hexsha string | size int64 | ext string | lang string | max_stars_repo_path string | max_stars_repo_name string | max_stars_repo_head_hexsha string | max_stars_repo_licenses list | max_stars_count int64 | max_stars_repo_stars_event_min_datetime string | max_stars_repo_stars_event_max_datetime string | max_issues_repo_path string | max_issues_repo_name string | max_issues_repo_head_hexsha string | max_issues_repo_licenses list | max_issues_count int64 | max_issues_repo_issues_event_min_datetime string | max_issues_repo_issues_event_max_datetime string | max_forks_repo_path string | max_forks_repo_name string | max_forks_repo_head_hexsha string | max_forks_repo_licenses list | max_forks_count int64 | max_forks_repo_forks_event_min_datetime string | max_forks_repo_forks_event_max_datetime string | content string | avg_line_length float64 | max_line_length int64 | alphanum_fraction float64 |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
990a19c5fbc553f6df9acc492a0eaf09e2db162e | 2,430 | js | JavaScript | leste contacts/src/componets/TableRow.js | mundotv789123/desafio | 60f5c22e553fe22fa21edf3b7178ca4586cc5f52 | [
"MIT"
] | null | null | null | leste contacts/src/componets/TableRow.js | mundotv789123/desafio | 60f5c22e553fe22fa21edf3b7178ca4586cc5f52 | [
"MIT"
] | null | null | null | leste contacts/src/componets/TableRow.js | mundotv789123/desafio | 60f5c22e553fe22fa21edf3b7178ca4586cc5f52 | [
"MIT"
] | null | null | null | import styled from 'styled-components';
function TableRow(drops) {
const contact = (drops.contact ? drops.contact : {})
const Row = styled.tr`
{
transition: all 0.3s ease;
cursor: pointer;
}
&:hover {
-webkit-transform: translateY(-4px);
-ms-transform: translateY(-4px);
transform: translateY(-4px);
}
`;
/* A linha que será usada para adicionar novo contato */
const RowPlus = { backgroundColor: 'rgb(223, 255, 255)' } ;
function getAge(date) {
if (!date) {
return 0;
}
let today = new Date();
let byear = date.split('-')[0];
let bmonth = date.split('-')[1];
let bday = date.split('-')[2];
let age = (today.getFullYear() - byear + ((today.getMonth > bmonth && today.getDay > bday) ? 1 : 0));
return age;
}
return (
<Row style={(!contact.id ? RowPlus : {})} id={'contacts-'+ (contact.id?contact.id:'plus')}>
<td>
<input className={'name'} placeholder={'Nome do contato'} type={'text'} defaultValue={(contact ? contact.first_name : '')}/>
</td>
<td>
<input className={'lastname'} placeholder={'Sobrenome do contato'} type={'text'} defaultValue={(contact ? contact.last_name : '')}/>
</td>
<td>
<input className={'contact'} placeholder={'Email de contato'} type={'text'} defaultValue={(contact ? contact.email : '')}/>
</td>
<td>
<select className={'gender'} defaultValue={contact.gender}>
<option value={'M'}>Masculino</option>
<option value={'F'}>Feminino</option>
</select>
</td>
<td>
<input className={'language'} placeholder={'Idioma do contato'} type={'text'} defaultValue={contact.language} />
</td>
<td style={{textAlign: 'center'}}>
<p>{contact.birthday ? getAge(contact.birthday) : 0}</p>
</td>
<td>
<input className={'birthday'} type={'date'} defaultValue={(contact ? contact.birthday : '')}/>
</td>
<td style={{textAlign: 'center'}} className={"buttons"}>
{drops.children}
</td>
</Row>
)
};
export default TableRow; | 36.818182 | 148 | 0.499177 |
990a3a25fb1bf4e2dbde78755cd374f22aab05e8 | 5,454 | js | JavaScript | shopping-cart/js/orderShipping.js | WongWaiChung1015/chatbotcms-wcbot-server-2 | d304cfdc1ec0cf41a8824243a59ebfdac1b0e297 | [
"Apache-2.0"
] | 6 | 2018-01-31T01:22:39.000Z | 2021-02-01T12:41:18.000Z | shopping-cart/js/orderShipping.js | WongWaiChung1015/chatbotcms-wcbot-server-2 | d304cfdc1ec0cf41a8824243a59ebfdac1b0e297 | [
"Apache-2.0"
] | null | null | null | shopping-cart/js/orderShipping.js | WongWaiChung1015/chatbotcms-wcbot-server-2 | d304cfdc1ec0cf41a8824243a59ebfdac1b0e297 | [
"Apache-2.0"
] | 3 | 2018-04-04T17:56:41.000Z | 2019-11-16T19:00:22.000Z | "use strict";function SetupUI(){var e=$("#shipping_fee_form");e.form({on:"blur",inline:!0,fields:{ship_method:["empty"]}}),e.submit(function(e){return e.preventDefault(),!1}),$("#btn_proceed").click(onBtnProceed),$("#btn_back").click(onBtnBack)}function LoadShoppingCart(){return $.ajax({method:"GET",url:"ws/db_loadcart",data:{uid:window._userId,rid:window._recipientId}})}function LoadWcShipSetting(){return $.ajax({method:"GET",url:"ws/get_wc_ship_setting",timeout:15e3,data:{uid:window._userId,rid:window._recipientId}})}function renderShipInfo(){function e(e){return e&&0<e.length?e:"--"}$("#first_name").html(e(window._wcOrder.shipping.first_name)),$("#last_name").html(e(window._wcOrder.shipping.last_name)),$("#address1").html(e(window._wcOrder.shipping.address_1)),$("#address2").html(window._wcOrder.shipping.address_2),$("#city").html(e(window._wcOrder.shipping.city)),$("#state").html(e(window._wcOrder.shipping.state)),$("#postcode").html(e(window._wcOrder.shipping.postcode)),$("#country").html(e(window._wcOrder.shipping.country))}function CalculateTotal(){var t=0,n=0;window._wcOrder.line_items.forEach(function(e){t+=parseFloat(e.subtotal),n+=parseFloat(e.total_tax)}),window._totalAmount=t;var e=util.ParseCurrencyToDisp(window._shoppingCart.server_settings.currency,t);$("#order_totalamt").html(e);for(var o=[],r=null,i=0,d=_shipSettings.length;i<d;i++){var a=_shipSettings[i];if(0===a.locations.length)r=a;else{for(var s=!1,l=!1,p=!1,c=0,u=a.locations.length;c<u;c++){var w=a.locations[c];"country"===w.type?w.code===_wcOrder.shipping.country&&(s=!0):"postcode"===w.type&&(l=!0,IsPostcodeMatch(w.code,_wcOrder.shipping.postcode)&&(p=!0))}s&&(l?p&&o.push(a):o.push(a))}}var _='<option value="">Please select</option>';if(0===o.length)_+=MethodsToSelectOptionsMarkup("Locations not covered",r.methods);else for(i=0,d=o.length;i<d;++i){var h=o[i];_+=MethodsToSelectOptionsMarkup(h.zone.name,h.methods)}$('[name="ship_method"]').html(_);e=util.ParseCurrencyToDisp(window._shoppingCart.server_settings.currency,n);$("#order_totaltax").html(e)}function MethodsToSelectOptionsMarkup(e,t){for(var n=window._shoppingCart.server_settings.currency,o="",r=0;r<t.length;++r){var i,d,a=t[r],s=!0;switch(d=e+": ",a.method_id){case"free_shipping":if(i=0,"min_amount"===a.settings.requires.value){var l=parseFloat(a.settings.min_amount.value);if(window._totalAmount<l)continue}d+=a.method_title,d+=": Fee "+util.ParseCurrencyToDisp(n,0);break;case"flat_rate":case"local_pickup":i=ParseAndCalcShipCost(a.settings.cost.value),d+=a.method_title+": Fee "+util.ParseCurrencyToDisp(n,i);break;case"wc_services_usps":s=!1;break;default:$.alert({type:"red",useBootstrap:!1,title:"Error",content:"Unhandled shipping method: "+a.method_id})}s&&(o+="<option ",o+='value="'+a.method_id+'"',o+='data-title="'+a.method_title+'"',o+='data-cost="'+i+'">',o+=d,o+="</option>")}return o}function IsPostcodeMatch(e,t){var n=t.toLowerCase().trim(),o=e.toLowerCase().split("-");if(1===o.length)return o[0].trim()===n;if(2===o.length){var r=parseInt(o[0].trim()),i=parseInt(o[1].trim());if(i<r){var d=i;i=r,r=d}return r<=(n=parseInt(n))&&n<=i}return $.alert({type:"red",useBootstrap:!1,title:"Error",content:"Invalid WC Postcode: "+e}),!1}function ParseAndCalcShipCost(e){if(null==e||""==e)return 0;var t=e.toLowerCase().replace(/'/g,'"');return ParseWithLexer(t)}function EnableAllButtons(e){e?($("#btn_proceed").removeClass("disabled loading"),$("#btn_back").removeClass("disabled loading")):($("#btn_proceed").addClass("disabled loading"),$("#btn_back").addClass("disabled loading"))}function onBtnBack(e){e.preventDefault(),EnableAllButtons(!1),$.ajax({type:"DELETE",url:"ws/delete_order",data:{oid:window._orderId,uid:window._userId,rid:window._recipientId}}).done(function(e){"ok"===e&&(window.location.href="mwp?page=orderInfoInput&oid="+window._orderId+"&uid="+window._userId+"&rid="+window._recipientId)}).fail(function(e,t,n){EnableAllButtons(!0),$.alert({type:"red",useBootstrap:!1,title:e,content:n.responseText})})}function onBtnProceed(e){$("#shipping_fee_form").form("validate form")&&(EnableAllButtons(!1),$.when(SaveCart(),UpdateWcOrder()).done(function(e,t){"success"===e[1]&&"success"===t[1]&&(window.location.href="mwp?page=orderReview&oid="+window._orderId+"&uid="+window._userId+"&rid="+window._recipientId)}).fail(function(e,t,n){EnableAllButtons(!0),$.alert({type:"red",useBootstrap:!1,title:n,content:e.responseText})}))}function SaveCart(){delete window._shoppingCart.input_info,delete window._shoppingCart.cart_items,delete window._shoppingCart.server_settings,delete window._shoppingCart.order_pool;var e=$('[name="ship_method"]');return window._shoppingCart.ship_info={wc_order_id:window._wcOrder.id.toString(),method:e.val(),cost:e.find(":selected").data("cost").toString()},$.ajax({type:"POST",url:"ws/db_savecart",data:JSON.stringify({userId:window._userId,recipientId:window._recipientId,cart:window._shoppingCart}),contentType:"application/json"})}function UpdateWcOrder(){var e=$('[name="ship_method"]').find(":selected"),t={shipping_lines:[{method_id:e.val(),method_title:e.data("title"),total:numeral(e.data("cost")).format("0.00")}]};return $.ajax({type:"PUT",url:"ws/update_order",data:{userId:window._userId,recipientId:window._recipientId,orderId:window._orderId,updateProps:JSON.stringify(t)}})}$(document).ready(function(){renderShipInfo(),CalculateTotal(),$(".loading_wrapper").hide(),$(".loaded_wrapper").show(),SetupUI()}); | 5,454 | 5,454 | 0.735974 |
990acd133382ce33a8230ceaa8cca81e9ea48066 | 1,498 | js | JavaScript | src/app.js | mike820324/ComicSearchEngine | 19f44ddd4b36379d2aa1d7833ca5ad693fba9482 | [
"MIT"
] | 1 | 2015-08-17T13:32:04.000Z | 2015-08-17T13:32:04.000Z | src/app.js | mike820324/ComicSearchEngine | 19f44ddd4b36379d2aa1d7833ca5ad693fba9482 | [
"MIT"
] | 7 | 2015-02-26T13:06:09.000Z | 2015-03-11T17:40:33.000Z | src/app.js | mike820324/ComicSearchEngine | 19f44ddd4b36379d2aa1d7833ca5ad693fba9482 | [
"MIT"
] | null | null | null | import crawler from './lib/crawler';
import Indexer from './lib/indexer';
import Url from 'url';
import Opencc from 'opencc';
const opencc = new Opencc('tw2s.json');
import winston from 'winston';
let appLogger = new winston.Logger({
transports: [
new winston.transports.Console({
'timestamp': true,
'colorize': true
}),
],
});
let comicIndexer = new Indexer('./newdb');
let initLinks = [
'http://www.comicvip.com/comic/all.html',
'http://mh.99770.cc/comiclist/0',
'http://www.99comic.com/lists/',
'http://www.dmeden.com/comic/'
];
// init crawlers
let crawlers = initLinks.map(initLink => {
return new crawler(initLink, 1000);
});
let index = (err, comicList) => {
if(err) appLogger.log('error', err);
else {
let hostname = Url.parse(comicList[0].url).hostname;
// @fixme
// not a good pattern
if(hostname.includes('comicvip'))
comicIndexer.add('comicvip', comicList);
else if(hostname.includes('99770'))
comicIndexer.add('99770', comicList);
else if(hostname.includes('99comic'))
comicIndexer.add('99comic', comicList);
else if(hostname.includes('dmeden'))
comicIndexer.add('dmeden', comicList);
else
appLogger.log('error', 'can not find the proper indexer');
}
};
let main = () => {
for(crawler of crawlers) {
crawler.start(index);
}
};
main();
| 23.40625 | 70 | 0.586782 |
990adc1a0b8c4bfa935b48c79fbc3ace99679e1d | 17,218 | js | JavaScript | InvenTree/templates/js/barcode.js | onurtatli/InvenTree | 4ce479cf97cc62563ab08ed6123d3c6ca28ba6a3 | [
"MIT"
] | null | null | null | InvenTree/templates/js/barcode.js | onurtatli/InvenTree | 4ce479cf97cc62563ab08ed6123d3c6ca28ba6a3 | [
"MIT"
] | null | null | null | InvenTree/templates/js/barcode.js | onurtatli/InvenTree | 4ce479cf97cc62563ab08ed6123d3c6ca28ba6a3 | [
"MIT"
] | null | null | null | {% load i18n %}
function makeBarcodeInput(placeholderText='', hintText='') {
/*
* Generate HTML for a barcode input
*/
placeholderText = placeholderText || '{% trans "Scan barcode data here using wedge scanner" %}';
hintText = hintText || '{% trans "Enter barcode data" %}';
var html = `
<div class='form-group'>
<label class='control-label' for='barcode'>{% trans "Barcode" %}</label>
<div class='controls'>
<div class='input-group'>
<span class='input-group-addon'>
<span class='fas fa-qrcode'></span>
</span>
<input id='barcode' class='textinput textInput form-control' type='text' name='barcode' placeholder='${placeholderText}'>
</div>
<div id='hint_barcode_data' class='help-block'>${hintText}</div>
</div>
</div>
`;
return html;
}
function makeNotesField(options={}) {
var tooltip = options.tooltip || '{% trans "Enter optional notes for stock transfer" %}';
var placeholder = options.placeholder || '{% trans "Enter notes" %}';
return `
<div class='form-group'>
<label class='control-label' for='notes'>{% trans "Notes" %}</label>
<div class='controls'>
<div class='input-group'>
<span class='input-group-addon'>
<span class='fas fa-sticky-note'></span>
</span>
<input id='notes' class='textinput textInput form-control' type='text' name='notes' placeholder='${placeholder}'>
</div>
<div id='hint_notes' class='help_block'>${tooltip}</div>
</div>
</div>`;
}
/*
* POST data to the server, and handle standard responses.
*/
function postBarcodeData(barcode_data, options={}) {
var modal = options.modal || '#modal-form';
var url = options.url || '/api/barcode/';
var data = options.data || {};
data.barcode = barcode_data;
inventreePut(
url,
data,
{
method: 'POST',
error: function() {
enableBarcodeInput(modal, true);
showBarcodeMessage(modal, '{% trans "Server error" %}');
},
success: function(response, status) {
modalEnable(modal, false);
enableBarcodeInput(modal, true);
if (status == 'success') {
if ('success' in response) {
if (options.onScan) {
options.onScan(response);
}
} else if ('error' in response) {
showBarcodeMessage(
modal,
response.error,
'warning'
);
} else {
showBarcodeMessage(
modal,
'{% trans "Unknown response from server" %}',
'warning'
);
}
} else {
// Invalid response returned from server
showInvalidResponseError(modal, response, status);
}
}
}
)
}
function showBarcodeMessage(modal, message, style='danger') {
var html = `<div class='alert alert-block alert-${style}'>`;
html += message;
html += "</div>";
$(modal + ' #barcode-error-message').html(html);
}
function showInvalidResponseError(modal, response, status) {
showBarcodeMessage(modal, `{% trans "Invalid server response" %}<br>{% trans "Status" %}: '${status}'`);
}
function enableBarcodeInput(modal, enabled=true) {
var barcode = $(modal + ' #barcode');
barcode.prop('disabled', !enabled);
modalEnable(modal, enabled);
barcode.focus();
}
function getBarcodeData(modal) {
modal = modal || '#modal-form';
var el = $(modal + ' #barcode');
var barcode = el.val();
el.val('');
el.focus();
return barcode.trim();
}
function barcodeDialog(title, options={}) {
/*
* Handle a barcode display dialog.
*/
var modal = '#modal-form';
function sendBarcode() {
var barcode = getBarcodeData(modal);
if (barcode && barcode.length > 0) {
postBarcodeData(barcode, options);
}
}
$(modal).on('shown.bs.modal', function() {
$(modal + ' .modal-form-content').scrollTop(0);
var barcode = $(modal + ' #barcode');
// Handle 'enter' key on barcode
barcode.keyup(function(event) {
event.preventDefault();
if (event.which == 10 || event.which == 13) {
sendBarcode();
}
});
// Ensure the barcode field has focus
barcode.focus();
var form = $(modal).find('.js-modal-form');
// Override form submission
form.submit(function() {
return false;
});
// Callback for when the "submit" button is pressed on the modal
modalSubmit(modal, function() {
if (options.onSubmit) {
options.onSubmit();
}
});
if (options.onShow) {
options.onShow();
}
});
modalSetTitle(modal, title);
if (options.onSubmit) {
modalShowSubmitButton(modal, true);
} else {
modalShowSubmitButton(modal, false);
}
var content = '';
content += `<div class='alert alert-info alert-block'>{% trans "Scan barcode data below" %}</div>`;
content += `<div id='barcode-error-message'></div>`;
content += `<form class='js-modal-form' method='post'>`;
// Optional content before barcode input
content += `<div class='container' id='barcode-header'>`;
content += options.headerContent || '';
content += `</div>`;
content += makeBarcodeInput();
if (options.extraFields) {
content += options.extraFields;
}
content += `</form>`;
// Optional content after barcode input
content += `<div class='container' id='barcode-footer'>`;
content += options.footerContent || '';
content += '</div>';
modalSetContent(modal, content);
$(modal).modal({
backdrop: 'static',
keyboard: false,
});
if (options.preShow) {
options.preShow();
}
$(modal).modal('show');
}
function barcodeScanDialog() {
/*
* Perform a barcode scan,
* and (potentially) redirect the browser
*/
var modal = '#modal-form';
barcodeDialog(
"Scan Barcode",
{
onScan: function(response) {
if ('url' in response) {
$(modal).modal('hide');
// Redirect to the URL!
window.location.href = response.url;
} else {
showBarcodeMessage(
modal,
'{% trans "No URL in response" %}',
'warning'
);
}
}
},
);
}
/*
* Dialog for linking a particular barcode to a stock item.
*/
function linkBarcodeDialog(stockitem, options={}) {
var modal = '#modal-form';
barcodeDialog(
"{% trans 'Link Barcode to Stock Item' %}",
{
url: '/api/barcode/link/',
data: {
stockitem: stockitem,
},
onScan: function(response) {
$(modal).modal('hide');
location.reload();
}
}
);
}
/*
* Remove barcode association from a device.
*/
function unlinkBarcode(stockitem) {
var html = `<b>{% trans "Unlink Barcode" %}</b><br>`;
html += "{% trans 'This will remove the association between this stock item and the barcode' %}";
showQuestionDialog(
"{% trans 'Unlink Barcode' %}",
html,
{
accept_text: "{% trans 'Unlink' %}",
accept: function() {
inventreePut(
`/api/stock/${stockitem}/`,
{
// Clear the UID field
uid: '',
},
{
method: 'PATCH',
success: function(response, status) {
location.reload();
},
},
);
},
}
);
}
/*
* Display dialog to check multiple stock items in to a stock location.
*/
function barcodeCheckIn(location_id, options={}) {
var modal = '#modal-form';
// List of items we are going to checkin
var items = [];
function reloadTable() {
modalEnable(modal, false);
// Remove click listeners
$(modal + ' .button-item-remove').unbind('click');
var table = $(modal + ' #items-table-div');
var html = `
<table class='table table-condensed table-striped' id='items-table'>
<thead>
<tr>
<th>{% trans "Part" %}</th>
<th>{% trans "Location" %}</th>
<th>{% trans "Quantity" %}</th>
<th></th>
</tr>
</thead>
<tbody>`;
items.forEach(function(item) {
html += `
<tr pk='${item.pk}'>
<td>${imageHoverIcon(item.part_detail.thumbnail)} ${item.part_detail.name}</td>
<td>${item.location_detail.name}</td>
<td>${item.quantity}</td>
<td>${makeIconButton('fa-times-circle icon-red', 'button-item-remove', item.pk, '{% trans "Remove stock item" %}')}</td>
</tr>`;
});
html += `
</tbody>
</table>`;
table.html(html);
modalEnable(modal, items.length > 0);
$(modal + ' #barcode').focus();
$(modal + ' .button-item-remove').unbind('click').on('mouseup', function() {
var pk = $(this).attr('pk');
var match = false;
for (var ii = 0; ii < items.length; ii++) {
if (pk.toString() == items[ii].pk.toString()) {
items.splice(ii, 1);
match = true;
break;
}
}
if (match) {
reloadTable();
}
return false;
});
}
var table = `<div class='container' id='items-table-div' style='width: 80%; float: left;'></div>`;
// Extra form fields
var extra = makeNotesField();
barcodeDialog(
'{% trans "Check Stock Items into Location" %}',
{
headerContent: table,
preShow: function() {
modalSetSubmitText(modal, '{% trans "Check In" %}');
modalEnable(modal, false);
reloadTable();
},
onShow: function() {
},
extraFields: extra,
onSubmit: function() {
// Called when the 'check-in' button is pressed
var data = {location: location_id};
// Extract 'notes' field
data.notes = $(modal + ' #notes').val();
var entries = [];
items.forEach(function(item) {
entries.push({
pk: item.pk,
quantity: item.quantity,
});
});
data.items = entries;
inventreePut(
"{% url 'api-stock-transfer' %}",
data,
{
method: 'POST',
success: function(response, status) {
// Hide the modal
$(modal).modal('hide');
if (status == 'success' && 'success' in response) {
showAlertOrCache('alert-success', response.success, true);
location.reload();
} else {
showAlertOrCache('alert-success', '{% trans "Error transferring stock" %}', false);
}
}
}
);
},
onScan: function(response) {
if ('stockitem' in response) {
stockitem = response.stockitem;
var duplicate = false;
items.forEach(function(item) {
if (item.pk == stockitem.pk) {
duplicate = true;
}
});
if (duplicate) {
showBarcodeMessage(modal, '{% trans "Stock Item already scanned" %}', "warning");
} else {
if (stockitem.location == location_id) {
showBarcodeMessage(modal, '{% trans "Stock Item already in this location" %}');
return;
}
// Add this stock item to the list
items.push(stockitem);
showBarcodeMessage(modal, '{% trans "Added stock item" %}', "success");
reloadTable();
}
} else {
// Barcode does not match a stock item
showBarcodeMessage(modal, '{% trans "Barcode does not match Stock Item" %}', "warning");
}
},
}
);
}
/*
* Display dialog to check a single stock item into a stock location
*/
function scanItemsIntoLocation(item_id_list, options={}) {
var modal = options.modal || '#modal-form';
var stock_location = null;
// Extra form fields
var extra = makeNotesField();
// Header contentfor
var header = `
<div id='header-div'>
</div>
`;
function updateLocationInfo(location) {
var div = $(modal + ' #header-div');
if (stock_location && stock_location.pk) {
div.html(`
<div class='alert alert-block alert-info'>
<b>{% trans "Location" %}</b></br>
${stock_location.name}<br>
<i>${stock_location.description}</i>
</div>
`);
} else {
div.html('');
}
}
barcodeDialog(
'{% trans "Check Into Location" %}',
{
headerContent: header,
extraFields: extra,
preShow: function() {
modalSetSubmitText(modal, '{% trans "Check In" %}');
modalEnable(modal, false);
},
onShow: function() {
},
onSubmit: function() {
// Called when the 'check-in' button is pressed
if (!stock_location) {
return;
}
var items = [];
item_id_list.forEach(function(pk) {
items.push({
pk: pk,
});
})
var data = {
location: stock_location.pk,
notes: $(modal + ' #notes').val(),
items: items,
};
// Send API request
inventreePut(
'{% url "api-stock-transfer" %}',
data,
{
method: 'POST',
success: function(response, status) {
// First hide the modal
$(modal).modal('hide');
if (status == 'success' && 'success' in response) {
showAlertOrCache('alert-success', response.success, true);
location.reload();
} else {
showAlertOrCache('alert-danger', '{% trans "Error transferring stock" %}', false);
}
}
}
)
},
onScan: function(response) {
updateLocationInfo(null);
if ('stocklocation' in response) {
// Barcode corresponds to a StockLocation
stock_location = response.stocklocation;
updateLocationInfo(stock_location);
modalEnable(modal, true);
} else {
// Barcode does *NOT* correspond to a StockLocation
showBarcodeMessage(
modal,
'{% trans "Barcode does not match a valid location" %}',
"warning",
);
}
}
}
)
} | 28.133987 | 137 | 0.445116 |
990ae89b7dcf07e39fe84676b52053433cc8e08c | 63 | js | JavaScript | app/javascript/vue/tasks/digitize/store/getters/getTypeMaterial.js | NaturalHistoryMuseum/taxonworks | fadf26fb3218279f625c6ce85104e3d66891f964 | [
"NCSA"
] | null | null | null | app/javascript/vue/tasks/digitize/store/getters/getTypeMaterial.js | NaturalHistoryMuseum/taxonworks | fadf26fb3218279f625c6ce85104e3d66891f964 | [
"NCSA"
] | null | null | null | app/javascript/vue/tasks/digitize/store/getters/getTypeMaterial.js | NaturalHistoryMuseum/taxonworks | fadf26fb3218279f625c6ce85104e3d66891f964 | [
"NCSA"
] | null | null | null | export default function(state) {
return state.type_material
} | 21 | 32 | 0.793651 |
990b28ca74e1de6ea04071100df099f43fe46c4b | 1,898 | js | JavaScript | lib/resthelper.js | Loksly/redistack | 3afec0a27231b8b62412ec0ce95b62c371f5d339 | [
"MIT"
] | null | null | null | lib/resthelper.js | Loksly/redistack | 3afec0a27231b8b62412ec0ce95b62c371f5d339 | [
"MIT"
] | null | null | null | lib/resthelper.js | Loksly/redistack | 3afec0a27231b8b62412ec0ce95b62c371f5d339 | [
"MIT"
] | null | null | null | (function(module, logger){
'use strict';
const Q = require('q'),
SIZE = 30;
function RestHelper(databasehandler, entity){
this.databasehandler = databasehandler;
this.entity = entity;
}
function failHandler(res){
return function(err){
logger.error(res, err);
res.status(500).json(err).end();
};
}
RestHelper.prototype.getById = function() {
let instance = this;
return function(req, res){
if (typeof req.params.id === 'undefined'){
res.status(404).end();
} else {
let id = req.params.id;
instance
.databasehandler
.findByKey(instance.entity, id)
.then(function(data){
if (data){
res.json(data);
} else {
res.status(404).end();
}
}, failHandler(res));
}
};
};
RestHelper.prototype.find = function(postFilter){
let instance = this;
return function(req, res){
let restriction = '';
for (var attr in req.query){
if (attr !== 'page'){
restriction = attr + '|' + req.query[attr];
}
}
let numpage = 1;
if (typeof req.query.page === 'string'){
numpage = parseInt(req.query.page);
}
instance
.databasehandler
.membersOfSet(instance.entity, restriction)
.then(function(data){
if (data){
Q.all(data.slice(-SIZE * numpage).map(function(o){
return instance
.databasehandler
.findByKey(instance.entity, o);
}))
.then(function(docs){
if (postFilter){
docs = docs.filter(postFilter);
}
res.json(docs);
})
} else {
res.status(404).end();
}
}, failHandler(res));
};
};
RestHelper.prototype.flush = function(){
let instance = this;
return function(req, res){
instance
.databasehandler
.flush()
.then(function(){
res.json({});
}, failHandler(res));
};
};
module.exports = RestHelper;
})(module, console);
| 20.857143 | 56 | 0.581665 |
990c505d22c60ab1400b37ea799170e8fdd77e8d | 801 | js | JavaScript | test/middleware.test.js | sumbad/fastify | 538fe6391cd2598b3435f71b23125026b730af24 | [
"MIT"
] | 1 | 2022-03-21T04:48:49.000Z | 2022-03-21T04:48:49.000Z | test/middleware.test.js | sumbad/fastify | 538fe6391cd2598b3435f71b23125026b730af24 | [
"MIT"
] | 68 | 2021-09-23T07:18:38.000Z | 2022-03-30T07:28:37.000Z | test/middleware.test.js | sumbad/fastify | 538fe6391cd2598b3435f71b23125026b730af24 | [
"MIT"
] | null | null | null | 'use strict'
const { test } = require('tap')
const Fastify = require('..')
const {
FST_ERR_DEC_ALREADY_PRESENT
} = require('../lib/errors')
test('Should be able to override the default use API', t => {
t.plan(1)
const fastify = Fastify()
fastify.decorate('use', () => true)
t.equal(fastify.use(), true)
})
test('Cannot decorate use twice', t => {
t.plan(1)
const fastify = Fastify()
fastify.decorate('use', () => true)
try {
fastify.decorate('use', () => true)
} catch (err) {
t.ok(err instanceof FST_ERR_DEC_ALREADY_PRESENT)
}
})
test('Encapsulation works', t => {
t.plan(1)
const fastify = Fastify()
fastify.register((instance, opts, done) => {
instance.decorate('use', () => true)
t.equal(instance.use(), true)
done()
})
fastify.ready()
})
| 20.538462 | 61 | 0.616729 |
990c54fb1a9adb9d874a03ffc72bb8ce4238cbd5 | 115 | js | JavaScript | samples/widgets/containers/accordion/index.js | eliace/ergojs-site | 4f9913490cc12085f2811dbb838368f2f5879e5c | [
"MIT"
] | null | null | null | samples/widgets/containers/accordion/index.js | eliace/ergojs-site | 4f9913490cc12085f2811dbb838368f2f5879e5c | [
"MIT"
] | null | null | null | samples/widgets/containers/accordion/index.js | eliace/ergojs-site | 4f9913490cc12085f2811dbb838368f2f5879e5c | [
"MIT"
] | null | null | null |
$context.section('Basic');
//= require accordion-basic
$context.section('Box');
//= require accordion-box
| 8.214286 | 27 | 0.66087 |
990cde9f8035912c798f86d01289b1f8cc694297 | 89 | js | JavaScript | lib/accessibility/index.js | N0taN3rd/chrome-remote-interface-extra | 1c57e0d8ea19969a4373af45daf557960c4f1c64 | [
"Apache-2.0"
] | 10 | 2019-02-10T14:57:08.000Z | 2022-03-12T06:31:02.000Z | lib/accessibility/index.js | N0taN3rd/chrome-remote-interface-extra | 1c57e0d8ea19969a4373af45daf557960c4f1c64 | [
"Apache-2.0"
] | 4 | 2020-07-16T18:11:23.000Z | 2021-09-01T01:04:22.000Z | lib/accessibility/index.js | N0taN3rd/chrome-remote-interface-extra | 1c57e0d8ea19969a4373af45daf557960c4f1c64 | [
"Apache-2.0"
] | 1 | 2021-07-16T03:02:13.000Z | 2021-07-16T03:02:13.000Z | exports.Accessibility = require('./Accessibility')
exports.AXNode = require('./AXNode')
| 22.25 | 50 | 0.741573 |
990d0f9dc881eaa10adb1760ba6901209ec5b485 | 94 | js | JavaScript | app/views/room.js | webmasteradmin/FlyMyFile | ff56ad3e83fa7b1f49aea3cdfa48a3d49ba5fef4 | [
"MIT"
] | null | null | null | app/views/room.js | webmasteradmin/FlyMyFile | ff56ad3e83fa7b1f49aea3cdfa48a3d49ba5fef4 | [
"MIT"
] | null | null | null | app/views/room.js | webmasteradmin/FlyMyFile | ff56ad3e83fa7b1f49aea3cdfa48a3d49ba5fef4 | [
"MIT"
] | null | null | null | import Ember from 'ember';
export default Ember.View.extend({
templateName: 'index'
});
| 15.666667 | 35 | 0.691489 |
990d636446006f42c3b7c994bc4c38847f5aa53f | 50 | js | JavaScript | app/models/extra.js | Macainian/ember-osf-test | f1d6668886de202300c2c4e020ebb0526730947c | [
"MIT"
] | null | null | null | app/models/extra.js | Macainian/ember-osf-test | f1d6668886de202300c2c4e020ebb0526730947c | [
"MIT"
] | null | null | null | app/models/extra.js | Macainian/ember-osf-test | f1d6668886de202300c2c4e020ebb0526730947c | [
"MIT"
] | null | null | null | export { default } from 'ember-osf/models/extra';
| 25 | 49 | 0.72 |
990e2143cf2580554be8a5e8bf785335877579f9 | 2,267 | js | JavaScript | src/Particle.js | mcteapot/bounce.js | b14d310978e28c163ab91cc737df22f372b61cfd | [
"Unlicense"
] | 1 | 2015-04-19T15:06:40.000Z | 2015-04-19T15:06:40.000Z | src/Particle.js | mcteapot/bounce.js | b14d310978e28c163ab91cc737df22f372b61cfd | [
"Unlicense"
] | null | null | null | src/Particle.js | mcteapot/bounce.js | b14d310978e28c163ab91cc737df22f372b61cfd | [
"Unlicense"
] | null | null | null | /**
* @author mcteapot / http://cyborgdino.com/
*/
BOUNCE.Particle = function () {
this.position = new BOUNCE.Vector3();
this.velocity = new BOUNCE.Vector3();
forceAccum = new BOUNCE.Vector3();
this.acceleration = new BOUNCE.Vector3();
this.damping;
this.inverseMass;
};
BOUNCE.Particle.prototype = {
constructor: BOUNCE.Particle,
integrate: function ( duration ) {
if ( duration > 0.0 ) {
this.position.addScaledVector( this.velocity, duration );
var resultingAcc = this.acceleration.clone;
resultingAcc.addScaledVector( this.forceAccum, this.inverseMass );
velocity.addScaledVector( resultingAcc, this.duration );
velocity.multiplyScalar( Math.pow( this.damping, duration ) );
this.clearAccumulator();
} else {
console.error( "duration < 0.0" );
}
},
setMass: function ( mass ) {
if ( mass != 0 ) {
this.inverseMass = ( 1.0 / mass );
} else {
console.error( "mass == 0" );
}
},
mass: function () {
if ( this.inverseMass ) {
return ( 1.0 / this.inverseMass );
} else if ( this.inverseMass === 0 ) {
return Number.NaN;
} else {
console.error( "mass not set")
}
},
setInverseMass: function ( inverseMass ) {
this.inverseMass = inverseMass;
},
hasFiniteMass: function () {
return this.inverseMass >= 0.0;
},
setDamping: function ( damping ) {
this.damping = damping;
},
setPosition: function ( x, y, z ) {
this.position.set( x, y, z );
},
setPositionVector: function ( v ) {
this.position.setVector( v );
},
setVelocity: function ( x, y, z ) {
this.velocity.set( x, y, z );
},
setVelocityVector: function ( v ) {
this.velocity.setVector( v );
},
setAcceleration: function ( x, y, z ) {
this.acceleration.set( x, y, z );
},
setAccelerationVector: function ( v ) {
this.acceleration.setVector( v );
},
clearAccumulator: function () {
this.forceAccum.clear();
},
addForce: function ( v ) {
this.forceAccum.addUpdate( v );
}
}; | 15.964789 | 69 | 0.551831 |
990f2a76a3656ec5259cad6792d19c82d9b7b34b | 1,028 | js | JavaScript | components/data.js | RomanMunar/chklst | e677664d18ca623453413b8d1a63863efe67304d | [
"Apache-2.0"
] | 5 | 2021-04-02T07:39:47.000Z | 2021-04-02T12:51:32.000Z | components/data.js | RomanMunar/chklst | e677664d18ca623453413b8d1a63863efe67304d | [
"Apache-2.0"
] | 7 | 2021-04-02T08:21:51.000Z | 2021-04-02T17:40:08.000Z | components/data.js | RomanMunar/chklst | e677664d18ca623453413b8d1a63863efe67304d | [
"Apache-2.0"
] | 7 | 2021-04-02T07:41:11.000Z | 2021-04-02T17:35:47.000Z | const fs = require('fs');
const path = require('path');
/**
* Path to contributors json files
*/
const jsonFilePath = `components/contributors`;
/**
* Sample file
*/
const sampleJsonFile = `[name-sample].json`;
/**
* @return {Array} Json data of all contributors
*/
const readAllTheJsonFiles = () => {
// file directory to all json files
const jsonFileDirectory = path.join(process.cwd(), jsonFilePath);
// check all the available files on given directory
const filenames = fs.readdirSync(jsonFileDirectory);
// read all the available files and return it as JSON Array
return filenames.filter(filename => filename !== sampleJsonFile)
.map(filename => {
// path of each file
const filePath = path.join(jsonFileDirectory, filename);
// reading the content
const fileContents = fs.readFileSync(filePath, 'utf8');
// parsing the raw data to actual JSON Format
return JSON.parse(fileContents)
});
}
const plainData = readAllTheJsonFiles();
export default plainData; | 20.979592 | 67 | 0.694553 |
990f63e5ad1648d923998fc8efa5667f3566c107 | 952 | js | JavaScript | config/tasks/setup/modules/setup-bundle.js | Threstle/test-nestor | a7fb89487e529a857fcde9455e1c9766c863d602 | [
"MIT"
] | null | null | null | config/tasks/setup/modules/setup-bundle.js | Threstle/test-nestor | a7fb89487e529a857fcde9455e1c9766c863d602 | [
"MIT"
] | null | null | null | config/tasks/setup/modules/setup-bundle.js | Threstle/test-nestor | a7fb89487e529a857fcde9455e1c9766c863d602 | [
"MIT"
] | null | null | null | const { logs } = require("../../../helpers/logs-helper");
const { scaffoldBundle } = require("../../scaffold-bundle");
const debug = require("debug")("config:setup-bundle");
// ----------------------------------------------------------------------------- PATHS / CONFIG
// target local path files
const paths = require("../../../global.paths");
// get local task config
const config = require("../../../global.config");
// ----------------------------------------------------------------------------- MODULE
/**
* Setup Bundle
* @returns {Promise<unknown>}
*/
const setupBundle = async ({
logDoneDelay = config.logDoneDelay,
scaffoldBundleFunction = scaffoldBundle,
}) => {
return new Promise(async (resolve) => {
logs.start("Setup bundle project type...");
const bundleType = await scaffoldBundleFunction(true);
logs.done();
setTimeout(() => resolve(bundleType), logDoneDelay);
});
};
module.exports = { setupBundle };
| 30.709677 | 95 | 0.546218 |
990fa7716f397590daf15aec8000b154eacaa6cc | 1,478 | js | JavaScript | apiGateway/routers/echarts/line/relative-displacement-statistics.js | liuyibin23/iovVis | db1182a3c238e83e95258bd331a44ee8cfbbc629 | [
"Apache-2.0",
"MIT"
] | null | null | null | apiGateway/routers/echarts/line/relative-displacement-statistics.js | liuyibin23/iovVis | db1182a3c238e83e95258bd331a44ee8cfbbc629 | [
"Apache-2.0",
"MIT"
] | null | null | null | apiGateway/routers/echarts/line/relative-displacement-statistics.js | liuyibin23/iovVis | db1182a3c238e83e95258bd331a44ee8cfbbc629 | [
"Apache-2.0",
"MIT"
] | null | null | null | const charCfg = require('../../echarts/chartConfig');
const common = require('./common-line');
let option = {
title : {
text: '相对位移监测数据统计分析',
x: 'center',
y:'bottom'
},
legend: {
data:['最大位移', '平均位移', '最小位移'],
//orient: 'vertical',
x:'center',
y:'top',
//backgroundColor: '#eee',
//borderColor: 'rgba(178,34,34,0.8)',
borderWidth: 1
},
toolbox: {
show : false
},
calculable : false,
xAxis : [
{
type : 'category',
boundaryGap : false,
axisLabel: {
rotate:30,
},
data : []
}
],
yAxis : [
{
type : 'value',
axisLabel : {
formatter: '{value} mm'
}
}
],
series : [
{
name:'最大位移',
type:'line',
data:[]
},
{
name:'平均位移',
type:'line',
data:[]
},
{
name:'最小位移',
type:'line',
data:[]
}
]
};
var chart_area = {
name: 'chart_data',
version: '1.0.0',
fillData: function (params, token, res, calllback) {
plotCfg = charCfg.getCfgParams(params.chart_name, 'LINE');
common.resetPreData(option, plotCfg.maxCnt);
common.getData(plotCfg, option, params, token, res);
}
}
module.exports = chart_area; | 20.816901 | 66 | 0.420839 |
99105259765ad8ff26077b8fa092f1103f2df0af | 1,187 | js | JavaScript | src/lightbox/LightboxScreen.js | akashnimare/zulip-mobile | 009e9b6d009a0f5a6901b5316395722cabd6fc75 | [
"Apache-2.0"
] | null | null | null | src/lightbox/LightboxScreen.js | akashnimare/zulip-mobile | 009e9b6d009a0f5a6901b5316395722cabd6fc75 | [
"Apache-2.0"
] | null | null | null | src/lightbox/LightboxScreen.js | akashnimare/zulip-mobile | 009e9b6d009a0f5a6901b5316395722cabd6fc75 | [
"Apache-2.0"
] | null | null | null | /* @flow */
import React, { PureComponent } from 'react';
import { View, StyleSheet } from 'react-native';
import type { NavigationScreenProp } from 'react-navigation';
import { ActionSheetProvider } from '@expo/react-native-action-sheet';
import { ZulipStatusBar } from '../common';
import Lightbox from './Lightbox';
import type { Message } from '../types';
const styles = StyleSheet.create({
screen: {
flex: 1,
flexDirection: 'column',
alignItems: 'stretch',
backgroundColor: 'black',
},
});
type Props = {
navigation: NavigationScreenProp<*> & {
state: {
params: {
src: string,
message: Message,
},
},
},
};
export default class LightboxScreen extends PureComponent<Props> {
props: Props;
render() {
const { src, message } = this.props.navigation.state.params;
return (
<View style={styles.screen}>
{/* $FlowFixMe-56 Cannot create ZulipStatusBar element because ST is not a React component. */}
<ZulipStatusBar hidden backgroundColor="black" />
<ActionSheetProvider>
<Lightbox src={src} message={message} />
</ActionSheetProvider>
</View>
);
}
}
| 25.255319 | 103 | 0.634372 |
99107267d298dda053e8cf0e250055a503717c90 | 371 | js | JavaScript | src/components/Wrapper/WrapperService.js | lzwUpUpUp/Aterminator | 492879927a2296c85e39349781848e5ef196017b | [
"MIT"
] | 9 | 2020-03-09T08:24:57.000Z | 2021-03-08T13:07:29.000Z | src/components/Wrapper/WrapperService.js | lzwUpUpUp/Aterminator | 492879927a2296c85e39349781848e5ef196017b | [
"MIT"
] | 4 | 2020-06-30T06:31:46.000Z | 2022-02-26T19:52:18.000Z | src/components/Wrapper/WrapperService.js | WX-DongXing/terminator | 104e3bd74d4e6f9cbb5acead5cb09114b53f53a1 | [
"MIT"
] | 5 | 2020-04-23T12:33:28.000Z | 2021-11-15T07:58:52.000Z | import { Subject } from 'rxjs'
export default class WrapperService {
constructor () {
if (!WrapperService.prototype.instance) {
this.change = new Subject()
this.change$ = this.change.asObservable()
WrapperService.prototype.instance = this
}
return WrapperService.prototype.instance
}
next (event) {
this.change.next(event)
}
}
| 21.823529 | 47 | 0.671159 |
9911383ebc41b23c0b547dba41820b414d45a263 | 2,858 | js | JavaScript | src/store/locationTemplate.js | mcmatan/stackedit | 4a97ca9891f8a8800fd174b191f5ab74d5aa0e33 | [
"Apache-2.0"
] | 16,372 | 2015-01-01T13:35:12.000Z | 2022-03-31T18:04:48.000Z | src/store/locationTemplate.js | mcmatan/stackedit | 4a97ca9891f8a8800fd174b191f5ab74d5aa0e33 | [
"Apache-2.0"
] | 1,214 | 2015-01-02T17:07:22.000Z | 2022-03-25T12:23:04.000Z | src/store/locationTemplate.js | liusanman/stackedit | 87ddfb9000999df21d13e0e743fd057dd9e7b3f7 | [
"Apache-2.0"
] | 3,023 | 2015-01-01T15:16:29.000Z | 2022-03-31T08:07:12.000Z | import moduleTemplate from './moduleTemplate';
import providerRegistry from '../services/providers/common/providerRegistry';
import utils from '../services/utils';
const addToGroup = (groups, item) => {
const list = groups[item.fileId];
if (!list) {
groups[item.fileId] = [item];
} else {
list.push(item);
}
};
export default (empty) => {
const module = moduleTemplate(empty);
module.getters = {
...module.getters,
groupedByFileId: (state, { items }) => {
const groups = {};
items.forEach(item => addToGroup(groups, item));
return groups;
},
groupedByFileIdAndHash: (state, { items }) => {
const fileIdGroups = {};
items.forEach((item) => {
let hashGroups = fileIdGroups[item.fileId];
if (!hashGroups) {
hashGroups = {};
fileIdGroups[item.fileId] = hashGroups;
}
const list = hashGroups[item.hash];
if (!list) {
hashGroups[item.hash] = [item];
} else {
list.push(item);
}
});
return fileIdGroups;
},
filteredGroupedByFileId: (state, { items }) => {
const groups = {};
items
.filter((item) => {
// Filter items that we can't use
const provider = providerRegistry.providersById[item.providerId];
return provider && provider.getToken(item);
})
.forEach(item => addToGroup(groups, item));
return groups;
},
current: (state, { filteredGroupedByFileId }, rootState, rootGetters) => {
const locations = filteredGroupedByFileId[rootGetters['file/current'].id] || [];
return locations.map((location) => {
const provider = providerRegistry.providersById[location.providerId];
return {
...location,
description: utils.sanitizeName(provider.getLocationDescription(location)),
url: provider.getLocationUrl(location),
};
});
},
currentWithWorkspaceSyncLocation: (state, { current }, rootState, rootGetters) => {
const fileId = rootGetters['file/current'].id;
const fileSyncData = rootGetters['data/syncDataByItemId'][fileId];
const contentSyncData = rootGetters['data/syncDataByItemId'][`${fileId}/content`];
if (!fileSyncData || !contentSyncData) {
return current;
}
// Add the workspace sync location
const workspaceProvider = providerRegistry.providersById[
rootGetters['workspace/currentWorkspace'].providerId];
return [{
id: 'main',
providerId: workspaceProvider.id,
fileId,
description: utils.sanitizeName(workspaceProvider
.getSyncDataDescription(fileSyncData, contentSyncData)),
url: workspaceProvider.getSyncDataUrl(fileSyncData, contentSyncData),
}, ...current];
},
};
return module;
};
| 32.850575 | 88 | 0.615465 |
991146abd91c6d11feae188796ae9636f73fd0cc | 2,566 | js | JavaScript | ui/src/Component/Header/Header.js | PowerMagicUniversity/deepstream_360_d_smart_parking_application | e7f73583680750aa60adffa0fc3cf5b063c92a6a | [
"MIT"
] | 294 | 2018-11-14T19:48:18.000Z | 2022-03-21T20:06:51.000Z | ui/src/Component/Header/Header.js | PowerMagicUniversity/deepstream_360_d_smart_parking_application | e7f73583680750aa60adffa0fc3cf5b063c92a6a | [
"MIT"
] | 33 | 2018-11-22T04:31:11.000Z | 2021-12-30T15:53:10.000Z | ui/src/Component/Header/Header.js | PowerMagicUniversity/deepstream_360_d_smart_parking_application | e7f73583680750aa60adffa0fc3cf5b063c92a6a | [
"MIT"
] | 115 | 2018-11-15T06:21:32.000Z | 2022-02-24T05:48:57.000Z | import React from 'react';
import FontAwesomeIcon from '@fortawesome/react-fontawesome';
import { faQuestionCircle, faExclamationTriangle } from '@fortawesome/free-solid-svg-icons';
import { Navbar, Nav, NavItem } from 'react-bootstrap';
import { Tooltip, OverlayTrigger } from 'react-bootstrap';
import classes from './Header.css';
import logo from '../../assets/NVLogo-H-White-Small.png';
/**
* Header.js contains
* 1) nvidia's logo;
* 2) app's name;
* 3) search bar with drop-down calendar;
* 4) alert icon which is an exclamation triangle will be triggered by invalid time bounds in search;
* 5) question mark icon without hyperlink;
* 6) tool icon without hyperlink.
*/
const header = (props) => {
let alertIcon;
if ( window.location.hash === "#/home" || props.isTimeValid ) {
alertIcon = (
<Nav pullRight >
<NavItem>
{null}
</NavItem>
</Nav>
);
}
else {
alertIcon = (
<OverlayTrigger placement='left' overlay={<Tooltip id="tooltip" >Invalid time</Tooltip>} >
<Nav pullRight >
<NavItem>
<FontAwesomeIcon icon={faExclamationTriangle} color="red" />
</NavItem>
</Nav>
</OverlayTrigger>
);
}
return (
<Navbar inverse fixedTop fluid className={classes.Header}>
<Navbar.Header>
{/* left nvidia brand */}
<Navbar.Brand>
<a href="/">
<img alt="Nvidia" src={logo} />
</a>
</Navbar.Brand>
{/* center METROPOLIS text */}
<Navbar.Brand className={classes.center}>METROPOLIS</Navbar.Brand>
<Navbar.Toggle />
</Navbar.Header>
<Navbar.Collapse>
{/* right end question to other websites */}
<Nav pullRight>
<NavItem className={classes.questioncircle}>
<FontAwesomeIcon icon={faQuestionCircle} />
</NavItem>
</Nav>
{/* alert icon if time query is invalid */}
{alertIcon}
{/* search input group */}
<Navbar.Form pullRight style={{ textAlign: 'right' }}>
{props.children}
</Navbar.Form>
</Navbar.Collapse>
</Navbar>
);
};
export default header; | 34.675676 | 102 | 0.508184 |
9911fe363ee72f64fb029f8777afb102ddc8c450 | 178 | js | JavaScript | vue.config.js | iandroogmans/vue-business-hours | 53a5219d2d51926948f9397ccbc1bffd1690ad28 | [
"MIT"
] | 47 | 2019-05-17T22:46:14.000Z | 2021-12-16T08:53:46.000Z | vue.config.js | iandroogmans/vue-business-hours | 53a5219d2d51926948f9397ccbc1bffd1690ad28 | [
"MIT"
] | 21 | 2019-05-18T23:01:12.000Z | 2022-01-09T15:10:47.000Z | vue.config.js | iandroogmans/vue-business-hours | 53a5219d2d51926948f9397ccbc1bffd1690ad28 | [
"MIT"
] | 26 | 2019-05-17T22:35:09.000Z | 2022-01-09T22:43:28.000Z | module.exports = {
chainWebpack: config => {
// Remove the old entry and add the new one
config
.entry('app')
.clear()
.add('./demo/main.js');
}
};
| 17.8 | 47 | 0.533708 |
991315d52180a7061badb37c4c5e35b6efdfcdfc | 5,007 | js | JavaScript | packages/remediations/src/steps/ExistingOrNew.js | Sergey1011010/frontend-components | fbeeb6f025299b59ab4a11dbda691209175d7df4 | [
"Apache-2.0"
] | null | null | null | packages/remediations/src/steps/ExistingOrNew.js | Sergey1011010/frontend-components | fbeeb6f025299b59ab4a11dbda691209175d7df4 | [
"Apache-2.0"
] | 3 | 2022-02-13T20:42:14.000Z | 2022-02-27T10:32:23.000Z | packages/remediations/src/steps/ExistingOrNew.js | karelhala/frontend-components_old | 31038e0a22eb5b7d7d62e3d5c9f51fce17719fed | [
"Apache-2.0"
] | null | null | null | import React, { Component } from 'react';
import propTypes from 'prop-types';
import {
Form,
FormGroup,
Grid, GridItem,
Radio,
FormSelect,
FormSelectOption,
TextInput,
Stack, StackItem
} from '@patternfly/react-core';
import { Skeleton, SkeletonSize } from '@redhat-cloud-services/frontend-components/components/Skeleton';
import './ExistingOrNew.scss';
function ExistingOrNewStep(props) {
const { name, nameValid, isNewSwitch, existingRemediations, selectedRemediationId } = props.state;
return (
<React.Fragment>
<Form className="ins-c-existing-or-new">
<Stack gutter='md'>
<StackItem>
<h1 className='ins-m-text__bold'>Do you want to modify an existing Playbook or create a new one?</h1>
</StackItem>
<StackItem>
<Grid>
<GridItem sm={ 12 } md={ 6 } lg={ 3 }>
<Radio
label={ existingRemediations ? `Existing Playbook (${existingRemediations.length})` : 'Existing Playbook' }
aria-label="Existing Playbook"
id="existing"
name="radio"
isDisabled={ !existingRemediations || !existingRemediations.length }
defaultChecked={ !props.state.isNewSwitch }
onChange={ () => props.onIsNewSwitch(false) }
/>
</GridItem>
<GridItem sm={ 12 } md={ 6 } lg={ 4 }>
{
existingRemediations === false ?
<Skeleton size={ SkeletonSize.lg } /> :
<FormSelect
isDisabled={ isNewSwitch }
onChange={ props.onRemediationSelected }
value={ selectedRemediationId }
aria-label="Select an existing Playbook" >
{ existingRemediations.length
? existingRemediations.map(({ id, name }) =>
<FormSelectOption key={ id } value={ id } label={ name } />)
: <FormSelectOption key="empty" value="empty" label="No exising Playbooks" />
}
</FormSelect>
}
</GridItem>
</Grid>
</StackItem>
<StackItem>
<Grid>
<GridItem sm={ 12 } md={ 6 } lg={ 3 }>
<Radio
label="Create new Playbook"
aria-label="Create new Playbook"
id="new"
name="radio"
defaultChecked={ props.state.isNewSwitch }
onChange={ () => props.onIsNewSwitch(true) }
/>
</GridItem>
<GridItem sm={ 12 } md={ 6 } lg={ 4 }>
<FormGroup
fieldId="remediation-name"
helperText="Playbook name"
helperTextInvalid="Playbook name has to contain alphanumeric characters"
isValid={ nameValid }
>
<TextInput
type="text"
value={ name }
onChange={ props.onNameChange }
aria-label="Name your Playbook"
autoFocus
isDisabled={ !isNewSwitch }
isValid={ nameValid }
/>
</FormGroup>
</GridItem>
</Grid>
</StackItem>
</Stack>
</Form>
</React.Fragment>
);
}
ExistingOrNewStep.propTypes = {
state: propTypes.object.isRequired,
onNameChange: propTypes.func.isRequired,
onIsNewSwitch: propTypes.func.isRequired,
onRemediationSelected: propTypes.func.isRequired
};
export default ExistingOrNewStep;
| 46.794393 | 143 | 0.379868 |
99136a891a7d72aea6f140ee4e615365da0afd92 | 459 | js | JavaScript | app/assets/javascripts/exchanges/broker_applicants.js | bgalloway1/enroll | e69c5af25278dfae17bc3db701e45f4bc9c4c7e1 | [
"Unlicense",
"MIT"
] | 43 | 2015-03-08T18:35:47.000Z | 2020-10-07T18:23:49.000Z | app/assets/javascripts/exchanges/broker_applicants.js | bgalloway1/enroll | e69c5af25278dfae17bc3db701e45f4bc9c4c7e1 | [
"Unlicense",
"MIT"
] | 911 | 2015-03-18T13:31:04.000Z | 2021-02-25T20:43:22.000Z | app/assets/javascripts/exchanges/broker_applicants.js | lisyk/enroll-copy-my | 8cf50e9e39a72977ef9002331bea3711e6ac3176 | [
"MIT",
"Unlicense"
] | 55 | 2015-03-06T14:20:53.000Z | 2020-10-27T20:43:04.000Z | function enableBrokerApplicantFilters() {
var url = '/exchanges/broker_applicants.js';
if( $('#broker_agency_profile_id').length ) {
url = $('#broker_agency_profile_id').attr("href") + ".js";
}
$('div[name=broker_applicants_tabs] > ').children().each( function() {
$(this).change(function(){
filter = $(this).val();
$.ajax({
url: url,
type: "GET",
data : { 'status': filter }
});
});
});
}
| 21.857143 | 72 | 0.54902 |
9913982f586c21197f49af95905dd2ff8781a156 | 993 | js | JavaScript | packages/create-remix/templates/express/server.js | stepri/remix | ad77263dd905c24d29c50437bebc0199c90f5f44 | [
"MIT"
] | 1 | 2022-03-07T09:56:14.000Z | 2022-03-07T09:56:14.000Z | packages/create-remix/templates/express/server.js | stepri/remix | ad77263dd905c24d29c50437bebc0199c90f5f44 | [
"MIT"
] | null | null | null | packages/create-remix/templates/express/server.js | stepri/remix | ad77263dd905c24d29c50437bebc0199c90f5f44 | [
"MIT"
] | 1 | 2022-03-08T23:32:29.000Z | 2022-03-08T23:32:29.000Z | import express from "express";
import compression from "compression";
import morgan from "morgan";
import { createRequestHandler } from "@remix-run/express";
import * as serverBuild from "@remix-run/dev/server-build";
const app = express();
app.use(compression());
// http://expressjs.com/en/advanced/best-practice-security.html#at-a-minimum-disable-x-powered-by-header
app.disable("x-powered-by");
// Remix fingerprints its assets so we can cache forever.
app.use(
"/build",
express.static("public/build", { immutable: true, maxAge: "1y" })
);
// Everything else (like favicon.ico) is cached for an hour. You may want to be
// more aggressive with this caching.
app.use(express.static("public/build", { maxAge: "1h" }));
app.use(morgan("tiny"));
app.all(
"*",
createRequestHandler({
build: serverBuild,
mode: process.env.NODE_ENV,
})
);
const port = process.env.PORT || 3000;
app.listen(port, () => {
console.log(`Express server listening on port ${port}`);
});
| 24.825 | 104 | 0.696878 |
9914516df11d0113e853baa0d6fdbfab17cf400f | 8,772 | js | JavaScript | test/common/tests.js | reg2005/throtty | 4f7aba495f610c7dbb79db8d596062c2d9e98ccd | [
"MIT"
] | 2 | 2018-11-21T14:07:19.000Z | 2021-08-22T14:27:40.000Z | test/common/tests.js | reg2005/throtty | 4f7aba495f610c7dbb79db8d596062c2d9e98ccd | [
"MIT"
] | null | null | null | test/common/tests.js | reg2005/throtty | 4f7aba495f610c7dbb79db8d596062c2d9e98ccd | [
"MIT"
] | 3 | 2019-12-05T23:31:15.000Z | 2022-03-05T08:31:34.000Z | 'use strict';
const Promise = require('bluebird');
const sinon = require('sinon');
const chai = require('chai');
const sinonChai = require('sinon-chai');
const uuid = require('uuid/v4');
const rateLimiter = require('../../index');
const expect = chai.expect;
chai.use(sinonChai);
async function runNTimesWithDelay(rLimiter, ns, times, delay) {
const results = [];
for (let i = 0; i < times; i += 1) {
const r = await rLimiter.checkRateAsync(ns);
results.push(r);
const t = r.details.wait || delay;
await Promise.delay(t);
}
return results;
}
module.exports = (title, params) => {
const rLimiter = rateLimiter(params);
title = `${title} (interval: ${params.interval}, threshold: ${params.threshold}, delay: ${params.delay})`;
describe(title, function () {
it('Make sure promisify is working. Expect first roll to be allowed.', async function () {
this.timeout(100000);
const id = uuid();
const r = await rLimiter.checkRateAsync(id);
expect(r.allowed).to.eq(true);
expect(r.details.delayViolation).to.eq(false);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.eq(0);
});
it('Run 4 rolls with a delay of one second. Expect 4th roll to be not allowed due to threshold violation.', async function () {
this.timeout(100000);
const id = uuid();
const results = await runNTimesWithDelay(rLimiter, id, 4, 1000);
for (let i = 0; i < results.length; i += 1) {
const r = results[i];
if (i < 3) {
expect(r.allowed).to.eq(true);
expect(r.details.delayViolation).to.eq(false);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.eq(0);
} else {
expect(r.allowed).to.eq(false);
expect(r.details.delayViolation).to.eq(false);
expect(r.details.thresholdViolation).to.eq(true);
expect(r.details.wait).to.be.above(0);
}
}
});
it('Run 5 rolls with a delay of one second. Expect 4th roll to be not allowed due to threshold violation and 5th roll to be allowed after waiting.', async function () {
this.timeout(100000);
const id = uuid();
const results = await runNTimesWithDelay(rLimiter, id, 5, 1000);
for (let i = 0; i < 5; i += 1) {
const r = results[i];
if (i < 3) {
expect(r.allowed).to.eq(true);
expect(r.details.delayViolation).to.eq(false);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.eq(0);
} else if (i === 3) {
expect(r.allowed).to.eq(false);
expect(r.details.delayViolation).to.eq(false);
expect(r.details.thresholdViolation).to.eq(true);
expect(r.details.wait).to.be.above(0);
} else {
expect(r.allowed).to.eq(true);
expect(r.details.delayViolation).to.eq(false);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.eq(0);
}
}
});
it('Run 2 rolls with a delay of 500 ms. Expect 2nd roll to be not allowed due to delay violation.', async function () {
this.timeout(100000);
const id = uuid();
const results = await runNTimesWithDelay(rLimiter, id, 2, 500);
for (let i = 0; i < 2; i += 1) {
const r = results[i];
if (i === 0) {
expect(r.allowed).to.eq(true);
expect(r.details.delayViolation).to.eq(false);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.eq(0);
} else {
expect(r.allowed).to.eq(false);
expect(r.details.delayViolation).to.eq(true);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.be.above(0);
}
}
});
it('Run 3 rolls with a delay of 500 ms. Expect 2nd roll to be not allowed due to delay violation and 3rd roll to be allowed after waiting.', async function () {
this.timeout(100000);
const id = uuid();
const results = await runNTimesWithDelay(rLimiter, id, 3, 500);
for (let i = 0; i < 3; i += 1) {
const r = results[i];
if (i === 0) {
expect(r.allowed).to.eq(true);
expect(r.details.delayViolation).to.eq(false);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.eq(0);
} else if (i === 1) {
expect(r.allowed).to.eq(false);
expect(r.details.delayViolation).to.eq(true);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.be.above(0);
} else {
expect(r.allowed).to.eq(true);
expect(r.details.delayViolation).to.eq(false);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.eq(0);
}
}
});
it('Run 8 rolls with a delay of 500 ms. Expect both delay violations and threshold violations. Wait when required.', async function () {
this.timeout(100000);
const id = uuid();
const results = await runNTimesWithDelay(rLimiter, id, 8, 500);
for (let i = 0; i < 8; i += 1) {
const r = results[i];
if (i % 2 === 0) {
expect(r.allowed).to.eq(true);
expect(r.details.delayViolation).to.eq(false);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.eq(0);
} else if (i === 5 || i === 3 || i === 7) {
expect(r.allowed).to.eq(false);
expect(r.details.delayViolation).to.eq(true);
expect(r.details.thresholdViolation).to.eq(true);
expect(r.details.wait).to.be.above(0);
} else {
expect(r.allowed).to.eq(false);
expect(r.details.delayViolation).to.eq(true);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.be.above(0);
}
}
});
it('Run [8 rolls] x 2, each group with own namespace, in parallel, with a delay of 500 ms with different namespaces. Expect both delay violations and threshold violations. Wait when required.', async function () {
this.timeout(100000);
let counter = 0;
const check = (results) => {
for (let i = 0; i < 8; i += 1) {
const r = results[i];
if (i % 2 === 0) {
expect(r.allowed).to.eq(true);
expect(r.details.delayViolation).to.eq(false);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.eq(0);
} else if (i === 5 || i === 3 || i === 7) {
expect(r.allowed).to.eq(false);
expect(r.details.delayViolation).to.eq(true);
expect(r.details.thresholdViolation).to.eq(true);
expect(r.details.wait).to.be.above(0);
} else {
expect(r.allowed).to.eq(false);
expect(r.details.delayViolation).to.eq(true);
expect(r.details.thresholdViolation).to.eq(false);
expect(r.details.wait).to.be.above(0);
}
}
counter += 1;
};
const id = uuid();
const r1 = runNTimesWithDelay(rLimiter, id, 8, 500);
const anotherId = uuid();
const r2 = runNTimesWithDelay(rLimiter, anotherId, 8, 500);
const r = await Promise.all([r1, r2]);
for (let i = 0; i < r.length; i += 1) {
check(r[i]);
}
});
});
};
| 45.6875 | 221 | 0.49487 |
99150b23f151ac0da18bad7e4c6d66e2d9bf00c8 | 6,209 | js | JavaScript | public/javascripts/controllers/ndtController.js | carlosFattor/DoceTentacaoSlick | 61a235365e86289642a4f3b4af6542de87328ec8 | [
"Apache-2.0"
] | 4 | 2015-10-14T22:16:57.000Z | 2019-06-25T14:21:54.000Z | public/javascripts/controllers/ndtController.js | carlosFattor/DoceTentacaoSlick | 61a235365e86289642a4f3b4af6542de87328ec8 | [
"Apache-2.0"
] | null | null | null | public/javascripts/controllers/ndtController.js | carlosFattor/DoceTentacaoSlick | 61a235365e86289642a4f3b4af6542de87328ec8 | [
"Apache-2.0"
] | null | null | null | /**
* Created by carlos on 15/10/15.
*/
'use strict';
angular.module("ndt-app").controller("ndtController", function ($scope, listAPI) {
var filtro = /^([\w-]+(?:\.[\w-]+)*)@((?:[\w-]+\.)*\w[\w-]{0,66})\.([a-z]{2,6}(?:\.[a-z]{2})?)$/i;
$scope.infoNews= "Deixe o Seu Email";
$scope.error;
$scope.msgOk;
$scope.msgNOK;
$scope.app = "Nilda Doce Tentação";
$scope.myInterval = 3000;
$scope.noWrapSlides = false;
$scope.slides = [];
$scope.sendNews = function(news){
if(filtro.test(news)){
listAPI.sendNews({email : news})
.success(function(data, status){
$scope.msgOk = data.response;
})
.error(function(data, status){
$scope.msgNOK = data.status;
})
}
}
$scope.getListProducts = function(name) {
listAPI.findListProds(name)
.success(function(data, status){
console.log(data)
})
}
var myList = function () {
listAPI.getListProductFeatured()
.success(function (data, status) {
$scope.slides = data.response.map(function(element){
return {image: element.imgSmallURL,
text: element.name};
});
})
.error(function (data, status) {
$scope.message = "não foi possivel carregar os dados! " + status;
})
}
myList();
});
angular.module("ndt-app").controller("ndtCatContol", function($scope, listAPI){
$scope.msgFail = "";
$scope.categories = [];
$scope.app = "Nilda Doce Tentação";
var myList = function () {
listAPI.getListCategory()
.success(function (data, status) {
$scope.categories = data.response;
})
.error(function (data, status) {
$scope.msgFail = "não foi possivel carregar os dados! " + status;
})
}
myList();
});
angular.module("ndt-app").controller("ndtProdsControl", function($scope, listAPI, $stateParams){
$scope.msgFail;
$scope.products = [];
var myList = function() {
listAPI.getListProducts($stateParams.id)
.success(function(data, status){
$scope.products = data.response;
})
.error(function(data, status){
$scope.msgFail = "não foi possivel carregar os dados! " + status;
})
}
myList();
});
angular.module("ndt-app").controller("ndtProdControl", function($scope, listAPI, $stateParams){
$scope.msgFail;
$scope.product;
var myProduct = function(){
listAPI.getProduct($stateParams.id)
.success(function(data, status){
$scope.product = data.response;
})
.error(function(data, status){
$scope.msgFail = "não foi possivel carregar os dados! " + status;
})
}
myProduct();
});
angular.module("ndt-app").controller("ndtGalleryControl", function($scope, listAPI){
$scope.msgFail;
$scope.galleryItens = [];
var funcGallery = function(){
$('ul.magnific-gallery').each(function () {
openGallery.call(this, 'mfp-example');
});
}
var myGallery = function(){
listAPI.getListGallery()
.success(function(data, status){
$scope.galleryItens = data.response;
})
.error(function(data, status){
$scope.msgFail = "não foi possivel carregar os dados! " + status;
})
}
myGallery();
funcGallery();
});
angular.module("ndt-app").controller("ndtContactControl", function($scope, listAPI, nameFilter){
$scope.frmContact = {};
$scope.statusOk=false;
$scope.statusNOK=false;
$scope.msgFail;
$scope.msgOk;
$scope.sendContact = function(contact){
if($scope.frmContact.$valid) {
contact.name = nameFilter(contact.name);
listAPI.sendContact(angular.copy(contact))
.success(function (data, status) {
delete $scope.contact;
$scope.frmContact.$setPristine();
$scope.msgOk = data.response;
$scope.statusNOk = false;
$scope.statusOk = true;
})
.error(function (data, status) {
console.log(data+" | "+status )
$scope.msgFail = "não foi possivel enviar o e-mail! ";
$scope.statusOk = false;
$scope.statusNOk = true;
})
}else{
console.log($scope.frmContact);
}
}
});
angular.module("ndt-app").controller("ndtKnowControl", function($scope){
var mapOptions = {
zoom: 17,
center: new google.maps.LatLng(-21.99859, -47.884205),
mapTypeId: google.maps.MapTypeId.TERRAIN
}
$scope.map = new google.maps.Map(document.getElementById('map'), mapOptions);
$scope.markers = [];
var infoWindow = new google.maps.InfoWindow();
var createMarker = function (info){
var marker = new google.maps.Marker({
map: $scope.map,
position: new google.maps.LatLng(info.lat, info.long),
title: info.city,
tel: info.tel
});
marker.content = '<div class="infoWindowContent">' + info.desc + '</div>';
google.maps.event.addListener(marker, 'click', function(){
infoWindow.setContent('<h2>' + marker.title + '</h2>' + marker.content + marker.tel);
infoWindow.open($scope.map, marker);
});
$scope.markers.push(marker);
}
for (var i = 0; i < cities.length; i++){
createMarker(cities[i]);
}
$scope.openInfoWindow = function(e, selectedMarker){
e.preventDefault();
google.maps.event.trigger(selectedMarker, 'click');
}
});
//Data to googleMaps
var cities = [
{
city : 'São Carlos',
desc : 'Nilda Doce Tentação',
tel: 'WhatsApp - (16) 98156-2280',
lat : -21.99858,
long : -47.884205
}
] | 29.995169 | 102 | 0.532453 |
99153d0e0b361c4adcd2fd0b502457c97f18ae6d | 639 | js | JavaScript | src/common/js/flexible.js | pingshiguo/vue-find | e06e6a8a2f941547403642776de6a1792761056f | [
"MIT"
] | null | null | null | src/common/js/flexible.js | pingshiguo/vue-find | e06e6a8a2f941547403642776de6a1792761056f | [
"MIT"
] | null | null | null | src/common/js/flexible.js | pingshiguo/vue-find | e06e6a8a2f941547403642776de6a1792761056f | [
"MIT"
] | null | null | null | (function flexible (window, document) {
const root = document.documentElement;
const dpr = window.devicePixelRatio;
const setFontSize = () => {
let viewportWidth = root.getBoundingClientRect().width || 375;
viewportWidth = viewportWidth > 650 ? 650 : viewportWidth;
root.style.fontSize = `${viewportWidth / 10}px`;
document.body.style.fontSize = `${12 * dpr}px`;
};
root.setAttribute('data-dpr', dpr);
window.addEventListener('resize', setFontSize, false);
if (document.readyState === 'complete') setFontSize();
document.addEventListener('DOMContentLoaded', setFontSize, false);
})(window, document);
| 30.428571 | 68 | 0.699531 |
99154d9951441b660839d2a2276ef05242cd7fe4 | 17,834 | js | JavaScript | tests/slider/clientsideapi.js | davidda/kendo-ui-core | 1cd612b2ccc4d6bdfc222948b74af1c4d37e2d9f | [
"Apache-2.0"
] | 2,304 | 2015-01-04T13:49:57.000Z | 2022-03-29T22:48:20.000Z | tests/slider/clientsideapi.js | davidda/kendo-ui-core | 1cd612b2ccc4d6bdfc222948b74af1c4d37e2d9f | [
"Apache-2.0"
] | 5,952 | 2015-01-05T03:11:28.000Z | 2022-03-31T15:16:01.000Z | tests/slider/clientsideapi.js | davidda/kendo-ui-core | 1cd612b2ccc4d6bdfc222948b74af1c4d37e2d9f | [
"Apache-2.0"
] | 2,214 | 2015-01-03T14:30:19.000Z | 2022-03-28T18:59:18.000Z | (function() {
var Slider = kendo.ui.Slider;
function newSlider(options, sliderInput) {
var input = $(sliderInput || "<input id='slider'>").appendTo(Mocha.fixture)[0];
return new Slider(input, options);
}
describe("slider api", function() {
afterEach(function() {
kendo.destroy(Mocha.fixture);
});
it("value should set slider value", function() {
var slider = newSlider();
slider.value(9);
assert.equal(slider.value(), 9);
});
it("min method should get min value", function() {
var slider = newSlider();
assert.equal(slider.min(), 0);
});
it("max method should get max value", function() {
var slider = newSlider();
assert.equal(slider.max(), 10);
});
it("min method should set min value", function() {
var slider = newSlider();
slider.min(5);
assert.equal(slider.element.parent().find(".k-slider-items").children("li").first().attr("title"), "5");
});
it("max method should set max value", function() {
var slider = newSlider();
slider.max(15);
assert.equal(slider.element.parent().find(".k-slider-items").children("li").last().attr("title"), "15");
});
it("setOptions min should set min value", function() {
var slider = newSlider();
slider.setOptions({ "min": 5 });
assert.equal(slider.element.parent().find(".k-slider-items").children("li").first().attr("title"), "5");
});
it("setOptions max should set max value", function() {
var slider = newSlider();
slider.setOptions({ "max": 15 });
assert.equal(slider.element.parent().find(".k-slider-items").children("li").last().attr("title"), "15");
});
it("setOptions smallStep should set smallStep value", function() {
var slider = newSlider();
slider.setOptions({ "smallStep": 2 });
assert.equal(slider.element.parent().find(".k-slider-items").children("li").eq(1).attr("title"), "2");
});
it("setOptions largeStep should set largeStep value", function() {
var slider = newSlider();
slider.setOptions({ "largeStep": 2 });
assert.equal(slider.element.parent().find(".k-slider-items").children("li").eq(2).hasClass("k-tick-large"), true);
});
it("value should not be null or empty string and should return old value", function() {
var slider = newSlider();
slider.value(2);
slider.value(" ");
assert.equal(slider.value(), 2);
slider.value(null);
assert.equal(slider.value(), 2);
});
it("value should be in range", function() {
var slider = newSlider();
$.extend(slider.options, {
precision: 4,
smallStep: 0.0001,
largeStep: 0.0001,
min: 0,
max: 0.0004,
value: 0.0002,
tooltip: {
format: "{0:#,#.####}"
}
});
assert.equal(slider.value(), 0.0002);
});
it("precision is correctly calculated", function() {
var slider = newSlider();
$.extend(slider.options, { showButtons: false });
slider.value(11);
assert.equal(slider.value(), 0);
slider.value(-1);
assert.equal(slider.value(), 0);
});
it("value should update slider selectionDiv", function() {
var slider = newSlider();
var selectionDiv = slider.wrapper.find(".k-slider-selection");
slider.value(10);
assert.equal(selectionDiv.width(), 130);
});
it("value should be in range", function() {
var slider = newSlider();
var selectionDiv = slider.wrapper.find(".k-slider-selection");
slider.value(11);
assert.equal(selectionDiv.width(), 0);
slider.value(-1);
assert.equal(selectionDiv.width(), 0);
});
it("when value is string slider should set slider value", function() {
var slider = newSlider();
slider.value("1");
assert.equal(1, slider.value());
});
it("value should not trigger change event", function() {
var result = true;
var change = function(e) {
result = false;
};
var slider = newSlider({ "change": change });
slider.value(5);
assert.isOk(result);
});
it("slider init should not trigger change event", function() {
var result = true;
var change = function(e) {
result = false;
};
newSlider({ "change": change, min: 2 });
assert.isOk(result);
});
it("value should set value to the input", function() {
var slider = newSlider({ value: 1 });
var value = 2;
slider.value(value);
assert.equal(slider.element.val(), value);
});
it("value should alter in change event handler", function() {
var rightArrow = kendo.keys.RIGHT,
slider = newSlider({
"change": function(e) {
e.sender.value(3);
}
}),
dragHandle = slider.wrapper.find(".k-draghandle").focus();
dragHandle.trigger({ type: "keydown", keyCode: rightArrow });
assert.equal(slider.value(), 3);
});
it("enabled with false should disable slider", function() {
var slider = newSlider({ enabled: false });
assert.isOk(slider.element.is("[disabled]"));
assert.isOk(!slider.options.enabled);
assert.equal(slider.wrapper.find(".k-draghandle").attr("tabindex"), -1);
});
it("disabled attribute should disable slider", function() {
var slider = newSlider({}, "<input disabled='disabled' />");
assert.isOk(slider.element.is("[disabled]"));
assert.isOk(!slider.options.enabled);
});
it("enable method with false should disable slider", function() {
var slider = newSlider();
slider.disable(false);
assert.isOk(slider.element.is("[disabled]"));
assert.isOk(!slider.options.enabled);
});
it("enable method with true should enable slider", function() {
var slider = newSlider();
slider.enable(true);
assert.isOk(!slider.element.attr("disabled"));
assert.isOk(slider.options.enabled);
assert.equal(slider.wrapper.find(".k-draghandle").attr("tabindex"), 0);
});
it("disable method should disable slider", function() {
var slider = newSlider();
slider.disable();
assert.isOk(slider.element.is("[disabled]"));
assert.isOk(!slider.options.enabled);
});
it("enable method should enable slider", function() {
var slider = newSlider();
slider.enable();
assert.isOk(!slider.element.attr("disabled"));
assert.isOk(slider.options.enabled);
});
it("disable method should add state disabled to the slider", function() {
var slider = newSlider();
slider.disable();
assert.isOk(slider.wrapper.hasClass("k-state-disabled"));
});
it("enable method should remove state disabled from the slider", function() {
var slider = newSlider();
slider.enable();
assert.isOk(!slider.wrapper.hasClass("k-state-disabled"));
});
it("refresh method should not select minimum when slider increase his value from -1 to 0", function() {
var slider = newSlider({ showButtons: true, min: -5, value: -1 });
slider.value(0);
assert.isOk(slider.value, 0);
});
it('slider should not trigger change if we decrease value with 1 step and value is equal to min value', function() {
var downArrow = kendo.keys.DOWN,
leftArrow = kendo.keys.LEFT,
result = true;
var change = function(e) {
result = false;
};
var slider = newSlider({ "change": change, value: 0 }),
dragHandle = slider.wrapper.find(".k-draghandle").focus();
dragHandle.trigger({ type: "keydown", keyCode: downArrow });
dragHandle.trigger({ type: "keydown", keyCode: leftArrow });
assert.isOk(result);
});
});
var slider;
describe("slider destroy", function() {
beforeEach(function() {
slider = newSlider();
slider.destroy();
});
it("removes data", function() {
assert.isOk(!$("#slider").data("kendoSlider"));
});
it("unbinds events", function() {
assert.isOk(!(slider._events || {}).slide);
});
it("unbinds mousedown", function() {
assert.isOk(!($(".k-slider").data("events") || {}).mousedown);
});
});
// ------------------------------------------------------------
var RangeSlider = kendo.ui.RangeSlider;
function newRangeSlider(options, sliderDiv) {
var div = $(sliderDiv || "<div id='rangeslider'><input /><input /></div>").appendTo(Mocha.fixture);
return new RangeSlider(div, options);
}
describe("rangeslider api", function() {
afterEach(function() {
kendo.destroy(Mocha.fixture);
});
it("values should set rangeSlider selectionStart and selectionEnd", function() {
var rangeSlider = newRangeSlider(),
values = [0, 9];
rangeSlider.values(values);
assert.deepEqual(rangeSlider.value(), values);
});
it("value should set rangeSlider selectionStart and selectionEnd", function() {
var rangeSlider = newRangeSlider(),
values = [0, 9];
rangeSlider.value(values);
assert.deepEqual(rangeSlider.value(), values);
});
it("values should return array of selectionStart and selectionEnd", function() {
var rangeSlider = newRangeSlider(),
values = [0, 9];
rangeSlider.values(values);
assert.isOk(values instanceof Array);
});
it("values should not be null or empty string and should return old values", function() {
var selectionStart = 1,
selectionEnd = 3,
rangeSlider = newRangeSlider({ selectionStart: selectionStart, selectionEnd: selectionEnd });
rangeSlider.values(" ");
assert.deepEqual(rangeSlider.values(), [selectionStart, selectionEnd]);
rangeSlider.values(null);
assert.deepEqual(rangeSlider.values(), [selectionStart, selectionEnd]);
});
it("values should be in range", function() {
var selectionStart = 1,
selectionEnd = 3,
rangeSlider = newRangeSlider({ selectionStart: selectionStart, selectionEnd: selectionEnd });
rangeSlider.values(-1, 11);
assert.deepEqual(rangeSlider.values(), [selectionStart, selectionEnd]);
});
it("values should set rangeSlider position selectionDiv", function() {
var rangeSlider = newRangeSlider();
var selectionDiv = rangeSlider.wrapper.find(".k-slider-selection");
rangeSlider.values(0, 10);
assert.equal(selectionDiv.width(), 198);
});
it("values should not trigger change event", function() {
var result = true;
var change = function(e) {
result = false;
};
var rangeSlider = newRangeSlider({ "change": change });
rangeSlider.values(1, 3);
assert.isOk(result);
});
it("init should not trigger change event", function() {
var result = true;
var change = function(e) {
result = false;
};
newRangeSlider({ "change": change, min: -1, max: 20 });
assert.isOk(result);
});
it("values should set values to the inputs", function() {
var rangeSlider = newRangeSlider(),
selectionStart = 2,
selectionEnd = 5;
rangeSlider.values(selectionStart, selectionEnd);
var inputs = rangeSlider.element.find("input");
assert.equal(inputs.eq(0).val(), selectionStart);
assert.equal(inputs.eq(1).val(), selectionEnd);
});
it("values should set selectionStart and selectionEnd values from string parameters", function() {
var rangeSlider = newRangeSlider();
rangeSlider.values("1", "2");
assert.deepEqual(rangeSlider.values(), [1, 2]);
});
it("values should set z-index to first handle", function() {
var rangeSlider = newRangeSlider(),
dragHandles = rangeSlider.wrapper.find(".k-draghandle"),
firstDragHandle = dragHandles.eq(0);
rangeSlider.values(10, 10);
assert.equal(firstDragHandle.css("z-index"), 1);
});
it("enabled with false should disable range slider", function() {
var rangeSlider = newRangeSlider({ enabled: false });
assert.isOk(rangeSlider.element.find("input").is("[disabled]"));
assert.isOk(!rangeSlider.options.enabled);
assert.equal(rangeSlider.wrapper.find(".k-draghandle").eq(0).attr("tabindex"), -1);
assert.equal(rangeSlider.wrapper.find(".k-draghandle").eq(1).attr("tabindex"), -1);
});
it("disabled attribute should disable range slider", function() {
var rangeSlider = newRangeSlider({}, "<div><input disabled='disabled' /><input disabled='disabled' /></div>");
assert.isOk(rangeSlider.element.find("input").is("[disabled]"));
assert.isOk(!rangeSlider.options.enabled);
});
it("enable method with false should disable range slider", function() {
var rangeSlider = newRangeSlider();
rangeSlider.disable(false);
assert.isOk(rangeSlider.element.find("input").is("[disabled]"));
assert.isOk(!rangeSlider.options.enabled);
});
it("enable method with true should enable range slider", function() {
var rangeSlider = newRangeSlider();
rangeSlider.enable(true);
assert.isOk(!rangeSlider.element.find("input").attr("disabled"));
assert.isOk(rangeSlider.options.enabled);
});
it("disable method should disable range slider", function() {
var rangeSlider = newRangeSlider();
rangeSlider.disable();
assert.isOk(rangeSlider.element.find("input").is(":disabled"));
assert.isOk(!rangeSlider.options.enabled);
});
it("enable method should enable range slider", function() {
var rangeSlider = newRangeSlider();
rangeSlider.enable();
assert.isOk(!rangeSlider.wrapper.attr("disabled"));
assert.isOk(rangeSlider.options.enabled);
});
it("disable method should add state disabled to the range slider", function() {
var rangeSlider = newRangeSlider();
rangeSlider.disable();
assert.isOk(rangeSlider.wrapper.hasClass("k-state-disabled"));
});
it("enable method should remove state disabled from the range slider", function() {
var rangeSlider = newRangeSlider();
rangeSlider.enable();
assert.isOk(!rangeSlider.wrapper.hasClass("k-state-disabled"));
assert.equal(rangeSlider.wrapper.find(".k-draghandle").eq(0).attr("tabindex"), 0);
assert.equal(rangeSlider.wrapper.find(".k-draghandle").eq(1).attr("tabindex"), 0);
});
it('range slider should not trigger change if we decrease selectionStart with 1 step and selectionStart is equal to min value', function() {
var downArrow = kendo.keys.down,
leftArrow = kendo.keys.left,
result = true;
var change = function(e) {
result = false;
};
var rangeSlider = newRangeSlider({ change: change, selectionStart: 10, selectionEnd: 10 }),
dragHandles = rangeSlider.wrapper.find(".k-draghandle");
dragHandles.eq(0).trigger({ type: "keydown", keyCode: downArrow });
dragHandles.eq(0).trigger({ type: "keydown", keyCode: leftArrow });
assert.isOk(result);
});
});
var rangeSider;
describe("rangeslider destroy", function() {
beforeEach(function() {
rangeSider = newRangeSlider();
rangeSider.destroy();
});
it("removes data", function() {
assert.isOk(!$("#rangeslider").data("kendoRangeSlider"));
});
it("unbinds events", function() {
assert.isOk(!(rangeSider._events || {}).slide);
});
it("unbinds mousedown", function() {
assert.isOk(!($(".k-slider").data("events") || {}).mousedown);
});
});
}());
| 31.564602 | 148 | 0.539363 |
9916359c43ae07ff311ebfc2a00b642ad7e0c2a1 | 1,758 | js | JavaScript | src/_lib/MVC/View.js | amilajack/JDAW | b85c643a6566366a707f330c5daaf840a88e16ac | [
"MIT"
] | null | null | null | src/_lib/MVC/View.js | amilajack/JDAW | b85c643a6566366a707f330c5daaf840a88e16ac | [
"MIT"
] | null | null | null | src/_lib/MVC/View.js | amilajack/JDAW | b85c643a6566366a707f330c5daaf840a88e16ac | [
"MIT"
] | null | null | null | import Utils from "DAW/_lib/Utils"
import Event from "DAW/_lib/Event"
import vHTML from "DAW/_lib/external/cjs/vdom-virtualize"
import vDOM from "DAW/_lib/external/cjs/virtual-dom"
class View
{
$el = null
model = null
container = null
template = null
events = {}
constructor(model)
{
this.model = model
}
init()
{
this.$el = this.element ? $(this.element) : this.template ? $(Utils.template(this.template, this.model)) : $()
this.toggleEvents(true)
}
toggleEvents(enabled)
{
for (let k in this.events)
{
let event = this.events[k]
let $el = this.$el
if (event[0] == "@")
{
event = event.substr(1)
let split = event.split(" ")
let selector = split.shift()
if (selector == "window") selector = window
if (selector == "document") selector = document
$el = $(selector)
event = split.join(" ")
}
let split = event.split(" ")
let events = split.shift().replace(/\|/g," ")
let selector = split.join(" ")
if (enabled)
{
this.events[k] = new Event()
let trigger = this.events[k].getTrigger()
if (this[k]) this.events[k].listen(this[k].bind(this))
selector ? $el.on(events, selector, trigger) : $el.on(events, trigger)
}
else
{
$el.off(events, selector)
}
}
}
afterRender(){}
beforeRender(){}
render()
{
if (!this.template) return
this.beforeRender()
this.diff($(Utils.template(this.template, this.model))[0])
this.afterRender()
}
diff(tree)
{
vDOM.patch(this.$el[0], vDOM.diff(
vHTML(this.$el[0]),
vHTML(tree)
))
}
listen(event, fn)
{
this.events[event].listen(fn)
}
ignore(event, fn)
{
this.events[event].ignore(fn)
}
destroy()
{
this.$el.remove();
}
}
export default View | 16.903846 | 112 | 0.605233 |
991637c711f4013620222dd48c1f9da2f2868517 | 2,885 | js | JavaScript | lib/index.js | bmancini55/react-service-utils | 6bdc902b7142dcafea4fa4f8bfc2db5033c3b6ad | [
"MIT"
] | null | null | null | lib/index.js | bmancini55/react-service-utils | 6bdc902b7142dcafea4fa4f8bfc2db5033c3b6ad | [
"MIT"
] | null | null | null | lib/index.js | bmancini55/react-service-utils | 6bdc902b7142dcafea4fa4f8bfc2db5033c3b6ad | [
"MIT"
] | null | null | null |
module.exports = {
createResult,
getValidationErrors,
getFlash,
getPaging
};
/**
* Creates the result object that can be resolved
*
* @param {object} err
* @param {object} response
* @return {object} returns a uniform resolution object
*/
function createResult(error, response) {
let success = !error;
let body = getBody(response);
let paging = getPaging(response);
let flash = getFlash(response);
let validationErrors = getValidationErrors(response);
let statusCode = getStatusCode(response);
let errorMessage = getErrorMessage(error);
let result = getResult(response);
return {
success,
flash,
validationErrors,
body,
paging,
result,
error,
errorMessage,
response,
statusCode,
};
}
/**
* [getBody description]
* @param {[type]} response [description]
* @return {[type]} [description]
*/
function getBody(response) {
if(response) {
return response.body;
}
}
/**
* [getResult description]
* @param {[type]} response [description]
* @return {[type]} [description]
*/
function getResult(response) {
if(response) {
let result = getBody(response);
let paging = getPaging(response);
if(result) {
result.paging = paging;
}
return result;
}
}
/**
* [getStatusCode description]
* @param {[type]} response [description]
* @return {[type]} [description]
*/
function getStatusCode(response) {
if(response) {
return response.statusCode;
}
}
/**
* Gets the validation errors for a 422 response
*
* @param {response} response
* @return {object} map of validation errors or null
*/
function getValidationErrors(response) {
if(response && response.status === 422) {
return response.body;
} else {
return { };
}
}
/**
* Retrieves the flash headers from the response
*
* @param {res} response objct
* @return {object} flash object
*/
function getFlash(response) {
if(response) {
let type = response.headers['x-flash-type'];
let msg = response.headers['x-flash-message'];
if(type && msg) {
return { type, msg };
}
}
}
/**
* Retreives the paging information
*
* @param {res} response object
* @return {object} paging object
*/
function getPaging(response) {
if(response) {
let start = parseInt(response.headers['x-paging-start']);
let limit = parseInt(response.headers['x-paging-limit']);
let total = parseInt(response.headers['x-paging-total']);
if(start || limit || total) {
return { start, limit, total };
}
}
}
/**
* [getErrorMessage description]
* @param {[type]} error [description]
* @return {[type]} [description]
*/
function getErrorMessage(error) {
if(error) {
if(error.message) {
return error.message;
}
else {
return error;
}
}
}
| 20.607143 | 61 | 0.621144 |
9916c49cab979d05b699e6876b90c39d61a56b0a | 391 | js | JavaScript | src/index.js | maximturchenko/simple-react-app | 4d53d91bf8bb15a4541ef446da46bc70d424d1b3 | [
"MIT"
] | 1 | 2020-12-25T04:59:16.000Z | 2020-12-25T04:59:16.000Z | src/index.js | maximturchenko/simple-react-app | 4d53d91bf8bb15a4541ef446da46bc70d424d1b3 | [
"MIT"
] | null | null | null | src/index.js | maximturchenko/simple-react-app | 4d53d91bf8bb15a4541ef446da46bc70d424d1b3 | [
"MIT"
] | null | null | null | // Импортируем основное api React
import React from "react";
// Импортируем методы для работы с dom
import ReactDom from "react-dom";
// Импортируем наш компонент
import App from "./App";
// Подключили стили бутстрапа 4
import "./bootstrap.min.css";
// Наш компонент App выводим в тег с id root
// Рендерим компонент
ReactDom.render(
<App />
,
document.getElementById("root")
);
| 17.772727 | 44 | 0.71867 |
991701ed4647a403330694864e88bff6bd1eceb5 | 20,724 | js | JavaScript | src/commands/admin/TestCommand.js | quenquentin/DraftBot-A-Discord-Adventure | a84ce4efd60b7bf3dc7fad958a92014cd627c8b8 | [
"MIT"
] | 1 | 2020-08-08T16:07:27.000Z | 2020-08-08T16:07:27.000Z | src/commands/admin/TestCommand.js | quenquentin/DraftBot-A-Discord-Adventure | a84ce4efd60b7bf3dc7fad958a92014cd627c8b8 | [
"MIT"
] | null | null | null | src/commands/admin/TestCommand.js | quenquentin/DraftBot-A-Discord-Adventure | a84ce4efd60b7bf3dc7fad958a92014cd627c8b8 | [
"MIT"
] | null | null | null | /**
* Cheat command for testers
* @param {("fr"|"en")} language - Language to use in the response
* @param {module:"discord.js".Message} message - Message from the discord server
* @param {String[]} args=[] - Additional arguments sent with the command
*/
const TestCommand = async (language, message, args) => {
let authorized = false;
if (JsonReader.app.TEST_MODE !== true) {
return;
} else {
authorized = true;
}
if (!authorized) {
// Additional security in case of error
return;
}
if (args.length === 0) {
await message.channel.send(":x: | Pas assez d'arguments");
return;
}
let author;
[author] = await Entities.getOrRegister(message.author.id);
try {
switch (args[0].toLowerCase()) {
case "lvl":
case "level":
if (args.length === 2) {
author.Player.level = parseInt(args[1]);
author.Player.save();
} else {
await message.channel.send(
"Usage correct: test level <niveau>"
);
return;
}
break;
case "score":
if (args.length === 2) {
author.Player.score = parseInt(args[1]);
author.Player.save();
} else {
await message.channel.send(
"Usage correct: test score <score>"
);
return;
}
break;
case "weeklyscore":
if (args.length === 2) {
author.Player.weeklyScore = parseInt(args[1]);
author.Player.save();
} else {
await message.channel.send(
"Usage correct: test weeklyscore <score>"
);
return;
}
break;
case "xp":
case "experience":
if (args.length === 2) {
author.Player.experience = parseInt(args[1]);
author.Player.save();
} else {
await message.channel.send(
"Usage correct: test experience <experience>"
);
return;
}
break;
case "money":
if (args.length === 2) {
author.Player.money = parseInt(args[1]);
author.Player.save();
} else {
await message.channel.send(
"Usage correct: test experience <experience>"
);
return;
}
break;
case "givebadge":
if (args.length === 2) {
author.Player.addBadge(args[1]);
author.Player.save();
} else {
await message.channel.send(
"Usage correct: test givebadge <badge>"
);
return;
}
break;
case "clearbadges":
if (args.length === 1) {
author.Player.badges = null;
author.Player.save();
} else {
await message.channel.send(
"Usage correct: test clearbadges"
);
return;
}
break;
case "resetreport":
case "rr":
if (args.length === 1) {
author.Player.lastReportAt = new Date(1980, 0);
author.Player.save();
} else {
await message.channel.send(
"Usage correct: test resetreport"
);
return;
}
break;
case "maxhealth":
if (args.length === 2) {
author.maxHealth = parseInt(args[1]);
author.save();
} else {
await message.channel.send(
"Usage correct: test maxhealth <max health>"
);
return;
}
break;
case "health":
if (args.length === 2) {
author.health = parseInt(args[1]);
author.save();
} else {
await message.channel.send(
"Usage correct: test health <health>"
);
return;
}
break;
case "attack":
if (args.length === 2) {
author.attack = parseInt(args[1]);
author.save();
} else {
await message.channel.send(
"Usage correct: test attack <attack>"
);
return;
}
break;
case "defense":
if (args.length === 2) {
author.defense = parseInt(args[1]);
author.save();
} else {
await message.channel.send(
"Usage correct: test defense <defense>"
);
return;
}
break;
case "speed":
if (args.length === 2) {
author.speed = parseInt(args[1]);
author.save();
} else {
await message.channel.send(
"Usage correct: test speed <speed>"
);
return;
}
break;
case "effect":
if (args.length === 2) {
let effectMalus = ":" + args[1] + ":";
if (
JsonReader.models.players.effectMalus[effectMalus] !==
null &&
JsonReader.models.players.effectMalus[effectMalus] !==
undefined
) {
author.effect = effectMalus;
author.save();
author.Player.lastReportAt = new Date(
message.createdTimestamp +
JsonReader.models.players.effectMalus[
effectMalus
]
);
author.Player.save();
} else {
await message.channel.send(
"Effet inconnu ! Il ne faut pas mettre les ::"
);
return;
}
} else {
await message.channel.send(
"Usage correct: test effect <effect>"
);
return;
}
break;
case "weaponid":
if (args.length === 2) {
author.Player.Inventory.weapon_id = parseInt(args[1]);
author.Player.Inventory.save();
} else {
await message.channel.send(
"Usage correct: test weaponId <weaponId>"
);
return;
}
break;
case "armorid":
if (args.length === 2) {
author.Player.Inventory.armor_id = parseInt(args[1]);
author.Player.Inventory.save();
} else {
await message.channel.send(
"Usage correct: test armorId <armorId>"
);
return;
}
break;
case "potionid":
if (args.length === 2) {
author.Player.Inventory.potion_id = parseInt(args[1]);
author.Player.Inventory.save();
} else {
await message.channel.send(
"Usage correct: test potionId <potionId>"
);
return;
}
break;
case "objectid":
if (args.length === 2) {
author.Player.Inventory.object_id = parseInt(args[1]);
author.Player.Inventory.save();
} else {
await message.channel.send(
"Usage correct: test objectId <objectId>"
);
return;
}
break;
case "backupid":
if (args.length === 2) {
author.Player.Inventory.backup_id = parseInt(args[1]);
author.Player.Inventory.save();
} else {
await message.channel.send(
"Usage correct: test backupId <backupId>"
);
return;
}
break;
case "init":
if (args.length === 2) {
author.Player.score = 2000;
author.Player.level = parseInt(args[1]);
author.Player.weeklyScore = 0;
author.Player.score = 2000;
author.Player.experience = 0;
author.Player.weeklyScore = 0;
author.Player.money = 0;
author.Player.experience = 0;
author.Player.badges = null;
author.Player.money = 50000;
author.Player.lastReportAt = new Date(1980, 0);
author.Player.badges = null;
author.Player.save();
author.Player.lastReportAt = new Date(1980, 0);
author.Player.save();
author.effect = ":smiley:";
author.maxHealth = 100;
author.health = 100;
author.attack = 50;
author.defense = 20;
author.speed = 10;
author.save();
author.effect = ":smiley:";
author.Player.Inventory.weapon_id = 0;
author.maxHealth = 100;
author.Player.Inventory.armor_id = 0;
author.health = 100;
author.Player.Inventory.object_id = 0;
author.attack = 50;
author.Player.Inventory.backup_id = 0;
author.defense = 20;
author.Player.Inventory.save();
author.speed = 10;
} else {
author.save();
author.Player.level = 50;
author.Player.score = 2000;
author.Player.weeklyScore = 0;
author.Player.experience = 0;
author.Player.money = 50000;
author.Player.badges = null;
author.Player.lastReportAt = new Date(1980, 0);
author.Player.save();
author.effect = ":smiley:";
author.maxHealth = 100;
author.health = 100;
author.attack = 50;
author.defense = 20;
author.speed = 10;
author.save();
author.Player.Inventory.weapon_id = 0;
author.Player.Inventory.armor_id = 0;
author.Player.Inventory.object_id = 0;
author.Player.Inventory.backup_id = 0;
author.Player.Inventory.save();
}
break;
case "atime":
if (args.length === 2) {
author.Player.lastReportAt -= parseInt(args[1]) * 60000;
author.Player.save();
}
break;
case "destroy":
Inventories.destroy({
where: {
player_id: author.Player.id,
},
});
Players.destroy({
where: {
entity_id: author.id,
},
});
Entities.destroy({
where: {
id: author.id,
},
});
break;
case "forcereport":
case "fr":
case "forcer":
if (args.length === 2) {
await getCommand("r")(
language,
message,
args,
parseInt(args[1])
);
} else {
await message.channel.send(
"Usage correct: test forcer <eventId>"
);
}
return;
case "agd":
if (args.length === 2) {
let guild = await Guilds.findOne({
where: { id: author.Player.guild_id },
});
guild.lastDailyAt -= parseInt(args[1]) * 60000;
guild.save();
}
break;
case "adaily":
if (args.length === 2) {
author.Player.Inventory.lastDailyAt -=
parseInt(args[1]) * 60000;
author.Player.Inventory.save();
}
break;
case "glvl":
if (args.length === 2 && !isNaN(args[1])) {
let guild = await Guilds.findOne({
where: { id: author.Player.guild_id },
});
guild.level = parseInt(args[1]);
guild.save();
}
break;
case "gxp":
if (args.length === 2 && !isNaN(args[1])) {
let guild = await Guilds.findOne({
where: { id: author.Player.guild_id },
});
guild.experience = parseInt(args[1]);
guild.save();
}
break;
case "fakevote":
await require("../../core/DBL").userDBLVote(message.author.id);
break;
case "topggatime":
author.Player.topggVoteAt -= parseInt(args[1]) * 60000;
author.Player.save();
break;
case "fightpointslost":
case "fpl":
if (args.length === 2) {
author.fightPointsLost = parseInt(args[1]);
author.save();
}
break;
case "forcejoinguild":
case "fjg":
if (args.length >= 2) {
let guild = await Guilds.findOne({
where: { id: author.Player.guild_id },
});
if (guild && guild.chief_id === author.Player.id) {
// the chief is leaving : destroy the guild
await Guilds.destroy({
where: {
id: guild.id,
},
});
}
guild = await Guilds.getByName(
args.slice(1, args.length).join(" ")
);
if (guild === null) {
await message.channel.send("Guild not found");
return;
}
author.Player.guild_id = guild.id;
await Promise.all([
guild.save(),
author.save(),
author.Player.save(),
]);
await message.channel.send("Guild joined");
return;
}
break;
case "forceguildowner":
case "fgo":
let guild = await Guilds.findOne({
where: { id: author.Player.guild_id },
});
guild.chief_id = author.Player.id;
await guild.save();
break;
case "pet":
if (args.length === 3) {
if (author.Player.Pet) {
await author.Player.Pet.destroy();
}
if (args[1] === "0") {
break;
}
const pet = PetEntities.createPet(
parseInt(args[1]),
args[2],
null
);
await pet.save();
author.Player.pet_id = pet.id;
await author.Player.save();
break;
}
await message.channel.send(
"Correct usage: test pet <id> <sex = m/f>"
);
return;
case "gp":
case "guildpet":
if (args.length === 3) {
const guild = await Guilds.getById(author.Player.guild_id);
if (!guild) {
await message.channel.send("Not in a guild!");
return;
}
if (Guilds.isPetShelterFull(guild)) {
await message.channel.send("Guild's pet shelter full!");
return;
}
const pet = PetEntities.createPet(
parseInt(args[1]),
args[2],
null
);
await pet.save();
await (await GuildPets.addPet(guild.id, pet.id)).save();
break;
}
await message.channel.send(
"Correct usage: test guildpet <id> <sex = m/f>"
);
return;
case "givefood":
const targetGuild = await Guilds.getById(
author.Player.guild_id
);
targetGuild[args[1]] = parseInt(args[2]);
await targetGuild.save();
return message.channel.send("Done");
case "apfree":
if (args.length === 2) {
author.Player.last_pet_free -= parseInt(args[1]) * 60000;
author.Player.save();
}
break;
case "greward":
await getCommand("gd")(language, message, [], args[1]);
break;
case "block":
let sec = parseInt(args[1]);
const msg = await message.channel.send(
":clock2: You're now blocked for " + sec + " seconds!"
);
let collector = msg.createReactionCollector(
() => {
return true;
},
{
time: sec * 1000,
}
);
collector.on("collect", () => {});
collector.on("end", () => {});
addBlockedPlayer(author.discordUser_id, "test", collector);
break;
case "dailytimeout":
require("../../core/DraftBot").dailyTimeout();
break;
default:
await message.channel.send("Argument inconnu !");
return;
}
} catch (error) {
console.log(error);
await message.channel.send(
":x: | Une erreur est survenue pendant la commande !"
);
return;
}
await message.channel.send(
":man_mage: | Commande test reconnue et appliquée !"
);
};
module.exports = {
commands: [
{
name: "test",
func: TestCommand,
},
],
};
| 37.073345 | 81 | 0.371405 |
9917be91088839189c2c28e38785e13536f86f8b | 384 | js | JavaScript | JS Advanced/Classes and Members/dataClass.js | Tanya-Zheleva/SoftUni-JS-Core | 7bbe4b3dc619bc7c699aa69502090a88bce3ef0d | [
"MIT"
] | null | null | null | JS Advanced/Classes and Members/dataClass.js | Tanya-Zheleva/SoftUni-JS-Core | 7bbe4b3dc619bc7c699aa69502090a88bce3ef0d | [
"MIT"
] | null | null | null | JS Advanced/Classes and Members/dataClass.js | Tanya-Zheleva/SoftUni-JS-Core | 7bbe4b3dc619bc7c699aa69502090a88bce3ef0d | [
"MIT"
] | null | null | null | class HttpRequest {
constructor(method, uri, version, message, response, fulfilled = false) {
this.method = method;
this.uri = uri;
this.version = version;
this.message = message;
this.response = response;
this.fulfilled = fulfilled;
}
}
let request = new HttpRequest('GET', 'google.com', 'HTTP/1.1', '');
console.log(request); | 29.538462 | 77 | 0.611979 |
9918610d689c9b655abb12f14845022f45fd6875 | 403 | js | JavaScript | MyShoppingStoreApp/MyShoppingStore/wwwroot/lib/ckeditor/plugins/emoji/lang/fa.min.js | jdizon0721/ComITProjectPresentation | 16157e2f26266f34f55dd4cb9e0a34fdee6ed78f | [
"MIT"
] | null | null | null | MyShoppingStoreApp/MyShoppingStore/wwwroot/lib/ckeditor/plugins/emoji/lang/fa.min.js | jdizon0721/ComITProjectPresentation | 16157e2f26266f34f55dd4cb9e0a34fdee6ed78f | [
"MIT"
] | null | null | null | MyShoppingStoreApp/MyShoppingStore/wwwroot/lib/ckeditor/plugins/emoji/lang/fa.min.js | jdizon0721/ComITProjectPresentation | 16157e2f26266f34f55dd4cb9e0a34fdee6ed78f | [
"MIT"
] | null | null | null | CKEDITOR.plugins.setLang("emoji","fa",{searchPlaceholder:"جست و جوی ایموجی",searchLabel:"Input field responsible for searching and filtering emoji inside panel.",navigationLabel:"Groups navigation for emoji sections.",title:"لیست ایموجی",groups:{people:"افراد",nature:"طبیعت و حیوانات",food:"غذا و نوشیدنی",travel:"سفر و اماکن",activities:"فعالیت ها",objects:"اشیا",symbols:"نمادها",flags:"پرچمها"}}); | 403 | 403 | 0.774194 |
991913d11b57105f4ccf6ba32caef65ec238c818 | 150 | js | JavaScript | amd-modules/main.js | rongfengliang/javascript-bundlers | 6f8cfb16cb27652b605423d54db53106b8d35bfb | [
"MIT"
] | null | null | null | amd-modules/main.js | rongfengliang/javascript-bundlers | 6f8cfb16cb27652b605423d54db53106b8d35bfb | [
"MIT"
] | null | null | null | amd-modules/main.js | rongfengliang/javascript-bundlers | 6f8cfb16cb27652b605423d54db53106b8d35bfb | [
"MIT"
] | null | null | null | define(['./arith'], function (arith) {
'use strict';
document.querySelector('#result')
.textContent = '2 + 2 = ' + arith.add(2, 2);
});
| 25 | 54 | 0.553333 |
99197742297c21d9b404752f2cd39626981b1013 | 8,316 | js | JavaScript | src/sims/engine2D/PileAttractApp.js | mijuanlo/myphysicslab | 0a3cdf04bb43e036216a0f1f1a8e44b5e0ca340a | [
"Apache-2.0"
] | 273 | 2016-11-11T10:28:34.000Z | 2022-03-31T03:06:53.000Z | src/sims/engine2D/PileAttractApp.js | mijuanlo/myphysicslab | 0a3cdf04bb43e036216a0f1f1a8e44b5e0ca340a | [
"Apache-2.0"
] | 3 | 2017-11-19T17:56:12.000Z | 2021-09-09T00:19:51.000Z | src/sims/engine2D/PileAttractApp.js | mijuanlo/myphysicslab | 0a3cdf04bb43e036216a0f1f1a8e44b5e0ca340a | [
"Apache-2.0"
] | 70 | 2016-12-11T16:18:29.000Z | 2022-03-15T15:15:21.000Z | // Copyright 2016 Erik Neumann. All Rights Reserved.
//
// 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.
goog.module('myphysicslab.sims.engine2D.PileAttractApp');
const array = goog.require('goog.array');
const ButtonControl = goog.require('myphysicslab.lab.controls.ButtonControl');
const CheckBoxControl = goog.require('myphysicslab.lab.controls.CheckBoxControl');
const ChoiceControl = goog.require('myphysicslab.lab.controls.ChoiceControl');
const CollisionAdvance = goog.require('myphysicslab.lab.model.CollisionAdvance');
const CommonControls = goog.require('myphysicslab.sims.common.CommonControls');
const ContactSim = goog.require('myphysicslab.lab.engine2D.ContactSim');
const DampingLaw = goog.require('myphysicslab.lab.model.DampingLaw');
const DisplayShape = goog.require('myphysicslab.lab.view.DisplayShape');
const DoubleRect = goog.require('myphysicslab.lab.util.DoubleRect');
const Engine2DApp = goog.require('myphysicslab.sims.engine2D.Engine2DApp');
const Gravity2Law = goog.require('myphysicslab.lab.model.Gravity2Law');
const ModifiedEuler = goog.require('myphysicslab.lab.model.ModifiedEuler');
const NumericControl = goog.require('myphysicslab.lab.controls.NumericControl');
const ParameterBoolean = goog.require('myphysicslab.lab.util.ParameterBoolean');
const ParameterNumber = goog.require('myphysicslab.lab.util.ParameterNumber');
const PileConfig = goog.require('myphysicslab.sims.engine2D.PileConfig');
const Polygon = goog.require('myphysicslab.lab.engine2D.Polygon');
const RandomLCG = goog.require('myphysicslab.lab.util.RandomLCG');
const Shapes = goog.require('myphysicslab.lab.engine2D.Shapes');
const SixThrusters = goog.require('myphysicslab.sims.engine2D.SixThrusters');
const Util = goog.require('myphysicslab.lab.util.Util');
const Vector = goog.require('myphysicslab.lab.util.Vector');
/** Creates a pile of randomly shaped blocks that clump together under mutual
gravitation.
This app has a config() method which looks at a set of options
and rebuilds the simulation accordingly. UI controls are created to change the options.
*/
class PileAttractApp extends Engine2DApp {
/**
* @param {!Object} elem_ids specifies the names of the HTML
* elementId's to look for in the HTML document; these elements are where the user
* interface of the simulation is created.
*/
constructor(elem_ids) {
const simRect = new DoubleRect(-3, -3, 3, 3);
const sim = new ContactSim();
const advance = new CollisionAdvance(sim);
super(elem_ids, simRect, sim, advance);
/** @type {!ContactSim} */
this.mySim = sim;
this.layout.getSimCanvas().setBackground('black');
this.rbo.protoDragSpring.setWidth(0.3);
this.rbo.protoPolygon.setDrawCenterOfMass(true);
if (1 == 0) {
// draw names of blocks
this.rbo.protoPolygon.setNameColor('gray').setNameFont('10pt sans-serif');
}
this.elasticity.setElasticity(0.8);
this.mySim.setShowForces(false);
this.mySim.setDistanceTol(0.01);
this.mySim.setCollisionAccuracy(0.6);
this.diffEqSolver.setDiffEqSolver(ModifiedEuler.en.NAME);
//this.advance.setDebugLevel(CollisionAdvance.DebugLevel.NONE);
/** @type {!DampingLaw} */
this.dampingLaw = new DampingLaw(0.05, 0.15);
/** @type {!Gravity2Law} */
this.gravityLaw = new Gravity2Law(1);
/** @type {number} */
this.numBlocks = 8;
/** @type {boolean} */
this.squareBlocks = false;
/** @type {number} */
this.randomSeed = 0;
/** @type {!RandomLCG} */
this.buildRNG = new RandomLCG(this.randomSeed);
/** @type {number} */
this.zeroEnergyLevel = 0;
this.addPlaybackControls();
/** @type {!ParameterBoolean} */
let pb;
/** @type {!ParameterNumber} */
let pn;
this.addParameter(pn = new ParameterNumber(this, PileConfig.en.NUM_BLOCKS,
PileConfig.i18n.NUM_BLOCKS,
() => this.getNumBlocks(), a => this.setNumBlocks(a))
.setDecimalPlaces(0));
this.addControl(new NumericControl(pn));
this.addParameter(pb = new ParameterBoolean(this, PileConfig.en.SQUARE_BLOCKS,
PileConfig.i18n.SQUARE_BLOCKS,
() => this.getSquareBlocks(), a => this.setSquareBlocks(a)));
this.addControl(new CheckBoxControl(pb));
this.addParameter(pn = new ParameterNumber(this, PileConfig.en.RANDOM_SEED,
PileConfig.i18n.RANDOM_SEED,
() => this.getRandomSeed(), a => this.setRandomSeed(a))
.setDecimalPlaces(0).setLowerLimit(Util.NEGATIVE_INFINITY));
pn = this.gravityLaw.getParameterNumber(Gravity2Law.en.GRAVITY);
this.addControl(new NumericControl(pn));
this.watchEnergyChange(pn);
pn = this.dampingLaw.getParameterNumber(DampingLaw.en.DAMPING);
this.addControl(new NumericControl(pn));
this.addStandardControls();
const c = new ButtonControl(PileConfig.i18n.REBUILD, () => this.config());
this.addControl(c);
this.makeEasyScript();
this.addURLScriptButton();
this.config();
this.graphSetup();
};
/** @override */
toString() {
return Util.ADVANCED ? '' : this.toStringShort().slice(0, -1)
+', dampingLaw: '+this.dampingLaw.toStringShort()
+', gravityLaw: '+this.gravityLaw.toStringShort()
+ super.toString();
};
/** @override */
getClassName() {
return 'PileAttractApp';
};
/** @override */
defineNames(myName) {
super.defineNames(myName);
this.terminal.addRegex('gravityLaw|dampingLaw',
myName+'.');
this.terminal.addRegex('PileConfig|PileAttractApp|Engine2DApp',
'myphysicslab.sims.engine2D.', /*addToVars=*/false);
};
/** @override */
getSubjects() {
return super.getSubjects().concat(this.dampingLaw, this.gravityLaw);
};
/**
* @return {undefined}
*/
config() {
this.randomSeed = this.buildRNG.getSeed();
const elasticity = this.elasticity.getElasticity();
this.mySim.cleanSlate();
Polygon.ID = 1;
this.advance.reset();
this.mySim.addForceLaw(this.dampingLaw);
this.dampingLaw.connect(this.mySim.getSimList());
this.mySim.addForceLaw(this.gravityLaw);
this.gravityLaw.connect(this.mySim.getSimList());
const half = Math.floor(this.numBlocks/2);
const rest = this.numBlocks-half;
const blocks = PileConfig.makeRandomBlocks(this.mySim, /* num blocks=*/half,
/* x=*/-half/2, /* y=*/1, this.buildRNG, /*rightAngle=*/this.squareBlocks);
array.extend(blocks, PileConfig.makeRandomBlocks(this.mySim,
/* num blocks=*/rest, /* x=*/-half/2, /* y=*/-1, this.buildRNG,
/*rightAngle=*/this.squareBlocks));
// set random colors for blocks
blocks.forEach(b =>
this.displayList.findShape(b).setFillStyle(PileConfig.getRandomColor()));
this.mySim.setElasticity(elasticity);
this.mySim.getVarsList().setTime(0);
this.mySim.saveInitialState();
this.clock.setTime(0);
this.clock.setRealTime(0);
this.easyScript.update();
};
/**
* @return {number}
*/
getNumBlocks() {
return this.numBlocks;
};
/**
* @param {number} value
*/
setNumBlocks(value) {
this.numBlocks = value;
this.config();
this.broadcastParameter(PileConfig.en.NUM_BLOCKS);
};
/** Returns the seed of the random number generator used to determine sizes of blocks.
* @return {number}
*/
getRandomSeed() {
return this.randomSeed;
};
/** Sets the seed of the random number generator used to determine sizes of blocks
* @param {number} value
*/
setRandomSeed(value) {
this.randomSeed = value;
this.buildRNG.setSeed(value);
this.config();
this.broadcastParameter(PileConfig.en.RANDOM_SEED);
};
/**
* @return {boolean}
*/
getSquareBlocks() {
return this.squareBlocks;
};
/**
* @param {boolean} value
*/
setSquareBlocks(value) {
this.squareBlocks = value;
this.config();
this.broadcastParameter(PileConfig.en.SQUARE_BLOCKS);
};
} // end class
/**
* @param {!Object} elem_ids
* @return {!PileAttractApp}
*/
function makePileAttractApp(elem_ids) {
return new PileAttractApp(elem_ids);
};
goog.exportSymbol('makePileAttractApp', makePileAttractApp);
exports = PileAttractApp;
| 33.532258 | 87 | 0.72619 |
9919ded31a7fafa2f4e5ce6c0221d84346479c1e | 4,124 | js | JavaScript | vendor/assets/components/jsts-es/src/org/locationtech/jts/geomgraph/PlanarGraph.js | ekylibre/cartography | 0dc98ff4780486412bd455140b3a3babb54f62d0 | [
"MIT"
] | null | null | null | vendor/assets/components/jsts-es/src/org/locationtech/jts/geomgraph/PlanarGraph.js | ekylibre/cartography | 0dc98ff4780486412bd455140b3a3babb54f62d0 | [
"MIT"
] | 3 | 2018-01-31T17:31:40.000Z | 2021-05-07T11:57:49.000Z | vendor/assets/components/jsts-es/src/org/locationtech/jts/geomgraph/PlanarGraph.js | ekylibre/cartography | 0dc98ff4780486412bd455140b3a3babb54f62d0 | [
"MIT"
] | null | null | null | import Location from '../geom/Location';
import CGAlgorithms from '../algorithm/CGAlgorithms';
import Coordinate from '../geom/Coordinate';
import Node from './Node';
import extend from '../../../../extend';
import NodeMap from './NodeMap';
import DirectedEdge from './DirectedEdge';
import System from '../../../../java/lang/System';
import ArrayList from '../../../../java/util/ArrayList';
import Quadrant from './Quadrant';
import NodeFactory from './NodeFactory';
export default function PlanarGraph() {
this._edges = new ArrayList();
this._nodes = null;
this._edgeEndList = new ArrayList();
if (arguments.length === 0) {
this._nodes = new NodeMap(new NodeFactory());
} else if (arguments.length === 1) {
let nodeFact = arguments[0];
this._nodes = new NodeMap(nodeFact);
}
}
extend(PlanarGraph.prototype, {
printEdges: function (out) {
out.println("Edges:");
for (var i = 0; i < this._edges.size(); i++) {
out.println("edge " + i + ":");
var e = this._edges.get(i);
e.print(out);
e.eiList.print(out);
}
},
find: function (coord) {
return this._nodes.find(coord);
},
addNode: function () {
if (arguments[0] instanceof Node) {
let node = arguments[0];
return this._nodes.addNode(node);
} else if (arguments[0] instanceof Coordinate) {
let coord = arguments[0];
return this._nodes.addNode(coord);
}
},
getNodeIterator: function () {
return this._nodes.iterator();
},
linkResultDirectedEdges: function () {
for (var nodeit = this._nodes.iterator(); nodeit.hasNext(); ) {
var node = nodeit.next();
node.getEdges().linkResultDirectedEdges();
}
},
debugPrintln: function (o) {
System.out.println(o);
},
isBoundaryNode: function (geomIndex, coord) {
var node = this._nodes.find(coord);
if (node === null) return false;
var label = node.getLabel();
if (label !== null && label.getLocation(geomIndex) === Location.BOUNDARY) return true;
return false;
},
linkAllDirectedEdges: function () {
for (var nodeit = this._nodes.iterator(); nodeit.hasNext(); ) {
var node = nodeit.next();
node.getEdges().linkAllDirectedEdges();
}
},
matchInSameDirection: function (p0, p1, ep0, ep1) {
if (!p0.equals(ep0)) return false;
if (CGAlgorithms.computeOrientation(p0, p1, ep1) === CGAlgorithms.COLLINEAR && Quadrant.quadrant(p0, p1) === Quadrant.quadrant(ep0, ep1)) return true;
return false;
},
getEdgeEnds: function () {
return this._edgeEndList;
},
debugPrint: function (o) {
System.out.print(o);
},
getEdgeIterator: function () {
return this._edges.iterator();
},
findEdgeInSameDirection: function (p0, p1) {
for (var i = 0; i < this._edges.size(); i++) {
var e = this._edges.get(i);
var eCoord = e.getCoordinates();
if (this.matchInSameDirection(p0, p1, eCoord[0], eCoord[1])) return e;
if (this.matchInSameDirection(p0, p1, eCoord[eCoord.length - 1], eCoord[eCoord.length - 2])) return e;
}
return null;
},
insertEdge: function (e) {
this._edges.add(e);
},
findEdgeEnd: function (e) {
for (var i = this.getEdgeEnds().iterator(); i.hasNext(); ) {
var ee = i.next();
if (ee.getEdge() === e) return ee;
}
return null;
},
addEdges: function (edgesToAdd) {
for (var it = edgesToAdd.iterator(); it.hasNext(); ) {
var e = it.next();
this._edges.add(e);
var de1 = new DirectedEdge(e, true);
var de2 = new DirectedEdge(e, false);
de1.setSym(de2);
de2.setSym(de1);
this.add(de1);
this.add(de2);
}
},
add: function (e) {
this._nodes.add(e);
this._edgeEndList.add(e);
},
getNodes: function () {
return this._nodes.values();
},
findEdge: function (p0, p1) {
for (var i = 0; i < this._edges.size(); i++) {
var e = this._edges.get(i);
var eCoord = e.getCoordinates();
if (p0.equals(eCoord[0]) && p1.equals(eCoord[1])) return e;
}
return null;
},
interfaces_: function () {
return [];
},
getClass: function () {
return PlanarGraph;
}
});
PlanarGraph.linkResultDirectedEdges = function (nodes) {
for (var nodeit = nodes.iterator(); nodeit.hasNext(); ) {
var node = nodeit.next();
node.getEdges().linkResultDirectedEdges();
}
};
| 28.839161 | 152 | 0.64937 |
991a82f67fd8afd75f7dbc9048bf50cef0160c61 | 2,146 | js | JavaScript | node_modules/@bochilteam/scraper/lib/cjs/encryptions/test.js | 01072007/Botz2 | 10ecdabc0ea707346f406f5d7f4b55eb1376ce8f | [
"MIT"
] | null | null | null | node_modules/@bochilteam/scraper/lib/cjs/encryptions/test.js | 01072007/Botz2 | 10ecdabc0ea707346f406f5d7f4b55eb1376ce8f | [
"MIT"
] | null | null | null | node_modules/@bochilteam/scraper/lib/cjs/encryptions/test.js | 01072007/Botz2 | 10ecdabc0ea707346f406f5d7f4b55eb1376ce8f | [
"MIT"
] | null | null | null | "use strict";
Object.defineProperty(exports, "__esModule", { value: true });
const chai_1 = require("chai");
const index_js_1 = require("./index.js");
describe('Encryptions', () => {
describe('Base64', () => {
it('From string to base64', done => {
try {
const res = (0, index_js_1.toBase64)('Hello World!!');
(0, chai_1.expect)(res).to.be.a('string');
(0, chai_1.expect)(res).to.be.equal('SGVsbG8gV29ybGQhIQ==');
return done();
}
catch (e) {
return done(e);
}
});
it('from base64 to string', done => {
try {
const res = (0, index_js_1.fromBase64ToString)('SGVsbG8gV29ybGQhIQ==');
(0, chai_1.expect)(res).to.be.a('string');
(0, chai_1.expect)(res).to.be.equal('Hello World!!');
return done();
}
catch (e) {
return done(e);
}
});
});
describe('Crypto', () => {
it('randomUUID', done => {
try {
const res = (0, index_js_1.randomUUID)();
(0, chai_1.expect)(res).to.be.a('string');
return done();
}
catch (e) {
return done(e);
}
});
it('randomBytes', done => {
try {
const res = (0, index_js_1.randomBytes)(16);
(0, chai_1.expect)(res).to.be.a('string');
return done();
}
catch (e) {
return done(e);
}
});
it('createHash', done => {
try {
const res = (0, index_js_1.createHash)('sha256', 'Hello world!!');
(0, chai_1.expect)(res).to.be.a('string');
(0, chai_1.expect)(res).to.have.length(64);
return done();
}
catch (e) {
return done(e);
}
});
});
});
//# sourceMappingURL=test.js.map | 33.53125 | 88 | 0.403541 |
991ab910ac951370e9ca0649fbc1317660e54fed | 545 | js | JavaScript | docs/precache-manifest.f8b17331ffd34652877356b042b9c81e.js | carmen-tm/f-online-pokemon-carmen-tm | 5eb7df49ffb5be6d6cfa977ae364c6c038b6acb7 | [
"MIT"
] | 1 | 2019-06-20T09:17:17.000Z | 2019-06-20T09:17:17.000Z | docs/precache-manifest.f8b17331ffd34652877356b042b9c81e.js | Adalab/f-online-pokemon-carmen-tm | 5eb7df49ffb5be6d6cfa977ae364c6c038b6acb7 | [
"MIT"
] | 9 | 2019-06-20T10:02:01.000Z | 2021-01-28T10:47:12.000Z | docs/precache-manifest.f8b17331ffd34652877356b042b9c81e.js | carmen-tm/f-online-pokemon-carmen-tm | 5eb7df49ffb5be6d6cfa977ae364c6c038b6acb7 | [
"MIT"
] | 1 | 2019-06-29T18:09:29.000Z | 2019-06-29T18:09:29.000Z | self.__precacheManifest = (self.__precacheManifest || []).concat([
{
"revision": "ace772648a0e6dc94ee6382fe9e65089",
"url": "./index.html"
},
{
"revision": "3e984a769f531a18e98d",
"url": "./static/css/main.731409ef.chunk.css"
},
{
"revision": "5e9d2e38914a9e4e516e",
"url": "./static/js/2.f2ae70ff.chunk.js"
},
{
"revision": "3e984a769f531a18e98d",
"url": "./static/js/main.f5897ea8.chunk.js"
},
{
"revision": "8c97409f0ee389fe75da",
"url": "./static/js/runtime~main.d653cc00.js"
}
]); | 24.772727 | 66 | 0.614679 |
991b576842def34bce80c6fe281a4fff6c0c7e7f | 50,323 | js | JavaScript | serverless/lambda/index.js | aredhead1370/amazon-ivs-ugc-web-demo | 5ef7ada5deb1d7b461483cf1e31b492770adb538 | [
"MIT-0",
"MIT"
] | 14 | 2020-12-02T22:49:25.000Z | 2021-12-05T06:41:11.000Z | serverless/lambda/index.js | anoop4bhat/UGCAppRepo | cea2193251615679b4909f9ef1fc4c78c170b69c | [
"MIT-0",
"MIT"
] | 6 | 2020-12-14T17:33:56.000Z | 2022-03-02T01:40:32.000Z | serverless/lambda/index.js | anoop4bhat/UGCAppRepo | cea2193251615679b4909f9ef1fc4c78c170b69c | [
"MIT-0",
"MIT"
] | 10 | 2021-02-20T17:04:58.000Z | 2022-03-01T04:10:40.000Z | const https = require('https');
const AWS = require('aws-sdk');
const jwt = require('jsonwebtoken');
const jwkToPem = require('jwk-to-pem');
const region = 'us-west-2';
const cognitoISP = new AWS.CognitoIdentityServiceProvider({
apiVersion: '2016-04-18',
region
});
const ddb = new AWS.DynamoDB();
const ivs = new AWS.IVS({
apiVersion: '2020-07-14',
region // Must be in one of the supported regions
});
const {
COGNITO_USER_POOL_ID,
COGNITO_USER_POOL_CLIENT_ID,
CHANNELS_TABLE_NAME
} = process.env;
const response = {
"statusCode": 200,
"headers": {
"Access-Control-Allow-Origin": "*",
"Access-Control-Allow-Methods": "OPTIONS,GET,PUT,POST,DELETE",
"Access-Control-Allow-Headers": "*",
"Content-Type": "application/json"
},
"body": '',
"isBase64Encoded": false
};
const uuid = () => {
return 'xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) {
var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8);
return v.toString(16);
});
}
// For IVS channel name remove all special characters except for - and _
const rmSpChar = (str) => {
return str.replace(/[`~!@#$%^&*()|+=?;:'",.<>\{\}\[\]\\\/]/gi, '');
}
/* Cognito */
// Take line 1
const cognitoErrors = (str) => {
const lines = str.split(/\n/g);
return lines[0];
};
// TODO: convert to authorizer
const getJWKS = () => {
// https://cognito-idp.{region}.amazonaws.com/{userPoolId}/.well-known/jwks.json
return new Promise((resolve, reject) => {
https.get(`https://cognito-idp.${region}.amazonaws.com/${COGNITO_USER_POOL_ID}/.well-known/jwks.json`, (resp) => {
let data = '';
resp.on('data', (chunk) => {
data += chunk;
});
resp.on('end', () => {
// console.log(JSON.parse(data));
resolve(JSON.parse(data));
});
}).on("error", (err) => {
console.log("Error: " + err.message);
reject(err);
});
});
};
// TODO: convert to authorizer
const verifyAccessToken = (event) => {
return new Promise((resolve, reject) => {
let header_access_token;
if (event.headers && event.headers.Authorization) {
const bearer_token = event.headers.Authorization.split(' ');
header_access_token = bearer_token[0];
}
if (!header_access_token && !event.queryStringParameters.access_token) {
let errMsg = 'Must provide access token';
console.log(`verifyAccessToken > missing required fields: ${errMsg}`);
reject(errMsg);
return;
}
const accessToken = header_access_token || event.queryStringParameters.access_token;
getJWKS().then(jwks => {
let pem = jwkToPem(jwks.keys[1]);
console.log('verifyAccessToken > pem:', pem);
jwt.verify(accessToken, pem, { algorithms: ['RS256'] }, function(err, decodedToken) {
if (err) {
console.log('verifyAccessToken > jwt verify > error:', err);
reject(err);
}
// console.log('verifyAccessToken > decodedToken:', decodedToken);
resolve({
accessToken,
decodedToken
});
});
})
.catch(err => {
console.log('verifyAccessToken > getJWKS > err:', err);
});
});
};
// For demo only, not recommended for Production environment.
exports.preSignUp = (event, context, callback) => {
console.log("presignup event:", JSON.stringify(event, null, 2));
event.response.autoConfirmUser = true;
event.response.autoVerifyEmail = true;
callback(null, event);
};
const _updateUserAttribute = (username, newUserAttr) => {
return new Promise((resolve, reject) => {
try {
console.info("_updateUserAttribute > newUserAttr:", JSON.stringify(newUserAttr, '', 2));
let params = {
UserPoolId: COGNITO_USER_POOL_ID,
Username: username
};
console.log(`params:`, JSON.stringify(params, null, 2));
cognitoISP.adminGetUser(params, function(err, userData) {
if (err) {
console.log('_updateUserAttribute > adminGetUser > err:', err);
reject(err);
return;
}
console.log(`_updateUserAttribute > adminGetUser > userData:`, userData);
if (!userData) {
resolve(null);
return;
}
const updatedUserAttributes = [];
// console.log('userData.UserAttributes:', userData.UserAttributes);
if (newUserAttr.Name === 'profile') {
const savedAttrIndex = userData.UserAttributes.findIndex(obj => obj.Name === newUserAttr.Name);
if (savedAttrIndex !== -1) {
console.log('_updateUserAttribute > savedAttrIndex:', savedAttrIndex);
const savedAttrValueAsJson = JSON.parse(userData.UserAttributes[savedAttrIndex].Value);
console.log('_updateUserAttribute > savedAttrValueAsJson:', JSON.stringify(savedAttrValueAsJson, null, 2));
const mergedAttrValue = {
...savedAttrValueAsJson,
...newUserAttr.Value
};
console.log('_updateUserAttribute > mergedAttrValue:', JSON.stringify(mergedAttrValue, null, 2));
newUserAttr.Value = JSON.stringify(mergedAttrValue);
updatedUserAttributes.push(newUserAttr);
}
} else {
updatedUserAttributes.push(newUserAttr);
}
console.log('_updateUserAttribute > updatedUserAttributes:', JSON.stringify(updatedUserAttributes, null, 2));
params = {
UserPoolId: COGNITO_USER_POOL_ID,
Username: username,
UserAttributes: updatedUserAttributes
};
console.log('_updateUserAttribute > params:', JSON.stringify(params, null, 2));
cognitoISP.adminUpdateUserAttributes(params, function(err, data) {
if (err) {
reject(err);
}
resolve({
userAttributes: updatedUserAttributes,
updatedResult: data
});
});
});
} catch(err) {
console.info("_updateUserAttribute > try/catch:", err);
reject(err);
}
});
};
exports.signUp = (event, context, callback) => {
console.log("signup event:", JSON.stringify(event, null, 2));
let payload;
try {
payload = JSON.parse(event.body);
} catch (err) {
console.log("signup event > parse payload:", JSON.stringify(err, null, 2));
response.statusCode = 500;
response.body = JSON.stringify(err);
callback(null, response);
return;
}
if (!payload || !payload.email || !payload.password || !payload.avatar || !payload.bgColor ) {
console.log("signup event > missing required field(s): Must provide email, password, avatar and background color");
response.statusCode = 400;
response.body = "Must provide email, password, avatar and background color";
callback(null, response);
return;
}
try {
const segments = payload.email.split('@');
const username = segments[0];
const profile = {
bgColor: payload.bgColor
};
const UserAttributes = [
{
Name: 'email',
Value: payload.email
},
{
Name: 'preferred_username',
Value: username
},
{
Name: 'picture',
Value: payload.avatar
},
{
Name: 'profile',
Value: JSON.stringify(profile)
}
];
const params = {
ClientId: COGNITO_USER_POOL_CLIENT_ID,
Username: payload.email,
Password: payload.password,
UserAttributes
};
// console.info("signup event > params:", JSON.stringify(params, null, 2));
cognitoISP.signUp(params, function(err, signUpResult) {
if (err) {
console.log("signup event > error:", err, err.stack);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
console.info("signup event > signUp > error > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
console.info("signup event > signUp > success > result:", JSON.stringify(signUpResult, '', 2));
// Add default channel
const defaultChannel = {
name: `${rmSpChar(username)}s-live-stream`
};
if (payload.channelLatencyMode) {
defaultChannel.latencyMode = payload.channelLatencyMode;
}
if (payload.channelType) {
defaultChannel.type = payload.channelType;
}
const defaultChannelName = `${username}'s live stream`;
_createChannel(defaultChannel)
.then((channel) => {
console.log("signup event > _createChannel > channel:", JSON.stringify(channel, '', 2));
const channelAttribute = {
Name: 'profile',
Value: {
defaultChannelName,
defaultChannelDetails: channel
}
};
console.log("signup event > channelAttribute:", JSON.stringify(channelAttribute, '', 2));
_updateUserAttribute(payload.email, channelAttribute).then(() => {
const ddbPayload = {
sub: signUpResult.UserSub,
username,
avatar: payload.avatar,
bgColor: payload.bgColor,
name: defaultChannelName,
channelArn: channel.channel.arn,
channel: channel
};
console.log("signup event > ddbPayload:", JSON.stringify(ddbPayload, '', 2));
_createDdbChannel(ddbPayload).then(() => {
// For demo only, not recommended for Production
const authPayload = {
email: payload.email,
password: payload.password
};
_authUser(authPayload).then((authResult) => {
console.log("signup event > success:", JSON.stringify(authResult, '', 2));
response.statusCode = 201;
response.body = JSON.stringify(authResult, '', 2);
console.info("signup event > response:", JSON.stringify(authResult, '', 2));
callback(null, response);
})
.catch((err) => {
console.info("signup event > _authUser > err:", err);
response.statusCode = 500;
response.body = JSON.stringify(err.stack);
callback(null, response);
return;
});
})
.catch((err) => {
console.info("signup event > _createDdbChannel > err:", err);
response.statusCode = 500;
response.body = JSON.stringify(err.stack);
callback(null, response);
return;
});
})
.catch((err) => {
console.info("signup event > _updateUserAttribute > err:", err);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
callback(null, response);
return;
});
})
.catch((err) => {
console.info("signup event > _createChannel > err:", err);
response.statusCode = 500;
response.body = err.stack;
callback(null, response);
return;
});
});
} catch(err) {
console.info("signup event > try/catch:", err);
response.statusCode = 500;
response.body = err;
callback(null, response);
return;
}
};
const _authUser = (payload) => {
return new Promise((resolve, reject) => {
try {
const params = {
AuthFlow: 'USER_PASSWORD_AUTH',
ClientId: COGNITO_USER_POOL_CLIENT_ID,
AuthParameters: {
USERNAME: payload.email,
PASSWORD: payload.password
}
};
console.info("auth event > response:", JSON.stringify(params, null, 2));
cognitoISP.initiateAuth(params, function(err, data) {
if (err) {
console.log("auth event > error:", err, err.stack);
reject(err);
return;
}
console.log("auth event > success:", JSON.stringify(data, '', 2));
resolve(data);
});
} catch(err) {
console.info("_authUser > err:", err, err.stack);
reject(err);
}
});
};
exports.authUser = (event, context, callback) => {
console.log("auth event:", JSON.stringify(event, null, 2));
let payload;
try {
payload = JSON.parse(event.body);
} catch (err) {
console.log("auth event > parse payload:", JSON.stringify(err, null, 2));
response.statusCode = 500;
response.body = JSON.stringify(err);
callback(null, response);
return;
}
if (!payload || !payload.email || !payload.password ) {
console.log("auth event > missing required field(s): Must provide email and password");
response.statusCode = 400;
response.body = "Must provide email and password";
callback(null, response);
return;
}
try {
const params = {
AuthFlow: 'USER_PASSWORD_AUTH',
ClientId: COGNITO_USER_POOL_CLIENT_ID,
AuthParameters: {
USERNAME: payload.email,
PASSWORD: payload.password
}
};
console.info("auth event > response:", JSON.stringify(params, null, 2));
cognitoISP.initiateAuth(params, function(err, data) {
if (err) {
console.log("auth event > error:", err, err.stack);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
console.info("auth event > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
console.log("auth event > success:", JSON.stringify(data, '', 2));
response.statusCode = 200;
response.body = JSON.stringify(data, '', 2);
console.info("auth event > response:", JSON.stringify(response, '', 2));
callback(null, response);
});
} catch(err) {
console.info("auth event > err:", err);
response.statusCode = 500;
response.body = err.stack;
callback(null, response);
return;
}
};
exports.getUserAdmin = (event, context, callback) => {
console.log("getUserAdmin event:", JSON.stringify(event, null, 2));
if (!event.queryStringParameters.username) {
console.log("getUserAdmin event > missing required fields: Must provide username");
response.statusCode = 400;
response.body = "Must provide username";
callback(null, response);
return;
}
try {
const params = {
UserPoolId: COGNITO_USER_POOL_ID,
Username: event.queryStringParameters.username
};
console.info("getUserAdmin event > params:", JSON.stringify(params, '', 2));
cognitoISP.adminGetUser(params, function(err, data) {
if (err) {
console.log("getUserAdmin event > error:", err, err.stack);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
console.info("getUserAdmin event > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
console.log("getUserAdmin event > success:", JSON.stringify(data, '', 2));
response.statusCode = 201;
response.body = JSON.stringify(data, '', 2);
console.info("getUserAdmin event > success > response:", JSON.stringify(response, '', 2));
callback(null, response);
});
} catch(err) {
console.info("getUserAdmin event > err:", err, err.stack);
response.statusCode = 500;
response.body = err.stack;
callback(null, response);
}
};
const _getCognitoUser = (AccessToken) => {
console.log("_getCognitoUser:", AccessToken);
return new Promise((resolve, reject) => {
try {
const params = {
AccessToken
};
console.info("_getCognitoUser > params:", JSON.stringify(params, '', 2));
cognitoISP.getUser(params, function(err, data) {
if (err) {
console.log("_getCognitoUser > error:", err, err.stack);
reject(err);
return;
}
resolve(data);
});
} catch(err) {
console.info("_getCognitoUser > err:", err);
reject(err);
}
});
};
exports.getUser = async (event, context, callback) => {
console.log("getUser event:", JSON.stringify(event, null, 2));
let header_access_token;
if (event.headers && event.headers.Authorization) {
const bearer_token = event.headers.Authorization.split(' ');
header_access_token = bearer_token[0];
}
if (!header_access_token && !event.queryStringParameters.access_token) {
console.log("getUser event > missing required fields: Must provide access token");
response.statusCode = 400;
response.body = "Must provide access token";
callback(null, response);
return;
}
try {
const userData = await _getCognitoUser(header_access_token || event.queryStringParameters.access_token);
// Convert `profile` attribute value from string to JSON
if (userData && userData.UserAttributes && userData.UserAttributes.length) {
let len = userData.UserAttributes.length;
while(--len >= 0) {
if (userData.UserAttributes[len].Name === 'profile') {
userData.UserAttributes[len].Value = JSON.parse(userData.UserAttributes[len].Value);
break;
}
}
}
console.log("getUser event > success:", JSON.stringify(userData, '', 2));
response.statusCode = 200;
response.body = JSON.stringify(userData, '', 2);
console.info("getUser event > success > response:", JSON.stringify(response, '', 2));
callback(null, response);
} catch(err) {
console.info("getUser event > err:", err, err.stack);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
callback(null, response);
}
};
exports.updateUserAttribute = (event, context, callback) => {
console.log("updateUserAttribute event:", JSON.stringify(event, null, 2));
verifyAccessToken(event).then(result => {
const { accessToken, decodedToken } = result;
let payload;
try {
payload = JSON.parse(event.body);
} catch (err) {
console.log("updateUserAttribute event > parse payload:", JSON.stringify(err, null, 2));
response.statusCode = 500;
response.body = JSON.stringify(err);
callback(null, response);
return;
}
if (!payload || !payload.Name || !payload.Value) {
console.log("updateUserAttribute event > missing required field(s): Must provide Name and Value");
response.statusCode = 400;
response.body = "Must provide Must provide Name and Value";
callback(null, response);
return;
}
if (payload.Value.defaultChannelDetails) {
delete payload.Value.defaultChannelDetails;
if (!Object.keys(payload.Value).length) {
console.log("updateUserAttribute event > defaultChannelDetails");
response.statusCode = 200;
response.body = '';
console.info("updateUserAttribute event > defaultChannelDetails > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
}
_updateUserAttribute(decodedToken.username, payload).then((updateAttrsResult) => {
console.info("updateUserAttribute event > _updateUserAttribute > updateAttrsResult:", JSON.stringify(updateAttrsResult, '', 2));
_updateDDBChannelUserProfile(accessToken).then(() => {
console.log("updateUserAttribute event > success:", JSON.stringify(updateAttrsResult, '', 2));
response.statusCode = 200;
response.body = JSON.stringify(updateAttrsResult, '', 2);
console.info("updateUserAttribute event > response:", JSON.stringify(response, '', 2));
callback(null, response);
})
.catch((err) => {
console.info("updateUserAttribute event > _updateDDBChannelUserProfile > err:", err);
response.statusCode = 500;
response.body = JSON.stringify(err);
callback(null, response);
return;
});
})
.catch((err) => {
console.info("updateUserAttribute event > updateUserAttribute > err:", err);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
callback(null, response);
return;
});
})
.catch(err => {
console.log("updateUserAttribute event > verifyAccessToken > error:", err);
response.statusCode = 500;
response.body = err;
console.info("updateUserAttribute event > verifyAccessToken > error > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
});
};
exports.changePassword = (event, context, callback) => {
console.log("changePassword event:", JSON.stringify(event, null, 2));
verifyAccessToken(event).then(result => {
const { accessToken } = result;
let payload;
try {
payload = JSON.parse(event.body);
} catch (err) {
console.log("changePassword event > parse payload:", JSON.stringify(err, null, 2));
response.statusCode = 500;
response.body = JSON.stringify(err);
callback(null, response);
return;
}
if (!payload || !payload.oldPassword || !payload.newPassword) {
console.log("changePassword event > missing required field(s): Must provide old and new password");
response.statusCode = 400;
response.body = "Must provide Must provide old and new password";
callback(null, response);
return;
}
var params = {
AccessToken: accessToken,
PreviousPassword: payload.oldPassword,
ProposedPassword: payload.newPassword
};
cognitoISP.changePassword(params, function(err, data) {
if (err) {
console.log("changePassword event > error:", err, err.stack);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
console.info("changePassword event > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
console.log("changePassword event > success:", JSON.stringify(data, '', 2));
response.statusCode = 200;
response.body = JSON.stringify(data, '', 2);
console.info("changePassword event > success > response:", JSON.stringify(response, '', 2));
callback(null, response);
});
})
.catch(err => {
console.log("changePassword event > verifyAccessToken > error:", err);
response.statusCode = 500;
response.body = err;
console.info("changePassword event > verifyAccessToken > error > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
});
};
exports.deleteUser = (event, context, callback) => {
console.log("deleteUser event:", JSON.stringify(event, null, 2));
verifyAccessToken(event).then(result => {
const { decodedToken } = result;
try {
const params = {
UserPoolId: COGNITO_USER_POOL_ID,
Username: decodedToken.username
};
// console.info("delete event > params:", JSON.stringify(params, '', 2));
cognitoISP.adminGetUser(params, function(err, userData) {
if (err) {
console.log("delete event > adminGetUser > error:", err, err.stack);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
console.info("delete event > adminGetUser > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
console.log("delete event > userData:", JSON.stringify(userData, '', 2));
const profileAttr = userData.UserAttributes.find(obj => obj.Name === 'profile');
console.log("delete event > profileAttr:", JSON.stringify(profileAttr, '', 2));
let userDefaultChannelArn;
if (profileAttr) {
const savedAttrValueAsJson = JSON.parse(profileAttr.Value);
if (savedAttrValueAsJson.defaultChannelDetails) {
userDefaultChannelArn = savedAttrValueAsJson.defaultChannelDetails.channel.arn;
}
}
console.log("delete event > userDefaultChannelArn:", JSON.stringify(userDefaultChannelArn, '', 2));
cognitoISP.adminDisableUser(params, function(err, data) {
if (err) {
console.log("delete event > disable > error:", err, err.stack);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
console.info("delete event > disable > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
cognitoISP.adminDeleteUser(params, function(err, data) {
if (err) {
console.log("delete event > delete > error:", err, err.stack);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
console.info("delete event > delete> response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
if (userDefaultChannelArn) {
_deleteChannel(userDefaultChannelArn)
.then((data) => {
const subAttr = userData.UserAttributes.find(obj => obj.Name === 'sub');
console.log("delete event > preferredUsernameAttr:", JSON.stringify(subAttr, '', 2));
_deleteDdbChannel(subAttr.Value).then(() => {
console.log("delete event > delete > success:", JSON.stringify(data, '', 2));
response.statusCode = 200;
// response.body = JSON.stringify(data, '', 2);
console.info("delete event > delete > response:", JSON.stringify(response, '', 2));
callback(null, response);
})
.catch((err) => {
console.info("delete event > _deleteDdbChannel > err:", err);
response.statusCode = 500;
response.body = err;
callback(null, response);
return;
});
})
.catch((err) => {
console.info("delete event > _deleteChannel > err:", err);
response.statusCode = 500;
response.body = err;
callback(null, response);
return;
});
} else {
console.log("delete event > delete > success:", JSON.stringify(data, '', 2));
response.statusCode = 200;
// response.body = JSON.stringify(data, '', 2);
console.info("delete event > delete > response:", JSON.stringify(response, '', 2));
callback(null, response);
}
});
});
});
} catch(err) {
console.info("create event > try/catch:", err);
response.statusCode = 500;
response.body = err;
callback(null, response);
}
})
.catch(err => {
console.log("deleteUser event > verifyAccessToken > error:", err);
response.statusCode = 500;
response.body = err;
console.info("deleteUser event > verifyAccessToken > error > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
});
};
/* DDB */
const _createDdbChannel = async (payload) => {
try {
const result = await ddb.putItem({
TableName: CHANNELS_TABLE_NAME,
Item: {
'Id': { S: payload.sub },
'Username': { S: payload.username },
'Avatar': { S: payload.avatar },
'BgColor': { S: payload.bgColor },
'Name': { S: payload.name },
'ChannelArn': { S: payload.channelArn },
'Channel': { S: JSON.stringify(payload.channel) },
'ChannelStatus': { S: '' },
'IsLive': { BOOL: false }
}
}).promise();
console.info("_createDdbChannel > result:", result);
return result;
} catch(err) {
console.info("_createDdbChannel > err:", err, err.stack);
throw new Error(err);
}
};
const _updateDDBChannelUserProfile = async (accessToken) => {
try {
const userData = await _getCognitoUser(accessToken);
const subAttr = userData.UserAttributes.find(obj => obj.Name === 'sub');
const preferredUsernameAttr = userData.UserAttributes.find(obj => obj.Name === 'preferred_username');
const pictureAttr = userData.UserAttributes.find(obj => obj.Name === 'picture');
const profileAttr = userData.UserAttributes.find(obj => obj.Name === 'profile');
const profileAttrValue = JSON.parse(profileAttr.Value);
const params = {
TableName: CHANNELS_TABLE_NAME,
Key: {
'Id': {
S: subAttr.Value
},
},
ExpressionAttributeNames: {
'#Username': 'Username',
'#Avatar': 'Avatar',
'#BgColor': 'BgColor',
'#Name': 'Name',
'#Channel': 'Channel'
},
ExpressionAttributeValues: {
':username': {
S: preferredUsernameAttr.Value
},
':avatar': {
S: pictureAttr.Value
},
':bgColor': {
S: profileAttrValue.bgColor
},
':name': {
S: profileAttrValue.defaultChannelName
},
':channel': {
S: JSON.stringify(profileAttrValue.defaultChannelDetails)
}
},
UpdateExpression: 'SET #Username = :username, #Avatar = :avatar, #BgColor = :bgColor, #Name = :name, #Channel = :channel',
ReturnValues: "ALL_NEW"
};
console.info("_updateDDBChannelUserProfile > params:", JSON.stringify(params, null, 2));
const result = await ddb.updateItem(params).promise();
return result;
} catch(err) {
console.info("_updateDDBChannelUserProfile > err:", err, err.stack);
throw new Error(err);
}
};
const _updateDDBChannelIsLive = async (isLive, id, stream) => {
try {
const params = {
TableName: CHANNELS_TABLE_NAME,
Key: {
'Id': {
S: id
},
},
ExpressionAttributeNames: {
'#IsLive': 'IsLive',
'#ChannelStatus': 'ChannelStatus'
},
ExpressionAttributeValues: {
':isLive': {
BOOL: isLive
},
':channelStatus': {
S: isLive ? JSON.stringify(stream) : '{}'
}
},
UpdateExpression: 'SET #IsLive = :isLive, #ChannelStatus = :channelStatus',
ReturnValues: "ALL_NEW"
};
console.info("_updateDDBChannelIsLive > params:", JSON.stringify(params, null, 2));
const result = await ddb.updateItem(params).promise();
return result;
} catch(err) {
console.info("_updateDDBChannelIsLive > err:", err, err.stack);
throw new Error(err);
}
};
exports.get = async(event, context, callback) => {
console.log("get event:", JSON.stringify(event, null, 2));
try {
const params = {
TableName: CHANNELS_TABLE_NAME
};
if (event.queryStringParameters && event.queryStringParameters.username) {
console.log("get event > by Id");
params.Key = {
'Id': {
S: event.queryStringParameters.username
}
};
console.info("get event > by Id > params:", JSON.stringify(params, null, 2));
const result = await ddb.getItem(params).promise();
console.info("get event > by Id > result:", JSON.stringify(result, null, 2));
if (!result.Item) {
response.statusCode = 200;
response.body = JSON.stringify({});
callback(null, response);
return;
}
const filtered = {
username: result.Item.Username.S,
avatar: result.Item.Avatar.S,
bgColor: result.Item.BgColor.S,
channelArn: result.Item.ChannelArn ? result.Item.ChannelArn.S : '',
channelName: result.Item.Name ? result.Item.Name.S : '',
channel: result.Item.Channel ? JSON.parse(result.Item.Channel.S) : {},
channelStatus: result.Item.ChannelStatus ? result.Item.ChannelStatus.S : {},
isLive: result.Item.IsLive && result.Item.IsLive.BOOL ? 'Yes' : 'No'
};
response.statusCode = 200;
response.body = JSON.stringify(filtered, '', 2);
console.info("get event > by Id > response:", JSON.stringify(response, null, 2));
callback(null, response);
return;
}
console.log("get event > list");
console.info("get event > list > params:", JSON.stringify(params, null, 2));
const result = await ddb.scan(params).promise();
console.info("get event > list > result:", JSON.stringify(result, null, 2));
if (!result.Items) {
response.statusCode = 200;
response.body = JSON.stringify([]);
callback(null, response);
return;
}
let filteredItems = [];
let prop;
for (prop in result.Items) {
let channelStatus = {};
try {
channelStatus = JSON.parse(result.Items[prop].ChannelStatus.S);
} catch(err) {}
filteredItems.push({
username: result.Items[prop].Username.S,
avatar: result.Items[prop].Avatar.S,
bgColor: result.Items[prop].BgColor.S,
channelArn: result.Items[prop].ChannelArn ? result.Items[prop].ChannelArn.S : '',
channelName: result.Items[prop].Name ? result.Items[prop].Name.S : '',
channel: result.Items[prop].Channel ? JSON.parse(result.Items[prop].Channel.S) : {},
channelStatus: channelStatus,
isLive: result.Items[prop].IsLive && result.Items[prop].IsLive.BOOL ? 'Yes' : 'No'
});
}
response.statusCode = 200;
response.body = JSON.stringify(filteredItems, '', 2);
console.info("get event > list > response:", JSON.stringify(response, null, 2));
callback(null, response);
} catch(err) {
console.info("get event > err:", err, err.stack);
response.statusCode = 500;
response.body = err.stack;
callback(null, response);
}
};
const _deleteDdbChannel = async (sub) => {
try {
const params = {
TableName: CHANNELS_TABLE_NAME,
Key: {
'Id': {
S: sub
},
},
};
console.info("_deleteDdbChannel > params:", JSON.stringify(params, null, 2));
const result = await ddb.deleteItem(params).promise();
console.info("_deleteDdbChannel > result:", JSON.stringify(result, null, 2));
return result;
} catch(err) {
console.info("_deleteDdbChannel > err:", err, err.stack);
throw new Error(err);
}
};
const _isLive = async(counter) => {
console.info("_isLive > counter:", counter);
const liveStreams = await ivs.listStreams({}).promise();
console.info("_isLive > liveStreams:", liveStreams);
if (!liveStreams) {
console.log("_isLive: No live streams. Nothing to check");
return;
}
const result = await ddb.scan({ TableName: CHANNELS_TABLE_NAME }).promise();
if (!result.Items) {
console.log("_isLive: No channels. Nothing to check");
return;
}
let len = result.Items.length;
while(--len >= 0) {
const channel = JSON.parse(result.Items[len].Channel.S);
console.log("_isLive > channel:", JSON.stringify(channel, null, 2));
const liveStream = liveStreams.streams.find(obj => obj.channelArn === channel.channel.arn);
console.log("_isLive > liveStream:", JSON.stringify(liveStream, null, 2));
if (liveStream) {
await _updateDDBChannelIsLive(true, result.Items[len].Id.S, liveStream);
} else {
await _updateDDBChannelIsLive(false, result.Items[len].Id.S, { channelArn: channel.channel.arn });
}
}
};
exports.isLive = async(event) => {
console.log("isLive event:", JSON.stringify(event, null, 2));
// Run three times before the next scheduled event every 1 minute
const waitTime = 15 * 1000; // 15 seconds
let i = 0;
_isLive(i + 1); // run immediately
for(i; i < 2; i++) {
await new Promise(r => setTimeout(r, waitTime)); // wait 15 seconds
console.log("isLive event: waited 15 seconds");
_isLive(i + 1);
}
console.log("isLive event: end");
return;
};
/* IVS */
const _createChannel = async (payload) => {
const params = {
latencyMode: payload.latencyMode || 'NORMAL',
name: payload.name,
tags: payload.tags || {},
type: payload.type || 'BASIC'
};
console.log("_createChannel > params:", JSON.stringify(params, null, 2));
try {
const result = await ivs.createChannel(params).promise();
// console.info("_createChannel > result:", result);
return result;
} catch(err) {
// console.info("_createChannel > err:", err, err.stack);
throw new Error(err);
}
};
const _deleteChannel = async (arn) => {
const params = {
arn
};
console.log("_deleteChannel > params:", JSON.stringify(params, null, 2));
try {
const result = await ivs.deleteChannel(params).promise();
// console.info("_deleteChannel > result:", result);
return result;
} catch(err) {
// console.info("_deleteChannel > err:", err, err.stack);
throw new Error(err);
}
};
const _stopStream = async (params) => {
console.log("_stopStream > params:", JSON.stringify(params, null, 2));
try {
const result = await ivs.stopStream(params).promise();
// console.info("_stopStream > result:", result);
return result;
} catch(err) {
console.info("_stopStream > err:", err);
console.info("_stopStream > err.stack:", err.stack);
// Ignore error
if (/ChannelNotBroadcasting/.test(err)) {
return;
}
throw new Error(err);
}
};
exports.createChannel = async(event, context, callback) => {
console.log("createChannel event:", JSON.stringify(event, null, 2));
let payload;
try {
payload = JSON.parse(event.body);
} catch (err) {
console.log("createChannel event > parse payload:", JSON.stringify(err, null, 2));
response.statusCode = 500;
response.body = JSON.stringify(err);
callback(null, response);
return;
}
if (!payload || !payload.name) {
console.log("createChannel event > missing required field(s): Must provide name.");
response.statusCode = 400;
response.body = "Must provide name.";
callback(null, response);
return;
}
const params = {
latencyMode: payload.latencyMode || 'NORMAL',
name: payload.name,
tags: payload.tags || {},
type: payload.type || 'BASIC'
};
console.log("createChannel event > params:", JSON.stringify(params, null, 2));
/*try {
const result = await ivs.createChannel(params).promise();
console.info("createChannel event > result:", result);
response.statusCode = 200;
response.body = JSON.stringify(result);
callback(null, response);
} catch(err) {
console.info("getChannels event > err:", err, err.stack);
response.statusCode = 500;
response.body = err.stack;
callback(null, response);
}*/
callback(null, _createChannel(params));
};
exports.createStreamKey = async(event, context, callback) => {
console.log("createStreamKey event:", JSON.stringify(event, null, 2));
let payload;
try {
payload = JSON.parse(event.body);
} catch (err) {
console.log("createStreamKey event > parse payload:", JSON.stringify(err, null, 2));
response.statusCode = 500;
response.body = JSON.stringify(err);
callback(null, response);
return;
}
if (!payload || !payload.channelArn) {
console.log("createStreamKey event > missing required field(s): Must provide channelArn.");
response.statusCode = 400;
response.body = "Must provide channelArn.";
callback(null, response);
return;
}
const params = {
channelArn: payload.channelArn,
tags: payload.tags || {}
};
console.log("createStreamKey event > params:", JSON.stringify(params, null, 2));
try {
const result = await ivs.createStreamKey(params).promise();
console.info("createStreamKey event > result:", result);
response.statusCode = 200;
response.body = JSON.stringify(result);
callback(null, response);
} catch(err) {
console.info("createStreamKey event > err:", err, err.stack);
response.statusCode = 500;
response.body = err.stack;
callback(null, response);
}
};
exports.getChannels = async(event, context, callback) => {
console.log("getChannels event:", JSON.stringify(event, null, 2));
const params = {};
try {
if (event.queryStringParameters && event.queryStringParameters.channelArn) {
console.log("getChannels event > by channelArn");
params.arn = event.queryStringParameters.channelArn;
const result = await ivs.listChannel(params).promise();
console.info("getChannels event > result:", result);
response.statusCode = 200;
response.body = JSON.stringify(result);
callback(null, response);
return;
}
if (event.queryStringParameters) {
if (event.queryStringParameters.maxResults) {
params.maxResults = event.queryStringParameters.maxResults;
}
if (event.queryStringParameters.nextToken) {
params.nextToken = event.queryStringParameters.nextToken;
}
}
console.log("getChannels event > list");
const result = await ivs.listChannels(params).promise();
console.info("getChannels event > result:", result);
response.statusCode = 200;
response.body = JSON.stringify(result);
callback(null, response);
} catch(err) {
console.info("getChannels event > err:", err, err.stack);
response.statusCode = 500;
response.body = err.stack;
callback(null, response);
}
};
exports.getStreams = async(event, context, callback) => {
console.log("getStreams event:", JSON.stringify(event, null, 2));
const params = {};
try {
if (event.queryStringParameters && event.queryStringParameters.channelArn) {
console.log("getStreams event > by channelArn");
params.channelArn = event.queryStringParameters.channelArn;
console.log("getStreams event > by channelArn > params:", JSON.stringify(params, null, 2));
const result = await ivs.getStream(params).promise();
console.log("getStreams event > result:", result);
response.statusCode = 200;
response.body = JSON.stringify(result);
callback(null, response);
return;
}
console.log("getStreams event > list");
if (event.queryStringParameters) {
if (event.queryStringParameters.maxResults) {
params.maxResults = event.queryStringParameters.maxResults;
}
if (event.queryStringParameters.nextToken) {
params.nextToken = event.queryStringParameters.nextToken;
}
}
const result = await ivs.listStreams(params).promise();
console.info("getStreams event > result:", result);
response.statusCode = 200;
response.body = JSON.stringify(result);
callback(null, response);
} catch(err) {
console.info("getStreams event > err:", err, err.stack);
response.statusCode = 500;
response.body = err.stack;
callback(null, response);
}
};
exports.getStreamKeys = async(event, context, callback) => {
console.log("getStreamKeys event:", JSON.stringify(event, null, 2));
if (!event.queryStringParameters && !event.queryStringParameters.channelArn) {
console.log("getStreamKeys event > missing required field(s): Must provide channelArn.");
response.statusCode = 400;
response.body = "Must provide channelArn.";
callback(null, response);
return;
}
const params = {
arn: event.queryStringParameters.channelArn
};
try {
if (event.queryStringParameters && event.queryStringParameters.channelArn) {
console.log("getStreamKeys event > by channelArn");
params.arn = event.queryStringParameters.channelArn;
const result = await ivs.getStreamKey(params).promise();
console.info("getStreamKeys event > result:", result);
response.statusCode = 200;
response.body = JSON.stringify(result);
callback(null, response);
return;
}
console.log("getStreamKeys event > list");
if (event.queryStringParameters.maxResults) {
params.maxResults = event.queryStringParameters.maxResults;
}
if (event.queryStringParameters.nextToken) {
params.nextToken = event.queryStringParameters.nextToken;
}
const result = await ivs.listStreamKeys(params).promise();
console.info("getStreamKeys event > result:", result);
response.statusCode = 200;
response.body = JSON.stringify(result);
callback(null, response);
} catch(err) {
console.info("getStreamKeys event > err:", err, err.stack);
response.statusCode = 500;
response.body = err.stack;
callback(null, response);
}
};
exports.resetDefaultStreamKey = (event, context, callback) => {
console.log("resetDefaultStreamKey event:", JSON.stringify(event, null, 2));
verifyAccessToken(event).then(result => {
const { accessToken, decodedToken } = result;
const getUserParams = {
AccessToken: accessToken
};
console.info("resetDefaultStreamKey event > params:", JSON.stringify(getUserParams, '', 2));
cognitoISP.getUser(getUserParams, function(err, userData) {
if (err) {
console.log("resetDefaultStreamKey event > getUser > error:", err, err.stack);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
console.log("resetDefaultStreamKey event > getUser > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
console.log('userData.UserAttributes:', JSON.stringify(userData.UserAttributes, '', 2));
const profile = userData.UserAttributes.find(obj => obj.Name === 'profile');
console.log('profile:', JSON.stringify(profile, '', 2));
if (!profile) {
console.log("resetDefaultStreamKey event > getUser > error: No default channel");
response.statusCode = 500;
response.body = "No default channel";
console.log("resetDefaultStreamKey event > getUser > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
const profileValueAsJson = JSON.parse(profile.Value);
console.log("resetDefaultStreamKey event > profileValueAsJson:", JSON.stringify(profileValueAsJson, '', 2));
const stopStreamParams = {
channelArn: profileValueAsJson.defaultChannelDetails.channel.arn
};
console.log("resetDefaultStreamKey event > stopStreamParams:", JSON.stringify(stopStreamParams, '', 2));
_stopStream(stopStreamParams).then(() => {
const deleteStreamKeyParams = {
arn: profileValueAsJson.defaultChannelDetails.streamKey.arn
};
console.log("resetDefaultStreamKey event > deleteStreamKeyParams:", JSON.stringify(deleteStreamKeyParams, '', 2));
// Quota limit 1 - delete then add
ivs.deleteStreamKey(deleteStreamKeyParams, function(err) {
if (err) {
console.log("resetDefaultStreamKey event > deleteStreamKey > error:", err, err.stack);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
console.info("resetDefaultStreamKey event > deleteStreamKey > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
const createStreamKeyParams = {
channelArn: profileValueAsJson.defaultChannelDetails.channel.arn
};
console.log("resetDefaultStreamKey event > createStreamKeyParams:", JSON.stringify(createStreamKeyParams, '', 2));
ivs.createStreamKey(createStreamKeyParams, function(err, newStreamKey) {
if (err) {
console.log("resetDefaultStreamKey event > createStreamKey > error:", err, err.stack);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
console.info("resetDefaultStreamKey event > createStreamKey > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
}
const newAttribute = {
Name: 'profile',
Value: {
defaultChannelDetails: {
channel: profileValueAsJson.defaultChannelDetails.channel,
streamKey: newStreamKey.streamKey
}
}
};
_updateUserAttribute(decodedToken.username, newAttribute).then((updateAttrsResult) => {
_updateDDBChannelUserProfile(accessToken).then(() => {
console.log("resetDefaultStreamKey event > success:", JSON.stringify(newStreamKey, '', 2));
response.statusCode = 200;
response.body = JSON.stringify(newStreamKey, '', 2);
console.log("resetDefaultStreamKey event > response:", JSON.stringify(response, '', 2));
callback(null, response);
})
.catch((err) => {
console.info("resetDefaultStreamKey event > _updateDDBChannelUserProfile > err:", err);
response.statusCode = 500;
response.body = JSON.stringify(err);
callback(null, response);
return;
});
})
.catch((err) => {
console.info("resetDefaultStreamKey event > _updateUserAttribute > err:", err);
response.statusCode = 500;
response.body = cognitoErrors(err.stack);
callback(null, response);
return;
});
});
});
})
.catch((err) => {
console.info("resetDefaultStreamKey event > _stopStream > err:", err);
response.statusCode = 500;
response.body = JSON.stringify(err);
callback(null, response);
return;
});
});
})
.catch(err => {
console.log("resetStreamKey event > verifyAccessToken > error:", err);
response.statusCode = 500;
response.body = err;
console.info("resetStreamKey event > verifyAccessToken > error > response:", JSON.stringify(response, '', 2));
callback(null, response);
return;
});
}; | 28.560159 | 134 | 0.602766 |
991b925106c50756054f62a552113e84ad1acf4c | 2,091 | js | JavaScript | scripts/fix-release-notes-ci.js | ssbc/ssb-backup-tool | ce8c9b1ebab4c4e770e064b6703bd7940ecded59 | [
"MIT"
] | 4 | 2019-09-24T15:51:57.000Z | 2021-03-13T21:49:43.000Z | scripts/fix-release-notes-ci.js | ssbc/ssb-backup-tool | ce8c9b1ebab4c4e770e064b6703bd7940ecded59 | [
"MIT"
] | 6 | 2020-12-17T14:56:46.000Z | 2020-12-17T14:56:55.000Z | scripts/fix-release-notes-ci.js | ssbc/ssb-backup-tool | ce8c9b1ebab4c4e770e064b6703bd7940ecded59 | [
"MIT"
] | null | null | null | /**
* Picks the first release draft whose name is the same as the current version listed
* in the _package.json_ file and updates its body.
*
* Requires that Travis CI exports:
*
* - `GH_TOKEN=<personal token>`
*
* this is tied to the SSBC collaborator account called `hermes-bot`, its user is hardcoded in the URLs.
*
* Call it with:
* - `npm run fix-release-notes-ci`
*/
const fs = require("fs")
const fetch = require("node-fetch")
const Handlebars = require("handlebars")
const open = require("open");
const pkg = JSON.parse(fs.readFileSync("./package.json"))
const version = pkg.version
const token = process.env.GH_TOKEN
const user = "hermes-bot"
const changes = fs.readFileSync("./CHANGELOG.md", {encoding: "utf8"})
const template_source = fs.readFileSync("./scripts/release-notes.hbs", {encoding: "utf8"})
const template = Handlebars.compile(template_source)
const api = (url) => url.replace("api.github.com", `${user}:${token}@api.github.com`)
const releases_url = api("https://api.github.com/repos/ssbc/ssb-backup-tool/releases") // <-- customize this if using for another repo.
let main = async () => {
console.log(`[CI VERSION] Fixing release notes for draft ${version}`)
console.log(`- Getting releases from GitHub...`)
let releases = await (await fetch(releases_url)).json()
let release = releases.filter(r => r.tag_name === `v${version}`)[0]
if (!release) {
console.log(`- Can't find a release for ${version}`)
process.exit(1)
}
console.log(`- Release found: ${release.url}`)
console.log(`- Updating release notes...`)
const notes = template({pkg, version, changes, release})
let payload = {
name: `${pkg.name} v${version}`,
body: notes,
tag_name: `v${version}`,
draft: false
}
let url_with_auth = api(release.url)
let response = await (await fetch(`${url_with_auth}`, {
method: "PATCH",
headers: { "Content-Type": "application/json" },
body: JSON.stringify(payload)
})).json()
console.log(response.html_url)
process.exit(0)
}
main()
| 31.681818 | 135 | 0.659971 |
991c094637b521962b16a5a4061064341258138e | 48 | js | JavaScript | src/paku.js | drihu/paku | c6c30d93a6c335ea1866c0c13db805ed4dff09a1 | [
"MIT"
] | null | null | null | src/paku.js | drihu/paku | c6c30d93a6c335ea1866c0c13db805ed4dff09a1 | [
"MIT"
] | null | null | null | src/paku.js | drihu/paku | c6c30d93a6c335ea1866c0c13db805ed4dff09a1 | [
"MIT"
] | null | null | null | import Card from './card';
window.Paku = Card;
| 12 | 26 | 0.666667 |
991c55e50d831ae2be28eadfbfb560cd9257744f | 1,756 | js | JavaScript | frontend/src/components/pairwise-form/index.js | findy-network/findy-issuer-tool | c0ee1f825a7767dd7048eaf9c08982c99901c4ee | [
"Apache-2.0"
] | null | null | null | frontend/src/components/pairwise-form/index.js | findy-network/findy-issuer-tool | c0ee1f825a7767dd7048eaf9c08982c99901c4ee | [
"Apache-2.0"
] | 2 | 2022-03-07T11:31:57.000Z | 2022-03-07T11:33:37.000Z | frontend/src/components/pairwise-form/index.js | findy-network/findy-issuer-tool | c0ee1f825a7767dd7048eaf9c08982c99901c4ee | [
"Apache-2.0"
] | null | null | null | import React, { useState } from 'react';
import PropTypes from 'prop-types';
import styled from 'styled-components';
import TextField from '../text-input';
import EditorButtons from '../editor-buttons';
import DropDown from '../drop-down';
const Container = styled.div``;
const PairwiseForm = ({ credDefs, onSend, defaultValues }) => {
const [credDefId, setCredDefId] = useState('');
const defaultAttributes = '{"attribute":"value"}';
const [attributes, setAttributes] = useState(defaultAttributes);
const canReset = credDefId !== '' && attributes.length !== defaultAttributes;
const canSave = credDefId.length > 0 && attributes.length > 0;
const handleReset = () => {
setCredDefId('');
setAttributes(defaultAttributes);
};
const handleCredDef = (value) => {
setCredDefId(value);
if (value) {
const newDefault = defaultValues[value];
if (newDefault) {
setAttributes(JSON.stringify(newDefault));
}
} else {
setAttributes(defaultAttributes);
}
};
return (
<Container>
<DropDown
value={credDefId}
values={credDefs.map((item) => ({ id: item, title: item }))}
onValueChange={handleCredDef}
label="Credential definition"
/>
<TextField label="Value" onChange={setAttributes} value={attributes} />
<EditorButtons
canReset={canReset}
onReset={handleReset}
canSave={canSave}
onSave={() => onSend(JSON.parse(attributes), credDefId)}
okLabel="Send"
/>
</Container>
);
};
PairwiseForm.propTypes = {
credDefs: PropTypes.arrayOf(PropTypes.string).isRequired,
onSend: PropTypes.func.isRequired,
defaultValues: PropTypes.object.isRequired,
};
export default PairwiseForm;
| 28.786885 | 79 | 0.654897 |
991c6fb5910cb0e8fadf8be46ad069dc439aa7ea | 642 | js | JavaScript | src/store/store.js | chhunsocheat/afterCorona | 1beb8384b58946a6b89d7faf849481f5846c9ef3 | [
"MIT"
] | null | null | null | src/store/store.js | chhunsocheat/afterCorona | 1beb8384b58946a6b89d7faf849481f5846c9ef3 | [
"MIT"
] | 4 | 2021-03-10T14:10:27.000Z | 2022-02-27T02:51:43.000Z | src/store/store.js | chhunsocheat/afterCorona | 1beb8384b58946a6b89d7faf849481f5846c9ef3 | [
"MIT"
] | 1 | 2020-05-08T03:31:50.000Z | 2020-05-08T03:31:50.000Z | import Vue from 'vue'
import Vuex from 'vuex'
import db from "../firebase/init"
import router from '../router/index'
import firebase from 'firebase'
import auth from './modules/auth'
import imagePosts from './modules/imagePost'
import createPersistedState from 'vuex-persistedstate';
Vue.use(Vuex)
export const strict = false;
export const store = new Vuex.Store({
strict: false,
modules:{
auth,
imagePosts
},
state: {
data:"hi"
},
plugins: [createPersistedState()],
getters: {
},
mutations: {
},
actions: {
}
});
| 17.833333 | 55 | 0.580997 |
991ccd1e28258e81c26afb7700de13e510627f58 | 509 | js | JavaScript | build/module/lib/math/quadVectorE2.js | geometryzen/davinci-eight | 2260ee7bd6a396ff2e4da1d56e0833b5574c6d23 | [
"MIT"
] | 21 | 2015-05-20T10:21:15.000Z | 2021-08-11T11:00:05.000Z | build/module/lib/math/quadVectorE2.js | geometryzen/davinci-eight | 2260ee7bd6a396ff2e4da1d56e0833b5574c6d23 | [
"MIT"
] | 11 | 2020-06-17T01:08:32.000Z | 2021-04-02T14:16:28.000Z | build/module/lib/math/quadVectorE2.js | geometryzen/davinci-eight | 2260ee7bd6a396ff2e4da1d56e0833b5574c6d23 | [
"MIT"
] | 5 | 2015-11-23T02:59:32.000Z | 2021-10-30T17:34:09.000Z | import { isDefined } from '../checks/isDefined';
import { isNumber } from '../checks/isNumber';
import { dotVectorCartesianE2 } from '../math/dotVectorCartesianE2';
/**
* @hidden
*/
export function quadVectorE2(vector) {
if (isDefined(vector)) {
var x = vector.x;
var y = vector.y;
if (isNumber(x) && isNumber(y)) {
return dotVectorCartesianE2(x, y, x, y);
}
else {
return void 0;
}
}
else {
return void 0;
}
}
| 23.136364 | 68 | 0.544204 |
991d097616ce0dd6df68b8c7e197b575628fdaef | 1,732 | js | JavaScript | svg-sandbox/node_modules/@pentaho/viz-api/pentaho/visual/color/palettes/divergentRyg3.js | webdetails/Viz-SVG | 7b5e80b7706b3b0897bec5fc65f11ab220cb6557 | [
"MIT"
] | 1 | 2019-12-27T17:05:08.000Z | 2019-12-27T17:05:08.000Z | svg-sandbox/node_modules/@pentaho/viz-api/pentaho/visual/color/palettes/divergentRyg3.js | webdetails/Viz-SVG | 7b5e80b7706b3b0897bec5fc65f11ab220cb6557 | [
"MIT"
] | null | null | null | svg-sandbox/node_modules/@pentaho/viz-api/pentaho/visual/color/palettes/divergentRyg3.js | webdetails/Viz-SVG | 7b5e80b7706b3b0897bec5fc65f11ab220cb6557 | [
"MIT"
] | 3 | 2017-11-22T18:07:38.000Z | 2021-05-29T20:05:39.000Z | /*!
* Copyright 2017 Hitachi Vantara. All rights reserved.
*
* 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.
*/
define([
"pentaho/util/spec"
], function(specUtil) {
"use strict";
return ["pentaho/visual/color/palette", function(Palette, config) {
/**
* A divergent color palette of 3 colors: one red, one yellow and another one green.
*
* <table style="font-family:courier; width:120px;">
* <colgroup><col width="20px"/><col />
* <tr><td style="background-color:#FF0000"></td><td>#FF0000</td></tr>
* <tr><td style="background-color:#FFFF00"></td><td>#FFFF00</td></tr>
* <tr><td style="background-color:#008000"></td><td>#008000</td></tr>
* </table>
*
* This palette's [colors]{@link pentaho.visual.color.spec.IPalette#colors} can be configured.
*
* @name pentaho.visual.color.palettes.divergentRyg3
* @type {pentaho.visual.color.Palette}
* @amd {pentaho.type.spec.UInstanceModule<pentaho.visual.color.Palette>} pentaho/visual/color/palettes/divergentRyg3
*/
var spec = specUtil.merge({
level: "divergent",
colors: [
"#FF0000", "#FFFF00", "#008000"
]
}, config);
return new Palette(spec);
}];
});
| 33.960784 | 121 | 0.661085 |
991d333629e17ed23a0f65020ed4ba8c03d541ff | 2,045 | js | JavaScript | config/webpack.common.js | OctoConsulting/sam-ui-elements | 5880b12b956b403dce5ca5be5bc30de01e515fcc | [
"MIT"
] | null | null | null | config/webpack.common.js | OctoConsulting/sam-ui-elements | 5880b12b956b403dce5ca5be5bc30de01e515fcc | [
"MIT"
] | null | null | null | config/webpack.common.js | OctoConsulting/sam-ui-elements | 5880b12b956b403dce5ca5be5bc30de01e515fcc | [
"MIT"
] | null | null | null | /**
* @author: @AngularClass
*/
const webpack = require('webpack');
const helpers = require('./helpers');
/*
* Webpack configuration
*
* See: http://webpack.github.io/docs/configuration.html#cli
*/
module.exports = {
/*
* Cache generated modules and chunks to improve performance for multiple incremental builds.
* This is enabled by default in watch mode.
* You can pass false to disable it.
*
* See: http://webpack.github.io/docs/configuration.html#cache
*/
//cache: false,
/*
* Options affecting the resolving of modules.
*
* See: http://webpack.github.io/docs/configuration.html#resolve
*/
resolve: {
/*
* An array of extensions that should be used to resolve modules.
*
* See: http://webpack.github.io/docs/configuration.html#resolve-extensions
*/
extensions: ['', '.ts', '.js', '.json'],
// Make sure root is src
root: helpers.root('src'),
// aliases
alias: {
samUIKit: helpers.root('src') + '/ui-kit',
samDirectives: helpers.root('src') + '/ui-kit/directives',
samComponents: helpers.root('src') + '/ui-kit/components',
samElements: helpers.root('src') + '/ui-kit/elements',
samFormControls: helpers.root('src') + '/ui-kit/form-controls',
samFormTemplates: helpers.root('src') + '/ui-kit/form-templates',
samPipes: helpers.root('src') + '/ui-kit/pipes',
samWrappers: helpers.root('src') + '/ui-kit/wrappers'
},
// remove other default values
modulesDirectories: ['node_modules'],
},
/*
* Options affecting the normal modules.
*
* See: http://webpack.github.io/docs/configuration.html#module
*/
module: {
loaders: []
},
plugins: [],
/*
* Include polyfills or mocks for various node stuff
* Description: Node configuration
*
* See: https://webpack.github.io/docs/configuration.html#node
*/
node: {
global: 'window',
crypto: 'empty',
process: true,
module: false,
clearImmediate: false,
setImmediate: false
}
};
| 25.246914 | 95 | 0.628362 |
991d5c7a6ff6c9021611049a8b45916c242a0b29 | 1,188 | js | JavaScript | src/js/components/Dashboard/FileInsertLayer.js | nicholas-b-carter/grommet-cms-boilerplate | ecd9163e4e3846f4952787cd5550be7fb921679a | [
"Apache-2.0"
] | 12 | 2017-01-20T23:35:32.000Z | 2017-09-01T03:20:12.000Z | src/js/components/Dashboard/FileInsertLayer.js | nicholas-b-carter/grommet-cms-boilerplate | ecd9163e4e3846f4952787cd5550be7fb921679a | [
"Apache-2.0"
] | 23 | 2017-01-23T15:38:32.000Z | 2017-02-05T23:27:19.000Z | src/js/components/Dashboard/FileInsertLayer.js | nicholas-b-carter/grommet-cms-boilerplate | ecd9163e4e3846f4952787cd5550be7fb921679a | [
"Apache-2.0"
] | 4 | 2017-04-02T21:30:34.000Z | 2020-12-15T16:55:33.000Z | import React from 'react';
import Layer from 'grommet/components/Layer';
import Box from 'grommet/components/Box';
import Form from 'grommet/components/Form';
import Header from 'grommet/components/Header';
import FormFields from 'grommet/components/FormFields';
import FormField from 'grommet/components/FormField';
import Button from 'grommet/components/Button';
import SpinningIcon from 'grommet/components/icons/Spinning';
export default function FileInsertLayer(props) {
const content = (!props.request)
? (
<Form onSubmit={props.onSubmit}>
<Header>
Add File
</Header>
<FormFields>
<fieldset>
<FormField label="File - 15MB max" htmlFor={"img"}>
<input id={"img"} name="img" type="file"
onChange={props.onChange} />
</FormField>
</fieldset>
<p>{props.error}</p>
<Button onClick={props.onSubmit} primary={true} label="submit" />
</FormFields>
</Form>
) : (
<span>
<SpinningIcon /> loading
</span>
);
return (
<Layer onClose={props.onLayerClose} closer={true}>
<Box pad="medium">
{content}
</Box>
</Layer>
);
}
| 27 | 73 | 0.627104 |
991dfbb66720ccf0656226dba60c589d165d33aa | 225 | js | JavaScript | src/components/BeforeLogin/Pages/AuthButton.js | MatthieuBenierPisani/app-web-be | 9a89ecfe69d7f18effef8a295a47bf4c4dee34ec | [
"MIT"
] | null | null | null | src/components/BeforeLogin/Pages/AuthButton.js | MatthieuBenierPisani/app-web-be | 9a89ecfe69d7f18effef8a295a47bf4c4dee34ec | [
"MIT"
] | null | null | null | src/components/BeforeLogin/Pages/AuthButton.js | MatthieuBenierPisani/app-web-be | 9a89ecfe69d7f18effef8a295a47bf4c4dee34ec | [
"MIT"
] | null | null | null | import React from "react";
const AuthButton = props => {
let { isLoggedIn } = props;
if (isLoggedIn) {
return <button>Logout</button>;
} else {
return <button>Login</button>;
}
};
export default AuthButton; | 17.307692 | 35 | 0.64 |
991e5163adc7b28319f9d027d720d9a2ebe85f8f | 646 | js | JavaScript | src/main/webapp/js/base.js | cclaaaaa/weibo | 56d1f299c1300196551d5ae2bd749c0d845a1560 | [
"Apache-2.0"
] | 4 | 2019-02-14T06:45:30.000Z | 2020-12-13T06:46:04.000Z | src/main/webapp/js/base.js | cclaaaaa/weibo | 56d1f299c1300196551d5ae2bd749c0d845a1560 | [
"Apache-2.0"
] | 4 | 2020-03-04T22:08:13.000Z | 2021-12-09T20:47:08.000Z | src/main/webapp/js/base.js | cclaaaaa/weibo | 56d1f299c1300196551d5ae2bd749c0d845a1560 | [
"Apache-2.0"
] | 1 | 2020-05-18T04:19:02.000Z | 2020-05-18T04:19:02.000Z | $(document).ready(function() {
$("#bt0").click(function() {
$("#com0").toggle();
});
$("#bt1").click(function() {
$("#com1").toggle();
});
$("#bt2").click(function() {
$("#com2").toggle();
});
$("#bt3").click(function() {
$("#com3").toggle();
});
$("#bt4").click(function() {
$("#com4").toggle();
});
$("#bt5").click(function() {
$("#com5").toggle();
});
$("#bt6").click(function() {
$("#com6").toggle();
});
$("#bt7").click(function() {
$("#com7").toggle();
});
$("#bt8").click(function() {
$("#com8").toggle();
});
$("#bt9").click(function() {
$("#com9").toggle();
});
})
| 19.575758 | 31 | 0.434985 |
991ecb106e8e0f676a391c706980674aa9b814f5 | 2,164 | js | JavaScript | frontend/src/components/HomeScreen/FooterSection/FooterSection.js | negiaditi/Mern_Organic-Origins | c6b9ed85da57a7590a1fe6682f5518d4c44ed16a | [
"MIT"
] | null | null | null | frontend/src/components/HomeScreen/FooterSection/FooterSection.js | negiaditi/Mern_Organic-Origins | c6b9ed85da57a7590a1fe6682f5518d4c44ed16a | [
"MIT"
] | null | null | null | frontend/src/components/HomeScreen/FooterSection/FooterSection.js | negiaditi/Mern_Organic-Origins | c6b9ed85da57a7590a1fe6682f5518d4c44ed16a | [
"MIT"
] | null | null | null | import styles from "./footer-section.module.scss";
const FooterSection = () => {
return (
<footer className={styles.footer}>
<div className={styles.footer_logoBox}>Organic Origins</div>
<div className={styles.row}>
<div className={styles.col_1_of_2}>
<div className={styles.footer_navigation}>
<ul className={styles.footer_list}>
<li className={styles.footer_item}>
<a href="#d" className={styles.footer_link}>
Company
</a>
</li>
<li className={styles.footer_item}>
<a href="#a" className={styles.footer_link}>
Contact Us
</a>
</li>
<li className={styles.footer_item}>
<a href="#a" className={styles.footer_link}>
Carrers
</a>
</li>
<li className={styles.footer_item}>
<a href="#a" className={styles.footer_link}>
Privacy Term
</a>
</li>
<li className={styles.footer_item}>
<a href="#a" className={styles.footer_link}>
terms
</a>
</li>
</ul>
</div>
</div>
<div className={styles.col_1_of_2}>
<p className={styles.footer_copyright}>
Built by{" "}
<a href="#a" className={styles.footer_link}>
Aditi Negi
</a>{" "}
Lorem ipsum dolor sit amet consectetur adipisicing elit. Aperiam
eligendi est nulla nam{" "}
<a href="#a" className={styles.footer_link}>
Organic Origins
</a>
. Copyright © by Aditi Negi Lorem ipsum dolor sit amet
consectetur adipisicing elit. Rerum dolorem dignissimos iusto
nesciunt corporis laborum, repudiandae quae tempora vero! Sit quia
in, temporibus mollitia nesciunt obcaecati ex enim ad quis.
</p>
</div>
</div>
</footer>
);
};
export default FooterSection;
| 34.349206 | 78 | 0.502311 |
991fdada79f9aae32b716e692b0f7d071d15d812 | 1,220 | js | JavaScript | test/specs/index.spec.js | fintechdev/x2-service-i18n | 0721881def07c77c3fb41d88ac1b2060d04e5b75 | [
"MIT"
] | null | null | null | test/specs/index.spec.js | fintechdev/x2-service-i18n | 0721881def07c77c3fb41d88ac1b2060d04e5b75 | [
"MIT"
] | null | null | null | test/specs/index.spec.js | fintechdev/x2-service-i18n | 0721881def07c77c3fb41d88ac1b2060d04e5b75 | [
"MIT"
] | null | null | null | /* global window describe it beforeEach assert */
import i18nService from '../../src';
const ES = 'es';
const EN = 'en';
describe('Service -> i18n', () => {
beforeEach(() => {
window.localStorage.clear();
});
describe('setLanguage(lang)', () => {
it('should return and set given language', () => {
const lang = i18nService.setLanguage(ES);
assert.equal(lang, ES);
assert.equal(window.localStorage.lang, ES);
});
it('should return and set default language', () => {
const lang = i18nService.setLanguage();
assert.equal(lang, EN);
assert.equal(window.localStorage.lang, EN);
});
});
describe('getLanguage()', () => {
it('should return language from memory', () => {
i18nService.selectedLanguage = EN;
assert.equal(i18nService.getLanguage(), EN);
});
it('should return language from local storage', () => {
i18nService.selectedLanguage = null;
window.localStorage.lang = ES;
assert.equal(i18nService.getLanguage(), ES);
});
it('should return language from default value', () => {
i18nService.selectedLanguage = null;
assert.equal(i18nService.getLanguage(), EN);
});
});
});
| 23.461538 | 59 | 0.604918 |
9920f67327dc53524400808e2b86bab8a7aec2f6 | 1,452 | js | JavaScript | proto/wtools/atop/will.test/_asset/dos/.will/hook/GitUncommitted.js | JackieJoo/willbe | 42eca65f879326eb8d6c54def119dbfaf9375d82 | [
"MIT"
] | null | null | null | proto/wtools/atop/will.test/_asset/dos/.will/hook/GitUncommitted.js | JackieJoo/willbe | 42eca65f879326eb8d6c54def119dbfaf9375d82 | [
"MIT"
] | null | null | null | proto/wtools/atop/will.test/_asset/dos/.will/hook/GitUncommitted.js | JackieJoo/willbe | 42eca65f879326eb8d6c54def119dbfaf9375d82 | [
"MIT"
] | null | null | null |
function onModule( context )
{
let o = context.request.map;
let _ = context.tools;
let logger = context.logger;
let fileProvider = context.will.fileProvider;
let path = context.will.fileProvider.path;
/* read stats to fix for windows to update edit time of hard linked files */
if( process.platform === 'win32' )
fileProvider.filesFind({ filePath : context.junction.dirPath + '**', safe : 0 });
if( o.v !== null && o.v !== undefined )
o.verbosity = o.v;
_.routineOptions( onModule, o );
let o2 = _.mapOnly( o, _.git.statusFull.defaults );
o2.insidePath = context.junction.dirPath;
let status = _.git.statusFull( o2 );
if( !status.status )
return null;
logger.log( context.junction.nameWithLocationGet() );
logger.log( status.status );
}
var defaults = onModule.defaults = Object.create( null );
defaults.local = 0;
defaults.uncommitted = 1;
defaults.uncommittedUntracked = null;
defaults.uncommittedAdded = null;
defaults.uncommittedChanged = null;
defaults.uncommittedDeleted = null;
defaults.uncommittedRenamed = null;
defaults.uncommittedCopied = null;
defaults.uncommittedIgnored = 0;
defaults.unpushed = 0;
defaults.unpushedCommits = null;
defaults.unpushedTags = null;
defaults.unpushedBranches = null;
defaults.remote = 0;
defaults.remoteCommits = null;
defaults.remoteBranches = 0;
defaults.remoteTags = null;
defaults.prs = 0;
defaults.v = null;
defaults.verbosity = 1;
module.exports = onModule;
| 26.888889 | 83 | 0.726584 |
9921a6a20d63bd9b188aa433f8dd2c176823bd96 | 883 | js | JavaScript | client/src/components/Notification.js | SombreroElGringo/Twitter | f681d6a6817d3d0f4d7b3de332be3a4dd1da4622 | [
"MIT"
] | null | null | null | client/src/components/Notification.js | SombreroElGringo/Twitter | f681d6a6817d3d0f4d7b3de332be3a4dd1da4622 | [
"MIT"
] | null | null | null | client/src/components/Notification.js | SombreroElGringo/Twitter | f681d6a6817d3d0f4d7b3de332be3a4dd1da4622 | [
"MIT"
] | null | null | null | import React, { Component } from 'react';
import moment from 'moment';
import 'moment/locale/fr';
export default class Notification extends Component {
render() {
const { user_uid, post_id, target_uid, target_username, type, createdAt} = this.props.data;
return (
<div className="_notification">
<div className="_header">
<span className="_username">
<a href={`/account/${target_uid}`}>@{target_username}</a>
</span>
<span className="_createdAt">
{moment(createdAt).from()}
</span>
</div>
<div className="_text">
<a href={`/account/${user_uid}`}>User</a>{` ${type} your `}<a href={`/tweet/${post_id}`}>tweet</a>
</div>
</div>
);
}
} | 35.32 | 116 | 0.493771 |
9921addc813ffb231fe882aa31b6818502e6ebff | 1,708 | js | JavaScript | input/tasks/scripts.js | onekin/FeedbackSPL | 8ee6295b1e12eb0b59ac7c3fb11acc0d395f9855 | [
"MIT"
] | null | null | null | input/tasks/scripts.js | onekin/FeedbackSPL | 8ee6295b1e12eb0b59ac7c3fb11acc0d395f9855 | [
"MIT"
] | null | null | null | input/tasks/scripts.js | onekin/FeedbackSPL | 8ee6295b1e12eb0b59ac7c3fb11acc0d395f9855 | [
"MIT"
] | null | null | null | import gulp from 'gulp'
import gulpif from 'gulp-if'
import { log, colors } from 'gulp-util'
import named from 'vinyl-named'
import webpack from 'webpack'
import gulpWebpack from 'webpack-stream'
import plumber from 'gulp-plumber'
import livereload from 'gulp-livereload'
import args from './lib/args'
const ENV = args.production ? 'production' : 'development'
gulp.task('scripts', () => {
return gulp.src(['app/scripts/*.js'])
.pipe(plumber({
// Webpack will log the errors
errorHandler () {}
}))
.pipe(named())
.pipe(gulpWebpack({
devtool: args.sourcemaps ? 'inline-source-map' : false,
watch: args.watch,
mode: 'development', // TODO Set to ENV. Currently uglify is not encoding contentScript.js in UTF-8
plugins: [
new webpack.ProvidePlugin({
$: 'jquery',
jQuery: 'jquery',
'window.jQuery': 'jquery',
Popper: ['popper.js', 'default']
}),
new webpack.DefinePlugin({
'process.env.NODE_ENV': JSON.stringify(ENV),
'process.env.VENDOR': JSON.stringify(args.vendor)
})
],
module: {
rules: [{
test: /\.js$/,
loader: 'eslint-loader',
exclude: /node_modules/,
enforce: 'pre'
}, {
test: /\.js$/,
loader: 'babel-loader'
}]
}
},
webpack,
(err, stats) => {
if (err) return
log(`Finished '${colors.cyan('scripts')}'`, stats.toString({
chunks: false,
colors: true,
cached: false,
children: false
}))
}))
.pipe(gulp.dest(`dist/${args.vendor}/scripts`))
.pipe(gulpif(args.watch, livereload()))
})
| 28 | 105 | 0.562061 |
9921ed9975a0cb77facb358793f56c03ae28dbbe | 24,991 | js | JavaScript | static/scripts/gis/openlayers/lib/OpenLayers/Format/WMC/v1.js | flavour/lacity | fd1f1cccdcea64d07143b29d4f88996e3af35c4b | [
"MIT"
] | null | null | null | static/scripts/gis/openlayers/lib/OpenLayers/Format/WMC/v1.js | flavour/lacity | fd1f1cccdcea64d07143b29d4f88996e3af35c4b | [
"MIT"
] | null | null | null | static/scripts/gis/openlayers/lib/OpenLayers/Format/WMC/v1.js | flavour/lacity | fd1f1cccdcea64d07143b29d4f88996e3af35c4b | [
"MIT"
] | null | null | null | /* Copyright (c) 2006-2011 by OpenLayers Contributors (see authors.txt for
* full list of contributors). Published under the Clear BSD license.
* See http://svn.openlayers.org/trunk/openlayers/license.txt for the
* full text of the license. */
/**
* @requires OpenLayers/Format/WMC.js
* @requires OpenLayers/Format/XML.js
*/
/**
* Class: OpenLayers.Format.WMC.v1
* Superclass for WMC version 1 parsers.
*
* Inherits from:
* - <OpenLayers.Format.XML>
*/
OpenLayers.Format.WMC.v1 = OpenLayers.Class(OpenLayers.Format.XML, {
/**
* Property: namespaces
* {Object} Mapping of namespace aliases to namespace URIs.
*/
namespaces: {
ol: "http://openlayers.org/context",
wmc: "http://www.opengis.net/context",
sld: "http://www.opengis.net/sld",
xlink: "http://www.w3.org/1999/xlink",
xsi: "http://www.w3.org/2001/XMLSchema-instance"
},
/**
* Property: schemaLocation
* {String} Schema location for a particular minor version.
*/
schemaLocation: "",
/**
* Method: getNamespacePrefix
* Get the namespace prefix for a given uri from the <namespaces> object.
*
* Returns:
* {String} A namespace prefix or null if none found.
*/
getNamespacePrefix: function(uri) {
var prefix = null;
if(uri == null) {
prefix = this.namespaces[this.defaultPrefix];
} else {
for(prefix in this.namespaces) {
if(this.namespaces[prefix] == uri) {
break;
}
}
}
return prefix;
},
/**
* Property: defaultPrefix
*/
defaultPrefix: "wmc",
/**
* Property: rootPrefix
* {String} Prefix on the root node that maps to the context namespace URI.
*/
rootPrefix: null,
/**
* Property: defaultStyleName
* {String} Style name used if layer has no style param. Default is "".
*/
defaultStyleName: "",
/**
* Property: defaultStyleTitle
* {String} Default style title. Default is "Default".
*/
defaultStyleTitle: "Default",
/**
* Constructor: OpenLayers.Format.WMC.v1
* Instances of this class are not created directly. Use the
* <OpenLayers.Format.WMC> constructor instead.
*
* Parameters:
* options - {Object} An optional object whose properties will be set on
* this instance.
*/
initialize: function(options) {
OpenLayers.Format.XML.prototype.initialize.apply(this, [options]);
},
/**
* Method: read
* Read capabilities data from a string, and return a list of layers.
*
* Parameters:
* data - {String} or {DOMElement} data to read/parse.
*
* Returns:
* {Array} List of named layers.
*/
read: function(data) {
if(typeof data == "string") {
data = OpenLayers.Format.XML.prototype.read.apply(this, [data]);
}
var root = data.documentElement;
this.rootPrefix = root.prefix;
var context = {
version: root.getAttribute("version")
};
this.runChildNodes(context, root);
return context;
},
/**
* Method: runChildNodes
*/
runChildNodes: function(obj, node) {
var children = node.childNodes;
var childNode, processor, prefix, local;
for(var i=0, len=children.length; i<len; ++i) {
childNode = children[i];
if(childNode.nodeType == 1) {
prefix = this.getNamespacePrefix(childNode.namespaceURI);
local = childNode.nodeName.split(":").pop();
processor = this["read_" + prefix + "_" + local];
if(processor) {
processor.apply(this, [obj, childNode]);
}
}
}
},
/**
* Method: read_wmc_General
*/
read_wmc_General: function(context, node) {
this.runChildNodes(context, node);
},
/**
* Method: read_wmc_BoundingBox
*/
read_wmc_BoundingBox: function(context, node) {
context.projection = node.getAttribute("SRS");
context.bounds = new OpenLayers.Bounds(
parseFloat(node.getAttribute("minx")),
parseFloat(node.getAttribute("miny")),
parseFloat(node.getAttribute("maxx")),
parseFloat(node.getAttribute("maxy"))
);
},
/**
* Method: read_wmc_LayerList
*/
read_wmc_LayerList: function(context, node) {
// layersContext is an array containing info for each layer
context.layersContext = [];
this.runChildNodes(context, node);
},
/**
* Method: read_wmc_Layer
*/
read_wmc_Layer: function(context, node) {
var layerContext = {
visibility: (node.getAttribute("hidden") != "1"),
queryable: (node.getAttribute("queryable") == "1"),
formats: [],
styles: []
};
this.runChildNodes(layerContext, node);
// set properties common to multiple objects on layer options/params
context.layersContext.push(layerContext);
},
/**
* Method: read_wmc_Extension
*/
read_wmc_Extension: function(obj, node) {
this.runChildNodes(obj, node);
},
/**
* Method: read_ol_units
*/
read_ol_units: function(layerContext, node) {
layerContext.units = this.getChildValue(node);
},
/**
* Method: read_ol_maxExtent
*/
read_ol_maxExtent: function(obj, node) {
var bounds = new OpenLayers.Bounds(
node.getAttribute("minx"), node.getAttribute("miny"),
node.getAttribute("maxx"), node.getAttribute("maxy")
);
obj.maxExtent = bounds;
},
/**
* Method: read_ol_transparent
*/
read_ol_transparent: function(layerContext, node) {
layerContext.transparent = this.getChildValue(node);
},
/**
* Method: read_ol_numZoomLevels
*/
read_ol_numZoomLevels: function(layerContext, node) {
layerContext.numZoomLevels = parseInt(this.getChildValue(node));
},
/**
* Method: read_ol_opacity
*/
read_ol_opacity: function(layerContext, node) {
layerContext.opacity = parseFloat(this.getChildValue(node));
},
/**
* Method: read_ol_singleTile
*/
read_ol_singleTile: function(layerContext, node) {
layerContext.singleTile = (this.getChildValue(node) == "true");
},
/**
* Method: read_ol_tileSize
*/
read_ol_tileSize: function(layerContext, node) {
var obj = {"width": node.getAttribute("width"), "height": node.getAttribute("height")};
layerContext.tileSize = obj;
},
/**
* Method: read_ol_isBaseLayer
*/
read_ol_isBaseLayer: function(layerContext, node) {
layerContext.isBaseLayer = (this.getChildValue(node) == "true");
},
/**
* Method: read_ol_displayInLayerSwitcher
*/
read_ol_displayInLayerSwitcher: function(layerContext, node) {
layerContext.displayInLayerSwitcher = (this.getChildValue(node) == "true");
},
/**
* Method: read_wmc_Server
*/
read_wmc_Server: function(layerContext, node) {
layerContext.version = node.getAttribute("version");
var server = {};
var links = node.getElementsByTagName("OnlineResource");
if(links.length > 0) {
this.read_wmc_OnlineResource(server, links[0]);
}
layerContext.url = server.href;
},
/**
* Method: read_wmc_FormatList
*/
read_wmc_FormatList: function(layerContext, node) {
this.runChildNodes(layerContext, node);
},
/**
* Method: read_wmc_Format
*/
read_wmc_Format: function(layerContext, node) {
var format = {
value: this.getChildValue(node)
};
if(node.getAttribute("current") == "1") {
format.current = true;
}
layerContext.formats.push(format);
},
/**
* Method: read_wmc_StyleList
*/
read_wmc_StyleList: function(layerContext, node) {
this.runChildNodes(layerContext, node);
},
/**
* Method: read_wmc_Style
*/
read_wmc_Style: function(layerContext, node) {
var style = {};
this.runChildNodes(style, node);
if(node.getAttribute("current") == "1") {
style.current = true;
}
layerContext.styles.push(style);
},
/**
* Method: read_wmc_SLD
*/
read_wmc_SLD: function(style, node) {
this.runChildNodes(style, node);
// style either comes back with an href or a body property
},
/**
* Method: read_sld_StyledLayerDescriptor
*/
read_sld_StyledLayerDescriptor: function(sld, node) {
var xml = OpenLayers.Format.XML.prototype.write.apply(this, [node]);
sld.body = xml;
},
/**
* Method: read_wmc_OnlineResource
*/
read_wmc_OnlineResource: function(obj, node) {
obj.href = this.getAttributeNS(
node, this.namespaces.xlink, "href"
);
},
/**
* Method: read_wmc_Name
*/
read_wmc_Name: function(obj, node) {
var name = this.getChildValue(node);
if(name) {
obj.name = name;
}
},
/**
* Method: read_wmc_Title
*/
read_wmc_Title: function(obj, node) {
var title = this.getChildValue(node);
if(title) {
obj.title = title;
}
},
/**
* Method: read_wmc_MetadataURL
*/
read_wmc_MetadataURL: function(layerContext, node) {
var metadataURL = {};
var links = node.getElementsByTagName("OnlineResource");
if(links.length > 0) {
this.read_wmc_OnlineResource(metadataURL, links[0]);
}
layerContext.metadataURL = metadataURL.href;
},
/**
* Method: read_wmc_Abstract
*/
read_wmc_Abstract: function(obj, node) {
var abst = this.getChildValue(node);
if(abst) {
obj["abstract"] = abst;
}
},
/**
* Method: read_wmc_LegendURL
*/
read_wmc_LegendURL: function(style, node) {
var legend = {
width: node.getAttribute('width'),
height: node.getAttribute('height')
};
var links = node.getElementsByTagName("OnlineResource");
if(links.length > 0) {
this.read_wmc_OnlineResource(legend, links[0]);
}
style.legend = legend;
},
/**
* Method: write
*
* Parameters:
* context - {Object} An object representing the map context.
* options - {Object} Optional object.
*
* Returns:
* {String} A WMC document string.
*/
write: function(context, options) {
var root = this.createElementDefaultNS("ViewContext");
this.setAttributes(root, {
version: this.VERSION,
id: (options && typeof options.id == "string") ?
options.id :
OpenLayers.Util.createUniqueID("OpenLayers_Context_")
});
// add schemaLocation attribute
this.setAttributeNS(
root, this.namespaces.xsi,
"xsi:schemaLocation", this.schemaLocation
);
// required General element
root.appendChild(this.write_wmc_General(context));
// required LayerList element
root.appendChild(this.write_wmc_LayerList(context));
return OpenLayers.Format.XML.prototype.write.apply(this, [root]);
},
/**
* Method: createElementDefaultNS
* Shorthand for createElementNS with namespace from <defaultPrefix>.
* Can optionally be used to set attributes and a text child value.
*
* Parameters:
* name - {String} The qualified node name.
* childValue - {String} Optional value for text child node.
* attributes - {Object} Optional object representing attributes.
*
* Returns:
* {Element} An element node.
*/
createElementDefaultNS: function(name, childValue, attributes) {
var node = this.createElementNS(
this.namespaces[this.defaultPrefix],
name
);
if(childValue) {
node.appendChild(this.createTextNode(childValue));
}
if(attributes) {
this.setAttributes(node, attributes);
}
return node;
},
/**
* Method: setAttributes
* Set multiple attributes given key value pairs from an object.
*
* Parameters:
* node - {Element} An element node.
* obj - {Object} An object whose properties represent attribute names and
* values represent attribute values.
*/
setAttributes: function(node, obj) {
var value;
for(var name in obj) {
value = obj[name].toString();
if(value.match(/[A-Z]/)) {
// safari lowercases attributes with setAttribute
this.setAttributeNS(node, null, name, value);
} else {
node.setAttribute(name, value);
}
}
},
/**
* Method: write_wmc_General
* Create a General node given an context object.
*
* Parameters:
* context - {Object} Context object.
*
* Returns:
* {Element} A WMC General element node.
*/
write_wmc_General: function(context) {
var node = this.createElementDefaultNS("General");
// optional Window element
if(context.size) {
node.appendChild(this.createElementDefaultNS(
"Window", null,
{
width: context.size.w,
height: context.size.h
}
));
}
// required BoundingBox element
var bounds = context.bounds;
node.appendChild(this.createElementDefaultNS(
"BoundingBox", null,
{
minx: bounds.left.toPrecision(18),
miny: bounds.bottom.toPrecision(18),
maxx: bounds.right.toPrecision(18),
maxy: bounds.top.toPrecision(18),
SRS: context.projection
}
));
// required Title element
node.appendChild(this.createElementDefaultNS(
"Title", context.title
));
// OpenLayers specific map properties
node.appendChild(this.write_ol_MapExtension(context));
return node;
},
/**
* Method: write_ol_MapExtension
*/
write_ol_MapExtension: function(context) {
var node = this.createElementDefaultNS("Extension");
var bounds = context.maxExtent;
if(bounds) {
var maxExtent = this.createElementNS(
this.namespaces.ol, "ol:maxExtent"
);
this.setAttributes(maxExtent, {
minx: bounds.left.toPrecision(18),
miny: bounds.bottom.toPrecision(18),
maxx: bounds.right.toPrecision(18),
maxy: bounds.top.toPrecision(18)
});
node.appendChild(maxExtent);
}
return node;
},
/**
* Method: write_wmc_LayerList
* Create a LayerList node given an context object.
*
* Parameters:
* context - {Object} Context object.
*
* Returns:
* {Element} A WMC LayerList element node.
*/
write_wmc_LayerList: function(context) {
var list = this.createElementDefaultNS("LayerList");
for(var i=0, len=context.layersContext.length; i<len; ++i) {
list.appendChild(this.write_wmc_Layer(context.layersContext[i]));
}
return list;
},
/**
* Method: write_wmc_Layer
* Create a Layer node given a layer context object.
*
* Parameters:
* context - {Object} A layer context object.}
*
* Returns:
* {Element} A WMC Layer element node.
*/
write_wmc_Layer: function(context) {
var node = this.createElementDefaultNS(
"Layer", null, {
queryable: context.queryable ? "1" : "0",
hidden: context.visibility ? "0" : "1"
}
);
// required Server element
node.appendChild(this.write_wmc_Server(context));
// required Name element
node.appendChild(this.createElementDefaultNS(
"Name", context.name
));
// required Title element
node.appendChild(this.createElementDefaultNS(
"Title", context.title
));
// optional MetadataURL element
if (context.metadataURL) {
node.appendChild(this.write_wmc_MetadataURL(context.metadataURL));
}
return node;
},
/**
* Method: write_wmc_LayerExtension
* Add OpenLayers specific layer parameters to an Extension element.
*
* Parameters:
* context - {Object} A layer context object.
*
* Returns:
* {Element} A WMC Extension element (for a layer).
*/
write_wmc_LayerExtension: function(context) {
var node = this.createElementDefaultNS("Extension");
var bounds = context.maxExtent;
var maxExtent = this.createElementNS(
this.namespaces.ol, "ol:maxExtent"
);
this.setAttributes(maxExtent, {
minx: bounds.left.toPrecision(18),
miny: bounds.bottom.toPrecision(18),
maxx: bounds.right.toPrecision(18),
maxy: bounds.top.toPrecision(18)
});
node.appendChild(maxExtent);
if (context.tileSize && !context.singleTile) {
var size = this.createElementNS(
this.namespaces.ol, "ol:tileSize"
);
this.setAttributes(size, context.tileSize);
node.appendChild(size);
}
var properties = [
"transparent", "numZoomLevels", "units", "isBaseLayer",
"opacity", "displayInLayerSwitcher", "singleTile"
];
var child;
for(var i=0, len=properties.length; i<len; ++i) {
child = this.createOLPropertyNode(context, properties[i]);
if(child) {
node.appendChild(child);
}
}
return node;
},
/**
* Method: createOLPropertyNode
* Create a node representing an OpenLayers property. If the property is
* null or undefined, null will be returned.
*
* Parameters:
* object - {Object} An object.
* prop - {String} A property.
*
* Returns:
* {Element} A property node.
*/
createOLPropertyNode: function(obj, prop) {
var node = null;
if(obj[prop] != null) {
node = this.createElementNS(this.namespaces.ol, "ol:" + prop);
node.appendChild(this.createTextNode(obj[prop].toString()));
}
return node;
},
/**
* Method: write_wmc_Server
* Create a Server node given a layer context object.
*
* Parameters:
* context - {Object} Layer context object.
*
* Returns:
* {Element} A WMC Server element node.
*/
write_wmc_Server: function(context) {
var node = this.createElementDefaultNS("Server");
this.setAttributes(node, {
service: "OGC:WMS",
version: context.version
});
// required OnlineResource element
node.appendChild(this.write_wmc_OnlineResource(context.url));
return node;
},
/**
* Method: write_wmc_MetadataURL
* Create a MetadataURL node given a metadataURL string.
*
* Parameters:
* metadataURL - {String} MetadataURL string value.
*
* Returns:
* {Element} A WMC metadataURL element node.
*/
write_wmc_MetadataURL: function(metadataURL) {
var node = this.createElementDefaultNS("MetadataURL");
// required OnlineResource element
node.appendChild(this.write_wmc_OnlineResource(metadataURL));
return node;
},
/**
* Method: write_wmc_FormatList
* Create a FormatList node given a layer context.
*
* Parameters:
* context - {Object} Layer context object.
*
* Returns:
* {Element} A WMC FormatList element node.
*/
write_wmc_FormatList: function(context) {
var node = this.createElementDefaultNS("FormatList");
for (var i=0, len=context.formats.length; i<len; i++) {
var format = context.formats[i];
node.appendChild(this.createElementDefaultNS(
"Format",
format.value,
(format.current && format.current == true) ?
{current: "1"} : null
));
}
return node;
},
/**
* Method: write_wmc_StyleList
* Create a StyleList node given a layer context.
*
* Parameters:
* context - {Object} Layer context object.
*
* Returns:
* {Element} A WMC StyleList element node.
*/
write_wmc_StyleList: function(layer) {
var node = this.createElementDefaultNS("StyleList");
var styles = layer.styles;
if (styles && styles instanceof Array) {
var sld;
for (var i=0, len=styles.length; i<len; i++) {
var s = styles[i];
// three style types to consider
// [1] linked SLD
// [2] inline SLD
// [3] named style
// running child nodes always gets name, optionally gets href or body
var style = this.createElementDefaultNS(
"Style",
null,
(s.current && s.current == true) ?
{current: "1"} : null
);
if(s.href) { // [1]
sld = this.createElementDefaultNS("SLD");
var link = this.write_wmc_OnlineResource(s.href);
sld.appendChild(link);
// Name is required.
sld.appendChild(this.createElementDefaultNS("Name", s.name));
// Title is optional.
if (s.title) {
sld.appendChild(this.createElementDefaultNS("Title", s.title));
}
style.appendChild(sld);
} else if(s.body) { // [2]
sld = this.createElementDefaultNS("SLD");
// read in body as xml doc - assume proper namespace declarations
var doc = OpenLayers.Format.XML.prototype.read.apply(this, [s.body]);
// append to StyledLayerDescriptor node
var imported = doc.documentElement;
if(sld.ownerDocument && sld.ownerDocument.importNode) {
imported = sld.ownerDocument.importNode(imported, true);
}
sld.appendChild(imported);
// Name is required.
sld.appendChild(this.createElementDefaultNS("Name", s.name));
// Title is optional.
if (s.title) {
sld.appendChild(this.createElementDefaultNS("Title", s.title));
}
style.appendChild(sld);
} else { // [3]
// both Name and Title are required.
style.appendChild(this.createElementDefaultNS("Name", s.name));
style.appendChild(this.createElementDefaultNS("Title", s.title));
// Abstract is optional
if (s['abstract']) { // abstract is a js keyword
style.appendChild(this.createElementDefaultNS(
"Abstract", s['abstract']
));
}
}
node.appendChild(style);
}
}
return node;
},
/**
* Method: write_wmc_OnlineResource
* Create an OnlineResource node given a URL.
*
* Parameters:
* href - {String} URL for the resource.
*
* Returns:
* {Element} A WMC OnlineResource element node.
*/
write_wmc_OnlineResource: function(href) {
var node = this.createElementDefaultNS("OnlineResource");
this.setAttributeNS(node, this.namespaces.xlink, "xlink:type", "simple");
this.setAttributeNS(node, this.namespaces.xlink, "xlink:href", href);
return node;
},
CLASS_NAME: "OpenLayers.Format.WMC.v1"
});
| 29.893541 | 95 | 0.552439 |
9921fd6c592f94e8d0301ad5467b272d45a5f179 | 2,139 | js | JavaScript | pages.js | DecisionSystemsGroup/jekyll-editor | b032f4a6d0a3f89d3d21f4ddb0bc3d3ad66aaf19 | [
"MIT"
] | null | null | null | pages.js | DecisionSystemsGroup/jekyll-editor | b032f4a6d0a3f89d3d21f4ddb0bc3d3ad66aaf19 | [
"MIT"
] | null | null | null | pages.js | DecisionSystemsGroup/jekyll-editor | b032f4a6d0a3f89d3d21f4ddb0bc3d3ad66aaf19 | [
"MIT"
] | null | null | null | const pages = [
{
name: 'post',
hasText: true,
elements: [
{
name: 'layout',
default: 'post'
},
{
name: 'title',
default: ''
},
{
name: 'author',
default: ''
},
{
name: 'tags',
default: '[dsg]'
},
{
name: 'language',
default: 'english'
},
{
name: 'thumb',
default: ''
}
]
},
{
name: 'project',
hasText: true,
elements: [
{
name: 'layout',
default: 'project'
},
{
name: 'title',
default: ''
},
{
name: 'alias',
default: ''
},
{
name: 'members',
default: '[]'
},
{
name: 'thumb',
default: ''
}
]
},
{
name: 'team',
editorLabel: 'team member',
elements: [
{
name: 'layout',
default: 'member'
},
{
name: 'type',
default: 'student'
},
{
name: 'status',
default: 'active'
},
{
name: 'title',
default: ''
},
{
name: 'nickname',
default: ''
},
{
name: 'bio',
default: 'active'
},
{
name: 'department',
default: ''
},
{
name: 'avatar',
default: ''
},
{
name: 'projects',
default: '[]'
},
{
name: 'website',
default: ''
},
{
name: 'email',
default: ''
},
{
name: 'skype',
default: ''
},
{
name: 'facebook',
default: ''
},
{
name: 'twitter',
default: ''
},
{
name: 'linkedin',
default: ''
},
{
name: 'github',
default: ''
},
{
name: 'gitlab',
default: ''
},
{
name: 'stackoverflow',
default: ''
},
{
name: 'google_plus',
default: ''
},
{
name: 'youtube',
default: ''
},
{
name: 'behance',
default: ''
},
{
name: 'instagram',
default: ''
},
{
name: 'flickr',
default: ''
},
]
}
];
module.exports.all = pages;
module.exports.find = function (name){
return pages[pages.map(function(e) { return e.name; }).indexOf(name)];
};
module.exports.exists = function (name){
return (typeof module.exports.find(name) !== 'undefined');
}; | 12.885542 | 71 | 0.430108 |
992414b3f44c9c4d39118b85c21791462ed3057c | 10,852 | js | JavaScript | build/static/js/main.0e310904.chunk.js | Iryna1320/goit-react-hw-08-phonebook | 7486cdffca31107c79883f4bba820ae5bd0b9b9d | [
"MIT"
] | null | null | null | build/static/js/main.0e310904.chunk.js | Iryna1320/goit-react-hw-08-phonebook | 7486cdffca31107c79883f4bba820ae5bd0b9b9d | [
"MIT"
] | null | null | null | build/static/js/main.0e310904.chunk.js | Iryna1320/goit-react-hw-08-phonebook | 7486cdffca31107c79883f4bba820ae5bd0b9b9d | [
"MIT"
] | null | null | null | (this["webpackJsonpgoit-react-hw-08-phonebook"]=this["webpackJsonpgoit-react-hw-08-phonebook"]||[]).push([[1],{10:function(t,e,r){"use strict";r.d(e,"a",(function(){return g})),r.d(e,"b",(function(){return S})),r.d(e,"c",(function(){return E}));var n=r(4),c={registerRequest:Object(n.b)("auth/registerRequest"),registerSuccess:Object(n.b)("auth/registerSuccess"),registerError:Object(n.b)("auth/registerError"),loginRequest:Object(n.b)("auth/loginRequest"),loginSuccess:Object(n.b)("auth/loginSuccess"),loginError:Object(n.b)("auth/loginError"),logoutRequest:Object(n.b)("auth/logoutRequest"),logoutSuccess:Object(n.b)("auth/logoutSuccess"),logoutError:Object(n.b)("auth/logoutError"),getCurrentUserRequest:Object(n.b)("auth/getCurrentUserRequest"),getCurrentUserSuccess:Object(n.b)("auth/getCurrentUserSuccess"),getCurrentUserError:Object(n.b)("auth/getCurrentUserError")},a=r(16),u=r.n(a),s=r(23),o=r(18),i=r.n(o);i.a.defaults.baseURL="https://connections-api.herokuapp.com";var b,l,j,d,O=function(t){i.a.defaults.headers.common.Authorization="Bearer ".concat(t)},f=function(){i.a.defaults.headers.common.Authorization=""},g={register:function(t){return function(){var e=Object(s.a)(u.a.mark((function e(r){var n;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r(c.registerRequest()),e.prev=1,e.next=4,i.a.post("/users/signup",t);case 4:n=e.sent,O(n.data.token),r(c.registerSuccess(n.data)),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),r(c.registerError(e.t0.message));case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}()},logIn:function(t){return function(){var e=Object(s.a)(u.a.mark((function e(r){var n;return u.a.wrap((function(e){for(;;)switch(e.prev=e.next){case 0:return r(c.loginRequest()),e.prev=1,e.next=4,i.a.post("/users/login",t);case 4:n=e.sent,O(n.data.token),r(c.loginSuccess(n.data)),e.next=12;break;case 9:e.prev=9,e.t0=e.catch(1),r(c.loginError(e.t0.message));case 12:case"end":return e.stop()}}),e,null,[[1,9]])})));return function(t){return e.apply(this,arguments)}}()},logOut:function(){return function(){var t=Object(s.a)(u.a.mark((function t(e){return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:return e(c.logoutRequest()),t.prev=1,t.next=4,i.a.post("/users/logout");case 4:f(),e(c.logoutSuccess()),t.next=11;break;case 8:t.prev=8,t.t0=t.catch(1),e(c.logoutError(t.t0.message));case 11:case"end":return t.stop()}}),t,null,[[1,8]])})));return function(e){return t.apply(this,arguments)}}()},getCurrentUser:function(){return function(){var t=Object(s.a)(u.a.mark((function t(e,r){var n,a,s;return u.a.wrap((function(t){for(;;)switch(t.prev=t.next){case 0:if(n=r(),a=n.auth.token){t.next=3;break}return t.abrupt("return");case 3:return O(a),e(c.getCurrentUserRequest()),t.prev=5,t.next=8,i.a.get("/users/current");case 8:s=t.sent,e(c.getCurrentUserSuccess(s.data)),t.next=15;break;case 12:t.prev=12,t.t0=t.catch(5),e(c.getCurrentUserError(t.t0.message));case 15:case"end":return t.stop()}}),t,null,[[5,12]])})));return function(e,r){return t.apply(this,arguments)}}()}},h=r(3),p=r(7),x={name:null,email:null},v=Object(n.c)(x,(b={},Object(h.a)(b,c.registerSuccess,(function(t,e){return e.payload.user})),Object(h.a)(b,c.loginSuccess,(function(t,e){return e.payload.user})),Object(h.a)(b,c.logoutSuccess,(function(){return x})),Object(h.a)(b,c.getCurrentUserSuccess,(function(t,e){return e.payload})),b)),y=Object(n.c)(null,(l={},Object(h.a)(l,c.registerSuccess,(function(t,e){return e.payload.token})),Object(h.a)(l,c.loginSuccess,(function(t,e){return e.payload.token})),Object(h.a)(l,c.logoutSuccess,(function(){return null})),l)),k=function(t,e){return e.payload},m=Object(n.c)(null,(j={},Object(h.a)(j,c.registerError,k),Object(h.a)(j,c.loginError,k),Object(h.a)(j,c.logoutError,k),Object(h.a)(j,c.getCurrentUserError,k),j)),C=Object(n.c)(!1,(d={},Object(h.a)(d,c.registerSuccess,(function(){return!0})),Object(h.a)(d,c.loginSuccess,(function(){return!0})),Object(h.a)(d,c.getCurrentUserSuccess,(function(){return!0})),Object(h.a)(d,c.registerError,(function(){return!1})),Object(h.a)(d,c.loginError,(function(){return!1})),Object(h.a)(d,c.getCurrentUserError,(function(){return!1})),Object(h.a)(d,c.logoutSuccess,(function(){return!1})),d)),S=Object(p.c)({user:v,isAuthenticated:C,token:y,error:m}),E={getIsAuthenticated:function(t){return t.auth.isAuthenticated},getUserName:function(t){return t.auth.user.name}}},47:function(t,e,r){"use strict";r.d(e,"a",(function(){return u}));r(0);var n=r(50),c=r.n(n),a=r(1),u=function(t){var e=t.children;return Object(a.jsx)("div",{className:c.a.Container,children:e})}},50:function(t,e,r){t.exports={Container:"Container_Container__1P_2s"}},8:function(t,e,r){"use strict";r.d(e,"i",(function(){return c})),r.d(e,"j",(function(){return a})),r.d(e,"h",(function(){return u})),r.d(e,"b",(function(){return s})),r.d(e,"c",(function(){return o})),r.d(e,"a",(function(){return i})),r.d(e,"f",(function(){return b})),r.d(e,"g",(function(){return l})),r.d(e,"e",(function(){return j})),r.d(e,"d",(function(){return d}));var n=r(4),c=Object(n.b)("contacts/fetchContactsRequest"),a=Object(n.b)("contacts/fetchContactsSuccess"),u=Object(n.b)("contacts/fetchContactsError"),s=Object(n.b)("contacts/addContactRequest"),o=Object(n.b)("contacts/addContactSuccess"),i=Object(n.b)("contacts/addContactError"),b=Object(n.b)("contacts/deleteContactRequest"),l=Object(n.b)("contacts/deleteContactSuccess"),j=Object(n.b)("contacts/deleteContactError"),d=Object(n.b)("contacts/chageFilter")},85:function(t,e,r){},87:function(t,e,r){"use strict";r.r(e);var n=r(0),c=r.n(n),a=r(26),u=r.n(a),s=r(15),o=r(9),i=r(49),b=r(5),l=r(10),j=r(1),d={link:{display:"inline-block",textDecoration:"none",padding:12,fontWeight:700,color:"#2A363B"},activeLink:{color:"#E84A5F"}};function O(){var t=Object(o.c)(l.c.getIsAuthenticated);return Object(j.jsxs)("nav",{children:[Object(j.jsx)(s.b,{to:"/",exact:!0,style:d.link,activeStyle:d.activeLink,children:"\u0413\u043b\u0430\u0432\u043d\u0430\u044f"}),t&&Object(j.jsx)(s.b,{to:"/contacts",exact:!0,style:d.link,activeStyle:d.activeLink,children:"\u041a\u043e\u043d\u0442\u0430\u043a\u0442\u044b"})]})}var f=r.p+"static/media/default-avatar.ec618d9c.png",g=(r(37),r(89)),h={container:{display:"flex",alignItems:"center"},avatar:{marginRight:4},name:{fontWeight:700,marginRight:12}};function p(){var t=Object(o.b)(),e=Object(o.c)(l.c.getUserName),r=Object(n.useCallback)((function(){return t(l.a.logOut())}),[t]);return Object(j.jsxs)("div",{style:h.container,children:[Object(j.jsx)("img",{src:f,alt:"",width:"32",style:h.avatar}),Object(j.jsxs)("span",{style:h.name,children:["Welcome, ",e]}),Object(j.jsx)(g.a,{type:"button",variant:"primary",onClick:r,children:"Logout"})]})}var x={link:{display:"inline-block",textDecoration:"none",padding:12,fontWeight:700,color:"#2A363B"},activeLink:{color:"#E84A5F"}},v=function(){return Object(j.jsxs)("div",{children:[Object(j.jsx)(s.b,{to:"/register",exact:!0,style:x.link,activeStyle:x.activeLink,children:"\u0420\u0435\u0433\u0438\u0441\u0442\u0440\u0430\u0446\u0438\u044f"}),Object(j.jsx)(s.b,{to:"/login",exact:!0,style:x.link,activeStyle:x.activeLink,children:"\u041b\u043e\u0433\u0438\u043d"})]})},y={header:{display:"flex",justifyContent:"space-between",alignItems:"center",borderBottom:"1px solid #2A363B"}};function k(){var t=Object(o.c)(l.c.getIsAuthenticated);return Object(j.jsxs)("header",{style:y.header,children:[Object(j.jsx)(O,{}),t?Object(j.jsx)(p,{}):Object(j.jsx)(v,{})]})}var m=r(47),C=r(20),S=r(30);function E(t){t.getIsAuthenticated;var e=t.redirectTo,r=t.children,n=Object(S.a)(t,["getIsAuthenticated","redirectTo","children"]),c=Object(o.c)(l.c.getIsAuthenticated);return Object(j.jsx)(b.b,Object(C.a)(Object(C.a)({},n),{},{children:c?r:Object(j.jsx)(b.a,{to:e})}))}function A(t){t.getIsAuthenticated;var e=t.redirectTo,r=t.children,n=Object(S.a)(t,["getIsAuthenticated","redirectTo","children"]),c=Object(o.c)(l.c.getIsAuthenticated);return Object(j.jsx)(b.b,Object(C.a)(Object(C.a)({},n),{},{children:c&&n.restricted?Object(j.jsx)(b.a,{to:e}):r}))}var R=r(88),U=Object(n.lazy)((function(){return r.e(5).then(r.bind(null,98))})),w=Object(n.lazy)((function(){return Promise.all([r.e(0),r.e(7)]).then(r.bind(null,99))})),q=Object(n.lazy)((function(){return Promise.all([r.e(0),r.e(6)]).then(r.bind(null,100))})),I=Object(n.lazy)((function(){return r.e(4).then(r.bind(null,102))}));function L(){var t=Object(o.b)();return Object(n.useEffect)((function(){t(l.a.getCurrentUser())}),[t]),Object(j.jsxs)(m.a,{children:[Object(j.jsx)(k,{}),Object(j.jsx)(n.Suspense,{fallback:Object(j.jsx)("div",{className:"d-flex justify-content-center",children:Object(j.jsx)(R.a,{animation:"border",variant:"danger",role:"status",children:Object(j.jsx)("span",{className:"sr-only",children:"Loading..."})})}),children:Object(j.jsxs)(b.d,{children:[Object(j.jsx)(A,{exact:!0,path:"/",children:Object(j.jsx)(U,{})}),Object(j.jsx)(A,{path:"/register",restricted:!0,redirectTo:"/contacts",children:Object(j.jsx)(w,{})}),Object(j.jsx)(A,{path:"/login",restricted:!0,redirectTo:"/contacts",children:Object(j.jsx)(q,{})}),Object(j.jsx)(E,{path:"/contacts",redirectTo:"/login",children:Object(j.jsx)(I,{})})]})})]})}var T,z,B,N=r(29),W=r(4),_=r(51),F=r.n(_),P=r(17),D=r(52),J=r.n(D),M=r(3),G=r(7),H=r(8),K=Object(W.c)([],(T={},Object(M.a)(T,H.j,(function(t,e){return e.payload})),Object(M.a)(T,H.c,(function(t,e){var r=e.payload;return[].concat(Object(N.a)(t),[r])})),Object(M.a)(T,H.g,(function(t,e){var r=e.payload;return t.filter((function(t){return t.id!==r}))})),T)),Q=Object(W.c)(!1,(z={},Object(M.a)(z,H.i,(function(){return!0})),Object(M.a)(z,H.j,(function(){return!1})),Object(M.a)(z,H.h,(function(){return!1})),Object(M.a)(z,H.b,(function(){return!0})),Object(M.a)(z,H.c,(function(){return!1})),Object(M.a)(z,H.a,(function(){return!1})),Object(M.a)(z,H.f,(function(){return!0})),Object(M.a)(z,H.g,(function(){return!1})),Object(M.a)(z,H.e,(function(){return!1})),z)),V=Object(W.c)("",Object(M.a)({},H.d,(function(t,e){return e.payload}))),X=function(t,e){return e.payload},Y=Object(W.c)(null,(B={},Object(M.a)(B,H.h,X),Object(M.a)(B,H.a,X),Object(M.a)(B,H.e,X),B)),Z=Object(G.c)({items:K,filter:V,loading:Q,error:Y}),$=[].concat(Object(N.a)(Object(W.d)({serializableCheck:{ignoredActions:[P.a,P.f,P.b,P.c,P.d,P.e]}})),[F.a]),tt={key:"auth",storage:J.a,whitelist:["token"]},et=Object(W.a)({reducer:{auth:Object(P.g)(tt,l.b),contacts:Z},middleware:$,devTools:!1}),rt={store:et,persistor:Object(P.h)(et)};r(85),r(86);u.a.render(Object(j.jsx)(c.a.StrictMode,{children:Object(j.jsx)(o.a,{store:rt.store,children:Object(j.jsx)(i.a,{loading:null,persistor:rt.persistor,children:Object(j.jsx)(s.a,{children:Object(j.jsx)(L,{})})})})}),document.getElementById("root"))}},[[87,2,3]]]);
//# sourceMappingURL=main.0e310904.chunk.js.map | 5,426 | 10,804 | 0.689827 |
99243189adb39e32ace8ad9e97f4aef033942ded | 798 | js | JavaScript | packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/output.js | ozanhonamlioglu/babel | 2671c986c24df4a9edca30aba029aec170ea3d12 | [
"MIT"
] | 1 | 2022-03-20T23:22:48.000Z | 2022-03-20T23:22:48.000Z | packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/output.js | ozanhonamlioglu/babel | 2671c986c24df4a9edca30aba029aec170ea3d12 | [
"MIT"
] | null | null | null | packages/babel-plugin-proposal-decorators/test/fixtures/2021-12-misc/valid-expression-formats/output.js | ozanhonamlioglu/babel | 2671c986c24df4a9edca30aba029aec170ea3d12 | [
"MIT"
] | null | null | null | var _initClass, _dec, _dec2, _dec3, _dec4, _dec5, _dec6, _dec7, _dec8, _initProto;
const dec = () => {};
let _Foo;
_dec = call()
_dec2 = chain.expr()
_dec3 = arbitrary + expr
_dec4 = array[expr]
_dec5 = call()
_dec6 = chain.expr()
_dec7 = arbitrary + expr
_dec8 = array[expr]
class Foo {
static {
[_initProto, _Foo, _initClass] = babelHelpers.applyDecs(this, [[[dec, _dec5, _dec6, _dec7, _dec8], 2, "method"]], [dec, _dec, _dec2, _dec3, _dec4]);
}
constructor(...args) {
_initProto(this);
}
#a;
method() {}
makeClass() {
var _dec9, _init_bar;
return _dec9 = this.#a, class Nested {
static {
[_init_bar] = babelHelpers.applyDecs(this, [[_dec9, 0, "bar"]], []);
}
bar = _init_bar(this);
};
}
static {
_initClass();
}
}
| 17.733333 | 152 | 0.590226 |
992473e7d5898482668bc79d4af24bc1a471c559 | 556 | js | JavaScript | tasks/options/copy.js | erikwiffin/gridforms-chartjs-demo | 76f62ad3a56cfb034c51e6a0693d53e85fce91ba | [
"MIT"
] | 1 | 2020-10-31T23:18:09.000Z | 2020-10-31T23:18:09.000Z | tasks/options/copy.js | erikwiffin/gridforms-chartjs-demo | 76f62ad3a56cfb034c51e6a0693d53e85fce91ba | [
"MIT"
] | null | null | null | tasks/options/copy.js | erikwiffin/gridforms-chartjs-demo | 76f62ad3a56cfb034c51e6a0693d53e85fce91ba | [
"MIT"
] | null | null | null | // Copies remaining files to places other tasks can use.
module.exports = {
dist: {
files: [{
expand: true,
dot: true,
cwd: '<%= cfg.assets %>/bower_components/bootstrap/dist',
src: ['fonts/*.*'],
dest: '<%= cfg.dist %>'
}]
},
build: {
files: [{
expand: true,
dot: true,
cwd: '<%= cfg.assets %>',
dest: '<%= cfg.build %>',
src: [
'scripts/**/*.js'
]
}]
}
};
| 21.384615 | 69 | 0.370504 |
9925308f57ba15d4f68e21dbaea7e6247afa3202 | 1,325 | js | JavaScript | frontend/src/components/profileComponents/Info.js | arefeh-htmi/jobino | d006aa8a98bbfd025ff150736ea16f030dea9a9d | [
"MIT"
] | 3 | 2020-12-18T23:08:58.000Z | 2021-05-19T18:45:37.000Z | frontend/src/components/profileComponents/Info.js | arefeh-htmi/jobino | d006aa8a98bbfd025ff150736ea16f030dea9a9d | [
"MIT"
] | null | null | null | frontend/src/components/profileComponents/Info.js | arefeh-htmi/jobino | d006aa8a98bbfd025ff150736ea16f030dea9a9d | [
"MIT"
] | null | null | null | import React, { Component } from 'react';
import PropTypes from 'prop-types';
import isEmpty from '../../validation/isEmpty';
class Info extends Component {
render() {
const { profile } = this.props;
const fname = profile.user.name
const skills = profile.skills.map((skill, index) => (
<div key={index} className="p-3">
<i className="fa fa-check" /> {skill}
</div>
));
return (
<div className="row">
<div className="col-md-12">
<div className="card card-body bg-light mb-3">
<h3 className="text-center text-info">Summary</h3>
<p className="lead">
{isEmpty(profile.bio) ? (
<span>I am looking for a job which will help me utilize my skills for the growth of the organization</span>
) : (
<span>{fname.bio}</span>
)}
</p>
<hr />
<h3 className="text-center text-info">My Skills</h3>
<div className="row">
<div className="d-flex flex-wrap justify-content-center align-items-center">
{skills}
</div>
</div>
</div>
</div>
</div>
);
}
}
Info.propTypes = {
profile: PropTypes.object.isRequired
};
export default Info;
| 26.5 | 123 | 0.526792 |
99256a77e95f6e4d1563a7f4edec9038cb01b03f | 22,212 | js | JavaScript | src/pages/TaxForm/TaxBB1.js | Frostrab/VatLabel | e05ab009ace492ce1a54b10b9702cc3107cefbf1 | [
"MIT"
] | null | null | null | src/pages/TaxForm/TaxBB1.js | Frostrab/VatLabel | e05ab009ace492ce1a54b10b9702cc3107cefbf1 | [
"MIT"
] | null | null | null | src/pages/TaxForm/TaxBB1.js | Frostrab/VatLabel | e05ab009ace492ce1a54b10b9702cc3107cefbf1 | [
"MIT"
] | null | null | null | import React, { PureComponent } from 'react';
import {
Card,
Button,
Form,
Icon,
Col,
Row,
DatePicker,
TimePicker,
Input,
Select,
Popover,
Tabs,
} from 'antd';
import { connect } from 'dva';
import FooterToolbar from '@/components/FooterToolbar';
import PageHeaderWrapper from '@/components/PageHeaderWrapper';
import styles from './style.less';
const { Option } = Select;
const { RangePicker } = DatePicker;
const { TextArea } = Input;
const TabPane = Tabs.TabPane;
const fieldLabels = {
itemnumber: 'Item Number',
UM: 'UM',
Description: 'Description',
Prodbrand: 'Prod.Brand',
Alternate: 'Alternate UM',
Conversion: 'Conversion',
Barcode1: 'Barcode-หน่วยขาย',
Barcode2: 'Barcode-แพค',
Barcode3: 'Barcode-ลังบรรจุ',
Effective: 'Effective Date',
Safety: 'Safety Stock',
Requested: 'Requested by',
Department: 'Department',
Date: 'Date',
Apporved: 'Approved by',
Unit: 'Unit of Measure',
AlternateUM: 'Alternate UM',
ConversionUM: 'UM Conversion',
Year: 'ประจำปี',
Oldnum: 'เลขรับปีก่อน',
OwnerName: 'ชื่อเจ้าของป้าย',
ShopName: 'ชื่อสถานที่ประกอบการค้าหรือกิจการอื่นๆ',
Number: 'เลขที่',
Soi: 'ซอย',
Road: 'ถนน',
Muu: 'หมู่ที่',
Kwang: 'แขวง',
Ked: 'เขต',
Tel: 'โทรศัพท์',
Where: 'ขอยื่นแบบแสดงรายการภาษีป้ายต่อพนักงานเจ้าหน้าที่ ณ สำนักงานเขต',
Cat: 'ประเภทป้าย',
W: 'กว้าง',
H: 'ยาว',
Cal: 'เนื้อที่ป้าย ตาราง ซ.ม.',
Total: 'จำนวนป้าย',
Message: 'ข้อความหรือภาพหรือเครื่องหมายที่ปรากฏในป้ายโดยย่อ',
Start: 'สถานที่ติดตั้งและวันที่ติดตั้ง สถานที่ใกล้เคียงหรือ ระหว่าง ก.ม. ที่',
ETC: 'หมายเหตุ',
};
const formItemLayout1 = {
labelCol: {
xs: { span: 24 },
sm: { span: 8 },
},
wrapperCol: {
xs: { span: 24 },
sm: { span: 16 },
},
};
const tableData = [
{
key: '1',
workId: '00001',
name: 'John Brown',
department: 'New York No. 1 Lake Park',
},
{
key: '2',
workId: '00002',
name: 'Jim Green',
department: 'London No. 1 Lake Park',
},
{
key: '3',
workId: '00003',
name: 'Joe Black',
department: 'Sidney No. 1 Lake Park',
},
];
function onChange(date, dateString) {
console.log(date, dateString);
}
function callback(key) {
console.log(key);
}
@connect(({ loading }) => ({
submitting: loading.effects['form/submitTaxBB1'],
}))
@Form.create()
class TaxBB1 extends PureComponent {
state = {
width: '100%',
area: 0,
Wid: 0,
High: 0,
};
// Cal = (e) => {
// return (
// <p>{this.state.Wid} * {this.state.High}</p>)
// };
Cal = () => {
this.setState({ area : this.state.High * this.state.Wid})
}
handleWidChange = value => {
this.setState({ Wid: value });
}
handleHighChange = value => {
this.setState({ High: value });
}
onChangeCal = e => this.setState({ [e.target.name]: e.target.value })
componentDidMount() {
window.addEventListener('resize', this.resizeFooterToolbar, { passive: true });
}
componentWillUnmount() {
window.removeEventListener('resize', this.resizeFooterToolbar);
}
getErrorInfo = () => {
const {
form: { getFieldsError },
} = this.props;
const errors = getFieldsError();
const errorCount = Object.keys(errors).filter(key => errors[key]).length;
if (!errors || errorCount === 0) {
return null;
}
const scrollToField = fieldKey => {
const labelNode = document.querySelector(`label[for="${fieldKey}"]`);
if (labelNode) {
labelNode.scrollIntoView(true);
}
};
const errorList = Object.keys(errors).map(key => {
if (!errors[key]) {
return null;
}
return (
<li key={key} className={styles.errorListItem} onClick={() => scrollToField(key)}>
<Icon type="cross-circle-o" className={styles.errorIcon} />
<div className={styles.errorMessage}>{errors[key][0]}</div>
<div className={styles.errorField}>{fieldLabels[key]}</div>
</li>
);
});
return (
<span className={styles.errorIcon}>
<Popover
title="表单校验信息"
content={errorList}
overlayClassName={styles.errorPopover}
trigger="click"
getPopupContainer={trigger => trigger.parentNode}
>
<Icon type="exclamation-circle" />
</Popover>
{errorCount}
</span>
);
};
resizeFooterToolbar = () => {
requestAnimationFrame(() => {
const sider = document.querySelectorAll('.ant-layout-sider')[0];
if (sider) {
const width = `calc(100% - ${sider.style.width})`;
const { width: stateWidth } = this.state;
if (stateWidth !== width) {
this.setState({ width });
}
}
});
};
validate = () => {
const {
form: { validateFieldsAndScroll },
dispatch,
} = this.props;
validateFieldsAndScroll((error, values) => {
if (!error) {
// submit the values
dispatch({
type: 'form/submitTaxBB1',
payload: values,
});
}
});
};
render() {
const {
form: { getFieldDecorator },
submitting,
} = this.props;
const { Wid, High,area } = this.state;
return (
<div>
<Card className={styles.card} bordered={false}>
<Form layout="vertical" hideRequiredMark>
{/* Row 1 */}
<Row gutter={16}>
<Col lg={6} md={12} sm={24}>
<Form.Item label={fieldLabels.Year}>
<DatePicker onChange={onChange} />
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
<Form.Item label={fieldLabels.Oldnum}>
{getFieldDecorator('Oldnum', {
rules: [{ required: true, message: 'กรุณากรอกหมายเลข' }],
})(<Input placeholder="" />)}
</Form.Item>
</Col>
</Row>
{/* Row 2 */}
<Row gutter={16}>
<Col lg={6} md={12} sm={24}>
<Form.Item label={fieldLabels.OwnerName}>
{getFieldDecorator('OwnerName', {
rules: [{ required: true, message: 'กรุณากรอกชื่อเจ้าของป้าย' }],
})(<Input placeholder="" />)}
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
<Form.Item label={fieldLabels.ShopName}>
{getFieldDecorator('ShopName', {
rules: [{ required: true, message: 'กรุณากรอกชื่อร้าน' }],
})(<Input placeholder="" />)}
</Form.Item>
</Col>
</Row>
{/* Row 3 */}
<Row gutter={16}>
<Col lg={6} md={12} sm={24}>
<Form.Item label={fieldLabels.Number}>
{getFieldDecorator('Number', {
rules: [{ required: true, message: 'กรุณากรอกชื่อร้าน' }],
})(<Input placeholder="" />)}
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
<Form.Item label={fieldLabels.Soi}>
{getFieldDecorator('Soi', {
rules: [{ required: true, message: 'กรุณากรอกชื่อร้าน' }],
})(<Input placeholder="" />)}
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24} >
<Form.Item label={fieldLabels.Road}>
{getFieldDecorator('Road', {
rules: [{ required: true, message: 'กรุณากรอกชื่อร้าน' }],
})(<Input placeholder="" />)}
</Form.Item>
</Col>
</Row>
{/* Row 4 */}
<Row gutter={16}>
<Col lg={6} md={12} sm={24}>
<Form.Item label={fieldLabels.Muu}>
{getFieldDecorator('Muu', {
rules: [{ required: true, message: 'กรุณากรอกชื่อร้าน' }],
})(<Input placeholder="" />)}
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 18 }} sm={24}>
<Form.Item label={fieldLabels.Kwang}>
{getFieldDecorator('Kwang', {
rules: [{ required: true, message: 'กรุณากรอกชื่อร้าน' }],
})(<Input placeholder="" />)}
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 10 }} md={{ span: 18 }} sm={24}>
<Form.Item label={fieldLabels.Ked}>
{getFieldDecorator('Ked', {
rules: [{ required: true, message: 'กรุณากรอกชื่อร้าน' }],
})(<Input placeholder="" />)}
</Form.Item>
</Col>
</Row>
{/* Row 5 */}
<Row gutter={16}>
<Col lg={6} md={12} sm={24}>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24} />
<Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24} />
</Row>
{/* Row 6 */}
<Row gutter={16}>
<Col lg={6} md={12} sm={24}>
<Form.Item label={fieldLabels.Tel}>
{getFieldDecorator('Tel', {
rules: [{ required: true, message: '' }],
})(<Input placeholder="" />)}
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24} />
<Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24} />
</Row>
{/* Row 7 */}
<Row gutter={16}>
<Col lg={6} md={12} sm={24}>
<Form.Item label={fieldLabels.Where}>
{getFieldDecorator('Where', {
rules: [{ required: true, message: '' }],
})(<Input placeholder="" />)}
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24} >
</Col>
<Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24} />
</Row>
{/* Row 8 */}
<Row gutter={16}>
<Col lg={10} md={12} sm={24}>
<Form.Item label={fieldLabels.Cat}>
{getFieldDecorator('Cat', {
rules: [{ required: true, message: '' }],
})(
<Select
style={{ width: 280 }}
placeholder="เลือกประเภทของป้าย">
<Option value="1">มีอักษรไทยล้วน มีอักษรไทย</Option>
<Option value="2">ปนกับอักษรต่างประเทศ หรือ เครื่องหมาย</Option>
<Option value="3">ป้ายที่ไม่มีอักษร</Option>
</Select>
)}
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
</Col>
<Col xl={{ span: 8, offset: 0 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
</Col>
<Col xl={{ span: 8, offset: 0 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
</Col>
</Row>
{/* Row 9 */}
<Row gutter={16}>
<Col lg={6} md={12} sm={24}>
<h3>ขนาดของป้าย</h3>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
<Form.Item label={fieldLabels.W}>
{/* {getFieldDecorator('W', {
rules: [{ required: true, message: '' }],
})(<Input type="number" name="Wid" value={Wid} onChange={this.onChangeCal} />)}
})(<Input placeholder="" />)} */}
<Input type="number" name="Wid" value={Wid} onChange={this.onChangeCal} onBlur={this.Cal} />
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
<Form.Item label={fieldLabels.H}>
{/* {getFieldDecorator('H', {
rules: [{ required: true, message: '' }],
})(<Input type="number" name="High" value={High} onChange={this.onChangeCal} />)}
})(<Input placeholder="" />)} */}
<Input type="number" name="High" value={High} onChange={this.onChangeCal} onBlur={this.Cal} />
</Form.Item>
</Col>
</Row>
{/* Row 10 */}
<Row gutter={16}>
<Col lg={6} md={12} sm={24}>
<Form.Item label={fieldLabels.Cal}>
{/* <Input type="number" value={this.Cal()} readOnly /> */}
<Input type="number" value={area} readOnly />
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
<Form.Item label={fieldLabels.Total}>
<Input type="number"placeholder="" />
</Form.Item>
</Col>
<Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
</Col>
</Row>
</Form>
<Form>
{/* Row 11 */}
<Row gutter={16}>
<Col lg={12} md={12} sm={24}>
<Form.Item label={fieldLabels.Message}>
{getFieldDecorator('Message', {
rules: [
{
required: true,
message: 'Please enter description',
},
],
})(
<TextArea
style={{ minHeight: 32, width: 300 }}
placeholder=""
rows={4}
/>
)}
</Form.Item>
</Col>
<Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
</Col>
<Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
</Col>
</Row>
{/* Row 12 */}
<Row gutter={16}>
<Col lg={12} md={12} sm={24}>
<Form.Item label={fieldLabels.Start}>
{getFieldDecorator('Start', {
rules: [
{
required: true,
message: '',
},
],
})(
<TextArea
style={{ minHeight: 32, width: 300 }}
placeholder=""
rows={4}
/>
)}
</Form.Item>
</Col>
{/* <Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
</Col>
<Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
</Col> */}
</Row>
{/* Row 13 */}
<Row gutter={16}>
<Col lg={12} md={12} sm={24}>
<Form.Item label={fieldLabels.ETC}>
{getFieldDecorator('ETC', {
rules: [
{
required: true,
message: 'Please enter description',
},
],
})(
<TextArea
style={{ minHeight: 32, width: 300 }}
placeholder=""
rows={4}
/>
)}
</Form.Item>
</Col>
{/* <Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
</Col>
<Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
</Col> */}
</Row>
{/* Row 13 */}
<Row gutter={16}>
<Col lg={12} md={12} sm={24}>
<Button type="primary">Print</Button>
</Col>
{/* <Col xl={{ span: 6, offset: 2 }} lg={{ span: 8 }} md={{ span: 12 }} sm={24}>
</Col>
<Col xl={{ span: 8, offset: 2 }} lg={{ span: 10 }} md={{ span: 24 }} sm={24}>
</Col> */}
</Row>
</Form>
</Card>
</div>
);
}
}
export default TaxBB1;
| 42.228137 | 130 | 0.32667 |
992692d98af35c2cdcdbc682f30d2b76a4d3a3b2 | 885 | js | JavaScript | static/js/DataLoadingController.js | appfirst/correlate | f82fe35da220eac2d722df3521fcd1e4a88f955d | [
"MIT"
] | null | null | null | static/js/DataLoadingController.js | appfirst/correlate | f82fe35da220eac2d722df3521fcd1e4a88f955d | [
"MIT"
] | null | null | null | static/js/DataLoadingController.js | appfirst/correlate | f82fe35da220eac2d722df3521fcd1e4a88f955d | [
"MIT"
] | null | null | null | define([], function() {
var DataLoadingController = Backbone.View.extend({
initialize: function(options) {
this.listenTo(options.watchedResources, 'data-fetch-start', this.requestStart);
this.listenTo(options.watchedResources, 'data-fetch-page', this.requestMore);
this.listenTo(options.watchedResources, 'data-received', this.requestEnd);
this.listenTo(options.watchedResources, 'data-error', this.requestEnd);
this.numRequests = 0;
},
requestStart: function() {
this.numRequests ++;
this.checkRequests();
},
requestMore: function() {
this.numRequests --;
},
requestEnd: function() {
this.numRequests --;
this.checkRequests();
},
checkRequests: function() {
if (this.numRequests > 0) {
showLoading($('#graph'), true, 1);
} else {
this.numRequests = 0;
hideLoading();
}
}
});
return DataLoadingController;
}); | 26.818182 | 82 | 0.675706 |
99272d54e88f4a449f61a5ff2fede365b668fc68 | 452 | js | JavaScript | client/index.js | Trip-Tracker/triptracker | 7521af674e5ccb2c3d7ebc00af3f452111a0fec4 | [
"PostgreSQL",
"Unlicense",
"MIT"
] | null | null | null | client/index.js | Trip-Tracker/triptracker | 7521af674e5ccb2c3d7ebc00af3f452111a0fec4 | [
"PostgreSQL",
"Unlicense",
"MIT"
] | null | null | null | client/index.js | Trip-Tracker/triptracker | 7521af674e5ccb2c3d7ebc00af3f452111a0fec4 | [
"PostgreSQL",
"Unlicense",
"MIT"
] | null | null | null | import React from "react";
import { render } from "react-dom";
import { Provider } from "react-redux";
import store from './store.js';
//Import Components
import App from "./components/App.jsx";
// uncomment so that webpack can bundle styles
import styles from "./css/application.css";
// render(<App />, document.getElementById("root"));
render(
<Provider store={store}>
<App />
</Provider>,
document.getElementById("root") // anchor
);
| 22.6 | 52 | 0.688053 |
9927d23c42246dc511ddfad55f3867be458dee54 | 125 | js | JavaScript | source/task/index.js | entoj/entoj-js | 28fcc275d22994dd4a6bbe7dae4c03022d80a2b8 | [
"Apache-2.0"
] | 1 | 2020-07-27T18:32:17.000Z | 2020-07-27T18:32:17.000Z | source/task/index.js | entoj/entoj-js | 28fcc275d22994dd4a6bbe7dae4c03022d80a2b8 | [
"Apache-2.0"
] | 3 | 2019-07-01T12:30:38.000Z | 2021-03-31T20:58:12.000Z | source/task/index.js | entoj/entoj-js | 28fcc275d22994dd4a6bbe7dae4c03022d80a2b8 | [
"Apache-2.0"
] | 1 | 2019-07-01T10:41:09.000Z | 2019-07-01T10:41:09.000Z |
/**
* @namespace task
*/
module.exports =
{
PostProcessJsTask: require('./PostProcessJsTask.js').PostProcessJsTask
};
| 13.888889 | 74 | 0.688 |
99298544c03f7f95e37b0f302e6911bc66076125 | 193,387 | js | JavaScript | static/js/xtk/xtk_edge.js | RitikGandhi21/3D-Medical-Image-Modelling | 3e1b1614b78189fbe1966a58315157af7d3cf62f | [
"MIT"
] | 24 | 2017-12-16T08:34:29.000Z | 2021-09-27T22:37:26.000Z | static/js/xtk/xtk_edge.js | RitikGandhi21/3D-Medical-Image-Modelling | 3e1b1614b78189fbe1966a58315157af7d3cf62f | [
"MIT"
] | 1 | 2018-06-21T09:15:47.000Z | 2018-06-21T09:15:47.000Z | static/js/xtk/xtk_edge.js | RitikGandhi21/3D-Medical-Image-Modelling | 3e1b1614b78189fbe1966a58315157af7d3cf62f | [
"MIT"
] | 10 | 2018-04-19T10:03:42.000Z | 2020-09-26T16:55:32.000Z | /*
*
* xxxxxxx xxxxxxx
* x:::::x x:::::x
* x:::::x x:::::x
* x:::::xx:::::x
* x::::::::::x
* x::::::::x
* x::::::::x
* x::::::::::x
* x:::::xx:::::x
* x:::::x x:::::x
* x:::::x x:::::x
* THE xxxxxxx xxxxxxx TOOLKIT
*
* http://www.goXTK.com
*
* Copyright (c) 2012 The X Toolkit Developers <dev@goXTK.com>
*
* The X Toolkit (XTK) is licensed under the MIT License:
* http://www.opensource.org/licenses/mit-license.php
*
* "Free software" is a matter of liberty, not price.
* "Free" as in "free speech", not as in "free beer".
* - Richard M. Stallman
*
* FUELED BY:
* - the wonderful Constructive Solid Geometry library by Evan Wallace (http://madebyevan.com)
* LICENSE: https://raw.github.com/xtk/X/master/lib/csg/LICENSE
*
* - parts of the Google Closure Library (http://code.google.com/closure/library)
* LICENSE: https://raw.github.com/xtk/google-closure-library/master/LICENSE
*
* - zlib.js, the ultimate gzip/zlib javascript implementation (https://github.com/imaya/zlib.js)
* LICENSE: https://raw.github.com/imaya/zlib.js/master/LICENSE
*
* MORE CREDITS: https://raw.github.com/xtk/X/master/LICENSE
*
*/
function m(a){throw a;}var p=void 0,q=!0,t=null,u=!1;function aa(){return function(){}}function ca(a){return function(b){this[a]=b}}function v(a){return function(){return this[a]}}var w,fa=this;function ga(){}
function ha(a){var b=typeof a;if("object"==b)if(a){if(a instanceof Array)return"array";if(a instanceof Object)return b;var c=Object.prototype.toString.call(a);if("[object Window]"==c)return"object";if("[object Array]"==c||"number"==typeof a.length&&"undefined"!=typeof a.splice&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("splice"))return"array";if("[object Function]"==c||"undefined"!=typeof a.call&&"undefined"!=typeof a.propertyIsEnumerable&&!a.propertyIsEnumerable("call"))return"function"}else return"null";
else if("function"==b&&"undefined"==typeof a.call)return"object";return b}function ia(a){return a!==p}function la(a){return"array"==ha(a)}function ma(a){var b=ha(a);return"array"==b||"object"==b&&"number"==typeof a.length}function na(a){return"string"==typeof a}function x(a){return"number"==typeof a}function oa(a){return"function"==ha(a)}function pa(a){var b=typeof a;return"object"==b&&a!=t||"function"==b}function qa(a){return a[ra]||(a[ra]=++sa)}var ra="closure_uid_"+(1E9*Math.random()>>>0),sa=0;
function ta(a,b,c){return a.call.apply(a.bind,arguments)}function ua(a,b,c){a||m(Error());if(2<arguments.length){var e=Array.prototype.slice.call(arguments,2);return function(){var c=Array.prototype.slice.call(arguments);Array.prototype.unshift.apply(c,e);return a.apply(b,c)}}return function(){return a.apply(b,arguments)}}function va(a,b,c){va=Function.prototype.bind&&-1!=Function.prototype.bind.toString().indexOf("native code")?ta:ua;return va.apply(t,arguments)}
function wa(a,b){var c=Array.prototype.slice.call(arguments,1);return function(){var b=Array.prototype.slice.call(arguments);b.unshift.apply(b,c);return a.apply(this,b)}}var xa=Date.now||function(){return+new Date};function A(a,b){var c=a.split("."),e=fa;!(c[0]in e)&&e.execScript&&e.execScript("var "+c[0]);for(var d;c.length&&(d=c.shift());)!c.length&&ia(b)?e[d]=b:e=e[d]?e[d]:e[d]={}}
function C(a,b){function c(){}c.prototype=b.prototype;a.u=b.prototype;a.prototype=new c;a.prototype.constructor=a};function ya(a,b,c){this.Za=this.Ya=this.Xa=0;3==arguments.length?(this.Xa=Number(a),this.Ya=Number(b),this.Za=Number(c)):a instanceof ya?(this.Xa=Number(a.x()),this.Ya=Number(a.y()),this.Za=Number(a.d())):(this.Xa=Number(a[0]),this.Ya=Number(a[1]),this.Za=Number(a[2]))}
ya.prototype={l:function(){return new ya(this.Xa,this.Ya,this.Za)},ac:function(a){return this.Xa*a.x()+this.Ya*a.y()+this.Za*a.d()},se:function(a,b){return za(this,Aa(Ca(a,this),b))},length:function(){return Math.sqrt(this.ac(this))},sc:function(a){return new ya(this.Ya*a.d()-this.Za*a.y(),this.Za*a.x()-this.Xa*a.d(),this.Xa*a.y()-this.Ya*a.x())},x:v("Xa"),y:v("Ya"),d:v("Za")};function Da(a){var b=a.length();return new ya(a.Xa/b,a.Ya/b,a.Za/b)}
function Aa(a,b){return new ya(a.Xa*b,a.Ya*b,a.Za*b)}function Ca(a,b){return new ya(a.Xa-b.x(),a.Ya-b.y(),a.Za-b.d())}function za(a,b){return new ya(a.Xa+b.x(),a.Ya+b.y(),a.Za+b.d())}function Ea(a){return new ya(-a.Xa,-a.Ya,-a.Za)};var D=D||{};D.zk=q;D.Ja=function(a){eval("X.DEV === undefined")||window.console.time(a)};D.Da=function(a){eval("X.DEV === undefined")||window.console.timeEnd(a)};window["X.counter"]=new function(){this.Wh=0;this.qk=function(){return this.Wh++}};function Fa(a,b){for(var c in b){var e=b.__lookupGetter__(c),d=b.__lookupSetter__(c);c in a||(e||d?(e&&a.__defineGetter__(c,e),d&&a.__defineSetter__(c,d)):a[c]=b[c])}}var Ha=window.Lh;
Function.prototype.bind||(Function.prototype.bind=function(a){function b(){return f.apply(this instanceof c?this:a||window,d.concat(e.call(arguments)))}function c(){}"function"!==typeof this&&m(new TypeError("Function.prototype.bind - what is trying to be bound is not callable"));var e=Array.prototype.slice,d=e.call(arguments,1),f=this;c.prototype=this.prototype;b.prototype=new c;return b});
for(var Ia=0,Ja=["ms","moz","webkit","o"],Ka=0;Ka<Ja.length&&!window.requestAnimationFrame;++Ka)window.requestAnimationFrame=window[Ja[Ka]+"RequestAnimationFrame"],window.cancelAnimationFrame=window[Ja[Ka]+"CancelAnimationFrame"]||window[Ja[Ka]+"CancelRequestAnimationFrame"];window.requestAnimationFrame||(window.requestAnimationFrame=function(a){var b=Date.now(),c=Math.max(0,16-(b-Ia)),e=window.setTimeout(function(){a(b+c)},c);Ia=b+c;return e});
window.cancelAnimationFrame||(window.cancelAnimationFrame=function(a){clearTimeout(a)});
"slice"in ArrayBuffer.prototype||(ArrayBuffer.prototype.slice=function(a,b){a===p&&m(Error("Not enough arguments."));var c=b||this.byteLength;0>a&&(a=this.byteLength+a);0>c&&(c=this.byteLength+c);c<a&&(c=a=0);0>a&&(a=0);0>c&&(c=0);a>this.byteLength&&(a=this.byteLength);c>this.byteLength&&(c=this.byteLength);for(var e=new ArrayBuffer(c-a),d=new Uint8Array(this),f=new Uint8Array(e),g=a,h=0;g<c;++g,++h)f[h]=d[g];return e});A("$",Ha);A("Function.prototype.bind",Function.prototype.bind);
A("window.requestAnimationFrame",window.requestAnimationFrame);A("window.cancelAnimationFrame",window.cancelAnimationFrame);var La=0;function Ma(){}w=Ma.prototype;w.key=0;w.xc=u;w.ie=u;w.Ca=function(a,b,c,e,d,f){oa(a)?this.Ug=q:a&&a.handleEvent&&oa(a.handleEvent)?this.Ug=u:m(Error("Invalid listener argument"));this.bc=a;this.oh=b;this.src=c;this.type=e;this.capture=!!d;this.tf=f;this.ie=u;this.key=++La;this.xc=u};w.handleEvent=function(a){return this.Ug?this.bc.call(this.tf||this.src,a):this.bc.handleEvent.call(this.bc,a)};function Na(a,b){for(var c in a)b.call(p,a[c],c,a)}function Oa(a){var b=[],c=0,e;for(e in a)b[c++]=a[e];return b}var Pa="constructor hasOwnProperty isPrototypeOf propertyIsEnumerable toLocaleString toString valueOf".split(" ");function Qa(a,b){for(var c,e,d=1;d<arguments.length;d++){e=arguments[d];for(c in e)a[c]=e[c];for(var f=0;f<Pa.length;f++)c=Pa[f],Object.prototype.hasOwnProperty.call(e,c)&&(a[c]=e[c])}};function Ra(a){if(!Sa.test(a))return a;-1!=a.indexOf("&")&&(a=a.replace(Ta,"&"));-1!=a.indexOf("<")&&(a=a.replace(Ua,"<"));-1!=a.indexOf(">")&&(a=a.replace(Va,">"));-1!=a.indexOf('"')&&(a=a.replace(Wa,"""));return a}var Ta=/&/g,Ua=/</g,Va=/>/g,Wa=/\"/g,Sa=/[&<>\"]/;var Xa,Ya,Za,$a,ab,bb,db;function eb(){return fa.navigator?fa.navigator.userAgent:t}function fb(){return fa.navigator}$a=Za=Ya=Xa=u;var gb;if(gb=eb()){var hb=fb();Xa=0==gb.indexOf("Opera");Ya=!Xa&&-1!=gb.indexOf("MSIE");Za=!Xa&&-1!=gb.indexOf("WebKit");$a=!Xa&&!Za&&"Gecko"==hb.product}var ib=Xa,K=Ya,jb=$a,lb=Za,mb,pb=fb();mb=pb&&pb.platform||"";ab=-1!=mb.indexOf("Mac");bb=-1!=mb.indexOf("Win");db=-1!=mb.indexOf("Linux");var qb=!!fb()&&-1!=(fb().appVersion||"").indexOf("X11");
function rb(){var a=fa.document;return a?a.documentMode:p}var sb;a:{var wb="",xb;if(ib&&fa.opera)var yb=fa.opera.version,wb="function"==typeof yb?yb():yb;else if(jb?xb=/rv\:([^\);]+)(\)|;)/:K?xb=/MSIE\s+([^\);]+)(\)|;)/:lb&&(xb=/WebKit\/(\S+)/),xb)var zb=xb.exec(eb()),wb=zb?zb[1]:"";if(K){var Ab=rb();if(Ab>parseFloat(wb)){sb=String(Ab);break a}}sb=wb}var Bb={};
function Cb(a){var b;if(!(b=Bb[a])){b=0;for(var c=String(sb).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),e=String(a).replace(/^[\s\xa0]+|[\s\xa0]+$/g,"").split("."),d=Math.max(c.length,e.length),f=0;0==b&&f<d;f++){var g=c[f]||"",h=e[f]||"",l=RegExp("(\\d*)(\\D*)","g"),j=RegExp("(\\d*)(\\D*)","g");do{var k=l.exec(g)||["","",""],n=j.exec(h)||["","",""];if(0==k[0].length&&0==n[0].length)break;b=((0==k[1].length?0:parseInt(k[1],10))<(0==n[1].length?0:parseInt(n[1],10))?-1:(0==k[1].length?0:parseInt(k[1],
10))>(0==n[1].length?0:parseInt(n[1],10))?1:0)||((0==k[2].length)<(0==n[2].length)?-1:(0==k[2].length)>(0==n[2].length)?1:0)||(k[2]<n[2]?-1:k[2]>n[2]?1:0)}while(0==b)}b=Bb[a]=0<=b}return b}var Db=fa.document,Eb=!Db||!K?p:rb()||("CSS1Compat"==Db.compatMode?parseInt(sb,10):5);var Fb=!K||K&&9<=Eb,Gb=K&&!Cb("9");!lb||Cb("528");jb&&Cb("1.9b")||K&&Cb("8")||ib&&Cb("9.5")||lb&&Cb("528");jb&&!Cb("8")||K&&Cb("9");var Hb=Array.prototype,Ib=Hb.indexOf?function(a,b,c){return Hb.indexOf.call(a,b,c)}:function(a,b,c){c=c==t?0:0>c?Math.max(0,a.length+c):c;if(na(a))return!na(b)||1!=b.length?-1:a.indexOf(b,c);for(;c<a.length;c++)if(c in a&&a[c]===b)return c;return-1},Jb=Hb.forEach?function(a,b,c){Hb.forEach.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=na(a)?a.split(""):a,f=0;f<e;f++)f in d&&b.call(c,d[f],f,a)},Lb=Hb.map?function(a,b,c){return Hb.map.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=Array(e),f=
na(a)?a.split(""):a,g=0;g<e;g++)g in f&&(d[g]=b.call(c,f[g],g,a));return d},Mb=Hb.some?function(a,b,c){return Hb.some.call(a,b,c)}:function(a,b,c){for(var e=a.length,d=na(a)?a.split(""):a,f=0;f<e;f++)if(f in d&&b.call(c,d[f],f,a))return q;return u};function Nb(a,b){var c=Ib(a,b);0<=c&&Hb.splice.call(a,c,1)}function Ob(a,b,c){return 2>=arguments.length?Hb.slice.call(a,b):Hb.slice.call(a,b,c)};function Pb(){0!=Qb&&(this.xl=Error().stack,qa(this))}var Qb=0;function Rb(a,b){this.type=a;this.currentTarget=this.target=b}w=Rb.prototype;w.wc=u;w.defaultPrevented=u;w.xe=q;w.stopPropagation=function(){this.wc=q};w.preventDefault=function(){this.defaultPrevented=q;this.xe=u};function Sb(a){Sb[" "](a);return a}Sb[" "]=ga;function Tb(a,b){a&&this.Ca(a,b)}C(Tb,Rb);w=Tb.prototype;w.target=t;w.relatedTarget=t;w.offsetX=0;w.offsetY=0;w.clientX=0;w.clientY=0;w.screenX=0;w.screenY=0;w.button=0;w.keyCode=0;w.charCode=0;w.ctrlKey=u;w.altKey=u;w.shiftKey=u;w.metaKey=u;w.Wj=u;w.sb=t;
w.Ca=function(a,b){var c=this.type=a.type;Rb.call(this,c);this.target=a.target||a.srcElement;this.currentTarget=b;var e=a.relatedTarget;if(e){if(jb){var d;a:{try{Sb(e.nodeName);d=q;break a}catch(f){}d=u}d||(e=t)}}else"mouseover"==c?e=a.fromElement:"mouseout"==c&&(e=a.toElement);this.relatedTarget=e;this.offsetX=lb||a.offsetX!==p?a.offsetX:a.layerX;this.offsetY=lb||a.offsetY!==p?a.offsetY:a.layerY;this.clientX=a.clientX!==p?a.clientX:a.pageX;this.clientY=a.clientY!==p?a.clientY:a.pageY;this.screenX=
a.screenX||0;this.screenY=a.screenY||0;this.button=a.button;this.keyCode=a.keyCode||0;this.charCode=a.charCode||("keypress"==c?a.keyCode:0);this.ctrlKey=a.ctrlKey;this.altKey=a.altKey;this.shiftKey=a.shiftKey;this.metaKey=a.metaKey;this.Wj=ab?a.metaKey:a.ctrlKey;this.state=a.state;this.sb=a;a.defaultPrevented&&this.preventDefault();delete this.wc};w.stopPropagation=function(){Tb.u.stopPropagation.call(this);this.sb.stopPropagation?this.sb.stopPropagation():this.sb.cancelBubble=q};
w.preventDefault=function(){Tb.u.preventDefault.call(this);var a=this.sb;if(a.preventDefault)a.preventDefault();else if(a.returnValue=u,Gb)try{if(a.ctrlKey||112<=a.keyCode&&123>=a.keyCode)a.keyCode=-1}catch(b){}};w.Gi=v("sb");var Ub={},Vb={},Wb={},Xb={};function L(a,b,c,e,d){if(la(b)){for(var f=0;f<b.length;f++)L(a,b[f],c,e,d);return t}a=Yb(a,b,c,u,e,d);b=a.key;Ub[b]=a;return b}
function Yb(a,b,c,e,d,f){b||m(Error("Invalid event type"));d=!!d;var g=Vb;b in g||(g[b]={oa:0,Na:0});g=g[b];d in g||(g[d]={oa:0,Na:0},g.oa++);var g=g[d],h=qa(a),l;g.Na++;if(g[h]){l=g[h];for(var j=0;j<l.length;j++)if(g=l[j],g.bc==c&&g.tf==f){if(g.xc)break;e||(l[j].ie=u);return l[j]}}else l=g[h]=[],g.oa++;var k=Zb,n=Fb?function(a){return k.call(n.src,n.bc,a)}:function(a){a=k.call(n.src,n.bc,a);if(!a)return a},j=n,g=new Ma;g.Ca(c,j,a,b,d,f);g.ie=e;j.src=a;j.bc=g;l.push(g);Wb[h]||(Wb[h]=[]);Wb[h].push(g);
a.addEventListener?(a==fa||!a.customEvent_)&&a.addEventListener(b,j,d):a.attachEvent(b in Xb?Xb[b]:Xb[b]="on"+b,j);return g}function $b(a,b,c,e,d){if(la(b))for(var f=0;f<b.length;f++)$b(a,b[f],c,e,d);else a=Yb(a,b,c,q,e,d),Ub[a.key]=a}function ac(a,b,c,e,d){if(la(b))for(var f=0;f<b.length;f++)ac(a,b[f],c,e,d);else{e=!!e;a:{f=Vb;if(b in f&&(f=f[b],e in f&&(f=f[e],a=qa(a),f[a]))){a=f[a];break a}a=t}if(a)for(f=0;f<a.length;f++)if(a[f].bc==c&&a[f].capture==e&&a[f].tf==d){bc(a[f].key);break}}}
function bc(a){var b=Ub[a];if(!b||b.xc)return u;var c=b.src,e=b.type,d=b.oh,f=b.capture;c.removeEventListener?(c==fa||!c.customEvent_)&&c.removeEventListener(e,d,f):c.detachEvent&&c.detachEvent(e in Xb?Xb[e]:Xb[e]="on"+e,d);c=qa(c);Wb[c]&&(d=Wb[c],Nb(d,b),0==d.length&&delete Wb[c]);b.xc=q;if(b=Vb[e][f][c])b.fh=q,cc(e,f,c,b);delete Ub[a];return q}
function cc(a,b,c,e){if(!e.te&&e.fh){for(var d=0,f=0;d<e.length;d++)e[d].xc?e[d].oh.src=t:(d!=f&&(e[f]=e[d]),f++);e.length=f;e.fh=u;0==f&&(delete Vb[a][b][c],Vb[a][b].oa--,0==Vb[a][b].oa&&(delete Vb[a][b],Vb[a].oa--),0==Vb[a].oa&&delete Vb[a])}}function dc(a){var b=0;if(a!=t){if(a=qa(a),Wb[a]){a=Wb[a];for(var c=a.length-1;0<=c;c--)bc(a[c].key),b++}}else Na(Ub,function(a,c){bc(c);b++})}
function ec(a,b){var c=qa(a),e=Wb[c];if(e){var d=ia(b),f=ia(p);return d&&f?(e=Vb[b],!!e&&!!e[p]&&c in e[p]):!d&&!f?q:Mb(e,function(a){return d&&a.type==b||f&&a.capture==p})}return u}function fc(a,b,c,e,d){var f=1;b=qa(b);if(a[b]){var g=--a.Na,h=a[b];h.te?h.te++:h.te=1;try{for(var l=h.length,j=0;j<l;j++){var k=h[j];k&&!k.xc&&(f&=gc(k,d)!==u)}}finally{a.Na=Math.max(g,a.Na),h.te--,cc(c,e,b,h)}}return Boolean(f)}function gc(a,b){a.ie&&bc(a.key);return a.handleEvent(b)}
function Zb(a,b){if(a.xc)return q;var c=a.type,e=Vb;if(!(c in e))return q;var e=e[c],d,f;if(!Fb){var g;if(!(g=b))a:{g=["window","event"];for(var h=fa;d=g.shift();)if(h[d]!=t)h=h[d];else{g=t;break a}g=h}d=g;g=q in e;h=u in e;if(g){if(0>d.keyCode||d.returnValue!=p)return q;a:{var l=u;if(0==d.keyCode)try{d.keyCode=-1;break a}catch(j){l=q}if(l||d.returnValue==p)d.returnValue=q}}l=new Tb;l.Ca(d,this);d=q;try{if(g){for(var k=[],n=l.currentTarget;n;n=n.parentNode)k.push(n);f=e[q];f.Na=f.oa;for(var s=k.length-
1;!l.wc&&0<=s&&f.Na;s--)l.currentTarget=k[s],d&=fc(f,k[s],c,q,l);if(h){f=e[u];f.Na=f.oa;for(s=0;!l.wc&&s<k.length&&f.Na;s++)l.currentTarget=k[s],d&=fc(f,k[s],c,u,l)}}else d=gc(a,l)}finally{k&&(k.length=0)}return d}c=new Tb(b,this);return d=gc(a,c)}var hc=0;function ic(a){return a+"_"+hc++};function jc(){Pb.call(this);this.Bl={};this.ul=this}C(jc,Pb);jc.prototype.customEvent_=q;w=jc.prototype;w.Lf=t;w.Qf=ca("Lf");w.addEventListener=function(a,b,c,e){L(this,a,b,c,e)};w.removeEventListener=function(a,b,c,e){ac(this,a,b,c,e)};
w.dispatchEvent=function(a){var b=a.type||a,c=Vb;if(b in c){if(na(a))a=new Rb(a,this);else if(a instanceof Rb)a.target=a.target||this;else{var e=a;a=new Rb(b,this);Qa(a,e)}var e=1,d,c=c[b],b=q in c,f;if(b){d=[];for(f=this;f;f=f.Lf)d.push(f);f=c[q];f.Na=f.oa;for(var g=d.length-1;!a.wc&&0<=g&&f.Na;g--)a.currentTarget=d[g],e&=fc(f,d[g],a.type,q,a)&&a.xe!=u}if(u in c)if(f=c[u],f.Na=f.oa,b)for(g=0;!a.wc&&g<d.length&&f.Na;g++)a.currentTarget=d[g],e&=fc(f,d[g],a.type,u,a)&&a.xe!=u;else for(d=this;!a.wc&&
d&&f.Na;d=d.Lf)a.currentTarget=d,e&=fc(f,d,a.type,u,a)&&a.xe!=u;a=Boolean(e)}else a=q;return a};function M(){jc.call(this);this.f="base";this.qa=window["X.counter"].qk();this.j=u}C(M,jc);M.prototype.__defineGetter__("classname",v("f"));M.prototype.__defineGetter__("id",v("qa"));A("X.base",M);function kc(a,b){this.Wa=new ya(a);this.va=new ya(b)}kc.prototype={l:function(){return new kc(this.Wa.l(),this.va.l())},uc:function(){this.va=Ea(this.va)}};function lc(a,b){this.va=a;this.Pd=b}lc.prototype={l:function(){return new lc(this.va.l(),this.Pd)},uc:function(){this.va=Ea(this.va);this.Pd=-this.Pd}};function mc(a,b){this.Lb=a;this.De=b;var c=a[0].Wa,e=a[2].Wa,e=Da(Ca(a[1].Wa,c).sc(Ca(e,c)));this.Va=new lc(e,e.ac(c))}mc.prototype={l:function(){var a=this.Lb.map(function(a){return a.l()});return new mc(a,this.De)},uc:function(){this.Lb.reverse().map(function(a){a.uc()});this.Va.uc()}};
function nc(a,b,c,e,d,f){for(var g=0,h=[],l=0;l<a.Lb.length;l++){var j=b.va.ac(a.Lb[l].Wa)-b.Pd,j=-1E-5>j?2:1E-5<j?1:0,g=g|j;h.push(j)}switch(g){case 0:(0<b.va.ac(a.Va.va)?c:e).push(a);break;case 1:d.push(a);break;case 2:f.push(a);break;case 3:c=[];e=[];for(l=0;l<a.Lb.length;l++){var k=(l+1)%a.Lb.length,j=h[l],n=h[k],g=a.Lb[l],k=a.Lb[k];2!=j&&c.push(g);1!=j&&e.push(2!=j?g.l():g);3==(j|n)&&(j=(b.Pd-b.va.ac(g.Wa))/b.va.ac(Ca(k.Wa,g.Wa)),j=new kc(g.Wa.se(k.Wa,j),g.va.se(k.va,j)),c.push(j),e.push(j.l()))}3<=
c.length&&d.push(new mc(c,a.De));3<=e.length&&f.push(new mc(e,a.De))}};function oc(a){this.Aa=this.Ba=this.Va=t;this.Z=[];a&&pc(this,a)}oc.prototype={l:function(){var a=new oc,b=this.Va&&this.Va.l();a.Va=b;b=this.Ba&&this.Ba.l();a.Ba=b;b=this.Aa&&this.Aa.l();a.Aa=b;a.Ce(this.Z.map(function(a){return a.l()}));return a},Y:function(){for(var a=0;a<this.Z.length;a++)this.Z[a].uc();this.Va.uc();this.Ba&&this.Ba.Y();this.Aa&&this.Aa.Y();a=this.Ba;this.Ba=this.Aa;this.Aa=a},Ce:ca("Z")};
function pc(a,b){if(b.length){a.Va||(a.Va=b[0].Va.l());for(var c=[],e=[],d=0;d<b.length;d++)nc(b[d],a.Va,a.Z,a.Z,c,e);c.length&&(a.Ba||(a.Ba=new oc),pc(a.Ba,c));e.length&&(a.Aa||(a.Aa=new oc),pc(a.Aa,e))}}function qc(a){var b=a.Z.slice();a.Ba&&(b=b.concat(qc(a.Ba)));a.Aa&&(b=b.concat(qc(a.Aa)));return b}function rc(a,b){a.Z=sc(b,a.Z);a.Ba&&rc(a.Ba,b);a.Aa&&rc(a.Aa,b)}
function sc(a,b){if(!a.Va)return b.slice();for(var c=[],e=[],d=0;d<b.length;d++)nc(b[d],a.Va,c,e,c,e);a.Ba&&(c=sc(a.Ba,c));e=a.Aa?sc(a.Aa,e):[];return c.concat(e)};function tc(){this.Z=[]}function uc(a){var b=new tc;b.Ce(a);return b}
tc.prototype={l:function(){var a=new tc;a.Ce(this.Z.map(function(a){return a.l()}));return a},Xf:function(a){var b=new oc(this.l().Z);a=new oc(a.l().Z);rc(b,a);rc(a,b);a.Y();rc(a,b);a.Y();pc(b,qc(a));return uc(qc(b))},wa:function(a){var b=new oc(this.l().Z);a=new oc(a.l().Z);b.Y();rc(b,a);rc(a,b);a.Y();rc(a,b);a.Y();pc(b,qc(a));b.Y();return uc(qc(b))},vf:function(a){var b=new oc(this.l().Z);a=new oc(a.l().Z);b.Y();rc(a,b);a.Y();rc(b,a);rc(a,b);pc(b,qc(a));b.Y();return uc(qc(b))},inverse:function(){var a=
this.l();a.Z.map(function(a){a.uc()});return a},Ce:ca("Z")};function vc(){M.call(this);this.f="indexer";this.bf=[];this.pl=[];this.Ka={}}C(vc,M);vc.prototype.add=function(a){a==t&&m(Error("Invalid object."));var b=window.JSON.stringify(a);b in this.Ka||(this.Ka[b]=this.bf.length,this.bf.push(a));return this.Ka[b]};vc.prototype.unique=v("bf");function wc(a){M.call(this);this.f="file";this.$d=a;this.j=q}C(wc,M);function xc(){this.$a=this.r=t}xc.prototype.__defineSetter__("file",function(a){if(a==t||la(a)&&0==a.length)this.r=t;else{if(la(a)){if(1==a.length){this.r=new wc(a[0]);return}this.r=Lb(a,function(a){var c=new P;c.r=new wc(a);return c})}else this.r=new wc(a);this.$a=t}});xc.prototype.__defineGetter__("file",function(){return!this.r?"":la(this.r)?this.r.map(function(a){return a.r.$d}):this.r.$d});
xc.prototype.__defineGetter__("filedata",function(){return la(this.r)?this.r.map(function(a){return a.$a}):this.$a});xc.prototype.__defineSetter__("filedata",function(a){if(a==t||la(a)&&0==a.length)this.$a=t;if(la(a))if(1==a.length)this.$a=a[0];else{var b=this.r.length,c;for(c=0;c<b;c++)this.r[c].$a=a[c]}else this.$a=a});function yc(a){if("function"==typeof a.Dd)return a.Dd();if(na(a))return a.split("");if(ma(a)){for(var b=[],c=a.length,e=0;e<c;e++)b.push(a[e]);return b}return Oa(a)};function zc(a,b){this.ga={};this.S=[];var c=arguments.length;if(1<c){c%2&&m(Error("Uneven number of arguments"));for(var e=0;e<c;e+=2)this.set(arguments[e],arguments[e+1])}else a&&this.df(a)}w=zc.prototype;w.oa=0;w.Zf=0;w.sf=v("oa");w.Dd=function(){Ac(this);for(var a=[],b=0;b<this.S.length;b++)a.push(this.ga[this.S[b]]);return a};function Bc(a){for(var b=0;b<a.S.length;b++){var c=a.S[b];if(Cc(a.ga,c)&&a.ga[c]==u)return q}return u}w.clear=function(){this.ga={};this.Zf=this.oa=this.S.length=0};
w.remove=function(a){return Cc(this.ga,a)?(delete this.ga[a],this.oa--,this.Zf++,this.S.length>2*this.oa&&Ac(this),q):u};function Ac(a){if(a.oa!=a.S.length){for(var b=0,c=0;b<a.S.length;){var e=a.S[b];Cc(a.ga,e)&&(a.S[c++]=e);b++}a.S.length=c}if(a.oa!=a.S.length){for(var d={},c=b=0;b<a.S.length;)e=a.S[b],Cc(d,e)||(a.S[c++]=e,d[e]=1),b++;a.S.length=c}}w.get=function(a,b){return Cc(this.ga,a)?this.ga[a]:b};w.set=function(a,b){Cc(this.ga,a)||(this.oa++,this.S.push(a),this.Zf++);this.ga[a]=b};
w.df=function(a){var b;if(a instanceof zc)Ac(a),b=a.S.concat(),a=a.Dd();else{b=[];var c=0,e;for(e in a)b[c++]=e;a=Oa(a)}for(c=0;c<b.length;c++)this.set(b[c],a[c])};w.l=function(){return new zc(this)};w.Wf=function(){for(var a=new zc,b=0;b<this.S.length;b++){var c=this.S[b];a.set(this.ga[c],c)}return a};function Cc(a,b){return Object.prototype.hasOwnProperty.call(a,b)};function Dc(){M.call(this);this.f="colortable";this.Ka=new zc;Fa(this,new xc)}C(Dc,M);Dc.prototype.add=function(a,b,c,e,d,f){(!x(a)||!x(c)||!x(e)||!x(d)||!x(f))&&m(Error("Invalid color table entry."));this.Ka.set(a,[b,c,e,d,f]);this.j=q};Dc.prototype.get=function(a){return this.Ka.get(a)};A("X.colortable.prototype.get",Dc.prototype.get);function Ec(a,b,c){this.x=ia(a)?a:0;this.y=ia(b)?b:0;this.d=ia(c)?c:0}Ec.prototype.l=function(){return new Ec(this.x,this.y,this.d)};function R(a,b,c){this.x=a;this.y=b;this.d=c}C(R,Ec);w=R.prototype;w.l=function(){return new R(this.x,this.y,this.d)};w.Ib=function(){return Math.sqrt(this.x*this.x+this.y*this.y+this.d*this.d)};w.scale=function(a){this.x*=a;this.y*=a;this.d*=a;return this};w.Y=function(){this.x=-this.x;this.y=-this.y;this.d=-this.d;return this};w.normalize=function(){return this.scale(1/this.Ib())};w.add=function(a){this.x+=a.x;this.y+=a.y;this.d+=a.d;return this};
w.wa=function(a){this.x-=a.x;this.y-=a.y;this.d-=a.d;return this};function Fc(a,b){var c=a.x-b.x,e=a.y-b.y,d=a.d-b.d;return Math.sqrt(c*c+e*e+d*d)}function Gc(a,b){var c=a.x-b.x,e=a.y-b.y,d=a.d-b.d;return c*c+e*e+d*d}function Hc(a,b){return new R(a.x+b.x,a.y+b.y,a.d+b.d)}function Ic(a,b){return new R(a.y*b.d-a.d*b.y,a.d*b.x-a.x*b.d,a.x*b.y-a.y*b.x)};D.m=R;w=D.m.prototype;w.l=R.prototype.l;w.Ib=R.prototype.Ib;w.scale=R.prototype.scale;w.Y=R.prototype.Y;w.add=R.prototype.add;w.wa=R.prototype.wa;w.normalize=function(){var a=this.Ib();return 0==a?this.scale(0):this.scale(1/a)};D.m.ac=function(a,b){return a.x*b.x+a.y*b.y+a.d*b.d};D.m.sc=Ic;D.m.rf=Fc;D.m.se=function(a,b,c){return new R(a.x+c*(b.x-a.x),a.y+c*(b.y-a.y),a.d+c*(b.d-a.d))};D.m.prototype.__defineGetter__("xx",v("x"));D.m.prototype.__defineGetter__("yy",v("y"));
D.m.prototype.__defineGetter__("zz",v("d"));A("X.vector",D.m);A("X.vector.prototype.clone",D.m.prototype.l);A("X.vector.prototype.magnitude",D.m.prototype.Ib);A("X.vector.prototype.scale",D.m.prototype.scale);A("X.vector.prototype.invert",D.m.prototype.Y);A("X.vector.prototype.normalize",D.m.prototype.normalize);A("X.vector.prototype.add",D.m.prototype.add);A("X.vector.prototype.subtract",D.m.prototype.wa);A("X.vector.dot",D.m.ac);A("X.vector.cross",D.m.sc);A("X.vector.distance",D.m.rf);
A("X.vector.lerp",D.m.se);function Jc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}Jc.prototype.BYTES_PER_ELEMENT=8;Jc.prototype.set=function(a,b){b=b||0;for(var c=0;c<a.length&&b+c<this.length;c++)this[b+c]=a[c]};Jc.prototype.toString=Array.prototype.join;if("undefined"==typeof Float64Array){try{Jc.BYTES_PER_ELEMENT=8}catch(Kc){}Jc.prototype.BYTES_PER_ELEMENT=Jc.prototype.BYTES_PER_ELEMENT;Jc.prototype.set=Jc.prototype.set;Jc.prototype.toString=Jc.prototype.toString;A("Float64Array",Jc)};function Lc(a){this.length=a.length||a;for(var b=0;b<this.length;b++)this[b]=a[b]||0}Lc.prototype.BYTES_PER_ELEMENT=4;Lc.prototype.set=function(a,b){b=b||0;for(var c=0;c<a.length&&b+c<this.length;c++)this[b+c]=a[c]};Lc.prototype.toString=Array.prototype.join;"undefined"==typeof Float32Array&&(Lc.BYTES_PER_ELEMENT=4,Lc.prototype.BYTES_PER_ELEMENT=Lc.prototype.BYTES_PER_ELEMENT,Lc.prototype.set=Lc.prototype.set,Lc.prototype.toString=Lc.prototype.toString,A("Float32Array",Lc));function Mc(){return new Float32Array(3)}function Nc(a,b,c){var e=Mc();e[0]=a;e[1]=b;e[2]=c;return e}function Oc(a,b){var c=a[0],e=a[1],d=a[2],c=1/Math.sqrt(c*c+e*e+d*d);b[0]=a[0]*c;b[1]=a[1]*c;b[2]=a[2]*c};function Pc(){return new Float32Array(4)}function Qc(a,b,c,e){var d=Pc();d[0]=a;d[1]=b;d[2]=c;d[3]=e;return d};function Rc(){return new Float32Array(16)}function Sc(){var a=Rc();a[0]=a[5]=a[10]=a[15]=1;return a}function Tc(a,b,c,e,d,f,g,h,l,j,k,n,s,r,y,z,F){a[0]=b;a[1]=c;a[2]=e;a[3]=d;a[4]=f;a[5]=g;a[6]=h;a[7]=l;a[8]=j;a[9]=k;a[10]=n;a[11]=s;a[12]=r;a[13]=y;a[14]=z;a[15]=F;return a}function Uc(a,b,c,e,d){a[12]=b;a[13]=c;a[14]=e;a[15]=d;return a}function Vc(a,b,c){b*=4;a[b]=c[0];a[b+1]=c[1];a[b+2]=c[2];a[b+3]=c[3]}function Wc(a,b,c){b*=4;c[0]=a[b];c[1]=a[b+1];c[2]=a[b+2];c[3]=a[b+3]}
function T(a,b,c,e,d,f){a[b]=c;a[b+4]=e;a[b+8]=d;a[b+12]=f}function Xc(a,b,c){a[b]=c[0];a[b+4]=c[1];a[b+8]=c[2];a[b+12]=c[3]}function Yc(a,b,c){c[0]=a[b];c[1]=a[b+4];c[2]=a[b+8];c[3]=a[b+12]}
function $c(a,b,c){var e=a[0],d=a[1],f=a[2],g=a[3],h=a[4],l=a[5],j=a[6],k=a[7],n=a[8],s=a[9],r=a[10],y=a[11],z=a[12],F=a[13],G=a[14];a=a[15];var H=b[0],B=b[1],E=b[2],I=b[3],N=b[4],Q=b[5],O=b[6],S=b[7],da=b[8],J=b[9],ba=b[10],ka=b[11],U=b[12],V=b[13],Ga=b[14];b=b[15];c[0]=e*H+h*B+n*E+z*I;c[1]=d*H+l*B+s*E+F*I;c[2]=f*H+j*B+r*E+G*I;c[3]=g*H+k*B+y*E+a*I;c[4]=e*N+h*Q+n*O+z*S;c[5]=d*N+l*Q+s*O+F*S;c[6]=f*N+j*Q+r*O+G*S;c[7]=g*N+k*Q+y*O+a*S;c[8]=e*da+h*J+n*ba+z*ka;c[9]=d*da+l*J+s*ba+F*ka;c[10]=f*da+j*J+r*ba+
G*ka;c[11]=g*da+k*J+y*ba+a*ka;c[12]=e*U+h*V+n*Ga+z*b;c[13]=d*U+l*V+s*Ga+F*b;c[14]=f*U+j*V+r*Ga+G*b;c[15]=g*U+k*V+y*Ga+a*b;return c}
function ad(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[4],h=a[5],l=a[6],j=a[7],k=a[8],n=a[9],s=a[10],r=a[11],y=a[12],z=a[13],F=a[14],G=a[15],H=c*h-e*g,B=c*l-d*g,E=c*j-f*g,I=e*l-d*h,N=e*j-f*h,Q=d*j-f*l,O=k*z-n*y,S=k*F-s*y,da=k*G-r*y,J=n*F-s*z,ba=n*G-r*z,ka=s*G-r*F,U=H*ka-B*ba+E*J+I*da-N*S+Q*O;if(0==U)return u;U=1/U;b[0]=(h*ka-l*ba+j*J)*U;b[1]=(-e*ka+d*ba-f*J)*U;b[2]=(z*Q-F*N+G*I)*U;b[3]=(-n*Q+s*N-r*I)*U;b[4]=(-g*ka+l*da-j*S)*U;b[5]=(c*ka-d*da+f*S)*U;b[6]=(-y*Q+F*E-G*B)*U;b[7]=(k*Q-s*E+r*B)*U;b[8]=(g*
ba-h*da+j*O)*U;b[9]=(-c*ba+e*da-f*O)*U;b[10]=(y*N-z*E+G*H)*U;b[11]=(-k*N+n*E-r*H)*U;b[12]=(-g*J+h*S-l*O)*U;b[13]=(c*J-e*S+d*O)*U;b[14]=(-y*I+z*B-F*H)*U;b[15]=(k*I-n*B+s*H)*U;return q}function bd(a,b,c){var e=b[0],d=b[1];b=b[2];c[0]=e*a[0]+d*a[4]+b*a[8]+a[12];c[1]=e*a[1]+d*a[5]+b*a[9]+a[13];c[2]=e*a[2]+d*a[6]+b*a[10]+a[14]}
function cd(a,b,c){var e=b[0],d=b[1],f=b[2];b=b[3];c[0]=e*a[0]+d*a[4]+f*a[8]+b*a[12];c[1]=e*a[1]+d*a[5]+f*a[9]+b*a[13];c[2]=e*a[2]+d*a[6]+f*a[10]+b*a[14];c[3]=e*a[3]+d*a[7]+f*a[11]+b*a[15];return c}function dd(a,b,c,e){return Uc(a,a[0]*b+a[4]*c+a[8]*e+a[12],a[1]*b+a[5]*c+a[9]*e+a[13],a[2]*b+a[6]*c+a[10]*e+a[14],a[3]*b+a[7]*c+a[11]*e+a[15])}new Float64Array(3);new Float64Array(3);new Float64Array(4);new Float64Array(4);new Float64Array(4);new Float64Array(16);D.g={};D.g.Xg=function(a,b,c,e){c=c.wa(b);c.normalize();e=D.m.sc(c,e);e.normalize();var d=D.m.sc(e,c);d.normalize();c.Y();T(a,0,e.x,e.y,e.d,0);T(a,1,d.x,d.y,d.d,0);T(a,2,c.x,c.y,c.d,0);dd(a,-b.x,-b.y,-b.d);return a};D.g.ba=function(a,b,c,e){var d=1/(b*a[3]+c*a[7]+e*a[11]+a[15]);return new D.m((b*a[0]+c*a[4]+e*a[8]+a[12])*d,(b*a[1]+c*a[5]+e*a[9]+a[13])*d,(b*a[2]+c*a[6]+e*a[10]+a[14])*d)};
D.g.nk=function(a,b,c){var e=new Float32Array(4),d=new Float32Array(4);Yc(a,b,e);Yc(a,c,d);Xc(a,b,d);Xc(a,c,e);return a};D.g.mk=function(a,b,c){var e=new Float32Array(4),d=new Float32Array(4);Wc(a,b,e);Wc(a,c,d);Vc(a,b,d);Vc(a,c,e);return a};D.g.Ed=Sc;D.g.l=function(a){var b=Rc();b[0]=a[0];b[1]=a[1];b[2]=a[2];b[3]=a[3];b[4]=a[4];b[5]=a[5];b[6]=a[6];b[7]=a[7];b[8]=a[8];b[9]=a[9];b[10]=a[10];b[11]=a[11];b[12]=a[12];b[13]=a[13];b[14]=a[14];b[15]=a[15];return b};
D.g.Wf=function(a,b){if(b==a){var c=a[1],e=a[2],d=a[3],f=a[6],g=a[7],h=a[11];b[1]=a[4];b[2]=a[8];b[3]=a[12];b[4]=c;b[6]=a[9];b[7]=a[13];b[8]=e;b[9]=f;b[11]=a[14];b[12]=d;b[13]=g;b[14]=h}else b[0]=a[0],b[1]=a[4],b[2]=a[8],b[3]=a[12],b[4]=a[1],b[5]=a[5],b[6]=a[9],b[7]=a[13],b[8]=a[2],b[9]=a[6],b[10]=a[10],b[11]=a[14],b[12]=a[3],b[13]=a[7],b[14]=a[11],b[15]=a[15];return b};
D.g.ti=function(a){var b=a[0],c=a[1],e=a[2],d=a[3],f=a[4],g=a[5],h=a[6],l=a[7],j=a[8],k=a[9],n=a[10],s=a[11],r=a[12],y=a[13],z=a[14];a=a[15];return(b*g-c*f)*(n*a-s*z)-(b*h-e*f)*(k*a-s*y)+(b*l-d*f)*(k*z-n*y)+(c*h-e*g)*(j*a-s*r)-(c*l-d*g)*(j*z-n*r)+(e*l-d*h)*(j*y-k*r)};D.g.Y=ad;D.g.yf=function(a,b,c,e,d){var f=b/2;b=d-e;var g=Math.sin(f);if(0==b||0==g||0==c)return a;f=Math.cos(f)/g;return Tc(a,f/c,0,0,0,0,f,0,0,0,0,-(d+e)/b,-1,0,0,-(2*e*d)/b,0)};
D.g.dj=function(a,b,c,e,d,f,g){return Tc(a,2*f/(c-b),0,0,0,0,2*f/(d-e),0,0,(c+b)/(c-b),(d+e)/(d-e),-(g+f)/(g-f),-1,0,0,-(2*g*f)/(g-f),0)};D.g.ej=function(a,b,c,e,d,f,g){return Tc(a,2/(c-b),0,0,0,0,2/(d-e),0,0,0,0,-2/(g-f),0,-(c+b)/(c-b),-(d+e)/(d-e),-(g+f)/(g-f),1)};D.g.multiply=$c;D.g.ah=cd;D.g.translate=dd;D.g.scale=function(a,b,c,e){return Tc(a,a[0]*b,a[1]*b,a[2]*b,a[3]*b,a[4]*c,a[5]*c,a[6]*c,a[7]*c,a[8]*e,a[9]*e,a[10]*e,a[11]*e,a[12],a[13],a[14],a[15])};
D.g.rotate=function(a,b,c,e,d){var f=a[0],g=a[1],h=a[2],l=a[3],j=a[4],k=a[5],n=a[6],s=a[7],r=a[8],y=a[9],z=a[10],F=a[11],G=Math.cos(b),H=Math.sin(b),B=1-G;b=c*c*B+G;var E=c*e*B+d*H,I=c*d*B-e*H,N=c*e*B-d*H,Q=e*e*B+G,O=e*d*B+c*H,S=c*d*B+e*H;c=e*d*B-c*H;d=d*d*B+G;return Tc(a,f*b+j*E+r*I,g*b+k*E+y*I,h*b+n*E+z*I,l*b+s*E+F*I,f*N+j*Q+r*O,g*N+k*Q+y*O,h*N+n*Q+z*O,l*N+s*Q+F*O,f*S+j*c+r*d,g*S+k*c+y*d,h*S+n*c+z*d,l*S+s*c+F*d,a[12],a[13],a[14],a[15])};
D.g.ye=function(a,b){var c=a[4],e=a[5],d=a[6],f=a[7],g=a[8],h=a[9],l=a[10],j=a[11],k=Math.cos(b),n=Math.sin(b);a[4]=c*k+g*n;a[5]=e*k+h*n;a[6]=d*k+l*n;a[7]=f*k+j*n;a[8]=c*-n+g*k;a[9]=e*-n+h*k;a[10]=d*-n+l*k;a[11]=f*-n+j*k;return a};D.g.ze=function(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[8],h=a[9],l=a[10],j=a[11],k=Math.cos(b),n=Math.sin(b);a[0]=c*k+g*-n;a[1]=e*k+h*-n;a[2]=d*k+l*-n;a[3]=f*k+j*-n;a[8]=c*n+g*k;a[9]=e*n+h*k;a[10]=d*n+l*k;a[11]=f*n+j*k;return a};
D.g.Ae=function(a,b){var c=a[0],e=a[1],d=a[2],f=a[3],g=a[4],h=a[5],l=a[6],j=a[7],k=Math.cos(b),n=Math.sin(b);a[0]=c*k+g*n;a[1]=e*k+h*n;a[2]=d*k+l*n;a[3]=f*k+j*n;a[4]=c*-n+g*k;a[5]=e*-n+h*k;a[6]=d*-n+l*k;a[7]=f*-n+j*k;return a};A("X.matrix.identity",D.g.Ed);A("X.matrix.clone",D.g.l);A("X.matrix.transpose",D.g.Wf);A("X.matrix.determinant",D.g.ti);A("X.matrix.invert",D.g.Y);A("X.matrix.multiply",D.g.multiply);A("X.matrix.multiplyByVector",D.g.ba);A("X.matrix.multiplyByVec4",D.g.ah);
A("X.matrix.makePerspective",D.g.yf);A("X.matrix.makeFrustum",D.g.dj);A("X.matrix.makeOrtho",D.g.ej);A("X.matrix.makeLookAt",D.g.Xg);A("X.matrix.translate",D.g.translate);A("X.matrix.scale",D.g.scale);A("X.matrix.rotate",D.g.rotate);A("X.matrix.rotateX",D.g.ye);A("X.matrix.rotateY",D.g.ze);A("X.matrix.rotateZ",D.g.Ae);A("X.matrix.swapRows",D.g.nk);A("X.matrix.swapCols",D.g.mk);function ed(){M.call(this);this.f="transform";this.Q=D.g.Ed()}C(ed,M);ed.prototype.__defineGetter__("matrix",v("Q"));ed.prototype.__defineSetter__("matrix",function(a){(a==t||!(a instanceof Float32Array))&&m(Error("Invalid matrix."));this.Q=a;this.q()});w=ed.prototype;w.ye=function(a){(!x(a)||-360>a||360<a)&&m(Error("Invalid angle."));D.g.ye(this.Q,a*Math.PI/180);this.q()};w.ze=function(a){(!x(a)||-360>a||360<a)&&m(Error("Invalid angle."));D.g.ze(this.Q,a*Math.PI/180);this.q()};
w.Ae=function(a){(!x(a)||-360>a||360<a)&&m(Error("Invalid angle."));D.g.Ae(this.Q,a*Math.PI/180);this.q()};w.Dh=function(a){x(a)||m(Error("Invalid distance."));D.g.translate(this.Q,a,0,0);this.q()};w.Eh=function(a){x(a)||m(Error("Invalid distance."));D.g.translate(this.Q,0,a,0);this.q()};w.Fh=function(a){x(a)||m(Error("Invalid distance."));D.g.translate(this.Q,0,0,a);this.q()};function fd(a,b,c){a.Q[b+4*c]*=-1;a.q()}w.Bi=function(){fd(this,0,0)};w.Ci=function(){fd(this,1,1)};
w.Di=function(){fd(this,2,2)};w.q=function(){this.j=q};A("X.transform",ed);A("X.transform.prototype.rotateX",ed.prototype.ye);A("X.transform.prototype.rotateY",ed.prototype.ze);A("X.transform.prototype.rotateZ",ed.prototype.Ae);A("X.transform.prototype.translateX",ed.prototype.Dh);A("X.transform.prototype.translateY",ed.prototype.Eh);A("X.transform.prototype.translateZ",ed.prototype.Fh);A("X.transform.prototype.flipX",ed.prototype.Bi);A("X.transform.prototype.flipY",ed.prototype.Ci);
A("X.transform.prototype.flipZ",ed.prototype.Di);A("X.transform.prototype.modified",ed.prototype.q);function gd(){M.call(this);this.f="texture";this.Wb=this.ib=this.r=t;this.We=this.Xe=0;this.hg=u;Fa(this,new xc)}C(gd,M);gd.prototype.__defineSetter__("rawData",function(a){this.Wb=a;this.j=q});gd.prototype.__defineSetter__("rawDataHeight",function(a){this.We=a;this.j=q});gd.prototype.__defineSetter__("rawDataWidth",function(a){this.Xe=a;this.j=q});gd.prototype.__defineSetter__("grayscale",function(a){this.hg=a;this.j=q});A("X.texture",gd);function W(a,b){M.call(this);this.f="triplets";this.mb=Infinity;this.jb=-Infinity;this.nb=Infinity;this.kb=-Infinity;this.ob=Infinity;this.lb=-Infinity;this.Rd=[0,0,0];this.gg=q;this.C=0;this.da=new Float32Array(a);b!=t&&(this.da=b.da.subarray(0,b.da.length),this.C=this.da.length,this.mb=b.mb,this.jb=b.jb,this.nb=b.nb,this.kb=b.kb,this.ob=b.ob,this.lb=b.lb,this.Rd=b.Rd.slice(),this.gg=u)}C(W,M);w=W.prototype;
w.add=function(a,b,c){this.mb=Math.min(this.mb,a);this.jb=Math.max(this.jb,a);this.nb=Math.min(this.nb,b);this.kb=Math.max(this.kb,b);this.ob=Math.min(this.ob,c);this.lb=Math.max(this.lb,c);this.Rd=[(this.mb+this.jb)/2,(this.nb+this.kb)/2,(this.ob+this.lb)/2];this.gg=u;this.j=q;this.da[this.C++]=a;this.da[this.C++]=b;this.da[this.C++]=c;return this.C/3};w.Jb=function(){if(this.C!=this.da.length){var a=new Float32Array(this.C);a.set(this.da.subarray(0,this.C));this.da=a}};
w.get=function(a){a*=3;return[this.da[a],this.da[a+1],this.da[a+2]]};w.remove=function(){m(Error("Not implemented."))};w.clear=function(){this.da=new Float32Array(this.da.length);this.j=q};W.prototype.__defineGetter__("count",function(){this.Jb();return this.da.length/3});W.prototype.__defineGetter__("length",function(){this.Jb();return this.da.length});A("X.triplets",W);A("X.triplets.prototype.add",W.prototype.add);A("X.triplets.prototype.resize",W.prototype.Jb);A("X.triplets.prototype.get",W.prototype.get);
A("X.triplets.prototype.remove",W.prototype.remove);A("X.triplets.prototype.clear",W.prototype.clear);function hd(){this.Ia=id;this.ja=new ed;this.w=[1,1,1];this.nc=this.G=this.pa=this.n=this.h=t;this.Nc=[];this.O=q;this.Lc=this.sd=1;this.Dc=t;this.jd=u;this.za=1;this.ya=0;this.rd=q}var id="TRIANGLES";hd.prototype.__defineSetter__("type",function(a){return this.Ia=a});hd.prototype.__defineGetter__("type",v("Ia"));hd.prototype.__defineGetter__("texture",function(){this.G||(this.G=new gd);return this.G});hd.prototype.__defineGetter__("transform",v("ja"));hd.prototype.__defineGetter__("points",v("h"));
hd.prototype.__defineSetter__("points",ca("h"));hd.prototype.__defineGetter__("normals",v("n"));hd.prototype.__defineSetter__("normals",ca("n"));hd.prototype.__defineGetter__("colors",v("pa"));hd.prototype.__defineSetter__("colors",ca("pa"));hd.prototype.__defineGetter__("color",v("w"));hd.prototype.__defineSetter__("color",function(a){(a==t||!la(a)||3!=a.length)&&m(Error("Invalid color."));for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e].color=a;this.w=a;this.j=q});
hd.prototype.__defineGetter__("opacity",v("za"));hd.prototype.__defineSetter__("opacity",function(a){(!x(a)||1<a||0>a)&&m(Error("Invalid opacity."));for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e]!=t&&(b[e].opacity=a);this.za=a;this.j=q});hd.prototype.__defineGetter__("caption",v("Dc"));hd.prototype.__defineSetter__("caption",function(a){this.Dc=a;this.j=q});hd.prototype.__defineGetter__("visible",v("O"));
hd.prototype.__defineSetter__("visible",function(a){for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e]!=t&&(b[e].visible=a);this.O=a;this.j=q});hd.prototype.__defineGetter__("pointsize",v("sd"));hd.prototype.__defineSetter__("pointsize",function(a){x(a)||m(Error("Invalid point size."));this.sd=a;this.j=q});hd.prototype.__defineGetter__("magicmode",v("jd"));hd.prototype.__defineSetter__("magicmode",function(a){"boolean"!=typeof a&&m(Error("Invalid magic mode setting."));this.jd=a;this.j=q});
hd.prototype.__defineGetter__("linewidth",v("Lc"));hd.prototype.__defineSetter__("linewidth",function(a){x(a)||m(Error("Invalid line width."));this.Lc=a;this.j=q});hd.prototype.__defineGetter__("pickable",v("rd"));hd.prototype.__defineSetter__("pickable",function(a){"boolean"!=typeof a&&m(Error("Invalid pickable setting."));this.rd=a;this.j=q});hd.prototype.__defineGetter__("textureCoordinateMap",v("nc"));hd.prototype.__defineSetter__("textureCoordinateMap",ca("sl"));function jd(){this.ra=Infinity;this.U=this.ia=-Infinity;this.W=Infinity;this.Rb=[0,0,0];this.Pb=[1,1,1]}jd.prototype.__defineGetter__("lowerThreshold",v("U"));jd.prototype.__defineSetter__("lowerThreshold",ca("U"));jd.prototype.__defineGetter__("upperThreshold",v("W"));jd.prototype.__defineSetter__("upperThreshold",ca("W"));jd.prototype.__defineGetter__("min",v("ra"));jd.prototype.__defineGetter__("max",v("ia"));jd.prototype.__defineGetter__("minColor",v("Rb"));
jd.prototype.__defineSetter__("minColor",function(a){(a==t||!la(a)||3!=a.length)&&m(Error("Invalid min. color."));this.Rb=a});jd.prototype.__defineGetter__("maxColor",v("Pb"));jd.prototype.__defineSetter__("maxColor",function(a){(a==t||!la(a)||3!=a.length)&&m(Error("Invalid max. color."));this.Pb=a});function kd(){M.call(this);this.f="scalars";this.dd=this.I=t;this.ug=q;this.Le=0;Fa(this,new xc);Fa(this,new jd);this.Rb=[0,1,0];this.Pb=[1,0,0]}C(kd,M);kd.prototype.__defineGetter__("array",v("I"));kd.prototype.__defineSetter__("array",function(a){this.dd=this.I=a;this.j=q});kd.prototype.__defineGetter__("interpolation",v("Le"));kd.prototype.__defineSetter__("interpolation",ca("Le"));A("X.scalars",kd);function Y(a){M.call(this);this.f="object";this.c=[];this.F=this.xa=t;Fa(this,new hd);a!=t&&this.rc(a)}C(Y,M);
Y.prototype.rc=function(a){this.Ia=a.Ia;this.ja=new ed;this.ja.Q=new Float32Array(a.ja.Q);this.w=a.w.slice();a.h&&(this.h=new W(a.h.length,a.h));a.n&&(this.n=new W(a.n.length,a.n));a.pa&&(this.pa=new W(a.pa.length,a.pa));this.G=a.G;this.nc=a.nc;a.r&&(this.r=new wc((new String(a.r.$d)).toString()));this.za=a.za;this.c.length=0;var b=a.c;if(b)for(var c=b.length,e=0,e=0;e<c;e++)this.c.push(new D[b[e].f](b[e]));this.O=a.O;this.sd=a.sd;this.Lc=a.Lc;a.Dc&&(this.Dc=(new String(a.Dc)).toString());this.jd=
a.jd;this.rd=a.rd;this.Nc=a.Nc.slice();this.j=q};Y.prototype.__defineGetter__("colortable",function(){this.xa||(this.xa=new Dc);return this.xa});Y.prototype.__defineGetter__("scalars",function(){this.F||(this.F=new kd);return this.F});Y.prototype.__defineGetter__("children",v("c"));Y.prototype.q=function(){var a=new ld;a.D=this;this.dispatchEvent(a)};Y.prototype.remove=function(){var a=new md;a.D=this;this.dispatchEvent(a)};
Y.prototype.Ta=function(){dc(this);if(0<this.c.length)for(var a=this.c,b=a.length,c=0,c=0;c<b;c++)"undefined"!=typeof a[c]&&this.c[c].Ta();this.c.length=0;this.F=this.xa=t};function nd(a,b){(a==t||b==t||!(a instanceof Y)||!(b instanceof Y))&&m(Error("Fatal: Two valid X.objects are required for comparison."));return 1==a.za?-1:1==b.za?1:a.ya!=t&&b.ya!=t&&a.ya>b.ya?-1:1}A("X.object",Y);A("X.object.prototype.modified",Y.prototype.q);A("X.object.prototype.remove",Y.prototype.remove);
A("X.object.prototype.destroy",Y.prototype.Ta);function od(){}function pd(a){for(var b=a.h.count,c=[],e=0,e=0;e<b;e+=3){var d=a.h.get(e),f=a.h.get(e+1),g=a.h.get(e+2),h=a.n.get(e),l=a.n.get(e+1),j=a.n.get(e+2),k=a.w;a.pa&&0<a.pa.length&&(k=a.pa.get(e));var n=[];n.push(new kc(d,h));n.push(new kc(f,l));n.push(new kc(g,j));c.push(new mc(n,k))}return uc(c)}
function qd(a,b){(b==t||!(b instanceof tc))&&m(Error("Invalid CSG object."));var c=new vc,e=[];Lb(b.Z,function(a){var b=[],g=a.De,b=Lb(a.Lb,function(a){a.color=g;return c.add(a)});for(a=a=2;a<b.length;a++)e.push([b[0],b[a-1],b[a]])}.bind(a));a.Vh=Lb(c.unique(),function(a){return[a.Wa.x(),a.Wa.y(),a.Wa.d()]});a.Uh=Lb(c.unique(),function(a){return[a.va.x(),a.va.y(),a.va.d()]});a.Th=Lb(c.unique(),function(a){return!a.color?t:[a.color[0],a.color[1],a.color[2]]});a.h=new W(9*e.length);a.n=new W(9*e.length);
a.pa=new W(9*e.length);Lb(e,function(a){var b=a[0],c=a[1];a=a[2];var e=this.Vh,l=this.Uh,j=this.Th;this.h.add(e[b][0],e[b][1],e[b][2]);this.h.add(e[c][0],e[c][1],e[c][2]);this.h.add(e[a][0],e[a][1],e[a][2]);this.n.add(l[b][0],l[b][1],l[b][2]);this.n.add(l[c][0],l[c][1],l[c][2]);this.n.add(l[a][0],l[a][1],l[a][2]);j[b]&&this.pa.add(j[b][0],j[b][1],j[b][2]);j[c]&&this.pa.add(j[c][0],j[c][1],j[c][2]);j[a]&&this.pa.add(j[a][0],j[a][1],j[a][2])}.bind(a));0==a.pa.C&&(a.pa=t);a.Ia=id}
od.prototype.Xf=function(a){(a==t||!(a instanceof tc)&&!(a instanceof Y))&&m(Error("Invalid object."));var b=a;a instanceof Y&&(b=pd(b));a=new Y;Fa(a,new od);qd(a,pd(this).Xf(b));return a};od.prototype.wa=function(a){(a==t||!(a instanceof tc)&&!(a instanceof Y))&&m(Error("Invalid object."));var b=a;a instanceof Y&&(b=pd(b));a=new Y;Fa(a,new od);qd(a,pd(this).wa(b));return a};
od.prototype.vf=function(a){(a==t||!(a instanceof tc)&&!(a instanceof Y))&&m(Error("Invalid object."));var b=a;a instanceof Y&&(b=pd(b));a=new Y;Fa(a,new od);qd(a,pd(this).vf(b));return a};od.prototype.inverse=function(){var a=new Y;Fa(a,new od);qd(a,pd(this).inverse());return a};A("X.constructable",od);A("X.constructable.prototype.intersect",od.prototype.vf);A("X.constructable.prototype.inverse",od.prototype.inverse);A("X.constructable.prototype.subtract",od.prototype.wa);
A("X.constructable.prototype.union",od.prototype.Xf);function rd(a){Rb.call(this,a);this.f="event"}C(rd,Rb);var sd=ic("pan"),td=ic("rotate"),ud=ic("zoom"),vd=ic("scroll");ic("render");var wd=ic("resetview"),xd=ic("windowlevel"),yd=ic("modified"),zd=ic("remove"),Ad=ic("progress"),Bd=ic("hover"),Cd=ic("hover_end"),Dd=ic("computing"),Ed=ic("computing_end"),Fd=ic("computing_progress");function Gd(){rd.call(this,xd);this.Qe=this.cf=0}C(Gd,rd);function Hd(){rd.call(this,sd);this.ya=new D.m(0,0,0)}C(Hd,rd);
function Id(){rd.call(this,td);this.ya=new D.m(0,0,0)}C(Id,rd);function Jd(){rd.call(this,ud);this.hb=this.vb=u}C(Jd,rd);function Kd(){rd.call(this,vd);this.V=u}C(Kd,rd);function Ld(){rd.call(this,Bd);this.ge=this.fe=0}C(Ld,rd);function Md(){rd.call(this,Cd)}C(Md,rd);function Nd(){rd.call(this,wd)}C(Nd,rd);function ld(){rd.call(this,yd);this.v=this.D=t}C(ld,rd);function md(){rd.call(this,zd);this.v=this.D=t}C(md,rd);function Od(){rd.call(this,Ad);this.Ad=0}C(Od,rd);
function Pd(){rd.call(this,Dd);this.D=t}C(Pd,rd);function Qd(){rd.call(this,Fd);this.Ad=0}C(Qd,rd);function Rd(){rd.call(this,Ed);this.D=t}C(Rd,rd);A("X.event.events.PAN",sd);A("X.event.events.ROTATE",td);A("X.event.events.ZOOM",ud);A("X.event.events.SCROLL",vd);function Sd(a,b,c){a==t&&m(Error("Invalid GL Buffer."));b==t&&m(Error("Invalid number of items."));c==t&&m(Error("Invalid item size."));M.call(this);this.f="buffer";this.P=a;this.ed=b;this.Ob=c}C(Sd,M);var Td;function Ud(a,b){var c;c=a.className;c=na(c)&&c.match(/\S+/g)||[];for(var e=Ob(arguments,1),d=c.length+e.length,f=c,g=0;g<e.length;g++)0<=Ib(f,e[g])||f.push(e[g]);a.className=c.join(" ");return c.length==d};function Vd(a,b){this.width=a;this.height=b}w=Vd.prototype;w.l=function(){return new Vd(this.width,this.height)};w.ceil=function(){this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};w.floor=function(){this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};w.round=function(){this.width=Math.round(this.width);this.height=Math.round(this.height);return this};w.scale=function(a,b){var c=x(b)?b:a;this.width*=a;this.height*=c;return this};var Wd=!K||K&&9<=Eb;!jb&&!K||K&&K&&9<=Eb||jb&&Cb("1.9.1");K&&Cb("9");function Xd(a,b){this.x=ia(a)?a:0;this.y=ia(b)?b:0}w=Xd.prototype;w.l=function(){return new Xd(this.x,this.y)};function Yd(a,b){return new Xd(a.x-b.x,a.y-b.y)}w.ceil=function(){this.x=Math.ceil(this.x);this.y=Math.ceil(this.y);return this};w.floor=function(){this.x=Math.floor(this.x);this.y=Math.floor(this.y);return this};w.round=function(){this.x=Math.round(this.x);this.y=Math.round(this.y);return this};
w.translate=function(a,b){a instanceof Xd?(this.x+=a.x,this.y+=a.y):(this.x+=a,x(b)&&(this.y+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.x*=a;this.y*=c;return this};function Zd(a){return a?new $d(ae(a)):Td||(Td=new $d)}function be(a){return na(a)?document.getElementById(a):a}var ce={cellpadding:"cellPadding",cellspacing:"cellSpacing",colspan:"colSpan",frameborder:"frameBorder",height:"height",maxlength:"maxLength",role:"role",rowspan:"rowSpan",type:"type",usemap:"useMap",valign:"vAlign",width:"width"};function de(a,b,c){return ee(document,arguments)}
function ee(a,b){var c=b[0],e=b[1];if(!Wd&&e&&(e.name||e.type)){c=["<",c];e.name&&c.push(' name="',Ra(e.name),'"');if(e.type){c.push(' type="',Ra(e.type),'"');var d={};Qa(d,e);delete d.type;e=d}c.push(">");c=c.join("")}var f=a.createElement(c);e&&(na(e)?f.className=e:la(e)?Ud.apply(t,[f].concat(e)):Na(e,function(a,b){"style"==b?f.style.cssText=a:"class"==b?f.className=a:"for"==b?f.htmlFor=a:b in ce?f.setAttribute(ce[b],a):0==b.lastIndexOf("aria-",0)||0==b.lastIndexOf("data-",0)?f.setAttribute(b,a):
f[b]=a}));if(2<b.length){e=function(b){b&&f.appendChild(na(b)?a.createTextNode(b):b)};for(c=2;c<b.length;c++){var g=b[c];if(ma(g)&&!(pa(g)&&0<g.nodeType)){var d=Jb,h;a:{if((h=g)&&"number"==typeof h.length){if(pa(h)){h="function"==typeof h.item||"string"==typeof h.item;break a}if(oa(h)){h="function"==typeof h.item;break a}}h=u}if(h)if(h=g.length,0<h){for(var l=Array(h),j=0;j<h;j++)l[j]=g[j];g=l}else g=[];d(g,e)}else e(g)}}return f}function fe(a){return"CSS1Compat"==a.compatMode}
function ge(a){a&&a.parentNode&&a.parentNode.removeChild(a)}function he(a){for(;a&&1!=a.nodeType;)a=a.nextSibling;return a}function ie(a,b){if(a.contains&&1==b.nodeType)return a==b||a.contains(b);if("undefined"!=typeof a.compareDocumentPosition)return a==b||Boolean(a.compareDocumentPosition(b)&16);for(;b&&a!=b;)b=b.parentNode;return b==a}function ae(a){return 9==a.nodeType?a:a.ownerDocument||a.document}function $d(a){this.ka=a||fa.document||document}w=$d.prototype;w.ne=Zd;
w.t=function(a){return na(a)?this.ka.getElementById(a):a};w.Lh=$d.prototype.t;w.Wc=function(a,b,c){return ee(this.ka,arguments)};w.createElement=function(a){return this.ka.createElement(a)};w.createTextNode=function(a){return this.ka.createTextNode(String(a))};function je(a){return fe(a.ka)}
function ke(a){var b=a.ka;a=!lb&&fe(b)?b.documentElement:b.body;b=b.parentWindow||b.defaultView;return K&&Cb("10")&&b.pageYOffset!=a.scrollTop?new Xd(a.scrollLeft,a.scrollTop):new Xd(b.pageXOffset||a.scrollLeft,b.pageYOffset||a.scrollTop)}w.appendChild=function(a,b){a.appendChild(b)};w.contains=ie;function le(a,b,c,e){this.top=a;this.right=b;this.bottom=c;this.left=e}w=le.prototype;w.l=function(){return new le(this.top,this.right,this.bottom,this.left)};w.contains=function(a){return!this||!a?u:a instanceof le?a.left>=this.left&&a.right<=this.right&&a.top>=this.top&&a.bottom<=this.bottom:a.x>=this.left&&a.x<=this.right&&a.y>=this.top&&a.y<=this.bottom};
w.ceil=function(){this.top=Math.ceil(this.top);this.right=Math.ceil(this.right);this.bottom=Math.ceil(this.bottom);this.left=Math.ceil(this.left);return this};w.floor=function(){this.top=Math.floor(this.top);this.right=Math.floor(this.right);this.bottom=Math.floor(this.bottom);this.left=Math.floor(this.left);return this};w.round=function(){this.top=Math.round(this.top);this.right=Math.round(this.right);this.bottom=Math.round(this.bottom);this.left=Math.round(this.left);return this};
w.translate=function(a,b){a instanceof Xd?(this.left+=a.x,this.right+=a.x,this.top+=a.y,this.bottom+=a.y):(this.left+=a,this.right+=a,x(b)&&(this.top+=b,this.bottom+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.left*=a;this.right*=a;this.top*=c;this.bottom*=c;return this};function me(a,b,c,e){this.left=a;this.top=b;this.width=c;this.height=e}w=me.prototype;w.l=function(){return new me(this.left,this.top,this.width,this.height)};w.Tg=function(a){var b=Math.max(this.left,a.left),c=Math.min(this.left+this.width,a.left+a.width);if(b<=c){var e=Math.max(this.top,a.top);a=Math.min(this.top+this.height,a.top+a.height);if(e<=a)return this.left=b,this.top=e,this.width=c-b,this.height=a-e,q}return u};
w.contains=function(a){return a instanceof me?this.left<=a.left&&this.left+this.width>=a.left+a.width&&this.top<=a.top&&this.top+this.height>=a.top+a.height:a.x>=this.left&&a.x<=this.left+this.width&&a.y>=this.top&&a.y<=this.top+this.height};function ne(a,b){var c=b.x<a.left?a.left-b.x:Math.max(b.x-(a.left+a.width),0),e=b.y<a.top?a.top-b.y:Math.max(b.y-(a.top+a.height),0);return c*c+e*e}w.rf=function(a){return Math.sqrt(ne(this,a))};
w.ceil=function(){this.left=Math.ceil(this.left);this.top=Math.ceil(this.top);this.width=Math.ceil(this.width);this.height=Math.ceil(this.height);return this};w.floor=function(){this.left=Math.floor(this.left);this.top=Math.floor(this.top);this.width=Math.floor(this.width);this.height=Math.floor(this.height);return this};w.round=function(){this.left=Math.round(this.left);this.top=Math.round(this.top);this.width=Math.round(this.width);this.height=Math.round(this.height);return this};
w.translate=function(a,b){a instanceof Xd?(this.left+=a.x,this.top+=a.y):(this.left+=a,x(b)&&(this.top+=b));return this};w.scale=function(a,b){var c=x(b)?b:a;this.left*=a;this.width*=a;this.top*=c;this.height*=c;return this};function oe(a,b){var c=ae(a);return c.defaultView&&c.defaultView.getComputedStyle&&(c=c.defaultView.getComputedStyle(a,t))?c[b]||c.getPropertyValue(b)||"":""}function pe(a,b){return oe(a,b)||(a.currentStyle?a.currentStyle[b]:t)||a.style&&a.style[b]}function qe(a){a=a?ae(a):document;return K&&!(K&&9<=Eb)&&!je(Zd(a))?a.body:a.documentElement}
function re(a){var b=a.getBoundingClientRect();K&&(a=a.ownerDocument,b.left-=a.documentElement.clientLeft+a.body.clientLeft,b.top-=a.documentElement.clientTop+a.body.clientTop);return b}
function se(a){if(K&&!(K&&8<=Eb))return a.offsetParent;var b=ae(a),c=pe(a,"position"),e="fixed"==c||"absolute"==c;for(a=a.parentNode;a&&a!=b;a=a.parentNode)if(c=pe(a,"position"),e=e&&"static"==c&&a!=b.documentElement&&a!=b.body,!e&&(a.scrollWidth>a.clientWidth||a.scrollHeight>a.clientHeight||"fixed"==c||"absolute"==c||"relative"==c))return a;return t}
function te(a){for(var b=new le(0,Infinity,Infinity,0),c=Zd(a),e=c.ka.body,d=c.ka.documentElement,f=!lb&&fe(c.ka)?c.ka.documentElement:c.ka.body;a=se(a);)if((!K||0!=a.clientWidth)&&(!lb||0!=a.clientHeight||a!=e)&&a!=e&&a!=d&&"visible"!=pe(a,"overflow")){var g=ue(a),h;h=a;if(jb&&!Cb("1.9")){var l=parseFloat(oe(h,"borderLeftWidth"));if(ve(h))var j=h.offsetWidth-h.clientWidth-l-parseFloat(oe(h,"borderRightWidth")),l=l+j;h=new Xd(l,parseFloat(oe(h,"borderTopWidth")))}else h=new Xd(h.clientLeft,h.clientTop);
g.x+=h.x;g.y+=h.y;b.top=Math.max(b.top,g.y);b.right=Math.min(b.right,g.x+a.clientWidth);b.bottom=Math.min(b.bottom,g.y+a.clientHeight);b.left=Math.max(b.left,g.x)}e=f.scrollLeft;f=f.scrollTop;b.left=Math.max(b.left,e);b.top=Math.max(b.top,f);c=(c.ka.parentWindow||c.ka.defaultView||window).document;c=fe(c)?c.documentElement:c.body;c=new Vd(c.clientWidth,c.clientHeight);b.right=Math.min(b.right,e+c.width);b.bottom=Math.min(b.bottom,f+c.height);return 0<=b.top&&0<=b.left&&b.bottom>b.top&&b.right>b.left?
b:t}
function ue(a){var b,c=ae(a),e=pe(a,"position"),d=jb&&c.getBoxObjectFor&&!a.getBoundingClientRect&&"absolute"==e&&(b=c.getBoxObjectFor(a))&&(0>b.screenX||0>b.screenY),f=new Xd(0,0),g=qe(c);if(a==g)return f;if(a.getBoundingClientRect)b=re(a),a=ke(Zd(c)),f.x=b.left+a.x,f.y=b.top+a.y;else if(c.getBoxObjectFor&&!d)b=c.getBoxObjectFor(a),a=c.getBoxObjectFor(g),f.x=b.screenX-a.screenX,f.y=b.screenY-a.screenY;else{b=a;do{f.x+=b.offsetLeft;f.y+=b.offsetTop;b!=a&&(f.x+=b.clientLeft||0,f.y+=b.clientTop||0);
if(lb&&"fixed"==pe(b,"position")){f.x+=c.body.scrollLeft;f.y+=c.body.scrollTop;break}b=b.offsetParent}while(b&&b!=a);if(ib||lb&&"absolute"==e)f.y-=c.body.offsetTop;for(b=a;(b=se(b))&&b!=c.body&&b!=g;)if(f.x-=b.scrollLeft,!ib||"TR"!=b.tagName)f.y-=b.scrollTop}return f}
function we(a){var b=new Xd;if(1==a.nodeType){if(a.getBoundingClientRect){var c=re(a);b.x=c.left;b.y=c.top}else{var c=ke(Zd(a)),e=ue(a);b.x=e.x-c.x;b.y=e.y-c.y}if(jb&&!Cb(12)){var d;K?d="-ms-transform":lb?d="-webkit-transform":ib?d="-o-transform":jb&&(d="-moz-transform");var f;d&&(f=pe(a,d));f||(f=pe(a,"transform"));f?(a=f.match(xe),a=!a?new Xd(0,0):new Xd(parseFloat(a[1]),parseFloat(a[2]))):a=new Xd(0,0);b=new Xd(b.x+a.x,b.y+a.y)}}else d=oa(a.Gi),f=a,a.targetTouches?f=a.targetTouches[0]:d&&a.sb.targetTouches&&
(f=a.sb.targetTouches[0]),b.x=f.clientX,b.y=f.clientY;return b}function ye(a,b){"number"==typeof a&&(a=(b?Math.round(a):a)+"px");return a}function ze(a){if("none"!=pe(a,"display"))return Ae(a);var b=a.style,c=b.display,e=b.visibility,d=b.position;b.visibility="hidden";b.position="absolute";b.display="inline";a=Ae(a);b.display=c;b.position=d;b.visibility=e;return a}
function Ae(a){var b=a.offsetWidth,c=a.offsetHeight,e=lb&&!b&&!c;return(!ia(b)||e)&&a.getBoundingClientRect?(a=re(a),new Vd(a.right-a.left,a.bottom-a.top)):new Vd(b,c)}function Be(a,b){a.style.display=b?"":"none"}function ve(a){return"rtl"==pe(a,"direction")}function Ce(a,b){if(/^\d+px?$/.test(b))return parseInt(b,10);var c=a.style.left,e=a.runtimeStyle.left;a.runtimeStyle.left=a.currentStyle.left;a.style.left=b;var d=a.style.pixelLeft;a.style.left=c;a.runtimeStyle.left=e;return d}
function De(a,b){var c=a.currentStyle?a.currentStyle[b]:t;return c?Ce(a,c):0}var Ee={thin:2,medium:4,thick:6};function Fe(a,b){if("none"==(a.currentStyle?a.currentStyle[b+"Style"]:t))return 0;var c=a.currentStyle?a.currentStyle[b+"Width"]:t;return c in Ee?Ee[c]:Ce(a,c)}var xe=/matrix\([0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, [0-9\.\-]+, ([0-9\.\-]+)p?x?, ([0-9\.\-]+)p?x?\)/;function Ge(a,b){jc.call(this);this.H=a;var c=pa(this.H)&&1==this.H.nodeType?this.H:this.H?this.H.body:t;this.aj=!!c&&ve(c);this.Jl=L(this.H,jb?"DOMMouseScroll":"mousewheel",this,b)}C(Ge,jc);
Ge.prototype.handleEvent=function(a){var b=0,c=0,e=0;a=a.sb;if("mousewheel"==a.type){c=1;if(K||lb&&(bb||Cb("532.0")))c=40;e=He(-a.wheelDelta,c);ia(a.wheelDeltaX)?(b=He(-a.wheelDeltaX,c),c=He(-a.wheelDeltaY,c)):c=e}else e=a.detail,100<e?e=3:-100>e&&(e=-3),ia(a.axis)&&a.axis===a.HORIZONTAL_AXIS?b=e:c=e;x(this.Yg)&&(b=Math.min(Math.max(b,-this.Yg),this.Yg));x(this.Zg)&&(c=Math.min(Math.max(c,-this.Zg),this.Zg));this.aj&&(b=-b);b=new Ie(e,a,b,c);this.dispatchEvent(b)};
function He(a,b){return lb&&(ab||db)&&0!=a%b?a:a/b}function Ie(a,b,c,e){b&&this.Ca(b,p);this.type="mousewheel";this.detail=a;this.yl=c;this.Xc=e}C(Ie,Tb);K||lb&&Cb("525");function Je(a){M.call(this);this.f="interactor";this.Oa=a;this.Re=this.og=this.ng=this.pg=this.mg=this.qg=t;this.Yd=q;this.Xb=this.Qb=this.wb=u;this.ua=[0,0];this.Me=new D.m(0,0,0);this.gd=new D.m(0,0,0);this.Vg=0;this.xg=this.Wd=t;this.wg=u;this.R={MOUSEWHEEL_ENABLED:q,MOUSECLICKS_ENABLED:q,KEYBOARD_ENABLED:q,HOVERING_ENABLED:q,CONTEXTMENU_ENABLED:u,TOUCH_ENABLED:q,TOUCH_BOUNCING_ENABLED:u}}C(Je,M);Je.prototype.__defineGetter__("config",v("R"));Je.prototype.__defineGetter__("leftButtonDown",v("wb"));
Je.prototype.__defineGetter__("middleButtonDown",v("Qb"));Je.prototype.__defineGetter__("rightButtonDown",v("Xb"));
Je.prototype.Ca=function(){this.R.MOUSEWHEEL_ENABLED?(this.Re=new Ge(this.Oa),this.qg=L(this.Re,"mousewheel",this.Kd.bind(this))):(bc(this.qg),this.Re=t);this.R.MOUSECLICKS_ENABLED?(this.mg=L(this.Oa,"mousedown",this.vj.bind(this)),this.pg=L(this.Oa,"mouseup",this.Aj.bind(this))):(bc(this.mg),bc(this.pg));this.Oa.oncontextmenu=this.R.CONTEXTMENU_ENABLED?t:function(){return u};window.onkeydown=this.R.KEYBOARD_ENABLED?this.ih.bind(this):t;this.R.TOUCH_ENABLED?(this.R.TOUCH_BOUNCING_ENABLED||document.body.addEventListener("touchmove",
function(a){a.preventDefault()},u),this.ci=L(this.Oa,"touchstart",this.Pj.bind(this)),this.bi=L(this.Oa,"touchmove",this.Nj.bind(this)),this.ai=L(this.Oa,"touchend",this.Jj.bind(this))):(bc(this.ci),bc(this.bi),bc(this.ai));bc(this.ng);bc(this.og);this.ng=L(this.Oa,"mousemove",this.xj.bind(this));this.og=L(this.Oa,"mouseout",this.yj.bind(this))};
Je.prototype.vj=function(a){0==a.button?this.wb=q:1==a.button?this.Qb=q:2==a.button&&(this.Xb=q);eval("this.onMouseDown("+this.wb+","+this.Qb+","+this.Xb+")");Ke(this);a.preventDefault()};Je.prototype.uj=aa();Je.prototype.Aj=function(a){0==a.button?this.wb=u:1==a.button?this.Qb=u:2==a.button&&(this.Xb=u);eval("this.onMouseUp("+this.wb+","+this.Qb+","+this.Xb+")");Ke(this);a.preventDefault()};Je.prototype.__defineGetter__("mousePosition",v("ua"));w=Je.prototype;w.zj=aa();
w.yj=function(a){this.Yd=u;this.R.KEYBOARD_ENABLED&&(window.onkeydown=t);this.Xb=this.Qb=this.wb=u;Ke(this);this.Me=new D.m(0,0,0);a.preventDefault()};w.wj=aa();w.Pj=function(a){a.preventDefault();a.Ca(a.sb.targetTouches[0],a.currentTarget);eval("this.onTouchStart("+a.clientX+","+a.clientY+")");this.gd=new D.m(a.clientX,a.clientY,0);this.xg=setTimeout(this.Lj.bind(this,a),500)};w.Oj=aa();
w.Lj=function(a){eval("this.onTouchHover("+a.clientX+","+a.clientY+")");a=new Jd;a.vb=q;a.hb=this instanceof Le;this.dispatchEvent(a);this.be=q};w.Kj=aa();function Me(a){clearTimeout(a.xg);if(a.be){var b=new Jd;b.vb=u;b.hb=a instanceof Le;a.dispatchEvent(b)}a.be=u}w.Jj=function(a){a.preventDefault();eval("this.onTouchEnd()");Me(this)};w.Ij=aa();
w.Nj=function(a){a.preventDefault();this.be||Me(this);this.touchmoveEvent=a=a.sb;eval("this.onTouchMove(this['touchmoveEvent'])");var b=a.targetTouches;if(1==b.length){a=b[0];var c=[a.clientX,a.clientY];a=new D.m(c[0],c[1],0);var b=c[0]>3*this.Oa.clientWidth/4,e=c[0]<this.Oa.clientWidth/4,d=c[1]<this.Oa.clientHeight/4,c=c[1]>3*this.Oa.clientHeight/4,c=!b&&!e&&!d&&!c,d=this.gd.wa(a);this.gd=a.l();if(this.be)a=new Hd,5<d.x?d.x=1:-5>d.x&&(d.x=-1),5<d.y?d.y=1:-5>d.y&&(d.y=-1),a.ya=d,this.dispatchEvent(a);
else if(this instanceof Ne&&(b||e))a=new Kd,a.V=0>d.y,this.dispatchEvent(a);else if(this instanceof Le||c)d.scale(3),a=new Id,a.ya=d,this.dispatchEvent(a)}else 2==b.length&&(a=b[0],b=b[1],a=[a.clientX,a.clientY],b=[b.clientX,b.clientY],a=new D.m(a[0],a[1],0),b=new D.m(b[0],b[1],0),d=Gc(a,b),b=d-this.Vg,this.Vg=d,this.gd.wa(a),this.gd=a.l(),10<Math.abs(b)&&(a=new Jd,a.vb=0<b,a.hb=this instanceof Le,this.dispatchEvent(a)))};w.Mj=aa();
w.xj=function(a){this.mousemoveEvent=a;eval("this.onMouseMove(this['mousemoveEvent'])");this.Yd=q;this.R.KEYBOARD_ENABLED&&window.onkeydown==t&&(window.onkeydown=this.ih.bind(this));a.preventDefault();var b=a.shiftKey;this.wg=b;this.ua=[a.offsetX,a.offsetY];var c=new D.m(this.ua[0],this.ua[1],0);a=this.Me.wa(c);this.Me=c.l();this.R.HOVERING_ENABLED&&((0<Math.abs(a.x)||0<Math.abs(a.y)||this.Qb||this.wb||this.Xb)&&Ke(this),this.Wd=setTimeout(function(){Ke(this);var a=new Ld;a.fe=c.x;a.ge=c.y;this.dispatchEvent(a);
this.Wd=t}.bind(this),300));0!=a.Ib()&&(this.wb&&!b?(b=new Id,a.scale(3),b.ya=a,this.dispatchEvent(b)):this.Qb||this.wb&&b?(b=new Hd,b.ya=a,this.dispatchEvent(b)):this.Xb&&(b=new Jd,b.vb=0<a.y,b.hb=u,this.dispatchEvent(b)))};function Ke(a){a.Wd&&clearTimeout(a.Wd);a.dispatchEvent(new Md)}w.Bj=aa();w.Kd=function(a){this.mouseWheelEvent=a;eval("this.onMouseWheel(this['mouseWheelEvent'])");Ke(this);a.preventDefault()};w.sj=aa();
w.ih=function(a){if(this.Yd){this.keyEvent=a;eval("this.onKey(this['keyEvent'])");Ke(this);var b=a.altKey,c=a.ctrlKey,e=a.metaKey,d=a.shiftKey,f=a.keyCode;82==f&&!b&&!c&&!e&&!d?(a.preventDefault(),a=new Nd,this.dispatchEvent(a)):37<=f&&40>=f&&(a.preventDefault(),d?a=new Hd:b?a=new Jd:(a=new Id,this instanceof Ne&&(a=new Kd)),a&&(c=new D.m(0,0,0),37==f?(c.x=5,a.V=u,b&&(a.V=q,a.vb=q,a.hb=u)):39==f?(c.x=-5,a.V=q,b&&(a.vb=u,a.hb=u)):38==f?(c.y=5,a.V=q,b&&(a.vb=q,a.hb=q)):40==f&&(c.y=-5,a.V=u,b&&(a.vb=
u,a.hb=q)),a.ya=c,this.dispatchEvent(a)))}};A("X.interactor",Je);A("X.interactor.prototype.init",Je.prototype.Ca);A("X.interactor.prototype.onMouseDown",Je.prototype.uj);A("X.interactor.prototype.onMouseUp",Je.prototype.zj);A("X.interactor.prototype.onMouseMove",Je.prototype.wj);A("X.interactor.prototype.onMouseWheel",Je.prototype.Bj);A("X.interactor.prototype.onKey",Je.prototype.sj);A("X.interactor.prototype.onTouchStart",Je.prototype.Oj);A("X.interactor.prototype.onTouchMove",Je.prototype.Mj);
A("X.interactor.prototype.onTouchEnd",Je.prototype.Ij);A("X.interactor.prototype.onTouchHover",Je.prototype.Kj);function Ne(a){Je.call(this,a);this.f="interactor2D"}C(Ne,Je);Ne.prototype.Kd=function(a){Ne.u.Kd.call(this,a);var b=new Kd;a.Xc==t&&(a.Xc=0);b.V=0>a.Xc;this.dispatchEvent(b)};function Oe(a,b){(!x(a)||!x(b))&&m(Error("A camera needs valid width and height values."));M.call(this);this.f="camera";this.ic=new D.m(0,100,0);this.Fc=new D.m(0,0,0);this.V=new D.m(0,0,1);this.K=a;this.A=b;this.o=this.ue(this.ic,this.Fc)}C(Oe,M);Oe.prototype.observe=function(a){(a==t||!(a instanceof Je))&&m(Error("Could not observe the interactor."));L(a,td,this.Fj.bind(this));L(a,sd,this.Cj.bind(this));L(a,ud,this.Sj.bind(this))};
Oe.prototype.Fj=function(a){a instanceof Id||m(Error("Received no valid rotate event."));this.rotate(a.ya)};Oe.prototype.Sj=function(a){a instanceof Jd||m(Error("Received no valid zoom event."));a.vb?this.$f(a.hb):this.ag(a.hb)};Oe.prototype.Cj=function(a){a instanceof Hd||m(Error("Received no valid pan event."));this.Kf(a.ya)};Oe.prototype.__defineGetter__("view",v("o"));
Oe.prototype.__defineSetter__("view",function(a){(a==t||!(a instanceof Float32Array))&&m(Error("Invalid view matrix."));this.o=a});Oe.prototype.__defineGetter__("position",function(){return[this.ic.x,this.ic.y,this.ic.d]});Oe.prototype.__defineSetter__("position",function(a){(a==t||!la(a)||3!=a.length)&&m(Error("Invalid position."));this.ic=new D.m(a[0],a[1],a[2]);this.reset()});Oe.prototype.__defineGetter__("focus",function(){return[this.Fc.x,this.Fc.y,this.Fc.d]});
Oe.prototype.__defineSetter__("focus",function(a){(a==t||!la(a)||3!=a.length)&&m(Error("Invalid focus"));this.Fc=new D.m(a[0],a[1],a[2]);this.reset()});Oe.prototype.__defineGetter__("up",function(){return[this.V.x,this.V.y,this.V.d]});Oe.prototype.__defineSetter__("up",function(a){(a==t||!la(a)||3!=a.length)&&m(Error("Invalid up vector."));this.V=new D.m(a[0],a[1],a[2]);this.reset()});w=Oe.prototype;w.reset=function(){this.o=this.ue(this.ic,this.Fc)};
w.rotate=function(a){la(a)&&2==a.length?a=new D.m(a[0],a[1],0):a instanceof D.m||m(Error("Invalid distance vector for rotate operation."));return a};w.Kf=function(a){la(a)&&2==a.length?a=new D.m(a[0],a[1],0):a instanceof D.m||m(Error("Invalid distance vector for pan operation."));this.o[12]-=a.x;this.o[13]+=a.y};w.$f=function(a){var b=20;a!=t&&!a&&(b=1);this.o[14]+=b};w.ag=function(a){var b=20;a!=t&&!a&&(b=1);this.o[14]-=b};
w.ue=function(a,b){(!(a instanceof D.m)||!(b instanceof D.m))&&m(Error("3D vectors required for calculating the view."));return D.g.Ed()};A("X.camera",Oe);A("X.camera.prototype.pan",Oe.prototype.Kf);A("X.camera.prototype.rotate",Oe.prototype.rotate);A("X.camera.prototype.zoomIn",Oe.prototype.$f);A("X.camera.prototype.zoomOut",Oe.prototype.ag);function Pe(a,b){Oe.call(this,a,b);this.f="camera3D";this.eg=45;this.Ve=D.g.yf(D.g.Ed(),this.eg,a/b,1,1E4)}C(Pe,Oe);Pe.prototype.rotate=function(a){a=Pe.u.rotate.call(this,a);var b=-a.x/5*Math.PI/180;a=-a.y/5*Math.PI/180;var c=new D.m(this.o[1],this.o[5],this.o[9]),e=new D.m(this.o[0],this.o[4],this.o[8]);c.normalize();e.normalize();D.g.rotate(this.o,b,c.x,c.y,c.d);D.g.rotate(this.o,a,e.x,e.y,e.d)};Pe.prototype.ue=function(a,b){var c=Pe.u.ue.call(this,a,b);D.g.Xg(c,a,b,this.V);return c};
function Qe(a,b,c,e){var d=new Float32Array(4),f=new Float32Array(4),g=new Float32Array(16),h=new Float32Array(16);new Float32Array(16);D.g.multiply(a.Ve,a.o,h);D.g.Y(h,g);d[0]=b;d[1]=c;d[2]=2*e-1;d[3]=1;D.g.ah(g,d,f);f[3]=1/f[3];f[0]*=f[3];f[1]*=f[3];f[2]*=f[3];return f}A("X.camera3D",Pe);function Re(){M.call(this);this.f="parser";this.J=t;this.C=0;this.Zh=0<(new Int8Array((new Int16Array([1])).buffer))[0];this.Mc=q;this.rl=-Infinity;this.ql=Infinity}C(Re,M);Re.prototype.parse=function(){m(Error("The function parse() should be overloaded."))};function Se(a){for(var b=Infinity,c=-Infinity,e=a.length,d=0,d=0;d<e;d++)if(!isNaN(a[d]))var f=a[d],b=Math.min(b,f),c=Math.max(c,f);return[b,c]}
function Te(a,b,c){b===p&&(b=0);c===p&&(c=a.length);for(var e="",d=0,d=b;d<c;++d)e+=String.fromCharCode(a[d]);return e}
function Z(a,b,c){c!=t||(c=1);var e=1,d=Uint8Array;switch(b){case "schar":d=Int8Array;break;case "ushort":d=Uint16Array;e=2;break;case "sshort":d=Int16Array;e=2;break;case "uint":d=Uint32Array;e=4;break;case "sint":d=Int32Array;e=4;break;case "float":d=Float32Array;e=4;break;case "complex":d=Float64Array;e=8;break;case "double":d=Float64Array,e=8}b=new d(a.J.slice(a.C,a.C+=c*e));if(a.Zh!=a.Mc){a=b;b=new Uint8Array(a.buffer,a.byteOffset,a.byteLength);for(d=0;d<a.byteLength;d+=e)for(var f=d+e-1,g=d;f>
g;f--,g++){var h=b[g];b[g]=b[f];b[f]=h}b=a}return 1==c?b[0]:b}
function Ue(a,b){var c=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE],e=Qc(0,0,0,1),d=Pc();cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(0,0,b[2]-1,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(0,b[1]-
1,0,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(b[0]-1,0,0,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(b[0]-1,b[1]-1,0,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];
c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(b[0]-1,0,b[2]-1,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(0,b[1]-1,b[2]-1,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];e=Qc(b[0]-1,b[1]-1,b[2]-1,1);cd(a,e,d);c[0]=d[0]<c[0]?d[0]:c[0];c[1]=d[0]>c[1]?d[0]:c[1];c[2]=d[1]<c[2]?d[1]:
c[2];c[3]=d[1]>c[3]?d[1]:c[3];c[4]=d[2]<c[4]?d[2]:c[4];c[5]=d[2]>c[5]?d[2]:c[5];return c}
function Ve(a,b){var c=Sc();if(!(a.length==b.length&&a[0]==b[0]&&a[1]==b[1]&&a[2]==b[2])){var e=Math.acos(a[2]),d=Mc(),f=a[0],g=a[1],h=a[2],l=b[0],j=b[1],k=b[2];d[0]=g*k-h*j;d[1]=h*l-f*k;d[2]=f*j-g*l;Oc(d,d);f=Math.cos(e/2);g=Math.sin(e/2)*d[0];h=Math.sin(e/2)*d[1];e=Math.sin(e/2)*d[2];T(c,0,f*f+g*g-h*h-e*e,2*(g*h-f*e),2*(g*e+f*h),0);T(c,1,2*(g*h+f*e),f*f+h*h-g*g-e*e,2*(h*e-f*g),0);T(c,2,2*(g*e-f*h),2*(h*e+f*g),f*f+e*e-h*h-g*g,0)}e=Rc();ad(c,e);return[c,e]}
function We(a,b,c,e,d,f,g,h,l){var j=new Xe;Oc(c,c);for(var k=[],n=[],s=0;6>s;s++)for(var r=Math.floor(s/2),y=(r+1)%3,z=(r+2)%3,F=(4+2*r)%6,G=0;2>G;G++){var H=(2+G+2*r)%6,B=-(c[r]*(d[s]-a[r])+c[y]*(d[H]-a[y]))/c[z]+a[z];if(B>=d[F]&&B<=d[F+1]||B<=d[F]&&B>=d[F+1]){var E=[];E[r]=d[s];E[y]=d[H];E[z]=B;k.push(E)}else E=[],E[r]=d[s],E[y]=d[H],E[z]=B,n.push(E)}a=Nc(0,0,1);a=Ve(c,a);d=a[0];a=a[1];r=[];for(n=0;n<k.length;++n)s=Qc(k[n][0],k[n][1],k[n][2],1),y=Pc(),cd(d,s,y),r.push([y[0],y[1],y[2]]);d=Nc(1,
0,0);k=Mc();bd(a,d,k);n=Nc(0,1,0);d=Mc();bd(a,n,d);s=[Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE,Number.MAX_VALUE,-Number.MAX_VALUE];for(n=n=0;n<r.length;++n)r[n][0]<s[0]&&(s[0]=r[n][0]),r[n][0]>s[1]&&(s[1]=r[n][0]),r[n][1]<s[2]&&(s[2]=r[n][1]),r[n][1]>s[3]&&(s[3]=r[n][1]),r[n][2]<s[4]&&(s[4]=r[n][2]),r[n][2]>s[5]&&(s[5]=r[n][2]);n=Qc(s[0]+(s[1]-s[0])/2,s[2]+(s[3]-s[2])/2,s[4]+(s[5]-s[4])/2,0);r=Pc();$c(a,n,r);y=Math.floor(s[0]);z=Math.ceil(s[1]);y==z&&z++;F=z-y;G=Math.floor(s[2]);
H=Math.ceil(s[3]);G==H&&H++;B=H-G;E=b[0];b=b[1];var n=Math.ceil(F/E),I=Math.ceil(B/b),N=new Uint8Array(4*n*I),Q=new gd;Q.Xe=n;Q.We=I;var I=Pc(),O=Qc(0,0,s[4],1),S=Rc();$c(g.Qh,a,S);for(var da=H-1E-7,J=z-1E-7,ba=0,ka=0,U=0,V=G,V=G;V<=da;V+=b){U++;ka=0;O[1]=V;for(n=y;n<=J;n+=E){ka++;O[0]=n;cd(S,O,I);var Ga=4*ba,tb=Math.floor(I[2]),ub=Math.floor(I[1]),vb=Math.floor(I[0]);if(0<=vb&&vb<g.ca[0]&&0<=ub&&ub<g.ca[1]&&0<=tb&&tb<g.ca[2]){var kb=f[tb][ub][vb],Zc=vb=ub=tb=0;l?((kb=l.get(kb))||(kb=[0,0.61,0,0,
1]),tb=255*kb[1],ub=255*kb[2],vb=255*kb[3],Zc=255*kb[4]):(tb=ub=vb=255*((kb-g.ra)/(g.ia-g.ra)),Zc=255);N[Ga]=tb;N[++Ga]=ub;N[++Ga]=vb;N[++Ga]=Zc}else N[Ga]=0,N[++Ga]=0,N[++Ga]=0,N[++Ga]=0;ba++}}Q.Wb=N;j.G=Q;j.ei=s;j.Sh=a;j.Rh=S;j.Yh=G;j.ol=H;j.di=y;j.tl=z;j.jg=ka;j.ig=U;j.Vc=E;j.K=F;j.Gc=b;j.A=B;j.z=[r[0],r[1],r[2]];j.gc=[c[0],c[1],c[2]];j.Oc=[k[0],k[1],k[2]];j.V=[d[0],d[1],d[2]];j.O=u;j.yb=g;j.Bb=g.yb!=t&&!h?u:q;j.ec=e;j.Gb();j.O=u;return j}
function Ye(a,b,c,e){var d;d=e.ma;for(var f=[],g=[],h=0;6>h;h++){var l=Math.floor(h/2),j=(l+1)%3,k=(l+2)%3,n=(2+2*l)%6,s=(4+2*l)%6,r=(d[h]-b[l])*(1/c[l]);if(Infinity!=r&&-Infinity!=r){var y=b[j]+c[j]*r,r=b[k]+c[k]*r;y>=d[n]&&y<=d[n+1]&&r>=d[s]&&r<=d[s+1]?(n=[],n[l]=d[h],n[j]=y,n[k]=r,f.push(n)):(n=[],n[l]=d[h],n[j]=y,n[k]=r,g.push(n))}}d=[f,g];b=d[0];e.b[a].k=d;d=Fc(new R(b[0][0],b[0][1],b[0][2]),new R(b[1][0],b[1][1],b[1][2]));e.b[a].nl=d;f=Nc(0,0,1);g=Ve(c,f)[0];h=Qc(e.ad[0],e.ad[1],e.ad[2],0);
f=Pc();cd(g,h,f);g=Pc();h=f[2];g[0]=c[0]*h;g[1]=c[1]*h;g[2]=c[2]*h;g[3]=c[3]*h;0.1>Math.abs(f[0])&&(f[0]=0.1);0.1>Math.abs(f[1])&&(f[1]=0.1);f[0]/=e.ae;f[1]/=e.ae;e.b[a].Ga=[Math.abs(f[0]),Math.abs(f[1])];e.b[a].Sc=f[2];e.b[a].B=g;d=Math.floor(Math.abs(d/f[2]));e.ud[a]=d+1;e.b[a].p=d+1;e.b[a].k[0][0][0]>e.b[a].k[0][1][0]?0<g[0]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][0]<e.b[a].k[0][1][0]?0>g[0]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=
d):e.b[a].k[0][0][1]>e.b[a].k[0][1][1]?0<g[1]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][1]<e.b[a].k[0][1][1]?0>g[1]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][2]>e.b[a].k[0][1][2]?0<g[2]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d):e.b[a].k[0][0][2]<e.b[a].k[0][1][2]&&0>g[2]&&(d=e.b[a].k[0][0],e.b[a].k[0][0]=e.b[a].k[0][1],e.b[a].k[0][1]=d);e.b[a].Te=-(c[0]*b[0][0]+c[1]*b[0][1]+c[2]*b[0][2])}
function af(a,b){var c;c=b.J;for(var e=b.ca,d=b.ia,f=b.ra,g=Array(e[2]),h=Array(e[2]),l=e[1]*e[0],j=0,k=0,n=0,s=0,r=0,s=0;s<e[2];s++){var y=c.subarray(s*l,(s+1)*l),r=0;h[s]=Array(e[1]);g[s]=Array(e[1]);for(n=0;n<e[1];n++){h[s][n]=new c.constructor(e[0]);g[s][n]=new c.constructor(e[0]);for(k=0;k<e[0];k++)j=y[r],h[s][n][k]=255*((j-f)/(d-f)),g[s][n][k]=j,r++}}c=[g,h];b.$=c[0];b.bg=c[1];D.Ja(a.f+".reslice");b.L=b.e!=t;b.xa&&(b.cd=b.xa.Ka);b.Sl=[0,0,0];b.s=[b.Ea[0]+(b.gb[0]-1)/2,b.Ea[1]+(b.gb[1]-1)/2,
b.Ea[2]+(b.gb[2]-1)/2];b.ma=[Math.min(b.Ea[0],b.Ea[0]+b.gb[0]-1),Math.max(b.Ea[0],b.Ea[0]+b.gb[0]-1),Math.min(b.Ea[1],b.Ea[1]+b.gb[1]-1),Math.max(b.Ea[1],b.Ea[1]+b.gb[1]-1),Math.min(b.Ea[2],b.Ea[2]+b.gb[2]-1),Math.max(b.Ea[2],b.Ea[2]+b.gb[2]-1)];b.b=[{},{},{}];c=Nc(b.s[0],b.s[1],b.s[2]);b.b[0].vd=c;e=Nc(1,0,0);Oc(e,e);b.b[0].i=e;d=[1,0,0];b.b[0].w=d;Ye(0,c,e,b);b.c[0].c=Array(b.b[0].p);c[0]=b.b[0].k[0][0][0]+b.b[0].B[0]*Math.floor(b.b[0].p/2);c[1]=b.b[0].k[0][0][1]+b.b[0].B[1]*Math.floor(b.b[0].p/
2);c[2]=b.b[0].k[0][0][2]+b.b[0].B[2]*Math.floor(b.b[0].p/2);c=We(c,b.b[0].Ga,b.b[0].i,b.b[0].w,b.ma,b.$,b,b.L,b.cd);b.L&&(c.e=b.e.c[0].c[Math.floor(b.b[0].p/2)].G);b.c[0].c[Math.floor(b.b[0].p/2)]=c;b.Cb=Math.floor(b.b[0].p/2);b.Hc=Math.floor(b.b[0].p/2);c=Nc(b.s[0],b.s[1],b.s[2]);b.b[1].vd=c;e=Nc(0,1,0);Oc(e,e);b.b[1].i=e;d=[0,1,0];b.b[1].w=d;Ye(1,c,e,b);b.c[1].c=Array(b.b[1].p);c[0]=b.b[1].k[0][0][0]+b.b[1].B[0]*Math.floor(b.b[1].p/2);c[1]=b.b[1].k[0][0][1]+b.b[1].B[1]*Math.floor(b.b[1].p/2);c[2]=
b.b[1].k[0][0][2]+b.b[1].B[2]*Math.floor(b.b[1].p/2);c=We(c,b.b[1].Ga,b.b[1].i,b.b[1].w,b.ma,b.$,b,b.L,b.cd);b.L&&(c.e=b.e.c[1].c[Math.floor(b.b[1].p/2)].G);b.c[1].c[Math.floor(b.b[1].p/2)]=c;b.Db=Math.floor(b.b[1].p/2);b.Ic=Math.floor(b.b[1].p/2);c=Nc(b.s[0],b.s[1],b.s[2]);b.b[2].vd=c;e=Nc(0,0,1);Oc(e,e);b.b[2].i=e;d=[0,0.392,0.804];b.b[2].w=d;Ye(2,c,e,b);b.c[2].c=Array(b.b[2].p);c[0]=b.b[2].k[0][0][0]+b.b[2].B[0]*Math.floor(b.b[2].p/2);c[1]=b.b[2].k[0][0][1]+b.b[2].B[1]*Math.floor(b.b[2].p/2);c[2]=
b.b[2].k[0][0][2]+b.b[2].B[2]*Math.floor(b.b[2].p/2);c=We(c,b.b[2].Ga,b.b[2].i,b.b[2].w,b.ma,b.$,b,b.L,b.cd);b.L&&(c.e=b.e.c[2].c[Math.floor(b.b[2].p/2)].G);b.c[2].c[Math.floor(b.b[2].p/2)]=c;b.Eb=Math.floor(b.b[2].p/2);b.Jc=Math.floor(b.b[2].p/2);D.Da(a.f+".reslice");return b.$};function bf(){Re.call(this);this.f="parserIMAGE"}C(bf,Re);bf.prototype.parse=function(a,b,c,e){c instanceof ArrayBuffer||m(Error());for(var d=new Uint8Array(c),f=d.length,g=Array(f);f--;)g[f]=String.fromCharCode(d[f]);d=window.btoa(g.join(""));f=new Image;$b(f,"load",this.Uj.bind(this,f,a,b,c,e));f.src="data:image/"+e+";base64,"+d};bf.prototype.Uj=function(a,b,c){b.ib=a;b.Wb=t;a=new ld;a.D=c;a.v=b;this.dispatchEvent(a)};A("X.parserIMAGE",bf);A("X.parserIMAGE.prototype.parse",bf.prototype.parse);function cf(a,b){Oe.call(this,a,b);this.f="camera2D"}C(cf,Oe);cf.prototype.rotate=function(a){a=cf.u.rotate.call(this,a);var b=new Gd;0<a.x?b.cf--:0>a.x&&b.cf++;0<a.y?b.Qe++:0>a.y&&b.Qe--;this.dispatchEvent(b)};cf.prototype.$f=function(a){var b=20;a!=t&&!a&&(b=0.02);this.o[14]+=b};cf.prototype.ag=function(a){var b=20;a!=t&&!a&&(b=0.02);this.o[14]-=b};
cf.prototype.Kf=function(a){la(a)&&2==a.length?a=new D.m(a[0],a[1],0):a instanceof D.m||m(Error("Invalid distance vector for pan operation."));this.o[12]-=a.x/this.o[14];this.o[13]+=a.y/this.o[14]};function df(){M.call(this);this.f="shaders";this.ce="";var a;a="precision mediump float;\n\n";a+="attribute vec3 vertexPosition;\n";a+="attribute vec3 vertexNormal;\n";a+="attribute vec3 vertexColor;\n";a+="attribute vec2 vertexTexturePos;\n";a+="attribute float vertexScalar;\n";a+="\n";a+="uniform mat4 view;\n";a+="uniform mat4 perspective;\n";a+="uniform vec3 center;\n";a+="uniform mat4 objectTransform;\n";a+="uniform bool useObjectColor;\n";a+="uniform bool useScalars;\n";a+="uniform bool scalarsReplaceMode;\n";
a+="uniform float scalarsMin;\n";a+="uniform float scalarsMax;\n";a+="uniform vec3 scalarsMinColor;\n";a+="uniform vec3 scalarsMaxColor;\n";a+="uniform float scalarsMinThreshold;\n";a+="uniform float scalarsMaxThreshold;\n";a+="uniform int scalarsInterpolation;\n";a+="uniform vec3 objectColor;\n";a+="uniform float pointSize;\n";a+="\n";a+="varying float fDiscardNow;\n";a+="varying vec4 fVertexPosition;\n";a+="varying vec3 fragmentColor;\n";a+="varying vec2 fragmentTexturePos;\n";a+="varying vec3 fVertexNormal;\n";
a+="varying vec3 fTransformedVertexNormal;\n";a+="\n";a+="void main(void) {\n";a+=" fTransformedVertexNormal = mat3(view[0].xyz,view[1].xyz,view[2].xyz) * ";a+="mat3(objectTransform[0].xyz,objectTransform[1].xyz,objectTransform[2].xyz) * ";a+="vertexNormal;\n";a+=" fVertexNormal = vertexNormal;\n";a+=" fDiscardNow = 0.0;\n";a+=" vec3 vertexPosition2 = vertexPosition - center;\n";a+=" fVertexPosition = view * objectTransform * vec4(vertexPosition2, 1.0);\n";a+=" fragmentTexturePos = vertexTexturePos;\n";
a+=" if (useScalars) {\n";a+=" float scalarValue = vertexScalar;\n";a+=" if (scalarValue < scalarsMinThreshold || scalarValue > scalarsMaxThreshold) {\n";a+=" if (scalarsReplaceMode) {\n";a+=" fragmentColor = objectColor;\n";a+=" } else {\n";a+=" fDiscardNow = 1.0;\n";a+=" }\n";a+=" } else {\n";a+=" if (scalarsReplaceMode) {\n";a+=" if (scalarsInterpolation == 1) {\n";a+=" vec3 zeroMaxColor;\n";a+=" vec3 zeroMinColor;\n";a+=
" zeroMaxColor[0] = scalarsMaxColor[0]*0.33;\n";a+=" zeroMaxColor[1] = scalarsMaxColor[1]*0.33;\n";a+=" zeroMaxColor[2] = scalarsMaxColor[2]*0.33;\n";a+=" zeroMinColor[0] = scalarsMinColor[0]*0.33;\n";a+=" zeroMinColor[1] = scalarsMinColor[1]*0.33;\n";a+=" zeroMinColor[2] = scalarsMinColor[2]*0.33;\n";a+=" if(scalarValue < 0.0) {fragmentColor = scalarValue/(scalarsMin) * scalarsMinColor + (1.0 - scalarValue/(scalarsMin)) * (zeroMinColor);}\n";
a+=" else {fragmentColor = scalarValue/(scalarsMax) * scalarsMaxColor + (1.0 - scalarValue/(scalarsMax)) * (zeroMaxColor);}\n";a+=" } else {\n";a+=" fragmentColor = scalarValue * scalarsMaxColor + (1.0 - scalarValue) * scalarsMinColor;\n";a+=" }\n";a+=" } else {\n";a+=" fragmentColor = vertexColor;\n";a+=" }\n";a+=" }\n";a+=" } else if (useObjectColor) {\n";a+=" fragmentColor = objectColor;\n";a+=" } else {\n";a+=" fragmentColor = vertexColor;\n";
a+=" }\n";a+=" gl_PointSize = pointSize;\n";a+=" gl_Position = perspective * fVertexPosition;\n";this.ce=a+="}\n";this.Ud="";a="precision mediump float;\n\n";a+="uniform bool usePicking;\n";a+="uniform bool useTexture;\n";a+="uniform bool volumeTexture;\n";a+="uniform bool useLabelMapTexture;\n";a+="uniform sampler2D textureSampler;\n";a+="uniform sampler2D textureSampler2;\n";a+="uniform float objectOpacity;\n";a+="uniform float labelmapOpacity;\n";a+="uniform vec4 labelmapColor;\n";a+="uniform float volumeLowerThreshold;\n";
a+="uniform float volumeUpperThreshold;\n";a+="uniform float volumeScalarMin;\n";a+="uniform float volumeScalarMax;\n";a+="uniform vec3 volumeScalarMinColor;\n";a+="uniform vec3 volumeScalarMaxColor;\n";a+="uniform float volumeWindowLow;\n";a+="uniform float volumeWindowHigh;\n";a+="\n";a+="varying float fDiscardNow;\n";a+="varying vec4 fVertexPosition;\n";a+="varying vec3 fragmentColor;\n";a+="varying vec2 fragmentTexturePos;\n";a+="varying vec3 fVertexNormal;\n";a+="varying vec3 fTransformedVertexNormal;\n";
a+="\n";a+="void main(void) {\n";a+=" if (fDiscardNow > 0.0) {\n";a+=" discard;\n";a+=" }\n";a+=" if (usePicking) {\n";a+=" gl_FragColor = vec4(fragmentColor, 1.0);\n";a+=" } else if (useTexture) {\n";a+=" vec4 texture1 = texture2D(textureSampler,fragmentTexturePos);\n";a+=" vec4 textureSum = texture1;\n";a+=" if (volumeTexture) {\n";a+=" float _windowLow = ((volumeWindowLow - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin));\n";a+=" float _windowHigh = ((volumeWindowHigh - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin));\n";
a+=" vec3 _minrange = vec3(_windowLow,_windowLow,_windowLow);\n";a+=" vec3 _maxrange = vec3(_windowHigh,_windowHigh,_windowHigh);\n";a+=" vec3 fac = _maxrange - _minrange;\n";a+=" textureSum = vec4((textureSum.r - _minrange)/fac,1);\n";a+=" textureSum = textureSum.r * vec4(volumeScalarMaxColor,1) + (1.0 - textureSum.r) * vec4(volumeScalarMinColor,1);\n";a+=" }\n";a+=" if (useLabelMapTexture) {\n";a+=" vec4 texture2 = texture2D(textureSampler2,fragmentTexturePos);\n";a+=
" if (texture2.a > 0.0) {\n";a+=" if (labelmapColor.a != -255.0) {\n";a+=" if (all(equal(floor(texture2 * vec4(255)), labelmapColor))) {\n";a+=" if (labelmapOpacity < 1.0) {\n";a+=" textureSum = mix(texture2, textureSum, 1.0 - labelmapOpacity);\n";a+=" } else {\n";a+=" textureSum = texture2;\n";a+=" }\n";a+=" }\n";a+=" } else {\n";a+=" if (labelmapOpacity < 1.0) {\n";a+=" textureSum = mix(texture2, textureSum, 1.0 - labelmapOpacity);\n";
a+=" } else {\n";a+=" textureSum = texture2;\n";a+=" }\n";a+=" }\n";a+=" }\n";a+=" }\n";a+=" if (volumeTexture) {\n";a+=" float _volumeLowerThreshold = (volumeLowerThreshold - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin);\n";a+=" float _volumeUpperThreshold = (volumeUpperThreshold - volumeScalarMin)/ (volumeScalarMax - volumeScalarMin);\n";a+=" if (texture1.r < _volumeLowerThreshold ||\n";a+=" texture1.r > _volumeUpperThreshold ||\n";
a+=" texture1.a == 0.0 ) {\n";a+=" discard;\n";a+=" };\n";a+=" };\n";a+=" gl_FragColor = textureSum;\n";a+=" gl_FragColor.a = objectOpacity;\n";a+=" } else {\n";a+=" vec3 nNormal = normalize(fTransformedVertexNormal);\n";a+=" if (fVertexNormal == vec3(0.0,0.0,0.0)) {\n";a+=" gl_FragColor = vec4(fragmentColor,1.0);\n";a+=" return;\n";a+=" }\n";a+=" vec3 light = vec3(0.0, 0.0, 1.0);\n";a+=" vec3 lightDirection = vec3(0,0,-10);\n";a+=" lightDirection = normalize(lightDirection);\n";
a+=" vec3 eyeDirection = normalize(-fVertexPosition.xyz);\n";a+=" vec3 reflectionDirection = reflect(-lightDirection, nNormal);\n";a+=" float specular = pow(max(dot(reflectionDirection, eyeDirection), 0.0), 10.0);\n";a+=" float diffuse = 0.8 * max(dot(nNormal, light), 0.0);\n";a+=" float ambient = 0.3;\n";a+=" gl_FragColor = vec4(fragmentColor * ambient +\n";a+=" fragmentColor * diffuse +\n";a+=" vec3(0.2, 0.2, 0.2) * specular,\n";a+=" objectOpacity);\n";
a+=" }\n";this.Ud=a+="}\n"}C(df,M);
var ef={$k:"vertexPosition",Zk:"vertexNormal",Yk:"vertexColor",bl:"vertexTexturePos",al:"vertexScalar"},ff={cl:"view",Hk:"perspective",yk:"center",Gk:"objectTransform",Uk:"useObjectColor",Ek:"objectColor",Wk:"useScalars",Qk:"scalarsReplaceMode",Nk:"scalarsMin",Kk:"scalarsMax",Ok:"scalarsMinColor",Lk:"scalarsMaxColor",Pk:"scalarsMinThreshold",Mk:"scalarsMaxThreshold",Jk:"scalarsInterpolation",Ik:"pointSize",Fk:"objectOpacity",Dk:"normal",Vk:"usePicking",Xk:"useTexture",Tk:"useLabelMapTexture",Bk:"labelmapOpacity",
Ak:"labelmapColor",Rk:"textureSampler",Sk:"textureSampler2",dl:"volumeLowerThreshold",jl:"volumeUpperThreshold",gl:"volumeScalarMin",el:"volumeScalarMax",hl:"volumeScalarMinColor",fl:"volumeScalarMaxColor",ll:"volumeWindowLow",kl:"volumeWindowHigh",il:"volumeTexture"};function Xe(a){Y.call(this);this.f="slice";this.z=[0,0,0];this.gc=[0,0,1];this.V=[0,1,0];this.Oc=[1,0,0];this.A=this.K=10;this.nc=[0,1,0,0,1,1,1,1,1,0,0,0];this.e=this.yb=t;this.Bb=q;this.ec=[1,1,1];a!=t&&this.rc(a)}C(Xe,Y);Xe.prototype.rc=function(a){this.z=a.z.slice();this.gc=a.gc.slice();this.V=a.V.slice();this.K=a.K;this.A=a.A;this.yb=a.yb;this.e=a.e;this.Bb=a.Bb;this.ec=a.ec;this.Xh=a.Xh;Xe.u.rc.call(this,a)};Xe.prototype.__defineSetter__("height",ca("A"));
Xe.prototype.__defineSetter__("width",ca("K"));Xe.prototype.__defineGetter__("up",v("V"));Xe.prototype.__defineGetter__("right",v("Oc"));Xe.prototype.create=function(){this.Gb()};Xe.prototype.Ta=function(){Xe.u.Ta.call(this);this.z.length=0;this.gc.length=0;this.V.length=0;this.Oc.length=0;this.nc.length=0;this.e=this.yb=t;this.ec.length=0};
Xe.prototype.Gb=function(){var a=(new R(this.gc[0],this.gc[1],this.gc[2])).normalize(),b=new R(this.V[0],this.V[1],this.V[2]),c=new R(this.Oc[0],this.Oc[1],this.Oc[2]),e=new R(this.z[0],this.z[1],this.z[2]),d=Hc(c.l().Y().scale(this.K/2),b.l().Y().scale(this.A/2)),f=new R(d.x+e.x,d.y+e.y,d.d+e.d),d=Hc(c.l().Y().scale(this.K/2),b.l().scale(this.A/2)),g=new R(d.x+e.x,d.y+e.y,d.d+e.d),d=Hc(c.l().scale(this.K/2),b.l().Y().scale(this.A/2)),h=new R(d.x+e.x,d.y+e.y,d.d+e.d),d=Hc(c.l().scale(this.K/2),b.l().scale(this.A/
2)),b=new R(d.x+e.x,d.y+e.y,d.d+e.d);this.h=new W(18);this.n=new W(18);this.h.add(f.x,f.y,f.d);this.h.add(g.x,g.y,g.d);this.h.add(h.x,h.y,h.d);this.h.add(h.x,h.y,h.d);this.h.add(b.x,b.y,b.d);this.h.add(g.x,g.y,g.d);this.n.add(a.x,a.y,a.d);this.n.add(a.x,a.y,a.d);this.n.add(a.x,a.y,a.d);this.n.add(a.x,a.y,a.d);this.n.add(a.x,a.y,a.d);this.n.add(a.x,a.y,a.d);this.Bb&&(a=new Y,a.h=new W(24),a.n=new W(24),a.h.add(f.x,f.y,f.d),a.h.add(g.x,g.y,g.d),a.h.add(g.x,g.y,g.d),a.h.add(b.x,b.y,b.d),a.h.add(b.x,
b.y,b.d),a.h.add(h.x,h.y,h.d),a.h.add(h.x,h.y,h.d),a.h.add(f.x,f.y,f.d),a.n.add(0,0,0),a.n.add(0,0,0),a.n.add(0,0,0),a.n.add(0,0,0),a.n.add(0,0,0),a.n.add(0,0,0),a.n.add(0,0,0),a.n.add(0,0,0),a.w=[this.ec[0],this.ec[1],this.ec[2]],a.Ia="LINES",a.Lc=2,this.c.push(a))};A("X.slice",Xe);A("X.slice.prototype.create",Xe.prototype.create);A("X.slice.prototype.destroy",Xe.prototype.Ta);function P(a){Y.call(this);this.f="volume";this.z=[0,0,0];this.ca=[10,10,10];this.ma=[1,1,1];this.ud=[10,10,10];this.qb=[1,1,1];this.ib=[];this.Jc=this.Eb=this.Ic=this.Db=this.Hc=this.Cb=0;this.kc=new Y;this.lc=new Y;this.mc=new Y;this.ee=this.Ra=u;this.X=-1;this.de=[];this.e=t;this.Bb=q;this.fa=Infinity;this.ea=-Infinity;this.vg=q;this.ae=1;this.ia=0;this.J=t;this.b=[];this.s=[0,0,0];this.gb=[0,0,0];this.ad=[0,0,0];this.$=[];this.bg=[];this.$a=t;Fa(this,new xc);Fa(this,new jd);a!=t&&this.rc(a)}
C(P,Y);P.prototype.rc=function(a){this.z=a.z.slice();this.ca=a.ca.slice();this.qb=a.qb.slice();this.Cb=a.Cb;this.Hc=a.Hc;this.Db=a.Db;this.Ic=a.Ic;this.Eb=a.Eb;this.Jc=a.Jc;this.dg=a.dg.slice();this.kc=new Y(a.kc);this.lc=new Y(a.lc);this.mc=new Y(a.mc);this.ia=a.ia;this.J=a.J;this.Ra=a.Ra;this.ee=a.ee;this.X=a.X;this.e=a.e;this.Bb=a.Bb;P.u.rc.call(this,a)};
P.prototype.Gb=function(a){this.c.length=0;this.kc.c.length=0;this.lc.c.length=0;this.mc.c.length=0;this.c.push(this.kc);this.c.push(this.lc);this.c.push(this.mc);this.Ea=a.Ac;this.ad=a.Bc;this.gb=a.zc;this.Cc=a.cb;this.Qh=a.fb;this.ia=a.max;this.J=a.data;this.j=q};
P.prototype.Ta=function(){P.u.Ta.call(this);this.ib.length=0;this.c.length=0;this.kc.c.length=0;this.kc.length=0;this.lc.c.length=0;this.lc.length=0;this.mc.c.length=0;this.mc.length=0;this.J=t;this.ma.length=0;this.b.length=0;this.s.length=0;this.gb.length=0;this.ad.length=0;this.$.length=0;this.bg.length=0;this.$a=t};
P.prototype.q=function(a){a="undefined"!==typeof a?a:q;if(0<this.c.length){this.Ra!=this.ee&&(!this.Ra&&-1!=this.X&&(this.c[this.X].visible=u),this.j=q,this.ee=this.Ra);if(!this.O)return;for(var b=0,b=0;3>b;b++){var c=this.c[b],e=0,d=0;0==b?(e=this.Cb,d=this.Hc,this.Hc=this.Cb):1==b?(e=this.Db,d=this.Ic,this.Ic=this.Db):2==b&&(e=this.Eb,d=this.Jc,this.Jc=this.Eb);if(this.c[b].c[parseInt(e,10)]==t){var f=Mc();f[0]=this.b[b].k[0][0][0]+this.b[b].B[0]*parseInt(e,10);f[1]=this.b[b].k[0][0][1]+this.b[b].B[1]*
parseInt(e,10);f[2]=this.b[b].k[0][0][2]+this.b[b].B[2]*parseInt(e,10);if(this.L){var g=We(f,this.b[b].Ga,this.b[b].i,this.b[b].w,this.ma,this.e.$,this.e,this.e.L,this.e.xa.Ka);this.e.c[b].c[parseInt(e,10)]=g;this.e.c[b].q(q)}f=We(f,this.b[b].Ga,this.b[b].i,this.b[b].w,this.ma,this.$,this,q,t);this.L&&(f.e=f.G,f.e=this.e.c[b].c[parseInt(e,10)].G);c.c[parseInt(e,10)]=f;this.c[b].q(q)}d=c.c[parseInt(d,10)];this.Ra||(d.visible=u);c=c.c[parseInt(e,10)];c.visible=q;c.za=1;this.Ra&&(c.c[0].O=u,b!=this.X&&
(c.visible=u,c.za=0))}this.Ra&&-1!=this.X&&gf(this,this.X)}a&&P.u.q.call(this)};P.prototype.__defineGetter__("dimensions",v("ca"));P.prototype.__defineSetter__("dimensions",ca("ca"));P.prototype.__defineGetter__("spacing",v("qb"));P.prototype.__defineSetter__("spacing",ca("qb"));P.prototype.__defineGetter__("bbox",v("ma"));P.prototype.__defineGetter__("range",v("ud"));P.prototype.__defineGetter__("dimensionsRAS",v("dg"));P.prototype.__defineGetter__("volumeRendering",v("Ra"));
P.prototype.__defineSetter__("volumeRendering",function(a){this.Ra=a;this.q(u)});P.prototype.__defineGetter__("visible",v("O"));P.prototype.__defineSetter__("visible",function(a){if(a)this.O=a,this.q(u);else{for(var b=this.c,c=b.length,e=0,e=0;e<c;e++)b[e].visible=a;this.O=a;this.j=q}});P.prototype.__defineGetter__("center",v("z"));P.prototype.__defineSetter__("center",function(a){(a==t||!la(a)||3!=a.length)&&m(Error("Invalid center."));this.z=a});
P.prototype.__defineGetter__("volumeRenderingCache",v("de"));P.prototype.__defineSetter__("volumeRenderingCache",function(a){(a==t||!la(a)||!(3>=a.length))&&m(Error("Invalid volumeRederingCache."));this.de=a});P.prototype.__defineGetter__("image",v("ib"));P.prototype.__defineGetter__("labelmap",function(){this.e||(this.e=new hf(this));return this.e});P.prototype.__defineGetter__("indexX",v("Cb"));P.prototype.__defineSetter__("indexX",function(a){x(a)&&(0<=a&&a<this.kc.c.length)&&(this.Cb=a,this.q(u))});
P.prototype.__defineGetter__("indexY",v("Db"));P.prototype.__defineSetter__("indexY",function(a){x(a)&&(0<=a&&a<this.lc.c.length)&&(this.Db=a,this.q(u))});P.prototype.__defineGetter__("indexZ",v("Eb"));P.prototype.__defineSetter__("indexZ",function(a){x(a)&&(0<=a&&a<this.mc.c.length)&&(this.Eb=a,this.q(u))});P.prototype.__defineGetter__("windowLow",v("fa"));P.prototype.__defineSetter__("windowLow",ca("fa"));P.prototype.__defineGetter__("windowHigh",v("ea"));
P.prototype.__defineSetter__("windowHigh",ca("ea"));P.prototype.__defineGetter__("borders",v("Bb"));P.prototype.__defineSetter__("borders",ca("Bb"));P.prototype.__defineGetter__("reslicing",v("vg"));P.prototype.__defineSetter__("reslicing",ca("vg"));P.prototype.__defineGetter__("resolutionFactor",v("ae"));P.prototype.__defineSetter__("resolutionFactor",ca("ae"));P.prototype.__defineSetter__("xNormX",function(a){this.b[0].i[0]=a});P.prototype.__defineGetter__("xNormX",function(){return this.b[0].i[0]});
P.prototype.__defineSetter__("xNormY",function(a){this.b[0].i[1]=a});P.prototype.__defineGetter__("xNormY",function(){return this.b[0].i[1]});P.prototype.__defineSetter__("xNormZ",function(a){this.b[0].i[2]=a});P.prototype.__defineGetter__("xNormZ",function(){return this.b[0].i[2]});P.prototype.__defineSetter__("xColor",function(a){this.b[0].w=a});P.prototype.__defineGetter__("xColor",function(){return this.b[0].w});P.prototype.__defineSetter__("yNormX",function(a){this.b[1].i[0]=a});
P.prototype.__defineGetter__("yNormX",function(){return this.b[1].i[0]});P.prototype.__defineSetter__("yNormY",function(a){this.b[1].i[1]=a});P.prototype.__defineGetter__("yNormY",function(){return this.b[1].i[1]});P.prototype.__defineSetter__("yNormZ",function(a){this.b[1].i[2]=a});P.prototype.__defineGetter__("yNormZ",function(){return this.b[1].i[2]});P.prototype.__defineSetter__("yColor",function(a){this.b[1].w=a});P.prototype.__defineGetter__("yColor",function(){return this.b[1].w});
P.prototype.__defineSetter__("zNormX",function(a){this.b[2].i[0]=a});P.prototype.__defineGetter__("zNormX",function(){return this.b[2].i[0]});P.prototype.__defineSetter__("zNormY",function(a){this.b[2].i[1]=a});P.prototype.__defineGetter__("zNormY",function(){return this.b[2].i[1]});P.prototype.__defineSetter__("zNormZ",function(a){this.b[2].i[2]=a});P.prototype.__defineGetter__("zNormZ",function(){return this.b[2].i[2]});P.prototype.__defineSetter__("zColor",function(a){this.b[2].w=a});
P.prototype.__defineGetter__("zColor",function(){return this.b[2].w});
P.prototype.gk=function(a){this.c[a].visible=u;for(var b=0;b<this.c[a].c.length;b++)"undefined"!=typeof this.c[a].c[b]&&(this.L&&(this.e.c[a].c[b].remove(),this.e.c[a].c[b]=t),this.c[a].c[b].remove(),this.c[a].c[b]=t);Oc(this.b[a].i,this.b[a].i);Ye(a,this.b[a].vd,this.b[a].i,this);this.c[a].c=[];this.c[a].c=Array(this.b[a].p);this.L&&(b=We(this.b[a].vd,this.b[a].Ga,this.b[a].i,this.b[a].w,this.ma,this.e.$,this.e,this.e.L,this.e.xa.Ka),this.e.c[a].c=[],this.e.c[a].c=Array(this.b[a].p),this.e.c[a].c[Math.floor(this.b[a].p/
2)]=b,this.e.c[a].q());b=We(this.b[a].vd,this.b[a].Ga,this.b[a].i,this.b[a].w,this.ma,this.$,this,q,t);window.console.log("modified!");this.L&&(b.e=b.G,b.e=this.e.c[a].c[Math.floor(this.b[a].p/2)].G);this.c[a].c[Math.floor(this.b[a].p/2)]=b;0==a?(this.Cb=Math.floor(this.b[a].p/2),this.Hc=Math.floor(this.b[a].p/2)):1==a?(this.Db=Math.floor(this.b[a].p/2),this.Ic=Math.floor(this.b[a].p/2)):(this.Eb=Math.floor(this.b[a].p/2),this.Jc=Math.floor(this.b[a].p/2));this.c[a].q();this.c[a].c[Math.floor(this.b[a].p/
2)].O=q};
function gf(a,b){if(!a.Sd)if(!a.Ra||!a.j&&b==a.X)a.X=b;else if(-1==a.de.indexOf(b)){a.de.push(b);a.Sd=q;var c=new Pd;c.D=a;a.dispatchEvent(c);a.onComputing(b);setTimeout(function(){var a=t;0<=this.X&&(a=this.c[this.X],a.visible=u);var a=this.c[b],c=a.c.length,d=Math.floor(c/4),e;for(e=0;e<1*d;e++){if(a.c[e]==t){var j=Mc();j[0]=this.b[b].k[0][0][0]+this.b[b].B[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].B[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].B[2]*e;if(this.L){var k=We(j,this.b[b].Ga,this.b[b].i,this.b[b].w,
this.ma,this.e.$,this.e,this.e.L,this.e.xa.Ka);this.e.c[b].c[e]=k;this.e.c[b].q(q)}j=We(j,this.b[b].Ga,this.b[b].i,this.b[b].w,this.ma,this.$,this,q,t);j.c[0].O=u;this.L&&(j.e=j.G,j.e=this.e.c[b].c[e].G);a.c[e]=j}a.c[e].O=q}jf(this,0.25);setTimeout(function(){for(;e<2*d;e++){if(a.c[e]==t){var j=Mc();j[0]=this.b[b].k[0][0][0]+this.b[b].B[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].B[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].B[2]*e;if(this.L){var k=We(j,this.b[b].Ga,this.b[b].i,this.b[b].w,this.ma,this.e.$,
this.e,this.e.L,this.e.xa.Ka);this.e.c[b].c[e]=k;this.e.c[b].q(q)}j=We(j,this.b[b].Ga,this.b[b].i,this.b[b].w,this.ma,this.$,this,q,t);j.c[0].O=u;this.L&&(j.e=j.G,j.e=this.e.c[b].c[e].G);a.c[e]=j}a.c[e].O=q}jf(this,0.5);setTimeout(function(){for(;e<3*d;e++){if(a.c[e]==t){var j=Mc();j[0]=this.b[b].k[0][0][0]+this.b[b].B[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].B[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].B[2]*e;if(this.L){var k=We(j,this.b[b].Ga,this.b[b].i,this.b[b].w,this.ma,this.e.$,this.e,this.e.L,
this.e.xa.Ka);this.e.c[b].c[e]=k;this.e.c[b].q(q)}j=We(j,this.b[b].Ga,this.b[b].i,this.b[b].w,this.ma,this.$,this,q,t);j.c[0].O=u;this.L&&(j.e=j.G,j.e=this.e.c[b].c[e].G);a.c[e]=j}a.c[e].O=q}jf(this,0.75);setTimeout(function(){for(e=3*d;e<c;e++){if(a.c[e]==t){var j=Mc();j[0]=this.b[b].k[0][0][0]+this.b[b].B[0]*e;j[1]=this.b[b].k[0][0][1]+this.b[b].B[1]*e;j[2]=this.b[b].k[0][0][2]+this.b[b].B[2]*e;if(this.L){var k=We(j,this.b[b].Ga,this.b[b].i,this.b[b].w,this.ma,this.e.$,this.e,this.e.L,this.e.xa.Ka);
this.e.c[b].c[e]=k;this.e.c[b].q(q)}j=We(j,this.b[b].Ga,this.b[b].i,this.b[b].w,this.ma,this.$,this,q,t);j.c[0].O=u;this.L&&(j.e=j.G,j.e=this.e.c[b].c[e].G);a.c[e]=j}a.c[e].O=q}jf(this,1);setTimeout(function(){this.Sd&&this.c[b].q(q);this.X=b;this.j=u;if(this.Sd){var a=new Rd;a.D=this;this.dispatchEvent(a);this.onComputingEnd(b)}this.Sd=u}.bind(this),10)}.bind(this),10)}.bind(this),10)}.bind(this),10)}.bind(a),10)}else{c=a.c[a.X];c.visible=u;var c=a.c[b],e=c.c.length,d;for(d=0;d<e;d++)c.c[d].O=q;
a.X=b;a.j=u}}function jf(a,b){var c=new Qd;c.Ad=b;a.dispatchEvent(c);a.onComputingProgress(100*b)}P.prototype.Ef=aa();P.prototype.Gf=aa();P.prototype.Ff=aa();A("X.volume",P);A("X.volume.prototype.modified",P.prototype.q);A("X.volume.prototype.destroy",P.prototype.Ta);A("X.volume.prototype.sliceInfoChanged",P.prototype.gk);A("X.volume.prototype.onComputing",P.prototype.Ef);A("X.volume.prototype.onComputingProgress",P.prototype.Gf);A("X.volume.prototype.onComputingEnd",P.prototype.Ff);function kf(){Re.call(this);this.f="parserOFF"}C(kf,Re);
kf.prototype.parse=function(a,b,c){function e(){l===d&&m(Error("End of file reached unexpectedly."));for(var a=l;a<d;++a)if(10===f[a]){var b=Te(f,l,a);l=a+1;return b}l=d;return Te(f,l,d-1)}D.Ja(this.f+".parse");this.J=c;var d=c.byteLength,f=Z(this,"uchar",d);c=[];b.h=new W(d);b.n=new W(d);for(var g=b.h,h=b.n,l=0,j=e(),j=("OFF"===j?e():j).split(" "),k=j[0],j=j[1];k--;){var n=e(),n=n.split(" ");c.push([parseFloat(n[0]),parseFloat(n[1]),parseFloat(n[2])])}for(;j--;){var n=e(),n=n.split(" "),s=c[parseInt(n[1],
10)],k=c[parseInt(n[2],10)],n=c[parseInt(n[3],10)];g.add(s[0],s[1],s[2]);g.add(k[0],k[1],k[2]);g.add(n[0],n[1],n[2]);s=new R(s[0],s[1],s[2]);n=new R(n[0],n[1],n[2]);k=Ic((new R(k[0],k[1],k[2])).wa(s),n.wa(s));k.normalize();h.add(k.x,k.y,k.d);h.add(k.x,k.y,k.d);h.add(k.x,k.y,k.d)}D.Da(this.f+".parse");c=new ld;c.D=b;c.v=a;this.dispatchEvent(c)};A("X.parserOFF",kf);A("X.parserOFF.prototype.parse",kf.prototype.parse);function lf(){Re.call(this);this.f="parserDCM"}C(lf,Re);
lf.prototype.parse=function(a,b,c){b.yc={};b.yc.xf=0;this.vc(c,b);if(b.r.length==t||b.ta.length==b.r.length){b.yc.xf=b.r.length;var e={};c={};for(var d=0;d<b.ta.length;d++)e.hasOwnProperty(b.ta[d].series_instance_uid)||(e[b.ta[d].series_instance_uid]=[],c[b.ta[d].series_instance_uid]={}),c[b.ta[d].series_instance_uid].hasOwnProperty(b.ta[d].sop_instance_uid)||(c[b.ta[d].series_instance_uid][b.ta[d].sop_instance_uid]=q,e[b.ta[d].series_instance_uid].push(b.ta[d]));var f=Object.keys(e)[0],d=e[f],g=
d.length;c={};var h="image_position_patient";1==g?(h="image_position_patient",e[f][0].dist=0):d[0].image_position_patient[0]!=d[1].image_position_patient[0]||d[0].image_position_patient[1]!=d[1].image_position_patient[1]||d[0].image_position_patient[2]!=d[1].image_position_patient[2]?(h="image_position_patient",e=new R(d[0].image_orientation_patient[0],d[0].image_orientation_patient[1],d[0].image_orientation_patient[2]),f=new R(d[0].image_orientation_patient[3],d[0].image_orientation_patient[4],d[0].image_orientation_patient[5]),
e=Ic(e,f),d.map(function(a,b){b.dist=b.image_position_patient[0]*a.x+b.image_position_patient[1]*a.y+b.image_position_patient[2]*a.d;return b}.bind(t,e)),d.sort(function(a,b){return a.dist-b.dist})):d[0].instance_number!=d[1].instance_number?(h="instance_number",d.sort(function(a,b){return a.instance_number-b.instance_number})):window.console.log("Could not resolve the ordering mode");isNaN(d[0].pixel_spacing[0])&&(d[0].pixel_spacing[0]=1);isNaN(d[0].pixel_spacing[1])&&(d[0].pixel_spacing[1]=1);if(1<
g)switch(h){case "image_position_patient":var l=d[0].image_position_patient,e=d[1].image_position_patient,f=e[0]-l[0],j=e[1]-l[1],k=e[2]-l[2];d[0].pixel_spacing[2]=Math.sqrt(f*f+j*j+k*k);break;case "instance_number":d[0].pixel_spacing[2]=1;break;default:window.console.log("Unkown ordering mode - returning: "+h)}else d[0].pixel_spacing[2]=1;e=1;switch(h){case "image_position_patient":var l=d[0].image_position_patient,n=d[g-1].image_position_patient,f=n[0]-l[0],j=n[1]-l[1],k=n[2]-l[2],f=Math.sqrt(f*
f+j*j+k*k),e=e+Math.round(f/d[0].pixel_spacing[2]);break;case "instance_number":e+=Math.abs(d[g-1].instance_number-d[0].instance_number);break;default:window.console.log("Unkown ordering mode - returning: "+h)}l=d[0].columns*d[0].rows;f=l*e;n=t;switch(d[0].ff){case 8:n=new Uint8Array(f);break;case 16:n=new Uint16Array(f);break;case 32:n=new Uint32Array(f);default:window.console.log("Unknown number of bits allocated - using default: 32 bits")}b.qb=d[0].pixel_spacing;for(var s=0;s<g;s++){var r=d[s].data,
f=0;switch(h){case "image_position_patient":f=d[s].image_position_patient[0]-d[0].image_position_patient[0];j=d[s].image_position_patient[1]-d[0].image_position_patient[1];k=d[s].image_position_patient[2]-d[0].image_position_patient[2];f=Math.round(Math.sqrt(f*f+j*j+k*k)/d[0].pixel_spacing[2]);break;case "instance_number":f=d[s].instance_number-d[0].instance_number;break;default:window.console.log("Unkown ordering mode - returning: "+h)}n.set(r,f*l)}c.data=n;b.J=n;b.ca=[d[0].columns,d[0].rows,e];
c.zl=b.ca;e=Se(n);g=e[0];e=e[1];c.min=b.ra=b.fa=g;c.max=b.ia=b.ea=e;-Infinity==b.U&&(b.U=g);Infinity==b.W&&(b.W=e);j=d[0].image_position_patient;g=Rc();if("false"==b.reslicing||b.reslicing==u)T(g,0,d[0].pixel_spacing[0],0,0,0),T(g,1,0,d[0].pixel_spacing[1],0,0),T(g,2,0,0,d[0].pixel_spacing[2],0),T(g,3,0,0,0,1);else switch(h){case "image_position_patient":e=new R(d[0].image_orientation_patient[0],d[0].image_orientation_patient[1],d[0].image_orientation_patient[2]);f=new R(d[0].image_orientation_patient[3],
d[0].image_orientation_patient[4],d[0].image_orientation_patient[5]);e=Ic(e,f);T(g,0,-d[0].image_orientation_patient[0]*d[0].pixel_spacing[0],-d[0].image_orientation_patient[3]*d[0].pixel_spacing[1],-e.x*d[0].pixel_spacing[2],-j[0]);T(g,1,-d[0].image_orientation_patient[1]*d[0].pixel_spacing[0],-d[0].image_orientation_patient[4]*d[0].pixel_spacing[1],-e.y*d[0].pixel_spacing[2],-j[1]);T(g,2,d[0].image_orientation_patient[2]*d[0].pixel_spacing[0],d[0].image_orientation_patient[5]*d[0].pixel_spacing[1],
e.d*d[0].pixel_spacing[2],j[2]);T(g,3,0,0,0,1);break;case "instance_number":T(g,0,-1,0,0,-j[0]);T(g,1,-0,-1,-0,-j[1]);T(g,2,0,0,1,j[2]);T(g,3,0,0,0,1);break;default:window.console.log("Unkown ordering mode - returning: "+h)}c.cb=g;c.fb=Rc();ad(c.cb,c.fb);h=Qc(0,0,0,1);d=Pc();cd(g,h,d);h=Qc(1,1,1,1);e=Pc();cd(g,h,e);c.Bc=[e[0]-d[0],e[1]-d[1],e[2]-d[2]];d=Ue(g,[b.ca[0],b.ca[1],b.ca[2]]);c.zc=[d[1]-d[0]+1,d[3]-d[2]+1,d[5]-d[4]+1];c.Ac=[d[0],d[2],d[4]];b.Gb(c);b.ib=af(this,b)}c=new ld;c.D=b;c.v=a;this.dispatchEvent(c)};
function mf(a,b,c,e){switch(c){case 16975:case 20819:case 20053:case 22351:c=function(a){for(var b="",c=128;1<=c;c/=2)b+=a&c?"1":"0";return b};e=a[b++];a=a[b++];e=parseInt(c((a&65280)>>8)+c(a&255)+(c((e&65280)>>8)+c(e&255)),2);4294967295==e&&(e=0);b+=e/2;break;default:b+=e/2}return b}
lf.prototype.vc=function(a,b){this.J=a;if("undefined"==typeof b.ta||b.ta==t)b.ta=[];for(var c={pixel_spacing:[0.1,0.1,Infinity],image_orientation_patient:[1,0,0,0,1,0],image_position_patient:[0,0,0],transfer_syntax_uid:"no_transfer_syntax_uid"},e=Z(this,"ushort",this.J.byteLength),d=66,f=t,g=t,h=t,l=t;d<e.length;)switch(f=e[d++],g=e[d++],h=e[d++],l=e[d++],"1.2.840.10008.1.2"==c.transfer_syntax_uid&&0==l&&(l=h),f){case 2:switch(g){case 16:for(var j="",f=f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>
8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);c.transfer_syntax_uid=j.replace(/\0/g,"");break;default:d=mf(e,d,h,l)}break;case 40:switch(g){case 16:c.rows=e[d];d+=l/2;break;case 17:c.columns=e[d];d+=l/2;break;case 256:c.ff=e[d];d+=l/2;break;case 257:c.bits_stored=e[d];d+=l/2;break;case 2:c.number_of_images=e[d];d+=l/2;break;case 48:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);j=j.split("\\");c.pixel_spacing=[parseFloat(j[0]),parseFloat(j[1]),
Infinity];break;default:d=mf(e,d,h,l)}break;case 32:switch(g){case 14:c.series_instance_uid="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,c.series_instance_uid+=String.fromCharCode(g),c.series_instance_uid+=String.fromCharCode(h);break;case 19:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);c.instance_number=parseInt(j,10);break;case 50:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);
j=j.split("\\");c.image_position_patient=[parseFloat(j[0]),parseFloat(j[1]),parseFloat(j[2])];break;case 55:j="";for(f=0;f<l/2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,j+=String.fromCharCode(g),j+=String.fromCharCode(h);j=j.split("\\");c.image_orientation_patient=[parseFloat(j[0]),parseFloat(j[1]),parseFloat(j[2]),parseFloat(j[3]),parseFloat(j[4]),parseFloat(j[5])];break;default:d=mf(e,d,h,l)}break;case 65534:switch(g){default:l=0,d+=l/2}break;case 8:switch(g){case 24:c.sop_instance_uid="";for(f=0;f<l/
2;f++)h=e[d++],g=h&255,h=(h&65280)>>8,c.sop_instance_uid+=String.fromCharCode(g),c.sop_instance_uid+=String.fromCharCode(h);break;default:d=mf(e,d,h,l)}break;case 16:switch(g){case 8720:for(f=0;f<l/2;f++)d++;break;default:d=mf(e,d,h,l)}break;default:d=mf(e,d,h,l)}switch(c.ff){case 8:c.data=new Uint8Array(c.columns*c.rows);break;case 16:c.data=new Uint16Array(c.columns*c.rows);break;case 32:c.data=new Uint32Array(c.columns*c.rows)}this.C=this.J.byteLength-2*c.columns*c.rows;e=t;switch(c.ff){case 8:e=
Z(this,"uchar",c.columns*c.rows);break;case 16:e=Z(this,"ushort",c.columns*c.rows);break;case 32:e=Z(this,"uint",c.columns*c.rows)}c.data=e;b.ta.push(c);return b};A("X.parserDCM",lf);A("X.parserDCM.prototype.parse",lf.prototype.parse);function nf(){Re.call(this);this.f="parserVTK"}C(nf,Re);
nf.prototype.parse=function(a,b,c){D.Ja(this.f+".parse");var e=b.h,d=b.n,f=new Uint8Array(c),g="";b.h=e=new W(c.byteLength);b.n=d=new W(c.byteLength);c=0;for(var h=f.length;c<h;c+=32768)g+=Te(f,c,Math.min(c+32768,h));f=g.split("\n");g=f.length;this.yd=this.zd=t;this.hc=[];this.Pa=id;this.Se=this.Tb=this.Nb=this.Ub=u;c=0;for(h=g%8;h--;)of(this,f[c]),c++;for(h=0.125*g^0;h--;)of(this,f[c]),c++,of(this,f[c]),c++,of(this,f[c]),c++,of(this,f[c]),c++,of(this,f[c]),c++,of(this,f[c]),c++,of(this,f[c]),c++,
of(this,f[c]),c++;c=this.zd;var f=this.yd,g=f.length,l=h=this.hc.length;do{var j=this.hc[h-l],k=j.length,n;for(n=0;n<k&&!("LINES"==this.Pa&&n+1>=k);n++){var s=parseInt(j[n],10),r=c.get(s);e.add(r[0],r[1],r[2]);var y=s,z=r;"LINES"==this.Pa?(y=parseInt(j[n+1],10),z=c.get(y),e.add(z[0],z[1],z[2])):"TRIANGLE_STRIPS"==this.Pa&&(0==n||n==k-1)&&e.add(r[0],r[1],r[2]);s<g?(z=f.get(s),d.add(z[0],z[1],z[2]),"LINES"==this.Pa?(y=f.get(y),d.add(y[0],y[1],y[2])):"TRIANGLE_STRIPS"==this.Pa&&(0==n||n==k-1)&&d.add(z[0],
z[1],z[2])):(y=new R(r[0],r[1],r[2]),y.normalize(),d.add(y.x,y.y,y.d),"LINES"==this.Pa?(y=new R(z[0],z[1],z[2]),y.normalize(),d.add(y.x,y.y,y.d)):"TRIANGLE_STRIPS"==this.Pa&&(0==n||n==k-1)&&d.add(y.x,y.y,y.d))}l--}while(0<l);b.Ia=this.Pa;D.Da(this.f+".parse");e=new ld;e.D=b;e.v=a;this.dispatchEvent(e)};
function of(a,b){b=b.replace(/^\s+|\s+$/g,"");var c=b.split(" "),e=c.length,d=c[0];switch(d){case "POINTS":a.Ub=q;a.Nb=u;a.Tb=u;c=parseInt(c[1],10);a.zd=new W(3*c);a.yd=new W(3*c);return;case "VERTICES":a.Nb=q;a.Ub=u;a.Tb=u;c=parseInt(c[1],10);3<=c?a.Pa=id:1==c?a.Pa="POINTS":m(Error("This VTK file is not supported!"));a.hc=[];return;case "TRIANGLE_STRIPS":a.Nb=q;a.Ub=u;a.Tb=u;a.Pa="TRIANGLE_STRIPS";a.hc=[];return;case "LINES":a.Nb=q;a.Ub=u;a.Tb=u;a.Pa="LINES";a.hc=[];return;case "POLYGONS":a.Nb=q;
a.Ub=u;a.Tb=u;a.Pa="POLYGONS";a.hc=[];return;case "POINT_DATA":a.Tb=q;a.Ub=u;a.Nb=u;return}if(a.Ub)if(1==e||isNaN(parseFloat(d)))a.Ub=u;else{if(3<=e){var d=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]);a.zd.add(d,f,g)}6<=e&&(d=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.zd.add(d,f,g));9<=e&&(e=parseFloat(c[6]),d=parseFloat(c[7]),c=parseFloat(c[8]),a.zd.add(e,d,c))}else a.Nb?1==e||isNaN(parseFloat(d))?a.Nb=u:(c=c.slice(1),a.hc.push(c)):a.Tb&&("NORMALS"==d?a.Se=q:1==e||isNaN(parseFloat(d))?
(a.Tb=u,a.Se=u):a.Se&&(3<=e&&(d=parseFloat(c[0]),f=parseFloat(c[1]),g=parseFloat(c[2]),a.yd.add(d,f,g)),6<=e&&(d=parseFloat(c[3]),f=parseFloat(c[4]),g=parseFloat(c[5]),a.yd.add(d,f,g)),9<=e&&(e=parseFloat(c[6]),d=parseFloat(c[7]),c=parseFloat(c[8]),a.yd.add(e,d,c))))}A("X.parserVTK",nf);A("X.parserVTK.prototype.parse",nf.prototype.parse);function pf(){Re.call(this);this.f="parserFSM";this.Mc=u}C(pf,Re);
pf.prototype.parse=function(a,b,c){D.Ja(this.f+".parse");this.J=c;var e=b.h,d=b.n;b.Nc=[];var f=b.Nc;c=0;var g;do g=Z(this,"uchar"),c++;while(200>c&&10!=g);Z(this,"uchar");d=Z(this,"uint");c=Z(this,"uint");var h=Z(this,"float",3*d);g=Z(this,"uint",3*c);var l=new Uint32Array(d),j=new Float32Array(9*c);b.h=e=new W(9*c);b.n=d=new W(9*c);var k;for(k=0;k<c;k++){var n=3*k,s=g[n],r=g[n+1],y=g[n+2];f.push(s);f.push(r);f.push(y);l[s]+=1;l[r]+=1;l[y]+=1;var n=3*s,z=3*r,F=3*y,G=h[n],H=h[n+1],B=h[n+2],r=h[z],
y=h[z+1],s=h[z+2],E=h[F],I=h[F+1],N=h[F+2];e.add(G,H,B);e.add(r,y,s);e.add(E,I,N);G=new R(G,H,B);E=new R(E,I,N);r=(new R(r,y,s)).l().wa(G);y=E.l().wa(G);r=Ic(r,y).normalize();j[n]+=r.x;j[n+1]+=r.y;j[n+2]+=r.d;j[z]+=r.x;j[z+1]+=r.y;j[z+2]+=r.d;j[F]+=r.x;j[F+1]+=r.y;j[F+2]+=r.d}for(k=0;k<c;k++)n=3*k,s=g[n],r=g[n+1],y=g[n+2],n=3*s,z=3*r,F=3*y,f=new R(j[z],j[z+1],j[z+2]),h=new R(j[F],j[F+1],j[F+2]),n=(new R(j[n],j[n+1],j[n+2])).scale(1/l[s]).normalize(),f=f.scale(1/l[r]).normalize(),h=h.scale(1/l[y]).normalize(),
d.add(n.x,n.y,n.d),d.add(f.x,f.y,f.d),d.add(h.x,h.y,h.d);c=Z(this,"uchar",this.J.byteLength-this.C);g=t;for(n=0;n<c.length;n++)if(99==c[n]&&114==c[n+1]&&97==c[n+2]&&115==c[n+3]){for(d=g=n+9;10!=c[n]&&n<c.length;)d++,n++;g=Te(c.subarray(g,d)).split(" ");break}g&&(b.ja.Dh(parseFloat(g[0])),b.ja.Eh(parseFloat(g[1])),b.ja.Fh(parseFloat(g[2])));b.Ia=id;D.Da(this.f+".parse");c=new ld;c.D=b;c.v=a;this.dispatchEvent(c)};A("X.parserFSM",pf);A("X.parserFSM.prototype.parse",pf.prototype.parse);var qf={kf:function(a,b,c){return qf.update(a,0,b,c)},update:function(a,b,c,e){var d=qf.Mh,f="number"===typeof c?c:c=0;e="number"===typeof e?e:a.length;b^=4294967295;for(f=e&7;f--;++c)b=b>>>8^d[(b^a[c])&255];for(f=e>>3;f--;c+=8)b=b>>>8^d[(b^a[c])&255],b=b>>>8^d[(b^a[c+1])&255],b=b>>>8^d[(b^a[c+2])&255],b=b>>>8^d[(b^a[c+3])&255],b=b>>>8^d[(b^a[c+4])&255],b=b>>>8^d[(b^a[c+5])&255],b=b>>>8^d[(b^a[c+6])&255],b=b>>>8^d[(b^a[c+7])&255];return(b^4294967295)>>>0}};
qf.Mh=new Uint32Array([0,1996959894,3993919788,2567524794,124634137,1886057615,3915621685,2657392035,249268274,2044508324,3772115230,2547177864,162941995,2125561021,3887607047,2428444049,498536548,1789927666,4089016648,2227061214,450548861,1843258603,4107580753,2211677639,325883990,1684777152,4251122042,2321926636,335633487,1661365465,4195302755,2366115317,997073096,1281953886,3579855332,2724688242,1006888145,1258607687,3524101629,2768942443,901097722,1119000684,3686517206,2898065728,853044451,1172266101,
3705015759,2882616665,651767980,1373503546,3369554304,3218104598,565507253,1454621731,3485111705,3099436303,671266974,1594198024,3322730930,2970347812,795835527,1483230225,3244367275,3060149565,1994146192,31158534,2563907772,4023717930,1907459465,112637215,2680153253,3904427059,2013776290,251722036,2517215374,3775830040,2137656763,141376813,2439277719,3865271297,1802195444,476864866,2238001368,4066508878,1812370925,453092731,2181625025,4111451223,1706088902,314042704,2344532202,4240017532,1658658271,
366619977,2362670323,4224994405,1303535960,984961486,2747007092,3569037538,1256170817,1037604311,2765210733,3554079995,1131014506,879679996,2909243462,3663771856,1141124467,855842277,2852801631,3708648649,1342533948,654459306,3188396048,3373015174,1466479909,544179635,3110523913,3462522015,1591671054,702138776,2966460450,3352799412,1504918807,783551873,3082640443,3233442989,3988292384,2596254646,62317068,1957810842,3939845945,2647816111,81470997,1943803523,3814918930,2489596804,225274430,2053790376,
3826175755,2466906013,167816743,2097651377,4027552580,2265490386,503444072,1762050814,4150417245,2154129355,426522225,1852507879,4275313526,2312317920,282753626,1742555852,4189708143,2394877945,397917763,1622183637,3604390888,2714866558,953729732,1340076626,3518719985,2797360999,1068828381,1219638859,3624741850,2936675148,906185462,1090812512,3747672003,2825379669,829329135,1181335161,3412177804,3160834842,628085408,1382605366,3423369109,3138078467,570562233,1426400815,3317316542,2998733608,733239954,
1555261956,3268935591,3050360625,752459403,1541320221,2607071920,3965973030,1969922972,40735498,2617837225,3943577151,1913087877,83908371,2512341634,3803740692,2075208622,213261112,2463272603,3855990285,2094854071,198958881,2262029012,4057260610,1759359992,534414190,2176718541,4139329115,1873836001,414664567,2282248934,4279200368,1711684554,285281116,2405801727,4167216745,1634467795,376229701,2685067896,3608007406,1308918612,956543938,2808555105,3495958263,1231636301,1047427035,2932959818,3654703836,
1088359270,936918E3,2847714899,3736837829,1202900863,817233897,3183342108,3401237130,1404277552,615818150,3134207493,3453421203,1423857449,601450431,3009837614,3294710456,1567103746,711928724,3020668471,3272380065,1510334235,755167117]);function rf(a){var b=a.length,c=0,e=Number.POSITIVE_INFINITY,d,f,g,h,l,j,k,n,s;for(n=0;n<b;++n)a[n]>c&&(c=a[n]),a[n]<e&&(e=a[n]);d=1<<c;f=new Uint32Array(d);g=1;h=0;for(l=2;g<=c;){for(n=0;n<b;++n)if(a[n]===g){j=0;k=h;for(s=0;s<g;++s)j=j<<1|k&1,k>>=1;for(s=j;s<d;s+=l)f[s]=g<<16|n;++h}++g;h<<=1;l<<=1}return[f,c,e]};function sf(a,b){this.gf=[];this.hf=32768;this.rb=this.Bd=this.M=this.Vf=0;this.input=new Uint8Array(a);this.Ag=u;this.jf=tf;this.Jb=u;if(b||!(b={}))b.index&&(this.M=b.index),b.bufferSize&&(this.hf=b.bufferSize),b.bufferType&&(this.jf=b.bufferType),b.resize&&(this.Jb=b.resize);switch(this.jf){case uf:this.la=32768;this.Ua=new Uint8Array(32768+this.hf+258);break;case tf:this.la=0;this.Ua=new Uint8Array(this.hf);this.tc=this.xi;this.Dg=this.mi;this.qf=this.ri;break;default:m(Error("invalid inflate mode"))}}
var uf=0,tf=1;
sf.prototype.Yb=function(){for(;!this.Ag;){var a=vf(this,3);a&1&&(this.Ag=q);a>>>=1;switch(a){case 0:var a=this.input,b=this.M,c=this.Ua,e=this.la,d=p,f=p,g=p,h=c.length,d=p;this.rb=this.Bd=0;d=a[b++];d===p&&m(Error("invalid uncompressed block header: LEN (first byte)"));f=d;d=a[b++];d===p&&m(Error("invalid uncompressed block header: LEN (second byte)"));f|=d<<8;d=a[b++];d===p&&m(Error("invalid uncompressed block header: NLEN (first byte)"));g=d;d=a[b++];d===p&&m(Error("invalid uncompressed block header: NLEN (second byte)"));g|=
d<<8;f===~g&&m(Error("invalid uncompressed block header: length verify"));b+f>a.length&&m(Error("input buffer is broken"));switch(this.jf){case uf:for(;e+f>c.length;)d=h-e,f-=d,c.set(a.subarray(b,b+d),e),e+=d,b+=d,this.la=e,c=this.tc(),e=this.la;break;case tf:for(;e+f>c.length;)c=this.tc({Jg:2});break;default:m(Error("invalid inflate mode"))}c.set(a.subarray(b,b+f),e);e+=f;this.M=b+=f;this.la=e;this.Ua=c;break;case 1:this.qf(wf,xf);break;case 2:yf(this);break;default:m(Error("unknown BTYPE: "+a))}}return this.Dg()};
var zf=new Uint16Array([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Af=new Uint16Array([3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,258,258]),Bf=new Uint8Array([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0]),Cf=new Uint16Array([1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577]),Df=new Uint8Array([0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13]),Ef=new Uint8Array(288),
Ff,Gf;Ff=0;for(Gf=Ef.length;Ff<Gf;++Ff)Ef[Ff]=143>=Ff?8:255>=Ff?9:279>=Ff?7:8;var wf=rf(Ef),Hf=new Uint8Array(30),If,Jf;If=0;for(Jf=Hf.length;If<Jf;++If)Hf[If]=5;var xf=rf(Hf);function vf(a,b){for(var c=a.Bd,e=a.rb,d=a.input,f=a.M,g;e<b;)g=d[f++],g===p&&m(Error("input buffer is broken")),c|=g<<e,e+=8;g=c&(1<<b)-1;a.Bd=c>>>b;a.rb=e-b;a.M=f;return g}
function Kf(a,b){for(var c=a.Bd,e=a.rb,d=a.input,f=a.M,g=b[0],h=b[1],l;e<h;)l=d[f++],l===p&&m(Error("input buffer is broken")),c|=l<<e,e+=8;d=g[c&(1<<h)-1];g=d>>>16;a.Bd=c>>g;a.rb=e-g;a.M=f;return d&65535}
function yf(a){function b(a,b,c){var d,e,f;for(f=0;f<a;)switch(d=Kf(this,b),d){case 16:for(d=3+vf(this,2);d--;)c[f++]=e;break;case 17:for(d=3+vf(this,3);d--;)c[f++]=0;e=0;break;case 18:for(d=11+vf(this,7);d--;)c[f++]=0;e=0;break;default:e=c[f++]=d}return c}var c=vf(a,5)+257,e=vf(a,5)+1,d=vf(a,4)+4,f=new Uint8Array(zf.length),g;for(g=0;g<d;++g)f[zf[g]]=vf(a,3);d=rf(f);f=new Uint8Array(c);g=new Uint8Array(e);a.qf(rf(b.call(a,c,d,f)),rf(b.call(a,e,d,g)))}w=sf.prototype;
w.qf=function(a,b){var c=this.Ua,e=this.la;this.Gg=a;for(var d=c.length-258,f,g,h;256!==(f=Kf(this,a));)if(256>f)e>=d&&(this.la=e,c=this.tc(),e=this.la),c[e++]=f;else{f-=257;h=Af[f];0<Bf[f]&&(h+=vf(this,Bf[f]));f=Kf(this,b);g=Cf[f];0<Df[f]&&(g+=vf(this,Df[f]));e>=d&&(this.la=e,c=this.tc(),e=this.la);for(;h--;)c[e]=c[e++-g]}for(;8<=this.rb;)this.rb-=8,this.M--;this.la=e};
w.ri=function(a,b){var c=this.Ua,e=this.la;this.Gg=a;for(var d=c.length,f,g,h;256!==(f=Kf(this,a));)if(256>f)e>=d&&(c=this.tc(),d=c.length),c[e++]=f;else{f-=257;h=Af[f];0<Bf[f]&&(h+=vf(this,Bf[f]));f=Kf(this,b);g=Cf[f];0<Df[f]&&(g+=vf(this,Df[f]));e+h>d&&(c=this.tc(),d=c.length);for(;h--;)c[e]=c[e++-g]}for(;8<=this.rb;)this.rb-=8,this.M--;this.la=e};
w.tc=function(){var a=new Uint8Array(this.la-32768),b=this.la-32768,c=this.Ua;a.set(c.subarray(32768,a.length));this.gf.push(a);this.Vf+=a.length;c.set(c.subarray(b,b+32768));this.la=32768;return c};w.xi=function(a){var b=this.input.length/this.M+1|0,c=this.input,e=this.Ua;a&&("number"===typeof a.Jg&&(b=a.Jg),"number"===typeof a.fi&&(b+=a.fi));2>b?(a=(c.length-this.M)/this.Gg[2],a=258*(a/2)|0,a=a<e.length?e.length+a:e.length<<1):a=e.length*b;a=new Uint8Array(a);a.set(e);return this.Ua=a};
w.Dg=function(){var a=0,b=this.Ua,c=this.gf,e,d=new Uint8Array(this.Vf+(this.la-32768)),f,g,h,l;if(0===c.length)return this.Ua.subarray(32768,this.la);f=0;for(g=c.length;f<g;++f){e=c[f];h=0;for(l=e.length;h<l;++h)d[a++]=e[h]}f=32768;for(g=this.la;f<g;++f)d[a++]=b[f];this.gf=[];return this.buffer=d};w.mi=function(){var a,b=this.la;this.Jb?(a=new Uint8Array(b),a.set(this.Ua.subarray(0,b))):a=this.Ua.subarray(0,b);return this.buffer=a};new Uint8Array(256);var Lf;for(Lf=0;256>Lf;++Lf)for(var Mf=Lf,Nf=7,Mf=Mf>>>1;Mf;Mf>>>=1)--Nf;var Of=[],Pf;for(Pf=0;288>Pf;Pf++)switch(q){case 143>=Pf:Of.push([Pf+48,8]);break;case 255>=Pf:Of.push([Pf-144+400,9]);break;case 279>=Pf:Of.push([Pf-256+0,7]);break;case 287>=Pf:Of.push([Pf-280+192,8]);break;default:m("invalid literal: "+Pf)}
function Qf(){var a=Rf;switch(q){case 3===a:return[257,a-3,0];case 4===a:return[258,a-4,0];case 5===a:return[259,a-5,0];case 6===a:return[260,a-6,0];case 7===a:return[261,a-7,0];case 8===a:return[262,a-8,0];case 9===a:return[263,a-9,0];case 10===a:return[264,a-10,0];case 12>=a:return[265,a-11,1];case 14>=a:return[266,a-13,1];case 16>=a:return[267,a-15,1];case 18>=a:return[268,a-17,1];case 22>=a:return[269,a-19,2];case 26>=a:return[270,a-23,2];case 30>=a:return[271,a-27,2];case 34>=a:return[272,a-
31,2];case 42>=a:return[273,a-35,3];case 50>=a:return[274,a-43,3];case 58>=a:return[275,a-51,3];case 66>=a:return[276,a-59,3];case 82>=a:return[277,a-67,4];case 98>=a:return[278,a-83,4];case 114>=a:return[279,a-99,4];case 130>=a:return[280,a-115,4];case 162>=a:return[281,a-131,5];case 194>=a:return[282,a-163,5];case 226>=a:return[283,a-195,5];case 257>=a:return[284,a-227,5];case 258===a:return[285,a-258,0];default:m("invalid length: "+a)}}var Sf=[],Rf,Tf;
for(Rf=3;258>=Rf;Rf++)Tf=Qf(),Sf[Rf]=Tf[2]<<24|Tf[1]<<16|Tf[0];new Uint32Array(Sf);function Uf(){};function Vf(a){this.input=a;this.M=0;this.member=[]}
Vf.prototype.Yb=function(){for(var a=this.input.length;this.M<a;){var b=new Uf,c=p,e=p,d=p,f=c=d=p,g=p,c=c=p,h=this.input,e=this.M;b.Pg=h[e++];b.Qg=h[e++];(31!==b.Pg||139!==b.Qg)&&m(Error("invalid file signature:",b.Pg,b.Qg));b.Cg=h[e++];switch(b.Cg){case 8:break;default:m(Error("unknown compression method: "+b.Cg))}b.me=h[e++];c=h[e++]|h[e++]<<8|h[e++]<<16|h[e++]<<24;b.Ml=new Date(1E3*c);b.Xl=h[e++];b.Rl=h[e++];0<(b.me&4)&&(b.Ge=h[e++]|h[e++]<<8,e+=b.Ge);if(0<(b.me&8)){g=[];for(f=0;0<(c=h[e++]);)g[f++]=
String.fromCharCode(c);b.name=g.join("")}if(0<(b.me&16)){g=[];for(f=0;0<(c=h[e++]);)g[f++]=String.fromCharCode(c);b.comment=g.join("")}0<(b.me&2)&&(b.ni=qf.kf(h,0,e)&65535,b.ni!==(h[e++]|h[e++]<<8)&&m(Error("invalid header crc16")));c=h[h.length-4]|h[h.length-3]<<8|h[h.length-2]<<16|h[h.length-1]<<24;h.length-e-4-4<512*c&&(d=c);e=new sf(h,{index:e,bufferSize:d});b.data=d=e.Yb();e=e.M;b.wl=c=(h[e++]|h[e++]<<8|h[e++]<<16|h[e++]<<24)>>>0;qf.kf(d)!==c&&m(Error("invalid CRC-32 checksum: 0x"+qf.kf(d).toString(16)+
" / 0x"+c.toString(16)));b.Fl=c=(h[e++]|h[e++]<<8|h[e++]<<16|h[e++]<<24)>>>0;(d.length&4294967295)!==c&&m(Error("invalid input size: "+(d.length&4294967295)+" / "+c));this.member.push(b);this.M=e}a=this.member;b=d=e=0;for(h=a.length;b<h;++b)d+=a[b].data.length;d=new Uint8Array(d);for(b=0;b<h;++b)d.set(a[b].data,e),e+=a[b].data.length;return d};function Wf(){Re.call(this);this.f="parserMGZ";this.Mc=u}C(Wf,Re);
Wf.prototype.parse=function(a,b,c,e){D.Ja(this.f+".parse");window.console.log(b);e&&(c=(new Vf(new Uint8Array(c))).Yb(),c=c.buffer);e=this.vc(c);var d=[e.Af,e.Bf,e.Cf];b.ca=d;var f=e.Gh;b.qb=f;c=e.min;var g=e.max;b.ra=b.fa=c;b.ia=b.ea=g;-Infinity==b.U&&(b.U=c);Infinity==b.W&&(b.W=g);c=Rc();if("false"==b.reslicing||b.reslicing==u)T(c,0,b.qb[0],0,0,0),T(c,1,0,b.qb[1],0,0),T(c,2,0,0,b.qb[2],0),T(c,3,0,0,0,1),Uc(c,0,0,0,1);else{T(c,0,e.eb[0][0],e.eb[1][0],e.eb[2][0],0);T(c,1,e.eb[0][1],e.eb[1][1],e.eb[2][1],
0);T(c,2,e.eb[0][2],e.eb[1][2],e.eb[2][2],0);T(c,3,0,0,0,1);for(var g=d[0]/2,h=d[1]/2,d=d[2]/2,l=[0,0,0],j=0;3>j;++j)l[j]=e.eb[3][j]-(c[j+0]*f[0]*g+c[j+4]*f[1]*h+c[j+8]*f[2]*d);Uc(c,l[0],l[1],l[2],1)}e.cb=c;e.fb=Rc();ad(e.cb,e.fb);g=Qc(0,0,0,1);f=Pc();cd(c,g,f);h=Qc(1,1,1,1);g=Pc();cd(c,h,g);c=Ue(c,b.ca);e.Bc=[g[0]-f[0],g[1]-f[1],g[2]-f[2]];e.zc=[c[1]-c[0]+1,c[3]-c[2]+1,c[5]-c[4]+1];e.Ac=[c[0],c[2],c[4]];b.Gb(e);D.Da(this.f+".parse");b.ib=af(this,b);e=new ld;e.D=b;e.v=a;this.dispatchEvent(e)};
Wf.prototype.vc=function(a){this.J=a;a={version:0,Ph:0,Nh:0,Ei:0,Oh:0,Af:0,Bf:0,Cf:0,nj:0,type:0,vi:0,vh:0,Ck:t,eb:t,Gh:t,data:t,min:Infinity,max:-Infinity};a.version=Z(this,"uint");a.Af=Z(this,"uint");a.Bf=Z(this,"uint");a.Cf=Z(this,"uint");a.nj=Z(this,"uint");a.type=Z(this,"uint");a.vi=Z(this,"uint");a.vh=Z(this,"ushort");if(0<a.vh){a.Gh=Z(this,"float",3);var b=[];b.push(Z(this,"float",3));b.push(Z(this,"float",3));b.push(Z(this,"float",3));b.push(Z(this,"float",3));a.eb=b}this.C=284;b=a.Af*a.Bf*
a.Cf;switch(a.type){case 0:a.data=Z(this,"uchar",b);break;case 1:a.data=Z(this,"uint",b);break;case 3:a.data=Z(this,"float",b);break;case 4:a.data=Z(this,"ushort",b);break;default:m(Error("Unsupported MGH/MGZ data type: "+a.type))}b=Se(a.data);a.min=b[0];a.max=b[1];this.C+16<this.J.byteLength&&(a.Ph=Z(this,"float"),a.Ei=Z(this,"float"),a.Nh=Z(this,"float"),a.Oh=Z(this,"float"));return a};A("X.parserMGZ",Wf);A("X.parserMGZ.prototype.parse",Wf.prototype.parse);function Xf(){Re.call(this);this.f="parserLBL"}C(Xf,Re);
Xf.prototype.parse=function(a,b,c){D.Ja(this.f+".parse");var e=b.Nc,d=e.length;0==d&&m(Error("No _pointIndices defined on the X.object."));this.J=c;var f=[],g=Z(this,"uchar",c.byteLength),h=g.length,l=u,j=0;for(c=1;c<h;c++)10==g[c-1]?(j=c,l=q):l&&32==g[c]&&(f.push(parseInt(Te(g,j,c),10)),l=u);g=b.F.I?b.F.I:new Float32Array(d);h=f.length;for(c=0;c<h;c++)g[f[c]]=1;f=new Float32Array(3*d);for(c=h=0;c<d;c++)l=e[c],l>d&&m(Error("Could not find scalar for vertex.")),l=g[l],f[h++]=l,f[h++]=l,f[h++]=l;b.F.I=
g;b.F.dd=f;b.F.j=q;D.Da(this.f+".parse");e=new ld;e.D=b;e.v=a;this.dispatchEvent(e)};A("X.parserLBL",Xf);A("X.parserLBL.prototype.parse",Xf.prototype.parse);function Yf(){Re.call(this);this.f="parserCRV";this.Mc=u}C(Yf,Re);
Yf.prototype.parse=function(a,b,c){D.Ja(this.f+".parse");var e=b.Nc;0==e.length&&m(Error("No _pointIndices defined on the X.object."));this.J=c;this.C=3;var d=Z(this,"uint");Z(this,"uint");Z(this,"uint");var f=0,g=0,h=0,l=0,j=0,k=0,n=0,s=0,r=0,y=0,z=0;c=Array(2);var F=Array(2),G=Z(this,"float",d),H;for(H=0;H<d;H++){var B=G[H];0==H&&(c[0]=F[0]=B);0<=B?(f++,l+=B):(g++,h+=B);r+=B;z++;F[0]=Math.max(B,F[0]);c[0]=Math.min(B,c[0]);G[H]=B}0!=f&&(j=l/f);0!=g&&(k=h/g);0!=z&&(y=r/z);for(z=r=h=l=0;z<d;z++)B=
G[z],H=0,0<=B?(H=Math.pow(B-j,2),l+=H):(H=Math.pow(B-k,2),h+=H),H=Math.pow(B-y,2),r+=H;1<f&&(n=Math.sqrt(l/(f-1)));1<g&&(s=Math.sqrt(h/(g-1)));c[1]=k-2.5*s;F[1]=j+2.5*n;d=e.length;f=new Float32Array(3*d);for(z=0;z<d;z++)g=G[e[z]],h=3*z,f[h]=g,f[h+1]=g,f[h+2]=g;b.F.ra=c[1];b.F.ia=F[1];-Infinity==b.F.U&&(b.F.U=c[1]);Infinity==b.F.W&&(b.F.W=F[1]);b.F.I=G;b.F.dd=f;b.F.j=q;D.Da(this.f+".parse");e=new ld;e.D=b;e.v=a;this.dispatchEvent(e)};A("X.parserCRV",Yf);A("X.parserCRV.prototype.parse",Yf.prototype.parse);function Zf(a,b){var c,e;this.input=a;this.M=0;if(b||!(b={}))b.index&&(this.M=b.index),b.verify&&(this.tk=b.verify);c=a[this.M++];e=a[this.M++];switch(c&15){case 8:this.method=8;break;default:m(Error("unsupported compression method"))}0!==((c<<8)+e)%31&&m(Error("invalid fcheck flag:"+((c<<8)+e)%31));e&32&&m(Error("fdict flag is not supported"));this.wh=new sf(a,{index:this.M,bufferSize:b.bufferSize,bufferType:b.bufferType,resize:b.resize})}
Zf.prototype.Yb=function(){var a=this.input,b;b=this.wh.Yb();this.M=this.wh.M;if(this.tk){var a=(a[this.M++]<<24|a[this.M++]<<16|a[this.M++]<<8|a[this.M++])>>>0,c=b;if("string"===typeof c){var c=c.split(""),e,d;e=0;for(d=c.length;e<d;e++)c[e]=(c[e].charCodeAt(0)&255)>>>0}e=1;d=0;for(var f=c.length,g,h=0;0<f;){g=1024<f?1024:f;f-=g;do e+=c[h++],d+=e;while(--g);e%=65521;d%=65521}a!==(d<<16|e)>>>0&&m(Error("invalid adler-32 checksum"))}return b};function $f(){Re.call(this);this.f="parserRAW"}C($f,Re);
$f.prototype.parse=function(a,b,c,e){D.Ja(this.f+".parse");e&&(c=(new Zf(new Uint8Array(c))).Yb(),c=c.buffer);e={};e.data=new Uint8Array(c);var d=Se(e.data);c=d[0];d=d[1];e.min=b.ra=b.fa=c;e.max=b.ia=b.ea=d;-Infinity==b.U&&(b.U=c);Infinity==b.W&&(b.W=d);d=Sc();e.cb=d;e.fb=Sc();var f=Qc(0,0,0,1);c=Pc();cd(d,f,c);var g=Qc(1,1,1,1),f=Pc();cd(d,g,f);d=Ue(d,b.ca);e.Bc=[f[0]-c[0],f[1]-c[1],f[2]-c[2]];e.zc=[d[1]-d[0]+1,d[3]-d[2]+1,d[5]-d[4]+1];e.Ac=[d[0],d[2],d[4]];b.Gb(e);D.Da(this.f+".parse");b.ib=af(this,
b);e=new ld;e.D=b;e.v=a;this.dispatchEvent(e)};A("X.parserRAW",$f);A("X.parserRAW.prototype.parse",$f.prototype.parse);function ag(){Re.call(this);this.f="parserLUT"}C(ag,Re);
ag.prototype.parse=function(a,b,c){D.Ja(this.f+".parse");this.J=c;c=Z(this,"uchar",c.byteLength);var e=c.length,d=0,f;for(f=0;f<e;f++)if(10==c[f]){var g=Te(c,d,f),d=f+1,g=g.replace(/^\s+|\s+$/g,"");"#"!=g[0]&&(g=g.split(" "),g=g.filter(function(a){return""!=a}),6==g.length&&(g[2]=parseInt(g[2],10)/255,g[3]=parseInt(g[3],10)/255,g[4]=parseInt(g[4],10)/255,g[5]=parseInt(g[5],10)/255,a.add(parseInt(g[0],10),g[1],g[2],g[3],g[4],g[5],10)))}D.Da(this.f+".parse");c=new ld;c.D=b;c.v=a;this.dispatchEvent(c)};
A("X.parserLUT",ag);A("X.parserLUT.prototype.parse",ag.prototype.parse);function bg(){Re.call(this);this.f="parserMRC"}C(bg,Re);
bg.prototype.parse=function(a,b,c){D.Ja(this.f+".parse");c=this.vc(c);var e=c.min,d=c.max;b.ca=[c.Hd,c.Id,c.Jd];b.qb=[c.Ge/c.bh,c.Jh/c.dh,c.Kh/c.eh];b.ra=b.fa=e;b.ia=b.ea=d;-Infinity==b.U&&(b.U=e);Infinity==b.W&&(b.W=d);d=Rc();T(d,3,0,0,0,1);T(d,0,-1,0,0,c.Hd);T(d,1,0,0,-1,c.Id);T(d,2,0,-1,0,c.Jd);c.cb=d;c.fb=Rc();ad(c.cb,c.fb);var f=Qc(0,0,0,1),e=Pc();cd(d,f,e);var g=Qc(1,1,1,1),f=Pc();cd(d,g,f);g=[c.Hd,c.Id,c.Jd];d=Ue(d,g);c.Bc=[f[0]-e[0],f[1]-e[1],f[2]-e[2]];c.zc=[d[1]+d[0]+1,d[3]-d[2]+1,d[5]-
d[4]+1];c.Ac=[d[0],d[2],d[4]];b.ca=g;b.Gb(c);b.ib=af(this,b);D.Da(this.f+".parse");c=new ld;c.D=b;c.v=a;this.dispatchEvent(c)};
bg.prototype.vc=function(a){this.J=a;a={Hd:0,Id:0,Jd:0,mode:0,Ol:0,Pl:0,Ql:0,bh:0,dh:0,eh:0,Ge:0,Jh:0,Kh:0,alpha:0,ii:0,Fi:0,fj:0,gj:0,hj:0,ef:0,he:0,qc:0,Hl:0,next:0,oi:0,zi:t,oj:0,qj:0,zi:t,Ti:0,El:0,Ri:0,bj:0,kj:0,lj:0,rk:0,sk:0,ok:t,uk:0,wk:0,xk:0,vl:0,Wl:0,ak:0,pj:0,data:t,min:Infinity,max:-Infinity,Ll:0,zh:t,Vl:t,Tl:t,orientation:t,Nl:t};this.C=0;a.Hd=Z(this,"sint");a.Id=Z(this,"sint");a.Jd=Z(this,"sint");a.mode=Z(this,"sint");var b=a.Hd*a.Id*a.Jd;this.C=1024;switch(a.mode){case 0:a.data=Z(this,
"schar",b);break;case 1:a.data=Z(this,"sshort",b);break;case 2:a.data=Z(this,"float",b);break;case 3:a.data=Z(this,"uint",b);break;case 4:a.data=Z(this,"double",b);break;case 6:a.data=Z(this,"ushort",b);break;case 16:a.data=Z(this,"uchar",b);break;default:m(Error("Unsupported MRC data type: "+a.mode))}this.C=28;a.bh=Z(this,"sint");a.dh=Z(this,"sint");a.eh=Z(this,"sint");a.Ge=Z(this,"float");a.Jh=Z(this,"float");a.Kh=Z(this,"float");a.alpha=Z(this,"float");a.ii=Z(this,"float");a.Fi=Z(this,"float");
a.fj=Z(this,"sint");a.gj=Z(this,"sint");a.hj=Z(this,"sint");a.ef=Z(this,"float");a.he=Z(this,"float");a.qc=Z(this,"float");a.Gl=Z(this,"sint");a.next=Z(this,"sint");a.oi=Z(this,"short");a.oj=Z(this,"short");a.qj=Z(this,"short");a.Ti=Z(this,"sint");a.Dl=Z(this,"sint");a.Ri=Z(this,"short");a.bj=Z(this,"short");a.kj=Z(this,"short");a.lj=Z(this,"short");a.rk=Z(this,"short");a.sk=Z(this,"short");a.ok=Z(this,"float",6);this.C=196;a.uk=Z(this,"float");a.wk=Z(this,"float");a.xk=Z(this,"float");this.C=216;
a.ak=Z(this,"float");a.pj=Z(this,"sint");a.Il=Z(this,"schar",10);if(0!=a.next)switch(this.C=parseInt(a.next+1024,10),a.mode){case 0:a.data=Z(this,"schar",b);break;case 1:a.data=Z(this,"sshort",b);break;case 2:a.data=Z(this,"float",b);break;case 3:a.data=Z(this,"uint",b);break;case 4:a.data=Z(this,"double",b);break;case 6:a.data=Z(this,"ushort",b);break;case 16:a.data=Z(this,"uchar",b);break;default:m(Error("Unsupported MRC data type: "+a.mode))}0>a.qc-(a.he-a.qc)?(a.min=a.ef,a.max=a.qc+(a.qc-a.ef)):
(a.min=a.qc-(a.he-a.qc),a.max=a.he);return a};A("X.parserMRC",bg);A("X.parserMRC.prototype.parse",bg.prototype.parse);function cg(){Re.call(this);this.f="parserNRRD"}C(cg,Re);
cg.prototype.parse=function(a,b,c){D.Ja(this.f+".parse");this.J=c;c=Z(this,"uchar",c.byteLength);var e=c.length,d=t,f=0,g;for(g=1;g<e;g++)if(10==c[g-1]&&10==c[g]){d=Te(c,0,g-2);f=g+1;break}var h,l,j,k,e=d.split(/\r?\n/),d=0;for(g=e.length;d<g;d++)if(h=e[d],h.match(/NRRD\d+/))this.$i=q;else if(!h.match(/^#/)&&(k=h.match(/(.*):(.*)/)))l=k[1].trim(),h=k[2].trim(),(j=this.Ai[l])?j.call(this,h):this[l]=h;this.$i||m(Error("Not an NRRD file"));"raw"!==this.encoding&&("gzip"!==this.encoding&&"gz"!==this.encoding)&&
m(Error("Only raw or gz/gzip encoding is allowed"));if(!this.ha&&(this.ha=[new R(1,0,0),new R(0,1,0),new R(0,0,1)],this.Tf)){e=[];for(k=0;2>=k;k++)e.push(!isNaN(this.Tf[k])?this.ha[k].scale(this.Tf[k]):p)}f=c.subarray(f);if("gzip"==this.encoding||"gz"==this.encoding)f=(new Vf(new Uint8Array(f))).Yb();f=f.buffer;c={data:t,min:Infinity,max:-Infinity};c.data=new this.Mb(f);k=Se(c.data);f=c.min=k[0];k=c.max=k[1];b.ra=b.fa=f;b.ia=b.ea=k;b.ca=[this.Rf[0],this.Rf[1],this.Rf[2]];e=(new R(this.ha[0][0],this.ha[0][1],
this.ha[0][2])).Ib();d=(new R(this.ha[1][0],this.ha[1][1],this.ha[1][2])).Ib();g=(new R(this.ha[2][0],this.ha[2][1],this.ha[2][2])).Ib();b.qb=[e,d,g];-Infinity==b.U&&(b.U=f);Infinity==b.W&&(b.W=k);e=k=1;"left-posterior-superior"==this.zh&&(e=k=-1);f=Sc();"false"==b.reslicing||b.reslicing==u?(T(f,0,k,0,0,0),T(f,1,0,e,0,0),T(f,2,0,0,1,0)):(T(f,0,k*this.ha[0][0],k*this.ha[1][0],k*this.ha[2][0],k*this.Sf[0]),T(f,1,e*this.ha[0][1],e*this.ha[1][1],e*this.ha[2][1],e*this.Sf[1]),T(f,2,1*this.ha[0][2],1*this.ha[1][2],
1*this.ha[2][2],1*this.Sf[2]));T(f,3,0,0,0,1);c.cb=f;c.fb=Rc();ad(c.cb,c.fb);e=Qc(0,0,0,1);k=Pc();cd(f,e,k);d=Qc(1,1,1,1);e=Pc();cd(f,d,e);f=Ue(f,b.ca);c.Bc=[e[0]-k[0],e[1]-k[1],e[2]-k[2]];c.zc=[f[1]-f[0]+1,f[3]-f[2]+1,f[5]-f[4]+1];c.Ac=[f[0],f[2],f[4]];b.Gb(c);D.Da(this.f+".parse");b.ib=af(this,b);c=new ld;c.D=b;c.v=a;this.dispatchEvent(c)};
cg.prototype.Ai={type:function(a){switch(a){case "uchar":case "unsigned char":case "uint8":case "uint8_t":this.Mb=Uint8Array;break;case "signed char":case "int8":case "int8_t":this.Mb=Int8Array;break;case "short":case "short int":case "signed short":case "signed short int":case "int16":case "int16_t":this.Mb=Int16Array;break;case "ushort":case "unsigned short":case "unsigned short int":case "uint16":case "uint16_t":this.Mb=Uint16Array;break;case "int":case "signed int":case "int32":case "int32_t":this.Mb=
Int32Array;break;case "uint":case "unsigned int":case "uint32":case "uint32_t":this.Mb=Uint32Array;break;case "float":this.Mb=Float32Array;break;case "double":this.Mb=Float64Array;break;default:m(Error("Unsupported NRRD data type: "+a))}return this.type=a},endian:function(a){return this.Al=a},encoding:function(a){return this.encoding=a},dimension:function(a){return this.Zb=parseInt(a,10)},sizes:function(a){var b,c,e,d;e=a.split(/\s+/);d=[];b=0;for(c=e.length;b<c;b++)a=e[b],d.push(parseInt(a,10));
return this.Rf=d},space:function(a){return this.zh=a},"space origin":function(a){return this.Sf=a.split("(")[1].split(")")[0].split(",")},"space directions":function(a){var b,c;a=a.match(/\(.*?\)/g);var e,d,f;f=[];e=0;for(d=a.length;e<d;e++)c=a[e],f.push(function(){var a,d,e,f;e=c.slice(1,-1).split(/,/);f=[];a=0;for(d=e.length;a<d;a++)b=e[a],f.push(parseFloat(b));return f}());return this.ha=f},spacings:function(a){var b;b=a.split(/\s+/);var c,e,d;d=[];c=0;for(e=b.length;c<e;c++)a=b[c],d.push(parseFloat(a));
return this.Tf=d}};A("X.parserNRRD",cg);A("X.parserNRRD.prototype.parse",cg.prototype.parse);function dg(){Re.call(this);this.f="parserSTL"}C(dg,Re);
dg.prototype.parse=function(a,b,c){D.Ja(this.f+".parse");this.J=c;var e=b.h,d=b.n;if("solid"==Te(Z(this,"uchar",5))){b.h=e=new W(c.byteLength);b.n=d=new W(c.byteLength);var f=e,e=d,d=Z(this,"uchar",c.byteLength-5);c=d.length;var g=u,h=u,l=0,j;for(j=0;j<c;j++)if(10==d[j]){if(g||h){var k=Te(d,l,j).split(" "),h=parseFloat(k[0]),n=parseFloat(k[1]),k=parseFloat(k[2]);g?(e.add(h,n,k),e.add(h,n,k),e.add(h,n,k)):f.add(h,n,k);h=g=u}}else 32==d[j-1]&&(102==d[j]?(l=j+=13,g=q):118==d[j]&&(l=j+=7,h=q))}else{this.C=
80;f=Z(this,"uint");b.h=e=new W(9*f);b.n=d=new W(9*f);for(c=c=0;c<f;c++)g=Z(this,"float",12),l=g[0],j=g[1],h=g[2],d.add(l,j,h),d.add(l,j,h),d.add(l,j,h),e.add(g[3],g[4],g[5]),e.add(g[6],g[7],g[8]),e.add(g[9],g[10],g[11]),this.C+=2}D.Da(this.f+".parse");f=new ld;f.D=b;f.v=a;this.dispatchEvent(f)};A("X.parserSTL",dg);A("X.parserSTL.prototype.parse",dg.prototype.parse);function eg(){Re.call(this);this.f="parserNII"}C(eg,Re);
eg.prototype.parse=function(a,b,c){if(!fg(c))try{c=(new Vf(new Uint8Array(c))).Yb().buffer,fg(c)||(this.Mc=u)}catch(e){this.Mc=u}c=this.vc(c);var d=c.min,f=c.max;b.ra=b.fa=d;b.ia=b.ea=f;-Infinity==b.U&&(b.U=d);Infinity==b.W&&(b.W=f);d=Rc();T(d,3,0,0,0,1);if("false"==b.reslicing||b.reslicing==u){var g=f=1,h=1;0<c.sa[1]&&(f=c.sa[1]);0<c.sa[2]&&(g=c.sa[2]);0<c.sa[2]&&(h=c.sa[3]);0>c.sa[0]&&(h=-h);T(d,0,f,0,0,0);T(d,1,0,g,0,0);T(d,2,0,0,h,0)}else if(0<c.Nf){var l=0,j=c.sh,k=c.th,n=c.uh,h=g=f=1,s=c.ph,
r=c.qh,y=c.rh,l=1-(j*j+k*k+n*n);1E-7>l?(l=1/Math.sqrt(j*j+k*k+n*n),j*=l,k*=l,n*=l,l=0):l=Math.sqrt(l);0<c.sa[1]&&(f=c.sa[1]);0<c.sa[2]&&(g=c.sa[2]);0<c.sa[2]&&(h=c.sa[3]);0>c.sa[0]&&(h=-h);T(d,0,(l*l+j*j-k*k-n*n)*f,2*(j*k-l*n)*g,2*(j*n+l*k)*h,s);T(d,1,2*(j*k+l*n)*f,(l*l+k*k-j*j-n*n)*g,2*(k*n-l*j)*h,r);T(d,2,2*(j*n-l*k)*f,2*(k*n+l*j)*g,(l*l+n*n-k*k-j*j)*h,y)}else 0<c.xh?(f=c.Ah,g=c.Bh,h=c.Ch,T(d,0,f[0],f[1],f[2],f[3]),T(d,1,g[0],g[1],g[2],g[3]),T(d,2,h[0],h[1],h[2],h[3])):0==c.Nf?(T(d,0,c.sa[1],0,
0,0),T(d,1,0,c.sa[2],0,0),T(d,2,0,0,c.sa[3],0)):window.console.log("UNKNOWN METHOD IN PARSER NII");c.cb=d;c.fb=Rc();ad(c.cb,c.fb);g=Qc(0,0,0,1);f=Pc();cd(d,g,f);h=Qc(1,1,1,1);g=Pc();cd(d,h,g);h=[c.Zb[1],c.Zb[2],c.Zb[3]];d=Ue(d,h);c.Bc=[g[0]-f[0],g[1]-f[1],g[2]-f[2]];c.zc=[d[1]-d[0]+1,d[3]-d[2]+1,d[5]-d[4]+1];c.Ac=[d[0],d[2],d[4]];b.ca=h;b.Gb(c);b.ib=af(this,b);c=new ld;c.D=b;c.v=a;this.dispatchEvent(c)};
eg.prototype.vc=function(a){this.J=a;a={fk:0,pi:t,qi:t,yi:0,dk:0,Yj:0,ui:t,Zb:t,Wi:0,Xi:0,Yi:0,Ui:0,pf:0,ji:0,kk:0,sa:t,Hh:0,ck:0,bk:0,jk:0,hk:t,vk:t,ki:0,li:0,ik:0,pk:0,Hi:0,Ii:0,si:t,hi:t,Nf:0,xh:0,sh:0,th:0,uh:0,ph:0,qh:0,rh:0,Ah:t,Bh:t,Ch:t,Vi:t,cj:t,data:t,min:Infinity,max:-Infinity};a.fk=Z(this,"uint");a.pi=Z(this,"uchar",10);a.qi=Z(this,"uchar",18);a.yi=Z(this,"uint");a.dk=Z(this,"ushort");a.Yj=Z(this,"uchar");a.ui=Z(this,"uchar");a.Zb=Z(this,"ushort",8);a.Wi=Z(this,"float");a.Xi=Z(this,"float");
a.Yi=Z(this,"float");a.Ui=Z(this,"ushort");a.pf=Z(this,"ushort");a.ji=Z(this,"ushort");a.kk=Z(this,"ushort");a.sa=Z(this,"float",8);a.Hh=Z(this,"float");a.ck=Z(this,"float");a.bk=Z(this,"float");a.jk=Z(this,"ushort");a.hk=Z(this,"uchar");a.vk=Z(this,"uchar");a.ki=Z(this,"float");a.li=Z(this,"float");a.ik=Z(this,"float");a.pk=Z(this,"float");a.Hi=Z(this,"uint",1);a.Ii=Z(this,"uint",1);a.si=Z(this,"uchar",80);a.hi=Z(this,"uchar",24);a.Nf=Z(this,"ushort");a.xh=Z(this,"ushort");a.sh=Z(this,"float");a.th=
Z(this,"float");a.uh=Z(this,"float");a.ph=Z(this,"float");a.qh=Z(this,"float");a.rh=Z(this,"float");a.Ah=Z(this,"float",4);a.Bh=Z(this,"float",4);a.Ch=Z(this,"float",4);a.Vi=Z(this,"uchar",16);a.cj=Z(this,"uchar",4);this.C=parseInt(a.Hh,10);var b=a.Zb[1]*a.Zb[2]*a.Zb[3];switch(a.pf){case 2:a.data=Z(this,"uchar",b);break;case 4:a.data=Z(this,"sshort",b);break;case 8:a.data=Z(this,"sint",b);break;case 16:a.data=Z(this,"float",b);break;case 32:a.data=Z(this,"complex",b);break;case 64:a.data=Z(this,"double",
b);break;case 256:a.data=Z(this,"schar",b);break;case 512:a.data=Z(this,"ushort",b);break;case 768:a.data=Z(this,"uint",b);break;default:m(Error("Unsupported NII data type: "+a.pf))}b=Se(a.data);a.min=b[0];a.max=b[1];return a};function fg(a){var b=-1,b="undefined"==typeof DataView?(new Int32Array(a,0,1))[0]:(new DataView(a,0)).getInt32(0,q);return 348==b?q:u}A("X.parserNII",eg);A("X.parserNII.prototype.parse",eg.prototype.parse);function gg(){Re.call(this);this.f="parserTRK"}C(gg,Re);
gg.prototype.parse=function(a,b,c){D.Ja(this.f+".parse");var e=b.h,d=b.n,f=b.pa;this.J=c;Z(this,"uchar",6);Z(this,"ushort",3);var g=Z(this,"float",3);Z(this,"float",3);var h=Z(this,"ushort");Z(this,"uchar",200);Z(this,"ushort");Z(this,"uchar",200);c=Z(this,"float",16);Z(this,"uchar",444);Z(this,"uchar",4);Z(this,"uchar",4);Z(this,"float",6);Z(this,"uchar",2);Z(this,"uchar");Z(this,"uchar");Z(this,"uchar");Z(this,"uchar");Z(this,"uchar");Z(this,"uchar");var l=Z(this,"uint");Z(this,"uint");var j=Z(this,
"uint"),k=0===l?Infinity:l,n=[],s=[],l=Infinity,r=-Infinity,y=t,z=t,F=t,G=t,d=e=t,H=Z(this,"uint",(this.J.byteLength-1E3)/4);this.C=j;for(var B=Z(this,"float",(this.J.byteLength-1E3)/4),E=0,j=f=0;j<k;j++){if("undefined"===typeof H[E]){k=j;break}for(var I=H[E],N=new W(3*I),Q=0,O=0;O<I;O++){var S=B[E+3*O+O*h+1],da=B[E+3*O+O*h+2],J=B[E+3*O+O*h+3],S=S/g[0],da=da/g[1],J=J/g[2];N.add(S,da,J);if(0<O)var ba=N.get(O-1),Q=Q+Math.sqrt(Math.pow(S-ba[0],2)+Math.pow(da-ba[1],2)+Math.pow(J-ba[2],2));O<I-1&&(f+=
6)}E+=3*I+I*h+1;O=N.mb;I=N.jb;S=N.nb;da=N.kb;J=N.ob;ba=N.lb;if(!y||O<y)y=O;if(!z||I>z)z=I;if(!F||S<F)F=S;if(!G||da>G)G=da;if(!e||J<e)e=J;if(!d||ba>d)d=ba;n.push(N);s.push(Q)}g=(y+z)/2;h=(F+G)/2;G=(e+d)/2;F=new Float32Array(f);b.h=e=new W(f);b.n=d=new W(f);b.pa=f=new W(f);for(j=y=0;j<k;j++){z=n[j];H=z.count;Q=s[j];l=Math.min(l,Q);r=Math.max(r,Q);for(O=0;O<H-1;O++){E=z.get(O);B=z.get(O+1);e.add(E[0],E[1],E[2]);e.add(B[0],B[1],B[2]);var N=E[0]-g,I=E[1]-h,S=E[2]-G,da=Math.sqrt(N*N+I*I+S*S),J=B[0]-g,ba=
B[1]-h,ka=B[2]-G,U=Math.sqrt(J*J+ba*ba+ka*ka);d.add(N/da,I/da,S/da);d.add(J/U,ba/U,ka/U);B=[Math.abs(B[0]-E[0]),Math.abs(B[1]-E[1]),Math.abs(B[2]-E[2])];E=Math.sqrt(B[0]*B[0]+B[1]*B[1]+B[2]*B[2]);B[0]/=E;B[1]/=E;B[2]/=E;f.add(B[0],B[1],B[2]);f.add(B[0],B[1],B[2]);F[y++]=Q;F[y++]=Q;F[y++]=Q;F[y++]=Q;F[y++]=Q;F[y++]=Q}}b.Ia="LINES";k=new kd;k.ra=l;k.ia=r;k.U=l;k.W=r;k.dd=F;k.ug=u;k.j=q;b.F=k;l=u;for(j=0;16>j;j++)if(0!=c[j]){l=q;break}l==u&&(c[0]=c[5]=c[10]=c[15]=1);D.Da(this.f+".parse");D.g.Wf(c,b.ja.Q);
c=new ld;c.D=b;c.v=a;this.dispatchEvent(c)};A("X.parserTRK",gg);A("X.parserTRK.prototype.parse",gg.prototype.parse);function hg(){Re.call(this);this.f="parserOBJ"}C(hg,Re);
hg.prototype.parse=function(a,b,c){D.Ja(this.f+".parse");this.J=c;c=c.byteLength;var e=Z(this,"uchar",c),d=[];b.h=new W(c);b.n=new W(c);var f=b.h,g=b.n,h=0,l;for(l=0;l<c;++l)if(10==e[l]){var j=Te(e,h,l).replace(/\s{2,}/g," ").split(" ");if("v"==j[0])d.push([parseFloat(j[1]),parseFloat(j[2]),parseFloat(j[3])]);else if("f"==j[0]){var k=d[parseInt(j[1],10)-1],h=d[parseInt(j[2],10)-1],j=d[parseInt(j[3],10)-1];f.add(k[0],k[1],k[2]);f.add(h[0],h[1],h[2]);f.add(j[0],j[1],j[2]);k=new R(k[0],k[1],k[2]);j=
new R(j[0],j[1],j[2]);h=Ic((new R(h[0],h[1],h[2])).wa(k),j.wa(k));h.normalize();g.add(h.x,h.y,h.d);g.add(h.x,h.y,h.d);g.add(h.x,h.y,h.d)}h=l+1}D.Da(this.f+".parse");c=new ld;c.D=b;c.v=a;this.dispatchEvent(c)};A("X.parserOBJ",hg);A("X.parserOBJ.prototype.parse",hg.prototype.parse);function ig(){M.call(this);this.f="loader";this.Kc=new zc;this.td=0}C(ig,M);function jg(a,b){a.td+=b/a.Kc.sf()/3;a.td=Math.min(1,a.td);var c=new Od;c.Ad=a.td;a.dispatchEvent(c)}function kg(a){a=a.r.$d;var b=a.split(".").pop().toUpperCase();b==a.toUpperCase()&&(b="");b in lg||m(Error("The "+b+" file format is not supported."));return[a,b,lg[b][0],lg[b][1],lg[b][2]]}
ig.prototype.load=function(a,b){(!a||!b)&&m(Error("No container or object to load."));if(!Cc(this.Kc.ga,a.qa)||this.Kc.get(a.qa)){this.Kc.set(a.qa,u);var c=kg(a)[0];if(a.$a!=t)this.parse(t,a,b);else{var e=new XMLHttpRequest;L(e,"abort",this.Ig.bind(this,e,a,b));L(e,"error",this.Ig.bind(this,e,a,b));L(e,"load",this.parse.bind(this,e,a,b));e.open("GET",c,q);e.responseType="arraybuffer";e.send(t)}}};
ig.prototype.parse=function(a,b,c){jg(this,1);setTimeout(function(){var e=kg(b),d=e[3],e=new e[2];$b(e,yd,this.complete.bind(this));var f=b.$a;f==t&&(f=a.response,b.$a=f);e.parse(b,c,f,d)}.bind(this),100)};ig.prototype.complete=function(a){jg(this,1);setTimeout(function(){var b=a.v,c=a.D;b.r.j=u;b.j=q;c.q();this.Kc.set(b.qa,q)}.bind(this),100)};ig.prototype.Ig=function(a,b,c){m(Error("Loading failed: ",b,c))};
var lg={OBJ:[hg,t],OFF:[kf,t],STL:[dg,t],VTK:[nf,t],TRK:[gg,t],MRC:[bg,t],ST:[bg,t],FSM:[pf,t],INFLATED:[pf,t],SMOOTHWM:[pf,t],SPHERE:[pf,t],PIAL:[pf,t],ORIG:[pf,t],NRRD:[cg,t],NII:[eg,t],GZ:[eg,t],DCM:[lf,t],DICOM:[lf,t],"":[lf,t],CRV:[Yf,t],LABEL:[Xf,t],MGH:[Wf,u],MGZ:[Wf,q],RAW:[$f,u],RZ:[$f,q],TXT:[ag,t],LUT:[ag,t],PNG:[bf,"png"],JPG:[bf,"jpeg"],JPEG:[bf,"jpeg"],GIF:[bf,"gif"]};function mg(a){function b(a,b,e){b=2*b*Math.PI;b=za(Aa(l,Math.cos(b)),Aa(j,Math.sin(b)));a=za(za(c,Aa(d,a)),Aa(b,f));e=za(Aa(b,1-Math.abs(e)),Aa(g,e));return new kc(a,e)}this.Z=[];a=a||{};var c=new ya(a.start||[0,-1,0]),e=new ya(a.end||[0,1,0]),d=Ca(e,c),f=a.zb||1;a=a.ta||16;for(var g=Da(d),h=0.5<Math.abs(g.y()),l=Da((new ya(h,!h,0)).sc(g)),j=Da(l.sc(g)),h=new kc(c,Ea(g)),e=new kc(e,Da(g)),k=[],n=0;n<a;n++){var s=n/a,r=(n+1)/a;k.push(new mc([h,b(0,s,-1),b(0,r,-1)]));k.push(new mc([b(0,r,0),b(0,s,
0),b(1,s,0),b(1,r,0)]));k.push(new mc([e,b(1,r,1),b(1,s,1)]))}return uc(k)}C(mg,tc);function ng(){Y.call(this);this.f="cylinder";this.af=[-10,-10,-10];this.Ke=[10,10,10];this.jc=10;this.bb=32;Fa(this,new od)}C(ng,Y);ng.prototype.__defineGetter__("start",v("af"));ng.prototype.__defineSetter__("start",function(a){(a==t||!la(a)||3!=a.length)&&m(Error("Invalid start"));this.af=a});ng.prototype.__defineGetter__("end",v("Ke"));ng.prototype.__defineSetter__("end",function(a){(a==t||!la(a)||3!=a.length)&&m(Error("Invalid end"));this.Ke=a});ng.prototype.__defineGetter__("radius",v("jc"));
ng.prototype.__defineSetter__("radius",function(a){x(a)||m(Error("Invalid radius."));this.jc=a});ng.prototype.q=function(){qd(this,new mg({start:this.af,end:this.Ke,zb:this.jc,ta:this.bb}));ng.u.q.call(this)};A("X.cylinder",ng);A("X.cylinder.prototype.modified",ng.prototype.q);function og(a){function b(a,b){a*=2*Math.PI;b*=Math.PI;var d=new ya(Math.cos(a)*Math.sin(b),Math.cos(b),Math.sin(a)*Math.sin(b));g.push(new kc(za(c,Aa(d,e)),d))}this.Z=[];a=a||{};var c=new ya(a.lf||[0,0,0]),e=a.zb||1,d=a.ta||16;a=a.lk||8;for(var f=[],g=[],h=0;h<d;h++)for(var l=0;l<a;l++)g=[],b(h/d,l/a),0<l&&b((h+1)/d,l/a),l<a-1&&b((h+1)/d,(l+1)/a),b(h/d,(l+1)/a),f.push(new mc(g));return uc(f)}C(og,tc);function pg(){Y.call(this);this.f="sphere";this.z=[0,0,0];this.jc=5;this.bb=32;this.$h=16;Fa(this,new od)}C(pg,Y);pg.prototype.__defineGetter__("center",v("z"));pg.prototype.__defineSetter__("center",function(a){(a==t||!la(a)||3!=a.length)&&m(Error("Invalid center"));this.z=a});pg.prototype.__defineGetter__("radius",v("jc"));pg.prototype.__defineSetter__("radius",function(a){x(a)||m(Error("Invalid radius."));this.jc=a});
pg.prototype.q=function(){qd(this,new og({lf:this.z,zb:this.jc,ta:this.bb,lk:this.$h}));pg.u.q.call(this)};A("X.sphere",pg);A("X.sphere.prototype.modified",pg.prototype.q);function hf(a){P.call(this);this.f="labelmap";this.yb=a;this.$e=new Float32Array([-255,-255,-255,-255])}C(hf,P);hf.prototype.q=function(){var a=new ld;a.D=this;this.dispatchEvent(a);this.yb.q()};hf.prototype.__defineSetter__("showOnly",function(a){var b=[-1,-1,-1,-1];a!=t&&(la(a)&&4==a.length?b=a:(this.xa||m(Error("No colortable assigned.")),b=this.xa.Ka.get(a).slice(1,5)));this.$e=new Float32Array([Math.floor(255*b[0]),Math.floor(255*b[1]),Math.floor(255*b[2]),Math.floor(255*b[3])])});
A("X.labelmap",hf);function qg(a){this.Z=[];a=a||{};var b=new ya(a.lf||[0,0,0]),c=!a.zb?[1,1,1]:a.zb.length?a.zb:[a.zb,a.zb,a.zb];return uc([[[0,4,6,2],[-1,0,0]],[[1,3,7,5],[1,0,0]],[[0,1,5,4],[0,-1,0]],[[2,6,7,3],[0,1,0]],[[0,2,3,1],[0,0,-1]],[[4,5,7,6],[0,0,1]]].map(function(a){return new mc(a[0].map(function(d){d=new ya(b.x()+c[0]*(2*!!(d&1)-1),b.y()+c[1]*(2*!!(d&2)-1),b.d()+c[2]*(2*!!(d&4)-1));return new kc(d,new ya(a[1]))}))}))}C(qg,tc);function rg(){Y.call(this);this.f="cube";this.z=[0,0,0];this.Pe=this.Oe=this.Ne=20;this.nc=[0,1,1,1,1,0,0,1,1,0,0,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0,0,0,0,0,1,1,1,0,0,1,1,1,0,1,1,1,0,0,0,1,1,0,0,0,1,0,1,1,1,1,0,0,1,1,0,0,0];Fa(this,new od)}C(rg,Y);rg.prototype.__defineGetter__("center",v("z"));rg.prototype.__defineSetter__("center",function(a){(a==t||!la(a)||3!=a.length)&&m(Error("Invalid center"));this.z=a});rg.prototype.__defineGetter__("lengthX",v("Ne"));
rg.prototype.__defineSetter__("lengthX",function(a){x(a)||m(Error("Invalid lengthX."));this.Ne=a});rg.prototype.__defineGetter__("lengthY",v("Oe"));rg.prototype.__defineSetter__("lengthY",function(a){x(a)||m(Error("Invalid lengthY."));this.Oe=a});rg.prototype.__defineGetter__("lengthZ",v("Pe"));rg.prototype.__defineSetter__("lengthZ",function(a){x(a)||m(Error("Invalid lengthZ."));this.Pe=a});rg.prototype.q=function(){qd(this,new qg({lf:this.z,zb:[this.Ne/2,this.Oe/2,this.Pe/2]}));rg.u.q.call(this)};
A("X.cube",rg);A("X.cube.prototype.modified",rg.prototype.q);function Le(a){Je.call(this,a);this.f="interactor3D";this.ml=u}C(Le,Je);Le.prototype.Kd=function(a){Le.u.Kd.call(this,a);var b=new Jd;a.Xc==t&&(a.Xc=0);b.vb=0>a.Xc;b.hb=q;this.dispatchEvent(b)};function sg(a){M.call(this);this.f="array";this.I=[];this.cg=a}C(sg,M);function tg(a,b,c){for(var e=0;4>e;e++)if(a[e+0]!==b[e+c])return u;return q}sg.prototype.add=function(a){this.I.push(a);return q};sg.prototype.remove=function(a){a=this.I.indexOf(a);-1<a&&this.I.splice(a,1);return q};sg.prototype.clear=function(){this.I.length=0};
function ug(a,b,c){var e=c-b;if(!(2>e)){e=b+Math.floor(e/2);ug(a,b,e);for(ug(a,e,c);b<e;++b)if(0<a.cg(a.I[b],a.I[e])){var d=a.I[b];a.I[b]=a.I[e];for(var f=a,g=e,h=c;g+1<h&&0>f.cg(f.I[g+1],d);){var l=f,j=g+1,k=l.I[g];l.I[g]=l.I[j];l.I[j]=k;++g}f.I[g]=d}}}sg.prototype.sort=function(){ug(this,0,this.I.length)};function vg(a){Pb.call(this);this.Hb=a;this.S=[]}C(vg,Pb);var wg=[];function xg(a,b,c,e,d){la(c)||(wg[0]=c,c=wg);for(var f=0;f<c.length;f++){var g=L(b,c[f],e||a,d||u,a.Hb||a);a.S.push(g)}}vg.prototype.Of=function(){Jb(this.S,bc);this.S.length=0};vg.prototype.handleEvent=function(){m(Error("EventHandler.handleEvent not implemented"))};function yg(){}yg.Kg=function(){return yg.Sg?yg.Sg:yg.Sg=new yg};yg.prototype.mj=0;yg.Kg();function zg(a){jc.call(this);this.$b=a||Zd();this.$j=Ag}C(zg,jc);zg.prototype.Qi=yg.Kg();var Ag=t;w=zg.prototype;w.Rg=t;w.Zc=u;w.H=t;w.$j=t;w.Ld=t;w.Cd=t;w.mf=t;w.t=v("H");w.Qf=function(a){this.Ld&&this.Ld!=a&&m(Error("Method not supported"));zg.u.Qf.call(this,a)};w.ne=v("$b");w.Wc=function(){this.H=this.$b.createElement("div")};w.cc=function(a){this.dc(a)};
w.dc=function(a,b){this.Zc&&m(Error("Component already rendered"));this.H||this.Wc();a?a.insertBefore(this.H,b||t):this.$b.ka.body.appendChild(this.H);(!this.Ld||this.Ld.Zc)&&this.ke()};w.ke=function(){function a(a){!a.Zc&&a.t()&&a.ke()}this.Zc=q;this.Cd&&Jb(this.Cd,a,p)};w.le=function(){function a(a){a.Zc&&a.le()}this.Cd&&Jb(this.Cd,a,p);this.Ji&&this.Ji.Of();this.Zc=u};
w.removeChild=function(a,b){if(a){var c=na(a)?a:a.Rg||(a.Rg=":"+(a.Qi.mj++).toString(36)),e;this.mf&&c?(e=this.mf,e=(c in e?e[c]:p)||t):e=t;a=e;c&&a&&(e=this.mf,c in e&&delete e[c],Nb(this.Cd,a),b&&(a.le(),a.H&&ge(a.H)),c=a,c==t&&m(Error("Unable to set parent component")),c.Ld=t,zg.u.Qf.call(c,t))}a||m(Error("Child is not in parent component"));return a};function Cg(){jc.call(this)}C(Cg,jc);w=Cg.prototype;w.Yf=0;w.Gd=0;w.zf=100;w.Hg=0;w.Uf=1;w.Zi=u;w.jj=u;w.Od=function(a){a=Dg(this,a);this.Yf!=a&&(this.Yf=a+this.Hg>this.zf?this.zf-this.Hg:a<this.Gd?this.Gd:a,!this.Zi&&!this.jj&&this.dispatchEvent("change"))};w.qe=function(){return Dg(this,this.Yf)};w.pe=function(){return Dg(this,this.Gd)};w.oe=function(){return Dg(this,this.zf)};function Dg(a,b){return a.Uf==t?b:a.Gd+Math.round((b-a.Gd)/a.Uf)*a.Uf};function Eg(a){zg.call(this,a);this.Md=new Cg;L(this.Md,"change",this.Ki,u,this)}C(Eg,zg);var Fg={vertical:"progress-bar-vertical",horizontal:"progress-bar-horizontal"};w=Eg.prototype;w.Wc=function(){this.Ab=this.ne().Wc("div","progress-bar-thumb");var a=Fg[this.mh];this.H=this.ne().Wc("div",a,this.Ab);Gg(this);a=this.pe();this.t().setAttribute("aria-valuemin",a);a=this.oe();this.t().setAttribute("aria-valuemax",a)};
w.ke=function(){Eg.u.ke.call(this);K&&7>sb&&L(this.t(),"resize",this.Fe,u,this);this.Fe();var a=this.t();a.setAttribute("role","progressbar");a.setAttribute("aria-live","polite")};w.le=function(){Eg.u.le.call(this);K&&7>sb&&ac(this.t(),"resize",this.Fe,u,this)};w.qe=function(){return this.Md.qe()};w.Od=function(a){this.Md.Od(a);this.t()&&Gg(this)};function Gg(a){var b=a.qe();a.t().setAttribute("aria-valuenow",b)}w.pe=function(){return this.Md.pe()};w.oe=function(){return this.Md.oe()};w.mh="horizontal";
w.Ki=function(){this.Fe();this.dispatchEvent("change")};w.Fe=function(){if(this.Ab){var a=this.pe(),b=this.oe(),a=(this.qe()-a)/(b-a),b=Math.round(100*a);"vertical"==this.mh?K&&7>sb?(this.Ab.style.top=0,this.Ab.style.height="100%",b=this.Ab.offsetHeight,a=Math.round(a*b),this.Ab.style.top=b-a+"px",this.Ab.style.height=a+"px"):(this.Ab.style.top=100-b+"%",this.Ab.style.height=b+"%"):this.Ab.style.width=b+"%"}};function Hg(a,b){a==t&&m(Error("No valid parent element."));b==t&&m(Error("Invalid initial value."));Eg.call(this);this.f="progressbar";this.ab=a;this.Ue="";this.Td=this.Fb=t;this.fc=[];var c;c=".progress-bar-horizontal {\n position: relative;\n border: 1px solid #949dad;\n";c+=" background: white;\n";c+=" padding: 1px;\n";c+=" overflow: hidden;\n";c+=" margin: 2px;\n";c+=" width: 100px;\n";c+=" height: 5px;\n";c+="}";var e;e=".progress-bar-thumb {\n position: relative;\n background: #F62217;\n";
e+=" overflow: hidden;\n";e+=" width: 0%;\n";e+=" height: 100%;\n";e+="}";var d;d=".progress-bar-thumb-done {\n background: #57E964;\n}";this.fc=[c,e,d];this.Od(b);this.uf()}C(Hg,Eg);
Hg.prototype.uf=function(){var a=oe(this.ab,"position");if("static"==a||""==a)this.Ue=this.ab.style.position,this.ab.style.position="relative";var a=document.getElementsByTagName("head")[0],b=de("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.fc[0])),e=document.createTextNode(String(this.fc[1])),d=document.createTextNode(String(this.fc[2]));a.appendChild(b);b.appendChild(c);b.appendChild(e);b.appendChild(d);this.Fb=b;this.cc(this.ab);a=this.t();a.style.position=
"absolute";a.style.top=(this.ab.clientHeight-5)/2+"px";a.style.left=(this.ab.clientWidth-100)/2+"px";a.classList.add("xtk-progress-bar")};function Ig(a){var b=a.t().style.top,c=a.t().style.left;ge(a.t());var e=new Hg(a.ab,100),d=e.t();d.style.position="absolute";d.style.top=b;d.style.left=c;d.classList.add("xtk-progress-bar");(d.firstElementChild!=p?d.firstElementChild:he(d.firstChild)).classList.add("progress-bar-thumb-done");a.Td=e}
Hg.prototype.Fd=function(){this.Fb&&ge(this.Fb);this.t()&&ge(this.t());this.Td&&ge(this.Td.t());this.Td=this.Fb=t;this.Ue&&(this.ab.style.position=this.Ue)};function Jg(a,b,c){oa(a)?c&&(a=va(a,c)):a&&"function"==typeof a.handleEvent?a=va(a.handleEvent,a):m(Error("Invalid listener argument"));return 2147483647<b?-1:fa.setTimeout(a,b||0)};function Kg(){M.call(this);this.f="renderer";this.v=window.document.body;this.K=this.v.clientWidth;this.A=this.v.clientHeight;this.T=this.N=this.na=t;this.pb=new sg(nd);this.Ha=[];this.aa=t;this.Zd=this.hd=this.Xd=u;this.a=this.Vb=this.La=t;this.R={PROGRESSBAR_ENABLED:q,INTERMEDIATE_RENDERING:u,SLICENAVIGATORS:q};this.He=-1;window.console.log("XTK release 10 -- 2015-01-14 14:18:53 -- http://www.goXTK.com -- @goXTK")}C(Kg,M);w=Kg.prototype;
w.Ef=function(){window.cancelAnimationFrame(this.He);this.R.PROGRESSBAR_ENABLED&&(this.Vb=new Hg(this.v,3))};w.Ff=function(){this.R.PROGRESSBAR_ENABLED&&this.Vb&&(Ig(this.Vb),this.Qd=Jg(function(){this.Qd=t;this.Vb&&(this.Vb.Fd(),this.Vb=t);this.hd=this.Zd=q;this.cc()}.bind(this),700))};w.Gf=function(a){this.Vb&&this.Vb.Od(100*a.Ad)};w.Dj=function(a){this.La&&this.La.Od(100*a.Ad)};w.tj=function(a){a!=t&&a instanceof ld&&a.D&&this.ub(a.D)};w.Ej=function(a){a!=t&&a instanceof md&&a.D&&this.remove(a.D)};
w.If=function(a){(a==t||!(a instanceof Ld))&&m(Error("Invalid hover event."))};w.ve=function(){var a=be(this.v);this.K=a.clientWidth;this.A=a.clientHeight;a=be(this.na);a.width=this.K;a.height=this.A;"renderer3D"==this.f&&(this.a.viewport(0,0,this.K,this.A),this.N.Ve=D.g.yf(D.g.Ed(),this.N.eg,this.na.width/this.na.height,1,1E4))};w.Jf=function(a){(a==t||!(a instanceof Kd))&&m(Error("Invalid scroll event."))};Kg.prototype.__defineGetter__("config",v("R"));
Kg.prototype.__defineGetter__("interactor",v("T"));Kg.prototype.__defineGetter__("camera",v("N"));Kg.prototype.__defineGetter__("loadingCompleted",v("hd"));Kg.prototype.__defineGetter__("container",v("v"));Kg.prototype.__defineSetter__("container",function(a){a==t&&m(Error("An ID to a valid container (<div>..) is required."));var b=a;na(b)&&(b=be(a));pa(b)&&1==b.nodeType||m(Error("Could not find the given container."));this.v=b});w=Kg.prototype;w.Nd=function(){this.N.reset()};
w.Ca=function(a){var b=de("canvas");this.v.appendChild(b);this.K=this.v.clientWidth;this.A=this.v.clientHeight;b.width=this.K;b.height=this.A;try{var c=b.getContext(a);c||m(Error())}catch(e){var d="Sorry, "+a+' context is <strong>not supported</strong> on this machine! See <a href="http://crash.goXTK.com" target="_blank">http://crash.goXTK.com</a> for requirements..';this.v.innerHTML='<h3 style="color:red;font-family:sans-serif;">Oooops..</h3><p style="color:red;font-family:sans-serif;">'+d+"</p>";
m(Error(d))}this.aa=new ig;L(this.aa,Ad,this.Dj.bind(this));this.na=b;this.a=c;b=new Le(this.na);"2d"==a&&(b=new Ne(this.na));b.Ca();L(b,wd,this.Nd.bind(this));L(b,Bd,this.If.bind(this));L(b,vd,this.Jf.bind(this));this.T=b;b=new Pe(this.K,this.A);"2d"==a&&(b=new cf(this.K,this.A));b.observe(this.T);this.N=b;L(window,"resize",this.ve,u,this)};w.add=function(a){(a instanceof rg||a instanceof pg||a instanceof ng)&&a.q();this.Ha.push(a);this.ub(a)};
w.remove=function(a){(!this.na||!this.a)&&m(Error("The renderer was not initialized properly."));if(a!=t){dc(a);var b=this.Ha.length,c;for(c=0;c<b;c++)if(this.Ha[c].qa==a.qa)return this.Ha[c]=t,this.Ha.splice(c,1),q}return u};w.ub=function(a){(!this.na||!this.a)&&m(Error("The renderer was not initialized properly."));a!=t&&(ec(a,yd)||L(a,yd,this.tj.bind(this)),ec(a,zd)||L(a,zd,this.Ej.bind(this)),ec(a,Dd)||L(a,Dd,this.Ef.bind(this)),ec(a,Fd)||L(a,Fd,this.Gf.bind(this)),ec(a,Ed)||L(a,Ed,this.Ff.bind(this)))};
w.get=function(a){a==t&&m(Error("Invalid object id."));for(var b=this.pb.I,c=b.length,e=0,e=0;e<c;e++)if(b[e].qa==a)return b[e];return t};
w.cc=function(){(!this.na||!this.a)&&m(Error("The renderer was not initialized properly."));if(this.tg==t){if(Bc(this.aa.Kc)){if(this.R.PROGRESSBAR_ENABLED&&!this.La&&(this.La=new Hg(this.v,3)),this.Zd=this.hd=u,this.tg=Jg(function(){this.tg=t;this.cc()}.bind(this),100),!this.R.INTERMEDIATE_RENDERING)return}else if(!this.hd&&!this.Zd&&(this.Zd=q,eval("this.onShowtime()"),this.hd=q),this.La){this.R.PROGRESSBAR_ENABLED&&(this.La&&!this.Qd)&&(Ig(this.La),this.Qd=Jg(function(){this.Qd=t;this.La&&(this.La.Fd(),
this.La=t);this.cc()}.bind(this),700));return}this.He=window.requestAnimationFrame(this.cc.bind(this));eval("this.onRender()");this.dc(u,q);eval("this.afterRender()")}};w.lh=aa();w.jh=aa();w.yg=aa();w.dc=aa();
w.Ta=function(){dc(this);ac(window,"resize",this.ve,u,this);window.cancelAnimationFrame(this.He);this.aa&&(delete this.aa,this.aa=t);this.La&&(this.La.Fd(),delete this.La,this.La=t);this.pb.clear();delete this.pb;this.Ha.length=0;delete this.Ha;delete this.aa;this.aa=t;delete this.N;this.N=t;delete this.T;this.T=t;delete this.a;this.a=t;ge(this.na);delete this.na;this.na=t};function Lg(a,b,c,e,d,f,g,h){var l,j;if(l=c.offsetParent){var k="HTML"==l.tagName||"BODY"==l.tagName;if(!k||"static"!=pe(l,"position"))j=ue(l),k||(k=(k=ve(l))&&jb?-l.scrollLeft:k&&(!K||!Cb("8"))&&"visible"!=pe(l,"overflowX")?l.scrollWidth-l.clientWidth-l.scrollLeft:l.scrollLeft,j=Yd(j,new Xd(k,l.scrollTop)))}l=j||new Xd;j=ue(a);k=ze(a);j=new me(j.x,j.y,k.width,k.height);(k=te(a))&&j.Tg(new me(k.left,k.top,k.right-k.left,k.bottom-k.top));var k=Zd(a),n=Zd(c);if(k.ka!=n.ka){var s=k.ka.body,n=n.ka.parentWindow||
n.ka.defaultView,r=new Xd(0,0),y=ae(s)?ae(s).parentWindow||ae(s).defaultView:window,z=s;do{var F=y==n?ue(z):we(z);r.x+=F.x;r.y+=F.y}while(y&&y!=n&&(z=y.frameElement)&&(y=y.parent));s=Yd(r,ue(s));K&&!je(k)&&(s=Yd(s,ke(k)));j.left+=s.x;j.top+=s.y}a=(b&4&&ve(a)?b^2:b)&-5;b=new Xd(a&2?j.left+j.width:j.left,a&1?j.top+j.height:j.top);b=Yd(b,l);d&&(b.x+=(a&2?-1:1)*d.x,b.y+=(a&1?-1:1)*d.y);var G;if(g&&(G=te(c)))G.top-=l.y,G.right-=l.x,G.bottom-=l.y,G.left-=l.x;return Mg(b,c,e,f,G,g,h)}
function Mg(a,b,c,e,d,f,g){a=a.l();var h=0,l=(c&4&&ve(b)?c^2:c)&-5;c=ze(b);g=g?g.l():c.l();if(e||0!=l)l&2?a.x-=g.width+(e?e.right:0):e&&(a.x+=e.left),l&1?a.y-=g.height+(e?e.bottom:0):e&&(a.y+=e.top);if(f){if(d){h=a;e=0;if(65==(f&65)&&(h.x<d.left||h.x>=d.right))f&=-2;if(132==(f&132)&&(h.y<d.top||h.y>=d.bottom))f&=-5;h.x<d.left&&f&1&&(h.x=d.left,e|=1);h.x<d.left&&(h.x+g.width>d.right&&f&16)&&(g.width=Math.max(g.width-(h.x+g.width-d.right),0),e|=4);h.x+g.width>d.right&&f&1&&(h.x=Math.max(d.right-g.width,
d.left),e|=1);f&2&&(e|=(h.x<d.left?16:0)|(h.x+g.width>d.right?32:0));h.y<d.top&&f&4&&(h.y=d.top,e|=2);h.y<=d.top&&(h.y+g.height<d.bottom&&f&32)&&(g.height=Math.max(g.height-(d.top-h.y),0),h.y=0,e|=8);h.y>=d.top&&(h.y+g.height>d.bottom&&f&32)&&(g.height=Math.max(g.height-(h.y+g.height-d.bottom),0),e|=8);h.y+g.height>d.bottom&&f&4&&(h.y=Math.max(d.bottom-g.height,d.top),e|=2);f&8&&(e|=(h.y<d.top?64:0)|(h.y+g.height>d.bottom?128:0));h=e}else h=256;if(h&496)return h}f=a;d=jb&&(ab||qb)&&Cb("1.9");f instanceof
Xd?(a=f.x,f=f.y):(a=f,f=p);b.style.left=ye(a,d);b.style.top=ye(f,d);if(!(c==g||(!c||!g?0:c.width==g.width&&c.height==g.height)))a=je(Zd(ae(b))),K&&(!a||!Cb("8"))?(c=b.style,a?(K?(a=De(b,"paddingLeft"),d=De(b,"paddingRight"),f=De(b,"paddingTop"),e=De(b,"paddingBottom"),a=new le(f,d,e,a)):(a=oe(b,"paddingLeft"),d=oe(b,"paddingRight"),f=oe(b,"paddingTop"),e=oe(b,"paddingBottom"),a=new le(parseFloat(f),parseFloat(d),parseFloat(e),parseFloat(a))),K?(d=Fe(b,"borderLeft"),f=Fe(b,"borderRight"),e=Fe(b,"borderTop"),
b=Fe(b,"borderBottom"),b=new le(e,f,b,d)):(d=oe(b,"borderLeftWidth"),f=oe(b,"borderRightWidth"),e=oe(b,"borderTopWidth"),b=oe(b,"borderBottomWidth"),b=new le(parseFloat(e),parseFloat(f),parseFloat(b),parseFloat(d))),c.pixelWidth=g.width-b.left-a.left-a.right-b.right,c.pixelHeight=g.height-b.top-a.top-a.bottom-b.bottom):(c.pixelWidth=g.width,c.pixelHeight=g.height)):(b=b.style,jb?b.MozBoxSizing="border-box":lb?b.WebkitBoxSizing="border-box":b.boxSizing="border-box",b.width=Math.max(g.width,0)+"px",
b.height=Math.max(g.height,0)+"px");return h};function Ng(){}Ng.prototype.tb=aa();function Og(a,b){this.nf=a instanceof Xd?a:new Xd(a,b)}C(Og,Ng);Og.prototype.tb=function(a,b,c,e){Lg(qe(a),0,a,b,this.nf,c,t,e)};function Pg(a,b,c){this.element=a;this.Fg=b;this.Tj=c}C(Pg,Ng);Pg.prototype.tb=function(a,b,c){Lg(this.element,this.Fg,a,b,p,c,this.Tj)};function Qg(a,b){jc.call(this);this.Hb=new vg(this);this.Pf(a||t);b&&(this.$c=b)}C(Qg,jc);w=Qg.prototype;w.H=t;w.gi=q;w.zg=t;w.Ma=u;w.ek=u;w.wf=-1;w.Wg=-1;w.Pi=u;w.wi=q;w.$c="toggle_display";w.t=v("H");w.Pf=function(a){this.Ma&&m(Error("Can not change this state of the popup while showing."));this.H=a};
function Rg(a,b){a.Ee&&a.Ee.stop();a.re&&a.re.stop();if(b){if(!a.Ma&&a.Df()){a.H||m(Error("Caller must call setElement before trying to show the popup"));a.tb();var c=ae(a.H);a.Pi&&xg(a.Hb,c,"keydown",a.rj,q);if(a.gi)if(xg(a.Hb,c,"mousedown",a.hh,q),K){var e;try{e=c.activeElement}catch(d){}for(;e&&"IFRAME"==e.nodeName;){try{var f=e.contentDocument||e.contentWindow.document}catch(g){break}c=f;e=c.activeElement}xg(a.Hb,c,"mousedown",a.hh,q);xg(a.Hb,c,"deactivate",a.gh)}else xg(a.Hb,c,"blur",a.gh);"toggle_display"==
a.$c?(a.H.style.visibility="visible",Be(a.H,q)):"move_offscreen"==a.$c&&a.tb();a.Ma=q;a.Ee?($b(a.Ee,"end",a.kh,u,a),a.Ee.play()):a.kh()}}else Sg(a)}w.tb=ga;function Sg(a,b){if(!a.Ma||!a.dispatchEvent({type:"beforehide",target:b}))return u;a.Hb&&a.Hb.Of();a.Ma=u;a.Wg=xa();a.re?($b(a.re,"end",wa(a.Eg,b),u,a),a.re.play()):a.Eg(b);return q}w.Eg=function(a){"toggle_display"==this.$c?this.ek?Jg(this.Og,0,this):this.Og():"move_offscreen"==this.$c&&(this.H.style.top="-10000px");this.Hf(a)};
w.Og=function(){this.H.style.visibility="hidden";Be(this.H,u)};w.Df=function(){return this.dispatchEvent("beforeshow")};w.kh=function(){this.wf=xa();this.Wg=-1;this.dispatchEvent("show")};w.Hf=function(a){this.dispatchEvent({type:"hide",target:a})};w.hh=function(a){a=a.target;!ie(this.H,a)&&((!this.zg||ie(this.zg,a))&&!(150>xa()-this.wf))&&Sg(this,a)};w.rj=function(a){27==a.keyCode&&Sg(this,a.target)&&(a.preventDefault(),a.stopPropagation())};
w.gh=function(a){if(this.wi){var b=ae(this.H);if(K||ib){if(a=b.activeElement,!a||ie(this.H,a)||"BODY"==a.tagName)return}else if(a.target!=b)return;150>xa()-this.wf||Sg(this)}};function Tg(a,b){this.Xj=4;this.we=b||p;Qg.call(this,a)}C(Tg,Qg);Tg.prototype.tb=function(){if(this.we){var a=!this.Ma&&"move_offscreen"!=this.$c,b=this.t();a&&(b.style.visibility="hidden",Be(b,q));this.we.tb(b,this.Xj,this.Kl);a&&Be(b,u)}};function Ug(a){this.ga=new zc;a&&this.df(a)}function Vg(a){var b=typeof a;return"object"==b&&a||"function"==b?"o"+qa(a):b.substr(0,1)+a}w=Ug.prototype;w.sf=function(){return this.ga.sf()};w.add=function(a){this.ga.set(Vg(a),a)};w.df=function(a){a=yc(a);for(var b=a.length,c=0;c<b;c++)this.add(a[c])};w.Of=function(a){a=yc(a);for(var b=a.length,c=0;c<b;c++)this.remove(a[c])};w.remove=function(a){return this.ga.remove(Vg(a))};w.clear=function(){this.ga.clear()};
w.contains=function(a){a=Vg(a);return Cc(this.ga.ga,a)};w.Tg=function(a){var b=new Ug;a=yc(a);for(var c=0;c<a.length;c++){var e=a[c];this.contains(e)&&b.add(e)}return b};w.Dd=function(){return this.ga.Dd()};w.l=function(){return new Ug(this)};function Wg(a,b,c){this.$b=c||(a?Zd(be(a)):Zd());Tg.call(this,this.$b.Wc("div",{style:"position:absolute;display:none;"}));this.of=new Xd(1,1);this.je=new Ug;a&&Xg(this,a);if(b!=t)if(a=this.t(),"textContent"in a)a.textContent=b;else if(a.firstChild&&3==a.firstChild.nodeType){for(;a.lastChild!=a.firstChild;)a.removeChild(a.lastChild);a.firstChild.data=b}else{for(;c=a.firstChild;)a.removeChild(c);a.appendChild(ae(a).createTextNode(String(b)))}}C(Wg,Tg);var Yg=[];w=Wg.prototype;w.Sa=t;w.className="goog-tooltip";
w.yh=500;w.Oi=0;w.ne=v("$b");function Xg(a,b){b=be(b);a.je.add(b);L(b,"mouseover",a.Ni,u,a);L(b,"mouseout",a.Lg,u,a);L(b,"mousemove",a.Mi,u,a);L(b,"focus",a.Li,u,a);L(b,"blur",a.Lg,u,a)}w.Pf=function(a){var b=this.t();b&&ge(b);Wg.u.Pf.call(this,a);a&&(b=this.$b.ka.body,b.insertBefore(a,b.lastChild))};
w.Df=function(){if(!Qg.prototype.Df.call(this))return u;if(this.anchor)for(var a,b=0;a=Yg[b];b++)ie(a.t(),this.anchor)||Rg(a,u);0<=Ib(Yg,this)||Yg.push(this);a=this.t();a.className=this.className;Zg(this);L(a,"mouseover",this.Ng,u,this);L(a,"mouseout",this.Mg,u,this);$g(this);return q};
w.Hf=function(){Nb(Yg,this);for(var a=this.t(),b,c=0;b=Yg[c];c++)b.anchor&&ie(a,b.anchor)&&Rg(b,u);this.nh&&ah(this.nh);ac(a,"mouseover",this.Ng,u,this);ac(a,"mouseout",this.Mg,u,this);this.anchor=p;if(0==(this.Kb?this.Ma?4:1:this.Yc?3:this.Ma?2:0))this.Be=u;Qg.prototype.Hf.call(this)};w.$g=function(a,b){this.anchor==a&&this.je.contains(this.anchor)&&(this.Be||!this.Ul?(Rg(this,u),this.Ma||(this.anchor=a,this.we=b||bh(this,0)||p,this.Ma&&this.tb(),Rg(this,q))):this.anchor=p);this.Kb=p};
w.ij=function(a){this.Yc=p;a==this.anchor&&(this.Sa==t||this.Sa!=this.t()&&!this.je.contains(this.Sa))&&(!this.Bg||!this.Bg.Sa)&&Rg(this,u)};function ch(a,b){var c=ke(a.$b);a.of.x=b.clientX+c.x;a.of.y=b.clientY+c.y}w.Ni=function(a){var b=dh(this,a.target);this.Sa=b;Zg(this);b!=this.anchor&&(this.anchor=b,this.Kb||(this.Kb=Jg(va(this.$g,this,b,p),this.yh)),eh(this),ch(this,a))};function dh(a,b){try{for(;b&&!a.je.contains(b);)b=b.parentNode;return b}catch(c){return t}}
w.Mi=function(a){ch(this,a);this.Be=q};w.Li=function(a){this.Sa=a=dh(this,a.target);this.Be=q;if(this.anchor!=a){this.anchor=a;var b=bh(this,1);Zg(this);this.Kb||(this.Kb=Jg(va(this.$g,this,a,b),this.yh));eh(this)}};function bh(a,b){if(0==b){var c=a.of.l();return new fh(c)}return new gh(a.Sa)}function eh(a){if(a.anchor)for(var b,c=0;b=Yg[c];c++)ie(b.t(),a.anchor)&&(b.Bg=a,a.nh=b)}
w.Lg=function(a){var b=dh(this,a.target),c=dh(this,a.relatedTarget);b!=c&&(b==this.Sa&&(this.Sa=t),$g(this),this.Be=u,this.Ma&&(!a.relatedTarget||!ie(this.t(),a.relatedTarget))?ah(this):this.anchor=p)};w.Ng=function(){var a=this.t();this.Sa!=a&&(Zg(this),this.Sa=a)};w.Mg=function(a){var b=this.t();if(this.Sa==b&&(!a.relatedTarget||!ie(b,a.relatedTarget)))this.Sa=t,ah(this)};function $g(a){a.Kb&&(fa.clearTimeout(a.Kb),a.Kb=p)}
function ah(a){if(2==(a.Kb?a.Ma?4:1:a.Yc?3:a.Ma?2:0))a.Yc=Jg(va(a.ij,a,a.anchor),a.Oi)}function Zg(a){a.Yc&&(fa.clearTimeout(a.Yc),a.Yc=p)}function fh(a,b){Og.call(this,a,b)}C(fh,Og);fh.prototype.tb=function(a,b,c){b=qe(a);b=te(b);c=c?new le(c.top+10,c.right,c.bottom,c.left+10):new le(10,0,0,10);Mg(this.nf,a,4,c,b,9)&496&&Mg(this.nf,a,4,c,b,5)};function gh(a){Pg.call(this,a,3)}C(gh,Pg);
gh.prototype.tb=function(a,b,c){var e=new Xd(10,0);Lg(this.element,this.Fg,a,b,e,c,9)&496&&Lg(this.element,2,a,1,e,c,5)};function hh(a,b,c,e){a==t&&m(Error("No valid parent element."));(!x(b)||!x(c))&&m(Error("Invalid coordinates."));(e==t||!(e instanceof Je))&&m(Error("Invalid interactor."));Wg.call(this);this.f="caption";this.ab=a;this.fe=b;this.ge=c;this.T=e;this.Fb=t;this.fc=[];a=".x-tooltip {\n background: #C0C0FF;\n color: #000000;\n";a+=" border: 1px solid infotext;\n";a+=" padding: 1px;\n";a+=" font-family: sans-serif;\n";a+="}";this.fc=[a];$b(e,Cd,this.Fd.bind(this));this.uf()}C(hh,Wg);
hh.prototype.uf=function(){var a=oe(this.ab,"position");if("static"==a||""==a)this.ab.style.position="relative";var a=document.getElementsByTagName("head")[0],b=de("style");b.type="text/css";b.media="screen";var c=document.createTextNode(String(this.fc[0]));a.appendChild(b);b.appendChild(c);this.Fb=b;this.we=new Og(this.fe,this.ge)||p;this.Ma&&this.tb();Rg(this,q);Xg(this,this.ab);this.t().classList.add("x-tooltip")};
hh.prototype.Fd=function(){Rg(this,u);this.Fb&&ge(this.Fb);this.t()&&ge(this.t());this.Fb=t};function ih(){Kg.call(this);this.f="renderer3D";this.md=this.pd=this.ld=this.od=this.kd=this.nd=this.Ye=this.Ze=t;this.z=[0,0,0];this.bd=[0,0,0];this.rg=t;this.Ie=new zc;this.xd=new zc;this.pc=new zc;this.qd=new zc;this.Ec=new zc;this.Pc=new zc;this.oc=new zc;this.wd=new zc;this.R={PROGRESSBAR_ENABLED:q,PICKING_ENABLED:q,ORDERING_ENABLED:q,STATISTICS_ENABLED:u,INTERMEDIATE_RENDERING:u}}C(ih,Kg);ih.prototype.__defineGetter__("config",v("R"));w=ih.prototype;
w.Zj=function(){this.md=this.pd=this.ld=this.od=this.kd=this.nd=t;this.z=[0,0,0]};w.If=function(a){ih.u.If.call(this,a);var b=a.fe;a=a.ge;var c=this.Mf(b,a);if(c=this.get(c))if(c=c.Dc){var e=we(this.v);(new hh(this.v,e.x+b+10,e.y+a+10,this.T)).t().innerHTML=c}};
w.Ca=function(){ih.u.Ca.call(this,"experimental-webgl");try{if(this.a.viewport(0,0,this.K,this.A),this.a.clearColor(this.bd[0],this.bd[1],this.bd[2],0),this.a.enable(this.a.BLEND),this.a.blendEquation(this.a.FUNC_ADD),this.a.blendFunc(this.a.SRC_ALPHA,this.a.ONE_MINUS_SRC_ALPHA),this.a.enable(this.a.DEPTH_TEST),this.a.depthFunc(this.a.LEQUAL),this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT),this.R.PICKING_ENABLED){var a=this.a.createFramebuffer(),b=this.a.createRenderbuffer(),c=this.a.createTexture();
this.a.bindTexture(this.a.TEXTURE_2D,c);this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGB,this.K,this.A,0,this.a.RGB,this.a.UNSIGNED_BYTE,t);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_S,this.a.CLAMP_TO_EDGE);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_T,this.a.CLAMP_TO_EDGE);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.NEAREST);this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.NEAREST);this.a.bindFramebuffer(this.a.FRAMEBUFFER,
a);this.a.bindRenderbuffer(this.a.RENDERBUFFER,b);this.a.renderbufferStorage(this.a.RENDERBUFFER,this.a.DEPTH_COMPONENT16,this.K,this.A);this.a.bindRenderbuffer(this.a.RENDERBUFFER,t);this.a.framebufferTexture2D(this.a.FRAMEBUFFER,this.a.COLOR_ATTACHMENT0,this.a.TEXTURE_2D,c,0);this.a.framebufferRenderbuffer(this.a.FRAMEBUFFER,this.a.DEPTH_ATTACHMENT,this.a.RENDERBUFFER,b);this.a.bindFramebuffer(this.a.FRAMEBUFFER,t);this.rg=a}}catch(e){m(Error("Exception while accessing GL Context!\n"+e))}a=new df;
(this.na==t||this.a==t||this.N==t)&&m(Error("Renderer was not initialized properly."));(a==t||!(a instanceof df))&&m(Error("Could not add shaders."));b=Object.keys(ff);Object.keys(ef).every(function(a){a=ef[a];return-1!=this.ce.search(a)||-1!=this.Ud.search(a)}.bind(a))||m(Error("Could not find all attributes in the shader sources."));b.every(function(a){a=ff[a];return-1!=this.ce.search(a)||-1!=this.Ud.search(a)}.bind(a))||m(Error("Could not find all uniforms in the shader sources."));b=this.a.createShader(this.a.FRAGMENT_SHADER);
c=this.a.createShader(this.a.VERTEX_SHADER);this.a.shaderSource(b,a.Ud);this.a.shaderSource(c,a.ce);this.a.compileShader(b);this.a.compileShader(c);this.a.getShaderParameter(b,this.a.COMPILE_STATUS)||m(Error("Fragement Shader compilation failed!\n"+this.a.getShaderInfoLog(b)));this.a.getShaderParameter(c,this.a.COMPILE_STATUS)||m(Error("Vertex Shader compilation failed!\n"+this.a.getShaderInfoLog(c)));var d=this.a.createProgram();this.a.attachShader(d,c);this.a.attachShader(d,b);this.a.linkProgram(d);
this.a.getProgramParameter(d,this.a.LINK_STATUS)||m(Error("Could not create shader program!\n"+this.a.getShaderInfoLog(b)+"\n"+this.a.getShaderInfoLog(c)+"\n"+this.a.getProgramInfoLog(d)));this.a.useProgram(d);this.Ye=d;Object.keys(ef).forEach(function(a){a=ef[a];this.Ie.set(a,this.a.getAttribLocation(this.Ye,a));this.a.enableVertexAttribArray(this.Ie.get(a))}.bind(this));Object.keys(ff).forEach(function(a){a=ff[a];this.xd.set(a,this.a.getUniformLocation(this.Ye,a))}.bind(this));this.Ze=a};
w.ub=function(a){ih.u.ub.call(this,a);var b=u;if(a!=t){this.get(a.qa)&&(b=q);var c=a.qa,e=a.h,d=a.n,f=a.pa,g=a.G,h=a.r,l=a.ja,j=a.xa,k=a.e,n=a.F;if(k!=t&&k.r!=t&&k.r.j)this.ub(k);else if(k!=t&&k.j&&this.ub(k),j!=t&&j.r!=t&&j.r.j)this.aa.load(j,a);else if(g!=t&&g.r!=t&&g.r.j)this.aa.load(g,a);else{if(h!=t&&la(h))if(a.yc!=t){if(a.yc.xf!=h.length||!a.j)return}else{b=0;c=h.length;for(b=0;b<c;b++)this.aa.load(h[b],a);return}else{if(h!=t&&h.j){this.aa.load(a,a);return}if(n!=t&&n.r!=t&&n.r.j){this.aa.load(n,
a);return}}if(0<a.c.length){h=a.c;j=h.length;for(k=k=0;k<j;k++)this.ub(h[k])}if(e){for(h=0;this.Xd;)h++,window.console.log("Possible thread lock avoided: "+h);this.Xd=q;j=a instanceof Xe&&a.yb instanceof hf;b&&(g!=t&&g.j)&&(h=this.oc.get(c),h!=t&&this.a.isBuffer(h.P)&&this.a.deleteBuffer(h.P));h=t;g!=t&&(!b||g.j?(h=a.nc,h==t&&m(Error("Can not add an object and texture without valid coordinate mapping! Set the textureCoordinateMap!")),k=u,g.Wb&&(k=q),this.a.pixelStorei(this.a.UNPACK_FLIP_Y_WEBGL,k),
k=this.a.createTexture(),k.Si=g.ib,this.wd.set(g.qa,k),this.a.bindTexture(this.a.TEXTURE_2D,k),g.Wb?(k=this.a.RGBA,g.hg&&(k=this.a.LUMINANCE,this.a.pixelStorei(this.a.UNPACK_ALIGNMENT,1)),this.a.texImage2D(this.a.TEXTURE_2D,0,k,g.Xe,g.We,0,k,this.a.UNSIGNED_BYTE,g.Wb)):this.a.texImage2D(this.a.TEXTURE_2D,0,this.a.RGBA,this.a.RGBA,this.a.UNSIGNED_BYTE,k.Si),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_S,this.a.CLAMP_TO_EDGE),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_WRAP_T,
this.a.CLAMP_TO_EDGE),j?(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.NEAREST),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.NEAREST)):(this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MAG_FILTER,this.a.LINEAR),this.a.texParameteri(this.a.TEXTURE_2D,this.a.TEXTURE_MIN_FILTER,this.a.LINEAR)),this.a.bindTexture(this.a.TEXTURE_2D,t),k=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,k),this.a.bufferData(this.a.ARRAY_BUFFER,new Float32Array(h),
this.a.STATIC_DRAW),h=new Sd(k,h.length,2),this.oc.set(c,h),g.j=u):h=this.oc.get(c));jg(this.aa,0.1);if(j)this.Xd=u,D.Da(this.f+".update"),jg(this.aa,0.9);else{if(!b||e.j||l.j){j=l.Q;g=D.g.ba(j,e.mb,e.nb,e.ob);j=D.g.ba(j,e.jb,e.kb,e.lb);if(this.nd===t||g.x<this.nd)this.nd=g.x;if(this.kd===t||j.x>this.kd)this.kd=j.x;if(this.od===t||g.y<this.od)this.od=g.y;if(this.ld===t||j.y>this.ld)this.ld=j.y;if(this.pd===t||g.d<this.pd)this.pd=g.d;if(this.md===t||j.d>this.md)this.md=j.d;this.z=[(this.nd+this.kd)/
2,(this.od+this.ld)/2,(this.pd+this.md)/2];l.j=u}b&&e.j&&(l=this.pc.get(c),l!=t&&this.a.isBuffer(l.P)&&this.a.deleteBuffer(l.P));l=t;!b||e.j?(l=this.a.createBuffer(),e.Jb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,l),this.a.bufferData(this.a.ARRAY_BUFFER,e.da,this.a.STATIC_DRAW),l=new Sd(l,e.count,3),e.j=u):l=this.pc.get(c);jg(this.aa,0.3);b&&d.j&&(g=this.pc.get(c),g!=t&&this.a.isBuffer(g.P)&&this.a.deleteBuffer(g.P));g=t;!b||d.j?(g=this.a.createBuffer(),d.Jb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,
g),this.a.bufferData(this.a.ARRAY_BUFFER,d.da,this.a.STATIC_DRAW),g=new Sd(g,d.count,3),d.j=u):g=this.qd.get(c);jg(this.aa,0.3);b&&(f&&f.j)&&(d=this.Ec.get(c),d!=t&&this.a.isBuffer(d.P)&&this.a.deleteBuffer(d.P));d=t;f&&(!b||f.j?(f.length!=e.length&&m(Error("Mismatch between points and point colors.")),d=this.a.createBuffer(),f.Jb(),this.a.bindBuffer(this.a.ARRAY_BUFFER,d),this.a.bufferData(this.a.ARRAY_BUFFER,f.da,this.a.STATIC_DRAW),d=new Sd(d,f.count,3),f.j=u):d=this.Ec.get(c));jg(this.aa,0.2);
b&&(n&&n.j)&&(f=this.Pc.get(c),f!=t&&this.a.isBuffer(f.P)&&this.a.deleteBuffer(f.P));f=t;n&&(f=n.dd,!b||n.j?(f.length!=e.length&&m(Error("Mismatch between points and scalars.")),e=this.a.createBuffer(),this.a.bindBuffer(this.a.ARRAY_BUFFER,e),this.a.bufferData(this.a.ARRAY_BUFFER,f,this.a.STATIC_DRAW),f=new Sd(e,f.length,3),n.j=u):f=this.Pc.get(c));jg(this.aa,0.1);b||this.pb.add(a);this.pc.set(c,l);this.qd.set(c,g);this.Ec.set(c,d);this.oc.set(c,h);this.Pc.set(c,f);this.Xd=a.j=u}}else a.j=u}}};
w.Mf=function(a,b){if(this.R.PICKING_ENABLED){this.dc(q,u);var c=new Uint8Array(4);this.a.readPixels(a,this.A-b,1,1,this.a.RGBA,this.a.UNSIGNED_BYTE,c);return c[0]+255*c[1]+65025*c[2]}return-1};
w.dc=function(a,b){ih.u.dc.call(this,a,b);this.a.viewport(0,0,this.K,this.A);this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);var c=this.pb.I,e=c.length;if(0!=e){a?this.a.bindFramebuffer(this.a.FRAMEBUFFER,this.rg):this.a.bindFramebuffer(this.a.FRAMEBUFFER,t);var d=this.N.Ve,f=this.N.o;this.a.uniformMatrix4fv(this.xd.get("perspective"),u,d);this.a.uniformMatrix4fv(this.xd.get("view"),u,f);d=this.z;this.a.uniform3f(this.xd.get("center"),parseFloat(d[0]),parseFloat(d[1]),parseFloat(d[2]));
f=this.Ha.length;for(d=0;d<f;++d){var g=this.Ha[d];if(g instanceof P){var h=D.g.ba(this.N.o,g.s[0]+g.b[0].i[0],g.s[1]+g.b[0].i[1],g.s[2]+g.b[0].i[2]),l=D.g.ba(this.N.o,g.s[0]-g.b[0].i[0],g.s[1]-g.b[0].i[1],g.s[2]-g.b[0].i[2]),j=Math.abs(h.d-l.d),h=D.g.ba(this.N.o,g.s[0]+g.b[1].i[0],g.s[1]+g.b[1].i[1],g.s[2]+g.b[1].i[2]),l=D.g.ba(this.N.o,g.s[0]-g.b[1].i[0],g.s[1]-g.b[1].i[1],g.s[2]+-g.b[1].i[2]),k=Math.abs(h.d-l.d),h=D.g.ba(this.N.o,g.s[0]+g.b[2].i[0],g.s[1]+g.b[2].i[1],g.s[2]+g.b[2].i[2]),l=D.g.ba(this.N.o,
g.s[0]-g.b[2].i[0],g.s[1]-g.b[2].i[1],g.s[2]-g.b[2].i[2]),h=Math.max(j,k,Math.abs(h.d-l.d));h==j?gf(g,0):h==k?gf(g,1):gf(g,2)}}if(this.R.ORDERING_ENABLED){j=u;f=this.Ha;g=f.length-1;do if(d=f[g],d instanceof P&&d.Ra&&-1!=d.X){var j=d.c[d.X].c,k=d.X,h=D.g.ba(this.N.o,d.s[0]+d.b[k].B[0],d.s[1]+d.b[k].B[1],d.s[2]+d.b[k].B[2]),l=D.g.ba(this.N.o,d.s[0]-d.b[k].B[0],d.s[1]-d.b[k].B[1],d.s[2]-d.b[k].B[2]),h=h.d-l.d,l=Math.max(d.Cc[d.X],Math.max(d.Cc[d.X+4],d.Cc[d.X+8])),n=Math.min(d.Cc[d.X],Math.min(d.Cc[d.X+
4],d.Cc[d.X+8]));if(0>h*(l+n))for(h=h=0;h<d.ud[k]-1;h++)j[h]&&(j[h].za=d.za,j[h].ya=d.b[k].Sc*h);else for(h=d.ud[k]-1;0<=h;h--)j[h]&&(j[h].za=d.za,j[h].ya=(d.ud[k]-1)*d.b[k].Sc-d.b[k].Sc*h);j=q}while(g--);f=this.pb.I;g=f.length-1;do if(d=f[g],d.O&&!(1==d.za||d instanceof Xe))j=d,k=d.h.Rd,d=D.g.ba(d.ja.Q,k[0],k[1],k[2]),d=D.g.ba(this.N.o,d.x,d.y,d.d),d=D.m.rf(this.N.ic,d),d=Math.round(1E3*d)/1E3,j.ya=d,j=q;while(g--);j&&this.pb.sort()}if(f=!a&&b!=t&&b&&this.R.STATISTICS_ENABLED)var s=0;var d=this.Ie,
g=d.get("vertexPosition"),j=d.get("vertexNormal"),k=d.get("vertexColor"),h=d.get("vertexTexturePos"),l=d.get("vertexScalar"),d=this.xd,n=d.get("usePicking"),r=d.get("useObjectColor"),y=d.get("objectColor"),z=d.get("useScalars"),F=d.get("scalarsReplaceMode"),G=d.get("scalarsMin"),H=d.get("scalarsMax"),B=d.get("scalarsMinColor"),E=d.get("scalarsMaxColor"),I=d.get("scalarsInterpolation"),N=d.get("scalarsMinThreshold"),Q=d.get("scalarsMaxThreshold"),O=d.get("objectOpacity"),S=d.get("labelmapOpacity"),
da=d.get("labelmapColor"),J=d.get("useTexture"),ba=d.get("useLabelMapTexture"),ka=d.get("textureSampler"),U=d.get("textureSampler2"),V=d.get("volumeLowerThreshold"),Ga=d.get("volumeUpperThreshold"),tb=d.get("volumeScalarMin"),ub=d.get("volumeScalarMax"),vb=d.get("volumeWindowLow"),kb=d.get("volumeWindowHigh"),Zc=d.get("volumeScalarMinColor"),mh=d.get("volumeScalarMaxColor"),Bg=d.get("volumeTexture"),nh=d.get("objectTransform"),oh=d.get("pointSize"),d=e;do{var ea=c[e-d];if(ea){var ja=t;ea instanceof
Xe&&ea.yb&&(ja=ea.yb);if(ea.O&&(!ja||ja.O)&&(!a||ea.rd)){var Ba=ea.qa,cb=ea.jd,nb=this.pc.get(Ba),ob=this.qd.get(Ba),Ze=this.Ec.get(Ba),Kb=this.Pc.get(Ba),$e=this.oc.get(Ba);this.a.bindBuffer(this.a.ARRAY_BUFFER,nb.P);this.a.vertexAttribPointer(g,nb.Ob,this.a.FLOAT,u,0,0);this.a.bindBuffer(this.a.ARRAY_BUFFER,ob.P);this.a.vertexAttribPointer(j,ob.Ob,this.a.FLOAT,u,0,0);a?this.a.uniform1i(n,q):this.a.uniform1i(n,u);Ze&&!a&&!cb?(this.a.uniform1i(r,u),this.a.bindBuffer(this.a.ARRAY_BUFFER,Ze.P),this.a.vertexAttribPointer(k,
Ze.Ob,this.a.FLOAT,u,0,0)):(ob=1,cb&&!a&&(ob=0),this.a.uniform1i(r,ob),ob=ea.w,a&&(ob=[Math.floor(Ba%65025%255)/255,Math.floor(Ba%65025/255)/255,Math.floor(Ba/65025)/255]),this.a.uniform3f(y,parseFloat(ob[0]),parseFloat(ob[1]),parseFloat(ob[2])),this.a.vertexAttribPointer(k,nb.Ob,this.a.FLOAT,u,0,0));Kb&&!a&&!cb?(this.a.uniform1i(z,q),this.a.uniform1i(F,ea.F.ug),Ba=ea.F.Rb,cb=ea.F.Pb,this.a.uniform3f(B,parseFloat(Ba[0]),parseFloat(Ba[1]),parseFloat(Ba[2])),this.a.uniform3f(E,parseFloat(cb[0]),parseFloat(cb[1]),
parseFloat(cb[2])),this.a.uniform1f(N,parseFloat(ea.F.U)),this.a.uniform1f(Q,parseFloat(ea.F.W)),this.a.uniform1f(G,parseFloat(ea.F.ra)),this.a.uniform1f(H,parseFloat(ea.F.ia)),this.a.uniform1i(I,parseInt(ea.F.Le,10)),this.a.bindBuffer(this.a.ARRAY_BUFFER,Kb.P),this.a.vertexAttribPointer(l,Kb.Ob,this.a.FLOAT,u,0,0)):(this.a.uniform1i(z,u),this.a.vertexAttribPointer(l,nb.Ob,this.a.FLOAT,u,0,0));this.a.uniform1f(O,parseFloat(ea.za));ea.G&&$e&&!a?(this.a.uniform1i(J,q),this.a.activeTexture(this.a.TEXTURE0),
this.a.bindTexture(this.a.TEXTURE_2D,this.wd.get(ea.G.qa)),this.a.uniform1i(ka,0),this.a.bindBuffer(this.a.ARRAY_BUFFER,$e.P),this.a.vertexAttribPointer(h,$e.Ob,this.a.FLOAT,u,0,0),this.a.uniform1i(Bg,u)):(this.a.uniform1i(J,u),this.a.vertexAttribPointer(h,nb.Ob,this.a.FLOAT,u,0,0));ja&&(this.a.uniform1i(Bg,q),this.a.uniform1f(V,ja.U),this.a.uniform1f(Ga,ja.W),this.a.uniform1f(tb,ja.ra),this.a.uniform1f(ub,ja.ia),Ba=ja.Rb,cb=ja.Pb,this.a.uniform3f(Zc,parseFloat(Ba[0]),parseFloat(Ba[1]),parseFloat(Ba[2])),
this.a.uniform3f(mh,parseFloat(cb[0]),parseFloat(cb[1]),parseFloat(cb[2])),this.a.uniform1f(vb,ja.fa),this.a.uniform1f(kb,ja.ea),Kb=ja.e,this.a.uniform1i(ba,u),ja.Ra?this.a.uniform1f(O,parseFloat(ja.za)):Kb&&Kb.O&&(ja=ea.e.qa,this.a.uniform1i(ba,q),this.a.activeTexture(this.a.TEXTURE1),this.a.bindTexture(this.a.TEXTURE_2D,this.wd.get(ja)),this.a.uniform1i(U,1),this.a.uniform1f(S,Kb.za),this.a.uniform4fv(da,Kb.$e)));this.a.uniformMatrix4fv(nh,u,ea.ja.Q);ja=1;"POINTS"==ea.Ia&&(ja=ea.sd);this.a.uniform1f(oh,
ja);ja=-1;ea.Ia==id?(ja=this.a.TRIANGLES,f&&(s+=nb.ed/3)):"LINES"==ea.Ia?(this.a.lineWidth(ea.Lc),ja=this.a.LINES):"POINTS"==ea.Ia?ja=this.a.POINTS:"TRIANGLE_STRIPS"==ea.Ia?(ja=this.a.TRIANGLE_STRIP,f&&(s+=nb.ed/3)):"POLYGONS"==ea.Ia&&(ja=0==nb.ed%3?this.a.TRIANGLES:this.a.TRIANGLE_FAN,f&&(s+=nb.ed/3));this.a.drawArrays(ja,0,nb.ed)}}}while(--d);f&&Math.round(s)}};
w.remove=function(a){ih.u.remove.call(this,a);if(0<a.c.length)for(var b=a.c,c=b.length,e=0,e=0;e<c;e++)"undefined"!=typeof b[e]&&this.remove(b[e]);b=a.qa;c=this.oc.get(b);c!=t&&this.a.isBuffer(c.P)&&this.a.deleteBuffer(c.P);if(a.G&&(c=this.wd.get(a.G.qa)))this.a.deleteTexture(c),this.wd.remove(a.G.qa);c=this.pc.get(b);c!=t&&this.a.isBuffer(c.P)&&this.a.deleteBuffer(c.P);c=this.qd.get(b);c!=t&&this.a.isBuffer(c.P)&&this.a.deleteBuffer(c.P);c=this.Ec.get(b);c!=t&&this.a.isBuffer(c.P)&&this.a.deleteBuffer(c.P);
c=this.Pc.get(b);c!=t&&this.a.isBuffer(c.P)&&this.a.deleteBuffer(c.P);this.pc.remove(b);this.qd.remove(b);this.Ec.remove(b);this.oc.remove(b);this.Pc.remove(b);this.pb.remove(a);return q};w.Ta=function(){this.Ze=t;delete this.Ze;this.a.clear(this.a.COLOR_BUFFER_BIT|this.a.DEPTH_BUFFER_BIT);ih.u.Ta.call(this)};ih.prototype.__defineGetter__("bgColor",v("bd"));ih.prototype.__defineSetter__("bgColor",ca("bd"));
ih.prototype.Vj=function(a,b,c,e,d){c!=t||(c=4);e!=t||(e=2);if(d==t){d=this.Mf(a,b);if(-1==d)return t;d=this.get(d);if(!d)return t}var f=Qe(this.N,2*(a/this.K)-1,2*((this.A-b)/this.A)-1,0);a=Qe(this.N,2*(a/this.K)-1,2*((this.A-b)/this.A)-1,1);f[0]+=this.z[0];f[1]+=this.z[1];f[2]+=this.z[2];a[0]+=this.z[0];a[1]+=this.z[1];a[2]+=this.z[2];b=[d.h.mb,d.h.nb,d.h.ob];var g=[d.h.jb,d.h.nb,d.h.ob],h=[d.h.jb,d.h.kb,d.h.ob],l=[d.h.mb,d.h.kb,d.h.ob],j=[d.h.mb,d.h.kb,d.h.lb],k=[d.h.mb,d.h.nb,d.h.lb],n=[d.h.jb,
d.h.kb,d.h.lb],s=[d.h.jb,d.h.nb,d.h.lb];b=[D.g.ba(d.ja.Q,b[0],b[1],b[2]),D.g.ba(d.ja.Q,g[0],g[1],g[2]),D.g.ba(d.ja.Q,h[0],h[1],h[2]),D.g.ba(d.ja.Q,l[0],l[1],l[2]),D.g.ba(d.ja.Q,j[0],j[1],j[2]),D.g.ba(d.ja.Q,k[0],k[1],k[2]),D.g.ba(d.ja.Q,n[0],n[1],n[2]),D.g.ba(d.ja.Q,s[0],s[1],s[2])];var g=[Infinity,-Infinity,Infinity,-Infinity,Infinity,-Infinity],r;for(r in b)r=b[r],g=[Math.min(g[0],r.x),Math.max(g[1],r.x),Math.min(g[2],r.y),Math.max(g[3],r.y),Math.min(g[4],r.d),Math.max(g[5],r.d)];r=g;b=[];g=[];
for(h=0;6>h;h++){var l=Math.floor(h/2),j=(l+1)%3,k=(l+2)%3,s=(2+2*l)%6,y=(4+2*l)%6,z=(r[h]-f[l])*(1/a[l]);Infinity!=z&&-Infinity!=z&&(n=f[j]+a[j]*z,z=f[k]+a[k]*z,n>=r[s]&&n<=r[s+1]&&z>=r[y]&&z<=r[y+1]?(s=[],s[l]=r[h],s[j]=n,s[k]=z,b.push(s)):(s=[],s[l]=r[h],s[j]=n,s[k]=z,g.push(s)))}a=[b,g];a=a[0];if(0==a.length)return t;g=Array(2);for(r=0;2>r;r++)b=a[r],g[r]=Math.sqrt((b[0]-f[0])*(b[0]-f[0])+(b[1]-f[1])*(b[1]-f[1])+(b[2]-f[2])*(b[2]-f[2]));f=b=r=t;g[0]<g[1]?(r=a[0],b=a[1]):(r=a[1],b=a[0]);f=Math.sqrt((r[0]-
b[0])*(r[0]-b[0])+(r[1]-b[1])*(r[1]-b[1])+(r[2]-b[2])*(r[2]-b[2]));f/=c;a=r;r=[b[0]-r[0],b[1]-r[1],b[2]-r[2]];b=Math.sqrt(r[0]*r[0]+r[1]*r[1]+r[2]*r[2]);g=[r[0]/b,r[1]/b,r[2]/b];h=d.h.da;l=h.length;for(r=0;r<f;r+=c){a=[a[0]+c*g[0],a[1]+c*g[1],a[2]+c*g[2]];for(b=0;b<l;b+=3)if(j=h[b],k=h[b+1],n=h[b+2],s=new D.m(j,k,n),s=D.g.ba(d.ja.Q,j,k,n),Math.sqrt((a[0]-s.x)*(a[0]-s.x)+(a[1]-s.y)*(a[1]-s.y)+(a[2]-s.d)*(a[2]-s.d))<=e)return[s.x,s.y,s.d]}return t};A("X.renderer3D",ih);
A("X.renderer3D.prototype.init",ih.prototype.Ca);A("X.renderer3D.prototype.add",ih.prototype.add);A("X.renderer3D.prototype.onShowtime",ih.prototype.lh);A("X.renderer3D.prototype.onRender",ih.prototype.jh);A("X.renderer3D.prototype.get",ih.prototype.get);A("X.renderer3D.prototype.render",ih.prototype.cc);A("X.renderer3D.prototype.destroy",ih.prototype.Ta);A("X.renderer3D.prototype.remove",ih.prototype.remove);A("X.renderer3D.prototype.resetBoundingBox",ih.prototype.Zj);
A("X.renderer3D.prototype.resetViewAndRender",ih.prototype.Nd);A("X.renderer3D.prototype.pick",ih.prototype.Mf);A("X.renderer3D.prototype.pick3d",ih.prototype.Vj);A("X.renderer3D.prototype.afterRender",ih.prototype.yg);function jh(){Y.call(this);this.f="mesh";Fa(this,new xc)}C(jh,Y);A("X.mesh",jh);function kh(){Y.call(this);this.f="fibers";Fa(this,new xc)}C(kh,Y);A("X.fibers",kh);function lh(){Kg.call(this);this.f="renderer2D";this.Qa=t;this.Fa=-1;this.Sb=[];this.kg=this.fd=this.fg=this.Vd=t;this.Rc=this.Uc=this.Qc=this.Tc=0;this.ea=this.fa=this.W=this.U=this.Je=-1;this.lg=new Float32Array([-255,-255,-255,-255]);this.sg=q;this.xb=1}C(lh,Kg);w=lh.prototype;w.remove=function(a){lh.u.remove.call(this,a);this.pb.remove(a);return q};w.Gj=aa();w.Qj=aa();
w.Jf=function(a){lh.u.Jf.call(this,a);var b=this.Ha[0];if(b){var c="",c=0==this.Fa?"indexX":1==this.Fa?"indexY":"indexZ";b[c]=a.V?b[c]+1:b[c]-1;eval("this.onScroll();")}};w.Rj=function(a){var b=this.Ha[0];if(b){var c=b.ea-b.fa,e=c/2,d=parseInt(c+c/15*-a.cf,10);a=parseInt(e+e/15*a.Qe,10);c==d&&d++;e==a&&a++;b.fa-=parseInt(e-a,10);b.fa-=parseInt(c-d,10);b.fa=Math.max(b.fa,b.ra);b.ea-=parseInt(e-a,10);b.ea+=parseInt(c-d,10);b.ea=Math.min(b.ea,b.ia);eval("this.onWindowLevel();")}};
lh.prototype.__defineGetter__("orientation",v("Qa"));lh.prototype.__defineSetter__("orientation",function(a){a=a.toUpperCase();"AXIAL"==a?(a="Z",this.Fa=2):"SAGITTAL"==a?(a="X",this.Fa=0):"CORONAL"==a&&(a="Y",this.Fa=1);"X"!=a&&("Y"!=a&&"Z"!=a)&&m(Error("Invalid orientation."));this.Qa=a});lh.prototype.__defineGetter__("radiological",v("sg"));lh.prototype.__defineGetter__("normalizedScale",v("xb"));lh.prototype.__defineGetter__("canvasWidth",function(){return this.na.width});
lh.prototype.__defineGetter__("canvasHeight",function(){return this.na.height});lh.prototype.__defineGetter__("sliceWidth",v("Tc"));lh.prototype.__defineGetter__("sliceHeight",v("Qc"));lh.prototype.__defineSetter__("radiological",ca("sg"));w=lh.prototype;
w.Ca=function(){this.Qa||m(Error("No 2D orientation set."));lh.u.Ca.call(this,"2d");this.a.fillStyle="rgba(50,50,50,0)";this.a.fillRect(0,0,this.na.width,this.na.height);this.Vd=de("canvas");this.fd=de("canvas");this.fd.style.Cl="pixelated";L(this.N,xd,this.Rj.bind(this))};w.ve=function(){lh.u.ve.call(this);ph(this)};w.Nd=function(){lh.u.Nd.call(this);ph(this);var a=this.Ha[0];a&&(a.ea=a.ia,a.fa=a.ra)};w.update=function(a){this.ub(a);this.Je=-1};
w.ub=function(a){lh.u.ub.call(this,a);var b=u;this.get(a.qa)&&(b=q);if(a instanceof P){var c=a.r,e=a.e,d=a.xa;if(e!=t&&e.r!=t&&e.r.j)this.ub(e);else if(d!=t&&d.r!=t&&d.r.j)this.aa.load(d,a);else{if(c!=t&&la(c))if(a.yc!=t){if(a.yc.xf!=c.length)return}else{b=0;e=c.length;for(b=0;b<e;b++)this.aa.load(c[b],a);return}else if(c!=t&&c.j){this.aa.load(a,a);return}this.Fa="X"==this.Qa?0:"Y"==this.Qa?1:2;this.bb=a.c[this.Fa].c;d=t;d=0==this.Fa?a.indexX:1==this.Fa?a.indexY:a.indexZ;c=a.c[this.Fa].c[d].jg;e=
a.c[this.Fa].c[d].ig;this.Uc=a.c[this.Fa].c[d].Vc;this.Rc=a.c[this.Fa].c[d].Gc;this.Tc=c;this.Qc=e;d=this.Vd;d.width=c;d.height=e;var f=this.fd;f.width=c;f.height=e;this.fg=d.getContext("2d");this.kg=f.getContext("2d");b||(this.pb.add(a),ph(this))}}};function ph(a){var b=Math.min(a.K/(a.Tc*a.Uc),a.A/(a.Qc*a.Rc));a.N.o[14]=b}w.Hj=aa();
w.Ih=function(a,b){var c=this.Ha[0],e=this.N.o,d=t,f=this.Tc,g=this.Qc,h=t,l=t;if("Y"==this.Qa)d=this.bb[parseInt(c.indexY,10)],h=d.Vc,l=d.Gc,this.Sb[0]="rgba(255,0,0,.3)",this.Sb[1]="rgba(0,0,255,.3)";else if("Z"==this.Qa)d=this.bb[parseInt(c.indexZ,10)],h=d.Vc,l=d.Gc,this.Sb[0]="rgba(255,0,0,.3)",this.Sb[1]="rgba(0,255,0,.3)";else{d=this.bb[parseInt(c.indexX,10)];h=d.Gc;l=d.Vc;this.Sb[0]="rgba(0,255,0,.3)";this.Sb[1]="rgba(0,0,255,.3)";var j=f,f=g,g=j}var k=1*e[12],e=-1*e[13],j=[this.K/2,this.A/
2],h=f*h*this.xb,l=g*l*this.xb,n=j[0]-h/2,j=j[1]-l/2,n=n+k*this.xb,j=j+e*this.xb;return a>n&&a<n+h&&b>j&&b<j+l?(k=(a-n)/h*f,e=(b-j)/l*g,l=d.ei[4],"X"==this.Qa?(j=f-k,k=e,e=j):"Y"==this.Qa?k=f-k:"Z"==this.Qa&&(k=f-k,e=g-e),k=d.di+k*d.Vc,e=d.Yh+e*d.Gc,k=Qc(k,e,l,1),f=Rc(),cd(d.Rh,k,f),f=[Math.floor(f[0]),Math.floor(f[1]),Math.floor(f[2])],g=Rc(),cd(d.Sh,k,g),d=Math.round((c.b[0].i[0]*g[0]+c.b[0].i[1]*g[1]+c.b[0].i[2]*g[2]+c.b[0].Te)/c.b[0].Sc),d>=c.b[0].p?d=c.b[0].p-1:0>d&&(d=0),k=Math.round((c.b[1].i[0]*
g[0]+c.b[1].i[1]*g[1]+c.b[1].i[2]*g[2]+c.b[1].Te)/c.b[1].Sc),k>=c.b[1].p?k=c.b[1].p-1:0>k&&(k=0),e=Math.round((c.b[2].i[0]*g[0]+c.b[2].i[1]*g[1]+c.b[2].i[2]*g[2]+c.b[2].Te)/c.b[2].Sc),e>=c.b[2].p?e=c.b[2].p-1:0>e&&(e=0),[[d,k,e],[f[0],f[1],f[2]],[g[0],g[1],g[2]]]):t};
w.dc=function(a,b){lh.u.dc.call(this,a,b);if(0!=this.pb.I.length){var c=this.Ha[0],e=t,e=0==this.Fa?c.indexX:1==this.Fa?c.indexY:c.indexZ,d=this.bb[parseInt(e,10)].jg,f=this.bb[parseInt(e,10)].ig;this.Uc=this.bb[parseInt(e,10)].Vc;this.Rc=this.bb[parseInt(e,10)].Gc;this.Tc=d;this.Qc=f;var g=this.K,h=this.A,l=this.N.o;this.a.save();this.a.clearRect(-g,-h,2*g,2*h);this.a.restore();this.xb=Math.max(l[14],1E-4);this.a.setTransform(this.xb,0,0,this.xb,0,0);var j=1*l[12],l=-1*l[13],k=t;c.e&&(k=c.e.$e);
var n=this.bb[parseInt(e,10)],s=n.G.Wb,n=n.e,r=t;n&&(r=n.Wb);var y=this.Tc,z=this.Qc,F=this.fg,G=this.kg,H=F.getImageData(0,0,y,z),B=G.getImageData(0,0,y,z),E=H.data,I=B.data,N=E.length,Q=c.U,O=c.W,S=c.fa,da=c.ea;if(this.Je!=e||this.U!=Q||this.W!=O||this.fa!=S||this.ea!=da||k&&!tg(k,this.lg,0)){var J=this.Vd;J.width=d;J.height=f;J=this.fd;J.width=d;J.height=f;d=0;do{var J=[0,0,0,0],f=[0,0,0,0],ba=s[d]/255*(c.ia-c.ra)+c.ra,ka=da-S,U=ka/2+S,V=0,V=ba<U-ka/2?0:ba>U+ka/2?255:255*(ba-(U-ka/2))/ka;ba>=Q&&
ba<=O&&(J=new R(c.Rb[0],c.Rb[1],c.Rb[2]),J=(new R(c.Pb[0],c.Pb[1],c.Pb[2])).scale(V).add(J.scale(255-V)),J=[Math.floor(J.x),Math.floor(J.y),Math.floor(J.d),255],n&&(-255==k[3]?f=[r[d],r[d+1],r[d+2],r[d+3]]:tg(k,r,d)&&(f=[r[d],r[d+1],r[d+2],r[d+3]])));"X"==this.Qa?(E[d]=J[0],E[d+1]=J[1],E[d+2]=J[2],E[d+3]=J[3],I[d]=f[0],I[d+1]=f[1],I[d+2]=f[2],I[d+3]=f[3]):"Y"==this.Qa?(V=Math.floor(d/(4*y)),V=4*V*y+(4*(y-1)-(d-4*V*y)),E[V]=J[0],E[V+1]=J[1],E[V+2]=J[2],E[V+3]=J[3],I[V]=f[0],I[V+1]=f[1],I[V+2]=f[2],
I[V+3]=f[3]):(V=N-1-d,E[V-3]=J[0],E[V-2]=J[1],E[V-1]=J[2],E[V]=J[3],I[V-3]=f[0],I[V-2]=f[1],I[V-1]=f[2],I[V]=f[3]);d+=4}while(d<N);F.putImageData(H,0,0);G.putImageData(B,0,0);this.Je=e;this.U=Q;this.W=O;this.fa=S;this.ea=da;n&&(this.lg=k)}this.a.globalAlpha=1;this.a.translate(g/2/this.xb,h/2/this.xb);"X"==this.Qa&&(this.a.rotate(0.5*Math.PI),e=j,j=l,l=-e);j=-y*this.Uc/2+j;l=-z*this.Rc/2+l;this.a.drawImage(this.Vd,j,l,y*this.Uc,z*this.Rc);n&&c.e.O&&(this.a.globalAlpha=1,this.a.drawImage(this.fd,j,
l,y*this.Uc,z*this.Rc));if(this.R.SLICENAVIGATORS)if(this.na.style.cursor="none",this.T.Yd&&this.T.wg&&!this.T.wb){if(j=this.T.ua,j=this.Ih(j[0],j[1]))c.Cb=j[0][0],c.Db=j[0][1],c.Eb=j[0][2],c.q(u),this.onSliceNavigation(),this.a.setTransform(1,0,0,1,0,0),this.a.beginPath(),this.a.moveTo(this.T.ua[0],0),this.a.lineTo(this.T.ua[0],this.T.ua[1]-1),this.a.moveTo(this.T.ua[0],this.T.ua[1]+1),this.a.lineTo(this.T.ua[0],this.A),this.a.strokeStyle=this.Sb[0],this.a.stroke(),this.a.closePath(),this.a.beginPath(),
this.a.moveTo(0,this.T.ua[1]),this.a.lineTo(this.T.ua[0]-1,this.T.ua[1]),this.a.moveTo(this.T.ua[0]+1,this.T.ua[1]),this.a.lineTo(this.K,this.T.ua[1]),this.a.strokeStyle=this.Sb[1],this.a.stroke(),this.a.closePath(),this.a.font="10pt Arial",this.a.textAlign="left",this.a.textBaseline="top",this.a.fillStyle="white",this.a.fillText("RAS: "+j[2][0].toFixed(2)+", "+j[2][1].toFixed(2)+", "+j[2][2].toFixed(2),0,0),y=n=l="undefined","undefined"!=typeof c.$[j[1][2].toFixed(0)]&&"undefined"!=typeof c.$[j[1][2].toFixed(0)][j[1][1].toFixed(0)]&&
(l=c.$[j[1][2].toFixed(0)][j[1][1].toFixed(0)][j[1][0].toFixed(0)],c.L&&(n=c.e.$[j[1][2].toFixed(0)][j[1][1].toFixed(0)][j[1][0].toFixed(0)],c.e.cd&&(y=c.e.cd.get(n),"undefined"!=typeof y&&(y=y[0])))),this.a.fillText("Background: "+l+" ("+j[1][0].toFixed(0)+", "+j[1][1].toFixed(0)+", "+j[1][2].toFixed(0)+")",0,15),c.L&&this.a.fillText("Labelmap: "+y+" ("+n+")",0,30)}else this.na.style.cursor="default"}};A("X.renderer2D",lh);A("X.renderer2D.prototype.init",lh.prototype.Ca);
A("X.renderer2D.prototype.add",lh.prototype.add);A("X.renderer2D.prototype.onShowtime",lh.prototype.lh);A("X.renderer2D.prototype.onRender",lh.prototype.jh);A("X.renderer2D.prototype.onScroll",lh.prototype.Gj);A("X.renderer2D.prototype.onWindowLevel",lh.prototype.Qj);A("X.renderer2D.prototype.get",lh.prototype.get);A("X.renderer2D.prototype.resetViewAndRender",lh.prototype.Nd);A("X.renderer2D.prototype.xy2ijk",lh.prototype.Ih);A("X.renderer2D.prototype.render",lh.prototype.cc);
A("X.renderer2D.prototype.destroy",lh.prototype.Ta);A("X.renderer2D.prototype.onSliceNavigation",lh.prototype.Hj);A("X.renderer2D.prototype.afterRender",lh.prototype.yg);
| 459.351544 | 1,797 | 0.647241 |
992a26598d0995dac84ce2e05b3e9b77eaba6fd5 | 375 | js | JavaScript | utils/api.js | Moesaidi76/README_Generator | 72cdd7f6c307bbff271e37c8daa1e2a64ae8078a | [
"MIT"
] | null | null | null | utils/api.js | Moesaidi76/README_Generator | 72cdd7f6c307bbff271e37c8daa1e2a64ae8078a | [
"MIT"
] | null | null | null | utils/api.js | Moesaidi76/README_Generator | 72cdd7f6c307bbff271e37c8daa1e2a64ae8078a | [
"MIT"
] | null | null | null |
const axios = require("axios");
require('dotenv').config();
const token = process.env.TOKEN;
const api = {
async getUser(username) {
const res = await axios({
headers:{'Authorization': `token ${token}`},
url: `https://api.github.com/users/${username}`,
method: 'GET'})
const user = res.data
return user;
}
};
module.exports = api; | 19.736842 | 54 | 0.602667 |
992a5be0217d69ad3395bab46fd4ca092403889b | 2,821 | js | JavaScript | apiproxies/npm-private-repo-proxy/grunt/apigee-config.js | mpramod16/apigee-tutorials | 3774501ca30db871c375b7fe62f32ff1bdecc6c4 | [
"MIT"
] | 55 | 2015-01-28T23:09:40.000Z | 2021-12-23T03:52:51.000Z | apiproxies/npm-private-repo-proxy/grunt/apigee-config.js | brualves/apigee-tutorials | 4bd97cfe1294c24bb536667a70ec9d1cffa32e5d | [
"MIT"
] | 4 | 2016-04-14T14:46:35.000Z | 2021-08-04T16:22:59.000Z | apiproxies/npm-private-repo-proxy/grunt/apigee-config.js | brualves/apigee-tutorials | 4bd97cfe1294c24bb536667a70ec9d1cffa32e5d | [
"MIT"
] | 68 | 2015-06-29T22:54:04.000Z | 2022-01-23T17:26:35.000Z | exports.profiles = function(grunt){
return {
env : grunt.option('env'), // replace with environment
'test' : {
apiproxy : 'npm-private-repo-proxy',
org : 'testmyapi', // replace with organization
env : 'test', // replace with environment
url_mgmt : 'https://api.enterprise.apigee.com', // for cloud environments, leave as is
username : grunt.option('username'), //|| process.env.ae_username, // pass credentials as arguments as grunt task --username=$ae_username --password=$ae_password
password : grunt.option('password'), //|| process.env.ae_password, // use ae_username and ae_password are defined as environment variables and no arguments are passed
revision : grunt.option('revision'), // provide revision to be undeployed by passing argument as --revision=X
override : grunt.option('override') || false,
delay : grunt.option('delay') || 0
},
'prod' : {
apiproxy : 'npm-private-repo-proxy',
org : 'testmyapi', // replace with organization
env : 'prod', // replace with environment
url_mgmt : 'https://api.enterprise.apigee.com', // for cloud environments, leave as is
username : grunt.option('username'), //|| process.env.ae_username, // pass credentials as arguments as grunt task --username=$ae_username --password=$ae_password
password : grunt.option('password'), //|| process.env.ae_password, // use ae_username and ae_password are defined as environment variables and no arguments are passed
revision : grunt.option('revision'), // provide revision to be undeployed by passing argument as --revision=X
override : grunt.option('override') || false,
delay : grunt.option('delay') || 0
}
}
}
exports.xmlconfig = function(env, grunt){
config = { "test" : [
{//sets description within API proxy for tracking purposes with this format 'git commit: 8974b5a by dzuluaga on Diegos-MacBook-Pro-2.local'
//see grunt/tasks/saveGitRevision.js for further customization
"options": {
"xpath": "//APIProxy/Description",
"value": "<%= grunt.option('gitRevision') %>"
},
"files": {
"target/apiproxy/<%= apigee_profiles[grunt.option('env')].apiproxy %>.xml": "apiproxy/*.xml"
}
},
],
"prod" : [
{//sets description within API proxy for tracking purposes with this format 'git commit: 8974b5a by dzuluaga on Diegos-MacBook-Pro-2.local'
//see grunt/tasks/saveGitRevision.js for further customization
"options": {
"xpath": "//APIProxy/Description",
"value": "<%= grunt.option('gitRevision') %>"
},
"files": {
"target/apiproxy/<%= apigee_profiles[grunt.option('env')].apiproxy %>.xml": "apiproxy/*.xml"
}
},
]}
if(!config[env])grunt.fail.fatal('Environment '+ env +' does not exist under grunt/apigee-config.js')
return config[env];
}
| 49.491228 | 171 | 0.672457 |
992b192262620cd437df0091ac3972caa34525d7 | 235 | js | JavaScript | gulp/task/jade.js | gaowhen/task-master | ff5e8baf9fa99815bea582fd8868bab978f63544 | [
"MIT"
] | 22 | 2015-02-09T05:58:39.000Z | 2021-03-08T17:35:49.000Z | gulp/task/jade.js | gaowhen/task-master | ff5e8baf9fa99815bea582fd8868bab978f63544 | [
"MIT"
] | 1 | 2016-01-11T05:15:59.000Z | 2016-01-11T06:01:55.000Z | gulp/task/jade.js | gaowhen/task-master | ff5e8baf9fa99815bea582fd8868bab978f63544 | [
"MIT"
] | 7 | 2015-02-09T06:07:43.000Z | 2016-08-22T07:58:34.000Z | var gulp = require('gulp');
var config = require('config').gulp;
var jade = require('gulp-jade');
gulp.task('jade', function() {
gulp.src(config.src.view + '/**/*.jade')
.pipe(jade())
.pipe(gulp.dest(config.dist.view));
}); | 26.111111 | 42 | 0.612766 |
992b505de03686d46f5fedc11ba266d929dad493 | 3,356 | js | JavaScript | scripts/prepare/index.js | billfienberg/urql | f504d7c2dc1cf5519767e83de45a21f822255043 | [
"MIT"
] | 1 | 2021-09-26T17:13:34.000Z | 2021-09-26T17:13:34.000Z | scripts/prepare/index.js | billfienberg/urql | f504d7c2dc1cf5519767e83de45a21f822255043 | [
"MIT"
] | null | null | null | scripts/prepare/index.js | billfienberg/urql | f504d7c2dc1cf5519767e83de45a21f822255043 | [
"MIT"
] | 1 | 2020-05-17T06:17:18.000Z | 2020-05-17T06:17:18.000Z | #!/usr/bin/env node
const invariant = require('invariant');
const path = require('path');
const fs = require('fs');
const cwd = process.cwd();
const workspaceRoot = path.resolve(__dirname, '../../');
const pkg = require(path.resolve(cwd, 'package.json'));
const hasReact = !!pkg.dependencies.react || !!pkg.peerDependencies.react;
const normalize = name => name
.replace(/[@\s\/\.]+/g, ' ')
.trim()
.replace(/\s+/, '-')
.toLowerCase();
const name = normalize(pkg.name);
if (pkg.name.startsWith('@urql/')) {
invariant(
pkg.publishConfig.access === 'public',
'package.json:publishConfig.access must be set to public for @urql/* packages'
);
}
invariant(
path.normalize(cwd) !== path.normalize(workspaceRoot),
'prepare-pkg must be run in a package.'
);
invariant(
fs.existsSync(pkg.source || 'src/index.ts'),
'package.json:source must exist'
);
if (hasReact) {
invariant(
path.normalize(pkg.main) === `dist/${name}.js`,
'package.json:main path must end in `.js` for packages depending on React.'
);
invariant(
path.normalize(pkg.module) === `dist/${name}.es.js`,
'package.json:module path must end in `.es.js` for packages depending on React.'
);
} else {
invariant(
path.normalize(pkg.main) === `dist/${name}`,
'package.json:main path must be valid and have no extension'
);
invariant(
path.normalize(pkg.module) === `dist/${name}.mjs`,
'package.json:module path must be valid and ending in .mjs'
);
}
invariant(
path.normalize(pkg.types) === 'dist/types/'
+ path.relative('src', pkg.source || 'src/index.ts')
.replace(/\.ts$/, '.d.ts'),
'package.json:types path must be valid'
);
invariant(
path.normalize(pkg.repository.directory) ===
path.relative(workspaceRoot, cwd),
'package.json:repository.directory path is invalid'
);
invariant(
pkg.sideEffects === false,
'package.json:sideEffects must be false'
);
invariant(
pkg.license === 'MIT',
'package.json:license must be "MIT"'
);
invariant(
Array.isArray(pkg.files) &&
pkg.files.some(x => path.normalize(x) === 'dist/') &&
pkg.files.some(x => path.normalize(x) === 'LICENSE'),
'package.json:files must include "dist" and "LICENSE"'
);
if (hasReact) {
invariant(!pkg.exports, 'package.json:exports must not be added for packages depending on React.');
} else {
invariant(!!pkg.exports, 'package.json:exports must be added and have a "." entry');
invariant(!!pkg.exports['.'], 'package.json:exports must have a "." entry');
for (const key in pkg.exports) {
const entry = pkg.exports[key];
const entryName = normalize(key);
const bundleName = entryName ? `${name}-${entryName}` : name;
invariant(
fs.existsSync(entry.source),
`package.json:exports["${key}"].source must exist`
);
invariant(
entry.require === `./dist/${bundleName}.js`,
`package.json:exports["${key}"].require must be valid`
);
invariant(
entry.import === `./dist/${bundleName}.mjs`,
`package.json:exports["${key}"].import must be valid`
);
invariant(
entry.types === './dist/types/'
+ path.relative('src', entry.source).replace(/\.ts$/, '.d.ts'),
'package.json:types path must be valid'
);
}
}
fs.copyFileSync(
path.resolve(workspaceRoot, 'LICENSE'),
path.resolve(cwd, 'LICENSE'), cwd
);
| 26.634921 | 101 | 0.638856 |
992c2776cdeeb96dc58ca9bc874770da5a55660d | 291 | js | JavaScript | jest.config.js | 372623460jh/learn-rollup | 490476a4b1b94cbfd285d334596b413bda3da51b | [
"MIT"
] | 1 | 2021-05-26T15:06:11.000Z | 2021-05-26T15:06:11.000Z | jest.config.js | 372623460jh/learn-rollup | 490476a4b1b94cbfd285d334596b413bda3da51b | [
"MIT"
] | null | null | null | jest.config.js | 372623460jh/learn-rollup | 490476a4b1b94cbfd285d334596b413bda3da51b | [
"MIT"
] | null | null | null | module.exports = {
// Automatically clear mock calls and instances between every test
clearMocks: true,
// 是否收集测试时的覆盖率信息
collectCoverage: true,
// Jest输出覆盖信息文件的目录。
coverageDirectory: 'coverage',
// 排除出coverage的文件列表
coveragePathIgnorePatterns: ['<rootDir>/node_modules/'],
};
| 26.454545 | 68 | 0.738832 |
992c81c8f4bfe350ed0b20be857a9215bf3c4bfc | 979 | js | JavaScript | node_modules/@react-icons/all-files/ai/AiOutlineRedEnvelope.js | syazwanirahimin/dotcom | 162acf4500655ec965d27bd1e45ef0415963d346 | [
"MIT"
] | null | null | null | node_modules/@react-icons/all-files/ai/AiOutlineRedEnvelope.js | syazwanirahimin/dotcom | 162acf4500655ec965d27bd1e45ef0415963d346 | [
"MIT"
] | null | null | null | node_modules/@react-icons/all-files/ai/AiOutlineRedEnvelope.js | syazwanirahimin/dotcom | 162acf4500655ec965d27bd1e45ef0415963d346 | [
"MIT"
] | null | null | null | // THIS FILE IS AUTO GENERATED
var GenIcon = require('../lib').GenIcon
module.exports.AiOutlineRedEnvelope = function AiOutlineRedEnvelope (props) {
return GenIcon({"tag":"svg","attr":{"viewBox":"0 0 1024 1024"},"child":[{"tag":"path","attr":{"d":"M440.6 462.6a8.38 8.38 0 0 0-7.5-4.6h-48.8c-1.3 0-2.6.4-3.9 1a8.4 8.4 0 0 0-3.4 11.4l87.4 161.1H419c-4.6 0-8.4 3.8-8.4 8.4V665c0 4.6 3.8 8.4 8.4 8.4h63V702h-63c-4.6 0-8.4 3.8-8.4 8.4v25.1c0 4.6 3.8 8.4 8.4 8.4h63v49.9c0 4.6 3.8 8.4 8.4 8.4h43.7c4.6 0 8.4-3.8 8.4-8.4v-49.9h63.3c4.7 0 8.4-3.8 8.2-8.5v-25c0-4.6-3.8-8.4-8.4-8.4h-63.3v-28.6h63.3c4.6 0 8.4-3.8 8.4-8.4v-25.1c0-4.6-3.8-8.4-8.4-8.4h-45.9l87.2-161a8.45 8.45 0 0 0-7.4-12.4h-47.8c-3.1 0-6 1.8-7.5 4.6l-71.9 141.9-71.7-142zM832 64H192c-17.7 0-32 14.3-32 32v832c0 17.7 14.3 32 32 32h640c17.7 0 32-14.3 32-32V96c0-17.7-14.3-32-32-32zm-40 824H232V193.1l260.3 204.1c11.6 9.1 27.9 9.1 39.5 0L792 193.1V888zm0-751.3h-31.7L512 331.3 263.7 136.7H232v-.7h560v.7z"}}]})(props);
};
| 163.166667 | 826 | 0.65475 |
992cf5f8bd843ed55e7af2f3970477a16d283377 | 4,522 | js | JavaScript | lib/github/aurelia/templating@0.8.7/amd/content-selector.js | sonnylazuardi/todomvc-aurelia | 7427e598cc8b2a4787a528071b78948ddeeb53c1 | [
"MIT"
] | 4 | 2015-01-31T11:34:37.000Z | 2015-05-25T17:59:45.000Z | lib/github/aurelia/templating@0.8.7/amd/content-selector.js | sonnylazuardi/todomvc-aurelia | 7427e598cc8b2a4787a528071b78948ddeeb53c1 | [
"MIT"
] | null | null | null | lib/github/aurelia/templating@0.8.7/amd/content-selector.js | sonnylazuardi/todomvc-aurelia | 7427e598cc8b2a4787a528071b78948ddeeb53c1 | [
"MIT"
] | null | null | null | /* */
"format register";
define(["exports"], function (exports) {
"use strict";
var _prototypeProperties = function (child, staticProps, instanceProps) {
if (staticProps) Object.defineProperties(child, staticProps);
if (instanceProps) Object.defineProperties(child.prototype, instanceProps);
};
if (Element && !Element.prototype.matches) {
var proto = Element.prototype;
proto.matches = proto.matchesSelector || proto.mozMatchesSelector || proto.msMatchesSelector || proto.oMatchesSelector || proto.webkitMatchesSelector;
}
var placeholder = [];
function findInsertionPoint(groups, index) {
var insertionPoint;
while (!insertionPoint && index >= 0) {
insertionPoint = groups[index][0];
index--;
}
return insertionPoint || anchor;
}
var ContentSelector = (function () {
function ContentSelector(anchor, selector) {
this.anchor = anchor;
this.selector = selector;
this.all = !this.selector;
this.groups = [];
}
_prototypeProperties(ContentSelector, {
applySelectors: {
value: function applySelectors(view, contentSelectors, callback) {
var currentChild = view.fragment.firstChild,
contentMap = new Map(),
nextSibling,
i,
ii,
contentSelector;
while (currentChild) {
nextSibling = currentChild.nextSibling;
if (currentChild.viewSlot) {
var viewSlotSelectors = contentSelectors.map(function (x) {
return x.copyForViewSlot();
});
currentChild.viewSlot.installContentSelectors(viewSlotSelectors);
} else {
for (i = 0, ii = contentSelectors.length; i < ii; i++) {
contentSelector = contentSelectors[i];
if (contentSelector.matches(currentChild)) {
var elements = contentMap.get(contentSelector);
if (!elements) {
elements = [];
contentMap.set(contentSelector, elements);
}
elements.push(currentChild);
break;
}
}
}
currentChild = nextSibling;
}
for (i = 0, ii = contentSelectors.length; i < ii; ++i) {
contentSelector = contentSelectors[i];
callback(contentSelector, contentMap.get(contentSelector) || placeholder);
}
},
writable: true,
enumerable: true,
configurable: true
}
}, {
copyForViewSlot: {
value: function copyForViewSlot() {
return new ContentSelector(this.anchor, this.selector);
},
writable: true,
enumerable: true,
configurable: true
},
matches: {
value: function matches(node) {
return this.all || node.nodeType === 1 && node.matches(this.selector);
},
writable: true,
enumerable: true,
configurable: true
},
add: {
value: function add(group) {
var anchor = this.anchor,
parent = anchor.parentNode,
i,
ii;
for (i = 0, ii = group.length; i < ii; ++i) {
parent.insertBefore(group[i], anchor);
}
this.groups.push(group);
},
writable: true,
enumerable: true,
configurable: true
},
insert: {
value: function insert(index, group) {
if (group.length) {
var anchor = findInsertionPoint(this.groups, index) || this.anchor,
parent = anchor.parentNode,
i,
ii;
for (i = 0, ii = group.length; i < ii; ++i) {
parent.insertBefore(group[i], anchor);
}
}
this.groups.splice(index, 0, group);
},
writable: true,
enumerable: true,
configurable: true
},
removeAt: {
value: function removeAt(index, fragment) {
var group = this.groups[index],
i,
ii;
for (i = 0, ii = group.length; i < ii; ++i) {
fragment.appendChild(group[i]);
}
this.groups.splice(index, 1);
},
writable: true,
enumerable: true,
configurable: true
}
});
return ContentSelector;
})();
exports.ContentSelector = ContentSelector;
}); | 28.620253 | 154 | 0.532729 |
992d91c781aa0e4b1cac943abaebf07d5f20e4d3 | 2,024 | js | JavaScript | contrib/views/hive-next/src/main/resources/ui/hive-web/config/environment.js | panfeiyy/ambari | 24077510723ede93d3024784f0b04422adaf56d6 | [
"Apache-2.0"
] | 16 | 2018-05-24T10:28:24.000Z | 2021-08-05T03:13:26.000Z | contrib/views/hive-next/src/main/resources/ui/hive-web/config/environment.js | panfeiyy/ambari | 24077510723ede93d3024784f0b04422adaf56d6 | [
"Apache-2.0"
] | 8 | 2020-06-18T17:31:19.000Z | 2022-03-02T08:32:03.000Z | contrib/views/hive-next/src/main/resources/ui/hive-web/config/environment.js | panfeiyy/ambari | 24077510723ede93d3024784f0b04422adaf56d6 | [
"Apache-2.0"
] | 17 | 2018-07-06T08:57:00.000Z | 2021-11-04T11:00:36.000Z | /**
* Licensed to the Apache Software Foundation (ASF) under one
* or more contributor license agreements. See the NOTICE file
* distributed with this work for additional information
* regarding copyright ownership. The ASF licenses this file
* to you under the Apache License, Version 2.0 (the
* "License"); you may not use this file except in compliance
* with the License. You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/* jshint node: true */
module.exports = function(environment) {
var ENV = {
modulePrefix: 'hive',
environment: environment,
baseURL: '/',
locationType: 'hash',
EmberENV: {
FEATURES: {
// Here you can enable experimental features on an ember canary build
// e.g. 'with-controller': true
}
},
contentSecurityPolicy: {
'connect-src': "'self' ws://localhost:35729 ws://0.0.0.0:35729",
'style-src': "'self' 'unsafe-inline'"
},
APP: {
// Here you can pass flags/options to your application instance
// when it is created
}
};
if (environment === 'development') {
// ENV.APP.LOG_RESOLVER = true;
ENV.APP.LOG_ACTIVE_GENERATION = true;
// ENV.APP.LOG_TRANSITIONS = true;
// ENV.APP.LOG_TRANSITIONS_INTERNAL = true;
ENV.APP.LOG_VIEW_LOOKUPS = true;
}
if (environment === 'test') {
// Testem prefers this...
ENV.baseURL = '/';
ENV.locationType = 'auto';
// keep test console output quieter
ENV.APP.LOG_ACTIVE_GENERATION = false;
ENV.APP.LOG_VIEW_LOOKUPS = false;
ENV.APP.rootElement = '#ember-testing';
}
if (environment === 'production') {
}
return ENV;
};
| 28.507042 | 77 | 0.662055 |
992e136e0989487ca056d53ac741fa4691128066 | 880 | js | JavaScript | src/components/MsgBox.js | rayman22201/parlons | ee5a38935124ce2905a12d43e39816d7273b8bbd | [
"MIT"
] | 2 | 2019-06-26T12:50:26.000Z | 2019-08-16T02:48:44.000Z | src/components/MsgBox.js | rayman22201/parlons | ee5a38935124ce2905a12d43e39816d7273b8bbd | [
"MIT"
] | null | null | null | src/components/MsgBox.js | rayman22201/parlons | ee5a38935124ce2905a12d43e39816d7273b8bbd | [
"MIT"
] | 1 | 2019-06-26T12:50:58.000Z | 2019-06-26T12:50:58.000Z | import React, {Component} from 'react';
import {list, textarea, element} from 'react-blessed';
export class MsgBox extends Component {
constructor(props) {
super(props);
}
componentDidMount() {
if(this.props.readInput) {
this.refs.element.readInput(() => {
this.props.onSubmit(this.refs.element.value);
this.refs.element.clearValue();
});
}
}
componentWillReceiveProps(nextProps) {
if(nextProps.readInput) {
this.refs.element.readInput(() => {
this.props.onSubmit(this.refs.element.value);
this.refs.element.clearValue();
});
}
}
render() {
return (
<textarea
ref="element"
width="80%"
height="10%"
top="90%"
left="20%"
border={{type: 'line'}}
style={{border: {fg: 'green'}}} />
);
}
}
| 22 | 54 | 0.545455 |
992e4a424780534d602edff78ea5aa77fc77b7dc | 1,433 | js | JavaScript | templates/renderjs-templates.js | fullrange-interactive/oss-social-wall-client | ae7109a0c7ab7a8cf71a6d331caa53fb6eb740df | [
"MIT"
] | null | null | null | templates/renderjs-templates.js | fullrange-interactive/oss-social-wall-client | ae7109a0c7ab7a8cf71a6d331caa53fb6eb740df | [
"MIT"
] | null | null | null | templates/renderjs-templates.js | fullrange-interactive/oss-social-wall-client | ae7109a0c7ab7a8cf71a6d331caa53fb6eb740df | [
"MIT"
] | null | null | null | var renderJsTemplates = {};
String.prototype.replaceLinks = function(){
var urlRegex =/(\b(https?|ftp|file):\/\/[-A-Z0-9+&@#\/%?=~_|!:,.;]*[-A-Z0-9+&@#\/%=~_|])/ig;
return this.replace(urlRegex, '<a href="$1">$1</a>');
};
String.prototype.smartLinks = function(){
var urlRegex =/www\.([^ ]+)/ig;
return this.replace(urlRegex, '<a href="http://www.$1">www.$1</a>');
};
String.prototype.replaceHashtags = function(){
var reg = new RegExp("([^&])#([0-9A-Za-z_\u00C0-\u01BF]+)","ig");
return this.replace(reg,'$1<span class="hashtag">#$2</span>');
};
$.views.converters("contentFormatter", function(val) {
console.log(twemoji.parse(val));
return twemoji.parse(val.replaceLinks().replaceHashtags().smartLinks());
});
$.views.converters("removeHash", function(val) {
return val.replace('#', '');
})
$.views.converters("facebookUrlFormatter", function (val) {
return '<a href="' + val + '">' + val.replace(/(.+)facebook.com\/([^\?]+)(.*)/i, 'facebook.com/$2') + '</a>';
// return val.replace(/(?:https?:\/\/)?(?:www\.)?facebook\.com\/(?:(?:\w\.)*#!\/)?(?:pages\/)?(?:[\w\-\.]*\/)*([\w\-\.]*)/, '<a href="' + val + '" target="_blank">facebook.com/$1</a>')
// return val.replace(/(.+)facebook.com\/(.+)(\??.+)/i, '<a href="' + val + '" target="_blank">facebook.com/$2</a>');
});
/*
* Register templates for further rendering
*/
for(var name in renderJsTemplates)
$.template(name,renderJsTemplates[name])
| 34.119048 | 186 | 0.584089 |
992e5fdaf8180259469f2f2ea507fa11217cd1ce | 734 | js | JavaScript | src/tweens/builders/GetBoolean.js | acz13/phaser | 9a21b4c7f40894804806f15402834f3055837b42 | [
"MIT"
] | 1 | 2019-04-16T19:51:12.000Z | 2019-04-16T19:51:12.000Z | src/tweens/builders/GetBoolean.js | acz13/phaser | 9a21b4c7f40894804806f15402834f3055837b42 | [
"MIT"
] | null | null | null | src/tweens/builders/GetBoolean.js | acz13/phaser | 9a21b4c7f40894804806f15402834f3055837b42 | [
"MIT"
] | null | null | null | /**
* @author Richard Davey <rich@photonstorm.com>
* @copyright 2018 Photon Storm Ltd.
* @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License}
*/
/**
* [description]
*
* @function Phaser.Tweens.Builders.GetBoolean
* @since 3.0.0
*
* @param {object} source - [description]
* @param {string} key - [description]
* @param {any} defaultValue - [description]
*
* @return {any} [description]
*/
var GetBoolean = function (source, key, defaultValue)
{
if (!source)
{
return defaultValue;
}
else if (source.hasOwnProperty(key))
{
return source[key];
}
else
{
return defaultValue;
}
};
module.exports = GetBoolean;
| 20.388889 | 98 | 0.617166 |
992f2765c5086663d72805ce9ea5424cab807450 | 2,203 | js | JavaScript | src/components/loan.js | DanielAdek/Finance-Palace | a3a4e2af9b577b5fb3dacd8bdea622855c8e7ab8 | [
"MIT"
] | null | null | null | src/components/loan.js | DanielAdek/Finance-Palace | a3a4e2af9b577b5fb3dacd8bdea622855c8e7ab8 | [
"MIT"
] | 4 | 2021-03-10T05:08:05.000Z | 2022-02-26T22:39:54.000Z | src/components/loan.js | DanielAdek/Finance-Palace | a3a4e2af9b577b5fb3dacd8bdea622855c8e7ab8 | [
"MIT"
] | null | null | null | import React, { Fragment, useState } from 'react';
import { useHistory } from 'react-router-dom';
import { useDispatch, useSelector } from 'react-redux';
import * as Loading from './spinner';
import * as Style from '../Styles/loan';
import { Alert } from '../store/utils/helpers';
import { requestLoan } from '../store/action/axiosActions/loan';
export const Loan = () => {
// React Hooks
const history = useHistory();
const initialState = { password: '', bvn: '', amount: 0 };
const [requestData, setRequestData] = useState(initialState);
// Redux Hooks
const dispatch = useDispatch();
const processing = useSelector(state => state.Loading.loading);
const handleOnChange = event => setRequestData({ ...requestData, [event.target.name]: event.target.value });
const handleRequestLoan = () => {
if (requestData.amount < 1) {
return Alert.error('Invalid Amount');
}
dispatch(requestLoan(requestData, history));
}
return (
<Fragment>
{processing && <Loading.RingLoadScreen /> }
<Style.BannerWrapper>
<Style.banner></Style.banner>
</Style.BannerWrapper>
<Style.FormContainer>
<Style.formWrapper>
<Style.Heading>To get a Loan kindly Fill the Form Below</Style.Heading>
<Style.Form>
<Style.Div className="form-group">
<Style.label htmlFor="email">Enter BVN</Style.label>
<Style.Input type="text" name="bvn" className="form-control" placeholder="BVN Number" onChange={handleOnChange} />
</Style.Div>
<Style.Div className="form-group">
<Style.label htmlFor="password">Enter Password</Style.label>
<Style.Input type="password" name="password" className="form-control" placeholder="Password" onChange={handleOnChange} />
</Style.Div>
<Style.Div className="form-group">
<Style.label htmlFor="country">Enter Amount</Style.label>
<Style.Input type="number" name="amount" className="form-control" placeholder="2000000000" onChange={handleOnChange} />
</Style.Div>
<Style.Button type="button" onClick={handleRequestLoan}>
Submit Request
</Style.Button>
</Style.Form>
</Style.formWrapper>
</Style.FormContainer>
</Fragment>
);
};
| 36.716667 | 129 | 0.672265 |
992f6224a36216154202a1f0948b523be7c07f35 | 499 | js | JavaScript | resources/assets/js/custom.min.js | aungkokhantace/ros | 23acb39928e68cb0851deff1a7f4507bd4452a2c | [
"MIT"
] | 2 | 2021-02-15T19:39:25.000Z | 2021-02-15T19:40:26.000Z | resources/assets/js/custom.min.js | aungkokhantace/ros | 23acb39928e68cb0851deff1a7f4507bd4452a2c | [
"MIT"
] | null | null | null | resources/assets/js/custom.min.js | aungkokhantace/ros | 23acb39928e68cb0851deff1a7f4507bd4452a2c | [
"MIT"
] | null | null | null |
function HandleBrowseClick()
{
//var textinput = document.getElementById("filename");
var fileinput = document.getElementById("browse");
fileinput.click();
//textinput.value = fileinput.value;
}
function test(){
var fileinput = document.getElementById("browse");
var textinput = document.getElementById("filename");
textinput.value = fileinput.value;
}
/*--=============== End fileupload ==========================--*/ | 27.722222 | 65 | 0.569138 |
9930ee62ba1e4bbc4ea0a50c1f6db79a0a73883a | 2,727 | js | JavaScript | events/message.js | naksudev/zenaii | fe2b369835a07afa66d742e9c6acc3595cdf1dbd | [
"MIT"
] | null | null | null | events/message.js | naksudev/zenaii | fe2b369835a07afa66d742e9c6acc3595cdf1dbd | [
"MIT"
] | null | null | null | events/message.js | naksudev/zenaii | fe2b369835a07afa66d742e9c6acc3595cdf1dbd | [
"MIT"
] | null | null | null | // Dependencies
const Discord = require('discord.js');
// Collection of users in cooldown
const cooldowns = new Discord.Collection();
module.exports = class Message {
constructor (bot) {
this.bot = bot;
}
async run (message) {
let bot = this.bot;
// Don't respond to bot and DM messages
if (message.author.bot || !message.guild) return;
// Get server settings
let settings;
try {
settings = await bot.getGuild(message.guild);
} catch (err) {
settings = bot.CONFIG.DEFAULTSETTINGS;
}
// Check if server settings is stored in database
if (!settings && message.channel.type != 'dm') {
await bot.emit('guildCreate', message.guild);
try {
settings = await bot.getGuild(message.guild);
} catch (err) {
console.error(err.message);
}
}
// Commands
const args = message.content.split(' ');
const command = args.shift().slice(settings.prefix.length).toLowerCase();
const cmd = bot.commands.get(command) || bot.commands.get(bot.aliases.get(command));
if (cmd && message.content.startsWith(settings.prefix)) {
// Check if the commands needs permissions
// TODO: Fix this and pull to dev then merge to main
if (!message.guild.me.hasPermission(cmd.config.permission)) return message.channel.send(`:x: | I don't have permission to use this command ! Do ${settings.prefix}help ${cmd.name} to check the permissions needed${message.author}`);
// Check to see if user is in 'cooldown'
if (!cooldowns.has(cmd)) {
cooldowns.set(cmd, new Discord.Collection());
}
const now = Date.now();
const timestamps = cooldowns.get(cmd);
const cooldownAmount = (cmd.config.cooldown) * 1000;
if (timestamps.has(message.author.id)) {
const expirationTime = timestamps.get(message.author.id) + cooldownAmount;
if (now < expirationTime) {
const timeLeft = (expirationTime - now) / 1000;
return message.channel.send(`🕦 | Please wait **${timeLeft.toFixed(1)} more second(s)** before reusing the \`${command}\` command. ${message.author}`).then(message.delete());
}
}
// Run Command
cmd.run(bot, message, args, settings);
timestamps.set(message.author.id, now);
setTimeout(() => timestamps.delete(message.author.id), cooldownAmount);
}
}
}; | 37.875 | 242 | 0.558489 |
9930f6d47e5ccefcd398fc90f890a0af689ae883 | 866 | js | JavaScript | stats/base/dmidrange.js | stdlib-js/esm | e40d9dc228b49c18a94973ffdfdf4d64e1698d1b | [
"Apache-2.0"
] | 12 | 2020-12-20T20:16:45.000Z | 2022-01-30T03:08:18.000Z | stats/base/dmidrange.js | stdlib-js/esm | e40d9dc228b49c18a94973ffdfdf4d64e1698d1b | [
"Apache-2.0"
] | 1 | 2021-05-24T16:42:11.000Z | 2021-05-24T17:51:24.000Z | stats/base/dmidrange.js | stdlib-js/esm | e40d9dc228b49c18a94973ffdfdf4d64e1698d1b | [
"Apache-2.0"
] | null | null | null | // This file is a part of stdlib. License is Apache-2.0: http://www.apache.org/licenses/LICENSE-2.0
import r from"./../../utils/define-nonenumerable-read-only-property.js";import e from"./../../math/base/assert/is-positive-zero.js";import t from"./../../math/base/assert/is-negative-zero.js";import a from"./../../math/base/assert/is-nan.js";var n=e,i=t,o=a;function s(r,e,t){var a,s,f,u,m;if(r<=0)return NaN;if(1===r||0===t)return e[0];for(a=s=e[f=t<0?(1-r)*t:0],m=1;m<r;m++){if(u=e[f+=t],o(u))return u;u<s||u===s&&i(u)?s=u:(u>a||u===a&&n(u))&&(a=u)}return(a+s)/2}var f=e,u=t,m=a;function p(r,e,t,a){var n,i,o,s,p;if(r<=0)return NaN;if(1===r||0===t)return e[a];for(n=i=e[o=a],p=1;p<r;p++){if(s=e[o+=t],m(s))return s;s<i||s===i&&u(s)?i=s:(s>n||s===n&&f(s))&&(n=s)}return(n+i)/2}var v=r,b=s,d=p;v(b,"ndarray",d);export default b;
//# sourceMappingURL=dmidrange.js.map | 288.666667 | 728 | 0.608545 |
9931aa6145580f0858d52674b1652435b9c85a03 | 471 | js | JavaScript | server/config/routes.js | Atanas9708/Credit-Manager-0.1 | 13c2b19cc14ba2603fbcb8339e325a71e3a8d2f7 | [
"MIT"
] | null | null | null | server/config/routes.js | Atanas9708/Credit-Manager-0.1 | 13c2b19cc14ba2603fbcb8339e325a71e3a8d2f7 | [
"MIT"
] | null | null | null | server/config/routes.js | Atanas9708/Credit-Manager-0.1 | 13c2b19cc14ba2603fbcb8339e325a71e3a8d2f7 | [
"MIT"
] | null | null | null | const controllers = require('../controllers');
module.exports = app => {
app.post('/register', controllers.user.registerPost);
app.post('/login', controllers.user.loginPost);
app.get('/credits/:page', controllers.credit.getPage);
app.post('/create', controllers.credit.createCredit);
app.get('/credit/:id', controllers.credit.getCreditDetails);
app.post('/note/:id', controllers.credit.addNote);
app.post('/status/:id', controllers.credit.changeStatus);
} | 39.25 | 62 | 0.719745 |
99322f04e424d43ef447a5d61a3ab44e177f64ad | 872 | js | JavaScript | website/src/parsers/html/svelte.js | Learn-form-Zakas/astexplorer | a786db682516280ec19a7dac61077ff107304c00 | [
"MIT"
] | 4,526 | 2015-12-08T06:26:24.000Z | 2022-03-31T09:21:39.000Z | website/src/parsers/html/svelte.js | Learn-form-Zakas/astexplorer | a786db682516280ec19a7dac61077ff107304c00 | [
"MIT"
] | 476 | 2015-12-08T06:13:55.000Z | 2022-03-27T08:04:15.000Z | website/src/parsers/html/svelte.js | Learn-form-Zakas/astexplorer | a786db682516280ec19a7dac61077ff107304c00 | [
"MIT"
] | 643 | 2015-12-12T18:38:51.000Z | 2022-03-30T16:17:13.000Z | import defaultParserInterface from '../utils/defaultParserInterface';
import pkg from 'svelte/package.json';
const ID = 'svelte';
export default {
...defaultParserInterface,
id: ID,
displayName: ID,
version: pkg.version,
homepage: pkg.homepage,
locationProps: new Set(['start', 'end']),
typeProps: new Set(['tag']),
loadParser(callback) {
require(['svelte/compiler'], callback);
},
parse(parser, code, options) {
return parser.compile(code, options).ast;
},
nodeToRange(node) {
if (node.type || node.name) {
return [node.start, node.end];
}
},
opensByDefault(node, key) {
return key === 'children';
},
getNodeName(node) {
return node.tag;
},
getDefaultOptions() {
return {
preserveWhitespace: true,
preserveComments: true,
};
},
_ignoredProperties: new Set(['parent']),
};
| 18.956522 | 69 | 0.634174 |
99329dee62553f96c8e11b16192788a08e8ee0a4 | 3,336 | js | JavaScript | src/migrations/20210217195834-rbac-tables.js | dmitrylebedev/unleash | 10dd4b753e423361c98adf74fdb534d083c47fe1 | [
"Apache-2.0"
] | 2 | 2021-06-22T05:58:42.000Z | 2021-06-22T07:56:11.000Z | src/migrations/20210217195834-rbac-tables.js | dmitrylebedev/unleash | 10dd4b753e423361c98adf74fdb534d083c47fe1 | [
"Apache-2.0"
] | 6 | 2021-09-01T00:30:31.000Z | 2022-02-27T16:10:18.000Z | src/migrations/20210217195834-rbac-tables.js | yinonavraham/unleash | 38266f5918a718463415f39cb43d60cc5ceddd8d | [
"Apache-2.0"
] | 3 | 2021-06-22T05:45:55.000Z | 2021-07-19T05:28:48.000Z | exports.up = function(db, cb) {
db.runSql(
`CREATE TABLE IF NOT EXISTS roles
(
id SERIAL PRIMARY KEY,
name text not null,
description text,
type text not null default 'custom',
project text,
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
);
CREATE TABLE IF NOT EXISTS role_user
(
role_id integer not null references roles (id) ON DELETE CASCADE,
user_id integer not null references users (id) ON DELETE CASCADE,
created_at TIMESTAMP WITH TIME ZONE DEFAULT now(),
PRIMARY KEY (role_id, user_id)
);
CREATE TABLE IF NOT EXISTS role_permission
(
role_id integer not null references roles (id) ON DELETE CASCADE,
project text,
permission text not null,
created_at TIMESTAMP WITH TIME ZONE DEFAULT now()
);
WITH admin AS (
INSERT INTO roles(name, description, type)
VALUES ('Admin', 'Users with the global admin role have superuser access to Unleash and can perform any operation within the unleash platform.', 'root')
RETURNING id role_id
)
INSERT INTO role_permission(role_id, permission)
SELECT role_id, 'ADMIN' from admin;
WITH regular AS (
INSERT INTO roles(name, description, type)
VALUES ('Regular', 'Users with the global regular role have access most features in Unleash, but can not manage users and roles in the global scope. If a user with a global regular role creates a project, they will become a project admin and receive superuser rights within the context of that project.', 'root')
RETURNING id role_id
)
INSERT INTO role_permission(role_id, project, permission)
VALUES
((SELECT role_id from regular), '', 'CREATE_STRATEGY'),
((SELECT role_id from regular), '', 'UPDATE_STRATEGY'),
((SELECT role_id from regular), '', 'DELETE_STRATEGY'),
((SELECT role_id from regular), '', 'UPDATE_APPLICATION'),
((SELECT role_id from regular), '', 'CREATE_CONTEXT_FIELD'),
((SELECT role_id from regular), '', 'UPDATE_CONTEXT_FIELD'),
((SELECT role_id from regular), '', 'DELETE_CONTEXT_FIELD'),
((SELECT role_id from regular), '', 'CREATE_PROJECT'),
((SELECT role_id from regular), '', 'CREATE_ADDON'),
((SELECT role_id from regular), '', 'UPDATE_ADDON'),
((SELECT role_id from regular), '', 'DELETE_ADDON'),
((SELECT role_id from regular), 'default', 'UPDATE_PROJECT'),
((SELECT role_id from regular), 'default', 'DELETE_PROJECT'),
((SELECT role_id from regular), 'default', 'CREATE_FEATURE'),
((SELECT role_id from regular), 'default', 'UPDATE_FEATURE'),
((SELECT role_id from regular), 'default', 'DELETE_FEATURE');
INSERT INTO roles(name, description, type)
VALUES ('Read', 'Users with this role can only read root resources in Unleash. They may be added as collaborator to specific projects.', 'root');
`,
cb,
);
};
exports.down = function(db, cb) {
db.runSql(
`
DROP TABLE role_user;
DROP TABLE role_permission;
DROP TABLE roles;
`,
cb,
);
};
| 40.682927 | 320 | 0.618405 |
99339d2b82bd5f46d9f7542fb6afc83e96b49a4f | 5,696 | js | JavaScript | test/directory.js | imyufu/connect | 59e853a293d614720e6c256fc26aaeedf5ca9f85 | [
"MIT"
] | null | null | null | test/directory.js | imyufu/connect | 59e853a293d614720e6c256fc26aaeedf5ca9f85 | [
"MIT"
] | null | null | null | test/directory.js | imyufu/connect | 59e853a293d614720e6c256fc26aaeedf5ca9f85 | [
"MIT"
] | null | null | null |
var connect = require('..');
var app = connect();
app.use(connect.directory('test/fixtures'));
describe('directory()', function(){
describe('when given Accept: header', function () {
describe('of application/json', function () {
it('should respond with json', function (done) {
app.request()
.get('/')
.set('Accept', 'application/json')
.end(function(res){
var arr = JSON.parse(res.body);
arr.should.include('g# %3 o %2525 %37 dir');
arr.should.include('users');
arr.should.include('file #1.txt');
arr.should.include('nums');
arr.should.include('todo.txt');
done();
});
});
});
describe('when Accept: text/html is given', function () {
it('should respond with html', function (done) {
app.request()
.get('/')
.set('Accept', 'text/html')
.end(function (res) {
res.should.be.html;
res.body.should.include('<a href="/g%23%20%253%20o%20%252525%20%2537%20dir"');
res.body.should.include('<a href="/users"');
res.body.should.include('<a href="/file%20%231.txt"');
res.body.should.include('<a href="/todo.txt"');
done();
});
});
it('should sort folders first', function (done) {
app.request()
.get('/')
.set('Accept', 'text/html')
.end(function (res) {
res.should.be.html;
var urls = res.body.split(/<a href="([^"]*)"/).filter(function(s, i){ return i%2; });
urls.should.eql([
'/%23directory',
'/g%23%20%253%20o%20%252525%20%2537%20dir',
'/users',
'/file%20%231.txt',
'/foo%20bar',
'/nums',
'/todo.txt',
]);
done();
});
});
});
describe('when Accept: text/plain is given', function () {
it('should respond with text', function (done) {
app.request()
.get('/')
.set('Accept', 'text/plain')
.end(function (res) {
res.body.should.include('users');
res.body.should.include('g# %3 o %2525 %37 dir');
res.body.should.include('file #1.txt');
res.body.should.include('todo.txt');
done();
});
});
});
});
describe('when navigating to other directory', function () {
it('should respond with correct listing', function (done) {
app.request()
.get('/users/')
.set('Accept', 'text/html')
.end(function(res){
res.body.should.include('<a href="/users/index.html"');
res.body.should.include('<a href="/users/tobi.txt"');
done();
});
});
it('should work for directory with #', function (done) {
app.request()
.get('/%23directory/')
.set('Accept', 'text/html')
.end(function(res){
res.body.should.include('<a href="/%23directory"');
res.body.should.include('<a href="/%23directory/index.html"');
done();
});
});
it('should work for directory with special chars', function (done) {
app.request()
.get('/g%23%20%253%20o%20%252525%20%2537%20dir/')
.set('Accept', 'text/html')
.end(function(res){
res.body.should.include('<a href="/g%23%20%253%20o%20%252525%20%2537%20dir"');
res.body.should.include('<a href="/g%23%20%253%20o%20%252525%20%2537%20dir/empty.txt"');
done();
});
});
it('should not work for outside root', function (done) {
app.request()
.get('/../support/')
.set('Accept', 'text/html')
.expect(403, done);
});
});
describe('when setting a custom template', function () {
var app = connect();
app.use(connect.directory('test/fixtures', {'template': __dirname + '/shared/template.html'}));
it('should respond with file list and testing template sentence', function (done) {
app.request()
.get('/')
.set('Accept', 'text/html')
.end(function(res){
res.should.be.html;
res.body.should.include('<a href="/g%23%20%253%20o%20%252525%20%2537%20dir"');
res.body.should.include('<a href="/users"');
res.body.should.include('<a href="/file%20%231.txt"');
res.body.should.include('<a href="/todo.txt"');
res.body.should.include('This is the test template');
done();
});
});
});
describe('when set with trailing slash', function () {
var app = connect();
app.use(connect.directory('test/fixtures/'));
it('should respond with file list', function (done) {
app.request()
.get('/')
.set('Accept', 'application/json')
.end(function(res){
res.statusCode.should.equal(200);
var arr = JSON.parse(res.body);
arr.should.include('users');
arr.should.include('file #1.txt');
arr.should.include('nums');
arr.should.include('todo.txt');
done();
});
});
});
describe('when set to \'.\'', function () {
var app = connect();
app.use(connect.directory('.'));
it('should respond with file list', function (done) {
app.request()
.get('/')
.set('Accept', 'application/json')
.end(function(res){
res.statusCode.should.equal(200);
var arr = JSON.parse(res.body);
arr.should.include('LICENSE');
arr.should.include('lib');
arr.should.include('test');
done();
});
});
it('should not allow serving outside root', function (done) {
app.request()
.get('/../')
.set('Accept', 'text/html')
.expect(403, done);
});
});
});
| 30.459893 | 99 | 0.528968 |
9933c0a4a9a09ac31cbeaa706232f528da75b7a2 | 210 | js | JavaScript | src/__tests__/uva-00100-the-3n1-problem.test.js | taylor1791/programming-training | 2384def9c78d60c6adb125a0be5acb68b40a80ae | [
"MIT"
] | null | null | null | src/__tests__/uva-00100-the-3n1-problem.test.js | taylor1791/programming-training | 2384def9c78d60c6adb125a0be5acb68b40a80ae | [
"MIT"
] | null | null | null | src/__tests__/uva-00100-the-3n1-problem.test.js | taylor1791/programming-training | 2384def9c78d60c6adb125a0be5acb68b40a80ae | [
"MIT"
] | null | null | null | var uva00100 = require("../uva-00100-the-3n1-problem");
describe("UVA 00100: The 3n + 1 Problem", () => {
it("returns 20 for sample 1: i = 1, j = 10", () => {
expect(uva00100(1, 10)).toBe(20);
});
});
| 26.25 | 55 | 0.557143 |
9933d9899f504c12990084bd942376ffaf68d5ab | 901 | js | JavaScript | src/noto_emoji_regular/u1F343.js | danielkov/react-icons-kit | 160bc967ed1ba9cad75a86fb40a449e1f79d1fe0 | [
"MIT"
] | 372 | 2017-01-07T01:54:27.000Z | 2022-03-02T10:16:01.000Z | src/noto_emoji_regular/u1F343.js | danielkov/react-icons-kit | 160bc967ed1ba9cad75a86fb40a449e1f79d1fe0 | [
"MIT"
] | 72 | 2016-12-17T04:04:02.000Z | 2022-02-26T03:35:19.000Z | src/noto_emoji_regular/u1F343.js | qza7849467chensh5/react-icons-kit | 09aeaf39d13e33c45bd032cc1b42a64c5a334dd9 | [
"MIT"
] | 66 | 2017-05-14T21:52:41.000Z | 2021-12-08T12:15:09.000Z | export const u1F343 = {"viewBox":"0 0 2600 2760.837","children":[{"name":"path","attribs":{"d":"M1765 2103q4 0 8-1 24 0 43.5 24t19.5 53q0 33-15.5 50t-73.5 17q-64 0-161 24t-157 78-171 95.5-231 41.5q-224 0-386-135t-254.5-343.5T294 1602l1-34q0-43 5-62.5t14-19.5q11 0 19 13.5t57 37.5 127 24q35 0 71-4l71-7q35-4 71-7.5t72-3.5q297 0 504 154t222 396q0 40 12.5 60.5t38.5 20.5l81-21q53-13 66-25t31-19zm182-655q41-16 80-33.5t76-40.5q-17 113-97.5 230.5t-190 199.5-142.5 82q-12 0-21-5.5t-9-19.5l1-10q2-6 90-79.5t135.5-151T1947 1448zm100.5-119Q1770 1479 1332 1479q-230 0-394.5-77T773 1180q0-103 93.5-176T1112 895t261-36q207 0 347.5 35.5T1961 1016q-30 22-64.5 39.5T1824 1087q-81-57-198-88.5T1370 967l-31 1q-138 5-232.5 41.5T1012 1112q0 54 96 83t224 29q369 0 591-109t222-315q0-168-176.5-286T1526 359l-114-16-17-1q-20 0-29-5t-9-14q0-13 14-16t31-5q157 0 397.5 68.5t383 203T2325 896q0 283-277.5 433z"},"children":[]}]}; | 901 | 901 | 0.72697 |
99343183c8dda0b7f966f73df6b55c2e6fb2c0a8 | 415 | js | JavaScript | src/index.js | maikkoko/messenger-ui-kit | d1bca606cf1a57f690413a8bbea9066d843b119d | [
"MIT"
] | null | null | null | src/index.js | maikkoko/messenger-ui-kit | d1bca606cf1a57f690413a8bbea9066d843b119d | [
"MIT"
] | null | null | null | src/index.js | maikkoko/messenger-ui-kit | d1bca606cf1a57f690413a8bbea9066d843b119d | [
"MIT"
] | null | null | null | import UIKit from './UIKit'
import Container from './components/Container'
import {
CircularButton,
BottomButton,
Button
} from './components/Buttons'
import {
List,
ListItem,
ListHeader
} from './components/Lists'
import PageHeader from './components/PageHeader'
export {
Container,
CircularButton,
BottomButton,
Button,
List,
ListItem,
ListHeader,
PageHeader
}
export default UIKit
| 14.821429 | 48 | 0.725301 |
9934b34271baf1cade277b93a4b7140bc26527d3 | 439 | js | JavaScript | scripts/fix-stencil.js | antony/web-components-benchmark | 3c27275b7c08243a2eabcbdeac0e1a1b291f93a6 | [
"MIT"
] | null | null | null | scripts/fix-stencil.js | antony/web-components-benchmark | 3c27275b7c08243a2eabcbdeac0e1a1b291f93a6 | [
"MIT"
] | null | null | null | scripts/fix-stencil.js | antony/web-components-benchmark | 3c27275b7c08243a2eabcbdeac0e1a1b291f93a6 | [
"MIT"
] | null | null | null | const replace = require("replace");
replace({
regex: '/demos/pascal-triangle/stencil/build/app/',
replacement: '/web-components-benchmark/demos/pascal-triangle/stencil/build/app/',
paths: ['demos/pascal-triangle/stencil/index.html']
});
replace({
regex: '/demos/todomvc/stencil/build/app/',
replacement: '/web-components-benchmark/demos/todomvc/stencil/build/app/',
paths: ['demos/todomvc/stencil/index.html']
}); | 33.769231 | 86 | 0.708428 |
9934dca52335f5250c1f99cc33309eb5309d2b15 | 1,526 | js | JavaScript | js/generate.js | phetsims/binder | 6b9cdbafe1b3c16dfc7534516bccda6918f1e81e | [
"MIT"
] | null | null | null | js/generate.js | phetsims/binder | 6b9cdbafe1b3c16dfc7534516bccda6918f1e81e | [
"MIT"
] | 29 | 2018-05-09T22:57:53.000Z | 2021-05-10T23:05:28.000Z | js/generate.js | phetsims/binder | 6b9cdbafe1b3c16dfc7534516bccda6918f1e81e | [
"MIT"
] | 1 | 2020-03-14T05:06:56.000Z | 2020-03-14T05:06:56.000Z | // Copyright 2018-2021, University of Colorado Boulder
/**
* Main launch point for the documentation generation
*
* @author Michael Kauzmann (PhET Interactive Simulations)
*/
const createHTMLString = require( './createHTMLString' );
const fs = require( 'fs' );
const fsExtra = require( 'fs-extra' ); // eslint-disable-line
const getFromSimInMaster = require( './getFromSimInMaster' );
// resolve image and doc paths as constants
// constants
const OUTPUT_FILE = `${__dirname}/../docs/index.html`;
const myArgs = process.argv.slice( 2 );
const commandLineSims = myArgs[ 0 ]; // Allow comma-separated list of sims
console.log( `streaming to ${OUTPUT_FILE}` );
// Copy image files
try {
// TODO: this assumes we only need image from two repos, see https://github.com/phetsims/binder/issues/28
fsExtra.copySync( `${__dirname}/../../sun/doc/images`, `${__dirname}/../docs/images/sun` );
fsExtra.copySync( `${__dirname}/../../scenery-phet/images`, `${__dirname}/../docs/images/scenery-phet` );
}
catch( err ) {
console.error( err );
console.error( '\x1b[37m' ); // reset back to white text.
}
( async () => {
// Run all sims, get a list of pictures for a sim for a component.
const componentDataBySim = await getFromSimInMaster( commandLineSims );
const HTML = createHTMLString( componentDataBySim );
// fs.writeFileSync( 'binderjson.json', JSON.stringify( componentDataBySim, null, 2 ) );
fs.writeFileSync( OUTPUT_FILE, HTML );
console.log( `wrote final report to: ${OUTPUT_FILE}` );
} )(); | 31.791667 | 107 | 0.695937 |
9935308c5f04e11a4da4298f871dca8245e0db06 | 783 | js | JavaScript | test/mocha/gtfs.get-feed-info.js | donovanrichardson/node-gtfs | 8e18ff9ce6a0b20373422a3842bd403673dc40f2 | [
"MIT"
] | null | null | null | test/mocha/gtfs.get-feed-info.js | donovanrichardson/node-gtfs | 8e18ff9ce6a0b20373422a3842bd403673dc40f2 | [
"MIT"
] | null | null | null | test/mocha/gtfs.get-feed-info.js | donovanrichardson/node-gtfs | 8e18ff9ce6a0b20373422a3842bd403673dc40f2 | [
"MIT"
] | 1 | 2020-09-11T02:03:14.000Z | 2020-09-11T02:03:14.000Z | /* eslint-env mocha */
const path = require('path');
const should = require('should');
const { openDb, closeDb } = require('../../lib/db');
const gtfs = require('../..');
const config = {
agencies: [{
agency_key: 'caltrain',
path: path.join(__dirname, '../fixture/caltrain_20160406.zip')
}],
verbose: false
};
describe('gtfs.getFeedInfo():', () => {
before(async () => {
await openDb(config);
await gtfs.import(config);
});
after(async () => {
await closeDb();
});
it('should return empty array if no feed info', async () => {
const feedPublisherName = 'not_real';
const results = await gtfs.getFeedInfo({
feed_publisher_name: feedPublisherName
});
should.exists(results);
results.should.have.length(0);
});
});
| 21.162162 | 66 | 0.609195 |
99365dc77d09e4d5f0001d7250cccec91f6ae879 | 486 | js | JavaScript | js/lib/lodash/cond.min.js | 1337GameDev/WordPressPluginExample | 73f86850f8ab4c7061bfcce0c30af00572e073c0 | [
"MIT"
] | null | null | null | js/lib/lodash/cond.min.js | 1337GameDev/WordPressPluginExample | 73f86850f8ab4c7061bfcce0c30af00572e073c0 | [
"MIT"
] | null | null | null | js/lib/lodash/cond.min.js | 1337GameDev/WordPressPluginExample | 73f86850f8ab4c7061bfcce0c30af00572e073c0 | [
"MIT"
] | null | null | null | var apply=require("./_apply"),arrayMap=require("./_arrayMap"),baseIteratee=require("./_baseIteratee"),baseRest=require("./_baseRest");var FUNC_ERROR_TEXT="Expected a function";function cond(c){var a=c==null?0:c.length,b=baseIteratee;c=!a?[]:arrayMap(c,function(d){if(typeof d[1]!="function"){throw new TypeError(FUNC_ERROR_TEXT)}return[b(d[0]),d[1]]});return baseRest(function(e){var d=-1;while(++d<a){var f=c[d];if(apply(f[0],this,e)){return apply(f[1],this,e)}}})}module.exports=cond; | 486 | 486 | 0.720165 |
9936800c162620f62cc0d06fe384d1aa3f889911 | 23,385 | js | JavaScript | CarManagement/car-management/target/car-management/js/sumcar.js | itastro/mycode | f386a58056704dabf1ca38c89fc7fa52963ee330 | [
"Apache-2.0"
] | 1 | 2019-11-13T08:20:33.000Z | 2019-11-13T08:20:33.000Z | CarManagement/car-management/target/car-management/js/sumcar.js | itastro/mycode | f386a58056704dabf1ca38c89fc7fa52963ee330 | [
"Apache-2.0"
] | null | null | null | CarManagement/car-management/target/car-management/js/sumcar.js | itastro/mycode | f386a58056704dabf1ca38c89fc7fa52963ee330 | [
"Apache-2.0"
] | null | null | null | // #checkpoint_cartype
if (window.islogin == undefined || window.islogin == null) {
$("#checkpoint_cartype").hide();
} else if (window.islogin.data.roles.length > 0) {
var userrole = [];
for (var i = 0; i < window.islogin.data.roles.length; i++) {
userrole.push(window.islogin.data.roles[i].name);
}
var userroleString = userrole.toString();
if (userroleString.indexOf("超级管理员") != -1 || userroleString.indexOf("试验车牌办理人员") != -1) {
$("#checkpoint_cartype").show();
} else {
$("#checkpoint_cartype").hide();
}
// project_status
if (userroleString.indexOf("超级管理员") != -1 || userroleString.indexOf("项目管理") != -1) {
$("#project_status").show();
} else {
$("#project_status").hide();
}
}
var index = "";
function loadsumCarList(args, order, pageInfo) {
var url = allurl + "/car-management/car/pageQuery.action";
if (args == "orderQuery") {
url = allurl + "/car-management/car/orderQuery.action";
}
if (pageInfo == undefined) {
var pageInfo = {
pageNumber: 1,
pageSize: 10
};
}
$("#sumcarTable").bootstrapTable('destroy').bootstrapTable({
url: url,
dataType: 'json',
striped: true, //是否显示行间隔色
toggle: "table",
toolbar: "sumcarTable_toolbar",
pagination: "true", //是否显示分页(*)
sortOrder: "asc", //排序方式
sidePagination: "server", //分页方式:client客户端分页,server服务端分页(*)
pageNumber: pageInfo.pageNumber, //初始化加载第一页,默认第一页
pageSize: pageInfo.pageSize, //每页的记录行数(*)
paginationShowPageGo: true,
pageList: [10, 25, 50, 100, 150, 200, 300, 400, 500], //可供选择的每页的行数(*)
search: false, //是否搜索查询
showColumns: true, //是否显示所有的列
showRefresh: false, //是否显示刷新按钮
sortable: true, //是否启用排序
minimumCountColumns: 2, //最少允许的列数
clickToSelect: true, //是否启用点击选中行
searchOnEnterKey: true, //设置为 true时,按回车触发搜索方法
strictSearch: false, //设置为 true启用全匹配搜索, 否则为模糊搜索
showToggle: true, //是否显示切换视图(table/card)按钮
searchAlign: "right",
showFullscreen: true, //是否显示全屏按钮
showExport: true,
buttonsAlign: "right", //按钮位置
exportDataType: "selected",
exportTypes: ['excel'], //导出文件类型
exportOptions: {
ignoreColumn: [0], //忽略某一列的索引
fileName: '测试车辆-车辆总表', //文件名称设置
worksheetName: 'sheet1', //表格工作区名称
tableName: '测试车辆-车辆总表',
excelstyles: ['background-color', 'color', 'font-size', 'font-weight']
// onMsoNumberFormat: DoOnMsoNumberFormat
},
uniqueId: "vSn", // 每一行的唯一标识
queryParams: function (params) {
var temp = {
size: params.limit, //页面大小
page: (params.offset / params.limit) + 1, //页码
sort: "vSn", //排序列名
sortOrder: "asc", //排位命令(desc,asc)
vSn: $("#sumCarList .sumcar_top .vSn").val(),
customer: $("#sumCarList .sumcar_top .customer").val(),
project_sn: $("#sumCarList .sumcar_top .project_sn").val(),
adminName: $("#sumCarList .sumcar_top .adminName").val(),
vin: $("#sumCarList .sumcar_top .vin").val(),
engineNumber: $("#sumCarList .sumcar_top .engineNumber").val(),
projectEngineer: $("#sumCarList .sumcar_top .projectEngineer").val(),
brandModeltwo: $("#filter_model .brandModeltwo").val(),
groupName: $("#sumCarList .sumcar_top .groupName").val(), //车辆分组
istatus: $("#sumCarList .sumcar_top .istatus").val(), // 保险状态
vehicleInspection: $("#sumCarList .sumcar_top .vehicleInspection").val(), // 验车状态
carStatus: $("#sumCarList .sumcar_top .carStatus").val(), // 车辆状态
NO: $("#filter_model .NO").val(),
bstart: $("#filter_model .bstart").val(), //保险起始日
bend: $("#filter_model .bend").val(), //保险终止日
pstart: $("#filter_model .pstart").val(), //牌照起始日
pend: $("#filter_model .pend").val(), //牌照结束日
ustart: $("#filter_model .ustart").val(), //ustart接车起始日
uend: $("#filter_model .uend").val(), //接车结束日
backstart: $("#filter_model .backstart").val(), //还车起始日
backend: $("#filter_model .backend").val(), //还车结束日
ing: "", //在用
all: "", //全部
beforup: "", //先前接车
haveLi: "", //有牌照无保险
HaveIn: "", //有保险无牌照
thismonthback: "", //当月归还
thismonnew: "", //当月新车
beforBack: "", // 之前归还
stop: "" //// 停用车辆
};
// temp.order = order;
console.log(order);
if (args == "orderQuery") {
for (var key in temp) {
if (key == order) {
temp[key] = true;
}
}
}
console.log(temp);
return temp;
},
onLoadSuccess: function (res) {
console.log(res);
},
onLoadError: function () {
console.log("数据加载失败!");
},
//单击行时
onClickRow: function (row, $element) {
index = $element.data('index');
},
//点击每列前的checkbox时
onCheck: function (row, $element) {
index = $element.data('index');
},
columns: [
[{
"title": "测试车辆-车辆总表",
"halign": "center",
"align": "center",
"colspan": 32
}],
[{
field: "checkbox",
title: "全选",
checkbox: true,
align: 'center',
valign: "middle",
width: 100
},
{
field: 'index',
title: "序号",
width: 100,
valign: "middle",
align: "center",
formatter: function (value, row, index) {
var pageSize = $('#sumcarTable').bootstrapTable('getOptions').pageSize; //通过表的#id 可以得到每页多少条
var pageNumber = $('#sumcarTable').bootstrapTable('getOptions').pageNumber; //通过表的#id 可以得到当前第几页
return pageSize * (pageNumber - 1) + index + 1; //返回每条的序号: 每页条数 * (当前页 - 1 )+ 序号
}
},
{
field: "vSn",
title: '<span>车辆编号</span>',
width: 100,
align: 'center',
valign: "middle",
events: carVsnoperateEvents,
formatter: carVsnoperateFormatter
},
{
field: "project",
title: "项目编号",
align: 'center',
valign: "middle",
width: 100,
formatter: function (value, row, index) {
if (value != null) {
return value.project_sn
}
}
},
{
field: "project",
title: "项目状态",
align: 'center',
valign: "middle",
width: 100,
formatter: function (value, row, index) {
if (value != null) {
return value.project_status
}
}
},
{
field: "customer",
title: "客户",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null) {
return '';
} else {
return '<span style="width:85px;">' + value + '</span>';
}
}
},
{
field: "projectEngineer",
title: "项目工程师",
align: 'center',
valign: "middle",
width: 80
},
{
field: "adminName",
title: "车管",
align: 'center',
valign: "middle",
width: 80,
formatter: function (value, row, index) {
if (value == null) {
return '';
} else {
return '<span style="color:green">' + value + '</span>';
}
}
},
{
field: "car_status",
title: "车辆状态",
align: 'center',
valign: "middle",
width: 100,
formatter: function (value, row, index) {
if (value == '已还') {
return '<span style="color:#999">' + value + '</span>';
} else {
return '<span style="color:#333">' + value + '</span>'
}
}
},
{
field: "engineNumber",
title: "发动机号",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null) {
return '';
} else {
return '<span style="width:50px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "vin",
title: "车架号",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null) {
return '';
} else {
return '<span style="width:50px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "vehicleQuality",
title: "吨位",
align: 'center',
valign: "middle",
width: 70
},
{
field: "color",
title: "颜色",
align: 'center',
valign: "middle",
width: 70
},
{
field: "upcheckTime",
title: "接车日期",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null || value == "1970-10-01") {
return '';
} else {
return '<span style="width:40px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "upcheckSubmitTime",
title: "接车提交日期",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null || value == "1970-10-01") {
return '';
} else {
return '<span style="width:40px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "backchecktime",
title: "还车日期",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null || value == "1970-10-01") {
return '';
} else {
return '<span style="width:40px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "backcheckSubmitTime",
title: "还车提交日期",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null || value == "1970-10-01") {
return '';
} else {
return '<span style="width:40px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "vCarType",
title: "车辆类型",
align: 'center',
valign: "middle",
width: 70
},
{
field: "engineCapacity",
title: "排量",
align: 'center',
valign: "middle",
width: 70
},
{
field: "checkStaionType",
title: "检测站车型",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null) {
return '';
} else {
return '<span style="width:60px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "brandModelone",
title: "车辆型号",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null) {
return '';
} else {
return '<span style="min-width:40px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "seats",
title: "座纳",
align: 'center',
valign: "middle"
},
{
field: "brandModeltwo",
title: "厂牌型号(保)",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null) {
return '';
} else {
return '<span style="width:50px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "insNo",
title: "保单号",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null) {
return '';
} else {
return '<span style="width:50px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "istatus",
title: "保险状态",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
var a = "";
if (value == null) {
var a = '';
} else if (value == "未申请") {
var a = '<span style="color:red">未申请</span>';
} else if (value == "已申请") {
var a = '<span style="color:green">已申请</span>';
} else if (value == "未续保") {
var a = '<span style="color:red">未续保</span>';
} else if (value == "已续保") {
var a = '<span style="color:green">已续保</span>';
} else {
var a = value;
}
return a;
}
}, {
field: "vehicleInspection",
title: "验车状态",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
var a = "";
if (value == null) {
var a = '';
} else if (value == "未申请") {
var a = '<span style="color:red">未申请</span>';
} else if (value == "已申请") {
var a = '<span style="color:green">已申请</span>';
} else {
var a = value;
}
return a;
}
},
{
field: "insremark",
title: "保险备注",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null) {
return '';
} else {
return '<span style="width:40px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "startTime",
title: "保险起始日",
align: 'center',
valign: "middle",
formatter: function (value, row, index) {
if (value == null || value == "1970-10-01") {
return '';
} else {
return '<span style="width:40px;word-break:break-all; word-wrap:break-all;">' + value + '</span>';
}
}
},
{
field: "endTime",
title: "保险终止日",
align: 'center',
valign: "middle",
width: 70,
formatter: function (value, row, index) {
if (value == null || value == "1970-10-01") {
return '';
} else {
return '<span style="color:green">' + value + '</span>';
}
}
},
{
field: "licenseEndTime",
title: "车牌到期日",
align: 'center',
valign: "middle",
width: 70,
formatter: function (value, row, index) {
if (value == null || value == "1970-10-01") {
return '';
} else {
return '<span style="color:blue">' + value + '</span>';
}
}
},
{
field: "licenseNo",
title: "车牌",
width: 70,
align: 'center',
valign: "middle"
},
{
field: "licremark",
title: "车牌备注",
width: 70,
align: 'center',
valign: "middle"
}
]
]
});
}
$("#project_status").unbind('click').bind('click', function () {
$("#add_model").modal();
$("#add_model #myModalLabel").html("项目状态更新");
creatForm(projectStatus, "#add_model .modal-body form", "porjectstatus_btn");
var projectsn = "";
$.ajax({
url: allurl + "/car-management/project/likeProjectSn.action?projectsn=" + projectsn,
async: false,
success: function (res) {
console.log(res);
var selectOption = "";
if (res.length > 0) {
for (var i = 0; i < res.length; i++) {
selectOption += '<option>' + res[i] + '</option>';
}
} else {
selectOption = '<option>' + "请填写" + '</option>';
}
$('#add_model .modal-body form .projectSn').html(selectOption);
}
});
$('#add_model .modal-body form .projectSn').editableSelect({
effects: 'slide',
filter: true,
duration: 200,
onCreate: function () {
$("#add_model .modal-body form .projectSn").val();
},
onShow: function () {
console.log("下拉框显示");
},
onSelect: function () {
// console.log("下拉框选项被选中");
var a = $("#add_model .modal-body form .projectSn").val();
$.ajax({
url: allurl + "/car-management/project/loadStatusBySn.action?sn=" + a,
success: function (res) {
console.log(res);
if (res) {
$('#add_model .modal-body form .currentstatus').val(res);
}
}
});
}
});
// $("#add_model .currentstatus").val($("#add_model select.projectSn option:selected").attr("status"));
// 实时监测项目号的值
// $('#add_model select.projectSn').change(function() {
// $("#add_model .currentstatus").val($("#add_model select.projectSn option:selected").attr("status"));
// });
$(".porjectstatus_btn").unbind('click').bind('click', function () {
var sub_url = allurl + "/car-management/project/updateStatus.action";
var sub_data = {
"projectSn": $("#add_model .projectSn").val(),
status: $("#add_model .status option:selected").attr("value")
};
$(this).attr({
"data-dismiss": "modal",
"aria-label": "Close"
});
subData(sub_url, sub_data, "get", "projectstatus");
});
});
$("#sumcar_filter").unbind('click').bind('click', function () {
$("#filter_model").modal();
$("#filter_model #myModalLabel").html("车辆筛选");
$(".sumcar_filter_btn").unbind('click').bind('click', function () {
loadsumCarList();
// var sub_data = $("#filter_model .modal-body form").serialize();
//var sub_url = allurl + "/car-management/vehicle/add.json";
// $(this).attr({ "data-dismiss": "modal", "aria-label": "Close" });
// subData(sub_url, sub_data, "post", "sub_sumcar_filter");
});
});
$("#checkpoint_cartype").unbind('click').bind('click', function () { //检测站车型更新
var checkpoint_cartype_Arr = $("#sumcarTable").bootstrapTable('getSelections');
deletAll(checkpoint_cartype_Arr, "checkpoint_cartype_update");
});
var cartypeInfo = [{
"name": "车辆编号",
"type": "text",
"inputName": "vSn",
"must": "*"
},
{
"name": "检测站车型",
"type": "text",
"inputName": "type",
"must": "*"
},
];
// 车辆总表查询
var sumcar_row_filter = [{
"name": "项目号",
"type": "text",
"inputName": "project_sn",
"must": ""
},
{
"name": "车辆编号",
"type": "text",
"inputName": "vSn",
"must": ""
},
{
"name": "车架号",
"type": "text",
"inputName": "vin",
"must": ""
},
{
"name": "发动机号",
"type": "text",
"inputName": "engineNumber",
"must": ""
},
{
"name": "车管",
"type": "text",
"inputName": "adminName",
"must": ""
},
{
"name": "客户",
"type": "text",
"inputName": "customer",
"must": ""
},
{
"name": "车辆分组",
"type": "text",
"inputName": "groupName",
"must": ""
},
{
"name": "保险状态",
"type": "text",
"inputName": "istatus",
"must": ""
},
{
"name": "验车状态",
"type": "text",
"inputName": "vehicleInspection",
"must": ""
},
{
"name": "项目工程师",
"type": "text",
"inputName": "projectEngineer",
"must": ""
},
{
"name": "车辆状态",
"type": "text",
"inputName": "carStatus",
"must": ""
}
];
var projectStatus = [{
"name": "项目号",
"type": "select",
"inputName": "projectSn",
"must": "*",
"option": [{
"name": "请填写",
"val": "请填写"
}]
},
{
"name": "当前状态",
"type": "text",
"inputName": "currentstatus",
"must": "*"
},
{
"name": "更新后状态",
"type": "select",
"inputName": "status",
"must": "*",
"option": [{
"name": "Active",
"val": "Active"
}, {
"name": "Closed",
"val": "Closed"
}, {
"name": "pending",
"val": "pending"
},
{
"name": "Cancelled",
"val": "Cancelled"
}, {
"name": "To do",
"val": "To do"
},
{
"name": "Lost",
"val": "Lost"
}, {
"name": "ADP",
"val": "ADP"
},
{
"name": "C-cal",
"val": "C-cal"
}, {
"name": "BN-cal",
"val": "BN-cal"
},
]
},
];
$(".btn_filter button").unbind('click').bind('click', function () {
$(this).addClass('filter_choice_btn').siblings().removeClass('filter_choice_btn');
});
// 更新项目状态/project/updateStatus.action
//查询 /car/orderQuery.action
// 车辆录入列表查询
creatSelect(sumcar_row_filter, "#sumCarList .sumcar_top .form-inline", "sumcar_filter_btn");
$(".sumcar_filter_btn").unbind('click').bind('click', function () {
loadsumCarList();
})
$("#sumCarList .sumcar_top input").change(function () {
loadsumCarList();
});
// 模态框条件查询
// btn btn-default pull-left btn-primary
$("#filter_model .pull-left").unbind('click').bind('click', function () {
if ($(".btn_filter button").hasClass("filter_choice_btn")) {
var val = $(".filter_choice_btn").attr("value");
loadsumCarList("orderQuery", $(".filter_choice_btn").attr("value"));
console.log(val);
} else {
loadsumCarList();
}
})
$("#sumcar_filter_allcar").unbind('click').bind('click', function () { //所有车辆
loadsumCarList("orderQuery", "all");
})
$("#sumcar_filter_usecar").unbind('click').bind('click', function () { //在用车辆
loadsumCarList("orderQuery", "ing");
});
// 通过车辆编号升序或者降序
$(".vSn_sort").unbind('click').bind('click', function () {
sumcarqueryParams("orderQuery");
loadsumCarList("orderQuery");
})
// 撤销还车
$("#cancle_back").unbind('click').bind('click', function () {
var cancle_back_Arr = $("#sumcarTable").bootstrapTable('getSelections');
var ids = []
console.log(cancle_back_Arr)
cancle_back_Arr.forEach(item => {
if (item.car_status == '已还') {
ids.push(item.id)
}
});
if (ids.length == 0) {
toastr.warning('请至少选择一个已还车辆', '提示', errormessageOpts);
return;
}
$.ajax({
url: allurl + "/car-management/car/cancleBackCar.action",
type: "get",
data: {
ids: ids.join()
},
contentType: 'application/json;charset=UTF-8', // contentType很重要
crossDomain: true,
success: function (res) {
if (res.ret) {
toastr.success(res.msg, '提示', messageOpts);
loadsumCarList();
} else {
toastr.warning(res.msg, '提示', errormessageOpts);
}
},
error: function (err) {
console.log(err)
}
})
}); | 28.693252 | 116 | 0.480051 |
99380ba49f049333b3b4a99881b5e3bc7138c33d | 3,297 | js | JavaScript | sundry_hacks/js_console_hacks/get_vm_account_tag_value.js | MitchellGerdisch/tbutil_scripts | 3f32ac75723481ff5975ea46ca3955ce940d1f71 | [
"MIT"
] | 1 | 2019-02-13T16:46:43.000Z | 2019-02-13T16:46:43.000Z | sundry_hacks/js_console_hacks/get_vm_account_tag_value.js | MitchellGerdisch/tbutil_scripts | 3f32ac75723481ff5975ea46ca3955ce940d1f71 | [
"MIT"
] | null | null | null | sundry_hacks/js_console_hacks/get_vm_account_tag_value.js | MitchellGerdisch/tbutil_scripts | 3f32ac75723481ff5975ea46ca3955ce940d1f71 | [
"MIT"
] | 1 | 2020-08-09T00:09:46.000Z | 2020-08-09T00:09:46.000Z | /*
* INPUTS:
* - VM Group name
* - One or two VM Tag Key names for which to return value
*
* OUTPUTS:
* - CSV where each row has:
* - VM Name
* - VM UUID
* - VM Account name
* - VM Tag Value for identified tag key
*/
async function getGroupVMsAcctTag(group_name, tag_key_name, optional_tag_key_name) {
if ((group_name == null) || (group_name == "")) {
console.log("**** Need to pass name of VM group.")
console.log("**** USAGE: getGroupVMsAcctTag(\"GROUP NAME\",\"VM TAG KEY NAME\",\"OPTIONAL ADDITIONAL TAG\"")
return
}
if ((tag_key_name == null) || (tag_key_name == "")) {
console.log("**** Need to pass name of key to return value for.")
console.log("**** USAGE: getGroupVMsAcctTag(\"GROUP NAME\",\"VM TAG KEY NAME\",\"OPTIONAL ADDITIONAL TAG\"")
return
}
group_uuid = await getUuid("Group", group_name)
vm_list = await getGroupMembers(group_uuid)
if (vm_list.length == 0) {
console.log("No members found in group, "+group_name+" - Exiting.")
return
}
console.log("Found "+vm_list.length+" VMs in group, "+group_name+".")
/* collate data for each VM */
vm_data = []
for (i = 0; i < vm_list.length; i++) {
vm = vm_list[i]
vm_data.push({
"name":vm.displayName,
"uuid":vm.uuid,
"account":vm.discoveredBy.displayName,
"tag_value":vm.tags[tag_key_name][0],
"opt_tag_value":vm.tags[optional_tag_key_name][0]
})
}
csvContent = "data:text/csv;charset=utf-8,";
csvContent += "Account,VM Name,VM UUID,"+tag_key_name+" Tag Value,"+optional_tag_key_name+" Tag Value\n"
console.log("Downloading CSV containing VM data")
for (k = 0; k < vm_data.length; k++) {
vm = vm_data[k]
csvContent += vm.account + "," + vm.name + "," + vm.uuid + "," + vm.tag_value + "," + vm.opt_tag_value + "\n"
}
link = document.createElement('a')
link.setAttribute('href', encodeURI(csvContent));
link.setAttribute('download', "vm_account_and_"+tag_key_name+"-tag-value_"+`${(new Date()).getTime()}.csv`);
link.click();
}
async function getGroupMembers(uuid) {
uri = "/api/v2/groups/"+uuid+"/members"
response = await fetch(uri)
members_json_array = await response.json()
return members_json_array
}
async function getUuid(entity_type, entity_name) {
if (entity_type == "BusApp") {
filterType = "busAppsByName"
className = "BusinessApplication"
} else if (entity_type == "Group") {
filterType = "groupsByName"
className = "Group"
} else {
console.log("getUuid: Called with incorrect entity_type")
return 0
}
entity_name = regExpEscape(entity_name)
search_body = {
"criteriaList": [
{
"expType": "RXEQ",
"expVal": "^"+entity_name+"$", /* need to limit to exact name match only so anchor the name */
"filterType": filterType,
"caseSensitive": true
}
],
"logicalOperator": "AND",
"className": className,
"scope": null
}
response = await fetch('/vmturbo/rest/search', {
method: 'POST',
body: JSON.stringify(search_body),
headers: {
'Content-Type': 'application/json'
}
})
info = await response.json()
if (info.length > 0) {
/* Found an existing entity so return uuid */
return info[0].uuid
}
}
function regExpEscape(literal_string) {
return literal_string.replace(/[-[\]{}()*+!<=:?.\/\\^$|#\s,]/g, '\\$&');
}
| 26.58871 | 111 | 0.641492 |
993810f9cbd7b2543b469b9a24695dc029d8a900 | 97 | js | JavaScript | bower_components/jscover/src/test-integration/resources/data/javascript/javascript-special-characters.js | v0lkan/o2.js | d835204184570bcd8f2fe3713d3dc8ecf2464c3a | [
"MIT"
] | 16 | 2015-05-25T06:43:23.000Z | 2021-06-03T18:47:24.000Z | bower_components/jscover/src/test-integration/resources/data/javascript/javascript-special-characters.js | v0lkan/o2.js | d835204184570bcd8f2fe3713d3dc8ecf2464c3a | [
"MIT"
] | 1 | 2016-12-06T04:12:10.000Z | 2016-12-06T04:12:10.000Z | bower_components/jscover/src/test-integration/resources/data/javascript/javascript-special-characters.js | v0lkan/o2.js | d835204184570bcd8f2fe3713d3dc8ecf2464c3a | [
"MIT"
] | 5 | 2015-05-07T19:04:12.000Z | 2016-12-05T23:25:20.000Z | function f() {
return '\'';
}
function g() {
return "\"";
}
function h() {
return '\\';
}
| 8.083333 | 14 | 0.463918 |
993859fc10087ad1949231899c3977b95ecfd04c | 508 | js | JavaScript | login/static/js/login.js | NFuller721/TwitterClone | a56c2f2ccae7f071d6cf1e59a90aa951cc0bca2b | [
"MIT"
] | null | null | null | login/static/js/login.js | NFuller721/TwitterClone | a56c2f2ccae7f071d6cf1e59a90aa951cc0bca2b | [
"MIT"
] | null | null | null | login/static/js/login.js | NFuller721/TwitterClone | a56c2f2ccae7f071d6cf1e59a90aa951cc0bca2b | [
"MIT"
] | null | null | null | let Login = () => {
$.redirect("/login/", {'username': $("#username").val(), 'password': $("#password").val()});
};
$(document).ready(function() {
Requirements = [
'./static/js/Modules/loginBox.js',
'/static/js/Modules/inputBox.js',
]
var head = $("head");
Render(head, Requirements);
externalRequirements = loginBoxRequirements.concat(inputBoxRequirements);
Render(head, externalRequirements);
var body = $("body");
body.append(
`
${loginBox(inputBox)}
`
)
});
| 21.166667 | 94 | 0.606299 |
9938a902686e3b83f4ab7ca0b935cc43af49bde7 | 378 | js | JavaScript | blueocean-pipeline-editor/src/main/js/GitUtils.js | fengzhao-study-notes/blueocean-plugin | be654d88ab89ceff0f3fc9b216bde72a490d2c9b | [
"MIT"
] | 1 | 2022-03-10T03:27:12.000Z | 2022-03-10T03:27:12.000Z | blueocean-pipeline-editor/src/main/js/GitUtils.js | fengzhao-study-notes/blueocean-plugin | be654d88ab89ceff0f3fc9b216bde72a490d2c9b | [
"MIT"
] | 44 | 2018-11-26T04:44:19.000Z | 2019-06-04T19:17:34.000Z | blueocean-pipeline-editor/src/main/js/GitUtils.js | fengzhao-study-notes/blueocean-plugin | be654d88ab89ceff0f3fc9b216bde72a490d2c9b | [
"MIT"
] | 1 | 2020-04-20T11:09:12.000Z | 2020-04-20T11:09:12.000Z | /**
* Simple git utilties
*/
// FIXME centralize this, move credential creation into jenkins.credential.selection for git
export function isSshRepositoryUrl(url) {
if (!url || url.trim() === '') {
return false;
}
if (/^ssh:\/\/.*/.test(url)) {
return true;
}
if (/^[^@:]+@.*/.test(url)) {
return true;
}
return false;
}
| 18 | 92 | 0.539683 |
993926458330625c40e24a454c186dd7954e2d0b | 491 | js | JavaScript | node_modules/@material-ui/icons/es/Public.js | jlclementjr/material-dashboard | b747c01e60f86a5be1af425280e4b1539fcbfcbe | [
"MIT"
] | 1 | 2019-08-22T04:57:30.000Z | 2019-08-22T04:57:30.000Z | node_modules/@material-ui/icons/es/Public.js | jlclementjr/material-dashboard | b747c01e60f86a5be1af425280e4b1539fcbfcbe | [
"MIT"
] | 3 | 2020-09-07T12:00:40.000Z | 2022-02-12T22:02:40.000Z | node_modules/@material-ui/icons/es/Public.js | jlclementjr/material-dashboard | b747c01e60f86a5be1af425280e4b1539fcbfcbe | [
"MIT"
] | 1 | 2018-07-24T07:40:04.000Z | 2018-07-24T07:40:04.000Z | import React from 'react';
import createSvgIcon from './utils/createSvgIcon';
export default createSvgIcon(React.createElement("g", null, React.createElement("path", {
d: "M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-1 17.93c-3.95-.49-7-3.85-7-7.93 0-.62.08-1.21.21-1.79L9 15v1c0 1.1.9 2 2 2v1.93zm6.9-2.54c-.26-.81-1-1.39-1.9-1.39h-1v-3c0-.55-.45-1-1-1H8v-2h2c.55 0 1-.45 1-1V7h2c1.1 0 2-.9 2-2v-.41c2.93 1.19 5 4.06 5 7.41 0 2.08-.8 3.97-2.1 5.39z"
})), 'Public'); | 98.2 | 307 | 0.668024 |
993926f5c5c1c3557f049ecae7c03f7a61af0a5c | 1,217 | js | JavaScript | src/products/custormManager/views/sysInfo/businessManager/serviceLog/tableTitle.js | kinglong127124/puzzle | f618cdb5903c65281e68814cf48e17d6608e27dc | [
"MIT"
] | null | null | null | src/products/custormManager/views/sysInfo/businessManager/serviceLog/tableTitle.js | kinglong127124/puzzle | f618cdb5903c65281e68814cf48e17d6608e27dc | [
"MIT"
] | null | null | null | src/products/custormManager/views/sysInfo/businessManager/serviceLog/tableTitle.js | kinglong127124/puzzle | f618cdb5903c65281e68814cf48e17d6608e27dc | [
"MIT"
] | null | null | null | export default {
indexTitle: [
{
text: '审核状态',
value: 'validateStatus',
width: '80',
align: 'center'
}, {
text: '单据编号',
value: 'code',
width: '130',
align: 'center',
showOverflowTooltip: true
}, {
text: '服务名称',
value: 'name',
minWidth: 200,
align: 'left',
headerAlign: 'center',
showOverflowTooltip: true
}, {
text: '客户单位',
value: 'cusOrgName',
width: 200,
align: 'left',
headerAlign: 'center',
showOverflowTooltip: true
}, {
text: '签字人员',
value: 'signaturePerson',
width: 130,
align: 'center',
headerAlign: 'center',
showOverflowTooltip: true
}, {
text: '服务人员',
value: 'servicePerson',
width: 130,
align: 'center',
headerAlign: 'center',
showOverflowTooltip: true
}, {
text: '服务日期',
value: 'signDate',
width: 130,
align: 'center',
headerAlign: 'center',
showOverflowTooltip: true
}, {
text: '登记时间',
value: 'inputTime',
width: '160',
align: 'center',
headerAlign: 'center',
showOverflowTooltip: true
}
]
};
| 20.627119 | 31 | 0.506984 |
993978998d580d5ffee973333e04042a7a8d3005 | 6,722 | js | JavaScript | js/datapicker-separate/time.js | Ikaros-521/boa_cgi_SMS | 194c79c34f6a27588a85ea9d2f51866310e55eef | [
"Apache-2.0"
] | 3 | 2021-12-15T10:21:27.000Z | 2022-02-02T16:33:15.000Z | js/datapicker-separate/time.js | Ikaros-521/boa_cgi_SMS | 194c79c34f6a27588a85ea9d2f51866310e55eef | [
"Apache-2.0"
] | null | null | null | js/datapicker-separate/time.js | Ikaros-521/boa_cgi_SMS | 194c79c34f6a27588a85ea9d2f51866310e55eef | [
"Apache-2.0"
] | null | null | null | /*==============BEGIN TIME============*/
// 时分秒
function Time(picker) {
this.picker = picker;
this.init();
}
$.extend(Time.prototype, {
init: function () {
},
event: function () {
// 时分秒取消
this.picker.$container.on('click', '.c-datepicker-time-panel__btn.cancel', function () {
var _this = API.getPicker($(this), 'time');
var $time = _this.picker.activeTimeWrap.find('.c-datePicker__input-time');
var index = _this.picker.$container.find('.c-datePicker__input-time').index($time);
if (!_this.picker.config.isRange) {
var day = _this.picker.$container.find('.c-datePicker__input-day').eq(index).val();
_this.picker.$input.val(day + ' ' + _this.prevValue);
}
_this.picker.$container.find('.c-datePicker__input-time').eq(index).val(_this.prevValue);
_this.hide();
});
// 时分秒确定
this.picker.$container.on('click', '.c-datepicker-time-panel__btn.confirm', function () {
var _this = API.getPicker($(this), 'time');
_this.hide();
});
// 0点
this.picker.$container.on('click', '.c-datepicker-time-panel__btn.min', function () {
var _this = API.getPicker($(this), 'time');
_this.updateTimeInput(_this.picker.timeMin);
});
// 23点
this.picker.$container.on('click', '.c-datepicker-time-panel__btn.max', function () {
var _this = API.getPicker($(this), 'time');
_this.updateTimeInput(_this.picker.timeMax);
});
// 点击隐藏
this.picker.$container.on('click', function () {
var _this = $(this).data('time');
_this.hide();
});
var timerArr = {
timer0: '',
timer1: '',
timer2: ''
};
// 滚动选择时分秒
this.picker.$container.find('.c-datepicker-scrollbar__wrap').scroll(function () {
var _this = API.getPicker($(this), 'time');
var index = _this.picker.$container.find('.c-datepicker-scrollbar__wrap').index($(this));
// 兼容滚动延时,导致下一个时间滚动清除掉上一个的timer,所以分开是三个
clearTimeout(timerArr['timer' + index]);
timerArr['timer' + index] = setTimeout(function () {
var top = $(this).scrollTop();
var num = Math.round(top / 32);
var len = $(this).find('li').length - 1;
if (num >= len) {
num = len;
}
top = num * 32;
$(this).scrollTop(top);
var index = _this.picker.activeTimeWrap.find('.c-datepicker-scrollbar__wrap').index($(this));
var $time = _this.picker.activeTimeWrap.find('.c-datePicker__input-time');
var day = _this.picker.activeTimeWrap.find('.c-datePicker__input-day').val();
var val = $time.val();
val = val.split(':');
val[index] = API.fillTime(num);
val = val.join(':');
$time.val(val);
if (!_this.picker.config.isRange) {
// 更新input val
_this.picker.$input.val(day + ' ' + val);
}
}.bind(this), 100);
})
},
updateTimeInput: function (val) {
this.picker.activeTimeWrap.find('.c-datePicker__input-time').val(val);
if (!this.picker.config.isRange) {
var day = this.picker.$input.val().split(' ')[0];
this.picker.$input.val(day + ' ' + val);
}
// this.updateTimePanel();
},
updateTimePanel: function (isShow) {
var $wrap = this.picker.activeTimeWrap.find('.c-datepicker-scrollbar__wrap');
var val = this.picker.activeTimeWrap.find('.c-datePicker__input-time').val();
var format = this.picker.config.format.split(' ')[1];
var regText = format.replace(/HH/, '[0-9]{2}').replace(/(mm|ss)/g, '[0-9]{2}');
var reg = new RegExp('^' + regText + '$');
var isMatch = reg.test(val);
// 判断符合时间格式
if (isMatch) {
// 兼容第一次打开才赋值
if (isShow) {
this.prevValue = val;
}
val = val.split(':');
$.each($wrap, function (i, el) {
$(el).scrollTop(Number(val[i]) * 32).addClass('active');
});
}
return isMatch;
},
show: function () {
this.picker.activeTimeWrap.find('.c-datepicker-time-panel').show();
this.updateTimePanel(true);
},
hide: function () {
this.picker.$container.find('.c-datepicker-time-panel').hide();
},
render: function (type, hour, minute, second) {
if (this.picker.config.isRange) {
this.renderRange(type, hour, minute, second);
} else {
this.renderSingle(type, hour, minute, second);
}
},
renderSingle: function (type, hour, minute, second) {
var html = this.renderHtml(type, hour, minute, second);
var $time = this.picker.activeTimeWrap.find('.c-datepicker-time-panel');
// 初始化,添加html
if (!$time.length) {
this.picker.activeTimeWrap.find('.c-datepicker-date-picker__editor-wrap').eq(1).append(html);
this.picker.$container.data('time', this);
this.event();
this.show();
} else {
// 已添加,显示
this.show();
}
},
renderRange: function (type, hour, minute, second) {
var html = this.renderHtml(type, hour, minute, second);
var $time = this.picker.activeTimeWrap.find('.c-datepicker-time-panel');
// 初始化,添加html
if (!$time.length) {
var $content = this.picker.$container.find('.c-datepicker-date-range-picker__time-content');
$content.eq(0).find('.c-datepicker-date-range-picker__editor-wrap').eq(1).append(html);
$content.eq(1).find('.c-datepicker-date-range-picker__editor-wrap').eq(1).append(html);
this.picker.$container.find('.c-datepicker-time-panel').hide();
this.picker.$container.data('time', this);
this.event();
this.show();
} else {
// 已添加,显示
this.show();
}
},
renderHtml: function (type, hour, minute, second) {
hour = hour || moment().hour();
minute = minute || moment().minute();
second = second || moment().second();
var li = '';
var html = '';
// 时
if (type[0]) {
for (var i = 0; i < 24; i++) {
var className = hour === i ? 'active' : '';
li += RENDERAPI.timeLiTpl(className, API.fillTime(i));
}
html += RENDERAPI.timeTpl('hour', li);
li = '';
}
// 分
if (type[1]) {
for (var j = 0; j < 60; j++) {
var className = minute === j ? 'active' : '';
li += RENDERAPI.timeLiTpl(className, API.fillTime(j));
}
html += RENDERAPI.timeTpl('minute', li);
li = '';
}
// 秒
if (type[2]) {
for (var k = 0; k < 60; k++) {
var className = second === k ? 'active' : '';
li += RENDERAPI.timeLiTpl(className, API.fillTime(k));
}
html += RENDERAPI.timeTpl('second', li);
}
var nameOptions = $.fn.datePicker.dates[this.picker.language];
html = RENDERAPI.timeMainTpl(nameOptions,html);
return html;
}
});
/*==============END TIME============*/ | 34.829016 | 101 | 0.575275 |
9939a4347d2caed4710aef3ad994218387b668f9 | 990 | js | JavaScript | online-workouts/w3resource/Fundamentals-ES6-II/js-program-254.js | ivenpoker/Learning-JS | 7c81b9ab5224bb844692e6d0d7e8a799bb7c875d | [
"MIT"
] | null | null | null | online-workouts/w3resource/Fundamentals-ES6-II/js-program-254.js | ivenpoker/Learning-JS | 7c81b9ab5224bb844692e6d0d7e8a799bb7c875d | [
"MIT"
] | null | null | null | online-workouts/w3resource/Fundamentals-ES6-II/js-program-254.js | ivenpoker/Learning-JS | 7c81b9ab5224bb844692e6d0d7e8a799bb7c875d | [
"MIT"
] | null | null | null | // #######################################################################################################
// # #
// # Program Purpose: Generate a UUID in Node.JS. #
// # Program Author: Happi Yvan <ivensteinpoker@gmail.com> #
// # Program Date: August 05, 2020. #
// # #
// #######################################################################################################
const crypto = require("crypto");
const UUIDGeneratorNode = () =>
([1e7] + -1e3 + -4e3 + -8e3 + -1e11).replace(/[018]/g, c =>
(c ^ (crypto.randomBytes(1)[0] & (15 >> (c / 4)))).toString(16)
);
(function () {
console.log("Node crypto UUID:", UUIDGeneratorNode());
})();
| 47.142857 | 106 | 0.261616 |