code stringlengths 2 1.05M | repo_name stringlengths 5 114 | path stringlengths 4 991 | language stringclasses 1 value | license stringclasses 15 values | size int32 2 1.05M |
|---|---|---|---|---|---|
function thisMovie(movieName) {
if (navigator.appName.indexOf("Microsoft") != -1) {
return window[movieName];
} else {
return document[movieName];
}
}
function trigger(value) {
thisMovie("map_test").receiveNotification(value);
}
function triggerXml(xmlurl,value) {
thisMovie("map_test").receiveXML(xmlurl,value);
}
| commtrack/temp-rapidsms | apps/schools/static/javascripts/flashlinks.js | JavaScript | lgpl-3.0 | 351 |
import React, {Component} from 'react';
import ReactRethinkdb from 'react-rethinkdb';
import reactMixin from 'react-mixin';
import ReactPanels from '../layout/ReactPanels'
import ReactPanel from '../layout/ReactPanel'
import Variables from './Variables'
const r = ReactRethinkdb.r;
class Namespaces extends Component {
static defaultProps = {
parent: undefined,
}
static propTypes = {
parent: React.PropTypes.instanceOf(ReactPanels),
}
constructor(props) {
super(props);
}
observe(props, state) { // eslint-disable-line no-unused-vars
return {
namespaces: new ReactRethinkdb.QueryRequest({
// RethinkDB query
query: r.table('namespaces'),
// subscribe to realtime changefeed
changes: true,
// return [] while loading
initial: [],
}),
};
}
openVariables = (id, name) => {
this.props.parent.push(
<ReactPanel width="wide">
<header>
<nav className="place-right">
<a className="close" title="Close this panel"></a>
</nav>
<h4>Variables from <b>{name}</b></h4>
</header>
<section>
<Variables parent={this.props.parent} namespace={id} />
</section>
</ReactPanel>
);
}
render() {
const icon = (name) => {
return require(`../svg/${name}.svg`)
};
const items = this.data.namespaces.value().map(x =>
<div key={x.id} className="list" onClick={() => { this.openVariables(x.id, x.name); }} data-id={x.id}>
<img className="list-icon" src={icon("package")} />
<span className="list-title">{x.name}</span>
</div>
);
return (
<div className="listview">
{items}
</div>
);
}
}
// Enable RethinkDB query subscriptions in this component
reactMixin.onClass(Namespaces, ReactRethinkdb.DefaultMixin);
export default Namespaces;
| jachinte/pascani | web/dashboard/src/panels/Namespaces.js | JavaScript | lgpl-3.0 | 1,759 |
var cache = {};
var ensureTokenKey = (token) => {
if (!cache[token])
cache[token] = {};
};
exports.set = (token, key, data) => {
ensureTokenKey(token);
cache[token][key] = data;
};
exports.get = (token, key) => {
ensureTokenKey(token);
return cache[token][key];
};
exports.clean = (token) => {
var data = cache[token];
delete cache[token];
return data;
};
exports.expire = (token, key) => {
ensureTokenKey(token);
delete cache[token][key];
};
| suryakencana/niimanga | frontends/xcms/app/utils/cache.js | JavaScript | lgpl-3.0 | 473 |
//// [callChainWithSuper.ts]
// GH#34952
class Base { method?() {} }
class Derived extends Base {
method1() { return super.method?.(); }
method2() { return super["method"]?.(); }
}
//// [callChainWithSuper.js]
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
// GH#34952
var Base = /** @class */ (function () {
function Base() {
}
Base.prototype.method = function () { };
return Base;
}());
var Derived = /** @class */ (function (_super) {
__extends(Derived, _super);
function Derived() {
return _super !== null && _super.apply(this, arguments) || this;
}
Derived.prototype.method1 = function () { var _a; return (_a = _super.prototype.method) === null || _a === void 0 ? void 0 : _a.call(this); };
Derived.prototype.method2 = function () { var _a; return (_a = _super.prototype["method"]) === null || _a === void 0 ? void 0 : _a.call(this); };
return Derived;
}(Base));
| alexeagle/TypeScript | tests/baselines/reference/callChainWithSuper(target=es5).js | JavaScript | apache-2.0 | 1,513 |
var _Color = (function () {
function _Color() {
}
return _Color;
})();
var Color;
(function (Color) {
Color.namedColors;
})(Color || (Color = {}));
var a = Color.namedColors["azure"];
var a = Color.namedColors.blue;
var a = Color.namedColors["pale blue"];
| hippich/typescript | tests/baselines/reference/propertyNamesWithStringLiteral.js | JavaScript | apache-2.0 | 286 |
import {Post} from 'api/post/post';
import {log} from 'components/logger';
var _ = require('lodash');
var slug = require('slug');
var tag = 'post/controller';
var controller = {
mountId: function(req, res, next, id) {
if (req.query.slug) {
Post.findBySlug(id)
.then(post =>{
req.post = post;
next();
})
.catch(next.bind(next));
} else {
Post.findById(id, function(err, post) {
if (err) return next(err);
post = post || {};
req.post = post;
next();
});
}
},
getAll: function(req, res, next) {
Post.find(req.query)
.populate('author', 'displayName _id')
.exec(function(err, posts){
if (err){
return next(err);
}
posts = _.map(posts, post => {
return post.toObject();
});
res.json(posts);
});
},
getOne: function(req, res, next) {
let post = req.post;
Post.populate(post, { path: 'author', select: 'displayName _id' }, function(err, post){
if (err) return next(err);
post = post.toObject();
res.json(post);
});
},
createOne: function(req, res, next) {
var newPost = req.body;
newPost.author = req.author._id;
log.info(tag, newPost);
Post.make(newPost)
.then(posts =>{
log.info(tag, posts[0]);
res.status(201).json(posts[0]);
})
.catch(next.bind(next));
},
editOne: function(req, res, next) {
_.merge(req.post, req.body);
req.post.save((err, post) =>{
if (err) {
return next(err);
}
res.status(201).json(post);
});
},
removeOne: function(req, res, next) {
req.post.remove((err, post) =>{
if (err){
return next(err);
}
res.json(post);
})
}
};
export {controller};
| angular-class/angular-class-site | server/api/post/controller.js | JavaScript | apache-2.0 | 1,820 |
'use strict';
var LE = require('../').LE;
var le = LE.create({
server: 'staging'
, acme: require('le-acme-core').ACME.create()
, store: require('le-store-certbot').create({
configDir: '~/letsencrypt.test/etc'
, webrootPath: '~/letsencrypt.test/var/:hostname'
})
, challenge: require('le-challenge-fs').create({
webrootPath: '~/letsencrypt.test/var/:hostname'
})
, debug: true
});
// TODO test generateRsaKey code path separately
// and then provide opts.accountKeypair to create account
//var testId = Math.round(Date.now() / 1000).toString();
var testId = 'test1000';
var testEmail = 'coolaj86+le.' + testId + '@gmail.com';
// TODO integrate with Daplie Domains for junk domains to test with
var testDomains = [ 'pokemap.hellabit.com', 'www.pokemap.hellabit.com' ];
var testCerts;
var tests = [
function () {
// TODO test that an altname also fetches the proper certificate
return le.core.certificates.checkAsync({
domains: testDomains
}).then(function (certs) {
if (!certs) {
throw new Error("Either certificates.registerAsync (in previous test)"
+ " or certificates.checkAsync (in this test) failed.");
}
testCerts = certs;
console.log('Issued At', new Date(certs.issuedAt).toISOString());
console.log('Expires At', new Date(certs.expiresAt).toISOString());
if (certs.expiresAt <= Date.now()) {
throw new Error("Certificates are already expired. They cannot be tested for duplicate or forced renewal.");
}
});
}
, function () {
return le.core.certificates.renewAsync({
email: testEmail
, domains: testDomains
}, testCerts).then(function () {
throw new Error("Should not have renewed non-expired certificates.");
}, function (err) {
if ('E_NOT_RENEWABLE' !== err.code) {
throw err;
}
});
}
, function () {
return le.core.certificates.renewAsync({
email: testEmail
, domains: testDomains
, renewWithin: 720 * 24 * 60 * 60 * 1000
}, testCerts).then(function (certs) {
console.log('Issued At', new Date(certs.issuedAt).toISOString());
console.log('Expires At', new Date(certs.expiresAt).toISOString());
if (certs.issuedAt === testCerts.issuedAt) {
throw new Error("Should not have returned existing certificates.");
}
});
}
];
function run() {
//var express = require(express);
var server = require('http').createServer(le.middleware());
server.listen(80, function () {
console.log('Server running, proceeding to test.');
function next() {
var test = tests.shift();
if (!test) {
server.close();
console.info('All tests passed');
return;
}
test().then(next, function (err) {
console.error('ERROR');
console.error(err.stack);
server.close();
});
}
next();
});
}
run();
| Daplie/node-greenlock | tests/renew-certificate.js | JavaScript | apache-2.0 | 2,906 |
/* ******************************
Search Prompt
Author: Jack Lukic
Designed to be used as an autocomplete
or to deliver quick inline search results
****************************** */
;(function ($, window, document, undefined) {
$.fn.search = function(source, parameters) {
var
$allModules = $(this),
settings = $.extend(true, {}, $.fn.search.settings, parameters),
className = settings.className,
selector = settings.selector,
error = settings.error,
namespace = settings.namespace,
eventNamespace = '.' + namespace,
moduleNamespace = namespace + '-module',
moduleSelector = $allModules.selector || '',
time = new Date().getTime(),
performance = [],
query = arguments[0],
methodInvoked = (typeof query == 'string'),
queryArguments = [].slice.call(arguments, 1),
invokedResponse
;
$(this)
.each(function() {
var
$module = $(this),
$prompt = $module.find(selector.prompt),
$searchButton = $module.find(selector.searchButton),
$results = $module.find(selector.results),
$result = $module.find(selector.result),
$category = $module.find(selector.category),
element = this,
instance = $module.data(moduleNamespace),
module
;
module = {
initialize: function() {
module.verbose('Initializing module');
var
prompt = $prompt[0],
inputEvent = (prompt.oninput !== undefined)
? 'input'
: (prompt.onpropertychange !== undefined)
? 'propertychange'
: 'keyup'
;
// attach events
$prompt
.on('focus' + eventNamespace, module.event.focus)
.on('blur' + eventNamespace, module.event.blur)
.on('keydown' + eventNamespace, module.handleKeyboard)
;
if(settings.automatic) {
$prompt
.on(inputEvent + eventNamespace, module.search.throttle)
;
}
$searchButton
.on('click' + eventNamespace, module.search.query)
;
$results
.on('click' + eventNamespace, selector.result, module.results.select)
;
module.instantiate();
},
instantiate: function() {
module.verbose('Storing instance of module', module);
instance = module;
$module
.data(moduleNamespace, module)
;
},
destroy: function() {
module.verbose('Destroying instance');
$module
.removeData(moduleNamespace)
;
},
event: {
focus: function() {
$module
.addClass(className.focus)
;
module.results.show();
},
blur: function() {
module.search.cancel();
$module
.removeClass(className.focus)
;
module.results.hide();
}
},
handleKeyboard: function(event) {
var
// force latest jq dom
$result = $module.find(selector.result),
$category = $module.find(selector.category),
keyCode = event.which,
keys = {
backspace : 8,
enter : 13,
escape : 27,
upArrow : 38,
downArrow : 40
},
activeClass = className.active,
currentIndex = $result.index( $result.filter('.' + activeClass) ),
resultSize = $result.size(),
newIndex
;
// search shortcuts
if(keyCode == keys.escape) {
module.verbose('Escape key pressed, blurring search field');
$prompt
.trigger('blur')
;
}
// result shortcuts
if($results.filter(':visible').size() > 0) {
if(keyCode == keys.enter) {
module.verbose('Enter key pressed, selecting active result');
if( $result.filter('.' + activeClass).exists() ) {
$.proxy(module.results.select, $result.filter('.' + activeClass) )();
event.preventDefault();
return false;
}
}
else if(keyCode == keys.upArrow) {
module.verbose('Up key pressed, changing active result');
newIndex = (currentIndex - 1 < 0)
? currentIndex
: currentIndex - 1
;
$category
.removeClass(activeClass)
;
$result
.removeClass(activeClass)
.eq(newIndex)
.addClass(activeClass)
.closest($category)
.addClass(activeClass)
;
event.preventDefault();
}
else if(keyCode == keys.downArrow) {
module.verbose('Down key pressed, changing active result');
newIndex = (currentIndex + 1 >= resultSize)
? currentIndex
: currentIndex + 1
;
$category
.removeClass(activeClass)
;
$result
.removeClass(activeClass)
.eq(newIndex)
.addClass(activeClass)
.closest($category)
.addClass(activeClass)
;
event.preventDefault();
}
}
else {
// query shortcuts
if(keyCode == keys.enter) {
module.verbose('Enter key pressed, executing query');
module.search.query();
$searchButton
.addClass(className.down)
;
$prompt
.one('keyup', function(){
$searchButton
.removeClass(className.down)
;
})
;
}
}
},
search: {
cancel: function() {
var
xhr = $module.data('xhr') || false
;
if( xhr && xhr.state() != 'resolved') {
module.debug('Cancelling last search');
xhr.abort();
}
},
throttle: function() {
var
searchTerm = $prompt.val(),
numCharacters = searchTerm.length
;
clearTimeout(module.timer);
if(numCharacters >= settings.minCharacters) {
module.timer = setTimeout(module.search.query, settings.searchThrottle);
}
else {
module.results.hide();
}
},
query: function() {
var
searchTerm = $prompt.val(),
cachedHTML = module.search.cache.read(searchTerm)
;
if(cachedHTML) {
module.debug("Reading result for '" + searchTerm + "' from cache");
module.results.add(cachedHTML);
}
else {
module.debug("Querying for '" + searchTerm + "'");
if(typeof source == 'object') {
module.search.local(searchTerm);
}
else {
module.search.remote(searchTerm);
}
$.proxy(settings.onSearchQuery, $module)(searchTerm);
}
},
local: function(searchTerm) {
var
results = [],
fullTextResults = [],
searchFields = $.isArray(settings.searchFields)
? settings.searchFields
: [settings.searchFields],
searchRegExp = new RegExp('(?:\s|^)' + searchTerm, 'i'),
fullTextRegExp = new RegExp(searchTerm, 'i'),
searchHTML
;
$module
.addClass(className.loading)
;
// iterate through search fields in array order
$.each(searchFields, function(index, field) {
$.each(source, function(label, thing) {
if(typeof thing[field] == 'string' && ($.inArray(thing, results) == -1) && ($.inArray(thing, fullTextResults) == -1) ) {
if( searchRegExp.test( thing[field] ) ) {
results.push(thing);
}
else if( fullTextRegExp.test( thing[field] ) ) {
fullTextResults.push(thing);
}
}
});
});
searchHTML = module.results.generate({
results: $.merge(results, fullTextResults)
});
$module
.removeClass(className.loading)
;
module.search.cache.write(searchTerm, searchHTML);
module.results.add(searchHTML);
},
remote: function(searchTerm) {
var
apiSettings = {
stateContext : $module,
url : source,
urlData: { query: searchTerm },
success : function(response) {
searchHTML = module.results.generate(response);
module.search.cache.write(searchTerm, searchHTML);
module.results.add(searchHTML);
},
failure : module.error
},
searchHTML
;
module.search.cancel();
module.debug('Executing search');
$.extend(true, apiSettings, settings.apiSettings);
$.api(apiSettings);
},
cache: {
read: function(name) {
var
cache = $module.data('cache')
;
return (settings.cache && (typeof cache == 'object') && (cache[name] !== undefined) )
? cache[name]
: false
;
},
write: function(name, value) {
var
cache = ($module.data('cache') !== undefined)
? $module.data('cache')
: {}
;
cache[name] = value;
$module
.data('cache', cache)
;
}
}
},
results: {
generate: function(response) {
module.debug('Generating html from response', response);
var
template = settings.templates[settings.type],
html = ''
;
if(($.isPlainObject(response.results) && !$.isEmptyObject(response.results)) || ($.isArray(response.results) && response.results.length > 0) ) {
if(settings.maxResults > 0) {
response.results = $.makeArray(response.results).slice(0, settings.maxResults);
}
if(response.results.length > 0) {
if($.isFunction(template)) {
html = template(response);
}
else {
module.error(error.noTemplate, false);
}
}
}
else {
html = module.message(error.noResults, 'empty');
}
$.proxy(settings.onResults, $module)(response);
return html;
},
add: function(html) {
if(settings.onResultsAdd == 'default' || $.proxy(settings.onResultsAdd, $results)(html) == 'default') {
$results
.html(html)
;
}
module.results.show();
},
show: function() {
if( ($results.filter(':visible').size() === 0) && ($prompt.filter(':focus').size() > 0) && $results.html() !== '') {
$results
.stop()
.fadeIn(200)
;
$.proxy(settings.onResultsOpen, $results)();
}
},
hide: function() {
if($results.filter(':visible').size() > 0) {
$results
.stop()
.fadeOut(200)
;
$.proxy(settings.onResultsClose, $results)();
}
},
select: function(event) {
module.debug('Search result selected');
var
$result = $(this),
$title = $result.find('.title'),
title = $title.html()
;
if(settings.onSelect == 'default' || $.proxy(settings.onSelect, this)(event) == 'default') {
var
$link = $result.find('a[href]').eq(0),
href = $link.attr('href') || false,
target = $link.attr('target') || false
;
module.results.hide();
$prompt
.val(title)
;
if(href) {
if(target == '_blank' || event.ctrlKey) {
window.open(href);
}
else {
window.location.href = (href);
}
}
}
}
},
setting: function(name, value) {
module.debug('Changing setting', name, value);
if(value !== undefined) {
if( $.isPlainObject(name) ) {
$.extend(true, settings, name);
}
else {
settings[name] = value;
}
}
else {
return settings[name];
}
},
internal: function(name, value) {
module.debug('Changing internal', name, value);
if(value !== undefined) {
if( $.isPlainObject(name) ) {
$.extend(true, module, name);
}
else {
module[name] = value;
}
}
else {
return module[name];
}
},
debug: function() {
if(settings.debug) {
if(settings.performance) {
module.performance.log(arguments);
}
else {
module.debug = Function.prototype.bind.call(console.info, console, settings.moduleName + ':');
module.debug.apply(console, arguments);
}
}
},
verbose: function() {
if(settings.verbose && settings.debug) {
if(settings.performance) {
module.performance.log(arguments);
}
else {
module.verbose = Function.prototype.bind.call(console.info, console, settings.moduleName + ':');
module.verbose.apply(console, arguments);
}
}
},
error: function() {
module.error = Function.prototype.bind.call(console.error, console, settings.moduleName + ':');
module.error.apply(console, arguments);
},
performance: {
log: function(message) {
var
currentTime,
executionTime,
previousTime
;
if(settings.performance) {
currentTime = new Date().getTime();
previousTime = time || currentTime;
executionTime = currentTime - previousTime;
time = currentTime;
performance.push({
'Element' : element,
'Name' : message[0],
'Arguments' : [].slice.call(message, 1) || '',
'Execution Time' : executionTime
});
}
clearTimeout(module.performance.timer);
module.performance.timer = setTimeout(module.performance.display, 100);
},
display: function() {
var
title = settings.name + ':',
totalTime = 0
;
time = false;
clearTimeout(module.performance.timer);
$.each(performance, function(index, data) {
totalTime += data['Execution Time'];
});
title += ' ' + totalTime + 'ms';
if(moduleSelector) {
title += ' \'' + moduleSelector + '\'';
}
if($allModules.size() > 1) {
title += ' ' + '(' + $allModules.size() + ')';
}
if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) {
console.groupCollapsed(title);
if(console.table) {
console.table(performance);
}
else {
$.each(performance, function(index, data) {
console.log(data['Name'] + ': ' + data['Execution Time']+'ms');
});
}
console.groupEnd();
}
performance = [];
}
},
invoke: function(query, passedArguments, context) {
var
maxDepth,
found,
response
;
passedArguments = passedArguments || queryArguments;
context = element || context;
if(typeof query == 'string' && instance !== undefined) {
query = query.split(/[\. ]/);
maxDepth = query.length - 1;
$.each(query, function(depth, value) {
var camelCaseValue = (depth != maxDepth)
? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1)
: query
;
if( $.isPlainObject( instance[value] ) && (depth != maxDepth) ) {
instance = instance[value];
}
else if( $.isPlainObject( instance[camelCaseValue] ) && (depth != maxDepth) ) {
instance = instance[camelCaseValue];
}
else if( instance[value] !== undefined ) {
found = instance[value];
return false;
}
else if( instance[camelCaseValue] !== undefined ) {
found = instance[camelCaseValue];
return false;
}
else {
module.error(error.method);
return false;
}
});
}
if ( $.isFunction( found ) ) {
response = found.apply(context, passedArguments);
}
else if(found !== undefined) {
response = found;
}
if($.isArray(invokedResponse)) {
invokedResponse.push(response);
}
else if(typeof invokedResponse == 'string') {
invokedResponse = [invokedResponse, response];
}
else if(response !== undefined) {
invokedResponse = response;
}
return found;
}
};
if(methodInvoked) {
if(instance === undefined) {
module.initialize();
}
module.invoke(query);
}
else {
if(instance !== undefined) {
module.destroy();
}
module.initialize();
}
})
;
return (invokedResponse !== undefined)
? invokedResponse
: this
;
};
$.fn.search.settings = {
name : 'Search Module',
namespace : 'search',
debug : true,
verbose : true,
performance : true,
// onSelect default action is defined in module
onSelect : 'default',
onResultsAdd : 'default',
onSearchQuery : function(){},
onResults : function(response){},
onResultsOpen : function(){},
onResultsClose : function(){},
automatic : 'true',
type : 'simple',
minCharacters : 3,
searchThrottle : 300,
maxResults : 7,
cache : true,
searchFields : [
'title',
'description'
],
// api config
apiSettings: {
},
className: {
active : 'active',
down : 'down',
focus : 'focus',
empty : 'empty',
loading : 'loading'
},
error : {
noResults : 'Your search returned no results',
logging : 'Error in debug logging, exiting.',
noTemplate : 'A valid template name was not specified.',
serverError : 'There was an issue with querying the server.',
method : 'The method you called is not defined.'
},
selector : {
prompt : '.prompt',
searchButton : '.search.button',
results : '.results',
category : '.category',
result : '.result'
},
templates: {
message: function(message, type) {
var
html = ''
;
if(message !== undefined && type !== undefined) {
html += ''
+ '<div class="message ' + type +'">'
;
// message type
if(type == 'empty') {
html += ''
+ '<div class="header">No Results</div class="header">'
+ '<div class="description">' + message + '</div class="description">'
;
}
else {
html += ' <div class="description">' + message + '</div>';
}
html += '</div>';
}
return html;
},
categories: function(response) {
var
html = ''
;
if(response.results !== undefined) {
// each category
$.each(response.results, function(index, category) {
if(category.results !== undefined && category.results.length > 0) {
html += ''
+ '<div class="category">'
+ '<div class="name">' + category.name + '</div>'
;
// each item inside category
$.each(category.results, function(index, result) {
html += '<div class="result">';
html += '<a href="' + result.url + '"></a>';
if(result.image !== undefined) {
html+= ''
+ '<div class="image">'
+ ' <img src="' + result.image + '">'
+ '</div>'
;
}
html += '<div class="info">';
if(result.price !== undefined) {
html+= '<div class="price">' + result.price + '</div>';
}
if(result.title !== undefined) {
html+= '<div class="title">' + result.title + '</div>';
}
if(result.description !== undefined) {
html+= '<div class="description">' + result.description + '</div>';
}
html += ''
+ '</div>'
+ '</div>'
;
});
html += ''
+ '</div>'
;
}
});
if(response.resultPage) {
html += ''
+ '<a href="' + response.resultPage.url + '" class="all">'
+ response.resultPage.text
+ '</a>';
}
return html;
}
return false;
},
simple: function(response) {
var
html = ''
;
if(response.results !== undefined) {
// each result
$.each(response.results, function(index, result) {
html += '<a class="result" href="' + result.url + '">';
if(result.image !== undefined) {
html+= ''
+ '<div class="image">'
+ ' <img src="' + result.image + '">'
+ '</div>'
;
}
html += '<div class="info">';
if(result.price !== undefined) {
html+= '<div class="price">' + result.price + '</div>';
}
if(result.title !== undefined) {
html+= '<div class="title">' + result.title + '</div>';
}
if(result.description !== undefined) {
html+= '<div class="description">' + result.description + '</div>';
}
html += ''
+ '</div>'
+ '</a>'
;
});
if(response.resultPage) {
html += ''
+ '<a href="' + response.resultPage.url + '" class="all">'
+ response.resultPage.text
+ '</a>';
}
return html;
}
return false;
}
}
};
})( jQuery, window , document ); | riaval/Magister | semantic/modules/search.js | JavaScript | apache-2.0 | 24,477 |
/// Copyright (c) 2009 Microsoft Corporation
///
/// Redistribution and use in source and binary forms, with or without modification, are permitted provided
/// that the following conditions are met:
/// * Redistributions of source code must retain the above copyright notice, this list of conditions and
/// the following disclaimer.
/// * Redistributions in binary form must reproduce the above copyright notice, this list of conditions and
/// the following disclaimer in the documentation and/or other materials provided with the distribution.
/// * Neither the name of Microsoft nor the names of its contributors may be used to
/// endorse or promote products derived from this software without specific prior written permission.
///
/// THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR
/// IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
/// FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE
/// FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
/// LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
/// INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
/// OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF
/// ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
ES5Harness.registerTest({
id: "15.4.4.20-1-13",
path: "TestCases/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-13.js",
description: "Array.prototype.filter applied to the JSON object",
test: function testcase() {
function callbackfn(val, idx, obj) {
return '[object JSON]' === Object.prototype.toString.call(JSON);
}
try {
JSON.length = 1;
JSON[0] = 1;
var newArr = Array.prototype.filter.call(JSON, callbackfn);
return newArr[0] === 1;
} finally {
delete JSON.length;
delete JSON[0];
}
},
precondition: function prereq() {
return fnExists(Array.prototype.filter);
}
});
| hnafar/IronJS | Src/Tests/ietestcenter/chapter15/15.4/15.4.4/15.4.4.20/15.4.4.20-1-13.js | JavaScript | apache-2.0 | 2,298 |
'use strict';
angular.module('openshiftConsole')
// The HTML5 `autofocus` attribute does not work reliably with Angular,
// so define our own directive
.directive('takeFocus', function($timeout) {
return {
restrict: 'A',
link: function(scope, element) {
// Add a delay to allow other asynchronous components to load.
$timeout(function() {
$(element).focus();
}, 300);
}
};
})
.directive('selectOnFocus', function() {
return {
restrict: 'A',
link: function($scope, element) {
$(element).focus(function () {
$(this).select();
});
}
};
})
.directive('focusWhen', function($timeout) {
return {
restrict: 'A',
scope: {
trigger: '@focusWhen'
},
link: function(scope, element) {
scope.$watch('trigger', function(value) {
if (value) {
$timeout(function() {
$(element).focus();
});
}
});
}
};
})
.directive('tileClick', function() {
return {
restrict: 'AC',
link: function($scope, element) {
$(element).click(function (evt) {
var t = $(evt.target);
if (t && t.is('a')){
return;
}
$('a.tile-target', element).trigger("click");
});
}
};
})
.directive('clickToReveal', function() {
return {
restrict: 'A',
transclude: true,
scope: {
linkText: "@"
},
templateUrl: 'views/directives/_click-to-reveal.html',
link: function($scope, element) {
$('.reveal-contents-link', element).click(function () {
$(this).hide();
$('.reveal-contents', element).show();
});
}
};
})
.directive('copyToClipboard', function(IS_IOS) {
return {
restrict: 'E',
scope: {
clipboardText: "="
},
templateUrl: 'views/directives/_copy-to-clipboard.html',
controller: function($scope) {
$scope.id = _.uniqueId('clipboardJs');
},
link: function($scope, element) {
if (IS_IOS) {
$scope.hidden = true;
return;
}
var node = $('button', element);
var clipboard = new Clipboard( node.get(0) );
clipboard.on('success', function (e) {
$(e.trigger)
.attr('title', 'Copied!')
.tooltip('fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('fixTitle');
e.clearSelection();
});
clipboard.on('error', function (e) {
var fallbackMsg = /Mac/i.test(navigator.userAgent) ? 'Press \u2318C to copy' : 'Press Ctrl-C to copy';
$(e.trigger)
.attr('title', fallbackMsg)
.tooltip('fixTitle')
.tooltip('show')
.attr('title', 'Copy to clipboard')
.tooltip('fixTitle');
});
element.on('$destroy', function() {
clipboard.destroy();
});
}
};
})
.directive('shortId', function() {
return {
restrict:'E',
scope: {
id: '@'
},
template: '<code class="short-id" title="{{id}}">{{id.substring(0, 6)}}</code>'
};
})
.directive('customIcon', function() {
return {
restrict:'E',
scope: {
resource: '=',
kind: '@',
tag: '=?'
},
controller: function($scope, $filter) {
if ($scope.tag) {
$scope.icon = $filter('imageStreamTagAnnotation')($scope.resource, "icon", $scope.tag);
} else {
$scope.icon = $filter('annotation')($scope.resource, "icon");
}
$scope.isDataIcon = $scope.icon && ($scope.icon.indexOf("data:") === 0);
if (!$scope.isDataIcon) {
// The icon class filter will at worst return the default icon for the given kind
if ($scope.tag) {
$scope.icon = $filter('imageStreamTagIconClass')($scope.resource, $scope.tag);
} else {
$scope.icon = $filter('iconClass')($scope.resource, $scope.kind);
}
}
},
templateUrl: 'views/directives/_custom-icon.html'
};
})
.directive('bottomOfWindow', function() {
return {
restrict:'A',
link: function(scope, element) {
function resized() {
var height = $(window).height() - element[0].getBoundingClientRect().top;
element.css('height', (height - 10) + "px");
}
$(window).on("resize", resized);
resized();
element.on("$destroy", function() {
$(window).off("resize", resized);
});
}
};
}).directive('onEnter', function(){
return function (scope, element, attrs) {
element.bind("keydown keypress", function (event) {
if(event.which === 13) {
scope.$apply(function (){
scope.$eval(attrs.onEnter);
});
event.preventDefault();
}
});
};
});
| tmckayus/oshinko-rest | vendor/github.com/openshift/origin/assets/app/scripts/directives/util.js | JavaScript | apache-2.0 | 5,042 |
'use strict';
let angular = require('angular');
module.exports = angular.module('spinnaker.core.pipeline.config.trigger.jenkins', [
require('../trigger.directive.js'),
require('../../../../ci/jenkins/igor.service.js'),
require('../../pipelineConfigProvider.js'),
])
.config(function(pipelineConfigProvider) {
pipelineConfigProvider.registerTrigger({
label: 'Jenkins',
description: 'Listens to a Jenkins job',
key: 'jenkins',
controller: 'JenkinsTriggerCtrl',
controllerAs: 'jenkinsTriggerCtrl',
templateUrl: require('./jenkinsTrigger.html'),
popoverLabelUrl: require('./jenkinsPopoverLabel.html'),
validators: [
{
type: 'requiredField',
fieldName: 'job',
message: '<strong>Job</strong> is a required field on Jenkins triggers.',
},
],
});
})
.controller('JenkinsTriggerCtrl', function($scope, trigger, igorService) {
$scope.trigger = trigger;
$scope.viewState = {
mastersLoaded: false,
mastersRefreshing: false,
jobsLoaded: false,
jobsRefreshing: false,
};
function initializeMasters() {
igorService.listMasters().then(function (masters) {
$scope.masters = masters;
$scope.viewState.mastersLoaded = true;
$scope.viewState.mastersRefreshing = false;
});
}
this.refreshMasters = function() {
$scope.viewState.mastersRefreshing = true;
initializeMasters();
};
this.refreshJobs = function() {
$scope.viewState.jobsRefreshing = true;
updateJobsList();
};
function updateJobsList() {
if ($scope.trigger && $scope.trigger.master) {
$scope.viewState.jobsLoaded = false;
$scope.jobs = [];
igorService.listJobsForMaster($scope.trigger.master).then(function(jobs) {
$scope.viewState.jobsLoaded = true;
$scope.viewState.jobsRefreshing = false;
$scope.jobs = jobs;
if (jobs.length && $scope.jobs.indexOf($scope.trigger.job) === -1) {
$scope.trigger.job = '';
}
});
}
}
initializeMasters();
$scope.$watch('trigger.master', updateJobsList);
}).name;
| zanthrash/deck-1 | app/scripts/modules/core/pipeline/config/triggers/jenkins/jenkinsTrigger.module.js | JavaScript | apache-2.0 | 2,210 |
/*
* Copyright 2016 IBM Corp.
*
* 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.
*/
(function () {
var JavaWrapper = require(EclairJS_Globals.NAMESPACE + '/JavaWrapper');
var Logger = require(EclairJS_Globals.NAMESPACE + '/Logger');
var Utils = require(EclairJS_Globals.NAMESPACE + '/Utils');
/**
* Class used to solve an optimization problem using Limited-memory BFGS.
* Reference: http://en.wikipedia.org/wiki/Limited-memory_BFGS param: gradient
* Gradient function to be used. param: updater Updater to be used to update weights after every iteration.
* @class
* @memberof module:eclairjs/mllib/optimization
* @constructor
* @param {module:eclairjs/mllib/optimization.Gradient} gradient
* @param {module:eclairjs/mllib/optimization.Updater} updater
*/
var LBFGS = function (gradient, updater) {
this.logger = Logger.getLogger("LBFGS_js");
var jvmObject;
if (gradient instanceof org.apache.spark.mllib.optimization.LBFGS) {
jvmObject = gradient;
} else {
jvmObject = new org.apache.spark.mllib.optimization.LBFGS(Utils.unwrapObject(gradient), Utils.unwrapObject(updater));
}
JavaWrapper.call(this, jvmObject);
};
LBFGS.prototype = Object.create(JavaWrapper.prototype);
LBFGS.prototype.constructor = LBFGS;
/**
* Run Limited-memory BFGS (L-BFGS) in parallel. Averaging the subgradients over different partitions is performed
* using one standard spark map-reduce in each iteration.
* @param {module:eclairjs.RDD} data - - Input data for L-BFGS. RDD of the set of data examples, each of the form (label, [feature values]).
* @param {module:eclairjs/mllib/optimization.Gradient} gradient - - Gradient object (used to compute the gradient of the loss function of one single data example)
* @param {module:eclairjs/mllib/optimization.Updater} updater - - Updater function to actually perform a gradient step in a given direction.
* @param {integer} numCorrections - - The number of corrections used in the L-BFGS update.
* @param {float} convergenceTol - - The convergence tolerance of iterations for L-BFGS which is must be nonnegative.
* Lower values are less tolerant and therefore generally cause more iterations to be run.
* @param {integer} maxNumIterations - - Maximal number of iterations that L-BFGS can be run.
* @param {float} regParam - - Regularization parameter
* @param {module:eclairjs/mllib/linalg.Vector} initialWeights - (undocumented)
* @returns {module:eclairjs.Tuple2} A tuple containing two elements. The first element is a column matrix containing weights for every feature,
* and the second element is an array containing the loss computed for every iteration.
* @param testData
*/
LBFGS.runLBFGS = function (data,gradient,updater,numCorrections,convergenceTol,maxNumIterations,regParam,initialWeights) {
var data_uw = Utils.unwrapObject(data);
var rdd = data_uw.rdd();
var gradient_uw = Utils.unwrapObject(gradient);
var updater_uw = Utils.unwrapObject(updater);
var initialWeights_uw = Utils.unwrapObject(initialWeights);
var javaObject = org.apache.spark.mllib.optimization.LBFGS.runLBFGS(rdd,gradient_uw,updater_uw,numCorrections,convergenceTol,maxNumIterations,regParam,initialWeights_uw);
return Utils.javaToJs(javaObject);
};
/**
* Description copied from interface: {@link Optimizer}
* Solve the provided convex optimization problem.
* @param {module:eclairjs.RDD} data
* @param {module:eclairjs/mllib/linalg.Vector} initialWeights
* @returns {module:eclairjs/mllib/linalg.Vector}
*/
LBFGS.prototype.optimize = function (data,initialWeights) {
var data_uw = Utils.unwrapObject(data);
var initialWeights_uw = Utils.unwrapObject(initialWeights);
var javaObject = this.getJavaObject().optimize(data_uw,initialWeights_uw);
return Utils.javaToJs(javaObject);
};
/**
* Set the number of corrections used in the LBFGS update. Default 10. Values of numCorrections less than 3 are not recommended;
* large values of numCorrections will result in excessive computing time. 3 < numCorrections < 10 is recommended. Restriction: numCorrections > 0
* @param {integer} corrections
* @returns {LBFGS}
*/
LBFGS.prototype.setNumCorrections = function (corrections) {
var javaObject = this.getJavaObject().setNumCorrections(corrections);
return new LBFGS(javaObject);
};
/**
* Set the convergence tolerance of iterations for L-BFGS. Default 0.0001. Smaller value will lead to higher accuracy with the cost of more iterations.
* This value must be nonnegative. Lower convergence values are less tolerant and therefore generally cause more iterations to be run.
* @param {float} tolerance
* @returns {LBFGS}
*/
LBFGS.prototype.setConvergenceTol = function (tolerance) {
var javaObject = this.getJavaObject().setConvergenceTol(tolerance);
return new LBFGS(javaObject);
};
/**
* Set the maximal number of iterations for L-BFGS. Default 100.
* @param {integer} iters
* @returns {LBFGS}
*/
LBFGS.prototype.setNumIterations = function (iters) {
var javaObject = this.getJavaObject().setNumIterations(iters);
return new LBFGS(javaObject);
};
/**
* Set the regularization parameter. Default 0.0.
* @param {float} regParam
* @returns {LBFGS}
*/
LBFGS.prototype.setRegParam = function (regParam) {
var javaObject = this.getJavaObject().setRegParam(regParam);
return new LBFGS(javaObject);
};
/**
* Set the gradient function (of the loss function of one single data example) to be used for L-BFGS.
* @param {module:eclairjs/mllib/optimization.Gradient} gradient
* @returns {LBFGS}
*/
LBFGS.prototype.setGradient = function (gradient) {
var javaObject = this.getJavaObject().setGradient(Utils.unwrapObject(gradient));
return new LBFGS(javaObject);
};
/**
* Set the updater function to actually perform a gradient step in a given direction.
* The updater is responsible to perform the update from the regularization term as well,
* and therefore determines what kind or regularization is used, if any.
* @param {module:eclairjs/mllib/optimization.Updater} updater
* @returns {LBFGS}
*/
LBFGS.prototype.setUpdater = function (updater) {
var javaObject = this.getJavaObject().setUpdater(Utils.unwrapObject(updater));
return new LBFGS(javaObject);
};
module.exports = LBFGS;
})();
| EclairJS/eclairjs-nashorn | src/main/resources/eclairjs/mllib/optimization/LBFGS.js | JavaScript | apache-2.0 | 7,288 |
import * as utils from '../src/utils.js';
import {registerBidder} from '../src/adapters/bidderFactory.js';
const BIDDER_CODE = 'jcm';
const URL = 'https://media.adfrontiers.com/pq'
export const spec = {
code: BIDDER_CODE,
aliases: ['jcarter'],
isBidRequestValid: function(bid) {
return !!(bid.params && bid.params.siteId && bid.bidId);
},
buildRequests: function(validBidRequests) {
var BidRequestStr = {
bids: []
};
for (var i = 0; i < validBidRequests.length; i++) {
var adSizes = '';
var bid = validBidRequests[i];
for (var x = 0; x < bid.sizes.length; x++) {
adSizes += utils.parseGPTSingleSizeArray(bid.sizes[x]);
if (x !== (bid.sizes.length - 1)) {
adSizes += ',';
}
}
BidRequestStr.bids.push({
'callbackId': bid.bidId,
'siteId': bid.params.siteId,
'adSizes': adSizes,
});
}
var JSONStr = JSON.stringify(BidRequestStr);
var dataStr = 't=hb&ver=1.0&compact=true&bids=' + encodeURIComponent(JSONStr);
return {
method: 'GET',
url: URL,
data: dataStr
}
},
interpretResponse: function(serverResponse) {
const bidResponses = [];
serverResponse = serverResponse.body;
// loop through serverResponses
if (serverResponse) {
if (serverResponse.bids) {
var bids = serverResponse.bids;
for (var i = 0; i < bids.length; i++) {
var bid = bids[i];
const bidResponse = {
requestId: bid.callbackId,
bidderCode: spec.code,
cpm: bid.cpm,
width: bid.width,
height: bid.height,
creativeId: bid.creativeId,
currency: 'USD',
netRevenue: bid.netRevenue,
ttl: bid.ttl,
ad: decodeURIComponent(bid.ad.replace(/\+/g, '%20'))
};
bidResponses.push(bidResponse);
};
};
}
return bidResponses;
},
getUserSyncs: function(syncOptions) {
if (syncOptions.iframeEnabled) {
return [{
type: 'iframe',
url: 'https://media.adfrontiers.com/hb/jcm_usersync.html'
}];
}
if (syncOptions.image) {
return [{
type: 'image',
url: 'https://media.adfrontiers.com/hb/jcm_usersync.png'
}];
}
}
}
registerBidder(spec);
| varashellov/Prebid.js | modules/jcmBidAdapter.js | JavaScript | apache-2.0 | 2,345 |
/**
* Copyright 2017 The AMP HTML Authors. 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.
*/
import {BindEvaluator, BindingDef} from '../bind-evaluator';
describe('BindEvaluator', () => {
let evaluator;
beforeEach(() => {
evaluator = new BindEvaluator();
});
it('should allow callers to add bindings multiple times', () => {
expect(evaluator.bindingsForTesting().length).to.equal(0);
evaluator.addBindings([{
tagName: 'P',
property: 'text',
expressionString: 'oneplusone + 2',
}]);
expect(evaluator.bindingsForTesting().length).to.equal(1);
evaluator.addBindings([{
tagName: 'SPAN',
property: 'text',
expressionString: 'oneplusone + 3',
}]);
expect(evaluator.bindingsForTesting().length).to.equal(2);
});
it('should allow callers to remove bindings', () => {
expect(evaluator.bindingsForTesting().length).to.equal(0);
evaluator.addBindings([{
tagName: 'P',
property: 'text',
expressionString: 'oneplusone + 2',
}]);
expect(evaluator.bindingsForTesting().length).to.equal(1);
evaluator.addBindings([{
tagName: 'SPAN',
property: 'text',
expressionString: 'oneplusone + 3',
}]);
expect(evaluator.bindingsForTesting().length).to.equal(2);
evaluator.removeBindingsWithExpressionStrings(['oneplusone + 2']);
expect(evaluator.bindingsForTesting().length).to.equal(1);
evaluator.removeBindingsWithExpressionStrings(['oneplusone + 3']);
expect(evaluator.bindingsForTesting().length).to.equal(0);
});
it('should evaluate expressions given a scope with needed bindings', () => {
const bindingDef = {
tagName: 'P',
property: 'text',
expressionString: 'oneplusone + 2',
};
expect(evaluator.bindingsForTesting().length).to.equal(0);
evaluator.addBindings([{
tagName: 'P',
property: 'text',
expressionString: 'oneplusone + 2',
}]);
expect(evaluator.bindingsForTesting().length).to.equal(1);
const results = evaluator.evaluateBindings({oneplusone: 2});
const evaluated = results['results'];
const errors = results['errors'];
expect(errors['oneplusone + 2']).to.be.undefined;
expect(evaluated['oneplusone + 2']).to.not.be.undefined;
expect(evaluated['oneplusone + 2'] = '4');
});
it('should treat out-of-scope vars as null', () => {
expect(evaluator.bindingsForTesting().length).to.equal(0);
evaluator.addBindings([{
tagName: 'P',
property: 'text',
expressionString: 'outOfScope',
}]);
expect(evaluator.bindingsForTesting().length).to.equal(1);
const results = evaluator.evaluateBindings({});
const evaluated = results['results'];
const errors = results['errors'];
expect(errors['outOfScope']).to.be.undefined;
expect(evaluated['outOfScope']).to.not.be.undefined;
expect(evaluated['outOfScope']).to.be.null;
});
});
| Adtoma/amphtml | extensions/amp-bind/0.1/test/test-bind-evaluator.js | JavaScript | apache-2.0 | 3,455 |
import { expect } from 'chai';
import { spec } from 'modules/sekindoUMBidAdapter';
import { newBidder } from 'src/adapters/bidderFactory';
describe('sekindoUMAdapter', () => {
const adapter = newBidder(spec);
const bannerParams = {
'spaceId': '14071'
};
const videoParams = {
'spaceId': '14071',
'video': {
playerWidth: 300,
playerHeight: 250,
vid_vastType: 2 // optional
}
};
var bidRequests = {
'bidder': 'sekindoUM',
'params': bannerParams,
'adUnitCode': 'adunit-code',
'sizes': [[300, 250], [300, 600]],
'bidId': '30b31c1838de1e',
'bidderRequestId': '22edbae2733bf6',
'auctionId': '1d1a030790a475',
'mediaType': 'banner'
};
describe('inherited functions', () => {
it('exists and is a function', () => {
expect(adapter.callBids).to.exist.and.to.be.a('function');
});
});
describe('isBidRequestValid', () => {
it('should return true when required params found', () => {
bidRequests.mediaType = 'banner';
bidRequests.params = bannerParams;
expect(spec.isBidRequestValid(bidRequests)).to.equal(true);
});
it('should return false when required video params are missing', () => {
bidRequests.mediaType = 'video';
bidRequests.params = bannerParams;
expect(spec.isBidRequestValid(bidRequests)).to.equal(false);
});
it('should return true when required Video params found', () => {
bidRequests.mediaType = 'video';
bidRequests.params = videoParams;
expect(spec.isBidRequestValid(bidRequests)).to.equal(true);
});
});
describe('buildRequests', () => {
it('banner data should be a query string and method = GET', () => {
bidRequests.mediaType = 'banner';
bidRequests.params = bannerParams;
const request = spec.buildRequests([bidRequests]);
expect(request[0].data).to.be.a('string');
expect(request[0].method).to.equal('GET');
});
it('video data should be a query string and method = GET', () => {
bidRequests.mediaType = 'video';
bidRequests.params = videoParams;
const request = spec.buildRequests([bidRequests]);
expect(request[0].data).to.be.a('string');
expect(request[0].method).to.equal('GET');
});
});
describe('interpretResponse', () => {
it('banner should get correct bid response', () => {
let response = {
'headers': function(header) {
return 'dummy header';
},
'body': {'id': '30b31c1838de1e', 'bidderCode': 'sekindoUM', 'cpm': 2.1951, 'width': 300, 'height': 250, 'ad': '<h1>sekindo creative<\/h1>', 'ttl': 36000, 'creativeId': '323774', 'netRevenue': true, 'currency': 'USD'}
};
bidRequests.mediaType = 'banner';
bidRequests.params = bannerParams;
let expectedResponse = [
{
'requestId': '30b31c1838de1e',
'bidderCode': 'sekindoUM',
'cpm': 2.1951,
'width': 300,
'height': 250,
'creativeId': '323774',
'currency': 'USD',
'netRevenue': true,
'ttl': 36000,
'ad': '<h1>sekindo creative</h1>'
}
];
let result = spec.interpretResponse(response, bidRequests);
expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0]));
});
it('vastXml video should get correct bid response', () => {
let response = {
'headers': function(header) {
return 'dummy header';
},
'body': {'id': '30b31c1838de1e', 'bidderCode': 'sekindoUM', 'cpm': 2.1951, 'width': 300, 'height': 250, 'vastXml': '<vast/>', 'ttl': 36000, 'creativeId': '323774', 'netRevenue': true, 'currency': 'USD'}
};
bidRequests.mediaType = 'video';
bidRequests.params = videoParams;
let expectedResponse = [
{
'requestId': '30b31c1838de1e',
'bidderCode': 'sekindoUM',
'cpm': 2.1951,
'width': 300,
'height': 250,
'creativeId': '323774',
'currency': 'USD',
'netRevenue': true,
'ttl': 36000,
'vastXml': '<vast/>'
}
];
let result = spec.interpretResponse(response, bidRequests);
expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0]));
});
it('vastUrl video should get correct bid response', () => {
let response = {
'headers': function(header) {
return 'dummy header';
},
'body': {'id': '30b31c1838de1e', 'bidderCode': 'sekindoUM', 'cpm': 2.1951, 'width': 300, 'height': 250, 'vastUrl': '//vastUrl', 'ttl': 36000, 'creativeId': '323774', 'netRevenue': true, 'currency': 'USD'}
};
bidRequests.mediaType = 'video';
bidRequests.params = videoParams;
let expectedResponse = [
{
'requestId': '30b31c1838de1e',
'bidderCode': 'sekindoUM',
'cpm': 2.1951,
'width': 300,
'height': 250,
'creativeId': '323774',
'currency': 'USD',
'netRevenue': true,
'ttl': 36000,
'vastUrl': '//vastUrl'
}
];
let result = spec.interpretResponse(response, bidRequests);
expect(Object.keys(result[0])).to.deep.equal(Object.keys(expectedResponse[0]));
});
});
});
| SpreeGorilla/Prebid.js | test/spec/modules/sekindoUMBidAdapter_spec.js | JavaScript | apache-2.0 | 5,318 |
Input::
//// [/lib/lib.d.ts]
/// <reference no-default-lib="true"/>
interface Boolean {}
interface Function {}
interface CallableFunction {}
interface NewableFunction {}
interface IArguments {}
interface Number { toExponential: any; }
interface Object {}
interface RegExp {}
interface String { charAt: any; }
interface Array<T> { length: number; [n: number]: T; }
interface ReadonlyArray<T> {}
declare const console: { log(msg: any): void; };
//// [/src/project/src/main.ts]
export const x = 10;
//// [/src/project/tsconfig.json]
{
"compilerOptions": {
"target": "es5",
"module": "commonjs",
"composite": true,
"tsBuildInfoFile": "tsconfig.json.tsbuildinfo"
},
"include": [
"src/**/*.ts"
]
}
Output::
/lib/tsc --composite false --p src/project
[96msrc/project/tsconfig.json[0m:[93m6[0m:[93m9[0m - [91merror[0m[90m TS5069: [0mOption 'tsBuildInfoFile' cannot be specified without specifying option 'incremental' or option 'composite'.
[7m6[0m "tsBuildInfoFile": "tsconfig.json.tsbuildinfo"
[7m [0m [91m ~~~~~~~~~~~~~~~~~[0m
Found 1 error.
exitCode:: ExitStatus.DiagnosticsPresent_OutputsGenerated
//// [/src/project/src/main.js]
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.x = void 0;
exports.x = 10;
| kpreisser/TypeScript | tests/baselines/reference/tsc/composite/initial-build/when-setting-composite-false-on-command-line-but-has-tsbuild-info-in-config.js | JavaScript | apache-2.0 | 1,364 |
enyo.kind({
name: "AllInOneApp",
kind: enyo.HFlexBox,
components: [
{flex: 1, kind: "VFlexBox", style: "background: white; overflow: auto; padding: 10px;", components: [
{name: "docs", onclick: "docClick", requiresDomMousedown: true, allowHtml: true, className: "selectable"}
]}
],
create: function() {
// this maps files to content objects
this.modules = {};
this.inherited(arguments);
this.nextDoc();
},
docsFinished: function() {
var renderedModules = Object.keys(this.modules).map(function(topic) {
return this.modules[topic] ? this.modules[topic].renderContent() : "";
}, this);
this.$.docs.setContent(renderedModules.join("<hr>"));
},
docIndex: 0,
nextDoc: function() {
var m = enyo.modules[this.docIndex++];
if (m) {
this.loadDoc(m.path);
} else {
this.docsFinished();
}
},
loadDoc: function(inUrl) {
enyo.xhrGet({
url: inUrl,
load: enyo.bind(this, "docLoaded", inUrl)
});
},
docLoaded: function(inUrl, d) {
this.addDocs(inUrl, d);
this.nextDoc();
},
addDocs: function(inPath, inCode) {
// remove crufty part of path
var module = enyo.Module.relativizePath(inPath);
this.modules[module] = this.createComponent({kind: "Module", name: module, path: module, source: inCode});
}
});
| enyojs/enyo-1.0 | support/docs/api/source/allInOneApp.js | JavaScript | apache-2.0 | 1,262 |
//This file is automatically rebuilt by the Cesium build process.
/*global define*/
define(function() {
'use strict';
return "//#define SHOW_TILE_BOUNDARIES\n\
\n\
uniform vec4 u_initialColor;\n\
\n\
#if TEXTURE_UNITS > 0\n\
uniform sampler2D u_dayTextures[TEXTURE_UNITS];\n\
uniform vec4 u_dayTextureTranslationAndScale[TEXTURE_UNITS];\n\
\n\
#ifdef APPLY_ALPHA\n\
uniform float u_dayTextureAlpha[TEXTURE_UNITS];\n\
#endif\n\
\n\
#ifdef APPLY_BRIGHTNESS\n\
uniform float u_dayTextureBrightness[TEXTURE_UNITS];\n\
#endif\n\
\n\
#ifdef APPLY_CONTRAST\n\
uniform float u_dayTextureContrast[TEXTURE_UNITS];\n\
#endif\n\
\n\
#ifdef APPLY_HUE\n\
uniform float u_dayTextureHue[TEXTURE_UNITS];\n\
#endif\n\
\n\
#ifdef APPLY_SATURATION\n\
uniform float u_dayTextureSaturation[TEXTURE_UNITS];\n\
#endif\n\
\n\
#ifdef APPLY_GAMMA\n\
uniform float u_dayTextureOneOverGamma[TEXTURE_UNITS];\n\
#endif\n\
\n\
uniform vec4 u_dayTextureTexCoordsRectangle[TEXTURE_UNITS];\n\
#endif\n\
\n\
#ifdef SHOW_REFLECTIVE_OCEAN\n\
uniform sampler2D u_waterMask;\n\
uniform vec4 u_waterMaskTranslationAndScale;\n\
uniform float u_zoomedOutOceanSpecularIntensity;\n\
#endif\n\
\n\
#ifdef SHOW_OCEAN_WAVES\n\
uniform sampler2D u_oceanNormalMap;\n\
#endif\n\
\n\
#ifdef ENABLE_DAYNIGHT_SHADING\n\
uniform vec2 u_lightingFadeDistance;\n\
#endif\n\
\n\
varying vec3 v_positionMC;\n\
varying vec3 v_positionEC;\n\
varying vec2 v_textureCoordinates;\n\
varying vec3 v_normalMC;\n\
varying vec3 v_normalEC;\n\
\n\
#ifdef FOG\n\
varying float v_distance;\n\
varying vec3 v_rayleighColor;\n\
varying vec3 v_mieColor;\n\
#endif\n\
\n\
vec4 sampleAndBlend(\n\
vec4 previousColor,\n\
sampler2D texture,\n\
vec2 tileTextureCoordinates,\n\
vec4 textureCoordinateRectangle,\n\
vec4 textureCoordinateTranslationAndScale,\n\
float textureAlpha,\n\
float textureBrightness,\n\
float textureContrast,\n\
float textureHue,\n\
float textureSaturation,\n\
float textureOneOverGamma)\n\
{\n\
// This crazy step stuff sets the alpha to 0.0 if this following condition is true:\n\
// tileTextureCoordinates.s < textureCoordinateRectangle.s ||\n\
// tileTextureCoordinates.s > textureCoordinateRectangle.p ||\n\
// tileTextureCoordinates.t < textureCoordinateRectangle.t ||\n\
// tileTextureCoordinates.t > textureCoordinateRectangle.q\n\
// In other words, the alpha is zero if the fragment is outside the rectangle\n\
// covered by this texture. Would an actual 'if' yield better performance?\n\
vec2 alphaMultiplier = step(textureCoordinateRectangle.st, tileTextureCoordinates); \n\
textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\n\
\n\
alphaMultiplier = step(vec2(0.0), textureCoordinateRectangle.pq - tileTextureCoordinates);\n\
textureAlpha = textureAlpha * alphaMultiplier.x * alphaMultiplier.y;\n\
\n\
vec2 translation = textureCoordinateTranslationAndScale.xy;\n\
vec2 scale = textureCoordinateTranslationAndScale.zw;\n\
vec2 textureCoordinates = tileTextureCoordinates * scale + translation;\n\
vec4 value = texture2D(texture, textureCoordinates);\n\
vec3 color = value.rgb;\n\
float alpha = value.a;\n\
\n\
#ifdef APPLY_BRIGHTNESS\n\
color = mix(vec3(0.0), color, textureBrightness);\n\
#endif\n\
\n\
#ifdef APPLY_CONTRAST\n\
color = mix(vec3(0.5), color, textureContrast);\n\
#endif\n\
\n\
#ifdef APPLY_HUE\n\
color = czm_hue(color, textureHue);\n\
#endif\n\
\n\
#ifdef APPLY_SATURATION\n\
color = czm_saturation(color, textureSaturation);\n\
#endif\n\
\n\
#ifdef APPLY_GAMMA\n\
color = pow(color, vec3(textureOneOverGamma));\n\
#endif\n\
\n\
float sourceAlpha = alpha * textureAlpha;\n\
float outAlpha = mix(previousColor.a, 1.0, sourceAlpha);\n\
vec3 outColor = mix(previousColor.rgb * previousColor.a, color, sourceAlpha) / outAlpha;\n\
return vec4(outColor, outAlpha);\n\
}\n\
\n\
vec4 computeDayColor(vec4 initialColor, vec2 textureCoordinates);\n\
vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float specularMapValue);\n\
\n\
void main()\n\
{\n\
// The clamp below works around an apparent bug in Chrome Canary v23.0.1241.0\n\
// where the fragment shader sees textures coordinates < 0.0 and > 1.0 for the\n\
// fragments on the edges of tiles even though the vertex shader is outputting\n\
// coordinates strictly in the 0-1 range.\n\
vec4 color = computeDayColor(u_initialColor, clamp(v_textureCoordinates, 0.0, 1.0));\n\
\n\
#ifdef SHOW_TILE_BOUNDARIES\n\
if (v_textureCoordinates.x < (1.0/256.0) || v_textureCoordinates.x > (255.0/256.0) ||\n\
v_textureCoordinates.y < (1.0/256.0) || v_textureCoordinates.y > (255.0/256.0))\n\
{\n\
color = vec4(1.0, 0.0, 0.0, 1.0);\n\
}\n\
#endif\n\
\n\
#if defined(SHOW_REFLECTIVE_OCEAN) || defined(ENABLE_DAYNIGHT_SHADING)\n\
vec3 normalMC = czm_geodeticSurfaceNormal(v_positionMC, vec3(0.0), vec3(1.0)); // normalized surface normal in model coordinates\n\
vec3 normalEC = czm_normal3D * normalMC; // normalized surface normal in eye coordiantes\n\
#endif\n\
\n\
#ifdef SHOW_REFLECTIVE_OCEAN\n\
vec2 waterMaskTranslation = u_waterMaskTranslationAndScale.xy;\n\
vec2 waterMaskScale = u_waterMaskTranslationAndScale.zw;\n\
vec2 waterMaskTextureCoordinates = v_textureCoordinates * waterMaskScale + waterMaskTranslation;\n\
\n\
float mask = texture2D(u_waterMask, waterMaskTextureCoordinates).r;\n\
\n\
if (mask > 0.0)\n\
{\n\
mat3 enuToEye = czm_eastNorthUpToEyeCoordinates(v_positionMC, normalEC);\n\
\n\
vec2 ellipsoidTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC);\n\
vec2 ellipsoidFlippedTextureCoordinates = czm_ellipsoidWgs84TextureCoordinates(normalMC.zyx);\n\
\n\
vec2 textureCoordinates = mix(ellipsoidTextureCoordinates, ellipsoidFlippedTextureCoordinates, czm_morphTime * smoothstep(0.9, 0.95, normalMC.z));\n\
\n\
color = computeWaterColor(v_positionEC, textureCoordinates, enuToEye, color, mask);\n\
}\n\
#endif\n\
\n\
#ifdef ENABLE_VERTEX_LIGHTING\n\
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalize(v_normalEC)) * 0.9 + 0.3, 0.0, 1.0);\n\
vec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n\
#elif defined(ENABLE_DAYNIGHT_SHADING)\n\
float diffuseIntensity = clamp(czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * 5.0 + 0.3, 0.0, 1.0);\n\
float cameraDist = length(czm_view[3]);\n\
float fadeOutDist = u_lightingFadeDistance.x;\n\
float fadeInDist = u_lightingFadeDistance.y;\n\
float t = clamp((cameraDist - fadeOutDist) / (fadeInDist - fadeOutDist), 0.0, 1.0);\n\
diffuseIntensity = mix(1.0, diffuseIntensity, t);\n\
vec4 finalColor = vec4(color.rgb * diffuseIntensity, color.a);\n\
#else\n\
vec4 finalColor = color;\n\
#endif\n\
\n\
\n\
#ifdef FOG\n\
const float fExposure = 2.0;\n\
vec3 fogColor = v_mieColor + finalColor.rgb * v_rayleighColor;\n\
fogColor = vec3(1.0) - exp(-fExposure * fogColor);\n\
\n\
gl_FragColor = vec4(czm_fog(v_distance, finalColor.rgb, fogColor), finalColor.a);\n\
#else\n\
gl_FragColor = finalColor;\n\
#endif\n\
}\n\
\n\
#ifdef SHOW_REFLECTIVE_OCEAN\n\
\n\
float waveFade(float edge0, float edge1, float x)\n\
{\n\
float y = clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n\
return pow(1.0 - y, 5.0);\n\
}\n\
\n\
float linearFade(float edge0, float edge1, float x)\n\
{\n\
return clamp((x - edge0) / (edge1 - edge0), 0.0, 1.0);\n\
}\n\
\n\
// Based on water rendering by Jonas Wagner:\n\
// http://29a.ch/2012/7/19/webgl-terrain-rendering-water-fog\n\
\n\
// low altitude wave settings\n\
const float oceanFrequencyLowAltitude = 825000.0;\n\
const float oceanAnimationSpeedLowAltitude = 0.004;\n\
const float oceanOneOverAmplitudeLowAltitude = 1.0 / 2.0;\n\
const float oceanSpecularIntensity = 0.5;\n\
\n\
// high altitude wave settings\n\
const float oceanFrequencyHighAltitude = 125000.0;\n\
const float oceanAnimationSpeedHighAltitude = 0.008;\n\
const float oceanOneOverAmplitudeHighAltitude = 1.0 / 2.0;\n\
\n\
vec4 computeWaterColor(vec3 positionEyeCoordinates, vec2 textureCoordinates, mat3 enuToEye, vec4 imageryColor, float maskValue)\n\
{\n\
vec3 positionToEyeEC = -positionEyeCoordinates;\n\
float positionToEyeECLength = length(positionToEyeEC);\n\
\n\
// The double normalize below works around a bug in Firefox on Android devices.\n\
vec3 normalizedpositionToEyeEC = normalize(normalize(positionToEyeEC));\n\
\n\
// Fade out the waves as the camera moves far from the surface.\n\
float waveIntensity = waveFade(70000.0, 1000000.0, positionToEyeECLength);\n\
\n\
#ifdef SHOW_OCEAN_WAVES\n\
// high altitude waves\n\
float time = czm_frameNumber * oceanAnimationSpeedHighAltitude;\n\
vec4 noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyHighAltitude, time, 0.0);\n\
vec3 normalTangentSpaceHighAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeHighAltitude);\n\
\n\
// low altitude waves\n\
time = czm_frameNumber * oceanAnimationSpeedLowAltitude;\n\
noise = czm_getWaterNoise(u_oceanNormalMap, textureCoordinates * oceanFrequencyLowAltitude, time, 0.0);\n\
vec3 normalTangentSpaceLowAltitude = vec3(noise.xy, noise.z * oceanOneOverAmplitudeLowAltitude);\n\
\n\
// blend the 2 wave layers based on distance to surface\n\
float highAltitudeFade = linearFade(0.0, 60000.0, positionToEyeECLength);\n\
float lowAltitudeFade = 1.0 - linearFade(20000.0, 60000.0, positionToEyeECLength);\n\
vec3 normalTangentSpace = \n\
(highAltitudeFade * normalTangentSpaceHighAltitude) + \n\
(lowAltitudeFade * normalTangentSpaceLowAltitude);\n\
normalTangentSpace = normalize(normalTangentSpace);\n\
\n\
// fade out the normal perturbation as we move farther from the water surface\n\
normalTangentSpace.xy *= waveIntensity;\n\
normalTangentSpace = normalize(normalTangentSpace);\n\
#else\n\
vec3 normalTangentSpace = vec3(0.0, 0.0, 1.0);\n\
#endif\n\
\n\
vec3 normalEC = enuToEye * normalTangentSpace;\n\
\n\
const vec3 waveHighlightColor = vec3(0.3, 0.45, 0.6);\n\
\n\
// Use diffuse light to highlight the waves\n\
float diffuseIntensity = czm_getLambertDiffuse(czm_sunDirectionEC, normalEC) * maskValue;\n\
vec3 diffuseHighlight = waveHighlightColor * diffuseIntensity;\n\
\n\
#ifdef SHOW_OCEAN_WAVES\n\
// Where diffuse light is low or non-existent, use wave highlights based solely on\n\
// the wave bumpiness and no particular light direction.\n\
float tsPerturbationRatio = normalTangentSpace.z;\n\
vec3 nonDiffuseHighlight = mix(waveHighlightColor * 5.0 * (1.0 - tsPerturbationRatio), vec3(0.0), diffuseIntensity);\n\
#else\n\
vec3 nonDiffuseHighlight = vec3(0.0);\n\
#endif\n\
\n\
// Add specular highlights in 3D, and in all modes when zoomed in.\n\
float specularIntensity = czm_getSpecular(czm_sunDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0) + 0.25 * czm_getSpecular(czm_moonDirectionEC, normalizedpositionToEyeEC, normalEC, 10.0);\n\
float surfaceReflectance = mix(0.0, mix(u_zoomedOutOceanSpecularIntensity, oceanSpecularIntensity, waveIntensity), maskValue);\n\
float specular = specularIntensity * surfaceReflectance;\n\
\n\
return vec4(imageryColor.rgb + diffuseHighlight + nonDiffuseHighlight + specular, imageryColor.a); \n\
}\n\
\n\
#endif // #ifdef SHOW_REFLECTIVE_OCEAN\n\
";
}); | ceos-seo/Data_Cube_v2 | ui/django_site_v2/data_cube_ui/static/assets/js/Cesium-1.23/Source/Shaders/GlobeFS.js | JavaScript | apache-2.0 | 11,686 |
/**
* Copyright 2013-2014, Facebook, Inc.
* All rights reserved.
*
* This source code is licensed under the BSD-style license found in the
* LICENSE file in the root directory of this source tree. An additional grant
* of patent rights can be found in the PATENTS file in the same directory.
*
* @emails react-core
*/
/*jslint evil: true */
'use strict';
var React = require('React');
var ReactTestUtils = require('ReactTestUtils');
var div = React.createFactory('div');
describe('ReactDOM', function() {
// TODO: uncomment this test once we can run in phantom, which
// supports real submit events.
/*
it('should bubble onSubmit', function() {
var count = 0;
var form;
var Parent = React.createClass({
handleSubmit: function() {
count++;
return false;
},
render: function() {
return <Child />;
}
});
var Child = React.createClass({
render: function() {
return <form><input type="submit" value="Submit" /></form>;
},
componentDidMount: function() {
form = this.getDOMNode();
}
});
var instance = ReactTestUtils.renderIntoDocument(<Parent />);
form.submit();
expect(count).toEqual(1);
});
*/
it("allows a DOM element to be used with a string", function() {
var element = React.createElement('div', { className: 'foo' });
var instance = ReactTestUtils.renderIntoDocument(element);
expect(instance.getDOMNode().tagName).toBe('DIV');
});
it("should allow children to be passed as an argument", function() {
var argDiv = ReactTestUtils.renderIntoDocument(
div(null, 'child')
);
var argNode = argDiv.getDOMNode();
expect(argNode.innerHTML).toBe('child');
});
it("should overwrite props.children with children argument", function() {
var conflictDiv = ReactTestUtils.renderIntoDocument(
div({children: 'fakechild'}, 'child')
);
var conflictNode = conflictDiv.getDOMNode();
expect(conflictNode.innerHTML).toBe('child');
});
/**
* We need to make sure that updates occur to the actual node that's in the
* DOM, instead of a stale cache.
*/
it("should purge the DOM cache when removing nodes", function() {
var myDiv = ReactTestUtils.renderIntoDocument(
<div>{{
theDog: <div className="dog" />,
theBird: <div className="bird" />
}}</div>
);
// Warm the cache with theDog
myDiv.setProps({
children: {
theDog: <div className="dogbeforedelete" />,
theBird: <div className="bird" />
}
});
// Remove theDog - this should purge the cache
myDiv.setProps({
children: {
theBird: <div className="bird" />
}
});
// Now, put theDog back. It's now a different DOM node.
myDiv.setProps({
children: {
theDog: <div className="dog" />,
theBird: <div className="bird" />
}
});
// Change the className of theDog. It will use the same element
myDiv.setProps({
children: {
theDog: <div className="bigdog" />,
theBird: <div className="bird" />
}
});
var root = myDiv.getDOMNode();
var dog = root.childNodes[0];
expect(dog.className).toBe('bigdog');
});
it('allow React.DOM factories to be called without warnings', function() {
spyOn(console, 'warn');
var element = React.DOM.div();
expect(element.type).toBe('div');
expect(console.warn.argsForCall.length).toBe(0);
});
});
| spicyj/react | src/browser/__tests__/ReactDOM-test.js | JavaScript | bsd-3-clause | 3,499 |
// This file comes from Box2D-JS, Copyright (c) 2008 ANDO Yasushi.
// The original version is available at http://box2d-js.sourceforge.net/ under the
// zlib/libpng license (see License.txt).
// This version has been modified to make it work with O3D.
o3djs.require('o3djs.util');
o3djs.require('o3djs.math');
o3djs.require('o3djs.rendergraph');
o3djs.require('o3djs.primitives');
o3djs.require('o3djs.picking');
var initId = 0;
var world;
var canvasWidth;
var canvasHeight;
var canvasTop;
var canvasLeft;
function setupWorld(did) {
var transforms = g.client.getObjectsByClassName('o3d.Transform');
for (var tt = 0; tt < transforms.length; ++tt) {
var transform = transforms[tt];
if (transform.clientId != g.root.clientId &&
transform.clientId != g.client.root.clientId) {
transform.parent = null;
g.pack.removeObject(transform);
}
}
if (!did) did = 0;
world = createWorld();
initId += did;
initId %= demos.InitWorlds.length;
if (initId < 0) initId = demos.InitWorlds.length + initId;
demos.InitWorlds[initId](world);
}
function setupNextWorld() { setupWorld(1); }
function setupPrevWorld() { setupWorld(-1); }
function step(elapsedTime) {
// NOTE: changed to use the renderEvent's elapsed time instead of
// javascript timers. The check below makes the physics never do a time step
// slower that 1/30th of a second because collision bugs will happen.
if (elapsedTime > 1 / 30) {
elapsedTime = 1 / 30;
}
var stepping = false;
var timeStep = elapsedTime;
var iteration = 1;
if (world) {
world.Step(timeStep, iteration);
drawWorld(world);
}
}
// When the sample is running in V8, window.g is the browser's global object and
// g is v8's. When the sample is running only in the browser, they are the same
// object.
window.g = {};
// A global object to track stuff with.
var g = {
o3dWidth: -1, // width of our client area
o3dHeight: -1, // height of our client area
materials: [], // all our materials
shapes: [] // all our shapes
};
/**
* Sets up the o3d stuff.
* @param {HTML element} o3dElement The o3d object element.
*/
function setupO3D(o3dElement) {
// Initializes global variables and libraries.
g.o3dElement = o3dElement;
g.o3d = o3dElement.o3d;
g.math = o3djs.math;
g.client = o3dElement.client;
g.mgr = new O3DManager();
// The browser needs to be able to see these globals so that it can
// call unload later.
window.g.client = g.client;
// Get the width and height of our client area.
g.o3dWidth = g.client.width;
g.o3dHeight = g.client.height;
// Creates a pack to manage our resources/assets
g.pack = g.client.createPack();
// Create the render graph for a view.
g.viewInfo = o3djs.rendergraph.createBasicView(
g.pack,
g.client.root,
g.client.renderGraphRoot);
// Create an object to hold global params.
g.globalParamObject = g.pack.createObject('ParamObject');
g.lightWorldPosParam = g.globalParamObject.createParam('lightWorldPos',
'ParamFloat3');
g.lightColorParam = g.globalParamObject.createParam('lightColor',
'ParamFloat4');
g.lightWorldPosParam.value = [200, -1500, -1000];
g.lightColorParam.value = [1, 1, 1.0, 1.0];
// Create Materials.
g.materials = [];
var material = g.pack.createObject('Material');
var effect = g.pack.createObject('Effect');
effect.loadFromFXString(document.getElementById('shader').value);
material.effect = effect;
effect.createUniformParameters(material);
material.getParam('lightWorldPos').bind(g.lightWorldPosParam);
material.getParam('lightColor').bind(g.lightColorParam);
material.getParam('emissive').set(0, 0, 0, 1);
material.getParam('ambient').set(0, 0, 0, 1);
material.getParam('specular').set(1, 1, 1, 1);
material.getParam('shininess').value = 20;
material.drawList = g.viewInfo.performanceDrawList;
g.materials[0] = material;
// Create a kind of checkboardish texture.
var pixels = [];
for (var y = 0; y < 32; ++y) {
for (var x = 0; x < 32; ++x) {
var offset = (y * 32 + x) * 3; // rgb
var u = x / 32 * Math.PI * 0.5;
var v = y / 32 * Math.PI * 0.5;
pixels[offset + 0] = 1;//Math.sin(Math.PI * 32 / x) * 0.2 + 0.8; // red
pixels[offset + 1] = Math.floor(x / 8) % 2 * 0.2 + 0.8; // green
pixels[offset + 2] = Math.floor(y / 8) % 2 * 0.5 + 0.5; // blue
}
}
var texture = g.pack.createTexture2D(32, 32, g.o3d.Texture.XRGB8, 1, false);
texture.set(0, pixels);
var samplerParam = material.getParam('diffuseSampler');
var sampler = g.pack.createObject('Sampler');
samplerParam.value = sampler;
sampler.texture = texture;
// Creates a transform to put our data on.
g.root = g.pack.createObject('Transform');
g.root.parent = g.client.root;
// make a cube for drawing lines
g.lineShape = o3djs.primitives.createRainbowCube(
g.pack,
g.materials[0],
1,
g.math.matrix4.translation([0, 0.5, 0]));
// Set the projection matrix
g.viewInfo.drawContext.projection = g.math.matrix4.perspective(
g.math.degToRad(45),
g.o3dWidth / g.o3dHeight,
0.1,
10000);
// Set the view matrix.
g.viewInfo.drawContext.view = g.math.matrix4.lookAt(
[100, -50, -600],
[250, 80, 0],
[0, -1, 0]);
// Make copies of the view and projection matrix to get fast access to them.
g.projectionMatrix = g.math.matrix4.copy(g.viewInfo.drawContext.projection);
g.viewMatrix = g.math.matrix4.copy(g.viewInfo.drawContext.view);
// Make a bounding box to use for picking.
g.worldBox = g.o3d.BoundingBox([0, -100, 0],
[500, 250, 5]);
// Steps the physics with a time of zero. This is left over from the orignial
// code.
step(0);
g.client.setRenderCallback(o3dOnRender);
}
/**
* Called just before rendering each frame.
* @param {o3d.RenderEvent} renderEvent The render event passed by
* o3d.
*/
function o3dOnRender(renderEvent) {
var newWidth = g.client.width;
var newHeight = g.client.height;
if (newWidth != g.o3dWidth || newHeight != g.o3dHeight) {
g.o3dWidth = newWidth;
g.o3dHeight = newHeight;
// Adjust the projection matrix.
var projectionMatrix = g.math.matrix4.perspective(g.math.degToRad(45),
g.o3dWidth / g.o3dHeight,
0.1,
10000);
g.viewInfo.drawContext.projection = projectionMatrix;
g.projectionMatrix = projectionMatrix;
}
step(renderEvent.elapsedTime);
}
/**
* This is the original setup code modified to work with o3d.
* @param {Array} clientElements Array of o3d objects.
*/
function setupStep2(clientElements) {
var canvasElm = clientElements[0];
canvasElm.id = 'canvas';
setupO3D(canvasElm);
setupWorld();
canvasWidth = g.client.width;
canvasHeight = g.client.height;
canvasTop = parseInt(canvasElm.style.top);
canvasLeft = parseInt(canvasElm.style.left);
o3djs.event.addEventListener(canvasElm, 'mousedown', function(e) {
if (e.shiftKey || e.button == g.o3d.Event.BUTTON_RIGHT) {
setupPrevWorld();
} else {
createNewRandomObject(world, e);
}
});
window.g_finished = true; // for selenium
}
/**
* Creates a new random object using 3d picking to figure out where to start it.
* @param {Object} world A B2World object.
* @param {Object} offset Mouse position relative to o3d area.
*/
function createNewRandomObject(world, offset) {
var worldRay = o3djs.picking.clientPositionToWorldRayEx(
offset.x,
offset.y,
g.viewMatrix,
g.projectionMatrix,
g.o3dWidth,
g.o3dHeight);
var rayIntersectionInfo = g.worldBox.intersectRay(worldRay.near,
worldRay.far);
if (rayIntersectionInfo.intersected) {
var position = rayIntersectionInfo.position;
if (Math.random() < 0.5) {
demos.top.createBall(world, position[0], position[1]);
} else {
createBox(world, position[0], position[1], 10, 10, false);
}
}
}
function init() {
window.g_finished = false; // for selenium.
// Runs the sample in V8. Comment out this line to run it in the browser
// JavaScript engine, for example if you want to debug it. This sample cannot
// currently run in V8 on IE because it access the DOM.
if (!o3djs.base.IsMSIE()) {
o3djs.util.setMainEngine(o3djs.util.Engine.V8);
o3djs.util.addScriptUri('third_party');
o3djs.util.addScriptUri('demos');
o3djs.util.addScriptUri('style');
}
o3djs.util.makeClients(setupStep2);
}
function uninit() {
if (g.client) {
g.client.cleanup();
}
}
| rwatson/chromium-capsicum | o3d/samples/box2d-3d/demos/demos.js | JavaScript | bsd-3-clause | 8,843 |
/*
* Tangram
* Copyright 2009 Baidu Inc. All rights reserved.
*
* path: baidu/dom/hide.js
* author: allstar
* version: 1.1.0
* date: 2009/11/17
*/
///import baidu.dom.g;
/**
* 隐藏目标元素
* @name baidu.dom.hide
* @function
* @grammar baidu.dom.hide(element)
* @param {HTMLElement|string} element 目标元素或目标元素的id
* @shortcut hide
* @meta standard
* @see baidu.dom.show,baidu.dom.toggle
*
* @returns {HTMLElement} 目标元素
*/
baidu.dom.hide = function (element) {
element = baidu.dom.g(element);
element.style.display = "none";
return element;
};
// 声明快捷方法
baidu.hide = baidu.dom.hide;
| BaiduFE/Tangram-base | src/baidu/dom/hide.js | JavaScript | bsd-3-clause | 673 |
var $P = PATHBUBBLES;
$P.HtmlObject = $P.defineClass(
$P.Object2D,
/**
* @classdesc A wrapper for an html object to be displayed on the screen.
* @constructor
* @param {!string} config.parent - the parent tag selector
* @param {!string} config.type - the type of the tag
* @param {object} config.objectConfig - config object to pass to
* the [Object2D]{@link $P.Object2D} constructor.
*/
function HtmlObject(config) {
$P.Object2D.call(this, config.objectConfig);
var id = 'object' + $P.HtmlObject.nextId++;
/** @member {HTMLElement} element - the actual html element */
this.element = document.createElement(config.type);
if (config.before) {
$(config.parent).find(config.before).before(this.element);}
else {
$(config.parent).append(this.element);}
if (config.class) {
this.element.setAttribute('class', config.class);}
this.element.setAttribute('id', id);
this.element.style.position = 'absolute';
if (undefined === config.pointer) {config.pointer = 'none';}
if (null !== config.pointer) {this.element.style['pointer-events'] = config.pointer;}
this.onPositionChanged();
},
{
onAdded: function(parent) {
$P.Object2D.prototype.onAdded.call(this, parent);
$P.state.scene.registerHtmlObject(this);},
onRemoved: function(parent) {
$P.Object2D.prototype.onRemoved.call(this, parent);
$P.state.scene.unregisterHtmlObject(this);},
onDelete: function() {
this.element.parentNode.removeChild(this.element);},
drawSelf: function() {
$(this.element).css({left: (this.x - $P.state.scrollX) + 'px'});},
onPositionChanged: function(dx, dy, dw, dh) {
var e = $(this.element);
$P.Object2D.prototype.onPositionChanged.call(this, dx, dy, dw, dh);
e.css({
left: (this.x -$P.state.scrollX) + 'px',
top: (this.y + $P.state.mainCanvas.getLocation().y) + 'px'});
if (this.w && !this.ignoreW) {e.css('width', this.w + 'px');}
else {e.css('width', 'auto');}
if (this.h && !this.ignoreH) {e.css('height', this.h + 'px');}
else {e.css('height', 'auto');}},
/**
* If the element can receieve pointer events.
* @returns {boolean} - if it is enabled
*/
arePointerEventsEnabled: function() {
return this.element.style['pointer-events'] !== 'none';},
/**
* Set whether or not pointer events are enabled.
* @param {boolean} enabled - if the events are enabled
*/
setPointerEventsEnabled: function(enabled) {
this.element.style['pointer-events'] = enabled ? 'visiblePainted' : 'none';}
});
/** The next id number to use */
$P.HtmlObject.nextId = 0;
| maya70/GraphMirrors | js/HtmlObject.js | JavaScript | bsd-3-clause | 2,563 |
const chai = require('chai');
const expect = chai.expect;
const mock = require('mock-fs');
const fs = require('fs');
const path = require('path');
const makeImportPatch = require('../../../../src/android/patches/0.20/makeImportPatch');
const applyPatch = require('../../../../src/android/patches/applyPatch');
const projectConfig = {
mainFilePath: 'MainActivity.java',
};
const packageImportPath = 'import some.example.project';
describe('makeImportPatch@0.20', () => {
before(() => mock({
'MainActivity.java': fs.readFileSync(
path.join(__dirname, '../../../fixtures/android/0.20/MainActivity.java')
),
}));
it('MainActivity contains a correct 0.20 import patch', () => {
const importPatch = makeImportPatch(packageImportPath);
applyPatch('MainActivity.java', importPatch);
expect(fs.readFileSync('MainActivity.java', 'utf8'))
.to.have.string(importPatch.patch);
});
after(mock.restore);
});
| mrspeaker/react-native | local-cli/rnpm/link/test/android/patches/0.20/makeImportPatch.js | JavaScript | bsd-3-clause | 943 |
var EXPORTED_SYMBOLS = ['GM_openInTab'];
var Cu = Components.utils;
var Ci = Components.interfaces;
var Cc = Components.classes;
Cu.import('resource://gre/modules/Services.jsm');
function GM_openInTab(aFrame, aBaseUrl, aUrl, aOptions) {
var loadInBackground = null;
if ("undefined" != typeof aOptions) {
if ("undefined" == typeof aOptions.active) {
if ("object" != typeof aOptions) {
loadInBackground = !!aOptions;
}
} else {
loadInBackground = !aOptions.active;
}
}
var insertRelatedAfterCurrent = null;
if ("undefined" != typeof aOptions) {
if ("undefined" != typeof aOptions.insert) {
insertRelatedAfterCurrent = !!aOptions.insert;
}
}
// Resolve URL relative to the location of the content window.
var baseUri = Services.io.newURI(aBaseUrl, null, null);
var uri = Services.io.newURI(aUrl, null, baseUri);
aFrame.sendAsyncMessage('greasemonkey:open-in-tab', {
afterCurrent: insertRelatedAfterCurrent,
inBackground: loadInBackground,
url: uri.spec,
});
};
| Martii/greasemonkey | modules/GM_openInTab.js | JavaScript | bsd-3-clause | 1,051 |
'use strict';
/**
*
* Auto load AMD modules through RequireJS
*
* Example:
*
* <div data-clockwork-module="test"></div>
*
* File: /amm/amd_module/release/test.js
* File Contents:
* define(function(){
* return: {
* run: function(){
* console.info('Ran!');
* }
* }
* });
*
* $('body').on('loading.cw.module', function(){ console.info(['loading', arguments]); });
*
* Loader Next Steps:
* 1. Sets data('clockwork-module-loading', '')
* 2. Sets data('clockwork-module-loaded', '')
* 3. Fires event on loaded DOM element .trigger('loaded.cw.module')
* - $('body').on('loaded.cw.module', function(){ console.info(['loaded', arguments]); });
* 4. If there was an error calling run, fires .trigger('run_error.cw.module')
* - $('body').on('run_error.cw.module', function(){ console.info(['error', arguments]); });
*
*/
define(['jquery'], function ($) {
// find components on the page
function run (target, dataSelector, eventNamespace) {
var $target = target ? $(target) : null;
var $containers = target ? $target.find('[data-' + dataSelector + ']') : $('[data-' + dataSelector + ']');
if (target && $target.data(dataSelector)) {
$.merge($containers, $target);
}
// find all of the components on the page and run their module inits
$containers.each(function (i, container) {
var $container = $(container);
var moduleType = $container.data(dataSelector);
if ($container.data(dataSelector + '-loading') || $container.data(dataSelector + '-loaded')) {
return;
} else {
$container.data(dataSelector + '-loading', true);
}
$.each(moduleType.split(' '), function (iType, type) {
$container.trigger('loading.' + eventNamespace, [type, $container]);
require([type], function (module) {
try {
module.run(container);
} catch (err) {
$container.trigger('run_error.' + eventNamespace, [type, $container, err]);
}
$container
.data(dataSelector + '-loading', '')
.data(dataSelector + '-loaded', true)
.trigger('loaded.' + eventNamespace, [type, $container]);
});
});
});
}
var methods = {
setup: function (dataSelector, eventNamespace) {
if (!dataSelector) {
dataSelector = 'clockwork-module';
}
if (!eventNamespace) {
eventNamespace = '.cw.module';
}
$(document).ready(function () {
$('body')
.on('loaded' + eventNamespace, function (evt) {
run(evt.target, dataSelector, eventNamespace);
})
.on('load' + eventNamespace, function (evt) {
run(evt.target, dataSelector, eventNamespace);
});
run(null, dataSelector, eventNamespace);
});
},
run: run
};
return methods;
});
| jdstand/Railay | www/modules/cw-amd/loader.js | JavaScript | mit | 2,759 |
import React from "react"
export default () => (
<div
css={{
display: `flex`,
alignItems: `center`,
justifyContent: `center`,
flexDirection: `column`,
height: `100vh`,
}}
>
<h1>Weeee...</h1>
<img src="https://media1.giphy.com/media/urVO9yrQhKwDK/200.webp#1-grid1" />
</div>
)
| mickeyreiss/gatsby | examples/using-glamor/src/pages/other-page.js | JavaScript | mit | 329 |
import fakeData from './fakeData.js';
import Content from '../../../client/ProfileComponents/Content.jsx';
import ReactTestUtils from 'react-addons-test-utils';
import {expect} from 'chai';
describe('Content', function() {
var {
Simulate,
renderIntoDocument,
findRenderedDOMComponentWithClass,
scryRenderedDOMComponentsWithClass
} = ReactTestUtils;
var content;
beforeEach(function() {
content = renderIntoDocument(
<Content userInfo={fakeData.userInfo} posts={fakeData.posts} friends={fakeData.friends} />
);
});
it('should render a single Posts component', function() {
var post = findRenderedDOMComponentWithClass(profile, 'post-list');
expect(post).to.exist;
});
it('should render a single Friends component', function() {
var friend = findRenderedDOMComponentWithClass(profile, 'friends');
expect(friend).to.exist;
});
}); | anthonypecchillo/bracegirdles | spec/client/ProfileSpecs/ContentSpec.js | JavaScript | mit | 932 |
'use strict';
// MODULES //
var deepSet = require( 'utils-deep-set' ).factory,
deepGet = require( 'utils-deep-get' ).factory,
ENTROPY = require( './number.js' );
// ENTROPY //
/**
* FUNCTION: entropy( arr, path[, sep] )
* Computes the distribution entropy and deep sets the input array.
*
* @param {Array} arrays - input array
* @param {String} path - key path used when deep getting and setting
* @param {String} [sep] - key path separator
* @returns {Array} input array
*/
function entropy( arr, path, sep ) {
var len = arr.length,
opts = {},
dget,
dset,
v, i;
if ( arguments.length > 2 ) {
opts.sep = sep;
}
if ( len ) {
dget = deepGet( path, opts );
dset = deepSet( path, opts );
for ( i = 0; i < len; i++ ) {
v = dget( arr[ i ] );
if ( typeof v === 'number' ) {
dset( arr[i], ENTROPY ( v ) );
} else {
dset( arr[i], NaN );
}
}
}
return arr;
} // end FUNCTION entropy()
// EXPORTS //
module.exports = entropy;
| distributions-io/exponential-entropy | lib/deepset.js | JavaScript | mit | 969 |
/*!
* Bootstrap modal.js v4.6.1 (https://getbootstrap.com/)
* Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors)
* Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE)
*/
(function (global, factory) {
typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('jquery'), require('./util.js')) :
typeof define === 'function' && define.amd ? define(['jquery', './util'], factory) :
(global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.Modal = factory(global.jQuery, global.Util));
})(this, (function ($, Util) { 'use strict';
function _interopDefaultLegacy (e) { return e && typeof e === 'object' && 'default' in e ? e : { 'default': e }; }
var $__default = /*#__PURE__*/_interopDefaultLegacy($);
var Util__default = /*#__PURE__*/_interopDefaultLegacy(Util);
function _defineProperties(target, props) {
for (var i = 0; i < props.length; i++) {
var descriptor = props[i];
descriptor.enumerable = descriptor.enumerable || false;
descriptor.configurable = true;
if ("value" in descriptor) descriptor.writable = true;
Object.defineProperty(target, descriptor.key, descriptor);
}
}
function _createClass(Constructor, protoProps, staticProps) {
if (protoProps) _defineProperties(Constructor.prototype, protoProps);
if (staticProps) _defineProperties(Constructor, staticProps);
return Constructor;
}
function _extends() {
_extends = Object.assign || function (target) {
for (var i = 1; i < arguments.length; i++) {
var source = arguments[i];
for (var key in source) {
if (Object.prototype.hasOwnProperty.call(source, key)) {
target[key] = source[key];
}
}
}
return target;
};
return _extends.apply(this, arguments);
}
/**
* Constants
*/
var NAME = 'modal';
var VERSION = '4.6.1';
var DATA_KEY = 'bs.modal';
var EVENT_KEY = "." + DATA_KEY;
var DATA_API_KEY = '.data-api';
var JQUERY_NO_CONFLICT = $__default["default"].fn[NAME];
var ESCAPE_KEYCODE = 27; // KeyboardEvent.which value for Escape (Esc) key
var CLASS_NAME_SCROLLABLE = 'modal-dialog-scrollable';
var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure';
var CLASS_NAME_BACKDROP = 'modal-backdrop';
var CLASS_NAME_OPEN = 'modal-open';
var CLASS_NAME_FADE = 'fade';
var CLASS_NAME_SHOW = 'show';
var CLASS_NAME_STATIC = 'modal-static';
var EVENT_HIDE = "hide" + EVENT_KEY;
var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY;
var EVENT_HIDDEN = "hidden" + EVENT_KEY;
var EVENT_SHOW = "show" + EVENT_KEY;
var EVENT_SHOWN = "shown" + EVENT_KEY;
var EVENT_FOCUSIN = "focusin" + EVENT_KEY;
var EVENT_RESIZE = "resize" + EVENT_KEY;
var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY;
var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY;
var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY;
var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY;
var EVENT_CLICK_DATA_API = "click" + EVENT_KEY + DATA_API_KEY;
var SELECTOR_DIALOG = '.modal-dialog';
var SELECTOR_MODAL_BODY = '.modal-body';
var SELECTOR_DATA_TOGGLE = '[data-toggle="modal"]';
var SELECTOR_DATA_DISMISS = '[data-dismiss="modal"]';
var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top';
var SELECTOR_STICKY_CONTENT = '.sticky-top';
var Default = {
backdrop: true,
keyboard: true,
focus: true,
show: true
};
var DefaultType = {
backdrop: '(boolean|string)',
keyboard: 'boolean',
focus: 'boolean',
show: 'boolean'
};
/**
* Class definition
*/
var Modal = /*#__PURE__*/function () {
function Modal(element, config) {
this._config = this._getConfig(config);
this._element = element;
this._dialog = element.querySelector(SELECTOR_DIALOG);
this._backdrop = null;
this._isShown = false;
this._isBodyOverflowing = false;
this._ignoreBackdropClick = false;
this._isTransitioning = false;
this._scrollbarWidth = 0;
} // Getters
var _proto = Modal.prototype;
// Public
_proto.toggle = function toggle(relatedTarget) {
return this._isShown ? this.hide() : this.show(relatedTarget);
};
_proto.show = function show(relatedTarget) {
var _this = this;
if (this._isShown || this._isTransitioning) {
return;
}
var showEvent = $__default["default"].Event(EVENT_SHOW, {
relatedTarget: relatedTarget
});
$__default["default"](this._element).trigger(showEvent);
if (showEvent.isDefaultPrevented()) {
return;
}
this._isShown = true;
if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE)) {
this._isTransitioning = true;
}
this._checkScrollbar();
this._setScrollbar();
this._adjustDialog();
this._setEscapeEvent();
this._setResizeEvent();
$__default["default"](this._element).on(EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function (event) {
return _this.hide(event);
});
$__default["default"](this._dialog).on(EVENT_MOUSEDOWN_DISMISS, function () {
$__default["default"](_this._element).one(EVENT_MOUSEUP_DISMISS, function (event) {
if ($__default["default"](event.target).is(_this._element)) {
_this._ignoreBackdropClick = true;
}
});
});
this._showBackdrop(function () {
return _this._showElement(relatedTarget);
});
};
_proto.hide = function hide(event) {
var _this2 = this;
if (event) {
event.preventDefault();
}
if (!this._isShown || this._isTransitioning) {
return;
}
var hideEvent = $__default["default"].Event(EVENT_HIDE);
$__default["default"](this._element).trigger(hideEvent);
if (!this._isShown || hideEvent.isDefaultPrevented()) {
return;
}
this._isShown = false;
var transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE);
if (transition) {
this._isTransitioning = true;
}
this._setEscapeEvent();
this._setResizeEvent();
$__default["default"](document).off(EVENT_FOCUSIN);
$__default["default"](this._element).removeClass(CLASS_NAME_SHOW);
$__default["default"](this._element).off(EVENT_CLICK_DISMISS);
$__default["default"](this._dialog).off(EVENT_MOUSEDOWN_DISMISS);
if (transition) {
var transitionDuration = Util__default["default"].getTransitionDurationFromElement(this._element);
$__default["default"](this._element).one(Util__default["default"].TRANSITION_END, function (event) {
return _this2._hideModal(event);
}).emulateTransitionEnd(transitionDuration);
} else {
this._hideModal();
}
};
_proto.dispose = function dispose() {
[window, this._element, this._dialog].forEach(function (htmlElement) {
return $__default["default"](htmlElement).off(EVENT_KEY);
});
/**
* `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API`
* Do not move `document` in `htmlElements` array
* It will remove `EVENT_CLICK_DATA_API` event that should remain
*/
$__default["default"](document).off(EVENT_FOCUSIN);
$__default["default"].removeData(this._element, DATA_KEY);
this._config = null;
this._element = null;
this._dialog = null;
this._backdrop = null;
this._isShown = null;
this._isBodyOverflowing = null;
this._ignoreBackdropClick = null;
this._isTransitioning = null;
this._scrollbarWidth = null;
};
_proto.handleUpdate = function handleUpdate() {
this._adjustDialog();
} // Private
;
_proto._getConfig = function _getConfig(config) {
config = _extends({}, Default, config);
Util__default["default"].typeCheckConfig(NAME, config, DefaultType);
return config;
};
_proto._triggerBackdropTransition = function _triggerBackdropTransition() {
var _this3 = this;
var hideEventPrevented = $__default["default"].Event(EVENT_HIDE_PREVENTED);
$__default["default"](this._element).trigger(hideEventPrevented);
if (hideEventPrevented.isDefaultPrevented()) {
return;
}
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
if (!isModalOverflowing) {
this._element.style.overflowY = 'hidden';
}
this._element.classList.add(CLASS_NAME_STATIC);
var modalTransitionDuration = Util__default["default"].getTransitionDurationFromElement(this._dialog);
$__default["default"](this._element).off(Util__default["default"].TRANSITION_END);
$__default["default"](this._element).one(Util__default["default"].TRANSITION_END, function () {
_this3._element.classList.remove(CLASS_NAME_STATIC);
if (!isModalOverflowing) {
$__default["default"](_this3._element).one(Util__default["default"].TRANSITION_END, function () {
_this3._element.style.overflowY = '';
}).emulateTransitionEnd(_this3._element, modalTransitionDuration);
}
}).emulateTransitionEnd(modalTransitionDuration);
this._element.focus();
};
_proto._showElement = function _showElement(relatedTarget) {
var _this4 = this;
var transition = $__default["default"](this._element).hasClass(CLASS_NAME_FADE);
var modalBody = this._dialog ? this._dialog.querySelector(SELECTOR_MODAL_BODY) : null;
if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) {
// Don't move modal's DOM position
document.body.appendChild(this._element);
}
this._element.style.display = 'block';
this._element.removeAttribute('aria-hidden');
this._element.setAttribute('aria-modal', true);
this._element.setAttribute('role', 'dialog');
if ($__default["default"](this._dialog).hasClass(CLASS_NAME_SCROLLABLE) && modalBody) {
modalBody.scrollTop = 0;
} else {
this._element.scrollTop = 0;
}
if (transition) {
Util__default["default"].reflow(this._element);
}
$__default["default"](this._element).addClass(CLASS_NAME_SHOW);
if (this._config.focus) {
this._enforceFocus();
}
var shownEvent = $__default["default"].Event(EVENT_SHOWN, {
relatedTarget: relatedTarget
});
var transitionComplete = function transitionComplete() {
if (_this4._config.focus) {
_this4._element.focus();
}
_this4._isTransitioning = false;
$__default["default"](_this4._element).trigger(shownEvent);
};
if (transition) {
var transitionDuration = Util__default["default"].getTransitionDurationFromElement(this._dialog);
$__default["default"](this._dialog).one(Util__default["default"].TRANSITION_END, transitionComplete).emulateTransitionEnd(transitionDuration);
} else {
transitionComplete();
}
};
_proto._enforceFocus = function _enforceFocus() {
var _this5 = this;
$__default["default"](document).off(EVENT_FOCUSIN) // Guard against infinite focus loop
.on(EVENT_FOCUSIN, function (event) {
if (document !== event.target && _this5._element !== event.target && $__default["default"](_this5._element).has(event.target).length === 0) {
_this5._element.focus();
}
});
};
_proto._setEscapeEvent = function _setEscapeEvent() {
var _this6 = this;
if (this._isShown) {
$__default["default"](this._element).on(EVENT_KEYDOWN_DISMISS, function (event) {
if (_this6._config.keyboard && event.which === ESCAPE_KEYCODE) {
event.preventDefault();
_this6.hide();
} else if (!_this6._config.keyboard && event.which === ESCAPE_KEYCODE) {
_this6._triggerBackdropTransition();
}
});
} else if (!this._isShown) {
$__default["default"](this._element).off(EVENT_KEYDOWN_DISMISS);
}
};
_proto._setResizeEvent = function _setResizeEvent() {
var _this7 = this;
if (this._isShown) {
$__default["default"](window).on(EVENT_RESIZE, function (event) {
return _this7.handleUpdate(event);
});
} else {
$__default["default"](window).off(EVENT_RESIZE);
}
};
_proto._hideModal = function _hideModal() {
var _this8 = this;
this._element.style.display = 'none';
this._element.setAttribute('aria-hidden', true);
this._element.removeAttribute('aria-modal');
this._element.removeAttribute('role');
this._isTransitioning = false;
this._showBackdrop(function () {
$__default["default"](document.body).removeClass(CLASS_NAME_OPEN);
_this8._resetAdjustments();
_this8._resetScrollbar();
$__default["default"](_this8._element).trigger(EVENT_HIDDEN);
});
};
_proto._removeBackdrop = function _removeBackdrop() {
if (this._backdrop) {
$__default["default"](this._backdrop).remove();
this._backdrop = null;
}
};
_proto._showBackdrop = function _showBackdrop(callback) {
var _this9 = this;
var animate = $__default["default"](this._element).hasClass(CLASS_NAME_FADE) ? CLASS_NAME_FADE : '';
if (this._isShown && this._config.backdrop) {
this._backdrop = document.createElement('div');
this._backdrop.className = CLASS_NAME_BACKDROP;
if (animate) {
this._backdrop.classList.add(animate);
}
$__default["default"](this._backdrop).appendTo(document.body);
$__default["default"](this._element).on(EVENT_CLICK_DISMISS, function (event) {
if (_this9._ignoreBackdropClick) {
_this9._ignoreBackdropClick = false;
return;
}
if (event.target !== event.currentTarget) {
return;
}
if (_this9._config.backdrop === 'static') {
_this9._triggerBackdropTransition();
} else {
_this9.hide();
}
});
if (animate) {
Util__default["default"].reflow(this._backdrop);
}
$__default["default"](this._backdrop).addClass(CLASS_NAME_SHOW);
if (!callback) {
return;
}
if (!animate) {
callback();
return;
}
var backdropTransitionDuration = Util__default["default"].getTransitionDurationFromElement(this._backdrop);
$__default["default"](this._backdrop).one(Util__default["default"].TRANSITION_END, callback).emulateTransitionEnd(backdropTransitionDuration);
} else if (!this._isShown && this._backdrop) {
$__default["default"](this._backdrop).removeClass(CLASS_NAME_SHOW);
var callbackRemove = function callbackRemove() {
_this9._removeBackdrop();
if (callback) {
callback();
}
};
if ($__default["default"](this._element).hasClass(CLASS_NAME_FADE)) {
var _backdropTransitionDuration = Util__default["default"].getTransitionDurationFromElement(this._backdrop);
$__default["default"](this._backdrop).one(Util__default["default"].TRANSITION_END, callbackRemove).emulateTransitionEnd(_backdropTransitionDuration);
} else {
callbackRemove();
}
} else if (callback) {
callback();
}
} // ----------------------------------------------------------------------
// the following methods are used to handle overflowing modals
// todo (fat): these should probably be refactored out of modal.js
// ----------------------------------------------------------------------
;
_proto._adjustDialog = function _adjustDialog() {
var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight;
if (!this._isBodyOverflowing && isModalOverflowing) {
this._element.style.paddingLeft = this._scrollbarWidth + "px";
}
if (this._isBodyOverflowing && !isModalOverflowing) {
this._element.style.paddingRight = this._scrollbarWidth + "px";
}
};
_proto._resetAdjustments = function _resetAdjustments() {
this._element.style.paddingLeft = '';
this._element.style.paddingRight = '';
};
_proto._checkScrollbar = function _checkScrollbar() {
var rect = document.body.getBoundingClientRect();
this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth;
this._scrollbarWidth = this._getScrollbarWidth();
};
_proto._setScrollbar = function _setScrollbar() {
var _this10 = this;
if (this._isBodyOverflowing) {
// Note: DOMNode.style.paddingRight returns the actual value or '' if not set
// while $(DOMNode).css('padding-right') returns the calculated value or 0 if not set
var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
var stickyContent = [].slice.call(document.querySelectorAll(SELECTOR_STICKY_CONTENT)); // Adjust fixed content padding
$__default["default"](fixedContent).each(function (index, element) {
var actualPadding = element.style.paddingRight;
var calculatedPadding = $__default["default"](element).css('padding-right');
$__default["default"](element).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + _this10._scrollbarWidth + "px");
}); // Adjust sticky content margin
$__default["default"](stickyContent).each(function (index, element) {
var actualMargin = element.style.marginRight;
var calculatedMargin = $__default["default"](element).css('margin-right');
$__default["default"](element).data('margin-right', actualMargin).css('margin-right', parseFloat(calculatedMargin) - _this10._scrollbarWidth + "px");
}); // Adjust body padding
var actualPadding = document.body.style.paddingRight;
var calculatedPadding = $__default["default"](document.body).css('padding-right');
$__default["default"](document.body).data('padding-right', actualPadding).css('padding-right', parseFloat(calculatedPadding) + this._scrollbarWidth + "px");
}
$__default["default"](document.body).addClass(CLASS_NAME_OPEN);
};
_proto._resetScrollbar = function _resetScrollbar() {
// Restore fixed content padding
var fixedContent = [].slice.call(document.querySelectorAll(SELECTOR_FIXED_CONTENT));
$__default["default"](fixedContent).each(function (index, element) {
var padding = $__default["default"](element).data('padding-right');
$__default["default"](element).removeData('padding-right');
element.style.paddingRight = padding ? padding : '';
}); // Restore sticky content
var elements = [].slice.call(document.querySelectorAll("" + SELECTOR_STICKY_CONTENT));
$__default["default"](elements).each(function (index, element) {
var margin = $__default["default"](element).data('margin-right');
if (typeof margin !== 'undefined') {
$__default["default"](element).css('margin-right', margin).removeData('margin-right');
}
}); // Restore body padding
var padding = $__default["default"](document.body).data('padding-right');
$__default["default"](document.body).removeData('padding-right');
document.body.style.paddingRight = padding ? padding : '';
};
_proto._getScrollbarWidth = function _getScrollbarWidth() {
// thx d.walsh
var scrollDiv = document.createElement('div');
scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER;
document.body.appendChild(scrollDiv);
var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth;
document.body.removeChild(scrollDiv);
return scrollbarWidth;
} // Static
;
Modal._jQueryInterface = function _jQueryInterface(config, relatedTarget) {
return this.each(function () {
var data = $__default["default"](this).data(DATA_KEY);
var _config = _extends({}, Default, $__default["default"](this).data(), typeof config === 'object' && config ? config : {});
if (!data) {
data = new Modal(this, _config);
$__default["default"](this).data(DATA_KEY, data);
}
if (typeof config === 'string') {
if (typeof data[config] === 'undefined') {
throw new TypeError("No method named \"" + config + "\"");
}
data[config](relatedTarget);
} else if (_config.show) {
data.show(relatedTarget);
}
});
};
_createClass(Modal, null, [{
key: "VERSION",
get: function get() {
return VERSION;
}
}, {
key: "Default",
get: function get() {
return Default;
}
}]);
return Modal;
}();
/**
* Data API implementation
*/
$__default["default"](document).on(EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) {
var _this11 = this;
var target;
var selector = Util__default["default"].getSelectorFromElement(this);
if (selector) {
target = document.querySelector(selector);
}
var config = $__default["default"](target).data(DATA_KEY) ? 'toggle' : _extends({}, $__default["default"](target).data(), $__default["default"](this).data());
if (this.tagName === 'A' || this.tagName === 'AREA') {
event.preventDefault();
}
var $target = $__default["default"](target).one(EVENT_SHOW, function (showEvent) {
if (showEvent.isDefaultPrevented()) {
// Only register focus restorer if modal will actually get shown
return;
}
$target.one(EVENT_HIDDEN, function () {
if ($__default["default"](_this11).is(':visible')) {
_this11.focus();
}
});
});
Modal._jQueryInterface.call($__default["default"](target), config, this);
});
/**
* jQuery
*/
$__default["default"].fn[NAME] = Modal._jQueryInterface;
$__default["default"].fn[NAME].Constructor = Modal;
$__default["default"].fn[NAME].noConflict = function () {
$__default["default"].fn[NAME] = JQUERY_NO_CONFLICT;
return Modal._jQueryInterface;
};
return Modal;
}));
//# sourceMappingURL=modal.js.map
| venkatramanm/swf-all | swf/src/main/resources/scripts/node_modules/bootstrap/js/dist/modal.js | JavaScript | mit | 22,710 |
var Server = require('../').Server
exports.createServer = function (t, serverType, cb) {
var opts = serverType === 'http' ? { udp: false } : { http: false }
var server = new Server(opts)
server.on('error', function (err) {
t.error(err)
})
server.on('warning', function (err) {
t.error(err)
})
server.listen(0, function () {
var port = server[serverType].address().port
var announceUrl = serverType === 'http'
? 'http://127.0.0.1:' + port + '/announce'
: 'udp://127.0.0.1:' + port
cb(server, announceUrl)
})
}
| precisit/bittorrent-tracker | test/common.js | JavaScript | mit | 562 |
var fs = require('fs');
var path = require('path');
var gulp = require('gulp');
var del = require('del');
var mocha = require('gulp-mocha');
var tar = require('gulp-tar');
var gzip = require('gulp-gzip');
var merge = require('merge2');
var minimist = require('minimist');
var typescript = require('gulp-tsc');
var buildRoot = path.join(__dirname, '_build');
var tarRoot = path.join(__dirname, '_tar');
var packageRoot = path.join(__dirname, '_package');
var testRoot = path.join(__dirname, '_test');
var testPath = path.join(testRoot, 'test');
var buildPath = path.join(buildRoot, 'vsoxplat');
var packagePath = path.join(packageRoot, 'vsoxplat');
var binPath = path.join(buildPath, 'bin');
var agentPath = path.join(buildPath, 'agent');
var handlerPath = path.join(agentPath, 'handlers');
var pluginPath = path.join(agentPath, 'plugins');
var buildPluginPath = path.join(pluginPath, 'build');
var buildPluginLibPath = path.join(buildPluginPath, 'lib');
var scmLibPath = path.join(agentPath, 'scm', 'lib');
var mopts = {
boolean: 'ci',
string: 'suite',
default: { ci: false, suite: '*' }
};
var options = minimist(process.argv.slice(2), mopts);
gulp.task('copy', ['clean'], function () {
return merge([
gulp.src(['package.json']).pipe(gulp.dest(buildPath)),
gulp.src(['src/agent/svc.sh']).pipe(gulp.dest(agentPath)),
gulp.src(['src/agent/plugins/build/lib/askpass.js']).pipe(gulp.dest(buildPluginLibPath)),
gulp.src(['src/agent/scm/lib/credhelper.js']).pipe(gulp.dest(scmLibPath)),
gulp.src(['src/agent/scm/lib/gitw.js']).pipe(gulp.dest(scmLibPath)),
gulp.src(['src/bin/install.js']).pipe(gulp.dest(binPath))
]);
});
gulp.task('build', ['copy'], function () {
return gulp.src(['src/**/*.ts'])
.pipe(typescript())
.pipe(gulp.dest(buildPath));
});
gulp.task('testPrep', function () {
var buildSrc = gulp.src([path.join(buildPath, '**')]);
var testSrcPaths = ['src/test/messages/**',
'src/test/projects/**',
'src/test/tasks/**',
'src/test/scripts/**',
'src/test/testresults/**',
'src/vso-task-lib/**',
'!src/test/definitions'];
return merge([
buildSrc.pipe(gulp.dest(testRoot)),
gulp.src(testSrcPaths, { base: 'src/test' })
.pipe(gulp.dest(testPath))
]);
});
gulp.task('test', ['testPrep'], function () {
var suitePath = path.join(testPath, '*.js');
if (options.suite !== '*') {
suitePath = path.join(testPath, options.suite + '.js');
}
return gulp.src([suitePath])
.pipe(mocha({ reporter: 'spec', ui: 'bdd', useColors: !options.ci }));
});
gulp.task('package', ['build'], function () {
return gulp.src([path.join(buildPath, '**'), 'README.md'])
.pipe(gulp.dest(packagePath));
});
gulp.task('tar', ['package'], function () {
return gulp.src(path.join(packagePath, '**'))
.pipe(tar('vsoxplat.tar'))
.pipe(gzip())
.pipe(gulp.dest(tarRoot));
});
gulp.task('clean', function (done) {
del([buildRoot, tarRoot, packageRoot, testRoot], done);
});
gulp.task('default', ['tar']);
| TwoToneBytes/vso-agent | gulpfile.js | JavaScript | mit | 3,005 |
var log = [];
var a = {
...{ get foo() { log.push(1); } },
get bar() { log.push(2); }
};
expect(log).toEqual([1]);
| kaicataldo/babel | packages/babel-plugin-proposal-object-rest-spread/test/fixtures/object-spread/expression/exec.js | JavaScript | mit | 121 |
var numbro = require('../../numbro'),
language = require('../../languages/sr-Cyrl-RS');
numbro.culture('sr-Cyrl-RS', language);
exports['culture:sr-Cyrl-RS'] = {
setUp: function (callback) {
numbro.culture('sr-Cyrl-RS');
callback();
},
tearDown: function (callback) {
numbro.culture('en-US');
callback();
},
format: function (test) {
test.expect(16);
var tests = [
[10000,'0,0.0000','10.000,0000'],
[10000.23,'0,0','10.000'],
[-10000,'0,0.0','-10.000,0'],
[10000.1234,'0.000','10000,123'],
[-10000,'(0,0.0000)','(10.000,0000)'],
[-0.23,'.00','-,23'],
[-0.23,'(.00)','(,23)'],
[0.23,'0.00000','0,23000'],
[1230974,'0.0a','1,2млн'],
[1460,'0a','1тыс.'],
[-104000,'0a','-104тыс.'],
[1,'0o','1.'],
[52,'0o','52.'],
[23,'0o','23.'],
[100,'0o','100.'],
[1,'0[.]0','1']
];
for (var i = 0; i < tests.length; i++) {
test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]);
}
test.done();
},
currency: function (test) {
test.expect(4);
var tests = [
[1000.234,'$0,0.00','RSD1.000,23'],
[-1000.234,'($0,0)','(RSD1.000)'],
[-1000.234,'$0.00','-RSD1000,23'],
[1230974,'($0.00a)','RSD1,23млн']
];
for (var i = 0; i < tests.length; i++) {
test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]);
}
test.done();
},
percentages: function (test) {
test.expect(4);
var tests = [
[1,'0%','100%'],
[0.974878234,'0.000%','97,488%'],
[-0.43,'0%','-43%'],
[0.43,'(0.000%)','43,000%']
];
for (var i = 0; i < tests.length; i++) {
test.strictEqual(numbro(tests[i][0]).format(tests[i][1]), tests[i][2], tests[i][1]);
}
test.done();
},
unformat: function (test) {
test.expect(9);
var tests = [
['10.000,123',10000.123],
['(0,12345)',-0.12345],
['(RSD1,23млн)',-1230000],
['10тыс.',10000],
['-10тыс.',-10000],
['23e',23],
['RSD10.000,00',10000],
['-76%',-0.76],
['2:23:57',8637]
];
for (var i = 0; i < tests.length; i++) {
test.strictEqual(numbro().unformat(tests[i][0]), tests[i][1], tests[i][0]);
}
test.done();
}
};
| foretagsplatsen/numbro | tests/languages/sr-Cyrl-RS.js | JavaScript | mit | 2,705 |
'use strict';
var $compileMinErr = minErr('$compile');
/**
* @ngdoc service
* @name $templateRequest
*
* @description
* The `$templateRequest` service downloads the provided template using `$http` and, upon success,
* stores the contents inside of `$templateCache`. If the HTTP request fails or the response data
* of the HTTP request is empty, a `$compile` error will be thrown (the exception can be thwarted
* by setting the 2nd parameter of the function to true).
*
* @param {string} tpl The HTTP request template URL
* @param {boolean=} ignoreRequestError Whether or not to ignore the exception when the request fails or the template is empty
*
* @return {Promise} a promise for the the HTTP response data of the given URL.
*
* @property {number} totalPendingRequests total amount of pending template requests being downloaded.
*/
function $TemplateRequestProvider() {
this.$get = ['$templateCache', '$http', '$q', function($templateCache, $http, $q) {
function handleRequestFn(tpl, ignoreRequestError) {
var self = handleRequestFn;
self.totalPendingRequests++;
var transformResponse = $http.defaults && $http.defaults.transformResponse;
if (isArray(transformResponse)) {
transformResponse = transformResponse.filter(function(transformer) {
return transformer !== defaultHttpResponseTransform;
});
} else if (transformResponse === defaultHttpResponseTransform) {
transformResponse = null;
}
var httpOptions = {
cache: $templateCache,
transformResponse: transformResponse
};
return $http.get(tpl, httpOptions)
.then(function(response) {
self.totalPendingRequests--;
return response.data;
}, handleError);
function handleError(resp) {
self.totalPendingRequests--;
if (!ignoreRequestError) {
throw $compileMinErr('tpload', 'Failed to load template: {0}', tpl);
}
return $q.reject(resp);
}
}
handleRequestFn.totalPendingRequests = 0;
return handleRequestFn;
}];
}
| Lucassssss/angular.js | src/ng/templateRequest.js | JavaScript | mit | 2,103 |
import Ember from 'ember';
/*global hljs*/
export default {
name: 'hightlightjs',
initialize: function() {
return Ember.Route.reopen({
renderTemplate: function() {
this._super();
return Ember.run.next(this, function() {
return $('pre code').each(function(i, e) {
return hljs.highlightBlock(e);
});
});
}
});
}
};
| dwmcnelis/zz-form | tests/dummy/app/initializers/hightlightjs.js | JavaScript | mit | 396 |
'use strict';
var addFinalProp = require('../utils').addFinalProp;
var assert = require('../assert');
var Class = require('../imports').SessionId;
var Instance = require('./Instance');
module.exports = SessionId;
function SessionId(opaqueKey) {
if (assert(opaqueKey).extends(Instance).isValid) {
addFinalProp(this, '_instance', opaqueKey._instance);
return this;
}
addFinalProp(this, '_instance', new Class(opaqueKey));
}
SessionId.prototype.equals = function(obj) {
if (obj instanceof SessionId) {
return this._instance.equalsSync(obj._instance);
}
return false;
};
SessionId.prototype.toString = function() {
return this._instance.toStringSync();
}; | i-e-b/webdriver-sync | src/classes/SessionId.js | JavaScript | mit | 679 |
"use strict";
//# sourceMappingURL=Iterable.js.map | riccardomoja/typespirit | tspirit/system/collections/Iterable.js | JavaScript | mit | 50 |
//https://www.hackerrank.com/challenges/fizzbuzz
for(i=0;i++<100;)console.log(i%3?i%5?i:"Buzz":i%5?"Fizz":"FizzBuzz") | hongyegong/hackerrank | miscellaneous/code_golf/fizzbuzz.js | JavaScript | mit | 118 |
var path = require('path');
module.exports = function (config) {
config.set({
browsers: ['PhantomJS',/*'Chrome','Firefox','IE'*/],
coverageReporter: {
reporters: [
{ type: 'html', subdir: 'html' },
{ type: 'lcovonly', subdir: '.' },
{type:'json', subdir: '.'},
],
},
files: [
{
pattern: 'src/__tests__/fixtures/**/*.html',
watched: true,
included: false,
served: true
},
{
pattern: 'src/__tests__/fixtures/*.json',
watched: true,
included: false,
served: true
},
'tests.webpack.js',
],
frameworks: [
'jasmine-jquery',
'jasmine-ajax',
'jasmine'
],
preprocessors: {
'tests.webpack.js': ['webpack', 'sourcemap'],
},
reporters: ['progress', 'coverage'],
webpack: {
cache: true,
devtool: 'inline-source-map',
module: {
preLoaders: [
{
test: /-test\.js$/,
include: /src/,
exclude: /(bower_components)/,
loader: 'babel',
query: {
cacheDirectory: true,
},
},
{
test: /\.js?$/,
include: /src/,
exclude: /(bower_components|__tests__)/,
loader: 'babel-istanbul',
query: {
cacheDirectory: true,
},
},
{
test: /\.css$/,
include: /src/,
loader: "css!postcss"
}
],
loaders: [
{
test: /\.js$/,
include: path.resolve(__dirname, '../src'),
exclude: /(node_modules|__tests__)/,
loader: 'babel',
query: {
cacheDirectory: true,
},
},
],
},
},
});
};
| Lext3r/drilldown-nps-map | karma.config.js | JavaScript | mit | 1,872 |
import { SetAsMasterMessage, RestoreChildLinkMessage } from '../messages';
import sendMessageToDriver from '../send-message-to-driver';
import { CannotSwitchToWindowError } from '../../../../shared/errors';
import { WAIT_FOR_WINDOW_DRIVER_RESPONSE_TIMEOUT } from '../timeouts';
export default class ParentWindowDriverLink {
constructor (currentDriverWindow) {
this.currentDriverWindow = currentDriverWindow;
}
_getTopOpenedWindow (wnd) {
let topOpened = wnd;
while (topOpened.opener)
topOpened = topOpened.opener;
return topOpened.top;
}
_setAsMaster (wnd, finalizePendingCommand) {
const msg = new SetAsMasterMessage(finalizePendingCommand);
return sendMessageToDriver(msg, wnd, WAIT_FOR_WINDOW_DRIVER_RESPONSE_TIMEOUT, CannotSwitchToWindowError);
}
getTopOpenedWindow () {
return this._getTopOpenedWindow(this.currentDriverWindow);
}
setTopOpenedWindowAsMaster () {
const wnd = this._getTopOpenedWindow(this.currentDriverWindow);
return this._setAsMaster(wnd);
}
setParentWindowAsMaster (opts = {}) {
const wnd = this.currentDriverWindow.opener;
return this._setAsMaster(wnd, opts.finalizePendingCommand);
}
async restoreChild (windowId) {
const msg = new RestoreChildLinkMessage(windowId);
const wnd = this.currentDriverWindow.opener;
sendMessageToDriver(msg, wnd, WAIT_FOR_WINDOW_DRIVER_RESPONSE_TIMEOUT, CannotSwitchToWindowError);
}
}
| DevExpress/testcafe | src/client/driver/driver-link/window/parent.js | JavaScript | mit | 1,534 |
// Copyright 2009 the Sputnik authors. All rights reserved.
// This code is governed by the BSD license found in the LICENSE file.
/*---
info: Return the number value for the MV of Result(4)
es5id: 15.1.2.3_A5_T1
description: Checking Infinity
---*/
//CHECK#1
if (parseFloat("Infinity") !== Number.POSITIVE_INFINITY) {
$ERROR('#1: parseFloat("Infinity") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("Infinity")));
}
//CHECK#2
if (parseFloat("+Infinity") !== Number.POSITIVE_INFINITY) {
$ERROR('#2: parseFloat("+Infinity") === Number.POSITIVE_INFINITY. Actual: ' + (parseFloat("+Infinity")));
}
//CHECK#3
if (parseFloat("-Infinity") !== Number.NEGATIVE_INFINITY) {
$ERROR('#3: parseFloat("-Infinity") === Number.NEGATIVE_INFINITY. Actual: ' + (parseFloat("-Infinity")));
}
| PiotrDabkowski/Js2Py | tests/test_cases/built-ins/parseFloat/S15.1.2.3_A5_T1.js | JavaScript | mit | 792 |
import firebase from 'firebase'
import { createUser } from './helpers'
import { FirebaseProviderAuthenticationError } from './errors'
export default function linkWithFacebook(options = {}) {
const scopes = options.scopes || []
const redirect = options.redirect || false
const provider = new firebase.auth.FacebookAuthProvider()
scopes.forEach(scope => {
provider.addScope(scope)
})
return new Promise((resolve, reject) => {
if (redirect) {
firebase.auth().currentUser.linkWithRedirect(provider)
resolve()
} else {
firebase.auth().currentUser.linkWithPopup(provider).then(
result => {
const user = createUser(result.user)
user.accessToken = result.credential.accessToken
resolve({
user: user,
})
},
error => {
reject(new FirebaseProviderAuthenticationError(error))
}
)
}
})
}
| garth/cerebral | packages/node_modules/@cerebral/firebase/src/linkWithFacebook.js | JavaScript | mit | 927 |
/*!
* Bootstrap-select v1.13.8 (https://developer.snapappointments.com/bootstrap-select)
*
* Copyright 2012-2019 SnapAppointments, LLC
* Licensed under MIT (https://github.com/snapappointments/bootstrap-select/blob/master/LICENSE)
*/
(function (root, factory) {
if (root === undefined && window !== undefined) root = window;
if (typeof define === 'function' && define.amd) {
// AMD. Register as an anonymous module unless amdModuleId is set
define(["jquery"], function (a0) {
return (factory(a0));
});
} else if (typeof module === 'object' && module.exports) {
// Node. Does not work with strict CommonJS, but
// only CommonJS-like environments that support module.exports,
// like Node.
module.exports = factory(require("jquery"));
} else {
factory(root["jQuery"]);
}
}(this, function (jQuery) {
(function ($) {
$.fn.selectpicker.defaults = {
noneSelectedText: 'Nič izbranega',
noneResultsText: 'Ni zadetkov za {0}',
countSelectedText: '{0} od {1} izbranih',
maxOptionsText: function (numAll, numGroup) {
return [
'Omejitev dosežena (max. izbranih: {n})',
'Omejitev skupine dosežena (max. izbranih: {n})'
];
},
selectAllText: 'Izberi vse',
deselectAllText: 'Počisti izbor',
multipleSeparator: ', '
};
})(jQuery);
}));
//# sourceMappingURL=defaults-sl_SI.js.map | sufuf3/cdnjs | ajax/libs/bootstrap-select/1.13.8/js/i18n/defaults-sl_SI.js | JavaScript | mit | 1,428 |
var mocha = require('mocha');
var assert = require('assert');
var nconf = require('nconf');
var testingKeys = nconf.env().file({
file: __dirname + '/testing_keys.json'
});
var util = require('util');
var merge = require('merge');
var postmark = require('../lib/postmark/index.js');
describe('client template handling', function() {
this.timeout(10000);
var _client = null;
beforeEach(function() {
_client = new postmark.Client(testingKeys.get('WRITE_TEST_SERVER_TOKEN'));
});
after(function() {
_client.getTemplates(function(err, results) {
while (results.Templates.length > 0) {
var t = results.Templates.pop();
if (/testing-template-node-js/.test(t.Name)) {
_client.deleteTemplate(t.TemplateId);
}
}
});
});
it('should retrieve a list of templates.', function(done) {
_client.getTemplates(done);
});
it('should get a single template.', function(done) {
_client.createTemplate({
name: "testing-template-node-js" + Date(),
textBody: "text body for template {{id}}!",
htmlBody: "{{content}}",
subject: "{{subject}}"
}, function(err, template) {
_client.getTemplate(template.TemplateId, done);
});
});
it('should a update a template.', function(done) {
_client.createTemplate({
name: "testing-template-node-js" + Date(),
textBody: "text body for template {{id}}!",
htmlBody: "{{content}}",
subject: "{{subject}}"
}, function(error, newTemplate) {
_client.editTemplate(newTemplate.TemplateId, {
name: "testing-template-node-js" + Date(),
textBody: "text body for template {{id}}!",
htmlBody: "{{content}}",
subject: "{{subject}}"
}, done);
});
});
it('should a create a template.', function(done) {
_client.createTemplate({
name: "testing-template-node-js" + Date(),
textBody: "text body for template {{id}}!",
htmlBody: "{{content}}",
subject: "{{subject}}"
}, done);
});
it('should a delete a template.', function(done) {
_client.createTemplate({
name: "testing-template-node-js" + Date(),
textBody: "text body for template {{id}}!",
htmlBody: "{{content}}",
subject: "{{subject}}"
}, function(err, template) {
_client.deleteTemplate(template.TemplateId, done);
});
});
it('send an email using a template.', function(done) {
_client.createTemplate({
name: "testing-template-node-js" + Date(),
textBody: "text body for template {{id}}!",
htmlBody: "{{content}}",
subject: "{{subject}}"
}, function(error, t) {
_client.sendEmailWithTemplate({
To: testingKeys.get('WRITE_TEST_EMAIL_RECIPIENT_ADDRESS'),
From: testingKeys.get('WRITE_TEST_SENDER_EMAIL_ADDRESS'),
TemplateId: t.TemplateId,
TemplateModel: {
subject: "Hello from the node.js client! " + new Date(),
content: "Testing templated email"
}
}, done);
});
});
it('should validate template', function(done) {
_client.validateTemplate({
testRenderModel: {
Name: "joe!"
},
textBody: "text body for template {{id}}!",
htmlBody: "{{content}}",
subject: "{{subject}}"
}, done);
})
});
| jedahan/postmark.js | tests/fixture_clientTemplateHandling.js | JavaScript | mit | 3,748 |
/**
* bootstrap-table - An extended Bootstrap table with radio, checkbox, sort, pagination, and other added features. (supports twitter bootstrap v2 and v3).
*
* @version v1.14.1
* @homepage https://bootstrap-table.com
* @author wenzhixin <wenzhixin2010@gmail.com> (http://wenzhixin.net.cn/)
* @license MIT
*/
(function(a,b){if('function'==typeof define&&define.amd)define([],b);else if('undefined'!=typeof exports)b();else{b(),a.bootstrapTableFrBE={exports:{}}.exports}})(this,function(){'use strict';(function(a){a.fn.bootstrapTable.locales['fr-BE']={formatLoadingMessage:function(){return'Chargement en cours...'},formatRecordsPerPage:function(a){return a+' entr\xE9es par page'},formatShowingRows:function(a,b,c){return'Affiche de'+a+' \xE0 '+b+' sur '+c+' lignes'},formatSearch:function(){return'Recherche'},formatNoMatches:function(){return'Pas de fichiers trouv\xE9s'}},a.extend(a.fn.bootstrapTable.defaults,a.fn.bootstrapTable.locales['fr-BE'])})(jQuery)}); | joeyparrish/cdnjs | ajax/libs/bootstrap-table/1.14.1/locale/bootstrap-table-fr-BE.min.js | JavaScript | mit | 980 |
'use strict';
const Npc = require('./Npc');
const BehaviorManager = require('./BehaviorManager');
/**
* Stores definitions of entities to allow for easy creation/cloning
*/
class EntityFactory {
constructor() {
this.entities = new Map();
this.scripts = new BehaviorManager();
}
/**
* Create the key used by the entities and scripts maps
* @param {string} areaName
* @param {number} id
* @return {string}
*/
createEntityRef(area, id) {
return area + ':' + id;
}
/**
* @param {string} entityRef
* @return {Object}
*/
getDefinition(entityRef) {
return this.entities.get(entityRef);
}
/**
* @param {string} entityRef
* @param {Object} def
*/
setDefinition(entityRef, def) {
def.entityReference = entityRef;
this.entities.set(entityRef, def);
}
/**
* Add an event listener from a script to a specific item
* @see BehaviorManager::addListener
* @param {string} entityRef
* @param {string} event
* @param {Function} listener
*/
addScriptListener(entityRef, event, listener) {
this.scripts.addListener(entityRef, event, listener);
}
/**
* Create a new instance of a given npc definition. Resulting npc will not be held or equipped
* and will _not_ have its default contents. If you want it to also populate its default contents
* you must manually call `npc.hydrate(state)`
*
* @param {Area} area
* @param {string} entityRef
* @param {Class} Type Type of entity to instantiate
* @return {type}
*/
createByType(area, entityRef, Type) {
const definition = this.getDefinition(entityRef);
const entity = new Type(area, definition);
if (this.scripts.has(entityRef)) {
this.scripts.get(entityRef).attach(entity);
}
return entity;
}
create() {
throw new Error("No type specified for Entity.create");
}
/**
* Clone an existing item. Resulting item will not be held or equipped and will _not_ have its default contents
* If you want it to also populate its default contents you must manually call `item.hydrate(state)`
* @param {Item} item
* @return {Item}
*/
clone(entity) {
return this.create(entity.area, entity.entityReference);
}
}
module.exports = EntityFactory;
| isaachelbling/gnosis-mud | src/EntityFactory.js | JavaScript | mit | 2,280 |
/**
* @license Highcharts JS v7.0.1 (2018-12-19)
*
* Money Flow Index indicator for Highstock
*
* (c) 2010-2018 Grzegorz Blachliński
*
* License: www.highcharts.com/license
*/
'use strict';
(function (factory) {
if (typeof module === 'object' && module.exports) {
module.exports = factory;
} else if (typeof define === 'function' && define.amd) {
define(function () {
return factory;
});
} else {
factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
}
}(function (Highcharts) {
(function (H) {
/* *
*
* Money Flow Index indicator for Highstock
*
* (c) 2010-2018 Grzegorz Blachliński
*
* License: www.highcharts.com/license
*
* */
var isArray = H.isArray;
// Utils:
function sumArray(array) {
return array.reduce(function (prev, cur) {
return prev + cur;
});
}
function toFixed(a, n) {
return parseFloat(a.toFixed(n));
}
function calculateTypicalPrice(point) {
return (point[1] + point[2] + point[3]) / 3;
}
function calculateRawMoneyFlow(typicalPrice, volume) {
return typicalPrice * volume;
}
/**
* The MFI series type.
*
* @private
* @class
* @name Highcharts.seriesTypes.mfi
*
* @augments Highcharts.Series
*/
H.seriesType('mfi', 'sma',
/**
* Money Flow Index. This series requires `linkedTo` option to be set and
* should be loaded after the `stock/indicators/indicators.js` file.
*
* @sample stock/indicators/mfi
* Money Flow Index Indicator
*
* @extends plotOptions.sma
* @since 6.0.0
* @product highstock
* @optionparent plotOptions.mfi
*/
{
/**
* @excluding index
*/
params: {
period: 14,
/**
* The id of volume series which is mandatory.
* For example using OHLC data, volumeSeriesID='volume' means
* the indicator will be calculated using OHLC and volume values.
*/
volumeSeriesID: 'volume',
/**
* Number of maximum decimals that are used in MFI calculations.
*/
decimals: 4
}
},
/**
* @lends Highcharts.Series#
*/
{
nameBase: 'Money Flow Index',
getValues: function (series, params) {
var period = params.period,
xVal = series.xData,
yVal = series.yData,
yValLen = yVal ? yVal.length : 0,
decimals = params.decimals,
// MFI starts calculations from the second point
// Cause we need to calculate change between two points
range = 1,
volumeSeries = series.chart.get(params.volumeSeriesID),
yValVolume = volumeSeries && volumeSeries.yData,
MFI = [],
isUp = false,
xData = [],
yData = [],
positiveMoneyFlow = [],
negativeMoneyFlow = [],
newTypicalPrice,
oldTypicalPrice,
rawMoneyFlow,
negativeMoneyFlowSum,
positiveMoneyFlowSum,
moneyFlowRatio,
MFIPoint, i;
if (!volumeSeries) {
return H.error(
'Series ' +
params.volumeSeriesID +
' not found! Check `volumeSeriesID`.',
true,
series.chart
);
}
// MFI requires high low and close values
if (
(xVal.length <= period) || !isArray(yVal[0]) ||
yVal[0].length !== 4 ||
!yValVolume
) {
return false;
}
// Calculate first typical price
newTypicalPrice = calculateTypicalPrice(yVal[range]);
// Accumulate first N-points
while (range < period + 1) {
// Calculate if up or down
oldTypicalPrice = newTypicalPrice;
newTypicalPrice = calculateTypicalPrice(yVal[range]);
isUp = newTypicalPrice >= oldTypicalPrice ? true : false;
// Calculate raw money flow
rawMoneyFlow = calculateRawMoneyFlow(
newTypicalPrice,
yValVolume[range]
);
// Add to array
positiveMoneyFlow.push(isUp ? rawMoneyFlow : 0);
negativeMoneyFlow.push(isUp ? 0 : rawMoneyFlow);
range++;
}
for (i = range - 1; i < yValLen; i++) {
if (i > range - 1) {
// Remove first point from array
positiveMoneyFlow.shift();
negativeMoneyFlow.shift();
// Calculate if up or down
oldTypicalPrice = newTypicalPrice;
newTypicalPrice = calculateTypicalPrice(yVal[i]);
isUp = newTypicalPrice > oldTypicalPrice ? true : false;
// Calculate raw money flow
rawMoneyFlow = calculateRawMoneyFlow(
newTypicalPrice,
yValVolume[i]
);
// Add to array
positiveMoneyFlow.push(isUp ? rawMoneyFlow : 0);
negativeMoneyFlow.push(isUp ? 0 : rawMoneyFlow);
}
// Calculate sum of negative and positive money flow:
negativeMoneyFlowSum = sumArray(negativeMoneyFlow);
positiveMoneyFlowSum = sumArray(positiveMoneyFlow);
moneyFlowRatio = positiveMoneyFlowSum / negativeMoneyFlowSum;
MFIPoint = toFixed(
100 - (100 / (1 + moneyFlowRatio)),
decimals
);
MFI.push([xVal[i], MFIPoint]);
xData.push(xVal[i]);
yData.push(MFIPoint);
}
return {
values: MFI,
xData: xData,
yData: yData
};
}
}
);
/**
* A `MFI` series. If the [type](#series.mfi.type) option is not specified, it
* is inherited from [chart.type](#chart.type).
*
* @extends series,plotOptions.mfi
* @since 6.0.0
* @excluding dataParser, dataURL
* @product highstock
* @apioption series.mfi
*/
}(Highcharts));
return (function () {
}());
})); | joeyparrish/cdnjs | ajax/libs/highcharts/7.0.1/indicators/mfi.src.js | JavaScript | mit | 6,895 |
/*
* GoJS v2.0.0-beta12 JavaScript Library for HTML Diagrams
* Northwoods Software, https://www.nwoods.com/
* GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation.
* Copyright (C) 1998-2019 by Northwoods Software Corporation. All Rights Reserved.
* THIS SOFTWARE IS LICENSED. THE LICENSE AGREEMENT IS AT: https://gojs.net/2.0.0-beta12/license.html.
*/
(function() { var t;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ba(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}function ca(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var da="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},ha;
if("function"==typeof Object.setPrototypeOf)ha=Object.setPrototypeOf;else{var ka;a:{var la={a:!0},ma={};try{ma.__proto__=la;ka=ma.a;break a}catch(a){}ka=!1}ha=ka?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var na=ha;
function oa(a,b){a.prototype=da(b.prototype);a.prototype.constructor=a;if(na)na(a,b);else for(var c in b)if("prototype"!=c)if(Object.defineProperties){var d=Object.getOwnPropertyDescriptor(b,c);d&&Object.defineProperty(a,c,d)}else a[c]=b[c];a.Zz=b.prototype}var pa="undefined"!=typeof window&&window===self?self:"undefined"!=typeof global&&null!=global?global:self,qa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)};
function ra(a){if(a){for(var b=pa,c=["Array","prototype","fill"],d=0;d<c.length-1;d++){var e=c[d];e in b||(b[e]={});b=b[e]}c=c[c.length-1];d=b[c];a=a(d);a!=d&&null!=a&&qa(b,c,{writable:!0,value:a})}}ra(function(a){return a?a:function(a,c,d){var b=this.length||0;0>c&&(c=Math.max(0,b+c));if(null==d||d>b)d=b;d=Number(d);0>d&&(d=Math.max(0,b+d));for(c=Number(c||0);c<d;c++)this[c]=a;return this}});var w="object"===typeof self&&self.self===self&&self||"object"===typeof global&&global.global===global&&global||"object"===typeof window&&window.window===window&&window||{};void 0===w.requestAnimationFrame&&(w.requestAnimationFrame=w.setImmediate);function sa(){}function ta(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&w.clearTimeout(c);c=ua(function(){c=-1;a.apply(d,e)},b)}}function ua(a,b){return w.setTimeout(a,b)}function va(a){return w.document.createElement(a)}
function A(a){throw Error(a);}function wa(a,b){a="The object is frozen, so its properties cannot be set: "+a.toString();void 0!==b&&(a+=" to value: "+b);A(a)}function xa(a,b,c,d){c=null===c?"*":"string"===typeof c?c:"function"===typeof c&&"string"===typeof c.className?c.className:"";void 0!==d&&(c+="."+d);A(c+" is not in the range "+b+": "+a)}function ya(a){w.console&&w.console.log(a)}
function za(){w.console&&w.console.log("Warning: List/Map/Set constructors no longer take an argument that enforces type.Instead they take an optional collection of Values to add to the collection. See 2.0 changelog for details.")}function Aa(a){return"object"===typeof a&&null!==a}function Da(a){return Array.isArray(a)||w.NodeList&&a instanceof w.NodeList||w.HTMLCollection&&a instanceof w.HTMLCollection}function Fa(a){return Array.prototype.slice.call(a)}
function Ha(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):A("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)}function Ja(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):A("Cannot remove an object from an HTMLCollection or NodeList at "+b)}function Ka(){var a=La.pop();return void 0===a?[]:a}function Oa(a){a.length=0;La.push(a)}
function Pa(a){if("function"===typeof a){if(a.className)return a.className;if(a.name)return a.name;var b=a.toString();b=b.substring(9,b.indexOf("(")).trim();if(""!==b)return a._className=b}else if(Aa(a)&&a.constructor)return Pa(a.constructor);return typeof a}
function Qa(a){var b=a;Aa(a)&&(a.text?b=a.text:a.name?b=a.name:void 0!==a.key?b=a.key:void 0!==a.id?b=a.id:a.constructor===Object&&(a.Text?b=a.Text:a.Name?b=a.Name:void 0!==a.Key?b=a.Key:void 0!==a.Id?b=a.Id:void 0!==a.ID&&(b=a.ID)));return void 0===b?"undefined":null===b?"null":b.toString()}function Sa(a,b){if(a.hasOwnProperty(b))return!0;for(a=Object.getPrototypeOf(a);a&&a!==Function;){if(a.hasOwnProperty(b))return!0;var c=a.Pz;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1}
function Ta(a,b,c){Object.defineProperty(Ua.prototype,a,{get:b,set:c})}function Va(){var a=Xa;if(0===a.length)for(var b=w.document.getElementsByTagName("canvas"),c=b.length,d=0;d<c;d++){var e=b[d];e.parentElement&&e.parentElement.F&&a.push(e.parentElement.F)}return a}
function ab(a){for(var b=[],c=0;256>c;c++)b["0123456789abcdef".charAt(c>>4)+"0123456789abcdef".charAt(c&15)]=String.fromCharCode(c);a.length%2&&(a="0"+a);c=[];for(var d=0,e=0;e<a.length;e+=2)c[d++]=b[a.substr(e,2)];a=c.join("");a=""===a?"0":a;b=[];for(c=0;256>c;c++)b[c]=c;for(c=d=0;256>c;c++)d=(d+b[c]+119)%256,e=b[c],b[c]=b[d],b[d]=e;d=c=0;for(var f="",g=0;g<a.length;g++)c=(c+1)%256,d=(d+b[c])%256,e=b[c],b[c]=b[d],b[d]=e,f+=String.fromCharCode(a.charCodeAt(g)^b[(b[c]+b[d])%256]);return f}
var bb=void 0!==w.navigator&&0<w.navigator.userAgent.indexOf("MSIE 9.0"),cb=void 0!==w.navigator&&0<w.navigator.userAgent.indexOf("MSIE 10.0"),fb=void 0!==w.navigator&&0<w.navigator.userAgent.indexOf("Trident/7"),gb=void 0!==w.navigator&&0<w.navigator.userAgent.indexOf("Edge/"),ib=void 0!==w.navigator&&void 0!==w.navigator.platform&&0<=w.navigator.platform.toUpperCase().indexOf("MAC"),lb=void 0!==w.navigator&&void 0!==w.navigator.platform&&null!==w.navigator.platform.match(/(iPhone|iPod|iPad)/i),
mb=!1,qb=null,sb=null,La=[];Object.freeze([]);var Xa=[];sa.className="Util";sa.Dx="32ab5ff3b26f42dc0ed90f224c2913b5";sa.adym="gojs.net";sa.vfo="28e646fdb37b1981578a0e21";sa.className="Util";function D(a,b,c){tb(this);this.l=a;this.Ta=b;this.u=c}D.prototype.toString=function(){return"EnumValue."+this.Ta};function ub(a,b){return void 0===b||null===b||""===b?null:a[b]}
pa.Object.defineProperties(D.prototype,{classType:{get:function(){return this.l}},name:{get:function(){return this.Ta}},value:{get:function(){return this.u}}});D.className="EnumValue";function xb(){this.hw=[]}xb.prototype.toString=function(){return this.hw.join("")};xb.prototype.add=function(a){""!==a&&this.hw.push(a)};xb.className="StringBuilder";function yb(){}yb.className="PropertyCollection";
function zb(){}zb.prototype.reset=function(){};zb.prototype.next=function(){return!1};zb.prototype.fd=function(){return!1};zb.prototype.first=function(){return null};zb.prototype.any=function(){return!1};zb.prototype.all=function(){return!0};zb.prototype.each=function(){return this};zb.prototype.map=function(){return this};zb.prototype.filter=function(){return this};zb.prototype.yd=function(){};zb.prototype.toString=function(){return"EmptyIterator"};
pa.Object.defineProperties(zb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 0}}});zb.prototype.first=zb.prototype.first;zb.prototype.hasNext=zb.prototype.fd;zb.prototype.next=zb.prototype.next;zb.prototype.reset=zb.prototype.reset;var Ab=null;zb.className="EmptyIterator";Ab=new zb;function Bb(a){this.key=-1;this.value=a}Bb.prototype.reset=function(){this.key=-1};
Bb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};Bb.prototype.fd=function(){return this.next()};Bb.prototype.first=function(){this.key=0;return this.value};Bb.prototype.any=function(a){this.key=-1;return a(this.value)};Bb.prototype.all=function(a){this.key=-1;return a(this.value)};Bb.prototype.each=function(a){this.key=-1;a(this.value);return this};Bb.prototype.map=function(a){return new Bb(a(this.value))};
Bb.prototype.filter=function(a){return a(this.value)?new Bb(this.value):Ab};Bb.prototype.yd=function(){this.value=null};Bb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};pa.Object.defineProperties(Bb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return 1}}});Bb.prototype.first=Bb.prototype.first;Bb.prototype.hasNext=Bb.prototype.fd;Bb.prototype.next=Bb.prototype.next;
Bb.prototype.reset=Bb.prototype.reset;Bb.className="SingletonIterator";function Cb(a){this.rb=a;this.Ve=null;a.Ia=null;this.la=a.Ba;this.Qa=-1}Cb.prototype.reset=function(){var a=this.rb;a.Ia=null;this.la=a.Ba;this.Qa=-1};Cb.prototype.next=function(){var a=this.rb;if(a.Ba!==this.la&&0>this.key)return!1;a=a.j;var b=a.length,c=++this.Qa,d=this.Ve;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Qa=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.yd()}return!1};
Cb.prototype.fd=function(){return this.next()};Cb.prototype.first=function(){var a=this.rb;this.la=a.Ba;this.Qa=0;a=a.j;var b=a.length,c=this.Ve;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Qa=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};Cb.prototype.any=function(a){var b=this.rb;b.Ia=null;this.Qa=-1;b=b.j;for(var c=b.length,d=this.Ve,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&a(f))return!0}return!1};
Cb.prototype.all=function(a){var b=this.rb;b.Ia=null;this.Qa=-1;b=b.j;for(var c=b.length,d=this.Ve,e=0;e<c;e++){var f=b[e];if((null===d||d(f))&&!a(f))return!1}return!0};Cb.prototype.each=function(a){var b=this.rb;b.Ia=null;this.Qa=-1;b=b.j;for(var c=b.length,d=this.Ve,e=0;e<c;e++){var f=b[e];(null===d||d(f))&&a(f)}return this};
Cb.prototype.map=function(a){var b=this.rb;b.Ia=null;this.Qa=-1;var c=[];b=b.j;for(var d=b.length,e=this.Ve,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&c.push(a(g))}a=new E;a.j=c;a.lb();return a.iterator};Cb.prototype.filter=function(a){var b=this.rb;b.Ia=null;this.Qa=-1;var c=[];b=b.j;for(var d=b.length,e=this.Ve,f=0;f<d;f++){var g=b[f];(null===e||e(g))&&a(g)&&c.push(g)}a=new E;a.j=c;a.lb();return a.iterator};
Cb.prototype.yd=function(){this.key=-1;this.value=null;this.la=-1;this.Ve=null;this.rb.Ia=this};Cb.prototype.toString=function(){return"ListIterator@"+this.Qa+"/"+this.rb.count};
pa.Object.defineProperties(Cb.prototype,{iterator:{get:function(){return this}},predicate:{get:function(){return this.Ve},set:function(a){this.Ve=a}},count:{get:function(){var a=this.Ve;if(null!==a){for(var b=0,c=this.rb.j,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.rb.j.length}}});Cb.prototype.first=Cb.prototype.first;Cb.prototype.hasNext=Cb.prototype.fd;Cb.prototype.next=Cb.prototype.next;
Cb.prototype.reset=Cb.prototype.reset;Cb.className="ListIterator";function Db(a){this.rb=a;a.Ng=null;this.la=a.Ba;this.Qa=a.j.length}Db.prototype.reset=function(){var a=this.rb;a.Ng=null;this.la=a.Ba;this.Qa=a.j.length};Db.prototype.next=function(){var a=this.rb;if(a.Ba!==this.la&&0>this.key)return!1;var b=--this.Qa;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.yd();return!1};Db.prototype.fd=function(){return this.next()};
Db.prototype.first=function(){var a=this.rb;this.la=a.Ba;var b=a.j;this.Qa=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};Db.prototype.any=function(a){var b=this.rb;b.Ng=null;b=b.j;var c=b.length;this.Qa=c;for(--c;0<=c;c--)if(a(b[c]))return!0;return!1};Db.prototype.all=function(a){var b=this.rb;b.Ng=null;b=b.j;var c=b.length;this.Qa=c;for(--c;0<=c;c--)if(!a(b[c]))return!1;return!0};
Db.prototype.each=function(a){var b=this.rb;b.Ng=null;b=b.j;var c=b.length;this.Qa=c;for(--c;0<=c;c--)a(b[c]);return this};Db.prototype.map=function(a){var b=this.rb;b.Ng=null;var c=[];b=b.j;var d=b.length;this.Qa=d;for(--d;0<=d;d--)c.push(a(b[d]));a=new E;a.j=c;a.lb();return a.iterator};Db.prototype.filter=function(a){var b=this.rb;b.Ng=null;var c=[];b=b.j;var d=b.length;this.Qa=d;for(--d;0<=d;d--){var e=b[d];a(e)&&c.push(e)}a=new E;a.j=c;a.lb();return a.iterator};
Db.prototype.yd=function(){this.key=-1;this.value=null;this.la=-1;this.rb.Ng=this};Db.prototype.toString=function(){return"ListIteratorBackwards("+this.Qa+"/"+this.rb.count+")"};pa.Object.defineProperties(Db.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.rb.j.length}}});Db.prototype.first=Db.prototype.first;Db.prototype.hasNext=Db.prototype.fd;Db.prototype.next=Db.prototype.next;Db.prototype.reset=Db.prototype.reset;
Db.className="ListIteratorBackwards";function E(a){tb(this);this.v=!1;this.j=[];this.Ba=0;this.Ng=this.Ia=null;void 0!==a&&("function"===typeof a||"string"===typeof a?za():this.addAll(a))}t=E.prototype;t.lb=function(){var a=this.Ba;a++;999999999<a&&(a=0);this.Ba=a};t.freeze=function(){this.v=!0;return this};t.ha=function(){this.v=!1;return this};t.toString=function(){return"List()#"+Fb(this)};t.add=function(a){if(null===a)return this;this.v&&wa(this,a);this.j.push(a);this.lb();return this};
t.push=function(a){this.add(a)};t.addAll=function(a){if(null===a)return this;this.v&&wa(this);var b=this.j;if(Da(a))for(var c=a.length,d=0;d<c;d++)b.push(a[d]);else for(a=a.iterator;a.next();)b.push(a.value);this.lb();return this};t.clear=function(){this.v&&wa(this);this.j.length=0;this.lb()};t.contains=function(a){return null===a?!1:-1!==this.j.indexOf(a)};t.has=function(a){return this.contains(a)};t.indexOf=function(a){return null===a?-1:this.j.indexOf(a)};
t.N=function(a){var b=this.j;(0>a||a>=b.length)&&xa(a,"0 <= i < length",E,"elt:i");return b[a]};t.get=function(a){return this.N(a)};t.jd=function(a,b){var c=this.j;(0>a||a>=c.length)&&xa(a,"0 <= i < length",E,"setElt:i");this.v&&wa(this,a);c[a]=b};t.set=function(a,b){this.jd(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.dc=function(){var a=this.j,b=a.length;return 0<b?a[b-1]:null};t.pop=function(){this.v&&wa(this);var a=this.j;return 0<a.length?a.pop():null};
E.prototype.any=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(a(b[d]))return!0;return!1};E.prototype.all=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)if(!a(b[d]))return!1;return!0};E.prototype.each=function(a){for(var b=this.j,c=b.length,d=0;d<c;d++)a(b[d]);return this};E.prototype.map=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++)c.push(a(d[f]));b.j=c;b.lb();return b};
E.prototype.filter=function(a){for(var b=new E,c=[],d=this.j,e=d.length,f=0;f<e;f++){var g=d[f];a(g)&&c.push(g)}b.j=c;b.lb();return b};t=E.prototype;t.Jb=function(a,b){0>a&&xa(a,">= 0",E,"insertAt:i");this.v&&wa(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.lb()};t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=this.j;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.lb();return!0};t.delete=function(a){return this.remove(a)};
t.nb=function(a){var b=this.j;(0>a||a>=b.length)&&xa(a,"0 <= i < length",E,"removeAt:i");this.v&&wa(this,a);a===b.length-1?b.pop():b.splice(a,1);this.lb()};t.removeRange=function(a,b){var c=this.j,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.v&&wa(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.lb();return this};E.prototype.copy=function(){var a=new E,b=this.j;0<b.length&&(a.j=Array.prototype.slice.call(b));return a};
t=E.prototype;t.Ma=function(){for(var a=this.j,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.Kv=function(){for(var a=new F,b=this.j,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){this.v&&wa(this);this.j.sort(a);this.lb();return this};
t.Mi=function(a,b,c){var d=this.j,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);this.v&&wa(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&xa(b,"0 <= from < length",E,"sortRange:from");if(2===f)return c=d[b],e=d[b+1],0<a(c,e)&&(d[b]=e,d[b+1]=c,this.lb()),this;if(0===b)if(c>=e)d.sort(a);else for(b=d.slice(0,c),b.sort(a),a=0;a<c;a++)d[a]=b[a];else if(c>=e)for(c=d.slice(b),c.sort(a),a=b;a<e;a++)d[a]=c[a-b];else for(e=d.slice(b,c),e.sort(a),a=b;a<c;a++)d[a]=e[a-b];this.lb();return this};
t.reverse=function(){this.v&&wa(this);this.j.reverse();this.lb();return this};
pa.Object.defineProperties(E.prototype,{_dataArray:{get:function(){return this.j}},count:{get:function(){return this.j.length}},size:{get:function(){return this.j.length}},length:{get:function(){return this.j.length}},iterator:{get:function(){if(0>=this.j.length)return Ab;var a=this.Ia;return null!==a?(a.reset(),a):new Cb(this)}},iteratorBackwards:{
get:function(){if(0>=this.j.length)return Ab;var a=this.Ng;return null!==a?(a.reset(),a):new Db(this)}}});E.prototype.reverse=E.prototype.reverse;E.prototype.sortRange=E.prototype.Mi;E.prototype.sort=E.prototype.sort;E.prototype.toSet=E.prototype.Kv;E.prototype.toArray=E.prototype.Ma;E.prototype.removeRange=E.prototype.removeRange;E.prototype.removeAt=E.prototype.nb;E.prototype["delete"]=E.prototype.delete;E.prototype.remove=E.prototype.remove;E.prototype.insertAt=E.prototype.Jb;
E.prototype.pop=E.prototype.pop;E.prototype.last=E.prototype.dc;E.prototype.first=E.prototype.first;E.prototype.set=E.prototype.set;E.prototype.setElt=E.prototype.jd;E.prototype.get=E.prototype.get;E.prototype.elt=E.prototype.N;E.prototype.indexOf=E.prototype.indexOf;E.prototype.has=E.prototype.has;E.prototype.contains=E.prototype.contains;E.prototype.clear=E.prototype.clear;E.prototype.addAll=E.prototype.addAll;E.prototype.push=E.prototype.push;E.prototype.add=E.prototype.add;E.prototype.thaw=E.prototype.ha;
E.prototype.freeze=E.prototype.freeze;E.className="List";function Gb(a){this.bg=a;a.Ia=null;this.la=a.Ba;this.na=null}Gb.prototype.reset=function(){var a=this.bg;a.Ia=null;this.la=a.Ba;this.na=null};Gb.prototype.next=function(){var a=this.bg;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.value=b.value,this.key=b.key,!0;this.yd();return!1};Gb.prototype.fd=function(){return this.next()};
Gb.prototype.first=function(){var a=this.bg;this.la=a.Ba;a=a.fa;if(null!==a){this.na=a;var b=a.value;this.key=a.key;return this.value=b}return null};Gb.prototype.any=function(a){var b=this.bg;this.na=b.Ia=null;for(b=b.fa;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};Gb.prototype.all=function(a){var b=this.bg;this.na=b.Ia=null;for(b=b.fa;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};Gb.prototype.each=function(a){var b=this.bg;this.na=b.Ia=null;for(b=b.fa;null!==b;)a(b.value),b=b.oa;return this};
Gb.prototype.map=function(a){var b=this.bg;b.Ia=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};Gb.prototype.filter=function(a){var b=this.bg;b.Ia=null;var c=new E;for(b=b.fa;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};Gb.prototype.yd=function(){this.value=this.key=null;this.la=-1;this.bg.Ia=this};Gb.prototype.toString=function(){return null!==this.na?"SetIterator@"+this.na.value:"SetIterator"};
pa.Object.defineProperties(Gb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.bg.Db}}});Gb.prototype.first=Gb.prototype.first;Gb.prototype.hasNext=Gb.prototype.fd;Gb.prototype.next=Gb.prototype.next;Gb.prototype.reset=Gb.prototype.reset;Gb.className="SetIterator";
function F(a){tb(this);this.v=!1;this.Eb={};this.Db=0;this.Ia=null;this.Ba=0;this.Qe=this.fa=null;void 0!==a&&("function"===typeof a||"string"===typeof a?za():this.addAll(a))}t=F.prototype;t.lb=function(){var a=this.Ba;a++;999999999<a&&(a=0);this.Ba=a};t.freeze=function(){this.v=!0;return this};t.ha=function(){this.v=!1;return this};t.toString=function(){return"Set()#"+Fb(this)};
t.add=function(a){if(null===a)return this;this.v&&wa(this,a);var b=a;Aa(a)&&(b=Hb(a));void 0===this.Eb[b]&&(this.Db++,a=new Ib(a,a),this.Eb[b]=a,b=this.Qe,null===b?this.fa=a:(a.nl=b,b.oa=a),this.Qe=a,this.lb());return this};t.addAll=function(a){if(null===a)return this;this.v&&wa(this);if(Da(a))for(var b=a.length,c=0;c<b;c++)this.add(a[c]);else for(a=a.iterator;a.next();)this.add(a.value);return this};
t.contains=function(a){if(null===a)return!1;var b=a;return Aa(a)&&(b=Fb(a),void 0===b)?!1:void 0!==this.Eb[b]};t.has=function(a){return this.contains(a)};t.ny=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.oy=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(this.contains(a.value))return!0;return!1};t.first=function(){var a=this.fa;return null===a?null:a.value};
F.prototype.any=function(a){for(var b=this.fa;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};F.prototype.all=function(a){for(var b=this.fa;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};F.prototype.each=function(a){for(var b=this.fa;null!==b;)a(b.value),b=b.oa;return this};F.prototype.map=function(a){for(var b=new F,c=this.fa;null!==c;)b.add(a(c.value)),c=c.oa;return b};F.prototype.filter=function(a){for(var b=new F,c=this.fa;null!==c;){var d=c.value;a(d)&&b.add(d);c=c.oa}return b};t=F.prototype;
t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=a;if(Aa(a)&&(b=Fb(a),void 0===b))return!1;a=this.Eb[b];if(void 0===a)return!1;var c=a.oa,d=a.nl;null!==c&&(c.nl=d);null!==d&&(d.oa=c);this.fa===a&&(this.fa=c);this.Qe===a&&(this.Qe=d);delete this.Eb[b];this.Db--;this.lb();return!0};t.delete=function(a){return this.remove(a)};
t.gq=function(a){if(null===a)return this;this.v&&wa(this);if(Da(a))for(var b=a.length,c=0;c<b;c++)this.remove(a[c]);else for(a=a.iterator;a.next();)this.remove(a.value);return this};t.Cz=function(a){if(null===a||0===this.count)return this;this.v&&wa(this);var b=new F;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.gq(a);return this};t.clear=function(){this.v&&wa(this);this.Eb={};this.Db=0;null!==this.Ia&&this.Ia.reset();this.Qe=this.fa=null;this.lb()};
F.prototype.copy=function(){var a=new F,b=this.Eb,c;for(c in b)a.add(b[c].value);return a};F.prototype.Ma=function(){var a=Array(this.Db),b=this.Eb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};F.prototype.Jv=function(){var a=new E,b=this.Eb,c;for(c in b)a.add(b[c].value);return a};function tb(a){a.__gohashid=Jb++}function Hb(a){var b=a.__gohashid;void 0===b&&(b=Jb++,a.__gohashid=b);return b}function Fb(a){return a.__gohashid}
pa.Object.defineProperties(F.prototype,{count:{get:function(){return this.Db}},size:{get:function(){return this.Db}},iterator:{get:function(){if(0>=this.Db)return Ab;var a=this.Ia;return null!==a?(a.reset(),a):new Gb(this)}}});F.prototype.toList=F.prototype.Jv;F.prototype.toArray=F.prototype.Ma;F.prototype.clear=F.prototype.clear;F.prototype.retainAll=F.prototype.Cz;F.prototype.removeAll=F.prototype.gq;
F.prototype["delete"]=F.prototype.delete;F.prototype.remove=F.prototype.remove;F.prototype.first=F.prototype.first;F.prototype.containsAny=F.prototype.oy;F.prototype.containsAll=F.prototype.ny;F.prototype.has=F.prototype.has;F.prototype.contains=F.prototype.contains;F.prototype.addAll=F.prototype.addAll;F.prototype.add=F.prototype.add;F.prototype.thaw=F.prototype.ha;F.prototype.freeze=F.prototype.freeze;var Jb=1;F.className="Set";F.uniqueHash=tb;F.hashIdUnique=Hb;F.hashId=Fb;
function Kb(a){this.ja=a;this.la=a.Ba;this.na=null}Kb.prototype.reset=function(){this.la=this.ja.Ba;this.na=null};Kb.prototype.next=function(){var a=this.ja;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.value=this.key=a=b.key,!0;this.yd();return!1};Kb.prototype.fd=function(){return this.next()};Kb.prototype.first=function(){var a=this.ja;this.la=a.Ba;a=a.fa;return null!==a?(this.na=a,this.value=this.key=a=a.key):null};
Kb.prototype.any=function(a){var b=this.ja;this.na=null;for(b=b.fa;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};Kb.prototype.all=function(a){var b=this.ja;this.na=null;for(b=b.fa;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};Kb.prototype.each=function(a){var b=this.ja;this.na=null;for(b=b.fa;null!==b;)a(b.key),b=b.oa;return this};Kb.prototype.map=function(a){var b=this.ja;this.na=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b.key)),b=b.oa;return c.iterator};
Kb.prototype.filter=function(a){var b=this.ja;this.na=null;var c=new E;for(b=b.fa;null!==b;){var d=b.key;a(d)&&c.add(d);b=b.oa}return c.iterator};Kb.prototype.yd=function(){this.value=this.key=null;this.la=-1};Kb.prototype.toString=function(){return null!==this.na?"MapKeySetIterator@"+this.na.value:"MapKeySetIterator"};pa.Object.defineProperties(Kb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ja.Db}}});
Kb.prototype.first=Kb.prototype.first;Kb.prototype.hasNext=Kb.prototype.fd;Kb.prototype.next=Kb.prototype.next;Kb.prototype.reset=Kb.prototype.reset;Kb.className="MapKeySetIterator";function Mb(a){F.call(this);tb(this);this.v=!0;this.ja=a}oa(Mb,F);t=Mb.prototype;t.freeze=function(){return this};t.ha=function(){return this};t.toString=function(){return"MapKeySet("+this.ja.toString()+")"};t.add=function(){A("This Set is read-only: "+this.toString());return this};t.contains=function(a){return this.ja.contains(a)};
t.has=function(a){return this.contains(a)};t.remove=function(){A("This Set is read-only: "+this.toString());return!1};t.delete=function(a){return this.remove(a)};t.clear=function(){A("This Set is read-only: "+this.toString())};t.first=function(){var a=this.ja.fa;return null!==a?a.key:null};Mb.prototype.any=function(a){for(var b=this.ja.fa;null!==b;){if(a(b.key))return!0;b=b.oa}return!1};Mb.prototype.all=function(a){for(var b=this.ja.fa;null!==b;){if(!a(b.key))return!1;b=b.oa}return!0};
Mb.prototype.each=function(a){for(var b=this.ja.fa;null!==b;)a(b.key),b=b.oa;return this};Mb.prototype.map=function(a){for(var b=new F,c=this.ja.fa;null!==c;)b.add(a(c.key)),c=c.oa;return b};Mb.prototype.filter=function(a){for(var b=new F,c=this.ja.fa;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.oa}return b};Mb.prototype.copy=function(){return new Mb(this.ja)};Mb.prototype.Kv=function(){var a=new F,b=this.ja.Eb,c;for(c in b)a.add(b[c].key);return a};
Mb.prototype.Ma=function(){var a=this.ja.Eb,b=Array(this.ja.Db),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};Mb.prototype.Jv=function(){var a=new E,b=this.ja.Eb,c;for(c in b)a.add(b[c].key);return a};pa.Object.defineProperties(Mb.prototype,{count:{get:function(){return this.ja.Db}},size:{get:function(){return this.ja.Db}},iterator:{get:function(){return 0>=this.ja.Db?Ab:new Kb(this.ja)}}});
Mb.prototype.toList=Mb.prototype.Jv;Mb.prototype.toArray=Mb.prototype.Ma;Mb.prototype.toSet=Mb.prototype.Kv;Mb.prototype.first=Mb.prototype.first;Mb.prototype.clear=Mb.prototype.clear;Mb.prototype["delete"]=Mb.prototype.delete;Mb.prototype.remove=Mb.prototype.remove;Mb.prototype.has=Mb.prototype.has;Mb.prototype.contains=Mb.prototype.contains;Mb.prototype.add=Mb.prototype.add;Mb.prototype.thaw=Mb.prototype.ha;Mb.prototype.freeze=Mb.prototype.freeze;Mb.className="MapKeySet";
function Nb(a){this.ja=a;a.Pe=null;this.la=a.Ba;this.na=null}Nb.prototype.reset=function(){var a=this.ja;a.Pe=null;this.la=a.Ba;this.na=null};Nb.prototype.next=function(){var a=this.ja;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.value=b.value,this.key=b.key,!0;this.yd();return!1};Nb.prototype.fd=function(){return this.next()};
Nb.prototype.first=function(){var a=this.ja;this.la=a.Ba;a=a.fa;if(null!==a){this.na=a;var b=a.value;this.key=a.key;return this.value=b}return null};Nb.prototype.any=function(a){var b=this.ja;this.na=b.Pe=null;for(b=b.fa;null!==b;){if(a(b.value))return!0;b=b.oa}return!1};Nb.prototype.all=function(a){var b=this.ja;this.na=b.Pe=null;for(b=b.fa;null!==b;){if(!a(b.value))return!1;b=b.oa}return!0};Nb.prototype.each=function(a){var b=this.ja;this.na=b.Pe=null;for(b=b.fa;null!==b;)a(b.value),b=b.oa;return this};
Nb.prototype.map=function(a){var b=this.ja;this.na=b.Pe=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b.value)),b=b.oa;return c.iterator};Nb.prototype.filter=function(a){var b=this.ja;this.na=b.Pe=null;var c=new E;for(b=b.fa;null!==b;){var d=b.value;a(d)&&c.add(d);b=b.oa}return c.iterator};Nb.prototype.yd=function(){this.value=this.key=null;this.la=-1;this.ja.Pe=this};Nb.prototype.toString=function(){return null!==this.na?"MapValueSetIterator@"+this.na.value:"MapValueSetIterator"};
pa.Object.defineProperties(Nb.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ja.Db}}});Nb.prototype.first=Nb.prototype.first;Nb.prototype.hasNext=Nb.prototype.fd;Nb.prototype.next=Nb.prototype.next;Nb.prototype.reset=Nb.prototype.reset;Nb.className="MapValueSetIterator";function Ib(a,b){this.key=a;this.value=b;this.nl=this.oa=null}Ib.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};
Ib.className="KeyValuePair";function Ob(a){this.ja=a;a.Ia=null;this.la=a.Ba;this.na=null}Ob.prototype.reset=function(){var a=this.ja;a.Ia=null;this.la=a.Ba;this.na=null};Ob.prototype.next=function(){var a=this.ja;if(a.Ba!==this.la&&null===this.key)return!1;var b=this.na;b=null===b?a.fa:b.oa;if(null!==b)return this.na=b,this.key=b.key,this.value=b.value,!0;this.yd();return!1};Ob.prototype.fd=function(){return this.next()};
Ob.prototype.first=function(){var a=this.ja;this.la=a.Ba;a=a.fa;return null!==a?(this.na=a,this.key=a.key,this.value=a.value,a):null};Ob.prototype.any=function(a){var b=this.ja;this.na=b.Ia=null;for(b=b.fa;null!==b;){if(a(b))return!0;b=b.oa}return!1};Ob.prototype.all=function(a){var b=this.ja;this.na=b.Ia=null;for(b=b.fa;null!==b;){if(!a(b))return!1;b=b.oa}return!0};Ob.prototype.each=function(a){var b=this.ja;this.na=b.Ia=null;for(b=b.fa;null!==b;)a(b),b=b.oa;return this};
Ob.prototype.map=function(a){var b=this.ja;this.na=b.Ia=null;var c=new E;for(b=b.fa;null!==b;)c.add(a(b)),b=b.oa;return c.iterator};Ob.prototype.filter=function(a){var b=this.ja;this.na=b.Ia=null;var c=new E;for(b=b.fa;null!==b;)a(b)&&c.add(b),b=b.oa;return c.iterator};Ob.prototype.yd=function(){this.value=this.key=null;this.la=-1;this.ja.Ia=this};Ob.prototype.toString=function(){return null!==this.na?"MapIterator@"+this.na:"MapIterator"};
pa.Object.defineProperties(Ob.prototype,{iterator:{get:function(){return this}},count:{get:function(){return this.ja.Db}}});Ob.prototype.first=Ob.prototype.first;Ob.prototype.hasNext=Ob.prototype.fd;Ob.prototype.next=Ob.prototype.next;Ob.prototype.reset=Ob.prototype.reset;Ob.className="MapIterator";
function Pb(a){tb(this);this.v=!1;this.Eb={};this.Db=0;this.Pe=this.Ia=null;this.Ba=0;this.Qe=this.fa=null;void 0!==a&&("function"===typeof a||"string"===typeof a?za():this.addAll(a))}t=Pb.prototype;t.lb=function(){var a=this.Ba;a++;999999999<a&&(a=0);this.Ba=a};t.freeze=function(){this.v=!0;return this};t.ha=function(){this.v=!1;return this};t.toString=function(){return"Map()#"+Fb(this)};
t.add=function(a,b){this.v&&wa(this,a);var c=a;Aa(a)&&(c=Hb(a));var d=this.Eb[c];void 0===d?(this.Db++,a=new Ib(a,b),this.Eb[c]=a,c=this.Qe,null===c?this.fa=a:(a.nl=c,c.oa=a),this.Qe=a,this.lb()):d.value=b;return this};t.set=function(a,b){return this.add(a,b)};t.addAll=function(a){if(null===a)return this;if(Da(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];this.add(d.key,d.value)}else for(a=a.iterator;a.next();)b=a.value,this.add(b.key,b.value);return this};t.first=function(){return this.fa};
Pb.prototype.any=function(a){for(var b=this.fa;null!==b;){if(a(b))return!0;b=b.oa}return!1};Pb.prototype.all=function(a){for(var b=this.fa;null!==b;){if(!a(b))return!1;b=b.oa}return!0};Pb.prototype.each=function(a){for(var b=this.fa;null!==b;)a(b),b=b.oa;return this};Pb.prototype.map=function(a){for(var b=new Pb,c=this.fa;null!==c;)b.add(c.key,a(c)),c=c.oa;return b};Pb.prototype.filter=function(a){for(var b=new Pb,c=this.fa;null!==c;)a(c)&&b.add(c.key,c.value),c=c.oa;return b};t=Pb.prototype;
t.contains=function(a){var b=a;return Aa(a)&&(b=Fb(a),void 0===b)?!1:void 0!==this.Eb[b]};t.has=function(a){return this.contains(a)};t.J=function(a){var b=a;if(Aa(a)&&(b=Fb(a),void 0===b))return null;a=this.Eb[b];return void 0===a?null:a.value};t.get=function(a){return this.J(a)};
t.remove=function(a){if(null===a)return!1;this.v&&wa(this,a);var b=a;if(Aa(a)&&(b=Fb(a),void 0===b))return!1;a=this.Eb[b];if(void 0===a)return!1;var c=a.oa,d=a.nl;null!==c&&(c.nl=d);null!==d&&(d.oa=c);this.fa===a&&(this.fa=c);this.Qe===a&&(this.Qe=d);delete this.Eb[b];this.Db--;this.lb();return!0};t.delete=function(a){return this.remove(a)};t.clear=function(){this.v&&wa(this);this.Eb={};this.Db=0;null!==this.Ia&&this.Ia.reset();null!==this.Pe&&this.Pe.reset();this.Qe=this.fa=null;this.lb()};
Pb.prototype.copy=function(){var a=new Pb,b=this.Eb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};Pb.prototype.Ma=function(){var a=this.Eb,b=Array(this.Db),c=0,d;for(d in a){var e=a[d];b[c]=new Ib(e.key,e.value);c++}return b};Pb.prototype.Xd=function(){return new Mb(this)};
pa.Object.defineProperties(Pb.prototype,{count:{get:function(){return this.Db}},size:{get:function(){return this.Db}},iterator:{get:function(){if(0>=this.count)return Ab;var a=this.Ia;return null!==a?(a.reset(),a):new Ob(this)}},iteratorKeys:{get:function(){return 0>=this.count?Ab:new Kb(this)}},iteratorValues:{get:function(){if(0>=this.count)return Ab;
var a=this.Pe;return null!==a?(a.reset(),a):new Nb(this)}}});Pb.prototype.toKeySet=Pb.prototype.Xd;Pb.prototype.toArray=Pb.prototype.Ma;Pb.prototype.clear=Pb.prototype.clear;Pb.prototype["delete"]=Pb.prototype.delete;Pb.prototype.remove=Pb.prototype.remove;Pb.prototype.get=Pb.prototype.get;Pb.prototype.getValue=Pb.prototype.J;Pb.prototype.has=Pb.prototype.has;Pb.prototype.contains=Pb.prototype.contains;Pb.prototype.first=Pb.prototype.first;Pb.prototype.addAll=Pb.prototype.addAll;
Pb.prototype.set=Pb.prototype.set;Pb.prototype.add=Pb.prototype.add;Pb.prototype.thaw=Pb.prototype.ha;Pb.prototype.freeze=Pb.prototype.freeze;Pb.className="Map";function G(a,b){void 0===a?this.D=this.C=0:"number"===typeof a&&"number"===typeof b?(this.C=a,this.D=b):A("Invalid arguments to Point constructor: "+a+", "+b);this.v=!1}G.prototype.assign=function(a){this.C=a.C;this.D=a.D;return this};G.prototype.h=function(a,b){this.C=a;this.D=b;return this};
G.prototype.qg=function(a,b){this.C=a;this.D=b;return this};G.prototype.set=function(a){this.C=a.C;this.D=a.D;return this};G.prototype.copy=function(){var a=new G;a.C=this.C;a.D=this.D;return a};t=G.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;return this};
function Qb(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new G(c,e)}return new G}function Rb(a){return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.A=function(a){return a instanceof G?this.C===a.x&&this.D===a.y:!1};t.yi=function(a,b){return this.C===a&&this.D===b};t.Oa=function(a){return H.w(this.C,a.x)&&H.w(this.D,a.y)};
t.add=function(a){this.C+=a.x;this.D+=a.y;return this};t.Wd=function(a){this.C-=a.x;this.D-=a.y;return this};t.offset=function(a,b){this.C+=a;this.D+=b;return this};G.prototype.rotate=function(a){if(0===a)return this;var b=this.C,c=this.D;if(0===b&&0===c)return this;360<=a?a-=360:0>a&&(a+=360);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));this.C=a*b-d*c;this.D=d*b+a*c;return this};t=G.prototype;
t.scale=function(a,b){this.C*=a;this.D*=b;return this};t.Ae=function(a){var b=a.x-this.C;a=a.y-this.D;return b*b+a*a};t.ed=function(a,b){a-=this.C;b-=this.D;return a*a+b*b};t.normalize=function(){var a=this.C,b=this.D,c=Math.sqrt(a*a+b*b);0<c&&(this.C=a/c,this.D=b/c);return this};t.Va=function(a){return Sb(a.x-this.C,a.y-this.D)};t.direction=function(a,b){return Sb(a-this.C,b-this.D)};
function Sb(a,b){if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;var c=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?c=0>b?c+180:180-c:0>b&&(c=360-c);return c}t.wz=function(a,b,c,d){H.Ii(a,b,c,d,this.C,this.D,this);return this};t.xz=function(a,b){H.Ii(a.x,a.y,b.x,b.y,this.C,this.D,this);return this};t.Hz=function(a,b,c,d){H.Op(this.C,this.D,a,b,c,d,this);return this};t.Iz=function(a,b){H.Op(this.C,this.D,a.x,a.y,b.width,b.height,this);return this};
t.Li=function(a,b){this.C=a.x+b.x*a.width+b.offsetX;this.D=a.y+b.y*a.height+b.offsetY;return this};t.ik=function(a,b,c,d,e){this.C=a+e.x*c+e.offsetX;this.D=b+e.y*d+e.offsetY;return this};t.transform=function(a){a.ta(this);return this};function Yb(a,b){b.Td(a);return a}function Zb(a,b,c,d,e,f){var g=e-c,h=f-d,k=g*g+h*h;c-=a;d-=b;var l=-c*g-d*h;if(0>=l||l>=k)return g=e-a,h=f-b,Math.min(c*c+d*d,g*g+h*h);a=g*d-h*c;return a*a/k}function $b(a,b,c,d){a=c-a;b=d-b;return a*a+b*b}
function ac(a,b,c,d){a=c-a;b=d-b;if(0===a)return 0<b?90:0>b?270:0;if(0===b)return 0<a?0:180;if(isNaN(a)||isNaN(b))return 0;d=180*Math.atan(Math.abs(b/a))/Math.PI;0>a?d=0>b?d+180:180-d:0>b&&(d=360-d);return d}t.s=function(){return isFinite(this.x)&&isFinite(this.y)};G.alloc=function(){var a=bc.pop();return void 0===a?new G:a};G.allocAt=function(a,b){var c=bc.pop();if(void 0===c)return new G(a,b);c.x=a;c.y=b;return c};G.free=function(a){bc.push(a)};
pa.Object.defineProperties(G.prototype,{x:{get:function(){return this.C},set:function(a){this.C=a}},y:{get:function(){return this.D},set:function(a){this.D=a}}});G.prototype.isReal=G.prototype.s;G.prototype.setSpot=G.prototype.ik;G.prototype.setRectSpot=G.prototype.Li;G.prototype.snapToGridPoint=G.prototype.Iz;G.prototype.snapToGrid=G.prototype.Hz;G.prototype.projectOntoLineSegmentPoint=G.prototype.xz;G.prototype.projectOntoLineSegment=G.prototype.wz;
G.prototype.direction=G.prototype.direction;G.prototype.directionPoint=G.prototype.Va;G.prototype.normalize=G.prototype.normalize;G.prototype.distanceSquared=G.prototype.ed;G.prototype.distanceSquaredPoint=G.prototype.Ae;G.prototype.scale=G.prototype.scale;G.prototype.rotate=G.prototype.rotate;G.prototype.offset=G.prototype.offset;G.prototype.subtract=G.prototype.Wd;G.prototype.add=G.prototype.add;G.prototype.equalsApprox=G.prototype.Oa;G.prototype.equalTo=G.prototype.yi;G.prototype.equals=G.prototype.A;
G.prototype.set=G.prototype.set;G.prototype.setTo=G.prototype.qg;var cc=null,dc=null,ec=null,fc=null,gc=null,bc=[];G.className="Point";G.parse=Qb;G.stringify=Rb;G.distanceLineSegmentSquared=Zb;G.distanceSquared=$b;G.direction=ac;G.Origin=cc=(new G(0,0)).ga();G.InfiniteTopLeft=dc=(new G(-Infinity,-Infinity)).ga();G.InfiniteBottomRight=ec=(new G(Infinity,Infinity)).ga();G.SixPoint=fc=(new G(6,6)).ga();G.NoPoint=gc=(new G(NaN,NaN)).ga();G.parse=Qb;G.stringify=Rb;G.distanceLineSegmentSquared=Zb;
G.distanceSquared=$b;G.direction=ac;function L(a,b){void 0===a?this.Y=this.$=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.$=a,this.Y=b):A("Invalid arguments to Size constructor: "+a+", "+b);this.v=!1}var jc,kc,lc,mc,nc,oc,rc;L.prototype.assign=function(a){this.$=a.$;this.Y=a.Y;return this};L.prototype.h=function(a,b){this.$=a;this.Y=b;return this};L.prototype.qg=function(a,b){this.$=a;this.Y=b;return this};L.prototype.set=function(a){this.$=a.$;this.Y=a.Y;return this};
L.prototype.copy=function(){var a=new L;a.$=this.$;a.Y=this.Y;return a};t=L.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;return this};
function sc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));return new L(c,e)}return new L}function tc(a){return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.A=function(a){return a instanceof L?this.$===a.width&&this.Y===a.height:!1};t.yi=function(a,b){return this.$===a&&this.Y===b};
t.Oa=function(a){return H.w(this.$,a.width)&&H.w(this.Y,a.height)};t.s=function(){return isFinite(this.width)&&isFinite(this.height)};L.alloc=function(){var a=uc.pop();return void 0===a?new L:a};L.free=function(a){uc.push(a)};
pa.Object.defineProperties(L.prototype,{width:{get:function(){return this.$},set:function(a){0>a&&xa(a,">= 0",L,"width");this.$=a}},height:{get:function(){return this.Y},set:function(a){0>a&&xa(a,">= 0",L,"height");this.Y=a}}});L.prototype.isReal=L.prototype.s;L.prototype.equalsApprox=L.prototype.Oa;L.prototype.equalTo=L.prototype.yi;L.prototype.equals=L.prototype.A;L.prototype.set=L.prototype.set;L.prototype.setTo=L.prototype.qg;
var uc=[];L.className="Size";L.parse=sc;L.stringify=tc;L.ZeroSize=jc=(new L(0,0)).ga();L.OneSize=kc=(new L(1,1)).ga();L.SixSize=lc=(new L(6,6)).ga();L.EightSize=mc=(new L(8,8)).ga();L.TenSize=nc=(new L(10,10)).ga();L.InfiniteSize=oc=(new L(Infinity,Infinity)).ga();L.NoSize=rc=(new L(NaN,NaN)).ga();L.parse=sc;L.stringify=tc;
function N(a,b,c,d){void 0===a?this.Y=this.$=this.D=this.C=0:a instanceof G?b instanceof G?(this.C=Math.min(a.C,b.C),this.D=Math.min(a.D,b.D),this.$=Math.abs(a.C-b.C),this.Y=Math.abs(a.D-b.D)):b instanceof L?(this.C=a.C,this.D=a.D,this.$=b.$,this.Y=b.Y):A("Incorrect arguments supplied to Rect constructor"):"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.C=a,this.D=b,this.$=c,this.Y=d):A("Invalid arguments to Rect constructor: "+
a+", "+b+", "+c+", "+d);this.v=!1}t=N.prototype;t.assign=function(a){this.C=a.C;this.D=a.D;this.$=a.$;this.Y=a.Y;return this};t.h=function(a,b,c,d){this.C=a;this.D=b;this.$=c;this.Y=d;return this};function xc(a,b,c){a.$=b;a.Y=c}t.qg=function(a,b,c,d){this.C=a;this.D=b;this.$=c;this.Y=d;return this};t.set=function(a){this.C=a.C;this.D=a.D;this.$=a.$;this.Y=a.Y;return this};t.ld=function(a){this.C=a.C;this.D=a.D;return this};t.Fz=function(a){this.$=a.$;this.Y=a.Y;return this};
N.prototype.copy=function(){var a=new N;a.C=this.C;a.D=this.D;a.$=this.$;a.Y=this.Y;return a};t=N.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;return this};
function yc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return new N(c,e,f,g)}return new N}function zc(a){return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()}
t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.A=function(a){return a instanceof N?this.C===a.x&&this.D===a.y&&this.$===a.width&&this.Y===a.height:!1};t.yi=function(a,b,c,d){return this.C===a&&this.D===b&&this.$===c&&this.Y===d};t.Oa=function(a){return H.w(this.C,a.x)&&H.w(this.D,a.y)&&H.w(this.$,a.width)&&H.w(this.Y,a.height)};function Ac(a,b){return H.ba(a.C,b.x)&&H.ba(a.D,b.y)&&H.ba(a.$,b.width)&&H.ba(a.Y,b.height)}
t.ea=function(a){return this.C<=a.x&&this.C+this.$>=a.x&&this.D<=a.y&&this.D+this.Y>=a.y};t.kf=function(a){return this.C<=a.x&&a.x+a.width<=this.C+this.$&&this.D<=a.y&&a.y+a.height<=this.D+this.Y};t.contains=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return this.C<=a&&a+c<=this.C+this.$&&this.D<=b&&b+d<=this.D+this.Y};t.reset=function(){this.Y=this.$=this.D=this.C=0};t.offset=function(a,b){this.C+=a;this.D+=b;return this};t.Vc=function(a,b){return Bc(this,b,a,b,a)};
t.Gp=function(a){return Bc(this,a.top,a.right,a.bottom,a.left)};t.Iv=function(a){return Bc(this,-a.top,-a.right,-a.bottom,-a.left)};t.dz=function(a,b,c,d){return Bc(this,a,b,c,d)};function Bc(a,b,c,d,e){var f=a.$;c+e<=-f?(a.C+=f/2,a.$=0):(a.C-=e,a.$+=c+e);c=a.Y;b+d<=-c?(a.D+=c/2,a.Y=0):(a.D-=b,a.Y+=b+d);return a}t.hz=function(a){return Cc(this,a.x,a.y,a.width,a.height)};t.av=function(a,b,c,d){return Cc(this,a,b,c,d)};
function Cc(a,b,c,d,e){var f=Math.max(a.C,b),g=Math.max(a.D,c);b=Math.min(a.C+a.$,b+d);c=Math.min(a.D+a.Y,c+e);a.C=f;a.D=g;a.$=Math.max(0,b-f);a.Y=Math.max(0,c-g);return a}t.Jc=function(a){return this.bv(a.x,a.y,a.width,a.height)};t.bv=function(a,b,c,d){var e=this.$,f=this.C;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.Y;c=this.D;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0};
function Dc(a,b,c){var d=a.$,e=a.C,f=b.x-c;if(e>b.width+c+c+f||f>d+e)return!1;d=a.Y;a=a.D;e=b.y-c;return a>b.height+c+c+e||e>d+a?!1:!0}t.Ie=function(a){return Fc(this,a.x,a.y,0,0)};t.Wc=function(a){return Fc(this,a.C,a.D,a.$,a.Y)};t.Pv=function(a,b,c,d){void 0===c&&(c=0);void 0===d&&(d=0);return Fc(this,a,b,c,d)};function Fc(a,b,c,d,e){var f=Math.min(a.C,b),g=Math.min(a.D,c);b=Math.max(a.C+a.$,b+d);c=Math.max(a.D+a.Y,c+e);a.C=f;a.D=g;a.$=b-f;a.Y=c-g;return a}
t.ik=function(a,b,c){this.C=a-c.offsetX-c.x*this.$;this.D=b-c.offsetY-c.y*this.Y;return this};function Gc(a,b,c,d,e,f,g,h){void 0===g&&(g=0);void 0===h&&(h=0);return a<=e&&e+g<=a+c&&b<=f&&f+h<=b+d}function Hc(a,b,c,d,e,f,g,h){return a>g+e||e>c+a?!1:b>h+f||f>d+b?!1:!0}t.s=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.jz=function(){return 0===this.width&&0===this.height};N.alloc=function(){var a=Ic.pop();return void 0===a?new N:a};
N.allocAt=function(a,b,c,d){var e=Ic.pop();return void 0===e?new N(a,b,c,d):e.h(a,b,c,d)};N.free=function(a){Ic.push(a)};
pa.Object.defineProperties(N.prototype,{x:{get:function(){return this.C},set:function(a){this.C=a}},y:{get:function(){return this.D},set:function(a){this.D=a}},width:{get:function(){return this.$},set:function(a){0>a&&xa(a,">= 0",N,"width");this.$=a}},height:{get:function(){return this.Y},set:function(a){0>a&&xa(a,">= 0",N,"height");this.Y=a}},left:{
get:function(){return this.C},set:function(a){this.C=a}},top:{get:function(){return this.D},set:function(a){this.D=a}},right:{get:function(){return this.C+this.$},set:function(a){this.C+=a-(this.C+this.$)}},bottom:{get:function(){return this.D+this.Y},set:function(a){this.D+=a-(this.D+this.Y)}},position:{get:function(){return new G(this.C,this.D)},set:function(a){this.C=a.x;this.D=
a.y}},size:{get:function(){return new L(this.$,this.Y)},set:function(a){this.$=a.width;this.Y=a.height}},center:{get:function(){return new G(this.C+this.$/2,this.D+this.Y/2)},set:function(a){this.C=a.x-this.$/2;this.D=a.y-this.Y/2}},centerX:{get:function(){return this.C+this.$/2},set:function(a){this.C=a-this.$/2}},centerY:{get:function(){return this.D+this.Y/2},set:function(a){this.D=
a-this.Y/2}}});N.prototype.isEmpty=N.prototype.jz;N.prototype.isReal=N.prototype.s;N.prototype.setSpot=N.prototype.ik;N.prototype.union=N.prototype.Pv;N.prototype.unionRect=N.prototype.Wc;N.prototype.unionPoint=N.prototype.Ie;N.prototype.intersects=N.prototype.bv;N.prototype.intersectsRect=N.prototype.Jc;N.prototype.intersect=N.prototype.av;N.prototype.intersectRect=N.prototype.hz;N.prototype.grow=N.prototype.dz;N.prototype.subtractMargin=N.prototype.Iv;N.prototype.addMargin=N.prototype.Gp;
N.prototype.inflate=N.prototype.Vc;N.prototype.offset=N.prototype.offset;N.prototype.contains=N.prototype.contains;N.prototype.containsRect=N.prototype.kf;N.prototype.containsPoint=N.prototype.ea;N.prototype.equalsApprox=N.prototype.Oa;N.prototype.equalTo=N.prototype.yi;N.prototype.equals=N.prototype.A;N.prototype.setSize=N.prototype.Fz;N.prototype.setPoint=N.prototype.ld;N.prototype.set=N.prototype.set;N.prototype.setTo=N.prototype.qg;var Jc=null,Kc=null,Ic=[];N.className="Rect";N.parse=yc;
N.stringify=zc;N.contains=Gc;N.intersects=Hc;N.ZeroRect=Jc=(new N(0,0,0,0)).ga();N.NoRect=Kc=(new N(NaN,NaN,NaN,NaN)).ga();N.parse=yc;N.stringify=zc;N.contains=Gc;N.intersects=Hc;
function Lc(a,b,c,d){void 0===a?this.je=this.Zd=this.re=this.ue=0:void 0===b?this.left=this.bottom=this.right=this.top=a:void 0===c?(this.top=a,this.right=b,this.bottom=a,this.left=b):void 0!==d?(this.top=a,this.right=b,this.bottom=c,this.left=d):A("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.v=!1}Lc.prototype.assign=function(a){this.ue=a.ue;this.re=a.re;this.Zd=a.Zd;this.je=a.je;return this};Lc.prototype.qg=function(a,b,c,d){this.ue=a;this.re=b;this.Zd=c;this.je=d;return this};
Lc.prototype.set=function(a){this.ue=a.ue;this.re=a.re;this.Zd=a.Zd;this.je=a.je;return this};Lc.prototype.copy=function(){var a=new Lc;a.ue=this.ue;a.re=this.re;a.Zd=this.Zd;a.je=this.je;return a};t=Lc.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;return this};
function Oc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new Lc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new Lc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new Lc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new Lc(c,e):new Lc(c,e,f,g)}return new Lc}
function Pc(a){return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.A=function(a){return a instanceof Lc?this.ue===a.top&&this.re===a.right&&this.Zd===a.bottom&&this.je===a.left:!1};t.yi=function(a,b,c,d){return this.ue===a&&this.re===b&&this.Zd===c&&this.je===d};
t.Oa=function(a){return H.w(this.ue,a.top)&&H.w(this.re,a.right)&&H.w(this.Zd,a.bottom)&&H.w(this.je,a.left)};t.s=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};Lc.alloc=function(){var a=Qc.pop();return void 0===a?new Lc:a};Lc.free=function(a){Qc.push(a)};
pa.Object.defineProperties(Lc.prototype,{top:{get:function(){return this.ue},set:function(a){this.ue=a}},right:{get:function(){return this.re},set:function(a){this.re=a}},bottom:{get:function(){return this.Zd},set:function(a){this.Zd=a}},left:{get:function(){return this.je},set:function(a){this.je=a}}});Lc.prototype.isReal=Lc.prototype.s;Lc.prototype.equalsApprox=Lc.prototype.Oa;
Lc.prototype.equalTo=Lc.prototype.yi;Lc.prototype.equals=Lc.prototype.A;Lc.prototype.set=Lc.prototype.set;Lc.prototype.setTo=Lc.prototype.qg;var Rc=null,Sc=null,Qc=[];Lc.className="Margin";Lc.parse=Oc;Lc.stringify=Pc;Lc.ZeroMargin=Rc=(new Lc(0,0,0,0)).ga();Lc.TwoMargin=Sc=(new Lc(2,2,2,2)).ga();Lc.parse=Oc;Lc.stringify=Pc;function Tc(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}
Tc.prototype.set=function(a){this.m11=a.m11;this.m12=a.m12;this.m21=a.m21;this.m22=a.m22;this.dx=a.dx;this.dy=a.dy;return this};Tc.prototype.copy=function(){var a=new Tc;a.m11=this.m11;a.m12=this.m12;a.m21=this.m21;a.m22=this.m22;a.dx=this.dx;a.dy=this.dy;return a};t=Tc.prototype;t.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};
t.A=function(a){return a instanceof Tc?this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy:!1};t.Zs=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};t.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};
t.multiply=function(a){var b=this.m12*a.m11+this.m22*a.m12,c=this.m11*a.m21+this.m21*a.m22,d=this.m12*a.m21+this.m22*a.m22,e=this.m11*a.dx+this.m21*a.dy+this.dx,f=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=this.m11*a.m11+this.m21*a.m12;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};
t.hv=function(a){var b=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*b,d=-a.m12*b,e=-a.m21*b,f=a.m11*b,g=b*(a.m21*a.dy-a.m22*a.dx);a=b*(a.m12*a.dx-a.m11*a.dy);b=this.m11*c+this.m21*d;c=this.m12*c+this.m22*d;d=this.m11*e+this.m21*f;e=this.m12*e+this.m22*f;this.dx=this.m11*g+this.m21*a+this.dx;this.dy=this.m12*g+this.m22*a+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this};
t.Ys=function(){var a=1/(this.m11*this.m22-this.m12*this.m21),b=-this.m12*a,c=-this.m21*a,d=this.m11*a,e=a*(this.m21*this.dy-this.m22*this.dx),f=a*(this.m12*this.dx-this.m11*this.dy);this.m11=this.m22*a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};
Tc.prototype.rotate=function(a,b,c){360<=a?a-=360:0>a&&(a+=360);if(0===a)return this;this.translate(b,c);if(90===a){a=0;var d=1}else 180===a?(a=-1,d=0):270===a?(a=0,d=-1):(d=a*Math.PI/180,a=Math.cos(d),d=Math.sin(d));var e=this.m12*a+this.m22*d,f=this.m11*-d+this.m21*a,g=this.m12*-d+this.m22*a;this.m11=this.m11*a+this.m21*d;this.m12=e;this.m21=f;this.m22=g;this.translate(-b,-c);return this};t=Tc.prototype;t.translate=function(a,b){this.dx+=this.m11*a+this.m21*b;this.dy+=this.m12*a+this.m22*b;return this};
t.scale=function(a,b){void 0===b&&(b=a);this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};t.ta=function(a){var b=a.C,c=a.D;a.C=b*this.m11+c*this.m21+this.dx;a.D=b*this.m12+c*this.m22+this.dy;return a};t.Td=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=-this.m12*b,d=this.m11*b,e=b*(this.m12*this.dx-this.m11*this.dy),f=a.C,g=a.D;a.C=f*this.m22*b+g*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx);a.D=f*c+g*d+e;return a};
t.Ov=function(a){var b=a.C,c=a.D,d=b+a.$,e=c+a.Y,f=this.m11,g=this.m12,h=this.m21,k=this.m22,l=this.dx,m=this.dy,n=b*f+c*h+l,p=b*g+c*k+m,q=d*f+c*h+l,r=d*g+c*k+m;c=b*f+e*h+l;b=b*g+e*k+m;f=d*f+e*h+l;d=d*g+e*k+m;e=Math.min(n,q);n=Math.max(n,q);q=Math.min(p,r);p=Math.max(p,r);e=Math.min(e,c);n=Math.max(n,c);q=Math.min(q,b);p=Math.max(p,b);e=Math.min(e,f);n=Math.max(n,f);q=Math.min(q,d);p=Math.max(p,d);a.C=e;a.D=q;a.$=n-e;a.Y=p-q;return a};Tc.alloc=function(){var a=Uc.pop();return void 0===a?new Tc:a};
Tc.free=function(a){Uc.push(a)};Tc.prototype.transformRect=Tc.prototype.Ov;Tc.prototype.invertedTransformPoint=Tc.prototype.Td;Tc.prototype.transformPoint=Tc.prototype.ta;Tc.prototype.scale=Tc.prototype.scale;Tc.prototype.translate=Tc.prototype.translate;Tc.prototype.rotate=Tc.prototype.rotate;Tc.prototype.invert=Tc.prototype.Ys;Tc.prototype.multiplyInverted=Tc.prototype.hv;Tc.prototype.multiply=Tc.prototype.multiply;Tc.prototype.reset=Tc.prototype.reset;Tc.prototype.isIdentity=Tc.prototype.Zs;
Tc.prototype.equals=Tc.prototype.A;Tc.prototype.set=Tc.prototype.set;var Uc=[];Tc.className="Transform";Tc.xF="54a702f3e53909c447824c6706603faf4c";function O(a,b,c,d){void 0===a?this.Nd=this.Md=this.D=this.C=0:(void 0===b&&(b=0),void 0===c&&(c=0),void 0===d&&(d=0),this.x=a,this.y=b,this.offsetX=c,this.offsetY=d);this.v=!1}var bd,cd,dd,ed,fd,gd,hd,id,od,pd,qd,rd,sd,td,ud,vd,yd,zd,Ad,Bd,Cd,Dd,Ed,Fd,Gd,Hd,Id,Qd,Rd,Sd,Td,Ud,Vd,Wd,Xd,Yd;
O.prototype.assign=function(a){this.C=a.C;this.D=a.D;this.Md=a.Md;this.Nd=a.Nd;return this};O.prototype.qg=function(a,b,c,d){this.C=a;this.D=b;this.Md=c;this.Nd=d;return this};O.prototype.set=function(a){this.C=a.C;this.D=a.D;this.Md=a.Md;this.Nd=a.Nd;return this};O.prototype.copy=function(){var a=new O;a.C=this.C;a.D=this.D;a.Md=this.Md;a.Nd=this.Nd;return a};t=O.prototype;t.ga=function(){this.v=!0;Object.freeze(this);return this};t.I=function(){return Object.isFrozen(this)?this:this.copy().freeze()};
t.freeze=function(){this.v=!0;return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;return this};function Zd(a,b){a.C=NaN;a.D=NaN;a.Md=b;return a}
function $d(a){if("string"===typeof a){a=a.trim();if("None"===a)return bd;if("TopLeft"===a)return cd;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return dd;if("TopRight"===a)return ed;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return fd;if("Center"===a)return gd;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return hd;if("BottomLeft"===a)return id;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return od;if("BottomRight"===a)return pd;if("TopSide"===a)return qd;if("LeftSide"===
a)return rd;if("RightSide"===a)return sd;if("BottomSide"===a)return td;if("TopBottomSides"===a)return ud;if("LeftRightSides"===a)return vd;if("TopLeftSides"===a)return yd;if("TopRightSides"===a)return zd;if("BottomLeftSides"===a)return Ad;if("BottomRightSides"===a)return Bd;if("NotTopSide"===a)return Cd;if("NotLeftSide"===a)return Dd;if("NotRightSide"===a)return Ed;if("NotBottomSide"===a)return Fd;if("AllSides"===a)return Gd;if("Default"===a)return Hd;a=a.split(" ");for(var b=0,c=0;""===a[b];)b++;
var d=a[b++];void 0!==d&&0<d.length&&(c=parseFloat(d));for(var e=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(e=parseFloat(d));for(var f=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(f=parseFloat(d));for(var g=0;""===a[b];)b++;d=a[b++];void 0!==d&&0<d.length&&(g=parseFloat(d));return new O(c,e,f,g)}return new O}function ae(a){return a.ib()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.ib()?0===this.Md&&0===this.Nd?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.A(bd)?"None":this.A(cd)?"TopLeft":this.A(dd)?"Top":this.A(ed)?"TopRight":this.A(fd)?"Left":this.A(gd)?"Center":this.A(hd)?"Right":this.A(id)?"BottomLeft":this.A(od)?"Bottom":this.A(pd)?"BottomRight":this.A(qd)?"TopSide":this.A(rd)?"LeftSide":this.A(sd)?"RightSide":this.A(td)?"BottomSide":this.A(ud)?"TopBottomSides":this.A(vd)?"LeftRightSides":
this.A(yd)?"TopLeftSides":this.A(zd)?"TopRightSides":this.A(Ad)?"BottomLeftSides":this.A(Bd)?"BottomRightSides":this.A(Cd)?"NotTopSide":this.A(Dd)?"NotLeftSide":this.A(Ed)?"NotRightSide":this.A(Fd)?"NotBottomSide":this.A(Gd)?"AllSides":this.A(Hd)?"Default":"None"};t.A=function(a){return a instanceof O?(this.C===a.x||isNaN(this.C)&&isNaN(a.x))&&(this.D===a.y||isNaN(this.D)&&isNaN(a.y))&&this.Md===a.offsetX&&this.Nd===a.offsetY:!1};
t.lv=function(){return new O(.5-(this.C-.5),.5-(this.D-.5),-this.Md,-this.Nd)};t.mf=function(a){if(!this.nf())return!1;if(!a.nf())if(a.A(Id))a=rd;else if(a.A(Qd))a=sd;else if(a.A(Rd))a=qd;else if(a.A(Sd))a=td;else return!1;a=a.offsetY;return(this.Nd&a)===a};t.ib=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.mc=function(){return isNaN(this.x)||isNaN(this.y)};t.nf=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY};
t.at=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Lb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};O.alloc=function(){var a=fe.pop();return void 0===a?new O:a};O.free=function(a){fe.push(a)};
pa.Object.defineProperties(O.prototype,{x:{get:function(){return this.C},set:function(a){this.C=a}},y:{get:function(){return this.D},set:function(a){this.D=a}},offsetX:{get:function(){return this.Md},set:function(a){this.Md=a}},offsetY:{get:function(){return this.Nd},set:function(a){this.Nd=a}}});O.prototype.isDefault=O.prototype.Lb;O.prototype.isNone=O.prototype.at;
O.prototype.isSide=O.prototype.nf;O.prototype.isNoSpot=O.prototype.mc;O.prototype.isSpot=O.prototype.ib;O.prototype.includesSide=O.prototype.mf;O.prototype.opposite=O.prototype.lv;O.prototype.equals=O.prototype.A;O.prototype.set=O.prototype.set;O.prototype.setTo=O.prototype.qg;var fe=[];O.className="Spot";O.parse=$d;O.stringify=ae;O.None=bd=Zd(new O(0,0,0,0),0).ga();O.Default=Hd=Zd(new O(0,0,-1,0),-1).ga();O.TopLeft=cd=(new O(0,0,0,0)).ga();O.TopCenter=dd=(new O(.5,0,0,0)).ga();
O.TopRight=ed=(new O(1,0,0,0)).ga();O.LeftCenter=fd=(new O(0,.5,0,0)).ga();O.Center=gd=(new O(.5,.5,0,0)).ga();O.RightCenter=hd=(new O(1,.5,0,0)).ga();O.BottomLeft=id=(new O(0,1,0,0)).ga();O.BottomCenter=od=(new O(.5,1,0,0)).ga();O.BottomRight=pd=(new O(1,1,0,0)).ga();O.MiddleTop=Td=dd;O.MiddleLeft=Ud=fd;O.MiddleRight=Vd=hd;O.MiddleBottom=Wd=od;O.Top=Rd=dd;O.Left=Id=fd;O.Right=Qd=hd;O.Bottom=Sd=od;O.TopSide=qd=Zd(new O(0,0,1,1),1).ga();O.LeftSide=rd=Zd(new O(0,0,1,2),1).ga();
O.RightSide=sd=Zd(new O(0,0,1,4),1).ga();O.BottomSide=td=Zd(new O(0,0,1,8),1).ga();O.TopBottomSides=ud=Zd(new O(0,0,1,9),1).ga();O.LeftRightSides=vd=Zd(new O(0,0,1,6),1).ga();O.TopLeftSides=yd=Zd(new O(0,0,1,3),1).ga();O.TopRightSides=zd=Zd(new O(0,0,1,5),1).ga();O.BottomLeftSides=Ad=Zd(new O(0,0,1,10),1).ga();O.BottomRightSides=Bd=Zd(new O(0,0,1,12),1).ga();O.NotTopSide=Cd=Zd(new O(0,0,1,14),1).ga();O.NotLeftSide=Dd=Zd(new O(0,0,1,13),1).ga();O.NotRightSide=Ed=Zd(new O(0,0,1,11),1).ga();
O.NotBottomSide=Fd=Zd(new O(0,0,1,7),1).ga();O.AllSides=Gd=Zd(new O(0,0,1,15),1).ga();Xd=(new O(.156,.156)).ga();Yd=(new O(.844,.844)).ga();O.parse=$d;O.stringify=ae;
var H={Nz:"7da71ca0ad381e90",ug:(Math.sqrt(2)-1)/3*4,$v:null,sqrt:function(a){if(0>=a)return 0;var b=H.$v;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);H.$v=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},w:function(a,b){a-=b;return.5>a&&-.5<a},ba:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Sb:function(a,b,c,d,e,f,g){0>=e&&(e=1E-6);if(a<c){var h=a;var k=c}else h=c,k=a;if(b<d){var l=b;var m=d}else l=d,m=b;if(a===c)return l<=g&&g<=m&&a-e<=f&&f<=a+e;if(b===d)return h<=
f&&f<=k&&b-e<=g&&g<=b+e;k+=e;h-=e;if(h<=f&&f<=k&&(m+=e,l-=e,l<=g&&g<=m))if(k-h>m-l)if(a-c>e||c-a>e){if(f=(d-b)/(c-a)*(f-a)+b,f-e<=g&&g<=f+e)return!0}else return!0;else if(b-d>e||d-b>e){if(g=(c-a)/(d-b)*(g-b)+a,g-e<=f&&f<=g+e)return!0}else return!0;return!1},Ds:function(a,b,c,d,e,f,g,h,k,l,m,n){if(H.Sb(a,b,g,h,n,c,d)&&H.Sb(a,b,g,h,n,e,f))return H.Sb(a,b,g,h,n,l,m);var p=(a+c)/2,q=(b+d)/2,r=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+r)/2;c=(q+u)/2;r=(r+e)/2;u=(u+f)/2;var v=(d+r)/2,x=(c+u)/2;return H.Ds(a,
b,p,q,d,c,v,x,k,l,m,n)||H.Ds(v,x,r,u,e,f,g,h,k,l,m,n)},jy:function(a,b,c,d,e,f,g,h,k){var l=(c+e)/2,m=(d+f)/2;k.h((((a+c)/2+l)/2+(l+(e+g)/2)/2)/2,(((b+d)/2+m)/2+(m+(f+h)/2)/2)/2);return k},iy:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return ac(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},Ml:function(a,b,c,d,e,f,g,h,k,l){if(H.Sb(a,b,g,h,k,c,d)&&H.Sb(a,b,g,h,k,e,f))Fc(l,a,b,0,0),Fc(l,g,h,0,0);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,q=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+q)/
2;p=(p+e)/2;q=(q+f)/2;var r=(d+p)/2,u=(c+q)/2;H.Ml(a,b,m,n,d,c,r,u,k,l);H.Ml(r,u,p,q,e,f,g,h,k,l)}return l},xe:function(a,b,c,d,e,f,g,h,k,l){if(H.Sb(a,b,g,h,k,c,d)&&H.Sb(a,b,g,h,k,e,f))0===l.length&&(l.push(a),l.push(b)),l.push(g),l.push(h);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,q=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+q)/2;p=(p+e)/2;q=(q+f)/2;var r=(d+p)/2,u=(c+q)/2;H.xe(a,b,m,n,d,c,r,u,k,l);H.xe(r,u,p,q,e,f,g,h,k,l)}return l},Qz:function(a,b,c,d,e,f,g,h,k,l,m,n,p,q){var r=1-k;a=a*r+c*k;b=b*
r+d*k;c=c*r+e*k;d=d*r+f*k;e=e*r+g*k;f=f*r+h*k;h=a*r+c*k;g=b*r+d*k;c=c*r+e*k;d=d*r+f*k;var u=h*r+c*k;k=g*r+d*k;l.h(a,b);m.h(h,g);n.h(u,k);p.h(c,d);q.h(e,f)},ov:function(a,b,c,d,e,f,g,h,k,l){if(H.Sb(a,b,e,f,l,c,d))return H.Sb(a,b,e,f,l,h,k);var m=(a+c)/2,n=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var p=(m+c)/2,q=(n+d)/2;return H.ov(a,b,m,n,p,q,g,h,k,l)||H.ov(p,q,c,d,e,f,g,h,k,l)},Xz:function(a,b,c,d,e,f,g){g.h(((a+c)/2+(c+e)/2)/2,((b+d)/2+(d+f)/2)/2);return g},nv:function(a,b,c,d,e,f,g,h){if(H.Sb(a,b,e,f,g,c,d))Fc(h,
a,b,0,0),Fc(h,e,f,0,0);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;H.nv(a,b,k,l,m,n,g,h);H.nv(m,n,c,d,e,f,g,h)}return h},eq:function(a,b,c,d,e,f,g,h){if(H.Sb(a,b,e,f,g,c,d))0===h.length&&(h.push(a),h.push(b)),h.push(e),h.push(f);else{var k=(a+c)/2,l=(b+d)/2;c=(c+e)/2;d=(d+f)/2;var m=(k+c)/2,n=(l+d)/2;H.eq(a,b,k,l,m,n,g,h);H.eq(m,n,c,d,e,f,g,h)}return h},Hp:function(a,b,c,d,e,f,g,h,k,l,m,n,p,q){if(H.Sb(a,b,g,h,p,c,d)&&H.Sb(a,b,g,h,p,e,f)){var r=(a-g)*(l-n)-(b-h)*(k-m);
if(0===r)return!1;p=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/r;r=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/r;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?g=b:(g=h,h=b),r<g||r>h)return!1}else if(a<g?h=a:(h=g,g=a),p<h||p>g)return!1;q.h(p,r);return!0}r=(a+c)/2;var u=(b+d)/2;c=(c+e)/2;d=(d+f)/2;e=(e+g)/2;f=(f+h)/2;var v=(r+c)/2,x=(u+d)/2;c=(c+e)/2;d=(d+f)/2;var y=(v+c)/2,z=(x+d)/2,B=(m-k)*(m-k)+(n-l)*(n-l),C=!1;H.Hp(a,b,r,u,v,x,y,z,k,l,m,n,p,q)&&(a=(q.x-k)*(q.x-k)+(q.y-l)*(q.y-l),a<B&&(B=a,C=!0));a=q.x;b=q.y;H.Hp(y,z,c,d,
e,f,g,h,k,l,m,n,p,q)&&((q.x-k)*(q.x-k)+(q.y-l)*(q.y-l)<B?C=!0:q.h(a,b));return C},Ip:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var q=0;if(H.Sb(a,b,g,h,p,c,d)&&H.Sb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return q;var r=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,u=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p;if(r>=m)return q;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(a=b,b=h):a=h,u<a||u>b)return q}else if(a<g?(b=a,a=g):b=g,r<b||r>a)return q;0<p?q++:0>p&&q--}else{r=(a+c)/2;u=(b+d)/2;var v=(c+e)/2,x=(d+f)/2;e=(e+
g)/2;f=(f+h)/2;d=(r+v)/2;c=(u+x)/2;v=(v+e)/2;x=(x+f)/2;var y=(d+v)/2,z=(c+x)/2;q+=H.Ip(a,b,r,u,d,c,y,z,k,l,m,n,p);q+=H.Ip(y,z,v,x,e,f,g,h,k,l,m,n,p)}return q},Ii:function(a,b,c,d,e,f,g){if(H.ba(a,c)){b<d?(c=b,b=d):c=d;if(f<c)return g.h(a,c),!1;if(f>b)return g.h(a,b),!1;g.h(a,f);return!0}if(H.ba(b,d)){a<c?(d=a,a=c):d=c;if(e<d)return g.h(d,b),!1;if(e>a)return g.h(a,b),!1;g.h(e,b);return!0}e=((a-e)*(a-c)+(b-f)*(b-d))/((c-a)*(c-a)+(d-b)*(d-b));if(-5E-6>e)return g.h(a,b),!1;if(1.000005<e)return g.h(c,
d),!1;g.h(a+e*(c-a),b+e*(d-b));return!0},Fe:function(a,b,c,d,e,f,g,h,k){if(H.w(a,c)&&H.w(b,d))return k.h(a,b),!1;if(H.ba(e,g))return H.ba(a,c)?(H.Ii(a,b,c,d,e,f,k),!1):H.Ii(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(H.ba(a,c)){c=h*(a-e)+f;b<d?(e=b,b=d):e=d;if(c<e)return k.h(a,e),!1;if(c>b)return k.h(a,b),!1;k.h(a,c);return!0}g=(d-b)/(c-a);if(H.ba(h,g))return H.Ii(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(H.ba(g,0)){a<c?(d=a,a=c):d=c;if(e<d)return k.h(d,b),!1;if(e>a)return k.h(a,b),!1;k.h(e,
b);return!0}return H.Ii(a,b,c,d,e,g*(e-a)+b,k)},Uz:function(a,b,c,d,e){return H.Fe(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},Tz:function(a,b,c,d,e,f,g,h,k,l){function m(c,d){var e=(c-a)*(c-a)+(d-b)*(d-b);e<n&&(n=e,k.h(c,d))}var n=Infinity;m(k.x,k.y);var p=0,q=0,r=0,u=0;e<g?(p=e,q=g):(p=g,q=e);f<h?(r=e,u=g):(r=g,u=e);p=(q-p)/2+l;l=(u-r)/2+l;e=(e+g)/2;f=(f+h)/2;if(0===p||0===l)return k;if(.5>(c>a?c-a:a-c)){p=1-(c-e)*(c-e)/(p*p);if(0>p)return k;p=Math.sqrt(p);d=-l*p+f;m(c,l*p+f);m(c,d)}else{c=(d-b)/(c-a);
d=1/(p*p)+c*c/(l*l);h=2*c*(b-c*a)/(l*l)-2*c*f/(l*l)-2*e/(p*p);p=h*h-4*d*(2*c*a*f/(l*l)-2*b*f/(l*l)+f*f/(l*l)+e*e/(p*p)-1+(b-c*a)*(b-c*a)/(l*l));if(0>p)return k;p=Math.sqrt(p);l=(-h+p)/(2*d);m(l,c*l-c*a+b);p=(-h-p)/(2*d);m(p,c*p-c*a+b)}return k},Uc:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(H.Fe(a,b,a,d,e,f,g,h,k)){var p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f);p<l&&(l=p,m=k.x,n=k.y)}H.Fe(c,b,c,d,e,f,g,h,k)&&(p=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),p<l&&(l=p,m=k.x,n=k.y));H.Fe(a,b,c,b,e,f,g,h,k)&&(b=(k.x-
e)*(k.x-e)+(k.y-f)*(k.y-f),b<l&&(l=b,m=k.x,n=k.y));H.Fe(a,d,c,d,e,f,g,h,k)&&(a=(k.x-e)*(k.x-e)+(k.y-f)*(k.y-f),a<l&&(l=a,m=k.x,n=k.y));k.h(m,n);return 1E21>l},Sz:function(a,b,c,d,e,f,g,h,k){c=a-c;g=e-g;0===c||0===g?0===c?(b=(f-h)/g,h=a,e=b*h+(f-b*e)):(f=(b-d)/c,h=e,e=f*h+(b-f*a)):(d=(b-d)/c,h=(f-h)/g,a=b-d*a,h=(f-h*e-a)/(d-h),e=d*h+a);k.h(h,e);return k},Ws:function(a,b,c){var d=b.x,e=b.y,f=c.x,g=c.y,h=a.left,k=a.right,l=a.top,m=a.bottom;return d===f?(e<g?(f=e,e=g):f=g,h<=d&&d<=k&&f<=m&&e>=l):e===
g?(d<f?(g=d,d=f):g=f,l<=e&&e<=m&&g<=k&&d>=h):a.ea(b)||a.ea(c)||H.Vs(h,l,k,l,d,e,f,g)||H.Vs(k,l,k,m,d,e,f,g)||H.Vs(k,m,h,m,d,e,f,g)||H.Vs(h,m,h,l,d,e,f,g)?!0:!1},Vs:function(a,b,c,d,e,f,g,h){return 0>=H.Gs(a,b,c,d,e,f)*H.Gs(a,b,c,d,g,h)&&0>=H.Gs(e,f,g,h,a,b)*H.Gs(e,f,g,h,c,d)},Gs:function(a,b,c,d,e,f){c-=a;d-=b;a=e-a;b=f-b;f=a*d-b*c;0===f&&(f=a*c+b*d,0<f&&(f=(a-c)*c+(b-d)*d,0>f&&(f=0)));return 0>f?-1:0<f?1:0},aq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},Xw:function(a,b,c,d,e,f){var g=Math.PI;
f||(d*=g/180,e*=g/180);var h=d>e?-1:1;f=[];var k=g/2,l=d;d=Math.min(2*g,Math.abs(e-d));if(1E-5>d)return k=l+h*Math.min(d,k),h=a+c*Math.cos(l),l=b+c*Math.sin(l),a+=c*Math.cos(k),b+=c*Math.sin(k),c=(h+a)/2,k=(l+b)/2,f.push([h,l,c,k,c,k,a,b]),f;for(;1E-5<d;)e=l+h*Math.min(d,k),f.push(H.qy(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},qy:function(a,b,c,d,e){var f=(c-b)/2,g=a*Math.cos(f),h=a*Math.sin(f),k=-h,l=g*g+k*k,m=l+g*g+k*h;l=4/3*(Math.sqrt(2*l*m)-m)/(g*h-k*g);h=g-l*k;g=k+l*g;k=-g;l=f+b;f=Math.cos(l);
l=Math.sin(l);return[d+a*Math.cos(b),e+a*Math.sin(b),d+h*f-g*l,e+h*l+g*f,d+h*f-k*l,e+h*l+k*f,d+a*Math.cos(c),e+a*Math.sin(c)]},Op:function(a,b,c,d,e,f,g){c=Math.floor((a-c)/e)*e+c;d=Math.floor((b-d)/f)*f+d;var h=c;c+e-a<e/2&&(h=c+e);a=d;d+f-b<f/2&&(a=d+f);g.h(h,a);return g},hx:function(a,b){var c=Math.max(a,b);a=Math.min(a,b);var d;do b=c%a,c=d=a,a=b;while(0<b);return d},wy:function(a,b,c,d){var e=0>c,f=0>d;if(a<b){var g=1;var h=0}else g=0,h=1;var k=0===g?a:b;var l=0===g?c:d;if(0===g?e:f)l=-l;g=h;
c=0===g?c:d;if(0===g?e:f)c=-c;return H.xy(k,0===g?a:b,l,c,0,0)},xy:function(a,b,c,d,e,f){if(0<d)if(0<c){e=a*a;f=b*b;a*=c;var g=b*d,h=-f+g,k=-f+Math.sqrt(a*a+g*g);b=h;for(var l=0;9999999999>l;++l){b=.5*(h+k);if(b===h||b===k)break;var m=a/(b+e),n=g/(b+f);m=m*m+n*n-1;if(0<m)h=b;else if(0>m)k=b;else break}c=e*c/(b+e)-c;d=f*d/(b+f)-d;c=Math.sqrt(c*c+d*d)}else c=Math.abs(d-b);else d=a*a-b*b,f=a*c,f<d?(d=f/d,f=b*Math.sqrt(Math.abs(1-d*d)),c=a*d-c,c=Math.sqrt(c*c+f*f)):c=Math.abs(c-a);return c},Je:new yb,
vm:new yb};H.za=H.Nz;function ge(a){tb(this);this.v=!1;void 0===a&&(a=he);this.va=a;this.Dc=this.pc=this.dd=this.cd=0;this.Yi=new E;this.er=this.Yi.Ba;this.Oq=(new N).freeze();this.ra=!0;this.Im=this.rk=null;this.Jm=NaN;this.af=cd;this.bf=pd;this.Uk=this.Wk=NaN;this.Af=ie}
ge.prototype.copy=function(){var a=new ge;a.va=this.va;a.cd=this.cd;a.dd=this.dd;a.pc=this.pc;a.Dc=this.Dc;for(var b=this.Yi.j,c=b.length,d=a.Yi,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.er=this.er;a.Oq.assign(this.Oq);a.ra=this.ra;a.rk=this.rk;a.Im=this.Im;a.Jm=this.Jm;a.af=this.af.I();a.bf=this.bf.I();a.Wk=this.Wk;a.Uk=this.Uk;a.Af=this.Af;return a};t=ge.prototype;t.ga=function(){this.freeze();Object.freeze(this);return this};
t.freeze=function(){this.v=!0;var a=this.figures;a.freeze();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;var a=this.figures;a.ha();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ha();return this};
t.Oa=function(a){if(!(a instanceof ge))return!1;if(this.type!==a.type)return this.type===je&&a.type===he?ke(this,a):a.type===je&&this.type===he?ke(a,this):!1;if(this.type===he){var b=this.figures.j;a=a.figures.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Oa(a[d]))return!1;return!0}return H.w(this.startX,a.startX)&&H.w(this.startY,a.startY)&&H.w(this.endX,a.endX)&&H.w(this.endY,a.endY)};
function ke(a,b){return a.type!==je||b.type!==he?!1:1===b.figures.count&&(b=b.figures.N(0),1===b.segments.count&&H.w(a.startX,b.startX)&&H.w(a.startY,b.startY)&&(b=b.segments.N(0),b.type===le&&H.w(a.endX,b.endX)&&H.w(a.endY,b.endY)))?!0:!1}function me(a){return a.toString()}t.hb=function(a){a.classType===ge&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case je:return 0>a?"M"+this.startX.toString()+" "+this.startY.toString()+"L"+this.endX.toString()+" "+this.endY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a)+"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);case ne:var b=new N(this.startX,this.startY,0,0);b.Pv(this.endX,this.endY,0,0);return 0>a?"M"+b.x.toString()+" "+b.y.toString()+"H"+b.right.toString()+"V"+b.bottom.toString()+"H"+b.left.toString()+"z":"M"+b.x.toFixed(a)+
" "+b.y.toFixed(a)+"H"+b.right.toFixed(a)+"V"+b.bottom.toFixed(a)+"H"+b.left.toFixed(a)+"z";case re:b=new N(this.startX,this.startY,0,0);b.Pv(this.endX,this.endY,0,0);if(0>a)return a=b.left.toString()+" "+(b.y+b.height/2).toString(),"M"+a+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+(b.right.toString()+" "+(b.y+b.height/2).toString())+"A"+(b.width/2).toString()+" "+(b.height/2).toString()+" 0 0 1 "+a;var c=b.left.toFixed(a)+" "+(b.y+b.height/2).toFixed(a);return"M"+c+"A"+(b.width/
2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+(b.right.toFixed(a)+" "+(b.y+b.height/2).toFixed(a))+"A"+(b.width/2).toFixed(a)+" "+(b.height/2).toFixed(a)+" 0 0 1 "+c;case he:b="";c=this.figures.j;for(var d=c.length,e=0;e<d;e++){var f=c[e];0<e&&(b+=" x ");f.isFilled&&(b+="F ");b+=f.toString(a)}return b;default:return this.type.toString()}};
function se(a,b){function c(){return u>=B-1?!0:null!==k[u+1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)}function d(){u++;return k[u]}function e(){var a=new G(parseFloat(d()),parseFloat(d()));v===v.toLowerCase()&&(a.x=z.x+a.x,a.y=z.y+a.y);return a}function f(){return z=e()}function g(){return y=e()}function h(){var a=x.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?z:new G(2*z.x-y.x,2*z.y-y.y)}void 0===b&&(b=!1);a=a.replace(/,/gm," ");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,
"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^\s])/gm,"$1 $2");a=a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 ");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var k=a.split(" ");for(a=0;a<k.length;a++){var l=k[a];if(null!==l.match(/(\.[0-9]*)(\.)/gm)){for(var m=
Ka(),n="",p=!1,q=0;q<l.length;q++){var r=l[q];"."!==r||p?"."===r?(m.push(n),n="."):n+=r:(p=!0,n+=r)}m.push(n);k.splice(a,1);for(l=0;l<m.length;l++)k.splice(a+l,0,m[l]);a+=m.length-1;Oa(m)}}var u=-1,v="",x="";m=new G(0,0);var y=new G(0,0),z=new G(0,0),B=k.length;a=te(null);n=l=!1;p=!0;for(q=null;!(u>=B-1);)if(x=v,v=d(),""!==v)switch(v.toUpperCase()){case "X":p=!0;n=l=!1;break;case "M":q=f();null===a.gc||!0===p?(ue(a,q.x,q.y,l,!n),p=!1):a.moveTo(q.x,q.y);for(m=z;!c();)q=f(),a.lineTo(q.x,q.y);break;
case "L":for(;!c();)q=f(),a.lineTo(q.x,q.y);break;case "H":for(;!c();)z=new G((v===v.toLowerCase()?z.x:0)+parseFloat(d()),z.y),a.lineTo(z.x,z.y);break;case "V":for(;!c();)z=new G(z.x,(v===v.toLowerCase()?z.y:0)+parseFloat(d())),a.lineTo(z.x,z.y);break;case "C":for(;!c();){q=e();r=g();var C=f();ve(a,q.x,q.y,r.x,r.y,C.x,C.y)}break;case "S":for(;!c();)q=h(),r=g(),C=f(),ve(a,q.x,q.y,r.x,r.y,C.x,C.y);break;case "Q":for(;!c();)q=g(),r=f(),we(a,q.x,q.y,r.x,r.y);break;case "T":for(;!c();)y=q=h(),r=f(),we(a,
q.x,q.y,r.x,r.y);break;case "B":for(;!c();){q=parseFloat(d());r=parseFloat(d());C=parseFloat(d());var I=parseFloat(d()),J=parseFloat(d()),K=J,X=!1;c()||(K=parseFloat(d()),c()||(X=0!==parseFloat(d())));v===v.toLowerCase()&&(C+=z.x,I+=z.y);a.arcTo(q,r,C,I,J,K,X)}break;case "A":for(;!c();)q=Math.abs(parseFloat(d())),r=Math.abs(parseFloat(d())),C=parseFloat(d()),I=!!parseFloat(d()),J=!!parseFloat(d()),K=f(),xe(a,q,r,C,I,J,K.x,K.y);break;case "Z":ye(a);z=m;break;case "F":q="";for(r=1;k[u+r];)if(null!==
k[u+r].match(/[Uu]/))r++;else if(null===k[u+r].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))r++;else{q=k[u+r];break}q.match(/[Mm]/)?l=!0:0<a.gc.segments.length&&(a.gc.isFilled=!0);break;case "U":q="";for(r=1;k[u+r];)if(null!==k[u+r].match(/[Ff]/))r++;else if(null===k[u+r].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))r++;else{q=k[u+r];break}q.match(/[Mm]/)?n=!0:a.lq(!1)}m=a.Qs;ze=a;if(b)for(b=m.figures.iterator;b.next();)b.value.isFilled=!0;return m}
function Ae(a,b){for(var c=a.length,d=G.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.ta(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.ta(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.ta(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.ta(d);f[6]=d.x;f[7]=d.y}G.free(d)}t.fv=function(){if(this.ra||this.er!==this.figures.Ba)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].fv())return!0;return!1};
ge.prototype.computeBounds=function(){this.ra=!1;this.Im=this.rk=null;this.Jm=NaN;this.er=this.figures.Ba;for(var a=this.figures.j,b=a.length,c=0;c<b;c++){var d=a[c];d.ra=!1;var e=d.segments;d.ns=e.Ba;d=e.j;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.ra=!1;g.Ke=null}}a=this.Oq;a.ha();isNaN(this.Wk)||isNaN(this.Uk)?a.h(0,0,0,0):a.h(0,0,this.Wk,this.Uk);Be(this,a,!1);Fc(a,0,0,0,0);a.freeze()};ge.prototype.Vw=function(){var a=new N;Be(this,a,!0);return a};
function Be(a,b,c){switch(a.type){case je:case ne:case re:c?b.h(a.cd,a.dd,0,0):Fc(b,a.cd,a.dd,0,0);Fc(b,a.pc,a.Dc,0,0);break;case he:var d=a.figures;a=d.j;d=d.length;for(var e=0;e<d;e++){var f=a[e];c&&0===e?b.h(f.startX,f.startY,0,0):Fc(b,f.startX,f.startY,0,0);for(var g=f.segments.j,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case le:case Ce:k=n.endX;l=n.endY;Fc(b,k,l,0,0);break;case De:H.Ml(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;
break;case Ee:H.nv(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case Fe:case Re:var p=n.type===Fe?Se(n,f):Te(n,f,k,l),q=p.length;if(0===q){k=n.centerX;l=n.centerY;Fc(b,k,l,0,0);break}n=null;for(var r=0;r<q;r++)n=p[r],H.Ml(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.5,b);null!==n&&(k=n[6],l=n[7]);break;default:A("Unknown Segment type: "+n.type)}}}break;default:A("Unknown Geometry type: "+a.type)}}
ge.prototype.normalize=function(){this.v&&wa(this);var a=this.Vw();this.offset(-a.x,-a.y);return new G(-a.x,-a.y)};ge.prototype.offset=function(a,b){this.v&&wa(this);this.transform(1,0,0,1,a,b);return this};ge.prototype.scale=function(a,b){this.v&&wa(this);this.transform(a,0,0,b,0,0);return this};ge.prototype.rotate=function(a,b,c){this.v&&wa(this);void 0===b&&(b=0);void 0===c&&(c=0);var d=Tc.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);Tc.free(d);return this};
t=ge.prototype;
t.transform=function(a,b,c,d,e,f){switch(this.type){case je:case ne:case re:var g=this.cd;var h=this.dd;this.cd=g*a+h*c+e;this.dd=g*b+h*d+f;g=this.pc;h=this.Dc;this.pc=g*a+h*c+e;this.Dc=g*b+h*d+f;break;case he:for(var k=this.figures.j,l=k.length,m=0;m<l;m++){var n=k[m];g=n.startX;h=n.startY;n.startX=g*a+h*c+e;n.startY=g*b+h*d+f;n=n.segments.j;for(var p=n.length,q=0;q<p;q++){var r=n[q];switch(r.type){case le:case Ce:g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;break;case De:g=r.point1X;h=r.point1Y;
r.point1X=g*a+h*c+e;r.point1Y=g*b+h*d+f;g=r.point2X;h=r.point2Y;r.point2X=g*a+h*c+e;r.point2Y=g*b+h*d+f;g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;break;case Ee:g=r.point1X;h=r.point1Y;r.point1X=g*a+h*c+e;r.point1Y=g*b+h*d+f;g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;break;case Fe:g=r.centerX;h=r.centerY;r.centerX=g*a+h*c+e;r.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),r.startAngle+=g);0>a&&(r.startAngle=180-r.startAngle,r.sweepAngle=-r.sweepAngle);0>d&&
(r.startAngle=-r.startAngle,r.sweepAngle=-r.sweepAngle);r.radiusX*=Math.sqrt(a*a+c*c);void 0!==r.radiusY&&(r.radiusY*=Math.sqrt(b*b+d*d));break;case Re:g=r.endX;h=r.endY;r.endX=g*a+h*c+e;r.endY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),r.xAxisRotation+=g);0>a&&(r.xAxisRotation=180-r.xAxisRotation,r.isClockwiseArc=!r.isClockwiseArc);0>d&&(r.xAxisRotation=-r.xAxisRotation,r.isClockwiseArc=!r.isClockwiseArc);r.radiusX*=Math.sqrt(a*a+c*c);r.radiusY*=Math.sqrt(b*b+d*d);break;default:A("Unknown Segment type: "+
r.type)}}}}this.ra=!0;return this};
t.ea=function(a,b,c,d){var e=a.x;a=a.y;for(var f=this.bounds.x-20,g=0,h,k,l,m,n,p=this.figures.j,q=p.length,r=0;r<q;r++){var u=p[r];if(u.isFilled){if(c&&u.ea(e,a,b))return!0;var v=u.segments;h=u.startX;k=u.startY;for(var x=h,y=k,z=v.j,B=0;B<=v.length;B++){var C=void 0;if(B!==v.length){C=z[B];var I=C.type;m=C.endX;n=C.endY}else I=le,m=x,n=y;switch(I){case Ce:x=Ue(e,a,f,a,h,k,x,y);if(isNaN(x))return!0;g+=x;x=m;y=n;break;case le:h=Ue(e,a,f,a,h,k,m,n);if(isNaN(h))return!0;g+=h;break;case De:l=H.Ip(h,
k,C.point1X,C.point1Y,C.point2X,C.point2Y,m,n,f,a,e,a,.5);g+=l;break;case Ee:l=H.Ip(h,k,(h+2*C.point1X)/3,(k+2*C.point1Y)/3,(2*C.point1X+m)/3,(2*C.point1Y+n)/3,m,n,f,a,e,a,.5);g+=l;break;case Fe:case Re:I=C.type===Fe?Se(C,u):Te(C,u,h,k);var J=I.length;if(0===J){h=Ue(e,a,f,a,h,k,C.centerX,C.centerY);if(isNaN(h))return!0;g+=h;break}C=null;for(var K=0;K<J;K++){C=I[K];if(0===K){l=Ue(e,a,f,a,h,k,C[0],C[1]);if(isNaN(l))return!0;g+=l}l=H.Ip(C[0],C[1],C[2],C[3],C[4],C[5],C[6],C[7],f,a,e,a,.5);g+=l}null!==
C&&(m=C[6],n=C[7]);break;default:A("Unknown Segment type: "+C.type)}h=m;k=n}if(0!==g)return!0;g=0}else if(u.ea(e,a,d?b:b+2))return!0}return 0!==g};function Ue(a,b,c,d,e,f,g,h){if(H.Sb(e,f,g,h,.05,a,b))return NaN;var k=(a-c)*(f-h);if(0===k)return 0;var l=((a*d-b*c)*(e-g)-(a-c)*(e*h-f*g))/k;b=(a*d-b*c)*(f-h)/k;if(l>=a)return 0;if((e>g?e-g:g-e)<(f>h?f-h:h-f))if(f<h){if(b<f||b>h)return 0}else{if(b<h||b>f)return 0}else if(e<g){if(l<e||l>g)return 0}else if(l<g||l>e)return 0;return 0<k?1:-1}
function Ve(a,b,c,d){a=a.figures.j;for(var e=a.length,f=0;f<e;f++)if(a[f].ea(b,c,d))return!0;return!1}
t.Vu=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new G);if(this.type===je)return b.h(this.startX+a*(this.endX-this.startX),this.startY+a*(this.endY-this.startY)),b;for(var c=this.flattenedSegments,d=this.flattenedLengths,e=c.length,f=this.flattenedTotalLength*a,g=0,h=0;h<e;h++){var k=d[h],l=k.length;for(a=0;a<l;a++){var m=k[a];if(g+m>=f)return d=(f-g)/m,c=c[h],e=c[2*a],h=c[2*a+1],b.h(e+(c[2*a+2]-e)*d,h+(c[2*a+3]-h)*d),b;g+=m}}b.h(NaN,NaN);return b};
t.ix=function(a){if(this.type===je){var b=this.startX,c=this.startY,d=this.endX,e=this.endY;if(b!==d||c!==e){var f=a.x;a=a.y;if(b===d){if(c<e){var g=c;d=e}else g=e,d=c;return a<=g?g===c?0:1:a>=d?d===c?0:1:Math.abs(a-c)/(d-g)}return c===e?(b<d?g=b:(g=d,d=b),f<=g?g===b?0:1:f>=d?d===b?0:1:Math.abs(f-b)/(d-g)):((f-b)*(f-b)+(a-c)*(a-c))/((d-b)*(d-b)+(e-c)*(e-c))}}else if(this.type===ne){g=this.startX;var h=this.startY,k=this.endX;e=this.endY;if(g!==k||h!==e){b=k-g;c=e-h;f=2*b+2*c;d=a.x;a=a.y;d=Math.min(Math.max(d,
g),k);a=Math.min(Math.max(a,h),e);g=Math.abs(d-g);k=Math.abs(d-k);h=Math.abs(a-h);e=Math.abs(a-e);var l=Math.min(g,k,h,e);if(l===h)return d/f;if(l===k)return(b+a)/f;if(l===e)return(2*b+c-d)/f;if(l===g)return(2*b+2*c-a)/f}}else{b=this.flattenedSegments;c=this.flattenedLengths;f=this.flattenedTotalLength;d=G.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],q=c[n],r=p.length,u=0;u<r;u+=2){var v=p[u],x=p[u+1];if(0!==u){H.Ii(l,m,v,x,a.x,a.y,d);var y=(d.x-a.x)*(d.x-a.x)+(d.y-
a.y)*(d.y-a.y);y<e&&(e=y,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=q[(u-2)/2]}l=v;m=x}G.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function We(a){if(null===a.rk){var b=a.rk=[],c=a.Im=[],d=[],e=[];if(a.type===je)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.endY),b.push(d),e.push(Math.sqrt((a.startX-a.endX)*(a.startX-a.endX)+(a.startY-a.endY)*(a.startY-a.endY))),c.push(e);else if(a.type===ne)d.push(a.startX),d.push(a.startY),d.push(a.endX),d.push(a.startY),d.push(a.endX),d.push(a.endY),d.push(a.startX),d.push(a.endY),d.push(a.startX),d.push(a.startY),b.push(d),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-
a.endY)),e.push(Math.abs(a.startX-a.endX)),e.push(Math.abs(a.startY-a.endY)),c.push(e);else if(a.type===re){var f=new Xe;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new Ye(Fe);g.startAngle=0;g.sweepAngle=360;g.centerX=(a.startX+a.endX)/2;g.centerY=(a.startY+a.endY)/2;g.radiusX=Math.abs(a.startX-a.endX)/2;g.radiusY=Math.abs(a.startY-a.endY)/2;f.add(g);a=Se(g,f);e=a.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else{g=f.startX;f=f.startY;for(var h=0;h<e;h++){var k=a[h];H.xe(g,f,k[2],k[3],
k[4],k[5],k[6],k[7],.5,d);g=k[6];f=k[7]}}b.push(d);c.push(Ze(d))}else for(a=a.figures.iterator;a.next();){e=a.value;d=[];d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;h=g;k=f;for(var l=e.segments.j,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case Ce:4<=d.length&&(b.push(d),c.push(Ze(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case le:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case De:H.xe(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,
.5,d);g=p.endX;f=p.endY;break;case Ee:H.eq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case Fe:var q=Se(p,e),r=q.length;if(0===r){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<r;u++){var v=q[u];H.xe(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d);g=v[6];f=v[7]}break;case Re:q=Te(p,e,g,f);r=q.length;if(0===r){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(u=0;u<r;u++)v=q[u],H.xe(g,f,v[2],v[3],v[4],v[5],v[6],v[7],.5,d),g=v[6],
f=v[7];break;default:A("Segment not of valid type: "+p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(Ze(d)))}}}function Ze(a){for(var b=[],c=0,d=0,e=a.length,f=0;f<e;f+=2){var g=a[f],h=a[f+1];0!==f&&b.push(Math.sqrt($b(c,d,g,h)));c=g;d=h}return b}t.add=function(a){this.Yi.add(a);return this};t.rm=function(a,b,c,d,e,f,g,h){this.v&&wa(this);this.af=(new O(a,b,e,f)).freeze();this.bf=(new O(c,d,g,h)).freeze();return this};
pa.Object.defineProperties(ge.prototype,{flattenedSegments:{get:function(){We(this);return this.rk}},flattenedLengths:{get:function(){We(this);return this.Im}},flattenedTotalLength:{get:function(){var a=this.Jm;if(isNaN(a)){if(this.type===je){a=Math.abs(this.endX-this.startX);var b=Math.abs(this.endY-this.startY);a=Math.sqrt(a*a+b*b)}else if(this.type===ne)a=2*Math.abs(this.endX-this.startX)+2*Math.abs(this.endY-
this.startY);else{b=this.flattenedLengths;for(var c=b.length,d=a=0;d<c;d++)for(var e=b[d],f=e.length,g=0;g<f;g++)a+=e[g]}this.Jm=a}return a}},type:{get:function(){return this.va},set:function(a){this.va!==a&&(this.v&&wa(this,a),this.va=a,this.ra=!0)}},startX:{get:function(){return this.cd},set:function(a){this.cd!==a&&(this.v&&wa(this,a),this.cd=a,this.ra=!0)}},startY:{get:function(){return this.dd},set:function(a){this.dd!==
a&&(this.v&&wa(this,a),this.dd=a,this.ra=!0)}},endX:{get:function(){return this.pc},set:function(a){this.pc!==a&&(this.v&&wa(this,a),this.pc=a,this.ra=!0)}},endY:{get:function(){return this.Dc},set:function(a){this.Dc!==a&&(this.v&&wa(this,a),this.Dc=a,this.ra=!0)}},figures:{get:function(){return this.Yi},set:function(a){this.Yi!==a&&(this.v&&wa(this,a),this.Yi=a,this.ra=!0)}},spot1:{
get:function(){return this.af},set:function(a){this.v&&wa(this,a);this.af=a.I()}},spot2:{get:function(){return this.bf},set:function(a){this.v&&wa(this,a);this.bf=a.I()}},defaultStretch:{get:function(){return this.Af},set:function(a){this.v&&wa(this,a);this.Af=a}},bounds:{get:function(){this.fv()&&this.computeBounds();return this.Oq}}});ge.prototype.setSpots=ge.prototype.rm;ge.prototype.add=ge.prototype.add;
ge.prototype.getFractionForPoint=ge.prototype.ix;ge.prototype.getPointAlongPath=ge.prototype.Vu;ge.prototype.transform=ge.prototype.transform;ge.prototype.rotate=ge.prototype.rotate;ge.prototype.scale=ge.prototype.scale;ge.prototype.offset=ge.prototype.offset;ge.prototype.normalize=ge.prototype.normalize;ge.prototype.computeBoundsWithoutOrigin=ge.prototype.Vw;ge.prototype.equalsApprox=ge.prototype.Oa;
var je=new D(ge,"Line",0),ne=new D(ge,"Rectangle",1),re=new D(ge,"Ellipse",2),he=new D(ge,"Path",3);ge.className="Geometry";ge.stringify=me;ge.fillPath=function(a){a=a.split(/[Xx]/);for(var b=a.length,c="",d=0;d<b;d++){var e=a[d];c=null!==e.match(/[Ff]/)?0===d?c+e:c+("X"+(" "===e[0]?"":" ")+e):c+((0===d?"":"X ")+"F"+(" "===e[0]?"":" ")+e)}return c};ge.parse=se;ge.Line=je;ge.Rectangle=ne;ge.Ellipse=re;ge.Path=he;
function Xe(a,b,c,d){tb(this);this.v=!1;void 0===c&&(c=!0);this.wr=c;void 0===d&&(d=!0);this.zr=d;void 0!==a?this.cd=a:this.cd=0;void 0!==b?this.dd=b:this.dd=0;this.sl=new E;this.ns=this.sl.Ba;this.ra=!0}Xe.prototype.copy=function(){var a=new Xe;a.wr=this.wr;a.zr=this.zr;a.cd=this.cd;a.dd=this.dd;for(var b=this.sl.j,c=b.length,d=a.sl,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.ns=this.ns;a.ra=this.ra;return a};t=Xe.prototype;
t.Oa=function(a){if(!(a instanceof Xe&&H.w(this.startX,a.startX)&&H.w(this.startY,a.startY)))return!1;var b=this.segments.j;a=a.segments.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Oa(a[d]))return!1;return!0};t.toString=function(a){void 0===a&&(a=-1);var b=0>a?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a);for(var c=this.segments.j,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b};
t.freeze=function(){this.v=!0;var a=this.segments;a.freeze();var b=a.j;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ha=function(){this.v=!1;var a=this.segments;a.ha();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ha();return this};t.fv=function(){if(this.ra)return!0;var a=this.segments;if(this.ns!==a.Ba)return!0;a=a.j;for(var b=a.length,c=0;c<b;c++)if(a[c].ra)return!0;return!1};t.add=function(a){this.sl.add(a);return this};
t.ea=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.j,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case Ce:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case le:if(H.Sb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case De:if(H.Ds(d,e,m.point1X,m.point1Y,m.point2X,m.point2Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Ee:if(H.ov(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case Fe:case Re:var n=m.type===
Fe?Se(m,this):Te(m,this,d,e),p=n.length;if(0===p){if(H.Sb(d,e,m.centerX,m.centerY,c,a,b))return!0;d=m.centerX;e=m.centerY;break}for(var q=null,r=0;r<p;r++)if(q=n[r],0===r&&H.Sb(d,e,q[0],q[1],c,a,b)||H.Ds(q[0],q[1],q[2],q[3],q[4],q[5],q[6],q[7],.5,a,b,c))return!0;null!==q&&(d=q[6],e=q[7]);break;default:A("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&H.Sb(d,e,f,g,c,a,b))return!0}return!1};
pa.Object.defineProperties(Xe.prototype,{isFilled:{get:function(){return this.wr},set:function(a){this.v&&wa(this,a);this.wr=a}},isShadowed:{get:function(){return this.zr},set:function(a){this.v&&wa(this,a);this.zr=a}},startX:{get:function(){return this.cd},set:function(a){this.v&&wa(this,a);this.cd=a;this.ra=!0}},startY:{get:function(){return this.dd},set:function(a){this.v&&wa(this,
a);this.dd=a;this.ra=!0}},segments:{get:function(){return this.sl},set:function(a){this.v&&wa(this,a);this.sl=a;this.ra=!0}}});Xe.prototype.add=Xe.prototype.add;Xe.prototype.equalsApprox=Xe.prototype.Oa;Xe.className="PathFigure";
function Ye(a,b,c,d,e,f,g,h){tb(this);this.v=!1;void 0===a&&(a=le);this.va=a;void 0!==b?this.pc=b:this.pc=0;void 0!==c?this.Dc=c:this.Dc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===Re?(a=f%360,0>a&&(a+=360),this.qe=a,this.ii=0,this.ji=Math.max(d,0),this.Vg=Math.max(e,0),this.$k="boolean"===typeof g?!!g:!1,this.wk=!!h):(this.qe=d,this.ii=e,a===Fe&&(f=Math.max(f,0)),this.ji=f,"number"===typeof g?(a===Fe&&(g=Math.max(g,0)),this.Vg=g):this.Vg=0,this.wk=this.$k=!1);this.dj=
!1;this.ra=!0;this.Ke=null}Ye.prototype.copy=function(){var a=new Ye;a.va=this.va;a.pc=this.pc;a.Dc=this.Dc;a.qe=this.qe;a.ii=this.ii;a.ji=this.ji;a.Vg=this.Vg;a.$k=this.$k;a.wk=this.wk;a.dj=this.dj;a.ra=this.ra;return a};t=Ye.prototype;
t.Oa=function(a){if(!(a instanceof Ye)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Ce:case le:return H.w(this.endX,a.endX)&&H.w(this.endY,a.endY);case De:return H.w(this.endX,a.endX)&&H.w(this.endY,a.endY)&&H.w(this.point1X,a.point1X)&&H.w(this.point1Y,a.point1Y)&&H.w(this.point2X,a.point2X)&&H.w(this.point2Y,a.point2Y);case Ee:return H.w(this.endX,a.endX)&&H.w(this.endY,a.endY)&&H.w(this.point1X,a.point1X)&&H.w(this.point1Y,a.point1Y);case Fe:return H.w(this.startAngle,
a.startAngle)&&H.w(this.sweepAngle,a.sweepAngle)&&H.w(this.centerX,a.centerX)&&H.w(this.centerY,a.centerY)&&H.w(this.radiusX,a.radiusX)&&H.w(this.radiusY,a.radiusY);case Re:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&H.w(this.xAxisRotation,a.xAxisRotation)&&H.w(this.endX,a.endX)&&H.w(this.endY,a.endY)&&H.w(this.radiusX,a.radiusX)&&H.w(this.radiusY,a.radiusY);default:return!1}};t.hb=function(a){a.classType===Ye&&(this.type=a)};
t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Ce:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case le:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case De:a=0>a?"C"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.point2X.toString()+" "+this.point2Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"C"+this.point1X.toFixed(a)+
" "+this.point1Y.toFixed(a)+" "+this.point2X.toFixed(a)+" "+this.point2Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Ee:a=0>a?"Q"+this.point1X.toString()+" "+this.point1Y.toString()+" "+this.endX.toString()+" "+this.endY.toString():"Q"+this.point1X.toFixed(a)+" "+this.point1Y.toFixed(a)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Fe:a=0>a?"B"+this.startAngle.toString()+" "+this.sweepAngle.toString()+" "+this.centerX.toString()+" "+this.centerY.toString()+
" "+this.radiusX.toString()+" "+this.radiusY.toString():"B"+this.startAngle.toFixed(a)+" "+this.sweepAngle.toFixed(a)+" "+this.centerX.toFixed(a)+" "+this.centerY.toFixed(a)+" "+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a);break;case Re:a=0>a?"A"+this.radiusX.toString()+" "+this.radiusY.toString()+" "+this.xAxisRotation.toString()+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toString()+" "+this.endY.toString():"A"+this.radiusX.toFixed(a)+" "+this.radiusY.toFixed(a)+
" "+this.xAxisRotation.toFixed(a)+" "+(this.isLargeArc?1:0)+" "+(this.isClockwiseArc?1:0)+" "+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;default:a=this.type.toString()}return a+(this.dj?"z":"")};t.freeze=function(){this.v=!0;return this};t.ha=function(){this.v=!1;return this};t.close=function(){this.dj=!0;return this};
function Se(a,b){if(null!==a.Ke&&!1===b.ra)return a.Ke;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Ke=[],a.Ke;b=a.qe;var e=a.ii,f=H.Xw(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=Tc.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);Ae(f,g);Tc.free(g)}c=f.length;for(d=0;d<c;d++)g=f[d],g[0]+=b,g[1]+=e,g[2]+=b,g[3]+=e,g[4]+=b,g[5]+=e,g[6]+=b,g[7]+=e;a.Ke=f;return a.Ke}
function Te(a,b,c,d){function e(a,b,c,d){return(a*d<b*c?-1:1)*Math.acos((a*c+b*d)/(Math.sqrt(a*a+b*b)*Math.sqrt(c*c+d*d)))}if(null!==a.Ke&&!1===b.ra)return a.Ke;b=a.ji;var f=a.Vg;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.qe,h=a.$k,k=a.wk,l=a.pc,m=a.Dc,n=Math.cos(g),p=Math.sin(g),q=n*(c-l)/2+p*(d-m)/2;g=-p*(c-l)/2+n*(d-m)/2;var r=q*q/(b*b)+g*g/(f*f);1<r&&(b*=Math.sqrt(r),f*=Math.sqrt(r));r=(h===k?-1:1)*Math.sqrt((b*b*f*f-b*b*g*g-f*f*q*q)/(b*b*g*g+f*f*q*q));isNaN(r)&&(r=0);h=r*b*g/f;r=r*-f*
q/b;isNaN(h)&&(h=0);isNaN(r)&&(r=0);c=(c+l)/2+n*h-p*r;d=(d+m)/2+p*h+n*r;m=e(1,0,(q-h)/b,(g-r)/f);n=(q-h)/b;l=(g-r)/f;q=(-q-h)/b;h=(-g-r)/f;g=e(n,l,q,h);q=(n*q+l*h)/(Math.sqrt(n*n+l*l)*Math.sqrt(q*q+h*h));-1>=q?g=Math.PI:1<=q&&(g=0);!k&&0<g&&(g-=2*Math.PI);k&&0>g&&(g+=2*Math.PI);k=b>f?1:b/f;q=b>f?f/b:1;b=H.Xw(0,0,b>f?b:f,m,m+g,!0);f=Tc.alloc();f.reset();f.translate(c,d);f.rotate(a.qe,0,0);f.scale(k,q);Ae(b,f);Tc.free(f);a.Ke=b;return a.Ke}
pa.Object.defineProperties(Ye.prototype,{isClosed:{get:function(){return this.dj},set:function(a){this.dj!==a&&(this.dj=a,this.ra=!0)}},type:{get:function(){return this.va},set:function(a){this.v&&wa(this,a);this.va=a;this.ra=!0}},endX:{get:function(){return this.pc},set:function(a){this.v&&wa(this,a);this.pc=a;this.ra=!0}},endY:{get:function(){return this.Dc},set:function(a){this.v&&
wa(this,a);this.Dc=a;this.ra=!0}},point1X:{get:function(){return this.qe},set:function(a){this.v&&wa(this,a);this.qe=a;this.ra=!0}},point1Y:{get:function(){return this.ii},set:function(a){this.v&&wa(this,a);this.ii=a;this.ra=!0}},point2X:{get:function(){return this.ji},set:function(a){this.v&&wa(this,a);this.ji=a;this.ra=!0}},point2Y:{get:function(){return this.Vg},set:function(a){this.v&&
wa(this,a);this.Vg=a;this.ra=!0}},centerX:{get:function(){return this.qe},set:function(a){this.v&&wa(this,a);this.qe=a;this.ra=!0}},centerY:{get:function(){return this.ii},set:function(a){this.v&&wa(this,a);this.ii=a;this.ra=!0}},radiusX:{get:function(){return this.ji},set:function(a){0>a&&xa(a,">= zero",Ye,"radiusX");this.v&&wa(this,a);this.ji=a;this.ra=!0}},radiusY:{get:function(){return this.Vg},
set:function(a){0>a&&xa(a,">= zero",Ye,"radiusY");this.v&&wa(this,a);this.Vg=a;this.ra=!0}},startAngle:{get:function(){return this.pc},set:function(a){this.pc!==a&&(this.v&&wa(this,a),a%=360,0>a&&(a+=360),this.pc=a,this.ra=!0)}},sweepAngle:{get:function(){return this.Dc},set:function(a){this.v&&wa(this,a);360<a&&(a=360);-360>a&&(a=-360);this.Dc=a;this.ra=!0}},isClockwiseArc:{get:function(){return this.wk},set:function(a){this.v&&
wa(this,a);this.wk=a;this.ra=!0}},isLargeArc:{get:function(){return this.$k},set:function(a){this.v&&wa(this,a);this.$k=a;this.ra=!0}},xAxisRotation:{get:function(){return this.qe},set:function(a){a%=360;0>a&&(a+=360);this.v&&wa(this,a);this.qe=a;this.ra=!0}}});Ye.prototype.equalsApprox=Ye.prototype.Oa;
var Ce=new D(Ye,"Move",0),le=new D(Ye,"Line",1),De=new D(Ye,"Bezier",2),Ee=new D(Ye,"QuadraticBezier",3),Fe=new D(Ye,"Arc",4),Re=new D(Ye,"SvgArc",4);Ye.className="PathSegment";Ye.Move=Ce;Ye.Line=le;Ye.Bezier=De;Ye.QuadraticBezier=Ee;Ye.Arc=Fe;Ye.SvgArc=Re;function $e(){this.F=null;this.wu=(new G(0,0)).freeze();this.Pt=(new G(0,0)).freeze();this.Hq=this.Or=0;this.Iq=1;this.Dr="";this.ys=this.Yq=!1;this.Xq=this.Kq=0;this.xg=this.kr=this.xr=!1;this.dr=null;this.ws=0;this.Qd=this.vs=null}
$e.prototype.copy=function(){var a=new $e;return this.clone(a)};$e.prototype.clone=function(a){a.F=this.F;a.wu.assign(this.viewPoint);a.Pt.assign(this.documentPoint);a.Or=this.Or;a.Hq=this.Hq;a.Iq=this.Iq;a.Dr=this.Dr;a.Yq=this.Yq;a.ys=this.ys;a.Kq=this.Kq;a.Xq=this.Xq;a.xr=this.xr;a.kr=this.kr;a.xg=this.xg;a.dr=this.dr;a.ws=this.ws;a.vs=this.vs;a.Qd=this.Qd;return a};
$e.prototype.toString=function(){var a="^";0!==this.modifiers&&(a+="M:"+this.modifiers);0!==this.button&&(a+="B:"+this.button);""!==this.key&&(a+="K:"+this.key);0!==this.clickCount&&(a+="C:"+this.clickCount);0!==this.delta&&(a+="D:"+this.delta);this.handled&&(a+="h");this.bubbles&&(a+="b");null!==this.documentPoint&&(a+="@"+this.documentPoint.toString());return a};$e.prototype.Rp=function(a,b){var c=this.diagram;if(null===c)return b;af(c,this.event,a,b);return b};
$e.prototype.Wy=function(a,b){var c=this.diagram;if(null===c)return b;af(c,this.event,a,b);b.assign(c.vt(b));return b};
pa.Object.defineProperties($e.prototype,{diagram:{get:function(){return this.F},set:function(a){this.F=a}},viewPoint:{get:function(){return this.wu},set:function(a){this.wu.assign(a)}},documentPoint:{get:function(){return this.Pt},set:function(a){this.Pt.assign(a)}},modifiers:{get:function(){return this.Or},set:function(a){this.Or=a}},button:{get:function(){return this.Hq},
set:function(a){this.Hq=a;if(null===this.event)switch(a){case 0:this.buttons=1;break;case 1:this.buttons=4;break;case 2:this.buttons=2}}},buttons:{get:function(){return this.Iq},set:function(a){this.Iq=a}},key:{get:function(){return this.Dr},set:function(a){this.Dr=a}},down:{get:function(){return this.Yq},set:function(a){this.Yq=a}},up:{get:function(){return this.ys},set:function(a){this.ys=
a}},clickCount:{get:function(){return this.Kq},set:function(a){this.Kq=a}},delta:{get:function(){return this.Xq},set:function(a){this.Xq=a}},isMultiTouch:{get:function(){return this.xr},set:function(a){this.xr=a}},handled:{get:function(){return this.kr},set:function(a){this.kr=a}},bubbles:{get:function(){return this.xg},set:function(a){this.xg=a}},event:{
get:function(){return this.dr},set:function(a){this.dr=a}},isTouchEvent:{get:function(){var a=w.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=w.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{get:function(){return this.ws},set:function(a){this.ws=a}},targetDiagram:{get:function(){return this.vs},set:function(a){this.vs=a}},targetObject:{
get:function(){return this.Qd},set:function(a){this.Qd=a}},control:{get:function(){return 0!==(this.modifiers&1)},set:function(a){this.modifiers=a?this.modifiers|1:this.modifiers&-2}},shift:{get:function(){return 0!==(this.modifiers&4)},set:function(a){this.modifiers=a?this.modifiers|4:this.modifiers&-5}},alt:{get:function(){return 0!==(this.modifiers&2)},set:function(a){this.modifiers=a?this.modifiers|
2:this.modifiers&-3}},meta:{get:function(){return 0!==(this.modifiers&8)},set:function(a){this.modifiers=a?this.modifiers|8:this.modifiers&-9}},left:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&1):0===this.button},set:function(a){this.buttons=a?this.buttons|1:this.buttons&-2}},right:{get:function(){var a=
this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&2):2===this.button},set:function(a){this.buttons=a?this.buttons|2:this.buttons&-3}},middle:{get:function(){var a=this.event;return null===a||"mousedown"!==a.type&&"mouseup"!==a.type&&"pointerdown"!==a.type&&"pointerup"!==a.type?0!==(this.buttons&4):1===this.button},set:function(a){this.buttons=a?this.buttons|4:this.buttons&-5}}});
$e.prototype.getMultiTouchDocumentPoint=$e.prototype.Wy;$e.prototype.getMultiTouchViewPoint=$e.prototype.Rp;$e.className="InputEvent";function bf(){this.F=null;this.Ta="";this.Xr=this.us=null}bf.prototype.copy=function(){var a=new bf;a.F=this.F;a.Ta=this.Ta;a.us=this.us;a.Xr=this.Xr;return a};bf.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a};
pa.Object.defineProperties(bf.prototype,{diagram:{get:function(){return this.F},set:function(a){this.F=a}},name:{get:function(){return this.Ta},set:function(a){this.Ta=a}},subject:{get:function(){return this.us},set:function(a){this.us=a}},parameter:{get:function(){return this.Xr},set:function(a){this.Xr=a}}});bf.className="DiagramEvent";
function cf(){this.Qm=df;this.vj=this.Nr="";this.to=this.uo=this.zo=this.Ao=this.yo=this.F=this.Zb=null}cf.prototype.clear=function(){this.to=this.uo=this.zo=this.Ao=this.yo=this.F=this.Zb=null};
cf.prototype.copy=function(){var a=new cf;a.Qm=this.Qm;a.Nr=this.Nr;a.vj=this.vj;a.Zb=this.Zb;a.F=this.F;a.yo=this.yo;var b=this.Ao;a.Ao=Aa(b)&&"function"===typeof b.I?b.I():b;b=this.zo;a.zo=Aa(b)&&"function"===typeof b.I?b.I():b;b=this.uo;a.uo=Aa(b)&&"function"===typeof b.I?b.I():b;b=this.to;a.to=Aa(b)&&"function"===typeof b.I?b.I():b;return a};cf.prototype.hb=function(a){a.classType===cf&&(this.change=a)};
cf.prototype.toString=function(){var a="";a=this.change===ef?a+"* ":this.change===df?a+(null!==this.model?"!m":"!d"):a+((null!==this.model?"!m":"!d")+this.change);this.propertyName&&"string"===typeof this.propertyName&&(a+=" "+this.propertyName);this.modelChange&&this.modelChange!==this.propertyName&&(a+=" "+this.modelChange);a+=": ";this.change===ef?null!==this.oldValue&&(a+=" "+this.oldValue):(null!==this.object&&(a+=Qa(this.object)),null!==this.oldValue&&(a+=" old: "+Qa(this.oldValue)),null!==
this.oldParam&&(a+=" "+this.oldParam),null!==this.newValue&&(a+=" new: "+Qa(this.newValue)),null!==this.newParam&&(a+=" "+this.newParam));return a};cf.prototype.J=function(a){return a?this.oldValue:this.newValue};cf.prototype.Yy=function(a){return a?this.oldParam:this.newParam};cf.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1};cf.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.Ij(this,!0):null!==this.diagram&&this.diagram.Ij(this,!0))};
cf.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};cf.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.Ij(this,!1):null!==this.diagram&&this.diagram.Ij(this,!1))};
pa.Object.defineProperties(cf.prototype,{model:{get:function(){return this.Zb},set:function(a){this.Zb=a}},diagram:{get:function(){return this.F},set:function(a){this.F=a}},change:{get:function(){return this.Qm},set:function(a){this.Qm=a}},modelChange:{get:function(){return this.Nr},set:function(a){this.Nr=a}},propertyName:{get:function(){return this.vj},
set:function(a){this.vj=a}},isTransactionFinished:{get:function(){return this.Qm===ef&&("CommittedTransaction"===this.vj||"FinishedUndo"===this.vj||"FinishedRedo"===this.vj)}},object:{get:function(){return this.yo},set:function(a){this.yo=a}},oldValue:{get:function(){return this.Ao},set:function(a){this.Ao=a}},oldParam:{get:function(){return this.zo},set:function(a){this.zo=a}},
newValue:{get:function(){return this.uo},set:function(a){this.uo=a}},newParam:{get:function(){return this.to},set:function(a){this.to=a}}});cf.prototype.redo=cf.prototype.redo;cf.prototype.canRedo=cf.prototype.canRedo;cf.prototype.undo=cf.prototype.undo;cf.prototype.canUndo=cf.prototype.canUndo;cf.prototype.getParam=cf.prototype.Yy;cf.prototype.getValue=cf.prototype.J;cf.prototype.clear=cf.prototype.clear;
var ef=new D(cf,"Transaction",-1),df=new D(cf,"Property",0),hf=new D(cf,"Insert",1),jf=new D(cf,"Remove",2);cf.className="ChangedEvent";cf.Transaction=ef;cf.Property=df;cf.Insert=hf;cf.Remove=jf;function kf(){this.u=(new E).freeze();this.Ta="";this.l=!1}kf.prototype.toString=function(a){var b="Transaction: "+this.name+" "+this.changes.count.toString()+(this.isComplete?"":", incomplete");if(void 0!==a&&0<a){a=this.changes.count;for(var c=0;c<a;c++){var d=this.changes.N(c);null!==d&&(b+="\n "+d.toString())}}return b};
kf.prototype.clear=function(){var a=this.changes;a.ha();for(var b=a.count-1;0<=b;b--){var c=a.N(b);null!==c&&c.clear()}a.clear();a.freeze()};kf.prototype.canUndo=function(){return this.isComplete};kf.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.N(a);null!==b&&b.undo()}};kf.prototype.canRedo=function(){return this.isComplete};
kf.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.N(b);null!==c&&c.redo()}};pa.Object.defineProperties(kf.prototype,{changes:{get:function(){return this.u}},name:{get:function(){return this.Ta},set:function(a){this.Ta=a}},isComplete:{get:function(){return this.l},set:function(a){this.l=a}}});kf.prototype.redo=kf.prototype.redo;kf.prototype.canRedo=kf.prototype.canRedo;
kf.prototype.undo=kf.prototype.undo;kf.prototype.canUndo=kf.prototype.canUndo;kf.prototype.clear=kf.prototype.clear;kf.className="Transaction";function lf(){this.eu=new F;this.Oc=!1;this.K=(new E).freeze();this.de=-1;this.u=999;this.ge=!1;this.Vq=null;this.ui=0;this.l=!1;this.ne=(new E).freeze();this.jl=new E;this.Wt=!0;this.Zt=!1}t=lf.prototype;
t.toString=function(a){var b="UndoManager "+this.historyIndex+"<"+this.history.count+"<="+this.maxHistoryLength;b+="[";for(var c=this.nestedTransactionNames.count,d=0;d<c;d++)0<d&&(b+=" "),b+=this.nestedTransactionNames.N(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.N(d).toString(a-1);return b};
t.clear=function(){var a=this.history;a.ha();for(var b=a.count-1;0<=b;b--){var c=a.N(b);null!==c&&c.clear()}a.clear();this.de=-1;a.freeze();this.ge=!1;this.Vq=null;this.ui=0;this.ne.ha();this.ne.clear();this.ne.freeze();this.jl.clear()};t.Nw=function(a){this.eu.add(a)};t.xx=function(a){this.eu.remove(a)};
t.Aa=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Wt&&(this.Wt=!1,this.ui++,this.zb("StartingFirstTransaction",a,this.currentTransaction),0<this.ui&&this.ui--);this.isEnabled&&(this.ne.ha(),this.ne.add(a),this.ne.freeze(),null===this.currentTransaction?this.jl.add(0):this.jl.add(this.currentTransaction.changes.count));this.ui++;var b=1===this.transactionLevel;b&&this.zb("StartedTransaction",a,this.currentTransaction);return b};
t.ab=function(a){void 0===a&&(a="");return mf(this,!0,a)};t.rf=function(){return mf(this,!1,"")};
function mf(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&ya("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel;d&&b&&a.zb("CommittingTransaction",c,a.currentTransaction);var e=0;if(0<a.transactionLevel&&(a.ui--,a.isEnabled)){var f=a.ne.count;0<f&&(""===c&&(c=a.ne.N(0)),a.ne.ha(),a.ne.nb(f-1),a.ne.freeze());f=a.jl.count;0<f&&(e=a.jl.N(f-1),a.jl.nb(f-1))}f=a.currentTransaction;if(d){if(b){a.Zt=!1;if(a.isEnabled&&null!==
f){b=f;b.isComplete=!0;b.name=c;d=a.history;d.ha();for(e=d.count-1;e>a.historyIndex;e--)f=d.N(e),null!==f&&f.clear(),d.nb(e),a.Zt=!0;e=a.maxHistoryLength;0===e&&(e=1);0<e&&d.count>=e&&(e=d.N(0),null!==e&&e.clear(),d.nb(0),a.de--);d.add(b);a.de++;d.freeze();f=b}a.zb("CommittedTransaction",c,f)}else{a.ge=!0;try{a.isEnabled&&null!==f&&(f.isComplete=!0,f.undo())}finally{a.zb("RolledBackTransaction",c,f),a.ge=!1}null!==f&&f.clear()}a.Vq=null;return!0}if(a.isEnabled&&!b&&null!==f){a=e;c=f.changes;for(b=
c.count-1;b>=a;b--)d=c.N(b),null!==d&&d.undo(),c.ha(),c.nb(b);c.freeze()}return!1}lf.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1};lf.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.ge=!0,this.zb("StartingUndo","Undo",a),this.de--,a.undo()}catch(b){ya("undo error: "+b.toString())}finally{this.zb("FinishedUndo","Undo",a),this.ge=!1}}};
lf.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1};lf.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.ge=!0,this.zb("StartingRedo","Redo",a),this.de++,a.redo()}catch(b){ya("redo error: "+b.toString())}finally{this.zb("FinishedRedo","Redo",a),this.ge=!1}}};
lf.prototype.zb=function(a,b,c){void 0===c&&(c=null);var d=new cf;d.change=ef;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.Es(d)};
lf.prototype.Yu=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Vq=b=new kf);var c=a.copy();b=b.changes;b.ha();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Wt&&(a=a.diagram,null!==a&&!1===a.Xj||ya("Change not within a transaction: "+c.toString()))}};
lf.prototype.skipsEvent=function(a){if(null===a||0>a.change.value)return!0;a=a.object;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1};
pa.Object.defineProperties(lf.prototype,{models:{get:function(){return this.eu.iterator}},isEnabled:{get:function(){return this.Oc},set:function(a){this.Oc=a}},transactionToUndo:{get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.N(this.historyIndex):null}},transactionToRedo:{get:function(){return this.historyIndex<this.history.count-
1?this.history.N(this.historyIndex+1):null}},isUndoingRedoing:{get:function(){return this.ge}},history:{get:function(){return this.K}},maxHistoryLength:{get:function(){return this.u},set:function(a){this.u=a}},historyIndex:{get:function(){return this.de}},currentTransaction:{get:function(){return this.Vq}},transactionLevel:{
get:function(){return this.ui}},isInTransaction:{get:function(){return 0<this.ui}},checksTransactionLevel:{get:function(){return this.l},set:function(a){this.l=a}},nestedTransactionNames:{get:function(){return this.ne}}});lf.prototype.handleChanged=lf.prototype.Yu;lf.prototype.redo=lf.prototype.redo;lf.prototype.undo=lf.prototype.undo;lf.prototype.canUndo=lf.prototype.canUndo;
lf.prototype.rollbackTransaction=lf.prototype.rf;lf.prototype.commitTransaction=lf.prototype.ab;lf.prototype.startTransaction=lf.prototype.Aa;lf.prototype.removeModel=lf.prototype.xx;lf.prototype.addModel=lf.prototype.Nw;lf.prototype.clear=lf.prototype.clear;lf.className="UndoManager";function nf(){tb(this);this.F=of;this.Ta="";this.Oc=!0;this.Tb=!1;this.Zv=null;this.Yx=new $e;this.Bs=-1}nf.prototype.ob=function(a){this.F=a};
nf.prototype.toString=function(){return""!==this.name?this.name+" Tool":Pa(this.constructor)};nf.prototype.updateAdornments=function(){};nf.prototype.canStart=function(){return this.isEnabled};nf.prototype.doStart=function(){};nf.prototype.doActivate=function(){this.isActive=!0};nf.prototype.doDeactivate=function(){this.isActive=!1};nf.prototype.doStop=function(){};nf.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};
nf.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};nf.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};nf.prototype.doMouseMove=function(){};nf.prototype.doMouseUp=function(){this.stopTool()};nf.prototype.doMouseWheel=function(){};nf.prototype.canStartMultiTouch=function(){return!0};
nf.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.Rp(0,G.allocAt(NaN,NaN)),d=b.Rp(1,G.allocAt(NaN,NaN));if(c.s()&&d.s()&&(this.doCancel(),a.Wl("hasGestureZoom"))){a.Bo=a.scale;var e=d.x-c.x,f=d.y-c.y;a.Dw=Math.sqrt(e*e+f*f);b.bubbles=!1}G.free(c);G.free(d)};
nf.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.Rp(0,G.allocAt(NaN,NaN)),d=b.Rp(1,G.allocAt(NaN,NaN));if(c.s()&&d.s()&&(this.doCancel(),a.Wl("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.Dw;e=new G((Math.min(d.x,c.x)+Math.max(d.x,c.x))/2,(Math.min(d.y,c.y)+Math.max(d.y,c.y))/2);f*=a.Bo;var g=a.commandHandler;if(f!==a.scale&&g.canResetZoom(f)){var h=a.zoomPoint;a.zoomPoint=e;g.resetZoom(f);a.zoomPoint=h}b.bubbles=!1}G.free(c);G.free(d)};
nf.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};nf.prototype.doKeyUp=function(){};nf.prototype.Aa=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.Aa(a)};nf.prototype.sg=function(){var a=this.diagram;return null===this.transactionResult?a.rf():a.ab(this.transactionResult)};
nf.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.Ul(b.documentPoint,!1);if(null!==c)if(ib?b.meta:b.control){a.aa("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.aa("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.aa("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.aa("ChangedSelection",
a.selection)}}else{if(!c.isSelected){for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&a.select(b)}}else!b.left||(ib?b.meta:b.control)||b.shift||a.Fs()}};nf.prototype.standardMouseClick=function(a,b){void 0===a&&(a=null);void 0===b&&(b=function(a){return!a.layer.isTemporary});var c=this.diagram,d=c.lastInput;a=c.Rb(d.documentPoint,a,b);d.targetObject=a;pf(a,d,c);return d.handled};
function pf(a,b,c){b.handled=!1;if(null===a||a.og()){var d=0;b.left?d=1===b.clickCount?1:2===b.clickCount?2:1:b.right&&1===b.clickCount&&(d=3);var e="";if(null!==a){switch(d){case 1:e="ObjectSingleClicked";break;case 2:e="ObjectDoubleClicked";break;case 3:e="ObjectContextClicked"}0!==d&&c.aa(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.aa(e)}if(null!==a)for(;null!==a;){c=null;switch(d){case 1:c=a.click;
break;case 2:c=a.doubleClick?a.doubleClick:a.click;break;case 3:c=a.contextClick}if(null!==c&&(c(b,a),b.handled))break;a=a.panel}else{a=null;switch(d){case 1:a=c.click;break;case 2:a=c.doubleClick?c.doubleClick:c.click;break;case 3:a=c.contextClick}null!==a&&a(b)}}}
nf.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.$a){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.fe?a.Rb(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.Bk){var f=a.Bk,g=f;a.Bk=d;this.doCurrentObjectChanged(f,d);for(b.handled=!1;null!==f;){var h=f.mouseLeave;if(null!==h){if(d===f)break;if(null!==d&&d.ng(f))break;h(b,f,d);e=!0;if(b.handled)break}f=f.panel}f=g;for(b.handled=!1;null!==d;){g=d.mouseEnter;if(null!==g){if(f===
d)break;if(null!==f&&f.ng(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Bk}if(null!==d){f=d;for(g="";null!==f;){g=f.cursor;if(""!==g)break;f=f.panel}a.currentCursor=g;b.handled=!1;for(f=d;null!==f;){d=f.mouseOver;if(null!==d&&(d(b,f),e=!0,b.handled))break;f=f.panel}}else a.currentCursor="",d=a.mouseOver,null!==d&&(d(b),e=!0);e&&a.ec();a.skipsUndoManager=c}};nf.prototype.doCurrentObjectChanged=function(){};
nf.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.s()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===qf&&!b.shift||e===rf&&b.control)&&(0<c?d.canIncreaseZoom():d.canDecreaseZoom()))e=a.zoomPoint,a.zoomPoint=b.viewPoint,0<c?d.increaseZoom():d.decreaseZoom(),a.zoomPoint=e,b.bubbles=!1;else if(e===qf&&b.shift||e===rf&&!b.control){d=a.position.copy();var f=0<c?c:-c,g=b.event,h=g.deltaMode;e=g.deltaX;g=g.deltaY;
if(cb||fb||gb)h=1,0<e&&(e=3),0>e&&(e=-3),0<g&&(g=3),0>g&&(g=-3);if(void 0===h||void 0===e||void 0===g||0===e&&0===g||b.shift)!b.shift&&a.allowVerticalScroll?(f=3*f*a.scrollVerticalLineChange,0<c?a.scroll("pixel","up",f):a.scroll("pixel","down",f)):b.shift&&a.allowHorizontalScroll&&(f=3*f*a.scrollHorizontalLineChange,0<c?a.scroll("pixel","left",f):a.scroll("pixel","right",f));else{switch(h){case 0:c="pixel";break;case 1:c="line";break;case 2:c="page";break;default:c="pixel"}0!==e&&a.allowHorizontalScroll&&
(0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.A(d)||(b.bubbles=!1)}}};nf.prototype.standardWaitAfter=function(a,b){void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.Yx);this.Bs=ua(function(){c.doWaitAfter(d)},a)};nf.prototype.cancelWaitAfter=function(){-1!==this.Bs&&w.clearTimeout(this.Bs);this.Bs=-1};nf.prototype.doWaitAfter=function(){};
nf.prototype.findToolHandleAt=function(a,b){a=this.diagram.Rb(a,function(a){for(;null!==a&&!(a.panel instanceof sf);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null};nf.prototype.isBeyondDragSize=function(a,b){var c=this.diagram;void 0===a&&(a=c.firstInput.viewPoint);void 0===b&&(b=c.lastInput.viewPoint);var d=c.toolManager.dragSize,e=d.width;d=d.height;c.firstInput.isTouchEvent&&(e+=6,d+=6);return Math.abs(b.x-a.x)>e||Math.abs(b.y-a.y)>d};
pa.Object.defineProperties(nf.prototype,{diagram:{get:function(){return this.F},set:function(a){a instanceof P&&(this.F=a)}},name:{get:function(){return this.Ta},set:function(a){this.Ta=a}},isEnabled:{get:function(){return this.Oc},set:function(a){this.Oc=a}},isActive:{get:function(){return this.Tb},set:function(a){this.Tb=a}},transactionResult:{get:function(){return this.Zv},
set:function(a){this.Zv=a}}});nf.prototype.stopTransaction=nf.prototype.sg;nf.prototype.startTransaction=nf.prototype.Aa;nf.className="Tool";function Ua(){nf.call(this);this.name="ToolManager";this.Kc=new E;this.Xc=new E;this.tg=new E;this.da=this.La=850;this.u=(new L(2,2)).ga();this.Ub=5E3;this.Wa=rf;this.K=tf;this.Uq=this.l=null;this.Bj=-1}oa(Ua,nf);Ua.prototype.initializeStandardTools=function(){};
Ua.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof sf&&this.Uq===a){var c=b.adornedObject;(null!==a?c.part===a:null===c)?this.showToolTip(b,c):this.hideToolTip()}};
Ua.prototype.doMouseDown=function(){var a=this.diagram,b=a.lastInput;b.isTouchEvent&&this.gestureBehavior===uf&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===vf){b.bubbles=!0;return}if(this.gestureBehavior===uf)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.N(d);e.ob(this.diagram);if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===
e&&(e.isActive||e.doActivate(),e.doMouseDown());return}}1===a.lastInput.button&&(this.mouseWheelBehavior===rf?this.mouseWheelBehavior=qf:this.mouseWheelBehavior===qf&&(this.mouseWheelBehavior=rf));this.doActivate();this.standardWaitAfter(this.holdDelay,b)};
Ua.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===vf){b.bubbles=!0;return}if(this.gestureBehavior===uf)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomMove();return}}if(this.isActive)for(var c=this.mouseMoveTools.length,d=0;d<c;d++){var e=this.mouseMoveTools.N(d);e.ob(this.diagram);if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}wf(this,
a);a=b.event;null===a||"mousemove"!==a.type&&"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function wf(a,b){a.standardMouseOver();a.isBeyondDragSize()&&a.standardWaitAfter(a.isActive?a.holdDelay:a.hoverDelay,b.lastInput)}Ua.prototype.doCurrentObjectChanged=function(a,b){a=this.currentToolTip;null===a||null!==b&&a instanceof sf&&(b===a||b.ng(a))||this.hideToolTip()};
Ua.prototype.doWaitAfter=function(a){var b=this.diagram;b.Ea&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.Fl=!0,b.doMouseUp()))};
Ua.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Rb(b.documentPoint,null,null));var c=b.targetObject;if(null!==c)for(b.handled=!1;null!==c;){a=this.isActive?c.mouseHold:c.mouseHover;if(null!==a&&(a(b,c),b.handled))break;c=c.panel}else c=this.isActive?a.mouseHold:a.mouseHover,null!==c&&c(b)};
Ua.prototype.doToolTip=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.Rb(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof sf)||b!==a&&!b.ng(a)){for(;null!==b;){a=b.toolTip;if(null!==a){this.showToolTip(a,b);return}b=b.panel}this.hideToolTip()}}else b=a.toolTip,null!==b?this.showToolTip(b,null):this.hideToolTip()};
Ua.prototype.showToolTip=function(a,b){var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof sf){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category="ToolTip";null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?(c=null,d=b.ph(),null!==d&&(c=d.data),a.adornedObject=b,a.data=c):a.data=c.model;a.ac();this.positionToolTip(a,b)}else a instanceof xf&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=
a;-1!==this.Bj&&(w.clearTimeout(this.Bj),this.Bj=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.Bj=ua(function(){e.hideToolTip()},a)}};
Ua.prototype.positionToolTip=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y=c.y+20/b.scale+d.height>e.bottom?c.y-(d.height+5/b.scale):c.y+20/b.scale;c.y<e.y&&(c.y=e.y);a.position=c}};
Ua.prototype.hideToolTip=function(){-1!==this.Bj&&(w.clearTimeout(this.Bj),this.Bj=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof sf?(a.remove(b),null!==this.Uq&&this.Uq.qf(b.category),b.data=null,b.adornedObject=null):b instanceof xf&&null!==b.hide&&b.hide(a,this),this.currentToolTip=null)};
Ua.prototype.doMouseUp=function(){this.cancelWaitAfter();var a=this.diagram;if(this.isActive)for(var b=this.mouseUpTools.length,c=0;c<b;c++){var d=this.mouseUpTools.N(c);d.ob(this.diagram);if(d.canStart()){a.doFocus();a.currentTool=d;a.currentTool===d&&(d.isActive||d.doActivate(),d.doMouseUp());return}}a.doFocus();this.doDeactivate()};Ua.prototype.doMouseWheel=function(){this.standardMouseWheel()};Ua.prototype.doKeyDown=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyDown()};
Ua.prototype.doKeyUp=function(){var a=this.diagram;null!==a.commandHandler&&a.commandHandler.doKeyUp()};Ua.prototype.findTool=function(a){for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.N(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.N(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.N(c),d.name===a)return d;return null};
Ua.prototype.replaceTool=function(a,b){null!==b&&b.ob(this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.N(d);if(e.name===a)return null!==b?this.mouseDownTools.jd(d,b):this.mouseDownTools.nb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.N(d),e.name===a)return null!==b?this.mouseMoveTools.jd(d,b):this.mouseMoveTools.nb(d),e;c=this.mouseUpTools.length;for(d=0;d<c;d++)if(e=this.mouseUpTools.N(d),e.name===a)return null!==b?this.mouseUpTools.jd(d,
b):this.mouseUpTools.nb(d),e;return null};function Gf(a,b,c,d){null!==c&&(c.name=b,c.ob(a.diagram));a.findTool(b)?a.replaceTool(b,c):null!==c&&d.add(c)}
pa.Object.defineProperties(Ua.prototype,{mouseWheelBehavior:{get:function(){return this.Wa},set:function(a){this.Wa=a}},gestureBehavior:{get:function(){return this.K},set:function(a){this.K=a}},currentToolTip:{get:function(){return this.l},set:function(a){this.l=a;this.Uq=null!==a&&a instanceof sf?a.adornedPart:null}},mouseDownTools:{get:function(){return this.Kc}},mouseMoveTools:{
get:function(){return this.Xc}},mouseUpTools:{get:function(){return this.tg}},hoverDelay:{get:function(){return this.La},set:function(a){this.La=a}},holdDelay:{get:function(){return this.da},set:function(a){this.da=a}},dragSize:{get:function(){return this.u},set:function(a){this.u=a.I()}},toolTipDuration:{get:function(){return this.Ub},
set:function(a){this.Ub=a}}});var rf=new D(Ua,"WheelScroll",0),qf=new D(Ua,"WheelZoom",1),Hf=new D(Ua,"WheelNone",2),tf=new D(Ua,"GestureZoom",3),uf=new D(Ua,"GestureCancel",4),vf=new D(Ua,"GestureNone",5);Ua.className="ToolManager";Ua.WheelScroll=rf;Ua.WheelZoom=qf;Ua.WheelNone=Hf;Ua.GestureZoom=tf;Ua.GestureCancel=uf;Ua.GestureNone=vf;
function If(){nf.call(this);this.name="Dragging";this.K=this.Kc=!0;this.u=this.Wa=this.da=this.Zf=null;this.sn=this.Xc=!1;this.yl=new G(NaN,NaN);this.ss=new G;this.Ub=!0;this.Ik=100;this.Eg=[];this.tg=(new F).freeze();this.La=new Jf}oa(If,nf);
If.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly&&!a.allowDragOut||!a.allowMove&&!a.allowCopy&&!a.allowDragOut||!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.isTouchEvent&&b.timestamp-a.firstInput.timestamp<this.Ik)?!1:null!==this.findDraggablePart()};
If.prototype.findDraggablePart=function(){var a=this.diagram;a=a.Ul(a.firstInput.documentPoint,!1);if(null===a)return null;for(;null!==a&&!a.canSelect();)a=a.containingGroup;return null!==a&&(a.canMove()||a.canCopy())?a:null};
If.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.Ul(a.firstInput.documentPoint,!1);if(null!==b){for(;null!==b&&!b.canSelect();)b=b.containingGroup;this.currentPart=b;null===this.currentPart||this.currentPart.isSelected||(a.aa("ChangingSelection",a.selection),b=a.lastInput,(ib?b.meta:b.control)||b.shift||Kf(a),this.currentPart.isSelected=!0,a.aa("ChangedSelection",a.selection))}}};
If.prototype.doActivate=function(){var a=this.diagram;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(Lf=null,this.isActive=!0,this.yl.set(a.position),Mf(this,a.selection),this.Eg.length=0,this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.jk=!0,!0===a.Ce("temporaryPixelRatio")&&30<a.$t&&(a.te=1),Nf(a,this.draggedParts),this.Aa("Drag"),this.startPoint=a.firstInput.documentPoint,a.isMouseCaptured=!0,a.allowDragOut&&
(this.isDragOutStarted=!0,this.sn=!1,Lf=this,Of=this.diagram,this.doSimulatedDragOut()))};function Mf(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.Vj()&&1===b.count&&b.first()instanceof S?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.Jj(),a.Zf=c.toolManager.findTool("Relinking"),null===a.Zf&&(a.Zf=new Pf,a.Zf.ob(c))):(a.draggedLink=null,a.Zf=null))}}
If.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};If.prototype.rd=function(a){return void 0===a?new Qf(cc):this.isGridSnapEnabled?new Qf(new G(Math.round(a.x),Math.round(a.y))):new Qf(a.copy())};
If.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.sf();Rf(this);Sf(a,this.draggedParts);this.draggedParts=this.currentPart=null;this.sn=this.isDragOutStarted=!1;if(0<Tf.count){for(var b=Tf,c=b.length,d=0;d<c;d++){var e=b.N(d);Uf(e);Vf(e);Rf(e);e.diagram.sf()}b.clear()}Uf(this);this.yl.h(NaN,NaN);Lf=Of=null;Vf(this);a.isMouseCaptured=!1;a.currentCursor="";a.jk=!1;this.sg();Wf(a,!0)};
function Rf(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;Xf(a,b.lastInput,null);b.skipsUndoManager=c;a.Eg.length=0}function Yf(){var a=Lf;Vf(a);Zf(a);var b=a.diagram;a.yl.s()&&(b.position=a.yl);b.sf()}If.prototype.doCancel=function(){Vf(this);Zf(this);var a=this.diagram;this.yl.s()&&(a.position=this.yl);this.stopTool()};If.prototype.doKeyDown=function(){this.isActive&&("Esc"===this.diagram.lastInput.key?this.doCancel():this.doMouseMove())};
If.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};function $f(a,b){var c=Infinity,d=Infinity,e=-Infinity,f=-Infinity;for(a=a.iterator;a.next();){var g=a.value;if(g.cc()&&g.isVisible()){var h=g.location;g=h.x;h=h.y;isNaN(g)||isNaN(h)||(g<c&&(c=g),h<d&&(d=h),g>e&&(e=g),h>f&&(f=h))}}Infinity===c?b.h(0,0,0,0):b.h(c,d,e-c,f-d)}
function ag(a,b){if(null===a.copiedParts){var c=a.diagram;if((!b||!c.isReadOnly&&!c.isModelReadOnly)&&null!==a.draggedParts){var d=c.undoManager;d.isEnabled&&d.isInTransaction?null!==d.currentTransaction&&0<d.currentTransaction.changes.count&&(c.undoManager.rf(),c.Aa("Drag")):Zf(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Xd():c.selection;c=c.Oj(b,c,!0);for(b=c.iterator;b.next();)b.value.location=
b.key.location;b=N.alloc();$f(c,b);N.free(b);b=new Pb;for(d=a.draggedParts.iterator;d.next();){var e=d.key;e.cc()&&e.canCopy()&&(e=c.J(e),null!==e&&(e.ac(),b.add(e,a.rd(e.location))))}for(c=c.iterator;c.next();)d=c.value,d instanceof S&&d.canCopy()&&b.add(d,a.rd());a.copiedParts=b;Mf(a,b.Xd());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,bg(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)))}}}
function Vf(a){var b=a.diagram;if(null!==a.copiedParts&&(b.nt(a.copiedParts.Xd(),!1),a.copiedParts=null,null!==a.draggedParts))for(var c=a.draggedParts.iterator;c.next();)c.key instanceof S&&(c.value.point=new G(0,0));b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint}
function Uf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.Zf){var b=a.Zf;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.Zf=null}}function cg(a,b,c){var d=a.diagram,e=a.startPoint,f=G.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.Wd(e),c);G.free(f);!0===d.Ce("temporaryPixelRatio")&&null===d.te&&30<d.$t&&(d.te=1,d.kt())}If.prototype.moveParts=function(a,b,c){var d=this.diagram;null!==d&&eg(d,a,b,this.dragOptions,c)};
function Zf(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.cc()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof S&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.rd());bg(d,-e.x,-e.y)}b.hd()}}function fg(a,b){if(null===b)return!0;b=b.part;return null===b||b instanceof sf||b.layer.isTemporary||a.draggedParts&&a.draggedParts.contains(b)||a.copiedParts&&a.copiedParts.contains(b)?!0:!1}
function gg(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),hg(a,!1));var d=ig(c,b,null,function(b){return!fg(a,b)}),e=c.lastInput;e.targetObject=d;var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=Xf(a,e,d);if(!a.isActive&&null===Lf)return;if(null===d||c.handlesDragDropForTopLevelParts){var h=c.mouseDragOver;null!==h&&(h(e),g=!0)}if(!a.isActive&&null===Lf)return;a.doDragOver(b,d);if(!a.isActive&&null===Lf)return}finally{c.skipsUndoManager=
f,g&&c.hd()}(c.allowHorizontalScroll||c.allowVerticalScroll)&&c.Js(e.viewPoint)}function Xf(a,b,c){var d=!1,e=a.Eg.length,f=0<e?a.Eg[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.Eg[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.Eg.length=0;if(!a.isActive&&null===Lf||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.Eg.push(e),e=jg(e);e=a.Eg.length;for(c=0;c<e&&(g=a.Eg[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d}
function jg(a){var b=a.panel;return null!==b?b:a instanceof T&&!(a instanceof kg)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function lg(a,b,c){var d=a.Zf;if(null===d)return null;var e=a.diagram.kg(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=G.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.ma(gd,a);k=b.Ae(k);k<f&&(g=h,f=k)}}G.free(a);return g}
function hg(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.Zf;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=lg(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=lg(a,c.i(c.pointsCount-1),!0),null!==h&&(k=h.part));e.isValidLink(g,f,k,h)?b?(c.defaultFromPoint=c.i(0),c.defaultToPoint=c.i(c.pointsCount-1),c.suspendsRouting=!1,c.fromNode=g,null!==f&&(c.fromPortId=f.portId),c.toNode=k,null!==h&&(c.toPortId=h.portId),c.fromPort!==
d.sx&&d.aa("LinkRelinked",c,d.sx),c.toPort!==d.tx&&d.aa("LinkRelinked",c,d.tx)):mg(e,g,f,k,h):mg(e,null,null,null,null)}}}}If.prototype.doDragOver=function(){};
function ng(a,b){var c=a.diagram;a.dragsLink&&hg(a,!0);Rf(a);var d=ig(c,b,null,function(b){return!fg(a,b)}),e=c.lastInput;e.targetObject=d;if(null!==d){e.handled=!1;for(var f=d;null!==f;){var g=f.mouseDrop;if(null!==g&&(g(e,f),e.handled))break;og(a,e,f);f=jg(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Lf){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof U&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==
Lf){b=N.alloc();for(d=c.selection.iterator;d.next();)e=d.value,e instanceof U&&pg(c,e.getAvoidableRect(b));N.free(b)}}}function og(a,b,c){a=a.diagram;c instanceof T&&null===c.containingGroup&&!(c instanceof kg)&&a.handlesDragDropForTopLevelParts&&(c=a.mouseDrop,null!==c&&c(b))}function pg(a,b){var c=!1;a.viewportBounds.kf(b)&&(c=!0);for(a=a.links;a.next();){var d=a.value;(!c||qg(d))&&d.isAvoiding&&Dc(d.actualBounds,b,0)&&d.Pa()}}If.prototype.doDropOnto=function(){};
If.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,null,b.targetDiagram||null)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(a.currentCursor="copy",ag(this,!1),Nf(a,this.copiedParts),cg(this,this.copiedParts,!1),Sf(a,this.copiedParts)):this.mayMove()?(Vf(this),cg(this,this.draggedParts,!0)):this.mayDragOut()?(a.currentCursor="no-drop",ag(this,!1),cg(this,this.copiedParts,!1)):Vf(this),gg(this,a.lastInput.documentPoint))}};
If.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,null,b.documentPoint,b.targetDiagram)){var c=!1;(b=this.mayCopy())&&null!==this.copiedParts?(Vf(this),ag(this,!0),Nf(a,this.copiedParts),cg(this,this.copiedParts,!1),Sf(a,this.copiedParts),null!==this.copiedParts&&a.Av(this.copiedParts.Xd())):(c=!0,Vf(this),this.mayMove()&&(cg(this,this.draggedParts,!0),gg(this,a.lastInput.documentPoint)));this.sn=!0;ng(this,a.lastInput.documentPoint);
if(this.isActive){var d=b?this.copiedParts.Xd():this.draggedParts.Xd();this.copiedParts=null;if(c&&null!==this.draggedParts)for(c=this.draggedParts.iterator;c.next();){var e=c.key;e instanceof U&&(e=e.containingGroup,null===e||null===e.placeholder||this.draggedParts.contains(e)||e.placeholder.o())}a.Xa();Sf(a,this.draggedParts);this.transactionResult=b?"Copy":"Move";a.aa(b?"SelectionCopied":"SelectionMoved",d)}this.stopTool()}}};
If.prototype.simulatedMouseMove=function(a,b,c){if(null===Lf)return!1;var d=Lf.diagram;c instanceof P||(c=null);var e=Of;c!==e&&(null!==e&&e!==d&&(e.sf(),Lf.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),Of=c,null!==c&&c!==d&&(Yf(),e=c.toolManager.findTool("Dragging"),null!==e&&(Tf.contains(e)||Tf.add(e),e.doSimulatedDragEnter())));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");null!==d&&(null!==
a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)):null===b&&(b=new G),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.ut(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0};
If.prototype.simulatedMouseUp=function(a,b,c,d){if(null===Lf)return!1;null===d&&(d=b);b=Of;var e=Lf.diagram;if(d!==b){var f=b.toolManager.findTool("Dragging");if(null!==b&&b!==e&&null!==f)return b.sf(),Lf.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;Of=d;b=d.toolManager.findTool("Dragging");null!==d&&null!==b&&(Yf(),Tf.contains(b)||Tf.add(b),b.doSimulatedDragEnter())}return null===d?(Lf.doCancel(),!0):d!==this.diagram?(null!==a?(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:
0<a.changedTouches.length&&(a=a.changedTouches[0])),c=d.getMouse(a)):null===c&&(c=new G),d.lastInput.documentPoint=c,d.lastInput.viewPoint=d.ut(c),d.lastInput.down=!1,d.lastInput.up=!0,a=d.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=Lf,null!==a&&(d=a.mayCopy(),a.transactionResult=d?"Copy":"Move",a.stopTool()),!0):!1};
If.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(ib?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.cc()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
If.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.cc()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1};
If.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.cc()&&b.canMove())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};If.prototype.computeBorder=function(a,b,c){return this.sn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};If.prototype.Ty=function(){return Lf};
If.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Lf;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};If.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.Vd();rg(a);a.animationManager.Vd();a=Lf;null!==a&&(a.diagram.currentCursor="copy",a.diagram.jk=!1)}};If.prototype.doSimulatedDragLeave=function(){var a=Lf;null!==a&&a.doSimulatedDragOut();this.doCancel()};
If.prototype.doSimulatedDragOver=function(){var a=this.diagram,b=Lf;null!==b&&null!==b.draggedParts&&this.mayDragIn()&&(a.currentCursor="copy",sg(this,b.draggedParts.Xd(),!1,a.firstInput),cg(this,this.copiedParts,!1),gg(this,a.lastInput.documentPoint))};
If.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Lf;if(null!==b){var c=b.diagram;b.sn=!0;Vf(this);this.mayDragIn()&&(this.Aa("Drop"),sg(this,b.draggedParts.Xd(),!0,a.lastInput),cg(this,this.copiedParts,!1),null!==this.copiedParts&&a.Av(this.copiedParts.Xd()),ng(this,a.lastInput.documentPoint),a.Xa(),b=a.selection,null!==this.copiedParts?this.transactionResult="ExternalCopy":b=new F,this.copiedParts=null,a.doFocus(),a.aa("ExternalObjectsDropped",b,c),this.sg())}};
function sg(a,b,c,d){if(null===a.copiedParts){var e=a.diagram;if(!e.isReadOnly&&!e.isModelReadOnly){e.skipsUndoManager=!c;e.partManager.addsToTemporaryLayer=!c;a.startPoint=d.documentPoint;c=e.Oj(b,e,!0);var f=N.alloc();$f(b,f);d=f.x+f.width/2;e=f.y+f.height/2;N.free(f);f=a.ss;var g=new Pb,h=G.alloc();for(b=b.iterator;b.next();){var k=b.value,l=c.J(k);k.cc()&&k.canCopy()?(k=k.location,h.h(f.x-(d-k.x),f.y-(e-k.y)),l.location=h,l.ac(),g.add(l,a.rd(h))):l instanceof S&&k.canCopy()&&(bg(l,f.x-d,f.y-e),
g.add(l,a.rd()))}G.free(h);a.copiedParts=g;Mf(a,g.Xd());null!==a.draggedLink&&(c=a.draggedLink,d=c.routeBounds,bg(c,a.startPoint.x-(d.x+d.width/2),a.startPoint.y-(d.y+d.height/2)))}}}If.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.jk=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor="no-drop"};If.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new G};
pa.Object.defineProperties(If.prototype,{isCopyEnabled:{get:function(){return this.Kc},set:function(a){this.Kc=a}},copiesEffectiveCollection:{get:function(){return this.K},set:function(a){this.K=a}},dragOptions:{get:function(){return this.La},set:function(a){this.La=a}},isGridSnapEnabled:{get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){this.dragOptions.isGridSnapEnabled=
a}},isComplexRoutingRealtime:{get:function(){return this.Ub},set:function(a){this.Ub=a}},isGridSnapRealtime:{get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){this.dragOptions.isGridSnapRealtime=a}},gridSnapCellSize:{get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){null===this.diagram||this.dragOptions.gridSnapCellSize.A(a)||(a=a.I(),this.dragOptions.gridSnapCellSize=
a)}},gridSnapCellSpot:{get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){this.dragOptions.gridSnapCellSpot.A(a)||(a=a.I(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){this.dragOptions.gridSnapOrigin.A(a)||(a=a.I(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{get:function(){return this.dragOptions.dragsLink},
set:function(a){this.dragOptions.dragsLink=a}},dragsTree:{get:function(){return this.dragOptions.dragsTree},set:function(a){this.dragOptions.dragsTree=a}},currentPart:{get:function(){return this.da},set:function(a){this.da=a}},copiedParts:{get:function(){return this.u},set:function(a){this.u=a}},draggedParts:{get:function(){return this.Wa},set:function(a){this.Wa=a}},draggingParts:{
get:function(){return null!==this.copiedParts?this.copiedParts.Xd():null!==this.draggedParts?this.draggedParts.Xd():this.tg}},draggedLink:{get:function(){return this.diagram.draggedLink},set:function(a){this.diagram.draggedLink=a}},isDragOutStarted:{get:function(){return this.Xc},set:function(a){this.Xc=a}},startPoint:{get:function(){return this.ss},set:function(a){this.ss.A(a)||this.ss.assign(a)}},
delay:{get:function(){return this.Ik},set:function(a){this.Ik=a}}});If.prototype.getDraggingSource=If.prototype.Ty;var Tf=null,Lf=null,Of=null;If.className="DraggingTool";Tf=new E;Ta("draggingTool",function(){return this.findTool("Dragging")},function(a){Gf(this,"Dragging",a,this.mouseMoveTools)});Ua.prototype.doCancel=function(){null!==Lf&&Lf.doCancel();nf.prototype.doCancel.call(this)};
function tg(){nf.call(this);this.tg=100;this.da=!1;var a=new S,b=new V;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new V;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.Bm=a;a=new U;b=new V;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=kc;a.add(b);a.selectable=!1;a.layerName="Tool";this.zm=a;this.Am=b;a=new U;b=new V;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=kc;a.add(b);
a.selectable=!1;a.layerName="Tool";this.sq=a;this.Yv=b;this.Xc=this.Kc=this.Wa=this.La=this.Ub=null;this.K=!0;this.Nx=new Pb;this.wm=this.ei=this.ym=null}oa(tg,nf);tg.prototype.doStop=function(){this.diagram.sf();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null};
tg.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Be(),g=L.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;L.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=gd;f=G.alloc();c.location=b.ma(gd,f);G.free(f);d.angle=b.Ci();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}};
tg.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=kc,b.fromSpot=bd,b.toSpot=bd);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};tg.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()};
tg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof U){var b=this.targetPort.part;this.isForwards?this.copyPortProperties(b,this.targetPort,this.temporaryToNode,this.temporaryToPort,!0):this.copyPortProperties(b,this.targetPort,this.temporaryFromNode,this.temporaryFromPort,!1)}else this.isForwards?this.setNoTargetPortProperties(this.temporaryToNode,this.temporaryToPort,
!0):this.setNoTargetPortProperties(this.temporaryFromNode,this.temporaryFromPort,!1);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.Js(a.lastInput.viewPoint)}};tg.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof U))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof U)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null};
tg.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.kg(c,d,function(b){return e.findValidLinkablePort(b,a)},null,!0);d=Infinity;b=null;for(f=f.iterator;f.next();){var g=f.value,h=g.part;if(h instanceof U){var k=g.ma(gd,G.alloc()),l=c.x-k.x,m=c.y-k.y;G.free(k);k=l*l+m*m;k<d&&(l=this.validPortsCache.J(g),null!==l?l&&(b=g,d=k):a&&this.isValidLink(this.originalFromNode,this.originalFromPort,h,g)||!a&&this.isValidLink(h,
g,this.originalToNode,this.originalToPort)?(this.validPortsCache.add(g,!0),b=g,d=k):this.validPortsCache.add(g,!1))}}return null!==b&&(c=b.part,c instanceof U&&(null===c.layer||c.layer.allowLink))?b:null};
tg.prototype.isValidFrom=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.fromLinkable))return!1;var c=b.fromMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalFromNode&&b===this.originalFromPort)return!0;b=b.portId;null===b&&(b="");if(a.Np(b).count>=c)return!1}return!0};
tg.prototype.isValidTo=function(a,b){if(null===a||null===b)return this.isUnconnectedLinkValid;if(this.diagram.currentTool===this&&(null!==a.layer&&!a.layer.allowLink||!0!==b.toLinkable))return!1;var c=b.toMaxLinks;if(Infinity>c){if(null!==this.originalLink&&a===this.originalToNode&&b===this.originalToPort)return!0;b=b.portId;null===b&&(b="");if(a.ud(b).count>=c)return!1}return!0};
tg.prototype.isInSameNode=function(a,b){if(null===a||null===b)return!1;if(a===b)return!0;a=a.part;b=b.part;return null!==a&&a===b};tg.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof U))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof U))return!1;b=b.portId;null===b&&(b="");for(b=d.ud(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1};
tg.prototype.isValidLink=function(a,b,c,d){if(!this.isValidFrom(a,b)||!this.isValidTo(c,d)||!(null===b||null===d||(b.fromLinkableSelfNode&&d.toLinkableSelfNode||!this.isInSameNode(b,d))&&(b.fromLinkableDuplicates&&d.toLinkableDuplicates||!this.isLinked(b,d)))||null!==this.originalLink&&(null!==a&&this.isLabelDependentOnLink(a,this.originalLink)||null!==c&&this.isLabelDependentOnLink(c,this.originalLink))||null!==a&&null!==c&&(null===a.data&&null!==c.data||null!==a.data&&null===c.data)||!this.isValidCycle(a,
c,this.originalLink))return!1;if(null!==a){var e=a.linkValidation;if(null!==e&&!e(a,b,c,d,this.originalLink))return!1}if(null!==c&&(e=c.linkValidation,null!==e&&!e(a,b,c,d,this.originalLink)))return!1;e=this.linkValidation;return null!==e?e(a,b,c,d,this.originalLink):!0};tg.prototype.isLabelDependentOnLink=function(a,b){if(null===a)return!1;var c=a.labeledLink;if(null===c)return!1;if(c===b)return!0;var d=new F;d.add(a);return ug(this,c,b,d)};
function ug(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),ug(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),ug(a,b.labeledLink,c,d))?!0:!1}
tg.prototype.isValidCycle=function(a,b,c){void 0===c&&(c=null);if(null===a||null===b)return this.isUnconnectedLinkValid;var d=this.diagram.validCycle;if(d!==vg){if(d===wg){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=b.linksConnected;d.next();){var e=d.value;if(e!==c&&e.isTreeLink&&e.toNode===b)return!1}return!xg(this,a,b,c,!0)}if(d===yg){d=c||this.temporaryLink;if(null!==d&&!d.isTreeLink)return!0;for(d=a.linksConnected;d.next();)if(e=d.value,e!==c&&e.isTreeLink&&e.fromNode===
a)return!1;return!xg(this,a,b,c,!0)}if(d===zg)return a===b?a=!0:(d=new F,d.add(b),a=Ag(this,d,a,b,c)),!a;if(d===Bg)return!xg(this,a,b,c,!1);if(d===Ig)return a===b?a=!0:(d=new F,d.add(b),a=Jg(this,d,a,b,c)),!a}return!0};function xg(a,b,c,d,e){if(b===c)return!0;if(null===b||null===c)return!1;for(var f=b.linksConnected;f.next();){var g=f.value;if(g!==d&&(!e||g.isTreeLink)&&g.toNode===b&&(g=g.fromNode,g!==b&&xg(a,g,c,d,e)))return!0}return!1}
function Ag(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e&&g.toNode===c&&(g=g.fromNode,g!==c&&Ag(a,b,g,d,e)))return!0}return!1}function Jg(a,b,c,d,e){if(c===d)return!0;if(null===c||null===d||b.contains(c))return!1;b.add(c);for(var f=c.linksConnected;f.next();){var g=f.value;if(g!==e){var h=g.fromNode;g=g.toNode;h=h===c?g:h;if(h!==c&&Jg(a,b,h,d,e))return!0}}return!1}
pa.Object.defineProperties(tg.prototype,{portGravity:{get:function(){return this.tg},set:function(a){0<=a&&(this.tg=a)}},isUnconnectedLinkValid:{get:function(){return this.da},set:function(a){this.da=a}},temporaryLink:{get:function(){return this.Bm},set:function(a){this.Bm=a}},temporaryFromNode:{get:function(){return this.zm},set:function(a){this.zm=a}},temporaryFromPort:{
get:function(){return this.Am},set:function(a){this.Am=a}},temporaryToNode:{get:function(){return this.sq},set:function(a){this.sq=a}},temporaryToPort:{get:function(){return this.Yv},set:function(a){this.Yv=a}},originalLink:{get:function(){return this.Ub},set:function(a){this.Ub=a}},originalFromNode:{get:function(){return this.La},set:function(a){this.La=a}},originalFromPort:{
get:function(){return this.Wa},set:function(a){this.Wa=a}},originalToNode:{get:function(){return this.Kc},set:function(a){this.Kc=a}},originalToPort:{get:function(){return this.Xc},set:function(a){this.Xc=a}},isForwards:{get:function(){return this.K},set:function(a){this.K=a}},validPortsCache:{get:function(){return this.Nx}},targetPort:{
get:function(){return this.ym},set:function(a){this.ym=a}},linkValidation:{get:function(){return this.ei},set:function(a){this.ei=a}},portTargeted:{get:function(){return this.wm},set:function(a){this.wm=a}}});tg.className="LinkingBaseTool";function Kg(){tg.call(this);this.name="Linking";this.u={};this.l=null;this.L=Lg;this.xm=null}oa(Kg,tg);
Kg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.$s()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()};
Kg.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.Rb(a.firstInput.documentPoint,null,null));if(null===b||!(b.part instanceof U))return null;a=this.direction;if(a===Lg||a===Mg){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.isForwards=!0,c}if(a===Lg||a===Ng)if(b=this.findValidLinkablePort(b,!0),null!==b)return this.isForwards=!1,b;return null};
Kg.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null!==b&&(this.Aa(this.name),a.isMouseCaptured=!0,a.currentCursor="pointer",this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.s()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof U&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,
!1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.s()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof U&&(this.originalToNode=b),this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0)),a.add(this.temporaryFromNode),a.add(this.temporaryToNode),null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=this.temporaryFromNode),
null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.temporaryLink.isTreeLink=this.isNewTreeLink(),this.temporaryLink.Pa(),a.add(this.temporaryLink)),this.isActive=!0)};Kg.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.sg()};Kg.prototype.doStop=function(){tg.prototype.doStop.call(this);this.startObject=null};
Kg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=this.transactionResult=null,c=null,d=null,e=null,f=this.targetPort=this.findTargetPort(this.isForwards);if(null!==f){var g=f.part;g instanceof U&&(this.isForwards?(null!==this.originalFromNode&&(b=this.originalFromNode,c=this.originalFromPort),d=g,e=f):(b=g,c=f,null!==this.originalToNode&&(d=this.originalToNode,e=this.originalToPort)))}else this.isForwards?null!==this.originalFromNode&&this.isUnconnectedLinkValid&&(b=this.originalFromNode,
c=this.originalFromPort):null!==this.originalToNode&&this.isUnconnectedLinkValid&&(d=this.originalToNode,e=this.originalToPort);null!==b||null!==d?(g=this.insertLink(b,c,d,e),null!==g?(null===f&&(this.isForwards?g.defaultToPoint=a.lastInput.documentPoint:g.defaultFromPoint=a.lastInput.documentPoint),a.allowSelect&&a.select(g),this.transactionResult=this.name,a.aa("LinkDrawn",g)):(a.model.Fu(),this.doNoLink(b,c,d,e))):this.isForwards?this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):
this.doNoLink(null,null,this.originalToNode,this.originalToPort)}this.stopTool()};Kg.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof S)return a.isTreeLink;var b=this.diagram;if(null===b)return!0;a=b.partManager.getLinkCategoryForData(a);b=b.partManager.findLinkTemplateForCategory(a);return null!==b?b.isTreeLink:!0};Kg.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Kg.prototype.doNoLink=function(){};
pa.Object.defineProperties(Kg.prototype,{archetypeLinkData:{get:function(){return this.u},set:function(a){this.u=a}},archetypeLabelNodeData:{get:function(){return this.l},set:function(a){this.l=a}},direction:{get:function(){return this.L},set:function(a){this.L=a}},startObject:{get:function(){return this.xm},set:function(a){this.xm=a}}});
var Lg=new D(Kg,"Either",0),Mg=new D(Kg,"ForwardsOnly",0),Ng=new D(Kg,"BackwardsOnly",0);Kg.className="LinkingTool";Kg.Either=Lg;Kg.ForwardsOnly=Mg;Kg.BackwardsOnly=Ng;
function Pf(){tg.call(this);this.name="Relinking";var a=new V;a.figure="Diamond";a.desiredSize=mc;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.segmentIndex=0;this.l=a;a=new V;a.figure="Diamond";a.desiredSize=mc;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="pointer";a.segmentIndex=-1;this.u=a;this.Ya=null;this.Cw=new N}oa(Pf,tg);
Pf.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.s()&&a.isVisible()&&d.actualBounds.s()&&d.pf()&&(c=a.Rj(b),null===c&&(c=this.makeAdornment(d,!1),a.ih(b,c)))}null===c&&a.qf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.s()&&a.isVisible()&&d.actualBounds.s()&&d.pf()&&
(c=a.Rj(b),null===c?(c=this.makeAdornment(d,!0),a.ih(b,c)):c.o()));null===c&&a.qf(b)}};Pf.prototype.makeAdornment=function(a,b){var c=new sf;c.type=W.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c};
Pf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.$s()||!a.lastInput.left)return!1;var b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo"));return null!==b};
Pf.prototype.doActivate=function(){var a=this.diagram;if(null===this.originalLink){var b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkFrom");null===b&&(b=this.findToolHandleAt(a.firstInput.documentPoint,"RelinkTo"));if(null===b)return;var c=b.part;if(!(c instanceof sf&&c.adornedPart instanceof S))return;this.Ya=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.Aa(this.name);a.isMouseCaptured=!0;a.currentCursor="pointer";this.originalFromPort=this.originalLink.fromPort;
this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.Cw.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=jc),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&&(null!==this.temporaryToPort&&
(this.temporaryToPort.desiredSize=jc),null!==this.temporaryToNode&&(this.temporaryToNode.location=this.originalLink.i(this.originalLink.pointsCount-1))));this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort,!1);this.copyPortProperties(this.originalToNode,this.originalToPort,this.temporaryToNode,this.temporaryToPort,!0);a.add(this.temporaryFromNode);a.add(this.temporaryToNode);null!==this.temporaryLink&&(null!==this.temporaryFromNode&&(this.temporaryLink.fromNode=
this.temporaryFromNode),null!==this.temporaryToNode&&(this.temporaryLink.toNode=this.temporaryToNode),this.copyLinkProperties(this.originalLink,this.temporaryLink),this.temporaryLink.Pa(),a.add(this.temporaryLink));this.isActive=!0};
Pf.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===Og||c===Pg)c=Qg;b.curve=c;b.curviness=a.curviness;b.isTreeLink=a.isTreeLink;b.points=a.points;b.routing=a.routing;b.smoothness=a.smoothness;b.fromSpot=a.fromSpot;b.fromEndSegmentLength=a.fromEndSegmentLength;b.fromShortLength=a.fromShortLength;b.toSpot=a.toSpot;b.toEndSegmentLength=a.toEndSegmentLength;b.toShortLength=a.toShortLength}};
Pf.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.remove(this.temporaryLink);a.remove(this.temporaryFromNode);a.remove(this.temporaryToNode);a.isMouseCaptured=!1;a.currentCursor="";this.sg()};Pf.prototype.doStop=function(){tg.prototype.doStop.call(this);this.Ya=null};
Pf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof U&&(this.isForwards?(d=g,e=this.targetPort):(b=g,c=this.targetPort))}else this.isUnconnectedLinkValid?this.isForwards?e=d=null:c=b=null:f=null;null!==f?(this.reconnectLink(f,
this.isForwards?d:b,this.isForwards?e:c,this.isForwards),null===this.targetPort&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint,f.Pa()),a.allowSelect&&(f.isSelected=!0),this.transactionResult=this.name,a.aa("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.Vp(this.Cw)}this.stopTool()};
Pf.prototype.reconnectLink=function(a,b,c,d){c=null!==c&&null!==c.portId?c.portId:"";d?(a.toNode=b,a.toPortId=c):(a.fromNode=b,a.fromPortId=c);return!0};Pf.prototype.doNoRelink=function(){};
function mg(a,b,c,d,e){null!==b?(a.copyPortProperties(b,c,a.temporaryFromNode,a.temporaryFromPort,!1),a.diagram.add(a.temporaryFromNode)):a.diagram.remove(a.temporaryFromNode);null!==d?(a.copyPortProperties(d,e,a.temporaryToNode,a.temporaryToPort,!0),a.diagram.add(a.temporaryToNode)):a.diagram.remove(a.temporaryToNode)}
pa.Object.defineProperties(Pf.prototype,{fromHandleArchetype:{get:function(){return this.l},set:function(a){this.l=a}},toHandleArchetype:{get:function(){return this.u},set:function(a){this.u=a}},handle:{get:function(){return this.Ya}}});Pf.className="RelinkingTool";Ta("linkingTool",function(){return this.findTool("Linking")},function(a){Gf(this,"Linking",a,this.mouseMoveTools)});
Ta("relinkingTool",function(){return this.findTool("Relinking")},function(a){Gf(this,"Relinking",a,this.mouseDownTools)});function Rg(){nf.call(this);this.name="LinkReshaping";var a=new V;a.figure="Rectangle";a.desiredSize=lc;a.fill="lightblue";a.stroke="dodgerblue";this.l=a;a=new V;a.figure="Diamond";a.desiredSize=mc;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.u=a;this.K=3;this.Dt=this.Ya=null;this.ll=new G;this.Wr=new E}oa(Rg,nf);
Rg.prototype.Wu=function(a){return a&&a.cs&&0!==a.cs.value?a.cs:Sg};Rg.prototype.qm=function(a,b){a.cs=b};
Rg.prototype.updateAdornments=function(a){if(null!==a&&a instanceof S){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.s()&&a.isVisible()&&c.actualBounds.s()&&c.pf()&&(b=a.Rj(this.name),null===b||b.zw!==a.pointsCount||b.Kw!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.zw=a.pointsCount,b.Kw=a.resegmentable,a.ih(this.name,b)))}null===b&&a.qf(this.name)}};
Rg.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new sf;e.type=W.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==Tg)for(var h=c+g;h<f-g;h++){var k=this.makeResegmentHandle(a,h);null!==k&&(k.segmentIndex=h,k.segmentFraction=.5,k.fromMaxLinks=999,e.add(k))}for(g=c+1;g<f;g++)if(h=this.makeHandle(a,g),null!==h){h.segmentIndex=g;if(g!==c)if(g===c+1&&d){k=b.i(c);var l=b.i(c+1);H.w(k.x,l.x)&&
H.w(k.y,l.y)&&(l=b.i(c-1));H.w(k.x,l.x)?(this.qm(h,Ug),h.cursor="n-resize"):H.w(k.y,l.y)&&(this.qm(h,Vg),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),H.w(k.x,l.x)&&H.w(k.y,l.y)&&(k=b.i(f+1)),H.w(k.x,l.x)?(this.qm(h,Ug),h.cursor="n-resize"):H.w(k.y,l.y)&&(this.qm(h,Vg),h.cursor="w-resize")):g!==f&&(this.qm(h,Wg),h.cursor="move");e.add(h)}e.adornedObject=a}return e};Rg.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()};
Rg.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};Rg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowReshape&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
Rg.prototype.doActivate=function(){var a=this.diagram;this.Ya=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null!==this.Ya){var b=this.Ya.part.adornedPart;if(b instanceof S){this.Dt=b;a.isMouseCaptured=!0;this.Aa(this.name);if(b.resegmentable&&999===this.Ya.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.Jb(this.Ya.segmentIndex+1,d);b.isOrthogonal&&c.Jb(this.Ya.segmentIndex+1,d);b.points=c;b.Kb();b.updateAdornments();this.Ya=this.findToolHandleAt(a.firstInput.documentPoint,
this.name);if(null===this.Ya){this.doDeactivate();return}}this.ll=b.i(this.Ya.segmentIndex);this.Wr=b.points.copy();this.isActive=!0}}};Rg.prototype.doDeactivate=function(){this.sg();this.Dt=this.Ya=null;this.isActive=this.diagram.isMouseCaptured=!1};Rg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Wr);this.stopTool()};Rg.prototype.getResegmentingPoint=function(){return this.handle.ma(gd)};
Rg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))};
Rg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.computeReshape(a.lastInput.documentPoint);this.reshape(b);b=this.adornedLink;if(null!==b&&b.resegmentable){var c=this.handle.segmentIndex,d=b.i(c-1),e=b.i(c),f=b.i(c+1);if(b.isOrthogonal){if(c>b.firstPickIndex+1&&c<b.lastPickIndex-1){var g=b.i(c-2);if(Math.abs(d.x-e.x)<this.resegmentingDistance&&Math.abs(d.y-e.y)<this.resegmentingDistance&&(Xg(this,g,d,e,f,!0)||Xg(this,g,d,e,f,!1))){var h=b.points.copy();Xg(this,g,d,
e,f,!0)?(h.jd(c-2,new G(g.x,(f.y+g.y)/2)),h.jd(c+1,new G(f.x,(f.y+g.y)/2))):(h.jd(c-2,new G((f.x+g.x)/2,g.y)),h.jd(c+1,new G((f.x+g.x)/2,f.y)));h.nb(c);h.nb(c-1);b.points=h;b.Kb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(Xg(this,d,e,f,g,!0)||Xg(this,d,e,f,g,!1))&&(h=b.points.copy(),Xg(this,d,e,f,g,!0)?(h.jd(c-1,new G(d.x,(d.y+g.y)/2)),h.jd(c+2,new G(g.x,(d.y+g.y)/2))):(h.jd(c-1,new G((d.x+g.x)/2,d.y)),h.jd(c+2,new G((d.x+g.x)/2,g.y))),
h.nb(c+1),h.nb(c),b.points=h,b.Kb())}}else g=G.alloc(),H.Ii(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Ae(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.nb(c),b.points=d,b.Kb()),G.free(g)}a.Xa();this.transactionResult=this.name;a.aa("LinkReshaped",this.adornedLink,this.Wr)}this.stopTool()};
function Xg(a,b,c,d,e,f){return f?Math.abs(b.y-c.y)<a.resegmentingDistance&&Math.abs(c.y-d.y)<a.resegmentingDistance&&Math.abs(d.y-e.y)<a.resegmentingDistance:Math.abs(b.x-c.x)<a.resegmentingDistance&&Math.abs(c.x-d.x)<a.resegmentingDistance&&Math.abs(d.x-e.x)<a.resegmentingDistance}
Rg.prototype.reshape=function(a){var b=this.adornedLink;b.wh();var c=this.handle.segmentIndex,d=this.Wu(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===Ug?(b.M(c,b.i(c-1).x,a.y),b.M(c+1,b.i(c+2).x,a.y)):d===Vg&&(b.M(c,a.x,b.i(c-1).y),b.M(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===Ug?(b.M(c-1,b.i(c-2).x,a.y),b.M(c,b.i(c+1).x,a.y)):d===Vg&&(b.M(c-1,a.x,b.i(c-2).y),b.M(c,a.x,b.i(c+1).y));else{d=c;var e=b.i(d),f=b.i(d-1),g=b.i(d+1);H.w(f.x,
e.x)&&H.w(e.y,g.y)?(H.w(f.x,b.i(d-2).x)&&!H.w(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.M(d-1,a.x,f.y),H.w(g.y,b.i(d+2).y)&&!H.w(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.M(d+1,g.x,a.y)):H.w(f.y,e.y)&&H.w(e.x,g.x)?(H.w(f.y,b.i(d-2).y)&&!H.w(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.M(d-1,f.x,a.y),H.w(g.x,b.i(d+2).x)&&!H.w(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.M(d+1,a.x,g.y)):H.w(f.x,e.x)&&H.w(e.x,g.x)?(H.w(f.x,b.i(d-2).x)&&!H.w(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.M(d-1,a.x,f.y),H.w(g.x,b.i(d+2).x)&&
!H.w(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.M(d+1,a.x,g.y)):H.w(f.y,e.y)&&H.w(e.y,g.y)&&(H.w(f.y,b.i(d-2).y)&&!H.w(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.M(d-1,f.x,a.y),H.w(g.y,b.i(d+2).y)&&!H.w(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.M(d+1,g.x,a.y));b.M(c,a.x,a.y)}else b.M(c,a.x,a.y),d=b.fromNode,e=b.fromPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),1===c&&b.computeSpot(!0,e).mc()&&(f=e.ma(gd,G.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,G.alloc()),b.M(0,d.x,d.y),G.free(f),
G.free(d)),d=b.toNode,e=b.toPort,null!==d&&(f=d.findVisibleNode(),null!==f&&f!==d&&(d=f,e=d.port)),c===b.pointsCount-2&&b.computeSpot(!1,e).mc()&&(c=e.ma(gd,G.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,G.alloc()),b.M(b.pointsCount-1,a.x,a.y),G.free(c),G.free(a));b.jf()};Rg.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.Wu(this.handle)){case Wg:return a;case Ug:return new G(b.i(c).x,a.y);case Vg:return new G(a.x,b.i(c).y);default:case Sg:return b.i(c)}};
pa.Object.defineProperties(Rg.prototype,{handleArchetype:{get:function(){return this.l},set:function(a){this.l=a}},midHandleArchetype:{get:function(){return this.u},set:function(a){this.u=a}},handle:{get:function(){return this.Ya}},adornedLink:{get:function(){return this.Dt}},resegmentingDistance:{get:function(){return this.K},set:function(a){this.K=
a}},originalPoint:{get:function(){return this.ll}},originalPoints:{get:function(){return this.Wr}}});Rg.prototype.setReshapingBehavior=Rg.prototype.qm;Rg.prototype.getReshapingBehavior=Rg.prototype.Wu;var Sg=new D(Rg,"None",0),Vg=new D(Rg,"Horizontal",1),Ug=new D(Rg,"Vertical",2),Wg=new D(Rg,"All",3);Rg.className="LinkReshapingTool";Rg.None=Sg;Rg.Horizontal=Vg;Rg.Vertical=Ug;Rg.All=Wg;
Ta("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){Gf(this,"LinkReshaping",a,this.mouseDownTools)});
function Yg(){nf.call(this);this.name="Resizing";this.Nf=(new L(1,1)).freeze();this.Mf=(new L(9999,9999)).freeze();this.yg=(new L(NaN,NaN)).freeze();this.u=!1;this.Vb=null;var a=new V;a.alignmentFocus=gd;a.figure="Rectangle";a.desiredSize=lc;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.l=a;this.Ya=null;this.ll=new G;this.Bw=new L;this.Co=new G;this.Ut=new L(0,0);this.Tt=new L(Infinity,Infinity);this.St=new L(1,1);this.yw=!0}oa(Yg,nf);
Yg.prototype.updateAdornments=function(a){if(!(null===a||a instanceof S)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.Rj(this.name);if(null!==c||null!==b&&a.canResize()&&a.actualBounds.s()&&a.isVisible()&&b.actualBounds.s()&&b.pf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.Ci();qg(a)&&this.updateResizeHandles(c,b);a.ih(this.name,c);return}}}a.qf(this.name)}};
Yg.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new sf;b.type=W.Spot;b.locationSpot=gd;var c=new Zg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,cd));b.add(this.makeHandle(a,ed));b.add(this.makeHandle(a,pd));b.add(this.makeHandle(a,id));b.add(this.makeHandle(a,Td));b.add(this.makeHandle(a,Vd));b.add(this.makeHandle(a,Wd));b.add(this.makeHandle(a,Ud))}else if($g(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};
Yg.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a};
Yg.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Lb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.mc()&&(c=gd);if(0>=c.x)b=0>=c.y?b+225:1<=c.y?b+135:b+180;else if(1<=c.x)0>=c.y?b+=315:1<=c.y&&(b+=45);else if(0>=c.y)b+=270;else if(1<=c.y)b+=90;else break a;0>b?b+=360:360<=b&&(b-=360);a.cursor=22.5>b?"e-resize":67.5>b?"se-resize":112.5>b?"s-resize":157.5>b?"sw-resize":202.5>b?"w-resize":247.5>b?"nw-resize":292.5>b?"n-resize":337.5>b?"ne-resize":
"e-resize"}else if(a instanceof W)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};Yg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowResize&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
Yg.prototype.doActivate=function(){var a=this.diagram;this.Ya=this.findToolHandleAt(a.firstInput.documentPoint,this.name);null!==this.Ya&&(this.Vb=this.Ya.part.adornedObject,this.ll.set(this.adornedObject.ma(this.handle.alignment.lv())),this.Co.set(this.Vb.part.location),this.Bw.set(this.Vb.desiredSize),this.St=this.computeCellSize(),this.Ut=this.computeMinSize(),this.Tt=this.computeMaxSize(),a.isMouseCaptured=!0,this.yw=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.Aa(this.name),
this.isActive=!0)};Yg.prototype.doDeactivate=function(){var a=this.diagram;this.sg();this.Vb=this.Ya=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.yw};Yg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()};
Yg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Ut,c=this.Tt,d=this.St,e=this.adornedObject.Ss(a.lastInput.documentPoint,G.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.hd();G.free(e)}};
Yg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Ut,c=this.Tt,d=this.St,e=this.adornedObject.Ss(a.lastInput.documentPoint,G.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);G.free(e);a.Xa();this.transactionResult=this.name;a.aa("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()};
Yg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject,d=c.part;c.desiredSize=a.size;d.ac();a=this.adornedObject.ma(this.handle.alignment.lv());d instanceof kg?(c=new E,c.add(d),b.moveParts(c,this.ll.copy().Wd(a),!0)):d.location=d.location.copy().Wd(a).add(this.ll)};
Yg.prototype.computeResize=function(a,b,c,d,e,f){b.mc()&&(b=gd);var g=this.adornedObject.naturalBounds,h=g.x,k=g.y,l=g.x+g.width,m=g.y+g.height,n=1;if(!f){n=g.width;var p=g.height;0>=n&&(n=1);0>=p&&(p=1);n=p/n}p=G.alloc();H.Op(a.x,a.y,h,k,e.width,e.height,p);a=g.copy();0>=b.x?0>=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*
a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width,a.y=m-a.height)):1<=b.y?(a.x=Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=Math.max(l-a.x,c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),a.x=l-a.width)):(a.x=
Math.max(p.x,l-d.width),a.x=Math.min(a.x,l-c.width),a.width=l-a.x,f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):1<=b.x?0>=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.y=Math.max(p.y,m-d.height),a.y=Math.min(a.y,m-c.height),a.height=Math.max(m-a.y,c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width),
a.y=m-a.height)):1<=b.y?(a.width=Math.max(Math.min(p.x-h,d.width),c.width),a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(1<=a.height/a.width?(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n):(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width))):(a.width=Math.max(Math.min(p.x-h,d.width),c.width),f||(a.height=Math.max(Math.min(n*a.width,d.height),c.height),a.width=a.height/n,a.y=k+.5*(m-k-a.height))):0>=b.y?(a.y=Math.max(p.y,m-d.height),
a.y=Math.min(a.y,m-c.height),a.height=m-a.y,f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width))):1<=b.y&&(a.height=Math.max(Math.min(p.y-k,d.height),c.height),f||(a.width=Math.max(Math.min(a.height/n,d.width),c.width),a.height=n*a.width,a.x=h+.5*(l-h-a.width)));G.free(p);return a};Yg.prototype.computeReshape=function(){var a=ah;this.adornedObject instanceof V&&(a=bh(this.adornedObject));return!(a===ch||this.diagram.lastInput.shift)};
Yg.prototype.computeMinSize=function(){var a=this.adornedObject.minSize.copy(),b=this.minSize;!isNaN(b.width)&&b.width>a.width&&(a.width=b.width);!isNaN(b.height)&&b.height>a.height&&(a.height=b.height);return a};Yg.prototype.computeMaxSize=function(){var a=this.adornedObject.maxSize.copy(),b=this.maxSize;!isNaN(b.width)&&b.width<a.width&&(a.width=b.width);!isNaN(b.height)&&b.height<a.height&&(a.height=b.height);return a};
Yg.prototype.computeCellSize=function(){var a=new L(NaN,NaN),b=this.adornedObject.part;null!==b&&(b=b.resizeCellSize,!isNaN(b.width)&&0<b.width&&(a.width=b.width),!isNaN(b.height)&&0<b.height&&(a.height=b.height));b=this.cellSize;isNaN(a.width)&&!isNaN(b.width)&&0<b.width&&(a.width=b.width);isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height);b=this.diagram;(isNaN(a.width)||isNaN(a.height))&&b&&(b=b.grid,null!==b&&b.visible&&this.isGridSnapEnabled&&(b=b.gridCellSize,isNaN(a.width)&&
!isNaN(b.width)&&0<b.width&&(a.width=b.width),isNaN(a.height)&&!isNaN(b.height)&&0<b.height&&(a.height=b.height)));if(isNaN(a.width)||0===a.width||Infinity===a.width)a.width=1;if(isNaN(a.height)||0===a.height||Infinity===a.height)a.height=1;return a};
pa.Object.defineProperties(Yg.prototype,{handleArchetype:{get:function(){return this.l},set:function(a){this.l=a}},handle:{get:function(){return this.Ya}},adornedObject:{get:function(){return this.Vb},set:function(a){this.Vb=a}},minSize:{get:function(){return this.Nf},set:function(a){if(!this.Nf.A(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.Nf.h(b,a)}}},maxSize:{
get:function(){return this.Mf},set:function(a){if(!this.Mf.A(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);this.Mf.h(b,a)}}},cellSize:{get:function(){return this.yg},set:function(a){this.yg.A(a)||this.yg.assign(a)}},isGridSnapEnabled:{get:function(){return this.u},set:function(a){this.u=a}},originalDesiredSize:{get:function(){return this.Bw}},originalLocation:{
get:function(){return this.Co}}});Yg.className="ResizingTool";Ta("resizingTool",function(){return this.findTool("Resizing")},function(a){Gf(this,"Resizing",a,this.mouseDownTools)});function dh(){nf.call(this);this.name="Rotating";this.La=45;this.da=2;this.Co=new G;this.Vb=null;var a=new V;a.figure="Ellipse";a.desiredSize=mc;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.l=a;this.Ya=null;this.Aw=0;this.ku=new G(NaN,NaN);this.u=0;this.K=50}oa(dh,nf);
dh.prototype.updateAdornments=function(a){if(null!==a){if(a.th()){var b=a.rotateObject;if(b===a||b===a.path||b.isPanelMain)return}if(a.isSelected&&!this.diagram.isReadOnly&&(b=a.rotateObject,null!==b&&a.canRotate()&&a.actualBounds.s()&&a.isVisible()&&b.actualBounds.s()&&b.pf())){var c=a.Rj(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.Ci();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.ih(this.name,c);return}}a.qf(this.name)}};
dh.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new sf;b.type=W.Position;b.locationSpot=gd;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if($g(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};dh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.isReadOnly&&a.allowRotate&&a.lastInput.left?null!==this.findToolHandleAt(a.firstInput.documentPoint,this.name):!1};
dh.prototype.doActivate=function(){var a=this.diagram;this.Ya=this.findToolHandleAt(a.firstInput.documentPoint,this.name);null!==this.Ya&&(this.Vb=this.Ya.part.adornedObject,this.Aw=this.Vb.angle,this.ku=this.computeRotationPoint(this.Vb),this.Co=this.adornedObject.part.location.copy(),a.isMouseCaptured=!0,a.delaysLayout=!0,this.Aa(this.name),this.isActive=!0)};
dh.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.ib()?a.ma(b.rotationSpot):a===b||a===c?c.ma(b.locationSpot):a.ma(gd)};
dh.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.s()||(b=this.computeRotationPoint(a));b=a.Ss(b);var c=this.handleAngle;0>c?c+=360:360<=c&&(c-=360);c=Math.round(45*Math.round(c/45));var d=this.handleDistance;0===c?b.x=a.naturalBounds.width+d:45===c?(b.x=a.naturalBounds.width+d,b.y=a.naturalBounds.height+d):90===c?b.y=a.naturalBounds.height+d:135===c?(b.x=-d,b.y=a.naturalBounds.height+d):180===c?b.x=-d:225===c?(b.x=-d,b.y=-d):270===c?b.y=-d:315===c&&(b.x=a.naturalBounds.width+
d,b.y=-d);return a.ma(b)};dh.prototype.doDeactivate=function(){var a=this.diagram;this.sg();this.Vb=this.Ya=null;this.ku=new G(NaN,NaN);this.isActive=a.isMouseCaptured=!1};dh.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};dh.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))};
dh.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Xa();this.transactionResult=this.name;a.aa("PartRotated",this.Vb,this.originalAngle)}this.stopTool()};dh.prototype.rotate=function(a){var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.ac();var c=b.locationObject,d=b.rotateObject;if(c===d||c.ng(d))c=this.Co.copy(),b.location=c.Wd(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint)}};
dh.prototype.computeRotate=function(a){a=this.rotationPoint.Va(a)-this.handleAngle;var b=this.Vb.panel;null!==b&&(a-=b.Ci());360<=a?a-=360:0>a&&(a+=360);b=Math.min(Math.abs(this.snapAngleMultiple),180);var c=Math.min(Math.abs(this.snapAngleEpsilon),b/2);!this.diagram.lastInput.shift&&0<b&&0<c&&(a%b<c?a=Math.floor(a/b)*b:a%b>b-c&&(a=(Math.floor(a/b)+1)*b));360<=a?a-=360:0>a&&(a+=360);return a};
pa.Object.defineProperties(dh.prototype,{handleArchetype:{get:function(){return this.l},set:function(a){this.l=a}},handle:{get:function(){return this.Ya}},adornedObject:{get:function(){return this.Vb},set:function(a){this.Vb=a}},snapAngleMultiple:{get:function(){return this.La},set:function(a){this.La=a}},snapAngleEpsilon:{get:function(){return this.da},
set:function(a){this.da=a}},originalAngle:{get:function(){return this.Aw}},rotationPoint:{get:function(){return this.ku}},handleAngle:{get:function(){return this.u},set:function(a){this.u=a}},handleDistance:{get:function(){return this.K},set:function(a){this.K=a}}});dh.className="RotatingTool";
Ta("rotatingTool",function(){return this.findTool("Rotating")},function(a){Gf(this,"Rotating",a,this.mouseDownTools)});function eh(){nf.call(this);this.name="ClickSelecting"}oa(eh,nf);eh.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};eh.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};eh.className="ClickSelectingTool";
function fh(){nf.call(this);this.name="Action";this.nk=null}oa(fh,nf);fh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.Rb(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.nk=c;a.Bk=a.Rb(b.documentPoint,null,null);return!0}return!1};
fh.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.nk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()};fh.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.nk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};
fh.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.nk;if(null===b)return;a.targetObject=b;null!==b.actionUp&&b.actionUp(a,b);this.standardMouseClick(function(a){for(;null!==a.panel&&(!a.isActionable||a!==b);)a=a.panel;return a},function(a){return a===b})}this.stopTool()};fh.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.nk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};
fh.prototype.doStop=function(){this.nk=null};fh.className="ActionTool";function gh(){nf.call(this);this.name="ClickCreating";this.Ri=null;this.u=!0;this.l=!1;this.sw=new G(0,0)}oa(gh,nf);
gh.prototype.canStart=function(){if(!this.isEnabled||null===this.archetypeNodeData)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.lastInput.left||this.isBeyondDragSize())return!1;if(this.isDoubleClick){if(1===a.lastInput.clickCount&&(this.sw=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.sw))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.Ul(a.lastInput.documentPoint,!0)?!1:!0};
gh.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()};
gh.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;this.Aa(this.name);var d=null;c instanceof T?c.cc()&&($g(c),d=c.copy(),null!==d&&b.add(d)):null!==c&&(c=b.model.copyNodeData(c),Aa(c)&&(b.model.gf(c),d=b.xc(c)));null!==d&&(c=G.allocAt(a.x,a.y),this.isGridSnapEnabled&&hh(this.diagram,d,a,c),d.location=c,b.allowSelect&&b.select(d),G.free(c));b.Xa();this.transactionResult=this.name;b.aa("PartCreated",d);this.sg();return d};
pa.Object.defineProperties(gh.prototype,{archetypeNodeData:{get:function(){return this.Ri},set:function(a){this.Ri=a}},isDoubleClick:{get:function(){return this.u},set:function(a){this.u=a}},isGridSnapEnabled:{get:function(){return this.l},set:function(a){this.l=a}}});gh.className="ClickCreatingTool";
function ih(){nf.call(this);this.name="DragSelecting";this.Ik=175;this.u=!1;var a=new T;a.layerName="Tool";a.selectable=!1;var b=new V;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}oa(ih,nf);
ih.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(!a.allowSelect)return!1;var b=a.lastInput;return!b.left||a.currentTool!==this&&(!this.isBeyondDragSize()||b.timestamp-a.firstInput.timestamp<this.delay||null!==a.Ul(b.documentPoint,!0))?!1:!0};ih.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()};
ih.prototype.doDeactivate=function(){var a=this.diagram;a.sf();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};ih.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.bb("SHAPE");null===c&&(c=this.box.Ab());var d=L.alloc().h(b.width,b.height);b=G.alloc().h(b.x,b.y);c.desiredSize=d;this.box.position=b;L.free(d);G.free(b);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.Js(a.lastInput.viewPoint)}};
ih.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",this.selectInRect(this.computeBoxBounds())}finally{a.currentCursor=""}}this.stopTool()};ih.prototype.computeBoxBounds=function(){var a=this.diagram;return new N(a.firstInput.documentPoint,a.lastInput.documentPoint)};
ih.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;b.aa("ChangingSelection",b.selection);a=b.gx(a,this.isPartialInclusion);if(ib?c.meta:c.control)if(c.shift)for(a=a.iterator;a.next();)c=a.value,c.isSelected&&(c.isSelected=!1);else for(a=a.iterator;a.next();)c=a.value,c.isSelected=!c.isSelected;else if(c.shift)for(a=a.iterator;a.next();)c=a.value,c.isSelected||(c.isSelected=!0);else{c=new E;for(var d=b.selection.iterator;d.next();){var e=d.value;a.contains(e)||c.add(e)}for(c=c.iterator;c.next();)c.value.isSelected=
!1;for(a=a.iterator;a.next();)c=a.value,c.isSelected||(c.isSelected=!0)}b.aa("ChangedSelection",b.selection)};pa.Object.defineProperties(ih.prototype,{delay:{get:function(){return this.Ik},set:function(a){this.Ik=a}},isPartialInclusion:{get:function(){return this.u},set:function(a){this.u=a}},box:{get:function(){return this.l},set:function(a){this.l=a}}});ih.className="DragSelectingTool";
function jh(){nf.call(this);this.name="Panning";this.gu=new G;this.Xx=new G;this.xg=!1;var a=this;this.Ew=function(){w.document.removeEventListener("scroll",a.Ew,!1);a.stopTool()}}oa(jh,nf);jh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return!a.allowHorizontalScroll&&!a.allowVerticalScroll||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:!0};
jh.prototype.doActivate=function(){var a=this.diagram;this.xg?(a.lastInput.bubbles=!0,w.document.addEventListener("scroll",this.Ew,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.gu.assign(a.position));this.isActive=!0};jh.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};jh.prototype.doCancel=function(){var a=this.diagram;a.position=this.gu;a.isMouseCaptured=!1;this.stopTool()};jh.prototype.doMouseMove=function(){this.move()};
jh.prototype.doMouseUp=function(){this.move();this.stopTool()};jh.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.xg)a.lastInput.bubbles=!0;else{var b=a.position,c=a.firstInput.documentPoint,d=a.lastInput.documentPoint,e=b.x+c.x-d.x;c=b.y+c.y-d.y;a.allowHorizontalScroll||(e=b.x);a.allowVerticalScroll||(c=b.y);a.position=this.Xx.h(e,c)}};
pa.Object.defineProperties(jh.prototype,{bubbles:{get:function(){return this.xg},set:function(a){this.xg=a}},originalPosition:{get:function(){return this.gu}}});jh.className="PanningTool";Ta("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){Gf(this,"ClickCreating",a,this.mouseUpTools)});Ta("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){Gf(this,"ClickSelecting",a,this.mouseUpTools)});
Ta("panningTool",function(){return this.findTool("Panning")},function(a){Gf(this,"Panning",a,this.mouseMoveTools)});Ta("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){Gf(this,"DragSelecting",a,this.mouseMoveTools)});Ta("actionTool",function(){return this.findTool("Action")},function(a){Gf(this,"Action",a,this.mouseDownTools)});function xf(){this.da=this.K=this.l=this.u=null}
pa.Object.defineProperties(xf.prototype,{mainElement:{get:function(){return this.K},set:function(a){this.K=a}},show:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},hide:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},valueFunction:{get:function(){return this.da},set:function(a){this.da=a}}});xf.className="HTMLInfo";
function kh(a,b,c){this.text=a;this.Uw=b;this.visible=c}kh.className="ContextMenuButtonInfo";function lh(){nf.call(this);this.name="ContextMenu";this.u=this.Jt=this.l=null;this.xw=new G;this.Kt=this.Qh=null;var a=this;this.uu=function(){a.stopTool()}}oa(lh,nf);
function mh(a){var b=new xf;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};a.Qh=b;a.uu=function(){a.stopTool()};b=va("div");var c=va("div");b.style.cssText="top: 0px;z-index:10002;position: fixed;display: none;text-align: center;left: 25%;width: 50%;background-color: #F5F5F5;padding: 16px;border: 16px solid #444;border-radius: 10px;margin-top: 10px";c.style.cssText="z-index:10001;position: fixed;display: none;top: 0;left: 0;width: 100%;height: 100%;background-color: black;opacity: 0.8;";
var d=va("style");w.document.getElementsByTagName("head")[0].appendChild(d);d.sheet.insertRule(".goCXul { list-style: none; }",0);d.sheet.insertRule(".goCXli {font:700 1.5em Helvetica, Arial, sans-serif;position: relative;min-width: 60px; }",0);d.sheet.insertRule(".goCXa {color: #444;display: inline-block;padding: 4px;text-decoration: none;margin: 2px;border: 1px solid gray;border-radius: 10px; }",0);b.addEventListener("contextmenu",nh,!1);b.addEventListener("selectstart",nh,!1);c.addEventListener("contextmenu",
nh,!1);w.document.body&&(w.document.body.appendChild(b),w.document.body.appendChild(c));sb=b;qb=c;mb=!0}function nh(a){a.preventDefault();return!1}lh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(this.isBeyondDragSize()||!a.lastInput.right)return!1;!1===mb&&null===this.Qh&&oh&&mh(this);return null!==this.Qh&&a.lastInput.isTouchEvent||null!==this.findObjectWithContextMenu()?!0:!1};lh.prototype.doStart=function(){this.xw.set(this.diagram.firstInput.documentPoint)};
lh.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null};lh.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof P||(a instanceof Y?d=a:d=b.Rb(c.documentPoint,null,function(a){return!a.layer.isTemporary}));if(null!==d){for(a=d;null!==a;){if(null!==a.contextMenu)return a;a=a.panel}if(null!==this.Qh&&b.lastInput.isTouchEvent)return d.part}else if(null!==b.contextMenu)return b;return null};
lh.prototype.doActivate=function(){};lh.prototype.doMouseDown=function(){nf.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof sf){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&ph(this)};
lh.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof sf){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}ph(this)};
function ph(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof xf)){var d=b.Rb(b.lastInput.documentPoint,null,null);null!==d&&d.ng(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(qh(a,!0),a.isActive||a.stopTool())}
function qh(a,b,c){void 0===c&&(c=null);b&&a.standardMouseSelect();if(!a.standardMouseClick())if(a.isActive=!0,b=a.Qh,null===c&&(c=a.findObjectWithContextMenu()),null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof Y?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null)}lh.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()};
lh.prototype.showContextMenu=function(a,b){var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof sf){a.layerName="Tool";a.selectable=!1;a.scale=1/c.scale;a.category=this.name;null!==a.placeholder&&(a.placeholder.scale=c.scale);var d=a.diagram;null!==d&&d!==c&&d.remove(a);c.add(a);null!==b?(c=null,d=b.ph(),null!==d&&(c=d.data),a.adornedObject=b,a.data=c):a.data=c.model;a.ac();this.positionContextMenu(a,b)}else a instanceof xf&&a.show(b,c,this);this.currentContextMenu=
a};lh.prototype.positionContextMenu=function(a){if(null===a.placeholder){var b=this.diagram,c=b.lastInput.documentPoint.copy(),d=a.measuredBounds,e=b.viewportBounds;b.lastInput.isTouchEvent&&(c.x-=d.width);c.x+d.width>e.right&&(c.x-=d.width+5/b.scale);c.x<e.x&&(c.x=e.x);c.y+d.height>e.bottom&&(c.y-=d.height+5/b.scale);c.y<e.y&&(c.y=e.y);a.position=c}};
lh.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof sf?(a.remove(b),null!==this.Jt&&this.Jt.qf(b.category),b.data=null,b.adornedObject=null):b instanceof xf&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())};
function rh(){var a=new E;a.add(new kh("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));a.add(new kh("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));a.add(new kh("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));a.add(new kh("Paste",function(a){a.commandHandler.pasteSelection(a.lastInput.documentPoint)},function(a){return a.commandHandler.canPasteSelection()}));
a.add(new kh("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));a.add(new kh("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));a.add(new kh("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));a.add(new kh("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));a.add(new kh("Zoom To Fit",function(a){a.commandHandler.zoomToFit()},
function(a){return a.commandHandler.canZoomToFit()}));a.add(new kh("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));a.add(new kh("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));a.add(new kh("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));a.add(new kh("Edit Text",function(a){a.commandHandler.editTextBlock()},
function(a){return a.commandHandler.canEditTextBlock()}));return a}
lh.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.Kt&&(this.Kt=rh());sb.innerHTML="";qb.addEventListener("click",this.uu,!1);var b=this,c=va("ul");c.className="goCXul";sb.appendChild(c);c.innerHTML="";for(var d=this.Kt.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.Uw&&("function"!==typeof f||f(a))){f=va("li");f.className="goCXli";var g=va("a");g.className="goCXa";g.href="#";g.Px=e.Uw;g.addEventListener("click",function(c){this.Px(a);b.stopTool();
c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}sb.style.display="block";qb.style.display="block"};lh.prototype.hideDefaultContextMenu=function(){null!==this.currentContextMenu&&this.currentContextMenu===this.Qh&&(sb.style.display="none",qb.style.display="none",qb.removeEventListener("click",this.uu,!1),this.currentContextMenu=null)};
pa.Object.defineProperties(lh.prototype,{currentContextMenu:{get:function(){return this.l},set:function(a){this.l=a;this.Jt=a instanceof sf?a.adornedPart:null}},defaultTouchContextMenu:{get:function(){return this.Qh},set:function(a){this.Qh=a}},currentObject:{get:function(){return this.u},set:function(a){this.u=a}},mouseDownPoint:{get:function(){return this.xw}}});lh.className="ContextMenuTool";
Ta("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){Gf(this,"ContextMenu",a,this.mouseUpTools)});function sh(){nf.call(this);this.name="TextEditing";this.bh=new th;this.Wa=null;this.La=uh;this.ri=null;this.la=vh;this.K=1;this.da=!0;this.u=null;this.l=new xf;this.Lt=null;wh(this,this.l)}oa(sh,nf);
function wh(a,b){if(oh){var c=va("textarea");a.Lt=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.px(this.value);this.style.width=20+b.measuredBounds.width*this.Jz+"px";this.rows=b.lineCount}},!1);c.addEventListener("keydown",function(b){if(null!==a.textBlock){var c=b.which;13===c?(!1===a.textBlock.isMultiline&&b.preventDefault(),a.acceptText(xh)):9===c?(a.acceptText(yh),b.preventDefault()):27===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus",
function(){if(null!==a.currentTextEditor&&a.state!==vh){var b=a.Lt;a.la===zh&&(a.la=Ah);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==vh){var b=a.Lt;"function"===typeof b.focus&&b.focus();"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);b.valueFunction=function(){return c.value};b.mainElement=c;b.show=function(a,
b,f){if(a instanceof th&&f instanceof sh)if(f.state===Bh)c.style.border="3px solid red",c.focus();else{var d=a.ma(gd),e=b.position,k=b.scale,l=a.Be()*k;l<f.minimumEditorScale&&(l=f.minimumEditorScale);var m=a.naturalBounds.width*l+6,n=a.naturalBounds.height*l+2,p=(d.x-e.x)*k;d=(d.y-e.y)*k;c.value=a.text;b.div.style.font=a.font;c.style.position="absolute";c.style.zIndex="100";c.style.font="inherit";c.style.fontSize=100*l+"%";c.style.lineHeight="normal";c.style.width=m+"px";c.style.left=(p-m/2|0)-1+
"px";c.style.top=(d-n/2|0)-1+"px";c.style.textAlign=a.textAlign;c.style.margin="0";c.style.padding="1px";c.style.border="0";c.style.outline="none";c.style.whiteSpace="pre-wrap";c.style.overflow="hidden";c.rows=a.lineCount;c.Jz=l;b.div.appendChild(c);c.focus();f.selectsTextOnActivate&&(c.select(),c.setSelectionRange(0,9999))}};b.hide=function(a){a.div.removeChild(c)}}}
sh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.Rb(a.lastInput.documentPoint);if(!(null!==b&&b instanceof th&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===uh&&!b.isSelected||this.starting===Ch&&2>a.lastInput.clickCount?!1:!0};sh.prototype.doStart=function(){this.isActive||null===this.textBlock||this.doActivate()};
sh.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.Rb(a.lastInput.documentPoint));if(null!==b&&b instanceof th&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.la=zh;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.bh=this.textBlock.copy();var d=new N(this.textBlock.ma(cd),this.textBlock.ma(pd));a.zv(d);c.show(b,a,this);this.currentTextEditor=c}}}};sh.prototype.doCancel=function(){this.stopTool()};
sh.prototype.doMouseUp=function(){!this.isActive&&this.canStart()&&this.doActivate()};sh.prototype.doMouseDown=function(){this.isActive&&this.acceptText(Dh)};
sh.prototype.acceptText=function(a){switch(a){case Dh:if(this.la===Hh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.la===zh||this.la===Bh||this.la===Ah)this.la=Ih,Jh(this);break;case Kh:case xh:case yh:if(xh!==a||!0!==this.textBlock.isMultiline)if(this.la===zh||this.la===Bh||this.la===Ah)this.la=Ih,Jh(this)}};
function Jh(a){var b=a.textBlock,c=a.diagram,d=a.currentTextEditor;if(null!==b&&null!==d){var e=b.text,f="";null!==d.valueFunction&&(f=d.valueFunction());a.isValidText(b,e,f)?(a.Aa(a.name),a.la=Hh,a.transactionResult=a.name,b.text=f,null!==b.textEdited&&b.textEdited(b,e,f),null!==c&&c.aa("TextEdited",b,e),a.sg(),a.stopTool(),null!==c&&c.doFocus()):(a.la=Bh,null!==b.errorFunction&&b.errorFunction(a,e,f),d.show(b,c,a))}}
sh.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.la=vh,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};sh.prototype.isValidText=function(a,b,c){var d=this.textValidation;if(null!==d&&!d(a,b,c))return!1;d=a.textValidation;return null===d||d(a,b,c)?!0:!1};sh.prototype.px=function(a){var b=this.bh;b.text=a;b.measure(this.textBlock.al,Infinity);return b};
pa.Object.defineProperties(sh.prototype,{textBlock:{get:function(){return this.Wa},set:function(a){this.Wa=a}},currentTextEditor:{get:function(){return this.u},set:function(a){this.u=a}},defaultTextEditor:{get:function(){return this.l},set:function(a){this.l=a}},starting:{get:function(){return this.La},set:function(a){this.La=a}},textValidation:{get:function(){return this.ri},
set:function(a){this.ri=a}},minimumEditorScale:{get:function(){return this.K},set:function(a){this.K=a}},selectsTextOnActivate:{get:function(){return this.da},set:function(a){this.da=a}},state:{get:function(){return this.la},set:function(a){this.la!==a&&(this.la=a)}}});sh.prototype.measureTemporaryTextBlock=sh.prototype.px;
var Kh=new D(sh,"LostFocus",0),Dh=new D(sh,"MouseDown",1),yh=new D(sh,"Tab",2),xh=new D(sh,"Enter",3),Lh=new D(sh,"SingleClick",0),uh=new D(sh,"SingleClickSelected",1),Ch=new D(sh,"DoubleClick",2),vh=new D(sh,"StateNone",0),zh=new D(sh,"StateActive",1),Ah=new D(sh,"StateEditing",2),Ih=new D(sh,"StateValidating",3),Bh=new D(sh,"StateInvalid",4),Hh=new D(sh,"StateValidated",5);sh.className="TextEditingTool";sh.LostFocus=Kh;sh.MouseDown=Dh;sh.Tab=yh;sh.Enter=xh;sh.SingleClick=Lh;
sh.SingleClickSelected=uh;sh.DoubleClick=Ch;sh.StateNone=vh;sh.StateActive=zh;sh.StateEditing=Ah;sh.StateValidating=Ih;sh.StateInvalid=Bh;sh.StateValidated=Hh;Ta("textEditingTool",function(){return this.findTool("TextEditing")},function(a){Gf(this,"TextEditing",a,this.mouseUpTools)});
function Mh(){this.kw=Nh;this.F=of;this.ln=this.mn=null;this.Qi=this.nn=this.on=0;this.sk=this.$a=this.Ar=this.cj=!1;this.Yh=this.Oc=!0;this.Sq=this.Rq=this.jw=null;this.iw=0;this.Tq=new Pb;this.Eq=new F;this.Rt=600;this.Rx=new G(0,0);this.gw=this.fw=this.Hw=!1;this.pj=new Pb}Mh.prototype.ob=function(a){this.F=a};function Nh(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}Mh.prototype.canStart=function(){return!0};
Mh.prototype.Ji=function(a){this.Oc&&(this.Yh||this.F.Xj)&&(this.Eq.add(a),this.canStart(a)&&(this.cj&&this.Vd(),this.$a=!0))};function Oh(a){if(a.Oc&&(a.Eq.clear(),a.$a))if(!a.sk)a.$a=!1;else if(0===a.Qi){var b=+new Date;a.Qi=b;w.requestAnimationFrame(function(){if(!1!==a.$a&&!a.cj&&a.Qi===b){var c=a.F;c.Ce("temporaryPixelRatio")&&(c.te=1);Ph(c);a.$a=!1;c.aa("AnimationStarting");Qh(a,b)}})}}
function Rh(a,b,c,d,e,f){if(!(!a.$a||"position"===c&&d.A(e)||b instanceof T&&!b.isAnimated)){var g=a.pj;if(g.contains(b)){g=g.J(b);var h=g.start,k=g.end;void 0===h[c]&&(h[c]=Sh(d));g.Hs&&void 0!==k[c]?g.Lp[c]=Sh(e):(f||(g.Lp[c]=Sh(e)),k[c]=Sh(e));f&&0===c.indexOf("position:")&&b instanceof T&&(g.Lp.location=Sh(b.location))}else h=new yb,k=new yb,h[c]=Sh(d),k[c]=Sh(e),d=h.position,d instanceof G&&!d.s()&&a.Eq.contains("Expand SubGraph")&&d.assign(k.position),d=new Th(h,k,f),f&&0===c.indexOf("position:")&&
b instanceof T&&(d.Lp.location=Sh(b.location)),g.add(b,d);a.sk=!0}}function Sh(a){return a instanceof G?a.copy():a instanceof L?a.copy():a}
function Qh(a,b){var c;function d(){if(!1!==f.cj&&f.Qi===b){var a=+new Date,c=a>r?l:a-q;Uh(f);Vh(f,e,p,g,c,l);f.Rq&&f.Rq();rg(e);Wh(f);a>r?Xh(f):w.requestAnimationFrame(d)}}void 0===c&&(c=new yb);var e=a.F;if(null!==e){var f=a,g=c.Rz||a.kw,h=c.Vz||null,k=c.Wz||null,l=c.duration||a.Rt,m=a.Rx;for(c=a.pj.iterator;c.next();){var n=c.value.start.position;n instanceof G&&(n.s()||n.assign(m))}a.jw=g;a.Rq=h;a.Sq=k;a.iw=l;a.Tq=a.pj;var p=a.Tq;for(c=p.iterator;c.next();)h=c.value.end,h["position:placeholder"]&&
(k=c.key.findVisibleNode(),k instanceof kg&&null!==k.placeholder&&(m=k.placeholder,k=m.ma(cd),m=m.padding,k.x+=m.left,k.y+=m.top,h["position:placeholder"]=k));a.cj=!0;Uh(a);Vh(a,e,p,g,0,l);rg(a.F,!0);Wh(a);var q=+new Date,r=q+l;f.Qi===b&&w.requestAnimationFrame(function(){d()})}}function Uh(a){if(!a.Ar){var b=a.F;a.Hw=b.skipsUndoManager;a.fw=b.skipsModelSourceBindings;a.gw=b.jk;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;b.jk=!0;a.Ar=!0}}
function Wh(a){var b=a.F;b.skipsUndoManager=a.Hw;b.skipsModelSourceBindings=a.fw;b.jk=a.gw;a.Ar=!1}function Vh(a,b,c,d,e,f){for(c=c.iterator;c.next();){var g=c.key,h=c.value,k=h.start;h=h.end;for(var l in h)if(("position"!==l||!h["position:placeholder"]&&!h["position:node"])&&void 0!==Yh[l])Yh[l](g,k[l],h[l],d,e,f)}d=b.dv;b.dv=!0;l=a.kw;0!==a.on&&0!==a.nn&&(c=a.on,b.Ca=l(e,c,a.nn-c,f));null!==a.mn&&null!==a.ln&&(c=a.mn,a=a.ln,b.sa=new G(l(e,c.x,a.x-c.x,f),l(e,c.y,a.y-c.y,f)));b.dv=d}
Mh.prototype.Vd=function(){!0===this.$a&&(this.$a=!1,this.Qi=0,this.sk&&this.F.ec());this.cj&&this.Oc&&Xh(this)};
function Xh(a){a.cj=!1;a.sk=!1;Uh(a);for(var b=a.F,c=a.jw,d=a.iw,e=a.Tq.iterator;e.next();){var f=e.key,g=e.value,h=g.start,k=g.end,l=g.Lp,m;for(m in k)if(void 0!==Yh[m]){var n=m;!g.Hs||"position:node"!==n&&"position:placeholder"!==n||(n="position");Yh[n](f,h[m],void 0!==l[m]?l[m]:g.Hs?h[m]:k[m],c,d,d)}g.Hs&&void 0!==l.location&&f instanceof T&&(f.location=l.location);g.lt&&f instanceof T&&f.Mb(!1)}for(c=a.F.links;c.next();)d=c.value,null!==d.ol&&(d.points=d.ol,d.ol=null);b.ct.clear();Wf(b,!1);b.Xa();
b.R();b.hd();Zh(b);Wh(a);a.Sq&&a.Sq();a.Qi=0;a.Tq=new Pb;a.Sq=null;a.Rq=null;a.mn=null;a.ln=null;a.on=0;a.nn=0;a.pj=new Pb;b.aa("AnimationFinished");b.ec()}
Mh.prototype.Fp=function(a,b){var c=a.actualBounds,d=b.actualBounds,e=null;b instanceof kg&&(e=b.placeholder);null!==e?(c=e.ma(cd),e=e.padding,c.x+=e.left,c.y+=e.top,Rh(this,a,"position",c,a.position,!1)):Rh(this,a,"position",new G(d.x+d.width/2-c.width/2,d.y+d.height/2-c.height/2),a.position,!1);Rh(this,a,"scale",.01,a.scale,!1);if(a instanceof kg)for(a=a.memberParts;a.next();)e=a.value,e instanceof U&&this.Fp(e,b)};
Mh.prototype.Ep=function(a,b){if(a.isVisible()){var c=null;b instanceof kg&&(c=b.placeholder);null!==c?Rh(this,a,"position:placeholder",a.position,c,!0):Rh(this,a,"position:node",a.position,b,!0);Rh(this,a,"scale",a.scale,.01,!0);this.$a&&(c=this.pj,c.contains(a)&&(c.J(a).lt=!0));if(a instanceof kg)for(a=a.memberParts;a.next();)c=a.value,c instanceof U&&this.Ep(c,b)}};function $h(a,b,c){a.$a&&!b.A(c)&&(null===a.mn&&b.s()&&null===a.ln&&(a.mn=b.copy()),a.ln=c.copy(),a.sk=!0)}
function ai(a,b,c){a.$a&&a.F.Xj&&(0===a.on&&0===a.nn&&(a.on=b),a.nn=c,a.sk=!0)}
pa.Object.defineProperties(Mh.prototype,{animationReasons:{get:function(){return this.Eq}},isEnabled:{get:function(){return this.Oc},set:function(a){this.Oc=a}},duration:{get:function(){return this.Rt},set:function(a){1>a&&xa(a,">= 1",Mh,"duration");this.Rt=a}},isAnimating:{get:function(){return this.cj}},isTicking:{get:function(){return this.Ar}},isInitial:{
get:function(){return this.Yh},set:function(a){this.Yh=a}}});Mh.prototype.stopAnimation=Mh.prototype.Vd;Mh.prototype.prepareAutomaticAnimation=Mh.prototype.Ji;Mh.className="AnimationManager";function Th(a,b,c){this.start=a;this.end=b;this.Lp=new yb;this.Hs=c;this.lt=!1}Th.className="AnimationStates";
var Yh={opacity:function(a,b,c,d,e,f){a.opacity=d(e,b,c-b,f)},position:function(a,b,c,d,e,f){e!==f?a.tt(d(e,b.x,c.x-b.x,f),d(e,b.y,c.y-b.y,f)):a.position=new G(d(e,b.x,c.x-b.x,f),d(e,b.y,c.y-b.y,f))},"position:node":function(a,b,c,d,e,f){var g=a.actualBounds,h=c.actualBounds;c=h.x+h.width/2-g.width/2;g=h.y+h.height/2-g.height/2;e!==f?a.tt(d(e,b.x,c-b.x,f),d(e,b.y,g-b.y,f)):a.position=new G(d(e,b.x,c-b.x,f),d(e,b.y,g-b.y,f))},"position:placeholder":function(a,b,c,d,e,f){e!==f?a.tt(d(e,b.x,c.x-b.x,
f),d(e,b.y,c.y-b.y,f)):a.position=new G(d(e,b.x,c.x-b.x,f),d(e,b.y,c.y-b.y,f))},scale:function(a,b,c,d,e,f){a.scale=d(e,b,c-b,f)},visible:function(a,b,c,d,e,f){a.visible=e!==f?b:c}};function bi(){tb(this);this.F=null;this.Fa=new E;this.Ta="";this.mb=1;this.u=!1;this.tj=this.K=this.Hh=this.Gh=this.Fh=this.Eh=this.Ch=this.Dh=this.Bh=this.Jh=this.Ah=this.Ih=this.zh=this.yh=!0;this.l=!1;this.Do=[]}t=bi.prototype;t.ob=function(a){this.F=a};
t.toString=function(a){void 0===a&&(a=0);var b='Layer "'+this.name+'"';if(0>=a)return b;for(var c=0,d=0,e=0,f=0,g=0,h=this.Fa.iterator;h.next();){var k=h.value;k instanceof kg?e++:k instanceof U?d++:k instanceof S?f++:k instanceof sf?g++:c++}h="";0<c&&(h+=c+" Parts ");0<d&&(h+=d+" Nodes ");0<e&&(h+=e+" Groups ");0<f&&(h+=f+" Links ");0<g&&(h+=g+" Adornments ");if(1<a)for(a=this.Fa.iterator;a.next();)c=a.value,h+="\n "+c.toString(),d=c.data,null!==d&&Fb(d)&&(h+=" #"+Fb(d)),c instanceof U?h+=" "+
Qa(d):c instanceof S&&(h+=" "+Qa(c.fromNode)+" "+Qa(c.toNode));return b+" "+this.Fa.count+": "+h};t.Rb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.tj)return null;var d=!1;null!==this.diagram&&this.diagram.viewportBounds.ea(a)&&(d=!0);for(var e=G.alloc(),f=this.Fa.j,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==qg(h))&&h.isVisible()&&(e.assign(a),Yb(e,h.td),h=h.Rb(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return G.free(e),h}G.free(e);return null};
t.Sj=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new F);if(!1===this.tj)return d;var e=!1;null!==this.diagram&&this.diagram.viewportBounds.ea(a)&&(e=!0);for(var f=G.alloc(),g=this.Fa.j,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==qg(k))&&k.isVisible()){f.assign(a);Yb(f,k.td);var l=k;k.Sj(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}G.free(f);return d};
t.jg=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);if(!1===this.tj)return e;var f=!1;null!==this.diagram&&this.diagram.viewportBounds.kf(a)&&(f=!0);for(var g=this.Fa.j,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==qg(k))&&k.isVisible()){var l=k;k.jg(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e};
t.kg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);if(!1===this.tj)return f;var g=!1;null!==this.diagram&&this.diagram.viewportBounds.ea(a)&&(g=!0);for(var h=G.alloc(),k=G.alloc(),l=this.Fa.j,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==qg(n))&&n.isVisible()){h.assign(a);Yb(h,n.td);k.h(a.x+b,a.y);Yb(k,n.td);var p=n;n.kg(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===
p||null!==d&&!d(p)||f.add(p))}}G.free(h);G.free(k);return f};
t.kd=function(a,b){if(this.visible){var c=void 0===b?a.viewportBounds:b;var d=this.Fa.j,e=d.length;a=Ka();b=Ka();for(var f=0;f<e;f++){var g=d[f];g.ww=f;g instanceof S&&!1===g.Lc||g instanceof sf&&null!==g.adornedPart||(Dc(g.actualBounds,c,10)?(g.kd(!0),a.push(g)):(g.kd(!1),null!==g.adornments&&0<g.adornments.count&&b.push(g)))}for(c=0;c<a.length;c++)for(d=a[c],ci(d),d=d.adornments;d.next();)e=d.value,e.measure(Infinity,Infinity),e.arrange(),e.kd(!0);for(c=0;c<b.length;c++)d=b[c],d.updateAdornments(),
di(d,!0);Oa(a);Oa(b)}};t.kc=function(a,b,c){if(this.visible&&0!==this.mb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Fa.j;var d=c.length;if(0!==d){1!==this.mb&&(a.globalAlpha=this.mb);var e=this.Do;e.length=0;for(var f=b.scale,g=0;g<d;g++){var h=c[g];if(qg(h)){if(h instanceof S&&(h.isOrthogonal&&e.push(h),!1===h.Lc))continue;var k=h.actualBounds;1<k.width*f||1<k.height*f?h.kc(a,b):ei(a,h)}}a.globalAlpha=1}}};
function ei(a,b){var c=b.actualBounds,d=b.naturalBounds;if(0!==c.width&&0!==c.height&&!isNaN(c.x)&&!isNaN(c.y)&&b.isVisible()){var e=b.transform;null!==b.areaBackground&&(fi(b,a,b.areaBackground,!0,!0,d,c),a.fillRect(c.x,c.y,c.width,c.height));null===b.areaBackground&&null===b.background&&(fi(b,a,"rgba(0,0,0,0.4)",!0,!1,d,c),a.fillRect(c.x,c.y,c.width,c.height));null!==b.background&&(a.transform(e.m11,e.m12,e.m21,e.m22,e.dx,e.dy),fi(b,a,b.background,!0,!1,d,c),a.fillRect(0,0,d.width,d.height),e.Zs()||
(b=1/(e.m11*e.m22-e.m12*e.m21),a.transform(e.m22*b,-e.m12*b,-e.m21*b,e.m11*b,b*(e.m21*e.dy-e.m22*e.dx),b*(e.m12*e.dx-e.m11*e.dy))))}}t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.cb(df,a,this,b,c,d,e)};t.Gi=function(a,b,c){var d=this.Fa;b.bi=this;if(a>=d.count)a=d.count;else if(d.N(a)===b)return-1;d.Jb(a,b);b.Tp(c);d=this.diagram;null!==d&&(c?d.R():d.Gi(b));gi(this,a,b);return a};
t.zc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.zc(a,b,c);var d=this.Fa;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.N(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.Up(c);d.nb(a);d=this.diagram;null!==d&&(c?d.R():d.zc(b));b.bi=null;return a};
function gi(a,b,c){b=hi(a,b,c);if(c instanceof kg&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Fa.j,f=e.length,g=0;g<f;g++){var h=e[g];if(h===c&&(b=g,0<=d))break;if(0>d&&h.containingGroup===c&&(d=g,0<=b))break}!(0>d)&&d<b&&(e=a.Fa,e.nb(b),e.Jb(d,c))}c=c.containingGroup;null!==c&&gi(a,-1,c)}}
function hi(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Fa;var e=a.count;if(1>=e)return b;0>b&&(b=a.indexOf(c));if(0>b)return-1;for(var f=b-1,g=NaN;0<=f;){g=a.N(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.N(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.nb(b);a.Jb(f,c);return f}for(g=NaN;0<=--f&&(g=a.N(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.nb(b);a.Jb(h,c);return h}for(k=NaN;++h<
e&&(k=a.N(h).zOrder,isNaN(k)););}return b}t.clear=function(){for(var a=this.Fa.Ma(),b=a.length,c=0;c<b;c++)a[c].kd(!1),this.zc(-1,a[c],!1);this.Do.length=0};
pa.Object.defineProperties(bi.prototype,{parts:{get:function(){return this.Fa.iterator}},partsBackwards:{get:function(){return this.Fa.iteratorBackwards}},diagram:{get:function(){return this.F}},name:{get:function(){return this.Ta},set:function(a){var b=this.Ta;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&A("Cannot rename default Layer to: "+a),c=c.layers;c.next();)c.value.name===
a&&A("Layer.name is already present in this diagram: "+a);this.Ta=a;this.g("name",b,a);for(a=this.Fa.iterator;a.next();)a.value.layerName=this.Ta}}},opacity:{get:function(){return this.mb},set:function(a){var b=this.mb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",bi,"opacity"),this.mb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.R())}},isTemporary:{get:function(){return this.u},set:function(a){var b=this.u;b!==a&&(this.u=a,this.g("isTemporary",
b,a))}},visible:{get:function(){return this.K},set:function(a){var b=this.K;if(b!==a){this.K=a;this.g("visible",b,a);for(b=this.Fa.iterator;b.next();)b.value.Mb(a);a=this.diagram;null!==a&&a.R()}}},pickable:{get:function(){return this.tj},set:function(a){var b=this.tj;b!==a&&(this.tj=a,this.g("pickable",b,a))}},isBoundsIncluded:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==this.diagram&&
this.diagram.Xa())}},allowCopy:{get:function(){return this.yh},set:function(a){var b=this.yh;b!==a&&(this.yh=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.zh},set:function(a){var b=this.zh;b!==a&&(this.zh=a,this.g("allowDelete",b,a))}},allowTextEdit:{get:function(){return this.Ih},set:function(a){var b=this.Ih;b!==a&&(this.Ih=a,this.g("allowTextEdit",b,a))}},allowGroup:{
get:function(){return this.Ah},set:function(a){var b=this.Ah;b!==a&&(this.Ah=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.Jh},set:function(a){var b=this.Jh;b!==a&&(this.Jh=a,this.g("allowUngroup",b,a))}},allowLink:{get:function(){return this.Bh},set:function(a){var b=this.Bh;b!==a&&(this.Bh=a,this.g("allowLink",b,a))}},allowRelink:{get:function(){return this.Dh},set:function(a){var b=
this.Dh;b!==a&&(this.Dh=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Ch},set:function(a){var b=this.Ch;b!==a&&(this.Ch=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Eh},set:function(a){var b=this.Eh;b!==a&&(this.Eh=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Fh},set:function(a){var b=this.Fh;b!==a&&(this.Fh=a,this.g("allowResize",b,a))}},
allowRotate:{get:function(){return this.Gh},set:function(a){var b=this.Gh;b!==a&&(this.Gh=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.Hh},set:function(a){var b=this.Hh;b!==a&&(this.Hh=a,this.g("allowSelect",b,a))}}});bi.prototype.findObjectsNear=bi.prototype.kg;bi.prototype.findObjectsIn=bi.prototype.jg;bi.prototype.findObjectsAt=bi.prototype.Sj;bi.prototype.findObjectAt=bi.prototype.Rb;bi.className="Layer";
function P(a){function b(){w.document.removeEventListener("DOMContentLoaded",b,!1);c.setRTL()}1<arguments.length&&A("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");ii||(ji(),ii=!0);tb(this);of=this;Xa=[];this.qb=!0;this.Dq=new Mh;this.Dq.ob(this);this.Hb=17;this.Nn=!1;this.lu="default";this.Ha=null;var c=this;oh&&(null!==w.document.body?this.setRTL():w.document.addEventListener("DOMContentLoaded",b,!1));this.Ra=new E;this.wa=this.xa=0;this.Ea=null;this.bs=
new Pb;this.$u();this.Wg=this.$c=null;this.xv();this.Vk=null;this.wv();this.sa=(new G(NaN,NaN)).freeze();this.Wq=this.Ca=1;this.rr=(new G(NaN,NaN)).freeze();this.sr=NaN;this.Mr=1E-4;this.Kr=100;this.ub=new Tc;this.Cs=(new G(NaN,NaN)).freeze();this.gr=(new N(NaN,NaN,NaN,NaN)).freeze();this.mi=(new Lc(0,0,0,0)).freeze();this.js=ki;this.ms=!1;this.fs=this.$r=null;this.Si=li;this.Ui=Hd;this.Wh=li;this.In=Hd;this.tr=this.qr=cd;this.qc=!0;this.Jn=!1;this.Ed=new F;this.Rh=new Pb;this.rn=!0;this.Nm=250;this.tk=
-1;this.Om=(new Lc(16,16,16,16)).freeze();this.Jk=this.sd=!1;this.Ok=!0;this.Sh=new $e;this.Sh.diagram=this;this.We=new $e;this.We.diagram=this;this.ij=new $e;this.ij.diagram=this;this.le=this.wf=null;this.Fl=!1;this.Nt=this.Ot=null;this.Cq=w.PointerEvent&&(cb||fb||gb)&&w.navigator&&!1!==w.navigator.msPointerEnabled;mi(this);this.ti=new F;this.Br=!0;this.xs=ni;this.Ub=!1;this.zs=vg;this.Wa=null;oi.add("Model",pi);this.da=this.La=this.Tb=null;this.Qq="";this.kn="auto";this.Of=this.Pr=this.Qf=this.Rf=
this.Tf=this.yf=this.Cf=this.xf=null;this.lr=!1;this.zf=this.dg=this.Sf=this.Pf=null;this.fu=!1;this.iu={};this.ml=[null,null];this.K=null;this.Mt=this.qu=this.xm=this.Zg=!1;this.Xc=!0;this.ej=this.Yb=!1;this.Zb=null;var d=this;this.tg=function(a){var b=d.partManager;if(a.model===b.diagram.model&&b.diagram.ca){b.diagram.ca=!1;try{var c=a.change;""===a.modelChange&&c===df&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.ca=!0}}};this.wm=function(a){d.partManager.doModelChanged(a)};
this.Jw=!0;this.de=-2;this.uj=new Pb;this.hu=new E;this.If=!1;this.zh=this.yh=this.uq=this.Oc=!0;this.vq=!1;this.Bq=this.zq=this.Hh=this.Gh=this.Fh=this.Eh=this.Ch=this.Dh=this.Bh=this.yq=this.Jh=this.Ah=this.Ih=this.wq=!0;this.fe=this.Kc=!1;this.Aq=this.xq=this.nr=this.mr=!0;this.ls=this.hs=16;this.nu=this.gs=!1;this.$o=this.ks=null;this.ou=this.pu=0;this.gb=(new Lc(5)).freeze();this.os=(new F).freeze();this.Lr=999999999;this.pr=(new F).freeze();this.Xh=this.bj=this.Lg=!0;this.Uh=this.Kg=!1;this.ic=
null;this.wg=!0;this.ee=!1;this.sq=new F;this.uw=new F;this.Nb=null;this.Bo=1;this.Dw=0;this.ve={scale:1,position:new G,bounds:new N,mx:!1};this.Iw=(new N(NaN,NaN,NaN,NaN)).freeze();this.zp=(new L(NaN,NaN)).freeze();this.pn=(new N(NaN,NaN,NaN,NaN)).freeze();this.Cr=!1;this.$q=null;qi(this);this.Hr=this.jr=this.Sr=this.mw=this.lw=this.nw=this.Pg=this.Th=this.Uf=null;ri(this);this.Fb=null;this.ir=!1;this.Bk=null;this.partManager=new pi;this.toolManager=new Ua;this.toolManager.initializeStandardTools();
this.currentTool=this.defaultTool=this.toolManager;this.Zq=null;this.Dk=new Jf;this.Vr=this.Ur=null;this.pp=!1;this.commandHandler=si();this.model=ti();this.Zg=!0;this.layout=new ui;this.Zg=!1;this.pw=this.Qt=null;this.$b=1;this.te=null;this.$t=9999;this.Re=1;this.bl=0;this.Er=new G;this.vu=500;this.Fq=new G;this.Mg=!1;this.preventDefault=this.kt=this.em=this.fm=this.dm=this.cm=this.ck=this.ek=this.dk=this.ak=this.bk=this.Tv=this.Lv=this.Mv=this.Nv=this.li=this.Vo=this.ki=this.Uo=null;this.u=!1;this.Vh=
new vi;void 0!==a&&wi(this,a);this.qb=!1}P.prototype.clear=function(){this.model.clear();xi=null;yi="";zi(this,!1);this.pn=(new N(NaN,NaN,NaN,NaN)).freeze();this.R()};
function zi(a,b){var c=null;null!==a.Fb&&(c=a.Fb.part);a.animationManager.Vd();for(var d=[],e=a.Ra.length,f=0;f<e;f++){var g=a.Ra.j[f];if(b)for(var h=g.parts;h.next();){var k=h.value;k!==c&&null===k.data&&d.push(k)}g.clear()}a.partManager.clear();a.Ed.clear();a.Rh.clear();a.ti.clear();a.os.ha();a.os.clear();a.os.freeze();a.pr.ha();a.pr.clear();a.pr.freeze();a.Bk=null;La=[];null!==c&&(a.add(c),a.partManager.parts.remove(c));if(b)for(b=0;b<d.length;b++)a.add(d[b])}function si(){return null}
P.prototype.reset=function(){this.qb=!0;this.clear();this.Ra=new E;this.xv();this.wv();this.sa=(new G(NaN,NaN)).freeze();this.Ca=1;this.rr=(new G(NaN,NaN)).freeze();this.sr=NaN;this.Mr=1E-4;this.Kr=100;this.Cs=(new G(NaN,NaN)).freeze();this.gr=(new N(NaN,NaN,NaN,NaN)).freeze();this.mi=(new Lc(0,0,0,0)).freeze();this.js=ki;this.ms=!1;this.fs=this.$r=null;this.Si=li;this.Ui=Hd;this.Wh=li;this.In=Hd;this.tr=this.qr=cd;this.Nm=250;this.Om=(new Lc(16,16,16,16)).freeze();this.Br=!0;this.xs=ni;this.zs=vg;
this.kn="auto";this.Of=this.Pr=this.Qf=this.Rf=this.Tf=this.yf=this.Cf=this.xf=null;this.lr=!1;this.zf=this.dg=this.Sf=this.Pf=null;this.If=!1;this.zh=this.yh=this.uq=this.Oc=!0;this.vq=!1;this.Aq=this.xq=this.nr=this.mr=this.Bq=this.zq=this.Hh=this.Gh=this.Fh=this.Eh=this.Ch=this.Dh=this.Bh=this.yq=this.Jh=this.Ah=this.Ih=this.wq=!0;this.ls=this.hs=16;this.gb=(new Lc(5)).freeze();this.Lr=999999999;this.ic=null;this.Cr=!1;ri(this);this.Fb=null;this.partManager=new pi;this.toolManager=new Ua;this.toolManager.initializeStandardTools();
this.Vr=this.Ur=this.Zq=null;this.pp=!1;this.Dk.reset();this.bs=new Pb;this.$u();this.currentTool=this.defaultTool=this.toolManager;this.commandHandler=si();this.Zg=!0;qi(this);this.layout=new ui;this.Zg=!1;this.model=ti();this.ee=!1;this.Ok=!0;this.qb=this.sd=!1;this.R();this.le=this.wf=null;mi(this);this.Qq=""};
function ri(a){a.Uf=new Pb;var b=new U,c=new th;c.bind(new Ai("text","",Qa));b.add(c);a.nw=b;a.Uf.add("",b);b=new U;c=new th;c.stroke="brown";c.bind(new Ai("text","",Qa));b.add(c);a.Uf.add("Comment",b);b=new U;b.selectable=!1;b.avoidable=!1;c=new V;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new L(3,3)).ga();b.add(c);a.Uf.add("LinkLabel",b);a.Th=new Pb;b=new kg;b.selectionObjectName="GROUPPANEL";b.type=W.Vertical;c=new th;c.font="bold 12pt sans-serif";c.bind(new Ai("text","",Qa));
b.add(c);c=new W(W.Auto);c.name="GROUPPANEL";var d=new V;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new Zg;d.padding=(new Lc(5,5,5,5)).ga();c.add(d);b.add(c);a.lw=b;a.Th.add("",b);a.Pg=new Pb;b=new S;c=new V;c.isPanelMain=!0;b.add(c);c=new V;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.mw=b;a.Pg.add("",b);b=new S;c=new V;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.Pg.add("Comment",b);b=new sf;b.type=W.Auto;c=new V;c.fill=null;c.stroke=
"dodgerblue";c.strokeWidth=3;b.add(c);c=new Zg;c.margin=(new Lc(1.5,1.5,1.5,1.5)).ga();b.add(c);a.Sr=b;a.jr=b;b=new sf;b.type=W.Link;c=new V;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.Hr=b}
P.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=w.document.body);var b=va("div");b.dir="rtl";b.style.cssText="font-size: 14px; width: 1px; height: 1px; position: absolute; top: -1000px; overflow: scroll;";b.textContent="A";a.appendChild(b);var c="reverse";0<b.scrollLeft?c="default":(b.scrollLeft=1,0===b.scrollLeft&&(c="negative"));a.removeChild(b);this.lu=c};
P.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=w.document.body);var b=0;if(oh){var c=Bi;b=Ci;null===c&&(c=Bi=va("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=Ci=va("div"),b.style.position="absolute",b.style.visibility="hidden",b.style.width="200px",b.style.height="150px",b.style.boxSizing="content-box",b.appendChild(c));b.style.overflow="hidden";a.appendChild(b);var d=c.offsetWidth;b.style.overflow="scroll";c=c.offsetWidth;d===c&&(c=
b.clientWidth);a.removeChild(b);b=d-c;0!==b||lb||(b=11)}this.Hb=b};P.prototype.hb=function(a){a.classType===P&&(this.autoScale=a)};P.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.div&&this.div.id&&(b=this.div.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.Ra.iterator;c.next();)b+="\n "+c.value.toString(a-1);return b};
function Di(a){var b=a.Ea.Ka;a.Cq?(b.addEventListener("pointerdown",a.cm,!1),b.addEventListener("pointermove",a.dm,!1),b.addEventListener("pointerup",a.fm,!1),b.addEventListener("pointerout",a.em,!1)):(b.addEventListener("touchstart",a.Nv,!1),b.addEventListener("touchmove",a.Mv,!1),b.addEventListener("touchend",a.Lv,!1),b.addEventListener("mousemove",a.bk,!1),b.addEventListener("mousedown",a.ak,!1),b.addEventListener("mouseup",a.dk,!1),b.addEventListener("mouseout",a.ck,!1));b.addEventListener("mouseenter",
a.yy,!1);b.addEventListener("mouseleave",a.zy,!1);b.addEventListener("wheel",a.ek,!1);b.addEventListener("keydown",a.mz,!1);b.addEventListener("keyup",a.nz,!1);b.addEventListener("blur",a.ky,!1);b.addEventListener("focus",a.ly,!1);b.addEventListener("selectstart",function(a){a.preventDefault();return!1},!1);b.addEventListener("contextmenu",function(a){a.preventDefault();return!1},!1);b.addEventListener("gesturestart",function(b){a.toolManager.gestureBehavior!==vf&&(a.toolManager.gestureBehavior===
uf?b.preventDefault():(b.preventDefault(),a.Bo=a.scale,a.currentTool.doCancel()))},!1);b.addEventListener("gesturechange",function(b){if(a.toolManager.gestureBehavior!==vf)if(a.toolManager.gestureBehavior===uf)b.preventDefault();else{b.preventDefault();var c=b.scale;if(null!==a.Bo){var e=a.Ea.getBoundingClientRect();b=new G(b.pageX-window.scrollX-a.xa/e.width*e.left,b.pageY-window.scrollY-a.wa/e.height*e.top);c=a.Bo*c;e=a.commandHandler;if(c!==a.scale&&e.canResetZoom(c)){var f=a.zoomPoint;a.zoomPoint=
b;e.resetZoom(c);a.zoomPoint=f}}}},!1);w.addEventListener("resize",a.Tv,!1)}function Wf(a,b){null!==a.te&&(a.te=null,b&&a.kt())}P.prototype.computePixelRatio=function(){return null!==this.te?this.te:w.devicePixelRatio||1};P.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};P.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};P.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};P.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};
P.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};P.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};P.prototype.doFocus=function(){this.focus()};P.prototype.focus=function(){if(this.Ea)if(this.scrollsPageOnFocus)this.Ea.focus();else{var a=w.scrollX||w.pageXOffset,b=w.scrollY||w.pageYOffset;this.Ea.focus();w.scrollTo(a,b)}};P.prototype.ly=function(){this.F.aa("GainedFocus")};P.prototype.ky=function(){this.F.aa("LostFocus")};
function Ph(a){if(null!==a.Ea){var b=a.Ha;if(0!==b.clientWidth&&0!==b.clientHeight){a.setScrollWidth();var c=a.Uh?a.Hb:0,d=a.Kg?a.Hb:0,e=a.$b;a.$b=a.computePixelRatio();a.$b!==e&&(a.Jn=!0,a.ec());if(b.clientWidth!==a.xa+c||b.clientHeight!==a.wa+d)a.bj=!0,a.qc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===li&&(a.Jk=!0,b.B()),a.Yb||a.ec()}}}
function qi(a){var b=new bi;b.name="Background";a.Jl(b);b=new bi;b.name="";a.Jl(b);b=new bi;b.name="Foreground";a.Jl(b);b=new bi;b.name="Adornment";b.isTemporary=!0;a.Jl(b);b=new bi;b.name="Tool";b.isTemporary=!0;b.isBoundsIncluded=!0;a.Jl(b);b=new bi;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;a.Mw(b,a.Tl("Background"))}
function Ei(a){a.Fb=new W(W.Grid);a.Fb.name="GRID";var b=new V;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Fb.add(b);b=new V;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Fb.add(b);b=new V;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Fb.add(b);b=new V;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Fb.add(b);b=new V;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Fb.add(b);b=new V;b.figure="LineV";
b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Fb.add(b);b=new T;b.add(a.Fb);b.layerName="Grid";b.zOrder=0;b.isInDocumentBounds=!1;b.isAnimated=!1;b.pickable=!1;b.locationObjectName="GRID";a.add(b);a.partManager.parts.remove(b);a.Fb.visible=!1}function Ii(){this.F.nu?this.F.nu=!1:this.F.isEnabled?this.F.Yw(this):Ji(this.F)}function Ki(a){this.F.isEnabled?(this.F.pu=a.target.scrollTop,this.F.ou=a.target.scrollLeft):Ji(this.F)}
P.prototype.Yw=function(a){if(null!==this.Ea){this.gs=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.mi,e=b.x-d.left,f=b.y-d.top,g=b.width+d.left+d.right,h=b.height+d.top+d.bottom,k=b.right+d.right;d=b.bottom+d.bottom;var l=c.x;b=c.y;var m=c.width,n=c.height,p=c.right,q=c.bottom;c=this.scale;var r=a.scrollLeft;if(this.Nn)switch(this.lu){case "negative":r=r+a.scrollWidth-a.clientWidth;break;case "reverse":r=a.scrollWidth-r-a.clientWidth}var u=r;m<g||n<h?(r=G.allocAt(this.position.x,this.position.y),
this.allowHorizontalScroll&&this.ou!==u&&(r.x=u/c+e,this.ou=u),this.allowVerticalScroll&&this.pu!==a.scrollTop&&(r.y=a.scrollTop/c+f,this.pu=a.scrollTop),this.position=r,G.free(r),this.bj=this.gs=!1):(r=G.alloc(),a.Tx&&this.allowHorizontalScroll&&(e<l&&(this.position=r.h(u+e,this.position.y)),k>p&&(this.position=r.h(-(this.ks.scrollWidth-this.xa)+u-this.xa/c+k,this.position.y))),a.Ux&&this.allowVerticalScroll&&(f<b&&(this.position=r.h(this.position.x,a.scrollTop+f)),d>q&&(this.position=r.h(this.position.x,
-(this.ks.scrollHeight-this.wa)+a.scrollTop-this.wa/c+d))),G.free(r),Li(this),this.bj=this.gs=!1,b=this.documentBounds,c=this.viewportBounds,k=b.right,p=c.right,d=b.bottom,q=c.bottom,e=b.x,l=c.x,f=b.y,b=c.y,m>=g&&e>=l&&k<=p&&(this.$o.style.width="1px"),n>=h&&f>=b&&d<=q&&(this.$o.style.height="1px"))}};P.prototype.computeBounds=function(){0<this.Ed.count&&Mi(this);return Ni(this)};
function Ni(a){if(a.fixedBounds.s()){var b=a.fixedBounds.copy();b.Gp(a.gb);return b}for(var c=!0,d=a.Ra.j,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&(!g.isTemporary||g.isBoundsIncluded)){g=g.Fa.j;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.s()&&(c?(c=!1,b=l.copy()):b.Wc(l)))}}}c&&(b=new N(0,0,0,0));b.Gp(a.gb);return b}
P.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Da(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof S||(e.ac(),null===c?c=e.actualBounds.copy():c.Wc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof S||(d.ac(),null===c?c=d.actualBounds.copy():c.Wc(d.actualBounds));return null===c?new N(NaN,NaN,0,0):c};
function Oi(a,b){if((b||a.ee)&&!a.qb&&null!==a.Ea&&!a.animationManager.isAnimating&&a.documentBounds.s()){a.qb=!0;var c=a.Si;b&&a.Wh!==li&&(c=a.Wh);var d=c!==li?Pi(a,c):a.scale;c=a.viewportBounds.copy();var e=a.xa/d,f=a.wa/d,g=null,h=a.animationManager;h.$a&&(g=a.sa.copy());var k=a.Ui,l=a.In;b&&!k.ib()&&(l.ib()||l.Lb())&&(k=l.Lb()?gd:l);Qi(a,a.documentBounds,e,f,k,b);null!==g&&$h(h,g,a.sa);b=a.scale;a.scale=d;a.qb=!1;d=a.viewportBounds;d.Oa(c)||a.cq(c,d,b,!1)}}
function Pi(a,b){var c=a.Wq;if(null===a.Ea)return c;a.Lg&&Ri(a,a.computeBounds());var d=a.documentBounds;if(!d.s())return c;var e=d.width;d=d.height;var f=a.xa,g=a.wa,h=f/e,k=g/d;return b===Si?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===Ti?(b=k>h?(g-a.Hb)/d:(f-a.Hb)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale}
P.prototype.zoomToFit=function(){this.scale=Pi(this,Si);this.scrollMode!==ki&&Qi(this,this.documentBounds,this.xa/this.Ca,this.wa/this.Ca,this.Ui,!0)};t=P.prototype;
t.Oz=function(a,b){void 0===b&&(b=Si);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===Si||b===Ti)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.xa;var f=this.wa;e=b===Ti?f/d>e/c?(f-(this.Kg?this.Hb:0))/d:(e-(this.Uh?this.Hb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new G(a.x,a.y)}};
t.gy=function(a,b){this.Lg&&Ri(this,this.computeBounds());var c=this.documentBounds,d=this.viewportBounds;this.position=new G(c.x+(a.x*c.width+a.offsetX)-(b.x*d.width-b.offsetX),c.y+(a.y*c.height+a.offsetY)-(b.y*d.height-b.offsetY))};
function Qi(a,b,c,d,e,f){a.sa.ha();var g=a.sa,h=g.x,k=g.y;if(f||a.scrollMode===ki)e.ib()&&(c>b.width&&(h=b.x+(e.x*b.width+e.offsetX)-(e.x*c-e.offsetX)),d>b.height&&(k=b.y+(e.y*b.height+e.offsetY)-(e.y*d-e.offsetY))),e=a.mi,f=c-b.width,c<b.width+e.left+e.right?(h=Math.min(h+c/2,b.right+Math.max(f,e.right)-c/2),h=Math.max(h,b.left-Math.max(f,e.left)+c/2),h-=c/2):h>b.left?h=b.left:h<b.right-c&&(h=b.right-c),c=d-b.height,d<b.height+e.top+e.bottom?(k=Math.min(k+d/2,b.bottom+Math.max(c,e.bottom)-d/2),k=
Math.max(k,b.top-Math.max(c,e.top)+d/2),k-=d/2):k>b.top?k=b.top:k<b.bottom-d&&(k=b.bottom-d);g.x=isFinite(h)?h:-a.gb.left;g.y=isFinite(k)?k:-a.gb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.sa.freeze()}t.Ul=function(a,b){if(b){if(a=ig(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof T)return a}else if(a=ig(this,a,function(a){return a.part}),a instanceof T)return a;return null};
t.Rb=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);Mi(this);for(var d=this.Ra.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.Rb(a,b,c),null!==e))return e}return null};function ig(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);Mi(a);for(a=a.Ra.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.Rb(b,c,d),null!==e))return e}return null}
t.Sj=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new F);Mi(this);for(var e=this.Ra.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.Sj(a,b,c,d)}return d};t.gx=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return Ui(this,a,function(a){return a instanceof T&&(!c||a.canSelect())},b,d)};
t.jg=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);Mi(this);for(var f=this.Ra.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.jg(a,b,c,d,e)}return e};function Ui(a,b,c,d,e){var f=null;void 0===f&&(f=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof E||e instanceof F||(e=new F);Mi(a);for(a=a.Ra.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.jg(b,f,c,d,e)}return e}
t.Iy=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return Vi(this,a,b,function(a){return a instanceof T&&(!d||a.canSelect())},c,e)};t.kg=function(a,b,c,d,e,f){void 0===c&&(c=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);Mi(this);for(var g=this.Ra.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.kg(a,b,c,d,e,f)}return f};
function Vi(a,b,c,d,e,f){var g=null;void 0===g&&(g=null);void 0===d&&(d=null);void 0===e&&(e=!0);if(!1!==e&&!0!==e){if(e instanceof E||e instanceof F)f=e;e=!0}f instanceof E||f instanceof F||(f=new F);Mi(a);for(a=a.Ra.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.kg(b,c,g,d,e,f)}return f}P.prototype.acceptEvent=function(a){return Wi(this,a,a instanceof MouseEvent)};
function Wi(a,b,c){var d=a.We;a.We=a.ij;a.ij=d;d.diagram=a;d.event=b;c?Xi(a,b,d):(d.viewPoint=a.We.viewPoint,d.documentPoint=a.We.documentPoint);a=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);d.modifiers=a;d.button=b.button;void 0===b.buttons||bb||(d.buttons=b.buttons);ib&&0===b.button&&b.ctrlKey&&(d.button=2);d.down=!1;d.up=!1;d.clickCount=1;d.delta=0;d.handled=!1;d.bubbles=!1;d.timestamp=b.timeStamp;d.isMultiTouch=!1;d.targetDiagram=Yi(b);d.targetObject=null;return d}
function Yi(a){var b=a.target.F;if(!b){var c=a.path;c||"function"!==typeof a.composedPath||(c=a.composedPath());c&&c[0]&&(b=c[0].F)}return b?b:null}function Zi(a,b,c,d){var e=$i(a,b,!0,!1,!0,d);Xi(a,c,e);e.targetDiagram=Yi(b);e.targetObject=null;d||e.clone(a.Sh);return e}
function aj(a,b,c,d){var e;d=$i(a,b,!1,!1,!1,d);null!==c?((e=w.document.elementFromPoint(c.clientX,c.clientY))&&e.F?(b=c,c=e.F):(b=void 0!==b.targetTouches?b.targetTouches[0]:b,c=a),d.targetDiagram=c,Xi(a,b,d)):null!==a.We?(d.documentPoint=a.We.documentPoint,d.viewPoint=a.We.viewPoint,d.targetDiagram=a.We.targetDiagram):null!==a.Sh&&(d.documentPoint=a.Sh.documentPoint,d.viewPoint=a.Sh.viewPoint,d.targetDiagram=a.Sh.targetDiagram);d.targetObject=null;return d}
function $i(a,b,c,d,e,f){var g=a.We;a.We=a.ij;a.ij=g;g.diagram=a;g.clickCount=1;var h=g.delta=0;b.ctrlKey&&(h+=1);b.altKey&&(h+=2);b.shiftKey&&(h+=4);b.metaKey&&(h+=8);g.modifiers=h;g.button=0;g.buttons=1;g.event=b;g.timestamp=b.timeStamp;a.Cq&&b instanceof w.PointerEvent&&"touch"!==b.pointerType&&(g.button=b.button,void 0===b.buttons||bb||(g.buttons=b.buttons),ib&&0===b.button&&b.ctrlKey&&(g.button=2));g.down=c;g.up=d;g.handled=!1;g.bubbles=e;g.isMultiTouch=f;return g}
function bj(a,b){if(a.bubbles)return!0;void 0!==b.stopPropagation&&b.stopPropagation();b.preventDefault();b.cancelBubble=!0;return!1}
P.prototype.mz=function(a){var b=this.F;if(!this.F.isEnabled)return!1;var c=Wi(b,a,!1);c.key=String.fromCharCode(a.which);c.down=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del";break;case 48:c.key="0";break;case 187:case 61:case 107:c.key=
"Add";break;case 189:case 173:case 109:c.key="Subtract";break;case 27:c.key="Esc"}b.doKeyDown();return bj(c,a)};
P.prototype.nz=function(a){var b=this.F;if(!b.isEnabled)return!1;var c=Wi(b,a,!1);c.key=String.fromCharCode(a.which);c.up=!0;switch(a.which){case 8:c.key="Backspace";break;case 33:c.key="PageUp";break;case 34:c.key="PageDown";break;case 35:c.key="End";break;case 36:c.key="Home";break;case 37:c.key="Left";break;case 38:c.key="Up";break;case 39:c.key="Right";break;case 40:c.key="Down";break;case 45:c.key="Insert";break;case 46:c.key="Del"}b.doKeyUp();return bj(c,a)};
P.prototype.yy=function(a){var b=this.F;if(!b.isEnabled)return!1;var c=Wi(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return bj(c,a)};P.prototype.zy=function(a){var b=this.F;if(!b.isEnabled)return!1;var c=Wi(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return bj(c,a)};
P.prototype.getMouse=function(a){var b=this.Ea;if(null===b)return new G(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.xa/c.width*c.left;a=a.clientY-this.wa/c.height*c.top;return null!==this.ub?Yb(new G(b,a),this.ub):new G(b,a)};
function Xi(a,b,c){var d=a.Ea,e=a.xa,f=a.wa,g=0,h=0;null!==d&&(d=d.getBoundingClientRect(),g=b.clientX-e/d.width*d.left,h=b.clientY-f/d.height*d.top);c.viewPoint.h(g,h);null!==a.ub?(b=G.allocAt(g,h),a.ub.Td(b),c.documentPoint.assign(b),G.free(b)):c.documentPoint.h(g,h)}
function af(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.ml[0])b=a.ml[c];else return;c=a.Ea;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.xa/c.width*c.left,b.clientY-a.wa/c.height*c.top))}t=P.prototype;t.Xa=function(){this.Lg||(this.Lg=!0,this.ec(!0))};function Zh(a){a.Yb||Mi(a);a.Lg&&Ri(a,a.computeBounds())}t.vh=function(){this.qb||this.Yb||(this.R(),cj(this),Li(this),this.Xa(),this.hd())};t.lz=function(){return this.sd};
t.ty=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.Vd();b.isEnabled=!1;rg(this);this.ee=!1;b.isEnabled=c;null!==a&&ua(a,1)};t.ec=function(a){void 0===a&&(a=!1);if(!0!==this.sd&&!(this.qb||!1===a&&this.Yb)){this.sd=!0;var b=this;w.requestAnimationFrame(function(){b.sd&&b.hd()})}};t.hd=function(){if(!this.Ok||this.sd)this.Ok&&(this.Ok=!1),rg(this)};function dj(a,b){a.animationManager.isAnimating||a.qb||!a.bj||Ji(a)||(b&&Mi(a),Oi(a,!1))}
function rg(a,b){if(!a.Yb&&(a.sd=!1,null!==a.Ha||a.zp.s())){a.Yb=!0;var c=a.animationManager,d=a.hu;if(!c.isTicking&&0!==d.length){for(var e=d.j,f=e.length,g=0;g<f;g++){var h=e[g];ej(h,!1);h.o()}d.clear()}d=a.uw;0<d.count&&(d.each(function(a){a.Sv()}),d.clear());e=d=!1;c.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.$a||Ph(a);dj(a,!1);null!==a.Fb&&(a.Fb.visible&&!a.ir&&(fj(a),a.ir=!0),!a.Fb.visible&&a.ir&&(a.ir=!1));Mi(a);f=!1;if(!a.ee||a.wg)a.ee?gj(a,!a.Jk):(a.Aa("Initial Layout"),
!1===c.isEnabled&&c.Vd(),gj(a,!1)),f=!0;a.Jk=!1;Mi(a);a.qu||c.isAnimating||Zh(a);dj(a,!0);f&&(a.ee||hj(a),a.aa("LayoutCompleted"));Mi(a);f&&!a.ee&&(a.ee=!0,a.ab("Initial Layout"),a.skipsUndoManager||a.undoManager.clear(),ua(function(){a.isModified=!1},1));a.Eu();Oh(c);b||a.kc(a.$c);e&&(a.skipsUndoManager=d);a.Yb=!1}}
function hj(a){var b=a.Ra.j;a.kd(b,b.length,a);a.Wh!==li?a.scale=Pi(a,a.Wh):a.Si!==li?a.scale=Pi(a,a.Si):(b=a.initialScale,isFinite(b)&&0<b&&(a.scale=b));b=a.initialPosition;if(b.s())a.position=b;else{b=G.alloc();b.Li(a.documentBounds,a.initialDocumentSpot);var c=a.viewportBounds;c=N.allocAt(0,0,c.width,c.height);var d=G.alloc();d.Li(c,a.initialViewportSpot);d.h(b.x-d.x,b.y-d.y);a.position=d;N.free(c);G.free(d);G.free(b);cj(a);dj(a,!0);Oi(a,!0)}a.aa("InitialLayoutCompleted");fj(a)}
function Mi(a){if((a.Yb||!a.animationManager.isAnimating)&&0!==a.Ed.count){for(var b=0;23>b;b++){var c=a.Ed.iterator;if(null===c||0===a.Ed.count)break;a.Ed=new F;a.Sv(c,a.Ed)}a.nodes.each(function(a){a instanceof kg&&0!==(a.Z&65536)!==!1&&(a.Z=a.Z^65536)})}}
t.Sv=function(a,b){for(a.reset();a.next();){var c=a.value;!c.cc()||c instanceof kg||(c.Hi()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof kg&&c.isVisible()&&ij(this,c);for(a.reset();a.next();)c=a.value,c instanceof S&&c.isVisible()&&(c.Hi()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof sf&&c.isVisible()&&(c.Hi()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))};
function ij(a,b){for(var c=Ka(),d=Ka(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof kg?(jj(f)||kj(f)||lj(f))&&ij(a,f):f instanceof S?f.fromNode===b||f.toNode===b?d.push(f):c.push(f):(f.measure(Infinity,Infinity),f.arrange()))}a=c.length;for(e=0;e<a;e++)f=c[e],f.measure(Infinity,Infinity),f.arrange();Oa(c);b.measure(Infinity,Infinity);b.arrange();a=d.length;for(b=0;b<a;b++)c=d[b],c.measure(Infinity,Infinity),c.arrange();Oa(d)}
t.kd=function(a,b,c,d){if(this.Xh||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].kd(c,d)};
t.kc=function(a,b){void 0===b&&(b=null);if(null!==this.Ha){null===this.Ea&&A("No canvas specified");var c=this.animationManager;if(!c.$a){var d=new Date;mj(this);if("0"!==this.Ha.style.opacity){var e=a!==this.$c,f=this.Ra.j,g=f.length,h=this;this.kd(f,g,h);if(e)a.Sc(!0),Li(this);else if(!this.qc&&null===b&&!c.isAnimating)return;g=this.sa;var k=this.Ca,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.ub;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m);k=this.$b;a.setTransform(1,0,
0,1,0,0);a.scale(k,k);a.clearRect(0,0,this.xa,this.wa);a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);l=null!==b?function(c){var d=b;if(c.visible&&0!==c.mb){var e=c.Fa.j,f=e.length;if(0!==f){1!==c.mb&&(a.globalAlpha=c.mb);c=c.Do;c.length=0;for(var g=h.scale,k=0;k<f;k++){var l=e[k];if(qg(l)&&!d.contains(l)){if(l instanceof S&&(l.isOrthogonal&&c.push(l),!1===l.Lc))continue;var m=l.actualBounds;1<m.width*g||1<m.height*g?l.kc(a,h):ei(a,l)}}a.globalAlpha=1}}}:function(b){b.kc(a,
h)};nj(this,a);g=f.length;for(m=0;m<g;m++)a.setTransform(1,0,0,1,0,0),a.scale(k,k),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);this.Vh&&oj(this.Vh,this)&&this.$q();e?(this.$c.Sc(!0),Li(this)):this.qc=this.Xh=!1;d=+new Date-+d;null===this.te&&(this.$t=d)}}}};
function pj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ha){null===a.Ea&&A("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);mj(a);a.$c.Sc(!0);Li(a);a.ej=!0;var m=a.Ca;a.Ca=e;var n=a.Ra.j,p=n.length;try{var q=new N(f.x,f.y,d.width/e,d.height/e),r=q.copy();r.Gp(c);fj(a,r);Mi(a);a.kd(n,p,a,q);var u=a.$b;b.setTransform(1,0,0,1,0,0);b.scale(u,u);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var v=Tc.alloc();
v.reset();v.translate(c.left,c.top);v.scale(e);0===f.x&&0===f.y||v.translate(-f.x,-f.y);b.setTransform(v.m11,v.m12,v.m21,v.m22,v.dx,v.dy);Tc.free(v);nj(a,b);if(null!==g){var x=new F,y=g.iterator;for(y.reset();y.next();){var z=y.value;!1===l&&"Grid"===z.layer.name||null===z||x.add(z)}var B=function(c){var d=k;if(c.visible&&0!==c.mb&&(void 0===d&&(d=!0),d||!c.isTemporary)){d=c.Fa.j;var e=d.length;if(0!==e){1!==c.mb&&(b.globalAlpha=c.mb);c=c.Do;c.length=0;for(var f=a.scale,g=0;g<e;g++){var h=d[g];if(qg(h)&&
x.contains(h)){if(h instanceof S&&(h.isOrthogonal&&c.push(h),!1===h.Lc))continue;var l=h.actualBounds;1<l.width*f||1<l.height*f?h.kc(b,a):ei(b,h)}}b.globalAlpha=1}}}}else if(!k&&l){var C=a.grid.part,I=C.layer;B=function(c){c===I?C.kc(b,a):c.kc(b,a,k)}}else B=function(c){c.kc(b,a,k)};for(c=0;c<p;c++)B(n[c]);a.ej=!1;a.Vh&&oj(a.Vh,a)&&a.$q()}finally{a.Ca=m,a.$c.Sc(!0),Li(a),a.kd(n,p,a),fj(a)}}}t.Ce=function(a){return this.Wg[a]};t.Ex=function(a,b){this.Wg[a]=b;this.vh()};
t.xv=function(){this.Wg=new yb;this.Wg.drawShadows=!0;this.Wg.textGreeking=!0;this.Wg.viewportOptimizations=lb||cb||fb?!1:!0;this.Wg.temporaryPixelRatio=!0;this.Wg.pictureRatioOptimization=!0};function nj(a,b){a=a.Wg;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.rt(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.Wl=function(a){return this.Vk[a]};t.Ez=function(a,b){this.Vk[a]=b};
t.wv=function(){this.Vk=new yb;this.Vk.extraTouchArea=10;this.Vk.extraTouchThreshold=10;this.Vk.hasGestureZoom=!0};t.Gv=function(a){qj(this,a)};
function qj(a,b){var c=a instanceof W,d=a instanceof P,e;for(e in b){""===e&&A("Setting properties requires non-empty property names");var f=a,g=e;if(c||d){var h=e.indexOf(".");if(0<h){var k=e.substring(0,h);if(c)f=a.bb(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];Aa(f)?g=e.substr(h+1):A("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!Sa(f,g))if(d&&"ModelChanged"===g){a.Ow(b[g]);continue}else if(d&&"Changed"===g){a.jh(b[g]);continue}else if(d&&
Sa(a.toolManager,g))f=a.toolManager;else if(d&&rj(a,g)){a.Ej(g,b[g]);continue}else if(a instanceof Z&&"Changed"===g){a.jh(b[g]);continue}else A('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof Y&&f.Lw(g)}}t.Eu=function(){if(0===this.undoManager.transactionLevel&&0!==this.Rh.count){for(;0<this.Rh.count;){var a=this.Rh;this.Rh=new Pb;for(a=a.iterator;a.next();){var b=a.key;b.Vp(a.value);b.bc()}}this.R()}};
t.R=function(a){void 0===a&&(a=null);if(null===a)this.qc=!0,this.ec();else{var b=this.viewportBounds;null!==a&&a.s()&&b.Jc(a)&&(this.qc=!0,this.ec())}this.aa("InvalidateDraw")};
t.kx=function(a,b){if(!0!==this.qc){this.qc=!0;var c=!0===this.Ce("temporaryPixelRatio");if(!0===this.Ce("viewportOptimizations")&&this.scrollMode!==sj&&this.mi.yi(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=N.alloc(),f=Math.max(a.x,b.x),g=Math.max(a.y,b.y),h=Math.min(a.x+a.width,b.x+b.width),k=Math.min(a.y+a.height,b.y+b.height);e.x=f;e.y=g;e.width=Math.max(0,h-f)*d;e.height=Math.max(0,k-g)*d;if(0<e.width&&0<e.height){if(!this.Yb&&(this.sd=!1,null!==this.Ha&&(this.Yb=!0,
this.Eu(),this.documentBounds.s()||Ri(this,this.computeBounds()),d=this.Ea,null!==d))){k=this.$b;f=this.xa*k;h=this.wa*k;var l=this.scale*k;g=Math.round(Math.round(b.x*l)-Math.round(a.x*l));b=Math.round(Math.round(b.y*l)-Math.round(a.y*l));l=this.Qt;a=this.pw;l.width!==f&&(l.width=f);l.height!==h&&(l.height=h);a.clearRect(0,0,f,h);l=190*k;var m=70*k,n=Math.max(g,0),p=Math.max(b,0),q=Math.floor(f-n),r=Math.floor(h-p);a.rt(!1);a.drawImage(d.Ka,n,p,q,r,0,0,q,r);oj(this.Vh,this)&&a.clearRect(0,0,l,m);
d=Ka();a=Ka();r=Math.abs(g);q=Math.abs(b);var u=0===n?0:f-r;n=G.allocAt(u,0);r=G.allocAt(r+u,h);a.push(new N(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y)));var v=this.ub;v.reset();v.scale(k,k);1!==this.Ca&&v.scale(this.Ca);k=this.sa;(0!==k.x||0!==k.y)&&isFinite(k.x)&&isFinite(k.y)&&v.translate(-k.x,-k.y);Yb(n,v);Yb(r,v);d.push(new N(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y)));u=0===p?0:h-q;n.h(0,u);r.h(f,q+u);a.push(new N(Math.min(n.x,r.x),
Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y)));Yb(n,v);Yb(r,v);d.push(new N(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y)));oj(this.Vh,this)&&(f=0<g?0:-g,h=0<b?0:-b,n.h(f,h),r.h(l+f,m+h),a.push(new N(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y))),Yb(n,v),Yb(r,v),d.push(new N(Math.min(n.x,r.x),Math.min(n.y,r.y),Math.abs(n.x-r.x),Math.abs(n.y-r.y))));G.free(n);G.free(r);dj(this,!1);null===this.Ha&&A("No div specified");null===this.Ea&&A("No canvas specified");
if(!this.animationManager.$a&&(f=this.$c,this.qc)){mj(this);h=this.$b;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.xa*h,this.wa*h);f.rt(!1);f.drawImage(this.Qt.Ka,0<g?0:Math.round(-g),0<b?0:Math.round(-b));g=this.sa;k=this.Ca;l=Math.round(g.x*k)/k;m=Math.round(g.y*k)/k;b=this.ub;b.reset();1!==k&&b.scale(k);0===g.x&&0===g.y||b.translate(-l,-m);f.save();f.beginPath();g=a.length;for(k=0;k<g;k++)l=a[k],0!==l.width&&0!==l.height&&f.rect(Math.floor(l.x),Math.floor(l.y),Math.ceil(l.width),Math.ceil(l.height));
f.clip();f.setTransform(1,0,0,1,0,0);f.scale(h,h);f.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);b=this.Ra.j;g=b.length;this.kd(b,g,this);nj(this,f);for(h=0;h<g;h++)if(p=b[h],k=d,p.visible&&0!==p.mb){1!==p.mb&&(f.globalAlpha=p.mb);l=p.Do;l.length=0;m=this.scale;p=p.Fa.j;n=p.length;q=k.length;for(r=0;r<n;r++)if(v=p[r],qg(v)){if(v instanceof S&&(v.isOrthogonal&&l.push(v),!1===v.Lc))continue;u=tj(v,v.actualBounds);a:{var x=2/m;for(var y=4/m,z=0;z<q;z++){var B=k[z];if(0!==B.width&&0!==B.height&&u.bv(B.x-
x,B.y-x,B.width+y,B.height+y)){x=!0;break a}}x=!1}x&&(1<u.width*m||1<u.height*m?v.kc(f,this):ei(f,v))}f.globalAlpha=1}f.restore();f.Sc(!0);this.Vh&&oj(this.Vh,this)&&this.$q();this.qc=this.Xh=!1;this.kt()}Oa(d);Oa(a);this.Yb=!1}}else this.hd();N.free(e);c&&(this.te=1,this.hd(),Wf(this,!0))}else c?(this.te=1,this.hd(),Wf(this,!0)):this.hd()}};function cj(a){!1===a.bj&&(a.bj=!0)}function Li(a){!1===a.Xh&&(a.Xh=!0)}function mj(a){!1!==a.Jn&&(a.Jn=!1,uj(a,a.xa,a.wa))}
function uj(a,b,c){var d=a.Ea,e=a.$b,f=b*e;e=c*e;if(d.width!==f||d.height!==e)d.width=f,d.height=e,d.style.width=b+"px",d.style.height=c+"px",a.qc=!0,a.$c.Sc(!0)}
function Ji(a){var b=a.Ea;if(null===b)return!0;var c=a.Ha,d=a.xa,e=a.wa,f=a.Iw.copy();if(!f.s())return!0;var g=!1,h=a.Uh?a.Hb:0,k=a.Kg?a.Hb:0,l=c.clientWidth||d+h;c=c.clientHeight||e+k;if(l!==d+h||c!==e+k)a.Uh=!1,a.Kg=!1,k=h=0,a.xa=l,a.wa=c,g=a.Jn=!0;a.bj=!1;var m=a.documentBounds,n=0,p=0,q=0,r=0;l=f.width;c=f.height;var u=a.mi;a.contentAlignment.ib()?(m.width>l&&(n=u.left,p=u.right),m.height>c&&(q=u.top,r=u.bottom)):(n=u.left,p=u.right,q=u.top,r=u.bottom);u=m.width+n+p;var v=m.height+q+r;n=m.x-n;
var x=f.x;p=m.right+p;var y=f.right+h;q=m.y-q;var z=f.y;r=m.bottom+r;var B=f.bottom+k,C="1px",I="1px";m=a.scale;var J=!(u<l+h),K=!(v<c+k);a.scrollMode===ki&&(J||K)&&(J&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(C=1,n+1<x&&(C=Math.max((x-n)*m+a.xa,C)),p>y+1&&(C=Math.max((p-y)*m+a.xa,C)),l+h+1<u&&(C=Math.max((u-l+h)*m+a.xa,C)),C=C.toString()+"px"),K&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(I=1,q+1<z&&(I=Math.max((z-q)*m+a.wa,I)),r>B+1&&(I=Math.max((r-B)*m+a.wa,I)),c+k+1<v&&(I=Math.max((v-
c+k)*m+a.wa,I)),I=I.toString()+"px"));K="1px"!==C;J="1px"!==I;K&&J||!K&&!J||(J&&(y-=a.Hb),K&&(B-=a.Hb),u<l+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,n+1<x&&(h=Math.max((x-n)*m+a.xa,h)),p>y+1&&(h=Math.max((p-y)*m+a.xa,h)),l+1<u&&(h=Math.max((u-l)*m+a.xa,h)),C=h.toString()+"px"),K="1px"!==C,h=a.wa,K!==a.Kg&&(h=K?a.wa-a.Hb:a.wa+a.Hb),v<c+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(k=1,q+1<z&&(k=Math.max((z-q)*m+h,k)),r>B+1&&(k=Math.max((r-B)*m+h,k)),c+1<v&&(k=Math.max((v-
c)*m+h,k)),I=k.toString()+"px"),J="1px"!==I);if(a.gs&&K===a.Kg&&J===a.Uh)return d===a.xa&&e===a.wa||a.hd(),!1;K!==a.Kg&&("1px"===C?a.wa=a.wa+a.Hb:a.wa=Math.max(a.wa-a.Hb,1),g=!0);a.Kg=K;a.$o.style.width=C;J!==a.Uh&&("1px"===I?a.xa=a.xa+a.Hb:a.xa=Math.max(a.xa-a.Hb,1),g=!0,a.Nn&&(k=G.alloc(),J?(b.style.left=a.Hb+"px",a.position=k.h(a.sa.x+a.Hb/a.scale,a.sa.y)):(b.style.left="0px",a.position=k.h(a.sa.x-a.Hb/a.scale,a.sa.y)),G.free(k)));a.Uh=J;a.$o.style.height=I;a.nu=!0;g&&(a.Jn=!0);b=a.ks;k=b.scrollLeft;
a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l+1<u?k=(a.position.x-n)*m:n+1<x?k=b.scrollWidth-b.clientWidth:p>y+1&&(k=a.position.x*m));if(a.Nn)switch(a.lu){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(c+1<v?b.scrollTop=(a.position.y-q)*m:q+1<z?b.scrollTop=b.scrollHeight-b.clientHeight:r>B+1&&(b.scrollTop=a.position.y*m));l=a.xa;c=a.wa;b.style.width=l+(a.Uh?a.Hb:0)+"px";
b.style.height=c+(a.Kg?a.Hb:0)+"px";return d!==l||e!==c||a.animationManager.$a?(a.cq(f,a.viewportBounds,m,g),!1):!0}
t.add=function(a){var b=a.diagram;if(b!==this&&(null!==b&&A("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.Tl(a.layerName),null===b&&(b=this.Tl("")),null===b&&A('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.Gi(99999999,a,a.diagram===this);0<=c&&this.cb(hf,"parts",b,null,a,null,c);b.isTemporary||this.Xa();a.B(1);c=a.layerChanged;null!==c&&c(a,null,b)}};
t.Gi=function(a){this.partManager.Gi(a);var b=this;vj(a,function(a){wj(b,a)});(a instanceof sf||a instanceof kg&&null!==a.placeholder)&&a.o();null!==a.data&&vj(a,function(a){xj(b.partManager,a)});!0!==kj(a)&&!0!==lj(a)||this.Ed.add(a);yj(a,!0,this);zj(a)?(a.actualBounds.s()&&this.R(tj(a,a.actualBounds)),this.Xa()):a.isVisible()&&a.actualBounds.s()&&this.R(tj(a,a.actualBounds));this.ec()};
t.zc=function(a){a.Jj();this.partManager.zc(a);var b=this;vj(a,function(a){Aj(b,a)});null!==a.data&&vj(a,function(a){Bj(b.partManager,a)});this.Ed.remove(a);zj(a)?(a.actualBounds.s()&&this.R(tj(a,a.actualBounds)),this.Xa()):a.isVisible()&&a.actualBounds.s()&&this.R(tj(a,a.actualBounds));this.ec()};t.remove=function(a){Cj(this,a,!0)};
function Cj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.B(2),c&&b.Pj(),c=d.zc(-1,b,!1),0<=c&&a.cb(jf,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.nt=function(a,b){if(Da(a))for(var c=a.length,d=0;d<c;d++){var e=a[d];b&&!e.canDelete()||this.remove(e)}else for(c=new F,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.Oj=function(a,b,c){return this.partManager.Oj(a,b,c)};
P.prototype.moveParts=function(a,b,c,d){void 0===d&&(d=Dj(this));if(null!==this.toolManager){var e=new Pb;if(null!==a)if(Da(a))for(var f=0;f<a.length;f++)Ej(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Ej(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Ej(this,e,a.value,c,d);for(a=this.nodes;a.next();)Ej(this,e,a.value,c,d);for(a=this.links;a.next();)Ej(this,e,a.value,c,d)}eg(this,e,b,d,c)}};
function Ej(a,b,c,d,e){void 0===e&&(e=Dj(a));if(!b.contains(c)&&(!d||c.canMove()||c.canCopy()))if(c instanceof U){b.add(c,a.rd(e,c,c.location));if(c instanceof kg)for(var f=c.memberParts;f.next();)Ej(a,b,f.value,d,e);for(f=c.linksConnected;f.next();){var g=f.value;if(!b.contains(g)){var h=g.fromNode,k=g.toNode;null!==h&&b.contains(h)&&null!==k&&b.contains(k)&&Ej(a,b,g,d,e)}}if(e.dragsTree)for(c=c.Su();c.next();)Ej(a,b,c.value,d,e)}else if(c instanceof S)for(b.add(c,a.rd(e,c)),c=c.labelNodes;c.next();)Ej(a,
b,c.value,d,e);else c instanceof sf||b.add(c,a.rd(e,c,c.location))}
function eg(a,b,c,d,e){if(null!==b&&0!==b.count){var f=G.alloc(),g=G.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.pp)||Nf(a,b);for(var h=Ka(),k=Ka(),l=b.iterator,m=G.alloc();l.next();){var n=l.key,p=l.value;if(n.cc()){var q=Fj(a,n,b);if(null!==q)h.push(new Gj(n,p,q));else if(!e||n.canMove())q=p.point,f.assign(q),a.computeMove(n,f.add(g),d,m),n.location=m,void 0===p.shifted&&(p.shifted=new G),p.shifted.assign(m.Wd(q))}else l.key instanceof S&&k.push(l.na)}G.free(m);e=h.length;for(l=
0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.Xu.shifted&&(n.Xu.shifted=new G),n.node.location=f.add(n.Xu.shifted);e=G.alloc();l=G.alloc();n=k.length;for(p=0;p<n;p++){var r=k[p];q=r.key;if(q instanceof S)if(q.suspendsRouting){m=q.fromNode;var u=q.toNode;if(null!==a.draggedLink&&d.dragsLink)if(u=r.value.point,null===q.dragComputation)b.add(q,a.rd(d,q,g)),bg(q,g.x-u.x,g.y-u.y);else{r=G.allocAt(0,0);(m=q.i(0))&&m.s()&&r.assign(m);var v=m=G.alloc().assign(r).add(g);d.isGridSnapEnabled&&(d.isGridSnapRealtime||
a.lastInput.up)&&(v=G.alloc(),hh(a,q,m,v,d));m.assign(q.dragComputation(q,m,v)).Wd(r);b.add(q,a.rd(d,q,m));bg(q,m.x-u.x,m.y-u.y);G.free(r);G.free(m);v!==m&&G.free(v)}else null!==m&&(e.assign(m.location),v=b.J(m),null!==v&&e.Wd(v.point)),null!==u&&(l.assign(u.location),v=b.J(u),null!==v&&l.Wd(v.point)),null!==m&&null!==u?e.Oa(l)?(m=r.value.point,u=f,u.assign(e),u.Wd(m),b.add(q,a.rd(d,q,e)),bg(q,u.x,u.y)):(q.suspendsRouting=!1,q.Pa()):(r=r.value.point,m=null!==m?e:null!==u?l:g,b.add(q,a.rd(d,q,m)),
bg(q,m.x-r.x,m.y-r.y))}else if(null===q.fromNode||null===q.toNode)m=r.value.point,b.add(q,a.rd(d,q,g)),bg(q,g.x-m.x,g.y-m.y)}G.free(f);G.free(g);G.free(e);G.free(l);Oa(h);Oa(k);c||(Mi(a),Sf(a,b))}}
P.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new G);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=G.alloc(),hh(this,a,b,e,c));c=null!==a.dragComputation?a.dragComputation(a,b,e):e;var g=a.minLocation,h=g.x;isNaN(h)&&(h=f?Math.round(a.location.x):a.location.x);g=g.y;isNaN(g)&&(g=f?Math.round(a.location.y):a.location.y);var k=a.maxLocation,l=k.x;isNaN(l)&&(l=f?Math.round(a.location.x):a.location.x);k=k.y;isNaN(k)&&(k=f?Math.round(a.location.y):
a.location.y);d.h(Math.max(h,Math.min(c.x,l)),Math.max(g,Math.min(c.y,k)));e!==b&&G.free(e);return d};function Dj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.Dk}
function hh(a,b,c,d,e){void 0===e&&(e=Dj(a));d.assign(c);if(null!==b){var f=a.grid;b=e.gridSnapCellSize;a=b.width;b=b.height;var g=e.gridSnapOrigin,h=g.x;g=g.y;e=e.gridSnapCellSpot;if(null!==f){var k=f.gridCellSize;isNaN(a)&&(a=k.width);isNaN(b)&&(b=k.height);f=f.gridOrigin;isNaN(h)&&(h=f.x);isNaN(g)&&(g=f.y)}f=G.allocAt(0,0);f.ik(0,0,a,b,e);H.Op(c.x,c.y,h+f.x,g+f.y,a,b,d);G.free(f)}}function Nf(a,b){if(null!==b)for(a.pp=!0,a=b.iterator;a.next();)b=a.key,b instanceof S&&(b.suspendsRouting=!0)}
function Sf(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof S&&(c.suspendsRouting=!1,Hj(c)&&c.Pa())}a.pp=!1}}function Fj(a,b,c){b=b.containingGroup;if(null!==b){a=Fj(a,b,c);if(null!==a)return a;a=c.J(b);if(null!==a)return a}return null}t=P.prototype;t.rd=function(a,b,c){if(void 0===c)return new Qf(cc);var d=a.isGridSnapEnabled;a.cz||null===b.containingGroup||(d=!1);return d?new Qf(new G(Math.round(c.x),Math.round(c.y))):new Qf(c.copy())};
function Ij(a,b,c){null!==b.diagram&&b.diagram!==a&&A("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&A("Cannot add an existing Layer to this Diagram again: "+b):(c.diagram!==a&&A("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&A("Cannot move a Layer before or after itself: "+b));if(b.diagram!==a){b=b.name;a=a.Ra;c=a.count;for(var d=0;d<c;d++)a.N(d).name===b&&A("Cannot add Layer with the name '"+b+"'; a Layer with the same name is already present in this Diagram.")}}
t.Jl=function(a){Ij(this,a,null);a.ob(this);var b=this.Ra,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.N(c).isTemporary;)c--;b.Jb(c+1,a);null!==this.Zb&&this.cb(hf,"layers",this,null,a,null,c+1);this.R();this.Xa()};t.Mw=function(a,b){Ij(this,a,b);a.ob(this);var c=this.Ra,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.Zb&&this.cb(jf,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.N(f)===b){c.Jb(f,a);break}null!==this.Zb&&this.cb(hf,"layers",this,null,a,null,f);this.R();0>d&&this.Xa()};
t.$x=function(a,b){Ij(this,a,b);a.ob(this);var c=this.Ra,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.Zb&&this.cb(jf,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.N(f)===b){c.Jb(f+1,a);break}null!==this.Zb&&this.cb(hf,"layers",this,null,a,null,f+1);this.R();0>d&&this.Xa()};
t.yz=function(a){a.diagram!==this&&A("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Ra,c=b.indexOf(a);if(b.remove(a)){for(b=a.Fa.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.Zb&&this.cb(jf,"layers",this,a,null,c,null);this.R();this.Xa()}}};t.Tl=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.Ow=function(a){null===this.le&&(this.le=new E);this.le.add(a);this.model.jh(a)};t.Az=function(a){null!==this.le&&(this.le.remove(a),0===this.le.count&&(this.le=null));this.model.hk(a)};t.jh=function(a){null===this.wf&&(this.wf=new E);this.wf.add(a)};t.hk=function(a){null!==this.wf&&(this.wf.remove(a),0===this.wf.count&&(this.wf=null))};t.Es=function(a){this.skipsUndoManager||this.undoManager.Yu(a);a.change!==ef&&(this.isModified=!0);if(null!==this.wf)for(var b=this.wf,c=b.length,d=0;d<c;d++)b.N(d)(a)};
t.cb=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new cf;h.diagram=this;h.change=a;h.propertyName=b;h.object=c;h.oldValue=d;h.oldParam=f;h.newValue=e;h.newParam=g;this.Es(h)};t.g=function(a,b,c,d,e){this.cb(df,a,this,b,c,d,e)};
t.Ij=function(a,b){if(null!==a&&a.diagram===this){var c=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var d=a.change;if(d===df){var e=a.object;Jj(e,a.propertyName,a.J(b));if(e instanceof Y){var f=e.part;null!==f&&f.Kb()}this.isModified=!0}else if(d===hf){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof W)if("number"===typeof h&&k instanceof Y){b?g.zc(h):g.Jb(h,k);var l=g.part;null!==l&&l.Kb()}else{if("number"===typeof h&&k instanceof Kj)if(b)k.isRow?g.uv(h):g.sv(h);else{var m=
k.isRow?g.getRowDefinition(k.index):g.getColumnDefinition(k.index);m.Pl(k)}}else if(g instanceof bi){var n=!0===a.oldParam;"number"===typeof h&&k instanceof T&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Kb(),g.zc(n?h:-1,k,n)):g.Gi(h,k,n))}else g instanceof P?"number"===typeof h&&k instanceof bi&&(b?this.Ra.nb(h):(k.ob(this),this.Ra.Jb(h,k))):A("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===jf){var p=a.object,q=a.oldParam,r=a.oldValue;if(p instanceof W)"number"===
typeof q&&r instanceof Y?b?p.Jb(q,r):p.zc(q):"number"===typeof q&&r instanceof Kj&&(b?(m=r.isRow?p.getRowDefinition(r.index):p.getColumnDefinition(r.index),m.Pl(r)):r.isRow?p.uv(q):p.sv(q));else if(p instanceof bi){var u=!0===a.newParam;"number"===typeof q&&r instanceof T&&(b?0>p.Fa.indexOf(r)&&p.Gi(q,r,u):(r.isSelected=!1,r.isHighlighted=!1,r.Kb(),p.zc(u?q:-1,r,u)))}else p instanceof P?"number"===typeof q&&r instanceof bi&&(b?(r.ob(this),this.Ra.Jb(q,r)):this.Ra.nb(q)):A("unknown ChangedEvent.Remove object: "+
a.toString());this.isModified=!0}else d!==ef&&A("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};t.Aa=function(a){return this.undoManager.Aa(a)};t.ab=function(a){return this.undoManager.ab(a)};t.rf=function(){return this.undoManager.rf()};
P.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Aa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.ab(b):this.undoManager.rf(),this.skipsUndoManager=c}};P.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};t=P.prototype;t.pq=function(){this.partManager.pq()};
function Lj(a,b,c){var d=a.animationManager;if(a.qb||a.Yb)a.Ca=c,d.$a&&ai(d,b,a.Ca);else if(a.qb=!0,null===a.Ea)a.Ca=c;else{var e=a.viewportBounds.copy(),f=a.xa,g=a.wa;e.width=a.xa/b;e.height=a.wa/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.nf()?l.mf(rd)?h=0:l.mf(sd)&&(h=f-1):h=l.ib()?l.x*(f-1):f/2);isNaN(k)&&(l.nf()?l.mf(qd)?k=0:l.mf(td)&&(k=g-1):k=l.ib()?l.y*(g-1):g/2);null!==a.scaleComputation&&(c=a.scaleComputation(a,c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=
a.maxScale);f=G.allocAt(a.sa.x+h/b-h/c,a.sa.y+k/b-k/c);a.position=f;G.free(f);a.Ca=c;a.cq(e,a.viewportBounds,b,!1);a.qb=!1;Oi(a,!1);d.$a&&ai(d,b,a.Ca);a.R();cj(a)}}
t.cq=function(a,b,c,d){if(!a.A(b)){void 0===d&&(d=!1);d||cj(this);Li(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==li||d||a.width===b.width&&a.height===b.height||e.B();e=this.currentTool;!0===this.fe&&e instanceof Ua&&(this.lastInput.documentPoint=this.vt(this.lastInput.viewPoint),wf(e,this));this.qb||this.kx(a,b);fj(this);this.ve.scale=c;this.ve.position.x=a.x;this.ve.position.y=a.y;this.ve.bounds.assign(a);this.ve.mx=d;this.aa("ViewportBoundsChanged",this.ve,a);this.isVirtualized&&
this.links.each(function(a){a.isAvoiding&&a.actualBounds.Jc(b)&&a.Pa()})}};
function fj(a,b){void 0===b&&(b=null);var c=a.Fb;if(null!==c&&c.visible){for(var d=L.alloc(),e=1,f=1,g=c.W.j,h=g.length,k=0;k<h;k++){var l=g[k],m=l.interval;2>m||(Mj(l.figure)?f=f*m/H.hx(f,m):e=e*m/H.hx(e,m))}g=c.gridCellSize;d.h(f*g.width,e*g.height);if(null!==b)e=b.width,f=b.height,a=b.x,g=b.y;else{b=N.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.s()){N.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;N.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=G.alloc();H.Op(a,g,0,0,
d.width,d.height,b);b.offset(-d.width,-d.height);L.free(d);c.part.location=b;G.free(b)}}t.Fs=function(){var a=0<this.selection.count;a&&this.aa("ChangingSelection",this.selection);Kf(this);a&&this.aa("ChangedSelection",this.selection)};function Kf(a){a=a.selection;if(0<a.count){for(var b=a.Ma(),c=b.length,d=0;d<c;d++)b[d].isSelected=!1;a.ha();a.clear();a.freeze()}}
t.select=function(a){null!==a&&a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.aa("ChangingSelection",this.selection),Kf(this),a.isSelected=!0,this.aa("ChangedSelection",this.selection))};
t.Av=function(a){this.aa("ChangingSelection",this.selection);Kf(this);if(Da(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof T||A("Diagram.selectCollection given something that is not a Part: "+d);d.isSelected=!0}else for(a=a.iterator;a.next();)b=a.value,b instanceof T||A("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.aa("ChangedSelection",this.selection)};
t.Rw=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.Ma(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ha();a.clear();a.freeze()}};t.ez=function(a){null!==a&&a.layer.diagram===this&&(!a.isHighlighted||1<this.highlighteds.count)&&(this.Rw(),a.isHighlighted=!0)};
t.fz=function(a){a=(new F).addAll(a);for(var b=this.highlighteds.copy().gq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof T||A("Diagram.highlightCollection given something that is not a Part: "+b),b.isHighlighted=!0};
t.scroll=function(a,b,c){void 0===c&&(c=1);var d="up"===b||"down"===b,e=0;if("pixel"===a)e=c;else if("line"===a)e=c*(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange);else if("page"===a)a=d?this.viewportBounds.height:this.viewportBounds.width,a*=this.scale,0!==a&&(e=c*Math.max(a-(d?this.scrollVerticalLineChange:this.scrollHorizontalLineChange),0));else{if("document"===a){e=this.documentBounds;c=this.viewportBounds;d=G.alloc();"up"===b?this.position=d.h(c.x,e.y):"left"===b?this.position=
d.h(e.x,c.y):"down"===b?this.position=d.h(c.x,e.bottom-c.height):"right"===b&&(this.position=d.h(e.right-c.width,c.y));G.free(d);return}A("scrolling unit must be 'pixel', 'line', 'page', or 'document', not: "+a)}e/=this.scale;c=this.position.copy();"up"===b?c.y=this.position.y-e:"down"===b?c.y=this.position.y+e:"left"===b?c.x=this.position.x-e:"right"===b?c.x=this.position.x+e:A("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c};
t.zv=function(a){var b=this.viewportBounds;b.kf(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.Du=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.ut=function(a){var b=this.ub;b.reset();1!==this.Ca&&b.scale(this.Ca);var c=this.sa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.ub)};
t.Lz=function(a){var b=this.ub,c=a.x,d=a.y,e=c+a.width,f=d+a.height,g=b.m11,h=b.m12,k=b.m21,l=b.m22,m=b.dx,n=b.dy,p=c*g+d*k+m;b=c*h+d*l+n;var q=e*g+d*k+m;a=e*h+d*l+n;d=c*g+f*k+m;c=c*h+f*l+n;g=e*g+f*k+m;e=e*h+f*l+n;f=Math.min(p,q);p=Math.max(p,q);q=Math.min(b,a);b=Math.max(b,a);f=Math.min(f,d);p=Math.max(p,d);q=Math.min(q,c);b=Math.max(b,c);f=Math.min(f,g);p=Math.max(p,g);q=Math.min(q,e);b=Math.max(b,e);return new N(f,q,p-f,b-q)};
t.vt=function(a){var b=this.ub;b.reset();1!==this.Ca&&b.scale(this.Ca);var c=this.sa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Yb(a.copy(),this.ub)};function Nj(a){var b=a.isModified;a.Jw!==b&&(a.Jw=b,a.aa("Modified"))}function Oj(a){a=oi.get(a);return null!==a?new a:new pi}
P.prototype.doModelChanged=function(a){if(a.model===this.model){var b=a.change,c=a.propertyName;if(b===ef&&"S"===c[0])if("StartingFirstTransaction"===c){var d=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.ob(d)});a.mouseMoveTools.each(function(a){a.ob(d)});a.mouseUpTools.each(function(a){a.ob(d)});this.Yb||this.ee||(this.Jk=!0,this.Ok&&(this.sd=!0))}else"StartingUndo"===c||"StartingRedo"===c?(a=this.animationManager,a.isAnimating&&!this.skipsUndoManager&&a.Vd(),this.aa("ChangingSelection",
this.selection)):"StartedTransaction"===c&&(a=this.animationManager,a.isAnimating&&!this.skipsUndoManager&&a.Vd());else if(this.ca){this.ca=!1;try{if(""===a.modelChange&&b===ef){if("FinishedUndo"===c||"FinishedRedo"===c)this.aa("ChangedSelection",this.selection),Mi(this);var e=this.animationManager;"RolledBackTransaction"===c&&e.Vd();this.Jk=!0;this.hd();0===this.undoManager.transactionLevel&&Oh(e);"CommittedTransaction"===c&&this.undoManager.Zt&&(this.de=Math.min(this.de,this.undoManager.historyIndex-
1));var f=a.isTransactionFinished;f&&(Nj(this),this.ct.clear());if(!this.fu&&f){this.fu=!0;var g=this;ua(function(){g.currentTool.standardMouseOver();g.fu=!1},10)}}}finally{this.ca=!0}}}};function wj(a,b){b=b.W.j;for(var c=b.length,d=0;d<c;d++)Pj(a,b[d])}
function Pj(a,b){if(b instanceof Qj){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.Fg;null!==d&&(d.Qk instanceof Event&&null!==b.Ec&&b.Ec(b,d.Qk),!0===d.Ln&&(null!==b.cf&&b.cf(b,d.mu),null!==b.diagram&&b.diagram.hu.add(b)));c=c.src;d=a.uj.J(c);if(null===d)d=[],d.push(b),a.uj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}}function Aj(a,b){b=b.W.j;for(var c=b.length,d=0;d<c;d++)Rj(a,b[d])}
function Rj(a,b){if(b instanceof Qj){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c=c.src;var d=a.uj.J(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.uj.remove(c),Sj(c));break}}}}P.prototype.wd=function(){this.partManager.wd()};P.prototype.Ep=function(a,b){this.Dq.Ep(a,b)};P.prototype.Fp=function(a,b){this.Dq.Fp(a,b)};P.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};t=P.prototype;t.Ib=function(a){return this.partManager.Ib(a)};
t.xc=function(a){return this.partManager.xc(a)};t.zi=function(a){return this.partManager.zi(a)};t.wc=function(a){return this.partManager.wc(a)};t.Os=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Os.apply(this.partManager,b instanceof Array?b:ca(ba(b)))};t.Ns=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Ns.apply(this.partManager,b instanceof Array?b:ca(ba(b)))};
function Ri(a,b){a.Lg=!1;var c=a.pn;c.A(b)||(a.pn=b.freeze(),Oi(a,!1),a.aa("DocumentBoundsChanged",null,c.copy()),cj(a))}t.My=function(){for(var a=new F,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&a.add(c)}for(b=this.links;b.next();)c=b.value,c.isTopLevel&&a.add(c);return a.iterator};t.Ly=function(){return this.ti.iterator};t.pz=function(a){Mi(this);a&&Tj(this,!0);this.Jk=!0;rg(this)};
function Tj(a,b){for(var c=a.ti.iterator;c.next();)Uj(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.B())}function Uj(a,b,c){if(null!==b){for(var d=b.il.iterator;d.next();)Uj(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.B())}}
function gj(a,b){if(a.wg&&!a.Mt){var c=a.ca;a.ca=!0;var d=a.undoManager.transactionLevel,e=a.layout;try{0===d&&a.Aa("Layout");var f=a.animationManager;1>=d&&!f.isAnimating&&!f.$a&&(b||f.Ji("Layout"));a.wg=!1;for(var g=a.ti.iterator;g.next();)Vj(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),Mi(a),e.isValidLayout=!0):a.wg=!0)}finally{0===d&&a.ab("Layout"),a.wg=!e.isValidLayout,a.ca=c}}}
function Vj(a,b,c,d){if(null!==b){for(var e=b.il.iterator;e.next();)Vj(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.fk=!b.location.s(),e.doLayout(b),b.B(32),ij(a,b),e.isValidLayout=!0):a.wg=!0)}}t.Sy=function(){for(var a=new E,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.Ai()&&a.add(c)}return a.iterator};
function mi(a){function b(a){var b=a.toLowerCase(),e=new E;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new Pb,d=new Pb;b("AnimationStarting");b("AnimationFinished");b("BackgroundSingleClicked");b("BackgroundDoubleClicked");b("BackgroundContextClicked");b("ClipboardChanged");b("ClipboardPasted");b("DocumentBoundsChanged");b("ExternalObjectsDropped");b("GainedFocus");b("InitialLayoutCompleted");b("LayoutCompleted");b("LinkDrawn");b("LinkRelinked");b("LinkReshaped");b("LostFocus");b("Modified");
b("ObjectSingleClicked");b("ObjectDoubleClicked");b("ObjectContextClicked");b("PartCreated");b("PartResized");b("PartRotated");b("SelectionMoved");b("SelectionCopied");b("SelectionDeleting");b("SelectionDeleted");b("SelectionGrouped");b("SelectionUngrouped");b("ChangingSelection");b("ChangedSelection");b("SubGraphCollapsed");b("SubGraphExpanded");b("TextEdited");b("TreeCollapsed");b("TreeExpanded");b("ViewportBoundsChanged");b("InvalidateDraw");a.Ot=c;a.Nt=d}
function rj(a,b){var c=a.Nt.J(b);return null!==c?c:a.Nt.J(b.toLowerCase())}function Wj(a,b){var c=a.Ot.J(b);if(null!==c)return c;c=a.Ot.J(b.toLowerCase());if(null!==c)return c;A("Unknown DiagramEvent name: "+b);return null}t.Ej=function(a,b){a=Wj(this,a);null!==a&&a.add(b)};t.gm=function(a,b){a=Wj(this,a);null!==a&&a.remove(b)};
t.aa=function(a,b,c){var d=Wj(this,a),e=new bf;e.diagram=this;a=rj(this,a);null!==a&&(e.name=a);void 0!==b&&(e.subject=b);void 0!==c&&(e.parameter=c);b=d.length;if(1===b)d.N(0)(e);else if(0!==b)for(d=d.Ma(),c=0;c<b;c++)(0,d[c])(e)};function ak(a){if(a.animationManager.isAnimating)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.pp||b.isComplexRoutingRealtime:!0}t.Yj=function(a,b){void 0===b&&(b=null);return ek(this,!1,null,b).Yj(a.x,a.y,a.width,a.height)};
P.prototype.computeOccupiedArea=function(){return this.isVirtualized?this.viewportBounds.copy():this.Lg?Ni(this):this.documentBounds.copy()};
function ek(a,b,c,d){null===a.Nb&&(a.Nb=new fk);if(a.Nb.Xs||a.Nb.group!==c||a.Nb.Hx!==d){if(null===c){b=a.computeOccupiedArea();b.Vc(100,100);a.Nb.initialize(b);b=N.alloc();for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&gk(a,f,d,b)}N.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Vc(20,20),a.Nb.initialize(b));b=N.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof U&&gk(a,f,d,b);N.free(b)}a.Nb.group=c;a.Nb.Hx=d;a.Nb.Xs=
!1}else b&&hk(a.Nb);return a.Nb}function gk(a,b,c,d){if(b!==c)if(b.isVisible()&&b.avoidable&&!b.isLinkLabel){var e=b.getAvoidableRect(d),f=a.Nb.Ol;c=a.Nb.Nl;d=e.x+e.width;b=e.y+e.height;for(var g=e.x;g<d;g+=f){for(var h=e.y;h<b;h+=c)ik(a.Nb,g,h);ik(a.Nb,g,b)}for(e=e.y;e<b;e+=c)ik(a.Nb,d,e);ik(a.Nb,d,b)}else if(b instanceof kg)for(b=b.memberParts;b.next();)e=b.value,e instanceof U&&gk(a,e,c,d)}
function jk(a,b){null!==a.Nb&&!a.Nb.Xs&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Nb.Xs=!0)}t=P.prototype;t.Js=function(a){this.Fq.assign(a);kk(this,this.Fq).Oa(this.position)?this.sf():lk(this)};
function lk(a){-1===a.tk&&(a.tk=ua(function(){if(-1!==a.tk&&(a.sf(),null!==a.lastInput.event)){var b=kk(a,a.Fq);b.Oa(a.position)||(a.position=b,a.lastInput.documentPoint=a.vt(a.Fq),a.doMouseMove(),a.Lg=!0,Ri(a,a.documentBounds.copy().Wc(a.computeBounds())),a.qc=!0,a.hd(),lk(a))}},a.Nm))}t.sf=function(){-1!==this.tk&&(w.clearTimeout(this.tk),this.tk=-1)};
function kk(a,b){var c=a.position,d=a.Om;if(0>=d.top&&0>=d.left&&0>=d.right&&0>=d.bottom)return c;var e=a.viewportBounds,f=a.scale;e=N.allocAt(0,0,e.width*f,e.height*f);var g=G.allocAt(0,0);if(b.x>=e.x&&b.x<e.x+d.left){var h=Math.max(a.scrollHorizontalLineChange,1);h|=0;g.x-=h;b.x<e.x+d.left/2&&(g.x-=h);b.x<e.x+d.left/4&&(g.x-=4*h)}else b.x<=e.x+e.width&&b.x>e.x+e.width-d.right&&(h=Math.max(a.scrollHorizontalLineChange,1),h|=0,g.x+=h,b.x>e.x+e.width-d.right/2&&(g.x+=h),b.x>e.x+e.width-d.right/4&&
(g.x+=4*h));b.y>=e.y&&b.y<e.y+d.top?(a=Math.max(a.scrollVerticalLineChange,1),a|=0,g.y-=a,b.y<e.y+d.top/2&&(g.y-=a),b.y<e.y+d.top/4&&(g.y-=4*a)):b.y<=e.y+e.height&&b.y>e.y+e.height-d.bottom&&(a=Math.max(a.scrollVerticalLineChange,1),a|=0,g.y+=a,b.y>e.y+e.height-d.bottom/2&&(g.y+=a),b.y>e.y+e.height-d.bottom/4&&(g.y+=4*a));g.Oa(cc)||(c=new G(c.x+g.x/f,c.y+g.y/f));N.free(e);G.free(g);return c}t.et=function(){return null};t.gv=function(){return null};t.Pw=function(a,b){this.bs.add(a,b)};t.$u=function(){};
t.rz=function(a){if(!oh)return null;void 0===a&&(a=new yb);a.returnType="Image";return this.nx(a)};t.nx=function(a){function b(){var k=+new Date;d=!0;for(e.reset();e.next();)if(!e.value[0].el){d=!1;break}d||k-g>f?mk(h,a,c):w.requestAnimationFrame(b)}void 0===a&&(a=new yb);for(var c=a.callback,d=!0,e=this.uj.iterator;e.next();)if(!e.value[0].el){d=!1;break}if("function"!==typeof c||d)return mk(this,a,c);var f=a.callbackTimeout||300,g=+new Date,h=this;w.requestAnimationFrame(function(){b()});return null};
function mk(a,b,c){var d=nk(a,b);if(null===d)return null;a=d.V.canvas;var e=null;if(null!==a)switch(e=b.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case "imagedata":e=d.getImageData(0,0,a.width,a.height);break;case "image":d=(b.document||document).createElement("img");d.src=a.toDataURL(b.type,b.details);e=d;break;case "blob":"function"!==typeof c&&A('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');if("function"===typeof a.toBlob)return a.toBlob(c,
b.type,b.details),"toBlob";if("function"===typeof a.msToBlob)return c(a.msToBlob()),"msToBlob";c(null);return null;default:e=a.toDataURL(b.type,b.details)}return"function"===typeof c?(c(e),null):e}
function nk(a,b){a.animationManager.Vd();a.hd();if(null===a.Ea)return null;"object"!==typeof b&&A("properties argument must be an Object.");var c=b.size||null,d=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(d="NaN");var e=b.maxSize;void 0===b.maxSize&&(e="svg"===b.context?new L(Infinity,Infinity):new L(2E3,2E3));var f=b.position||null,g=b.parts||null,h=void 0===b.padding?1:b.padding,k=b.background||null,l=b.omitTemporary;void 0===l&&(l=!0);var m=b.document||document,n=b.elementFinished||null,p=
b.showTemporary;void 0===p&&(p=!l);l=b.showGrid;void 0===l&&(l=p);null!==c&&isNaN(c.width)&&isNaN(c.height)&&(c=null);"number"===typeof h?h=new Lc(h):h instanceof Lc||A("MakeImage padding must be a Margin or a number.");h.left=Math.max(h.left,0);h.right=Math.max(h.right,0);h.top=Math.max(h.top,0);h.bottom=Math.max(h.bottom,0);a.$c.Sc(!0);var q=new ok(null,m),r=q.context;if(!(c||d||g||f)){q.width=a.xa+Math.ceil(h.left+h.right);q.height=a.wa+Math.ceil(h.top+h.bottom);if("svg"===b.context){d=a.bs.J("SVG");
if(null===d)return null;d.Zu(q.width,q.height);d.ownerDocument=m;d.Ks=n;pj(a,d.context,h,new L(q.width,q.height),a.Ca,a.sa,g,k,p,l);return d.context}a.rn=!1;pj(a,r,h,new L(q.width,q.height),a.Ca,a.sa,g,k,p,l);a.rn=!0;return q.context}var u=a.Wq,v=a.documentBounds.copy();v.Iv(a.gb);if(p)for(var x=a.Ra.j,y=x.length,z=0;z<y;z++){var B=x[z];if(B.visible&&B.isTemporary){B=B.Fa.j;for(var C=B.length,I=0;I<C;I++){var J=B[I];J.isInDocumentBounds&&J.isVisible()&&(J=J.actualBounds,J.s()&&v.Wc(J))}}}x=new G(v.x,
v.y);if(null!==g){y=!0;z=g.iterator;for(z.reset();z.next();)if(B=z.value,B instanceof T&&(C=B.layer,(null===C||C.visible)&&(null===C||p||!C.isTemporary)&&B.isVisible()&&(B=B.actualBounds,B.s())))if(y){y=!1;var K=B.copy()}else K.Wc(B);y&&(K=new N(0,0,0,0));v.width=K.width;v.height=K.height;x.x=K.x;x.y=K.y}null!==f&&f.s()&&(x=f,d||(d=u));K=f=0;null!==h&&(f=h.left+h.right,K=h.top+h.bottom);y=z=0;null!==c&&(z=c.width,y=c.height,isFinite(z)&&(z=Math.max(0,z-f)),isFinite(y)&&(y=Math.max(0,y-K)));null!==
c&&null!==d?("NaN"===d&&(d=u),c.s()?(c=z,v=y):isNaN(y)?(c=z,v=v.height*d):(c=v.width*d,v=y)):null!==c?c.s()?(d=Math.min(z/v.width,y/v.height),c=z,v=y):isNaN(y)?(d=z/v.width,c=z,v=v.height*d):(d=y/v.height,c=v.width*d,v=y):null!==d?"NaN"===d&&e.s()?(d=Math.min((e.width-f)/v.width,(e.height-K)/v.height),d>u?(d=u,c=v.width,v=v.height):(c=e.width,v=e.height)):(c=v.width*d,v=v.height*d):(d=u,c=v.width,v=v.height);null!==h?(c+=f,v+=K):h=new Lc(0);null!==e&&(u=e.width,e=e.height,isNaN(u)&&(u=2E3),isNaN(e)&&
(e=2E3),isFinite(u)&&(c=Math.min(c,u)),isFinite(e)&&(v=Math.min(v,e)));q.width=Math.ceil(c);q.height=Math.ceil(v);if("svg"===b.context){b=a.bs.J("SVG");if(null===b)return null;b.Zu(q.width,q.height);b.ownerDocument=m;b.Ks=n;pj(a,b.context,h,new L(Math.ceil(c),Math.ceil(v)),d,x,g,k,p,l);return b.context}a.rn=!1;pj(a,r,h,new L(Math.ceil(c),Math.ceil(v)),d,x,g,k,p,l);a.rn=!0;return q.context}
pa.Object.defineProperties(P.prototype,{div:{get:function(){return this.Ha},set:function(a){if(this.Ha!==a){Xa=[];var b=this.Ha;null!==b?(b.F=void 0,b.innerHTML="",null!==this.Ea&&(b=this.Ea.Ka,b.removeEventListener("touchstart",this.Nv,!1),b.removeEventListener("touchmove",this.Mv,!1),b.removeEventListener("touchend",this.Lv,!1),this.Ea.Zw()),b=this.toolManager,null!==b&&(b.mouseDownTools.each(function(a){a.cancelWaitAfter()}),b.mouseMoveTools.each(function(a){a.cancelWaitAfter()}),
b.mouseUpTools.each(function(a){a.cancelWaitAfter()})),b.cancelWaitAfter(),this.currentTool.doCancel(),this.$c=this.Ea=null,w.removeEventListener("resize",this.Tv,!1),w.removeEventListener("mousemove",this.bk,!0),w.removeEventListener("mousedown",this.ak,!0),w.removeEventListener("mouseup",this.dk,!0),w.removeEventListener("wheel",this.ek,!0),w.removeEventListener("mouseout",this.ck,!0),of===this&&(of=null)):this.ee=!1;this.Ha=null;if(null!==a){if(b=a.F)b.div=null;wi(this,a);this.vh()}}}},dv:{
get:function(){return this.qb},set:function(a){this.qb=a}},Xj:{get:function(){return this.ee}},draggedLink:{get:function(){return this.Zq},set:function(a){this.Zq!==a&&(this.Zq=a,null!==a&&(this.Ur=a.fromPort,this.Vr=a.toPort))}},sx:{get:function(){return this.Ur},set:function(a){this.Ur=a}},tx:{get:function(){return this.Vr},set:function(a){this.Vr=a}},animationManager:{
get:function(){return this.Dq}},undoManager:{get:function(){return this.Zb.undoManager}},skipsUndoManager:{get:function(){return this.Zg},set:function(a){this.Zg=a;this.Zb.skipsUndoManager=a}},delaysLayout:{get:function(){return this.Mt},set:function(a){this.Mt=a}},validCycle:{get:function(){return this.zs},set:function(a){var b=this.zs;b!==a&&(this.zs=a,this.g("validCycle",
b,a))}},layers:{get:function(){return this.Ra.iterator}},isModelReadOnly:{get:function(){var a=this.Zb;return null===a?!1:a.isReadOnly},set:function(a){var b=this.Zb;null!==b&&(b.isReadOnly=a)}},isReadOnly:{get:function(){return this.If},set:function(a){var b=this.If;b!==a&&(this.If=a,this.g("isReadOnly",b,a))}},isEnabled:{get:function(){return this.Oc},set:function(a){var b=this.Oc;
b!==a&&(this.Oc=a,this.g("isEnabled",b,a))}},allowClipboard:{get:function(){return this.uq},set:function(a){var b=this.uq;b!==a&&(this.uq=a,this.g("allowClipboard",b,a))}},allowCopy:{get:function(){return this.yh},set:function(a){var b=this.yh;b!==a&&(this.yh=a,this.g("allowCopy",b,a))}},allowDelete:{get:function(){return this.zh},set:function(a){var b=this.zh;b!==a&&(this.zh=a,this.g("allowDelete",b,a))}},allowDragOut:{
get:function(){return this.vq},set:function(a){var b=this.vq;b!==a&&(this.vq=a,this.g("allowDragOut",b,a))}},allowDrop:{get:function(){return this.wq},set:function(a){var b=this.wq;b!==a&&(this.wq=a,this.g("allowDrop",b,a))}},allowTextEdit:{get:function(){return this.Ih},set:function(a){var b=this.Ih;b!==a&&(this.Ih=a,this.g("allowTextEdit",b,a))}},allowGroup:{get:function(){return this.Ah},set:function(a){var b=
this.Ah;b!==a&&(this.Ah=a,this.g("allowGroup",b,a))}},allowUngroup:{get:function(){return this.Jh},set:function(a){var b=this.Jh;b!==a&&(this.Jh=a,this.g("allowUngroup",b,a))}},allowInsert:{get:function(){return this.yq},set:function(a){var b=this.yq;b!==a&&(this.yq=a,this.g("allowInsert",b,a))}},allowLink:{get:function(){return this.Bh},set:function(a){var b=this.Bh;b!==a&&(this.Bh=a,this.g("allowLink",b,a))}},
allowRelink:{get:function(){return this.Dh},set:function(a){var b=this.Dh;b!==a&&(this.Dh=a,this.g("allowRelink",b,a))}},allowMove:{get:function(){return this.Ch},set:function(a){var b=this.Ch;b!==a&&(this.Ch=a,this.g("allowMove",b,a))}},allowReshape:{get:function(){return this.Eh},set:function(a){var b=this.Eh;b!==a&&(this.Eh=a,this.g("allowReshape",b,a))}},allowResize:{get:function(){return this.Fh},
set:function(a){var b=this.Fh;b!==a&&(this.Fh=a,this.g("allowResize",b,a))}},allowRotate:{get:function(){return this.Gh},set:function(a){var b=this.Gh;b!==a&&(this.Gh=a,this.g("allowRotate",b,a))}},allowSelect:{get:function(){return this.Hh},set:function(a){var b=this.Hh;b!==a&&(this.Hh=a,this.g("allowSelect",b,a))}},allowUndo:{get:function(){return this.zq},set:function(a){var b=this.zq;b!==a&&(this.zq=a,this.g("allowUndo",
b,a))}},allowZoom:{get:function(){return this.Bq},set:function(a){var b=this.Bq;b!==a&&(this.Bq=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{get:function(){return this.nr},set:function(a){var b=this.nr;b!==a&&(this.nr=a,cj(this),this.R(),this.g("hasVerticalScrollbar",b,a),Oi(this,!1))}},hasHorizontalScrollbar:{get:function(){return this.mr},set:function(a){var b=this.mr;b!==a&&(this.mr=a,cj(this),this.R(),
this.g("hasHorizontalScrollbar",b,a),Oi(this,!1))}},allowHorizontalScroll:{get:function(){return this.xq},set:function(a){var b=this.xq;b!==a&&(this.xq=a,this.g("allowHorizontalScroll",b,a),Oi(this,!1))}},allowVerticalScroll:{get:function(){return this.Aq},set:function(a){var b=this.Aq;b!==a&&(this.Aq=a,this.g("allowVerticalScroll",b,a),Oi(this,!1))}},scrollHorizontalLineChange:{get:function(){return this.hs},
set:function(a){var b=this.hs;b!==a&&(0>a&&xa(a,">= 0",P,"scrollHorizontalLineChange"),this.hs=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{get:function(){return this.ls},set:function(a){var b=this.ls;b!==a&&(0>a&&xa(a,">= 0",P,"scrollVerticalLineChange"),this.ls=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{get:function(){return this.ij},set:function(a){this.ij=a}},firstInput:{
get:function(){return this.Sh},set:function(a){this.Sh=a}},currentCursor:{get:function(){return this.Qq},set:function(a){""===a&&(a=this.kn);if(this.Qq!==a){var b=this.Ea,c=this.Ha;if(null!==b){this.Qq=a;var d=b.style.cursor;b.style.cursor=a;c.style.cursor=a;b.style.cursor===d&&(b.style.cursor="-webkit-"+a,c.style.cursor="-webkit-"+a,b.style.cursor===d&&(b.style.cursor="-moz-"+a,c.style.cursor="-moz-"+a,b.style.cursor===d&&(b.style.cursor=a,c.style.cursor=a)))}}}},defaultCursor:{
get:function(){return this.kn},set:function(a){""===a&&(a="auto");var b=this.kn;b!==a&&(this.kn=a,this.g("defaultCursor",b,a))}},click:{get:function(){return this.xf},set:function(a){var b=this.xf;b!==a&&(this.xf=a,this.g("click",b,a))}},doubleClick:{get:function(){return this.Cf},set:function(a){var b=this.Cf;b!==a&&(this.Cf=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return this.yf},
set:function(a){var b=this.yf;b!==a&&(this.yf=a,this.g("contextClick",b,a))}},mouseOver:{get:function(){return this.Tf},set:function(a){var b=this.Tf;b!==a&&(this.Tf=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return this.Rf},set:function(a){var b=this.Rf;b!==a&&(this.Rf=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return this.Qf},set:function(a){var b=this.Qf;b!==a&&(this.Qf=a,this.g("mouseHold",
b,a))}},mouseDragOver:{get:function(){return this.Pr},set:function(a){var b=this.Pr;b!==a&&(this.Pr=a,this.g("mouseDragOver",b,a))}},mouseDrop:{get:function(){return this.Of},set:function(a){var b=this.Of;b!==a&&(this.Of=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{get:function(){return this.lr},set:function(a){var b=this.lr;b!==a&&(this.lr=a,this.g("handlesDragDropForTopLevelParts",b,a))}},
mouseEnter:{get:function(){return this.Pf},set:function(a){var b=this.Pf;b!==a&&(this.Pf=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return this.Sf},set:function(a){var b=this.Sf;b!==a&&(this.Sf=a,this.g("mouseLeave",b,a))}},toolTip:{get:function(){return this.dg},set:function(a){var b=this.dg;b!==a&&(this.dg=a,this.g("toolTip",b,a))}},contextMenu:{get:function(){return this.zf},
set:function(a){var b=this.zf;b!==a&&(this.zf=a,this.g("contextMenu",b,a))}},commandHandler:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a,a.ob(this))}},toolManager:{get:function(){return this.Tb},set:function(a){this.Tb!==a&&(this.Tb=a,a.ob(this))}},defaultTool:{get:function(){return this.La},set:function(a){var b=this.La;b!==a&&(this.La=a,a.ob(this),this.currentTool===b&&(this.currentTool=
a))}},currentTool:{get:function(){return this.da},set:function(a){var b=this.da;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(this.da=a,a.ob(this),a.doStart())}},selection:{get:function(){return this.os}},maxSelectionCount:{get:function(){return this.Lr},set:function(a){var b=this.Lr;if(b!==a)if(0<=a&&!isNaN(a)){if(this.Lr=a,this.g("maxSelectionCount",
b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.aa("ChangingSelection",this.selection);b=this.selection.Ma();for(var c=0;c<a;c++)b[c].isSelected=!1;this.aa("ChangedSelection",this.selection)}}else xa(a,">= 0",P,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{get:function(){return this.Sr},set:function(a){var b=this.Sr;b!==a&&(this.Sr=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{
get:function(){return this.jr},set:function(a){var b=this.jr;b!==a&&(this.jr=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{get:function(){return this.Hr},set:function(a){var b=this.Hr;b!==a&&(this.Hr=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{get:function(){return this.pr}},isModified:{get:function(){var a=this.undoManager;return a.isEnabled?
null!==a.currentTransaction?!0:this.u&&this.de!==a.historyIndex:this.u},set:function(a){if(this.u!==a){this.u=a;var b=this.undoManager;!a&&b.isEnabled&&(this.de=b.historyIndex);a||Nj(this)}}},model:{get:function(){return this.Zb},set:function(a){var b=this.Zb;if(b!==a){this.currentTool.doCancel();null!==b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&A("Do not replace a Diagram.model while a transaction is in progress.");zi(this,!0);this.ee=!1;this.Ok=
!0;this.de=-2;this.sd=!1;var c=this.Yb;this.Yb=!0;this.animationManager.Ji("Model");null!==b&&(null!==this.le&&this.le.each(function(a){b.hk(a)}),b.hk(this.wm));this.Zb=a;this.partManager=Oj(this.Zb.constructor.type);a.jh(this.tg);this.partManager.addAllModeledParts();a.hk(this.tg);a.jh(this.wm);null!==this.le&&this.le.each(function(b){a.jh(b)});this.Yb=c;this.qb||this.R();null!==b&&(a.undoManager.isEnabled=b.undoManager.isEnabled)}}},ca:{get:function(){return this.Xc},
set:function(a){this.Xc=a}},ct:{get:function(){return this.sq}},skipsModelSourceBindings:{get:function(){return this.xm},set:function(a){this.xm=a}},jk:{get:function(){return this.qu},set:function(a){this.qu=a}},nodeTemplate:{get:function(){return this.Uf.J("")},set:function(a){var b=this.Uf.J("");b!==a&&(this.Uf.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||
this.wd())}},nodeTemplateMap:{get:function(){return this.Uf},set:function(a){var b=this.Uf;b!==a&&(this.Uf=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.wd())}},groupTemplate:{get:function(){return this.Th.J("")},set:function(a){var b=this.Th.J("");b!==a&&(this.Th.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.wd())}},groupTemplateMap:{get:function(){return this.Th},
set:function(a){var b=this.Th;b!==a&&(this.Th=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.wd())}},linkTemplate:{get:function(){return this.Pg.J("")},set:function(a){var b=this.Pg.J("");b!==a&&(this.Pg.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.wd())}},linkTemplateMap:{get:function(){return this.Pg},set:function(a){var b=this.Pg;b!==a&&(this.Pg=a,this.g("linkTemplateMap",b,a),
this.undoManager.isUndoingRedoing||this.wd())}},isMouseOverDiagram:{get:function(){return this.fe},set:function(a){this.fe=a}},isMouseCaptured:{get:function(){return this.Kc},set:function(a){var b=this.Ea;null!==b&&(b=b.Ka,a?(this.lastInput.bubbles=!1,this.Cq?(b.removeEventListener("pointermove",this.dm,!1),b.removeEventListener("pointerdown",this.cm,!1),b.removeEventListener("pointerup",this.fm,!1),b.removeEventListener("pointerout",this.em,
!1),w.addEventListener("pointermove",this.dm,!0),w.addEventListener("pointerdown",this.cm,!0),w.addEventListener("pointerup",this.fm,!0),w.addEventListener("pointerout",this.em,!0)):(b.removeEventListener("mousemove",this.bk,!1),b.removeEventListener("mousedown",this.ak,!1),b.removeEventListener("mouseup",this.dk,!1),b.removeEventListener("mouseout",this.ck,!1),w.addEventListener("mousemove",this.bk,!0),w.addEventListener("mousedown",this.ak,!0),w.addEventListener("mouseup",this.dk,!0),w.addEventListener("mouseout",
this.ck,!0)),b.removeEventListener("wheel",this.ek,!1),w.addEventListener("wheel",this.ek,!0),w.addEventListener("selectstart",this.preventDefault,!1)):(this.Cq?(w.removeEventListener("pointermove",this.dm,!0),w.removeEventListener("pointerdown",this.cm,!0),w.removeEventListener("pointerup",this.fm,!0),w.removeEventListener("pointerout",this.em,!0),b.addEventListener("pointermove",this.dm,!1),b.addEventListener("pointerdown",this.cm,!1),b.addEventListener("pointerup",this.fm,!1),b.addEventListener("pointerout",
this.em,!1)):(w.removeEventListener("mousemove",this.bk,!0),w.removeEventListener("mousedown",this.ak,!0),w.removeEventListener("mouseup",this.dk,!0),w.removeEventListener("mouseout",this.ck,!0),b.addEventListener("mousemove",this.bk,!1),b.addEventListener("mousedown",this.ak,!1),b.addEventListener("mouseup",this.dk,!1),b.addEventListener("mouseout",this.ck,!1)),w.removeEventListener("wheel",this.ek,!0),w.removeEventListener("selectstart",this.preventDefault,!1),b.addEventListener("wheel",this.ek,
!1)),this.Kc=a)}},position:{get:function(){return this.sa},set:function(a){var b=G.alloc().assign(this.sa);if(!b.A(a)){var c=this.viewportBounds.copy();this.sa.assign(a);this.qb||null===this.Ea&&!this.zp.s()||(this.qb=!0,a=this.scale,Qi(this,this.pn,this.xa/a,this.wa/a,this.Ui,!1),this.qb=!1);$h(this.animationManager,b,this.sa);this.qb||this.cq(c,this.viewportBounds,this.Ca,!1)}G.free(b)}},initialPosition:{get:function(){return this.rr},
set:function(a){this.rr.A(a)||(this.rr=a.I())}},initialScale:{get:function(){return this.sr},set:function(a){this.sr!==a&&(this.sr=a)}},grid:{get:function(){null===this.Fb&&Ei(this);return this.Fb},set:function(a){var b=this.Fb;if(b!==a){null===b&&(Ei(this),b=this.Fb);a.type!==W.Grid&&A("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.Fb=a;a.name="GRID";null!==c&&c.add(a);fj(this);this.R();this.g("grid",
b,a)}}},viewportBounds:{get:function(){var a=this.Iw,b=this.sa,c=this.Ca;if(null===this.Ea)return this.zp.s()&&a.h(b.x,b.y,this.xa/c,this.wa/c),a;a.h(b.x,b.y,Math.max(this.xa,0)/c,Math.max(this.wa,0)/c);return a}},viewSize:{get:function(){return this.zp},set:function(a){var b=this.viewSize;b.A(a)||(this.zp=a=a.I(),this.xa=a.width,this.wa=a.height,this.Xa(),this.g("viewSize",b,a))}},fixedBounds:{get:function(){return this.gr},
set:function(a){var b=this.gr;b.A(a)||(-Infinity!==a.width&&Infinity!==a.height&&-Infinity!==a.height||A("fixedBounds width/height must not be Infinity"),this.gr=a=a.I(),this.Xa(),this.g("fixedBounds",b,a))}},scrollMargin:{get:function(){return this.mi},set:function(a){"number"===typeof a&&(a=new Lc(a));var b=this.mi;b.A(a)||(this.mi=a=a.I(),this.g("scrollMargin",b,a),this.vh())}},scrollMode:{get:function(){return this.js},set:function(a){var b=
this.js;b!==a&&(this.js=a,a===ki&&Oi(this,!1),this.g("scrollMode",b,a),this.vh())}},scrollsPageOnFocus:{get:function(){return this.ms},set:function(a){var b=this.ms;b!==a&&(this.ms=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{get:function(){return this.$r},set:function(a){var b=this.$r;b!==a&&(this.$r=a,Oi(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{get:function(){return this.fs},
set:function(a){var b=this.fs;b!==a&&(this.fs=a,Lj(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{get:function(){return this.pn}},isVirtualized:{get:function(){return this.Cr},set:function(a){var b=this.Cr;b!==a&&(this.Cr=a,this.g("isVirtualized",b,a))}},scale:{get:function(){return this.Ca},set:function(a){var b=this.Ca;b!==a&&Lj(this,b,a)}},defaultScale:{
get:function(){return this.Wq},set:function(a){this.Wq=a}},autoScale:{get:function(){return this.Si},set:function(a){var b=this.Si;b!==a&&(this.Si=a,this.g("autoScale",b,a),a!==li&&Oi(this,!1))}},initialAutoScale:{get:function(){return this.Wh},set:function(a){var b=this.Wh;b!==a&&(this.Wh=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{get:function(){return this.tr},set:function(a){var b=this.tr;b!==
a&&(a.ib()||A("initialViewportSpot must be a specific Spot: "+a),this.tr=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{get:function(){return this.qr},set:function(a){var b=this.qr;b!==a&&(a.ib()||A("initialViewportSpot must be a specific Spot: "+a),this.qr=a,this.g("initialDocumentSpot",b,a))}},minScale:{get:function(){return this.Mr},set:function(a){var b=this.Mr;b!==a&&(0<a?(this.Mr=a,this.g("minScale",b,a),a>this.scale&&
(this.scale=a)):xa(a,"> 0",P,"minScale"))}},maxScale:{get:function(){return this.Kr},set:function(a){var b=this.Kr;b!==a&&(0<a?(this.Kr=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):xa(a,"> 0",P,"maxScale"))}},zoomPoint:{get:function(){return this.Cs},set:function(a){this.Cs.A(a)||(this.Cs=a=a.I())}},contentAlignment:{get:function(){return this.Ui},set:function(a){var b=this.Ui;b.A(a)||(this.Ui=a=a.I(),
this.g("contentAlignment",b,a),Oi(this,!1))}},initialContentAlignment:{get:function(){return this.In},set:function(a){var b=this.In;b.A(a)||(this.In=a=a.I(),this.g("initialContentAlignment",b,a))}},padding:{get:function(){return this.gb},set:function(a){"number"===typeof a&&(a=new Lc(a));var b=this.gb;b.A(a)||(this.gb=a=a.I(),this.Xa(),this.g("padding",b,a))}},partManager:{get:function(){return this.Wa},set:function(a){var b=
this.Wa;b!==a&&(null!==a.diagram&&A("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.ob(null),this.Wa=a,a.ob(this))}},nodes:{get:function(){return this.partManager.nodes.iterator}},links:{get:function(){return this.partManager.links.iterator}},parts:{get:function(){return this.partManager.parts.iterator}},layout:{get:function(){return this.ic},set:function(a){var b=
this.ic;b!==a&&(this.ic=a,a.diagram=this,a.group=null,this.wg=!0,this.g("layout",b,a),this.ec())}},isTreePathToChildren:{get:function(){return this.Br},set:function(a){var b=this.Br;if(b!==a&&(this.Br=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)pk(a.value)}},treeCollapsePolicy:{get:function(){return this.xs},set:function(a){var b=this.xs;b!==a&&(a!==ni&&a!==qk&&a!==rk&&A("Unknown Diagram.treeCollapsePolicy: "+
a),this.xs=a,this.g("treeCollapsePolicy",b,a))}},De:{get:function(){return this.Ub},set:function(a){this.Ub=a}},autoScrollInterval:{get:function(){return this.Nm},set:function(a){var b=this.Nm;b!==a&&(this.Nm=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{get:function(){return this.Om},set:function(a){"number"===typeof a&&(a=new Lc(a));var b=this.Om;b.A(a)||(this.Om=a=a.I(),this.Xa(),this.g("autoScrollRegion",
b,a))}}});P.prototype.makeImageData=P.prototype.nx;P.prototype.makeImage=P.prototype.rz;P.prototype.addRenderer=P.prototype.Pw;P.prototype.makeSVG=P.prototype.gv;P.prototype.makeSvg=P.prototype.et;P.prototype.stopAutoScroll=P.prototype.sf;P.prototype.doAutoScroll=P.prototype.Js;P.prototype.isUnoccupied=P.prototype.Yj;P.prototype.raiseDiagramEvent=P.prototype.aa;P.prototype.removeDiagramListener=P.prototype.gm;P.prototype.addDiagramListener=P.prototype.Ej;P.prototype.findTreeRoots=P.prototype.Sy;
P.prototype.layoutDiagram=P.prototype.pz;P.prototype.findTopLevelGroups=P.prototype.Ly;P.prototype.findTopLevelNodesAndLinks=P.prototype.My;P.prototype.findLinksByExample=P.prototype.Ns;P.prototype.findNodesByExample=P.prototype.Os;P.prototype.findLinkForData=P.prototype.wc;P.prototype.findNodeForData=P.prototype.zi;P.prototype.findPartForData=P.prototype.xc;P.prototype.findNodeForKey=P.prototype.Ib;P.prototype.findPartForKey=P.prototype.findPartForKey;P.prototype.rebuildParts=P.prototype.wd;
P.prototype.transformViewToDoc=P.prototype.vt;P.prototype.transformRectDocToView=P.prototype.Lz;P.prototype.transformDocToView=P.prototype.ut;P.prototype.centerRect=P.prototype.Du;P.prototype.scrollToRect=P.prototype.zv;P.prototype.scroll=P.prototype.scroll;P.prototype.highlightCollection=P.prototype.fz;P.prototype.highlight=P.prototype.ez;P.prototype.clearHighlighteds=P.prototype.Rw;P.prototype.selectCollection=P.prototype.Av;P.prototype.select=P.prototype.select;P.prototype.clearSelection=P.prototype.Fs;
P.prototype.updateAllRelationshipsFromData=P.prototype.pq;P.prototype.updateAllTargetBindings=P.prototype.updateAllTargetBindings;P.prototype.commit=P.prototype.commit;P.prototype.rollbackTransaction=P.prototype.rf;P.prototype.commitTransaction=P.prototype.ab;P.prototype.startTransaction=P.prototype.Aa;P.prototype.raiseChanged=P.prototype.g;P.prototype.raiseChangedEvent=P.prototype.cb;P.prototype.removeChangedListener=P.prototype.hk;P.prototype.addChangedListener=P.prototype.jh;
P.prototype.removeModelChangedListener=P.prototype.Az;P.prototype.addModelChangedListener=P.prototype.Ow;P.prototype.findLayer=P.prototype.Tl;P.prototype.removeLayer=P.prototype.yz;P.prototype.addLayerAfter=P.prototype.$x;P.prototype.addLayerBefore=P.prototype.Mw;P.prototype.addLayer=P.prototype.Jl;P.prototype.moveParts=P.prototype.moveParts;P.prototype.copyParts=P.prototype.Oj;P.prototype.removeParts=P.prototype.nt;P.prototype.remove=P.prototype.remove;P.prototype.add=P.prototype.add;
P.prototype.clearDelayedGeometries=P.prototype.Eu;P.prototype.setProperties=P.prototype.Gv;P.prototype.resetInputOptions=P.prototype.wv;P.prototype.setInputOption=P.prototype.Ez;P.prototype.getInputOption=P.prototype.Wl;P.prototype.resetRenderingHints=P.prototype.xv;P.prototype.setRenderingHint=P.prototype.Ex;P.prototype.getRenderingHint=P.prototype.Ce;P.prototype.maybeUpdate=P.prototype.hd;P.prototype.requestUpdate=P.prototype.ec;P.prototype.delayInitialization=P.prototype.ty;
P.prototype.isUpdateRequested=P.prototype.lz;P.prototype.redraw=P.prototype.vh;P.prototype.invalidateDocumentBounds=P.prototype.Xa;P.prototype.findObjectsNear=P.prototype.kg;P.prototype.findPartsNear=P.prototype.Iy;P.prototype.findObjectsIn=P.prototype.jg;P.prototype.findPartsIn=P.prototype.gx;P.prototype.findObjectsAt=P.prototype.Sj;P.prototype.findObjectAt=P.prototype.Rb;P.prototype.findPartAt=P.prototype.Ul;P.prototype.alignDocument=P.prototype.gy;P.prototype.zoomToRect=P.prototype.Oz;
P.prototype.zoomToFit=P.prototype.zoomToFit;P.prototype.diagramScroll=P.prototype.Yw;P.prototype.focus=P.prototype.focus;P.prototype.reset=P.prototype.reset;P.useDOM=function(a){oh=a?void 0!==w.document:!1};P.isUsingDOM=function(){return oh};
var of=null,oi=new Pb,Ci=null,Bi=null,oh=void 0!==w.document,xi=null,yi="",li=new D(P,"None",0),Si=new D(P,"Uniform",1),Ti=new D(P,"UniformToFill",2),vg=new D(P,"CycleAll",10),zg=new D(P,"CycleNotDirected",11),Bg=new D(P,"CycleNotDirectedFast",12),Ig=new D(P,"CycleNotUndirected",13),wg=new D(P,"CycleDestinationTree",14),yg=new D(P,"CycleSourceTree",15),ki=new D(P,"DocumentScroll",1),sj=new D(P,"InfiniteScroll",2),ni=new D(P,"TreeParentCollapsed",21),qk=new D(P,"AllParentsCollapsed",22),rk=new D(P,
"AnyParentsCollapsed",23),sk=null,ii=!1;function ji(){if(oh){var a=w.document.createElement("canvas"),b=a.getContext("2d"),c=ab("7ca11abfd022028846");b[c]=ab("398c3597c01238");for(var d=["5da73c80a36455d4038e4972187c3cae51fd22",sa.Dx+"4ae6247590da4bb21c324ba3a84e385776",Tc.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",H.za],e=1;5>e;e++)b[ab("7ca11abfd7330390")](ab(d[e-1]),10,15*e);b[c]=ab("39f046ebb36e4b");for(c=1;5>c;c++)b[ab("7ca11abfd7330390")](ab(d[c-1]),10,15*c);sk=a}}P.className="Diagram";
P.fromDiv=function(a){var b=a;"string"===typeof a&&(b=w.document.getElementById(a));return b instanceof HTMLDivElement&&b.F instanceof P?b.F:null};P.inherit=function(a,b){function c(){}if(Object.getPrototypeOf(a).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+a);c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};P.None=li;P.Uniform=Si;P.UniformToFill=Ti;P.CycleAll=vg;P.CycleNotDirected=zg;P.CycleNotDirectedFast=Bg;P.CycleNotUndirected=Ig;
P.CycleDestinationTree=wg;P.CycleSourceTree=yg;P.DocumentScroll=ki;P.InfiniteScroll=sj;P.TreeParentCollapsed=ni;P.AllParentsCollapsed=qk;P.AnyParentsCollapsed=rk;function vi(){this.Vx=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.Df=this.l=!0:this.Df=null}
function oj(a,b){b.$c.setTransform(b.$b,0,0,b.$b,0,0);if(null===a.Df){b="f";var c=w[ab("76a715b2f73f148a")][ab("72ba13b5")];a.Df=!0;if(oh)if(!w[ab("7da7")]||!w[ab("7da7")][ab("76a115b6ed251eaf4692")]){for(var d=c[ab("76ad18b4f73e")],e=c[ab("73a612b6fb191d")](ab("35e7"))+2;e<d;e++)b+=c[e];d=b[ab("73a612b6fb191d")](ab("7da71ca0ad381e90"));a.Df=!(0<=d&&d<b[ab("73a612b6fb191d")](ab("35")))}else if(w[ab("7da7")]&&w[ab("7da7")][ab("76a115b6ed251eaf4692")]&&(e=ab(w[ab("7da7")][ab("76a115b6ed251eaf4692")]).split(ab("39e9")),
!(6>e.length))){var f=ab(e[1]).split(".");if("7da71ca0"===e[4]){var g=ab(sa[ab("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[ab("76ad18b4f73e")];for(g=c[ab("73a612b6fb191d")](ab("35e7"))+2;g<f;g++)b+=c[g];c=b[ab("73a612b6fb191d")](ab(e[2]));0>c&&ab(e[2])!==ab("7da71ca0ad381e90")&&(c=b[ab("73a612b6fb191d")](ab("76a715b2ef3e149757")));0>c&&(c=b[ab("73a612b6fb191d")](ab("76a715b2ef3e149757")));a.Df=!(0<=c&&c<b[ab("73a612b6fb191d")](ab("35")));if(a.Df&&(c=ab(e[2]),"#"===c[0])){f=w.document.createElement("div");
for(e=e[0].replace(/[A-Za-z]/g,"");4>e.length;)e+="9";e=e.substr(e.length-4);b=""+["gsh","gsf"][parseInt(e.substr(0,1),10)%2];b+=["Header","Background","Display","Feedback"][parseInt(e.substr(0,1),10)%4];f[ab("79a417a0f0181a8946")]=b;if(w.document[ab("78a712aa")]){if(w.document[ab("78a712aa")][ab("7bb806b6ed32388c4a875b")](f),e=w.getComputedStyle(f).getPropertyValue(ab("78a704b7e62456904c9b12701b6532a8")),w.document[ab("78a712aa")][ab("68ad1bbcf533388c4a875b")](f),e)if(-1!==e.indexOf(parseInt(c[1]+
c[2],16))&&-1!==e.indexOf(parseInt(c[3]+c[4],16)))a.Df=!1;else if(bb||cb||fb||gb)for(b="."+b,e=0;e<document.styleSheets.length;e++)for(d in c=document.styleSheets[e].rules||document.styleSheets[e].cssRules,c)if(b===c[d].selectorText){a.Df=!1;break}}else a.Df=!1}}}}}return 0<a.Df&&a!==a.Vx?!0:!1}
function wi(a,b){if(oh){void 0!==b&&null!==b||A("Diagram setup requires an argument DIV.");null!==a.Ha&&A("Diagram has already completed setup.");"string"===typeof b?a.Ha=w.document.getElementById(b):b instanceof HTMLDivElement?a.Ha=b:A("No DIV or DIV id supplied: "+b);null===a.Ha&&A("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ha.F&&A("Invalid div id; div already has a Diagram associated with it.");"static"===w.getComputedStyle(a.Ha,null).position&&(a.Ha.style.position="relative");
a.Ha.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.Ha.style["-ms-touch-action"]="none";a.Ha.innerHTML="";a.Ha.F=a;var c=new ok(a);c.Ka.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";void 0!==c.style&&(c.style.position="absolute",c.style.top="0px",c.style.left="0px","rtl"===w.getComputedStyle(a.Ha,null).getPropertyValue("direction")&&(a.Nn=!0),c.style.zIndex="2",c.style.userSelect="none",c.style.webkitUserSelect="none",c.style.MozUserSelect=
"none");a.xa=a.Ha.clientWidth||1;a.wa=a.Ha.clientHeight||1;a.Ea=c;a.$c=c.context;b=a.$c;a.$b=a.computePixelRatio();uj(a,a.xa,a.wa);a.$q=b.V[ab("7eba17a4ca3b1a8346")][ab("78a118b7")](b.V,sk,4,4);a.Ha.insertBefore(c.Ka,a.Ha.firstChild);c=new ok(null);c.width=1;c.height=1;a.Qt=c;a.pw=c.context;if(oh){c=va("div");var d=va("div");c.style.position="absolute";c.style.overflow="auto";c.style.width=a.xa+"px";c.style.height=a.wa+"px";c.style.zIndex="1";d.style.position="absolute";d.style.width="1px";d.style.height=
"1px";a.Ha.appendChild(c);c.appendChild(d);c.onscroll=Ii;c.onmousedown=Ki;c.ontouchstart=Ki;c.F=a;c.Tx=!0;c.Ux=!0;a.ks=c;a.$o=d}a.kt=ta(function(){a.te=null;a.R()},300);a.Tv=ta(function(){Ph(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.bk=function(b){if(a.isEnabled){a.fe=!0;var c=Wi(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.Re=0);bj(c,b)}};a.ak=function(b){if(a.isEnabled)if(a.fe=!0,a.Mg)b.preventDefault();else{var c=Wi(a,b,!0);c.down=!0;c.clickCount=b.detail;
if(cb||fb)b.timeStamp-a.bl<a.vu&&!a.currentTool.isBeyondDragSize()?a.Re++:a.Re=1,a.bl=b.timeStamp,c.clickCount=a.Re;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():bj(c,b)}};a.dk=function(b){if(a.isEnabled)if(a.Mg&&2===b.button)b.preventDefault();else if(a.Mg&&0===b.button&&(a.Mg=!1),a.Fl)b.preventDefault();else{a.fe=!0;var c=Wi(a,b,!0);c.up=!0;c.clickCount=b.detail;if(cb||fb)c.clickCount=a.Re;c.bubbles=b.bubbles;c.targetDiagram=Yi(b);a.doMouseUp();a.sf();bj(c,b)}};a.ek=function(b){if(a.isEnabled){var c=
Wi(a,b,!0);c.bubbles=!0;if(void 0!==b.deltaX){var d=0<b.deltaX?1:-1;var e=0<b.deltaY?1:-1;c.delta=Math.abs(b.deltaX)>Math.abs(b.deltaY)?-d:-e}else void 0!==b.wheelDeltaX?(d=0<b.wheelDeltaX?-1:1,e=0<b.wheelDeltaY?-1:1,c.delta=Math.abs(b.wheelDeltaX)>Math.abs(b.wheelDeltaY)?-d:-e):c.delta=void 0!==b.wheelDelta?0<b.wheelDelta?1:-1:0;a.doMouseWheel();bj(c,b)}};a.ck=function(b){a.isEnabled&&(a.fe=!1,Wi(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.Nv=function(b){if(a.isEnabled){a.Fl=
!1;a.Mg=!0;var c=Zi(a,b,b.targetTouches[0],1<b.touches.length);a.doMouseDown();bj(c,b)}};a.Mv=function(b){if(a.isEnabled){var c=null;0<b.targetTouches.length?c=b.targetTouches[0]:0<b.changedTouches.length&&(c=b.changedTouches[0]);c=aj(a,b,c,1<b.touches.length);a.doMouseMove();bj(c,b)}};a.Lv=function(b){if(a.isEnabled)if(a.Fl)b.preventDefault();else if(!(1<b.touches.length)){var c=null,d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);var e=$i(a,
b,!1,!0,!1,!1);if(null!==d){c=w.document.elementFromPoint(d.clientX,d.clientY);null!==c&&c.F instanceof P&&c.F!==a&&Xi(c.F,d,e);Xi(a,d,e);var k=d.screenX;d=d.screenY;var l=a.Er;b.timeStamp-a.bl<a.vu&&!(25<Math.abs(l.x-k)||25<Math.abs(l.y-d))?a.Re++:a.Re=1;e.clickCount=a.Re;a.bl=b.timeStamp;a.Er.h(k,d)}null===c?e.targetDiagram=Yi(b):c.F?e.targetDiagram=c.F:e.targetDiagram=null;e.targetObject=null;a.doMouseUp();bj(e,b);a.Mg=!1}};a.cm=function(b){if(a.isEnabled){a.fe=!0;var c=a.iu;void 0===c[b.pointerId]&&
(c[b.pointerId]=b);c=a.ml;var d=!1;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else if(null!==c[1]&&c[1].pointerId===b.pointerId)c[1]=b,d=!0;else if(null===c[0])c[0]=b;else if(null===c[1])c[1]=b,d=!0;else{b.preventDefault();return}if("touch"===b.pointerType||"pen"===b.pointerType)a.Fl=!1,a.Mg=!0;c=Zi(a,b,b,d);a.doMouseDown();1===b.button?b.preventDefault():bj(c,b)}};a.dm=function(b){if(a.isEnabled){a.fe=!0;var c=a.ml;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else{if(null!==c[1]&&
c[1].pointerId===b.pointerId){c[1]=b;return}if(null===c[0])c[0]=b;else return}c[0].pointerId===b.pointerId&&(c=aj(a,b,b,null!==c[1]),a.doMouseMove(),bj(c,b))}};a.fm=function(b){if(a.isEnabled){a.fe=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.iu;if(c&&a.Fl)delete d[b.pointerId],b.preventDefault();else if(d=a.ml,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=$i(a,b,!1,!0,!0,!1);var e=w.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.F instanceof P&&e.F!==a&&Xi(e.F,
b,d);Xi(a,b,d);var k=a.Er,l=c?25:10;b.timeStamp-a.bl<a.vu&&!(Math.abs(k.x-b.screenX)>l||Math.abs(k.y-b.screenY)>l)?a.Re++:a.Re=1;d.clickCount=a.Re;a.bl=b.timeStamp;a.Er.qg(b.screenX,b.screenY);null===e?d.targetDiagram=Yi(b):e.F?d.targetDiagram=e.F:d.targetDiagram=null;d.targetObject=null;a.doMouseUp();bj(d,b);c&&(a.Mg=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.em=function(b){if(a.isEnabled){a.fe=!1;var c=a.iu;c[b.pointerId]&&delete c[b.pointerId];c=a.ml;null!==c[0]&&c[0].pointerId===
b.pointerId&&(c[0]=null);null!==c[1]&&c[1].pointerId===b.pointerId&&(c[1]=null);"touch"!==b.pointerType&&"pen"!==b.pointerType&&(b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())}};b.Sc(!0);Di(a)}}vi.className="DiagramHelper";function Qf(a){this.l=void 0===a?new G:a;this.u=new G}
pa.Object.defineProperties(Qf.prototype,{point:{get:function(){return this.l},set:function(a){this.l=a}},shifted:{get:function(){return this.u},set:function(a){this.u=a}}});Qf.className="DraggingInfo";function Gj(a,b,c){this.node=a;this.info=b;this.Xu=c}Gj.className="DraggingNodeInfoPair";function Jf(){this.reset()}
Jf.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new L(NaN,NaN)).freeze();this.gridSnapCellSpot=cd;this.gridSnapOrigin=(new G(NaN,NaN)).freeze();this.cz=this.dragsTree=this.dragsLink=!1};function tk(a){1<arguments.length&&A("Palette constructor can only take one optional argument, the DIV HTML element or its id.");P.call(this,a);this.allowDragOut=!0;this.allowMove=!1;this.isReadOnly=!0;this.contentAlignment=dd;this.layout=new uk}oa(tk,P);
tk.className="Palette";
function vk(a){1<arguments.length&&A("Overview constructor can only take one optional argument, the DIV HTML element or its id.");P.call(this,a);this.animationManager.isEnabled=!1;this.qb=!0;this.Vf=null;this.ar=!0;this.Ex("drawShadows",!1);var b=new T,c=new V;c.stroke="magenta";c.strokeWidth=2;c.fill="transparent";c.name="BOXSHAPE";b.selectable=!0;b.selectionAdorned=!1;b.selectionObjectName="BOXSHAPE";b.locationObjectName="BOXSHAPE";b.resizeObjectName="BOXSHAPE";b.cursor="move";b.add(c);this.l=b;
this.allowDelete=this.allowCopy=!1;this.allowSelect=!0;this.autoScrollRegion=new Lc(0,0,0,0);this.su=new ok(null);this.Wx=this.su.context;Gf(this.toolManager,"Dragging",new wk,this.toolManager.mouseMoveTools);var d=this;this.click=function(){var a=d.Vf;if(null!==a){var b=a.viewportBounds,c=d.lastInput.documentPoint;a.position=new G(c.x-b.width/2,c.y-b.height/2)}};this.Bm=function(){d.Xa();xk(d)};this.zm=function(){null!==d.Vf&&(d.Xa(),d.R())};this.Am=function(){d.R()};this.ym=function(){null!==d.Vf&&
xk(d)};this.autoScale=Si;this.qb=!1}oa(vk,P);
function yk(a){a.qb||a.Yb||!1!==a.sd||(a.sd=!0,w.requestAnimationFrame(function(){if(a.sd&&!a.Yb&&(a.sd=!1,null!==a.Ha)){a.Yb=!0;Mi(a);a.documentBounds.s()||Ri(a,a.computeBounds());null===a.Ha&&A("No div specified");null===a.Ea&&A("No canvas specified");ci(a.box);if(a.qc){var b=a.Vf;if(null!==b&&!b.animationManager.isAnimating&&!b.animationManager.$a){b=a.$c;var c=a.su;b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,a.Ea.width,a.Ea.height);b.drawImage(c.Ka,0,0);c=a.ub;c.reset();1!==a.scale&&c.scale(a.scale);
0===a.position.x&&0===a.position.y||c.translate(-a.position.x,-a.position.y);b.scale(a.$b,a.$b);b.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);c=a.Ra.j;for(var d=c.length,e=0;e<d;e++)c[e].kc(b,a);a.Xh=!1;a.qc=!1}}a.Yb=!1}}))}vk.prototype.computePixelRatio=function(){return 1};
vk.prototype.kc=function(){null===this.Ha&&A("No div specified");null===this.Ea&&A("No canvas specified");ci(this.box);if(this.qc){var a=this.Vf;if(null!==a&&!a.animationManager.isAnimating){mj(this);var b=a.grid;null===b||!b.visible||isNaN(b.width)||isNaN(b.height)||(fj(a),Mi(a));var c=this.Ea;b=this.$c;var d=this.su,e=this.Wx;d.width=c.width;d.height=c.height;b.Sc(!0);b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,c.width,c.height);d=this.ub;d.reset();1!==this.scale&&d.scale(this.scale);0===this.position.x&&
0===this.position.y||d.translate(-this.position.x,-this.position.y);b.scale(this.$b,this.$b);b.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);d=this.ar;var f=this.viewportBounds;a=a.Ra.j;for(var g=a.length,h=0;h<g;h++){var k=a[h],l=d;if(k.visible&&0!==k.mb&&(void 0===l&&(l=!0),l||!k.isTemporary)){1!==k.mb&&(b.globalAlpha=k.mb);l=this.scale;k=k.Fa.j;for(var m=k.length,n=0;n<m;n++){var p=k[n],q=p.actualBounds;q.Jc(f)&&(1<q.width*l||1<q.height*l?p.kc(b,this):ei(b,p))}b.globalAlpha=1}}e.drawImage(c.Ka,
0,0);c=this.Ra.j;e=c.length;for(d=0;d<e;d++)c[d].kc(b,this);this.qc=this.Xh=!1}}};function xk(a){var b=a.box;if(null!==b){var c=a.Vf;if(null!==c){a.qc=!0;c=c.viewportBounds;var d=b.selectionObject,e=L.alloc();e.h(c.width,c.height);d.desiredSize=e;L.free(e);a=2/a.scale;d instanceof V&&(d.strokeWidth=a);b.location=new G(c.x-a/2,c.y-a/2);b.isSelected=!0}}}vk.prototype.computeBounds=function(){var a=this.Vf;if(null===a)return Jc;var b=a.documentBounds.copy();b.Wc(a.viewportBounds);return b};
vk.prototype.kx=function(){!0!==this.qc&&(this.qc=!0,yk(this))};vk.prototype.cq=function(a,b,c,d){this.qb||(Li(this),this.R(),cj(this),this.Xa(),xk(this),this.ve.scale=c,this.ve.position.x=a.x,this.ve.position.y=a.y,this.ve.bounds.assign(a),this.ve.mx=d,this.aa("ViewportBoundsChanged",this.ve,a))};
pa.Object.defineProperties(vk.prototype,{observed:{get:function(){return this.Vf},set:function(a){var b=this.Vf;a instanceof vk&&A("Overview.observed Diagram may not be an Overview itself: "+a);b!==a&&(null!==b&&(this.remove(this.box),b.gm("ViewportBoundsChanged",this.Bm),b.gm("DocumentBoundsChanged",this.zm),b.gm("InvalidateDraw",this.Am),b.gm("AnimationFinished",this.ym)),this.Vf=a,null!==a&&(a.Ej("ViewportBoundsChanged",this.Bm),a.Ej("DocumentBoundsChanged",this.zm),
a.Ej("InvalidateDraw",this.Am),a.Ej("AnimationFinished",this.ym),this.add(this.box),xk(this)),this.Xa(),this.g("observed",b,a))}},box:{get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.remove(b),this.add(this.l),xk(this),this.g("box",b,a))}},drawsTemporaryLayers:{get:function(){return this.ar},set:function(a){this.ar!==a&&(this.ar=a,this.vh())}}});vk.className="Overview";
function wk(){If.call(this);this.l=null}oa(wk,If);
wk.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||!a.allowMove||!a.allowSelect)return!1;var b=a.observed;if(null===b)return!1;var c=a.lastInput;if(!c.left||a.currentTool!==this&&(!this.isBeyondDragSize()||c.isTouchEvent&&c.timestamp-a.firstInput.timestamp<this.delay))return!1;null===this.findDraggablePart()&&(c=b.viewportBounds,this.l=new G(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new G(a.x-this.l.x,a.y-this.l.y));return!0};
wk.prototype.doActivate=function(){this.l=null;If.prototype.doActivate.call(this)};wk.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.l){var d=a.firstInput.documentPoint;c=c.location;this.l=new G(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new G(a.x-this.l.x,a.y-this.l.y)}}};wk.className="OverviewDraggingTool";
function zk(){tb(this);this.F=of;this.Tb=this.K=this.u=!0;this.da=this.La=this.Ub=this.Wa=!1;this.fi=this.l=null;this.Xc=1.05;this.au=NaN;this.vw=null;this.yu=NaN;this.xu=Jc;this.$f=null;this.Kc=200}zk.prototype.toString=function(){return"CommandHandler"};zk.prototype.ob=function(a){this.F=a};
zk.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=ib?b.meta:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&&
this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.allowHorizontalScroll?a.scroll("page","left"):a.allowVerticalScroll&&
a.scroll("page","up"):"PageDown"===f?d&&a.allowHorizontalScroll?a.scroll("page","right"):a.allowVerticalScroll&&a.scroll("page","down"):"Home"===f?c&&a.allowVerticalScroll?a.scroll("document","up"):!c&&a.allowHorizontalScroll&&a.scroll("document","left"):"End"===f?c&&a.allowVerticalScroll?a.scroll("document","down"):!c&&a.allowHorizontalScroll&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&&
this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&this.ungroupSelection():b.event&&113===b.event.which?this.canEditTextBlock()&&this.editTextBlock():b.event&&93===b.event.which?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()};
zk.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};zk.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Ua&&a.allowSelect&&a.Fs();null!==b&&b.doCancel()};zk.prototype.canStopCommand=function(){return!0};
zk.prototype.selectAll=function(){var a=this.diagram;a.R();try{a.currentCursor="wait";a.aa("ChangingSelection",a.selection);for(var b=a.parts;b.next();)b.value.isSelected=!0;for(var c=a.nodes;c.next();)c.value.isSelected=!0;for(var d=a.links;d.next();)d.value.isSelected=!0}finally{a.aa("ChangedSelection",a.selection),a.currentCursor=""}};zk.prototype.canSelectAll=function(){return this.diagram.allowSelect};
zk.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.Aa("Delete");a.aa("ChangingSelection",a.selection);a.aa("SelectionDeleting",a.selection);for(var b=new F,c=a.selection.iterator;c.next();)Ak(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.nt(b,!0);a.aa("SelectionDeleted",b)}finally{a.aa("ChangedSelection",a.selection),a.ab("Delete"),a.currentCursor=""}};
zk.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};zk.prototype.copySelection=function(){var a=this.diagram,b=new F;for(a=a.selection.iterator;a.next();)Ak(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};zk.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
zk.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};zk.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
zk.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)xi=null,yi="";else{c=b.model;var d=!1,e=!1,f=null;try{c.$l()&&(d=c.Nj,c.Nj=this.copiesParentKey),c.Vj()&&(e=c.Mj,c.Mj=this.copiesGroupKey),f=b.Oj(a,null,!0)}finally{c.$l()&&(c.Nj=d),c.Vj()&&(c.Mj=e),c=new E,c.addAll(f),xi=c,yi=b.model.dataFormat}}b.aa("ClipboardChanged",c)};
zk.prototype.pasteFromClipboard=function(){var a=new F,b=xi;if(null===b)return a;var c=this.diagram;if(yi!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.$l()&&(e=d.Nj,d.Nj=this.copiesParentKey),d.Vj()&&(f=d.Mj,d.Mj=this.copiesGroupKey),g=c.Oj(b,c,!1)}finally{for(d.$l()&&(d.Nj=e),d.Vj()&&(d.Mj=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.s()||(d.location.s()?c.location=d.location:!c.position.s()&&d.position.s()&&(c.position=d.position)),a.add(c)}return a};
zk.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.Aa("Paste");b.aa("ChangingSelection",b.selection);var c=this.pasteFromClipboard();0<c.count&&Kf(b);for(var d=c.iterator;d.next();)d.value.isSelected=!0;b.aa("ChangedSelection",b.selection);if(null!==a){var e=b.computePartsBounds(b.selection);if(e.s()){var f=this.computeEffectiveCollection(b.selection,b.Dk);eg(b,f,new G(a.x-e.centerX,a.y-e.centerY),b.Dk,!1)}}b.aa("ClipboardPasted",c)}finally{b.ab("Paste"),
b.currentCursor=""}};zk.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===xi||0===xi.count||yi!==a.model.dataFormat?!1:!0};zk.prototype.undo=function(){this.diagram.undoManager.undo()};zk.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};zk.prototype.redo=function(){this.diagram.undoManager.redo()};
zk.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};zk.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;b.autoScale===li&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};zk.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);var b=this.diagram;if(b.autoScale!==li)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
zk.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;b.autoScale===li&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};zk.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);var b=this.diagram;if(b.autoScale!==li)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};zk.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
zk.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};zk.prototype.zoomToFit=function(){var a=this.diagram,b=a.scale,c=a.position;b===this.yu&&!isNaN(this.au)&&a.documentBounds.A(this.xu)?(a.scale=this.au,a.position=this.vw,this.yu=NaN,this.xu=Jc):(this.au=b,this.vw=c.copy(),a.zoomToFit(),this.yu=a.scale,this.xu=a.documentBounds.copy())};zk.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
zk.prototype.scrollToPart=function(a){void 0===a&&(a=null);var b=this.diagram;if(null===a){try{null!==this.$f&&(this.$f.next()?a=this.$f.value:this.$f=null)}catch(k){this.$f=null}null===a&&(0<b.highlighteds.count?this.$f=b.highlighteds.iterator:0<b.selection.count&&(this.$f=b.selection.iterator),null!==this.$f&&this.$f.next()&&(a=this.$f.value))}if(null!==a){var c=b.animationManager;c.Ji("Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=Bk(this,a,[a]),f=function(){b.Aa();for(var a=e.pop();0<
e.length&&a instanceof U&&a.isTreeExpanded&&(!(a instanceof kg)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof T&&b.zv(a.actualBounds),a instanceof U&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof kg&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof T&&b.Du(a.actualBounds),b.gm("LayoutCompleted",g));b.ab("Scroll To Part")},g=function(){ua(f,(c.isEnabled?c.duration:0)+d)};b.Ej("LayoutCompleted",g);f()}else{var h=b.position.copy();b.Du(a.actualBounds);h.Oa(b.position)&&
c.Vd()}}};function Bk(a,b,c){if(b.isVisible())return c;if(b instanceof sf)Bk(a,b.adornedPart,c);else if(b instanceof S){var d=b.fromNode;null!==d&&Bk(a,d,c);b=b.toNode;null!==b&&Bk(a,b,c)}else b instanceof U&&(d=b.labeledLink,null!==d&&Bk(a,d,c),d=b.lg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),Bk(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),Bk(a,b,c));return c}
zk.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof T))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll};
zk.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Aa("Collapse Tree");b.animationManager.Ji("Collapse Tree");var c=new E;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof U&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.aa("TreeCollapsed",c)}finally{b.ab("Collapse Tree")}};
zk.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof U&&a.isTreeExpanded))return!1;if(0<a.Pp().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&b.isTreeExpanded&&0<b.Pp().count)return!0;return!1};
zk.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Aa("Expand Tree");b.animationManager.Ji("Expand Tree");var c=new E;if(null===a||a.isTreeExpanded)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof U&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}else a.expandTree(),c.add(a);b.aa("TreeExpanded",c)}finally{b.ab("Expand Tree")}};
zk.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof U)||a.isTreeExpanded)return!1;if(0<a.Pp().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof U&&!b.isTreeExpanded&&0<b.Pp().count)return!0;return!1};
zk.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.Wj()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.Aa("Group");a.aa("ChangingSelection",a.selection);for(var e=new E,f=a.selection.iterator;f.next();){var g=f.value;g.cc()&&g.canGroup()&&e.add(g)}for(var h=new E,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Ee(m.value)){f=!0;break}f||h.add(l)}if(0<h.count){var n=h.first().containingGroup;if(null!==n)for(;null!==
n;){e=!1;for(var p=h.iterator;p.next();)if(!p.value.Ee(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof kg)$g(c),d=c.copy(),null!==d&&a.add(d);else if(b.ev(c)){var q=b.copyNodeData(c);Aa(q)&&(b.gf(q),d=a.zi(q))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var r=h.iterator;r.next();){var u=r.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.select(d)}}a.aa("ChangedSelection",a.selection);a.aa("SelectionGrouped",d)}finally{a.ab("Group"),a.currentCursor=
""}}}};zk.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.Wj()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.cc()&&b.canGroup())return!0}return!1};
function Ck(a){var b=Ka();for(a=a.iterator;a.next();){var c=a.value;c instanceof S||b.push(c)}a=new F;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Ee(b[g])){f=!1;break}f&&a.add(e)}Oa(b);return a}
zk.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof S)return!1;if(null!==a){if(a===b||a.Ee(b))return!1;var c=a.memberValidation;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.memberValidation;return null!==c?c(a,b):!0};
zk.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.Wj())try{b.currentCursor="wait";b.Aa("Ungroup");b.aa("ChangingSelection",b.selection);var d=new E;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof kg&&f.canUngroup()&&d.add(f)}var g=new E;if(0<d.count){b.Fs();for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.pa(l.data):void 0;g.addAll(k.memberParts);
for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof S)){var q=p.data;null!==q?c.qt(q,m):p.containingGroup=l}}b.remove(k)}}b.aa("ChangedSelection",b.selection);b.aa("SelectionUngrouped",d,g)}finally{b.ab("Ungroup"),b.currentCursor=""}};
zk.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.Wj())return!1;if(null!==a){if(!(a instanceof kg))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof kg&&b.canUngroup())return!0;return!1};
zk.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=Ck(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
zk.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Aa("Collapse SubGraph");b.animationManager.Ji("Collapse SubGraph");var c=new E;if(null!==a&&a.isSubGraphExpanded)a.collapseSubGraph(),c.add(a);else for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof kg&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.aa("SubGraphCollapsed",c)}finally{b.ab("Collapse SubGraph")}};
zk.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof kg&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof kg&&b.isSubGraphExpanded)return!0;return!1};
zk.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Aa("Expand SubGraph");b.animationManager.Ji("Expand SubGraph");var c=new E;if(null===a||a.isSubGraphExpanded)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof kg&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}else a.expandSubGraph(),c.add(a);b.aa("SubGraphExpanded",c)}finally{b.ab("Expand SubGraph")}};
zk.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof kg&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof kg&&!b.isSubGraphExpanded)return!0;return!1};
zk.prototype.editTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.toolManager.findTool("TextEditing");if(null!==c){if(null===a){a=null;for(var d=b.selection.iterator;d.next();){var e=d.value;if(e.canEdit()){a=e;break}}if(null===a)return;a=a.Sl(function(a){return a instanceof th&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
zk.prototype.canEditTextBlock=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowTextEdit||null===b.toolManager.findTool("TextEditing"))return!1;if(null!==a){if(!(a instanceof th))return!1;a=a.part;if(null!==a&&a.canEdit())return!0}else for(b=b.selection.iterator;b.next();)if(a=b.value,a.canEdit()&&(a=a.Sl(function(a){return a instanceof th&&a.editable}),null!==a))return!0;return!1};
zk.prototype.showContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null!==c&&(void 0===a&&(a=0<b.selection.count?b.selection.first():b),a=c.findObjectWithContextMenu(a),null!==a)){var d=b.lastInput,e=null;a instanceof Y?e=a.ma(gd):b.isMouseOverDiagram||(e=b.viewportBounds,e=new G(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.ut(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;qh(c,!1,a)}};
zk.prototype.canShowContextMenu=function(a){var b=this.diagram,c=b.toolManager.findTool("ContextMenu");if(null===c)return!1;void 0===a&&(a=0<b.selection.count?b.selection.first():b);return null===c.findObjectWithContextMenu(a)?!1:!0};
zk.prototype.computeEffectiveCollection=function(a,b){var c=this.diagram,d=c.toolManager.findTool("Dragging"),e=c.currentTool===d;void 0===b&&(b=e?d.dragOptions:c.Dk);d=new Pb;if(null===a)return d;for(var f=a.iterator;f.next();)Ej(c,d,f.value,e,b);if(null!==c.draggedLink&&b.dragsLink)return d;for(f=a.iterator;f.next();)a=f.value,a instanceof S&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d};
pa.Object.defineProperties(zk.prototype,{diagram:{get:function(){return this.F}},copiesClipboardData:{get:function(){return this.u},set:function(a){this.u=a}},copiesConnectedLinks:{get:function(){return this.K},set:function(a){this.K=a}},deletesConnectedLinks:{get:function(){return this.Tb},set:function(a){this.Tb=a}},copiesTree:{get:function(){return this.Wa},
set:function(a){this.Wa=a}},deletesTree:{get:function(){return this.Ub},set:function(a){this.Ub=a}},copiesParentKey:{get:function(){return this.La},set:function(a){this.La=a}},copiesGroupKey:{get:function(){return this.da},set:function(a){this.da=a}},archetypeGroupData:{get:function(){return this.l},set:function(a){this.l=a}},memberValidation:{get:function(){return this.fi},
set:function(a){this.fi=a}},defaultScale:{get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{get:function(){return this.Xc},set:function(a){1<a||A("zoomFactor must be larger than 1.0, not: "+a);this.Xc=a}},scrollToPartPause:{get:function(){return this.Kc},set:function(a){this.Kc=a}}});zk.className="CommandHandler";si=function(){return new zk};
function Y(){tb(this);this.G=4225027;this.mb=1;this.Yf=null;this.Ta="";this.fc=this.jb=null;this.sa=(new G(NaN,NaN)).freeze();this.Nc=rc;this.Nf=jc;this.Mf=oc;this.ub=new Tc;this.xh=new Tc;this.Kf=new Tc;this.Ca=this.Kk=1;this.Bc=0;this.se=Dk;this.Qg=Rc;this.sc=(new N(NaN,NaN,NaN,NaN)).freeze();this.wb=(new N(NaN,NaN,NaN,NaN)).freeze();this.jc=(new N(0,0,NaN,NaN)).freeze();this.P=this.Io=this.Jo=null;this.qk=this.xb=Hd;this.Wo=0;this.Xo=1;this.zg=0;this.Tm=1;this.mp=null;this.ap=-Infinity;this.pl=
0;this.ql=cc;this.rl=Qg;this.cn="";this.eb=this.O=null;this.vk=-1;this.tl=this.md=this.Mh=this.wl=null;this.cs=ah;this.sj=null}var ie,ah,ch,Dk,Ek,Fk,Gk,Hk,Ik,Jk;
Y.prototype.cloneProtected=function(a){a.G=this.G|6144;a.mb=this.mb;a.Ta=this.Ta;a.jb=this.jb;a.fc=this.fc;a.sa.assign(this.sa);a.Nc=this.Nc.I();a.Nf=this.Nf.I();a.Mf=this.Mf.I();a.Kf=this.Kf.copy();a.Ca=this.Ca;a.Bc=this.Bc;a.se=this.se;a.Qg=this.Qg.I();a.sc.assign(this.sc);a.wb.assign(this.wb);a.jc.assign(this.jc);a.Io=this.Io;null!==this.P&&(a.P=this.P.copy());a.xb=this.xb.I();a.qk=this.qk.I();a.Wo=this.Wo;a.Xo=this.Xo;a.zg=this.zg;a.Tm=this.Tm;a.mp=this.mp;a.ap=this.ap;a.pl=this.pl;a.ql=this.ql.I();
a.rl=this.rl;a.cn=this.cn;null!==this.O&&(a.O=this.O.copy());a.eb=this.eb;a.vk=this.vk;null!==this.Mh&&(a.Mh=Fa(this.Mh));null!==this.md&&(a.md=this.md.copy());a.tl=this.tl};Y.prototype.Lw=function(a){var b=this.Mh;if(Da(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.Mh=b=[];b.push(a)};Y.prototype.lf=function(a){a.Jo=null;a.sj=null;a.o()};
Y.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.Mh)for(var b=0;b<this.Mh.length;b++){var c=this.Mh[b];a[c]=this[c]}return a};Y.prototype.copy=function(){return this.clone()};t=Y.prototype;t.hb=function(a){a.classType===S?0===a.name.indexOf("Orient")?this.segmentOrientation=a:A("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===Y&&(this.stretch=a)};t.toString=function(){return Pa(this.constructor)+"#"+Fb(this)};
function Kk(a){null===a.O&&(a.O=new Lk)}t.Ic=function(){if(null===this.P){var a=new Mk;a.Ig=bd;a.fh=bd;a.Gg=10;a.dh=10;a.Hg=0;a.eh=0;this.P=a}};t.cb=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.gk(a,b,c,d,e,f,g),Nk(this)&&c===this&&a===df&&Ok(this,h,b),this instanceof W&&c===h&&0!==(h.G&16777216)&&null!==h.data))for(a=this.W.j,c=a.length,d=0;d<c;d++)e=a[d],e instanceof W&&vj(e,function(a){null!==a.data&&0!==(a.G&16777216)&&a.Da(b)})};
function Ok(a,b,c){var d=a.ph();if(null!==d)for(var e=a.eb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=Pk(f,d,a);if(null===g)continue;f.qq(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.qq(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.qq(a,h,c,d)}g===a&&(h=d.Ms(f.Oi),null!==h&&f.Rv(h,g,c))}}t.Ms=function(a){return this.vk===a?this:null};
t.g=function(a,b,c){this.cb(df,a,this,b,c)};function Qk(a,b,c,d,e){var f=a.sc,g=a.Kf;g.reset();Rk(a,g,b,c,d,e);a.Kf=g;f.h(b,c,d,e);g.Zs()||g.Ov(f)}function Sk(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Jc(b,d):a.mh(b,d)}
t.ex=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Ae(b);return c?Zb(a.x,a.y,0,0,0,d.height)<=b||Zb(a.x,a.y,0,d.height,d.width,d.height)<=b||Zb(a.x,a.y,d.width,d.height,d.width,0)<=b||Zb(a.x,a.y,d.width,0,0,0)<=b:a.ed(0,0)<=b&&a.ed(0,d.height)<=b&&a.ed(d.width,0)<=b&&a.ed(d.width,d.height)<=b};t.Yd=function(){return!0};
t.ea=function(a){var b=G.alloc();b.assign(a);this.transform.ta(b);var c=this.actualBounds;if(!c.s())return G.free(b),!1;var d=this.diagram;if(null!==d&&d.Mg){var e=d.Wl("extraTouchThreshold"),f=d.Wl("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Be()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=Gc(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),G.free(b),a}e=!1;if(this instanceof sf||this instanceof V?Gc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y):c.ea(b))this.md&&!this.md.ea(b)?
e=!1:null!==this.fc&&c.ea(b)?e=!0:null!==this.jb&&this.jc.ea(a)?e=!0:e=this.nh(a);G.free(b);return e};t.nh=function(a){var b=this.naturalBounds;return Gc(0,0,b.width,b.height,a.x,a.y)};
t.kf=function(a){if(0===this.angle)return this.actualBounds.kf(a);var b=this.naturalBounds;b=N.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=G.allocAt(a.x,a.y);b.ea(c.Td(e))&&(e.h(a.x,a.bottom),b.ea(c.Td(e))&&(e.h(a.right,a.bottom),b.ea(c.Td(e))&&(e.h(a.right,a.y),b.ea(c.Td(e))&&(d=!0))));G.free(e);N.free(b);return d};
t.mh=function(a,b){if(void 0===b)return a.kf(this.actualBounds);var c=this.naturalBounds,d=!1,e=G.allocAt(0,0);a.ea(b.ta(e))&&(e.h(0,c.height),a.ea(b.ta(e))&&(e.h(c.width,c.height),a.ea(b.ta(e))&&(e.h(c.width,0),a.ea(b.ta(e))&&(d=!0))));G.free(e);return d};
t.Jc=function(a,b){if(void 0===b&&(b=this.transform,0===this.angle))return a.Jc(this.actualBounds);var c=this.naturalBounds,d=G.allocAt(0,0),e=G.allocAt(0,c.height),f=G.allocAt(c.width,c.height),g=G.allocAt(c.width,0),h=!1;if(a.ea(b.ta(d))||a.ea(b.ta(e))||a.ea(b.ta(f))||a.ea(b.ta(g)))h=!0;else{c=N.allocAt(0,0,c.width,c.height);var k=G.allocAt(a.x,a.y);c.ea(b.Td(k))?h=!0:(k.h(a.x,a.bottom),c.ea(b.Td(k))?h=!0:(k.h(a.right,a.bottom),c.ea(b.Td(k))?h=!0:(k.h(a.right,a.y),c.ea(b.Td(k))&&(h=!0))));G.free(k);
N.free(c);!h&&(H.Ws(a,d,e)||H.Ws(a,e,f)||H.Ws(a,f,g)||H.Ws(a,g,d))&&(h=!0)}G.free(d);G.free(e);G.free(f);G.free(g);return h};t.ma=function(a,b){void 0===b&&(b=new G);if(a instanceof O){var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.td.ta(b);return b};
t.Qp=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.td,d=G.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);Fc(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);Fc(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);Fc(a,d.x,d.y,0,0);G.free(d);return a};t.Ci=function(){var a=this.td;1===a.m11&&0===a.m12?a=0:(a=180*Math.atan2(a.m12,a.m11)/Math.PI,0>a&&(a+=360));return a};
t.Be=function(){if(0!==(this.G&4096)===!1)return this.Kk;var a=this.Ca;return null!==this.panel?a*this.panel.Be():a};t.Ss=function(a,b){void 0===b&&(b=new G);b.assign(a);this.td.Td(b);return b};t.Uc=function(a,b,c){return this.Uj(a.x,a.y,b.x,b.y,c)};
t.Uj=function(a,b,c,d,e){var f=this.transform,g=1/(f.m11*f.m22-f.m12*f.m21),h=f.m22*g,k=-f.m12*g,l=-f.m21*g,m=f.m11*g,n=g*(f.m21*f.dy-f.m22*f.dx),p=g*(f.m12*f.dx-f.m11*f.dy);if(null!==this.areaBackground)return f=this.actualBounds,H.Uc(f.left,f.top,f.right,f.bottom,a,b,c,d,e);g=a*h+b*l+n;a=a*k+b*m+p;b=c*h+d*l+n;c=c*k+d*m+p;e.h(0,0);d=this.naturalBounds;c=H.Uc(0,0,d.width,d.height,g,a,b,c,e);e.transform(f);return c};
Y.prototype.measure=function(a,b,c,d){if(!1!==jj(this)){var e=this.Qg,f=e.right+e.left;e=e.top+e.bottom;a=Math.max(a-f,0);b=Math.max(b-e,0);c=Math.max((c||0)-f,0);d=Math.max((d||0)-e,0);f=this.angle;e=this.desiredSize;var g=0;this instanceof V&&(g=this.strokeWidth);90===f||270===f?(a=isFinite(e.height)?e.height+g:a,b=isFinite(e.width)?e.width+g:b):(a=isFinite(e.width)?e.width+g:a,b=isFinite(e.height)?e.height+g:b);e=c||0;g=d||0;var h=this instanceof W;switch(Tk(this,!0)){case ah:g=e=0;h&&(b=a=Infinity);
break;case ie:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case Ek:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case Fk:isFinite(b)&&b>d&&(g=b),e=0,h&&(a=Infinity)}h=this.maxSize;var k=this.minSize;e>h.width&&k.width<h.width&&(e=h.width);g>h.height&&k.height<h.height&&(g=h.height);c=Math.max(e/this.scale,k.width);d=Math.max(g/this.scale,k.height);h.width<c&&(c=Math.min(k.width,c));h.height<d&&(d=Math.min(k.height,d));a=Math.min(h.width,a);b=Math.min(h.height,b);a=Math.max(c,a);b=Math.max(d,
b);if(90===f||270===f)f=a,a=b,b=f,f=c,c=d,d=f;this.sc.ha();this.bm(a,b,c,d);this.sc.freeze();this.sc.s()||A("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.sc.toString());ej(this,!1)}};Y.prototype.bm=function(){};Y.prototype.pg=function(){return!1};
Y.prototype.arrange=function(a,b,c,d,e){this.Xk();var f=N.alloc();f.assign(this.wb);this.wb.ha();!1===kj(this)?this.wb.h(a,b,c,d):this.lh(a,b,c,d);this.wb.freeze();void 0===e?this.md=null:this.md=e;c=!1;if(void 0!==e)c=!0;else if(e=this.panel,null===e||e.type!==W.TableRow&&e.type!==W.TableColumn||(e=e.panel),null!==e&&(e=e.jc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.wb),c=b+d.height,d=a+d.width,c=!(0<=a+.05&&d<=e.width+.05&&0<=b+.05&&c<=e.height+.05),this instanceof th&&(a=this.naturalBounds,
this.Jr>a.height||this.metrics.maxLineWidth>a.width)))c=!0;this.G=c?this.G|256:this.G&-257;this.wb.s()||A("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.wb.toString());this.ht(f,this.wb);Uk(this,!1);N.free(f)};t=Y.prototype;t.lh=function(){};
function Vk(a,b,c,d,e){a.wb.h(b,c,d,e);if(!a.desiredSize.s()){var f=a.sc;c=a.Qg;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=Tk(a,!0);c===d&&f===e&&(b=ah);switch(b){case ah:if(c>d||f>e)ej(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case ie:ej(a,!0);a.measure(d,e,0,0);break;case Ek:ej(a,!0);a.measure(d,f,0,0);break;case Fk:ej(a,!0),a.measure(c,e,0,0)}}}
t.ht=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||Wk(c,!0),this.R(),Ac(a,b)||(c.sh(),this.xo(c)))};t.xo=function(a){null!==this.portId&&(Wk(a,!0),a instanceof U&&Xk(a,this))};
t.kc=function(a,b){if(this.visible){var c=this instanceof W&&(this.type===W.TableRow||this.type===W.TableColumn),d=this.wb;if(c||0!==d.width&&0!==d.height&&!isNaN(d.x)&&!isNaN(d.y)){var e=this.opacity;if(0!==e){var f=1;1!==e&&(f=a.globalAlpha,a.globalAlpha=f*e);if(!this.$w(a,b))if(c)Yk(this,a,b);else{this instanceof S&&this.$j(!1);c=this.transform;var g=this.panel;0!==(this.G&4096)===!0&&Zk(this);var h=this.part,k=!1,l=0;if(h&&b.Ce("drawShadows")&&(k=h.isShadowed)){var m=h.ni;l=Math.max(m.y,m.x)*
b.scale*b.$b}if(!(m=b.ej)){var n=this.jc;m=this.xh;var p=m.m11,q=m.m21,r=m.dx,u=m.m12,v=m.m22,x=m.dy,y,z=y=0;m=y*p+z*q+r;var B=y*u+z*v+x;y=n.width+l;z=0;var C=y*p+z*q+r;y=y*u+z*v+x;m=Math.min(m,C);B=Math.min(B,y);var I=Math.max(m,C)-m;var J=Math.max(B,y)-B;y=n.width+l;z=n.height+l;C=y*p+z*q+r;y=y*u+z*v+x;m=Math.min(m,C);B=Math.min(B,y);I=Math.max(m+I,C)-m;J=Math.max(B+J,y)-B;y=0;z=n.height+l;C=y*p+z*q+r;y=y*u+z*v+x;m=Math.min(m,C);B=Math.min(B,y);I=Math.max(m+I,C)-m;J=Math.max(B+J,y)-B;l=b.viewportBounds;
n=l.C;p=l.D;m=!(m>l.$+n||n>I+m||B>l.Y+p||p>J+B)}if(m){m=0!==(this.G&256);a.clipInsteadOfFill&&(m=!1);this instanceof th&&(a.font=this.font);if(m){B=g.Yd()?g.naturalBounds:g.actualBounds;null!==this.md?(n=this.md,I=n.x,J=n.y,l=n.width,n=n.height):(I=Math.max(d.x,B.x),J=Math.max(d.y,B.y),l=Math.min(d.right,B.right)-I,n=Math.min(d.bottom,B.bottom)-J);if(I>d.width+d.x||d.x>B.width+B.x){1!==e&&(a.globalAlpha=f);return}a.save();a.beginPath();a.rect(I,J,l,n);a.clip()}if(this.pg()){if(!h.isVisible()){1!==
e&&(a.globalAlpha=f);return}k&&(B=h.ni,a.Hv(B.x*b.scale*b.$b,B.y*b.scale*b.$b,h.Od),$k(a),a.shadowColor=h.zj)}!0===this.shadowVisible?$k(a):!1===this.shadowVisible&&al(a);h=this.naturalBounds;null!==this.fc&&(fi(this,a,this.fc,!0,!0,h,d),this.fc instanceof bl&&this.fc.type===cl?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.Sd(this.fc)):a.fillRect(d.x,d.y,d.width,d.height));a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);k&&(null!==g&&0!==(g.G&512)||null!==g&&(g.type===W.Auto||g.type===W.Spot)&&
g.Ab()!==this)&&null===this.shadowVisible&&al(a);null!==this.jb&&(l=this.naturalBounds,I=B=0,J=l.width,l=l.height,n=0,this instanceof V&&(l=this.qa.bounds,B=l.x,I=l.y,J=l.width,l=l.height,n=this.strokeWidth),fi(this,a,this.jb,!0,!1,h,d),this.jb instanceof bl&&this.jb.type===cl?(a.beginPath(),a.rect(B-n/2,I-n/2,J+n,l+n),a.Sd(this.jb)):a.fillRect(B-n/2,I-n/2,J+n,l+n));k&&(null!==this.jb||null!==this.fc||null!==g&&0!==(g.G&512)||null!==g&&(g.type===W.Auto||g.type===W.Spot)&&g.Ab()!==this)?(dl(this,!0),
null===this.shadowVisible&&al(a)):dl(this,!1);this.xi(a,b);k&&0!==(this.G&512)===!0&&$k(a);this.pg()&&k&&al(a);m?(a.restore(),this instanceof W?a.Sc(!0):a.Sc(!1)):c.Zs()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*c.dx),b*(c.m12*c.dx-c.m11*c.dy)))}}1!==e&&(a.globalAlpha=f)}}}};t.$w=function(){return!1};
function Yk(a,b,c){var d=a.wb,e=a.jc;null!==a.fc&&(fi(a,b,a.fc,!0,!0,e,d),a.fc instanceof bl&&a.fc.type===cl?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Sd(a.fc)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.jb&&(fi(a,b,a.jb,!0,!1,e,d),a.jb instanceof bl&&a.jb.type===cl?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.Sd(a.jb)):b.fillRect(d.x,d.y,d.width,d.height));a.xi(b,c)}t.xi=function(){};
function fi(a,b,c,d,e,f,g){if(null!==c){var h=1,k=1;if("string"===typeof c)d?b.fillStyle=c:b.strokeStyle=c;else if(c.type===el)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{h=f.width;k=f.height;e&&(h=g.width,k=g.height);if((f=b instanceof fl)&&c.ae&&(c.type===gl||c.yk===h&&c.Ht===k))var l=c.ae;else{var m=0,n=0,p=0,q=0,r=0,u=0;u=r=0;e&&(r=g.x,u=g.y);m=c.start.x*h+c.start.offsetX;n=c.start.y*k+c.start.offsetY;p=c.end.x*h+c.end.offsetX;q=c.end.y*k+c.end.offsetY;m+=r;p+=r;n+=u;q+=u;if(c.type===hl)l=
b.createLinearGradient(m,n,p,q);else if(c.type===cl)u=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(r=0,u=Math.max(h,k)/2):r=c.startRadius,l=b.createRadialGradient(m,n,r,p,q,u);else if(c.type===gl)try{l=b.createPattern(c.pattern,"repeat")}catch(x){l=null}if(c.type!==gl&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)l.addColorStop(e.key,e.value);if(f&&(c.ae=l,null!==l&&(c.yk=h,c.Ht=k),null===l&&c.type===gl&&-1!==c.yk)){c.yk=-1;var v=a.diagram;null!==v&&-1===c.yk&&ua(function(){v.vh()},
600)}}d?b.fillStyle=l:b.strokeStyle=l}}}t.ng=function(a){if(a instanceof W)a:{if(this!==a&&null!==a)for(var b=this.panel;null!==b;){if(b===a){a=!0;break a}b=b.panel}a=!1}else a=!1;return a};t.pf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.pf():!0};t.og=function(){for(var a=this instanceof W?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function Zk(a){if(0!==(a.G&2048)===!0){var b=a.ub;b.reset();if(!a.wb.s()||!a.sc.s()){il(a,!1);return}b.translate(a.wb.x-a.sc.x,a.wb.y-a.sc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;Rk(a,b,c.x,c.y,c.width,c.height)}il(a,!1);jl(a,!0)}0!==(a.G&4096)===!0&&(b=a.panel,null===b?(a.xh.set(a.ub),a.Kk=a.scale,jl(a,!1)):null!==b.td&&(c=a.xh,c.reset(),b.Yd()?c.multiply(b.xh):null!==b.panel&&c.multiply(b.panel.xh),c.multiply(a.ub),a.Kk=a.scale*b.Kk,jl(a,!1)))}
function Rk(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.angle){var g=gd;a.pg()&&a.locationSpot.ib()&&(g=a.locationSpot);var h=G.alloc();if(a instanceof T&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.ik(d.x,d.y,d.width,d.height,g),c.Kf.ta(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.Kf.ta(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.ik(c,d,e,f,g);b.rotate(a.angle,h.x,h.y);G.free(h)}}
t.o=function(a){void 0===a&&(a=!1);if(!0!==jj(this)){ej(this,!0);Uk(this,!0);var b=this.panel;null===b||a||b.o()}};t.Yl=function(){!0!==jj(this)&&(ej(this,!0),Uk(this,!0))};function kl(a){if(!1===kj(a)){var b=a.panel;null!==b?b.o():a.pg()&&(b=a.diagram,null!==b&&(b.Ed.add(a),a instanceof U&&a.gd(),b.ec()));Uk(a,!0)}}t.Xk=function(){0!==(this.G&2048)===!1&&(il(this,!0),jl(this,!0))};t.cv=function(){jl(this,!0)};t.R=function(){var a=this.part;null!==a&&a.R()};
function Tk(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===W.Table)return ll(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===W.Auto&&d.Ab()===a)return ml(a,ie,b);if(c===Dk){if(null!==d){if(d.type===W.Spot&&d.Ab()===a)return ml(a,ie,b);c=d.defaultStretch;return c===Dk?ml(a,ah,b):ml(a,c,b)}return ml(a,ah,b)}return ml(a,c,b)}
function ll(a,b,c,d){var e=a.stretch;if(e!==Dk)return ml(a,e,d);var f=e=null;switch(b.stretch){case Fk:f=!0;break;case ie:f=!0}switch(c.stretch){case Ek:e=!0;break;case ie:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===Ek||b===ie);null===f&&(f=b===Fk||b===ie);return!0===e&&!0===f?ml(a,ie,d):!0===e?ml(a,Ek,d):!0===f?ml(a,Fk,d):ml(a,ah,d)}
function ml(a,b,c){if(c)return b;if(b===ah)return ah;c=a.desiredSize;if(c.s())return ah;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===Ek)return ah;if(b===ie)return Fk}else{if(b===Fk)return ah;if(b===ie)return Ek}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===Fk)return ah;if(b===ie)return Ek}else{if(b===Ek)return ah;if(b===ie)return Fk}return b}function dl(a,b){a.G=b?a.G|512:a.G&-513}function Nk(a){return 0!==(a.G&1024)}function nl(a,b){a.G=b?a.G|1024:a.G&-1025}
function il(a,b){a.G=b?a.G|2048:a.G&-2049}function jl(a,b){a.G=b?a.G|4096:a.G&-4097}function jj(a){return 0!==(a.G&8192)}function ej(a,b){a.G=b?a.G|8192:a.G&-8193}function kj(a){return 0!==(a.G&16384)}function Uk(a,b){a.G=b?a.G|16384:a.G&-16385}t.Ki=function(a){this.Yf=a};t.Fv=function(){};t.Ev=function(a){this.sa=a;kl(this);return!0};t.tt=function(a,b){this.sa.h(a,b);this.Xk()};
function ol(a){var b=a.part;if(b instanceof U&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||Xk(b,a)}}function pl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof W?a instanceof U?a.gd():a.sm(a,function(a){ol(a)}):ol(a))}t.bind=function(a){a.Qd=this;var b=this.ph();null!==b&&ql(b)&&A("Cannot add a Binding to a template that has already been copied: "+a);null===this.eb&&(this.eb=new E);this.eb.add(a)};
t.ph=function(){for(var a=this instanceof W?this:this.panel;null!==a;){if(null!==a.Kh)return a;a=a.panel}return null};t.Gv=function(a){qj(this,a)};
function rl(a,b){for(var c=1;c<arguments.length;++c);c=arguments;var d=null,e=null;if("function"===typeof a)e=a;else if("string"===typeof a){var f=sl.J(a);"function"===typeof f?(c=Fa(arguments),d=f(c),Aa(d)||A('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=w.go[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||A("GraphObject.make requires a class function or GoJS class name or name of an object builder, not: "+a),d=new e);e=1;if(d instanceof P&&1<c.length){f=
d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)wi(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?A("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):tl(d,f);return d}
function tl(a,b){if("string"===typeof b)if(a instanceof th)a.text=b;else if(a instanceof V)a.figure=b;else if(a instanceof Qj)a.source=b;else if(a instanceof W)b=ul.J(b),null!==b&&(a.type=b);else if(a instanceof bl){var c=ub(bl,b);null!==c?a.type=c:A("Unknown Brush type as an argument to GraphObject.make: "+b)}else a instanceof ge?(b=ub(ge,b),null!==b&&(a.type=b)):a instanceof Ye&&(b=ub(Ye,b),null!==b&&(a.type=b));else if(b instanceof Y)a instanceof W||A("A GraphObject can only be added to a Panel, not to: "+
a),a.add(b);else if(b instanceof Kj){var d;b.isRow&&"function"===typeof a.getRowDefinition?d=a.getRowDefinition(b.index):b.isRow||"function"!==typeof a.getColumnDefinition||(d=a.getColumnDefinition(b.index));d instanceof Kj?d.Pl(b):A("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+a)}else if(b instanceof D)"function"===typeof a.hb&&a.hb(b);else if(b instanceof vl)a.type=b;else if(b instanceof Ai)a instanceof Y?a.bind(b):a instanceof
Kj?a.bind(b):A("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof Xe)a instanceof ge?a.figures.add(b):A("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof Ye)a instanceof Xe?a.segments.add(b):A("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof ui)a instanceof P?a.layout=b:a instanceof kg?a.layout=b:A("A Layout can only be assigned to a Diagram or a Group, not to: "+a);else if(Array.isArray(b))for(c=
0;c<b.length;c++)tl(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof bl){c=new yb;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);qj(a,c)}else if(a instanceof Kj){void 0!==b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&A("Must specify non-negative integer row for RowColumnDefinition "+b+", not: "+e),a.isRow=!0,a.index=e):void 0!==b.column&&(e=b.column,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&A("Must specify non-negative integer column for RowColumnDefinition "+
b+", not: "+e),a.isRow=!1,a.index=e);e=new yb;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);qj(a,e)}else qj(a,b);else A('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function wl(a,b){sl.add(a,b)}function xl(a,b,c){void 0===c&&(c=null);var d=a[1];if("function"===typeof c?c(d):"string"===typeof d)return a.splice(1,1),d;if(void 0===b)throw Error("no "+("function"===typeof c?"satisfactory":"string")+" argument for GraphObject builder "+a[0]);return b}
pa.Object.defineProperties(Y.prototype,{shadowVisible:{get:function(){return this.tl},set:function(a){var b=this.tl;b!==a&&(this.tl=a,this.R(),this.g("shadowVisible",b,a))}},enabledChanged:{get:function(){return null!==this.O?this.O.vn:null},set:function(a){Kk(this);var b=this.O.vn;b!==a&&(this.O.vn=a,this.g("enabledChanged",b,a))}},segmentOrientation:{get:function(){return this.rl},set:function(a){var b=this.rl;
b!==a&&(this.rl=a,this.o(),this.g("segmentOrientation",b,a),a===Qg&&(this.angle=0))}},segmentIndex:{get:function(){return this.ap},set:function(a){a=Math.round(a);var b=this.ap;b!==a&&(this.ap=a,this.o(),this.g("segmentIndex",b,a))}},segmentFraction:{get:function(){return this.pl},set:function(a){isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.pl;b!==a&&(this.pl=a,this.o(),this.g("segmentFraction",b,a))}},segmentOffset:{
get:function(){return this.ql},set:function(a){var b=this.ql;b.A(a)||(this.ql=a=a.I(),this.o(),this.g("segmentOffset",b,a))}},stretch:{get:function(){return this.se},set:function(a){var b=this.se;b!==a&&(this.se=a,this.o(),this.g("stretch",b,a))}},name:{get:function(){return this.Ta},set:function(a){var b=this.Ta;b!==a&&(this.Ta=a,null!==this.part&&(this.part.nj=null),this.g("name",b,a))}},opacity:{get:function(){return this.mb},
set:function(a){var b=this.mb;b!==a&&((0>a||1<a)&&xa(a,"0 <= value <= 1",Y,"opacity"),this.mb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.R(tj(b,b.actualBounds)))}},visible:{get:function(){return 0!==(this.G&1)},set:function(a){var b=0!==(this.G&1);b!==a&&(this.G^=1,this.g("visible",b,a),b=this.panel,null!==b?b.o():this.pg()&&this.Mb(a),this.R(),pl(this))}},pickable:{get:function(){return 0!==(this.G&2)},set:function(a){var b=
0!==(this.G&2);b!==a&&(this.G^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{get:function(){return 0!==(this.G&4)},set:function(a){var b=0!==(this.G&4);b!==a&&(this.G^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{get:function(){return 0!==(this.G&8)},set:function(a){var b=0!==(this.G&8);b!==a&&(this.G^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{get:function(){return 0!==
(this.G&16)},set:function(a){var b=0!==(this.G&16);b!==a&&(this.G^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{get:function(){return 0!==(this.G&32)},set:function(a){var b=0!==(this.G&32);b!==a&&(this.G^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{get:function(){return 0!==(this.G&64)},set:function(a){var b=0!==(this.G&64);b!==a&&(this.G^=64,this.o(),this.g("isPanelMain",b,a))}},isActionable:{
get:function(){return 0!==(this.G&128)},set:function(a){var b=0!==(this.G&128);b!==a&&(this.G^=128,this.g("isActionable",b,a))}},areaBackground:{get:function(){return this.fc},set:function(a){var b=this.fc;b!==a&&(a instanceof bl&&a.freeze(),this.fc=a,this.R(),this.g("areaBackground",b,a))}},background:{get:function(){return this.jb},set:function(a){var b=this.jb;b!==a&&(a instanceof bl&&a.freeze(),this.jb=a,this.R(),this.g("background",
b,a))}},part:{get:function(){if(this.pg())return this;if(null!==this.sj)return this.sj;var a;for(a=this.panel;a;){if(a instanceof T)return this.sj=a;a=a.panel}return null}},panel:{get:function(){return this.Yf}},layer:{get:function(){var a=this.part;return null!==a?a.layer:null}},diagram:{get:function(){var a=this.part;return null!==a?a.diagram:null}},position:{
get:function(){return this.sa},set:function(a){var b=a.x,c=a.y,d=this.sa,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.Fv():(a=a.I(),this.Ev(a,d)&&this.g("position",d,a))}},actualBounds:{get:function(){return this.wb}},scale:{get:function(){return this.Ca},set:function(a){var b=this.Ca;b!==a&&(0>=a&&A("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.Ca=a,this.o(),this.g("scale",b,a))}},
angle:{get:function(){return this.Bc},set:function(a){var b=this.Bc;b!==a&&(a%=360,0>a&&(a+=360),b!==a&&(this.Bc=a,pl(this),this.o(),this.g("angle",b,a)))}},desiredSize:{get:function(){return this.Nc},set:function(a){var b=a.width,c=a.height,d=this.Nc,e=d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Nc=a=a.I(),this.o(),this instanceof V&&this.bc(),this.g("desiredSize",d,a),Nk(this)&&(a=this.part,null!==
a&&(Ok(this,a,"width"),Ok(this,a,"height"))))}},width:{get:function(){return this.Nc.width},set:function(a){var b=this.Nc.width;b===a||isNaN(b)&&isNaN(a)||(b=this.Nc,this.Nc=a=(new L(a,this.Nc.height)).freeze(),this.o(),this instanceof V&&this.bc(),this.g("desiredSize",b,a),Nk(this)&&(a=this.part,null!==a&&Ok(this,a,"width")))}},height:{get:function(){return this.Nc.height},set:function(a){var b=this.Nc.height;b===a||isNaN(b)&&isNaN(a)||
(b=this.Nc,this.Nc=a=(new L(this.Nc.width,a)).freeze(),this.o(),this instanceof V&&this.bc(),this.g("desiredSize",b,a),Nk(this)&&(a=this.part,null!==a&&Ok(this,a,"height")))}},minSize:{get:function(){return this.Nf},set:function(a){var b=this.Nf;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=0),a.freeze(),this.Nf=a,this.o(),this.g("minSize",b,a))}},maxSize:{get:function(){return this.Mf},set:function(a){var b=
this.Mf;b.A(a)||(a=a.copy(),isNaN(a.width)&&(a.width=Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.Mf=a,this.o(),this.g("maxSize",b,a))}},measuredBounds:{get:function(){return this.sc}},naturalBounds:{get:function(){return this.jc}},margin:{get:function(){return this.Qg},set:function(a){"number"===typeof a&&(a=new Lc(a));var b=this.Qg;b.A(a)||(this.Qg=a=a.I(),this.o(),this.g("margin",b,a))}},
transform:{get:function(){0!==(this.G&2048)===!0&&Zk(this);return this.ub}},td:{get:function(){0!==(this.G&4096)===!0&&Zk(this);return this.xh}},alignment:{get:function(){return this.xb},set:function(a){var b=this.xb;b.A(a)||(a.mc()&&!a.Lb()&&A("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.xb=a=a.I(),kl(this),this.g("alignment",b,a))}},column:{
get:function(){return this.zg},set:function(a){a=Math.round(a);var b=this.zg;b!==a&&(0>a&&xa(a,">= 0",Y,"column"),this.zg=a,this.o(),this.g("column",b,a))}},columnSpan:{get:function(){return this.Tm},set:function(a){a=Math.round(a);var b=this.Tm;b!==a&&(1>a&&xa(a,">= 1",Y,"columnSpan"),this.Tm=a,this.o(),this.g("columnSpan",b,a))}},row:{get:function(){return this.Wo},set:function(a){a=Math.round(a);var b=this.Wo;b!==a&&(0>a&&xa(a,">= 0",
Y,"row"),this.Wo=a,this.o(),this.g("row",b,a))}},rowSpan:{get:function(){return this.Xo},set:function(a){a=Math.round(a);var b=this.Xo;b!==a&&(1>a&&xa(a,">= 1",Y,"rowSpan"),this.Xo=a,this.o(),this.g("rowSpan",b,a))}},spanAllocation:{get:function(){return this.mp},set:function(a){var b=this.mp;b!==a&&(this.mp=a,this.o(),this.g("spanAllocation",b,a))}},alignmentFocus:{get:function(){return this.qk},set:function(a){var b=
this.qk;b.A(a)||(this.qk=a=a.I(),this.o(),this.g("alignmentFocus",b,a))}},portId:{get:function(){return this.Io},set:function(a){var b=this.Io;if(b!==a){var c=this.part;null===c||c instanceof U||(A("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&yl(c,this);this.Io=a;null!==a&&null!==c&&(c.rh=!0,zl(c,this));this.g("portId",b,a)}}},toSpot:{get:function(){return null!==this.P?this.P.fh:bd},set:function(a){this.Ic();var b=this.P.fh;
b.A(a)||(a=a.I(),this.P.fh=a,this.g("toSpot",b,a),ol(this))}},toEndSegmentLength:{get:function(){return null!==this.P?this.P.dh:10},set:function(a){this.Ic();var b=this.P.dh;b!==a&&(0>a&&xa(a,">= 0",Y,"toEndSegmentLength"),this.P.dh=a,this.g("toEndSegmentLength",b,a),ol(this))}},toShortLength:{get:function(){return null!==this.P?this.P.eh:0},set:function(a){this.Ic();var b=this.P.eh;b!==a&&(this.P.eh=a,this.g("toShortLength",b,a),ol(this))}},
toLinkable:{get:function(){return null!==this.P?this.P.tp:null},set:function(a){this.Ic();var b=this.P.tp;b!==a&&(this.P.tp=a,this.g("toLinkable",b,a))}},toMaxLinks:{get:function(){return null!==this.P?this.P.vp:Infinity},set:function(a){this.Ic();var b=this.P.vp;b!==a&&(0>a&&xa(a,">= 0",Y,"toMaxLinks"),this.P.vp=a,this.g("toMaxLinks",b,a))}},fromSpot:{get:function(){return null!==this.P?this.P.Ig:bd},set:function(a){this.Ic();
var b=this.P.Ig;b.A(a)||(a=a.I(),this.P.Ig=a,this.g("fromSpot",b,a),ol(this))}},fromEndSegmentLength:{get:function(){return null!==this.P?this.P.Gg:10},set:function(a){this.Ic();var b=this.P.Gg;b!==a&&(0>a&&xa(a,">= 0",Y,"fromEndSegmentLength"),this.P.Gg=a,this.g("fromEndSegmentLength",b,a),ol(this))}},fromShortLength:{get:function(){return null!==this.P?this.P.Hg:0},set:function(a){this.Ic();var b=this.P.Hg;b!==a&&(this.P.Hg=a,this.g("fromShortLength",
b,a),ol(this))}},fromLinkable:{get:function(){return null!==this.P?this.P.xn:null},set:function(a){this.Ic();var b=this.P.xn;b!==a&&(this.P.xn=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{get:function(){return null!==this.P?this.P.yn:Infinity},set:function(a){this.Ic();var b=this.P.yn;b!==a&&(0>a&&xa(a,">= 0",Y,"fromMaxLinks"),this.P.yn=a,this.g("fromMaxLinks",b,a))}},cursor:{get:function(){return this.cn},
set:function(a){var b=this.cn;b!==a&&(this.cn=a,this.g("cursor",b,a))}},click:{get:function(){return null!==this.O?this.O.xf:null},set:function(a){Kk(this);var b=this.O.xf;b!==a&&(this.O.xf=a,this.g("click",b,a))}},doubleClick:{get:function(){return null!==this.O?this.O.Cf:null},set:function(a){Kk(this);var b=this.O.Cf;b!==a&&(this.O.Cf=a,this.g("doubleClick",b,a))}},contextClick:{get:function(){return null!==
this.O?this.O.yf:null},set:function(a){Kk(this);var b=this.O.yf;b!==a&&(this.O.yf=a,this.g("contextClick",b,a))}},mouseEnter:{get:function(){return null!==this.O?this.O.Pf:null},set:function(a){Kk(this);var b=this.O.Pf;b!==a&&(this.O.Pf=a,this.g("mouseEnter",b,a))}},mouseLeave:{get:function(){return null!==this.O?this.O.Sf:null},set:function(a){Kk(this);var b=this.O.Sf;b!==a&&(this.O.Sf=a,this.g("mouseLeave",b,a))}},mouseOver:{
get:function(){return null!==this.O?this.O.Tf:null},set:function(a){Kk(this);var b=this.O.Tf;b!==a&&(this.O.Tf=a,this.g("mouseOver",b,a))}},mouseHover:{get:function(){return null!==this.O?this.O.Rf:null},set:function(a){Kk(this);var b=this.O.Rf;b!==a&&(this.O.Rf=a,this.g("mouseHover",b,a))}},mouseHold:{get:function(){return null!==this.O?this.O.Qf:null},set:function(a){Kk(this);var b=this.O.Qf;b!==a&&(this.O.Qf=a,this.g("mouseHold",
b,a))}},mouseDragEnter:{get:function(){return null!==this.O?this.O.no:null},set:function(a){Kk(this);var b=this.O.no;b!==a&&(this.O.no=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{get:function(){return null!==this.O?this.O.oo:null},set:function(a){Kk(this);var b=this.O.oo;b!==a&&(this.O.oo=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{get:function(){return null!==this.O?this.O.Of:null},set:function(a){Kk(this);
var b=this.O.Of;b!==a&&(this.O.Of=a,this.g("mouseDrop",b,a))}},actionDown:{get:function(){return null!==this.O?this.O.Dm:null},set:function(a){Kk(this);var b=this.O.Dm;b!==a&&(this.O.Dm=a,this.g("actionDown",b,a))}},actionMove:{get:function(){return null!==this.O?this.O.Em:null},set:function(a){Kk(this);var b=this.O.Em;b!==a&&(this.O.Em=a,this.g("actionMove",b,a))}},actionUp:{get:function(){return null!==this.O?
this.O.Fm:null},set:function(a){Kk(this);var b=this.O.Fm;b!==a&&(this.O.Fm=a,this.g("actionUp",b,a))}},actionCancel:{get:function(){return null!==this.O?this.O.Cm:null},set:function(a){Kk(this);var b=this.O.Cm;b!==a&&(this.O.Cm=a,this.g("actionCancel",b,a))}},toolTip:{get:function(){return null!==this.O?this.O.dg:null},set:function(a){Kk(this);var b=this.O.dg;b!==a&&(this.O.dg=a,this.g("toolTip",b,a))}},contextMenu:{
get:function(){return null!==this.O?this.O.zf:null},set:function(a){Kk(this);var b=this.O.zf;b!==a&&(this.O.zf=a,this.g("contextMenu",b,a))}}});Y.prototype.setProperties=Y.prototype.Gv;Y.prototype.findTemplateBinder=Y.prototype.ph;Y.prototype.bind=Y.prototype.bind;Y.prototype.isEnabledObject=Y.prototype.og;Y.prototype.isVisibleObject=Y.prototype.pf;Y.prototype.isContainedBy=Y.prototype.ng;Y.prototype.getNearestIntersectionPoint=Y.prototype.Uc;Y.prototype.getLocalPoint=Y.prototype.Ss;
Y.prototype.getDocumentScale=Y.prototype.Be;Y.prototype.getDocumentAngle=Y.prototype.Ci;Y.prototype.getDocumentBounds=Y.prototype.Qp;Y.prototype.getDocumentPoint=Y.prototype.ma;Y.prototype.intersectsRect=Y.prototype.Jc;Y.prototype.containedInRect=Y.prototype.mh;Y.prototype.containsRect=Y.prototype.kf;Y.prototype.containsPoint=Y.prototype.ea;Y.prototype.raiseChanged=Y.prototype.g;Y.prototype.raiseChangedEvent=Y.prototype.cb;Y.prototype.addCopyProperty=Y.prototype.Lw;var sl=null;Y.className="GraphObject";
sl=new Pb;
wl("Button",function(){function a(a,b){return null!==a.diagram.Rb(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=rl(W,W.Auto,{isActionable:!0,enabledChanged:function(a,b){var c=a.bb("ButtonBorder");null!==c&&(c.fill=b?a._buttonFillNormal:a._buttonFillDisabled)},cursor:"pointer",_buttonFillNormal:"#F5F5F5",_buttonStrokeNormal:"#BDBDBD",_buttonFillOver:"#E0E0E0",_buttonStrokeOver:"#9E9E9E",_buttonFillPressed:"#BDBDBD",_buttonStrokePressed:"#9E9E9E",
_buttonFillDisabled:"#E5E5E5"},rl(V,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new O(0,0,2.76142374915397,2.761423749153969),spot2:new O(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.og()&&b instanceof W&&(a=b.bb("ButtonBorder"),a instanceof V)){var c=b._buttonFillOver;b._buttonFillNormal=a.fill;a.fill=c;c=b._buttonStrokeOver;b._buttonStrokeNormal=a.stroke;a.stroke=c}};b.mouseLeave=function(a,b){b.og()&&
b instanceof W&&(a=b.bb("ButtonBorder"),a instanceof V&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.og()&&b instanceof W&&null!==b._buttonFillPressed&&0===a.button){var c=b.bb("ButtonBorder");if(c instanceof V){a=a.diagram;var d=a.skipsUndoManager;a.skipsUndoManager=!0;var g=b._buttonFillPressed;b._buttonFillOver=c.fill;c.fill=g;g=b._buttonStrokePressed;b._buttonStrokeOver=c.stroke;c.stroke=g;a.skipsUndoManager=d}}};b.actionUp=function(b,d){if(d.og()&&
d instanceof W&&null!==d._buttonFillPressed&&0===b.button){var c=d.bb("ButtonBorder");if(c instanceof V){var f=b.diagram,g=f.skipsUndoManager;f.skipsUndoManager=!0;a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionCancel=function(b,d){if(d.og()&&d instanceof W&&null!==d._buttonFillPressed){var c=d.bb("ButtonBorder");if(c instanceof V){var f=b.diagram,g=f.skipsUndoManager;f.skipsUndoManager=!0;
a(b,d)?(c.fill=d._buttonFillOver,c.stroke=d._buttonStrokeOver):(c.fill=d._buttonFillNormal,c.stroke=d._buttonStrokeNormal);f.skipsUndoManager=g}}};b.actionMove=function(b,d){if(d.og()&&d instanceof W&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.bb("ButtonBorder"),b instanceof V))){var f=c.skipsUndoManager;c.skipsUndoManager=!0;var g=d._buttonFillPressed;b.fill!==g&&(b.fill=g);g=d._buttonStrokePressed;b.stroke!==g&&(b.stroke=
g);c.skipsUndoManager=f}}};return b});
wl("TreeExpanderButton",function(){var a=rl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},rl(V,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:mc},(new Ai("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).bq()),{visible:!1},(new Ai("visible","isTreeLeaf",function(a){return!a})).bq());a.click=function(a,c){c=c.part;c instanceof sf&&(c=c.adornedPart);if(c instanceof U){var b=c.diagram;
if(null!==b){b=b.commandHandler;if(c.isTreeExpanded){if(!b.canCollapseTree(c))return}else if(!b.canExpandTree(c))return;a.handled=!0;c.isTreeExpanded?b.collapseTree(c):b.expandTree(c)}}};return a});
wl("SubGraphExpanderButton",function(){var a=rl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},rl(V,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:mc},(new Ai("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).bq()));a.click=function(a,c){c=c.part;c instanceof sf&&(c=c.adornedPart);if(c instanceof kg){var b=c.diagram;if(null!==b){b=b.commandHandler;if(c.isSubGraphExpanded){if(!b.canCollapseSubGraph(c))return}else if(!b.canExpandSubGraph(c))return;
a.handled=!0;c.isSubGraphExpanded?b.collapseSubGraph(c):b.expandSubGraph(c)}}};return a});wl("ToolTip",function(){return rl(sf,W.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new G(0,3),shadowBlur:5},rl(V,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new O(0,0,4,6),spot2:new O(1,1,-4,-4)}))});
wl("ContextMenu",function(){return rl(sf,W.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new G(0,3),shadowBlur:5},new Ai("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});wl("ContextMenuButton",function(){var a=rl("Button");a.stretch=Ek;var b=a.bb("ButtonBorder");b instanceof V&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new O(0,0,2,3),b.spot2=new O(1,1,-2,-2));return a});
wl("PanelExpanderButton",function(a){var b=xl(a,"COLLAPSIBLE"),c=rl("Button",{_buttonExpandedFigure:"M0 0 M0 6 L4 2 8 6 M8 8",_buttonCollapsedFigure:"M0 0 M0 2 L4 6 8 2 M8 8",_buttonFillNormal:"rgba(0, 0, 0, 0)",_buttonStrokeNormal:null,_buttonFillOver:"rgba(0, 0, 0, .2)",_buttonStrokeOver:null,_buttonFillPressed:"rgba(0, 0, 0, .4)",_buttonStrokePressed:null},rl(V,{name:"ButtonIcon",strokeWidth:2},(new Ai("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).bq(b)));
a=c.bb("ButtonBorder");a instanceof V&&(a.stroke=null,a.fill="rgba(0, 0, 0, 0)");c.click=function(a,c){a=c.diagram;if(null!==a&&!a.isReadOnly){var d=c.ph();null===d&&(d=c.part);null!==d&&(c=d.bb(b),null!==c&&(a.Aa("Collapse/Expand Panel"),c.visible=!c.visible,a.ab("Collapse/Expand Panel")))}};return c});
wl("CheckBoxButton",function(a){var b=xl(a);a=rl("Button",{desiredSize:new L(14,14)},rl(V,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:ie,geometryStretch:ch,visible:!1},""!==b?(new Ai("visible",b)).ox():[]));a.click=function(a,d){if(d instanceof W){var c=a.diagram;if(!(null===c||c.isReadOnly||""!==b&&c.model.isReadOnly)){a.handled=!0;var f=d.bb("ButtonIcon");c.Aa("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a,
d);c.ab("checkbox")}}};return a});
wl("CheckBox",function(a){a=xl(a);a=rl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new Lc(0,1,0,0)});var b=rl(W,"Horizontal",a,{isActionable:!0,cursor:a.cursor,margin:1,_buttonFillNormal:a._buttonFillNormal,_buttonStrokeNormal:a._buttonStrokeNormal,_buttonFillOver:a._buttonFillOver,_buttonStrokeOver:a._buttonStrokeOver,_buttonFillPressed:a._buttonFillPressed,_buttonStrokePressed:a._buttonStrokePressed,_buttonFillDisabled:a._buttonFillDisabled,mouseEnter:a.mouseEnter,mouseLeave:a.mouseLeave,
actionDown:a.actionDown,actionUp:a.actionUp,actionCancel:a.actionCancel,actionMove:a.actionMove,click:a.click,_buttonClick:a.click});a.mouseEnter=null;a.mouseLeave=null;a.actionDown=null;a.actionUp=null;a.actionCancel=null;a.actionMove=null;a.click=null;return b});Y.None=ah=new D(Y,"None",0);Y.Default=Dk=new D(Y,"Default",0);Y.Vertical=Fk=new D(Y,"Vertical",4);Y.Horizontal=Ek=new D(Y,"Horizontal",5);Y.Fill=ie=new D(Y,"Fill",3);Y.Uniform=ch=new D(Y,"Uniform",1);
Y.UniformToFill=Gk=new D(Y,"UniformToFill",2);Y.FlipVertical=Hk=new D(Y,"FlipVertical",1);Y.FlipHorizontal=Ik=new D(Y,"FlipHorizontal",2);Y.FlipBoth=Jk=new D(Y,"FlipBoth",3);Y.make=rl;Y.getBuilders=function(){var a=new Pb,b;for(b in sl)if(b!==b.toLowerCase()){var c=sl.J(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};Y.defineBuilder=wl;Y.takeBuilderArgument=xl;
function Lk(){this.vn=this.zf=this.dg=this.Cm=this.Fm=this.Em=this.Dm=this.Of=this.oo=this.no=this.Qf=this.Rf=this.Tf=this.Sf=this.Pf=this.yf=this.Cf=this.xf=null}Lk.prototype.copy=function(){var a=new Lk;a.xf=this.xf;a.Cf=this.Cf;a.yf=this.yf;a.Pf=this.Pf;a.Sf=this.Sf;a.Tf=this.Tf;a.Rf=this.Rf;a.Qf=this.Qf;a.no=this.no;a.oo=this.oo;a.Of=this.Of;a.Dm=this.Dm;a.Em=this.Em;a.Fm=this.Fm;a.Cm=this.Cm;a.dg=this.dg;a.zf=this.zf;a.vn=this.vn;return a};Lk.className="GraphObjectEventHandlers";
function Al(){this.Na=[1,0,0,1,0,0]}Al.prototype.copy=function(){var a=new Al;a.Na[0]=this.Na[0];a.Na[1]=this.Na[1];a.Na[2]=this.Na[2];a.Na[3]=this.Na[3];a.Na[4]=this.Na[4];a.Na[5]=this.Na[5];return a};Al.prototype.translate=function(a,b){this.Na[4]+=this.Na[0]*a+this.Na[2]*b;this.Na[5]+=this.Na[1]*a+this.Na[3]*b};Al.prototype.scale=function(a,b){this.Na[0]*=a;this.Na[1]*=a;this.Na[2]*=b;this.Na[3]*=b};Al.className="STransform";
function Bl(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.Tw=[];this.pattern=null}Bl.prototype.addColorStop=function(a,b){this.Tw.push({offset:a,color:b})};Bl.className="SGradient";function Cl(a,b){this.ownerDocument=void 0===b?w.document:b;this.qx="http://www.w3.org/2000/svg";this.Ka=null}t=Cl.prototype;
t.Zu=function(a,b){this.Ka=this.vb("svg",{width:a+"px",height:b+"px",viewBox:"0 0 "+a+" "+b});this.Ka.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns",this.qx);this.Ka.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink");this.context=new Dl(this)};t.vb=function(a,b,c){a=this.ownerDocument.createElementNS(this.qx,a);if(Aa(b))for(var d in b)a.setAttributeNS("href"===d?"http://www.w3.org/1999/xlink":"",d,b[d]);void 0!==c&&(a.textContent=c);return a};
t.getBoundingClientRect=function(){return this.Ka.getBoundingClientRect()};t.focus=function(){this.Ka.focus()};t.Zw=function(){this.ownerDocument=null};pa.Object.defineProperties(Cl.prototype,{width:{get:function(){return this.Ka.width.baseVal.value},set:function(a){this.Ka.width=a}},height:{get:function(){return this.Ka.height.baseVal.value},set:function(a){this.Ka.height=a}},style:{get:function(){return this.Ka.style}}});
Cl.className="SVGSurface";
function Dl(a){this.kk=a;this.mq=a.Ka;this.stack=[];this.yc=[];this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.lineDashOffset=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.Od=this.ip=this.hp=0;this.Wp=null;this.path=[];this.ze=new Al;El(this,1,0,0,1,0,0);var b=Jb++,
c=this.vb("clipPath",{id:"mainClip"+b});c.appendChild(this.vb("rect",{x:0,y:0,width:a.width,height:a.height}));this.kk.Ka.appendChild(c);this.yc[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")")}t=Dl.prototype;
t.reset=function(){this.stack=[];this.yc=[];this.fillStyle="#000000";this.font="10px sans-serif";this.globalAlpha=1;this.lineCap="butt";this.lineDashOffset=0;this.lineJoin="miter";this.lineWidth=1;this.miterLimit=10;this.shadowBlur=0;this.shadowColor="rgba(0, 0, 0, 0)";this.shadowOffsetY=this.shadowOffsetX=0;this.strokeStyle="#000000";this.textAlign="start";this.clipInsteadOfFill=!1;this.Od=this.ip=this.hp=0;this.Wp=null;this.path=[];this.ze=new Al;El(this,1,0,0,1,0,0);var a=Jb++,b=this.vb("clipPath",
{id:"mainClip"+a});b.appendChild(this.vb("rect",{x:0,y:0,width:this.kk.width,height:this.kk.height}));this.kk.Ka.appendChild(b);this.yc[0].setAttributeNS(null,"clip-path","url(#mainClip"+a+")")};
t.arc=function(a,b,c,d,e,f,g,h){var k=2*Math.PI,l=k-1E-6,m=c*Math.cos(d),n=c*Math.sin(d),p=a+m,q=b+n,r=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-q))&&this.path.push(["L",p,+q]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,r,a-m,b-n]),this.path.push(["A",c,c,0,1,r,p,q])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),r,a+c*Math.cos(e),b+c*Math.sin(e)])};t.beginPath=function(){this.path=[]};t.bezierCurveTo=function(a,b,c,d,e,f){this.path.push(["C",a,b,c,d,e,f])};t.clearRect=function(){};
t.clip=function(){this.addPath("clipPath",this.path,new Al)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new Bl("linear");e.x1=a;e.y1=b;e.x2=c;e.y2=d;return e};t.createPattern=function(){return null};t.createRadialGradient=function(a,b,c,d,e,f){var g=new Bl("radial");g.x1=a;g.y1=b;g.r1=c;g.x2=d;g.y2=e;g.r2=f;return g};
t.drawImage=function(a,b,c,d,e,f,g,h,k){var l="";a instanceof HTMLCanvasElement&&(l=a.toDataURL());a instanceof HTMLImageElement&&(l=a.src);var m=a instanceof HTMLImageElement?a.naturalWidth:a.width,n=a instanceof HTMLImageElement?a.naturalHeight:a.height;void 0===d&&(f=b,g=c,h=d=m,k=e=n);d=d||0;e=e||0;f=f||0;g=g||0;h=h||0;k=k||0;l={x:0,y:0,width:m,height:n,href:l,preserveAspectRatio:"xMidYMid slice"};H.ba(d,h)&&H.ba(e,k)||(l.preserveAspectRatio="none");a="";h/=d;k/=e;if(0!==f||0!==g)a+=" translate("+
f+", "+g+")";if(1!==h||1!==k)a+=" scale("+h+", "+k+")";if(0!==b||0!==c)a+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+Jb++,g=this.vb("clipPath",{id:f}),g.appendChild(this.vb("rect",{x:b,y:c,width:d,height:e})),this.mq.appendChild(g),l["clip-path"]="url(#"+f+")";Fl(this,"image",l,this.ze,a);this.addElement("image",l)};t.fill=function(){this.addPath("fill",this.path,this.ze)};t.Sd=function(){this.clipInsteadOfFill?this.clip():this.fill()};
t.fillRect=function(a,b,c,d){a=[a,b,c,d];a={x:a[0],y:a[1],width:a[2],height:a[3]};Fl(this,"fill",a,this.ze);this.addElement("rect",a)};t.fillText=function(a,b,c){a=[a,b,c];b=this.textAlign;"left"===b?b="start":"right"===b?b="end":"center"===b&&(b="middle");b={x:a[1],y:a[2],style:"font: "+this.font,"text-anchor":b};Fl(this,"fill",b,this.ze);this.addElement("text",b,a[0])};t.lineTo=function(a,b){this.path.push(["L",a,b])};t.moveTo=function(a,b){this.path.push(["M",a,b])};
t.quadraticCurveTo=function(a,b,c,d){this.path.push(["Q",a,b,c,d])};t.rect=function(a,b,c,d){this.path.push(["M",a,b],["L",a+c,b],["L",a+c,b+d],["L",a,b+d],["z"])};
t.restore=function(){this.ze=this.stack.pop();this.path=this.stack.pop();var a=this.stack.pop();this.fillStyle=a.fillStyle;this.font=a.font;this.globalAlpha=a.globalAlpha;this.lineCap=a.lineCap;this.lineDashOffset=a.lineDashOffset;this.lineJoin=a.lineJoin;this.lineWidth=a.lineWidth;this.miterLimit=a.miterLimit;this.shadowBlur=a.shadowBlur;this.shadowColor=a.shadowColor;this.shadowOffsetX=a.shadowOffsetX;this.shadowOffsetY=a.shadowOffsetY;this.strokeStyle=a.strokeStyle;this.textAlign=a.textAlign};
t.save=function(){this.stack.push({fillStyle:this.fillStyle,font:this.font,globalAlpha:this.globalAlpha,lineCap:this.lineCap,lineDashOffset:this.lineDashOffset,lineJoin:this.lineJoin,lineWidth:this.lineWidth,miterLimit:this.miterLimit,shadowBlur:this.shadowBlur,shadowColor:this.shadowColor,shadowOffsetX:this.shadowOffsetX,shadowOffsetY:this.shadowOffsetY,strokeStyle:this.strokeStyle,textAlign:this.textAlign});for(var a=[],b=0;b<this.path.length;b++)a.push(this.path[b]);this.stack.push(a);this.stack.push(this.ze.copy())};
t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||El(this,a,b,c,d,e,f)};t.scale=function(a,b){this.ze.scale(a,b)};t.translate=function(a,b){this.ze.translate(a,b)};t.transform=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.ze)};t.Ni=function(){this.clipInsteadOfFill||this.stroke()};t.vb=function(a,b,c){return this.kk.vb(a,b,c)};
t.addElement=function(a,b,c){a=this.vb(a,b,c);0<this.yc.length?this.yc[this.yc.length-1].appendChild(a):this.mq.appendChild(a);return this.Wp=a};
function Fl(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof Bl?c.fill=Gl(a,a.fillStyle):(/^rgba\(/.test(a.fillStyle)&&(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+b[1]+","+b[2]+","+b[3]+")",c["fill-opacity"]=b[4]),c.fill=a.fillStyle),c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof Bl?c.stroke=Gl(a,a.strokeStyle):(/^rgba\(/.test(a.strokeStyle)&&(b=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.strokeStyle),
c.stroke="rgb("+b[1]+","+b[2]+","+b[3]+")",c["stroke-opacity"]=b[4]),c.stroke=a.strokeStyle),c["stroke-width"]=a.lineWidth,c["stroke-linecap"]=a.lineCap,c["stroke-linejoin"]=a.lineJoin,c["stroke-miterlimit"]=a.miterLimit);a=d.Na;a="matrix("+a[0]+", "+a[1]+", "+a[2]+", "+a[3]+", "+a[4]+", "+a[5]+")";void 0!==e&&(a+=e);c.transform=a}
function Gl(a,b){var c="GRAD"+Jb++;if("linear"===b.type)var d=a.vb("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.vb("radialGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,r1:b.r1,r2:b.r2,id:c});else if("pattern"===b.type){var e=b.pattern;d={width:e.width,height:e.height,id:c,patternUnits:"userSpaceOnUse"};var f="";e instanceof HTMLCanvasElement&&(f=e.toDataURL());e instanceof HTMLImageElement&&(f=e.src);e={x:0,y:0,width:e.width,height:e.height,
href:f};d=a.vb("pattern",d);d.appendChild(a.vb("image",e))}else throw Error("invalid gradient");f=b.Tw;b=f.length;e=[];for(var g=0;g<b;g++){var h=f[g],k=h.color;h={offset:h.offset,"stop-color":k};/^rgba\(/.test(k)&&(k=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(k),h["stop-color"]="rgb("+k[1]+","+k[2]+","+k[3]+")",h["stop-opacity"]=k[4]);e.push(h)}e.sort(function(a,b){return a.offset>b.offset?1:-1});for(f=0;f<b;f++)d.appendChild(a.vb("stop",e[f]));a.mq.appendChild(d);
return"url(#"+c+")"}
t.addPath=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=Fa(b[e]),g=[f.shift()];if("A"===g[0])g.push(f.shift()+","+f.shift(),f.shift(),f.shift()+","+f.shift(),f.shift()+","+f.shift());else for(;f.length;)g.push(f.shift()+","+f.shift());d.push(g.join(" "))}b={d:d.join(" ")};Fl(this,a,b,c);"clipPath"===a?(a="CLIP"+Jb++,c=this.vb("clipPath",{id:a}),c.appendChild(this.vb("path",b)),this.mq.appendChild(c),0<this.yc.length&&this.yc[this.yc.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):
this.addElement("path",b)};function El(a,b,c,d,e,f,g){var h=new Al;h.Na=[b,c,d,e,f,g];b={};Fl(a,"g",b,h);h=a.addElement("g",b);a.yc.push(h)}
t.lq=function(){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var a="SHADOW"+Jb++,b=this.addElement("filter",{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},null);var c=this.vb("feGaussianBlur",{"in":"SourceAlpha",result:"blur",Yz:this.shadowBlur/2});var d=this.vb("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor});var e=this.vb("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});var f=this.vb("feOffset",{"in":"comp",result:"offsetBlur",
dx:this.shadowOffsetX,dy:this.shadowOffsetY});var g=this.vb("feMerge",{});g.appendChild(this.vb("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.vb("feMergeNode",{"in":"SourceGraphic"}));b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);b.appendChild(g);0<this.yc.length&&this.yc[this.yc.length-1].setAttributeNS(null,"filter","url(#"+a+")")}};t.Hv=function(a,b,c){this.hp=a;this.ip=b;this.Od=c};function al(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}
function $k(a){a.shadowOffsetX=a.hp;a.shadowOffsetY=a.ip;a.shadowBlur=a.Od}t.Ls=function(){};t.Is=function(){};t.Sc=function(){};t.rt=function(){};Dl.prototype.rotate=function(){};Dl.prototype.getImageData=function(){return null};Dl.prototype.measureText=function(){return null};Dl.className="SVGContext";P.prototype.et=function(a){void 0===a&&(a=new yb);a.context="svg";a=nk(this,a);return null!==a?a.mq:null};P.prototype.makeSvg=P.prototype.et;P.prototype.gv=function(a){return this.et(a)};
P.prototype.makeSVG=P.prototype.gv;
Y.prototype.$w=function(a,b){if(!(a instanceof Dl))return!1;if(!this.visible)return!0;var c=null,d=a.Wp;if(this instanceof W&&(this.type===W.TableRow||this.type===W.TableColumn))return Yk(this,a,b),!0;var e=this.wb;if(0===e.width||0===e.height||isNaN(e.x)||isNaN(e.y))return!0;var f=this.transform,g=this.panel;0!==(this.G&4096)===!0&&Zk(this);var h=0!==(this.G&256),k=!1;this instanceof th&&(a.font=this.font);if(h){k=g.Yd()?g.naturalBounds:g.actualBounds;if(null!==this.md){var l=this.md;var m=l.x;var n=
l.y;var p=l.width;l=l.height}else m=Math.max(e.x,k.x),n=Math.max(e.y,k.y),p=Math.min(e.right,k.right)-m,l=Math.min(e.bottom,k.bottom)-n;if(m>e.width+e.x||e.x>k.width+k.x||n>e.height+e.y||e.y>k.height+k.y)return!0;k=!0;El(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.pg()&&!this.isVisible())return!0;a.ze.Na=[1,0,0,1,0,0];this instanceof th&&1<this.lineCount&&El(a,1,0,0,1,0,0);m=!1;this.pg()&&this.isShadowed&&b.Ce("drawShadows")&&(n=this.ni,a.Hv(n.x*b.scale*b.$b,n.y*b.scale*
b.$b,this.Od),$k(a),a.shadowColor=this.zj);n=!1;this.part&&b.Ce("drawShadows")&&(n=this.part.isShadowed);!0===this.shadowVisible?($k(a),!1===m&&n&&(El(a,1,0,0,1,0,0),a.lq(),m=!0)):!1===this.shadowVisible&&al(a);p=this.naturalBounds;null!==this.areaBackground&&(fi(this,a,this.areaBackground,!0,!0,p,e),!1===m&&n&&(El(a,1,0,0,1,0,0),a.lq(),m=!0),this.areaBackground instanceof bl&&this.areaBackground.type===cl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.Sd(this.areaBackground)):a.fillRect(e.x,e.y,
e.width,e.height));this instanceof W?El(a,f.m11,f.m12,f.m21,f.m22,f.dx,f.dy):a.ze.Na=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy];if(null!==this.background){!1===m&&n&&(El(a,1,0,0,1,0,0),a.lq(),m=!0);var q=this.naturalBounds;l=f=0;var r=q.width;q=q.height;var u=0;this instanceof V&&(q=this.geometry.bounds,f=q.x,l=q.y,r=q.width,q=q.height,u=this.strokeWidth);fi(this,a,this.background,!0,!1,p,e);this.background instanceof bl&&this.background.type===cl?(a.beginPath(),a.rect(f-u/2,l-u/2,r+u,q+u),a.Sd(this.background)):
a.fillRect(f-u/2,l-u/2,r+u,q+u)}n&&(null!==this.background||null!==this.areaBackground||null!==g&&0!==(g.G&512)||null!==g&&(g.type===W.Auto||g.type===W.Spot)&&g.Ab()!==this)?(dl(this,!0),null===this.shadowVisible&&al(a)):dl(this,!1);this.xi(a,b);n&&0!==(this.G&512)===!0&&$k(a);this.pg()&&n&&al(a);h&&(a.restore(),k&&a.yc.pop());this instanceof W&&(c=a.yc.pop());!0===m&&a.yc.pop();this instanceof th&&1<this.lineCount&&(c=a.yc.pop());null!==a.kk.Ks&&(null===c&&(d===a.Wp?(El(a,1,0,0,1,0,0),c=a.yc.pop()):
c=a.Wp),a.kk.Ks(this,c));return!0};function ok(a,b){this.ownerDocument=b=void 0===b?w.document:b;this.Ks=null;b=b.createElement("canvas");b.tabIndex=0;this.Ka=b;this.context=new fl(b);b.F=a}t=ok.prototype;t.Zu=function(){};t.toDataURL=function(a,b){return this.Ka.toDataURL(a,b)};t.getBoundingClientRect=function(){return this.Ka.getBoundingClientRect()};t.focus=function(){this.Ka.focus()};t.Zw=function(){this.ownerDocument=this.Ka.F=null};
pa.Object.defineProperties(ok.prototype,{width:{get:function(){return this.Ka.width},set:function(a){this.Ka.width=a}},height:{get:function(){return this.Ka.height},set:function(a){this.Ka.height=a}},style:{get:function(){return this.Ka.style}}});ok.className="CanvasSurface";
function fl(a){a.getContext&&a.getContext("2d")||A("Browser does not support HTML Canvas Element");this.V=a.getContext("2d");this.Et=this.Gt=this.Ft="";this.Sm=!1;this.Od=this.ip=this.hp=0}t=fl.prototype;t.rt=function(a){this.V.imageSmoothingEnabled=a};t.arc=function(a,b,c,d,e,f){this.V.arc(a,b,c,d,e,f)};t.beginPath=function(){this.V.beginPath()};t.bezierCurveTo=function(a,b,c,d,e,f){this.V.bezierCurveTo(a,b,c,d,e,f)};t.clearRect=function(a,b,c,d){this.V.clearRect(a,b,c,d)};t.clip=function(){this.V.clip()};
t.closePath=function(){this.V.closePath()};t.createLinearGradient=function(a,b,c,d){return this.V.createLinearGradient(a,b,c,d)};t.createPattern=function(a,b){return this.V.createPattern(a,b)};t.createRadialGradient=function(a,b,c,d,e,f){return this.V.createRadialGradient(a,b,c,d,e,f)};t.drawImage=function(a,b,c,d,e,f,g,h,k){void 0===d?this.V.drawImage(a,b,c):this.V.drawImage(a,b,c,d,e,f,g,h,k)};t.fill=function(){this.V.fill()};t.fillRect=function(a,b,c,d){this.V.fillRect(a,b,c,d)};
t.fillText=function(a,b,c){this.V.fillText(a,b,c)};t.getImageData=function(a,b,c,d){return this.V.getImageData(a,b,c,d)};t.lineTo=function(a,b){this.V.lineTo(a,b)};t.measureText=function(a){return this.V.measureText(a)};t.moveTo=function(a,b){this.V.moveTo(a,b)};t.quadraticCurveTo=function(a,b,c,d){this.V.quadraticCurveTo(a,b,c,d)};t.rect=function(a,b,c,d){this.V.rect(a,b,c,d)};t.restore=function(){this.V.restore()};fl.prototype.rotate=function(a){this.V.rotate(a)};t=fl.prototype;t.save=function(){this.V.save()};
t.setTransform=function(a,b,c,d,e,f){this.V.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.V.scale(a,b)};t.stroke=function(){this.V.stroke()};t.transform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||this.V.transform(a,b,c,d,e,f)};t.translate=function(a,b){this.V.translate(a,b)};
t.Sd=function(a){if(a instanceof bl&&a.type===cl){var b=a.yk;a=a.Ht;a>b?(this.scale(b/a,1),this.translate((a-b)/2,0)):b>a&&(this.scale(1,a/b),this.translate(0,(b-a)/2));this.Sm?this.clip():this.fill();a>b?(this.translate(-(a-b)/2,0),this.scale(1/(b/a),1)):b>a&&(this.translate(0,-(b-a)/2),this.scale(1,1/(a/b)))}else this.Sm?this.clip():this.fill()};t.Ni=function(){this.Sm||this.stroke()};t.Hv=function(a,b,c){this.hp=a;this.ip=b;this.Od=c};
t.Ls=function(a,b){var c=this.V;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.Is=function(){var a=this.V;void 0!==a.setLineDash&&(a.setLineDash(Hl),a.lineDashOffset=0)};t.Sc=function(a){a&&(this.Ft="");this.Et=this.Gt=""};
pa.Object.defineProperties(fl.prototype,{fillStyle:{get:function(){return this.V.fillStyle},set:function(a){this.Et!==a&&(this.Et=this.V.fillStyle=a)}},font:{get:function(){return this.V.font},set:function(a){this.Ft!==a&&(this.Ft=this.V.font=a)}},globalAlpha:{get:function(){return this.V.globalAlpha},set:function(a){this.V.globalAlpha=a}},lineCap:{get:function(){return this.V.lineCap},
set:function(a){this.V.lineCap=a}},lineDashOffset:{get:function(){return this.V.lineDashOffset},set:function(a){this.V.lineDashOffset=a}},lineJoin:{get:function(){return this.V.lineJoin},set:function(a){this.V.lineJoin=a}},lineWidth:{get:function(){return this.V.lineWidth},set:function(a){this.V.lineWidth=a}},miterLimit:{get:function(){return this.V.miterLimit},set:function(a){this.V.miterLimit=
a}},shadowBlur:{get:function(){return this.V.shadowBlur},set:function(a){this.V.shadowBlur=a}},shadowColor:{get:function(){return this.V.shadowColor},set:function(a){this.V.shadowColor=a}},shadowOffsetX:{get:function(){return this.V.shadowOffsetX},set:function(a){this.V.shadowOffsetX=a}},shadowOffsetY:{get:function(){return this.V.shadowOffsetY},set:function(a){this.V.shadowOffsetY=
a}},strokeStyle:{get:function(){return this.V.strokeStyle},set:function(a){this.Gt!==a&&(this.Gt=this.V.strokeStyle=a)}},textAlign:{get:function(){return this.V.textAlign},set:function(a){this.V.textAlign=a}},imageSmoothingEnabled:{get:function(){return this.V.imageSmoothingEnabled},set:function(a){this.V.imageSmoothingEnabled=a}},clipInsteadOfFill:{get:function(){return this.Sm},
set:function(a){this.Sm=a}}});var Hl=Object.freeze([]);fl.className="CanvasSurfaceContext";function Il(){this.da=this.u=this.K=this.l=0}Il.className="ColorNumbers";function bl(a){Jl||(Kl(),Jl=!0);tb(this);this.v=!1;void 0===a?(this.va=el,this.xk="black"):"string"===typeof a?(this.va=el,this.xk=a):(this.va=a,this.xk="black");a=this.va;a===hl?(this.xl=dd,this.Lk=od):this.Lk=a===cl?this.xl=gd:this.xl=bd;this.ts=0;this.cr=NaN;this.ae=this.Yr=this.$d=null;this.Ht=this.yk=0}
bl.prototype.copy=function(){var a=new bl;a.va=this.va;a.xk=this.xk;a.xl=this.xl.I();a.Lk=this.Lk.I();a.ts=this.ts;a.cr=this.cr;null!==this.$d&&(a.$d=this.$d.copy());a.Yr=this.Yr;return a};t=bl.prototype;t.freeze=function(){this.v=!0;null!==this.$d&&this.$d.freeze();return this};t.ha=function(){Object.isFrozen(this)&&A("cannot thaw constant: "+this);this.v=!1;null!==this.$d&&this.$d.ha();return this};t.hb=function(a){a.classType===bl&&(this.type=a)};
t.toString=function(){var a="Brush(";if(this.type===el)a+=this.color;else if(a=this.type===hl?a+"Linear ":this.type===cl?a+"Radial ":this.type===gl?a+"Pattern ":a+"(unknown) ",a+=this.start+" "+this.end,null!==this.colorStops)for(var b=this.colorStops.iterator;b.next();)a+=" "+b.key+":"+b.value;return a+")"};
t.addColorStop=function(a,b){this.v&&wa(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&xa(a,"0 <= loc <= 1",bl,"addColorStop:loc");null===this.$d&&(this.$d=new Pb);this.$d.add(a,b);this.va===el&&(this.type=hl);this.ae=null;return this};
t.qz=function(a,b){this.v&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?Ll:b;if(this.type===el)Ml(this.color),this.color=Nl(a,b);else if((this.type===hl||this.type===cl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Ml(c.value),this.addColorStop(c.key,Nl(a,b));return this};function Ol(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Ll:c;Ml(a);return Nl(b,c)}
t.sy=function(a,b){this.v&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?Ll:b;if(this.type===el)Ml(this.color),this.color=Nl(-a,b);else if((this.type===hl||this.type===cl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)Ml(c.value),this.addColorStop(c.key,Nl(-a,b));return this};function Pl(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?Ll:c;Ml(a);return Nl(-b,c)}
function Ql(a,b,c){Ml(a);a=Rl.l;var d=Rl.K,e=Rl.u,f=Rl.da;Ml(b);void 0===c&&(c=.5);return"rgba("+Math.round((Rl.l-a)*c+a)+", "+Math.round((Rl.K-d)*c+d)+", "+Math.round((Rl.u-e)*c+e)+", "+Math.round((Rl.da-f)*c+f)+")"}
t.lx=function(){if(this.type===el)return Sl(this.color);if((this.type===hl||this.type===cl)&&null!==this.colorStops){var a=this.colorStops;if(this.type===cl)return Sl(a.first().value);if(null!==a.get(.5))return Sl(a.get(.5));if(2===a.count)return a=a.Ma(),Sl(Ql(a[0].value,a[1].value));for(var b=a.iterator,c=-1,d=-1,e=1,f=1;b.next();){var g=b.key,h=Math.abs(.5-b.key);e>f&&h<e?(c=g,e=h):f>=e&&h<f&&(d=g,f=h)}c>d&&(c=[d,d=c][0]);b=d-c;return Sl(Ql(a.get(c),a.get(d),1-e/b))}return!1};
function Sl(a){if(null===a)return null;if(a instanceof bl)return a.lx();Ml(a);return 128>(299*Rl.l+587*Rl.K+114*Rl.u)/1E3}
function Nl(a,b){switch(b){case Ll:var c=100*Tl(Rl.l);b=100*Tl(Rl.K);var d=100*Tl(Rl.u);Ul.l=.4124564*c+.3575761*b+.1804375*d;Ul.K=.2126729*c+.7151522*b+.072175*d;Ul.u=.0193339*c+.119192*b+.9503041*d;Ul.da=Rl.da;c=Vl(Ul.l/Wl[0]);b=Vl(Ul.K/Wl[1]);d=Vl(Ul.u/Wl[2]);Xl.l=116*b-16;Xl.K=500*(c-b);Xl.u=200*(b-d);Xl.da=Ul.da;Xl.l=Math.min(100,Math.max(0,Xl.l+100*a));a=(Xl.l+16)/116;c=a-Xl.u/200;Ul.l=Wl[0]*Yl(Xl.K/500+a);Ul.K=Wl[1]*(Xl.l>Zl*$l?Math.pow(a,3):Xl.l/Zl);Ul.u=Wl[2]*Yl(c);Ul.da=Xl.da;a=-.969266*
Ul.l+1.8760108*Ul.K+.041556*Ul.u;c=.0556434*Ul.l+-.2040259*Ul.K+1.0572252*Ul.u;Rl.l=255*am((3.2404542*Ul.l+-1.5371385*Ul.K+-.4985314*Ul.u)/100);Rl.K=255*am(a/100);Rl.u=255*am(c/100);Rl.da=Ul.da;Rl.l=Math.round(Rl.l);255<Rl.l?Rl.l=255:0>Rl.l&&(Rl.l=0);Rl.K=Math.round(Rl.K);255<Rl.K?Rl.K=255:0>Rl.K&&(Rl.K=0);Rl.u=Math.round(Rl.u);255<Rl.u?Rl.u=255:0>Rl.u&&(Rl.u=0);return"rgba("+Rl.l+", "+Rl.K+", "+Rl.u+", "+Rl.da+")";case bm:b=Rl.l/255;d=Rl.K/255;var e=Rl.u/255,f=Math.max(b,d,e),g=Math.min(b,d,e),h=
f-g;g=(f+g)/2;if(0===h)c=b=0;else{switch(f){case b:c=(d-e)/h%6;break;case d:c=(e-b)/h+2;break;case e:c=(b-d)/h+4}c*=60;0>c&&(c+=360);b=h/(1-Math.abs(2*g-1))}cm.l=Math.round(c);cm.K=Math.round(100*b);cm.u=Math.round(100*g);cm.da=Rl.da;cm.u=Math.min(100,Math.max(0,cm.u+100*a));return"hsla("+cm.l+", "+cm.K+"%, "+cm.u+"%, "+cm.da+")";default:return A("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}
function Ml(a){Jl||(Kl(),Jl=!0);var b=dm;if(null!==b){b.clearRect(0,0,1,1);b.fillStyle="#000000";var c=b.fillStyle;b.fillStyle=a;b.fillStyle!==c?(b.fillRect(0,0,1,1),a=b.getImageData(0,0,1,1).data,Rl.l=a[0],Rl.K=a[1],Rl.u=a[2],Rl.da=a[3]/255):(b.fillStyle="#FFFFFF",b.fillStyle=a,Rl.l=0,Rl.K=0,Rl.u=0,Rl.da=1)}}function Tl(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function am(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055}
function Vl(a){return a>$l?Math.pow(a,1/3):(Zl*a+16)/116}function Yl(a){var b=a*a*a;return b>$l?b:(116*a-16)/Zl}function Kl(){dm=oh?(new ok(null)).context:null}
pa.Object.defineProperties(bl.prototype,{type:{get:function(){return this.va},set:function(a){this.v&&wa(this,a);this.va=a;this.start.mc()&&(a===hl?this.start=dd:a===cl&&(this.start=gd));this.end.mc()&&(a===hl?this.end=od:a===cl&&(this.end=gd));this.ae=null}},color:{get:function(){return this.xk},set:function(a){this.v&&wa(this,a);this.xk=a;this.ae=null}},start:{get:function(){return this.xl},set:function(a){this.v&&
wa(this,a);this.xl=a.I();this.ae=null}},end:{get:function(){return this.Lk},set:function(a){this.v&&wa(this,a);this.Lk=a.I();this.ae=null}},startRadius:{get:function(){return this.ts},set:function(a){this.v&&wa(this,a);0>a&&xa(a,">= zero",bl,"startRadius");this.ts=a;this.ae=null}},endRadius:{get:function(){return this.cr},set:function(a){this.v&&wa(this,a);0>a&&xa(a,">= zero",bl,"endRadius");this.cr=a;this.ae=
null}},colorStops:{get:function(){return this.$d},set:function(a){this.v&&wa(this,a);this.$d=a;this.ae=null}},pattern:{get:function(){return this.Yr},set:function(a){this.v&&wa(this,a);this.Yr=a;this.ae=null}}});bl.prototype.isDark=bl.prototype.lx;bl.prototype.darkenBy=bl.prototype.sy;bl.prototype.lightenBy=bl.prototype.qz;bl.prototype.addColorStop=bl.prototype.addColorStop;
var $l=216/24389,Zl=24389/27,Wl=[95.047,100,108.883],dm=null,Rl=new Il,cm=new Il,Ul=new Il,Xl=new Il,Jl=!1;bl.className="Brush";var el;bl.Solid=el=new D(bl,"Solid",0);var hl;bl.Linear=hl=new D(bl,"Linear",1);var cl;bl.Radial=cl=new D(bl,"Radial",2);var gl;bl.Pattern=gl=new D(bl,"Pattern",4);var Ll;bl.Lab=Ll=new D(bl,"Lab",5);var bm;bl.HSL=bm=new D(bl,"HSL",6);
bl.randomColor=function(a,b){void 0===a&&(a=128);void 0===b&&(b=Math.max(a,255));var c=Math.abs(b-a);b=Math.floor(a+Math.random()*c).toString(16);var d=Math.floor(a+Math.random()*c).toString(16);a=Math.floor(a+Math.random()*c).toString(16);2>b.length&&(b="0"+b);2>d.length&&(d="0"+d);2>a.length&&(a="0"+a);return"#"+b+d+a};
bl.isValidColor=function(a){if("black"===a)return!0;if(""===a)return!1;Jl||(Kl(),Jl=!0);var b=dm;if(null===b)return!0;b.fillStyle="#000000";var c=b.fillStyle;b.fillStyle=a;if(b.fillStyle!==c)return!0;b.fillStyle="#FFFFFF";c=b.fillStyle;b.fillStyle=a;return b.fillStyle!==c};bl.lighten=function(a){return Ol(a)};bl.lightenBy=Ol;bl.darken=function(a){return Pl(a)};bl.darkenBy=Pl;bl.mix=Ql;bl.isDark=Sl;function vl(){this.name="Base"}vl.prototype.measure=function(){};vl.prototype.arrange=function(){};
pa.Object.defineProperties(vl.prototype,{classType:{get:function(){return W}}});vl.className="PanelLayout";function em(){this.name="Base";this.name="Position"}oa(em,vl);
em.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=fm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===a){var m=l.margin,n=m.right+m.left;m=m.top+m.bottom;l.measure(b,c,f,g);var p=l.measuredBounds;n=Math.max(p.width+n,0);m=Math.max(p.height+m,0);p=l.position.x;var q=l.position.y;isFinite(p)||(p=0);isFinite(q)||(q=0);l instanceof V&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,q-=l);Fc(e,p,q,n,m)}}};
em.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding;a=c.x-e.left;c=c.y-e.top;for(e=0;e<d;e++){var f=b[e],g=f.measuredBounds,h=f.margin,k=f.position.x,l=f.position.y;k=isNaN(k)?-a:k-a;l=isNaN(l)?-c:l-c;if(f instanceof V&&f.isGeometryPositioned){var m=f.strokeWidth/2;k-=m;l-=m}f.visible&&f.arrange(k+h.left,l+h.top,g.width,g.height)}};function gm(){this.name="Base";this.name="Horizontal"}oa(gm,vl);
gm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Ka();f=fm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=Tk(l,!1);if(m!==ah&&m!==Ek)b.push(l);else{l.measure(Infinity,c,0,g);m=l.margin;l=l.measuredBounds;var n=Math.max(l.height+m.top+m.bottom,0);e.width+=Math.max(l.width+m.right+m.left,0);e.height=Math.max(e.height,n)}}}d=b.length;a.desiredSize.height?c=Math.min(a.desiredSize.height,a.maxSize.height):0!==e.height&&(c=Math.min(e.height,a.maxSize.height));for(a=0;a<d;a++)if(k=
b[a],k.visible||k===f)m=k.margin,h=m.right+m.left,m=m.top+m.bottom,k.measure(Infinity,c,0,g),k=k.measuredBounds,m=Math.max(k.height+m,0),e.width+=Math.max(k.width+h,0),e.height=Math.max(e.height,m);Oa(b)};
gm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.top,g=a.isOpposite,h=g?c.width:e.left,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,q=p.top+p.bottom,r=f+e.bottom,u=n.height,v=Tk(m,!1);if(isNaN(m.desiredSize.height)&&v===ie||v===Fk)u=Math.max(c.height-q-r,0);q=u+q+r;r=m.alignment;r.Lb()&&(r=a.defaultAlignment);r.ib()||(r=gd);g&&(h-=n.width+p.left+p.right);m.arrange(h+r.offsetX+p.left,l+r.offsetY+p.top+(c.height*r.y-q*r.y),n.width,u);g||(h+=n.width+
p.left+p.right)}}};function hm(){this.name="Base";this.name="Vertical"}oa(hm,vl);
hm.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Ka();for(var h=fm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=Tk(l,!1);if(m!==ah&&m!==Fk)c.push(l);else{var n=l.margin;m=n.right+n.left;n=n.top+n.bottom;l.measure(b,Infinity,f,0);l=l.measuredBounds;xc(e,Math.max(e.width,Math.max(l.width+m,0)),e.height+Math.max(l.height+n,0))}}}d=c.length;if(0!==d){a.desiredSize.width?b=Math.min(a.desiredSize.width,a.maxSize.width):0!==e.width&&(b=Math.min(e.width,a.maxSize.width));for(a=0;a<d;a++)if(k=
c[a],k.visible||k===h)l=k.margin,g=l.right+l.left,l=l.top+l.bottom,k.measure(b,Infinity,f,0),k=k.measuredBounds,l=Math.max(k.height+l,0),e.width=Math.max(e.width,Math.max(k.width+g,0)),e.height+=l;Oa(c)}};
hm.prototype.arrange=function(a,b,c){for(var d=b.length,e=a.padding,f=e.left,g=a.isOpposite,h=g?c.height:e.top,k=0;k<d;k++){var l=f,m=b[k];if(m.visible){var n=m.measuredBounds,p=m.margin,q=p.left+p.right,r=f+e.right,u=n.width,v=Tk(m,!1);if(isNaN(m.desiredSize.width)&&v===ie||v===Ek)u=Math.max(c.width-q-r,0);q=u+q+r;r=m.alignment;r.Lb()&&(r=a.defaultAlignment);r.ib()||(r=gd);g&&(h-=n.height+p.bottom+p.top);m.arrange(l+r.offsetX+p.left+(c.width*r.x-q*r.x),h+r.offsetY+p.top,u,n.height);g||(h+=n.height+
p.bottom+p.top)}}};function im(){this.name="Base";this.name="Spot"}oa(im,vl);
im.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.Ab(),l=k.margin,m=l.right+l.left,n=l.top+l.bottom;k.measure(b,c,f,g);var p=k.measuredBounds;f=p.width;g=p.height;var q=Math.max(f+m,0);var r=Math.max(g+n,0);for(var u=a.isClipping,v=N.allocAt(-l.left,-l.top,q,r),x=!0,y=fm(a),z=0;z<h;z++){var B=d[z];if(B!==k&&(B.visible||B===y)){l=B.margin;q=l.right+l.left;r=l.top+l.bottom;p=Tk(B,!1);switch(p){case ie:b=f;c=g;break;case Ek:b=f;break;case Fk:c=g}B.measure(b,c,0,0);p=B.measuredBounds;q=
Math.max(p.width+q,0);r=Math.max(p.height+r,0);var C=B.alignment;C.Lb()&&(C=a.defaultAlignment);C.ib()||(C=gd);var I=B.alignmentFocus;I.Lb()&&(I=gd);var J=null;B instanceof W&&""!==B.vg&&(B.arrange(0,0,p.width,p.height),J=B.bb(B.vg),J===B&&(J=null));if(null!==J){l=J.naturalBounds;p=J.margin;for(l=G.allocAt(I.x*l.width-I.offsetX-p.left,I.y*l.height-I.offsetY-p.top);J!==B;)J.transform.ta(l),J=J.panel;B=C.x*f+C.offsetX-l.x;p=C.y*g+C.offsetY-l.y;G.free(l)}else B=C.x*f+C.offsetX-(I.x*p.width+I.offsetX)-
l.left,p=C.y*g+C.offsetY-(I.y*p.height+I.offsetY)-l.top;x?(x=!1,e.h(B,p,q,r)):Fc(e,B,p,q,r)}}x?e.assign(v):u?e.av(v.x,v.y,v.width,v.height):Fc(e,v.x,v.y,v.width,v.height);N.free(v);p=k.stretch;p===Dk&&(p=Tk(k,!1));switch(p){case ah:return;case ie:if(!isFinite(b)&&!isFinite(c))return;break;case Ek:if(!isFinite(b))return;break;case Fk:if(!isFinite(c))return}p=k.measuredBounds;f=p.width;g=p.height;q=Math.max(f+m,0);r=Math.max(g+n,0);l=k.margin;v=N.allocAt(-l.left,-l.top,q,r);for(b=0;b<h;b++)c=d[b],c===
k||!c.visible&&c!==y||(l=c.margin,q=l.right+l.left,r=l.top+l.bottom,p=c.measuredBounds,q=Math.max(p.width+q,0),r=Math.max(p.height+r,0),m=c.alignment,m.Lb()&&(m=a.defaultAlignment),m.ib()||(m=gd),c=c.alignmentFocus,c.Lb()&&(c=gd),x?(x=!1,e.h(m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,q,r)):Fc(e,m.x*f+m.offsetX-(c.x*p.width+c.offsetX)-l.left,m.y*g+m.offsetY-(c.y*p.height+c.offsetY)-l.top,q,r));x?e.assign(v):u?e.av(v.x,v.y,v.width,v.height):Fc(e,v.x,
v.y,v.width,v.height);N.free(v)};
im.prototype.arrange=function(a,b,c){var d=b.length,e=a.Ab(),f=e.measuredBounds,g=f.width;f=f.height;var h=a.padding,k=h.left;h=h.top;var l=k-c.x,m=h-c.y;e.arrange(l,m,g,f);for(var n=0;n<d;n++){var p=b[n];if(p!==e){var q=p.measuredBounds,r=q.width;q=q.height;m=p.alignment;m.Lb()&&(m=a.defaultAlignment);m.ib()||(m=gd);var u=p.alignmentFocus;u.Lb()&&(u=gd);l=null;p instanceof W&&""!==p.vg&&(l=p.bb(p.vg),l===p&&(l=null));if(null!==l){var v=l.naturalBounds;for(u=G.allocAt(u.x*v.width-u.offsetX,u.y*v.height-
u.offsetY);l!==p;)l.transform.ta(u),l=l.panel;l=m.x*g+m.offsetX-u.x;m=m.y*f+m.offsetY-u.y;G.free(u)}else l=m.x*g+m.offsetX-(u.x*r+u.offsetX),m=m.y*f+m.offsetY-(u.y*q+u.offsetY);l-=c.x;m-=c.y;p.visible&&p.arrange(k+l,h+m,r,q)}}};function jm(){this.name="Base";this.name="Auto"}oa(jm,vl);
jm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.Ab(),l=k.margin,m=b,n=c,p=l.right+l.left,q=l.top+l.bottom;k.measure(b,c,f,g);l=k.measuredBounds;var r=0,u=null;k instanceof V&&(u=k,r=u.strokeWidth*u.scale);var v=Math.max(l.width+p,0);l=Math.max(l.height+q,0);var x=km(k),y=x.x*v+x.offsetX;x=x.y*l+x.offsetY;var z=lm(k),B=z.x*v+z.offsetX;z=z.y*l+z.offsetY;isFinite(b)&&(m=Math.max(Math.abs(y-B)-r,0));isFinite(c)&&(n=Math.max(Math.abs(x-z)-r,0));r=L.alloc();r.h(0,0);a=fm(a);for(z=0;z<h;z++)x=
d[z],x===k||!x.visible&&x!==a||(l=x.margin,v=l.right+l.left,y=l.top+l.bottom,x.measure(m,n,0,0),l=x.measuredBounds,v=Math.max(l.width+v,0),l=Math.max(l.height+y,0),r.h(Math.max(v,r.width),Math.max(l,r.height)));if(1===h)e.width=v,e.height=l,L.free(r);else{x=km(k);z=lm(k);h=d=0;z.x!==x.x&&z.y!==x.y&&(d=r.width/Math.abs(z.x-x.x),h=r.height/Math.abs(z.y-x.y));L.free(r);r=0;null!==u&&(r=u.strokeWidth*u.scale,bh(u)===ch&&(d=h=Math.max(d,h)));d+=Math.abs(x.offsetX)+Math.abs(z.offsetX)+r;h+=Math.abs(x.offsetY)+
Math.abs(z.offsetY)+r;u=k.stretch;u===Dk&&(u=Tk(k,!1));switch(u){case ah:g=f=0;break;case ie:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case Ek:isFinite(b)&&(d=b);g=0;break;case Fk:f=0,isFinite(c)&&(h=c)}k.Yl();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+q}};
jm.prototype.arrange=function(a,b){var c=b.length,d=a.Ab(),e=d.measuredBounds,f=N.alloc();f.h(0,0,1,1);var g=d.margin,h=g.left;g=g.top;var k=a.padding,l=k.left;k=k.top;d.arrange(l+h,k+g,e.width,e.height);var m=km(d),n=lm(d),p=m.y*e.height+m.offsetY,q=n.x*e.width+n.offsetX;n=n.y*e.height+n.offsetY;f.x=m.x*e.width+m.offsetX;f.y=p;Fc(f,q,n,0,0);f.x+=h+l;f.y+=g+k;for(e=0;e<c;e++)h=b[e],h!==d&&(l=h.measuredBounds,g=h.margin,k=Math.max(l.width+g.right+g.left,0),m=Math.max(l.height+g.top+g.bottom,0),p=h.alignment,
p.Lb()&&(p=a.defaultAlignment),p.ib()||(p=gd),k=f.width*p.x+p.offsetX-k*p.x+g.left+f.x,g=f.height*p.y+p.offsetY-m*p.y+g.top+f.y,h.visible&&(Gc(f.x,f.y,f.width,f.height,k,g,l.width,l.height)?h.arrange(k,g,l.width,l.height):h.arrange(k,g,l.width,l.height,new N(f.x,f.y,f.width,f.height))));N.free(f)};function mm(){this.name="Base";this.name="Table"}oa(mm,vl);
mm.prototype.measure=function(a,b,c,d,e,f,g){for(var h=d.length,k=Ka(),l=Ka(),m=0;m<h;m++){var n=d[m],p=n instanceof W?n:null;if(null===p||p.type!==W.TableRow&&p.type!==W.TableColumn||!n.visible)k.push(n);else{l.push(p);for(var q=p.W.j,r=q.length,u=0;u<r;u++){var v=q[u];p.type===W.TableRow?v.row=n.row:p.type===W.TableColumn&&(v.column=n.column);k.push(v)}}}h=k.length;0===h&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var x=[],y=0;y<h;y++){var z=k[y];ej(z,!0);Uk(z,!0);x[z.row]||(x[z.row]=
[]);x[z.row][z.column]||(x[z.row][z.column]=[]);x[z.row][z.column].push(z)}Oa(k);var B=Ka(),C=Ka(),I=Ka(),J={count:0},K={count:0},X=b,Q=c,ia=a.tb;h=ia.length;for(var ja=0;ja<h;ja++){var M=ia[ja];void 0!==M&&(M.actual=0)}ia=a.pb;h=ia.length;for(var R=0;R<h;R++)M=ia[R],void 0!==M&&(M.actual=0);for(var Ba=x.length,ob=0,Ia=0;Ia<Ba;Ia++)x[Ia]&&(ob=Math.max(ob,x[Ia].length));var Ea=Math.min(a.topIndex,Ba-1),Ga=Math.min(a.leftIndex,ob-1),Ra=0;Ba=x.length;for(var Tb=fm(a),Ya=0;Ya<Ba;Ya++)if(x[Ya]){ob=x[Ya].length;
for(var Wa=a.getRowDefinition(Ya),Ma=Wa.actual=0;Ma<ob;Ma++)if(x[Ya][Ma]){var fa=a.getColumnDefinition(Ma);void 0===B[Ma]&&(fa.actual=0,B[Ma]=!0);for(var ea=x[Ya][Ma],hb=ea.length,jb=0;jb<hb;jb++){var Na=ea[jb];if(Na.visible||Na===Tb){var be=1<Na.rowSpan||1<Na.columnSpan;be&&(Ya<Ea||Ma<Ga||C.push(Na));var Jd=Na.margin,vb=Jd.right+Jd.left,yf=Jd.top+Jd.bottom;var Eb=ll(Na,Wa,fa,!1);var oe=Na.desiredSize,Vc=!isNaN(oe.height),Ub=!isNaN(oe.width)&&Vc;be||Eb===ah||Ub||Ya<Ea||Ma<Ga||(void 0!==J[Ma]||Eb!==
ie&&Eb!==Ek||(J[Ma]=-1,J.count++),void 0!==K[Ya]||Eb!==ie&&Eb!==Fk||(K[Ya]=-1,K.count++),I.push(Na));Na.measure(Infinity,Infinity,0,0);if(!(Ya<Ea||Ma<Ga)){var Kd=Na.measuredBounds,Ec=Math.max(Kd.width+vb,0),Ge=Math.max(Kd.height+yf,0);if(1===Na.rowSpan&&(Eb===ah||Eb===Ek)){M=a.getRowDefinition(Ya);var He=M.vc();Ra=Math.max(Ge-M.actual,0);Ra+He>Q&&(Ra=Math.max(Q-He,0));var zf=0===M.actual;M.actual=M.actual+Ra;Q=Math.max(Q-(Ra+(zf?He:0)),0)}if(1===Na.columnSpan&&(Eb===ah||Eb===Fk)){M=a.getColumnDefinition(Ma);
var ff=M.vc();Ra=Math.max(Ec-M.actual,0);Ra+ff>X&&(Ra=Math.max(X-ff,0));var Af=0===M.actual;M.actual=M.actual+Ra;X=Math.max(X-(Ra+(Af?ff:0)),0)}be&&Na.Yl()}}}}}Oa(B);var hc=0,Za=0;h=a.columnCount;for(var $a=0;$a<h;$a++){var Mc=a.pb[$a];void 0!==Mc&&(hc+=Mc.ka,0!==Mc.ka&&(hc+=Mc.vc()))}h=a.rowCount;for(var Bf=0;Bf<h;Bf++){var ic=a.tb[Bf];void 0!==ic&&(Za+=ic.ka,0!==ic.ka&&(Za+=ic.vc()))}X=Math.max(b-hc,0);var Ld=Q=Math.max(c-Za,0),pc=X;h=I.length;for(var Md=0;Md<h;Md++){var Vb=I[Md],Eh=a.getRowDefinition(Vb.row),
Fh=a.getColumnDefinition(Vb.column),Ie=Vb.measuredBounds,pb=Vb.margin,Cf=pb.right+pb.left,Je=pb.top+pb.bottom;J[Vb.column]=0===Fh.actual&&void 0!==J[Vb.column]?Math.max(Ie.width+Cf,J[Vb.column]):null;K[Vb.row]=0===Eh.actual&&void 0!==K[Vb.row]?Math.max(Ie.height+Je,K[Vb.row]):null}var Wb=0,Ke=0,Nc;for(Nc in K)"count"!==Nc&&(Wb+=K[Nc]);for(Nc in J)"count"!==Nc&&(Ke+=J[Nc]);for(var db=L.alloc(),Le=0;Le<h;Le++){var rb=I[Le];if(rb.visible||rb===Tb){var qc=a.getRowDefinition(rb.row),kb=a.getColumnDefinition(rb.column),
Wc=0;isFinite(kb.width)?Wc=kb.width:(isFinite(X)&&null!==J[rb.column]?0===Ke?Wc=kb.actual+X:Wc=J[rb.column]/Ke*pc:null!==J[rb.column]?Wc=X:Wc=kb.actual||X,Wc=Math.max(0,Wc-kb.vc()));var Xc=0;isFinite(qc.height)?Xc=qc.height:(isFinite(Q)&&null!==K[rb.row]?0===Wb?Xc=qc.actual+Q:Xc=K[rb.row]/Wb*Ld:null!==K[rb.row]?Xc=Q:Xc=qc.actual||Q,Xc=Math.max(0,Xc-qc.vc()));db.h(Math.max(kb.minimum,Math.min(Wc,kb.maximum)),Math.max(qc.minimum,Math.min(Xc,qc.maximum)));Eb=ll(rb,qc,kb,!1);switch(Eb){case Ek:db.height=
Math.max(db.height,qc.actual+Q);break;case Fk:db.width=Math.max(db.width,kb.actual+X)}var wd=rb.margin,Cg=wd.right+wd.left,Df=wd.top+wd.bottom;rb.Yl();rb.measure(db.width,db.height,kb.minimum,qc.minimum);var Ef=rb.measuredBounds,gf=Math.max(Ef.width+Cg,0),jd=Math.max(Ef.height+Df,0);isFinite(X)&&(gf=Math.min(gf,db.width));isFinite(Q)&&(jd=Math.min(jd,db.height));var Nd=0;Nd=qc.actual;qc.actual=Math.max(qc.actual,jd);Ra=qc.actual-Nd;Q=Math.max(Q-Ra,0);Nd=kb.actual;kb.actual=Math.max(kb.actual,gf);
Ra=kb.actual-Nd;X=Math.max(X-Ra,0)}}Oa(I);var kd=L.alloc(),ld=Ka(),nb=Ka();h=C.length;if(0!==h)for(var eb=0;eb<Ba;eb++)if(x[eb]){ob=x[eb].length;var md=a.getRowDefinition(eb);ld[eb]=md.actual;for(var Yc=0;Yc<ob;Yc++)if(x[eb][Yc]){var nd=a.getColumnDefinition(Yc);nb[Yc]=nd.actual}}for(var vc=0;vc<h;vc++){var Ca=C[vc];if(Ca.visible||Ca===Tb){var Zc=a.getRowDefinition(Ca.row),Xb=a.getColumnDefinition(Ca.column);db.h(Math.max(Xb.minimum,Math.min(b,Xb.maximum)),Math.max(Zc.minimum,Math.min(c,Zc.maximum)));
Eb=ll(Ca,Zc,Xb,!1);switch(Eb){case ie:0!==nb[Xb.index]&&(db.width=Math.min(db.width,nb[Xb.index]));0!==ld[Zc.index]&&(db.height=Math.min(db.height,ld[Zc.index]));break;case Ek:0!==nb[Xb.index]&&(db.width=Math.min(db.width,nb[Xb.index]));break;case Fk:0!==ld[Zc.index]&&(db.height=Math.min(db.height,ld[Zc.index]))}isFinite(Xb.width)&&(db.width=Xb.width);isFinite(Zc.height)&&(db.height=Zc.height);kd.h(0,0);for(var ce=1;ce<Ca.rowSpan&&!(Ca.row+ce>=a.rowCount);ce++)M=a.getRowDefinition(Ca.row+ce),Ra=0,
Ra=Eb===ie||Eb===Fk?Math.max(M.minimum,0===ld[Ca.row+ce]?M.maximum:Math.min(ld[Ca.row+ce],M.maximum)):Math.max(M.minimum,isNaN(M.Qc)?M.maximum:Math.min(M.Qc,M.maximum)),kd.height+=Ra;for(var Me=1;Me<Ca.columnSpan&&!(Ca.column+Me>=a.columnCount);Me++)M=a.getColumnDefinition(Ca.column+Me),Ra=0,Ra=Eb===ie||Eb===Ek?Math.max(M.minimum,0===nb[Ca.column+Me]?M.maximum:Math.min(nb[Ca.column+Me],M.maximum)):Math.max(M.minimum,isNaN(M.Qc)?M.maximum:Math.min(M.Qc,M.maximum)),kd.width+=Ra;db.width+=kd.width;db.height+=
kd.height;var de=Ca.margin,wc=de.right+de.left,pe=de.top+de.bottom;Ca.measure(db.width,db.height,f,g);for(var $c=Ca.measuredBounds,wb=Math.max($c.width+wc,0),Od=Math.max($c.height+pe,0),Lb=0,qe=0;qe<Ca.rowSpan&&!(Ca.row+qe>=a.rowCount);qe++)M=a.getRowDefinition(Ca.row+qe),Lb+=M.total||0;if(Lb<Od){var xd=Od-Lb,ee=Od-Lb;if(null!==Ca.spanAllocation)for(var Dg=Ca.spanAllocation,ad=0;ad<Ca.rowSpan&&!(0>=xd)&&!(Ca.row+ad>=a.rowCount);ad++){M=a.getRowDefinition(Ca.row+ad);var Ne=M.ka||0,Eg=Dg(Ca,M,ee);M.actual=
Math.min(M.maximum,Ne+Eg);M.ka!==Ne&&(xd-=M.ka-Ne)}for(;0<xd;){var Ff=M.ka||0;isNaN(M.height)&&M.maximum>Ff&&(M.actual=Math.min(M.maximum,Ff+xd),M.ka!==Ff&&(xd-=M.ka-Ff));if(0===M.index)break;M=a.getRowDefinition(M.index-1)}}for(var Oe=0,Fg=0;Fg<Ca.columnSpan&&!(Ca.column+Fg>=a.columnCount);Fg++)M=a.getColumnDefinition(Ca.column+Fg),Oe+=M.total||0;if(Oe<wb){var dg=wb-Oe,Fi=wb-Oe;if(null!==Ca.spanAllocation)for(var Pe=Ca.spanAllocation,Qe=0;Qe<Ca.columnSpan&&!(0>=dg)&&!(Ca.column+Qe>=a.columnCount);Qe++){M=
a.getColumnDefinition(Ca.column+Qe);var Gh=M.ka||0,lt=Pe(Ca,M,Fi);M.actual=Math.min(M.maximum,Gh+lt);M.ka!==Gh&&(dg-=M.ka-Gh)}for(;0<dg;){var Xj=M.ka||0;isNaN(M.width)&&M.maximum>Xj&&(M.actual=Math.min(M.maximum,Xj+dg),M.ka!==Xj&&(dg-=M.ka-Xj));if(0===M.index)break;M=a.getColumnDefinition(M.index-1)}}}}Oa(C);L.free(kd);L.free(db);void 0!==ld&&Oa(ld);void 0!==nb&&Oa(nb);var Gg=0,Hg=0,Yj=a.desiredSize,Rq=a.maxSize;Eb=Tk(a,!0);var Gi=Za=hc=0,Hi=0;h=a.columnCount;for(var Zj=0;Zj<h;Zj++)void 0!==a.pb[Zj]&&
(M=a.getColumnDefinition(Zj),isFinite(M.width)?(Gi+=M.width,Gi+=M.vc()):nm(M)===om?(Gi+=M.ka,Gi+=M.vc()):0!==M.ka&&(hc+=M.ka,hc+=M.vc()));isFinite(Yj.width)?Gg=Math.min(Yj.width,Rq.width):Gg=Eb!==ah&&isFinite(b)?b:hc;Gg=Math.max(Gg,a.minSize.width);Gg=Math.max(Gg-Gi,0);var jn=Math.max(Gg/hc,1);isFinite(jn)||(jn=1);for(var bk=0;bk<h;bk++)void 0!==a.pb[bk]&&(M=a.getColumnDefinition(bk),isFinite(M.width)||nm(M)===om||(M.actual=M.ka*jn),M.position=e.width,0!==M.ka&&(e.width+=M.ka,e.width+=M.vc()));h=
a.rowCount;for(var ck=0;ck<h;ck++)void 0!==a.tb[ck]&&(M=a.getRowDefinition(ck),isFinite(M.height)?(Hi+=M.height,Hi+=M.vc()):nm(M)===om?(Hi+=M.ka,Hi+=M.vc()):0!==M.ka&&(Za+=M.ka,0!==M.ka&&(Za+=M.vc())));isFinite(Yj.height)?Hg=Math.min(Yj.height,Rq.height):Hg=Eb!==ah&&isFinite(c)?c:Za;Hg=Math.max(Hg,a.minSize.height);Hg=Math.max(Hg-Hi,0);var kn=Math.max(Hg/Za,1);isFinite(kn)||(kn=1);for(var dk=0;dk<h;dk++)void 0!==a.tb[dk]&&(M=a.getRowDefinition(dk),isFinite(M.height)||nm(M)===om||(M.actual=M.ka*kn),
M.position=e.height,0!==M.ka&&(e.height+=M.ka,0!==M.ka&&(e.height+=M.vc())));h=l.length;for(var ln=0;ln<h;ln++){var Pd=l[ln],mn=0,nn=0;Pd.type===W.TableRow?(mn=e.width,M=a.getRowDefinition(Pd.row),nn=M.actual):(M=a.getColumnDefinition(Pd.column),mn=M.actual,nn=e.height);Pd.measuredBounds.h(0,0,mn,nn);ej(Pd,!1);x[Pd.row]||(x[Pd.row]=[]);x[Pd.row][Pd.column]||(x[Pd.row][Pd.column]=[]);x[Pd.row][Pd.column].push(Pd)}Oa(l);a.Yo=x};
mm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.Yo,h,k,l=g.length,m=0,n=0;n<l;n++)g[n]&&(m=Math.max(m,g[n].length));for(n=Math.min(a.topIndex,l-1);n!==l&&(void 0===a.tb[n]||0===a.tb[n].ka);)n++;n=Math.min(n,l-1);n=-a.tb[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.pb[h]||0===a.pb[h].ka);)h++;h=Math.min(h,m-1);for(var p=-a.pb[h].position,q=L.alloc(),r=0;r<l;r++)if(g[r]){m=g[r].length;var u=a.getRowDefinition(r);k=u.position+n+e;0!==u.ka&&
(k+=u.Hu());for(var v=0;v<m;v++)if(g[r][v]){var x=a.getColumnDefinition(v);h=x.position+p+f;0!==x.ka&&(h+=x.Hu());for(var y=g[r][v],z=y.length,B=0;B<z;B++){var C=y[B],I=C.measuredBounds,J=C instanceof W?C:null;if(null===J||J.type!==W.TableRow&&J.type!==W.TableColumn){q.h(0,0);for(var K=1;K<C.rowSpan&&!(r+K>=a.rowCount);K++)J=a.getRowDefinition(r+K),q.height+=J.total;for(K=1;K<C.columnSpan&&!(v+K>=a.columnCount);K++)J=a.getColumnDefinition(v+K),q.width+=J.total;var X=x.ka+q.width,Q=u.ka+q.height;K=
h;J=k;var ia=X,ja=Q,M=h,R=k,Ba=X,ob=Q;h+X>c.width&&(Ba=Math.max(c.width-h,0));k+Q>c.height&&(ob=Math.max(c.height-k,0));var Ia=C.alignment;if(Ia.Lb()){Ia=a.defaultAlignment;Ia.ib()||(Ia=gd);var Ea=Ia.x;var Ga=Ia.y;var Ra=Ia.offsetX;Ia=Ia.offsetY;var Tb=x.alignment,Ya=u.alignment;Tb.ib()&&(Ea=Tb.x,Ra=Tb.offsetX);Ya.ib()&&(Ga=Ya.y,Ia=Ya.offsetY)}else Ea=Ia.x,Ga=Ia.y,Ra=Ia.offsetX,Ia=Ia.offsetY;if(isNaN(Ea)||isNaN(Ga))Ga=Ea=.5,Ia=Ra=0;Tb=I.width;Ya=I.height;var Wa=C.margin,Ma=Wa.left+Wa.right,fa=Wa.top+
Wa.bottom,ea=ll(C,u,x,!1);!isNaN(C.desiredSize.width)||ea!==ie&&ea!==Ek||(Tb=Math.max(X-Ma,0));!isNaN(C.desiredSize.height)||ea!==ie&&ea!==Fk||(Ya=Math.max(Q-fa,0));X=C.maxSize;Q=C.minSize;Tb=Math.min(X.width,Tb);Ya=Math.min(X.height,Ya);Tb=Math.max(Q.width,Tb);Ya=Math.max(Q.height,Ya);X=Ya+fa;K+=ia*Ea-(Tb+Ma)*Ea+Ra+Wa.left;J+=ja*Ga-X*Ga+Ia+Wa.top;C.visible&&(Gc(M,R,Ba,ob,K,J,I.width,I.height)?C.arrange(K,J,Tb,Ya):C.arrange(K,J,Tb,Ya,new N(M,R,Ba,ob)))}else C.Xk(),C.actualBounds.ha(),ia=C.actualBounds,
K=N.allocAt(ia.x,ia.y,ia.width,ia.height),ia.x=J.type===W.TableRow?f:h,ia.y=J.type===W.TableColumn?e:k,ia.width=I.width,ia.height=I.height,C.actualBounds.freeze(),Uk(C,!1),Ac(K,ia)||(I=C.part,null!==I&&(I.sh(),C.xo(I))),N.free(K)}}}L.free(q);for(a=0;a<d;a++)c=b[a],f=c instanceof W?c:null,null===f||f.type!==W.TableRow&&f.type!==W.TableColumn||(f=c.actualBounds,c.naturalBounds.ha(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};
function pm(){this.name="Base";this.name="TableRow"}oa(pm,vl);pm.prototype.measure=function(){};pm.prototype.arrange=function(){};function qm(){this.name="Base";this.name="TableColumn"}oa(qm,vl);qm.prototype.measure=function(){};qm.prototype.arrange=function(){};function rm(){this.name="Base";this.name="Viewbox"}oa(rm,vl);
rm.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&A("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.Ca=1;d.Yl();d.measure(Infinity,Infinity,f,g);var h=d.measuredBounds,k=d.margin,l=k.right+k.left;k=k.top+k.bottom;if(isFinite(b)||isFinite(c)){var m=d.scale,n=h.width;h=h.height;var p=Math.max(b-l,0),q=Math.max(c-k,0),r=1;a.viewboxStretch===ch?0!==n&&0!==h&&(r=Math.min(p/n,q/h)):0!==n&&0!==h&&(r=Math.max(p/n,q/h));0===r&&(r=1E-4);d.Ca*=r;m!==d.scale&&(ej(d,!0),d.measure(Infinity,
Infinity,f,g))}h=d.measuredBounds;e.width=isFinite(b)?b:Math.max(h.width+l,0);e.height=isFinite(c)?c:Math.max(h.height+k,0)};rm.prototype.arrange=function(a,b,c){b=b[0];var d=b.measuredBounds,e=b.margin,f=Math.max(d.width+(e.right+e.left),0);e=Math.max(d.height+(e.top+e.bottom),0);var g=b.alignment;g.Lb()&&(g=a.defaultAlignment);g.ib()||(g=gd);b.arrange(c.width*g.x-f*g.x+g.offsetX,c.height*g.y-e*g.y+g.offsetY,d.width,d.height)};function sm(){this.name="Base";this.name="Grid"}oa(sm,vl);
sm.prototype.measure=function(){};sm.prototype.arrange=function(){};function tm(){this.name="Base";this.name="Link"}oa(tm,vl);
tm.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof sf||a instanceof S){var f=null,g=null,h=null;a instanceof S&&(g=f=a);a instanceof sf&&(h=a,f=h.adornedPart);if(f instanceof S){var k=f;if(0===c)xc(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof sf?null:f.path,m=f.routeBounds;b=a.eg;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.$j(!1):null!==g&&g.$j(!1);var p=m.width,q=m.height;a.location.h(m.x,m.y);a.l.length=0;null!==l&&(um(a,p,q,l),
h=l.measuredBounds,b.Wc(h),a.l.push(h));h=Tc.alloc();for(var r=G.alloc(),u=G.alloc(),v=0;v<c;v++){var x=d[v];if(x!==l)if(x.isPanelMain&&x instanceof V){um(a,p,q,x);var y=x.measuredBounds;b.Wc(y);a.l.push(y)}else if(2>f)x.measure(Infinity,Infinity,0,0),y=x.measuredBounds,b.Wc(y),a.l.push(y);else{var z=x.segmentIndex;y=x.segmentFraction;var B=x.alignmentFocus;B.mc()&&(B=gd);var C=x.segmentOrientation,I=x.segmentOffset;if(z<-f||z>=f){y=k.midPoint;var J=k.midAngle;if(C!==Qg){var K=k.computeAngle(x,C,
J);x.Bc=K}K=y.x-m.x;var X=y.y-m.y}else{K=0;if(0<=z){X=n.N(z);var Q=z<f-1?n.N(z+1):X}else K=f+z,X=n.N(K),Q=0<K?n.N(K-1):X;if(X.Oa(Q)){0<=z?(J=0<z?n.N(z-1):X,K=z<f-2?n.N(z+2):Q):(J=K<f-1?n.N(K+1):X,K=1<K?n.N(K-2):Q);var ia=J.Ae(X),ja=Q.Ae(K);J=ia>ja+10?0<=z?J.Va(X):X.Va(J):ja>ia+10?0<=z?Q.Va(K):K.Va(Q):0<=z?J.Va(K):K.Va(J)}else J=0<=z?X.Va(Q):Q.Va(X);C!==Qg&&(K=k.computeAngle(x,C,J),x.Bc=K);K=X.x+(Q.x-X.x)*y-m.x;X=X.y+(Q.y-X.y)*y-m.y}x.measure(Infinity,Infinity,0,0);y=x.measuredBounds;ja=x.naturalBounds;
ia=0;x instanceof V&&(ia=x.strokeWidth);Q=ja.width+ia;ja=ja.height+ia;h.reset();h.translate(-y.x,-y.y);h.scale(x.scale,x.scale);h.rotate(C===Qg?x.angle:J,Q/2,ja/2);C!==vm&&C!==wm||h.rotate(90,Q/2,ja/2);C!==xm&&C!==ym||h.rotate(-90,Q/2,ja/2);C===zm&&(45<J&&135>J||225<J&&315>J)&&h.rotate(-J,Q/2,ja/2);C=new N(0,0,Q,ja);r.Li(C,B);h.ta(r);B=-r.x+ia/2*x.scale;x=-r.y+ia/2*x.scale;u.assign(I);isNaN(u.x)&&(u.x=0<=z?Q/2+3:-(Q/2+3));isNaN(u.y)&&(u.y=-(ja/2+3));u.rotate(J);K+=u.x;X+=u.y;C.set(y);C.h(K+B,X+x,
y.width,y.height);a.l.push(C);b.Wc(C)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.eg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);xc(e,b.width||0,b.height||0);Tc.free(h);G.free(r);G.free(u)}}}};
tm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof sf||a instanceof S){var d=null,e=null,f=null;a instanceof S&&(e=d=a);a instanceof sf&&(f=a,d=f.adornedPart);var g=a instanceof sf?null:d.path;if(0!==a.l.length){var h=a.l,k=0;if(null!==g&&k<a.l.length){var l=h[k];k++;g.arrange(l.x-a.eg.x,l.y-a.eg.y,l.width,l.height)}for(l=0;l<c;l++){var m=b[l];if(m!==g&&k<a.l.length){var n=h[k];k++;m.arrange(n.x-a.eg.x,n.y-a.eg.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof S)for(d=
a.labelNodes;d.next();){n=a;g=d.value;h=g.segmentIndex;var p=g.segmentFraction;l=g.alignmentFocus;var q=g.segmentOrientation;k=g.segmentOffset;if(h<-c||h>=c){var r=n.midPoint;m=n.midAngle;q!==Qg&&(n=n.computeAngle(g,q,m),g.angle=n);n=r.x;var u=r.y}else{var v=0;0<=h?(u=b.j[h],r=h<c-1?b.j[h+1]:u):(v=c+h,u=b.j[v],r=0<v?b.j[v-1]:u);if(u.Oa(r)){0<=h?(m=0<h?b.j[h-1]:u,v=h<c-2?b.j[h+2]:r):(m=v<c-1?b.j[v+1]:u,v=1<v?b.j[v-2]:r);var x=m.Ae(u),y=r.Ae(v);m=x>y+10?0<=h?m.Va(u):u.Va(m):y>x+10?0<=h?r.Va(v):v.Va(r):
0<=h?m.Va(v):v.Va(m)}else m=0<=h?u.Va(r):r.Va(u);q!==Qg&&(n=n.computeAngle(g,q,m),g.angle=n);n=u.x+(r.x-u.x)*p;u=u.y+(r.y-u.y)*p}l.at()?g.location=new G(n,u):(l.mc()&&(l=gd),r=Tc.alloc(),r.reset(),r.scale(g.scale,g.scale),r.rotate(g.angle,0,0),p=g.naturalBounds,p=N.allocAt(0,0,p.width,p.height),q=G.alloc(),q.Li(p,l),r.ta(q),l=-q.x,v=-q.y,k=k.copy(),isNaN(k.x)&&(0<=h?k.x=q.x+3:k.x=-(q.x+3)),isNaN(k.y)&&(k.y=-(q.y+3)),k.rotate(m),n+=k.x,u+=k.y,r.Ov(p),l+=p.x,v+=p.y,h=G.allocAt(n+l,u+v),g.move(h),G.free(h),
G.free(q),N.free(p),Tc.free(r))}null!==f?f.$j(!1):null!==e&&e.$j(!1)}};function um(a,b,c,d){if(!1!==jj(d)){var e=d.strokeWidth;0===e&&a instanceof sf&&a.type===W.Link&&a.adornedObject instanceof V&&(e=a.adornedObject.strokeWidth);e*=d.Ca;a instanceof S&&null!==a.qa?(a=a.qa.bounds,Qk(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof sf&&null!==a.adornedPart.qa?(a=a.adornedPart.qa.bounds,Qk(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):Qk(d,-(e/2),-(e/2),b+e,c+e);ej(d,!1)}}
function Am(){this.name="Base";this.name="Graduated"}oa(Am,vl);
Am.prototype.measure=function(a,b,c,d,e,f,g){var h=a.Ab();a.Zi=[];var k=h.margin,l=k.right+k.left,m=k.top+k.bottom;h.measure(b,c,f,g);var n=h.measuredBounds,p=new N(-k.left,-k.top,Math.max(n.width+l,0),Math.max(n.height+m,0));a.Zi.push(p);e.assign(p);for(var q=h.geometry,r=h.strokeWidth,u=q.flattenedSegments,v=q.flattenedLengths,x=q.flattenedTotalLength,y=u.length,z=0,B=0,C=Ka(),I=0;I<y;I++){var J=u[I],K=[];B=z=0;for(var X=J.length,Q=0;Q<X;Q+=2){var ia=J[Q],ja=J[Q+1];if(0!==Q){var M=180*Math.atan2(ja-
B,ia-z)/Math.PI;0>M&&(M+=360);K.push(M)}z=ia;B=ja}C.push(K)}if(null===a.Jg){for(var R=[],Ba=a.W.j,ob=Ba.length,Ia=0;Ia<ob;Ia++){var Ea=Ba[Ia],Ga=[];R.push(Ga);if(Ea.visible)for(var Ra=Ea.interval,Tb=0;Tb<ob;Tb++){var Ya=Ba[Tb];if(Ya.visible&&Ea!==Ya&&!(Ea instanceof V&&!(Ya instanceof V)||Ea instanceof th&&!(Ya instanceof th))){var Wa=Ya.interval;Wa>Ra&&Ga.push(Wa)}}}a.Jg=R}var Ma=a.Jg;var fa=a.W.j,ea=fa.length,hb=0,jb=0,Na=x;a.aj=[];for(var be,Jd=0;Jd<ea;Jd++){var vb=fa[Jd];be=[];if(vb.visible&&
vb!==h){var yf=vb.interval,Eb=a.graduatedTickUnit;if(!(2>Eb*yf*x/a.graduatedRange)){var oe=v[0][0],Vc=0,Ub=0;jb=x*vb.graduatedStart-1E-4;Na=x*vb.graduatedEnd+1E-4;var Kd=Eb*yf,Ec=a.graduatedTickBase;if(Ec<a.graduatedMin){var Ge=(a.graduatedMin-Ec)/Kd;Ge=0===Ge%1?Ge:Math.floor(Ge+1);Ec+=Ge*Kd}else Ec>a.graduatedMin+Kd&&(Ec-=Math.floor((Ec-a.graduatedMin)/Kd)*Kd);for(var He=Ma[Jd];Ec<=a.graduatedMax;){a:{for(var zf=He.length,ff=0;ff<zf;ff++)if(H.ba((Ec-a.graduatedTickBase)%(He[ff]*a.graduatedTickUnit),
0)){var Af=!1;break a}Af=!0}if(Af&&(null===vb.graduatedSkip||!vb.graduatedSkip(Ec))&&(hb=(Ec-a.graduatedMin)*x/a.graduatedRange,hb>x&&(hb=x),jb<=hb&&hb<=Na)){for(var hc=C[Vc][Ub],Za=v[Vc][Ub];Vc<v.length;){for(;hb>oe&&Ub<v[Vc].length-1;)Ub++,hc=C[Vc][Ub],Za=v[Vc][Ub],oe+=Za;if(hb<=oe)break;Vc++;Ub=0;hc=C[Vc][Ub];Za=v[Vc][Ub];oe+=Za}var $a=u[Vc],Mc=$a[2*Ub],Bf=$a[2*Ub+1],ic=(hb-(oe-Za))/Za,Ld=new G(Mc+($a[2*Ub+2]-Mc)*ic+r/2-q.bounds.x,Bf+($a[2*Ub+3]-Bf)*ic+r/2-q.bounds.y);Ld.scale(h.scale,h.scale);
var pc=hc,Md=C[Vc];1E-4>ic?0<Ub?pc=Md[Ub-1]:H.ba($a[0],$a[$a.length-2])&&H.ba($a[1],$a[$a.length-1])&&(pc=Md[Md.length-1]):.9999<ic&&(Ub+1<Md.length?pc=Md[Ub+1]:H.ba($a[0],$a[$a.length-2])&&H.ba($a[1],$a[$a.length-1])&&(pc=Md[0]));hc!==pc&&(180<Math.abs(hc-pc)&&(hc<pc?hc+=360:pc+=360),hc=(hc+pc)/2%360);if(vb instanceof th){var Vb="";null!==vb.graduatedFunction?(Vb=vb.graduatedFunction(Ec),Vb=null!==Vb&&void 0!==Vb?Vb.toString():""):Vb=(+Ec.toFixed(2)).toString();""!==Vb&&be.push([Ld,hc,Vb])}else be.push([Ld,
hc])}Ec+=Kd}}}a.aj.push(be)}Oa(C);for(var Eh=a.aj,Fh=d.length,Ie=0;Ie<Fh;Ie++){var pb=d[Ie],Cf=Eh[Ie];if(pb.visible&&pb!==h&&0!==Cf.length){if(pb instanceof V){var Je=a,Wb=e,Ke=pb.alignmentFocus;Ke.mc()&&(Ke=dd);var Nc=pb.angle;pb.Bc=0;pb.measure(Infinity,Infinity,0,0);pb.Bc=Nc;var db=pb.measuredBounds,Le=db.width,rb=db.height,qc=N.allocAt(0,0,Le,rb),kb=G.alloc();kb.Li(qc,Ke);N.free(qc);for(var Wc=-kb.x,Xc=-kb.y,wd=new N,Cg=Cf.length,Df=0;Df<Cg;Df++)for(var Ef=Cf[Df],gf=Ef[0].x,jd=Ef[0].y,Nd=Ef[1],
kd=0;4>kd;kd++){switch(kd){case 0:kb.h(Wc,Xc);break;case 1:kb.h(Wc+Le,Xc);break;case 2:kb.h(Wc,Xc+rb);break;case 3:kb.h(Wc+Le,Xc+rb)}kb.rotate(Nd+pb.angle);kb.offset(gf,jd);0===Df&&0===kd?wd.h(kb.x,kb.y,0,0):wd.Ie(kb);kb.offset(-gf,-jd);kb.rotate(-Nd-pb.angle)}G.free(kb);Je.Zi.push(wd);Fc(Wb,wd.x,wd.y,wd.width,wd.height)}else if(pb instanceof th){var ld=a,nb=e;null===ld.bh&&(ld.bh=new th);var eb=ld.bh;Bm(eb,pb);var md=pb.alignmentFocus;md.mc()&&(md=dd);for(var Yc=pb.segmentOrientation,nd=pb.segmentOffset,
vc=null,Ca=0,Zc=0,Xb=0,ce=0,Me=Cf.length,de=0;de<Me;de++){var wc=Cf[de];Ca=wc[0].x;Zc=wc[0].y;Xb=wc[1];Yc!==Qg&&(ce=S.computeAngle(Yc,Xb),eb.Bc=ce);eb.text=wc[2];eb.measure(Infinity,Infinity,0,0);var pe=eb.measuredBounds,$c=eb.naturalBounds,wb=$c.width,Od=$c.height,Lb=Tc.alloc();Lb.reset();Lb.translate(-pe.x,-pe.y);Lb.scale(eb.scale,eb.scale);Lb.rotate(Yc===Qg?eb.angle:Xb,wb/2,Od/2);Yc!==vm&&Yc!==wm||Lb.rotate(90,wb/2,Od/2);Yc!==xm&&Yc!==ym||Lb.rotate(-90,wb/2,Od/2);Yc===zm&&(45<Xb&&135>Xb||225<Xb&&
315>Xb)&&Lb.rotate(-Xb,wb/2,Od/2);var qe=N.allocAt(0,0,wb,Od),xd=G.alloc();xd.Li(qe,md);Lb.ta(xd);var ee=-xd.x,Dg=-xd.y,ad=G.alloc();ad.assign(nd);isNaN(ad.x)&&(ad.x=wb/2+3);isNaN(ad.y)&&(ad.y=-(Od/2+3));ad.rotate(Xb);Ca+=ad.x+ee;Zc+=ad.y+Dg;var Ne=new N(Ca,Zc,pe.width,pe.height),Eg=new N(pe.x,pe.y,pe.width,pe.height),Ff=new N($c.x,$c.y,$c.width,$c.height),Oe=new Cm;Oe.Pl(eb.metrics);wc.push(ce);wc.push(eb.lineCount);wc.push(Oe);wc.push(Ne);wc.push(Eg);wc.push(Ff);0===de?vc=Ne.copy():vc.Wc(Ne);G.free(ad);
G.free(xd);N.free(qe);Tc.free(Lb)}ld.Zi.push(vc);Fc(nb,vc.x,vc.y,vc.width,vc.height)}ej(pb,!1)}}};Am.prototype.arrange=function(a,b,c){if(null!==a.Zi){var d=a.Ab(),e=a.aj,f=a.Zi,g=0,h=f[g];g++;d.arrange(h.x-c.x,h.y-c.y,h.width,h.height);for(var k=b.length,l=0;l<k;l++){var m=b[l];h=e[l];m.visible&&m!==d&&0!==h.length&&(h=f[g],g++,m.arrange(h.x-c.x,h.y-c.y,h.width,h.height))}a.Zi=null}};
function W(a){Y.call(this);this.va=void 0===a?W.Position:a;null===this.va&&A("Panel type not specified or PanelLayout not loaded: "+a);this.W=new E;this.gb=Rc;this.va===W.Grid&&(this.isAtomic=!0);this.gn=Hd;this.Af=Dk;this.va===W.Table&&Dm(this);this.Ap=ch;this.Fn=nc;this.Gn=cc;this.Cn=0;this.Bn=100;this.En=10;this.Dn=0;this.Kh=this.kb=this.Jg=this.Zi=this.aj=null;this.Tn=NaN;this.he=this.ai=null;this.Yk="category";this.Fd=null;this.eg=new N(NaN,NaN,NaN,NaN);this.bh=this.Yo=this.oi=null;this.vg=""}
oa(W,Y);function Dm(a){a.Vi=Rc;a.Dg=1;a.Ph=null;a.Oh=null;a.Cg=1;a.Bg=null;a.Nh=null;a.tb=[];a.pb=[];a.xj=Em;a.Ti=Em;a.si=0;a.ci=0}
W.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.va=this.va;a.gb=this.gb.I();a.gn=this.gn.I();a.Af=this.Af;if(a.va===W.Table){a.Vi=this.Vi.I();a.Dg=this.Dg;a.Ph=this.Ph;a.Oh=this.Oh;a.Cg=this.Cg;a.Bg=this.Bg;a.Nh=this.Nh;var b=[];if(0<this.tb.length)for(var c=this.tb,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.Ki(a);b[e]=f}a.tb=b;b=[];if(0<this.pb.length)for(c=this.pb,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.Ki(a),b[e]=f);a.pb=b;a.xj=
this.xj;a.Ti=this.Ti;a.si=this.si;a.ci=this.ci}a.Ap=this.Ap;a.Fn=this.Fn.I();a.Gn=this.Gn.I();a.Cn=this.Cn;a.Bn=this.Bn;a.En=this.En;a.Dn=this.Dn;a.aj=this.aj;a.Jg=this.Jg;a.kb=this.kb;a.Kh=this.Kh;a.Tn=this.Tn;a.ai=this.ai;a.he=this.he;a.Yk=this.Yk;a.eg.assign(this.eg);a.vg=this.vg;null!==this.Yo&&(a.Yo=this.Yo)};W.prototype.lf=function(a){Y.prototype.lf.call(this,a);a.W=this.W;for(var b=a.W.j,c=b.length,d=0;d<c;d++)b[d].Yf=a;a.oi=null};
W.prototype.copy=function(){var a=Y.prototype.copy.call(this);if(null!==a){for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.Ki(a);e.sj=null;var f=a.W,g=f.count;f.Jb(g,e);f=a.part;if(null!==f){f.nj=null;null!==e.portId&&f instanceof U&&(f.rh=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.cb(hf,"elements",a,null,e,null,g)}}return a}return null};t=W.prototype;t.toString=function(){return"Panel("+this.type+")#"+Fb(this)};
t.xo=function(a){Y.prototype.xo.call(this,a);for(var b=this.W.j,c=b.length,d=0;d<c;d++)b[d].xo(a)};
t.xi=function(a,b){if(this.va===W.Grid){b=this.Be()*b.scale;0>=b&&(b=1);var c=this.gridCellSize,d=c.width;c=c.height;var e=this.naturalBounds,f=this.actualBounds,g=e.width,h=e.height,k=Math.ceil(g/d),l=Math.ceil(h/c),m=this.gridOrigin;a.save();a.beginPath();a.rect(0,0,g,h);a.clip();for(var n=[],p=this.W.j,q=p.length,r=0;r<q;r++){var u=p[r],v=[];n.push(v);if(u.visible){u=Mj(u.figure);for(var x=r+1;x<q;x++){var y=p[x];y.visible&&Mj(y.figure)===u&&(y=y.interval,2<=y&&v.push(y))}}}p=this.W.j;q=p.length;
for(r=0;r<q;r++){var z=p[r];if(z.visible&&(v=z.interval,!(2>d*v*b))){u=z.opacity;x=1;if(1!==u){if(0===u)continue;x=a.globalAlpha;a.globalAlpha=x*u}y=n[r];var B=!1,C=z.strokeDashArray;null!==C&&(B=!0,a.Ls(C,z.strokeDashOffset));if("LineV"===z.figure&&null!==z.stroke){a.lineWidth=z.strokeWidth;fi(this,a,z.stroke,!1,!1,e,f);a.beginPath();for(C=z=Math.floor(-m.x/d);C<=z+k;C++){var I=C*d+m.x;0<=I&&I<=g&&Fm(C,v,y)&&(a.moveTo(I,0),a.lineTo(I,h))}a.stroke()}else if("LineH"===z.figure&&null!==z.stroke){a.lineWidth=
z.strokeWidth;fi(this,a,z.stroke,!1,!1,e,f);a.beginPath();for(C=z=Math.floor(-m.y/c);C<=z+l;C++)I=C*c+m.y,0<=I&&I<=h&&Fm(C,v,y)&&(a.moveTo(0,I),a.lineTo(g,I));a.stroke()}else if("BarV"===z.figure&&null!==z.fill)for(fi(this,a,z.fill,!0,!1,e,f),z=z.width,isNaN(z)&&(z=d),I=C=Math.floor(-m.x/d);I<=C+k;I++){var J=I*d+m.x;0<=J&&J<=g&&Fm(I,v,y)&&a.fillRect(J,0,z,h)}else if("BarH"===z.figure&&null!==z.fill)for(fi(this,a,z.fill,!0,!1,e,f),z=z.height,isNaN(z)&&(z=c),I=C=Math.floor(-m.y/c);I<=C+l;I++)J=I*c+
m.y,0<=J&&J<=h&&Fm(I,v,y)&&a.fillRect(0,J,g,z);B&&a.Is();1!==u&&(a.globalAlpha=x)}}a.restore();a.Sc(!1)}else if(this.va===W.Graduated){d=b.ej;b.ej=!0;e=this.naturalBounds;c=e.width;e=e.height;a.save();a.beginPath();a.rect(-1,-1,c+1,e+1);a.clip();c=this.Ab();c.kc(a,b);e=this.Be()*b.scale;0>=e&&(e=1);f=c.actualBounds;g=this.W.j;h=this.aj;k=g.length;for(l=0;l<k;l++)if(p=g[l],m=h[l],n=m.length,p.visible&&p!==c&&0!==m.length)if(p instanceof V){if(!(2>this.graduatedTickUnit*p.interval*e))for(q=p.measuredBounds,
r=p.strokeWidth*p.scale,v=p.alignmentFocus,v.mc()&&(v=dd),u=0;u<n;u++)x=m[u][0],y=m[u][1],B=v,z=p.ub,z.reset(),z.translate(x.x+f.x,x.y+f.y),z.rotate(y+p.angle,0,0),z.translate(-q.width*B.x+B.offsetX+r/2,-q.height*B.y+B.offsetY+r/2),z.scale(p.scale,p.scale),il(p,!1),p.xh.set(p.ub),p.Kk=p.scale,jl(p,!1),p.kc(a,b),p.ub.reset()}else if(p instanceof th)for(null===this.bh&&(this.bh=new th),q=this.bh,Bm(q,p),p=0;p<n;p++)u=m[p],3<u.length&&(r=u[6],q.Ob=u[2],q.Bc=u[3],q.rc=u[4],q.pd=u[5],q.jc=u[8],q.arrange(r.x,
r.y,r.width,r.height),r=u[6],q.arrange(r.x,r.y,r.width,r.height),v=u[7],u=u[8],x=q.ub,x.reset(),x.translate(r.x+f.x,r.y+f.y),x.translate(-v.x,-v.y),Rk(q,x,u.x,u.y,u.width,u.height),il(q,!1),q.xh.set(q.ub),q.Kk=q.scale,jl(q,!1),q.kc(a,b));b.ej=d;a.restore();a.Sc(!0)}else{this.va===W.Table&&(a.lineCap="butt",Gm(this,a,!0,this.tb,!0),Gm(this,a,!1,this.pb,!0),Hm(this,a,!0,this.tb),Hm(this,a,!1,this.pb),Gm(this,a,!0,this.tb,!1),Gm(this,a,!1,this.pb,!1));(d=this.isClipping)&&a.save();c=this.Ab();e=this.W.j;
f=e.length;for(g=0;g<f;g++)h=e[g],d&&h===c&&(a.clipInsteadOfFill=!0),h.kc(a,b),d&&h===c&&(a.clipInsteadOfFill=!1);d&&(a.restore(),a.Sc(!0))}};
function Hm(a,b,c,d){for(var e=d.length,f=a.actualBounds,g=a.naturalBounds,h=!0,k=0;k<e;k++){var l=d[k];if(void 0!==l)if(h)h=!1;else if(0!==l.actual){if(c){if(l.position>f.height)continue}else if(l.position>f.width)continue;var m=l.separatorStrokeWidth;isNaN(m)&&(m=c?a.Dg:a.Cg);var n=l.separatorStroke;null===n&&(n=c?a.Ph:a.Bg);if(0!==m&&null!==n){fi(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.Oh:a.Nh);null!==p&&(n=!0,b.Ls(p,0));b.beginPath();p=l.position+m;c?p>f.height&&(m-=
p-f.height):p>f.width&&(m-=p-f.width);l=l.position+m/2;b.lineWidth=m;m=a.gb;c?(l+=m.top,p=f.width-m.right,b.moveTo(m.left,l),b.lineTo(p,l)):(l+=m.left,p=f.height-m.bottom,b.moveTo(l,m.top),b.lineTo(l,p));b.stroke();n&&b.Is()}}}}
function Gm(a,b,c,d,e){for(var f=d.length,g=a.actualBounds,h=a.naturalBounds,k=0;k<f;k++){var l=d[k];if(void 0!==l&&null!==l.background&&l.coversSeparators!==e&&0!==l.actual){var m=c?g.height:g.width;if(!(l.position>m)){var n=l.vc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.Dg:a.Cg);var q=l.separatorStroke;null===q&&(q=c?a.Ph:a.Bg);null===q&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.gb,fi(a,b,l.background,!0,!1,h,g),c?b.fillRect(m.left,p+m.top,g.width-(m.left+m.right),n):b.fillRect(p+
m.left,m.top,n,g.height-(m.top+m.bottom)))}}}}function Fm(a,b,c){if(0!==a%b)return!1;b=c.length;for(var d=0;d<b;d++)if(0===a%c[d])return!1;return!0}function Mj(a){return"LineV"===a||"BarV"===a}
t.Uj=function(a,b,c,d,e){var f=this.Yd(),g=this.transform,h=1/(g.m11*g.m22-g.m12*g.m21),k=g.m22*h,l=-g.m12*h,m=-g.m21*h,n=g.m11*h,p=h*(g.m21*g.dy-g.m22*g.dx),q=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.areaBackground)return g=this.actualBounds,H.Uc(g.left,g.top,g.right,g.bottom,a,b,c,d,e);if(null!==this.background)return f=a*k+b*m+p,h=a*l+b*n+q,a=c*k+d*m+p,k=c*l+d*n+q,e.h(0,0),c=this.naturalBounds,f=H.Uc(0,0,c.width,c.height,f,h,a,k,e),e.transform(g),f;f||(k=1,m=l=0,n=1,q=p=0);h=a*k+b*m+p;a=a*l+b*
n+q;k=c*k+d*m+p;c=c*l+d*n+q;e.h(k,c);d=(k-h)*(k-h)+(c-a)*(c-a);l=!1;n=this.W.j;q=n.length;m=G.alloc();p=null;b=Infinity;var r=null;this.isClipping&&(r=G.alloc(),p=this.Ab(),(l=p.Uj(h,a,k,c,r))&&(b=(h-r.x)*(h-r.x)+(a-r.y)*(a-r.y)));for(var u=0;u<q;u++){var v=n[u];v.visible&&v!==p&&v.Uj(h,a,k,c,m)&&(l=!0,v=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),v<d&&(d=v,e.set(m)))}this.isClipping&&(b>d&&e.set(r),G.free(r));G.free(m);f&&e.transform(g);return l};
t.o=function(a){Y.prototype.o.call(this,a);a=null;if(this.va===W.Auto||this.va===W.Link)a=this.Ab();for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.o(!0);if(!e.desiredSize.s()){var f=Tk(e,!1);(e instanceof Zg||e instanceof W||e instanceof th||f!==ah)&&e.o(!0)}}};t.Yl=function(){if(!1===jj(this)){ej(this,!0);Uk(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].Yl()}};
t.Xk=function(){if(0!==(this.G&2048)===!1){il(this,!0);jl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].cv()}};t.cv=function(){jl(this,!0);for(var a=this.W.j,b=a.length,c=0;c<b;c++)a[c].cv()};
t.bm=function(a,b,c,d){var e=this.eg;e.h(0,0,0,0);var f=this.desiredSize,g=this.minSize;void 0===c&&(c=g.width,d=g.height);c=Math.max(c,g.width);d=Math.max(d,g.height);var h=this.maxSize;isNaN(f.width)||(a=Math.min(f.width,h.width));isNaN(f.height)||(b=Math.min(f.height,h.height));a=Math.max(c,a);b=Math.max(d,b);var k=this.gb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.W.j;0!==l.length&&this.va.measure(this,a,b,l,e,c,d);a=e.width+k.left+k.right;k=e.height+k.top+k.bottom;
isFinite(f.width)&&(a=f.width);isFinite(f.height)&&(k=f.height);a=Math.min(h.width,a);k=Math.min(h.height,k);a=Math.max(g.width,a);k=Math.max(g.height,k);a=Math.max(c,a);k=Math.max(d,k);xc(e,a,k);xc(this.naturalBounds,a,k);Qk(this,0,0,a,k)};t.Ab=function(){if(null===this.oi){var a=this.W.j,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.isPanelMain)return this.oi=d}this.oi=a[0]}return this.oi};function fm(a){return null!==a.part?a.part.locationObject:null}
t.lh=function(a,b,c,d){var e=this.W.j;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.s()){a=Tk(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.Qg,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=ah);switch(a){case ah:if(b>c||f>d)this.o(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case ie:this.o(!0);this.measure(c+h,d+g,0,0);break;case Ek:this.o(!0);this.measure(c+h,f+g,0,0);break;case Fk:this.o(!0),this.measure(b+h,d+g,0,0)}}this.va.arrange(this,e,this.eg)}};
t.nh=function(a){var b=this.naturalBounds,c=fm(this);if(Gc(0,0,b.width,b.height,a.x,a.y)){b=this.W.j;for(var d=b.length,e=G.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(Yb(e.set(a),f.transform),f.ea(e))return G.free(e),!0}G.free(e);return null===this.jb&&null===this.fc?!1:!0}return!1};t.Ms=function(a){if(this.vk===a)return this;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d].Ms(a);if(null!==e)return e}return null};
t.sm=function(a,b){b(this,a);if(a instanceof W){a=a.W.j;for(var c=a.length,d=0;d<c;d++)this.sm(a[d],b)}};function vj(a,b){Im(a,a,b)}function Im(a,b,c){c(b);b=b.W.j;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof W&&Im(a,f,c)}}function Jm(a,b){Km(a,a,b)}function Km(a,b,c){c(b);if(b instanceof W){b=b.W.j;for(var d=b.length,e=0;e<d;e++)Km(a,b[e],c)}}t.Sl=function(a){return Lm(this,this,a)};
function Lm(a,b,c){if(c(b))return b;if(b instanceof W){b=b.W.j;for(var d=b.length,e=0;e<d;e++){var f=Lm(a,b[e],c);if(null!==f)return f}}return null}t.bb=function(a){if(this.name===a)return this;var b=this.W.j,c=b.length;null===this.ai&&null===this.he||(c=Mm(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof W){var f=e.bb(a);if(null!==f)return f}if(e.name===a)return e}return null};
function Nm(a){a=a.W.j;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];if(e instanceof W)c=Math.max(c,Nm(e));else if(e instanceof V){a:{switch(e.Mk){case "None":case "Square":case "Ellipse":case "Circle":case "LineH":case "LineV":case "FramedRectangle":case "RoundedRectangle":case "Line1":case "Line2":case "Border":case "Cube1":case "Cube2":case "Junction":case "Cylinder1":case "Cylinder2":case "Cylinder3":case "Cylinder4":case "PlusLine":case "XLine":case "ThinCross":case "ThickCross":e=0;break a}e=
e.ah/2*e.Aj*e.Be()}c=Math.max(c,e)}}return c}t.Yd=function(){return!(this.type===W.TableRow||this.type===W.TableColumn)};
t.Rb=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(kj(this))return null;var d=this.naturalBounds,e=1/this.Be(),f=this.Yd(),g=f?a:Yb(G.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.Wl("extraTouchArea"),l=k/2);if(Gc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.W.j;var m=e.length;h=G.alloc();l=(k=this.isClipping)?this.Ab():null;if(k&&(l.Yd()?Yb(h.set(a),l.transform):h.set(a),!l.ea(h)))return G.free(h),
f||G.free(g),null;for(var n=fm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.Yd()?Yb(h.set(a),p.transform):h.set(a),!k||p!==l){var q=null;p instanceof W?q=p.Rb(h,b,c):!0===p.pickable&&p.ea(h)&&(q=p);if(null!==q&&(null!==b&&(q=b(q)),null!==q&&(null===c||c(q))))return G.free(h),f||G.free(g),q}}G.free(h)}if(null===this.background&&null===this.areaBackground)return f||G.free(g),null;a=Gc(0,0,d.width,d.height,g.x,g.y)?this:null;f||G.free(g);return a}f||G.free(g);return null};
t.Sj=function(a,b,c,d){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);d instanceof E||d instanceof F||(d=new E);var e=this.naturalBounds,f=this.Yd(),g=f?a:Yb(G.allocAt(a.x,a.y),this.transform);e=Gc(0,0,e.width,e.height,g.x,g.y);if(this.type===W.TableRow||this.type===W.TableColumn||e){if(!this.isAtomic){for(var h=this.W.j,k=h.length,l=G.alloc(),m=fm(this);k--;){var n=h[k];if(n.visible||n===m){n.Yd()?Yb(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof W?n:null;(null!==
n?n.Sj(l,b,c,d):p.ea(l))&&!1!==p.pickable&&(null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||d.add(p))}}G.free(l)}f||G.free(g);return e&&(null!==this.background||null!==this.areaBackground)}f||G.free(g);return!1};
t.jg=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=Tc.alloc(),g.reset());g.multiply(this.transform);if(this.mh(a,g))return Om(this,b,c,e),void 0===f&&Tc.free(g),!0;if(this.Jc(a,g)){if(!this.isAtomic)for(var h=fm(this),k=this.W.j,l=k.length;l--;){var m=k[l];if(m.visible||m===h){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=m;m=m instanceof W?m:null;p=Tc.alloc();p.set(g);
if(null!==m?m.jg(a,b,c,d,e,p):Sk(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);Tc.free(p)}}}void 0===f&&Tc.free(g);return d}void 0===f&&Tc.free(g);return!1};function Om(a,b,c,d){for(var e=a.W.j,f=e.length;f--;){var g=e[f];if(g.visible){var h=g.actualBounds,k=a.naturalBounds;h.x>k.width||h.y>k.height||0>h.x+h.width||0>h.y+h.height||(g instanceof W&&Om(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}}
t.kg=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===c&&(c=null);void 0===d&&(d=null);var g=this.naturalBounds,h=this.Yd(),k=h?a:Yb(G.allocAt(a.x,a.y),this.transform),l=h?b:Yb(G.allocAt(b.x,b.y),this.transform),m=k.Ae(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||Zb(k.x,k.y,0,0,0,g.height)<=m||Zb(k.x,k.y,0,g.height,g.width,g.height)<=m||Zb(k.x,k.y,g.width,g.height,g.width,0)<=m||Zb(k.x,k.y,g.width,0,0,0)<=m;g=k.ed(0,0)<=m&&k.ed(0,g.height)<=m&&k.ed(g.width,0)<=m&&k.ed(g.width,g.height)<=
m;h||(G.free(k),G.free(l));if(n){if(!this.isAtomic){k=G.alloc();l=G.alloc();m=fm(this);for(var p=this.W.j,q=p.length;q--;){var r=p[q];if(r.visible||r===m){var u=r.actualBounds,v=this.naturalBounds;if(!h||!(u.x>v.width||u.y>v.height||0>u.x+u.width||0>u.y+u.height))if(r.Yd()?(u=r.transform,Yb(k.set(a),u),Yb(l.set(b),u)):(k.set(a),l.set(b)),u=r,r=r instanceof W?r:null,null!==r?r.kg(k,l,c,d,e,f):u.ex(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}G.free(k);G.free(l)}return e?n:g}return!1};
function km(a){var b=null;a instanceof V&&(b=a.spot1,b===Hd&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=cd);return b}function lm(a){var b=null;a instanceof V&&(b=a.spot2,b===Hd&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=pd);return b}t.add=function(a){this.Jb(this.W.count,a)};t.N=function(a){return this.W.N(a)};
t.Jb=function(a,b){b instanceof T&&A("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.ng(b))this===b&&A("Cannot make a Panel contain itself: "+this.toString()),A("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&A("Cannot add a GraphObject that already belongs to another Panel to this Panel: "+b.toString()+", already contained by "+c.toString()+", cannot be shared by this Panel: "+this.toString());
this.va!==W.Grid||b instanceof V||A("Can only add Shapes to a Grid Panel, not: "+b);this.va!==W.Graduated||b instanceof V||b instanceof th||A("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.Ki(this);b.sj=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Fd&&(this.Fd=new Pb),this.Fd.add(d,b))}var e=this.W;d=-1;if(c===this){for(var f=-1,g=this.W.j,h=g.length,k=0;k<h;k++)if(g[k]===b){f=k;break}if(-1!==f){if(f===a||f+1>=e.count&&a>=e.count)return;
e.nb(f);d=f}else A("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.Jb(a,b);if(0===a||b.isPanelMain)this.oi=null;jj(this)||this.o();b.o(!1);null!==b.portId?this.rh=!0:b instanceof W&&!0===b.rh&&(this.rh=!0);this.Jg=null;c=this.part;null!==c&&(c.nj=null,c.Rg=NaN,this.rh&&c instanceof U&&(c.rh=!0),c.rh&&c instanceof U&&(c.tc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.cb(jf,"elements",this,b,null,d,null),c.cb(hf,
"elements",this,null,b,null,a),this.og()||Pm(this,b,!1)))};function Qm(a,b){a.G=b?a.G|16777216:a.G&-16777217}t.remove=function(a){for(var b=this.W.j,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.zc(d,!0)};t.nb=function(a){0<=a&&this.zc(a,!0)};
t.zc=function(a,b){var c=this.W,d=c.N(a);d.sj=null;d.Ki(null);if(null!==this.Fd){var e=d.data;"object"===typeof e&&this.Fd.remove(e)}c.nb(a);ej(this,!1);this.o();this.oi===d&&(this.oi=null);this.Jg=null;var f=this.part;null!==f&&(f.nj=null,f.Rg=NaN,f.Kb(),f instanceof U&&(d instanceof W?d.sm(d,function(a,c){yl(f,c,b)}):yl(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.cb(jf,"elements",this,d,null,a,null))};
W.prototype.getRowDefinition=function(a){0>a&&xa(a,">= 0",W,"getRowDefinition:idx");a=Math.round(a);var b=this.tb;if(void 0===b)return null;if(void 0===b[a]){var c=new Kj;c.Ki(this);c.isRow=!0;c.index=a;b[a]=c}return b[a]};W.prototype.uv=function(a){0>a&&xa(a,">= 0",W,"removeRowDefinition:idx");a=Math.round(a);var b=this.tb;void 0!==b&&(this.cb(jf,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.o())};
W.prototype.getColumnDefinition=function(a){0>a&&xa(a,">= 0",W,"getColumnDefinition:idx");a=Math.round(a);var b=this.pb;if(void 0===b)return null;if(void 0===b[a]){var c=new Kj;c.Ki(this);c.isRow=!1;c.index=a;b[a]=c}return b[a]};t=W.prototype;t.sv=function(a){0>a&&xa(a,">= 0",W,"removeColumnDefinition:idx");a=Math.round(a);var b=this.pb;void 0!==b&&(this.cb(jf,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.o())};
t.Jy=function(a){if(0>a||this.type!==W.Table)return-1;for(var b=0,c=this.tb,d=c.length,e=this.si;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.Cy=function(a){if(0>a||this.type!==W.Table)return-1;for(var b=0,c=this.pb,d=c.length,e=this.ci;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};
t.az=function(a,b){void 0===b&&(b=new G(NaN,NaN));if(this.type!==W.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.Ab();c.geometry.Vu((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.ta(b)};t.bz=function(a){if(this.type!==W.Graduated)return NaN;var b=this.Ab();b.transform.Td(a);return b.geometry.ix(a)*this.graduatedRange+this.graduatedMin};function ql(a){a=a.Kh;return null!==a&&a.v}
function $g(a){var b=a.Kh;if(null===b)null!==a.data&&A("Template cannot have .data be non-null: "+a),a.Kh=b=new E;else if(b.v)return;var c=new E;Qm(a,!1);a.sm(a,function(a,d){var e=d.eb;if(null!==e)for(nl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===Rm&&nl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&Qm(a,!0),g=Pk(f,a,d),null!==g&&(c.add(g),null===g.wl&&(g.wl=new E),g.wl.add(f)));b.add(f)}if(d instanceof W&&d.type===W.Table){if(0<d.tb.length)for(a=d.tb,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!==
g&&null!==g.eb)for(var h=g.eb.iterator;h.next();){var k=h.value;k.Qd=g;k.qp=2;k.Gl=g.index;b.add(k)}if(0<d.pb.length)for(d=d.pb,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.eb)for(g=f.eb.iterator;g.next();)h=g.value,h.Qd=f,h.qp=1,h.Gl=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.wl){nl(e,!0);for(var f=e.wl.iterator;f.next();){var g=f.value;null===e.eb&&(e.eb=new E);e.eb.add(g)}}e.wl=null}for(d=b.iterator;d.next();)if(e=d.value,f=e.Qd,null!==f){e.Qd=null;var h=
e.targetProperty,k=h.indexOf(".");0<k&&f instanceof W&&(g=h.substring(0,k),h=h.substr(k+1),k=f.bb(g),null!==k?(f=k,e.targetProperty=h):ya('Warning: unable to find GraphObject named "'+g+'" for Binding: '+e.toString()));f instanceof Kj?(g=Fb(f.panel),e.Oi=void 0===g?-1:g,f.panel.vk=e.Oi):f instanceof Y?(g=Fb(f),e.Oi=void 0===g?-1:g,f.vk=e.Oi):A("Unknown type of binding target: "+f)}b.freeze();a instanceof T&&a.cc()&&a.ac()}
t.py=function(){var a=this.copy();Jm(a,function(a){a instanceof W&&(a.Kh=null,a.kb=null);var b=a.eb;null!==b&&(a.eb=null,b.each(function(b){a.bind(b.copy())}))});return a};
t.Da=function(a){var b=this.Kh;if(null!==b)for(void 0===a&&(a=""),b=b.iterator;b.next();){var c=b.value,d=c.sourceProperty;if(""===a||""===d||d===a)if(d=c.targetProperty,null!==c.converter||""!==d){d=this.data;var e=c.sourceName;if(null!==e)d=""===e?this:"/"===e?this:"."===e?this:".."===e?this:this.bb(e);else{var f=this.diagram;null!==f&&c.isToModel&&(d=f.model.modelData)}if(null!==d){f=this;var g=c.Oi;if(-1!==g){if(f=this.Ms(g),null===f)continue}else null!==c.Qd&&(f=c.Qd);"/"===e?d=f.part:"."===
e?d=f:".."===e&&(d=f.panel);e=c.qp;if(0!==e){if(!(f instanceof W))continue;1===e?f=f.getColumnDefinition(c.Gl):2===e&&(f=f.getRowDefinition(c.Gl))}void 0!==f&&c.Rv(f,d)}}}};function Sm(a,b){a=a.W.j;for(var c=a.length,d=b.length,e=0,f=null;e<c&&!(f=a[e],f instanceof W&&null!==f.data);)e++,f=a[e];if(c-e!==d)return!0;if(null===f)return 0<d;for(var g=0;e<c&&g<d;){f=a[e];if(!(f instanceof W)||f.data!==b[g])return!0;e++;g++}return!1}
function Mm(a){if(a.type===W.Spot||a.type===W.Auto)return Math.min(a.W.length,1);if(a.type===W.Link){a=a.W;for(var b=a.length,c=0;c<b;c++){var d=a.N(c);if(!(d instanceof V&&d.isPanelMain))break}return c}return a.type===W.Table&&0<a.W.length&&(a=a.W.N(0),a.isPanelMain&&a instanceof W&&(a.type===W.TableRow||a.type===W.TableColumn))?1:0}t.jt=function(){for(var a=Mm(this);this.W.length>a;)this.zc(this.W.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;c<b;c++)Tm(this,a[c],c)};
t.bx=function(a){return void 0===a||null===a||null===this.Fd?null:this.Fd.J(a)};
function Tm(a,b,c){if(!(void 0===b||null===b||0>c)){var d=Um(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.J(d));null===f&&(Vm||(Vm=!0,ya('No item template Panel found for category "'+d+'" on '+a),ya(" Using default item template."),d=new W,e=new th,e.bind(new Ai("text","",Qa)),d.add(e),Wm=d),f=Wm);d=f;null!==d&&($g(d),d=d.copy(),0!==(d.G&16777216)&&(e=a.ph(),null!==e&&Qm(e,!0)),"object"===typeof b&&(null===a.Fd&&(a.Fd=new Pb),a.Fd.add(b,d)),e=c+Mm(a),a.Jb(e,d),d.kb=b,Xm(a,e,c),d.kb=null,d.data=
b)}}function Xm(a,b,c){for(a=a.W;b<a.length;){var d=a.N(b);if(d instanceof W){var e=b,f=c;d.type===W.TableRow?d.row=e:d.type===W.TableColumn&&(d.column=e);d.itemIndex=f}b++;c++}}function Um(a,b){if(null===b)return"";a=a.Yk;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=Ym(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;A("Panel.getCategoryForItemData found a non-string category for "+b+": "+a);return""}
function Pm(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof W){b=b.W.j;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof W&&!f.isEnabled||Pm(a,f,c)}}}function Zm(a,b){ul.add(a,b)}
pa.Object.defineProperties(W.prototype,{type:{get:function(){return this.va},set:function(a){var b=this.va;b!==a&&(this.va=a,this.va===W.Grid?this.isAtomic=!0:this.va===W.Table&&Dm(this),this.o(),this.g("type",b,a))}},elements:{get:function(){return this.W.iterator}},naturalBounds:{get:function(){return this.jc}},padding:{get:function(){return this.gb},set:function(a){"number"===
typeof a?(0>a&&xa(a,">= 0",W,"padding"),a=new Lc(a)):(0>a.left&&xa(a.left,">= 0",W,"padding:value.left"),0>a.right&&xa(a.right,">= 0",W,"padding:value.right"),0>a.top&&xa(a.top,">= 0",W,"padding:value.top"),0>a.bottom&&xa(a.bottom,">= 0",W,"padding:value.bottom"));var b=this.gb;b.A(a)||(this.gb=a=a.I(),this.o(),this.g("padding",b,a))}},defaultAlignment:{get:function(){return this.gn},set:function(a){var b=this.gn;b.A(a)||(this.gn=a=a.I(),this.o(),this.g("defaultAlignment",
b,a))}},defaultStretch:{get:function(){return this.Af},set:function(a){var b=this.Af;b!==a&&(this.Af=a,this.o(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{get:function(){return void 0===this.Vi?Rc:this.Vi},set:function(a){if(void 0!==this.Vi){"number"===typeof a&&(a=new Lc(a));var b=this.Vi;b.A(a)||(this.Vi=a=a.I(),this.o(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{get:function(){return void 0===
this.Ph?null:this.Ph},set:function(a){var b=this.Ph;b!==a&&(null===a||"string"===typeof a||a instanceof bl)&&(a instanceof bl&&a.freeze(),this.Ph=a,this.R(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{get:function(){return void 0===this.Dg?1:this.Dg},set:function(a){if(void 0!==this.Dg){var b=this.Dg;b!==a&&isFinite(a)&&0<=a&&(this.Dg=a,this.o(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{
get:function(){return void 0===this.Oh?null:this.Oh},set:function(a){if(void 0!==this.Oh){var b=this.Oh;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||A("defaultRowSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Oh=a;this.R();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{get:function(){return void 0===
this.Bg?null:this.Bg},set:function(a){if(void 0!==this.Bg){var b=this.Bg;b!==a&&(null===a||"string"===typeof a||a instanceof bl)&&(a instanceof bl&&a.freeze(),this.Bg=a,this.R(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{get:function(){return void 0===this.Cg?1:this.Cg},set:function(a){if(void 0!==this.Cg){var b=this.Cg;b!==a&&isFinite(a)&&0<=a&&(this.Cg=a,this.o(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{
get:function(){return void 0===this.Nh?null:this.Nh},set:function(a){if(void 0!==this.Nh){var b=this.Nh;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=f&&isFinite(f)||A("defaultColumnSeparatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Nh=a;this.R();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{get:function(){return this.Ap},
set:function(a){var b=this.Ap;b!==a&&(this.Ap=a,this.o(),this.g("viewboxStretch",b,a))}},gridCellSize:{get:function(){return this.Fn},set:function(a){var b=this.Fn;if(!b.A(a)){a.s()&&0!==a.width&&0!==a.height||A("Invalid Panel.gridCellSize: "+a);this.Fn=a.I();var c=this.diagram;null!==c&&this===c.grid&&fj(c);this.R();this.g("gridCellSize",b,a)}}},gridOrigin:{get:function(){return this.Gn},set:function(a){var b=this.Gn;if(!b.A(a)){a.s()||
A("Invalid Panel.gridOrigin: "+a);this.Gn=a.I();var c=this.diagram;null!==c&&this===c.grid&&fj(c);this.R();this.g("gridOrigin",b,a)}}},graduatedMin:{get:function(){return this.Cn},set:function(a){var b=this.Cn;b!==a&&(this.Cn=a,this.o(),this.g("graduatedMin",b,a),Nk(this)&&(a=this.part,null!==a&&Ok(this,a,"graduatedRange")))}},graduatedMax:{get:function(){return this.Bn},set:function(a){var b=this.Bn;b!==a&&(this.Bn=a,this.o(),this.g("graduatedMax",
b,a),Nk(this)&&(a=this.part,null!==a&&Ok(this,a,"graduatedRange")))}},graduatedRange:{get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{get:function(){return this.En},set:function(a){var b=this.En;b!==a&&0<a&&(this.En=a,this.o(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{get:function(){return this.Dn},set:function(a){var b=this.Dn;b!==a&&(this.Dn=a,this.o(),this.g("graduatedTickBase",
b,a))}},rh:{get:function(){return 0!==(this.G&8388608)},set:function(a){0!==(this.G&8388608)!==a&&(this.G^=8388608)}},rowCount:{get:function(){return void 0===this.tb?0:this.tb.length}},columnCount:{get:function(){return void 0===this.pb?0:this.pb.length}},rowSizing:{get:function(){return void 0===this.xj?Em:this.xj},set:function(a){if(void 0!==this.xj){var b=this.xj;b!==a&&(this.xj=
a,this.o(),this.g("rowSizing",b,a))}}},columnSizing:{get:function(){return void 0===this.Ti?Em:this.Ti},set:function(a){if(void 0!==this.Ti){var b=this.Ti;b!==a&&(this.Ti=a,this.o(),this.g("columnSizing",b,a))}}},topIndex:{get:function(){return void 0===this.si?0:this.si},set:function(a){if(void 0!==this.si){var b=this.si;b!==a&&((!isFinite(a)||0>a)&&A("Panel.topIndex must be greater than zero and a real number, not: "+a),this.si=a,this.o(),
this.g("topIndex",b,a))}}},leftIndex:{get:function(){return void 0===this.ci?0:this.ci},set:function(a){if(void 0!==this.ci){var b=this.ci;b!==a&&((!isFinite(a)||0>a)&&A("Panel.leftIndex must be greater than zero and a real number, not: "+a),this.ci=a,this.o(),this.g("leftIndex",b,a))}}},data:{get:function(){return this.kb},set:function(a){var b=this.kb;if(b!==a){var c=this instanceof T&&!(this instanceof sf);$g(this);this.kb=a;var d=this.diagram;
null!==d&&(c?(c=d.partManager,this instanceof S?(null!==b&&c.Ag.remove(b),null!==a&&c.Ag.add(a,this)):this instanceof T&&(null!==b&&c.Me.remove(b),null!==a&&c.Me.add(a,this))):(c=this.panel,null!==c&&null!==c.Fd&&(null!==b&&c.Fd.remove(b),null!==a&&c.Fd.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Da()}}},itemIndex:{get:function(){return this.Tn},set:function(a){var b=this.Tn;b!==a&&(this.Tn=a,this.g("itemIndex",b,a))}},itemArray:{
get:function(){return this.ai},set:function(a){var b=this.ai;if(b!==a||null!==a&&Sm(this,a)){var c=this.diagram;b!==a&&(null!==c&&null!==b&&Bj(c.partManager,this),this.ai=a,null!==c&&null!==a&&xj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.jt()}}},itemTemplate:{get:function(){return null===this.he?null:this.he.J("")},set:function(a){if(null===this.he){if(null===a)return;this.he=new Pb}var b=this.he.J("");b!==
a&&((a instanceof T||a.isPanelMain)&&A("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+a),this.he.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.jt())}},itemTemplateMap:{get:function(){return this.he},set:function(a){var b=this.he;if(b!==a){for(var c=a.iterator;c.next(););this.he=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing||this.jt()}}},itemCategoryProperty:{
get:function(){return this.Yk},set:function(a){var b=this.Yk;b!==a&&(this.Yk=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{get:function(){return 0!==(this.G&1048576)},set:function(a){var b=0!==(this.G&1048576);b!==a&&(this.G^=1048576,this.g("isAtomic",b,a))}},isClipping:{get:function(){return 0!==(this.G&2097152)},set:function(a){var b=0!==(this.G&2097152);b!==a&&(this.G^=2097152,this.o(),this.g("isClipping",b,a))}},isOpposite:{
get:function(){return 0!==(this.G&33554432)},set:function(a){var b=0!==(this.G&33554432);b!==a&&(this.G^=33554432,this.o(),this.g("isOpposite",b,a))}},isEnabled:{get:function(){return 0!==(this.G&4194304)},set:function(a){var b=0!==(this.G&4194304);if(b!==a){var c=null===this.panel||this.panel.og();this.G^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&Pm(this,this,a)}}},alignmentFocusName:{
get:function(){return this.vg},set:function(a){var b=this.vg;b!==a&&(this.vg=a,this.o(),this.g("alignmentFocusName",b,a))}}});
pa.Object.defineProperties(W,{Position:{get:function(){return ul.J("Position")}},Horizontal:{get:function(){return ul.J("Horizontal")}},Vertical:{get:function(){return ul.J("Vertical")}},Spot:{get:function(){return ul.J("Spot")}},Auto:{get:function(){return ul.J("Auto")}},Table:{get:function(){return ul.J("Table")}},Viewbox:{
get:function(){return ul.J("Viewbox")}},TableRow:{get:function(){return ul.J("TableRow")}},TableColumn:{get:function(){return ul.J("TableColumn")}},Link:{get:function(){return ul.J("Link")}},Grid:{get:function(){return ul.J("Grid")}},Graduated:{get:function(){return ul.J("Graduated")}}});W.prototype.findItemPanelForData=W.prototype.bx;
W.prototype.rebuildItemElements=W.prototype.jt;W.prototype.updateTargetBindings=W.prototype.Da;W.prototype.copyTemplate=W.prototype.py;W.prototype.graduatedValueForPoint=W.prototype.bz;W.prototype.graduatedPointForValue=W.prototype.az;W.prototype.findColumnForLocalX=W.prototype.Cy;W.prototype.findRowForLocalY=W.prototype.Jy;W.prototype.removeColumnDefinition=W.prototype.sv;W.prototype.removeRowDefinition=W.prototype.uv;W.prototype.removeAt=W.prototype.nb;W.prototype.remove=W.prototype.remove;
W.prototype.insertAt=W.prototype.Jb;W.prototype.elt=W.prototype.N;W.prototype.add=W.prototype.add;W.prototype.findObject=W.prototype.bb;W.prototype.findInVisualTree=W.prototype.Sl;W.prototype.walkVisualTreeFrom=W.prototype.sm;W.prototype.findMainElement=W.prototype.Ab;var Vm=!1,Wm=null,ul=new Pb;W.className="Panel";W.definePanelLayout=Zm;Zm("Position",new em);Zm("Vertical",new hm);Zm("Auto",new jm);Zm("Link",new tm);Zm("Grid",new sm);
function Kj(){tb(this);this.Yf=null;this.yr=!0;this.Qa=0;this.Qc=NaN;this.Tg=0;this.Sg=Infinity;this.xb=Hd;this.sa=this.ka=0;this.eb=null;this.jp=$m;this.se=Dk;this.fp=this.ag=null;this.gp=NaN;this.jb=this.yj=null;this.bn=!1}
Kj.prototype.copy=function(){var a=new Kj;a.yr=this.yr;a.Qa=this.Qa;a.Qc=this.Qc;a.Tg=this.Tg;a.Sg=this.Sg;a.xb=this.xb;a.ka=this.ka;a.sa=this.sa;a.se=this.se;a.jp=this.jp;null===this.ag?a.ag=null:a.ag=this.ag.I();a.fp=this.fp;a.gp=this.gp;a.yj=null;null!==this.yj&&(a.separatorDashArray=Fa(this.separatorDashArray));a.jb=this.jb;a.bn=this.bn;a.eb=this.eb;return a};t=Kj.prototype;
t.Pl=function(a){a.isRow?this.height=a.height:this.width=a.width;this.minimum=a.minimum;this.maximum=a.maximum;this.alignment=a.alignment;this.stretch=a.stretch;this.sizing=a.sizing;this.ag=null===a.separatorPadding?null:a.separatorPadding.I();this.separatorStroke=a.separatorStroke;this.separatorStrokeWidth=a.separatorStrokeWidth;this.yj=null;a.separatorDashArray&&(this.yj=Fa(a.separatorDashArray));this.background=a.background;this.coversSeparators=a.coversSeparators;this.eb=a.eb};
t.hb=function(a){a.classType===Kj&&(this.sizing=a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+Fb(this)};t.Ki=function(a){this.Yf=a};
t.Hu=function(){var a=0,b=0,c=this.Yf,d=this.isRow;if(null!==c&&c.type===W.Table)for(var e=d?c.tb.length:c.pb.length,f=0;f<e;f++){var g=d?c.tb[f]:c.pb[f];if(void 0!==g){b=g.index;break}}this.index!==b&&(b=this.separatorStroke,null===b&&null!==c&&(b=this.isRow?c.defaultRowSeparatorStroke:c.defaultColumnSeparatorStroke),null!==b&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==c?a=this.isRow?c.defaultRowSeparatorStrokeWidth:c.defaultColumnSeparatorStrokeWidth:a=0)));b=this.ag;if(null===b)if(null!==c)b=
c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)};
t.vc=function(){var a=0,b=this.Yf,c=0,d=this.isRow;if(null!==b&&b.type===W.Table)for(var e=d?b.tb.length:b.pb.length,f=0;f<e;f++){var g=d?b.tb[f]:b.pb[f];if(void 0!==g){c=g.index;break}}this.index!==c&&(c=this.separatorStroke,null===c&&null!==b&&(c=d?b.defaultRowSeparatorStroke:b.defaultColumnSeparatorStroke),null!==c&&(a=this.separatorStrokeWidth,isNaN(a)&&(null!==b?a=d?b.defaultRowSeparatorStrokeWidth:b.defaultColumnSeparatorStrokeWidth:a=0)));d=this.ag;if(null===d)if(null!==b)d=b.defaultSeparatorPadding;
else return a;return a+(this.isRow?d.top+d.bottom:d.left+d.right)};t.zb=function(a,b,c){var d=this.Yf;if(null!==d&&(d.cb(df,a,this,b,c,void 0,void 0),null!==this.eb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.ph(),null!==d&&(b=d.data,null!==b)))))for(c=this.eb.iterator;c.next();)c.value.qq(this,b,a,d)};function nm(a){if(a.sizing===$m){var b=a.Yf;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing}
t.bind=function(a){a.Qd=this;var b=this.panel;if(null!==b){var c=b.ph();null!==c&&ql(c)&&A("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.eb&&(this.eb=new E);this.eb.add(a)};
pa.Object.defineProperties(Kj.prototype,{panel:{get:function(){return this.Yf}},isRow:{get:function(){return this.yr},set:function(a){this.yr=a}},index:{get:function(){return this.Qa},set:function(a){this.Qa=a}},height:{get:function(){return this.Qc},set:function(a){var b=this.Qc;b!==a&&(0>a&&xa(a,">= 0",Kj,"height"),this.Qc=a,this.actual=this.ka,null!==this.panel&&this.panel.o(),
this.zb("height",b,a))}},width:{get:function(){return this.Qc},set:function(a){var b=this.Qc;b!==a&&(0>a&&xa(a,">= 0",Kj,"width"),this.Qc=a,this.actual=this.ka,null!==this.panel&&this.panel.o(),this.zb("width",b,a))}},minimum:{get:function(){return this.Tg},set:function(a){var b=this.Tg;b!==a&&((0>a||!isFinite(a))&&xa(a,">= 0",Kj,"minimum"),this.Tg=a,this.actual=this.ka,null!==this.panel&&this.panel.o(),this.zb("minimum",b,a))}},maximum:{
get:function(){return this.Sg},set:function(a){var b=this.Sg;b!==a&&(0>a&&xa(a,">= 0",Kj,"maximum"),this.Sg=a,this.actual=this.ka,null!==this.panel&&this.panel.o(),this.zb("maximum",b,a))}},alignment:{get:function(){return this.xb},set:function(a){var b=this.xb;b.A(a)||(this.xb=a.I(),null!==this.panel&&this.panel.o(),this.zb("alignment",b,a))}},stretch:{get:function(){return this.se},set:function(a){var b=this.se;b!==a&&(this.se=
a,null!==this.panel&&this.panel.o(),this.zb("stretch",b,a))}},separatorPadding:{get:function(){return this.ag},set:function(a){"number"===typeof a&&(a=new Lc(a));var b=this.ag;null!==a&&null!==b&&b.A(a)||(null!==a&&(a=a.I()),this.ag=a,null!==this.panel&&this.panel.o(),this.zb("separatorPadding",b,a))}},separatorStroke:{get:function(){return this.fp},set:function(a){var b=this.fp;b!==a&&(null===a||"string"===typeof a||a instanceof bl)&&(a instanceof
bl&&a.freeze(),this.fp=a,null!==this.panel&&this.panel.o(),this.zb("separatorStroke",b,a))}},separatorStrokeWidth:{get:function(){return this.gp},set:function(a){var b=this.gp;b!==a&&(this.gp=a,null!==this.panel&&this.panel.o(),this.zb("separatorStrokeWidth",b,a))}},separatorDashArray:{get:function(){return this.yj},set:function(a){var b=this.yj;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];"number"===typeof f&&0<=
f&&isFinite(f)||A("separatorDashArray value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.yj=a;null!==this.panel&&this.panel.R();this.zb("separatorDashArray",b,a)}}},background:{get:function(){return this.jb},set:function(a){var b=this.jb;b!==a&&(null===a||"string"===typeof a||a instanceof bl)&&(a instanceof bl&&a.freeze(),this.jb=a,null!==this.panel&&this.panel.R(),this.zb("background",b,a))}},coversSeparators:{
get:function(){return this.bn},set:function(a){var b=this.bn;b!==a&&(this.bn=a,null!==this.panel&&this.panel.R(),this.zb("coversSeparators",b,a))}},sizing:{get:function(){return this.jp},set:function(a){var b=this.jp;b!==a&&(this.jp=a,null!==this.panel&&this.panel.o(),this.zb("sizing",b,a))}},actual:{get:function(){return this.ka},set:function(a){this.ka=isNaN(this.Qc)?Math.max(Math.min(this.Sg,a),this.Tg):Math.max(Math.min(this.Sg,
this.Qc),this.Tg)}},total:{get:function(){return this.ka+this.vc()},set:function(a){this.ka=isNaN(this.Qc)?Math.max(Math.min(this.Sg,a),this.Tg):Math.max(Math.min(this.Sg,this.Qc),this.Tg);this.ka=Math.max(0,this.ka-this.vc())}},position:{get:function(){return this.sa},set:function(a){this.sa=a}}});Kj.prototype.bind=Kj.prototype.bind;Kj.prototype.computeEffectiveSpacing=Kj.prototype.vc;Kj.prototype.computeEffectiveSpacingTop=Kj.prototype.Hu;
var $m=new D(Kj,"Default",0),om=new D(Kj,"None",1),Em=new D(Kj,"ProportionalExtra",2);Kj.className="RowColumnDefinition";Kj.Default=$m;Kj.None=om;Kj.ProportionalExtra=Em;function V(){Y.call(this);this.Pd=this.qa=null;this.Mk="None";this.An=Dk;this.Hc=this.Nk="black";this.ah=1;this.zl="butt";this.Cl="miter";this.Aj=10;this.Al=null;this.Bl=0;this.bf=this.af=Hd;this.Fo=this.Eo=NaN;this.Kn=!1;this.Ho=null;this.Pk=this.Il="None";this.Dd=1;this.Cd=0;this.Ad=1;this.Bd=null}oa(V,Y);
V.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.qa=this.qa;a.Mk=this.Mk;a.An=this.An;a.Pd=this.Pd;a.Nk=this.Nk;a.Hc=this.Hc;a.ah=this.ah;a.zl=this.zl;a.Cl=this.Cl;a.Aj=this.Aj;null!==this.Al&&(a.Al=Fa(this.Al));a.Bl=this.Bl;a.af=this.af.I();a.bf=this.bf.I();a.Eo=this.Eo;a.Fo=this.Fo;a.Kn=this.Kn;a.Ho=this.Ho;a.Il=this.Il;a.Pk=this.Pk;a.Dd=this.Dd;a.Cd=this.Cd;a.Ad=this.Ad;a.Bd=this.Bd};t=V.prototype;
t.hb=function(a){a===ah||a===ch||a===Gk||a===Dk?this.geometryStretch=a:Y.prototype.hb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+Fb(this)};
function an(a,b,c,d){var e=c.length;if(!(4>e)){var f=d.measuredBounds,g=Math.max(1,f.width);f=f.height;for(var h=c[0],k=c[1],l,m,n,p,q,r,u=0,v=Ka(),x=2;x<e;x+=2)l=c[x],m=c[x+1],n=l-h,h=m-k,0===n&&(n=.001),p=h/n,q=Math.atan2(h,n),r=Math.sqrt(n*n+h*h),v.push([n,q,p,r]),u+=r,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof V&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;x=0;r=v[x];n=r[0];q=r[1];p=r[2];r=r[3];for(var y=0;.1<=u;){0===y&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1));if(e>
u){Oa(v);return}e>r?(y=e-r,e=r):y=0;var z=Math.sqrt(e*e/(1+p*p));0>n&&(z=-z);h+=z;k+=p*z;a.translate(h,k);a.rotate(q);a.translate(-(g/2),-(f/2));0===y&&d.xi(a,b);a.translate(g/2,f/2);a.rotate(-q);a.translate(-h,-k);u-=e;r-=e;if(0!==y){x++;if(x===v.length){Oa(v);return}r=v[x];n=r[0];q=r[1];p=r[2];r=r[3];e=y}}Oa(v)}}
t.xi=function(a,b){var c=this.Hc,d=this.Nk;if(null!==c||null!==d){var e=this.actualBounds,f=this.naturalBounds;null!==d&&fi(this,a,d,!0,!1,f,e);null!==c&&fi(this,a,c,!1,!1,f,e);e=this.part;f=this.ah;0===f&&null!==e&&(f=e instanceof sf&&e.type===W.Link&&"Selection"===e.category&&e.adornedObject instanceof V&&e.adornedPart.Ab()===e.adornedObject?e.adornedObject.strokeWidth:0);a.lineWidth=f;a.lineJoin=this.Cl;a.lineCap=this.zl;a.miterLimit=this.Aj;var g=!1;e&&b.Ce("drawShadows")&&(g=e.isShadowed);var h=
!0;null!==c&&null===d&&(h=!1);e=!1;var k=this.strokeDashArray;null!==k&&(e=!0,a.Ls(k,this.Bl));var l=this.qa;if(null!==l){if(l.type===je)a.beginPath(),a.moveTo(l.startX,l.startY),a.lineTo(l.endX,l.endY),null!==d&&a.Sd(d),0!==f&&null!==c&&a.Ni();else if(l.type===ne){var m=l.startX,n=l.startY,p=l.endX,q=l.endY;k=Math.min(m,p);l=Math.min(n,q);m=Math.abs(p-m);n=Math.abs(q-n);null!==d&&(a.beginPath(),a.rect(k,l,m,n),a.Sd(d));null!==c&&(p=d=c=0,h&&g&&(c=a.shadowOffsetX,d=a.shadowOffsetY,p=a.shadowBlur,
a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),0!==f&&(a.beginPath(),a.rect(k,l,m,n),a.Ni()),h&&g&&(a.shadowOffsetX=c,a.shadowOffsetY=d,a.shadowBlur=p))}else if(l.type===re)n=l.startX,k=l.startY,p=l.endX,q=l.endY,l=Math.abs(p-n)/2,m=Math.abs(q-k)/2,n=Math.min(n,p)+l,k=Math.min(k,q)+m,a.beginPath(),a.moveTo(n,k-m),a.bezierCurveTo(n+H.ug*l,k-m,n+l,k-H.ug*m,n+l,k),a.bezierCurveTo(n+l,k+H.ug*m,n+H.ug*l,k+m,n,k+m),a.bezierCurveTo(n-H.ug*l,k+m,n-l,k+H.ug*m,n-l,k),a.bezierCurveTo(n-l,k-H.ug*m,n-H.ug*
l,k-m,n,k-m),a.closePath(),null!==d&&a.Sd(d),0!==f&&null!==c&&(h&&g?(f=a.shadowOffsetX,g=a.shadowOffsetY,c=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0,a.Ni(),a.shadowOffsetX=f,a.shadowOffsetY=g,a.shadowBlur=c):a.Ni());else if(l.type===he)for(k=l.figures,l=k.length,m=0;m<l;m++){n=k.j[m];a.beginPath();a.moveTo(n.startX,n.startY);p=n.segments.j;q=p.length;for(var r=null,u=0;u<q;u++){var v=p[u];switch(v.type){case Ce:a.moveTo(v.endX,v.endY);break;case le:a.lineTo(v.endX,v.endY);break;
case De:a.bezierCurveTo(v.point1X,v.point1Y,v.point2X,v.point2Y,v.endX,v.endY);break;case Ee:a.quadraticCurveTo(v.point1X,v.point1Y,v.endX,v.endY);break;case Fe:if(v.radiusX===v.radiusY){var x=Math.PI/180;a.arc(v.point1X,v.point1Y,v.radiusX,v.startAngle*x,(v.startAngle+v.sweepAngle)*x,0>v.sweepAngle,null!==r?r.endX:n.startX,null!==r?r.endY:n.startY)}else if(r=Se(v,n),x=r.length,0===x)a.lineTo(v.centerX,v.centerY);else for(var y=0;y<x;y++){var z=r[y];0===y&&a.lineTo(z[0],z[1]);a.bezierCurveTo(z[2],
z[3],z[4],z[5],z[6],z[7])}break;case Re:y=x=0;if(null!==r&&r.type===Fe){r=Se(r,n);z=r.length;if(0===z){a.lineTo(v.centerX,v.centerY);break}r=r[z-1]||null;null!==r&&(x=r[6],y=r[7])}else x=null!==r?r.endX:n.startX,y=null!==r?r.endY:n.startY;r=Te(v,n,x,y);x=r.length;if(0===x){a.lineTo(v.centerX,v.centerY);break}for(y=0;y<x;y++)z=r[y],a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7]);break;default:A("Segment not of valid type: "+v.type)}v.isClosed&&a.closePath();r=v}g?(u=q=p=0,n.isShadowed?(!0===n.isFilled&&
null!==d?(a.Sd(d),h=!0):h=!1,0!==f&&null!==c&&(h&&(p=a.shadowOffsetX,q=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),a.Ni(),h&&(a.shadowOffsetX=p,a.shadowOffsetY=q,a.shadowBlur=u))):(h&&(p=a.shadowOffsetX,q=a.shadowOffsetY,u=a.shadowBlur,a.shadowOffsetX=0,a.shadowOffsetY=0,a.shadowBlur=0),!0===n.isFilled&&null!==d&&a.Sd(d),0!==f&&null!==c&&a.Ni(),h&&(a.shadowOffsetX=p,a.shadowOffsetY=q,a.shadowBlur=u))):(!0===n.isFilled&&null!==d&&a.Sd(d),0!==f&&null!==c&&a.Ni())}e&&
a.Is();if(null!==this.pathPattern){e=this.pathPattern;e.measure(Infinity,Infinity);f=e.measuredBounds;e.arrange(0,0,f.width,f.height);g=this.geometry;a.save();a.beginPath();f=Ka();if(g.type===je)f.push(g.startX),f.push(g.startY),f.push(g.endX),f.push(g.endY),an(a,b,f,e);else if(g.type===he)for(g=g.figures.iterator;g.next();){c=g.value;f.length=0;f.push(c.startX);f.push(c.startY);d=c.startX;h=c.startY;k=d;l=h;m=c.segments.j;n=m.length;for(p=0;p<n;p++){q=m[p];switch(q.type){case Ce:an(a,b,f,e);f.length=
0;f.push(q.endX);f.push(q.endY);d=q.endX;h=q.endY;k=d;l=h;break;case le:f.push(q.endX);f.push(q.endY);d=q.endX;h=q.endY;break;case De:H.xe(d,h,q.point1X,q.point1Y,q.point2X,q.point2Y,q.endX,q.endY,.5,f);d=q.endX;h=q.endY;break;case Ee:H.eq(d,h,q.point1X,q.point1Y,q.endX,q.endY,.5,f);d=q.endX;h=q.endY;break;case Fe:u=Se(q,c);v=u.length;if(0===v){f.push(q.centerX);f.push(q.centerY);d=q.centerX;h=q.centerY;break}for(r=0;r<v;r++)x=u[r],H.xe(d,h,x[2],x[3],x[4],x[5],x[6],x[7],.5,f),d=x[6],h=x[7];break;
case Re:u=Te(q,c,d,h);v=u.length;if(0===v){f.push(q.centerX);f.push(q.centerY);d=q.centerX;h=q.centerY;break}for(r=0;r<v;r++)x=u[r],H.xe(d,h,x[2],x[3],x[4],x[5],x[6],x[7],.5,f),d=x[6],h=x[7];break;default:A("Segment not of valid type: "+q.type)}q.isClosed&&(f.push(k),f.push(l),an(a,b,f,e))}an(a,b,f,e)}else if(g.type===ne)f.push(g.startX),f.push(g.startY),f.push(g.endX),f.push(g.startY),f.push(g.endX),f.push(g.endY),f.push(g.startX),f.push(g.endY),f.push(g.startX),f.push(g.startY),an(a,b,f,e);else if(g.type===
re){h=new Xe;h.startX=g.endX;h.startY=(g.startY+g.endY)/2;d=new Ye(Fe);d.startAngle=0;d.sweepAngle=360;d.centerX=(g.startX+g.endX)/2;d.centerY=(g.startY+g.endY)/2;d.radiusX=Math.abs(g.startX-g.endX)/2;d.radiusY=Math.abs(g.startY-g.endY)/2;h.add(d);g=Se(d,h);c=g.length;if(0===c)f.push(d.centerX),f.push(d.centerY);else for(d=h.startX,h=h.startY,k=0;k<c;k++)l=g[k],H.xe(d,h,l[2],l[3],l[4],l[5],l[6],l[7],.5,f),d=l[6],h=l[7];an(a,b,f,e)}Oa(f);a.restore();a.Sc(!1)}}}};
t.ma=function(a,b){void 0===b&&(b=new G);if(a instanceof O){a.mc()&&A("getDocumentPoint Spot must be a real, specific Spot, not: "+a.toString());var c=this.naturalBounds,d=this.strokeWidth;b.h(a.x*(c.width+d)-d/2+c.x+a.offsetX,a.y*(c.height+d)-d/2+c.y+a.offsetY)}else b.set(a);this.td.ta(b);return b};
t.Qp=function(a){void 0===a&&(a=new N);var b=this.naturalBounds,c=this.td;b=N.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Vc(d/2,d/2);d=G.allocAt(b.x,b.y).transform(c);a.h(d.x,d.y,0,0);d.h(b.right,b.y).transform(c);Fc(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);Fc(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);Fc(a,d.x,d.y,0,0);N.free(b);G.free(d);return a};
t.nh=function(a,b){var c=this.geometry;if(null===c||null===this.fill&&null===this.stroke)return!1;var d=c.bounds,e=this.strokeWidth/2;c.type!==je||b||(e+=2);var f=N.alloc();f.assign(d);f.Vc(e+2,e+2);if(!f.ea(a))return N.free(f),!1;d=e+1E-4;if(c.type===je){if(null===this.stroke)return!1;d=(c.endX-c.startX)*(a.x-c.startX)+(c.endY-c.startY)*(a.y-c.startY);if(0>(c.startX-c.endX)*(a.x-c.endX)+(c.startY-c.endY)*(a.y-c.endY)||0>d)return!1;N.free(f);return H.Sb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type===
ne){b=c.startX;var g=c.startY,h=c.endX;c=c.endY;f.x=Math.min(b,h);f.y=Math.min(g,c);f.width=Math.abs(h-b);f.height=Math.abs(c-g);if(null===this.fill){f.Vc(-d,-d);if(f.ea(a))return N.free(f),!1;f.Vc(d,d)}null!==this.stroke&&f.Vc(e,e);a=f.ea(a);N.free(f);return a}if(c.type===re){g=c.startX;e=c.startY;h=c.endX;var k=c.endY;c=Math.min(g,h);b=Math.min(e,k);g=Math.abs(h-g)/2;e=Math.abs(k-e)/2;c=a.x-(c+g);b=a.y-(b+e);if(null===this.fill){g-=d;e-=d;if(0>=g||0>=e||1>=c*c/(g*g)+b*b/(e*e))return N.free(f),!1;
g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);N.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===he)return N.free(f),null===this.fill?Ve(c,a.x,a.y,e):c.ea(a,e,1<this.strokeWidth,b);A("Unknown Geometry type: "+c.type);return!1};
t.bm=function(a,b,c,d){var e=this.desiredSize,f=this.ah;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Pd)var g=this.geometry.bounds;else{var h=this.figure,k=bn[h];if(void 0===k){var l=H.Je[h];"string"===typeof l&&(l=H.Je[l]);"function"===typeof l?(k=l(null,100,100),bn[h]=k):A("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(Tk(this,!0)){case ah:d=c=0;break;case ie:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case Ek:l=Math.max(a-f,0);d=0;break;case Fk:c=0,m=
Math.max(b-f,0)}isFinite(e.width)&&(l=e.width);isFinite(e.height)&&(m=e.height);e=this.maxSize;g=this.minSize;c=Math.max(c-f,g.width);d=Math.max(d-f,g.height);l=Math.min(e.width,l);m=Math.min(e.height,m);l=isFinite(l)?Math.max(c,l):Math.max(h,c);m=isFinite(m)?Math.max(d,m):Math.max(k,d);c=bh(this);switch(c){case ah:break;case ie:h=l;k=m;break;case ch:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:A(c+" is not a valid geometryStretch.")}null!==this.Pd?(h=Math.max(h,.01),k=Math.max(k,
.01),g=null!==this.Pd?this.Pd:this.qa,e=h,d=k,c=g.copy(),g=g.bounds,e/=g.width,d/=g.height,isFinite(e)||(e=1),isFinite(d)||(d=1),1===e&&1===d||c.scale(e,d),this.qa=c):null!==this.qa&&H.ba(this.qa.Wk,a-f)&&H.ba(this.qa.Uk,b-f)||(this.qa=V.makeGeometry(this,h,k));g=this.qa.bounds;Infinity===a||Infinity===b?Qk(this,g.x-f/2,g.y-f/2,0===a&&0===h?0:g.width+f,0===b&&0===k?0:g.height+f):Qk(this,-(f/2),-(f/2),l+f,m+f)};
function bh(a){var b=a.geometryStretch;return null!==a.Pd?b===Dk?ie:b:b===Dk?bn[a.figure].defaultStretch:b}t.lh=function(a,b,c,d){Vk(this,a,b,c,d)};t.Uc=function(a,b,c){return this.Uj(a.x,a.y,b.x,b.y,c)};
t.Uj=function(a,b,c,d,e){var f=this.transform,g=1/(f.m11*f.m22-f.m12*f.m21),h=f.m22*g,k=-f.m12*g,l=-f.m21*g,m=f.m11*g,n=g*(f.m21*f.dy-f.m22*f.dx),p=g*(f.m12*f.dx-f.m11*f.dy);f=a*h+b*l+n;g=a*k+b*m+p;h=c*h+d*l+n;k=c*k+d*m+p;n=this.ah/2;l=this.qa;null===l&&(this.measure(Infinity,Infinity),l=this.qa);p=l.bounds;m=!1;if(l.type===je)if(1.5>=this.strokeWidth)m=H.Fe(l.startX,l.startY,l.endX,l.endY,f,g,h,k,e);else{l.startX===l.endX?(d=n,m=0):(b=(l.endY-l.startY)/(l.endX-l.startX),m=n/Math.sqrt(1+b*b),d=m*
b);b=Ka();a=new G;H.Fe(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new G;H.Fe(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new G;H.Fe(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new G;H.Fe(l.endX+d,l.endY+m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);h=b.length;if(0===h)return Oa(b),!1;m=!0;k=Infinity;for(d=0;d<h;d++)a=b[d],c=(a.x-f)*(a.x-f)+(a.y-g)*(a.y-g),c<k&&(k=c,e.x=a.x,e.y=a.y);Oa(b)}else if(l.type===ne)m=H.Uc(p.x-n,p.y-n,p.x+p.width+
n,p.y+p.height+n,f,g,h,k,e);else if(l.type===re){b=N.allocAt(p.x,p.y,p.width,p.height).Vc(n,n);a:if(0===b.width)m=H.Fe(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=H.Fe(b.x,b.y,b.x+b.width,b.y,f,g,h,k,e);else{a=b.width/2;l=b.height/2;d=b.x+a;m=b.y+l;c=9999;f!==h&&(c=(g-k)/(f-h));if(9999>Math.abs(c)){k=g-m-c*(f-d);if(0>a*a*c*c+l*l-k*k){e.x=NaN;e.y=NaN;m=!1;break a}n=Math.sqrt(a*a*c*c+l*l-k*k);h=(-(a*a*c*k)+a*l*n)/(l*l+a*a*c*c)+d;a=(-(a*a*c*k)-a*l*n)/(l*l+a*a*c*c)+d;l=c*(h-d)+k+m;k=c*
(a-d)+k+m;Math.abs((f-h)*(f-h))+Math.abs((g-l)*(g-l))<Math.abs((f-a)*(f-a))+Math.abs((g-k)*(g-k))?(e.x=h,e.y=l):(e.x=a,e.y=k)}else{h=l*l;k=f-d;h-=h/(a*a)*k*k;if(0>h){e.x=NaN;e.y=NaN;m=!1;break a}k=Math.sqrt(h);h=m+k;k=m-k;Math.abs(h-g)<Math.abs(k-g)?(e.x=f,e.y=h):(e.x=f,e.y=k)}m=!0}N.free(b)}else if(l.type===he){p=G.alloc();var q=h-f;var r=k-g;var u=q*q+r*r;e.x=h;e.y=k;for(var v=0;v<l.figures.count;v++){var x=l.figures.j[v],y=x.segments;q=x.startX;r=x.startY;for(var z=q,B=r,C=0;C<y.count;C++){var I=
y.j[C],J=I.type;var K=I.endX;var X=I.endY;var Q=!1;switch(J){case Ce:z=K;B=X;break;case le:Q=cn(q,r,K,X,f,g,h,k,p);break;case De:Q=H.Hp(q,r,I.point1X,I.point1Y,I.point2X,I.point2Y,K,X,f,g,h,k,.6,p);break;case Ee:Q=H.Hp(q,r,(q+2*I.point1X)/3,(r+2*I.point1Y)/3,(2*I.point1X+K)/3,(2*I.point1X+K)/3,K,X,f,g,h,k,.6,p);break;case Fe:case Re:J=I.type===Fe?Se(I,x):Te(I,x,q,r);var ia=J.length;if(0===ia){Q=cn(q,r,I.centerX,I.centerY,f,g,h,k,p);break}X=null;for(K=0;K<ia;K++){X=J[K];if(0===K&&cn(q,r,X[0],X[1],
f,g,h,k,p)){var ja=dn(f,g,p,u,e);ja<u&&(u=ja,m=!0)}H.Hp(X[0],X[1],X[2],X[3],X[4],X[5],X[6],X[7],f,g,h,k,.6,p)&&(ja=dn(f,g,p,u,e),ja<u&&(u=ja,m=!0))}K=X[6];X=X[7];break;default:A("Unknown Segment type: "+J)}q=K;r=X;Q&&(Q=dn(f,g,p,u,e),Q<u&&(u=Q,m=!0));I.isClosed&&(K=z,X=B,cn(q,r,K,X,f,g,h,k,p)&&(I=dn(f,g,p,u,e),I<u&&(u=I,m=!0)))}}f=c-a;g=d-b;h=Math.sqrt(f*f+g*g);0!==h&&(f/=h,g/=h);e.x-=f*n;e.y-=g*n;G.free(p)}else A("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.ta(e);return!0};
function dn(a,b,c,d,e){a=c.x-a;b=c.y-b;b=a*a+b*b;return b<d?(e.x=c.x,e.y=c.y,b):d}function cn(a,b,c,d,e,f,g,h,k){var l=!1,m=(e-g)*(b-d)-(f-h)*(a-c);if(0===m)return!1;k.x=((e*h-f*g)*(a-c)-(e-g)*(a*d-b*c))/m;k.y=((e*h-f*g)*(b-d)-(f-h)*(a*d-b*c))/m;(a>c?a-c:c-a)<(b>d?b-d:d-b)?(a=b<d?b:d,b=b<d?d:b,(k.y>a||H.ba(k.y,a))&&(k.y<b||H.ba(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||H.ba(k.x,b))&&(k.x<a||H.ba(k.x,a))&&(l=!0));return l}
t.mh=function(a,b){if(void 0===b)return a.kf(this.actualBounds);var c=this.qa;null===c&&(this.measure(Infinity,Infinity),c=this.qa);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=G.alloc();f.h(c.x-d,c.y-d);a.ea(b.ta(f))&&(f.h(c.x-d,c.bottom+d),a.ea(b.ta(f))&&(f.h(c.right+d,c.bottom+d),a.ea(b.ta(f))&&(f.h(c.right+d,c.y-d),a.ea(b.ta(f))&&(e=!0))));G.free(f);return e};
t.Jc=function(a,b){if(this.mh(a,b)||void 0===b&&(b=this.transform,a.kf(this.actualBounds)))return!0;var c=Tc.alloc();c.set(b);c.Ys();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=G.alloc();g.h(d,f);c.ta(g);if(this.nh(g,!0))return G.free(g),!0;g.h(e,f);c.ta(g);if(this.nh(g,!0))return G.free(g),!0;g.h(d,a);c.ta(g);if(this.nh(g,!0))return G.free(g),!0;g.h(e,a);c.ta(g);if(this.nh(g,!0))return G.free(g),!0;var h=G.alloc(),k=G.alloc();c.set(b);c.hv(this.transform);c.Ys();h.x=e;h.y=f;h.transform(c);g.x=
d;g.y=f;g.transform(c);b=!1;en(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),en(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),en(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),en(this,g,h,k)&&(b=!0))));G.free(g);Tc.free(c);G.free(h);G.free(k);return b};function en(a,b,c,d){if(!a.Uc(b,c,d))return!1;a=b.x;b=b.y;var e=c.x,f=c.y;c=d.x;d=d.y;if(a===e)return b<f?(a=b,b=f):a=f,d>=a&&d<=b;a<e?(d=a,a=e):d=e;return c>=d&&c<=a}
t.ex=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.ed(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.nh(a,!0))return!0;var e=a.Ae(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.qa;if(null===b&&(this.measure(Infinity,Infinity),b=this.qa,null===b))return!1;if(!c){var g=b.bounds,h=g.x,k=g.y,l=g.x+g.width;g=g.y+g.height;if($b(a.x,a.y,h,k)<=e&&$b(a.x,a.y,l,k)<=e&&$b(a.x,a.y,h,g)<=e&&$b(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l=
b.endX;g=b.endY;if(b.type===je){if(c=(h-l)*(a.x-l)+(k-g)*(a.y-g),Zb(a.x,a.y,h,k,l,g)<=(0<=(l-h)*(a.x-h)+(g-k)*(a.y-k)&&0<=c?e:f))return!0}else{if(b.type===ne)return b=!1,c&&(b=Zb(a.x,a.y,h,k,h,g)<=e||Zb(a.x,a.y,h,k,l,k)<=e||Zb(a.x,a.y,l,k,l,g)<=e||Zb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===re){b=a.x-(h+l)/2;f=a.y-(k+g)/2;var m=Math.abs(l-h)/2,n=Math.abs(g-k)/2;if(0===m||0===n)return Zb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=H.wy(m,n,b,f),a*a<=e)return!0}else return $b(b,f,-m,0)>=e||$b(b,f,0,-n)>=e||$b(b,
f,0,n)>=e||$b(b,f,m,0)>=e?!1:!0}else if(b.type===he){l=b.bounds;f=l.x;h=l.y;k=l.x+l.width;l=l.y+l.height;if(a.x>k&&a.x<f&&a.y>l&&a.y<h&&Zb(a.x,a.y,f,h,f,l)>e&&Zb(a.x,a.y,f,h,k,h)>e&&Zb(a.x,a.y,k,l,f,l)>e&&Zb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?Ve(b,a.x,a.y,f):b.ea(a,f,!0))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.j[b];g=f.startX;m=f.startY;if(a.ed(g,m)>e)return!1;h=f.segments.j;k=h.length;for(l=0;l<k;l++)switch(n=h[l],n.type){case Ce:case le:g=n.endX;m=
n.endY;if(a.ed(g,m)>e)return!1;break;case De:var p=Ka();H.xe(g,m,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.8,p);g=d(p,a);Oa(p);if(g)return!1;g=n.endX;m=n.endY;if(a.ed(g,m)>e)return!1;break;case Ee:p=Ka();H.eq(g,m,n.point1X,n.point1Y,n.endX,n.endY,.8,p);g=d(p,a);Oa(p);if(g)return!1;g=n.endX;m=n.endY;if(a.ed(g,m)>e)return!1;break;case Fe:case Re:p=n.type===Fe?Se(n,f):Te(n,f,g,m);var q=p.length;if(0===q){g=n.centerX;m=n.centerY;if(a.ed(g,m)>e)return!1;break}n=null;for(var r=Ka(),u=0;u<q;u++)if(n=
p[u],r.length=0,H.xe(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,r),d(r,a))return Oa(r),!1;Oa(r);null!==n&&(g=n[6],m=n[7]);break;default:A("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.bc=function(){this.qa=null};function fn(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=gn,"None"!==a.Il?(a.segmentIndex=-1,a.alignmentFocus=Vd):"None"!==a.Pk&&(a.segmentIndex=0,a.alignmentFocus=new O(1-Vd.x,Vd.y)))}
V.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=hn[a.toArrow];else"None"!==a.fromArrow?d=hn[a.fromArrow]:(d=H.Je[a.figure],"string"===typeof d&&(d=H.Je[d]),void 0===d&&A("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.Wk=b,d.Uk=c);if(null===d){var e=H.Je.Rectangle;"function"===typeof e&&(d=e(a,b,c))}return d};
function on(a){var b=hn[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=hn[c];if(void 0===b){var d=null,e;for(e in H.vm)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=se(H.vm[d],!1),hn[d]=a,c!==d&&(hn[c]=d),d}}return"string"===typeof b?b:b instanceof ge?a:null}
pa.Object.defineProperties(V.prototype,{geometry:{get:function(){return null!==this.qa?this.qa:this.Pd},set:function(a){var b=this.qa;if(b!==a){null!==a?this.Pd=this.qa=a.freeze():this.Pd=this.qa=null;var c=this.part;null!==c&&(c.Rg=NaN);this.o();this.g("geometry",b,a);Nk(this)&&(a=this.part,null!==a&&Ok(this,a,"geometryString"))}}},geometryString:{get:function(){return null===this.geometry?"":this.geometry.toString()},set:function(a){a=
se(a);var b=a.normalize();this.geometry=a;this.position=a=G.allocAt(-b.x,-b.y);G.free(a)}},isGeometryPositioned:{get:function(){return this.Kn},set:function(a){var b=this.Kn;b!==a&&(this.Kn=a,this.o(),this.g("isGeometryPositioned",b,a))}},fill:{get:function(){return this.Nk},set:function(a){var b=this.Nk;b!==a&&(a instanceof bl&&a.freeze(),this.Nk=a,this.R(),this.g("fill",b,a))}},stroke:{get:function(){return this.Hc},
set:function(a){var b=this.Hc;b!==a&&(a instanceof bl&&a.freeze(),this.Hc=a,this.R(),this.g("stroke",b,a))}},strokeWidth:{get:function(){return this.ah},set:function(a){var b=this.ah;if(b!==a)if(0<=a){this.ah=a;this.o();var c=this.part;null!==c&&(c.Rg=NaN);this.g("strokeWidth",b,a)}else xa(a,"value >= 0",V,"strokeWidth:value")}},strokeCap:{get:function(){return this.zl},set:function(a){var b=this.zl;b!==a&&("string"!==typeof a||"butt"!==
a&&"round"!==a&&"square"!==a?xa(a,'"butt", "round", or "square"',V,"strokeCap"):(this.zl=a,this.R(),this.g("strokeCap",b,a)))}},strokeJoin:{get:function(){return this.Cl},set:function(a){var b=this.Cl;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?xa(a,'"miter", "bevel", or "round"',V,"strokeJoin"):(this.Cl=a,this.R(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{get:function(){return this.Aj},set:function(a){var b=this.Aj;
if(b!==a&&1<=a){this.Aj=a;this.R();var c=this.part;null!==c&&(c.Rg=NaN);this.g("strokeMiterLimit",b,a)}}},strokeDashArray:{get:function(){return this.Al},set:function(a){var b=this.Al;if(b!==a){if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];0<=f&&isFinite(f)||A("strokeDashArray:value "+f+" at index "+e+" must be a positive number or zero.");d+=f}if(0===d){if(null===b)return;a=null}}this.Al=a;this.R();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{
get:function(){return this.Bl},set:function(a){var b=this.Bl;b!==a&&0<=a&&(this.Bl=a,this.R(),this.g("strokeDashOffset",b,a))}},figure:{get:function(){return this.Mk},set:function(a){var b=this.Mk;if(b!==a){var c=H.Je[a];"function"===typeof c?c=a:(c=H.Je[a.toLowerCase()])||A("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.Rg=NaN),this.Mk=c,this.Pd=null,this.bc(),this.o(),this.g("figure",b,c))}}},toArrow:{get:function(){return this.Il},
set:function(a){var b=this.Il;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=on(a);null===c?A("Unknown Shape.toArrow: "+a):b!==c&&(this.Il=c,this.Pd=null,this.bc(),this.o(),fn(this),this.g("toArrow",b,c))}}},fromArrow:{get:function(){return this.Pk},set:function(a){var b=this.Pk;!0===a?a="Standard":!1===a&&(a="");if(b!==a){var c=on(a);null===c?A("Unknown Shape.fromArrow: "+a):b!==c&&(this.Pk=c,this.Pd=null,this.bc(),this.o(),fn(this),this.g("fromArrow",b,c))}}},spot1:{
get:function(){return this.af},set:function(a){var b=this.af;b.A(a)||(this.af=a=a.I(),this.o(),this.g("spot1",b,a))}},spot2:{get:function(){return this.bf},set:function(a){var b=this.bf;b.A(a)||(this.bf=a=a.I(),this.o(),this.g("spot2",b,a))}},parameter1:{get:function(){return this.Eo},set:function(a){var b=this.Eo;b!==a&&(this.Eo=a,this.bc(),this.o(),this.g("parameter1",b,a))}},parameter2:{get:function(){return this.Fo},
set:function(a){var b=this.Fo;b!==a&&(this.Fo=a,this.bc(),this.o(),this.g("parameter2",b,a))}},naturalBounds:{get:function(){if(null!==this.qa)return this.jc.assign(this.qa.bounds),this.jc;var a=this.desiredSize;return new N(0,0,a.width,a.height)}},pathPattern:{get:function(){return this.Ho},set:function(a){var b=this.Ho;b!==a&&(this.Ho=a,this.R(),this.g("pathPattern",b,a))}},geometryStretch:{get:function(){return this.An},
set:function(a){var b=this.An;b!==a&&(this.An=a,this.g("geometryStretch",b,a))}},interval:{get:function(){return this.Dd},set:function(a){var b=this.Dd;a=Math.floor(a);if(b!==a&&0<=a){this.Dd=a;var c=this.diagram;null!==c&&this.panel===c.grid&&fj(c);this.o();c=this.panel;null!==c&&(c.Jg=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Cd},set:function(a){var b=this.Cd;b!==a&&(0>a?a=0:1<a&&(a=1),this.Cd=a,this.o(),
this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Ad},set:function(a){var b=this.Ad;b!==a&&(0>a?a=0:1<a&&(a=1),this.Ad=a,this.o(),this.g("graduatedEnd",b,a))}},graduatedSkip:{get:function(){return this.Bd},set:function(a){var b=this.Bd;b!==a&&(this.Bd=a,this.o(),this.g("graduatedSkip",b,a))}}});V.prototype.intersectsRect=V.prototype.Jc;V.prototype.containedInRect=V.prototype.mh;
V.prototype.getNearestIntersectionPoint=V.prototype.Uc;V.prototype.getDocumentBounds=V.prototype.Qp;V.prototype.getDocumentPoint=V.prototype.ma;var hn=new yb,bn=new yb;V.className="Shape";V.getFigureGenerators=function(){var a=new Pb,b;for(b in H.Je)b!==b.toLowerCase()&&a.add(b,H.Je[b]);a.freeze();return a};V.defineFigureGenerator=function(a,b){var c=a.toLowerCase(),d=H.Je;d[a]=b;d[c]=a};
V.getArrowheadGeometries=function(){var a=new Pb;for(d in H.vm)if(void 0===hn[d]){var b=se(H.vm[d],!1);hn[d]=b;b=d.toLowerCase();b!==d&&(hn[b]=d)}for(var c in hn)if(c!==c.toLowerCase()){var d=hn[c];d instanceof ge&&a.add(c,d)}a.freeze();return a};V.defineArrowheadGeometry=function(a,b){var c=null;"string"===typeof b?c=se(b,!1):c=b;b=a.toLowerCase();"none"!==b&&a!==b||A("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=hn;d[a]=c;d[b]=a};
function th(){Y.call(this);pn||(qn(),pn=!0);this.Ob="";this.Hc="black";this.ce="13px sans-serif";this.pi="start";this.zd=ah;this.vi=Rd;this.fj=!0;this.Zh=this.$h=!1;this.Wf=rn;this.gg=sn;this.Jr=this.rc=0;this.cu=this.du=null;this.pd=new Cm;this.un=!1;this.Ec=this.Rm=this.rp=this.ri=this.sp=null;this.$e=this.Ze=0;this.ke=Infinity;this.al=0;this.Dd=1;this.Cd=0;this.Ad=1;this.Bd=this.$i=null}oa(th,Y);
th.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.Ob=this.Ob;a.Hc=this.Hc;a.ce=this.ce;a.pi=this.pi;a.zd=this.zd;a.vi=this.vi;a.fj=this.fj;a.$h=this.$h;a.Zh=this.Zh;a.Wf=this.Wf;a.gg=this.gg;a.rc=this.rc;a.Jr=this.Jr;a.du=this.du;a.cu=this.cu;a.pd.Pl(this.pd);a.un=this.un;a.sp=this.sp;a.ri=this.ri;a.rp=this.rp;a.Rm=this.Rm;a.Ec=this.Ec;a.Ze=this.Ze;a.$e=this.$e;a.ke=this.ke;a.al=this.al;a.Dd=this.Dd;a.Cd=this.Cd;a.Ad=this.Ad;a.$i=this.$i;a.Bd=this.Bd};
function Bm(a,b){a.G=b.G|6144;a.mb=b.opacity;a.jb=b.background;a.fc=b.areaBackground;a.Nc=b.desiredSize.I();a.Nf=b.minSize.I();a.Mf=b.maxSize.I();a.Kf=b.Kf.copy();a.Ca=b.scale;a.Bc=b.angle;a.se=b.stretch;a.Qg=b.margin.I();a.xb=b.alignment.I();a.qk=b.alignmentFocus.I();a.pl=b.segmentFraction;a.ql=b.segmentOffset.I();a.rl=b.segmentOrientation;null!==b.md&&(a.md=b.md.copy());a.tl=b.shadowVisible;b instanceof th&&(a.Ob=b.Ob,a.Hc=b.Hc,a.ce=b.ce,a.pi=b.pi,a.zd=b.zd,a.vi=b.vi,a.fj=b.fj,a.$h=b.$h,a.Zh=b.Zh,
a.Wf=b.Wf,a.gg=b.gg,a.pd.Ff=null,a.Ze=b.Ze,a.$e=b.$e,a.ke=b.ke,a.al=b.al,a.Dd=b.Dd,a.Cd=b.Cd,a.Ad=b.Ad,a.$i=b.$i,a.Bd=b.Bd)}t=th.prototype;t.hb=function(a){a.classType===th?this.wrap=a:Y.prototype.hb.call(this,a)};t.toString=function(){return 22<this.Ob.length?'TextBlock("'+this.Ob.substring(0,20)+'"...)':'TextBlock("'+this.Ob+'")'};t.o=function(){Y.prototype.o.call(this);this.cu=this.du=null};
t.xi=function(a,b){if(null!==this.Hc&&0!==this.Ob.length&&null!==this.ce){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=tn(this),h=a.textAlign=this.pi,k=b.Nn;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.$h;var l=this.Zh;fi(this,a,this.Hc,!0,!1,c,d);(k||l)&&fi(this,a,this.Hc,!1,!1,c,d);d=0;c=!1;var m=G.allocAt(0,0);this.td.ta(m);var n=G.allocAt(0,g);this.td.ta(n);var p=m.Ae(n);G.free(m);G.free(n);m=b.scale;8>p*m*m&&(c=!0);b.$c!==a&&(c=!1);!1===b.Ce("textGreeking")&&
(c=!1);b=this.Ze;p=this.$e;switch(this.flip){case Ik:a.translate(e,0);a.scale(-1,1);break;case Hk:a.translate(0,f);a.scale(1,-1);break;case Jk:a.translate(e,f),a.scale(-1,-1)}m=this.rc;n=(b+g+p)*m;f>n&&(d=this.vi,d=d.y*f-d.y*n+d.offsetY);n=this.pd;for(var q=0;q<m;q++){var r=n.Yc[q];r>e&&(r=e);d+=b;var u=n.Cc[q],v=a,x=d,y=h,z=0;if(c)"left"===y?z=0:"right"===y?z=e-r:"center"===y&&(z=(e-r)/2),v.fillRect(0+z,x+.25*g,r,1);else{"left"===y?z=0:"right"===y?z=e:"center"===y&&(z=e/2);var B=null!==un?un(this,
g):.75*g;v.fillText(u,0+z,x+B);u=g/20|0;0===u&&(u=1);"right"===y?z-=r:"center"===y&&(z-=r/2);k&&(y=null!==vn?vn(this,g):.8*g,v.beginPath(),v.lineWidth=u,v.moveTo(0+z,x+y),v.lineTo(0+z+r,x+y),v.stroke());l&&(v.beginPath(),v.lineWidth=u,x=x+g-g/2.2|0,0!==u%2&&(x+=.5),v.moveTo(0+z,x),v.lineTo(0+z+r,x),v.stroke())}d+=g+p}switch(this.flip){case Ik:a.scale(-1,1);a.translate(-e,0);break;case Hk:a.scale(1,-1);a.translate(0,-f);break;case Jk:a.scale(-1,-1),a.translate(-e,-f)}}};
t.bm=function(a,b,c,d){this.al=a;var e=this.ce;null!==wn&&xn!==e&&(xn=wn.font=e);e=this.pd;e.reset();var f;if(isNaN(this.desiredSize.width)){var g=this.Ob.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===g.length)g=0;else if(this.isMultiline){for(var h=f=0,k=!1;!k;){var l=g.indexOf("\n",h);-1===l&&(l=g.length,k=!0);f=Math.max(f,yn(g.substr(h,l-h).trim()));h=l+1}g=f}else f=g.indexOf("\n",0),0<=f&&(g=g.substr(0,f)),g=yn(g);g=Math.min(g,a/this.scale);g=Math.max(8,g)}else g=this.desiredSize.width;null!==
this.panel&&(g=Math.min(g,this.panel.maxSize.width));f=zn(this,g,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;h=f;if(0!==e.Fc&&1!==e.Cc.length&&this.Wf===An&&(b=this.ce,b=this.Wf===An?Bn(b):0,k=this.Ze+this.$e,k=Math.max(0,tn(this)+k),h=Math.min(this.maxLines-1,Math.max(Math.floor(h/k+.01)-1,0)),!(h+1>=e.Cc.length))){k=e.Cc[h];for(b=Math.max(1,a-b);yn(k)>b&&1<k.length;)k=k.substr(0,k.length-1);k+=Cn;b=yn(k);e.Cc[h]=k;e.Cc=e.Cc.slice(0,h+1);e.Yc[h]=b;e.Yc=
e.Yc.slice(0,h+1);e.fg=e.Cc.length;e.Fc=Math.max(e.Fc,b);this.rc=e.fg}if(this.wrap===Dn||isNaN(this.desiredSize.width))g=isNaN(a)?e.Fc:Math.min(a,e.Fc),isNaN(this.desiredSize.width)&&(g=Math.max(8,g));g=Math.max(c,g);f=Math.max(d,f);xc(this.jc,g,f);Qk(this,0,0,g,f)};t.lh=function(a,b,c,d){Vk(this,a,b,c,d)};
function En(a,b,c,d,e){b=b.trim();var f=0;var g=a.ce;var h=a.Ze+a.$e;h=Math.max(0,tn(a)+h);var k=a.Wf===An?Bn(g):0;if(a.rc>=a.ke)null!==e&&e.h(0,h);else{var l=b;if(a.gg===Fn)if(c.fg=1,g=yn(b),0===k||g<=d)c.Fc=Math.max(c.Fc,g),c.Yc.push(c.Fc),c.Cc.push(b),null!==e&&e.h(g,h);else{f=Gn(a,l);l=l.substr(f.length);b=Gn(a,l);for(g=yn(f+b);0<b.length&&g<=d;)f+=b,l=l.substr(b.length),b=Gn(a,l),g=yn((f+b).trim());f+=b.trim();for(d=Math.max(1,d-k);yn(f)>d&&1<f.length;)f=f.substr(0,f.length-1);f+=Cn;b=yn(f);
c.Yc.push(b);c.Fc=b;c.Cc.push(f);null!==e&&e.h(b,h)}else{k=0;0===l.length&&(k=1,c.Yc.push(0),c.Cc.push(l));for(;0<l.length;){var m=Gn(a,l);for(l=l.substr(m.length);yn(m)>d;){var n=1;g=yn(m.substr(0,n));for(b=0;g<=d;)n++,b=g,g=yn(m.substr(0,n));1===n?(c.Yc[a.rc+k]=g,f=Math.max(f,g)):(c.Yc[a.rc+k]=b,f=Math.max(f,b));n--;1>n&&(n=1);c.Cc[a.rc+k]=m.substr(0,n);k++;m=m.substr(n);if(a.rc+k>a.ke)break}b=Gn(a,l);for(g=yn(m+b);0<b.length&&g<=d;)m+=b,l=l.substr(b.length),b=Gn(a,l),g=yn((m+b).trim());m=m.trim();
if(""!==m&&("\u00ad"===m[m.length-1]&&(m=m.substring(0,m.length-1)+"\u2010"),0===b.length?(c.Yc.push(g),f=Math.max(f,g)):(b=yn(m),c.Yc.push(b),f=Math.max(f,b)),c.Cc.push(m),k++,a.rc+k>a.ke))break}c.fg=Math.min(a.ke,k);c.Fc=Math.max(c.Fc,f);null!==e&&e.h(c.Fc,h*c.fg)}}}function Gn(a,b){if(a.gg===Hn)return b.substr(0,1);a=b.length;for(var c=0,d=In;c<a&&!d.test(b.charAt(c));)c++;for(;c<a&&d.test(b.charAt(c));)c++;return c>=a?b:b.substr(0,c)}
function yn(a){return null===wn?8*a.length:wn.measureText(a).width}function tn(a){if(null!==a.pd.Ff)return a.pd.Ff;var b=a.ce;if(null===wn){var c=16;return a.pd.Ff=c}void 0!==Jn[b]&&5E3>Kn?c=Jn[b]:(c=1.3*wn.measureText("M").width,Jn[b]=c,Kn++);return a.pd.Ff=c}function Bn(a){if(null===wn)return 6;if(void 0!==Ln[a]&&5E3>Mn)var b=Ln[a];else b=wn.measureText(Cn).width,Ln[a]=b,Mn++;return b}
function zn(a,b,c){var d=a.Ob.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),e=a.Ze+a.$e;e=Math.max(0,tn(a)+e);if(0===d.length)return c.Fc=0,a.rc=1,e;if(!a.isMultiline){var f=d.indexOf("\n",0);0<=f&&(d=d.substr(0,f))}f=0;for(var g=a.rc=0,h,k=!1;!k;){h=d.indexOf("\n",g);-1===h&&(h=d.length,k=!0);if(g<=h){g=d.substr(g,h-g);if(a.gg!==Fn){c.fg=0;var l=L.alloc();En(a,g,c,b,l);f+=l.height;L.free(l);a.rc+=c.fg}else En(a,g,c,b,null),f+=e,a.rc++;a.rc===a.ke&&(k=!0)}g=h+1}return a.Jr=f}
function qn(){In=/[ \u200b\u00ad]/;Jn=new yb;Ln=new yb;wn=oh?(new ok(null)).context:null}
pa.Object.defineProperties(th.prototype,{font:{get:function(){return this.ce},set:function(a){var b=this.ce;b!==a&&(this.ce=a,this.pd.Ff=null,this.o(),this.g("font",b,a))}},text:{get:function(){return this.Ob},set:function(a){var b=this.Ob;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Ob=a,this.o(),this.g("text",b,a))}},textAlign:{get:function(){return this.pi},set:function(a){var b=this.pi;b===a||"start"!==
a&&"end"!==a&&"left"!==a&&"right"!==a&&"center"!==a||(this.pi=a,this.R(),this.g("textAlign",b,a))}},flip:{get:function(){return this.zd},set:function(a){var b=this.zd;b!==a&&(this.zd=a,this.R(),this.g("flip",b,a))}},verticalAlignment:{get:function(){return this.vi},set:function(a){var b=this.vi;b.A(a)||(this.vi=a=a.I(),kl(this),this.g("verticalAlignment",b,a))}},naturalBounds:{get:function(){if(!this.jc.s()){var a=
L.alloc();En(this,this.Ob,this.pd,999999,a);var b=a.width;L.free(a);a=zn(this,b,this.pd);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);xc(this.jc,b,a)}return this.jc}},isMultiline:{get:function(){return this.fj},set:function(a){var b=this.fj;b!==a&&(this.fj=a,this.o(),this.g("isMultiline",b,a))}},isUnderline:{get:function(){return this.$h},set:function(a){var b=this.$h;b!==a&&(this.$h=a,this.R(),this.g("isUnderline",
b,a))}},isStrikethrough:{get:function(){return this.Zh},set:function(a){var b=this.Zh;b!==a&&(this.Zh=a,this.R(),this.g("isStrikethrough",b,a))}},wrap:{get:function(){return this.gg},set:function(a){var b=this.gg;b!==a&&(this.gg=a,this.o(),this.g("wrap",b,a))}},overflow:{get:function(){return this.Wf},set:function(a){var b=this.Wf;b!==a&&(this.Wf=a,this.o(),this.g("overflow",b,a))}},stroke:{
get:function(){return this.Hc},set:function(a){var b=this.Hc;b!==a&&(a instanceof bl&&a.freeze(),this.Hc=a,this.R(),this.g("stroke",b,a))}},lineCount:{get:function(){return this.rc}},editable:{get:function(){return this.un},set:function(a){var b=this.un;b!==a&&(this.un=a,this.g("editable",b,a))}},textEditor:{get:function(){return this.sp},set:function(a){var b=this.sp;b!==a&&(this.sp=a,this.g("textEditor",b,
a))}},errorFunction:{get:function(){return this.Ec},set:function(a){var b=this.Ec;b!==a&&(this.Ec=a,this.g("errorFunction",b,a))}},interval:{get:function(){return this.Dd},set:function(a){var b=this.Dd;a=Math.floor(a);if(b!==a&&0<=a){this.Dd=a;this.o();var c=this.panel;null!==c&&(c.Jg=null);this.g("interval",b,a)}}},graduatedStart:{get:function(){return this.Cd},set:function(a){var b=this.Cd;b!==a&&(0>a?a=0:
1<a&&(a=1),this.Cd=a,this.o(),this.g("graduatedStart",b,a))}},graduatedEnd:{get:function(){return this.Ad},set:function(a){var b=this.Ad;b!==a&&(0>a?a=0:1<a&&(a=1),this.Ad=a,this.o(),this.g("graduatedEnd",b,a))}},graduatedFunction:{get:function(){return this.$i},set:function(a){var b=this.$i;b!==a&&(this.$i=a,this.o(),this.g("graduatedFunction",b,a))}},graduatedSkip:{get:function(){return this.Bd},set:function(a){var b=
this.Bd;b!==a&&(this.Bd=a,this.o(),this.g("graduatedSkip",b,a))}},textValidation:{get:function(){return this.ri},set:function(a){var b=this.ri;b!==a&&(this.ri=a,this.g("textValidation",b,a))}},textEdited:{get:function(){return this.rp},set:function(a){var b=this.rp;b!==a&&(this.rp=a,this.g("textEdited",b,a))}},spacingAbove:{get:function(){return this.Ze},set:function(a){var b=this.Ze;b!==a&&(this.Ze=a,this.g("spacingAbove",
b,a))}},spacingBelow:{get:function(){return this.$e},set:function(a){var b=this.$e;b!==a&&(this.$e=a,this.g("spacingBelow",b,a))}},maxLines:{get:function(){return this.ke},set:function(a){var b=this.ke;b!==a&&(a=Math.floor(a),0>=a&&xa(a,"> 0",th,"maxLines"),this.ke=a,this.g("maxLines",b,a),this.o())}},metrics:{get:function(){return this.pd}},choices:{get:function(){return this.Rm},
set:function(a){var b=this.Rm;b!==a&&(this.Rm=a,this.g("choices",b,a))}}});var un=null,vn=null,Fn=new D(th,"None",0),Dn=new D(th,"WrapFit",1),sn=new D(th,"WrapDesiredSize",2),Hn=new D(th,"WrapBreakAll",3),rn=new D(th,"OverflowClip",0),An=new D(th,"OverflowEllipsis",1),In=null,Jn=null,Kn=0,Ln=null,Mn=0,Cn="...",xn="",wn=null,pn=!1;th.className="TextBlock";th.getEllipsis=function(){return Cn};th.setEllipsis=function(a){Cn=a;Ln=new yb;Mn=0};th.getBaseline=function(){return un};
th.setBaseline=function(a){un=a;a=Va();for(var b=a.length,c=0;c<b;c++)a[c].vh()};th.getUnderline=function(){return vn};th.setUnderline=function(a){vn=a;a=Va();for(var b=a.length,c=0;c<b;c++)a[c].vh()};th.isValidFont=function(a){pn||(qn(),pn=!0);if(null===wn)return!0;var b=wn.font;if(a===b||"10px sans-serif"===a)return!0;wn.font="10px sans-serif";wn.font=a;var c=wn.font;if("10px sans-serif"!==c)return wn.font=b,!0;wn.font="19px serif";var d=wn.font;wn.font=a;c=wn.font;wn.font=b;return c!==d};
th.None=Fn;th.WrapFit=Dn;th.WrapDesiredSize=sn;th.WrapBreakAll=Hn;th.OverflowClip=rn;th.OverflowEllipsis=An;function Cm(){this.Fc=this.fg=0;this.Yc=[];this.Cc=[];this.Ff=null}Cm.prototype.reset=function(){this.Fc=this.fg=0;this.Ff=null;this.Yc=[];this.Cc=[]};Cm.prototype.Pl=function(a){this.fg=a.fg;this.Ff=a.Ff;this.Fc=a.Fc;this.Yc=Fa(a.Yc);this.Cc=Fa(a.Cc)};
pa.Object.defineProperties(Cm.prototype,{arrSize:{get:function(){return this.Yc}},arrText:{get:function(){return this.Cc}},maxLineWidth:{get:function(){return this.Fc}},fontHeight:{get:function(){return this.Ff}}});Cm.className="TextBlockMetrics";
function Qj(){Y.call(this);this.Fg=null;this.lp="";this.$g=Kc;this.Sk=ie;this.cf=this.Ec=null;this.Rk=gd;this.zd=ah;this.El=null;this.Yt=!1;this.fr=!0;this.el=!1;this.ul=null}oa(Qj,Y);Qj.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.element=this.Fg;a.lp=this.lp;a.$g=this.$g.I();a.Sk=this.Sk;a.zd=this.zd;a.Ec=this.Ec;a.cf=this.cf;a.Rk=this.Rk.I();a.fr=this.fr;a.ul=this.ul};t=Qj.prototype;
t.hb=function(a){a===ah||a===ch||a===Gk?this.imageStretch=a:Y.prototype.hb.call(this,a)};t.toString=function(){return"Picture("+this.source+")#"+Fb(this)};function Sj(a){void 0===a&&(a="");""!==a?Nn[a]&&(delete Nn[a],On--):(Nn=new yb,On=0)}function Pn(a,b){a.Ln=!0;a.Qk=!1;for(var c,d=Va(),e=d.length,f=0;f<e;f++){var g=d[f],h=g.uj.J(a.src);if(null!==h)for(var k=h.length,l=0;l<k;l++)c=h[l],g.hu.add(c),g.ec(),null===a.mu&&(a.mu=b,null!==c.cf&&c.cf(c,b))}}
function Qn(a,b){a.Qk=b;for(var c,d=Va(),e=d.length,f=0;f<e;f++)if(c=d[f].uj.J(a.src),null!==c){for(var g=c.length,h=Ka(),k=0;k<g;k++)h.push(c[k]);for(k=0;k<g;k++)c=h[k],null!==c.Ec&&c.Ec(c,b);Oa(h)}}
t.xi=function(a,b){var c=this.Fg;if(null!==c){var d=c.src;null!==d&&""!==d||A('Element has no source ("src") attribute: '+c);if(!(c.Qk instanceof Event)&&!0===c.Ln){d=this.naturalBounds;var e=0,f=0,g=this.Yt,h=g?+c.width:c.naturalWidth;g=g?+c.height:c.naturalHeight;void 0===h&&c.videoWidth&&(h=c.videoWidth);void 0===g&&c.videoHeight&&(g=c.videoHeight);h=h||d.width;g=g||d.height;if(0!==h&&0!==g){var k=h,l=g;this.sourceRect.s()&&(e=this.$g.x,f=this.$g.y,h=this.$g.width,g=this.$g.height);var m=h,n=g,
p=this.Sk,q=this.Rk;switch(p){case ah:if(this.sourceRect.s())break;m>=d.width&&(e=e+q.offsetX+(m*q.x-d.width*q.x));n>=d.height&&(f=f+q.offsetY+(n*q.y-d.height*q.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case ie:m=d.width;n=d.height;break;case ch:case Gk:p===ch?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===Gk&&(p=Math.max(d.height/n,d.width/m),m*=p,n*=p,m>=d.width&&(e=(e+q.offsetX+(m*q.x-d.width*q.x)/m)*h),n>=d.height&&(f=(f+q.offsetY+(n*q.y-d.height*q.y)/n)*g),h*=1/(m/d.width),g*=
1/(n/d.height),m=d.width,n=d.height)}p=this.Be()*b.scale;var r=h*g/(m*p*n*p),u=Nn[this.source];p=null;var v=Rn;if(c.Ln&&void 0!==u&&r>v*v)for(2>u.Ll.length&&(Sn(u,4,k,l),Sn(u,16,k,l)),k=u.Ll,l=k.length,p=k[0],v=0;v<l;v++)if(k[v].ratio*k[v].ratio<r)p=k[v];else break;if(!b.rn){if(null===this.El)if(null===this.Fg)this.El=!1;else{k=(new ok(null)).context;k.drawImage(this.Fg,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.El=!1),this.El=!1}catch(x){this.El=!0}}if(this.El)return}k=0;m<d.width&&(k=q.offsetX+
(d.width*q.x-m*q.x));l=0;n<d.height&&(l=q.offsetY+(d.height*q.y-n*q.y));switch(this.flip){case Ik:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case Hk:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case Jk:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}if(b.Ce("pictureRatioOptimization")&&!b.ej&&void 0!==u&&null!==p&&1!==p.ratio){a.save();b=p.ratio;try{a.drawImage(p.source,e/b,f/b,Math.min(p.source.width,h/b),Math.min(p.source.height,g/b),k,l,Math.min(d.width,
m),Math.min(d.height,n))}catch(x){this.fr=!1}a.restore()}else try{a.drawImage(c,e,f,h,g,k,l,Math.min(d.width,m),Math.min(d.height,n))}catch(x){this.fr=!1}switch(this.flip){case Ik:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case Hk:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case Jk:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}};
t.bm=function(a,b,c,d){var e=this.desiredSize,f=Tk(this,!0),g=this.Fg,h=this.Yt;if(h||!this.el&&g&&g.complete)this.el=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===ie||f===Ek?(isFinite(a)||(a=this.sourceRect.s()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.el&&(a=this.sourceRect.s()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===ie||f===Fk?(isFinite(b)||(b=this.sourceRect.s()?this.sourceRect.height:h?
+g.height:g.naturalHeight),d=0):null!==g&&!1!==this.el&&(b=this.sourceRect.s()?this.sourceRect.height:h?+g.height:g.naturalHeight);isFinite(e.width)&&(a=e.width);isFinite(e.height)&&(b=e.height);e=this.maxSize;f=this.minSize;c=Math.max(c,f.width);d=Math.max(d,f.height);a=Math.min(e.width,a);b=Math.min(e.height,b);a=Math.max(c,a);b=Math.max(d,b);null===g||g.complete||(isFinite(a)||(a=0),isFinite(b)||(b=0));xc(this.jc,a,b);Qk(this,0,0,a,b)};t.lh=function(a,b,c,d){Vk(this,a,b,c,d)};
pa.Object.defineProperties(Qj.prototype,{element:{get:function(){return this.Fg},set:function(a){var b=this.Fg;if(b!==a){null===a||a instanceof HTMLImageElement||a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||A("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);this.Yt=a instanceof HTMLCanvasElement;this.Fg=a;if(null!==a)if(a instanceof HTMLCanvasElement||!0===a.complete)a.Qk instanceof Event&&null!==this.Ec&&this.Ec(this,a.Qk),
!0===a.Ln&&null!==this.cf&&this.cf(this,a.mu),a.Ln=!0,this.desiredSize.s()||(ej(this,!1),this.o());else{var c=this;a.tw||(a.addEventListener("load",function(b){Pn(a,b);c.desiredSize.s()||(ej(c,!1),c.o())}),a.addEventListener("error",function(b){Qn(a,b)}),a.tw=!0)}this.g("element",b,a);this.R()}}},source:{get:function(){return this.lp},set:function(a){var b=this.lp;if(b!==a){this.lp=a;var c=Nn,d=this.diagram,e=null;if(void 0!==c[a])e=c[a].Ll[0].source;else{30<On&&(Sj(),
c=Nn);e=va("img");var f=this;e.addEventListener("load",function(a){Pn(e,a);f.desiredSize.s()||(ej(f,!1),f.o())});e.addEventListener("error",function(a){Qn(e,a)});e.tw=!0;var g=this.ul;null!==g&&(e.crossOrigin=g(this));e.src=a;c[a]=new Tn(e);On++}null!==d&&Rj(d,this);this.element=e;null!==d&&Pj(d,this);this.o();this.R();this.g("source",b,a)}}},sourceCrossOrigin:{get:function(){return this.ul},set:function(a){if(this.ul!==a&&(this.ul=a,null!==this.element)){var b=this.element.src;
null===a&&"string"===typeof b?this.element.crossOrigin=null:null!==a&&(this.element.crossOrigin=a(this));this.element.src=b}}},sourceRect:{get:function(){return this.$g},set:function(a){var b=this.$g;b.A(a)||(this.$g=a=a.I(),this.R(),this.g("sourceRect",b,a))}},imageStretch:{get:function(){return this.Sk},set:function(a){var b=this.Sk;b!==a&&(this.Sk=a,this.R(),this.g("imageStretch",b,a))}},flip:{get:function(){return this.zd},
set:function(a){var b=this.zd;b!==a&&(this.zd=a,this.R(),this.g("flip",b,a))}},imageAlignment:{get:function(){return this.Rk},set:function(a){var b=this.Rk;b.A(a)||(this.Rk=a=a.I(),this.o(),this.g("imageAlignment",b,a))}},errorFunction:{get:function(){return this.Ec},set:function(a){var b=this.Ec;b!==a&&(this.Ec=a,this.g("errorFunction",b,a))}},successFunction:{get:function(){return this.cf},set:function(a){var b=
this.cf;b!==a&&(this.cf=a,this.g("successFunction",b,a))}},naturalBounds:{get:function(){return this.jc}}});var Nn=null,On=0,Rn=4;Qj.className="Picture";Nn=new yb;Qj.clearCache=Sj;function Tn(a){this.Ll=[new Un(a,1)]}function Sn(a,b,c,d){var e=new ok(null),f=e.context,g=1/b;e.width=c/b;e.height=d/b;b=new Un(e.Ka,b);c=a.Ll[a.Ll.length-1];f.setTransform(g*c.ratio,0,0,g*c.ratio,0,0);f.drawImage(c.source,0,0);a.Ll.push(b)}Tn.className="PictureCacheArray";
function Un(a,b){this.source=a;this.ratio=b}Un.className="PictureCacheInstance";function Vn(){this.Qs=new ge;this.gc=null}t=Vn.prototype;t.reset=function(a){null!==a?(this.Qs=a,a.figures.clear()):this.Qs=new ge;this.gc=null};function ue(a,b,c,d,e){a.gc=new Xe;a.gc.startX=b;a.gc.startY=c;a.gc.isFilled=d;a.Qs.figures.add(a.gc);void 0!==e&&(a.gc.isShadowed=e)}function ye(a){var b=a.gc.segments.length;0<b&&a.gc.segments.N(b-1).close()}t.lq=function(a){this.gc.isShadowed=a};
t.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new Ye(Ce);d.endX=a;d.endY=b;c&&d.close();this.gc.segments.add(d)};t.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new Ye(le);d.endX=a;d.endY=b;c&&d.close();this.gc.segments.add(d)};function ve(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new Ye(De);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.gc.segments.add(k)}
function we(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new Ye(Ee);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.gc.segments.add(g)}t.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new Ye(Fe);h.startAngle=a;h.sweepAngle=b;h.centerX=c;h.centerY=d;h.radiusX=e;h.radiusY=0!==f?f:e;g&&h.close();this.gc.segments.add(h)};function xe(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new Ye(Re,g,h,b,c,d,e,f);k&&b.close();a.gc.segments.add(b)}
function te(a){var b=ze;if(null!==b)return ze=null,b.reset(a),b;b=new Vn;b.reset(a);return b}var ze=null;Vn.className="StreamGeometryContext";function Wn(a,b){var c=a.toLowerCase(),d=H.Je;d[a]=b;d[c]=a}Wn("Rectangle",function(a,b,c){a=new ge(ne);a.startX=0;a.startY=0;a.endX=b;a.endY=c;return a});Wn("Square",function(a,b,c){a=new ge(ne);a.startX=0;a.startY=0;a.endX=b;a.endY=c;a.defaultStretch=ch;return a});
Wn("RoundedRectangle",function(a,b,c){var d=a?a.parameter1:NaN;if(isNaN(d)||0>=d)d=5;d=Math.min(d,b/3);d=Math.min(d,c/3);a=d*H.ug;b=(new ge).add((new Xe(d,0,!0)).add(new Ye(le,b-d,0)).add(new Ye(De,b,d,b-a,0,b,a)).add(new Ye(le,b,c-d)).add(new Ye(De,b-d,c,b,c-a,b-a,c)).add(new Ye(le,d,c)).add(new Ye(De,0,c-d,a,c,0,c-a)).add(new Ye(le,0,d)).add((new Ye(De,d,0,0,a,a,0)).close()));1<a&&(b.spot1=new O(0,0,a,a),b.spot2=new O(1,1,-a,-a));return b});Wn("Border","RoundedRectangle");
Wn("Ellipse",function(a,b,c){a=new ge(re);a.startX=0;a.startY=0;a.endX=b;a.endY=c;a.spot1=Xd;a.spot2=Yd;return a});Wn("Circle",function(a,b,c){a=new ge(re);a.startX=0;a.startY=0;a.endX=b;a.endY=c;a.spot1=Xd;a.spot2=Yd;a.defaultStretch=ch;return a});Wn("TriangleRight",function(a,b,c){return(new ge).add((new Xe(0,0)).add(new Ye(le,b,.5*c)).add((new Ye(le,0,c)).close())).rm(0,.25,.5,.75)});
Wn("TriangleDown",function(a,b,c){return(new ge).add((new Xe(0,0)).add(new Ye(le,b,0)).add((new Ye(le,.5*b,c)).close())).rm(.25,0,.75,.5)});Wn("TriangleLeft",function(a,b,c){return(new ge).add((new Xe(b,c)).add(new Ye(le,0,.5*c)).add((new Ye(le,b,0)).close())).rm(.5,.25,1,.75)});Wn("TriangleUp",function(a,b,c){return(new ge).add((new Xe(b,c)).add(new Ye(le,0,c)).add((new Ye(le,.5*b,0)).close())).rm(.25,.5,.75,1)});Wn("Triangle","TriangleUp");
Wn("Diamond",function(a,b,c){return(new ge).add((new Xe(.5*b,0)).add(new Ye(le,0,.5*c)).add(new Ye(le,.5*b,c)).add((new Ye(le,b,.5*c)).close())).rm(.25,.25,.75,.75)});Wn("LineH",function(a,b,c){a=new ge(je);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});Wn("LineV",function(a,b,c){a=new ge(je);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});Wn("None","Rectangle");Wn("BarH","Rectangle");Wn("BarV","Rectangle");Wn("MinusLine","LineH");
Wn("PlusLine",function(a,b,c){return(new ge).add((new Xe(0,c/2,!1)).add(new Ye(le,b,c/2)).add(new Ye(Ce,b/2,0)).add(new Ye(le,b/2,c)))});Wn("XLine",function(a,b,c){return(new ge).add((new Xe(0,c,!1)).add(new Ye(le,b,0)).add(new Ye(Ce,0,0)).add(new Ye(le,b,c)))});
H.vm={"":"",Standard:"F1 m 0,0 l 8,4 -8,4 2,-4 z",Backward:"F1 m 8,0 l -2,4 2,4 -8,-4 z",Triangle:"F1 m 0,0 l 8,4.62 -8,4.62 z",BackwardTriangle:"F1 m 8,4 l 0,4 -8,-4 8,-4 0,4 z",Boomerang:"F1 m 0,0 l 8,4 -8,4 4,-4 -4,-4 z",BackwardBoomerang:"F1 m 8,0 l -8,4 8,4 -4,-4 4,-4 z",SidewaysV:"m 0,0 l 8,4 -8,4 0,-1 6,-3 -6,-3 0,-1 z",BackwardV:"m 8,0 l -8,4 8,4 0,-1 -6,-3 6,-3 0,-1 z",OpenTriangle:"m 0,0 l 8,4 -8,4",BackwardOpenTriangle:"m 8,0 l -8,4 8,4",OpenTriangleLine:"m 0,0 l 8,4 -8,4 m 8.5,0 l 0,-8",
BackwardOpenTriangleLine:"m 8,0 l -8,4 8,4 m -8.5,0 l 0,-8",OpenTriangleTop:"m 0,0 l 8,4 m 0,4",BackwardOpenTriangleTop:"m 8,0 l -8,4 m 0,4",OpenTriangleBottom:"m 0,8 l 8,-4",BackwardOpenTriangleBottom:"m 0,4 l 8,4",HalfTriangleTop:"F1 m 0,0 l 0,4 8,0 z m 0,8",BackwardHalfTriangleTop:"F1 m 8,0 l 0,4 -8,0 z m 0,8",HalfTriangleBottom:"F1 m 0,4 l 0,4 8,-4 z",BackwardHalfTriangleBottom:"F1 m 8,4 l 0,4 -8,-4 z",ForwardSemiCircle:"m 4,0 b 270 180 0 4 4",BackwardSemiCircle:"m 4,8 b 90 180 0 -4 4",Feather:"m 0,0 l 3,4 -3,4",
BackwardFeather:"m 3,0 l -3,4 3,4",DoubleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardDoubleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4",TripleFeathers:"m 0,0 l 3,4 -3,4 m 3,-8 l 3,4 -3,4 m 3,-8 l 3,4 -3,4",BackwardTripleFeathers:"m 3,0 l -3,4 3,4 m 3,-8 l -3,4 3,4 m 3,-8 l -3,4 3,4",ForwardSlash:"m 0,8 l 5,-8",BackSlash:"m 0,0 l 5,8",DoubleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8",DoubleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8",TripleForwardSlash:"m 0,8 l 4,-8 m -2,8 l 4,-8 m -2,8 l 4,-8",
TripleBackSlash:"m 0,0 l 4,8 m -2,-8 l 4,8 m -2,-8 l 4,8",Fork:"m 0,4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4",LineFork:"m 0,0 l 0,8 m 0,-4 l 8,0 m -8,0 l 8,-4 m -8,4 l 8,4",BackwardLineFork:"m 8,4 l -8,0 m 8,0 l -8,-4 m 8,4 l -8,4 m 8,-8 l 0,8",CircleFork:"F1 m 6,4 b 0 360 -3 0 3 z m 0,0 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",BackwardCircleFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 6,0 b 0 360 -3 0 3",CircleLineFork:"F1 m 6,4 b 0 360 -3 0 3 z m 1,-4 l 0,8 m 0,-4 l 6,0 m -6,0 l 6,-4 m -6,4 l 6,4",
BackwardCircleLineFork:"F1 m 0,4 l 6,0 m -6,-4 l 6,4 m -6,4 l 6,-4 m 0,-4 l 0,8 m 7,-4 b 0 360 -3 0 3",Circle:"F1 m 8,4 b 0 360 -4 0 4 z",Block:"F1 m 0,0 l 0,8 8,0 0,-8 z",StretchedDiamond:"F1 m 0,3 l 5,-3 5,3 -5,3 -5,-3 z",Diamond:"F1 m 0,4 l 4,-4 4,4 -4,4 -4,-4 z",Chevron:"F1 m 0,0 l 5,0 3,4 -3,4 -5,0 3,-4 -3,-4 z",StretchedChevron:"F1 m 0,0 l 8,0 3,4 -3,4 -8,0 3,-4 -3,-4 z",NormalArrow:"F1 m 0,2 l 4,0 0,-2 4,4 -4,4 0,-2 -4,0 z",X:"m 0,0 l 8,8 m 0,-8 l -8,8",TailedNormalArrow:"F1 m 0,0 l 2,0 1,2 3,0 0,-2 2,4 -2,4 0,-2 -3,0 -1,2 -2,0 1,-4 -1,-4 z",
DoubleTriangle:"F1 m 0,0 l 4,4 -4,4 0,-8 z m 4,0 l 4,4 -4,4 0,-8 z",BigEndArrow:"F1 m 0,0 l 5,2 0,-2 3,4 -3,4 0,-2 -5,2 0,-8 z",ConcaveTailArrow:"F1 m 0,2 h 4 v -2 l 4,4 -4,4 v -2 h -4 l 2,-2 -2,-2 z",RoundedTriangle:"F1 m 0,1 a 1,1 0 0 1 1,-1 l 7,3 a 0.5,1 0 0 1 0,2 l -7,3 a 1,1 0 0 1 -1,-1 l 0,-6 z",SimpleArrow:"F1 m 1,2 l -1,-2 2,0 1,2 -1,2 -2,0 1,-2 5,0 0,-2 2,2 -2,2 0,-2 z",AccelerationArrow:"F1 m 0,0 l 0,8 0.2,0 0,-8 -0.2,0 z m 2,0 l 0,8 1,0 0,-8 -1,0 z m 3,0 l 2,0 2,4 -2,4 -2,0 0,-8 z",BoxArrow:"F1 m 0,0 l 4,0 0,2 2,0 0,-2 2,4 -2,4 0,-2 -2,0 0,2 -4,0 0,-8 z",
TriangleLine:"F1 m 8,4 l -8,-4 0,8 8,-4 z m 0.5,4 l 0,-8",CircleEndedArrow:"F1 m 10,4 l -2,-3 0,2 -2,0 0,2 2,0 0,2 2,-3 z m -4,0 b 0 360 -3 0 3 z",DynamicWidthArrow:"F1 m 0,3 l 2,0 2,-1 2,-2 2,4 -2,4 -2,-2 -2,-1 -2,0 0,-2 z",EquilibriumArrow:"m 0,3 l 8,0 -3,-3 m 3,5 l -8,0 3,3",FastForward:"F1 m 0,0 l 3.5,4 0,-4 3.5,4 0,-4 1,0 0,8 -1,0 0,-4 -3.5,4 0,-4 -3.5,4 0,-8 z",Kite:"F1 m 0,4 l 2,-4 6,4 -6,4 -2,-4 z",HalfArrowTop:"F1 m 0,0 l 4,4 4,0 -8,-4 z m 0,8",HalfArrowBottom:"F1 m 0,8 l 4,-4 4,0 -8,4 z",
OpposingDirectionDoubleArrow:"F1 m 0,4 l 2,-4 0,2 4,0 0,-2 2,4 -2,4 0,-2 -4,0 0,2 -2,-4 z",PartialDoubleTriangle:"F1 m 0,0 4,3 0,-3 4,4 -4,4 0,-3 -4,3 0,-8 z",LineCircle:"F1 m 0,0 l 0,8 m 7 -4 b 0 360 -3 0 3 z",DoubleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",TripleLineCircle:"F1 m 0,0 l 0,8 m 2,-8 l 0,8 m 2,-8 l 0,8 m 7 -4 b 0 360 -3 0 3 z",CircleLine:"F1 m 6 4 b 0 360 -3 0 3 z m 1,-4 l 0,8",DiamondCircle:"F1 m 8,4 l -4,4 -4,-4 4,-4 4,4 m 8,0 b 0 360 -4 0 4 z",PlusCircle:"F1 m 8,4 b 0 360 -4 0 4 l -8 0 z m -4 -4 l 0 8",
OpenRightTriangleTop:"m 8,0 l 0,4 -8,0 m 0,4",OpenRightTriangleBottom:"m 8,8 l 0,-4 -8,0",Line:"m 0,0 l 0,8",DoubleLine:"m 0,0 l 0,8 m 2,0 l 0,-8",TripleLine:"m 0,0 l 0,8 m 2,0 l 0,-8 m 2,0 l 0,8",PentagonArrow:"F1 m 8,4 l -4,-4 -4,0 0,8 4,0 4,-4 z"};
function T(a){W.call(this,a);this.H=2408959;this.Og=this.vf="";this.Ro=this.Oo=this.bp=this.Vn=null;this.ep="";this.tf=this.Hn=this.cp=this.Yg=null;this.Qo="";this.Po=rc;this.Ob=this.So="";this.bi=this.Um=this.Lh=null;this.Lf=(new G(NaN,NaN)).freeze();this.ao="";this.Ue=null;this.bo=cd;this.To=Hd;this.lo=dc;this.co=ec;this.qn=null;this.Wn=127;this.ni=fc;this.zj="gray";this.Od=4;this.ww=-1;this.Dp=NaN;this.Qx=new N;this.nj=null;this.Rg=NaN}oa(T,W);
T.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);a.H=this.H&-4097|49152;a.vf=this.vf;a.Og=this.Og;a.Vn=this.Vn;a.bp=this.bp;a.Oo=this.Oo;a.Ro=this.Ro;a.ep=this.ep;a.cp=this.cp;a.Hn=this.Hn;a.tf=null;a.Qo=this.Qo;a.Po=this.Po.I();a.So=this.So;a.To=this.To.I();a.Ob=this.Ob;a.Um=this.Um;a.Lf.assign(this.Lf);a.ao=this.ao;a.bo=this.bo.I();a.lo=this.lo.I();a.co=this.co.I();a.qn=this.qn;a.Wn=this.Wn;a.ni=this.ni.I();a.zj=this.zj;a.Od=this.Od;a.Dp=this.Dp};
T.prototype.lf=function(a){W.prototype.lf.call(this,a);a.sh();a.Yg=null;a.Ue=null;a.nj=null};T.prototype.toString=function(){var a=Pa(this.constructor)+"#"+Fb(this);null!==this.data&&(a+="("+Qa(this.data)+")");return a};T.prototype.gk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===hf&&"elements"===b?e instanceof W?vj(e,function(a){xj(h.partManager,a);wj(h,a)}):Pj(h,e):a===jf&&"elements"===b&&(e instanceof W?vj(e,function(a){Bj(h.partManager,a);Aj(h,a)}):Rj(h,e)),h.cb(a,b,c,d,e,f,g))};
T.prototype.Da=function(a){W.prototype.Da.call(this,a);if(null!==this.data){a=this.W.j;for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof W&&vj(d,function(a){null!==a.data&&a.Da()})}}};T.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};T.prototype.Rj=function(a){var b=this.tf;return null===b?null:b.J(a)};
T.prototype.ih=function(a,b){if(null!==b){var c=null,d=this.tf;null!==d&&(c=d.J(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.tf=d=new Pb);b.vf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),b.data=this.data)}}};T.prototype.qf=function(a){var b=this.tf;if(null!==b){var c=b.J(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.tf=null)}};
T.prototype.Jj=function(){var a=this.tf;if(null!==a){var b=Ka();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.qf(b[c]);Oa(b)}};
T.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.o();c.placeholder&&c.placeholder.o()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.s()&&this.isVisible()&&b.pf()&&b.actualBounds.s())){c=this.Rj("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.th()?a.linkSelectionAdornmentTemplate:this instanceof kg?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate);
if(!(c instanceof sf))break a;$g(c);c=c.copy();null!==c&&(this.th()&&this.selectionObject===this.path&&(c.type=W.Link),c.adornedObject=b)}if(null!==c){if(null!==c.placeholder){var d=b.Be(),e=0;b instanceof V&&(e=b.strokeWidth);var f=L.alloc();f.h((b.naturalBounds.width+e)*d,(b.naturalBounds.height+e)*d);L.free(f)}c.type===W.Link?c.o():(b=G.alloc(),G.free(b));this.ih("Selection",c);break a}}this.qf("Selection")}Xn(this,a);for(b=this.adornments;b.next();)b.value.Da()}};
T.prototype.Kb=function(){var a=this.diagram;null!==a&&(Li(a),0!==(this.H&16384)!==!0&&(di(this,!0),a.ec()))};function ci(a){0!==(a.H&16384)!==!1&&(a.updateAdornments(),di(a,!1))}function Xn(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function Yn(a){if(!1===lj(a)){var b=a.diagram;null!==b&&(b.Ed.add(a),b.ec());Zn(a,!0);a.Xk()}}
function $n(a){a.H|=2097152;if(!1!==lj(a)){var b=a.position,c=a.location;c.s()&&b.s()||ao(a,b,c);c=a.wb;var d=N.alloc().assign(c);c.ha();c.x=b.x;c.y=b.y;c.freeze();a.ht(d,c);N.free(d);Zn(a,!1)}}T.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};T.prototype.moveTo=function(a,b,c){a=G.allocAt(a,b);this.move(a,c);G.free(a)};
T.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a&&!a.visible)return!1;a=this.diagram;if(null!==a&&(a=a.animationManager,a.isAnimating&&(a=a.pj.J(this),null!==a&&a.lt)))return!0;a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};t=T.prototype;t.Mb=function(a){var b=this.diagram;a?(this.B(4),this.Kb(),null!==b&&b.Ed.add(this)):(this.B(8),this.Jj());this.sh();null!==b&&(b.Xa(),b.R())};
t.bb=function(a){if(this.name===a)return this;var b=this.nj;null===b&&(this.nj=b=new Pb);if(null!==b.J(a))return b.J(a);var c=W.prototype.bb.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};t.qh=function(a,b,c){void 0===c&&(c=new G);b=b.mc()?gd:b;var d=a.naturalBounds;c.h(d.width*b.x+b.offsetX,d.height*b.y+b.offsetY);if(null===a||a===this)return c;a.transform.ta(c);for(a=a.panel;null!==a&&a!==this;)a.transform.ta(c),a=a.panel;this.Kf.ta(c);c.offset(-this.sc.x,-this.sc.y);return c};
t.Qp=function(a){void 0===a&&(a=new N);return a.assign(this.actualBounds)};t.ac=function(){!0===jj(this)&&(this instanceof kg&&this.memberParts.each(function(a){a.ac()}),this.measure(Infinity,Infinity));this.arrange()};
function tj(a,b){var c=a.Qx;isNaN(a.Rg)&&(a.Rg=Nm(a));var d=a.Rg;var e=2*d;if(!a.isShadowed)return c.h(b.x-1-d,b.y-1-d,b.width+2+e,b.height+2+e),c;d=b.x;e=b.y;var f=b.width;b=b.height;var g=a.shadowBlur;a=a.shadowOffset;f+=g;b+=g;d-=g/2;e-=g/2;0<a.x?f+=a.x:(d+=a.x,f-=a.x);0<a.y?b+=a.y:(e+=a.y,b-=a.y);c.h(d-1,e-1,f+2,b+2);return c}
T.prototype.arrange=function(){if(!1===kj(this))$n(this);else{var a=this.wb,b=N.alloc();b.assign(a);a.ha();var c=qg(this);this.lh(0,0,this.sc.width,this.sc.height);var d=this.position;ao(this,d,this.location);a.x=d.x;a.y=d.y;a.freeze();this.ht(b,a);Uk(this,!1);b.A(a)?this.kd(c):!this.cc()||H.w(b.width,a.width)&&H.w(b.height,a.height)||0<=this.ww&&this.B(16);N.free(b);Zn(this,!1)}};t=T.prototype;
t.ht=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.Lg&&a.s()){var e=N.alloc();e.assign(c.documentBounds);e.Iv(c.padding);a.x>e.x&&a.y>e.y&&a.right<e.right&&a.bottom<e.bottom&&b.x>e.x&&b.y>e.y&&b.right<e.right&&b.bottom<e.bottom&&(d=!0);N.free(e)}0!==(this.H&65536)!==!0&&a.A(b)||yj(this,d,c);c.R();Ac(a,b)||(this instanceof U&&!c.undoManager.isUndoingRedoing&&this.gd(),this.sh())}};
t.Ev=function(a,b){if(this.th()||!a.s())return!1;var c=this.diagram;if(null!==c&&(bo(this,c,a,b),!0===c.undoManager.isUndoingRedoing))return!0;this.sa=a;this.H&=-2097153;c=this.Lf;if(c.s()){var d=c.copy();c.h(c.x+(a.x-b.x),c.y+(a.y-b.y));this.g("location",d,c)}!1===lj(this)&&!1===kj(this)&&(Yn(this),$n(this));return!0};function bo(a,b,c,d){null===b||a instanceof sf||(b=b.animationManager,b.$a&&Rh(b,a,"position",d.copy(),c.copy(),!1))}
t.tt=function(a,b){var c=this.Lf,d=this.sa;lj(this)||kj(this)?c.h(NaN,NaN):c.h(c.x+a-d.x,c.y+b-d.y);d.h(a,b);Yn(this)};t.Fv=function(){this.H&=-2097153;Yn(this)};
function ao(a,b,c){var d=G.alloc(),e=a.locationSpot,f=a.locationObject;e.mc()&&A("determineOffset: Part's locationSpot must be real: "+e.toString());var g=f.naturalBounds,h=f instanceof V?f.strokeWidth:0;d.ik(0,0,g.width+h,g.height+h,e);if(f!==a)for(d.offset(-h/2,-h/2),f.transform.ta(d),e=f.panel;null!==e&&e!==a;)e.transform.ta(d),e=e.panel;a.Kf.ta(d);d.offset(-a.sc.x,-a.sc.y);e=a.diagram;f=c.s();g=b.s();f&&g?0!==(a.H&2097152)?co(a,b,c,e,d):eo(a,b,c,e,d):f?co(a,b,c,e,d):g&&eo(a,b,c,e,d);a.H|=2097152;
G.free(d);a.Xk()}function co(a,b,c,d,e){var f=b.x,g=b.y;b.h(c.x-e.x,c.y-e.y);null!==d&&(c=d.animationManager,(e=c.isAnimating)||!c.$a||a instanceof sf||Rh(c,a,"position",new G(f,g),b,!1),e||b.x===f&&b.y===g||(c=d.skipsUndoManager,d.skipsUndoManager=!0,a.g("position",new G(f,g),b),d.skipsUndoManager=c))}function eo(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.A(f)||null===d||(b=d.skipsUndoManager,d.skipsUndoManager=!0,a.g("location",f,c),d.skipsUndoManager=b)}
function yj(a,b,c){Wk(a,!1);a instanceof U&&jk(c,a);a.layer.isTemporary||b||c.Xa();b=a.wb;var d=c.viewportBounds;d.s()?qg(a)?(Dc(b,d,10)||a.kd(!1),a.updateAdornments()):b.Jc(d)?(a.kd(!0),a.updateAdornments()):a.Kb():c.Xh=!0}t.Hi=function(){return!0};t.cc=function(){return!0};t.th=function(){return!1};t.pg=function(){return!0};
function fo(a,b,c,d){b.constructor===a.constructor||ho||(ho=!0,ya('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),ya(" Old class: "+Pa(a.constructor)+", new class: "+Pa(b.constructor)+", part: "+a.toString()));a.Jj();var e=a.data;c=a.layerName;var f=a.isSelected,g=a.isHighlighted,h=!0,k=!0,l=!1;a instanceof U&&(h=a.isTreeLeaf,k=a.isTreeExpanded,l=a.wasTreeExpanded);b.lf(a);b.cloneProtected(a);a.vf=d;a.o();a.R();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager,
b.skipsUndoManager=!0);a.kb=e;null!==e&&a.Da();null!==b&&(b.skipsUndoManager=d);e=a.layerName;e!==c&&(a.Og=c,a.layerName=e);a instanceof U&&(a.isTreeLeaf=h,a.isTreeExpanded=k,a.wasTreeExpanded=l,a.cc()&&a.B(64));a.isSelected=f;a.isHighlighted=g}T.prototype.canCopy=function(){if(!this.copyable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowCopy)return!1;a=a.diagram;return null===a?!0:a.allowCopy?!0:!1};
T.prototype.canDelete=function(){if(!this.deletable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowDelete)return!1;a=a.diagram;return null===a?!0:a.allowDelete?!0:!1};T.prototype.canEdit=function(){if(!this.textEditable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowTextEdit)return!1;a=a.diagram;return null===a?!0:a.allowTextEdit?!0:!1};
T.prototype.canGroup=function(){if(!this.groupable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowGroup)return!1;a=a.diagram;return null===a?!0:a.allowGroup?!0:!1};T.prototype.canMove=function(){if(!this.movable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowMove)return!1;a=a.diagram;return null===a?!0:a.allowMove?!0:!1};
T.prototype.canReshape=function(){if(!this.reshapable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowReshape)return!1;a=a.diagram;return null===a?!0:a.allowReshape?!0:!1};T.prototype.canResize=function(){if(!this.resizable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowResize)return!1;a=a.diagram;return null===a?!0:a.allowResize?!0:!1};
T.prototype.canRotate=function(){if(!this.rotatable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRotate)return!1;a=a.diagram;return null===a?!0:a.allowRotate?!0:!1};T.prototype.canSelect=function(){if(!this.selectable)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowSelect)return!1;a=a.diagram;return null===a?!0:a.allowSelect?!0:!1};function di(a,b){a.H=b?a.H|16384:a.H&-16385}function lj(a){return 0!==(a.H&32768)}function Zn(a,b){a.H=b?a.H|32768:a.H&-32769}
function Wk(a,b){a.H=b?a.H|65536:a.H&-65537}function qg(a){return 0!==(a.H&131072)}t=T.prototype;t.kd=function(a){this.H=a?this.H|131072:this.H&-131073};function io(a,b){a.H=b?a.H|1048576:a.H&-1048577}t.sh=function(){var a=this.containingGroup;null!==a&&(a.o(),null!==a.placeholder&&a.placeholder.o(),a.gd())};t.R=function(){var a=this.diagram;null!==a&&!kj(this)&&!lj(this)&&this.isVisible()&&this.wb.s()&&a.R(tj(this,this.wb))};
t.o=function(){W.prototype.o.call(this);var a=this.diagram;null!==a&&(a.Ed.add(this),this instanceof U&&null!==this.labeledLink&&kl(this.labeledLink),a.ec(!0))};t.Tp=function(a){a||(a=this.Lh,null!==a&&jo(a,this))};t.Up=function(a){a||(a=this.Lh,null!==a&&ko(a,this))};t.Pj=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.im(a))}};t.Ky=function(){return lo(this,this)};
function lo(a,b){var c=b.containingGroup;return null!==c?1+lo(a,c):b instanceof U&&(b=b.labeledLink,null!==b)?lo(a,b):0}t.Ny=function(){return mo(this,this)};function mo(a,b){var c=b.containingGroup;return null!==c||b instanceof U&&(c=b.labeledLink,null!==c)?mo(a,c):b}t.Ee=function(a){return a instanceof kg?no(this,this,a):!1};function no(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!no(a,d,c)?b instanceof U&&(b=b.labeledLink,null!==b)?no(a,b,c):!1:!0}
t.ax=function(a){if(null===a)return null;if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof kg&&io(b,!0);if(b instanceof U){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.H&1048576)){c=b;break}b instanceof U&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof kg&&io(b,!1),b instanceof U&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c};
T.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof U&&this.isLinkLabel?!1:!0};
T.prototype.B=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof U&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.Lh,null!==b){var c=b.layout;null!==c?c.B():b.B(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.B())};function zj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0}
function Ak(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof sf))if(a.add(b),b instanceof U){if(c&&b instanceof kg)for(var g=b.memberParts;g.next();)Ak(a,g.value,c,d,e,f);if(!1!==e)for(g=b.linksConnected;g.next();){var h=g.value;if(!a.contains(h)){var k=h.fromNode,l=h.toNode;k=null===k||a.contains(k);l=null===l||a.contains(l);(e?k&&l:k||l)&&Ak(a,h,c,d,e,f)}}if(1<d)for(b=b.Su();b.next();)Ak(a,b.value,c,d-1,e,f)}else if(b instanceof S)for(b=b.labelNodes;b.next();)Ak(a,
b.value,c,d,e,f)}
pa.Object.defineProperties(T.prototype,{key:{get:function(){var a=this.diagram;if(null!==a)return a.model.pa(this.data)}},adornments:{get:function(){return null===this.tf?Ab:this.tf.iteratorValues}},layer:{get:function(){return this.bi}},diagram:{get:function(){var a=this.bi;return null!==a?a.diagram:null}},layerName:{get:function(){return this.Og},set:function(a){var b=
this.Og;if(b!==a){var c=this.diagram;if(null===c||null!==c.Tl(a)&&!c.partManager.addsToTemporaryLayer)if(this.Og=a,null!==c&&c.Xa(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.Tl(a),null!==a&&a!==b))){var d=b.zc(-1,this,!0);0<=d&&c.cb(jf,"parts",b,this,null,d,!0);d=a.Gi(99999999,this,!0);b.visible!==a.visible&&this.Mb(a.visible);0<=d&&c.cb(hf,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.ca;c.ca=!0;d(this,b,a);c.ca=e}}}}},layerChanged:{
get:function(){return this.Vn},set:function(a){var b=this.Vn;b!==a&&(this.Vn=a,this.g("layerChanged",b,a))}},zOrder:{get:function(){return this.Dp},set:function(a){var b=this.Dp;if(b!==a){this.Dp=a;var c=this.layer;null!==c&&gi(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.R()}}},locationObject:{get:function(){if(null===this.Ue){var a=this.locationObjectName;""!==a?(a=this.bb(a),null!==a?this.Ue=a:this.Ue=this):
this instanceof sf?this.type!==W.Link&&null!==this.placeholder?this.Ue=this.placeholder:this.Ue=this:this.Ue=this}return this.Ue.visible?this.Ue:this}},minLocation:{get:function(){return this.lo},set:function(a){var b=this.lo;b.A(a)||(this.lo=a=a.I(),this.g("minLocation",b,a))}},maxLocation:{get:function(){return this.co},set:function(a){var b=this.co;b.A(a)||(this.co=a=a.I(),this.g("maxLocation",b,a))}},locationObjectName:{
get:function(){return this.ao},set:function(a){var b=this.ao;b!==a&&(this.ao=a,this.Ue=null,this.o(),this.g("locationObjectName",b,a))}},locationSpot:{get:function(){return this.bo},set:function(a){var b=this.bo;b.A(a)||(this.bo=a=a.I(),this.o(),this.g("locationSpot",b,a))}},location:{get:function(){return this.Lf},set:function(a){var b=a.x,c=a.y,d=this.Lf,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||
(a=a.I(),b=a,this.th()?b=!1:(this.Lf=b,this.H|=2097152,!1===kj(this)&&(Yn(this),c=this.sa,c.s()&&(e=c.copy(),c.h(c.x+(b.x-d.x),c.y+(b.y-d.y)),bo(this,this.diagram,c,e),this.g("position",e,c))),b=!0),b&&this.g("location",d,a))}},category:{get:function(){return this.vf},set:function(a){var b=this.vf;if(b!==a){var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&!(this instanceof sf)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.W.addAll(this.W))}this.vf=
a;this.g("category",b,a);null===c||null===d||this instanceof sf?this instanceof sf&&(e=this.adornedPart,null!==e&&(a=e.tf,null!==a&&a.remove(b),e.ih(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.th()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&($g(c),c=c.copy(),null!==c&&fo(this,c,b,a))):(null!==f&&f.kq(d,a),c=oo(c.partManager,d,a),null!==c&&($g(c),c=c.copy(),null===c||c instanceof S||(c.location=this.location,fo(this,
c,b,a)))),null!==e&&(b=this.clone(),b.W.addAll(this.W),this.g("self",e,b))))}}},self:{get:function(){return this},set:function(a){fo(this,a,this.category,a.category)}},copyable:{get:function(){return 0!==(this.H&1)},set:function(a){var b=0!==(this.H&1);b!==a&&(this.H^=1,this.g("copyable",b,a))}},deletable:{get:function(){return 0!==(this.H&2)},set:function(a){var b=0!==(this.H&2);b!==a&&(this.H^=2,this.g("deletable",
b,a))}},textEditable:{get:function(){return 0!==(this.H&4)},set:function(a){var b=0!==(this.H&4);b!==a&&(this.H^=4,this.g("textEditable",b,a),this.Kb())}},groupable:{get:function(){return 0!==(this.H&8)},set:function(a){var b=0!==(this.H&8);b!==a&&(this.H^=8,this.g("groupable",b,a))}},movable:{get:function(){return 0!==(this.H&16)},set:function(a){var b=0!==(this.H&16);b!==a&&(this.H^=16,this.g("movable",b,a))}},
selectionAdorned:{get:function(){return 0!==(this.H&32)},set:function(a){var b=0!==(this.H&32);b!==a&&(this.H^=32,this.g("selectionAdorned",b,a),this.Kb())}},isInDocumentBounds:{get:function(){return 0!==(this.H&64)},set:function(a){var b=0!==(this.H&64);if(b!==a){this.H^=64;var c=this.diagram;null!==c&&c.Xa();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{get:function(){return 0!==(this.H&128)},set:function(a){var b=
0!==(this.H&128);b!==a&&(this.H^=128,this.g("isLayoutPositioned",b,a),this.B(a?4:8))}},selectable:{get:function(){return 0!==(this.H&256)},set:function(a){var b=0!==(this.H&256);b!==a&&(this.H^=256,this.g("selectable",b,a),this.Kb())}},reshapable:{get:function(){return 0!==(this.H&512)},set:function(a){var b=0!==(this.H&512);b!==a&&(this.H^=512,this.g("reshapable",b,a),this.Kb())}},resizable:{get:function(){return 0!==
(this.H&1024)},set:function(a){var b=0!==(this.H&1024);b!==a&&(this.H^=1024,this.g("resizable",b,a),this.Kb())}},rotatable:{get:function(){return 0!==(this.H&2048)},set:function(a){var b=0!==(this.H&2048);b!==a&&(this.H^=2048,this.g("rotatable",b,a),this.Kb())}},isSelected:{get:function(){return 0!==(this.H&4096)},set:function(a){var b=0!==(this.H&4096);if(b!==a){var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=
c.maxSelectionCount)){this.H^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection;e.ha();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Kb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.ec(),c.skipsUndoManager=d)}}}},isHighlighted:{get:function(){return 0!==(this.H&524288)},set:function(a){var b=0!==(this.H&524288);if(b!==a){this.H^=524288;var c=this.diagram;null!==c&&(c=c.highlighteds,c.ha(),a?c.add(this):
c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.R();a=this.highlightedChanged;null!==a&&a(this)}}},isShadowed:{get:function(){return 0!==(this.H&8192)},set:function(a){var b=0!==(this.H&8192);b!==a&&(this.H^=8192,this.g("isShadowed",b,a),this.R())}},isAnimated:{get:function(){return 0!==(this.H&262144)},set:function(a){var b=0!==(this.H&262144);b!==a&&(this.H^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{
get:function(){return this.Hn},set:function(a){var b=this.Hn;b!==a&&(this.Hn=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{get:function(){return this.ep},set:function(a){var b=this.ep;b!==a&&(this.ep=a,this.Yg=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{get:function(){return this.bp},set:function(a){var b=this.bp;b!==a&&(this.bp=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{
get:function(){if(null===this.Yg){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.bb(a),null!==a?this.Yg=a:this.Yg=this):this instanceof S?(a=this.path,null!==a?this.Yg=a:this.Yg=this):this.Yg=this}return this.Yg}},selectionChanged:{get:function(){return this.cp},set:function(a){var b=this.cp;b!==a&&(this.cp=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{get:function(){return this.Oo},set:function(a){var b=
this.Oo;b!==a&&(this.Oo=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{get:function(){return this.Qo},set:function(a){var b=this.Qo;b!==a&&(this.Qo=a,this.g("resizeObjectName",b,a))}},resizeObject:{get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.bb(a),null!==a)?a:this}},resizeCellSize:{get:function(){return this.Po},set:function(a){var b=this.Po;b.A(a)||(this.Po=a=a.I(),this.g("resizeCellSize",
b,a))}},rotateAdornmentTemplate:{get:function(){return this.Ro},set:function(a){var b=this.Ro;b!==a&&(this.Ro=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{get:function(){return this.So},set:function(a){var b=this.So;b!==a&&(this.So=a,this.g("rotateObjectName",b,a))}},rotateObject:{get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.bb(a),null!==a)?a:this}},rotationSpot:{
get:function(){return this.To},set:function(a){var b=this.To;b.A(a)||(this.To=a=a.I(),this.g("rotationSpot",b,a))}},text:{get:function(){return this.Ob},set:function(a){var b=this.Ob;b!==a&&(this.Ob=a,this.g("text",b,a))}},containingGroup:{get:function(){return this.Lh},set:function(a){if(this.cc()){var b=this.Lh;if(b!==a){null===a||this!==a&&!a.Ee(this)||(this===a&&A("Cannot make a Group a member of itself: "+this.toString()),
A("Cannot make a Group indirectly contain itself: "+this.toString()+" already contains "+a.toString()));this.B(2);var c=this.diagram;null!==b?ko(b,this):this instanceof kg&&null!==c&&c.ti.remove(this);this.Lh=a;null!==a?jo(a,this):this instanceof kg&&null!==c&&c.ti.add(this);this.B(1);if(null!==c){var d=this.data,e=c.model;if(null!==d&&e.Wj()){var f=e.pa(null!==a?a.data:null);e.qt(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.ca,c.ca=!0),d(this,b,a),null!==c&&(c.ca=e));if(this instanceof
kg)for(c=new F,Ak(c,this,!0,0,!0),c=c.iterator;c.next();)if(d=c.value,d instanceof U)for(d=d.linksConnected;d.next();)po(d.value);if(this instanceof U){for(c=this.linksConnected;c.next();)po(c.value);c=this.labeledLink;null!==c&&po(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&gi(b,-1,a))}}else A("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{get:function(){return this.Um},set:function(a){var b=this.Um;b!==a&&
(this.Um=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{get:function(){return null!==this.containingGroup||this instanceof U&&null!==this.labeledLink?!1:!0}},layoutConditions:{get:function(){return this.Wn},set:function(a){var b=this.Wn;b!==a&&(this.Wn=a,this.g("layoutConditions",b,a))}},dragComputation:{get:function(){return this.qn},set:function(a){var b=this.qn;b!==a&&(this.qn=a,this.g("dragComputation",
b,a))}},shadowOffset:{get:function(){return this.ni},set:function(a){var b=this.ni;b.A(a)||(this.ni=a=a.I(),this.R(),this.g("shadowOffset",b,a))}},shadowColor:{get:function(){return this.zj},set:function(a){var b=this.zj;b!==a&&(this.zj=a,this.R(),this.g("shadowColor",b,a))}},shadowBlur:{get:function(){return this.Od},set:function(a){var b=this.Od;b!==a&&(this.Od=a,this.R(),this.g("shadowBlur",b,a))}}});
T.prototype.invalidateLayout=T.prototype.B;T.prototype.findCommonContainingGroup=T.prototype.ax;T.prototype.isMemberOf=T.prototype.Ee;T.prototype.findTopLevelPart=T.prototype.Ny;T.prototype.findSubGraphLevel=T.prototype.Ky;T.prototype.ensureBounds=T.prototype.ac;T.prototype.getDocumentBounds=T.prototype.Qp;T.prototype.getRelativePoint=T.prototype.qh;T.prototype.findObject=T.prototype.bb;T.prototype.moveTo=T.prototype.moveTo;T.prototype.invalidateAdornments=T.prototype.Kb;
T.prototype.clearAdornments=T.prototype.Jj;T.prototype.removeAdornment=T.prototype.qf;T.prototype.addAdornment=T.prototype.ih;T.prototype.findAdornment=T.prototype.Rj;T.prototype.updateTargetBindings=T.prototype.Da;var ho=!1;T.className="Part";T.LayoutNone=0;T.LayoutAdded=1;T.LayoutRemoved=2;T.LayoutShown=4;T.LayoutHidden=8;T.LayoutNodeSized=16;T.LayoutGroupLayout=32;T.LayoutNodeReplaced=64;T.LayoutStandard=127;T.LayoutAll=16777215;
function sf(a){T.call(this,a);this.H&=-257;this.Og="Adornment";this.Vb=null;this.zw=0;this.Kw=!1;this.l=[];this.Ua=null}oa(sf,T);sf.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};sf.prototype.updateRelationshipsFromData=function(){};
sf.prototype.$j=function(a){var b=this.adornedObject.part;if(b instanceof S&&this.adornedObject instanceof V){var c=b.path;b.$j(a);a=c.geometry;b=this.W.j;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof V&&(e.qa=a)}}};sf.prototype.Hi=function(){var a=this.Vb;if(null===a)return!0;a=a.part;return null===a||!kj(a)};sf.prototype.cc=function(){return!1};
sf.prototype.gk=function(a,b,c,d,e,f,g){if(a===hf&&"elements"===b)if(e instanceof Zg)null===this.Ua&&(this.Ua=e);else{if(e instanceof W){var h=e.Sl(function(a){return a instanceof Zg});h instanceof Zg&&null===this.Ua&&(this.Ua=h)}}else a===jf&&"elements"===b&&null!==this.Ua&&(d===this.Ua?this.Ua=null:d instanceof W&&this.Ua.ng(d)&&(this.Ua=null));T.prototype.gk.call(this,a,b,c,d,e,f,g)};sf.prototype.updateAdornments=function(){};sf.prototype.Pj=function(){};
pa.Object.defineProperties(sf.prototype,{placeholder:{get:function(){return this.Ua}},adornedObject:{get:function(){return this.Vb},set:function(a){var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.qf(this.category);this.Vb=a;null!==c&&c.ih(this.category,this)}},adornedPart:{get:function(){var a=this.Vb;return null!==a?a.part:null}},containingGroup:{
get:function(){return null}}});sf.className="Adornment";function U(a){T.call(this,a);this.Z=13;this.Za=new E;this.xp=this.Zk=this.ei=this.Yn=this.Xn=null;this.uk=Sc;this.tc=this.Le=null;this.Ko=qo;this.gh=!1}oa(U,T);U.prototype.cloneProtected=function(a){T.prototype.cloneProtected.call(this,a);a.Z=this.Z;a.Z=this.Z&-17;a.Xn=this.Xn;a.Yn=this.Yn;a.ei=this.ei;a.xp=this.xp;a.uk=this.uk.I();a.Ko=this.Ko};t=U.prototype;t.lf=function(a){T.prototype.lf.call(this,a);a.gd();a.Le=this.Le;a.tc=null};
function ro(a,b){null!==b&&(null===a.Le&&(a.Le=new F),a.Le.add(b))}function so(a,b,c,d){if(null===b||null===a.Le)return null;for(var e=a.Le.iterator;e.next();){var f=e.value;if(f.ft===a&&f.iv===b&&f.ux===c&&f.vx===d||f.ft===b&&f.iv===a&&f.ux===d&&f.vx===c)return f}return null}t.iz=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=so(this,a,b,c);null!==a&&a.Xl()};
t.gk=function(a,b,c,d,e,f,g){a===hf&&"elements"===b?this.tc=null:a===jf&&"elements"===b&&(this.tc=null);T.prototype.gk.call(this,a,b,c,d,e,f,g)};t.gd=function(a){void 0===a&&(a=null);for(var b=this.linksConnected;b.next();){var c=b.value;null!==a&&a.contains(c)||(to(this,c.fromPort),to(this,c.toPort),c.Pa())}};function Xk(a,b){for(var c=a.linksConnected;c.next();){var d=c.value;if(d.fromPort===b||d.toPort===b)to(a,d.fromPort),to(a,d.toPort),d.Pa()}}
function to(a,b){null!==b&&(b=b.Jo,null!==b&&b.Xl(),a=a.containingGroup,null===a||a.isSubGraphExpanded||to(a,a.port))}t.Hi=function(){return!0};U.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.Gp(this.uk);return a};U.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a};
U.prototype.isVisible=function(){if(!T.prototype.isVisible.call(this))return!1;var a=!0,b=ni,c=this.diagram;if(null!==c){a=c.animationManager;if(a.isAnimating&&(a=a.pj.J(this),null!==a&&a.lt))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===ni){if(c=this.lg(),null!==c&&!c.isTreeExpanded)return!1}else if(b===qk){if(c=a?this.Qu():this.Ru(),0<c.count&&c.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===rk&&(c=a?this.Qu():this.Ru(),0<c.count&&c.any(function(a){return!a.isTreeExpanded})))return!1;
c=this.labeledLink;return null!==c?c.isVisible():!0};t=U.prototype;t.Mb=function(a){T.prototype.Mb.call(this,a);for(var b=this.linksConnected;b.next();)b.value.Mb(a)};t.Ou=function(a){void 0===a&&(a=null);if(null===a)return this.Za.iterator;var b=new Cb(this.Za),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};
t.Np=function(a){void 0===a&&(a=null);var b=new Cb(this.Za),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b};t.ud=function(a){void 0===a&&(a=null);var b=new Cb(this.Za),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b};
t.Pu=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Za.iterator;d.next();){var e=d.value;if(e.fromNode===this){if(null===a||e.fromPortId===a)e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e}else e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new Bb(c):Ab};
t.Ru=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Za.iterator;d.next();){var e=d.value;e.fromNode!==this||null!==a&&e.fromPortId!==a||(e=e.toNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new Bb(c):Ab};
t.Qu=function(a){void 0===a&&(a=null);for(var b=null,c=null,d=this.Za.iterator;d.next();){var e=d.value;e.toNode!==this||null!==a&&e.toPortId!==a||(e=e.fromNode,null!==b?b.add(e):null!==c&&c!==e?(b=new F,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new Bb(c):Ab};
t.Gy=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new Cb(this.Za),e=this;d.predicate=function(d){return(d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c)&&(d.fromNode!==a||d.toNode!==e||null!==c&&d.fromPortId!==c||null!==b&&d.toPortId!==b)?!1:!0};return d};
t.Hy=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);var d=new Cb(this.Za),e=this;d.predicate=function(d){return d.fromNode!==e||d.toNode!==a||null!==b&&d.fromPortId!==b||null!==c&&d.toPortId!==c?!1:!0};return d};
function uo(a,b,c){to(a,c);var d=a.Za.contains(b);d||a.Za.add(b);if(!d||b.fromNode===b.toNode){var e=a.linkConnected;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.ca,g.ca=!0);e(a,b,c);null!==g&&(g.ca=f)}}!d&&b.isTreeLink&&(c=b.fromNode,b=b.toNode,null!==c&&null!==b&&c!==b&&(d=!0,a=a.diagram,null!==a&&(d=a.isTreePathToChildren),e=d?b:c,f=d?c:b,e.gh||(e.gh=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))}
function vo(a,b,c){to(a,c);var d=a.Za.remove(b),e=null;if(d||b.toNode===b.fromNode){var f=a.linkDisconnected;e=a.diagram;if(null!==f){var g=!0;null!==e&&(g=e.ca,e.ca=!0);f(a,b,c);null!==e&&(e.ca=g)}}d&&b.isTreeLink&&(c=!0,null!==e&&(c=e.isTreePathToChildren),a=c?b.toNode:b.fromNode,b=c?b.fromNode:b.toNode,null!==a&&(a.gh=!1),null===b||b.isTreeLeaf||(0===b.Za.count?(b.gh=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):pk(b)))}
function pk(a){a.gh=!1;if(0!==a.Za.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.Za.iterator;c.next();){var d=c.value;if(d.isTreeLink)if(b){if(d.fromNode===a){a.isTreeLeaf=!1;return}}else if(d.toNode===a){a.isTreeLeaf=!1;return}}a.isTreeLeaf=!0}}}U.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=U.prototype;
t.Tp=function(a){T.prototype.Tp.call(this,a);a||(pk(this),a=this.Zk,null!==a&&wo(a,this))};t.Up=function(a){T.prototype.Up.call(this,a);a||(a=this.Zk,null!==a&&null!==a.bd&&(a.bd.remove(this),a.o()))};
t.Pj=function(){if(0<this.Za.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.Za.copy().iterator;c.next();){var d=c.value;b?a.remove(d):(d.fromNode===this&&(d.fromNode=null),d.toNode===this&&(d.toNode=null))}}this.labeledLink=null;T.prototype.Pj.call(this)};t.Ps=function(a){if(null===this.tc){if(""===a&&!1===this.rh)return this;xo(this)}var b=this.tc.J(a);return null!==b||""!==a&&(b=this.tc.J(""),null!==b)?b:this};
function xo(a){null===a.tc?a.tc=new Pb:a.tc.clear();a.sm(a,function(a,c){zl(a,c)});0===a.tc.count&&a.tc.add("",a)}function zl(a,b){var c=b.portId;null!==c&&null!==a.tc&&a.tc.add(c,b)}function yl(a,b,c){var d=b.portId;if(null!==d&&(null!==a.tc&&a.tc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.Ou(d);a.next();)d=a.value,null===c&&(c=Ka()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Oa(c)}}}
t.kz=function(a){if(null===a||a===this)return!1;var b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this;if(b)for(;c!==a;){b=null;for(var d=c.Za.iterator;d.next();){var e=d.value;if(e.isTreeLink&&(b=e.fromNode,b!==c&&b!==this))break}if(b===this||null===b||b===c)return!1;c=b}else for(;c!==a;){b=null;for(d=c.Za.iterator;d.next()&&(e=d.value,!e.isTreeLink||(b=e.toNode,b===c||b===this)););if(b===this||null===b||b===c)return!1;c=b}return!0};
t.Ry=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.Za.iterator;c.next();){var d=c.value;if(d.isTreeLink&&(a=d.fromNode,a!==b&&a!==this))break}if(a===this)return this;if(null===a||a===b)return b;b=a}else for(;;){a=null;for(c=b.Za.iterator;c.next()&&(d=c.value,!d.isTreeLink||(a=d.toNode,a===b||a===this)););if(a===this)return this;if(null===a||a===b)return b;b=a}};
t.Dy=function(a){if(null===a)return null;if(this===a)return this;for(var b=this;null!==b;)io(b,!0),b=b.lg();var c=null;for(b=a;null!==b;){if(0!==(b.H&1048576)){c=b;break}b=b.lg()}for(b=this;null!==b;)io(b,!1),b=b.lg();return c};t.Ai=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.Za.iterator;if(a)for(;b.next();){if(a=b.value,a.isTreeLink&&a.fromNode!==this)return a}else for(;b.next();)if(a=b.value,a.isTreeLink&&a.toNode!==this)return a;return null};
t.lg=function(){var a=this.gh;if(null===a)return null;if(a instanceof U)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.Za.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.gh=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.gh=b;return this.gh=null};t.Py=function(){function a(b,d){if(null!==b){d.add(b);var c=b.Ai();null!==c&&(d.add(c),a(b.lg(),d))}}var b=new F;a(this,b);return b};
t.Oy=function(){return yo(this,this)};function yo(a,b){b=b.lg();return null===b?0:1+yo(a,b)}t.Pp=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new Cb(this.Za);var c=this;b.predicate=a?function(a){return a.isTreeLink&&a.fromNode===c?!0:!1}:function(a){return a.isTreeLink&&a.toNode===c?!0:!1};return b};
t.Su=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.Za.iterator;if(a)for(;d.next();)a=d.value,a.isTreeLink&&a.fromNode===this&&(a=a.toNode,null!==b?b.add(a):null!==c&&c!==a?(b=new E,b.add(c),b.add(a)):c=a);else for(;d.next();)a=d.value,a.isTreeLink&&a.toNode===this&&(a=a.fromNode,null!==b?b.add(a):null!==c&&c!==a?(b=new E,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new Bb(c):Ab};
t.Qy=function(a){void 0===a&&(a=Infinity);var b=new F;Ak(b,this,!1,a,!0);return b};U.prototype.collapseTree=function(a){void 0===a&&(a=1);1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.De){b.De=!0;var c=new F;c.add(this);zo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ni);b.De=!1}};function zo(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.Np():a.ud();h.next();){var k=h.value;k.isTreeLink&&(k=k.Ts(a),null===k||k===a||b.contains(k)||(b.add(k),zo(k,b,c,d-1,e,f,g)))}else Ao(a,b,c,e,f,g)}
function Ao(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.Np():a.ud();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.Ts(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.Ep(k,e),k.sh(),k.Mb(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||Ao(k,b,c,d,e,f))}}a.isTreeExpanded=!1}
U.prototype.expandTree=function(a){void 0===a&&(a=2);2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.De){b.De=!0;var c=new F;c.add(this);Bo(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===ni);b.De=!1}};
function Bo(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Np():a.ud();k.next();){var l=k.value;l.isTreeLink&&(h||l.Lc||l.Pa(),l=l.Ts(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Mb(!0),l.sh(),g&&e.Fp(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,Bo(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0}
pa.Object.defineProperties(U.prototype,{portSpreading:{get:function(){return this.Ko},set:function(a){var b=this.Ko;b!==a&&(this.Ko=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.gd())}},avoidable:{get:function(){return 0!==(this.Z&8)},set:function(a){var b=0!==(this.Z&8);if(b!==a){this.Z^=8;var c=this.diagram;null!==c&&jk(c,this);this.g("avoidable",b,a)}}},avoidableMargin:{
get:function(){return this.uk},set:function(a){"number"===typeof a&&(a=new Lc(a));var b=this.uk;if(!b.A(a)){this.uk=a=a.I();var c=this.diagram;null!==c&&jk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{get:function(){return this.Za.iterator}},linkConnected:{get:function(){return this.Xn},set:function(a){var b=this.Xn;b!==a&&(this.Xn=a,this.g("linkConnected",b,a))}},linkDisconnected:{get:function(){return this.Yn},
set:function(a){var b=this.Yn;b!==a&&(this.Yn=a,this.g("linkDisconnected",b,a))}},linkValidation:{get:function(){return this.ei},set:function(a){var b=this.ei;b!==a&&(this.ei=a,this.g("linkValidation",b,a))}},isLinkLabel:{get:function(){return null!==this.Zk}},labeledLink:{get:function(){return this.Zk},set:function(a){var b=this.Zk;if(b!==a){var c=this.diagram,d=this.data;if(null!==b){null!==b.bd&&(b.bd.remove(this),
b.o());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.Zl()){var g=f.pa(d);void 0!==g&&f.wx(e,g)}}this.containingGroup=null}this.Zk=a;null!==a&&(wo(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,c=c.model,null!==e&&c.Zl()&&(d=c.pa(d),void 0!==d&&c.Au(e,d))),this.containingGroup=a.containingGroup);kl(this);this.g("labeledLink",b,a)}}},port:{get:function(){return this.Ps("")}},ports:{
get:function(){null===this.tc&&xo(this);return this.tc.iteratorValues}},isTreeExpanded:{get:function(){return 0!==(this.Z&1)},set:function(a){var b=0!==(this.Z&1);if(b!==a){this.Z^=1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.ca,c.ca=!0);b(this);null!==c&&(c.ca=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Mb(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{
get:function(){return 0!==(this.Z&2)},set:function(a){var b=0!==(this.Z&2);b!==a&&(this.Z^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{get:function(){return this.xp},set:function(a){var b=this.xp;b!==a&&(this.xp=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{get:function(){return 0!==(this.Z&4)},set:function(a){var b=0!==(this.Z&4);b!==a&&(this.Z^=4,this.g("isTreeLeaf",b,a))}}});U.prototype.expandTree=U.prototype.expandTree;
U.prototype.collapseTree=U.prototype.collapseTree;U.prototype.findTreeParts=U.prototype.Qy;U.prototype.findTreeChildrenNodes=U.prototype.Su;U.prototype.findTreeChildrenLinks=U.prototype.Pp;U.prototype.findTreeLevel=U.prototype.Oy;U.prototype.findTreeParentChain=U.prototype.Py;U.prototype.findTreeParentNode=U.prototype.lg;U.prototype.findTreeParentLink=U.prototype.Ai;U.prototype.findCommonTreeParent=U.prototype.Dy;U.prototype.findTreeRoot=U.prototype.Ry;U.prototype.isInTreeOf=U.prototype.kz;
U.prototype.findPort=U.prototype.Ps;U.prototype.findLinksTo=U.prototype.Hy;U.prototype.findLinksBetween=U.prototype.Gy;U.prototype.findNodesInto=U.prototype.Qu;U.prototype.findNodesOutOf=U.prototype.Ru;U.prototype.findNodesConnected=U.prototype.Pu;U.prototype.findLinksInto=U.prototype.ud;U.prototype.findLinksOutOf=U.prototype.Np;U.prototype.findLinksConnected=U.prototype.Ou;U.prototype.invalidateConnectedLinks=U.prototype.gd;U.prototype.invalidateLinkBundle=U.prototype.iz;
var Co=new D(U,"SpreadingNone",10),qo=new D(U,"SpreadingEvenly",11),Do=new D(U,"SpreadingPacked",12);U.className="Node";U.SpreadingNone=Co;U.SpreadingEvenly=qo;U.SpreadingPacked=Do;function kg(a){U.call(this,a);this.Z|=4608;this.io=new F;this.il=new F;this.Ua=this.op=this.fi=this.jo=this.ho=null;this.ic=new ui;this.ic.group=this}oa(kg,U);
kg.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);this.Z=this.Z&-32769;a.ho=this.ho;a.jo=this.jo;a.fi=this.fi;a.op=this.op;var b=a.Sl(function(a){return a instanceof Zg});b instanceof Zg?a.Ua=b:a.Ua=null;null!==this.ic?(a.ic=this.ic.copy(),a.ic.group=a):(null!==a.ic&&(a.ic.group=null),a.ic=null)};t=kg.prototype;
t.lf=function(a){U.prototype.lf.call(this,a);var b=a.Tj();for(a=a.memberParts;a.next();){var c=a.value;c.o();c.B(8);c.Jj();if(c instanceof U)c.gd(b);else if(c instanceof S)for(c=c.labelNodes;c.next();)c.value.gd(b)}};
t.gk=function(a,b,c,d,e,f,g){if(a===hf&&"elements"===b)if(e instanceof Zg)null===this.Ua?this.Ua=e:this.Ua!==e&&A("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof W){var h=e.Sl(function(a){return a instanceof Zg});h instanceof Zg&&(null===this.Ua?this.Ua=h:this.Ua!==h&&A("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===jf&&"elements"===b&&null!==this.Ua&&(d===this.Ua?this.Ua=null:d instanceof W&&this.Ua.ng(d)&&(this.Ua=null));
U.prototype.gk.call(this,a,b,c,d,e,f,g)};t.lh=function(a,b,c,d){this.Ue=this.Ua;U.prototype.lh.call(this,a,b,c,d)};t.Hi=function(){if(!U.prototype.Hi.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof U){if(b.isVisible()&&kj(b))return!1}else if(b instanceof S&&b.isVisible()&&kj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0};
function jo(a,b){if(a.io.add(b)){b instanceof kg&&a.il.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.ca,e.ca=!0);c(a,b);null!==e&&(e.ca=d)}a.isVisible()&&a.isSubGraphExpanded||b.Mb(!1)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Ua,null===b&&(b=a),b.o())}
function ko(a,b){if(a.io.remove(b)){b instanceof kg&&a.il.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.ca,e.ca=!0);c(a,b);null!==e&&(e.ca=d)}a.isVisible()&&a.isSubGraphExpanded||b.Mb(!0)}b instanceof S&&!a.computesBoundsIncludingLinks||(b=a.Ua,null===b&&(b=a),b.o())}t.Pj=function(){if(0<this.io.count){var a=this.diagram;if(null!==a)for(var b=this.io.copy().iterator;b.next();)a.remove(b.value)}U.prototype.Pj.call(this)};
kg.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=Ck(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};kg.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=Ck(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d};
kg.prototype.canUngroup=function(){if(!this.ungroupable)return!1;var a=this.layer;if(null!==a&&!a.allowUngroup)return!1;a=a.diagram;return null===a||a.allowUngroup?!0:!1};t=kg.prototype;
t.gd=function(a){void 0===a&&(a=null);var b=0!==(this.Z&65536);U.prototype.gd.call(this,a);if(!b)for(0!==(this.Z&65536)!==!0&&(this.Z=this.Z^65536),b=this.Nu();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Ee(this)&&!d.isVisible()?(to(d,c.fromPort),to(d,c.toPort),c.Pa()):(d=c.toNode,null!==d&&d!==this&&d.Ee(this)&&!d.isVisible()&&(to(d,c.fromPort),to(d,c.toPort),c.Pa()))}}};
t.Nu=function(){var a=this.Tj();a.add(this);for(var b=new F,c=a.iterator;c.next();){var d=c.value;if(d instanceof U)for(d=d.linksConnected;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.iterator};t.Fy=function(){var a=this.Tj();a.add(this);for(var b=new F,c=a.iterator;c.next();){var d=c.value;if(d instanceof U)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;a.contains(f)&&f!==this||b.add(f);e=e.toNode;a.contains(e)&&e!==this||b.add(e)}}return b.iterator};
t.Ey=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new F;a(this,b);return b};t.Tj=function(){var a=new F;Ak(a,this,!0,0,!0);a.remove(this);return a};t.Mb=function(a){U.prototype.Mb.call(this,a);for(var b=this.memberParts;b.next();)b.value.Mb(a)};kg.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.De){a.De=!0;var b=this.Tj();Eo(this,b,a,this);a.De=!1}};
function Eo(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Mb(!1);f instanceof kg&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,Eo(f,b,c,d));if(f instanceof U)f.gd(b),c.Ep(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.gd(b)}a.isSubGraphExpanded=!1}kg.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.De){a.De=!0;var b=this.Tj();Fo(this,b,a,this);a.De=!1}};
function Fo(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Mb(!0);f instanceof kg&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,Fo(f,b,c,d));if(f instanceof U)f.gd(b),c.Fp(f,d);else if(f instanceof S)for(f=f.labelNodes;f.next();)f.value.gd(b)}a.isSubGraphExpanded=!0}
kg.prototype.move=function(a,b){void 0===b&&(b=!1);var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);c=c.y;isNaN(c)&&(c=0);d=a.x-d;c=a.y-c;var e=G.allocAt(d,c);U.prototype.move.call(this,a,b);a=new F;for(b=this.Tj().iterator;b.next();){var f=b.value;f instanceof S&&(f.suspendsRouting&&a.add(f),f.Lc||f.fromNode!==this&&f.toNode!==this)&&(f.suspendsRouting=!0)}for(b.reset();b.next();)if(f=b.value,!(f.th()||f instanceof U&&f.isLinkLabel)){var g=f.position,h=f.location;g.s()?(e.x=g.x+d,e.y=g.y+
c,f.position=e):h.s()&&(e.x=h.x+d,e.y=h.y+c,f.location=e)}for(b.reset();b.next();)if(f=b.value,f instanceof S&&(f.suspendsRouting=a.contains(f),f.Lc||f.fromNode!==this&&f.toNode!==this))g=f.position,e.x=g.x+d,e.y=g.y+c,e.s()?f.move(e):f.Pa(),Hj(f)&&f.Pa();G.free(e)};
pa.Object.defineProperties(kg.prototype,{placeholder:{get:function(){return this.Ua}},computesBoundsAfterDrag:{get:function(){return 0!==(this.Z&2048)},set:function(a){var b=0!==(this.Z&2048);b!==a&&(this.Z^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{get:function(){return 0!==(this.Z&4096)},set:function(a){var b=0!==(this.Z&4096);b!==a&&(this.Z^=4096,this.g("computesBoundsIncludingLinks",
b,a))}},computesBoundsIncludingLocation:{get:function(){return 0!==(this.Z&8192)},set:function(a){var b=0!==(this.Z&8192);b!==a&&(this.Z^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{get:function(){return 0!==(this.Z&16384)},set:function(a){var b=0!==(this.Z&16384);b!==a&&(this.Z^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{get:function(){return this.io.iterator}},
layout:{get:function(){return this.ic},set:function(a){var b=this.ic;if(b!==a){null!==b&&(b.diagram=null,b.group=null);this.ic=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.wg=!0);this.g("layout",b,a);null!==c&&c.ec()}}},memberAdded:{get:function(){return this.ho},set:function(a){var b=this.ho;b!==a&&(this.ho=a,this.g("memberAdded",b,a))}},memberRemoved:{get:function(){return this.jo},
set:function(a){var b=this.jo;b!==a&&(this.jo=a,this.g("memberRemoved",b,a))}},memberValidation:{get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(this.fi=a,this.g("memberValidation",b,a))}},ungroupable:{get:function(){return 0!==(this.Z&256)},set:function(a){var b=0!==(this.Z&256);b!==a&&(this.Z^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{get:function(){return 0!==(this.Z&512)},
set:function(a){var b=0!==(this.Z&512);if(b!==a){this.Z^=512;var c=this.diagram;this.g("isSubGraphExpanded",b,a);b=this.subGraphExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.ca,c.ca=!0);b(this);null!==c&&(c.ca=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Ua&&this.Ua.o(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{get:function(){return 0!==(this.Z&1024)},set:function(a){var b=
0!==(this.Z&1024);b!==a&&(this.Z^=1024,this.g("wasSubGraphExpanded",b,a))}},subGraphExpandedChanged:{get:function(){return this.op},set:function(a){var b=this.op;b!==a&&(this.op=a,this.g("subGraphExpandedChanged",b,a))}},fk:{get:function(){return 0!==(this.Z&32768)},set:function(a){0!==(this.Z&32768)!==a&&(this.Z^=32768)}}});kg.prototype.expandSubGraph=kg.prototype.expandSubGraph;kg.prototype.collapseSubGraph=kg.prototype.collapseSubGraph;
kg.prototype.findSubGraphParts=kg.prototype.Tj;kg.prototype.findContainingGroupChain=kg.prototype.Ey;kg.prototype.findExternalNodesConnected=kg.prototype.Fy;kg.prototype.findExternalLinksConnected=kg.prototype.Nu;kg.className="Group";function Zg(){Y.call(this);this.gb=Rc;this.Zo=new N(NaN,NaN,NaN,NaN)}oa(Zg,Y);Zg.prototype.cloneProtected=function(a){Y.prototype.cloneProtected.call(this,a);a.gb=this.gb.I();a.Zo=this.Zo.copy()};
Zg.prototype.nh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return Gc(0,0,b.width,b.height,a.x,a.y)};
Zg.prototype.bm=function(){var a=this.part;null!==a&&(a instanceof kg||a instanceof sf)||A("Placeholder is not inside a Group or Adornment.");if(a instanceof kg){var b=this.computeBorder(this.Zo),c=this.minSize,d=this.jc;xc(d,(isFinite(c.width)?Math.max(c.width,b.width):b.width)||0,(isFinite(c.height)?Math.max(c.height,b.height):b.height)||0);Qk(this,0,0,d.width,d.height);d=a.memberParts;for(c=!1;d.next();)if(d.value.isVisible()){c=!0;break}d=a.diagram;!c||null===d||d.animationManager.isAnimating||
isNaN(b.x)||isNaN(b.y)||(c=G.alloc(),c.Li(b,a.locationSpot),c.A(a.location)||(a.location=new G(c.x,c.y)),G.free(c))}else{b=this.jc;c=this.gb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.Ci();var g=0;f instanceof V&&(g=f.strokeWidth);var h=f.Be(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==W.Link&&(f=f.ma("Selection"===a.category?cd:a.locationSpot,G.alloc()),a.location=f,G.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.ma(cd,G.alloc()),f=N.allocAt(l.x,l.y,0,
0),f.Ie(a.ma(pd,l)),f.Ie(a.ma(ed,l)),f.Ie(a.ma(id,l)),xc(b,f.width+d||0,f.height+e||0),Qk(this,-c.left,-c.top,b.width,b.height),G.free(l),N.free(f)):(xc(b,l+d||0,g+e||0),Qk(this,-c.left,-c.top,b.width,b.height))}};Zg.prototype.lh=function(a,b,c,d){this.actualBounds.h(a,b,c,d)};
Zg.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof kg&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.Zo.s()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.Zo,a),null!==c))return c}c=N.alloc();d=this.computeMemberBounds(c);var e=this.gb;b instanceof kg&&!b.isSubGraphExpanded?a.h(d.x-e.left,d.y-e.top,0,0):a.h(d.x-e.left,d.y-e.top,Math.max(d.width+e.left+e.right,0),Math.max(d.height+e.top+e.bottom,0));N.free(c);
b instanceof kg&&b.computesBoundsIncludingLocation&&b.location.s()&&a.Ie(b.location);return a};
Zg.prototype.computeMemberBounds=function(a){if(!(this.part instanceof kg))return a.h(0,0,0,0),a;for(var b=this.part,c=Infinity,d=Infinity,e=-Infinity,f=-Infinity,g=b.memberParts;g.next();){var h=g.value;if(h.isVisible()){if(h instanceof S){if(!b.computesBoundsIncludingLinks)continue;if(jj(h))continue;if(h.fromNode===b||h.toNode===b)continue}h=h.actualBounds;h.left<c&&(c=h.left);h.top<d&&(d=h.top);h.right>e&&(e=h.right);h.bottom>f&&(f=h.bottom)}}isFinite(c)&&isFinite(d)?a.h(c,d,e-c,f-d):(b=b.location,
a.h(b.x,b.y,0,0));return a};pa.Object.defineProperties(Zg.prototype,{padding:{get:function(){return this.gb},set:function(a){"number"===typeof a&&(a=new Lc(a));var b=this.gb;b.A(a)||(this.gb=a=a.I(),this.g("padding",b,a))}}});Zg.className="Placeholder";
function S(){T.call(this,W.Link);this.Sa=8;this.Ne=null;this.Oe="";this.df=this.zn=null;this.ef="";this.wp=null;this.Gm=Qg;this.an=0;this.dn=Qg;this.en=NaN;this.wj=Go;this.kp=.5;this.bd=null;this.yb=(new E).freeze();this.ol=this.Ug=null;this.Lo=new N;this.qa=new ge;this.vr=!0;this.K=this.u=this.uf=this.Ef=null;this.l=[];this.tu=new G;this.hr=this.Gw=this.Fw=null;this.Xt=NaN;this.P=null}oa(S,T);
S.prototype.cloneProtected=function(a){T.prototype.cloneProtected.call(this,a);a.Sa=this.Sa&-113;a.Oe=this.Oe;a.zn=this.zn;a.ef=this.ef;a.wp=this.wp;a.Gm=this.Gm;a.an=this.an;a.dn=this.dn;a.en=this.en;a.wj=this.wj;a.kp=this.kp;null!==this.P&&(a.P=this.P.copy())};t=S.prototype;t.lf=function(a){T.prototype.lf.call(this,a);this.Oe=a.Oe;this.ef=a.ef;a.Ug=null;a.Pa();a.uf=this.uf;var b=a.fromPort;null!==b&&to(a.fromNode,b);b=a.toPort;null!==b&&to(a.toNode,b)};
t.hb=function(a){a.classType===S?2===(a.value&2)?this.routing=a:a===Tg||a===Pg||a===Og?this.curve=a:a===Ho||a===Io||a===Jo?this.adjusting=a:a!==Go&&a!==Qg&&A("Unknown Link enum value for a Link property: "+a):T.prototype.hb.call(this,a)};t.Ic=function(){null===this.P&&(this.P=new Mk)};t.Hi=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(kj(a)||lj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),kj(a)||lj(a))?!1:!0};t.Ev=function(){return!1};
t.Fv=function(){};t.cc=function(){return!1};S.prototype.computeAngle=function(a,b,c){return S.computeAngle(b,c)};S.computeAngle=function(a,b){switch(a){default:case Qg:a=0;break;case gn:a=b;break;case vm:a=b+90;break;case xm:a=b-90;break;case Ko:a=b+180;break;case Lo:a=H.aq(b);90<a&&270>a&&(a-=180);break;case wm:a=H.aq(b+90);90<a&&270>a&&(a-=180);break;case ym:a=H.aq(b-90);90<a&&270>a&&(a-=180);break;case zm:a=H.aq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return H.aq(a)};
function po(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.ax(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.Lh;if(c!==b){null!==c&&ko(c,a);a.Lh=b;null!==b&&jo(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.ca,g.ca=!0);e(a,c,b);null!==g&&(g.ca=f)}!a.Lc||a.Fw!==c&&a.Gw!==c||a.Pa()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=S.prototype;
t.sh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&T.prototype.sh.call(this)};t.Ts=function(a){var b=this.fromNode;return a===b?this.toNode:b};t.Xy=function(a){var b=this.fromPort;return a===b?this.toPort:b};function wo(a,b){null===a.bd&&(a.bd=new F);a.bd.add(b);a.o()}
t.Tp=function(a){T.prototype.Tp.call(this,a);Mo(this)&&this.Vp(this.actualBounds);if(!a){a=this.Ne;var b=null;null!==a&&(b=this.fromPort,uo(a,this,b));var c=this.df;if(null!==c){var d=this.toPort;c===a&&d===b||uo(c,this,d)}No(this)}};t.Up=function(a){T.prototype.Up.call(this,a);Mo(this)&&this.Vp(this.actualBounds);if(!a){a=this.Ne;var b=null;null!==a&&(b=this.fromPort,vo(a,this,b));var c=this.df;if(null!==c){var d=this.toPort;c===a&&d===b||vo(c,this,d)}Oo(this)}};
t.Pj=function(){this.Lc=!0;if(null!==this.bd){var a=this.diagram;if(null!==a)for(var b=this.bd.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};S.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}};
S.prototype.move=function(a,b){var c=b?this.location:this.position,d=c.x;isNaN(d)&&(d=0);var e=c.y;isNaN(e)&&(e=0);d=a.x-d;e=a.y-e;!0===b?T.prototype.move.call(this,a,!1):(a=G.allocAt(c.x+d,c.y+e),T.prototype.move.call(this,a,!1),G.free(a));bg(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)};
S.prototype.canRelinkFrom=function(){if(!this.relinkableFrom)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};S.prototype.canRelinkTo=function(){if(!this.relinkableTo)return!1;var a=this.layer;if(null===a)return!0;if(!a.allowRelink)return!1;a=a.diagram;return null===a||a.allowRelink?!0:!1};
S.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(gc),a;if(1===b)return a.assign(this.i(0)),a;if(2===b){var c=this.i(0),d=this.i(1);a.h((c.x+d.x)/2,(c.y+d.y)/2);return a}if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===Tg))return this.qa.Vu(.5,a),a.add(this.i(0)),c=this.qa.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===Tg){if(3===b)return this.i(1);d=(b-1)/3|0;c=3*(d/2|0);if(1===d%2){d=this.i(c);var e=this.i(c+1),
f=this.i(c+2);c=this.i(c+3);H.jy(d.x,d.y,e.x,e.y,f.x,f.y,c.x,c.y,a)}else a.assign(this.i(c));return a}var g=this.flattenedLengths;c=this.flattenedTotalLength;for(e=f=d=0;d<c/2&&f<b;){e=g[f];if(d+e>c/2)break;d+=e;f++}b=this.i(f);f=this.i(f+1);1>Math.abs(b.x-f.x)?b.y>f.y?a.h(b.x,b.y-(c/2-d)):a.h(b.x,b.y+(c/2-d)):1>Math.abs(b.y-f.y)?b.x>f.x?a.h(b.x-(c/2-d),b.y):a.h(b.x+(c/2-d),b.y):(c=(c/2-d)/e,a.h(b.x+c*(f.x-b.x),b.y+c*(f.y-b.y)));return a};
S.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Va(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===Tg)){a:{a=this.qa;var b=.5;0>b?b=0:1<b&&(b=1);if(a.type===je)a=180*Math.atan2(a.endY-a.startY,a.endX-a.startX)/Math.PI;else{var c=a.flattenedSegments,d=a.flattenedLengths,e=c.length;b=a.flattenedTotalLength*b;for(var f=0,g=0;g<e;g++){var h=d[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=b){b=c[g];c=b[2*a];
d=b[2*a+1];e=b[2*a+2];a=b[2*a+3];a=1>Math.abs(e-c)&&1>Math.abs(a-d)?0:1>Math.abs(e-c)?0<=a-d?90:270:1>Math.abs(a-d)?0<=e-c?0:180:180*Math.atan2(a-d,e-c)/Math.PI;break a}f+=l}}a=NaN}}return a}if(this.computeCurve()===Tg&&4<=a){d=(a-1)/3|0;c=3*(d/2|0);if(1===d%2)return c=Math.floor(c),a=this.i(c),d=this.i(c+1),e=this.i(c+2),c=this.i(c+3),H.iy(a.x,a.y,d.x,d.y,e.x,e.y,c.x,c.y);if(0<c&&c+1<a)return this.i(c-1).Va(this.i(c+1))}d=this.flattenedLengths;e=this.flattenedTotalLength;for(c=b=0;b<e/2&&c<a;){f=
d[c];if(b+f>e/2)break;b+=f;c++}d=this.i(c);e=this.i(c+1);if(1>Math.abs(d.x-e.x)&&1>Math.abs(d.y-e.y)){if(0<c&&c+2<a)return this.i(c-1).Va(this.i(c+2))}else{if(1>Math.abs(d.x-e.x))return d.y>e.y?270:90;if(1>Math.abs(d.y-e.y))return d.x>e.x?180:0}return d.Va(e)};t=S.prototype;t.i=function(a){return this.yb.j[a]};t.ld=function(a,b){this.yb.jd(a,b)};t.M=function(a,b,c){this.yb.jd(a,new G(b,c))};t.gz=function(a,b){this.yb.Jb(a,b)};t.m=function(a,b,c){this.yb.Jb(a,new G(b,c))};t.we=function(a){this.yb.add(a)};
t.hf=function(a,b){this.yb.add(new G(a,b))};t.tv=function(a){this.yb.nb(a)};t.Kj=function(){this.yb.clear()};function bg(a,b,c){if(0!==b||0!==c){for(var d=a.Lc,e=new E,f=a.yb.iterator;f.next();){var g=f.value;e.add((new G(g.x+b,g.y+c)).freeze())}e.freeze();f=a.yb;a.yb=e;isNaN(b)||isNaN(c)||a.diagram.animationManager.$a?a.o():(a.Lf.h(a.Lf.x+b,a.Lf.y+c),a.sa.h(a.sa.x+b,a.sa.y+c),kl(a));d&&Po(a);b=a.diagram;null!==b&&b.animationManager.$a&&(a.ol=e);a.g("points",f,e)}}
t.wh=function(){null===this.Ug&&(this.Ug=this.yb,this.yb=this.yb.copy())};
t.jf=function(){if(null!==this.Ug){for(var a=this.Ug,b=this.yb,c=Infinity,d=Infinity,e=a.j,f=e.length,g=0;g<f;g++){var h=e[g];c=Math.min(h.x,c);d=Math.min(h.y,d)}h=g=Infinity;for(var k=b.j,l=k.length,m=0;m<l;m++){var n=k[m];g=Math.min(n.x,g);h=Math.min(n.y,h);n.freeze()}b.freeze();if(l===f)for(f=0;f<l;f++){if(m=e[f],n=k[f],m.x-c!==n.x-g||m.y-d!==n.y-h){this.o();this.bc();break}}else this.o(),this.bc();this.Ug=null;c=this.diagram;null!==c&&c.animationManager.$a&&(this.ol=b);Po(this);this.g("points",
a,b)}};t.yx=function(){null!==this.Ug&&(this.yb=this.Ug,this.Ug=null)};function Po(a){0===a.yb.count?a.Lc=!1:(a.Lc=!0,a.hr=null,a.Xt=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),Qo(a,!1))}t.Pa=function(){if(!this.suspendsRouting){var a=this.diagram;a&&(a.ct.contains(this)||a.undoManager.isUndoingRedoing||a.animationManager.isTicking&&!a.animationManager.isAnimating)||(a=this.path,null!==a&&(this.Lc=!1,this.o(),a.o()))}};
t.Pi=function(){if(!this.Lc&&!this.Iu){var a=!0;try{this.Iu=!0,this.wh(),a=this.computePoints()}finally{this.Iu=!1,a?this.jf():this.yx()}}};
S.prototype.computePoints=function(){var a=this.diagram;if(null===a)return!1;var b=this.fromNode,c=null;null===b?(a.ki||(a.Uo=new V,a.Uo.desiredSize=jc,a.Uo.strokeWidth=0,a.ki=new U,a.ki.add(a.Uo),a.ki.ac()),this.defaultFromPoint&&(a.ki.position=a.ki.location=this.defaultFromPoint,a.ki.ac(),b=a.ki,c=a.Uo)):c=this.fromPort;if(null!==c&&!b.isVisible()){var d=b.findVisibleNode();null!==d&&d!==b?(b=d,c=d.port):b=d}this.Fw=b;if(null===b||!b.location.s())return!1;for(;!(null===c||c.actualBounds.s()&&c.pf());)c=
c.panel;if(null===c)return!1;var e=this.toNode,f=null;null===e?(a.li||(a.Vo=new V,a.Vo.desiredSize=jc,a.Vo.strokeWidth=0,a.li=new U,a.li.add(a.Vo),a.li.ac()),this.defaultToPoint&&(a.li.position=a.li.location=this.defaultToPoint,a.li.ac(),e=a.li,f=a.Vo)):f=this.toPort;null===f||e.isVisible()||(a=e.findVisibleNode(),null!==a&&a!==e?(e=a,f=a.port):e=a);this.Gw=e;if(null===e||!e.location.s())return!1;for(;!(null===f||f.actualBounds.s()&&f.pf());)f=f.panel;if(null===f)return!1;var g=this.pointsCount;d=
this.computeSpot(!0,c);a=this.computeSpot(!1,f);var h=Ro(d),k=Ro(a),l=c===f&&null!==c,m=this.isOrthogonal,n=this.curve===Tg;this.Ef=l&&!m?n=!0:!1;var p=this.adjusting===Qg||l;if(!m&&!l&&h&&k){if(h=!1,!p&&3<=g&&(p=this.getLinkPoint(b,c,d,!0,!1,e,f),k=this.getLinkPoint(e,f,a,!1,!1,b,c),h=this.adjustPoints(0,p,g-1,k))&&(p=this.getLinkPoint(b,c,d,!0,!1,e,f),k=this.getLinkPoint(e,f,a,!1,!1,b,c),this.adjustPoints(0,p,g-1,k)),!h)if(this.Kj(),n){g=this.getLinkPoint(b,c,d,!0,!1,e,f);p=this.getLinkPoint(e,
f,a,!1,!1,b,c);h=p.x-g.x;k=p.y-g.y;l=this.computeCurviness();n=m=0;var q=g.x+h/3,r=g.y+k/3,u=q,v=r;H.w(k,0)?v=0<h?v-l:v+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=(0>k?-1:1)*n+q,v=m*(u-q)+r);q=g.x+2*h/3;r=g.y+2*k/3;var x=q,y=r;H.w(k,0)?y=0<h?y-l:y+l:(x=(0>k?-1:1)*n+q,y=m*(x-q)+r);this.Kj();this.we(g);this.hf(u,v);this.hf(x,y);this.we(p);this.ld(0,this.getLinkPoint(b,c,d,!0,!1,e,f));this.ld(3,this.getLinkPoint(e,f,a,!1,!1,b,c))}else d=this.getLinkPoint(b,c,d,!0,!1,e,f),a=this.getLinkPoint(e,
f,a,!1,!1,b,c),this.hasCurviness()?(p=a.x-d.x,e=a.y-d.y,f=this.computeCurviness(),b=d.x+p/2,c=d.y+e/2,g=b,h=c,H.w(e,0)?h=0<p?h-f:h+f:(p=-p/e,g=Math.sqrt(f*f/(p*p+1)),0>f&&(g=-g),g=(0>e?-1:1)*g+b,h=p*(g-b)+c),this.we(d),this.hf(g,h)):this.we(d),this.we(a)}else{n=this.isAvoiding;p&&(m&&n||l)&&this.Kj();var z=l?this.computeCurviness():0;n=this.getLinkPoint(b,c,d,!0,m,e,f);q=u=r=0;if(m||!h||l)v=this.computeEndSegmentLength(b,c,d,!0),q=this.getLinkDirection(b,c,n,d,!0,m,e,f),l&&(h||d.A(a)||!m&&1===d.x+
a.x&&1===d.y+a.y)&&(q-=m?90:30,0>z&&(q-=180)),0>q?q+=360:360<=q&&(q-=360),l&&(v+=Math.abs(z)*(m?1:2)),0===q?r=v:90===q?u=v:180===q?r=-v:270===q?u=-v:(r=v*Math.cos(q*Math.PI/180),u=v*Math.sin(q*Math.PI/180)),d.mc()&&l&&(v=c.ma(gd,G.alloc()),x=G.allocAt(v.x+1E3*r,v.y+1E3*u),this.getLinkPointFromPoint(b,c,v,x,!0,n),G.free(v),G.free(x));v=this.getLinkPoint(e,f,a,!1,m,b,c);var B=y=x=0;if(m||!k||l){var C=this.computeEndSegmentLength(e,f,a,!1);B=this.getLinkDirection(e,f,v,a,!1,m,b,c);l&&(k||d.A(a)||!m&&
1===d.x+a.x&&1===d.y+a.y)&&(B+=m?0:30,0>z&&(B+=180));0>B?B+=360:360<=B&&(B-=360);l&&(C+=Math.abs(z)*(m?1:2));0===B?x=C:90===B?y=C:180===B?x=-C:270===B?y=-C:(x=C*Math.cos(B*Math.PI/180),y=C*Math.sin(B*Math.PI/180));a.mc()&&l&&(a=f.ma(gd,G.alloc()),d=G.allocAt(a.x+1E3*x,a.y+1E3*y),this.getLinkPointFromPoint(e,f,a,d,!1,v),G.free(a),G.free(d))}a=n;if(m||!h||l)a=new G(n.x+r,n.y+u);d=v;if(m||!k||l)d=new G(v.x+x,v.y+y);!p&&!m&&h&&3<g&&this.adjustPoints(0,n,g-2,d)?this.ld(g-1,v):!p&&!m&&k&&3<g&&this.adjustPoints(1,
a,g-1,v)?this.ld(0,n):!p&&(m?6<=g:4<g)&&this.adjustPoints(1,a,g-2,d)?(this.ld(0,n),this.ld(g-1,v)):(this.Kj(),this.we(n),(m||!h||l)&&this.we(a),m&&this.addOrthoPoints(a,q,d,B,b,e),(m||!k||l)&&this.we(d),this.we(v))}return!0};function So(a,b){Math.abs(b.x-a.x)>Math.abs(b.y-a.y)?(b.x>=a.x?b.x=a.x+9E9:b.x=a.x-9E9,b.y=a.y):(b.y>=a.y?b.y=a.y+9E9:b.y=a.y-9E9,b.x=a.x);return b}
S.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new G);if(null===a||null===b)return f.assign(c),f;a.isVisible()||(e=a.findVisibleNode(),null!==e&&e!==a&&(b=e.port));a=null;e=b.panel;null===e||e.Yd()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.td;e=1/(a.m11*a.m22-a.m12*a.m21);g=a.m22*e;var h=-a.m12*e,k=-a.m21*e,l=a.m11*e,m=e*(a.m21*a.dy-a.m22*a.dx),n=e*(a.m12*a.dx-a.m11*a.dy);e=d.x*g+d.y*k+m;d=d.x*h+d.y*l+n;g=c.x*g+c.y*k+m;c=c.x*h+c.y*l+n}b.Uj(e,d,g,c,f);null!==
a&&f.transform(a);return f};function To(a,b){var c=b.Jo;null===c&&(c=new Uo,c.port=b,c.node=b.part,b.Jo=c);return Vo(c,a)}
S.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new G);if(c.ib()&&!Ro(c))return b.ma(c,h),h;if(c.nf()){var k=To(this,b);if(null!==k){h.assign(k.Yp);if(e&&this.routing===Wo){var l=To(this,g);if(null!==l&&k.Ql<l.Ql){k=G.alloc();l=G.alloc();var m=new N(b.ma(cd,k),b.ma(pd,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.mf(rd)||c.mf(sd))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.mf(qd)||c.mf(td))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);G.free(k);G.free(l)}}return h}}c=
b.ma(.5===c.x&&.5===c.y?c:gd,G.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=So(c,g.copy()))):(k=this.computeSpot(!d,g),f=G.alloc(),g=g.ma(.5===k.x&&.5===k.y?k:gd,f),e&&(g=So(c,g)),G.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);G.free(c);return h};
S.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.ib())var k=d.x>d.y?d.x>1-d.y?0:d.x<1-d.y?270:315:d.x<d.y?d.x>1-d.y?90:d.x<1-d.y?180:135:.5>d.x?225:.5<d.x?45:0;else{if(d.nf()&&(k=To(this,b),null!==k))switch(k.Ac){case 1:k=270;break a;case 2:k=180;break a;default:case 4:k=0;break a;case 8:k=90;break a}k=b.ma(gd,G.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?So(k,h.copy()):c):(c=G.alloc(),h=h.ma(gd,c),G.free(c));c=Math.abs(h.x-k.x)>Math.abs(h.y-k.y)?h.x>=
k.x?0:180:h.y>=k.y?90:270;G.free(k);k=c}d.mc()&&g.Ee(a)&&(k+=180,360<=k&&(k-=360));if(Ro(d))return k;a=b.Ci();if(0===a)return k;45<=a&&135>a?k+=90:135<=a&&225>a?k+=180:225<=a&&315>a&&(k+=270);360<=k&&(k-=360);return k};S.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.nf()&&(a=To(this,b),null!==a))return a.Mu;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a};
S.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=gd:(b=this.fromSpot,b.Lb()&&(b=a.fromSpot),a=b===Hd?bd:b)):(a=b?b:this.toPort,null===a?a=gd:(b=this.toSpot,b.Lb()&&(b=a.toSpot),a=b===Hd?bd:b));return a};function Ro(a){return a===bd||.5===a.x&&.5===a.y}S.prototype.computeOtherPoint=function(a,b){a=b.ma(gd);b=b.Jo;b=null!==b?Vo(b,this):null;null!==b&&(a=b.Yp);return a};
S.prototype.computeShortLength=function(a){if(a){a=this.fromShortLength;if(isNaN(a)){var b=this.fromPort;null!==b&&(a=b.fromShortLength)}return isNaN(a)?0:a}a=this.toShortLength;isNaN(a)&&(b=this.toPort,null!==b&&(a=b.toShortLength));return isNaN(a)?0:a};
S.prototype.jg=function(a,b,c,d,e,f){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var g=f;void 0===f&&(g=Tc.alloc(),g.reset());g.multiply(this.transform);if(this.mh(a,g))return Om(this,b,c,e),void 0===f&&Tc.free(g),!0;if(this.Jc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.W.j,l=k.length;l--;){var m=k[l];if(m.visible||m===this.locationObject){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=Tc.alloc();n.set(g);
if(m instanceof W)h=m.jg(a,b,c,d,e,n);else if(this.path===m){if(m instanceof V){h=m;p=a;var q=d;if(!1===h.pickable)h=!1;else if(n.multiply(h.transform),q)b:{var r=p,u=n;if(h.mh(r,u))h=!0;else{if(void 0===u&&(u=h.transform,r.kf(h.actualBounds))){h=!0;break b}p=r.left;q=r.right;var v=r.top;r=r.bottom;var x=G.alloc(),y=G.alloc(),z=G.alloc(),B=Tc.alloc();B.set(u);B.hv(h.transform);B.Ys();y.x=q;y.y=v;y.transform(B);x.x=p;x.y=v;x.transform(B);u=!1;en(h,x,y,z)?u=!0:(x.x=q,x.y=r,x.transform(B),en(h,x,y,z)?
u=!0:(y.x=p,y.y=r,y.transform(B),en(h,x,y,z)?u=!0:(x.x=p,x.y=v,x.transform(B),en(h,x,y,z)&&(u=!0))));Tc.free(B);G.free(x);G.free(y);G.free(z);h=u}}else h=h.mh(p,n)}}else h=Sk(m,a,d,n);h&&(null!==b&&(m=b(m)),m&&(null===c||c(m))&&e.add(m));Tc.free(n)}}}void 0===f&&Tc.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&Tc.free(g);return!1};
S.prototype.computeCurve=function(){if(null===this.Ef){var a=this.fromPort,b=this.isOrthogonal;this.Ef=null!==a&&a===this.toPort&&!b}return this.Ef?Tg:this.curve};S.prototype.computeCorner=function(){if(this.curve===Tg)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a};
S.prototype.findMidLabel=function(){for(var a=this.path,b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.isPanelMain&&(-Infinity===e.segmentIndex||isNaN(e.segmentIndex)))return e}for(a=this.labelNodes;a.next();)if(b=a.value,-Infinity===b.segmentIndex||isNaN(b.segmentIndex))return b;return null};
S.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=Math.max(14,this.computeThickness());var b=this.fromPort,c=this.toPort;if(null!==b&&null!==c){var d=this.findMidLabel();if(null!==d){var e=d.naturalBounds,f=d.margin,g=isNaN(e.width)?30:e.width*d.scale+f.left+f.right;e=isNaN(e.height)?14:e.height*d.scale+f.top+f.bottom;d=d.segmentOrientation;d===gn||d===Lo||d===Ko?a=Math.max(a,e):d===xm||d===ym||d===vm||d===wm?a=Math.max(a,g):(b=b.ma(gd).Va(c.ma(gd))/180*Math.PI,a=Math.max(a,
Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===Tg&&(a*=1.333)}}return a};S.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.adjusting===Qg&&c.Pa()}};
S.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=16;var b=this.uf;if(null!==b){for(var c=Ka(),d=0,e=b.links,f=0;f<e.length;f++){var g=e[f].computeSpacing();c.push(g);d+=g}d=-d/2;for(f=0;f<e.length;f++){if(e[f]===this){a=d+c[f]/2;break}d+=c[f]}b.ft===this.fromNode&&(a=-a);Oa(c)}}return a};S.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1};
S.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.uf};
S.prototype.adjustPoints=function(a,b,c,d){var e=this.adjusting;if(this.isOrthogonal){if(e===Io)return!1;e===Jo&&(e=Ho)}switch(e){case Io:var f=this.i(a),g=this.i(c);if(!f.Oa(b)||!g.Oa(d)){e=f.x;f=f.y;var h=g.x-e,k=g.y-f,l=Math.sqrt(h*h+k*k);if(!H.ba(l,0)){if(H.ba(h,0))var m=0>k?-Math.PI/2:Math.PI/2;else m=Math.atan(k/Math.abs(h)),0>h&&(m=Math.PI-m);g=b.x;var n=b.y;h=d.x-g;var p=d.y-n;k=Math.sqrt(h*h+p*p);H.ba(h,0)?p=0>p?-Math.PI/2:Math.PI/2:(p=Math.atan(p/Math.abs(h)),0>h&&(p=Math.PI-p));l=k/l;m=
p-m;this.ld(a,b);for(a+=1;a<c;a++)b=this.i(a),h=b.x-e,k=b.y-f,b=Math.sqrt(h*h+k*k),H.ba(b,0)||(H.ba(h,0)?k=0>k?-Math.PI/2:Math.PI/2:(k=Math.atan(k/Math.abs(h)),0>h&&(k=Math.PI-k)),h=k+m,b*=l,this.M(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.ld(c,d)}}return!0;case Jo:f=this.i(a);n=this.i(c);if(!f.Oa(b)||!n.Oa(d)){e=f.x;f=f.y;g=n.x;n=n.y;l=(g-e)*(g-e)+(n-f)*(n-f);h=b.x;m=b.y;k=d.x;p=d.y;var q=1;if(0!==k-h){var r=(p-m)/(k-h);q=Math.sqrt(1+1/(r*r))}else r=9E9;this.ld(a,b);for(a+=1;a<c;a++){b=this.i(a);
var u=b.x,v=b.y,x=.5;0!==l&&(x=((e-u)*(e-g)+(f-v)*(f-n))/l);var y=e+x*(g-e),z=f+x*(n-f);b=Math.sqrt((u-y)*(u-y)+(v-z)*(v-z));v<r*(u-y)+z&&(b=-b);0<r&&(b=-b);u=h+x*(k-h);x=m+x*(p-m);0!==r?(b=u+b/q,this.M(a,b,x-(b-u)/r)):this.M(a,u,x+b)}this.ld(c,d)}return!0;case Ho:a:{if(this.isOrthogonal&&(e=this.i(a),f=this.i(a+1),g=this.i(a+2),h=f.x,m=f.y,n=h,l=m,H.w(e.y,f.y)?H.w(f.x,g.x)?m=b.y:H.w(f.y,g.y)&&(h=b.x):H.w(e.x,f.x)&&(H.w(f.y,g.y)?h=b.x:H.w(f.x,g.x)&&(m=b.y)),this.M(a+1,h,m),e=this.i(c),f=this.i(c-
1),g=this.i(c-2),h=f.x,m=f.y,k=h,p=m,H.w(e.y,f.y)?H.w(f.x,g.x)?m=d.y:H.w(f.y,g.y)&&(h=d.x):H.w(e.x,f.x)&&(H.w(f.y,g.y)?h=d.x:H.w(f.x,g.x)&&(m=d.y)),this.M(c-1,h,m),Hj(this))){this.M(a+1,n,l);this.M(c-1,k,p);c=!1;break a}this.ld(a,b);this.ld(c,d);c=!0}return c;default:return!1}};
S.prototype.addOrthoPoints=function(a,b,c,d,e,f){b=-45<=b&&45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=-45<=d&&45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var g=e.actualBounds.copy(),h=f.actualBounds.copy();if(g.s()&&h.s()){g.Vc(8,8);h.Vc(8,8);g.Ie(a);h.Ie(c);if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&h.right>a.x||90===d&&c.y>a.y&&h.right>a.x){var k=new G(c.x,a.y);var l=new G(c.x,(a.y+c.y)/2);180===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.y<a.y||90===d&&
c.y>a.y?(k.x=a.x<h.left?this.computeMidOrthoPosition(a.x,a.y,h.left,c.y,!1):a.x<h.right&&(270===d&&a.y<h.top||90===d&&a.y>h.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.right,l.x=k.x,l.y=c.y):0===d&&a.x<h.left&&a.y>h.top&&a.y<h.bottom&&(k.x=a.x,k.y=a.y<c.y?Math.min(c.y,h.top):Math.max(c.y,h.bottom),l.y=k.y)}else{k=new G(a.x,c.y);l=new G((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)180===d&&(h.ea(a)||g.ea(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):
c.y<a.y&&(180===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(180===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x>=g.left&&c.x<=a.x||a.x<=h.right&&a.x>=c.x){if(90===d||270===d)k=new G(Math.max((a.x+c.x)/2,a.x),a.y),l=new G(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?g.top:Math.min(g.top,h.top)):Math.max(c.y,0===d?g.bottom:Math.max(g.bottom,
h.bottom)),l.x=c.x,l.y=k.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&h.left<a.x||90===d&&c.y>a.y&&h.left<a.x)k=new G(c.x,a.y),l=new G(c.x,(a.y+c.y)/2),0===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(k.x=a.x>h.right?this.computeMidOrthoPosition(a.x,a.y,h.right,c.y,!1):a.x>h.left&&(270===d&&a.y<h.top||90===d&&a.y>h.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.left,l.x=k.x,l.y=c.y):180===d&&a.x>h.right&&a.y>h.top&&a.y<
h.bottom&&(k.x=a.x,k.y=a.y<c.y?Math.min(c.y,h.top):Math.max(c.y,h.bottom),l.y=k.y);else{k=new G(a.x,c.y);l=new G((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)0===d&&(h.ea(a)||g.ea(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(0===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x<=
g.right&&c.x>=a.x||a.x>=h.left&&a.x<=c.x){if(90===d||270===d)k=new G(Math.min((a.x+c.x)/2,a.x),a.y),l=new G(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?g.top:Math.min(g.top,h.top)):Math.max(c.y,180===d?g.bottom:Math.max(g.bottom,h.bottom)),l.x=c.x,l.y=k.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&h.bottom>a.y||0===d&&c.x>a.x&&h.bottom>a.y)k=new G(a.x,c.y),l=new G((a.x+c.x)/2,c.y),270===d?(k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),l.x=c.x,l.y=k.y):180===
d&&c.x<a.x||0===d&&c.x>a.x?(k.y=a.y<h.top?this.computeMidOrthoPosition(a.x,a.y,c.x,h.top,!0):a.y<h.bottom&&(180===d&&a.x<h.left||0===d&&a.x>h.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.bottom,l.x=c.x,l.y=k.y):90===d&&a.y<h.top&&a.x>h.left&&a.x<h.right&&(k.x=a.x<c.x?Math.min(c.x,h.left):Math.max(c.x,h.right),k.y=a.y,l.x=k.x);else{k=new G(c.x,a.y);l=new G(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<g.left||180===d&&c.x>g.right)270===d&&(h.ea(a)||g.ea(c))?k.x=this.computeMidOrthoPosition(a.x,
a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&k.x<g.right)if(c.y>=g.top&&c.y<=a.y||a.y<=h.bottom&&a.y>=c.y){if(0===d||180===d)k=new G(a.x,Math.max((a.y+c.y)/2,a.y)),l=new G(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,90===
d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&h.top<a.y||0===d&&c.x>a.x&&h.top<a.y)k=new G(a.x,c.y),l=new G((a.x+c.x)/2,c.y),90===d?(k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),l.x=c.x,l.y=k.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(k.y=a.y>h.bottom?this.computeMidOrthoPosition(a.x,a.y,c.x,h.bottom,!0):a.y>h.top&&(180===d&&a.x<h.left||0===d&&a.x>h.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.top,l.x=c.x,l.y=k.y):270===d&&a.y>h.bottom&&a.x>
h.left&&a.x<h.right&&(k.x=a.x<c.x?Math.min(c.x,h.left):Math.max(c.x,h.right),k.y=a.y,l.x=k.x);else{k=new G(c.x,a.y);l=new G(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<g.left||180===d&&c.x>g.right)90===d&&(h.ea(a)||g.ea(c))?k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&
k.x<g.right)if(c.y<=g.bottom&&c.y>=a.y||a.y>=h.top&&a.y<=c.y){if(0===d||180===d)k=new G(a.x,Math.min((a.y+c.y)/2,a.y)),l=new G(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,270===d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}var m=k,n=l,p=c;if(this.isAvoiding){var q=this.diagram;if(null===q||!ak(q)||g.ea(p)&&!f.Ee(e)||h.ea(a)&&!e.Ee(f)||e===f||this.layer.isTemporary)b=!1;else{var r=ek(q,!0,this.containingGroup,null);
if(r.Yj(Math.min(a.x,m.x),Math.min(a.y,m.y),Math.abs(a.x-m.x),Math.abs(a.y-m.y))&&r.Yj(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y))&&r.Yj(Math.min(n.x,p.x),Math.min(n.y,p.y),Math.abs(n.x-p.x),Math.abs(n.y-p.y)))b=!1;else{e=a;f=p;var u=c=null;if(q.isVirtualized){q=r.bounds.copy();q.Vc(-r.Ol,-r.Nl);var v=G.alloc();Xo(r,a.x,a.y)||(H.Uc(q.x,q.y,q.x+q.width,q.y+q.height,a.x,a.y,m.x,m.y,v)?(c=a=v.copy(),b=v.Va(m)):H.Uc(q.x,q.y,q.x+q.width,q.y+q.height,m.x,m.y,n.x,n.y,v)?(c=a=
v.copy(),b=v.Va(n)):H.Uc(q.x,q.y,q.x+q.width,q.y+q.height,n.x,n.y,p.x,p.y,v)&&(c=a=v.copy(),b=v.Va(p)));Xo(r,p.x,p.y)||(H.Uc(q.x,q.y,q.x+q.width,q.y+q.height,p.x,p.y,n.x,n.y,v)?(u=p=v.copy(),d=n.Va(v)):H.Uc(q.x,q.y,q.x+q.width,q.y+q.height,n.x,n.y,m.x,m.y,v)?(u=p=v.copy(),d=m.Va(v)):H.Uc(q.x,q.y,q.x+q.width,q.y+q.height,m.x,m.y,a.x,a.y,v)&&(u=p=v.copy(),d=a.Va(v)));G.free(v)}g=g.copy().Wc(h);h=r.Gz;g.Vc(r.Ol*h,r.Nl*h);Yo(r,a,b,p,d,g);h=Zo(r,p.x,p.y);!r.abort&&h>=$o&&(hk(r),h=r.oz,g.Vc(r.Ol*h,r.Nl*
h),Yo(r,a,b,p,d,g),h=Zo(r,p.x,p.y));!r.abort&&h>=$o&&r.Mz&&(hk(r),Yo(r,a,b,p,d,r.bounds),h=Zo(r,p.x,p.y));if(!r.abort&&h<$o&&Zo(r,p.x,p.y)!==ap){bp(this,r,p.x,p.y,d,!0);g=this.i(2);if(4>this.pointsCount)0===b||180===b?(g.x=a.x,g.y=p.y):(g.x=p.x,g.y=a.y),this.M(2,g.x,g.y),this.m(3,g.x,g.y);else if(p=this.i(3),0===b||180===b)H.w(g.x,p.x)?(g=0===b?Math.max(g.x,a.x):Math.min(g.x,a.x),this.M(2,g,a.y),this.M(3,g,p.y)):H.w(g.y,p.y)?(Math.abs(a.y-g.y)<=r.Nl/2&&(this.M(2,g.x,a.y),this.M(3,p.x,a.y)),this.m(2,
g.x,a.y)):this.M(2,a.x,g.y);else if(90===b||270===b)H.w(g.y,p.y)?(g=90===b?Math.max(g.y,a.y):Math.min(g.y,a.y),this.M(2,a.x,g),this.M(3,p.x,g)):H.w(g.x,p.x)?(Math.abs(a.x-g.x)<=r.Ol/2&&(this.M(2,a.x,g.y),this.M(3,a.x,p.y)),this.m(2,a.x,g.y)):this.M(2,g.x,a.y);null!==c&&(a=this.i(1),p=this.i(2),a.x!==p.x&&a.y!==p.y?0===b||180===b?this.m(2,a.x,p.y):this.m(2,p.x,a.y):0===b||180===b?this.m(2,e.x,c.y):this.m(2,c.x,e.y));null!==u&&(0===d||180===d?this.hf(f.x,u.y):this.hf(u.x,f.y));b=!0}else b=!1}}}else b=
!1;b||(this.we(k),this.we(l))}};S.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;this.hasCurviness()&&(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f};function Hj(a){if(null===a.diagram||!a.isAvoiding||!ak(a.diagram))return!1;var b=a.points.j,c=b.length;if(4>c)return!1;a=ek(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.Yj(Math.min(e.x,f.x),Math.min(e.y,f.y),Math.abs(e.x-f.x),Math.abs(e.y-f.y)))return!0}return!1}
function bp(a,b,c,d,e,f){var g=b.Ol,h=b.Nl,k=Zo(b,c,d),l=c,m=d;for(0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h;k>cp&&Zo(b,l,m)===k-1;)c=l,d=m,0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h,--k;if(f){if(k>cp)if(180===e||0===e)c=Math.floor(c/g)*g+g/2;else if(90===e||270===e)d=Math.floor(d/h)*h+h/2}else c=Math.floor(c/g)*g+g/2,d=Math.floor(d/h)*h+h/2;k>cp&&(f=e,l=c,m=d,0===e?(f=90,m+=h):90===e?(f=180,l-=g):180===e?(f=270,m-=h):270===e&&(f=0,l+=g),Zo(b,l,m)===k-1?bp(a,b,l,m,f,!1):(l=c,m=d,0===e?(f=270,m-=h):90===
e?(f=0,l+=g):180===e?(f=90,m+=h):270===e&&(f=180,l-=g),Zo(b,l,m)===k-1&&bp(a,b,l,m,f,!1)));a.hf(c,d)}S.prototype.By=function(a){var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Zb(b,a,c.x,c.y,d.x,d.y),f=0,g=1;g<this.pointsCount-1;g++){c=this.i(g+1);var h=Zb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};S.prototype.bc=function(){this.vr=!0};
S.prototype.$j=function(a){if(!a){if(!1===this.Lc)return;a=this.Ab();if(!this.vr&&(null===a||null!==a.geometry))return}this.qa=this.makeGeometry();a=this.path;if(null!==a){a.qa=this.qa;for(var b=this.W.j,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof V&&(e.qa=this.qa)}}};
S.prototype.makeGeometry=function(){var a=this.qa,b=this.pointsCount;if(2>b)return a.type=je,a;var c=!1,d=this.diagram;null!==d&&Mo(this)&&d.Rh.contains(this)&&null!==this.Lo&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.yb.j;var g=this.computeCurve();if(g===Tg&&3<=b&&!H.ba(this.smoothness,0))if(3===b){var h=this.i(1);d=Math.min(e.x,h.x);var k=Math.min(e.y,h.y);h=this.i(2);d=Math.min(d,h.x);k=Math.min(k,h.y)}else{if(this.isOrthogonal)for(k=0;k<b;k++)h=d[k],f.x=Math.min(h.x,f.x),f.y=Math.min(h.y,
f.y);else for(d=3;d<b;d+=3)d+3>=b&&(d=b-1),k=this.i(d),f.x=Math.min(k.x,f.x),f.y=Math.min(k.y,f.y);d=f.x;k=f.y}else{for(k=0;k<b;k++)h=d[k],f.x=Math.min(h.x,f.x),f.y=Math.min(h.y,f.y);d=f.x;k=f.y}d-=this.tu.x;k-=this.tu.y;e.x-=d;e.y-=k;if(2!==b||Mo(this)){a.type=he;h=te(a);0!==this.computeShortLength(!0)&&(e=dp(this,e,!0,f));ue(h,e.x,e.y,!1);if(g===Tg&&3<=b&&!H.ba(this.smoothness,0))if(3===b)c=this.i(1),b=c.x-d,c=c.y-k,e=this.i(2).copy(),e.x-=d,e.y-=k,0!==this.computeShortLength(!1)&&(e=dp(this,e,
!1,f)),ve(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){f=new G(d,k);e=this.i(1).copy();g=new G(d,k);b=new G(d,k);c=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=c,q=l,r=this.i(ep(this,l,n,!1));if(!H.ba(p.x,q.x)||!H.ba(q.x,r.x))if(!H.ba(p.y,q.y)||!H.ba(q.y,r.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var v=p.x;p=p.y;var x=q.x;q=q.y;var y=r.x;r=r.y;var z=u*fp(v,p,x,q);u*=fp(x,q,y,r);H.ba(p,q)&&H.ba(x,y)&&(x>v?r>q?(g.x=x-z,g.y=q-z,b.x=x+u,b.y=q+u):(g.x=x-z,
g.y=q+z,b.x=x+u,b.y=q-u):r>q?(g.x=x+z,g.y=q-z,b.x=x-u,b.y=q+u):(g.x=x+z,g.y=q+z,b.x=x-u,b.y=q-u));H.ba(v,x)&&H.ba(q,r)&&(q>p?(y>x?(g.x=x-z,g.y=q-z,b.x=x+u):(g.x=x+z,g.y=q-z,b.x=x-u),b.y=q+u):(y>x?(g.x=x-z,g.y=q+z,b.x=x+u):(g.x=x+z,g.y=q+z,b.x=x-u),b.y=q-u));if(H.ba(v,x)&&H.ba(x,y)||H.ba(p,q)&&H.ba(q,r))v=.5*(v+y),p=.5*(p+r),g.x=v,g.y=p,b.x=v,b.y=p;1===n?(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y)):2===n&&H.ba(c.x,this.i(0).x)&&H.ba(c.y,this.i(0).y)&&(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y));ve(h,e.x-d,e.y-k,g.x-
d,g.y-k,l.x-d,l.y-k);f.set(g);e.set(b);c=l}}f=c.x;c=c.y;e=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(e=dp(this,e.copy(),!1,cc));f=.5*(f+e.x);c=.5*(c+e.y);ve(h,b.x-d,b.y-k,f-d,c-k,e.x-d,e.y-k)}else for(c=3;c<b;c+=3)f=this.i(c-2),c+3>=b&&(c=b-1),e=this.i(c-1),g=this.i(c),c===b-1&&0!==this.computeShortLength(!1)&&(g=dp(this,g.copy(),!1,cc)),ve(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=G.alloc();f.assign(this.i(0));g=1;for(e=0;g<b;){g=ep(this,f,g,1<g);m=this.i(g);if(g>=b-1){if(!f.A(m))0!==
this.computeShortLength(!1)&&(m=dp(this,m.copy(),!1,cc)),gp(this,h,-d,-k,f,m,c);else if(0===e)for(g=1;g<b;)m=this.i(g++),gp(this,h,-d,-k,f,m,c),f.assign(m);break}e=ep(this,m,g+1,g<b-3);g=-d;l=-k;n=this.i(e);v=c;H.w(f.y,m.y)&&H.w(m.x,n.x)?(p=this.computeCorner(),p=Math.min(p,Math.abs(m.x-f.x)/2),p=u=Math.min(p,Math.abs(n.y-m.y)/2),H.w(p,0)?(gp(this,h,g,l,f,m,v),f.assign(m)):(x=m.x,q=m.y,y=x,r=q,m.x>f.x?x=m.x-p:x=m.x+p,n.y>m.y?r=m.y+u:r=m.y-u,gp(this,h,g,l,f,new G(x,q),v),we(h,m.x+g,m.y+l,y+g,r+l),
f.h(y,r))):H.w(f.x,m.x)&&H.w(m.y,n.y)?(p=this.computeCorner(),p=Math.min(p,Math.abs(m.y-f.y)/2),p=u=Math.min(p,Math.abs(n.x-m.x)/2),H.w(u,0)?(gp(this,h,g,l,f,m,v),f.assign(m)):(x=m.x,q=m.y,y=x,r=q,m.y>f.y?q=m.y-p:q=m.y+p,n.x>m.x?y=m.x+u:y=m.x-u,gp(this,h,g,l,f,new G(x,q),v),we(h,m.x+g,m.y+l,y+g,r+l),f.h(y,r))):(gp(this,h,g,l,f,m,v),f.assign(m));g=e}G.free(f)}ze=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=dp(this,e,!0,f)),0!==this.computeShortLength(!1)&&(h=dp(this,
h,!1,f)),a.type=je,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;return a};function fp(a,b,c,d){a=c-a;if(isNaN(a)||Infinity===a||-Infinity===a)return NaN;0>a&&(a=-a);b=d-b;if(isNaN(b)||Infinity===b||-Infinity===b)return NaN;0>b&&(b=-b);return H.ba(a,0)?b:H.ba(b,0)?a:Math.sqrt(a*a+b*b)}
function dp(a,b,c,d){var e=a.pointsCount;if(2>e)return b;if(c){var f=a.i(1);c=f.x-d.x;f=f.y-d.y;d=fp(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!0);a>e&&(a=e);e=a*(f-b.y)/d;b.x+=a*(c-b.x)/d;b.y+=e}else{f=a.i(e-2);c=f.x-d.x;f=f.y-d.y;d=fp(b.x,b.y,c,f);if(0===d)return b;e=2===e?.5*d:d;a=a.computeShortLength(!1);a>e&&(a=e);e=a*(b.y-f)/d;b.x-=a*(b.x-c)/d;b.y-=e}return b}
function ep(a,b,c,d){for(var e=a.pointsCount,f=b;H.ba(b.x,f.x)&&H.ba(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!H.ba(b.x,f.x)&&!H.ba(b.y,f.y))return c-1;for(var g=f;H.ba(b.x,f.x)&&H.ba(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||H.ba(b.y,f.y)&&H.ba(f.y,g.y)&&(!d||(b.x>=f.x?f.x>=g.x:f.x<=g.x));){if(c>=e)return e-1;g=a.i(c++)}return c-2}
function gp(a,b,c,d,e,f,g){if(!g&&Mo(a)){g=[];var h=0;a.isVisible()&&(h=hp(a,e,f,g));if(0<h)if(H.w(e.y,f.y))if(e.x<f.x)for(var k=0;k<h;){var l=Math.max(e.x,Math.min(g[k++]-5,f.x-10));b.lineTo(l+c,f.y+d);var m=l+c;for(var n=Math.min(l+10,f.x);k<h;)if(l=g[k],l<n+10)k++,n=Math.min(l+5,f.x);else break;l=f.y-10+d;n+=c;var p=f.y+d;a.curve===Pg?ue(b,n,p,!1):ve(b,m,l,n,l,n,p)}else for(--h;0<=h;){k=Math.min(e.x,Math.max(g[h--]+5,f.x+10));b.lineTo(k+c,f.y+d);m=k+c;for(l=Math.max(k-10,f.x);0<=h;)if(k=g[h],k>
l-10)h--,l=Math.max(k-5,f.x);else break;k=f.y-10+d;l+=c;n=f.y+d;a.curve===Pg?ue(b,l,n,!1):ve(b,m,k,l,k,l,n)}else if(H.w(e.x,f.x))if(e.y<f.y)for(k=0;k<h;){l=Math.max(e.y,Math.min(g[k++]-5,f.y-10));b.lineTo(f.x+c,l+d);m=l+d;for(l=Math.min(l+10,f.y);k<h;)if(n=g[k],n<l+10)k++,l=Math.min(n+5,f.y);else break;n=f.x-10+c;p=f.x+c;l+=d;a.curve===Pg?ue(b,p,l,!1):ve(b,n,m,n,l,p,l)}else for(--h;0<=h;){k=Math.min(e.y,Math.max(g[h--]+5,f.y+10));b.lineTo(f.x+c,k+d);m=k+d;for(k=Math.max(k-10,f.y);0<=h;)if(l=g[h],
l>k-10)h--,k=Math.max(l-5,f.y);else break;l=f.x-10+c;n=f.x+c;k+=d;a.curve===Pg?ue(b,n,k,!1):ve(b,l,m,l,k,n,k)}}b.lineTo(f.x+c,f.y+d)}
function hp(a,b,c,d){var e=a.diagram;if(null===e||b.A(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Fa.j;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof S){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&Mo(k)){var l=k.routeBounds;l.s()&&a.routeBounds.Jc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.pf()&&ip(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length}
function ip(a,b,c,d){for(var e=H.w(a.y,b.y),f=d.pointsCount,g=d.i(0),h=G.alloc(),k=1;k<f;k++){var l=d.i(k);if(k<f-1){var m=d.i(k+1);if(g.y===l.y&&l.y===m.y){if(l.x>g.x&&m.x>=l.x||l.x<g.x&&m.x<=l.x)continue}else if(g.x===l.x&&l.x===m.x&&(l.y>g.y&&m.y>=l.y||l.y<g.y&&m.y<=l.y))continue}a:{m=a.x;var n=a.y,p=b.x,q=b.y,r=g.x;g=g.y;var u=l.x,v=l.y;if(!H.w(m,p)){if(H.w(n,q)&&H.w(r,u)&&Math.min(m,p)<r&&Math.max(m,p)>r&&Math.min(g,v)<n&&Math.max(g,v)>n&&!H.w(g,v)){h.x=r;h.y=n;m=!0;break a}}else if(!H.w(n,q)&&
H.w(g,v)&&Math.min(n,q)<g&&Math.max(n,q)>g&&Math.min(r,u)<m&&Math.max(r,u)>m&&!H.w(r,u)){h.x=m;h.y=g;m=!0;break a}h.x=0;h.y=0;m=!1}m&&(e?c.push(h.x):c.push(h.y));g=l}G.free(h)}function Mo(a){a=a.curve;return a===Og||a===Pg}function Qo(a,b){if(b||Mo(a))b=a.diagram,null===b||b.Rh.contains(a)||null===a.Lo||b.Rh.add(a,a.Lo)}
S.prototype.Vp=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c){var d=!1;for(c=c.layers;c.next();){var e=c.value;if(e.visible)if(e===b){d=!0;var f=!1;e=e.Fa.j;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof S&&(k===this?f=!0:f&&jp(this,k,a))}}else if(d)for(f=e.Fa.j,e=f.length,g=0;g<e;g++)h=f[g],h instanceof S&&jp(this,h,a)}}}};
function jp(a,b,c){if(null!==b&&null!==b.qa&&Mo(b)){var d=b.routeBounds;d.s()&&(a.routeBounds.Jc(d)||c.Jc(d))&&(a.usesSamePort(b)||b.bc())}}S.prototype.usesSamePort=function(a){var b=this.pointsCount,c=a.pointsCount;if(0<b&&0<c){var d=this.i(0),e=a.i(0);if(d.Oa(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Oa(a)||d.Oa(a)||b.Oa(e))return!0}else if(this.fromNode===a.fromNode||this.toNode===a.toNode||this.fromNode===a.toNode||this.toNode===a.fromNode)return!0;return!1};
S.prototype.isVisible=function(){if(!T.prototype.isVisible.call(this))return!1;var a=this.containingGroup,b=!0,c=this.diagram;null!==c&&(b=c.isTreePathToChildren);c=this.fromNode;if(null!==c){if(this.isTreeLink&&b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(var d=c;null!==d;){if(d.labeledLink===this)return!0;d=d.containingGroup}c=c.findVisibleNode();if(null===c||c===a)return!1}c=this.toNode;if(null!==c){if(this.isTreeLink&&!b&&!c.isTreeExpanded)return!1;if(c===a)return!0;for(b=c;null!==b;){if(b.labeledLink===
this)return!0;b=b.containingGroup}b=c.findVisibleNode();if(null===b||b===a)return!1}return!0};S.prototype.Mb=function(a){T.prototype.Mb.call(this,a);null!==this.uf&&this.uf.Xl();if(null!==this.bd)for(var b=this.bd.iterator;b.next();)b.value.Mb(a)};
function No(a){var b=a.Ne;if(null!==b){var c=a.df;if(null!==c){for(var d=a.Oe,e=a.ef,f=a=null,g=b.Za.j,h=g.length,k=0;k<h;k++){var l=g[k];if(l.Ne===b&&l.Oe===d&&l.df===c&&l.ef===e||l.Ne===c&&l.Oe===e&&l.df===b&&l.ef===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=so(b,c,d,e);null===f&&(f=new kp(b,d,c,e),ro(b,f),ro(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].uf=f;f.Xl()}}}}function Oo(a){var b=a.uf;null!==b&&(a.uf=null,a=b.links.indexOf(a),0<=a&&(Ja(b.links,a),b.Xl()))}
S.prototype.th=function(){return!0};
pa.Object.defineProperties(S.prototype,{fromNode:{get:function(){return this.Ne},set:function(a){var b=this.Ne;if(b!==a){var c=this.fromPort;null!==b&&(this.df!==b&&vo(b,this,c),Oo(this),this.B(2));this.Ne=a;null!==a&&this.Mb(a.isVisible());this.Ef=null;this.Pa();var d=this.diagram;null!==d&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.ca,d.ca=!0);f(this,c,e);null!==d&&(d.ca=g)}null!==a&&(this.df!==
a&&uo(a,this,e),No(this),this.B(1));this.g("fromNode",b,a);po(this)}}},fromPortId:{get:function(){return this.Oe},set:function(a){var b=this.Oe;if(b!==a){var c=this.fromPort;null!==c&&to(this.fromNode,c);Oo(this);this.Oe=a;var d=this.fromPort;null!==d&&to(this.fromNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Zl()&&g.Cx(f,a)}c!==d&&(this.Ef=null,this.Pa(),f=this.fromPortChanged,null!==f&&(g=!0,null!==e&&(g=e.ca,e.ca=!0),f(this,c,d),null!==
e&&(e.ca=g)));No(this);this.g("fromPortId",b,a)}}},fromPort:{get:function(){var a=this.Ne;return null===a?null:a.Ps(this.Oe)}},fromPortChanged:{get:function(){return this.zn},set:function(a){var b=this.zn;b!==a&&(this.zn=a,this.g("fromPortChanged",b,a))}},toNode:{get:function(){return this.df},set:function(a){var b=this.df;if(b!==a){var c=this.toPort;null!==b&&(this.Ne!==b&&vo(b,this,c),Oo(this),this.B(2));this.df=
a;null!==a&&this.Mb(a.isVisible());this.Ef=null;this.Pa();var d=this.diagram;null!==d&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.ca,d.ca=!0);f(this,c,e);null!==d&&(d.ca=g)}null!==a&&(this.Ne!==a&&uo(a,this,e),No(this),this.B(1));this.g("toNode",b,a);po(this)}}},toPortId:{get:function(){return this.ef},set:function(a){var b=this.ef;if(b!==a){var c=this.toPort;null!==c&&to(this.toNode,c);Oo(this);
this.ef=a;var d=this.toPort;null!==d&&to(this.toNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Zl()&&g.Gx(f,a)}c!==d&&(this.Ef=null,this.Pa(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.ca,e.ca=!0),f(this,c,d),null!==e&&(e.ca=g)));No(this);this.g("toPortId",b,a)}}},toPort:{get:function(){var a=this.df;return null===a?null:a.Ps(this.ef)}},toPortChanged:{get:function(){return this.wp},set:function(a){var b=
this.wp;b!==a&&(this.wp=a,this.g("toPortChanged",b,a))}},fromSpot:{get:function(){return null!==this.P?this.P.Ig:Hd},set:function(a){this.Ic();var b=this.P.Ig;b.A(a)||(a=a.I(),this.P.Ig=a,this.g("fromSpot",b,a),this.Pa())}},fromEndSegmentLength:{get:function(){return null!==this.P?this.P.Gg:NaN},set:function(a){this.Ic();var b=this.P.Gg;b!==a&&(0>a&&xa(a,">= 0",S,"fromEndSegmentLength"),this.P.Gg=a,this.g("fromEndSegmentLength",b,a),this.Pa())}},
fromShortLength:{get:function(){return null!==this.P?this.P.Hg:NaN},set:function(a){this.Ic();var b=this.P.Hg;b!==a&&(this.P.Hg=a,this.g("fromShortLength",b,a),this.Pa(),this.bc())}},toSpot:{get:function(){return null!==this.P?this.P.fh:Hd},set:function(a){this.Ic();var b=this.P.fh;b.A(a)||(a=a.I(),this.P.fh=a,this.g("toSpot",b,a),this.Pa())}},toEndSegmentLength:{get:function(){return null!==this.P?this.P.dh:
NaN},set:function(a){this.Ic();var b=this.P.dh;b!==a&&(0>a&&xa(a,">= 0",S,"toEndSegmentLength"),this.P.dh=a,this.g("toEndSegmentLength",b,a),this.Pa())}},toShortLength:{get:function(){return null!==this.P?this.P.eh:NaN},set:function(a){this.Ic();var b=this.P.eh;b!==a&&(this.P.eh=a,this.g("toShortLength",b,a),this.Pa(),this.bc())}},isLabeledLink:{get:function(){return null===this.bd?!1:0<this.bd.count}},labelNodes:{
get:function(){return null===this.bd?Ab:this.bd.iterator}},relinkableFrom:{get:function(){return 0!==(this.Sa&1)},set:function(a){var b=0!==(this.Sa&1);b!==a&&(this.Sa^=1,this.g("relinkableFrom",b,a),this.Kb())}},relinkableTo:{get:function(){return 0!==(this.Sa&2)},set:function(a){var b=0!==(this.Sa&2);b!==a&&(this.Sa^=2,this.g("relinkableTo",b,a),this.Kb())}},resegmentable:{get:function(){return 0!==(this.Sa&
4)},set:function(a){var b=0!==(this.Sa&4);b!==a&&(this.Sa^=4,this.g("resegmentable",b,a),this.Kb())}},isTreeLink:{get:function(){return 0!==(this.Sa&8)},set:function(a){var b=0!==(this.Sa&8);b!==a&&(this.Sa^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&pk(this.fromNode),null!==this.toNode&&pk(this.toNode))}},path:{get:function(){var a=this.Ab();return a instanceof V?a:null}},routeBounds:{get:function(){this.Pi();
var a=this.Lo,b=Infinity,c=Infinity,d=this.pointsCount;if(0===d)a.h(NaN,NaN,0,0);else{if(1===d)d=this.i(0),b=Math.min(d.x,b),c=Math.min(d.y,c),a.h(d.x,d.y,0,0);else if(2===d){d=this.i(0);var e=this.i(1);b=Math.min(d.x,e.x);c=Math.min(d.y,e.y);a.h(d.x,d.y,0,0);a.Ie(e)}else if(this.computeCurve()===Tg&&3<=d&&!this.isOrthogonal)if(e=this.i(0),b=e.x,c=e.y,a.h(b,c,0,0),3===d){d=this.i(1);b=Math.min(d.x,b);c=Math.min(d.y,c);var f=this.i(2);b=Math.min(f.x,b);c=Math.min(f.y,c);H.Ml(e.x,e.y,d.x,d.y,d.x,d.y,
f.x,f.y,.5,a)}else for(f=3;f<d;f+=3){var g=this.i(f-2);f+3>=d&&(f=d-1);var h=this.i(f-1),k=this.i(f);H.Ml(e.x,e.y,g.x,g.y,h.x,h.y,k.x,k.y,.5,a);b=Math.min(k.x,b);c=Math.min(k.y,c);e=k}else for(e=this.i(0),f=this.i(1),b=Math.min(e.x,f.x),c=Math.min(e.y,f.y),a.h(e.x,e.y,0,0),a.Ie(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Ie(f);this.tu.h(b-a.x,c-a.y)}return this.Lo}},midPoint:{get:function(){this.Pi();return this.computeMidPoint(new G)}},midAngle:{
get:function(){this.Pi();return this.computeMidAngle()}},flattenedLengths:{get:function(){if(null===this.hr){this.Lc||Po(this);for(var a=this.hr=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);H.ba(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):H.ba(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Ae(e));a.push(d)}}return this.hr}},flattenedTotalLength:{get:function(){var a=this.Xt;if(isNaN(a)){for(var b=this.flattenedLengths,
c=b.length,d=a=0;d<c;d++)a+=b[d];this.Xt=a}return a}},points:{get:function(){return this.yb},set:function(a){var b=this.yb;if(b!==a){var c=null;if(Array.isArray(a)){var d=0===a.length%2;if(d)for(var e=0;e<a.length;e++)if("number"!==typeof a[e]||isNaN(a[e])){d=!1;break}if(d)for(c=new E,d=0;d<a.length/2;d++)e=(new G(a[2*d],a[2*d+1])).freeze(),c.add(e);else{d=!0;for(e=0;e<a.length;e++){var f=a[e];if(!Aa(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==typeof f.y||isNaN(f.y)){d=
!1;break}}if(d)for(c=new E,d=0;d<a.length;d++)e=a[d],c.add((new G(e.x,e.y)).freeze())}}else if(a instanceof E)for(c=a.copy(),a=c.iterator;a.next();)a.value.freeze();else A("Link.points value is not an instance of List or Array: "+a);c.freeze();this.yb=c;this.bc();this.o();Po(this);a=this.diagram;null!==a&&(a.Xj||a.undoManager.isUndoingRedoing||a.ct.add(this),a.animationManager.$a&&(this.ol=c));this.g("points",b,c)}}},pointsCount:{get:function(){return this.yb.count}},
Lc:{get:function(){return 0!==(this.Sa&16)},set:function(a){0!==(this.Sa&16)!==a&&(this.Sa^=16)}},suspendsRouting:{get:function(){return 0!==(this.Sa&32)},set:function(a){0!==(this.Sa&32)!==a&&(this.Sa^=32)}},Iu:{get:function(){return 0!==(this.Sa&64)},set:function(a){0!==(this.Sa&64)!==a&&(this.Sa^=64)}},defaultFromPoint:{get:function(){return this.u},set:function(a){this.u=a.copy()}},
defaultToPoint:{get:function(){return this.K},set:function(a){this.K=a.copy()}},isOrthogonal:{get:function(){return 2===(this.wj.value&2)}},isAvoiding:{get:function(){return 4===(this.wj.value&4)}},geometry:{get:function(){this.vr&&(this.Pi(),this.qa=this.makeGeometry(),this.vr=!1);return this.qa}},firstPickIndex:{get:function(){return 2>=this.pointsCount?
0:this.isOrthogonal||!Ro(this.computeSpot(!0))?1:0}},lastPickIndex:{get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!Ro(this.computeSpot(!1))?a-2:a-1}},adjusting:{get:function(){return this.Gm},set:function(a){var b=this.Gm;b!==a&&(this.Gm=a,this.g("adjusting",b,a))}},corner:{get:function(){return this.an},set:function(a){var b=this.an;b!==a&&(this.an=a,this.bc(),this.g("corner",
b,a))}},curve:{get:function(){return this.dn},set:function(a){var b=this.dn;b!==a&&(this.dn=a,this.Pa(),this.bc(),Qo(this,b===Pg||b===Og||a===Pg||a===Og),this.g("curve",b,a))}},curviness:{get:function(){return this.en},set:function(a){var b=this.en;b!==a&&(this.en=a,this.Pa(),this.bc(),this.g("curviness",b,a))}},routing:{get:function(){return this.wj},set:function(a){var b=this.wj;b!==a&&(this.wj=a,this.Ef=null,
this.Pa(),Qo(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{get:function(){return this.kp},set:function(a){var b=this.kp;b!==a&&(this.kp=a,this.bc(),this.g("smoothness",b,a))}},key:{get:function(){var a=this.diagram;if(null!==a&&a.model.Zl())return a.model.lc(this.data)}}});S.prototype.invalidateOtherJumpOvers=S.prototype.Vp;S.prototype.findClosestSegment=S.prototype.By;S.prototype.updateRoute=S.prototype.Pi;
S.prototype.invalidateRoute=S.prototype.Pa;S.prototype.rollbackRoute=S.prototype.yx;S.prototype.commitRoute=S.prototype.jf;S.prototype.startRoute=S.prototype.wh;S.prototype.clearPoints=S.prototype.Kj;S.prototype.removePoint=S.prototype.tv;S.prototype.addPointAt=S.prototype.hf;S.prototype.addPoint=S.prototype.we;S.prototype.insertPointAt=S.prototype.m;S.prototype.insertPoint=S.prototype.gz;S.prototype.setPointAt=S.prototype.M;S.prototype.setPoint=S.prototype.ld;S.prototype.getPoint=S.prototype.i;
S.prototype.getOtherPort=S.prototype.Xy;S.prototype.getOtherNode=S.prototype.Ts;
var Go=new D(S,"Normal",1),lp=new D(S,"Orthogonal",2),mp=new D(S,"AvoidsNodes",6),Wo=new D(S,"AvoidsNodesStraight",7),Qg=new D(S,"None",0),Tg=new D(S,"Bezier",9),Pg=new D(S,"JumpGap",10),Og=new D(S,"JumpOver",11),Ho=new D(S,"End",17),Io=new D(S,"Scale",18),Jo=new D(S,"Stretch",19),gn=new D(S,"OrientAlong",21),vm=new D(S,"OrientPlus90",22),xm=new D(S,"OrientMinus90",23),Ko=new D(S,"OrientOpposite",24),Lo=new D(S,"OrientUpright",25),wm=new D(S,"OrientPlus90Upright",26),ym=new D(S,"OrientMinus90Upright",
27),zm=new D(S,"OrientUpright45",28);S.className="Link";S.Normal=Go;S.Orthogonal=lp;S.AvoidsNodes=mp;S.AvoidsNodesStraight=Wo;S.None=Qg;S.Bezier=Tg;S.JumpGap=Pg;S.JumpOver=Og;S.End=Ho;S.Scale=Io;S.Stretch=Jo;S.OrientAlong=gn;S.OrientPlus90=vm;S.OrientMinus90=xm;S.OrientOpposite=Ko;S.OrientUpright=Lo;S.OrientPlus90Upright=wm;S.OrientMinus90Upright=ym;S.OrientUpright45=zm;function kp(a,b,c,d){tb(this);this.ge=this.ur=!1;this.ft=a;this.ux=b;this.iv=c;this.vx=d;this.links=[]}
kp.prototype.Xl=function(){if(!this.ur){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.uw.add(this),this.ge=a.undoManager.isUndoingRedoing))}this.ur=!0};kp.prototype.Sv=function(){if(this.ur){this.ur=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.Xj&&!this.ge;this.ge=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.uf=null,a.length=0)}0===a.length&&(a=this.ft,null!==this&&null!==a.Le&&a.Le.remove(this),a=this.iv,null!==this&&null!==a.Le&&a.Le.remove(this))}};
kp.className="LinkBundle";function fk(){tb(this);this.Hx=this.group=null;this.Xs=!0;this.abort=!1;this.Kd=this.Jd=1;this.fo=this.eo=-1;this.oc=this.nc=8;this.Cb=[[]];this.Dj=this.Cj=0;this.Mz=!1;this.Gz=22;this.oz=111}
fk.prototype.initialize=function(a){if(!(0>=a.width||0>=a.height)){var b=a.y,c=a.x+a.width,d=a.y+a.height;this.Jd=Math.floor((a.x-this.nc)/this.nc)*this.nc;this.Kd=Math.floor((b-this.oc)/this.oc)*this.oc;this.eo=Math.ceil((c+2*this.nc)/this.nc)*this.nc;this.fo=Math.ceil((d+2*this.oc)/this.oc)*this.oc;a=1+(Math.ceil((this.eo-this.Jd)/this.nc)|0);b=1+(Math.ceil((this.fo-this.Kd)/this.oc)|0);if(null===this.Cb||this.Cj<a-1||this.Dj<b-1){c=[];for(d=0;d<=a;d++)c[d]=[];this.Cb=c;this.Cj=a-1;this.Dj=b-1}a=
np;if(null!==this.Cb)for(b=0;b<=this.Cj;b++)for(c=0;c<=this.Dj;c++)this.Cb[b][c]=a}};function Xo(a,b,c){return a.Jd<=b&&b<=a.eo&&a.Kd<=c&&c<=a.fo}function Zo(a,b,c){if(!Xo(a,b,c))return np;b-=a.Jd;b/=a.nc;c-=a.Kd;c/=a.oc;return a.Cb[b|0][c|0]}function ik(a,b,c){Xo(a,b,c)&&(b-=a.Jd,b/=a.nc,c-=a.Kd,c/=a.oc,a.Cb[b|0][c|0]=ap)}function hk(a){if(null!==a.Cb)for(var b=0;b<=a.Cj;b++)for(var c=0;c<=a.Dj;c++)a.Cb[b][c]>=cp&&(a.Cb[b][c]=np)}
fk.prototype.Yj=function(a,b,c,d){if(a>this.eo||a+c<this.Jd||b>this.fo||b+d<this.Kd)return!0;a=(a-this.Jd)/this.nc|0;b=(b-this.Kd)/this.oc|0;c=Math.max(0,c)/this.nc+1|0;var e=Math.max(0,d)/this.oc+1|0;0>a&&(c+=a,a=0);0>b&&(e+=b,b=0);if(0>c||0>e)return!0;d=Math.min(a+c-1,this.Cj)|0;for(c=Math.min(b+e-1,this.Dj)|0;a<=d;a++)for(e=b;e<=c;e++)if(this.Cb[a][e]===ap)return!1;return!0};
function op(a,b,c,d,e,f,g,h,k){if(!(b<f||b>g||c<h||c>k)){var l=b|0;var m=c|0;var n=a.Cb[l][m];if(n>=cp&&n<$o)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Cb[l][m]);)a.Cb[l][m]=n,n+=1,e?m+=d:l+=d;l=e?m:l;if(e)if(0<d)for(c+=d;c<l;c+=d)op(a,b,c,1,!e,f,g,h,k),op(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)op(a,b,c,1,!e,f,g,h,k),op(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)op(a,b,c,1,!e,f,g,h,k),op(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)op(a,b,c,1,!e,f,g,h,k),op(a,b,c,-1,!e,f,g,h,
k)}}function pp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=ap,m=cp;for(a.Cb[b][c]=m;l===ap&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Cb[b][c]=m,e?c+=d:b+=d,l=a.Cb[b][c]}function qp(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=ap,m=$o;for(a.Cb[b][c]=m;l===ap&&b>f&&b<g&&c>h&&c<k;)a.Cb[b][c]=m,e?c+=d:b+=d,l=a.Cb[b][c]}
function Yo(a,b,c,d,e,f){if(null!==a.Cb){a.abort=!1;var g=b.x,h=b.y;if(Xo(a,g,h)&&(g-=a.Jd,g/=a.nc,h-=a.Kd,h/=a.oc,b=d.x,d=d.y,Xo(a,b,d)))if(b-=a.Jd,b/=a.nc,d-=a.Kd,d/=a.oc,1>=Math.abs(g-b)&&1>=Math.abs(h-d))a.abort=!0;else{var k=f.x,l=f.y,m=f.x+f.width,n=f.y+f.height;k-=a.Jd;k/=a.nc;l-=a.Kd;l/=a.oc;m-=a.Jd;m/=a.nc;n-=a.Kd;n/=a.oc;f=Math.max(0,Math.min(a.Cj,k|0));m=Math.min(a.Cj,Math.max(0,m|0));l=Math.max(0,Math.min(a.Dj,l|0));n=Math.min(a.Dj,Math.max(0,n|0));g|=0;h|=0;b|=0;d|=0;k=0===c||90===c?
1:-1;c=90===c||270===c;a.Cb[g][h]===ap?(pp(a,g,h,k,c,f,m,l,n),pp(a,g,h,1,!c,f,m,l,n),pp(a,g,h,-1,!c,f,m,l,n)):pp(a,g,h,k,c,g,h,g,h);a.Cb[b][d]===ap?(qp(a,b,d,0===e||90===e?1:-1,90===e||270===e,f,m,l,n),qp(a,b,d,1,!(90===e||270===e),f,m,l,n),qp(a,b,d,-1,!(90===e||270===e),f,m,l,n)):qp(a,b,d,k,c,b,d,b,d);a.abort||(op(a,g,h,1,!1,f,m,l,n),op(a,g,h,-1,!1,f,m,l,n),op(a,g,h,1,!0,f,m,l,n),op(a,g,h,-1,!0,f,m,l,n))}}}
pa.Object.defineProperties(fk.prototype,{bounds:{get:function(){return new N(this.Jd,this.Kd,this.eo-this.Jd,this.fo-this.Kd)}},Ol:{get:function(){return this.nc},set:function(a){0<a&&a!==this.nc&&(this.nc=a,this.initialize(this.bounds))}},Nl:{get:function(){return this.oc},set:function(a){0<a&&a!==this.oc&&(this.oc=a,this.initialize(this.bounds))}}});var ap=0,cp=1,$o=999999,np=$o+1;fk.className="PositionArray";
function Uo(){tb(this);this.port=this.node=null;this.Ud=[];this.$p=!1}Uo.prototype.toString=function(){for(var a=this.Ud,b=this.node.toString()+" "+a.length.toString()+":",c=0;c<a.length;c++){var d=a[c];null!==d&&(b+="\n "+d.toString())}return b};
function rp(a,b,c,d){b=b.offsetY;switch(b){case 8:return 90;case 2:return 180;case 1:return 270;case 4:return 0}switch(b){case 9:return 180<c?270:90;case 6:return 90<c&&270>=c?180:0}a=180*Math.atan2(a.height,a.width)/Math.PI;switch(b){case 3:return c>a&&c<=180+a?180:270;case 5:return c>180-a&&c<=360-a?270:0;case 12:return c>a&&c<=180+a?90:0;case 10:return c>180-a&&c<=360-a?180:90;case 7:return 90<c&&c<=180+a?180:c>180+a&&c<=360-a?270:0;case 13:return 180<c&&c<=360-a?270:c>a&&180>=c?90:0;case 14:return c>
a&&c<=180-a?90:c>180-a&&270>=c?180:0;case 11:return c>180-a&&c<=180+a?180:c>180+a?270:90}d&&15!==b&&(c-=15,0>c&&(c+=360));return c>a&&c<180-a?90:c>=180-a&&c<=180+a?180:c>180+a&&c<360-a?270:0}Uo.prototype.Xl=function(){this.Ud.length=0};
function Vo(a,b){var c=a.Ud;if(0===c.length){a:if(!a.$p){c=a.$p;a.$p=!0;var d=null,e=a.node;e=e instanceof kg?e:null;if(null===e||e.isSubGraphExpanded)var f=a.node.Ou(a.port.portId);else{if(!e.actualBounds.s()){a.$p=c;break a}d=e;f=d.Nu()}var g=a.Ud.length=0,h=a.port.ma(cd,G.alloc()),k=a.port.ma(pd,G.alloc());e=N.allocAt(h.x,h.y,0,0);e.Ie(k);G.free(h);G.free(k);h=G.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.Ci();for(f=f.iterator;f.next();){var l=f.value;if(l.isVisible()&&l.fromPort!==l.toPort){var m=
l.fromPort===a.port||null!==l.fromNode&&l.fromNode.Ee(d),n=l.computeSpot(m,a.port);if(n.nf()&&(m=m?l.toPort:l.fromPort,null!==m)){var p=m.part;if(null!==p){var q=p.findVisibleNode();null!==q&&q!==p&&(p=q,m=p.port);m=l.computeOtherPoint(p,m);p=h.Va(m);p-=k;0>p&&(p+=360);n=rp(e,n,p,l.isOrthogonal);0===n?(n=4,180<p&&(p-=360)):n=90===n?8:180===n?2:1;q=a.Ud[g];void 0===q?(q=new sp(l,p,n),a.Ud[g]=q):(q.link=l,q.angle=p,q.Ac=n);q.mv.set(m);g++}}}}G.free(h);a.Ud.sort(Uo.prototype.l);k=a.Ud.length;d=-1;for(g=
h=0;g<k;g++)f=a.Ud[g],void 0!==f&&(f.Ac!==d&&(d=f.Ac,h=0),f.Sp=h,h++);d=-1;h=0;for(g=k-1;0<=g;g--)k=a.Ud[g],void 0!==k&&(k.Ac!==d&&(d=k.Ac,h=k.Sp+1),k.Ql=h);g=a.Ud;n=a.port;d=a.node.portSpreading;h=G.alloc();k=G.alloc();f=G.alloc();l=G.alloc();n.ma(cd,h);n.ma(ed,k);n.ma(pd,f);n.ma(id,l);q=p=m=n=0;if(d===Do)for(var r=0;r<g.length;r++){var u=g[r];if(null!==u){var v=u.link.computeThickness();switch(u.Ac){case 8:p+=v;break;case 2:q+=v;break;case 1:n+=v;break;default:case 4:m+=v}}}var x=r=0,y=1,z=u=0;
for(v=0;v<g.length;v++){var B=g[v];if(null!==B){if(r!==B.Ac){r=B.Ac;switch(r){case 8:var C=f;x=l;break;case 2:C=l;x=h;break;case 1:C=h;x=k;break;default:case 4:C=k,x=f}u=x.x-C.x;z=x.y-C.y;switch(r){case 8:p>Math.abs(u)?(y=Math.abs(u)/p,p=Math.abs(u)):y=1;break;case 2:q>Math.abs(z)?(y=Math.abs(z)/q,q=Math.abs(z)):y=1;break;case 1:n>Math.abs(u)?(y=Math.abs(u)/n,n=Math.abs(u)):y=1;break;default:case 4:m>Math.abs(z)?(y=Math.abs(z)/m,m=Math.abs(z)):y=1}x=0}var I=B.Yp;if(d===Do){B=B.link.computeThickness();
B*=y;I.set(C);switch(r){case 8:I.x=C.x+u/2+p/2-x-B/2;break;case 2:I.y=C.y+z/2+q/2-x-B/2;break;case 1:I.x=C.x+u/2-n/2+x+B/2;break;default:case 4:I.y=C.y+z/2-m/2+x+B/2}x+=B}else{var J=.5;d===qo&&(J=(B.Sp+1)/(B.Ql+1));I.x=C.x+u*J;I.y=C.y+z*J}}}G.free(h);G.free(k);G.free(f);G.free(l);C=a.Ud;for(g=0;g<C.length;g++)d=C[g],null!==d&&(d.Mu=a.computeEndSegmentLength(d));a.$p=c;N.free(e)}c=a.Ud}for(a=0;a<c.length;a++)if(e=c[a],null!==e&&e.link===b)return e;return null}
Uo.prototype.l=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Ac<b.Ac?-1:a.Ac>b.Ac?1:a.angle<b.angle?-1:a.angle>b.angle?1:0};Uo.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,bd,b.fromPort===this.port),d=a.Sp;if(0>d)return c;var e=a.Ql;if(1>=e||!b.isOrthogonal)return c;b=a.mv;var f=a.Yp;if(2===a.Ac||8===a.Ac)d=e-1-d;return((a=2===a.Ac||4===a.Ac)?b.y<f.y:b.x<f.x)?c+8*d:(a?b.y===f.y:b.x===f.x)?c:c+8*(e-1-d)};Uo.className="Knot";
function sp(a,b,c){this.link=a;this.angle=b;this.Ac=c;this.mv=new G;this.Ql=this.Sp=0;this.Yp=new G;this.Mu=0}sp.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Ac.toString()+":"+this.Sp.toString()+"/"+this.Ql.toString()+" "+this.Yp.toString()+" "+this.Mu.toString()+" "+this.mv.toString()};sp.className="LinkInfo";function Mk(){this.fh=this.Ig=Hd;this.eh=this.Hg=this.dh=this.Gg=NaN;this.tp=this.xn=null;this.vp=this.yn=Infinity}
Mk.prototype.copy=function(){var a=new Mk;a.Ig=this.Ig.I();a.fh=this.fh.I();a.Gg=this.Gg;a.dh=this.dh;a.Hg=this.Hg;a.eh=this.eh;a.xn=this.xn;a.tp=this.tp;a.yn=this.yn;a.vp=this.vp;return a};Mk.className="LinkSettings";function ui(){tb(this);this.K=this.F=null;this.Yh=this.Mn=!0;this.Sn=!1;this.Km=(new G(0,0)).freeze();this.Pn=!0;this.On=null;this.ow="";this.u=null;this.Rn=!1;this.l=null}
ui.prototype.cloneProtected=function(a){a.Mn=this.Mn;a.Yh=this.Yh;a.Sn=this.Sn;a.Km.assign(this.Km);a.Pn=this.Pn;a.On=this.On;a.ow=this.ow;a.Rn=!0};ui.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};ui.prototype.hb=function(){};ui.prototype.toString=function(){var a=Pa(this.constructor);a+="(";null!==this.group&&(a+=" in "+this.group);null!==this.diagram&&(a+=" for "+this.diagram);return a+")"};
ui.prototype.B=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.isAnimating&&b.Vd(),this.isOngoing&&a.Xj||this.isInitial&&!a.Xj)&&(this.isValidLayout=!1,a.ec())}}};ui.prototype.createNetwork=function(){return new tp(this)};ui.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof P?(b.hg(a.nodes,!0),b.hg(a.links,!0)):a instanceof kg?b.hg(a.memberParts):b.hg(a.iterator);return b};
ui.prototype.updateParts=function(){var a=this.diagram;if(null===a&&null!==this.network)for(var b=this.network.vertexes.iterator;b.next();){var c=b.value.node;if(null!==c&&(a=c.diagram,null!==a))break}this.isValidLayout=!0;try{null!==a&&a.Aa("Layout"),this.commitLayout()}finally{null!==a&&a.ab("Layout")}};ui.prototype.commitLayout=function(){if(null!==this.network){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();if(this.isRouting)for(a=this.network.edges.iterator;a.next();)a.value.commit()}};
ui.prototype.doLayout=function(a){var b=new F;a instanceof P?(up(this,b,a.nodes,!0,this.fk,!0,!1,!0),up(this,b,a.parts,!0,this.fk,!0,!1,!0)):a instanceof kg?up(this,b,a.memberParts,!1,this.fk,!0,!1,!0):b.addAll(a.iterator);var c=b.count;if(0<c){a=this.diagram;null!==a&&a.Aa("Layout");c=Math.ceil(Math.sqrt(c));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var d=this.arrangementOrigin.x,e=d,f=this.arrangementOrigin.y,g=0,h=0;for(b=b.iterator;b.next();){var k=b.value;vp(k);var l=
k.measuredBounds,m=l.width;l=l.height;k.moveTo(e,f);k instanceof kg&&(k.fk=!1);e+=Math.max(m,50)+20;h=Math.max(h,Math.max(l,50));g>=c-1?(g=0,e=d,f+=h+20,h=0):g++}null!==a&&a.ab("Layout")}this.isValidLayout=!0};ui.prototype.fk=function(a){return!a.location.s()||a instanceof kg&&a.fk?!0:!1};
function up(a,b,c,d,e,f,g,h){for(c=c.iterator;c.next();){var k=c.value;d&&!k.isTopLevel||null!==e&&!e(k)||!k.canLayout()||(f&&k instanceof U?k.isLinkLabel||(k instanceof kg?null===k.layout?up(a,b,k.memberParts,!1,e,f,g,h):(vp(k),b.add(k)):(vp(k),b.add(k))):g&&k instanceof S?b.add(k):!h||!k.cc()||k instanceof U||(vp(k),b.add(k)))}}function vp(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.ac()}
ui.prototype.Ei=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new N),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};ui.prototype.Sw=function(a){var b=new F;a instanceof P?(up(this,b,a.nodes,!0,null,!0,!0,!0),up(this,b,a.links,!0,null,!0,!0,!0),up(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof kg?up(this,b,a.memberParts,!1,null,!0,!0,!0):up(this,b,a.iterator,!1,null,!0,!0,!0);return b};
ui.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.ma(cd),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};
pa.Object.defineProperties(ui.prototype,{diagram:{get:function(){return this.F},set:function(a){this.F=a}},group:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a,null!==a&&(this.F=a.diagram))}},isOngoing:{get:function(){return this.Mn},set:function(a){this.Mn!==a&&(this.Mn=a)}},isInitial:{get:function(){return this.Yh},set:function(a){this.Yh=a;a||(this.Rn=!0)}},
isViewportSized:{get:function(){return this.Sn},set:function(a){this.Sn!==a&&(this.Sn=a)&&this.B()}},isRouting:{get:function(){return this.Pn},set:function(a){this.Pn!==a&&(this.Pn=a)}},isRealtime:{get:function(){return this.On},set:function(a){this.On!==a&&(this.On=a)}},isValidLayout:{get:function(){return this.Rn},set:function(a){this.Rn!==a&&(this.Rn=a,a||(a=this.diagram,null!==
a&&(a.wg=!0)))}},network:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==a&&(a.layout=this))}},boundsComputation:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a,this.B())}},arrangementOrigin:{get:function(){return this.Km},set:function(a){this.Km.A(a)||(this.Km.assign(a),this.B())}}});ui.prototype.collectParts=ui.prototype.Sw;ui.prototype.getLayoutBounds=ui.prototype.Ei;
ui.prototype.invalidateLayout=ui.prototype.B;ui.className="Layout";function tp(a){tb(this);this.ic=a;this.ff=new F;this.be=new F;this.gt=new Pb;this.bt=new Pb}tp.prototype.clear=function(){if(this.ff)for(var a=this.ff.iterator;a.next();)a.value.clear();if(this.be)for(a=this.be.iterator;a.next();)a.value.clear();this.ff=new F;this.be=new F;this.gt=new Pb;this.bt=new Pb};
tp.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutNetwork"+(null!==this.layout?"("+this.layout.toString()+")":"");if(0>=a)return b;b+=" vertexes: "+this.ff.count+" edges: "+this.be.count;if(1<a){for(var c=this.ff.iterator;c.next();)b+="\n "+c.value.toString(a-1);for(c=this.be.iterator;c.next();)b+="\n "+c.value.toString(a-1)}return b};tp.prototype.createVertex=function(){return new wp(this)};tp.prototype.createEdge=function(){return new xp(this)};
tp.prototype.hg=function(a,b,c){if(null!==a){void 0===b&&(b=!1);void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof U)return!a.isLinkLabel;if(a instanceof S){var b=a.fromNode;if(null===b||b.isLinkLabel)return!1;a=a.toNode;return null===a||a.isLinkLabel?!1:!0}return!1});for(a=a.iterator;a.next();){var d=a.value;if(d instanceof U&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof kg&&null===d.layout)this.hg(d.memberParts,!1);else if(null===this.Bi(d)){var e=this.createVertex();e.node=
d;this.kh(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof S&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.Mp(d)){var f=d.fromNode;e=d.toNode;null!==f&&null!==e&&f!==e&&(f=this.findGroupVertex(f),e=this.findGroupVertex(e),null!==f&&null!==e&&this.Zj(f,e,d))}}};tp.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.Bi(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.Bi(b);if(null!==a)return a;b=b.containingGroup}return null};
t=tp.prototype;t.kh=function(a){if(null!==a){this.ff.add(a);var b=a.node;null!==b&&this.gt.add(b,a);a.network=this}};t.Kl=function(a){if(null===a)return null;var b=this.Bi(a);null===b&&(b=this.createVertex(),b.node=a,this.kh(b));return b};t.Lu=function(a){if(null!==a&&yp(this,a)){for(var b=a.rg,c=b.count-1;0<=c;c--){var d=b.N(c);this.Qj(d)}b=a.ig;for(a=b.count-1;0<=a;a--)c=b.N(a),this.Qj(c)}};function yp(a,b){if(null===b)return!1;var c=a.ff.remove(b);c&&a.gt.remove(b.node);return c}
t.vy=function(a){null!==a&&(a=this.Bi(a),null!==a&&this.Lu(a))};t.Bi=function(a){return null===a?null:this.gt.J(a)};t.Fj=function(a){if(null!==a){this.be.add(a);var b=a.link;null!==b&&null===this.Mp(b)&&this.bt.add(b,a);b=a.toVertex;null!==b&&b.Bu(a);b=a.fromVertex;null!==b&&b.zu(a);a.network=this}};
t.ay=function(a){if(null===a)return null;var b=a.fromNode,c=a.toNode,d=this.Mp(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.Kl(b)),null!==c&&(d.toVertex=this.Kl(c)),this.Fj(d)):(null!==b?d.fromVertex=this.Kl(b):d.fromVertex=null,null!==c?d.toVertex=this.Kl(c):d.toVertex=null);return d};t.Qj=function(a){if(null!==a){var b=a.toVertex;null!==b&&b.Ku(a);b=a.fromVertex;null!==b&&b.Ju(a);zp(this,a)}};function zp(a,b){null!==b&&a.be.remove(b)&&a.bt.remove(b.link)}
t.uy=function(a){null!==a&&(a=this.Mp(a),null!==a&&this.Qj(a))};t.Mp=function(a){return null===a?null:this.bt.J(a)};t.Zj=function(a,b,c){if(null===a||null===b)return null;if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.Fj(d);return d}return null};t.mm=function(a){if(null!==a){var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Ju(a),c.Ku(a),a.mm(),b.Bu(a),c.zu(a))}};
t.Kp=function(){for(var a=Ka(),b=this.be.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.Qj(a[c]);Oa(a)};tp.prototype.deleteArtificialVertexes=function(){for(var a=Ka(),b=this.ff.iterator;b.next();){var c=b.value;null===c.node&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.Lu(a[b]);b=Ka();for(c=this.be.iterator;c.next();){var d=c.value;null===d.link&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.Qj(b[d]);Oa(a);Oa(b)};
function Ap(a){for(var b=Ka(),c=a.be.iterator;c.next();){var d=c.value;null!==d.fromVertex&&null!==d.toVertex||b.push(d)}c=b.length;for(d=0;d<c;d++)a.Qj(b[d]);Oa(b)}
tp.prototype.Ix=function(){this.deleteArtificialVertexes();Ap(this);this.Kp();for(var a=new E,b=!0;b;){b=!1;for(var c=this.ff.iterator;c.next();){var d=c.value;if(0<d.rg.count||0<d.ig.count){b=this.layout.createNetwork();a.add(b);Bp(this,b,d);b=!0;break}}}a.sort(function(a,b){return null===a||null===b||a===b?0:b.vertexes.count-a.vertexes.count});return a};
function Bp(a,b,c){if(null!==c&&c.network!==b){yp(a,c);b.kh(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(zp(a,e),b.Fj(e),Bp(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(zp(a,c),b.Fj(c),Bp(a,b,c.toVertex))}}tp.prototype.Ay=function(){for(var a=new F,b=this.ff.iterator;b.next();)a.add(b.value.node);for(b=this.be.iterator;b.next();)a.add(b.value.link);return a};
pa.Object.defineProperties(tp.prototype,{layout:{get:function(){return this.ic},set:function(a){null!==a&&(this.ic=a)}},vertexes:{get:function(){return this.ff}},edges:{get:function(){return this.be}}});tp.prototype.findAllParts=tp.prototype.Ay;tp.prototype.splitIntoSubNetworks=tp.prototype.Ix;tp.prototype.deleteSelfEdges=tp.prototype.Kp;tp.prototype.reverseEdge=tp.prototype.mm;tp.prototype.linkVertexes=tp.prototype.Zj;
tp.prototype.findEdge=tp.prototype.Mp;tp.prototype.deleteLink=tp.prototype.uy;tp.prototype.deleteEdge=tp.prototype.Qj;tp.prototype.addLink=tp.prototype.ay;tp.prototype.addEdge=tp.prototype.Fj;tp.prototype.findVertex=tp.prototype.Bi;tp.prototype.deleteNode=tp.prototype.vy;tp.prototype.deleteVertex=tp.prototype.Lu;tp.prototype.addNode=tp.prototype.Kl;tp.prototype.addVertex=tp.prototype.kh;tp.prototype.addParts=tp.prototype.hg;tp.className="LayoutNetwork";
function wp(a){tb(this);this.Xc=a;this.l=(new N(0,0,10,10)).freeze();this.u=(new G(5,5)).freeze();this.gi=this.kb=null;this.rg=new E;this.ig=new E}wp.prototype.clear=function(){this.gi=this.kb=null;this.rg=new E;this.ig=new E};
wp.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+Fb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.rg.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.ig.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b};
wp.prototype.commit=function(){var a=this.kb;if(null!==a){var b=this.bounds,c=a.bounds;Aa(c)?(c.x=b.x,c.y=b.y,c.width=b.width,c.height=b.height):a.bounds=b.copy()}else if(a=this.node,null!==a){b=this.bounds;if(!(a instanceof kg)){c=N.alloc();var d=this.network.layout.Ei(a,c),e=a.locationObject.ma(gd);if(d.s()&&e.s()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));N.free(c);return}N.free(c)}a.moveTo(b.x,b.y)}};wp.prototype.Bu=function(a){null!==a&&(this.rg.contains(a)||this.rg.add(a))};
wp.prototype.Ku=function(a){null!==a&&this.rg.remove(a)};wp.prototype.zu=function(a){null!==a&&(this.ig.contains(a)||this.ig.add(a))};wp.prototype.Ju=function(a){null!==a&&this.ig.remove(a)};function Cp(a,b){a=a.gi;b=b.gi;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0}
pa.Object.defineProperties(wp.prototype,{sourceEdgesArrayAccess:{get:function(){return this.rg._dataArray}},destinationEdgesArrayAccess:{get:function(){return this.ig._dataArray}},data:{get:function(){return this.kb},set:function(a){this.kb=a;if(null!==a){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.u.h(d/2,b/2);this.l.h(a,c,d,b)}}},node:{get:function(){return this.gi},
set:function(a){if(this.gi!==a){this.gi=a;a.ac();var b=this.network.layout,c=N.alloc(),d=b.Ei(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.l.h(b,e,f,d);N.free(c);if(!(a instanceof kg)&&(a=a.locationObject.ma(gd),a.s())){this.u.h(a.x-b,a.y-e);return}this.u.h(f/2,d/2)}}},bounds:{get:function(){return this.l},set:function(a){this.l.A(a)||this.l.assign(a)}},focus:{get:function(){return this.u},set:function(a){this.u.A(a)||
this.u.assign(a)}},centerX:{get:function(){return this.l.x+this.u.x},set:function(a){var b=this.l;b.x+this.u.x!==a&&(b.ha(),b.x=a-this.u.x,b.freeze())}},centerY:{get:function(){return this.l.y+this.u.y},set:function(a){var b=this.l;b.y+this.u.y!==a&&(b.ha(),b.y=a-this.u.y,b.freeze())}},focusX:{get:function(){return this.u.x},set:function(a){var b=this.u;b.x!==a&&(b.ha(),b.x=a,b.freeze())}},focusY:{
get:function(){return this.u.y},set:function(a){var b=this.u;b.y!==a&&(b.ha(),b.y=a,b.freeze())}},x:{get:function(){return this.l.x},set:function(a){var b=this.l;b.x!==a&&(b.ha(),b.x=a,b.freeze())}},y:{get:function(){return this.l.y},set:function(a){var b=this.l;b.y!==a&&(b.ha(),b.y=a,b.freeze())}},width:{get:function(){return this.l.width},set:function(a){var b=this.l;b.width!==a&&(b.ha(),b.width=
a,b.freeze())}},height:{get:function(){return this.l.height},set:function(a){var b=this.l;b.height!==a&&(b.ha(),b.height=a,b.freeze())}},network:{get:function(){return this.Xc},set:function(a){this.Xc=a}},sourceVertexes:{get:function(){for(var a=new F,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);return a.iterator}},destinationVertexes:{get:function(){for(var a=new F,b=
this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{get:function(){for(var a=new F,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex);for(b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},sourceEdges:{get:function(){return this.rg.iterator}},destinationEdges:{get:function(){return this.ig.iterator}},edges:{get:function(){for(var a=
new E,b=this.sourceEdges;b.next();)a.add(b.value);for(b=this.destinationEdges;b.next();)a.add(b.value);return a.iterator}},edgesCount:{get:function(){return this.rg.count+this.ig.count}}});wp.prototype.deleteDestinationEdge=wp.prototype.Ju;wp.prototype.addDestinationEdge=wp.prototype.zu;wp.prototype.deleteSourceEdge=wp.prototype.Ku;wp.prototype.addSourceEdge=wp.prototype.Bu;wp.className="LayoutVertex";wp.standardComparer=Cp;
wp.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.gi;var c=b.gi;if(null!==a){if(null!==c){b=a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);a=c.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);for(c=0;c<b.length;c++)if(""!==a[c]&&void 0!==a[c]){var d=parseFloat(b[c]),e=parseFloat(a[c]);if(isNaN(d))if(isNaN(e)){if(0!==b[c].localeCompare(a[c]))return b[c].localeCompare(a[c])}else return 1;else{if(isNaN(e))return-1;if(0!==d-e)return d-
e}}else if(""!==b[c])return 1;return""!==a[c]&&void 0!==a[c]?-1:0}return 1}return null!==c?-1:0}return 1}return null!==b?-1:0};function xp(a){tb(this);this.Ub=a;this.cg=this.Gf=this.dl=this.kb=null}xp.prototype.clear=function(){this.cg=this.Gf=this.dl=this.kb=null};xp.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+Fb(this);0<a&&(b+=null!==this.dl?"("+this.dl.toString()+")":"",1<a&&(b+=" "+(this.Gf?this.Gf.toString():"null")+" --\x3e "+(this.cg?this.cg.toString():"null")));return b};
xp.prototype.mm=function(){var a=this.Gf;this.Gf=this.cg;this.cg=a};xp.prototype.commit=function(){};xp.prototype.jx=function(a){return this.cg===a?this.Gf:this.Gf===a?this.cg:null};
pa.Object.defineProperties(xp.prototype,{network:{get:function(){return this.Ub},set:function(a){this.Ub=a}},data:{get:function(){return this.kb},set:function(a){this.kb!==a&&(this.kb=a)}},link:{get:function(){return this.dl},set:function(a){this.dl!==a&&(this.dl=a)}},fromVertex:{get:function(){return this.Gf},set:function(a){this.Gf!==a&&(this.Gf=a)}},toVertex:{
get:function(){return this.cg},set:function(a){this.cg!==a&&(this.cg=a)}}});xp.prototype.getOtherVertex=xp.prototype.jx;xp.className="LayoutEdge";function uk(){ui.call(this);this.isViewportSized=!0;this.Bp=this.Cp=NaN;this.yg=(new L(NaN,NaN)).freeze();this.Ye=(new L(10,10)).freeze();this.xb=Dp;this.Bb=Ep;this.Rc=Fp;this.Mc=Gp}oa(uk,ui);
uk.prototype.cloneProtected=function(a){ui.prototype.cloneProtected.call(this,a);a.Cp=this.Cp;a.Bp=this.Bp;a.yg.assign(this.yg);a.Ye.assign(this.Ye);a.xb=this.xb;a.Bb=this.Bb;a.Rc=this.Rc;a.Mc=this.Mc};uk.prototype.hb=function(a){a.classType===uk?a===Fp||a===Hp||a===Ip||a===Jp?this.sorting=a:a===Ep||a===Kp?this.arrangement=a:a===Dp||a===Lp?this.alignment=a:A("Unknown enum value: "+a):ui.prototype.hb.call(this,a)};
uk.prototype.doLayout=function(a){this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.Sw(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.th()||null===d.fromNode&&null===d.toNode){if(d.ac(),d instanceof kg)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.Ma();if(0!==e.length){switch(this.sorting){case Jp:e.reverse();break;case Fp:e.sort(this.comparer);break;case Hp:e.sort(this.comparer),e.reverse()}var f=this.wrappingColumn;
isNaN(f)&&(f=0);var g=this.wrappingWidth;isNaN(g)&&null!==a?(b=a.padding,g=Math.max(a.viewportBounds.width-b.left-b.right,0)):g=Math.max(this.wrappingWidth,0);0>=f&&0>=g&&(f=1);b=this.spacing.width;isFinite(b)||(b=0);c=this.spacing.height;isFinite(c)||(c=0);null!==a&&a.Aa("Layout");d=[];switch(this.alignment){case Lp:var h=b,k=c,l=N.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n=m=0;n<e.length;n++){var p=this.Ei(e[n],l);m=Math.max(m,p.width)}m=Math.max(m+h,1);n=Math.max(this.cellSize.height,
1);if(!isFinite(n))for(p=n=0;p<e.length;p++){var q=this.Ei(e[p],l);n=Math.max(n,q.height)}n=Math.max(n+k,1);p=this.arrangement;for(var r=q=this.arrangementOrigin.x,u=this.arrangementOrigin.y,v=0,x=0,y=0;y<e.length;y++){var z=e[y],B=this.Ei(z,l),C=Math.ceil((B.width+h)/m)*m,I=Math.ceil((B.height+k)/n)*n;switch(p){case Kp:var J=Math.abs(r-B.width);break;default:J=r+B.width}if(0<f&&v>f-1||0<g&&0<v&&J>g)d.push(new N(0,u,g+h,x)),v=0,r=q,u+=x,x=0;x=Math.max(x,I);switch(p){case Kp:B=-B.width;break;default:B=
0}z.moveTo(r+B,u);switch(p){case Kp:r-=C;break;default:r+=C}v++}d.push(new N(0,u,g+h,x));N.free(l);break;case Dp:k=g;m=f;n=b;p=c;g=N.alloc();q=Math.max(this.cellSize.width,1);f=u=l=0;h=G.alloc();for(r=0;r<e.length;r++)x=e[r],v=this.Ei(x,g),x=x.qh(x.locationObject,x.locationSpot,h),l=Math.max(l,x.x),u=Math.max(u,v.width-x.x),f=Math.max(f,x.y);r=this.arrangement;switch(r){case Kp:l+=n;break;default:u+=n}q=isFinite(q)?Math.max(q+n,1):Math.max(l+u,1);var K=x=this.arrangementOrigin.x;y=this.arrangementOrigin.y;
u=0;k>=l&&(k-=l);l=z=0;C=Math.max(this.cellSize.height,1);B=f=0;I=!0;v=G.alloc();for(J=0;J<e.length;J++){var X=e[J],Q=this.Ei(X,g),ia=X.qh(X.locationObject,X.locationSpot,h);if(0<u)switch(r){case Kp:K=(K-x-(Q.width-ia.x))/q;K=H.ba(Math.round(K),K)?Math.round(K):Math.floor(K);K=K*q+x;break;default:K=(K-x+ia.x)/q,K=H.ba(Math.round(K),K)?Math.round(K):Math.ceil(K),K=K*q+x}else switch(r){case Kp:z=K+ia.x+Q.width;break;default:z=K-ia.x}switch(r){case Kp:var ja=-(K+ia.x)+z;break;default:ja=K+Q.width-ia.x-
z}if(0<m&&u>m-1||0<k&&0<u&&ja>k){d.push(new N(0,I?y-f:y,k+n,B+f+p));for(K=0;K<u&&J!==u;K++){ja=e[J-u+K];var M=ja.qh(ja.locationObject,ja.locationSpot,v);ja.moveTo(ja.position.x,ja.position.y+f-M.y)}B+=p;y=I?y+B:y+(B+f);u=B=f=0;K=x;I=!1}K===x&&(l=r===Kp?Math.max(l,Q.width-ia.x):Math.min(l,-ia.x));f=Math.max(f,ia.y);B=Math.max(B,Q.height-ia.y);isFinite(C)&&(B=Math.max(B,Math.max(Q.height,C)-ia.y));I?X.moveTo(K-ia.x,y-ia.y):X.moveTo(K-ia.x,y);switch(r){case Kp:K-=ia.x+n;break;default:K+=Q.width-ia.x+
n}u++}d.push(new N(0,y,k+n,(I?B:B+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=m.qh(m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);G.free(h);G.free(v);if(r===Kp)for(e=0;e<d.length;e++)f=d[e],f.width+=l,f.x-=l;else for(e=0;e<d.length;e++)f=d[e],f.x>l&&(f.width+=f.x-l,f.x=l);N.free(g)}for(h=f=g=e=0;h<d.length;h++)k=d[h],e=Math.min(e,k.x),g=Math.min(g,k.y),f=Math.max(f,k.x+k.width);this.arrangement===Kp?this.commitLayers(d,new G(e+b/2-(f+e),g-c/2)):this.commitLayers(d,
new G(e-b/2,g-c/2));null!==a&&a.ab("Layout");this.isValidLayout=!0}};uk.prototype.commitLayers=function(){};function Gp(a,b){a=a.text;b=b.text;return a<b?-1:a>b?1:0}
pa.Object.defineProperties(uk.prototype,{wrappingWidth:{get:function(){return this.Cp},set:function(a){this.Cp!==a&&(0<a||isNaN(a))&&(this.Cp=a,this.isViewportSized=isNaN(a),this.B())}},wrappingColumn:{get:function(){return this.Bp},set:function(a){this.Bp!==a&&(0<a||isNaN(a))&&(this.Bp=a,this.B())}},cellSize:{get:function(){return this.yg},set:function(a){this.yg.A(a)||(this.yg.assign(a),this.B())}},spacing:{
get:function(){return this.Ye},set:function(a){this.Ye.A(a)||(this.Ye.assign(a),this.B())}},alignment:{get:function(){return this.xb},set:function(a){this.xb===a||a!==Dp&&a!==Lp||(this.xb=a,this.B())}},arrangement:{get:function(){return this.Bb},set:function(a){this.Bb===a||a!==Ep&&a!==Kp||(this.Bb=a,this.B())}},sorting:{get:function(){return this.Rc},set:function(a){this.Rc===a||a!==Ip&&a!==Jp&&
a!==Fp&&a!==Hp||(this.Rc=a,this.B())}},comparer:{get:function(){return this.Mc},set:function(a){this.Mc!==a&&(this.Mc=a,this.B())}}});var Lp=new D(uk,"Position",0),Dp=new D(uk,"Location",1),Ep=new D(uk,"LeftToRight",2),Kp=new D(uk,"RightToLeft",3),Ip=new D(uk,"Forward",4),Jp=new D(uk,"Reverse",5),Fp=new D(uk,"Ascending",6),Hp=new D(uk,"Descending",7);uk.className="GridLayout";uk.standardComparer=Gp;
uk.smartComparer=function(a,b){if(null!==a){if(null!==b){a=a.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);b=b.text.toLocaleLowerCase().split(/([+\-]?[\.]?\d+(?:\.\d*)?(?:e[+\-]?\d+)?)/);for(var c=0;c<a.length;c++)if(""!==b[c]&&void 0!==b[c]){var d=parseFloat(a[c]),e=parseFloat(b[c]);if(isNaN(d))if(isNaN(e)){if(0!==a[c].localeCompare(b[c]))return a[c].localeCompare(b[c])}else return 1;else{if(isNaN(e))return-1;if(0!==d-e)return d-e}}else if(""!==a[c])return 1;return""!==
b[c]&&void 0!==b[c]?-1:0}return 1}return null!==b?-1:0};uk.Position=Lp;uk.Location=Dp;uk.LeftToRight=Ep;uk.RightToLeft=Kp;uk.Forward=Ip;uk.Reverse=Jp;uk.Ascending=Fp;uk.Descending=Hp;function pi(){this.wo=new F;this.$n=new F;this.Fa=new F;this.Me=new Pb;this.Ag=new Pb;this.gj=new Pb;this.F=null;this.tq=!1}t=pi.prototype;t.clear=function(){this.wo.clear();this.$n.clear();this.Fa.clear();this.Me.clear();this.Ag.clear();this.gj.clear()};t.ob=function(a){this.F=a};
t.Gi=function(a){if(a instanceof U){if(this.wo.add(a),a instanceof kg){var b=a.containingGroup;null===b?this.F.ti.add(a):b.il.add(a);b=a.layout;null!==b&&(b.diagram=this.F)}}else a instanceof S?this.$n.add(a):a instanceof sf||this.Fa.add(a);b=a.data;null===b||a instanceof sf||(a instanceof S?this.Ag.add(b,a):this.Me.add(b,a))};
t.zc=function(a){a.Jj();if(a instanceof U){if(this.wo.remove(a),a instanceof kg){var b=a.containingGroup;null===b?this.F.ti.remove(a):b.il.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof S?this.$n.remove(a):a instanceof sf||this.Fa.remove(a);b=a.data;null===b||a instanceof sf||(a instanceof S?this.Ag.remove(b):this.Me.remove(b))};
t.wd=function(){for(var a=this.F.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.cc()||b instanceof kg)&&A('Invalid node template in Diagram.nodeTemplateMap: template for "'+c+'" must be a Node or a simple Part, not a Group or Link: '+b)}for(a=this.F.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof kg||A('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.F.linkTemplateMap.iterator;a.next();)b=
a.value,c=a.key,b instanceof S||A('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=Ka();for(b=this.F.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=Ka();for(c=this.F.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=Ka();for(d=this.nodes.iterator;d.next();){var e=d.value;null!==e.data&&(c.push(e.data),c.push(e.location))}for(d=this.links.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),
c.push(e.location));for(d=this.parts.iterator;d.next();)e=d.value,null!==e.data&&(c.push(e.data),c.push(e.location));this.removeAllModeledParts();this.addAllModeledParts();for(d=0;d<a.length;d++)e=this.xc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.xc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.xc(c[d]),null!==e&&(e.location=c[d+1]);Oa(a);Oa(b);Oa(c)};pi.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)};
pi.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.Pb(a)&&Mp(c,a,!1)});a.forEach(function(a){d.Pb(a)&&c.resolveReferencesForData(a)});!1!==b&&Tj(this.diagram,!1)};
function Mp(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Me.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.F.undoManager.isUndoingRedoing&&!a.Me.contains(b)){var d=a.Rs(b);var e=oo(a,b,d);if(null!==e&&($g(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.vf=d;e.kb=b;a.tq&&(e.Og="Tool");a.diagram.add(e);e.kb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}}
pi.prototype.insertLink=function(){return null};pi.prototype.resolveReferencesForData=function(){};pi.prototype.Rs=function(a){return this.F.model.Rs(a)};
function oo(a,b,c){a=a.F;var d=a.model;d.Wj()&&d.ev(b)?(b=a.groupTemplateMap.J(c),null===b&&(b=a.groupTemplateMap.J(""),null===b&&(Np||(Np=!0,ya('No Group template found for category "'+c+'"'),ya(" Using default group template")),b=a.lw))):(b=a.nodeTemplateMap.J(c),null===b&&(b=a.nodeTemplateMap.J(""),null===b&&(Op||(Op=!0,ya('No Node template found for category "'+c+'"'),ya(" Using default node template")),b=a.nw)));return b}pi.prototype.getLinkCategoryForData=function(){return""};
pi.prototype.setLinkCategoryForData=function(){};pi.prototype.setFromNodeForLink=function(){};pi.prototype.setToNodeForLink=function(){};pi.prototype.findLinkTemplateForCategory=function(a){var b=this.F.linkTemplateMap.J(a);null===b&&(b=this.F.linkTemplateMap.J(""),null===b&&(Pp||(Pp=!0,ya('No Link template found for category "'+a+'"'),ya(" Using default link template")),b=this.F.mw));return b};pi.prototype.removeAllModeledParts=function(){this.mt(this.diagram.model.nodeDataArray)};
pi.prototype.mt=function(a){var b=this;a.forEach(function(a){b.hq(a)})};pi.prototype.hq=function(a){a=this.xc(a);null!==a&&(Cj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};pi.prototype.unresolveReferencesForPart=function(){};pi.prototype.removeDataForLink=function(){};pi.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.F.model.Qb(a);return null!==a?this.Me.J(a):null};t=pi.prototype;
t.Ib=function(a){if(null===a||void 0===a)return null;a=this.F.model.Qb(a);if(null===a)return null;a=this.Me.J(a);return a instanceof U?a:null};t.xc=function(a){if(null===a)return null;var b=this.Me.J(a);return null!==b?b:b=this.Ag.J(a)};t.zi=function(a){if(null===a)return null;a=this.Me.J(a);return a instanceof U?a:null};t.wc=function(a){return null===a?null:this.Ag.J(a)};
t.Os=function(a){for(var b=0;b<arguments.length;++b);b=new F;for(var c=this.wo.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(Aa(g)&&Qp(this,e,g)){b.add(d);break}}}return b.iterator};t.Ns=function(a){for(var b=0;b<arguments.length;++b);b=new F;for(var c=this.$n.iterator;c.next();){var d=c.value,e=d.data;if(null!==e)for(var f=0;f<arguments.length;f++){var g=arguments[f];if(Aa(g)&&Qp(this,e,g)){b.add(d);break}}}return b.iterator};
function Qp(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Da(f)){if(!Da(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!Rp(a,e[g],h))return!1}}else if(!Rp(a,e,f))return!1}return!0}function Rp(a,b,c){if("function"===typeof c){if(!c(b))return!1}else if(c instanceof RegExp){if(!b||!c.test(b.toString()))return!1}else if(Aa(b)&&Aa(c)){if(!Qp(a,b,c))return!1}else if(b!==c)return!1;return!0}
pi.prototype.doModelChanged=function(a){if(this.F){var b=this.F;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.ca){b.ca=!1;try{var d=a.modelChange;if(""!==d)if(c===df){if("nodeCategory"===d){var e=this.xc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.mt(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===hf){var g=a.newValue;"nodeDataArray"===d&&Aa(g)&&Mp(this,g);b.isModified=!0}else if(c===jf){var h=a.oldValue;
"nodeDataArray"===d&&Aa(h)&&this.hq(h);b.isModified=!0}else c===ef&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.pq(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.wd());else if(c===df){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.wd()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===hf||c===jf){var m=a.change===hf,n=m?a.newParam:a.oldParam,
p=m?a.newValue:a.oldValue,q=this.gj.J(a.object);if(Array.isArray(q))for(a=0;a<q.length;a++){var r=q[a];if(m)Tm(r,p,n);else if(!(0>n)){var u=n+Mm(r);r.zc(u,!0);Xm(r,u,n)}}b.isModified=!0}}finally{b.ca=!0}}}}};pi.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Da(a);for(b=this.nodes.iterator;b.next();)b.value.Da(a);for(b=this.links.iterator;b.next();)b.value.Da(a)};
pi.prototype.pq=function(){for(var a=this.F.model,b=new F,c=a.nodeDataArray,d=0;d<c.length;d++)b.add(c[d]);var e=[];this.nodes.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});this.parts.each(function(a){null===a.data||b.contains(a.data)||e.push(a.data)});e.forEach(function(b){Sp(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.xc(f)&&Tp(a,f,!1)}this.refreshDataBoundLinks();for(c=this.parts.iterator;c.next();)c.value.updateRelationshipsFromData();for(c=this.nodes.iterator;c.next();)c.value.updateRelationshipsFromData();
for(c=this.links.iterator;c.next();)c.value.updateRelationshipsFromData()};pi.prototype.refreshDataBoundLinks=function(){};pi.prototype.updateRelationshipsFromData=function(){};
pi.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.xc(a);if(null!==c)c.Da(b);else{c=null;for(var d=this.gj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].bx(a);null!==g&&(null===c&&(c=Ka()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Da(b);Oa(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}};
function xj(a,b){var c=b.ai;if(Da(c)){var d=a.gj.J(c);if(null===d)d=[],d.push(b),a.gj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Bj(a,b){var c=b.ai;if(Da(c)){var d=a.gj.J(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&a.gj.remove(c);break}}}
pi.prototype.Oj=function(a,b,c){var d=new Pb;if(Da(a))for(var e=0;e<a.length;e++)Up(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Up(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.Dk.dragsLink;e=new F;for(var f=new Pb,g=d.iterator;g.next();){var h=g.value;if(h instanceof S)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof U&&null!==h.data&&c.$l()){var k=h;h=g.key;var l=h.lg();null!==l&&(l=d.J(l),null!==l?(c.He(k.data,
c.pa(l.data)),k=b.wc(k.data),h=h.Ai(),null!==h&&null!==k&&f.add(h,k)):c.He(k.data,void 0))}}0<e.count&&b.nt(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.F&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new Pb;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.F.model)}for(b=d.iterator;b.next();)b.value.Da();return d};
function Up(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.J(b);var f=a.copyPartData(b,c);if(!(f instanceof T))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof U){for(var g=b.linksConnected;g.next();){var h=g.value;if(h.fromNode===b){var k=d.J(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.J(h),null!==h&&(h.toNode=f))}if(b instanceof kg&&f instanceof kg)for(b=b.memberParts;b.next();)g=Up(a,b.value,c,d,e),g instanceof S||null===g||(g.containingGroup=
f)}else if(b instanceof S&&f instanceof S)for(g=b.fromNode,null!==g&&(g=d.J(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.J(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=Up(a,b.value,c,d,e),null!==g&&g instanceof U&&(g.labeledLink=f);return f}
pi.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof S||(d=e.copyNodeData(d),Aa(d)&&(e.gf(d),c=b.xc(d)))}else $g(a),c=a.copy(),null!==c&&(e=this.F,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof S||(e=b.copyNodeData(d)),Aa(e)&&(c.data=e)));return c};
pa.Object.defineProperties(pi.prototype,{nodes:{get:function(){return this.wo}},links:{get:function(){return this.$n}},parts:{get:function(){return this.Fa}},diagram:{get:function(){return this.F}},addsToTemporaryLayer:{get:function(){return this.tq},set:function(a){this.tq=a}}});pi.prototype.updateAllRelationshipsFromData=pi.prototype.pq;
pi.prototype.findLinksByExample=pi.prototype.Ns;pi.prototype.findNodesByExample=pi.prototype.Os;pi.prototype.findLinkForData=pi.prototype.wc;pi.prototype.findNodeForData=pi.prototype.zi;pi.prototype.findPartForData=pi.prototype.xc;pi.prototype.findNodeForKey=pi.prototype.Ib;pi.prototype.removeModeledPart=pi.prototype.hq;pi.prototype.removeModeledParts=pi.prototype.mt;pi.prototype.rebuildParts=pi.prototype.wd;var Op=!1,Np=!1,Pp=!1;pi.className="PartManager";
function Vp(a){pi.apply(this,arguments)}oa(Vp,pi);Vp.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Wp(this,a.linkDataArray)};Vp.prototype.addModeledParts=function(a){pi.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)po(a.value);Tj(this.diagram,!1)};function Wp(a,b){b.forEach(function(b){Xp(a,b)});Tj(a.diagram,!1)}
function Xp(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Ag.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){$g(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.vf=c;e.kb=b;c=a.diagram.model;var f=Yp(c,b,!0);""!==f&&(e.fromPortId=f);f=Zp(c,b,!0);void 0!==f&&(f=a.Ib(f),f instanceof U&&(e.fromNode=f));f=Yp(c,b,!1);""!==f&&(e.toPortId=f);f=Zp(c,b,!1);void 0!==f&&(f=a.Ib(f),
f instanceof U&&(e.toNode=f));c=c.mg(b);Array.isArray(c)&&c.forEach(function(b){b=a.Ib(b);null!==b&&(b.labeledLink=e)});a.tq&&(e.Og="Tool");a.diagram.add(e);e.kb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Vp.prototype.removeAllModeledParts=function(){var a=this.diagram.model;$p(this,a.linkDataArray);this.mt(a.nodeDataArray)};function $p(a,b){b.forEach(function(b){a.hq(b)})}Vp.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Tu(a)};
Vp.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.pt(a,b)};Vp.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Bx(a.data,c.pa(null!==b?b.data:null))};Vp.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Fx(a.data,c.pa(null!==b?b.data:null))};Vp.prototype.removeDataForLink=function(a){this.diagram.model.hm(a.data)};
Vp.prototype.findPartForKey=function(a){var b=pi.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.oh(a),null!==a)?this.Ag.J(a):b};
Vp.prototype.doModelChanged=function(a){var b=this;pi.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.ca){c.ca=!1;try{var e=a.modelChange;if(""!==e)if(d===df){if("linkFromKey"===e){var f=this.wc(a.object);if(null!==f){var g=this.Ib(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.wc(a.object);if(null!==h){var k=this.Ib(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.wc(a.object);if(null!==l){var m=a.newValue;
"string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.wc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var q=this.xc(a.object);if(null!==q){var r=a.newValue;if(void 0!==r){var u=this.Ib(r);u instanceof kg?q.containingGroup=u:q.containingGroup=null}else q.containingGroup=null}}else if("linkLabelKeys"===e){var v=this.wc(a.object);if(null!==v){var x=a.oldValue,y=a.newValue;Array.isArray(x)&&x.forEach(function(a){a=b.Ib(a);
null!==a&&(a.labeledLink=null)});Array.isArray(y)&&y.forEach(function(a){a=b.Ib(a);null!==a&&(a.labeledLink=v)})}}else if("linkCategory"===e){var z=this.wc(a.object),B=a.newValue;null!==z&&"string"===typeof B&&(z.category=B)}else"linkDataArray"===e&&($p(this,a.oldValue),Wp(this,a.newValue));c.isModified=!0}else if(d===hf){var C=a.newValue;if("linkDataArray"===e&&"object"===typeof C&&null!==C)Xp(this,C);else if("linkLabelKeys"===e&&aq(C)){var I=this.wc(a.object),J=this.Ib(C);null!==I&&null!==J&&(J.labeledLink=
I)}c.isModified=!0}else{if(d===jf){var K=a.oldValue;if("linkDataArray"===e&&"object"===typeof K&&null!==K)this.hq(K);else if("linkLabelKeys"===e&&aq(K)){var X=this.Ib(K);null!==X&&(X.labeledLink=null)}c.isModified=!0}}else if(d===df){var Q=a.propertyName,ia=a.object;if(ia===c.model){if("linkFromKeyProperty"===Q||"linkToKeyProperty"===Q||"linkFromPortIdProperty"===Q||"linkToPortIdProperty"===Q||"linkLabelKeysProperty"===Q||"nodeIsGroupProperty"===Q||"nodeGroupKeyProperty"===Q||"linkCategoryProperty"===
Q)c.undoManager.isUndoingRedoing||this.wd()}else this.updateDataBindings(ia,Q);c.isModified=!0}}finally{c.ca=!0}}}}};Vp.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new F,d=b.linkDataArray;d.forEach(function(a){c.add(a)});var e=[];this.links.each(function(a){null===a.data||c.contains(a.data)||e.push(a.data)});e.forEach(function(a){bq(b,a,!1)});d.forEach(function(c){null===a.wc(c)&&cq(b,c,!1)})};
Vp.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;if(a instanceof S){var e=Zp(d,b,!0);e=c.Ib(e);a.fromNode=e;e=Zp(d,b,!1);e=c.Ib(e);a.toNode=e;b=d.mg(b);if(0<b.length||0<a.labelNodes.count){if(1===b.length&&1===a.labelNodes.count){e=b[0];var f=a.labelNodes.first();if(d.pa(f.data)===e)return}e=(new F).addAll(b);var g=new F;a.labelNodes.each(function(a){null!==a.data&&(a=d.pa(a.data),void 0!==a&&g.add(a))});b=g.copy();b.gq(e);e=
e.copy();e.gq(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Ib(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Ib(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof sf)&&(b=d.Di(b),b=c.findPartForKey(b),null===b||b instanceof kg)&&(a.containingGroup=b)}}};
Vp.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=dq(b,c),e=this.xc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.Pb(g)?e instanceof kg&&b.Di(g)===c&&(g=this.xc(g),null!==g&&(g.containingGroup=e)):(f.link=this.wc(g),null!==f.link&&e instanceof U&&(Zp(b,g,!0)===c&&(f.link.fromNode=e),Zp(b,g,!1)===c&&(f.link.toNode=e),g=b.mg(g),Array.isArray(g)&&g.some(function(a){return function(b){return b===c?(e.labeledLink=
a.link,!0):!1}}(f))));f={link:f.link}}eq(b,c)}a=b.Di(a);void 0!==a&&(a=this.Ib(a),a instanceof kg&&(e.containingGroup=a))}};Vp.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof U){var c=b.pa(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)fq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&fq(b,c,d.data));if(a instanceof kg)for(a=a.memberParts;a.next();)d=a.value.data,b.Pb(d)&&fq(b,c,d)}}};
Vp.prototype.copyPartData=function(a,b){var c=pi.prototype.copyPartData.call(this,a,b);if(a instanceof S)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.Jp(a);"object"===typeof a&&null!==a&&(d.wi(a),c=b.wc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.Jp(a),"object"===typeof b&&null!==b&&(c.data=b)));return c};
Vp.prototype.insertLink=function(a,b,c,d){var e=this.diagram,f=e.model,g=e.toolManager.findTool("Linking"),h="";null!==a&&(null===b&&(b=a),h=b.portId,null===h&&(h=""));b="";null!==c&&(null===d&&(d=c),b=d.portId,null===b&&(b=""));d=g.archetypeLinkData;if(d instanceof S){if($g(d),f=d.copy(),null!==f)return f.fromNode=a,f.fromPortId=h,f.toNode=c,f.toPortId=b,e.add(f),a=g.archetypeLabelNodeData,a instanceof U&&($g(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.Jp(d),"object"===
typeof d&&null!==d))return null!==a&&gq(f,d,f.pa(a.data),!0),hq(f,d,h,!0),null!==c&&gq(f,d,f.pa(c.data),!1),hq(f,d,b,!1),f.wi(d),a=g.archetypeLabelNodeData,null===a||a instanceof U||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.gf(a),a=f.pa(a),void 0!==a&&f.Au(d,a))),e.wc(d);return null};Vp.prototype.findPartForKey=Vp.prototype.findPartForKey;Vp.prototype.removeAllModeledParts=Vp.prototype.removeAllModeledParts;Vp.prototype.addModeledParts=Vp.prototype.addModeledParts;
Vp.prototype.addAllModeledParts=Vp.prototype.addAllModeledParts;Vp.className="GraphLinksPartManager";function iq(){pi.apply(this,arguments);this.Xg=null}oa(iq,pi);
function jq(a,b,c){if(null!==b&&null!==c){var d=a.diagram.toolManager.findTool("Linking"),e=b,f=c;if(a.diagram.isTreePathToChildren)for(b=f.linksConnected;b.next();){if(b.value.toNode===f)return}else for(e=c,f=b,b=e.linksConnected;b.next();)if(b.value.fromNode===e)return;if(null===d||!xg(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&($g(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.vf=d;
b.kb=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.kb=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}iq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Uu(a)};iq.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.Cv(a,b)};
iq.prototype.setFromNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren)d.He(a.data,d.pa(b));else{var e=this.Xg;this.Xg=a;null!==c&&d.He(c.data,void 0);d.He(b,d.pa(null!==a.toNode?a.toNode.data:null));this.Xg=e}};
iq.prototype.setToNodeForLink=function(a,b,c){var d=this.diagram.model;void 0===c&&(c=null);b=null!==b?b.data:null;if(this.diagram.isTreePathToChildren){var e=this.Xg;this.Xg=a;null!==c&&d.He(c.data,void 0);d.He(b,d.pa(null!==a.fromNode?a.fromNode.data:null));this.Xg=e}else d.He(a.data,d.pa(b))};iq.prototype.removeDataForLink=function(a){this.diagram.model.He(a.data,void 0)};
iq.prototype.doModelChanged=function(a){pi.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.ca){b.ca=!1;try{var d=a.modelChange;if(""!==d){if(c===df){if("nodeParentKey"===d){var e=a.object,f=this.Ib(a.newValue),g=this.zi(e);if(null!==this.Xg)null!==f&&(this.Xg.data=e,this.Xg.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.Ai();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:jq(this,f,
g)}}else if("parentLinkCategory"===d){var k=this.zi(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.Ai();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===df){var n=a.propertyName,p=a.object;p===b.model?"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.wd()):this.updateDataBindings(p,n);b.isModified=!0}}finally{b.ca=!0}}}}};
iq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;a instanceof U&&(b=d.Fi(b),b=c.Ib(b),d=a.lg(),b!==d&&(d=a.Ai(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:jq(this,b,a):null!==d&&Cj(c,d,!1)))}}};iq.prototype.updateDataBindings=function(a,b){pi.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.xc(a)&&(a=this.wc(a),null!==a&&a.Da(b))};
iq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=dq(b,c),e=this.xc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.Pb(f)&&e instanceof U&&b.Fi(f)===c&&jq(this,e,this.zi(f))}eq(b,c)}a=b.Fi(a);void 0!==a&&e instanceof U&&(a=this.Ib(a),jq(this,a,e))}};
iq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof U){var c=b.pa(a.data),d=this.wc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.zc(-1,d,!1);0<=f&&this.diagram.cb(jf,"parts",e,d,null,f,null);f=d.layerChanged;null!==f&&f(d,e,null)}}d=this.diagram.isTreePathToChildren;for(a=a.linksConnected;a.next();)e=a.value,e=(d?e.toNode:e.fromNode).data,b.Pb(e)&&fq(b,c,e)}};
iq.prototype.insertLink=function(a,b,c){b=this.diagram.model;var d=a,e=c;this.diagram.isTreePathToChildren||(d=c,e=a);return null!==d&&null!==e?(b.He(e.data,b.pa(d.data)),e.Ai()):null};iq.className="TreePartManager";
function Z(a){this.At=',\n "insertedNodeKeys": ';this.bw=',\n "modifiedNodeData": ';this.Ct=',\n "removedNodeKeys": ';tb(this);this.fn=this.Ta="";this.If=!1;this.l={};this.Gc=[];this.fb=new Pb;this.hi="key";this.Ak=this.fl=null;this.Wm=this.Xm=!1;this.Zm=!0;this.Hm=null;this.oj="category";this.Bf=new Pb;this.bu=new E;this.Zg=!1;this.u=null;this.undoManager=new lf;void 0!==a&&(this.nodeDataArray=a)}
Z.prototype.cloneProtected=function(a){a.Ta=this.Ta;a.fn=this.fn;a.If=this.If;a.hi=this.hi;a.fl=this.fl;a.Ak=this.Ak;a.Xm=this.Xm;a.Wm=this.Wm;a.Zm=this.Zm;a.Hm=this.Hm;a.oj=this.oj};Z.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};t=Z.prototype;t.clear=function(){this.Gc=[];this.fb.clear();this.Bf.clear();this.undoManager.clear()};
t.toString=function(a){void 0===a&&(a=0);if(1<a)return this.nq();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}}return b};
t.lk=function(){var a="";""!==this.name&&(a+=',\n "name": '+this.quote(this.name));""!==this.dataFormat&&(a+=',\n "dataFormat": '+this.quote(this.dataFormat));this.isReadOnly&&(a+=',\n "isReadOnly": '+this.isReadOnly);"key"!==this.nodeKeyProperty&&"string"===typeof this.nodeKeyProperty&&(a+=',\n "nodeKeyProperty": '+this.quote(this.nodeKeyProperty));this.copiesArrays&&(a+=',\n "copiesArrays": true');this.copiesArrayObjects&&(a+=',\n "copiesArrayObjects": true');this.copiesKey||(a+=',\n "copiesKey": false');
"category"!==this.nodeCategoryProperty&&"string"===typeof this.nodeCategoryProperty&&(a+=',\n "nodeCategoryProperty": '+this.quote(this.nodeCategoryProperty));return a};
t.fq=function(a){a.name&&(this.name=a.name);a.dataFormat&&(this.dataFormat=a.dataFormat);a.isReadOnly&&(this.isReadOnly=!0);a.nodeKeyProperty&&(this.nodeKeyProperty=a.nodeKeyProperty);a.copiesArrays&&(this.copiesArrays=!0);a.copiesArrayObjects&&(this.copiesArrayObjects=!0);a.copiesKey||(this.copiesKey=!1);a.nodeCategoryProperty&&(this.nodeCategoryProperty=a.nodeCategoryProperty)};function kq(a){return',\n "modelData": '+lq(a,a.modelData)}
function mq(a,b){b=b.modelData;Aa(b)&&(a.jm(b),a.modelData=b)}t.Vv=function(){var a=this.modelData,b=!1,c;for(c in a)if(!nq(c,a[c])){b=!0;break}a="";b&&(a=kq(this));return a+',\n "nodeDataArray": '+oq(this,this.nodeDataArray,!0)};t.qv=function(a){mq(this,a);a=a.nodeDataArray;Da(a)&&(this.jm(a),this.nodeDataArray=a)};
function pq(a,b,c,d){if(b===c)return!0;if(typeof b!==typeof c||"function"===typeof b||"function"===typeof c)return!1;if(Array.isArray(b)&&Array.isArray(c)){if(d.J(b)===c)return!0;d.add(b,c);if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!pq(a,b[e],c[e],d))return!1;return!0}if(Aa(b)&&Aa(c)){if(d.J(b)===c)return!0;d.add(b,c);for(var f in b){var g=b[f];if(!nq(f,g)){var h=c[f];if(void 0===h||!pq(a,g,h,d))return!1}}for(e in c)if(f=c[e],!nq(e,f)&&(g=b[e],void 0===g||!pq(a,g,f,d)))return!1;
return!0}return!1}function qq(a,b,c){a[c]!==b[c]&&A("Model.computeJsonDifference: Model."+c+' is not the same in both models: "'+a[c]+'" and "'+b[c]+'"')}
t.rq=function(a){qq(this,a,"nodeKeyProperty");for(var b=new F,c=new F,d=(new F).addAll(this.fb.iteratorKeys),e=new Pb,f=a.nodeDataArray,g=f.length,h=0;h<g;h++){var k=f[h],l=a.pa(k);if(void 0!==l){d.remove(l);var m=this.Qb(l);null===m?(b.add(l),c.add(k)):pq(this,m,k,e)||c.add(k)}else this.dt(k),l=this.pa(k),b.add(l),c.add(k)}f="";pq(this,this.modelData,a.modelData,e)||(f+=kq(this));0<b.count&&(f+=this.At+oq(this,b.Ma(),!0));0<c.count&&(f+=this.bw+oq(this,c.Ma(),!0));0<d.count&&(f+=this.Ct+oq(this,
d.Ma(),!0));return f};t.Ww=function(a,b){void 0===b&&(this.constructor===Z?b="go.Model":b=rq(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.lk()+this.rq(a)+"}"};t.my=function(a,b){return this.Ww(a,b)};
t.Uv=function(a,b){var c=this,d=!1,e=new F,f=new F,g=new F;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===hf?e.add(a.newValue):a.change===jf&&g.add(a.oldValue):c.Pb(a.object)?f.add(a.object):c.modelData===a.object&&a.change===df&&(d=!0))});var h=new F;e.each(function(a){h.add(c.pa(a));b||f.add(a)});var k=new F;g.each(function(a){k.add(c.pa(a));b&&f.add(a)});a="";d&&(a+=kq(this));0<h.count&&(a+=(b?this.Ct:this.At)+oq(this,h.Ma(),!0));0<f.count&&(a+=this.bw+oq(this,
f.Ma(),!0));0<k.count&&(a+=(b?this.At:this.Ct)+oq(this,k.Ma(),!0));return a};
t.pv=function(a){mq(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new Pb;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.pa(f);void 0!==g&&null!==g&&d.set(g,f)}if(Array.isArray(b))for(e=b.length,f=0;f<e;f++){g=b[f];var h=this.Qb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.pm(h,g),this.gf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.pa(e),f=this.Qb(f),null!==f)for(var k in e)"__gohashid"===k||k===this.nodeKeyProperty||this.Vj()&&k===
this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Qb(a[k]),null!==b&&this.im(b)};
t.Jx=function(a,b){a.change!==ef&&A("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof kf))return'{ "incremental": 0 }';void 0===b&&(this.constructor===Z?b="go.Model":b=rq(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.lk()+this.Uv(c,"FinishedUndo"===a.propertyName)+"}"};t.Kz=function(a,b){return this.Jx(a,b)};
t.nq=function(a){void 0===a&&(this.constructor===Z?a="go.Model":a=rq(this,this));return'{ "class": '+this.quote(a)+this.lk()+this.Vv()+"}"};t.toJSON=function(a){return this.nq(a)};t.Qw=function(a){var b=null;if("string"===typeof a)try{b=w.JSON.parse(a)}catch(d){}else"object"===typeof a?b=a:A("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&A("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.Aa("applyIncrementalJson"),this.pv(b),this.ab("applyIncrementalJson"))};
t.hy=function(a){return this.Qw(a)};Z.constructGraphLinksModel=function(){return new Z};t=Z.prototype;
t.jm=function(a){if(Da(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(Aa(d)){var e=c;d=this.jm(d);Array.isArray(a)?a[e]=d:A("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(Aa(a)){for(c in a)if(e=a[c],Aa(e)&&(e=this.jm(e),a[c]=e,"points"===c&&Array.isArray(e))){d=0===e.length%2;for(var f=0;f<e.length;f++)if("number"!==typeof e[f]){d=!1;break}if(d){d=new E;for(f=0;f<e.length/2;f++)d.add(new G(e[2*f],e[2*f+1]));d.freeze();a[c]=d}}if("object"===typeof a){c=a;e=a["class"];
if("NaN"===e)c=NaN;else if("Date"===e)c=new Date(a.value);else if("go.Point"===e)c=new G(sq(a.x),sq(a.y));else if("go.Size"===e)c=new L(sq(a.width),sq(a.height));else if("go.Rect"===e)c=new N(sq(a.x),sq(a.y),sq(a.width),sq(a.height));else if("go.Margin"===e)c=new Lc(sq(a.top),sq(a.right),sq(a.bottom),sq(a.left));else if("go.Spot"===e)"string"===typeof a["enum"]?c=$d(a["enum"]):c=new O(sq(a.x),sq(a.y),sq(a.offsetX),sq(a.offsetY));else if("go.Brush"===e){if(c=new bl,c.type=ub(bl,a.type),"string"===
typeof a.color&&(c.color=a.color),a.start instanceof O&&(c.start=a.start),a.end instanceof O&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=sq(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=sq(a.endRadius)),a=a.colorStops,Aa(a))for(b in a)c.addColorStop(parseFloat(b),a[b])}else"go.Geometry"===e?(b=null,"string"===typeof a.path?b=se(a.path):b=new ge,b.type=ub(ge,a.type),"number"===typeof a.startX&&(b.startX=sq(a.startX)),"number"===typeof a.startY&&(b.startY=sq(a.startY)),
"number"===typeof a.endX&&(b.endX=sq(a.endX)),"number"===typeof a.endY&&(b.endY=sq(a.endY)),a.spot1 instanceof O&&(b.spot1=a.spot1),a.spot2 instanceof O&&(b.spot2=a.spot2),c=b):"go.EnumValue"===e&&(b=a.classType,0===b.indexOf("go.")&&(b=b.substr(3)),c=ub(tq[b]?tq[b]:null,a.name));a=c}}return a};
t.quote=function(a){for(var b="",c=a.length,d=0;d<c;d++){var e=a[d];if('"'===e||"\\"===e)b+="\\"+e;else if("\b"===e)b+="\\b";else if("\f"===e)b+="\\f";else if("\n"===e)b+="\\n";else if("\r"===e)b+="\\r";else if("\t"===e)b+="\\t";else{var f=a.charCodeAt(d);b=16>f?b+("\\u000"+a.charCodeAt(d).toString(16)):32>f?b+("\\u00"+a.charCodeAt(d).toString(16)):8232===f?b+"\\u2028":8233===f?b+"\\u2029":b+e}}return'"'+b+'"'};
t.tm=function(a){return void 0===a?"undefined":null===a?"null":!0===a?"true":!1===a?"false":"string"===typeof a?this.quote(a):"number"===typeof a?Infinity===a?"9e9999":-Infinity===a?"-9e9999":isNaN(a)?'{"class":"NaN"}':a.toString():a instanceof Date?'{"class":"Date", "value":"'+a.toJSON()+'"}':a instanceof Number?this.tm(a.valueOf()):Da(a)?oq(this,a):Aa(a)?lq(this,a):"function"===typeof a?"null":a.toString()};
function oq(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new xb;e.add("[ ");c&&1<d&&e.add("\n");for(var f=0;f<d;f++){var g=b[f];void 0!==g&&(0<f&&(e.add(","),c&&e.add("\n")),e.add(a.tm(g)))}c&&1<d&&e.add("\n");e.add(" ]");return e.toString()}function nq(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function uq(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a}
function lq(a,b){var c=b;if(c instanceof G)b={"class":"go.Point",x:uq(c.x),y:uq(c.y)};else if(c instanceof L)b={"class":"go.Size",width:uq(c.width),height:uq(c.height)};else if(c instanceof N)b={"class":"go.Rect",x:uq(c.x),y:uq(c.y),width:uq(c.width),height:uq(c.height)};else if(c instanceof Lc)b={"class":"go.Margin",top:uq(c.top),right:uq(c.right),bottom:uq(c.bottom),left:uq(c.left)};else if(c instanceof O)c.ib()?b={"class":"go.Spot",x:uq(c.x),y:uq(c.y),offsetX:uq(c.offsetX),offsetY:uq(c.offsetY)}:
b={"class":"go.Spot","enum":c.toString()};else if(c instanceof bl){b={"class":"go.Brush",type:c.type.name};if(c.type===el)b.color=c.color;else if(c.type===hl||c.type===cl)b.start=c.start,b.end=c.end,c.type===cl&&(0!==c.startRadius&&(b.startRadius=uq(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=uq(c.endRadius)));if(null!==c.colorStops){var d={};for(c=c.colorStops.iterator;c.next();)d[c.key]=c.value;b.colorStops=d}}else c instanceof ge?(b={"class":"go.Geometry",type:c.type.name},0!==c.startX&&(b.startX=
uq(c.startX)),0!==c.startY&&(b.startY=uq(c.startY)),0!==c.endX&&(b.endX=uq(c.endX)),0!==c.endY&&(b.endY=uq(c.endY)),c.spot1.A(cd)||(b.spot1=c.spot1),c.spot2.A(pd)||(b.spot2=c.spot2),c.type===he&&(b.path=me(c))):c instanceof D&&(b={"class":"go.EnumValue",classType:rq(a,c.classType),name:c.name});d="{";c=!0;for(var e in b){var f=Ym(b,e);if(!nq(e,f))if(c?c=!1:d+=", ",d+='"'+e+'":',"points"===e&&f instanceof E){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.tm(h.x);g+=",";
g+=a.tm(h.y)}g+="]";d+=g}else d+=a.tm(f)}return d+"}"}function sq(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}t.jh=function(a){this.bu.add(a)};t.hk=function(a){this.bu.remove(a)};t.Es=function(a){this.skipsUndoManager||this.undoManager.Yu(a);for(var b=this.bu,c=b.length,d=0;d<c;d++)b.N(d)(a)};t.cb=function(a,b,c,d,e,f,g){vq(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){vq(this,"",df,a,this,b,c,d,e)};
t.it=function(a,b,c,d,e,f){vq(this,"",df,b,a,c,d,e,f)};function vq(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new cf;l.model=a;l.change=c;l.modelChange=b;l.propertyName=d;l.object=e;l.oldValue=f;l.oldParam=h;l.newValue=g;l.newParam=k;a.Es(l)}
t.Ij=function(a,b){if(null!==a&&a.model===this)if(a.change===df)Jj(a.object,a.propertyName,a.J(b));else if(a.change===hf){var c=a.newParam;if("nodeDataArray"===a.modelChange){if(a=a.newValue,Aa(a)&&"number"===typeof c){var d=this.pa(a);b?(this.Gc[c]===a&&Ja(this.Gc,c),void 0!==d&&this.fb.remove(d)):(this.Gc[c]!==a&&Ha(this.Gc,c,a),void 0!==d&&this.fb.add(d,a))}}else""===a.modelChange?((d=a.object)&&!Da(d)&&a.propertyName&&(d=Ym(a.object,a.propertyName)),Da(d)&&"number"===typeof c&&(a=a.newValue,b?
Ja(d,c):Ha(d,c,a))):A("unknown ChangedEvent.Insert modelChange: "+a.toString())}else a.change===jf?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,Aa(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.Gc[c]!==a&&Ha(this.Gc,c,a),void 0!==d&&this.fb.add(d,a)):(this.Gc[c]===a&&Ja(this.Gc,c),void 0!==d&&this.fb.remove(d)))):""===a.modelChange?((d=a.object)&&!Da(d)&&a.propertyName&&(d=Ym(a.object,a.propertyName)),Da(d)&&"number"===typeof c&&(a=a.oldValue,b?Ha(d,c,a):Ja(d,c))):A("unknown ChangedEvent.Remove modelChange: "+
a.toString())):a.change!==ef&&A("unknown ChangedEvent: "+a.toString())};t.Aa=function(a){return this.undoManager.Aa(a)};t.ab=function(a){return this.undoManager.ab(a)};t.rf=function(){return this.undoManager.rf()};Z.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Aa(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.ab(b):this.undoManager.rf(),this.skipsUndoManager=c}};t=Z.prototype;
t.Da=function(a,b){void 0===b&&(b="");vq(this,"SourceChanged",ef,b,a,null,null)};t.pa=function(a){if(null!==a){var b=this.hi;if(""!==b&&(b=Ym(a,b),void 0!==b)){if(aq(b))return b;A("Key value for node data "+a+" is not a number or a string: "+b)}}};
t.pm=function(a,b){if(null!==a){var c=this.hi;if(""!==c)if(this.Pb(a)){var d=Ym(a,c);d!==b&&null===this.Qb(b)&&(Jj(a,c,b),void 0!==d&&this.fb.remove(d),this.fb.add(b,a),vq(this,"nodeKey",df,c,a,d,b),"string"===typeof c&&this.Da(a,c),this.iq(d,b))}else Jj(a,c,b)}};function aq(a){return"number"===typeof a||"string"===typeof a}t.Pb=function(a){var b=this.pa(a);return void 0===b?!1:this.fb.J(b)===a};
t.Qb=function(a){null===a&&A("Model.findNodeDataForKey:key must not be null");return void 0!==a&&aq(a)?this.fb.J(a):null};t.dt=function(a){if(null!==a){var b=this.hi;if(""!==b){var c=this.pa(a);if(void 0===c||this.fb.contains(c)){var d=this.fl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.fb.contains(c))){Jj(a,b,c);return}if("string"===typeof c){for(d=2;this.fb.contains(c+d);)d++;Jj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.fb.count-1;this.fb.contains(c);)c--;Jj(a,b,c)}}}}};
t.gf=function(a){null!==a&&(Hb(a),this.Pb(a)||Tp(this,a,!0))};function Tp(a,b,c){var d=a.pa(b);if(void 0===d||a.fb.J(d)!==b)a.dt(b),d=a.pa(b),void 0===d?A("Model.makeNodeDataKeyUnique failed on "+b+". Data not added to Model."):(a.fb.add(d,b),d=null,c&&(d=a.Gc.length,Ha(a.Gc,d,b)),vq(a,"nodeDataArray",hf,"nodeDataArray",a,null,b,null,d),a.lm(b),a.km(b))}t.ey=function(a){if(Da(a))for(var b=a.length,c=0;c<b;c++)this.gf(a[c]);else for(a=a.iterator;a.next();)this.gf(a.value)};
t.im=function(a){null!==a&&Sp(this,a,!0)};function Sp(a,b,c){var d=a.pa(b);void 0!==d&&a.fb.remove(d);d=null;if(c){a:if(c=a.Gc,Array.isArray(c))d=c.indexOf(b);else{d=c.length;for(var e=0;e<d;e++)if(c[e]===b){d=e;break a}d=-1}if(0>d)return;Ja(a.Gc,d)}vq(a,"nodeDataArray",jf,"nodeDataArray",a,b,null,d,null);a.oq(b)}t.Bz=function(a){if(Da(a))for(var b=a.length,c=0;c<b;c++)this.im(a[c]);else for(a=a.iterator;a.next();)this.im(a.value)};
t.uz=function(a){if(Da(a)){for(var b=new F(this.fb.iteratorKeys),c=new F,d=a.length,e=0;e<d;e++){var f=a[e],g=this.pa(f);if(void 0!==g){c.add(g);var h=this.Qb(g);null!==h?this.Hj(h,f):(h={},this.pm(h,g),this.Hj(h,f),this.gf(h))}else this.gf(f),c.add(this.pa(f))}for(a=b.iterator;a.next();)b=a.value,c.contains(b)||(b=this.Qb(b))&&this.im(b)}};t.iq=function(a,b){void 0!==b&&(a=dq(this,a),a instanceof F&&this.Bf.add(b,a))};t.Qv=function(){};t.lm=function(){};t.km=function(){};t.oq=function(){};
function fq(a,b,c){if(void 0!==b){var d=a.Bf.J(b);null===d&&(d=new F,a.Bf.add(b,d));d.add(c)}}function eq(a,b,c){if(void 0!==b){var d=a.Bf.J(b);d instanceof F&&(void 0===c||null===c?a.Bf.remove(b):(d.remove(c),0===d.count&&a.Bf.remove(b)))}}function dq(a,b){if(void 0===b)return null;a=a.Bf.J(b);return a instanceof F?a:null}t.Fu=function(a){void 0===a?this.Bf.clear():this.Bf.remove(a)};
Z.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.Ak;a=null!==b?b(a,this):wq(this,a,!0);Aa(a)&&tb(a);return a};
function wq(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=wq(a,b[c],a.copiesArrayObjects);d.push(e)}tb(d);return d}if(c&&Aa(b)){c=(c=b.constructor)?new c:{};e=a.copiesKey||"string"!==typeof a.nodeKeyProperty?null:a.nodeKeyProperty;for(d in b)if("__gohashid"===d)c.__gohashid=void 0;else if(d===e)c[e]=void 0;else{var f=Ym(b,d),g=rq(a,f);"GraphObject"===g||"Diagram"===g||"Layer"===g||"RowColumnDefinition"===g||"AnimationManager"===g||"Tool"===g||"CommandHandler"===
g||"Layout"===g||"InputEvent"===g||"DiagramEvent"===g||f instanceof Z||f instanceof lf||f instanceof kf||f instanceof cf?Jj(c,d,f):(f=wq(a,f,!1),Jj(c,d,f))}tb(c);return c}return b instanceof G?b.copy():b instanceof L?b.copy():b instanceof N?b.copy():b instanceof O?b.copy():b instanceof Lc?b.copy():b}
Z.prototype.setDataProperty=function(a,b,c){if(this.Pb(a))if(b===this.nodeKeyProperty)this.pm(a,c);else{if(b===this.nodeCategoryProperty){this.kq(a,c);return}}else!xq&&a instanceof Y&&(xq=!0,ya('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),ya(" Is that really your intent?"));var d=Ym(a,b);d!==c&&(Jj(a,b,c),this.it(a,b,d,c))};t=Z.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};
t.Hj=function(a,b){if(b){var c=this.Pb(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.Zx=function(a,b){this.Us(a,-1,b)};t.Us=function(a,b,c){0>b&&(b=a.length);Ha(a,b,c);vq(this,"",hf,"",a,null,c,null,b)};t.rv=function(a,b){void 0===b&&(b=-1);a===this.Gc&&A("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Ja(a,b);vq(this,"",jf,"",a,c,null,b,null)};
t.Rs=function(a){if(null===a)return"";var b=this.oj;if(""===b)return"";b=Ym(a,b);if(void 0===b)return"";if("string"===typeof b)return b;A("getCategoryForNodeData found a non-string category for "+a+": "+b);return""};t.kq=function(a,b){if(null!==a){var c=this.oj;if(""!==c)if(this.Pb(a)){var d=Ym(a,c);void 0===d&&(d="");d!==b&&(Jj(a,c,b),vq(this,"nodeCategory",df,c,a,d,b))}else Jj(a,c,b)}};t.$l=function(){return!1};t.Vj=function(){return!1};t.Zl=function(){return!1};t.$s=function(){return!1};t.Wj=function(){return!1};
function ti(){return new Z}function rq(a,b){if("function"===typeof b){if(b.className)return b.className;if(b.name)return b.name}else if("object"===typeof b&&null!==b&&b.constructor)return rq(a,b.constructor);return typeof b}function Ym(a,b){if(!a||!b)return null;try{if("function"===typeof b)var c=b(a);else"function"===typeof a.getAttribute?(c=a.getAttribute(b),null===c&&(c=void 0)):c=a[b]}catch(d){}return c}
function Jj(a,b,c){if(a&&b)try{"function"===typeof b?b(a,c):"function"===typeof a.setAttribute?a.setAttribute(b,c):a[b]=c}catch(d){}}
pa.Object.defineProperties(Z.prototype,{name:{get:function(){return this.Ta},set:function(a){var b=this.Ta;b!==a&&(this.Ta=a,this.g("name",b,a))}},dataFormat:{get:function(){return this.fn},set:function(a){var b=this.fn;b!==a&&(this.fn=a,this.g("dataFormat",b,a))}},isReadOnly:{get:function(){return this.If},set:function(a){var b=this.If;b!==a&&(this.If=a,this.g("isReadOnly",b,a))}},modelData:{
get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.g("modelData",b,a),this.Da(a))}},undoManager:{get:function(){return this.u},set:function(a){var b=this.u;b!==a&&(null!==b&&b.xx(this),this.u=a,null!==a&&a.Nw(this))}},skipsUndoManager:{get:function(){return this.Zg},set:function(a){this.Zg=a}},nodeKeyProperty:{get:function(){return this.hi},set:function(a){var b=this.hi;
b!==a&&(""===a&&A("Model.nodeKeyProperty may not be the empty string"),0<this.fb.count&&A("Cannot set Model.nodeKeyProperty when there is existing node data"),this.hi=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{get:function(){return this.fl},set:function(a){var b=this.fl;b!==a&&(this.fl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{get:function(){return this.Gc},set:function(a){var b=this.Gc;if(b!==a){this.fb.clear();
this.Qv();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Aa(e)){A("Model.nodeDataArray must only contain Objects, not: "+e);return}Hb(e)}this.Gc=a;d=new E;for(e=0;e<c;e++){var f=a[e],g=this.pa(f);void 0===g?d.add(f):null!==this.fb.J(g)?d.add(f):this.fb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.dt(e),f=this.pa(e),void 0!==f&&this.fb.add(f,e);vq(this,"nodeDataArray",df,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.lm(d),this.km(d);this.Fu();Array.isArray(a)||(this.isReadOnly=!0)}}},
copyNodeDataFunction:{get:function(){return this.Ak},set:function(a){var b=this.Ak;b!==a&&(this.Ak=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{get:function(){return this.Xm},set:function(a){var b=this.Xm;b!==a&&(this.Xm=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{get:function(){return this.Wm},set:function(a){var b=this.Wm;b!==a&&(this.Wm=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{
get:function(){return this.Zm},set:function(a){var b=this.Zm;b!==a&&(this.Zm=a,this.g("copiesKey",b,a))}},afterCopyFunction:{get:function(){return this.Hm},set:function(a){var b=this.Hm;b!==a&&(this.Hm=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{get:function(){return this.oj},set:function(a){var b=this.oj;b!==a&&(this.oj=a,this.g("nodeCategoryProperty",b,a))}}});
pa.Object.defineProperties(Z,{type:{get:function(){return"Model"}}});Z.prototype.setCategoryForNodeData=Z.prototype.kq;Z.prototype.getCategoryForNodeData=Z.prototype.Rs;Z.prototype.removeArrayItem=Z.prototype.rv;Z.prototype.insertArrayItem=Z.prototype.Us;Z.prototype.addArrayItem=Z.prototype.Zx;Z.prototype.assignAllDataProperties=Z.prototype.Hj;Z.prototype.set=Z.prototype.set;Z.prototype.clearUnresolvedReferences=Z.prototype.Fu;Z.prototype.mergeNodeDataArray=Z.prototype.uz;
Z.prototype.removeNodeDataCollection=Z.prototype.Bz;Z.prototype.removeNodeData=Z.prototype.im;Z.prototype.addNodeDataCollection=Z.prototype.ey;Z.prototype.addNodeData=Z.prototype.gf;Z.prototype.makeNodeDataKeyUnique=Z.prototype.dt;Z.prototype.findNodeDataForKey=Z.prototype.Qb;Z.prototype.containsNodeData=Z.prototype.Pb;Z.prototype.setKeyForNodeData=Z.prototype.pm;Z.prototype.getKeyForNodeData=Z.prototype.pa;Z.prototype.updateTargetBindings=Z.prototype.Da;Z.prototype.commit=Z.prototype.commit;
Z.prototype.rollbackTransaction=Z.prototype.rf;Z.prototype.commitTransaction=Z.prototype.ab;Z.prototype.startTransaction=Z.prototype.Aa;Z.prototype.raiseDataChanged=Z.prototype.it;Z.prototype.raiseChanged=Z.prototype.g;Z.prototype.raiseChangedEvent=Z.prototype.cb;Z.prototype.removeChangedListener=Z.prototype.hk;Z.prototype.addChangedListener=Z.prototype.jh;Z.prototype.writeJsonValue=Z.prototype.tm;Z.prototype.replaceJsonObjects=Z.prototype.jm;Z.prototype.applyIncrementalJSON=Z.prototype.hy;
Z.prototype.applyIncrementalJson=Z.prototype.Qw;Z.prototype.toJSON=Z.prototype.toJSON;Z.prototype.toJson=Z.prototype.nq;Z.prototype.toIncrementalJSON=Z.prototype.Kz;Z.prototype.toIncrementalJson=Z.prototype.Jx;Z.prototype.computeJSONDifference=Z.prototype.my;Z.prototype.computeJsonDifference=Z.prototype.Ww;Z.prototype.clear=Z.prototype.clear;var xq=!1,tq={};Z.className="Model";
Z.fromJSON=Z.fromJson=function(a,b){void 0===b&&(b=null);var c=null;if("string"===typeof a)try{c=w.JSON.parse(a)}catch(f){}else"object"===typeof a?c=a:A("Unable to construct a Model from: "+a);if(null===b){a=null;var d=c["class"];if("string"===typeof d)try{var e=null;0===d.indexOf("go.")?(d=d.substr(3),e=tq[d]?tq[d]:null):(e=tq[d]?tq[d]:null,void 0===e&&(e=w[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof Z?b=a:A("Unable to construct a Model of declared class: "+c["class"])}null===
b&&(b=Z.constructGraphLinksModel());b.fq(c);b.qv(c);return b};Z.safePropertyValue=Ym;Z.safePropertySet=Jj;tq.Brush=bl;tq.ChangedEvent=cf;tq.Geometry=ge;tq.GraphObject=Y;tq.Margin=Lc;tq.Panel=W;tq.Point=G;tq.Rect=N;tq.Size=L;tq.Spot=O;tq.Transaction=kf;tq.UndoManager=lf;function Ai(a,b,c){tb(this);this.v=!1;void 0===a&&(a="");void 0===b&&(b=a);void 0===c&&(c=null);this.l=-1;this.Qd=null;this.Hl=a;this.Gl=this.qp=0;this.rs=null;this.Qn=!1;this.vl=b;this.Vm=c;this.mo=yq;this.Pm=null;this.Vt=new F}
Ai.prototype.copy=function(){var a=new Ai;a.Hl=this.Hl;a.qp=this.qp;a.Gl=this.Gl;a.rs=this.rs;a.Qn=this.Qn;a.vl=this.vl;a.Vm=this.Vm;a.mo=this.mo;a.Pm=this.Pm;return a};t=Ai.prototype;t.hb=function(a){a.classType===Ai&&(this.mode=a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.Oi?" "+this.Oi:"")+" "+this.mode.name+")"};t.freeze=function(){this.v=!0;return this};t.ha=function(){this.v=!1;return this};
t.ox=function(a){void 0===a&&(a=null);this.mode=Rm;this.backConverter=a;return this};t.bq=function(a){void 0===a&&(a="");this.sourceName=a;this.isToModel=!1;return this};t.vz=function(){this.sourceName=null;this.isToModel=!0;return this};function Pk(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.bb(a)}
t.Rv=function(a,b,c){var d=this.vl;if(void 0===c||""===d||d===c){c=this.Hl;var e=this.Vm;if(null===e&&""===c)ya("Binding error: target property is the empty string: "+this.toString());else{var f=b;""!==d&&(f=Ym(b,d));if(void 0!==f)if(null===e)""!==c&&Jj(a,c,f);else try{if(""!==c){var g=e(f,a);Jj(a,c,g)}else e(f,a)}catch(h){}}}};
t.qq=function(a,b,c,d){if(this.mo===Rm){var e=this.Hl;if(void 0===c||e===c){c=this.vl;var f=this.Pm,g=a;""!==e&&(g=Ym(a,e));if(void 0!==g&&!this.Vt.contains(a))try{this.Vt.add(a);var h=null!==d?d.diagram:null,k=null!==h?h.model:null;if(null===f)if(""!==c)null!==k?k.setDataProperty(b,c,g):Jj(b,c,g);else{if(null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var l=d.itemIndex,m=d.panel.itemArray;k.rv(m,l);k.Us(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?k.setDataProperty(b,
c,n):Jj(b,c,n)}else{var p=f(g,b,k);if(void 0!==p&&null!==k&&null!==d&&0<=d.itemIndex&&null!==d.panel&&Array.isArray(d.panel.itemArray)){var q=d.itemIndex,r=d.panel.itemArray;k.rv(r,q);k.Us(r,q,p)}}}catch(u){}}finally{this.Vt.remove(a)}}}};
pa.Object.defineProperties(Ai.prototype,{Oi:{get:function(){return this.l},set:function(a){this.v&&wa(this);this.l=a}},targetProperty:{get:function(){return this.Hl},set:function(a){this.v&&wa(this);this.Hl=a}},sourceName:{get:function(){return this.rs},set:function(a){this.v&&wa(this);this.rs=a;null!==a&&(this.Qn=!1)}},isToModel:{get:function(){return this.Qn},set:function(a){this.v&&
wa(this);this.Qn=a}},sourceProperty:{get:function(){return this.vl},set:function(a){this.v&&wa(this);this.vl=a}},converter:{get:function(){return this.Vm},set:function(a){this.v&&wa(this);this.Vm=a}},backConverter:{get:function(){return this.Pm},set:function(a){this.v&&wa(this);this.Pm=a}},mode:{get:function(){return this.mo},set:function(a){this.v&&wa(this);this.mo=a}}});
Ai.prototype.updateSource=Ai.prototype.qq;Ai.prototype.updateTarget=Ai.prototype.Rv;Ai.prototype.ofModel=Ai.prototype.vz;Ai.prototype.ofObject=Ai.prototype.bq;Ai.prototype.makeTwoWay=Ai.prototype.ox;var yq=new D(Ai,"OneWay",1),Rm=new D(Ai,"TwoWay",2);Ai.className="Binding";Ai.parseEnum=function(a,b){return function(c){c=ub(a,c);return null===c?b:c}};Ai.toString=Qa;Ai.OneWay=yq;Ai.TwoWay=Rm;
function zq(a,b){Z.call(this);this.zt=',\n "insertedLinkKeys": ';this.aw=',\n "modifiedLinkData": ';this.Bt=',\n "removedLinkKeys": ';this.Pc=[];this.Jf=new F;this.sb=new Pb;this.di="";this.Ri=this.zk=this.gl=null;this.Se="from";this.Te="to";this.lj=this.kj="";this.jj="category";this.Hd="";this.kl="isGroup";this.oe="group";this.Ym=!1;void 0!==a&&(this.nodeDataArray=a);void 0!==b&&(this.linkDataArray=b)}oa(zq,Z);zq.constructGraphLinksModel=Z.constructGraphLinksModel;
zq.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.di=this.di;a.gl=this.gl;a.zk=this.zk;a.Se=this.Se;a.Te=this.Te;a.kj=this.kj;a.lj=this.lj;a.jj=this.jj;a.Hd=this.Hd;a.kl=this.kl;a.oe=this.oe;a.Ym=this.Ym};t=zq.prototype;t.clear=function(){Z.prototype.clear.call(this);this.Pc=[];this.sb.clear();this.Jf.clear()};
t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.nq();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;var c=a.length,d;for(d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+Zp(this,e,!0)+"--\x3e"+Zp(this,e,!1)}return b};
t.lk=function(){var a=Z.prototype.lk.call(this),b="";"category"!==this.linkCategoryProperty&&"string"===typeof this.linkCategoryProperty&&(b+=',\n "linkCategoryProperty": '+this.quote(this.linkCategoryProperty));""!==this.linkKeyProperty&&"string"===typeof this.linkKeyProperty&&(b+=',\n "linkKeyProperty": '+this.quote(this.linkKeyProperty));"from"!==this.linkFromKeyProperty&&"string"===typeof this.linkFromKeyProperty&&(b+=',\n "linkFromKeyProperty": '+this.quote(this.linkFromKeyProperty));"to"!==
this.linkToKeyProperty&&"string"===typeof this.linkToKeyProperty&&(b+=',\n "linkToKeyProperty": '+this.quote(this.linkToKeyProperty));""!==this.linkFromPortIdProperty&&"string"===typeof this.linkFromPortIdProperty&&(b+=',\n "linkFromPortIdProperty": '+this.quote(this.linkFromPortIdProperty));""!==this.linkToPortIdProperty&&"string"===typeof this.linkToPortIdProperty&&(b+=',\n "linkToPortIdProperty": '+this.quote(this.linkToPortIdProperty));""!==this.linkLabelKeysProperty&&"string"===typeof this.linkLabelKeysProperty&&
(b+=',\n "linkLabelKeysProperty": '+this.quote(this.linkLabelKeysProperty));"isGroup"!==this.nodeIsGroupProperty&&"string"===typeof this.nodeIsGroupProperty&&(b+=',\n "nodeIsGroupProperty": '+this.quote(this.nodeIsGroupProperty));"group"!==this.nodeGroupKeyProperty&&"string"===typeof this.nodeGroupKeyProperty&&(b+=',\n "nodeGroupKeyProperty": '+this.quote(this.nodeGroupKeyProperty));return a+b};
t.fq=function(a){Z.prototype.fq.call(this,a);a.linkKeyProperty&&(this.linkKeyProperty=a.linkKeyProperty);a.linkFromKeyProperty&&(this.linkFromKeyProperty=a.linkFromKeyProperty);a.linkToKeyProperty&&(this.linkToKeyProperty=a.linkToKeyProperty);a.linkFromPortIdProperty&&(this.linkFromPortIdProperty=a.linkFromPortIdProperty);a.linkToPortIdProperty&&(this.linkToPortIdProperty=a.linkToPortIdProperty);a.linkCategoryProperty&&(this.linkCategoryProperty=a.linkCategoryProperty);a.linkLabelKeysProperty&&(this.linkLabelKeysProperty=
a.linkLabelKeysProperty);a.nodeIsGroupProperty&&(this.nodeIsGroupProperty=a.nodeIsGroupProperty);a.nodeGroupKeyProperty&&(this.nodeGroupKeyProperty=a.nodeGroupKeyProperty)};t.Vv=function(){var a=Z.prototype.Vv.call(this),b=',\n "linkDataArray": '+oq(this,this.linkDataArray,!0);return a+b};t.qv=function(a){Z.prototype.qv.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.jm(a),this.linkDataArray=a)};
t.rq=function(a){if(!(a instanceof zq))return A("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";var b=Z.prototype.rq.call(this,a);qq(this,a,"linkKeyProperty");qq(this,a,"linkFromKeyProperty");qq(this,a,"linkToKeyProperty");qq(this,a,"linkLabelKeysProperty");qq(this,a,"nodeIsGroupProperty");qq(this,a,"nodeGroupKeyProperty");for(var c=new F,d=new F,e=(new F).addAll(this.sb.iteratorKeys),f=new Pb,g=a.linkDataArray,h=g.length,k=0;k<h;k++){var l=g[k],m=a.lc(l);if(void 0!==m){e.remove(m);
var n=this.oh(m);null===n?(c.add(m),d.add(l)):pq(this,n,l,f)||d.add(l)}else this.Zp(l),m=this.lc(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.zt+oq(this,c.Ma(),!0));0<d.count&&(a+=this.aw+oq(this,d.Ma(),!0));0<e.count&&(a+=this.Bt+oq(this,e.Ma(),!0));return a};
t.Uv=function(a,b){var c=Z.prototype.Uv.call(this,a,b),d=this,e=new F,f=new F,g=new F;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===hf?e.add(a.newValue):a.change===jf&&g.add(a.oldValue):d.ye(a.object)&&f.add(a.object))});var h=new F;e.each(function(a){h.add(d.lc(a));b||f.add(a)});var k=new F;g.each(function(a){k.add(d.lc(a));b&&f.add(a)});a=c;0<h.count&&(a+=(b?this.Bt:this.zt)+oq(this,h.Ma(),!0));0<f.count&&(a+=this.aw+oq(this,f.Ma(),!0));0<k.count&&(a+=(b?this.zt:
this.Bt)+oq(this,k.Ma(),!0));return a};
t.pv=function(a){Z.prototype.pv.call(this,a);var b=a.insertedLinkKeys;if(Array.isArray(b))for(var c=b.length,d=0;d<c;d++){var e=b[d],f=this.oh(e);null===f&&(f=this.Jp({}),this.st(f,e),this.wi(f))}b=a.modifiedLinkData;if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.lc(e),f=this.oh(f),null!==f)for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.oh(a[b]),null!==c&&this.hm(c)};
t.Ij=function(a,b){if(a.change===hf){var c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;if(Aa(a)&&"number"===typeof c){var d=this.lc(a);b?(this.Jf.remove(a),this.Pc[c]===a&&this.Pc.splice(c,1),void 0!==d&&this.sb.remove(d)):(this.Jf.add(a),this.Pc[c]!==a&&this.Pc.splice(c,0,a),void 0!==d&&this.sb.add(d,a))}return}if("linkLabelKeys"===a.modelChange){d=this.mg(a.object);Array.isArray(d)&&"number"===typeof c&&(b?(c=d.indexOf(a.newValue),0<=c&&d.splice(c,1)):0>d.indexOf(a.newValue)&&d.splice(c,
0,a.newValue));return}}else if(a.change===jf){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;Aa(a)&&"number"===typeof c&&(d=this.lc(a),b?(this.Jf.add(a),this.Pc[c]!==a&&this.Pc.splice(c,0,a),void 0!==d&&this.sb.add(d,a)):(this.Jf.remove(a),this.Pc[c]===a&&this.Pc.splice(c,1),void 0!==d&&this.sb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.mg(a.object);Array.isArray(d)&&"number"===typeof c&&(b?0>d.indexOf(a.newValue)&&d.splice(c,0,a.newValue):(c=d.indexOf(a.newValue),
0<=c&&d.splice(c,1)));return}}Z.prototype.Ij.call(this,a,b)};t.am=function(a){if(void 0!==a){var b=this.Ri;if(null!==b){var c=this.Qb(a);null===c&&(c=this.copyNodeData(b),Jj(c,this.nodeKeyProperty,a),this.gf(c))}return a}};t.Uy=function(a){return Zp(this,a,!0)};t.Bx=function(a,b){gq(this,a,b,!0)};t.Zy=function(a){return Zp(this,a,!1)};t.Fx=function(a,b){gq(this,a,b,!1)};
function Zp(a,b,c){if(null!==b&&(a=c?a.Se:a.Te,""!==a&&(a=Ym(b,a),void 0!==a))){if(aq(a))return a;A((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}}function gq(a,b,c,d){null===c&&(c=void 0);if(null!==b){var e=d?a.Se:a.Te;if(""!==e)if(c=a.am(c),a.ye(b)){var f=Ym(b,e);f!==c&&(eq(a,f,b),Jj(b,e,c),null===a.Qb(c)&&fq(a,c,b),vq(a,d?"linkFromKey":"linkToKey",df,e,b,f,c),"string"===typeof e&&a.Da(b,e))}else Jj(b,e,c)}}t.Vy=function(a){return Yp(this,a,!0)};
t.Cx=function(a,b){hq(this,a,b,!0)};t.$y=function(a){return Yp(this,a,!1)};t.Gx=function(a,b){hq(this,a,b,!1)};function Yp(a,b,c){if(null===b)return"";a=c?a.kj:a.lj;if(""===a)return"";b=Ym(b,a);return void 0===b?"":b}function hq(a,b,c,d){if(null!==b){var e=d?a.kj:a.lj;if(""!==e)if(a.ye(b)){var f=Ym(b,e);void 0===f&&(f="");f!==c&&(Jj(b,e,c),vq(a,d?"linkFromPortId":"linkToPortId",df,e,b,f,c),"string"===typeof e&&a.Da(b,e))}else Jj(b,e,c)}}
t.mg=function(a){if(null===a)return Aq;var b=this.Hd;if(""===b)return Aq;a=Ym(a,b);return void 0===a?Aq:a};t.Bv=function(a,b){if(null!==a){var c=this.Hd;if(""!==c)if(this.ye(a)){var d=Ym(a,c);void 0===d&&(d=Aq);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)eq(this,d[f],a);Jj(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Qb(g)&&fq(this,g,a)}vq(this,"linkLabelKeys",df,c,a,d,b);"string"===typeof c&&this.Da(a,c)}}else Jj(a,c,b)}};
t.Au=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.Hd;if(""!==c){var d=Ym(a,c);if(void 0===d)c=[],c.push(b),this.Bv(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.ye(a)&&(null===this.Qb(b)&&fq(this,b,a),vq(this,"linkLabelKeys",hf,c,a,null,b,null,e)))}else A(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}};
t.wx=function(a,b){if(null!==b&&void 0!==b&&null!==a){var c=this.Hd;if(""!==c){var d=Ym(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.ye(a)&&(eq(this,b,a),vq(this,"linkLabelKeys",jf,c,a,b,null,e,null)))}else void 0!==d&&A(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}};t.lc=function(a){if(null!==a){var b=this.di;if(""!==b&&(b=Ym(a,b),void 0!==b)){if(aq(b))return b;A("Key value for link data "+a+" is not a number or a string: "+b)}}};
t.st=function(a,b){if(null!==a){var c=this.di;if(""!==c)if(this.ye(a)){var d=Ym(a,c);d!==b&&null===this.oh(b)&&(Jj(a,c,b),void 0!==d&&this.sb.remove(d),this.sb.add(b,a),vq(this,"linkKey",df,c,a,d,b),"string"===typeof c&&this.Da(a,c))}else Jj(a,c,b)}};t.oh=function(a){null===a&&A("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&aq(a)?this.sb.J(a):null};
t.Zp=function(a){if(null!==a){var b=this.di;if(""!==b){var c=this.lc(a);if(void 0===c||this.sb.contains(c)){var d=this.gl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.sb.contains(c))){Jj(a,b,c);return}if("string"===typeof c){for(d=2;this.sb.contains(c+d);)d++;Jj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.sb.count-1;this.sb.contains(c);)c--;Jj(a,b,c)}}}}};t.ye=function(a){return null===a?!1:this.Jf.contains(a)};t.wi=function(a){null!==a&&(Hb(a),this.ye(a)||cq(this,a,!0))};
function cq(a,b,c){if(""!==a.linkKeyProperty){var d=a.lc(b);if(void 0!==d&&a.sb.J(d)===b)return;a.Zp(b);d=a.lc(b);if(void 0===d){A("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.sb.add(d,b)}a.Jf.add(b);d=null;c&&(d=a.Pc.length,a.Pc.splice(d,0,b));vq(a,"linkDataArray",hf,"linkDataArray",a,null,b,null,d);Bq(a,b)}t.by=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.wi(a[c]);else for(a=a.iterator;a.next();)this.wi(a.value)};
t.hm=function(a){null!==a&&bq(this,a,!0)};function bq(a,b,c){a.Jf.remove(b);var d=a.lc(b);void 0!==d&&a.sb.remove(d);d=null;if(c){d=a.Pc.indexOf(b);if(0>d)return;a.Pc.splice(d,1)}vq(a,"linkDataArray",jf,"linkDataArray",a,b,null,d,null);c=Zp(a,b,!0);eq(a,c,b);c=Zp(a,b,!1);eq(a,c,b);d=a.mg(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],eq(a,c,b)}t.zz=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.hm(a[c]);else for(a=a.iterator;a.next();)this.hm(a.value)};
t.sz=function(a){if(Da(a)){for(var b=new F(this.sb.iteratorKeys),c=new F,d=a.length,e=0;e<d;e++){var f=a[e],g=this.lc(f);if(void 0!==g){c.add(g);var h=this.oh(g);null!==h?this.Hj(h,f):(h={},this.st(h,g),this.Hj(h,f),this.wi(h))}else this.wi(f),c.add(this.lc(f))}for(a=b.iterator;a.next();)b=a.value,c.contains(b)||(b=this.oh(b))&&this.hm(b)}};
function Bq(a,b){var c=Zp(a,b,!0);c=a.am(c);null===a.Qb(c)&&fq(a,c,b);c=Zp(a,b,!1);c=a.am(c);null===a.Qb(c)&&fq(a,c,b);var d=a.mg(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Qb(c)&&fq(a,c,b)}t.Jp=function(a){if(null===a)return null;var b=this.zk;a=null!==b?b(a,this):wq(this,a,!0);Aa(a)&&(tb(a),""!==this.Se&&Jj(a,this.Se,void 0),""!==this.Te&&Jj(a,this.Te,void 0),""!==this.Hd&&Jj(a,this.Hd,[]));return a};
t.ev=function(a){if(null===a)return!1;var b=this.kl;return""===b?!1:Ym(a,b)?!0:!1};t.Di=function(a){if(null!==a){var b=this.oe;if(""!==b&&(b=Ym(a,b),void 0!==b)){if(aq(b))return b;A("GroupKey value for node data "+a+" is not a number or a string: "+b)}}};
t.qt=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.oe;if(""!==c)if(this.Pb(a)){var d=Ym(a,c);d!==b&&(eq(this,d,a),Jj(a,c,b),null===this.Qb(b)&&fq(this,b,a),vq(this,"nodeGroupKey",df,c,a,d,b),"string"===typeof c&&this.Da(a,c))}else Jj(a,c,b)}};zq.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.Mj||""===this.oe||void 0===Ym(a,this.oe)||Jj(a,this.oe,void 0);return a};
zq.prototype.setDataProperty=function(a,b,c){if(this.Pb(a))if(b===this.nodeKeyProperty)this.pm(a,c);else{if(b===this.nodeCategoryProperty){this.kq(a,c);return}if(b===this.nodeGroupKeyProperty){this.qt(a,c);return}}else if(this.ye(a)){if(b===this.linkFromKeyProperty){gq(this,a,c,!0);return}if(b===this.linkToKeyProperty){gq(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){hq(this,a,c,!0);return}if(b===this.linkToPortIdProperty){hq(this,a,c,!1);return}if(b===this.linkKeyProperty){this.st(a,c);
return}if(b===this.linkCategoryProperty){this.pt(a,c);return}if(b===this.linkLabelKeysProperty){this.Bv(a,c);return}}var d=Ym(a,b);d!==c&&(Jj(a,b,c),this.it(a,b,d,c))};t=zq.prototype;t.Hj=function(a,b){if(b){var c=this.Pb(a),d=this.ye(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}};
t.iq=function(a,b){Z.prototype.iq.call(this,a,b);for(var c=this.fb.iterator;c.next();)this.vv(c.value,a,b);for(c=this.Jf.iterator;c.next();){var d=c.value,e=a,f=b;if(Zp(this,d,!0)===e){var g=this.Se;Jj(d,g,f);vq(this,"linkFromKey",df,g,d,e,f);"string"===typeof g&&this.Da(d,g)}Zp(this,d,!1)===e&&(g=this.Te,Jj(d,g,f),vq(this,"linkToKey",df,g,d,e,f),"string"===typeof g&&this.Da(d,g));g=this.mg(d);if(Array.isArray(g))for(var h=g.length,k=this.Hd,l=0;l<h;l++)g[l]===e&&(g[l]=f,vq(this,"linkLabelKeys",hf,
k,d,e,f,l,l))}};t.vv=function(a,b,c){if(this.Di(a)===b){var d=this.oe;Jj(a,d,c);vq(this,"nodeGroupKey",df,d,a,b,c);"string"===typeof d&&this.Da(a,d)}};t.Qv=function(){Z.prototype.Qv.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)Bq(this,a[c])};
t.lm=function(a){Z.prototype.lm.call(this,a);a=this.pa(a);var b=dq(this,a);if(null!==b){var c=Ka();for(b=b.iterator;b.next();){var d=b.value;if(this.Pb(d)){if(this.Di(d)===a){var e=this.oe;vq(this,"nodeGroupKey",df,e,d,a,a);"string"===typeof e&&this.Da(d,e);c.push(d)}}else if(Zp(this,d,!0)===a&&(e=this.Se,vq(this,"linkFromKey",df,e,d,a,a),"string"===typeof e&&this.Da(d,e),c.push(d)),Zp(this,d,!1)===a&&(e=this.Te,vq(this,"linkToKey",df,e,d,a,a),"string"===typeof e&&this.Da(d,e),c.push(d)),e=this.mg(d),
Array.isArray(e))for(var f=e.length,g=this.Hd,h=0;h<f;h++)e[h]===a&&(vq(this,"linkLabelKeys",hf,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)eq(this,a,c[b]);Oa(c)}};t.km=function(a){Z.prototype.km.call(this,a);var b=this.Di(a);null===this.Qb(b)&&fq(this,b,a)};t.oq=function(a){Z.prototype.oq.call(this,a);var b=this.Di(a);eq(this,b,a)};
t.Tu=function(a){if(null===a)return"";var b=this.jj;if(""===b)return"";b=Ym(a,b);if(void 0===b)return"";if("string"===typeof b)return b;A("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};zq.prototype.getLinkCategoryForData=function(a){return this.Tu(a)};zq.prototype.pt=function(a,b){if(null!==a){var c=this.jj;if(""!==c)if(this.ye(a)){var d=Ym(a,c);void 0===d&&(d="");d!==b&&(Jj(a,c,b),vq(this,"linkCategory",df,c,a,d,b),"string"===typeof c&&this.Da(a,c))}else Jj(a,c,b)}};
zq.prototype.setLinkCategoryForData=function(a,b){this.pt(a,b)};zq.prototype.Vj=function(){return!0};zq.prototype.Zl=function(){return!0};zq.prototype.$s=function(){return!0};zq.prototype.Wj=function(){return!0};
pa.Object.defineProperties(zq.prototype,{archetypeNodeData:{get:function(){return this.Ri},set:function(a){var b=this.Ri;b!==a&&(this.Ri=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{get:function(){return this.Se},set:function(a){var b=this.Se;b!==a&&(this.Se=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{get:function(){return this.Te},set:function(a){var b=this.Te;b!==a&&(this.Te=a,this.g("linkToKeyProperty",
b,a))}},linkFromPortIdProperty:{get:function(){return this.kj},set:function(a){var b=this.kj;b!==a&&(this.kj=a,this.g("linkFromPortIdProperty",b,a))}},linkToPortIdProperty:{get:function(){return this.lj},set:function(a){var b=this.lj;b!==a&&(this.lj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{get:function(){return this.Hd},set:function(a){var b=this.Hd;b!==a&&(this.Hd=a,this.g("linkLabelKeysProperty",
b,a))}},linkDataArray:{get:function(){return this.Pc},set:function(a){var b=this.Pc;if(b!==a){this.sb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Aa(e)){A("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}Hb(e)}this.Pc=a;if(""!==this.linkKeyProperty){d=new E;for(e=0;e<c;e++){var f=a[e],g=this.lc(f);void 0===g?d.add(f):null!==this.sb.J(g)?d.add(f):this.sb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Zp(e),f=this.lc(e),void 0!==
f&&this.sb.add(f,e)}d=new F;for(e=0;e<c;e++)d.add(a[e]);this.Jf=d;vq(this,"linkDataArray",df,"linkDataArray",this,b,a);for(b=0;b<c;b++)Bq(this,a[b])}}},linkKeyProperty:{get:function(){return this.di},set:function(a){var b=this.di;if(b!==a){this.di=a;this.sb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.lc(e);void 0===f&&(this.Zp(e),f=this.lc(e));void 0!==f&&this.sb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{
get:function(){return this.gl},set:function(a){var b=this.gl;b!==a&&(this.gl=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{get:function(){return this.zk},set:function(a){var b=this.zk;b!==a&&(this.zk=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{get:function(){return this.kl},set:function(a){var b=this.kl;b!==a&&(this.kl=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{
get:function(){return this.oe},set:function(a){var b=this.oe;b!==a&&(this.oe=a,this.g("nodeGroupKeyProperty",b,a))}},Mj:{get:function(){return this.Ym},set:function(a){this.Ym!==a&&(this.Ym=a)}},linkCategoryProperty:{get:function(){return this.jj},set:function(a){var b=this.jj;b!==a&&(this.jj=a,this.g("linkCategoryProperty",b,a))}}});pa.Object.defineProperties(zq,{type:{get:function(){return"GraphLinksModel"}}});
zq.prototype.setCategoryForLinkData=zq.prototype.pt;zq.prototype.getCategoryForLinkData=zq.prototype.Tu;zq.prototype.assignAllDataProperties=zq.prototype.Hj;zq.prototype.setGroupKeyForNodeData=zq.prototype.qt;zq.prototype.getGroupKeyForNodeData=zq.prototype.Di;zq.prototype.isGroupForNodeData=zq.prototype.ev;zq.prototype.copyLinkData=zq.prototype.Jp;zq.prototype.mergeLinkDataArray=zq.prototype.sz;zq.prototype.removeLinkDataCollection=zq.prototype.zz;zq.prototype.removeLinkData=zq.prototype.hm;
zq.prototype.addLinkDataCollection=zq.prototype.by;zq.prototype.addLinkData=zq.prototype.wi;zq.prototype.containsLinkData=zq.prototype.ye;zq.prototype.makeLinkDataKeyUnique=zq.prototype.Zp;zq.prototype.findLinkDataForKey=zq.prototype.oh;zq.prototype.setKeyForLinkData=zq.prototype.st;zq.prototype.getKeyForLinkData=zq.prototype.lc;zq.prototype.removeLabelKeyForLinkData=zq.prototype.wx;zq.prototype.addLabelKeyForLinkData=zq.prototype.Au;zq.prototype.setLabelKeysForLinkData=zq.prototype.Bv;
zq.prototype.getLabelKeysForLinkData=zq.prototype.mg;zq.prototype.setToPortIdForLinkData=zq.prototype.Gx;zq.prototype.getToPortIdForLinkData=zq.prototype.$y;zq.prototype.setFromPortIdForLinkData=zq.prototype.Cx;zq.prototype.getFromPortIdForLinkData=zq.prototype.Vy;zq.prototype.setToKeyForLinkData=zq.prototype.Fx;zq.prototype.getToKeyForLinkData=zq.prototype.Zy;zq.prototype.setFromKeyForLinkData=zq.prototype.Bx;zq.prototype.getFromKeyForLinkData=zq.prototype.Uy;zq.prototype.clear=zq.prototype.clear;
var Aq=Object.freeze([]);zq.className="GraphLinksModel";tq.GraphLinksModel=zq;Z.constructGraphLinksModel=Z.constructGraphLinksModel=function(){return new zq};Z.initDiagramModel=ti=function(){return new zq};function Cq(a){Z.call(this);this.pe="parent";this.$m=!1;this.rj="parentLinkCategory";void 0!==a&&(this.nodeDataArray=a)}oa(Cq,Z);Cq.constructGraphLinksModel=Z.constructGraphLinksModel;
Cq.prototype.cloneProtected=function(a){Z.prototype.cloneProtected.call(this,a);a.pe=this.pe;a.$m=this.$m;a.rj=this.rj};t=Cq.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.nq();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}}return b};
t.lk=function(){var a=Z.prototype.lk.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.fq=function(a){Z.prototype.fq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.rq=function(a){qq(this,a,"nodeParentKeyProperty");return Z.prototype.rq.call(this,a)};t.am=function(a){return a};
t.Fi=function(a){if(null!==a){var b=this.pe;if(""!==b&&(b=Ym(a,b),void 0!==b)){if(aq(b))return b;A("ParentKey value for node data "+a+" is not a number or a string: "+b)}}};t.He=function(a,b){null===b&&(b=void 0);if(null!==a){var c=this.pe;if(""!==c)if(b=this.am(b),this.Pb(a)){var d=Ym(a,c);d!==b&&(eq(this,d,a),Jj(a,c,b),null===this.Qb(b)&&fq(this,b,a),vq(this,"nodeParentKey",df,c,a,d,b),"string"===typeof c&&this.Da(a,c))}else Jj(a,c,b)}};
t.Uu=function(a){if(null===a)return"";var b=this.rj;if(""===b)return"";b=Ym(a,b);if(void 0===b)return"";if("string"===typeof b)return b;A("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};Cq.prototype.getLinkCategoryForData=function(a){return this.Uu(a)};
Cq.prototype.Cv=function(a,b){if(null!==a){var c=this.rj;if(""!==c)if(this.Pb(a)){var d=Ym(a,c);void 0===d&&(d="");d!==b&&(Jj(a,c,b),vq(this,"parentLinkCategory",df,c,a,d,b),"string"===typeof c&&this.Da(a,c))}else Jj(a,c,b)}};Cq.prototype.setLinkCategoryForData=function(a,b){this.Cv(a,b)};Cq.prototype.copyNodeData=function(a){if(null===a)return null;a=Z.prototype.copyNodeData.call(this,a);this.Nj||""===this.pe||void 0===Ym(a,this.pe)||Jj(a,this.pe,void 0);return a};
Cq.prototype.setDataProperty=function(a,b,c){if(this.Pb(a))if(b===this.nodeKeyProperty)this.pm(a,c);else{if(b===this.nodeCategoryProperty){this.kq(a,c);return}if(b===this.nodeParentKeyProperty){this.He(a,c);return}}var d=Ym(a,b);d!==c&&(Jj(a,b,c),this.it(a,b,d,c))};t=Cq.prototype;t.iq=function(a,b){Z.prototype.iq.call(this,a,b);for(var c=this.fb.iterator;c.next();)this.vv(c.value,a,b)};
t.vv=function(a,b,c){if(this.Fi(a)===b){var d=this.pe;Jj(a,d,c);vq(this,"nodeParentKey",df,d,a,b,c);"string"===typeof d&&this.Da(a,d)}};t.lm=function(a){Z.prototype.lm.call(this,a);a=this.pa(a);var b=dq(this,a);if(null!==b){var c=Ka();for(b=b.iterator;b.next();){var d=b.value;if(this.Pb(d)&&this.Fi(d)===a){var e=this.pe;vq(this,"nodeParentKey",df,e,d,a,a);"string"===typeof e&&this.Da(d,e);c.push(d)}}for(b=0;b<c.length;b++)eq(this,a,c[b]);Oa(c)}};
t.km=function(a){Z.prototype.km.call(this,a);var b=this.Fi(a);b=this.am(b);null===this.Qb(b)&&fq(this,b,a)};t.oq=function(a){Z.prototype.oq.call(this,a);var b=this.Fi(a);eq(this,b,a)};t.$l=function(){return!0};t.$s=function(){return!0};
pa.Object.defineProperties(Cq.prototype,{nodeParentKeyProperty:{get:function(){return this.pe},set:function(a){var b=this.pe;b!==a&&(this.pe=a,this.g("nodeParentKeyProperty",b,a))}},Nj:{get:function(){return this.$m},set:function(a){this.$m!==a&&(this.$m=a)}},parentLinkCategoryProperty:{get:function(){return this.rj},set:function(a){var b=this.rj;b!==a&&(this.rj=a,this.g("parentLinkCategoryProperty",b,a))}},
linkCategoryProperty:{get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}}});pa.Object.defineProperties(Cq,{type:{get:function(){return"TreeModel"}}});Cq.prototype.setParentLinkCategoryForNodeData=Cq.prototype.Cv;Cq.prototype.getParentLinkCategoryForNodeData=Cq.prototype.Uu;Cq.prototype.setParentKeyForNodeData=Cq.prototype.He;Cq.prototype.getParentKeyForNodeData=Cq.prototype.Fi;
Cq.className="TreeModel";tq.TreeModel=Cq;function Dq(){ui.call(this);this.rw=this.tn=this.Xb=0;this.br=360;this.qw=Eq;this.Xi=0;this.cw=new G;this.Pq=this.Rd=0;this.As=new Fq;this.It=this.qj=0;this.Sx=600;this.Mo=NaN;this.Mm=1;this.np=0;this.Dl=360;this.Bb=Eq;this.L=Gq;this.Rc=Hq;this.Mc=Cp;this.Ye=6;this.vo=Iq}oa(Dq,ui);
Dq.prototype.cloneProtected=function(a){ui.prototype.cloneProtected.call(this,a);a.Mo=this.Mo;a.Mm=this.Mm;a.np=this.np;a.Dl=this.Dl;a.Bb=this.Bb;a.L=this.L;a.Rc=this.Rc;a.Mc=this.Mc;a.Ye=this.Ye;a.vo=this.vo};
Dq.prototype.hb=function(a){if(a.classType===Dq)if(a===Jq||a===Kq||a===Lq||a===Mq||a===Hq)this.sorting=a;else if(a===Nq||a===Oq||a===Gq||a===Pq)this.direction=a;else if(a===Qq||a===Sq||a===Eq||a===Tq)this.arrangement=a;else{if(a===Uq||a===Iq)this.nodeDiameterFormula=a}else ui.prototype.hb.call(this,a)};Dq.prototype.createNetwork=function(){return new Vq(this)};
Dq.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);a=this.network.vertexes;if(1>=a.count)1===a.count&&(a=a.first(),a.centerX=0,a.centerY=0);else{var b=new E;b.addAll(a.iterator);a=new E;var c=new E;var d=this.sort(b);var e,f,g=this.Pq;var h=this.arrangement;var k=this.nodeDiameterFormula;var l=this.radius;if(!isFinite(l)||0>=l)l=NaN;var m=this.aspectRatio;if(!isFinite(m)||0>=m)m=1;var n=this.startAngle;
isFinite(n)||(n=0);var p=this.sweepAngle;if(!isFinite(p)||360<p||1>p)p=360;b=this.spacing;isFinite(b)||(b=NaN);h===Tq&&k===Uq?h=Eq:h===Tq&&k!==Uq&&(h=this.arrangement);if((this.direction===Nq||this.direction===Oq)&&this.sorting!==Hq){for(k=0;!(k>=d.length);k+=2){a.add(d.N(k));if(k+1>=d.length)break;c.add(d.N(k+1))}this.direction===Nq?(this.arrangement===Tq&&a.reverse(),d=new E,d.addAll(a),d.addAll(c)):(this.arrangement===Tq&&c.reverse(),d=new E,d.addAll(c),d.addAll(a))}k=d.length;for(var q=f=e=0;q<
d.length;q++){var r=n+p*f*(this.direction===Gq?1:-1)/k,u=d.N(q).diameter;isNaN(u)&&(u=Wq(d.N(q),r));360>p&&(0===q||q===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Tq){isNaN(b)&&(b=6);if(h!==Eq&&h!==Tq){f=-Infinity;for(g=0;g<k;g++)q=d.N(g),e=d.N(g===k-1?0:g+1),isNaN(q.diameter)&&Wq(q,0),isNaN(e.diameter)&&Wq(e,0),f=Math.max(f,(q.diameter+e.diameter)/2);g=f+b;h===Qq?l=(f+b)/(2*Math.PI/k):l=Xq(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=Xq(this,e+(360<=p?k:k-1)*(h!==Tq?b:1.6*b),m,n*
Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,q=Yq(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===Eq||h===Tq)b=(q-e)/(360<=p?k:k-1)}else if(h===Eq||h===Tq)q=(q-e)/(360<=p?k:k-1),q<b?(l=Xq(this,e+b*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180),f=l*m):b=q;else{g=-Infinity;for(e=0;e<k;e++)r=d.N(e),u=d.N(e===k-1?0:e+1),isNaN(r.diameter)&&Wq(r,0),isNaN(u.diameter)&&Wq(u,0),g=Math.max(g,(r.diameter+u.diameter)/2);g+=b;e=Xq(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180);e>l?(l=e,f=l*m):g=
q/(360<=p?k:k-1)}this.qw=h;this.Xb=l;this.tn=m;this.rw=n;this.br=p;this.Xi=b;this.Rd=f;this.Pq=g;b=d;d=this.qw;h=this.Xb;l=this.rw;m=this.br;n=this.Xi;p=this.Rd;k=this.Pq;if(this.direction!==Nq&&this.direction!==Oq||d!==Tq)if(this.direction===Nq||this.direction===Oq){g=0;switch(d){case Sq:g=180*Zq(this,h,p,l,k)/Math.PI;break;case Eq:k=b=0;g=a.first();null!==g&&(b=Wq(g,Math.PI/2));g=c.first();null!==g&&(k=Wq(g,Math.PI/2));g=180*Zq(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Qq:g=m/b.length}if(this.direction===
Nq){switch(d){case Sq:$q(this,a,l,Pq);break;case Eq:ar(this,a,l,Pq);break;case Qq:br(this,a,m/2,l,Pq)}switch(d){case Sq:$q(this,c,l+g,Gq);break;case Eq:ar(this,c,l+g,Gq);break;case Qq:br(this,c,m/2,l+g,Gq)}}else{switch(d){case Sq:$q(this,c,l,Pq);break;case Eq:ar(this,c,l,Pq);break;case Qq:br(this,c,m/2,l,Pq)}switch(d){case Sq:$q(this,a,l+g,Gq);break;case Eq:ar(this,a,l+g,Gq);break;case Qq:br(this,a,m/2,l+g,Gq)}}}else switch(d){case Sq:$q(this,b,l,this.direction);break;case Eq:ar(this,b,l,this.direction);
break;case Qq:br(this,b,m,l,this.direction);break;case Tq:cr(this,b,m,l,this.direction)}else cr(this,b,m,l-m/2,Gq)}this.updateParts();this.network=null;this.isValidLayout=!0};function br(a,b,c,d,e){var f=a.br,g=a.Xb;a=a.Rd;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===Gq?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.N(k),n=g*Math.tan(l)/a;n=Math.sqrt((g*g+a*a*n*n)/(1+n*n));m.centerX=n*Math.cos(l);m.centerY=n*Math.sin(l);m.actualAngle=180*l/Math.PI}}
function ar(a,b,c,d){var e=a.Xb,f=a.Rd,g=a.Xi;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.N(k),m=b.N(k===h-1?0:k+1),n=f*Math.sin(c);l.centerX=e*Math.cos(c);l.centerY=n;l.actualAngle=180*c/Math.PI;isNaN(l.diameter)&&Wq(l,0);isNaN(m.diameter)&&Wq(m,0);l=Zq(a,e,f,d===Gq?c:-c,(l.diameter+m.diameter)/2+g);c+=d===Gq?l:-l}}
function $q(a,b,c,d){var e=a.Xb,f=a.Rd,g=a.Pq;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.N(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=Zq(a,e,f,d===Gq?c:-c,g);c+=d===Gq?l:-l}}function cr(a,b,c,d,e){var f=a.br;a.qj=0;a.As=new Fq;if(360>c){for(f=d+(e===Gq?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.It=f;dr(a,b,c,d,e)}else er(a,b,c,d,e);a.As.commit(b)}
function er(a,b,c,d,e){var f=a.Xb,g=a.Xi,h=a.tn,k=f*Math.cos(d*Math.PI/180),l=a.Rd*Math.sin(d*Math.PI/180),m=b.Ma();if(3===m.length)m[0].centerX=f,m[0].centerY=0,m[1].centerX=m[0].centerX-m[0].width/2-m[1].width/2-g,m[1].y=m[0].y,m[2].centerX=(m[0].centerX+m[1].centerX)/2,m[2].y=m[0].y-m[2].height-g;else if(4===m.length)m[0].centerX=f,m[0].centerY=0,m[2].centerX=-m[0].centerX,m[2].centerY=m[0].centerY,m[1].centerX=0,m[1].y=Math.min(m[0].y,m[2].y)-m[1].height-g,m[3].centerX=0,m[3].y=Math.max(m[0].y+
m[0].height+g,m[2].y+m[2].height+g);else{f=G.alloc();for(var n=0;n<m.length;n++){m[n].centerX=k;m[n].centerY=l;if(n>=m.length-1)break;fr(a,k,l,m,n,e,f)||gr(a,k,l,m,n,e,f);k=f.x;l=f.y}G.free(f);a.qj++;if(!(23<a.qj)){k=m[0].centerX;l=m[0].centerY;f=m[m.length-1].centerX;n=m[m.length-1].centerY;var p=Math.abs(k-f)-((m[0].width+m[m.length-1].width)/2+g),q=Math.abs(l-n)-((m[0].height+m[m.length-1].height)/2+g);g=0;1>Math.abs(q)?Math.abs(k-f)<(m[0].width+m[m.length-1].width)/2&&(g=0):g=0<q?q:1>Math.abs(p)?
0:p;k=Math.abs(f)>Math.abs(n)?0<f!==l>n:0<n!==k<f;if(k=e===Gq?k:!k)g=-Math.abs(g),g=Math.min(g,-m[m.length-1].width),g=Math.min(g,-m[m.length-1].height);a.As.compare(g,m);1<Math.abs(g)&&(a.Xb=8>a.qj?a.Xb-g/(2*Math.PI):5>m.length&&10<g?a.Xb/2:a.Xb-(0<g?1.7:-2.3),a.Rd=a.Xb*h,er(a,b,c,d,e))}}}
function dr(a,b,c,d,e){for(var f=a.Xb,g=a.Rd,h=a.tn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=G.alloc(),n=b.Ma(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;fr(a,k,l,n,p,e,m)||gr(a,k,l,n,p,e,m);k=m.x;l=m.y}G.free(m);a.qj++;if(!(23<a.qj)){k=Math.atan2(l,k);k=e===Gq?a.It-k:k-a.It;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.As;if(Math.abs(f)<Math.abs(g.Vl))for(g.Vl=f,g.mk=[],g.um=[],k=0;k<n.length;k++)g.mk[k]=n[k].bounds.x,g.um[k]=n[k].bounds.y;
1<Math.abs(f)&&(a.Xb=8>a.qj?a.Xb-f/(2*Math.PI):a.Xb-(0<f?1.7:-2.3),a.Rd=a.Xb*h,dr(a,b,c,d,e))}}function fr(a,b,c,d,e,f,g){var h=a.Xb,k=a.Rd,l=0;a=(d[e].width+d[e+1].width)/2+a.Xi;var m=!1;if(0<=c!==(f===Gq)){if(f=b+a,f>h){f=b-a;if(f<-h)return g.x=f,g.y=l,!1;m=!0}}else if(f=b-a,f<-h){f=b+a;if(f>h)return g.x=f,g.y=l,!1;m=!0}l=Math.sqrt(1-Math.min(1,f*f/(h*h)))*k;0>c!==m&&(l=-l);if(Math.abs(c-l)>(d[e].height+d[e+1].height)/2)return g.x=f,g.y=l,!1;g.x=f;g.y=l;return!0}
function gr(a,b,c,d,e,f,g){var h=a.Xb,k=a.Rd,l=0;a=(d[e].height+d[e+1].height)/2+a.Xi;d=!1;if(0<=b!==(f===Gq)){if(f=c-a,f<-k){f=c+a;if(f>k){g.x=l;g.y=f;return}d=!0}}else if(f=c+a,f>k){f=c-a;if(f<-k){g.x=l;g.y=f;return}d=!0}l=Math.sqrt(1-Math.min(1,f*f/(k*k)))*h;0>b!==d&&(l=-l);g.x=l;g.y=f}Dq.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()};
Dq.prototype.commitNodes=function(){var a=null!==this.group&&null!==this.group.placeholder&&this.group.isSubGraphExpanded,b=a?this.group.location.copy():null,c=this.actualCenter;a?c=new G(0,0):(c.x=this.arrangementOrigin.x+this.Xb,c.y=this.arrangementOrigin.y+this.Rd);for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.x+=c.x;e.y+=c.y;e.commit()}a&&(this.group.ac(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.Wd(c.Wd(a)),this.group.move(b),this.cw=b.Wd(a))};
Dq.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function Yq(a,b,c,d,e){var f=a.Sx;if(.001>Math.abs(a.tn-1))return void 0!==d&&void 0!==e?e*b:2*Math.PI*b;a=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c;var g=0;var h=void 0!==d&&void 0!==e?e/(f+1):Math.PI/(2*(f+1));for(var k=0,l=0;l<=f;l++){void 0!==d&&void 0!==e?k=d+l*e/f:k=l*Math.PI/(2*f);var m=Math.sin(k);g+=Math.sqrt(1-a*a*m*m)*h}return void 0!==d&&void 0!==e?(b>c?b:c)*g:4*(b>c?b:c)*g}
function Xq(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?Yq(a,1,c,d,e):Yq(a,1,c))}function Zq(a,b,c,d,e){if(.001>Math.abs(a.tn-1))return e/b;var f=b>c?Math.sqrt(b*b-c*c)/b:Math.sqrt(c*c-b*b)/c,g=0;a=2*Math.PI/(700*a.network.vertexes.count);b>c&&(d+=Math.PI/2);for(var h=0;;h++){var k=Math.sin(d+h*a);g+=(b>c?b:c)*Math.sqrt(1-f*f*k*k)*a;if(g>=e)return h*a}}
Dq.prototype.sort=function(a){switch(this.sorting){case Lq:break;case Mq:a.reverse();break;case Jq:a.sort(this.comparer);break;case Kq:a.sort(this.comparer);a.reverse();break;case Hq:for(var b=[],c=0;c<a.length;c++)b.push(0);c=new E;for(var d=0;d<a.length;d++){var e=-1,f=-1;if(0===d)for(var g=0;g<a.length;g++){var h=a.N(g).edgesCount;h>e&&(e=h,f=g)}else for(g=0;g<a.length;g++)h=b[g],h>e&&(e=h,f=g);c.add(a.N(f));b[f]=-1;f=a.N(f);for(g=f.sourceEdges;g.next();)e=a.indexOf(g.value.fromVertex),0>e||0<=
b[e]&&b[e]++;for(f=f.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),0>e||0<=b[e]&&b[e]++}a=[];for(b=0;b<c.length;b++){e=c.N(b);a[b]=[];for(f=e.destinationEdges;f.next();)d=c.indexOf(f.value.toVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d);for(e=e.sourceEdges;e.next();)d=c.indexOf(e.value.fromVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d)}f=[];for(b=0;b<a.length;b++)f[b]=0;b=[];g=[];h=[];e=[];d=new E;for(var k=0,l=0;l<a.length;l++){var m=a[l].length;if(1===m)e.push(l);else if(0===m)d.add(c.N(l));
else{if(0===k)b.push(l);else{for(var n=m=Infinity,p=-1,q=[],r=0;r<b.length;r++)0>a[b[r]].indexOf(b[r===b.length-1?0:r+1])&&q.push(r===b.length-1?0:r+1);if(0===q.length)for(r=0;r<b.length;r++)q.push(r);for(r=0;r<q.length;r++){for(var u=q[r],v=a[l],x=0,y=0;y<g.length;y++){var z=f[g[y]],B=f[h[y]];if(z<B){var C=z;z=B}else C=B;if(C<u&&u<=z)for(B=0;B<v.length;B++){var I=v[B];0>b.indexOf(I)||C<f[I]&&f[I]<z||C===f[I]||z===f[I]||x++}else for(B=0;B<v.length;B++)I=v[B],0>b.indexOf(I)||C<f[I]&&f[I]<z&&C!==f[I]&&
z!==f[I]&&x++}v=x;for(y=x=0;y<a[l].length;y++)C=b.indexOf(a[l][y]),0<=C&&(C=Math.abs(u-(C>=u?C+1:C)),x+=C<b.length+1-C?C:b.length+1-C);for(y=0;y<g.length;y++)C=f[g[y]],z=f[h[y]],C>=u&&C++,z>=u&&z++,C>z&&(B=z,z=C,C=B),z-C<(b.length+2)/2===(C<u&&u<=z)&&x++;if(v<m||v===m&&x<n)m=v,n=x,p=u}b.splice(p,0,l);for(m=0;m<b.length;m++)f[b[m]]=m;for(m=0;m<a[l].length;m++)n=a[l][m],0<=b.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=b.length;;){f=!0;for(h=0;h<e.length;h++)if(k=e[h],l=a[k][0],m=b.indexOf(l),0<=m){for(p=
n=0;p<a[l].length;p++)q=b.indexOf(a[l][p]),0>q||q===m||(r=q>m?q-m:m-q,n+=q<m!==r>g-r?1:-1);b.splice(0>n?m:m+1,0,k);e.splice(h,1);h--}else f=!1;if(f)break;else b.push(e[0]),e.splice(0,1)}for(a=0;a<b.length;a++)d.add(c.N(b[a]));return d;default:A("Invalid sorting type.")}return a};
pa.Object.defineProperties(Dq.prototype,{radius:{get:function(){return this.Mo},set:function(a){this.Mo!==a&&(0<a||isNaN(a))&&(this.Mo=a,this.B())}},aspectRatio:{get:function(){return this.Mm},set:function(a){this.Mm!==a&&0<a&&(this.Mm=a,this.B())}},startAngle:{get:function(){return this.np},set:function(a){this.np!==a&&(this.np=a,this.B())}},sweepAngle:{get:function(){return this.Dl},
set:function(a){this.Dl!==a&&(0<a&&360>=a?this.Dl=a:this.Dl=360,this.B())}},arrangement:{get:function(){return this.Bb},set:function(a){this.Bb===a||a!==Tq&&a!==Eq&&a!==Sq&&a!==Qq||(this.Bb=a,this.B())}},direction:{get:function(){return this.L},set:function(a){this.L===a||a!==Gq&&a!==Pq&&a!==Nq&&a!==Oq||(this.L=a,this.B())}},sorting:{get:function(){return this.Rc},set:function(a){this.Rc===a||a!==Lq&&a!==Mq&&
a!==Jq&&!Kq&&a!==Hq||(this.Rc=a,this.B())}},comparer:{get:function(){return this.Mc},set:function(a){this.Mc!==a&&(this.Mc=a,this.B())}},spacing:{get:function(){return this.Ye},set:function(a){this.Ye!==a&&(this.Ye=a,this.B())}},nodeDiameterFormula:{get:function(){return this.vo},set:function(a){this.vo===a||a!==Iq&&a!==Uq||(this.vo=a,this.B())}},actualXRadius:{get:function(){return this.Xb}},
actualYRadius:{get:function(){return this.Rd}},actualSpacing:{get:function(){return this.Xi}},actualCenter:{get:function(){return this.cw}}});
var Eq=new D(Dq,"ConstantSpacing",0),Sq=new D(Dq,"ConstantDistance",1),Qq=new D(Dq,"ConstantAngle",2),Tq=new D(Dq,"Packed",3),Gq=new D(Dq,"Clockwise",4),Pq=new D(Dq,"Counterclockwise",5),Nq=new D(Dq,"BidirectionalLeft",6),Oq=new D(Dq,"BidirectionalRight",7),Lq=new D(Dq,"Forwards",8),Mq=new D(Dq,"Reverse",9),Jq=new D(Dq,"Ascending",10),Kq=new D(Dq,"Descending",11),Hq=new D(Dq,"Optimized",12),Iq=new D(Dq,"Pythagorean",13),Uq=new D(Dq,"Circular",14);Dq.className="CircularLayout";Dq.ConstantSpacing=Eq;
Dq.ConstantDistance=Sq;Dq.ConstantAngle=Qq;Dq.Packed=Tq;Dq.Clockwise=Gq;Dq.Counterclockwise=Pq;Dq.BidirectionalLeft=Nq;Dq.BidirectionalRight=Oq;Dq.Forwards=Lq;Dq.Reverse=Mq;Dq.Ascending=Jq;Dq.Descending=Kq;Dq.Optimized=Hq;Dq.Pythagorean=Iq;Dq.Circular=Uq;function Fq(){this.Vl=-Infinity;this.um=this.mk=null}
Fq.prototype.compare=function(a,b){if(0<a&&0>this.Vl||Math.abs(a)<Math.abs(this.Vl)&&!(0>a&&0<this.Vl))for(this.Vl=a,this.mk=[],this.um=[],a=0;a<b.length;a++)this.mk[a]=b[a].bounds.x,this.um[a]=b[a].bounds.y};Fq.prototype.commit=function(a){if(null!==this.mk&&null!==this.um)for(var b=0;b<this.mk.length;b++){var c=a.N(b);c.x=this.mk[b];c.y=this.um[b]}};Fq.className="VertexArrangement";function Vq(a){tp.call(this,a)}oa(Vq,tp);Vq.prototype.createVertex=function(){return new hr(this)};
Vq.prototype.createEdge=function(){return new ir(this)};Vq.className="CircularNetwork";function hr(a){wp.call(this,a);this.K=this.Wi=NaN}oa(hr,wp);
function Wq(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Tq)if(c.nodeDiameterFormula===Uq)a.Wi=Math.max(a.width,a.height);else{c=Math.abs(Math.sin(b));b=Math.abs(Math.cos(b));if(0===c)return a.width;if(0===b)return a.height;a.Wi=Math.min(a.height/c,a.width/b)}else a.Wi=c.nodeDiameterFormula===Uq?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.Wi}
pa.Object.defineProperties(hr.prototype,{diameter:{get:function(){return this.Wi},set:function(a){this.Wi!==a&&(this.Wi=a)}},actualAngle:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}}});hr.className="CircularVertex";function ir(a){xp.call(this,a)}oa(ir,xp);ir.className="CircularEdge";
function jr(){ui.call(this);this.hh=null;this.Un=0;this.xd=(new L(100,100)).freeze();this.Lm=!1;this.Xe=!0;this.Zc=!1;this.hl=100;this.wn=1;this.Hf=1E3;this.po=10;this.No=Math;this.Hk=.05;this.Gk=50;this.Ek=150;this.Fk=0;this.jn=10;this.hn=5}oa(jr,ui);
jr.prototype.cloneProtected=function(a){ui.prototype.cloneProtected.call(this,a);a.xd.assign(this.xd);a.Lm=this.Lm;a.Xe=this.Xe;a.Zc=this.Zc;a.hl=this.hl;a.wn=this.wn;a.Hf=this.Hf;a.po=this.po;a.No=this.No;a.Hk=this.Hk;a.Gk=this.Gk;a.Ek=this.Ek;a.Fk=this.Fk;a.jn=this.jn;a.hn=this.hn};jr.prototype.createNetwork=function(){return new kr(this)};
jr.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));a=this.maxIterations;if(0<this.network.vertexes.count){this.network.Kp();for(var b=this.network.vertexes.iterator;b.next();){var c=b.value;c.charge=this.electricalCharge(c);c.mass=this.gravitationalMass(c)}for(b=this.network.edges.iterator;b.next();)c=b.value,c.stiffness=this.springStiffness(c),c.length=this.springLength(c);this.Cu();this.Un=0;if(this.needsClusterLayout()){b=this.network;for(c=b.Ix().iterator;c.next();){this.network=
c.value;for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.vd=e.vertexes.count;e.uh=1;e.Lj=null;e.Ge=null}lr(this,0,a)}this.network=b;c.reset();d=this.arrangementSpacing;for(var f=c.count,g=!0,h=e=0,k=Ka(),l=0;l<f+b.vertexes.count+2;l++)k[l]=null;f=0;c.reset();for(var m=N.alloc();c.next();)if(l=c.value,this.computeBounds(l,m),g)g=!1,e=m.x+m.width/2,h=m.y+m.height/2,k[0]=new G(m.x+m.width+d.width,m.y),k[1]=new G(m.x,m.y+m.height+d.height),f=2;else{var n=mr(k,f,e,h,m.width,m.height,
d),p=k[n],q=new G(p.x+m.width+d.width,p.y),r=new G(p.x,p.y+m.height+d.height);n+1<f&&k.splice(n+1,0,null);k[n]=q;k[n+1]=r;f++;n=p.x-m.x;p=p.y-m.y;for(l=l.vertexes.iterator;l.next();)q=l.value,q.centerX+=n,q.centerY+=p}N.free(m);for(l=b.vertexes.iterator;l.next();)g=l.value,q=g.bounds,2>f?(e=q.x+q.width/2,h=q.y+q.height/2,k[0]=new G(q.x+q.width+d.width,q.y),k[1]=new G(q.x,q.y+q.height+d.height),f=2):(m=mr(k,f,e,h,q.width,q.height,d),p=k[m],n=new G(p.x+q.width+d.width,p.y),q=new G(p.x,p.y+q.height+
d.height),m+1<f&&k.splice(m+1,0,null),k[m]=n,k[m+1]=q,f++,g.centerX=p.x+g.width/2,g.centerY=p.y+g.height/2);Oa(k);for(c.reset();c.next();){d=c.value;for(e=d.vertexes.iterator;e.next();)b.kh(e.value);for(d=d.edges.iterator;d.next();)b.Fj(d.value)}}nr(this,a);this.updateParts()}this.hl=a;this.network=null;this.isValidLayout=!0};
jr.prototype.needsClusterLayout=function(){if(3>this.network.vertexes.count)return!1;for(var a=0,b=0,c=this.network.vertexes.first().bounds,d=this.network.vertexes.iterator;d.next();){if(d.value.bounds.Jc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};jr.prototype.computeBounds=function(a,b){var c=!0;for(a=a.vertexes.iterator;a.next();){var d=a.value;c?(c=!1,b.set(d.bounds)):b.Wc(d.bounds)}return b};
function lr(a,b,c){if(or(a,b)){var d=a.Hf;a.Hf*=1+1/(b+1);var e=pr(a,b),f=Math.max(0,Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10));a.maxIterations+=f;lr(a,b+1,c);nr(a,f);qr(a,e);b=e.vertexes.Ma();b.sort(function(a,b){return null===a||null===b||a===b?0:b.vd-a.vd});for(c=0;c<b.length;c++)rr(a,b[c]);a.Hf=d}}
function or(a,b){if(10<b||3>a.network.vertexes.count)return!1;a.hh=a.network.vertexes.Ma();a=a.hh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.vd-a.vd});for(b=a.length-1;0<=b&&1>=a[b].vd;)b--;return 1<a.length-b}
function pr(a,b){for(var c=a.network,d=new kr(a),e=0;e<a.hh.length;e++){var f=a.hh[e];if(1<f.vd){d.kh(f);var g=new sr;g.xt=f.vd;g.yt=f.width;g.wt=f.height;g.Wv=f.focus.x;g.Xv=f.focus.y;null===f.Ge&&(f.Ge=new E);f.Ge.add(g);f.yv=f.Ge.count-1}else break}for(f=c.edges.iterator;f.next();){var h=f.value;e=h.fromVertex;g=h.toVertex;e.network===d&&g.network===d?d.Fj(h):e.network===d?(h=e.Lj,null===h&&(h=new E,e.Lj=h),h.add(g),e.vd--,e.uh+=g.uh):g.network===d&&(h=g.Lj,null===h&&(h=new E,g.Lj=h),h.add(e),
g.vd--,g.uh+=e.uh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,H.sqrt((f.fromVertex.uh+f.toVertex.uh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.Lj;if(null!==k&&0<k.count&&(g=e.Ge.N(e.Ge.count-1).xt-e.vd,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.N(m),p=null;for(f=n.edges.iterator;f.next();){var q=f.value;if(q.jx(n)===e){p=q;break}}null!==p&&(l+=p.length,h+=n.width*n.height)}f=e.centerX;k=e.centerY;m=e.width;n=e.height;p=e.focus;q=m*n;1>q&&
(q=1);h=H.sqrt((h+q+l*l*4/(g*g))/q);g=(h-1)*m/2;h=(h-1)*n/2;e.bounds=new N(f-p.x-g,k-p.y-h,m+2*g,n+2*h);e.focus=new G(p.x+g,p.y+h)}}a.network=d;return c}function qr(a,b){for(var c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Ge){var e=d.Ge.N(d.yv);d.vd=e.xt;var f=e.Wv,g=e.Xv;d.bounds=new N(d.centerX-f,d.centerY-g,e.yt,e.wt);d.focus=new G(f,g);d.yv--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b}
function rr(a,b){var c=b.Lj;if(null!==c&&0!==c.count){var d=b.centerX,e=b.centerY,f=b.width,g=b.height;null!==b.Ge&&0<b.Ge.count&&(g=b.Ge.N(0),f=g.yt,g=g.wt);f=H.sqrt(f*f+g*g)/2;for(var h=!1,k=g=0,l=0,m=b.vertexes.iterator;m.next();){var n=m.value;1>=n.vd?k++:(h=!0,l++,g+=Math.atan2(b.centerY-n.centerY,b.centerX-n.centerX))}if(0!==k)for(0<l&&(g/=l),l=b=0,b=h?2*Math.PI/(k+1):2*Math.PI/k,0===k%2&&(l=b/2),1<c.count&&c.sort(function(a,b){return null===a||null===b||a===b?0:b.width*b.height-a.width*a.height}),
h=0===k%2?0:1,c=c.iterator;c.next();)if(k=c.value,!(1<k.vd||a.isFixed(k))){m=null;for(n=k.edges.iterator;n.next();){m=n.value;break}n=k.width;var p=k.height;n=H.sqrt(n*n+p*p)/2;m=f+m.length+n;n=g+(b*(h/2>>1)+l)*(0===h%2?1:-1);k.centerX=d+m*Math.cos(n);k.centerY=e+m*Math.sin(n);h++}}}
function mr(a,b,c,d,e,f,g){var h=9E19,k=-1,l=0;a:for(;l<b;l++){var m=a[l],n=m.x-c,p=m.y-d;n=n*n+p*p;if(n<h){for(p=l-1;0<=p;p--)if(a[p].y>m.y&&a[p].x-m.x<e+g.width)continue a;for(p=l+1;p<b;p++)if(a[p].x>m.x&&a[p].y-m.y<f+g.height)continue a;k=l;h=n}}return k}jr.prototype.Cu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
jr.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.Pu();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.Bi(c);null===d&&(d=this.network.Kl(c));d.charge=this.defaultCommentElectricalCharge;c=null;for(var e=d.destinationEdges;e.next();){var f=e.value;if(f.toVertex===a){c=f;break}}if(null===c)for(e=d.sourceEdges;e.next();)if(f=e.value,f.fromVertex===a){c=f;break}null===c&&(c=this.network.Zj(a,d,null));c.length=this.defaultCommentSpringLength}}};
function tr(a,b){var c=a.bounds,d=c.x;a=c.y;var e=c.width;c=c.height;var f=b.bounds,g=f.x;b=f.y;var h=f.width;f=f.height;return d+e<g?a>b+f?(c=d+e-g,a=a-b-f,H.sqrt(c*c+a*a)):a+c<b?(d=d+e-g,a=a+c-b,H.sqrt(d*d+a*a)):g-(d+e):d>g+h?a>b+f?(c=d-g-h,a=a-b-f,H.sqrt(c*c+a*a)):a+c<b?(d=d-g-h,a=a+c-b,H.sqrt(d*d+a*a)):d-(g+h):a>b+f?a-(b+f):a+c<b?b-(a+c):.1}function nr(a,b){a.hh=null;for(b=a.Un+b;a.Un<b&&(a.Un++,ur(a)););a.hh=null}
function ur(a){null===a.hh&&(a.hh=a.network.vertexes.Ma());var b=a.hh;if(0>=b.length)return!1;var c=b[0];c.forceX=0;c.forceY=0;for(var d=c.centerX,e=d,f=c=c.centerY,g=1;g<b.length;g++){var h=b[g];h.forceX=0;h.forceY=0;var k=h.centerX;h=h.centerY;d=Math.min(d,k);e=Math.max(e,k);c=Math.min(c,h);f=Math.max(f,h)}(e=e-d>f-c)?b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerX-b.centerX}):b.sort(function(a,b){return null===a||null===b||a===b?0:a.centerY-b.centerY});c=a.Hf;var l=d=h=0;for(f=
0;f<b.length;f++){g=b[f];d=g.bounds;h=g.focus;k=d.x+h.x;var m=d.y+h.y;d=g.charge*a.electricalFieldX(k,m);l=g.charge*a.electricalFieldY(k,m);d+=g.mass*a.gravitationalFieldX(k,m);l+=g.mass*a.gravitationalFieldY(k,m);g.forceX+=d;g.forceY+=l;for(var n=f+1;n<b.length;n++){var p=b[n];if(p!==g){d=p.bounds;h=p.focus;l=d.x+h.x;var q=d.y+h.y;if(k-l>c||l-k>c){if(e)break}else if(m-q>c||q-m>c){if(!e)break}else{var r=tr(g,p);1>r?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new vr),r=d.random(),
h=d.random(),k>l?(d=Math.abs(p.bounds.right-g.bounds.x),d=(1+d)*r):k<l?(d=Math.abs(p.bounds.x-g.bounds.right),d=-(1+d)*r):(d=Math.max(p.width,g.width),d=(1+d)*r-d/2),m>q?(l=Math.abs(p.bounds.bottom-g.bounds.y),l=(1+l)*h):k<l?(l=Math.abs(p.bounds.y-g.bounds.bottom),l=-(1+l)*h):(l=Math.max(p.height,g.height),l=(1+l)*h-l/2)):(h=-(g.charge*p.charge)/(r*r),d=(l-k)/r*h,l=(q-m)/r*h);g.forceX+=d;g.forceY+=l;p.forceX-=d;p.forceY-=l}}}}for(e=a.network.edges.iterator;e.next();)h=e.value,c=h.fromVertex,f=h.toVertex,
g=c.bounds,k=c.focus,d=g.x+k.x,g=g.y+k.y,m=f.bounds,n=f.focus,k=m.x+n.x,m=m.y+n.y,n=tr(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new vr),h=n.random(),n=n.random(),d=(d>k?1:-1)*(1+(f.width>c.width?f.width:c.width))*h,l=(g>m?1:-1)*(1+(f.height>c.height?f.height:c.height))*n):(h=h.stiffness*(n-h.length),d=(k-d)/n*h,l=(m-g)/n*h),c.forceX+=d,c.forceY+=l,f.forceX-=d,f.forceY-=l;d=0;e=a.moveLimit;for(c=0;c<b.length;c++)f=b[c],a.isFixed(f)?a.moveFixedVertex(f):(g=f.forceX,k=
f.forceY,g<-e?g=-e:g>e&&(g=e),k<-e?k=-e:k>e&&(k=e),f.centerX+=g,f.centerY+=k,d=Math.max(d,g*g+k*k));return d>a.epsilonDistance*a.epsilonDistance}jr.prototype.moveFixedVertex=function(){};jr.prototype.commitLayout=function(){this.Dv();this.commitNodes();this.isRouting&&this.commitLinks()};jr.prototype.Dv=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=Hd,b.toSpot=Hd)}};
jr.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=N.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;N.free(c)}c=N.alloc();for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;if(0!==a||0!==b)c.assign(e.bounds),c.x+=a,c.y+=b,e.bounds=c;e.commit()}N.free(c)};jr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
jr.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.Hk:a};jr.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.Gk:a};jr.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.Ek:a};jr.prototype.electricalFieldX=function(){return 0};jr.prototype.electricalFieldY=function(){return 0};jr.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.Fk:a};jr.prototype.gravitationalFieldX=function(){return 0};
jr.prototype.gravitationalFieldY=function(){return 0};jr.prototype.isFixed=function(a){return a.isFixed};
pa.Object.defineProperties(jr.prototype,{currentIteration:{get:function(){return this.Un}},arrangementSpacing:{get:function(){return this.xd},set:function(a){this.xd.A(a)||(this.xd.assign(a),this.B())}},arrangesToOrigin:{get:function(){return this.Lm},set:function(a){this.Lm!==a&&(this.Lm=a,this.B())}},setsPortSpots:{get:function(){return this.Xe},set:function(a){this.Xe!==a&&(this.Xe=
a,this.B())}},comments:{get:function(){return this.Zc},set:function(a){this.Zc!==a&&(this.Zc=a,this.B())}},maxIterations:{get:function(){return this.hl},set:function(a){this.hl!==a&&0<=a&&(this.hl=a,this.B())}},epsilonDistance:{get:function(){return this.wn},set:function(a){this.wn!==a&&0<a&&(this.wn=a,this.B())}},infinityDistance:{get:function(){return this.Hf},set:function(a){this.Hf!==
a&&1<a&&(this.Hf=a,this.B())}},moveLimit:{get:function(){return this.po},set:function(a){this.po!==a&&1<a&&(this.po=a,this.B())}},randomNumberGenerator:{get:function(){return this.No},set:function(a){this.No!==a&&(null!==a&&"function"!==typeof a.random&&A('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.No=a)}},defaultSpringStiffness:{get:function(){return this.Hk},
set:function(a){this.Hk!==a&&(this.Hk=a,this.B())}},defaultSpringLength:{get:function(){return this.Gk},set:function(a){this.Gk!==a&&(this.Gk=a,this.B())}},defaultElectricalCharge:{get:function(){return this.Ek},set:function(a){this.Ek!==a&&(this.Ek=a,this.B())}},defaultGravitationalMass:{get:function(){return this.Fk},set:function(a){this.Fk!==a&&(this.Fk=a,this.B())}},defaultCommentSpringLength:{
get:function(){return this.jn},set:function(a){this.jn!==a&&(this.jn=a,this.B())}},defaultCommentElectricalCharge:{get:function(){return this.hn},set:function(a){this.hn!==a&&(this.hn=a,this.B())}}});jr.className="ForceDirectedLayout";function sr(){this.Xv=this.Wv=this.wt=this.yt=this.xt=0}sr.className="ForceDirectedSubnet";function kr(a){tp.call(this,a)}oa(kr,tp);kr.prototype.createVertex=function(){return new wr(this)};kr.prototype.createEdge=function(){return new xr(this)};
kr.className="ForceDirectedNetwork";function wr(a){wp.call(this,a);this.Wa=!1;this.Tb=this.K=NaN;this.uh=this.vd=this.La=this.da=0;this.Ge=this.Lj=null;this.yv=0}oa(wr,wp);
pa.Object.defineProperties(wr.prototype,{isFixed:{get:function(){return this.Wa},set:function(a){this.Wa!==a&&(this.Wa=a)}},charge:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}},mass:{get:function(){return this.Tb},set:function(a){this.Tb!==a&&(this.Tb=a)}},forceX:{get:function(){return this.da},set:function(a){this.da!==a&&(this.da=a)}},forceY:{
get:function(){return this.La},set:function(a){this.La!==a&&(this.La=a)}}});wr.className="ForceDirectedVertex";function xr(a){xp.call(this,a);this.l=this.u=NaN}oa(xr,xp);pa.Object.defineProperties(xr.prototype,{stiffness:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},length:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}}});xr.className="ForceDirectedEdge";
function vr(){var a=0;void 0===a&&(a=42);this.seed=a;this.Kx=48271;this.Mx=2147483647;this.Q=44488.07041494893;this.Ox=3399;this.Lx=1/2147483647;this.random()}vr.prototype.random=function(){var a=this.seed%this.Q*this.Kx-this.seed/this.Q*this.Ox;0<a?this.seed=a:this.seed=a+this.Mx;return this.seed*this.Lx};vr.className="RandomNumberGenerator";
function yr(){ui.call(this);this.Wb=this.ie=25;this.L=0;this.Ck=zr;this.cl=Ar;this.Tk=Br;this.hj=4;this.pk=Cr;this.Xf=7;this.Xe=!0;this.Zn=4;this.Ga=this.Ir=this.ya=-1;this.qd=this.ko=0;this.Ja=this.nd=this.od=this.Gd=this.hc=null;this.ro=0;this.qo=this.mj=null;this.Ld=0;this.so=null;this.ew=new G;this.me=[];this.me.length=100}oa(yr,ui);
yr.prototype.cloneProtected=function(a){ui.prototype.cloneProtected.call(this,a);a.ie=this.ie;a.Wb=this.Wb;a.L=this.L;a.Ck=this.Ck;a.cl=this.cl;a.Tk=this.Tk;a.hj=this.hj;a.pk=this.pk;a.Xf=this.Xf;a.Xe=this.Xe;a.Zn=this.Zn};
yr.prototype.hb=function(a){a.classType===yr?0===a.name.indexOf("Aggressive")?this.aggressiveOption=a:0===a.name.indexOf("Cycle")?this.cycleRemoveOption=a:0===a.name.indexOf("Init")?this.initializeOption=a:0===a.name.indexOf("Layer")?this.layeringOption=a:A("Unknown enum value: "+a):ui.prototype.hb.call(this,a)};yr.prototype.createNetwork=function(){return new Dr(this)};
yr.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.Ir=-1;this.qd=this.ko=0;this.so=this.qo=this.mj=null;for(a=0;a<this.me.length;a++)this.me[a]=null;if(0<this.network.vertexes.count){this.network.Kp();this.cycleRemoveOption!==Er&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer=-1;this.ya=-1;this.assignLayers();for(a.reset();a.next();)this.ya=Math.max(this.ya,
a.value.layer);this.cycleRemoveOption===Er&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!d.valid&&(null!==e.node&&null!==f.node||e.layer!==f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode;k=h.toNode;var p=h.fromPort;h=h.toPort;if(d.rev){l=n;var q=p;n=k;p=h;k=l;h=q}var r=
e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;q=G.alloc();m!==n?u.s()&&n.isVisible()&&n.actualBounds.s()?(n.qh(p,gd,q),q.x+=n.actualBounds.x-u.x,q.y+=n.actualBounds.y-u.y):q.assign(r):u.s()?(n.qh(p,gd,q),q.s()||q.assign(r)):q.assign(r);n=d.rev?e.bounds:f.bounds;m=G.alloc();g!==k?n.s()&&k.isVisible()&&k.actualBounds.s()?(k.qh(h,gd,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):m.assign(l):n.s()?(k.qh(h,gd,m),m.s()||m.assign(l)):m.assign(l);90===this.L||270===this.L?(g=Math.round((q.x-r.x)/
this.Wb),k=q.x,h=Math.round((m.x-l.x)/this.Wb),l=m.x):(g=Math.round((q.y-r.y)/this.Wb),k=q.y,h=Math.round((m.y-l.y)/this.Wb),l=m.y);G.free(q);G.free(m);d.portFromColOffset=g;d.portFromPos=k;d.portToColOffset=h;d.portToPos=l}else d.portFromColOffset=0,d.portFromPos=0,d.portToColOffset=0,d.portToPos=0;q=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var v=u.fromPort,x=u.toPort;if(null!==v&&null!==x){var y=u.fromNode;p=u.toNode;if(null!==y&&null!==p){var z=Fr(this,!0),B=Fr(this,!1),C=this.setsPortSpots?
z:u.computeSpot(!0,v);r=this.setsPortSpots?B:u.computeSpot(!1,x);var I=u.isOrthogonal;C.nf()&&C.mf(B)&&r.nf()&&r.mf(z)?n=0:(z=u.getLinkPoint(y,v,C,!0,I,p,x,G.alloc()),B=u.getLinkDirection(y,v,z,C,!0,I,p,x),G.free(z),C.at()||B!==Gr(this,d,!0)?this.setsPortSpots&&null!==y&&1===y.ports.count&&d.rev&&(n+=1):n+=1,C=u.getLinkPoint(p,x,r,!1,I,y,v,G.alloc()),u=u.getLinkDirection(p,x,C,r,!1,I,y,v),G.free(C),r.at()||u!==Gr(this,d,!1)?this.setsPortSpots&&null!==p&&1===p.ports.count&&d.rev&&(n+=2):n+=2)}}}p=
n;n=1===p||3===p?!0:!1;if(p=2===p||3===p?!0:!1)r=a.createVertex(),r.node=null,r.Gj=1,r.layer=q,r.near=e,a.kh(r),e=a.Zj(e,r,d.link),e.valid=!1,e.rev=d.rev,e.portFromColOffset=g,e.portToColOffset=0,e.portFromPos=k,e.portToPos=0,e=r;u=1;n&&u--;if(q-m>u&&0<q){d.valid=!1;r=a.createVertex();r.node=null;r.Gj=2;r.layer=q-1;a.kh(r);e=a.Zj(e,r,d.link);e.valid=!0;e.rev=d.rev;e.portFromColOffset=p?0:g;e.portToColOffset=0;e.portFromPos=p?0:k;e.portToPos=0;e=r;for(q--;q-m>u&&0<q;)r=a.createVertex(),r.node=null,
r.Gj=3,r.layer=q-1,a.kh(r),e=a.Zj(e,r,d.link),e.valid=!0,e.rev=d.rev,e.portFromColOffset=0,e.portToColOffset=0,e.portFromPos=0,e.portToPos=0,e=r,q--;e=a.Zj(r,f,d.link);e.valid=!n;n&&(r.near=f);e.rev=d.rev;e.portFromColOffset=0;e.portToColOffset=h;e.portFromPos=0;e.portToPos=l}else d.valid=!0}}a=this.hc=[];for(b=0;b<=this.ya;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index=-1;this.initializeIndices();this.Ir=-1;for(c=this.qd=this.ko=0;c<=this.ya;c++)a[c]>a[this.qd]&&(this.Ir=
a[c]-1,this.qd=c),a[c]<a[this.ko]&&(this.ko=c);this.so=[];for(c=0;c<a.length;c++)this.so[c]=[];for(b.reset();b.next();)a=b.value,this.so[a.layer][a.index]=a;this.Ga=-1;for(a=0;a<=this.ya;a++){b=Hr(this,a);c=0;d=this.hc[a];for(f=0;f<d;f++)e=b[f],c+=this.nodeMinColumnSpace(e,!0),e.column=c,c+=1,c+=this.nodeMinColumnSpace(e,!1);this.Ga=Math.max(this.Ga,c-1);Ir(this,a,b)}this.reduceCrossings();this.straightenAndPack();this.updateParts()}this.network=null;this.isValidLayout=!0};
yr.prototype.linkMinLength=function(){return 1};function Jr(a){var b=a.fromVertex.node;a=a.toVertex.node;return null===b&&null===a?8:null===b||null===a?4:1}yr.prototype.nodeMinLayerSpace=function(a,b){return null===a.node?0:90===this.L||270===this.L?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};
yr.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node)return 0;var c=b?a.kv:a.jv;if(null!==c)return c;c=this.L;return 90===c||270===c?b?a.kv=a.focus.x/this.Wb+1|0:a.jv=(a.bounds.width-a.focus.x)/this.Wb+1|0:b?a.kv=a.focus.y/this.Wb+1|0:a.jv=(a.bounds.height-a.focus.y)/this.Wb+1|0};function Kr(a){null===a.mj&&(a.mj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.mj[b]=d.layer;b++;a.mj[b]=d.column;b++;a.mj[b]=d.index;b++}return a.mj}
function Lr(a,b){var c=0;for(a=a.network.vertexes.iterator;a.next();){var d=a.value;d.layer=b[c];c++;d.column=b[c];c++;d.index=b[c];c++}}
function Mr(a,b,c){var d=Hr(a,b),e=a.hc[b];if(null===a.qo||a.qo.length<e*e)a.qo=[];for(var f=a.qo,g=0;g<e;g++){var h=0,k=d[g],l=k.near;if(null!==l&&l.layer===k.layer)if(k=l.index,k>g)for(var m=g+1;m<k;m++){var n=d[m];n.near===l&&n.Gj===l.Gj||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.Gj===l.Gj||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var q=k[l];if(q.valid&&q.fromVertex.layer!==b)for(n=q.fromVertex.index,m=q.portToPos,q=q.portFromPos,p=l+1;p<k.length;p++){var r=
k[p];if(r.valid&&r.fromVertex.layer!==b){var u=r.fromVertex.index;var v=r.portToPos;r=r.portFromPos;m<v&&(n>u||n===u&&q>r)&&h++;v<m&&(u>n||u===n&&r>q)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(q=k[l],q.valid&&q.toVertex.layer!==b)for(n=q.toVertex.index,m=q.portToPos,q=q.portFromPos,p=l+1;p<k.length;p++)r=k[p],r.valid&&r.toVertex.layer!==b&&(u=r.toVertex.index,v=r.portToPos,r=r.portFromPos,q<r&&(n>u||n===u&&m>v)&&h++,r<q&&(u>n||u===n&&v>m)&&h++);f[g*e+g]=h;for(k=g+
1;k<e;k++){var x=0,y=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var z=d[k].sourceEdgesArrayAccess;for(l=0;l<h.length;l++)if(q=h[l],q.valid&&q.fromVertex.layer!==b)for(n=q.fromVertex.index,q=q.portFromPos,p=0;p<z.length;p++)r=z[p],r.valid&&r.fromVertex.layer!==b&&(u=r.fromVertex.index,r=r.portFromPos,(n<u||n===u&&q<r)&&y++,(u<n||u===n&&r<q)&&x++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,z=d[k].destinationEdgesArrayAccess,l=0;l<h.length;l++)if(q=h[l],q.valid&&q.toVertex.layer!==b)for(n=q.toVertex.index,
m=q.portToPos,p=0;p<z.length;p++)r=z[p],r.valid&&r.toVertex.layer!==b&&(u=r.toVertex.index,v=r.portToPos,(n<u||n===u&&m<v)&&y++,(u<n||u===n&&v<m)&&x++);f[g*e+k]=x;f[k*e+g]=y}}Ir(a,b,d);return f}yr.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.ya;b++)for(var c=Mr(this,b,1),d=this.hc[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a};
function Nr(a){for(var b=0,c=0;c<=a.ya;c++){for(var d=a,e=c,f=Hr(d,e),g=d.hc[e],h=0,k=0;k<g;k++){var l=f[k].destinationEdgesArrayAccess;if(null!==l)for(var m=0;m<l.length;m++){var n=l[m];if(n.valid&&n.toVertex.layer!==e){var p=n.fromVertex.column+n.portFromColOffset;var q=n.toVertex.column+n.portToColOffset;h+=(Math.abs(p-q)+1)*Jr(n)}}}Ir(d,e,f);b+=h}return b}
yr.prototype.normalize=function(){var a=Infinity;this.Ga=-1;for(var b=this.network.vertexes.iterator;b.next();){var c=b.value;a=Math.min(a,c.column-this.nodeMinColumnSpace(c,!0));this.Ga=Math.max(this.Ga,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ga-=a};
function Or(a,b,c){for(var d=Hr(a,b),e=a.hc[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=0,p=h.near;null!==p&&p.layer===h.layer&&(m+=p.column-1,n++);if(null!==k)for(p=0;p<k.length;p++){h=k[p];var q=h.fromVertex;h.valid&&!h.rev&&q.layer!==b&&(m+=q.column,n++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(m+=p.column,n++);f[g]=0===n?-1:m/n}Ir(a,b,d);return f}
function Pr(a,b,c){for(var d=Hr(a,b),e=a.hc[b],f=[],g=0;g<e;g++){var h=d[g],k=null;0>=c&&(k=h.sourceEdgesArrayAccess);var l=null;0<=c&&(l=h.destinationEdgesArrayAccess);var m=0,n=[],p=h.near;null!==p&&p.layer===h.layer&&(n[m]=p.column-1,m++);h=void 0;if(null!==k)for(p=0;p<k.length;p++){h=k[p];var q=h.fromVertex;h.valid&&!h.rev&&q.layer!==b&&(n[m]=q.column+h.portFromColOffset,m++)}if(null!==l)for(k=0;k<l.length;k++)h=l[k],p=h.toVertex,h.valid&&!h.rev&&p.layer!==b&&(n[m]=p.column+h.portToColOffset,
m++);0===m?f[g]=-1:(n.sort(function(a,b){return a-b}),l=m>>1,f[g]=0!==(m&1)?n[l]:n[l-1]+n[l]>>1)}Ir(a,b,d);return f}function Qr(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();){var h=g.value;var k=h.toVertex;var l=b.layer-k.layer;h=a.linkMinLength(h);l===h&&Qr(a,k,c,d,e,f)}if(f)for(g=b.sourceEdges;g.next();)h=g.value,k=h.fromVertex,l=k.layer-b.layer,h=a.linkMinLength(h),l===h&&Qr(a,k,c,d,e,f)}}
function Rr(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Rr(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Rr(a,b.value.fromVertex,c,d,e,f)}}
yr.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.Ck){default:case Sr:a=this.network;var b=0,c=a.vertexes.count-1,d=[];d.length=c+1;for(var e=a.vertexes.iterator;e.next();)e.value.valid=!0;for(;null!==Tr(a);){for(e=Ur(a);null!==e;)d[c]=e,c--,e.valid=!1,e=Ur(a);for(e=Vr(a);null!==e;)d[b]=e,b++,e.valid=!1,e=Vr(a);e=null;for(var f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value;if(h.valid){for(var k=0,l=h.destinationEdges;l.next();)l.value.toVertex.valid&&
k++;l=0;for(var m=h.sourceEdges;m.next();)m.value.fromVertex.valid&&l++;if(null===e||f<k-l)e=h,f=k-l}}null!==e&&(d[b]=e,b++,e.valid=!1)}for(b=0;b<a.vertexes.count;b++)d[b].index=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.index>b.toVertex.index&&(a.mm(b),b.rev=!0);break;case zr:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.Rl=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.ro=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&&
Wr(this,b);for(d.reset();d.next();)b=d.value,-1===b.Rl&&Wr(this,b);for(a.reset();a.next();)d=a.value,d.forest||(b=d.fromVertex,c=b.finish,e=d.toVertex,f=e.finish,e.Rl<b.Rl&&c<f&&(this.network.mm(d),d.rev=!0));break;case Er:a=this.network;b=a.vertexes.iterator;for(d=Infinity;b.next();)d=Math.min(d,b.value.layer);if(Infinity>d){if(0>d)for(b.reset();b.next();)b.value.layer-=d;d=[];for(b.reset();b.next();)c=b.value,e=d[c.layer],void 0===e?d[c.layer]=[c]:e.push(c);for(c=b=0;c<d.length;c++)if(e=d[c],!e||
0===e.length)b++;else if(0<c)for(f=0;f<e.length;f++)e[f].layer-=b;for(d=a.edges.iterator;d.next();)b=d.value,b.fromVertex.layer<b.toVertex.layer&&(a.mm(b),b.rev=!0)}}};function Tr(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function Ur(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.destinationEdges;d.next();)if(d.value.toVertex.valid){c=!1;break}if(c)return b}}return null}
function Vr(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid){for(var c=!0,d=b.sourceEdges;d.next();)if(d.value.fromVertex.valid){c=!1;break}if(c)return b}}return null}function Wr(a,b){b.Rl=a.ro;a.ro++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.Rl&&(d.forest=!0,Wr(a,e))}b.finish=a.ro;a.ro++}
yr.prototype.assignLayers=function(){switch(this.cl){case Xr:Yr(this);break;case Zr:for(var a,b=this.network.vertexes.iterator;b.next();)a=$r(this,b.value),this.ya=Math.max(a,this.ya);for(b.reset();b.next();)a=b.value,a.layer=this.ya-a.layer;break;default:case Ar:Yr(this);for(b=this.network.vertexes.iterator;b.next();)b.value.valid=!1;for(b.reset();b.next();)a=b.value,0===a.sourceEdges.count&&as(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.ya=-1;for(b.reset();b.next();){var c=
b.value;c.layer-=a;this.ya=Math.max(this.ya,c.layer)}}};function Yr(a){for(var b=a.network.vertexes.iterator;b.next();){var c=bs(a,b.value);a.ya=Math.max(c,a.ya)}}function bs(a,b){var c=0;if(-1===b.layer){for(var d=b.destinationEdges;d.next();){var e=d.value,f=e.toVertex;e=a.linkMinLength(e);c=Math.max(c,bs(a,f)+e)}b.layer=c}else c=b.layer;return c}
function $r(a,b){var c=0;if(-1===b.layer){for(var d=b.sourceEdges;d.next();){var e=d.value,f=e.fromVertex;e=a.linkMinLength(e);c=Math.max(c,$r(a,f)+e)}b.layer=c}else c=b.layer;return c}
function as(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)as(a,c.value.toVertex);for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(var d=b.sourceEdgesArrayAccess,e=d.length,f=0;f<e;f++){var g=d[f],h=g.fromVertex,k=g.toVertex;g=a.linkMinLength(g);h.layer-k.layer>g&&Qr(a,h,0,-1,!0,!1)}for(Qr(a,b,1,-1,!0,!0);0!==b.component;){f=0;d=Infinity;h=0;k=null;for(g=a.network.vertexes.iterator;g.next();){var l=g.value;if(1===l.component){var m=0,n=!1,p=l.sourceEdgesArrayAccess;
e=p.length;for(var q=0;q<e;q++){var r=p[q],u=r.fromVertex;m+=1;1!==u.component&&(f+=1,u=u.layer-l.layer,r=a.linkMinLength(r),d=Math.min(d,u-r))}p=l.destinationEdgesArrayAccess;e=p.length;for(q=0;q<e;q++)r=p[q].toVertex,--m,1!==r.component?--f:n=!0;(null===k||m<h)&&!n&&(k=l,h=m)}}if(0<f){for(c.reset();c.next();)e=c.value,1===e.component&&(e.layer+=d);b.component=0}else k.component=0}for(c=a.network.vertexes.iterator;c.next();)c.value.component=-1;for(Qr(a,b,1,-1,!0,!1);0!==b.component;){d=0;e=Infinity;
f=0;h=null;for(k=a.network.vertexes.iterator;k.next();)if(g=k.value,1===g.component){l=0;m=!1;p=g.sourceEdgesArrayAccess;n=p.length;for(q=0;q<n;q++)r=p[q].fromVertex,l+=1,1!==r.component?d+=1:m=!0;p=g.destinationEdgesArrayAccess;n=p.length;for(q=0;q<n;q++)r=p[q],u=r.toVertex,--l,1!==u.component&&(--d,u=g.layer-u.layer,r=a.linkMinLength(r),e=Math.min(e,u-r));(null===h||l>f)&&!m&&(h=g,f=l)}if(0>d){for(c.reset();c.next();)d=c.value,1===d.component&&(d.layer-=e);b.component=0}else h.component=0}}}
function Gr(a,b,c){return 90===a.L?c&&!b.rev||!c&&b.rev?270:90:180===a.L?c&&!b.rev||!c&&b.rev?0:180:270===a.L?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0}
yr.prototype.initializeIndices=function(){switch(this.Tk){default:case cs:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.hc[c];this.hc[c]++}break;case Br:a=this.network.vertexes.iterator;for(b=this.ya;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&ds(this,c);break;case es:for(a=this.network.vertexes.iterator,b=0;b<=this.ya;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&fs(this,c)}};
function ds(a,b){var c=b.layer;b.index=a.hc[c];a.hc[c]++;b=b.destinationEdgesArrayAccess;for(c=!0;c;){c=!1;for(var d=0;d<b.length-1;d++){var e=b[d],f=b[d+1];e.portFromColOffset>f.portFromColOffset&&(c=!0,b[d]=f,b[d+1]=e)}}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.toVertex,-1===d.index&&ds(a,d))}
function fs(a,b){var c=b.layer;b.index=a.hc[c];a.hc[c]++;b=b.sourceEdgesArrayAccess;for(var d=!0;d;)for(d=!1,c=0;c<b.length-1;c++){var e=b[c],f=b[c+1];e.portToColOffset>f.portToColOffset&&(d=!0,b[c]=f,b[c+1]=e)}for(c=0;c<b.length;c++)d=b[c],d.valid&&(d=d.fromVertex,-1===d.index&&fs(a,d))}
yr.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=Kr(this),c,d;for(c=0;c<this.hj;c++){for(d=0;d<=this.ya;d++)gs(this,d,1),hs(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=Kr(this));for(d=this.ya;0<=d;d--)gs(this,d,-1),hs(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=Kr(this))}Lr(this,b);for(c=0;c<this.hj;c++){for(d=0;d<=this.ya;d++)gs(this,d,0),hs(this,d,0);e=this.countCrossings();e<a&&(a=e,b=Kr(this));for(d=this.ya;0<=d;d--)gs(this,d,0),hs(this,d,0);e=this.countCrossings();
e<a&&(a=e,b=Kr(this))}Lr(this,b);var f,g,h;switch(this.pk){case is:break;case js:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.ya;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=hs(this,d,-1)||f;e=this.countCrossings();e>=a?Lr(this,b):(a=e,b=Kr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=hs(this,d,1)||f;e=this.countCrossings();e>=a?Lr(this,b):(a=e,b=Kr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=hs(this,d,1)||f;e>=a?Lr(this,b):(a=e,b=Kr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=
hs(this,d,-1)||f;e>=a?Lr(this,b):(a=e,b=Kr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=hs(this,d,0)||f;e>=a?Lr(this,b):(a=e,b=Kr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=hs(this,d,0)||f;e>=a?Lr(this,b):(a=e,b=Kr(this))}break;default:case Cr:for(c=this.ya,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=hs(this,d,-1)||f;e=this.countCrossings();e>=a?Lr(this,b):(a=e,b=Kr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=hs(this,d,1)||f;e=this.countCrossings();e>=a?Lr(this,b):
(a=e,b=Kr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=hs(this,d,1)||f;e>=a?Lr(this,b):(a=e,b=Kr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=hs(this,d,-1)||f;e>=a?Lr(this,b):(a=e,b=Kr(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=hs(this,d,0)||f;e>=a?Lr(this,b):(a=e,b=Kr(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=hs(this,d,0)||f;e>=a?Lr(this,b):(a=e,b=Kr(this))}}Lr(this,b)};
function gs(a,b,c){var d=Hr(a,b),e=a.hc[b],f=Pr(a,b,c),g=Or(a,b,c);for(c=0;c<e;c++)-1===g[c]&&(g[c]=d[c].column),-1===f[c]&&(f[c]=d[c].column);for(var h=!0,k;h;)for(h=!1,c=0;c<e-1;c++)if(f[c+1]<f[c]||f[c+1]===f[c]&&g[c+1]<g[c])h=!0,k=f[c],f[c]=f[c+1],f[c+1]=k,k=g[c],g[c]=g[c+1],g[c+1]=k,k=d[c],d[c]=d[c+1],d[c+1]=k;for(c=f=0;c<e;c++)k=d[c],k.index=c,f+=a.nodeMinColumnSpace(k,!0),k.column=f,f+=1,f+=a.nodeMinColumnSpace(k,!1);Ir(a,b,d)}
function hs(a,b,c){var d=Hr(a,b),e=a.hc[b];c=Mr(a,b,c);var f;var g=[];for(f=0;f<e;f++)g[f]=-1;var h=[];for(f=0;f<e;f++)h[f]=-1;for(var k=!1,l=!0;l;)for(l=!1,f=0;f<e-1;f++){var m=c[d[f].index*e+d[f+1].index],n=c[d[f+1].index*e+d[f].index],p=0,q=0,r=d[f].column,u=d[f+1].column,v=a.nodeMinColumnSpace(d[f],!0),x=a.nodeMinColumnSpace(d[f],!1),y=a.nodeMinColumnSpace(d[f+1],!0),z=a.nodeMinColumnSpace(d[f+1],!1);v=r-v+y;x=u-x+z;var B=d[f].sourceEdges.iterator;for(B.reset();B.next();)if(y=B.value,z=y.fromVertex,
y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f-y),q+=2*(f+1-y));y===f+1&&(p+=1);y>f+1&&(p+=4*(y-f),q+=4*(y-(f+1)))}B=d[f].destinationEdges.iterator;for(B.reset();B.next();)if(y=B.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f+1&&(q+=1)}B=d[f+1].sourceEdges.iterator;for(B.reset();B.next();)if(y=B.value,z=y.fromVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y<f&&(p+=2*(f+1-y),q+=2*(f-y));y===f&&(q+=1);y>f+1&&(p+=4*(y-(f+1)),q+=4*(y-f))}B=d[f+1].destinationEdges.iterator;
for(B.reset();B.next();)if(y=B.value,z=y.toVertex,y.valid&&z.layer===b){for(y=0;d[y]!==z;)y++;y===f&&(p+=1)}y=z=0;B=g[d[f].index];var C=h[d[f].index],I=g[d[f+1].index],J=h[d[f+1].index];-1!==B&&(z+=Math.abs(B-r),y+=Math.abs(B-x));-1!==C&&(z+=Math.abs(C-r),y+=Math.abs(C-x));-1!==I&&(z+=Math.abs(I-u),y+=Math.abs(I-v));-1!==J&&(z+=Math.abs(J-u),y+=Math.abs(J-v));if(q<p-.5||q===p&&n<m-.5||q===p&&n===m&&y<z-.5)l=k=!0,d[f].column=x,d[f+1].column=v,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index=
f;Ir(a,b,d);return k}
yr.prototype.straightenAndPack=function(){var a=0!==(this.Xf&1);var b=7===this.Xf;1E3<this.network.edges.count&&!b&&(a=!1);if(a){var c=[];for(b=0;b<=this.ya;b++)c[b]=0;for(var d,e=this.network.vertexes.iterator;e.next();){var f=e.value;b=f.layer;d=f.column;f=this.nodeMinColumnSpace(f,!1);c[b]=Math.max(c[b],d+f)}for(e.reset();e.next();)f=e.value,b=f.layer,d=f.column,f.column=(8*(this.Ga-c[b])>>1)+8*d;this.Ga*=8}if(0!==(this.Xf&2))for(c=!0;c;){c=!1;for(b=this.qd+1;b<=this.ya;b++)c=ks(this,b,1)||c;for(b=
this.qd-1;0<=b;b--)c=ks(this,b,-1)||c;c=ks(this,this.qd,0)||c}if(0!==(this.Xf&4)){for(b=this.qd+1;b<=this.ya;b++)ls(this,b,1);for(b=this.qd-1;0<=b;b--)ls(this,b,-1);ls(this,this.qd,0)}a&&(ms(this,-1),ms(this,1));if(0!==(this.Xf&2))for(c=!0;c;){c=!1;c=ks(this,this.qd,0)||c;for(b=this.qd+1;b<=this.ya;b++)c=ks(this,b,0)||c;for(b=this.qd-1;0<=b;b--)c=ks(this,b,0)||c}};function ks(a,b,c){for(var d=!1;ns(a,b,c);)d=!0;return d}
function ns(a,b,c){var d,e=Hr(a,b),f=a.hc[b],g=Or(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Or(a,b,1);if(0>c)for(d=0;d<f;d++)h[d]=-1;for(var k=!1,l=!0;l;)for(l=!1,d=0;d<f;d++){var m=e[d].column,n=a.nodeMinColumnSpace(e[d],!0),p=a.nodeMinColumnSpace(e[d],!1),q=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?q=m-1:q=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var r=p=0,u=0;if(0>=c)for(var v=e[d].sourceEdges.iterator;v.next();){var x=v.value;var y=x.fromVertex;
if(x.valid&&y.layer!==b){var z=Jr(x);var B=x.portFromColOffset;x=x.portToColOffset;y=y.column;p+=(Math.abs(m+x-(y+B))+1)*z;r+=(Math.abs(q+x-(y+B))+1)*z;u+=(Math.abs(n+x-(y+B))+1)*z}}if(0<=c)for(v=e[d].destinationEdges.iterator;v.next();)x=v.value,y=x.toVertex,x.valid&&y.layer!==b&&(z=Jr(x),B=x.portFromColOffset,x=x.portToColOffset,y=y.column,p+=(Math.abs(m+B-(y+x))+1)*z,r+=(Math.abs(q+B-(y+x))+1)*z,u+=(Math.abs(n+B-(y+x))+1)*z);x=B=z=0;v=g[e[d].index];y=h[e[d].index];-1!==v&&(z+=Math.abs(v-m),B+=
Math.abs(v-q),x+=Math.abs(v-n));-1!==y&&(z+=Math.abs(y-m),B+=Math.abs(y-q),x+=Math.abs(y-n));if(r<p||r===p&&B<z)l=k=!0,e[d].column=q;else if(u<p||u===p&&x<z)l=k=!0,e[d].column=n}Ir(a,b,e);a.normalize();return k}
function ls(a,b,c){var d=Hr(a,b),e=a.hc[b],f=Pr(a,b,c),g=[];for(c=0;c<e;c++)g[c]=f[c];for(f=!0;f;)for(f=!1,c=0;c<e;c++){var h=d[c].column,k=a.nodeMinColumnSpace(d[c],!0),l=a.nodeMinColumnSpace(d[c],!1),m=0;if(-1===g[c])if(0===c&&c===e-1)m=h;else if(0===c){var n=d[c+1].column;n-h===l+a.nodeMinColumnSpace(d[c+1],!0)?m=h-1:m=h}else c===e-1?(n=d[c-1].column,m=h-n===k+a.nodeMinColumnSpace(d[c-1],!1)?h+1:h):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+
1],!0)-l-1,m=(k+l)/2|0);else 0===c&&c===e-1?m=g[c]:0===c?(n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,m=Math.min(g[c],l)):c===e-1?(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,m=Math.max(g[c],k)):(n=d[c-1].column,k=n+a.nodeMinColumnSpace(d[c-1],!1)+k+1,n=d[c+1].column,l=n-a.nodeMinColumnSpace(d[c+1],!0)-l-1,k<g[c]&&g[c]<l?m=g[c]:k>=g[c]?m=k:l<=g[c]&&(m=l));m!==h&&(f=!0,d[c].column=m)}Ir(a,b,d);a.normalize()}
function os(a,b){for(var c=!0,d=a.network.vertexes.iterator;d.next();){var e=d.value,f=a.nodeMinColumnSpace(e,!0),g=a.nodeMinColumnSpace(e,!1);if(e.column-f<=b&&e.column+g>=b){c=!1;break}}a=!1;if(c)for(d.reset();d.next();)c=d.value,c.column>b&&(--c.column,a=!0);return a}
function ps(a,b){var c=b+1;var d,e=[],f=[];for(d=0;d<=a.ya;d++)e[d]=!1,f[d]=!1;for(var g=a.network.vertexes.iterator;g.next();){d=g.value;var h=d.column-a.nodeMinColumnSpace(d,!0),k=d.column+a.nodeMinColumnSpace(d,!1);h<=b&&k>=b&&(e[d.layer]=!0);h<=c&&k>=c&&(f[d.layer]=!0)}h=!0;c=!1;for(d=0;d<=a.ya;d++)h=h&&!(e[d]&&f[d]);if(h)for(g.reset();g.next();)a=g.value,a.column>b&&(--a.column,c=!0);return c}
function ms(a,b){for(var c=0;c<=a.Ga;c++)for(;os(a,c););a.normalize();for(c=0;c<a.Ga;c++)for(;ps(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ga;c++){var e=Kr(a);var f=Nr(a);for(d=f+1;f<d;){d=f;qs(a,c,1);var g=Nr(a);g>f?Lr(a,e):g<f&&(f=g,e=Kr(a))}}if(0>b)for(c=a.Ga;0<=c;c--)for(e=Kr(a),f=Nr(a),d=f+1;f<d;)d=f,qs(a,c,-1),g=Nr(a),g>f?Lr(a,e):g<f&&(f=g,e=Kr(a));a.normalize()}
function qs(a,b,c){a.Ld=0;for(var d=a.network.vertexes.iterator;d.next();)d.value.component=-1;if(0<c)for(d.reset();d.next();){var e=d.value;e.column-a.nodeMinColumnSpace(e,!0)<=b&&(e.component=a.Ld)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Ld);a.Ld++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Rr(a,b,a.Ld,-1,!0,!0),a.Ld++);var f;b=[];for(f=0;f<a.Ld*a.Ld;f++)b[f]=!1;e=[];for(f=0;f<(a.ya+1)*(a.Ga+1);f++)e[f]=-1;for(d.reset();d.next();){f=
d.value;for(var g=f.layer,h=Math.max(0,f.column-a.nodeMinColumnSpace(f,!0)),k=Math.min(a.Ga,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ga+1)+h]=f.component}for(f=0;f<=a.ya;f++){if(0<c)for(g=0;g<a.Ga;g++)-1!==e[f*(a.Ga+1)+g]&&-1!==e[f*(a.Ga+1)+g+1]&&e[f*(a.Ga+1)+g]!==e[f*(a.Ga+1)+g+1]&&(b[e[f*(a.Ga+1)+g]*a.Ld+e[f*(a.Ga+1)+g+1]]=!0);if(0>c)for(g=a.Ga;0<g;g--)-1!==e[f*(a.Ga+1)+g]&&-1!==e[f*(a.Ga+1)+g-1]&&e[f*(a.Ga+1)+g]!==e[f*(a.Ga+1)+g-1]&&(b[e[f*(a.Ga+1)+g]*a.Ld+e[f*(a.Ga+1)+g-1]]=!0)}e=
[];for(f=0;f<a.Ld;f++)e[f]=!0;g=[];for(g.push(0);0!==g.length;)if(k=g[g.length-1],g.pop(),e[k])for(e[k]=!1,f=0;f<a.Ld;f++)b[k*a.Ld+f]&&g.splice(0,0,f);if(0<c)for(d.reset();d.next();)a=d.value,e[a.component]&&--a.column;if(0>c)for(d.reset();d.next();)c=d.value,e[c.component]&&(c.column+=1)}
yr.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=Fr(this,!0),b=Fr(this,!1),c=this.network.edges.iterator;c.next();){var d=c.value.link;null!==d&&(d.fromSpot=a,d.toSpot=b)}this.commitNodes();this.Gu();this.isRouting&&this.commitLinks()};function Fr(a,b){return 270===a.L?b?Td:Wd:90===a.L?b?Wd:Td:180===a.L?b?Ud:Vd:b?Vd:Ud}
yr.prototype.commitNodes=function(){this.Gd=[];this.od=[];this.nd=[];this.Ja=[];for(var a=0;a<=this.ya;a++)this.Gd[a]=0,this.od[a]=0,this.nd[a]=0,this.Ja[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.Gd[c]=Math.max(this.Gd[c],this.nodeMinLayerSpace(b,!0));this.od[c]=Math.max(this.od[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.ie;for(var d=0;d<=this.ya;d++){var e=c;0>=this.Gd[d]+this.od[d]&&(e=0);0<d&&(b+=e/2);90===this.L||0===this.L?(b+=this.od[d],this.nd[d]=b,
b+=this.Gd[d]):(b+=this.Gd[d],this.nd[d]=b,b+=this.od[d]);d<this.ya&&(b+=e/2);this.Ja[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.ya;d++)270===this.L?this.nd[d]=b.y+this.nd[d]:90===this.L?(this.nd[d]=b.y+c-this.nd[d],this.Ja[d]=c-this.Ja[d]):180===this.L?this.nd[d]=b.x+this.nd[d]:(this.nd[d]=b.x+c-this.nd[d],this.Ja[d]=c-this.Ja[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.L||90===this.L){var h=b.x+this.Wb*g;f=this.nd[f]}else h=this.nd[f],f=b.y+
this.Wb*g;e.centerX=h;e.centerY=f;d=Math.min(e.x,d);c=Math.min(e.y,c)}d=b.x-d;b=b.y-c;this.ew=new G(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()};
yr.prototype.Gu=function(){for(var a=0,b=this.ie,c=0;c<=this.ya;c++)a+=this.Gd[c],a+=this.od[c];a+=this.ya*b;b=[];c=this.Wb*this.Ga;for(var d=this.maxLayer;0<=d;d--)270===this.L?0===d?b.push(new N(0,0,c,Math.abs(this.Ja[0]))):b.push(new N(0,this.Ja[d-1],c,Math.abs(this.Ja[d-1]-this.Ja[d]))):90===this.L?0===d?b.push(new N(0,this.Ja[0],c,Math.abs(this.Ja[0]-a))):b.push(new N(0,this.Ja[d],c,Math.abs(this.Ja[d-1]-this.Ja[d]))):180===this.L?0===d?b.push(new N(0,0,Math.abs(this.Ja[0]),c)):b.push(new N(this.Ja[d-
1],0,Math.abs(this.Ja[d-1]-this.Ja[d]),c)):0===d?b.push(new N(this.Ja[0],0,Math.abs(this.Ja[0]-a),c)):b.push(new N(this.Ja[d],0,Math.abs(this.Ja[d-1]-this.Ja[d]),c));this.commitLayers(b,this.ew)};yr.prototype.commitLayers=function(){};
yr.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.wh(),b.Kj(),b.jf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.Pi();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.wh();var d=b,e=d.fromNode,f=d.toNode,g=d.fromPort,h=d.toPort;if(null!==e){var k=e.findVisibleNode();null!==k&&k!==e&&(e=k,g=k.port)}if(null!==f){var l=f.findVisibleNode();null!==l&&l!==f&&(f=l,h=l.port)}var m=b.computeSpot(!0,g),n=b.computeSpot(!1,
h),p=c.fromVertex,q=c.toVertex;if(c.valid){if(b.curve===Tg&&4===b.pointsCount)if(p.column===q.column){var r=b.getLinkPoint(e,g,m,!0,!1,f,h),u=b.getLinkPoint(f,h,n,!1,!1,e,g);r.s()||r.set(e.actualBounds.center);u.s()||u.set(f.actualBounds.center);b.Kj();b.hf(r.x,r.y);b.hf((2*r.x+u.x)/3,(2*r.y+u.y)/3);b.hf((r.x+2*u.x)/3,(r.y+2*u.y)/3);b.hf(u.x,u.y)}else{var v=!1,x=!1;null!==g&&m===bd&&(v=!0);null!==h&&n===bd&&(x=!0);if(v||x){var y=b.i(0).x,z=b.i(0).y,B=b.i(3).x,C=b.i(3).y;if(v){if(90===this.L||270===
this.L){var I=y;var J=(z+C)/2}else I=(y+B)/2,J=z;b.M(1,I,J);var K=b.getLinkPoint(e,g,m,!0,!1,f,h);K.s()||K.set(e.actualBounds.center);b.M(0,K.x,K.y)}if(x){if(90===this.L||270===this.L){var X=B;var Q=(z+C)/2}else X=(y+B)/2,Q=C;b.M(2,X,Q);var ia=b.getLinkPoint(f,h,n,!1,!1,e,g);ia.s()||ia.set(f.actualBounds.center);b.M(3,ia.x,ia.y)}}}b.jf()}else if(p.layer===q.layer)b.jf();else{var ja=!1,M=!1,R=b.firstPickIndex+1;if(b.isOrthogonal){M=!0;var Ba=b.pointsCount;4<Ba&&b.points.removeRange(2,Ba-3)}else if(b.curve===
Tg)ja=!0,Ba=b.pointsCount,4<Ba&&b.points.removeRange(2,Ba-3),R=2;else{Ba=b.pointsCount;var ob=m===bd,Ia=n===bd;2<Ba&&ob&&Ia?b.points.removeRange(1,Ba-2):3<Ba&&ob&&!Ia?b.points.removeRange(1,Ba-3):3<Ba&&!ob&&Ia?b.points.removeRange(2,Ba-2):4<Ba&&!ob&&!Ia&&b.points.removeRange(2,Ba-3)}var Ea;if(c.rev){for(var Ga;null!==q&&p!==q;){var Ra=Ea=null;for(var Tb=q.sourceEdges.iterator;Tb.next();){var Ya=Tb.value;if(Ya.link===c.link&&(Ea=Ya.fromVertex,Ra=Ya.toVertex,null===Ea.node))break}if(Ea!==p){var Wa=
b.i(R-1).x;var Ma=b.i(R-1).y;var fa=Ea.centerX;var ea=Ea.centerY;if(M)if(180===this.L||0===this.L)if(2===R)b.m(R++,Wa,Ma),b.m(R++,Wa,ea);else{if((null!==Ra?Ra.centerY:Ma)!==ea){var hb=this.Ja[Ea.layer-1];b.m(R++,hb,Ma);b.m(R++,hb,ea)}}else 2===R?(b.m(R++,Wa,Ma),b.m(R++,fa,Ma)):(null!==Ra?Ra.centerX:Wa)!==fa&&(hb=this.Ja[Ea.layer-1],b.m(R++,Wa,hb),b.m(R++,fa,hb));else if(2===R){var jb=Math.max(10,this.Gd[q.layer]);var Na=Math.max(10,this.od[q.layer]);if(ja)180===this.L?fa<=q.bounds.x?(Ga=q.bounds.x,
b.m(R++,Ga-jb,ea),b.m(R++,Ga,ea),b.m(R++,Ga+Na,ea)):(b.m(R++,fa-jb,ea),b.m(R++,fa,ea),b.m(R++,fa+Na,ea)):90===this.L?ea>=q.bounds.bottom?(Ga=q.bounds.y+q.bounds.height,b.m(R++,fa,Ga+Na),b.m(R++,fa,Ga),b.m(R++,fa,Ga-jb)):(b.m(R++,fa,ea+Na),b.m(R++,fa,ea),b.m(R++,fa,ea-jb)):270===this.L?ea<=q.bounds.y?(Ga=q.bounds.y,b.m(R++,fa,Ga-jb),b.m(R++,fa,Ga),b.m(R++,fa,Ga+Na)):(b.m(R++,fa,ea-jb),b.m(R++,fa,ea),b.m(R++,fa,ea+Na)):0===this.L&&(fa>=q.bounds.right?(Ga=q.bounds.x+q.bounds.width,b.m(R++,Ga+Na,ea),
b.m(R++,Ga,ea),b.m(R++,Ga-jb,ea)):(b.m(R++,fa+Na,ea),b.m(R++,fa,ea),b.m(R++,fa-jb,ea)));else{b.m(R++,Wa,Ma);var be=0;if(180===this.L||0===this.L){if(180===this.L?fa>=q.bounds.right:fa<=q.bounds.x)be=(0===this.L?-jb:Na)/2;b.m(R++,Wa+be,ea)}else{if(270===this.L?ea>=q.bounds.bottom:ea<=q.bounds.y)be=(90===this.L?-jb:Na)/2;b.m(R++,fa,Ma+be)}b.m(R++,fa,ea)}}else jb=Math.max(10,this.Gd[Ea.layer]),Na=Math.max(10,this.od[Ea.layer]),180===this.L?(ja&&b.m(R++,fa-jb,ea),b.m(R++,fa,ea),ja&&b.m(R++,fa+Na,ea)):
90===this.L?(ja&&b.m(R++,fa,ea+Na),b.m(R++,fa,ea),ja&&b.m(R++,fa,ea-jb)):270===this.L?(ja&&b.m(R++,fa,ea-jb),b.m(R++,fa,ea),ja&&b.m(R++,fa,ea+Na)):(ja&&b.m(R++,fa+Na,ea),b.m(R++,fa,ea),ja&&b.m(R++,fa-jb,ea))}q=Ea}if(null===h||m!==bd||M)if(Wa=b.i(R-1).x,Ma=b.i(R-1).y,fa=b.i(R).x,ea=b.i(R).y,M){var Jd=this.od[p.layer];if(180===this.L||0===this.L){var vb=Ma;vb>=p.bounds.y&&vb<=p.bounds.bottom&&(180===this.L?fa>=p.bounds.x:fa<=p.bounds.right)&&(Ga=p.centerX+(180===this.L?-Jd:Jd),vb<p.bounds.y+p.bounds.height/
2?vb=p.bounds.y-this.Wb/2:vb=p.bounds.bottom+this.Wb/2,b.m(R++,Ga,Ma),b.m(R++,Ga,vb));b.m(R++,fa,vb)}else vb=Wa,vb>=p.bounds.x&&vb<=p.bounds.right&&(270===this.L?ea>=p.bounds.y:ea<=p.bounds.bottom)&&(Ga=p.centerY+(270===this.L?-Jd:Jd),vb<p.bounds.x+p.bounds.width/2?vb=p.bounds.x-this.Wb/2:vb=p.bounds.right+this.Wb/2,b.m(R++,Wa,Ga),b.m(R++,vb,Ga)),b.m(R++,vb,ea);b.m(R++,fa,ea)}else if(ja)jb=Math.max(10,this.Gd[p.layer]),Na=Math.max(10,this.od[p.layer]),180===this.L&&fa>=p.bounds.x?(Ga=p.bounds.x+p.bounds.width,
b.M(R-2,Ga,Ma),b.M(R-1,Ga+Na,Ma)):90===this.L&&ea<=p.bounds.bottom?(Ga=p.bounds.y,b.M(R-2,Wa,Ga),b.M(R-1,Wa,Ga-jb)):270===this.L&&ea>=p.bounds.y?(Ga=p.bounds.y+p.bounds.height,b.M(R-2,Wa,Ga),b.M(R-1,Wa,Ga+Na)):0===this.L&&fa<=p.bounds.right&&(Ga=p.bounds.x,b.M(R-2,Ga,Ma),b.M(R-1,Ga-jb,Ma));else{jb=Math.max(10,this.Gd[p.layer]);Na=Math.max(10,this.od[p.layer]);var yf=0;if(180===this.L||0===this.L){if(180===this.L?fa<=p.bounds.x:fa>=p.bounds.right)yf=(0===this.L?Na:-jb)/2;b.m(R++,fa+yf,Ma)}else{if(270===
this.L?ea<=p.bounds.y:ea>=p.bounds.bottom)yf=(90===this.L?Na:-jb)/2;b.m(R++,Wa,ea+yf)}b.m(R++,fa,ea)}}else{for(;null!==p&&p!==q;){Ra=Ea=null;for(var Eb=p.destinationEdges.iterator;Eb.next();){var oe=Eb.value;if(oe.link===c.link&&(Ea=oe.toVertex,Ra=oe.fromVertex,null!==Ra.node&&(Ra=null),null===Ea.node))break}Ea!==q&&(Wa=b.i(R-1).x,Ma=b.i(R-1).y,fa=Ea.centerX,ea=Ea.centerY,M?180===this.L||0===this.L?(null!==Ra?Ra.centerY:Ma)!==ea&&(hb=this.Ja[Ea.layer],2===R&&(hb=0===this.L?Math.max(hb,Wa):Math.min(hb,
Wa)),b.m(R++,hb,Ma),b.m(R++,hb,ea)):(null!==Ra?Ra.centerX:Wa)!==fa&&(hb=this.Ja[Ea.layer],2===R&&(hb=90===this.L?Math.max(hb,Ma):Math.min(hb,Ma)),b.m(R++,Wa,hb),b.m(R++,fa,hb)):(jb=Math.max(10,this.Gd[Ea.layer]),Na=Math.max(10,this.od[Ea.layer]),180===this.L?(b.m(R++,fa+Na,ea),ja&&b.m(R++,fa,ea),b.m(R++,fa-jb,ea)):90===this.L?(b.m(R++,fa,ea-jb),ja&&b.m(R++,fa,ea),b.m(R++,fa,ea+Na)):270===this.L?(b.m(R++,fa,ea+Na),ja&&b.m(R++,fa,ea),b.m(R++,fa,ea-jb)):(b.m(R++,fa-jb,ea),ja&&b.m(R++,fa,ea),b.m(R++,
fa+Na,ea))));p=Ea}M&&(Wa=b.i(R-1).x,Ma=b.i(R-1).y,fa=b.i(R).x,ea=b.i(R).y,180===this.L||0===this.L?Ma!==ea&&(hb=0===this.L?Math.min(Math.max((fa+Wa)/2,this.Ja[q.layer]),fa):Math.max(Math.min((fa+Wa)/2,this.Ja[q.layer]),fa),b.m(R++,hb,Ma),b.m(R++,hb,ea)):Wa!==fa&&(hb=90===this.L?Math.min(Math.max((ea+Ma)/2,this.Ja[q.layer]),ea):Math.max(Math.min((ea+Ma)/2,this.Ja[q.layer]),ea),b.m(R++,Wa,hb),b.m(R++,fa,hb)))}if(null!==d&&ja){if(null!==g){if(m===bd){var Vc=b.i(0),Ub=b.i(2);Vc.A(Ub)||b.M(1,(Vc.x+Ub.x)/
2,(Vc.y+Ub.y)/2)}var Kd=b.getLinkPoint(e,g,bd,!0,!1,f,h);Kd.s()||Kd.set(e.actualBounds.center);b.M(0,Kd.x,Kd.y)}if(null!==h){if(n===bd){var Ec=b.i(b.pointsCount-1),Ge=b.i(b.pointsCount-3);Ec.A(Ge)||b.M(b.pointsCount-2,(Ec.x+Ge.x)/2,(Ec.y+Ge.y)/2)}var He=b.getLinkPoint(f,h,bd,!1,!1,e,g);He.s()||He.set(f.actualBounds.center);b.M(b.pointsCount-1,He.x,He.y)}}b.jf();c.commit()}}}for(var zf=new E,ff=this.network.edges.iterator;ff.next();){var Af=ff.value.link;null!==Af&&Af.isOrthogonal&&!zf.contains(Af)&&
zf.add(Af)}if(0<zf.count)if(90===this.L||270===this.L){for(var hc=0,Za=[],$a,Mc,Bf=zf.iterator;Bf.next();){var ic=Bf.value;if(null!==ic&&ic.isOrthogonal)for(var Ld=2;Ld<ic.pointsCount-3;Ld++)if($a=ic.i(Ld),Mc=ic.i(Ld+1),this.w($a.y,Mc.y)&&!this.w($a.x,Mc.x)){var pc=new rs;pc.layer=Math.floor($a.y/2);var Md=ic.i(0),Vb=ic.i(ic.pointsCount-1);pc.first=Md.x*Md.x+Md.y;pc.dc=Vb.x*Vb.x+Vb.y;pc.Tc=Math.min($a.x,Mc.x);pc.uc=Math.max($a.x,Mc.x);pc.index=Ld;pc.link=ic;if(Ld+2<ic.pointsCount){var Eh=ic.i(Ld-
1),Fh=ic.i(Ld+2),Ie=0;Eh.y<$a.y?Ie=Fh.y<$a.y?3:$a.x<Mc.x?2:1:Eh.y>$a.y&&(Ie=Fh.y>$a.y?0:Mc.x<$a.x?2:1);pc.l=Ie}Za.push(pc)}}if(1<Za.length){Za.sort(this.Ax);for(var pb=0;pb<Za.length;){for(var Cf=Za[pb].layer,Je=pb+1;Je<Za.length&&Za[Je].layer===Cf;)Je++;if(1<Je-pb)for(var Wb=pb;Wb<Je;){for(var Ke=Za[Wb].uc,Nc=pb+1;Nc<Je&&Za[Nc].Tc<Ke;)Ke=Math.max(Ke,Za[Nc].uc),Nc++;var db=Nc-Wb;if(1<db){this.Mi(Za,this.ot,Wb,Wb+db);for(var Le=1,rb=Za[Wb].dc,qc=Wb;qc<Nc;qc++){var kb=Za[qc];kb.dc!==rb&&(Le++,rb=kb.dc)}this.Mi(Za,
this.zx,Wb,Wb+db);var Wc=1;rb=Za[Wb].first;for(var Xc=Wb;Xc<Nc;Xc++){var wd=Za[Xc];wd.first!==rb&&(Wc++,rb=wd.first)}var Cg=!0,Df=Wc;Le<Wc?(Cg=!1,Df=Le,rb=Za[Wb].dc,this.Mi(Za,this.ot,Wb,Wb+db)):rb=Za[Wb].first;for(var Ef=0,gf=Wb;gf<Nc;gf++){var jd=Za[gf];(Cg?jd.first:jd.dc)!==rb&&(Ef++,rb=Cg?jd.first:jd.dc);var Nd=jd.link;$a=Nd.i(jd.index);Mc=Nd.i(jd.index+1);var kd=this.linkSpacing*(Ef-(Df-1)/2);hc++;Nd.wh();Nd.M(jd.index,$a.x,$a.y+kd);Nd.M(jd.index+1,Mc.x,Mc.y+kd);Nd.jf()}}Wb=Nc}pb=Je}}}else{for(var ld=
0,nb=[],eb,md,Yc=zf.iterator;Yc.next();){var nd=Yc.value;if(null!==nd&&nd.isOrthogonal)for(var vc=2;vc<nd.pointsCount-3;vc++)if(eb=nd.i(vc),md=nd.i(vc+1),this.w(eb.x,md.x)&&!this.w(eb.y,md.y)){var Ca=new rs;Ca.layer=Math.floor(eb.x/2);var Zc=nd.i(0),Xb=nd.i(nd.pointsCount-1);Ca.first=Zc.x+Zc.y*Zc.y;Ca.dc=Xb.x+Xb.y*Xb.y;Ca.Tc=Math.min(eb.y,md.y);Ca.uc=Math.max(eb.y,md.y);Ca.index=vc;Ca.link=nd;if(vc+2<nd.pointsCount){var ce=nd.i(vc-1),Me=nd.i(vc+2),de=0;ce.x<eb.x?de=Me.x<eb.x?3:eb.y<md.y?2:1:ce.x>
eb.x&&(de=Me.x>eb.x?0:md.y<eb.y?2:1);Ca.l=de}nb.push(Ca)}}if(1<nb.length){nb.sort(this.Ax);for(var wc=0;wc<nb.length;){for(var pe=nb[wc].layer,$c=wc+1;$c<nb.length&&nb[$c].layer===pe;)$c++;if(1<$c-wc)for(var wb=wc;wb<$c;){for(var Od=nb[wb].uc,Lb=wc+1;Lb<$c&&nb[Lb].Tc<Od;)Od=Math.max(Od,nb[Lb].uc),Lb++;var qe=Lb-wb;if(1<qe){this.Mi(nb,this.ot,wb,wb+qe);for(var xd=1,ee=nb[wb].dc,Dg=wb;Dg<Lb;Dg++){var ad=nb[Dg];ad.dc!==ee&&(xd++,ee=ad.dc)}this.Mi(nb,this.zx,wb,wb+qe);var Ne=1;ee=nb[wb].first;for(var Eg=
wb;Eg<Lb;Eg++){var Ff=nb[Eg];Ff.first!==ee&&(Ne++,ee=Ff.first)}var Oe=!0,Fg=Ne;xd<Ne?(Oe=!1,Fg=xd,ee=nb[wb].dc,this.Mi(nb,this.ot,wb,wb+qe)):ee=nb[wb].first;for(var dg=0,Fi=wb;Fi<Lb;Fi++){var Pe=nb[Fi];(Oe?Pe.first:Pe.dc)!==ee&&(dg++,ee=Oe?Pe.first:Pe.dc);var Qe=Pe.link;eb=Qe.i(Pe.index);md=Qe.i(Pe.index+1);var Gh=this.linkSpacing*(dg-(Fg-1)/2);ld++;Qe.wh();Qe.M(Pe.index,eb.x+Gh,eb.y);Qe.M(Pe.index+1,md.x+Gh,md.y);Qe.jf()}}wb=Lb}wc=$c}}}};t=yr.prototype;
t.Ax=function(a,b){return a instanceof rs&&b instanceof rs&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.Tc<b.Tc?-1:a.Tc>b.Tc?1:a.uc<b.uc?-1:a.uc>b.uc?1:0:0};t.zx=function(a,b){return a instanceof rs&&b instanceof rs&&a!==b?a.first<b.first?-1:a.first>b.first||a.l<b.l?1:a.l>b.l||a.Tc<b.Tc?-1:a.Tc>b.Tc?1:a.uc<b.uc?-1:a.uc>b.uc?1:0:0};t.ot=function(a,b){return a instanceof rs&&b instanceof rs&&a!==b?a.dc<b.dc?-1:a.dc>b.dc||a.l<b.l?1:a.l>b.l||a.Tc<b.Tc?-1:a.Tc>b.Tc?1:a.uc<b.uc?-1:a.uc>b.uc?1:0:0};
t.w=function(a,b){a-=b;return-1<a&&1>a};t.Mi=function(a,b,c,d){var e=a.length,f=d-c;if(!(1>=f))if((0>c||c>=e-1)&&A("not in range 0 <= from < length: "+c),2===f)d=a[c],e=a[c+1],0<b(d,e)&&(a[c]=e,a[c+1]=d);else if(0===c)if(d>=e)a.sort(b);else for(c=a.slice(0,d),c.sort(b),b=0;b<d;b++)a[b]=c[b];else if(d>=e)for(d=a.slice(c),d.sort(b),b=c;b<e;b++)a[b]=d[b-c];else for(e=a.slice(c,d),e.sort(b),b=c;b<d;b++)a[b]=e[b-c]};
function Hr(a,b){var c=a.hc[b];if(c>=a.me.length){var d=[];for(var e=0;e<a.me.length;e++)d[e]=a.me[e];a.me=d}void 0===a.me[c]||null===a.me[c]?d=[]:(d=a.me[c],a.me[c]=null);a=a.so[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function Ir(a,b,c){a.me[a.hc[b]]=c}
pa.Object.defineProperties(yr.prototype,{layerSpacing:{get:function(){return this.ie},set:function(a){this.ie!==a&&0<=a&&(this.ie=a,this.B())}},columnSpacing:{get:function(){return this.Wb},set:function(a){this.Wb!==a&&0<a&&(this.Wb=a,this.B())}},direction:{get:function(){return this.L},set:function(a){this.L!==a&&(0===a||90===a||180===a||270===a?(this.L=a,this.B()):A("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},
cycleRemoveOption:{get:function(){return this.Ck},set:function(a){this.Ck===a||a!==Sr&&a!==zr&&a!==Er||(this.Ck=a,this.B())}},layeringOption:{get:function(){return this.cl},set:function(a){this.cl===a||a!==Ar&&a!==Xr&&a!==Zr||(this.cl=a,this.B())}},initializeOption:{get:function(){return this.Tk},set:function(a){this.Tk===a||a!==Br&&a!==es&&a!==cs||(this.Tk=a,this.B())}},iterations:{
get:function(){return this.hj},set:function(a){this.hj!==a&&0<=a&&(this.hj=a,this.B())}},aggressiveOption:{get:function(){return this.pk},set:function(a){this.pk===a||a!==is&&a!==Cr&&a!==js||(this.pk=a,this.B())}},packOption:{get:function(){return this.Xf},set:function(a){this.Xf!==a&&0<=a&&8>a&&(this.Xf=a,this.B())}},setsPortSpots:{get:function(){return this.Xe},set:function(a){this.Xe!==a&&(this.Xe=a,this.B())}},
linkSpacing:{get:function(){return this.Zn},set:function(a){this.Zn!==a&&0<=a&&(this.Zn=a,this.B())}},maxLayer:{get:function(){return this.ya}},maxIndex:{get:function(){return this.Ir}},maxColumn:{get:function(){return this.Ga}},minIndexLayer:{get:function(){return this.ko}},maxIndexLayer:{get:function(){return this.qd}}});
var zr=new D(yr,"CycleDepthFirst",0),Sr=new D(yr,"CycleGreedy",1),Er=new D(yr,"CycleFromLayers",2),Ar=new D(yr,"LayerOptimalLinkLength",0),Xr=new D(yr,"LayerLongestPathSink",1),Zr=new D(yr,"LayerLongestPathSource",2),Br=new D(yr,"InitDepthFirstOut",0),es=new D(yr,"InitDepthFirstIn",1),cs=new D(yr,"InitNaive",2),is=new D(yr,"AggressiveNone",0),Cr=new D(yr,"AggressiveLess",1),js=new D(yr,"AggressiveMore",2);yr.className="LayeredDigraphLayout";yr.CycleDepthFirst=zr;yr.CycleGreedy=Sr;
yr.CycleFromLayers=Er;yr.LayerOptimalLinkLength=Ar;yr.LayerLongestPathSink=Xr;yr.LayerLongestPathSource=Zr;yr.InitDepthFirstOut=Br;yr.InitDepthFirstIn=es;yr.InitNaive=cs;yr.AggressiveNone=is;yr.AggressiveLess=Cr;yr.AggressiveMore=js;yr.PackNone=0;yr.PackExpand=1;yr.PackStraighten=2;yr.PackMedian=4;yr.PackAll=7;function rs(){this.index=this.uc=this.Tc=this.dc=this.first=this.layer=0;this.link=null;this.l=0}rs.className="SegInfo";function Dr(a){tp.call(this,a)}oa(Dr,tp);Dr.prototype.createVertex=function(){return new ss(this)};
Dr.prototype.createEdge=function(){return new ts(this)};Dr.className="LayeredDigraphNetwork";function ss(a){wp.call(this,a);this.Qa=this.zg=this.bi=-1;this.K=NaN;this.da=null;this.valid=!1;this.finish=this.Rl=NaN;this.Gj=0;this.jv=this.kv=null}oa(ss,wp);
pa.Object.defineProperties(ss.prototype,{layer:{get:function(){return this.bi},set:function(a){this.bi!==a&&(this.bi=a)}},column:{get:function(){return this.zg},set:function(a){this.zg!==a&&(this.zg=a)}},index:{get:function(){return this.Qa},set:function(a){this.Qa!==a&&(this.Qa=a)}},component:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}},near:{
get:function(){return this.da},set:function(a){this.da!==a&&(this.da=a)}}});ss.className="LayeredDigraphVertex";function ts(a){xp.call(this,a);this.l=this.Wa=this.Tb=!1;this.La=this.K=NaN;this.da=this.u=0}oa(ts,xp);
pa.Object.defineProperties(ts.prototype,{valid:{get:function(){return this.Tb},set:function(a){this.Tb!==a&&(this.Tb=a)}},rev:{get:function(){return this.Wa},set:function(a){this.Wa!==a&&(this.Wa=a)}},forest:{get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a)}},portFromPos:{get:function(){return this.K},set:function(a){this.K!==a&&(this.K=a)}},portToPos:{
get:function(){return this.La},set:function(a){this.La!==a&&(this.La=a)}},portFromColOffset:{get:function(){return this.u},set:function(a){this.u!==a&&(this.u=a)}},portToColOffset:{get:function(){return this.da},set:function(a){this.da!==a&&(this.da=a)}}});ts.className="LayeredDigraphEdge";
function us(){ui.call(this);this.Gb=new F;this.Go=vs;this.ad=ws;this.yp=xs;this.Gr=ys;this.dw=[];this.Zc=!0;this.Bb=zs;this.xd=(new L(10,10)).freeze();var a=new As(this);this.T=new Bs(a);this.U=new Bs(a);this.ru=[]}oa(us,ui);us.prototype.cloneProtected=function(a){ui.prototype.cloneProtected.call(this,a);a.Go=this.Go;a.yp=this.yp;a.Gr=this.Gr;a.Zc=this.Zc;a.Bb=this.Bb;a.xd.assign(this.xd);a.T.copyInheritedPropertiesFrom(this.T);a.U.copyInheritedPropertiesFrom(this.U)};
us.prototype.hb=function(a){a.classType===us?0===a.name.indexOf("Alignment")?this.alignment=a:0===a.name.indexOf("Arrangement")?this.arrangement=a:0===a.name.indexOf("Compaction")?this.compaction=a:0===a.name.indexOf("Path")?this.path=a:0===a.name.indexOf("Sorting")?this.sorting=a:0===a.name.indexOf("Style")?this.treeStyle=a:A("Unknown enum value: "+a):ui.prototype.hb.call(this,a)};us.prototype.createNetwork=function(){return new As(this)};
us.prototype.makeNetwork=function(a){function b(a){if(a instanceof U)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof S){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof P?(c.hg(a.nodes,!0,b),c.hg(a.links,!0,b)):a instanceof kg?c.hg(a.memberParts,!1,b):c.hg(a.iterator,!1,b);return c};
us.prototype.doLayout=function(a){null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==Cs&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof P&&(b=a);this.path===vs&&null!==b?this.ad=b.isTreePathToChildren?ws:Ds:this.ad=this.path===vs?ws:this.path;if(0<this.network.vertexes.count){this.network.Kp();for(a=this.network.vertexes.iterator;a.next();)b=a.value,b.initialized=!1,b.level=0,b.parent=null,b.children=[];if(0<this.Gb.count){a=
new F;for(b=this.Gb.iterator;b.next();){var c=b.value;c instanceof U?(c=this.network.Bi(c),null!==c&&a.add(c)):c instanceof Bs&&a.add(c)}this.Gb=a}0===this.Gb.count&&this.findRoots();for(a=this.Gb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,Es(this,b));b=this.network.vertexes;for(a=null;a=Fs(b),0<a.count;)b=Gs(this,a),null!==b&&this.Gb.add(b),b.initialized=!0,Es(this,b),b=a;for(a=this.Gb.iterator;a.next();)b=a.value,b instanceof Bs&&Hs(this,b);for(a=this.Gb.iterator;a.next();)b=
a.value,b instanceof Bs&&Is(this,b);for(a=this.Gb.iterator;a.next();)b=a.value,b instanceof Bs&&Js(this,b);this.Cu();if(this.layerStyle===Ks){a=[];for(b=this.network.vertexes.iterator;b.next();){c=b.value;var d=c.parent;null===d&&(d=c);d=0===d.angle||180===d.angle;var e=a[c.level];void 0===e&&(e=0);a[c.level]=Math.max(e,d?c.width:c.height)}for(b=0;b<a.length;b++)void 0===a[b]&&(a[b]=0);this.dw=a;for(b=this.network.vertexes.iterator;b.next();)c=b.value,d=c.parent,null===d&&(d=c),0===d.angle||180===
d.angle?(180===d.angle&&(c.focusX+=a[c.level]-c.width),c.width=a[c.level]):(270===d.angle&&(c.focusY+=a[c.level]-c.height),c.height=a[c.level])}else if(this.layerStyle===Ls)for(a=this.network.vertexes.iterator;a.next();){b=a.value;c=0===b.angle||180===b.angle;d=-1;for(e=0;e<b.children.length;e++){var f=b.children[e];d=Math.max(d,c?f.width:f.height)}if(0<=d)for(e=0;e<b.children.length;e++)f=b.children[e],c?(180===b.angle&&(f.focusX+=d-f.width),f.width=d):(270===b.angle&&(f.focusY+=d-f.height),f.height=
d)}for(a=this.Gb.iterator;a.next();)b=a.value,b instanceof Bs&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Gb=new F;this.isValidLayout=!0};function Fs(a){var b=new F;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b}
us.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.ad){case ws:0===c.sourceEdges.count&&this.Gb.add(c);break;case Ds:0===c.destinationEdges.count&&this.Gb.add(c);break;default:A("Unhandled path value "+this.ad.toString())}}0===this.Gb.count&&(a=Gs(this,a),null!==a&&this.Gb.add(a))};
function Gs(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.ad){case ws:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case Ds:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:A("Unhandled path value "+a.ad.toString())}}return d}
function Es(a,b){if(null!==b){switch(a.ad){case ws:if(0<b.destinationEdges.count){for(var c=new E,d=b.destinationVertexes;d.next();){var e=d.value;Ms(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.Ma())}break;case Ds:if(0<b.sourceEdges.count){c=new E;for(d=b.sourceVertexes;d.next();)e=d.value,Ms(a,b,e)&&c.add(e);0<c.count&&(b.children=c.Ma())}break;default:A("Unhandled path value"+a.ad.toString())}c=b.children;d=c.length;for(e=0;e<d;e++){var f=c[e];f.initialized=!0;f.level=b.level+1;f.parent=b;a.Gb.remove(f)}for(b=
0;b<d;b++)Es(a,c[b])}}function Ms(a,b,c){if(c.initialized){if(null===b)var d=!1;else{for(d=b.parent;null!==d&&d!==c;)d=d.parent;d=d===c}if(d||c.level>b.level)return!1;a.removeChild(c.parent,c)}return!0}us.prototype.removeChild=function(a,b){if(null!==a&&null!==b){for(var c=a.children,d=0,e=0;e<c.length;e++)c[e]===b&&d++;if(0<d){d=Array(c.length-d);for(var f=e=0;f<c.length;f++)c[f]!==b&&(d[e++]=c[f]);a.children=d}}};
function Hs(a,b){if(null!==b){a.initializeTreeVertexValues(b);b.alignment===Ns&&a.sortTreeVertexChildren(b);for(var c=0,d=b.childrenCount,e=0,f=b.children,g=f.length,h=0;h<g;h++){var k=f[h];Hs(a,k);c+=k.descendantCount+1;d=Math.max(d,k.maxChildrenCount);e=Math.max(e,k.maxGenerationCount)}b.descendantCount=c;b.maxChildrenCount=d;b.maxGenerationCount=0<d?e+1:0}}
function Os(a,b){switch(a.yp){default:case xs:return null!==b.parent?b.parent:a.T;case Ps:return null===b.parent?a.T:null===b.parent.parent?a.U:b.parent;case Qs:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.U:a.T;case Rs:var c=!0;if(0===b.childrenCount)c=!1;else for(var d=b.children,e=d.length,f=0;f<e;f++)if(0<d[f].childrenCount){c=!1;break}return c&&null!==b.parent?a.U:null!==b.parent?b.parent:a.T}}
us.prototype.initializeTreeVertexValues=function(a){a.copyInheritedPropertiesFrom(Os(this,a));if(null!==a.parent&&a.parent.alignment===Ns){for(var b=a.angle,c=a.parent.children,d=0;d<c.length&&a!==c[d];)d++;0===d%2?d!==c.length-1&&(b=90===b?180:180===b?270:270===b?180:270):b=90===b?0:180===b?90:270===b?0:90;a.angle=b}a.initialized=!0};function Is(a,b){if(null!==b){a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Is(a,b[d])}}us.prototype.assignTreeVertexValues=function(){};
function Js(a,b){if(null!==b){b.alignment!==Ns&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Js(a,b[d])}}us.prototype.sortTreeVertexChildren=function(a){switch(a.sorting){case Ss:break;case Ts:a.children.reverse();break;case Us:a.children.sort(a.comparer);break;case Vs:a.children.sort(a.comparer);a.children.reverse();break;default:A("Unhandled sorting value "+a.sorting.toString())}};us.prototype.Cu=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)};
us.prototype.addComments=function(a){var b=a.angle,c=a.parent,d=0;var e=!1;null!==c&&(d=c.angle,e=c.alignment,e=Ws(e));b=90===b||270===b;d=90===d||270===d;c=0===a.childrenCount;var f=0,g=0,h=0,k=a.commentSpacing;if(null!==a.node)for(var l=a.node.Pu();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.ac(),m=m.measuredBounds,b&&!c||!e&&!d&&c||e&&d&&c?(f=Math.max(f,m.width),g+=m.height+Math.abs(h)):(f+=m.width+Math.abs(h),g=Math.max(g,
m.height)),h=k)}null!==a.comments&&(b&&!c||!e&&!d&&c||e&&d&&c?(f+=Math.abs(a.commentMargin),g=Math.max(0,g-a.height)):(g+=Math.abs(a.commentMargin),f=Math.max(0,f-a.width)),e=N.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,N.free(e))};function Ws(a){return a===Xs||a===Ns||a===Ys||a===Zs}function $s(a){return a===Xs||a===Ns}
function at(a){var b=a.parent;if(null!==b){var c=b.alignment;if(Ws(c)){if($s(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===Ys)return!0}}return!1}
us.prototype.layoutComments=function(a){if(null!==a.comments){var b=a.node.measuredBounds,c=a.parent,d=a.angle,e=0;var f=!1;null!==c&&(e=c.angle,f=c.alignment,f=Ws(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=at(a),k=0,l=a.comments,m=l.length,n=G.alloc(),p=0;p<m;p++){var q=l[p],r=q.measuredBounds;if(d&&!g||!f&&!c&&g||f&&c&&g){if(135<e&&!f||c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x-a.commentMargin-r.width,a.bounds.y+k),q.move(n),q=q.ud();q.next();){var u=q.value;u.fromSpot=
Ud;u.toSpot=Vd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Vd,u.toSpot=Ud;else if(0<=a.commentMargin)for(n.h(a.bounds.x+2*a.focus.x+a.commentMargin,a.bounds.y+k),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Vd,u.toSpot=Ud;else for(n.h(a.bounds.x+a.commentMargin-r.width,a.bounds.y+k),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Ud,u.toSpot=Vd;k=0<=a.commentSpacing?k+(r.height+a.commentSpacing):k+(a.commentSpacing-r.height)}else{if(135<
e&&!f||!c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y-a.commentMargin-r.height),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Td,u.toSpot=Wd;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Wd,u.toSpot=Td;else if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y+a.commentMargin),q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Wd,u.toSpot=Td;else for(n.h(a.bounds.x+k,a.bounds.y+a.commentMargin-r.height),
q.move(n),q=q.ud();q.next();)u=q.value,u.fromSpot=Td,u.toSpot=Wd;k=0<=a.commentSpacing?k+(r.width+a.commentSpacing):k+(a.commentSpacing-r.width)}}G.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.ad===ws)for(a=a.destinationEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.fromEndSegmentLength=0<b?b:NaN);else for(a=a.sourceEdges;a.next();)e=a.value.link,null===e||e.isAvoiding||(e.toEndSegmentLength=0<b?b:NaN)}};
us.prototype.layoutTree=function(a){if(null!==a){for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case bt:ct(this,a);break;case dt:if(a.alignment===Ns)ct(this,a);else if(0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=Ws(c)),d=at(a),a.S.h(0,0),a.ua.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.ia.h(0,0):180===b&&!c||(90===b||270===b)&&d?a.ia.h(a.width-2*a.focus.x,0):a.ia.h(0,a.height-2*a.focus.y),
a.Xp=null,a.jq=null;else{var e=et(a);b=90===e||270===e;var f=0,g=a.children,h=g.length;for(c=0;c<h;c++)d=g[c],f=Math.max(f,b?d.ua.width:d.ua.height);var k=a.alignment,l=k===ft,m=Ws(k),n=Math.max(0,a.breadthLimit);c=gt(a);var p=a.nodeSpacing,q=ht(a),r=a.rowSpacing,u=0;if(k===it||l||a.nm||a.om&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var v=a.height,x=0,y=0,z=0,B=null,C=null,I=0,J=0,K=0,X=0,Q=0,ia=0,ja=0,M=0;m&&!$s(k)&&135<e&&g.reverse();if($s(k))if(1<h)for(var R=0;R<h;R++)0===R%
2&&R!==h-1&&(M=Math.max(M,b?g[R].ua.width:g[R].ua.height));else 1===h&&(M=b?g[0].ua.width:g[0].ua.height);if(m){switch(k){case Xs:y=135>e?jt(a,g,M,x,y):kt(a,g,M,x,y);M=y.x;x=y.width;y=y.height;break;case Ys:for(B=0;B<h;B++)C=g[B],n=C.ua,z=0===ia?0:r,b?(C.S.h(f-n.width,X+z),x=Math.max(x,n.width),y=Math.max(y,X+z+n.height),X+=z+n.height):(C.S.h(K+z,f-n.height),x=Math.max(x,K+z+n.width),y=Math.max(y,n.height),K+=z+n.width),ia++;break;case Zs:for(B=0;B<h;B++)C=g[B],f=C.ua,n=0===ia?0:r,b?(C.S.h(p/2+a.focus.x,
X+n),x=Math.max(x,f.width),y=Math.max(y,X+n+f.height),X+=n+f.height):(C.S.h(K+n,p/2+a.focus.y),x=Math.max(x,K+n+f.width),y=Math.max(y,f.height),K+=n+f.width),ia++}B=mt(this,2);C=mt(this,2);b?(B[0].h(0,0),B[1].h(0,y),C[0].h(x,0)):(B[0].h(0,0),B[1].h(x,0),C[0].h(0,y));C[1].h(x,y)}else for(R=0;R<h;R++){var Ba=g[R],ob=Ba.ua;if(b){0<n&&0<ia&&K+p+ob.width>n&&(K<f&&nt(a,k,f-K,0,ja,R-1),Q++,ia=0,ja=R,z=y,K=0,X=135<e?-y-r:y+r);ot(this,Ba,0,X);var Ia=0;if(0===ia){if(B=Ba.Xp,C=Ba.jq,I=ob.width,J=ob.height,null===
B||null===C||e!==et(Ba))B=mt(this,2),C=mt(this,2),B[0].h(0,0),B[1].h(0,J),C[0].h(I,0),C[1].h(I,J)}else{var Ea=Ka();J=pt(this,a,Ba,B,C,I,J,Ea);Ia=J.x;B=Ea[0];C=Ea[1];I=J.width;J=J.height;Oa(Ea);K<ob.width&&0>Ia&&(qt(a,-Ia,0,ja,R-1),rt(B,-Ia,0),rt(C,-Ia,0),Ia=0)}Ba.S.h(Ia,X);x=Math.max(x,I);y=Math.max(y,z+(0===Q?0:r)+ob.height);K=I}else{0<n&&0<ia&&X+p+ob.height>n&&(X<f&&nt(a,k,0,f-X,ja,R-1),Q++,ia=0,ja=R,z=x,X=0,K=135<e?-x-r:x+r);ot(this,Ba,K,0);Ia=0;if(0===ia){if(B=Ba.Xp,C=Ba.jq,I=ob.width,J=ob.height,
null===B||null===C||e!==et(Ba))B=mt(this,2),C=mt(this,2),B[0].h(0,0),B[1].h(I,0),C[0].h(0,J),C[1].h(I,J)}else Ea=Ka(),J=pt(this,a,Ba,B,C,I,J,Ea),Ia=J.x,B=Ea[0],C=Ea[1],I=J.width,J=J.height,Oa(Ea),X<ob.height&&0>Ia&&(qt(a,0,-Ia,ja,R-1),rt(B,0,-Ia),rt(C,0,-Ia),Ia=0);Ba.S.h(K,Ia);y=Math.max(y,J);x=Math.max(x,z+(0===Q?0:r)+ob.width);X=J}ia++}0<Q&&(b?(y+=Math.max(0,c),K<x&&nt(a,k,x-K,0,ja,h-1),0<u&&(l||qt(a,u,0,0,h-1),x+=u)):(x+=Math.max(0,c),X<y&&nt(a,k,0,y-X,ja,h-1),0<u&&(l||qt(a,0,u,0,h-1),y+=u)));
u=l=0;switch(k){case st:b?l+=x/2-a.focus.x-q/2:u+=y/2-a.focus.y-q/2;break;case tt:0<Q?b?l+=x/2-a.focus.x-q/2:u+=y/2-a.focus.y-q/2:b?(M=g[0].S.x+g[0].ia.x,l+=M+(g[h-1].S.x+g[h-1].ia.x+2*g[h-1].focus.x-M)/2-a.focus.x-q/2):(M=g[0].S.y+g[0].ia.y,u+=M+(g[h-1].S.y+g[h-1].ia.y+2*g[h-1].focus.y-M)/2-a.focus.y-q/2);break;case it:b?(l-=q,x+=q):(u-=q,y+=q);break;case ft:b?(l+=x-a.width+q,x+=q):(u+=y-a.height+q,y+=q);break;case Xs:b?1<h?l+=M+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].ia.x:1<h?u+=M+p/2-a.focus.y:
u+=g[0].focus.y-a.focus.y+g[0].ia.y;break;case Ys:b?l+=x+p/2-a.focus.x:u+=y+p/2-a.focus.y;break;case Zs:break;default:A("Unhandled alignment value "+k.toString())}for(q=0;q<h;q++)M=g[q],b?M.S.h(M.S.x+M.ia.x-l,M.S.y+(135<e?(m?-y:-M.ua.height)+M.ia.y-c:v+c+M.ia.y)):M.S.h(M.S.x+(135<e?(m?-x:-M.ua.width)+M.ia.x-c:d+c+M.ia.x),M.S.y+M.ia.y-u);h=g=0;m?b?(x=ut(a,x,l),0>l&&(l=0),135<e&&(u+=y+c),y+=v+c,k===Zs&&(g+=p/2+a.focus.x),h+=v+c):(135<e&&(l+=x+c),x+=d+c,y=vt(a,y,u),0>u&&(u=0),k===Zs&&(h+=p/2+a.focus.y),
g+=d+c):b?(null===a.comments?d>x&&(x=wt(k,d-x,0),g=x.x,h=x.y,x=d,l=0):x=ut(a,x,l),0>l&&(g-=l,l=0),135<e&&(u+=y+c),y=Math.max(Math.max(y,v),y+v+c),h+=v+c):(135<e&&(l+=x+c),x=Math.max(Math.max(x,d),x+d+c),null===a.comments?v>y&&(y=wt(k,0,v-y),g=y.x,h=y.y,y=v,u=0):y=vt(a,y,u),0>u&&(h-=u,u=0),g+=d+c);if(0<Q)e=mt(this,4),Q=mt(this,4),b?(e[2].h(0,v+c),e[3].h(e[2].x,y),Q[2].h(x,e[2].y),Q[3].h(Q[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(x,e[2].y),Q[2].h(e[2].x,y),Q[3].h(e[3].x,Q[2].y));else{e=mt(this,B.length+
2);Q=mt(this,C.length+2);for(k=0;k<B.length;k++)m=B[k],e[k+2].h(m.x+g,m.y+h);for(k=0;k<C.length;k++)m=C[k],Q[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,v),e[2].y<e[1].y&&(e[2].x>e[0].x?e[2].assign(e[1]):e[1].assign(e[2])),e[3].y<e[2].y&&(e[3].x>e[0].x?e[3].assign(e[2]):e[2].assign(e[3])),Q[0].h(l+d,0),Q[1].h(Q[0].x,v),Q[2].y<Q[1].y&&(Q[2].x<Q[0].x?Q[2].assign(Q[1]):Q[1].assign(Q[2])),Q[3].y<Q[2].y&&(Q[3].x<Q[0].x?Q[3].assign(Q[2]):Q[2].assign(Q[3])),e[2].y-=c/2,Q[2].y-=c/2):(e[0].h(0,u),e[1].h(d,
e[0].y),e[2].x<e[1].x&&(e[2].y>e[0].y?e[2].assign(e[1]):e[1].assign(e[2])),e[3].x<e[2].x&&(e[3].y>e[0].y?e[3].assign(e[2]):e[2].assign(e[3])),Q[0].h(0,u+v),Q[1].h(d,Q[0].y),Q[2].x<Q[1].x&&(Q[2].y<Q[0].y?Q[2].assign(Q[1]):Q[1].assign(Q[2])),Q[3].x<Q[2].x&&(Q[3].y<Q[0].y?Q[3].assign(Q[2]):Q[2].assign(Q[3])),e[2].x-=c/2,Q[2].x-=c/2);xt(this,B);xt(this,C);a.Xp=e;a.jq=Q;a.ia.h(l,u);a.ua.h(x,y)}break;default:A("Unhandled compaction value "+a.compaction.toString())}}};
function ct(a,b){if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=Ws(c));var e=at(b);b.S.h(0,0);b.ua.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.ia.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.ia.h(b.width-2*b.focus.x,0):b.ia.h(0,b.height-2*b.focus.y)}else{d=et(b);c=90===d||270===d;var f=0;e=b.children;for(var g=e.length,h=0;h<g;h++){var k=e[h];f=Math.max(f,c?k.ua.width:k.ua.height)}var l=b.alignment,m=l===it,n=l===
ft;h=Ws(l);var p=Math.max(0,b.breadthLimit);k=gt(b);var q=b.nodeSpacing,r=ht(b),u=m||n?0:r/2,v=b.rowSpacing,x=0;if(m||n||b.nm||b.om&&1===b.maxGenerationCount)x=Math.max(0,b.rowIndent);m=b.width;var y=b.height,z=0,B=0,C=0,I=0,J=0,K=0,X=0,Q=0,ia=0;h&&!$s(l)&&135<d&&e.reverse();if($s(l))if(1<g)for(var ja=0;ja<g;ja++){var M=e[ja],R=M.ua;0===ja%2&&ja!==g-1&&(ia=Math.max(ia,(c?R.width:R.height)+yt(M)-q))}else 1===g&&(ia=c?e[0].ua.width:e[0].ua.height);if(h)switch(l){case Xs:case Ns:B=135>d?jt(b,e,ia,z,
B):kt(b,e,ia,z,B);ia=B.x;z=B.width;B=B.height;break;case Ys:for(a=0;a<g;a++)p=e[a],u=p.ua,C=0===X?0:v,c?(p.S.h(f-u.width,J+C),z=Math.max(z,u.width),B=Math.max(B,J+C+u.height),J+=C+u.height):(p.S.h(I+C,f-u.height),z=Math.max(z,I+C+u.width),B=Math.max(B,u.height),I+=C+u.width),X++;break;case Zs:for(f=0;f<g;f++)a=e[f],p=a.ua,u=0===X?0:v,c?(a.S.h(q/2+b.focus.x,J+u),z=Math.max(z,p.width),B=Math.max(B,J+u+p.height),J+=u+p.height):(a.S.h(I+u,q/2+b.focus.y),z=Math.max(z,I+u+p.width),B=Math.max(B,p.height),
I+=u+p.width),X++}else for(ja=0;ja<g;ja++){M=e[ja];R=M.ua;if(c){0<p&&0<X&&I+q+R.width>p&&(I<f&&nt(b,l,f-I,0,Q,ja-1),K++,X=0,Q=ja,C=B,I=0,J=135<d?-B-v:B+v);var Ba=0===X?u:q;ot(a,M,0,J);M.S.h(I+Ba,J);z=Math.max(z,I+Ba+R.width);B=Math.max(B,C+(0===K?0:v)+R.height);I+=Ba+R.width}else 0<p&&0<X&&J+q+R.height>p&&(J<f&&nt(b,l,0,f-J,Q,ja-1),K++,X=0,Q=ja,C=z,J=0,I=135<d?-z-v:z+v),Ba=0===X?u:q,ot(a,M,I,0),M.S.h(I,J+Ba),B=Math.max(B,J+Ba+R.height),z=Math.max(z,C+(0===K?0:v)+R.width),J+=Ba+R.height;X++}0<K&&(c?
(B+=Math.max(0,k),I<z&&nt(b,l,z-I,0,Q,g-1),0<x&&(n||qt(b,x,0,0,g-1),z+=x)):(z+=Math.max(0,k),J<B&&nt(b,l,0,B-J,Q,g-1),0<x&&(n||qt(b,0,x,0,g-1),B+=x)));x=n=0;switch(l){case st:c?n+=z/2-b.focus.x-r/2:x+=B/2-b.focus.y-r/2;break;case tt:0<K?c?n+=z/2-b.focus.x-r/2:x+=B/2-b.focus.y-r/2:c?(l=e[0].S.x+e[0].ia.x,n+=l+(e[g-1].S.x+e[g-1].ia.x+2*e[g-1].focus.x-l)/2-b.focus.x-r/2):(l=e[0].S.y+e[0].ia.y,x+=l+(e[g-1].S.y+e[g-1].ia.y+2*e[g-1].focus.y-l)/2-b.focus.y-r/2);break;case it:c?(n-=r,z+=r):(x-=r,B+=r);break;
case ft:c?(n+=z-b.width+r,z+=r):(x+=B-b.height+r,B+=r);break;case Xs:case Ns:c?1<g?n+=ia+q/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].ia.x:1<g?x+=ia+q/2-b.focus.y:x+=e[0].focus.y-b.focus.y+e[0].ia.y;break;case Ys:c?n+=z+q/2-b.focus.x:x+=B+q/2-b.focus.y;break;case Zs:break;default:A("Unhandled alignment value "+l.toString())}for(r=0;r<g;r++)l=e[r],c?l.S.h(l.S.x+l.ia.x-n,l.S.y+(135<d?(h?-B:-l.ua.height)+l.ia.y-k:y+k+l.ia.y)):l.S.h(l.S.x+(135<d?(h?-z:-l.ua.width)+l.ia.x-k:m+k+l.ia.x),l.S.y+l.ia.y-x);
c?(z=ut(b,z,n),0>n&&(n=0),135<d&&(x+=B+k),B+=y+k):(135<d&&(n+=z+k),z+=m+k,B=vt(b,B,x),0>x&&(x=0));b.ia.h(n,x);b.ua.h(z,B)}}
function jt(a,b,c,d,e){var f=b.length;if(0===f)return new N(c,0,d,e);if(1===f)return a=b[0],d=a.ua.width,e=a.ua.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===et(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var q=b[p],r=q.ua,u=0===l?0:h;if(k){var v=yt(q)-g;q.S.h(c-(r.width+v),n+u);d=Math.max(d,r.width+v);e=Math.max(e,n+u+r.height);n+=u+r.height}else v=yt(q)-g,q.S.h(m+u,c-(r.height+v)),e=Math.max(e,r.height+v),d=Math.max(d,m+u+r.width),m+=u+r.width;l++}l=0;q=m;p=n;k?
(m=c+g,n=0):(m=0,n=c+g);for(r=0;r<f;r++)if(0!==r%2){u=b[r];v=u.ua;var x=0===l?0:h;if(k){var y=yt(u)-g;u.S.h(m+y,n+x);d=Math.max(d,m+v.width+y);e=Math.max(e,n+x+v.height);n+=x+v.height}else y=yt(u)-g,u.S.h(m+x,n+y),d=Math.max(d,m+x+v.width),e=Math.max(e,n+v.height+y),m+=x+v.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.ua,h=null===b.parent?0:b.parent.rowSpacing,k?(b.S.h(c+g/2-b.focus.x-b.ia.x,e+h),k=c+g/2-b.focus.x-b.ia.x,d=Math.max(d,k+f.width),0>k&&(d-=k),e=Math.max(e,Math.max(p,n)+h+f.height),0>b.S.x&&
(c=zt(a,b.S.x,!1,c,g))):(b.S.h(d+h,c+g/2-b.focus.y-b.ia.y),d=Math.max(d,Math.max(q,m)+h+f.width),n=c+g/2-b.focus.y-b.ia.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.S.y&&(c=zt(a,b.S.y,!0,c,g))));return new N(c,0,d,e)}
function kt(a,b,c,d,e){var f=b.length;if(0===f)return new N(c,0,d,e);if(1===f)return b=b[0],d=b.ua.width,e=b.ua.height,new N(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===et(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var q=b[p],r=q.ua,u=0===l?0:h;if(k){var v=yt(q)-g;n-=u+r.height;q.S.h(c-(r.width+v),n);d=Math.max(d,r.width+v);e=Math.max(e,Math.abs(n))}else v=yt(q)-g,m-=u+r.width,q.S.h(m,c-(r.height+v)),e=Math.max(e,r.height+v),d=Math.max(d,Math.abs(m));l++}l=0;q=m;p=n;k?(m=
c+g,n=0):(m=0,n=c+g);for(r=0;r<f;r++)if(0!==r%2){u=b[r];v=u.ua;var x=0===l?0:h;if(k){var y=yt(u)-g;n-=x+v.height;u.S.h(m+y,n);d=Math.max(d,m+v.width+y);e=Math.max(e,Math.abs(n))}else y=yt(u)-g,m-=x+v.width,u.S.h(m,n+y),e=Math.max(e,n+v.height+y),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.ua,r=null===h.parent?0:h.parent.rowSpacing,k?(h.S.h(c+g/2-h.focus.x-h.ia.x,-e-l.height-r),m=c+g/2-h.focus.x-h.ia.x,d=Math.max(d,m+l.width),0>m&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+r+l.height),
0>h.S.x&&(c=zt(a,h.S.x,!1,c,g))):(h.S.h(-d-l.width-r,c+g/2-h.focus.y-h.ia.y),d=Math.max(d,Math.abs(Math.min(q,m))+r+l.width),n=c+g/2-h.focus.y-h.ia.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.S.y&&(c=zt(a,h.S.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.S.h(g.S.x,g.S.y+e):g.S.h(g.S.x+d,g.S.y);return new N(c,0,d,e)}function yt(a){return null===a.parent?0:a.parent.nodeSpacing}
function zt(a,b,c,d,e){a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].S.h(a[g].S.x,a[g].S.y-b):a[g].S.h(a[g].S.x-b,a[g].S.y);b=a[f-1];return Math.max(d,c?b.ia.y+b.focus.y-e/2:b.ia.x+b.focus.x-e/2)}
function ut(a,b,c){switch(a.alignment){case tt:case st:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case it:return a.width>b?a.width:b;case ft:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case Xs:case Ns:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case Ys:return a.width-a.focus.x+a.nodeSpacing/2+b;case Zs:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}}
function vt(a,b,c){switch(a.alignment){case tt:case st:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case it:return a.height>b?a.height:b;case ft:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case Xs:case Ns:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case Ys:return a.height-a.focus.y+a.nodeSpacing/2+b;case Zs:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}}
function wt(a,b,c){switch(a){case st:b/=2;c/=2;break;case tt:b/=2;c/=2;break;case it:c=b=0;break;case ft:break;default:A("Unhandled alignment value "+a.toString())}return new G(b,c)}function nt(a,b,c,d,e,f){b=wt(b,c,d);qt(a,b.x,b.y,e,f)}function qt(a,b,c,d,e){if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].S;f.x+=b;f.y+=c}}
function ot(a,b,c,d){var e=b.parent;switch(a.ad){case ws:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case Ds:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:A("Unhandled path value "+a.ad.toString())}}function rt(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}}
function pt(a,b,c,d,e,f,g,h){var k=et(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,q=c.Xp,r=c.jq;g=c.ua;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===q||k!==et(c))q=mt(a,2),r=mt(a,2),l?(q[0].h(0,0),q[1].h(0,g.height),r[0].h(g.width,0),r[1].h(r[0].x,q[1].y)):(q[0].h(0,0),q[1].h(g.width,0),r[0].h(0,g.height),r[1].h(q[1].x,r[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===q||2>q.length))for(e=c=0;c<n.length&&e<q.length;){f=n[c];var v=q[e];k=v.x;l=v.y;k+=d;var x=
f;c+1<n.length&&(x=n[c+1]);var y=v;v=y.x;y=y.y;e+1<q.length&&(y=q[e+1],v=y.x,y=y.y,v+=d);var z=p;f.y===l?z=k-f.x:f.y>l&&f.y<y?z=k+(f.y-l)/(y-l)*(v-k)-f.x:l>f.y&&l<x.y&&(z=k-(f.x+(l-f.y)/(x.y-f.y)*(x.x-f.x)));z<p&&(p=z);x.y<=f.y?c++:y<=l?e++:(x.y<=y&&c++,y<=x.y&&e++)}p=d-p;p+=m;c=q;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=mt(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].y<b[0].y;)l=c[f++],m[d++].h(l.x+e,l.y);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].y;f<
c.length&&c[f].y<=k;)f++;for(;f<c.length&&c[f].y>k;)l=c[f++],m[d++].h(l.x+e,l.y);c=mt(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);xt(a,m);d=c}f=r;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=mt(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)x=n[c++],m[e++].h(x.x,x.y);for(;l<f.length;)x=f[l++],m[e++].h(x.x+k,x.y);for(f=f[f.length-1].y;c<n.length&&n[c].y<=f;)c++;for(;c<n.length&&n[c].y>f;)k=n[c++],m[e++].h(k.x,k.y);f=mt(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);xt(a,m);e=f}f=
Math.max(0,p)+g.width;g=u;xt(a,b);xt(a,q);xt(a,n);xt(a,r);h[0]=d;h[1]=e;return new N(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===q||2>q.length))for(e=c=0;c<n.length&&e<q.length;)f=n[c],v=q[e],k=v.x,l=v.y,l+=p,x=f,c+1<n.length&&(x=n[c+1]),y=v,v=y.x,y=y.y,e+1<q.length&&(y=q[e+1],v=y.x,y=y.y,y+=p),z=d,f.x===k?z=l-f.y:f.x>k&&f.x<v?z=l+(f.x-k)/(v-k)*(y-l)-f.y:k>f.x&&k<x.x&&(z=l-(f.y+(k-f.x)/(x.x-f.x)*(x.y-f.y))),z<d&&(d=z),x.x<=f.x?c++:v<=k?e++:(x.x<=v&&c++,v<=x.x&&e++);p-=d;p+=m;c=q;e=p;if(null===
b||2>b.length||null===c||2>c.length)d=null;else{m=mt(a,b.length+c.length);for(d=f=k=0;f<c.length&&c[f].x<b[0].x;)l=c[f++],m[d++].h(l.x,l.y+e);for(;k<b.length;)l=b[k++],m[d++].h(l.x,l.y);for(k=b[b.length-1].x;f<c.length&&c[f].x<=k;)f++;for(;f<c.length&&c[f].x>k;)l=c[f++],m[d++].h(l.x,l.y+e);c=mt(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);xt(a,m);d=c}f=r;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=mt(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)x=n[c++],m[e++].h(x.x,x.y);
for(;l<f.length;)x=f[l++],m[e++].h(x.x,x.y+k);for(f=f[f.length-1].x;c<n.length&&n[c].x<=f;)c++;for(;c<n.length&&n[c].x>f;)k=n[c++],m[e++].h(k.x,k.y);f=mt(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);xt(a,m);e=f}f=u;g=Math.max(0,p)+g.height;xt(a,b);xt(a,q);xt(a,n);xt(a,r);h[0]=d;h[1]=e;return new N(p,0,f,g)}function mt(a,b){a=a.ru[b];if(void 0!==a&&(a=a.pop(),void 0!==a))return a;a=[];for(var c=0;c<b;c++)a[c]=new G;return a}
function xt(a,b){var c=b.length,d=a.ru[c];void 0===d&&(d=[],a.ru[c]=d);d.push(b)}
us.prototype.arrangeTrees=function(){if(this.Bb===Cs)for(var a=this.Gb.iterator;a.next();){var b=a.value;if(b instanceof Bs){var c=b.node;if(null!==c){var d=c.position;c=d.x;d=d.y;isFinite(c)||(c=0);isFinite(d)||(d=0);At(this,b,c,d)}}}else{a=[];for(b=this.Gb.iterator;b.next();)c=b.value,c instanceof Bs&&a.push(c);switch(this.sorting){case Ss:break;case Ts:a.reverse();break;case Us:a.sort(this.comparer);break;case Vs:a.sort(this.comparer);a.reverse();break;default:A("Unhandled sorting value "+this.sorting.toString())}c=
this.arrangementOrigin;b=c.x;c=c.y;for(d=0;d<a.length;d++){var e=a[d];At(this,e,b+e.ia.x,c+e.ia.y);switch(this.Bb){case zs:c+=e.ua.height+this.xd.height;break;case Bt:b+=e.ua.width+this.xd.width;break;default:A("Unhandled arrangement value "+this.Bb.toString())}}}};function At(a,b,c,d){if(null!==b){b.x=c;b.y=d;b=b.children;for(var e=b.length,f=0;f<e;f++){var g=b[f];At(a,g,c+g.S.x,d+g.S.y)}}}us.prototype.commitLayout=function(){this.Dv();this.commitNodes();this.Gu();this.isRouting&&this.commitLinks()};
us.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)};
us.prototype.Gu=function(){if(this.layerStyle===Ks){for(var a=this.dw,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Wc(e.bounds);var f=b[e.level];void 0===f?f=gt(e):f=Math.max(f,gt(e));b[e.level]=f}for(d=0;d<b.length;d++)void 0===b[d]&&(b[d]=0);90===this.angle||270===this.angle?(c.Vc(this.nodeSpacing/2,this.layerSpacing),d=new G(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Vc(this.layerSpacing,this.nodeSpacing/2),d=new G(-this.layerSpacing/2,-this.nodeSpacing/
2));e=[];c=90===this.angle||270===this.angle?c.width:c.height;f=0;if(180===this.angle||270===this.angle)for(var g=0;g<a.length;g++)f+=a[g]+b[g];for(g=0;g<a.length;g++){var h=a[g]+b[g];270===this.angle?(f-=h,e.push(new N(0,f,c,h))):90===this.angle?(e.push(new N(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new N(f,0,h,c))):(e.push(new N(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};us.prototype.commitLayers=function(){};us.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};
us.prototype.Dv=function(){for(var a=this.Gb.iterator;a.next();){var b=a.value;b instanceof Bs&&Ct(this,b)}};function Ct(a,b){if(null!==b){a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Ct(a,b[d])}}
us.prototype.setPortSpots=function(a){var b=a.alignment;if(Ws(b)){var c=this.ad===ws,d=et(a);switch(d){case 0:var e=Vd;break;case 90:e=Wd;break;case 180:e=Ud;break;default:e=Td}var f=a.children,g=f.length;switch(b){case Xs:case Ns:for(b=0;b<g;b++){var h=f[b];h=(c?h.sourceEdges:h.destinationEdges).first();if(null!==h&&(h=h.link,null!==h)){var k=90===d||270===d?Ud:Td;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k=Ud;break;case 90:k=Td;break;case 180:k=Vd;break;default:k=Wd}else 0===b%2&&(k=90===d||270===
d?Vd:Wd);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case Ys:d=90===d||270===d?Vd:Wd;for(f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)));break;case Zs:for(d=90===d||270===d?Ud:Td,f=c?a.destinationEdges:a.sourceEdges;f.next();)g=f.value.link,
null!==g&&(c?(a.setsPortSpot&&(g.fromSpot=e),a.setsChildPortSpot&&(g.toSpot=d)):(a.setsPortSpot&&(g.fromSpot=d),a.setsChildPortSpot&&(g.toSpot=e)))}}else if(c=et(a),this.ad===ws)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Lb())switch(c){case 0:d.fromSpot=Vd;break;case 90:d.fromSpot=Wd;break;case 180:d.fromSpot=Ud;break;default:d.fromSpot=Td}else d.fromSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Lb())switch(c){case 0:d.toSpot=Ud;break;
case 90:d.toSpot=Td;break;case 180:d.toSpot=Vd;break;default:d.toSpot=Wd}else d.toSpot=a.childPortSpot}}else for(e=a.sourceEdges;e.next();)if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Lb())switch(c){case 0:d.toSpot=Vd;break;case 90:d.toSpot=Wd;break;case 180:d.toSpot=Ud;break;default:d.toSpot=Td}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Lb())switch(c){case 0:d.fromSpot=Ud;break;case 90:d.fromSpot=Td;break;case 180:d.fromSpot=Vd;break;default:d.fromSpot=Wd}else d.fromSpot=
a.childPortSpot}};function et(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function gt(a){var b=et(a);b=90===b||270===b;var c=a.layerSpacing;if(0<a.layerSpacingParentOverlap){var d=Math.min(1,a.layerSpacingParentOverlap);c-=b?a.height*d:a.width*d}c<(b?-a.height:-a.width)&&(c=b?-a.height:-a.width);return c}function ht(a){var b=et(a),c=a.nodeIndent;if(0<a.nodeIndentPastParent){var d=Math.min(1,a.nodeIndentPastParent);c+=90===b||270===b?a.width*d:a.height*d}return c=Math.max(0,c)}
pa.Object.defineProperties(us.prototype,{roots:{get:function(){return this.Gb},set:function(a){this.Gb!==a&&(this.Gb=a,this.B())}},path:{get:function(){return this.Go},set:function(a){this.Go!==a&&(this.Go=a,this.B())}},treeStyle:{get:function(){return this.yp},set:function(a){this.Bb===a||a!==xs&&a!==Qs&&a!==Rs&&a!==Ps||(this.yp=a,this.B())}},layerStyle:{get:function(){return this.Gr},
set:function(a){this.Bb===a||a!==ys&&a!==Ls&&a!==Ks||(this.Gr=a,this.B())}},comments:{get:function(){return this.Zc},set:function(a){this.Zc!==a&&(this.Zc=a,this.B())}},arrangement:{get:function(){return this.Bb},set:function(a){this.Bb===a||a!==zs&&a!==Bt&&a!==Cs||(this.Bb=a,this.B())}},arrangementSpacing:{get:function(){return this.xd},set:function(a){this.xd.A(a)||(this.xd.assign(a),this.B())}},rootDefaults:{
get:function(){return this.T},set:function(a){this.T!==a&&(this.T=a,this.B())}},alternateDefaults:{get:function(){return this.U},set:function(a){this.U!==a&&(this.U=a,this.B())}},sorting:{get:function(){return this.T.sorting},set:function(a){this.T.sorting===a||a!==Ss&&a!==Ts&&a!==Us&&!Vs||(this.T.sorting=a,this.B())}},comparer:{get:function(){return this.T.comparer},set:function(a){this.T.comparer!==
a&&(this.T.comparer=a,this.B())}},angle:{get:function(){return this.T.angle},set:function(a){this.T.angle!==a&&(0===a||90===a||180===a||270===a?(this.T.angle=a,this.B()):A("TreeLayout.angle must be 0, 90, 180, or 270"))}},alignment:{get:function(){return this.T.alignment},set:function(a){this.T.alignment!==a&&(this.T.alignment=a,this.B())}},nodeIndent:{get:function(){return this.T.nodeIndent},set:function(a){this.T.nodeIndent!==
a&&0<=a&&(this.T.nodeIndent=a,this.B())}},nodeIndentPastParent:{get:function(){return this.T.nodeIndentPastParent},set:function(a){this.T.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.T.nodeIndentPastParent=a,this.B())}},nodeSpacing:{get:function(){return this.T.nodeSpacing},set:function(a){this.T.nodeSpacing!==a&&(this.T.nodeSpacing=a,this.B())}},layerSpacing:{get:function(){return this.T.layerSpacing},set:function(a){this.T.layerSpacing!==
a&&(this.T.layerSpacing=a,this.B())}},layerSpacingParentOverlap:{get:function(){return this.T.layerSpacingParentOverlap},set:function(a){this.T.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.T.layerSpacingParentOverlap=a,this.B())}},compaction:{get:function(){return this.T.compaction},set:function(a){this.T.compaction===a||a!==bt&&a!==dt||(this.T.compaction=a,this.B())}},breadthLimit:{get:function(){return this.T.breadthLimit},
set:function(a){this.T.breadthLimit!==a&&0<=a&&(this.T.breadthLimit=a,this.B())}},rowSpacing:{get:function(){return this.T.rowSpacing},set:function(a){this.T.rowSpacing!==a&&(this.T.rowSpacing=a,this.B())}},rowIndent:{get:function(){return this.T.rowIndent},set:function(a){this.T.rowIndent!==a&&0<=a&&(this.T.rowIndent=a,this.B())}},commentSpacing:{get:function(){return this.T.commentSpacing},set:function(a){this.T.commentSpacing!==
a&&(this.T.commentSpacing=a,this.B())}},commentMargin:{get:function(){return this.T.commentMargin},set:function(a){this.T.commentMargin!==a&&(this.T.commentMargin=a,this.B())}},setsPortSpot:{get:function(){return this.T.setsPortSpot},set:function(a){this.T.setsPortSpot!==a&&(this.T.setsPortSpot=a,this.B())}},portSpot:{get:function(){return this.T.portSpot},set:function(a){this.T.portSpot.A(a)||(this.T.portSpot=
a,this.B())}},setsChildPortSpot:{get:function(){return this.T.setsChildPortSpot},set:function(a){this.T.setsChildPortSpot!==a&&(this.T.setsChildPortSpot=a,this.B())}},childPortSpot:{get:function(){return this.T.childPortSpot},set:function(a){this.T.childPortSpot.A(a)||(this.T.childPortSpot=a,this.B())}},alternateSorting:{get:function(){return this.U.sorting},set:function(a){this.U.sorting===a||a!==Ss&&a!==Ts&&
a!==Us&&!Vs||(this.U.sorting=a,this.B())}},alternateComparer:{get:function(){return this.U.comparer},set:function(a){this.U.comparer!==a&&(this.U.comparer=a,this.B())}},alternateAngle:{get:function(){return this.U.angle},set:function(a){this.U.angle===a||0!==a&&90!==a&&180!==a&&270!==a||(this.U.angle=a,this.B())}},alternateAlignment:{get:function(){return this.U.alignment},set:function(a){this.U.alignment!==
a&&(this.U.alignment=a,this.B())}},alternateNodeIndent:{get:function(){return this.U.nodeIndent},set:function(a){this.U.nodeIndent!==a&&0<=a&&(this.U.nodeIndent=a,this.B())}},alternateNodeIndentPastParent:{get:function(){return this.U.nodeIndentPastParent},set:function(a){this.U.nodeIndentPastParent!==a&&0<=a&&1>=a&&(this.U.nodeIndentPastParent=a,this.B())}},alternateNodeSpacing:{get:function(){return this.U.nodeSpacing},
set:function(a){this.U.nodeSpacing!==a&&(this.U.nodeSpacing=a,this.B())}},alternateLayerSpacing:{get:function(){return this.U.layerSpacing},set:function(a){this.U.layerSpacing!==a&&(this.U.layerSpacing=a,this.B())}},alternateLayerSpacingParentOverlap:{get:function(){return this.U.layerSpacingParentOverlap},set:function(a){this.U.layerSpacingParentOverlap!==a&&0<=a&&1>=a&&(this.U.layerSpacingParentOverlap=a,this.B())}},alternateCompaction:{
get:function(){return this.U.compaction},set:function(a){this.U.compaction===a||a!==bt&&a!==dt||(this.U.compaction=a,this.B())}},alternateBreadthLimit:{get:function(){return this.U.breadthLimit},set:function(a){this.U.breadthLimit!==a&&0<=a&&(this.U.breadthLimit=a,this.B())}},alternateRowSpacing:{get:function(){return this.U.rowSpacing},set:function(a){this.U.rowSpacing!==a&&(this.U.rowSpacing=a,this.B())}},alternateRowIndent:{
get:function(){return this.U.rowIndent},set:function(a){this.U.rowIndent!==a&&0<=a&&(this.U.rowIndent=a,this.B())}},alternateCommentSpacing:{get:function(){return this.U.commentSpacing},set:function(a){this.U.commentSpacing!==a&&(this.U.commentSpacing=a,this.B())}},alternateCommentMargin:{get:function(){return this.U.commentMargin},set:function(a){this.U.commentMargin!==a&&(this.U.commentMargin=a,this.B())}},alternateSetsPortSpot:{
get:function(){return this.U.setsPortSpot},set:function(a){this.U.setsPortSpot!==a&&(this.U.setsPortSpot=a,this.B())}},alternatePortSpot:{get:function(){return this.U.portSpot},set:function(a){this.U.portSpot.A(a)||(this.U.portSpot=a,this.B())}},alternateSetsChildPortSpot:{get:function(){return this.U.setsChildPortSpot},set:function(a){this.U.setsChildPortSpot!==a&&(this.U.setsChildPortSpot=a,this.B())}},alternateChildPortSpot:{
get:function(){return this.U.childPortSpot},set:function(a){this.U.childPortSpot.A(a)||(this.U.childPortSpot=a,this.B())}}});
var vs=new D(us,"PathDefault",-1),ws=new D(us,"PathDestination",0),Ds=new D(us,"PathSource",1),Ss=new D(us,"SortingForwards",10),Ts=new D(us,"SortingReverse",11),Us=new D(us,"SortingAscending",12),Vs=new D(us,"SortingDescending",13),st=new D(us,"AlignmentCenterSubtrees",20),tt=new D(us,"AlignmentCenterChildren",21),it=new D(us,"AlignmentStart",22),ft=new D(us,"AlignmentEnd",23),Xs=new D(us,"AlignmentBus",24),Ns=new D(us,"AlignmentBusBranching",25),Ys=new D(us,"AlignmentTopLeftBus",26),Zs=new D(us,
"AlignmentBottomRightBus",27),bt=new D(us,"CompactionNone",30),dt=new D(us,"CompactionBlock",31),xs=new D(us,"StyleLayered",40),Rs=new D(us,"StyleLastParents",41),Qs=new D(us,"StyleAlternating",42),Ps=new D(us,"StyleRootOnly",43),zs=new D(us,"ArrangementVertical",50),Bt=new D(us,"ArrangementHorizontal",51),Cs=new D(us,"ArrangementFixedRoots",52),ys=new D(us,"LayerIndividual",60),Ls=new D(us,"LayerSiblings",61),Ks=new D(us,"LayerUniform",62);us.className="TreeLayout";us.PathDefault=vs;
us.PathDestination=ws;us.PathSource=Ds;us.SortingForwards=Ss;us.SortingReverse=Ts;us.SortingAscending=Us;us.SortingDescending=Vs;us.AlignmentCenterSubtrees=st;us.AlignmentCenterChildren=tt;us.AlignmentStart=it;us.AlignmentEnd=ft;us.AlignmentBus=Xs;us.AlignmentBusBranching=Ns;us.AlignmentTopLeftBus=Ys;us.AlignmentBottomRightBus=Zs;us.CompactionNone=bt;us.CompactionBlock=dt;us.StyleLayered=xs;us.StyleLastParents=Rs;us.StyleAlternating=Qs;us.StyleRootOnly=Ps;us.ArrangementVertical=zs;
us.ArrangementHorizontal=Bt;us.ArrangementFixedRoots=Cs;us.LayerIndividual=ys;us.LayerSiblings=Ls;us.LayerUniform=Ks;function As(a){tp.call(this,a)}oa(As,tp);As.prototype.createVertex=function(){return new Bs(this)};As.prototype.createEdge=function(){return new Dt(this)};As.className="TreeNetwork";
function Bs(a){wp.call(this,a);this.La=!1;this.Kc=null;this.K=[];this.Ub=this.Tb=this.da=this.Wa=0;this.Zc=null;this.S=new G(0,0);this.ua=new L(0,0);this.ia=new G(0,0);this.om=this.nm=this.Dz=!1;this.jq=this.Xp=null;this.Rc=Ss;this.Mc=Cp;this.Bc=0;this.xb=tt;this.Rr=this.Qr=0;this.Tr=20;this.ie=50;this.Fr=0;this.Nq=dt;this.Gq=0;this.es=25;this.Mq=this.ds=10;this.Lq=20;this.qs=!0;this.Zr=Hd;this.ps=!0;this.Jq=Hd}oa(Bs,wp);
Bs.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.Rc=a.sorting,this.Mc=a.comparer,this.Bc=a.angle,this.xb=a.alignment,this.Qr=a.nodeIndent,this.Rr=a.nodeIndentPastParent,this.Tr=a.nodeSpacing,this.ie=a.layerSpacing,this.Fr=a.layerSpacingParentOverlap,this.Nq=a.compaction,this.Gq=a.breadthLimit,this.es=a.rowSpacing,this.ds=a.rowIndent,this.Mq=a.commentSpacing,this.Lq=a.commentMargin,this.qs=a.setsPortSpot,this.Zr=a.portSpot,this.ps=a.setsChildPortSpot,this.Jq=a.childPortSpot)};
pa.Object.defineProperties(Bs.prototype,{initialized:{get:function(){return this.La},set:function(a){this.La!==a&&(this.La=a)}},parent:{get:function(){return this.Kc},set:function(a){this.Kc!==a&&(this.Kc=a)}},children:{get:function(){return this.K},set:function(a){if(this.K!==a){if(null!==a)for(var b=a.length,c=0;c<b;c++);this.K=a}}},level:{get:function(){return this.Wa},set:function(a){this.Wa!==
a&&(this.Wa=a)}},descendantCount:{get:function(){return this.da},set:function(a){this.da!==a&&(this.da=a)}},maxChildrenCount:{get:function(){return this.Tb},set:function(a){this.Tb!==a&&(this.Tb=a)}},maxGenerationCount:{get:function(){return this.Ub},set:function(a){this.Ub!==a&&(this.Ub=a)}},comments:{get:function(){return this.Zc},set:function(a){if(this.Zc!==a){if(null!==a)for(var b=
a.length,c=0;c<b;c++);this.Zc=a}}},sorting:{get:function(){return this.Rc},set:function(a){this.Rc!==a&&(this.Rc=a)}},comparer:{get:function(){return this.Mc},set:function(a){this.Mc!==a&&(this.Mc=a)}},angle:{get:function(){return this.Bc},set:function(a){this.Bc!==a&&(this.Bc=a)}},alignment:{get:function(){return this.xb},set:function(a){this.xb!==a&&(this.xb=a)}},nodeIndent:{
get:function(){return this.Qr},set:function(a){this.Qr!==a&&(this.Qr=a)}},nodeIndentPastParent:{get:function(){return this.Rr},set:function(a){this.Rr!==a&&(this.Rr=a)}},nodeSpacing:{get:function(){return this.Tr},set:function(a){this.Tr!==a&&(this.Tr=a)}},layerSpacing:{get:function(){return this.ie},set:function(a){this.ie!==a&&(this.ie=a)}},layerSpacingParentOverlap:{
get:function(){return this.Fr},set:function(a){this.Fr!==a&&(this.Fr=a)}},compaction:{get:function(){return this.Nq},set:function(a){this.Nq!==a&&(this.Nq=a)}},breadthLimit:{get:function(){return this.Gq},set:function(a){this.Gq!==a&&(this.Gq=a)}},rowSpacing:{get:function(){return this.es},set:function(a){this.es!==a&&(this.es=a)}},rowIndent:{get:function(){return this.ds},set:function(a){this.ds!==
a&&(this.ds=a)}},commentSpacing:{get:function(){return this.Mq},set:function(a){this.Mq!==a&&(this.Mq=a)}},commentMargin:{get:function(){return this.Lq},set:function(a){this.Lq!==a&&(this.Lq=a)}},setsPortSpot:{get:function(){return this.qs},set:function(a){this.qs!==a&&(this.qs=a)}},portSpot:{get:function(){return this.Zr},set:function(a){this.Zr.A(a)||(this.Zr=a)}},setsChildPortSpot:{
get:function(){return this.ps},set:function(a){this.ps!==a&&(this.ps=a)}},childPortSpot:{get:function(){return this.Jq},set:function(a){this.Jq.A(a)||(this.Jq=a)}},childrenCount:{get:function(){return this.children.length}},relativePosition:{get:function(){return this.S},set:function(a){this.S.set(a)}},subtreeSize:{get:function(){return this.ua},set:function(a){this.ua.set(a)}},
subtreeOffset:{get:function(){return this.ia},set:function(a){this.ia.set(a)}}});Bs.className="TreeVertex";function Dt(a){xp.call(this,a);this.ju=new G(0,0)}oa(Dt,xp);
Dt.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.ad){case ws:c=this.fromVertex;d=this.toVertex;break;case Ds:c=this.toVertex;d=this.fromVertex;break;default:A("Unhandled path value "+b.ad.toString())}if(null!==c&&null!==d)if(b=this.ju,0!==b.x||0!==b.y||c.Dz){d=c.bounds;var e=et(c),f=gt(c),g=c.rowSpacing;a.Pi();var h=a.curve===Tg,k=a.isOrthogonal,l;a.wh();if(k||h){for(l=2;4<a.pointsCount;)a.tv(2);var m=a.i(1);var n=a.i(2)}else{for(l=
1;3<a.pointsCount;)a.tv(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===ft?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-ht(c))))):c.alignment===it?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+ht(c))))):e=c.nm||c.om&&1===c.maxGenerationCount?d.top-c.ia.y+b.y:d.y+d.height/2+b.y,h?(a.m(l,m.x,e),l++,a.m(l,d.right+f,e),l++,a.m(l,d.right+f+(b.x-g)/3,e),l++,a.m(l,d.right+f+2*(b.x-g)/3,e),l++,a.m(l,d.right+f+(b.x-
g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.right+f/2,m.y),l++),a.m(l,d.right+f/2,e),l++,a.m(l,d.right+f+b.x-(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):90===e?(c.alignment===ft?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-ht(c))))):c.alignment===it?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+ht(c))))):e=c.nm||c.om&&1===c.maxGenerationCount?d.left-c.ia.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.bottom+f),l++,a.m(l,e,d.bottom+f+(b.y-g)/
3),l++,a.m(l,e,d.bottom+f+2*(b.y-g)/3),l++,a.m(l,e,d.bottom+f+(b.y-g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.bottom+f/2),l++),a.m(l,e,d.bottom+f/2),l++,a.m(l,e,d.bottom+f+b.y-(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):180===e?(c.alignment===ft?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-ht(c))))):c.alignment===it?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+ht(c))))):e=c.nm||c.om&&1===c.maxGenerationCount?d.top-c.ia.y+b.y:d.y+d.height/2+b.y,h?
(a.m(l,m.x,e),l++,a.m(l,d.left-f,e),l++,a.m(l,d.left-f+(b.x+g)/3,e),l++,a.m(l,d.left-f+2*(b.x+g)/3,e),l++,a.m(l,d.left-f+(b.x+g),e),l++,a.m(l,n.x,e)):(k&&(a.m(l,d.left-f/2,m.y),l++),a.m(l,d.left-f/2,e),l++,a.m(l,d.left-f+b.x+(k?g/2:g),e),l++,k&&a.m(l,a.i(l-1).x,n.y))):270===e?(c.alignment===ft?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-ht(c))))):c.alignment===it?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+ht(c))))):e=c.nm||c.om&&1===c.maxGenerationCount?
d.left-c.ia.x+b.x:d.x+d.width/2+b.x,h?(a.m(l,e,m.y),l++,a.m(l,e,d.top-f),l++,a.m(l,e,d.top-f+(b.y+g)/3),l++,a.m(l,e,d.top-f+2*(b.y+g)/3),l++,a.m(l,e,d.top-f+(b.y+g)),l++,a.m(l,e,n.y)):(k&&(a.m(l,m.x,d.top-f/2),l++),a.m(l,e,d.top-f/2),l++,a.m(l,e,d.top-f+b.y+(k?g/2:g)),l++,k&&a.m(l,n.x,a.i(l-1).y))):A("Invalid angle "+e);a.jf()}else a=this.link,f=et(c),f!==et(d)&&(g=gt(c),h=c.bounds,c=d.bounds,0===f&&c.left-h.right<g+1||90===f&&c.top-h.bottom<g+1||180===f&&h.left-c.right<g+1||270===f&&h.top-c.bottom<
g+1||(a.Pi(),c=a.curve===Tg,b=a.isOrthogonal,d=Ws(this.fromVertex.alignment),a.wh(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.M(1,f-20,a.i(1).y),a.m(2,f-20,c),a.m(3,f,c),a.m(4,f+20,c),a.M(5,a.i(5).x,c)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,f,a.i(2).y),a.M(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.M(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):90===f?(f=h.bottom+g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.M(1,a.i(1).x,f-20),a.m(2,c,f-20),
a.m(3,c,f),a.m(4,c,f+20),a.M(5,c,a.i(5).y)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,a.i(2).x,f),a.M(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.M(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)):180===f?(f=h.left-g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.M(1,f+20,a.i(1).y),a.m(2,f+20,c),a.m(3,f,c),a.m(4,f-20,c),a.M(5,a.i(5).x,c)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,f,a.i(2).y),a.M(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?
a.M(1,f,a.i(2).y):2===a.pointsCount&&a.m(1,f,a.i(1).y)):270===f&&(f=h.top-g/2,c?4===a.pointsCount&&(c=a.i(3).x,a.M(1,a.i(1).x,f+20),a.m(2,c,f+20),a.m(3,c,f),a.m(4,c,f-20),a.M(5,c,a.i(5).y)):b?d?a.M(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.M(2,a.i(2).x,f),a.M(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.M(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)),a.jf()))}};
pa.Object.defineProperties(Dt.prototype,{relativePoint:{get:function(){return this.ju},set:function(a){this.ju.set(a)}}});Dt.className="TreeEdge";
Ua.prototype.initializeStandardTools=function(){Gf(this,"Action",new fh,this.mouseDownTools);Gf(this,"Relinking",new Pf,this.mouseDownTools);Gf(this,"LinkReshaping",new Rg,this.mouseDownTools);Gf(this,"Rotating",new dh,this.mouseDownTools);Gf(this,"Resizing",new Yg,this.mouseDownTools);Gf(this,"Linking",new Kg,this.mouseMoveTools);Gf(this,"Dragging",new If,this.mouseMoveTools);Gf(this,"DragSelecting",new ih,this.mouseMoveTools);Gf(this,"Panning",new jh,this.mouseMoveTools);Gf(this,"ContextMenu",new lh,
this.mouseUpTools);Gf(this,"TextEditing",new sh,this.mouseUpTools);Gf(this,"ClickCreating",new gh,this.mouseUpTools);Gf(this,"ClickSelecting",new eh,this.mouseUpTools)};P.prototype.$u=function(){this.Pw("SVG",new Cl(this,w.document))};Zm("Horizontal",new gm);Zm("Spot",new im);Zm("Table",new mm);Zm("Viewbox",new rm);Zm("TableRow",new pm);Zm("TableColumn",new qm);Zm("Graduated",new Am);oi.add(zq.type,Vp);oi.add(Cq.type,iq);
var Et={licenseKey:"",version:"2.0.0-beta12",Group:kg,EnumValue:D,List:E,Set:F,Map:Pb,Point:G,Size:L,Rect:N,Margin:Lc,Spot:O,Geometry:ge,PathFigure:Xe,PathSegment:Ye,InputEvent:$e,DiagramEvent:bf,ChangedEvent:cf,Model:Z,GraphLinksModel:zq,TreeModel:Cq,Binding:Ai,Transaction:kf,UndoManager:lf,CommandHandler:zk,Tool:nf,DraggingTool:If,DraggingInfo:Qf,LinkingBaseTool:tg,LinkingTool:Kg,RelinkingTool:Pf,LinkReshapingTool:Rg,ResizingTool:Yg,RotatingTool:dh,ClickSelectingTool:eh,ActionTool:fh,ClickCreatingTool:gh,
HTMLInfo:xf,ContextMenuTool:lh,DragSelectingTool:ih,PanningTool:jh,TextEditingTool:sh,ToolManager:Ua,AnimationManager:Mh,Layer:bi,Diagram:P,Palette:tk,Overview:vk,Brush:bl,GraphObject:Y,Panel:W,RowColumnDefinition:Kj,Shape:V,TextBlock:th,TextBlockMetrics:Cm,Picture:Qj,Part:T,Adornment:sf,Node:U,Link:S,Placeholder:Zg,Layout:ui,LayoutNetwork:tp,LayoutVertex:wp,LayoutEdge:xp,GridLayout:uk,PanelLayout:vl,CircularLayout:Dq,CircularNetwork:Vq,CircularVertex:hr,CircularEdge:ir,ForceDirectedLayout:jr,ForceDirectedNetwork:kr,
ForceDirectedVertex:wr,ForceDirectedEdge:xr,LayeredDigraphLayout:yr,LayeredDigraphNetwork:Dr,LayeredDigraphVertex:ss,LayeredDigraphEdge:ts,TreeLayout:us,TreeNetwork:As,TreeVertex:Bs,TreeEdge:Dt},Ft=["go"],Gt=this;Ft[0]in Gt||!Gt.execScript||Gt.execScript("var "+Ft[0]);for(var Ht;Ft.length&&(Ht=Ft.shift());){var It;if(It=!Ft.length)It=void 0!==Et;It?Gt[Ht]=Et:Gt[Ht]&&Gt[Ht]!==Object.prototype[Ht]?Gt=Gt[Ht]:Gt=Gt[Ht]={}}
w.module&&"object"===typeof w.module&&"object"===typeof w.module.exports?w.module.exports=Et:w.define&&"function"===typeof w.define&&w.define.amd?(w.go=Et,w.define(Et)):w.go=Et; 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports=go); })();
| sufuf3/cdnjs | ajax/libs/gojs/2.0.0-beta12/go.js | JavaScript | mit | 865,341 |
define(function(require) {
var IMAGE_SRC = 'images/sprite.png';
var sprite = null;
// Constructor
function SuperMario(posX, posY) {
this.posX = posX;
this.posY = posY;
var imageObj = new Image();
imageObj.src = IMAGE_SRC;
sprite = generateSprite(imageObj, posX, posY);
}
function generateSprite(imageObj, posX, posY) {
var sprite = new Kinetic.Sprite({
x: posX,
y: posY,
image: imageObj,
animation: 'idle',
animations: {
idle: [
688, 155, 88, 119
],
move: [
7, 290, 80, 119,
90, 290, 80, 119,
170, 290, 80, 119,
250, 290, 80, 119,
330, 290, 80, 119,
415, 290, 80, 119,
490, 290, 80, 119
]
},
frameRate: 5,
frameIndex: 0
});
return sprite;
}
SuperMario.prototype.getSprite = function() {
return sprite;
};
return SuperMario;
}); | TelerikAcademy/flextry-Telerik-Academy | Web Design & Development/4. JavaScript UI & DOM/06. Canvas Animations/01. Super Mario/scripts/Models/SuperMario.js | JavaScript | mit | 1,166 |
this["wp"] = this["wp"] || {}; this["wp"]["primitives"] =
/******/ (function(modules) { // webpackBootstrap
/******/ // The module cache
/******/ var installedModules = {};
/******/
/******/ // The require function
/******/ function __webpack_require__(moduleId) {
/******/
/******/ // Check if module is in cache
/******/ if(installedModules[moduleId]) {
/******/ return installedModules[moduleId].exports;
/******/ }
/******/ // Create a new module (and put it into the cache)
/******/ var module = installedModules[moduleId] = {
/******/ i: moduleId,
/******/ l: false,
/******/ exports: {}
/******/ };
/******/
/******/ // Execute the module function
/******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__);
/******/
/******/ // Flag the module as loaded
/******/ module.l = true;
/******/
/******/ // Return the exports of the module
/******/ return module.exports;
/******/ }
/******/
/******/
/******/ // expose the modules object (__webpack_modules__)
/******/ __webpack_require__.m = modules;
/******/
/******/ // expose the module cache
/******/ __webpack_require__.c = installedModules;
/******/
/******/ // define getter function for harmony exports
/******/ __webpack_require__.d = function(exports, name, getter) {
/******/ if(!__webpack_require__.o(exports, name)) {
/******/ Object.defineProperty(exports, name, { enumerable: true, get: getter });
/******/ }
/******/ };
/******/
/******/ // define __esModule on exports
/******/ __webpack_require__.r = function(exports) {
/******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) {
/******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' });
/******/ }
/******/ Object.defineProperty(exports, '__esModule', { value: true });
/******/ };
/******/
/******/ // create a fake namespace object
/******/ // mode & 1: value is a module id, require it
/******/ // mode & 2: merge all properties of value into the ns
/******/ // mode & 4: return value when already ns object
/******/ // mode & 8|1: behave like require
/******/ __webpack_require__.t = function(value, mode) {
/******/ if(mode & 1) value = __webpack_require__(value);
/******/ if(mode & 8) return value;
/******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value;
/******/ var ns = Object.create(null);
/******/ __webpack_require__.r(ns);
/******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value });
/******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key));
/******/ return ns;
/******/ };
/******/
/******/ // getDefaultExport function for compatibility with non-harmony modules
/******/ __webpack_require__.n = function(module) {
/******/ var getter = module && module.__esModule ?
/******/ function getDefault() { return module['default']; } :
/******/ function getModuleExports() { return module; };
/******/ __webpack_require__.d(getter, 'a', getter);
/******/ return getter;
/******/ };
/******/
/******/ // Object.prototype.hasOwnProperty.call
/******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); };
/******/
/******/ // __webpack_public_path__
/******/ __webpack_require__.p = "";
/******/
/******/
/******/ // Load entry module and return exports
/******/ return __webpack_require__(__webpack_require__.s = 463);
/******/ })
/************************************************************************/
/******/ ({
/***/ 0:
/***/ (function(module, exports) {
(function() { module.exports = this["wp"]["element"]; }());
/***/ }),
/***/ 11:
/***/ (function(module, exports, __webpack_require__) {
var __WEBPACK_AMD_DEFINE_ARRAY__, __WEBPACK_AMD_DEFINE_RESULT__;/*!
Copyright (c) 2017 Jed Watson.
Licensed under the MIT License (MIT), see
http://jedwatson.github.io/classnames
*/
/* global define */
(function () {
'use strict';
var hasOwn = {}.hasOwnProperty;
function classNames () {
var classes = [];
for (var i = 0; i < arguments.length; i++) {
var arg = arguments[i];
if (!arg) continue;
var argType = typeof arg;
if (argType === 'string' || argType === 'number') {
classes.push(arg);
} else if (Array.isArray(arg) && arg.length) {
var inner = classNames.apply(null, arg);
if (inner) {
classes.push(inner);
}
} else if (argType === 'object') {
for (var key in arg) {
if (hasOwn.call(arg, key) && arg[key]) {
classes.push(key);
}
}
}
}
return classes.join(' ');
}
if ( true && module.exports) {
classNames.default = classNames;
module.exports = classNames;
} else if (true) {
// register as 'classnames', consistent with npm package name
!(__WEBPACK_AMD_DEFINE_ARRAY__ = [], __WEBPACK_AMD_DEFINE_RESULT__ = (function () {
return classNames;
}).apply(exports, __WEBPACK_AMD_DEFINE_ARRAY__),
__WEBPACK_AMD_DEFINE_RESULT__ !== undefined && (module.exports = __WEBPACK_AMD_DEFINE_RESULT__));
} else {}
}());
/***/ }),
/***/ 15:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutProperties; });
/* harmony import */ var _objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(41);
function _objectWithoutProperties(source, excluded) {
if (source == null) return {};
var target = Object(_objectWithoutPropertiesLoose__WEBPACK_IMPORTED_MODULE_0__[/* default */ "a"])(source, excluded);
var key, i;
if (Object.getOwnPropertySymbols) {
var sourceSymbolKeys = Object.getOwnPropertySymbols(source);
for (i = 0; i < sourceSymbolKeys.length; i++) {
key = sourceSymbolKeys[i];
if (excluded.indexOf(key) >= 0) continue;
if (!Object.prototype.propertyIsEnumerable.call(source, key)) continue;
target[key] = source[key];
}
}
return target;
}
/***/ }),
/***/ 41:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _objectWithoutPropertiesLoose; });
function _objectWithoutPropertiesLoose(source, excluded) {
if (source == null) return {};
var target = {};
var sourceKeys = Object.keys(source);
var key, i;
for (i = 0; i < sourceKeys.length; i++) {
key = sourceKeys[i];
if (excluded.indexOf(key) >= 0) continue;
target[key] = source[key];
}
return target;
}
/***/ }),
/***/ 463:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
// ESM COMPAT FLAG
__webpack_require__.r(__webpack_exports__);
// EXPORTS
__webpack_require__.d(__webpack_exports__, "Circle", function() { return /* reexport */ svg_Circle; });
__webpack_require__.d(__webpack_exports__, "G", function() { return /* reexport */ svg_G; });
__webpack_require__.d(__webpack_exports__, "Path", function() { return /* reexport */ svg_Path; });
__webpack_require__.d(__webpack_exports__, "Polygon", function() { return /* reexport */ svg_Polygon; });
__webpack_require__.d(__webpack_exports__, "Rect", function() { return /* reexport */ svg_Rect; });
__webpack_require__.d(__webpack_exports__, "Defs", function() { return /* reexport */ svg_Defs; });
__webpack_require__.d(__webpack_exports__, "RadialGradient", function() { return /* reexport */ svg_RadialGradient; });
__webpack_require__.d(__webpack_exports__, "LinearGradient", function() { return /* reexport */ svg_LinearGradient; });
__webpack_require__.d(__webpack_exports__, "Stop", function() { return /* reexport */ svg_Stop; });
__webpack_require__.d(__webpack_exports__, "SVG", function() { return /* reexport */ svg_SVG; });
__webpack_require__.d(__webpack_exports__, "HorizontalRule", function() { return /* reexport */ HorizontalRule; });
__webpack_require__.d(__webpack_exports__, "BlockQuotation", function() { return /* reexport */ BlockQuotation; });
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/defineProperty.js
var defineProperty = __webpack_require__(5);
// EXTERNAL MODULE: ./node_modules/@babel/runtime/helpers/esm/objectWithoutProperties.js
var objectWithoutProperties = __webpack_require__(15);
// EXTERNAL MODULE: ./node_modules/classnames/index.js
var classnames = __webpack_require__(11);
var classnames_default = /*#__PURE__*/__webpack_require__.n(classnames);
// EXTERNAL MODULE: external {"this":["wp","element"]}
var external_this_wp_element_ = __webpack_require__(0);
// CONCATENATED MODULE: ./node_modules/@wordpress/primitives/build-module/svg/index.js
function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { Object(defineProperty["a" /* default */])(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
/**
* External dependencies
*/
/**
* WordPress dependencies
*/
// Disable reason: JSDoc linter doesn't seem to parse the union (`&`) correctly.
/* eslint-disable jsdoc/valid-types */
/** @typedef {{isPressed?: boolean} & import('react').ComponentPropsWithoutRef<'svg'>} SVGProps */
/* eslint-enable jsdoc/valid-types */
/**
* @param {import('react').ComponentPropsWithoutRef<'circle'>} props
*
* @return {JSX.Element} Circle component
*/
var svg_Circle = function Circle(props) {
return Object(external_this_wp_element_["createElement"])('circle', props);
};
/**
* @param {import('react').ComponentPropsWithoutRef<'g'>} props
*
* @return {JSX.Element} G component
*/
var svg_G = function G(props) {
return Object(external_this_wp_element_["createElement"])('g', props);
};
/**
* @param {import('react').ComponentPropsWithoutRef<'path'>} props
*
* @return {JSX.Element} Path component
*/
var svg_Path = function Path(props) {
return Object(external_this_wp_element_["createElement"])('path', props);
};
/**
* @param {import('react').ComponentPropsWithoutRef<'polygon'>} props
*
* @return {JSX.Element} Polygon component
*/
var svg_Polygon = function Polygon(props) {
return Object(external_this_wp_element_["createElement"])('polygon', props);
};
/**
* @param {import('react').ComponentPropsWithoutRef<'rect'>} props
*
* @return {JSX.Element} Rect component
*/
var svg_Rect = function Rect(props) {
return Object(external_this_wp_element_["createElement"])('rect', props);
};
/**
* @param {import('react').ComponentPropsWithoutRef<'defs'>} props
*
* @return {JSX.Element} Defs component
*/
var svg_Defs = function Defs(props) {
return Object(external_this_wp_element_["createElement"])('defs', props);
};
/**
* @param {import('react').ComponentPropsWithoutRef<'radialGradient'>} props
*
* @return {JSX.Element} RadialGradient component
*/
var svg_RadialGradient = function RadialGradient(props) {
return Object(external_this_wp_element_["createElement"])('radialGradient', props);
};
/**
* @param {import('react').ComponentPropsWithoutRef<'linearGradient'>} props
*
* @return {JSX.Element} LinearGradient component
*/
var svg_LinearGradient = function LinearGradient(props) {
return Object(external_this_wp_element_["createElement"])('linearGradient', props);
};
/**
* @param {import('react').ComponentPropsWithoutRef<'stop'>} props
*
* @return {JSX.Element} Stop component
*/
var svg_Stop = function Stop(props) {
return Object(external_this_wp_element_["createElement"])('stop', props);
};
/**
*
* @param {SVGProps} props isPressed indicates whether the SVG should appear as pressed.
* Other props will be passed through to svg component.
*
* @return {JSX.Element} Stop component
*/
var svg_SVG = function SVG(_ref) {
var className = _ref.className,
isPressed = _ref.isPressed,
props = Object(objectWithoutProperties["a" /* default */])(_ref, ["className", "isPressed"]);
var appliedProps = _objectSpread({}, props, {
className: classnames_default()(className, {
'is-pressed': isPressed
}) || undefined,
role: 'img',
'aria-hidden': true,
focusable: false
}); // Disable reason: We need to have a way to render HTML tag for web.
// eslint-disable-next-line react/forbid-elements
return Object(external_this_wp_element_["createElement"])("svg", appliedProps);
};
// CONCATENATED MODULE: ./node_modules/@wordpress/primitives/build-module/horizontal-rule/index.js
var HorizontalRule = 'hr';
// CONCATENATED MODULE: ./node_modules/@wordpress/primitives/build-module/block-quotation/index.js
var BlockQuotation = 'blockquote';
// CONCATENATED MODULE: ./node_modules/@wordpress/primitives/build-module/index.js
/***/ }),
/***/ 5:
/***/ (function(module, __webpack_exports__, __webpack_require__) {
"use strict";
/* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return _defineProperty; });
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
/***/ })
/******/ }); | pjhooker/monferratopaesaggi | trunk/wp-includes/js/dist/primitives.js | JavaScript | mit | 13,957 |
/*
* Copyright (C) 2011 Google Inc. All rights reserved.
*
* Redistribution and use in source and binary forms, with or without
* modification, are permitted provided that the following conditions are
* met:
*
* 1. Redistributions of source code must retain the above copyright
* notice, this list of conditions and the following disclaimer.
*
* 2. Redistributions in binary form must reproduce the above
* copyright notice, this list of conditions and the following disclaimer
* in the documentation and/or other materials provided with the
* distribution.
*
* THIS SOFTWARE IS PROVIDED BY GOOGLE INC. AND ITS CONTRIBUTORS
* "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
* LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
* A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GOOGLE INC.
* OR ITS CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
* SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
* LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
* DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
* THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
*/
/**
* @constructor
* @extends {WebInspector.Object}
*/
WebInspector.ApplicationCacheModel = function()
{
ApplicationCacheAgent.enable();
InspectorBackend.registerApplicationCacheDispatcher(new WebInspector.ApplicationCacheDispatcher(this));
WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameNavigated, this._frameNavigated, this);
WebInspector.resourceTreeModel.addEventListener(WebInspector.ResourceTreeModel.EventTypes.FrameDetached, this._frameDetached, this);
this._statuses = {};
this._manifestURLsByFrame = {};
this._mainFrameNavigated();
this._onLine = true;
}
WebInspector.ApplicationCacheModel.EventTypes = {
FrameManifestStatusUpdated: "FrameManifestStatusUpdated",
FrameManifestAdded: "FrameManifestAdded",
FrameManifestRemoved: "FrameManifestRemoved",
NetworkStateChanged: "NetworkStateChanged"
}
WebInspector.ApplicationCacheModel.prototype = {
_frameNavigated: function(event)
{
var frame = /** @type {!WebInspector.ResourceTreeFrame} */ (event.data);
if (frame.isMainFrame()) {
this._mainFrameNavigated();
return;
}
ApplicationCacheAgent.getManifestForFrame(frame.id, this._manifestForFrameLoaded.bind(this, frame.id));
},
/**
* @param {!WebInspector.Event} event
*/
_frameDetached: function(event)
{
var frame = /** @type {!WebInspector.ResourceTreeFrame} */ (event.data);
this._frameManifestRemoved(frame.id);
},
_mainFrameNavigated: function()
{
ApplicationCacheAgent.getFramesWithManifests(this._framesWithManifestsLoaded.bind(this));
},
/**
* @param {string} frameId
* @param {?Protocol.Error} error
* @param {string} manifestURL
*/
_manifestForFrameLoaded: function(frameId, error, manifestURL)
{
if (error) {
console.error(error);
return;
}
if (!manifestURL)
this._frameManifestRemoved(frameId);
},
/**
* @param {?Protocol.Error} error
* @param {!Array.<!ApplicationCacheAgent.FrameWithManifest>} framesWithManifests
*/
_framesWithManifestsLoaded: function(error, framesWithManifests)
{
if (error) {
console.error(error);
return;
}
for (var i = 0; i < framesWithManifests.length; ++i)
this._frameManifestUpdated(framesWithManifests[i].frameId, framesWithManifests[i].manifestURL, framesWithManifests[i].status);
},
/**
* @param {string} frameId
* @param {string} manifestURL
* @param {number} status
*/
_frameManifestUpdated: function(frameId, manifestURL, status)
{
if (status === applicationCache.UNCACHED) {
this._frameManifestRemoved(frameId);
return;
}
if (!manifestURL)
return;
if (this._manifestURLsByFrame[frameId] && manifestURL !== this._manifestURLsByFrame[frameId])
this._frameManifestRemoved(frameId);
var statusChanged = this._statuses[frameId] !== status;
this._statuses[frameId] = status;
if (!this._manifestURLsByFrame[frameId]) {
this._manifestURLsByFrame[frameId] = manifestURL;
this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestAdded, frameId);
}
if (statusChanged)
this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestStatusUpdated, frameId);
},
/**
* @param {string} frameId
*/
_frameManifestRemoved: function(frameId)
{
if (!this._manifestURLsByFrame[frameId])
return;
var manifestURL = this._manifestURLsByFrame[frameId];
delete this._manifestURLsByFrame[frameId];
delete this._statuses[frameId];
this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.FrameManifestRemoved, frameId);
},
/**
* @param {string} frameId
* @return {string}
*/
frameManifestURL: function(frameId)
{
return this._manifestURLsByFrame[frameId] || "";
},
/**
* @param {string} frameId
* @return {number}
*/
frameManifestStatus: function(frameId)
{
return this._statuses[frameId] || applicationCache.UNCACHED;
},
/**
* @return {boolean}
*/
get onLine()
{
return this._onLine;
},
/**
* @param {string} frameId
* @param {string} manifestURL
* @param {number} status
*/
_statusUpdated: function(frameId, manifestURL, status)
{
this._frameManifestUpdated(frameId, manifestURL, status);
},
/**
* @param {string} frameId
* @param {function(?ApplicationCacheAgent.ApplicationCache)} callback
*/
requestApplicationCache: function(frameId, callback)
{
/**
* @param {?Protocol.Error} error
* @param {!ApplicationCacheAgent.ApplicationCache} applicationCache
*/
function callbackWrapper(error, applicationCache)
{
if (error) {
console.error(error);
callback(null);
return;
}
callback(applicationCache);
}
ApplicationCacheAgent.getApplicationCacheForFrame(frameId, callbackWrapper.bind(this));
},
/**
* @param {boolean} isNowOnline
*/
_networkStateUpdated: function(isNowOnline)
{
this._onLine = isNowOnline;
this.dispatchEventToListeners(WebInspector.ApplicationCacheModel.EventTypes.NetworkStateChanged, isNowOnline);
},
__proto__: WebInspector.Object.prototype
}
/**
* @constructor
* @implements {ApplicationCacheAgent.Dispatcher}
*/
WebInspector.ApplicationCacheDispatcher = function(applicationCacheModel)
{
this._applicationCacheModel = applicationCacheModel;
}
WebInspector.ApplicationCacheDispatcher.prototype = {
/**
* @param {string} frameId
* @param {string} manifestURL
* @param {number} status
*/
applicationCacheStatusUpdated: function(frameId, manifestURL, status)
{
this._applicationCacheModel._statusUpdated(frameId, manifestURL, status);
},
/**
* @param {boolean} isNowOnline
*/
networkStateUpdated: function(isNowOnline)
{
this._applicationCacheModel._networkStateUpdated(isNowOnline);
}
}
| lordmos/blink | Source/devtools/front_end/ApplicationCacheModel.js | JavaScript | mit | 7,855 |
/**
* filesize
*
* @copyright 2019 Jason Mulligan <jason.mulligan@avoidwork.com>
* @license BSD-3-Clause
* @version 4.1.2
*/
(function (global) {
const b = /^(b|B)$/,
symbol = {
iec: {
bits: ["b", "Kib", "Mib", "Gib", "Tib", "Pib", "Eib", "Zib", "Yib"],
bytes: ["B", "KiB", "MiB", "GiB", "TiB", "PiB", "EiB", "ZiB", "YiB"]
},
jedec: {
bits: ["b", "Kb", "Mb", "Gb", "Tb", "Pb", "Eb", "Zb", "Yb"],
bytes: ["B", "KB", "MB", "GB", "TB", "PB", "EB", "ZB", "YB"]
}
},
fullform = {
iec: ["", "kibi", "mebi", "gibi", "tebi", "pebi", "exbi", "zebi", "yobi"],
jedec: ["", "kilo", "mega", "giga", "tera", "peta", "exa", "zetta", "yotta"]
};
/**
* filesize
*
* @method filesize
* @param {Mixed} arg String, Int or Float to transform
* @param {Object} descriptor [Optional] Flags
* @return {String} Readable file size String
*/
function filesize (arg, descriptor = {}) {
let result = [],
val = 0,
e, base, bits, ceil, full, fullforms, locale, neg, num, output, round, unix, separator, spacer, standard, symbols;
if (isNaN(arg)) {
throw new TypeError("Invalid number");
}
bits = descriptor.bits === true;
unix = descriptor.unix === true;
base = descriptor.base || 2;
round = descriptor.round !== void 0 ? descriptor.round : unix ? 1 : 2;
locale = descriptor.locale !== void 0 ? descriptor.locale : "";
separator = descriptor.separator !== void 0 ? descriptor.separator : "";
spacer = descriptor.spacer !== void 0 ? descriptor.spacer : unix ? "" : " ";
symbols = descriptor.symbols || {};
standard = base === 2 ? descriptor.standard || "jedec" : "jedec";
output = descriptor.output || "string";
full = descriptor.fullform === true;
fullforms = descriptor.fullforms instanceof Array ? descriptor.fullforms : [];
e = descriptor.exponent !== void 0 ? descriptor.exponent : -1;
num = Number(arg);
neg = num < 0;
ceil = base > 2 ? 1000 : 1024;
// Flipping a negative number to determine the size
if (neg) {
num = -num;
}
// Determining the exponent
if (e === -1 || isNaN(e)) {
e = Math.floor(Math.log(num) / Math.log(ceil));
if (e < 0) {
e = 0;
}
}
// Exceeding supported length, time to reduce & multiply
if (e > 8) {
e = 8;
}
if (output === "exponent") {
return e;
}
// Zero is now a special case because bytes divide by 1
if (num === 0) {
result[0] = 0;
result[1] = unix ? "" : symbol[standard][bits ? "bits" : "bytes"][e];
} else {
val = num / (base === 2 ? Math.pow(2, e * 10) : Math.pow(1000, e));
if (bits) {
val = val * 8;
if (val >= ceil && e < 8) {
val = val / ceil;
e++;
}
}
result[0] = Number(val.toFixed(e > 0 ? round : 0));
result[1] = base === 10 && e === 1 ? bits ? "kb" : "kB" : symbol[standard][bits ? "bits" : "bytes"][e];
if (unix) {
result[1] = standard === "jedec" ? result[1].charAt(0) : e > 0 ? result[1].replace(/B$/, "") : result[1];
if (b.test(result[1])) {
result[0] = Math.floor(result[0]);
result[1] = "";
}
}
}
// Decorating a 'diff'
if (neg) {
result[0] = -result[0];
}
// Applying custom symbol
result[1] = symbols[result[1]] || result[1];
if (locale === true) {
result[0] = result[0].toLocaleString();
} else if (locale.length > 0) {
result[0] = result[0].toLocaleString(locale);
} else if (separator.length > 0) {
result[0] = result[0].toString().replace(".", separator);
}
// Returning Array, Object, or String (default)
if (output === "array") {
return result;
}
if (full) {
result[1] = fullforms[e] ? fullforms[e] : fullform[standard][e] + (bits ? "bit" : "byte") + (result[0] === 1 ? "" : "s");
}
if (output === "object") {
return {value: result[0], symbol: result[1]};
}
return result.join(spacer);
}
// Partial application for functional programming
filesize.partial = opt => arg => filesize(arg, opt);
// CommonJS, AMD, script tag
if (typeof exports !== "undefined") {
module.exports = filesize;
} else if (typeof define === "function" && define.amd !== void 0) {
define(() => filesize);
} else {
global.filesize = filesize;
}
}(typeof window !== "undefined" ? window : global));
| extend1994/cdnjs | ajax/libs/filesize/4.1.2/filesize.es6.js | JavaScript | mit | 4,253 |
/**
* @license Highcharts JS v7.0.2 (2019-01-17)
*
* (c) 2014-2019 Highsoft AS
* Authors: Jon Arild Nygard / Oystein Moseng
*
* License: www.highcharts.com/license
*/
'use strict';
(function (factory) {
if (typeof module === 'object' && module.exports) {
factory['default'] = factory;
module.exports = factory;
} else if (typeof define === 'function' && define.amd) {
define(function () {
return factory;
});
} else {
factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined);
}
}(function (Highcharts) {
var result = (function (H) {
var extend = H.extend,
isArray = H.isArray,
isBoolean = function (x) {
return typeof x === 'boolean';
},
isFn = function (x) {
return typeof x === 'function';
},
isObject = H.isObject,
isNumber = H.isNumber,
merge = H.merge,
pick = H.pick;
// TODO Combine buildTree and buildNode with setTreeValues
// TODO Remove logic from Treemap and make it utilize this mixin.
var setTreeValues = function setTreeValues(tree, options) {
var before = options.before,
idRoot = options.idRoot,
mapIdToNode = options.mapIdToNode,
nodeRoot = mapIdToNode[idRoot],
levelIsConstant = (
isBoolean(options.levelIsConstant) ?
options.levelIsConstant :
true
),
points = options.points,
point = points[tree.i],
optionsPoint = point && point.options || {},
childrenTotal = 0,
children = [],
value;
extend(tree, {
levelDynamic: tree.level - (levelIsConstant ? 0 : nodeRoot.level),
name: pick(point && point.name, ''),
visible: (
idRoot === tree.id ||
(isBoolean(options.visible) ? options.visible : false)
)
});
if (isFn(before)) {
tree = before(tree, options);
}
// First give the children some values
tree.children.forEach(function (child, i) {
var newOptions = extend({}, options);
extend(newOptions, {
index: i,
siblings: tree.children.length,
visible: tree.visible
});
child = setTreeValues(child, newOptions);
children.push(child);
if (child.visible) {
childrenTotal += child.val;
}
});
tree.visible = childrenTotal > 0 || tree.visible;
// Set the values
value = pick(optionsPoint.value, childrenTotal);
extend(tree, {
children: children,
childrenTotal: childrenTotal,
isLeaf: tree.visible && !childrenTotal,
val: value
});
return tree;
};
var getColor = function getColor(node, options) {
var index = options.index,
mapOptionsToLevel = options.mapOptionsToLevel,
parentColor = options.parentColor,
parentColorIndex = options.parentColorIndex,
series = options.series,
colors = options.colors,
siblings = options.siblings,
points = series.points,
getColorByPoint,
chartOptionsChart = series.chart.options.chart,
point,
level,
colorByPoint,
colorIndexByPoint,
color,
colorIndex;
function variation(color) {
var colorVariation = level && level.colorVariation;
if (colorVariation) {
if (colorVariation.key === 'brightness') {
return H.color(color).brighten(
colorVariation.to * (index / siblings)
).get();
}
}
return color;
}
if (node) {
point = points[node.i];
level = mapOptionsToLevel[node.level] || {};
getColorByPoint = point && level.colorByPoint;
if (getColorByPoint) {
colorIndexByPoint = point.index % (colors ?
colors.length :
chartOptionsChart.colorCount
);
colorByPoint = colors && colors[colorIndexByPoint];
}
// Select either point color, level color or inherited color.
if (!series.chart.styledMode) {
color = pick(
point && point.options.color,
level && level.color,
colorByPoint,
parentColor && variation(parentColor),
series.color
);
}
colorIndex = pick(
point && point.options.colorIndex,
level && level.colorIndex,
colorIndexByPoint,
parentColorIndex,
options.colorIndex
);
}
return {
color: color,
colorIndex: colorIndex
};
};
/**
* Creates a map from level number to its given options.
*
* @private
* @function getLevelOptions
*
* @param {object} params
* Object containing parameters.
* - `defaults` Object containing default options. The default options
* are merged with the userOptions to get the final options for a
* specific level.
* - `from` The lowest level number.
* - `levels` User options from series.levels.
* - `to` The highest level number.
*
* @return {Highcharts.Dictionary<object>}
* Returns a map from level number to its given options.
*/
var getLevelOptions = function getLevelOptions(params) {
var result = null,
defaults,
converted,
i,
from,
to,
levels;
if (isObject(params)) {
result = {};
from = isNumber(params.from) ? params.from : 1;
levels = params.levels;
converted = {};
defaults = isObject(params.defaults) ? params.defaults : {};
if (isArray(levels)) {
converted = levels.reduce(function (obj, item) {
var level,
levelIsConstant,
options;
if (isObject(item) && isNumber(item.level)) {
options = merge({}, item);
levelIsConstant = (
isBoolean(options.levelIsConstant) ?
options.levelIsConstant :
defaults.levelIsConstant
);
// Delete redundant properties.
delete options.levelIsConstant;
delete options.level;
// Calculate which level these options apply to.
level = item.level + (levelIsConstant ? 0 : from - 1);
if (isObject(obj[level])) {
extend(obj[level], options);
} else {
obj[level] = options;
}
}
return obj;
}, {});
}
to = isNumber(params.to) ? params.to : 1;
for (i = 0; i <= to; i++) {
result[i] = merge(
{},
defaults,
isObject(converted[i]) ? converted[i] : {}
);
}
}
return result;
};
/**
* Update the rootId property on the series. Also makes sure that it is
* accessible to exporting.
*
* @private
* @function updateRootId
*
* @param {object} series
* The series to operate on.
*
* @return {string}
* Returns the resulting rootId after update.
*/
var updateRootId = function (series) {
var rootId,
options;
if (isObject(series)) {
// Get the series options.
options = isObject(series.options) ? series.options : {};
// Calculate the rootId.
rootId = pick(series.rootNode, options.rootId, '');
// Set rootId on series.userOptions to pick it up in exporting.
if (isObject(series.userOptions)) {
series.userOptions.rootId = rootId;
}
// Set rootId on series to pick it up on next update.
series.rootNode = rootId;
}
return rootId;
};
var result = {
getColor: getColor,
getLevelOptions: getLevelOptions,
setTreeValues: setTreeValues,
updateRootId: updateRootId
};
return result;
}(Highcharts));
(function (H, mixinTreeSeries) {
/* *
* (c) 2014-2019 Highsoft AS
*
* Authors: Jon Arild Nygard / Oystein Moseng
*
* License: www.highcharts.com/license
*/
var seriesType = H.seriesType,
seriesTypes = H.seriesTypes,
merge = H.merge,
extend = H.extend,
noop = H.noop,
getColor = mixinTreeSeries.getColor,
getLevelOptions = mixinTreeSeries.getLevelOptions,
isArray = H.isArray,
isBoolean = function (x) {
return typeof x === 'boolean';
},
isNumber = H.isNumber,
isObject = H.isObject,
isString = H.isString,
pick = H.pick,
Series = H.Series,
stableSort = H.stableSort,
color = H.Color,
eachObject = function (list, func, context) {
context = context || this;
H.objectEach(list, function (val, key) {
func.call(context, val, key, list);
});
},
// @todo find correct name for this function.
// @todo Similar to reduce, this function is likely redundant
recursive = function (item, func, context) {
var next;
context = context || this;
next = func.call(context, item);
if (next !== false) {
recursive(next, func, context);
}
},
updateRootId = mixinTreeSeries.updateRootId;
/**
* @private
* @class
* @name Highcharts.seriesTypes.treemap
*
* @augments Highcharts.Series
*/
seriesType(
'treemap',
'scatter'
/**
* A treemap displays hierarchical data using nested rectangles. The data
* can be laid out in varying ways depending on options.
*
* @sample highcharts/demo/treemap-large-dataset/
* Treemap
*
* @extends plotOptions.scatter
* @excluding marker, jitter
* @product highcharts
* @optionparent plotOptions.treemap
*/
, {
/**
* When enabled the user can click on a point which is a parent and
* zoom in on its children.
*
* @sample {highcharts} highcharts/plotoptions/treemap-allowdrilltonode/
* Enabled
*
* @type {boolean}
* @default false
* @since 4.1.0
* @product highcharts
* @apioption plotOptions.treemap.allowDrillToNode
*/
/**
* When the series contains less points than the crop threshold, all
* points are drawn, event if the points fall outside the visible plot
* area at the current zoom. The advantage of drawing all points
* (including markers and columns), is that animation is performed on
* updates. On the other hand, when the series contains more points than
* the crop threshold, the series data is cropped to only contain points
* that fall within the plot area. The advantage of cropping away
* invisible points is to increase performance on large series.
*
* @type {number}
* @default 300
* @since 4.1.0
* @product highcharts
* @apioption plotOptions.treemap.cropThreshold
*/
/**
* This option decides if the user can interact with the parent nodes
* or just the leaf nodes. When this option is undefined, it will be
* true by default. However when allowDrillToNode is true, then it will
* be false by default.
*
* @sample {highcharts} highcharts/plotoptions/treemap-interactbyleaf-false/
* False
* @sample {highcharts} highcharts/plotoptions/treemap-interactbyleaf-true-and-allowdrilltonode/
* InteractByLeaf and allowDrillToNode is true
*
* @type {boolean}
* @since 4.1.2
* @product highcharts
* @apioption plotOptions.treemap.interactByLeaf
*/
/**
* The sort index of the point inside the treemap level.
*
* @sample {highcharts} highcharts/plotoptions/treemap-sortindex/
* Sort by years
*
* @type {number}
* @since 4.1.10
* @product highcharts
* @apioption plotOptions.treemap.sortIndex
*/
/**
* When using automatic point colors pulled from the `options.colors`
* collection, this option determines whether the chart should receive
* one color per series or one color per point.
*
* @see [series colors](#plotOptions.treemap.colors)
*
* @type {boolean}
* @default false
* @since 2.0
* @product highcharts
* @apioption plotOptions.treemap.colorByPoint
*/
/**
* A series specific or series type specific color set to apply instead
* of the global [colors](#colors) when
* [colorByPoint](#plotOptions.treemap.colorByPoint) is true.
*
* @type {Array<Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject>}
* @since 3.0
* @product highcharts
* @apioption plotOptions.treemap.colors
*/
/**
* Whether to display this series type or specific series item in the
* legend.
*/
showInLegend: false,
/**
* @ignore
*/
marker: false,
colorByPoint: false,
/**
* @extends plotOptions.heatmap.dataLabels
* @since 4.1.0
*/
dataLabels: {
enabled: true,
defer: false,
verticalAlign: 'middle',
formatter: function () {
var point = this && this.point ? this.point : {},
name = isString(point.name) ? point.name : '';
return name;
},
inside: true
},
tooltip: {
headerFormat: '',
pointFormat: '<b>{point.name}</b>: {point.value}<br/>'
},
/**
* Whether to ignore hidden points when the layout algorithm runs.
* If `false`, hidden points will leave open spaces.
*
* @since 5.0.8
*/
ignoreHiddenPoint: true,
/**
* This option decides which algorithm is used for setting position
* and dimensions of the points.
*
* @see [How to write your own algorithm](https://www.highcharts.com/docs/chart-and-series-types/treemap)
*
* @sample {highcharts} highcharts/plotoptions/treemap-layoutalgorithm-sliceanddice/
* SliceAndDice by default
* @sample {highcharts} highcharts/plotoptions/treemap-layoutalgorithm-stripes/
* Stripes
* @sample {highcharts} highcharts/plotoptions/treemap-layoutalgorithm-squarified/
* Squarified
* @sample {highcharts} highcharts/plotoptions/treemap-layoutalgorithm-strip/
* Strip
*
* @since 4.1.0
* @validvalue ["sliceAndDice", "stripes", "squarified", "strip"]
*/
layoutAlgorithm: 'sliceAndDice',
/**
* Defines which direction the layout algorithm will start drawing.
*
* @since 4.1.0
* @validvalue ["vertical", "horizontal"]
*/
layoutStartingDirection: 'vertical',
/**
* Enabling this option will make the treemap alternate the drawing
* direction between vertical and horizontal. The next levels starting
* direction will always be the opposite of the previous.
*
* @sample {highcharts} highcharts/plotoptions/treemap-alternatestartingdirection-true/
* Enabled
*
* @since 4.1.0
*/
alternateStartingDirection: false,
/**
* Used together with the levels and allowDrillToNode options. When
* set to false the first level visible when drilling is considered
* to be level one. Otherwise the level will be the same as the tree
* structure.
*
* @since 4.1.0
*/
levelIsConstant: true,
/**
* Options for the button appearing when drilling down in a treemap.
*/
drillUpButton: {
/**
* The position of the button.
*/
position: {
/**
* Vertical alignment of the button.
*
* @default top
* @validvalue ["top", "middle", "bottom"]
* @product highcharts
* @apioption plotOptions.treemap.drillUpButton.position.verticalAlign
*/
/**
* Horizontal alignment of the button.
*
* @validvalue ["left", "center", "right"]
*/
align: 'right',
/**
* Horizontal offset of the button.
*/
x: -10,
/**
* Vertical offset of the button.
*/
y: 10
}
},
/**
* Set options on specific levels. Takes precedence over series options,
* but not point options.
*
* @sample {highcharts} highcharts/plotoptions/treemap-levels/
* Styling dataLabels and borders
* @sample {highcharts} highcharts/demo/treemap-with-levels/
* Different layoutAlgorithm
*
* @type {Array<*>}
* @since 4.1.0
* @product highcharts
* @apioption plotOptions.treemap.levels
*/
/**
* Can set a `borderColor` on all points which lies on the same level.
*
* @type {Highcharts.ColorString}
* @since 4.1.0
* @product highcharts
* @apioption plotOptions.treemap.levels.borderColor
*/
/**
* Set the dash style of the border of all the point which lies on the
* level. See <a href"#plotoptions.scatter.dashstyle">
* plotOptions.scatter.dashStyle</a> for possible options.
*
* @type {string}
* @since 4.1.0
* @product highcharts
* @apioption plotOptions.treemap.levels.borderDashStyle
*/
/**
* Can set the borderWidth on all points which lies on the same level.
*
* @type {number}
* @since 4.1.0
* @product highcharts
* @apioption plotOptions.treemap.levels.borderWidth
*/
/**
* Can set a color on all points which lies on the same level.
*
* @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject}
* @since 4.1.0
* @product highcharts
* @apioption plotOptions.treemap.levels.color
*/
/**
* A configuration object to define how the color of a child varies from
* the parent's color. The variation is distributed among the children
* of node. For example when setting brightness, the brightness change
* will range from the parent's original brightness on the first child,
* to the amount set in the `to` setting on the last node. This allows a
* gradient-like color scheme that sets children out from each other
* while highlighting the grouping on treemaps and sectors on sunburst
* charts.
*
* @sample highcharts/demo/sunburst/
* Sunburst with color variation
*
* @since 6.0.0
* @product highcharts
* @apioption plotOptions.treemap.levels.colorVariation
*/
/**
* The key of a color variation. Currently supports `brightness` only.
*
* @type {string}
* @since 6.0.0
* @product highcharts
* @validvalue ["brightness"]
* @apioption plotOptions.treemap.levels.colorVariation.key
*/
/**
* The ending value of a color variation. The last sibling will receive
* this value.
*
* @type {number}
* @since 6.0.0
* @product highcharts
* @apioption plotOptions.treemap.levels.colorVariation.to
*/
/**
* Can set the options of dataLabels on each point which lies on the
* level.
* [plotOptions.treemap.dataLabels](#plotOptions.treemap.dataLabels) for
* possible values.
*
* @type {object}
* @since 4.1.0
* @product highcharts
* @apioption plotOptions.treemap.levels.dataLabels
*/
/**
* Can set the layoutAlgorithm option on a specific level.
*
* @type {string}
* @since 4.1.0
* @product highcharts
* @validvalue ["sliceAndDice", "stripes", "squarified", "strip"]
* @apioption plotOptions.treemap.levels.layoutAlgorithm
*/
/**
* Can set the layoutStartingDirection option on a specific level.
*
* @type {string}
* @since 4.1.0
* @product highcharts
* @validvalue ["vertical", "horizontal"]
* @apioption plotOptions.treemap.levels.layoutStartingDirection
*/
/**
* Decides which level takes effect from the options set in the levels
* object.
*
* @sample {highcharts} highcharts/plotoptions/treemap-levels/
* Styling of both levels
*
* @type {number}
* @since 4.1.0
* @product highcharts
* @apioption plotOptions.treemap.levels.level
*/
// Presentational options
/**
* The color of the border surrounding each tree map item.
*
* @type {Highcharts.ColorString}
*/
borderColor: '#e6e6e6',
/**
* The width of the border surrounding each tree map item.
*/
borderWidth: 1,
/**
* The opacity of a point in treemap. When a point has children, the
* visibility of the children is determined by the opacity.
*
* @since 4.2.4
*/
opacity: 0.15,
/**
* A wrapper object for all the series options in specific states.
*
* @extends plotOptions.heatmap.states
*/
states: {
/**
* Options for the hovered series
*
* @extends plotOptions.heatmap.states.hover
* @excluding halo
*/
hover: {
/**
* The border color for the hovered state.
*/
borderColor: '#999999',
/**
* Brightness for the hovered point. Defaults to 0 if the
* heatmap series is loaded first, otherwise 0.1.
*
* @type {number}
* @default undefined
*/
brightness: seriesTypes.heatmap ? 0 : 0.1,
/**
* @extends plotOptions.heatmap.states.hover.halo
*/
halo: false,
/**
* The opacity of a point in treemap. When a point has children,
* the visibility of the children is determined by the opacity.
*
* @since 4.2.4
*/
opacity: 0.75,
/**
* The shadow option for hovered state.
*/
shadow: false
}
}
// Prototype members
}, {
pointArrayMap: ['value'],
directTouch: true,
optionalAxis: 'colorAxis',
getSymbol: noop,
parallelArrays: ['x', 'y', 'value', 'colorValue'],
colorKey: 'colorValue', // Point color option key
trackerGroups: ['group', 'dataLabelsGroup'],
/**
* Creates an object map from parent id to childrens index.
*
* @private
* @function Highcharts.Series#getListOfParents
*
* @param {Highcharts.SeriesTreemapDataOptions} data
* List of points set in options.
*
* @param {Array<string>} existingIds
* List of all point ids.
*
* @return {object}
* Map from parent id to children index in data.
*/
getListOfParents: function (data, existingIds) {
var arr = isArray(data) ? data : [],
ids = isArray(existingIds) ? existingIds : [],
listOfParents = arr.reduce(function (prev, curr, i) {
var parent = pick(curr.parent, '');
if (prev[parent] === undefined) {
prev[parent] = [];
}
prev[parent].push(i);
return prev;
}, {
'': [] // Root of tree
});
// If parent does not exist, hoist parent to root of tree.
eachObject(listOfParents, function (children, parent, list) {
if ((parent !== '') && (ids.indexOf(parent) === -1)) {
children.forEach(function (child) {
list[''].push(child);
});
delete list[parent];
}
});
return listOfParents;
},
// Creates a tree structured object from the series points
getTree: function () {
var series = this,
allIds = this.data.map(function (d) {
return d.id;
}),
parentList = series.getListOfParents(this.data, allIds);
series.nodeMap = [];
return series.buildNode('', -1, 0, parentList, null);
},
init: function (chart, options) {
var series = this,
colorSeriesMixin = H.colorSeriesMixin;
// If color series logic is loaded, add some properties
if (H.colorSeriesMixin) {
this.translateColors = colorSeriesMixin.translateColors;
this.colorAttribs = colorSeriesMixin.colorAttribs;
this.axisTypes = colorSeriesMixin.axisTypes;
}
Series.prototype.init.call(series, chart, options);
if (series.options.allowDrillToNode) {
H.addEvent(series, 'click', series.onClickDrillToNode);
}
},
buildNode: function (id, i, level, list, parent) {
var series = this,
children = [],
point = series.points[i],
height = 0,
node,
child;
// Actions
((list[id] || [])).forEach(function (i) {
child = series.buildNode(
series.points[i].id,
i,
(level + 1),
list,
id
);
height = Math.max(child.height + 1, height);
children.push(child);
});
node = {
id: id,
i: i,
children: children,
height: height,
level: level,
parent: parent,
visible: false // @todo move this to better location
};
series.nodeMap[node.id] = node;
if (point) {
point.node = node;
}
return node;
},
setTreeValues: function (tree) {
var series = this,
options = series.options,
idRoot = series.rootNode,
mapIdToNode = series.nodeMap,
nodeRoot = mapIdToNode[idRoot],
levelIsConstant = (
isBoolean(options.levelIsConstant) ?
options.levelIsConstant :
true
),
childrenTotal = 0,
children = [],
val,
point = series.points[tree.i];
// First give the children some values
tree.children.forEach(function (child) {
child = series.setTreeValues(child);
children.push(child);
if (!child.ignore) {
childrenTotal += child.val;
}
});
// Sort the children
stableSort(children, function (a, b) {
return a.sortIndex - b.sortIndex;
});
// Set the values
val = pick(point && point.options.value, childrenTotal);
if (point) {
point.value = val;
}
extend(tree, {
children: children,
childrenTotal: childrenTotal,
// Ignore this node if point is not visible
ignore: !(pick(point && point.visible, true) && (val > 0)),
isLeaf: tree.visible && !childrenTotal,
levelDynamic: (
tree.level - (levelIsConstant ? 0 : nodeRoot.level)
),
name: pick(point && point.name, ''),
sortIndex: pick(point && point.sortIndex, -val),
val: val
});
return tree;
},
/**
* Recursive function which calculates the area for all children of a
* node.
*
* @private
* @function Highcharts.Series#calculateChildrenAreas
*
* @param {object} node
* The node which is parent to the children.
*
* @param {object} area
* The rectangular area of the parent.
*/
calculateChildrenAreas: function (parent, area) {
var series = this,
options = series.options,
mapOptionsToLevel = series.mapOptionsToLevel,
level = mapOptionsToLevel[parent.level + 1],
algorithm = pick(
(
series[level &&
level.layoutAlgorithm] &&
level.layoutAlgorithm
),
options.layoutAlgorithm
),
alternate = options.alternateStartingDirection,
childrenValues = [],
children;
// Collect all children which should be included
children = parent.children.filter(function (n) {
return !n.ignore;
});
if (level && level.layoutStartingDirection) {
area.direction = level.layoutStartingDirection === 'vertical' ?
0 :
1;
}
childrenValues = series[algorithm](area, children);
children.forEach(function (child, index) {
var values = childrenValues[index];
child.values = merge(values, {
val: child.childrenTotal,
direction: (alternate ? 1 - area.direction : area.direction)
});
child.pointValues = merge(values, {
x: (values.x / series.axisRatio),
width: (values.width / series.axisRatio)
});
// If node has children, then call method recursively
if (child.children.length) {
series.calculateChildrenAreas(child, child.values);
}
});
},
setPointValues: function () {
var series = this,
xAxis = series.xAxis,
yAxis = series.yAxis;
series.points.forEach(function (point) {
var node = point.node,
values = node.pointValues,
x1,
x2,
y1,
y2,
crispCorr = 0;
// Get the crisp correction in classic mode. For this to work in
// styled mode, we would need to first add the shape (without x,
// y, width and height), then read the rendered stroke width
// using point.graphic.strokeWidth(), then modify and apply the
// shapeArgs. This applies also to column series, but the
// downside is performance and code complexity.
if (!series.chart.styledMode) {
crispCorr = (
(series.pointAttribs(point)['stroke-width'] || 0) % 2
) / 2;
}
// Points which is ignored, have no values.
if (values && node.visible) {
x1 = Math.round(
xAxis.translate(values.x, 0, 0, 0, 1)
) - crispCorr;
x2 = Math.round(
xAxis.translate(values.x + values.width, 0, 0, 0, 1)
) - crispCorr;
y1 = Math.round(
yAxis.translate(values.y, 0, 0, 0, 1)
) - crispCorr;
y2 = Math.round(
yAxis.translate(values.y + values.height, 0, 0, 0, 1)
) - crispCorr;
// Set point values
point.shapeType = 'rect';
point.shapeArgs = {
x: Math.min(x1, x2),
y: Math.min(y1, y2),
width: Math.abs(x2 - x1),
height: Math.abs(y2 - y1)
};
point.plotX =
point.shapeArgs.x + (point.shapeArgs.width / 2);
point.plotY =
point.shapeArgs.y + (point.shapeArgs.height / 2);
} else {
// Reset visibility
delete point.plotX;
delete point.plotY;
}
});
},
// Set the node's color recursively, from the parent down.
setColorRecursive: function (
node,
parentColor,
colorIndex,
index,
siblings
) {
var series = this,
chart = series && series.chart,
colors = chart && chart.options && chart.options.colors,
colorInfo,
point;
if (node) {
colorInfo = getColor(node, {
colors: colors,
index: index,
mapOptionsToLevel: series.mapOptionsToLevel,
parentColor: parentColor,
parentColorIndex: colorIndex,
series: series,
siblings: siblings
});
point = series.points[node.i];
if (point) {
point.color = colorInfo.color;
point.colorIndex = colorInfo.colorIndex;
}
// Do it all again with the children
(node.children || []).forEach(function (child, i) {
series.setColorRecursive(
child,
colorInfo.color,
colorInfo.colorIndex,
i,
node.children.length
);
});
}
},
algorithmGroup: function (h, w, d, p) {
this.height = h;
this.width = w;
this.plot = p;
this.direction = d;
this.startDirection = d;
this.total = 0;
this.nW = 0;
this.lW = 0;
this.nH = 0;
this.lH = 0;
this.elArr = [];
this.lP = {
total: 0,
lH: 0,
nH: 0,
lW: 0,
nW: 0,
nR: 0,
lR: 0,
aspectRatio: function (w, h) {
return Math.max((w / h), (h / w));
}
};
this.addElement = function (el) {
this.lP.total = this.elArr[this.elArr.length - 1];
this.total = this.total + el;
if (this.direction === 0) {
// Calculate last point old aspect ratio
this.lW = this.nW;
this.lP.lH = this.lP.total / this.lW;
this.lP.lR = this.lP.aspectRatio(this.lW, this.lP.lH);
// Calculate last point new aspect ratio
this.nW = this.total / this.height;
this.lP.nH = this.lP.total / this.nW;
this.lP.nR = this.lP.aspectRatio(this.nW, this.lP.nH);
} else {
// Calculate last point old aspect ratio
this.lH = this.nH;
this.lP.lW = this.lP.total / this.lH;
this.lP.lR = this.lP.aspectRatio(this.lP.lW, this.lH);
// Calculate last point new aspect ratio
this.nH = this.total / this.width;
this.lP.nW = this.lP.total / this.nH;
this.lP.nR = this.lP.aspectRatio(this.lP.nW, this.nH);
}
this.elArr.push(el);
};
this.reset = function () {
this.nW = 0;
this.lW = 0;
this.elArr = [];
this.total = 0;
};
},
algorithmCalcPoints: function (
directionChange, last, group, childrenArea
) {
var pX,
pY,
pW,
pH,
gW = group.lW,
gH = group.lH,
plot = group.plot,
keep,
i = 0,
end = group.elArr.length - 1;
if (last) {
gW = group.nW;
gH = group.nH;
} else {
keep = group.elArr[group.elArr.length - 1];
}
group.elArr.forEach(function (p) {
if (last || (i < end)) {
if (group.direction === 0) {
pX = plot.x;
pY = plot.y;
pW = gW;
pH = p / pW;
} else {
pX = plot.x;
pY = plot.y;
pH = gH;
pW = p / pH;
}
childrenArea.push({
x: pX,
y: pY,
width: pW,
height: pH
});
if (group.direction === 0) {
plot.y = plot.y + pH;
} else {
plot.x = plot.x + pW;
}
}
i = i + 1;
});
// Reset variables
group.reset();
if (group.direction === 0) {
group.width = group.width - gW;
} else {
group.height = group.height - gH;
}
plot.y = plot.parent.y + (plot.parent.height - group.height);
plot.x = plot.parent.x + (plot.parent.width - group.width);
if (directionChange) {
group.direction = 1 - group.direction;
}
// If not last, then add uncalculated element
if (!last) {
group.addElement(keep);
}
},
algorithmLowAspectRatio: function (directionChange, parent, children) {
var childrenArea = [],
series = this,
pTot,
plot = {
x: parent.x,
y: parent.y,
parent: parent
},
direction = parent.direction,
i = 0,
end = children.length - 1,
group = new this.algorithmGroup( // eslint-disable-line new-cap
parent.height,
parent.width,
direction,
plot
);
// Loop through and calculate all areas
children.forEach(function (child) {
pTot =
(parent.width * parent.height) * (child.val / parent.val);
group.addElement(pTot);
if (group.lP.nR > group.lP.lR) {
series.algorithmCalcPoints(
directionChange,
false,
group,
childrenArea,
plot
);
}
// If last child, then calculate all remaining areas
if (i === end) {
series.algorithmCalcPoints(
directionChange,
true,
group,
childrenArea,
plot
);
}
i = i + 1;
});
return childrenArea;
},
algorithmFill: function (directionChange, parent, children) {
var childrenArea = [],
pTot,
direction = parent.direction,
x = parent.x,
y = parent.y,
width = parent.width,
height = parent.height,
pX,
pY,
pW,
pH;
children.forEach(function (child) {
pTot =
(parent.width * parent.height) * (child.val / parent.val);
pX = x;
pY = y;
if (direction === 0) {
pH = height;
pW = pTot / pH;
width = width - pW;
x = x + pW;
} else {
pW = width;
pH = pTot / pW;
height = height - pH;
y = y + pH;
}
childrenArea.push({
x: pX,
y: pY,
width: pW,
height: pH
});
if (directionChange) {
direction = 1 - direction;
}
});
return childrenArea;
},
strip: function (parent, children) {
return this.algorithmLowAspectRatio(false, parent, children);
},
squarified: function (parent, children) {
return this.algorithmLowAspectRatio(true, parent, children);
},
sliceAndDice: function (parent, children) {
return this.algorithmFill(true, parent, children);
},
stripes: function (parent, children) {
return this.algorithmFill(false, parent, children);
},
translate: function () {
var series = this,
options = series.options,
// NOTE: updateRootId modifies series.
rootId = updateRootId(series),
rootNode,
pointValues,
seriesArea,
tree,
val;
// Call prototype function
Series.prototype.translate.call(series);
// @todo Only if series.isDirtyData is true
tree = series.tree = series.getTree();
rootNode = series.nodeMap[rootId];
series.mapOptionsToLevel = getLevelOptions({
from: rootNode.level + 1,
levels: options.levels,
to: tree.height,
defaults: {
levelIsConstant: series.options.levelIsConstant,
colorByPoint: options.colorByPoint
}
});
if (
rootId !== '' &&
(!rootNode || !rootNode.children.length)
) {
series.drillToNode('', false);
rootId = series.rootNode;
rootNode = series.nodeMap[rootId];
}
// Parents of the root node is by default visible
recursive(series.nodeMap[series.rootNode], function (node) {
var next = false,
p = node.parent;
node.visible = true;
if (p || p === '') {
next = series.nodeMap[p];
}
return next;
});
// Children of the root node is by default visible
recursive(
series.nodeMap[series.rootNode].children,
function (children) {
var next = false;
children.forEach(function (child) {
child.visible = true;
if (child.children.length) {
next = (next || []).concat(child.children);
}
});
return next;
}
);
series.setTreeValues(tree);
// Calculate plotting values.
series.axisRatio = (series.xAxis.len / series.yAxis.len);
series.nodeMap[''].pointValues = pointValues =
{ x: 0, y: 0, width: 100, height: 100 };
series.nodeMap[''].values = seriesArea = merge(pointValues, {
width: (pointValues.width * series.axisRatio),
direction: (
options.layoutStartingDirection === 'vertical' ? 0 : 1
),
val: tree.val
});
series.calculateChildrenAreas(tree, seriesArea);
// Logic for point colors
if (series.colorAxis) {
series.translateColors();
} else if (!options.colorByPoint) {
series.setColorRecursive(series.tree);
}
// Update axis extremes according to the root node.
if (options.allowDrillToNode) {
val = rootNode.pointValues;
series.xAxis.setExtremes(val.x, val.x + val.width, false);
series.yAxis.setExtremes(val.y, val.y + val.height, false);
series.xAxis.setScale();
series.yAxis.setScale();
}
// Assign values to points.
series.setPointValues();
},
/**
* Extend drawDataLabels with logic to handle custom options related to
* the treemap series:
*
* - Points which is not a leaf node, has dataLabels disabled by
* default.
*
* - Options set on series.levels is merged in.
*
* - Width of the dataLabel is set to match the width of the point
* shape.
*
* @private
* @function Highcharts.Series#drawDataLabels
*/
drawDataLabels: function () {
var series = this,
mapOptionsToLevel = series.mapOptionsToLevel,
points = series.points.filter(function (n) {
return n.node.visible;
}),
options,
level;
points.forEach(function (point) {
level = mapOptionsToLevel[point.node.level];
// Set options to new object to avoid problems with scope
options = { style: {} };
// If not a leaf, then label should be disabled as default
if (!point.node.isLeaf) {
options.enabled = false;
}
// If options for level exists, include them as well
if (level && level.dataLabels) {
options = merge(options, level.dataLabels);
series._hasPointLabels = true;
}
// Set dataLabel width to the width of the point shape.
if (point.shapeArgs) {
options.style.width = point.shapeArgs.width;
if (point.dataLabel) {
point.dataLabel.css({
width: point.shapeArgs.width + 'px'
});
}
}
// Merge custom options with point options
point.dlOptions = merge(options, point.options.dataLabels);
});
Series.prototype.drawDataLabels.call(this);
},
// Over the alignment method by setting z index
alignDataLabel: function (point, dataLabel, labelOptions) {
var style = labelOptions.style;
// #8160: Prevent the label from exceeding the point's
// boundaries in treemaps by applying ellipsis overflow.
// The issue was happening when datalabel's text contained a
// long sequence of characters without a whitespace.
if (
!H.defined(style.textOverflow) &&
dataLabel.text &&
dataLabel.getBBox().width > dataLabel.text.textWidth
) {
dataLabel.css({
textOverflow: 'ellipsis',
// unit (px) is required when useHTML is true
width: style.width += 'px'
});
}
seriesTypes.column.prototype.alignDataLabel.apply(this, arguments);
if (point.dataLabel) {
// point.node.zIndex could be undefined (#6956)
point.dataLabel.attr({ zIndex: (point.node.zIndex || 0) + 1 });
}
},
// Get presentational attributes
pointAttribs: function (point, state) {
var series = this,
mapOptionsToLevel = (
isObject(series.mapOptionsToLevel) ?
series.mapOptionsToLevel :
{}
),
level = point && mapOptionsToLevel[point.node.level] || {},
options = this.options,
attr,
stateOptions = (state && options.states[state]) || {},
className = (point && point.getClassName()) || '',
opacity;
// Set attributes by precedence. Point trumps level trumps series.
// Stroke width uses pick because it can be 0.
attr = {
'stroke':
(point && point.borderColor) ||
level.borderColor ||
stateOptions.borderColor ||
options.borderColor,
'stroke-width': pick(
point && point.borderWidth,
level.borderWidth,
stateOptions.borderWidth,
options.borderWidth
),
'dashstyle':
(point && point.borderDashStyle) ||
level.borderDashStyle ||
stateOptions.borderDashStyle ||
options.borderDashStyle,
'fill': (point && point.color) || this.color
};
// Hide levels above the current view
if (className.indexOf('highcharts-above-level') !== -1) {
attr.fill = 'none';
attr['stroke-width'] = 0;
// Nodes with children that accept interaction
} else if (
className.indexOf('highcharts-internal-node-interactive') !== -1
) {
opacity = pick(stateOptions.opacity, options.opacity);
attr.fill = color(attr.fill).setOpacity(opacity).get();
attr.cursor = 'pointer';
// Hide nodes that have children
} else if (className.indexOf('highcharts-internal-node') !== -1) {
attr.fill = 'none';
} else if (state) {
// Brighten and hoist the hover nodes
attr.fill = color(attr.fill)
.brighten(stateOptions.brightness)
.get();
}
return attr;
},
// Extending ColumnSeries drawPoints
drawPoints: function () {
var series = this,
points = series.points.filter(function (n) {
return n.node.visible;
});
points.forEach(function (point) {
var groupKey = 'level-group-' + point.node.levelDynamic;
if (!series[groupKey]) {
series[groupKey] = series.chart.renderer.g(groupKey)
.attr({
// @todo Set the zIndex based upon the number of levels,
// instead of using 1000
zIndex: 1000 - point.node.levelDynamic
})
.add(series.group);
}
point.group = series[groupKey];
});
// Call standard drawPoints
seriesTypes.column.prototype.drawPoints.call(this);
// In styled mode apply point.color. Use CSS, otherwise the fill
// used in the style sheet will take precedence over the fill
// attribute.
if (this.colorAttribs && series.chart.styledMode) {
// Heatmap is loaded
this.points.forEach(function (point) {
if (point.graphic) {
point.graphic.css(this.colorAttribs(point));
}
}, this);
}
// If drillToNode is allowed, set a point cursor on clickables & add
// drillId to point
if (series.options.allowDrillToNode) {
points.forEach(function (point) {
if (point.graphic) {
point.drillId = series.options.interactByLeaf ?
series.drillToByLeaf(point) :
series.drillToByGroup(point);
}
});
}
},
// Add drilling on the suitable points
onClickDrillToNode: function (event) {
var series = this,
point = event.point,
drillId = point && point.drillId;
// If a drill id is returned, add click event and cursor.
if (isString(drillId)) {
point.setState(''); // Remove hover
series.drillToNode(drillId);
}
},
/**
* Finds the drill id for a parent node. Returns false if point should
* not have a click event.
*
* @private
* @function Highcharts.Series#drillToByGroup
*
* @param {object} point
*
* @return {boolean|string}
* Drill to id or false when point should not have a click
* event.
*/
drillToByGroup: function (point) {
var series = this,
drillId = false;
if ((point.node.level - series.nodeMap[series.rootNode].level) ===
1 &&
!point.node.isLeaf
) {
drillId = point.id;
}
return drillId;
},
/**
* Finds the drill id for a leaf node. Returns false if point should not
* have a click event
*
* @private
* @function Highcharts.Series#drillToByLeaf
*
* @param {object} point
*
* @return {boolean|string}
* Drill to id or false when point should not have a click
* event.
*/
drillToByLeaf: function (point) {
var series = this,
drillId = false,
nodeParent;
if ((point.node.parent !== series.rootNode) &&
point.node.isLeaf
) {
nodeParent = point.node;
while (!drillId) {
nodeParent = series.nodeMap[nodeParent.parent];
if (nodeParent.parent === series.rootNode) {
drillId = nodeParent.id;
}
}
}
return drillId;
},
drillUp: function () {
var series = this,
node = series.nodeMap[series.rootNode];
if (node && isString(node.parent)) {
series.drillToNode(node.parent);
}
},
drillToNode: function (id, redraw) {
var series = this,
nodeMap = series.nodeMap,
node = nodeMap[id];
series.idPreviousRoot = series.rootNode;
series.rootNode = id;
if (id === '') {
series.drillUpButton = series.drillUpButton.destroy();
} else {
series.showDrillUpButton((node && node.name || id));
}
this.isDirty = true; // Force redraw
if (pick(redraw, true)) {
this.chart.redraw();
}
},
showDrillUpButton: function (name) {
var series = this,
backText = (name || '< Back'),
buttonOptions = series.options.drillUpButton,
attr,
states;
if (buttonOptions.text) {
backText = buttonOptions.text;
}
if (!this.drillUpButton) {
attr = buttonOptions.theme;
states = attr && attr.states;
this.drillUpButton = this.chart.renderer.button(
backText,
null,
null,
function () {
series.drillUp();
},
attr,
states && states.hover,
states && states.select
)
.addClass('highcharts-drillup-button')
.attr({
align: buttonOptions.position.align,
zIndex: 7
})
.add()
.align(
buttonOptions.position,
false,
buttonOptions.relativeTo || 'plotBox'
);
} else {
this.drillUpButton.placed = false;
this.drillUpButton.attr({
text: backText
})
.align();
}
},
buildKDTree: noop,
drawLegendSymbol: H.LegendSymbolMixin.drawRectangle,
getExtremes: function () {
// Get the extremes from the value data
Series.prototype.getExtremes.call(this, this.colorValueData);
this.valueMin = this.dataMin;
this.valueMax = this.dataMax;
// Get the extremes from the y data
Series.prototype.getExtremes.call(this);
},
getExtremesFromAll: true,
bindAxes: function () {
var treeAxis = {
endOnTick: false,
gridLineWidth: 0,
lineWidth: 0,
min: 0,
dataMin: 0,
minPadding: 0,
max: 100,
dataMax: 100,
maxPadding: 0,
startOnTick: false,
title: null,
tickPositions: []
};
Series.prototype.bindAxes.call(this);
H.extend(this.yAxis.options, treeAxis);
H.extend(this.xAxis.options, treeAxis);
},
utils: {
recursive: recursive
}
// Point class
}, {
getClassName: function () {
var className = H.Point.prototype.getClassName.call(this),
series = this.series,
options = series.options;
// Above the current level
if (this.node.level <= series.nodeMap[series.rootNode].level) {
className += ' highcharts-above-level';
} else if (
!this.node.isLeaf &&
!pick(options.interactByLeaf, !options.allowDrillToNode)
) {
className += ' highcharts-internal-node-interactive';
} else if (!this.node.isLeaf) {
className += ' highcharts-internal-node';
}
return className;
},
/**
* A tree point is valid if it has han id too, assume it may be a parent
* item.
*
* @private
* @function Highcharts.Point#isValid
*/
isValid: function () {
return this.id || isNumber(this.value);
},
setState: function (state) {
H.Point.prototype.setState.call(this, state);
// Graphic does not exist when point is not visible.
if (this.graphic) {
this.graphic.attr({
zIndex: state === 'hover' ? 1 : 0
});
}
},
setVisible: seriesTypes.pie.prototype.pointClass.prototype.setVisible
}
);
/**
* A `treemap` series. If the [type](#series.treemap.type) option is
* not specified, it is inherited from [chart.type](#chart.type).
*
* @extends series,plotOptions.treemap
* @excluding dataParser, dataURL, stack
* @product highcharts
* @apioption series.treemap
*/
/**
* An array of data points for the series. For the `treemap` series
* type, points can be given in the following ways:
*
* 1. An array of numerical values. In this case, the numerical values
* will be interpreted as `value` options. Example:
*
* ```js
* data: [0, 5, 3, 5]
* ```
*
* 2. An array of objects with named values. The following snippet shows only a
* few settings, see the complete options set below. If the total number of data
* points exceeds the series' [turboThreshold](#series.treemap.turboThreshold),
* this option is not available.
*
* ```js
* data: [{
* value: 9,
* name: "Point2",
* color: "#00FF00"
* }, {
* value: 6,
* name: "Point1",
* color: "#FF00FF"
* }]
* ```
*
* @sample {highcharts} highcharts/chart/reflow-true/
* Numerical values
* @sample {highcharts} highcharts/series/data-array-of-objects/
* Config objects
*
* @type {Array<number|*>}
* @extends series.heatmap.data
* @excluding x, y
* @product highcharts
* @apioption series.treemap.data
*/
/**
* The value of the point, resulting in a relative area of the point
* in the treemap.
*
* @type {number}
* @product highcharts
* @apioption series.treemap.data.value
*/
/**
* Serves a purpose only if a `colorAxis` object is defined in the chart
* options. This value will decide which color the point gets from the
* scale of the colorAxis.
*
* @type {number}
* @since 4.1.0
* @product highcharts
* @apioption series.treemap.data.colorValue
*/
/**
* Only for treemap. Use this option to build a tree structure. The
* value should be the id of the point which is the parent. If no points
* has a matching id, or this option is undefined, then the parent will
* be set to the root.
*
* @sample {highcharts} highcharts/point/parent/
* Point parent
* @sample {highcharts} highcharts/demo/treemap-with-levels/
* Example where parent id is not matching
*
* @type {string}
* @since 4.1.0
* @product highcharts
* @apioption series.treemap.data.parent
*/
}(Highcharts, result));
return (function () {
}());
})); | cdnjs/cdnjs | ajax/libs/highcharts/7.0.2/modules/treemap.src.js | JavaScript | mit | 68,015 |
/*!
* @copyright Copyright © Kartik Visweswaran, Krajee.com, 2014 - 2015
* @version 1.3.3
*
* Date formatter utility library that allows formatting date/time variables or Date objects using PHP DateTime format.
* @see http://php.net/manual/en/function.date.php
*
* For more JQuery plugins visit http://plugins.krajee.com
* For more Yii related demos visit http://demos.krajee.com
*/
var DateFormatter;
(function () {
"use strict";
var _compare, _lpad, _extend, defaultSettings, DAY, HOUR;
DAY = 1000 * 60 * 60 * 24;
HOUR = 3600;
_compare = function (str1, str2) {
return typeof(str1) === 'string' && typeof(str2) === 'string' && str1.toLowerCase() === str2.toLowerCase();
};
_lpad = function (value, length, char) {
var chr = char || '0', val = value.toString();
return val.length < length ? _lpad(chr + val, length) : val;
};
_extend = function (out) {
var i, obj;
out = out || {};
for (i = 1; i < arguments.length; i++) {
obj = arguments[i];
if (!obj) {
continue;
}
for (var key in obj) {
if (obj.hasOwnProperty(key)) {
if (typeof obj[key] === 'object') {
_extend(out[key], obj[key]);
} else {
out[key] = obj[key];
}
}
}
}
return out;
};
defaultSettings = {
dateSettings: {
days: ['Sunday', 'Monday', 'Tuesday', 'Wednesday', 'Thursday', 'Friday', 'Saturday'],
daysShort: ['Sun', 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat'],
months: [
'January', 'February', 'March', 'April', 'May', 'June', 'July',
'August', 'September', 'October', 'November', 'December'
],
monthsShort: ['Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec'],
meridiem: ['AM', 'PM'],
ordinal: function (number) {
var n = number % 10, suffixes = {1: 'st', 2: 'nd', 3: 'rd'};
return Math.floor(number % 100 / 10) === 1 || !suffixes[n] ? 'th' : suffixes[n];
}
},
separators: /[ \-+\/\.T:@]/g,
validParts: /[dDjlNSwzWFmMntLoYyaABgGhHisueTIOPZcrU]/g,
intParts: /[djwNzmnyYhHgGis]/g,
tzParts: /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g,
tzClip: /[^-+\dA-Z]/g
};
DateFormatter = function (options) {
var self = this, config = _extend(defaultSettings, options);
self.dateSettings = config.dateSettings;
self.separators = config.separators;
self.validParts = config.validParts;
self.intParts = config.intParts;
self.tzParts = config.tzParts;
self.tzClip = config.tzClip;
};
DateFormatter.prototype = {
constructor: DateFormatter,
parseDate: function (vDate, vFormat) {
var self = this, vFormatParts, vDateParts, i, vDateFlag = false, vTimeFlag = false, vDatePart, iDatePart,
vSettings = self.dateSettings, vMonth, vMeriIndex, vMeriOffset, len, mer,
out = {date: null, year: null, month: null, day: null, hour: 0, min: 0, sec: 0};
if (!vDate) {
return undefined;
}
if (vDate instanceof Date) {
return vDate;
}
if (typeof vDate === 'number') {
return new Date(vDate);
}
if (vFormat === 'U') {
i = parseInt(vDate);
return i ? new Date(i * 1000) : vDate;
}
if (typeof vDate !== 'string') {
return '';
}
vFormatParts = vFormat.match(self.validParts);
if (!vFormatParts || vFormatParts.length === 0) {
throw new Error("Invalid date format definition.");
}
vDateParts = vDate.replace(self.separators, '\0').split('\0');
for (i = 0; i < vDateParts.length; i++) {
vDatePart = vDateParts[i];
iDatePart = parseInt(vDatePart);
switch (vFormatParts[i]) {
case 'y':
case 'Y':
len = vDatePart.length;
if (len === 2) {
out.year = parseInt((iDatePart < 70 ? '20' : '19') + vDatePart);
} else if (len === 4) {
out.year = iDatePart;
}
vDateFlag = true;
break;
case 'm':
case 'n':
case 'M':
case 'F':
if (isNaN(vDatePart)) {
vMonth = vSettings.monthsShort.indexOf(vDatePart);
if (vMonth > -1) {
out.month = vMonth + 1;
}
vMonth = vSettings.months.indexOf(vDatePart);
if (vMonth > -1) {
out.month = vMonth + 1;
}
} else {
if (iDatePart >= 1 && iDatePart <= 12) {
out.month = iDatePart;
}
}
vDateFlag = true;
break;
case 'd':
case 'j':
if (iDatePart >= 1 && iDatePart <= 31) {
out.day = iDatePart;
}
vDateFlag = true;
break;
case 'g':
case 'h':
vMeriIndex = (vFormatParts.indexOf('a') > -1) ? vFormatParts.indexOf('a') :
(vFormatParts.indexOf('A') > -1) ? vFormatParts.indexOf('A') : -1;
mer = vDateParts[vMeriIndex];
if (vMeriIndex > -1) {
vMeriOffset = _compare(mer, vSettings.meridiem[0]) ? 0 :
(_compare(mer, vSettings.meridiem[1]) ? 12 : -1);
if (iDatePart >= 1 && iDatePart <= 12 && vMeriOffset > -1) {
out.hour = iDatePart + vMeriOffset - 1;
} else if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
}
} else if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
}
vTimeFlag = true;
break;
case 'G':
case 'H':
if (iDatePart >= 0 && iDatePart <= 23) {
out.hour = iDatePart;
}
vTimeFlag = true;
break;
case 'i':
if (iDatePart >= 0 && iDatePart <= 59) {
out.min = iDatePart;
}
vTimeFlag = true;
break;
case 's':
if (iDatePart >= 0 && iDatePart <= 59) {
out.sec = iDatePart;
}
vTimeFlag = true;
break;
}
}
if (vDateFlag === true && out.year && out.month && out.day) {
out.date = new Date(out.year, out.month - 1, out.day, out.hour, out.min, out.sec, 0);
} else {
if (vTimeFlag !== true) {
return false;
}
out.date = new Date(0, 0, 0, out.hour, out.min, out.sec, 0);
}
return out.date;
},
guessDate: function (vDateStr, vFormat) {
if (typeof vDateStr !== 'string') {
return vDateStr;
}
var self = this, vParts = vDateStr.replace(self.separators, '\0').split('\0'), vPattern = /^[djmn]/g,
vFormatParts = vFormat.match(self.validParts), vDate = new Date(), vDigit = 0, vYear, i, iPart, iSec;
if (!vPattern.test(vFormatParts[0])) {
return vDateStr;
}
for (i = 0; i < vParts.length; i++) {
vDigit = 2;
iPart = vParts[i];
iSec = parseInt(iPart.substr(0, 2));
switch (i) {
case 0:
if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') {
vDate.setMonth(iSec - 1);
} else {
vDate.setDate(iSec);
}
break;
case 1:
if (vFormatParts[0] === 'm' || vFormatParts[0] === 'n') {
vDate.setDate(iSec);
} else {
vDate.setMonth(iSec - 1);
}
break;
case 2:
vYear = vDate.getFullYear();
if (iPart.length < 4) {
vDate.setFullYear(parseInt(vYear.toString().substr(0, 4 - iPart.length) + iPart));
vDigit = iPart.length;
} else {
vDate.setFullYear = parseInt(iPart.substr(0, 4));
vDigit = 4;
}
break;
case 3:
vDate.setHours(iSec);
break;
case 4:
vDate.setMinutes(iSec);
break;
case 5:
vDate.setSeconds(iSec);
break;
}
if (iPart.substr(vDigit).length > 0) {
vParts.splice(i + 1, 0, iPart.substr(vDigit));
}
}
return vDate;
},
parseFormat: function (vChar, vDate) {
var self = this, vSettings = self.dateSettings, fmt, backspace = /\\?(.?)/gi, doFormat = function (t, s) {
return fmt[t] ? fmt[t]() : s;
};
fmt = {
/////////
// DAY //
/////////
/**
* Day of month with leading 0: `01..31`
* @return {string}
*/
d: function () {
return _lpad(fmt.j(), 2);
},
/**
* Shorthand day name: `Mon...Sun`
* @return {string}
*/
D: function () {
return vSettings.daysShort[fmt.w()];
},
/**
* Day of month: `1..31`
* @return {number}
*/
j: function () {
return vDate.getDate();
},
/**
* Full day name: `Monday...Sunday`
* @return {number}
*/
l: function () {
return vSettings.days[fmt.w()];
},
/**
* ISO-8601 day of week: `1[Mon]..7[Sun]`
* @return {number}
*/
N: function () {
return fmt.w() || 7;
},
/**
* Day of week: `0[Sun]..6[Sat]`
* @return {number}
*/
w: function () {
return vDate.getDay();
},
/**
* Day of year: `0..365`
* @return {number}
*/
z: function () {
var a = new Date(fmt.Y(), fmt.n() - 1, fmt.j()), b = new Date(fmt.Y(), 0, 1);
return Math.round((a - b) / DAY);
},
//////////
// WEEK //
//////////
/**
* ISO-8601 week number
* @return {number}
*/
W: function () {
var a = new Date(fmt.Y(), fmt.n() - 1, fmt.j() - fmt.N() + 3), b = new Date(a.getFullYear(), 0, 4);
return _lpad(1 + Math.round((a - b) / DAY / 7), 2);
},
///////////
// MONTH //
///////////
/**
* Full month name: `January...December`
* @return {string}
*/
F: function () {
return vSettings.months[vDate.getMonth()];
},
/**
* Month w/leading 0: `01..12`
* @return {string}
*/
m: function () {
return _lpad(fmt.n(), 2);
},
/**
* Shorthand month name; `Jan...Dec`
* @return {string}
*/
M: function () {
return vSettings.monthsShort[vDate.getMonth()];
},
/**
* Month: `1...12`
* @return {number}
*/
n: function () {
return vDate.getMonth() + 1;
},
/**
* Days in month: `28...31`
* @return {number}
*/
t: function () {
return (new Date(fmt.Y(), fmt.n(), 0)).getDate();
},
//////////
// YEAR //
//////////
/**
* Is leap year? `0 or 1`
* @return {number}
*/
L: function () {
var Y = fmt.Y();
return (Y % 4 === 0 && Y % 100 !== 0 || Y % 400 === 0) ? 1 : 0;
},
/**
* ISO-8601 year
* @return {number}
*/
o: function () {
var n = fmt.n(), W = fmt.W(), Y = fmt.Y();
return Y + (n === 12 && W < 9 ? 1 : n === 1 && W > 9 ? -1 : 0);
},
/**
* Full year: `e.g. 1980...2010`
* @return {number}
*/
Y: function () {
return vDate.getFullYear();
},
/**
* Last two digits of year: `00...99`
* @return {string}
*/
y: function () {
return fmt.Y().toString().slice(-2);
},
//////////
// TIME //
//////////
/**
* Meridian lower: `am or pm`
* @return {string}
*/
a: function () {
return fmt.A().toLowerCase();
},
/**
* Meridian upper: `AM or PM`
* @return {string}
*/
A: function () {
var n = fmt.G() < 12 ? 0 : 1;
return vSettings.meridiem[n];
},
/**
* Swatch Internet time: `000..999`
* @return {string}
*/
B: function () {
var H = vDate.getUTCHours() * HOUR, i = vDate.getUTCMinutes() * 60, s = vDate.getUTCSeconds();
return _lpad(Math.floor((H + i + s + HOUR) / 86.4) % 1000, 3);
},
/**
* 12-Hours: `1..12`
* @return {number}
*/
g: function () {
return fmt.G() % 12 || 12;
},
/**
* 24-Hours: `0..23`
* @return {number}
*/
G: function () {
return vDate.getHours();
},
/**
* 12-Hours with leading 0: `01..12`
* @return {string}
*/
h: function () {
return _lpad(fmt.g(), 2);
},
/**
* 24-Hours w/leading 0: `00..23`
* @return {string}
*/
H: function () {
return _lpad(fmt.G(), 2);
},
/**
* Minutes w/leading 0: `00..59`
* @return {string}
*/
i: function () {
return _lpad(vDate.getMinutes(), 2);
},
/**
* Seconds w/leading 0: `00..59`
* @return {string}
*/
s: function () {
return _lpad(vDate.getSeconds(), 2);
},
/**
* Microseconds: `000000-999000`
* @return {string}
*/
u: function () {
return _lpad(vDate.getMilliseconds() * 1000, 6);
},
//////////////
// TIMEZONE //
//////////////
/**
* Timezone identifier: `e.g. Atlantic/Azores, ...`
* @return {string}
*/
e: function () {
var str = /\((.*)\)/.exec(String(vDate))[1];
return str || 'Coordinated Universal Time';
},
/**
* Timezone abbreviation: `e.g. EST, MDT, ...`
* @return {string}
*/
T: function () {
var str = (String(vDate).match(self.tzParts) || [""]).pop().replace(self.tzClip, "");
return str || 'UTC';
},
/**
* DST observed? `0 or 1`
* @return {number}
*/
I: function () {
var a = new Date(fmt.Y(), 0), c = Date.UTC(fmt.Y(), 0),
b = new Date(fmt.Y(), 6), d = Date.UTC(fmt.Y(), 6);
return ((a - c) !== (b - d)) ? 1 : 0;
},
/**
* Difference to GMT in hour format: `e.g. +0200`
* @return {string}
*/
O: function () {
var tzo = vDate.getTimezoneOffset(), a = Math.abs(tzo);
return (tzo > 0 ? '-' : '+') + _lpad(Math.floor(a / 60) * 100 + a % 60, 4);
},
/**
* Difference to GMT with colon: `e.g. +02:00`
* @return {string}
*/
P: function () {
var O = fmt.O();
return (O.substr(0, 3) + ':' + O.substr(3, 2));
},
/**
* Timezone offset in seconds: `-43200...50400`
* @return {number}
*/
Z: function () {
return -vDate.getTimezoneOffset() * 60;
},
////////////////////
// FULL DATE TIME //
////////////////////
/**
* ISO-8601 date
* @return {string}
*/
c: function () {
return 'Y-m-d\\TH:i:s'.replace(backspace, doFormat);
},
/**
* RFC 2822 date
* @return {string}
*/
r: function () {
return 'D, d M Y H:i:s O'.replace(backspace, doFormat);
},
/**
* Seconds since UNIX epoch
* @return {number}
*/
U: function () {
return vDate.getTime() / 1000 || 0;
}
};
return doFormat(vChar, vChar);
},
formatDate: function (vDate, vFormat) {
var self = this, i, n, len, str, vChar, vDateStr = '';
if (typeof vDate === 'string') {
vDate = self.parseDate(vDate, vFormat);
if (vDate === false) {
return false;
}
}
if (vDate instanceof Date) {
len = vFormat.length;
for (i = 0; i < len; i++) {
vChar = vFormat.charAt(i);
if (vChar === 'S') {
continue;
}
str = self.parseFormat(vChar, vDate);
if (i !== (len - 1) && self.intParts.test(vChar) && vFormat.charAt(i + 1) === 'S') {
n = parseInt(str);
str += self.dateSettings.ordinal(n);
}
vDateStr += str;
}
return vDateStr;
}
return '';
}
};
})();/**
* @preserve jQuery DateTimePicker plugin v2.5.1
* @homepage http://xdsoft.net/jqplugins/datetimepicker/
* @author Chupurnov Valeriy (<chupurnov@gmail.com>)
*/
/*global DateFormatter, document,window,jQuery,setTimeout,clearTimeout,HighlightedDate,getCurrentValue*/
;(function (factory) {
if ( typeof define === 'function' && define.amd ) {
// AMD. Register as an anonymous module.
define(['jquery', 'jquery-mousewheel'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
'use strict';
var default_options = {
i18n: {
ar: { // Arabic
months: [
"كانون الثاني", "شباط", "آذار", "نيسان", "مايو", "حزيران", "تموز", "آب", "أيلول", "تشرين الأول", "تشرين الثاني", "كانون الأول"
],
dayOfWeekShort: [
"ن", "ث", "ع", "خ", "ج", "س", "ح"
],
dayOfWeek: ["الأحد", "الاثنين", "الثلاثاء", "الأربعاء", "الخميس", "الجمعة", "السبت", "الأحد"]
},
ro: { // Romanian
months: [
"Ianuarie", "Februarie", "Martie", "Aprilie", "Mai", "Iunie", "Iulie", "August", "Septembrie", "Octombrie", "Noiembrie", "Decembrie"
],
dayOfWeekShort: [
"Du", "Lu", "Ma", "Mi", "Jo", "Vi", "Sâ"
],
dayOfWeek: ["Duminică", "Luni", "Marţi", "Miercuri", "Joi", "Vineri", "Sâmbătă"]
},
id: { // Indonesian
months: [
"Januari", "Februari", "Maret", "April", "Mei", "Juni", "Juli", "Agustus", "September", "Oktober", "November", "Desember"
],
dayOfWeekShort: [
"Min", "Sen", "Sel", "Rab", "Kam", "Jum", "Sab"
],
dayOfWeek: ["Minggu", "Senin", "Selasa", "Rabu", "Kamis", "Jumat", "Sabtu"]
},
is: { // Icelandic
months: [
"Janúar", "Febrúar", "Mars", "Apríl", "Maí", "Júní", "Júlí", "Ágúst", "September", "Október", "Nóvember", "Desember"
],
dayOfWeekShort: [
"Sun", "Mán", "Þrið", "Mið", "Fim", "Fös", "Lau"
],
dayOfWeek: ["Sunnudagur", "Mánudagur", "Þriðjudagur", "Miðvikudagur", "Fimmtudagur", "Föstudagur", "Laugardagur"]
},
bg: { // Bulgarian
months: [
"Януари", "Февруари", "Март", "Април", "Май", "Юни", "Юли", "Август", "Септември", "Октомври", "Ноември", "Декември"
],
dayOfWeekShort: [
"Нд", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
],
dayOfWeek: ["Неделя", "Понеделник", "Вторник", "Сряда", "Четвъртък", "Петък", "Събота"]
},
fa: { // Persian/Farsi
months: [
'فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند'
],
dayOfWeekShort: [
'یکشنبه', 'دوشنبه', 'سه شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه', 'شنبه'
],
dayOfWeek: ["یکشنبه", "دوشنبه", "سهشنبه", "چهارشنبه", "پنجشنبه", "جمعه", "شنبه", "یکشنبه"]
},
ru: { // Russian
months: [
'Январь', 'Февраль', 'Март', 'Апрель', 'Май', 'Июнь', 'Июль', 'Август', 'Сентябрь', 'Октябрь', 'Ноябрь', 'Декабрь'
],
dayOfWeekShort: [
"Вс", "Пн", "Вт", "Ср", "Чт", "Пт", "Сб"
],
dayOfWeek: ["Воскресенье", "Понедельник", "Вторник", "Среда", "Четверг", "Пятница", "Суббота"]
},
uk: { // Ukrainian
months: [
'Січень', 'Лютий', 'Березень', 'Квітень', 'Травень', 'Червень', 'Липень', 'Серпень', 'Вересень', 'Жовтень', 'Листопад', 'Грудень'
],
dayOfWeekShort: [
"Ндл", "Пнд", "Втр", "Срд", "Чтв", "Птн", "Сбт"
],
dayOfWeek: ["Неділя", "Понеділок", "Вівторок", "Середа", "Четвер", "П'ятниця", "Субота"]
},
en: { // English
months: [
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
],
dayOfWeekShort: [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
],
dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
},
el: { // Ελληνικά
months: [
"Ιανουάριος", "Φεβρουάριος", "Μάρτιος", "Απρίλιος", "Μάιος", "Ιούνιος", "Ιούλιος", "Αύγουστος", "Σεπτέμβριος", "Οκτώβριος", "Νοέμβριος", "Δεκέμβριος"
],
dayOfWeekShort: [
"Κυρ", "Δευ", "Τρι", "Τετ", "Πεμ", "Παρ", "Σαβ"
],
dayOfWeek: ["Κυριακή", "Δευτέρα", "Τρίτη", "Τετάρτη", "Πέμπτη", "Παρασκευή", "Σάββατο"]
},
de: { // German
months: [
'Januar', 'Februar', 'März', 'April', 'Mai', 'Juni', 'Juli', 'August', 'September', 'Oktober', 'November', 'Dezember'
],
dayOfWeekShort: [
"So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"
],
dayOfWeek: ["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"]
},
nl: { // Dutch
months: [
"januari", "februari", "maart", "april", "mei", "juni", "juli", "augustus", "september", "oktober", "november", "december"
],
dayOfWeekShort: [
"zo", "ma", "di", "wo", "do", "vr", "za"
],
dayOfWeek: ["zondag", "maandag", "dinsdag", "woensdag", "donderdag", "vrijdag", "zaterdag"]
},
tr: { // Turkish
months: [
"Ocak", "Şubat", "Mart", "Nisan", "Mayıs", "Haziran", "Temmuz", "Ağustos", "Eylül", "Ekim", "Kasım", "Aralık"
],
dayOfWeekShort: [
"Paz", "Pts", "Sal", "Çar", "Per", "Cum", "Cts"
],
dayOfWeek: ["Pazar", "Pazartesi", "Salı", "Çarşamba", "Perşembe", "Cuma", "Cumartesi"]
},
fr: { //French
months: [
"Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"
],
dayOfWeekShort: [
"Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"
],
dayOfWeek: ["dimanche", "lundi", "mardi", "mercredi", "jeudi", "vendredi", "samedi"]
},
es: { // Spanish
months: [
"Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"
],
dayOfWeekShort: [
"Dom", "Lun", "Mar", "Mié", "Jue", "Vie", "Sáb"
],
dayOfWeek: ["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"]
},
th: { // Thai
months: [
'มกราคม', 'กุมภาพันธ์', 'มีนาคม', 'เมษายน', 'พฤษภาคม', 'มิถุนายน', 'กรกฎาคม', 'สิงหาคม', 'กันยายน', 'ตุลาคม', 'พฤศจิกายน', 'ธันวาคม'
],
dayOfWeekShort: [
'อา.', 'จ.', 'อ.', 'พ.', 'พฤ.', 'ศ.', 'ส.'
],
dayOfWeek: ["อาทิตย์", "จันทร์", "อังคาร", "พุธ", "พฤหัส", "ศุกร์", "เสาร์", "อาทิตย์"]
},
pl: { // Polish
months: [
"styczeń", "luty", "marzec", "kwiecień", "maj", "czerwiec", "lipiec", "sierpień", "wrzesień", "październik", "listopad", "grudzień"
],
dayOfWeekShort: [
"nd", "pn", "wt", "śr", "cz", "pt", "sb"
],
dayOfWeek: ["niedziela", "poniedziałek", "wtorek", "środa", "czwartek", "piątek", "sobota"]
},
pt: { // Portuguese
months: [
"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
],
dayOfWeekShort: [
"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sab"
],
dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
},
ch: { // Simplified Chinese
months: [
"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
],
dayOfWeekShort: [
"日", "一", "二", "三", "四", "五", "六"
]
},
se: { // Swedish
months: [
"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
]
},
kr: { // Korean
months: [
"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
],
dayOfWeekShort: [
"일", "월", "화", "수", "목", "금", "토"
],
dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
},
it: { // Italian
months: [
"Gennaio", "Febbraio", "Marzo", "Aprile", "Maggio", "Giugno", "Luglio", "Agosto", "Settembre", "Ottobre", "Novembre", "Dicembre"
],
dayOfWeekShort: [
"Dom", "Lun", "Mar", "Mer", "Gio", "Ven", "Sab"
],
dayOfWeek: ["Domenica", "Lunedì", "Martedì", "Mercoledì", "Giovedì", "Venerdì", "Sabato"]
},
da: { // Dansk
months: [
"January", "Februar", "Marts", "April", "Maj", "Juni", "July", "August", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
],
dayOfWeek: ["søndag", "mandag", "tirsdag", "onsdag", "torsdag", "fredag", "lørdag"]
},
no: { // Norwegian
months: [
"Januar", "Februar", "Mars", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Desember"
],
dayOfWeekShort: [
"Søn", "Man", "Tir", "Ons", "Tor", "Fre", "Lør"
],
dayOfWeek: ['Søndag', 'Mandag', 'Tirsdag', 'Onsdag', 'Torsdag', 'Fredag', 'Lørdag']
},
ja: { // Japanese
months: [
"1月", "2月", "3月", "4月", "5月", "6月", "7月", "8月", "9月", "10月", "11月", "12月"
],
dayOfWeekShort: [
"日", "月", "火", "水", "木", "金", "土"
],
dayOfWeek: ["日曜", "月曜", "火曜", "水曜", "木曜", "金曜", "土曜"]
},
vi: { // Vietnamese
months: [
"Tháng 1", "Tháng 2", "Tháng 3", "Tháng 4", "Tháng 5", "Tháng 6", "Tháng 7", "Tháng 8", "Tháng 9", "Tháng 10", "Tháng 11", "Tháng 12"
],
dayOfWeekShort: [
"CN", "T2", "T3", "T4", "T5", "T6", "T7"
],
dayOfWeek: ["Chủ nhật", "Thứ hai", "Thứ ba", "Thứ tư", "Thứ năm", "Thứ sáu", "Thứ bảy"]
},
sl: { // Slovenščina
months: [
"Januar", "Februar", "Marec", "April", "Maj", "Junij", "Julij", "Avgust", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"Ned", "Pon", "Tor", "Sre", "Čet", "Pet", "Sob"
],
dayOfWeek: ["Nedelja", "Ponedeljek", "Torek", "Sreda", "Četrtek", "Petek", "Sobota"]
},
cs: { // Čeština
months: [
"Leden", "Únor", "Březen", "Duben", "Květen", "Červen", "Červenec", "Srpen", "Září", "Říjen", "Listopad", "Prosinec"
],
dayOfWeekShort: [
"Ne", "Po", "Út", "St", "Čt", "Pá", "So"
]
},
hu: { // Hungarian
months: [
"Január", "Február", "Március", "Április", "Május", "Június", "Július", "Augusztus", "Szeptember", "Október", "November", "December"
],
dayOfWeekShort: [
"Va", "Hé", "Ke", "Sze", "Cs", "Pé", "Szo"
],
dayOfWeek: ["vasárnap", "hétfő", "kedd", "szerda", "csütörtök", "péntek", "szombat"]
},
az: { //Azerbaijanian (Azeri)
months: [
"Yanvar", "Fevral", "Mart", "Aprel", "May", "Iyun", "Iyul", "Avqust", "Sentyabr", "Oktyabr", "Noyabr", "Dekabr"
],
dayOfWeekShort: [
"B", "Be", "Ça", "Ç", "Ca", "C", "Ş"
],
dayOfWeek: ["Bazar", "Bazar ertəsi", "Çərşənbə axşamı", "Çərşənbə", "Cümə axşamı", "Cümə", "Şənbə"]
},
bs: { //Bosanski
months: [
"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
],
dayOfWeekShort: [
"Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
],
dayOfWeek: ["Nedjelja","Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
},
ca: { //Català
months: [
"Gener", "Febrer", "Març", "Abril", "Maig", "Juny", "Juliol", "Agost", "Setembre", "Octubre", "Novembre", "Desembre"
],
dayOfWeekShort: [
"Dg", "Dl", "Dt", "Dc", "Dj", "Dv", "Ds"
],
dayOfWeek: ["Diumenge", "Dilluns", "Dimarts", "Dimecres", "Dijous", "Divendres", "Dissabte"]
},
'en-GB': { //English (British)
months: [
"January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"
],
dayOfWeekShort: [
"Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"
],
dayOfWeek: ["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"]
},
et: { //"Eesti"
months: [
"Jaanuar", "Veebruar", "Märts", "Aprill", "Mai", "Juuni", "Juuli", "August", "September", "Oktoober", "November", "Detsember"
],
dayOfWeekShort: [
"P", "E", "T", "K", "N", "R", "L"
],
dayOfWeek: ["Pühapäev", "Esmaspäev", "Teisipäev", "Kolmapäev", "Neljapäev", "Reede", "Laupäev"]
},
eu: { //Euskara
months: [
"Urtarrila", "Otsaila", "Martxoa", "Apirila", "Maiatza", "Ekaina", "Uztaila", "Abuztua", "Iraila", "Urria", "Azaroa", "Abendua"
],
dayOfWeekShort: [
"Ig.", "Al.", "Ar.", "Az.", "Og.", "Or.", "La."
],
dayOfWeek: ['Igandea', 'Astelehena', 'Asteartea', 'Asteazkena', 'Osteguna', 'Ostirala', 'Larunbata']
},
fi: { //Finnish (Suomi)
months: [
"Tammikuu", "Helmikuu", "Maaliskuu", "Huhtikuu", "Toukokuu", "Kesäkuu", "Heinäkuu", "Elokuu", "Syyskuu", "Lokakuu", "Marraskuu", "Joulukuu"
],
dayOfWeekShort: [
"Su", "Ma", "Ti", "Ke", "To", "Pe", "La"
],
dayOfWeek: ["sunnuntai", "maanantai", "tiistai", "keskiviikko", "torstai", "perjantai", "lauantai"]
},
gl: { //Galego
months: [
"Xan", "Feb", "Maz", "Abr", "Mai", "Xun", "Xul", "Ago", "Set", "Out", "Nov", "Dec"
],
dayOfWeekShort: [
"Dom", "Lun", "Mar", "Mer", "Xov", "Ven", "Sab"
],
dayOfWeek: ["Domingo", "Luns", "Martes", "Mércores", "Xoves", "Venres", "Sábado"]
},
hr: { //Hrvatski
months: [
"Siječanj", "Veljača", "Ožujak", "Travanj", "Svibanj", "Lipanj", "Srpanj", "Kolovoz", "Rujan", "Listopad", "Studeni", "Prosinac"
],
dayOfWeekShort: [
"Ned", "Pon", "Uto", "Sri", "Čet", "Pet", "Sub"
],
dayOfWeek: ["Nedjelja", "Ponedjeljak", "Utorak", "Srijeda", "Četvrtak", "Petak", "Subota"]
},
ko: { //Korean (한국어)
months: [
"1월", "2월", "3월", "4월", "5월", "6월", "7월", "8월", "9월", "10월", "11월", "12월"
],
dayOfWeekShort: [
"일", "월", "화", "수", "목", "금", "토"
],
dayOfWeek: ["일요일", "월요일", "화요일", "수요일", "목요일", "금요일", "토요일"]
},
lt: { //Lithuanian (lietuvių)
months: [
"Sausio", "Vasario", "Kovo", "Balandžio", "Gegužės", "Birželio", "Liepos", "Rugpjūčio", "Rugsėjo", "Spalio", "Lapkričio", "Gruodžio"
],
dayOfWeekShort: [
"Sek", "Pir", "Ant", "Tre", "Ket", "Pen", "Šeš"
],
dayOfWeek: ["Sekmadienis", "Pirmadienis", "Antradienis", "Trečiadienis", "Ketvirtadienis", "Penktadienis", "Šeštadienis"]
},
lv: { //Latvian (Latviešu)
months: [
"Janvāris", "Februāris", "Marts", "Aprīlis ", "Maijs", "Jūnijs", "Jūlijs", "Augusts", "Septembris", "Oktobris", "Novembris", "Decembris"
],
dayOfWeekShort: [
"Sv", "Pr", "Ot", "Tr", "Ct", "Pk", "St"
],
dayOfWeek: ["Svētdiena", "Pirmdiena", "Otrdiena", "Trešdiena", "Ceturtdiena", "Piektdiena", "Sestdiena"]
},
mk: { //Macedonian (Македонски)
months: [
"јануари", "февруари", "март", "април", "мај", "јуни", "јули", "август", "септември", "октомври", "ноември", "декември"
],
dayOfWeekShort: [
"нед", "пон", "вто", "сре", "чет", "пет", "саб"
],
dayOfWeek: ["Недела", "Понеделник", "Вторник", "Среда", "Четврток", "Петок", "Сабота"]
},
mn: { //Mongolian (Монгол)
months: [
"1-р сар", "2-р сар", "3-р сар", "4-р сар", "5-р сар", "6-р сар", "7-р сар", "8-р сар", "9-р сар", "10-р сар", "11-р сар", "12-р сар"
],
dayOfWeekShort: [
"Дав", "Мяг", "Лха", "Пүр", "Бсн", "Бям", "Ням"
],
dayOfWeek: ["Даваа", "Мягмар", "Лхагва", "Пүрэв", "Баасан", "Бямба", "Ням"]
},
'pt-BR': { //Português(Brasil)
months: [
"Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"
],
dayOfWeekShort: [
"Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"
],
dayOfWeek: ["Domingo", "Segunda", "Terça", "Quarta", "Quinta", "Sexta", "Sábado"]
},
sk: { //Slovenčina
months: [
"Január", "Február", "Marec", "Apríl", "Máj", "Jún", "Júl", "August", "September", "Október", "November", "December"
],
dayOfWeekShort: [
"Ne", "Po", "Ut", "St", "Št", "Pi", "So"
],
dayOfWeek: ["Nedeľa", "Pondelok", "Utorok", "Streda", "Štvrtok", "Piatok", "Sobota"]
},
sq: { //Albanian (Shqip)
months: [
"Janar", "Shkurt", "Mars", "Prill", "Maj", "Qershor", "Korrik", "Gusht", "Shtator", "Tetor", "Nëntor", "Dhjetor"
],
dayOfWeekShort: [
"Die", "Hën", "Mar", "Mër", "Enj", "Pre", "Shtu"
],
dayOfWeek: ["E Diel", "E Hënë", "E Martē", "E Mërkurë", "E Enjte", "E Premte", "E Shtunë"]
},
'sr-YU': { //Serbian (Srpski)
months: [
"Januar", "Februar", "Mart", "April", "Maj", "Jun", "Jul", "Avgust", "Septembar", "Oktobar", "Novembar", "Decembar"
],
dayOfWeekShort: [
"Ned", "Pon", "Uto", "Sre", "čet", "Pet", "Sub"
],
dayOfWeek: ["Nedelja","Ponedeljak", "Utorak", "Sreda", "Četvrtak", "Petak", "Subota"]
},
sr: { //Serbian Cyrillic (Српски)
months: [
"јануар", "фебруар", "март", "април", "мај", "јун", "јул", "август", "септембар", "октобар", "новембар", "децембар"
],
dayOfWeekShort: [
"нед", "пон", "уто", "сре", "чет", "пет", "суб"
],
dayOfWeek: ["Недеља","Понедељак", "Уторак", "Среда", "Четвртак", "Петак", "Субота"]
},
sv: { //Svenska
months: [
"Januari", "Februari", "Mars", "April", "Maj", "Juni", "Juli", "Augusti", "September", "Oktober", "November", "December"
],
dayOfWeekShort: [
"Sön", "Mån", "Tis", "Ons", "Tor", "Fre", "Lör"
],
dayOfWeek: ["Söndag", "Måndag", "Tisdag", "Onsdag", "Torsdag", "Fredag", "Lördag"]
},
'zh-TW': { //Traditional Chinese (繁體中文)
months: [
"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
],
dayOfWeekShort: [
"日", "一", "二", "三", "四", "五", "六"
],
dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
},
zh: { //Simplified Chinese (简体中文)
months: [
"一月", "二月", "三月", "四月", "五月", "六月", "七月", "八月", "九月", "十月", "十一月", "十二月"
],
dayOfWeekShort: [
"日", "一", "二", "三", "四", "五", "六"
],
dayOfWeek: ["星期日", "星期一", "星期二", "星期三", "星期四", "星期五", "星期六"]
},
he: { //Hebrew (עברית)
months: [
'ינואר', 'פברואר', 'מרץ', 'אפריל', 'מאי', 'יוני', 'יולי', 'אוגוסט', 'ספטמבר', 'אוקטובר', 'נובמבר', 'דצמבר'
],
dayOfWeekShort: [
'א\'', 'ב\'', 'ג\'', 'ד\'', 'ה\'', 'ו\'', 'שבת'
],
dayOfWeek: ["ראשון", "שני", "שלישי", "רביעי", "חמישי", "שישי", "שבת", "ראשון"]
},
hy: { // Armenian
months: [
"Հունվար", "Փետրվար", "Մարտ", "Ապրիլ", "Մայիս", "Հունիս", "Հուլիս", "Օգոստոս", "Սեպտեմբեր", "Հոկտեմբեր", "Նոյեմբեր", "Դեկտեմբեր"
],
dayOfWeekShort: [
"Կի", "Երկ", "Երք", "Չոր", "Հնգ", "Ուրբ", "Շբթ"
],
dayOfWeek: ["Կիրակի", "Երկուշաբթի", "Երեքշաբթի", "Չորեքշաբթի", "Հինգշաբթի", "Ուրբաթ", "Շաբաթ"]
},
kg: { // Kyrgyz
months: [
'Үчтүн айы', 'Бирдин айы', 'Жалган Куран', 'Чын Куран', 'Бугу', 'Кулжа', 'Теке', 'Баш Оона', 'Аяк Оона', 'Тогуздун айы', 'Жетинин айы', 'Бештин айы'
],
dayOfWeekShort: [
"Жек", "Дүй", "Шей", "Шар", "Бей", "Жум", "Ише"
],
dayOfWeek: [
"Жекшемб", "Дүйшөмб", "Шейшемб", "Шаршемб", "Бейшемби", "Жума", "Ишенб"
]
},
rm: { // Romansh
months: [
"Schaner", "Favrer", "Mars", "Avrigl", "Matg", "Zercladur", "Fanadur", "Avust", "Settember", "October", "November", "December"
],
dayOfWeekShort: [
"Du", "Gli", "Ma", "Me", "Gie", "Ve", "So"
],
dayOfWeek: [
"Dumengia", "Glindesdi", "Mardi", "Mesemna", "Gievgia", "Venderdi", "Sonda"
]
},
},
value: '',
rtl: false,
format: 'Y/m/d H:i',
formatTime: 'H:i',
formatDate: 'Y/m/d',
startDate: false, // new Date(), '1986/12/08', '-1970/01/05','-1970/01/05',
step: 60,
monthChangeSpinner: true,
closeOnDateSelect: false,
closeOnTimeSelect: true,
closeOnWithoutClick: true,
closeOnInputClick: true,
timepicker: true,
datepicker: true,
weeks: false,
defaultTime: false, // use formatTime format (ex. '10:00' for formatTime: 'H:i')
defaultDate: false, // use formatDate format (ex new Date() or '1986/12/08' or '-1970/01/05' or '-1970/01/05')
minDate: false,
maxDate: false,
minTime: false,
maxTime: false,
disabledMinTime: false,
disabledMaxTime: false,
allowTimes: [],
opened: false,
initTime: true,
inline: false,
theme: '',
onSelectDate: function () {},
onSelectTime: function () {},
onChangeMonth: function () {},
onGetWeekOfYear: function () {},
onChangeYear: function () {},
onChangeDateTime: function () {},
onShow: function () {},
onClose: function () {},
onGenerate: function () {},
withoutCopyright: true,
inverseButton: false,
hours12: false,
next: 'xdsoft_next',
prev : 'xdsoft_prev',
dayOfWeekStart: 0,
parentID: 'body',
timeHeightInTimePicker: 25,
timepickerScrollbar: true,
todayButton: true,
prevButton: true,
nextButton: true,
defaultSelect: true,
scrollMonth: true,
scrollTime: true,
scrollInput: true,
lazyInit: false,
mask: false,
validateOnBlur: true,
allowBlank: true,
yearStart: 1950,
yearEnd: 2050,
monthStart: 0,
monthEnd: 11,
style: '',
id: '',
fixed: false,
roundTime: 'round', // ceil, floor
className: '',
weekends: [],
highlightedDates: [],
highlightedPeriods: [],
allowDates : [],
allowDateRe : null,
disabledDates : [],
disabledWeekDays: [],
yearOffset: 0,
beforeShowDay: null,
enterLikeTab: true,
showApplyButton: false
};
var dateHelper = null,
globalLocaleDefault = 'en',
globalLocale = 'en';
var dateFormatterOptionsDefault = {
meridiem: ['AM', 'PM']
};
var initDateFormatter = function(){
var locale = default_options.i18n[globalLocale],
opts = {
days: locale.dayOfWeek,
daysShort: locale.dayOfWeekShort,
months: locale.months,
monthsShort: $.map(locale.months, function(n){ return n.substring(0, 3) }),
};
dateHelper = new DateFormatter({
dateSettings: $.extend({}, dateFormatterOptionsDefault, opts)
});
};
// for locale settings
$.datetimepicker = {
setLocale: function(locale){
var newLocale = default_options.i18n[locale]?locale:globalLocaleDefault;
if(globalLocale != newLocale){
globalLocale = newLocale;
// reinit date formatter
initDateFormatter();
}
},
RFC_2822: 'D, d M Y H:i:s O',
ATOM: 'Y-m-d\TH:i:sP',
ISO_8601: 'Y-m-d\TH:i:sO',
RFC_822: 'D, d M y H:i:s O',
RFC_850: 'l, d-M-y H:i:s T',
RFC_1036: 'D, d M y H:i:s O',
RFC_1123: 'D, d M Y H:i:s O',
RSS: 'D, d M Y H:i:s O',
W3C: 'Y-m-d\TH:i:sP'
};
// first init date formatter
initDateFormatter();
// fix for ie8
if (!window.getComputedStyle) {
window.getComputedStyle = function (el, pseudo) {
this.el = el;
this.getPropertyValue = function (prop) {
var re = /(\-([a-z]){1})/g;
if (prop === 'float') {
prop = 'styleFloat';
}
if (re.test(prop)) {
prop = prop.replace(re, function (a, b, c) {
return c.toUpperCase();
});
}
return el.currentStyle[prop] || null;
};
return this;
};
}
if (!Array.prototype.indexOf) {
Array.prototype.indexOf = function (obj, start) {
var i, j;
for (i = (start || 0), j = this.length; i < j; i += 1) {
if (this[i] === obj) { return i; }
}
return -1;
};
}
Date.prototype.countDaysInMonth = function () {
return new Date(this.getFullYear(), this.getMonth() + 1, 0).getDate();
};
$.fn.xdsoftScroller = function (percent) {
return this.each(function () {
var timeboxparent = $(this),
pointerEventToXY = function (e) {
var out = {x: 0, y: 0},
touch;
if (e.type === 'touchstart' || e.type === 'touchmove' || e.type === 'touchend' || e.type === 'touchcancel') {
touch = e.originalEvent.touches[0] || e.originalEvent.changedTouches[0];
out.x = touch.clientX;
out.y = touch.clientY;
} else if (e.type === 'mousedown' || e.type === 'mouseup' || e.type === 'mousemove' || e.type === 'mouseover' || e.type === 'mouseout' || e.type === 'mouseenter' || e.type === 'mouseleave') {
out.x = e.clientX;
out.y = e.clientY;
}
return out;
},
move = 0,
timebox,
parentHeight,
height,
scrollbar,
scroller,
maximumOffset = 100,
start = false,
startY = 0,
startTop = 0,
h1 = 0,
touchStart = false,
startTopScroll = 0,
calcOffset = function () {};
if (percent === 'hide') {
timeboxparent.find('.xdsoft_scrollbar').hide();
return;
}
if (!$(this).hasClass('xdsoft_scroller_box')) {
timebox = timeboxparent.children().eq(0);
parentHeight = timeboxparent[0].clientHeight;
height = timebox[0].offsetHeight;
scrollbar = $('<div class="xdsoft_scrollbar"></div>');
scroller = $('<div class="xdsoft_scroller"></div>');
scrollbar.append(scroller);
timeboxparent.addClass('xdsoft_scroller_box').append(scrollbar);
calcOffset = function calcOffset(event) {
var offset = pointerEventToXY(event).y - startY + startTopScroll;
if (offset < 0) {
offset = 0;
}
if (offset + scroller[0].offsetHeight > h1) {
offset = h1 - scroller[0].offsetHeight;
}
timeboxparent.trigger('scroll_element.xdsoft_scroller', [maximumOffset ? offset / maximumOffset : 0]);
};
scroller
.on('touchstart.xdsoft_scroller mousedown.xdsoft_scroller', function (event) {
if (!parentHeight) {
timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
}
startY = pointerEventToXY(event).y;
startTopScroll = parseInt(scroller.css('margin-top'), 10);
h1 = scrollbar[0].offsetHeight;
if (event.type === 'mousedown' || event.type === 'touchstart') {
if (document) {
$(document.body).addClass('xdsoft_noselect');
}
$([document.body, window]).on('touchend mouseup.xdsoft_scroller', function arguments_callee() {
$([document.body, window]).off('touchend mouseup.xdsoft_scroller', arguments_callee)
.off('mousemove.xdsoft_scroller', calcOffset)
.removeClass('xdsoft_noselect');
});
$(document.body).on('mousemove.xdsoft_scroller', calcOffset);
} else {
touchStart = true;
event.stopPropagation();
event.preventDefault();
}
})
.on('touchmove', function (event) {
if (touchStart) {
event.preventDefault();
calcOffset(event);
}
})
.on('touchend touchcancel', function (event) {
touchStart = false;
startTopScroll = 0;
});
timeboxparent
.on('scroll_element.xdsoft_scroller', function (event, percentage) {
if (!parentHeight) {
timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percentage, true]);
}
percentage = percentage > 1 ? 1 : (percentage < 0 || isNaN(percentage)) ? 0 : percentage;
scroller.css('margin-top', maximumOffset * percentage);
setTimeout(function () {
timebox.css('marginTop', -parseInt((timebox[0].offsetHeight - parentHeight) * percentage, 10));
}, 10);
})
.on('resize_scroll.xdsoft_scroller', function (event, percentage, noTriggerScroll) {
var percent, sh;
parentHeight = timeboxparent[0].clientHeight;
height = timebox[0].offsetHeight;
percent = parentHeight / height;
sh = percent * scrollbar[0].offsetHeight;
if (percent > 1) {
scroller.hide();
} else {
scroller.show();
scroller.css('height', parseInt(sh > 10 ? sh : 10, 10));
maximumOffset = scrollbar[0].offsetHeight - scroller[0].offsetHeight;
if (noTriggerScroll !== true) {
timeboxparent.trigger('scroll_element.xdsoft_scroller', [percentage || Math.abs(parseInt(timebox.css('marginTop'), 10)) / (height - parentHeight)]);
}
}
});
timeboxparent.on('mousewheel', function (event) {
var top = Math.abs(parseInt(timebox.css('marginTop'), 10));
top = top - (event.deltaY * 20);
if (top < 0) {
top = 0;
}
timeboxparent.trigger('scroll_element.xdsoft_scroller', [top / (height - parentHeight)]);
event.stopPropagation();
return false;
});
timeboxparent.on('touchstart', function (event) {
start = pointerEventToXY(event);
startTop = Math.abs(parseInt(timebox.css('marginTop'), 10));
});
timeboxparent.on('touchmove', function (event) {
if (start) {
event.preventDefault();
var coord = pointerEventToXY(event);
timeboxparent.trigger('scroll_element.xdsoft_scroller', [(startTop - (coord.y - start.y)) / (height - parentHeight)]);
}
});
timeboxparent.on('touchend touchcancel', function (event) {
start = false;
startTop = 0;
});
}
timeboxparent.trigger('resize_scroll.xdsoft_scroller', [percent]);
});
};
$.fn.datetimepicker = function (opt, opt2) {
var result = this,
KEY0 = 48,
KEY9 = 57,
_KEY0 = 96,
_KEY9 = 105,
CTRLKEY = 17,
DEL = 46,
ENTER = 13,
ESC = 27,
BACKSPACE = 8,
ARROWLEFT = 37,
ARROWUP = 38,
ARROWRIGHT = 39,
ARROWDOWN = 40,
TAB = 9,
F5 = 116,
AKEY = 65,
CKEY = 67,
VKEY = 86,
ZKEY = 90,
YKEY = 89,
ctrlDown = false,
options = ($.isPlainObject(opt) || !opt) ? $.extend(true, {}, default_options, opt) : $.extend(true, {}, default_options),
lazyInitTimer = 0,
createDateTimePicker,
destroyDateTimePicker,
lazyInit = function (input) {
input
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function initOnActionCallback(event) {
if (input.is(':disabled') || input.data('xdsoft_datetimepicker')) {
return;
}
clearTimeout(lazyInitTimer);
lazyInitTimer = setTimeout(function () {
if (!input.data('xdsoft_datetimepicker')) {
createDateTimePicker(input);
}
input
.off('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', initOnActionCallback)
.trigger('open.xdsoft');
}, 100);
});
};
createDateTimePicker = function (input) {
var datetimepicker = $('<div class="xdsoft_datetimepicker xdsoft_noselect"></div>'),
xdsoft_copyright = $('<div class="xdsoft_copyright"><a target="_blank" href="http://xdsoft.net/jqplugins/datetimepicker/">xdsoft.net</a></div>'),
datepicker = $('<div class="xdsoft_datepicker active"></div>'),
mounth_picker = $('<div class="xdsoft_mounthpicker"><button type="button" class="xdsoft_prev"></button><button type="button" class="xdsoft_today_button"></button>' +
'<div class="xdsoft_label xdsoft_month"><span></span><i></i></div>' +
'<div class="xdsoft_label xdsoft_year"><span></span><i></i></div>' +
'<button type="button" class="xdsoft_next"></button></div>'),
calendar = $('<div class="xdsoft_calendar"></div>'),
timepicker = $('<div class="xdsoft_timepicker active"><button type="button" class="xdsoft_prev"></button><div class="xdsoft_time_box"></div><button type="button" class="xdsoft_next"></button></div>'),
timeboxparent = timepicker.find('.xdsoft_time_box').eq(0),
timebox = $('<div class="xdsoft_time_variant"></div>'),
applyButton = $('<button type="button" class="xdsoft_save_selected blue-gradient-button">Save Selected</button>'),
monthselect = $('<div class="xdsoft_select xdsoft_monthselect"><div></div></div>'),
yearselect = $('<div class="xdsoft_select xdsoft_yearselect"><div></div></div>'),
triggerAfterOpen = false,
XDSoft_datetime,
xchangeTimer,
timerclick,
current_time_index,
setPos,
timer = 0,
timer1 = 0,
_xdsoft_datetime;
if (options.id) {
datetimepicker.attr('id', options.id);
}
if (options.style) {
datetimepicker.attr('style', options.style);
}
if (options.weeks) {
datetimepicker.addClass('xdsoft_showweeks');
}
if (options.rtl) {
datetimepicker.addClass('xdsoft_rtl');
}
datetimepicker.addClass('xdsoft_' + options.theme);
datetimepicker.addClass(options.className);
mounth_picker
.find('.xdsoft_month span')
.after(monthselect);
mounth_picker
.find('.xdsoft_year span')
.after(yearselect);
mounth_picker
.find('.xdsoft_month,.xdsoft_year')
.on('touchstart mousedown.xdsoft', function (event) {
var select = $(this).find('.xdsoft_select').eq(0),
val = 0,
top = 0,
visible = select.is(':visible'),
items,
i;
mounth_picker
.find('.xdsoft_select')
.hide();
if (_xdsoft_datetime.currentTime) {
val = _xdsoft_datetime.currentTime[$(this).hasClass('xdsoft_month') ? 'getMonth' : 'getFullYear']();
}
select[visible ? 'hide' : 'show']();
for (items = select.find('div.xdsoft_option'), i = 0; i < items.length; i += 1) {
if (items.eq(i).data('value') === val) {
break;
} else {
top += items[0].offsetHeight;
}
}
select.xdsoftScroller(top / (select.children()[0].offsetHeight - (select[0].clientHeight)));
event.stopPropagation();
return false;
});
mounth_picker
.find('.xdsoft_select')
.xdsoftScroller()
.on('touchstart mousedown.xdsoft', function (event) {
event.stopPropagation();
event.preventDefault();
})
.on('touchstart mousedown.xdsoft', '.xdsoft_option', function (event) {
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
}
var year = _xdsoft_datetime.currentTime.getFullYear();
if (_xdsoft_datetime && _xdsoft_datetime.currentTime) {
_xdsoft_datetime.currentTime[$(this).parent().parent().hasClass('xdsoft_monthselect') ? 'setMonth' : 'setFullYear']($(this).data('value'));
}
$(this).parent().parent().hide();
datetimepicker.trigger('xchange.xdsoft');
if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
if (year !== _xdsoft_datetime.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
});
datetimepicker.getValue = function () {
return _xdsoft_datetime.getCurrentTime();
};
datetimepicker.setOptions = function (_options) {
var highlightedDates = {};
options = $.extend(true, {}, options, _options);
if (_options.allowTimes && $.isArray(_options.allowTimes) && _options.allowTimes.length) {
options.allowTimes = $.extend(true, [], _options.allowTimes);
}
if (_options.weekends && $.isArray(_options.weekends) && _options.weekends.length) {
options.weekends = $.extend(true, [], _options.weekends);
}
if (_options.allowDates && $.isArray(_options.allowDates) && _options.allowDates.length) {
options.allowDates = $.extend(true, [], _options.allowDates);
}
if (_options.allowDateRe && Object.prototype.toString.call(_options.allowDateRe)==="[object String]") {
options.allowDateRe = new RegExp(_options.allowDateRe);
}
if (_options.highlightedDates && $.isArray(_options.highlightedDates) && _options.highlightedDates.length) {
$.each(_options.highlightedDates, function (index, value) {
var splitData = $.map(value.split(','), $.trim),
exDesc,
hDate = new HighlightedDate(dateHelper.parseDate(splitData[0], options.formatDate), splitData[1], splitData[2]), // date, desc, style
keyDate = dateHelper.formatDate(hDate.date, options.formatDate);
if (highlightedDates[keyDate] !== undefined) {
exDesc = highlightedDates[keyDate].desc;
if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
}
} else {
highlightedDates[keyDate] = hDate;
}
});
options.highlightedDates = $.extend(true, [], highlightedDates);
}
if (_options.highlightedPeriods && $.isArray(_options.highlightedPeriods) && _options.highlightedPeriods.length) {
highlightedDates = $.extend(true, [], options.highlightedDates);
$.each(_options.highlightedPeriods, function (index, value) {
var dateTest, // start date
dateEnd,
desc,
hDate,
keyDate,
exDesc,
style;
if ($.isArray(value)) {
dateTest = value[0];
dateEnd = value[1];
desc = value[2];
style = value[3];
}
else {
var splitData = $.map(value.split(','), $.trim);
dateTest = dateHelper.parseDate(splitData[0], options.formatDate);
dateEnd = dateHelper.parseDate(splitData[1], options.formatDate);
desc = splitData[2];
style = splitData[3];
}
while (dateTest <= dateEnd) {
hDate = new HighlightedDate(dateTest, desc, style);
keyDate = dateHelper.formatDate(dateTest, options.formatDate);
dateTest.setDate(dateTest.getDate() + 1);
if (highlightedDates[keyDate] !== undefined) {
exDesc = highlightedDates[keyDate].desc;
if (exDesc && exDesc.length && hDate.desc && hDate.desc.length) {
highlightedDates[keyDate].desc = exDesc + "\n" + hDate.desc;
}
} else {
highlightedDates[keyDate] = hDate;
}
}
});
options.highlightedDates = $.extend(true, [], highlightedDates);
}
if (_options.disabledDates && $.isArray(_options.disabledDates) && _options.disabledDates.length) {
options.disabledDates = $.extend(true, [], _options.disabledDates);
}
if (_options.disabledWeekDays && $.isArray(_options.disabledWeekDays) && _options.disabledWeekDays.length) {
options.disabledWeekDays = $.extend(true, [], _options.disabledWeekDays);
}
if ((options.open || options.opened) && (!options.inline)) {
input.trigger('open.xdsoft');
}
if (options.inline) {
triggerAfterOpen = true;
datetimepicker.addClass('xdsoft_inline');
input.after(datetimepicker).hide();
}
if (options.inverseButton) {
options.next = 'xdsoft_prev';
options.prev = 'xdsoft_next';
}
if (options.datepicker) {
datepicker.addClass('active');
} else {
datepicker.removeClass('active');
}
if (options.timepicker) {
timepicker.addClass('active');
} else {
timepicker.removeClass('active');
}
if (options.value) {
_xdsoft_datetime.setCurrentTime(options.value);
if (input && input.val) {
input.val(_xdsoft_datetime.str);
}
}
if (isNaN(options.dayOfWeekStart)) {
options.dayOfWeekStart = 0;
} else {
options.dayOfWeekStart = parseInt(options.dayOfWeekStart, 10) % 7;
}
if (!options.timepickerScrollbar) {
timeboxparent.xdsoftScroller('hide');
}
if (options.minDate && /^[\+\-](.*)$/.test(options.minDate)) {
options.minDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.minDate), options.formatDate);
}
if (options.maxDate && /^[\+\-](.*)$/.test(options.maxDate)) {
options.maxDate = dateHelper.formatDate(_xdsoft_datetime.strToDateTime(options.maxDate), options.formatDate);
}
applyButton.toggle(options.showApplyButton);
mounth_picker
.find('.xdsoft_today_button')
.css('visibility', !options.todayButton ? 'hidden' : 'visible');
mounth_picker
.find('.' + options.prev)
.css('visibility', !options.prevButton ? 'hidden' : 'visible');
mounth_picker
.find('.' + options.next)
.css('visibility', !options.nextButton ? 'hidden' : 'visible');
setMask(options);
if (options.validateOnBlur) {
input
.off('blur.xdsoft')
.on('blur.xdsoft', function () {
if (options.allowBlank && (!$.trim($(this).val()).length || $.trim($(this).val()) === options.mask.replace(/[0-9]/g, '_'))) {
$(this).val(null);
datetimepicker.data('xdsoft_datetime').empty();
} else if (!dateHelper.parseDate($(this).val(), options.format)) {
var splittedHours = +([$(this).val()[0], $(this).val()[1]].join('')),
splittedMinutes = +([$(this).val()[2], $(this).val()[3]].join(''));
// parse the numbers as 0312 => 03:12
if (!options.datepicker && options.timepicker && splittedHours >= 0 && splittedHours < 24 && splittedMinutes >= 0 && splittedMinutes < 60) {
$(this).val([splittedHours, splittedMinutes].map(function (item) {
return item > 9 ? item : '0' + item;
}).join(':'));
} else {
$(this).val(dateHelper.formatDate(_xdsoft_datetime.now(), options.format));
}
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
} else {
datetimepicker.data('xdsoft_datetime').setCurrentTime($(this).val());
}
datetimepicker.trigger('changedatetime.xdsoft');
datetimepicker.trigger('close.xdsoft');
});
}
options.dayOfWeekStartPrev = (options.dayOfWeekStart === 0) ? 6 : options.dayOfWeekStart - 1;
datetimepicker
.trigger('xchange.xdsoft')
.trigger('afterOpen.xdsoft');
};
datetimepicker
.data('options', options)
.on('touchstart mousedown.xdsoft', function (event) {
event.stopPropagation();
event.preventDefault();
yearselect.hide();
monthselect.hide();
return false;
});
//scroll_element = timepicker.find('.xdsoft_time_box');
timeboxparent.append(timebox);
timeboxparent.xdsoftScroller();
datetimepicker.on('afterOpen.xdsoft', function () {
timeboxparent.xdsoftScroller();
});
datetimepicker
.append(datepicker)
.append(timepicker);
if (options.withoutCopyright !== true) {
datetimepicker
.append(xdsoft_copyright);
}
datepicker
.append(mounth_picker)
.append(calendar)
.append(applyButton);
$(options.parentID)
.append(datetimepicker);
XDSoft_datetime = function () {
var _this = this;
_this.now = function (norecursion) {
var d = new Date(),
date,
time;
if (!norecursion && options.defaultDate) {
date = _this.strToDateTime(options.defaultDate);
d.setFullYear(date.getFullYear());
d.setMonth(date.getMonth());
d.setDate(date.getDate());
}
if (options.yearOffset) {
d.setFullYear(d.getFullYear() + options.yearOffset);
}
if (!norecursion && options.defaultTime) {
time = _this.strtotime(options.defaultTime);
d.setHours(time.getHours());
d.setMinutes(time.getMinutes());
}
return d;
};
_this.isValidDate = function (d) {
if (Object.prototype.toString.call(d) !== "[object Date]") {
return false;
}
return !isNaN(d.getTime());
};
_this.setCurrentTime = function (dTime) {
_this.currentTime = (typeof dTime === 'string') ? _this.strToDateTime(dTime) : _this.isValidDate(dTime) ? dTime : _this.now();
datetimepicker.trigger('xchange.xdsoft');
};
_this.empty = function () {
_this.currentTime = null;
};
_this.getCurrentTime = function (dTime) {
return _this.currentTime;
};
_this.nextMonth = function () {
if (_this.currentTime === undefined || _this.currentTime === null) {
_this.currentTime = _this.now();
}
var month = _this.currentTime.getMonth() + 1,
year;
if (month === 12) {
_this.currentTime.setFullYear(_this.currentTime.getFullYear() + 1);
month = 0;
}
year = _this.currentTime.getFullYear();
_this.currentTime.setDate(
Math.min(
new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
_this.currentTime.getDate()
)
);
_this.currentTime.setMonth(month);
if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
if (year !== _this.currentTime.getFullYear() && $.isFunction(options.onChangeYear)) {
options.onChangeYear.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
datetimepicker.trigger('xchange.xdsoft');
return month;
};
_this.prevMonth = function () {
if (_this.currentTime === undefined || _this.currentTime === null) {
_this.currentTime = _this.now();
}
var month = _this.currentTime.getMonth() - 1;
if (month === -1) {
_this.currentTime.setFullYear(_this.currentTime.getFullYear() - 1);
month = 11;
}
_this.currentTime.setDate(
Math.min(
new Date(_this.currentTime.getFullYear(), month + 1, 0).getDate(),
_this.currentTime.getDate()
)
);
_this.currentTime.setMonth(month);
if (options.onChangeMonth && $.isFunction(options.onChangeMonth)) {
options.onChangeMonth.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
datetimepicker.trigger('xchange.xdsoft');
return month;
};
_this.getWeekOfYear = function (datetime) {
if (options.onGetWeekOfYear && $.isFunction(options.onGetWeekOfYear)) {
var week = options.onGetWeekOfYear.call(datetimepicker, datetime);
if (typeof week !== 'undefined') {
return week;
}
}
var onejan = new Date(datetime.getFullYear(), 0, 1);
//First week of the year is th one with the first Thursday according to ISO8601
if(onejan.getDay()!=4)
onejan.setMonth(0, 1 + ((4 - onejan.getDay()+ 7) % 7));
return Math.ceil((((datetime - onejan) / 86400000) + onejan.getDay() + 1) / 7);
};
_this.strToDateTime = function (sDateTime) {
var tmpDate = [], timeOffset, currentTime;
if (sDateTime && sDateTime instanceof Date && _this.isValidDate(sDateTime)) {
return sDateTime;
}
tmpDate = /^(\+|\-)(.*)$/.exec(sDateTime);
if (tmpDate) {
tmpDate[2] = dateHelper.parseDate(tmpDate[2], options.formatDate);
}
if (tmpDate && tmpDate[2]) {
timeOffset = tmpDate[2].getTime() - (tmpDate[2].getTimezoneOffset()) * 60000;
currentTime = new Date((_this.now(true)).getTime() + parseInt(tmpDate[1] + '1', 10) * timeOffset);
} else {
currentTime = sDateTime ? dateHelper.parseDate(sDateTime, options.format) : _this.now();
}
if (!_this.isValidDate(currentTime)) {
currentTime = _this.now();
}
return currentTime;
};
_this.strToDate = function (sDate) {
if (sDate && sDate instanceof Date && _this.isValidDate(sDate)) {
return sDate;
}
var currentTime = sDate ? dateHelper.parseDate(sDate, options.formatDate) : _this.now(true);
if (!_this.isValidDate(currentTime)) {
currentTime = _this.now(true);
}
return currentTime;
};
_this.strtotime = function (sTime) {
if (sTime && sTime instanceof Date && _this.isValidDate(sTime)) {
return sTime;
}
var currentTime = sTime ? dateHelper.parseDate(sTime, options.formatTime) : _this.now(true);
if (!_this.isValidDate(currentTime)) {
currentTime = _this.now(true);
}
return currentTime;
};
_this.str = function () {
return dateHelper.formatDate(_this.currentTime, options.format);
};
_this.currentTime = this.now();
};
_xdsoft_datetime = new XDSoft_datetime();
applyButton.on('touchend click', function (e) {//pathbrite
e.preventDefault();
datetimepicker.data('changed', true);
_xdsoft_datetime.setCurrentTime(getCurrentValue());
input.val(_xdsoft_datetime.str());
datetimepicker.trigger('close.xdsoft');
});
mounth_picker
.find('.xdsoft_today_button')
.on('touchend mousedown.xdsoft', function () {
datetimepicker.data('changed', true);
_xdsoft_datetime.setCurrentTime(0);
datetimepicker.trigger('afterOpen.xdsoft');
}).on('dblclick.xdsoft', function () {
var currentDate = _xdsoft_datetime.getCurrentTime(), minDate, maxDate;
currentDate = new Date(currentDate.getFullYear(), currentDate.getMonth(), currentDate.getDate());
minDate = _xdsoft_datetime.strToDate(options.minDate);
minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
if (currentDate < minDate) {
return;
}
maxDate = _xdsoft_datetime.strToDate(options.maxDate);
maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate());
if (currentDate > maxDate) {
return;
}
input.val(_xdsoft_datetime.str());
input.trigger('change');
datetimepicker.trigger('close.xdsoft');
});
mounth_picker
.find('.xdsoft_prev,.xdsoft_next')
.on('touchend mousedown.xdsoft', function () {
var $this = $(this),
timer = 0,
stop = false;
(function arguments_callee1(v) {
if ($this.hasClass(options.next)) {
_xdsoft_datetime.nextMonth();
} else if ($this.hasClass(options.prev)) {
_xdsoft_datetime.prevMonth();
}
if (options.monthChangeSpinner) {
if (!stop) {
timer = setTimeout(arguments_callee1, v || 100);
}
}
}(500));
$([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee2() {
clearTimeout(timer);
stop = true;
$([document.body, window]).off('touchend mouseup.xdsoft', arguments_callee2);
});
});
timepicker
.find('.xdsoft_prev,.xdsoft_next')
.on('touchend mousedown.xdsoft', function () {
var $this = $(this),
timer = 0,
stop = false,
period = 110;
(function arguments_callee4(v) {
var pheight = timeboxparent[0].clientHeight,
height = timebox[0].offsetHeight,
top = Math.abs(parseInt(timebox.css('marginTop'), 10));
if ($this.hasClass(options.next) && (height - pheight) - options.timeHeightInTimePicker >= top) {
timebox.css('marginTop', '-' + (top + options.timeHeightInTimePicker) + 'px');
} else if ($this.hasClass(options.prev) && top - options.timeHeightInTimePicker >= 0) {
timebox.css('marginTop', '-' + (top - options.timeHeightInTimePicker) + 'px');
}
timeboxparent.trigger('scroll_element.xdsoft_scroller', [Math.abs(parseInt(timebox.css('marginTop'), 10) / (height - pheight))]);
period = (period > 10) ? 10 : period - 10;
if (!stop) {
timer = setTimeout(arguments_callee4, v || period);
}
}(500));
$([document.body, window]).on('touchend mouseup.xdsoft', function arguments_callee5() {
clearTimeout(timer);
stop = true;
$([document.body, window])
.off('touchend mouseup.xdsoft', arguments_callee5);
});
});
xchangeTimer = 0;
// base handler - generating a calendar and timepicker
datetimepicker
.on('xchange.xdsoft', function (event) {
clearTimeout(xchangeTimer);
xchangeTimer = setTimeout(function () {
if (_xdsoft_datetime.currentTime === undefined || _xdsoft_datetime.currentTime === null) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
}
var table = '',
start = new Date(_xdsoft_datetime.currentTime.getFullYear(), _xdsoft_datetime.currentTime.getMonth(), 1, 12, 0, 0),
i = 0,
j,
today = _xdsoft_datetime.now(),
maxDate = false,
minDate = false,
hDate,
day,
d,
y,
m,
w,
classes = [],
customDateSettings,
newRow = true,
time = '',
h = '',
line_time,
description;
while (start.getDay() !== options.dayOfWeekStart) {
start.setDate(start.getDate() - 1);
}
table += '<table><thead><tr>';
if (options.weeks) {
table += '<th></th>';
}
for (j = 0; j < 7; j += 1) {
table += '<th>' + options.i18n[globalLocale].dayOfWeekShort[(j + options.dayOfWeekStart) % 7] + '</th>';
}
table += '</tr></thead>';
table += '<tbody>';
if (options.maxDate !== false) {
maxDate = _xdsoft_datetime.strToDate(options.maxDate);
maxDate = new Date(maxDate.getFullYear(), maxDate.getMonth(), maxDate.getDate(), 23, 59, 59, 999);
}
if (options.minDate !== false) {
minDate = _xdsoft_datetime.strToDate(options.minDate);
minDate = new Date(minDate.getFullYear(), minDate.getMonth(), minDate.getDate());
}
while (i < _xdsoft_datetime.currentTime.countDaysInMonth() || start.getDay() !== options.dayOfWeekStart || _xdsoft_datetime.currentTime.getMonth() === start.getMonth()) {
classes = [];
i += 1;
day = start.getDay();
d = start.getDate();
y = start.getFullYear();
m = start.getMonth();
w = _xdsoft_datetime.getWeekOfYear(start);
description = '';
classes.push('xdsoft_date');
if (options.beforeShowDay && $.isFunction(options.beforeShowDay.call)) {
customDateSettings = options.beforeShowDay.call(datetimepicker, start);
} else {
customDateSettings = null;
}
if(options.allowDateRe && Object.prototype.toString.call(options.allowDateRe) === "[object RegExp]"){
if(!options.allowDateRe.test(dateHelper.formatDate(start, options.formatDate))){
classes.push('xdsoft_disabled');
}
} else if(options.allowDates && options.allowDates.length>0){
if(options.allowDates.indexOf(dateHelper.formatDate(start, options.formatDate)) === -1){
classes.push('xdsoft_disabled');
}
} else if ((maxDate !== false && start > maxDate) || (minDate !== false && start < minDate) || (customDateSettings && customDateSettings[0] === false)) {
classes.push('xdsoft_disabled');
} else if (options.disabledDates.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
classes.push('xdsoft_disabled');
} else if (options.disabledWeekDays.indexOf(day) !== -1) {
classes.push('xdsoft_disabled');
}
if (customDateSettings && customDateSettings[1] !== "") {
classes.push(customDateSettings[1]);
}
if (_xdsoft_datetime.currentTime.getMonth() !== m) {
classes.push('xdsoft_other_month');
}
if ((options.defaultSelect || datetimepicker.data('changed')) && dateHelper.formatDate(_xdsoft_datetime.currentTime, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
classes.push('xdsoft_current');
}
if (dateHelper.formatDate(today, options.formatDate) === dateHelper.formatDate(start, options.formatDate)) {
classes.push('xdsoft_today');
}
if (start.getDay() === 0 || start.getDay() === 6 || options.weekends.indexOf(dateHelper.formatDate(start, options.formatDate)) !== -1) {
classes.push('xdsoft_weekend');
}
if (options.highlightedDates[dateHelper.formatDate(start, options.formatDate)] !== undefined) {
hDate = options.highlightedDates[dateHelper.formatDate(start, options.formatDate)];
classes.push(hDate.style === undefined ? 'xdsoft_highlighted_default' : hDate.style);
description = hDate.desc === undefined ? '' : hDate.desc;
}
if (options.beforeShowDay && $.isFunction(options.beforeShowDay)) {
classes.push(options.beforeShowDay(start));
}
if (newRow) {
table += '<tr>';
newRow = false;
if (options.weeks) {
table += '<th>' + w + '</th>';
}
}
table += '<td data-date="' + d + '" data-month="' + m + '" data-year="' + y + '"' + ' class="xdsoft_date xdsoft_day_of_week' + start.getDay() + ' ' + classes.join(' ') + '" title="' + description + '">' +
'<div>' + d + '</div>' +
'</td>';
if (start.getDay() === options.dayOfWeekStartPrev) {
table += '</tr>';
newRow = true;
}
start.setDate(d + 1);
}
table += '</tbody></table>';
calendar.html(table);
mounth_picker.find('.xdsoft_label span').eq(0).text(options.i18n[globalLocale].months[_xdsoft_datetime.currentTime.getMonth()]);
mounth_picker.find('.xdsoft_label span').eq(1).text(_xdsoft_datetime.currentTime.getFullYear());
// generate timebox
time = '';
h = '';
m = '';
line_time = function line_time(h, m) {
var now = _xdsoft_datetime.now(), optionDateTime, current_time,
isALlowTimesInit = options.allowTimes && $.isArray(options.allowTimes) && options.allowTimes.length;
now.setHours(h);
h = parseInt(now.getHours(), 10);
now.setMinutes(m);
m = parseInt(now.getMinutes(), 10);
optionDateTime = new Date(_xdsoft_datetime.currentTime);
optionDateTime.setHours(h);
optionDateTime.setMinutes(m);
classes = [];
if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || (options.maxTime !== false && _xdsoft_datetime.strtotime(options.maxTime).getTime() < now.getTime()) || (options.minTime !== false && _xdsoft_datetime.strtotime(options.minTime).getTime() > now.getTime())) {
classes.push('xdsoft_disabled');
}
if ((options.minDateTime !== false && options.minDateTime > optionDateTime) || ((options.disabledMinTime !== false && now.getTime() > _xdsoft_datetime.strtotime(options.disabledMinTime).getTime()) && (options.disabledMaxTime !== false && now.getTime() < _xdsoft_datetime.strtotime(options.disabledMaxTime).getTime()))) {
classes.push('xdsoft_disabled');
}
current_time = new Date(_xdsoft_datetime.currentTime);
current_time.setHours(parseInt(_xdsoft_datetime.currentTime.getHours(), 10));
if (!isALlowTimesInit) {
current_time.setMinutes(Math[options.roundTime](_xdsoft_datetime.currentTime.getMinutes() / options.step) * options.step);
}
if ((options.initTime || options.defaultSelect || datetimepicker.data('changed')) && current_time.getHours() === parseInt(h, 10) && ((!isALlowTimesInit && options.step > 59) || current_time.getMinutes() === parseInt(m, 10))) {
if (options.defaultSelect || datetimepicker.data('changed')) {
classes.push('xdsoft_current');
} else if (options.initTime) {
classes.push('xdsoft_init_time');
}
}
if (parseInt(today.getHours(), 10) === parseInt(h, 10) && parseInt(today.getMinutes(), 10) === parseInt(m, 10)) {
classes.push('xdsoft_today');
}
time += '<div class="xdsoft_time ' + classes.join(' ') + '" data-hour="' + h + '" data-minute="' + m + '">' + dateHelper.formatDate(now, options.formatTime) + '</div>';
};
if (!options.allowTimes || !$.isArray(options.allowTimes) || !options.allowTimes.length) {
for (i = 0, j = 0; i < (options.hours12 ? 12 : 24); i += 1) {
for (j = 0; j < 60; j += options.step) {
h = (i < 10 ? '0' : '') + i;
m = (j < 10 ? '0' : '') + j;
line_time(h, m);
}
}
} else {
for (i = 0; i < options.allowTimes.length; i += 1) {
h = _xdsoft_datetime.strtotime(options.allowTimes[i]).getHours();
m = _xdsoft_datetime.strtotime(options.allowTimes[i]).getMinutes();
line_time(h, m);
}
}
timebox.html(time);
opt = '';
i = 0;
for (i = parseInt(options.yearStart, 10) + options.yearOffset; i <= parseInt(options.yearEnd, 10) + options.yearOffset; i += 1) {
opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getFullYear() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + i + '</div>';
}
yearselect.children().eq(0)
.html(opt);
for (i = parseInt(options.monthStart, 10), opt = ''; i <= parseInt(options.monthEnd, 10); i += 1) {
opt += '<div class="xdsoft_option ' + (_xdsoft_datetime.currentTime.getMonth() === i ? 'xdsoft_current' : '') + '" data-value="' + i + '">' + options.i18n[globalLocale].months[i] + '</div>';
}
monthselect.children().eq(0).html(opt);
$(datetimepicker)
.trigger('generate.xdsoft');
}, 10);
event.stopPropagation();
})
.on('afterOpen.xdsoft', function () {
if (options.timepicker) {
var classType, pheight, height, top;
if (timebox.find('.xdsoft_current').length) {
classType = '.xdsoft_current';
} else if (timebox.find('.xdsoft_init_time').length) {
classType = '.xdsoft_init_time';
}
if (classType) {
pheight = timeboxparent[0].clientHeight;
height = timebox[0].offsetHeight;
top = timebox.find(classType).index() * options.timeHeightInTimePicker + 1;
if ((height - pheight) < top) {
top = height - pheight;
}
timeboxparent.trigger('scroll_element.xdsoft_scroller', [parseInt(top, 10) / (height - pheight)]);
} else {
timeboxparent.trigger('scroll_element.xdsoft_scroller', [0]);
}
}
});
timerclick = 0;
calendar
.on('touchend click.xdsoft', 'td', function (xdevent) {
xdevent.stopPropagation(); // Prevents closing of Pop-ups, Modals and Flyouts in Bootstrap
timerclick += 1;
var $this = $(this),
currentTime = _xdsoft_datetime.currentTime;
if (currentTime === undefined || currentTime === null) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
currentTime = _xdsoft_datetime.currentTime;
}
if ($this.hasClass('xdsoft_disabled')) {
return false;
}
currentTime.setDate(1);
currentTime.setFullYear($this.data('year'));
currentTime.setMonth($this.data('month'));
currentTime.setDate($this.data('date'));
datetimepicker.trigger('select.xdsoft', [currentTime]);
input.val(_xdsoft_datetime.str());
if (options.onSelectDate && $.isFunction(options.onSelectDate)) {
options.onSelectDate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
}
datetimepicker.data('changed', true);
datetimepicker.trigger('xchange.xdsoft');
datetimepicker.trigger('changedatetime.xdsoft');
if ((timerclick > 1 || (options.closeOnDateSelect === true || (options.closeOnDateSelect === false && !options.timepicker))) && !options.inline) {
datetimepicker.trigger('close.xdsoft');
}
setTimeout(function () {
timerclick = 0;
}, 200);
});
timebox
.on('touchend click.xdsoft', 'div', function (xdevent) {
xdevent.stopPropagation();
var $this = $(this),
currentTime = _xdsoft_datetime.currentTime;
if (currentTime === undefined || currentTime === null) {
_xdsoft_datetime.currentTime = _xdsoft_datetime.now();
currentTime = _xdsoft_datetime.currentTime;
}
if ($this.hasClass('xdsoft_disabled')) {
return false;
}
currentTime.setHours($this.data('hour'));
currentTime.setMinutes($this.data('minute'));
datetimepicker.trigger('select.xdsoft', [currentTime]);
datetimepicker.data('input').val(_xdsoft_datetime.str());
if (options.onSelectTime && $.isFunction(options.onSelectTime)) {
options.onSelectTime.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), xdevent);
}
datetimepicker.data('changed', true);
datetimepicker.trigger('xchange.xdsoft');
datetimepicker.trigger('changedatetime.xdsoft');
if (options.inline !== true && options.closeOnTimeSelect === true) {
datetimepicker.trigger('close.xdsoft');
}
});
datepicker
.on('mousewheel.xdsoft', function (event) {
if (!options.scrollMonth) {
return true;
}
if (event.deltaY < 0) {
_xdsoft_datetime.nextMonth();
} else {
_xdsoft_datetime.prevMonth();
}
return false;
});
input
.on('mousewheel.xdsoft', function (event) {
if (!options.scrollInput) {
return true;
}
if (!options.datepicker && options.timepicker) {
current_time_index = timebox.find('.xdsoft_current').length ? timebox.find('.xdsoft_current').eq(0).index() : 0;
if (current_time_index + event.deltaY >= 0 && current_time_index + event.deltaY < timebox.children().length) {
current_time_index += event.deltaY;
}
if (timebox.children().eq(current_time_index).length) {
timebox.children().eq(current_time_index).trigger('mousedown');
}
return false;
}
if (options.datepicker && !options.timepicker) {
datepicker.trigger(event, [event.deltaY, event.deltaX, event.deltaY]);
if (input.val) {
input.val(_xdsoft_datetime.str());
}
datetimepicker.trigger('changedatetime.xdsoft');
return false;
}
});
datetimepicker
.on('changedatetime.xdsoft', function (event) {
if (options.onChangeDateTime && $.isFunction(options.onChangeDateTime)) {
var $input = datetimepicker.data('input');
options.onChangeDateTime.call(datetimepicker, _xdsoft_datetime.currentTime, $input, event);
delete options.value;
$input.trigger('change');
}
})
.on('generate.xdsoft', function () {
if (options.onGenerate && $.isFunction(options.onGenerate)) {
options.onGenerate.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'));
}
if (triggerAfterOpen) {
datetimepicker.trigger('afterOpen.xdsoft');
triggerAfterOpen = false;
}
})
.on('click.xdsoft', function (xdevent) {
xdevent.stopPropagation();
});
current_time_index = 0;
setPos = function () {
/**
* 修复输入框在window最右边,且输入框的宽度小于日期控件宽度情况下,日期控件显示不全的bug。
* Bug fixed - The datetimepicker will overflow-y when the width of the date input less than its, which
* could causes part of the datetimepicker being hidden.
* by Soon start
*/
var offset = datetimepicker.data('input').offset(),
datetimepickerelement = datetimepicker.data('input')[0],
top = offset.top + datetimepickerelement.offsetHeight - 1,
left = offset.left,
position = "absolute",
node;
if ((document.documentElement.clientWidth - offset.left) < datepicker.parent().outerWidth(true)) {
var diff = datepicker.parent().outerWidth(true) - datetimepickerelement.offsetWidth;
left = left - diff;
}
/**
* by Soon end
*/
if (datetimepicker.data('input').parent().css('direction') == 'rtl')
left -= (datetimepicker.outerWidth() - datetimepicker.data('input').outerWidth());
if (options.fixed) {
top -= $(window).scrollTop();
left -= $(window).scrollLeft();
position = "fixed";
} else {
if (top + datetimepickerelement.offsetHeight > $(window).height() + $(window).scrollTop()) {
top = offset.top - datetimepickerelement.offsetHeight + 1;
}
if (top < 0) {
top = 0;
}
if (left + datetimepickerelement.offsetWidth > $(window).width()) {
left = $(window).width() - datetimepickerelement.offsetWidth;
}
}
node = datetimepicker[0];
do {
node = node.parentNode;
if (window.getComputedStyle(node).getPropertyValue('position') === 'relative' && $(window).width() >= node.offsetWidth) {
left = left - (($(window).width() - node.offsetWidth) / 2);
break;
}
} while (node.nodeName !== 'HTML');
datetimepicker.css({
left: left,
top: top,
position: position
});
};
datetimepicker
.on('open.xdsoft', function (event) {
var onShow = true;
if (options.onShow && $.isFunction(options.onShow)) {
onShow = options.onShow.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
}
if (onShow !== false) {
datetimepicker.show();
setPos();
$(window)
.off('resize.xdsoft', setPos)
.on('resize.xdsoft', setPos);
if (options.closeOnWithoutClick) {
$([document.body, window]).on('touchstart mousedown.xdsoft', function arguments_callee6() {
datetimepicker.trigger('close.xdsoft');
$([document.body, window]).off('touchstart mousedown.xdsoft', arguments_callee6);
});
}
}
})
.on('close.xdsoft', function (event) {
var onClose = true;
mounth_picker
.find('.xdsoft_month,.xdsoft_year')
.find('.xdsoft_select')
.hide();
if (options.onClose && $.isFunction(options.onClose)) {
onClose = options.onClose.call(datetimepicker, _xdsoft_datetime.currentTime, datetimepicker.data('input'), event);
}
if (onClose !== false && !options.opened && !options.inline) {
datetimepicker.hide();
}
event.stopPropagation();
})
.on('toggle.xdsoft', function (event) {
if (datetimepicker.is(':visible')) {
datetimepicker.trigger('close.xdsoft');
} else {
datetimepicker.trigger('open.xdsoft');
}
})
.data('input', input);
timer = 0;
timer1 = 0;
datetimepicker.data('xdsoft_datetime', _xdsoft_datetime);
datetimepicker.setOptions(options);
function getCurrentValue() {
var ct = false, time;
if (options.startDate) {
ct = _xdsoft_datetime.strToDate(options.startDate);
} else {
ct = options.value || ((input && input.val && input.val()) ? input.val() : '');
if (ct) {
ct = _xdsoft_datetime.strToDateTime(ct);
} else if (options.defaultDate) {
ct = _xdsoft_datetime.strToDateTime(options.defaultDate);
if (options.defaultTime) {
time = _xdsoft_datetime.strtotime(options.defaultTime);
ct.setHours(time.getHours());
ct.setMinutes(time.getMinutes());
}
}
}
if (ct && _xdsoft_datetime.isValidDate(ct)) {
datetimepicker.data('changed', true);
} else {
ct = '';
}
return ct || 0;
}
function setMask(options) {
var isValidValue = function (mask, value) {
var reg = mask
.replace(/([\[\]\/\{\}\(\)\-\.\+]{1})/g, '\\$1')
.replace(/_/g, '{digit+}')
.replace(/([0-9]{1})/g, '{digit$1}')
.replace(/\{digit([0-9]{1})\}/g, '[0-$1_]{1}')
.replace(/\{digit[\+]\}/g, '[0-9_]{1}');
return (new RegExp(reg)).test(value);
},
getCaretPos = function (input) {
try {
if (document.selection && document.selection.createRange) {
var range = document.selection.createRange();
return range.getBookmark().charCodeAt(2) - 2;
}
if (input.setSelectionRange) {
return input.selectionStart;
}
} catch (e) {
return 0;
}
},
setCaretPos = function (node, pos) {
node = (typeof node === "string" || node instanceof String) ? document.getElementById(node) : node;
if (!node) {
return false;
}
if (node.createTextRange) {
var textRange = node.createTextRange();
textRange.collapse(true);
textRange.moveEnd('character', pos);
textRange.moveStart('character', pos);
textRange.select();
return true;
}
if (node.setSelectionRange) {
node.setSelectionRange(pos, pos);
return true;
}
return false;
};
if(options.mask) {
input.off('keydown.xdsoft');
}
if (options.mask === true) {
if (typeof moment != 'undefined') {
options.mask = options.format
.replace(/Y{4}/g, '9999')
.replace(/Y{2}/g, '99')
.replace(/M{2}/g, '19')
.replace(/D{2}/g, '39')
.replace(/H{2}/g, '29')
.replace(/m{2}/g, '59')
.replace(/s{2}/g, '59');
} else {
options.mask = options.format
.replace(/Y/g, '9999')
.replace(/F/g, '9999')
.replace(/m/g, '19')
.replace(/d/g, '39')
.replace(/H/g, '29')
.replace(/i/g, '59')
.replace(/s/g, '59');
}
}
if ($.type(options.mask) === 'string') {
if (!isValidValue(options.mask, input.val())) {
input.val(options.mask.replace(/[0-9]/g, '_'));
setCaretPos(input[0], 0);
}
input.on('keydown.xdsoft', function (event) {
var val = this.value,
key = event.which,
pos,
digit;
if (((key >= KEY0 && key <= KEY9) || (key >= _KEY0 && key <= _KEY9)) || (key === BACKSPACE || key === DEL)) {
pos = getCaretPos(this);
digit = (key !== BACKSPACE && key !== DEL) ? String.fromCharCode((_KEY0 <= key && key <= _KEY9) ? key - KEY0 : key) : '_';
if ((key === BACKSPACE || key === DEL) && pos) {
pos -= 1;
digit = '_';
}
while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
}
val = val.substr(0, pos) + digit + val.substr(pos + 1);
if ($.trim(val) === '') {
val = options.mask.replace(/[0-9]/g, '_');
} else {
if (pos === options.mask.length) {
event.preventDefault();
return false;
}
}
pos += (key === BACKSPACE || key === DEL) ? 0 : 1;
while (/[^0-9_]/.test(options.mask.substr(pos, 1)) && pos < options.mask.length && pos > 0) {
pos += (key === BACKSPACE || key === DEL) ? -1 : 1;
}
if (isValidValue(options.mask, val)) {
this.value = val;
setCaretPos(this, pos);
} else if ($.trim(val) === '') {
this.value = options.mask.replace(/[0-9]/g, '_');
} else {
input.trigger('error_input.xdsoft');
}
} else {
if (([AKEY, CKEY, VKEY, ZKEY, YKEY].indexOf(key) !== -1 && ctrlDown) || [ESC, ARROWUP, ARROWDOWN, ARROWLEFT, ARROWRIGHT, F5, CTRLKEY, TAB, ENTER].indexOf(key) !== -1) {
return true;
}
}
event.preventDefault();
return false;
});
}
}
_xdsoft_datetime.setCurrentTime(getCurrentValue());
input
.data('xdsoft_datetimepicker', datetimepicker)
.on('open.xdsoft focusin.xdsoft mousedown.xdsoft touchstart', function (event) {
if (input.is(':disabled') || (input.data('xdsoft_datetimepicker').is(':visible') && options.closeOnInputClick)) {
return;
}
clearTimeout(timer);
timer = setTimeout(function () {
if (input.is(':disabled')) {
return;
}
triggerAfterOpen = true;
_xdsoft_datetime.setCurrentTime(getCurrentValue());
if(options.mask) {
setMask(options);
}
datetimepicker.trigger('open.xdsoft');
}, 100);
})
.on('keydown.xdsoft', function (event) {
var val = this.value, elementSelector,
key = event.which;
if ([ENTER].indexOf(key) !== -1 && options.enterLikeTab) {
elementSelector = $("input:visible,textarea:visible,button:visible,a:visible");
datetimepicker.trigger('close.xdsoft');
elementSelector.eq(elementSelector.index(this) + 1).focus();
return false;
}
if ([TAB].indexOf(key) !== -1) {
datetimepicker.trigger('close.xdsoft');
return true;
}
})
.on('blur.xdsoft', function () {
datetimepicker.trigger('close.xdsoft');
});
};
destroyDateTimePicker = function (input) {
var datetimepicker = input.data('xdsoft_datetimepicker');
if (datetimepicker) {
datetimepicker.data('xdsoft_datetime', null);
datetimepicker.remove();
input
.data('xdsoft_datetimepicker', null)
.off('.xdsoft');
$(window).off('resize.xdsoft');
$([window, document.body]).off('mousedown.xdsoft touchstart');
if (input.unmousewheel) {
input.unmousewheel();
}
}
};
$(document)
.off('keydown.xdsoftctrl keyup.xdsoftctrl')
.on('keydown.xdsoftctrl', function (e) {
if (e.keyCode === CTRLKEY) {
ctrlDown = true;
}
})
.on('keyup.xdsoftctrl', function (e) {
if (e.keyCode === CTRLKEY) {
ctrlDown = false;
}
});
this.each(function () {
var datetimepicker = $(this).data('xdsoft_datetimepicker'), $input;
if (datetimepicker) {
if ($.type(opt) === 'string') {
switch (opt) {
case 'show':
$(this).select().focus();
datetimepicker.trigger('open.xdsoft');
break;
case 'hide':
datetimepicker.trigger('close.xdsoft');
break;
case 'toggle':
datetimepicker.trigger('toggle.xdsoft');
break;
case 'destroy':
destroyDateTimePicker($(this));
break;
case 'reset':
this.value = this.defaultValue;
if (!this.value || !datetimepicker.data('xdsoft_datetime').isValidDate(dateHelper.parseDate(this.value, options.format))) {
datetimepicker.data('changed', false);
}
datetimepicker.data('xdsoft_datetime').setCurrentTime(this.value);
break;
case 'validate':
$input = datetimepicker.data('input');
$input.trigger('blur.xdsoft');
break;
default:
if (datetimepicker[opt] && $.isFunction(datetimepicker[opt])) {
result = datetimepicker[opt](opt2);
}
}
} else {
datetimepicker
.setOptions(opt);
}
return 0;
}
if ($.type(opt) !== 'string') {
if (!options.lazyInit || options.open || options.inline) {
createDateTimePicker($(this));
} else {
lazyInit($(this));
}
}
});
return result;
};
$.fn.datetimepicker.defaults = default_options;
function HighlightedDate(date, desc, style) {
"use strict";
this.date = date;
this.desc = desc;
this.style = style;
}
}));
/*!
* jQuery Mousewheel 3.1.13
*
* Copyright jQuery Foundation and other contributors
* Released under the MIT license
* http://jquery.org/license
*/
(function (factory) {
if ( typeof define === 'function' && define.amd ) {
// AMD. Register as an anonymous module.
define(['jquery'], factory);
} else if (typeof exports === 'object') {
// Node/CommonJS style for Browserify
module.exports = factory;
} else {
// Browser globals
factory(jQuery);
}
}(function ($) {
var toFix = ['wheel', 'mousewheel', 'DOMMouseScroll', 'MozMousePixelScroll'],
toBind = ( 'onwheel' in document || document.documentMode >= 9 ) ?
['wheel'] : ['mousewheel', 'DomMouseScroll', 'MozMousePixelScroll'],
slice = Array.prototype.slice,
nullLowestDeltaTimeout, lowestDelta;
if ( $.event.fixHooks ) {
for ( var i = toFix.length; i; ) {
$.event.fixHooks[ toFix[--i] ] = $.event.mouseHooks;
}
}
var special = $.event.special.mousewheel = {
version: '3.1.12',
setup: function() {
if ( this.addEventListener ) {
for ( var i = toBind.length; i; ) {
this.addEventListener( toBind[--i], handler, false );
}
} else {
this.onmousewheel = handler;
}
// Store the line height and page height for this particular element
$.data(this, 'mousewheel-line-height', special.getLineHeight(this));
$.data(this, 'mousewheel-page-height', special.getPageHeight(this));
},
teardown: function() {
if ( this.removeEventListener ) {
for ( var i = toBind.length; i; ) {
this.removeEventListener( toBind[--i], handler, false );
}
} else {
this.onmousewheel = null;
}
// Clean up the data we added to the element
$.removeData(this, 'mousewheel-line-height');
$.removeData(this, 'mousewheel-page-height');
},
getLineHeight: function(elem) {
var $elem = $(elem),
$parent = $elem['offsetParent' in $.fn ? 'offsetParent' : 'parent']();
if (!$parent.length) {
$parent = $('body');
}
return parseInt($parent.css('fontSize'), 10) || parseInt($elem.css('fontSize'), 10) || 16;
},
getPageHeight: function(elem) {
return $(elem).height();
},
settings: {
adjustOldDeltas: true, // see shouldAdjustOldDeltas() below
normalizeOffset: true // calls getBoundingClientRect for each event
}
};
$.fn.extend({
mousewheel: function(fn) {
return fn ? this.bind('mousewheel', fn) : this.trigger('mousewheel');
},
unmousewheel: function(fn) {
return this.unbind('mousewheel', fn);
}
});
function handler(event) {
var orgEvent = event || window.event,
args = slice.call(arguments, 1),
delta = 0,
deltaX = 0,
deltaY = 0,
absDelta = 0,
offsetX = 0,
offsetY = 0;
event = $.event.fix(orgEvent);
event.type = 'mousewheel';
// Old school scrollwheel delta
if ( 'detail' in orgEvent ) { deltaY = orgEvent.detail * -1; }
if ( 'wheelDelta' in orgEvent ) { deltaY = orgEvent.wheelDelta; }
if ( 'wheelDeltaY' in orgEvent ) { deltaY = orgEvent.wheelDeltaY; }
if ( 'wheelDeltaX' in orgEvent ) { deltaX = orgEvent.wheelDeltaX * -1; }
// Firefox < 17 horizontal scrolling related to DOMMouseScroll event
if ( 'axis' in orgEvent && orgEvent.axis === orgEvent.HORIZONTAL_AXIS ) {
deltaX = deltaY * -1;
deltaY = 0;
}
// Set delta to be deltaY or deltaX if deltaY is 0 for backwards compatabilitiy
delta = deltaY === 0 ? deltaX : deltaY;
// New school wheel delta (wheel event)
if ( 'deltaY' in orgEvent ) {
deltaY = orgEvent.deltaY * -1;
delta = deltaY;
}
if ( 'deltaX' in orgEvent ) {
deltaX = orgEvent.deltaX;
if ( deltaY === 0 ) { delta = deltaX * -1; }
}
// No change actually happened, no reason to go any further
if ( deltaY === 0 && deltaX === 0 ) { return; }
// Need to convert lines and pages to pixels if we aren't already in pixels
// There are three delta modes:
// * deltaMode 0 is by pixels, nothing to do
// * deltaMode 1 is by lines
// * deltaMode 2 is by pages
if ( orgEvent.deltaMode === 1 ) {
var lineHeight = $.data(this, 'mousewheel-line-height');
delta *= lineHeight;
deltaY *= lineHeight;
deltaX *= lineHeight;
} else if ( orgEvent.deltaMode === 2 ) {
var pageHeight = $.data(this, 'mousewheel-page-height');
delta *= pageHeight;
deltaY *= pageHeight;
deltaX *= pageHeight;
}
// Store lowest absolute delta to normalize the delta values
absDelta = Math.max( Math.abs(deltaY), Math.abs(deltaX) );
if ( !lowestDelta || absDelta < lowestDelta ) {
lowestDelta = absDelta;
// Adjust older deltas if necessary
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
lowestDelta /= 40;
}
}
// Adjust older deltas if necessary
if ( shouldAdjustOldDeltas(orgEvent, absDelta) ) {
// Divide all the things by 40!
delta /= 40;
deltaX /= 40;
deltaY /= 40;
}
// Get a whole, normalized value for the deltas
delta = Math[ delta >= 1 ? 'floor' : 'ceil' ](delta / lowestDelta);
deltaX = Math[ deltaX >= 1 ? 'floor' : 'ceil' ](deltaX / lowestDelta);
deltaY = Math[ deltaY >= 1 ? 'floor' : 'ceil' ](deltaY / lowestDelta);
// Normalise offsetX and offsetY properties
if ( special.settings.normalizeOffset && this.getBoundingClientRect ) {
var boundingRect = this.getBoundingClientRect();
offsetX = event.clientX - boundingRect.left;
offsetY = event.clientY - boundingRect.top;
}
// Add information to the event object
event.deltaX = deltaX;
event.deltaY = deltaY;
event.deltaFactor = lowestDelta;
event.offsetX = offsetX;
event.offsetY = offsetY;
// Go ahead and set deltaMode to 0 since we converted to pixels
// Although this is a little odd since we overwrite the deltaX/Y
// properties with normalized deltas.
event.deltaMode = 0;
// Add event and delta to the front of the arguments
args.unshift(event, delta, deltaX, deltaY);
// Clearout lowestDelta after sometime to better
// handle multiple device types that give different
// a different lowestDelta
// Ex: trackpad = 3 and mouse wheel = 120
if (nullLowestDeltaTimeout) { clearTimeout(nullLowestDeltaTimeout); }
nullLowestDeltaTimeout = setTimeout(nullLowestDelta, 200);
return ($.event.dispatch || $.event.handle).apply(this, args);
}
function nullLowestDelta() {
lowestDelta = null;
}
function shouldAdjustOldDeltas(orgEvent, absDelta) {
// If this is an older event and the delta is divisable by 120,
// then we are assuming that the browser is treating this as an
// older mouse wheel event and that we should divide the deltas
// by 40 to try and get a more usable deltaFactor.
// Side note, this actually impacts the reported scroll distance
// in older browsers and can cause scrolling to be slower than native.
// Turn this off by setting $.event.special.mousewheel.settings.adjustOldDeltas to false.
return special.settings.adjustOldDeltas && orgEvent.type === 'mousewheel' && absDelta % 120 === 0;
}
}));
$(document).ready(function(){
$.datetimepicker.setLocale('en');
});
| tech-server/tgmanage | web/nms.gathering.org/js/jquery.datetimepicker.full.js | JavaScript | gpl-2.0 | 110,839 |
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
define([
'ko',
'uiClass'
], function (ko, Class) {
'use strict';
return Class.extend({
initialize: function () {
this._super()
.initObservable();
return this;
},
initObservable: function () {
this.errorMessages = ko.observableArray([]);
this.successMessages = ko.observableArray([]);
return this;
},
/**
* Add message to list.
* @param {Object} messageObj
* @param {Object} type
* @returns {Boolean}
*/
add: function (messageObj, type) {
var expr = /([%])\w+/g,
message;
if (!messageObj.hasOwnProperty('parameters')) {
this.clear();
type.push(messageObj.message);
return true;
}
message = messageObj.message.replace(expr, function (varName) {
varName = varName.substr(1);
if (messageObj.parameters.hasOwnProperty(varName)) {
return messageObj.parameters[varName];
}
return messageObj.parameters.shift();
});
this.clear();
this.errorMessages.push(message);
return true;
},
addSuccessMessage: function (message) {
return this.add(message, this.successMessages);
},
addErrorMessage: function (message) {
return this.add(message, this.errorMessages);
},
getErrorMessages: function () {
return this.errorMessages;
},
getSuccessMessages: function () {
return this.successMessages;
},
hasMessages: function () {
return this.errorMessages().length > 0 || this.successMessages().length > 0;
},
clear: function () {
this.errorMessages.removeAll();
this.successMessages.removeAll();
}
});
});
| FPLD/project0 | vendor/magento/module-ui/view/frontend/web/js/model/messages.js | JavaScript | gpl-2.0 | 2,128 |
/*
* Copyright 2013 the original author or authors
* @license MIT, see LICENSE.txt for details
*
* @author Scott Andrews
*/
(function (buster, define) {
'use strict';
var assert, refute, fail;
assert = buster.assertions.assert;
refute = buster.assertions.refute;
fail = buster.assertions.fail;
define('rest/interceptor/csrf-test', function (require) {
var csrf, rest;
csrf = require('rest/interceptor/csrf');
rest = require('rest');
buster.testCase('rest/interceptor/csrf', {
'should protect the requst from the config': function () {
var client = csrf(
function (request) { return { request: request }; },
{ token: 'abc123xyz789'}
);
return client({}).then(function (response) {
assert.equals('abc123xyz789', response.request.headers['X-Csrf-Token']);
}).otherwise(fail);
},
'should protect the requst from the request': function () {
var client = csrf(
function (request) { return { request: request }; }
);
return client({ csrfToken: 'abc123xyz789' }).then(function (response) {
assert.equals('abc123xyz789', response.request.headers['X-Csrf-Token']);
}).otherwise(fail);
},
'should protect the requst from the config using a custom header': function () {
var client = csrf(
function (request) { return { request: request }; },
{ token: 'abc123xyz789', name: 'Csrf-Token' }
);
return client({}).then(function (response) {
assert.equals('abc123xyz789', response.request.headers['Csrf-Token']);
}).otherwise(fail);
},
'should protect the requst from the request using a custom header': function () {
var client = csrf(
function (request) { return { request: request }; }
);
return client({ csrfToken: 'abc123xyz789', csrfTokenName: 'Csrf-Token' }).then(function (response) {
assert.equals('abc123xyz789', response.request.headers['Csrf-Token']);
}).otherwise(fail);
},
'should not protect without a token': function () {
var client = csrf(
function (request) { return { request: request }; }
);
return client({}).then(function (response) {
refute.defined(response.request.headers['X-Csrf-Token']);
}).otherwise(fail);
},
'should have the default client as the parent by default': function () {
assert.same(rest, csrf().skip());
},
'should support interceptor chaining': function () {
assert(typeof csrf().chain === 'function');
}
});
});
}(
this.buster || require('buster'),
typeof define === 'function' && define.amd ? define : function (id, factory) {
var packageName = id.split(/[\/\-]/)[0], pathToRoot = id.replace(/[^\/]+/g, '..');
pathToRoot = pathToRoot.length > 2 ? pathToRoot.substr(3) : pathToRoot;
factory(function (moduleId) {
return require(moduleId.indexOf(packageName) === 0 ? pathToRoot + moduleId.substr(packageName.length) : moduleId);
});
}
// Boilerplate for AMD and Node
));
| toolsmasterbioinfo/toolsmasterbioinfo | node_modules/github-token/node_modules/rest/test/interceptor/csrf-test.js | JavaScript | gpl-2.0 | 2,933 |
import { Media, Revisions } from "/lib/collections";
import { Reaction } from "/server/api";
import { RevisionApi } from "/imports/plugins/core/revisions/lib/api/revisions";
/**
* CollectionFS - Image/Video Publication
* @params {Array} shops - array of current shop object
*/
Meteor.publish("Media", function (shops) {
check(shops, Match.Optional(Array));
let selector;
const shopId = Reaction.getShopId();
if (!shopId) {
return this.ready();
}
if (shopId) {
selector = {
"metadata.shopId": shopId
};
}
if (shops) {
selector = {
"metadata.shopId": {
$in: shops
}
};
}
// Product editors can see both published and unpublished images
if (!Reaction.hasPermission(["createProduct"], this.userId)) {
selector["metadata.workflow"] = {
$in: [null, "published"]
};
} else {
// but no one gets to see archived images
selector["metadata.workflow"] = {
$nin: ["archived"]
};
}
if (RevisionApi.isRevisionControlEnabled()) {
const revisionHandle = Revisions.find({
"documentType": "image",
"workflow.status": { $nin: [ "revision/published"] }
}).observe({
added: (revision) => {
const media = Media.findOne(revision.documentId);
if (media) {
this.added("Media", media._id, media);
this.added("Revisions", revision._id, revision);
}
},
changed: (revision) => {
const media = Media.findOne(revision.documentId);
this.changed("Media", media._id, media);
this.changed("Revisions", revision._id, revision);
},
removed: (revision) => {
if (revision) {
const media = Media.findOne(revision.documentId);
if (media) {
this.removed("Media", media._id, media);
this.removed("Revisions", revision._id, revision);
}
}
}
});
this.onStop(() => {
revisionHandle.stop();
});
}
return Media.find({
"metadata.type": "brandAsset"
});
});
| 3rrolw/Reaction-Theme | server/publications/collections/media.js | JavaScript | gpl-3.0 | 2,044 |
// Copyright (C) 2011 Google Inc.
//
// Licensed under the Apache License, Version 2.0 (the "License");
// you may not use this file except in compliance with the License.
// You may obtain a copy of the License at
//
// http://www.apache.org/licenses/LICENSE-2.0
//
// Unless required by applicable law or agreed to in writing, software
// distributed under the License is distributed on an "AS IS" BASIS,
// WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
// See the License for the specific language governing permissions and
// limitations under the License.
/**
* @fileoverview Install a leaky WeakMap emulation on platforms that
* don't provide a built-in one.
*
* <p>Assumes that an ES5 platform where, if {@code WeakMap} is
* already present, then it conforms to the anticipated ES6
* specification. To run this file on an ES5 or almost ES5
* implementation where the {@code WeakMap} specification does not
* quite conform, run <code>repairES5.js</code> first.
*
* @author Mark S. Miller
* @requires ses, crypto, ArrayBuffer, Uint8Array
* @overrides WeakMap, WeakMapModule
*/
/**
* This {@code WeakMap} emulation is observably equivalent to the
* ES-Harmony WeakMap, but with leakier garbage collection properties.
*
* <p>As with true WeakMaps, in this emulation, a key does not
* retain maps indexed by that key and (crucially) a map does not
* retain the keys it indexes. A map by itself also does not retain
* the values associated with that map.
*
* <p>However, the values associated with a key in some map are
* retained so long as that key is retained and those associations are
* not overridden. For example, when used to support membranes, all
* values exported from a given membrane will live for the lifetime
* they would have had in the absence of an interposed membrane. Even
* when the membrane is revoked, all objects that would have been
* reachable in the absence of revocation will still be reachable, as
* far as the GC can tell, even though they will no longer be relevant
* to ongoing computation.
*
* <p>The API implemented here is approximately the API as implemented
* in FF6.0a1 and agreed to by MarkM, Andreas Gal, and Dave Herman,
* rather than the offially approved proposal page. TODO(erights):
* upgrade the ecmascript WeakMap proposal page to explain this API
* change and present to EcmaScript committee for their approval.
*
* <p>The first difference between the emulation here and that in
* FF6.0a1 is the presence of non enumerable {@code get___, has___,
* set___, and delete___} methods on WeakMap instances to represent
* what would be the hidden internal properties of a primitive
* implementation. Whereas the FF6.0a1 WeakMap.prototype methods
* require their {@code this} to be a genuine WeakMap instance (i.e.,
* an object of {@code [[Class]]} "WeakMap}), since there is nothing
* unforgeable about the pseudo-internal method names used here,
* nothing prevents these emulated prototype methods from being
* applied to non-WeakMaps with pseudo-internal methods of the same
* names.
*
* <p>Another difference is that our emulated {@code
* WeakMap.prototype} is not itself a WeakMap. A problem with the
* current FF6.0a1 API is that WeakMap.prototype is itself a WeakMap
* providing ambient mutability and an ambient communications
* channel. Thus, if a WeakMap is already present and has this
* problem, repairES5.js wraps it in a safe wrappper in order to
* prevent access to this channel. (See
* PATCH_MUTABLE_FROZEN_WEAKMAP_PROTO in repairES5.js).
*/
var WeakMap;
/**
* If this is a full <a href=
* "http://code.google.com/p/es-lab/wiki/SecureableES5"
* >secureable ES5</a> platform and the ES-Harmony {@code WeakMap} is
* absent, install an approximate emulation.
*
* <p>If this is almost a secureable ES5 platform, then WeakMap.js
* should be run after repairES5.js.
*
* <p>See {@code WeakMap} for documentation of the garbage collection
* properties of this WeakMap emulation.
*/
(function WeakMapModule() {
"use strict";
if (typeof ses !== 'undefined' && ses.ok && !ses.ok()) {
// already too broken, so give up
return;
}
if (typeof WeakMap === 'function') {
// assumed fine, so we're done.
return;
}
var gopn = Object.getOwnPropertyNames;
var defProp = Object.defineProperty;
/**
* Holds the orginal static properties of the Object constructor,
* after repairES5 fixes these if necessary to be a more complete
* secureable ES5 environment, but before installing the following
* WeakMap emulation overrides and before any untrusted code runs.
*/
var originalProps = {};
gopn(Object).forEach(function(name) {
originalProps[name] = Object[name];
});
/**
* Security depends on HIDDEN_NAME being both <i>unguessable</i> and
* <i>undiscoverable</i> by untrusted code.
*
* <p>Given the known weaknesses of Math.random() on existing
* browsers, it does not generate unguessability we can be confident
* of.
*
* <p>It is the monkey patching logic in this file that is intended
* to ensure undiscoverability. The basic idea is that there are
* three fundamental means of discovering properties of an object:
* The for/in loop, Object.keys(), and Object.getOwnPropertyNames(),
* as well as some proposed ES6 extensions that appear on our
* whitelist. The first two only discover enumerable properties, and
* we only use HIDDEN_NAME to name a non-enumerable property, so the
* only remaining threat should be getOwnPropertyNames and some
* proposed ES6 extensions that appear on our whitelist. We monkey
* patch them to remove HIDDEN_NAME from the list of properties they
* returns.
*
* <p>TODO(erights): On a platform with built-in Proxies, proxies
* could be used to trap and thereby discover the HIDDEN_NAME, so we
* need to monkey patch Proxy.create, Proxy.createFunction, etc, in
* order to wrap the provided handler with the real handler which
* filters out all traps using HIDDEN_NAME.
*
* <p>TODO(erights): Revisit Mike Stay's suggestion that we use an
* encapsulated function at a not-necessarily-secret name, which
* uses the Stiegler shared-state rights amplification pattern to
* reveal the associated value only to the WeakMap in which this key
* is associated with that value. Since only the key retains the
* function, the function can also remember the key without causing
* leakage of the key, so this doesn't violate our general gc
* goals. In addition, because the name need not be a guarded
* secret, we could efficiently handle cross-frame frozen keys.
*/
var HIDDEN_NAME = 'ident:' + Math.random() + '___';
if (typeof crypto !== 'undefined' &&
typeof crypto.getRandomValues === 'function' &&
typeof ArrayBuffer === 'function' &&
typeof Uint8Array === 'function') {
var ab = new ArrayBuffer(25);
var u8s = new Uint8Array(ab);
crypto.getRandomValues(u8s);
HIDDEN_NAME = 'rand:' +
Array.prototype.map.call(u8s, function(u8) {
return (u8 % 36).toString(36);
}).join('') + '___';
}
/**
* Monkey patch getOwnPropertyNames to avoid revealing the
* HIDDEN_NAME.
*
* <p>The ES5.1 spec requires each name to appear only once, but as
* of this writing, this requirement is controversial for ES6, so we
* made this code robust against this case. If the resulting extra
* search turns out to be expensive, we can probably relax this once
* ES6 is adequately supported on all major browsers, iff no browser
* versions we support at that time have relaxed this constraint
* without providing built-in ES6 WeakMaps.
*/
defProp(Object, 'getOwnPropertyNames', {
value: function fakeGetOwnPropertyNames(obj) {
return gopn(obj).filter(function(name) {
return name !== HIDDEN_NAME;
});
}
});
/**
* getPropertyNames is not in ES5 but it is proposed for ES6 and
* does appear in our whitelist, so we need to clean it too.
*/
if ('getPropertyNames' in Object) {
defProp(Object, 'getPropertyNames', {
value: function fakeGetPropertyNames(obj) {
return originalProps.getPropertyNames(obj).filter(function(name) {
return name !== HIDDEN_NAME;
});
}
});
}
/**
* <p>To treat objects as identity-keys with reasonable efficiency
* on ES5 by itself (i.e., without any object-keyed collections), we
* need to add a hidden property to such key objects when we
* can. This raises several issues:
* <ul>
* <li>Arranging to add this property to objects before we lose the
* chance, and
* <li>Hiding the existence of this new property from most
* JavaScript code.
* <li>Preventing <i>certification theft</i>, where one object is
* created falsely claiming to be the key of an associa
n
* actually keyed by another object.
* <li>Preventing <i>value theft</i>, where untrusted code with
* access to a key object but not a weak map nevertheless
* obtains access to the value associated with that key in that
* weak map.
* </ul>
* We do so by
* <ul>
* <li>Making the name of the hidden property unguessable, so "[]"
* indexing, which we cannot intercept, cannot be used to access
* a property without knowing the name.
* <li>Making the hidden property non-enumerable, so we need not
* worry about for-in loops or {@code Object.keys},
* <li>monkey patching those reflective methods that would
* prevent extensions, to add this hidden property first,
* <li>monkey patching those methods that would reveal this
* hidden property.
* </ul>
* Unfortunately, because of same-origin iframes, we cannot reliably
* add this hidden property before an object becomes
* non-extensible. Instead, if we encounter a non-extensible object
* without a hidden record that we can detect (whether or not it has
* a hidden record stored under a name secret to us), then we just
* use the key object itself to represent its identity in a brute
* force leaky map stored in the weak map, losing all the advantages
* of weakness for these.
*/
function getHiddenRecord(key) {
if (key !== Object(key)) {
throw new TypeError('Not an object: ' + key);
}
var hiddenRecord = key[HIDDEN_NAME];
if (hiddenRecord && hiddenRecord.key === key) { return hiddenRecord; }
if (!originalProps.isExtensible(key)) {
// Weak map must brute force, as explained in doc-comment above.
return void 0;
}
var gets = [];
var vals = [];
hiddenRecord = {
key: key, // self pointer for quick own check above.
gets: gets, // get___ methods identifying weak maps
vals: vals // values associated with this key in each
// corresponding weak map.
};
defProp(key, HIDDEN_NAME, {
value: hiddenRecord,
writable: false,
enumerable: false,
configurable: false
});
return hiddenRecord;
}
/**
* Monkey patch operations that would make their argument
* non-extensible.
*
* <p>The monkey patched versions throw a TypeError if their
* argument is not an object, so it should only be done to functions
* that should throw a TypeError anyway if their argument is not an
* object.
*/
(function(){
var oldFreeze = Object.freeze;
defProp(Object, 'freeze', {
value: function identifyingFreeze(obj) {
getHiddenRecord(obj);
return oldFreeze(obj);
}
});
var oldSeal = Object.seal;
defProp(Object, 'seal', {
value: function identifyingSeal(obj) {
getHiddenRecord(obj);
return oldSeal(obj);
}
});
var oldPreventExtensions = Object.preventExtensions;
defProp(Object, 'preventExtensions', {
value: function identifyingPreventExtensions(obj) {
getHiddenRecord(obj);
return oldPreventExtensions(obj);
}
});
})();
function constFunc(func) {
func.prototype = null;
return Object.freeze(func);
}
// Right now (12/25/2012) the histogram supports the current
// representation. We should check this occasionally, as a true
// constant time representation is easy.
// var histogram = [];
WeakMap = function() {
// We are currently (12/25/2012) never encountering any prematurely
// non-extensible keys.
var keys = []; // brute force for prematurely non-extensible keys.
var vals = []; // brute force for corresponding values.
function get___(key, opt_default) {
var hr = getHiddenRecord(key);
var i, vs;
if (hr) {
i = hr.gets.indexOf(get___);
vs = hr.vals;
} else {
i = keys.indexOf(key);
vs = vals;
}
return (i >= 0) ? vs[i] : opt_default;
}
function has___(key) {
var hr = getHiddenRecord(key);
var i;
if (hr) {
i = hr.gets.indexOf(get___);
} else {
i = keys.indexOf(key);
}
return i >= 0;
}
function set___(key, value) {
var hr = getHiddenRecord(key);
var i;
if (hr) {
i = hr.gets.indexOf(get___);
if (i >= 0) {
hr.vals[i] = value;
} else {
// i = hr.gets.length;
// histogram[i] = (histogram[i] || 0) + 1;
hr.gets.push(get___);
hr.vals.push(value);
}
} else {
i = keys.indexOf(key);
if (i >= 0) {
vals[i] = value;
} else {
keys.push(key);
vals.push(value);
}
}
}
function delete___(key) {
var hr = getHiddenRecord(key);
var i;
if (hr) {
i = hr.gets.indexOf(get___);
if (i >= 0) {
hr.gets.splice(i, 1);
hr.vals.splice(i, 1);
}
} else {
i = keys.indexOf(key);
if (i >= 0) {
keys.splice(i, 1);
vals.splice(i, 1);
}
}
return true;
}
return Object.create(WeakMap.prototype, {
get___: { value: constFunc(get___) },
has___: { value: constFunc(has___) },
set___: { value: constFunc(set___) },
delete___: { value: constFunc(delete___) }
});
};
WeakMap.prototype = Object.create(Object.prototype, {
get: {
/**
* Return the value most recently associated with key, or
* opt_default if none.
*/
value: function get(key, opt_default) {
return this.get___(key, opt_default);
},
writable: true,
configurable: true
},
has: {
/**
* Is there a value associated with key in this WeakMap?
*/
value: function has(key) {
return this.has___(key);
},
writable: true,
configurable: true
},
set: {
/**
* Associate value with key in this WeakMap, overwriting any
* previous association if present.
*/
value: function set(key, value) {
this.set___(key, value);
},
writable: true,
configurable: true
},
'delete': {
/**
* Remove any association for key in this WeakMap, returning
* whether there was one.
*
* <p>Note that the boolean return here does not work like the
* {@code delete} operator. The {@code delete} operator returns
* whether the deletion succeeds at bringing about a state in
* which the deleted property is absent. The {@code delete}
* operator therefore returns true if the property was already
* absent, whereas this {@code delete} method returns false if
* the association was already absent.
*/
value: function remove(key) {
return this.delete___(key);
},
writable: true,
configurable: true
}
});
})();
| ashking/Cloud9 | node_modules/sourcemint-loader-js/node_modules/sourcemint-platform-nodejs/node_modules/q/.tmp/weak-map.js | JavaScript | gpl-3.0 | 17,395 |
/*global wc_add_to_cart_variation_params */
;(function ( $, window, document, undefined ) {
/**
* VariationForm class which handles variation forms and attributes.
*/
var VariationForm = function( $form ) {
var self = this;
self.$form = $form;
self.$attributeFields = $form.find( '.variations select' );
self.$singleVariation = $form.find( '.single_variation' );
self.$singleVariationWrap = $form.find( '.single_variation_wrap' );
self.$resetVariations = $form.find( '.reset_variations' );
self.$product = $form.closest( '.product' );
self.variationData = $form.data( 'product_variations' );
self.useAjax = false === self.variationData;
self.xhr = false;
self.loading = true;
// Initial state.
self.$singleVariationWrap.show();
self.$form.off( '.wc-variation-form' );
// Methods.
self.getChosenAttributes = self.getChosenAttributes.bind( self );
self.findMatchingVariations = self.findMatchingVariations.bind( self );
self.isMatch = self.isMatch.bind( self );
self.toggleResetLink = self.toggleResetLink.bind( self );
// Events.
$form.on( 'click.wc-variation-form', '.reset_variations', { variationForm: self }, self.onReset );
$form.on( 'reload_product_variations', { variationForm: self }, self.onReload );
$form.on( 'hide_variation', { variationForm: self }, self.onHide );
$form.on( 'show_variation', { variationForm: self }, self.onShow );
$form.on( 'click', '.single_add_to_cart_button', { variationForm: self }, self.onAddToCart );
$form.on( 'reset_data', { variationForm: self }, self.onResetDisplayedVariation );
$form.on( 'reset_image', { variationForm: self }, self.onResetImage );
$form.on( 'change.wc-variation-form', '.variations select', { variationForm: self }, self.onChange );
$form.on( 'found_variation.wc-variation-form', { variationForm: self }, self.onFoundVariation );
$form.on( 'check_variations.wc-variation-form', { variationForm: self }, self.onFindVariation );
$form.on( 'update_variation_values.wc-variation-form', { variationForm: self }, self.onUpdateAttributes );
// Init after gallery.
setTimeout( function() {
$form.trigger( 'check_variations' );
$form.trigger( 'wc_variation_form' );
self.loading = false;
}, 100 );
};
/**
* Reset all fields.
*/
VariationForm.prototype.onReset = function( event ) {
event.preventDefault();
event.data.variationForm.$attributeFields.val( '' ).change();
event.data.variationForm.$form.trigger( 'reset_data' );
};
/**
* Reload variation data from the DOM.
*/
VariationForm.prototype.onReload = function( event ) {
var form = event.data.variationForm;
form.variationData = form.$form.data( 'product_variations' );
form.useAjax = false === form.variationData;
form.$form.trigger( 'check_variations' );
};
/**
* When a variation is hidden.
*/
VariationForm.prototype.onHide = function( event ) {
event.preventDefault();
event.data.variationForm.$form.find( '.single_add_to_cart_button' ).removeClass( 'wc-variation-is-unavailable' ).addClass( 'disabled wc-variation-selection-needed' );
event.data.variationForm.$form.find( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-enabled' ).addClass( 'woocommerce-variation-add-to-cart-disabled' );
};
/**
* When a variation is shown.
*/
VariationForm.prototype.onShow = function( event, variation, purchasable ) {
event.preventDefault();
if ( purchasable ) {
event.data.variationForm.$form.find( '.single_add_to_cart_button' ).removeClass( 'disabled wc-variation-selection-needed wc-variation-is-unavailable' );
event.data.variationForm.$form.find( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-disabled' ).addClass( 'woocommerce-variation-add-to-cart-enabled' );
} else {
event.data.variationForm.$form.find( '.single_add_to_cart_button' ).removeClass( 'wc-variation-selection-needed' ).addClass( 'disabled wc-variation-is-unavailable' );
event.data.variationForm.$form.find( '.woocommerce-variation-add-to-cart' ).removeClass( 'woocommerce-variation-add-to-cart-enabled' ).addClass( 'woocommerce-variation-add-to-cart-disabled' );
}
};
/**
* When the cart button is pressed.
*/
VariationForm.prototype.onAddToCart = function( event ) {
if ( $( this ).is('.disabled') ) {
event.preventDefault();
if ( $( this ).is('.wc-variation-is-unavailable') ) {
window.alert( wc_add_to_cart_variation_params.i18n_unavailable_text );
} else if ( $( this ).is('.wc-variation-selection-needed') ) {
window.alert( wc_add_to_cart_variation_params.i18n_make_a_selection_text );
}
}
};
/**
* When displayed variation data is reset.
*/
VariationForm.prototype.onResetDisplayedVariation = function( event ) {
var form = event.data.variationForm;
form.$product.find( '.product_meta' ).find( '.sku' ).wc_reset_content();
form.$product.find( '.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value' ).wc_reset_content();
form.$product.find( '.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value' ).wc_reset_content();
form.$form.trigger( 'reset_image' );
form.$singleVariation.slideUp( 200 ).trigger( 'hide_variation' );
};
/**
* When the product image is reset.
*/
VariationForm.prototype.onResetImage = function( event ) {
event.data.variationForm.$form.wc_variations_image_update( false );
};
/**
* Looks for matching variations for current selected attributes.
*/
VariationForm.prototype.onFindVariation = function( event ) {
var form = event.data.variationForm,
attributes = form.getChosenAttributes(),
currentAttributes = attributes.data;
if ( attributes.count === attributes.chosenCount ) {
if ( form.useAjax ) {
if ( form.xhr ) {
form.xhr.abort();
}
form.$form.block( { message: null, overlayCSS: { background: '#fff', opacity: 0.6 } } );
currentAttributes.product_id = parseInt( form.$form.data( 'product_id' ), 10 );
currentAttributes.custom_data = form.$form.data( 'custom_data' );
form.xhr = $.ajax( {
url: wc_add_to_cart_variation_params.wc_ajax_url.toString().replace( '%%endpoint%%', 'get_variation' ),
type: 'POST',
data: currentAttributes,
success: function( variation ) {
if ( variation ) {
form.$form.trigger( 'found_variation', [ variation ] );
} else {
form.$form.trigger( 'reset_data' );
attributes.chosenCount = 0;
if ( ! form.loading ) {
form.$form.find( '.single_variation' ).after( '<p class="wc-no-matching-variations woocommerce-info">' + wc_add_to_cart_variation_params.i18n_no_matching_variations_text + '</p>' );
form.$form.find( '.wc-no-matching-variations' ).slideDown( 200 );
}
}
},
complete: function() {
form.$form.unblock();
}
} );
} else {
form.$form.trigger( 'update_variation_values' );
var matching_variations = form.findMatchingVariations( form.variationData, currentAttributes ),
variation = matching_variations.shift();
if ( variation ) {
form.$form.trigger( 'found_variation', [ variation ] );
} else {
form.$form.trigger( 'reset_data' );
attributes.chosenCount = 0;
if ( ! form.loading ) {
form.$form.find( '.single_variation' ).after( '<p class="wc-no-matching-variations woocommerce-info">' + wc_add_to_cart_variation_params.i18n_no_matching_variations_text + '</p>' );
form.$form.find( '.wc-no-matching-variations' ).slideDown( 200 );
}
}
}
} else {
form.$form.trigger( 'update_variation_values' );
form.$form.trigger( 'reset_data' );
}
// Show reset link.
form.toggleResetLink( attributes.chosenCount > 0 );
};
/**
* Triggered when a variation has been found which matches all attributes.
*/
VariationForm.prototype.onFoundVariation = function( event, variation ) {
var form = event.data.variationForm,
$sku = form.$product.find( '.product_meta' ).find( '.sku' ),
$weight = form.$product.find( '.product_weight, .woocommerce-product-attributes-item--weight .woocommerce-product-attributes-item__value' ),
$dimensions = form.$product.find( '.product_dimensions, .woocommerce-product-attributes-item--dimensions .woocommerce-product-attributes-item__value' ),
$qty = form.$singleVariationWrap.find( '.quantity' ),
purchasable = true,
variation_id = '',
template = false,
$template_html = '';
if ( variation.sku ) {
$sku.wc_set_content( variation.sku );
} else {
$sku.wc_reset_content();
}
if ( variation.weight ) {
$weight.wc_set_content( variation.weight_html );
} else {
$weight.wc_reset_content();
}
if ( variation.dimensions ) {
// Decode HTML entities.
$dimensions.wc_set_content( $.parseHTML( variation.dimensions_html )[0].data );
} else {
$dimensions.wc_reset_content();
}
form.$form.wc_variations_image_update( variation );
if ( ! variation.variation_is_visible ) {
template = wp_template( 'unavailable-variation-template' );
} else {
template = wp_template( 'variation-template' );
variation_id = variation.variation_id;
}
$template_html = template( {
variation: variation
} );
$template_html = $template_html.replace( '/*<![CDATA[*/', '' );
$template_html = $template_html.replace( '/*]]>*/', '' );
form.$singleVariation.html( $template_html );
form.$form.find( 'input[name="variation_id"], input.variation_id' ).val( variation.variation_id ).change();
// Hide or show qty input
if ( variation.is_sold_individually === 'yes' ) {
$qty.find( 'input.qty' ).val( '1' ).attr( 'min', '1' ).attr( 'max', '' );
$qty.hide();
} else {
$qty.find( 'input.qty' ).attr( 'min', variation.min_qty ).attr( 'max', variation.max_qty );
$qty.show();
}
// Enable or disable the add to cart button
if ( ! variation.is_purchasable || ! variation.is_in_stock || ! variation.variation_is_visible ) {
purchasable = false;
}
// Reveal
if ( $.trim( form.$singleVariation.text() ) ) {
form.$singleVariation.slideDown( 200 ).trigger( 'show_variation', [ variation, purchasable ] );
} else {
form.$singleVariation.show().trigger( 'show_variation', [ variation, purchasable ] );
}
};
/**
* Triggered when an attribute field changes.
*/
VariationForm.prototype.onChange = function( event ) {
var form = event.data.variationForm;
form.$form.find( 'input[name="variation_id"], input.variation_id' ).val( '' ).change();
form.$form.find( '.wc-no-matching-variations' ).remove();
if ( form.useAjax ) {
form.$form.trigger( 'check_variations' );
} else {
form.$form.trigger( 'woocommerce_variation_select_change' );
form.$form.trigger( 'check_variations' );
$( this ).blur();
}
// Custom event for when variation selection has been changed
form.$form.trigger( 'woocommerce_variation_has_changed' );
};
/**
* Escape quotes in a string.
* @param {string} string
* @return {string}
*/
VariationForm.prototype.addSlashes = function( string ) {
string = string.replace( /'/g, '\\\'' );
string = string.replace( /"/g, '\\\"' );
return string;
};
/**
* Updates attributes in the DOM to show valid values.
*/
VariationForm.prototype.onUpdateAttributes = function( event ) {
var form = event.data.variationForm,
attributes = form.getChosenAttributes(),
currentAttributes = attributes.data;
if ( form.useAjax ) {
return;
}
// Loop through selects and disable/enable options based on selections.
form.$attributeFields.each( function( index, el ) {
var current_attr_select = $( el ),
current_attr_name = current_attr_select.data( 'attribute_name' ) || current_attr_select.attr( 'name' ),
show_option_none = $( el ).data( 'show_option_none' ),
option_gt_filter = ':gt(0)',
attached_options_count = 0,
new_attr_select = $( '<select/>' ),
selected_attr_val = current_attr_select.val() || '',
selected_attr_val_valid = true;
// Reference options set at first.
if ( ! current_attr_select.data( 'attribute_html' ) ) {
var refSelect = current_attr_select.clone();
refSelect.find( 'option' ).removeAttr( 'disabled attached' ).removeAttr( 'selected' );
current_attr_select.data( 'attribute_options', refSelect.find( 'option' + option_gt_filter ).get() ); // Legacy data attribute.
current_attr_select.data( 'attribute_html', refSelect.html() );
}
new_attr_select.html( current_attr_select.data( 'attribute_html' ) );
// The attribute of this select field should not be taken into account when calculating its matching variations:
// The constraints of this attribute are shaped by the values of the other attributes.
var checkAttributes = $.extend( true, {}, currentAttributes );
checkAttributes[ current_attr_name ] = '';
var variations = form.findMatchingVariations( form.variationData, checkAttributes );
// Loop through variations.
for ( var num in variations ) {
if ( typeof( variations[ num ] ) !== 'undefined' ) {
var variationAttributes = variations[ num ].attributes;
for ( var attr_name in variationAttributes ) {
if ( variationAttributes.hasOwnProperty( attr_name ) ) {
var attr_val = variationAttributes[ attr_name ],
variation_active = '';
if ( attr_name === current_attr_name ) {
if ( variations[ num ].variation_is_active ) {
variation_active = 'enabled';
}
if ( attr_val ) {
// Decode entities.
attr_val = $( '<div/>' ).html( attr_val ).text();
// Attach to matching options by value. This is done to compare
// TEXT values rather than any HTML entities.
var $option_elements = new_attr_select.find( 'option' );
if ( $option_elements.length ) {
for (var i = 0, len = $option_elements.length; i < len; i++) {
var $option_element = $( $option_elements[i] ),
option_value = $option_element.val();
if ( attr_val === option_value ) {
$option_element.addClass( 'attached ' + variation_active );
break;
}
}
}
} else {
// Attach all apart from placeholder.
new_attr_select.find( 'option:gt(0)' ).addClass( 'attached ' + variation_active );
}
}
}
}
}
}
// Count available options.
attached_options_count = new_attr_select.find( 'option.attached' ).length;
// Check if current selection is in attached options.
if ( selected_attr_val ) {
selected_attr_val_valid = false;
if ( 0 !== attached_options_count ) {
new_attr_select.find( 'option.attached.enabled' ).each( function() {
var option_value = $( this ).val();
if ( selected_attr_val === option_value ) {
selected_attr_val_valid = true;
return false; // break.
}
});
}
}
// Detach the placeholder if:
// - Valid options exist.
// - The current selection is non-empty.
// - The current selection is valid.
// - Placeholders are not set to be permanently visible.
if ( attached_options_count > 0 && selected_attr_val && selected_attr_val_valid && ( 'no' === show_option_none ) ) {
new_attr_select.find( 'option:first' ).remove();
option_gt_filter = '';
}
// Detach unattached.
new_attr_select.find( 'option' + option_gt_filter + ':not(.attached)' ).remove();
// Finally, copy to DOM and set value.
current_attr_select.html( new_attr_select.html() );
current_attr_select.find( 'option' + option_gt_filter + ':not(.enabled)' ).prop( 'disabled', true );
// Choose selected value.
if ( selected_attr_val ) {
// If the previously selected value is no longer available, fall back to the placeholder (it's going to be there).
if ( selected_attr_val_valid ) {
current_attr_select.val( selected_attr_val );
} else {
current_attr_select.val( '' ).change();
}
} else {
current_attr_select.val( '' ); // No change event to prevent infinite loop.
}
});
// Custom event for when variations have been updated.
form.$form.trigger( 'woocommerce_update_variation_values' );
};
/**
* Get chosen attributes from form.
* @return array
*/
VariationForm.prototype.getChosenAttributes = function() {
var data = {};
var count = 0;
var chosen = 0;
this.$attributeFields.each( function() {
var attribute_name = $( this ).data( 'attribute_name' ) || $( this ).attr( 'name' );
var value = $( this ).val() || '';
if ( value.length > 0 ) {
chosen ++;
}
count ++;
data[ attribute_name ] = value;
});
return {
'count' : count,
'chosenCount': chosen,
'data' : data
};
};
/**
* Find matching variations for attributes.
*/
VariationForm.prototype.findMatchingVariations = function( variations, attributes ) {
var matching = [];
for ( var i = 0; i < variations.length; i++ ) {
var variation = variations[i];
if ( this.isMatch( variation.attributes, attributes ) ) {
matching.push( variation );
}
}
return matching;
};
/**
* See if attributes match.
* @return {Boolean}
*/
VariationForm.prototype.isMatch = function( variation_attributes, attributes ) {
var match = true;
for ( var attr_name in variation_attributes ) {
if ( variation_attributes.hasOwnProperty( attr_name ) ) {
var val1 = variation_attributes[ attr_name ];
var val2 = attributes[ attr_name ];
if ( val1 !== undefined && val2 !== undefined && val1.length !== 0 && val2.length !== 0 && val1 !== val2 ) {
match = false;
}
}
}
return match;
};
/**
* Show or hide the reset link.
*/
VariationForm.prototype.toggleResetLink = function( on ) {
if ( on ) {
if ( this.$resetVariations.css( 'visibility' ) === 'hidden' ) {
this.$resetVariations.css( 'visibility', 'visible' ).hide().fadeIn();
}
} else {
this.$resetVariations.css( 'visibility', 'hidden' );
}
};
/**
* Function to call wc_variation_form on jquery selector.
*/
$.fn.wc_variation_form = function() {
new VariationForm( this );
return this;
};
/**
* Stores the default text for an element so it can be reset later
*/
$.fn.wc_set_content = function( content ) {
if ( undefined === this.attr( 'data-o_content' ) ) {
this.attr( 'data-o_content', this.text() );
}
this.text( content );
};
/**
* Stores the default text for an element so it can be reset later
*/
$.fn.wc_reset_content = function() {
if ( undefined !== this.attr( 'data-o_content' ) ) {
this.text( this.attr( 'data-o_content' ) );
}
};
/**
* Stores a default attribute for an element so it can be reset later
*/
$.fn.wc_set_variation_attr = function( attr, value ) {
if ( undefined === this.attr( 'data-o_' + attr ) ) {
this.attr( 'data-o_' + attr, ( ! this.attr( attr ) ) ? '' : this.attr( attr ) );
}
if ( false === value ) {
this.removeAttr( attr );
} else {
this.attr( attr, value );
}
};
/**
* Reset a default attribute for an element so it can be reset later
*/
$.fn.wc_reset_variation_attr = function( attr ) {
if ( undefined !== this.attr( 'data-o_' + attr ) ) {
this.attr( attr, this.attr( 'data-o_' + attr ) );
}
};
/**
* Reset the slide position if the variation has a different image than the current one
*/
$.fn.wc_maybe_trigger_slide_position_reset = function( variation ) {
var $form = $( this ),
$product = $form.closest( '.product' ),
$product_gallery = $product.find( '.images' ),
reset_slide_position = false,
new_image_id = ( variation && variation.image_id ) ? variation.image_id : '';
if ( $form.attr( 'current-image' ) !== new_image_id ) {
reset_slide_position = true;
}
$form.attr( 'current-image', new_image_id );
if ( reset_slide_position ) {
$product_gallery.trigger( 'woocommerce_gallery_reset_slide_position' );
}
};
/**
* Sets product images for the chosen variation
*/
$.fn.wc_variations_image_update = function( variation ) {
var $form = this,
$product = $form.closest( '.product' ),
$product_gallery = $product.find( '.images' ),
$gallery_nav = $product.find( '.flex-control-nav' ),
$gallery_img = $gallery_nav.find( 'li:eq(0) img' ),
$product_img_wrap = $product_gallery.find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ).eq( 0 ),
$product_img = $product_img_wrap.find( '.wp-post-image' ),
$product_link = $product_img_wrap.find( 'a' ).eq( 0 );
if ( variation && variation.image && variation.image.src && variation.image.src.length > 1 ) {
// See if the gallery has an image with the same original src as the image we want to switch to.
var galleryHasImage = $gallery_nav.find( 'li img[data-o_src="' + variation.image.gallery_thumbnail_src + '"]' ).length > 0;
// If the gallery has the image, reset the images. We'll scroll to the correct one.
if ( galleryHasImage ) {
$form.wc_variations_image_reset();
}
// See if gallery has a matching image we can slide to.
var slideToImage = $gallery_nav.find( 'li img[src="' + variation.image.gallery_thumbnail_src + '"]' );
if ( slideToImage.length > 0 ) {
slideToImage.trigger( 'click' );
$form.attr( 'current-image', variation.image_id );
window.setTimeout( function() {
$( window ).trigger( 'resize' );
$product_gallery.trigger( 'woocommerce_gallery_init_zoom' );
}, 20 );
return;
}
$product_img.wc_set_variation_attr( 'src', variation.image.src );
$product_img.wc_set_variation_attr( 'height', variation.image.src_h );
$product_img.wc_set_variation_attr( 'width', variation.image.src_w );
$product_img.wc_set_variation_attr( 'srcset', variation.image.srcset );
$product_img.wc_set_variation_attr( 'sizes', variation.image.sizes );
$product_img.wc_set_variation_attr( 'title', variation.image.title );
$product_img.wc_set_variation_attr( 'data-caption', variation.image.caption );
$product_img.wc_set_variation_attr( 'alt', variation.image.alt );
$product_img.wc_set_variation_attr( 'data-src', variation.image.full_src );
$product_img.wc_set_variation_attr( 'data-large_image', variation.image.full_src );
$product_img.wc_set_variation_attr( 'data-large_image_width', variation.image.full_src_w );
$product_img.wc_set_variation_attr( 'data-large_image_height', variation.image.full_src_h );
$product_img_wrap.wc_set_variation_attr( 'data-thumb', variation.image.src );
$gallery_img.wc_set_variation_attr( 'src', variation.image.gallery_thumbnail_src );
$product_link.wc_set_variation_attr( 'href', variation.image.full_src );
} else {
$form.wc_variations_image_reset();
}
window.setTimeout( function() {
$( window ).trigger( 'resize' );
$form.wc_maybe_trigger_slide_position_reset( variation );
$product_gallery.trigger( 'woocommerce_gallery_init_zoom' );
}, 20 );
};
/**
* Reset main image to defaults.
*/
$.fn.wc_variations_image_reset = function() {
var $form = this,
$product = $form.closest( '.product' ),
$product_gallery = $product.find( '.images' ),
$gallery_nav = $product.find( '.flex-control-nav' ),
$gallery_img = $gallery_nav.find( 'li:eq(0) img' ),
$product_img_wrap = $product_gallery.find( '.woocommerce-product-gallery__image, .woocommerce-product-gallery__image--placeholder' ).eq( 0 ),
$product_img = $product_img_wrap.find( '.wp-post-image' ),
$product_link = $product_img_wrap.find( 'a' ).eq( 0 );
$product_img.wc_reset_variation_attr( 'src' );
$product_img.wc_reset_variation_attr( 'width' );
$product_img.wc_reset_variation_attr( 'height' );
$product_img.wc_reset_variation_attr( 'srcset' );
$product_img.wc_reset_variation_attr( 'sizes' );
$product_img.wc_reset_variation_attr( 'title' );
$product_img.wc_reset_variation_attr( 'data-caption' );
$product_img.wc_reset_variation_attr( 'alt' );
$product_img.wc_reset_variation_attr( 'data-src' );
$product_img.wc_reset_variation_attr( 'data-large_image' );
$product_img.wc_reset_variation_attr( 'data-large_image_width' );
$product_img.wc_reset_variation_attr( 'data-large_image_height' );
$product_img_wrap.wc_reset_variation_attr( 'data-thumb' );
$gallery_img.wc_reset_variation_attr( 'src' );
$product_link.wc_reset_variation_attr( 'href' );
};
$(function() {
if ( typeof wc_add_to_cart_variation_params !== 'undefined' ) {
$( '.variations_form' ).each( function() {
$( this ).wc_variation_form();
});
}
});
/**
* Matches inline variation objects to chosen attributes
* @deprecated 2.6.9
* @type {Object}
*/
var wc_variation_form_matcher = {
find_matching_variations: function( product_variations, settings ) {
var matching = [];
for ( var i = 0; i < product_variations.length; i++ ) {
var variation = product_variations[i];
if ( wc_variation_form_matcher.variations_match( variation.attributes, settings ) ) {
matching.push( variation );
}
}
return matching;
},
variations_match: function( attrs1, attrs2 ) {
var match = true;
for ( var attr_name in attrs1 ) {
if ( attrs1.hasOwnProperty( attr_name ) ) {
var val1 = attrs1[ attr_name ];
var val2 = attrs2[ attr_name ];
if ( val1 !== undefined && val2 !== undefined && val1.length !== 0 && val2.length !== 0 && val1 !== val2 ) {
match = false;
}
}
}
return match;
}
};
/**
* Avoids using wp.template where possible in order to be CSP compliant.
* wp.template uses internally eval().
* @param {string} templateId
* @return {Function}
*/
var wp_template = function( templateId ) {
var html = document.getElementById( 'tmpl-' + templateId ).textContent;
var hard = false;
// any <# #> interpolate (evaluate).
hard = hard || /<#\s?data\./.test( html );
// any data that is NOT data.variation.
hard = hard || /{{{?\s?data\.(?!variation\.).+}}}?/.test( html );
// any data access deeper than 1 level e.g.
// data.variation.object.item
// data.variation.object['item']
// data.variation.array[0]
hard = hard || /{{{?\s?data\.variation\.[\w-]*[^\s}]/.test ( html );
if ( hard ) {
return wp.template( templateId );
}
return function template ( data ) {
var variation = data.variation || {};
return html.replace( /({{{?)\s?data\.variation\.([\w-]*)\s?(}}}?)/g, function( _, open, key, close ) {
// Error in the format, ignore.
if ( open.length !== close.length ) {
return '';
}
var replacement = variation[ key ] || '';
// {{{ }}} => interpolate (unescaped).
// {{ }} => interpolate (escaped).
// https://codex.wordpress.org/Javascript_Reference/wp.template
if ( open.length === 2 ) {
return window.escape( replacement );
}
return replacement;
});
};
};
})( jQuery, window, document );
| woothemes/woocommerce | assets/js/frontend/add-to-cart-variation.js | JavaScript | gpl-3.0 | 27,355 |
let StandaloneSass = require('../StandaloneSass');
class FastSassPlugin {
/**
* Create a new plugin instance.
*
* @param {Array} files
*/
constructor(files = []) {
this.files = files;
}
/**
* Apply the plugin.
*/
apply() {
this.files.forEach(sass => {
new StandaloneSass(
sass.src, sass.output.forceFromPublic(), sass.pluginOptions
).run();
});
}
}
module.exports = FastSassPlugin;
| Maurifc/MacMan | node_modules/laravel-mix/src/plugins/FastSassPlugin.js | JavaScript | gpl-3.0 | 504 |
/*
* Copyright (C) 2014 Canonical, Ltd.
*
* This program is free software; you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
* the Free Software Foundation; version 3.
*
* This program is distributed in the hope that it will be useful,
* but WITHOUT ANY WARRANTY; without even the implied warranty of
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
* GNU General Public License for more details.
*
* You should have received a copy of the GNU General Public License
* along with this program. If not, see <http://www.gnu.org/licenses/>.
*/
.pragma library
/*! \brief Calculate average luminance of the passed colors
\note If not fully opaque, luminance is dependant on blending.
*/
function luminance() {
var sum = 0;
// TODO this was originally
// for (var k in arguments) {
// but for some unkown reason was causing crashes in testDash/testDashContent
// investigate when we have some time
for (var k = 0; k < arguments.length; ++k) {
// only way to convert string to color
var c = Qt.lighter(arguments[k], 1.0);
sum += 0.2126 * c.r + 0.7152 * c.g + 0.0722 * c.b;
}
return sum / arguments.length;
}
| jonjahren/unity8 | tests/mocks/Utils/Style.js | JavaScript | gpl-3.0 | 1,257 |
/**
* Copyright (c) 2008-2009 The Open Source Geospatial Foundation
*
* Published under the BSD license.
* See http://svn.geoext.org/core/trunk/geoext/license.txt for the full text
* of the license.
*/
Ext.namespace("GEOR");
/** api: (define)
* module = GEOR
* class = FeaturePanel
* base_link = `Ext.form.FormPanel <http://extjs.com/deploy/dev/docs/?class=Ext.form.FormPanel>`_
*/
/**
* @include OpenLayers/Lang.js
* @include Ext/examples/ux/Spinner.js
* @include Ext/examples/ux/SpinnerField.js
* @include FeatureEditing/ux/widgets/Ext.ux.ColorField.js
*/
/** api: constructor
* .. class:: FeaturePanel
*/
GEOR.FeaturePanel = Ext.extend(Ext.form.FormPanel, {
/** api: config[labelWidth]
* ``Number`` Default value.
*/
labelWidth: 100,
/** api: config[border]
* ``Boolean`` Default value.
*/
border: false,
/** api: config[bodyStyle]
* ``String`` Default value.
*/
bodyStyle:'padding:5px 5px 5px 5px',
/** api: config[width]
* ``String`` Default value.
*/
width: 'auto',
/** api: config[autoWidth]
* ``Boolean`` Default value.
*/
autoWidth: true,
/** api: config[height]
* ``String`` Default value.
*/
height: 'auto',
/** api: config[autoHeight]
* ``Boolean`` Default value.
*/
autoHeight: true,
/** api: config[defaults]
* ``Object`` Default value.
*/
defaults: {width: 120},
/** api: config[defaultType]
* ``String`` Default value.
*/
defaultType: 'textfield',
/** private: property[features]
* ``OpenLayers.Feature.Vector`` The feature currently being edited
*/
features: null,
/** api: config[layer]
* ``OpenLayers.Layer.Vector``
* The layer the features are binded to
*/
layer: null,
/** api: config[deleteAction]
* ``Ext.Action``
* The action created to delete the selected feature(s).
*/
deleteAction: null,
/** private: method[initComponent]
*/
initComponent: function() {
this.initFeatures(this.features);
this.initToolbar();
this.initMyItems();
GEOR.FeaturePanel.superclass.initComponent.call(this);
},
/** private: method[initFeatures]
* :param features: ``Array(OpenLayers.Feature.Vector)``
*/
initFeatures: function(features) {
if (features instanceof Array) {
this.features = features;
} else {
this.features = [features];
}
},
/** private: method[initToolbar]
* Initialize the controls of the controler and create a toolbar from the
* actions created.
*/
initToolbar: function() {
this.initDeleteAction();
// Add buttons and toolbar
Ext.apply(this, {bbar: new Ext.Toolbar(this.getActions())});
},
/** private: method[initMyItems]
* Create field options and link them to the controler controls and actions
*/
initMyItems: function() {
var oItems, oGroup, feature, field;
// todo : for multiple features selection support, remove this...
if (this.features.length != 1) {
return;
} else {
feature = this.features[0];
}
oItems = [];
if (feature.geometry.CLASS_NAME === "OpenLayers.Geometry.Point" ) {
if (!feature.isLabel) {
// point size
oItems.push({
xtype: 'spinnerfield',
name: 'pointRadius',
fieldLabel: OpenLayers.i18n('annotation.size'),
value: feature.style.pointRadius || 10,
width: 40,
minValue: 6,
maxValue: 20,
listeners: {
spin: function(spinner) {
feature.style.pointRadius = spinner.field.getValue();
feature.layer.drawFeature(feature);
}
}
});
}
}
if (feature.isLabel) {
oItems.push({
name: 'label',
fieldLabel: OpenLayers.i18n('annotation.label'),
value: feature.attributes.label,
enableKeyEvents: true,
listeners: {
keyup: function(field) {
feature.style.label = field.getValue();
feature.layer.drawFeature(feature);
}
}
});
}
if (feature.geometry.CLASS_NAME !== "OpenLayers.Geometry.LineString" &&
!feature.isLabel) {
var fillColor = feature.style.fillColor;
oItems.push({
xtype: 'compositefield',
fieldLabel: OpenLayers.i18n('annotation.fillcolor'),
items: [{
xtype: 'displayfield', value: ''
},{
xtype: 'button',
text: ' ',
menu: {
xtype: 'colormenu',
value: fillColor.replace('#', ''),
listeners: {
select: function(menu, color) {
color = "#" + color;
menu.ownerCt.ownerCt.btnEl.setStyle("background", color);
feature.style.fillColor = color;
feature.layer.drawFeature(feature);
},
scope: this
}
},
listeners: {
render: function(button) {
button.btnEl.setStyle("background", fillColor);
}
}
}]
});
}
var color = feature.style[(feature.isLabel ? 'fontColor' : 'strokeColor')]
|| "#00FF00";
var label = (
feature.geometry.CLASS_NAME == "OpenLayers.Geometry.LineString" ||
feature.isLabel
) ? 'annotation.color' : 'annotation.outlinecolor';
oItems.push({
xtype: 'compositefield',
fieldLabel: OpenLayers.i18n(label),
items: [{
xtype: 'displayfield', value: ''
},{
xtype: 'button',
text: ' ',
menu: {
xtype: 'colormenu',
value: color.replace('#', ''),
listeners: {
select: function(menu, color) {
color = "#" + color;
menu.ownerCt.ownerCt.btnEl.setStyle("background", color);
if (feature.isLabel) {
feature.style.fontColor = color;
} else {
feature.style.strokeColor = color;
}
feature.layer.drawFeature(feature);
},
scope: this
}
},
listeners: {
render: function(button) {
button.btnEl.setStyle("background", color);
}
}
}]
});
if (feature.geometry.CLASS_NAME !== "OpenLayers.Geometry.Point" ||
feature.isLabel) {
// font size or stroke width
var attribute = feature.isLabel ? 'fontSize' : 'strokeWidth';
oItems.push({
xtype: 'spinnerfield',
name: 'stroke',
fieldLabel: OpenLayers.i18n('annotation.' + attribute.toLowerCase()),
value: feature.style[attribute] || ((feature.isLabel) ? 16 : 1),
width: 40,
minValue: feature.isLabel ? 8 : 1,
maxValue: feature.isLabel ? 36 : 10,
listeners: {
spin: function(spinner) {
var f = feature;
var style = {};
style[attribute] = spinner.field.getValue() +
(f.isLabel ? 'px' : '');
f.style = OpenLayers.Util.extend(f.style, style);
f.layer.drawFeature(f);
},
scope: this
}
});
}
// Add item within feature panel for polygon, rectangle and ring
if (feature.geometry.CLASS_NAME === "OpenLayers.Geometry.Polygon" ) {
if (!feature.isLabel) {
// Opacity
oItems.push({
id: 'opacitySlider',
xtype: 'sliderfield',
name: 'Opacity',
fieldLabel: OpenLayers.i18n('annotation.fillOpacity'),
value: feature.style.fillOpacity || 1,
width: 100,
minValue: 0,
maxValue: 1,
decimalPrecision: 2,
increment: 0.01,
tipText: function(thumb){
var valOpacity = thumb.value;
return String(Math.round(valOpacity*100)) + '%';
},
// Get default opacity value, give it to the feature style properties
// and draw feature if value change
listeners : {
valid: function(slider) {
feature.style.fillOpacity = slider.value;
feature.layer.drawFeature(feature);
},
}
});
}
}
Ext.apply(this, {items: oItems});
},
/** private: method[initDeleteAction]
* Create a Ext.Action object that is set as the deleteAction property
* and pushed to te actions array.
*/
initDeleteAction: function() {
var actionOptions = {
handler: this.deleteFeatures,
scope: this,
tooltip: OpenLayers.i18n('annotation.delete_feature'),
iconCls: "gx-featureediting-delete",
text: OpenLayers.i18n('annotation.delete')
};
this.deleteAction = new Ext.Action(actionOptions);
},
/** private: method[deleteFeatures]
* Called when the deleteAction is triggered (button pressed).
* Destroy all features from all layers.
*/
deleteFeatures: function() {
Ext.MessageBox.confirm(OpenLayers.i18n('annotation.delete_feature'), OpenLayers.i18n('annotation.delete_confirm'), function(btn) {
if (btn == 'yes') {
for (var i = 0; i < this.features.length; i++) {
var feature = this.features[i];
if (feature.popup) {
feature.popup.close();
feature.popup = null;
}
feature.layer.destroyFeatures([feature]);
}
}
},
this);
},
/** private: method[getActions]
*/
getActions: function() {
return [this.deleteAction, '->', {
text: OpenLayers.i18n('annotation.close'),
handler: function() {
this.ownerCt.close();
},
scope: this
}];
},
/** private: method[beforeDestroy]
*/
beforeDestroy: function() {
delete this.feature;
}
});
| landryb/georchestra | mapfishapp/src/main/webapp/app/addons/annotation/js/FeaturePanel.js | JavaScript | gpl-3.0 | 11,790 |
"use strict";
/* global define, app, socket, bootbox */
define('admin/extend/plugins', function() {
var Plugins = {};
Plugins.init = function() {
var pluginsList = $('.plugins'),
numPlugins = pluginsList[0].querySelectorAll('li').length,
pluginID;
if (!numPlugins) {
pluginsList.append('<li><p><i>No plugins found.</i></p></li>');
return;
}
$('#plugin-search').val('');
pluginsList.on('click', 'button[data-action="toggleActive"]', function() {
pluginID = $(this).parents('li').attr('data-plugin-id');
var btn = $(this);
socket.emit('admin.plugins.toggleActive', pluginID, function(err, status) {
btn.html('<i class="fa fa-power-off"></i> ' + (status.active ? 'Deactivate' : 'Activate'));
btn.toggleClass('btn-warning', status.active).toggleClass('btn-success', !status.active);
app.alert({
alert_id: 'plugin_toggled',
title: 'Plugin ' + (status.active ? 'Enabled' : 'Disabled'),
message: status.active ? 'Please reload your NodeBB to fully activate this plugin' : 'Plugin successfully deactivated',
type: status.active ? 'warning' : 'success',
timeout: 5000,
clickfn: function() {
require(['admin/modules/instance'], function(instance) {
instance.reload();
});
}
});
});
});
pluginsList.on('click', 'button[data-action="toggleInstall"]', function() {
var btn = $(this);
btn.attr('disabled', true);
pluginID = $(this).parents('li').attr('data-plugin-id');
if ($(this).attr('data-installed') === '1') {
return Plugins.toggleInstall(pluginID, $(this).parents('li').attr('data-version'));
}
Plugins.suggest(pluginID, function(err, payload) {
if (err) {
bootbox.confirm('<p>NodeBB could not reach the package manager, proceed with installation of latest version?</p><div class="alert alert-danger"><strong>Server returned (' + err.status + ')</strong>: ' + err.responseText + '</div>', function(confirm) {
if (confirm) {
Plugins.toggleInstall(pluginID, 'latest');
} else {
btn.removeAttr('disabled');
}
});
return;
}
require(['semver'], function(semver) {
if (payload.version !== 'latest') {
Plugins.toggleInstall(pluginID, payload.version);
} else if (payload.version === 'latest') {
confirmInstall(pluginID, function(confirm) {
if (confirm) {
Plugins.toggleInstall(pluginID, 'latest');
} else {
btn.removeAttr('disabled');
}
});
} else {
btn.removeAttr('disabled');
}
});
});
});
pluginsList.on('click', 'button[data-action="upgrade"]', function() {
var btn = $(this);
var parent = btn.parents('li');
pluginID = parent.attr('data-plugin-id');
Plugins.suggest(pluginID, function(err, payload) {
if (err) {
return bootbox.alert('<p>NodeBB could not reach the package manager, an upgrade is not suggested at this time.</p>');
}
require(['semver'], function(semver) {
if (payload.version !== 'latest' && semver.gt(payload.version, parent.find('.currentVersion').text())) {
upgrade(pluginID, btn, payload.version);
} else if (payload.version === 'latest') {
confirmInstall(pluginID, function() {
upgrade(pluginID, btn, payload.version);
});
} else {
bootbox.alert('<p>Your version of NodeBB (v' + app.config.version + ') is only cleared to upgrade to v' + payload.version + ' of this plugin. Please update your NodeBB if you wish to install a newer version of this plugin.');
}
});
});
});
$('#plugin-search').on('input propertychange', function() {
var term = $(this).val();
$('.plugins li').each(function() {
var pluginId = $(this).attr('data-plugin-id');
$(this).toggleClass('hide', pluginId && pluginId.indexOf(term) === -1);
});
});
$('#plugin-order').on('click', function() {
$('#order-active-plugins-modal').modal('show');
socket.emit('admin.plugins.getActive', function(err, activePlugins) {
if (err) {
return app.alertError(err);
}
var html = '';
activePlugins.forEach(function(plugin) {
html += '<li class="">' + plugin + '</li>';
});
if (!activePlugins.length) {
html = 'No Active Plugins';
}
$('#order-active-plugins-modal .plugin-list').html(html).sortable();
});
});
$('#save-plugin-order').on('click', function() {
var plugins = $('#order-active-plugins-modal .plugin-list').children();
var data = [];
plugins.each(function(index, el) {
data.push({name: $(el).text(), order: index});
});
socket.emit('admin.plugins.orderActivePlugins', data, function(err) {
if (err) {
return app.alertError(err.message);
}
$('#order-active-plugins-modal').modal('hide');
});
});
populateUpgradeablePlugins();
};
function confirmInstall(pluginID, callback) {
bootbox.confirm(
'<div class="alert alert-warning"><p><strong>No Compatibility Infomation Found</strong></p><p>This plugin did not specify a specific version for installation given your NodeBB version. Full compatibility cannot be guaranteed, and may cause your NodeBB to no longer start properly.</p></div>' +
'<p>In the event that NodeBB cannot boot properly:</p>' +
'<pre><code>$ ./nodebb reset plugin="' + pluginID + '"</code></pre>' +
'<p>Continue installation of latest version of this plugin?</p>', function(confirm) {
callback(confirm);
});
}
function upgrade(pluginID, btn, version) {
btn.attr('disabled', true).find('i').attr('class', 'fa fa-refresh fa-spin');
socket.emit('admin.plugins.upgrade', {
id: pluginID,
version: version
}, function(err, isActive) {
if (err) {
return app.alertError(err.message);
}
var parent = btn.parents('li');
parent.find('.fa-exclamation-triangle').remove();
parent.find('.currentVersion').text(version);
btn.remove();
if (isActive) {
app.alert({
alert_id: 'plugin_upgraded',
title: 'Plugin Upgraded',
message: 'Please reload your NodeBB to fully upgrade this plugin',
type: 'warning',
timeout: 5000,
clickfn: function() {
require(['admin/modules/instance'], function(instance) {
instance.reload();
});
}
});
}
});
}
Plugins.toggleInstall = function(pluginID, version, callback) {
var btn = $('li[data-plugin-id="' + pluginID + '"] button[data-action="toggleInstall"]');
var activateBtn = btn.siblings('[data-action="toggleActive"]');
btn.find('i').attr('class', 'fa fa-refresh fa-spin');
socket.emit('admin.plugins.toggleInstall', {
id: pluginID,
version: version
}, function(err, pluginData) {
if (err) {
btn.removeAttr('disabled');
return app.alertError(err.message);
}
ajaxify.refresh();
app.alert({
alert_id: 'plugin_toggled',
title: 'Plugin ' + (pluginData.installed ? 'Installed' : 'Uninstalled'),
message: pluginData.installed ? 'Plugin successfully installed, please activate the plugin.' : 'The plugin has been successfully deactivated and uninstalled.',
type: 'info',
timeout: 5000
});
if (typeof callback === 'function') {
callback.apply(this, arguments);
}
});
};
Plugins.suggest = function(pluginId, callback) {
var nbbVersion = app.config.version.match(/^\d\.\d\.\d/);
$.ajax((app.config.registry || 'https://packages.nodebb.org') + '/api/v1/suggest', {
type: 'GET',
data: {
package: pluginId,
version: nbbVersion[0]
},
dataType: 'json'
}).done(function(payload) {
callback(undefined, payload);
}).fail(callback);
};
function populateUpgradeablePlugins() {
$('#installed ul li').each(function() {
if ($(this).children('[data-action="upgrade"]').length) {
$('#upgrade ul').append($(this).clone(true));
}
});
}
return Plugins;
});
| rockq-org/cnodebb | public/src/admin/extend/plugins.js | JavaScript | gpl-3.0 | 7,813 |
import { module } from 'qunit';
import { setupTest } from 'ember-qunit';
import test from 'ember-sinon-qunit/test-support/test';
module('Unit | Route | dc', function(hooks) {
setupTest(hooks);
test('it exists', function(assert) {
let route = this.owner.lookup('route:dc');
assert.ok(route);
});
});
| hashicorp/consul | ui/packages/consul-ui/tests/unit/routes/dc-test.js | JavaScript | mpl-2.0 | 315 |
OC.L10N.register(
"spreed",
{
"(Duration %s)" : "(Duración %s)",
"You attended a call with {user1}" : "Tomaste una llamda con {user1}",
"_%n guest_::_%n guests_" : ["%n inivitado","%n inivitados"],
"You attended a call with {user1} and {user2}" : "Tuviste una llamada con {user1} y {user2}",
"You attended a call with {user1}, {user2} and {user3}" : "Tuviste una llamada con {user1}, {user2} y {user3}",
"You attended a call with {user1}, {user2}, {user3} and {user4}" : "Tuviste una llamada con {user1}, {user2}, {user3} y {user4}",
"You attended a call with {user1}, {user2}, {user3}, {user4} and {user5}" : "Tuviste una llamada con {user1}, {user2}, {user3}, {user4} y {user5}",
"_%n other_::_%n others_" : ["%n otro","otros %n"],
"{actor} invited you to {call}" : "{actor} te ha invitado a {call}",
"Talk" : "Hablar",
"Guest" : "Invitado",
"Talk to %s" : "Hablar con %s",
"Join call" : "Unirse a la llamada",
"A group call has started in {call}" : "Una llamada en grupo ha iniciado en {call}",
"Open settings" : "Abrir configuraciones",
"Invalid date, date format must be YYYY-MM-DD" : "La fecha es inválida, por favor sigue el formato AAAA-MM-DD",
"Leave call" : "Dejar la llamada",
"Limit to groups" : "Limitar a grupos",
"Everyone" : "Todos",
"Save changes" : "Guardar cambios",
"Saved!" : "¡Guardado!",
"None" : "Ninguno",
"User" : "Usuario",
"Disabled" : "Deshabilitado",
"Users" : "Usuarios",
"Name" : "Nombre",
"General settings" : "Configuraciones generales",
"Language" : "Idioma",
"Country" : "País",
"Status" : "Estatus",
"Created at" : "Creado en",
"Pending" : "Pendiente",
"Error" : "Error",
"Blocked" : "Bloqueado",
"Shared secret" : "Secreto compartido",
"Validate SSL certificate" : "Validar certificado SSL",
"Saved" : "Guardado",
"STUN servers" : "Servidores STUN",
"A STUN server is used to determine the public IP address of participants behind a router." : "Un servidor STUN se está usando para determinar la IP pública de los participantes que estén detrás de un ruteador. ",
"TURN server protocols" : "Protocolos del servidor TURN",
"Copy link" : "Copiar liga",
"Waiting for others to join the call …" : "Esperando a que los demás se unan a la llamada ...",
"You can invite others in the participant tab of the sidebar" : "Puedes invitar a otras personas en la pestaña de participante del menú lateral",
"Share this link to invite others!" : "¡Comparte esta liga para invitar a otras personas!",
"Dismiss" : "Descartar",
"Show your screen" : "Mostrar tu pantalla",
"Stop screensharing" : "Dejar de compartir la pantalla",
"Mute audio" : "Silenciar audio",
"Disable video" : "Deshabilitar video",
"Enable video" : "Habilitar el video",
"Screensharing options" : "Opciones de compartir pantalla",
"Enable screensharing" : "Habilitar compartir pantalla",
"Grid view" : "Vista de cuadrícula",
"Screensharing requires the page to be loaded through HTTPS." : "Compartir pantalla requiere que la página se cargue a través de HTTPS.",
"Sharing your screen only works with Firefox version 52 or newer." : "Compartir la pantalla sólo funciona con Firefox versión 52 o superior. ",
"Screensharing extension is required to share your screen." : "Se requiere de la extenisón de compartir pantalla para compartir tu pantalla. ",
"Please use a different browser like Firefox or Chrome to share your screen." : "Por favor usa un navegador diferente como Firefox o Chrome para compartir tu pantalla.",
"An error occurred while starting screensharing." : "Se presentó un error al comenzar a compartir la pantalla. ",
"Back" : "Atrás",
"You" : "Tú",
"Show screen" : "Mostrar pantalla",
"Favorite" : "Hacer favorito",
"Password protection" : "Protección con contraseña",
"Enter a password" : "Ingresa una contraseña",
"Save" : "Guardar",
"Edit" : "Editar",
"Password" : "Contraseña",
"API token" : "Ficha del API",
"Login" : "Iniciar sesión",
"Nickname" : "Apodo",
"Client ID" : "ID del cliente",
"Remove from favorites" : "Eliminar de favoritos",
"Add to favorites" : "Agregar a tus favoritos",
"Loading" : "Cargando",
"Groups" : "Grupos",
"Circles" : "Círculos",
"Password protect" : "Proteger con contraseña",
"Close" : "Cerrar",
"Reply" : "Responder",
"Today" : "Hoy",
"Yesterday" : "Ayer",
"moderator" : "moderador",
"Demote from moderator" : "Degradar de moderador",
"Promote to moderator" : "Promover a moderador",
"Remove participant" : "Eliminar participante",
"No results" : "No hay resultados",
"Add users or groups" : "Agregar usuarios o grupos",
"Participants" : "Participantes",
"Chat" : "Chat",
"Settings" : "Configuraciones ",
"Keyboard shortcuts" : "Atajos del teclado",
"Search" : "Buscar",
"Send" : "Enviar",
"Default" : "Predeterminado",
"Access to microphone & camera is only possible with HTTPS" : "El acceso al micrófono & cámara sólo es posible mediante HTTPS",
"Access to microphone & camera was denied" : "El acceso al micrófono & cámara fue denegado",
"WebRTC is not supported in your browser" : "WebRTC no está soportado en tu navegador",
"Please use a different browser like Firefox or Chrome" : "Por favor usa un navegador diferente como Firefox o Chrome",
"Error while accessing microphone & camera" : "Se pressentó un error al acceder al micrófono & cámara",
"The password is wrong. Try again." : "La contraseña está equivoada. Por favor vuelve a intentarlo. ",
"TURN server" : "Servidor TURN",
"The TURN server is used to proxy the traffic from participants behind a firewall." : "El servidor TURN se usa para concentrar el tráfico de participantes detras de un firewall. ",
"An external signaling server can optionally be used for larger installations. Leave empty to use the internal signaling server." : "Un servidor externo de señalización puede ser, opcionalmente, utilizado para instalaciones más grandes. Déjalo vacío para usar el sevidor de señalización interno. ",
"Android app" : "Aplicación android",
"iOS app" : "Aplicación iOS",
"Remove" : "Eliminar"
},
"nplurals=2; plural=(n != 1);");
| nextcloud/spreed | l10n/es_UY.js | JavaScript | agpl-3.0 | 6,423 |
lang['Open'] = 'Obre';
lang['Close'] = 'Tanca';
lang['Save'] = 'Desa';
lang['Save As'] = 'Desa com...'; | jonrandoem/eyeos | eyeos/apps/notepad/lang/ca/ca.js | JavaScript | agpl-3.0 | 103 |
/*
* Copyright (C) 2014 - present Instructure, Inc.
*
* This file is part of Canvas.
*
* Canvas is free software: you can redistribute it and/or modify it under
* the terms of the GNU Affero General Public License as published by the Free
* Software Foundation, version 3 of the License.
*
* Canvas is distributed in the hope that it will be useful, but WITHOUT ANY
* WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR
* A PARTICULAR PURPOSE. See the GNU Affero General Public License for more
* details.
*
* You should have received a copy of the GNU Affero General Public License along
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
import _ from 'underscore'
import I18n from 'i18n!modules'
import React from 'react'
var PostGradesDialogNeedsGradingPage = React.createClass({
onClickRow(assignment_id) {
window.location = "gradebook/speed_grader?assignment_id=" + assignment_id
},
render () {
return (
<div>
<small>
<em className="text-left" style={{color: "#555555"}}>
{I18n.t("NOTE: Students have submitted work for these assignments" +
"that has not been graded. If you post these grades now, you" +
"will need to re-post their scores after grading their" +
"latest submissions.")}
</em>
</small>
<br/><br/>
<table className="ic-Table ic-Table--hover-row ic-Table--condensed">
<tbody>
<thead>
<td>{I18n.t("Assignment Name")}</td>
<td>{I18n.t("Due Date")}</td>
<td>{I18n.t("Ungraded Submissions")}</td>
</thead>
{this.props.needsGrading.map((a) => {
return (
<tr
className="clickable-row"
onClick={this.onClickRow.bind(this, a.id)}
>
<td>{a.name}</td>
<td>{I18n.l('#date.formats.full', a.due_at)}</td>
<td>{a.needs_grading_count}</td>
</tr>
)
})}
</tbody>
</table>
<form className="form-horizontal form-dialog form-inline">
<div className="form-controls">
<button
type="button"
className="btn btn-primary"
onClick={ this.props.leaveNeedsGradingPage }
>
{I18n.t("Continue")} <i className="icon-arrow-right" />
</button>
</div>
</form>
</div>
)
}
})
export default PostGradesDialogNeedsGradingPage
| venturehive/canvas-lms | app/jsx/gradezilla/SISGradePassback/PostGradesDialogNeedsGradingPage.js | JavaScript | agpl-3.0 | 2,722 |
//// [tests/cases/compiler/moduleResolutionWithSymlinks_notInNodeModules.ts] ////
//// [abc.ts]
// When symlinked files are not in node_modules, realpath is not used.
// A symlink file acts like the real thing. So, 2 symlinks act like 2 different files.
// See GH#10364.
export const x = 0;
//// [app.ts]
import { x } from "./shared/abc";
import { x as x2 } from "./shared2/abc";
x + x2;
//// [/src/bin/shared/abc.js]
// When symlinked files are not in node_modules, realpath is not used.
// A symlink file acts like the real thing. So, 2 symlinks act like 2 different files.
// See GH#10364.
"use strict";
exports.__esModule = true;
exports.x = 0;
//// [/src/bin/shared2/abc.js]
// When symlinked files are not in node_modules, realpath is not used.
// A symlink file acts like the real thing. So, 2 symlinks act like 2 different files.
// See GH#10364.
"use strict";
exports.__esModule = true;
exports.x = 0;
//// [/src/bin/app.js]
"use strict";
exports.__esModule = true;
var abc_1 = require("./shared/abc");
var abc_2 = require("./shared2/abc");
abc_1.x + abc_2.x;
| jwbay/TypeScript | tests/baselines/reference/moduleResolutionWithSymlinks_notInNodeModules.js | JavaScript | apache-2.0 | 1,104 |
/**
* Copyright 2013-2020 the original author or authors from the JHipster project.
*
* This file is part of the JHipster project, see https://www.jhipster.tech/
* for more information.
*
* 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.
*/
const chalk = require('chalk');
const constants = require('../generator-constants');
const { clientDefaultConfig } = require('../generator-defaults');
const ANGULAR = constants.SUPPORTED_CLIENT_FRAMEWORKS.ANGULAR;
const REACT = constants.SUPPORTED_CLIENT_FRAMEWORKS.REACT;
const VUE = constants.SUPPORTED_CLIENT_FRAMEWORKS.VUE;
module.exports = {
askForModuleName,
askForClient,
askForClientTheme,
askForClientThemeVariant,
};
function askForModuleName() {
if (this.jhipsterConfig.baseName) return undefined;
return this.askModuleName(this);
}
function askForClient() {
if (this.existingProject) return true;
const applicationType = this.applicationType;
const choices = [
{
value: ANGULAR,
name: 'Angular',
},
{
value: REACT,
name: 'React',
},
{
value: VUE,
name: 'Vue',
},
{
value: 'no',
name: 'No client',
},
];
const PROMPT = {
type: 'list',
name: 'clientFramework',
when: response => applicationType !== 'microservice' && applicationType !== 'uaa',
message: `Which ${chalk.yellow('*Framework*')} would you like to use for the client?`,
choices,
default: clientDefaultConfig.clientFramework,
};
return this.prompt(PROMPT).then(prompt => {
this.clientFramework = this.jhipsterConfig.clientFramework = prompt.clientFramework;
if (this.clientFramework === 'no') {
this.skipClient = this.jhipsterConfig.skipClient = true;
}
});
}
function askForClientTheme() {
if (this.existingProject) {
return;
}
const skipClient = this.skipClient;
const defaultChoices = [
{
value: 'none',
name: 'Default JHipster',
},
{ value: 'cerulean', name: 'Cerulean' },
{ value: 'cosmo', name: 'Cosmo' },
{ value: 'cerulean', name: 'Cyborg' },
{ value: 'darkly', name: 'Darkly' },
{ value: 'flatly', name: 'Flatly' },
{ value: 'journal', name: 'Journal' },
{ value: 'litera', name: 'Litera' },
{ value: 'lumen', name: 'Lumen' },
{ value: 'lux', name: 'Lux' },
{ value: 'materia', name: 'Materia' },
{ value: 'minty', name: 'Minty' },
{ value: 'pulse', name: 'Pulse' },
{ value: 'sandstone', name: 'Sandstone' },
{ value: 'simplex', name: 'Simplex' },
{ value: 'sketchy', name: 'Sketchy' },
{ value: 'slate', name: 'Slate' },
{ value: 'solar', name: 'Solar' },
{ value: 'spacelab', name: 'Spacelab' },
{ value: 'superhero', name: 'Superhero' },
{ value: 'united', name: 'United' },
{ value: 'yeti', name: 'Yeti' },
];
const PROMPT = {
type: 'list',
name: 'clientTheme',
when: () => !skipClient,
message: 'Would you like to use a Bootswatch theme (https://bootswatch.com/)?',
choices: defaultChoices,
default: clientDefaultConfig.clientTheme,
};
const self = this;
const promptClientTheme = function (PROMPT) {
return self.prompt(PROMPT).then(prompt => {
self.clientTheme = self.jhipsterConfig.clientTheme = prompt.clientTheme;
});
};
const done = this.async();
this.httpsGet(
'https://bootswatch.com/api/4.json',
// eslint-disable-next-line consistent-return
body => {
try {
const { themes } = JSON.parse(body);
PROMPT.choices = [
{
value: 'none',
name: 'Default JHipster',
},
...themes.map(theme => ({
value: theme.name.toLowerCase(),
name: theme.name,
})),
];
} catch (err) {
this.warning('Could not fetch bootswatch themes from API. Using default ones.');
}
done(undefined, promptClientTheme(PROMPT));
},
() => {
this.warning('Could not fetch bootswatch themes from API. Using default ones.');
done(undefined, promptClientTheme(PROMPT));
}
);
}
function askForClientThemeVariant() {
if (this.existingProject) {
return undefined;
}
if (this.clientTheme === 'none') {
this.clientThemeVariant = '';
return undefined;
}
const skipClient = this.skipClient;
const choices = [
{ value: 'primary', name: 'Primary' },
{ value: 'dark', name: 'Dark' },
{ value: 'light', name: 'Light' },
];
const PROMPT = {
type: 'list',
name: 'clientThemeVariant',
when: () => !skipClient,
message: 'Choose a Bootswatch variant navbar theme (https://bootswatch.com/)?',
choices,
default: clientDefaultConfig.clientThemeVariant,
};
return this.prompt(PROMPT).then(prompt => {
this.clientThemeVariant = this.jhipsterConfig.clientThemeVariant = prompt.clientThemeVariant;
});
}
| cbornet/generator-jhipster | generators/client/prompts.js | JavaScript | apache-2.0 | 5,953 |
define(
"dojo/cldr/nls/bs/gregorian", //begin v1.x content
{
"dateFormatItem-yM": "MM.y.",
"field-dayperiod": "pre podne/ popodne",
"dayPeriods-format-wide-pm": "popodne",
"field-minute": "minut",
"eraNames": [
"Pre nove ere",
"Nove ere"
],
"dateFormatItem-MMMEd": "E, dd. MMM",
"field-day-relative+-1": "juče",
"field-weekday": "dan u nedelji",
"dateFormatItem-hms": "hh:mm:ss a",
"dateFormatItem-yQQQ": "y QQQ",
"field-day-relative+-2": "prekjuče",
"days-standAlone-wide": [
"nedjelja",
"ponedjeljak",
"utorak",
"srijeda",
"četvrtak",
"petak",
"subota"
],
"dateFormatItem-MMM": "LLL",
"months-standAlone-narrow": [
"j",
"f",
"m",
"a",
"m",
"j",
"j",
"a",
"s",
"o",
"n",
"d"
],
"field-era": "era",
"dateFormatItem-Gy": "y. G",
"field-hour": "čas",
"dayPeriods-format-wide-am": "pre podne",
"quarters-standAlone-abbr": [
"K1",
"K2",
"K3",
"K4"
],
"dateFormatItem-y": "y.",
"timeFormat-full": "HH:mm:ss zzzz",
"months-standAlone-abbr": [
"jan",
"feb",
"mar",
"apr",
"maj",
"jun",
"jul",
"avg",
"sep",
"okt",
"nov",
"dec"
],
"dateFormatItem-Ed": "E, dd.",
"dateFormatItem-yMMM": "MMM y.",
"field-day-relative+0": "danas",
"field-day-relative+1": "sutra",
"eraAbbr": [
"p. n. e.",
"n. e"
],
"field-day-relative+2": "prekosutra",
"dateFormatItem-GyMMMd": "dd. MMM y. G",
"dateFormat-long": "dd. MMMM y.",
"timeFormat-medium": "HH:mm:ss",
"field-zone": "zona",
"dateFormatItem-Hm": "HH:mm",
"dateFormat-medium": "dd.MM.y.",
"dateFormatItem-Hms": "HH:mm:ss",
"dateFormatItem-yMd": "dd.MM.y.",
"quarters-standAlone-wide": [
"Prvi kvartal",
"Drugi kvartal",
"Treći kvartal",
"Četvrti kvartal"
],
"dateFormatItem-ms": "mm:ss",
"field-year": "godina",
"field-week": "nedelja",
"months-standAlone-wide": [
"januar",
"februar",
"mart",
"april",
"maj",
"juni",
"juli",
"avgust",
"septembar",
"oktobar",
"novembar",
"decembar"
],
"dateFormatItem-MMMd": "dd. MMM",
"timeFormat-long": "HH:mm:ss z",
"months-format-abbr": [
"jan",
"feb",
"mar",
"apr",
"maj",
"jun",
"jul",
"avg",
"sep",
"okt",
"nov",
"dec"
],
"dateFormatItem-yQQQQ": "y QQQQ",
"timeFormat-short": "HH:mm",
"field-month": "mesec",
"quarters-format-abbr": [
"K1",
"K2",
"K3",
"K4"
],
"days-format-abbr": [
"ned",
"pon",
"uto",
"sri",
"čet",
"pet",
"sub"
],
"dateFormatItem-M": "L",
"dateFormatItem-yMMMd": "dd. MMM y.",
"field-second": "sekund",
"dateFormatItem-GyMMMEd": "E, dd. MMM y. G",
"dateFormatItem-GyMMM": "MMM y. G",
"field-day": "dan",
"dateFormatItem-MEd": "E, dd.MM.",
"months-format-narrow": [
"j",
"f",
"m",
"a",
"m",
"j",
"j",
"a",
"s",
"o",
"n",
"d"
],
"days-standAlone-short": [
"ned",
"pon",
"uto",
"sri",
"čet",
"pet",
"sub"
],
"dateFormatItem-hm": "hh:mm a",
"days-standAlone-abbr": [
"ned",
"pon",
"uto",
"sri",
"čet",
"pet",
"sub"
],
"dateFormat-short": "dd.MM.yy.",
"dateFormatItem-yMMMEd": "E, dd. MMM y.",
"dateFormat-full": "EEEE, dd. MMMM y.",
"dateFormatItem-Md": "dd.MM.",
"dateFormatItem-yMEd": "E, dd.MM.y.",
"months-format-wide": [
"januar",
"februar",
"mart",
"april",
"maj",
"juni",
"juli",
"avgust",
"septembar",
"oktobar",
"novembar",
"decembar"
],
"days-format-short": [
"ned",
"pon",
"uto",
"sri",
"čet",
"pet",
"sub"
],
"dateFormatItem-d": "d",
"quarters-format-wide": [
"Prvi kvartal",
"Drugi kvartal",
"Treći kvartal",
"Četvrti kvartal"
],
"days-format-wide": [
"nedjelja",
"ponedjeljak",
"utorak",
"srijeda",
"četvrtak",
"petak",
"subota"
],
"eraNarrow": [
"p. n. e.",
"n. e"
]
}
//end v1.x content
); | Caspar12/zh.sw | zh.web.site.admin/src/main/resources/static/js/dojo/dojo/cldr/nls/bs/gregorian.js.uncompressed.js | JavaScript | apache-2.0 | 3,767 |
/**
* @license
* Copyright Google Inc. All Rights Reserved.
*
* Use of this source code is governed by an MIT-style license that can be
* found in the LICENSE file at https://angular.io/license
*/
// THIS CODE IS GENERATED - DO NOT MODIFY
// See angular/tools/gulp-tasks/cldr/extract.js
export default [
[
['mi', 'n', 'in the morning', 'in the afternoon', 'in the evening', 'at night'],
['midnight', 'noon', 'in the morning', 'in the afternoon', 'in the evening', 'at night'],
],
[
['midnight', 'noon', 'morning', 'afternoon', 'evening', 'night'],
,
],
[
'00:00', '12:00', ['06:00', '12:00'], ['12:00', '18:00'], ['18:00', '21:00'],
['21:00', '06:00']
]
];
//# sourceMappingURL=en-SX.js.map | N03297857/2017Fall | node_modules/@angular/common/locales/extra/en-SX.js | JavaScript | apache-2.0 | 768 |
/*!
* Module dependencies.
*/
var readPref = require('./drivers').ReadPreference
, EventEmitter = require('events').EventEmitter
, VirtualType = require('./virtualtype')
, utils = require('./utils')
, MongooseTypes
, Kareem = require('kareem')
, async = require('async')
, PromiseProvider = require('./promise_provider');
var IS_QUERY_HOOK = {
count: true,
find: true,
findOne: true,
findOneAndUpdate: true,
findOneAndRemove: true,
update: true
};
/**
* Schema constructor.
*
* ####Example:
*
* var child = new Schema({ name: String });
* var schema = new Schema({ name: String, age: Number, children: [child] });
* var Tree = mongoose.model('Tree', schema);
*
* // setting schema options
* new Schema({ name: String }, { _id: false, autoIndex: false })
*
* ####Options:
*
* - [autoIndex](/docs/guide.html#autoIndex): bool - defaults to null (which means use the connection's autoIndex option)
* - [bufferCommands](/docs/guide.html#bufferCommands): bool - defaults to true
* - [capped](/docs/guide.html#capped): bool - defaults to false
* - [collection](/docs/guide.html#collection): string - no default
* - [id](/docs/guide.html#id): bool - defaults to true
* - [_id](/docs/guide.html#_id): bool - defaults to true
* - `minimize`: bool - controls [document#toObject](#document_Document-toObject) behavior when called manually - defaults to true
* - [read](/docs/guide.html#read): string
* - [safe](/docs/guide.html#safe): bool - defaults to true.
* - [shardKey](/docs/guide.html#shardKey): bool - defaults to `null`
* - [strict](/docs/guide.html#strict): bool - defaults to true
* - [toJSON](/docs/guide.html#toJSON) - object - no default
* - [toObject](/docs/guide.html#toObject) - object - no default
* - [validateBeforeSave](/docs/guide.html#validateBeforeSave) - bool - defaults to `true`
* - [versionKey](/docs/guide.html#versionKey): bool - defaults to "__v"
*
* ####Note:
*
* _When nesting schemas, (`children` in the example above), always declare the child schema first before passing it into its parent._
*
* @param {Object} definition
* @inherits NodeJS EventEmitter http://nodejs.org/api/events.html#events_class_events_eventemitter
* @event `init`: Emitted after the schema is compiled into a `Model`.
* @api public
*/
function Schema (obj, options) {
if (!(this instanceof Schema))
return new Schema(obj, options);
this.paths = {};
this.subpaths = {};
this.virtuals = {};
this.nested = {};
this.inherits = {};
this.callQueue = [];
this._indexes = [];
this.methods = {};
this.statics = {};
this.tree = {};
this._requiredpaths = undefined;
this.discriminatorMapping = undefined;
this._indexedpaths = undefined;
this.s = {
hooks: new Kareem(),
queryHooks: IS_QUERY_HOOK
};
this.options = this.defaultOptions(options);
// build paths
if (obj) {
this.add(obj);
}
// check if _id's value is a subdocument (gh-2276)
var _idSubDoc = obj && obj._id && utils.isObject(obj._id);
// ensure the documents get an auto _id unless disabled
var auto_id = !this.paths['_id'] && (!this.options.noId && this.options._id) && !_idSubDoc;
if (auto_id) {
this.add({ _id: {type: Schema.ObjectId, auto: true} });
}
// ensure the documents receive an id getter unless disabled
var autoid = !this.paths['id'] && (!this.options.noVirtualId && this.options.id);
if (autoid) {
this.virtual('id').get(idGetter);
}
for (var i = 0; i < this._defaultMiddleware.length; ++i) {
var m = this._defaultMiddleware[i];
this[m.kind](m.hook, !!m.isAsync, m.fn);
}
// adds updatedAt and createdAt timestamps to documents if enabled
var timestamps = this.options.timestamps;
if (timestamps) {
var createdAt = timestamps.createdAt || 'createdAt'
, updatedAt = timestamps.updatedAt || 'updatedAt'
, schemaAdditions = {};
schemaAdditions[updatedAt] = Date;
if (!this.paths[createdAt]) {
schemaAdditions[createdAt] = Date;
}
this.add(schemaAdditions);
this.pre('save', function (next) {
var defaultTimestamp = new Date();
if (!this[createdAt]){
this[createdAt] = auto_id ? this._id.getTimestamp() : defaultTimestamp;
}
this[updatedAt] = this.isNew ? this[createdAt] : defaultTimestamp;
next();
});
}
}
/*!
* Returns this documents _id cast to a string.
*/
function idGetter () {
if (this.$__._id) {
return this.$__._id;
}
return this.$__._id = null == this._id
? null
: String(this._id);
}
/*!
* Inherit from EventEmitter.
*/
Schema.prototype = Object.create( EventEmitter.prototype );
Schema.prototype.constructor = Schema;
/**
* Default middleware attached to a schema. Cannot be changed.
*
* This field is used to make sure discriminators don't get multiple copies of
* built-in middleware. Declared as a constant because changing this at runtime
* may lead to instability with Model.prototype.discriminator().
*
* @api private
* @property _defaultMiddleware
*/
Object.defineProperty(Schema.prototype, '_defaultMiddleware', {
configurable: false,
enumerable: false,
writable: false,
value: [{
kind: 'pre',
hook: 'save',
fn: function(next) {
// Nested docs have their own presave
if (this.ownerDocument) {
return next();
}
// Validate
if (this.schema.options.validateBeforeSave) {
this.validate().then(next, next);
} else {
next();
}
}
}, {
kind: 'pre',
hook: 'save',
isAsync: true,
fn: function(next, done) {
var Promise = PromiseProvider.get(),
subdocs = this.$__getAllSubdocs(),
_this = this;
// Calling `save` on a nested subdoc calls `save` with
// the scope of its direct parent. That means in the
// case of a nested subdoc, `subdocs` here will include
// this subdoc itself leading to an infinite loop.
subdocs = subdocs.filter(function(subdoc) {
return !subdoc.$__preSavingFromParent;
});
if (!subdocs.length) {
done();
next();
return;
}
new Promise.ES6(function(resolve, reject) {
async.each(subdocs, function(subdoc, cb) {
subdoc.$__preSavingFromParent = true;
subdoc.save(function(err) {
delete subdoc.$__preSavingFromParent;
cb(err);
});
}, function(error) {
if (error) {
reject(error);
return;
}
resolve();
});
}).then(function() {
next();
done();
}, done);
}
}]
});
/**
* Schema as flat paths
*
* ####Example:
* {
* '_id' : SchemaType,
* , 'nested.key' : SchemaType,
* }
*
* @api private
* @property paths
*/
Schema.prototype.paths;
/**
* Schema as a tree
*
* ####Example:
* {
* '_id' : ObjectId
* , 'nested' : {
* 'key' : String
* }
* }
*
* @api private
* @property tree
*/
Schema.prototype.tree;
/**
* Returns default options for this schema, merged with `options`.
*
* @param {Object} options
* @return {Object}
* @api private
*/
Schema.prototype.defaultOptions = function (options) {
if (options && false === options.safe) {
options.safe = { w: 0 };
}
if (options && options.safe && 0 === options.safe.w) {
// if you turn off safe writes, then versioning goes off as well
options.versionKey = false;
}
options = utils.options({
strict: true
, bufferCommands: true
, capped: false // { size, max, autoIndexId }
, versionKey: '__v'
, discriminatorKey: '__t'
, minimize: true
, autoIndex: null
, shardKey: null
, read: null
, validateBeforeSave: true
// the following are only applied at construction time
, noId: false // deprecated, use { _id: false }
, _id: true
, noVirtualId: false // deprecated, use { id: false }
, id: true
// , pluralization: true // only set this to override the global option
}, options);
if (options.read) {
options.read = readPref(options.read);
}
return options;
}
/**
* Adds key path / schema type pairs to this schema.
*
* ####Example:
*
* var ToySchema = new Schema;
* ToySchema.add({ name: 'string', color: 'string', price: 'number' });
*
* @param {Object} obj
* @param {String} prefix
* @api public
*/
Schema.prototype.add = function add (obj, prefix) {
prefix = prefix || '';
var keys = Object.keys(obj);
for (var i = 0; i < keys.length; ++i) {
var key = keys[i];
if (null == obj[key]) {
throw new TypeError('Invalid value for schema path `'+ prefix + key +'`');
}
if (Array.isArray(obj[key]) && obj[key].length === 1 && null == obj[key][0]) {
throw new TypeError('Invalid value for schema Array path `'+ prefix + key +'`');
}
if (utils.isObject(obj[key]) && (!obj[key].constructor || 'Object' == utils.getFunctionName(obj[key].constructor)) && (!obj[key].type || obj[key].type.type)) {
if (Object.keys(obj[key]).length) {
// nested object { last: { name: String }}
this.nested[prefix + key] = true;
this.add(obj[key], prefix + key + '.');
} else {
this.path(prefix + key, obj[key]); // mixed type
}
} else {
this.path(prefix + key, obj[key]);
}
}
};
/**
* Reserved document keys.
*
* Keys in this object are names that are rejected in schema declarations b/c they conflict with mongoose functionality. Using these key name will throw an error.
*
* on, emit, _events, db, get, set, init, isNew, errors, schema, options, modelName, collection, _pres, _posts, toObject
*
* _NOTE:_ Use of these terms as method names is permitted, but play at your own risk, as they may be existing mongoose document methods you are stomping on.
*
* var schema = new Schema(..);
* schema.methods.init = function () {} // potentially breaking
*/
Schema.reserved = Object.create(null);
var reserved = Schema.reserved;
// EventEmitter
reserved.emit =
reserved.on =
reserved.once =
// document properties and functions
reserved.collection =
reserved.db =
reserved.errors =
reserved.init =
reserved.isModified =
reserved.isNew =
reserved.get =
reserved.modelName =
reserved.save =
reserved.schema =
reserved.set =
reserved.toObject =
reserved.validate =
// hooks.js
reserved._pres = reserved._posts = 1;
/**
* Document keys to print warnings for
*/
var warnings = {};
warnings.increment = '`increment` should not be used as a schema path name ' +
'unless you have disabled versioning.';
/**
* Gets/sets schema paths.
*
* Sets a path (if arity 2)
* Gets a path (if arity 1)
*
* ####Example
*
* schema.path('name') // returns a SchemaType
* schema.path('name', Number) // changes the schemaType of `name` to Number
*
* @param {String} path
* @param {Object} constructor
* @api public
*/
Schema.prototype.path = function (path, obj) {
if (obj == undefined) {
if (this.paths[path]) return this.paths[path];
if (this.subpaths[path]) return this.subpaths[path];
// subpaths?
return /\.\d+\.?.*$/.test(path)
? getPositionalPath(this, path)
: undefined;
}
// some path names conflict with document methods
if (reserved[path]) {
throw new Error("`" + path + "` may not be used as a schema pathname");
}
if (warnings[path]) {
console.log('WARN: ' + warnings[path]);
}
// update the tree
var subpaths = path.split(/\./)
, last = subpaths.pop()
, branch = this.tree;
subpaths.forEach(function(sub, i) {
if (!branch[sub]) branch[sub] = {};
if ('object' != typeof branch[sub]) {
var msg = 'Cannot set nested path `' + path + '`. '
+ 'Parent path `'
+ subpaths.slice(0, i).concat([sub]).join('.')
+ '` already set to type ' + branch[sub].name
+ '.';
throw new Error(msg);
}
branch = branch[sub];
});
branch[last] = utils.clone(obj);
this.paths[path] = Schema.interpretAsType(path, obj);
return this;
};
/**
* Converts type arguments into Mongoose Types.
*
* @param {String} path
* @param {Object} obj constructor
* @api private
*/
Schema.interpretAsType = function (path, obj) {
if (obj.constructor) {
var constructorName = utils.getFunctionName(obj.constructor);
if (constructorName != 'Object') {
obj = { type: obj };
}
}
// Get the type making sure to allow keys named "type"
// and default to mixed if not specified.
// { type: { type: String, default: 'freshcut' } }
var type = obj.type && !obj.type.type
? obj.type
: {};
if ('Object' == utils.getFunctionName(type.constructor) || 'mixed' == type) {
return new MongooseTypes.Mixed(path, obj);
}
if (Array.isArray(type) || Array == type || 'array' == type) {
// if it was specified through { type } look for `cast`
var cast = (Array == type || 'array' == type)
? obj.cast
: type[0];
if (cast instanceof Schema) {
return new MongooseTypes.DocumentArray(path, cast, obj);
}
if ('string' == typeof cast) {
cast = MongooseTypes[cast.charAt(0).toUpperCase() + cast.substring(1)];
} else if (cast && (!cast.type || cast.type.type)
&& 'Object' == utils.getFunctionName(cast.constructor)
&& Object.keys(cast).length) {
return new MongooseTypes.DocumentArray(path, new Schema(cast), obj);
}
return new MongooseTypes.Array(path, cast || MongooseTypes.Mixed, obj);
}
var name;
if (Buffer.isBuffer(type)) {
name = 'Buffer';
} else {
name = 'string' == typeof type
? type
// If not string, `type` is a function. Outside of IE, function.name
// gives you the function name. In IE, you need to compute it
: type.schemaName || utils.getFunctionName(type);
}
if (name) {
name = name.charAt(0).toUpperCase() + name.substring(1);
}
if (undefined == MongooseTypes[name]) {
throw new TypeError('Undefined type `' + name + '` at `' + path +
'`\n Did you try nesting Schemas? ' +
'You can only nest using refs or arrays.');
}
return new MongooseTypes[name](path, obj);
};
/**
* Iterates the schemas paths similar to Array#forEach.
*
* The callback is passed the pathname and schemaType as arguments on each iteration.
*
* @param {Function} fn callback function
* @return {Schema} this
* @api public
*/
Schema.prototype.eachPath = function (fn) {
var keys = Object.keys(this.paths)
, len = keys.length;
for (var i = 0; i < len; ++i) {
fn(keys[i], this.paths[keys[i]]);
}
return this;
};
/**
* Returns an Array of path strings that are required by this schema.
*
* @api public
* @return {Array}
*/
Schema.prototype.requiredPaths = function requiredPaths () {
if (this._requiredpaths) return this._requiredpaths;
var paths = Object.keys(this.paths)
, i = paths.length
, ret = [];
while (i--) {
var path = paths[i];
if (this.paths[path].isRequired) ret.push(path);
}
return this._requiredpaths = ret;
}
/**
* Returns indexes from fields and schema-level indexes (cached).
*
* @api private
* @return {Array}
*/
Schema.prototype.indexedPaths = function indexedPaths () {
if (this._indexedpaths) return this._indexedpaths;
return this._indexedpaths = this.indexes();
}
/**
* Returns the pathType of `path` for this schema.
*
* Given a path, returns whether it is a real, virtual, nested, or ad-hoc/undefined path.
*
* @param {String} path
* @return {String}
* @api public
*/
Schema.prototype.pathType = function (path) {
if (path in this.paths) return 'real';
if (path in this.virtuals) return 'virtual';
if (path in this.nested) return 'nested';
if (path in this.subpaths) return 'real';
if (/\.\d+\.|\.\d+$/.test(path) && getPositionalPath(this, path)) {
return 'real';
} else {
return 'adhocOrUndefined'
}
};
/*!
* ignore
*/
function getPositionalPath (self, path) {
var subpaths = path.split(/\.(\d+)\.|\.(\d+)$/).filter(Boolean);
if (subpaths.length < 2) {
return self.paths[subpaths[0]];
}
var val = self.path(subpaths[0]);
if (!val) return val;
var last = subpaths.length - 1
, subpath
, i = 1;
for (; i < subpaths.length; ++i) {
subpath = subpaths[i];
if (i === last && val && !val.schema && !/\D/.test(subpath)) {
if (val instanceof MongooseTypes.Array) {
// StringSchema, NumberSchema, etc
val = val.caster;
} else {
val = undefined;
}
break;
}
// ignore if its just a position segment: path.0.subpath
if (!/\D/.test(subpath)) continue;
if (!(val && val.schema)) {
val = undefined;
break;
}
val = val.schema.path(subpath);
}
return self.subpaths[path] = val;
}
/**
* Adds a method call to the queue.
*
* @param {String} name name of the document method to call later
* @param {Array} args arguments to pass to the method
* @api public
*/
Schema.prototype.queue = function(name, args){
this.callQueue.push([name, args]);
return this;
};
/**
* Defines a pre hook for the document.
*
* ####Example
*
* var toySchema = new Schema(..);
*
* toySchema.pre('save', function (next) {
* if (!this.created) this.created = new Date;
* next();
* })
*
* toySchema.pre('validate', function (next) {
* if (this.name != 'Woody') this.name = 'Woody';
* next();
* })
*
* @param {String} method
* @param {Function} callback
* @see hooks.js https://github.com/bnoguchi/hooks-js/tree/31ec571cef0332e21121ee7157e0cf9728572cc3
* @api public
*/
Schema.prototype.pre = function() {
var name = arguments[0];
if (IS_QUERY_HOOK[name]) {
this.s.hooks.pre.apply(this.s.hooks, arguments);
return this;
}
return this.queue('pre', arguments);
};
/**
* Defines a post hook for the document
*
* Post hooks fire `on` the event emitted from document instances of Models compiled from this schema.
*
* var schema = new Schema(..);
* schema.post('save', function (doc) {
* console.log('this fired after a document was saved');
* });
*
* var Model = mongoose.model('Model', schema);
*
* var m = new Model(..);
* m.save(function (err) {
* console.log('this fires after the `post` hook');
* });
*
* @param {String} method name of the method to hook
* @param {Function} fn callback
* @see hooks.js https://github.com/bnoguchi/hooks-js/tree/31ec571cef0332e21121ee7157e0cf9728572cc3
* @api public
*/
Schema.prototype.post = function(method, fn) {
if (IS_QUERY_HOOK[method]) {
this.s.hooks.post.apply(this.s.hooks, arguments);
return this;
}
// assuming that all callbacks with arity < 2 are synchronous post hooks
if (fn.length < 2) {
return this.queue('on', [arguments[0], function(doc) {
return fn.call(doc, doc);
}]);
}
return this.queue('post', [arguments[0], function(next){
// wrap original function so that the callback goes last,
// for compatibility with old code that is using synchronous post hooks
var self = this;
fn.call(this, this, function(err, result) {
return next(err, result || self);
});
}]);
};
/**
* Registers a plugin for this schema.
*
* @param {Function} plugin callback
* @param {Object} [opts]
* @see plugins
* @api public
*/
Schema.prototype.plugin = function (fn, opts) {
fn(this, opts);
return this;
};
/**
* Adds an instance method to documents constructed from Models compiled from this schema.
*
* ####Example
*
* var schema = kittySchema = new Schema(..);
*
* schema.method('meow', function () {
* console.log('meeeeeoooooooooooow');
* })
*
* var Kitty = mongoose.model('Kitty', schema);
*
* var fizz = new Kitty;
* fizz.meow(); // meeeeeooooooooooooow
*
* If a hash of name/fn pairs is passed as the only argument, each name/fn pair will be added as methods.
*
* schema.method({
* purr: function () {}
* , scratch: function () {}
* });
*
* // later
* fizz.purr();
* fizz.scratch();
*
* @param {String|Object} method name
* @param {Function} [fn]
* @api public
*/
Schema.prototype.method = function (name, fn) {
if ('string' != typeof name)
for (var i in name)
this.methods[i] = name[i];
else
this.methods[name] = fn;
return this;
};
/**
* Adds static "class" methods to Models compiled from this schema.
*
* ####Example
*
* var schema = new Schema(..);
* schema.static('findByName', function (name, callback) {
* return this.find({ name: name }, callback);
* });
*
* var Drink = mongoose.model('Drink', schema);
* Drink.findByName('sanpellegrino', function (err, drinks) {
* //
* });
*
* If a hash of name/fn pairs is passed as the only argument, each name/fn pair will be added as statics.
*
* @param {String} name
* @param {Function} fn
* @api public
*/
Schema.prototype.static = function(name, fn) {
if ('string' != typeof name)
for (var i in name)
this.statics[i] = name[i];
else
this.statics[name] = fn;
return this;
};
/**
* Defines an index (most likely compound) for this schema.
*
* ####Example
*
* schema.index({ first: 1, last: -1 })
*
* @param {Object} fields
* @param {Object} [options]
* @api public
*/
Schema.prototype.index = function (fields, options) {
options || (options = {});
if (options.expires)
utils.expires(options);
this._indexes.push([fields, options]);
return this;
};
/**
* Sets/gets a schema option.
*
* @param {String} key option name
* @param {Object} [value] if not passed, the current option value is returned
* @api public
*/
Schema.prototype.set = function (key, value, _tags) {
if (1 === arguments.length) {
return this.options[key];
}
switch (key) {
case 'read':
this.options[key] = readPref(value, _tags);
break;
case 'safe':
this.options[key] = false === value
? { w: 0 }
: value
break;
default:
this.options[key] = value;
}
return this;
}
/**
* Gets a schema option.
*
* @param {String} key option name
* @api public
*/
Schema.prototype.get = function (key) {
return this.options[key];
}
/**
* The allowed index types
*
* @static indexTypes
* @receiver Schema
* @api public
*/
var indexTypes = '2d 2dsphere hashed text'.split(' ');
Object.defineProperty(Schema, 'indexTypes', {
get: function () { return indexTypes }
, set: function () { throw new Error('Cannot overwrite Schema.indexTypes') }
})
/**
* Compiles indexes from fields and schema-level indexes
*
* @api public
*/
Schema.prototype.indexes = function () {
'use strict';
var indexes = [];
var seenPrefix = {};
var collectIndexes = function(schema, prefix) {
if (seenPrefix[prefix]) {
return;
}
seenPrefix[prefix] = true;
prefix = prefix || '';
var key, path, index, field, isObject, options, type;
var keys = Object.keys(schema.paths);
for (var i = 0; i < keys.length; ++i) {
key = keys[i];
path = schema.paths[key];
if (path instanceof MongooseTypes.DocumentArray) {
collectIndexes(path.schema, key + '.');
} else {
index = path._index;
if (false !== index && null != index) {
field = {};
isObject = utils.isObject(index);
options = isObject ? index : {};
type = 'string' == typeof index ? index :
isObject ? index.type :
false;
if (type && ~Schema.indexTypes.indexOf(type)) {
field[prefix + key] = type;
} else {
field[prefix + key] = 1;
}
delete options.type;
if (!('background' in options)) {
options.background = true;
}
indexes.push([field, options]);
}
}
}
if (prefix) {
fixSubIndexPaths(schema, prefix);
} else {
schema._indexes.forEach(function (index) {
if (!('background' in index[1])) index[1].background = true;
});
indexes = indexes.concat(schema._indexes);
}
};
collectIndexes(this);
return indexes;
/*!
* Checks for indexes added to subdocs using Schema.index().
* These indexes need their paths prefixed properly.
*
* schema._indexes = [ [indexObj, options], [indexObj, options] ..]
*/
function fixSubIndexPaths (schema, prefix) {
var subindexes = schema._indexes
, len = subindexes.length
, indexObj
, newindex
, klen
, keys
, key
, i = 0
, j
for (i = 0; i < len; ++i) {
indexObj = subindexes[i][0];
keys = Object.keys(indexObj);
klen = keys.length;
newindex = {};
// use forward iteration, order matters
for (j = 0; j < klen; ++j) {
key = keys[j];
newindex[prefix + key] = indexObj[key];
}
indexes.push([newindex, subindexes[i][1]]);
}
}
}
/**
* Creates a virtual type with the given name.
*
* @param {String} name
* @param {Object} [options]
* @return {VirtualType}
*/
Schema.prototype.virtual = function (name, options) {
var virtuals = this.virtuals;
var parts = name.split('.');
return virtuals[name] = parts.reduce(function (mem, part, i) {
mem[part] || (mem[part] = (i === parts.length-1)
? new VirtualType(options, name)
: {});
return mem[part];
}, this.tree);
};
/**
* Returns the virtual type with the given `name`.
*
* @param {String} name
* @return {VirtualType}
*/
Schema.prototype.virtualpath = function (name) {
return this.virtuals[name];
};
/**
* Removes the given `path` (or [`paths`]).
*
* @param {String|Array} path
*
* @api public
*/
Schema.prototype.remove = function(path) {
if (typeof path === 'string') {
path = [path];
}
if (Array.isArray(path)) {
path.forEach(function(name) {
if (this.path(name)) {
delete this.paths[name];
}
}, this);
}
}
/*!
* Module exports.
*/
module.exports = exports = Schema;
// require down here because of reference issues
/**
* The various built-in Mongoose Schema Types.
*
* ####Example:
*
* var mongoose = require('mongoose');
* var ObjectId = mongoose.Schema.Types.ObjectId;
*
* ####Types:
*
* - [String](#schema-string-js)
* - [Number](#schema-number-js)
* - [Boolean](#schema-boolean-js) | Bool
* - [Array](#schema-array-js)
* - [Buffer](#schema-buffer-js)
* - [Date](#schema-date-js)
* - [ObjectId](#schema-objectid-js) | Oid
* - [Mixed](#schema-mixed-js)
*
* Using this exposed access to the `Mixed` SchemaType, we can use them in our schema.
*
* var Mixed = mongoose.Schema.Types.Mixed;
* new mongoose.Schema({ _user: Mixed })
*
* @api public
*/
Schema.Types = MongooseTypes = require('./schema/index');
/*!
* ignore
*/
var ObjectId = exports.ObjectId = MongooseTypes.ObjectId;
| giblets2570/turinglab | node_modules/mongoose/lib/schema.js | JavaScript | apache-2.0 | 27,195 |
/*
* 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.
*/
/**
* This module is imported by echarts directly.
*
* Notice:
* Always keep this file exists for backward compatibility.
* Because before 4.1.0, dataset is an optional component,
* some users may import this module manually.
*/
import ComponentModel from '../model/Component';
import ComponentView from '../view/Component';
import {detectSourceFormat} from '../data/helper/sourceHelper';
import {SERIES_LAYOUT_BY_COLUMN} from '../data/helper/sourceType';
ComponentModel.extend({
type: 'dataset',
/**
* @protected
*/
defaultOption: {
// 'row', 'column'
seriesLayoutBy: SERIES_LAYOUT_BY_COLUMN,
// null/'auto': auto detect header, see "module:echarts/data/helper/sourceHelper"
sourceHeader: null,
dimensions: null,
source: null
},
optionUpdated: function () {
detectSourceFormat(this);
}
});
ComponentView.extend({
type: 'dataset'
});
| 100star/echarts | src/component/dataset.js | JavaScript | apache-2.0 | 1,740 |
// Copyright 2011, Google Inc. 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.
/**
* @author api.anash@gmail.com (Anash P. Oommen)
*/
/**
* @fileoverview Defines DeleteAd, a code example that deletes an ad using the
* 'REMOVE' operator.
*/
goog.provide('google.ads.adwords.examples.v201101.DeleteAd');
goog.require('google.ads.adwords.AdWordsService.v201101');
goog.require('google.ads.adwords.examples.ExampleBase');
goog.require('google.ads.adwords.v201101.AdGroupAd');
goog.require('google.ads.adwords.v201101.AdGroupAdOperation');
goog.require('google.ads.adwords.v201101.AdGroupAdService');
goog.require('google.ads.adwords.v201101.Operator');
goog.require('google.ads.adwords.v201101.TextAd');
/**
* This code example deletes an ad using the 'REMOVE' operator. To get ads,
* run GetAllAds.js.
*
* Tags: AdGroupAdService.mutate
*
* @extends google.ads.adwords.examples.ExampleBase
* @constructor
*/
google.ads.adwords.examples.v201101.DeleteAd = function() {
google.ads.adwords.examples.ExampleBase.call(this);
this.description = 'This code example deletes an ad using the "REMOVE" ' +
'operator. To get ads, run GetAllAds.js.';
};
goog.inherits(google.ads.adwords.examples.v201101.DeleteAd,
google.ads.adwords.examples.ExampleBase);
/**
* Runs the code example.
*
* @param {google.ads.adwords.AdWordsUser} user AdWords user running the code
* example.
* @param {function} callback the callback method to be called once this example
* is complete.
*/
google.ads.adwords.examples.v201101.DeleteAd.prototype.run =
function(user, callback) {
// Get the AdGroupAdService.
var adGroupAdService = user.getService(
google.ads.adwords.AdWordsService.v201101.AdGroupAdService);
var adGroupId = this._T('INSERT_ADGROUP_ID_HERE');
var adId = this._T('INSERT_AD_ID_HERE');
// Create base class ad to avoid setting type specific fields.
var ad = new google.ads.adwords.v201101.Ad();
ad.id = adId;
// Create ad group ad.
var adGroupAd = new google.ads.adwords.v201101.AdGroupAd();
adGroupAd.adGroupId = adGroupId;
adGroupAd.ad = ad;
// Create operations.
var operation = new google.ads.adwords.v201101.AdGroupAdOperation();
operation.operand = adGroupAd;
operation.operator = google.ads.adwords.v201101.Operator.REMOVE;
try {
// Delete ad.
adGroupAdService.mutate([operation],
goog.bind(function(retval) {
if (retval && retval.value) {
for (var i = 0, len = retval.value.length; i < len; i++) {
var adGroupAdValue = retval.value[i];
this.writeOutput('Ad with id = "%s" and type = "%s" ' +
'was deleted.', adGroupAdValue.ad.id, adGroupAdValue.ad.AdType);
}
}
callback();
}, this),
goog.bind(function(soapException) {
this.writeOutput('Failed to delete ads(s). Soap Fault says "%s"',
soapException.getInnerException().getFaultString());
callback();
}, this)
);
} catch (ex) {
this.writeOutput('An exception occurred while running the code example.');
callback();
}
};
| gileze33/google-api-adwords-js | js/adwordsapi/examples/google/ads/adwords/v201101/DeleteAd.js | JavaScript | apache-2.0 | 3,647 |
const puppeteer = require('puppeteer');
const path = require('path');
const cas = require('../../cas.js');
(async () => {
const browser = await puppeteer.launch(cas.browserOptions());
const page = await cas.newPage(browser);
await cas.uploadSamlMetadata(page, path.join(__dirname, '/saml-md/idp-metadata.xml'));
await page.goto("https://samltest.id/start-idp-test/");
await cas.type(page,'input[name=\'entityID\']', "https://cas.apereo.org/saml/idp");
// await page.waitForTimeout(1000)
await cas.click(page, "input[type='submit']")
await page.waitForNavigation();
await page.waitForTimeout(1000)
await cas.loginWith(page, "casuser", "Mellon");
await cas.removeDirectory(path.join(__dirname, '/saml-md'));
await page.waitForSelector('div.entry-content p', { visible: true });
await cas.assertInnerTextStartsWith(page, "div.entry-content p", "Your browser has completed the full SAML 2.0 round-trip");
await browser.close();
})();
| apereo/cas | ci/tests/puppeteer/scenarios/saml2-idp-simplesign-binding-login/script.js | JavaScript | apache-2.0 | 991 |
import Ember from 'ember';
import FormMixin from 'open-event-frontend/mixins/form';
import { timezones } from 'open-event-frontend/utils/dictionary/date-time';
const { Component, computed, computed: { alias } } = Ember;
export default Component.extend(FormMixin, {
event : alias('data.parentData.event'),
sessionsSpeakers : alias('data.sessionsSpeakers'),
getValidationRules() {
return {
inline : true,
delay : false,
on : 'blur',
fields : {
}
};
},
timezones: computed(function() {
return timezones;
}),
fieldChanged(field) {
if (!field.get('isIncluded')) {
field.set('isRequired', false);
}
if (field.get('isRequired')) {
field.set('isIncluded', true);
}
},
actions: {
saveDraft() {
this.onValid(() => {
this.get('save')('draft');
});
},
moveForward() {
this.onValid(() => {
this.get('move')();
});
},
publish() {
this.onValid(() => {
this.get('save')('publish');
});
},
addItem(type) {
switch (type) {
case 'sessionType':
this.get('data.sessionsSpeakers.sessionTypes').addObject(this.store.createRecord('session-type'));
break;
case 'track':
this.get('data.sessionsSpeakers.tracks').addObject(this.store.createRecord('track'));
break;
case 'microlocation':
this.get('data.sessionsSpeakers.microlocations').addObject(this.store.createRecord('microlocation'));
break;
}
},
removeItem(item, type) {
item.unloadRecord();
this.get(`data.sessionsSpeakers.${type}s`).removeObject(item);
}
}
});
| sumedh123/open-event-frontend | app/components/forms/wizard/sessions-speakers-step.js | JavaScript | apache-2.0 | 1,713 |
/*
* Waltz - Enterprise Architecture
* Copyright (C) 2016, 2017, 2018, 2019 Waltz open source project
* See README.md for more information
*
* 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
*
*/
import { CORE_API } from "../../../common/services/core-api-utils";
import { initialiseData } from "../../../common";
import template from "./software-package-overview.html";
const bindings = {
parentEntityRef: "<",
};
const initialState = {
softwareCatalog: null,
softwarePackage: null
};
function controller(serviceBroker) {
const vm = initialiseData(this, initialState);
const loadPackage = () => {
return serviceBroker
.loadViewData(
CORE_API.SoftwareCatalogStore.getByPackageId,
[vm.parentEntityRef.id])
.then(r => {
vm.softwareCatalog = r.data;
vm.softwarePackage = _.get(vm.softwareCatalog, 'packages[0]');
});
};
vm.$onInit = () => {
loadPackage();
};
}
controller.$inject = [
"ServiceBroker"
];
const component = {
template,
bindings,
controller
};
export default {
component,
id: "waltzSoftwarePackageOverview"
};
| khartec/waltz | waltz-ng/client/software-catalog/components/overview/software-package-overview.js | JavaScript | apache-2.0 | 1,651 |
describe('GridLayer', function () {
var div, map;
beforeEach(function () {
div = document.createElement('div');
div.style.width = '800px';
div.style.height = '600px';
div.style.visibility = 'hidden';
document.body.appendChild(div);
map = L.map(div);
});
afterEach(function () {
document.body.removeChild(div);
});
describe('#redraw', function () {
it('can be called before map.setView', function () {
var grid = L.gridLayer().addTo(map);
expect(grid.redraw()).to.equal(grid);
});
});
describe('#setOpacity', function () {
it('can be called before map.setView', function () {
var grid = L.gridLayer().addTo(map);
expect(grid.setOpacity(0.5)).to.equal(grid);
});
it('works when map has fadeAnimated=false (IE8 is exempt)', function (done) {
map.remove();
map = L.map(div, {fadeAnimation: false}).setView([0, 0], 0);
var grid = L.gridLayer().setOpacity(0.5).addTo(map);
grid.on('load', function () {
expect(grid._container.style.opacity).to.equal('0.5');
done();
});
});
});
it('positions tiles correctly with wrapping and bounding', function () {
map.setView([0, 0], 1);
var tiles = [];
var grid = L.gridLayer();
grid.createTile = function (coords) {
var tile = document.createElement('div');
tiles.push({coords: coords, tile: tile});
return tile;
};
map.addLayer(grid);
var loaded = {};
for (var i = 0; i < tiles.length; i++) {
var coords = tiles[i].coords,
pos = L.DomUtil.getPosition(tiles[i].tile);
loaded[pos.x + ':' + pos.y] = [coords.x, coords.y];
}
expect(loaded).to.eql({
'144:0': [0, 0],
'400:0': [1, 0],
'144:256': [0, 1],
'400:256': [1, 1],
'-112:0': [1, 0],
'656:0': [0, 0],
'-112:256': [1, 1],
'656:256': [0, 1]
});
});
describe('tile pyramid', function () {
var clock;
beforeEach(function () {
clock = sinon.useFakeTimers();
});
afterEach(function () {
clock.restore();
});
it('removes tiles for unused zoom levels', function (done) {
map.remove();
map = L.map(div, {fadeAnimation: false});
map.setView([0, 0], 1);
var grid = L.gridLayer();
var tiles = {};
grid.createTile = function (coords) {
tiles[grid._tileCoordsToKey(coords)] = true;
return document.createElement('div');
};
grid.on('tileunload', function (e) {
delete tiles[grid._tileCoordsToKey(e.coords)];
});
grid.on('load', function (e) {
if (Object.keys(tiles).length === 1) {
expect(Object.keys(tiles)).to.eql(['0:0:0']);
grid.off();
done();
}
});
map.addLayer(grid);
map.setZoom(0, {animate: false});
clock.tick(250);
});
});
describe('#createTile', function () {
var grid;
beforeEach(function () {
// Simpler sizes to test.
div.style.width = '512px';
div.style.height = '512px';
map.remove();
map = L.map(div);
map.setView([0, 0], 10);
grid = L.gridLayer();
});
afterEach(function () {
div.style.width = '800px';
div.style.height = '600px';
});
// Passes on Firefox, but fails on phantomJS: done is never called.
it('only creates tiles for visible area on zoom in', function (done) {
var count = 0,
loadCount = 0;
grid.createTile = function (coords) {
count++;
return document.createElement('div');
};
var onLoad = function (e) {
expect(count).to.eql(4);
count = 0;
loadCount++;
if (loadCount === 1) { // On layer add.
map.zoomIn();
} else { // On zoom in.
done();
}
};
grid.on('load', onLoad);
map.addLayer(grid);
});
describe('when done() is called with an error parameter', function () {
var keys;
beforeEach(function () {
keys = [];
grid.createTile = function (coords, done) {
var tile = document.createElement('div');
keys.push(this._tileCoordsToKey(coords));
done('error', tile);
return tile;
};
});
it('does not raise tileload events', function (done) {
var tileLoadRaised = sinon.spy();
grid.on('tileload', tileLoadRaised);
grid.on('tileerror', function () {
if (keys.length === 4) {
expect(tileLoadRaised.notCalled).to.be(true);
done();
}
});
map.addLayer(grid);
});
it('raises tileerror events', function (done) {
var tileErrorRaised = sinon.spy();
grid.on('tileerror', function () {
tileErrorRaised();
if (keys.length === 4) {
expect(tileErrorRaised.callCount).to.be(4);
done();
}
});
map.addLayer(grid);
});
it('does not add the .leaflet-tile-loaded class to tile elements', function (done) {
var count = 0;
grid.on('tileerror', function (e) {
if (!L.DomUtil.hasClass(e.tile, 'leaflet-tile-loaded')) {
count++;
}
if (keys.length === 4) {
expect(count).to.be(4);
done();
}
});
map.addLayer(grid);
});
});
});
describe("#onAdd", function () {
it('is called after zoomend on first map load', function () {
var layer = L.gridLayer().addTo(map);
var onAdd = layer.onAdd,
onAddSpy = sinon.spy();
layer.onAdd = function () {
onAdd.apply(this, arguments);
onAddSpy();
};
var onReset = sinon.spy();
map.on('zoomend', onReset);
map.setView([0, 0], 0);
expect(onReset.calledBefore(onAddSpy)).to.be.ok();
});
});
describe("#getMaxZoom, #getMinZoom", function () {
describe("when a tilelayer is added to a map with no other layers", function () {
it("has the same zoomlevels as the tilelayer", function () {
var maxZoom = 10,
minZoom = 5;
map.setView([0, 0], 1);
L.gridLayer({
maxZoom: maxZoom,
minZoom: minZoom
}).addTo(map);
expect(map.getMaxZoom()).to.be(maxZoom);
expect(map.getMinZoom()).to.be(minZoom);
});
});
describe("accessing a tilelayer's properties", function () {
it('provides a container', function () {
map.setView([0, 0], 1);
var layer = L.gridLayer().addTo(map);
expect(layer.getContainer()).to.be.ok();
});
});
describe("when a tilelayer is added to a map that already has a tilelayer", function () {
it("has its zoomlevels updated to fit the new layer", function () {
map.setView([0, 0], 1);
L.gridLayer({minZoom: 10, maxZoom: 15}).addTo(map);
expect(map.getMinZoom()).to.be(10);
expect(map.getMaxZoom()).to.be(15);
L.gridLayer({minZoom: 5, maxZoom: 10}).addTo(map);
expect(map.getMinZoom()).to.be(5); // changed
expect(map.getMaxZoom()).to.be(15); // unchanged
L.gridLayer({minZoom: 10, maxZoom: 20}).addTo(map);
expect(map.getMinZoom()).to.be(5); // unchanged
expect(map.getMaxZoom()).to.be(20); // changed
L.gridLayer({minZoom: 0, maxZoom: 25}).addTo(map);
expect(map.getMinZoom()).to.be(0); // changed
expect(map.getMaxZoom()).to.be(25); // changed
});
});
describe("when a gridlayer is removed from a map", function () {
it("has its zoomlevels updated to only fit the layers it currently has", function () {
var tiles = [
L.gridLayer({minZoom: 10, maxZoom: 15}).addTo(map),
L.gridLayer({minZoom: 5, maxZoom: 10}).addTo(map),
L.gridLayer({minZoom: 10, maxZoom: 20}).addTo(map),
L.gridLayer({minZoom: 0, maxZoom: 25}).addTo(map)
];
map.whenReady(function () {
expect(map.getMinZoom()).to.be(0);
expect(map.getMaxZoom()).to.be(25);
map.removeLayer(tiles[0]);
expect(map.getMinZoom()).to.be(0);
expect(map.getMaxZoom()).to.be(25);
map.removeLayer(tiles[3]);
expect(map.getMinZoom()).to.be(5);
expect(map.getMaxZoom()).to.be(20);
map.removeLayer(tiles[2]);
expect(map.getMinZoom()).to.be(5);
expect(map.getMaxZoom()).to.be(10);
map.removeLayer(tiles[1]);
expect(map.getMinZoom()).to.be(0);
expect(map.getMaxZoom()).to.be(Infinity);
});
});
});
});
describe("min/maxNativeZoom option", function () {
it("calls createTile() with maxNativeZoom when map zoom is larger", function (done) {
map.setView([0, 0], 10);
var grid = L.gridLayer({
maxNativeZoom: 5
});
var tileCount = 0;
grid.createTile = function (coords) {
expect(coords.z).to.be(5);
tileCount++;
return document.createElement('div');
};
grid.on('load', function () {
if (tileCount > 0) {
done();
} else {
done('No tiles loaded');
}
});
map.addLayer(grid);
});
it("calls createTile() with minNativeZoom when map zoom is smaller", function (done) {
map.setView([0, 0], 3);
var grid = L.gridLayer({
minNativeZoom: 5
});
var tileCount = 0;
grid.createTile = function (coords) {
expect(coords.z).to.be(5);
tileCount++;
return document.createElement('div');
};
grid.on('load', function () {
if (tileCount > 0) {
done();
} else {
done('No tiles loaded');
}
});
map.addLayer(grid);
});
});
describe("number of 256px tiles loaded in synchronous non-animated grid @800x600px", function () {
var clock, grid, counts;
beforeEach(function () {
clock = sinon.useFakeTimers();
grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256)
});
grid.createTile = function (coords) {
var tile = document.createElement('div');
tile.innerHTML = [coords.x, coords.y, coords.z].join(', ');
tile.style.border = '2px solid red';
return tile;
};
counts = {
tileload: 0,
tileerror: 0,
tileloadstart: 0,
tileunload: 0
};
grid.on('tileload tileunload tileerror tileloadstart', function (ev) {
// console.log(ev.type);
counts[ev.type]++;
});
// grid.on('tileunload', function (ev) {
// console.log(ev.type, ev.coords, counts);
// });
map.options.fadeAnimation = false;
map.options.zoomAnimation = false;
});
afterEach(function () {
clock.restore();
grid.off();
grid = undefined;
counts = undefined;
});
it("Loads 8 tiles zoom 1", function (done) {
grid.on('load', function () {
expect(counts.tileloadstart).to.be(8);
expect(counts.tileload).to.be(8);
expect(counts.tileunload).to.be(0);
done();
});
map.addLayer(grid).setView([0, 0], 1);
clock.tick(250);
});
it("Loads 5 tiles zoom 0", function (done) {
grid.on('load', function () {
expect(counts.tileloadstart).to.be(5);
expect(counts.tileload).to.be(5);
expect(counts.tileunload).to.be(0);
done();
});
map.addLayer(grid).setView([0, 0], 0);
clock.tick(250);
});
it("Loads 16 tiles zoom 10", function (done) {
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
expect(counts.tileunload).to.be(0);
grid.off();
done();
});
map.addLayer(grid).setView([0, 0], 10);
clock.tick(250);
});
it("Loads 32, unloads 16 tiles zooming in 10-11", function (done) {
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
expect(counts.tileunload).to.be(0);
grid.off('load');
grid.on('load', function () {
expect(counts.tileloadstart).to.be(32);
expect(counts.tileload).to.be(32);
expect(counts.tileunload).to.be(16);
done();
});
map.setZoom(11, {animate: false});
clock.tick(250);
});
map.addLayer(grid).setView([0, 0], 10);
clock.tick(250);
});
it("Loads 32, unloads 16 tiles zooming out 11-10", function (done) {
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
expect(counts.tileunload).to.be(0);
grid.off('load');
grid.on('load', function () {
expect(counts.tileloadstart).to.be(32);
expect(counts.tileload).to.be(32);
expect(counts.tileunload).to.be(16);
done();
});
map.setZoom(10, {animate: false});
clock.tick(250);
});
map.addLayer(grid).setView([0, 0], 11);
clock.tick(250);
});
it("Loads 32, unloads 16 tiles zooming out 18-10", function (done) {
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
expect(counts.tileunload).to.be(0);
grid.off('load');
grid.on('load', function () {
expect(counts.tileloadstart).to.be(32);
expect(counts.tileload).to.be(32);
expect(counts.tileunload).to.be(16);
done();
});
map.setZoom(10, {animate: false});
clock.tick(250);
});
map.addLayer(grid).setView([0, 0], 18);
clock.tick(250);
});
});
describe("number of 256px tiles loaded in synchronous animated grid @800x600px", function () {
var clock, grid, counts;
beforeEach(function () {
clock = sinon.useFakeTimers();
grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256)
});
grid.createTile = function (coords) {
var tile = document.createElement('div');
tile.innerHTML = [coords.x, coords.y, coords.z].join(', ');
tile.style.border = '2px solid red';
return tile;
};
counts = {
tileload: 0,
tileerror: 0,
tileloadstart: 0,
tileunload: 0
};
grid.on('tileload tileunload tileerror tileloadstart', function (ev) {
counts[ev.type]++;
});
});
afterEach(function () {
clock.restore();
grid.off();
grid = undefined;
counts = undefined;
});
// Debug helper
function logTiles(ev) {
var pending = 0;
for (var key in grid._tiles) {
if (!grid._tiles[key].loaded) { pending++; }
}
console.log(ev.type + ': ', ev.coords, grid._loading, counts, ' pending: ', pending);
}
// animationFrame helper, just runs requestAnimFrame() a given number of times
function runFrames(n) {
return _runFrames(n)();
}
function _runFrames(n) {
if (n) {
return function () {
clock.tick(40); // 40msec/frame ~= 25fps
map.fire('_frame');
L.Util.requestAnimFrame(_runFrames(n - 1));
};
} else {
return L.Util.falseFn;
}
}
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
it.skipInPhantom("Loads 32, unloads 16 tiles zooming in 10-11", function (done) {
// grid.on('tileload tileunload tileloadstart load', logTiles);
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
expect(counts.tileunload).to.be(0);
grid.off('load');
// grid.on('load', logTiles);
grid.on('load', function () {
// We're one frame into the zoom animation, there are
// 16 tiles for z10 plus 16 tiles for z11 covering the
// bounds at the *end* of the zoom-*in* anim
expect(counts.tileloadstart).to.be(32);
expect(counts.tileload).to.be(32);
expect(counts.tileunload).to.be(0);
// Wait > 250msec for the tile fade-in animation to complete,
// which triggers the tile pruning
clock.tick(300);
// After the zoom-in, the 'outside' 12 tiles (not the 4
// at the center, still in bounds) have been unloaded.
expect(counts.tileunload).to.be(12);
L.Util.requestAnimFrame(function () {
expect(counts.tileloadstart).to.be(32);
expect(counts.tileload).to.be(32);
expect(counts.tileunload).to.be(16);
done();
});
});
map.setZoom(11, {animate: true});
clock.tick(250);
});
map.addLayer(grid).setView([0, 0], 10);
clock.tick(250);
});
it("Loads 32, unloads 16 tiles zooming in 10-18", function (done) {
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
expect(counts.tileunload).to.be(0);
grid.off('load');
grid.on('load', function () {
// In this particular scenario, the tile unloads happen in the
// next render frame after the grid's 'load' event.
L.Util.requestAnimFrame(function () {
expect(counts.tileloadstart).to.be(32);
expect(counts.tileload).to.be(32);
expect(counts.tileunload).to.be(16);
done();
});
});
map.setZoom(18, {animate: true});
clock.tick(250);
});
map.addLayer(grid).setView([0, 0], 10);
clock.tick(250);
});
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
it.skipInPhantom("Loads 32, unloads 16 tiles zooming out 11-10", function (done) {
// grid.on('tileload tileunload load', logTiles);
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
expect(counts.tileunload).to.be(0);
grid.off('load');
// grid.on('load', logTiles);
grid.on('load', function () {
grid.off('load');
// grid.on('load', logTiles);
// We're one frame into the zoom animation, there are
// 16 tiles for z11 plus 4 tiles for z10 covering the
// bounds at the *beginning* of the zoom-*out* anim
expect(counts.tileloadstart).to.be(20);
expect(counts.tileload).to.be(20);
expect(counts.tileunload).to.be(0);
// Wait > 250msec for the tile fade-in animation to complete,
// which triggers the tile pruning
clock.tick(300);
L.Util.requestAnimFrame(function () {
expect(counts.tileunload).to.be(16);
// The next 'load' event happens when the zoom anim is
// complete, and triggers loading of all the z10 tiles.
grid.on('load', function () {
expect(counts.tileloadstart).to.be(32);
expect(counts.tileload).to.be(32);
done();
});
});
});
map.setZoom(10, {animate: true});
clock.tick(250);
});
map.addLayer(grid).setView([0, 0], 11);
clock.tick(250);
});
it("Loads 32, unloads 16 tiles zooming out 18-10", function (done) {
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
expect(counts.tileunload).to.be(0);
grid.off('load');
grid.on('load', function () {
// In this particular scenario, the tile unloads happen in the
// next render frame after the grid's 'load' event.
L.Util.requestAnimFrame(function () {
expect(counts.tileloadstart).to.be(32);
expect(counts.tileload).to.be(32);
expect(counts.tileunload).to.be(16);
done();
});
});
map.setZoom(10, {animate: true});
clock.tick(250);
});
map.addLayer(grid).setView([0, 0], 18);
clock.tick(250);
});
// NOTE: This test has different behaviour in PhantomJS and graphical
// browsers due to CSS animations!
it.skipInPhantom("Loads 290, unloads 275 tiles on MAD-TRD flyTo()", function (done) {
this.timeout(10000); // This test takes longer than usual due to frames
var mad = [40.40, -3.7], trd = [63.41, 10.41];
grid.on('load', function () {
expect(counts.tileloadstart).to.be(12);
expect(counts.tileload).to.be(12);
expect(counts.tileunload).to.be(0);
grid.off('load');
map.on('zoomend', function () {
expect(counts.tileloadstart).to.be(290);
expect(counts.tileunload).to.be(275);
expect(counts.tileload).to.be(290);
expect(grid._container.querySelectorAll('div').length).to.be(16); // 15 + container
done();
});
map.flyTo(trd, 12, {animate: true});
// map.on('_frame', function () {
// console.log('frame', counts);
// });
runFrames(500);
});
grid.options.keepBuffer = 0;
map.addLayer(grid).setView(mad, 12);
clock.tick(250);
});
});
describe("configurable tile pruning", function () {
var clock, grid, counts;
beforeEach(function () {
clock = sinon.useFakeTimers();
grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256)
});
grid.createTile = function (coords) {
var tile = document.createElement('div');
tile.innerHTML = [coords.x, coords.y, coords.z].join(', ');
tile.style.border = '2px solid red';
return tile;
};
counts = {
tileload: 0,
tileerror: 0,
tileloadstart: 0,
tileunload: 0
};
grid.on('tileload tileunload tileerror tileloadstart', function (ev) {
// console.log(ev.type);
counts[ev.type]++;
});
// grid.on('tileunload', function (ev) {
// console.log(ev.type, ev.coords, counts);
// });
map.options.fadeAnimation = false;
map.options.zoomAnimation = false;
});
afterEach(function () {
clock.restore();
grid.off();
grid = undefined;
counts = undefined;
});
it("Loads map, moves forth by 512 px, keepBuffer = 0", function (done) {
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
expect(counts.tileunload).to.be(0);
grid.off('load');
grid.on('load', function () {
expect(counts.tileloadstart).to.be(28);
expect(counts.tileload).to.be(28);
expect(counts.tileunload).to.be(12);
done();
});
map.panBy([512, 512], {animate: false});
clock.tick(250);
});
grid.options.keepBuffer = 0;
map.addLayer(grid).setView([0, 0], 10);
clock.tick(250);
});
it("Loads map, moves forth and back by 512 px, keepBuffer = 0", function (done) {
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
expect(counts.tileunload).to.be(0);
grid.off('load');
grid.on('load', function () {
expect(counts.tileloadstart).to.be(28);
expect(counts.tileload).to.be(28);
expect(counts.tileunload).to.be(12);
grid.off('load');
grid.on('load', function () {
expect(counts.tileloadstart).to.be(40);
expect(counts.tileload).to.be(40);
expect(counts.tileunload).to.be(24);
done();
});
map.panBy([-512, -512], {animate: false});
clock.tick(250);
});
map.panBy([512, 512], {animate: false});
clock.tick(250);
});
grid.options.keepBuffer = 0;
map.addLayer(grid).setView([0, 0], 10);
clock.tick(250);
});
it("Loads map, moves forth and back by 512 px, default keepBuffer", function (done) {
var spy = sinon.spy();
grid.on('load', function () {
expect(counts.tileloadstart).to.be(16);
expect(counts.tileload).to.be(16);
expect(counts.tileunload).to.be(0);
grid.off('load');
grid.on('load', function () {
expect(counts.tileloadstart).to.be(28);
expect(counts.tileload).to.be(28);
expect(counts.tileunload).to.be(0);
grid.off('load');
grid.addEventListener('load', spy);
map.panBy([-512, -512], {animate: false});
clock.tick(250);
expect(spy.called).to.be(false);
done();
});
map.panBy([512, 512], {animate: false});
clock.tick(250);
});
map.addLayer(grid).setView([0, 0], 10);
clock.tick(250);
});
});
describe("nowrap option", function () {
it("When false, uses same coords at zoom 0 for all tiles", function (done) {
var grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256),
noWrap: false
});
var loadedTileKeys = [];
grid.createTile = function (coords) {
loadedTileKeys.push(coords.x + ':' + coords.y + ':' + coords.z);
return document.createElement('div');
};
map.addLayer(grid).setView([0, 0], 0);
grid.on('load', function () {
expect(loadedTileKeys).to.eql(["0:0:0", "0:0:0", "0:0:0", "0:0:0", "0:0:0"]);
done();
});
});
it("When true, uses different coords at zoom level 0 for all tiles", function (done) {
var grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256),
noWrap: true
});
var loadedTileKeys = [];
grid.createTile = function (coords) {
loadedTileKeys.push(coords.x + ':' + coords.y + ':' + coords.z);
return document.createElement('div');
};
map.addLayer(grid).setView([0, 0], 0);
grid.on('load', function () {
expect(loadedTileKeys).to.eql(['0:0:0', '-1:0:0', '1:0:0', '-2:0:0', '2:0:0']);
done();
});
});
it("When true and with bounds, loads just one tile at zoom level 0", function (done) {
var grid = L.gridLayer({
attribution: 'Grid Layer',
tileSize: L.point(256, 256),
bounds: [[-90, -180], [90, 180]],
noWrap: true
});
var loadedTileKeys = [];
grid.createTile = function (coords) {
loadedTileKeys.push(coords.x + ':' + coords.y + ':' + coords.z);
return document.createElement('div');
};
map.addLayer(grid).setView([0, 0], 0);
grid.on('load', function () {
expect(loadedTileKeys).to.eql(['0:0:0']);
done();
});
});
});
describe("Sanity checks for infinity", function () {
it("Throws error on map center at plus Infinity longitude", function () {
expect(function () {
map.setCenter([Infinity, Infinity]);
L.gridLayer().addTo(map);
}).to.throwError('Attempted to load an infinite number of tiles');
});
it("Throws error on map center at minus Infinity longitude", function () {
expect(function () {
map.setCenter([-Infinity, -Infinity]);
L.gridLayer().addTo(map);
}).to.throwError('Attempted to load an infinite number of tiles');
});
});
it("doesn't call map's getZoomScale method with null after _invalidateAll method was called", function () {
map.setView([0, 0], 0);
var grid = L.gridLayer().addTo(map);
var wrapped = sinon.spy(map, 'getZoomScale');
grid._invalidateAll();
grid.redraw();
expect(wrapped.neverCalledWith(sinon.match.any, null)).to.be(true);
});
});
| msiadak/Leaflet | spec/suites/layer/tile/GridLayerSpec.js | JavaScript | bsd-2-clause | 25,460 |
import {CommitAuthor} from './commitAuthor';
import {Repository} from './repository';
export function Commit(params = {}) {
return {
dateCreated: '2018-11-30T18:46:31Z',
message:
'(improve) Add Links to Spike-Protection Email (#2408)\n\n* (improve) Add Links to Spike-Protection Email\r\n\r\nUsers now have access to useful links from the blogs and docs on Spike-protection.\r\n\r\n* fixed wording',
id: 'f7f395d14b2fe29a4e253bf1d3094d61e6ad4434',
author: CommitAuthor(),
repository: Repository(),
...params,
};
}
| beeftornado/sentry | tests/js/sentry-test/fixtures/commit.js | JavaScript | bsd-3-clause | 549 |
module.exports = function() {
if (!("querySelectorAll" in document)) {
return;
}
var className = ".tab";
var Tab = function(element, opts) {
opts = opts || {};
this.element = element;
this.$element = $(element);
this.tabNav = $(".tabs [href='#" + element.id + "']");
this.isOpen = false;
this.siblings = $(className).not(this.$element);
this.$element.data("tab", this);
this.init();
};
Tab.prototype.init = function() {
if (this.tabNav.closest("li").hasClass("current")) {
this.open();
} else {
this.close();
}
};
Tab.prototype.open = function() {
this.$element.removeClass("hidden");
this.$element.addClass("visible");
this.isOpen = true;
$(".tabs .current").removeClass("current");
this.tabNav.closest("li").addClass("current");
$.each(this.siblings, function(idx, el) {
var tab = $(el).data("tab");
if (tab) {
tab.close();
}
});
};
Tab.prototype.close = function() {
this.$element.removeClass("visible");
this.$element.addClass("hidden");
this.isOpen = false;
};
Tab.prototype.toggle = function() {
if (this.isOpen) {
this.close();
} else {
this.open();
}
};
var openLinkedTab = function() {
if ($(".tabs .current").attr("href") !== location.hash) {
var tab = $(location.hash).data('tab');
tab && tab.open();
}
};
var parser = document.createElement("a");
var updateFormActions = function() {
var forms = document.querySelectorAll("form");
for (var i = 0, l = forms.length; i < l; i++) {
var form = forms[i];
parser.href = form.action;
if (!parser.host) {
form.action = parser.pathname + location.hash;
}
}
};
$(function() {
$(window)[0].scrollTo(0, 0);
var tabs = $(className);
$.each(tabs, function(idx, el) {
var tab = new Tab(el);
tab.tabNav.on("click", function(e) {
e.preventDefault();
tab.open();
location.hash = $(this).attr('href');
$(window)[0].scrollTo(0, 0);
});
});
openLinkedTab();
updateFormActions();
$(window).on("hashchange", function(e) {
openLinkedTab();
updateFormActions();
});
});
};
| rutaihwa/newww | assets/scripts/tabs.js | JavaScript | isc | 2,279 |
import Enum from '../lib/Enum';
export default new Enum([
'pending',
'initializing',
'ready',
'resetting',
], 'module');
| ele828/ringcentral-js-integration-commons | src/enums/moduleStatuses.js | JavaScript | mit | 130 |
var title = "Got Milk? ";
var desc = "And after you got <a href=\"event:item|milk_butterfly\">Milk<\/a>, got <a href=\"event:item|meat\">Meat<\/a>? Get a <a href=\"event:item|butterfly_milker\">Butterfly Milker<\/a> and a <a href=\"event:item|meat_collector\">Meat Collector<\/a>, install them in your yard, then set them to milking and harvesting until they're full up.";
var offer = "I've been watching you kid. You're busy and important. You're on the move, and you've got better places to be than hanging around the house waiting to harvest butterflies and piggies. <split butt_txt=\"It's like you're inside my head.\" \/>You need to get yourself a patented, practically dumdum-proof <a href=\"event:item|butterfly_milker\">Butterfly Milker<\/a> and <a href=\"event:item|meat_collector\">Meat Collector<\/a>. <split butt_txt=\"I am fond of gadgets.\" \/>Set them up in your yard, and I'll check back with you when they're full up, mkay?";
var completion = "Looks like that Butterfly Milker is as full as it gets. And if that Meat Collector were any more full, it would be... really, really full. <split butt_txt=\"True.\" \/>Here's an idea you maybe haven't tried: give one of your <a href=\"event:item|milk_butterfly\">Butterfly Milks<\/a> a good shake and see what happens. <split butt_txt=\"What about shaking a meat?\" \/>Nothing happens. It just makes other people uncomfortable.";
var auto_complete = 0;
var familiar_turnin = 1;
var is_tracked = 0;
var show_alert = 0;
var silent_complete = 0;
var progress = [
];
var giver_progress = [
];
var no_progress = "null";
var prereq_quests = [];
var prerequisites = [];
var end_npcs = [];
var locations = {};
var requirements = {
"r173" : {
"type" : "flag",
"name" : "meat_collector_full",
"class_id" : "meat_collector",
"desc" : "Fill up a Meat Collector"
},
"r174" : {
"type" : "flag",
"name" : "butterfly_milker_full",
"class_id" : "butterfly_milker",
"desc" : "Fill up a Butterfly Milker"
}
};
function onComplete(pc){ // generated from rewards
var xp=0;
var currants=0;
var mood=0;
var energy=0;
var favor=0;
var multiplier = pc.buffs_has('gift_of_gab') ? 1.2 : pc.buffs_has('silvertongue') ? 1.05 : 1.0;
multiplier += pc.imagination_get_quest_modifier();
xp = pc.stats_add_xp(round_to_5(600 * multiplier), true, {type: 'quest_complete', quest: this.class_tsid});
currants = pc.stats_add_currants(round_to_5(400 * multiplier), {type: 'quest_complete', quest: this.class_tsid});
mood = pc.metabolics_add_mood(round_to_5(75 * multiplier));
favor = pc.stats_add_favor_points("humbaba", round_to_5(60 * multiplier));
apiLogAction('QUEST_REWARDS', 'pc='+pc.tsid, 'quest='+this.class_tsid, 'xp='+intval(xp), 'mood='+intval(mood), 'energy='+intval(energy), 'currants='+intval(currants), 'favor='+intval(favor));
if(pc.buffs_has('gift_of_gab')) {
pc.buffs_remove('gift_of_gab');
}
else if(pc.buffs_has('silvertongue')) {
pc.buffs_remove('silvertongue');
}
}
var rewards = {
"xp" : 600,
"currants" : 400,
"mood" : 75,
"favor" : {
"0" : {
"giant" : "humbaba",
"points" : 60
}
}
};
// generated ok (NO DATE)
| yelworc/eleven-gsjs | quests/remoteherdkeeping_fill_up_meat_collector_and_milker.js | JavaScript | mit | 3,125 |
module.exports=['\xBB','\u2019','\u201D','\u203A','\u2E03','\u2E05','\u2E0A','\u2E0D','\u2E1D','\u2E21'] | marclundgren/mithril-fidm-app | node_modules/gulp-jscs/node_modules/jscs/node_modules/unicode-6.3.0/categories/Pf/symbols.js | JavaScript | mit | 104 |
var fs = require('fs');
var http = require('http');
var path = require('path');
var util = require('util');
var querystring = require('querystring');
var httpProxy = require('http-proxy');
var pause = require('pause');
var mime = require('mime');
var helper = require('./helper');
var proxy = require('./proxy');
var log = require('./logger').create('web server');
var SCRIPT_TAG = '<script type="text/javascript" src="%s"></script>';
var setNoCacheHeaders = function(response) {
response.setHeader('Cache-Control', 'no-cache');
response.setHeader('Pragma', 'no-cache');
response.setHeader('Expires', (new Date(0)).toString());
};
var serveStaticFile = function(file, response, process) {
fs.readFile(file, function(error, data) {
if (error) {
log.warn('404: ' + file);
response.writeHead(404);
return response.end('NOT FOUND');
}
// set content type
response.setHeader('Content-Type', mime.lookup(file, 'text/plain'));
// call custom process fn to transform the data
var responseData = process && process(data.toString(), response) || data;
response.writeHead(200);
log.debug('serving: ' + file);
return response.end(responseData);
});
};
var createTestacularSourceHandler = function(promiseContainer, staticFolder, adapterFolder,
baseFolder, urlRoot) {
return function(request, response, next) {
var requestUrl = request.url.replace(/\?.*/, '');
if (requestUrl === urlRoot.substr(0, urlRoot.length - 1)) {
response.setHeader('Location', urlRoot);
response.writeHead(301);
return response.end('MOVED PERMANENTLY');
}
if (requestUrl.indexOf(urlRoot) !== 0) {
return next();
}
requestUrl = requestUrl.substring(urlRoot.length - 1);
if (requestUrl === '/') {
return serveStaticFile(staticFolder + '/client.html', response);
}
// SERVE testacular.js
if (requestUrl === '/testacular.js') {
return serveStaticFile(staticFolder + '/testacular.js', response, function(data) {
return data.replace('%TESTACULAR_SRC_PREFIX%', urlRoot.substring(1));
});
}
// SERVE context.html - execution context within the iframe
// or runner.html - execution context without channel to the server
if (requestUrl === '/context.html' || requestUrl === '/debug.html') {
return promiseContainer.promise.then(function(files) {
serveStaticFile(staticFolder + requestUrl, response, function(data, response) {
// never cache
setNoCacheHeaders(response);
var scriptTags = files.included.map(function(file) {
var filePath = file.path;
if (!file.isUrl) {
// TODO(vojta): serve these files from within urlRoot as well
if (filePath.indexOf(adapterFolder) === 0) {
filePath = '/adapter' + filePath.substr(adapterFolder.length);
} else if (filePath.indexOf(baseFolder) === 0) {
filePath = '/base' + filePath.substr(baseFolder.length);
} else {
filePath = '/absolute' + filePath;
}
if (requestUrl === '/context.html') {
filePath += '?' + file.mtime.getTime();
}
}
return util.format(SCRIPT_TAG, filePath);
});
var mappings = files.served.map(function(file) {
var filePath = file.path;
// TODO(vojta): refactor to remove code duplication
// TODO(vojta): don't compute if it's not in the template
if (filePath.indexOf(adapterFolder) === 0) {
filePath = '/adapter' + filePath.substr(adapterFolder.length);
} else if (filePath.indexOf(baseFolder) === 0) {
filePath = '/base' + filePath.substr(baseFolder.length);
} else {
filePath = '/absolute' + filePath;
}
return util.format(' \'%s\': \'%d\'', filePath, file.mtime.getTime());
});
mappings = 'window.__testacular__.files = {\n' + mappings.join(',\n') + '\n};\n';
return data.replace('%SCRIPTS%', scriptTags.join('\n')).replace('%MAPPINGS%', mappings);
});
});
}
return next();
};
};
var findByPath = function(files, path) {
for (var i = 0; i < files.length; i++) {
if (files[i].path === path) {
return files[i];
}
}
return null;
};
var createSourceFileHandler = function(promiseContainer, adapterFolder, baseFolder) {
return function(request, response, next) {
// Need to pause the request because of proxying, see:
// https://groups.google.com/forum/#!topic/q-continuum/xr8znxc_K5E/discussion
var pausedReqest = pause(request);
var requestedFilePath = request.url.replace(/\?.*/, '')
.replace(/^\/adapter/, adapterFolder)
.replace(/^\/absolute/, '')
.replace(/^\/base/, baseFolder);
requestedFilePath = querystring.unescape(requestedFilePath);
promiseContainer.promise.then(function(files) {
var file = findByPath(files.served, requestedFilePath);
if (file) {
serveStaticFile(file.contentPath, response, function(data, response) {
if (/\?\d+/.test(request.url)) {
// files with timestamps - cache one year, rely on timestamps
response.setHeader('Cache-Control', ['public', 'max-age=31536000']);
} else {
// without timestamps - no cache (debug)
setNoCacheHeaders(response);
}
});
} else {
next();
}
pausedReqest.resume();
});
};
};
var createHandler = function(promiseContainer, staticFolder, adapterFolder, baseFolder, proxyFn,
proxies, urlRoot) {
var testacularSrcHandler = createTestacularSourceHandler(promiseContainer, staticFolder,
adapterFolder, baseFolder, urlRoot);
var proxiedPathsHandler = proxy.createProxyHandler(proxyFn, proxies);
var sourceFileHandler = createSourceFileHandler(promiseContainer, adapterFolder, baseFolder);
return function(request, response) {
testacularSrcHandler(request, response, function() {
sourceFileHandler(request, response, function() {
proxiedPathsHandler(request, response, function() {
response.writeHead(404);
response.end('NOT FOUND');
});
});
});
};
};
exports.createWebServer = function (baseFolder, proxies, urlRoot) {
var staticFolder = path.normalize(__dirname + '/../static');
var adapterFolder = path.normalize(__dirname + '/../adapter');
var promiseContainer = {
promise: null
};
var server = http.createServer(createHandler(promiseContainer,
helper.normalizeWinPath(staticFolder), helper.normalizeWinPath(adapterFolder), baseFolder,
new httpProxy.RoutingProxy({changeOrigin: true}), proxies, urlRoot));
server.updateFilesPromise = function(promise) {
promiseContainer.promise = promise;
};
return server;
};
exports.createWebServer.$inject = ['config.basePath', 'config.proxies', 'config.urlRoot'];
| alivanov/testacular | lib/web-server.js | JavaScript | mit | 7,073 |
/*
MIT License http://www.opensource.org/licenses/mit-license.php
Author Tobias Koppers @sokra
*/
"use strict";
const { SyncWaterfallHook } = require("tapable");
const util = require("util");
const RuntimeGlobals = require("./RuntimeGlobals");
const memoize = require("./util/memoize");
/** @typedef {import("webpack-sources").ConcatSource} ConcatSource */
/** @typedef {import("webpack-sources").Source} Source */
/** @typedef {import("../declarations/WebpackOptions").Output} OutputOptions */
/** @typedef {import("./ModuleTemplate")} ModuleTemplate */
/** @typedef {import("./Chunk")} Chunk */
/** @typedef {import("./Compilation")} Compilation */
/** @typedef {import("./Compilation").AssetInfo} AssetInfo */
/** @typedef {import("./Module")} Module} */
/** @typedef {import("./util/Hash")} Hash} */
/** @typedef {import("./DependencyTemplates")} DependencyTemplates} */
/** @typedef {import("./javascript/JavascriptModulesPlugin").RenderContext} RenderContext} */
/** @typedef {import("./RuntimeTemplate")} RuntimeTemplate} */
/** @typedef {import("./ModuleGraph")} ModuleGraph} */
/** @typedef {import("./ChunkGraph")} ChunkGraph} */
/** @typedef {import("./Template").RenderManifestOptions} RenderManifestOptions} */
/** @typedef {import("./Template").RenderManifestEntry} RenderManifestEntry} */
const getJavascriptModulesPlugin = memoize(() =>
require("./javascript/JavascriptModulesPlugin")
);
const getJsonpTemplatePlugin = memoize(() =>
require("./web/JsonpTemplatePlugin")
);
const getLoadScriptRuntimeModule = memoize(() =>
require("./runtime/LoadScriptRuntimeModule")
);
// TODO webpack 6 remove this class
class MainTemplate {
/**
*
* @param {OutputOptions} outputOptions output options for the MainTemplate
* @param {Compilation} compilation the compilation
*/
constructor(outputOptions, compilation) {
/** @type {OutputOptions} */
this._outputOptions = outputOptions || {};
this.hooks = Object.freeze({
renderManifest: {
tap: util.deprecate(
(options, fn) => {
compilation.hooks.renderManifest.tap(
options,
(entries, options) => {
if (!options.chunk.hasRuntime()) return entries;
return fn(entries, options);
}
);
},
"MainTemplate.hooks.renderManifest is deprecated (use Compilation.hooks.renderManifest instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_RENDER_MANIFEST"
)
},
modules: {
tap: () => {
throw new Error(
"MainTemplate.hooks.modules has been removed (there is no replacement, please create an issue to request that)"
);
}
},
moduleObj: {
tap: () => {
throw new Error(
"MainTemplate.hooks.moduleObj has been removed (there is no replacement, please create an issue to request that)"
);
}
},
require: {
tap: util.deprecate(
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.renderRequire.tap(options, fn);
},
"MainTemplate.hooks.require is deprecated (use JavascriptModulesPlugin.getCompilationHooks().renderRequire instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE"
)
},
beforeStartup: {
tap: () => {
throw new Error(
"MainTemplate.hooks.beforeStartup has been removed (use RuntimeGlobals.startupOnlyBefore instead)"
);
}
},
startup: {
tap: () => {
throw new Error(
"MainTemplate.hooks.startup has been removed (use RuntimeGlobals.startup instead)"
);
}
},
afterStartup: {
tap: () => {
throw new Error(
"MainTemplate.hooks.afterStartup has been removed (use RuntimeGlobals.startupOnlyAfter instead)"
);
}
},
render: {
tap: util.deprecate(
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.render.tap(options, (source, renderContext) => {
if (
renderContext.chunkGraph.getNumberOfEntryModules(
renderContext.chunk
) === 0 ||
!renderContext.chunk.hasRuntime()
) {
return source;
}
return fn(
source,
renderContext.chunk,
compilation.hash,
compilation.moduleTemplates.javascript,
compilation.dependencyTemplates
);
});
},
"MainTemplate.hooks.render is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_RENDER"
)
},
renderWithEntry: {
tap: util.deprecate(
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.render.tap(options, (source, renderContext) => {
if (
renderContext.chunkGraph.getNumberOfEntryModules(
renderContext.chunk
) === 0 ||
!renderContext.chunk.hasRuntime()
) {
return source;
}
return fn(source, renderContext.chunk, compilation.hash);
});
},
"MainTemplate.hooks.renderWithEntry is deprecated (use JavascriptModulesPlugin.getCompilationHooks().render instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_RENDER_WITH_ENTRY"
)
},
assetPath: {
tap: util.deprecate(
(options, fn) => {
compilation.hooks.assetPath.tap(options, fn);
},
"MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH"
),
call: util.deprecate(
(filename, options) => {
return compilation.getAssetPath(filename, options);
},
"MainTemplate.hooks.assetPath is deprecated (use Compilation.hooks.assetPath instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_ASSET_PATH"
)
},
hash: {
tap: util.deprecate(
(options, fn) => {
compilation.hooks.fullHash.tap(options, fn);
},
"MainTemplate.hooks.hash is deprecated (use Compilation.hooks.fullHash instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_HASH"
)
},
hashForChunk: {
tap: util.deprecate(
(options, fn) => {
getJavascriptModulesPlugin()
.getCompilationHooks(compilation)
.chunkHash.tap(options, (chunk, hash) => {
if (!chunk.hasRuntime()) return;
return fn(hash, chunk);
});
},
"MainTemplate.hooks.hashForChunk is deprecated (use JavascriptModulesPlugin.getCompilationHooks().chunkHash instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK"
)
},
globalHashPaths: {
tap: util.deprecate(
() => {},
"MainTemplate.hooks.globalHashPaths has been removed (it's no longer needed)",
"DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK"
)
},
globalHash: {
tap: util.deprecate(
() => {},
"MainTemplate.hooks.globalHash has been removed (it's no longer needed)",
"DEP_WEBPACK_MAIN_TEMPLATE_HASH_FOR_CHUNK"
)
},
hotBootstrap: {
tap: () => {
throw new Error(
"MainTemplate.hooks.hotBootstrap has been removed (use your own RuntimeModule instead)"
);
}
},
// for compatibility:
/** @type {SyncWaterfallHook<[string, Chunk, string, ModuleTemplate, DependencyTemplates]>} */
bootstrap: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"moduleTemplate",
"dependencyTemplates"
]),
/** @type {SyncWaterfallHook<[string, Chunk, string]>} */
localVars: new SyncWaterfallHook(["source", "chunk", "hash"]),
/** @type {SyncWaterfallHook<[string, Chunk, string]>} */
requireExtensions: new SyncWaterfallHook(["source", "chunk", "hash"]),
/** @type {SyncWaterfallHook<[string, Chunk, string, string]>} */
requireEnsure: new SyncWaterfallHook([
"source",
"chunk",
"hash",
"chunkIdExpression"
]),
get jsonpScript() {
const hooks =
getLoadScriptRuntimeModule().getCompilationHooks(compilation);
return hooks.createScript;
},
get linkPrefetch() {
const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation);
return hooks.linkPrefetch;
},
get linkPreload() {
const hooks = getJsonpTemplatePlugin().getCompilationHooks(compilation);
return hooks.linkPreload;
}
});
this.renderCurrentHashCode = util.deprecate(
/**
* @deprecated
* @param {string} hash the hash
* @param {number=} length length of the hash
* @returns {string} generated code
*/ (hash, length) => {
if (length) {
return `${RuntimeGlobals.getFullHash} ? ${
RuntimeGlobals.getFullHash
}().slice(0, ${length}) : ${hash.slice(0, length)}`;
}
return `${RuntimeGlobals.getFullHash} ? ${RuntimeGlobals.getFullHash}() : ${hash}`;
},
"MainTemplate.renderCurrentHashCode is deprecated (use RuntimeGlobals.getFullHash runtime function instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_RENDER_CURRENT_HASH_CODE"
);
this.getPublicPath = util.deprecate(
/**
*
* @param {object} options get public path options
* @returns {string} hook call
*/ options => {
return compilation.getAssetPath(
compilation.outputOptions.publicPath,
options
);
},
"MainTemplate.getPublicPath is deprecated (use Compilation.getAssetPath(compilation.outputOptions.publicPath, options) instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_GET_PUBLIC_PATH"
);
this.getAssetPath = util.deprecate(
(path, options) => {
return compilation.getAssetPath(path, options);
},
"MainTemplate.getAssetPath is deprecated (use Compilation.getAssetPath instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH"
);
this.getAssetPathWithInfo = util.deprecate(
(path, options) => {
return compilation.getAssetPathWithInfo(path, options);
},
"MainTemplate.getAssetPathWithInfo is deprecated (use Compilation.getAssetPath instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_GET_ASSET_PATH_WITH_INFO"
);
}
}
Object.defineProperty(MainTemplate.prototype, "requireFn", {
get: util.deprecate(
() => "__webpack_require__",
'MainTemplate.requireFn is deprecated (use "__webpack_require__")',
"DEP_WEBPACK_MAIN_TEMPLATE_REQUIRE_FN"
)
});
Object.defineProperty(MainTemplate.prototype, "outputOptions", {
get: util.deprecate(
/**
* @this {MainTemplate}
* @returns {OutputOptions} output options
*/
function () {
return this._outputOptions;
},
"MainTemplate.outputOptions is deprecated (use Compilation.outputOptions instead)",
"DEP_WEBPACK_MAIN_TEMPLATE_OUTPUT_OPTIONS"
)
});
module.exports = MainTemplate;
| webpack/webpack | lib/MainTemplate.js | JavaScript | mit | 10,391 |
/*!@license
* Infragistics.Web.ClientUI templating localization resources 15.1.20151.1005
*
* Copyright (c) 2011-2015 Infragistics Inc.
*
* http://www.infragistics.com/
*
*/
/*global jQuery */
(function ($) {
$.ig = $.ig || {};
if (!$.ig.Templating) {
$.ig.Templating = {};
$.extend($.ig.Templating, {
locale: {
undefinedArgument: 'Грешка при опит да се вземе стойността на следното свойство от източника на данни: '
}
});
}
})(jQuery); | ajbeaven/personal-finance-sample | PersonalFinance/Scripts/ig/modules/i18n/infragistics.templating-bg.js | JavaScript | mit | 556 |
SirTrevor.BlockDeletion = (function(){
var BlockDeletion = function() {
this._ensureElement();
this._bindFunctions();
};
_.extend(BlockDeletion.prototype, FunctionBind, Renderable, {
tagName: 'a',
className: 'st-block-ui-btn st-block-ui-btn--delete st-icon',
attributes: {
html: 'delete',
'data-icon': 'bin'
}
});
return BlockDeletion;
})(); | 10thfloor/sir-trevor-js | src/block.deletion.js | JavaScript | mit | 394 |
/*
*
* Copyright 2013 Anis Kadri
*
* 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.
*
*/
/* jshint node:true, bitwise:true, undef:true, trailing:true, quotmark:true,
indent:4, unused:vars, latedef:nofunc
*/
var os = require('os'),
path = require('path'),
util = require('util'),
shell = require('shelljs'),
child_process = require('child_process'),
Q = require('q'),
xml_helpers = require('../../util/xml-helpers'),
events = require('../../events'),
tmp_dir;
module.exports = {
searchAndReplace:require('./search-and-replace'),
clonePluginGit:function(plugin_git_url, plugins_dir, options) {
return module.exports.clonePluginGitRepo(plugin_git_url, plugins_dir, options.subdir, options.git_ref).then(
function(dst){
// Keep location where we checked out git repo
options.plugin_src_dir = tmp_dir;
return dst;
}
);
},
// Fetches plugin information from remote server.
// Returns a promise.
clonePluginGitRepo:function(plugin_git_url, plugins_dir, subdir, git_ref) {
if(!shell.which('git')) {
return Q.reject(new Error('"git" command line tool is not installed: make sure it is accessible on your PATH.'));
}
tmp_dir = path.join(os.tmpdir(), 'plugman', 'git', String((new Date()).valueOf()));
shell.rm('-rf', tmp_dir);
var cmd = util.format('git clone "%s" "%s"', plugin_git_url, tmp_dir);
events.emit('verbose', 'Fetching plugin via git-clone command: ' + cmd);
var d = Q.defer();
child_process.exec(cmd, function(err, stdout, stderr) {
if (err) {
d.reject(err);
} else {
d.resolve();
}
});
return d.promise.then(function() {
events.emit('verbose', 'Plugin "' + plugin_git_url + '" fetched.');
// Check out the specified revision, if provided.
if (git_ref) {
var cmd = util.format('git checkout "%s"', git_ref);
var d2 = Q.defer();
child_process.exec(cmd, { cwd: tmp_dir }, function(err, stdout, stderr) {
if (err) d2.reject(err);
else d2.resolve();
});
return d2.promise.then(function() {
events.emit('log', 'Plugin "' + plugin_git_url + '" checked out to git ref "' + git_ref + '".');
});
}
}).then(function() {
// Read the plugin.xml file and extract the plugin's ID.
tmp_dir = path.join(tmp_dir, subdir);
// TODO: what if plugin.xml does not exist?
var xml_file = path.join(tmp_dir, 'plugin.xml');
var xml = xml_helpers.parseElementtreeSync(xml_file);
var plugin_id = xml.getroot().attrib.id;
// TODO: what if a plugin depended on different subdirectories of the same plugin? this would fail.
// should probably copy over entire plugin git repo contents into plugins_dir and handle subdir separately during install.
var plugin_dir = path.join(plugins_dir, plugin_id);
events.emit('verbose', 'Copying fetched plugin over "' + plugin_dir + '"...');
shell.cp('-R', path.join(tmp_dir, '*'), plugin_dir);
events.emit('verbose', 'Plugin "' + plugin_id + '" fetched.');
process.env.CORDOVA_PLUGIN_ID = plugin_id;
return plugin_dir;
});
}
};
| frangucc/gamify | www/sandbox/pals/node_modules/cordova/node_modules/cordova-lib/src/plugman/util/plugins.js | JavaScript | mit | 4,067 |
{
// This was the first test song of Akiba Hero, made by Arnaldo Brenna.
// Was an early prototype built only for pre-testing audio sync on Akihabara and is the
// song played in the demo video I've made before releasing the audio engine.
//
// http://www.youtube.com/watch?v=ChL5dZpkFOE - Akiba Hero 'The Fifth Markup' 100% on Hard
//
// The song was kept as an history piece - the original "The Fifth Markup" sounds really
// better :)
setObject:[
{
object:"song",
property:"demo",
value:{
wallpaper:"resources/akibahero/ingame-demo.png", // The song's wallpaper. Must.
audio:[audioserver+"hypermarkup5-song.mp3",audioserver+"hypermarkup5-song.ogg"], // The music track. Must be defined.
guitar:[audioserver+"hypermarkup5-guitar.mp3",audioserver+"hypermarkup5-guitar.ogg"], // Facoltative. The notes track. You can use just a mixed track but is less "GH".
mix:[audioserver+"hypermarkup5-mix.mp3",audioserver+"hypermarkup5-mix.ogg"], // The mixed track, used for single channel devices.
title:"The Test Song", // Song title. Must have.
artist:"Arnaldo Brenna", // Artist's name. Must have.
year:"2010", // Year. Must have for closing titles.
contact:"arnaldobrenna@hotmail.it", // Must! :)
errors:["explosion"], // Error sounds. Must.
errorleave:["explosion"], // Sound when a note is missed. Must.
duration:125,
track:[
// Song start
{ time: 19.99000 , d:[0,0,1,0,0]},
{ time: 20.39000 , d:[0,1,0,0,0]},
{ time: 20.87000 , d:[1,0,0,0,0]},
{ time: 21.24000 , d:[0,1,0,0,0]},
{ time: 22.09000 , d:[0,0,0,1,0]},
{ time: 22.43000 , d:[0,0,1,0,0]},
{ time: 22.89000 , d:[0,1,0,0,0]},
{ time: 23.35000 , d:[1,0,0,0,0]},
{ time: 23.64000 , d:[0,0,1,0,0]},
{ time: 24.27000 , d:[0,1,0,0,0]},
{ time: 25.03000 , d:[0,0,1,0,0]},
{ time: 25.47000 , d:[0,1,0,0,0]},
{ time: 25.94000 , d:[1,0,0,0,0]},
{ time: 26.30000 , d:[0,1,0,0,0]},
{ time: 27.17000 , d:[0,0,0,1,0]},
{ time: 27.44000 , d:[0,0,1,0,0]},
{ time: 27.93000 , d:[0,1,0,0,0]},
{ time: 28.43000 , d:[1,0,0,0,0]},
{ time: 28.73000 , d:[0,1,0,0,0]},
{ time: 29.37000 , d:[0,0,1,0,0]},
{ time: 30.09000 , d:[0,0,0,1,0]},
{ time: 31.01000 , d:[0,1,0,0,0]},
{ time: 31.46000 , d:[0,1,0,0,0]},
{ time: 32.48000 , d:[0,0,1,0,0]},
{ time: 32.90000 , d:[0,0,1,0,0]},
{ time: 33.29000 , d:[0,0,1,0,0]},
{ time: 33.71000 , d:[0,0,1,0,0]},
{ time: 34.60000 , d:[0,0,1,0,0]},
{ time: 34.82000 , d:[0,1,0,0,0]},
{ time: 35.08000 , d:[0,0,1,0,0]},
{ time: 35.90000 , d:[0,1,0,0,0]},
{ time: 36.31000 , d:[0,1,0,0,0]},
{ time: 37.24000 , d:[1,0,0,0,0]},
{ time: 37.54000 , d:[0,1,0,0,0]},
{ time: 37.98000 , d:[0,0,1,0,0]},
{ time: 38.39000 , d:[0,0,0,1,0]},
{ time: 38.77000 , d:[0,0,0,1,0]},
{ time: 39.39000 , d:[0,0,0,0,1]},
{ time: 40.00000 , d:[0,1,0,0,0]},
{ time: 40.46000 , d:[0,1,0,0,0]},
{ time: 40.77000 , d:[0,0,1,0,0]},
{ time: 41.07000 , d:[0,1,0,0,0]},
{ time: 41.38000 , d:[0,0,1,0,0]},
{ time: 41.72000 , d:[0,0,1,0,0]},
{ time: 42.06000 , d:[0,1,0,0,0]},
{ time: 42.36000 , d:[0,0,1,0,0]},
{ time: 42.70000 , d:[0,1,0,0,0]},
{ time: 43.01000 , d:[0,1,0,0,0]},
{ time: 43.34000 , d:[0,0,1,0,0]},
{ time: 43.61000 , d:[0,0,1,0,0]},
{ time: 43.90000 , d:[0,1,0,0,0]},
{ time: 44.23000 , d:[0,0,1,0,0]},
{ time: 44.52000 , d:[0,0,1,0,0]},
{ time: 44.83000 , d:[0,0,0,1,0]},
{ time: 45.17000 , d:[0,1,0,0,0]},
{ time: 45.45000 , d:[0,1,0,0,0]},
{ time: 45.77000 , d:[0,0,1,0,0]},
{ time: 46.08000 , d:[0,1,0,0,0]},
{ time: 46.37000 , d:[0,0,1,0,0]},
{ time: 46.70000 , d:[0,1,0,0,0]},
{ time: 47.02000 , d:[0,1,0,0,0]},
{ time: 47.33000 , d:[0,0,1,0,0]},
{ time: 47.64000 , d:[0,1,0,0,0]},
{ time: 47.90000 , d:[0,0,1,0,0]},
{ time: 48.20000 , d:[0,1,0,0,0]},
{ time: 48.51000 , d:[0,1,0,0,0]},
{ time: 48.84000 , d:[0,0,1,0,0]},
{ time: 49.14000 , d:[0,1,0,0,0]},
{ time: 49.47000 , d:[0,0,1,0,0]},
{ time: 49.78000 , d:[0,0,0,1,0]},
{ time: 50.10000 , d:[0,0,1,0,0]},
{ time: 50.51000 , d:[0,1,0,0,0]},
{ time: 50.99000 , d:[1,0,0,0,0]},
{ time: 51.38000 , d:[0,1,0,0,0]},
{ time: 52.23000 , d:[0,0,0,1,0]},
{ time: 52.44000 , d:[0,0,1,0,0]},
{ time: 52.65000 , d:[0,0,1,0,0]},
{ time: 52.98000 , d:[0,1,0,0,0]},
{ time: 53.45000 , d:[1,0,0,0,0]},
{ time: 53.71000 , d:[0,0,1,0,0]},
{ time: 54.39000 , d:[0,1,0,0,0]},
{ time: 55.06000 , d:[0,0,1,0,0]},
{ time: 55.51000 , d:[0,1,0,0,0]},
{ time: 56.00000 , d:[1,0,0,0,0]},
{ time: 56.34000 , d:[0,1,0,0,0]},
{ time: 57.24000 , d:[0,1,0,0,0]},
{ time: 57.45000 , d:[1,0,0,0,0]},
{ time: 57.65000 , d:[0,1,0,0,0]},
{ time: 58.03000 , d:[1,0,0,0,0]},
{ time: 58.42000 , d:[0,1,0,0,0]},
{ time: 58.75000 , d:[0,0,1,0,0]},
{ time: 59.38000 , d:[0,0,1,0,0]},
{ time: 60.04000 , d:[0,0,0,1,0]},
{ time: 60.94000 , d:[1,0,0,0,0]},
{ time: 61.30000 , d:[1,0,0,0,0]},
{ time: 62.51000 , d:[0,1,0,0,0]},
{ time: 63.01000 , d:[0,1,0,0,0]},
{ time: 63.40000 , d:[0,1,0,0,0]},
{ time: 63.85000 , d:[0,1,0,0,0]},
{ time: 64.64000 , d:[0,1,0,0,0]},
{ time: 64.85000 , d:[1,0,0,0,0]},
{ time: 65.08000 , d:[0,1,0,0,0]},
{ time: 65.95000 , d:[1,0,0,0,0]},
{ time: 66.37000 , d:[1,0,0,0,0]},
{ time: 67.26000 , d:[1,0,0,0,0]},
{ time: 67.60000 , d:[0,1,0,0,0]},
{ time: 68.03000 , d:[0,0,1,0,0]},
{ time: 68.45000 , d:[0,0,1,0,0]},
{ time: 68.76000 , d:[0,0,0,1,0]},
{ time: 69.35000 , d:[0,0,0,0,1]},
{ time: 70.01000 , d:[0,0,1,1,0]},
{ time: 70.51000 , d:[0,0,1,0,0]},
{ time: 70.98000 , d:[1,0,0,0,0]},
{ time: 71.34000 , d:[0,1,1,0,0]},
{ time: 72.26000 , d:[0,0,0,1,0]},
{ time: 72.46000 , d:[0,0,1,0,0]},
{ time: 72.67000 , d:[0,1,0,0,0]},
{ time: 73.06000 , d:[1,1,0,0,0]},
{ time: 73.50000 , d:[1,0,0,0,0]},
{ time: 73.81000 , d:[0,1,0,0,0]},
{ time: 74.37000 , d:[1,0,0,0,0]},
{ time: 75.02000 , d:[0,1,1,0,0]},
{ time: 75.48000 , d:[0,1,0,0,0]},
{ time: 75.94000 , d:[1,0,0,0,0]},
{ time: 76.27000 , d:[0,1,1,0,0]},
{ time: 77.19000 , d:[0,0,0,1,0]},
{ time: 77.39000 , d:[0,0,1,0,0]},
{ time: 77.60000 , d:[0,1,0,0,0]},
{ time: 77.99000 , d:[1,1,0,0,0]},
{ time: 78.39000 , d:[1,0,0,0,0]},
{ time: 78.72000 , d:[0,1,0,0,0]},
{ time: 79.41000 , d:[0,0,1,0,0]},
{ time: 80.10000 , d:[0,0,0,1,0]},
{ time: 80.97000 , d:[0,1,1,0,0]},
{ time: 81.43000 , d:[0,1,1,0,0]},
{ time: 82.59000 , d:[0,1,0,0,0]},
{ time: 82.99000 , d:[0,1,0,0,0]},
{ time: 83.41000 , d:[0,1,1,0,0]},
{ time: 83.78000 , d:[0,1,1,0,0]},
{ time: 84.62000 , d:[0,1,1,0,0]},
{ time: 84.84000 , d:[1,1,0,0,0]},
{ time: 85.10000 , d:[0,1,1,0,0]},
{ time: 85.98000 , d:[1,1,0,0,0]},
{ time: 86.36000 , d:[1,0,0,0,0]},
{ time: 87.26000 , d:[1,0,0,0,0]},
{ time: 87.57000 , d:[0,1,0,0,0]},
{ time: 88.00000 , d:[0,0,1,0,0]},
{ time: 88.43000 , d:[0,0,1,0,0]},
{ time: 88.75000 , d:[0,0,0,1,0]},
{ time: 89.36000 , d:[0,0,0,0,1]},
{ time: 90.12000 , d:[0,1,1,0,0]},
{ time: 90.51000 , d:[0,1,0,0,0]},
{ time: 90.79000 , d:[0,0,1,0,0]},
{ time: 91.06000 , d:[0,1,0,0,0]},
{ time: 91.38000 , d:[0,0,1,0,0]},
{ time: 91.71000 , d:[0,1,0,0,0]},
{ time: 92.02000 , d:[0,0,1,0,0]},
{ time: 92.31000 , d:[0,0,1,0,0]},
{ time: 92.61000 , d:[0,1,0,0,0]},
{ time: 92.89000 , d:[0,0,1,0,0]},
{ time: 93.19000 , d:[0,0,1,0,0]},
{ time: 93.51000 , d:[0,1,0,0,0]},
{ time: 93.84000 , d:[0,0,1,0,0]},
{ time: 94.15000 , d:[0,0,1,0,0]},
{ time: 94.49000 , d:[0,0,0,1,0]},
{ time: 94.78000 , d:[0,0,0,0,1]},
{ time: 95.12000 , d:[0,1,0,0,0]},
{ time: 95.43000 , d:[0,1,0,0,0]},
{ time: 95.73000 , d:[0,0,1,0,0]},
{ time: 96.03000 , d:[0,1,0,0,0]},
{ time: 96.36000 , d:[0,0,1,0,0]},
{ time: 96.67000 , d:[0,0,1,0,0]},
{ time: 96.96000 , d:[0,1,0,0,0]},
{ time: 97.30000 , d:[0,0,1,0,0]},
{ time: 97.62000 , d:[0,1,0,0,0]},
{ time: 97.91000 , d:[0,0,1,0,0]},
{ time: 98.20000 , d:[0,0,1,0,0]},
{ time: 98.52000 , d:[0,1,0,0,0]},
{ time: 98.82000 , d:[0,0,1,0,0]},
{ time: 99.12000 , d:[0,0,1,0,0]},
{ time: 99.43000 , d:[0,0,0,1,0]},
{ time: 99.74000 , d:[0,0,0,0,1]},
{ time: 100.05000 , d:[0,1,0,0,0]},
{ time: 100.35000 , d:[0,0,1,0,0]},
{ time: 100.65000 , d:[0,1,0,0,0]},
{ time: 100.98000 , d:[0,1,0,0,0]},
{ time: 101.30000 , d:[0,0,1,0,0]},
{ time: 101.63000 , d:[0,1,0,0,0]},
{ time: 101.97000 , d:[0,0,1,0,0]},
{ time: 102.27000 , d:[0,0,1,0,0]},
{ time: 102.57000 , d:[0,1,0,0,0]},
{ time: 102.89000 , d:[0,1,0,0,0]},
{ time: 103.20000 , d:[0,0,1,0,0]},
{ time: 103.52000 , d:[0,0,1,0,0]},
{ time: 103.85000 , d:[0,1,0,0,0]},
{ time: 104.16000 , d:[0,0,1,0,0]},
{ time: 104.48000 , d:[0,0,0,1,0]},
{ time: 104.78000 , d:[0,0,0,0,1]},
{ time: 105.11000 , d:[0,1,0,0,0]},
{ time: 105.45000 , d:[0,0,1,0,0]},
{ time: 105.74000 , d:[0,0,1,0,0]},
{ time: 106.04000 , d:[0,1,0,0,0]},
{ time: 106.35000 , d:[0,0,1,0,0]},
{ time: 106.66000 , d:[0,0,1,0,0]},
{ time: 106.99000 , d:[0,1,0,0,0]},
{ time: 107.27000 , d:[0,0,1,0,0]},
{ time: 107.58000 , d:[0,1,0,0,0]},
{ time: 107.87000 , d:[0,0,1,0,0]},
{ time: 108.18000 , d:[0,0,1,0,0]},
{ time: 108.51000 , d:[0,1,0,0,0]},
{ time: 108.82000 , d:[0,0,1,0,0]},
{ time: 109.16000 , d:[0,0,1,0,0]},
{ time: 109.49000 , d:[0,0,0,1,0]},
{ time: 109.80000 , d:[0,0,0,0,1]},
{ time: 110.13000 , d:[0,1,0,1,0]},
{ time: 112.14000 , d:[0,1,0,1,0]},
{ time: 112.82000 , d:[0,1,0,1,0]},
{ time: 113.34000 , d:[0,1,0,1,0]},
{ time: 113.73000 , d:[0,1,0,1,0]},
{ time: 114.54000 , d:[1,1,0,0,0]},
{ time: 114.92000 , d:[1,1,0,0,0]},
]
}
}
]
} | deminew/akihabara | resources/akibahero/bundle-song-demo.js | JavaScript | mit | 10,953 |
Package.describe({
summary: "Allows templates to be defined in .html files",
version: '1.1.1'
});
// Today, this package is closely intertwined with Handlebars, meaning
// that other templating systems will need to duplicate this logic. In
// the future, perhaps we should have the concept of a template system
// registry and a default templating system, ideally per-package.
Package.registerBuildPlugin({
name: "compileTemplatesBatch",
// minifiers is a weak dependency of spacebars-compiler; adding it here
// ensures that the output is minified. (Having it as a weak dependency means
// that we don't ship uglify etc with built apps just because
// boilerplate-generator uses spacebars-compiler.)
// XXX maybe uglify should be applied by this plugin instead of via magic
// weak dependency.
use: [
'minifiers',
'spacebars-compiler',
'caching-compiler',
'ecmascript'
],
sources: [
'plugin/html_scanner.js',
'plugin/compile-templates.js'
]
});
// This onUse describes the *runtime* implications of using this package.
Package.onUse(function (api) {
// XXX would like to do the following only when the first html file
// is encountered
api.addFiles('templating.js', 'client');
api.export('Template', 'client');
api.use('underscore'); // only the subset in packages/blaze/microscore.js
api.use('isobuild:compiler-plugin@1.0.0');
// html_scanner.js emits client code that calls Meteor.startup and
// Blaze, so anybody using templating (eg apps) need to implicitly use
// 'meteor' and 'blaze'.
api.use('blaze');
api.imply(['meteor', 'blaze'], 'client');
});
Package.onTest(function (api) {
api.use('tinytest');
api.use('htmljs');
api.use('templating');
api.use('underscore');
api.use(['test-helpers', 'session', 'tracker',
'minimongo'], 'client');
api.use('spacebars-compiler');
api.use('minifiers'); // ensure compiler output is beautified
api.addFiles([
'plugin/html_scanner.js',
'scanner_tests.js'
], 'server');
});
| esteedqueen/meteor | packages/templating/package.js | JavaScript | mit | 2,036 |
var Game = new function() {
var KEY_CODES = { 37:'left', 39:'right', 32 :'fire' };
this.keys = {};
this.initialize = function(canvas_dom,level_data,sprite_data,callbacks) {
this.canvas_elem = $(canvas_dom)[0];
this.canvas = this.canvas_elem.getContext('2d');
this.width = $(this.canvas_elem).attr('width');
this.height= $(this.canvas_elem).attr('height');
$(window).keydown(function(event) {
if(KEY_CODES[event.keyCode]) Game.keys[KEY_CODES[event.keyCode]] = true;
});
$(window).keyup(function(event) {
if(KEY_CODES[event.keyCode]) Game.keys[KEY_CODES[event.keyCode]] = false;
});
this.level_data = level_data;
this.callbacks = callbacks;
Sprites.load(sprite_data,this.callbacks['start']);
};
this.loadBoard = function(board) { Game.board = board; };
this.loop = function() {
Game.board.step(30/1000);
Game.board.render(Game.canvas);
setTimeout(Game.loop,30);
};
};
var Sprites = new function() {
this.map = { };
this.load = function(sprite_data,callback) {
this.map = sprite_data;
this.image = new Image();
this.image.onload = callback;
this.image.src = 'images/sprites.png';
};
this.draw = function(canvas,sprite,x,y,frame) {
var s = this.map[sprite];
if(!frame) frame = 0;
canvas.drawImage(this.image, s.sx + frame * s.w, s.sy, s.w, s.h, x,y, s.w, s.h);
};
}
var GameScreen = function GameScreen(text,text2,callback) {
this.step = function(dt) {
if(Game.keys['fire'] && callback) callback();
};
this.render = function(canvas) {
canvas.clearRect(0,0,Game.width,Game.height);
canvas.font = "bold 40px arial";
var measure = canvas.measureText(text);
canvas.fillStyle = "#FFFFFF";
canvas.fillText(text,Game.width/2 - measure.width/2,Game.height/2);
canvas.font = "bold 20px arial";
var measure2 = canvas.measureText(text2);
canvas.fillText(text2,Game.width/2 - measure2.width/2,Game.height/2 + 40);
};
};
var GameBoard = function GameBoard(level_number) {
this.removed_objs = [];
this.missiles = 0;
this.level = level_number;
var board = this;
this.add = function(obj) { obj.board=this; this.objects.push(obj); return obj; };
this.remove = function(obj) { this.removed_objs.push(obj); };
this.addSprite = function(name,x,y,opts) {
var sprite = this.add(new Sprites.map[name].cls(opts));
sprite.name = name;
sprite.x = x; sprite.y = y;
sprite.w = Sprites.map[name].w;
sprite.h = Sprites.map[name].h;
return sprite;
};
this.iterate = function(func) {
for(var i=0,len=this.objects.length;i<len;i++) {
func.call(this.objects[i]);
}
};
this.detect = function(func) {
for(var i = 0,val=null, len=this.objects.length; i < len; i++) {
if(func.call(this.objects[i])) return this.objects[i];
}
return false;
};
this.step = function(dt) {
this.removed_objs = [];
this.iterate(function() {
if(!this.step(dt)) this.die();
});
for(var i=0,len=this.removed_objs.length;i<len;i++) {
var idx = this.objects.indexOf(this.removed_objs[i]);
if(idx != -1) this.objects.splice(idx,1);
}
};
this.render = function(canvas) {
canvas.clearRect(0,0,Game.width,Game.height);
this.iterate(function() { this.draw(canvas); });
};
this.collision = function(o1,o2) {
return !((o1.y+o1.h-1<o2.y) || (o1.y>o2.y+o2.h-1) ||
(o1.x+o1.w-1<o2.x) || (o1.x>o2.x+o2.w-1));
};
this.collide = function(obj) {
return this.detect(function() {
if(obj != this && !this.invulnrable)
return board.collision(obj,this) ? this : false;
});
};
this.loadLevel = function(level) {
this.objects = [];
this.player = this.addSprite('player', // Sprite
Game.width/2, // X
Game.height - Sprites.map['player'].h - 10); // Y
var flock = this.add(new AlienFlock());
for(var y=0,rows=level.length;y<rows;y++) {
for(var x=0,cols=level[y].length;x<cols;x++) {
var alien = Sprites.map['alien' + level[y][x]];
if(alien) {
this.addSprite('alien' + level[y][x], // Which Sprite
(alien.w+10)*x, // X
alien.h*y, // Y
{ flock: flock }); // Options
}
}
}
};
this.nextLevel = function() {
return Game.level_data[level_number + 1] ? (level_number + 1) : false
};
this.loadLevel(Game.level_data[level_number]);
};
var GameAudio = new function() {
this.load_queue = [];
this.loading_sounds = 0;
this.sounds = {};
var channel_max = 10;
audio_channels = new Array();
for (a=0;a<channel_max;a++) {
audio_channels[a] = new Array();
audio_channels[a]['channel'] = new Audio();
audio_channels[a]['finished'] = -1;
}
this.load = function(files,callback) {
var audioCallback = function() { GameAudio.finished(callback); }
for(name in files) {
var filename = files[name];
this.loading_sounds++;
var snd = new Audio();
this.sounds[name] = snd;
snd.addEventListener('canplaythrough',audioCallback,false);
snd.src = filename;
snd.load();
}
};
this.finished = function(callback) {
this.loading_sounds--;
if(this.loading_sounds == 0) {
callback();
}
};
this.play = function(s) {
for (a=0;a<audio_channels.length;a++) {
thistime = new Date();
if (audio_channels[a]['finished'] < thistime.getTime()) {
audio_channels[a]['finished'] = thistime.getTime() + this.sounds[s].duration*1000;
audio_channels[a]['channel'].src = this.sounds[s].src;
audio_channels[a]['channel'].load();
audio_channels[a]['channel'].play();
break;
}
}
};
};
| TommyTura/AlienInvaders | js/engine.js | JavaScript | mit | 5,911 |
'use strict';
const path = require('path');
describe('PIXI.loaders.spritesheetParser', function ()
{
it('should exist and return a function', function ()
{
expect(PIXI.loaders.spritesheetParser).to.be.a('function');
expect(PIXI.loaders.spritesheetParser()).to.be.a('function');
});
it('should do nothing if the resource is not JSON', function ()
{
const spy = sinon.spy();
const res = {};
PIXI.loaders.spritesheetParser()(res, spy);
expect(spy).to.have.been.calledOnce;
expect(res.textures).to.be.undefined;
});
it('should do nothing if the resource is JSON, but improper format', function ()
{
const spy = sinon.spy();
const res = createMockResource(PIXI.loaders.Resource.TYPE.JSON, {});
PIXI.loaders.spritesheetParser()(res, spy);
expect(spy).to.have.been.calledOnce;
expect(res.textures).to.be.undefined;
});
it('should load the image & create textures if json is properly formatted', function ()
{
const spy = sinon.spy();
const res = createMockResource(PIXI.loaders.Resource.TYPE.JSON, getJsonSpritesheet());
const loader = new PIXI.loaders.Loader();
const addStub = sinon.stub(loader, 'add');
const imgRes = createMockResource(PIXI.loaders.Resource.TYPE.IMAGE, new Image());
imgRes.texture = new PIXI.Texture(new PIXI.BaseTexture(imgRes.data));
addStub.yields(imgRes);
PIXI.loaders.spritesheetParser().call(loader, res, spy);
addStub.restore();
expect(spy).to.have.been.calledOnce;
expect(addStub).to.have.been.calledWith(
`${res.name}_image`,
`${path.dirname(res.url)}/${res.data.meta.image}`
);
expect(res).to.have.property('textures')
.that.is.an('object')
.with.keys(Object.keys(getJsonSpritesheet().frames))
.and.has.property('0.png')
.that.is.an.instanceof(PIXI.Texture);
});
it('should build the image url', function ()
{
function getResourcePath(url, image)
{
return PIXI.loaders.getResourcePath({
url,
data: { meta: { image } },
});
}
let result = getResourcePath('http://some.com/spritesheet.json', 'img.png');
expect(result).to.be.equals('http://some.com/img.png');
result = getResourcePath('http://some.com/some/dir/spritesheet.json', 'img.png');
expect(result).to.be.equals('http://some.com/some/dir/img.png');
result = getResourcePath('http://some.com/some/dir/spritesheet.json', './img.png');
expect(result).to.be.equals('http://some.com/some/dir/img.png');
result = getResourcePath('http://some.com/some/dir/spritesheet.json', '../img.png');
expect(result).to.be.equals('http://some.com/some/img.png');
result = getResourcePath('/spritesheet.json', 'img.png');
expect(result).to.be.equals('/img.png');
result = getResourcePath('/some/dir/spritesheet.json', 'img.png');
expect(result).to.be.equals('/some/dir/img.png');
result = getResourcePath('/some/dir/spritesheet.json', './img.png');
expect(result).to.be.equals('/some/dir/img.png');
result = getResourcePath('/some/dir/spritesheet.json', '../img.png');
expect(result).to.be.equals('/some/img.png');
});
// TODO: Test that rectangles are created correctly.
// TODO: Test that bathc processing works correctly.
// TODO: Test that resolution processing works correctly.
// TODO: Test that metadata is honored.
});
function createMockResource(type, data)
{
const name = `${Math.floor(Date.now() * Math.random())}`;
return {
url: `http://localhost/doesnt_exist/${name}`,
name,
type,
data,
metadata: {},
};
}
function getJsonSpritesheet()
{
/* eslint-disable */
return {"frames": {
"0.png":
{
"frame": {"x":14,"y":28,"w":14,"h":14},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":14,"h":14},
"sourceSize": {"w":14,"h":14}
},
"1.png":
{
"frame": {"x":14,"y":42,"w":12,"h":14},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":12,"h":14},
"sourceSize": {"w":12,"h":14}
},
"2.png":
{
"frame": {"x":14,"y":14,"w":14,"h":14},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":14,"h":14},
"sourceSize": {"w":14,"h":14}
},
"3.png":
{
"frame": {"x":42,"y":0,"w":14,"h":14},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":14,"h":14},
"sourceSize": {"w":14,"h":14}
},
"4.png":
{
"frame": {"x":28,"y":0,"w":14,"h":14},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":14,"h":14},
"sourceSize": {"w":14,"h":14}
},
"5.png":
{
"frame": {"x":14,"y":0,"w":14,"h":14},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":14,"h":14},
"sourceSize": {"w":14,"h":14}
},
"6.png":
{
"frame": {"x":0,"y":42,"w":14,"h":14},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":14,"h":14},
"sourceSize": {"w":14,"h":14}
},
"7.png":
{
"frame": {"x":0,"y":28,"w":14,"h":14},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":14,"h":14},
"sourceSize": {"w":14,"h":14}
},
"8.png":
{
"frame": {"x":0,"y":14,"w":14,"h":14},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":14,"h":14},
"sourceSize": {"w":14,"h":14}
},
"9.png":
{
"frame": {"x":0,"y":0,"w":14,"h":14},
"rotated": false,
"trimmed": false,
"spriteSourceSize": {"x":0,"y":0,"w":14,"h":14},
"sourceSize": {"w":14,"h":14}
}},
"meta": {
"app": "http://www.texturepacker.com",
"version": "1.0",
"image": "hud.png",
"format": "RGBA8888",
"size": {"w":64,"h":64},
"scale": "1",
"smartupdate": "$TexturePacker:SmartUpdate:47025c98c8b10634b75172d4ed7e7edc$"
}
};
/* eslint-enable */
}
| staff0rd/pixi.js | test/loaders/spritesheetParser.js | JavaScript | mit | 6,529 |
/****************************************************************************
Copyright (c) 2014-2015 Chukong Technologies Inc.
http://www.cocos2d-x.org
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.
****************************************************************************/
(function () {
var INT_MAX = Number.MAX_VALUE;
var GROUP_JSON_PATH = "group.json";
cc.LoaderLayer = cc.Layer.extend({
_backgroundSprite: null,
_progressBackgroundSprite: null,
_progressBarSprite: null,
_logoSprite: null,
_titleSprite: null,
_groupname: null,
_callback: null,
_selector: null,
_preloadCount: 0,
_isPreloadFromFailed: false,
_progressOriginalWidth: 0,
_isLandScape: false,
_scaleFactor: null,
ctor: function (config) {
this._super();
if (config) {
cc.LoaderLayer.setConfig(config);
}
},
onEnter: function () {
this._super();
this.initView();
var config = cc.LoaderLayer._finalConfig;
if (config.onEnter) {
config.onEnter(this);
}
},
onExit: function () {
this._super();
var config = cc.LoaderLayer._finalConfig;
if (config.logo.action) {
config.logo.action.release();
}
if(config.title.action){
config.title.action.release();
}
if (config.onExit) {
config.onExit(this);
}
},
initView: function () {
var config = cc.LoaderLayer._finalConfig;
this._contentLayer = new cc.Layer();
this._isLandScape = cc.winSize.width > cc.winSize.height;
this._scaleFactor = !cc.LoaderLayer._useDefaultSource ? 1 : cc.winSize.width > cc.winSize.height ? cc.winSize.width / 720 : cc.winSize.width / 480;
//background
this.backgroundSprite = new cc.Sprite(config.background.res);
this.addChild(this.backgroundSprite);
this.backgroundSprite.x = 0, this.backgroundSprite.y = 0, this.backgroundSprite.anchorX = 0, this.backgroundSprite.anchorY = 0;
if (cc.LoaderLayer._useDefaultSource) {
this.backgroundSprite.scaleX = cc.winSize.width / this.backgroundSprite.width;
this.backgroundSprite.scaleY = cc.winSize.height / this.backgroundSprite.height;
}
//title
if (config.title.show) {
this.titleSprite = new cc.Sprite(config.title.res);
var defaultTitlePosition = cc.pAdd(cc.visibleRect.center, cc.p(0, this._scaleFactor < 1 ? 0 : this._isLandScape ? -80 : 30));
this.titleSprite.setPosition(config.title.position ? config.title.position : defaultTitlePosition);
this._contentLayer.addChild(this.titleSprite);
if (config.title.action) {
this.titleSprite.runAction(config.title.action);
}
}
//logo
if (config.logo.show) {
this.logoSprite = new cc.Sprite(config.logo.res);
var defaultLogoPosition = cc.pAdd(cc.visibleRect.top, cc.p(0, this._scaleFactor < 1 ? 0 : -this.logoSprite.height / 2 - (this._isLandScape ? 56 : 76)));
this.logoSprite.setPosition(config.logo.position ? config.logo.position : defaultLogoPosition);
this._contentLayer.addChild(this.logoSprite);
if (config.logo.action) {
this.logoSprite.runAction(config.logo.action);
}
}
//progressbar
if (config.progressBar.show) {
this.progressBarSprite = new cc.Sprite(config.progressBar.res);
this._progressOriginalWidth = this.progressBarSprite.width;
this.progressBackgroundSprite = new cc.Sprite(config.progressBar.barBackgroundRes);
this.progressBarSprite.anchorX = 0;
this.progressBarSprite.anchorY = 0;
if (cc.LoaderLayer._isDefaultProgress) {
this._barPoint = new cc.Sprite(config.progressBar.barPoint);
this.progressBarSprite.addChild(this._barPoint);
}
if (config.progressBar.barBackgroundRes == null) {
this.progressBackgroundSprite.setTextureRect(cc.rect(0, 0, this.progressBarSprite.width, this.progressBarSprite.height));
}
if (config.progressBar.offset == null) {
var deltaProgressWithX = (this.progressBackgroundSprite.width - this.progressBarSprite.width) / 2;
var deltaProgressWithY = (this.progressBackgroundSprite.height - this.progressBarSprite.height) / 2;
config.progressBar.offset = cc.p(deltaProgressWithX, deltaProgressWithY);
}
this.progressBarSprite.setPosition(config.progressBar.offset);
this.progressBackgroundSprite.addChild(this.progressBarSprite);
var defaultProgressPosition = cc.pAdd(cc.visibleRect.bottom, cc.p(0, this.progressBarSprite.height / 2 + this._isLandScape ? 60 : 80));
this.progressBackgroundSprite.setPosition(config.progressBar.position ? config.progressBar.position : defaultProgressPosition);
this._contentLayer.addChild(this.progressBackgroundSprite);
this._setProgress(0);
}
//tips
if (config.tips.show) {
this.tipsLabel = new cc.LabelTTF("100%", "Arial", config.tips.fontSize);
this.tipsLabel.setColor(config.tips.color);
this.tipsLabel.setPosition(config.tips.position ? config.tips.position : this.progressBackgroundSprite ? cc.p(this.progressBackgroundSprite.x, this.progressBackgroundSprite.y + this.progressBackgroundSprite.height / 2 + 20) : cc.pAdd(cc.visibleRect.bottom, cc.p(0, 100)));
this._contentLayer.addChild(this.tipsLabel);
}
this.addChild(this._contentLayer);
if (this._scaleFactor < 1) {
this._contentLayer.setScale(this._scaleFactor);
this._contentLayer.setPosition(cc.pAdd(this._contentLayer.getPosition(), cc.p(0, -50)));
}
},
_setProgress: function (percent) {
if (this.progressBarSprite) {
percent < 1 ? percent : 1;
var width = percent * this._progressOriginalWidth;
this.progressBarSprite.setTextureRect(cc.rect(0, 0, width, this.progressBarSprite.height));
if (cc.LoaderLayer._isDefaultProgress) {
this._barPoint.setPosition(cc.p(this.progressBarSprite.width, this.progressBarSprite.height / 2));
}
}
},
setTipsString: function (str) {
if (this.tipsLabel != null) {
this.tipsLabel.setString(str);
}
},
getProgressBar: function () {
return this.progressBarSprite;
},
getTipsLabel: function () {
return this.tipsLabel;
},
getLogoSprite: function () {
return this.logoSprite;
},
getTitleSprite: function () {
return this.titleSprite;
},
updateGroup: function (groupname, callback, target) {
this._groupname = groupname;
this._callback = callback;
this._selector = target;
},
_resetLoadingLabel: function () {
this.setTipsString("");
this._setProgress(0);
},
_preloadSource: function () {
cc.log("cc.LoaderLayer is preloading resource group: " + this._groupname);
this._resetLoadingLabel();
if (cc.sys.isNative) {
cc.Loader.preload(this._groupname, this._preload_native, this);
} else {
this._preload_html5();
}
},
_preload_html5: function () {
var res = "";
var groupIndex = [];
var config = cc.LoaderLayer._finalConfig;
var groups = cc.LoaderLayer.groups;
if (cc.isString(this._groupname)) {
if (this._groupname.indexOf(".") != -1) {
res = [this._groupname];
} else {
res = groups[this._groupname];
}
} else if (cc.isArray(this._groupname)) {
res = [];
for (var i = 0; i < this._groupname.length; i++) {
var group = groups[this._groupname[i]];
var files = group && group.files;
var preCount = i > 0 ? groupIndex[i - 1] : 0;
groupIndex.push(preCount + files ? files.length : 0);
res = res.concat(files);
}
}
var self = this;
//var progressFunction = self.config.progressCallback ? self.config.progressCallback : null;
cc.loader.load(res, function (result, count, loadedCount) {
var checkGroupName = function (loadedCount) {
for (var i = 0; i < groupIndex.length; i++) {
if (groupIndex[i] >= loadedCount) {
return self._groupname[i];
}
}
};
var groupName = checkGroupName(loadedCount);
var status = {
groupName: groupName,
isCompleted: false,
percent: (loadedCount / count * 100) | 0,//(float),
stage: 1, //(1 download,2 unzip)
isFailed: false
}
if (status.percent != 0) {
self._setProgress(status.percent / 100);
}
config.tips.tipsProgress(status, self);
}, function () {
self.removeFromParent();
self._preloadCount--;
if (self._callback) {
if (self._selector) {
self._callback(self._selector, true);
} else {
self._callback(true);
}
}
self._callback.call(this._target, !status.isFailed);
});
},
_preload_native: function (status) {
cc.log(JSON.stringify(status));
var config = cc.LoaderLayer._finalConfig;
if (status.percent) {
this._setProgress(status.percent / 100);
}
if (config.tips.tipsProgress) {
config.tips.tipsProgress(status, this);
}
if (status.isCompleted || status.isFailed) {
this._preloadCount--;
if (status.isCompleted) {
cc.log("preload finish!");
this._isPreloadFromFailed = false;
}
if (status.isFailed) {
cc.log("preload failed!");
this._isPreloadFromFailed = true;
}
// Remove loading layer from scene after loading was done.
if (this._preloadCount == 0 && !this._isPreloadFromFailed) {
this.removeFromParent();
if (cc.LoaderLayer._useDefaultSource) {
var _config = cc.runtime.config.design_resolution || {width: 480, height: 720, policy: "SHOW_ALL"};
cc.view.setDesignResolutionSize(_config.width, _config.height, cc.ResolutionPolicy[_config.policy]);
}
}
// Callback must be invoked after removeFromParent.
this._callback.call(this._target, status);
}
},
_addToScene: function () {
if (this._preloadCount == 0 && !this._isPreloadFromFailed) {
if (cc.sys.isNative && cc.LoaderLayer._useDefaultSource) {
var config = cc.runtime.config.design_resolution;
var isLandscape = false;
var isLargeThanResource = false;
if (config) {
var orientation = cc.runtime.config.orientation;
cc.log("_addToScene orientation is " + orientation);
if (orientation == "landscape") {
isLandscape = true;
isLargeThanResource = config.width > 720 || config.height > 480;
} else {
isLargeThanResource = config.width > 480 || config.height > 720;
}
}
cc.log("isLargeThanResource is " + isLargeThanResource);
cc.view.setDesignResolutionSize(isLargeThanResource ? config.width : isLandscape ? 720 : 480, isLargeThanResource ? config.height : isLandscape ? 480 : 720, cc.ResolutionPolicy["FIXED_HEIGHT"]);
}
cc.director.getRunningScene().addChild(this, INT_MAX - 1);
}
this._preloadCount++;
}
});
cc.LoaderLayer._config = {//default setting for loaderlayer
background: {
res: "res_engine/preload_bg.jpg"
},
title: {
show: true,
res: "res_engine/preload_title.png",
position: null,
action: null
},
logo: {
res: "res_engine/preload_logo.png",
show: true,
position: null
},
progressBar: {
show: true,
res: "res_engine/progress_bar.png",
offset: null,
position: null,
barBackgroundRes: "res_engine/progress_bg.png",
barPoint: "res_engine/progress_light.png",
barShadow: "res_engine/shadow.png"
},
tips: {
show: true,
fontSize: 22,
position: null,
color: null,
tipsProgress: function (status, loaderlayer) {
if(loaderlayer.getTipsLabel()){
var statusStr = "正在";
if (status.stage == cc.network.preloadstatus.DOWNLOAD) {
statusStr += "下载";
} else if (status.stage == cc.network.preloadstatus.UNZIP) {
statusStr += "解压";
}
if (status.groupName) {
statusStr += status.groupName;
}
statusStr += "进度:" + status.percent.toFixed(2) + "%";
loaderlayer.getTipsLabel().setString(statusStr);
}
}
},
progressCallback: function (progress) {
},
onEnter: function (layer) {
cc.log("LoaderLayer onEnter");
},
onExit: function (layer) {
cc.log("LoaderLayer onExit");
}
}
var res_engine_loaded = false;
cc.LoaderLayer.preload = function (groupname, callback, target) {
var loaderLayer = new cc.LoaderLayer();
var preloadCb = function (status) {
if (status.isFailed) {
var tips, conirmfunc, cancelfunc;
switch (status.errorCode) {
case "err_no_space":
{
tips = "空间不足,请清理磁盘空间";
conirmfunc = function () {
callPreload();
};
cancelfunc = function () {
cc.director.end();
};
break;
}
case "err_verify":
{
tips = "校验失败,是否重新下载?";
conirmfunc = function () {
callPreload();
}
cancelfunc = function () {
cc.director.end();
}
break;
}
case "err_network":
{
tips = "网络异常是否重新下载";
conirmfunc = function () {
callPreload();
}
cancelfunc = function () {
cc.director.end();
}
break;
}
default :
{
conirmfunc = cancelfunc = function () {
}
}
}
cc._NetworkErrorDialog._show(status.errorCode, tips, conirmfunc, cancelfunc);
} else {
if (callback) {
if (target) {
callback.call(target, !status.isFailed);
} else {
callback(!status.isFailed)
}
}
}
}
var callPreload = function () {
if (cc.director.getRunningScene()) {
loaderLayer.updateGroup(groupname, preloadCb, target);
loaderLayer._addToScene();
loaderLayer._preloadSource();
} else {
cc.log("Current scene is null we can't start preload");
}
};
if (res_engine_loaded) {
callPreload();
return;
}
// Res engine not loaded, load them
cc.loader.load([
GROUP_JSON_PATH,
cc.LoaderLayer._finalConfig.background.res,
cc.LoaderLayer._finalConfig.title.res,
cc.LoaderLayer._finalConfig.logo.res,
cc.LoaderLayer._finalConfig.progressBar.res,
cc.LoaderLayer._finalConfig.progressBar.barBackgroundRes,
cc.LoaderLayer._finalConfig.progressBar.barPoint,
cc.LoaderLayer._finalConfig.progressBar.barShadow,
cc.Dialog._finalConfig.background.res,
cc.Dialog._finalConfig.confirmBtn.normalRes,
cc.Dialog._finalConfig.confirmBtn.pressRes,
cc.Dialog._finalConfig.cancelBtn.normalRes,
cc.Dialog._finalConfig.cancelBtn.pressRes
],
function (result, count, loadedCount) {
var percent = (loadedCount / count * 100) | 0;
percent = Math.min(percent, 100);
cc.log("Preloading engine resources... " + percent + "%");
}, function () {
var groups = cc.loader.getRes(GROUP_JSON_PATH);
if (groups) {
cc.LoaderLayer.groups = groups;
}
else {
cc.warn("Group versions haven't been loaded, you can also set group data with 'cc.LoaderLayer.groups'");
}
res_engine_loaded = true;
callPreload();
});
};
cc.LoaderLayer._useDefaultSource = true;
cc.LoaderLayer._isDefaultProgress = true;
cc.LoaderLayer._finalConfig = cc.LoaderLayer._confg;
cc.LoaderLayer.groups = {};
cc.LoaderLayer.setUseDefaultSource = function (status) {
cc.LoaderLayer._useDefaultSource = status;
};
cc.LoaderLayer.setConfig = function (config) {
if(config.title && config.title.action){
config.title.action.retain();
}
if(config.logo && config.logo.action){
config.logo.action.retain();
}
this._initData(config);
};
cc.LoaderLayer._initData = function (uConfig) {
this._finalConfig = cc.clone(this._config);
var config = this._finalConfig;
if (uConfig != null) {
if (uConfig.background && uConfig.background.res) {
config.background.res = uConfig.background.res;
}
if (uConfig.title) {
var uTitle = uConfig.title;
var title = config.title;
title.show = typeof uTitle.show != "undefined" ? uTitle.show : title.show;
title.res = uTitle.res ? uTitle.res : title.res;
title.position = uTitle.position ? uTitle.position : title.position;
title.action = uTitle.action ? uTitle.action : title.action;
if (title.action) {
title.action = uTitle.action;
title.action.retain();
}
}
if (uConfig.logo) {
var uLogo = uConfig.logo;
var logo = config.logo;
logo.show = typeof uLogo.show != "undefined" ? uLogo.show : logo.show;
logo.res = uLogo.res ? uLogo.res : logo.res;
logo.position = uLogo.position ? uLogo.position : logo.position;
if (typeof uLogo.action != "undefined") {
logo.action = uLogo.action;
if (logo.action) {
logo.action.retain();
}
}
}
if (uConfig.progressBar) {
var uProgress = uConfig.progressBar;
var progress = config.progressBar;
progress.show = typeof uProgress.show != "undefined" ? uProgress.show : progress.show;
if (uProgress.res) {
progress.res = uProgress.res;
this._isDefaultProgress = false;
}
progress.offset = uProgress.offset ? uProgress.offset : progress.offset;
progress.position = uProgress.position ? uProgress.position : progress.position;
progress.barBackgroundRes = uProgress.barBackgroundRes ? uProgress.barBackgroundRes : progress.barBackgroundRes;
}
if (uConfig.tips) {
var uTips = uConfig.tips;
var tips = config.tips;
tips.show = typeof uTips.show != "undefined" ? uTips.show : tips.show;
tips.res = uTips.res ? uTips.res : tips.res;
tips.offset = uTips.offset ? uTips.offset : tips.offset;
tips.fontSize = uTips.fontSize ? uTips.fontSize : tips.fontSize;
tips.position = uTips.position ? uTips.position : tips.position;
tips.color = uTips.color ? uTips.color : tips.color;
if (uConfig.tips.tipsProgress && typeof uConfig.tips.tipsProgress == "function") {
tips.tipsProgress = uConfig.tips.tipsProgress;
}
}
if (typeof uConfig.onEnter == "function") {
config.onEnter = uConfig.onEnter;
}
if (typeof uConfig.onExit == "function") {
config.onExit = uConfig.onExit;
}
}
if (typeof config.logo.action == "undefined" && this._useDefaultSource) {
config.logo.action = cc.sequence(
cc.spawn(cc.moveBy(0.4, cc.p(0, 40)).easing(cc.easeIn(0.5)), cc.scaleTo(0.4, 0.95, 1.05).easing(cc.easeIn(0.5))),
cc.delayTime(0.08),
cc.spawn(cc.moveBy(0.4, cc.p(0, -40)).easing(cc.easeOut(0.5)), cc.scaleTo(0.4, 1.05, 0.95).easing(cc.easeOut(0.5)))
).repeatForever();
config.logo.action.retain();
}
if (!config.tips.color) {
config.tips.color = cc.color(255, 255, 255);
}
};
cc.Dialog = cc.Layer.extend({
_defaultConfig: null,
backgroundSprite: null,
_menuItemConfirm: null,
_menuItemCancel: null,
_messageLabel: null,
_eventListener: null,
_scaleFactor: null,
ctor: function (config) {
this._super();
this.setConfig(config);
},
setConfig: function (config) {
this.removeAllChildren();
if (config) {
cc.Dialog.setConfig(config);
}
},
initView: function () {
var useDefaultSource = cc.Dialog._useDefaultSource;
var winSize = cc.director.getWinSize();
this._scaleFactor = !useDefaultSource ? 1 : winSize.width > winSize.height ? winSize.width / 720 : winSize.width / 480;
var config = cc.Dialog._finalConfig;
//bg
this.backgroundSprite = new cc.Scale9Sprite(config.background.res);
this._setScale(this.backgroundSprite);
if (this._scaleFactor < 1) {
this.backgroundSprite.setScale(this._scaleFactor);
}
this.backgroundSprite.setPosition(config.position ? config.position : cc.p(winSize.width / 2, winSize.height / 2));
//menu
this.menuItemConfirm = this._createMenuItemSprite(config.confirmBtn, this._confirmCallback);
this.menuItemCancel = this._createMenuItemSprite(config.cancelBtn, this._cancelCallback);
this.menuItemCancel.setPosition(config.cancelBtn.position ? config.cancelBtn.position : cc.p(this.backgroundSprite.width / 2 - this.menuItemCancel.width / 2 - 20, this.menuItemCancel.height + 20));
this.menuItemConfirm.setPosition(config.confirmBtn.position ? config.confirmBtn.position : cc.p(this.backgroundSprite.width / 2 + this.menuItemConfirm.width / 2 + 20, this.menuItemConfirm.height + 20));
var menu = new cc.Menu(this.menuItemConfirm, this.menuItemCancel);
menu.setPosition(cc.p(0, 0));
this.backgroundSprite.addChild(menu);
//message
var fontSize = config.messageLabel.fontSize ? config.messageLabel.fontSize : this._scaleFactor > 1 ? 16 * this._scaleFactor : 16;
this.messageLabel = new cc.LabelTTF(config.messageLabel.text, "Arial", fontSize);
this.messageLabel.setDimensions(config.messageLabel.dimensions ? config.messageLabel.dimensions : cc.size(this.backgroundSprite.width - 30, this.backgroundSprite.height - this.menuItemConfirm.y - 10));
this.messageLabel.setColor(config.messageLabel.color ? config.messageLabel.color : cc.color(255, 255, 255));
this.messageLabel.setPosition(config.messageLabel.position ? config.messageLabel.position : cc.p(this.backgroundSprite.width / 2, this.backgroundSprite.height - this.messageLabel.height / 2 - 20));
this.backgroundSprite.addChild(this.messageLabel);
if (!config.action) {
var action = cc.sequence(cc.EaseIn.create(cc.scaleTo(0.1, this.backgroundSprite.scale + 0.02), 0.4), cc.EaseOut.create(cc.scaleTo(0.1, this.backgroundSprite.scale), 0.3));
this.backgroundSprite.runAction(action);
} else {
this.backgroundSprite.runAction(config.action);
}
this.addChild(this.backgroundSprite);
},
_createMenuItemSprite: function (res, callback) {
var spriteNormal = new cc.Scale9Sprite(res.normalRes);
var spritePress = new cc.Scale9Sprite(res.pressRes);
this._setScale(spriteNormal);
this._setScale(spritePress);
var fontSize = res.fontSize ? res.fontSize : this._scaleFactor > 1 ? 16 * this._scaleFactor : 16;
var menuLabel = new cc.LabelTTF(res.text, "Arial", fontSize);
menuLabel.setColor(res.textColor);
var menuItem = new cc.MenuItemSprite(spriteNormal, spritePress, callback, this);
menuLabel.setPosition(cc.p(menuItem.width / 2, menuItem.height / 2));
menuItem.addChild(menuLabel);
return menuItem;
},
_setScale: function (s9Sprite) {
if (this._scaleFactor > 1) {
s9Sprite.setContentSize(cc.size(this._scaleFactor * s9Sprite.width, this._scaleFactor * s9Sprite.height));
}
},
_confirmCallback: function () {
var config = cc.Dialog._finalConfig;
if (config.confirmBtn.callback) {
if (config.target) {
config.confirmBtn.callback.call(config.target, this);
} else {
config.confirmBtn.callback(this);
}
}
this.removeFromParent();
},
_cancelCallback: function () {
var config = cc.Dialog._finalConfig;
if (config.cancelBtn.callback) {
if (config.target) {
config.cancelBtn.callback.call(config.target, this);
} else {
config.cancelBtn.callback(this);
}
}
this.removeFromParent();
},
onEnter: function () {
this._super();
var config = cc.Dialog._finalConfig;
this.initView();
config.onEnter(this);
var self = this;
self._eventListener = cc.EventListener.create({
event: cc.EventListener.TOUCH_ONE_BY_ONE,
swallowTouches: true,
onTouchBegan: function (touch, event) {
return true;
}
});
cc.eventManager.addListener(self._eventListener, self);
},
onExit: function () {
this._super();
var config = cc.Dialog._finalConfig;
config.onExit(this);
this.removeAllChildren();
cc.Dialog._dialog = null;
cc.eventManager.removeListener(this._eventListener);
}
});
cc.Dialog._dialog = null;
cc.Dialog._clearDialog = function () {
if (cc.Dialog._dialog != null) {
cc.Dialog._dialog.removeFromParent();
cc.Dialog._dialog = null;
}
}
cc.Dialog.show = function (tips, confirmCb, cancelCb) {
if (cc.Dialog._dialog != null) {
cc.log("other dialog is on the screen,this dialog can't show now");
return;
}
var conf;
if (typeof tips == "string") {
conf = {
messageLabel: {
text: tips
},
confirmBtn: {
callback: confirmCb
},
cancelBtn: {
callback: cancelCb
}
}
} else if (typeof tips == "object") {
conf = tips;
} else {
cc.log("tips is invalid");
return;
}
cc.Dialog._dialog = new cc.Dialog(conf);
if (cc.director.getRunningScene()) {
cc.director.getRunningScene().addChild(cc.Dialog._dialog, INT_MAX);
} else {
cc.log("Current scene is null we can't show dialog");
}
};
cc.Dialog._useDefaultSource = true;
cc.Dialog.setUseDefaultSource = function (status) {
cc.Dialog._useDefaultSource = status;
}
cc.Dialog._defaultConfig = {
position: null,
target: null,
action: null,
background: {
res: "res_engine/dialog_bg.png"
},
confirmBtn: {
normalRes: "res_engine/dialog_confirm_normal.png",
pressRes: "res_engine/dialog_confirm_press.png",
text: "确定",
textColor: null,
fontSize: null,
position: null,
callback: function () {
cc.log("this is confirm callback");
}
},
cancelBtn: {
normalRes: "res_engine/dialog_cancel_normal.png",
pressRes: "res_engine/dialog_cancel_press.png",
text: "取消",
textColor: null,
position: null,
fontSize: null,
callback: function () {
cc.log("this is cancel callback");
}
},
messageLabel: {
text: "",
color: null,
dimensions: null,
fontSize: null,
position: null
},
onEnter: function (dialog) {
cc.log("dialog call onEnter");
},
onExit: function (dialog) {
cc.log("dialog call onExit");
}
};
cc.Dialog._finalConfig = cc.Dialog._defaultConfig;
cc.Dialog.setConfig = function (config) {
this._initData(config);
};
cc.Dialog._initData = function (uConfig) {
this._finalConfig = cc.clone(this._defaultConfig);
var config = this._finalConfig;
if (uConfig != null) {
if (uConfig.position) {
config.position = uConfig.position;
}
if (uConfig.action) {
config.action = uConfig.action;
}
if (uConfig.background && uConfig.background.res) {
config.background = uConfig.background;
}
if (uConfig.confirmBtn) {
var uConfirmBtn = uConfig.confirmBtn;
var confirmBtn = config.confirmBtn;
confirmBtn.normalRes = uConfirmBtn.normalRes ? uConfirmBtn.normalRes : confirmBtn.normalRes;
confirmBtn.pressRes = uConfirmBtn.pressRes ? uConfirmBtn.pressRes : confirmBtn.pressRes;
confirmBtn.text = typeof uConfirmBtn.text != "undefined" ? uConfirmBtn.text : confirmBtn.text;
confirmBtn.textColor = uConfirmBtn.textColor ? uConfirmBtn.textColor : confirmBtn.textColor;
confirmBtn.fontSize = uConfirmBtn.fontSize ? uConfirmBtn.fontSize : confirmBtn.fontSize;
confirmBtn.position = uConfirmBtn.position ? uConfirmBtn.position : confirmBtn.position;
confirmBtn.callback = uConfirmBtn.callback ? uConfirmBtn.callback : confirmBtn.callback;
}
if (uConfig.cancelBtn) {
var uCancelBtn = uConfig.cancelBtn;
var cancelBtn = config.cancelBtn;
cancelBtn.normalRes = uCancelBtn.normalRes ? uCancelBtn.normalRes : cancelBtn.normalRes;
cancelBtn.pressRes = uCancelBtn.pressRes ? uCancelBtn.pressRes : cancelBtn.pressRes;
cancelBtn.text = typeof uCancelBtn.text != "undefined" ? uCancelBtn.text : cancelBtn.text;
cancelBtn.textColor = uCancelBtn.textColor ? uCancelBtn.textColor : cancelBtn.textColor;
cancelBtn.fontSize = uCancelBtn.fontSize ? uCancelBtn.fontSize : cancelBtn.fontSize;
cancelBtn.position = uCancelBtn.position ? uCancelBtn.position : cancelBtn.position;
cancelBtn.callback = uCancelBtn.callback ? uCancelBtn.callback : cancelBtn.callback;
}
if (uConfig.messageLabel) {
var uMessageLabel = uConfig.messageLabel;
var messageLabel = config.messageLabel;
messageLabel.text = typeof uMessageLabel.text != "undefined" ? uMessageLabel.text : messageLabel.text;
messageLabel.color = uMessageLabel.color ? uMessageLabel.color : messageLabel.color;
messageLabel.fontSize = uMessageLabel.fontSize ? uMessageLabel.fontSize : messageLabel.fontSize;
messageLabel.position = uMessageLabel.position ? uMessageLabel.position : messageLabel.position;
messageLabel.dimensions = uMessageLabel.dimensions ? uMessageLabel.dimensions : messageLabel.dimensions;
}
if (uConfig.target) {
config.target = uConfig.target;
}
if (typeof uConfig.onEnter == "function") {
config.onEnter = uConfig.onEnter;
}
if (typeof uConfig.onExit == "function") {
config.onExit = uConfig.onExit;
}
}
if (!config.cancelBtn.textColor) {
config.cancelBtn.textColor = cc.color(255, 255, 255);
}
if (!config.confirmBtn.textColor) {
config.confirmBtn.textColor = cc.color(255, 255, 255);
}
};
cc._NetworkErrorDialog = function () {
cc.Dialog._clearDialog();
cc.Dialog._dialog = new cc.Dialog(cc._NetworkErrorDialog._config);
return cc.Dialog._dialog;
}
cc._NetworkErrorDialog._config = {
networkError: {},
spaceError: {},
verifyError: {}
};
cc._NetworkErrorDialog._show = function (type, tips, confirmCb, cancelCb) {
var networkDialog = cc._NetworkErrorDialog();
var config;
switch (type) {
case "err_network":
{
config = cc._NetworkErrorDialog._config.networkError;
break;
}
case "err_no_space":
{
config = cc._NetworkErrorDialog._config.spaceError;
break;
}
case "err_verify":
{
config = cc._NetworkErrorDialog._config.verifyError;
break;
}
default:
{
cc.log("type is not found");
return;
}
}
if (!networkDialog.getParent()) {
config.confirmBtn = config.confirmBtn || {};
config.confirmBtn.callback = function () {
if (confirmCb)
confirmCb();
}
config.cancelBtn = config.cancelBtn || {};
config.cancelBtn.callback = function () {
if (cancelCb)
cancelCb();
}
config.messageLabel = config.messageLabel || {};
if (typeof config.messageLabel.text == "undefined") {
config.messageLabel.text = tips;
}
networkDialog.setConfig(config);
if (cc.director.getRunningScene()) {
cc.director.getRunningScene().addChild(networkDialog, INT_MAX);
} else {
cc.log("Current scene is null we can't show dialog");
}
}
}
cc._NetworkErrorDialog._setConfig = function (key, config) {
if (key && config) {
switch (key) {
case "err_network":
{
cc._NetworkErrorDialog._config.networkError = config;
break;
}
case "err_no_space":
{
cc._NetworkErrorDialog._config.spaceError = config;
break;
}
case "err_verify":
{
cc._NetworkErrorDialog._config.verifyError = config;
break;
}
}
}
}
cc.runtime = cc.runtime || {};
cc.runtime.setOption = function (promptype, config) {
if (config) {
switch (promptype) {
case "network_error_dialog":
{
cc._NetworkErrorDialog._setConfig("err_network", config);
break;
}
case "no_space_error_dialog":
{
cc._NetworkErrorDialog._setConfig("err_no_space", config);
break;
}
case "verify_error_dialog":
{
cc._NetworkErrorDialog._setConfig("err_verify", config);
break;
}
default :
{
cc.log("promptype not found please check your promptype");
}
}
} else {
cc.log("config is null please check your config");
}
}
/**
* only use in JSB get network type
* @type {{}|*|cc.network}
*/
cc.network = cc.network || {};
cc.network.type = {
NO_NETWORK: -1,
MOBILE: 0,
WIFI: 1
}
cc.network.preloadstatus = {
DOWNLOAD: 1,
UNZIP: 2
}
cc.runtime.network = cc.network;
})();
| i-z/cocos2d-x-samples | samples/MoonWarriors/frameworks/cocos2d-html5/extensions/runtime/CCLoaderLayer.js | JavaScript | mit | 37,627 |
/* global it, expect, describe */
import React from 'react'
import { shallow } from 'enzyme'
import renderer from 'react-test-renderer'
import App from '../pages/index.js'
describe('With Enzyme', () => {
it('App shows "Hello world!"', () => {
const app = shallow(
<App />
)
expect(app.find('p').text()).toEqual('Hello World!')
})
})
describe('With Snapshot Testing', () => {
it('App shows "Hello world!"', () => {
const component = renderer.create(<App />)
const tree = component.toJSON()
expect(tree).toMatchSnapshot()
})
})
| nahue/next.js | examples/with-jest/__tests__/index.test.js | JavaScript | mit | 568 |
'use strict';
const withGL = require('../withGL');
describe('PIXI.Graphics', function ()
{
describe('constructor', function ()
{
it('should set defaults', function ()
{
const graphics = new PIXI.Graphics();
expect(graphics.fillAlpha).to.be.equals(1);
expect(graphics.lineWidth).to.be.equals(0);
expect(graphics.lineColor).to.be.equals(0);
expect(graphics.tint).to.be.equals(0xFFFFFF);
expect(graphics.blendMode).to.be.equals(PIXI.BLEND_MODES.NORMAL);
});
});
describe('lineTo', function ()
{
it('should return correct bounds - north', function ()
{
const graphics = new PIXI.Graphics();
graphics.moveTo(0, 0);
graphics.lineStyle(1);
graphics.lineTo(0, 10);
expect(graphics.width).to.be.below(1.00001);
expect(graphics.width).to.be.above(0.99999);
expect(graphics.height).to.be.equals(10);
});
it('should return correct bounds - south', function ()
{
const graphics = new PIXI.Graphics();
graphics.moveTo(0, 0);
graphics.lineStyle(1);
graphics.lineTo(0, -10);
expect(graphics.width).to.be.below(1.00001);
expect(graphics.width).to.be.above(0.99999);
expect(graphics.height).to.be.equals(10);
});
it('should return correct bounds - east', function ()
{
const graphics = new PIXI.Graphics();
graphics.moveTo(0, 0);
graphics.lineStyle(1);
graphics.lineTo(10, 0);
expect(graphics.height).to.be.equals(1);
expect(graphics.width).to.be.equals(10);
});
it('should return correct bounds - west', function ()
{
const graphics = new PIXI.Graphics();
graphics.moveTo(0, 0);
graphics.lineStyle(1);
graphics.lineTo(-10, 0);
expect(graphics.height).to.be.above(0.9999);
expect(graphics.height).to.be.below(1.0001);
expect(graphics.width).to.be.equals(10);
});
it('should return correct bounds when stacked with circle', function ()
{
const graphics = new PIXI.Graphics();
graphics.beginFill(0xFF0000);
graphics.drawCircle(50, 50, 50);
graphics.endFill();
expect(graphics.width).to.be.equals(100);
expect(graphics.height).to.be.equals(100);
graphics.lineStyle(20, 0);
graphics.moveTo(25, 50);
graphics.lineTo(75, 50);
expect(graphics.width).to.be.equals(100);
expect(graphics.height).to.be.equals(100);
});
it('should return correct bounds when square', function ()
{
const graphics = new PIXI.Graphics();
graphics.lineStyle(20, 0, 0.5);
graphics.moveTo(0, 0);
graphics.lineTo(50, 0);
graphics.lineTo(50, 50);
graphics.lineTo(0, 50);
graphics.lineTo(0, 0);
expect(graphics.width).to.be.equals(70);
expect(graphics.height).to.be.equals(70);
});
});
describe('containsPoint', function ()
{
it('should return true when point inside', function ()
{
const point = new PIXI.Point(1, 1);
const graphics = new PIXI.Graphics();
graphics.beginFill(0);
graphics.drawRect(0, 0, 10, 10);
expect(graphics.containsPoint(point)).to.be.true;
});
it('should return false when point outside', function ()
{
const point = new PIXI.Point(20, 20);
const graphics = new PIXI.Graphics();
graphics.beginFill(0);
graphics.drawRect(0, 0, 10, 10);
expect(graphics.containsPoint(point)).to.be.false;
});
it('should return false when no fill', function ()
{
const point = new PIXI.Point(1, 1);
const graphics = new PIXI.Graphics();
graphics.drawRect(0, 0, 10, 10);
expect(graphics.containsPoint(point)).to.be.false;
});
it('should return false with hole', function ()
{
const point1 = new PIXI.Point(1, 1);
const point2 = new PIXI.Point(5, 5);
const graphics = new PIXI.Graphics();
graphics.beginFill(0)
.moveTo(0, 0)
.lineTo(10, 0)
.lineTo(10, 10)
.lineTo(0, 10)
// draw hole
.moveTo(2, 2)
.lineTo(8, 2)
.lineTo(8, 8)
.lineTo(2, 8)
.addHole();
expect(graphics.containsPoint(point1)).to.be.true;
expect(graphics.containsPoint(point2)).to.be.false;
});
});
describe('arc', function ()
{
it('should draw an arc', function ()
{
const graphics = new PIXI.Graphics();
expect(graphics.currentPath).to.be.null;
expect(() => graphics.arc(100, 30, 20, 0, Math.PI)).to.not.throw();
expect(graphics.currentPath).to.be.not.null;
});
it('should not throw with other shapes', function ()
{
// complex drawing #1: draw triangle, rounder rect and an arc (issue #3433)
const graphics = new PIXI.Graphics();
// set a fill and line style
graphics.beginFill(0xFF3300);
graphics.lineStyle(4, 0xffd900, 1);
// draw a shape
graphics.moveTo(50, 50);
graphics.lineTo(250, 50);
graphics.lineTo(100, 100);
graphics.lineTo(50, 50);
graphics.endFill();
graphics.lineStyle(2, 0xFF00FF, 1);
graphics.beginFill(0xFF00BB, 0.25);
graphics.drawRoundedRect(150, 450, 300, 100, 15);
graphics.endFill();
graphics.beginFill();
graphics.lineStyle(4, 0x00ff00, 1);
expect(() => graphics.arc(300, 100, 20, 0, Math.PI)).to.not.throw();
});
it('should do nothing when startAngle and endAngle are equal', function ()
{
const graphics = new PIXI.Graphics();
expect(graphics.currentPath).to.be.null;
graphics.arc(0, 0, 10, 0, 0);
expect(graphics.currentPath).to.be.null;
});
it('should do nothing if sweep equals zero', function ()
{
const graphics = new PIXI.Graphics();
expect(graphics.currentPath).to.be.null;
graphics.arc(0, 0, 10, 10, 10);
expect(graphics.currentPath).to.be.null;
});
});
describe('_calculateBounds', function ()
{
it('should only call updateLocalBounds once', function ()
{
const graphics = new PIXI.Graphics();
const spy = sinon.spy(graphics, 'updateLocalBounds');
graphics._calculateBounds();
expect(spy).to.have.been.calledOnce;
graphics._calculateBounds();
expect(spy).to.have.been.calledOnce;
});
});
describe('fastRect', function ()
{
it('should calculate tint, alpha and blendMode of fastRect correctly', withGL(function ()
{
const renderer = new PIXI.WebGLRenderer(200, 200, {});
try
{
const graphics = new PIXI.Graphics();
graphics.beginFill(0x102030, 0.6);
graphics.drawRect(2, 3, 100, 100);
graphics.endFill();
graphics.tint = 0x101010;
graphics.blendMode = 2;
graphics.alpha = 0.3;
renderer.render(graphics);
expect(graphics.isFastRect()).to.be.true;
const sprite = graphics._spriteRect;
expect(sprite).to.not.be.equals(null);
expect(sprite.worldAlpha).to.equals(0.18);
expect(sprite.blendMode).to.equals(2);
expect(sprite.tint).to.equals(0x010203);
const bounds = sprite.getBounds();
expect(bounds.x).to.equals(2);
expect(bounds.y).to.equals(3);
expect(bounds.width).to.equals(100);
expect(bounds.height).to.equals(100);
}
finally
{
renderer.destroy();
}
}));
});
});
| themoonrat/pixi.js | test/core/Graphics.js | JavaScript | mit | 8,630 |
/* global server */
import Ember from 'ember';
import {module, test} from 'qunit';
import startApp from '../helpers/start-app';
var application;
module('Acceptance: Create new app', {
beforeEach: function() {
application = startApp();
server.create('host_app', { id: 'current' });
},
afterEach: function() {
Ember.run(application, 'destroy');
}
});
test('I should not see the new app form when I visit the page', function(assert) {
visit("/");
assertExists(".New-app-form", 0);
});
test('I should see the new app form when I click the new app button', function(assert) {
visit("/");
click(".new-app-button");
assertExists(".New-app-form");
});
test('I should not be able to create a new app without entering a name', function(assert) {
visit("/");
click(".new-app-button");
click(".New-app-form__create");
assertExists(".form-group.has-error .New-app-form__name");
});
test("I should be able to cancel adding a new app", function(assert) {
visit("/");
click(".new-app-button");
click(".New-app-form__cancel");
assertExists(".New-app-form", 0);
});
test('I should be able to create a new app', function(assert) {
visit("/");
click(".new-app-button");
fillIn(".New-app-form__name", "Test app");
click(".New-app-form__create");
assertExists(".New-app-form", 0);
assertExists(".App-card");
});
| tedconf/front_end_builds | admin/tests/acceptance/create-new-app-test.js | JavaScript | mit | 1,362 |
var utils = require('../../../utils');
module.exports = function LocalFileType(config) {
var self = {
selector: '.field-type-localfile[for="' + config.fieldName + '"]',
elements: {
label: '.FormLabel',
button: '.file-toolbar .Button--default',
},
commands: [{
assertUI: function() {
this
.expect.element('@label').to.be.visible;
this
.expect.element('@label').text.to.equal(utils.titlecase(config.fieldName));
this
.expect.element('@button').to.be.visible;
return this;
},
}],
};
return self;
};
| michaelerobertsjr/keystone | test/e2e/adminUI/pages/fieldTypes/localFile.js | JavaScript | mit | 554 |
function test() {
var i, names = ["anchor", "fontcolor", "fontsize", "link"];
for (i = 0; i < names.length; i++) {
if (""[names[i]]('"') !== ""[names[i]]('&' + 'quot;')) {
return false;
}
}
return true;
}
if (!test())
throw new Error("Test failed");
| Debian/openjfx | modules/web/src/main/native/Source/JavaScriptCore/tests/es6/String.prototype_HTML_methods_quotes_in_arguments_are_escaped.js | JavaScript | gpl-2.0 | 272 |
var Immutable = require('immutable');
var SummaryArticle = require('./summaryArticle');
/*
A part represents a section in the Summary / table of Contents
*/
var SummaryPart = Immutable.Record({
level: String(),
title: String(),
articles: Immutable.List()
});
SummaryPart.prototype.getLevel = function() {
return this.get('level');
};
SummaryPart.prototype.getTitle = function() {
return this.get('title');
};
SummaryPart.prototype.getArticles = function() {
return this.get('articles');
};
/**
* Create a new level for a new child article
*
* @return {String}
*/
SummaryPart.prototype.createChildLevel = function() {
var level = this.getLevel();
var subArticles = this.getArticles();
var childLevel = level + '.' + (subArticles.size + 1);
return childLevel;
};
/**
* Create a SummaryPart
*
* @param {Object} def
* @return {SummaryPart}
*/
SummaryPart.create = function(def, level) {
var articles = (def.articles || []).map(function(article, i) {
if (article instanceof SummaryArticle) {
return article;
}
return SummaryArticle.create(article, [level, i + 1].join('.'));
});
return new SummaryPart({
level: String(level),
title: def.title,
articles: Immutable.List(articles)
});
};
module.exports = SummaryPart;
| hhkaos/awesome-arcgis | node_modules/gitbook/lib/models/summaryPart.js | JavaScript | gpl-3.0 | 1,370 |
import { Meteor } from "meteor/meteor";
import { expect } from "meteor/practicalmeteor:chai";
import { sinon } from "meteor/practicalmeteor:sinon";
import { ExampleApi } from "./exampleapi";
const paymentMethod = {
processor: "Generic",
storedCard: "Visa 4242",
status: "captured",
mode: "authorize",
createdAt: new Date()
};
describe("ExampleApi", function () {
let sandbox;
beforeEach(function () {
sandbox = sinon.sandbox.create();
});
afterEach(function () {
sandbox.restore();
});
it("should return data from ThirdPartyAPI authorize", function () {
const cardData = {
name: "Test User",
number: "4242424242424242",
expireMonth: "2",
expireYear: "2018",
cvv2: "123",
type: "visa"
};
const paymentData = {
currency: "USD",
total: "19.99"
};
const transactionType = "authorize";
const transaction = ExampleApi.methods.authorize.call({
transactionType: transactionType,
cardData: cardData,
paymentData: paymentData
});
expect(transaction).to.not.be.undefined;
});
it("should return data from ThirdPartAPI capture", function (done) {
const authorizationId = "abc123";
const amount = 19.99;
const results = ExampleApi.methods.capture.call({
authorizationId: authorizationId,
amount: amount
});
expect(results).to.not.be.undefined;
done();
});
});
describe("Submit payment", function () {
let sandbox;
beforeEach(function () {
sandbox = sinon.sandbox.create();
});
afterEach(function () {
sandbox.restore();
});
it("should call Example API with card and payment data", function () {
// this is a ridiculous timeout for a test that should run in subseconds
// but a bug in the Meteor test runner (or something) seems to make this test stall
// it actually stalls after the entire test is completed
this.timeout(30000);
const cardData = {
name: "Test User",
number: "4242424242424242",
expireMonth: "2",
expireYear: "2018",
cvv2: "123",
type: "visa"
};
const paymentData = {
currency: "USD",
total: "19.99"
};
const authorizeResult = {
saved: true,
currency: "USD"
};
const authorizeStub = sandbox.stub(ExampleApi.methods.authorize, "call", () => authorizeResult);
const results = Meteor.call("exampleSubmit", "authorize", cardData, paymentData);
expect(authorizeStub).to.have.been.calledWith({
transactionType: "authorize",
cardData: cardData,
paymentData: paymentData
});
expect(results.saved).to.be.true;
});
it("should throw an error if card data is not correct", function () {
const badCardData = {
name: "Test User",
cvv2: "123",
type: "visa"
};
const paymentData = {
currency: "USD",
total: "19.99"
};
// Notice how you need to wrap this call in another function
expect(function () {
Meteor.call("exampleSubmit", "authorize", badCardData, paymentData);
}
).to.throw;
});
});
describe("Capture payment", function () {
let sandbox;
beforeEach(function () {
sandbox = sinon.sandbox.create();
});
afterEach(function () {
sandbox.restore();
});
it("should call ExampleApi with transaction ID", function () {
const captureResults = { success: true };
const authorizationId = "abc1234";
paymentMethod.transactionId = authorizationId;
paymentMethod.amount = 19.99;
const captureStub = sandbox.stub(ExampleApi.methods.capture, "call", () => captureResults);
const results = Meteor.call("example/payment/capture", paymentMethod);
expect(captureStub).to.have.been.calledWith({
authorizationId: authorizationId,
amount: 19.99
});
expect(results.saved).to.be.true;
});
it("should throw an error if transaction ID is not found", function () {
sandbox.stub(ExampleApi.methods, "capture", function () {
throw new Meteor.Error("Not Found");
});
expect(function () {
Meteor.call("example/payment/capture", "abc123");
}).to.throw;
});
});
describe("Refund", function () {
let sandbox;
beforeEach(function () {
sandbox = sinon.sandbox.create();
});
afterEach(function () {
sandbox.restore();
});
it("should call ExampleApi with transaction ID", function () {
const refundResults = { success: true };
const transactionId = "abc1234";
const amount = 19.99;
paymentMethod.transactionId = transactionId;
const refundStub = sandbox.stub(ExampleApi.methods.refund, "call", () => refundResults);
Meteor.call("example/refund/create", paymentMethod, amount);
expect(refundStub).to.have.been.calledWith({
transactionId: transactionId,
amount: amount
});
});
it("should throw an error if transaction ID is not found", function () {
sandbox.stub(ExampleApi.methods.refund, "call", function () {
throw new Meteor.Error("404", "Not Found");
});
const transactionId = "abc1234";
paymentMethod.transactionId = transactionId;
expect(function () {
Meteor.call("example/refund/create", paymentMethod, 19.99);
}).to.throw(Meteor.Error, /Not Found/);
});
});
describe("List Refunds", function () {
let sandbox;
beforeEach(function () {
sandbox = sinon.sandbox.create();
});
afterEach(function () {
sandbox.restore();
});
it("should call ExampleApi with transaction ID", function () {
const refundResults = { refunds: [] };
const refundArgs = {
transactionId: "abc1234"
};
const refundStub = sandbox.stub(ExampleApi.methods.refunds, "call", () => refundResults);
Meteor.call("example/refund/list", paymentMethod);
expect(refundStub).to.have.been.calledWith(refundArgs);
});
it("should throw an error if transaction ID is not found", function () {
sandbox.stub(ExampleApi.methods, "refunds", function () {
throw new Meteor.Error("404", "Not Found");
});
expect(() => Meteor.call("example/refund/list", paymentMethod)).to.throw(Meteor.Error, /Not Found/);
});
});
| NahomAgidew/eCommerce | imports/plugins/included/payments-example/server/methods/example-payment-methods.app-test.js | JavaScript | gpl-3.0 | 6,144 |