code
stringlengths
2
1.05M
module.exports = function (app) { var colaboradorCtrl = app.controllers.colaborador; app.get('/colaborador', colaboradorCtrl.index); app.post('/buscar_colaborador', colaboradorCtrl.find); app.get('/buscar_colaborador_id/:id', colaboradorCtrl.buscarId); app.post('/editar_colaborador/:id', colaboradorCtrl.update); app.get('/remover_colaborador/:id', colaboradorCtrl.remove); app.post('/cadastrar_colaborador', colaboradorCtrl.insert); }
import arrayToObject from './array-to-object' describe('array to object', () => { it('takes an array of object and returns an object', () => { expect(arrayToObject([ { name: 'A', age: 30, food: 'pizza' }, { name: 'B', age: 40, food: 'pasta' } ], 'name')).toEqual({ A: { age: 30, food: 'pizza' }, B: { age: 40, food: 'pasta' } }) }) })
const clone = require('lodash/clone'); const testHelpers = require('@quoin/node-test-helpers'); const BasicTypes = require('./basic-types'); const expect = testHelpers.expect; describe("lib/core/basic-types", () => { it("should export an object", () => { expect(BasicTypes).to.be.an('object'); }); it("should expose known properties", () => { const aClone = clone(BasicTypes); testHelpers.verifyProperties(aClone, 'string', [ 'Boolean', 'Date', 'File', 'Password', 'Number', 'String', 'Text' ]); testHelpers.verifyProperties(aClone, 'function', [ 'defaultValue', 'isValid', 'typesCheck' ]); expect(aClone).to.deep.equal({}); }); describe("isValid()", () => { const isValid = BasicTypes.isValid; it("should accept 1 param", () => { expect(isValid).to.have.lengthOf(1); }); it("should recognize an existing type", () => { expect(isValid(BasicTypes.String)).to.be.true(); }); it("should not recognize an invalid type", () => { expect(isValid('foobar')).to.be.false(); }); }); });
import React from 'react'; import { storiesOf } from '@storybook/react'; import { linkTo, hrefTo } from '@storybook/addon-links'; import LinkTo from '@storybook/addon-links/react'; import { action } from '@storybook/addon-actions'; storiesOf('Addons|Links.Link', module) .add('First', () => <LinkTo story="Second">Go to Second</LinkTo>) .add('Second', () => <LinkTo story="First">Go to First</LinkTo>); storiesOf('Addons|Links.Button', module) .add('First', () => ( <button onClick={linkTo('Addons|Links.Button', 'Second')}>Go to "Second"</button> )) .add('Second', () => ( <button onClick={linkTo('Addons|Links.Button', 'First')}>Go to "First"</button> )); storiesOf('Addons|Links.Select', module) .add('Index', () => ( <select value="Index" onChange={linkTo('Addons|Links.Select', e => e.currentTarget.value)}> <option>Index</option> <option>First</option> <option>Second</option> <option>Third</option> </select> )) .add('First', () => <LinkTo story="Index">Go back</LinkTo>) .add('Second', () => <LinkTo story="Index">Go back</LinkTo>) .add('Third', () => <LinkTo story="Index">Go back</LinkTo>); storiesOf('Addons|Links.Href', module).add('log', () => { hrefTo('Addons|Links.Href', 'log').then(href => action('URL of this story')({ href })); return <span>See action logger</span>; }); storiesOf('Addons|Links.Scroll position', module) .addDecorator(story => ( <React.Fragment> <div style={{ marginBottom: '100vh' }}>Scroll down to see the link</div> {story()} </React.Fragment> )) .add('First', () => <LinkTo story="Second">Go to Second</LinkTo>) .add('Second', () => <LinkTo story="First">Go to First</LinkTo>);
'use strict'; var app = angular.module('Fablab'); app.controller('GlobalConfigurationEditController', function ($scope,$route, $location, ConfigurationService, NotificationService) { $scope.selected = {configuration: undefined}; $scope.loadConfiguration = function (id) { ConfigurationService.get(id, function (data) { $scope.configuration = data; }); }; $scope.save = function () { var configurationCurrent = angular.copy($scope.configuration); ConfigurationService.save(configurationCurrent, function (data) { $scope.configuration = data; NotificationService.notify("success", "configuration.notification.saved"); $route.reload(); $location.path("configurations"); }); }; } ); app.controller('ConfigurationEditController', function ($scope, $routeParams, $controller) { $controller('GlobalConfigurationEditController', {$scope: $scope}); $scope.newConfiguration = false; $scope.loadConfiguration($routeParams.id); } );
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var _createClass = (function () { function defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } return function (Constructor, protoProps, staticProps) { if (protoProps) defineProperties(Constructor.prototype, protoProps); if (staticProps) defineProperties(Constructor, staticProps); return Constructor; }; })(); var _get = function get(_x2, _x3, _x4) { var _again = true; _function: while (_again) { var object = _x2, property = _x3, receiver = _x4; desc = parent = getter = undefined; _again = false; var desc = Object.getOwnPropertyDescriptor(object, property); if (desc === undefined) { var parent = Object.getPrototypeOf(object); if (parent === null) { return undefined; } else { _x2 = parent; _x3 = property; _x4 = receiver; _again = true; continue _function; } } else if ("value" in desc) { return desc.value; } else { var getter = desc.get; if (getter === undefined) { return undefined; } return getter.call(receiver); } } }; function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function, not " + typeof superClass); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, enumerable: false, writable: true, configurable: true } }); if (superClass) subClass.__proto__ = superClass; } var _ResourceDecoratorJs = require("./ResourceDecorator.js"); var _ResourceDecoratorJs2 = _interopRequireDefault(_ResourceDecoratorJs); var _endpointsLoadedDataEndpointJs = require("../endpoints/LoadedDataEndpoint.js"); var _endpointsLoadedDataEndpointJs2 = _interopRequireDefault(_endpointsLoadedDataEndpointJs); var _transformersEmbeddedPropertyTransformerJs = require("../transformers/EmbeddedPropertyTransformer.js"); var _transformersEmbeddedPropertyTransformerJs2 = _interopRequireDefault(_transformersEmbeddedPropertyTransformerJs); var _endpointsPromiseEndpointJs = require("../endpoints/PromiseEndpoint.js"); var _endpointsPromiseEndpointJs2 = _interopRequireDefault(_endpointsPromiseEndpointJs); var _injectorJs = require("../injector.js"); var JsonPropertyDecorator = (function (_ResourceDecorator) { function JsonPropertyDecorator(loadedDataEndpointFactory, embeddedPropertyTransformerFactory, promiseEndpointFactory, name, path, value, options) { _classCallCheck(this, JsonPropertyDecorator); _get(Object.getPrototypeOf(JsonPropertyDecorator.prototype), "constructor", this).call(this, name); this.path = path; this.options = options || {}; this.loadedDataEndpointFactory = loadedDataEndpointFactory; this.embeddedPropertyTransformerFactory = embeddedPropertyTransformerFactory; this.promiseEndpointFactory = promiseEndpointFactory; this.value = value; } _inherits(JsonPropertyDecorator, _ResourceDecorator); _createClass(JsonPropertyDecorator, [{ key: "recordApply", value: function recordApply(target) { target.constructor.properties[this.name] = this.path; if (!target.hasOwnProperty(this.name)) { var afterSet = this.options.afterSet; var path = this.path; Object.defineProperty(target, this.name, { enumerable: true, configurable: true, get: function get() { return this.pathGet(path); }, set: function set(value) { var result = this.pathSet(path, value); if (afterSet) { afterSet.call(this); } return result; } }); } } }, { key: "resourceApply", value: function resourceApply(resource) { if (this.value !== undefined) { resource.setInitialValue(this.path, this.value); } this.recordApply(resource); } }, { key: "errorsApply", value: function errorsApply(errors) { this.recordApply(errors); } }, { key: "endpointFn", get: function () { if (!this._endpointFn) { var path = this.path; var promiseEndpointFactory = this.promiseEndpointFactory; var loadedDataEndpointFactory = this.loadedDataEndpointFactory; var embeddedPropertyTransformerFactory = this.embeddedPropertyTransformerFactory; this._endpointFn = function () { var _this = this; var uriParams = arguments[0] === undefined ? {} : arguments[0]; // 'this' in here = Endpoint var newPromise = function newPromise() { return _this.load().then(function (resource) { return loadedDataEndpointFactory(resource.self(), resource, [embeddedPropertyTransformerFactory(path)]); }); }; var newEndpoint = promiseEndpointFactory(newPromise); return newEndpoint; }; } return this._endpointFn; } }, { key: "endpointApply", value: function endpointApply(target) { this.addFunction(target, this.endpointFn); } }]); return JsonPropertyDecorator; })(_ResourceDecoratorJs2["default"]); exports["default"] = JsonPropertyDecorator; (0, _injectorJs.Inject)((0, _injectorJs.factory)(_endpointsLoadedDataEndpointJs2["default"]), (0, _injectorJs.factory)(_transformersEmbeddedPropertyTransformerJs2["default"]), (0, _injectorJs.factory)(_endpointsPromiseEndpointJs2["default"]))(JsonPropertyDecorator); module.exports = exports["default"];
/* =================================================== */ var treeData = [ { "name": "Top Level", "parent": "null", "children": [ { "name": "Level 2: A", "parent": "Top Level", "children": [ { "name": "Son of A", "parent": "Level 2: A" }, { "name": "Daughter of A", "parent": "Level 2: A" } ] }, { "name": "Level 2: B", "parent": "Top Level", "children": [ { "name": "Son of B", "parent": "Level 2: B" }, { "name": "Daughter of B", "parent": "Level 2: B" } ] } ] } ]; /* =================================================== */ var boxHeight = 60;// var boxWidth = 130;// var fontSize = 10; var lineSpace = 2; var renderOut = "tree"; var treeOrientation = "vertical";// var goZoo = true; var el = "div#myTree";// var margin = {top: -5, right: -5, bottom: -5, left: -5};// var width = 500, height = 500;// /* =================================================== */ /* Creates a new tree layout with the default settings: the default sort order is null; the default children accessor assumes each input data is an object with a children array; the default separation function uses one node width for siblings, and two node widths for non-siblings; the default size is 1×1. */ var hierarchy = ''; if ( renderOut == "tree") { hierarchy = d3.layout.tree(); } else { hierarchy = d3.layout.cluster(); } hierarchy.nodeSize([boxWidth*1.5, boxHeight*2]); //hierarchy.size([height, width - 160]); /** The default comparator is null, which disables sorting and uses tree traversal order. * Note that if no comparator function is specified to the built-in sort method, the default order is lexicographic * function comparator(a, b) { return a.name < b.name ? -1 : a.name > b.name ? 1 : 0; } * * The current default separation function * function separation(a, b) { return (a.parent == b.parent ? 1 : 2); } *//* TREE.sort(comparator).separation(separation); */ var svg = d3.select(el).append("svg") .attr("width", width)//+ margin.left + margin.right) .attr("height", height)//+ margin.top + margin.bottom) .append("g"); /* svg.append("rect") .attr("width", width) .attr("height", height) .style("fill", "grey") .style("pointer-events", "all"); */ var zoom = d3.behavior.zoom().scaleExtent([1, 10]).on("zoom", zoomed); function zoomed() { svg.append("g").attr("transform", "translate("+ d3.event.translate +") scale("+ d3.event.scale + ")"); } if (treeOrientation == "vertical") { svg.attr("transform", "translate("+ (0+margin.left)+","+(0+margin.right)+")"+" rotate(90) scale(1)") .call(zoom); } else { svg.attr("transform", "translate(1500,50) rotate(0) scale(0.5)") .call(zoom); } if ( renderOut == "tree" ) { } else {} var drag = d3.behavior.drag() .origin(function(d) { return d; }) .on("dragstart", dragstarted) .on("drag", dragged) .on("dragend", dragended); function dragstarted(d) { d3.event.sourceEvent.stopPropagation(); d3.select(this).classed("dragging", true); } function dragged(d) { d3.select(this).attr("x", d.x = d3.event.x).attr("y", d.y = d3.event.y); } function dragended(d) { d3.select(this).classed("dragging", false); } d3.json("./flare.json", function(error, json) { if (error) throw error; /* https://github.com/mbostock/d3/wiki/Tree-Layout Runs the tree layout, returning the array of nodes associated with the specified root node. The tree layout is part of D3's family of hierarchical layouts. */ root = treeData[0]; var nodes = hierarchy.nodes(root), // nodes(json) /* Given the specified array of nodes, such as those returned by nodes, returns an array of objects representing the links from parent to child for each node. */ links = hierarchy.links(nodes); /* https://www.dashingd3js.com/svg-paths-and-d3js */ var link = svg.selectAll("path.link").data(links).enter().append("path") .attr("class", "link"); var diagonal = d3.svg.diagonal(); if ( renderOut == "tree") { diagonal = function() { var mprojection = function(d) { return [d.y, d.x]; }; var mpath = function(pathData) { return "M" + pathData[0] + ' ' + pathData[1] + " " + pathData[2]+ " " + pathData[3]; }; // link.attr("d", function(d) { return "M" + (d.source.y/2) + "," + (d.source.x) + "H" + (d.target.y/2)+ "V" + (d.target.x);}); function mdiagonal(diagonalPath, i) { var source = diagonalPath.source, target = diagonalPath.target, turnPointY = target.y/2, pathData = [source, {x: source.x, y: turnPointY}, {x: target.x, y: turnPointY}, target]; pathData = pathData.map(mprojection); return mpath(pathData); } return mdiagonal; }; } else { // Straitgh curve! diagonal.projection(function(d) { return [d.y, d.x]; }); } link.attr("d", diagonal()); /* g is a container element http://www.w3.org/TR/SVG/shapes.html#InterfaceSVGRectElement */ var node = svg.selectAll("g.node").data(nodes).enter().append("g"); node.attr("class", "node") .attr("transform", function(d) { return "translate("+ d.y +","+ d.x +")"+ "rotate("+ -90 +")"; }) .on("mouseover", mouseover) .on("mouseout", mouseout); node.append("rect") .attr('class', "recBox") .attr("x", -boxWidth/2).attr("y", -boxHeight/2) .attr("width", boxWidth).attr("height", boxHeight) .attr("rx", 50); node.append("text") .attr("id", "nodetitle") .attr("class", "nodeTitle") .attr("y", -boxHeight/2 + fontSize + 2*lineSpace) .attr("text-anchor", "middle") .text( 'd.name' ); node.append("text") .attr("id", "nodetext") .attr("class", "nodeText") .attr("y", -boxHeight/2 + 2*fontSize + 4*lineSpace) .attr("text-anchor", "middle").text('Score: 00') .call(drag); //.style("fill", "none").style("stroke", "purple").style("stroke-width", "2.5px"); // mouseover event handler function mouseover() { d3.select(this).select("rect").transition().duration(750) .attr("width", boxWidth*1.5).attr("height", boxHeight*1.5) .style("opacity", 1) .style("fill", "#c8e4f8").style("stroke", "orange").style("stroke-width", "5px"); d3.select(this).select("text#nodetitle").transition().duration(750) .attr("y", -boxHeight/2 + fontSize + 2*lineSpace) .style("font-weight", "bold") .style("font-size", "18px"); // displayInfoBox(thisNode) } // mouseout event handler function mouseout() { d3.select(this).select("rect").transition(0.5).duration(750) .attr("width", boxWidth).attr("height", boxHeight) .style("opacity", 1) .style("fill", "white").style("stroke", "purple").style("stroke-width", "2.5px"); d3.select(this).select("text#nodetitle").transition().duration(750) .attr("y", -boxHeight/2 + fontSize + 2*lineSpace) .style("font-weight", "normal") .style("font-size", "12px"); } /* // Display up the info box (for mouse overs) function displayInfoBox(node) { var nodeName = node.attr("id") var infoX = infoBoxWidth/2*0.6 var infoY = infoBoxHeight/2*1.05 var infoBox = svg.append("g") infoBox .attr("class", "popup") .attr("transform", function(d) {return "translate(" + infoX + "," + infoY + ")";}) infoBox .append("text") .attr("y", -infoBoxHeight/2 + fontSize + 2*lineSpace) .attr("text-anchor", "middle") .text(nodeName) .attr("font-size", fontSize + 8 + "px") var imgOffsetX = -infoBoxWidth/2 * 0.95 var imgOffsetY = -infoBoxHeight/2 + fontSize+8 + 2*lineSpace infoBox .append("svg:image") .attr("xlink:href", "sample_patches/"+nodeName+".png") .attr("width", infoBoxWidth*0.99) .attr("height", infoBoxHeight*0.99) .attr("transform", function(d) {return "translate(" + imgOffsetX + "," + imgOffsetY + ")";}) } */ }); d3.select(self.frameElement).style("height", height + "px");
var fs = require('fs'); fs.stat('/tmp', function(err, stats) { if (err) { console.error(err); return; } console.log(stats); });
var path = require('path'); var cmd = require('cmd-util'); var ast = cmd.ast; var iduri = cmd.iduri; exports.init = function(grunt) { var exports = {}; exports.jsConcat = function(fileObj, options) { var data = grunt.file.read(fileObj.src); var meta = ast.parseFirst(data); var records = grunt.option('concat-records'); if (grunt.util._.contains(records, meta.id)) { return ''; } records.push(meta.id); if (options.include === 'self') { return data; } var rv = meta.dependencies.map(function(dep) { if (dep.charAt(0) === '.') { var id = iduri.absolute(meta.id, dep); if (grunt.util._.contains(records, id)) { return ''; } records.push(id); var fpath = path.join(path.dirname(fileObj.src), dep); console.log('###', fpath); if (!/\.js$/.test(fpath)) fpath += '.js'; if (!grunt.file.exists(fpath)) { grunt.log.warn('##=>file ' + fpath + ' not found'); return ''; } return grunt.file.read(fpath); } else if ((/\.css$/.test(dep) && options.css2js) || options.include === 'all') { var fileInPaths; options.paths.some(function(basedir) { var fpath = path.join(basedir, dep); console.log('@@@', fpath); if (!/\.css$/.test(dep)) { fpath += '.js'; } if (grunt.file.exists(fpath)) { fileInPaths = fpath; return true; } }); if (!fileInPaths) { grunt.log.warn('@@=>file ' + dep + ' not found\n'+ fileInPaths +'\n'); } else { var data = grunt.file.read(fileInPaths); if (/\.css$/.test(dep)) { return options.css2js(data, dep); } return data; } } return ''; }).join(grunt.util.normalizelf(options.separator)); return [data, rv].join(grunt.util.normalizelf(options.separator)); }; return exports; };
'use strict'; angular.module('myApp.gear', ['ngRoute']) .config(['$routeProvider', function($routeProvider) { $routeProvider.when('/gear', { templateUrl: 'gear/gear.html', controller: 'GearCtrl' }); }]) .controller('GearCtrl', ['$scope','$http', function($scope, $http) { $http.get('resources/data/gear.json'). success(function(data, status, headers, config) { $scope.content = data; }). error(function(data, status, headers, config) { // log error }); }]);
$("#btnAddButton").on('click', addButton); $("#btnRemoveButton").on('click', removeButton); $('#btnAddTrail').on('click', loadFiles); $(document).ready(function() { }); var counter = 0; function addButton(event) { if(counter >= 10){ alert("Only 10 textboxes are allowed"); return false; } var newTextBoxDiv = $(document.createElement('div')).attr("id", 'TextBoxDiv' + counter); var str = '<input id="inputPicture" type="file" name="addpic">' + '<input id="inputPictureLon" type="text" placeholder="lon" size="8">' + '<input id="inputPictureLat" type="text" placeholder="lat" size="8">' + '<input id="inputPictureAlt" type="text" placeholder="alt" size="8">' + '<input id="inputPictureTimestamp" type="text" placeholder="timestamp" size="8">' + '<input id="inputPictureName" type="text" placeholder="picturename" size="8">' + '<input id="inputPictureDescription" type="text" placeholder="description" size="8">'; newTextBoxDiv.after().html(str); newTextBoxDiv.appendTo("#TextBoxesGroup"); counter++; } function removeButton(event) { if (counter == 0) { alert("No more textbox to remove"); return false; } counter--; $("#TextBoxDiv" + counter).remove(); } var log = function(text) { var elem = document.getElementsByTagName('span')[1]; elem.innerHTML = text; elem.style.backgroundColor="yellow"; elem.style.color="black"; setTimeout(function() { document.getElementsByTagName('span')[1].innerHTML = ""; }, 60000); }; var picDataArray = []; var readers = []; var readerInd = 0; function loadFiles(event) { var elem; var file; picDataArray = []; readers = []; readerInd = 0; event.preventDefault(); if (window.File && window.FileReader && window.FileList && window.Blob) { //alert("File API supported.!"); for (var i=0; i<counter; i++) { readers[i] = new FileReader(); readers[i].onload = function(e) { if (e.target.error) { log("couldn't read file"); return; } picDataArray.push(btoa(e.target.result)); readerInd++; if (readerInd == counter) { sendTrail(); } }; var elem = document.getElementById('TextBoxDiv' + (i).toString()); var file = elem.children[0].files[0]; readers[i].readAsBinaryString(file); } if (counter == 0) { sendTrail(); } } else { alert('The File APIs are not fully supported in this browser.\nI will not send pictures'); sendTrail(); } } function sendTrail() { var obj; var locArray = []; var picArray = []; var coords = []; var lines = $('#textareaCoordinates').val().split('\n'); for (var i=0; i<lines.length; i++) { var words = lines[i].split(','); if (words.length == 4) { coords = []; for (var j=0; j<3; j++) { coords.push(parseFloat(words[j])); } obj = { 'timestamp': words[3], 'loc': { 'type': 'Point', 'coordinates': coords } }; locArray.push(obj); } } for (var i=0; i<counter; i++) { coords = []; coords.push($('#TextBoxDiv' + i + ' #inputPictureLon').val()); coords.push($('#TextBoxDiv' + i + ' #inputPictureLat').val()); coords.push($('#TextBoxDiv' + i + ' #inputPictureAlt').val()); obj = { 'timestamp': $('#TextBoxDiv' + i + ' #inputPictureTimestamp').val(), 'picturename': $('#TextBoxDiv' + i + ' #inputPictureName').val(), 'description': $('#TextBoxDiv' + i + ' #inputPictureDescription').val(), 'filename': $('#TextBoxDiv' + i + ' #inputPicture').val(), 'file': picDataArray[i], 'loc': { 'type': 'Point', 'coordinates': coords } }; picArray.push(obj); } var data = { 'newtrail' : [ { 'type': 'LocationCollection', 'locations': locArray }, { 'type': 'PictureCollection', 'pictures': picArray }, { 'type': 'TrailInfo', 'access': $('#inputAccess').val(), 'trailname': $('#inputTrailName').val(), 'description': $('#inputDescription').val(), 'date': $('#inputDate').val(), 'locationname': $('#inputLocationName').val() }, { 'type': 'UserInfo', 'username': $('#inputUsername').val(), 'password': $('#inputPassword').val(), } ] }; $.ajax({ type: 'POST', data: data, url: '/addtrail', dataType: 'JSON', success: function(res) { if (res.status == 'ok') { var elem = document.getElementsByTagName('span')[0]; elem.innerHTML = res.msg; elem.style.backgroundColor="blue"; elem.style.color="white"; setTimeout(function() { document.getElementsByTagName('span')[0].innerHTML = ""; }, 5000); } else { var elem = document.getElementsByTagName('span')[0]; elem.innerHTML = res.msg; elem.style.backgroundColor="red"; elem.style.color="white"; setTimeout(function() { document.getElementsByTagName('span')[0].innerHTML = ""; }, 5000); } }, error: function(xhr, textStatus) { alert("HTTP error code: " + xhr.status + " response:\n" + xhr.responseText); }, complete: function(xhr, textstatus) { } }); }
(function (window, document, angular, jQuery, undefined) { 'use strict'; angular.module('vissensePlayground') .controller('TrackSectionsDemoCtrl', [ '$window', '$document', '$scope', 'VisSense', function ($window, $document, $scope, VisSense) { $scope.scrollToElement = function (elementId) { jQuery('html, body').animate({ scrollTop: jQuery('#' + elementId).offset().top }, 500); }; var changeOpacityOnPercentageChangeOfElementWithId = function (elementId) { var sectionElement = jQuery('#' + elementId); var onChange = function (state) { var newValue = state.percentage; var oldValue = (state.previous.percentage || 0); var difference = newValue - oldValue; var duration = 500 * Math.max(difference, 0.25); // set the opacity to the actual visibility percentage var opacity = Math.max(newValue, 0.25); sectionElement.fadeTo(duration, opacity); }; var sectionMonitor = new VisSense(sectionElement[0]).monitor({ // update when user scrolls or resizes the page strategy: VisSense.VisMon.Strategy.EventStrategy({debounce: 50}), percentagechange: function (monitor) { onChange(monitor.state()); } }).start(); $scope.$on('$destroy', function () { sectionMonitor.stop(); }); }; changeOpacityOnPercentageChangeOfElementWithId('examples-section'); changeOpacityOnPercentageChangeOfElementWithId('demo-section'); changeOpacityOnPercentageChangeOfElementWithId('plugins-section'); }]); })(window, document, angular, jQuery);
"use strict"; const commonOptions = require("../common/common-options"); // format based on https://github.com/prettier/prettier/blob/master/src/main/core-options.js module.exports = { bracketSpacing: commonOptions.bracketSpacing, singleQuote: commonOptions.singleQuote, proseWrap: commonOptions.proseWrap };
'use strict'; module.exports = config => [{ name: 'facebook-app_id', message: 'app id of facebook', store: true, when: require('./when')('facebook', config) }, { name: 'facebook_api-api_version', message: 'version of facebook api', store: true, when: require('./when')('facebook_api', config) }];
let prop, value, i, len; for (i = 0, len = myDiv.style.length; i < len; i++) { prop = myDiv.style[i]; // alternately, myDiv.style.item(i) value = myDiv.style.getPropertyCSSValue(prop); console.log(`prop: ${value.cssText} (${value.cssValueType})`); }
var albumId; var addPictures = function (result) { UserFBAlbums.update({id: albumId}, {$set: {'paging': result.paging}}); for (var i = 0; i < result.data.length; i++) { UserFBAlbums.update({id: albumId}, {$addToSet: {'pictures': result.data[i]}}); } IonLoading.hide(); }; Template.gallery.events({ 'click .loadNext': function () { IonLoading.show(); var next = UserFBAlbums.findOne({id: albumId}).paging.next; facebookApi.getNext(next, addPictures) }, 'click .thumb': function (e) { Meteor.call('TogglePicture', this.id, function (error, result) { if (error) { console.log(error.reason); } else if (!result) { IonPopup.alert({ title: 'Too many images!', template: 'You can only select up to five images.\n Please review your "Selected Photos" album, and remove some before adding more.', okText: 'Got It.' }); } }); } }); var pictures = []; Template.gallery.helpers({ pictures: function () { if (albumId) { pictures = UserFBAlbums.findOne({id: albumId}).pictures; } return pictures; }, photosSelected: function () { var selected = 0; if (Meteor.user()) { selected = Meteor.user().profile.facebookImageIds.length; } return '(' + selected + '/5)'; }, hasNext: function () { var album = UserFBAlbums.findOne({id: albumId}); if (album && album.paging) { return album.paging.next; } return false; } }); Template.gallery.rendered = function () { if (albumId) { if (!UserFBAlbums.findOne({id: albumId}).pictures) { IonLoading.show(); } this.autorun(function () { if (UserFBAlbums.findOne({id: albumId}).pictures) { IonLoading.hide(); } else if (Session.get('fbLoaded') && Meteor.userId()) { facebookApi.getPhotos({identifier: albumId}, function (result) { addPictures(result); }); } }.bind(this)); } }; Template.gallery.created = function () { albumId = Router.current().params._albumId; this.autorun(function () { this.subscription = Meteor.subscribe('user', Meteor.userId()); }.bind(this)); if (!albumId) { var images = Meteor.user().profile.facebookImageIds; for (var i = 0; i < images.length; i++) { pictures.push({id: images[i]}); } } };
var assert = require("chai").assert; var Init = require("truffle-init"); var Migrate = require("truffle-migrate"); var Contracts = require("../lib/contracts"); var Networks = require("../lib/networks"); var path = require("path"); var fs = require("fs"); var TestRPC = require("ethereumjs-testrpc"); var Resolver = require("truffle-resolver"); var Artifactor = require("truffle-artifactor"); var Web3 = require("web3"); describe("migrate", function() { var config; var accounts; var network_id_one; var network_id_two; var from_addresses = []; before("Create a sandbox", function(done) { this.timeout(10000); Init.sandbox(function(err, result) { if (err) return done(err); config = result; config.resolver = new Resolver(config); config.artifactor = new Artifactor(config.contracts_build_directory); config.networks = {}; done(); }); }); function createProviderAndSetNetworkConfig(network, callback) { var provider = TestRPC.provider({seed: network}); var web3 = new Web3(provider); web3.eth.getAccounts(function(err, accs) { if (err) return callback(err); web3.version.getNetwork(function(err, network_id) { if (err) return callback(err); config.networks[network] = { provider: provider, network_id: network_id + "", from: accs[0] }; callback(); }); }); }; before("Get accounts and network id of network one", function(done) { createProviderAndSetNetworkConfig("primary", done); }); before("Get accounts and network id of network one", function(done) { createProviderAndSetNetworkConfig("secondary", done); }); it('profiles a new project as not having any contracts deployed', function(done) { Networks.deployed(config, function(err, networks) { if (err) return done(err); assert.equal(Object.keys(networks).length, 2, "Should have results for two networks from profiler"); assert.equal(Object.keys(networks["primary"]), 0, "Primary network should not have been deployed to"); assert.equal(Object.keys(networks["secondary"]), 0, "Secondary network should not have been deployed to"); done(); }) }); it('links libraries in initial project, and runs all migrations', function(done) { this.timeout(10000); config.network = "primary"; Contracts.compile(config.with({ all: false, quiet: true }), function(err, contracts) { if (err) return done(err); Migrate.run(config.with({ quiet: true }), function(err) { if (err) return done(err); Networks.deployed(config, function(err, networks) { if (err) return done(err); assert.equal(Object.keys(networks).length, 2, "Should have results for two networks from profiler"); assert.equal(Object.keys(networks["primary"]).length, 3, "Primary network should have three contracts deployed"); assert.isNotNull(networks["primary"]["MetaCoin"], "MetaCoin contract should have an address"); assert.isNotNull(networks["primary"]["ConvertLib"], "ConvertLib library should have an address"); assert.isNotNull(networks["primary"]["Migrations"], "Migrations contract should have an address"); assert.equal(Object.keys(networks["secondary"]), 0, "Secondary network should not have been deployed to"); done(); }); }); }); }); it('should migrate secondary network without altering primary network', function(done) { this.timeout(10000); config.network = "secondary"; var currentAddresses = {}; Networks.deployed(config, function(err, networks) { if (err) return done(err); ["MetaCoin", "ConvertLib", "Migrations"].forEach(function(contract_name) { currentAddresses[contract_name] = networks["primary"][contract_name]; }); Migrate.run(config.with({ quiet: true }), function(err, contracts) { if (err) return done(err); Networks.deployed(config, function(err, networks) { if (err) return done(err); assert.equal(Object.keys(networks).length, 2, "Should have results for two networks from profiler"); assert.equal(Object.keys(networks["primary"]).length, 3, "Primary network should have three contracts deployed"); assert.equal(networks["primary"]["MetaCoin"], currentAddresses["MetaCoin"], "MetaCoin contract updated on primary network"); assert.equal(networks["primary"]["ConvertLib"], currentAddresses["ConvertLib"], "ConvertLib library updated on primary network"); assert.equal(networks["primary"]["Migrations"], currentAddresses["Migrations"], "Migrations contract updated on primary network"); assert.equal(Object.keys(networks["secondary"]).length, 3, "Secondary network should have three contracts deployed"); assert.isNotNull(networks["secondary"]["MetaCoin"], "MetaCoin contract should have an address on secondary network"); assert.isNotNull(networks["secondary"]["ConvertLib"], "ConvertLib library should have an address on secondary network"); assert.isNotNull(networks["secondary"]["Migrations"], "Migrations contract should have an address on secondary network"); Object.keys(networks["primary"]).forEach(function(contract_name) { assert.notEqual(networks["secondary"][contract_name], networks["primary"][contract_name], "Contract " + contract_name + " has the same address on both networks") }); done(); }); }); }); }); it("should ignore files that don't start with a number", function(done) { fs.writeFileSync(path.join(config.migrations_directory, "~2_deploy_contracts.js"), "module.exports = function() {};", "utf8"); Migrate.assemble(config, function(err, migrations) { if (err) return done(err); assert.equal(migrations.length, 2, "~2_deploy_contracts.js should have been ignored!"); done(); }); }); it("should ignore non-js extensions", function(done) { fs.writeFileSync(path.join(config.migrations_directory, "2_deploy_contracts.js~"), "module.exports = function() {};", "utf8"); Migrate.assemble(config, function(err, migrations) { if (err) return done(err); assert.equal(migrations.length, 2, "2_deploy_contracts.js~ should have been ignored!"); done(); }); }); });
var LiveStream = require('../') var SubLevel = require('level-sublevel') var db = SubLevel(require('level-test')()('test-level-live-stream')) var assert = require('assert') var i = 10 var j = 10 var k = 10 LiveStream(db, {tail: true}).on('data', function (data) { console.log(data) if(data.type === 'put') assert.equal(data.key, j--) }) LiveStream(db, {old: false}).on('data', function (data) { if(data.type === 'put') assert.equal(data.key, k--) }) var a = [] var int = setInterval(function () { var key = i + '' if(Math.random() < 0.2 && a.length) { var r = ~~(Math.random()*a.length) key = a[r] a.slice(r, 1) db.del(key, function (err) { assert(err == undefined) }) } else { a.push(key) db.put(key, new Date(), function(err) { assert(err == undefined) }) if(--i) return clearInterval(int) } }, 100)
import React, { Component } from 'react'; import { connect } from 'react-redux'; import { bindActionCreators } from 'redux'; import { fetchIP } from '../../actions/fetchIP'; import { Snackbar } from 'react-toolbox'; import theme from './Snackbar.css'; class SnackbarComponent extends Component { constructor(props) { super(props); this.state = { active: false, message: '' }; this.handleSnackbarClick = this.handleSnackbarClick.bind(this); this.handleSnackbarTimeout = this.handleSnackbarTimeout.bind(this); } handleSnackbarClick = () => { this.setState({active: false}); }; handleSnackbarTimeout = () => { if (this._isMounted) { this.setState({active: false}); } this.props.fetchIP(); }; componentWillReceiveProps(props) { this.setState({ active: props.error, message: props.message }); } componentDidMount() { this._isMounted = true; } componentWillUnmount() { this._isMounted = false; } render() { return ( <section> <Snackbar theme={theme} action="Hide" active={this.props.weather.error} label={this.props.weather.message} timeout={1500} onClick={this.handleSnackbarClick} onTimeout={this.handleSnackbarTimeout} type="warning" /> </section> ); } } function mapDispatchToProps(dispatch) { return bindActionCreators({ fetchIP }, dispatch); } function mapStateToProps({ weather }) { return { weather }; } export default connect(mapStateToProps, mapDispatchToProps)(SnackbarComponent);
// @flow import React, { type Node, Component } from 'react'; import { Image, View, ScrollView, StyleSheet, TouchableHighlight, TouchableOpacity, Dimensions, } from 'react-native'; const reactNativePackage = require('react-native/package.json'); const splitVersion = reactNativePackage.version.split('.'); const majorVersion = +splitVersion[0]; const minorVersion = +splitVersion[1]; type Slide = { index: number, style?: any, width?: number, item?: any, }; type PropsType = { images: Array<number | string>, style?: any, loop?: boolean, loopBothSides?: boolean, autoPlayWithInterval?: number, position?: number, onPositionChanged?: number => void, onPress?: Object => void, customButtons?: (number, (number, animated?: boolean) => void) => Node, customSlide?: Slide => Node, imagesWidth: number }; type StateType = { position: number, width: number, interval: any, onPositionChangedCalled: boolean, }; class ImageSlider extends Component<PropsType, StateType> { state = { position: 0, width: Dimensions.get('window').width, onPositionChangedCalled: false, interval: null, }; _ref = null; _panResponder = {}; _onRef = (ref: any) => { this._ref = ref; if (ref && this.state.position !== this._getPosition()) { this._move(this._getPosition()); } }; // In iOS you can pop view by swiping left, with active ScrollView // you can't do that. This View on top of ScrollView enables call of // pop function. _popHelperView = () => !this.props.loopBothSides && this._getPosition() === 0 && ( <View style={{ position: 'absolute', width: 50, height: '100%' }} /> ); _move = (index: number, animated: boolean = true, autoCalled: boolean = true) => { if (!this.autoPlayFlag && autoCalled) { return; } const isUpdating = index !== this._getPosition(); const x = (this.props.imagesWidth ? this.props.imagesWidth : Dimensions.get("window").width) * index; this._ref && this._ref.scrollTo({ y: 0, x, animated }); this.setState({ position: index }); if ( isUpdating && this.props.onPositionChanged && index < this.props.images.length && index > -1 ) { this.props.onPositionChanged(index); this.setState({ onPositionChangedCalled: true }); } this._setInterval(); }; _getPosition() { if (typeof this.props.position === 'number') { return this.props.position % this.props.images.length; } return this.state.position % this.props.images.length; } componentDidUpdate(prevProps: Object) { const { position, autoPlayFlag } = this.props; this.autoPlayFlag = autoPlayFlag; if (position && prevProps.position !== position) { this._move(position); } } _clearInterval = () => this.state.interval && clearInterval(this.state.interval); _setInterval = () => { this._clearInterval(); const { autoPlayWithInterval, images, loop, loopBothSides } = this.props; if (autoPlayWithInterval) { this.setState({ interval: setInterval( () => this._move( !(loop || loopBothSides) && this.state.position === images.length - 1 ? 0 : this.state.position + 1, ), autoPlayWithInterval, ), }); } }; _handleScroll = (event: Object) => { const { position, width } = this.state; const { loop, loopBothSides, images, onPositionChanged } = this.props; const { x } = event.nativeEvent.contentOffset; if ( (loop || loopBothSides) && x.toFixed() >= +(width * images.length).toFixed() ) { return this._move(0, false); } else if (loopBothSides && x.toFixed() <= +(-width).toFixed()) { return this._move(images.length - 1, false); } let newPosition = 0; if (position !== -1 && position !== images.length) { newPosition = Math.round(event.nativeEvent.contentOffset.x / width); this.setState({ position: newPosition }); } if ( onPositionChanged && !this.state.onPositionChangedCalled && newPosition < images.length && newPosition > -1 ) { onPositionChanged(newPosition); } else { this.setState({ onPositionChangedCalled: false }); } this._setInterval(); }; componentDidMount() { this._setInterval(); } componentWillUnmount() { this._clearInterval(); } _onLayout = () => { this.setState({ width: Dimensions.get('window').width }); this._move(this.state.position, false); }; _renderImage = (image: any, index: number) => { const { width } = Dimensions.get('window'); const { onPress, customSlide } = this.props; const offset = { marginLeft: index === -1 ? -width : 0 }; const imageStyle = [styles.image, { width }, offset]; if (customSlide) { return customSlide({ item: image, style: imageStyle, index, width }); } const imageObject = typeof image === 'string' ? { uri: image } : image; const imageComponent = ( <Image key={index} source={imageObject} style={[imageStyle]} /> ); if (onPress) { return ( <TouchableOpacity key={index} style={[imageStyle, offset]} onPress={() => onPress && onPress({ image, index })} delayPressIn={200} > {imageComponent} </TouchableOpacity> ); } return imageComponent; }; // We make shure, that, when loop is active, // fake images at the begin and at the end of ScrollView // do not scroll. _scrollEnabled = (position: number) => position !== -1 && position !== this.props.images.length; moveNext = () => { const next = (this.state.position + 1) % this.props.images.length; this._move(next, true, false); } movePrev = () => { const prev = (this.state.position + this.props.images.length - 1) % this.props.images.length; this._move(prev, true, false); } render() { const { onPress, customButtons, style, loop, images, loopBothSides, } = this.props; const position = this._getPosition(); const scrollEnabled = this._scrollEnabled(position); return ( <View style={[styles.container, style]} onLayout={this._onLayout}> <ScrollView onLayout={this._onLayout} ref={ref => this._onRef(ref)} onMomentumScrollEnd={this._handleScroll} scrollEventThrottle={16} pagingEnabled={true} bounces={loopBothSides} contentInset={loopBothSides ? { left: this.state.width } : {}} horizontal={true} scrollEnabled={scrollEnabled} showsHorizontalScrollIndicator={false} style={[styles.scrollViewContainer, style]} > {loopBothSides && this._renderImage(images[images.length - 1], -1)} {images.map(this._renderImage)} {(loop || loopBothSides) && this._renderImage(images[0], images.length)} </ScrollView> {customButtons ? ( customButtons(position, this._move) ) : ( <View style={styles.buttons}> {this.props.images.map((image, index) => ( <TouchableHighlight key={index} underlayColor="#ccc" onPress={() => this._move(index)} style={[ styles.button, position === index && styles.buttonSelected, ]} > <View /> </TouchableHighlight> ))} </View> )} {this._popHelperView()} </View> ); } } const styles = StyleSheet.create({ container: { flex: 1, }, scrollViewContainer: { flexDirection: 'row', backgroundColor: '#222', }, image: { width: 200, height: '100%', }, buttons: { height: 15, marginTop: -15, justifyContent: 'center', alignItems: 'center', flexDirection: 'row', }, button: { margin: 3, width: 8, height: 8, borderRadius: 8 / 2, backgroundColor: '#ccc', opacity: 0.9, }, buttonSelected: { opacity: 1, backgroundColor: '#fff', }, }); export default ImageSlider;
/** * Copyright (c) Facebook, Inc. and its affiliates. * * This source code is licensed under the MIT license found in the * LICENSE file in the root directory of this source tree. * * @emails oncall+relay * @format */ 'use strict'; const RelayClassic = require('../../RelayPublic'); const RelayQuery = require('../../query/RelayQuery'); const RelayTestUtils = require('RelayTestUtils'); const flattenRelayQuery = require('../flattenRelayQuery'); const generateRQLFieldAlias = require('../../query/generateRQLFieldAlias'); const splitDeferredRelayQueries = require('../splitDeferredRelayQueries'); describe('splitDeferredRelayQueries()', () => { // helper functions const {defer, getNode, getRefNode} = RelayTestUtils; // remove the root `id` field function filterGeneratedRootFields(node) { const children = node .getChildren() .filter( child => !(child instanceof RelayQuery.Field && child.isGenerated()), ); return node.clone(children); } beforeEach(() => { // Reset query numbers back to q0. jest.resetModules(); expect.extend(RelayTestUtils.matchers); }); it('returns the original query when there are no fragments', () => { const node = RelayClassic.QL`query{node(id:"4"){id,name}}`; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); expect(required).toBe(queryNode); expect(deferred).toEqual([]); }); it('returns the original query when there are no deferred fragments', () => { const fragment = RelayClassic.QL`fragment on User{hometown{name}}`; const node = RelayClassic.QL` query { node(id:"4") { id name ${fragment} } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); expect(required).toBe(queryNode); expect(deferred).toEqual([]); }); it('splits a deferred fragment on the viewer root', () => { const fragment = RelayClassic.QL` fragment on Viewer { newsFeed(first: 10) { edges { node { id actorCount } } } } `; const node = RelayClassic.QL` query { viewer { actor { id } ${defer(fragment)} } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode(RelayClassic.QL`query{viewer{actor{id}}}`), ); expect(required.getID()).toBe('q3'); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( getNode( RelayClassic.QL` query { viewer { ${fragment} } } `, ), ); expect(deferred[0].required.getID()).toBe('q2'); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferreds expect(deferred[0].deferred).toEqual([]); }); it('splits a deferred fragment on a query without an ID argument', () => { const fragment = RelayClassic.QL` fragment on Actor { name } `; const node = RelayClassic.QL` query { username(name:"yuzhi") { id ${defer(fragment)} } } `; const queryNode = getNode(node); const {deferred} = splitDeferredRelayQueries(queryNode); expect(deferred.length).toBe(1); expect(deferred[0].required.getConcreteQueryNode().metadata).toEqual({ identifyingArgName: 'name', identifyingArgType: 'String!', isAbstract: true, isPlural: false, }); }); it('splits a nested feed on the viewer root', () => { const nestedFragment = RelayClassic.QL` fragment on Viewer { newsFeed(first: 10) { edges { node { id actorCount } } } } `; const fragment = RelayClassic.QL` fragment on Viewer { actor { name } ${defer(nestedFragment)} } `; const node = RelayClassic.QL` query { viewer { actor { id } ${fragment} } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode( RelayClassic.QL` query { viewer { actor { id } ${RelayClassic.QL` fragment on Viewer { actor { name, } } `} } } `, ), ); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( getNode( RelayClassic.QL` query { viewer { ${nestedFragment} } } `, ), ); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferreds expect(deferred[0].deferred).toEqual([]); }); it('splits nested deferred fragments', () => { const nestedFragment = RelayClassic.QL`fragment on NonNodeStory{message{text}}`; const fragment = RelayClassic.QL` fragment on Viewer { newsFeed(first: 10) { edges { node { tracking ${defer(nestedFragment)} } } } } `; const node = RelayClassic.QL` query { viewer { actor { name } ${defer(fragment)} } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode( RelayClassic.QL` query { viewer{actor{id,name}} } `, ), ); expect(required.getID()).toBe('q5'); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( getNode( RelayClassic.QL` query { viewer { ${RelayClassic.QL` fragment on Viewer { newsFeed(first: 10) { edges { cursor, node { id, tracking } }, pageInfo { hasNextPage, hasPreviousPage } } } `} } } `, ), ); expect(deferred[0].required.getID()).toBe('q4'); expect(deferred[0].required.isDeferred()).toBe(true); // nested deferred part expect(deferred[0].deferred.length).toBe(1); expect(deferred[0].deferred[0].required.getName()).toBe( queryNode.getName(), ); // TODO (#7891872): test unflattened queries. The expected output's `edges` // field has two `node` children: // - the requisite `node{id}` // - the nested deferred fragment expect( flattenRelayQuery(deferred[0].deferred[0].required), ).toEqualQueryRoot( flattenRelayQuery( getNode( RelayClassic.QL` query { viewer { newsFeed(first: 10) { edges { cursor node { ${nestedFragment} id } } pageInfo { hasNextPage hasPreviousPage } } } } `, ), ), ); expect(deferred[0].deferred[0].required.getID()).toBe('q2'); expect(deferred[0].deferred[0].required.isDeferred()).toBe(true); // no nested nested deferreds expect(deferred[0].deferred[0].deferred).toEqual([]); }); it('splits deferred fragments using ref queries', () => { const fragment = RelayClassic.QL`fragment on Page{profilePicture{uri}}`; const node = RelayClassic.QL` query { node(id:"4") { id name hometown { ${defer(fragment)} } } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode(RelayClassic.QL`query{node(id:"4"){hometown{id},id,name}}`), ); expect(required.getID()).toBe('q1'); expect( required .getFieldByStorageKey('hometown') .getFieldByStorageKey('id') .isRefQueryDependency(), ).toBe(true); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( filterGeneratedRootFields( getRefNode( RelayClassic.QL` query { nodes(ids:$ref_q1) { ${fragment} } } `, {path: '$.*.hometown.id'}, ), ), ); expect(deferred[0].required.getID()).toBe('q2'); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferreds expect(deferred[0].deferred).toEqual([]); }); it('splits a nested deferred fragments as a ref queries', () => { const nestedFragment = RelayClassic.QL`fragment on Page{profilePicture{uri}}`; const fragment = RelayClassic.QL` fragment on User { hometown { name ${defer(nestedFragment)} } } `; const node = RelayClassic.QL` query { node(id:"4") { id name ${defer(fragment)} } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode(RelayClassic.QL`query{node(id:"4"){id,name}}`), ); expect(required.getID()).toBe('q3'); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( getNode( RelayClassic.QL` query { node(id:"4") { ${RelayClassic.QL`fragment on User{hometown{name}}`}, id } } `, ), ); expect(deferred[0].required.getID()).toBe('q2'); expect(deferred[0].required.isDeferred()).toBe(true); expect( deferred[0].required .getChildren()[0] // node(4){hometown} (fragment) .getChildren()[0] // node(4){hometown} (field) .getChildren()[0] // node(4){hometown{id}} (field) .isRefQueryDependency(), ).toBe(true); // nested deferred part expect(deferred[0].deferred.length).toBe(1); expect(deferred[0].deferred[0].required.getName()).toBe( queryNode.getName(), ); expect(deferred[0].deferred[0].required).toEqualQueryRoot( filterGeneratedRootFields( getRefNode( RelayClassic.QL` query { nodes(ids:$ref_q2) { ${nestedFragment} } } `, {path: '$.*.hometown.id'}, ), ), ); expect(deferred[0].deferred[0].required.getID()).toBe('q4'); expect(deferred[0].deferred[0].required.isDeferred()).toBe(true); // no nested nested deferreds expect(deferred[0].deferred[0].deferred).toEqual([]); }); it('splits a deferred fragment nested inside a ref query', () => { // this time, going to defer something inside the ref const nestedFragment = RelayClassic.QL`fragment on Page{address{city}}`; const fragment = RelayClassic.QL` fragment on Page { profilePicture { uri } ${defer(nestedFragment)} } `; const node = RelayClassic.QL` query { node(id:"4") { id name hometown { ${defer(fragment)} } } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode(RelayClassic.QL`query{node(id:"4"){hometown{id},id,name}}`), ); expect( required .getFieldByStorageKey('hometown') .getFieldByStorageKey('id') .isRefQueryDependency(), ).toBe(true); expect(required.getID()).toBe('q1'); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( filterGeneratedRootFields( getRefNode( RelayClassic.QL` query { nodes(ids:$ref_q1) { ${RelayClassic.QL`fragment on Page{id,profilePicture{uri}}`} } } `, {path: '$.*.hometown.id'}, ), ), ); expect(deferred[0].required.getID()).toBe('q2'); expect(deferred[0].required.isDeferred()).toBe(true); // nested deferred part expect(deferred[0].deferred.length).toBe(1); expect(deferred[0].deferred[0].required.getName()).toBe( queryNode.getName(), ); expect(deferred[0].deferred[0].required).toEqualQueryRoot( filterGeneratedRootFields( getRefNode( RelayClassic.QL` query { nodes(ids:$ref_q2) { ${nestedFragment} } } `, {path: '$.*.hometown.id'}, ), ), ); expect(deferred[0].deferred[0].required.getID()).toBe('q3'); expect(deferred[0].deferred[0].required.isDeferred()).toBe(true); // no nested nested deferreds expect(deferred[0].deferred[0].deferred).toEqual([]); }); it('drops the required portion if it is empty', () => { const fragment = RelayClassic.QL` fragment on Viewer { newsFeed(first: 10) { edges { node { id actorCount } } } } `; const node = RelayClassic.QL` query { viewer { ${defer(fragment)} } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required).toBe(null); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( getNode( RelayClassic.QL` query { viewer { ${fragment} } } `, ), ); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferred part expect(deferred[0].deferred).toEqual([]); }); it('handles a nested defer with no required part', () => { const nestedFragment = RelayClassic.QL`fragment on Viewer{primaryEmail}`; const fragment = RelayClassic.QL` fragment on Viewer { ${defer(nestedFragment)} } `; const node = RelayClassic.QL` query { viewer { isFbEmployee ${defer(fragment)} } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode( RelayClassic.QL` query { viewer{isFbEmployee} } `, ), ); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required).toBe(null); // nested deferred part expect(deferred[0].deferred.length).toBe(1); expect(deferred[0].deferred[0].required.getName()).toBe( queryNode.getName(), ); expect(deferred[0].deferred[0].required).toEqualQueryRoot( getNode( RelayClassic.QL` query { viewer { ${nestedFragment} } } `, ), ); expect(deferred[0].deferred[0].required.isDeferred()).toBe(true); // no nested nested deferreds expect(deferred[0].deferred[0].deferred).toEqual([]); }); it('handles a nested ref query defer with no required part', () => { const nestedFragment = RelayClassic.QL`fragment on Actor{hometown{name}}`; const fragment = RelayClassic.QL` fragment on Viewer { ${defer(nestedFragment)} } `; const node = RelayClassic.QL` query { viewer { actor { name ${defer(fragment)} } } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode( RelayClassic.QL` query { viewer{actor{id,name}} } `, ), ); expect(required.getID()).toBe('q1'); expect( required .getFieldByStorageKey('actor') .getFieldByStorageKey('id') .isRefQueryDependency(), ).toBe(true); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required).toBe(null); // nested deferred part expect(deferred[0].deferred.length).toBe(1); expect(deferred[0].deferred[0].required.getName()).toBe( queryNode.getName(), ); expect(deferred[0].deferred[0].required).toEqualQueryRoot( filterGeneratedRootFields( getRefNode( RelayClassic.QL` query { nodes(ids:$ref_q1) { ${nestedFragment} } } `, {path: '$.*.actor.id'}, ), ), ); expect(deferred[0].deferred[0].required.getID()).toBe('q2'); expect(deferred[0].deferred[0].required.isDeferred()).toBe(true); // no nested nested deferreds expect(deferred[0].deferred[0].deferred).toEqual([]); }); it('handles paths with plural fields', () => { const fragment = RelayClassic.QL`fragment on Actor{name}`; const node = RelayClassic.QL` query { node(id:"123") { actors { id ${defer(fragment)} } } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode( RelayClassic.QL` query { node(id:"123") { actors { id } } } `, ), ); expect(required.getID()).toBe('q1'); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( filterGeneratedRootFields( getRefNode( RelayClassic.QL` query { nodes(ids:$ref_q1) { ${fragment} } } `, {path: '$.*.actors.*.id'}, ), ), ); expect(deferred[0].required.getID()).toBe('q2'); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferreds expect(deferred[0].deferred).toEqual([]); }); it('works with nested node ancestors', () => { const fragment = RelayClassic.QL`fragment on Node{name}`; const node = RelayClassic.QL` query { viewer { actor { hometown { ${defer(fragment)} } } } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode( RelayClassic.QL` query { viewer { actor { hometown { id } } } } `, ), ); expect(required.getID()).toBe('q1'); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( filterGeneratedRootFields( getRefNode( RelayClassic.QL` query { nodes(ids:$ref_q1) { ${fragment} } } `, {path: '$.*.actor.hometown.id'}, ), ), ); expect(deferred[0].required.getID()).toBe('q2'); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferreds expect(deferred[0].deferred).toEqual([]); }); it('uses the auto-generated alias in ref query paths', () => { const fragment = RelayClassic.QL`fragment on User{firstName}`; const node = RelayClassic.QL` query { node(id:"4") { friends(first: 5) { edges { node { name ${defer(fragment)} } } } } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode( RelayClassic.QL` query { node(id:"4") { friends(first: 5) { edges { node { id name } } } } } `, ), ); expect(required.getID()).toBe('q1'); // deferred part const alias = generateRQLFieldAlias('friends.first(5)'); expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( filterGeneratedRootFields( getRefNode( RelayClassic.QL` query { nodes(ids:$ref_q1) { ${fragment} } } `, {path: '$.*.' + alias + '.edges.*.node.id'}, ), ), ); expect(deferred[0].required.getID()).toBe('q2'); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferreds expect(deferred[0].deferred).toEqual([]); }); it('correctly produces multi-level JSONPaths in ref queries', () => { const fragment = RelayClassic.QL`fragment on Actor{name}`; const node = RelayClassic.QL` query { node(id:"4") { friends(first: 5) { edges { node { ${defer(fragment)} } } } } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode( RelayClassic.QL` query { node(id:"4") { friends(first: 5) { edges { node { id } } } } } `, ), ); expect(required.getID()).toBe('q1'); // deferred part const alias = generateRQLFieldAlias('friends.first(5)'); expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( filterGeneratedRootFields( getRefNode( RelayClassic.QL` query { nodes(ids:$ref_q1) { ${fragment} } } `, {path: '$.*.' + alias + '.edges.*.node.id'}, ), ), ); expect(deferred[0].required.getID()).toBe('q2'); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferreds expect(deferred[0].deferred).toEqual([]); }); it('handles fragments that are not nodes', () => { const fragment = RelayClassic.QL`fragment on Image{uri}`; const node = RelayClassic.QL` query { node(id:"4") { id profilePicture(size: 100) { ${defer(fragment)} } } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode(RelayClassic.QL`query{node(id:"4"){id}}`), ); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( getNode( RelayClassic.QL` query { node(id:"4") { profilePicture(size: 100) { ${fragment} } } } `, ), ); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferreds expect(deferred[0].deferred).toEqual([]); }); it('omits required queries with only generated `id` fields', () => { const fragment = RelayClassic.QL`fragment on Node{name}`; const node = RelayClassic.QL` query { node(id:"4") { ${defer(fragment)} } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(required).toBe(null); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( getNode( RelayClassic.QL` query { node(id:"4") { ${fragment} } } `, ), ); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferreds expect(deferred[0].deferred).toEqual([]); }); it('does not omit "empty" required ref query dependencies', () => { // It isn't possible to produce an "empty" ref query dependency with // `RelayClassic.QL`, but in order to be future-proof against this possible edge // case, we create such a query by hand. const fragment = RelayClassic.QL`fragment on Node{name}`; const id = RelayQuery.Field.build({ fieldName: 'id', metadata: {isRequisite: true}, type: 'String', }); const typename = RelayQuery.Field.build({ fieldName: '__typename', metadata: {isRequisite: true}, type: 'String', }); let queryNode = RelayQuery.Root.build( 'splitDeferredRelayQueries', 'node', '4', [ id, typename, RelayQuery.Field.build({ fieldName: 'hometown', children: [id, getNode(defer(fragment))], metadata: { canHaveSubselections: true, isGenerated: true, inferredPrimaryKey: 'id', inferredRootCallName: 'node', }, type: 'Page', }), ], { identifyingArgName: 'id', }, ); queryNode = queryNode.clone( queryNode.getChildren().map((outerChild, ii) => { if (ii === 1) { return outerChild.clone( outerChild.getChildren().map((innerChild, jj) => { if (jj === 0) { return innerChild.cloneAsRefQueryDependency(); } else { return innerChild; } }), ); } else { return outerChild; } }), ); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode( RelayClassic.QL` query { node(id:"4"){hometown{id},id} } `, ), ); expect(required.getID()).toBe('q1'); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( filterGeneratedRootFields( getRefNode( RelayClassic.QL` query { nodes(ids:$ref_q1) { ${fragment} } } `, {path: '$.*.hometown.id'}, ), ), ); expect(deferred[0].required.getID()).toBe('q2'); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferreds expect(deferred[0].deferred).toEqual([]); }); it('preserves required queries with only a non-generated `id` field', () => { const fragment = RelayClassic.QL`fragment on Node{name}`; const node = RelayClassic.QL` query { node(id:"4") { id ${defer(fragment)} } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); // required part expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode(RelayClassic.QL`query{node(id:"4"){id}}`), ); // deferred part expect(deferred.length).toBe(1); expect(deferred[0].required.getName()).toBe(queryNode.getName()); expect(deferred[0].required).toEqualQueryRoot( getNode( RelayClassic.QL` query { node(id:"4") { ${fragment} } } `, ), ); expect(deferred[0].required.isDeferred()).toBe(true); // no nested deferreds expect(deferred[0].deferred).toEqual([]); }); it('does not split empty fragments', () => { // null fragment could be caused by an `if`/`unless` call + a GK const nullFragment = RelayClassic.QL`fragment on Viewer{${null}}`; const fragment = RelayClassic.QL`fragment on Viewer{${nullFragment}}`; const node = RelayClassic.QL` query { viewer { primaryEmail ${defer(fragment)} } } `; const queryNode = getNode(node); const {required, deferred} = splitDeferredRelayQueries(queryNode); expect(required.getName()).toBe(queryNode.getName()); expect(required).toEqualQueryRoot( getNode( RelayClassic.QL` query { viewer{primaryEmail} } `, ), ); expect(deferred.length).toBe(0); }); it('does not flatten fragments when splitting root queries', () => { const fragment = RelayClassic.QL`fragment on Node{name}`; const query = getNode( RelayClassic.QL` query { node(id:"4") { ${defer(fragment)} } } `, ); const {deferred} = splitDeferredRelayQueries(query); expect(deferred.length).toBe(1); expect(deferred[0].required).toContainQueryNode(getNode(fragment)); }); it('does not flatten fragments when splitting ref queries', () => { const fragment = RelayClassic.QL`fragment on Feedback{likers{count}}`; const query = getNode( RelayClassic.QL` query { node(id:"STORY_ID") { feedback { ${defer(fragment)} } } } `, ); const {deferred} = splitDeferredRelayQueries(query); expect(deferred.length).toBe(1); expect(deferred[0].required).toContainQueryNode(getNode(fragment)); }); });
var util = require('util'); var bleno = require('bleno'); var BlenoPrimaryService = bleno.PrimaryService; var ParkCharacteristic = require('./parkCharacteristic'); function DeviceInformationService() { DeviceInformationService.super_.call(this, { uuid: 'ec00', characteristics: [ new ParkCharacteristic() ] }); } util.inherits(DeviceInformationService, BlenoPrimaryService); module.exports = DeviceInformationService;
const expect = require('chai').expect const includeMimeType = require('../src/file').includeMimeType const findInFile = require('../src/file').findInFile describe('file : includeMimeType', () => { it('MIME_TYPES_IGNORED contain this mime type', () => { expect(includeMimeType('test/directoryTest/file2.png')).to.be.true }) it('MIME_TYPES_IGNORED not contain this mime type', () => { expect(includeMimeType('test/directoryTest/file1.js')).to.be.false }) }) describe('file : findInFile', () => { it('will some results (string)', () => { const results = findInFile('foo', 'test/directoryTest/file1.js') expect(results).to.be.eql({ 1: [5], 2: [12], 3: [5, 18] }) }) it('will some results (regExp)', () => { const results = findInFile(/foo/, 'test/directoryTest/file1.js') expect(results).to.be.eql({ 1: [5], 2: [12], 3: [5, 18] }) }) it('will nothing (string)', () => { const results = findInFile('nothing', 'test/directoryTest/file1.js') expect(results).to.be.eql({}) }) it('will nothing (regExp)', () => { const results = findInFile(/nothing/, 'test/directoryTest/file1.js') expect(results).to.be.eql({}) }) })
var fs = require('fs'); var assert = require('assert'); var JSZip = require('jszip'); var path = require('path') var compareWorkbooks = require('./util/compareworkbooks.js') var excelbuilder = require('..'); describe('It generates a simple workbook', function () { it('generates a ZIP file we can save', function (done) { var workbook = excelbuilder.createWorkbook(); var table = [ [1, 2, "", 4, 5], [2, 4, null, 16, 20], [1, 4, NaN, 16, 25], [4, 8, undefined, 16, 20] ] var sheet1 = workbook.createSheet('sheet1', table[0].length, table.length); table.forEach(function (row, rowIdx) { row.forEach(function (val, colIdx) { sheet1.set(colIdx + 1, rowIdx + 1, val) }) }) workbook.generate(function (err, zip) { if (err) throw err; zip.generateAsync({type: "nodebuffer"}).then(function (buffer) { var OUTFILE = './test/out/example.xlsx'; fs.writeFile(OUTFILE, buffer, function (err) { console.log('open \"' + OUTFILE + "\""); compareWorkbooks('./test/files/example.xlsx', OUTFILE, function (err, result) { if (err) throw err; // assert(result) done(err); }); }); }); }); }); });
var Cat = require('../src/Cat'); require('chai').should(); describe('This should pass if mutated', function(){ it('yes it should', function(){ var name = Math.random(); true.should.equal(true); }); });
var today = new Date(); var birthday = new Date(1981, 1, 16); var age = today.getTime() - birthday.getTime(); alert(age); // alert(age / 1000 / 60 / 60 / 24/ 365.25);
/* * Datagrid.js */ function dg_send(url, grid, form, page, tamano, orderby, orderdirection) { var oForm = $("#"+form); var oGrid = $("#"+grid); var oLoader = $("#loader_"+grid); $('#Form_'+grid+'_page').val(page); $('#Form_'+grid+'_tamano').val(tamano); $('#Form_'+grid+'_orderby').val(orderby); $('#Form_'+grid+'_orderdirection').val(orderdirection); $(oLoader).width($(oGrid).width()) $(oLoader).height($(oGrid).height()) jQuery(oLoader).show(); $.ajax({ type: "POST", url: Routing.generate(url), data: ($(oForm).serialize()+'&datagrid='+grid), success: function(data){ data = data.replace(/^\s*|\s*$/g,""); $(oGrid).html(data); }, error: function(XMLHttpRequest, textStatus, errorThrown){ jQuery(oLoader).hide(); $("#dialog-modal").html("Error: "+XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText); $("#dialog-modal").dialog("open"); } }); } function dg_delitem(urlreload, urldelete, grid, form, deletekey) { if (confirm("¿Está seguro que desea eliminar?")) { var oForm = $("#"+form); var oGrid = $("#"+grid); var oLoader = $("#loader_"+grid); $('#Form_'+grid+'_deletekey').val(deletekey); $(oLoader).width($(oGrid).width()) $(oLoader).height($(oGrid).height()) jQuery(oLoader).show(); $.ajax({ type: "POST", url: Routing.generate(urldelete), data: $(oForm).serialize(), success: function(data){ data = data.replace(/^\s*|\s*$/g,""); if(data == 'OK'){ dg_reload(urlreload, grid, form); }else{ jQuery(oLoader).hide(); $("#dialog-modal").html(data); $("#dialog-modal").dialog("open"); } }, error: function(XMLHttpRequest, textStatus, errorThrown){ jQuery(oLoader).hide(); $("#dialog-modal").html("Error: "+XMLHttpRequest.status + ' ' + XMLHttpRequest.statusText); $("#dialog-modal").dialog("open"); } }); } } function dg_reload(url, grid, form) { dg_send(url, grid, form, $('#Form_'+grid+'_page').val(), $('#Form_'+grid+'_tamano').val(), $('#Form_'+grid+'_orderby').val(), $('#Form_'+grid+'_orderdirection').val() ); }
"use strict"; exports.buttonEvent = function(id) { return function(cb) { return function() { var el = document.getElementById(id); el.addEventListener('click', function(ev) { cb(); }); } }; }; exports.keydownEvent = function(el) { return function(cb) { return function() { window.addEventListener('keydown', function(ev) { cb(ev)(); }); } }; }; exports.resizeEvent = function(cb) { return function() { var resizeDelay = 250; // ms delay before running resize logic var resizeTimeout = null; var throttled = function() { if (resizeTimeout) { clearTimeout(resizeTimeout); } resizeTimeout = setTimeout(function() { resizeTimeout = null; cb(exports.windowInnerSize())(); }, resizeDelay); }; window.addEventListener('resize', throttled, false); }; }; exports.windowInnerSize = function() { var w = window.innerWidth; var h = window.innerHeight; return { width: w, height: h }; }; exports.setWindow = function(k) { return function(v) { return function() { window[k] = v; }; }; }; exports.setElementContents = function(el) { return function(html) { return function() { el.innerHTML = html; }; }; }; var debugDivId = "debugDiv"; exports.initDebugDiv = function(radius) { return function() { var view = document.getElementById("browser"); var div = document.getElementById(debugDivId); if (!div) { div = document.createElement("div"); view.appendChild(div); } div.id = debugDivId; div.style['position'] = "relative"; div.style['left'] = "0.0"; div.style['top'] = "0.0"; div.style['border-radius'] = "50%"; div.style['width'] = (radius * 2.0) + "px"; div.style['height'] = (radius * 2.0) + "px"; div.style['z-index'] = "100"; div.style['backgroundColor'] = "red"; div.style['pointer-events'] = "none"; div.style['display'] = "inline-block"; div.style['visibility'] = "hidden"; div.dataset.radius = radius; return div; }; }; var getDebugDiv = function() { var div = document.getElementById(debugDivId); if (!div) { return initDebugDiv(10.0)(); } else { return div; } }; exports.setDebugDivVisibility = function(s) { return function() { var div = getDebugDiv(); div.style['visibility'] = s; }; }; exports.setDebugDivPoint = function(p) { return function() { var div = getDebugDiv(); var r = div.dataset.radius | 1.0; var x = p.x - r; var y = p.y - r * 2.0; // var y = p.y; div.style['left'] = x + "px"; div.style['top'] = y + "px"; }; };
window.appConf = { author: 'React Drive CMS', dashboardId: '1-on_GfmvaEcOk7HcWfKb8B6KFRv166RkLN2YmDEtDn4', sendContactMessageUrlId: 'AKfycbyL4vW1UWs4mskuDjLoLmf1Hjan1rTLEca6i2Hi2H_4CtKUN84d', shortname: 'easydrivecms', root: 'react-drive-cms', }
import Express from 'express'; import compression from 'compression'; import mongoose from 'mongoose'; import bodyParser from 'body-parser'; import path from 'path'; import morgan from 'morgan'; //import jwt from 'jsonwebtoken'; import IntlWrapper from '../client/modules/Intl/IntlWrapper'; // Webpack Requirements import webpack from 'webpack'; import config from '../webpack.config.dev'; import webpackDevMiddleware from 'webpack-dev-middleware'; import webpackHotMiddleware from 'webpack-hot-middleware'; // var apiRoutes = express.Router(); // Initialize the Express App const app = new Express(); const apiRoutes = require('express').Router(); // Run Webpack dev server in development mode if (process.env.NODE_ENV === 'development') { const compiler = webpack(config); app.use(webpackDevMiddleware(compiler, { noInfo: true, publicPath: config.output.publicPath })); app.use(webpackHotMiddleware(compiler)); } // React And Redux Setup import { configureStore } from '../client/store'; import { Provider } from 'react-redux'; import React from 'react'; import { renderToString } from 'react-dom/server'; import { match, RouterContext } from 'react-router'; import Helmet from 'react-helmet'; // Import required modules import routes from '../client/routes'; import { fetchComponentData } from './util/fetchData'; import posts from './routes/post.routes'; import signup from './routes/signup.routes'; import login from './routes/login.routes'; import sms from './routes/sms.routes'; import dummyData from './dummyData'; import serverConfig from './config'; // Set native promises as mongoose promise mongoose.Promise = global.Promise; // MongoDB Connection mongoose.connect(serverConfig.mongoURL, (error) => { if (error) { console.error('Please make sure Mongodb is installed and running!'); // eslint-disable-line no-console throw error; } // feed some dummy data in DB. dummyData(); }); // Apply body Parser and server public assets and routes app.use(compression()); app.use(bodyParser.json({ limit: '20mb' })); app.use(bodyParser.urlencoded({ limit: '20mb', extended: false })); app.use(morgan('dev')); app.use(Express.static(path.resolve(__dirname, '../dist'))); app.use('/api', [posts, signup, login, sms]); app.set('superSecret', config.secret); // Render Initial HTML const renderFullPage = (html, initialState) => { const head = Helmet.rewind(); // Import Manifests const assetsManifest = process.env.webpackAssets && JSON.parse(process.env.webpackAssets); const chunkManifest = process.env.webpackChunkAssets && JSON.parse(process.env.webpackChunkAssets); return ` <!doctype html> <html> <head> ${head.base.toString()} ${head.title.toString()} ${head.meta.toString()} ${head.link.toString()} ${head.script.toString()} ${process.env.NODE_ENV === 'production' ? `<link rel='stylesheet' href='${assetsManifest['/app.css']}' />` : ''} <link href='https://fonts.googleapis.com/css?family=Lato:400,300,700' rel='stylesheet' type='text/css'/> <link rel="shortcut icon" href="http://res.cloudinary.com/hashnode/image/upload/v1455629445/static_imgs/mern/mern-favicon-circle-fill.png" type="image/png" /> </head> <body> <div id="root">${html}</div> <script> window.__INITIAL_STATE__ = ${JSON.stringify(initialState)}; ${process.env.NODE_ENV === 'production' ? `//<![CDATA[ window.webpackManifest = ${JSON.stringify(chunkManifest)}; //]]>` : ''} </script> <script src='${process.env.NODE_ENV === 'production' ? assetsManifest['/vendor.js'] : '/vendor.js'}'></script> <script src='${process.env.NODE_ENV === 'production' ? assetsManifest['/app.js'] : '/app.js'}'></script> </body> </html> `; }; const renderError = err => { const softTab = '&#32;&#32;&#32;&#32;'; const errTrace = process.env.NODE_ENV !== 'production' ? `:<br><br><pre style="color:red">${softTab}${err.stack.replace(/\n/g, `<br>${softTab}`)}</pre>` : ''; return renderFullPage(`Server Error${errTrace}`, {}); }; // Server Side Rendering based on routes matched by React-router. app.use((req, res, next) => { match({ routes, location: req.url }, (err, redirectLocation, renderProps) => { if (err) { return res.status(500).end(renderError(err)); } if (redirectLocation) { return res.redirect(302, redirectLocation.pathname + redirectLocation.search); } if (!renderProps) { return next(); } const store = configureStore(); return fetchComponentData(store, renderProps.components, renderProps.params) .then(() => { const initialView = renderToString( <Provider store={store}> <IntlWrapper> <RouterContext {...renderProps} /> </IntlWrapper> </Provider> ); const finalState = store.getState(); res .set('Content-Type', 'text/html') .status(200) .end(renderFullPage(initialView, finalState)); }) .catch((error) => next(error)); }); }); // route to authenticate a user (POST http://localhost:8080/api/authenticate) // route middleware to verify a token // apiRoutes.use(function(req, res, next) { // // check header or url parameters or post parameters for token // var token = req.body.token || req.query.token || req.headers['x-access-token']; // // decode token // if (token) { // // verifies secret and checks exp // jwt.verify(token, app.get('superSecret'), function(err, decoded) { // if (err) { // return res.json({ success: false, message: 'Failed to authenticate token.' }); // } else { // // if everything is good, save to request for use in other routes // req.decoded = decoded; // next(); // } // }); // } else { // // if there is no token // // return an error // return res.status(403).send({ // success: false, // message: 'No token provided.' // }); // } // }); // route to show a random message (GET http://localhost:8080/api/) // route to return all users (GET http://localhost:8080/api/users) // apply the routes to our application with the prefix /api //app.use('/api', apiRoutes); // start app app.listen(serverConfig.port, (error) => { if (!error) { console.log(`MERN is running on port: ${serverConfig.port}! Build something amazing!`); // eslint-disable-line } }); export default app;
module.exports = flatten([ require("./base/dualfilter"), require("./base/filter"), require("./base/mirrorBlocks"), require("./base/overlayMask"), require("./base/split"), require("./base/splitMask"), require("./colourset/lerp"), require("./colourset/distinct"), require("./colourset/chunks"), require("./colourset/alpha"), require("./extras/swatch"), require("./extras/text"), require("./filter/bevel"), require("./filter/disolve"), require("./filter/roughen"), require("./filter/sharpen"), require("./filter/splash"), require("./lines/straight"), require("./lines/curve"), require("./lines/scribble"), require("./mask/halfmask"), require("./overlay/lines"), require("./overlay/network"), require("./overlay/shapes"), require("./overlay/sparkles"), require("./pallete/monochrome"), require("./pallete/hightlightAndMidtone"), require("./pallete/bicolor"), require("./pointset/static"), require("./pointset/linear"), require("./pointset/circular"), require("./pointset/grid"), require("./pointset/spiral"), require("./pointset/tree"), require("./shapes/polygon"), require("./shapes/stars"), require("./shapes/ring"), require("./shapes/circle"), require("./simple/blockColor"), require("./simple/blockOverlay"), require("./spacial/radial"), require("./spacial/chaos"), require("./spacial/linear"), require("./tiles/squares"), require("./tiles/triangles"), ]) function flatten( m ){ var retval = []; for ( var id in m ){ if ( m[id].push ){ retval = retval.concat(m[id]); }else{ retval.push(m[id]); } } return retval; }
'use strict'; angular.module('myApp').directive('loginDirective',function(){ return{ templateUrl:'partials/tpl/login.tpl.html' } });
datab = [{},{"Document Version":{"colspan":"1","rowspan":"1","text":"1.1"},"Date":{"colspan":"1","rowspan":"1","text":"October 30,2003"},"Author":{"colspan":"1","rowspan":"1","text":"WG 6"},"Description":{"colspan":"1","rowspan":"1","text":"For Final Text"}},{"Document Version":{"colspan":"1","rowspan":"1","text":"1.2"},"Date":{"colspan":"1","rowspan":"1","text":"August 30, 2007"},"Author":{"colspan":"1","rowspan":"1","text":"WG 6"},"Description":{"colspan":"1","rowspan":"1","text":"Revised Introduction"}}];
function Rook(loc, isWhite, asset){ Piece.call(this, loc, isWhite, asset); this.name = "Rook"; } Rook.prototype = Object.create(Piece.prototype); Rook.prototype.constructor = Rook; Rook.prototype.getValidMoveSet = function(board) { var result = []; var currentX = this.loc.x+1; var currentY = this.loc.y; var currentSpeculation = new Point(currentX, currentY); //moving right while(board.inBounds(currentSpeculation) && !board.locOccupied(currentSpeculation)){ result.push(currentSpeculation); currentX += 1; currentSpeculation = new Point(currentX, currentY); } var cap = board.getPieceAt(currentSpeculation); if(cap){ if(cap.isWhite() !== this.white){ result.push(currentSpeculation); } } //moving left currentX = this.loc.x-1; currentY = this.loc.y; currentSpeculation = new Point(currentX, currentY); while(board.inBounds(currentSpeculation) && !board.locOccupied(currentSpeculation)){ result.push(currentSpeculation); currentX -= 1; currentSpeculation = new Point(currentX, currentY); } cap = board.getPieceAt(currentSpeculation); if(cap){ if(cap.isWhite() !== this.white){ result.push(currentSpeculation); } } //moving up currentX = this.loc.x; currentY = this.loc.y-1; currentSpeculation = new Point(currentX, currentY); while(board.inBounds(currentSpeculation) && !board.locOccupied(currentSpeculation)){ result.push(currentSpeculation); currentY -= 1; currentSpeculation = new Point(currentX, currentY); } cap = board.getPieceAt(currentSpeculation); if(cap){ if(cap.isWhite() !== this.white){ result.push(currentSpeculation); } } //moving down currentX = this.loc.x; currentY = this.loc.y+1; currentSpeculation = new Point(currentX, currentY); while(board.inBounds(currentSpeculation) && !board.locOccupied(currentSpeculation)){ result.push(currentSpeculation); currentY += 1; currentSpeculation = new Point(currentX, currentY); } cap = board.getPieceAt(currentSpeculation); if(cap){ if(cap.isWhite() !== this.white){ result.push(currentSpeculation); } } return result; };
var dir_72c031272133aec1d916095cf903ecf1 = [ [ "HTTP", "dir_7e5fd1ff9265fa651882e3ad4d93cc88.html", "dir_7e5fd1ff9265fa651882e3ad4d93cc88" ], [ "Module", "dir_10705d0e5b4538c0e815cbe3b6497638.html", "dir_10705d0e5b4538c0e815cbe3b6497638" ] ];
var flow = require('js-flow'), assert = require('assert'), tubes = require('evo-tubes'); describe('evo-states', function () { var TIMEOUT = 60000; var sandbox; beforeEach(function (done) { this.timeout(TIMEOUT); (sandbox = new tubes.Sandbox()) .add(new tubes.Environment({ nodes: 4 })) .add(new tubes.NeuronFactory()) .add(new tubes.Connector()) .add(new tubes.States()) .start(done); }); afterEach(function (done) { sandbox.cleanup(done); }); it('synchronize', function (done) { this.timeout(TIMEOUT); var connector = sandbox.res('evo-connector'); flow.steps() .next('clientsReady') .next(function (next) { flow.each([this.clients[0], this.clients[1]]) .keys() .do(function (index, client, next) { client.commit({ key: 'val' + index }, next); }) .run(next); }) .next(function (next) { this.waitForSync({ key: 'key' }, function (data, client, index) { return [0, 1].every(function (i) { var nodeVal = data.d[connector.clients[i].localId]; return nodeVal && nodeVal.d == 'val' + i; }); }, next); }) .with(sandbox.res('evo-states')) .run(done) }); });
/** * @authors JayChenFE * @date 2017-03-21 11:17:13 * @version $1.0$ */ /** * 主要核心逻辑入口 **/ const fs = require('fs'); const path = require('path'); const staticServer = require('./static-server'); class App { constructor() { } initServer() { //方便增加别的逻辑 //返回一个函数 return (request, response) => { let { url } = request; let body = staticServer(url); response.writeHead(200, 'resolve ok', { 'X-Powered-By': 'Node.js' }); response.end(body); // const staticPrefix = path.resolve(process.cwd(), 'public'); // let staticFun = url => { // if (url == '/') { // url = '/index.html'; // } // let _path = getPath(url); // // fs.readFile(_path, 'binary', (error, data) => { // // if (error) { // // data="NOT FOUND"; // // } // // response.end(data,'binary'); // // }); // fs.readFile(_path, (error, data) => { // if (error) { // data = `NOT FOUND ${error.stack}`; // } // response.end(data); // }); // }; // staticFun(url); // if (url == '/css/index.css') { // fs.readFile('./public/css/index.css', 'utf-8', (error, data) => { // response.end(data); // }); // } // if (url == '/js/index.js') { // fs.readFile('./public/js/index.js', 'utf-8', (error, data) => { // response.end(data); // }); // } // if (url == '/') { // //第一个路径相对的是process.cwd(); // fs.readFile('./public/index.html', 'utf-8', (error, data) => { // response.end(data); // }); // } }; } } module.exports = App;
define('controllers/menuController',['jqueryui'],function($){ $('#faq').dialog({ modal:true, autoOpen: false, height:window.innerHeight * 0.75, width:window.innerWidth * 0.75, draggable:false }); $('#faq-button').click(function(event){ $('#faq').dialog('open'); }); $('#signin').dialog({ modal:true, autoOpen: false, height:window.innerHeight * 0.75, width:window.innerWidth * 0.75, draggable:false }); $('#signin-button').click(function(event){ $('#signin').dialog('open'); }); $('#facebook-login').click(function(event){ $(document).trigger('facebook-login'); }); });
const _ = require("lodash"); const Path = require("path-parser"); const { URL } = require("url"); const mongoose = require("mongoose"); const requireSignIn = require("../middlewares/requireSignIn"); const requireCredits = require("../middlewares/requireCredits"); const Mailer = require("../services/Mailer"); const surveyTemplate = require("../services/templates/surveyTemplate"); const Survey = mongoose.model("surveys"); module.exports = app => { app.get("/api/surveys", requireSignIn, async (req, res) => { const surveys = await Survey.find({ _user: req.user.id }).select({ recipients: false }); res.send(surveys); }); app.get("/api/surveys/:surveyID/:choice", (req, res) => { res.send("Thank you for your response."); }); app.post("/api/surveys/webhooks", (req, res) => { const parsedURL = new Path("/api/surveys/:surveyID/:choice"); _.chain(req.body) .map(({ email, url }) => { //do not destructure because match can be null const match = parsedURL.test(new URL(url).pathname); if (match) { return { email, surveyID: match.surveyID, choice: match.choice }; } }) .compact() .uniqBy("email", "surveyID") .each(({ surveyID, email, choice }) => { Survey.updateOne( { _id: surveyID, recipients: { $elemMatch: { email: email, responded: false } } }, { $inc: { [choice]: 1 }, $set: { "recipients.$.responded": true }, lastResponded: new Date() } ).exec(); }) .value(); res.send({}); }); app.post("/api/surveys", requireSignIn, requireCredits, async (req, res) => { const { title, subject, body, recipients } = req.body; const survey = new Survey({ title, subject, body, recipients: recipients.split(",").map(email => ({ email: email.trim() })), _user: req.user.id, dateSent: Date.now() }); const mailer = new Mailer(survey, surveyTemplate(survey)); try { await mailer.send(); await survey.save(); req.user.credits -= 1; const user = await req.user.save(); res.send(user); } catch (err) { res.status(422).send(err); } }); };
// Geometry building functions import Vector from '../vector'; import Geo from '../geo'; import earcut from 'earcut'; var Builders; export default Builders = {}; Builders.debug = false; Builders.tile_bounds = [ { x: 0, y: 0}, { x: Geo.tile_scale, y: -Geo.tile_scale } // TODO: correct for flipped y-axis? ]; // Re-scale UVs from [0, 1] range to a smaller area within the image Builders.scaleTexcoordsToSprite = function (uv, area_origin, area_size, tex_size) { var area_origin_y = tex_size[1] - area_origin[1] - area_size[1]; var suv = []; suv[0] = (uv[0] * area_size[0] + area_origin[0]) / tex_size[0]; suv[1] = (uv[1] * area_size[1] + area_origin_y) / tex_size[1]; return suv; }; Builders.getTexcoordsForSprite = function (area_origin, area_size, tex_size) { return [ Builders.scaleTexcoordsToSprite([0, 0], area_origin, area_size, tex_size), Builders.scaleTexcoordsToSprite([1, 1], area_origin, area_size, tex_size) ]; }; // Tesselate a flat 2D polygon // x & y coordinates will be set as first two elements of provided vertex_template Builders.buildPolygons = function ( polygons, vertex_data, vertex_template, { texcoord_index, texcoord_scale, texcoord_normalize }) { if (texcoord_index) { texcoord_normalize = texcoord_normalize || 1; var [[min_u, min_v], [max_u, max_v]] = texcoord_scale || [[0, 0], [1, 1]]; } var num_polygons = polygons.length; for (var p=0; p < num_polygons; p++) { var polygon = polygons[p]; // Find polygon extents to calculate UVs, fit them to the axis-aligned bounding box if (texcoord_index) { var [min_x, min_y, max_x, max_y] = Geo.findBoundingBox(polygon); var span_x = max_x - min_x; var span_y = max_y - min_y; var scale_u = (max_u - min_u) / span_x; var scale_v = (max_v - min_v) / span_y; } // Tessellate var vertices = Builders.triangulatePolygon(polygon); // Add vertex data var num_vertices = vertices.length; for (var v=0; v < num_vertices; v++) { var vertex = vertices[v]; vertex_template[0] = vertex[0]; vertex_template[1] = vertex[1]; // Add UVs if (texcoord_index) { vertex_template[texcoord_index + 0] = ((vertex[0] - min_x) * scale_u + min_u) * texcoord_normalize; vertex_template[texcoord_index + 1] = ((vertex[1] - min_y) * scale_v + min_v) * texcoord_normalize; } vertex_data.addVertex(vertex_template); } } }; // Tesselate and extrude a flat 2D polygon into a simple 3D model with fixed height and add to GL vertex buffer Builders.buildExtrudedPolygons = function ( polygons, z, height, min_height, vertex_data, vertex_template, normal_index, normal_normalize, { texcoord_index, texcoord_scale, texcoord_normalize }) { // Top var min_z = z + (min_height || 0); var max_z = z + height; vertex_template[2] = max_z; Builders.buildPolygons(polygons, vertex_data, vertex_template, { texcoord_index, texcoord_scale, texcoord_normalize }); // Walls // Fit UVs to wall quad if (texcoord_index) { texcoord_normalize = texcoord_normalize || 1; var [[min_u, min_v], [max_u, max_v]] = texcoord_scale || [[0, 0], [1, 1]]; var texcoords = [ [min_u, max_v], [min_u, min_v], [max_u, min_v], [max_u, min_v], [max_u, max_v], [min_u, max_v] ]; } var num_polygons = polygons.length; for (var p=0; p < num_polygons; p++) { var polygon = polygons[p]; for (var q=0; q < polygon.length; q++) { var contour = polygon[q]; for (var w=0; w < contour.length - 1; w++) { // Two triangles for the quad formed by each vertex pair, going from bottom to top height var wall_vertices = [ // Triangle [contour[w+1][0], contour[w+1][1], max_z], [contour[w+1][0], contour[w+1][1], min_z], [contour[w][0], contour[w][1], min_z], // Triangle [contour[w][0], contour[w][1], min_z], [contour[w][0], contour[w][1], max_z], [contour[w+1][0], contour[w+1][1], max_z] ]; // Calc the normal of the wall from up vector and one segment of the wall triangles var normal = Vector.cross( [0, 0, 1], Vector.normalize([contour[w+1][0] - contour[w][0], contour[w+1][1] - contour[w][1], 0]) ); // Update vertex template with current surface normal vertex_template[normal_index + 0] = normal[0] * normal_normalize; vertex_template[normal_index + 1] = normal[1] * normal_normalize; vertex_template[normal_index + 2] = normal[2] * normal_normalize; for (var wv=0; wv < wall_vertices.length; wv++) { vertex_template[0] = wall_vertices[wv][0]; vertex_template[1] = wall_vertices[wv][1]; vertex_template[2] = wall_vertices[wv][2]; if (texcoord_index) { vertex_template[texcoord_index + 0] = texcoords[wv][0] * texcoord_normalize; vertex_template[texcoord_index + 1] = texcoords[wv][1] * texcoord_normalize; } vertex_data.addVertex(vertex_template); } } } } }; // Build tessellated triangles for a polyline Builders.buildPolylines = function ( lines, width, vertex_data, vertex_template, { closed_polygon, remove_tile_edges, tile_edge_tolerance, texcoord_index, texcoord_scale, texcoord_normalize, scaling_index, scaling_normalize, join, cap }) { var cornersOnCap = (cap === "square") ? 2 : ((cap === "round") ? 3 : 0); // Butt is the implicit default var trianglesOnJoin = (join === "bevel") ? 1 : ((join === "round") ? 3 : 0); // Miter is the implicit default // Build variables texcoord_normalize = texcoord_normalize || 1; var [[min_u, min_v], [max_u, max_v]] = texcoord_scale || [[0, 0], [1, 1]]; // Values that are constant for each line and are passed to helper functions var constants = { vertex_data, vertex_template, halfWidth: width/2, vertices: [], scaling_index, scaling_normalize, scalingVecs: scaling_index && [], texcoord_index, texcoords: texcoord_index && [], texcoord_normalize, min_u, min_v, max_u, max_v, nPairs: 0 }; for (var ln = 0; ln < lines.length; ln++) { var line = lines[ln]; var lineSize = line.length; // Ignore non-lines if (lineSize < 2) { continue; } // Initialize variables var coordPrev = [0, 0], // Previous point coordinates coordCurr = [0, 0], // Current point coordinates coordNext = [0, 0]; // Next point coordinates var normPrev = [0, 0], // Right normal to segment between previous and current m_points normCurr = [0, 0], // Right normal at current point, scaled for miter joint normNext = [0, 0]; // Right normal to segment between current and next m_points var isPrev = false, isNext = true; // Add vertices to buffer according to their index indexPairs(constants); // Do this with the rest (except the last one) for (let i = 0; i < lineSize ; i++) { // There is a next one? isNext = i+1 < lineSize; if (isPrev) { // If there is a previous one, copy the current (previous) values on *Prev coordPrev = coordCurr; normPrev = Vector.normalize(Vector.perp(coordPrev, line[i])); } else if (i === 0 && closed_polygon === true) { // If it's the first point and is a closed polygon var needToClose = true; if (remove_tile_edges) { if(Builders.isOnTileEdge(line[i], line[lineSize-2], { tolerance: tile_edge_tolerance })) { needToClose = false; } } if (needToClose) { coordPrev = line[lineSize-2]; normPrev = Vector.normalize(Vector.perp(coordPrev, line[i])); isPrev = true; } } // Assign current coordinate coordCurr = line[i]; if (isNext) { coordNext = line[i+1]; } else if (closed_polygon === true) { // If it's the last point in a closed polygon coordNext = line[1]; isNext = true; } if (isNext) { // If it's not the last one get next coordinates and calculate the right normal normNext = Vector.normalize(Vector.perp(coordCurr, coordNext)); if (remove_tile_edges) { if (Builders.isOnTileEdge(coordCurr, coordNext, { tolerance: tile_edge_tolerance })) { normCurr = Vector.normalize(Vector.perp(coordPrev, coordCurr)); if (isPrev) { addVertexPair(coordCurr, normCurr, i/lineSize, constants); constants.nPairs++; // Add vertices to buffer acording their index indexPairs(constants); } isPrev = false; continue; } } } // Compute current normal if (isPrev) { // If there is a PREVIOUS ... if (isNext) { // ... and a NEXT ONE, compute previous and next normals (scaled by the angle with the last prev) normCurr = Vector.normalize(Vector.add(normPrev, normNext)); var scale = 2 / (1 + Math.abs(Vector.dot(normPrev, normCurr))); normCurr = Vector.mult(normCurr,scale*scale); } else { // ... and there is NOT a NEXT ONE, copy the previous next one (which is the current one) normCurr = Vector.normalize(Vector.perp(coordPrev, coordCurr)); } } else { // If there is NO PREVIOUS ... if (isNext) { // ... and a NEXT ONE, normNext = Vector.normalize(Vector.perp(coordCurr, coordNext)); normCurr = normNext; } else { // ... and NO NEXT ONE, nothing to do (without prev or next one this is just a point) continue; } } if (isPrev || isNext) { // If it's the BEGINNING of a LINE if (i === 0 && !isPrev && !closed_polygon) { addCap(coordCurr, normCurr, cornersOnCap, true, constants); } // If it's a JOIN if(trianglesOnJoin !== 0 && isPrev && isNext) { addJoin([coordPrev, coordCurr, coordNext], [normPrev,normCurr, normNext], i/lineSize, trianglesOnJoin, constants); } else { addVertexPair(coordCurr, normCurr, i/(lineSize-1), constants); } if (isNext) { constants.nPairs++; } isPrev = true; } } // Add vertices to buffer according to their index indexPairs(constants); // If it's the END of a LINE if(!closed_polygon) { addCap(coordCurr, normCurr, cornersOnCap , false, constants); } } }; // Add to equidistant pairs of vertices (internal method for polyline builder) function addVertex(coord, normal, uv, { halfWidth, vertices, scalingVecs, texcoords }) { if (scalingVecs) { // a. If scaling is on add the vertex (the currCoord) and the scaling Vecs (normals pointing where to extrude the vertices) vertices.push(coord); scalingVecs.push(normal); } else { // b. Add the extruded vertices vertices.push([coord[0] + normal[0] * halfWidth, coord[1] + normal[1] * halfWidth]); } // c) Add UVs if they are enabled if (texcoords) { texcoords.push(uv); } } // Add to equidistant pairs of vertices (internal method for polyline builder) function addVertexPair (coord, normal, v_pct, constants) { addVertex(coord, normal, [constants.max_u, (1-v_pct)*constants.min_v + v_pct*constants.max_v], constants); addVertex(coord, Vector.neg(normal), [constants.min_u, (1-v_pct)*constants.min_v + v_pct*constants.max_v], constants); } // Tessalate a FAN geometry between points A B // using their normals from a center \ . . / // and interpolating their UVs \ p / // \./ // C function addFan (coord, nA, nC, nB, uA, uC, uB, signed, numTriangles, constants) { if (numTriangles < 1) { return; } // Add previous vertices to buffer and clear the buffers and index pairs // because we are going to add more triangles. indexPairs(constants); var normCurr = Vector.set(nA); var normPrev = [0,0]; var angle_delta = Vector.dot(nA, nB); if (angle_delta < -1) { angle_delta = -1; } angle_delta = Math.acos(angle_delta)/numTriangles; if (!signed) { angle_delta *= -1; } var uvCurr = Vector.set(uA); var uv_delta = Vector.div(Vector.sub(uB,uA), numTriangles); // Add the FIRST and CENTER vertex // The triangles will be composed in a FAN style around it addVertex(coord, nC, uC, constants); // Add first corner addVertex(coord, normCurr, uA, constants); // Iterate through the rest of the corners for (var t = 0; t < numTriangles; t++) { normPrev = Vector.normalize(normCurr); normCurr = Vector.rot( Vector.normalize(normCurr), angle_delta); // Rotate the extrusion normal if (numTriangles === 4 && (t === 0 || t === numTriangles - 2)) { var scale = 2 / (1 + Math.abs(Vector.dot(normPrev, normCurr))); normCurr = Vector.mult(normCurr, scale*scale); } uvCurr = Vector.add(uvCurr,uv_delta); addVertex(coord, normCurr, uvCurr, constants); // Add computed corner } for (var i = 0; i < numTriangles; i++) { if (signed) { addIndex(i+2, constants); addIndex(0, constants); addIndex(i+1, constants); } else { addIndex(i+1, constants); addIndex(0, constants); addIndex(i+2, constants); } } // Clear the buffer constants.vertices = []; if (constants.scalingVecs) { constants.scalingVecs = []; } if (constants.texcoords) { constants.texcoords = []; } } // Add special joins (not miter) types that require FAN tessellations // Using http://www.codeproject.com/Articles/226569/Drawing-polylines-by-tessellation as reference function addJoin (coords, normals, v_pct, nTriangles, constants) { var T = [Vector.set(normals[0]), Vector.set(normals[1]), Vector.set(normals[2])]; var signed = Vector.signed_area(coords[0], coords[1], coords[2]) > 0; var nA = T[0], // normal to point A (aT) nC = Vector.neg(T[1]), // normal to center (-vP) nB = T[2]; // normal to point B (bT) var uA = [constants.max_u, (1-v_pct)*constants.min_v + v_pct*constants.max_v], uC = [constants.min_u, (1-v_pct)*constants.min_v + v_pct*constants.max_v], uB = [constants.max_u, (1-v_pct)*constants.min_v + v_pct*constants.max_v]; if (signed) { addVertex(coords[1], nA, uA, constants); addVertex(coords[1], nC, uC, constants); } else { nA = Vector.neg(T[0]); nC = T[1]; nB = Vector.neg(T[2]); uA = [constants.min_u, (1-v_pct)*constants.min_v + v_pct*constants.max_v]; uC = [constants.max_u, (1-v_pct)*constants.min_v + v_pct*constants.max_v]; uB = [constants.min_u, (1-v_pct)*constants.min_v + v_pct*constants.max_v]; addVertex(coords[1], nC, uC, constants); addVertex(coords[1], nA, uA, constants); } addFan(coords[1], nA, nC, nB, uA, uC, uB, signed, nTriangles, constants); if (signed) { addVertex(coords[1], nB, uB, constants); addVertex(coords[1], nC, uC, constants); } else { addVertex(coords[1], nC, uC, constants); addVertex(coords[1], nB, uB, constants); } } // Function to add the vertex need for line caps, // because re-use the buffers needs to be at the end function addCap (coord, normal, numCorners, isBeginning, constants) { if (numCorners < 1) { return; } // UVs var uvA = [constants.min_u,constants.min_v], // Beginning angle UVs uvC = [constants.min_u+(constants.max_u-constants.min_u)/2, constants.min_v], // center point UVs uvB = [constants.max_u,constants.min_v]; // Ending angle UVs if (!isBeginning) { uvA = [constants.min_u,constants.max_v], // Begining angle UVs uvC = [constants.min_u+(constants.max_u-constants.min_u)/2, constants.max_v], // center point UVs uvB = [constants.max_u,constants.max_v]; } addFan( coord, Vector.neg(normal), [0, 0], normal, uvA, uvC, uvB, isBeginning, numCorners*2, constants); } // Add a vertex based on the index position into the VBO (internal method for polyline builder) function addIndex (index, { vertex_data, vertex_template, halfWidth, vertices, scaling_index, scaling_normalize, scalingVecs, texcoord_index, texcoords, texcoord_normalize }) { // Prevent access to undefined vertices if (index >= vertices.length) { return; } // set vertex position vertex_template[0] = vertices[index][0]; vertex_template[1] = vertices[index][1]; // set UVs if (texcoord_index) { vertex_template[texcoord_index + 0] = texcoords[index][0] * texcoord_normalize; vertex_template[texcoord_index + 1] = texcoords[index][1] * texcoord_normalize; } // set Scaling vertex (X, Y normal direction + Z halfwidth as attribute) if (scaling_index) { vertex_template[scaling_index + 0] = scalingVecs[index][0] * scaling_normalize; vertex_template[scaling_index + 1] = scalingVecs[index][1] * scaling_normalize; vertex_template[scaling_index + 2] = halfWidth; } // Add vertex to VBO vertex_data.addVertex(vertex_template); } // Add the index vertex to the VBO and clean the buffers function indexPairs (constants) { // Add vertices to buffer acording their index for (var i = 0; i < constants.nPairs; i++) { addIndex(2*i+2, constants); addIndex(2*i+1, constants); addIndex(2*i+0, constants); addIndex(2*i+2, constants); addIndex(2*i+3, constants); addIndex(2*i+1, constants); } constants.nPairs = 0; // Clean the buffer constants.vertices = []; if (constants.scalingVecs) { constants.scalingVecs = []; } if (constants.texcoords) { constants.texcoords = []; } } // Build a billboard sprite quad centered on a point. Sprites are intended to be drawn in screenspace, and have // properties for width, height, angle, and a scale factor that can be used to interpolate the screenspace size // of a sprite between two zoom levels. Builders.buildQuadsForPoints = function ( points, width, height, angle, scale, vertex_data, vertex_template, scaling_index, { texcoord_index, texcoord_scale, texcoord_normalize }) { let w2 = width / 2; let h2 = height / 2; let scaling = [ [-w2, -h2], [w2, -h2], [w2, h2], [-w2, -h2], [w2, h2], [-w2, h2] ]; let texcoords; if (texcoord_index) { texcoord_normalize = texcoord_normalize || 1; let [[min_u, min_v], [max_u, max_v]] = texcoord_scale || [[0, 0], [1, 1]]; texcoords = [ [min_u, min_v], [max_u, min_v], [max_u, max_v], [min_u, min_v], [max_u, max_v], [min_u, max_v] ]; } let num_points = points.length; for (let p=0; p < num_points; p++) { let point = points[p]; for (let pos=0; pos < 6; pos++) { // Add texcoords if (texcoord_index) { vertex_template[texcoord_index + 0] = texcoords[pos][0] * texcoord_normalize; vertex_template[texcoord_index + 1] = texcoords[pos][1] * texcoord_normalize; } vertex_template[0] = point[0]; vertex_template[1] = point[1]; vertex_template[scaling_index + 0] = scaling[pos][0]; vertex_template[scaling_index + 1] = scaling[pos][1]; vertex_template[scaling_index + 2] = angle; vertex_template[scaling_index + 3] = scale; vertex_data.addVertex(vertex_template); } } }; /* Utility functions */ // Triangulation using earcut // https://github.com/mapbox/earcut Builders.triangulatePolygon = function (contours) { return earcut(contours); }; // Tests if a line segment (from point A to B) is nearly coincident with the edge of a tile Builders.isOnTileEdge = function (pa, pb, options) { options = options || {}; var tolerance_function = options.tolerance_function || Builders.valuesWithinTolerance; var tolerance = options.tolerance || 1; var tile_min = Builders.tile_bounds[0]; var tile_max = Builders.tile_bounds[1]; var edge = null; if (tolerance_function(pa[0], tile_min.x, tolerance) && tolerance_function(pb[0], tile_min.x, tolerance)) { edge = 'left'; } else if (tolerance_function(pa[0], tile_max.x, tolerance) && tolerance_function(pb[0], tile_max.x, tolerance)) { edge = 'right'; } else if (tolerance_function(pa[1], tile_min.y, tolerance) && tolerance_function(pb[1], tile_min.y, tolerance)) { edge = 'top'; } else if (tolerance_function(pa[1], tile_max.y, tolerance) && tolerance_function(pb[1], tile_max.y, tolerance)) { edge = 'bottom'; } return edge; }; Builders.valuesWithinTolerance = function (a, b, tolerance) { tolerance = tolerance || 1; return (Math.abs(a - b) < tolerance); };
#target "InDesign" #include "../datetimef.js" var today = new Date(2014, 2, 8, 13, 23, 46, 300); // => Sat Mar 08 2014 13:23:46 GMT+0900 var ret = []; var t = function(done, expect) { done_str = done; if (done === expect) { ret.push("[Passed]: return => " + expect); } else { ret.push("[Failed]: expect " + expect + ", but return => " + done); } } // tests t( datetimef(today)+"", Error("No Format")+""); t( datetimef(today, 123)+"", Error("No Format")+""); t( datetimef(today, ""), ""); t( datetimef(today, "%X"), "%X"); t( datetimef("today", "%Y")+"", Error("Not Date")+""); t( datetimef(today, "%Y"), "2014"); t( datetimef(today, "%y"), "14"); t( datetimef(today, "%m"), "03"); t( datetimef(today, "%B"), "March"); t( datetimef(today, "%b"), "Mar"); t( datetimef(today, "%d"), "08"); t( datetimef(today, "%e"), " 8"); t( datetimef(today, "%j"), "67"); t( datetimef(today, "%H"), "13"); t( datetimef(today, "%k"), "13"); t( datetimef(today, "%I"), "01"); t( datetimef(today, "%l"), " 1"); t( datetimef(today, "%p"), "PM"); t( datetimef(today, "%P"), "pm"); t( datetimef(today, "%M"), "23"); t( datetimef(today, "%S"), "46"); t( datetimef(today, "%L"), "300"); t( datetimef(today, "%z"), "-0900"); t( datetimef(today, "%A"), "Saturday"); t( datetimef(today, "%a"), "Sat"); t( datetimef(today, "%u"), "7"); t( datetimef(today, "%w"), "6"); t( datetimef(today, "%s"), "1394252626300"); t( datetimef(today, "%Y%m%d"), "20140308" ); t( datetimef(today, "%F"), "2014-03-08" ); t( datetimef(today, "%Y-%m"), "2014-03" ); t( datetimef(today, "%Y"), "2014" ); t( datetimef(today, "%Y%j"), "201467" ); t( datetimef(today, "%Y-%j"), "2014-67" ); t( datetimef(today, "%H%M%S"), "132346" ); t( datetimef(today, "%T"), "13:23:46" ); t( datetimef(today, "%H%M"), "1323" ); t( datetimef(today, "%H:%M"), "13:23" ); t( datetimef(today, "%H"), "13" ); t( datetimef(today, "%H%M%S,%L"), "132346,300" ); t( datetimef(today, "%T,%L"), "13:23:46,300" ); t( datetimef(today, "%H%M%S.%L"), "132346.300" ); t( datetimef(today, "%T.%L"), "13:23:46.300" ); t( datetimef(today, "%H%M%S%z"), "132346-0900" ); t( datetimef(today, "%Y%m%dT%H%M%S%z"), "20140308T132346-0900" ); t( datetimef(today, "%Y%jT%H%M%S%z"), "201467T132346-0900" ); t( datetimef(today, "%Y%m%dT%H%M"), "20140308T1323" ); t( datetimef(today, "%FT%R"), "2014-03-08T13:23" ); t( datetimef(today, "%Y%jT%H%MZ"), "201467T1323Z" ); t( datetimef(today, "%Y-%jT%RZ"), "2014-67T13:23Z" ); $.writeln(ret.join("\n")); /* toString,toSource [Passed]: return => エラー: No Format [Passed]: return => エラー: No Format [Passed]: return => [Passed]: return => %X [Passed]: return => エラー: Not Date [Passed]: return => 2014 [Passed]: return => 14 [Passed]: return => 03 [Passed]: return => March [Passed]: return => Mar [Passed]: return => 08 [Passed]: return =>  8 [Passed]: return => 67 [Passed]: return => 13 [Passed]: return => 13 [Passed]: return => 01 [Passed]: return =>  1 [Passed]: return => PM [Passed]: return => pm [Passed]: return => 23 [Passed]: return => 46 [Passed]: return => 300 [Passed]: return => -0900 [Passed]: return => Saturday [Passed]: return => Sat [Passed]: return => 7 [Passed]: return => 6 [Passed]: return => 1394252626300 [Passed]: return => 20140308 [Passed]: return => 2014-03-08 [Passed]: return => 2014-03 [Passed]: return => 2014 [Passed]: return => 201467 [Passed]: return => 2014-67 [Passed]: return => 132346 [Passed]: return => 13:23:46 [Passed]: return => 1323 [Passed]: return => 13:23 [Passed]: return => 13 [Passed]: return => 132346,300 [Passed]: return => 13:23:46,300 [Passed]: return => 132346.300 [Passed]: return => 13:23:46.300 [Passed]: return => 132346-0900 [Passed]: return => 20140308T132346-0900 [Passed]: return => 201467T132346-0900 [Passed]: return => 20140308T1323 [Passed]: return => 2014-03-08T13:23 [Passed]: return => 201467T1323Z [Passed]: return => 2014-67T13:23Z */
import { all } from 'redux-saga/effects'; import WatchUsers from 'sagas/users'; export default function *WatchSagas() { yield all([ WatchUsers() ]); }
//initialize Settings. zsi.init({ baseURL : base_url ,errorUpdateURL : base_url + "common/errors_update" ,sqlConsoleName : "runsql" ,excludeAjaxWatch : ["checkDataExist","employe_search_json"] }); //check cookie and load user menus. var userInfo = readCookie("userinfo"); if(userInfo){ if(isLocalStorageSupport()) { userInfo = JSON.parse(localStorage.getItem("userinfo")); var menuInfo = localStorage.getItem("menuInfo"); if(menuInfo){ displayMenu( JSON.parse(menuInfo)); } }else{ loadMenu(); loadUserInfo(); } }else{ loadMenu(); loadUserInfo(); } function isLocalStorageSupport(){ if(typeof(Storage) !== "undefined") return true; else return false; } function loadMenu(){ $.getJSON(base_url + "menu_types/getdata_json",function(data){ if(isLocalStorageSupport()) { localStorage.setItem("menuInfo", JSON.stringify(data)); } displayMenu(data); }); } function loadUserInfo(){ $.getJSON(base_url + "users/getuserinfo",function(data){ createCookie("userinfo", "*",1); localStorage.setItem("userinfo", JSON.stringify(data)); userInfo = data; }); } function displayMenu(data){ var nav = $("#navbar-main"); var m = '<ul class="nav navbar-nav">'; $.each(data,function(){ var mlength= this.subMenus.length; m += '<li class="dropdown">'; m += '<a data-toggle="dropdown" class="dropdown-toggle" href="#">' + this.name + ( mlength >0 ? '<span class="caret"></span>':'') + '</a>'; if(mlength>0){ m +='<ul class="dropdown-menu">'; $.each(this.subMenus,function(){ m +='<li><a href="' + base_url + this.url + '">' + this.name + '</a></li>'; }); m +='</ul>'; } m += '</>'; }); m +='<url>'; nav.append(m); }
var recLength = 0, recBuffers = [], sampleRate; this.onmessage = function(e){ switch(e.data.command){ case 'init': init(e.data.config); break; case 'record': record(e.data.buffer); break; case 'exportWAV': exportWAV(e.data.type); break; case 'getBuffer': getBuffer(); break; case 'clear': clear(); break; } }; function init(config){ sampleRate = config.sampleRate; } function record(inputBuffer){ var bufferL = inputBuffer[0]; var bufferR = inputBuffer[1]; var interleaved = interleave(bufferL, bufferR); recBuffers.push(interleaved); recLength += interleaved.length; } function exportWAV(type){ var buffer = mergeBuffers(recBuffers, recLength); var dataview = encodeWAV(buffer); var audioBlob = new Blob([dataview], { type: type }); this.postMessage(audioBlob); } function getBuffer() { var buffer = mergeBuffers(recBuffers, recLength) this.postMessage(buffer); } function clear(){ recLength = 0; recBuffers = []; } function mergeBuffers(recBuffers, recLength){ var result = new Float32Array(recLength); var offset = 0; for (var i = 0; i < recBuffers.length; i++){ result.set(recBuffers[i], offset); offset += recBuffers[i].length; } return result; } function interleave(inputL, inputR){ var length = inputL.length + inputR.length; var result = new Float32Array(length); var index = 0, inputIndex = 0; while (index < length){ result[index++] = inputL[inputIndex]; result[index++] = inputR[inputIndex]; inputIndex++; } return result; } function floatTo16BitPCM(output, offset, input){ for (var i = 0; i < input.length; i++, offset+=2){ var s = Math.max(-1, Math.min(1, input[i])); output.setInt16(offset, s < 0 ? s * 0x8000 : s * 0x7FFF, true); } } function writeString(view, offset, string){ for (var i = 0; i < string.length; i++){ view.setUint8(offset + i, string.charCodeAt(i)); } } function encodeWAV(samples){ var buffer = new ArrayBuffer(44 + samples.length * 2); var view = new DataView(buffer); /* RIFF identifier */ writeString(view, 0, 'RIFF'); /* file length */ view.setUint32(4, 32 + samples.length * 2, true); /* RIFF type */ writeString(view, 8, 'WAVE'); /* format chunk identifier */ writeString(view, 12, 'fmt '); /* format chunk length */ view.setUint32(16, 16, true); /* sample format (raw) */ view.setUint16(20, 1, true); /* channel count */ view.setUint16(22, 2, true); /* sample rate */ view.setUint32(24, sampleRate, true); /* byte rate (sample rate * block align) */ view.setUint32(28, sampleRate * 4, true); /* block align (channel count * bytes per sample) */ view.setUint16(32, 4, true); /* bits per sample */ view.setUint16(34, 16, true); /* data chunk identifier */ writeString(view, 36, 'data'); /* data chunk length */ view.setUint32(40, samples.length * 2, true); floatTo16BitPCM(view, 44, samples); return view; }
function dialogoCV() { var dialogo = getDiv(); var actualizarDialogoPsiquica = function() { var titulo; var contenido; var cvLibres = personaje_actual.getHabilidadDePersonaje(HB_CV).valorFinalActual() - personaje_actual.getCVGastados(); dialogo.empty(); /** * CVs, potencial psíquico e innatos */ dialogo.append(muestraSubtitulo(UI_CVS_POTENCIAL, false, false, [])); var divHabilidades = getDiv(); divHabilidades.append(muestraCabecerasBaseBonosFinal()); var divCVs = getDiv().append(muestraHabilidadPrimaria(HB_CV,_l(UI_CV),true)); var divCVsLibres = getDiv().append(muestraValorPuntual(0,_l(UI_CV_LIBRES),cvLibres,{})); var divPotencial = getDiv().append(muestraHabilidadPrimaria(HB_POTENCIAL_PSIQUICO,_l(UI_POTENCIAL_PSIQUICO),true)); var botonMasInnato = boton("small primary pretty btn",_l("+"),(cvLibres < 2)); var botonMenosInnato = boton("small secondary pretty btn",_l("-"),(personaje_actual.getInnatosPsiquicos() == 0)); var divBotones = getDiv().append(botonMasInnato).append(botonMenosInnato); var divInnatos = getDiv().append(muestraValorPuntual("2 CV",_l(UI_INNATO),personaje_actual.getInnatosPsiquicos(),{},divBotones)); botonMasInnato.on("click", {cantidad: 1}, comprarInnato); botonMenosInnato.on("click", {cantidad: -1}, comprarInnato); divHabilidades.append(divCVs).append(divCVsLibres).append(divPotencial).append(divInnatos); dialogo.append(divHabilidades); /** * Disciplinas y poderes */ dialogo.append(muestraSubtitulo(UI_DISCIPLINAS_DOMINADAS, false, false, [])); var botonAfinidadDisciplinaDisabled = false; if (cvLibres < 1) { botonAfinidadDisciplinaDisabled = true; } if (!personaje_actual.hasFlag(FLAG_PSIQUICO)) { botonAfinidadDisciplinaDisabled = true; } else if (!personaje_actual.hasFlag(FLAG_ACCESO_TODAS_DISCIPLINAS)) { if (personaje_actual.getDisciplinasPsiquicas().length == personaje_actual.getAccesoDisciplinas().length) { botonAfinidadDisciplinaDisabled = true; } } var divBotonNuevaDisciplina = muestraBotonPequeño(_l(UI_AFINIDAD_CON_NUEVA_DISCIPLINA) + "[1 " + _l(UI_CV) + "]",{},afinidadNuevaDisciplina,""); //boton("medium primary pretty btn",,botonAfinidadDisciplinaDisabled); dialogo.append(divBotonNuevaDisciplina); if (botonAfinidadDisciplinaDisabled) { disableButton(divBotonNuevaDisciplina); } var zonasDisciplinas = getDiv(); /** * * @type {DisciplinaPsiquicaAccedida[]} */ var disciplinasPsiquicas = personaje_actual.getDisciplinasPsiquicas(); for (var i = 0; i < disciplinasPsiquicas.length; i++) { titulo = $("<h3></h3>").append(_l(disciplinasPsiquicas[i].getNombre())); titulo.append(muestraBotonAnular(eliminarAfinidadDisciplina,{disciplina: disciplinasPsiquicas[i]})); contenido = getDiv().attr("id","disciplinaPsiquica" + disciplinasPsiquicas[i].getNombre().replace(/\s+/g, '')); appendPoderesPsiquicos(contenido,disciplinasPsiquicas[i].disciplina); zonasDisciplinas.append(titulo).append(contenido); } var poderesMatriciales = getDisciplina(DISCIPLINA_PODERES_MATRICIALES); titulo = $("<h3></h3>").append(_l(poderesMatriciales.getNombre())); contenido = getDiv().attr("id","disciplinaPsiquica" + poderesMatriciales.getNombre().replace(/\s+/g, '')); if (personaje_actual.hasFlag(FLAG_PSIQUICO)) { appendPoderesPsiquicos(contenido,poderesMatriciales); } zonasDisciplinas.append(titulo).append(contenido); zonasDisciplinas.accordion({ heightStyle: "content" }); dialogo.append(zonasDisciplinas); }; actualizarDialogoPsiquica(); dialogo.dialog({ modal: true, autoOpen: true, resizable: true, draggable: true, title: _l(DIAG_PODERES_PSIQUICOS), position: "center", width: ANCHO_DIALOGO, height: ALTO_DIALOGO, maxHeight: ALTO_DIALOGO, closeOnEscape: true }); dialogo.on("close",function( event, ui ) { dialogo.empty(); removeActualizador(EVENT_CHARACTER_SECCION_PSIQUICA,actualizarDialogoPsiquica); }); addActualizador(EVENT_CHARACTER_SECCION_PSIQUICA,actualizarDialogoPsiquica); } function appendPoderesPsiquicos(elemento, disciplinaPsiquica) { var poderesDominados = personaje_actual.getPoderesDominadosDisciplina(disciplinaPsiquica); var noQuedanCV = (personaje_actual.getHabilidadDePersonaje(HB_CV).valorFinalActual()-personaje_actual.getCVGastados() == 0); var nuevoPoder = muestraBotonPequeño(_l(UI_DOMINAR_NUEVO_PODER) + "[1 " + _l(UI_CV) + "]",{disciplina: disciplinaPsiquica},elegirPoderADominar,""); elemento.append(nuevoPoder); if (((poderesDominados.length == disciplinaPsiquica.getPoderesPsiquicos().length) || noQuedanCV)) { disableButton(nuevoPoder); } for (var i = 0; i < poderesDominados.length; i++) { var poder = poderesDominados[i]; var divPoder = getDiv(); var botonMas = boton("small primary pretty btn",_l("+"),((poder.getFortalecimiento() == 10) || noQuedanCV)); var botonMenos = boton("small primary pretty btn",_l("-"),(poder.getFortalecimiento() == 0)); var divBotones = getDiv().append(botonMas).append(botonMenos); var labelPoder = muestraValorPuntual(" " + _l(UI_NV) + ":" + poder.getPoder().getNivel() + " ",_l(poder.getPoder().getNombre()),poder.getFortalecimiento()*10,{descripcion:_l(UI_POTENCIAL)},divBotones); divPoder.append(labelPoder); botonMas.on("click", {disciplina: disciplinaPsiquica, poder: poder, cantidad: 1}, fortalecerPoderPsiquico); botonMenos.on("click", {disciplina: disciplinaPsiquica, poder: poder, cantidad: -1}, fortalecerPoderPsiquico); divPoder.append(botonMas).append(botonMenos).append(muestraBotonAnular(eliminarPoderDominado,{disciplina: disciplinaPsiquica, poder: poder})); elemento.append(divPoder); } } function elegirPoderADominar(event) { var disciplina = event.data.disciplina; var arrayOpciones = []; var poderesPsiquicos = disciplina.getPoderesPsiquicos(); for (var j = 0; j < poderesPsiquicos.length; j++) { var poder = poderesPsiquicos[j]; arrayOpciones.push(new OpcionMostrable(_l(poder.getNombre()),poder.getNombre(),"",_l(poder.getDescripcion()))); } muestraDialogoElegirOpciones(arrayOpciones, {disciplina: disciplina}, {principal: dominarPoder, isDisabled: noPuedeDominarPoder}, true); }
import React, {Component, PropTypes} from 'react'; import {View, ListView, Image, CameraRoll, TouchableHighlight, StyleSheet} from 'react-native'; import MessageDao from '../../dao/MessageDao'; import LoadingSpinner from '../common/LoadingSpinner'; import Icon from 'react-native-vector-icons/MaterialIcons'; import MediaRenderer from './MediaRenderer'; import {InteractionManager} from 'react-native'; import { Dimensions } from 'react-native'; class MediaGallery extends Component { constructor(props, context) { super(props, context); this.state = {mediasForThread: [], isLoading: true}; } componentDidMount(){ let threadId = this.props.threadId; InteractionManager.runAfterInteractions(() => { requestAnimationFrame(() => { this.openGalleryForThread(threadId); }); }); } reloadMedia(){ let threadId = this.props.threadId; this.openGalleryForThread(threadId); } openGalleryForThread(threadId){ let mediaResult = MessageDao.getMediasForThread(threadId); this.setState({ mediasForThread: mediaResult.mediasForThread, isLoading: false }); } render() { const {router} = this.props; let imagesDS = new ListView.DataSource({ rowHasChanged: (r1, r2) => r1 !== r2}); //let lotOfImages = []; //const images = this.state.mediasForThread; //lotOfImages = lotOfImages.concat(images, images, images); //imagesDS = imagesDS.cloneWithRows(lotOfImages); imagesDS = imagesDS.cloneWithRows(this.state.mediasForThread); if(this.state.isLoading){ return( <View style={[styles.loadingContainer]}> <LoadingSpinner size="large"/> </View> ); } else{ return ( <View style={[styles.container]}> <ListView contentContainerStyle={styles.imageGrid} enableEmptySections={true} dataSource={imagesDS} renderRow={(media) => this.renderMedia(media)} initialListSize={15} scrollRenderAheadDistance={500} pagingEnabled={true} pageSize={1} removeClippedSubviews={true} /> </View> ); } } renderMedia(media){ return( <TouchableHighlight onPress={() => this.openMediaViewer(media)}> <View> <MediaRenderer media={media} router={this.props.router} threadId={this.props.threadId} mediaViewerEnabled={true} mediaStyle={styles.image}/> </View> </TouchableHighlight> ); } openMediaViewer(media){ this.props.router.toMediaViewer({selectedMedia: media, threadId: this.props.threadId}); } } const styles = StyleSheet.create({ container: { flex: 1, backgroundColor: 'black', borderRadius: 4, borderWidth: 0.5, borderColor: '#d6d7da', paddingBottom: 10 }, loadingContainer:{ flex: 1, justifyContent: 'center', alignItems: 'center', backgroundColor: 'black', height: Dimensions.get('window').height, width: Dimensions.get('window').width, }, image: { width: 100, height: 100, margin: 2, justifyContent: 'center', }, imageGrid: { flexDirection: 'row', flexWrap: 'wrap', justifyContent: 'space-around', marginBottom: 50 }, }); MediaRenderer.propTypes = { router: PropTypes.object.isRequired, threadId: PropTypes.number.isRequired, }; export default MediaGallery;
/**! * koa-generic-session - test/session.test.js * Copyright(c) 2013 * MIT Licensed * * Authors: * dead_horse <[email protected]> (http://deadhorse.me) */ 'use strict'; /** * Module dependencies. */ var Session = require('..'); var koa = require('koa'); var app = require('./support/server'); var request = require('supertest'); var mm = require('mm'); var should = require('should'); var EventEmitter = require('events').EventEmitter; describe('test/koa-session.test.js', function () { describe('init', function () { afterEach(mm.restore); beforeEach(function (done) { request(app) .get('/session/remive') .expect(200, done); }); it('should warn when in production', function (done) { mm(process.env, 'NODE_ENV', 'production'); mm(console, 'warn', function (message) { message.should.equal('Warning: koa-generic-session\'s MemoryStore is not\n' + 'designed for a production environment, as it will leak\n' + 'memory, and will not scale past a single process.'); done(); }); Session({secret: 'secret'}); }); it('should listen disconnect and connect', function () { var store = new EventEmitter(); Session({ secret: 'secret', store: store }); store._events.disconnect.should.be.Function; store._events.connect.should.be.Function; }); }); describe('use', function () { var cookie; var mockCookie = 'koa.sid=s:dsfdss.PjOnUyhFG5bkeHsZ1UbEY7bDerxBINnZsD5MUguEph8; path=/; httponly'; it('should GET /session/get ok', function (done) { request(app) .get('/session/get') .expect(/1/) .end(function (err, res) { cookie = res.headers['set-cookie'].join(';'); done(); }); }); it('should GET /session/get second ok', function (done) { request(app) .get('/session/get') .set('cookie', cookie) .expect(/2/, done); }); it('should GET /session/httponly ok', function (done) { request(app) .get('/session/httponly') .set('cookie', cookie) .expect(/httpOnly: false/, function (err, res) { should.not.exist(err); cookie = res.headers['set-cookie'].join(';'); cookie.indexOf('httponly').should.equal(-1); cookie.indexOf('expires=').should.above(0); request(app) .get('/session/get') .set('cookie', cookie) .expect(/3/, done); }); }); it('should GET /session/httponly twice ok', function (done) { request(app) .get('/session/httponly') .set('cookie', cookie) .expect(/httpOnly: true/, function (err, res) { should.not.exist(err); cookie = res.headers['set-cookie'].join(';'); cookie.indexOf('httponly').should.above(0); cookie.indexOf('expires=').should.above(0); done(); }); }); it('should another user GET /session/get ok', function (done) { request(app) .get('/session/get') .expect(/1/, done); }); it('should GET /session/nothing ok', function (done) { request(app) .get('/session/nothing') .set('cookie', cookie) .expect(/3/, done); }); it('should wrong cookie GET /session/get ok', function (done) { request(app) .get('/session/get') .set('cookie', mockCookie) .expect(/1/, done); }); it('should wrong cookie GET /session/get twice ok', function (done) { request(app) .get('/session/get') .set('cookie', mockCookie) .expect(/1/, done); }); it('should GET /wrongpath response no session', function (done) { request(app) .get('/wrongpath') .set('cookie', cookie) .expect(/no session/, done); }); it('should GET /session/remove ok', function (done) { request(app) .get('/session/remove') .set('cookie', cookie) .expect(/0/, function () { request(app) .get('/session/get') .set('cookie', cookie) .expect(/1/, done); }); }); it('should GET / error by session ok', function (done) { request(app) .get('/') .expect(/no session/, done); }); it('should GET /session ok', function (done) { request(app) .get('/session') .expect(/has session/, done); }); it('should rewrite session before get ok', function (done) { request(app) .get('/session/rewrite') .expect({foo: 'bar', path: '/session/rewrite'}, done); }); it('should regenerate a new session when session invalid', function (done) { request(app) .get('/session/get') .expect('1', function (err) { should.not.exist(err); request(app) .get('/session/nothing?valid=false') .expect('', function (err) { should.not.exist(err); request(app) .get('/session/get') .expect('1', done); }); }); }); it('should GET /session ok', function (done) { request(app) .get('/session/id?test_sid_append=test') .expect(/test$/, done); }); it('should force a session id ok', function (done) { request(app) .get('/session/get') .expect(/.*/, function(err, res) { should.not.exist(err); cookie = res.headers['set-cookie'][0].split(';'); var val = cookie[0].split('=').pop(); request(app) .get('/session/id?force_session_id=' + val) .expect(new RegExp(val), done); }); }); it('should regenerate existing sessions', function (done) { var agent = request.agent(app) agent .get('/session/get') .expect(/.+/, function(err, res) { var firstId = res.body; agent .get('/session/regenerate') .expect(/.+/, function(err, res) { var secondId = res.body; secondId.should.not.equal(firstId); done(); }); }); }); it('should regenerate a new session', function (done) { request(app) .get('/session/regenerateWithData') .expect({ /* foo: undefined, */ hasSession: true }, done); }); }); });
+(function (factory) { if (typeof exports === 'undefined') { factory(webduino || {}); } else { module.exports = factory; } }(function (scope) { 'use strict'; // source: // https://raw.githubusercontent.com/twistdigital/es6-promisify/release/2.0.0/lib/promisify.js // Promise Context object constructor. function Context(resolve, reject, custom) { this.resolve = resolve; this.reject = reject; this.custom = custom; } // Default callback function - rejects on truthy error, otherwise resolves function callback(ctx, err, result) { if (typeof ctx.custom === 'function') { var cust = function () { // Bind the callback to itself, so the resolve and reject // properties that we bound are available to the callback. // Then we push it onto the end of the arguments array. return ctx.custom.apply(cust, arguments); }; cust.resolve = ctx.resolve; cust.reject = ctx.reject; cust.call(null, err, result); } else { if (err) { return ctx.reject(err); } ctx.resolve(result); } } function promisify(original, custom) { return function () { // Store original context var that = this, args = Array.prototype.slice.call(arguments); // Return the promisified function return new Promise(function (resolve, reject) { // Create a Context object var ctx = new Context(resolve, reject, custom); // Append the callback bound to the context args.push(callback.bind(null, ctx)); // Call the function original.apply(that, args); }); }; } scope.util.promisify = promisify; }));
import ContactList from './ContactList' export default ContactList
/*global module:false*/ module.exports = function(grunt) { // Load all tasks require('load-grunt-tasks')(grunt); // Project configuration. grunt.initConfig({ pkg: grunt.file.readJSON('package.json'), meta: { banner: '/*! <%= pkg.title || pkg.name %> - v<%= pkg.version %> - ' + '<%= pkg.homepage ? "* " + pkg.homepage : "" %>' + '* Copyright (c) <%= grunt.template.today("yyyy") %> <%= pkg.author.name %>;' + ' Licensed <%= pkg.licenses.map(function(license) { return license.type; }).join(", ") %> */' }, concat: { dist: { src: ['src/<%= pkg.name %>.js'], dest: 'dist/<%= pkg.name %>.js' } }, qunit: { files: ['test/**/*.html'] }, watch: { files: '<%= jshint.all %>', tasks: [ 'jshint', 'qunit', 'concat', 'uglify' ] }, jshint: { options: { jshintrc: '.jshintrc' }, all: ['src/**/*.js', 'test/**/*.js'] }, uglify: { options: { banner: '<%= meta.banner %>' }, dist: { src: ['<%= concat.dist.dest %>'], dest: 'dist/<%= pkg.name %>.min.js' } } }); // Register tasks grunt.registerTask('default', [ 'build' ]); grunt.registerTask('dev', [ 'build', 'watch' ]); grunt.registerTask('build', [ 'jshint', 'qunit', 'concat', 'uglify' ]); grunt.registerTask('test', [ 'jshint', 'qunit' ]); };
import { applyMiddleware, compose } from 'redux'; import history from './history'; import { routerMiddleware } from 'react-router-redux'; import thunk from 'redux-thunk'; export default compose( applyMiddleware(thunk, routerMiddleware(history)) );
import DateTimeCore from './DateTimeCore'; let DateTime = { mixins : [DateTimeCore], data : function () { return {}; }, methods : { _dtParseRelativeDatetimeToObj : function (val) { return this._dtcoreParseRelativeToObj('datetime', val); }, _dtIsRelativeDatetime : function (val) { return this._dtcoreIsRelative('datetime', val); }, _dtGetRelativeDatetime : function (relativeDate) { return this._dtcoreGetRelativeObj('datetime', relativeDate); } } }; export default DateTime;
$(document).on("ready" ,function(){ listaBrecha();// LLamar al metodo para listar las brechas //Inicio cargar combo servicio public $("#btn-NuevaBrecha").click(function()//para que cargue el como una vez echo click sino repetira datos { //alert('hola'); listaSerPubAsocCombo();//para llenar el combo de servicio publico asociado }); //fin cargar combo servicio public //AGREGAR UNA NUEVA BRECHA $("#form-addBrecha").submit(function(event) { event.preventDefault(); $.ajax({ url:base_url+"index.php/MantenimientoBrecha/AddBrecha", type:$(this).attr('method'), data:$(this).serialize(), success:function(resp){ var registros = eval(resp); for (var i = 0; i < registros.length; i++) { if(registros[i]["VALOR"]==1){ swal("",registros[i]["MENSAJE"], "success"); $('#form-addBrecha')[0].reset(); $("#VentanaRegistraBrecha").modal("hide"); }else{ swal('',registros[i]["MENSAJE"],'error' ) } /*swal("", registros[i]["MENSAJE"], "success");*/ }; $('#table-brecha').dataTable()._fnAjaxUpdate(); //SIRVE PARA REFRESCAR LA TABLA } }); }); //FIN AGREGAR UNA NUEVA BRECHA }); //-------------------------MANTENIMIENTO DE BRECHAS ---------------------------- //TRAER DATOS EN UN COMBO DE SERVICIOS PUBLICO ASOCIADO var listaSerPubAsocCombo=function(id_serv_pub_asoc) //PARA RECIR PARAMETRO PARA MANTENER VALOR DEL CAMBO { html=""; $("#cbxServPubAsoc").html(html); //nombre del selectpicker RUBRO DE EJECUCION $("#cbxSerPubAsocModificar").html(html); event.preventDefault(); $.ajax({ "url":base_url +"index.php/ServicioPublico/GetServicioAsociado", type:"POST", success:function(respuesta){ // alert(respuesta); var registros = eval(respuesta); for (var i = 0; i <registros.length;i++) { html +="<option value="+registros[i]["id_serv_pub_asoc"]+"> "+ registros[i]["nombre_serv_pub_asoc"]+" </option>"; }; $("#cbxServPubAsoc").html(html);// //MODIFICAR $("#cbxSerPubAsocModificar").html(html); $('select[name=cbxSerPubAsocModificar]').val(id_serv_pub_asoc) // VALOR DEL COMBO SELECCIONADO $('select[name=cbxSerPubAsocModificar]').change(); //FIN MODIFICAR $('.selectpicker').selectpicker('refresh'); } }); } //FIN TRAER DATOS EN UN COMBO DE RUBRO EJECUCION /*listar las brechas en el datatable*/ var listaBrecha=function() { var table=$("#table-brecha").DataTable({ "processing":true, "serverSide":false, destroy:true, "ajax":{ "url":base_url +"index.php/MantenimientoBrecha/GetBrecha", "method":"POST", "dataSrc":"" }, "columns":[ {"data":"id_brecha"}, {"data":"id_serv_pub_asoc"}, {"data":"nombre_serv_pub_asoc"}, //DATO DEL SERVICIO PUB ASOCIADO PARA ENVIAR DATO AL COMBO ACTUALIZAR Y SE MANTENGA EL VALOR {"data":"nombre_brecha"}, {"data":"descripcion_brecha"}, {"defaultContent":"<button type='button' class='editar btn btn-primary btn-xs' data-toggle='modal' data-target='#VentanaModificarBrecha'><i class='ace-icon fa fa-pencil bigger-120'></i></button><button type='button' class='eliminar btn btn-danger btn-xs' data-toggle='modal' data-target='#'><i class='fa fa-trash-o'></i></button>"} ], "language":idioma_espanol }); BrechaData("#table-brecha",table); //TRAER LA DATA DE LAS BRECHAS PARA ACTUALIZAR EliminarBrechaLista("#table-brecha",table);//TRAER LA DATA DE LAS BRECHAS PARA ELIMINAR } /*fin de listar las brechas en el datatable*/ //ACTUALIZAR UNA BRECHA $("#form-ActualizarBrecha").submit(function(event) { event.preventDefault(); $.ajax({ url:base_url+"index.php/MantenimientoBrecha/UpdateBrecha", type:$(this).attr('method'), data:$(this).serialize(), success:function(resp){ swal("ACTUALIZADO!", resp, "success"); $('#table-brecha').dataTable()._fnAjaxUpdate(); } }); }); //FIN ACTUALIZAR UNA BRECHA // CAMPOS QUE SE ACTUALIZARAN DE LAS BRECHAS var BrechaData=function(tbody,table){ $(tbody).on("click","button.editar",function(){ var data=table.row( $(this).parents("tr")).data(); var id_brecha=$('#txt_IdBrechaModif').val(data.id_brecha); var id_serv_pub_asoc=data.id_serv_pub_asoc; var nombre_brecha=$('#txt_NombreBrechaU').val(data.nombre_brecha); var descripcion_brecha=$('#txtArea_DescBrechaU').val(data.descripcion_brecha); listaSerPubAsocCombo(id_serv_pub_asoc);//llamar al evento de combo box para actualizar }); } // FIN DE CAMPOS QUE SE ACTUALIZARAN DE LAS BRECHAS //ELIMINAR UNA BRECHA var EliminarBrechaLista=function(tbody,table){ $(tbody).on("click","button.eliminar",function(){ var data=table.row( $(this).parents("tr")).data(); var id_brecha=data.id_brecha; swal({ title: "Esta seguro que desea eliminar la brecha?", text: "", type: "warning", showCancelButton: true, confirmButtonColor: "#DD6B55", confirmButtonText: "SI,ELIMINAR", closeOnConfirm: false }, function(){ $.ajax({ url:base_url+"index.php/MantenimientoBrecha/DeleteBrecha", type:"POST", data:{id_brecha:id_brecha}, success:function(respuesta) { swal("ELIMINADO!", "Se elimino correctamente la brecha.", "success"); $('#table-brecha').dataTable()._fnAjaxUpdate(); }//para actualizar mi datatablet datatablet }); }); }); } //FIN ELIMINAR UNA BRECHA /* //Manda datos en consola de la tabla brecha function lista() { event.preventDefault(); $.ajax({ "url":base_url +"index.php/MantenimientoBrecha/GetBrecha", type:"POST", success:function(respuesta) { console.log(respuesta); } }); } *///fin datos en consola de la tabla brecha //-------------------------FIN MANTENIMIENTO DE BRECHAS ----------------------------
if (!com) var com = {} if (!com.corejsf) { com.corejsf = { showProgress: function(data) { var inputId = data.source.id var progressbarId = inputId.substring(0, inputId.length - "name".length) + "pole"; if (data.status == "begin") Element.show(progressbarId); else if (data.status == "success") Element.hide(progressbarId); } } }
(function () { 'use strict'; angular.module('UserSearch') .controller('UserSearchController', ['searchService', UserSearchController]); function UserSearchController(searchService) { var self = this; self.user = {}; self.searchFilter = ''; self.showSpinner = true; init(); function init() { return searchService.getAllUserData().then(function (response) { if (response.data !== null) { self.userData = response; self.getUserDetails(0); self.showSpinner = false; } else { self.error = "Oops. Looks like we hit a snag, try reloading."; self.showSpinner = false; } }); } self.getUserDetails = function (index) { if (self.userData[index]) { self.user = self.userData[index]; } }; } })();
/** * Compiler configuration for outputting the comonent. */ /* eslint-disable */ var path = require('path') var webpack = require('webpack') module.exports = { devtool: 'eval', entry: [ 'webpack-dev-server/client?http://localhost:3000', path.join(__dirname, '../src/index.jsx'), ], output: { path: path.join(__dirname, 'dist'), filename: 'bundle.js', publicPath: '/' }, module: { loaders: [ { test: /\.jsx?$/, loaders: ['babel-loader'], include: path.join(__dirname, '../src') }, { test: /\.scss$/, loaders: ['style-loader', 'css-loader', 'sass-loader'] } ] } }
/** * Blueprint API Configuration * (sails.config.blueprints) * * These settings are for the global configuration of blueprint routes and * request options (which impact the behavior of blueprint actions). * * You may also override any of these settings on a per-controller basis * by defining a '_config' key in your controller defintion, and assigning it * a configuration object with overrides for the settings in this file. * A lot of the configuration options below affect so-called "CRUD methods", * or your controllers' `find`, `create`, `update`, and `destroy` actions. * * It's important to realize that, even if you haven't defined these yourself, as long as * a model exists with the same name as the controller, Sails will respond with built-in CRUD * logic in the form of a JSON API, including support for sort, pagination, and filtering. * * For more information on the blueprint API, check out: * http://sailsjs.org/#/documentation/reference/blueprint-api * * For more information on the settings in this file, see: * http://sailsjs.org/#/documentation/reference/sails.config/sails.config.blueprints.html * */ module.exports.blueprints = { /*************************************************************************** * * * Action routes speed up the backend development workflow by * * eliminating the need to manually bind routes. When enabled, GET, POST, * * PUT, and DELETE routes will be generated for every one of a controller's * * actions. * * * * If an `index` action exists, additional naked routes will be created for * * it. Finally, all `actions` blueprints support an optional path * * parameter, `id`, for convenience. * * * * `actions` are enabled by default, and can be OK for production-- * * however, if you'd like to continue to use controller/action autorouting * * in a production deployment, you must take great care not to * * inadvertently expose unsafe/unintentional controller logic to GET * * requests. * * * ***************************************************************************/ // actions: true, /*************************************************************************** * * * RESTful routes (`sails.config.blueprints.rest`) * * * * REST blueprints are the automatically generated routes Sails uses to * * expose a conventional REST API on top of a controller's `find`, * * `create`, `update`, and `destroy` actions. * * * * For example, a BoatController with `rest` enabled generates the * * following routes: * * ::::::::::::::::::::::::::::::::::::::::::::::::::::::: * * GET /boat -> BoatController.find * * GET /boat/:id -> BoatController.findOne * * POST /boat -> BoatController.create * * PUT /boat/:id -> BoatController.update * * DELETE /boat/:id -> BoatController.destroy * * * * `rest` blueprint routes are enabled by default, and are suitable for use * * in a production scenario, as long you take standard security precautions * * (combine w/ policies, etc.) * * * ***************************************************************************/ // rest: true, /*************************************************************************** * * * Shortcut routes are simple helpers to provide access to a * * controller's CRUD methods from your browser's URL bar. When enabled, * * GET, POST, PUT, and DELETE routes will be generated for the * * controller's`find`, `create`, `update`, and `destroy` actions. * * * * `shortcuts` are enabled by default, but should be disabled in * * production. * * * ***************************************************************************/ // shortcuts: true, /*************************************************************************** * * * An optional mount path for all blueprint routes on a controller, * * including `rest`, `actions`, and `shortcuts`. This allows you to take * * advantage of blueprint routing, even if you need to namespace your API * * methods. * * * * (NOTE: This only applies to blueprint autoroutes, not manual routes from * * `sails.config.routes`) * * * ***************************************************************************/ // prefix: '', /*************************************************************************** * * * Whether to pluralize controller names in blueprint routes. * * * * (NOTE: This only applies to blueprint autoroutes, not manual routes from * * `sails.config.routes`) * * * * For example, REST blueprints for `FooController` with `pluralize` * * enabled: * * GET /foos/:id? * * POST /foos * * PUT /foos/:id? * * DELETE /foos/:id? * * * ***************************************************************************/ pluralize: true, /*************************************************************************** * * * Whether the blueprint controllers should populate model fetches with * * data from other models which are linked by associations * * * * If you have a lot of data in one-to-many associations, leaving this on * * may result in very heavy api calls * * * ***************************************************************************/ // populate: true, /**************************************************************************** * * * Whether to run Model.watch() in the find and findOne blueprint actions. * * Can be overridden on a per-model basis. * * * ****************************************************************************/ // autoWatch: true, /**************************************************************************** * * * The default number of records to show in the response from a "find" * * action. Doubles as the default size of populated arrays if populate is * * true. * * * ****************************************************************************/ // defaultLimit: 30 };
var mongoose = require('mongoose') , Schema = mongoose.Schema , ObjectId = Schema.ObjectId , relationships = require('../../index'); // require('mongoose-relationships'); /** * Blog Post Schema * "belongs to one author" */ var PostSchema = new Schema({ title : String , body : String , author : {type: ObjectId, ref: 'User'} }); /** * User Schema * "has many posts" */ var UserSchema = new Schema({ name : String , posts : [{type: ObjectId, ref: 'Post'}] }); /** * Attach the plugin to the schemas */ PostSchema.plugin(relationships, { belongsTo : "User" , through : "author" }); UserSchema.plugin(relationships, { hasMany : "Post" , through : "posts" }); /** * Register the models with Mongoose */ var Post = mongoose.model('Post', PostSchema) , User = mongoose.model('User', UserSchema); // Have fun here: var user = new User(); user.posts.create({ title: "Mongoose, now with added love through relationships!" }, function(err, user, post){ // user.posts.length === 1 // post.title === "Mongoose, now with added love through relationships!" }); // Using an `Array` user.posts.create([ { title: "Not too imaginative post title" } , { title: "... a tad more imaginative post title" } ], function(err, user, posts){ // user.posts.length === 3 // posts.length == 2 // posts[0] instanceof Post });
import {createSelector} from 'reselect' import usersSelector from 'usersSelector' const selectedUserIdSelector = (state) => state.selectedUserId export default createSelector( [usersSelector, selectedUserIdSelector], (users, selectedUserId) => users.get(selectedUserId) )
// (c) ammap.com | SVG (in JSON format) map of Libya - Low // areas: {id:"LY-WD"},{id:"LY-BU"},{id:"LY-DR"},{id:"LY-SR"},{id:"LY-BA"},{id:"LY-WA"},{id:"LY-JA"},{id:"LY-HZ"},{id:"LY-TB"},{id:"LY-MZ"},{id:"LY-ZA"},{id:"LY-NQ"},{id:"LY-JI"},{id:"LY-SB"},{id:"LY-MI"},{id:"LY-MQ"},{id:"LY-GT"},{id:"LY-WS"},{id:"LY-MB"},{id:"LY-KF"},{id:"LY-JU"},{id:"LY-NL"} AmCharts.maps.libyaLow={ "svg": { "defs": { "amcharts:ammap": { "projection":"mercator", "leftLongitude":"9.391466", "topLatitude":"33.1679793", "rightLongitude":"25.146954", "bottomLatitude":"19.5008125" } }, "g":{ "path":[ { "id":"LY-WD", "title":"Wadi al Hayaa", "d":"M236.97,352.67L188.1,345.8L105.65,404.02L106.9,441.29L145.18,439.93L234.51,402.37L245.18,378.51L236.97,352.67z" }, { "id":"LY-BU", "title":"Al Butnan", "d":"M790.67,297.68L790.32,232.14L775.94,177.43L791.36,142.24L784.01,109.12L799.48,90.55L790.69,72.49L703.58,57.71L689.36,141.4L694.05,295.25L790.67,297.68z" }, { "id":"LY-DR", "title":"Darnah", "d":"M703.58,57.71L696.27,32.47L639.88,16.11L636.44,113.04L646.24,122.59L689.36,141.4L703.58,57.71z" }, { "id":"LY-SR", "title":"Surt", "d":"M478.97,166.48L407.27,124.54L345.42,114.27L365.25,209.36L359.58,222.33L405.66,229.62L418.06,223.15L438.3,261.26L464.33,274.5L478.97,166.48z" }, { "id":"LY-BA", "title":"Benghazi", "d":"M606.3,127.57L601.08,97.76L567.51,95.48L557.53,74.82L568.89,37.08L536.87,73.09L547.02,116.47L569.78,129.22L606.3,127.57z" }, { "id":"LY-WA", "title":"Al Wahat", "d":"M606.3,127.57L569.78,129.22L547.02,116.47L541.73,140.25L520.58,163.52L496.89,172.65L478.97,166.48L464.33,274.5L498.21,283.36L498.09,359.23L790.67,357.18L790.67,297.68L694.05,295.25L689.36,141.4L646.24,122.59L626.34,125.78L606.3,127.57z" }, { "id":"LY-JA", "title":"Al Jabal al Akhdar", "d":"M639.88,16.11L608.21,24.06L626.34,125.78L646.24,122.59L636.44,113.04L639.88,16.11z" }, { "id":"LY-MJ", "title":"Al Marj", "d":"M608.21,24.06L568.89,37.08L557.53,74.82L567.51,95.48L601.08,97.76L606.3,127.57L626.34,125.78L608.21,24.06z" }, { "id":"LY-TB", "title":"Tripoli", "d":"M235.52,25.39L192.67,18.24L191.32,27.6L199.38,50.74L235.52,25.39z" }, { "id":"LY-JG", "title":"Al Jabal al Gharbi", "d":"M207.49,67.57L200.1,51.71L178.39,55.12L130.21,52.3L135.27,124.88L116.48,156.44L123.5,240.9L134.7,269.17L171.79,278.61L233.31,213.15L258.95,233.86L275.7,222.53L280.82,196.08L285.65,164.23L248.47,145.99L207.49,67.57z" }, { "id":"LY-ZA", "title":"Az Zawiyah", "d":"M191.32,27.6L192.67,18.24L165.98,22.13L130.21,52.3L178.39,55.12L191.32,27.6z" }, { "id":"LY-NQ", "title":"An Nuqat al Khams", "d":"M112.21,0L113.27,45.72L130.21,52.3L165.98,22.13L112.21,0z" }, { "id":"LY-JI", "title":"Al Jifarah", "d":"M199.38,50.74L191.32,27.6L178.39,55.12L200.1,51.71L199.38,50.74z" }, { "id":"LY-SB", "title":"Sabha", "d":"M328.23,319.08L291.61,324.15L259.02,350.19L236.97,352.67L245.18,378.51L234.51,402.37L259.18,395.1L279.48,373.62L352.59,355.71L328.23,319.08z" }, { "id":"LY-MI", "title":"Misratah", "d":"M345.42,114.27L314.06,92.6L301.74,51.03L275.87,43.83L271.38,72.5L243.96,62.12L207.49,67.57L248.47,145.99L285.65,164.23L280.82,196.08L325.45,223.19L359.58,222.33L365.25,209.36L345.42,114.27z" }, { "id":"LY-MQ", "title":"Murzuq", "d":"M498,416L449.47,395.09L409.49,413.29L385.86,407.05L352.53,368.64L352.59,355.71L279.48,373.62L259.18,395.1L234.51,402.37L145.18,439.93L106.9,441.29L110.31,509.32L135.56,553.87L211.75,572.39L248.7,603.18L337.76,557.86L498.9,644.09L498,416z" }, { "id":"LY-GT", "title":"Ghat", "d":"M105.65,404.02L92.16,335.26L32.98,313.53L22.41,343.44L31.22,379.55L6.29,409.86L36.84,453.56L38.05,479.97L49.54,495.47L110.31,509.32L106.9,441.29L105.65,404.02z" }, { "id":"LY-WS", "title":"Wadi ash Shati'", "d":"M258.95,233.86L233.31,213.15L171.79,278.61L134.7,269.17L103.09,272.05L82.24,254.85L58.63,267.48L27.74,267.82L32.98,313.53L92.16,335.26L105.65,404.02L188.1,345.8L236.97,352.67L259.02,350.19L291.61,324.15L328.23,319.08L332.41,298.68L317.85,290.94L289.05,294.93L286.08,279.91L259.09,252.9L258.95,233.86z" }, { "id":"LY-MB", "title":"Al Marqab", "d":"M275.87,43.83L235.52,25.39L199.38,50.74L200.1,51.71L207.49,67.57L243.96,62.12L271.38,72.5L275.87,43.83z" }, { "id":"LY-KF", "title":"Al Kufrah", "d":"M740.33,771.53L740.33,744.82L790.45,744.79L790.67,357.18L498.09,359.23L498,416L498.9,644.09L740.33,771.53z" }, { "id":"LY-JU", "title":"Al Jufrah", "d":"M359.58,222.33L325.45,223.19L280.82,196.08L275.7,222.53L258.95,233.86L259.09,252.9L286.08,279.91L289.05,294.93L317.85,290.94L332.41,298.68L328.23,319.08L352.59,355.71L352.53,368.64L385.86,407.05L409.49,413.29L449.47,395.09L498,416L498.09,359.23L498.21,283.36L464.33,274.5L438.3,261.26L418.06,223.15L405.66,229.62L359.58,222.33z" }, { "id":"LY-NL", "title":"Nalut", "d":"M130.21,52.3L113.27,45.72L49.73,89.52L41.79,104.37L46.11,145.4L29.96,167.38L0.52,181.25L19.71,210.79L27.74,267.82L58.63,267.48L82.24,254.85L103.09,272.05L134.7,269.17L123.5,240.9L116.48,156.44L135.27,124.88L130.21,52.3z" } ] } } };
/** * @license Highcharts JS v9.1.0 (2021-05-04) * @module highcharts/themes/high-contrast-light * @requires highcharts * * (c) 2009-2021 Highsoft AS * * License: www.highcharts.com/license */ 'use strict'; import '../../Extensions/Themes/HighContrastLight.js';
'use strict'; var yeoman = require('yeoman-generator'); var chalk = require('chalk'); var yosay = require('yosay'); module.exports = yeoman.Base.extend({ prompting: function () { // Have Yeoman greet the user. this.log(yosay( 'Welcome to the stylish ' + chalk.red('generator-dev-cli') + ' generator!' )); var prompts = [{ type: 'list', name: 'environment', message: 'Please choose dev environment(jsPlugin):', choices: ['jsPlugin', 'react'], default: 'jsPlugin' }, { type: 'input', name: 'name', message: 'Your project name', default: this.appname // Default to current folder name }, { type: 'confirm', name: 'besure', message: 'Would you like to enable this option?', default: true }]; return this.prompt(prompts).then(function (props) { // To access props later use this.props.someAnswer; this.props = props; }.bind(this)); }, writing: function () { this.fs.copy( this.templatePath(this.props.environment), this.destinationPath(this.props.name), true ); this.fs.copy( this.templatePath(this.props.environment + '/.*'), this.destinationPath(this.props.name + '/'), true ); }, install: function () { } });
const { stripIndent } = require('common-tags') module.exports = function (widgetName) { return stripIndent` import { ${widgetName} } from 'react-widgets'; let people = listOfPeople(); <> <${widgetName} data={people} textField='fullName' groupBy='lastName' /> <${widgetName} data={people} textField='fullName' groupBy={person => person.fullName.length} /> </> ` }
module.exports = function(grunt) { grunt.initConfig({ sass: { // Task dist: { // Target files: { // Dictionary of files 'assets/stylesheets/styles.css': 'assets/stylesheets/src/styles.scss' , 'assets/stylesheets/smartphone.css': 'assets/stylesheets/src/smartphone.scss' } } }, watch: { css: { files: ['assets/stylesheets/src/*.scss'], tasks: ['sass', 'cssmin'] } }, cssmin: { target: { files: { 'assets/stylesheets/app.min.css': ['assets/stylesheets/styles.css', 'assets/stylesheets/smartphone.css'] } } } }); grunt.loadNpmTasks('grunt-contrib-sass'); grunt.loadNpmTasks('grunt-contrib-watch'); grunt.loadNpmTasks('grunt-contrib-cssmin'); grunt.registerTask('default', ['sass', 'cssmin', 'watch']); };
const test = require('tape'); const Mark = require('./../mark.js'); function stringArrayBuffer(str) { var buffer = new ArrayBuffer(str.length); var bytes = new Uint8Array(buffer); str.split('').forEach(function(str, i) { bytes[i] = str.charCodeAt(0); }); return buffer; } test('Stringify JSON object', function(assert) { assert.equal(Mark.stringify(Mark.parse(`{a:12.4, b:true, c:false, d:'str', e:null, g:1, h:[1,2,3], i:-12, j:[], k:{}, l:'', m:"", n:0, p:1e-2}`)), `{a:12.4 b:true c:false d:"str" e:null g:1 h:[1 2 3] i:-12 j:[] k:{} l:"" m:"" n:0 p:0.01}`, "Stringify JSON object"); assert.end() ; }); test('Stringify Mark object', function(assert) { assert.equal(Mark.stringify(Mark.parse('{obj}')), '{obj}', "Stringify {obj}"); assert.equal(Mark.stringify(Mark.parse('{div width:10}')), '{div width:10}', "Stringify {div width:10}"); assert.equal(Mark.stringify(Mark.parse('{div "text"}')), '{div "text"}', 'Stringify {div "text"}'); assert.equal(Mark.stringify(Mark.parse("{div 'text'}")), '{div "text"}', "Stringify {div 'text'}"); assert.equal(Mark.stringify(Mark.parse('{div {br}}')), '{div {br}}', "Stringify {div {br}}"); assert.equal(Mark.stringify(Mark.parse('{div width:null}')), '{div width:null}', "Stringify property with null value}"); // undefined value handling var t = {obj:undefined}; assert.equal(Mark.stringify(t), '{}', "Stringify undefined property"); assert.equal(Mark.stringify([1, null, undefined]), '[1 null null]', "Stringify undefined value in array"); // JSON inside Mark assert.equal(Mark.stringify(Mark.parse('{div {width:10}}')), '{div {width:10}}', "Stringify {div {width:10}}"); // stringify with identation assert.equal(Mark.stringify(Mark.parse('{div width:10 (!--comment--) "test" {br}}'), {space:' '}), '{div width:10 \n (!--comment--) \n "test" \n {br}\n}', "Stringify with identation"); // stringify omitting comma assert.equal(Mark.stringify(Mark.parse('{div width:10, height:"15px", margin:[5 10 10 5]}')), '{div width:10 height:"15px" margin:[5 10 10 5]}', "Stringify without comma"); // stringify base64 data assert.equal(Mark.stringify(stringArrayBuffer('Hello')), '[#SGVsbG8=]', "Stringify binary data 'hello'"); assert.equal(Mark.stringify(stringArrayBuffer('Hello worlds!')), '[#SGVsbG8gd29ybGRzIQ==]', "Stringify binary data 'Hello worlds!'"); var doc = Mark('doc', {mime:'text/html', data:stringArrayBuffer("<h1>Mark binary!</h1>")}); assert.equal(Mark.stringify(doc), '{doc mime:"text/html" data:[#PGgxPk1hcmsgYmluYXJ5ITwvaDE+]}', "Stringify nested binary data"); // stringify base85 data var bin = stringArrayBuffer('hello'); bin.encoding = 'a85'; assert.equal(Mark.stringify(bin), "[#~BOu!rDZ~]", "Stringify base85"); assert.equal(Mark.stringify(Mark("[#~\n@p\ns7\ntD.3~]")), "[#[email protected]~]", "Stringify base85"); assert.equal(Mark.stringify(Mark("[#~ @<5pm \rBfIs ~]")), "[#~@<5pmBfIs~]", "Parse base85 of 'ascii85'"); assert.end(); });
const path = require(`path`) const chunk = require(`lodash/chunk`) // This is a simple debugging tool // dd() will prettily dump to the terminal and kill the process // const { dd } = require(`dumper.js`) /** * exports.createPages is a built-in Gatsby Node API. * It's purpose is to allow you to create pages for your site! 💡 * * See https://www.gatsbyjs.com/docs/node-apis/#createPages for more info. */ exports.createPages = async gatsbyUtilities => { // Query our posts from the GraphQL server const posts = await getNodes(gatsbyUtilities) // If there are no posts in WordPress, don't do anything if (!posts.length) { return } // If there are posts and pages, create Gatsby pages for them await createSinglePages({ posts, gatsbyUtilities }) // And a paginated archive await createBlogPostArchive({ posts, gatsbyUtilities }) } /** * This function creates all the individual blog pages in this site */ const createSinglePages = async ({ posts, gatsbyUtilities }) => Promise.all( posts.map(({ previous, post, next }) => // createPage is an action passed to createPages // See https://www.gatsbyjs.com/docs/actions#createPage for more info gatsbyUtilities.actions.createPage({ // Use the WordPress uri as the Gatsby page path // This is a good idea so that internal links and menus work 👍 path: post.uri, // use the blog post template as the page component component: path.resolve( `./src/templates/${post.__typename.replace(`Wp`, ``)}.js` ), // `context` is available in the template as a prop and // as a variable in GraphQL. context: { // we need to add the post id here // so our blog post template knows which blog post // the current page is (when you open it in a browser) id: post.id, // We also use the next and previous id's to query them and add links! previousPostId: previous ? previous.id : null, nextPostId: next ? next.id : null, }, }) ) ) /** * This function creates all the individual blog pages in this site */ async function createBlogPostArchive({ posts, gatsbyUtilities }) { const graphqlResult = await gatsbyUtilities.graphql(/* GraphQL */ ` { wp { readingSettings { postsPerPage } } } `) const { postsPerPage } = graphqlResult.data.wp.readingSettings const postsChunkedIntoArchivePages = chunk(posts, postsPerPage) const totalPages = postsChunkedIntoArchivePages.length return Promise.all( postsChunkedIntoArchivePages.map(async (_posts, index) => { const pageNumber = index + 1 const getPagePath = page => { if (page > 0 && page <= totalPages) { // Since our homepage is our blog page // we want the first page to be "/" and any additional pages // to be numbered. // "/blog/2" for example return page === 1 ? `/` : `/blog/${page}` } return null } // createPage is an action passed to createPages // See https://www.gatsbyjs.com/docs/actions#createPage for more info await gatsbyUtilities.actions.createPage({ path: getPagePath(pageNumber), // use the blog post archive template as the page component component: path.resolve(`./src/templates/blog-post-archive.js`), // `context` is available in the template as a prop and // as a variable in GraphQL. context: { // the index of our loop is the offset of which posts we want to display // so for page 1, 0 * 10 = 0 offset, for page 2, 1 * 10 = 10 posts offset, // etc offset: index * postsPerPage, // We need to tell the template how many posts to display too postsPerPage, nextPagePath: getPagePath(pageNumber + 1), previousPagePath: getPagePath(pageNumber - 1), }, }) }) ) } /** * This function queries Gatsby's GraphQL server and asks for * All WordPress blog posts. If there are any GraphQL error it throws an error * Otherwise it will return the posts 🙌 * * We're passing in the utilities we got from createPages. * So see https://www.gatsbyjs.com/docs/node-apis/#createPages for more info! */ async function getNodes({ graphql, reporter }) { const graphqlResult = await graphql(/* GraphQL */ ` query WpPosts { # Query all WordPress blog posts sorted by date allWpPost(sort: { fields: [date], order: DESC }) { edges { previous { id } # note: this is a GraphQL alias. It renames "node" to "post" for this query # We're doing this because this "node" is a post! It makes our code more readable further down the line. post: node { __typename id uri } next { id } } } allWpPage(sort: { fields: [date], order: DESC }) { edges { previous { id } # note: this is a GraphQL alias. It renames "node" to "post" for this query # We're doing this because this "node" is a post! It makes our code more readable further down the line. post: node { __typename id uri } next { id } } } } `) if (graphqlResult.errors) { reporter.panicOnBuild( `There was an error loading your blog posts`, graphqlResult.errors ) return } return [ ...graphqlResult.data.allWpPost.edges, ...graphqlResult.data.allWpPage.edges, ] }
'use strict'; // Call this function when the page loads (the "ready" event) $(document).ready(function() { initializePage(); }) /* * Function that is called when the document is ready. */ function initializePage() { $('.project a').click(addProjectDetails); $('#colorBtn').click(randomizeColors); $('#apibutton').click(getExternalApi); } /* * Make an AJAX call to retrieve project details and add it in */ function addProjectDetails(e) { // Prevent following the link e.preventDefault(); // Get the div ID, e.g., "project3" var projectID = $(this).closest('.project').attr('id'); // get rid of 'project' from the front of the id 'project3' var idNumber = projectID.substr('project'.length); console.log("User clicked on project " + idNumber); $.get('/project/' + idNumber, addProject); console.log('/project/' + idNumber); } function addProject(result) { console.log(result); var projectHTML = '<a href="#" class="thumbnail">' + '<img src="' + result['image'] + '" class="detalsImage">' + '<p>' + result['title'] + '</p>' + '<p> <small>' + result['date'] + '</small></p>' + '<p>' + result['summary'] + '</p> </a>'; $("#project" + result['id'] + " .details").html(projectHTML);
 } /* * Make an AJAX call to retrieve a color palette for the site * and apply it */ function randomizeColors(e) { e.preventDefault(); $.get('/palette', addColor); } function addColor(result) { console.log(result); var colors = result['colors']['hex']; $('body').css('background-color', colors[0]); $('.thumbnail').css('background-color', colors[1]); $('h1, h2, h3, h4, h5, h5').css('color', colors[2]); $('p').css('color', colors[3]); $('.project img').css('opacity', .75); } function getExternalApi(e) { e.preventDefault(); $.get('https://api.spotify.com/v1/artists/4dpARuHxo51G3z768sgnrY', getAPI); } function getAPI(result) { console.log(result); var images = result['images']; console.log(images); var adeleHTML = '<h1>' + result['name'] + '</h1>' + '<p> popularity: ' + result['popularity'] + '</p>' + '<p> genre: ' + result['genres'][0] + '</p>' + '<img src="' + images[2]['url'] + '"> <br />' ; $("#output").html(adeleHTML);
 }
import"./index-ec0f574a.js";import{C as e}from"./component-cc759df5.js";export default class extends e{static get params(){return{input:!0,localized:!0,component:"datepicker",provideValue:!1,props:["value","begin","end","mode","lang","host"]}}}
'use strict'; const path = require('path'); const srcDir = path.join(__dirname, 'src/front'), distDir = path.join(__dirname, 'front/dist'); module.exports = { envFilePath: path.join(__dirname, '.env'), src: { front: { jsEntry: path.join(srcDir, 'js/index.js'), htmlEntry: path.join(srcDir, 'index.html'), stylesEntry: path.join(srcDir, 'scss/style.scss') } }, dist: { buildDir: path.join(distDir, 'build'), releaseDir: path.join(distDir, 'release') } };
import test from 'ava'; import React from 'react'; import { shallow } from 'enzyme'; import Text from '../../../src/components/form-inputs/text'; test('Text | default props', (t) => { const textWrapper = shallow(<Text />); t.deepEqual(textWrapper.props(), { type: 'text', 'data-form-id': '', className: '', id: '', placeholder: '', required: false, value: '', min: -1, max: -1, }); }); test('Text | all props filled', (t) => { const textWrapper = shallow( <Text className="test-class" data-form-id="test-form-id" id="test-id" placeholder="test-placeholder" required value="test-value" min={8} max={30} />, ); t.deepEqual(textWrapper.props(), { type: 'text', 'data-form-id': 'test-form-id', className: 'test-class', id: 'test-id', placeholder: 'test-placeholder', required: true, value: 'test-value', min: 8, max: 30, }); });
/* jquery.flipper (c) MrKMG 2012 */ (function( $ ){ var methods = { init : function( o ) { return this.each(function(){ var $this = $(this), data = $this.data('flipper'), text = $this.text(); // If the plugin hasn't been initialized yet if ( ! data ) { var options = $.extend({ type:'fall', speed:'normal', queueSuper:true },o); $this .addClass('flipper') .addClass('fl-animate') .addClass('fl-'+options.type) .addClass('fl-'+options.speed); $this.css('line-height',($this.height()+1)+'px') var new1 = $('<span class="fl-new fl-top fl-num"></span>'); var new2 = $('<span class="fl-new fl-bottom fl-num"></span>'); var cur1 = $('<span class="fl-show fl-top fl-num">'+text+'</span>'); var cur2 = $('<span class="fl-show fl-bottom fl-num">'+text+'</span>'); $this.html('').append(new1,new2,cur1,cur2); $this.data('flipper', { new1:new1, new2:new2, cur1:cur1, cur2:cur2, type:options.type, speed:options.speed, queueSuper:options.queueSuper, running:false, insuper:false, presuperspeed:null, queue:[] }); } }); }, destroy : function( ) { return this.each(function(){ var $this = $(this), data = $this.data('flipper'); data.flipper.remove(); $this.removeData('flipper'); }); }, option:function(key,val){ if(key=="speed"){ var $this = $(this), o = $this.data().flipper; var oldspeed = o.speed; o.speed = val; $this.removeClass('fl-'+oldspeed).addClass('fl-'+val); $this.data('flipper',o); return true; } else if(key=="type"){ var $this = $(this), o = $this.data().flipper; var oldtype = o.type; o.type = val; $this.removeClass('fl-'+oldtype).addClass('fl-'+val); $this.data('flipper',o); return true; } else { return false; } }, update: function( newtext, callback ) { var $this = $(this); var o = $this.data().flipper; if(o.running){ o.queue.push([newtext,callback]); $this.data('flipper',o); return; }else{ o.running = true; methods._process(this,newtext,callback); } }, _process:function(obj,newtext,callback){ var $this = $(obj); var o = $this.data().flipper; $this.data('flipper',o); console.log(o.insuper,o.queue.length); if(o.queueSuper &&!o.insuper && o.queue.length){ var oldspeed = o.speed; o.speed = 'super'; $this.removeClass('fl-'+oldspeed).addClass('fl-super'); o.oldspeed = oldspeed; o.insuper = true; $this.data('flipper',o); }else if(o.queueSuper && o.insuper && !o.queue.length){ o.speed = o.oldspeed; $this.removeClass('fl-super').addClass('fl-'+o.speed); o.insuper = false; $this.data('flipper',o); } setTimeout(function(){ animators[o.type](obj,newtext,function(){ if(o.queue.length){ var q = o.queue.shift(); setTimeout(function(){methods._process(obj,q[0],q[1]);},1); if(typeof(callback) == 'function') callback(false); }else{ if(typeof(callback) == 'function') callback(true); o.running = false; $this.data('flipper',o); } }); },1); }, clearqueue: function(){ var $this = $(this); var o = $this.data().flipper; o.queue.length = 0; $this.data('flipper',o); } }; var animators = { fall:function(obj,newtext,finished){ var $this = $(obj); var o = $this.data().flipper; $this.addClass('fl-animate'); $this.addClass('fl-go'); o.new1.text(newtext); o.new2.text(newtext); if(o.speed=='slow') var t = 2000; else if(o.speed=='normal') var t = 1000; else if(o.speed=='fast') var t = 500; else if(o.speed=='super') var t = 50; setTimeout(function(){ $this.removeClass('fl-animate'); o.cur1.text(newtext); o.cur2.text(newtext); o.new1.text(''); o.new2.text(''); $this.removeClass('fl-go'); finished(); },t); }, rise:function(obj,newtext,finished){ var $this = $(obj); var o = $this.data().flipper; $this.addClass('fl-animate'); $this.addClass('fl-go'); o.new1.text(newtext); o.new2.text(newtext); if(o.speed=='slow') var t = 2000; else if(o.speed=='normal') var t = 1000; else if(o.speed=='fast') var t = 500; else if(o.speed=='super') var t = 50; setTimeout(function(){ $this.removeClass('fl-animate'); o.cur1.text(newtext); o.cur2.text(newtext); o.new1.text(''); o.new2.text(''); $this.removeClass('fl-go'); finished(); },t); }, clap:function(obj,newtext,finished){ var $this = $(obj); var o = $this.data().flipper; $this.addClass('fl-animate'); $this.addClass('fl-go'); o.new1.text(newtext); o.new2.text(o.cur2.text()); o.cur2.text(newtext); if(o.speed=='slow') var t = 2000; else if(o.speed=='normal') var t = 1000; else if(o.speed=='fast') var t = 500; else if(o.speed=='super') var t = 50; setTimeout(function(){ $this.removeClass('fl-animate'); o.cur1.text(newtext); o.new1.text(''); o.new2.text(''); $this.removeClass('fl-go'); finished(); },t); }, slide:function(obj,newtext,finished){ var $this = $(obj); var o = $this.data().flipper; $this.addClass('fl-animate'); $this.addClass('fl-go'); o.new1.text(newtext); if(o.speed=='slow'){ var t1 = 2000; var t2 = 1000; } else if(o.speed=='normal'){ var t1 = 1000; var t2 = 500; } else if(o.speed=='fast'){ var t1 = 500; var t2 = 250; } else if(o.speed=='super'){ var t1 = 50; var t2 = 25; } setTimeout(function(){ $this.removeClass('fl-go').addClass('fl-zfix'); o.cur2.text(newtext); },t2); setTimeout(function(){ $this.removeClass('fl-animate'); o.cur1.text(newtext); o.new1.text(''); $this.removeClass('fl-zfix'); finished(); },t1); }, open:function(obj,newtext,finished){ var $this = $(obj); var o = $this.data().flipper; $this.addClass('fl-animate'); $this.addClass('fl-go'); o.new1.text(newtext); o.new2.text(newtext); if(o.speed=='slow'){ var t1 = 2000; var t2 = 1000; } else if(o.speed=='normal'){ var t1 = 1000; var t2 = 500; } else if(o.speed=='fast'){ var t1 = 500; var t2 = 250; } else if(o.speed=='super'){ var t1 = 50; var t2 = 25; } setTimeout(function(){ $this.addClass('fl-zfix'); },t2); setTimeout(function(){ $this.removeClass('fl-animate'); o.cur1.text(newtext); o.cur2.text(newtext); o.new1.text(''); o.new2.text(''); $this.removeClass('fl-go').removeClass('fl-zfix'); finished(); },t1); }, close:function(obj,newtext,finished){ var $this = $(obj); var o = $this.data().flipper; $this.addClass('fl-animate'); $this.addClass('fl-go'); o.new1.text(o.cur1.text()); o.new2.text(o.cur2.text()); o.cur1.text(newtext); o.cur2.text(newtext); if(o.speed=='slow'){ var t1 = 2000; var t2 = 1000; } else if(o.speed=='normal'){ var t1 = 1000; var t2 = 500; } else if(o.speed=='fast'){ var t1 = 500; var t2 = 250; } else if(o.speed=='super'){ var t1 = 50; var t2 = 25; } $this.addClass('fl-zfix'); setTimeout(function(){ $this.removeClass('fl-zfix'); },t2); setTimeout(function(){ $this.removeClass('fl-animate'); o.cur1.text(newtext); o.cur2.text(newtext); o.new1.text(''); o.new2.text(''); $this.removeClass('fl-go'); finished(); },t1); } }; $.fn.flipper = function( method ) { if ( methods[method] ) { return methods[method].apply( this, Array.prototype.slice.call( arguments, 1 )); } else if ( typeof method === 'object' || ! method ) { return methods.init.apply( this, arguments ); } else { $.error( 'Method ' + method + ' does not exist on jQuery.flipper' ); } }; })( jQuery );
define(['exports', 'aurelia-validation', 'aurelia-dependency-injection', './orm-metadata'], function (exports, _aureliaValidation, _aureliaDependencyInjection, _ormMetadata) { 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.Entity = undefined; var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol ? "symbol" : typeof obj; }; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var _dec, _dec2, _class; var Entity = exports.Entity = (_dec = (0, _aureliaDependencyInjection.transient)(), _dec2 = (0, _aureliaDependencyInjection.inject)(_aureliaValidation.Validation), _dec(_class = _dec2(_class = function () { function Entity(validator) { _classCallCheck(this, Entity); this.define('__meta', _ormMetadata.OrmMetadata.forTarget(this.constructor)).define('__cleanValues', {}, true); if (!this.hasValidation()) { return this; } return this.define('__validator', validator); } Entity.prototype.getTransport = function getTransport() { return this.getRepository().getTransport(); }; Entity.prototype.getRepository = function getRepository() { return this.__repository; }; Entity.prototype.setRepository = function setRepository(repository) { return this.define('__repository', repository); }; Entity.prototype.define = function define(property, value, writable) { Object.defineProperty(this, property, { value: value, writable: !!writable, enumerable: false }); return this; }; Entity.prototype.getMeta = function getMeta() { return this.__meta; }; Entity.prototype.save = function save() { var _this = this; if (!this.isNew()) { return this.update(); } var response = void 0; return this.getTransport().create(this.getResource(), this.asObject(false)).then(function (created) { _this.id = created.id; response = created; }).then(function () { return _this.saveCollections(); }).then(function () { return _this.markClean(); }).then(function () { return response; }); }; Entity.prototype.update = function update() { var _this2 = this; if (this.isNew()) { throw new Error('Required value "id" missing on entity.'); } if (this.isClean()) { return this.saveCollections().then(function () { return _this2.markClean(); }).then(function () { return null; }); } var requestBody = this.asObject(false); var response = void 0; delete requestBody.id; return this.getTransport().update(this.getResource(), this.id, requestBody).then(function (updated) { return response = updated; }).then(function () { return _this2.saveCollections(); }).then(function () { return _this2.markClean(); }).then(function () { return response; }); }; Entity.prototype.addCollectionAssociation = function addCollectionAssociation(entity, property) { var _this3 = this; property = property || getPropertyForAssociation(this, entity); var url = [this.getResource(), this.id, property]; if (this.isNew()) { throw new Error('Cannot add association to entity that does not have an id.'); } if (!(entity instanceof Entity)) { url.push(entity); return this.getTransport().create(url.join('/')); } if (entity.isNew()) { var associationProperty = getPropertyForAssociation(entity, this); var relation = entity.getMeta().fetch('association', associationProperty); if (!relation || relation.type !== 'entity') { return entity.save().then(function () { return _this3.addCollectionAssociation(entity, property); }); } entity[associationProperty] = this.id; return entity.save().then(function () { return entity; }); } url.push(entity.id); return this.getTransport().create(url.join('/')).then(function () { return entity; }); }; Entity.prototype.removeCollectionAssociation = function removeCollectionAssociation(entity, property) { property = property || getPropertyForAssociation(this, entity); var idToRemove = entity; if (entity instanceof Entity) { if (!entity.id) { return Promise.resolve(null); } idToRemove = entity.id; } return this.getTransport().destroy([this.getResource(), this.id, property, idToRemove].join('/')); }; Entity.prototype.saveCollections = function saveCollections() { var _this4 = this; var tasks = []; var currentCollections = getCollectionsCompact(this, true); var cleanCollections = this.__cleanValues.data ? this.__cleanValues.data.collections : null; var addTasksForDifferences = function addTasksForDifferences(base, candidate, method) { if (base === null) { return; } Object.getOwnPropertyNames(base).forEach(function (property) { base[property].forEach(function (id) { if (candidate === null || !Array.isArray(candidate[property]) || candidate[property].indexOf(id) === -1) { tasks.push(method.call(_this4, id, property)); } }); }); }; addTasksForDifferences(currentCollections, cleanCollections, this.addCollectionAssociation); addTasksForDifferences(cleanCollections, currentCollections, this.removeCollectionAssociation); return Promise.all(tasks).then(function (results) { return _this4; }); }; Entity.prototype.markClean = function markClean() { var cleanValues = getFlat(this, false, false); this.__cleanValues = { checksum: JSON.stringify(cleanValues), data: cleanValues }; return this; }; Entity.prototype.isClean = function isClean() { return getFlat(this, true, false) === this.__cleanValues.checksum; }; Entity.prototype.isDirty = function isDirty() { return !this.isClean(); }; Entity.prototype.isNew = function isNew() { return typeof this.id === 'undefined'; }; Entity.getResource = function getResource() { return _ormMetadata.OrmMetadata.forTarget(this).fetch('resource'); }; Entity.prototype.getResource = function getResource() { return this.__resource || this.getMeta().fetch('resource'); }; Entity.prototype.setResource = function setResource(resource) { return this.define('__resource', resource); }; Entity.prototype.destroy = function destroy() { if (!this.id) { throw new Error('Required value "id" missing on entity.'); } return this.getTransport().destroy(this.getResource(), this.id); }; Entity.prototype.getName = function getName() { var metaName = this.getMeta().fetch('name'); if (metaName) { return metaName; } return this.getResource(); }; Entity.getName = function getName() { var metaName = _ormMetadata.OrmMetadata.forTarget(this).fetch('name'); if (metaName) { return metaName; } return this.getResource(); }; Entity.prototype.setData = function setData(data) { Object.assign(this, data); return this; }; Entity.prototype.enableValidation = function enableValidation() { if (!this.hasValidation()) { throw new Error('Entity not marked as validated. Did you forget the @validation() decorator?'); } if (this.__validation) { return this; } return this.define('__validation', this.__validator.on(this)); }; Entity.prototype.getValidation = function getValidation() { if (!this.hasValidation()) { return null; } if (!this.__validation) { this.enableValidation(); } return this.__validation; }; Entity.prototype.hasValidation = function hasValidation() { return !!this.getMeta().fetch('validation'); }; Entity.prototype.asObject = function asObject(shallow) { return _asObject(this, shallow); }; Entity.prototype.asJson = function asJson(shallow) { return _asJson(this, shallow); }; return Entity; }()) || _class) || _class); function _asObject(entity, shallow) { var pojo = {}; var metadata = entity.getMeta(); Object.keys(entity).forEach(function (propertyName) { var value = entity[propertyName]; var association = metadata.fetch('associations', propertyName); if (!association || !value) { pojo[propertyName] = value; return; } if (shallow) { if (association.type === 'collection') { return; } if (value.id) { pojo[propertyName] = value.id; } else if (value instanceof Entity) { pojo[propertyName] = value.asObject(); } else if (['string', 'number', 'boolean'].indexOf(typeof value === 'undefined' ? 'undefined' : _typeof(value)) > -1 || value.constructor === Object) { pojo[propertyName] = value; } return; } if (!Array.isArray(value)) { pojo[propertyName] = !(value instanceof Entity) ? value : value.asObject(shallow); return; } var asObjects = []; value.forEach(function (childValue) { if ((typeof childValue === 'undefined' ? 'undefined' : _typeof(childValue)) !== 'object') { return; } if (!(childValue instanceof Entity)) { asObjects.push(childValue); return; } if (!shallow || (typeof childValue === 'undefined' ? 'undefined' : _typeof(childValue)) === 'object' && !childValue.id) { asObjects.push(childValue.asObject(shallow)); } }); if (asObjects.length > 0) { pojo[propertyName] = asObjects; } }); return pojo; } function _asJson(entity, shallow) { var json = void 0; try { json = JSON.stringify(_asObject(entity, shallow)); } catch (error) { json = ''; } return json; } function getCollectionsCompact(forEntity, includeNew) { var associations = forEntity.getMeta().fetch('associations'); var collections = {}; Object.getOwnPropertyNames(associations).forEach(function (index) { var association = associations[index]; if (association.type !== 'collection') { return; } collections[index] = []; if (!Array.isArray(forEntity[index])) { return; } forEntity[index].forEach(function (entity) { if (typeof entity === 'number') { collections[index].push(entity); return; } if (entity.id) { collections[index].push(entity.id); } else if (includeNew && entity instanceof Entity) { collections[index].push(entity); } }); }); return collections; } function getFlat(entity, json, shallow) { var flat = { entity: _asObject(entity, !!shallow), collections: getCollectionsCompact(entity) }; if (json) { flat = JSON.stringify(flat); } return flat; } function getPropertyForAssociation(forEntity, entity) { var associations = forEntity.getMeta().fetch('associations'); return Object.keys(associations).filter(function (key) { return associations[key].entity === entity.getResource(); })[0]; } });
var detailSelector = function() { return { restrict: 'E', scope : { items: '=', selectedItem: '=' }, replace: true, templateUrl: 'js/directives/detailSelector.html', link: function (scope, element, attrs) { scope.updateCurrentItem = function(value) { scope.selectedItem = value; }; } }; } module.exports = detailSelector;
/* * GoJS v2.2.0b4 JavaScript Library for HTML Diagrams, https://gojs.net * GoJS and Northwoods Software are registered trademarks of Northwoods Software Corporation, https://www.nwoods.com. * Copyright (C) 1998-2022 by Northwoods Software Corporation. All Rights Reserved. * THIS SOFTWARE IS LICENSED. THE LICENSE AGREEMENT IS AT: https://gojs.net/2.2.0b4/license.html. * DO NOT MODIFY THIS FILE. DO NOT DISTRIBUTE A MODIFIED COPY OF THE CONTENTS OF THIS FILE. */ (function() { var t;function aa(a){var b=0;return function(){return b<a.length?{done:!1,value:a[b++]}:{done:!0}}}function ca(a){var b="undefined"!=typeof Symbol&&Symbol.iterator&&a[Symbol.iterator];return b?b.call(a):{next:aa(a)}}function da(a){for(var b,c=[];!(b=a.next()).done;)c.push(b.value);return c}var ea="function"==typeof Object.create?Object.create:function(a){function b(){}b.prototype=a;return new b},fa; if("function"==typeof Object.setPrototypeOf)fa=Object.setPrototypeOf;else{var ha;a:{var ia={a:!0},ja={};try{ja.__proto__=ia;ha=ja.a;break a}catch(a){}ha=!1}fa=ha?function(a,b){a.__proto__=b;if(a.__proto__!==b)throw new TypeError(a+" is not extensible");return a}:null}var la=fa; function ma(a,b){a.prototype=ea(b.prototype);a.prototype.constructor=a;if(la)la(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.JB=b.prototype} var na="undefined"!=typeof global&&null!=global?global:self,oa="function"==typeof Object.assign?Object.assign:function(a,b){for(var c=1;c<arguments.length;c++){var d=arguments[c];if(d)for(var e in d)Object.prototype.hasOwnProperty.call(d,e)&&(a[e]=d[e])}return a},pa="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)}; function qa(a,b){if(b){var c=na;a=a.split(".");for(var d=0;d<a.length-1;d++){var e=a[d];e in c||(c[e]={});c=c[e]}a=a[a.length-1];d=c[a];b=b(d);b!=d&&null!=b&&pa(c,a,{configurable:!0,writable:!0,value:b})}}qa("Object.assign",function(a){return a||oa}); qa("String.prototype.startsWith",function(a){return a?a:function(a,c){if(null==this)throw new TypeError("The 'this' value for String.prototype.startsWith must not be null or undefined");if(a instanceof RegExp)throw new TypeError("First argument to String.prototype.startsWith must not be a regular expression");var b=this.length,e=a.length;c=Math.max(0,Math.min(c|0,this.length));for(var f=0;f<e&&c<b;)if(this[c++]!=a[f++])return!1;return f>=e}}); qa("Array.prototype.fill",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 ra="object"===typeof globalThis&&globalThis||"object"===typeof global&&global.global===global&&global||"object"===typeof self&&self.self===self&&self||{};void 0===ra.requestAnimationFrame&&(void 0===ra.setImmediate?ra.requestAnimationFrame=function(a){ra.setTimeout(a,0)}:ra.requestAnimationFrame=ra.setImmediate);function sa(){}function ta(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&ra.clearTimeout(c);c=ua(function(){c=-1;a.apply(d,e)},b)}} function ua(a,b){return ra.setTimeout(a,b)}function va(a){return ra.document.createElement(a)}function v(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);v(a)}function w(a,b,c,d){a instanceof b||(c=ya(c),void 0!==d&&(c+="."+d),za(a,b,c))}function A(a,b,c,d){typeof a!==b&&(c=ya(c),void 0!==d&&(c+="."+d),za(a,b,c))} function C(a,b,c){"number"===typeof a&&isFinite(a)||(b=ya(b),void 0!==c&&(b+="."+c),v(b+" must be a real number type, and not NaN or Infinity: "+a))}function za(a,b,c,d){b=" value is not an instance of "+ya(b)+": ";c=ya(c);void 0!==d&&(c+="."+d);"string"===typeof a&&(a='"'+a+'"');v(c+b+a)}function Ba(a,b,c,d){c=ya(c);void 0!==d&&(c+="."+d);v(c+" is not in the range "+b+": "+a)}function Ca(a){v(("string"===typeof a.className?a.className:"")+" constructor cannot take any arguments.")} function Da(a){v("Collection was modified during iteration: "+a.toString()+"\n Perhaps you should iterate over a copy of the collection,\n or you could collect items to be removed from the collection after the iteration.")}function Ea(a,b){v("No property to set for this enum value: "+b+" on "+a.toString())}function Fa(a){ra.console&&ra.console.log(a)}function Ga(a){return"object"===typeof a&&null!==a} function Ha(a){return Array.isArray(a)||ra.NodeList&&a instanceof ra.NodeList||ra.HTMLCollection&&a instanceof ra.HTMLCollection}function Ia(a,b,c){Ha(a)||za(a,"Array or NodeList or HTMLCollection",b,c)}function Ja(a){return Array.prototype.slice.call(a)}function Ka(a,b,c){Array.isArray(a)?b>=a.length?a.push(c):a.splice(b,0,c):v("Cannot insert an object into an HTMLCollection or NodeList: "+c+" at "+b)} function La(a,b){Array.isArray(a)?b>=a.length?a.pop():a.splice(b,1):v("Cannot remove an object from an HTMLCollection or NodeList at "+b)}function Ma(){var a=Na.pop();return void 0===a?[]:a}function Oa(a){a.length=0;Na.push(a)}function ya(a){return null===a?"*":"string"===typeof a?a:"function"===typeof a&&"string"===typeof a.className?a.className:""} 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(Ga(a)&&a.constructor)return Pa(a.constructor);return typeof a} function Qa(a){var b=a;Ga(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 Ra(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.zB;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(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 Wa=void 0!==ra.navigator&&0<ra.navigator.userAgent.indexOf("Trident/7"),Za=void 0!==ra.navigator&&0<ra.navigator.userAgent.indexOf("Edge/"),$a=void 0!==ra.navigator&&void 0!==ra.navigator.platform&&0<=ra.navigator.platform.toUpperCase().indexOf("MAC"),ab=void 0!==ra.navigator&&void 0!==ra.navigator.platform&&null!==ra.navigator.platform.match(/(iPhone|iPod|iPad)/i),Na=[];Object.freeze([]);sa.className="Util";sa.Dx="32ab5ff3b26f42dc0ed90f21462913b5";sa.adym="gojs.net";sa.vfo="28e644fdb3344f"; sa.className="Util";function E(a,b,c){cb(this);this.j=a;this.ta=b;this.o=c}E.prototype.toString=function(){return"EnumValue."+this.ta};function db(a,b){return void 0===b||null===b||""===b?null:a[b]}function eb(a,b,c,d){a.classType!==b&&(c=ya(c),void 0!==d&&(c+="."+d),za(a,"function"==="a constant of class "+typeof b.className?b.className:"",c))} na.Object.defineProperties(E.prototype,{classType:{configurable:!0,get:function(){return this.j}},name:{configurable:!0,get:function(){return this.ta}},value:{configurable:!0,get:function(){return this.o}}});E.className="EnumValue";function fb(){this.vx=[]}fb.prototype.toString=function(){return this.vx.join("")};fb.prototype.add=function(a){""!==a&&this.vx.push(a)};fb.className="StringBuilder";function gb(){}gb.className="PropertyCollection"; var G={Am:!1,sy:!1,BB:!1,DB:!1,HB:!1,Hy:!1,qy:!1,AB:null,trace:function(a){ra.console&&ra.console.log(a)},CB:function(a,b,c,d){a.strokeStyle="red";a.fillStyle="red";a.font="8px sans-serif";a.beginPath();a.moveTo(-10,0);a.lineTo(10,0);a.moveTo(0,-10);a.lineTo(0,10);a.stroke();a.setTransform(1,0,0,1,0,0);a.scale(c,c);a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy);a.lineWidth=2;a.beginPath();a.moveTo(d.left,d.top+20);a.lineTo(d.left,d.top);a.lineTo(d.left+20,d.top);a.moveTo(d.right,d.bottom-20);a.lineTo(d.right, d.bottom);a.lineTo(d.right-20,d.bottom);a.stroke();a.fillText("DB: "+Math.round(d.x)+", "+Math.round(d.y)+", "+Math.round(d.width)+", "+Math.round(d.height),d.left,d.top-5)},Ez:function(a){var b={},c;for(c in a){b.x=c;if("licenseKey"!==b.x){var d=a[b.x];if(void 0!==d.prototype){b.Qm=Object.getOwnPropertyNames(d.prototype);for(var e={Fk:0};e.Fk<b.Qm.length;e={Fk:e.Fk},e.Fk++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.Qm[e.Fk]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype, b.Qm[e.Fk],{set:function(a,b){return function(){throw Error("Property "+a.Qm[b.Fk]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={Qm:b.Qm,x:b.x}}}};function hb(){}hb.prototype.reset=function(){};hb.prototype.next=function(){return!1};hb.prototype.wd=function(){return!1};hb.prototype.first=function(){return null};hb.prototype.any=function(){return!1};hb.prototype.all=function(){return!0};hb.prototype.each=function(){return this};hb.prototype.map=function(){return this};hb.prototype.filter=function(){return this}; hb.prototype.Vd=function(){};hb.prototype.toString=function(){return"EmptyIterator"};na.Object.defineProperties(hb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 0}}});hb.prototype.first=hb.prototype.first;hb.prototype.hasNext=hb.prototype.wd;hb.prototype.next=hb.prototype.next;hb.prototype.reset=hb.prototype.reset;var ib=null;hb.className="EmptyIterator";ib=new hb;function jb(a){this.key=-1;this.value=a} jb.prototype.reset=function(){this.key=-1};jb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};jb.prototype.wd=function(){return this.next()};jb.prototype.first=function(){this.key=0;return this.value};jb.prototype.any=function(a){this.key=-1;return a(this.value)};jb.prototype.all=function(a){this.key=-1;return a(this.value)};jb.prototype.each=function(a){this.key=-1;a(this.value);return this};jb.prototype.map=function(a){return new jb(a(this.value))}; jb.prototype.filter=function(a){return a(this.value)?new jb(this.value):ib};jb.prototype.Vd=function(){this.value=null};jb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};na.Object.defineProperties(jb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 1}}});jb.prototype.first=jb.prototype.first;jb.prototype.hasNext=jb.prototype.wd;jb.prototype.next=jb.prototype.next; jb.prototype.reset=jb.prototype.reset;jb.className="SingletonIterator";function kb(a){this.xb=a;this.sf=null;a.Oa=null;this.pa=a.w;this.Wa=-1}kb.prototype.reset=function(){var a=this.xb;a.Oa=null;this.pa=a.w;this.Wa=-1};kb.prototype.next=function(){var a=this.xb;if(a.w!==this.pa){if(0>this.key)return!1;Da(a)}a=a.l;var b=a.length,c=++this.Wa,d=this.sf;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Wa=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Vd()}return!1}; kb.prototype.wd=function(){return this.next()};kb.prototype.first=function(){var a=this.xb;this.pa=a.w;this.Wa=0;a=a.l;var b=a.length,c=this.sf;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Wa=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};kb.prototype.any=function(a){var b=this.xb;b.Oa=null;var c=b.w;this.Wa=-1;for(var d=b.l,e=d.length,f=this.sf,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(a(h))return!0;b.w!==c&&Da(b)}}return!1}; kb.prototype.all=function(a){var b=this.xb;b.Oa=null;var c=b.w;this.Wa=-1;for(var d=b.l,e=d.length,f=this.sf,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(!a(h))return!1;b.w!==c&&Da(b)}}return!0};kb.prototype.each=function(a){var b=this.xb;b.Oa=null;var c=b.w;this.Wa=-1;for(var d=b.l,e=d.length,f=this.sf,g=0;g<e;g++){var h=d[g];if(null===f||f(h))a(h),b.w!==c&&Da(b)}return this}; kb.prototype.map=function(a){var b=this.xb;b.Oa=null;var c=b.w;this.Wa=-1;for(var d=[],e=b.l,f=e.length,g=this.sf,h=0;h<f;h++){var k=e[h];if(null===g||g(k))d.push(a(k)),b.w!==c&&Da(b)}a=new H;a.l=d;a.sb();return a.iterator};kb.prototype.filter=function(a){var b=this.xb;b.Oa=null;var c=b.w;this.Wa=-1;for(var d=[],e=b.l,f=e.length,g=this.sf,h=0;h<f;h++){var k=e[h];if(null===g||g(k))a(k)&&d.push(k),b.w!==c&&Da(b)}a=new H;a.l=d;a.sb();return a.iterator}; kb.prototype.Vd=function(){this.key=-1;this.value=null;this.pa=-1;this.sf=null;this.xb.Oa=this};kb.prototype.toString=function(){return"ListIterator@"+this.Wa+"/"+this.xb.count}; na.Object.defineProperties(kb.prototype,{iterator:{configurable:!0,get:function(){return this}},predicate:{configurable:!0,get:function(){return this.sf},set:function(a){this.sf=a}},count:{configurable:!0,get:function(){var a=this.sf;if(null!==a){for(var b=0,c=this.xb.l,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.xb.l.length}}});kb.prototype.first=kb.prototype.first;kb.prototype.hasNext=kb.prototype.wd;kb.prototype.next=kb.prototype.next; kb.prototype.reset=kb.prototype.reset;kb.className="ListIterator";function lb(a){this.xb=a;a.rh=null;this.pa=a.w;this.Wa=a.l.length}lb.prototype.reset=function(){var a=this.xb;a.rh=null;this.pa=a.w;this.Wa=a.l.length};lb.prototype.next=function(){var a=this.xb;if(a.w!==this.pa){if(0>this.key)return!1;Da(a)}var b=--this.Wa;if(0<=b)return this.key=b,this.value=a.l[b],!0;this.Vd();return!1};lb.prototype.wd=function(){return this.next()}; lb.prototype.first=function(){var a=this.xb;this.pa=a.w;var b=a.l;this.Wa=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};lb.prototype.any=function(a){var b=this.xb;b.rh=null;var c=b.w,d=b.l,e=d.length;this.Wa=e;for(--e;0<=e;e--){if(a(d[e]))return!0;b.w!==c&&Da(b)}return!1};lb.prototype.all=function(a){var b=this.xb;b.rh=null;var c=b.w,d=b.l,e=d.length;this.Wa=e;for(--e;0<=e;e--){if(!a(d[e]))return!1;b.w!==c&&Da(b)}return!0}; lb.prototype.each=function(a){var b=this.xb;b.rh=null;var c=b.w,d=b.l,e=d.length;this.Wa=e;for(--e;0<=e;e--)a(d[e]),b.w!==c&&Da(b);return this};lb.prototype.map=function(a){var b=this.xb;b.rh=null;var c=b.w,d=[],e=b.l,f=e.length;this.Wa=f;for(--f;0<=f;f--)d.push(a(e[f])),b.w!==c&&Da(b);a=new H;a.l=d;a.sb();return a.iterator}; lb.prototype.filter=function(a){var b=this.xb;b.rh=null;var c=b.w,d=[],e=b.l,f=e.length;this.Wa=f;for(--f;0<=f;f--){var g=e[f];a(g)&&d.push(g);b.w!==c&&Da(b)}a=new H;a.l=d;a.sb();return a.iterator};lb.prototype.Vd=function(){this.key=-1;this.value=null;this.pa=-1;this.xb.rh=this};lb.prototype.toString=function(){return"ListIteratorBackwards("+this.Wa+"/"+this.xb.count+")"}; na.Object.defineProperties(lb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.xb.l.length}}});lb.prototype.first=lb.prototype.first;lb.prototype.hasNext=lb.prototype.wd;lb.prototype.next=lb.prototype.next;lb.prototype.reset=lb.prototype.reset;lb.className="ListIteratorBackwards"; function H(a){cb(this);this.u=!1;this.l=[];this.w=0;this.rh=this.Oa=null;(G&&"function"===typeof a||"string"===typeof a)&&v("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=H.prototype;t.sb=function(){var a=this.w;a++;999999999<a&&(a=0);this.w=a};t.freeze=function(){this.u=!0;return this};t.ka=function(){this.u=!1;return this};t.toString=function(){return"List()#"+mb(this)}; t.add=function(a){if(null===a)return this;this.u&&wa(this,a);this.l.push(a);this.sb();return this};t.push=function(a){this.add(a)};t.addAll=function(a){if(null===a)return this;this.u&&wa(this);var b=this.l;if(Ha(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.sb();return this};t.clear=function(){this.u&&wa(this);this.l.length=0;this.sb()};t.contains=function(a){return null===a?!1:-1!==this.l.indexOf(a)};t.has=function(a){return this.contains(a)}; t.indexOf=function(a){return null===a?-1:this.l.indexOf(a)};t.M=function(a){G&&C(a,H,"elt:i");var b=this.l;(0>a||a>=b.length)&&Ba(a,"0 <= i < length",H,"elt:i");return b[a]};t.get=function(a){return this.M(a)};t.Wc=function(a,b){G&&C(a,H,"setElt:i");var c=this.l;(0>a||a>=c.length)&&Ba(a,"0 <= i < length",H,"setElt:i");this.u&&wa(this,a);c[a]=b};t.set=function(a,b){this.Wc(a,b)};t.first=function(){var a=this.l;return 0===a.length?null:a[0]}; t.cc=function(){var a=this.l,b=a.length;return 0<b?a[b-1]:null};t.pop=function(){this.u&&wa(this);var a=this.l;return 0<a.length?a.pop():null};H.prototype.any=function(a){for(var b=this.l,c=this.w,d=b.length,e=0;e<d;e++){if(a(b[e]))return!0;this.w!==c&&Da(this)}return!1};H.prototype.all=function(a){for(var b=this.l,c=this.w,d=b.length,e=0;e<d;e++){if(!a(b[e]))return!1;this.w!==c&&Da(this)}return!0}; H.prototype.each=function(a){for(var b=this.l,c=this.w,d=b.length,e=0;e<d;e++)a(b[e]),this.w!==c&&Da(this);return this};H.prototype.map=function(a){for(var b=new H,c=[],d=this.l,e=this.w,f=d.length,g=0;g<f;g++)c.push(a(d[g])),this.w!==e&&Da(this);b.l=c;b.sb();return b};H.prototype.filter=function(a){for(var b=new H,c=[],d=this.l,e=this.w,f=d.length,g=0;g<f;g++){var h=d[g];a(h)&&c.push(h);this.w!==e&&Da(this)}b.l=c;b.sb();return b};t=H.prototype; t.zb=function(a,b){G&&C(a,H,"insertAt:i");0>a&&Ba(a,">= 0",H,"insertAt:i");this.u&&wa(this,a);var c=this.l;a>=c.length?c.push(b):c.splice(a,0,b);this.sb()};t.remove=function(a){if(null===a)return!1;this.u&&wa(this,a);var b=this.l;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.sb();return!0};t.delete=function(a){return this.remove(a)}; t.kb=function(a){G&&C(a,H,"removeAt:i");var b=this.l;(0>a||a>=b.length)&&Ba(a,"0 <= i < length",H,"removeAt:i");this.u&&wa(this,a);a===b.length-1?b.pop():b.splice(a,1);this.sb()};t.removeRange=function(a,b){G&&(C(a,H,"removeRange:from"),C(b,H,"removeRange:to"));var c=this.l,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.u&&wa(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.sb();return this}; H.prototype.copy=function(){var a=new H,b=this.l;0<b.length&&(a.l=Array.prototype.slice.call(b));return a};t=H.prototype;t.Ea=function(){for(var a=this.l,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c};t.Rw=function(){for(var a=new I,b=this.l,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){G&&A(a,"function",H,"sort:sortfunc");this.u&&wa(this);this.l.sort(a);this.sb();return this}; t.Aj=function(a,b,c){var d=this.l,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);G&&(A(a,"function",H,"sortRange:sortfunc"),C(b,H,"sortRange:from"),C(c,H,"sortRange:to"));this.u&&wa(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&Ba(b,"0 <= from < length",H,"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.sb()),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.sb();return this};t.reverse=function(){this.u&&wa(this);this.l.reverse();this.sb();return this}; na.Object.defineProperties(H.prototype,{_dataArray:{configurable:!0,get:function(){return this.l}},count:{configurable:!0,get:function(){return this.l.length}},size:{configurable:!0,get:function(){return this.l.length}},length:{configurable:!0,get:function(){return this.l.length}},iterator:{configurable:!0,get:function(){if(0>=this.l.length)return ib;var a=this.Oa;return null!==a?(a.reset(),a):new kb(this)}},iteratorBackwards:{configurable:!0, enumerable:!0,get:function(){if(0>=this.l.length)return ib;var a=this.rh;return null!==a?(a.reset(),a):new lb(this)}}});H.prototype.reverse=H.prototype.reverse;H.prototype.sortRange=H.prototype.Aj;H.prototype.sort=H.prototype.sort;H.prototype.toSet=H.prototype.Rw;H.prototype.toArray=H.prototype.Ea;H.prototype.removeRange=H.prototype.removeRange;H.prototype.removeAt=H.prototype.kb;H.prototype["delete"]=H.prototype.delete;H.prototype.remove=H.prototype.remove;H.prototype.insertAt=H.prototype.zb; H.prototype.pop=H.prototype.pop;H.prototype.last=H.prototype.cc;H.prototype.first=H.prototype.first;H.prototype.set=H.prototype.set;H.prototype.setElt=H.prototype.Wc;H.prototype.get=H.prototype.get;H.prototype.elt=H.prototype.M;H.prototype.indexOf=H.prototype.indexOf;H.prototype.has=H.prototype.has;H.prototype.contains=H.prototype.contains;H.prototype.clear=H.prototype.clear;H.prototype.addAll=H.prototype.addAll;H.prototype.push=H.prototype.push;H.prototype.add=H.prototype.add;H.prototype.thaw=H.prototype.ka; H.prototype.freeze=H.prototype.freeze;H.className="List";function nb(a){this.Dg=a;a.Oa=null;this.pa=a.w;this.qa=null}nb.prototype.reset=function(){var a=this.Dg;a.Oa=null;this.pa=a.w;this.qa=null};nb.prototype.next=function(){var a=this.Dg;if(a.w!==this.pa){if(null===this.key)return!1;Da(a)}var b=this.qa;b=null===b?a.ga:b.ua;if(null!==b)return this.qa=b,this.value=b.value,this.key=b.key,!0;this.Vd();return!1};nb.prototype.wd=function(){return this.next()}; nb.prototype.first=function(){var a=this.Dg;this.pa=a.w;a=a.ga;if(null!==a){this.qa=a;var b=a.value;this.key=a.key;return this.value=b}return null};nb.prototype.any=function(a){var b=this.Dg;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.w!==c&&Da(b);d=d.ua}return!1};nb.prototype.all=function(a){var b=this.Dg;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.w!==c&&Da(b);d=d.ua}return!0}; nb.prototype.each=function(a){var b=this.Dg;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;)a(d.value),b.w!==c&&Da(b),d=d.ua;return this};nb.prototype.map=function(a){var b=this.Dg;b.Oa=null;for(var c=new H,d=b.w,e=b.ga;null!==e;)c.add(a(e.value)),b.w!==d&&Da(b),e=e.ua;return c.iterator};nb.prototype.filter=function(a){var b=this.Dg;b.Oa=null;for(var c=new H,d=b.w,e=b.ga;null!==e;){var f=e.value;a(f)&&c.add(f);b.w!==d&&Da(b);e=e.ua}return c.iterator}; nb.prototype.Vd=function(){this.value=this.key=null;this.pa=-1;this.Dg.Oa=this};nb.prototype.toString=function(){return null!==this.qa?"SetIterator@"+this.qa.value:"SetIterator"};na.Object.defineProperties(nb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.Dg.Mb}}});nb.prototype.first=nb.prototype.first;nb.prototype.hasNext=nb.prototype.wd;nb.prototype.next=nb.prototype.next;nb.prototype.reset=nb.prototype.reset; nb.className="SetIterator";function I(a){cb(this);this.u=!1;this.Nb={};this.Mb=0;this.Oa=null;this.w=0;this.lf=this.ga=null;(G&&"function"===typeof a||"string"===typeof a)&&v("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=I.prototype;t.sb=function(){var a=this.w;a++;999999999<a&&(a=0);this.w=a};t.freeze=function(){this.u=!0;return this};t.ka=function(){this.u=!1;return this};t.toString=function(){return"Set()#"+mb(this)}; t.add=function(a){if(null===a)return this;this.u&&wa(this,a);var b=a;Ga(a)&&(b=ob(a));void 0===this.Nb[b]&&(this.Mb++,a=new pb(a,a),this.Nb[b]=a,b=this.lf,null===b?this.ga=a:(a.am=b,b.ua=a),this.lf=a,this.sb());return this};t.addAll=function(a){if(null===a)return this;this.u&&wa(this);if(Ha(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 Ga(a)&&(b=mb(a),void 0===b)?!1:void 0!==this.Nb[b]};t.has=function(a){return this.contains(a)};t.Mz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.Nz=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.ga;return null===a?null:a.value}; I.prototype.any=function(a){for(var b=this.w,c=this.ga;null!==c;){if(a(c.value))return!0;this.w!==b&&Da(this);c=c.ua}return!1};I.prototype.all=function(a){for(var b=this.w,c=this.ga;null!==c;){if(!a(c.value))return!1;this.w!==b&&Da(this);c=c.ua}return!0};I.prototype.each=function(a){for(var b=this.w,c=this.ga;null!==c;)a(c.value),this.w!==b&&Da(this),c=c.ua;return this};I.prototype.map=function(a){for(var b=new I,c=this.w,d=this.ga;null!==d;)b.add(a(d.value)),this.w!==c&&Da(this),d=d.ua;return b}; I.prototype.filter=function(a){for(var b=new I,c=this.w,d=this.ga;null!==d;){var e=d.value;a(e)&&b.add(e);this.w!==c&&Da(this);d=d.ua}return b};t=I.prototype;t.remove=function(a){if(null===a)return!1;this.u&&wa(this,a);var b=a;if(Ga(a)&&(b=mb(a),void 0===b))return!1;a=this.Nb[b];if(void 0===a)return!1;var c=a.ua,d=a.am;null!==c&&(c.am=d);null!==d&&(d.ua=c);this.ga===a&&(this.ga=c);this.lf===a&&(this.lf=d);delete this.Nb[b];this.Mb--;this.sb();return!0};t.delete=function(a){return this.remove(a)}; t.gr=function(a){if(null===a)return this;this.u&&wa(this);if(Ha(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.jB=function(a){if(null===a||0===this.count)return this;this.u&&wa(this);var b=new I;b.addAll(a);a=[];for(var c=this.iterator;c.next();){var d=c.value;b.contains(d)||a.push(d)}this.gr(a);return this};t.clear=function(){this.u&&wa(this);this.Nb={};this.Mb=0;null!==this.Oa&&this.Oa.reset();this.lf=this.ga=null;this.sb()}; I.prototype.copy=function(){var a=new I,b=this.Nb,c;for(c in b)a.add(b[c].value);return a};I.prototype.Ea=function(){var a=Array(this.Mb),b=this.Nb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};I.prototype.Qw=function(){var a=new H,b=this.Nb,c;for(c in b)a.add(b[c].value);return a};function cb(a){a.__gohashid=qb++}function ob(a){var b=a.__gohashid;void 0===b&&(b=qb++,a.__gohashid=b);return b}function mb(a){return a.__gohashid} na.Object.defineProperties(I.prototype,{count:{configurable:!0,get:function(){return this.Mb}},size:{configurable:!0,get:function(){return this.Mb}},iterator:{configurable:!0,get:function(){if(0>=this.Mb)return ib;var a=this.Oa;return null!==a?(a.reset(),a):new nb(this)}}});I.prototype.toList=I.prototype.Qw;I.prototype.toArray=I.prototype.Ea;I.prototype.clear=I.prototype.clear;I.prototype.retainAll=I.prototype.jB;I.prototype.removeAll=I.prototype.gr; I.prototype["delete"]=I.prototype.delete;I.prototype.remove=I.prototype.remove;I.prototype.first=I.prototype.first;I.prototype.containsAny=I.prototype.Nz;I.prototype.containsAll=I.prototype.Mz;I.prototype.has=I.prototype.has;I.prototype.contains=I.prototype.contains;I.prototype.addAll=I.prototype.addAll;I.prototype.add=I.prototype.add;I.prototype.thaw=I.prototype.ka;I.prototype.freeze=I.prototype.freeze;var qb=1;I.className="Set";I.uniqueHash=cb;I.hashIdUnique=ob;I.hashId=mb; function sb(a){this.ma=a;this.pa=a.w;this.qa=null}sb.prototype.reset=function(){this.pa=this.ma.w;this.qa=null};sb.prototype.next=function(){var a=this.ma;if(a.w!==this.pa){if(null===this.key)return!1;Da(a)}var b=this.qa;b=null===b?a.ga:b.ua;if(null!==b)return this.qa=b,this.value=this.key=a=b.key,!0;this.Vd();return!1};sb.prototype.wd=function(){return this.next()};sb.prototype.first=function(){var a=this.ma;this.pa=a.w;a=a.ga;return null!==a?(this.qa=a,this.value=this.key=a=a.key):null}; sb.prototype.any=function(a){var b=this.ma,c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(a(d.key))return!0;b.w!==c&&Da(b);d=d.ua}return!1};sb.prototype.all=function(a){var b=this.ma,c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d.key))return!1;b.w!==c&&Da(b);d=d.ua}return!0};sb.prototype.each=function(a){var b=this.ma,c=b.w;this.qa=null;for(var d=b.ga;null!==d;)a(d.key),b.w!==c&&Da(b),d=d.ua;return this}; sb.prototype.map=function(a){var b=this.ma,c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e.key)),b.w!==c&&Da(b),e=e.ua;return d.iterator};sb.prototype.filter=function(a){var b=this.ma,c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;){var f=e.key;a(f)&&d.add(f);b.w!==c&&Da(b);e=e.ua}return d.iterator};sb.prototype.Vd=function(){this.value=this.key=null;this.pa=-1};sb.prototype.toString=function(){return null!==this.qa?"MapKeySetIterator@"+this.qa.value:"MapKeySetIterator"}; na.Object.defineProperties(sb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.ma.Mb}}});sb.prototype.first=sb.prototype.first;sb.prototype.hasNext=sb.prototype.wd;sb.prototype.next=sb.prototype.next;sb.prototype.reset=sb.prototype.reset;sb.className="MapKeySetIterator";function tb(a){I.call(this);cb(this);this.u=!0;this.ma=a}ma(tb,I);t=tb.prototype;t.freeze=function(){return this};t.ka=function(){return this}; t.toString=function(){return"MapKeySet("+this.ma.toString()+")"};t.add=function(){v("This Set is read-only: "+this.toString())};t.contains=function(a){return this.ma.contains(a)};t.has=function(a){return this.contains(a)};t.remove=function(){v("This Set is read-only: "+this.toString())};t.delete=function(a){return this.remove(a)};t.clear=function(){v("This Set is read-only: "+this.toString())};t.first=function(){var a=this.ma.ga;return null!==a?a.key:null}; tb.prototype.any=function(a){for(var b=this.ma.ga;null!==b;){if(a(b.key))return!0;b=b.ua}return!1};tb.prototype.all=function(a){for(var b=this.ma.ga;null!==b;){if(!a(b.key))return!1;b=b.ua}return!0};tb.prototype.each=function(a){for(var b=this.ma.ga;null!==b;)a(b.key),b=b.ua;return this};tb.prototype.map=function(a){for(var b=new I,c=this.ma.ga;null!==c;)b.add(a(c.key)),c=c.ua;return b};tb.prototype.filter=function(a){for(var b=new I,c=this.ma.ga;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.ua}return b}; tb.prototype.copy=function(){return new tb(this.ma)};tb.prototype.Rw=function(){var a=new I,b=this.ma.Nb,c;for(c in b)a.add(b[c].key);return a};tb.prototype.Ea=function(){var a=this.ma.Nb,b=Array(this.ma.Mb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};tb.prototype.Qw=function(){var a=new H,b=this.ma.Nb,c;for(c in b)a.add(b[c].key);return a}; na.Object.defineProperties(tb.prototype,{count:{configurable:!0,get:function(){return this.ma.Mb}},size:{configurable:!0,get:function(){return this.ma.Mb}},iterator:{configurable:!0,get:function(){return 0>=this.ma.Mb?ib:new sb(this.ma)}}});tb.prototype.toList=tb.prototype.Qw;tb.prototype.toArray=tb.prototype.Ea;tb.prototype.toSet=tb.prototype.Rw;tb.prototype.first=tb.prototype.first;tb.prototype.clear=tb.prototype.clear;tb.prototype["delete"]=tb.prototype.delete; tb.prototype.remove=tb.prototype.remove;tb.prototype.has=tb.prototype.has;tb.prototype.contains=tb.prototype.contains;tb.prototype.add=tb.prototype.add;tb.prototype.thaw=tb.prototype.ka;tb.prototype.freeze=tb.prototype.freeze;tb.className="MapKeySet";function ub(a){this.ma=a;a.kf=null;this.pa=a.w;this.qa=null}ub.prototype.reset=function(){var a=this.ma;a.kf=null;this.pa=a.w;this.qa=null}; ub.prototype.next=function(){var a=this.ma;if(a.w!==this.pa){if(null===this.key)return!1;Da(a)}var b=this.qa;b=null===b?a.ga:b.ua;if(null!==b)return this.qa=b,this.value=b.value,this.key=b.key,!0;this.Vd();return!1};ub.prototype.wd=function(){return this.next()};ub.prototype.first=function(){var a=this.ma;this.pa=a.w;a=a.ga;if(null!==a){this.qa=a;var b=a.value;this.key=a.key;return this.value=b}return null}; ub.prototype.any=function(a){var b=this.ma;b.kf=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.w!==c&&Da(b);d=d.ua}return!1};ub.prototype.all=function(a){var b=this.ma;b.kf=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.w!==c&&Da(b);d=d.ua}return!0};ub.prototype.each=function(a){var b=this.ma;b.kf=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;)a(d.value),b.w!==c&&Da(b),d=d.ua;return this}; ub.prototype.map=function(a){var b=this.ma;b.kf=null;var c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e.value)),b.w!==c&&Da(b),e=e.ua;return d.iterator};ub.prototype.filter=function(a){var b=this.ma;b.kf=null;var c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;){var f=e.value;a(f)&&d.add(f);b.w!==c&&Da(b);e=e.ua}return d.iterator};ub.prototype.Vd=function(){this.value=this.key=null;this.pa=-1;this.ma.kf=this}; ub.prototype.toString=function(){return null!==this.qa?"MapValueSetIterator@"+this.qa.value:"MapValueSetIterator"};na.Object.defineProperties(ub.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.ma.Mb}}});ub.prototype.first=ub.prototype.first;ub.prototype.hasNext=ub.prototype.wd;ub.prototype.next=ub.prototype.next;ub.prototype.reset=ub.prototype.reset;ub.className="MapValueSetIterator"; function pb(a,b){this.key=a;this.value=b;this.am=this.ua=null}pb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};pb.className="KeyValuePair";function yb(a){this.ma=a;a.Oa=null;this.pa=a.w;this.qa=null}yb.prototype.reset=function(){var a=this.ma;a.Oa=null;this.pa=a.w;this.qa=null}; yb.prototype.next=function(){var a=this.ma;if(a.w!==this.pa){if(null===this.key)return!1;Da(a)}var b=this.qa;b=null===b?a.ga:b.ua;if(null!==b)return this.qa=b,this.key=b.key,this.value=b.value,!0;this.Vd();return!1};yb.prototype.wd=function(){return this.next()};yb.prototype.first=function(){var a=this.ma;this.pa=a.w;a=a.ga;return null!==a?(this.qa=a,this.key=a.key,this.value=a.value,a):null}; yb.prototype.any=function(a){var b=this.ma;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(a(d))return!0;b.w!==c&&Da(b);d=d.ua}return!1};yb.prototype.all=function(a){var b=this.ma;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;){if(!a(d))return!1;b.w!==c&&Da(b);d=d.ua}return!0};yb.prototype.each=function(a){var b=this.ma;b.Oa=null;var c=b.w;this.qa=null;for(var d=b.ga;null!==d;)a(d),b.w!==c&&Da(b),d=d.ua;return this}; yb.prototype.map=function(a){var b=this.ma;b.Oa=null;var c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e)),b.w!==c&&Da(b),e=e.ua;return d.iterator};yb.prototype.filter=function(a){var b=this.ma;b.Oa=null;var c=b.w;this.qa=null;for(var d=new H,e=b.ga;null!==e;)a(e)&&d.add(e),b.w!==c&&Da(b),e=e.ua;return d.iterator};yb.prototype.Vd=function(){this.value=this.key=null;this.pa=-1;this.ma.Oa=this};yb.prototype.toString=function(){return null!==this.qa?"MapIterator@"+this.qa:"MapIterator"}; na.Object.defineProperties(yb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.ma.Mb}}});yb.prototype.first=yb.prototype.first;yb.prototype.hasNext=yb.prototype.wd;yb.prototype.next=yb.prototype.next;yb.prototype.reset=yb.prototype.reset;yb.className="MapIterator"; function zb(a){cb(this);this.u=!1;this.Nb={};this.Mb=0;this.kf=this.Oa=null;this.w=0;this.lf=this.ga=null;(G&&"function"===typeof a||"string"===typeof a)&&v("Error: Since 2.0 List/Map/Set constructors no longer take an argument that enforces type.");void 0!==a&&this.addAll(a)}t=zb.prototype;t.sb=function(){var a=this.w;a++;999999999<a&&(a=0);this.w=a};t.freeze=function(){this.u=!0;return this};t.ka=function(){this.u=!1;return this};t.toString=function(){return"Map()#"+mb(this)}; t.add=function(a,b){this.u&&wa(this,a);var c=a;Ga(a)&&(c=ob(a));var d=this.Nb[c];void 0===d?(this.Mb++,a=new pb(a,b),this.Nb[c]=a,c=this.lf,null===c?this.ga=a:(a.am=c,c.ua=a),this.lf=a,this.sb()):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(Ha(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];this.add(d.key,d.value)}else if(a instanceof zb)for(a=a.iterator;a.next();)this.add(a.key,a.value);else for(a=a.iterator;a.next();)b=a.value,this.add(b.key,b.value);return this};t.first=function(){return this.ga};zb.prototype.any=function(a){for(var b=this.w,c=this.ga;null!==c;){if(a(c))return!0;this.w!==b&&Da(this);c=c.ua}return!1}; zb.prototype.all=function(a){for(var b=this.w,c=this.ga;null!==c;){if(!a(c))return!1;this.w!==b&&Da(this);c=c.ua}return!0};zb.prototype.each=function(a){for(var b=this.w,c=this.ga;null!==c;)a(c),this.w!==b&&Da(this),c=c.ua;return this};zb.prototype.map=function(a){for(var b=new zb,c=this.w,d=this.ga;null!==d;)b.add(d.key,a(d)),this.w!==c&&Da(this),d=d.ua;return b};zb.prototype.filter=function(a){for(var b=new zb,c=this.w,d=this.ga;null!==d;)a(d)&&b.add(d.key,d.value),this.w!==c&&Da(this),d=d.ua;return b}; t=zb.prototype;t.contains=function(a){var b=a;return Ga(a)&&(b=mb(a),void 0===b)?!1:void 0!==this.Nb[b]};t.has=function(a){return this.contains(a)};t.K=function(a){var b=a;if(Ga(a)&&(b=mb(a),void 0===b))return null;a=this.Nb[b];return void 0===a?null:a.value};t.get=function(a){return this.K(a)}; t.remove=function(a){if(null===a)return!1;this.u&&wa(this,a);var b=a;if(Ga(a)&&(b=mb(a),void 0===b))return!1;a=this.Nb[b];if(void 0===a)return!1;var c=a.ua,d=a.am;null!==c&&(c.am=d);null!==d&&(d.ua=c);this.ga===a&&(this.ga=c);this.lf===a&&(this.lf=d);delete this.Nb[b];this.Mb--;this.sb();return!0};t.delete=function(a){return this.remove(a)};t.clear=function(){this.u&&wa(this);this.Nb={};this.Mb=0;null!==this.Oa&&this.Oa.reset();null!==this.kf&&this.kf.reset();this.lf=this.ga=null;this.sb()}; zb.prototype.copy=function(){var a=new zb,b=this.Nb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};zb.prototype.Ea=function(){var a=this.Nb,b=Array(this.Mb),c=0,d;for(d in a){var e=a[d];b[c]=new pb(e.key,e.value);c++}return b};zb.prototype.Vf=function(){return new tb(this)}; na.Object.defineProperties(zb.prototype,{count:{configurable:!0,get:function(){return this.Mb}},size:{configurable:!0,get:function(){return this.Mb}},iterator:{configurable:!0,get:function(){if(0>=this.count)return ib;var a=this.Oa;return null!==a?(a.reset(),a):new yb(this)}},iteratorKeys:{configurable:!0,get:function(){return 0>=this.count?ib:new sb(this)}},iteratorValues:{configurable:!0,get:function(){if(0>=this.count)return ib; var a=this.kf;return null!==a?(a.reset(),a):new ub(this)}}});zb.prototype.toKeySet=zb.prototype.Vf;zb.prototype.toArray=zb.prototype.Ea;zb.prototype.clear=zb.prototype.clear;zb.prototype["delete"]=zb.prototype.delete;zb.prototype.remove=zb.prototype.remove;zb.prototype.get=zb.prototype.get;zb.prototype.getValue=zb.prototype.K;zb.prototype.has=zb.prototype.has;zb.prototype.contains=zb.prototype.contains;zb.prototype.first=zb.prototype.first;zb.prototype.addAll=zb.prototype.addAll; zb.prototype.set=zb.prototype.set;zb.prototype.add=zb.prototype.add;zb.prototype.thaw=zb.prototype.ka;zb.prototype.freeze=zb.prototype.freeze;zb.className="Map";function J(a,b){void 0===a?this.J=this.I=0:"number"===typeof a&&"number"===typeof b?(this.I=a,this.J=b):v("Invalid arguments to Point constructor: "+a+", "+b);this.u=!1}J.prototype.assign=function(a){this.I=a.I;this.J=a.J;return this};J.prototype.h=function(a,b){this.I=a;this.J=b;return this}; J.prototype.Sg=function(a,b){G&&(A(a,"number",J,"setTo:x"),A(b,"number",J,"setTo:y"),this.ha());this.I=a;this.J=b;return this};J.prototype.set=function(a){G&&(w(a,J,J,"set:p"),this.ha());this.I=a.I;this.J=a.J;return this};J.prototype.copy=function(){var a=new J;a.I=this.I;a.J=this.J;return a};t=J.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this};t.L=function(){return this.u||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this}; t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(G&&this.u){var b="The Point is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+=" to value: "+a);v(b)}};function Ab(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 J(c,e)}return new J} function Bb(a){G&&w(a,J);return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.B=function(a){return a instanceof J?this.I===a.x&&this.J===a.y:!1};t.ij=function(a,b){return this.I===a&&this.J===b};t.Ya=function(a){return K.A(this.I,a.x)&&K.A(this.J,a.y)};t.add=function(a){G&&(w(a,J,J,"add:p"),this.ha());this.I+=a.x;this.J+=a.y;return this};t.oe=function(a){G&&(w(a,J,J,"subtract:p"),this.ha());this.I-=a.x;this.J-=a.y;return this}; t.offset=function(a,b){G&&(C(a,J,"offset:dx"),C(b,J,"offset:dy"),this.ha());this.I+=a;this.J+=b;return this};J.prototype.rotate=function(a){G&&(C(a,J,"rotate:angle"),this.ha());if(0===a)return this;var b=this.I,c=this.J;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.I=a*b-d*c;this.J=d*b+a*c;return this};t=J.prototype; t.scale=function(a,b){G&&(C(a,J,"scale:sx"),C(b,J,"scale:sy"),this.ha());this.I*=a;this.J*=b;return this};t.Lf=function(a){G&&w(a,J,J,"distanceSquaredPoint:p");var b=a.x-this.I;a=a.y-this.J;return b*b+a*a};t.vd=function(a,b){G&&(C(a,J,"distanceSquared:px"),C(b,J,"distanceSquared:py"));a-=this.I;b-=this.J;return a*a+b*b};t.normalize=function(){G&&this.ha();var a=this.I,b=this.J,c=Math.sqrt(a*a+b*b);0<c&&(this.I=a/c,this.J=b/c);return this}; t.Ua=function(a){G&&w(a,J,J,"directionPoint:p");return Cb(a.x-this.I,a.y-this.J)};t.direction=function(a,b){G&&(C(a,J,"direction:px"),C(b,J,"direction:py"));return Cb(a-this.I,b-this.J)};function Cb(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.Lz=function(a,b){G&&(w(a,J,J,"compareWithLineSegmentPoint:p"),w(b,J,J,"compareWithLineSegmentPoint:q"));return K.Cm(a.x,a.y,b.x,b.y,this.x,this.y)};t.$A=function(a,b,c,d){G&&(C(a,J,"projectOntoLineSegment:px"),C(b,J,"projectOntoLineSegment:py"),C(c,J,"projectOntoLineSegment:qx"),C(d,J,"projectOntoLineSegment:qy"));K.Yh(a,b,c,d,this.I,this.J,this);return this}; t.aB=function(a,b){G&&(w(a,J,J,"projectOntoLineSegmentPoint:p"),w(b,J,J,"projectOntoLineSegmentPoint:q"));K.Yh(a.x,a.y,b.x,b.y,this.I,this.J,this);return this};t.oB=function(a,b,c,d){G&&(C(a,J,"snapToGrid:originx"),C(b,J,"snapToGrid:originy"),C(c,J,"snapToGrid:cellwidth"),C(d,J,"snapToGrid:cellheight"));K.Oq(this.I,this.J,a,b,c,d,this);return this};t.pB=function(a,b){G&&(w(a,J,J,"snapToGridPoint:p"),w(b,Db,J,"snapToGridPoint:q"));K.Oq(this.I,this.J,a.x,a.y,b.width,b.height,this);return this}; t.yj=function(a,b){G&&(w(a,M,J,"setRectSpot:r"),w(b,Eb,J,"setRectSpot:spot"),this.ha());this.I=a.x+b.x*a.width+b.offsetX;this.J=a.y+b.y*a.height+b.offsetY;return this};t.zj=function(a,b,c,d,e){G&&(C(a,J,"setSpot:x"),C(b,J,"setSpot:y"),C(c,J,"setSpot:w"),C(d,J,"setSpot:h"),(0>c||0>d)&&v("Point.setSpot:Width and height cannot be negative"),w(e,Eb,J,"setSpot:spot"),this.ha());this.I=a+e.x*c+e.offsetX;this.J=b+e.y*d+e.offsetY;return this}; t.transform=function(a){G&&w(a,Fb,J,"transform:t");a.Fa(this);return this};function Gb(a,b){G&&w(b,Fb,J,"transformInverted:t");b.Md(a);return a} function Hb(a,b,c,d,e,f){G&&(C(a,J,"distanceLineSegmentSquared:px"),C(b,J,"distanceLineSegmentSquared:py"),C(c,J,"distanceLineSegmentSquared:ax"),C(d,J,"distanceLineSegmentSquared:ay"),C(e,J,"distanceLineSegmentSquared:bx"),C(f,J,"distanceLineSegmentSquared:by"));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 Ib(a,b,c,d){G&&(C(a,J,"distanceSquared:px"),C(b,J,"distanceSquared:py"),C(c,J,"distanceSquared:qx"),C(d,J,"distanceSquared:qy"));a=c-a;b=d-b;return a*a+b*b}function Jb(a,b,c,d){G&&(C(a,J,"direction:px"),C(b,J,"direction:py"),C(c,J,"direction:qx"),C(d,J,"direction:qy"));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)};J.alloc=function(){var a=Kb.pop();return void 0===a?new J:a};J.allocAt=function(a,b){var c=Kb.pop();if(void 0===c)return new J(a,b);c.x=a;c.y=b;return c};J.free=function(a){Kb.push(a)}; na.Object.defineProperties(J.prototype,{x:{configurable:!0,get:function(){return this.I},set:function(a){G&&(A(a,"number",J,"x"),this.ha(a));this.I=a}},y:{configurable:!0,get:function(){return this.J},set:function(a){G&&(A(a,"number",J,"y"),this.ha(a));this.J=a}}});J.prototype.isReal=J.prototype.s;J.prototype.setSpot=J.prototype.zj;J.prototype.setRectSpot=J.prototype.yj;J.prototype.snapToGridPoint=J.prototype.pB;J.prototype.snapToGrid=J.prototype.oB; J.prototype.projectOntoLineSegmentPoint=J.prototype.aB;J.prototype.projectOntoLineSegment=J.prototype.$A;J.intersectingLineSegments=function(a,b,c,d,e,f,g,h){G&&(C(a,J,"intersectingLineSegments:a1x"),C(b,J,"intersectingLineSegments:a1y"),C(c,J,"intersectingLineSegments:a2x"),C(d,J,"intersectingLineSegments:a2y"),C(e,J,"intersectingLineSegments:b1x"),C(f,J,"intersectingLineSegments:b1y"),C(g,J,"intersectingLineSegments:b2x"),C(h,J,"intersectingLineSegments:b2y"));return K.Jm(a,b,c,d,e,f,g,h)}; J.prototype.compareWithLineSegmentPoint=J.prototype.Lz;J.compareWithLineSegment=function(a,b,c,d,e,f){G&&(C(a,J,"compareWithLineSegment:a1x"),C(b,J,"compareWithLineSegment:a1y"),C(c,J,"compareWithLineSegment:a2x"),C(d,J,"compareWithLineSegment:a2y"),C(e,J,"compareWithLineSegment:b1x"),C(f,J,"compareWithLineSegment:b1y"));return K.Cm(a,b,c,d,e,f)};J.prototype.direction=J.prototype.direction;J.prototype.directionPoint=J.prototype.Ua;J.prototype.normalize=J.prototype.normalize; J.prototype.distanceSquared=J.prototype.vd;J.prototype.distanceSquaredPoint=J.prototype.Lf;J.prototype.scale=J.prototype.scale;J.prototype.rotate=J.prototype.rotate;J.prototype.offset=J.prototype.offset;J.prototype.subtract=J.prototype.oe;J.prototype.add=J.prototype.add;J.prototype.equalsApprox=J.prototype.Ya;J.prototype.equalTo=J.prototype.ij;J.prototype.equals=J.prototype.B;J.prototype.set=J.prototype.set;J.prototype.setTo=J.prototype.Sg;var Lb=null,Mb=null,Nb=null,Ob=null,Pb=null,Kb=[]; J.className="Point";J.parse=Ab;J.stringify=Bb;J.distanceLineSegmentSquared=Hb;J.distanceSquared=Ib;J.direction=Jb;J.Origin=Lb=(new J(0,0)).ia();J.InfiniteTopLeft=Mb=(new J(-Infinity,-Infinity)).ia();J.InfiniteBottomRight=Nb=(new J(Infinity,Infinity)).ia();J.SixPoint=Ob=(new J(6,6)).ia();J.NoPoint=Pb=(new J(NaN,NaN)).ia();J.parse=Ab;J.stringify=Bb;J.distanceLineSegmentSquared=Hb;J.distanceSquared=Ib;J.direction=Jb; function Db(a,b){void 0===a?this.ea=this.fa=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.fa=a,this.ea=b):v("Invalid arguments to Size constructor: "+a+", "+b);this.u=!1}var Qb,Rb,Sb,Tb,Ub,Xb,Yb;Db.prototype.assign=function(a){this.fa=a.fa;this.ea=a.ea;return this};Db.prototype.h=function(a,b){this.fa=a;this.ea=b;return this}; Db.prototype.Sg=function(a,b){G&&(A(a,"number",Db,"setTo:w"),A(b,"number",Db,"setTo:h"),0>a&&Ba(a,">= 0",Db,"setTo:w"),0>b&&Ba(b,">= 0",Db,"setTo:h"),this.ha());this.fa=a;this.ea=b;return this};Db.prototype.set=function(a){G&&(w(a,Db,Db,"set:s"),this.ha());this.fa=a.fa;this.ea=a.ea;return this};Db.prototype.copy=function(){var a=new Db;a.fa=this.fa;a.ea=this.ea;return a};t=Db.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this}; t.L=function(){return this.u||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(G&&this.u){var b="The Size is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+=" to value: "+a);v(b)}}; function Zb(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 Db(c,e)}return new Db}function $b(a){G&&w(a,Db);return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.B=function(a){return a instanceof Db?this.fa===a.width&&this.ea===a.height:!1};t.ij=function(a,b){return this.fa===a&&this.ea===b}; t.Ya=function(a){return K.A(this.fa,a.width)&&K.A(this.ea,a.height)};t.s=function(){return isFinite(this.width)&&isFinite(this.height)};Db.alloc=function(){var a=ac.pop();return void 0===a?new Db:a};Db.free=function(a){ac.push(a)}; na.Object.defineProperties(Db.prototype,{width:{configurable:!0,get:function(){return this.fa},set:function(a){G&&(A(a,"number",Db,"width"),this.ha(a));0>a&&Ba(a,">= 0",Db,"width");this.fa=a}},height:{configurable:!0,get:function(){return this.ea},set:function(a){G&&(A(a,"number",Db,"height"),this.ha(a));0>a&&Ba(a,">= 0",Db,"height");this.ea=a}}});Db.prototype.isReal=Db.prototype.s;Db.prototype.equalsApprox=Db.prototype.Ya;Db.prototype.equalTo=Db.prototype.ij; Db.prototype.equals=Db.prototype.B;Db.prototype.set=Db.prototype.set;Db.prototype.setTo=Db.prototype.Sg;var ac=[];Db.className="Size";Db.parse=Zb;Db.stringify=$b;Db.ZeroSize=Qb=(new Db(0,0)).ia();Db.OneSize=Rb=(new Db(1,1)).ia();Db.SixSize=Sb=(new Db(6,6)).ia();Db.EightSize=Tb=(new Db(8,8)).ia();Db.TenSize=Ub=(new Db(10,10)).ia();Db.InfiniteSize=Xb=(new Db(Infinity,Infinity)).ia();Db.NoSize=Yb=(new Db(NaN,NaN)).ia();Db.parse=Zb;Db.stringify=$b; function M(a,b,c,d){void 0===a?this.ea=this.fa=this.J=this.I=0:"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.I=a,this.J=b,this.fa=c,this.ea=d):a instanceof J?(c=a.x,a=a.y,b instanceof J?(d=b.x,b=b.y,this.I=Math.min(c,d),this.J=Math.min(a,b),this.fa=Math.abs(c-d),this.ea=Math.abs(a-b)):b instanceof Db?(this.I=c,this.J=a,this.fa=b.width,this.ea=b.height):v("Incorrect second argument supplied to Rect constructor "+b)):v("Invalid arguments to Rect constructor: "+ a+", "+b+", "+c+", "+d);this.u=!1}t=M.prototype;t.assign=function(a){this.I=a.I;this.J=a.J;this.fa=a.fa;this.ea=a.ea;return this};t.h=function(a,b,c,d){this.I=a;this.J=b;this.fa=c;this.ea=d;return this};function bc(a,b,c){a.fa=b;a.ea=c}t.Sg=function(a,b,c,d){G&&(A(a,"number",M,"setTo:x"),A(b,"number",M,"setTo:y"),A(c,"number",M,"setTo:w"),A(d,"number",M,"setTo:h"),0>c&&Ba(c,">= 0",M,"setTo:w"),0>d&&Ba(d,">= 0",M,"setTo:h"),this.ha());this.I=a;this.J=b;this.fa=c;this.ea=d;return this}; t.set=function(a){G&&(w(a,M,M,"set:r"),this.ha());this.I=a.I;this.J=a.J;this.fa=a.fa;this.ea=a.ea;return this};t.Xc=function(a){G&&(w(a,J,M,"setPoint:p"),this.ha());this.I=a.x;this.J=a.y;return this};t.nB=function(a){G&&(w(a,Db,M,"setSize:s"),this.ha());this.fa=a.width;this.ea=a.height;return this};M.prototype.copy=function(){var a=new M;a.I=this.I;a.J=this.J;a.fa=this.fa;a.ea=this.ea;return a};t=M.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this}; t.L=function(){return this.u||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(G&&this.u){var b="The Rect is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+=" to value: "+a);v(b)}}; function cc(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 M(c,e,f,g)}return new M}function dc(a){G&&w(a,M);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.B=function(a){return a instanceof M?this.I===a.x&&this.J===a.y&&this.fa===a.width&&this.ea===a.height:!1};t.ij=function(a,b,c,d){return this.I===a&&this.J===b&&this.fa===c&&this.ea===d};t.Ya=function(a){return K.A(this.I,a.x)&&K.A(this.J,a.y)&&K.A(this.fa,a.width)&&K.A(this.ea,a.height)};function ec(a,b){return K.da(a.I,b.x)&&K.da(a.J,b.y)&&K.da(a.fa,b.width)&&K.da(a.ea,b.height)} t.ca=function(a){G&&w(a,J,M,"containsPoint:p");return this.I<=a.x&&this.I+this.fa>=a.x&&this.J<=a.y&&this.J+this.ea>=a.y};t.Te=function(a){G&&w(a,M,M,"containsRect:r");return this.I<=a.x&&a.x+a.width<=this.I+this.fa&&this.J<=a.y&&a.y+a.height<=this.J+this.ea}; t.contains=function(a,b,c,d){G?(C(a,M,"contains:x"),C(b,M,"contains:y"),void 0===c?c=0:C(c,M,"contains:w"),void 0===d?d=0:C(d,M,"contains:h"),(0>c||0>d)&&v("Rect.contains:Width and height cannot be negative")):(void 0===c&&(c=0),void 0===d&&(d=0));return this.I<=a&&a+c<=this.I+this.fa&&this.J<=b&&b+d<=this.J+this.ea};t.offset=function(a,b){G&&(C(a,M,"offset:dx"),C(b,M,"offset:dy"),this.ha());this.I+=a;this.J+=b;return this}; t.Qc=function(a,b){G&&(C(a,M,"inflate:w"),C(b,M,"inflate:h"));return fc(this,b,a,b,a)};t.Dq=function(a){G&&w(a,gc,M,"addMargin:m");return fc(this,a.top,a.right,a.bottom,a.left)};t.Pw=function(a){G&&w(a,gc,M,"subtractMargin:m");return fc(this,-a.top,-a.right,-a.bottom,-a.left)};t.DA=function(a,b,c,d){G&&(C(a,M,"grow:t"),C(b,M,"grow:r"),C(c,M,"grow:b"),C(d,M,"grow:l"));return fc(this,a,b,c,d)}; function fc(a,b,c,d,e){G&&a.ha();var f=a.fa;c+e<=-f?(a.I+=f/2,a.fa=0):(a.I-=e,a.fa+=c+e);c=a.ea;b+d<=-c?(a.J+=c/2,a.ea=0):(a.J-=b,a.ea+=b+d);return a}t.Iy=function(a){G&&w(a,M,M,"intersectRect:r");return hc(this,a.x,a.y,a.width,a.height)};t.jw=function(a,b,c,d){G&&(C(a,M,"intersect:x"),C(b,M,"intersect:y"),C(c,M,"intersect:w"),C(d,M,"intersect:h"),(0>c||0>d)&&v("Rect.intersect:Width and height cannot be negative"));return hc(this,a,b,c,d)}; function hc(a,b,c,d,e){G&&a.ha();var f=Math.max(a.I,b),g=Math.max(a.J,c);b=Math.min(a.I+a.fa,b+d);c=Math.min(a.J+a.ea,c+e);a.I=f;a.J=g;a.fa=Math.max(0,b-f);a.ea=Math.max(0,c-g);return a}t.Tc=function(a){G&&w(a,M,M,"intersectsRect:r");return this.kw(a.x,a.y,a.width,a.height)}; t.kw=function(a,b,c,d){G&&(C(a,M,"intersects:x"),C(b,M,"intersects:y"),C(a,M,"intersects:w"),C(b,M,"intersects:h"),(0>c||0>d)&&v("Rect.intersects:Width and height cannot be negative"));var e=this.fa,f=this.I;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.ea;c=this.J;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0}; function ic(a,b){var c=a.fa,d=a.I,e=b.x-10;if(d>b.width+10+10+e||e>c+d)return!1;c=a.ea;a=a.J;d=b.y-10;return a>b.height+10+10+d||d>c+a?!1:!0}t.Ze=function(a){G&&w(a,J,M,"unionPoint:p");return jc(this,a.x,a.y,0,0)};t.Yc=function(a){G&&w(a,M,M,"unionRect:r");return jc(this,a.I,a.J,a.fa,a.ea)}; t.Tw=function(a,b,c,d){G?(C(a,M,"union:x"),C(b,M,"union:y"),void 0===c?c=0:C(c,M,"union:w"),void 0===d?d=0:C(d,M,"union:h"),(0>c||0>d)&&v("Rect.union:Width and height cannot be negative"),this.ha()):(void 0===c&&(c=0),void 0===d&&(d=0));return jc(this,a,b,c,d)};function jc(a,b,c,d,e){var f=Math.min(a.I,b),g=Math.min(a.J,c);b=Math.max(a.I+a.fa,b+d);c=Math.max(a.J+a.ea,c+e);a.I=f;a.J=g;a.fa=b-f;a.ea=c-g;return a} t.zj=function(a,b,c){G&&(C(a,M,"setSpot:x"),C(b,M,"setSpot:y"),w(c,Eb,M,"setSpot:spot"),this.ha());this.I=a-c.offsetX-c.x*this.fa;this.J=b-c.offsetY-c.y*this.ea;return this}; function nc(a,b,c,d,e,f,g,h){G?(C(a,M,"contains:rx"),C(b,M,"contains:ry"),C(c,M,"contains:rw"),C(d,M,"contains:rh"),C(e,M,"contains:x"),C(f,M,"contains:y"),void 0===g?g=0:C(g,M,"contains:w"),void 0===h?h=0:C(h,M,"contains:h"),(0>c||0>d||0>g||0>h)&&v("Rect.contains:Width and height cannot be negative")):(void 0===g&&(g=0),void 0===h&&(h=0));return a<=e&&e+g<=a+c&&b<=f&&f+h<=b+d} function oc(a,b,c,d,e,f,g,h){G&&(C(a,M,"intersects:rx"),C(b,M,"intersects:ry"),C(c,M,"intersects:rw"),C(d,M,"intersects:rh"),C(e,M,"intersects:x"),C(f,M,"intersects:y"),C(g,M,"intersects:w"),C(h,M,"intersects:h"),(0>c||0>d||0>g||0>h)&&v("Rect.intersects:Width and height cannot be negative"));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.JA=function(){return 0===this.width&&0===this.height}; M.alloc=function(){var a=pc.pop();return void 0===a?new M:a};M.allocAt=function(a,b,c,d){var e=pc.pop();return void 0===e?new M(a,b,c,d):e.h(a,b,c,d)};M.free=function(a){pc.push(a)}; na.Object.defineProperties(M.prototype,{x:{configurable:!0,get:function(){return this.I},set:function(a){G&&(A(a,"number",M,"x"),this.ha(a));this.I=a}},y:{configurable:!0,get:function(){return this.J},set:function(a){G&&(A(a,"number",M,"y"),this.ha(a));this.J=a}},width:{configurable:!0,get:function(){return this.fa},set:function(a){G&&(A(a,"number",M,"width"),this.ha(a));0>a&&Ba(a,">= 0",M,"width");this.fa=a}},height:{configurable:!0,get:function(){return this.ea}, set:function(a){G&&(A(a,"number",M,"height"),this.ha(a));0>a&&Ba(a,">= 0",M,"height");this.ea=a}},left:{configurable:!0,get:function(){return this.I},set:function(a){G&&(A(a,"number",M,"left"),this.ha(a));this.I=a}},top:{configurable:!0,get:function(){return this.J},set:function(a){G&&(A(a,"number",M,"top"),this.ha(a));this.J=a}},right:{configurable:!0,get:function(){return this.I+this.fa},set:function(a){G&&(C(a,M,"right"),this.ha(a));this.I+=a-(this.I+this.fa)}}, bottom:{configurable:!0,get:function(){return this.J+this.ea},set:function(a){G&&(C(a,M,"top"),this.ha(a));this.J+=a-(this.J+this.ea)}},position:{configurable:!0,get:function(){return new J(this.I,this.J)},set:function(a){G&&(w(a,J,M,"position"),this.ha(a));this.I=a.x;this.J=a.y}},size:{configurable:!0,get:function(){return new Db(this.fa,this.ea)},set:function(a){G&&(w(a,Db,M,"size"),this.ha(a));this.fa=a.width;this.ea=a.height}},center:{configurable:!0, enumerable:!0,get:function(){return new J(this.I+this.fa/2,this.J+this.ea/2)},set:function(a){G&&(w(a,J,M,"center"),this.ha(a));this.I=a.x-this.fa/2;this.J=a.y-this.ea/2}},centerX:{configurable:!0,get:function(){return this.I+this.fa/2},set:function(a){G&&(C(a,M,"centerX"),this.ha(a));this.I=a-this.fa/2}},centerY:{configurable:!0,get:function(){return this.J+this.ea/2},set:function(a){G&&(C(a,M,"centerY"),this.ha(a));this.J=a-this.ea/2}}});M.prototype.isEmpty=M.prototype.JA; M.prototype.isReal=M.prototype.s;M.intersectsLineSegment=function(a,b,c,d,e,f,g,h){G&&(C(a,M,"intersectsLineSegment:x"),C(b,M,"intersectsLineSegment:y"),C(c,M,"intersectsLineSegment:w"),C(d,M,"intersectsLineSegment:h"),C(e,M,"intersectsLineSegment:p1x"),C(f,M,"intersectsLineSegment:p1y"),C(g,M,"intersectsLineSegment:p2x"),C(h,M,"intersectsLineSegment:p2y"),(0>c||0>d)&&v("Rect.intersectsLineSegment: width and height cannot be negative"));return K.Jy(a,b,c,d,e,f,g,h)};M.prototype.setSpot=M.prototype.zj; M.prototype.union=M.prototype.Tw;M.prototype.unionRect=M.prototype.Yc;M.prototype.unionPoint=M.prototype.Ze;M.prototype.intersects=M.prototype.kw;M.prototype.intersectsRect=M.prototype.Tc;M.prototype.intersect=M.prototype.jw;M.prototype.intersectRect=M.prototype.Iy;M.prototype.grow=M.prototype.DA;M.prototype.subtractMargin=M.prototype.Pw;M.prototype.addMargin=M.prototype.Dq;M.prototype.inflate=M.prototype.Qc;M.prototype.offset=M.prototype.offset;M.prototype.contains=M.prototype.contains; M.prototype.containsRect=M.prototype.Te;M.prototype.containsPoint=M.prototype.ca;M.prototype.equalsApprox=M.prototype.Ya;M.prototype.equalTo=M.prototype.ij;M.prototype.equals=M.prototype.B;M.prototype.setSize=M.prototype.nB;M.prototype.setPoint=M.prototype.Xc;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.Sg;var tc=null,uc=null,pc=[];M.className="Rect";M.parse=cc;M.stringify=dc;M.contains=nc;M.intersects=oc;M.ZeroRect=tc=(new M(0,0,0,0)).ia();M.NoRect=uc=(new M(NaN,NaN,NaN,NaN)).ia(); M.parse=cc;M.stringify=dc;M.contains=nc;M.intersects=oc;function gc(a,b,c,d){void 0===a?this.Ee=this.se=this.Oe=this.Qe=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):v("Invalid arguments to Margin constructor: "+a+", "+b+", "+c+", "+d);this.u=!1}gc.prototype.assign=function(a){this.Qe=a.Qe;this.Oe=a.Oe;this.se=a.se;this.Ee=a.Ee;return this}; gc.prototype.Sg=function(a,b,c,d){G&&(A(a,"number",gc,"setTo:t"),A(b,"number",gc,"setTo:r"),A(c,"number",gc,"setTo:b"),A(d,"number",gc,"setTo:l"),this.ha());this.Qe=a;this.Oe=b;this.se=c;this.Ee=d;return this};gc.prototype.set=function(a){G&&(w(a,gc,gc,"assign:m"),this.ha());this.Qe=a.Qe;this.Oe=a.Oe;this.se=a.se;this.Ee=a.Ee;return this};gc.prototype.copy=function(){var a=new gc;a.Qe=this.Qe;a.Oe=this.Oe;a.se=this.se;a.Ee=this.Ee;return a};t=gc.prototype; t.ia=function(){this.u=!0;Object.freeze(this);return this};t.L=function(){return this.u||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(G&&this.u){var b="The Margin is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+=" to value: "+a);v(b)}}; function vc(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 gc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new gc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new gc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new gc(c,e):new gc(c,e,f,g)}return new gc} function wc(a){G&&w(a,gc);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.B=function(a){return a instanceof gc?this.Qe===a.top&&this.Oe===a.right&&this.se===a.bottom&&this.Ee===a.left:!1};t.ij=function(a,b,c,d){return this.Qe===a&&this.Oe===b&&this.se===c&&this.Ee===d}; t.Ya=function(a){return K.A(this.Qe,a.top)&&K.A(this.Oe,a.right)&&K.A(this.se,a.bottom)&&K.A(this.Ee,a.left)};t.s=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};gc.alloc=function(){var a=xc.pop();return void 0===a?new gc:a};gc.free=function(a){xc.push(a)}; na.Object.defineProperties(gc.prototype,{top:{configurable:!0,get:function(){return this.Qe},set:function(a){G&&(C(a,gc,"top"),this.ha(a));this.Qe=a}},right:{configurable:!0,get:function(){return this.Oe},set:function(a){G&&(C(a,gc,"right"),this.ha(a));this.Oe=a}},bottom:{configurable:!0,get:function(){return this.se},set:function(a){G&&(C(a,gc,"bottom"),this.ha(a));this.se=a}},left:{configurable:!0,get:function(){return this.Ee},set:function(a){G&& (C(a,gc,"left"),this.ha(a));this.Ee=a}}});gc.prototype.isReal=gc.prototype.s;gc.prototype.equalsApprox=gc.prototype.Ya;gc.prototype.equalTo=gc.prototype.ij;gc.prototype.equals=gc.prototype.B;gc.prototype.set=gc.prototype.set;gc.prototype.setTo=gc.prototype.Sg;var Ac=null,Bc=null,xc=[];gc.className="Margin";gc.parse=vc;gc.stringify=wc;gc.ZeroMargin=Ac=(new gc(0,0,0,0)).ia();gc.TwoMargin=Bc=(new gc(2,2,2,2)).ia();gc.parse=vc;gc.stringify=wc; function Eb(a,b,c,d){void 0===a?this.ge=this.fe=this.J=this.I=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.u=!1}var Cc,Dc,Ec,Fc,Ic,Jc,Kc,Lc,Mc,Nc,Pc,Qc,Rc,Sc,Tc,Uc,Vc,Wc,Xc,Zc,$c,ad,bd,cd,dd,ed,hd,id,jd,kd,ld,md,nd,od,pd,qd;Eb.prototype.assign=function(a){this.I=a.I;this.J=a.J;this.fe=a.fe;this.ge=a.ge;return this}; Eb.prototype.Sg=function(a,b,c,d){G&&(rd(a,"setTo:x"),rd(b,"setTo:y"),sd(c,"setTo:offx"),sd(d,"setTo:offy"),this.ha());this.I=a;this.J=b;this.fe=c;this.ge=d;return this};Eb.prototype.set=function(a){G&&(w(a,Eb,Eb,"set:s"),this.ha());this.I=a.I;this.J=a.J;this.fe=a.fe;this.ge=a.ge;return this};Eb.prototype.copy=function(){var a=new Eb;a.I=this.I;a.J=this.J;a.fe=this.fe;a.ge=this.ge;return a};t=Eb.prototype;t.ia=function(){this.u=!0;Object.freeze(this);return this}; t.L=function(){return this.u||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.u=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;return this};t.ha=function(a){if(G&&this.u){var b="The Spot is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+=" to value: "+a);v(b)}};function td(a,b){a.I=NaN;a.J=NaN;a.fe=b;return a}function rd(a,b){(isNaN(a)||1<a||0>a)&&Ba(a,"0 <= "+b+" <= 1",Eb,b)} function sd(a,b){(isNaN(a)||Infinity===a||-Infinity===a)&&Ba(a,"real number, not NaN or Infinity",Eb,b)} function ud(a){if("string"===typeof a){a=a.trim();if("None"===a)return Cc;if("TopLeft"===a)return Dc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return Ec;if("TopRight"===a)return Fc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return Ic;if("Center"===a)return Jc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Kc;if("BottomLeft"===a)return Lc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Mc;if("BottomRight"===a)return Nc;if("TopSide"===a)return Pc;if("LeftSide"=== a)return Qc;if("RightSide"===a)return Rc;if("BottomSide"===a)return Sc;if("TopBottomSides"===a)return Tc;if("LeftRightSides"===a)return Uc;if("TopLeftSides"===a)return Vc;if("TopRightSides"===a)return Wc;if("BottomLeftSides"===a)return Xc;if("BottomRightSides"===a)return Zc;if("NotTopSide"===a)return $c;if("NotLeftSide"===a)return ad;if("NotRightSide"===a)return bd;if("NotBottomSide"===a)return cd;if("AllSides"===a)return dd;if("Default"===a)return ed;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 Eb(c,e,f,g)}return new Eb}function vd(a){G&&w(a,Eb);return a.fb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()} t.toString=function(){return this.fb()?0===this.fe&&0===this.ge?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.B(Cc)?"None":this.B(Dc)?"TopLeft":this.B(Ec)?"Top":this.B(Fc)?"TopRight":this.B(Ic)?"Left":this.B(Jc)?"Center":this.B(Kc)?"Right":this.B(Lc)?"BottomLeft":this.B(Mc)?"Bottom":this.B(Nc)?"BottomRight":this.B(Pc)?"TopSide":this.B(Qc)?"LeftSide":this.B(Rc)?"RightSide":this.B(Sc)?"BottomSide":this.B(Tc)?"TopBottomSides":this.B(Uc)?"LeftRightSides": this.B(Vc)?"TopLeftSides":this.B(Wc)?"TopRightSides":this.B(Xc)?"BottomLeftSides":this.B(Zc)?"BottomRightSides":this.B($c)?"NotTopSide":this.B(ad)?"NotLeftSide":this.B(bd)?"NotRightSide":this.B(cd)?"NotBottomSide":this.B(dd)?"AllSides":this.B(ed)?"Default":"None"};t.B=function(a){return a instanceof Eb?(this.I===a.x||isNaN(this.I)&&isNaN(a.x))&&(this.J===a.y||isNaN(this.J)&&isNaN(a.y))&&this.fe===a.offsetX&&this.ge===a.offsetY:!1}; t.uw=function(){return new Eb(.5-(this.I-.5),.5-(this.J-.5),-this.fe,-this.ge)};t.Rf=function(a){if(!this.Vc())return!1;if(!a.Vc())if(a.B(hd))a=Qc;else if(a.B(id))a=Rc;else if(a.B(jd))a=Pc;else if(a.B(kd))a=Sc;else return!1;a=a.offsetY;return(this.ge&a)===a};t.fb=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.bc=function(){return isNaN(this.x)||isNaN(this.y)};t.Vc=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY}; t.Xq=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Jb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};Eb.alloc=function(){var a=Ad.pop();return void 0===a?new Eb:a};Eb.free=function(a){Ad.push(a)}; na.Object.defineProperties(Eb.prototype,{x:{configurable:!0,get:function(){return this.I},set:function(a){G&&(rd(a,"x"),this.ha(a));this.I=a}},y:{configurable:!0,get:function(){return this.J},set:function(a){G&&(rd(a,"y"),this.ha(a));this.J=a}},offsetX:{configurable:!0,get:function(){return this.fe},set:function(a){G&&(sd(a,"offsetX"),this.ha(a));this.fe=a}},offsetY:{configurable:!0,get:function(){return this.ge},set:function(a){G&&(sd(a,"offsetY"), this.ha(a));this.ge=a}}});Eb.prototype.isDefault=Eb.prototype.Jb;Eb.prototype.isNone=Eb.prototype.Xq;Eb.prototype.isSide=Eb.prototype.Vc;Eb.prototype.isNoSpot=Eb.prototype.bc;Eb.prototype.isSpot=Eb.prototype.fb;Eb.prototype.includesSide=Eb.prototype.Rf;Eb.prototype.opposite=Eb.prototype.uw;Eb.prototype.equals=Eb.prototype.B;Eb.prototype.set=Eb.prototype.set;Eb.prototype.setTo=Eb.prototype.Sg;var Ad=[];Eb.className="Spot";Eb.parse=ud;Eb.stringify=vd;Eb.None=Cc=td(new Eb(0,0,0,0),0).ia(); Eb.Default=ed=td(new Eb(0,0,-1,0),-1).ia();Eb.TopLeft=Dc=(new Eb(0,0,0,0)).ia();Eb.TopCenter=Ec=(new Eb(.5,0,0,0)).ia();Eb.TopRight=Fc=(new Eb(1,0,0,0)).ia();Eb.LeftCenter=Ic=(new Eb(0,.5,0,0)).ia();Eb.Center=Jc=(new Eb(.5,.5,0,0)).ia();Eb.RightCenter=Kc=(new Eb(1,.5,0,0)).ia();Eb.BottomLeft=Lc=(new Eb(0,1,0,0)).ia();Eb.BottomCenter=Mc=(new Eb(.5,1,0,0)).ia();Eb.BottomRight=Nc=(new Eb(1,1,0,0)).ia();Eb.MiddleTop=ld=Ec;Eb.MiddleLeft=md=Ic;Eb.MiddleRight=nd=Kc;Eb.MiddleBottom=od=Mc;Eb.Top=jd=Ec; Eb.Left=hd=Ic;Eb.Right=id=Kc;Eb.Bottom=kd=Mc;Eb.TopSide=Pc=td(new Eb(0,0,1,1),1).ia();Eb.LeftSide=Qc=td(new Eb(0,0,1,2),1).ia();Eb.RightSide=Rc=td(new Eb(0,0,1,4),1).ia();Eb.BottomSide=Sc=td(new Eb(0,0,1,8),1).ia();Eb.TopBottomSides=Tc=td(new Eb(0,0,1,9),1).ia();Eb.LeftRightSides=Uc=td(new Eb(0,0,1,6),1).ia();Eb.TopLeftSides=Vc=td(new Eb(0,0,1,3),1).ia();Eb.TopRightSides=Wc=td(new Eb(0,0,1,5),1).ia();Eb.BottomLeftSides=Xc=td(new Eb(0,0,1,10),1).ia();Eb.BottomRightSides=Zc=td(new Eb(0,0,1,12),1).ia(); Eb.NotTopSide=$c=td(new Eb(0,0,1,14),1).ia();Eb.NotLeftSide=ad=td(new Eb(0,0,1,13),1).ia();Eb.NotRightSide=bd=td(new Eb(0,0,1,11),1).ia();Eb.NotBottomSide=cd=td(new Eb(0,0,1,7),1).ia();Eb.AllSides=dd=td(new Eb(0,0,1,15),1).ia();pd=(new Eb(.156,.156)).ia();qd=(new Eb(.844,.844)).ia();Eb.parse=ud;Eb.stringify=vd;function Fb(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0} Fb.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};Fb.prototype.setTransform=function(a,b,c,d,e,f){this.m11=a;this.m12=b;this.m21=c;this.m22=d;this.dx=e;this.dy=f;return this};Fb.prototype.copy=function(){var a=new Fb;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}; Fb.prototype.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};Fb.prototype.B=function(a){return this.m11===a.m11&&this.m12===a.m12&&this.m21===a.m21&&this.m22===a.m22&&this.dx===a.dx&&this.dy===a.dy};Fb.prototype.Zt=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22};Fb.prototype.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this}; Fb.prototype.multiply=function(a){var b=this.m11*a.m11+this.m21*a.m12,c=this.m12*a.m11+this.m22*a.m12,d=this.m11*a.m21+this.m21*a.m22,e=this.m12*a.m21+this.m22*a.m22;this.dx=this.m11*a.dx+this.m21*a.dy+this.dx;this.dy=this.m12*a.dx+this.m22*a.dy+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this}; Fb.prototype.rw=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}; Fb.prototype.Xt=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}; Fb.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=Fb.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.Fa=function(a){var b=a.x,c=a.y;return a.h(b*this.m11+c*this.m21+this.dx,b*this.m12+c*this.m22+this.dy)};t.Md=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=a.x,d=a.y;return a.h(c*this.m22*b+d*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx),c*-this.m12*b+d*this.m11*b+b*(this.m12*this.dx-this.m11*this.dy))}; t.gy=function(a){var b=1/(this.m11*this.m22-this.m12*this.m21),c=1.25*a.x,d=1.2*a.y;return a.h(c*this.m22*b+d*-this.m21*b+b*(this.m21*this.dy-this.m22*this.dx),c*-this.m12*b+d*this.m11*b+b*(this.m12*this.dx-this.m11*this.dy))}; t.pr=function(a){var b=a.x,c=a.y,d=b+a.width,e=c+a.height,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,r=d*f+c*h+l,q=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,r);n=Math.max(n,r);r=Math.min(p,q);p=Math.max(p,q);e=Math.min(e,c);n=Math.max(n,c);r=Math.min(r,b);p=Math.max(p,b);e=Math.min(e,f);n=Math.max(n,f);r=Math.min(r,d);p=Math.max(p,d);a.h(e,r,n-e,p-r);return a};Fb.alloc=function(){var a=Bd.pop();return void 0===a?new Fb:a}; Fb.free=function(a){Bd.push(a)};Fb.prototype.transformRect=Fb.prototype.pr;Fb.prototype.transformPoint=Fb.prototype.Fa;Fb.prototype.scale=Fb.prototype.scale;Fb.prototype.translate=Fb.prototype.translate;Fb.prototype.rotate=Fb.prototype.rotate;Fb.prototype.invert=Fb.prototype.Xt;Fb.prototype.multiplyInverted=Fb.prototype.rw;Fb.prototype.multiply=Fb.prototype.multiply;Fb.prototype.reset=Fb.prototype.reset;Fb.prototype.isIdentity=Fb.prototype.Zt;Fb.prototype.equals=Fb.prototype.B; Fb.prototype.setTransform=Fb.prototype.setTransform;Fb.prototype.set=Fb.prototype.set;var Bd=[];Fb.className="Transform";Fb.xF="54a702f3e53909c447824c6706603faf4c"; var K={xB:"7da71ca0ad381e90",Vg:(Math.sqrt(2)-1)/3*4,lx:null,sqrt:function(a){if(0>=a)return 0;var b=K.lx;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);K.lx=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},A:function(a,b){a-=b;return.5>a&&-.5<a},da:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Rb: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},Ft:function(a,b,c,d,e,f,g,h,k,l,m,n){if(K.Rb(a,b,g,h,n,c,d)&&K.Rb(a,b,g,h,n,e,f))return K.Rb(a,b,g,h,n,l,m);var p=(a+c)/2,r=(b+d)/2,q=(c+e)/2,u=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(p+q)/2;c=(r+u)/2;q=(q+e)/2;u=(u+f)/2;var y=(d+q)/2,x=(c+u)/2;return K.Ft(a, b,p,r,d,c,y,x,k,l,m,n)||K.Ft(y,x,q,u,e,f,g,h,k,l,m,n)},Gz: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},Fz:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Jb(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},zm:function(a,b,c,d,e,f,g,h,k,l){if(K.Rb(a,b,g,h,k,c,d)&&K.Rb(a,b,g,h,k,e,f))jc(l,a,b,0,0),jc(l,g,h,0,0);else{var m=(a+c)/2,n=(b+d)/2,p=(c+e)/2,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/ 2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;K.zm(a,b,m,n,d,c,q,u,k,l);K.zm(q,u,p,r,e,f,g,h,k,l)}return l},Se:function(a,b,c,d,e,f,g,h,k,l){if(K.Rb(a,b,g,h,k,c,d)&&K.Rb(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,r=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(m+p)/2;c=(n+r)/2;p=(p+e)/2;r=(r+f)/2;var q=(d+p)/2,u=(c+r)/2;K.Se(a,b,m,n,d,c,q,u,k,l);K.Se(q,u,p,r,e,f,g,h,k,l)}return l},xw:function(a,b,c,d,e,f,g,h,k,l){if(K.Rb(a,b,e,f,l,c,d))return K.Rb(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,r=(n+d)/2;return K.xw(a,b,m,n,p,r,g,h,k,l)||K.xw(p,r,c,d,e,f,g,h,k,l)},IB: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},ww:function(a,b,c,d,e,f,g,h){if(K.Rb(a,b,e,f,g,c,d))jc(h,a,b,0,0),jc(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;K.ww(a,b,k,l,m,n,g,h);K.ww(m,n,c,d,e,f,g,h)}return h},cr:function(a,b,c,d,e,f,g,h){if(K.Rb(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;K.cr(a,b,k,l,m,n,g,h);K.cr(m,n,c,d,e,f,g,h)}return h},Fq:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(K.Rb(a,b,g,h,p,c,d)&&K.Rb(a,b,g,h,p,e,f)){if(!K.Jm(a,b,g,h,k,l,m,n))return!1;p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return!1;r.h(((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/p,((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/p);return!0}var q=(a+c)/2,u=(b+d)/2,y=(c+e)/2,x=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+y)/2;c=(u+x)/2;y=(y+e)/ 2;x=(x+f)/2;var z=(d+y)/2,B=(c+x)/2,D=Infinity,F=!1,L=0,Z=0;K.Fq(a,b,q,u,d,c,z,B,k,l,m,n,p,r)&&(a=(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l),a<D&&(D=a,F=!0,L=r.x,Z=r.y));K.Fq(z,B,y,x,e,f,g,h,k,l,m,n,p,r)&&(r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<D&&(F=!0,L=r.x,Z=r.y);F&&(r.x=L,r.y=Z);return F},Gq:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(K.Rb(a,b,g,h,p,c,d)&&K.Rb(a,b,g,h,p,e,f)){p=(a-g)*(l-n)-(b-h)*(k-m);if(0===p)return r;var q=((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(q>=m)return r; if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?(k=b,a=h):(k=h,a=b),u<k||u>a)return r}else if(a<g?(k=a,a=g):k=g,q<k||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var y=(c+e)/2,x=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+y)/2;c=(u+x)/2;y=(y+e)/2;x=(x+f)/2;var z=(d+y)/2,B=(c+x)/2;r+=K.Gq(a,b,q,u,d,c,z,B,k,l,m,n,p);r+=K.Gq(z,B,y,x,e,f,g,h,k,l,m,n,p)}return r},Yh:function(a,b,c,d,e,f,g){if(K.da(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(K.da(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},Xe:function(a,b,c,d,e,f,g,h,k){if(K.A(a,c)&&K.A(b,d))return k.h(a,b),!1;if(K.da(e,g))return K.da(a,c)?(K.Yh(a,b,c,d,e,f,k),!1):K.Yh(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(K.da(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(K.da(h,g))return K.Yh(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(K.da(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 K.Yh(a,b,c,d,e,g*(e-a)+b,k)},GB:function(a,b,c,d,e){return K.Xe(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},FB: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,r=0,q=0,u=0;e<g?(p=e,r=g):(p=g,r=e);f<h?(q=e,u=g):(q=g,u= e);p=(r-p)/2+l;l=(u-q)/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},Qf:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(K.Xe(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)}K.Xe(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));K.Xe(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));K.Xe(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},EB: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},Vt:function(a,b,c){return K.Jy(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},Jy:function(a,b,c,d,e,f,g,h){var k=a+c,l=b+d;return e===g?(f<h?(g=f,f=h):g=h,a<=e&&e<=k&&g<=l&&f>=b):f===h?(e<g?(h=e,e=g):h=g,b<=f&&f<=l&&h<=k&&e>=a):nc(a,b,c,d,e,f)||nc(a,b,c,d,g,h)||K.Jm(a,b,k,b,e,f,g,h)||K.Jm(k,b,k,l,e,f,g,h)||K.Jm(k,l,a,l,e,f,g,h)||K.Jm(a,l,a,b,e,f,g,h)?!0:!1},Jm:function(a,b,c,d,e,f,g,h){return 0>=K.Cm(a,b,c,d,e,f)*K.Cm(a,b,c,d,g,h)&&0>=K.Cm(e,f,g,h,a,b)*K.Cm(e, f,g,h,c,d)},Cm: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 f},ar:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},ly: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(K.Pz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},Pz: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)]},Oq: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}, yy: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},Uz: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 K.Vz(k,0===g?a:b,l,c,0,0)},Vz: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},qe:new gb,nn:new gb,Wf:new gb,Xf:0,on:100};K.za=K.xB; function N(a){G&&1<arguments.length&&v("Geometry constructor can take at most one optional argument, the Geometry type.");cb(this);this.u=!1;void 0===a?a=N.o:G&&eb(a,N,N,"constructor:type");this.na=a;this.uc=this.lc=this.jd=this.hd=0;this.Nj=new H;this.es=this.Nj.w;this.Mr=(new M).freeze();this.xa=!0;this.vn=this.$k=null;this.wn=NaN;this.Bf=Dc;this.Cf=Nc;this.El=this.Fl=NaN;this.eg=Cd} N.prototype.copy=function(){var a=new N;a.na=this.na;a.hd=this.hd;a.jd=this.jd;a.lc=this.lc;a.uc=this.uc;for(var b=this.Nj.l,c=b.length,d=a.Nj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.es=this.es;a.Mr.assign(this.Mr);a.xa=this.xa;a.$k=this.$k;a.vn=this.vn;a.wn=this.wn;a.Bf=this.Bf.L();a.Cf=this.Cf.L();a.Fl=this.Fl;a.El=this.El;a.eg=this.eg;return a};N.prototype.ia=function(){this.freeze();Object.freeze(this);return this}; N.prototype.freeze=function(){this.u=!0;var a=this.figures;a.freeze();a=a.l;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};N.prototype.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;var a=this.figures;a.ka();a=a.l;for(var b=a.length,c=0;c<b;c++)a[c].ka();return this}; N.prototype.Ya=function(a){if(!(a instanceof N))return!1;if(this.type!==a.type)return this.type===N.j&&a.type===N.o?Dd(this,a):a.type===N.j&&this.type===N.o?Dd(a,this):!1;if(this.type===N.o){var b=this.figures.l;a=a.figures.l;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ya(a[d]))return!1;return!0}return K.A(this.startX,a.startX)&&K.A(this.startY,a.startY)&&K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)}; function Dd(a,b){return a.type!==N.j||b.type!==N.o?!1:1===b.figures.count&&(b=b.figures.M(0),1===b.segments.count&&K.A(a.startX,b.startX)&&K.A(a.startY,b.startY)&&(b=b.segments.M(0),b.type===Ed&&K.A(a.endX,b.endX)&&K.A(a.endY,b.endY)))?!0:!1}N.La=function(a){return a.toString()};N.prototype.ob=function(a){a.classType===N?this.type=a:Ea(this,a)}; N.prototype.toString=function(a){void 0===a&&(a=-1);switch(this.type){case N.j: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 N.F:var b=new M(this.startX,this.startY,0,0);b.Tw(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 N.P:b=new M(this.startX,this.startY,0,0);b.Tw(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 N.o:b="";c=this.figures.l;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()}}; N.bb=function(a){"string"!==typeof a&&za(a,"string",N,"fillPath:str");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}; N.parse=function(a,b){function c(){return u>=D-1?!0:null!==l[u+1].match(F)}function d(){u++;return l[u]}function e(a){var b=parseFloat(d()),c=parseFloat(d());y===y.toLowerCase()&&(b=B.x+b,c=B.y+c);a.h(b,c)}function f(){e(B);return B}function g(){e(z);return z}function h(){var a=x.toLowerCase();return"c"!==a&&"s"!==a&&"q"!==a&&"t"!==a?B:new J(2*B.x-z.x,2*B.y-z.y)}void 0===b&&(b=!1);"string"!==typeof a&&za(a,"string",N,"parse:str");var k=/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm; a=a.replace(/,/gm," ");a=a.replace(k,"$1 $2");a=a.replace(k,"$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(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var l=a.split(" ");for(a=0;a<l.length;a++){var m=l[a];if(null!==m.match(/(\.[0-9]*)(\.)/gm)){k=Ma();for(var n="",p=!1,r=0;r<m.length;r++){var q=m[r];"."!==q||p?"."===q?(k.push(n),n="."):n+=q:(p=!0,n+=q)}k.push(n); l.splice(a,1);for(m=0;m<k.length;m++)l.splice(a+m,0,k[m]);a+=k.length-1;Oa(k)}}var u=-1,y="",x="";k=new J(0,0);var z=new J(0,0),B=new J(0,0),D=l.length;a=Fd(null);n=m=!1;p=!0;r=null;for(var F=/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/;!(u>=D-1);)if(x=y,y=d(),""!==y)switch(y.toUpperCase()){case "X":p=!0;n=m=!1;break;case "M":r=f();null===a.mc||!0===p?(Gd(a,r.x,r.y,m,!n),p=!1):a.moveTo(r.x,r.y);for(k.assign(B);!c();)r=f(),a.lineTo(r.x,r.y);break;case "L":for(;!c();)r=f(),a.lineTo(r.x,r.y);break;case "H":for(;!c();)B= new J((y===y.toLowerCase()?B.x:0)+parseFloat(d()),B.y),a.lineTo(B.x,B.y);break;case "V":for(;!c();)B=new J(B.x,(y===y.toLowerCase()?B.y:0)+parseFloat(d())),a.lineTo(B.x,B.y);break;case "C":for(;!c();){r=new J;e(r);q=g();var L=f();Hd(a,r.x,r.y,q.x,q.y,L.x,L.y)}break;case "S":for(;!c();)r=h(),q=g(),L=f(),Hd(a,r.x,r.y,q.x,q.y,L.x,L.y);break;case "Q":for(;!c();)r=g(),q=f(),Id(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)z=r=h(),q=f(),Id(a,r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d()); q=parseFloat(d());L=parseFloat(d());var Z=parseFloat(d()),Q=parseFloat(d()),ba=Q,S=!1;c()||(ba=parseFloat(d()),c()||(S=0!==parseFloat(d())));y===y.toLowerCase()&&(L+=B.x,Z+=B.y);a.arcTo(r,q,L,Z,Q,ba,S)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),L=parseFloat(d()),Q=Z=!1,S=ba=0,ba=d(),1===ba.length?(Z=!!parseFloat(ba),Q=!!parseFloat(d()),ba=parseFloat(d())):2===ba.length?(Z=!!parseFloat(ba[0]),Q=!!parseFloat(ba[1]),ba=parseFloat(d())):(Z=!!parseFloat(ba[0]),Q= !!parseFloat(ba[1]),ba=parseFloat(ba.slice(2))),S=parseFloat(d()),y===y.toLowerCase()&&(ba=B.x+ba,S=B.y+S),B.h(ba,S),Jd(a,r,q,L,Z,Q,ba,S);break;case "Z":Nd(a);B.assign(k);break;case "F":r="";for(q=1;l[u+q];)if(null!==l[u+q].match(/[Uu]/))q++;else if(null===l[u+q].match(F))q++;else{r=l[u+q];break}r.match(/[Mm]/)?m=!0:0<a.mc.segments.length&&(a.mc.isFilled=!0);break;case "U":r="";for(q=1;l[u+q];)if(null!==l[u+q].match(/[Ff]/))q++;else if(null===l[u+q].match(F))q++;else{r=l[u+q];break}r.match(/[Mm]/)? n=!0:a.gn(!1)}k=a.Pt;Od=a;if(b)for(b=k.figures.iterator;b.next();)b.value.isFilled=!0;return k};N.Ma=function(a,b){for(var c=a.length,d=J.alloc(),e=0;e<c;e++){var f=a[e];d.x=f[0];d.y=f[1];b.Fa(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.Fa(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.Fa(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.Fa(d);f[6]=d.x;f[7]=d.y}J.free(d)};N.prototype.nw=function(){if(this.xa||this.es!==this.figures.w)return!0;for(var a=this.figures.l,b=a.length,c=0;c<b;c++)if(a[c].nw())return!0;return!1}; N.prototype.computeBounds=function(){this.xa=!1;this.vn=this.$k=null;this.wn=NaN;this.es=this.figures.w;for(var a=this.figures.l,b=a.length,c=0;c<b;c++){var d=a[c];d.xa=!1;var e=d.segments;d.it=e.w;d=e.l;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.xa=!1;g.Td=null}}a=this.Mr;a.ka();isNaN(this.Fl)||isNaN(this.El)?a.h(0,0,0,0):a.h(0,0,this.Fl,this.El);Pd(this,a,!1);jc(a,0,0,0,0);a.freeze()};N.prototype.ky=function(){var a=new M;Pd(this,a,!0);return a}; function Pd(a,b,c){switch(a.type){case N.j:case N.F:case N.P:c?b.h(a.hd,a.jd,0,0):jc(b,a.hd,a.jd,0,0);jc(b,a.lc,a.uc,0,0);break;case N.o:var d=a.figures;a=d.l;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):jc(b,f.startX,f.startY,0,0);for(var g=f.segments.l,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case Ed:case Qd:k=n.endX;l=n.endY;jc(b,k,l,0,0);break;case Rd:K.zm(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX; l=n.endY;break;case Sd:K.ww(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case de:case ee:var p=n.type===de?fe(n,f):ge(n,f,k,l),r=p.length;if(0===r){k=n.type===de?n.centerX:n.endX;l=n.type===de?n.centerY:n.endY;jc(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],K.zm(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:v("Unknown Segment type: "+n.type)}}}break;default:v("Unknown Geometry type: "+a.type)}} N.prototype.normalize=function(){this.u&&wa(this);var a=this.ky();this.offset(-a.x,-a.y);return new J(-a.x,-a.y)};N.prototype.offset=function(a,b){this.u&&wa(this);G&&(C(a,N,"offset"),C(b,N,"offset"));this.transform(1,0,0,1,a,b);return this};N.prototype.scale=function(a,b){this.u&&wa(this);G&&(C(a,N,"scale:x"),C(b,N,"scale:y"),0===a&&Ba(a,"scale must be non-zero",N,"scale:x"),0===b&&Ba(b,"scale must be non-zero",N,"scale:y"));this.transform(a,0,0,b,0,0);return this}; N.prototype.rotate=function(a,b,c){this.u&&wa(this);void 0===b&&(b=0);void 0===c&&(c=0);G&&(C(a,N,"rotate:angle"),C(b,N,"rotate:x"),C(c,N,"rotate:y"));var d=Fb.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);Fb.free(d);return this};t=N.prototype; t.transform=function(a,b,c,d,e,f){switch(this.type){case N.j:case N.F:case N.P:var g=this.hd;var h=this.jd;this.hd=g*a+h*c+e;this.jd=g*b+h*d+f;g=this.lc;h=this.uc;this.lc=g*a+h*c+e;this.uc=g*b+h*d+f;break;case N.o:for(var k=this.figures.l,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.l;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case Ed:case Qd:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Rd:g=q.point1X; h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.point2X;h=q.point2Y;q.point2X=g*a+h*c+e;q.point2Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case Sd:g=q.point1X;h=q.point1Y;q.point1X=g*a+h*c+e;q.point1Y=g*b+h*d+f;g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case de:g=q.centerX;h=q.centerY;q.centerX=g*a+h*c+e;q.centerY=g*b+h*d+f;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.startAngle+=g);0>a&&(q.startAngle=180-q.startAngle,q.sweepAngle=-q.sweepAngle); 0>d&&(q.startAngle=-q.startAngle,q.sweepAngle=-q.sweepAngle);q.radiusX*=Math.sqrt(a*a+c*c);void 0!==q.radiusY&&(q.radiusY*=Math.sqrt(b*b+d*d));break;case ee:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;if(0===q.radiusX||0===q.radiusY)break;0!==b&&(g=180*Math.atan2(b,a)/Math.PI,0>g&&(g+=360),q.xAxisRotation+=g);0>a&&(q.xAxisRotation=180-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);0>d&&(q.xAxisRotation=-q.xAxisRotation,q.isClockwiseArc=!q.isClockwiseArc);q.radiusX*=Math.sqrt(a*a+c*c); q.radiusY*=Math.sqrt(b*b+d*d);break;default:v("Unknown Segment type: "+q.type)}}}}this.xa=!0;return this}; t.ca=function(a,b){void 0===b&&(b=0);var c=this.hd,d=this.jd,e=this.lc,f=this.uc;switch(this.type){case N.j:return K.Rb(c,d,e,f,b,a.x,a.y);case N.F:var g=M.allocAt(Math.min(c,e)-b,Math.min(d,f)-b,Math.abs(e-c)+2*b,Math.abs(f-d)+2*b);a=g.ca(a);M.free(g);return a;case N.P:g=Math.min(c,e)-b;var h=Math.min(d,f)-b;c=(Math.abs(e-c)+2*b)/2;b=(Math.abs(f-d)+2*b)/2;if(0>=c||0>=b)return!1;g=a.x-(g+c);h=a.y-(h+b);return 1>=g*g/(c*c)+h*h/(b*b);case N.o:return he(this,a,b,!0,!1);default:return!1}}; function he(a,b,c,d,e){var f=b.x;b=b.y;for(var g=a.bounds.x-20,h=0,k,l,m,n,p=a.figures.l,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.ca(f,b,c))return!0;var y=u.segments;k=u.startX;l=u.startY;for(var x=k,z=l,B=y.l,D=0;D<=y.length;D++){var F=void 0;if(D!==y.length){F=B[D];var L=F.type;a=F.endX;n=F.endY}else L=Ed,a=x,n=z;switch(L){case Qd:x=ie(f,b,g,b,k,l,x,z);if(isNaN(x))return!0;h+=x;x=a;z=n;break;case Ed:k=ie(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case Rd:m=K.Gq(k,l,F.point1X, F.point1Y,F.point2X,F.point2Y,a,n,g,b,f,b,.5);h+=m;break;case Sd:m=K.Gq(k,l,(k+2*F.point1X)/3,(l+2*F.point1Y)/3,(2*F.point1X+a)/3,(2*F.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case de:case ee:L=F.type===de?fe(F,u):ge(F,u,k,l);var Z=L.length;if(0===Z){k=ie(f,b,g,b,k,l,F.type===de?F.centerX:F.endX,F.type===de?F.centerY:F.endY);if(isNaN(k))return!0;h+=k;break}F=null;for(var Q=0;Q<Z;Q++){F=L[Q];if(0===Q){m=ie(f,b,g,b,k,l,F[0],F[1]);if(isNaN(m))return!0;h+=m}m=K.Gq(F[0],F[1],F[2],F[3],F[4],F[5],F[6],F[7], g,b,f,b,.5);h+=m}null!==F&&(a=F[6],n=F[7]);break;default:v("Unknown Segment type: "+F.type)}k=a;l=n}if(0!==h)return!0;h=0}else if(u.ca(f,b,e?c:c+2))return!0}return 0!==h} function ie(a,b,c,d,e,f,g,h){if(K.Rb(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 je(a,b,c,d){a=a.figures.l;for(var e=a.length,f=0;f<e;f++)if(a[f].ca(b,c,d))return!0;return!1} t.ew=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new J);if(this.type===N.j)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,d=0===m?0:d/m,c=c[h],h=c[2*a],e=c[2*a+1],b.h(h+(c[2*a+2]-h)*d,e+(c[2*a+3]-e)*d),b;g+=m}}return b}; t.zy=function(a){0>a?a=0:1<a&&(a=1);if(this.type===N.j)return 180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI;for(var b=this.flattenedSegments,c=this.flattenedLengths,d=b.length,e=this.flattenedTotalLength*a,f=0,g=0;g<d;g++){var h=c[g],k=h.length;for(a=0;a<k;a++){var l=h[a];if(f+l>=e)return e=b[g],b=e[2*a],c=e[2*a+1],d=e[2*a+2],a=e[2*a+3],1>Math.abs(d-b)&&1>Math.abs(a-c)?0:1>Math.abs(d-b)?0<=a-c?90:270:1>Math.abs(a-c)?0<=d-b?0:180:180*Math.atan2(a-c,d-b)/Math.PI;f+=l}}return NaN}; t.fw=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===N.j)return b[0]=this.startX+a*(this.endX-this.startX),b[1]=this.startY+a*(this.endY-this.startY),b[2]=180*Math.atan2(this.endY-this.startY,this.endX-this.startX)/Math.PI,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,d=0===m?0:d/m,m=c[h],c=m[2*a],h=m[2*a+1],e=m[2*a+2],a=m[2* a+3],b[0]=c+(e-c)*d,b[1]=h+(a-h)*d,b[2]=1>Math.abs(e-c)&&1>Math.abs(a-h)?0:1>Math.abs(e-c)?0<=a-h?90:270:1>Math.abs(a-h)?0<=e-c?0:180:180*Math.atan2(a-h,e-c)/Math.PI,b;g+=m}}return b}; t.Ay=function(a){if(this.type===N.j){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)}if(c===e)return 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);g=(d-b)*(d-b)+(e-c)*(e-c);var h=J.alloc();K.Yh(b,c,d,e,f,a,h);a=h.x;f=h.y;J.free(h);return Math.sqrt(((a-b)*(a-b)+(f-c)*(f-c))/g)}}else if(this.type===N.F){g=this.startX;h=this.startY;var 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=J.alloc();e=Infinity;h=g=0;k=b.length;for(var m=l=0,n=0;n<k;n++)for(var p=b[n],r=c[n],q=p.length,u=0;u<q;u+=2){var y= p[u],x=p[u+1];if(0!==u){K.Yh(l,m,y,x,a.x,a.y,d);var z=(d.x-a.x)*(d.x-a.x)+(d.y-a.y)*(d.y-a.y);z<e&&(e=z,g=h,g+=Math.sqrt((d.x-l)*(d.x-l)+(d.y-m)*(d.y-m)));h+=r[(u-2)/2]}l=y;m=x}J.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0}; function ke(a){if(null===a.$k){var b=a.$k=[],c=a.vn=[],d=[],e=[];if(a.type===N.j)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===N.F)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===N.P){var f=new le;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new me(de);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=fe(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];K.Se(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(ne(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.l,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case Qd:4<=d.length&&(b.push(d),c.push(ne(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case Ed:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case Rd:K.Se(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY, .5,d);g=p.endX;f=p.endY;break;case Sd:K.cr(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case de:var r=fe(p,e),q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(var u=0;u<q;u++){var y=r[u];K.Se(g,f,y[2],y[3],y[4],y[5],y[6],y[7],.5,d);g=y[6];f=y[7]}break;case ee:r=ge(p,e,g,f);q=r.length;u=p.endX;y=p.endY;if(0===q){d.push(u);d.push(y);g=u;f=y;break}for(u=0;u<q;u++)y=r[u],K.Se(g,f,y[2],y[3],y[4],y[5],y[6],y[7],.5,d),g=y[6],f=y[7];break;default:v("Segment not of valid type: "+ p.type)}p.isClosed&&(d.push(h),d.push(k))}4<=d.length&&(b.push(d),c.push(ne(d)))}}}function ne(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&&(c=Math.sqrt(Ib(c,d,g,h)),b.push(c));c=g;d=h}return b}t.add=function(a){this.Nj.add(a);return this};t.hn=function(a,b,c,d,e,f,g,h){this.u&&wa(this);this.Bf=(new Eb(a,b,e,f)).freeze();this.Cf=(new Eb(c,d,g,h)).freeze();return this}; na.Object.defineProperties(N.prototype,{flattenedSegments:{configurable:!0,get:function(){ke(this);return this.$k}},flattenedLengths:{configurable:!0,get:function(){ke(this);return this.vn}},flattenedTotalLength:{configurable:!0,get:function(){var a=this.wn;if(isNaN(a)){if(this.type===N.j){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===N.F)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.wn=a}return a}},type:{configurable:!0,get:function(){return this.na},set:function(a){this.na!==a&&(G&&eb(a,N,N,"type"),this.u&&wa(this,a),this.na=a,this.xa=!0)}},startX:{configurable:!0,get:function(){return this.hd},set:function(a){this.hd!==a&&(G&&C(a,N,"startX"),this.u&&wa(this,a),this.hd=a,this.xa=!0)}},startY:{configurable:!0, get:function(){return this.jd},set:function(a){this.jd!==a&&(G&&C(a,N,"startY"),this.u&&wa(this,a),this.jd=a,this.xa=!0)}},endX:{configurable:!0,get:function(){return this.lc},set:function(a){this.lc!==a&&(G&&C(a,N,"endX"),this.u&&wa(this,a),this.lc=a,this.xa=!0)}},endY:{configurable:!0,get:function(){return this.uc},set:function(a){this.uc!==a&&(G&&C(a,N,"endY"),this.u&&wa(this,a),this.uc=a,this.xa=!0)}},figures:{configurable:!0,get:function(){return this.Nj}, set:function(a){this.Nj!==a&&(G&&w(a,H,N,"figures"),this.u&&wa(this,a),this.Nj=a,this.xa=!0)}},spot1:{configurable:!0,get:function(){return this.Bf},set:function(a){G&&w(a,Eb,N,"spot1");this.u&&wa(this,a);this.Bf=a.L()}},spot2:{configurable:!0,get:function(){return this.Cf},set:function(a){G&&w(a,Eb,N,"spot2");this.u&&wa(this,a);this.Cf=a.L()}},defaultStretch:{configurable:!0,get:function(){return this.eg},set:function(a){G&&eb(a,O,N,"stretch");this.u&&wa(this, a);this.eg=a}},bounds:{configurable:!0,get:function(){this.nw()&&this.computeBounds();return this.Mr}}});N.prototype.setSpots=N.prototype.hn;N.prototype.add=N.prototype.add;N.prototype.getFractionForPoint=N.prototype.Ay;N.prototype.getPointAndAngleAlongPath=N.prototype.fw;N.prototype.getAngleAlongPath=N.prototype.zy;N.prototype.getPointAlongPath=N.prototype.ew;N.prototype.containsPoint=N.prototype.ca;N.prototype.transform=N.prototype.transform;N.prototype.rotate=N.prototype.rotate; N.prototype.scale=N.prototype.scale;N.prototype.offset=N.prototype.offset;N.prototype.normalize=N.prototype.normalize;N.prototype.computeBoundsWithoutOrigin=N.prototype.ky;N.prototype.equalsApprox=N.prototype.Ya;N.className="Geometry";N.j=new E(N,"Line",0);N.F=new E(N,"Rectangle",1);N.P=new E(N,"Ellipse",2);N.o=new E(N,"Path",3);N.Fc="UuBbMmZzLlHhVvCcSsQqTtAaFfXx";N.className="Geometry";N.stringify=N.La;N.fillPath=N.bb;N.parse=N.parse;N.Line=N.j;N.Rectangle=N.F;N.Ellipse=N.P;N.Path=N.o; function le(a,b,c,d){cb(this);this.wx=null;this.u=!1;void 0===c&&(c=!0);this.ps=c;void 0===d&&(d=!0);this.us=d;void 0!==a?(G&&C(a,le,"sx"),this.hd=a):this.hd=0;void 0!==b?(G&&C(b,le,"sy"),this.jd=b):this.jd=0;this.hm=new H;this.it=this.hm.w;this.xa=!0}le.prototype.copy=function(){var a=new le;a.ps=this.ps;a.us=this.us;a.hd=this.hd;a.jd=this.jd;for(var b=this.hm.l,c=b.length,d=a.hm,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.it=this.it;a.xa=this.xa;a.wx=this.wx;return a};t=le.prototype; t.Ya=function(a){if(!(a instanceof le&&K.A(this.startX,a.startX)&&K.A(this.startY,a.startY)))return!1;var b=this.segments.l;a=a.segments.l;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Ya(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.l,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b}; t.freeze=function(){this.u=!0;var a=this.segments;a.freeze();var b=a.l;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ka=function(){this.u=!1;var a=this.segments;a.ka();a=a.l;for(var b=a.length,c=0;c<b;c++)a[c].ka();return this};t.nw=function(){if(this.xa)return!0;var a=this.segments;if(this.it!==a.w)return!0;a=a.l;for(var b=a.length,c=0;c<b;c++)if(a[c].xa)return!0;return!1};t.add=function(a){this.hm.add(a);return this}; t.ca=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.l,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case Qd:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case Ed:if(K.Rb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case Rd:if(K.Ft(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 Sd:if(K.xw(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case de:case ee:var n=m.type=== de?fe(m,this):ge(m,this,d,e),p=n.length,r=m.type===de?m.centerX:m.endX,q=m.type===de?m.centerY:m.endY;if(0===p){if(K.Rb(d,e,r,q,c,a,b))return!0;d=r;e=q;break}r=null;for(q=0;q<p;q++)if(r=n[q],0===q&&K.Rb(d,e,r[0],r[1],c,a,b)||K.Ft(r[0],r[1],r[2],r[3],r[4],r[5],r[6],r[7],.5,a,b,c))return!0;null!==r&&(d=r[6],e=r[7]);break;default:v("Unknown Segment type: "+m.type)}if(m.isClosed&&(d!==f||e!==g)&&K.Rb(d,e,f,g,c,a,b))return!0}return!1}; na.Object.defineProperties(le.prototype,{isFilled:{configurable:!0,get:function(){return this.ps},set:function(a){G&&A(a,"boolean",le,"isFilled");this.u&&wa(this,a);this.ps=a}},isShadowed:{configurable:!0,get:function(){return this.us},set:function(a){G&&A(a,"boolean",le,"isShadowed");this.u&&wa(this,a);this.us=a}},startX:{configurable:!0,get:function(){return this.hd},set:function(a){G&&C(a,le,"startX");this.u&&wa(this,a);this.hd=a;this.xa=!0}},startY:{configurable:!0, enumerable:!0,get:function(){return this.jd},set:function(a){G&&C(a,le,"startY");this.u&&wa(this,a);this.jd=a;this.xa=!0}},segments:{configurable:!0,get:function(){return this.hm},set:function(a){G&&w(a,H,le,"segments");this.u&&wa(this,a);this.hm=a;this.xa=!0}}});le.prototype.add=le.prototype.add;le.prototype.equalsApprox=le.prototype.Ya;le.className="PathFigure"; function me(a,b,c,d,e,f,g,h){cb(this);this.u=!1;void 0===a?a=Ed:G&&eb(a,me,me,"constructor:type");this.na=a;void 0!==b?(G&&C(b,me,"ex"),this.lc=b):this.lc=0;void 0!==c?(G&&C(c,me,"ey"),this.uc=c):this.uc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===ee?(a=f%360,0>a&&(a+=360),this.Ne=a,this.Ti=0,G&&C(d,me,"x1"),this.Ui=Math.max(d,0),G&&C(e,me,"y1"),this.yh=Math.max(e,0),this.Nl="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.el=!!h):(G&&C(d,me,"x1"),this.Ne=d, G&&C(e,me,"y1"),this.Ti=e,G&&C(f,me,"x2"),a===de&&(f=Math.max(f,0)),this.Ui=f,"number"===typeof g?(a===de&&(g=Math.max(g,0)),this.yh=g):this.yh=0,this.el=this.Nl=!1);this.Sj=!1;this.xa=!0;this.Td=null}me.prototype.copy=function(){var a=new me;a.na=this.na;a.lc=this.lc;a.uc=this.uc;a.Ne=this.Ne;a.Ti=this.Ti;a.Ui=this.Ui;a.yh=this.yh;a.Nl=this.Nl;a.el=this.el;a.Sj=this.Sj;a.xa=this.xa;return a};t=me.prototype; t.Ya=function(a){if(!(a instanceof me)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case Qd:case Ed:return K.A(this.endX,a.endX)&&K.A(this.endY,a.endY);case Rd:return K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)&&K.A(this.point1X,a.point1X)&&K.A(this.point1Y,a.point1Y)&&K.A(this.point2X,a.point2X)&&K.A(this.point2Y,a.point2Y);case Sd:return K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)&&K.A(this.point1X,a.point1X)&&K.A(this.point1Y,a.point1Y);case de:return K.A(this.startAngle, a.startAngle)&&K.A(this.sweepAngle,a.sweepAngle)&&K.A(this.centerX,a.centerX)&&K.A(this.centerY,a.centerY)&&K.A(this.radiusX,a.radiusX)&&K.A(this.radiusY,a.radiusY);case ee:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&K.A(this.xAxisRotation,a.xAxisRotation)&&K.A(this.endX,a.endX)&&K.A(this.endY,a.endY)&&K.A(this.radiusX,a.radiusX)&&K.A(this.radiusY,a.radiusY);default:return!1}};t.ob=function(a){a.classType===me?this.type=a:Ea(this,a)}; t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Qd:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Ed:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Rd: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 Sd: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 de: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 ee: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.Sj?"z":"")};t.freeze=function(){this.u=!0;return this};t.ka=function(){this.u=!1;return this};t.close=function(){this.Sj=!0;return this}; function fe(a,b){if(null!==a.Td&&!1===b.xa)return a.Td;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Td=[],a.Td;b=a.Ne;var e=a.Ti,f=K.ly(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=Fb.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);N.Ma(f,g);Fb.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.Td=f;return a.Td} function ge(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.Td&&!1===b.xa)return a.Td;if(0===a.radiusX||0===a.radiusY)return a.Td=[],a.Td;b=a.Ui;var f=a.yh;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.Ne,h=a.Nl,k=a.el,l=a.lc,m=a.uc,n=Math.cos(g),p=Math.sin(g),r=n*(c-l)/2+p*(d-m)/2;g=-p*(c-l)/2+n*(d-m)/2;var q=r*r/(b*b)+g*g/(f*f);1<q&&(b*=Math.sqrt(q),f*=Math.sqrt(q));q=(h===k?-1:1)*Math.sqrt((b*b*f*f-b*b*g*g-f*f*r*r)/ (b*b*g*g+f*f*r*r));isNaN(q)&&(q=0);h=q*b*g/f;q=q*-f*r/b;isNaN(h)&&(h=0);isNaN(q)&&(q=0);c=(c+l)/2+n*h-p*q;d=(d+m)/2+p*h+n*q;m=e(1,0,(r-h)/b,(g-q)/f);n=(r-h)/b;l=(g-q)/f;r=(-r-h)/b;h=(-g-q)/f;g=e(n,l,r,h);r=(n*r+l*h)/(Math.sqrt(n*n+l*l)*Math.sqrt(r*r+h*h));-1>=r?g=Math.PI:1<=r&&(g=0);!k&&0<g&&(g-=2*Math.PI);k&&0>g&&(g+=2*Math.PI);k=b>f?1:b/f;r=b>f?f/b:1;b=K.ly(0,0,b>f?b:f,m,m+g,!0);f=Fb.alloc();f.reset();f.translate(c,d);f.rotate(a.Ne,0,0);f.scale(k,r);N.Ma(b,f);Fb.free(f);a.Td=b;return a.Td} na.Object.defineProperties(me.prototype,{isClosed:{configurable:!0,get:function(){return this.Sj},set:function(a){this.Sj!==a&&(this.Sj=a,this.xa=!0)}},type:{configurable:!0,get:function(){return this.na},set:function(a){G&&eb(a,me,me,"type");this.u&&wa(this,a);this.na=a;this.xa=!0}},endX:{configurable:!0,get:function(){return this.lc},set:function(a){G&&C(a,me,"endX");this.u&&wa(this,a);this.lc=a;this.xa=!0}},endY:{configurable:!0,get:function(){return this.uc}, set:function(a){G&&C(a,me,"endY");this.u&&wa(this,a);this.uc=a;this.xa=!0}},point1X:{configurable:!0,get:function(){return this.Ne},set:function(a){G&&C(a,me,"point1X");this.u&&wa(this,a);this.Ne=a;this.xa=!0}},point1Y:{configurable:!0,get:function(){return this.Ti},set:function(a){G&&C(a,me,"point1Y");this.u&&wa(this,a);this.Ti=a;this.xa=!0}},point2X:{configurable:!0,get:function(){return this.Ui},set:function(a){G&&C(a,me,"point2X");this.u&&wa(this,a);this.Ui= a;this.xa=!0}},point2Y:{configurable:!0,get:function(){return this.yh},set:function(a){G&&C(a,me,"point2Y");this.u&&wa(this,a);this.yh=a;this.xa=!0}},centerX:{configurable:!0,get:function(){return this.Ne},set:function(a){G&&C(a,me,"centerX");this.u&&wa(this,a);this.Ne=a;this.xa=!0}},centerY:{configurable:!0,get:function(){return this.Ti},set:function(a){G&&C(a,me,"centerY");this.u&&wa(this,a);this.Ti=a;this.xa=!0}},radiusX:{configurable:!0, get:function(){return this.Ui},set:function(a){G&&C(a,me,"radiusX");0>a&&Ba(a,">= zero",me,"radiusX");this.u&&wa(this,a);this.Ui=a;this.xa=!0}},radiusY:{configurable:!0,get:function(){return this.yh},set:function(a){G&&C(a,me,"radiusY");0>a&&Ba(a,">= zero",me,"radiusY");this.u&&wa(this,a);this.yh=a;this.xa=!0}},startAngle:{configurable:!0,get:function(){return this.lc},set:function(a){this.lc!==a&&(this.u&&wa(this,a),G&&C(a,me,"startAngle"),a%=360,0>a&&(a+=360),this.lc= a,this.xa=!0)}},sweepAngle:{configurable:!0,get:function(){return this.uc},set:function(a){G&&C(a,me,"sweepAngle");this.u&&wa(this,a);360<a&&(a=360);-360>a&&(a=-360);this.uc=a;this.xa=!0}},isClockwiseArc:{configurable:!0,get:function(){return this.el},set:function(a){this.u&&wa(this,a);this.el=a;this.xa=!0}},isLargeArc:{configurable:!0,get:function(){return this.Nl},set:function(a){this.u&&wa(this,a);this.Nl=a;this.xa=!0}},xAxisRotation:{configurable:!0, get:function(){return this.Ne},set:function(a){G&&C(a,me,"xAxisRotation");a%=360;0>a&&(a+=360);this.u&&wa(this,a);this.Ne=a;this.xa=!0}}});me.prototype.equalsApprox=me.prototype.Ya;var Qd=new E(me,"Move",0),Ed=new E(me,"Line",1),Rd=new E(me,"Bezier",2),Sd=new E(me,"QuadraticBezier",3),de=new E(me,"Arc",4),ee=new E(me,"SvgArc",4);me.className="PathSegment";me.Move=Qd;me.Line=Ed;me.Bezier=Rd;me.QuadraticBezier=Sd;me.Arc=de;me.SvgArc=ee; function oe(){this.D=null;this.Dv=(new J(0,0)).freeze();this.Ku=(new J(0,0)).freeze();this.Er=this.Gs=0;this.Fr=1;this.Ii="";this.zt=this.Yr=!1;this.Vr=this.Hr=0;this.$g=this.hs=this.ss=!1;this.ds=null;this.vt=0;this.ud=this.ut=null}oe.prototype.copy=function(){var a=new oe;return this.clone(a)}; oe.prototype.clone=function(a){a.D=this.D;a.Dv.assign(this.viewPoint);a.Ku.assign(this.documentPoint);a.Gs=this.Gs;a.Er=this.Er;a.Fr=this.Fr;a.Ii=this.Ii;a.Yr=this.Yr;a.zt=this.zt;a.Hr=this.Hr;a.Vr=this.Vr;a.ss=this.ss;a.hs=this.hs;a.$g=this.$g;a.ds=this.ds;a.vt=this.vt;a.ut=this.ut;a.ud=this.ud;return a}; oe.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};oe.prototype.Rq=function(a,b){var c=this.diagram;if(null===c)return b;pe(c,this.event,a,b);return b}; oe.prototype.xA=function(a,b){var c=this.diagram;if(null===c)return b;pe(c,this.event,a,b);b.assign(c.uu(b));return b}; na.Object.defineProperties(oe.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){this.D=a}},viewPoint:{configurable:!0,get:function(){return this.Dv},set:function(a){w(a,J,oe,"viewPoint");this.Dv.assign(a)}},documentPoint:{configurable:!0,get:function(){return this.Ku},set:function(a){w(a,J,oe,"documentPoint");this.Ku.assign(a)}},modifiers:{configurable:!0,get:function(){return this.Gs},set:function(a){this.Gs= a}},button:{configurable:!0,get:function(){return this.Er},set:function(a){this.Er=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:{configurable:!0,get:function(){return this.Fr},set:function(a){this.Fr=a}},key:{configurable:!0,get:function(){return this.Ii},set:function(a){this.Ii=a}},down:{configurable:!0,get:function(){return this.Yr},set:function(a){this.Yr=a}},up:{configurable:!0, enumerable:!0,get:function(){return this.zt},set:function(a){this.zt=a}},clickCount:{configurable:!0,get:function(){return this.Hr},set:function(a){this.Hr=a}},delta:{configurable:!0,get:function(){return this.Vr},set:function(a){this.Vr=a}},isMultiTouch:{configurable:!0,get:function(){return this.ss},set:function(a){this.ss=a}},handled:{configurable:!0,get:function(){return this.hs},set:function(a){this.hs=a}},bubbles:{configurable:!0, get:function(){return this.$g},set:function(a){this.$g=a}},event:{configurable:!0,get:function(){return this.ds},set:function(a){this.ds=a}},isTouchEvent:{configurable:!0,get:function(){var a=ra.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=ra.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{configurable:!0,get:function(){return this.vt},set:function(a){this.vt=a}},targetDiagram:{configurable:!0, get:function(){return this.ut},set:function(a){this.ut=a}},targetObject:{configurable:!0,get:function(){return this.ud},set:function(a){this.ud=a}},control:{configurable:!0,get:function(){return 0!==(this.modifiers&1)},set:function(a){this.modifiers=a?this.modifiers|1:this.modifiers&-2}},shift:{configurable:!0,get:function(){return 0!==(this.modifiers&4)},set:function(a){this.modifiers=a?this.modifiers|4:this.modifiers&-5}},alt:{configurable:!0, get:function(){return 0!==(this.modifiers&2)},set:function(a){this.modifiers=a?this.modifiers|2:this.modifiers&-3}},meta:{configurable:!0,get:function(){return 0!==(this.modifiers&8)},set:function(a){this.modifiers=a?this.modifiers|8:this.modifiers&-9}},left:{configurable:!0,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:{configurable:!0,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:{configurable:!0,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}}});oe.prototype.getMultiTouchDocumentPoint=oe.prototype.xA;oe.prototype.getMultiTouchViewPoint=oe.prototype.Rq;oe.className="InputEvent";function qe(){this.D=null;this.ta="";this.Qs=this.rt=null}qe.prototype.copy=function(){var a=new qe;a.D=this.D;a.ta=this.ta;a.rt=this.rt;a.Qs=this.Qs;return a}; qe.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a}; na.Object.defineProperties(qe.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){this.D=a}},name:{configurable:!0,get:function(){return this.ta},set:function(a){this.ta=a}},subject:{configurable:!0,get:function(){return this.rt},set:function(a){this.rt=a}},parameter:{configurable:!0,get:function(){return this.Qs},set:function(a){this.Qs=a}}});qe.className="DiagramEvent"; function re(){this.Fn=se;this.uf=this.Fs="";this.pp=this.qp=this.xp=this.yp=this.wp=this.D=this.hc=null}re.prototype.clear=function(){this.pp=this.qp=this.xp=this.yp=this.wp=this.D=this.hc=null}; re.prototype.copy=function(){var a=new re;a.Fn=this.Fn;a.Fs=this.Fs;a.uf=this.uf;a.hc=this.hc;a.D=this.D;a.wp=this.wp;var b=this.yp;a.yp=Ga(b)&&"function"===typeof b.L?b.L():b;b=this.xp;a.xp=Ga(b)&&"function"===typeof b.L?b.L():b;b=this.qp;a.qp=Ga(b)&&"function"===typeof b.L?b.L():b;b=this.pp;a.pp=Ga(b)&&"function"===typeof b.L?b.L():b;return a};re.prototype.ob=function(a){a.classType===re?this.change=a:Ea(this,a)}; re.prototype.toString=function(){var a="";a=this.change===te?a+"* ":this.change===se?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===te?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};re.prototype.K=function(a){return a?this.oldValue:this.newValue};re.prototype.zA=function(a){return a?this.oldParam:this.newParam};re.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1}; re.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};re.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};re.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))}; na.Object.defineProperties(re.prototype,{model:{configurable:!0,get:function(){return this.hc},set:function(a){this.hc=a}},diagram:{configurable:!0,get:function(){return this.D},set:function(a){this.D=a}},change:{configurable:!0,get:function(){return this.Fn},set:function(a){G&&eb(a,re,re,"change");this.Fn=a}},modelChange:{configurable:!0,get:function(){return this.Fs},set:function(a){G&&A(a,"string",re,"modelChange");this.Fs=a}},propertyName:{configurable:!0, enumerable:!0,get:function(){return this.uf},set:function(a){G&&"string"!==typeof a&&A(a,"function",re,"propertyName");this.uf=a}},isTransactionFinished:{configurable:!0,get:function(){return this.Fn===te&&("CommittedTransaction"===this.uf||"FinishedUndo"===this.uf||"FinishedRedo"===this.uf)}},object:{configurable:!0,get:function(){return this.wp},set:function(a){this.wp=a}},oldValue:{configurable:!0,get:function(){return this.yp},set:function(a){this.yp= a}},oldParam:{configurable:!0,get:function(){return this.xp},set:function(a){this.xp=a}},newValue:{configurable:!0,get:function(){return this.qp},set:function(a){this.qp=a}},newParam:{configurable:!0,get:function(){return this.pp},set:function(a){this.pp=a}}});re.prototype.redo=re.prototype.redo;re.prototype.canRedo=re.prototype.canRedo;re.prototype.undo=re.prototype.undo;re.prototype.canUndo=re.prototype.canUndo;re.prototype.getParam=re.prototype.zA; re.prototype.getValue=re.prototype.K;re.prototype.clear=re.prototype.clear;var te=new E(re,"Transaction",-1),se=new E(re,"Property",0),ue=new E(re,"Insert",1),ve=new E(re,"Remove",2);re.className="ChangedEvent";re.Transaction=te;re.Property=se;re.Insert=ue;re.Remove=ve;function we(){this.o=(new H).freeze();this.ta="";this.j=!1} we.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.M(c);null!==d&&(b+="\n "+d.toString())}}return b};we.prototype.clear=function(){var a=this.changes;a.ka();for(var b=a.count-1;0<=b;b--){var c=a.M(b);null!==c&&c.clear()}a.clear();a.freeze()};we.prototype.canUndo=function(){return this.isComplete}; we.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.M(a);null!==b&&b.undo()}};we.prototype.canRedo=function(){return this.isComplete};we.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.M(b);null!==c&&c.redo()}}; we.prototype.iu=function(){if(this.isComplete){var a=this.changes;a.ka();for(var b=new zb,c=0;c<a.count;c++){var d=a.M(c);if(null!==d&&d.change===se&&d.object){var e=b.get(d.object);e||(e=new zb,b.set(d.object,e));var f=e.get(d.propertyName);null===f?e.set(d.propertyName,-1):(0<f&&a.Wc(f,null),e.set(d.propertyName,c))}}for(c=b=0;c<a.count;c++)d=a.M(c),null!==d&&(c>b&&a.Wc(b,d),b++);for(;a.length>b;)a.pop();a.freeze()}}; na.Object.defineProperties(we.prototype,{changes:{configurable:!0,get:function(){return this.o}},name:{configurable:!0,get:function(){return this.ta},set:function(a){this.ta=a}},isComplete:{configurable:!0,get:function(){return this.j},set:function(a){this.j=a}}});we.prototype.optimize=we.prototype.iu;we.prototype.redo=we.prototype.redo;we.prototype.canRedo=we.prototype.canRedo;we.prototype.undo=we.prototype.undo;we.prototype.canUndo=we.prototype.canUndo; we.prototype.clear=we.prototype.clear;we.className="Transaction";function Ee(){this.kv=new I;this.sd=!1;this.F=(new H).freeze();this.$d=-1;this.o=999;this.Be=!1;this.Sr=null;this.aj=0;this.j=!1;G&&(this.j=!0);this.Je=(new H).freeze();this.Wl=new H;this.Su=!0;this.Yu=this.qs=this.bv=this.av=!1} Ee.prototype.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.M(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.M(d).toString(a-1);return b}; Ee.prototype.clear=function(){var a=this.history;a.ka();for(var b=a.count-1;0<=b;b--){var c=a.M(b);null!==c&&c.clear()}a.clear();this.$d=-1;a.freeze();this.Be=!1;this.Sr=null;this.aj=0;this.Je.ka();this.Je.clear();this.Je.freeze();this.Wl.clear();this.Yu=this.qs=this.bv=this.av=!1};Ee.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=Ee.prototype;t.$x=function(a){this.kv.add(a)};t.Uy=function(a){this.kv.remove(a)}; t.Da=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Su&&(this.Su=!1,this.aj++,this.isInternalTransaction||this.Hb("StartingFirstTransaction",a,this.currentTransaction),0<this.aj&&this.aj--);this.isEnabled&&(this.Je.ka(),this.Je.add(a),this.Je.freeze(),null===this.currentTransaction?this.Wl.add(0):this.Wl.add(this.currentTransaction.changes.count));this.aj++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.Hb("StartedTransaction",a,this.currentTransaction)); return b};t.cb=function(a){void 0===a&&(a="");return Fe(this,!0,a)};t.Uf=function(){return Fe(this,!1,"")}; function Fe(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&Fa("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.isInternalTransaction||a.Hb("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.aj--,a.isEnabled)){var g=a.Je.count;0<g&&(""===c&&(c=a.Je.M(0)),a.Je.ka(),a.Je.kb(g-1),a.Je.freeze());g=a.Wl.count;0<g&&(f=a.Wl.M(g-1),a.Wl.kb(g-1))}if(d){if(b){a.qs=!1;null===e&&""!== c&&(e=a.currentTransaction);if(a.isEnabled&&null!==e){e.isComplete||(e.isComplete=!0,e.name=c);b=a.history;b.ka();for(d=b.count-1;d>a.historyIndex;d--)f=b.M(d),null!==f&&f.clear(),b.kb(d),a.qs=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.M(0),null!==f&&f.clear(),b.kb(0),a.$d--));0===d||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.$d++);b.freeze()}a.isInternalTransaction||a.Hb("CommittedTransaction",c,e)}else{a.Be=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction|| a.Hb("RolledBackTransaction",c,e),a.Be=!1}null!==e&&e.clear()}a.Sr=null;a.isPendingClear&&a.clear();a.isPendingClear=!1;a.isPendingUnmodified=!1;return!0}if(a.isEnabled&&!b&&null!==e){a=f;c=e.changes;for(e=c.count-1;e>=a;e--)b=c.M(e),null!==b&&b.undo(),c.ka(),c.kb(e);c.freeze()}return!1}Ee.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1}; Ee.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.Be=!0,this.Hb("StartingUndo","Undo",a),this.$d--,a.undo()}catch(b){Fa("undo error: "+b.toString())}finally{this.Hb("FinishedUndo","Undo",a),this.Be=!1}}};Ee.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1}; Ee.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.Be=!0,this.Hb("StartingRedo","Redo",a),this.$d++,a.redo()}catch(b){Fa("redo error: "+b.toString())}finally{this.Hb("FinishedRedo","Redo",a),this.Be=!1}}};Ee.prototype.Hb=function(a,b,c){void 0===c&&(c=null);var d=new re;d.change=te;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.Gt(d)}; Ee.prototype.iw=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Sr=b=new we);var c=a.copy();b=b.changes;b.ka();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Su&&(a=a.diagram,null!==a&&!1===a.tj||Fa("Change not within a transaction: "+c.toString()))}}; Ee.prototype.skipsEvent=function(a){if(null===a||0>a.change.value)return!0;a=a.object;if(null===a)return!1;if(void 0!==a.layer){if(a=a.layer,null!==a&&a.isTemporary)return!0}else if(a.isTemporary)return!0;return!1}; na.Object.defineProperties(Ee.prototype,{models:{configurable:!0,get:function(){return this.kv.iterator}},isEnabled:{configurable:!0,get:function(){return this.sd},set:function(a){this.sd=a}},transactionToUndo:{configurable:!0,get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.M(this.historyIndex):null}},transactionToRedo:{configurable:!0,get:function(){return this.historyIndex<this.history.count- 1?this.history.M(this.historyIndex+1):null}},isUndoingRedoing:{configurable:!0,get:function(){return this.Be}},history:{configurable:!0,get:function(){return this.F}},maxHistoryLength:{configurable:!0,get:function(){return this.o},set:function(a){this.o=a}},historyIndex:{configurable:!0,get:function(){return this.$d}},currentTransaction:{configurable:!0,get:function(){return this.Sr}},transactionLevel:{configurable:!0, get:function(){return this.aj}},isInTransaction:{configurable:!0,get:function(){return 0<this.aj}},checksTransactionLevel:{configurable:!0,get:function(){return this.j},set:function(a){this.j=a}},nestedTransactionNames:{configurable:!0,get:function(){return this.Je}},isPendingClear:{configurable:!0,get:function(){return this.av},set:function(a){this.av=a}},isPendingUnmodified:{configurable:!0,get:function(){return this.bv},set:function(a){this.bv= a}},isInternalTransaction:{configurable:!0,get:function(){return this.Yu},set:function(a){this.Yu=a}},isJustDiscarded:{configurable:!0,get:function(){return this.qs}}});Ee.prototype.handleChanged=Ee.prototype.iw;Ee.prototype.redo=Ee.prototype.redo;Ee.prototype.undo=Ee.prototype.undo;Ee.prototype.canUndo=Ee.prototype.canUndo;Ee.prototype.rollbackTransaction=Ee.prototype.Uf;Ee.prototype.commitTransaction=Ee.prototype.cb;Ee.prototype.startTransaction=Ee.prototype.Da; Ee.prototype.removeModel=Ee.prototype.Uy;Ee.prototype.addModel=Ee.prototype.$x;Ee.prototype.clear=Ee.prototype.clear;Ee.className="UndoManager";function Ge(){0<arguments.length&&Ca(Ge);cb(this);this.D=He;this.ta="";this.sd=!0;this.Fc=!1;this.kx=null;this.sz=new oe;this.Ct=-1}Ge.prototype.toString=function(){return""!==this.name?this.name+" Tool":Pa(this.constructor)};Ge.prototype.updateAdornments=function(){};Ge.prototype.canStart=function(){return this.isEnabled};Ge.prototype.doStart=function(){}; Ge.prototype.doActivate=function(){this.isActive=!0};Ge.prototype.doDeactivate=function(){this.isActive=!1};Ge.prototype.doStop=function(){};Ge.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};Ge.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};Ge.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};Ge.prototype.doMouseMove=function(){};Ge.prototype.doMouseUp=function(){this.stopTool()}; Ge.prototype.doMouseWheel=function(){};Ge.prototype.canStartMultiTouch=function(){return!0};Ge.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.Rq(0,J.allocAt(NaN,NaN)),d=b.Rq(1,J.allocAt(NaN,NaN));if(c.s()&&d.s()&&(this.doCancel(),a.Im("hasGestureZoom"))){a.ov=a.scale;var e=d.x-c.x,f=d.y-c.y;a.xv=Math.sqrt(e*e+f*f);b.bubbles=!1}J.free(c);J.free(d)}; Ge.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.Rq(0,J.allocAt(NaN,NaN)),d=b.Rq(1,J.allocAt(NaN,NaN));if(c.s()&&d.s()&&(this.doCancel(),a.Im("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.xv;e=new J((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.ov;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}J.free(c);J.free(d)}; Ge.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};Ge.prototype.doKeyUp=function(){};Ge.prototype.Da=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.Da(a)};Ge.prototype.stopTransaction=function(){var a=this.diagram;return null===this.transactionResult?a.Uf():a.cb(this.transactionResult)}; Ge.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.Gm(b.documentPoint,!1);if(null!==c)if($a?b.meta:b.control){a.V("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.V("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.V("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.V("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||($a?b.meta:b.control)||b.shift||a.clearSelection()}};Ge.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.ac(d.documentPoint,a,b);d.targetObject=a;Ie(a,d,c);return d.handled}; function Ie(a,b,c){b.handled=!1;if(null===a||a.Rg()){var d=0;b.left?d=1===b.clickCount?1:2===b.clickCount?2:1:b.right&&1===b.clickCount&&(d=3);var e="ObjectSingleClicked";if(null!==a){switch(d){case 1:e="ObjectSingleClicked";break;case 2:e="ObjectDoubleClicked";break;case 3:e="ObjectContextClicked"}0!==d&&c.V(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.V(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)}}} Ge.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.yc){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.ca(b.documentPoint)?a.ac(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.Ij){var f=a.Ij,g=f;a.Ij=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.Qg(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.Qg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Ij}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.Kb();a.skipsUndoManager=c}};Ge.prototype.doCurrentObjectChanged=function(){}; Ge.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===Je&&!b.shift||e===Ke&&b.control)){if(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===Je&&b.shift||e===Ke&&!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(Wa||Za)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&& (e*=a.scrollHorizontalLineChange/16,0<e?a.scroll(c,"left",-e):a.scroll(c,"right",e));0!==g&&a.allowVerticalScroll&&(g*=a.scrollVerticalLineChange/16,0<g?a.scroll(c,"up",-g):a.scroll(c,"down",g))}a.position.B(d)||(b.bubbles=!1)}}};Ge.prototype.standardWaitAfter=function(a,b){G&&A(a,"number",Ge,"standardWaitAfter:delay");void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.sz);this.Ct=ua(function(){c.doWaitAfter(d)},a)}; Ge.prototype.cancelWaitAfter=function(){-1!==this.Ct&&ra.clearTimeout(this.Ct);this.Ct=-1};Ge.prototype.doWaitAfter=function(){};Ge.prototype.findToolHandleAt=function(a,b){a=this.diagram.ac(a,function(a){for(;null!==a&&!(a.panel instanceof Le);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null}; Ge.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}; na.Object.defineProperties(Ge.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){a instanceof R&&(this.D=a)}},name:{configurable:!0,get:function(){return this.ta},set:function(a){A(a,"string",Ge,"name");this.ta=a}},isEnabled:{configurable:!0,get:function(){return this.sd},set:function(a){A(a,"boolean",Ge,"isEnabled");this.sd=a}},isActive:{configurable:!0,get:function(){return this.Fc},set:function(a){A(a,"boolean", Ge,"isActive");this.Fc=a}},transactionResult:{configurable:!0,get:function(){return this.kx},set:function(a){null!==a&&A(a,"string",Ge,"transactionResult");this.kx=a}}});Ge.prototype.startTransaction=Ge.prototype.Da;Ge.className="Tool";function Ua(){Ge.call(this);this.name="ToolManager";this.Gc=new H;this.Zc=new H;this.Rd=new H;this.P=this.La=850;this.o=(new Db(2,2)).ia();this.bb=5E3;this.Ma=Ke;this.F=Me;this.Rr=this.j=null;this.nk=-1}ma(Ua,Ge);Ua.prototype.initializeStandardTools=function(){}; Ua.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Le&&this.Rr===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===Ne&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===Oe){b.bubbles=!0;return}if(this.gestureBehavior===Ne)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}var c=a.undoManager;G&&c.checksTransactionLevel&&0!==c.transactionLevel&&Fa("WARNING: In ToolManager.doMouseDown: UndoManager.transactionLevel is not zero");c=this.mouseDownTools.length; for(var d=0;d<c;d++){var e=this.mouseDownTools.M(d);e.diagram=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===Ke?this.mouseWheelBehavior=Je:this.mouseWheelBehavior===Je&&(this.mouseWheelBehavior=Ke));this.doActivate();this.standardWaitAfter(this.holdDelay,b)}; Ua.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===Oe){b.bubbles=!0;return}if(this.gestureBehavior===Ne)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.M(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}Pe(this, a);a=b.event;null===a||"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function Pe(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 Le&&(b===a||b.Qg(a))||this.hideToolTip()}; Ua.prototype.doWaitAfter=function(a){var b=this.diagram;b.Ga&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.tt=!0,b.doMouseUp()))}; Ua.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.ac(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.ac(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof Le)||b!==a&&!b.Qg(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){!G||a instanceof Le||a instanceof Qe||v("showToolTip:tooltip must be an Adornment or HTMLInfo.");null!==b&&w(b,O,Ua,"showToolTip:obj");var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof Le){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?a.adornedObject=b:a.data=c.model;a.Xa();this.positionToolTip(a, b)}else a instanceof Qe&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.nk&&(ra.clearTimeout(this.nk),this.nk=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.nk=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.nk&&(ra.clearTimeout(this.nk),this.nk=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof Le?(a.remove(b),null!==this.Rr&&this.Rr.Tf(b.category),b.data=null,b.adornedObject=null):b instanceof Qe&&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.M(c);d.diagram=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){A(a,"string",Ua,"findTool:name");for(var b=this.mouseDownTools.length,c=0;c<b;c++){var d=this.mouseDownTools.M(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.M(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.M(c),d.name===a)return d;return null}; Ua.prototype.replaceTool=function(a,b){A(a,"string",Ua,"replaceTool:name");null!==b&&(w(b,Ge,Ua,"replaceTool:newtool"),b.diagram=this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.M(d);if(e.name===a)return null!==b?this.mouseDownTools.Wc(d,b):this.mouseDownTools.kb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.M(d),e.name===a)return null!==b?this.mouseMoveTools.Wc(d,b):this.mouseMoveTools.kb(d),e;c=this.mouseUpTools.length;for(d= 0;d<c;d++)if(e=this.mouseUpTools.M(d),e.name===a)return null!==b?this.mouseUpTools.Wc(d,b):this.mouseUpTools.kb(d),e;return null};Ua.prototype.gb=function(a,b,c){A(a,"string",Ua,"replaceStandardTool:name");w(c,H,Ua,"replaceStandardTool:list");null!==b&&(w(b,Ge,Ua,"replaceStandardTool:newtool"),b.name=a,b.diagram=this.diagram);this.findTool(a)?this.replaceTool(a,b):null!==b&&c.add(b)}; na.Object.defineProperties(Ua.prototype,{mouseWheelBehavior:{configurable:!0,get:function(){return this.Ma},set:function(a){eb(a,Ua,Ua,"mouseWheelBehavior");this.Ma=a}},gestureBehavior:{configurable:!0,get:function(){return this.F},set:function(a){eb(a,Ua,Ua,"gestureBehavior");this.F=a}},currentToolTip:{configurable:!0,get:function(){return this.j},set:function(a){!G||null===a||a instanceof Le||a instanceof Qe||v("ToolManager.currentToolTip must be an Adornment or HTMLInfo."); this.j=a;this.Rr=null!==a&&a instanceof Le?a.adornedPart:null}},mouseDownTools:{configurable:!0,get:function(){return this.Gc}},mouseMoveTools:{configurable:!0,get:function(){return this.Zc}},mouseUpTools:{configurable:!0,get:function(){return this.Rd}},hoverDelay:{configurable:!0,get:function(){return this.La},set:function(a){A(a,"number",Ua,"hoverDelay");this.La=a}},holdDelay:{configurable:!0,get:function(){return this.P},set:function(a){A(a, "number",Ua,"holdDelay");this.P=a}},dragSize:{configurable:!0,get:function(){return this.o},set:function(a){w(a,Db,Ua,"dragSize");this.o=a.L()}},toolTipDuration:{configurable:!0,get:function(){return this.bb},set:function(a){A(a,"number",Ua,"toolTipDuration");this.bb=a}}});Ua.prototype.replaceStandardTool=Ua.prototype.gb; var Ke=new E(Ua,"WheelScroll",0),Je=new E(Ua,"WheelZoom",1),Re=new E(Ua,"WheelNone",2),Me=new E(Ua,"GestureZoom",3),Ne=new E(Ua,"GestureCancel",4),Oe=new E(Ua,"GestureNone",5);Ua.className="ToolManager";Ua.WheelScroll=Ke;Ua.WheelZoom=Je;Ua.WheelNone=Re;Ua.GestureZoom=Me;Ua.GestureCancel=Ne;Ua.GestureNone=Oe; function Xe(){Ge.call(this);0<arguments.length&&Ca(Xe);this.name="Dragging";this.F=this.Zc=!0;this.o=this.bb=this.La=this.Ag=null;this.bo=this.Rd=!1;this.nm=new J(NaN,NaN);this.pt=new J;this.Gc=!0;this.pl=100;this.ih=[];this.tr=(new I).freeze();this.Ma=new Ye;this.Oo=null;this.P="copy";this.bi="";this.ci="no-drop"}ma(Xe,Ge); Xe.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.pl)?!1:null!==this.findDraggablePart()}; Xe.prototype.findDraggablePart=function(){var a=this.diagram;a=a.Gm(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}; Xe.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.Gm(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.V("ChangingSelection",a.selection),b=a.lastInput,($a?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.V("ChangedSelection",a.selection))}}}; Xe.prototype.doActivate=function(){var a=this.diagram;this.Oo=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(Ze=null,this.isActive=!0,this.nm.set(a.position),$e(this,a.selection),this.ih.length=0,a.animationManager.tc(),this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.su=!0,!0===a.Ve("temporaryPixelRatio")&&30<a.ey&&af(a),bf(a,this.draggedParts),this.Da("Drag"),this.startPoint=a.firstInput.documentPoint, a.isMouseCaptured=!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.bo=!1,Ze=this,cf=this.diagram,this.doSimulatedDragOut()))};function $e(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.Hk()&&1===b.count&&b.first()instanceof T?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.tk(),a.Ag=c.toolManager.findTool("Relinking"),null===a.Ag&&(a.Ag=new df,a.Ag.diagram=c)):(a.draggedLink=null,a.Ag=null))}} Xe.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};Xe.prototype.Fd=function(a){return void 0===a?new ef(Lb):this.isGridSnapEnabled?new ef(new J(Math.round(1E3*a.x)/1E3,Math.round(1E3*a.y)/1E3)):new ef(a.copy())}; Xe.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.Tg();ff(this);gf(a,this.draggedParts);this.draggedParts=this.currentPart=this.Oo=null;this.bo=this.isDragOutStarted=!1;if(0<hf.count){for(var b=hf,c=b.length,d=0;d<c;d++){var e=b.M(d);jf(e);kf(e);ff(e);e.diagram.Tg()}b.clear()}jf(this);this.nm.h(NaN,NaN);null!==cf&&(cf.currentCursor="");Ze=cf=null;kf(this);a.isMouseCaptured=!1;a.currentCursor="";a.su=!1;this.stopTransaction();lf(a,!0)}; Xe.prototype.stopTransaction=function(){var a=this.diagram,b=Ge.prototype.stopTransaction.call(this);b&&null!==a.undoManager.transactionToUndo&&a.undoManager.transactionToUndo.iu();return b};function ff(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;mf(a,b.lastInput,null);b.skipsUndoManager=c;a.ih.length=0}function nf(){var a=Ze;kf(a);of(a);var b=a.diagram;a.nm.s()&&(b.position=a.nm);b.Tg()} Xe.prototype.doCancel=function(){kf(this);of(this);var a=this.diagram;this.nm.s()&&(a.position=this.nm);this.stopTool()};Xe.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput;this.isActive&&("Esc"===b.key?this.doCancel():b.key!==a.previousInput.key&&this.doMouseMove())};Xe.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()}; function sf(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.Uf(),c.Da("Drag")):of(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Vf():c.selection;b=c.yk(b,c,!0);c=new zb;for(d=a.draggedParts.iterator;d.next();){var e= d.key;if(e.Uc()&&e.canCopy()){var f=b.K(e);null!==f&&(f.location=e.location,f.Xa(),c.add(f,a.Fd(f.location)))}}for(b=b.iterator;b.next();)d=b.value,d instanceof T&&d.canCopy()&&c.add(d,a.Fd());a.copiedParts=c;$e(a,c.Vf());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,tf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)));a.doUpdateCursor(null,!0)}}} function kf(a){var b=a.diagram;if(null!==a.copiedParts){b.mu(a.copiedParts.Vf(),!1);a.copiedParts=null;if(null!==a.draggedParts)for(var c=a.draggedParts.iterator;c.next();)c.key instanceof T&&(c.value.point=new J(0,0));a.doUpdateCursor(null,!0)}b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint} function jf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.Ag){var b=a.Ag;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.Ag=null}}function uf(a,b,c){var d=a.diagram,e=a.startPoint,f=J.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.oe(e),c);J.free(f);!0===d.Ve("temporaryPixelRatio")&&null===d.Fh&&30<d.ey&&(af(d),d.fr())} Xe.prototype.moveParts=function(a,b,c){void 0===c&&(c=!1);var d=this.diagram;null!==d&&vf(d,a,b,this.dragOptions,c)};function of(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.Uc()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof T&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.Fd());tf(d,-e.x,-e.y)}b.nd()}} function wf(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),xf(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d,!1);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=mf(a,e,d);if(!a.isActive&&null===Ze)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof yf)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===Ze)return; a.doDragOver(b,d);if(!a.isActive&&null===Ze)return}finally{c.skipsUndoManager=f,g&&c.nd()}a.Oo=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.Jt(e.viewPoint)}Xe.prototype.findDragOverObject=function(a){var b=this;return zf(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof Le||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})}; Xe.prototype.doUpdateCursor=function(a,b){var c=this.diagram;if(b||this.Oo!==a)!this.diagram.currentTool.isActive||this.mayCopy()?c.currentCursor=this.copyCursor:this.mayMove()?c.currentCursor=this.moveCursor:this.mayDragOut()&&(c.currentCursor=this.nodropCursor)}; function mf(a,b,c){var d=!1,e=a.ih.length,f=0<e?a.ih[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.ih[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.ih.length=0;if(!a.isActive&&null===Ze||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.ih.push(e),e=Af(e);e=a.ih.length;for(c=0;c<e&&(g=a.ih[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d} function Af(a){var b=a.panel;return null!==b?b:a instanceof U&&!(a instanceof yf)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function Bf(a,b,c){var d=a.Ag;if(null===d)return null;var e=a.diagram.Og(b,d.portGravity,function(a){return d.findValidLinkablePort(a,c)});a=J.alloc();var f=Infinity,g=null;for(e=e.iterator;e.next();){var h=e.value;if(null!==h.part){var k=h.ja(Jc,a);k=b.Lf(k);k<f&&(g=h,f=k)}}J.free(a);return g} function xf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.Ag;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=Bf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=Bf(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.Py&&d.V("LinkRelinked",c,d.Py),c.toPort!==d.Qy&&d.V("LinkRelinked",c,d.Qy)):Cf(e,g,f,k,h):Cf(e,null,null,null,null)}}}}Xe.prototype.doDragOver=function(){}; function Df(a,b){var c=a.diagram;a.dragsLink&&xf(a,!0);ff(a);var d=a.findDragOverObject(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;Ef(a,e,f);f=Af(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==Ze){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof V&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==Ze){a=M.alloc();for(b= c.selection.iterator;b.next();)d=b.value,d instanceof V&&Ff(c,d,a);M.free(a)}}}function Ef(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof yf||(c=a.mouseDrop,null!==c&&c(b))}function Ff(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.Te(c)&&(d=!0);a=a.cw(c,function(a){return a.part},function(a){return a instanceof T},!0,function(a){return a instanceof T},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.Nd(b)&&c.isAvoiding&&c.Za()} Xe.prototype.doDropOnto=function(){};Xe.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;this.simulatedMouseMove(b.event,b.documentPoint,b.targetDiagram)||null===this.currentPart||null===this.draggedParts||(this.mayCopy()?(sf(this,!1),bf(a,this.copiedParts),uf(this,this.copiedParts,!1),gf(a,this.copiedParts)):this.mayMove()?(kf(this),uf(this,this.draggedParts,!0)):this.mayDragOut()?(sf(this,!1),uf(this,this.copiedParts,!1)):kf(this),wf(this,a.lastInput.documentPoint))}}; Xe.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=a.lastInput;if(!this.simulatedMouseUp(b.event,b.documentPoint,b.targetDiagram)){b=!1;var c=this.mayCopy();c&&null!==this.copiedParts?(kf(this),sf(this,!0),bf(a,this.copiedParts),uf(this,this.copiedParts,!1),gf(a,this.copiedParts),null!==this.copiedParts&&(a.V("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,kf(this),this.mayMove()&&(uf(this,this.draggedParts, !0),wf(this,a.lastInput.documentPoint)));this.bo=!0;Df(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Vf():this.draggedParts.Vf();this.copiedParts=null;b&&Gf(this);a.Va();gf(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.V(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.V("ChangedSelection",a.selection)}}}; Xe.prototype.simulatedMouseMove=function(a,b,c){if(null===Ze)return!1;var d=Ze.diagram;c instanceof R||(c=null);var e=cf;c!==e&&(null!==e&&e!==d&&(e.Tg(),Ze.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),cf=c,null!==c&&c!==d&&(nf(),e=c.toolManager.findTool("Dragging"),null!==e&&(hf.contains(e)||hf.add(e),e.doSimulatedDragEnter())),this.doUpdateCursor(null,!0));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)),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.nr(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0}; Xe.prototype.simulatedMouseUp=function(a,b,c){if(null===Ze)return!1;var d=cf,e=Ze.diagram;if(null===c)return Ze.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.Tg(),Ze.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;cf=c;d=c.toolManager.findTool("Dragging");null!==d&&(nf(),hf.contains(d)||hf.add(d),d.doSimulatedDragEnter())}return c!==this.diagram?(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 J),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.nr(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=Ze,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1}; function Gf(a){if(null!==a.draggedParts)for(var b=a.draggedParts.iterator;b.next();){var c=b.key;c instanceof V&&(c=c.containingGroup,null===c||null===c.placeholder||a.draggedParts.contains(c)||c.placeholder.v())}} Xe.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||($a?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();)if(a.value.canCopy())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1}; Xe.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();)if(a.value.canCopy())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1}; Xe.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();)if(a.value.canMove())return!0;return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};Xe.prototype.computeBorder=function(a,b,c){return this.bo||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};Xe.prototype.wA=function(){return Ze}; Xe.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=Ze;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};Xe.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.tc();Hf(a);a.animationManager.tc();a=Ze;null!==a&&(a.diagram.su=!1);this.doUpdateCursor(null,!0)}};Xe.prototype.doSimulatedDragLeave=function(){var a=Ze;null!==a&&a.doSimulatedDragOut();this.doCancel()}; Xe.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.Dn=!0;var b=Ze;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;If(this,b.draggedParts.Vf(),!1,a.firstInput);uf(this,this.copiedParts,!1);wf(this,a.lastInput.documentPoint)}a.animationManager.Dn=!1}; Xe.prototype.doSimulatedDrop=function(){var a=this.diagram,b=Ze;if(null!==b){var c=b.diagram;b.bo=!0;kf(this);if(!this.mayDragIn())return;a.animationManager.Dn=!0;a.V("ChangingSelection",a.selection);this.Da("Drop");If(this,b.draggedParts.Vf(),!0,a.lastInput);uf(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));Df(this,a.lastInput.documentPoint);a.Va();b=a.selection;null!==this.copiedParts?this.transactionResult= "ExternalCopy":b=new I;this.copiedParts=null;a.doFocus();a.V("ExternalObjectsDropped",b,c);this.stopTransaction();a.V("ChangedSelection",a.selection)}a.animationManager.Dn=!1}; function If(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.yk(b,e,!0);var f=M.alloc();e=d=Infinity;for(var g=-Infinity,h=-Infinity,k=b.iterator;k.next();){var l=k.value;if(l.isVisible()){var m=l.location;l=m.x;m=m.y;isNaN(l)||isNaN(m)||(l<d&&(d=l),m<e&&(e=m),l>g&&(g=l),m>h&&(h=m))}}Infinity===d?f.h(0,0,0,0):f.h(d,e,g-d,h-e);d=f.x+f.width/2;e=f.y+f.height/2;M.free(f); f=a.pt;g=new zb;h=J.alloc();for(k=b.iterator;k.next();)l=k.value,l instanceof T&&l.canCopy()&&(m=c.K(l),null!==m&&(m.points=l.points,tf(m,f.x-d,f.y-e),m.suspendsRouting=!0,g.add(m,a.Fd())));for(b=b.iterator;b.next();)l=b.value,l.Uc()&&l.canCopy()&&(k=c.K(l),null!==k&&(l=l.location,h.h(f.x-(d-l.x),f.y-(e-l.y)),k.location=h,k.Xa(),g.add(k,a.Fd(h))));J.free(h);a.copiedParts=g;$e(a,g.Vf());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,tf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/ 2)));a.doUpdateCursor(null,!0)}}}Xe.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.su=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.Oo=null};Xe.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new J}; na.Object.defineProperties(Xe.prototype,{isCopyEnabled:{configurable:!0,get:function(){return this.Zc},set:function(a){A(a,"boolean",Xe,"isCopyEnabled");this.Zc=a}},copiesEffectiveCollection:{configurable:!0,get:function(){return this.F},set:function(a){A(a,"boolean",Xe,"copiesEffectiveCollection");this.F=a}},dragOptions:{configurable:!0,get:function(){return this.Ma},set:function(a){w(a,Ye,Xe,"dragOptions");this.Ma=a}},isGridSnapEnabled:{configurable:!0, enumerable:!0,get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){A(a,"boolean",Xe,"isGridSnapEnabled");this.dragOptions.isGridSnapEnabled=a}},isComplexRoutingRealtime:{configurable:!0,get:function(){return this.Gc},set:function(a){A(a,"boolean",Xe,"isComplexRoutingRealtime");this.Gc=a}},isGridSnapRealtime:{configurable:!0,get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){A(a,"boolean",Xe,"isGridSnapRealtime");this.dragOptions.isGridSnapRealtime= a}},gridSnapCellSize:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){w(a,Db,Xe,"gridSnapCellSize");this.dragOptions.gridSnapCellSize.B(a)||(a=a.L(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){w(a,Eb,Xe,"gridSnapCellSpot");this.dragOptions.gridSnapCellSpot.B(a)||(a=a.L(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{configurable:!0, enumerable:!0,get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){w(a,J,Xe,"gridSnapOrigin");this.dragOptions.gridSnapOrigin.B(a)||(a=a.L(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{configurable:!0,get:function(){return this.dragOptions.dragsLink},set:function(a){A(a,"boolean",Xe,"dragsLink");this.dragOptions.dragsLink=a}},dragsTree:{configurable:!0,get:function(){return this.dragOptions.dragsTree},set:function(a){A(a,"boolean",Xe,"dragsTree"); this.dragOptions.dragsTree=a}},copyCursor:{configurable:!0,get:function(){return this.P},set:function(a){this.P=a}},moveCursor:{configurable:!0,get:function(){return this.bi},set:function(a){this.bi=a}},nodropCursor:{configurable:!0,get:function(){return this.ci},set:function(a){this.ci=a}},currentPart:{configurable:!0,get:function(){return this.La},set:function(a){null!==a&&w(a,U,Xe,"currentPart");this.La=a}},copiedParts:{configurable:!0, get:function(){return this.o},set:function(a){this.o=a}},draggedParts:{configurable:!0,get:function(){return this.bb},set:function(a){this.bb=a}},draggingParts:{configurable:!0,get:function(){return null!==this.copiedParts?this.copiedParts.Vf():null!==this.draggedParts?this.draggedParts.Vf():this.tr}},draggedLink:{configurable:!0,get:function(){return this.diagram.draggedLink},set:function(a){null!==a&&w(a,T,Xe,"draggedLink");this.diagram.draggedLink=a}}, isDragOutStarted:{configurable:!0,get:function(){return this.Rd},set:function(a){this.Rd=a}},startPoint:{configurable:!0,get:function(){return this.pt},set:function(a){w(a,J,Xe,"startPoint");this.pt.B(a)||this.pt.assign(a)}},delay:{configurable:!0,get:function(){return this.pl},set:function(a){A(a,"number",Xe,"delay");this.pl=a}}});Xe.prototype.getDraggingSource=Xe.prototype.wA;var hf=null,Ze=null,cf=null;Xe.className="DraggingTool";hf=new H; Ta("draggingTool",function(){return this.findTool("Dragging")},function(a){this.gb("Dragging",a,this.mouseMoveTools)});Ua.prototype.doCancel=function(){null!==Ze&&Ze.doCancel();Ge.prototype.doCancel.call(this)}; function Jf(){0<arguments.length&&Ca(Jf);Ge.call(this);this.ci=100;this.Ma=!1;this.ui="pointer";var a=new T,b=new Kf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new Kf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.ix=a;a=new V;b=new Kf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Rb;a.add(b);a.selectable=!1;a.layerName="Tool";this.hx=a;this.j=b;a=new V;b=new Kf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke= "magenta";b.strokeWidth=2;b.desiredSize=Rb;a.add(b);a.selectable=!1;a.layerName="Tool";this.jx=a;this.o=b;this.bi=this.Rd=this.Gc=this.bb=this.Zc=null;this.La=!0;this.hz=new zb;this.tr=this.Ni=this.gx=null}ma(Jf,Ge);Jf.prototype.doStop=function(){this.diagram.Tg();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null}; Jf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Of(),g=Db.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;Db.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=Jc;f=J.alloc();c.location=b.ja(Jc,f);J.free(f);d.angle=b.oj();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}}; Jf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Rb,b.fromSpot=Cc,b.toSpot=Cc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Jf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()}; Jf.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof V){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.Jt(a.lastInput.viewPoint)}};Jf.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof V))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof V)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null}; Jf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.Og(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 V){var k=g.ja(Jc,J.alloc()),l=c.x-k.x,m=c.y-k.y;J.free(k);k=l*l+m*m;k<d&&(l=this.validPortsCache.K(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 V&&(null===c.layer||c.layer.allowLink))?b:null}; Jf.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.Nq(b).count>=c)return!1}return!0}; Jf.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.Ld(b).count>=c)return!1}return!0}; Jf.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};Jf.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof V))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof V))return!1;b=b.portId;null===b&&(b="");for(b=d.Ld(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1}; Jf.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};Jf.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 I;d.add(a);return Lf(this,c,b,d)}; function Lf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Lf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Lf(a,b.labeledLink,c,d))?!0:!1} Jf.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!==Mf){if(d===Nf){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!Of(this,a,b,c,!0)}if(d===Pf){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!Of(this,a,b,c,!0)}if(d===Tf)return a===b?a=!0:(d=new I,d.add(b),a=Uf(this,d,a,b,c)),!a;if(d===Vf)return!Of(this,a,b,c,!1);if(d===Wf)return a===b?a=!0:(d=new I,d.add(b),a=Xf(this,d,a,b,c)),!a}return!0};function Of(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&&Of(a,g,c,d,e)))return!0}return!1} function Uf(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&&Uf(a,b,g,d,e)))return!0}return!1}function Xf(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&&Xf(a,b,h,d,e))return!0}}return!1} na.Object.defineProperties(Jf.prototype,{portGravity:{configurable:!0,get:function(){return this.ci},set:function(a){A(a,"number",Jf,"portGravity");0<=a&&(this.ci=a)}},isUnconnectedLinkValid:{configurable:!0,get:function(){return this.Ma},set:function(a){A(a,"boolean",Jf,"isUnconnectedLinkValid");this.Ma=a}},linkingCursor:{configurable:!0,get:function(){return this.ui},set:function(a){this.ui=a}},temporaryLink:{configurable:!0,get:function(){return this.ix}, set:function(a){w(a,T,Jf,"temporaryLink");this.ix=a}},temporaryFromNode:{configurable:!0,get:function(){return this.hx},set:function(a){w(a,V,Jf,"temporaryFromNode");if(this.hx=a)this.j=a.port}},temporaryFromPort:{configurable:!0,get:function(){return this.j},set:function(a){w(a,O,Jf,"temporaryFromPort");if(null!==this.j){var b=this.j.panel;if(null!==b){var c=b.$.indexOf(this.j);b.kb(c);b.zb(c,a)}}this.j=a}},temporaryToNode:{configurable:!0,get:function(){return this.jx}, set:function(a){w(a,V,Jf,"temporaryToNode");if(this.jx=a)this.o=a.port}},temporaryToPort:{configurable:!0,get:function(){return this.o},set:function(a){w(a,O,Jf,"temporaryToPort");if(null!==this.o){var b=this.o.panel;if(null!==b){var c=b.$.indexOf(this.o);b.kb(c);b.zb(c,a)}}this.o=a}},originalLink:{configurable:!0,get:function(){return this.Zc},set:function(a){null!==a&&w(a,T,Jf,"originalLink");this.Zc=a}},originalFromNode:{configurable:!0,get:function(){return this.bb}, set:function(a){null!==a&&w(a,V,Jf,"originalFromNode");this.bb=a}},originalFromPort:{configurable:!0,get:function(){return this.Gc},set:function(a){null!==a&&w(a,O,Jf,"originalFromPort");this.Gc=a}},originalToNode:{configurable:!0,get:function(){return this.Rd},set:function(a){null!==a&&w(a,V,Jf,"originalToNode");this.Rd=a}},originalToPort:{configurable:!0,get:function(){return this.bi},set:function(a){null!==a&&w(a,O,Jf,"originalToPort");this.bi=a}},isForwards:{configurable:!0, enumerable:!0,get:function(){return this.La},set:function(a){A(a,"boolean",Jf,"isForwards");this.La=a}},validPortsCache:{configurable:!0,get:function(){return this.hz}},targetPort:{configurable:!0,get:function(){return this.gx},set:function(a){null!==a&&w(a,O,Jf,"targetPort");this.gx=a}},linkValidation:{configurable:!0,get:function(){return this.Ni},set:function(a){null!==a&&A(a,"function",Jf,"linkValidation");this.Ni=a}},portTargeted:{configurable:!0, get:function(){return this.tr},set:function(a){null!==a&&A(a,"function",Jf,"portTargeted");this.tr=a}}});Jf.className="LinkingBaseTool";function Yf(){0<arguments.length&&Ca(Yf);Jf.call(this);this.name="Linking";this.P={};this.F=null;this.N=Zf;this.pn=null}ma(Yf,Jf);Yf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.$t()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()}; Yf.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.ac(a.firstInput.documentPoint,null,null));if(null===b)return null;a=b.part;if(!(a instanceof V))return null;var c=this.direction;if(c===Zf||c===$f){var d=this.findValidLinkablePort(b,!1);if(null!==d||this.startObject===a&&(d=a.port,this.findValidLinkablePort(d,!1)))return this.isForwards=!0,d}if(c===Zf||c===ag)if(b=this.findValidLinkablePort(b,!0),null!==b||this.startObject===a&&(b=a.port,this.findValidLinkablePort(b, !0)))return this.isForwards=!1,b;return null}; Yf.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null===b?this.stopTool():(this.Da(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.s()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof V&&(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 V&&(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.Za(),a.add(this.temporaryLink)),this.isActive=!0)};Yf.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.stopTransaction()}; Yf.prototype.doStop=function(){Jf.prototype.doStop.call(this);this.startObject=null}; Yf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram,b=this.transactionResult=null,c=null,d=null,e=null,f=null;try{var g=this.targetPort=this.findTargetPort(this.isForwards);if(null!==g){var h=g.part;h instanceof V&&(this.isForwards?(null!==this.originalFromNode&&(b=this.originalFromNode,c=this.originalFromPort),d=h,e=g):(b=h,c=g,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?(f=this.insertLink(b,c,d,e),null!==f?(null===g&&(this.isForwards?f.defaultToPoint=a.lastInput.documentPoint:f.defaultFromPoint=a.lastInput.documentPoint),a.allowSelect&&(a.V("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.V("LinkDrawn",f)):this.doNoLink(b,c,d,e)):this.isForwards? this.doNoLink(this.originalFromNode,this.originalFromPort,null,null):this.doNoLink(null,null,this.originalToNode,this.originalToPort)}finally{this.stopTool(),f&&a.allowSelect&&a.V("ChangedSelection",a.selection)}}};Yf.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof T)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}; Yf.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};Yf.prototype.doNoLink=function(){}; na.Object.defineProperties(Yf.prototype,{archetypeLinkData:{configurable:!0,get:function(){return this.P},set:function(a){null!==a&&A(a,"object",Yf,"archetypeLinkData");a instanceof O&&w(a,T,Yf,"archetypeLinkData");this.P=a}},archetypeLabelNodeData:{configurable:!0,get:function(){return this.F},set:function(a){null!==a&&A(a,"object",Yf,"archetypeLabelNodeData");a instanceof O&&w(a,V,Yf,"archetypeLabelNodeData");this.F=a}},direction:{configurable:!0,get:function(){return this.N}, set:function(a){eb(a,Yf,Yf,"direction");this.N=a}},startObject:{configurable:!0,get:function(){return this.pn},set:function(a){null!==a&&w(a,O,Yf,"startObject");this.pn=a}}});var Zf=new E(Yf,"Either",0),$f=new E(Yf,"ForwardsOnly",0),ag=new E(Yf,"BackwardsOnly",0);Yf.className="LinkingTool";Yf.Either=Zf;Yf.ForwardsOnly=$f;Yf.BackwardsOnly=ag; function df(){0<arguments.length&&Ca(df);Jf.call(this);this.name="Relinking";var a=new Kf;a.figure="Diamond";a.desiredSize=Tb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.P=a;a=new Kf;a.figure="Diamond";a.desiredSize=Tb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.pn=a;this.F=null;this.Mx=new M}ma(df,Jf); df.prototype.updateAdornments=function(a){if(null!==a&&a instanceof T){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.Sf()&&(c=a.Bk(b),null===c&&(c=this.makeAdornment(d,!1),a.Nh(b,c)))}null===c&&a.Tf(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.Sf()&& (c=a.Bk(b),null===c?(c=this.makeAdornment(d,!0),a.Nh(b,c)):c.v()));null===c&&a.Tf(b)}};df.prototype.makeAdornment=function(a,b){var c=new Le;c.type=W.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c}; df.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.$t()||!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}; df.prototype.doActivate=function(){var a=this.diagram;if(null===this.originalLink){var b=this.handle;null===b&&(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 Le&&c.adornedPart instanceof T))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.Da(this.name);a.isMouseCaptured=!0;a.currentCursor=this.linkingCursor; this.originalFromPort=this.originalLink.fromPort;this.originalFromNode=this.originalLink.fromNode;this.originalToPort=this.originalLink.toPort;this.originalToNode=this.originalLink.toNode;this.Mx.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Qb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&& (null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Qb),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.Za(),a.add(this.temporaryLink));this.isActive=!0}; df.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===bg||c===cg)c=dg;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}}; df.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.stopTransaction()};df.prototype.doStop=function(){Jf.prototype.doStop.call(this);this.handle=null}; df.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;try{this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof V&&(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.Za()),this.transactionResult=this.name,a.V("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.Wq(this.Mx)}finally{this.stopTool()}}}; df.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};df.prototype.doNoRelink=function(){}; function Cf(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)} na.Object.defineProperties(df.prototype,{fromHandleArchetype:{configurable:!0,get:function(){return this.P},set:function(a){null!==a&&w(a,O,df,"fromHandleArchetype");this.P=a}},toHandleArchetype:{configurable:!0,get:function(){return this.pn},set:function(a){null!==a&&w(a,O,df,"toHandleArchetype");this.pn=a}},handle:{configurable:!0,get:function(){return this.F},set:function(a){if(null!==a&&(w(a,O,df,"handle"),!(a.part instanceof Le)))throw Error("new handle is not in an Adornment: "+ a);this.F=a}}});df.className="RelinkingTool";Ta("linkingTool",function(){return this.findTool("Linking")},function(a){this.gb("Linking",a,this.mouseMoveTools)});Ta("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.gb("Relinking",a,this.mouseDownTools)}); function eg(){0<arguments.length&&Ca(eg);Ge.call(this);this.name="LinkReshaping";var a=new Kf;a.figure="Rectangle";a.desiredSize=Sb;a.fill="lightblue";a.stroke="dodgerblue";this.o=a;a=new Kf;a.figure="Diamond";a.desiredSize=Tb;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.F=a;this.P=3;this.yu=this.j=null;this.Nx=new J;this.Ps=new H}ma(eg,Ge);eg.prototype.gw=function(a){return a&&a.Vs&&0!==a.Vs.value?a.Vs:fg}; eg.prototype.fn=function(a,b){w(a,O,eg,"setReshapingBehavior:obj");eb(b,eg,eg,"setReshapingBehavior:behavior");a.Vs=b}; eg.prototype.updateAdornments=function(a){if(null!==a&&a instanceof T){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.Sf()&&(b=a.Bk(this.name),null===b||b.Jx!==a.pointsCount||b.Xx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.Jx=a.pointsCount,b.Xx=a.resegmentable,a.Nh(this.name,b)))}null===b&&a.Tf(this.name)}}; eg.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new Le;e.type=W.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==gg)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);K.A(k.x,l.x)&& K.A(k.y,l.y)&&(l=b.i(c-1));K.A(k.x,l.x)?(this.fn(h,hg),h.cursor="n-resize"):K.A(k.y,l.y)&&(this.fn(h,ig),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),K.A(k.x,l.x)&&K.A(k.y,l.y)&&(k=b.i(f+1)),K.A(k.x,l.x)?(this.fn(h,hg),h.cursor="n-resize"):K.A(k.y,l.y)&&(this.fn(h,ig),h.cursor="w-resize")):g!==f&&(this.fn(h,jg),h.cursor="move");e.add(h)}e.adornedObject=a}return e};eg.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()}; eg.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};eg.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}; eg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null!==this.handle){var b=this.handle.part.adornedPart;if(b instanceof T){this.yu=b;a.isMouseCaptured=!0;this.Da(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.zb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.zb(this.handle.segmentIndex+1,d);b.points=c;b.Qb();b.updateAdornments(); this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.Nx=b.i(this.handle.segmentIndex);this.Ps=b.points.copy();this.isActive=!0}}};eg.prototype.doDeactivate=function(){this.stopTransaction();this.yu=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};eg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Ps);this.stopTool()};eg.prototype.getResegmentingPoint=function(){return this.handle.ja(Jc)}; eg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))}; eg.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&&(kg(this,g,d,e,f,!0)||kg(this,g,d,e,f,!1))){var h=b.points.copy();kg(this,g,d, e,f,!0)?(h.Wc(c-2,new J(g.x,(f.y+g.y)/2)),h.Wc(c+1,new J(f.x,(f.y+g.y)/2))):(h.Wc(c-2,new J((f.x+g.x)/2,g.y)),h.Wc(c+1,new J((f.x+g.x)/2,f.y)));h.kb(c);h.kb(c-1);b.points=h;b.Qb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(kg(this,d,e,f,g,!0)||kg(this,d,e,f,g,!1))&&(h=b.points.copy(),kg(this,d,e,f,g,!0)?(h.Wc(c-1,new J(d.x,(d.y+g.y)/2)),h.Wc(c+2,new J(g.x,(d.y+g.y)/2))):(h.Wc(c-1,new J((d.x+g.x)/2,d.y)),h.Wc(c+2,new J((d.x+g.x)/2,g.y))), h.kb(c+1),h.kb(c),b.points=h,b.Qb())}}else g=J.alloc(),K.Yh(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Lf(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.kb(c),b.points=d,b.Qb()),J.free(g)}a.Va();this.transactionResult=this.name;a.V("LinkReshaped",this.adornedLink,this.Ps)}this.stopTool()}; function kg(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} eg.prototype.reshape=function(a){var b=this.adornedLink;b.ai();var c=this.handle.segmentIndex,d=this.gw(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===hg?(b.O(c,b.i(c-1).x,a.y),b.O(c+1,b.i(c+2).x,a.y)):d===ig&&(b.O(c,a.x,b.i(c-1).y),b.O(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===hg?(b.O(c-1,b.i(c-2).x,a.y),b.O(c,b.i(c+1).x,a.y)):d===ig&&(b.O(c-1,a.x,b.i(c-2).y),b.O(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);K.A(f.x, e.x)&&K.A(e.y,g.y)?(K.A(f.x,b.i(d-2).x)&&!K.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.O(d-1,a.x,f.y),K.A(g.y,b.i(d+2).y)&&!K.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.O(d+1,g.x,a.y)):K.A(f.y,e.y)&&K.A(e.x,g.x)?(K.A(f.y,b.i(d-2).y)&&!K.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.O(d-1,f.x,a.y),K.A(g.x,b.i(d+2).x)&&!K.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.O(d+1,a.x,g.y)):K.A(f.x,e.x)&&K.A(e.x,g.x)?(K.A(f.x,b.i(d-2).x)&&!K.A(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.O(d-1,a.x,f.y),K.A(g.x,b.i(d+2).x)&& !K.A(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.O(d+1,a.x,g.y)):K.A(f.y,e.y)&&K.A(e.y,g.y)&&(K.A(f.y,b.i(d-2).y)&&!K.A(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.O(d-1,f.x,a.y),K.A(g.y,b.i(d+2).y)&&!K.A(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.O(d+1,g.x,a.y));b.O(c,a.x,a.y)}else b.O(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).bc()&&(f=e.ja(Jc,J.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,J.alloc()),b.O(0,d.x,d.y),J.free(f), J.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).bc()&&(c=e.ja(Jc,J.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,J.alloc()),b.O(b.pointsCount-1,a.x,a.y),J.free(c),J.free(a));b.Jf()};eg.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.gw(this.handle)){case jg:return a;case hg:return new J(b.i(c).x,a.y);case ig:return new J(a.x,b.i(c).y);default:case fg:return b.i(c)}}; na.Object.defineProperties(eg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.o},set:function(a){null!==a&&w(a,O,eg,"handleArchetype");this.o=a}},midHandleArchetype:{configurable:!0,get:function(){return this.F},set:function(a){null!==a&&w(a,O,eg,"midHandleArchetype");this.F=a}},handle:{configurable:!0,get:function(){return this.j},set:function(a){if(null!==a&&(w(a,O,eg,"handle"),!(a.part instanceof Le)))throw Error("new handle is not in an Adornment: "+ a);this.j=a}},adornedLink:{configurable:!0,get:function(){return this.yu}},resegmentingDistance:{configurable:!0,get:function(){return this.P},set:function(a){A(a,"number",eg,"resegmentingDistance");this.P=a}},originalPoint:{configurable:!0,get:function(){return this.Nx}},originalPoints:{configurable:!0,get:function(){return this.Ps}}});eg.prototype.setReshapingBehavior=eg.prototype.fn;eg.prototype.getReshapingBehavior=eg.prototype.gw; var fg=new E(eg,"None",0),ig=new E(eg,"Horizontal",1),hg=new E(eg,"Vertical",2),jg=new E(eg,"All",3);eg.className="LinkReshapingTool";eg.None=fg;eg.Horizontal=ig;eg.Vertical=hg;eg.All=jg;Ta("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.gb("LinkReshaping",a,this.mouseDownTools)}); function lg(){0<arguments.length&&Ca(lg);Ge.call(this);this.name="Resizing";this.pg=(new Db(1,1)).freeze();this.og=(new Db(9999,9999)).freeze();this.ah=(new Db(NaN,NaN)).freeze();this.F=!1;this.P=!0;this.re=null;var a=new Kf;a.alignmentFocus=Jc;a.figure="Rectangle";a.desiredSize=Sb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.o=a;this.j=null;this.Os=new J;this.Lx=new Db;this.zp=new J;this.Pu=new Db(0,0);this.Ou=new Db(Infinity,Infinity);this.Nu=new Db(1,1)} ma(lg,Ge);lg.prototype.updateAdornments=function(a){if(!(null===a||a instanceof T)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.Bk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.s()&&a.isVisible()&&b.actualBounds.s()&&b.Sf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.oj();mg(a)&&this.updateResizeHandles(c,b);a.Nh(this.name,c);return}}}a.Tf(this.name)}}; lg.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new Le;b.type=W.Spot;b.locationSpot=Jc;var c=new ng;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,Dc));b.add(this.makeHandle(a,Fc));b.add(this.makeHandle(a,Nc));b.add(this.makeHandle(a,Lc));b.add(this.makeHandle(a,ld));b.add(this.makeHandle(a,nd));b.add(this.makeHandle(a,od));b.add(this.makeHandle(a,md))}else if(og(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b}; lg.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a}; lg.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Jb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.bc()&&(c=Jc);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)};lg.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}; lg.prototype.doActivate=function(){var a=this.diagram;null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));null!==this.handle&&(this.adornedObject=this.handle.part.adornedObject,null!==this.adornedObject&&(a.isMouseCaptured=!0,a.animationManager.tc(),this.Da(this.name),this.Os.set(this.adornedObject.ja(this.handle.alignment.uw())),this.zp.set(this.adornedObject.part.location),this.Lx.set(this.adornedObject.desiredSize),this.Nu=this.computeCellSize(),this.Pu= this.computeMinSize(),this.Ou=this.computeMaxSize(),this.isActive=!0))};lg.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.re=this.handle=null;this.isActive=a.isMouseCaptured=!1};lg.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()}; lg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Pu,c=this.Ou,d=this.Nu,e=this.adornedObject.Rt(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.nd();J.free(e)}}; lg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Pu,c=this.Ou,d=this.Nu,e=this.adornedObject.Rt(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);J.free(e);a.Va();this.transactionResult=this.name;a.V("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()}; lg.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Xa();c=c.ja(this.handle.alignment.uw());if(a instanceof yf){var d=new H;d.add(a);if(!this.dragsMembers&&null===a.placeholder){var e=new Ye;e.dragsMembers=!1}b.moveParts(d,this.oppositePoint.copy().oe(c),!0,e)}else a.location=a.location.copy().oe(c).add(this.oppositePoint);b.nd()}}; lg.prototype.computeResize=function(a,b,c,d,e,f){b.bc()&&(b=Jc);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=J.alloc();K.Oq(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)));J.free(p);return a};lg.prototype.computeReshape=function(){var a=pg;this.adornedObject instanceof Kf&&(a=qg(this.adornedObject));return!(a===rg||this.diagram.lastInput.shift)}; lg.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};lg.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}; lg.prototype.computeCellSize=function(){var a=new Db(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}; na.Object.defineProperties(lg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.o},set:function(a){null!==a&&w(a,O,lg,"handleArchetype");this.o=a}},handle:{configurable:!0,get:function(){return this.j},set:function(a){if(null!==a&&(w(a,O,lg,"handle"),!(a.part instanceof Le)))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedObject:{configurable:!0,get:function(){return this.re},set:function(a){if(null!==a&&(w(a,O, lg,"handle"),a.part instanceof Le))throw Error("new handle must not be in an Adornment: "+a);this.re=a}},minSize:{configurable:!0,get:function(){return this.pg},set:function(a){w(a,Db,lg,"minSize");if(!this.pg.B(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.pg.h(b,a)}}},maxSize:{configurable:!0,get:function(){return this.og},set:function(a){w(a,Db,lg,"maxSize");if(!this.og.B(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity); this.og.h(b,a)}}},cellSize:{configurable:!0,get:function(){return this.ah},set:function(a){w(a,Db,lg,"cellSize");this.ah.B(a)||this.ah.assign(a)}},isGridSnapEnabled:{configurable:!0,get:function(){return this.F},set:function(a){A(a,"boolean",lg,"isGridSnapEnabled");this.F=a}},dragsMembers:{configurable:!0,get:function(){return this.P},set:function(a){A(a,"boolean",lg,"dragsMembers");this.P=a}},oppositePoint:{configurable:!0,get:function(){return this.Os}, set:function(a){w(a,J,lg,"oppositePoint");this.Os.B(a)||this.Os.assign(a)}},originalDesiredSize:{configurable:!0,get:function(){return this.Lx}},originalLocation:{configurable:!0,get:function(){return this.zp}}});lg.className="ResizingTool";Ta("resizingTool",function(){return this.findTool("Resizing")},function(a){this.gb("Resizing",a,this.mouseDownTools)}); function Fg(){0<arguments.length&&Ca(Fg);Ge.call(this);this.name="Rotating";this.Ma=45;this.La=2;this.zp=new J;this.re=null;var a=new Kf;a.figure="Ellipse";a.desiredSize=Tb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.o=a;this.j=null;this.Kx=0;this.Ws=new J(NaN,NaN);this.F=0;this.P=50}ma(Fg,Ge); Fg.prototype.updateAdornments=function(a){if(null!==a){if(a.Xh()){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.Sf())){var c=a.Bk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.oj();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.Nh(this.name,c);return}}a.Tf(this.name)}}; Fg.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new Le;b.type=W.Position;b.locationSpot=Jc;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(og(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};Fg.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}; Fg.prototype.doActivate=function(){var a=this.diagram;if(null===this.adornedObject){null===this.handle&&(this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name));if(null===this.handle)return;this.adornedObject=this.handle.part.adornedObject}null!==this.adornedObject&&(a.isMouseCaptured=!0,a.delaysLayout=!0,this.Da(this.name),this.Kx=this.adornedObject.angle,this.Ws=this.computeRotationPoint(this.adornedObject),this.zp=this.adornedObject.part.location.copy(),this.isActive=!0)}; Fg.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.fb()?a.ja(b.rotationSpot):a===b||a===c?c.ja(b.locationSpot):a.ja(Jc)}; Fg.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.s()||(b=this.computeRotationPoint(a));b=a.Rt(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.ja(b)};Fg.prototype.doDeactivate=function(){var a=this.diagram;this.stopTransaction();this.re=this.handle=null;this.Ws=new J(NaN,NaN);this.isActive=a.isMouseCaptured=!1};Fg.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};Fg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))}; Fg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Va();this.transactionResult=this.name;a.V("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()}; Fg.prototype.rotate=function(a){G&&C(a,Fg,"rotate:newangle");var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Xa();var c=b.locationObject,d=b.rotateObject;if(c===d||c.Qg(d))c=this.zp.copy(),b.location=c.oe(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.nd()}}; Fg.prototype.computeRotate=function(a){a=this.rotationPoint.Ua(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.oj());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}; na.Object.defineProperties(Fg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.o},set:function(a){null!==a&&w(a,O,Fg,"handleArchetype");this.o=a}},handle:{configurable:!0,get:function(){return this.j},set:function(a){if(null!==a&&(w(a,O,Fg,"handle"),!(a.part instanceof Le)))throw Error("new handle is not in an Adornment: "+a);this.j=a}},adornedObject:{configurable:!0,get:function(){return this.re},set:function(a){if(null!==a&&(w(a,O, Fg,"handle"),a.part instanceof Le))throw Error("new handle must not be in an Adornment: "+a);this.re=a}},snapAngleMultiple:{configurable:!0,get:function(){return this.Ma},set:function(a){A(a,"number",Fg,"snapAngleMultiple");this.Ma=a}},snapAngleEpsilon:{configurable:!0,get:function(){return this.La},set:function(a){A(a,"number",Fg,"snapAngleEpsilon");this.La=a}},originalAngle:{configurable:!0,get:function(){return this.Kx}},rotationPoint:{configurable:!0, enumerable:!0,get:function(){return this.Ws},set:function(a){this.Ws=a.copy()}},handleAngle:{configurable:!0,get:function(){return this.F},set:function(a){A(a,"number",Fg,"handleAngle");this.F=a}},handleDistance:{configurable:!0,get:function(){return this.P},set:function(a){A(a,"number",Fg,"handleDistance");this.P=a}}});Fg.className="RotatingTool";Ta("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.gb("Rotating",a,this.mouseDownTools)}); function Gg(){Ge.call(this);0<arguments.length&&Ca(Gg);this.name="ClickSelecting"}ma(Gg,Ge);Gg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};Gg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};Gg.className="ClickSelectingTool";function Hg(){Ge.call(this);0<arguments.length&&Ca(Hg);this.name="Action";this.Wk=null} ma(Hg,Ge);Hg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.ac(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.Wk=c;a.Ij=a.ac(b.documentPoint,null,null);return!0}return!1};Hg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Wk;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()}; Hg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Wk;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};Hg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Wk;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()}; Hg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.Wk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};Hg.prototype.doStop=function(){this.Wk=null};Hg.className="ActionTool";function Ig(){Ge.call(this);0<arguments.length&&Ca(Ig);this.name="ClickCreating";this.Ej=null;this.o=!0;this.j=!1;this.Bx=new J(0,0)}ma(Ig,Ge); Ig.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.Bx=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.Bx))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.Gm(a.lastInput.documentPoint,!0)?!1:!0}; Ig.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()}; Ig.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.V("ChangingSelection",b.selection);this.Da(this.name);if(c instanceof U)c.Uc()&&(og(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);Ga(e)&&(b.model.Gf(e),d=b.Dc(e))}if(null!==d){var f=J.allocAt(a.x,a.y);this.isGridSnapEnabled&&Jg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);J.free(f)}b.Va();this.transactionResult= this.name;b.V("PartCreated",d)}finally{this.stopTransaction(),b.V("ChangedSelection",b.selection)}return d}; na.Object.defineProperties(Ig.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.Ej},set:function(a){null!==a&&A(a,"object",Ig,"archetypeNodeData");this.Ej=a}},isDoubleClick:{configurable:!0,get:function(){return this.o},set:function(a){A(a,"boolean",Ig,"isDoubleClick");this.o=a}},isGridSnapEnabled:{configurable:!0,get:function(){return this.j},set:function(a){A(a,"boolean",Ig,"isGridSnapEnabled");this.j=a}}});Ig.className="ClickCreatingTool"; function Kg(){Ge.call(this);0<arguments.length&&Ca(Kg);this.name="DragSelecting";this.pl=175;this.o=!1;var a=new U;a.layerName="Tool";a.selectable=!1;var b=new Kf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.j=a}ma(Kg,Ge); Kg.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.Gm(b.documentPoint,!0))?!1:!0};Kg.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()}; Kg.prototype.doDeactivate=function(){var a=this.diagram;a.Tg();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};Kg.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.eb("SHAPE");null===c&&(c=this.box.wb());var d=Db.alloc().h(b.width,b.height);c.desiredSize=d;this.box.dn(b.x,b.y,!1);Db.free(d);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.Jt(a.lastInput.viewPoint)}}; Kg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.V("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.V("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};Kg.prototype.computeBoxBounds=function(){var a=this.diagram;return new M(a.firstInput.documentPoint,a.lastInput.documentPoint)}; Kg.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.xy(a,this.isPartialInclusion);if($a?c.meta:c.control)if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected&&(b.isSelected=!1);else for(a=a.iterator;a.next();)b=a.value,b.isSelected=!b.isSelected;else if(c.shift)for(a=a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0);else{c=new H;for(b=b.selection.iterator;b.next();){var d=b.value;a.contains(d)||c.add(d)}for(b=c.iterator;b.next();)b.value.isSelected=!1;for(a= a.iterator;a.next();)b=a.value,b.isSelected||(b.isSelected=!0)}};na.Object.defineProperties(Kg.prototype,{delay:{configurable:!0,get:function(){return this.pl},set:function(a){A(a,"number",Kg,"delay");this.pl=a}},isPartialInclusion:{configurable:!0,get:function(){return this.o},set:function(a){A(a,"boolean",Kg,"isPartialInclusion");this.o=a}},box:{configurable:!0,get:function(){return this.j},set:function(a){null!==a&&w(a,U,Kg,"box");this.j=a}}}); Kg.className="DragSelectingTool";function Lg(){Ge.call(this);0<arguments.length&&Ca(Lg);this.name="Panning";this.pv=new J;this.rz=new J;this.$g=!1;var a=this;this.Px=function(){var b=a.diagram;null!==b&&b.removeEventListener(ra.document,"scroll",a.Px,!1);a.stopTool()}}ma(Lg,Ge);Lg.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}; Lg.prototype.doActivate=function(){var a=this.diagram;this.$g?(a.lastInput.bubbles=!0,a.addEventListener(ra.document,"scroll",this.Px,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.pv.assign(a.position));this.isActive=!0};Lg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};Lg.prototype.doCancel=function(){var a=this.diagram;a.position=this.pv;a.isMouseCaptured=!1;this.stopTool()};Lg.prototype.doMouseMove=function(){this.move()}; Lg.prototype.doMouseUp=function(){this.move();this.stopTool()};Lg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.$g)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.rz.h(e,c)}}; na.Object.defineProperties(Lg.prototype,{bubbles:{configurable:!0,get:function(){return this.$g},set:function(a){A(a,"boolean",Lg,"bubbles");this.$g=a}},originalPosition:{configurable:!0,get:function(){return this.pv}}});Lg.className="PanningTool";Ta("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.gb("ClickCreating",a,this.mouseUpTools)}); Ta("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.gb("ClickSelecting",a,this.mouseUpTools)});Ta("panningTool",function(){return this.findTool("Panning")},function(a){this.gb("Panning",a,this.mouseMoveTools)});Ta("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.gb("DragSelecting",a,this.mouseMoveTools)});Ta("actionTool",function(){return this.findTool("Action")},function(a){this.gb("Action",a,this.mouseDownTools)}); function Qe(){this.P=this.F=this.j=this.o=null} na.Object.defineProperties(Qe.prototype,{mainElement:{configurable:!0,get:function(){return this.F},set:function(a){null!==a&&w(a,HTMLElement,Qe,"mainElement");this.F=a}},show:{configurable:!0,get:function(){return this.o},set:function(a){this.o!==a&&(null!==a&&A(a,"function",Qe,"show"),this.o=a)}},hide:{configurable:!0,get:function(){return this.j},set:function(a){this.j!==a&&(null!==a&&A(a,"function",Qe,"hide"),this.j=a)}},valueFunction:{configurable:!0, enumerable:!0,get:function(){return this.P},set:function(a){this.P=a}}});Qe.className="HTMLInfo";function Mg(a,b,c){this.text=a;this.jy=b;this.visible=c}Mg.className="ContextMenuButtonInfo";function Ng(){Ge.call(this);0<arguments.length&&Ca(Ng);this.name="ContextMenu";this.o=this.Eu=this.j=null;this.Ix=new J;this.Fu=null;this.$u=!1;var a=this;this.Bv=function(){a.stopTool()}}ma(Ng,Ge); function Og(a){var b=new Qe;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Pg=b;a.Bv=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");ra.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);d=a.diagram;null!==d&&(d.addEventListener(b,"contextmenu",Qg,!1),d.addEventListener(b,"selectstart", Qg,!1),d.addEventListener(c,"contextmenu",Qg,!1));b.className="goCXforeground";c.className="goCXbackground";ra.document.body&&(ra.document.body.appendChild(b),ra.document.body.appendChild(c));Rg=b;Sg=c;Tg=!0}function Qg(a){a.preventDefault();return!1} Ng.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return this.isBeyondDragSize()||!a.lastInput.right||1<a.lastInput.clickCount?!1:a.lastInput.isTouchEvent&&null!==this.defaultTouchContextMenu||null!==this.findObjectWithContextMenu()?!0:!1};Ng.prototype.doStart=function(){this.Ix.set(this.diagram.firstInput.documentPoint)};Ng.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null}; Ng.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof R||(a instanceof O?d=a:d=b.ac(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(b.lastInput.isTouchEvent&&this.defaultTouchContextMenu)return d.part}else if(null!==b.contextMenu)return b;return null};Ng.prototype.doActivate=function(){}; Ng.prototype.doMouseDown=function(){Ge.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof Le){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&Ug(this)}; Ng.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Le){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}Ug(this)}; function Ug(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof Qe)){var d=b.ac(b.lastInput.documentPoint,null,null);null!==d&&d.Qg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(Vg(a,!0),a.isActive||a.stopTool())} function Vg(a,b,c){void 0===c&&(c=null);if(!a.$u&&(a.$u=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.$u=!1,!b)){a.isActive=!0;b=Pg;null===c&&(c=a.findObjectWithContextMenu());if(null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof O?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null);a.currentContextMenu instanceof Le&&!a.currentContextMenu.visible&&a.stopTool()}} Ng.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()}; Ng.prototype.showContextMenu=function(a,b){!G||a instanceof Le||a instanceof Qe||v("showContextMenu:contextMenu must be an Adornment or HTMLInfo.");null!==b&&w(b,O,Ng,"showContextMenu:obj");var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof Le){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?a.adornedObject=b:a.data=c.model; a.Xa();this.positionContextMenu(a,b)}else a instanceof Qe&&a.show(b,c,this);this.currentContextMenu=a};Ng.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}}; Ng.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof Le?(a.remove(b),null!==this.Eu&&this.Eu.Tf(b.category),b.data=null,b.adornedObject=null):b instanceof Qe&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())}; function Wg(a){var b=new H;b.add(new Mg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new Mg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new Mg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new Mg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)})); b.add(new Mg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new Mg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new Mg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new Mg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new Mg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()}, function(a){return a.commandHandler.canZoomToFit()}));b.add(new Mg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new Mg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new Mg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new Mg("Edit Text",function(a){a.commandHandler.editTextBlock()}, function(a){return a.commandHandler.canEditTextBlock()}));return b} Ng.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.Fu&&(this.Fu=Wg(this));Rg.innerHTML="";Sg.addEventListener("click",this.Bv,!1);var b=this,c=va("ul");c.className="goCXul";Rg.appendChild(c);c.innerHTML="";for(var d=this.Fu.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.jy&&("function"!==typeof f||f(a))){f=va("li");f.className="goCXli";var g=va("a");g.className="goCXa";g.href="#";g.kz=e.jy;g.addEventListener("click",function(c){this.kz(a);b.stopTool(); c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}Rg.style.display="block";Sg.style.display="block"};Ng.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Pg){Rg.style.display="none";Sg.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(Sg,"click",this.Bv,!1);this.currentContextMenu=null}}; na.Object.defineProperties(Ng.prototype,{currentContextMenu:{configurable:!0,get:function(){return this.j},set:function(a){!G||null===a||a instanceof Le||a instanceof Qe||v("ContextMenuTool.currentContextMenu must be an Adornment or HTMLInfo.");this.j=a;this.Eu=a instanceof Le?a.adornedPart:null}},defaultTouchContextMenu:{configurable:!0,get:function(){!1===Tg&&null===Pg&&Xg&&Og(this);return Pg},set:function(a){!G||null===a||a instanceof Le||a instanceof Qe||v("ContextMenuTool.defaultTouchContextMenu must be an Adornment or HTMLInfo."); null===a&&(Tg=!0);Pg=a}},currentObject:{configurable:!0,get:function(){return this.o},set:function(a){null!==a&&w(a,O,Ng,"currentObject");this.o=a}},mouseDownPoint:{configurable:!0,get:function(){return this.Ix}}});var Pg=null,Tg=!1,Sg=null,Rg=null;Ng.className="ContextMenuTool";Ta("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.gb("ContextMenu",a,this.mouseUpTools)}); function Yg(){0<arguments.length&&Ca(Yg);Ge.call(this);this.name="TextEditing";this.Gh=new Zg;this.Ma=null;this.La=$g;this.Zi=null;this.pa=ah;this.F=1;this.P=!0;this.o=null;this.j=new Qe;this.Ju=null;bh(this,this.j)}ma(Yg,Ge); function bh(a,b){if(Xg){var c=va("textarea");a.Ju=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.Oy(this.value);this.style.width=20+b.measuredBounds.width*this.qB+"px";this.rows=b.lineCount}},!1);c.addEventListener("keydown",function(b){if(null!==a.textBlock){var c=b.key;"Enter"===c?(!1===a.textBlock.isMultiline&&b.preventDefault(),a.acceptText(ch)):"Tab"===c?(a.acceptText(dh),b.preventDefault()):"Escape"===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus", function(){if(null!==a.currentTextEditor&&a.state!==ah){var b=a.Ju;a.pa===eh&&(a.pa=fh);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==ah){var b=a.Ju;"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 Zg&&f instanceof Yg)if(f.state===gh)c.style.border="3px solid red",c.focus();else{var d=a.ja(Jc),e=b.position,k=b.scale,l=a.Of()*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;e=a.verticalAlignment;k=(a.lineHeight+a.spacingAbove+a.spacingBelow)*a.lineCount*l;n=e.y*n-e.y*k+e.offsetY-(.5*n-.5*k)-k/2;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|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.qB=l;c.className="goTXarea";b.div.appendChild(c);c.focus();f.selectsTextOnActivate&&(c.select(),c.setSelectionRange(0,9999))}};b.hide=function(a){a.div.removeChild(c)}}} Yg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||hh&&hh!==this&&(hh.acceptText(ih),hh&&hh!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.ac(a.lastInput.documentPoint);if(!(null!==b&&b instanceof Zg&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===$g&&!b.isSelected||this.starting===jh&&2>a.lastInput.clickCount?!1:!0};Yg.prototype.doStart=function(){hh=this;null!==this.textBlock&&this.doActivate()}; Yg.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.ac(a.lastInput.documentPoint));if(null!==b&&b instanceof Zg&&(this.textBlock=b,null!==b.part)){a.animationManager.tc();this.isActive=!0;this.pa=eh;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.Gh=this.textBlock.copy();var d=new M(this.textBlock.ja(Dc),this.textBlock.ja(Nc));a.Hw(d);c.show(b,a,this);this.currentTextEditor=c}}}};Yg.prototype.doCancel=function(){this.stopTool()}; Yg.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};Yg.prototype.doMouseDown=function(){this.isActive&&this.acceptText(ih)};Yg.prototype.acceptText=function(a){switch(a){case ih:if(this.pa===kh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.pa===eh||this.pa===gh||this.pa===fh)this.pa=lh,mh(this);break;case nh:case ch:case dh:if(ch!==a||!0!==this.textBlock.isMultiline)if(this.pa===eh||this.pa===gh||this.pa===fh)this.pa=lh,mh(this)}}; function mh(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.Da(a.name),a.pa=kh,a.transactionResult=a.name,b.text=f,a.doSuccess(e,f),null!==c&&c.V("TextEdited",b,e),a.stopTransaction(),a.stopTool(),null!==c&&c.doFocus()):(a.pa=gh,a.doError(e,f))}} Yg.prototype.doError=function(a,b){var c=this.textBlock;null!==c.errorFunction&&c.errorFunction(this,a,b);(a=this.currentTextEditor)&&a.show(c,this.diagram,this)};Yg.prototype.doSuccess=function(a,b){var c=this.textBlock;null!==c.textEdited&&c.textEdited(c,a,b)};Yg.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.pa=ah,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};Yg.prototype.doStop=function(){hh=null}; Yg.prototype.isValidText=function(a,b,c){w(a,Zg,Yg,"isValidText:textblock");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};Yg.prototype.Oy=function(a){var b=this.Gh;b.text=a;b.measure(this.textBlock.Ji,Infinity);return b}; na.Object.defineProperties(Yg.prototype,{textBlock:{configurable:!0,get:function(){return this.Ma},set:function(a){null!==a&&w(a,Zg,Yg,"textBlock");this.Ma=a}},currentTextEditor:{configurable:!0,get:function(){return this.o},set:function(a){this.o=a}},defaultTextEditor:{configurable:!0,get:function(){return this.j},set:function(a){!G||a instanceof Qe||v("TextEditingTool.defaultTextEditor must be an HTMLInfo.");this.j=a}},starting:{configurable:!0, get:function(){return this.La},set:function(a){eb(a,Yg,Yg,"starting");this.La=a}},textValidation:{configurable:!0,get:function(){return this.Zi},set:function(a){null!==a&&A(a,"function",Yg,"textValidation");this.Zi=a}},minimumEditorScale:{configurable:!0,get:function(){return this.F},set:function(a){null!==a&&A(a,"number",Yg,"minimumEditorScale");this.F=a}},selectsTextOnActivate:{configurable:!0,get:function(){return this.P},set:function(a){null!==a&&A(a, "boolean",Yg,"selectsTextOnActivate");this.P=a}},state:{configurable:!0,get:function(){return this.pa},set:function(a){this.pa!==a&&(eb(a,Yg,Yg,"starting"),this.pa=a)}}});Yg.prototype.measureTemporaryTextBlock=Yg.prototype.Oy; var nh=new E(Yg,"LostFocus",0),ih=new E(Yg,"MouseDown",1),dh=new E(Yg,"Tab",2),ch=new E(Yg,"Enter",3),oh=new E(Yg,"SingleClick",0),$g=new E(Yg,"SingleClickSelected",1),jh=new E(Yg,"DoubleClick",2),ah=new E(Yg,"StateNone",0),eh=new E(Yg,"StateActive",1),fh=new E(Yg,"StateEditing",2),lh=new E(Yg,"StateValidating",3),gh=new E(Yg,"StateInvalid",4),kh=new E(Yg,"StateValidated",5),hh=null;Yg.className="TextEditingTool";Yg.LostFocus=nh;Yg.MouseDown=ih;Yg.Tab=dh;Yg.Enter=ch;Yg.SingleClick=oh; Yg.SingleClickSelected=$g;Yg.DoubleClick=jh;Yg.StateNone=ah;Yg.StateActive=eh;Yg.StateEditing=fh;Yg.StateValidating=lh;Yg.StateInvalid=gh;Yg.StateValidated=kh;Ta("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.gb("TextEditing",a,this.mouseUpTools)}); function ph(a){qh||(rh(),qh=!0);this.D=He;this.Bl=this.rf=this.yc=this.vs=this.nc=!1;this.Vx=!0;this.Cl=sh;this.Dn=!1;this.Ei=this.sd=!0;this.jh=600;this.tx=this.Ux=!1;this.bf=new I;this.Ud=new th;this.Ud.$c=this;this.Dj=new I;this.yv=new I;this.wt=new I;this.dm=new I;a&&Object.assign(this,a)}ph.prototype.me=function(a){this.D=a};ph.prototype.canStart=function(){return!0};function uh(a,b){vh(a,b)&&(a.rf=!0)} function vh(a,b){if(!a.sd||!a.canStart(b))return!1;a.bf.add(b);a.defaultAnimation.isAnimating&&a.tc();wh(a.D);return a.yc=!0} function xh(a){if(a.sd&&a.yc){var b=a.Ud,c=a.D,d=a.bf.contains("Model");d&&(a.Bl=!0,a.Cl===sh?(b.isViewportUnconstrained=!0,b.qc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.Cl===yh&&b.qc.clear(),a.Vx=a.Cl===zh&&c.$s.B(c.oa)?!0:!1,c.V("InitialAnimationStarting",a));d&&!a.Ei||0===b.qc.count?(a.bf.clear(),a.yc=!1,a.rf=!1,b.qc.clear(),Ah(b,c),a.Bl=!1,c.R()):(a.bf.clear(),c.Re=!1,d=b.qc.get(c),c.autoScale!==Bh&&null!==d&&(delete d.start.scale,delete d.end.scale), ra.requestAnimationFrame(function(){!1===a.yc||b.nc||(c.Ve("temporaryPixelRatio")&&af(c),Ch(c),a.yc=!1,a.rf=!1,b.start(),Ph(a),c.Va(),Qh(b,0),Hf(c,!0),Rh(a),c.V("AnimationStarting",a))}))}}function Sh(a,b,c,d){a.isTicking||b instanceof T&&(null!==b.fromNode||null!==b.toNode)||a.Ud.add(b,"position",c,d,!1)}t=ph.prototype;t.hu=function(a){return this.Ud.hu(a)};t.mw=function(a){return this.Ud.mw(a)}; function Th(a,b){function c(){0<e.wt.count&&(d.addAll(e.wt),e.wt.clear(),e.nc=!0);if(!1!==e.nc&&0!==d.count){e.yv.addAll(d);for(var a=e.yv.iterator;a.next();){var b=a.value;if(!1!==b.nc){a:if(0<b.um.count)var h=!0;else{for(h=b.qc.iterator;h.next();){var k=h.key;if(k instanceof O&&null!==k.diagram||k instanceof R){h=!0;break a}}h=!1}h?Uh(b,!1):b.Kl=!0}}e.yv.clear();Ph(e);Hf(e.D);Rh(e);ra.requestAnimationFrame(c)}}var d=a.Dj,e=a;a.nc?a.wt.add(b):(a.nc=!0,d.add(b),ra.requestAnimationFrame(function(){c()}))} function Vh(a){for(a=a.Dj.iterator;a.next();)a.value.Kl=!1}function Ph(a){if(!a.vs){var b=a.D;a.Ux=b.skipsUndoManager;a.tx=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.vs=!0}}function Rh(a){var b=a.D;b.skipsUndoManager=a.Ux;b.skipsModelSourceBindings=a.tx;a.vs=!1} t.tc=function(a){var b=this.Ud;!0===this.yc&&(this.Bl=this.rf=this.yc=!1,this.bf.clear(),0<b.qc.count&&this.D.Kb());if(this.nc){if(b.Em(!0),b.qc.clear(),Ah(b,null),!0===a)for(a=this.Dj.Ea(),b=0;b<a.length;b++)a[b].Em(!0)}else b.qc.clear(),Ah(b,this.D)};t.Em=function(a){a===this.defaultAnimation&&this.defaultAnimation.qc.clear();this.Dj.remove(a);0===this.Dj.count&&(this.nc=!1,this.D.Kb());a===this.defaultAnimation&&(this.defaultAnimation.qc.clear(),this.D.V("AnimationFinished",this))}; t.rk=function(a,b){this.rf&&(this.bf.contains("Expand Tree")||this.bf.contains("Expand SubGraph"))&&(this.Ud.rk(a,b),Wh(this,a))};t.pk=function(a,b){this.rf&&(this.bf.contains("Collapse Tree")||this.bf.contains("Collapse SubGraph"))&&(this.Ud.pk(a,b),Xh(this.Ud,b,"position",b.position,b.position),Wh(this,a))};function Yh(a,b,c){a.rf&&!b.B(c)&&(a.D.tj||(b=c.copy()),Xh(a.Ud,a.D,"position",b,c))} function Wh(a,b){for(b=b.findLinksConnected();b.next();){var c=b.value;c.wf=c.points.copy();a.dm.add(c)}}function Zh(a,b,c,d,e){null===a&&(a=[0,0,0,0]);null===b&&(b=[0,0,0,0]);var f=a[0],g=a[1],h=a[2];a=a[3];var k=b[0],l=b[1],m=b[2];b=b[3];if(0===h||100===h)f=k,g=l;else if(0===m||100===m)k=f,l=g;180<Math.abs(k-f)&&(k>f?f+=360:k+=360);f=e(c,f,k-f,d)%360;g=e(c,g,l-g,d);h=e(c,h,m-h,d);c=e(c,a,b-a,d);return"hsla("+f+", "+g+"%, "+h+"%, "+c+")"} function rh(){function a(a,b,e,f,g,h){a.position=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))}var b=new zb;b.add("position:diagram",a);b.add("position",a);b.add("position:part",function(a,b,e,f,g,h){g<h?a.dn(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("location",function(a,b,e,f,g,h){g<h?a.dn(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!0):a.location=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("position:placeholder",function(a,b,e,f, g,h){g<h?a.dn(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h),!1):a.position=new J(f(g,b.x,e.x-b.x,h),f(g,b.y,e.y-b.y,h))});b.add("position:nodeCollapse",function(a,b,e,f,g,h){var c=a.actualBounds,d=e.actualBounds;e=d.x+d.width/2-c.width/2;c=d.y+d.height/2-c.height/2;g<h?a.dn(f(g,b.x,e-b.x,h),f(g,b.y,c-b.y,h),!1):a.position=new J(f(g,b.x,e-b.x,h),f(g,b.y,c-b.y,h))});b.add("desiredSize",function(a,b,e,f,g,h){a.desiredSize=new M(f(g,b.width,e.width-b.width,h),f(g,b.height,e.height-b.height,h))});b.add("width", function(a,b,e,f,g,h){a.width=f(g,b,e-b,h)});b.add("height",function(a,b,e,f,g,h){a.height=f(g,b,e-b,h)});b.add("fill",function(a,b,e,f,g,h){a.fill=Zh(b,e,g,h,f)});b.add("stroke",function(a,b,e,f,g,h){a.stroke=Zh(b,e,g,h,f)});b.add("strokeWidth",function(a,b,e,f,g,h){a.strokeWidth=f(g,b,e-b,h)});b.add("strokeDashOffset",function(a,b,e,f,g,h){a.strokeDashOffset=f(g,b,e-b,h)});b.add("background",function(a,b,e,f,g,h){a.background=Zh(b,e,g,h,f)});b.add("areaBackground",function(a,b,e,f,g,h){a.areaBackground= Zh(b,e,g,h,f)});b.add("opacity",function(a,b,e,f,g,h){a.opacity=f(g,b,e-b,h)});b.add("scale",function(a,b,e,f,g,h){a.scale=f(g,b,e-b,h)});b.add("angle",function(a,b,e,f,g,h){a.angle=f(g,b,e-b,h)});$h=b} na.Object.defineProperties(ph.prototype,{animationReasons:{configurable:!0,get:function(){return this.bf}},isEnabled:{configurable:!0,get:function(){return this.sd},set:function(a){A(a,"boolean",ph,"isEnabled");(this.sd=a)&&this.Dj.each(function(a){a.isAnimating||Infinity!==a.runCount||a.start()})}},duration:{configurable:!0,get:function(){return this.jh},set:function(a){A(a,"number",ph,"duration");1>a&&Ba(a,">= 1",ph,"duration");this.jh=a}},isAnimating:{configurable:!0, enumerable:!0,get:function(){return this.nc}},isTicking:{configurable:!0,get:function(){return this.vs}},isInitial:{configurable:!0,get:function(){return this.Ei},set:function(a){A(a,"boolean",ph,"isInitial");this.Ei=a}},defaultAnimation:{configurable:!0,get:function(){return this.Ud}},activeAnimations:{configurable:!0,get:function(){return this.Dj}},initialAnimationStyle:{configurable:!0,get:function(){return this.Cl},set:function(a){G&& eb(a,ph,ph,"initialAnimationStyle");this.Cl=a}}});ph.prototype.stopAnimation=ph.prototype.tc;var $h=null,qh=!1,sh=new E(ph,"Default",1),zh=new E(ph,"AnimateLocations",2),yh=new E(ph,"None",3);ph.className="AnimationManager";ph.defineAnimationEffect=function(a,b){qh||(rh(),qh=!0);$h.add(a,b)};ph.Default=sh;ph.AnimateLocations=zh;ph.None=yh; function th(){this.Cv=this.Tx=this.$c=this.D=null;this.Kl=this.nc=this.j=!1;this.jo=this.Hd=0;this.Pr=this.Mu=ai;this.Jl=this.Np=!1;this.sv=1;this.rv=0;this.Ad=this.jh=NaN;this.xx=0;this.ko=null;this.o=Lb;this.qc=new zb;this.mv=new zb;this.um=new I;this.nv=new I;this.ux=bi;return this}th.prototype.suspend=function(){this.Kl=!0};th.prototype.advanceTo=function(a,b){b&&(this.Kl=!1);this.Np&&a>=this.Ad&&(this.Jl=!0,a-=this.Ad);this.xx=a;Uh(this,!0);Ph(this.$c);Hf(this.D);Rh(this.$c);this.D.redraw()}; function Ah(a,b){a.mv.clear();a.Jl=!1;a.rv=0;a.Ad=NaN;0<a.um.count&&a.um.clear();0<a.nv.count&&a.nv.clear();if(null!==b)for(a=b.links;a.next();)a.value.wf=null}t=th.prototype; t.start=function(){if(0!==this.qc.count&&!this.nc){for(var a=this.D,b=this.qc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof yf&&null!==e.placeholder){var f=e.placeholder;e=f.ja(Dc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof R?a=d:d instanceof O&&(a=d.diagram))}null!==a&&(this.D=a,b=this.$c=a.animationManager,!1!==b.isEnabled&&(this.Ad=isNaN(this.jh)?b.duration:this.jh,this.Pr=this.Mu, b.Bl&&b.Cl===sh&&this===b.defaultAnimation&&(this.Pr=ci,this.Ad=isNaN(this.jh)?600===b.duration?900:b.duration:this.jh),this.ux=a.scrollMode,this.isViewportUnconstrained&&(a.Wi=di),Ph(b),this.um.each(function(b){b.data=null;a.add(b)}),Rh(b),this.nc=!0,this.Hd=+new Date,this.jo=this.Hd+this.Ad,Th(b,this)))}}; t.Az=function(a,b){if(!a.Uc())return this;G&&(void 0===b&&v("addTemporaryPart: Required Diagram argument missing"),a.diagram===b&&v("addTemporaryPart: Part already in Diagram, did you mean to pass in a copy?"),null!==this.D&&this.D!==b&&v("addTemporaryPart: A different Diagram is already associated with this Animation: "+this.D.toString()));this.um.add(a);this.D=b;return this}; t.add=function(a,b,c,d,e){if("position"===b&&c.B(d))return this;null===this.D&&(a instanceof R?this.D=a:a instanceof O&&null!==a.diagram&&(this.D=a.diagram));if(a instanceof U){if(!a.isAnimated)return this;"position"===b&&(b="position:part")}Xh(this,a,b,c,d,e);return this}; function Xh(a,b,c,d,e,f){var g=a.qc;b instanceof R&&"position"===c&&(c="position:diagram");if("fill"===c||"stroke"===c||"background"===c||"areaBackground"===c)ei(d),fi(),d=[gi.j,gi.F,gi.o,gi.P],ei(e),fi(),e=[gi.j,gi.F,gi.o,gi.P];if(g.contains(b)){var h=g.K(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=hi(d));l[c]=hi(e)}else k={},l={},k[c]=hi(d),l[c]=hi(e),h=k.position,b instanceof O&&h instanceof J&&!h.s()&&b.diagram.animationManager.bf.contains("Expand SubGraph")&&h.assign(l.position),h=new ii(k, l,f),g.add(b,h);g=k[c];g instanceof J&&!g.s()&&g.assign(a.o);f&&0===c.indexOf("position:")&&b instanceof U?h.Yv.location=hi(b.location):f&&(h.Yv[c]=hi(d))}function hi(a){return a instanceof J?a.copy():a instanceof Db?a.copy():a}t.hu=function(a){if(!this.nc)return!1;a=this.qc.K(a);return null!==a&&a.zw};t.mw=function(a){if(!this.nc)return!1;a=this.qc.K(a);return null!==a&&(a.start.position||a.start.location)}; function Uh(a,b){if(!a.Kl||b){var c=a.$c;if(!1!==a.nc){var d=+new Date,e=d>a.jo?a.Ad:d-a.Hd;b&&(e=a.xx,e<a.Ad?(a.Hd=+new Date-e,a.jo=a.Hd+a.Ad):e=a.Ad);Ph(c);Qh(a,e);Hf(a.D,!0);Rh(c);d>a.jo&&(a.Np&&!a.Jl?(a.Hd=+new Date,a.jo=a.Hd+a.Ad,a.Jl=!0):a.Em(!1))}}} function Qh(a,b){for(var c=a.Ad,d=a.qc.iterator,e=a.Jl;d.next();){var f=d.key;if(!(f instanceof O&&null===f.diagram)){var g=d.value,h=e?g.end:g.start;g=e?g.start:g.end;var k=$h,l;for(l in g)"position"===l&&(g["position:placeholder"]||g["position:nodeCollapse"])||null===k.get(l)||k.get(l)(f,h[l],g[l],a.Pr,b,c,a)}}}t.stop=function(){this.nc&&this.Em(!0)}; t.Em=function(a){null!==this.Cv&&this.Cv.Up.remove(this.Tx);if(this.nc){var b=this.D,c=this.$c;this.Kl=this.nc=c.Bl=!1;Ph(c);for(var d=this.qc,e=this.um.iterator;e.next();)b.remove(e.value);for(e=this.nv.iterator;e.next();)e.value.v();e=this.Np;d=d.iterator;for(var f=$h;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.Yv,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Qv||"position:nodeCollapse"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]: h.Qv?k[n]:l[n],this.Pr,this.Ad,this.Ad,this)}h.Qv&&void 0!==m.location&&g instanceof U&&(g.location=m.location);h.zw&&g instanceof U&&g.Sb(!1)}b.cu.clear();lf(b,!1);b.Va();b.R();Hf(b,!0);if(c.defaultAnimation===this){for(n=c.dm.iterator;n.next();)e=n.value,null!==e.wf&&(e.points=e.wf,e.wf=null);c.dm.clear()}this.isViewportUnconstrained&&(b.scrollMode=this.ux);Rh(c);this.rv++;!a&&this.sv>this.rv?(this.Jl=!1,this.start()):(this.ko&&this.ko(this),Ah(this,null),c.Em(this),b.Kb())}}; t.rk=function(a,b){var c=b.actualBounds,d=null;b instanceof yf&&(d=b.placeholder);null!==d?(c=d.ja(Dc),d=d.padding,c.x+=d.left,c.y+=d.top,this.add(a,"position",c,a.position,!1)):this.add(a,"position",new J(c.x+c.width/2,c.y+c.height/2),a.position,!1);this.add(a,"scale",.01,a.scale,!1);if(a instanceof yf)for(a=a.memberParts;a.next();)d=a.value,d instanceof V&&this.rk(d,b)}; t.pk=function(a,b){if(a.isVisible()){var c=null;b instanceof yf&&(c=b.placeholder);null!==c?this.add(a,"position:placeholder",a.position,c,!0):this.add(a,"position:nodeCollapse",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);c=this.qc;c.contains(a)&&(c.K(a).zw=!0);if(a instanceof yf)for(a=a.memberParts;a.next();)c=a.value,c instanceof V&&this.pk(c,b)}};t.AA=function(a){var b=this.mv.get(a);null===b&&(b={},this.mv.add(a,b));return b}; na.Object.defineProperties(th.prototype,{duration:{configurable:!0,get:function(){return this.jh},set:function(a){A(a,"number",th,"duration");1>a&&Ba(a,">= 1",th,"duration");this.jh=a}},reversible:{configurable:!0,get:function(){return this.Np},set:function(a){this.Np=a}},runCount:{configurable:!0,get:function(){return this.sv},set:function(a){0<a?this.sv=a:v("Animation.runCount value must be a positive integer.")}},finished:{configurable:!0, get:function(){return this.ko},set:function(a){this.ko!==a&&(null!==a&&A(a,"function",R,"click"),this.ko=a)}},easing:{configurable:!0,get:function(){return this.Mu},set:function(a){this.Mu=a}},isViewportUnconstrained:{configurable:!0,get:function(){return this.j},set:function(a){this.j=a}},isAnimating:{configurable:!0,get:function(){return this.nc}}});th.prototype.getTemporaryState=th.prototype.AA;th.prototype.stop=th.prototype.stop;th.prototype.add=th.prototype.add; th.prototype.addTemporaryPart=th.prototype.Az;function ai(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function ci(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}th.className="Animation";th.EaseLinear=function(a,b,c,d){return c*a/d+b};th.EaseInOutQuad=ai;th.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};th.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};th.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};th.EaseOutExpo=ci; function ii(a,b,c){this.start=a;this.end=b;this.Yv={};this.Qv=c;this.zw=!1}ii.className="AnimationState";function ji(a,b,c){this.ud=null;this.uf=a;this.mq=c||ki;this.al=null;void 0!==b&&(this.al=b,void 0===c&&(this.mq=li))}ji.prototype.copy=function(){var a=new ji(this.uf);a.mq=this.mq;var b=this.al;if(null!==b){var c={};void 0!==b.duration&&(c.duration=b.duration);void 0!==b.finished&&(c.finished=b.finished);void 0!==b.easing&&(c.easing=b.easing);a.al=c}return a}; function mi(a,b){a=a.al;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))} na.Object.defineProperties(ji.prototype,{propertyName:{configurable:!0,get:function(){return this.uf},set:function(a){this.uf=a}},animationSettings:{configurable:!0,get:function(){return this.al},set:function(a){this.al=a}},startCondition:{configurable:!0,get:function(){return this.mq},set:function(a){G&&eb(a,ji,ji,"startCondition");this.mq=a}}});var ki=new E(ji,"Default",1),li=new E(ji,"Immediate",2),ni=new E(ji,"Bundled",3);ji.className="AnimationTrigger"; ji.Default=ki;ji.Immediate=li;ji.Bundled=ni;function oi(){0<arguments.length&&Ca(oi);cb(this);this.D=null;this.Ka=new H;this.ta="";this.mb=1;this.o=!1;this.j=this.Si=this.F=this.oi=this.ni=this.mi=this.li=this.ji=this.ki=this.ii=this.ri=this.hi=this.pi=this.gi=this.fi=!0;this.Ap=[]}t=oi.prototype;t.clear=function(){this.Ka.clear();this.Ap.length=0};t.me=function(a){this.D=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.Ka.iterator;h.next();){var k=h.value;k instanceof yf?e++:k instanceof V?d++:k instanceof T?f++:k instanceof Le?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.Ka.iterator;a.next();)c=a.value,h+="\n "+c.toString(),d=c.data,null!==d&&mb(d)&&(h+=" #"+mb(d)),c instanceof V?h+=" "+ Qa(d):c instanceof T&&(h+=" "+Qa(c.fromNode)+" "+Qa(c.toNode));return b+" "+this.Ka.count+": "+h}; t.ac=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Si)return null;G&&!a.s()&&v("findObjectAt: Point must have a real value, not: "+a.toString());var d=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(a)&&(d=!0);for(var e=J.alloc(),f=this.Ka.l,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==mg(h))&&h.isVisible()&&(e.assign(a),Gb(e,h.je),h=h.ac(e,b,c),null!==h&&(null!==b&&(h=b(h)),null!==h&&(null===c||c(h)))))return J.free(e),h}J.free(e);return null}; t.lj=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof H||d instanceof I||(d=new I);if(!1===this.Si)return d;G&&!a.s()&&v("findObjectsAt: Point must have a real value, not: "+a.toString());var e=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(a)&&(e=!0);for(var f=J.alloc(),g=this.Ka.l,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==mg(k))&&k.isVisible()){f.assign(a);Gb(f,k.je);var l=k;k.lj(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}J.free(f);return d}; t.Nf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof H||e instanceof I||(e=new I);if(!1===this.Si)return e;G&&!a.s()&&v("findObjectsIn: Rect must have a real value, not: "+a.toString());var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Te(a)&&(f=!0);for(var g=this.Ka.l,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==mg(k))&&k.isVisible()){var l=k;k.Nf(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e}; t.cw=function(a,b,c,d,e,f,g){if(!1===this.Si)return e;for(var h=this.Ka.l,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==mg(l))&&f(l)&&l.isVisible()){var m=l;l.Nf(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e}; t.Og=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 H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);if(!1===this.Si)return f;G&&!a.s()&&v("findObjectsNear: Point must have a real value, not: "+a.toString());var g=!1;null!==this.diagram&&this.diagram.viewportBounds.ca(a)&&(g=!0);for(var h=J.alloc(),k=J.alloc(),l=this.Ka.l,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==mg(n))&&n.isVisible()){h.assign(a);Gb(h,n.je); k.h(a.x+b,a.y);Gb(k,n.je);var p=n;n.Og(h,k,c,d,e,f)&&(null!==c&&(p=c(p)),null===p||null!==d&&!d(p)||f.add(p))}}J.free(h);J.free(k);return f}; t.Qd=function(a,b){if(this.visible){var c=this.Ka.l,d=c.length;if(0!==d){a=Ma();for(var e=Ma(),f=0;f<d;f++){var g=c[f];g.Fx=f;if(g instanceof T){if(!1===g.zd)continue}else if(g instanceof Le&&null!==g.adornedPart)continue;var h=g.actualBounds;g.isVisible()&&ic(h,b)?(g.Qd(!0),a.push(g)):(g.Qd(!1),null!==g.adornments&&0<g.adornments.count&&e.push(g))}for(b=0;b<a.length;b++)for(c=a[b],pi(c),c=c.adornments;c.next();)d=c.value,d.measure(Infinity,Infinity),d.arrange(),d.Qd(!0);for(b=0;b<e.length;b++)pi(e[b]); Oa(a);Oa(e)}}};function qi(a,b){var c=1;1!==a.mb&&(c=b.globalAlpha,b.globalAlpha=c*a.mb);return c}t.rc=function(a,b,c){if(this.visible&&0!==this.mb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Ka.l;var d=c.length;if(0!==d){var e=qi(this,a),f=this.Ap;f.length=0;for(var g=b.scale,h=M.alloc(),k=0;k<d;k++)this.gj(a,c[k],b,f,g,h,!0);M.free(h);a.globalAlpha=e}}}; t.gj=function(a,b,c,d,e,f,g){if(!g||mg(b)){if(null!==d&&b instanceof T&&(b.isOrthogonal&&d.push(b),!1===b.zd))return;g=!1;for(d=b.containingGroup;null!==d;)g?null!==d.hb&&f.Iy(d.hb):null!==d.hb&&(g=!0,f.assign(d.hb)),d=d.containingGroup;var h=b.actualBounds;d=!1;if(g&&b.isVisible()){if(!f.Tc(h))return;d=!f.Te(h)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());h.width*e>c.gp||h.height*e>c.gp?b.rc(a,c):(e=b.actualBounds,f=b.naturalBounds,0===e.width||0===e.height||isNaN(e.x)|| isNaN(e.y)||!b.isVisible()||(c=b.transform,null!==b.areaBackground&&(ri(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(ri(b,a,"rgba(0,0,0,0.3)",!0,!1,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null!==b.background&&(a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),ri(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.Zt()||(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))))));d&&(a.restore(),a.Oc(!0))}};t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.ab(se,a,this,b,c,d,e)};t.rj=function(a,b,c){var d=this.Ka;b.Ki=this;if(a>=d.count)a=d.count;else if(d.M(a)===b)return-1;d.zb(a,b);b.Uq(c);d=this.diagram;null!==d&&(c?d.R():d.rj(b));si(this,a,b);return a}; t.Sc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.Sc(a,b,c);var d=this.Ka;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.M(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.Vq(c);d.kb(a);d=this.diagram;null!==d&&(c?d.R():d.Sc(b));b.Ki=null;return a}; function si(a,b,c){b=ti(a,b,c);if(c instanceof yf&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Ka.l,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.Ka,e.kb(b),e.zb(d,c))}c=c.containingGroup;null!==c&&si(a,-1,c)}} function ti(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Ka;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.M(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.M(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.kb(b);a.zb(f,c);return f}for(g=NaN;0<=--f&&(g=a.M(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.kb(b);a.zb(h,c);return h}for(k=NaN;++h< e&&(k=a.M(h).zOrder,isNaN(k)););}return b} na.Object.defineProperties(oi.prototype,{parts:{configurable:!0,get:function(){return this.Ka.iterator}},partsBackwards:{configurable:!0,get:function(){return this.Ka.iteratorBackwards}},diagram:{configurable:!0,get:function(){return this.D}},name:{configurable:!0,get:function(){return this.ta},set:function(a){A(a,"string",oi,"name");var b=this.ta;if(b!==a){var c=this.diagram;if(null!==c)for(""===b&&v("Cannot rename default Layer to: "+a),c= c.layers;c.next();)c.value.name===a&&v("Layer.name is already present in this diagram: "+a);this.ta=a;this.g("name",b,a);for(a=this.Ka.iterator;a.next();)a.value.layerName=this.ta}}},opacity:{configurable:!0,get:function(){return this.mb},set:function(a){var b=this.mb;b!==a&&(A(a,"number",oi,"opacity"),(0>a||1<a)&&Ba(a,"0 <= value <= 1",oi,"opacity"),this.mb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.R())}},isTemporary:{configurable:!0,get:function(){return this.o}, set:function(a){var b=this.o;if(b!==a){A(a,"boolean",oi,"isTemporary");if(this.o=a)this.isInDocumentBounds=!1;this.g("isTemporary",b,a)}}},visible:{configurable:!0,get:function(){return this.F},set:function(a){var b=this.F;if(b!==a){A(a,"boolean",oi,"visible");this.F=a;this.g("visible",b,a);for(b=this.Ka.iterator;b.next();)b.value.Sb(a);a=this.diagram;null!==a&&a.R()}}},pickable:{configurable:!0,get:function(){return this.Si},set:function(a){var b=this.Si;b!==a&&(A(a,"boolean", oi,"pickable"),this.Si=a,this.g("pickable",b,a))}},isInDocumentBounds:{configurable:!0,get:function(){return this.j},set:function(a){this.j!==a&&(this.j=a,null!==this.diagram&&this.diagram.Va())}},allowCopy:{configurable:!0,get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(A(a,"boolean",oi,"allowCopy"),this.fi=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.gi},set:function(a){var b=this.gi;b!==a&&(A(a, "boolean",oi,"allowDelete"),this.gi=a,this.g("allowDelete",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.pi},set:function(a){var b=this.pi;b!==a&&(A(a,"boolean",oi,"allowTextEdit"),this.pi=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0,get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(A(a,"boolean",oi,"allowGroup"),this.hi=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.ri}, set:function(a){var b=this.ri;b!==a&&(A(a,"boolean",oi,"allowUngroup"),this.ri=a,this.g("allowUngroup",b,a))}},allowLink:{configurable:!0,get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(A(a,"boolean",oi,"allowLink"),this.ii=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(A(a,"boolean",oi,"allowRelink"),this.ki=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0, get:function(){return this.ji},set:function(a){var b=this.ji;b!==a&&(A(a,"boolean",oi,"allowMove"),this.ji=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,get:function(){return this.li},set:function(a){var b=this.li;b!==a&&(A(a,"boolean",oi,"allowReshape"),this.li=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.mi},set:function(a){var b=this.mi;b!==a&&(A(a,"boolean",oi,"allowResize"),this.mi=a,this.g("allowResize",b,a))}}, allowRotate:{configurable:!0,get:function(){return this.ni},set:function(a){var b=this.ni;b!==a&&(A(a,"boolean",oi,"allowRotate"),this.ni=a,this.g("allowRotate",b,a))}},allowSelect:{configurable:!0,get:function(){return this.oi},set:function(a){var b=this.oi;b!==a&&(A(a,"boolean",oi,"allowSelect"),this.oi=a,this.g("allowSelect",b,a))}}});oi.prototype.findObjectsNear=oi.prototype.Og;oi.prototype.findObjectsIn=oi.prototype.Nf;oi.prototype.findObjectsAt=oi.prototype.lj; oi.prototype.findObjectAt=oi.prototype.ac;oi.className="Layer"; function R(a,b){ui||(vi(),ui=!0);cb(this);He=this;this.Xb=!0;this.$c=new ph;this.$c.me(this);this.ub=17;this.Il=this.uv=!1;this.Zs="default";this.Ja=null;if(Xg){var c=this,d=function(){c.removeEventListener(ra.document,"DOMContentLoaded",d,!1);c.setRTL()};null!==ra.document.body?this.setRTL():c.addEventListener(ra.document,"DOMContentLoaded",d,!1)}this.Ra=new H;this.Aa=this.Ba=0;this.cm=this.Ga=null;this.Ox=new zb;this.vf=this.Db=null;this.Ew();this.Rj=null;this.Dw();this.mb=1;this.oa=(new J(NaN, NaN)).freeze();this.$s=new J(NaN,NaN);this.Zn=this.wa=1;this.ls=(new J(NaN,NaN)).freeze();this.ms=NaN;this.Es=1E-4;this.Cs=100;this.vb=new Fb;this.Et=(new J(NaN,NaN)).freeze();this.fs=(new M(NaN,NaN,NaN,NaN)).freeze();this.Vi=(new gc(0,0,0,0)).freeze();this.Wi=bi;this.ht=!1;this.at=this.Us=null;this.Yg=Bh;this.Hj=ed;this.jg=Bh;this.Co=ed;this.ns=this.ks=Dc;this.Ic=!0;this.Gl=!1;this.be=new I;this.gh=new zb;this.rl=!0;this.An=250;this.Fj=-1;this.Cn=(new gc(16,16,16,16)).freeze();this.Lj=this.Re=!1; this.Oj=!0;this.vl=new oe;this.vl.diagram=this;this.tf=new oe;this.tf.diagram=this;this.sh=new oe;this.sh.diagram=this;this.He=this.ag=null;this.tt=!1;this.Wr=this.Xr=null;wi(this);this.Kh=new I;this.xs=!0;this.yt=xi;this.Wu=!1;this.At=Mf;this.Ma=null;yi.add("Model",zi);this.Qr=this.Tr=this.xt=null;this.Yn=this.Or="auto";this.qg=this.Hs=this.sg=this.tg=this.vg=this.cg=this.gg=this.bg=null;this.js=!1;this.dg=this.Hg=this.ug=this.rg=null;this.Is=!1;this.Ss={};this.hk=[null,null];this.Ir=null;this.Ur= this.nt=this.wv=this.Fg=!1;this.cv=!0;this.Di=this.fc=!1;this.hc=null;var e=this;this.Gc=function(a){var b=e.partManager;if(a.model===b.diagram.model&&b.diagram.ba){b.diagram.ba=!1;try{var c=a.change;""===a.modelChange&&c===se&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.ba=!0}}};this.Zc=function(a){e.partManager.doModelChanged(a)};this.Ev=!0;this.$d=-2;this.zg=new zb;this.$l=new H;this.kg=!1;this.gi=this.fi=this.vr=this.sd=!0;this.wr=!1;this.Cr=this.Ar=this.oi=this.ni=this.mi= this.li=this.ji=this.ki=this.ii=this.zr=this.ri=this.hi=this.pi=this.xr=!0;this.Tj=this.Zu=!1;this.Br=this.yr=this.yl=this.xl=!0;this.gt=this.ct=16;this.bt=this.Wp=!1;this.Xp=this.et=null;this.dt=this.ft=0;this.nb=(new gc(5)).freeze();this.vv=(new I).freeze();this.Ds=999999999;this.Uu=(new I).freeze();this.Ci=this.Bi=this.Ai=!0;this.jf=this.ze=!1;this.oc=null;this.Xg=!0;this.Ae=!1;this.Gx=new I;this.Vu=new I;this.Lc=null;this.ov=1;this.xv=0;this.Nc={scale:1,position:new J,bounds:new M,Mv:new Db,sw:new Db, ow:!1};this.Wx=(new M(NaN,NaN,NaN,NaN)).freeze();this.wm=(new Db(NaN,NaN)).freeze();this.$n=(new M(NaN,NaN,NaN,NaN)).freeze();this.ys=!1;this.Uo=this.zo=this.sp=this.Hu=this.Gu=this.Iu=this.mg=this.qh=this.qf=this.$r=null;Ai(this);this.Ob=null;this.yo=!1;this.Ij=null;this.partManager=new zi;this.toolManager=new Ua;this.toolManager.initializeStandardTools();this.currentTool=this.defaultTool=this.toolManager;this.Zr=null;this.kl=new Ye;this.Ns=this.Ms=null;this.oq=!1;this.commandHandler=Bi();this.model= Ci();this.Fg=!0;Di(this);this.layout=new Ei;this.Fg=!1;this.yx=this.Lu=null;this.Yb=1;this.Fh=null;this.gp=1;this.lp=0;this.lv=[0,0,0,0,0];this.mp=0;this.Po=1;this.ev=0;this.fv=new J;this.Sx=500;this.Bn=new J;this.ws=!1;this.Qk=this.Rk=this.Pk=this.Ok=this.WA=this.Lk=this.Yw=null;this.fr=function(){};this.preventDefault=null;this.pq=this.Fo=!1;this.zi=new Fi;void 0!==a&&("string"===typeof a||ra.Element&&a instanceof Element?Gi(this,a):b=a);this.lo=null;this.mo=Pb;this.Xb=!1;b&&this.en(b);return this} R.prototype.clear=function(){this.animationManager.tc();this.model.clear();Hi=null;Ii="";Ji(this,!1);this.$l.clear();Ki();this.zg.clear();this.Va();this.Xa();this.R()}; function Ji(a,b){a.animationManager.tc(!0);a.vv=(new I).freeze();a.Uu=(new I).freeze();var c=a.skipsUndoManager;null!==a.model&&(a.skipsUndoManager=!0);var d=null;null!==a.Ob&&(d=a.Ob.part,null!==d&&a.remove(d));var e=[],f=a.Ra.length;if(b){for(b=0;b<f;b++)for(var g=a.Ra.l[b].parts;g.next();){var h=g.value;h!==d&&null===h.data&&e.push(h)}for(b=0;b<e.length;b++)a.remove(e[b])}for(b=0;b<f;b++)a.Ra.l[b].clear();a.partManager.clear();a.be.clear();a.gh.clear();a.Kh.clear();a.Ij=null;a.$l.clear();Ki(); a.zg.clear();Na=[];null!==d&&(a.add(d),a.partManager.parts.remove(d));null!==a.model&&(a.skipsUndoManager=c);return e}function Bi(){return null} R.prototype.reset=function(){this.clear();this.Xb=!0;this.$c=new ph;this.$c.me(this);this.ub=17;this.Il=this.uv=!1;this.Zs="default";this.Ra=new H;this.Ox=new zb;this.vf=null;this.Ew();this.Rj=null;this.Dw();this.mb=1;this.oa=(new J(NaN,NaN)).freeze();this.$s=new J(NaN,NaN);this.Zn=this.wa=1;this.ls=(new J(NaN,NaN)).freeze();this.ms=NaN;this.Es=1E-4;this.Cs=100;this.vb=new Fb;this.Et=(new J(NaN,NaN)).freeze();this.fs=(new M(NaN,NaN,NaN,NaN)).freeze();this.Vi=(new gc(0,0,0,0)).freeze();this.Wi=bi; this.ht=!1;this.at=this.Us=null;this.Yg=Bh;this.Hj=ed;this.jg=Bh;this.Co=ed;this.ns=this.ks=Dc;this.Ic=!0;this.Gl=!1;this.be=new I;this.gh=new zb;this.rl=!0;this.An=250;this.Fj=-1;this.Cn=(new gc(16,16,16,16)).freeze();this.Lj=this.Re=!1;this.Oj=!0;this.vl=new oe;this.vl.diagram=this;this.tf=new oe;this.tf.diagram=this;this.sh=new oe;this.sh.diagram=this;this.He=this.ag=null;this.tt=!1;this.Wr=this.Xr=null;wi(this);this.Kh=new I;this.xs=!0;this.yt=xi;this.Wu=!1;this.At=Mf;this.Qr=this.Tr=this.xt= null;this.Yn=this.Or="auto";this.qg=this.Hs=this.sg=this.tg=this.vg=this.cg=this.gg=this.bg=null;this.js=!1;this.dg=this.Hg=this.ug=this.rg=null;this.Is=!1;this.Ss={};this.hk=[null,null];this.Ir=null;this.Ur=this.nt=this.wv=this.Fg=!1;this.cv=!0;this.Di=this.fc=!1;this.Ev=!0;this.$d=-2;this.zg=new zb;this.$l=new H;this.kg=!1;this.gi=this.fi=this.vr=this.sd=!0;this.wr=!1;this.Cr=this.Ar=this.oi=this.ni=this.mi=this.li=this.ji=this.ki=this.ii=this.zr=this.ri=this.hi=this.pi=this.xr=!0;this.Tj=this.Zu= !1;this.Br=this.yr=this.yl=this.xl=!0;this.gt=this.ct=16;this.bt=this.Wp=!1;this.dt=this.ft=0;this.nb=(new gc(5)).freeze();this.vv=(new I).freeze();this.Ds=999999999;this.Uu=(new I).freeze();this.Ci=this.Bi=this.Ai=!0;this.jf=this.ze=!1;this.oc=null;this.Xg=!0;this.Ae=!1;this.Gx=new I;this.Vu=new I;this.Lc=null;this.ov=1;this.xv=0;this.Nc={scale:1,position:new J,bounds:new M,Mv:new Db,sw:new Db,ow:!1};this.Wx=(new M(NaN,NaN,NaN,NaN)).freeze();this.wm=(new Db(NaN,NaN)).freeze();this.$n=(new M(NaN, NaN,NaN,NaN)).freeze();this.ys=!1;this.Uo=this.zo=this.sp=this.Hu=this.Gu=this.Iu=this.mg=this.qh=this.qf=null;Ai(this);this.Ob=null;this.yo=!1;this.Ij=null;this.partManager=new zi;this.toolManager=new Ua;this.toolManager.initializeStandardTools();this.currentTool=this.defaultTool=this.toolManager;this.Zr=null;this.kl=new Ye;this.Ns=this.Ms=null;this.oq=!1;this.commandHandler=Bi();this.Fg=!0;Di(this);this.layout=new Ei;this.Fg=!1;this.model=Ci();this.model.undoManager=new Ee;this.Ae=!1;this.Oj=!0; this.Re=!1;this.Yb=1;this.Fh=null;this.gp=1;this.lp=0;this.lv=[0,0,0,0,0];this.mp=0;this.Po=1;this.ev=0;this.fv=new J;this.Sx=500;this.Bn=new J;this.pq=this.Fo=this.ws=!1;this.lo=null;this.mo=Pb;this.Xb=!1;this.R()}; function Ai(a){a.qf=new zb;var b=new V,c=new Zg;c.bind(new Li("text","",Qa));b.add(c);a.Iu=b;a.qf.add("",b);b=new V;c=new Zg;c.stroke="brown";c.bind(new Li("text","",Qa));b.add(c);a.qf.add("Comment",b);b=new V;b.selectable=!1;b.avoidable=!1;c=new Kf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new Db(3,3)).ia();b.add(c);a.qf.add("LinkLabel",b);a.qh=new zb;b=new yf;b.selectionObjectName="GROUPPANEL";b.type=W.Vertical;c=new Zg;c.font="bold 12pt sans-serif";c.bind(new Li("text","", Qa));b.add(c);c=new W(W.Auto);c.name="GROUPPANEL";var d=new Kf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new ng;d.padding=(new gc(5,5,5,5)).ia();c.add(d);b.add(c);a.Gu=b;a.qh.add("",b);a.mg=new zb;b=new T;c=new Kf;c.isPanelMain=!0;b.add(c);c=new Kf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.Hu=b;a.mg.add("",b);b=new T;c=new Kf;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.mg.add("Comment",b);b=new Le;b.type=W.Auto;c=new Kf;c.fill= null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new ng;c.margin=(new gc(1.5,1.5,1.5,1.5)).ia();b.add(c);a.sp=b;a.zo=b;b=new Le;b.type=W.Link;c=new Kf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.Uo=b} R.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=ra.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.Zs=c}; R.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=ra.document.body);var b=0;if(Xg){var c=Mi;b=Ni;null===c&&(c=Mi=va("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=Ni=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||ab||(b=11)}this.ub=b;this.uv=!0};R.prototype.ob=function(a){a.classType===R?this.autoScale=a:Ea(this,a)};R.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};R.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,{capture:d,passive:!1})}; R.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,{capture:d})}; function Vi(a){var b=a.Ga.Qa;b instanceof HTMLCanvasElement&&(a.addEventListener(b,"pointerdown",a.Ok,!1),a.addEventListener(b,"pointermove",a.Pk,!1),a.addEventListener(b,"pointerup",a.Rk,!1),a.addEventListener(b,"pointerout",a.Qk,!1),a.addEventListener(b,"pointerenter",a.Wz,!1),a.addEventListener(b,"pointerleave",a.Xz,!1),a.addEventListener(b,"wheel",a.Lk,!1),a.addEventListener(b,"keydown",a.MA,!1),a.addEventListener(b,"keyup",a.NA,!1),a.addEventListener(b,"blur",a.Iz,!1),a.addEventListener(b,"focus", a.Jz,!1),a.addEventListener(b,"selectstart",function(a){a.preventDefault();return!1},!1),a.addEventListener(b,"contextmenu",function(a){a.preventDefault();return!1},!1),a.addEventListener(ra,"resize",a.Yw,!1))}function af(a){30<a.lp&&(a.Fh=1)}function lf(a,b){null!==a.Fh&&(a.Fh=null,b&&a.fr(),G&&G.qy||(a.lp=0,a.lv=[0,0,0,0,0],a.mp=0))}R.prototype.computePixelRatio=function(){return null!==this.Fh?this.Fh:ra.devicePixelRatio||1};R.prototype.doMouseMove=function(){this.currentTool.doMouseMove()}; R.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};R.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};R.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};R.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};R.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};R.prototype.doFocus=function(){this.focus()}; R.prototype.focus=function(){if(this.Ga)if(this.scrollsPageOnFocus)this.Ga.focus();else{var a=ra.scrollX||ra.pageXOffset,b=ra.scrollY||ra.pageYOffset;this.Ga.focus();ra.scrollTo(a,b)}};R.prototype.Jz=function(){this.D.V("GainedFocus")};R.prototype.Iz=function(){this.D.V("LostFocus")}; function Ch(a){if(null!==a.Ga){var b=a.Ja;if(0!==b.clientWidth&&0!==b.clientHeight){a.uv||a.setScrollWidth();var c=a.jf?a.ub:0,d=a.ze?a.ub:0,e=a.Yb;a.Yb=a.computePixelRatio();a.Yb!==e&&(a.Gl=!0,a.Kb());if(b.clientWidth!==a.Ba+c||b.clientHeight!==a.Aa+d)a.Bi=!0,a.Ic=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===Bh&&(a.Lj=!0,b.C()),a.fc||a.Kb()}}} function Di(a){var b=new oi;b.name="Background";a.ym(b);b=new oi;b.name="";a.ym(b);b=new oi;b.name="Foreground";a.ym(b);b=new oi;b.name="Adornment";b.isTemporary=!0;b.isInDocumentBounds=!1;a.ym(b);b=new oi;b.name="Tool";b.isTemporary=!0;b.isInDocumentBounds=!0;a.ym(b);b=new oi;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;b.isInDocumentBounds=!1;a.Zx(b,a.Ck("Background"))} function Wi(a){a.Ob=new W(W.Grid);a.Ob.name="GRID";var b=new Kf;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Ob.add(b);b=new Kf;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Ob.add(b);b=new Kf;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Ob.add(b);b=new Kf;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Ob.add(b);b=new Kf;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Ob.add(b);b=new Kf;b.figure= "LineV";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Ob.add(b);b=new U;b.add(a.Ob);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.Ob.visible=!1}function Xi(){this.D.bt?this.D.bt=!1:this.D.isEnabled?this.D.my(this):Yi(this.D)}function Zi(a){this.D.isEnabled?(this.D.ft=a.target.scrollTop,this.D.dt=a.target.scrollLeft):Yi(this.D)} R.prototype.my=function(a){if(null!==this.Ga){this.Wp=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.Vi,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,r=c.bottom;c=this.scale;var q=a.scrollLeft;if(this.Il)switch(this.Zs){case "negative":q=q+a.scrollWidth-a.clientWidth;break;case "reverse":q=a.scrollWidth-q-a.clientWidth}var u=q;m<g||n<h?(q=J.allocAt(this.position.x,this.position.y), this.allowHorizontalScroll&&this.dt!==u&&(q.x=u/c+e,this.dt=u),this.allowVerticalScroll&&this.ft!==a.scrollTop&&(q.y=a.scrollTop/c+f,this.ft=a.scrollTop),this.position=q,J.free(q),this.Bi=this.Wp=!1):(q=J.alloc(),a.oz&&this.allowHorizontalScroll&&(e<l&&(this.position=q.h(u+e,this.position.y)),k>p&&(this.position=q.h(-(this.et.scrollWidth-this.Ba)+u-this.Ba/c+k,this.position.y))),a.pz&&this.allowVerticalScroll&&(f<b&&(this.position=q.h(this.position.x,a.scrollTop+f)),d>r&&(this.position=q.h(this.position.x, -(this.et.scrollHeight-this.Aa)+a.scrollTop-this.Aa/c+d))),J.free(q),$i(this),this.Bi=this.Wp=!1,b=this.documentBounds,c=this.viewportBounds,k=b.right,p=c.right,d=b.bottom,r=c.bottom,e=b.x,l=c.x,f=b.y,b=c.y,m>=g&&e>=l&&k<=p&&(this.Xp.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.Xp.style.height="1px"))}};R.prototype.computeBounds=function(a){void 0===a&&(a=new M);wh(this);return aj(this,a)}; function aj(a,b){if(a.fixedBounds.s())return b.assign(a.fixedBounds),b.Dq(a.nb),b;for(var c=!0,d=a.Ra.l,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&g.isInDocumentBounds){g=g.Ka.l;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.assign(l)):b.Yc(l)))}}}c&&b.h(0,0,0,0);b.Dq(a.nb);return b} R.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Ha(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof T||(e.Xa(),null===c?c=e.actualBounds.copy():c.Yc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof T||(d.Xa(),null===c?c=d.actualBounds.copy():c.Yc(d.actualBounds));return null===c?new M(NaN,NaN,0,0):c}; function bj(a,b){if((b||a.Ae)&&!a.Xb&&null!==a.Ga&&a.documentBounds.s()){if(b){var c=a.initialPosition;if(c.s()){a.position=c;return}c=J.alloc();c.yj(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=M.allocAt(0,0,d.width,d.height);var e=J.alloc();e.yj(d,a.initialViewportSpot);e.h(c.x-e.x,c.y-e.y);a.position=e;M.free(d);J.free(e);J.free(c)}a.Xb=!0;c=a.Yg;b&&a.jg!==Bh&&(c=a.jg);var f=c!==Bh?cj(a,c):a.scale;c=a.oa.x;d=a.oa.y;e=a.Ba/f;var g=a.Aa/f,h=a.Hj,k=a.Co;b&&!h.fb()&&(k.fb()||k.Jb())&& (h=k.Jb()?Jc:k);dj(a,a.documentBounds,e,g,h,b);b=a.scale;a.scale=f;a.Xb=!1;f=a.viewportBounds;if(!(K.A(f.I,c)&&K.A(f.J,d)&&K.A(f.fa,e)&&K.A(f.ea,g)))a.onViewportBoundsChanged(new M(c,d,e,g),f,b,!1);ej(a);fj(a,!0,!1)}} function cj(a,b){var c=a.Zn;if(null===a.Ga)return c;a.Xa();var d=a.documentBounds;if(!d.s())return c;var e=d.width;d=d.height;var f=a.Ba+(a.jf?a.ub:0),g=a.Aa+(a.ze?a.ub:0),h=f/e,k=g/d;return b===gj?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===hj?(b=k>h?(g-a.ub)/d:(f-a.ub)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale} R.prototype.zoomToFit=function(){var a=this.Wi;this.Wi=bi;this.scale=cj(this,gj);a!==bi&&(bj(this,!1),dj(this,this.documentBounds,this.Ba/this.wa,this.Aa/this.wa,this.Hj,!1));this.Wi=a};t=R.prototype; t.yB=function(a,b){void 0===b&&(b=gj);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===gj||b===hj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.Ba;var f=this.Aa;e=b===hj?f/d>e/c?(f-(this.ze?this.ub:0))/d:(e-(this.jf?this.ub:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new J(a.x,a.y)}}; t.Bz=function(a,b){this.Xa();var c=this.documentBounds,d=this.viewportBounds;this.position=new J(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))};t.vA=function(a){if(a instanceof O){this.lo=a;var b=J.alloc();this.mo=this.nr(a.ja(Dc,b));J.free(b)}else this.lo=null,this.mo=Pb}; function dj(a,b,c,d,e,f){var g=J.allocAt(a.oa.x,a.oa.y),h=g.x,k=g.y;if(null!==a.lo){var l=J.alloc();l=a.lo.ja(Dc,l);h=l.x-a.mo.x/a.scale;k=l.y-a.mo.y/a.scale;e=Cc;J.free(l)}if(f||a.scrollMode===bi)e.fb()&&(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.Vi,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.nb.left;g.y=isFinite(k)?k:-a.nb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.$c.yc&&Yh(a.$c,a.oa,g);a.oa.h(g.x,g.y);J.free(g)} t.Gm=function(a,b){void 0===b&&(b=!0);if(b){if(a=zf(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof U)return a}else if(a=zf(this,a,function(a){return a.part}),a instanceof U)return a;return null};t.ac=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);wh(this);for(var d=this.Ra.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.ac(a,b,c),null!==e))return e}return null}; function zf(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);wh(a);for(a=a.Ra.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.ac(b,c,d),null!==e))return e}return null}t.iA=function(a,b,c){void 0===b&&(b=!0);return ij(this,a,function(a){return a.part},b?function(a){return a instanceof U&&a.canSelect()}:null,c)}; function ij(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof H||e instanceof I||(e=new I);wh(a);for(a=a.Ra.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.lj(b,c,d,e)}return e}t.lj=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof H||d instanceof I||(d=new I);wh(this);for(var e=this.Ra.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.lj(a,b,c,d)}return d}; t.xy=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return jj(this,a,function(a){return a instanceof U&&(!c||a.canSelect())},b,d)};t.Nf=function(a,b,c,d,e){void 0===b&&(b=null);void 0===c&&(c=null);void 0===d&&(d=!1);e instanceof H||e instanceof I||(e=new I);wh(this);for(var f=this.Ra.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.Nf(a,b,c,d,e)}return e}; t.cw=function(a,b,c,d,e,f){var g=new I;wh(this);for(var h=this.Ra.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.cw(a,b,c,d,g,e,f)}return g};function jj(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 H||e instanceof I||(e=new I);wh(a);for(a=a.Ra.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.Nf(b,f,c,d,e)}return e} t.jA=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return kj(this,a,b,function(a){return a instanceof U&&(!d||a.canSelect())},c,e)};t.Og=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 H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);wh(this);for(var g=this.Ra.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.Og(a,b,c,d,e,f)}return f}; function kj(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 H||e instanceof I)f=e;e=!0}f instanceof H||f instanceof I||(f=new I);wh(a);for(a=a.Ra.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.Og(b,c,g,d,e,f)}return f}R.prototype.acceptEvent=function(a){return lj(this,a,a instanceof MouseEvent)}; function lj(a,b,c){var d=a.tf;a.tf=a.sh;a.sh=d;d.diagram=a;d.event=b;c?mj(a,b,d):(d.viewPoint=a.tf.viewPoint,d.documentPoint=a.tf.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&&(d.buttons=b.buttons);$a&&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=nj(b);d.targetObject=null;return d} function nj(a){var b=a.target.D;if(b)return b;(b=a.path)||"function"!==typeof a.composedPath||(b=a.composedPath());return b&&b[0]?b[0].D:null} function oj(a,b,c,d,e,f){var g=a.tf;a.tf=a.sh;a.sh=g;g.diagram=a;g.clickCount=1;a=g.delta=0;b.ctrlKey&&(a+=1);b.altKey&&(a+=2);b.shiftKey&&(a+=4);b.metaKey&&(a+=8);g.modifiers=a;g.event=b;g.timestamp=b.timeStamp;g.button=b.button;g.buttons=b.buttons;$a&&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 pj(a,b,c){if(b.bubbles)return G&&G.Hy&&Fa("NOT handled "+c.type+" "+b.toString()),!0;G&&G.Hy&&Fa("handled "+c.type+" "+a.currentTool.name+" "+b.toString());void 0!==c.stopPropagation&&c.stopPropagation();!1!==c.cancelable&&c.preventDefault();c.cancelBubble=!0;return!1} R.prototype.MA=function(a){var b=this.D;if(!this.D.isEnabled)return!1;var c=lj(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 pj(b,c,a)}; R.prototype.NA=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=lj(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 pj(b,c,a)}; R.prototype.Wz=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=lj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return pj(b,c,a)};R.prototype.Xz=function(a){var b=this.D;if(!b.isEnabled)return!1;var c=lj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return pj(b,c,a)}; R.prototype.getMouse=function(a){var b=this.Ga;if(null===b)return new J(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.Ba/c.width*c.left;a=a.clientY-this.Aa/c.height*c.top;return null!==this.vb?Gb(new J(b,a),this.vb):new J(b,a)}; function mj(a,b,c){var d=a.Ga,e=a.Ba,f=a.Aa,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.vb?(b=J.allocAt(g,h),a.vb.Md(b),c.documentPoint.assign(b),J.free(b)):c.documentPoint.h(g,h)} function pe(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.hk[0])b=a.hk[c];else return;c=a.Ga;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.Ba/c.width*c.left,b.clientY-a.Aa/c.height*c.top))}R.prototype.Va=function(){this.Ai||(this.Ai=!0,this.Kb(!0))};function qj(a){a.fc||wh(a);a.Xa()}R.prototype.redraw=function(){this.Xb||this.fc||(this.R(),ej(this),this.nd())};t=R.prototype;t.LA=function(){return this.Re}; t.Rz=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.tc();b.isEnabled=!1;Hf(this);this.Ae=!1;this.$s=new J(NaN,NaN);b.isEnabled=c;this.fc=!0;var d=this;null!==a&&ua(function(){d.fc=!1;uh(b,"Model");a(d)},1)};t.Kb=function(a){void 0===a&&(a=!1);if(!0!==this.Re&&!(this.Xb||!1===a&&this.fc)){this.Re=!0;var b=this;ra.requestAnimationFrame(function(){b.Re&&b.nd()})}};t.nd=function(){if(!this.Oj||this.Re)this.Oj&&(this.Oj=!1),Hf(this)}; function fj(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.Xb||!a.Bi||Yi(a)||(b&&wh(a),c&&bj(a,!1))} function Hf(a,b){if(!a.fc&&(a.Re=!1,null!==a.Ja||a.wm.s())){a.fc=!0;var c=a.animationManager,d=a.$l;if(!c.isAnimating&&0!==d.length){for(var e=d.l,f=e.length,g=0;g<f;g++){var h=e[g];rj(h,!1);h.v()}d.clear()}d=a.Vu;0<d.count&&(d.each(function(a){a.Xw()}),d.clear());e=d=!1;c.defaultAnimation.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.yc||Ch(a);fj(a,!1,!0);null!==a.Ob&&(a.Ob.visible&&!a.yo&&(sj(a),a.yo=!0),!a.Ob.visible&&a.yo&&(a.yo=!1));wh(a);f=!1;if(!a.Ae||a.Xg)a.Ae?tj(a,!a.Lj): (a.Da("Initial Layout"),!1===c.isEnabled&&c.tc(),tj(a,!1)),f=!0;a.Lj=!1;wh(a);a.nt||qj(a);fj(a,!0,!1);g=!1;f?(c=M.alloc(),c.assign(a.viewportBounds),a.Ae||(g=a.Ae=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,uj(a)),a.V("LayoutCompleted"),c.B(a.viewportBounds)||fj(a,!0,!1),M.free(c)):c.Bl&&c.Vx&&(a.jg!==Bh?a.scale=cj(a,a.jg):a.Yg!==Bh?a.scale=cj(a,a.Yg):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),bj(a,!0));wh(a);f&&g&&a.cb("Initial Layout");a.Nv(); b||a.rc(a.Db);e&&(a.skipsUndoManager=d);a.fc=!1}}function uj(a){var b=a.wa;if(a.jg!==Bh)a.scale=cj(a,a.jg);else if(a.Yg!==Bh)a.scale=cj(a,a.Yg);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.wa!==b&&(ej(a),fj(a,!0,!1));bj(a,!0);b=a.Ra.l;a.Qd(b,b.length,a);a.V("InitialLayoutCompleted");a.$s.assign(a.oa);sj(a)} function wh(a){if(0!==a.be.count&&(a.fc||!a.animationManager.isTicking)){for(var b=0;23>b;b++){var c=a.be.iterator;if(null===c||0===a.be.count)break;a.be=new I;a.Xw(c,a.be);G&&22===b&&Fa("failure to validate parts")}a.nodes.each(function(a){a instanceof yf&&0!==(a.U&65536)!==!1&&(a.U=a.U^65536)})}} t.Xw=function(a,b){for(a.reset();a.next();){var c=a.value;!c.Uc()||c instanceof yf||(c.wj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof yf&&c.isVisible()&&vj(this,c);for(a.reset();a.next();)c=a.value,c instanceof T&&c.isVisible()&&(c.wj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Le&&c.isVisible()&&(c.wj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}; function vj(a,b){for(var c=Ma(),d=Ma(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof yf?(wj(f)||xj(f)||yj(f))&&vj(a,f):f instanceof T?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.Qd=function(a,b,c,d){if(this.Ci||this.animationManager.isAnimating){void 0===d&&(d=c.viewportBounds);for(var e=0;e<b;e++)a[e].Qd(c,d)}}; t.rc=function(a,b){void 0===b&&(b=null);if(null!==this.Ja){null===this.Ga&&v("No canvas specified");var c=this.animationManager;if(!c.yc&&(!c.isAnimating||c.isTicking)){var d=new Date;zj(this);if("0"!==this.Ja.style.opacity){var e=a!==this.Db,f=this.Ra.l,g=f.length,h=this;this.Qd(f,g,h);if(e)a.Oc(!0),$i(this);else if(!this.Ic&&null===b&&!c.isAnimating)return;g=this.oa;var k=this.wa,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.vb;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m); k=this.Yb;a.setTransform(k,0,0,k,0,0);a.clearRect(0,0,this.Ba,this.Aa);1!==this.mb&&(a.globalAlpha=this.mb);G&&G.Am&&G.Vv&&(a.setTransform(c.m11*k,c.m12*k,c.m21*k,c.m22*k,c.dx,c.dy),G.Vv(this,a));Aj(this,a);l=null!==b?function(c){var d=b;if(c.visible&&0!==c.mb){var e=c.Ka.l,f=e.length;if(0!==f){var g=qi(c,a),k=c.Ap;k.length=0;for(var l=h.scale,m=M.alloc(),n=0;n<f;n++){var D=e[n];d.contains(D)||c.gj(a,D,h,k,l,m,!0)}M.free(m);a.globalAlpha=g}}}:function(b){b.rc(a,h)};g=f.length;for(m=0;m<g;m++)a.setTransform(k, 0,0,k,0,0),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);f=!1;this.zi?Bj(this.zi,this)&&(f=this.$r()):f=!0;f&&(Fb.prototype.Md=Fb.prototype.gy);G&&(G.sy||G.Am)&&G.Wv&&G.Wv(a,this,c);e?(this.Db.Oc(!0),$i(this)):this.Ic=this.Ci=!1;f=+new Date-+d;e=G&&G.qy;d=this.lv;if(e||null===this.Fh){d[this.mp]=f;this.mp=(this.mp+1)%d.length;for(c=f=0;c<d.length;c++)f+=d[c];this.lp=f/d.length}1!==this.mb&&(a.globalAlpha=1);if(e)for(a.setTransform(1,0,0,1,0,0),e=0;e<d.length;e++)a.fillText(d[e].toString(), 20,150+ +(20*e))}}}}; function Cj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ja){null===a.Ga&&v("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);zj(a);a.Db.Oc(!0);$i(a);a.Di=!0;var m=a.wa;a.wa=e;var n=a.Ra.l,p=n.length;try{var r=new M(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.Dq(c);sj(a,q);wh(a);a.Qd(n,p,a,r);b.setTransform(1,0,0,1,0,0);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var u=a.Yb;b.scale(u,u);var y=Fb.alloc(); y.reset();y.translate(c.left,c.top);y.scale(e);0===f.x&&0===f.y||y.translate(-f.x,-f.y);b.setTransform(y.m11,y.m12,y.m21,y.m22,y.dx,y.dy);Fb.free(y);Aj(a,b);b.globalAlpha=a.mb;var x=a.Ck("Grid");if(g){var z=new I,B=g.iterator;for(B.reset();B.next();){var D=B.value;D instanceof U&&(l||D.layer!==x)&&z.add(D)}for(l=0;l<p;l++){var F=n[l];x=b;var L=a;if(F.visible&&0!==F.mb&&(k||!F.isTemporary)){var Z=F.Ka.l,Q=Z.length;if(0!==Q){var ba=qi(F,x),S=F.Ap;S.length=0;var P=L.scale,xa=M.alloc();for(c=0;c<Q;c++){var ka= Z[c];z.contains(ka)&&F.gj(x,ka,L,S,P,xa,!1)}M.free(xa);x.globalAlpha=ba}}}}else for(z=0;z<p;z++)L=n[z],L===x?l&&L.rc(b,a,!0):L.rc(b,a,k);a.Di=!1;a.zi&&Bj(a.zi,a)&&a.$r()}finally{a.wa=m,a.Db.Oc(!0),$i(a),a.Qd(n,p,a),sj(a)}}}t.Ve=function(a){return this.vf[a]};t.Yy=function(a,b){"minDrawingLength"===a&&(this.gp=b);this.vf[a]=b;this.redraw()}; t.Ew=function(){this.vf=new gb;this.vf.drawShadows=!0;this.vf.textGreeking=!0;this.vf.viewportOptimizations=ab||Wa?!1:!0;this.vf.temporaryPixelRatio=!0;this.vf.pictureRatioOptimization=!0;this.gp=this.vf.minDrawingLength=1};function Aj(a,b){a=a.vf;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.Xy(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.Im=function(a){return this.Rj[a]};t.mB=function(a,b){this.Rj[a]=b}; t.Dw=function(){this.Rj=new gb;this.Rj.extraTouchArea=10;this.Rj.extraTouchThreshold=10;this.Rj.hasGestureZoom=!0};t.set=function(a){if(G)for(var b in a)(b.startsWith("_")||-1!==b.indexOf("."))&&v("Property with underscore or period passed to Diagram.set. Did you mean to use Diagram.assign?");Object.assign(this,a);return this};t.Lv=function(a){return this.en(a)};t.en=function(a){Dj(this,a);return this}; function Dj(a,b){var c=a instanceof W,d=a instanceof R,e;for(e in b){""===e&&v("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.eb(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];Ga(f)?g=e.substr(h+1):v("Unable to find object named: "+k+" in "+a.toString()+" when trying to set property: "+e)}}if("_"!==g[0]&&!Ra(f,g))if(d&&"ModelChanged"===g){a.ay(b[g]);continue}else if(d&&"Changed"===g){a.Oh(b[g]);continue}else if(d&& Ra(a.toolManager,g))f=a.toolManager;else if(d&&Ej(a,g)){a.qk(g,b[g]);continue}else if(a instanceof X&&"Changed"===g){a.Oh(b[g]);continue}else v('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof O&&f.Yx(g)}}t.Nv=function(){if(0===this.undoManager.transactionLevel&&0!==this.gh.count){for(;0<this.gh.count;){var a=this.gh;this.gh=new zb;for(a=a.iterator;a.next();){var b=a.key;b.Wq(a.value);b.ic(!1)}}this.R()}}; t.R=function(a){void 0===a&&(a=null);if(null===a)this.Ic=!0,this.Kb();else{var b=this.viewportBounds;null!==a&&a.s()&&b.Tc(a)&&(this.Ic=!0,this.Kb())}this.V("InvalidateDraw")}; R.prototype.invalidateViewport=function(a,b){if(!0!==this.Ic){this.Ic=!0;var c=!0===this.Ve("temporaryPixelRatio");if(!0===this.Ve("viewportOptimizations")&&this.scrollMode!==di&&this.Vi.ij(0,0,0,0)&&b.width===a.width&&b.height===a.height){var d=this.scale,e=Math.max(a.x,b.x),f=Math.max(a.y,b.y);d=M.allocAt(e,f,Math.max(0,Math.min(a.x+a.width,b.x+b.width)-e)*d,Math.max(0,Math.min(a.y+a.height,b.y+b.height)-f)*d);if(!this.pq&&0<d.width&&0<d.height){if(!(this.fc||(this.Re=!1,null===this.Ja||(this.fc= !0,this.Nv(),this.documentBounds.s()||(e=M.alloc(),Fj(this,this.computeBounds(e)),M.free(e)),e=this.Ga,null===e||e instanceof Gj)))){var g=this.Yb;f=this.Ba*g;var h=this.Aa*g,k=this.scale*g,l=Math.round(Math.round(b.x*k)-Math.round(a.x*k));b=Math.round(Math.round(b.y*k)-Math.round(a.y*k));k=this.Lu;a=this.yx;k.width!==f&&(k.width=f);k.height!==h&&(k.height=h);a.clearRect(0,0,f,h);k=190*g;var m=70*g,n=Math.max(l,0),p=Math.max(b,0),r=Math.floor(f-n),q=Math.floor(h-p);a.drawImage(e.Qa,n,p,r,q,0,0,r, q);Bj(this.zi,this)&&a.clearRect(0,0,k,m);e=Ma();a=Ma();q=Math.abs(l);r=Math.abs(b);var u=0===n?0:f-q;n=J.allocAt(u,0);q=J.allocAt(q+u,h);a.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));var y=this.vb;y.reset();y.scale(g,g);1!==this.wa&&y.scale(this.wa);g=this.oa;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&y.translate(-g.x,-g.y);Gb(n,y);Gb(q,y);e.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));u=0===p?0:h-r;n.h(0,u); q.h(f,r+u);a.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));Gb(n,y);Gb(q,y);e.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));Bj(this.zi,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),q.h(k+f,m+h),a.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))),Gb(n,y),Gb(q,y),e.push(new M(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))));J.free(n);J.free(q);fj(this,!1,!0);null===this.Ja&& v("No div specified");null===this.Ga&&v("No canvas specified");if(!this.animationManager.yc&&(f=this.Db,this.Ic)){zj(this);h=this.Yb;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.Ba*h,this.Aa*h);f.drawImage(this.Lu.Qa,0<l?0:Math.round(-l),0<b?0:Math.round(-b));b=this.oa;g=this.wa;k=Math.round(b.x*g)/g;m=Math.round(b.y*g)/g;l=this.vb;l.reset();1!==g&&l.scale(g);0===b.x&&0===b.y||l.translate(-k,-m);f.save();f.beginPath();b=a.length;for(g=0;g<b;g++)k=a[g],0!==k.width&&0!==k.height&&f.rect(Math.floor(k.x), Math.floor(k.y),Math.ceil(k.width),Math.ceil(k.height));f.clip();f.setTransform(1,0,0,1,0,0);f.scale(h,h);f.transform(l.m11,l.m12,l.m21,l.m22,l.dx,l.dy);G&&G.Am&&G.Vv&&G.Vv(this,f);h=this.Ra.l;b=h.length;this.Qd(h,b,this);Aj(this,f);f.globalAlpha=this.mb;for(g=0;g<b;g++)if(k=h[g],m=e,k.visible&&0!==k.mb){p=qi(k,f);n=k.Ap;n.length=0;r=this.scale;q=M.alloc();y=k.Ka.l;u=y.length;for(var x=m.length,z=0;z<u;z++){var B=y[z];a:{var D=Hj(B,B.actualBounds);for(var F=m,L=x,Z=2/r,Q=4/r,ba=0;ba<L;ba++){var S= F[ba];if(0!==S.width&&0!==S.height&&D.kw(S.x-Z,S.y-Z,S.width+Q,S.height+Q)){D=!0;break a}}D=!1}D&&k.gj(f,B,this,n,r,q,!0)}M.free(q);f.globalAlpha=p}f.restore();f.Oc(!0);G&&(G.sy||G.Am)&&G.Wv&&G.Wv(f,this,l);this.zi&&Bj(this.zi,this)&&this.$r();this.Ic=this.Ci=!1;this.fr()}Oa(e);Oa(a);this.fc=!1}}else this.nd();M.free(d);c&&(af(this),this.nd(),lf(this,!0))}else c?(af(this),this.nd(),lf(this,!0)):this.nd()}};function ej(a){!1===a.Bi&&(a.Bi=!0)}function $i(a){!1===a.Ci&&(a.Ci=!0)} function zj(a){!1!==a.Gl&&(a.Gl=!1,Ij(a,a.Ba,a.Aa))}function Ij(a,b,c){var d=a.Yb;a.Ga.resize(b*d,c*d,b,c)&&(a.Ic=!0,a.Db.Oc(!0))} function Yi(a){var b=a.Ga;if(null===b||a.wm.s())return!0;var c=a.Ja,d=a.Ba,e=a.Aa,f=a.viewportBounds;if(!a.viewportBounds.s())return!0;var g=!1,h=a.jf?a.ub:0,k=a.ze?a.ub:0,l=c.clientWidth||d+h,m=c.clientHeight||e+k;if(l!==d+h||m!==e+k)a.jf=!1,a.ze=!1,k=h=0,a.Ba=l,a.Aa=m,g=a.Gl=!0;if(!(g||a.jf||a.ze||a.xl||a.yl))return!0;a.Bi=!1;c=f.x;var n=f.y,p=f.width,r=f.height;f=a.viewportBounds;var q=a.documentBounds,u=0,y=0,x=0,z=0,B=f.width,D=f.height,F=a.Vi;a.contentAlignment.fb()?(q.width>B&&(u=F.left,y= F.right),q.height>D&&(x=F.top,z=F.bottom)):(u=F.left,y=F.right,x=F.top,z=F.bottom);F=q.width+u+y;var L=q.height+x+z;u=q.x-u;var Z=f.x;y=q.right+y;var Q=f.right+h;x=q.y-x;var ba=f.y;q=q.bottom+z;z=f.bottom+k;var S="1px",P="1px";f=a.scale;l=F>l/f;m=L>m/f;a.scrollMode===bi&&(l||m)&&(l&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l=1,u+1<Z&&(l=Math.max((Z-u)*f+a.Ba,l)),y>Q+1&&(l=Math.max((y-Q)*f+a.Ba,l)),B+h+1<F&&(l=Math.max((F-B)*f+a.Ba,l)),S=l.toString()+"px"),m&&a.hasVerticalScrollbar&&a.allowVerticalScroll&& (l=1,x+1<ba&&(l=Math.max((ba-x)*f+a.Aa,l)),q>z+1&&(l=Math.max((q-z)*f+a.Aa,l)),D+k+1<L&&(l=Math.max((L-D)*f+a.Aa,l)),P=l.toString()+"px"));l="1px"!==S;m="1px"!==P;l&&m||!l&&!m||(m&&(Q-=a.ub),l&&(z-=a.ub),F<B+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,u+1<Z&&(h=Math.max((Z-u)*f+a.Ba,h)),y>Q+1&&(h=Math.max((y-Q)*f+a.Ba,h)),B+1<F&&(h=Math.max((F-B)*f+a.Ba,h)),S=h.toString()+"px"),l="1px"!==S,h=a.Aa,l!==a.ze&&(h=l?a.Aa-a.ub:a.Aa+a.ub),L<D+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll|| (k=1,x+1<ba&&(k=Math.max((ba-x)*f+h,k)),q>z+1&&(k=Math.max((q-z)*f+h,k)),D+1<L&&(k=Math.max((L-D)*f+h,k)),P=k.toString()+"px"),m="1px"!==P);if(a.Wp&&l===a.ze&&m===a.jf)return d===a.Ba&&e===a.Aa||a.nd(),!1;l!==a.ze&&("1px"===S?a.Aa=a.Aa+a.ub:a.Aa=Math.max(a.Aa-a.ub,1),g=!0);a.ze=l;a.Xp.style.width=S;m!==a.jf&&("1px"===P?a.Ba=a.Ba+a.ub:a.Ba=Math.max(a.Ba-a.ub,1),g=!0,a.Il&&(k=J.alloc(),m?(b.style.left=a.ub+"px",a.position=k.h(a.oa.x+a.ub/a.scale,a.oa.y)):(b.style.left="0px",a.position=k.h(a.oa.x-a.ub/ a.scale,a.oa.y)),J.free(k)));a.jf=m;a.Xp.style.height=P;a.bt=!0;g&&(a.Gl=!0);b=a.et;k=b.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(B+1<F?k=(a.position.x-u)*f:u+1<Z?k=b.scrollWidth-b.clientWidth:y>Q+1&&(k=a.position.x*f));if(a.Il)switch(a.Zs){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(D+1<L?b.scrollTop=(a.position.y-x)*f:x+1<ba?b.scrollTop=b.scrollHeight-b.clientHeight: q>z+1&&(b.scrollTop=a.position.y*f));l=a.Ba;m=a.Aa;b.style.width=l+(a.jf?a.ub:0)+"px";b.style.height=m+(a.ze?a.ub:0)+"px";return d!==l||e!==m||a.animationManager.yc?(d=M.allocAt(c,n,p,r),a.onViewportBoundsChanged(d,a.viewportBounds,f,g),M.free(d),!1):!0}t=R.prototype; t.add=function(a){w(a,U,R,"add:part");var b=a.diagram;if(b!==this&&(null!==b&&v("Cannot add part "+a.toString()+" to "+this.toString()+". It is already a part of "+b.toString()),b=this.Ck(a.layerName),null===b&&(b=this.Ck("")),null===b&&v('Cannot add a Part when unable find a Layer named "'+a.layerName+'" and there is no default Layer'),a.layer!==b)){var c=b.rj(99999999,a,a.diagram===this);0<=c&&this.ab(ue,"parts",b,null,a,null,c);b.isTemporary||this.Va();a.C(1);c=a.layerChanged;null!==c&&c(a,null, b)}};t.rj=function(a){this.partManager.rj(a);var b=this;Jj(a,function(a){Kj(b,a)});(a instanceof Le||a instanceof yf&&null!==a.placeholder)&&a.v();null!==a.data&&Jj(a,function(a){Lj(b.partManager,a)});!0!==xj(a)&&!0!==yj(a)||this.be.add(a);Mj(a,!0,this);Nj(a)?(a.actualBounds.s()&&this.R(Hj(a,a.actualBounds)),this.Va()):a.isVisible()&&a.actualBounds.s()&&this.R(Hj(a,a.actualBounds));this.Kb()}; t.Sc=function(a){a.tk();this.partManager.Sc(a);var b=this;null!==a.data&&Jj(a,function(a){Oj(b.partManager,a,b)});this.be.remove(a);Nj(a)?(a.actualBounds.s()&&this.R(Hj(a,a.actualBounds)),this.Va()):a.isVisible()&&a.actualBounds.s()&&this.R(Hj(a,a.actualBounds));this.Kb()};t.remove=function(a){w(a,U,R,"remove:part");Pj(this,a,!0)}; function Pj(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.C(2),c&&b.zk(),c=d.Sc(-1,b,!1),0<=c&&a.ab(ve,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.mu=function(a,b){void 0===b&&(b=!1);if(Ha(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 I,c.addAll(a),a=c.iterator;a.next();)c=a.value,b&&!c.canDelete()||this.remove(c)};t.yk=function(a,b,c){void 0===c&&(c=!1);return this.partManager.yk(a,b,c)}; R.prototype.moveParts=function(a,b,c,d){void 0===c&&(c=!1);void 0===d&&(d=Qj(this));w(b,J,R,"moveParts:offset");if(null!==this.toolManager){var e=new zb;if(null!==a)if(Ha(a))for(var f=0;f<a.length;f++)Rj(this,e,a[f],c,d);else for(a=a.iterator;a.next();)Rj(this,e,a.value,c,d);else{for(a=this.parts;a.next();)Rj(this,e,a.value,c,d);for(a=this.nodes;a.next();)Rj(this,e,a.value,c,d);for(a=this.links;a.next();)Rj(this,e,a.value,c,d)}vf(this,e,b,d,c)}}; function Rj(a,b,c,d,e,f){if(!b.contains(c)&&(void 0===f&&(f=!1),!d||f||c.canMove()||c.canCopy()))if(void 0===e&&(e=Qj(a)),c instanceof V){b.add(c,a.Fd(e,c,c.location));if(c instanceof yf&&(null!==c.placeholder||e.dragsMembers))for(f=c.memberParts;f.next();)Rj(a,b,f.value,d,e,e.groupsAlwaysMove);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)&&Rj(a,b,g,d,e)}}if(e.dragsTree)for(c=c.dw();c.next();)Rj(a,b, c.value,d,e)}else if(c instanceof T)for(b.add(c,a.Fd(e,c)),c=c.labelNodes;c.next();)Rj(a,b,c.value,d,e);else c instanceof Le||b.add(c,a.Fd(e,c,c.location))} function vf(a,b,c,d,e){if(null!==b&&(w(b,zb,R,"moveParts:parts"),0!==b.count)){var f=J.alloc(),g=J.alloc();g.assign(c);isNaN(g.x)&&(g.x=0);isNaN(g.y)&&(g.y=0);(c=a.oq)||bf(a,b);for(var h=Ma(),k=Ma(),l=b.iterator,m=J.alloc();l.next();){var n=l.key,p=l.value;if(n.Uc()){var r=Sj(a,n,b);if(null!==r)h.push(new Tj(n,p,r));else if(!e||n.canMove())r=p.point,f.assign(r),a.computeMove(n,f.add(g),d,m),n.location=m,void 0===p.shifted&&(p.shifted=new J),p.shifted.assign(m.oe(r))}else l.key instanceof T&&k.push(l.qa)}J.free(m); e=h.length;for(l=0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.hw.shifted&&(n.hw.shifted=new J),n.node.location=f.add(n.hw.shifted);e=J.alloc();l=J.alloc();n=k.length;for(p=0;p<n;p++){var q=k[p];r=q.key;if(r instanceof T)if(r.suspendsRouting){r.wf=null;m=r.fromNode;var u=r.toNode;if(null!==a.draggedLink&&d.dragsLink)if(u=q.value.point,null===r.dragComputation)b.add(r,a.Fd(d,r,g)),tf(r,g.x-u.x,g.y-u.y);else{q=J.allocAt(0,0);(m=r.i(0))&&m.s()&&q.assign(m);var y=m=J.alloc().assign(q).add(g);d.isGridSnapEnabled&& (d.isGridSnapRealtime||a.lastInput.up)&&(y=J.alloc(),Jg(a,r,m,y,d));m.assign(r.dragComputation(r,m,y)).oe(q);b.add(r,a.Fd(d,r,m));tf(r,m.x-u.x,m.y-u.y);J.free(q);J.free(m);y!==m&&J.free(y)}else null!==m&&(e.assign(m.location),y=b.K(m),null!==y&&e.oe(y.point)),null!==u&&(l.assign(u.location),y=b.K(u),null!==y&&l.oe(y.point)),null!==m&&null!==u?e.Ya(l)?(m=q.value.point,u=f,u.assign(e),u.oe(m),b.add(r,a.Fd(d,r,e)),tf(r,u.x,u.y)):(r.suspendsRouting=!1,r.Za()):(q=q.value.point,m=null!==m?e:null!==u?l: g,b.add(r,a.Fd(d,r,m)),tf(r,m.x-q.x,m.y-q.y))}else if(null===r.fromNode||null===r.toNode)m=q.value.point,b.add(r,a.Fd(d,r,g)),tf(r,g.x-m.x,g.y-m.y)}J.free(f);J.free(g);J.free(e);J.free(l);Oa(h);Oa(k);c||(wh(a),gf(a,b))}} R.prototype.computeMove=function(a,b,c,d){void 0===d&&(d=new J);d.assign(b);if(null===a)return d;var e=b,f=c.isGridSnapEnabled;f&&(c.isGridSnapRealtime||this.lastInput.up)&&(e=J.alloc(),Jg(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(1E3*a.location.x)/1E3:a.location.x);g=g.y;isNaN(g)&&(g=f?Math.round(1E3*a.location.y)/1E3:a.location.y);var k=a.maxLocation,l=k.x;isNaN(l)&&(l=f?Math.round(1E3*a.location.x)/1E3:a.location.x); k=k.y;isNaN(k)&&(k=f?Math.round(1E3*a.location.y)/1E3:a.location.y);d.h(Math.max(h,Math.min(c.x,l)),Math.max(g,Math.min(c.y,k)));e!==b&&J.free(e);return d};function Qj(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.kl} function Jg(a,b,c,d,e){void 0===e&&(e=Qj(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=J.allocAt(0,0);f.zj(0,0,a,b,e);K.Oq(c.x,c.y,h+f.x,g+f.y,a,b,d);J.free(f)}}function bf(a,b){if(null!==b)for(a.oq=!0,a=b.iterator;a.next();)b=a.key,b instanceof T&&(b.suspendsRouting=!0)} function gf(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof T&&(c.suspendsRouting=!1,Uj(c)&&c.Za())}a.oq=!1}}function Sj(a,b,c){b=b.containingGroup;if(null!==b){a=Sj(a,b,c);if(null!==a)return a;a=c.K(b);if(null!==a)return a}return null}t=R.prototype;t.Fd=function(a,b,c){if(void 0===c)return new ef(Lb);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new ef(new J(Math.round(1E3*c.x)/1E3,Math.round(1E3*c.y)/1E3)):new ef(c.copy())}; function Vj(a,b,c){w(b,oi,R,"addLayer:layer");null!==b.diagram&&b.diagram!==a&&v("Cannot share a Layer with another Diagram: "+b+" of "+b.diagram);null===c?null!==b.diagram&&v("Cannot add an existing Layer to this Diagram again: "+b):(w(c,oi,R,"addLayer:existingLayer"),c.diagram!==a&&v("Existing Layer must be in this Diagram: "+c+" not in "+c.diagram),b===c&&v("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.M(d).name===b&&v("Cannot add Layer with the name '"+ b+"'; a Layer with the same name is already present in this Diagram.")}}t.ym=function(a){Vj(this,a,null);a.me(this);var b=this.Ra,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.M(c).isTemporary;)c--;b.zb(c+1,a);null!==this.hc&&this.ab(ue,"layers",this,null,a,null,c+1);this.R();this.Va();return this}; t.Zx=function(a,b){Vj(this,a,b);a.me(this);var c=this.Ra,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.hc&&this.ab(ve,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.M(f)===b){c.zb(f,a);break}null!==this.hc&&this.ab(ue,"layers",this,null,a,null,f);this.R();0>d&&this.Va();return this}; t.vz=function(a,b){Vj(this,a,b);a.me(this);var c=this.Ra,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.hc&&this.ab(ve,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.M(f)===b){c.zb(f+1,a);break}null!==this.hc&&this.ab(ue,"layers",this,null,a,null,f+1);this.R();0>d&&this.Va();return this}; t.eB=function(a){w(a,oi,R,"removeLayer:layer");a.diagram!==this&&v("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.Ka.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.hc&&this.ab(ve,"layers",this,a,null,c,null);this.R();this.Va()}}};t.Ck=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null}; t.ay=function(a){A(a,"function",R,"addModelChangedListener:listener");null===this.He&&(this.He=new H);this.He.add(a);this.model.Oh(a);return this};t.gB=function(a){A(a,"function",R,"removeModelChangedListener:listener");null!==this.He&&(this.He.remove(a),0===this.He.count&&(this.He=null));this.model.Tk(a)};t.Oh=function(a){A(a,"function",R,"addChangedListener:listener");null===this.ag&&(this.ag=new H);this.ag.add(a);return this}; t.Tk=function(a){A(a,"function",R,"removeChangedListener:listener");null!==this.ag&&(this.ag.remove(a),0===this.ag.count&&(this.ag=null))};t.Gt=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.iw(a);a.change!==te&&(this.isModified=!0);if(null!==this.ag)for(var b=this.ag,c=b.length,d=0;d<c;d++)b.M(d)(a)}; t.ab=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new re;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.Gt(h)};t.g=function(a,b,c,d,e){this.ab(se,a,this,b,c,d,e)}; R.prototype.changeState=function(a,b){if(null!==a&&a.diagram===this){var c=this.skipsModelSourceBindings;try{this.skipsModelSourceBindings=!0;var d=a.change;if(d===se){var e=a.object;Wj(e,a.propertyName,a.K(b));if(e instanceof O){var f=e.part;null!==f&&f.Qb()}this.isModified=!0}else if(d===ue){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof W)if("number"===typeof h&&k instanceof O){b?g.Sc(h):g.zb(h,k);var l=g.part;null!==l&&l.Qb()}else"number"===typeof h&&k instanceof Xj&&(k.isRow?Yj(g,h, b?void 0:k):Zj(g,h,b?void 0:k));else if(g instanceof oi){var m=!0===a.oldParam;"number"===typeof h&&k instanceof U&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Qb(),g.Sc(m?h:-1,k,m)):g.rj(h,k,m))}else g instanceof R?"number"===typeof h&&k instanceof oi&&(b?this.Ra.kb(h):(k.me(this),this.Ra.zb(h,k))):v("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===ve){var n=a.object,p=a.oldParam,r=a.oldValue;if(n instanceof W)"number"===typeof p&&r instanceof O?b?n.zb(p,r):n.Sc(p): "number"===typeof p&&r instanceof Xj&&(r.isRow?Yj(n,p,b?r:void 0):Zj(n,p,b?r:void 0));else if(n instanceof oi){var q=!0===a.newParam;"number"===typeof p&&r instanceof U&&(b?0>n.Ka.indexOf(r)&&n.rj(p,r,q):(r.isSelected=!1,r.isHighlighted=!1,r.Qb(),n.Sc(q?p:-1,r,q)))}else n instanceof R?"number"===typeof p&&r instanceof oi&&(b?(r.me(this),this.Ra.zb(p,r)):this.Ra.kb(p)):v("unknown ChangedEvent.Remove object: "+a.toString());this.isModified=!0}else d!==te&&v("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings= c}}};R.prototype.Da=function(a){return this.undoManager.Da(a)};R.prototype.cb=function(a){return this.undoManager.cb(a)};R.prototype.Uf=function(){return this.undoManager.Uf()};R.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Da(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.cb(b):this.undoManager.Uf(),this.skipsUndoManager=c}};R.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)}; R.prototype.rr=function(){this.partManager.rr()}; function ak(a,b,c){var d=a.animationManager;if(a.Xb||a.fc)a.wa=c,d.rf&&d.Ud.add(d.D,"scale",b,a.wa);else if(null===a.Ga)a.wa=c;else{a.Xb=!0;var e=a.viewportBounds.copy(),f=a.Ba,g=a.Aa;e.width=a.Ba/b;e.height=a.Aa/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.Vc()?l.Rf(Qc)?h=0:l.Rf(Rc)&&(h=f-1):h=l.fb()?l.x*(f-1):f/2);isNaN(k)&&(l.Vc()?l.Rf(Pc)?k=0:l.Rf(Sc)&&(k=g-1):k=l.fb()?l.y*(g-1):g/2);null===a.scaleComputation||a.animationManager.defaultAnimation.isAnimating||(c=a.scaleComputation(a, c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);f=J.allocAt(a.oa.x+h/b-h/c,a.oa.y+k/b-k/c);a.position=f;J.free(f);a.wa=c;a.onViewportBoundsChanged(e,a.viewportBounds,b,!1);a.Xb=!1;bj(a,!1);d.rf&&d.Ud.add(d.D,"scale",b,a.wa);a.R();ej(a)}} R.prototype.onViewportBoundsChanged=function(a,b,c,d){if(!a.B(b)){void 0===d&&(d=!1);d||ej(this);$i(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==Bh||d||a.width===b.width&&a.height===b.height||e.C();e=this.currentTool;!0===this.Tj&&e instanceof Ua&&(this.lastInput.documentPoint=this.uu(this.lastInput.viewPoint),Pe(e,this));this.Xb||this.invalidateViewport(a,b);sj(this);this.Nc.scale=c;this.Nc.position.x=a.x;this.Nc.position.y=a.y;this.Nc.bounds.assign(a);this.Nc.Mv.width= Math.round(a.width*c);this.Nc.Mv.height=Math.round(a.height*c);this.Nc.sw.width=this.Ba;this.Nc.sw.height=this.Aa;this.Nc.ow=d;this.V("ViewportBoundsChanged",this.Nc,a);this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Tc(b)&&a.Za()})}}; function sj(a,b){void 0===b&&(b=null);var c=a.Ob;if(null!==c&&c.visible){for(var d=Db.alloc(),e=1,f=1,g=c.$.l,h=g.length,k=0;k<h;k++){var l=g[k],m=Math.abs(l.interval);2>m||(bk(l.figure)?f=f*m/K.yy(f,m):e=e*m/K.yy(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=M.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.s()){M.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;M.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=J.alloc();K.Oq(a, g,0,0,d.width,d.height,b);b.offset(-d.width,-d.height);Db.free(d);c.part.location=b;J.free(b)}}R.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.V("ChangingSelection",b);for(var c=b.Ea(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ka();b.clear();b.freeze();a||this.V("ChangedSelection",b)}}; R.prototype.select=function(a){null!==a&&(w(a,U,R,"select:part"),a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.V("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.V("ChangedSelection",this.selection)))}; R.prototype.lB=function(a){this.V("ChangingSelection",this.selection);this.clearSelection(!0);if(Ha(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof U||v("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 U||v("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.V("ChangedSelection",this.selection)}; R.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.Ea(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ka();a.clear();a.freeze()}};t=R.prototype;t.FA=function(a){null!==a&&a.layer.diagram===this&&(w(a,U,R,"highlight:part"),!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)}; t.GA=function(a){a=(new I).addAll(a);for(var b=this.highlighteds.copy().gr(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof U||v("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=J.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));J.free(d);return}v("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:v("scrolling direction must be 'up', 'down', 'left', or 'right', not: "+b);this.position=c}; t.Hw=function(a){var b=this.viewportBounds;b.Te(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.Ht=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.nr=function(a){var b=this.vb;b.reset();1!==this.wa&&b.scale(this.wa);var c=this.oa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.vb)}; t.uB=function(a){var b=this.vb,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 r=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,r);p=Math.max(p,r);r=Math.min(b,a);b=Math.max(b,a);f=Math.min(f,d);p=Math.max(p,d);r=Math.min(r,c);b=Math.max(b,c);f=Math.min(f,g);p=Math.max(p,g);r=Math.min(r,e);b=Math.max(b,e);return new M(f,r,p-f,b-r)}; t.uu=function(a){var b=this.vb;b.reset();1!==this.wa&&b.scale(this.wa);var c=this.oa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Gb(a.copy(),this.vb)};function ck(a){var b=a.isModified;a.Ev!==b&&(a.Ev=b,a.V("Modified"))}function dk(a){a=yi.get(a);return null!==a?new a:new zi} R.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===te&&"S"===d[0])if("StartingFirstTransaction"===d){var e=this;a=this.toolManager;a.mouseDownTools.each(function(a){a.diagram=e});a.mouseMoveTools.each(function(a){a.diagram=e});a.mouseUpTools.each(function(a){a.diagram=e});this.fc||this.Ae||(this.Lj=!0,this.Oj&&(this.Re=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&& a.tc(),this.V("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.tc());else if(this.ba){this.ba=!1;try{if(""===a.modelChange&&c===te){if("FinishedUndo"===d||"FinishedRedo"===d)this.V("ChangedSelection",this.selection),wh(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.tc();this.Lj=!0;this.nd();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||xh(f);"CommittedTransaction"=== d&&this.undoManager.isJustDiscarded&&(this.$d=Math.min(this.$d,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(ck(this),this.cu.clear(),Vh(this.animationManager));if(!this.Is&&g&&this.lastInput.targetDiagram){this.Is=!0;var h=this;ua(function(){h.currentTool.standardMouseOver();h.Is=!1},10)}}}finally{this.ba=!0}}}}; function Kj(a,b){b=b.$.l;for(var c=b.length,d=0;d<c;d++)ek(a,b[d])}function ek(a,b){if(b instanceof fk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c.hh instanceof I&&c.hh.add(a);var d=b.kh;null!==d&&!0===d.rs&&null!==b.diagram&&b.diagram.$l.add(b);if(c.ro)if(c=c.getAttribute("src"),d=a.zg.K(c),null===d)d=[],d.push(b),a.zg.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}} function gk(a,b){if(b instanceof fk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement&&(c.hh instanceof I&&c.hh.remove(a),hk(c),c.ro)){c=c.getAttribute("src");var d=a.zg.K(c);if(null!==d)for(var e=0;e<d.length;e++)if(d[e]===b){d.splice(e,1);0===d.length&&(a.zg.remove(c),Ki(c));break}}}}R.prototype.Pd=function(){this.partManager.Pd()};R.prototype.pk=function(a,b){this.$c.pk(a,b)};R.prototype.rk=function(a,b){this.$c.rk(a,b)};R.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)}; R.prototype.Ib=function(a){return this.partManager.Ib(a)};R.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=R.prototype;t.Dc=function(a){return this.partManager.Dc(a)};t.kj=function(a){return this.partManager.kj(a)};t.Cc=function(a){return this.partManager.Cc(a)};t.Nt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Nt.apply(this.partManager,b instanceof Array?b:da(ca(b)))}; t.Mt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Mt.apply(this.partManager,b instanceof Array?b:da(ca(b)))};function Fj(a,b){a.Ai=!1;var c=a.$n;c.B(b)||(c=c.copy(),a.$n.assign(b),bj(a,!1),a.V("DocumentBoundsChanged",null,c),ej(a))}t.Xa=function(){if(this.Ai){var a=M.alloc();Fj(this,this.computeBounds(a));M.free(a)}}; t.oA=function(){for(var a=new I,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.nA=function(){return this.Kh.iterator};t.PA=function(a){wh(this);a&&ik(this,!0);this.fc?tj(this,!1):(this.Lj=!0,Hf(this))};function ik(a,b){for(var c=a.Kh.iterator;c.next();)jk(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.C())} function jk(a,b,c){if(null!==b){for(var d=b.Vl.iterator;d.next();)jk(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.C())}} function tj(a,b){if(a.Xg&&!a.Ur){var c=a.ba;a.ba=!0;var d=a.undoManager.transactionLevel,e=a.layout,f=a.animationManager;try{0===d&&(a.undoManager.isInternalTransaction=!0,a.Da("Layout"));1>=d&&!f.defaultAnimation.isAnimating&&!f.yc&&(b||uh(f,"Layout"));a.Xg=!1;for(var g=a.Kh.iterator;g.next();)kk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),wh(a),e.isValidLayout=!0):a.Xg=!0)}finally{b=a.undoManager.isInternalTransaction,0===d&&(a.cb("Layout"),a.undoManager.isInternalTransaction= !1),!b||0!==d&&1!==d||xh(f),a.ba=c}}}function kk(a,b,c,d){if(null!==b){for(var e=b.Vl.iterator;e.next();)kk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.Zh=!b.location.s(),e.doLayout(b),b.C(32),vj(a,b),e.isValidLayout=!0):a.Xg=!0)}}t.uA=function(){for(var a=new H,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.mj()&&a.add(c)}return a.iterator}; function wi(a){function b(a){var b=a.toLowerCase(),e=new H;c.add(a,e);c.add(b,e);d.add(a,a);d.add(b,a)}var c=new zb,d=new zb;b("InitialAnimationStarting");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.Xr=c;a.Wr=d} function Ej(a,b){var c=a.Wr.K(b);return null!==c?c:a.Wr.K(b.toLowerCase())}function lk(a,b){var c=a.Xr.K(b);if(null!==c)return c;c=a.Xr.K(b.toLowerCase());if(null!==c)return c;v("Unknown DiagramEvent name: "+b)}t.qk=function(a,b){A(a,"string",R,"addDiagramListener:name");A(b,"function",R,"addDiagramListener:listener");a=lk(this,a);null!==a&&a.add(b);return this};t.Sm=function(a,b){A(a,"string",R,"removeDiagramListener:name");A(b,"function",R,"addDiagramListener:listener");a=lk(this,a);null!==a&&a.remove(b)}; t.V=function(a,b,c){G&&A(a,"string",R,"raiseDiagramEvent:name");var d=lk(this,a),e=new qe;e.diagram=this;a=Ej(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.M(0)(e);else if(0!==b)for(d=d.Ea(),c=0;c<b;c++)(0,d[c])(e)};function mk(a){if(a.animationManager.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.oq||b.isComplexRoutingRealtime:!0} t.Ik=function(a,b){void 0===b&&(b=null);return nk(this,!1,null,b).Ik(a.x,a.y,a.width,a.height)};R.prototype.computeOccupiedArea=function(a){return this.isVirtualized?this.viewportBounds.copy():this.Ai?aj(this,a):a.assign(this.documentBounds)}; function nk(a,b,c,d){null===a.Lc&&(a.Lc=new vk);if(a.Lc.Wt||a.Lc.group!==c||a.Lc.$y!==d){null!==c&&(c=zk(a,c));if(null===c){b=M.alloc();a.computeOccupiedArea(b);b.Qc(100,100);a.Lc.initialize(b);for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&Ak(a,f,d,b)}M.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.Qc(20,20),a.Lc.initialize(b));b=M.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof V&&Ak(a,f,d,b);M.free(b)}a.Lc.group= c;a.Lc.$y=d;a.Lc.Wt=!1}else b&&Bk(a.Lc);return a.Lc}function zk(a,b){return b.avoidable&&!b.isLinkLabel?b:null!==b.containingGroup?zk(a,b.containingGroup):null} function Ak(a,b,c,d){if(b!==c&&b.isVisible())if(b.avoidable&&!b.isLinkLabel){b=b.getAvoidableRect(d);a=a.Lc;var e=b.x,f=b.y;if(Ck(a,e,f))for(c=(f-a.Ed)/a.kc|0,d=Math.min((e+b.width-a.Dd)/a.jc|0,a.bj),b=Math.min((f+b.height-a.Ed)/a.kc|0,a.cj),e=(e-a.Dd)/a.jc|0;e<=d;e++)if(f=a.Vb[e],f.fill)f.fill(Dk,c,b+1);else for(var g=c;g<=b;g++)f[g]=Dk}else if(b instanceof yf)for(b=b.memberParts;b.next();)e=b.value,e instanceof V&&Ak(a,e,c,d)} function Ek(a,b){null!==a.Lc&&!a.Lc.Wt&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Lc.Wt=!0)}R.prototype.Jt=function(a){this.Bn.assign(a);this.computeAutoScrollPosition(this.Bn).Ya(this.position)?this.Tg():Fk(this)}; function Fk(a){-1===a.Fj&&(a.Fj=ua(function(){if(-1!==a.Fj&&(a.Tg(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.Bn);b.Ya(a.position)||(a.position=b,a.lastInput.documentPoint=a.uu(a.Bn),a.doMouseMove(),a.Ai=!0,b=M.alloc(),a.computeBounds(b),b.Yc(a.documentBounds),Fj(a,b),M.free(b),a.Ic=!0,a.nd(),Fk(a))}},a.An))}R.prototype.Tg=function(){-1!==this.Fj&&(ra.clearTimeout(this.Fj),this.Fj=-1)}; R.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.Cn;if(0>=c.top&&0>=c.left&&0>=c.right&&0>=c.bottom)return b;var d=this.viewportBounds,e=this.scale;d=M.allocAt(0,0,d.width*e,d.height*e);var f=J.allocAt(0,0);if(a.x>=d.x&&a.x<d.x+c.left&&this.allowHorizontalScroll){var g=Math.max(this.scrollHorizontalLineChange,1);g|=0;f.x-=g;a.x<d.x+c.left/2&&(f.x-=g);a.x<d.x+c.left/4&&(f.x-=4*g)}else a.x<=d.x+d.width&&a.x>d.x+d.width-c.right&&this.allowHorizontalScroll&&(g=Math.max(this.scrollHorizontalLineChange, 1),g|=0,f.x+=g,a.x>d.x+d.width-c.right/2&&(f.x+=g),a.x>d.x+d.width-c.right/4&&(f.x+=4*g));a.y>=d.y&&a.y<d.y+c.top&&this.allowVerticalScroll?(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y-=g,a.y<d.y+c.top/2&&(f.y-=g),a.y<d.y+c.top/4&&(f.y-=4*g)):a.y<=d.y+d.height&&a.y>d.y+d.height-c.bottom&&this.allowVerticalScroll&&(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y+=g,a.y>d.y+d.height-c.bottom/2&&(f.y+=g),a.y>d.y+d.height-c.bottom/4&&(f.y+=4*g));f.Ya(Lb)||(b=new J(b.x+f.x/e,b.y+f.y/e)); M.free(d);J.free(f);return b};t=R.prototype;t.eu=function(){return null};t.qw=function(){return null};t.zz=function(a,b){this.Ox.add(a,b)}; function Gk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].Ql){f=!1;break}f||a-l>k?b(c,e,h):ra.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.zg.iterator;g.next();)if(!g.value[0].Ql){f=!1;break}if("function"!==typeof e||f)return b(c,e,a);var h=a,k=c.callbackTimeout||300,l=+new Date;ra.requestAnimationFrame(function(){d()});return null}t.RA=function(a){if(!Xg)return null;void 0===a&&(a=new gb);a.returnType="Image";return this.My(a)}; t.My=function(a){void 0===a&&(a=new gb);return Gk(this,this.SA,a)}; t.SA=function(a,b,c){var d=Hk(c,a,"canvas",null);if(null===d)return null;c=d.aa.canvas;var e=null;if(null!==c)switch(e=a.returnType,void 0===e?e="string":e=e.toLowerCase(),e){case Ik+"data":e=d.getImageData(0,0,c.width,c.height);break;case Ik:d=(a.document||document).createElement("img");d.src=c.toDataURL(a.type,a.details);e=d;break;case "blob":"function"!==typeof b&&v('Error: Diagram.makeImageData called with "returnType: toBlob", but no required "callback" function property defined.');if("function"=== typeof c.toBlob)return c.toBlob(b,a.type,a.details),"toBlob";if("function"===typeof c.msToBlob)return b(c.msToBlob()),"msToBlob";b(null);return null;default:e=c.toDataURL(a.type,a.details)}return"function"===typeof b?(b(e),null):e}; function Hk(a,b,c,d){a.animationManager.tc();a.nd();if(null===a.Ga)return null;"object"!==typeof b&&v("properties argument must be an Object.");var e=!1,f=b.size||null,g=b.scale||null;void 0!==b.scale&&isNaN(b.scale)&&(g="NaN");var h=b.maxSize;void 0===b.maxSize&&(e=!0,h="SVG"===c?new Db(Infinity,Infinity):new Db(2E3,2E3));var k=b.position||null,l=b.parts||null,m=void 0===b.padding?1:b.padding,n=b.background||null,p=b.omitTemporary;void 0===p&&(p=!0);var r=b.document||document,q=b.elementFinished|| null,u=b.showTemporary;void 0===u&&(u=!p);b=b.showGrid;void 0===b&&(b=u);null!==f&&isNaN(f.width)&&isNaN(f.height)&&(f=null);"number"===typeof m?m=new gc(m):m instanceof gc||v("MakeImage padding must be a Margin or a number.");m.left=Math.max(m.left,0);m.right=Math.max(m.right,0);m.top=Math.max(m.top,0);m.bottom=Math.max(m.bottom,0);a.Db.Oc(!0);p=new Jk(null,r);var y=p.context;if(!(f||g||l||k)){p.width=a.Ba+Math.ceil(m.left+m.right);p.height=a.Aa+Math.ceil(m.top+m.bottom);if("SVG"===c){if(null=== d)return null;d.resize(p.width,p.height,p.width,p.height);d.ownerDocument=r;d.Lq=q;Cj(a,d.context,m,new Db(p.width,p.height),a.wa,a.oa,l,n,u,b);return d.context}a.rl=!1;Cj(a,y,m,new Db(p.width,p.height),a.wa,a.oa,l,n,u,b);a.rl=!0;return p.context}var x=a.Zn,z=a.documentBounds.copy();z.Pw(a.nb);if(u)for(var B=a.Ra.l,D=B.length,F=0;F<D;F++){var L=B[F];if(L.visible&&L.isTemporary){L=L.Ka.l;for(var Z=L.length,Q=0;Q<Z;Q++){var ba=L[Q];ba.isInDocumentBounds&&ba.isVisible()&&(ba=ba.actualBounds,ba.s()&& z.Yc(ba))}}}B=new J(z.x,z.y);if(null!==l){D=!0;F=l.iterator;for(F.reset();F.next();)if(L=F.value,L instanceof U&&(Z=L.layer,(null===Z||Z.visible)&&(null===Z||u||!Z.isTemporary)&&L.isVisible()&&(L=L.actualBounds,L.s())))if(D){D=!1;var S=L.copy()}else S.Yc(L);D&&(S=new M(0,0,0,0));z.width=S.width;z.height=S.height;B.x=S.x;B.y=S.y}null!==k&&k.s()&&(B=k,g||(g=x));S=k=0;null!==m&&(k=m.left+m.right,S=m.top+m.bottom);D=F=0;null!==f&&(F=f.width,D=f.height,isFinite(F)&&(F=Math.max(0,F-k)),isFinite(D)&&(D= Math.max(0,D-S)));null!==f&&null!==g?("NaN"===g&&(g=x),f.s()?(f=F,z=D):isNaN(D)?(f=F,z=z.height*g):(f=z.width*g,z=D)):null!==f?f.s()?(g=Math.min(F/z.width,D/z.height),f=F,z=D):isNaN(D)?(g=F/z.width,f=F,z=z.height*g):(g=D/z.height,f=z.width*g,z=D):null!==g?"NaN"===g&&h.s()?(g=Math.min((h.width-k)/z.width,(h.height-S)/z.height),g>x?(g=x,f=z.width,z=z.height):(f=h.width,z=h.height)):(f=z.width*g,z=z.height*g):(g=x,f=z.width,z=z.height);null!==m?(f+=k,z+=S):m=new gc(0);null!==h&&(x=h.width,h=h.height, "SVG"!==c&&e&&!Kk&&G&&(f>x||z>h)&&(Fa("Diagram.makeImage(data): Diagram width or height is larger than the default max size. ("+Math.ceil(f)+"x"+Math.ceil(z)+" vs 2000x2000) Consider increasing the max size."),Kk=!0),isNaN(x)&&(x=2E3),isNaN(h)&&(h=2E3),isFinite(x)&&(f=Math.min(f,x)),isFinite(h)&&(z=Math.min(z,h)));p.width=Math.ceil(f);p.height=Math.ceil(z);if("SVG"===c){if(null===d)return null;d.resize(p.width,p.height,p.width,p.height);d.ownerDocument=r;d.Lq=q;Cj(a,d.context,m,new Db(Math.ceil(f), Math.ceil(z)),g,B,l,n,u,b);return d.context}a.rl=!1;Cj(a,y,m,new Db(Math.ceil(f),Math.ceil(z)),g,B,l,n,u,b);a.rl=!0;return p.context} na.Object.defineProperties(R.prototype,{div:{configurable:!0,get:function(){return this.Ja},set:function(a){null!==a&&w(a,HTMLDivElement,R,"div");if(this.Ja!==a){var b=this.Ja;null!==b?(b.D=void 0,b.goDiagram=void 0,b.innerHTML="",null!==this.Ga&&(b=this.Ga.Qa,this.removeEventListener(b,"pointermove",this.Pk,!1),this.removeEventListener(b,"pointerdown",this.Ok,!1),this.removeEventListener(b,"pointerup",this.Rk,!1),this.removeEventListener(b,"pointerout",this.Qk,!1),this.Ga.oy()),this.cm&& (this.cm.disconnect(),this.cm=null),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.Db=this.Ga=null,this.removeEventListener(ra,"resize",this.Yw,!1),this.removeEventListener(ra,"wheel",this.Lk,!0),He===this&&(He=null)):this.Ae=!1;this.Ja=null;if(null!==a){if(b=a.D)b.div=null;Gi(this,a);this.redraw()}}}}, ey:{configurable:!0,get:function(){return this.lp}},tj:{configurable:!0,get:function(){return this.Ae}},draggedLink:{configurable:!0,get:function(){return this.Zr},set:function(a){this.Zr!==a&&(this.Zr=a,null!==a&&(this.Ms=a.fromPort,this.Ns=a.toPort))}},Py:{configurable:!0,get:function(){return this.Ms},set:function(a){this.Ms=a}},Qy:{configurable:!0,get:function(){return this.Ns},set:function(a){this.Ns=a}},animationManager:{configurable:!0, enumerable:!0,get:function(){return this.$c}},undoManager:{configurable:!0,get:function(){return this.hc.undoManager}},skipsUndoManager:{configurable:!0,get:function(){return this.Fg},set:function(a){A(a,"boolean",R,"skipsUndoManager");this.Fg=a;this.hc.skipsUndoManager=a}},delaysLayout:{configurable:!0,get:function(){return this.Ur},set:function(a){this.Ur=a}},opacity:{configurable:!0,get:function(){return this.mb},set:function(a){var b=this.mb; b!==a&&(A(a,"number",R,"opacity"),(0>a||1<a)&&Ba(a,"0 <= value <= 1",R,"opacity"),this.mb=a,this.g("opacity",b,a),this.R())}},validCycle:{configurable:!0,get:function(){return this.At},set:function(a){var b=this.At;b!==a&&(eb(a,R,R,"validCycle"),this.At=a,this.g("validCycle",b,a))}},layers:{configurable:!0,get:function(){return this.Ra.iterator}},isModelReadOnly:{configurable:!0,get:function(){var a=this.hc;return null===a?!1:a.isReadOnly},set:function(a){var b= this.hc;null!==b&&(b.isReadOnly=a)}},isReadOnly:{configurable:!0,get:function(){return this.kg},set:function(a){var b=this.kg;b!==a&&(A(a,"boolean",R,"isReadOnly"),this.kg=a,this.g("isReadOnly",b,a))}},isEnabled:{configurable:!0,get:function(){return this.sd},set:function(a){var b=this.sd;b!==a&&(A(a,"boolean",R,"isEnabled"),this.sd=a,this.g("isEnabled",b,a))}},allowClipboard:{configurable:!0,get:function(){return this.vr},set:function(a){var b=this.vr;b!== a&&(A(a,"boolean",R,"allowClipboard"),this.vr=a,this.g("allowClipboard",b,a))}},allowCopy:{configurable:!0,get:function(){return this.fi},set:function(a){var b=this.fi;b!==a&&(A(a,"boolean",R,"allowCopy"),this.fi=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.gi},set:function(a){var b=this.gi;b!==a&&(A(a,"boolean",R,"allowDelete"),this.gi=a,this.g("allowDelete",b,a))}},allowDragOut:{configurable:!0,get:function(){return this.wr}, set:function(a){var b=this.wr;b!==a&&(A(a,"boolean",R,"allowDragOut"),this.wr=a,this.g("allowDragOut",b,a))}},allowDrop:{configurable:!0,get:function(){return this.xr},set:function(a){var b=this.xr;b!==a&&(A(a,"boolean",R,"allowDrop"),this.xr=a,this.g("allowDrop",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.pi},set:function(a){var b=this.pi;b!==a&&(A(a,"boolean",R,"allowTextEdit"),this.pi=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0, enumerable:!0,get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(A(a,"boolean",R,"allowGroup"),this.hi=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.ri},set:function(a){var b=this.ri;b!==a&&(A(a,"boolean",R,"allowUngroup"),this.ri=a,this.g("allowUngroup",b,a))}},allowInsert:{configurable:!0,get:function(){return this.zr},set:function(a){var b=this.zr;b!==a&&(A(a,"boolean",R,"allowInsert"),this.zr=a,this.g("allowInsert", b,a))}},allowLink:{configurable:!0,get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(A(a,"boolean",R,"allowLink"),this.ii=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(A(a,"boolean",R,"allowRelink"),this.ki=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0,get:function(){return this.ji},set:function(a){var b=this.ji;b!==a&&(A(a,"boolean",R,"allowMove"), this.ji=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,get:function(){return this.li},set:function(a){var b=this.li;b!==a&&(A(a,"boolean",R,"allowReshape"),this.li=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.mi},set:function(a){var b=this.mi;b!==a&&(A(a,"boolean",R,"allowResize"),this.mi=a,this.g("allowResize",b,a))}},allowRotate:{configurable:!0,get:function(){return this.ni},set:function(a){var b=this.ni; b!==a&&(A(a,"boolean",R,"allowRotate"),this.ni=a,this.g("allowRotate",b,a))}},allowSelect:{configurable:!0,get:function(){return this.oi},set:function(a){var b=this.oi;b!==a&&(A(a,"boolean",R,"allowSelect"),this.oi=a,this.g("allowSelect",b,a))}},allowUndo:{configurable:!0,get:function(){return this.Ar},set:function(a){var b=this.Ar;b!==a&&(A(a,"boolean",R,"allowUndo"),this.Ar=a,this.g("allowUndo",b,a))}},allowZoom:{configurable:!0,get:function(){return this.Cr}, set:function(a){var b=this.Cr;b!==a&&(A(a,"boolean",R,"allowZoom"),this.Cr=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{configurable:!0,get:function(){return this.yl},set:function(a){var b=this.yl;b!==a&&(A(a,"boolean",R,"hasVerticalScrollbar"),this.yl=a,ej(this),this.R(),this.g("hasVerticalScrollbar",b,a),bj(this,!1))}},hasHorizontalScrollbar:{configurable:!0,get:function(){return this.xl},set:function(a){var b=this.xl;b!==a&&(A(a,"boolean",R,"hasHorizontalScrollbar"), this.xl=a,ej(this),this.R(),this.g("hasHorizontalScrollbar",b,a),bj(this,!1))}},allowHorizontalScroll:{configurable:!0,get:function(){return this.yr},set:function(a){var b=this.yr;b!==a&&(A(a,"boolean",R,"allowHorizontalScroll"),this.yr=a,this.g("allowHorizontalScroll",b,a),bj(this,!1))}},allowVerticalScroll:{configurable:!0,get:function(){return this.Br},set:function(a){var b=this.Br;b!==a&&(A(a,"boolean",R,"allowVerticalScroll"),this.Br=a,this.g("allowVerticalScroll", b,a),bj(this,!1))}},scrollHorizontalLineChange:{configurable:!0,get:function(){return this.ct},set:function(a){var b=this.ct;b!==a&&(A(a,"number",R,"scrollHorizontalLineChange"),0>a&&Ba(a,">= 0",R,"scrollHorizontalLineChange"),this.ct=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{configurable:!0,get:function(){return this.gt},set:function(a){var b=this.gt;b!==a&&(A(a,"number",R,"scrollVerticalLineChange"),0>a&&Ba(a,">= 0",R,"scrollVerticalLineChange"), this.gt=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{configurable:!0,get:function(){return this.sh},set:function(a){G&&w(a,oe,R,"lastInput");this.sh=a}},previousInput:{configurable:!0,get:function(){return this.tf},set:function(a){G&&w(a,oe,R,"previousInput");this.tf=a}},firstInput:{configurable:!0,get:function(){return this.vl},set:function(a){G&&w(a,oe,R,"firstInput");this.vl=a}},currentCursor:{configurable:!0,get:function(){return this.Or}, set:function(a){""===a&&(a=this.Yn);if(this.Or!==a){A(a,"string",R,"currentCursor");var b=this.Ga,c=this.Ja;if(null!==b){this.Or=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:{configurable:!0,get:function(){return this.Yn},set:function(a){""===a&&(a="auto"); var b=this.Yn;b!==a&&(A(a,"string",R,"defaultCursor"),this.Yn=a,this.g("defaultCursor",b,a))}},click:{configurable:!0,get:function(){return this.bg},set:function(a){var b=this.bg;b!==a&&(null!==a&&A(a,"function",R,"click"),this.bg=a,this.g("click",b,a))}},doubleClick:{configurable:!0,get:function(){return this.gg},set:function(a){var b=this.gg;b!==a&&(null!==a&&A(a,"function",R,"doubleClick"),this.gg=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0, get:function(){return this.cg},set:function(a){var b=this.cg;b!==a&&(null!==a&&A(a,"function",R,"contextClick"),this.cg=a,this.g("contextClick",b,a))}},mouseOver:{configurable:!0,get:function(){return this.vg},set:function(a){var b=this.vg;b!==a&&(null!==a&&A(a,"function",R,"mouseOver"),this.vg=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return this.tg},set:function(a){var b=this.tg;b!==a&&(null!==a&&A(a,"function",R,"mouseHover"),this.tg=a, this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,get:function(){return this.sg},set:function(a){var b=this.sg;b!==a&&(null!==a&&A(a,"function",R,"mouseHold"),this.sg=a,this.g("mouseHold",b,a))}},mouseDragOver:{configurable:!0,get:function(){return this.Hs},set:function(a){var b=this.Hs;b!==a&&(null!==a&&A(a,"function",R,"mouseDragOver"),this.Hs=a,this.g("mouseDragOver",b,a))}},mouseDrop:{configurable:!0,get:function(){return this.qg},set:function(a){var b= this.qg;b!==a&&(G&&null!==a&&A(a,"function",R,"mouseDrop"),this.qg=a,this.g("mouseDrop",b,a))}},handlesDragDropForTopLevelParts:{configurable:!0,get:function(){return this.js},set:function(a){var b=this.js;b!==a&&(A(a,"boolean",R,"handlesDragDropForTopLevelParts"),this.js=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{configurable:!0,get:function(){return this.rg},set:function(a){var b=this.rg;b!==a&&(null!==a&&A(a,"function",R,"mouseEnter"),this.rg=a,this.g("mouseEnter", b,a))}},mouseLeave:{configurable:!0,get:function(){return this.ug},set:function(a){var b=this.ug;b!==a&&(null!==a&&A(a,"function",R,"mouseLeave"),this.ug=a,this.g("mouseLeave",b,a))}},toolTip:{configurable:!0,get:function(){return this.Hg},set:function(a){var b=this.Hg;b!==a&&(!G||null===a||a instanceof Le||a instanceof Qe||v("Diagram.toolTip must be an Adornment or HTMLInfo."),this.Hg=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return this.dg}, set:function(a){var b=this.dg;b!==a&&(!G||a instanceof Le||a instanceof Qe||v("Diagram.contextMenu must be an Adornment or HTMLInfo."),this.dg=a,this.g("contextMenu",b,a))}},commandHandler:{configurable:!0,get:function(){return this.Ir},set:function(a){this.Ir!==a&&(this.Ir=a,a.me(this))}},toolManager:{configurable:!0,get:function(){return this.xt},set:function(a){this.xt!==a&&(w(a,Ua,R,"toolManager"),this.xt=a,a.diagram=this)}},defaultTool:{configurable:!0, get:function(){return this.Tr},set:function(a){var b=this.Tr;b!==a&&(w(a,Ge,R,"defaultTool"),this.Tr=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{configurable:!0,get:function(){return this.Qr},set:function(a){var b=this.Qr;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(w(a,Ge,R,"currentTool"),this.Qr=a,a.diagram=this,a.doStart())}},selection:{configurable:!0,get:function(){return this.vv}}, maxSelectionCount:{configurable:!0,get:function(){return this.Ds},set:function(a){var b=this.Ds;if(b!==a)if(A(a,"number",R,"maxSelectionCount"),0<=a&&!isNaN(a)){if(this.Ds=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.V("ChangingSelection",this.selection);b=this.selection.Ea();for(var c=0;c<a;c++)b[c].isSelected=!1;this.V("ChangedSelection",this.selection)}}else Ba(a,">= 0",R,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{configurable:!0, enumerable:!0,get:function(){return this.sp},set:function(a){var b=this.sp;b!==a&&(w(a,Le,R,"nodeSelectionAdornmentTemplate"),this.sp=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.zo},set:function(a){var b=this.zo;b!==a&&(w(a,Le,R,"groupSelectionAdornmentTemplate"),this.zo=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.Uo}, set:function(a){var b=this.Uo;b!==a&&(w(a,Le,R,"linkSelectionAdornmentTemplate"),this.Uo=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{configurable:!0,get:function(){return this.Uu}},isModified:{configurable:!0,get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.Fo&&this.$d!==a.historyIndex:this.Fo},set:function(a){if(this.Fo!==a){A(a,"boolean",R,"isModified");this.Fo=a;var b=this.undoManager;!a&&b.isEnabled&&(this.$d= b.historyIndex);a||ck(this)}}},model:{configurable:!0,get:function(){return this.hc},set:function(a){var b=this.hc;if(b!==a){w(a,X,R,"model");this.currentTool.doCancel();null!==b&&b.undoManager!==a.undoManager&&b.undoManager.isInTransaction&&v("Do not replace a Diagram.model while a transaction is in progress.");this.animationManager.tc(!0);var c=Ji(this,!0);this.Ae=!1;this.Oj=!0;this.$d=-2;this.Re=!1;var d=this.fc;this.fc=!0;uh(this.animationManager,"Model");null!==b&&(null!==this.He&& this.He.each(function(a){b.Tk(a)}),b.Tk(this.Zc));this.hc=a;this.partManager=dk(this.hc.type);for(var e=0;e<c.length;e++)this.add(c[e]);a.Oh(this.Gc);this.partManager.addAllModeledParts();a.Tk(this.Gc);a.Oh(this.Zc);null!==this.He&&this.He.each(function(b){a.Oh(b)});this.fc=d;this.Va();this.Xb||this.R();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},ba:{configurable:!0,get:function(){return this.cv},set:function(a){this.cv=a}},cu:{configurable:!0,get:function(){return this.Gx}}, skipsModelSourceBindings:{configurable:!0,get:function(){return this.wv},set:function(a){this.wv=a}},su:{configurable:!0,get:function(){return this.nt},set:function(a){this.nt=a}},nodeTemplate:{configurable:!0,get:function(){return this.qf.K("")},set:function(a){var b=this.qf.K("");b!==a&&(w(a,U,R,"nodeTemplate"),this.qf.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.Pd())}},nodeTemplateMap:{configurable:!0,get:function(){return this.qf}, set:function(a){var b=this.qf;b!==a&&(w(a,zb,R,"nodeTemplateMap"),this.qf=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Pd())}},groupTemplate:{configurable:!0,get:function(){return this.qh.K("")},set:function(a){var b=this.qh.K("");b!==a&&(w(a,yf,R,"groupTemplate"),this.qh.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Pd())}},groupTemplateMap:{configurable:!0,get:function(){return this.qh},set:function(a){var b= this.qh;b!==a&&(w(a,zb,R,"groupTemplateMap"),this.qh=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Pd())}},linkTemplate:{configurable:!0,get:function(){return this.mg.K("")},set:function(a){var b=this.mg.K("");b!==a&&(w(a,T,R,"linkTemplate"),this.mg.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Pd())}},linkTemplateMap:{configurable:!0,get:function(){return this.mg},set:function(a){var b=this.mg;b!==a&&(w(a,zb,R, "linkTemplateMap"),this.mg=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Pd())}},isMouseCaptured:{configurable:!0,get:function(){return this.Zu},set:function(a){var b=this.Ga;null!==b&&(b=b.Qa,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.removeEventListener(b,"pointermove",this.Pk,!1),this.removeEventListener(b,"pointerdown",this.Ok,!1),this.removeEventListener(b,"pointerup",this.Rk,!1),this.removeEventListener(b,"pointerout",this.Qk,!1),this.addEventListener(ra, "pointermove",this.Pk,!0),this.addEventListener(ra,"pointerdown",this.Ok,!0),this.addEventListener(ra,"pointerup",this.Rk,!0),this.addEventListener(ra,"pointerout",this.Qk,!0),this.removeEventListener(b,"wheel",this.Lk,!1),this.addEventListener(ra,"wheel",this.Lk,!0),this.addEventListener(ra,"selectstart",this.preventDefault,!1)):(this.removeEventListener(ra,"pointermove",this.Pk,!0),this.removeEventListener(ra,"pointerdown",this.Ok,!0),this.removeEventListener(ra,"pointerup",this.Rk,!0),this.removeEventListener(ra, "pointerout",this.Qk,!0),this.addEventListener(b,"pointermove",this.Pk,!1),this.addEventListener(b,"pointerdown",this.Ok,!1),this.addEventListener(b,"pointerup",this.Rk,!1),this.addEventListener(b,"pointerout",this.Qk,!1),this.removeEventListener(ra,"wheel",this.Lk,!0),this.removeEventListener(ra,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.Lk,!1)),this.Zu=a))}},position:{configurable:!0,get:function(){return this.oa},set:function(a){var b=J.alloc().assign(this.oa); if(!b.B(a)){w(a,J,R,"position");var c=this.viewportBounds.copy();this.oa.assign(a);Yh(this.animationManager,b,this.oa);this.Xb||null===this.Ga&&!this.wm.s()||(this.Xb=!0,a=this.scale,dj(this,this.$n,this.Ba/a,this.Aa/a,this.Hj,!1),this.Xb=!1);if(!this.Xb)this.onViewportBoundsChanged(c,this.viewportBounds,this.wa,!1)}J.free(b)}},initialPosition:{configurable:!0,get:function(){return this.ls},set:function(a){this.ls.B(a)||(w(a,J,R,"initialPosition"),this.ls=a.L())}},initialScale:{configurable:!0, enumerable:!0,get:function(){return this.ms},set:function(a){this.ms!==a&&(A(a,"number",R,"initialScale"),this.ms=a)}},grid:{configurable:!0,get:function(){null===this.Ob&&Wi(this);return this.Ob},set:function(a){var b=this.Ob;if(b!==a){null===b&&(Wi(this),b=this.Ob);w(a,W,R,"grid");a.type!==W.Grid&&v("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.Ob=a;a.name="GRID";null!==c&&c.add(a);sj(this);this.R();this.g("grid",b,a)}}},viewportBounds:{configurable:!0, enumerable:!0,get:function(){var a=this.Wx,b=this.oa,c=this.wa;a.h(b.x,b.y,Math.max(this.Ba,0)/c,Math.max(this.Aa,0)/c);return a}},viewSize:{configurable:!0,get:function(){return this.wm},set:function(a){var b=this.viewSize;b.B(a)||(w(a,Db,R,"viewSize"),this.wm=a=a.L(),this.Aa=this.Ba=0,a.s()?(this.Ba=a.width,this.Aa=a.height):null!==this.Ja&&(this.Ba=this.Ja.clientWidth||1,this.Aa=this.Ja.clientHeight||1),this.Va(),this.g("viewSize",b,a),this.redraw())}},fixedBounds:{configurable:!0, enumerable:!0,get:function(){return this.fs},set:function(a){var b=this.fs;b.B(a)||(w(a,M,R,"fixedBounds"),(G&&Infinity===a.width||-Infinity===a.width||Infinity===a.height||-Infinity===a.height)&&v("fixedBounds width/height must not be Infinity"),this.fs=a=a.L(),this.Va(),this.g("fixedBounds",b,a))}},scrollMargin:{configurable:!0,get:function(){return this.Vi},set:function(a){"number"===typeof a?a=new gc(a):w(a,gc,R,"scrollMargin");var b=this.Vi;b.B(a)||(this.Vi=a=a.L(),this.g("scrollMargin", b,a),this.fr())}},scrollMode:{configurable:!0,get:function(){return this.Wi},set:function(a){var b=this.Wi;b!==a&&(eb(a,R,R,"scrollMode"),this.Wi=a,a===bi&&bj(this,!1),this.g("scrollMode",b,a),this.R())}},scrollsPageOnFocus:{configurable:!0,get:function(){return this.ht},set:function(a){var b=this.ht;b!==a&&(A(a,"boolean",R,"scrollsPageOnFocus"),this.ht=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{configurable:!0,get:function(){return this.Us}, set:function(a){var b=this.Us;b!==a&&(null!==a&&A(a,"function",R,"positionComputation"),this.Us=a,bj(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{configurable:!0,get:function(){return this.at},set:function(a){var b=this.at;b!==a&&(null!==a&&A(a,"function",R,"scaleComputation"),this.at=a,ak(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{configurable:!0,get:function(){return this.$n}},isVirtualized:{configurable:!0, get:function(){return this.ys},set:function(a){var b=this.ys;b!==a&&(A(a,"boolean",R,"isVirtualized"),this.ys=a,this.g("isVirtualized",b,a))}},scale:{configurable:!0,get:function(){return this.wa},set:function(a){var b=this.wa;C(a,R,"scale");b!==a&&ak(this,b,a)}},defaultScale:{configurable:!0,get:function(){return this.Zn},set:function(a){G&&C(a,R,"defaultScale");!G||0<a||v("defaultScale must be larger than zero, not: "+a);this.Zn=a}},autoScale:{configurable:!0, get:function(){return this.Yg},set:function(a){var b=this.Yg;b!==a&&(eb(a,R,R,"autoScale"),this.Yg=a,this.g("autoScale",b,a),a!==Bh&&bj(this,!1))}},initialAutoScale:{configurable:!0,get:function(){return this.jg},set:function(a){var b=this.jg;b!==a&&(eb(a,R,R,"initialAutoScale"),this.jg=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{configurable:!0,get:function(){return this.ns},set:function(a){var b=this.ns;b!==a&&(w(a,Eb,R,"initialViewportSpot"),a.fb()||v("initialViewportSpot must be a specific Spot: "+ a),this.ns=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{configurable:!0,get:function(){return this.ks},set:function(a){var b=this.ks;b!==a&&(w(a,Eb,R,"initialDocumentSpot"),a.fb()||v("initialViewportSpot must be a specific Spot: "+a),this.ks=a,this.g("initialDocumentSpot",b,a))}},minScale:{configurable:!0,get:function(){return this.Es},set:function(a){C(a,R,"minScale");var b=this.Es;b!==a&&(0<a?(this.Es=a,this.g("minScale",b,a),a>this.scale&&(this.scale= a)):Ba(a,"> 0",R,"minScale"))}},maxScale:{configurable:!0,get:function(){return this.Cs},set:function(a){C(a,R,"maxScale");var b=this.Cs;b!==a&&(0<a?(this.Cs=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):Ba(a,"> 0",R,"maxScale"))}},zoomPoint:{configurable:!0,get:function(){return this.Et},set:function(a){this.Et.B(a)||(w(a,J,R,"zoomPoint"),this.Et=a=a.L())}},contentAlignment:{configurable:!0,get:function(){return this.Hj},set:function(a){var b=this.Hj; b.B(a)||(w(a,Eb,R,"contentAlignment"),this.Hj=a=a.L(),this.g("contentAlignment",b,a),bj(this,!1))}},initialContentAlignment:{configurable:!0,get:function(){return this.Co},set:function(a){var b=this.Co;b.B(a)||(w(a,Eb,R,"initialContentAlignment"),this.Co=a=a.L(),this.g("initialContentAlignment",b,a))}},padding:{configurable:!0,get:function(){return this.nb},set:function(a){"number"===typeof a?a=new gc(a):w(a,gc,R,"padding");var b=this.nb;b.B(a)||(this.nb=a=a.L(),this.Va(), this.g("padding",b,a))}},partManager:{configurable:!0,get:function(){return this.Ma},set:function(a){var b=this.Ma;b!==a&&(w(a,zi,R,"partManager"),null!==a.diagram&&v("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.me(null),this.Ma=a,a.me(this))}},nodes:{configurable:!0,get:function(){return this.partManager.nodes.iterator}},links:{configurable:!0,get:function(){return this.partManager.links.iterator}},parts:{configurable:!0, get:function(){return this.partManager.parts.iterator}},layout:{configurable:!0,get:function(){return this.oc},set:function(a){var b=this.oc;b!==a&&(w(a,Ei,R,"layout"),this.oc=a,a.diagram=this,a.group=null,this.Xg=!0,this.g("layout",b,a),this.Kb())}},isTreePathToChildren:{configurable:!0,get:function(){return this.xs},set:function(a){var b=this.xs;if(b!==a&&(A(a,"boolean",R,"isTreePathToChildren"),this.xs=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a= this.nodes;a.next();)Lk(a.value)}},treeCollapsePolicy:{configurable:!0,get:function(){return this.yt},set:function(a){var b=this.yt;b!==a&&(a!==xi&&a!==Mk&&a!==Nk&&v("Unknown Diagram.treeCollapsePolicy: "+a),this.yt=a,this.g("treeCollapsePolicy",b,a))}},We:{configurable:!0,get:function(){return this.Wu},set:function(a){this.Wu=a}},autoScrollInterval:{configurable:!0,get:function(){return this.An},set:function(a){var b=this.An;C(a,R,"scale");b!==a&&(this.An= a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{configurable:!0,get:function(){return this.Cn},set:function(a){"number"===typeof a?a=new gc(a):w(a,gc,R,"autoScrollRegion");var b=this.Cn;b.B(a)||(this.Cn=a=a.L(),this.Va(),this.g("autoScrollRegion",b,a))}}});na.Object.defineProperties(R,{licenseKey:{configurable:!0,get:function(){return Ok.cc()},set:function(a){Ok.add(a)}},version:{configurable:!0,get:function(){return Pk}}}); R.prototype.makeImageData=R.prototype.My;R.prototype.makeImage=R.prototype.RA;R.prototype.addRenderer=R.prototype.zz;R.prototype.makeSVG=R.prototype.qw;R.prototype.makeSvg=R.prototype.eu;R.prototype.stopAutoScroll=R.prototype.Tg;R.prototype.doAutoScroll=R.prototype.Jt;R.prototype.isUnoccupied=R.prototype.Ik;R.prototype.raiseDiagramEvent=R.prototype.V;R.prototype.removeDiagramListener=R.prototype.Sm;R.prototype.addDiagramListener=R.prototype.qk;R.prototype.findTreeRoots=R.prototype.uA; R.prototype.layoutDiagram=R.prototype.PA;R.prototype.findTopLevelGroups=R.prototype.nA;R.prototype.findTopLevelNodesAndLinks=R.prototype.oA;R.prototype.ensureBounds=R.prototype.Xa;R.prototype.findLinksByExample=R.prototype.Mt;R.prototype.findNodesByExample=R.prototype.Nt;R.prototype.findLinkForData=R.prototype.Cc;R.prototype.findNodeForData=R.prototype.kj;R.prototype.findPartForData=R.prototype.Dc;R.prototype.findLinkForKey=R.prototype.findLinkForKey;R.prototype.findNodeForKey=R.prototype.Ib; R.prototype.findPartForKey=R.prototype.findPartForKey;R.prototype.rebuildParts=R.prototype.Pd;R.prototype.transformViewToDoc=R.prototype.uu;R.prototype.transformRectDocToView=R.prototype.uB;R.prototype.transformDocToView=R.prototype.nr;R.prototype.centerRect=R.prototype.Ht;R.prototype.scrollToRect=R.prototype.Hw;R.prototype.scroll=R.prototype.scroll;R.prototype.highlightCollection=R.prototype.GA;R.prototype.highlight=R.prototype.FA;R.prototype.selectCollection=R.prototype.lB;R.prototype.select=R.prototype.select; R.prototype.updateAllRelationshipsFromData=R.prototype.rr;R.prototype.updateAllTargetBindings=R.prototype.updateAllTargetBindings;R.prototype.commit=R.prototype.commit;R.prototype.rollbackTransaction=R.prototype.Uf;R.prototype.commitTransaction=R.prototype.cb;R.prototype.startTransaction=R.prototype.Da;R.prototype.raiseChanged=R.prototype.g;R.prototype.raiseChangedEvent=R.prototype.ab;R.prototype.removeChangedListener=R.prototype.Tk;R.prototype.addChangedListener=R.prototype.Oh; R.prototype.removeModelChangedListener=R.prototype.gB;R.prototype.addModelChangedListener=R.prototype.ay;R.prototype.findLayer=R.prototype.Ck;R.prototype.removeLayer=R.prototype.eB;R.prototype.addLayerAfter=R.prototype.vz;R.prototype.addLayerBefore=R.prototype.Zx;R.prototype.addLayer=R.prototype.ym;R.prototype.moveParts=R.prototype.moveParts;R.prototype.copyParts=R.prototype.yk;R.prototype.removeParts=R.prototype.mu;R.prototype.remove=R.prototype.remove;R.prototype.add=R.prototype.add; R.prototype.clearDelayedGeometries=R.prototype.Nv;R.prototype.setProperties=R.prototype.en;R.prototype.attach=R.prototype.Lv;R.prototype.set=R.prototype.set;R.prototype.resetInputOptions=R.prototype.Dw;R.prototype.setInputOption=R.prototype.mB;R.prototype.getInputOption=R.prototype.Im;R.prototype.resetRenderingHints=R.prototype.Ew;R.prototype.setRenderingHint=R.prototype.Yy;R.prototype.getRenderingHint=R.prototype.Ve;R.prototype.maybeUpdate=R.prototype.nd;R.prototype.requestUpdate=R.prototype.Kb; R.prototype.delayInitialization=R.prototype.Rz;R.prototype.isUpdateRequested=R.prototype.LA;R.prototype.invalidateDocumentBounds=R.prototype.Va;R.prototype.findObjectsNear=R.prototype.Og;R.prototype.findPartsNear=R.prototype.jA;R.prototype.findObjectsIn=R.prototype.Nf;R.prototype.findPartsIn=R.prototype.xy;R.prototype.findObjectsAt=R.prototype.lj;R.prototype.findPartsAt=R.prototype.iA;R.prototype.findObjectAt=R.prototype.ac;R.prototype.findPartAt=R.prototype.Gm;R.prototype.focusObject=R.prototype.vA; R.prototype.alignDocument=R.prototype.Bz;R.prototype.zoomToRect=R.prototype.yB;R.prototype.zoomToFit=R.prototype.zoomToFit;R.prototype.diagramScroll=R.prototype.my;R.prototype.focus=R.prototype.focus; var He=null,yi=new zb,Ni=null,Mi=null,Xg=void 0!==ra.document,Hi=null,Ii="",Bh=new E(R,"None",0),gj=new E(R,"Uniform",1),hj=new E(R,"UniformToFill",2),Mf=new E(R,"CycleAll",10),Tf=new E(R,"CycleNotDirected",11),Vf=new E(R,"CycleNotDirectedFast",12),Wf=new E(R,"CycleNotUndirected",13),Nf=new E(R,"CycleDestinationTree",14),Pf=new E(R,"CycleSourceTree",15),bi=new E(R,"DocumentScroll",1),di=new E(R,"InfiniteScroll",2),xi=new E(R,"TreeParentCollapsed",21),Mk=new E(R,"AllParentsCollapsed",22),Nk=new E(R, "AnyParentsCollapsed",23),Ok=new H,Pk="2.2.0b4",Ik="image",Kk=!1,Qk=null,ui=!1; function vi(){if(Xg){var a=ra.document.createElement("canvas"),b=a.getContext("2d"),c=Va("7ca11abfd022028846");b[c]=Va("398c3597c01238");for(var d=["5da73c80a36455d6038e4972187c3cae51fd22",sa.Dx+"4ae6247590da4bb21c324ba3a84e385776",Fb.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",K.za],e=1;5>e;e++)b[Va("7ca11abfd7330390")](Va(d[e-1]),10,15*e);b[c]=Va("39f046ebb36e4b");for(c=1;5>c;c++)b[Va("7ca11abfd7330390")](Va(d[c-1]),10,15*c);if(4!==d.length||"5"!==d[0][0]||"7"!==d[3][0])Fb.prototype.Md=Fb.prototype.gy; Qk=a}}R.className="Diagram";R.fromDiv=function(a){var b=a;"string"===typeof a&&(b=ra.document.getElementById(a));return b instanceof HTMLDivElement&&b.D instanceof R?b.D:null};R.inherit=function(a,b){function c(){}if(Object.getPrototypeOf(a).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+a);A(a,"function",R,"inherit");A(b,"function",R,"inherit");c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};R.None=Bh;R.Uniform=gj;R.UniformToFill=hj; R.CycleAll=Mf;R.CycleNotDirected=Tf;R.CycleNotDirectedFast=Vf;R.CycleNotUndirected=Wf;R.CycleDestinationTree=Nf;R.CycleSourceTree=Pf;R.DocumentScroll=bi;R.InfiniteScroll=di;R.TreeParentCollapsed=xi;R.AllParentsCollapsed=Mk;R.AnyParentsCollapsed=Nk;function Fi(){this.qz=null;this.j="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.ff=this.j=!0:this.ff=null} function Bj(a,b){b.Db.setTransform(b.Yb,0,0,b.Yb,0,0);b.Db.ke();if(null===a.ff)a:{b="f";var c=ra[Va("76a715b2f73f148a")][Va("72ba13b5")];a.ff=!0;if(Xg){var d=R[Va("76a115b6ed251eaf4692")];if(d)for(var e=Ok.iterator;e.next();){d=e.value;d=Va(d).split(Va("39e9"));if(6>d.length)break;var f=Va(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Va(sa[Va("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[Va("76ad18b4f73e")];for(g=c[Va("73a612b6fb191d")](Va("35e7"))+2;g<f;g++)b+=c[g];f=b[Va("73a612b6fb191d")](Va(d[2])); 0>f&&Va(d[2])!==Va("7da71ca0ad381e90")&&(f=b[Va("73a612b6fb191d")](Va("76a715b2ef3e149757")));0>f&&(f=b[Va("73a612b6fb191d")](Va("76a715b2ef3e149757")));0>f&&(f=c[Va("73a612b6fb191d")](Va("7baa19a6f76c1988428554")));a.ff=!(0<=f&&f<b[Va("73a612b6fb191d")](Va("35"))||-1===b[Va("73a612b6fb191d")](Va("35")));if(!a.ff)break;f=Va(d[2]);if("#"===f[0]){g=ra.document.createElement("div");for(var h=d[0].replace(/[A-Za-z]/g,"");4>h.length;)h+="9";h=h.substr(h.length-4);d="";d+=["gsh","gsf"][parseInt(h.substr(0, 1),10)%2];d+=["Header","Background","Display","Feedback"][parseInt(h.substr(0,1),10)%4];g[Va("79a417a0f0181a8946")]=d;if(ra.document[Va("78a712aa")]){if(ra.document[Va("78a712aa")][Va("7bb806b6ed32388c4a875b")](g),h=ra.getComputedStyle(g).getPropertyValue(Va("78a704b7e62456904c9b12701b6532a8")),ra.document[Va("78a712aa")][Va("68ad1bbcf533388c4a875b")](g),h)if(-1!==h.indexOf(parseInt(f[1]+f[2],16))&&-1!==h.indexOf(parseInt(f[3]+f[4],16))){a.ff=!1;break}else if(Wa||Za)for(d="."+d,f=0;f<document.styleSheets.length;f++){g= document.styleSheets[f].rules||document.styleSheets[f].cssRules;for(var k in g)if(d===g[k].selectorText){a.ff=!1;break a}}}else a.ff=null,a.ff=!1}}}else{k=c[Va("76ad18b4f73e")];for(e=c[Va("73a612b6fb191d")](Va("35e7"))+2;e<k;e++)b+=c[e];c=b[Va("73a612b6fb191d")](Va("7da71ca0ad381e90"));a.ff=!(0<=c&&c<b[Va("73a612b6fb191d")](Va("35")))}}}return 0<a.ff&&a!==a.qz?!0:!1} function Gi(a,b){if(Xg){void 0!==b&&null!==b||v("Diagram setup requires an argument DIV.");null!==a.Ja&&v("Diagram has already completed setup.");"string"===typeof b?a.Ja=ra.document.getElementById(b):b instanceof HTMLDivElement?a.Ja=b:v("No DIV or DIV id supplied: "+b);null===a.Ja&&v("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ja.D&&v("Invalid div id; div already has a Diagram associated with it.");if(!a.cm&&ra.ResizeObserver){var c=ta(function(){a.Kb()},250);a.cm=new ra.ResizeObserver(function(){c()}); a.cm.observe(a.Ja)}"static"===ra.getComputedStyle(a.Ja,null).position&&(a.Ja.style.position="relative");b=5;var d="rgba(2"+b+"5, 255, 255, 0)";b--;a.Ja.style["-webkit-tap-highlight-color"]=d;a.Ja.innerHTML="";a.Ja.D=a;a.Ja.goDiagram=a;a.Ja.go=ra.go;var e=a.pq?new Gj(a):new Jk(a);void 0!==e.style&&(e.style.position="absolute",e.style.top="0px",e.style.left="0px","rtl"===ra.getComputedStyle(a.Ja,null).getPropertyValue("direction")&&(a.Il=!0),e.style.zIndex="2",e.style.userSelect="none",e.style.MozUserSelect= "none",e.style.touchAction="none");a.Ga=e;a.Db=e.context;d=a.Db;a.Yb=a.computePixelRatio();a.viewSize.s()||(a.Ba=a.Ja.clientWidth||1,a.Aa=a.Ja.clientHeight||1);Ij(a,a.Ba,a.Aa);a.Ja.insertBefore(e.Qa,a.Ja.firstChild);e=new Jk(null);e.width=1;e.height=1;a.Lu=e;a.yx=e.context;if(Xg){e=va("div");var f=va("div");e.style.position="absolute";e.style.overflow="auto";e.style.width=a.Ba+"px";e.style.height=a.Aa+"px";e.style.zIndex="1";f.style.position="absolute";f.style.width="1px";f.style.height="1px";a.Ja.appendChild(e); e.appendChild(f);e.onscroll=Xi;e.addEventListener("pointerdown",Zi);e.D=a;e.oz=!0;e.pz=!0;a.et=e;a.Xp=f}a.fr=ta(function(){a.Fh=null;a.R()},300);a.Yw=ta(function(){Ch(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.Lk=function(b){if(a.isEnabled){var c=lj(a,b,!0);c.bubbles=!0;var d=0,e=0;c.delta=0;void 0!==b.deltaX?(0!==b.deltaX&&(d=0<b.deltaX?1:-1),0!==b.deltaY&&(e=0<b.deltaY?1:-1),c.delta=Math.abs(b.deltaX)>Math.abs(b.deltaY)?-d:-e):void 0!==b.wheelDeltaX?(0!==b.wheelDeltaX&& (d=0<b.wheelDeltaX?-1:1),0!==b.wheelDeltaY&&(e=0<b.wheelDeltaY?-1:1),c.delta=Math.abs(b.wheelDeltaX)>Math.abs(b.wheelDeltaY)?-d:-e):void 0!==b.wheelDelta&&0!==b.wheelDelta&&(c.delta=0<b.wheelDelta?1:-1);a.doMouseWheel();pj(a,c,b)}};a.WA=function(b){a.isEnabled&&(a.Tj=!1,lj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.Ok=function(b){if(a.isEnabled){a.Tj=!0;var c=a.Ss;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.hk;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(c="touch"===b.pointerType||"pen"===b.pointerType)a.tt=!1,a.ws=!0;var e=d;d=oj(a,b,!0,!1,!0,e);mj(a,b,d);d.targetDiagram=nj(b);d.targetObject=null;e||d.clone(a.vl);e=a.fv;c=c?25:10;b.timeStamp-a.ev<a.Sx&&!(Math.abs(e.x-b.screenX)>c||Math.abs(e.y-b.screenY)>c)?a.Po++:a.Po=1;d.clickCount=a.Po;a.ev=b.timeStamp;a.fv.Sg(b.screenX,b.screenY);a.doMouseDown(); 1===b.button?b.preventDefault():pj(a,d,b)}};a.Pk=function(b){if(a.isEnabled){a.Tj=!0;var c=a.hk;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}if(c[0].pointerId===b.pointerId){c=oj(a,b,!1,!1,!1,null!==c[1]);var d=ra.document.elementFromPoint(b.clientX,b.clientY);null!==d&&void 0!==d.shadowRoot&&null!==d.shadowRoot&&(d=d.shadowRoot.elementFromPoint(b.clientX,b.clientY));var e=a,f=b;d&&d.D&&(f=b, e=d.D);c.targetDiagram=e;mj(a,f,c);c.targetObject=null;a.doMouseMove();pj(a,c,b)}}};a.Rk=function(b){if(a.isEnabled){a.Tj=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.Ss;if(c&&a.tt)delete d[b.pointerId],b.preventDefault();else if(d=a.hk,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=oj(a,b,!1,!0,!0,!1);var e=ra.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.D instanceof R&&e.D!==a&&mj(e.D,b,d);mj(a,b,d);d.clickCount=a.Po;null===e?d.targetDiagram=nj(b):e.D?d.targetDiagram= e.D:d.targetDiagram=null;d.targetObject=null;a.doMouseUp();pj(a,d,b);c&&(a.ws=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.Qk=function(b){if(a.isEnabled){a.Tj=!1;var c=a.Ss;c[b.pointerId]&&delete c[b.pointerId];c=a.hk;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())}};a.$r=d.aa["d"+Rk[1]+Rk[2]+"wI"+Ik.slice(1, 5)]["b"+Sk.slice(1,b)](d.aa,Qk,b,b);d.Oc(!0);Vi(a)}}Fi.className="DiagramHelper";function ef(a){this.j=void 0===a?new J:a;this.o=new J}na.Object.defineProperties(ef.prototype,{point:{configurable:!0,get:function(){return this.j},set:function(a){this.j=a}},shifted:{configurable:!0,get:function(){return this.o},set:function(a){this.o=a}}});var Rk="DraggingInfo";ef.className="DraggingInfo";function Tj(a,b,c){this.node=a;this.info=b;this.hw=c}Tj.className="DraggingNodeInfoPair"; function Ye(){this.reset()}Ye.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new Db(NaN,NaN)).freeze();this.gridSnapCellSpot=Dc;this.gridSnapOrigin=(new J(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.dragsMembers=this.groupsAlwaysMove=!0};Ye.className="DraggingOptions"; function Tk(a,b){if("string"===typeof a||ra.Element&&a instanceof Element)var c=R.call(this,a)||this;else c=R.call(this)||this,b=a;Uk(c);b&&c.en(b);return c}ma(Tk,R);function Uk(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=Ec;a.layout=new Vk}Tk.prototype.reset=function(){R.prototype.reset.call(this);Uk(this)};Tk.className="Palette"; function Wk(a,b){if("string"===typeof a||ra.Element&&a instanceof Element)var c=R.call(this,a)||this;else c=R.call(this)||this,b=a;var d=c;c.animationManager.isEnabled=!1;c.Xb=!0;c.La=null;c.xl=!1;c.yl=!1;c.P=!0;c.F=!0;c.bb=0;c.o=!1;c.jm=null;c.Yy("drawShadows",!1);a=new U;var e=new Kf;e.stroke="magenta";e.strokeWidth=2;e.fill="transparent";e.name="BOXSHAPE";a.selectable=!0;a.selectionAdorned=!1;a.selectionObjectName="BOXSHAPE";a.locationObjectName="BOXSHAPE";a.resizeObjectName="BOXSHAPE";a.cursor= "move";a.add(e);c.j=a;c.allowCopy=!1;c.allowDelete=!1;c.allowSelect=!0;c.autoScrollRegion=new gc(0,0,0,0);c.oa.h(0,0);c.toolManager.gb("Dragging",new Xk,c.toolManager.mouseMoveTools);c.click=function(){var a=d.observed;if(null!==a){var b=a.viewportBounds,c=d.lastInput.documentPoint;a.position=new J(c.x-b.width/2,c.y-b.height/2)}};c.ci=function(){d.Va();Yk(d)};c.bi=function(){null!==d.observed&&(d.Va(),d.R())};c.Fc=function(){1>d.updateDelay?d.R():d.o||(d.o=!0,setTimeout(function(){return d.redraw()}, d.updateDelay))};c.Rd=function(){null!==d.observed&&Yk(d)};c.autoScale=gj;c.Xb=!1;b&&Object.assign(c,b);return c}ma(Wk,R);Wk.prototype.computePixelRatio=function(){return 1}; Wk.prototype.redraw=function(){if(this.o&&1<=this.updateDelay){this.o=!1;var a=this.Ga,b=this.Db;if(null!==a&&null!==b){zj(this);if(null===this.jm){var c=new Jk(null);c.width=a.width;c.height=a.height;this.jm=c}try{this.Ga=this.jm,this.Db=this.Ga.context,this.Db.Oc(!0),this.Db.setTransform(1,0,0,1,0,0),this.Db.clearRect(0,0,this.Ga.width,this.Ga.height),Zk(this)}finally{this.Ga=a,this.Db=b}}}R.prototype.redraw.call(this)}; Wk.prototype.rc=function(){null===this.Ja&&v("No div specified");null===this.Ga&&v("No canvas specified");if(!(this.Ga instanceof Gj)&&(pi(this.box),this.Ic)){var a=this.observed;if(null!==a&&!a.animationManager.defaultAnimation.isAnimating&&a.tj){zj(this);var b=this.Ga;a=this.Db;a.Oc(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?Zk(this):null!==this.jm&&(a.drawImage(this.jm.Qa,0,0),b=this.vb,b.reset(),1!==this.scale&&b.scale(this.scale),0===this.position.x&& 0===this.position.y||b.translate(-this.position.x,-this.position.y),a.scale(this.Yb,this.Yb),a.transform(b.m11,b.m12,b.m21,b.m22,b.dx,b.dy));b=this.Ra.l;for(var c=b.length,d=0;d<c;d++)b[d].rc(a,this);this.Ic=this.Ci=!1}}}; function Zk(a){var b=a.observed;if(null!==b){var c=a.drawsTemporaryLayers,d=a.drawsGrid&&c,e=b.grid;d&&null!==e&&e.visible&&!isNaN(e.width)&&!isNaN(e.height)&&(e=M.alloc().assign(a.viewportBounds).Yc(b.viewportBounds),sj(b,e),M.free(e),wh(b));var f=a.vb;f.reset();1!==a.scale&&f.scale(a.scale);0===a.position.x&&0===a.position.y||f.translate(-a.position.x,-a.position.y);e=a.Db;e.scale(a.Yb,a.Yb);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Ra.l;f=b.length;for(var g=0;g<f;g++){var h=b[g],k=a;if(h.visible&& 0!==h.opacity){var l=h.diagram.grid.part;if(!c&&h.isTemporary)d&&l.layer===h&&(h=qi(h,e),l.rc(e,k),e.globalAlpha=h);else{for(var m=qi(h,e),n=k.scale,p=M.alloc(),r=h.Ka.l,q=r.length,u=0;u<q;u++){var y=r[u];(d||y!==l)&&h.gj(e,y,k,null,n,p,!1)}M.free(p);e.globalAlpha=m}}}}} function Yk(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Ic=!0;c=c.viewportBounds;var d=b.selectionObject,e=Db.alloc();e.h(c.width,c.height);d.desiredSize=e;Db.free(e);a=2/a.scale;d instanceof Kf&&(d.strokeWidth=a);b.location=new J(c.x-a/2,c.y-a/2);b.isSelected=!0}}}Wk.prototype.computeBounds=function(){var a=this.observed;if(null===a)return tc;var b=a.documentBounds.copy();b.Yc(a.viewportBounds);return b};Wk.prototype.invalidateViewport=function(){!0!==this.Ic&&(this.Ic=!0,this.Kb())}; Wk.prototype.onViewportBoundsChanged=function(a,b,c,d){this.Xb||($i(this),this.R(),ej(this),this.Va(),Yk(this),this.Nc.scale=c,this.Nc.position.x=a.x,this.Nc.position.y=a.y,this.Nc.bounds.assign(a),this.Nc.ow=d,this.V("ViewportBoundsChanged",this.Nc,a))}; na.Object.defineProperties(Wk.prototype,{observed:{configurable:!0,get:function(){return this.La},set:function(a){var b=this.La;null!==a&&w(a,R,Wk,"observed");a instanceof Wk&&v("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.Sm("ViewportBoundsChanged",this.ci),b.Sm("DocumentBoundsChanged",this.bi),b.Sm("InvalidateDraw",this.Fc),b.Sm("AnimationFinished",this.Rd));this.La=a;null!==a&&(a.qk("ViewportBoundsChanged",this.ci),a.qk("DocumentBoundsChanged", this.bi),a.qk("InvalidateDraw",this.Fc),a.qk("AnimationFinished",this.Rd),this.add(this.box));this.Va();if(null===a){this.jm=null;var c=this.Ga,d=this.Db;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else this.Fc(null),Yk(this),this.R();this.g("observed",b,a)}}},box:{configurable:!0,get:function(){return this.j},set:function(a){var b=this.j;b!==a&&(this.j=a,this.remove(b),this.add(this.j),Yk(this),this.g("box",b,a))}},drawsTemporaryLayers:{configurable:!0, get:function(){return this.P},set:function(a){this.P!==a&&(this.P=a,this.redraw())}},drawsGrid:{configurable:!0,get:function(){return this.F},set:function(a){this.F!==a&&(this.F=a,this.redraw())}},updateDelay:{configurable:!0,get:function(){return this.bb},set:function(a){0>a&&(a=0);this.bb!==a&&(this.bb=a)}}});Wk.className="Overview";function Xk(){Xe.call(this);this.j=null}ma(Xk,Xe); Xk.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.j=new J(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new J(a.x-this.j.x,a.y-this.j.y));return!0}; Xk.prototype.doActivate=function(){this.j=null;Xe.prototype.doActivate.call(this)};Xk.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};Xk.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.j){var d=a.firstInput.documentPoint;c=c.location;this.j=new J(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new J(a.x-this.j.x,a.y-this.j.y)}}};Xk.className="OverviewDraggingTool"; function $k(){0<arguments.length&&Ca($k);cb(this);this.D=He;this.bb=this.F=this.o=!0;this.P=this.La=this.Fc=this.Ma=!1;this.Pi=this.j=null;this.Rd=1.05;this.dv=NaN;this.Ex=null;this.Gv=NaN;this.Fv=tc;this.Gc=!0;this.Bg=null;this.Zc=200}$k.prototype.toString=function(){return"CommandHandler"};$k.prototype.me=function(a){this.D=a}; $k.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=$a?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():"F2"===f||b.event&&"F2"===b.event.key?this.canEditTextBlock()&&this.editTextBlock():"ContextMenu"===f||b.event&&"ContextMenu"===b.event.key?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()}; $k.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};$k.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Ua&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};$k.prototype.canStopCommand=function(){return!0}; $k.prototype.selectAll=function(){var a=this.diagram;a.R();try{a.currentCursor="wait";a.V("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.V("ChangedSelection",a.selection),a.currentCursor=""}};$k.prototype.canSelectAll=function(){return this.diagram.allowSelect}; $k.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.V("ChangingSelection",a.selection);a.Da("Delete");a.V("SelectionDeleting",a.selection);for(var b=new I,c=a.selection.iterator;c.next();)al(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.mu(b,!0);a.V("SelectionDeleted",b)}finally{a.cb("Delete"),a.V("ChangedSelection",a.selection),a.currentCursor=""}}; $k.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};$k.prototype.copySelection=function(){var a=this.diagram,b=new I;for(a=a.selection.iterator;a.next();)al(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};$k.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1}; $k.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};$k.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1}; $k.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Hi=null,Ii="";else{c=b.model;var d=!1,e=!1,f=null;try{c.Lm()&&(d=c.xk,c.xk=this.copiesParentKey),c.Hk()&&(e=c.wk,c.wk=this.copiesGroupKey),f=b.yk(a,null,!0)}finally{c.Lm()&&(c.xk=d),c.Hk()&&(c.wk=e),c=new H,c.addAll(f),Hi=c,Ii=b.model.dataFormat}}b.V("ClipboardChanged",c)}; $k.prototype.pasteFromClipboard=function(){var a=new I,b=Hi;if(null===b)return a;var c=this.diagram;if(Ii!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.Lm()&&(e=d.xk,d.xk=this.copiesParentKey),d.Hk()&&(f=d.wk,d.wk=this.copiesGroupKey),g=c.yk(b,c,!1)}finally{for(d.Lm()&&(d.xk=e),d.Hk()&&(d.wk=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}; $k.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.V("ChangingSelection",b.selection);b.Da("Paste");var c=this.pasteFromClipboard();0<c.count&&b.clearSelection(!0);for(var d=c.iterator;d.next();)d.value.isSelected=!0;if(null!==a){var e=b.computePartsBounds(b.selection);if(e.s()){var f=this.computeEffectiveCollection(b.selection,b.kl);vf(b,f,new J(a.x-e.centerX,a.y-e.centerY),b.kl,!1)}}b.V("ClipboardPasted",c)}finally{b.cb("Paste"),b.V("ChangedSelection", b.selection),b.currentCursor=""}};$k.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Hi||0===Hi.count||Ii!==a.model.dataFormat?!1:!0};$k.prototype.undo=function(){this.diagram.undoManager.undo()};$k.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};$k.prototype.redo=function(){this.diagram.undoManager.redo()}; $k.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};$k.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);C(a,$k,"decreaseZoom:factor");var b=this.diagram;b.autoScale===Bh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))}; $k.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);C(a,$k,"canDecreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Bh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};$k.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);C(a,$k,"increaseZoom:factor");var b=this.diagram;b.autoScale===Bh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))}; $k.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);C(a,$k,"canIncreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Bh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};$k.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);C(a,$k,"resetZoom:newscale");var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)}; $k.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);C(a,$k,"canResetZoom:newscale");var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom}; $k.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.tc();a.redraw();var c=a.position,d=a.scale;uh(b,"Zoom To Fit");this.isZoomToFitRestoreEnabled&&d===this.Gv&&!isNaN(this.dv)&&a.documentBounds.B(this.Fv)?(a.scale=this.dv,a.position=this.Ex,this.Gv=NaN,this.Fv=tc):(this.dv=d,this.Ex=c.copy(),a.zoomToFit(),this.Gv=a.scale,this.Fv=a.documentBounds.copy());xh(b)};$k.prototype.canZoomToFit=function(){return this.diagram.allowZoom}; $k.prototype.scrollToPart=function(a){void 0===a&&(a=null);null!==a&&w(a,U,$k,"part");var b=this.diagram;b.Xa();if(null===a){try{null!==this.Bg&&(this.Bg.next()?a=this.Bg.value:this.Bg=null)}catch(k){this.Bg=null}null===a&&(0<b.highlighteds.count?this.Bg=b.highlighteds.iterator:0<b.selection.count&&(this.Bg=b.selection.iterator),null!==this.Bg&&this.Bg.next()&&(a=this.Bg.value))}if(null!==a){var c=b.animationManager;uh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=bl(this,a,[a]); if(1===e.length)b.Da(),b.Ht(a.actualBounds),b.cb("Scroll To Part");else{var f=function(){b.Da();for(var a=e.pop();0<e.length&&a instanceof V&&a.isTreeExpanded&&(!(a instanceof yf)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof U&&b.Hw(a.actualBounds),a instanceof V&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof yf&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof U&&b.Ht(a.actualBounds),b.Sm("LayoutCompleted",g));b.cb("Scroll To Part")},g=function(){ua(f,(c.isEnabled? c.duration:0)+d)};b.qk("LayoutCompleted",g);f()}}else{var h=b.position.copy();b.Ht(a.actualBounds);h.Ya(b.position)&&c.tc()}}}; function bl(a,b,c){if(b.isVisible())return c;if(b instanceof Le)bl(a,b.adornedPart,c);else if(b instanceof T){var d=b.fromNode;null!==d&&bl(a,d,c);b=b.toNode;null!==b&&bl(a,b,c)}else b instanceof V&&(d=b.labeledLink,null!==d&&bl(a,d,c),d=b.Pg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),bl(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),bl(a,b,c));return c} $k.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof U))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll}; $k.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Da("Collapse Tree");uh(b.animationManager,"Collapse Tree");var c=new H;if(null!==a&&a.isTreeExpanded)a.collapseTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.V("TreeCollapsed",c)}finally{b.cb("Collapse Tree")}}; $k.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V&&a.isTreeExpanded))return!1;if(0<a.Pq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&b.isTreeExpanded&&0<b.Pq().count)return!0;return!1}; $k.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Da("Expand Tree");uh(b.animationManager,"Expand Tree");var c=new H;if(null!==a&&!a.isTreeExpanded)a.expandTree(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof V&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.V("TreeExpanded",c)}finally{b.cb("Expand Tree")}}; $k.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof V)||a.isTreeExpanded)return!1;if(0<a.Pq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof V&&!b.isTreeExpanded&&0<b.Pq().count)return!0;return!1}; $k.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.sj()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.V("ChangingSelection",a.selection);a.Da("Group");for(var e=new H,f=a.selection.iterator;f.next();){var g=f.value;g.Uc()&&g.canGroup()&&e.add(g)}for(var h=new H,k=e.iterator;k.next();){var l=k.value;f=!1;for(var m=e.iterator;m.next();)if(l.Nd(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.Nd(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof yf)og(c),d=c.copy(),null!==d&&a.add(d);else if(b.Yt(c)){var r=b.copyNodeData(c);Ga(r)&&(b.Gf(r),d=a.kj(r))}if(null!==d){null!==n&&this.isValidMember(n,d)&&(d.containingGroup=n);for(var q=h.iterator;q.next();){var u=q.value;this.isValidMember(d,u)&&(u.containingGroup=d)}a.clearSelection(!0);d.isSelected=!0}}a.V("SelectionGrouped",d)}finally{a.cb("Group"),a.V("ChangedSelection", a.selection),a.currentCursor=""}}}};$k.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.sj()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.Uc()&&b.canGroup())return!0}return!1}; function cl(a){var b=Ma();for(a=a.iterator;a.next();){var c=a.value;c instanceof T||b.push(c)}a=new I;c=b.length;for(var d=0;d<c;d++){for(var e=b[d],f=!0,g=0;g<c;g++)if(e.Nd(b[g])){f=!1;break}f&&a.add(e)}Oa(b);return a} $k.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof T)return!1;if(null!==a){if(a===b||a.Nd(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}; $k.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.sj())try{b.currentCursor="wait";b.V("ChangingSelection",b.selection);b.Da("Ungroup");var d=new H;if(null!==a)d.add(a);else for(var e=b.selection.iterator;e.next();){var f=e.value;f instanceof yf&&f.canUngroup()&&d.add(f)}var g=new H;if(0<d.count){b.clearSelection(!0);for(var h=d.iterator;h.next();){var k=h.value;k.expandSubGraph();var l=k.containingGroup,m=null!==l&&null!==l.data?c.va(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 T)){var r=p.data;null!==r?c.lr(r,m):p.containingGroup=l}}b.remove(k)}}b.V("SelectionUngrouped",d,g)}finally{b.cb("Ungroup"),b.V("ChangedSelection",b.selection),b.currentCursor=""}}; $k.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.sj())return!1;if(null!==a){if(!(a instanceof yf))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof yf&&b.canUngroup())return!0;return!1}; $k.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=cl(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c}; $k.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Da("Collapse SubGraph");uh(b.animationManager,"Collapse SubGraph");var c=new H;if(null!==a&&a.isSubGraphExpanded)a.collapseSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof yf&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.V("SubGraphCollapsed",c)}finally{b.cb("Collapse SubGraph")}}; $k.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof yf&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof yf&&b.isSubGraphExpanded)return!0;return!1}; $k.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Da("Expand SubGraph");uh(b.animationManager,"Expand SubGraph");var c=new H;if(null!==a&&!a.isSubGraphExpanded)a.expandSubGraph(),c.add(a);else if(null===a)for(var d=b.selection.iterator;d.next();){var e=d.value;e instanceof yf&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.V("SubGraphExpanded",c)}finally{b.cb("Expand SubGraph")}}; $k.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof yf&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof yf&&!b.isSubGraphExpanded)return!0;return!1}; $k.prototype.editTextBlock=function(a){void 0===a&&(a=null);null!==a&&w(a,Zg,$k,"editTextBlock");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.Fm(function(a){return a instanceof Zg&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}}; $k.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 Zg))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.Fm(function(a){return a instanceof Zg&&a.editable}),null!==a))return!0;return!1}; $k.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 O?e=a.ja(Jc):b.viewportBounds.ca(d.documentPoint)||(e=b.viewportBounds,e=new J(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.nr(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;Vg(c,!1,a)}}; $k.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}; $k.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.kl);d=new zb;if(null===a)return d;for(var f=a.iterator;f.next();)Rj(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 T&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d}; na.Object.defineProperties($k.prototype,{diagram:{configurable:!0,get:function(){return this.D}},copiesClipboardData:{configurable:!0,get:function(){return this.o},set:function(a){A(a,"boolean",$k,"copiesClipboardData");this.o=a}},copiesConnectedLinks:{configurable:!0,get:function(){return this.F},set:function(a){A(a,"boolean",$k,"copiesConnectedLinks");this.F=a}},deletesConnectedLinks:{configurable:!0,get:function(){return this.bb},set:function(a){A(a, "boolean",$k,"deletesConnectedLinks");this.bb=a}},copiesTree:{configurable:!0,get:function(){return this.Ma},set:function(a){A(a,"boolean",$k,"copiesTree");this.Ma=a}},deletesTree:{configurable:!0,get:function(){return this.Fc},set:function(a){A(a,"boolean",$k,"deletesTree");this.Fc=a}},copiesParentKey:{configurable:!0,get:function(){return this.La},set:function(a){A(a,"boolean",$k,"copiesParentKey");this.La=a}},copiesGroupKey:{configurable:!0, get:function(){return this.P},set:function(a){A(a,"boolean",$k,"copiesGroupKey");this.P=a}},archetypeGroupData:{configurable:!0,get:function(){return this.j},set:function(a){null!==a&&A(a,"object",$k,"archetypeGroupData");var b=this.diagram;G&&(b=b.model,!b.sj()||a instanceof yf||b.Yt(a)||v("CommandHandler.archetypeGroupData must be either a Group or a data object for which GraphLinksModel.isGroupForNodeData is true: "+a));this.j=a}},memberValidation:{configurable:!0,get:function(){return this.Pi}, set:function(a){null!==a&&A(a,"function",$k,"memberValidation");this.Pi=a}},defaultScale:{configurable:!0,get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{configurable:!0,get:function(){return this.Rd},set:function(a){C(a,$k,"zoomFactor");1<a||v("zoomFactor must be larger than 1.0, not: "+a);this.Rd=a}},isZoomToFitRestoreEnabled:{configurable:!0,get:function(){return this.Gc},set:function(a){A(a,"boolean", $k,"isZoomToFitRestoreEnabled");this.Gc=a}},scrollToPartPause:{configurable:!0,get:function(){return this.Zc},set:function(a){C(a,$k,"scrollToPartPause");this.Zc=a}}});$k.className="CommandHandler";Bi=function(){return new $k}; function O(){cb(this);this.H=4225027;this.mb=1;this.yg=null;this.ta="";this.od=this.Wb=null;this.oa=(new J(NaN,NaN)).freeze();this.cd=Yb;this.pg=Qb;this.og=Xb;this.vb=new Fb;this.ei=new Fb;this.Fb=null;this.wa=this.ql=1;this.Cb=0;this.Pe=dl;this.uh=Ac;this.pc=(new M(NaN,NaN,NaN,NaN)).freeze();this.Ab=(new M(NaN,NaN,NaN,NaN)).freeze();this.wc=(new M(0,0,NaN,NaN)).freeze();this.T=this.Fp=this.Gp=null;this.Zk=this.Bb=ed;this.Rp=0;this.Sp=1;this.bh=0;this.In=1;this.kq=null;this.Yp=-Infinity;this.em=0; this.fm=Lb;this.gm=dg;this.ui="";this.lb=this.S=null;this.dl=-1;this.im=this.hb=this.ti=this.mm=null;this.Vs=pg;this.Up=this.Wg=this.gk=null}var Cd,pg,rg,dl,el,fl,gl,hl,il,jl; O.prototype.cloneProtected=function(a){a.H=this.H|6144;a.mb=this.mb;a.ta=this.ta;a.Wb=this.Wb;a.od=this.od;a.Wg=this.Wg;a.oa.assign(this.oa);a.cd=this.cd.L();a.pg=this.pg.L();a.og=this.og.L();null!==this.Fb?a.Fb=this.Fb.copy():a.Fb=null;a.wa=this.wa;a.Cb=this.Cb;a.Pe=this.Pe;a.uh=this.uh.L();a.pc.assign(this.pc);a.Ab.assign(this.Ab);a.wc.assign(this.wc);a.Fp=this.Fp;null!==this.T&&(a.T=this.T.copy());a.Bb=this.Bb.L();a.Zk=this.Zk.L();a.Rp=this.Rp;a.Sp=this.Sp;a.bh=this.bh;a.In=this.In;a.kq=this.kq; a.Yp=this.Yp;a.em=this.em;a.fm=this.fm.L();a.gm=this.gm;a.ui=this.ui;null!==this.S&&(a.S=this.S.copy());a.lb=this.lb;a.dl=this.dl;null!==this.ti&&(a.ti=Ja(this.ti));null!==this.hb&&(a.hb=this.hb.copy());a.im=this.im};O.prototype.Yx=function(a){var b=this.ti;if(Ha(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.ti=b=[];b.push(a)};O.prototype.Kf=function(a){a.Gp=null;a.gk=null;a.v()}; O.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.ti)for(var b=0;b<this.ti.length;b++){var c=this.ti[b];a[c]=this[c]}return a};O.prototype.copy=function(){return this.clone()};t=O.prototype;t.ob=function(a){a.classType===T?0===a.name.indexOf("Orient")?this.segmentOrientation=a:v("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===O?this.stretch=a:Ea(this,a)};t.toString=function(){return Pa(this.constructor)+"#"+mb(this)}; function kl(a){null===a.S&&(a.S=new ll)}t.Rc=function(){if(null===this.T){var a=new ml;a.nh=Cc;a.Jh=Cc;a.lh=10;a.Hh=10;a.mh=0;a.Ih=0;this.T=a}}; t.ab=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.Sk(a,b,c,d,e,f,g),c===this&&a===se&&nl(this)&&ol(this,h,b),f=this.diagram,null===this.Wg||null===f||!f.tj||f.undoManager.isUndoingRedoing||f.currentTool!==f.toolManager||f.animationManager.Dn||(a=this.Wg.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.Up&&(this.Up=new zb),g=0===f.undoManager.transactionLevel,a.startCondition===li?g=!0:a.startCondition===ni&&(g=!1),g?(f=new th,mi(a,f),g=this.Up.get(a), null!==g&&g.stop(),this.Up.add(a,f),f.Cv=this,f.Tx=a,f.add(this,b,d,e),f.start()):(vh(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof W&&c===h&&0!==(h.H&16777216)&&null!==h.data))for(c=this.$.l,d=c.length,e=0;e<d;e++)h=c[e],h instanceof W&&Jj(h,function(a){null!==a.data&&0!==(a.H&16777216)&&a.Ia(b)})}; function ol(a,b,c){var d=a.jj();if(null!==d)for(var e=a.lb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=pl(f,d,a);if(null===g)continue;f.sr(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.sr(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.sr(a,h,c,d)}g===a&&(h=d.Lt(f.Cj),null!==h&&f.Vw(h,g,c))}}t.Lt=function(a){return this.dl===a?this:null}; t.g=function(a,b,c){this.ab(se,a,this,b,c)};t.Ge=function(a,b,c,d){var e=this.pc;e.h(a,b,c,d);if(1!==this.wa||0!==this.Cb){null===this.Fb&&(this.Fb=new Fb);var f=this.Fb;f.reset();this.eq(f,a,b,c,d);f.pr(e)}};function ql(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Tc(b,d):a.Qh(b,d)} t.wy=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Lf(b);return c?Hb(a.x,a.y,0,0,0,d.height)<=b||Hb(a.x,a.y,0,d.height,d.width,d.height)<=b||Hb(a.x,a.y,d.width,d.height,d.width,0)<=b||Hb(a.x,a.y,d.width,0,0,0)<=b:a.vd(0,0)<=b&&a.vd(0,d.height)<=b&&a.vd(d.width,0)<=b&&a.vd(d.width,d.height)<=b};t.pe=function(){return!0}; t.ca=function(a){G&&w(a,J,O,"containsPoint:p");var b=J.alloc();b.assign(a);this.transform.Fa(b);var c=this.actualBounds;if(!c.s())return J.free(b),!1;var d=this.diagram;if(null!==d&&d.ws){var e=d.Im("extraTouchThreshold"),f=d.Im("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Of()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=nc(c.x-g*k,c.y-g*k,c.width+f*k,c.height+f*k,b.x,b.y),J.free(b),a}e=!1;if(this instanceof Le||this instanceof Kf?nc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y): c.ca(b))this.hb&&!this.hb.ca(b)?e=!1:null!==this.od&&c.ca(b)?e=!0:null!==this.Wb&&this.wc.ca(a)?e=!0:e=this.Rh(a);J.free(b);return e};t.Rh=function(a){var b=this.naturalBounds;return nc(0,0,b.width,b.height,a.x,a.y)}; t.Te=function(a){if(0===this.angle)return this.actualBounds.Te(a);var b=this.naturalBounds;b=M.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=J.allocAt(a.x,a.y);b.ca(c.Md(e))&&(e.h(a.x,a.bottom),b.ca(c.Md(e))&&(e.h(a.right,a.bottom),b.ca(c.Md(e))&&(e.h(a.right,a.y),b.ca(c.Md(e))&&(d=!0))));J.free(e);M.free(b);return d}; t.Qh=function(a,b){G&&w(a,M,O,"containedInRect:r");if(void 0===b)return a.Te(this.actualBounds);var c=this.naturalBounds,d=!1,e=J.allocAt(0,0);a.ca(b.Fa(e))&&(e.h(0,c.height),a.ca(b.Fa(e))&&(e.h(c.width,c.height),a.ca(b.Fa(e))&&(e.h(c.width,0),a.ca(b.Fa(e))&&(d=!0))));J.free(e);return d}; t.Tc=function(a,b){G&&w(a,M,O,"intersectsRect:r");if(void 0===b&&(b=this.transform,0===this.angle))return a.Tc(this.actualBounds);var c=this.naturalBounds,d=J.allocAt(0,0),e=J.allocAt(0,c.height),f=J.allocAt(c.width,c.height),g=J.allocAt(c.width,0),h=!1;if(a.ca(b.Fa(d))||a.ca(b.Fa(e))||a.ca(b.Fa(f))||a.ca(b.Fa(g)))h=!0;else{c=M.allocAt(0,0,c.width,c.height);var k=J.allocAt(a.x,a.y);c.ca(b.Md(k))?h=!0:(k.h(a.x,a.bottom),c.ca(b.Md(k))?h=!0:(k.h(a.right,a.bottom),c.ca(b.Md(k))?h=!0:(k.h(a.right,a.y), c.ca(b.Md(k))&&(h=!0))));J.free(k);M.free(c);!h&&(K.Vt(a,d,e)||K.Vt(a,e,f)||K.Vt(a,f,g)||K.Vt(a,g,d))&&(h=!0)}J.free(d);J.free(e);J.free(f);J.free(g);return h};t.ja=function(a,b){void 0===b&&(b=new J);if(a instanceof Eb){G&&a.bc()&&v("getDocumentPoint:s Spot must be specific: "+a.toString());var c=this.naturalBounds;b.h(a.x*c.width+a.offsetX,a.y*c.height+a.offsetY)}else b.set(a);this.je.Fa(b);return b}; t.pj=function(a){void 0===a&&(a=new M);var b=this.naturalBounds,c=this.je,d=J.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);jc(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);jc(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);jc(a,d.x,d.y,0,0);J.free(d);return a};t.oj=function(){var a=this.je;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.Of=function(){if(0!==(this.H&4096)===!1)return this.ql;var a=this.wa;return null!==this.panel?a*this.panel.Of():a};t.Rt=function(a,b){void 0===b&&(b=new J);b.assign(a);this.je.Md(b);return b};t.St=function(a,b,c){return this.Ek(a.x,a.y,b.x,b.y,c)}; t.Ek=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,K.Qf(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=K.Qf(0,0,d.width,d.height,g,a,b,c,e);e.transform(f);return c}; O.prototype.measure=function(a,b,c,d){if(!1!==wj(this)){var e=this.uh,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 Kf&&(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(rl(this,!0)){case pg:g=e=0;h&&(b=a=Infinity); break;case Cd:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case el:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case fl: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.pc.ka();this.Om(a,b,c,d);this.pc.freeze();this.pc.s()||v("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.pc.toString());rj(this,!1)}};O.prototype.Om=function(){};O.prototype.vj=function(){return!1}; O.prototype.arrange=function(a,b,c,d,e){this.Hl();var f=M.alloc();f.assign(this.Ab);this.Ab.ka();!1===xj(this)?this.Ab.h(a,b,c,d):this.Ph(a,b,c,d);this.Ab.freeze();void 0===e?this.hb=null:this.hb=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.wc,d=this.measuredBounds,null!==this.areaBackground&&(d=this.Ab),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 Zg&&(a=this.naturalBounds, this.Bs>a.height||this.yb>a.width)))c=!0;this.H=c?this.H|256:this.H&-257;this.Ab.s()||v("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.Ab.toString());this.Pm(f,this.Ab);sl(this,!1);M.free(f)};t=O.prototype;t.Ph=function(){}; function tl(a,b,c,d,e){a.Ab.h(b,c,d,e);if(!a.desiredSize.s()){var f=a.pc;c=a.uh;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=rl(a,!0);c===d&&f===e&&(b=pg);switch(b){case pg:if(c>d||f>e)rj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case Cd:rj(a,!0);a.measure(d,e,0,0);break;case el:rj(a,!0);a.measure(d,f,0,0);break;case fl:rj(a,!0),a.measure(c,e,0,0)}}} t.Pm=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||ul(c,!0),this.R(),ec(a,b)||(c.Wh(),this.vp(c)))};t.vp=function(a){null!==this.portId&&(ul(a,!0),a instanceof V&&vl(a,this))}; t.rc=function(a,b){if(this.visible){var c=this.opacity;if(0!==c){var d=this instanceof W&&(this.type===W.TableRow||this.type===W.TableColumn),e=this.Ab;if(d||0!==e.width&&0!==e.height&&!isNaN(e.x)&&!isNaN(e.y)){var f=1;1!==c&&(f=a.globalAlpha,a.globalAlpha=f*c);if(d){e=this.Ab;d=this.wc;var g=this.od,h=this.Wb;null===g&&null===h||a.ke();null!==g&&(ri(this,a,g,!0,!0,d,e),g instanceof wl&&g.type===xl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.Mf(g)):a.fillRect(e.x,e.y,e.width,e.height));null!== h&&(ri(this,a,h,!0,!1,d,e),h instanceof wl&&h.type===xl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.Mf(h)):a.fillRect(e.x,e.y,e.width,e.height));this.hj(a,b)}else if(!this.py(a,b)){this instanceof T&&this.Kk(!1);G&&G.Am&&G.Yz&&G.Yz(a,this);d=this.transform;g=this.panel;0!==(this.H&4096)===!0&&yl(this);var k=this.part;h=!1;var l=0;if(k&&b.Ve("drawShadows")&&(h=k.isShadowed)){var m=k.shadowOffset;l=Math.max(m.y,m.x)*b.scale*b.Yb}m=this.vj();var n;if(!(n=b.Di||!m)){var p=this.naturalBounds;n=this.ei; var r=n.m11,q=n.m21,u=n.dx,y=n.m12,x=n.m22,z=n.dy,B,D=B=0;n=B*r+D*q+u;var F=B*y+D*x+z;B=p.width+l;D=0;var L=B*r+D*q+u;B=B*y+D*x+z;D=Math.min(n,L);var Z=Math.min(F,B);var Q=Math.max(n+0,L)-D;var ba=Math.max(F+0,B)-Z;n=D;F=Z;B=p.width+l;D=p.height+l;L=B*r+D*q+u;B=B*y+D*x+z;D=Math.min(n,L);Z=Math.min(F,B);Q=Math.max(n+Q,L)-D;ba=Math.max(F+ba,B)-Z;n=D;F=Z;B=0;D=p.height+l;L=B*r+D*q+u;B=B*y+D*x+z;D=Math.min(n,L);Z=Math.min(F,B);Q=Math.max(n+Q,L)-D;ba=Math.max(F+ba,B)-Z;n=D;F=Z;l=b.viewportBounds;p=l.x; r=l.y;n=!(n>l.width+p||p>Q+n||F>l.height+r||r>ba+F)}if(n){n=0!==(this.H&256);a.clipInsteadOfFill&&(n=!1);this instanceof Zg&&(a.font=this.font);if(n){F=g.pe()?g.naturalBounds:g.actualBounds;null!==this.hb?(p=this.hb,Q=p.x,ba=p.y,l=p.width,p=p.height):(Q=Math.max(e.x,F.x),ba=Math.max(e.y,F.y),l=Math.min(e.right,F.right)-Q,p=Math.min(e.bottom,F.bottom)-ba);if(Q>e.width+e.x||e.x>F.width+F.x){1!==c&&(a.globalAlpha=f);return}a.save();a.beginPath();a.rect(Q,ba,l,p);a.clip()}if(m){if(!k.isVisible()){1!== c&&(a.globalAlpha=f);return}h&&(F=k.shadowOffset,a.Ow(F.x*b.scale*b.Yb,F.y*b.scale*b.Yb,k.shadowBlur),zl(a),a.shadowColor=k.shadowColor)}h&&!0===this.shadowVisible?zl(a):h&&!1===this.shadowVisible&&Al(a);k=this.naturalBounds;null!==this.od&&(a.ke(),ri(this,a,this.od,!0,!0,k,e),this.od instanceof wl&&this.od.type===xl?(a.beginPath(),a.rect(e.x,e.y,e.width,e.height),a.Mf(this.od)):a.fillRect(e.x,e.y,e.width,e.height));a.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);h&&(null!==g&&0!==(g.H&512)||null!== g&&(g.type===W.Auto||g.type===W.Spot)&&g.wb()!==this)&&null===this.shadowVisible&&Al(a);null!==this.Wb&&(a.ke(),Bl(this,a,k,e));G&&G.Am&&G.Zz&&G.Zz(a,this);h&&(null!==this.Wb||null!==this.od||null!==g&&0!==(g.H&512)||null!==g&&(g.type===W.Auto||g.type===W.Spot)&&g.wb()!==this)?(Cl(this,!0),null===this.shadowVisible&&Al(a)):Cl(this,!1);this.hj(a,b);h&&0!==(this.H&512)===!0&&zl(a);m&&h&&Al(a);n&&(a.restore(),a.Oc(this instanceof W));d.Zt()||(b=1/(d.m11*d.m22-d.m12*d.m21),a.transform(d.m22*b,-d.m12* b,-d.m21*b,d.m11*b,b*(d.m21*d.dy-d.m22*d.dx),b*(d.m12*d.dx-d.m11*d.dy)))}}1!==c&&(a.globalAlpha=f)}}}};function Bl(a,b,c,d){var e=a.naturalBounds,f=0,g=0,h=e.width;e=e.height;var k=a.Cx();a instanceof Kf&&(e=a.sa.bounds,f=e.x,g=e.y,h=e.width,e=e.height);ri(a,b,a.Wb,!0,!1,c,d);a.Wb instanceof wl&&a.Wb.type===xl?(b.beginPath(),b.rect(f-k/2,g-k/2,h+k,e+k),b.Mf(a.Wb)):b.fillRect(f-k/2,g-k/2,h+k,e+k)}t.py=function(){return!1};t.hj=function(){}; function ri(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===Dl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=0;a instanceof Kf&&(l=a.strokeWidth);h=f.width;k=f.height;e?(h=g.width,k=g.height):d||(h+=l,k+=l);if((f=b instanceof El)&&c.ue&&(c.type===Fl||c.gl===h&&c.Cu===k))var m=c.ue;else{var n=0,p=0,r=0,q=0,u=0,y=0;y=u=0;e?(u=g.x,y=g.y):d||(u-=l/2,y-=l/2);n=c.start.x*h+c.start.offsetX;p=c.start.y*k+c.start.offsetY;r=c.end.x*h+ c.end.offsetX;q=c.end.y*k+c.end.offsetY;n+=u;r+=u;p+=y;q+=y;if(c.type===Gl)m=b.createLinearGradient(n,p,r,q);else if(c.type===xl)y=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(u=0,y=Math.max(h,k)/2):u=c.startRadius,m=b.createRadialGradient(n,p,u,r,q,y);else if(c.type===Fl)try{m=b.createPattern(c.pattern,"repeat")}catch(z){m=null}else za(c.type,"Brush type");if(c.type!==Fl&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)m.addColorStop(e.key,e.value);if(f&&(c.ue=m,null!== m&&(c.gl=h,c.Cu=k),null===m&&c.type===Fl&&-1!==c.gl)){c.gl=-1;var x=a.diagram;null!==x&&-1===c.gl&&ua(function(){x.redraw()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.Qg=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.Sf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.Sf():!0}; t.Rg=function(){for(var a=this instanceof W?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a}; function yl(a){if(0!==(a.H&2048)===!0){var b=a.vb;b.reset();if(!a.Ab.s()||!a.pc.s()){Hl(a,!1);return}b.translate(a.Ab.x-a.pc.x,a.Ab.y-a.pc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;a.eq(b,c.x,c.y,c.width,c.height)}Hl(a,!1);Il(a,!0)}0!==(a.H&4096)===!0&&(b=a.panel,null===b?(a.ei.set(a.vb),a.ql=a.scale,Il(a,!1)):null!==b.je&&(c=a.ei,c.reset(),b.pe()?c.multiply(b.ei):null!==b.panel&&c.multiply(b.panel.ei),c.multiply(a.vb),a.ql=a.scale*b.ql,Il(a,!1)))} t.eq=function(a,b,c,d,e){1!==this.wa&&a.scale(this.wa);if(0!==this.Cb){var f=J.alloc();f.zj(b,c,d,e,Jc);a.rotate(this.Cb,f.x,f.y);J.free(f)}};t.v=function(a){if(!wj(this)){void 0===a&&(a=!1);rj(this,!0);sl(this,!0);var b=this.panel;null===b||a||b.v()}};t.Gk=function(){wj(this)||(rj(this,!0),sl(this,!0))};function Jl(a){if(!xj(a)){var b=a.panel;null!==b?b.v():a.vj()&&(b=a.diagram,null!==b&&(b.be.add(a),a instanceof V&&a.xd(),b.Kb()));sl(a,!0)}} t.Hl=function(){0!==(this.H&2048)===!1&&(Hl(this,!0),Il(this,!0))};t.lw=function(){Il(this,!0)};t.R=function(){var a=this.part;null!==a&&a.R()}; function rl(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===W.Table)return Kl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===W.Auto&&d.wb()===a)return Ll(a,Cd,b);if(c===dl){if(null!==d){if(d.type===W.Spot&&d.wb()===a)return Ll(a,Cd,b);c=d.defaultStretch;return c===dl?Ll(a,pg,b):Ll(a,c,b)}return Ll(a,pg,b)}return Ll(a,c,b)} function Kl(a,b,c,d){var e=a.stretch;if(e!==dl)return Ll(a,e,d);var f=e=null;switch(b.stretch){case fl:f=!0;break;case Cd:f=!0}switch(c.stretch){case el:e=!0;break;case Cd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===el||b===Cd);null===f&&(f=b===fl||b===Cd);return!0===e&&!0===f?Ll(a,Cd,d):!0===e?Ll(a,el,d):!0===f?Ll(a,fl,d):Ll(a,pg,d)} function Ll(a,b,c){if(c)return b;if(b===pg)return pg;c=a.desiredSize;if(c.s())return pg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===el)return pg;if(b===Cd)return fl}else{if(b===fl)return pg;if(b===Cd)return el}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===fl)return pg;if(b===Cd)return el}else{if(b===el)return pg;if(b===Cd)return fl}return b}function Cl(a,b){a.H=b?a.H|512:a.H&-513}function nl(a){return 0!==(a.H&1024)}function Ml(a,b){a.H=b?a.H|1024:a.H&-1025} function Hl(a,b){a.H=b?a.H|2048:a.H&-2049}function Il(a,b){a.H=b?a.H|4096:a.H&-4097}function wj(a){return 0!==(a.H&8192)}function rj(a,b){a.H=b?a.H|8192:a.H&-8193}function xj(a){return 0!==(a.H&16384)}function sl(a,b){a.H=b?a.H|16384:a.H&-16385}t.xj=function(a){this.yg=a};t.ru=function(){};t.Lw=function(a){this.oa=a;Jl(this);return!0};t.dn=function(a,b){if(this.oa.x!==a||this.oa.y!==b)this.oa.h(a,b),this.Hl()};t.Cx=function(){return 0}; function Nl(a){var b=a.part;if(b instanceof V&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||vl(b,a)}}function Ol(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof W?a instanceof V?a.xd():a.Uk(a,function(a){Nl(a)}):Nl(a))} t.bind=function(a,b,c,d){var e=null;"string"===typeof a?e=new Li(a,b,c,d):e=a;e.ud=this;a=this.jj();null!==a&&Pl(a)&&v("Cannot add a Binding to a template that has already been copied: "+e);null===this.lb&&(this.lb=new H);this.lb.add(e);return this};t.set=function(a){if(G)for(var b in a)(b.startsWith("_")||-1!==b.indexOf("."))&&v("Property with underscore or period passed to GraphObject.set. Did you mean to use GraphObject.assign?");Object.assign(this,a);return this};t.Lv=function(a){Ql(this,a);return this}; t.apply=function(a){a(this);return this};t.en=function(a){Dj(this,a);return this};t.mA=function(){for(var a=this instanceof W?this:this.panel;null!==a;){if(null!==a.Zg)return a;a=a.panel}return null};t.jj=function(){for(var a=this instanceof W?this:this.panel;null!==a;){if(null!==a.Zg)return a;a=a.panel}return null};t.Sw=function(a){a.ud=this;null===this.Wg&&(this.Wg=new zb);this.Wg.add(a.propertyName,a);return this}; 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.K(a);"function"===typeof f?(c=Ja(arguments),d=f(c),Ga(d)||v('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=ra.go[a]}null===d&&(void 0!==e&&null!==e&&e.constructor||v("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 R&&1<c.length){f= d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)Gi(f,g),e++}for(;e<c.length;e++)f=c[e],void 0===f?v("Undefined value at argument "+e+" for object being constructed by GraphObject.make: "+d):Ql(d,f);return d} function Ql(a,b){if("string"===typeof b)if(a instanceof Zg)a.text=b;else if(a instanceof Kf)a.figure=b;else if(a instanceof fk)a.source=b;else if(a instanceof W){var c=Tl.K(b);null!==c?a.type=c:G&&v("Unknown Panel type as an argument to GraphObject.make: "+b+". If building from source, you may need to call Panel.definePanelLayout.")}else a instanceof wl?(c=db(wl,b),null!==c?a.type=c:v("Unknown Brush type as an argument to GraphObject.make: "+b)):a instanceof N?(c=db(N,b),null!==c?a.type=c:G&&v("Unknown Geometry type as an argument to GraphObject.make: "+ b)):a instanceof me?(c=db(me,b),null!==c?a.type=c:G&&v("Unknown PathSegment type as an argument to GraphObject.make: "+b)):G&&v("Unable to use a string as an argument to GraphObject.make: "+b);else if(b instanceof O)a instanceof W||v("A GraphObject can only be added to a Panel, not to: "+a),a.add(b);else if(b instanceof Xj){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 Xj?(a=d,w(b,Xj,Xj,"copyFrom:pd"),b.isRow?a.height=b.height:a.width=b.width,a.minimum=b.minimum,a.maximum=b.maximum,a.alignment=b.alignment,a.stretch=b.stretch,a.sizing=b.sizing,a.Cg=null===b.separatorPadding?null:b.separatorPadding.L(),a.separatorStroke=b.separatorStroke,a.separatorStrokeWidth=b.separatorStrokeWidth,a.lk=null,b.separatorDashArray&&(a.lk=Ja(b.separatorDashArray)),a.background=b.background,a.coversSeparators=b.coversSeparators,a.lb=b.lb):v("A RowColumnDefinition can only be added to an object that implements getRowDefinition/getColumnDefinition, not to: "+ a)}else if(b instanceof E)"function"===typeof a.ob?a.ob(b):Ea(a,b);else if(b instanceof Ul)a.type=b;else if(b instanceof Li)a instanceof O?a.bind(b):a instanceof Xj?a.bind(b):v("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof ji)a instanceof O?a.Sw(b):v("An AnimationTrigger can only be applied to a GraphObject, not to: "+a);else if(b instanceof le)a instanceof N?a.figures.add(b):v("A PathFigure can only be added to a Geometry, not to: "+a); else if(b instanceof me)a instanceof le?a.segments.add(b):v("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof Ei)a instanceof R?a.layout=b:a instanceof yf?a.layout=b:v("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++)Ql(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof wl){c=new gb;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);Dj(a,c)}else if(a instanceof Xj){void 0!== b.row?(e=b.row,(void 0===e||null===e||Infinity===e||isNaN(e)||0>e)&&v("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)&&v("Must specify non-negative integer column for RowColumnDefinition "+b+", not: "+e),a.isRow=!1,a.index=e);e=new gb;for(c in b)"row"!==c&&"column"!==c&&(e[c]=b[c]);Dj(a,e)}else Dj(a,b);else v('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+ a)}function Vl(a,b){A(a,"string",O,"defineBuilder:name");A(b,"function",O,"defineBuilder:func");var c=a.toLowerCase();G&&(""===a||"none"===c||a===c)&&v("Shape.defineFigureGenerator name must not be empty or None or all-lower-case: "+a);Sl.add(a,b)} function Wl(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} na.Object.defineProperties(O.prototype,{shadowVisible:{configurable:!0,get:function(){return this.im},set:function(a){var b=this.im;b!==a&&(G&&null!==a&&A(a,"boolean",O,"shadowVisible"),this.im=a,this.R(),this.g("shadowVisible",b,a))}},enabledChanged:{configurable:!0,get:function(){return null!==this.S?this.S.fo:null},set:function(a){kl(this);var b=this.S.fo;b!==a&&(null!==a&&A(a,"function",O,"enabledChanged"),this.S.fo=a,this.g("enabledChanged",b,a))}},segmentOrientation:{configurable:!0, enumerable:!0,get:function(){return this.gm},set:function(a){var b=this.gm;b!==a&&(G&&eb(a,T,O,"segmentOrientation"),this.gm=a,this.v(),this.g("segmentOrientation",b,a),a===dg&&(this.angle=0))}},segmentIndex:{configurable:!0,get:function(){return this.Yp},set:function(a){G&&A(a,"number",O,"segmentIndex");a=Math.round(a);var b=this.Yp;b!==a&&(this.Yp=a,this.v(),this.g("segmentIndex",b,a))}},segmentFraction:{configurable:!0,get:function(){return this.em},set:function(a){G&& A(a,"number",O,"segmentFraction");isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.em;b!==a&&(this.em=a,this.v(),this.g("segmentFraction",b,a))}},segmentOffset:{configurable:!0,get:function(){return this.fm},set:function(a){var b=this.fm;b.B(a)||(G&&w(a,J,O,"segmentOffset"),this.fm=a=a.L(),this.v(),this.g("segmentOffset",b,a))}},stretch:{configurable:!0,get:function(){return this.Pe},set:function(a){var b=this.Pe;b!==a&&(G&&eb(a,O,O,"stretch"),this.Pe=a,this.v(),this.g("stretch", b,a))}},name:{configurable:!0,get:function(){return this.ta},set:function(a){var b=this.ta;b!==a&&(G&&A(a,"string",O,"name"),this.ta=a,null!==this.part&&(this.part.ck=null),this.g("name",b,a))}},opacity:{configurable:!0,get:function(){return this.mb},set:function(a){var b=this.mb;b!==a&&(A(a,"number",O,"opacity"),(0>a||1<a)&&Ba(a,"0 <= value <= 1",O,"opacity"),this.mb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.R(Hj(b,b.actualBounds)))}},visible:{configurable:!0, enumerable:!0,get:function(){return 0!==(this.H&1)},set:function(a){var b=0!==(this.H&1);b!==a&&(G&&A(a,"boolean",O,"visible"),this.H^=1,this.g("visible",b,a),b=this.panel,null!==b?b.v():this.vj()&&this.Sb(a),this.R(),Ol(this))}},pickable:{configurable:!0,get:function(){return 0!==(this.H&2)},set:function(a){var b=0!==(this.H&2);b!==a&&(G&&A(a,"boolean",O,"pickable"),this.H^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{configurable:!0,get:function(){return 0!==(this.H& 4)},set:function(a){var b=0!==(this.H&4);b!==a&&(G&&A(a,"boolean",O,"fromLinkableDuplicates"),this.H^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{configurable:!0,get:function(){return 0!==(this.H&8)},set:function(a){var b=0!==(this.H&8);b!==a&&(G&&A(a,"boolean",O,"fromLinkableSelfNode"),this.H^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{configurable:!0,get:function(){return 0!==(this.H&16)},set:function(a){var b=0!==(this.H&16);b!== a&&(G&&A(a,"boolean",O,"toLinkableDuplicates"),this.H^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{configurable:!0,get:function(){return 0!==(this.H&32)},set:function(a){var b=0!==(this.H&32);b!==a&&(G&&A(a,"boolean",O,"toLinkableSelfNode"),this.H^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{configurable:!0,get:function(){return 0!==(this.H&64)},set:function(a){var b=0!==(this.H&64);b!==a&&(G&&A(a,"boolean",O,"isPanelMain"),this.H^=64,this.v(), this.g("isPanelMain",b,a))}},isActionable:{configurable:!0,get:function(){return 0!==(this.H&128)},set:function(a){var b=0!==(this.H&128);b!==a&&(G&&A(a,"boolean",O,"isActionable"),this.H^=128,this.g("isActionable",b,a))}},areaBackground:{configurable:!0,get:function(){return this.od},set:function(a){var b=this.od;b!==a&&(null!==a&&Xl(a,"GraphObject.areaBackground"),a instanceof wl&&a.freeze(),this.od=a,this.R(),this.g("areaBackground",b,a))}},background:{configurable:!0, enumerable:!0,get:function(){return this.Wb},set:function(a){var b=this.Wb;b!==a&&(null!==a&&Xl(a,"GraphObject.background"),a instanceof wl&&a.freeze(),this.Wb=a,this.R(),this.g("background",b,a))}},part:{configurable:!0,get:function(){if(this.vj())return this;if(null!==this.gk)return this.gk;var a;for(a=this.panel;a;){if(a instanceof U)return this.gk=a;a=a.panel}return null}},svg:{configurable:!0,get:function(){return this.pq},set:function(a){this.pq=a}},panel:{configurable:!0, enumerable:!0,get:function(){return this.yg}},layer:{configurable:!0,get:function(){var a=this.part;return null!==a?a.layer:null}},diagram:{configurable:!0,get:function(){var a=this.part;return null!==a?a.diagram:null}},position:{configurable:!0,get:function(){return this.oa},set:function(a){G&&w(a,J,O,"position");var b=a.x,c=a.y,d=this.oa,e=d.x;d=d.y;(e===b||isNaN(e)&&isNaN(b))&&(d===c||isNaN(d)&&isNaN(c))?this.ru():(a=a.copy(),this.Lw(a,e,d)&&this.g("position", new J(e,d),a))}},actualBounds:{configurable:!0,get:function(){return this.Ab}},scale:{configurable:!0,get:function(){return this.wa},set:function(a){var b=this.wa;b!==a&&(G&&C(a,O,"scale"),0>=a&&v("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.wa=a,this.v(),this.g("scale",b,a))}},angle:{configurable:!0,get:function(){return this.Cb},set:function(a){var b=this.Cb;b!==a&&(G&&C(a,O,"angle"),a%=360,0>a&&(a+=360),b!==a&&(this.Cb=a,Ol(this), this.v(),this.g("angle",b,a)))}},desiredSize:{configurable:!0,get:function(){return this.cd},set:function(a){G&&w(a,Db,O,"desiredSize");var b=a.width,c=a.height,d=this.cd,e=d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.cd=a=a.L(),this.v(),this instanceof Kf&&this.ic(),this.g("desiredSize",d,a),nl(this)&&(a=this.part,null!==a&&(ol(this,a,"width"),ol(this,a,"height"))))}},width:{configurable:!0,get:function(){return this.cd.width},set:function(a){var b= this.cd.width;b===a||isNaN(b)&&isNaN(a)||(G&&A(a,"number",O,"width"),b=this.cd,this.cd=a=(new Db(a,this.cd.height)).freeze(),this.v(),this instanceof Kf&&this.ic(),this.g("desiredSize",b,a),nl(this)&&(a=this.part,null!==a&&ol(this,a,"width")))}},height:{configurable:!0,get:function(){return this.cd.height},set:function(a){var b=this.cd.height;b===a||isNaN(b)&&isNaN(a)||(G&&A(a,"number",O,"height"),b=this.cd,this.cd=a=(new Db(this.cd.width,a)).freeze(),this.v(),this instanceof Kf&&this.ic(), this.g("desiredSize",b,a),nl(this)&&(a=this.part,null!==a&&ol(this,a,"height")))}},minSize:{configurable:!0,get:function(){return this.pg},set:function(a){var b=this.pg;b.B(a)||(G&&w(a,Db,O,"minSize"),a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=0),a.freeze(),this.pg=a,this.v(),this.g("minSize",b,a))}},maxSize:{configurable:!0,get:function(){return this.og},set:function(a){var b=this.og;b.B(a)||(G&&w(a,Db,O,"maxSize"),a=a.copy(),isNaN(a.width)&&(a.width= Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.og=a,this.v(),this.g("maxSize",b,a))}},measuredBounds:{configurable:!0,get:function(){return this.pc}},naturalBounds:{configurable:!0,get:function(){return this.wc}},margin:{configurable:!0,get:function(){return this.uh},set:function(a){"number"===typeof a?a=new gc(a):G&&w(a,gc,O,"margin");var b=this.uh;b.B(a)||(this.uh=a=a.L(),this.v(),this.g("margin",b,a))}},transform:{configurable:!0, get:function(){0!==(this.H&2048)===!0&&yl(this);return this.vb}},je:{configurable:!0,get:function(){0!==(this.H&4096)===!0&&yl(this);return this.ei}},alignment:{configurable:!0,get:function(){return this.Bb},set:function(a){var b=this.Bb;b.B(a)||(G&&w(a,Eb,O,"alignment"),a.bc()&&!a.Jb()&&v("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.Bb=a=a.L(),Jl(this),this.g("alignment",b,a))}},column:{configurable:!0,get:function(){return this.bh}, set:function(a){G&&C(a,O,"column");a=Math.round(a);var b=this.bh;b!==a&&(0>a&&Ba(a,">= 0",O,"column"),this.bh=a,this.v(),this.g("column",b,a))}},columnSpan:{configurable:!0,get:function(){return this.In},set:function(a){G&&A(a,"number",O,"columnSpan");a=Math.round(a);var b=this.In;b!==a&&(1>a&&Ba(a,">= 1",O,"columnSpan"),this.In=a,this.v(),this.g("columnSpan",b,a))}},row:{configurable:!0,get:function(){return this.Rp},set:function(a){G&&C(a,O,"row");a=Math.round(a);var b= this.Rp;b!==a&&(0>a&&Ba(a,">= 0",O,"row"),this.Rp=a,this.v(),this.g("row",b,a))}},rowSpan:{configurable:!0,get:function(){return this.Sp},set:function(a){G&&A(a,"number",O,"rowSpan");a=Math.round(a);var b=this.Sp;b!==a&&(1>a&&Ba(a,">= 1",O,"rowSpan"),this.Sp=a,this.v(),this.g("rowSpan",b,a))}},spanAllocation:{configurable:!0,get:function(){return this.kq},set:function(a){var b=this.kq;b!==a&&(null!==a&&A(a,"function",O,"spanAllocation"),this.kq=a,this.v(),this.g("spanAllocation", b,a))}},alignmentFocus:{configurable:!0,get:function(){return this.Zk},set:function(a){var b=this.Zk;b.B(a)||(G&&w(a,Eb,O,"alignmentFocus"),!G||!a.bc()||a.Jb()||a.Xq()&&this instanceof V||v("GraphObject.alignmentFocus must be a real Spot or Spot.Default, not: "+a),this.Zk=a=a.L(),this.v(),this.g("alignmentFocus",b,a))}},portId:{configurable:!0,get:function(){return this.Fp},set:function(a){var b=this.Fp;if(b!==a){G&&null!==a&&A(a,"string",O,"portId");var c=this.part;null=== c||c instanceof V||v("Cannot set portID on a Link: "+a);null!==b&&null!==c&&Yl(c,this);this.Fp=a;null!==a&&null!==c&&(c.Vh=!0,Zl(c,this));this.g("portId",b,a)}}},toSpot:{configurable:!0,get:function(){return null!==this.T?this.T.Jh:Cc},set:function(a){this.Rc();var b=this.T.Jh;b.B(a)||(G&&w(a,Eb,O,"toSpot"),a=a.L(),this.T.Jh=a,this.g("toSpot",b,a),Nl(this))}},toEndSegmentLength:{configurable:!0,get:function(){return null!==this.T?this.T.Hh:10},set:function(a){this.Rc(); var b=this.T.Hh;b!==a&&(G&&A(a,"number",O,"toEndSegmentLength"),0>a&&Ba(a,">= 0",O,"toEndSegmentLength"),this.T.Hh=a,this.g("toEndSegmentLength",b,a),Nl(this))}},toShortLength:{configurable:!0,get:function(){return null!==this.T?this.T.Ih:0},set:function(a){this.Rc();var b=this.T.Ih;b!==a&&(G&&A(a,"number",O,"toShortLength"),this.T.Ih=a,this.g("toShortLength",b,a),Nl(this))}},toLinkable:{configurable:!0,get:function(){return null!==this.T?this.T.tq:null},set:function(a){this.Rc(); var b=this.T.tq;b!==a&&(G&&null!==a&&A(a,"boolean",O,"toLinkable"),this.T.tq=a,this.g("toLinkable",b,a))}},toMaxLinks:{configurable:!0,get:function(){return null!==this.T?this.T.uq:Infinity},set:function(a){this.Rc();var b=this.T.uq;b!==a&&(G&&A(a,"number",O,"toMaxLinks"),0>a&&Ba(a,">= 0",O,"toMaxLinks"),this.T.uq=a,this.g("toMaxLinks",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.T?this.T.nh:Cc},set:function(a){this.Rc();var b=this.T.nh;b.B(a)||(G&& w(a,Eb,O,"fromSpot"),a=a.L(),this.T.nh=a,this.g("fromSpot",b,a),Nl(this))}},fromEndSegmentLength:{configurable:!0,get:function(){return null!==this.T?this.T.lh:10},set:function(a){this.Rc();var b=this.T.lh;b!==a&&(G&&A(a,"number",O,"fromEndSegmentLength"),0>a&&Ba(a,">= 0",O,"fromEndSegmentLength"),this.T.lh=a,this.g("fromEndSegmentLength",b,a),Nl(this))}},fromShortLength:{configurable:!0,get:function(){return null!==this.T?this.T.mh:0},set:function(a){this.Rc();var b=this.T.mh; b!==a&&(G&&A(a,"number",O,"fromShortLength"),this.T.mh=a,this.g("fromShortLength",b,a),Nl(this))}},fromLinkable:{configurable:!0,get:function(){return null!==this.T?this.T.no:null},set:function(a){this.Rc();var b=this.T.no;b!==a&&(G&&null!==a&&A(a,"boolean",O,"fromLinkable"),this.T.no=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{configurable:!0,get:function(){return null!==this.T?this.T.oo:Infinity},set:function(a){this.Rc();var b=this.T.oo;b!==a&&(G&&A(a,"number",O,"fromMaxLinks"), 0>a&&Ba(a,">= 0",O,"fromMaxLinks"),this.T.oo=a,this.g("fromMaxLinks",b,a))}},cursor:{configurable:!0,get:function(){return this.ui},set:function(a){var b=this.ui;b!==a&&(A(a,"string",O,"cursor"),this.ui=a,this.g("cursor",b,a))}},click:{configurable:!0,get:function(){return null!==this.S?this.S.bg:null},set:function(a){kl(this);var b=this.S.bg;b!==a&&(null!==a&&A(a,"function",O,"click"),this.S.bg=a,this.g("click",b,a))}},doubleClick:{configurable:!0,get:function(){return null!== this.S?this.S.gg:null},set:function(a){kl(this);var b=this.S.gg;b!==a&&(null!==a&&A(a,"function",O,"doubleClick"),this.S.gg=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,get:function(){return null!==this.S?this.S.cg:null},set:function(a){kl(this);var b=this.S.cg;b!==a&&(null!==a&&A(a,"function",O,"contextClick"),this.S.cg=a,this.g("contextClick",b,a))}},mouseEnter:{configurable:!0,get:function(){return null!==this.S?this.S.rg:null},set:function(a){kl(this); var b=this.S.rg;b!==a&&(null!==a&&A(a,"function",O,"mouseEnter"),this.S.rg=a,this.g("mouseEnter",b,a))}},mouseLeave:{configurable:!0,get:function(){return null!==this.S?this.S.ug:null},set:function(a){kl(this);var b=this.S.ug;b!==a&&(null!==a&&A(a,"function",O,"mouseLeave"),this.S.ug=a,this.g("mouseLeave",b,a))}},mouseOver:{configurable:!0,get:function(){return null!==this.S?this.S.vg:null},set:function(a){kl(this);var b=this.S.vg;b!==a&&(null!==a&&A(a,"function",O,"mouseOver"), this.S.vg=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return null!==this.S?this.S.tg:null},set:function(a){kl(this);var b=this.S.tg;b!==a&&(null!==a&&A(a,"function",O,"mouseHover"),this.S.tg=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,get:function(){return null!==this.S?this.S.sg:null},set:function(a){kl(this);var b=this.S.sg;b!==a&&(null!==a&&A(a,"function",O,"mouseHold"),this.S.sg=a,this.g("mouseHold",b,a))}},mouseDragEnter:{configurable:!0, enumerable:!0,get:function(){return null!==this.S?this.S.ip:null},set:function(a){kl(this);var b=this.S.ip;b!==a&&(null!==a&&A(a,"function",O,"mouseDragEnter"),this.S.ip=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{configurable:!0,get:function(){return null!==this.S?this.S.jp:null},set:function(a){kl(this);var b=this.S.jp;b!==a&&(null!==a&&A(a,"function",O,"mouseDragLeave"),this.S.jp=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{configurable:!0,get:function(){return null!== this.S?this.S.qg:null},set:function(a){kl(this);var b=this.S.qg;b!==a&&(null!==a&&A(a,"function",O,"mouseDrop"),this.S.qg=a,this.g("mouseDrop",b,a))}},actionDown:{configurable:!0,get:function(){return null!==this.S?this.S.rn:null},set:function(a){kl(this);var b=this.S.rn;b!==a&&(null!==a&&A(a,"function",O,"actionDown"),this.S.rn=a,this.g("actionDown",b,a))}},actionMove:{configurable:!0,get:function(){return null!==this.S?this.S.sn:null},set:function(a){kl(this);var b=this.S.sn; b!==a&&(null!==a&&A(a,"function",O,"actionMove"),this.S.sn=a,this.g("actionMove",b,a))}},actionUp:{configurable:!0,get:function(){return null!==this.S?this.S.tn:null},set:function(a){kl(this);var b=this.S.tn;b!==a&&(null!==a&&A(a,"function",O,"actionUp"),this.S.tn=a,this.g("actionUp",b,a))}},actionCancel:{configurable:!0,get:function(){return null!==this.S?this.S.qn:null},set:function(a){kl(this);var b=this.S.qn;b!==a&&(null!==a&&A(a,"function",O,"actionCancel"),this.S.qn= a,this.g("actionCancel",b,a))}},toolTip:{configurable:!0,get:function(){return null!==this.S?this.S.Hg:null},set:function(a){kl(this);var b=this.S.Hg;b!==a&&(!G||null===a||a instanceof Le||a instanceof Qe||v("GraphObject.toolTip must be an Adornment or HTMLInfo."),this.S.Hg=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return null!==this.S?this.S.dg:null},set:function(a){kl(this);var b=this.S.dg;b!==a&&(!G||a instanceof Le||a instanceof Qe||v("GraphObject.contextMenu must be an Adornment or HTMLInfo."), this.S.dg=a,this.g("contextMenu",b,a))}}});O.prototype.trigger=O.prototype.Sw;O.prototype.findBindingPanel=O.prototype.jj;O.prototype.findTemplateBinder=O.prototype.mA;O.prototype.setProperties=O.prototype.en;O.prototype.apply=O.prototype.apply;O.prototype.attach=O.prototype.Lv;O.prototype.set=O.prototype.set;O.prototype.isEnabledObject=O.prototype.Rg;O.prototype.isVisibleObject=O.prototype.Sf;O.prototype.isContainedBy=O.prototype.Qg;O.prototype.getNearestIntersectionPoint=O.prototype.St; O.prototype.getLocalPoint=O.prototype.Rt;O.prototype.getDocumentScale=O.prototype.Of;O.prototype.getDocumentAngle=O.prototype.oj;O.prototype.getDocumentBounds=O.prototype.pj;O.prototype.getDocumentPoint=O.prototype.ja;O.prototype.intersectsRect=O.prototype.Tc;O.prototype.containedInRect=O.prototype.Qh;O.prototype.containsRect=O.prototype.Te;O.prototype.containsPoint=O.prototype.ca;O.prototype.raiseChanged=O.prototype.g;O.prototype.raiseChangedEvent=O.prototype.ab;O.prototype.addCopyProperty=O.prototype.Yx; var Sl=null;O.className="GraphObject";Sl=new zb; Vl("Button",function(){function a(a,b){return null!==a.diagram.ac(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){if(a instanceof W){var c=a.eb("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(Kf,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new Eb(0,0,2.76142374915397,2.761423749153969),spot2:new Eb(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Rg()&&b instanceof W&&(a=b.eb("ButtonBorder"),a instanceof Kf)){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.Rg()&&b instanceof W&&(a=b.eb("ButtonBorder"),a instanceof Kf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Rg()&&b instanceof W&&null!==b._buttonFillPressed&&0===a.button){var c=b.eb("ButtonBorder");if(c instanceof Kf){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.Rg()&&d instanceof W&&null!==d._buttonFillPressed&&0===b.button){var c=d.eb("ButtonBorder");if(c instanceof Kf){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.Rg()&&d instanceof W&&null!==d._buttonFillPressed){var c=d.eb("ButtonBorder");if(c instanceof Kf){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.Rg()&&d instanceof W&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.eb("ButtonBorder"),b instanceof Kf))){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}); Vl("TreeExpanderButton",function(){var a=Rl("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},Rl(Kf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Tb},(new Li("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).br()),{visible:!1},(new Li("visible","isTreeLeaf",function(a){return!a})).br());a.click=function(a,c){c=c.part;c instanceof Le&&(c=c.adornedPart);if(c instanceof V){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}); Vl("SubGraphExpanderButton",function(){var a=Rl("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},Rl(Kf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:Tb},(new Li("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).br()));a.click=function(a,c){c=c.part;c instanceof Le&&(c=c.adornedPart);if(c instanceof yf){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});Vl("ToolTip",function(){return Rl(Le,W.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},Rl(Kf,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new Eb(0,0,4,6),spot2:new Eb(1,1,-4,-4)}))}); Vl("ContextMenu",function(){return Rl(Le,W.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},new Li("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});Vl("ContextMenuButton",function(){var a=Rl("Button");a.stretch=el;var b=a.eb("ButtonBorder");b instanceof Kf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new Eb(0,0,2,3),b.spot2=new Eb(1,1,-2,-2));return a}); Vl("PanelExpanderButton",function(a){var b=Wl(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(Kf,{name:"ButtonIcon",strokeWidth:2},(new Li("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).br(b))); a=c.eb("ButtonBorder");a instanceof Kf&&(a.stroke=null,a.fill="rgba(0, 0, 0, 0)");c.click=function(a,c){var d=c.diagram;if(null!==d&&!d.isReadOnly){var e=c.jj();null===e&&(e=c.part);null!==e&&(c=e.eb(b),null!==c&&(a.handled=!0,d.Da("Collapse/Expand Panel"),c.visible=!c.visible,d.cb("Collapse/Expand Panel")))}};return c}); Vl("CheckBoxButton",function(a){var b=Wl(a);a=Rl("Button",{desiredSize:new Db(14,14)},Rl(Kf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:Cd,geometryStretch:rg,visible:!1},""!==b?(new Li("visible",b)).Ny():[]));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.eb("ButtonIcon");c.Da("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a, d);c.cb("checkbox")}}};return a}); Vl("CheckBox",function(a){a=Wl(a);a=Rl("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new gc(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});O.None=pg=new E(O,"None",0);O.Default=dl=new E(O,"Default",0);O.Vertical=fl=new E(O,"Vertical",4);O.Horizontal=el=new E(O,"Horizontal",5);O.Fill=Cd=new E(O,"Fill",3);O.Uniform=rg=new E(O,"Uniform",1); O.UniformToFill=gl=new E(O,"UniformToFill",2);O.FlipVertical=hl=new E(O,"FlipVertical",1);O.FlipHorizontal=il=new E(O,"FlipHorizontal",2);O.FlipBoth=jl=new E(O,"FlipBoth",3);O.make=Rl;O.getBuilders=function(){var a=new zb,b;for(b in Sl)if(b!==b.toLowerCase()){var c=Sl.K(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};O.defineBuilder=Vl;O.takeBuilderArgument=Wl; function ll(){this.fo=this.dg=this.Hg=this.qn=this.tn=this.sn=this.rn=this.qg=this.jp=this.ip=this.sg=this.tg=this.vg=this.ug=this.rg=this.cg=this.gg=this.bg=null}ll.prototype.copy=function(){var a=new ll;a.bg=this.bg;a.gg=this.gg;a.cg=this.cg;a.rg=this.rg;a.ug=this.ug;a.vg=this.vg;a.tg=this.tg;a.sg=this.sg;a.ip=this.ip;a.jp=this.jp;a.qg=this.qg;a.rn=this.rn;a.sn=this.sn;a.tn=this.tn;a.qn=this.qn;a.Hg=this.Hg;a.dg=this.dg;a.fo=this.fo;return a};ll.className="GraphObjectEventHandlers"; function $l(){this.Ta=[1,0,0,1,0,0]}$l.prototype.copy=function(){var a=new $l;a.Ta[0]=this.Ta[0];a.Ta[1]=this.Ta[1];a.Ta[2]=this.Ta[2];a.Ta[3]=this.Ta[3];a.Ta[4]=this.Ta[4];a.Ta[5]=this.Ta[5];return a};$l.prototype.translate=function(a,b){this.Ta[4]+=this.Ta[0]*a+this.Ta[2]*b;this.Ta[5]+=this.Ta[1]*a+this.Ta[3]*b};$l.prototype.scale=function(a,b){this.Ta[0]*=a;this.Ta[1]*=a;this.Ta[2]*=b;this.Ta[3]*=b};$l.className="STransform"; function am(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.iy=[];this.pattern=null}am.prototype.addColorStop=function(a,b){this.iy.push({offset:a,color:b})};am.className="SGradient"; function Gj(a,b){this.ownerDocument=a=void 0===b?ra.document:b;this.XA="http://www.w3.org/2000/svg";void 0!==a&&(this.Qa=this.Tb("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Qa.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Qa.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.Lq=null;this.context=new bm(this)} Gj.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.style.width=c+"px",this.style.height=d+"px",this.Qa.setAttributeNS(null,"width",c+"px"),this.Qa.setAttributeNS(null,"height",d+"px"),this.Qa.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.Hx.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.Hx.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1}; Gj.prototype.Tb=function(a,b,c){a=this.ownerDocument.createElementNS(this.XA,a);if(Ga(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};Gj.prototype.getBoundingClientRect=function(){return this.Qa.getBoundingClientRect()};Gj.prototype.focus=function(){this.Qa.focus()};Gj.prototype.oy=function(){this.ownerDocument=null}; na.Object.defineProperties(Gj.prototype,{width:{configurable:!0,get:function(){return this.Qa.width.baseVal.value},set:function(a){this.Qa.width=a}},height:{configurable:!0,get:function(){return this.Qa.height.baseVal.value},set:function(a){this.Qa.height=a}},style:{configurable:!0,get:function(){return this.Qa.style}}});Gj.className="SVGSurface"; function bm(a){this.tu=a;this.svg=a.Qa;this.stack=[];this.md=[];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.Eg=this.mt=this.lt=0;this.au=null;this.path=[];this.Xu=!1;this.Ch=null;this.Dh=0;this.Ue=new $l; cm(this,1,0,0,1,0,0);var b=qb++,c=this.Tb("clipPath",{id:"mainClip"+b});c.appendChild(this.Tb("rect",{x:0,y:0,width:a.width,height:a.height}));this.Hx=c;this.tu.Qa.appendChild(c);this.md[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.ZA={}}t=bm.prototype; 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,r=b+n,q=f?0:1;d=f?d-e:e-d;(1E-6<Math.abs(g-p)||1E-6<Math.abs(h-r))&&this.path.push(["L",p,+r]);0>d&&(d=d%k+k);d>l?(this.path.push(["A",c,c,0,1,q,a-m,b-n]),this.path.push(["A",c,c,0,1,q,p,r])):1E-6<d&&this.path.push(["A",c,c,0,+(d>=Math.PI),q,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,this.Ue)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new am("linear");e.x1=a;e.y1=b;e.x2=c;e.y2=d;return e}; t.createPattern=function(a){var b="";a instanceof HTMLCanvasElement&&(b=a.toDataURL());a instanceof HTMLImageElement&&(b=a.getAttribute("src"));var c=this.ZA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+qb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.Tb("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.Tb(Ik,e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"}; t.createRadialGradient=function(a,b,c,d,e,f){var g=new am("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.getAttribute("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;a={x:0,y:0,width:m||d,height:n||e,href:l};K.da(d,h)&&K.da(e,k)?-1===l.toLowerCase().indexOf(".svg")&&-1===l.toLowerCase().indexOf("data:image/svg")&&(a.preserveAspectRatio= "xMidYMid slice"):a.preserveAspectRatio="none";l="";h/=d;k/=e;if(0!==f||0!==g)l+=" translate("+f+", "+g+")";if(1!==h||1!==k)l+=" scale("+h+", "+k+")";if(0!==b||0!==c)l+=" translate("+-b+", "+-c+")";if(0!==b||0!==c||d!==m||e!==n)f="CLIP"+qb++,g=this.Tb("clipPath",{id:f}),g.appendChild(this.Tb("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";dm(this,Ik,a,this.Ue,l);this.addElement(Ik,a)};t.fill=function(){this.addPath("fill",this.path,this.Ue)}; t.Mf=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]};dm(this,"fill",a,this.Ue);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};dm(this,"fill",b,this.Ue);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.Ue=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.Ue.copy())}; t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||cm(this,a,b,c,d,e,f)};t.scale=function(a,b){this.Ue.scale(a,b)};t.translate=function(a,b){this.Ue.translate(a,b)};t.transform=function(){};t.ke=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.Ue)};t.Bj=function(){this.clipInsteadOfFill||this.stroke()};t.Tb=function(a,b,c){return this.tu.Tb(a,b,c)}; t.addElement=function(a,b,c){a=this.Tb(a,b,c);0<this.md.length?this.md[this.md.length-1].appendChild(a):this.svg.appendChild(a);return this.au=a}; function dm(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof am?c.fill=em(a,a.fillStyle):/^rgba\(/.test(a.fillStyle)?(a=/^\s*rgba\s*\(([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\s*,\s*([^,\s]+)\)\s*$/i.exec(a.fillStyle),c.fill="rgb("+a[1]+","+a[2]+","+a[3]+")",c["fill-opacity"]=a[4]):c.fill=a.fillStyle,c.stroke="none"):"stroke"===b&&(c.fill="none",a.strokeStyle instanceof am?c.stroke=em(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);d=d.Ta;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d} function em(a,b){var c="GRAD"+qb++;if("linear"===b.type)var d=a.Tb("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.Tb("radialGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,r1:b.r1,r2:b.r2,id:c});else throw Error("invalid gradient");var e=b.iy;b=e.length;for(var f=[],g=0;g<b;g++){var h=e[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]);f.push(h)}f.sort(function(a,b){return a.offset>b.offset?1:-1});for(e=0;e<b;e++)d.appendChild(a.Tb("stop",f[e]));a.svg.appendChild(d);return"url(#"+c+")"} t.addPath=function(a,b,c){for(var d=[],e=0;e<b.length;e++){var f=Ja(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(" ")};"stroke"===a&&this.Xu&&(b["stroke-dasharray"]=this.Ch.toString(),b["stroke-dashoffset"]=this.Dh);dm(this,a,b,c);"clipPath"===a?(a="CLIP"+qb++,c=this.Tb("clipPath",{id:a}),c.appendChild(this.Tb("path",b)),this.svg.appendChild(c), 0<this.md.length&&this.md[this.md.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function cm(a,b,c,d,e,f,g){var h=new $l;h.Ta=[b,c,d,e,f,g];b={};dm(a,"g",b,h);h=a.addElement("g",b);a.md.push(h)} t.gn=function(a){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var b="SHADOW"+qb++,c=this.addElement("filter",{id:b,x:"-100%",y:"-100%",width:"300%",height:"300%"},null),d=a.computePixelRatio();a=this.Tb("feGaussianBlur",{"in":"SourceAlpha",result:"blur",stdDeviation:this.shadowBlur/2/d});var e=this.Tb("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor}),f=this.Tb("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});d=this.Tb("feOffset", {"in":"comp",result:"offsetBlur",dx:this.shadowOffsetX/d,dy:this.shadowOffsetY/d});var g=this.Tb("feMerge",{});g.appendChild(this.Tb("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.Tb("feMergeNode",{"in":"SourceGraphic"}));c.appendChild(a);c.appendChild(e);c.appendChild(f);c.appendChild(d);c.appendChild(g);0<this.md.length&&this.md[this.md.length-1].setAttributeNS(null,"filter","url(#"+b+")")}};t.Ow=function(a,b,c){this.lt=a;this.mt=b;this.Eg=c}; function Al(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0}function zl(a){a.shadowOffsetX=a.lt;a.shadowOffsetY=a.mt;a.shadowBlur=a.Eg}t.Kt=function(a,b){this.Xu=!0;this.Ch=a;this.Dh=b};t.It=function(){this.Xu=!1};t.Oc=function(){};t.Xy=function(){};bm.prototype.rotate=function(){};bm.prototype.getImageData=function(){return null};bm.prototype.measureText=function(){return null};bm.className="SVGContext"; R.prototype.eu=function(a){var b=new Gj(this,ra.document);void 0===a&&(a=new gb);var c=this;return Gk(this,function(a,e){a=Hk(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};R.prototype.makeSvg=R.prototype.eu;R.prototype.qw=function(a){return this.eu(a)};R.prototype.makeSVG=R.prototype.qw; O.prototype.py=function(a,b){if(!(a instanceof bm))return!1;var c=null,d=a.au,e=this.transform,f=this.panel;0!==(this.H&4096)===!0&&yl(this);var g=this.Ab,h=0!==(this.H&256);a.clipInsteadOfFill&&(h=!1);var k=!1;this instanceof Zg&&(a.font=this.font);if(h){k=f.pe()?f.naturalBounds:f.actualBounds;if(null!==this.hb){var l=this.hb;var m=l.x;var n=l.y;var p=l.width;l=l.height}else m=Math.max(g.x,k.x),n=Math.max(g.y,k.y),p=Math.min(g.right,k.right)-m,l=Math.min(g.bottom,k.bottom)-n;if(m>g.width+g.x||g.x> k.width+k.x||n>g.height+g.y||g.y>k.height+k.y)return!0;k=!0;cm(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.vj()&&!this.isVisible())return!0;a.Ue.Ta=[1,0,0,1,0,0];(this instanceof Zg&&1<this.lineCount||this instanceof Kf&&1<this.geometry.figures.length)&&cm(a,1,0,0,1,0,0);m=!1;this.vj()&&this.isShadowed&&b.Ve("drawShadows")&&(n=this.shadowOffset,a.Ow(n.x*b.scale*b.Yb,n.y*b.scale*b.Yb,this.shadowBlur),zl(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Ve("drawShadows")&& (n=this.part.isShadowed);a.clipInsteadOfFill&&(n=!1);!0===this.shadowVisible?(zl(a),!1===m&&n&&(cm(a,1,0,0,1,0,0),a.gn(b),m=!0)):!1===this.shadowVisible&&Al(a);p=this.naturalBounds;null!==this.areaBackground&&(ri(this,a,this.areaBackground,!0,!0,p,g),!1===m&&n&&(cm(a,1,0,0,1,0,0),a.gn(b),m=!0),this.areaBackground instanceof wl&&this.areaBackground.type===xl?(a.beginPath(),a.rect(g.x,g.y,g.width,g.height),a.Mf(this.areaBackground)):a.fillRect(g.x,g.y,g.width,g.height));l=!1;this instanceof W?cm(a, e.m11,e.m12,e.m21,e.m22,e.dx,e.dy):(a.Ue.Ta=[e.m11,e.m12,e.m21,e.m22,e.dx,e.dy],!1===m&&n&&(l=!0));null!==this.background&&(!1===m&&n&&(cm(a,1,0,0,1,0,0),a.gn(b),m=!0),Bl(this,a,p,g));n&&(null!==this.background||null!==this.areaBackground||null!==f&&0!==(f.H&512)||null!==f&&(f.type===W.Auto||f.type===W.Spot)&&f.wb()!==this)?(Cl(this,!0),null===this.shadowVisible&&Al(a),l=!1):Cl(this,!1);l&&!1===m&&(cm(a,1,0,0,1,0,0),a.gn(b),m=!0);this.hj(a,b);n&&0!==(this.H&512)===!0&&zl(a);this.vj()&&n&&Al(a);h&& (a.restore(),k&&a.md.pop());this instanceof W&&(c=a.md.pop());!0===m&&a.md.pop();if(this instanceof Zg&&1<this.lineCount||this instanceof Kf&&1<this.geometry.figures.length)c=a.md.pop();null!==a.tu.Lq&&(null===c&&(d===a.au?(cm(a,1,0,0,1,0,0),c=a.md.pop()):c=a.au),a.tu.Lq(this,c));this.svg=c;return!0}; function Jk(a,b){this.ownerDocument=b=void 0===b?ra.document:b;this.Lq=null;b=b.createElement("canvas");b.tabIndex=0;this.Qa=b;this.Qa.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new El(b);b.D=a}Jk.prototype.resize=function(a,b,c,d){return this.width!==a||this.height!==b?(this.width=a,this.height=b,this.style.width=c+"px",this.style.height=d+"px",!0):!1};Jk.prototype.toDataURL=function(a,b){return this.Qa.toDataURL(a,b)}; Jk.prototype.getBoundingClientRect=function(){return this.Qa.getBoundingClientRect()};Jk.prototype.focus=function(){this.Qa.focus()};Jk.prototype.oy=function(){this.ownerDocument=this.Qa.D=null};na.Object.defineProperties(Jk.prototype,{width:{configurable:!0,get:function(){return this.Qa.width},set:function(a){this.Qa.width=a}},height:{configurable:!0,get:function(){return this.Qa.height},set:function(a){this.Qa.height=a}},style:{configurable:!0,get:function(){return this.Qa.style}}}); Jk.className="CanvasSurface";function El(a){a.getContext&&a.getContext("2d")||v("Browser does not support HTML Canvas Element");this.aa=a.getContext("2d");this.zu=this.Bu=this.Au="";this.Hn=!1;this.Eg=this.mt=this.lt=0;this.Bm=new Fb}t=El.prototype;t.Xy=function(a){this.aa.imageSmoothingEnabled=a};t.arc=function(a,b,c,d,e,f){this.aa.arc(a,b,c,d,e,f)};t.beginPath=function(){this.aa.beginPath()};t.bezierCurveTo=function(a,b,c,d,e,f){this.aa.bezierCurveTo(a,b,c,d,e,f)}; t.clearRect=function(a,b,c,d){this.ke();this.aa.clearRect(a,b,c,d)};t.clip=function(){this.aa.clip()};t.closePath=function(){this.aa.closePath()};t.createLinearGradient=function(a,b,c,d){return this.aa.createLinearGradient(a,b,c,d)};t.createPattern=function(a,b){return this.aa.createPattern(a,b)};t.createRadialGradient=function(a,b,c,d,e,f){return this.aa.createRadialGradient(a,b,c,d,e,f)}; t.drawImage=function(a,b,c,d,e,f,g,h,k){void 0===d?this.aa.drawImage(a,b,c):this.aa.drawImage(a,b,c,d,e,f,g,h,k)};t.fill=function(){this.aa.fill()};t.fillRect=function(a,b,c,d){this.aa.fillRect(a,b,c,d)};t.fillText=function(a,b,c){this.aa.fillText(a,b,c)};t.getImageData=function(a,b,c,d){return this.aa.getImageData(a,b,c,d)};t.lineTo=function(a,b){this.aa.lineTo(a,b)};t.measureText=function(a){return this.aa.measureText(a)};t.moveTo=function(a,b){this.aa.moveTo(a,b)}; t.quadraticCurveTo=function(a,b,c,d){this.aa.quadraticCurveTo(a,b,c,d)};t.rect=function(a,b,c,d){this.aa.rect(a,b,c,d)};t.restore=function(){this.aa.restore()};t.save=function(){this.ke();this.aa.save()};El.prototype.rotate=function(a){this.Bm.rotate(57.2958*a,0,0)};t=El.prototype;t.setTransform=function(a,b,c,d,e,f){this.Bm.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.Bm.scale(a,b)};t.translate=function(a,b){this.Bm.translate(a,b)};t.stroke=function(){this.aa.stroke()}; t.transform=function(a,b,c,d,e,f){if(1!==a||0!==b||0!==c||1!==d||0!==e||0!==f){var g=this.Bm,h=g.m11*a+g.m21*b;a=g.m12*a+g.m22*b;b=g.m11*c+g.m21*d;c=g.m12*c+g.m22*d;g.dx=g.m11*e+g.m21*f+g.dx;g.dy=g.m12*e+g.m22*f+g.dy;g.m11=h;g.m12=a;g.m21=b;g.m22=c}};t.ke=function(){var a=this.Bm;this.aa.setTransform(a.m11,a.m12,a.m21,a.m22,a.dx,a.dy)}; t.Mf=function(a){if(a instanceof wl&&a.type===xl){var b=a.gl;a=a.Cu;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.Hn?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.Hn?this.clip():this.fill()};t.Bj=function(){this.Hn||this.stroke()};t.Ow=function(a,b,c){this.lt=a;this.mt=b;this.Eg=c}; t.Kt=function(a,b){var c=this.aa;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.It=function(){var a=this.aa;void 0!==a.setLineDash&&(a.setLineDash(fm),a.lineDashOffset=0)};t.Oc=function(a){a&&(this.Au="");this.zu=this.Bu=""}; na.Object.defineProperties(El.prototype,{fillStyle:{configurable:!0,get:function(){return this.aa.fillStyle},set:function(a){this.zu!==a&&(this.zu=this.aa.fillStyle=a)}},font:{configurable:!0,get:function(){return this.aa.font},set:function(a){this.Au!==a&&(this.Au=this.aa.font=a)}},globalAlpha:{configurable:!0,get:function(){return this.aa.globalAlpha},set:function(a){this.aa.globalAlpha=a}},lineCap:{configurable:!0,get:function(){return this.aa.lineCap}, set:function(a){this.aa.lineCap=a}},lineDashOffset:{configurable:!0,get:function(){return this.aa.lineDashOffset},set:function(a){this.aa.lineDashOffset=a}},lineJoin:{configurable:!0,get:function(){return this.aa.lineJoin},set:function(a){this.aa.lineJoin=a}},lineWidth:{configurable:!0,get:function(){return this.aa.lineWidth},set:function(a){this.aa.lineWidth=a}},miterLimit:{configurable:!0,get:function(){return this.aa.miterLimit},set:function(a){this.aa.miterLimit= a}},shadowBlur:{configurable:!0,get:function(){return this.aa.shadowBlur},set:function(a){this.aa.shadowBlur=a}},shadowColor:{configurable:!0,get:function(){return this.aa.shadowColor},set:function(a){this.aa.shadowColor=a}},shadowOffsetX:{configurable:!0,get:function(){return this.aa.shadowOffsetX},set:function(a){this.aa.shadowOffsetX=a}},shadowOffsetY:{configurable:!0,get:function(){return this.aa.shadowOffsetY},set:function(a){this.aa.shadowOffsetY= a}},strokeStyle:{configurable:!0,get:function(){return this.aa.strokeStyle},set:function(a){this.Bu!==a&&(this.Bu=this.aa.strokeStyle=a)}},textAlign:{configurable:!0,get:function(){return this.aa.textAlign},set:function(a){this.aa.textAlign=a}},imageSmoothingEnabled:{configurable:!0,get:function(){return this.aa.imageSmoothingEnabled},set:function(a){this.aa.imageSmoothingEnabled=a}},clipInsteadOfFill:{configurable:!0,get:function(){return this.Hn}, set:function(a){this.Hn=a}}});var fm=Object.freeze([]);El.className="CanvasSurfaceContext";function gm(){this.P=this.o=this.F=this.j=0}gm.className="ColorNumbers"; function wl(a){G&&1<arguments.length&&v("Brush constructor can take at most one optional argument, the Brush type.");hm||(im(),hm=!0);cb(this);this.u=!1;void 0===a?(this.na=Dl,this.fl="black"):"string"===typeof a?(this.na=Dl,G&&!jm(a)&&v('Color "'+a+'" is not a valid color string for Brush constructor'),this.fl=a):(G&&eb(a,wl,wl,"constructor:type"),this.na=a,this.fl="black");var b=this.na;b===Gl?(this.Hd=Ec,this.sl=Mc):this.sl=b===xl?this.Hd=Jc:this.Hd=Cc;this.qt=0;this.cs=NaN;this.ue=this.Rs=this.te= null;this.Cu=this.gl=0}wl.prototype.copy=function(){var a=new wl;a.na=this.na;a.fl=this.fl;a.Hd=this.Hd.L();a.sl=this.sl.L();a.qt=this.qt;a.cs=this.cs;null!==this.te&&(a.te=this.te.copy());a.Rs=this.Rs;return a};t=wl.prototype;t.freeze=function(){this.u=!0;null!==this.te&&this.te.freeze();return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.u=!1;null!==this.te&&this.te.ka();return this};t.ob=function(a){a.classType===wl?this.type=a:Ea(this,a)}; t.toString=function(){var a="Brush(";if(this.type===Dl)a+=this.color;else if(a=this.type===Gl?a+"Linear ":this.type===xl?a+"Radial ":this.type===Fl?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.u&&wa(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&Ba(a,"0 <= loc <= 1",wl,"addColorStop:loc");A(b,"string",wl,"addColorStop:color");G&&!jm(b)&&v('Color "'+b+'" is not a valid color string for Brush.addColorStop');null===this.te&&(this.te=new zb);this.te.add(a,b);this.na===Dl&&(this.type=Gl);this.ue=null;return this}; function jm(a){if("black"===a)return!0;if(""===a)return!1;G&&A(a,"string",wl,"isValidColor");hm||(im(),hm=!0);var b=km;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} t.QA=function(a,b){this.u&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?lm:b;if(this.type===Dl)ei(this.color),this.color=mm(a,b);else if((this.type===Gl||this.type===xl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)ei(c.value),this.addColorStop(c.key,mm(a,b));return this};function nm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?lm:c;ei(a);return mm(b,c)} t.Qz=function(a,b){this.u&&wa(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?lm:b;if(this.type===Dl)ei(this.color),this.color=mm(-a,b);else if((this.type===Gl||this.type===xl)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)ei(c.value),this.addColorStop(c.key,mm(-a,b));return this};function om(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?lm:c;ei(a);return mm(-b,c)} function pm(a,b,c){ei(a);a=qm.j;var d=qm.F,e=qm.o,f=qm.P;ei(b);void 0===c&&(c=.5);return"rgba("+Math.round((qm.j-a)*c+a)+", "+Math.round((qm.F-d)*c+d)+", "+Math.round((qm.o-e)*c+e)+", "+Math.round((qm.P-f)*c+f)+")"} t.Ky=function(){if(this.type===Dl)return rm(this.color);if((this.type===Gl||this.type===xl)&&null!==this.colorStops){var a=this.colorStops;if(this.type===xl)return rm(a.first().value);if(null!==a.get(.5))return rm(a.get(.5));if(2===a.count)return a=a.Ea(),rm(pm(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&&(f=c,c=d,d=f,f=e);e=d-c;return rm(pm(a.get(c),a.get(d),1-f/e))}return!1}; function rm(a){if(!a)return!1;if(a instanceof wl)return a.Ky();ei(a);return 128>(299*qm.j+587*qm.F+114*qm.o)/1E3} function mm(a,b){switch(b){case lm:b=100*sm(qm.j);var c=100*sm(qm.F),d=100*sm(qm.o);tm.j=.4124564*b+.3575761*c+.1804375*d;tm.F=.2126729*b+.7151522*c+.072175*d;tm.o=.0193339*b+.119192*c+.9503041*d;tm.P=qm.P;b=um(tm.j/vm[0]);c=um(tm.F/vm[1]);d=um(tm.o/vm[2]);wm.j=116*c-16;wm.F=500*(b-c);wm.o=200*(c-d);wm.P=tm.P;wm.j=Math.min(100,Math.max(0,wm.j+100*a));a=(wm.j+16)/116;b=a-wm.o/200;tm.j=vm[0]*xm(wm.F/500+a);tm.F=vm[1]*(wm.j>ym*zm?Math.pow(a,3):wm.j/ym);tm.o=vm[2]*xm(b);tm.P=wm.P;a=-.969266*tm.j+1.8760108* tm.F+.041556*tm.o;b=.0556434*tm.j+-.2040259*tm.F+1.0572252*tm.o;qm.j=255*Am((3.2404542*tm.j+-1.5371385*tm.F+-.4985314*tm.o)/100);qm.F=255*Am(a/100);qm.o=255*Am(b/100);qm.P=tm.P;qm.j=Math.round(qm.j);255<qm.j?qm.j=255:0>qm.j&&(qm.j=0);qm.F=Math.round(qm.F);255<qm.F?qm.F=255:0>qm.F&&(qm.F=0);qm.o=Math.round(qm.o);255<qm.o?qm.o=255:0>qm.o&&(qm.o=0);return"rgba("+qm.j+", "+qm.F+", "+qm.o+", "+qm.P+")";case Bm:return fi(),gi.o=Math.min(100,Math.max(0,gi.o+100*a)),"hsla("+gi.j+", "+gi.F+"%, "+gi.o+"%, "+ gi.P+")";default:v("Unknown color space: "+b)}}function ei(a){hm||(im(),hm=!0);var b=km;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,qm.j=a[0],qm.F=a[1],qm.o=a[2],qm.P=a[3]/255):(b.fillStyle="#FFFFFF",c=b.fillStyle,b.fillStyle=a,b.fillStyle===c&&G&&v('Color "'+a+'" is not a valid color string for RGBA color conversion'),qm.j=0,qm.F=0,qm.o=0,qm.P=1)}} function fi(){var a=qm.j/255,b=qm.F/255,c=qm.o/255,d=Math.max(a,b,c),e=Math.min(a,b,c),f=d-e;e=(d+e)/2;if(0===f)var g=a=0;else{switch(d){case a:g=(b-c)/f%6;break;case b:g=(c-a)/f+2;break;case c:g=(a-b)/f+4}g*=60;0>g&&(g+=360);a=f/(1-Math.abs(2*e-1))}gi.j=Math.round(g);gi.F=Math.round(100*a);gi.o=Math.round(100*e);gi.P=qm.P}function sm(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 um(a){return a>zm?Math.pow(a,1/3):(ym*a+16)/116}function xm(a){var b=a*a*a;return b>zm?b:(116*a-16)/ym}function Xl(a,b){"string"===typeof a?G&&!jm(a)&&v('Color "'+a+'" is not a valid color string for '+b):a instanceof wl||v("Value for "+b+" must be a color string or a Brush, not "+a)}function im(){km=Xg?(new Jk(null)).context:null} na.Object.defineProperties(wl.prototype,{type:{configurable:!0,get:function(){return this.na},set:function(a){this.u&&wa(this,a);eb(a,wl,wl,"type");this.na=a;this.start.bc()&&(a===Gl?this.start=Ec:a===xl&&(this.start=Jc));this.end.bc()&&(a===Gl?this.end=Mc:a===xl&&(this.end=Jc));this.ue=null}},color:{configurable:!0,get:function(){return this.fl},set:function(a){this.u&&wa(this,a);G&&!jm(a)&&v('Color "'+a+'" is not a valid color string for Brush.color');this.fl=a;this.ue= null}},start:{configurable:!0,get:function(){return this.Hd},set:function(a){this.u&&wa(this,a);w(a,Eb,wl,"start");this.Hd=a.L();this.ue=null}},end:{configurable:!0,get:function(){return this.sl},set:function(a){this.u&&wa(this,a);w(a,Eb,wl,"end");this.sl=a.L();this.ue=null}},startRadius:{configurable:!0,get:function(){return this.qt},set:function(a){this.u&&wa(this,a);C(a,wl,"startRadius");0>a&&Ba(a,">= zero",wl,"startRadius");this.qt=a;this.ue=null}},endRadius:{configurable:!0, enumerable:!0,get:function(){return this.cs},set:function(a){this.u&&wa(this,a);C(a,wl,"endRadius");0>a&&Ba(a,">= zero",wl,"endRadius");this.cs=a;this.ue=null}},colorStops:{configurable:!0,get:function(){return this.te},set:function(a){this.u&&wa(this,a);G&&w(a,zb,wl,"colorStops");this.te=a;this.ue=null}},pattern:{configurable:!0,get:function(){return this.Rs},set:function(a){this.u&&wa(this,a);this.Rs=a;this.ue=null}}});wl.prototype.isDark=wl.prototype.Ky; wl.prototype.darkenBy=wl.prototype.Qz;wl.prototype.lightenBy=wl.prototype.QA;wl.prototype.addColorStop=wl.prototype.addColorStop;var zm=216/24389,ym=24389/27,vm=[95.047,100,108.883],km=null,qm=new gm,gi=new gm,tm=new gm,wm=new gm,hm=!1;wl.className="Brush";var Dl;wl.Solid=Dl=new E(wl,"Solid",0);var Gl;wl.Linear=Gl=new E(wl,"Linear",1);var xl;wl.Radial=xl=new E(wl,"Radial",2);var Fl;wl.Pattern=Fl=new E(wl,"Pattern",4);var lm;wl.Lab=lm=new E(wl,"Lab",5);var Bm;wl.HSL=Bm=new E(wl,"HSL",6); wl.randomColor=function(a,b){void 0===a&&(a=128);G&&(C(a,wl,"randomColor:min"),(0>a||255<a)&&Ba(a,"0 <= min <= 255",wl,"randomColor:min"));void 0===b&&(b=Math.max(a,255));G&&(C(b,wl,"randomColor:max"),(b<a||255<b)&&Ba(b,"min <= max <= 255",wl,"randomColor:max"));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};wl.isValidColor=jm;wl.lighten=function(a){return nm(a)};wl.lightenBy=nm;wl.darken=function(a){return om(a)};wl.darkenBy=om;wl.mix=pm;wl.isDark=rm;function Ul(){this.ta="Base"}Ul.prototype.measure=function(){};Ul.prototype.TA=function(a,b,c,d,e){a.measure(b,c,d,e)};Ul.prototype.arrange=function(){};Ul.prototype.Dz=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};Ul.prototype.cB=function(a){a.Gk()};Ul.prototype.rc=function(){}; na.Object.defineProperties(Ul.prototype,{name:{configurable:!0,get:function(){return this.ta},set:function(a){this.ta=a}},classType:{configurable:!0,get:function(){return W}}});Ul.prototype.remeasureObject=Ul.prototype.cB;Ul.prototype.arrangeElement=Ul.prototype.Dz;Ul.prototype.measureElement=Ul.prototype.TA;Ul.className="PanelLayout";function Cm(){this.ta="Base"}ma(Cm,Ul); Cm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=Dm(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 r=l.position.y;isFinite(p)||(p=0);isFinite(r)||(r=0);l instanceof Kf&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);jc(e,p,r,n,m)}}}; Cm.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 Kf&&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 Em(){this.ta="Base"}ma(Em,Ul); Em.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=Ma();f=Dm(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=rl(l,!1);if(m!==pg&&m!==el)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)}; Em.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,r=p.top+p.bottom,q=f+e.bottom,u=n.height,y=rl(m,!1);if(isNaN(m.desiredSize.height)&&y===Cd||y===fl)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Jb()&&(q=a.defaultAlignment);q.fb()||(q=Jc);g&&(h-=n.width+p.left+p.right);m.arrange(h+q.offsetX+p.left,l+q.offsetY+p.top+(c.height*q.y-r*q.y),n.width,u);g||(h+=n.width+ p.left+p.right)}}};function Fm(){this.ta="Base"}ma(Fm,Ul); Fm.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=Ma();for(var h=Dm(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=rl(l,!1);if(m!==pg&&m!==fl)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;bc(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)}}; Fm.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,r=p.left+p.right,q=f+e.right,u=n.width,y=rl(m,!1);if(isNaN(m.desiredSize.width)&&y===Cd||y===el)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Jb()&&(q=a.defaultAlignment);q.fb()||(q=Jc);g&&(h-=n.height+p.bottom+p.top);m.arrange(l+q.offsetX+p.left+(c.width*q.x-r*q.x),h+q.offsetY+p.top,u,n.height);g||(h+=n.height+ p.bottom+p.top)}}};function Gm(){this.ta="Base"}ma(Gm,Ul); Gm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.wb(),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 r=Math.max(f+m,0);var q=Math.max(g+n,0);var u=a.isClipping,y=M.allocAt(-l.left,-l.top,r,q),x=M.allocAt(0,0,f,g);Hm(k,x,!0);f=x.width;g=x.height;for(var z=!0,B=Dm(a),D=0;D<h;D++){var F=d[D];if(F!==k&&(F.visible||F===B)){l=F.margin;r=l.right+l.left;q=l.top+l.bottom;p=rl(F,!1);switch(p){case Cd:b=f;c=g;break;case el:b=f;break; case fl:c=g}F.measure(b,c,0,0);p=F.measuredBounds;r=Math.max(p.width+r,0);q=Math.max(p.height+q,0);var L=F.alignment;L.Jb()&&(L=a.defaultAlignment);L.fb()||(L=Jc);var Z=F.alignmentFocus;Z.Jb()&&(Z=Jc);var Q=null;F instanceof W&&""!==F.af&&(Q=F.eb(F.af),Q===F&&(Q=null));var ba=x.x,S=x.y;if(null!==Q){F.arrange(0,0,p.width,p.height);l=Q.actualBounds;l=J.allocAt(l.x+(Z.x*l.width-Z.offsetX),l.y+(Z.y*l.height-Z.offsetY));for(Q=Q.panel;Q!==F;)Q.transform.Fa(l),Q=Q.panel;ba+=L.x*f+L.offsetX-l.x;S+=L.y*g+ L.offsetY-l.y;J.free(l)}else ba+=L.x*f+L.offsetX-(Z.x*p.width+Z.offsetX)-l.left,S+=L.y*g+L.offsetY-(Z.y*p.height+Z.offsetY)-l.top;z?(z=!1,e.h(ba,S,r,q)):jc(e,ba,S,r,q)}}z?e.assign(y):u?e.jw(x.x,x.y,x.width,x.height):jc(e,y.x,y.y,y.width,y.height);M.free(y);M.free(x);p=k.stretch;p===dl&&(p=rl(k,!1));switch(p){case pg:return;case Cd:if(!isFinite(b)&&!isFinite(c))return;break;case el:if(!isFinite(b))return;break;case fl:if(!isFinite(c))return}p=k.measuredBounds;f=p.width;g=p.height;r=Math.max(f+m,0); q=Math.max(g+n,0);l=k.margin;x=M.allocAt(-l.left,-l.top,r,q);Hm(k,x,!0);f=x.width;g=x.height;for(b=0;b<h;b++)c=d[b],c===k||!c.visible&&c!==B||(l=c.margin,r=l.right+l.left,q=l.top+l.bottom,p=c.measuredBounds,r=Math.max(p.width+r,0),q=Math.max(p.height+q,0),m=c.alignment,m.Jb()&&(m=a.defaultAlignment),m.fb()||(m=Jc),c=c.alignmentFocus,c.Jb()&&(c=Jc),z?(z=!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,r,q)):jc(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,r,q));z?e.assign(y):u?e.jw(x.x,x.y,x.width,x.height):jc(e,y.x,y.y,y.width,y.height);M.free(x)}; Gm.prototype.arrange=function(a,b,c){var d=b.length,e=a.wb(),f=e.measuredBounds,g=f.width,h=f.height,k=a.padding;f=k.left;k=k.top;var l=f-c.x,m=k-c.y;e.arrange(l,m,g,h);g=M.allocAt(0,0,g,h);Hm(e,g,!1);for(h=0;h<d;h++){var n=b[h];if(n!==e){l=n.measuredBounds;var p=l.width,r=l.height;m=n.alignment;m.Jb()&&(m=a.defaultAlignment);m.fb()||(m=Jc);var q=n.alignmentFocus;q.Jb()&&(q=Jc);l=null;n instanceof W&&""!==n.af&&(l=n.eb(n.af),l===n&&(l=null));if(null!==l){var u=l.actualBounds;q=J.allocAt(u.x+(q.x* u.width-q.offsetX),u.y+(q.y*u.height-q.offsetY));for(l=l.panel;l!==n;)l.transform.Fa(q),l=l.panel;l=m.x*g.width+m.offsetX-q.x;m=m.y*g.height+m.offsetY-q.y;J.free(q)}else l=m.x*g.width+m.offsetX-(q.x*p+q.offsetX),m=m.y*g.height+m.offsetY-(q.y*r+q.offsetY);l+=g.x-c.x;m+=g.y-c.y;n.visible&&n.arrange(f+l,k+m,p,r)}}M.free(g)}; function Hm(a,b,c){var d=null;a instanceof W&&""!==a.af&&(d=a.eb(a.af),d===a&&(d=null));if(null!==d)for(c&&a.arrange(0,0,b.width,b.height),b.assign(d.actualBounds),d=d.panel;d!==a;)d.transform.pr(b),d=d.panel}function Im(){this.ta="Base"}ma(Im,Ul); Im.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.wb(),l=k.margin,m=b,n=c,p=l.right+l.left,r=l.top+l.bottom;k.measure(b,c,f,g);l=k.measuredBounds;var q=0,u=null;k instanceof Kf&&(u=k,q=u.strokeWidth*u.scale);var y=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var x=Jm(k),z=x.x*y+x.offsetX;x=x.y*l+x.offsetY;var B=Km(k),D=B.x*y+B.offsetX;B=B.y*l+B.offsetY;isFinite(b)&&(m=Math.max(Math.abs(z-D)-q,0));isFinite(c)&&(n=Math.max(Math.abs(x-B)-q,0));q=Db.alloc();q.h(0,0);a=Dm(a);for(B=0;B< h;B++)x=d[B],x===k||!x.visible&&x!==a||(l=x.margin,y=l.right+l.left,z=l.top+l.bottom,x.measure(m,n,0,0),l=x.measuredBounds,y=Math.max(l.width+y,0),l=Math.max(l.height+z,0),q.h(Math.max(y,q.width),Math.max(l,q.height)));if(1===h)e.width=y,e.height=l,Db.free(q);else{x=Jm(k);B=Km(k);h=d=0;B.x!==x.x&&B.y!==x.y&&(d=q.width/Math.abs(B.x-x.x),h=q.height/Math.abs(B.y-x.y));Db.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,qg(u)===rg&&(d=h=Math.max(d,h)));d+=Math.abs(x.offsetX)+Math.abs(B.offsetX)+q;h+=Math.abs(x.offsetY)+ Math.abs(B.offsetY)+q;u=k.stretch;u===dl&&(u=rl(k,!1));switch(u){case pg:g=f=0;break;case Cd:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case el:isFinite(b)&&(d=b);g=0;break;case fl:f=0,isFinite(c)&&(h=c)}k.Gk();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}}; Im.prototype.arrange=function(a,b){var c=b.length,d=a.wb(),e=d.measuredBounds,f=M.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=Jm(d),n=Km(d),p=m.y*e.height+m.offsetY,r=n.x*e.width+n.offsetX;n=n.y*e.height+n.offsetY;f.x=m.x*e.width+m.offsetX;f.y=p;jc(f,r,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.Jb()&&(p=a.defaultAlignment),p.fb()||(p=Jc),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&&(nc(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 M(f.x,f.y,f.width,f.height))));M.free(f)};function Lm(){this.ta="Base";this.name="Table"}ma(Lm,Ul); Lm.prototype.measure=function(a,b,c,d,e){for(var f=d.length,g=Ma(),h=Ma(),k=0;k<f;k++){var l=d[k],m=l instanceof W?l:null;if(null===m||m.type!==W.TableRow&&m.type!==W.TableColumn||!l.visible)g.push(l);else{G&&(m.desiredSize.s()&&v(m.toString()+" TableRow/TableColumn Panels cannot set a desiredSize: "+m.desiredSize.toString()),m.minSize.B(Qb)||v(m.toString()+" TableRow/TableColumn Panels cannot set a minSize: "+m.minSize.toString()),m.maxSize.B(Xb)||v(m.toString()+" TableRow/TableColumn Panels cannot set a maxSize: "+ m.maxSize.toString()));h.push(m);for(var n=m.$.l,p=n.length,r=0;r<p;r++){var q=n[r];m.type===W.TableRow?q.row=l.row:m.type===W.TableColumn&&(q.column=l.column);g.push(q)}}}f=g.length;0===f&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var u=[],y=0;y<f;y++){var x=g[y];rj(x,!0);sl(x,!0);u[x.row]||(u[x.row]=[]);u[x.row][x.column]||(u[x.row][x.column]=[]);u[x.row][x.column].push(x)}Oa(g);var z=Ma(),B=Ma(),D=Ma(),F={count:0},L={count:0},Z=b,Q=c,ba=a.tb;f=ba.length;for(var S=0;S<f;S++){var P=ba[S]; void 0!==P&&(P.actual=0)}ba=a.pb;f=ba.length;for(var xa=0;xa<f;xa++)P=ba[xa],void 0!==P&&(P.actual=0);for(var ka=u.length,Aa=0,Sa=0;Sa<ka;Sa++)u[Sa]&&(Aa=Math.max(Aa,u[Sa].length));var vb=Math.min(a.topIndex,ka-1),Xa=Math.min(a.leftIndex,Aa-1),Ya=0;ka=u.length;for(var Kd=Dm(a),kc=0;kc<ka;kc++)if(u[kc]){Aa=u[kc].length;var lc=a.getRowDefinition(kc);lc.actual=0;for(var wb=lc.gc=0;wb<Aa;wb++)if(u[kc][wb]){var Ld=a.getColumnDefinition(wb);void 0===z[wb]&&(Ld.actual=0,Ld.gc=0,z[wb]=!0);for(var sg=u[kc][wb], tg=sg.length,Se=0;Se<tg;Se++){var Vb=sg[Se];if(Vb.visible||Vb===Kd){var Dh=1<Vb.rowSpan||1<Vb.columnSpan;Dh&&(kc<vb||wb<Xa||B.push(Vb));var ug=Vb.margin,Eh=ug.right+ug.left,Fh=ug.top+ug.bottom;var rb=Kl(Vb,lc,Ld,!1);var Oi=Vb.desiredSize,ok=!isNaN(Oi.height),vg=!isNaN(Oi.width)&&ok;Dh||rb===pg||vg||kc<vb||wb<Xa||(void 0!==F[wb]||rb!==Cd&&rb!==el||(F[wb]=-1,F.count++),void 0!==L[kc]||rb!==Cd&&rb!==fl||(L[kc]=-1,L.count++),D.push(Vb));Vb.measure(Infinity,Infinity,0,0);if(!(kc<vb||wb<Xa)){var wd=Vb.measuredBounds, yc=Math.max(wd.width+Eh,0),Qf=Math.max(wd.height+Fh,0);if(1===Vb.rowSpan&&(rb===pg||rb===el)){P=a.getRowDefinition(kc);var Gc=P.Pc();Ya=Math.max(Qf-P.actual,0);Ya+Gc>Q&&(Ya=Math.max(Q-Gc,0));var wg=0===P.ra;P.gc=P.gc+Ya;P.actual=P.ra+Ya;Q=Math.max(Q-(Ya+(wg?Gc:0)),0)}if(1===Vb.columnSpan&&(rb===pg||rb===fl)){P=a.getColumnDefinition(wb);var Gh=P.Pc();Ya=Math.max(yc-P.actual,0);Ya+Gh>Z&&(Ya=Math.max(Z-Gh,0));var Kn=0===P.ra;P.gc=P.gc+Ya;P.actual=P.ra+Ya;Z=Math.max(Z-(Ya+(Kn?Gh:0)),0)}Dh&&Vb.Gk()}}}}}Oa(z); var Td=0,xe=0;f=a.columnCount;for(var xg=0;xg<f;xg++){var yg=a.pb[xg];void 0!==yg&&(Td+=yg.gc,0!==yg.gc&&(Td+=yg.Pc()))}f=a.rowCount;for(var fd=0;fd<f;fd++){var ye=a.tb[fd];void 0!==ye&&(xe+=ye.gc,0!==ye.gc&&(xe+=ye.Pc()))}Z=Math.max(b-Td,0);var qc=Q=Math.max(c-xe,0),Hh=Z;f=D.length;for(var Ih=0;Ih<f;Ih++){var gd=D[Ih],Pi=a.getRowDefinition(gd.row),ze=a.getColumnDefinition(gd.column),pf=gd.measuredBounds,Md=gd.margin,pk=Md.right+Md.left,Ln=Md.top+Md.bottom;F[gd.column]=0===ze.gc&&void 0!==F[gd.column]? Math.max(pf.width+pk,F[gd.column]):null;L[gd.row]=0===Pi.gc&&void 0!==L[gd.row]?Math.max(pf.height+Ln,L[gd.row]):null}var Rf=0,Wb=0,Ud;for(Ud in L)"count"!==Ud&&(Rf+=L[Ud]);for(Ud in F)"count"!==Ud&&(Wb+=F[Ud]);for(var xb=Db.alloc(),Qi=0;Qi<f;Qi++){var mc=D[Qi];if(mc.visible||mc===Kd){var Hc=a.getRowDefinition(mc.row),zc=a.getColumnDefinition(mc.column),Vd=0;isFinite(zc.width)?Vd=zc.width:(isFinite(Z)&&null!==F[mc.column]?0===Wb?Vd=zc.actual+Z:Vd=F[mc.column]/Wb*Hh:null!==F[mc.column]?Vd=Z:Vd=zc.actual|| Z,Vd=Math.max(0,Vd-zc.Pc()));var Wd=0;isFinite(Hc.height)?Wd=Hc.height:(isFinite(Q)&&null!==L[mc.row]?0===Rf?Wd=Hc.actual+Q:Wd=L[mc.row]/Rf*qc:null!==L[mc.row]?Wd=Q:Wd=Hc.actual||Q,Wd=Math.max(0,Wd-Hc.Pc()));xb.h(Math.max(zc.minimum,Math.min(Vd,zc.maximum)),Math.max(Hc.minimum,Math.min(Wd,Hc.maximum)));rb=Kl(mc,Hc,zc,!1);switch(rb){case el:xb.height=Math.max(xb.height,Hc.actual+Q);break;case fl:xb.width=Math.max(xb.width,zc.actual+Z)}var zg=mc.margin,Oc=zg.right+zg.left,Jh=zg.top+zg.bottom;mc.Gk(); mc.measure(xb.width,xb.height,zc.minimum,Hc.minimum);var Ag=mc.measuredBounds,Xd=Math.max(Ag.width+Oc,0),Kh=Math.max(Ag.height+Jh,0);isFinite(Z)&&(Xd=Math.min(Xd,xb.width));isFinite(Q)&&(Kh=Math.min(Kh,xb.height));var qf=0;qf=Hc.actual;Hc.actual=Math.max(Hc.actual,Kh);Hc.gc=Math.max(Hc.gc,Kh);Ya=Hc.actual-qf;Q=Math.max(Q-Ya,0);null===L[mc.row]&&(qc=Math.max(qc-Ya,0));qf=zc.actual;zc.actual=Math.max(zc.actual,Xd);zc.gc=Math.max(zc.gc,Xd);Ya=zc.actual-qf;Z=Math.max(Z-Ya,0);null===F[mc.column]&&(Hh= Math.max(Hh-Ya,0))}}Oa(D);var Yd=Db.alloc(),Zd=Ma(),$d=Ma();f=B.length;if(0!==f)for(var Te=0;Te<ka;Te++)if(u[Te]){Aa=u[Te].length;var Lh=a.getRowDefinition(Te);Zd[Te]=Lh.actual;for(var Ae=0;Ae<Aa;Ae++)if(u[Te][Ae]){var Mn=a.getColumnDefinition(Ae);$d[Ae]=Mn.actual}}for(var rc=0;rc<f;rc++){var bb=B[rc];if(bb.visible||bb===Kd){var sc=a.getRowDefinition(bb.row),ae=a.getColumnDefinition(bb.column);xb.h(Math.max(ae.minimum,Math.min(b,ae.maximum)),Math.max(sc.minimum,Math.min(c,sc.maximum)));rb=Kl(bb,sc, ae,!1);switch(rb){case Cd:0!==$d[ae.index]&&(xb.width=Math.min(xb.width,$d[ae.index]));0!==Zd[sc.index]&&(xb.height=Math.min(xb.height,Zd[sc.index]));break;case el:0!==$d[ae.index]&&(xb.width=Math.min(xb.width,$d[ae.index]));break;case fl:0!==Zd[sc.index]&&(xb.height=Math.min(xb.height,Zd[sc.index]))}isFinite(ae.width)&&(xb.width=ae.width);isFinite(sc.height)&&(xb.height=sc.height);Yd.h(0,0);for(var Ue=ae.minimum,Mh=sc.minimum,Ve=1;Ve<bb.rowSpan&&!(bb.row+Ve>=a.rowCount);Ve++)P=a.getRowDefinition(bb.row+ Ve),Ya=0,Ya=rb===Cd||rb===fl?Math.max(P.minimum,0===Zd[bb.row+Ve]?P.maximum:Math.min(Zd[bb.row+Ve],P.maximum)):Math.max(P.minimum,isNaN(P.Gd)?P.maximum:Math.min(P.Gd,P.maximum)),Yd.height+=Ya,Mh+=P.minimum;for(var Yc=1;Yc<bb.columnSpan&&!(bb.column+Yc>=a.columnCount);Yc++)P=a.getColumnDefinition(bb.column+Yc),Ya=0,Ya=rb===Cd||rb===el?Math.max(P.minimum,0===$d[bb.column+Yc]?P.maximum:Math.min($d[bb.column+Yc],P.maximum)):Math.max(P.minimum,isNaN(P.Gd)?P.maximum:Math.min(P.Gd,P.maximum)),Yd.width+= Ya,Ue+=P.minimum;xb.width+=Yd.width;xb.height+=Yd.height;var rf=bb.margin,Nh=rf.right+rf.left,Nn=rf.top+rf.bottom;bb.measure(xb.width,xb.height,Ue,Mh);for(var Bg=bb.measuredBounds,xd=Math.max(Bg.width+Nh,0),be=Math.max(Bg.height+Nn,0),Be=0,Ce=0;Ce<bb.rowSpan&&!(bb.row+Ce>=a.rowCount);Ce++)P=a.getRowDefinition(bb.row+Ce),Be+=P.total||0;if(Be<be){var ce=be-Be,De=be-Be;if(null!==bb.spanAllocation)for(var qk=bb.spanAllocation,We=0;We<bb.rowSpan&&!(0>=ce)&&!(bb.row+We>=a.rowCount);We++){P=a.getRowDefinition(bb.row+ We);var Ri=P.ra||0,Si=qk(bb,P,De);G&&"number"!==typeof Si&&v(bb+" spanAllocation does not return a number: "+Si);P.actual=Math.min(P.maximum,Ri+Si);P.ra!==Ri&&(ce-=P.ra-Ri)}for(;0<ce;){var yd=P.ra||0;isNaN(P.height)&&P.maximum>yd&&(P.actual=Math.min(P.maximum,yd+ce),P.ra!==yd&&(ce-=P.ra-yd));if(0===P.index)break;P=a.getRowDefinition(P.index-1)}}for(var Sf=0,Oh=0;Oh<bb.columnSpan&&!(bb.column+Oh>=a.columnCount);Oh++)P=a.getColumnDefinition(bb.column+Oh),Sf+=P.total||0;if(Sf<xd){var Cg=xd-Sf,lu=xd- Sf;if(null!==bb.spanAllocation)for(var mu=bb.spanAllocation,rk=0;rk<bb.columnSpan&&!(0>=Cg)&&!(bb.column+rk>=a.columnCount);rk++){P=a.getColumnDefinition(bb.column+rk);var On=P.ra||0,Pn=mu(bb,P,lu);G&&"number"!==typeof Pn&&v(bb+" spanAllocation does not return a number: "+Pn);P.actual=Math.min(P.maximum,On+Pn);P.ra!==On&&(Cg-=P.ra-On)}for(;0<Cg;){var sk=P.ra||0;isNaN(P.width)&&P.maximum>sk&&(P.actual=Math.min(P.maximum,sk+Cg),P.ra!==sk&&(Cg-=P.ra-sk));if(0===P.index)break;P=a.getColumnDefinition(P.index- 1)}}}}Oa(B);Db.free(Yd);Db.free(xb);void 0!==Zd&&Oa(Zd);void 0!==$d&&Oa($d);var Dg=0,Eg=0,tk=a.desiredSize,sr=a.maxSize;rb=rl(a,!0);var Ti=xe=Td=0,Ui=0;f=a.columnCount;for(var uk=0;uk<f;uk++)void 0!==a.pb[uk]&&(P=a.getColumnDefinition(uk),isFinite(P.width)?(Ti+=P.width,Ti+=P.Pc()):Mm(P)===Nm?(Ti+=P.ra,Ti+=P.Pc()):0!==P.ra&&(Td+=P.ra,Td+=P.Pc()));isFinite(tk.width)?Dg=Math.min(tk.width,sr.width):Dg=rb!==pg&&isFinite(b)?b:Td;Dg=Math.max(Dg,a.minSize.width);Dg=Math.max(Dg-Ti,0);for(var nu=0===Td?1:Math.max(Dg/ Td,1),wk=0;wk<f;wk++)void 0!==a.pb[wk]&&(P=a.getColumnDefinition(wk),isFinite(P.width)||Mm(P)===Nm||(P.actual=P.ra*nu),P.position=e.width,0!==P.ra&&(e.width+=P.ra,e.width+=P.Pc()));f=a.rowCount;for(var xk=0;xk<f;xk++)void 0!==a.tb[xk]&&(P=a.getRowDefinition(xk),isFinite(P.height)?(Ui+=P.height,Ui+=P.Pc()):Mm(P)===Nm?(Ui+=P.ra,Ui+=P.Pc()):0!==P.ra&&(xe+=P.ra,0!==P.ra&&(xe+=P.Pc())));isFinite(tk.height)?Eg=Math.min(tk.height,sr.height):Eg=rb!==pg&&isFinite(c)?c:xe;Eg=Math.max(Eg,a.minSize.height);Eg= Math.max(Eg-Ui,0);for(var ou=0===xe?1:Math.max(Eg/xe,1),yk=0;yk<f;yk++)void 0!==a.tb[yk]&&(P=a.getRowDefinition(yk),isFinite(P.height)||Mm(P)===Nm||(P.actual=P.ra*ou),P.position=e.height,0!==P.ra&&(e.height+=P.ra,0!==P.ra&&(e.height+=P.Pc())));f=h.length;for(var Qn=0;Qn<f;Qn++){var zd=h[Qn],Rn=0,Sn=0;zd.type===W.TableRow?(Rn=e.width,P=a.getRowDefinition(zd.row),Sn=P.actual):(P=a.getColumnDefinition(zd.column),Rn=P.actual,Sn=e.height);zd.measuredBounds.h(0,0,Rn,Sn);rj(zd,!1);u[zd.row]||(u[zd.row]= []);u[zd.row][zd.column]||(u[zd.row][zd.column]=[]);u[zd.row][zd.column].push(zd)}Oa(h);a.Tp=u}; Lm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.Tp,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].ra);)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].ra);)h++;h=Math.min(h,m-1);for(var p=-a.pb[h].position,r=Db.alloc(),q=0;q<l;q++)if(g[q]){m=g[q].length;var u=a.getRowDefinition(q);k=u.position+n+e;0!==u.ra&& (k+=u.Pv());for(var y=0;y<m;y++)if(g[q][y]){var x=a.getColumnDefinition(y);h=x.position+p+f;0!==x.ra&&(h+=x.Pv());for(var z=g[q][y],B=z.length,D=0;D<B;D++){var F=z[D],L=F.measuredBounds,Z=F instanceof W?F:null;if(null===Z||Z.type!==W.TableRow&&Z.type!==W.TableColumn){r.h(0,0);for(var Q=1;Q<F.rowSpan&&!(q+Q>=a.rowCount);Q++)Z=a.getRowDefinition(q+Q),r.height+=Z.total;for(Q=1;Q<F.columnSpan&&!(y+Q>=a.columnCount);Q++)Z=a.getColumnDefinition(y+Q),r.width+=Z.total;var ba=x.ra+r.width,S=u.ra+r.height; Q=h;Z=k;var P=ba,xa=S,ka=h,Aa=k,Sa=ba,vb=S;h+ba>c.width&&(Sa=Math.max(c.width-h,0));k+S>c.height&&(vb=Math.max(c.height-k,0));var Xa=F.alignment;if(Xa.Jb()){Xa=a.defaultAlignment;Xa.fb()||(Xa=Jc);var Ya=Xa.x;var Kd=Xa.y;var kc=Xa.offsetX;Xa=Xa.offsetY;var lc=x.alignment,wb=u.alignment;lc.fb()&&(Ya=lc.x,kc=lc.offsetX);wb.fb()&&(Kd=wb.y,Xa=wb.offsetY)}else Ya=Xa.x,Kd=Xa.y,kc=Xa.offsetX,Xa=Xa.offsetY;if(isNaN(Ya)||isNaN(Kd))Kd=Ya=.5,Xa=kc=0;lc=L.width;wb=L.height;var Ld=F.margin,sg=Ld.left+Ld.right, tg=Ld.top+Ld.bottom,Se=Kl(F,u,x,!1);!isNaN(F.desiredSize.width)||Se!==Cd&&Se!==el||(lc=Math.max(ba-sg,0));!isNaN(F.desiredSize.height)||Se!==Cd&&Se!==fl||(wb=Math.max(S-tg,0));ba=F.maxSize;S=F.minSize;lc=Math.min(ba.width,lc);wb=Math.min(ba.height,wb);lc=Math.max(S.width,lc);wb=Math.max(S.height,wb);ba=wb+tg;Q+=P*Ya-(lc+sg)*Ya+kc+Ld.left;Z+=xa*Kd-ba*Kd+Xa+Ld.top;F.visible&&(nc(ka,Aa,Sa,vb,Q,Z,L.width,L.height)?F.arrange(Q,Z,lc,wb):F.arrange(Q,Z,lc,wb,new M(ka,Aa,Sa,vb)))}else F.Hl(),F.actualBounds.ka(), P=F.actualBounds,Q=M.allocAt(P.x,P.y,P.width,P.height),P.x=Z.type===W.TableRow?f:h,P.y=Z.type===W.TableColumn?e:k,P.width=L.width,P.height=L.height,F.actualBounds.freeze(),sl(F,!1),ec(Q,P)||(L=F.part,null!==L&&(L.Wh(),F.vp(L))),M.free(Q)}}}Db.free(r);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.ka(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};function Om(){this.ta="Base"}ma(Om,Ul); Om.prototype.measure=function(){};Om.prototype.arrange=function(){};function Pm(){this.ta="Base"}ma(Pm,Ul);Pm.prototype.measure=function(){};Pm.prototype.arrange=function(){};function Qm(){this.ta="Base"}ma(Qm,Ul); Qm.prototype.measure=function(a,b,c,d,e,f,g){1<d.length&&v("Viewbox Panel cannot contain more than one GraphObject.");d=d[0];d.wa=1;d.Gk();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),r=Math.max(c-k,0),q=1;a.viewboxStretch===rg?0!==n&&0!==h&&(q=Math.min(p/n,r/h)):0!==n&&0!==h&&(q=Math.max(p/n,r/h));0===q&&(q=1E-4);d.wa*=q;m!==d.scale&&(rj(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)};Qm.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.Jb()&&(g=a.defaultAlignment);g.fb()||(g=Jc);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 Rm(){this.ta="Base"}ma(Rm,Ul);Rm.prototype.measure=function(){}; Rm.prototype.arrange=function(){}; Rm.prototype.rc=function(a,b,c){c=a.Of()*c.scale;0>=c&&(c=1);var d=a.gridCellSize,e=d.width;d=d.height;var f=a.naturalBounds,g=a.actualBounds,h=f.width,k=f.height,l=Math.ceil(h/e),m=Math.ceil(k/d),n=a.gridOrigin,p=n.x;n=n.y;b.save();b.beginPath();b.rect(0,0,h,k);b.clip();for(var r=[],q=a.$.l,u=q.length,y=0;y<u;y++){var x=q[y],z=[];r.push(z);if(x.visible){var B=x.interval;if(!(0>B)){x=bk(x.figure);for(var D=0;D<u;D++)if(D!==y){var F=q[D];F.visible&&bk(F.figure)===x&&(F=F.interval,F>B&&z.push(F))}}}}q= a.$.l;u=q.length;for(y=0;y<u;y++){var L=q[y];if(L.visible&&(z=L.interval||1,x=Math.abs(z),!(2>e*x*c))){B=L.segmentIndex;if(!isFinite(B)||isNaN(B))B=0;0>B&&(B=x-Math.min(-B,x));B=Math.round(B%x);x=L.opacity;D=1;if(1!==x){if(0===x)continue;D=b.globalAlpha;b.globalAlpha=D*x}F=r[y];var Z=!1,Q=L.strokeDashArray;null!==Q&&(Z=!0,b.Kt(Q,L.strokeDashOffset));if("LineV"===L.figure&&null!==L.stroke&&0<L.strokeWidth){b.lineWidth=L.strokeWidth;ri(a,b,L.stroke,!1,!1,f,g);b.beginPath();for(Q=L=Math.floor((p-e)/ e);Q<=L+l;Q++){var ba=Q*e+p;0<=ba&&ba<=h&&Sm(Q,z,B,F)&&(b.moveTo(ba,0),b.lineTo(ba,k))}b.stroke()}else if("LineH"===L.figure&&null!==L.stroke&&0<L.strokeWidth){b.lineWidth=L.strokeWidth;ri(a,b,L.stroke,!1,!1,f,g);b.beginPath();for(Q=L=Math.floor((n-d)/d);Q<=L+m;Q++)ba=Q*d+n,0<=ba&&ba<=k&&Sm(Q,z,B,F)&&(b.moveTo(0,ba),b.lineTo(h,ba));b.stroke()}else if("BarV"===L.figure&&null!==L.fill)for(ri(a,b,L.fill,!0,!1,f,g),L=L.width,isNaN(L)&&(L=e),ba=Q=Math.floor((p-e)/e);ba<=Q+l;ba++){var S=ba*e+p;0<=S+L&& S<=h&&Sm(ba,z,B,F)&&b.fillRect(S,0,L,k)}else if("BarH"===L.figure&&null!==L.fill)for(ri(a,b,L.fill,!0,!1,f,g),L=L.height,isNaN(L)&&(L=d),ba=Q=Math.floor((n-d)/d);ba<=Q+m;ba++)S=ba*d+n,0<=S+L&&S<=k&&Sm(ba,z,B,F)&&b.fillRect(0,S,h,L);Z&&b.It();1!==x&&(b.globalAlpha=D)}}b.restore();b.Oc(!1)};function Sm(a,b,c,d){if(0>b)return a%b===c;if(a%b!==c)return!1;b=d.length;for(var e=0;e<b;e++)if(a%d[e]===c)return!1;return!0}function Tm(){this.ta="Base"}ma(Tm,Ul); Tm.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof Le||a instanceof T){var f=null,g=null,h=null;a instanceof T&&(g=f=a);a instanceof Le&&(h=a,f=h.adornedPart);if(f instanceof T){var k=f;if(0===c)bc(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof Le?null:f.path,m=f.routeBounds;b=a.Ig;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.Kk(!1):null!==g&&g.Kk(!1);var p=m.width,r=m.height;a.location.h(m.x,m.y);a.j.length=0;null!==l&&(Um(a,p,r,l), h=l.measuredBounds,b.Yc(h),a.j.push(h));h=Fb.alloc();for(var q=J.alloc(),u=J.alloc(),y=0;y<c;y++){var x=d[y];if(x!==l)if(x.isPanelMain&&x instanceof Kf){Um(a,p,r,x);var z=x.measuredBounds;b.Yc(z);a.j.push(z)}else if(2>f)x.measure(Infinity,Infinity,0,0),z=x.measuredBounds,b.Yc(z),a.j.push(z);else{var B=x.segmentIndex,D=x.segmentFraction,F=x.alignmentFocus;F.bc()&&(F=Jc);var L=x.segmentOrientation,Z=x.segmentOffset;if(isNaN(B)){var Q=k.sa;z=Ma();Q.fw(D,z);var ba=J.allocAt(z[0],z[1]);ba.add(k.i(0)); Q.type===N.j?ba.offset(-Q.startX,-Q.startY):(Q=Q.figures.first(),ba.offset(-Q.startX,-Q.startY));Q=z[2];if(L!==dg){var S=k.computeAngle(x,L,Q);x.Cb=S}S=ba.x-m.x;var P=ba.y-m.y;J.free(ba);Oa(z)}else if(B<-f||B>=f)z=J.alloc(),k.Ug(),k.computeMidPoint(z),Q=k.midAngle,L!==dg&&(S=k.computeAngle(x,L,Q),x.Cb=S),S=z.x-m.x,P=z.y-m.y,J.free(z);else{S=0;0<=B?(P=n.M(B),z=B<f-1?n.M(B+1):P):(S=f+B,P=n.M(S),z=0<S?n.M(S-1):P);if(P.Ya(z)){0<=B?(Q=0<B?n.M(B-1):P,S=B<f-2?n.M(B+2):z):(Q=S<f-1?n.M(S+1):P,S=1<S?n.M(S- 2):z);ba=Q.Lf(P);var xa=z.Lf(S);Q=ba>xa+10?0<=B?Q.Ua(P):P.Ua(Q):xa>ba+10?0<=B?z.Ua(S):S.Ua(z):0<=B?Q.Ua(S):S.Ua(Q)}else Q=0<=B?P.Ua(z):z.Ua(P);L!==dg&&(S=k.computeAngle(x,L,Q),x.Cb=S);S=P.x+(z.x-P.x)*D-m.x;P=P.y+(z.y-P.y)*D-m.y}x.measure(Infinity,Infinity,0,0);z=x.measuredBounds;ba=x.naturalBounds;var ka=0;x instanceof Kf&&(ka=x.strokeWidth);xa=ba.width+ka;var Aa=ba.height+ka;h.reset();h.translate(-z.x,-z.y);h.scale(x.scale,x.scale);h.rotate(L===dg?x.angle:Q,xa/2,Aa/2);L!==Vm&&L!==Wm||h.rotate(90, xa/2,Aa/2);L!==Xm&&L!==Ym||h.rotate(-90,xa/2,Aa/2);L===Zm&&(45<Q&&135>Q||225<Q&&315>Q)&&h.rotate(-Q,xa/2,Aa/2);ba=new M(0,0,xa,Aa);q.yj(ba,F);h.Fa(q);F=-q.x+ka/2*x.scale;x=-q.y+ka/2*x.scale;u.assign(Z);ka=isNaN(Z.x);var Sa=isNaN(Z.y);if(ka||Sa){xa=xa/2+3;Aa=Aa/2+3;var vb=45<=Q&&135>=Q,Xa=225<=Q&&315>=Q;L===dg&&(vb||Xa)?(u.x=Sa?xa:Z.y,u.y=ka?Aa:Z.x,vb?0<=B||isNaN(B)&&.5>D||!ka||(u.y=-Aa):Xa&&((0<=B||isNaN(B)&&.5>D)&&ka&&(u.y=-Aa),Sa&&(u.x=-xa))):(ka&&(u.x=0<=B||isNaN(B)&&.5>D?xa:-xa),Sa&&(u.y=-Aa), u.rotate(Q))}else u.rotate(Q);S+=u.x;P+=u.y;ba.set(z);ba.h(S+F,P+x,z.width,z.height);a.j.push(ba);b.Yc(ba)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.Ig=b;a=a.location;a.h(a.x+b.x,a.y+b.y);bc(e,b.width||0,b.height||0);Fb.free(h);J.free(q);J.free(u)}}}}; Tm.prototype.arrange=function(a,b){var c=b.length;if(a instanceof Le||a instanceof T){var d=null,e=null,f=null;a instanceof T&&(e=d=a);a instanceof Le&&(f=a,d=f.adornedPart);var g=a instanceof Le?null:d.path;if(0!==a.j.length){var h=a.j,k=0;if(null!==g&&k<a.j.length){var l=h[k];k++;g.arrange(l.x-a.Ig.x,l.y-a.Ig.y,l.width,l.height)}for(l=0;l<c;l++){var m=b[l];if(m!==g&&k<a.j.length){var n=h[k];k++;m.arrange(n.x-a.Ig.x,n.y-a.Ig.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof T)for(d= a.labelNodes;d.next();){var p=a;g=d.value;h=g.segmentIndex;k=g.segmentFraction;var r=g.alignmentFocus;l=g.segmentOrientation;m=g.segmentOffset;if(isNaN(h)){n=p.sa;var q=Ma();n.fw(k,q);var u=J.allocAt(q[0],q[1]);u.add(p.i(0));n.type===N.j?u.offset(-n.startX,-n.startY):(n=n.figures.first(),u.offset(-n.startX,-n.startY));n=q[2];l!==dg&&(p=p.computeAngle(g,l,n),g.angle=p);p=u.x;var y=u.y;J.free(u);Oa(q)}else if(h<-c||h>=c)q=J.alloc(),n=p,y=q,n.Ug(),n.computeMidPoint(y),n=p.midAngle,l!==dg&&(p=p.computeAngle(g, l,n),g.angle=p),p=q.x,y=q.y,J.free(q);else{u=0;0<=h?(q=b.l[h],y=h<c-1?b.l[h+1]:q):(u=c+h,q=b.l[u],y=0<u?b.l[u-1]:q);if(q.Ya(y)){0<=h?(n=0<h?b.l[h-1]:q,u=h<c-2?b.l[h+2]:y):(n=u<c-1?b.l[u+1]:q,u=1<u?b.l[u-2]:y);var x=n.Lf(q),z=y.Lf(u);n=x>z+10?0<=h?n.Ua(q):q.Ua(n):z>x+10?0<=h?y.Ua(u):u.Ua(y):0<=h?n.Ua(u):u.Ua(n)}else n=0<=h?q.Ua(y):y.Ua(q);l!==dg&&(p=p.computeAngle(g,l,n),g.angle=p);p=q.x+(y.x-q.x)*k;y=q.y+(y.y-q.y)*k}if(r.Xq())g.location=new J(p,y);else{r.bc()&&(r=Jc);q=Fb.alloc();q.reset();q.scale(g.scale, g.scale);q.rotate(g.angle,0,0);var B=g.naturalBounds;u=M.allocAt(0,0,B.width,B.height);x=J.alloc();x.yj(u,r);q.Fa(x);r=-x.x;z=-x.y;var D=B.width,F=B.height;B=J.alloc();B.assign(m);var L=isNaN(m.x),Z=isNaN(m.y);if(L||Z){D=D/2+3;F=F/2+3;var Q=45<=n&&135>=n,ba=225<=n&&315>=n;l===dg&&(Q||ba)?(B.x=Z?D:m.y,B.y=L?F:m.x,Q?0<=h||isNaN(h)&&.5>k||!L||(B.y=-F):ba&&((0<=h||isNaN(h)&&.5>k)&&L&&(B.y=-F),Z&&(B.x=-D))):(L&&(B.x=0<=h||isNaN(h)&&.5>k?D:-D),Z&&(B.y=-F),B.rotate(n))}else B.rotate(n);p+=B.x;y+=B.y;q.pr(u); r+=u.x;z+=u.y;h=J.allocAt(p+r,y+z);g.move(h);J.free(h);J.free(B);J.free(x);M.free(u);Fb.free(q)}}null!==f?f.Kk(!1):null!==e&&e.Kk(!1)}}; function Um(a,b,c,d){if(!1!==wj(d)){var e=d.strokeWidth;0===e&&a instanceof Le&&a.type===W.Link&&a.adornedObject instanceof Kf&&(e=a.adornedObject.strokeWidth);e*=d.wa;a instanceof T&&null!==a.sa?(a=a.sa.bounds,d.Ge(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof Le&&null!==a.adornedPart.sa?(a=a.adornedPart.sa.bounds,d.Ge(a.x-e/2,a.y-e/2,a.width+e,a.height+e)):d.Ge(-(e/2),-(e/2),b+e,c+e);rj(d,!1)}}function $m(){this.ta="Base"}ma($m,Ul); $m.prototype.measure=function(a,b,c,d,e,f,g){var h=a.wb();a.oh=[];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 M(-k.left,-k.top,Math.max(n.width+l,0),Math.max(n.height+m,0));a.oh.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,y=r.flattenedLengths,x=r.flattenedTotalLength,z=u.length,B=0,D=0,F=Ma(),L=0;L<z;L++){var Z=u[L],Q=[];D=B=0;for(var ba=Z.length,S=0;S<ba;S+=2){var P=Z[S],xa=Z[S+1];if(0!==S){var ka=180*Math.atan2(xa- D,P-B)/Math.PI;0>ka&&(ka+=360);Q.push(ka)}B=P;D=xa}F.push(Q)}if(null===a.ph){for(var Aa=[],Sa=a.$.l,vb=Sa.length,Xa=0;Xa<vb;Xa++){var Ya=Sa[Xa],Kd=[];Aa.push(Kd);if(Ya.visible){var kc=Ya.interval;if(!(0>kc))for(var lc=0;lc<vb;lc++)if(lc!==Xa){var wb=Sa[lc];if(wb.visible&&Ya.constructor===wb.constructor){var Ld=wb.interval;Ld>kc&&Kd.push(Ld)}}}}a.ph=Aa}var sg=a.ph;var tg=a.$.l,Se=tg.length,Vb=0,Dh=0,ug=x;a.Qj=[];for(var Eh,Fh=0;Fh<Se;Fh++){var rb=tg[Fh];Eh=[];if(rb.visible&&rb!==h){var Oi=Math.abs(rb.interval), ok=a.graduatedTickUnit;if(!(2>ok*Oi*x/a.graduatedRange)){var vg=y[0][0],wd=0,yc=0;Dh=x*rb.graduatedStart-1E-4;ug=x*rb.graduatedEnd+1E-4;var Qf=ok*Oi,Gc=a.graduatedTickBase;if(Gc<a.graduatedMin){var wg=(a.graduatedMin-Gc)/Qf;wg=0===wg%1?wg:Math.floor(wg+1);Gc+=wg*Qf}else Gc>a.graduatedMin+Qf&&(Gc-=Math.floor((Gc-a.graduatedMin)/Qf)*Qf);for(var Gh=sg[Fh],Kn=Gc,Td=1;Gc<a.graduatedMax+5E-8;Td++){a:{for(var xe=Gh.length,xg=0;xg<xe;xg++)if(K.da((Gc-a.graduatedTickBase)%(Gh[xg]*a.graduatedTickUnit),0)){var yg= !1;break a}yg=!0}if(yg&&(null===rb.graduatedSkip||!rb.graduatedSkip(Gc))&&(Vb=(Gc-a.graduatedMin)*x/a.graduatedRange,Vb>x&&(Vb=x),Dh<=Vb&&Vb<=ug)){for(var fd=F[wd][yc],ye=y[wd][yc];wd<y.length;){for(;Vb>vg&&yc<y[wd].length-1;)yc++,fd=F[wd][yc],ye=y[wd][yc],vg+=ye;if(Vb<=vg)break;wd++;yc=0;fd=F[wd][yc];ye=y[wd][yc];vg+=ye}var qc=u[wd],Hh=qc[2*yc],Ih=qc[2*yc+1],gd=(Vb-(vg-ye))/ye,Pi=new J(Hh+(qc[2*yc+2]-Hh)*gd+q/2-r.bounds.x,Ih+(qc[2*yc+3]-Ih)*gd+q/2-r.bounds.y);Pi.scale(h.scale,h.scale);var ze=fd, pf=F[wd];1E-4>gd?0<yc?ze=pf[yc-1]:K.da(qc[0],qc[qc.length-2])&&K.da(qc[1],qc[qc.length-1])&&(ze=pf[pf.length-1]):.9999<gd&&(yc+1<pf.length?ze=pf[yc+1]:K.da(qc[0],qc[qc.length-2])&&K.da(qc[1],qc[qc.length-1])&&(ze=pf[0]));fd!==ze&&(180<Math.abs(fd-ze)&&(fd<ze?fd+=360:ze+=360),fd=(fd+ze)/2%360);if(rb instanceof Zg){var Md="";null!==rb.graduatedFunction?(Md=rb.graduatedFunction(Gc),Md=null!==Md&&void 0!==Md?Md.toString():""):Md=(+Gc.toFixed(2)).toString();""!==Md&&Eh.push({Rm:Pi,angle:fd,text:Md})}else Eh.push({Rm:Pi, angle:fd})}Gc=Kn+Td*Qf}}}a.Qj.push(Eh)}Oa(F);var pk=a.Qj;if(null!==pk)for(var Ln=d.length,Rf=0;Rf<Ln;Rf++){var Wb=d[Rf],Ud=pk[Rf];if(Wb.visible&&Wb!==h&&0!==Ud.length){if(Wb instanceof Kf){var xb=a,Qi=e,mc=Wb.alignmentFocus;mc.bc()&&(mc=Ec);var Hc=Wb.angle;Wb.Cb=0;Wb.measure(Infinity,Infinity,0,0);Wb.Cb=Hc;var zc=Wb.measuredBounds,Vd=zc.width,Wd=zc.height,zg=M.allocAt(0,0,Vd,Wd),Oc=J.alloc();Oc.yj(zg,mc);M.free(zg);for(var Jh=-Oc.x,Ag=-Oc.y,Xd=new M,Kh=Ud.length,qf=0;qf<Kh;qf++)for(var Yd=Ud[qf], Zd=Yd.Rm.x,$d=Yd.Rm.y,Te=Yd.angle,Lh=0;4>Lh;Lh++){switch(Lh){case 0:Oc.h(Jh,Ag);break;case 1:Oc.h(Jh+Vd,Ag);break;case 2:Oc.h(Jh,Ag+Wd);break;case 3:Oc.h(Jh+Vd,Ag+Wd)}Oc.rotate(Te+Wb.angle);Oc.offset(Zd,$d);0===qf&&0===Lh?Xd.h(Oc.x,Oc.y,0,0):Xd.Ze(Oc);Oc.offset(-Zd,-$d);Oc.rotate(-Te-Wb.angle)}J.free(Oc);null!==xb.oh&&xb.oh.push(Xd);jc(Qi,Xd.x,Xd.y,Xd.width,Xd.height)}else if(Wb instanceof Zg){var Ae=a,Mn=e;null===Ae.Gh&&(Ae.Gh=new Zg);var rc=Ae.Gh;an(rc,Wb);var bb=Wb.alignmentFocus;bb.bc()&&(bb= Ec);for(var sc=Wb.segmentOrientation,ae=Wb.segmentOffset,Ue=new M,Mh=0,Ve=0,Yc=0,rf=0,Nh=0,Nn=Ud.length,Bg=0;Bg<Nn;Bg++){var xd=Ud[Bg];Mh=xd.Rm.x;Ve=xd.Rm.y;Yc=xd.angle;Nh=rf=Wb.angle;sc!==dg&&(Nh=sc===bn||sc===cn?Yc+Wb.angle:Yc,rf=T.computeAngle(sc,Nh));rc.Cb=rf;rc.text=xd.text||"";rc.measure(Infinity,Infinity,0,0);var be=rc.measuredBounds,Be=rc.naturalBounds,Ce=Be.width,ce=Be.height,De=Fb.alloc();De.reset();De.translate(-be.x,-be.y);De.scale(rc.scale,rc.scale);De.rotate(Nh,Ce/2,ce/2);sc!==Vm&&sc!== Wm||De.rotate(90,Ce/2,ce/2);sc!==Xm&&sc!==Ym||De.rotate(-90,Ce/2,ce/2);sc===Zm&&(45<Yc&&135>Yc||225<Yc&&315>Yc)&&De.rotate(-Yc,Ce/2,ce/2);var qk=M.allocAt(0,0,Ce,ce),We=J.alloc();We.yj(qk,bb);De.Fa(We);var Ri=-We.x,Si=-We.y,yd=J.alloc();yd.assign(ae);isNaN(yd.x)&&(yd.x=Ce/2+3);isNaN(yd.y)&&(yd.y=-(ce/2+3));yd.rotate(Yc);Mh+=yd.x+Ri;Ve+=yd.y+Si;var Sf=new M(Mh,Ve,be.width,be.height),Oh=new M(be.x,be.y,be.width,be.height),Cg=new M(Be.x,Be.y,Be.width,Be.height);xd.OA=rf;xd.lineCount=rc.lineCount;xd.lines= [rc.yb,rc.Ji,rc.ye,rc.Me,rc.Hc,rc.Ub,rc.we];xd.actualBounds=Sf;xd.measuredBounds=Oh;xd.naturalBounds=Cg;0===Bg?Ue.assign(Sf):Ue.Yc(Sf);J.free(yd);J.free(We);M.free(qk);Fb.free(De)}null!==Ae.oh&&Ae.oh.push(Ue);jc(Mn,Ue.x,Ue.y,Ue.width,Ue.height)}rj(Wb,!1)}}}; $m.prototype.arrange=function(a,b,c){if(null!==a.oh){var d=a.wb(),e=a.Qj;if(null!==e){var f=a.oh,g=0,h=f[g];g++;null!==d&&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.oh=null}}}; $m.prototype.rc=function(a,b,c){var d=c.Di;c.Di=!0;var e=a.naturalBounds,f=e.width;e=e.height;b.save();b.beginPath();b.rect(-1,-1,f+1,e+1);b.clip();f=a.wb();f.rc(b,c);e=a.Of()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.$.l,k=a.Qj,l=h.length,m=0;m<l;m++){var n=h[m],p=k[m],r=p.length;if(n.visible&&n!==f&&0!==p.length)if(n instanceof Kf){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,y=n.alignmentFocus;y.bc()&& (y=Ec);for(var x=0;x<r;x++){var z=p[x].Rm,B=p[x].angle,D=y,F=n.vb;F.reset();F.translate(z.x+g.x,z.y+g.y);F.rotate(B+n.angle,0,0);F.translate(-q.width*D.x+D.offsetX+u/2,-q.height*D.y+D.offsetY+u/2);F.scale(n.scale,n.scale);Hl(n,!1);n.ei.set(n.vb);n.ql=n.scale;Il(n,!1);n.rc(b,c);n.vb.reset()}}}else if(n instanceof Zg)for(null===a.Gh&&(a.Gh=new Zg),q=a.Gh,an(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.Zb=u.text||"",q.Cb=u.OA||0,q.ed=u.lineCount||0,y=u.lines,void 0!== y&&(q.yb=y[0],q.Ji=y[1],q.ye=y[2],q.Me=y[3],q.Hc=y[4],q.Ub=y[5],q.we=y[6]),u.naturalBounds&&(q.wc=u.naturalBounds),u.actualBounds&&(y=u.actualBounds,q.arrange(y.x,y.y,y.width,y.height)),y=u.actualBounds,q.arrange(y.x,y.y,y.width,y.height),x=u.measuredBounds,u=u.naturalBounds,z=q.vb,z.reset(),z.translate(y.x+g.x,y.y+g.y),z.translate(-x.x,-x.y),q.eq(z,u.x,u.y,u.width,u.height),Hl(q,!1),q.ei.set(q.vb),q.ql=q.scale,Il(q,!1),q.rc(b,c))}c.Di=d;b.restore();b.Oc(!0)}; function W(a,b){O.call(this);this.na=null;if(void 0===a)this.na=W.Position;else if("string"===typeof a){var c=Tl.K(a);null!==c&&(this.na=c)}else a instanceof Ul?this.na=a:a&&(this.na=W.Position,b=a);null===this.na&&v("Panel type not specified or PanelLayout not loaded: "+a);this.$=new H;this.nb=Ac;this.na===W.Grid&&(this.H|=1048576);this.Vn=ed;this.eg=dl;this.na===W.Table&&dn(this);this.yq=rg;this.wo=Ub;this.xo=Lb;this.to=0;this.so=100;this.vo=10;this.uo=0;this.Zg=this.qb=this.ph=this.oh=this.Qj= null;this.Mo=NaN;this.Ce=this.Hi=null;this.Ll="category";this.ce=null;this.Ig=new M(NaN,NaN,NaN,NaN);this.Gh=this.Tp=this.Xi=null;this.af="";b&&Object.assign(this,b)}ma(W,O);function dn(a){a.Jj=Ac;a.fh=1;a.xi=null;a.wi=null;a.eh=1;a.dh=null;a.vi=null;a.tb=[];a.pb=[];a.jk=en;a.Gj=en;a.$i=0;a.Li=0} W.prototype.cloneProtected=function(a){O.prototype.cloneProtected.call(this,a);a.na=this.na;a.nb=this.nb.L();a.Vn=this.Vn.L();a.eg=this.eg;if(a.na===W.Table){a.Jj=this.Jj.L();a.fh=this.fh;a.xi=this.xi;a.wi=this.wi;a.eh=this.eh;a.dh=this.dh;a.vi=this.vi;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.xj(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.xj(a),b[e]=f);a.pb=b;a.jk= this.jk;a.Gj=this.Gj;a.$i=this.$i;a.Li=this.Li}a.yq=this.yq;a.wo=this.wo.L();a.xo=this.xo.L();a.to=this.to;a.so=this.so;a.vo=this.vo;a.uo=this.uo;a.Qj=this.Qj;a.ph=this.ph;a.qb=this.qb;a.Zg=this.Zg;a.Mo=this.Mo;a.Hi=this.Hi;a.Ce=this.Ce;a.Ll=this.Ll;a.Ig.assign(this.Ig);a.af=this.af;null!==this.Tp&&(a.Tp=this.Tp)};W.prototype.Kf=function(a){O.prototype.Kf.call(this,a);a.$=this.$;for(var b=a.$.l,c=b.length,d=0;d<c;d++)b[d].yg=a;a.Xi=null}; W.prototype.copy=function(){var a=O.prototype.copy.call(this);if(null!==a){for(var b=this.$.l,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.xj(a);e.gk=null;var f=a.$,g=f.count;f.zb(g,e);f=a.part;if(null!==f){f.ck=null;null!==e.portId&&f instanceof V&&(f.Vh=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.ab(ue,"elements",a,null,e,null,g)}}return a}return null};t=W.prototype;t.toString=function(){return"Panel("+this.type.name+")#"+mb(this)}; t.vp=function(a){O.prototype.vp.call(this,a);for(var b=this.$.l,c=b.length,d=0;d<c;d++)b[d].vp(a)}; t.hj=function(a,b){if(this.na===W.Grid)a.ke(),this.na.rc(this,a,b);else if(this.na===W.Graduated)a.ke(),this.na.rc(this,a,b);else{this.na===W.Table&&(a.ke(),a.lineCap="butt",fn(this,a,!0,this.tb,!0),fn(this,a,!1,this.pb,!0),gn(this,a,!0,this.tb),gn(this,a,!1,this.pb),fn(this,a,!0,this.tb,!1),fn(this,a,!1,this.pb,!1));var c=this.isClipping&&this.na===W.Spot;c&&a.save();for(var d=this.wb(),e=this.$.l,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.rc(a,b);c&&h===d&&(a.clipInsteadOfFill= !1)}c&&(a.restore(),a.Oc(!0))}}; function gn(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.fh:a.eh);var n=l.separatorStroke;null===n&&(n=c?a.xi:a.dh);if(0!==m&&null!==n){ri(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.wi:a.vi);null!==p&&(n=!0,b.Kt(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.nb;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.It()}}}} function fn(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.Pc(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.fh:a.eh);var r=l.separatorStroke;null===r&&(r=c?a.xi:a.dh);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.nb,ri(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 bk(a){return"LineV"===a||"BarV"===a} t.Ek=function(a,b,c,d,e){var f=this.pe(),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),r=h*(g.m12*g.dx-g.m11*g.dy);if(null!==this.areaBackground)return g=this.actualBounds,K.Qf(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+r,a=c*k+d*m+p,k=c*l+d*n+r,e.h(0,0),c=this.naturalBounds,f=K.Qf(0,0,c.width,c.height,f,h,a,k,e),e.transform(g),f;f||(k=1,m=l=0,n=1,r=p=0);h=a*k+b*m+p;a=a*l+b* n+r;k=c*k+d*m+p;c=c*l+d*n+r;e.h(k,c);d=(k-h)*(k-h)+(c-a)*(c-a);l=!1;n=this.$.l;r=n.length;m=J.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.na===W.Spot;u&&(q=J.alloc(),p=this.wb(),(l=p.Ek(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var y=0;y<r;y++){var x=n[y];x.visible&&x!==p&&x.Ek(h,a,k,c,m)&&(l=!0,x=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),x<d&&(d=x,e.set(m)))}u&&(b>d&&e.set(q),J.free(q));J.free(m);f&&e.transform(g);return l}; t.v=function(a){if(!wj(this)){O.prototype.v.call(this,a);a=null;if(this.na===W.Auto||this.na===W.Link)a=this.wb();for(var b=this.$.l,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.v(!0);if(!e.desiredSize.s()){var f=rl(e,!1);(e instanceof ng||e instanceof W||e instanceof Zg||f!==pg)&&e.v(!0)}}}};t.Gk=function(){if(!wj(this)){rj(this,!0);sl(this,!0);for(var a=this.$.l,b=a.length,c=0;c<b;c++)a[c].Gk()}}; t.Hl=function(){if(0!==(this.H&2048)===!1){Hl(this,!0);Il(this,!0);for(var a=this.$.l,b=a.length,c=0;c<b;c++)a[c].lw()}};t.lw=function(){Il(this,!0);for(var a=this.$.l,b=a.length,c=0;c<b;c++)a[c].lw()}; t.Om=function(a,b,c,d){var e=this.Ig;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.nb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.$.l;0!==l.length&&this.na.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);bc(e,a,k);bc(this.naturalBounds,a,k);this.Ge(0,0,a,k)};t.wb=function(){if(null===this.Xi){var a=this.$.l,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.Xi=d}this.Xi=a[0]}return this.Xi};function Dm(a){return null!==a.part?a.part.locationObject:null} t.Ph=function(a,b,c,d){var e=this.$.l;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.s()){a=rl(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.uh,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=pg);switch(a){case pg:if(b>c||f>d)this.v(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case Cd:this.v(!0);this.measure(c+h,d+g,0,0);break;case el:this.v(!0);this.measure(c+h,f+g,0,0);break;case fl:this.v(!0),this.measure(b+h,d+g,0,0)}}this.na.arrange(this,e,this.Ig)}}; t.Rh=function(a){var b=this.naturalBounds,c=Dm(this);if(nc(0,0,b.width,b.height,a.x,a.y)){b=this.$.l;for(var d=b.length,e=J.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(Gb(e.set(a),f.transform),f.ca(e))return J.free(e),!0}J.free(e);return null===this.Wb&&null===this.od?!1:!0}return!1};t.Lt=function(a){if(this.dl===a)return this;for(var b=this.$.l,c=b.length,d=0;d<c;d++){var e=b[d].Lt(a);if(null!==e)return e}return null}; t.Uk=function(a,b){b(this,a);if(a instanceof W){a=a.$.l;for(var c=a.length,d=0;d<c;d++)this.Uk(a[d],b)}};function Jj(a,b){hn(a,a,b)}function hn(a,b,c){c(b);b=b.$.l;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof W&&hn(a,f,c)}}function jn(a,b){kn(a,a,b)}function kn(a,b,c){c(b);if(b instanceof W){b=b.$.l;for(var d=b.length,e=0;e<d;e++)kn(a,b[e],c)}}t.Fm=function(a){return ln(this,this,a)}; function ln(a,b,c){if(c(b))return b;if(b instanceof W){b=b.$.l;for(var d=b.length,e=0;e<d;e++){var f=ln(a,b[e],c);if(null!==f)return f}}return null}t.eb=function(a){if(this.name===a)return this;var b=this.$.l,c=b.length;null===this.Hi&&null===this.Ce||(c=mn(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof W){var f=e.eb(a);if(null!==f)return f}if(e.name===a)return e}return null}; function nn(a){a=a.$.l;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof W?c=Math.max(c,nn(e)):e instanceof Kf&&(c=Math.max(c,e.Gg/2*e.mk*e.Of()))}return c}t.pe=function(){return!(this.type===W.TableRow||this.type===W.TableColumn)}; t.ac=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(xj(this))return null;var d=this.naturalBounds,e=1/this.Of(),f=this.pe(),g=f?a:Gb(J.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.Im("extraTouchArea"),l=k/2);if(nc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.$.l;var m=e.length;h=J.alloc();l=(k=this.isClipping&&this.na===W.Spot)?this.wb():null;if(k&&(l.pe()?Gb(h.set(a),l.transform):h.set(a),!l.ca(h)))return J.free(h), f||J.free(g),null;for(var n=Dm(this);m--;){var p=e[m];if(p.visible||p===n)if(p.pe()?Gb(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof W?r=p.ac(h,b,c):!0===p.pickable&&p.ca(h)&&(r=p);if(null!==r&&(null!==b&&(r=b(r)),null!==r&&(null===c||c(r))))return J.free(h),f||J.free(g),r}}J.free(h)}if(null===this.background&&null===this.areaBackground)return f||J.free(g),null;a=nc(0,0,d.width,d.height,g.x,g.y)?this:null;f||J.free(g);return a}f||J.free(g);return null}; t.lj=function(a,b,c,d){if(!1===this.pickable)return!1;void 0===b&&(b=null);void 0===c&&(c=null);var e=this.naturalBounds,f=this.pe(),g=f?a:Gb(J.allocAt(a.x,a.y),this.transform),h=this.type===W.TableRow||this.type===W.TableColumn;e=nc(0,0,e.width,e.height,g.x,g.y);if(h||e){if(!this.isAtomic){h=this.$.l;for(var k=h.length,l=J.alloc(),m=Dm(this);k--;){var n=h[k];if(n.visible||n===m){n.pe()?Gb(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof W?n:null;(null!==n?n.lj(l,b,c,d):p.ca(l))&&!1!==p.pickable&& (null!==b&&(p=b(p)),null===p||null!==c&&!c(p)||d.add(p))}}J.free(l)}f||J.free(g);return e&&(null!==this.background||null!==this.areaBackground)}f||J.free(g);return!1}; t.Nf=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=Fb.alloc(),g.reset());g.multiply(this.transform);if(this.Qh(a,g))return on(this,b,c,e),void 0===f&&Fb.free(g),!0;if(this.Tc(a,g)){if(!this.isAtomic)for(var h=Dm(this),k=this.$.l,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=Fb.alloc();p.set(g); if(null!==m?m.Nf(a,b,c,d,e,p):ql(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);Fb.free(p)}}}void 0===f&&Fb.free(g);return d}void 0===f&&Fb.free(g);return!1};function on(a,b,c,d){for(var e=a.$.l,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&&on(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}} t.Og=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.pe(),k=h?a:Gb(J.allocAt(a.x,a.y),this.transform),l=h?b:Gb(J.allocAt(b.x,b.y),this.transform),m=k.Lf(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||Hb(k.x,k.y,0,0,0,g.height)<=m||Hb(k.x,k.y,0,g.height,g.width,g.height)<=m||Hb(k.x,k.y,g.width,g.height,g.width,0)<=m||Hb(k.x,k.y,g.width,0,0,0)<=m;g=k.vd(0,0)<=m&&k.vd(0,g.height)<=m&&k.vd(g.width,0)<=m&&k.vd(g.width,g.height)<= m;h||(J.free(k),J.free(l));if(n){if(!this.isAtomic){k=J.alloc();l=J.alloc();m=Dm(this);for(var p=this.$.l,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,y=this.naturalBounds;if(!h||!(u.x>y.width||u.y>y.height||0>u.x+u.width||0>u.y+u.height))if(q.pe()?(u=q.transform,Gb(k.set(a),u),Gb(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof W?q:null,null!==q?q.Og(k,l,c,d,e,f):u.wy(k,l,e))null!==c&&(u=c(u)),null===u||null!==d&&!d(u)||f.add(u)}}J.free(k);J.free(l)}return e?n:g}return!1}; function Jm(a){var b=null;a instanceof Kf&&(b=a.spot1,b===ed&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=Dc);return b}function Km(a){var b=null;a instanceof Kf&&(b=a.spot2,b===ed&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Nc);return b}t.add=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];for(c=0;c<b.length;c++)this.zb(this.$.count,b[c]);return this};t.M=function(a){return this.$.M(a)}; t.zb=function(a,b){b instanceof U&&v("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.Qg(b))this===b&&v("Cannot make a Panel contain itself: "+this.toString()),v("Cannot make a Panel indirectly contain itself: "+this.toString()+" already contains "+b.toString());var c=b.panel;null!==c&&c!==this&&v("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.na!==W.Grid||b instanceof Kf||v("Can only add Shapes to a Grid Panel, not: "+b);this.na!==W.Graduated||b instanceof Kf||b instanceof Zg||v("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.xj(this);b.gk=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.ce&&(this.ce=new zb),this.ce.add(d,b))}var e=this.$;d=-1;if(c===this){for(var f=-1,g=this.$.l,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.kb(f);d=f}else v("element "+b.toString()+" has panel "+c.toString()+" but is not contained by it.")}if(0>a||a>e.count)a=e.count;e.zb(a,b);if(0===a||b.isPanelMain)this.Xi=null;wj(this)||this.v();b.v(!1);null!==b.portId?this.Vh=!0:b instanceof W&&!0===b.Vh&&(this.Vh=!0);this.ph=null;c=this.part;null!==c&&(c.ck=null,c.vh=NaN,this.Vh&&c instanceof V&&(c.Vh=!0),c.Vh&&c instanceof V&&(c.zc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.ab(ve,"elements",this,b,null,d,null),c.ab(ue, "elements",this,null,b,null,a),this.Rg()||pn(this,b,!1)))};function qn(a,b){a.H=b?a.H|16777216:a.H&-16777217}t.remove=function(a){w(a,O,W,"remove:element");for(var b=this.$.l,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.Sc(d,!0)};t.kb=function(a){G&&C(a,W,"removeAt:idx");0<=a&&this.Sc(a,!0)}; t.Sc=function(a,b){var c=this.$,d=c.M(a);d.gk=null;d.xj(null);if(null!==this.ce){var e=d.data;"object"===typeof e&&this.ce.remove(e)}c.kb(a);rj(this,!1);this.v();this.Xi===d&&(this.Xi=null);this.ph=null;var f=this.part;null!==f&&(f.ck=null,f.vh=NaN,f.Qb(),f instanceof V&&(d instanceof W?d.Uk(d,function(a,c){Yl(f,c,b)}):Yl(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.ab(ve,"elements",this,d,null,a,null))}; W.prototype.getRowDefinition=function(a){G&&C(a,W,"getRowDefinition:idx");0>a&&Ba(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 Xj;c.xj(this);c.isRow=!0;c.index=a;b[a]=c;this.ab(ue,"rowdefs",this,null,c,null,a)}return b[a]}; W.prototype.iB=function(a){G&&C(a,W,"removeRowDefinition:idx");0>a&&Ba(a,">= 0",W,"removeRowDefinition:idx");a=Math.round(a);var b=this.tb;if(void 0!==b){var c=b[a];if(c){b[a]=void 0;for(var d=b.length-1;0<=d&&void 0===b[d--];)b.length--;this.ab(ve,"rowdefs",this,c,null,a,null);this.v()}}};function Yj(a,b,c){var d=a.tb;if(d&&!(0>b)){d[b]=c instanceof Xj?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.v()}} W.prototype.getColumnDefinition=function(a){G&&C(a,W,"getColumnDefinition:idx");0>a&&Ba(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 Xj;c.xj(this);c.isRow=!1;c.index=a;b[a]=c;this.ab(ue,"coldefs",this,null,c,null,a)}return b[a]};t=W.prototype; t.dB=function(a){G&&C(a,W,"removeColumnDefinition:idx");0>a&&Ba(a,">= 0",W,"removeColumnDefinition:idx");a=Math.round(a);var b=this.pb;if(void 0!==b){var c=b[a];if(c){b[a]=void 0;for(var d=b.length-1;0<=d&&void 0===b[d--];)b.length--;this.ab(ve,"coldefs",this,c,null,a,null);this.v()}}};function Zj(a,b,c){var d=a.pb;if(d&&!(0>b)){d[b]=c instanceof Xj?c:void 0;if(!c)for(b=d.length-1;0<=b&&void 0===d[b--];)d.length--;a.v()}} t.kA=function(a){if(0>a||this.type!==W.Table)return-1;for(var b=0,c=this.tb,d=c.length,e=this.$i;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.cA=function(a){if(0>a||this.type!==W.Table)return-1;for(var b=0,c=this.pb,d=c.length,e=this.Li;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e}; t.BA=function(a,b){void 0===b&&(b=new J(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.wb();c.geometry.ew((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.Fa(b)};t.CA=function(a){if(this.type!==W.Graduated)return NaN;var b=this.wb();b.transform.Md(a);return b.geometry.Ay(a)*this.graduatedRange+this.graduatedMin};function Pl(a){a=a.Zg;return null!==a&&a.u} function og(a){var b=a.Zg;if(null===b)null!==a.data&&v("Template cannot have .data be non-null: "+a),a.Zg=b=new H;else if(b.u)return;var c=new H;qn(a,!1);a.Uk(a,function(a,d){var e=d.lb;if(null!==e)for(Ml(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===rn&&Ml(d,!0);var g=f.sourceName;null!==g&&("/"===g&&qn(a,!0),g=pl(f,a,d),null!==g&&(c.add(g),null===g.mm&&(g.mm=new H),g.mm.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.lb)for(var h=g.lb.iterator;h.next();){var k=h.value;k.ud=g;k.qq=2;k.sm=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.lb)for(g=f.lb.iterator;g.next();)h=g.value,h.ud=f,h.qq=1,h.sm=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.mm){Ml(e,!0);for(var f=e.mm.iterator;f.next();){var g=f.value;null===e.lb&&(e.lb=new H);e.lb.add(g)}}e.mm=null}for(var h=b.iterator;h.next();)if(d=h.value,e=d.ud,null!==e){d.ud=null; g=d.targetProperty;var k=g.indexOf(".");0<k&&e instanceof W&&(f=g.substring(0,k),g=g.substr(k+1),k=e.eb(f),null!==k?(e=k,d.targetProperty=g):Fa('Warning: unable to find GraphObject named "'+f+'" for Binding: '+d.toString()));e instanceof Xj?(f=mb(e.panel),d.Cj=void 0===f?-1:f,e.panel.dl=d.Cj):e instanceof O?(f=mb(e),d.Cj=void 0===f?-1:f,e.dl=d.Cj):v("Unknown type of binding target: "+e)}b.freeze();a instanceof U&&(a.Uc()&&a.Xa(),G&&!sn&&a.Uk(a,function(a,c){if(c instanceof W&&(c.type===W.Auto||c.type=== W.Spot||c.type===W.Graduated)&&1>=c.elements.count&&!(c instanceof U)){var d=!1;if(1===c.elements.count&&(d=null!==c.itemArray,!d))for(h=b.iterator;h.next();)if("itemArray"===h.value.targetProperty){d=!0;break}d||(Fa("Auto, Spot, or Graduated Panel should not have zero or one elements: "+c.toString()+" in "+a.toString()),sn=!0)}}))} t.Oz=function(a){void 0===a&&(a=!1);var b=this.copy();jn(b,function(a){a instanceof W&&(a.Zg=null,a.qb=null);var b=a.lb;null!==b&&(a.lb=null,b.each(function(b){a.bind(b.copy())}));b=a.Wg;null!==b&&(a.Wg=null,b.each(function(b){a.Sw(b.value.copy())}))});a&&og(b);return b}; t.Ia=function(a){var b=this.Zg;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)if(""===e)d=this;else if("/"===e)d=this;else if("."===e)d=this;else if(".."===e)d=this;else{if(d=this.eb(e),null===d){G&&Fa("Binding error: missing GraphObject named "+e+" in "+this.toString());continue}}else if(c.isToModel)if(d=this.diagram,null!==d)d=d.model.modelData; else continue;var f=this,g=c.Cj;if(-1!==g){if(f=this.Lt(g),null===f)continue}else null!==c.ud&&(f=c.ud);"/"===e?d=f.part:"."===e?d=f:".."===e&&(d=f.panel);e=c.qq;if(0!==e){if(!(f instanceof W))continue;1===e?f=f.getColumnDefinition(c.sm):2===e&&(f=f.getRowDefinition(c.sm))}void 0!==f&&c.Vw(f,d)}}}; function tn(a,b){a=a.$.l;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 mn(a){if(a.type===W.Spot||a.type===W.Auto)return Math.min(a.$.length,1);if(a.type===W.Link){a=a.$;for(var b=a.length,c=0;c<b;c++){var d=a.M(c);if(!(d instanceof Kf&&d.isPanelMain))break}return c}return a.type===W.Table&&0<a.$.length&&(a=a.$.M(0),a.isPanelMain&&a instanceof W&&(a.type===W.TableRow||a.type===W.TableColumn))?1:0}t.ku=function(){for(var a=mn(this);this.$.length>a;)this.Sc(this.$.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;c<b;c++)un(this,a[c],c)}; t.vy=function(a){if(void 0===a||null===a||null===this.ce)return null;A(a,"object",W,"findItemPanelForData");return this.ce.K(a)}; function un(a,b,c){if(!(void 0===b||null===b||0>c)){var d=vn(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.K(d));null===f&&(null!==e&&(f=e.K("")),null===f&&(wn||(wn=!0,Fa('No item template Panel found for category "'+d+'" on '+a),Fa(" Using default item template."),d=new W,e=new Zg,e.bind(new Li("text","",Qa)),d.add(e),xn=d),f=xn));d=f;null!==d&&(og(d),d=d.copy(),0!==(d.H&16777216)&&(e=a.jj(),null!==e&&qn(e,!0)),"object"===typeof b&&(null===a.ce&&(a.ce=new zb),a.ce.add(b,d)),e=c+mn(a),a.zb(e,d), d.qb=b,yn(a,e,c),d.qb=null,d.data=b)}}function yn(a,b,c){for(a=a.$;b<a.length;){var d=a.M(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 vn(a,b){if(null===b)return"";a=a.Ll;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=zn(b,a)}else return"";if(void 0===a)return"";if("string"===typeof a)return a;v("Panel.getCategoryForItemData found a non-string category for "+b+": "+a)}function pn(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof W){b=b.$.l;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof W&&!f.isEnabled||pn(a,f,c)}}} function An(a,b){b.name=a;Tl.add(a,b)} na.Object.defineProperties(W.prototype,{type:{configurable:!0,get:function(){return this.na},set:function(a){var b=this.na;b!==a&&(this.na=a,this.na===W.Grid?this.isAtomic=!0:this.na===W.Table&&dn(this),this.v(),this.g("type",b,a))}},elements:{configurable:!0,get:function(){return this.$.iterator}},naturalBounds:{configurable:!0,get:function(){return this.wc}},padding:{configurable:!0,get:function(){return this.nb},set:function(a){"number"=== typeof a?(0>a&&Ba(a,">= 0",W,"padding"),a=new gc(a)):(w(a,gc,W,"padding"),0>a.left&&Ba(a.left,">= 0",W,"padding:value.left"),0>a.right&&Ba(a.right,">= 0",W,"padding:value.right"),0>a.top&&Ba(a.top,">= 0",W,"padding:value.top"),0>a.bottom&&Ba(a.bottom,">= 0",W,"padding:value.bottom"));var b=this.nb;b.B(a)||(this.nb=a=a.L(),this.v(),this.g("padding",b,a))}},defaultAlignment:{configurable:!0,get:function(){return this.Vn},set:function(a){var b=this.Vn;b.B(a)||(G&&w(a,Eb,W,"defaultAlignment"), this.Vn=a=a.L(),this.v(),this.g("defaultAlignment",b,a))}},defaultStretch:{configurable:!0,get:function(){return this.eg},set:function(a){var b=this.eg;b!==a&&(eb(a,O,W,"defaultStretch"),this.eg=a,this.v(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{configurable:!0,get:function(){return void 0===this.Jj?Ac:this.Jj},set:function(a){if(void 0!==this.Jj){"number"===typeof a?a=new gc(a):G&&w(a,gc,W,"defaultSeparatorPadding");var b=this.Jj;b.B(a)||(this.Jj=a=a.L(), this.v(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{configurable:!0,get:function(){return void 0===this.xi?null:this.xi},set:function(a){var b=this.xi;b!==a&&(null===a||"string"===typeof a||a instanceof wl)&&(a instanceof wl&&a.freeze(),this.xi=a,this.R(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{configurable:!0,get:function(){return void 0===this.fh?1:this.fh},set:function(a){if(void 0!==this.fh){var b=this.fh; b!==a&&isFinite(a)&&0<=a&&(this.fh=a,this.v(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.wi?null:this.wi},set:function(a){if(void 0!==this.wi){var b=this.wi;if(b!==a){null===a||Array.isArray(a)||za(a,"Array",W,"defaultRowSeparatorDashArray:value");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)||v("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.wi=a;this.R();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{configurable:!0,get:function(){return void 0===this.dh?null:this.dh},set:function(a){if(void 0!==this.dh){var b=this.dh;b!==a&&(null===a||"string"===typeof a||a instanceof wl)&&(a instanceof wl&&a.freeze(),this.dh=a,this.R(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{configurable:!0, enumerable:!0,get:function(){return void 0===this.eh?1:this.eh},set:function(a){if(void 0!==this.eh){var b=this.eh;b!==a&&isFinite(a)&&0<=a&&(this.eh=a,this.v(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.vi?null:this.vi},set:function(a){if(void 0!==this.vi){var b=this.vi;if(b!==a){null===a||Array.isArray(a)||za(a,"Array",W,"defaultColumnSeparatorDashArray:value");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)||v("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.vi=a;this.R();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{configurable:!0,get:function(){return this.yq},set:function(a){var b=this.yq;b!==a&&(eb(a,O,W,"viewboxStretch"),this.yq=a,this.v(),this.g("viewboxStretch",b,a))}},gridCellSize:{configurable:!0, enumerable:!0,get:function(){return this.wo},set:function(a){var b=this.wo;if(!b.B(a)){w(a,Db,W,"gridCellSize");a.s()&&0!==a.width&&0!==a.height||v("Invalid Panel.gridCellSize: "+a);this.wo=a.L();var c=this.diagram;null!==c&&this===c.grid&&sj(c);this.R();this.g("gridCellSize",b,a)}}},gridOrigin:{configurable:!0,get:function(){return this.xo},set:function(a){var b=this.xo;if(!b.B(a)){w(a,J,W,"gridOrigin");a.s()||v("Invalid Panel.gridOrigin: "+a);this.xo=a.L();var c=this.diagram;null!== c&&this===c.grid&&sj(c);this.R();this.g("gridOrigin",b,a)}}},graduatedMin:{configurable:!0,get:function(){return this.to},set:function(a){C(a,W,"graduatedMin");var b=this.to;b!==a&&(this.to=a,this.v(),this.g("graduatedMin",b,a),nl(this)&&(a=this.part,null!==a&&ol(this,a,"graduatedRange")))}},graduatedMax:{configurable:!0,get:function(){return this.so},set:function(a){C(a,W,"graduatedMax");var b=this.so;b!==a&&(this.so=a,this.v(),this.g("graduatedMax",b,a),nl(this)&&(a= this.part,null!==a&&ol(this,a,"graduatedRange")))}},graduatedRange:{configurable:!0,get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{configurable:!0,get:function(){return this.vo},set:function(a){C(a,W,"graduatedTickUnit");var b=this.vo;b!==a&&0<a&&(this.vo=a,this.v(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{configurable:!0,get:function(){return this.uo},set:function(a){C(a,W,"graduatedTickBase");var b=this.uo;b!== a&&(this.uo=a,this.v(),this.g("graduatedTickBase",b,a))}},Vh:{configurable:!0,get:function(){return 0!==(this.H&8388608)},set:function(a){0!==(this.H&8388608)!==a&&(this.H^=8388608)}},rowCount:{configurable:!0,get:function(){return void 0===this.tb?0:this.tb.length}},columnCount:{configurable:!0,get:function(){return void 0===this.pb?0:this.pb.length}},rowSizing:{configurable:!0,get:function(){return void 0===this.jk?en:this.jk},set:function(a){if(void 0!== this.jk){var b=this.jk;b!==a&&(G&&a!==en&&a!==Nm&&v("Panel.rowSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.jk=a,this.v(),this.g("rowSizing",b,a))}}},columnSizing:{configurable:!0,get:function(){return void 0===this.Gj?en:this.Gj},set:function(a){if(void 0!==this.Gj){var b=this.Gj;b!==a&&(G&&a!==en&&a!==Nm&&v("Panel.columnSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.Gj=a,this.v(),this.g("columnSizing", b,a))}}},topIndex:{configurable:!0,get:function(){return void 0===this.$i?0:this.$i},set:function(a){if(void 0!==this.$i){var b=this.$i;b!==a&&((!isFinite(a)||0>a)&&v("Panel.topIndex must be greater than zero and a real number, not: "+a),this.$i=a,this.v(),this.g("topIndex",b,a))}}},leftIndex:{configurable:!0,get:function(){return void 0===this.Li?0:this.Li},set:function(a){if(void 0!==this.Li){var b=this.Li;b!==a&&((!isFinite(a)||0>a)&&v("Panel.leftIndex must be greater than zero and a real number, not: "+ a),this.Li=a,this.v(),this.g("leftIndex",b,a))}}},data:{configurable:!0,get:function(){return this.qb},set:function(a){var b=this.qb;if(b!==a){var c=this instanceof U&&!(this instanceof Le);c&&A(a,"object",W,"data");og(this);this.qb=a;var d=this.diagram;null!==d&&(c?(c=d.partManager,this instanceof T?(null!==b&&c.df.remove(b),null!==a&&c.df.add(a,this)):this instanceof U&&(null!==b&&c.ef.remove(b),null!==a&&c.ef.add(a,this))):(c=this.panel,null!==c&&null!==c.ce&&(null!==b&&c.ce.remove(b), null!==a&&c.ce.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ia()}}},itemIndex:{configurable:!0,get:function(){return this.Mo},set:function(a){var b=this.Mo;b!==a&&(this.Mo=a,this.g("itemIndex",b,a))}},itemArray:{configurable:!0,get:function(){return this.Hi},set:function(a){var b=this.Hi;if(b!==a||null!==a&&tn(this,a)){G&&null!==a&&!Ha(a)&&v("Panel.itemArray must be an Array-like object or null, not: "+a);var c=this.diagram; b!==a&&(null!==c&&null!==b&&Oj(c.partManager,this,c),this.Hi=a,null!==c&&null!==a&&Lj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.ku()}}},itemTemplate:{configurable:!0,get:function(){return null===this.Ce?null:this.Ce.K("")},set:function(a){if(null===this.Ce){if(null===a)return;this.Ce=new zb}var b=this.Ce.K("");b!==a&&(w(a,W,W,"itemTemplate"),(a instanceof U||a.isPanelMain)&&v("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+ a),this.Ce.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.ku())}},itemTemplateMap:{configurable:!0,get:function(){return this.Ce},set:function(a){var b=this.Ce;if(b!==a){w(a,zb,W,"itemTemplateMap");for(var c=a.iterator;c.next();){var d=c.value;G&&(d instanceof U||d.isPanelMain)&&v("Template in Panel.itemTemplateMap must not be a Part or be Panel.isPanelMain: "+d)}this.Ce=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing|| this.ku()}}},itemCategoryProperty:{configurable:!0,get:function(){return this.Ll},set:function(a){var b=this.Ll;b!==a&&("string"!==typeof a&&"function"!==typeof a&&za(a,"string or function",W,"itemCategoryProperty"),this.Ll=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{configurable:!0,get:function(){return 0!==(this.H&1048576)},set:function(a){var b=0!==(this.H&1048576);b!==a&&(A(a,"boolean",W,"isAtomic"),this.H^=1048576,this.g("isAtomic",b,a))}},isClipping:{configurable:!0, enumerable:!0,get:function(){return 0!==(this.H&2097152)},set:function(a){var b=0!==(this.H&2097152);b!==a&&(G&&(A(a,"boolean",W,"isClipping"),!a||this.type===W.Spot||this instanceof yf||Fa("Warning: Panel.isClipping set on non-Spot Panel: "+this.toString())),this.H^=2097152,this instanceof yf&&(this.hb=null),this.v(),this.g("isClipping",b,a))}},isOpposite:{configurable:!0,get:function(){return 0!==(this.H&33554432)},set:function(a){var b=0!==(this.H&33554432);b!==a&&(A(a,"boolean", W,"isOpposite"),this.H^=33554432,this.v(),this.g("isOpposite",b,a))}},isEnabled:{configurable:!0,get:function(){return 0!==(this.H&4194304)},set:function(a){var b=0!==(this.H&4194304);if(b!==a){A(a,"boolean",W,"isEnabled");var c=null===this.panel||this.panel.Rg();this.H^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&pn(this,this,a)}}},alignmentFocusName:{configurable:!0,get:function(){return this.af},set:function(a){var b=this.af; b!==a&&(G&&A(a,"string",W,"alignmentFocusName"),this.af=a,this.v(),this.g("alignmentFocusName",b,a))}}}); na.Object.defineProperties(W,{Position:{configurable:!0,get:function(){return Tl.K("Position")}},Horizontal:{configurable:!0,get:function(){return Tl.K("Horizontal")}},Vertical:{configurable:!0,get:function(){return Tl.K("Vertical")}},Spot:{configurable:!0,get:function(){return Tl.K("Spot")}},Auto:{configurable:!0,get:function(){return Tl.K("Auto")}},Table:{configurable:!0,get:function(){return Tl.K("Table")}},Viewbox:{configurable:!0, enumerable:!0,get:function(){return Tl.K("Viewbox")}},TableRow:{configurable:!0,get:function(){return Tl.K("TableRow")}},TableColumn:{configurable:!0,get:function(){return Tl.K("TableColumn")}},Link:{configurable:!0,get:function(){return Tl.K("Link")}},Grid:{configurable:!0,get:function(){return Tl.K("Grid")}},Graduated:{configurable:!0,get:function(){return Tl.K("Graduated")}}});W.prototype.findItemPanelForData=W.prototype.vy; W.prototype.rebuildItemElements=W.prototype.ku;W.prototype.updateTargetBindings=W.prototype.Ia;W.prototype.copyTemplate=W.prototype.Oz;W.prototype.graduatedValueForPoint=W.prototype.CA;W.prototype.graduatedPointForValue=W.prototype.BA;W.prototype.findColumnForLocalX=W.prototype.cA;W.prototype.findRowForLocalY=W.prototype.kA;W.prototype.removeColumnDefinition=W.prototype.dB;W.prototype.removeRowDefinition=W.prototype.iB;W.prototype.removeAt=W.prototype.kb;W.prototype.remove=W.prototype.remove; W.prototype.insertAt=W.prototype.zb;W.prototype.elt=W.prototype.M;W.prototype.add=W.prototype.add;W.prototype.findObject=W.prototype.eb;W.prototype.findInVisualTree=W.prototype.Fm;W.prototype.walkVisualTreeFrom=W.prototype.Uk;W.prototype.findMainElement=W.prototype.wb;var sn=!1,wn=!1,xn=null,Tl=new zb;W.className="Panel";W.definePanelLayout=An;An("Position",new Cm);An("Vertical",new Fm);An("Auto",new Im);An("Link",new Tm); function Xj(){cb(this);this.yg=null;this.ts=!0;this.Wa=0;this.Gd=NaN;this.ak=0;this.$j=Infinity;this.Bb=ed;this.oa=this.gc=this.ra=0;this.lb=null;this.hq=Bn;this.Pe=dl;this.bq=this.Cg=null;this.cq=NaN;this.Wb=this.lk=null;this.Rn=!1} Xj.prototype.copy=function(){var a=new Xj;a.ts=this.ts;a.Wa=this.Wa;a.Gd=this.Gd;a.ak=this.ak;a.$j=this.$j;a.Bb=this.Bb;a.ra=this.ra;a.gc=this.gc;a.oa=this.oa;a.Pe=this.Pe;a.hq=this.hq;null===this.Cg?a.Cg=null:a.Cg=this.Cg.L();a.bq=this.bq;a.cq=this.cq;a.lk=null;null!==this.lk&&(a.separatorDashArray=Ja(this.separatorDashArray));a.Wb=this.Wb;a.Rn=this.Rn;a.lb=this.lb;return a};t=Xj.prototype;t.ob=function(a){a.classType===Xj?this.sizing=a:Ea(this,a)}; t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+mb(this)};t.xj=function(a){this.yg=a}; t.Pv=function(){var a=0,b=0,c=this.yg,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.Cg;if(null===b)if(null!==c)b= c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)}; t.Pc=function(){var a=0,b=this.yg,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.Cg;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.Hb=function(a,b,c){var d=this.yg;if(null!==d&&(d.ab(se,a,this,b,c,void 0,void 0),null!==this.lb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.jj(),null!==d&&(b=d.data,null!==b)))))for(c=this.lb.iterator;c.next();)c.value.sr(this,b,a,d)};function Mm(a){if(a.sizing===Bn){var b=a.yg;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing} t.bind=function(a,b,c,d){var e=null;"string"===typeof a?e=new Li(a,b,c,d):e=a;e.ud=this;a=this.panel;null!==a&&(b=a.jj(),null!==b&&Pl(b)&&v("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+e+" on "+a));null===this.lb&&(this.lb=new H);this.lb.add(e);return this}; na.Object.defineProperties(Xj.prototype,{panel:{configurable:!0,get:function(){return this.yg}},isRow:{configurable:!0,get:function(){return this.ts},set:function(a){this.ts=a}},index:{configurable:!0,get:function(){return this.Wa},set:function(a){this.Wa=a}},height:{configurable:!0,get:function(){return this.Gd},set:function(a){var b=this.Gd;b!==a&&(G&&A(a,"number",Xj,"height"),0>a&&Ba(a,">= 0",Xj,"height"),this.Gd=a,this.actual=this.ra,null!== this.panel&&this.panel.v(),this.Hb("height",b,a))}},width:{configurable:!0,get:function(){return this.Gd},set:function(a){var b=this.Gd;b!==a&&(G&&A(a,"number",Xj,"width"),0>a&&Ba(a,">= 0",Xj,"width"),this.Gd=a,this.actual=this.ra,null!==this.panel&&this.panel.v(),this.Hb("width",b,a))}},minimum:{configurable:!0,get:function(){return this.ak},set:function(a){var b=this.ak;b!==a&&(G&&A(a,"number",Xj,"minimum"),(0>a||!isFinite(a))&&Ba(a,">= 0",Xj,"minimum"),this.ak=a,this.actual= this.ra,null!==this.panel&&this.panel.v(),this.Hb("minimum",b,a))}},maximum:{configurable:!0,get:function(){return this.$j},set:function(a){var b=this.$j;b!==a&&(G&&A(a,"number",Xj,"maximum"),0>a&&Ba(a,">= 0",Xj,"maximum"),this.$j=a,this.actual=this.ra,null!==this.panel&&this.panel.v(),this.Hb("maximum",b,a))}},alignment:{configurable:!0,get:function(){return this.Bb},set:function(a){var b=this.Bb;b.B(a)||(G&&w(a,Eb,Xj,"alignment"),this.Bb=a.L(),null!==this.panel&&this.panel.v(), this.Hb("alignment",b,a))}},stretch:{configurable:!0,get:function(){return this.Pe},set:function(a){var b=this.Pe;b!==a&&(G&&eb(a,O,Xj,"stretch"),this.Pe=a,null!==this.panel&&this.panel.v(),this.Hb("stretch",b,a))}},separatorPadding:{configurable:!0,get:function(){return this.Cg},set:function(a){"number"===typeof a?a=new gc(a):null!==a&&G&&w(a,gc,Xj,"separatorPadding");var b=this.Cg;null!==a&&null!==b&&b.B(a)||(null!==a&&(a=a.L()),this.Cg=a,null!==this.panel&&this.panel.v(), this.Hb("separatorPadding",b,a))}},separatorStroke:{configurable:!0,get:function(){return this.bq},set:function(a){var b=this.bq;b!==a&&(null!==a&&Xl(a,"RowColumnDefinition.separatorStroke"),a instanceof wl&&a.freeze(),this.bq=a,null!==this.panel&&this.panel.v(),this.Hb("separatorStroke",b,a))}},separatorStrokeWidth:{configurable:!0,get:function(){return this.cq},set:function(a){var b=this.cq;b!==a&&(this.cq=a,null!==this.panel&&this.panel.v(),this.Hb("separatorStrokeWidth", b,a))}},separatorDashArray:{configurable:!0,get:function(){return this.lk},set:function(a){var b=this.lk;if(b!==a){null===a||Array.isArray(a)||za(a,"Array",Xj,"separatorDashArray:value");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)||v("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.lk=a;null!==this.panel&&this.panel.R();this.Hb("separatorDashArray", b,a)}}},background:{configurable:!0,get:function(){return this.Wb},set:function(a){var b=this.Wb;b!==a&&(null!==a&&Xl(a,"RowColumnDefinition.background"),a instanceof wl&&a.freeze(),this.Wb=a,null!==this.panel&&this.panel.R(),this.Hb("background",b,a))}},coversSeparators:{configurable:!0,get:function(){return this.Rn},set:function(a){var b=this.Rn;b!==a&&(A(a,"boolean",Xj,"coversSeparators"),this.Rn=a,null!==this.panel&&this.panel.R(),this.Hb("coversSeparators",b,a))}}, sizing:{configurable:!0,get:function(){return this.hq},set:function(a){var b=this.hq;b!==a&&(G&&eb(a,Xj,Xj,"sizing"),this.hq=a,null!==this.panel&&this.panel.v(),this.Hb("sizing",b,a))}},actual:{configurable:!0,get:function(){return this.ra},set:function(a){this.ra=isNaN(this.Gd)?Math.max(Math.min(this.$j,a),this.ak):Math.max(Math.min(this.$j,this.Gd),this.ak)}},measured:{configurable:!0,get:function(){return this.gc},set:function(a){this.gc=a}},total:{configurable:!0, enumerable:!0,get:function(){return this.ra+this.Pc()}},position:{configurable:!0,get:function(){return this.oa},set:function(a){this.oa=a}}});Xj.prototype.computeEffectiveSpacing=Xj.prototype.Pc;Xj.prototype.computeEffectiveSpacingTop=Xj.prototype.Pv;var Bn=new E(Xj,"Default",0),Nm=new E(Xj,"None",1),en=new E(Xj,"ProportionalExtra",2);Xj.className="RowColumnDefinition";Xj.Default=Bn;Xj.None=Nm;Xj.ProportionalExtra=en; function Kf(a,b){O.call(this);this.Jd=this.sa=null;this.io="None";this.qo=dl;this.Mc=this.tl="black";this.Gg=1;this.om="butt";this.pm="miter";this.mk=10;this.Ch=null;this.Dh=0;this.Cf=this.Bf=ed;this.Cp=this.Bp=NaN;this.Eo=!1;this.Ep=null;this.wl=this.vm="None";this.ae=1;this.Zd=0;this.Xd=1;this.Yd=null;"string"===typeof a?this.figure=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}ma(Kf,O); Kf.prototype.cloneProtected=function(a){O.prototype.cloneProtected.call(this,a);a.sa=this.sa;a.io=this.io;a.qo=this.qo;a.Jd=this.Jd;a.tl=this.tl;a.Mc=this.Mc;a.Gg=this.Gg;a.om=this.om;a.pm=this.pm;a.mk=this.mk;null!==this.Ch&&(a.Ch=Ja(this.Ch));a.Dh=this.Dh;a.Bf=this.Bf.L();a.Cf=this.Cf.L();a.Bp=this.Bp;a.Cp=this.Cp;a.Eo=this.Eo;a.Ep=this.Ep;a.vm=this.vm;a.wl=this.wl;a.ae=this.ae;a.Zd=this.Zd;a.Xd=this.Xd;a.Yd=this.Yd};t=Kf.prototype; t.ob=function(a){a===pg||a===rg||a===gl||a===dl?this.geometryStretch=a:O.prototype.ob.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+mb(this)}; function Cn(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,r,q,u=0,y=Ma(),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,r=Math.atan2(h,n),q=Math.sqrt(n*n+h*h),y.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof Kf&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;x=0;q=y[x];n=q[0];r=q[1];p=q[2];q=q[3];for(var z=0;.1<=u;){0===z&&(m?(e=c,e-=l,u-=l,m=!1):e=c,0===e&&(e=1)); if(e>u){Oa(y);return}e>q?(z=e-q,e=q):z=0;var B=Math.sqrt(e*e/(1+p*p));0>n&&(B=-B);h+=B;k+=p*B;a.translate(h,k);a.rotate(r);a.translate(-(g/2),-(f/2));0===z&&d.hj(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==z){x++;if(x===y.length){Oa(y);return}q=y[x];n=q[0];r=q[1];p=q[2];q=q[3];e=z}}Oa(y)}} t.hj=function(a,b){var c=this.Mc,d=this.tl;if(null!==c||null!==d){var e=this.sa;if(null!==e){a.ke();var f=this.actualBounds,g=this.naturalBounds;null!==d&&ri(this,a,d,!0,!1,g,f);var h=this.part,k=this.Gg;null===c||0!==k||null===h||!this.isPanelMain&&h.wb()!==this||(k=h.type===W.Link&&h instanceof Le&&"Selection"===h.category&&h.adornedObject instanceof Kf&&h.adornedPart.wb()===h.adornedObject?h.adornedObject.strokeWidth:0);0===k&&(c=null);null!==c&&0!==k&&(ri(this,a,c,!1,!1,g,f),a.lineWidth=k,a.lineJoin= this.pm,a.lineCap=this.om,a.miterLimit=this.mk);f=!1;h&&b.Ve("drawShadows")&&(f=h.isShadowed);h=!0;null===c||null!==d&&"transparent"!==d||(h=!1);g=!1;k=this.strokeDashArray;null!==k&&(g=!0,a.Kt(k,this.Dh));if(e.type===N.j)a.beginPath(),a.moveTo(e.startX,e.startY),a.lineTo(e.endX,e.endY),null!==c&&a.Bj();else if(e.type===N.F){var l=e.startX;k=e.startY;var m=e.endX,n=e.endY;e=Math.min(l,m);var p=Math.min(k,n);l=Math.abs(m-l);k=Math.abs(n-k);a.beginPath();a.rect(e,p,l,k);null!==d&&a.Mf(d);if(null!== c){h&&f&&Al(a);if(0===l||0===k)a.beginPath(),a.rect(e,p,Math.max(l,.1),Math.max(k,.1));a.Bj();h&&f&&zl(a)}}else if(e.type===N.P)l=e.startX,k=e.startY,m=e.endX,n=e.endY,e=Math.abs(m-l)/2,p=Math.abs(n-k)/2,l=Math.min(l,m)+e,k=Math.min(k,n)+p,a.beginPath(),a.moveTo(l,k-p),a.bezierCurveTo(l+K.Vg*e,k-p,l+e,k-K.Vg*p,l+e,k),a.bezierCurveTo(l+e,k+K.Vg*p,l+K.Vg*e,k+p,l,k+p),a.bezierCurveTo(l-K.Vg*e,k+p,l-e,k+K.Vg*p,l-e,k),a.bezierCurveTo(l-e,k-K.Vg*p,l-K.Vg*e,k-p,l,k-p),a.closePath(),null!==d&&a.Mf(d),null!== c&&(h&&f?(Al(a),a.Bj(),zl(a)):a.Bj());else if(e.type===N.o)for(e=e.figures,k=e.length,p=0;p<k;p++){l=e.l[p];a.beginPath();a.moveTo(l.startX,l.startY);m=l.segments.l;n=m.length;for(var r=null,q=0;q<n;q++){var u=m[q];switch(u.type){case Qd:a.moveTo(u.endX,u.endY);break;case Ed:a.lineTo(u.endX,u.endY);break;case Rd:a.bezierCurveTo(u.point1X,u.point1Y,u.point2X,u.point2Y,u.endX,u.endY);break;case Sd:a.quadraticCurveTo(u.point1X,u.point1Y,u.endX,u.endY);break;case de:if(u.radiusX===u.radiusY){var y=Math.PI/ 180;a.arc(u.point1X,u.point1Y,u.radiusX,u.startAngle*y,(u.startAngle+u.sweepAngle)*y,0>u.sweepAngle,null!==r?r.endX:l.startX,null!==r?r.endY:l.startY)}else if(r=fe(u,l),y=r.length,0===y)a.lineTo(u.centerX,u.centerY);else for(var x=0;x<y;x++){var z=r[x];0===x&&a.lineTo(z[0],z[1]);a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7])}break;case ee:x=y=0;if(null!==r&&r.type===de){r=fe(r,l);z=r.length;if(0===z){a.lineTo(u.endX,u.endY);break}r=r[z-1]||null;null!==r&&(y=r[6],x=r[7])}else y=null!==r?r.endX:l.startX, x=null!==r?r.endY:l.startY;r=ge(u,l,y,x);y=r.length;if(0===y){a.lineTo(u.endX,u.endY);break}for(x=0;x<y;x++)z=r[x],a.bezierCurveTo(z[2],z[3],z[4],z[5],z[6],z[7]);break;default:v("Segment not of valid type: "+u.type)}u.isClosed&&a.closePath();r=u}m=l.isFilled;f?l.isShadowed?(!0===m&&"transparent"!==d&&null!==d&&a.Mf(d),null!==c&&(m&&h&&Al(a),a.Bj(),m&&h&&zl(a))):(Al(a),m&&"transparent"!==d&&null!==d&&a.Mf(d),null!==c&&a.Bj(),zl(a)):(m&&null!==d&&a.Mf(d),null!==c&&a.Bj())}g&&a.It();if(null!==this.pathPattern){c= this.pathPattern;c.measure(Infinity,Infinity);d=c.measuredBounds;c.arrange(0,0,d.width,d.height);f=this.geometry;a.save();a.beginPath();d=Ma();if(f.type===N.j)d.push(f.startX),d.push(f.startY),d.push(f.endX),d.push(f.endY),Cn(a,b,d,c);else if(f.type===N.o)for(f=f.figures.iterator;f.next();){h=f.value;d.length=0;d.push(h.startX);d.push(h.startY);g=h.startX;e=h.startY;k=g;p=e;l=h.segments.l;m=l.length;for(n=0;n<m;n++){q=l[n];switch(q.type){case Qd:Cn(a,b,d,c);d.length=0;d.push(q.endX);d.push(q.endY); g=q.endX;e=q.endY;k=g;p=e;break;case Ed:d.push(q.endX);d.push(q.endY);g=q.endX;e=q.endY;break;case Rd:K.Se(g,e,q.point1X,q.point1Y,q.point2X,q.point2Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case Sd:K.cr(g,e,q.point1X,q.point1Y,q.endX,q.endY,.5,d);g=q.endX;e=q.endY;break;case de:u=fe(q,h);r=u.length;if(0===r){d.push(q.centerX);d.push(q.centerY);g=q.centerX;e=q.centerY;break}for(y=0;y<r;y++)x=u[y],K.Se(g,e,x[2],x[3],x[4],x[5],x[6],x[7],.5,d),g=x[6],e=x[7];break;case ee:u=ge(q,h,g,e);r=u.length; if(0===r){d.push(q.endX);d.push(q.endY);g=q.endX;e=q.endY;break}for(y=0;y<r;y++)x=u[y],K.Se(g,e,x[2],x[3],x[4],x[5],x[6],x[7],.5,d),g=x[6],e=x[7];break;default:v("Segment not of valid type: "+q.type)}q.isClosed&&(d.push(k),d.push(p),Cn(a,b,d,c))}Cn(a,b,d,c)}else if(f.type===N.F)d.push(f.startX),d.push(f.startY),d.push(f.endX),d.push(f.startY),d.push(f.endX),d.push(f.endY),d.push(f.startX),d.push(f.endY),d.push(f.startX),d.push(f.startY),Cn(a,b,d,c);else if(f.type===N.P){e=new le;e.startX=f.endX;e.startY= (f.startY+f.endY)/2;g=new me(de);g.startAngle=0;g.sweepAngle=360;g.centerX=(f.startX+f.endX)/2;g.centerY=(f.startY+f.endY)/2;g.radiusX=Math.abs(f.startX-f.endX)/2;g.radiusY=Math.abs(f.startY-f.endY)/2;e.add(g);f=fe(g,e);h=f.length;if(0===h)d.push(g.centerX),d.push(g.centerY);else for(g=e.startX,e=e.startY,k=0;k<h;k++)p=f[k],K.Se(g,e,p[2],p[3],p[4],p[5],p[6],p[7],.5,d),g=p[6],e=p[7];Cn(a,b,d,c)}Oa(d);a.restore();a.Oc(!1)}}}}; t.ja=function(a,b){void 0===b&&(b=new J);if(a instanceof Eb){a.bc()&&v("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.je.Fa(b);return b}; t.pj=function(a){void 0===a&&(a=new M);var b=this.naturalBounds,c=this.je;b=M.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.Qc(d/2,d/2);d=J.allocAt(b.x,b.y).transform(c);a.h(d.x,d.y,0,0);d.h(b.right,b.y).transform(c);jc(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);jc(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);jc(a,d.x,d.y,0,0);M.free(b);J.free(d);return a}; t.Rh=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!==N.j||b||(e+=2);var f=M.alloc();f.assign(d);f.Qc(e+2,e+2);if(!f.ca(a))return M.free(f),!1;d=e+1E-4;if(c.type===N.j){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;M.free(f);return K.Rb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type=== N.F){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.Qc(-d,-d);if(f.ca(a))return M.free(f),!1;f.Qc(d,d)}null!==this.stroke&&f.Qc(e,e);a=f.ca(a);M.free(f);return a}if(c.type===N.P){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 M.free(f), !1;g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);M.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===N.o)return M.free(f),null===this.fill?je(c,a.x,a.y,e):he(c,a,e,1<this.strokeWidth,b);v("Unknown Geometry type: "+c.type)}; t.Om=function(a,b,c,d){var e=this.desiredSize,f=this.Gg;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Jd)var g=this.geometry.bounds;else{var h=this.figure,k=Dn[h];if(void 0===k){var l=K.qe[h];"string"===typeof l&&(l=K.qe[l]);"function"===typeof l?(k=l(null,100,100),Dn[h]=k):v("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(rl(this,!0)){case pg:d=c=0;break;case Cd:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case el:l=Math.max(a-f,0);d=0;break;case fl: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=qg(this);switch(c){case pg:break;case Cd:h=l;k=m;break;case rg:c=Math.min(l/h,m/k);isFinite(c)||(c=1);h*=c;k*=c;break;default:v(c+" is not a valid geometryStretch.")}null!==this.Jd?(0===h&&(h=.001),0===k&&(k=.001), c=null!==this.Jd?this.Jd:this.sa,e=c.bounds,d=h/e.width,e=k/e.height,isFinite(d)||(d=1),isFinite(e)||(e=1),c=1===d&&1===e?c:c.copy().scale(d,e),G&&c.freeze(),this.sa=c):null!==this.sa&&K.da(this.sa.Fl,a-f)&&K.da(this.sa.El,b-f)||(this.sa=Kf.makeGeometry(this,h,k));g=this.sa.bounds;Infinity===a||Infinity===b?this.Ge(g.x-f/2,g.y-f/2,0===a&&0===h?0:g.width+f,0===b&&0===k?0:g.height+f):this.Ge(-(f/2),-(f/2),l+f,m+f)}; function qg(a){var b=a.geometryStretch;return null!==a.Jd?b===dl?Cd:b:b===dl?Dn[a.figure].defaultStretch:b}t.Ph=function(a,b,c,d){tl(this,a,b,c,d)};t.St=function(a,b,c){return this.Ek(a.x,a.y,b.x,b.y,c)}; t.Ek=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.Gg/2;l=this.sa;null===l&&(this.measure(Infinity,Infinity),l=this.sa);var r=l.bounds;m=!1;if(l.type===N.j)if(1.5>=this.strokeWidth)m=K.Xe(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=Ma();a=new J;K.Xe(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new J;K.Xe(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Xe(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Xe(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===N.F)m=K.Qf(r.x-n,r.y-n,r.x+r.width+ n,r.y+r.height+n,f,g,h,k,e);else if(l.type===N.P){b=M.allocAt(r.x,r.y,r.width,r.height).Qc(n,n);a:if(0===b.width)m=K.Xe(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=K.Xe(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}M.free(b)}else if(l.type===N.o){p=J.alloc();var q=h-f;var u=k-g,y=q*q+u*u,x=f,z=g;if(0<y&&r.contains(x,z)&&(p.x=x,p.y=z,this.ca(p)))for(0!==q&&.5>Math.abs(q)?(u*=.5/q,q=.5):0!==u&&.5>Math.abs(u)&&(q*=.5/u,u=.5),x-=q,z-= u;r.contains(x,z);)x-=q,z-=u;e.x=h;e.y=k;for(u=0;u<l.figures.count;u++){var B=l.figures.l[u],D=B.isFilled?x:f,F=B.isFilled?z:g,L=B.segments;r=B.startX;q=B.startY;for(var Z=r,Q=q,ba=0;ba<L.count;ba++){var S=L.l[ba],P=S.type;var xa=S.endX;var ka=S.endY;var Aa=!1;switch(P){case Qd:Z=xa;Q=ka;break;case Ed:Aa=En(r,q,xa,ka,D,F,h,k,p);break;case Rd:Aa=K.Fq(r,q,S.point1X,S.point1Y,S.point2X,S.point2Y,xa,ka,D,F,h,k,.6,p);break;case Sd:Aa=K.Fq(r,q,r+2/3*(S.point1X-r),q+2/3*(S.point1Y-q),xa+2/3*(S.point1X-xa), ka+2/3*(S.point1Y-ka),xa,ka,D,F,h,k,.6,p);break;case de:case ee:P=S.type===de?fe(S,B):ge(S,B,r,q);var Sa=P.length;if(0===Sa){Aa=En(r,q,S.type===de?S.centerX:S.endX,S.type===de?S.centerY:S.endY,D,F,h,k,p);break}ka=null;for(xa=0;xa<Sa;xa++){ka=P[xa];if(0===xa&&En(r,q,ka[0],ka[1],D,F,h,k,p)){var vb=Fn(D,F,p,y,e);vb<y&&(y=vb,m=!0)}K.Fq(ka[0],ka[1],ka[2],ka[3],ka[4],ka[5],ka[6],ka[7],D,F,h,k,.6,p)&&(vb=Fn(D,F,p,y,e),vb<y&&(y=vb,m=!0))}xa=ka[6];ka=ka[7];break;default:v("Unknown Segment type: "+P)}r=xa; q=ka;Aa&&(Aa=Fn(D,F,p,y,e),Aa<y&&(y=Aa,m=!0));S.isClosed&&(xa=Z,ka=Q,En(r,q,xa,ka,D,F,h,k,p)&&(S=Fn(D,F,p,y,e),S<y&&(y=S,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;J.free(p)}else v("Unknown Geometry type: "+l.type);if(!m)return!1;this.transform.Fa(e);return!0};function Fn(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 En(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||K.da(k.y,a))&&(k.y<b||K.da(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||K.da(k.x,b))&&(k.x<a||K.da(k.x,a))&&(l=!0));return l} t.Qh=function(a,b){if(void 0===b)return a.Te(this.actualBounds);var c=this.sa;null===c&&(this.measure(Infinity,Infinity),c=this.sa);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=J.alloc();f.h(c.x-d,c.y-d);a.ca(b.Fa(f))&&(f.h(c.x-d,c.bottom+d),a.ca(b.Fa(f))&&(f.h(c.right+d,c.bottom+d),a.ca(b.Fa(f))&&(f.h(c.right+d,c.y-d),a.ca(b.Fa(f))&&(e=!0))));J.free(f);return e}; t.Tc=function(a,b){if(this.Qh(a,b)||void 0===b&&(b=this.transform,a.Te(this.actualBounds)))return!0;var c=Fb.alloc();c.set(b);c.Xt();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=J.alloc();g.h(d,f);c.Fa(g);if(this.Rh(g,!0))return J.free(g),!0;g.h(e,f);c.Fa(g);if(this.Rh(g,!0))return J.free(g),!0;g.h(d,a);c.Fa(g);if(this.Rh(g,!0))return J.free(g),!0;g.h(e,a);c.Fa(g);if(this.Rh(g,!0))return J.free(g),!0;var h=J.alloc(),k=J.alloc();c.set(b);c.rw(this.transform);c.Xt();h.x=e;h.y=f;h.transform(c);g.x= d;g.y=f;g.transform(c);b=!1;Gn(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),Gn(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),Gn(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),Gn(this,g,h,k)&&(b=!0))));J.free(g);Fb.free(c);J.free(h);J.free(k);return b};function Gn(a,b,c,d){if(!a.St(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.wy=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.vd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.Rh(a,!0))return!0;var e=a.Lf(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.sa;if(null===b&&(this.measure(Infinity,Infinity),b=this.sa,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(Ib(a.x,a.y,h,k)<=e&&Ib(a.x,a.y,l,k)<=e&&Ib(a.x,a.y,h,g)<=e&&Ib(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l= b.endX;g=b.endY;if(b.type===N.j){if(c=Hb(a.x,a.y,h,k,l,g),b=(h-l)*(a.x-l)+(k-g)*(a.y-g),c<=(0<=(l-h)*(a.x-h)+(g-k)*(a.y-k)&&0<=b?e:f))return!0}else{if(b.type===N.F)return b=!1,c&&(b=Hb(a.x,a.y,h,k,h,g)<=e||Hb(a.x,a.y,h,k,l,k)<=e||Hb(a.x,a.y,l,k,l,g)<=e||Hb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===N.P){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 Hb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=K.Uz(m,n,b,f),a*a<=e)return!0}else return Ib(b,f,-m,0)>=e||Ib(b,f,0,-n)>= e||Ib(b,f,0,n)>=e||Ib(b,f,m,0)>=e?!1:!0}else if(b.type===N.o){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&&Hb(a.x,a.y,f,h,f,l)>e&&Hb(a.x,a.y,f,h,k,h)>e&&Hb(a.x,a.y,k,l,f,l)>e&&Hb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?je(b,a.x,a.y,f):he(b,a,f,!0,!1))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.l[b];g=f.startX;m=f.startY;if(a.vd(g,m)>e)return!1;h=f.segments.l;k=h.length;for(l=0;l<k;l++)switch(n=h[l],n.type){case Qd:case Ed:g= n.endX;m=n.endY;if(a.vd(g,m)>e)return!1;break;case Rd:var p=Ma();K.Se(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.vd(g,m)>e)return!1;break;case Sd:p=Ma();K.cr(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.vd(g,m)>e)return!1;break;case de:case ee:p=n.type===de?fe(n,f):ge(n,f,g,m);var r=p.length;if(0===r){g=n.type===de?n.centerX:n.endX;m=n.type===de?n.centerY:n.endY;if(a.vd(g,m)> e)return!1;break}n=null;for(var q=Ma(),u=0;u<r;u++)if(n=p[u],q.length=0,K.Se(n[0],n[1],n[2],n[3],n[4],n[5],n[6],n[7],.8,q),d(q,a))return Oa(q),!1;Oa(q);null!==n&&(g=n[6],m=n[7]);break;default:v("Unknown Segment type: "+n.type)}}return!0}}}return!1};t.ic=function(){this.sa=null};t.Cx=function(){return this.Gg}; function Hn(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=bn,"None"!==a.vm?(a.segmentIndex=-1,a.alignmentFocus=nd):"None"!==a.wl&&(a.segmentIndex=0,a.alignmentFocus=new Eb(1-nd.x,nd.y)))} Kf.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=In[a.toArrow];else"None"!==a.fromArrow?d=In[a.fromArrow]:(d=K.qe[a.figure],"string"===typeof d&&(d=K.qe[d]),void 0===d&&v("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.Fl=b,d.El=c);if(null===d){var e=K.qe.Rectangle;"function"===typeof e&&(d=e(a,b,c))}G&&(d.bounds.width>b+1E-5||d.bounds.height>c+1E-5)&&v('Geometry made with figure "'+a.figure+'" has bounds '+d.bounds.toString()+" that are too large for the given size ("+b+","+c+"). See documentation for Shape.defineFigureGenerator."); return d};function Jn(a){var b=In[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=In[c];if(void 0===b){var d=null,e;for(e in K.nn)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=N.parse(K.nn[d],!1),In[d]=a,c!==d&&(In[c]=d),d}}return"string"===typeof b?b:b instanceof N?a:null} na.Object.defineProperties(Kf.prototype,{geometry:{configurable:!0,get:function(){return null!==this.sa?this.sa:this.Jd},set:function(a){var b=this.sa,c=this.Jd;if(b!==a){null!==a?(G&&w(a,N,Kf,"geometry"),this.Jd=this.sa=a.freeze()):this.Jd=this.sa=null;var d=this.part;null!==d&&(d.vh=NaN);this.v();this.g("geometry",b||c,a);nl(this)&&(a=this.part,null!==a&&ol(this,a,"geometryString"))}}},geometryString:{configurable:!0,get:function(){return null===this.geometry?"":this.geometry.toString()}, set:function(a){a=N.parse(a);var b=a.normalize();this.geometry=a;this.position=a=J.allocAt(-b.x,-b.y);J.free(a)}},isGeometryPositioned:{configurable:!0,get:function(){return this.Eo},set:function(a){G&&A(a,"boolean",Kf,"isGeometryPositioned");var b=this.Eo;b!==a&&(this.Eo=a,this.v(),this.g("isGeometryPositioned",b,a))}},fill:{configurable:!0,get:function(){return this.tl},set:function(a){var b=this.tl;b!==a&&(null!==a&&Xl(a,"Shape.fill"),a instanceof wl&&a.freeze(),this.tl= a,this.R(),this.g("fill",b,a))}},stroke:{configurable:!0,get:function(){return this.Mc},set:function(a){var b=this.Mc;b!==a&&(null!==a&&Xl(a,"Shape.stroke"),a instanceof wl&&a.freeze(),this.Mc=a,this.R(),this.g("stroke",b,a))}},strokeWidth:{configurable:!0,get:function(){return this.Gg},set:function(a){var b=this.Gg;if(b!==a)if(G&&C(a,Kf,"strokeWidth"),0<=a){this.Gg=a;this.v();var c=this.part;null!==c&&(c.vh=NaN);this.g("strokeWidth",b,a)}else Ba(a,"value >= 0",Kf,"strokeWidth:value")}}, strokeCap:{configurable:!0,get:function(){return this.om},set:function(a){var b=this.om;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?Ba(a,'"butt", "round", or "square"',Kf,"strokeCap"):(this.om=a,this.R(),this.g("strokeCap",b,a)))}},strokeJoin:{configurable:!0,get:function(){return this.pm},set:function(a){var b=this.pm;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?Ba(a,'"miter", "bevel", or "round"',Kf,"strokeJoin"):(this.pm= a,this.R(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{configurable:!0,get:function(){return this.mk},set:function(a){var b=this.mk;if(b!==a)if(G&&C(a,Kf,"strokeMiterLimit"),1<=a){this.mk=a;this.R();var c=this.part;null!==c&&(c.vh=NaN);this.g("strokeMiterLimit",b,a)}else G&&Ba(a,"value >= 1",Kf,"strokeWidth:value")}},strokeDashArray:{configurable:!0,get:function(){return this.Ch},set:function(a){var b=this.Ch;if(b!==a){null===a||Array.isArray(a)||za(a,"Array",Kf,"strokeDashArray:value"); if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];(!G||"number"===typeof f)&&0<=f&&isFinite(f)||v("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.Ch=a;this.R();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{configurable:!0,get:function(){return this.Dh},set:function(a){var b=this.Dh;b!==a&&(G&&C(a,Kf,"strokeDashOffset"),0<=a&&(this.Dh=a,this.R(),this.g("strokeDashOffset",b,a)))}},figure:{configurable:!0, enumerable:!0,get:function(){return this.io},set:function(a){var b=this.io;if(b!==a){G&&A(a,"string",Kf,"figure");var c=K.qe[a];"function"===typeof c?c=a:(c=K.qe[a.toLowerCase()])||v("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.vh=NaN),this.io=c,this.Jd=null,this.ic(),this.v(),this.g("figure",b,c))}}},toArrow:{configurable:!0,get:function(){return this.vm},set:function(a){var b=this.vm;!0===a?a="Standard":!1===a&&(a="");if(b!==a){G&&A(a,"string",Kf,"toArrow");var c=Jn(a); null===c?v("Unknown Shape.toArrow: "+a):b!==c&&(this.vm=c,this.Jd=null,this.ic(),this.v(),Hn(this),this.g("toArrow",b,c))}}},fromArrow:{configurable:!0,get:function(){return this.wl},set:function(a){var b=this.wl;!0===a?a="Standard":!1===a&&(a="");if(b!==a){G&&A(a,"string",Kf,"fromArrow");var c=Jn(a);null===c?v("Unknown Shape.fromArrow: "+a):b!==c&&(this.wl=c,this.Jd=null,this.ic(),this.v(),Hn(this),this.g("fromArrow",b,c))}}},spot1:{configurable:!0,get:function(){return this.Bf}, set:function(a){w(a,Eb,Kf,"spot1");var b=this.Bf;b.B(a)||(this.Bf=a=a.L(),this.v(),this.g("spot1",b,a))}},spot2:{configurable:!0,get:function(){return this.Cf},set:function(a){w(a,Eb,Kf,"spot2");var b=this.Cf;b.B(a)||(this.Cf=a=a.L(),this.v(),this.g("spot2",b,a))}},parameter1:{configurable:!0,get:function(){return this.Bp},set:function(a){var b=this.Bp;b!==a&&(this.Bp=a,this.ic(),this.v(),this.g("parameter1",b,a))}},parameter2:{configurable:!0,get:function(){return this.Cp}, set:function(a){var b=this.Cp;b!==a&&(this.Cp=a,this.ic(),this.v(),this.g("parameter2",b,a))}},naturalBounds:{configurable:!0,get:function(){var a=this.desiredSize;return a.s()||null===this.sa?new M(0,0,a.width,a.height):(this.wc.assign(this.sa.bounds),this.wc)}},pathPattern:{configurable:!0,get:function(){return this.Ep},set:function(a){var b=this.Ep;b!==a&&(G&&null!==a&&w(a,O,Kf,"pathPattern"),this.Ep=a,this.R(),this.g("pathPattern",b,a))}},geometryStretch:{configurable:!0, enumerable:!0,get:function(){return this.qo},set:function(a){var b=this.qo;b!==a&&(eb(a,O,Kf,"geometryStretch"),this.qo=a,this.v(),this.g("geometryStretch",b,a))}},interval:{configurable:!0,get:function(){return this.ae},set:function(a){var b=this.ae;G&&C(a,Kf,"interval");a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.ae=a;var c=this.diagram;null!==c&&this.panel===c.grid&&sj(c);this.v();c=this.panel;null!==c&&(c.ph=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0, enumerable:!0,get:function(){return this.Zd},set:function(a){var b=this.Zd;G&&C(a,Kf,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Zd=a,this.v(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.Xd},set:function(a){var b=this.Xd;G&&C(a,Kf,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.Xd=a,this.v(),this.g("graduatedEnd",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.Yd},set:function(a){var b=this.Yd;b!==a&& (null!==a&&A(a,"function",Kf,"graduatedSkip"),this.Yd=a,this.v(),this.g("graduatedSkip",b,a))}}});Kf.prototype.intersectsRect=Kf.prototype.Tc;Kf.prototype.containedInRect=Kf.prototype.Qh;Kf.prototype.getNearestIntersectionPoint=Kf.prototype.St;Kf.prototype.getDocumentBounds=Kf.prototype.pj;Kf.prototype.getDocumentPoint=Kf.prototype.ja;var In=new gb,Dn=new gb;Kf.className="Shape";Kf.getFigureGenerators=function(){var a=new zb,b;for(b in K.qe)b!==b.toLowerCase()&&a.add(b,K.qe[b]);a.freeze();return a}; Kf.defineFigureGenerator=function(a,b){A(a,"string",Kf,"defineFigureGenerator:name");"string"===typeof b?!G||""!==b&&K.qe[b]||v("Shape.defineFigureGenerator synonym must not be empty or None or not a defined figure name: "+b):A(b,"function",Kf,"defineFigureGenerator:func");var c=a.toLowerCase();!G||""!==a&&a!==c||v("Shape.defineFigureGenerator name must not be empty or all-lower-case: "+a);var d=K.qe;d[a]=b;d[c]=a}; Kf.getArrowheadGeometries=function(){var a=new zb;for(d in K.nn)if(void 0===In[d]){var b=N.parse(K.nn[d],!1);In[d]=b;b=d.toLowerCase();b!==d&&(In[b]=d)}for(var c in In)if(c!==c.toLowerCase()){var d=In[c];d instanceof N&&a.add(c,d)}a.freeze();return a}; Kf.defineArrowheadGeometry=function(a,b){A(a,"string",Kf,"defineArrowheadGeometry:name");"string"===typeof b?(A(b,"string",Kf,"defineArrowheadGeometry:pathstr"),b=N.parse(b,!1)):w(b,N,Kf,"defineArrowheadGeometry:pathstr");var c=a.toLowerCase();(G&&""===a||"none"===c||a===c)&&v("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=In;d[a]=b;d[c]=a}; function Zg(a,b){O.call(this);Tn||(Un=Xg?(new Jk(null)).context:null,Tn=!0);this.Zb="";this.Mc="black";this.xe="13px sans-serif";this.Yi="start";this.Wd=pg;this.dj=jd;this.Uj=!0;this.Fi=this.Gi=!1;this.wg=Vn;this.Kg=Wn;this.Bs=this.yb=this.ed=0;this.iv=this.jv=null;this.eo=!1;this.rd=this.Gn=this.rq=this.Zi=this.sq=null;this.Af=this.zf=0;this.yi=Xn;this.Fe=Infinity;this.Ji=0;this.ye=null;this.Me=0;this.we=this.Ub=this.Hc=null;this.ae=1;this.Zd=0;this.Xd=1;this.Yd=this.Pj=null;"string"===typeof a? this.text=a:a&&Object.assign(this,a);b&&Object.assign(this,b);return this}ma(Zg,O); Zg.prototype.cloneProtected=function(a){O.prototype.cloneProtected.call(this,a);a.Zb=this.Zb;a.Mc=this.Mc;a.xe=this.xe;a.Yi=this.Yi;a.Wd=this.Wd;a.dj=this.dj;a.Uj=this.Uj;a.Gi=this.Gi;a.Fi=this.Fi;a.wg=this.wg;a.Kg=this.Kg;a.ed=this.ed;a.Bs=this.Bs;a.yb=this.yb;a.jv=this.jv;a.iv=this.iv;a.eo=this.eo;a.sq=this.sq;a.Zi=this.Zi;a.rq=this.rq;a.Gn=this.Gn;a.rd=this.rd;a.zf=this.zf;a.Af=this.Af;a.yi=this.yi;a.Fe=this.Fe;a.ye=this.ye;a.Me=this.Me;a.Hc=this.Hc;a.Ub=this.Ub;a.we=this.we;a.Ji=this.Ji;a.ae= this.ae;a.Zd=this.Zd;a.Xd=this.Xd;a.Pj=this.Pj;a.Yd=this.Yd}; function an(a,b){a.H=b.H|6144;a.mb=b.opacity;a.Wb=b.background;a.od=b.areaBackground;a.cd=b.desiredSize.L();a.pg=b.minSize.L();a.og=b.maxSize.L();null!==b.Fb?a.Fb=b.Fb.copy():a.Fb=null;a.wa=b.scale;a.Cb=b.angle;a.Pe=b.stretch;a.uh=b.margin.L();a.Bb=b.alignment.L();a.Zk=b.alignmentFocus.L();a.em=b.segmentFraction;a.fm=b.segmentOffset.L();a.gm=b.segmentOrientation;null!==b.hb&&(a.hb=b.hb.copy());a.im=b.shadowVisible;b instanceof Zg&&(a.Zb=b.Zb,a.Mc=b.Mc,a.xe=b.xe,a.Yi=b.Yi,a.Wd=b.Wd,a.dj=b.dj,a.Uj= b.Uj,a.Gi=b.Gi,a.Fi=b.Fi,a.wg=b.wg,a.Kg=b.Kg,a.ye=null,a.zf=b.zf,a.Af=b.Af,a.Fe=b.Fe,a.Ji=b.Ji,a.ae=b.ae,a.Zd=b.Zd,a.Xd=b.Xd,a.Pj=b.Pj,a.Yd=b.Yd)}t=Zg.prototype;t.ob=function(a){a.classType===Zg?this.wrap=a:O.prototype.ob.call(this,a)};t.toString=function(){return 22<this.Zb.length?'TextBlock("'+this.Zb.substring(0,20)+'"...)':'TextBlock("'+this.Zb+'")'};t.v=function(){O.prototype.v.call(this);this.iv=this.jv=null}; function Yn(a){Tn||(Un=Xg?(new Jk(null)).context:null,Tn=!0);if(null===Un)return!0;var b=Un.font;if(a===b||"10px sans-serif"===a)return!0;Un.font="10px sans-serif";Un.font=a;var c=Un.font;if("10px sans-serif"!==c)return Un.font=b,!0;Un.font="19px serif";var d=Un.font;Un.font=a;c=Un.font;Un.font=b;return c!==d} t.hj=function(a,b){if(null!==this.Mc&&0!==this.Zb.length&&null!==this.xe){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=Zn(this),h=a.textAlign=this.Yi,k=b.Il;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.Gi;var l=this.Fi;ri(this,a,this.Mc,!0,!1,c,d);(k||l)&&ri(this,a,this.Mc,!1,!1,c,d);d=0;c=!1;var m=this.je,n=m.dx-(g*m.m21+m.dx);m=m.dy-(g*m.m22+m.dy);var p=b.scale;8>(n*n+m*m)*p*p&&(c=!0);b.Db!==a&&(c=!1);!1===b.Ve("textGreeking")&&(c=!1);b=this.zf;n= this.Af;switch(this.flip){case il:a.translate(e,0);a.scale(-1,1);break;case hl:a.translate(0,f);a.scale(1,-1);break;case jl:a.translate(e,f),a.scale(-1,-1)}a.ke();m=this.ed;p=(b+g+n)*m;f>p&&(d=this.dj,d=d.y*f-d.y*p+d.offsetY);if(1===m&&null!==this.we)n=this.yb,n>e&&(n=e),this.gj(this.we,a,0,d+b,e,g,n,c,h,k,l);else if(null!==this.Hc&&null!==this.Ub)for(p=0;p<m;p++){var r=this.Hc[p];r>e&&(r=e);d+=b;this.gj(this.Ub[p],a,0,d,e,g,r,c,h,k,l);d+=g+n}switch(this.flip){case il:a.scale(-1,1);a.translate(-e, 0);break;case hl:a.scale(1,-1);a.translate(0,-f);break;case jl:a.scale(-1,-1),a.translate(-e,-f)}}}; t.gj=function(a,b,c,d,e,f,g,h,k,l,m){var n=0;h?("left"===k?n=0:"right"===k?n=e-g:"center"===k&&(n=(e-g)/2),b.fillRect(c+n,d+.25*f,g,1)):("left"===k?n=0:"right"===k?n=e:"center"===k&&(n=e/2),e=null!==$n?$n(this,f):.75*f,b.fillText(a,c+n,d+e),a=f/20|0,0===a&&(a=1),"right"===k?n-=g:"center"===k&&(n-=g/2),l&&(k=null!==ao?ao(this,f):.8*f,b.beginPath(),b.lineWidth=a,b.moveTo(c+n,d+k),b.lineTo(c+n+g,d+k),b.stroke()),m&&(b.beginPath(),b.lineWidth=a,d=d+f-f/2.2|0,0!==a%2&&(d+=.5),b.moveTo(c+n,d),b.lineTo(c+ n+g,d),b.stroke()))}; t.Om=function(a,b,c,d){this.Ji=a;var e=this.xe;null!==Un&&bo!==e&&(bo=Un.font=e);this.yb=this.Me=0;this.we=this.Ub=this.Hc=this.ye=null;var f;if(isNaN(this.desiredSize.width)){e=this.Zb.replace(/\r\n/g,"\n").replace(/\r/g,"\n");if(0===e.length)e=0;else if(this.isMultiline){for(var g=f=0,h=!1;!h;){var k=e.indexOf("\n",g);-1===k&&(k=e.length,h=!0);g=e.substr(g,k-g);this.yi===Xn&&(g=g.trim());f=Math.max(f,co(g));g=k+1}e=f}else f=e.indexOf("\n",0),0<=f&&(e=e.substr(0,f)),e=co(e);e=Math.min(e,a/this.scale); e=Math.max(8,e)}else e=this.desiredSize.width;null!==this.panel&&(e=Math.min(e,this.panel.maxSize.width));f=eo(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;h=f;if(0!==this.yb&&null!==this.Hc&&null!==this.Ub&&this.wg===fo&&(b=this.xe,b=this.wg===fo?go(b):0,k=this.zf+this.Af,k=Math.max(0,Zn(this)+k),h=Math.min(this.maxLines-1,Math.max(Math.floor(h/k+.01)-1,0)),!(h+1>=this.Ub.length))){k=this.Ub[h];for(b=Math.max(1,a-b);co(k)>b&&1<k.length;)k=k.substr(0, k.length-1);k+=ho;b=co(k);this.Ub[h]=k;this.Ub=this.Ub.slice(0,h+1);this.Hc[h]=b;this.Hc=this.Hc.slice(0,h+1);this.Me=this.Ub.length;this.yb=Math.max(this.yb,b);this.ed=this.Me;1===this.ed&&(this.we=this.Ub[0])}if(this.wrap===io||isNaN(this.desiredSize.width))e=isNaN(a)?this.yb:Math.min(a,this.yb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);bc(this.wc,e,f);this.Ge(0,0,e,f)};t.Ph=function(a,b,c,d){tl(this,a,b,c,d)}; function jo(a,b,c){if(null===a.we)a.we=b,a.yb=c;else{if(null===a.Ub||null===a.Hc)a.Ub=[],a.Hc=[],a.Ub.push(a.we),a.Hc.push(a.yb);a.Ub.push(b);a.Hc.push(c)}} function ko(a,b,c,d){var e=a.yi===Xn;e&&(b=b.trim());var f=0,g=a.xe,h=a.zf+a.Af;h=Math.max(0,Zn(a)+h);var k=a.wg===fo?go(g):0;if(a.ed>=a.Fe)null!==d&&d.h(0,h);else if(g=b,a.Kg===lo){a.Me=1;var l=co(b);if(0===k||l<=c)a.yb=Math.max(a.yb,l),jo(a,b,a.yb),null!==d&&d.h(l,h);else{f=mo(a,g);g=g.substr(f.length);b=mo(a,g);for(l=co(f+b);0<b.length&&l<=c;)f+=b,g=g.substr(b.length),b=mo(a,g),l=f+b,e&&(l=l.trim()),l=co(l);e&&(b=b.trim());f+=b;for(c=Math.max(1,c-k);co(f)>c&&1<f.length;)f=f.substr(0,f.length-1); f+=ho;var m=co(f);a.yb=m;jo(a,f,m);null!==d&&d.h(m,h)}}else{k=0;0===g.length&&(k=1,jo(a,g,0));for(;0<g.length;){b=mo(a,g);for(g=g.substr(b.length);co(b)>c;){var n=1;l=co(b.substr(0,n));for(m=0;l<=c;)n++,m=l,l=co(b.substr(0,n));if(1===n){var p=l;f=Math.max(f,l)}else p=m,f=Math.max(f,m);n--;1>n&&(n=1);jo(a,b.substr(0,n),p);k++;b=b.substr(n);if(a.ed+k>a.Fe)break}m=mo(a,g);for(l=co(b+m);0<m.length&&l<=c;)b+=m,g=g.substr(m.length),m=mo(a,g),l=b+m,e&&(l=l.trim()),l=co(l);e&&(b=b.trim());if(""!==b&&("\u00ad"=== b[b.length-1]&&(b=b.substring(0,b.length-1)+"\u2010"),0===m.length?(n=l,f=Math.max(f,l)):(n=m=co(b),f=Math.max(f,m)),jo(a,b,n),k++,a.ed+k>a.Fe))break}a.Me=Math.min(a.Fe,k);a.yb=Math.max(a.yb,f);null!==d&&d.h(a.yb,h*a.Me)}}function mo(a,b){if(a.Kg===no)return b.substr(0,1);for(var c=b.length,d=0,e=oo;d<c&&!e.test(b.charAt(d));)d++;for(a.yi===po&&(c=Math.min(c,d+1));d<c&&e.test(b.charAt(d));)d++;return d>=b.length?b:b.substr(0,d)}function co(a){return null===Un?8*a.length:Un.measureText(a).width} function Zn(a){if(null!==a.ye)return a.ye;var b=a.xe;if(null===Un){var c=16;return a.ye=c}void 0!==qo[b]&&5E3>ro?c=qo[b]:(c=1.3*Un.measureText("M").width,qo[b]=c,ro++);return a.ye=c}function go(a){if(null===Un)return 6;if(void 0!==so[a]&&5E3>to)var b=so[a];else b=Un.measureText(ho).width,so[a]=b,to++;return b} function eo(a,b){var c=a.Zb.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.zf+a.Af;d=Math.max(0,Zn(a)+d);if(0===c.length)return a.yb=0,a.ed=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.ed=0,g,h=!1;!h;){g=c.indexOf("\n",f);-1===g&&(g=c.length,h=!0);if(f<=g){f=c.substr(f,g-f);if(a.Kg!==lo){a.Me=0;var k=Db.alloc();ko(a,f,b,k);e+=k.height;Db.free(k);a.ed+=a.Me}else ko(a,f,b,null),e+=d,a.ed++;a.ed===a.Fe&&(h=!0)}f=g+1}return a.Bs=e} na.Object.defineProperties(Zg.prototype,{font:{configurable:!0,get:function(){return this.xe},set:function(a){var b=this.xe;b!==a&&(G&&(A(a,"string",Zg,"font"),Yn(a)||v('Not a valid font: "'+a+'"')),this.xe=a,this.ye=null,this.v(),this.g("font",b,a))}},text:{configurable:!0,get:function(){return this.Zb},set:function(a){var b=this.Zb;null!==a&&void 0!==a?a=a.toString():a="";b!==a&&(this.Zb=a,this.v(),this.g("text",b,a))}},textAlign:{configurable:!0,get:function(){return this.Yi}, set:function(a){var b=this.Yi;b!==a&&(G&&A(a,"string",Zg,"textAlign"),"start"===a||"end"===a||"left"===a||"right"===a||"center"===a?(this.Yi=a,this.R(),this.g("textAlign",b,a)):G&&Ba(a,'"start", "end", "left", "right", or "center"',Zg,"textAlign"))}},flip:{configurable:!0,get:function(){return this.Wd},set:function(a){var b=this.Wd;b!==a&&(eb(a,O,Zg,"flip"),this.Wd=a,this.R(),this.g("flip",b,a))}},verticalAlignment:{configurable:!0,get:function(){return this.dj},set:function(a){var b= this.dj;b.B(a)||(G&&(w(a,Eb,Zg,"verticalAlignment"),a.bc()&&v("TextBlock.verticalAlignment for "+this+" must be a real Spot, not:"+a)),this.dj=a=a.L(),Jl(this),this.g("verticalAlignment",b,a))}},naturalBounds:{configurable:!0,get:function(){if(!this.wc.s()){var a=Db.alloc();ko(this,this.Zb,999999,a);var b=a.width;Db.free(a);a=eo(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);bc(this.wc,b,a)}return this.wc}},isMultiline:{configurable:!0, get:function(){return this.Uj},set:function(a){var b=this.Uj;b!==a&&(G&&A(a,"boolean",Zg,"isMultiline"),this.Uj=a,this.v(),this.g("isMultiline",b,a))}},isUnderline:{configurable:!0,get:function(){return this.Gi},set:function(a){var b=this.Gi;b!==a&&(G&&A(a,"boolean",Zg,"isUnderline"),this.Gi=a,this.R(),this.g("isUnderline",b,a))}},isStrikethrough:{configurable:!0,get:function(){return this.Fi},set:function(a){var b=this.Fi;b!==a&&(G&&A(a,"boolean",Zg,"isStrikethrough"), this.Fi=a,this.R(),this.g("isStrikethrough",b,a))}},wrap:{configurable:!0,get:function(){return this.Kg},set:function(a){var b=this.Kg;b!==a&&(G&&eb(a,Zg,Zg,"wrap"),this.Kg=a,this.v(),this.g("wrap",b,a))}},overflow:{configurable:!0,get:function(){return this.wg},set:function(a){var b=this.wg;b!==a&&(G&&eb(a,Zg,Zg,"overflow"),this.wg=a,this.v(),this.g("overflow",b,a))}},stroke:{configurable:!0,get:function(){return this.Mc},set:function(a){var b=this.Mc;b!== a&&(null!==a&&Xl(a,"TextBlock.stroke"),a instanceof wl&&a.freeze(),this.Mc=a,this.R(),this.g("stroke",b,a))}},lineCount:{configurable:!0,get:function(){return this.ed}},lineHeight:{configurable:!0,get:function(){return Zn(this)}},editable:{configurable:!0,get:function(){return this.eo},set:function(a){var b=this.eo;b!==a&&(G&&A(a,"boolean",Zg,"editable"),this.eo=a,this.g("editable",b,a))}},textEditor:{configurable:!0,get:function(){return this.sq}, set:function(a){var b=this.sq;b!==a&&(!G||a instanceof Qe||v("TextBlock.textEditor must be an HTMLInfo."),this.sq=a,this.g("textEditor",b,a))}},errorFunction:{configurable:!0,get:function(){return this.rd},set:function(a){var b=this.rd;b!==a&&(null!==a&&A(a,"function",Zg,"errorFunction"),this.rd=a,this.g("errorFunction",b,a))}},interval:{configurable:!0,get:function(){return this.ae},set:function(a){var b=this.ae;G&&C(a,Zg,"interval");a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.ae= a;this.v();var c=this.panel;null!==c&&(c.ph=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0,get:function(){return this.Zd},set:function(a){var b=this.Zd;G&&C(a,Zg,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Zd=a,this.v(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.Xd},set:function(a){var b=this.Xd;G&&C(a,Zg,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.Xd=a,this.v(),this.g("graduatedEnd",b,a))}},graduatedFunction:{configurable:!0, enumerable:!0,get:function(){return this.Pj},set:function(a){var b=this.Pj;b!==a&&(null!==a&&A(a,"function",Zg,"graduatedFunction"),this.Pj=a,this.v(),this.g("graduatedFunction",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.Yd},set:function(a){var b=this.Yd;b!==a&&(null!==a&&A(a,"function",Zg,"graduatedSkip"),this.Yd=a,this.v(),this.g("graduatedSkip",b,a))}},textValidation:{configurable:!0,get:function(){return this.Zi},set:function(a){var b=this.Zi; b!==a&&(null!==a&&A(a,"function",Zg,"textValidation"),this.Zi=a,this.g("textValidation",b,a))}},textEdited:{configurable:!0,get:function(){return this.rq},set:function(a){var b=this.rq;b!==a&&(null!==a&&A(a,"function",Zg,"textEdited"),this.rq=a,this.g("textEdited",b,a))}},spacingAbove:{configurable:!0,get:function(){return this.zf},set:function(a){var b=this.zf;b!==a&&(G&&A(a,"number",Zg,"spacingAbove"),this.zf=a,this.v(),this.g("spacingAbove",b,a))}},spacingBelow:{configurable:!0, enumerable:!0,get:function(){return this.Af},set:function(a){var b=this.Af;b!==a&&(G&&A(a,"number",Zg,"spacingBelow"),this.Af=a,this.v(),this.g("spacingBelow",b,a))}},formatting:{configurable:!0,get:function(){return this.yi},set:function(a){var b=this.yi;b!==a&&(eb(a,Zg,Zg,"flip"),this.yi=a,this.v(),this.g("formatting",b,a))}},maxLines:{configurable:!0,get:function(){return this.Fe},set:function(a){var b=this.Fe;b!==a&&(G&&A(a,"number",Zg,"maxLines"),a=Math.floor(a),0>= a&&Ba(a,"> 0",Zg,"maxLines"),this.Fe=a,this.v(),this.g("maxLines",b,a))}},metrics:{configurable:!0,get:function(){return{arrSize:null!==this.Hc?this.Hc:[this.yb],arrText:null!==this.Ub?this.Ub:[this.we],maxLineWidth:this.yb,fontHeight:this.ye}}},choices:{configurable:!0,get:function(){return this.Gn},set:function(a){var b=this.Gn;b!==a&&(G&&null!==a&&!Array.isArray(a)&&za(a,"Array",Zg,"choices:value"),this.Gn=a,this.g("choices",b,a))}}}); var $n=null,ao=null,lo=new E(Zg,"None",0),io=new E(Zg,"WrapFit",1),Wn=new E(Zg,"WrapDesiredSize",2),no=new E(Zg,"WrapBreakAll",3),Vn=new E(Zg,"OverflowClip",0),fo=new E(Zg,"OverflowEllipsis",1),Xn=new E(Zg,"FormatTrim",0),po=new E(Zg,"FormatNone",0),oo=/[ \u200b\u00ad]/,qo=new gb,ro=0,so=new gb,to=0,ho="...",bo="",Un=null,Tn=!1;Zg.className="TextBlock";Zg.getEllipsis=function(){return ho};Zg.setEllipsis=function(a){ho=a;so=new gb;to=0};Zg.getBaseline=function(){return $n}; Zg.setBaseline=function(a){$n=a};Zg.getUnderline=function(){return ao};Zg.setUnderline=function(a){ao=a};Zg.isValidFont=Yn;Zg.None=lo;Zg.WrapFit=io;Zg.WrapDesiredSize=Wn;Zg.WrapBreakAll=no;Zg.OverflowClip=Vn;Zg.OverflowEllipsis=fo;function fk(a,b){O.call(this);this.kh=null;this.jq="";this.Bh=uc;this.Al=Cd;this.Eh=this.rd=null;this.zl=Jc;this.Wd=pg;this.rm=null;this.Do=!1;this.ul=!0;this.Ql=!1;this.km=null;"string"===typeof a?this.source=a:a&&Object.assign(this,a);b&&Object.assign(this,b)}ma(fk,O); fk.prototype.cloneProtected=function(a){O.prototype.cloneProtected.call(this,a);a.element=this.kh;a.jq=this.jq;a.Bh=this.Bh.L();a.Al=this.Al;a.Wd=this.Wd;a.rd=this.rd;a.Eh=this.Eh;a.zl=this.zl.L();a.ul=this.ul;a.km=this.km};fk.prototype.ob=function(a){a===pg||a===rg||a===gl?this.imageStretch=a:O.prototype.ob.call(this,a)};fk.prototype.toString=function(){return"Picture("+this.source+")#"+mb(this)}; function Ki(a){void 0===a&&(a="");A(a,"string",fk,"clearCache:url");""!==a?uo[a]&&(delete uo[a],vo--):(uo=new gb,vo=0)} function wo(a,b){b.mz||(b.hv=function(c){b.rs=!0;b.Ao=!1;var d=b.hh.copy();if(null!==d&&void 0!==d){for(d=d.iterator;d.next();){var e=d.value;var f=b.getAttribute("src");var g=e.zg.K(f);if(null!==g)for(var h=g.length,k=0;k<h;k++)f=g[k],e.$l.add(f),e.Kb(),b.ro&&(void 0===b.tv&&(b.tv=c),null!==f.Eh&&f.Eh(f,c))}b.hh=null}a.desiredSize.s()||(rj(a,!1),a.v())},b.Ru=function(a){b.Ao=a;var c=b.hh.copy();if(null!==c&&void 0!==c){for(c=c.iterator;c.next();){var e=c.value,f=b.getAttribute("src");var g=e.zg.K(f); if(null!==g){e=g.length;f=Ma();for(var h=0;h<e;h++)f.push(g[h]);if(b.ro)for(h=0;h<e;h++)g=f[h],null!==g.rd&&g.rd(g,a);Oa(f)}}b.hh=null}},b.addEventListener("load",b.hv),b.addEventListener("error",b.Ru),b.mz=!0)}function hk(a){a.removeEventListener("load",a.hv);a.removeEventListener("error",a.Ru);delete a.hv;delete a.Ru}fk.prototype.bB=function(){if(""!==this.source){Ki(this.source);var a=this.source;this.source="";this.source=a}};fk.prototype.redraw=function(){this.R()}; fk.prototype.hj=function(a,b){var c=this.kh;if(null!==c){var d=c.getAttribute("src");if(!(c instanceof HTMLImageElement&&(null===d||""===d)||c.Ao instanceof Event&&a instanceof El)){d=this.naturalBounds;var e=0,f=0,g=this.Do,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.Bh.x,f=this.Bh.y,h=this.Bh.width,g=this.Bh.height); var m=h,n=g,p=this.Al,r=this.zl;switch(p){case pg:if(this.sourceRect.s())break;m>=d.width&&(e=e+r.offsetX+(m*r.x-d.width*r.x));n>=d.height&&(f=f+r.offsetY+(n*r.y-d.height*r.y));h=Math.min(d.width,m);g=Math.min(d.height,n);break;case Cd:m=d.width;n=d.height;break;case rg:case gl:p===rg?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===gl&&(p=Math.max(d.height/n,d.width/m),m*=p,n*=p,m>=d.width&&(e=(e+r.offsetX+(m*r.x-d.width*r.x)/m)*h),n>=d.height&&(f=(f+r.offsetY+(n*r.y-d.height*r.y)/n)*g),h*=1/(m/ d.width),g*=1/(n/d.height),m=d.width,n=d.height)}p=this.Of()*b.scale;var q=m*p*n*p,u=h*g/q,y=c.__goCache;p=null;var x=xo;if(c.rs&&void 0!==y&&4<q&&u>x*x)for(null===y.fj&&(yo(y,4,k,l,c),yo(y,16,k,l,c)),k=y.fj,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.rl){if(null===this.rm)if(null===this.kh)this.rm=!1;else{k=(new Jk(null)).context;k.drawImage(this.kh,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.rm=!1),this.rm=!1}catch(z){this.rm=!0}}if(this.rm)return}k=0;m<d.width&& (k=r.offsetX+(d.width*r.x-m*r.x));l=0;n<d.height&&(l=r.offsetY+(d.height*r.y-n*r.y));switch(this.flip){case il:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case hl:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case jl:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}a.ke();if(b.Ve("pictureRatioOptimization")&&!b.Di&&void 0!==y&&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(z){G&&this.ul&&Fa(z.toString()),this.ul=!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(z){G&&this.ul&&Fa(z.toString()),this.ul=!1}switch(this.flip){case il:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case hl:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case jl:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}}; fk.prototype.Om=function(a,b,c,d){var e=this.desiredSize,f=rl(this,!0),g=this.kh,h=this.Do;if(h||!this.Ql&&g&&g.complete)this.Ql=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===Cd||f===el?(isFinite(a)||(a=this.sourceRect.s()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.Ql&&(a=this.sourceRect.s()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===Cd||f===fl?(isFinite(b)||(b=this.sourceRect.s()?this.sourceRect.height: h?+g.height:g.naturalHeight),d=0):null!==g&&!1!==this.Ql&&(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));bc(this.wc,a,b);this.Ge(0,0,a,b)};fk.prototype.Ph=function(a,b,c,d){tl(this,a,b,c,d)}; na.Object.defineProperties(fk.prototype,{element:{configurable:!0,get:function(){return this.kh},set:function(a){var b=this.kh;if(b!==a){this.Do=a instanceof HTMLCanvasElement;var c=a instanceof HTMLImageElement;b instanceof HTMLImageElement&&hk(b);null===a||c||a instanceof HTMLVideoElement||this.Do||v("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);var d=this.diagram;null!==d&&gk(d,this);this.kh=a;null!==a&&c&&void 0===a.hh&&(a.hh=new I);null!==d&&c&&ek(d, this);null!==a&&(this.Do||!0===a.complete?(a.ro&&(a.Ao instanceof Event&&null!==this.rd?this.rd(this,a.Ao):!0===a.rs&&!a.Ao&&null!==this.Eh&&a.tv&&this.Eh(this,a.tv)),a.rs=!0,this.desiredSize.s()||(rj(this,!1),this.v())):c&&wo(this,a));this.g("element",b,a);this.R()}}},source:{configurable:!0,get:function(){return this.jq},set:function(a){var b=this.jq;if(b!==a){A(a,"string",fk,"source");this.jq=a;var c=uo;if(Xg){var d=null;if(void 0!==c[a])d=c[a];else if(""!==a){30<vo&&(Ki(),c=uo); d=va("img");d.ro=!0;wo(this,d);var e=this.km;null!==e&&(d.crossOrigin=e(this));d.src=a;c[a]=d;vo++}this.element=d;null!==d&&void 0===d.__goCache&&(d.__goCache=new zo);this.v();this.R()}this.g("source",b,a)}}},sourceCrossOrigin:{configurable:!0,get:function(){return this.km},set:function(a){if(this.km!==a&&(null!==a&&A(a,"function",fk,"sourceCrossOrigin"),this.km=a,null!==this.element)){var b=this.element.getAttribute("src");null===a&&"string"===typeof b?this.element.crossOrigin=null: null!==a&&(this.element.crossOrigin=a(this));this.element.src=b}}},sourceRect:{configurable:!0,get:function(){return this.Bh},set:function(a){var b=this.Bh;b.B(a)||(w(a,M,fk,"sourceRect"),this.Bh=a=a.L(),this.R(),this.g("sourceRect",b,a))}},imageStretch:{configurable:!0,get:function(){return this.Al},set:function(a){var b=this.Al;b!==a&&(eb(a,O,fk,"imageStretch"),this.Al=a,this.R(),this.g("imageStretch",b,a))}},flip:{configurable:!0,get:function(){return this.Wd}, set:function(a){var b=this.Wd;b!==a&&(eb(a,O,fk,"flip"),this.Wd=a,this.R(),this.g("flip",b,a))}},imageAlignment:{configurable:!0,get:function(){return this.zl},set:function(a){w(a,Eb,fk,"imageAlignment");var b=this.zl;b.B(a)||(this.zl=a=a.L(),this.R(),this.g("imageAlignment",b,a))}},errorFunction:{configurable:!0,get:function(){return this.rd},set:function(a){var b=this.rd;b!==a&&(null!==a&&A(a,"function",fk,"errorFunction"),this.rd=a,this.g("errorFunction",b,a))}},successFunction:{configurable:!0, enumerable:!0,get:function(){return this.Eh},set:function(a){var b=this.Eh;b!==a&&(null!==a&&A(a,"function",fk,"successFunction"),this.Eh=a,this.g("successFunction",b,a))}},naturalBounds:{configurable:!0,get:function(){return this.wc}}});fk.prototype.redraw=fk.prototype.redraw;fk.prototype.reloadSource=fk.prototype.bB;var uo=null,vo=0,xo=4;fk.className="Picture";uo=new gb;fk.clearCache=Ki;function zo(){this.fj=null} function yo(a,b,c,d,e){null===a.fj&&(a.fj=[]);var f=new Jk(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new Ao(f.Qa,b),c=1,0<a.fj.length&&(c=a.fj[a.fj.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.drawImage(e,0,0),a.fj.push(b))}zo.className="PictureCacheArray";function Ao(a,b){this.source=a;this.ratio=b}Ao.className="PictureCacheInstance";function Bo(){this.Pt=new N;this.mc=null} Bo.prototype.reset=function(a){null!==a?(a.ka(),this.Pt=a,a.figures.clear()):this.Pt=new N;this.mc=null};function Gd(a,b,c,d,e){a.mc=new le;a.mc.startX=b;a.mc.startY=c;a.mc.isFilled=d;a.Pt.figures.add(a.mc);void 0!==e&&(a.mc.isShadowed=e)}function Nd(a){var b=a.mc.segments.length;0<b&&a.mc.segments.M(b-1).close()}Bo.prototype.gn=function(a){this.mc.isShadowed=a};Bo.prototype.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new me(Qd);d.endX=a;d.endY=b;c&&d.close();this.mc.segments.add(d)}; Bo.prototype.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new me(Ed);d.endX=a;d.endY=b;c&&d.close();this.mc.segments.add(d)};function Hd(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new me(Rd);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.mc.segments.add(k)}function Id(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new me(Sd);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.mc.segments.add(g)} Bo.prototype.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new me(de);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.mc.segments.add(h)};function Jd(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new me(ee,g,h,b,c,d,e,f);k&&b.close();a.mc.segments.add(b)}function Fd(a){var b=Od;if(null!==b)return Od=null,b.reset(a),b;b=new Bo;b.reset(a);return b}var Od=null;Bo.className="StreamGeometryContext"; function Co(a,b){var c=a.toLowerCase(),d=K.qe;d[a]=b;d[c]=a}Co("Rectangle",function(a,b,c){a="r"+b+","+c;var d=K.Wf[a];if(void 0!==d)return d;d=new N(N.F);d.endX=b;d.endY=c;K.Xf<K.on&&(K.Wf[a]=d,K.Xf++);return d});Co("Square",function(a,b,c){a="s"+b+","+c;var d=K.Wf[a];if(void 0!==d)return d;d=new N(N.F);d.endX=b;d.endY=c;d.defaultStretch=rg;K.Xf<K.on&&(K.Wf[a]=d,K.Xf++);return d}); Co("RoundedRectangle",function(a,b,c){a=a?a.parameter1:NaN;if(isNaN(a)||0>a)a=5;a=Math.min(a,b/3);a=Math.min(a,c/3);var d="rr"+b+","+c+","+a,e=K.Wf[d];if(void 0!==e)return e;var f=a*K.Vg;e=(new N).add((new le(a,0,!0)).add(new me(Ed,b-a,0)).add(new me(Rd,b,a,b-f,0,b,f)).add(new me(Ed,b,c-a)).add(new me(Rd,b-a,c,b,c-f,b-f,c)).add(new me(Ed,a,c)).add(new me(Rd,0,c-a,f,c,0,c-f)).add(new me(Ed,0,a)).add((new me(Rd,a,0,0,f,f,0)).close()));1<f&&(e.spot1=new Eb(0,0,f,f),e.spot2=new Eb(1,1,-f,-f));K.Xf<K.on&& (K.Wf[d]=e,K.Xf++);return e});Co("Border","RoundedRectangle");Co("Ellipse",function(a,b,c){a="e"+b+","+c;var d=K.Wf[a];if(void 0!==d)return d;d=new N(N.P);d.endX=b;d.endY=c;d.spot1=pd;d.spot2=qd;K.Xf<K.on&&(K.Wf[a]=d,K.Xf++);return d});Co("Circle",function(a,b,c){a="c"+b+","+c;var d=K.Wf[a];if(void 0!==d)return d;d=new N(N.P);d.endX=b;d.endY=c;d.spot1=pd;d.spot2=qd;d.defaultStretch=rg;K.Xf<K.on&&(K.Wf[a]=d,K.Xf++);return d}); Co("TriangleRight",function(a,b,c){return(new N).add((new le(0,0)).add(new me(Ed,b,.5*c)).add((new me(Ed,0,c)).close())).hn(0,.25,.5,.75)});Co("TriangleDown",function(a,b,c){return(new N).add((new le(0,0)).add(new me(Ed,b,0)).add((new me(Ed,.5*b,c)).close())).hn(.25,0,.75,.5)});Co("TriangleLeft",function(a,b,c){return(new N).add((new le(b,c)).add(new me(Ed,0,.5*c)).add((new me(Ed,b,0)).close())).hn(.5,.25,1,.75)}); Co("TriangleUp",function(a,b,c){return(new N).add((new le(b,c)).add(new me(Ed,0,c)).add((new me(Ed,.5*b,0)).close())).hn(.25,.5,.75,1)});Co("Triangle","TriangleUp");Co("Diamond",function(a,b,c){return(new N).add((new le(.5*b,0)).add(new me(Ed,0,.5*c)).add(new me(Ed,.5*b,c)).add((new me(Ed,b,.5*c)).close())).hn(.25,.25,.75,.75)});Co("LineH",function(a,b,c){a=new N(N.j);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a}); Co("LineV",function(a,b,c){a=new N(N.j);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});Co("None","Rectangle");Co("BarH","Rectangle");Co("BarV","Rectangle");Co("MinusLine","LineH");Co("PlusLine",function(a,b,c){return(new N).add((new le(0,c/2,!1)).add(new me(Ed,b,c/2)).add(new me(Qd,b/2,0)).add(new me(Ed,b/2,c)))});Co("XLine",function(a,b,c){return(new N).add((new le(0,c,!1)).add(new me(Ed,b,0)).add(new me(Qd,0,0)).add(new me(Ed,b,c)))}); K.nn={"":"",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 U(a,b){void 0===a||a instanceof Ul||"string"===typeof a?W.call(this,a):(W.call(this),a&&(b=a));this.G=2408959;this.th=this.$f="";this.Op=this.Kp=this.Zp=this.Qo=null;this.aq="";this.Yf=this.Bo=this.$p=this.Ah=null;this.Mp="";this.Lp=Yb;this.Zb=this.Pp="";this.Ki=this.Jn=this.si=null;this.ng=(new J(NaN,NaN)).freeze();this.Xo="";this.pf=null;this.Yo=Dc;this.Qp=ed;this.hp=Mb;this.Zo=Nb;this.ao=null;this.Ro=127;this.gq=Ob;this.fq="gray";this.Eg=4;this.Fx=-1;this.Cq=NaN;this.lz=new M;this.ck= null;this.vh=NaN;b&&Object.assign(this,b)}ma(U,W); U.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);a.G=this.G&-4097|49152;a.$f=this.$f;a.th=this.th;a.Qo=this.Qo;a.Zp=this.Zp;a.Kp=this.Kp;a.Op=this.Op;a.aq=this.aq;a.$p=this.$p;a.Bo=this.Bo;a.Yf=null;a.Mp=this.Mp;a.Lp=this.Lp.L();a.Pp=this.Pp;a.Qp=this.Qp.L();a.Zb=this.Zb;a.Jn=this.Jn;a.ng.assign(this.ng);a.Xo=this.Xo;a.Yo=this.Yo.L();a.hp=this.hp.L();a.Zo=this.Zo.L();a.ao=this.ao;a.Ro=this.Ro;a.gq=this.gq.L();a.fq=this.fq;a.Eg=this.Eg;a.Cq=this.Cq}; U.prototype.Kf=function(a){W.prototype.Kf.call(this,a);a.Wh();a.Ah=null;a.pf=null;a.ck=null};U.prototype.toString=function(){var a=Pa(this.constructor)+"#"+mb(this);null!==this.data&&(a+="("+Qa(this.data)+")");return a};U.prototype.Sk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===ue&&"elements"===b?e instanceof W?Jj(e,function(a){Lj(h.partManager,a);Kj(h,a)}):ek(h,e):a===ve&&"elements"===b&&(e instanceof W?Jj(e,function(a){Oj(h.partManager,a,h)}):gk(h,e)),h.ab(a,b,c,d,e,f,g))}; U.prototype.Ia=function(a){W.prototype.Ia.call(this,a);if(null!==this.data){for(var b=this.$.l,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof W&&Jj(e,function(a){null!==a.data&&a.Ia()})}for(b=this.adornments;b.next();)b.value.Ia(a)}};U.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};U.prototype.Bk=function(a){G&&A(a,"string",U,"findAdornment:category");var b=this.Yf;return null===b?null:b.K(a)}; U.prototype.Nh=function(a,b){if(null!==b){G&&(A(a,"string",U,"addAdornment:category"),w(b,Le,U,"addAdornment:ad"));var c=null,d=this.Yf;null!==d&&(c=d.K(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Yf=d=new zb);b.$f!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.jj(),null!==a&&(b.data=a.data)))}}}; U.prototype.Tf=function(a){G&&A(a,"string",U,"removeAdornment:category");var b=this.Yf;if(null!==b){var c=b.K(a);if(null!==c){var d=c.diagram;null!==d&&d.remove(c)}b.remove(a);0===b.count&&(this.Yf=null)}};U.prototype.tk=function(){var a=this.Yf;if(null!==a){var b=Ma();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.Tf(b[c]);Oa(b)}}; U.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.v();c.placeholder&&c.placeholder.v()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.s()&&this.isVisible()&&b.Sf()&&b.actualBounds.s())){c=this.Bk("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Xh()?a.linkSelectionAdornmentTemplate:this instanceof yf?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate); if(!(c instanceof Le))break a;og(c);c=c.copy();null!==c&&(this.Xh()&&this.selectionObject===this.path&&(c.type=W.Link),c.adornedObject=b)}if(null!==c){c.type===W.Link&&c.v();this.Nh("Selection",c);break a}}this.Tf("Selection")}Do(this,a);for(b=this.adornments;b.next();)b.value.Ia()}};U.prototype.Qb=function(){var a=this.diagram;null!==a&&($i(a),0!==(this.G&16384)!==!0&&(this.G|=16384,a.Kb()))};function pi(a){0!==(a.G&16384)!==!1&&(a.updateAdornments(),a.G&=-16385)} function Do(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function Eo(a){if(!1===yj(a)){Fo(a,!0);a.Hl();var b=a.diagram;null!==b&&(b.be.add(a),b.Kb())}}function Go(a){a.G|=2097152;if(!1!==yj(a)){var b=a.position,c=a.location;c.s()&&b.s()||Ho(a,b,c);c=a.Ab;var d=M.alloc().assign(c);c.ka();c.x=b.x;c.y=b.y;c.freeze();a.Pm(d,c);M.free(d);Fo(a,!1)}} U.prototype.Ge=function(a,b,c,d){var e=this.pc;e.h(a,b,c,d);null===this.Fb&&(this.Fb=new Fb);var f=this.Fb;f.reset();this.eq(f,a,b,c,d);this.Fb=f;f.Zt()||f.pr(e)}; U.prototype.eq=function(a,b,c,d,e){1!==this.wa&&a.scale(this.wa);if(0!==this.Cb){var f=Jc;this.locationSpot.fb()&&(f=this.locationSpot);var g=J.alloc();if(this.locationObject!==this)for(b=this.locationObject,c=b.naturalBounds,g.zj(c.x,c.y,c.width,c.height,f),null!==b.Fb&&b.Fb.Fa(g),g.offset(-b.measuredBounds.x,-b.measuredBounds.y),f=b.panel;null!==f&&f!==this;)null!==f.Fb&&f.Fb.Fa(g),g.offset(-f.measuredBounds.x,-f.measuredBounds.y),f=f.panel;else g.zj(b,c,d,e,f);a.rotate(this.Cb,g.x,g.y);J.free(g)}}; U.prototype.move=function(a,b){!0===b?this.location=a:this.position=a};U.prototype.moveTo=function(a,b,c){a=J.allocAt(a,b);this.move(a,c);J.free(a)};U.prototype.isVisible=function(){if(!this.visible)return!1;var a=this.layer;if(null!==a){if(!a.visible)return!1;a=a.diagram;if(null!==a&&a.animationManager.hu(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1}; U.prototype.Sb=function(a){var b=this.diagram;a?(this.C(4),this.Qb(),null!==b&&b.be.add(this)):(this.C(8),this.tk());this.Wh();null!==b&&(b.Va(),b.R())};U.prototype.eb=function(a){if(this.name===a)return this;var b=this.ck;null===b&&(this.ck=b=new zb);if(null!==b.K(a))return b.K(a);var c=W.prototype.eb.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null}; function Io(a,b,c,d){void 0===d&&(d=new J);c=c.bc()?Jc:c;var e=b.naturalBounds;d.h(e.width*c.x+c.offsetX,e.height*c.y+c.offsetY);if(null===b||b===a)return d;b.transform.Fa(d);for(b=b.panel;null!==b&&b!==a;)b.transform.Fa(d),b=b.panel;null!==a.Fb&&a.Fb.Fa(d);d.offset(-a.pc.x,-a.pc.y);return d}U.prototype.pj=function(a){void 0===a&&(a=new M);return a.assign(this.actualBounds)};U.prototype.Xa=function(){!0===wj(this)&&this.measure(Infinity,Infinity);this.arrange()}; function Hj(a,b){var c=a.lz;isNaN(a.vh)&&(a.vh=nn(a));var d=a.vh;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} U.prototype.arrange=function(){if(!1===xj(this))Go(this);else{sl(this,!1);var a=this.Ab,b=M.alloc();b.assign(a);var c=mg(this);this.Ph(0,0,this.pc.width,this.pc.height);var d=this.position;Ho(this,d,this.location);a.ka();a.x=d.x;a.y=d.y;a.freeze();this.Pm(b,a);b.B(a)?this.Qd(c):!this.Uc()||K.A(b.width,a.width)&&K.A(b.height,a.height)||0<=this.Fx&&this.C(16);M.free(b);Fo(this,!1)}};t=U.prototype; t.Pm=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.Ai&&a.s()){var e=M.alloc();e.assign(c.documentBounds);e.Pw(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);M.free(e)}0!==(this.G&65536)!==!0&&a.B(b)||Mj(this,d,c);c.R();!a.s()&&!b.s()||ec(a,b)||(this instanceof V&&!c.undoManager.isUndoingRedoing&&this.xd(),this.Wh())}}; t.Lw=function(a,b,c){if(this.Xh()||!a.s())return!1;var d=this.diagram;null!==d&&Jo(this,d,a,b,c);this.oa=a;this.G&=-2097153;var e=this.ng;!e.s()||null!==d&&!d.animationManager.isTicking&&d.undoManager.isUndoingRedoing||(d=e.copy(),e.h(e.x+(a.x-b),e.y+(a.y-c)),this.g("location",d,e.copy()));!1===yj(this)&&!1===xj(this)&&(Eo(this),Go(this));return!0};function Jo(a,b,c,d,e){null===b||a instanceof Le||(b=b.animationManager,b.rf&&Sh(b,a,new J(d,e),c))} t.dn=function(a,b,c){var d=this.ng,e=this.oa;if(c){if(d.x===a&&d.y===b)return;yj(this)||xj(this)?e.h(NaN,NaN):e.h(e.x+a-d.x,e.y+b-d.y);d.h(a,b)}else{if(e.x===a&&e.y===b)return;yj(this)||xj(this)?this.ru():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}Eo(this)};t.ru=function(){this.G&=-2097153;Eo(this)}; function Ho(a,b,c){var d=J.alloc(),e=a.locationObject,f=e.naturalBounds,g=e instanceof Kf?e.strokeWidth:0;d.zj(0,0,f.width+g,f.height+g,a.locationSpot);if(e!==a)for(d.offset(-g/2,-g/2),e.transform.Fa(d),e=e.panel;null!==e&&e!==a;)e.transform.Fa(d),e=e.panel;null!==a.Fb&&a.Fb.Fa(d);d.offset(-a.pc.x,-a.pc.y);e=a.diagram;f=c.s();g=b.s();f&&g?0!==(a.G&2097152)?Ko(a,b,c,e,d):Lo(a,b,c,e,d):f?Ko(a,b,c,e,d):g&&Lo(a,b,c,e,d);a.G|=2097152;J.free(d);a.Hl()} function Ko(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,(d=c.defaultAnimation.isAnimating)||!c.rf||a instanceof Le||Sh(c,a,new J(f,g),b),d||b.x===f&&b.y===g||a.g("position",new J(f,g),b.copy()))}function Lo(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.B(f)||null===d||a.g("location",f,c.copy())} function Mj(a,b,c){ul(a,!1);a instanceof V&&Ek(c,a);a.layer.isTemporary||b||c.Va();b=a.Ab;var d=c.viewportBounds;d.s()?mg(a)?(ic(b,d)||a.Qd(!1),a.updateAdornments()):b.Tc(d)?(a.Qd(!0),a.updateAdornments()):a.Qb():c.Ci=!0}t.wj=function(){return!0};t.Uc=function(){return!0};t.Xh=function(){return!1};t.vj=function(){return!0}; function Mo(a,b,c,d){b.constructor===a.constructor||No||(No=!0,Fa('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),Fa(" Old class: "+Pa(a.constructor)+", new class: "+Pa(b.constructor)+", part: "+a.toString()));a.tk();var e=a.data;c=a.layerName;var f=a.isSelected,g=a.isHighlighted,h=!0,k=!0,l=!1;a instanceof V&&(h=a.isTreeLeaf,k=a.isTreeExpanded,l=a.wasTreeExpanded);b.Kf(a);b.cloneProtected(a);a.$f=d;a.v();a.R();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager, b.skipsUndoManager=!0);a.qb=e;a.G=f?a.G|4096:a.G&-4097;a.G=g?a.G|524288:a.G&-524289;a instanceof V&&(a.U=h?a.U|4:a.U&-5,a.U=k?a.U|1:a.U&-2,a.U=l?a.U|2:a.U&-3);null!==e&&a.Ia();e=a.layerName;e!==c&&(a.th=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.Uc()&&a.C(64)}U.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}; U.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};U.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}; U.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};U.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}; U.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};U.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}; U.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};U.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 yj(a){return 0!==(a.G&32768)}function Fo(a,b){a.G=b?a.G|32768:a.G&-32769}function ul(a,b){a.G=b?a.G|65536:a.G&-65537} function mg(a){return 0!==(a.G&131072)}t=U.prototype;t.Qd=function(a){this.G=a?this.G|131072:this.G&-131073};function Oo(a,b){a.G=b?a.G|1048576:a.G&-1048577}t.Wh=function(){var a=this.containingGroup;null!==a&&(a.v(),null!==a.placeholder&&a.placeholder.v(),a.xd())};t.R=function(){var a=this.diagram;null!==a&&!xj(this)&&!yj(this)&&this.isVisible()&&this.Ab.s()&&a.R(Hj(this,this.Ab))}; t.v=function(){W.prototype.v.call(this);var a=this.diagram;null!==a&&(a.be.add(this),this instanceof V&&null!==this.labeledLink&&Jl(this.labeledLink),a.Kb(!0))};t.Uq=function(a){a||(a=this.si,null!==a&&Po(a,this))};t.Vq=function(a){a||(a=this.si,null!==a&&Qo(a,this))};t.zk=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.Um(a))}};t.lA=function(){return Ro(this,this)}; function Ro(a,b){var c=b.containingGroup;return null!==c?1+Ro(a,c):b instanceof V&&(b=b.labeledLink,null!==b)?Ro(a,b):0}t.pA=function(){return So(this,this)};function So(a,b){var c=b.containingGroup;return null!==c||b instanceof V&&(c=b.labeledLink,null!==c)?So(a,c):b}t.Nd=function(a){return a instanceof yf?To(this,this,a):!1};function To(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!To(a,d,c)?b instanceof V&&(b=b.labeledLink,null!==b)?To(a,b,c):!1:!0} t.ty=function(a){if(null===a)return null;G&&w(a,U,U,"findCommonContainingGroup:other");if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof yf&&Oo(b,!0);if(b instanceof V){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.G&1048576)){c=b;break}b instanceof V&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof yf&&Oo(b,!1),b instanceof V&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c}; U.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof V&&this.isLinkLabel?!1:!0}; U.prototype.C=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof V&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.si,null!==b){var c=b.layout;null!==c?c.C():b.C(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.C())};function Nj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0} function al(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof Le))if(a.add(b),b instanceof V){if(c&&b instanceof yf)for(var g=b.memberParts;g.next();)al(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)&&al(a,h,c,d,e,f)}}if(1<d)for(b=b.dw();b.next();)al(a,b.value,c,d-1,e,f)}else if(b instanceof T)for(b=b.labelNodes;b.next();)al(a, b.value,c,d,e,f)} na.Object.defineProperties(U.prototype,{key:{configurable:!0,get:function(){var a=this.diagram;if(null!==a)return a.model.va(this.data)}},adornments:{configurable:!0,get:function(){return null===this.Yf?ib:this.Yf.iteratorValues}},layer:{configurable:!0,get:function(){return this.Ki}},diagram:{configurable:!0,get:function(){var a=this.Ki;return null===a||void 0===a?null:a.diagram}},layerName:{configurable:!0,get:function(){return this.th},set:function(a){var b= this.th;if(b!==a){A(a,"string",U,"layerName");var c=this.diagram;if(null===c||null!==c.Ck(a)&&!c.partManager.addsToTemporaryLayer)if(this.th=a,null!==c&&c.Va(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.Ck(a),null!==a&&a!==b))){var d=b.Sc(-1,this,!0);0<=d&&c.ab(ve,"parts",b,this,null,d,!0);d=a.rj(99999999,this,!0);b.visible!==a.visible&&this.Sb(a.visible);0<=d&&c.ab(ue,"parts",a,null,this,!0,d);d=this.layerChanged;if(null!==d){var e=c.ba;c.ba=!0;d(this, b,a);c.ba=e}}}}},layerChanged:{configurable:!0,get:function(){return this.Qo},set:function(a){var b=this.Qo;b!==a&&(null!==a&&A(a,"function",U,"layerChanged"),this.Qo=a,this.g("layerChanged",b,a))}},zOrder:{configurable:!0,get:function(){return this.Cq},set:function(a){var b=this.Cq;if(b!==a){A(a,"number",U,"zOrder");this.Cq=a;var c=this.layer;null!==c&&si(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.R()}}},locationObject:{configurable:!0,get:function(){if(null=== this.pf){var a=this.locationObjectName;""!==a?(a=this.eb(a),null!==a?this.pf=a:this.pf=this):this instanceof Le?this.type!==W.Link&&null!==this.placeholder?this.pf=this.placeholder:this.pf=this:this.pf=this}return this.pf.visible?this.pf:this}},minLocation:{configurable:!0,get:function(){return this.hp},set:function(a){var b=this.hp;b.B(a)||(G&&w(a,J,U,"minLocation"),this.hp=a=a.L(),this.g("minLocation",b,a))}},maxLocation:{configurable:!0,get:function(){return this.Zo}, set:function(a){var b=this.Zo;b.B(a)||(G&&w(a,J,U,"maxLocation"),this.Zo=a=a.L(),this.g("maxLocation",b,a))}},locationObjectName:{configurable:!0,get:function(){return this.Xo},set:function(a){var b=this.Xo;b!==a&&(G&&A(a,"string",U,"locationObjectName"),this.Xo=a,this.pf=null,this.v(),this.g("locationObjectName",b,a))}},locationSpot:{configurable:!0,get:function(){return this.Yo},set:function(a){var b=this.Yo;b.B(a)||(G&&(w(a,Eb,U,"locationSpot"),a.fb()||v("Part.locationSpot must be a specific Spot value, not: "+ a)),this.Yo=a=a.L(),this.v(),this.g("locationSpot",b,a))}},location:{configurable:!0,get:function(){return this.ng},set:function(a){G&&w(a,J,U,"location");var b=a.x,c=a.y,d=this.ng;if(!(d.x===b||isNaN(d.x)&&isNaN(b))||!(d.y===c||isNaN(d.y)&&isNaN(c))){a=a.copy();b=a;if(this.Xh())b=!1;else{this.ng=b;this.G|=2097152;if(!1===xj(this)&&(Eo(this),c=this.oa,c.s())){var e=this.diagram;if(null===e||e.animationManager.isTicking||!e.undoManager.isUndoingRedoing){var f=c.copy();c.h(c.x+(b.x-d.x), c.y+(b.y-d.y));Jo(this,e,c,f.x,f.y);this.g("position",f,c.copy())}}b=!0}b&&this.g("location",d,a.copy())}}},category:{configurable:!0,get:function(){return this.$f},set:function(a){var b=this.$f;if(b!==a){A(a,"string",U,"category");var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&!(this instanceof Le)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.$.addAll(this.$))}this.$f=a;this.g("category",b,a);null===c||null===d||this instanceof Le?this instanceof Le&&(e=this.adornedPart,null!==e&&(a=e.Yf,null!==a&&a.remove(b),e.Nh(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.Xh()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(og(c),c=c.copy(),null!==c&&Mo(this,c,b,a))):(null!==f&&f.an(d,a),c=Uo(c.partManager,d,a),null!==c&&(og(c),c=c.copy(),null===c||c instanceof T||(d=this.location.copy(),Mo(this,c,b,a),this.location.s()||(this.location=d)))),null!==e&&(b=this.clone(),b.$.addAll(this.$), this.g("self",e,b))))}}},self:{configurable:!0,get:function(){return this},set:function(a){Mo(this,a,this.category,a.category)}},copyable:{configurable:!0,get:function(){return 0!==(this.G&1)},set:function(a){var b=0!==(this.G&1);b!==a&&(G&&A(a,"boolean",U,"copyable"),this.G^=1,this.g("copyable",b,a))}},deletable:{configurable:!0,get:function(){return 0!==(this.G&2)},set:function(a){var b=0!==(this.G&2);b!==a&&(G&&A(a,"boolean",U,"deletable"),this.G^=2,this.g("deletable", b,a))}},textEditable:{configurable:!0,get:function(){return 0!==(this.G&4)},set:function(a){var b=0!==(this.G&4);b!==a&&(G&&A(a,"boolean",U,"textEditable"),this.G^=4,this.g("textEditable",b,a),this.Qb())}},groupable:{configurable:!0,get:function(){return 0!==(this.G&8)},set:function(a){var b=0!==(this.G&8);b!==a&&(G&&A(a,"boolean",U,"groupable"),this.G^=8,this.g("groupable",b,a))}},movable:{configurable:!0,get:function(){return 0!==(this.G&16)},set:function(a){var b= 0!==(this.G&16);b!==a&&(G&&A(a,"boolean",U,"movable"),this.G^=16,this.g("movable",b,a))}},selectionAdorned:{configurable:!0,get:function(){return 0!==(this.G&32)},set:function(a){var b=0!==(this.G&32);b!==a&&(G&&A(a,"boolean",U,"selectionAdorned"),this.G^=32,this.g("selectionAdorned",b,a),this.Qb())}},isInDocumentBounds:{configurable:!0,get:function(){return 0!==(this.G&64)},set:function(a){var b=0!==(this.G&64);if(b!==a){G&&A(a,"boolean",U,"isInDocumentBounds");this.G^= 64;var c=this.diagram;null!==c&&c.Va();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{configurable:!0,get:function(){return 0!==(this.G&128)},set:function(a){var b=0!==(this.G&128);b!==a&&(G&&A(a,"boolean",U,"isLayoutPositioned"),this.G^=128,this.g("isLayoutPositioned",b,a),this.C(a?4:8))}},selectable:{configurable:!0,get:function(){return 0!==(this.G&256)},set:function(a){var b=0!==(this.G&256);b!==a&&(G&&A(a,"boolean",U,"selectable"),this.G^=256,this.g("selectable", b,a),this.Qb())}},reshapable:{configurable:!0,get:function(){return 0!==(this.G&512)},set:function(a){var b=0!==(this.G&512);b!==a&&(G&&A(a,"boolean",U,"reshapable"),this.G^=512,this.g("reshapable",b,a),this.Qb())}},resizable:{configurable:!0,get:function(){return 0!==(this.G&1024)},set:function(a){var b=0!==(this.G&1024);b!==a&&(G&&A(a,"boolean",U,"resizable"),this.G^=1024,this.g("resizable",b,a),this.Qb())}},rotatable:{configurable:!0,get:function(){return 0!== (this.G&2048)},set:function(a){var b=0!==(this.G&2048);b!==a&&(G&&A(a,"boolean",U,"rotatable"),this.G^=2048,this.g("rotatable",b,a),this.Qb())}},isSelected:{configurable:!0,get:function(){return 0!==(this.G&4096)},set:function(a){var b=0!==(this.G&4096);if(b!==a){G&&A(a,"boolean",U,"isSelected");var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.maxSelectionCount)){this.G^=4096;var d=!1;if(null!==c){d=c.skipsUndoManager;c.skipsUndoManager=!0;var e=c.selection; e.ka();a?e.add(this):e.remove(this);e.freeze()}this.g("isSelected",b,a);this.Qb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Kb(),c.skipsUndoManager=d)}}}},isHighlighted:{configurable:!0,get:function(){return 0!==(this.G&524288)},set:function(a){var b=0!==(this.G&524288);if(b!==a){G&&A(a,"boolean",U,"isHighlighted");this.G^=524288;var c=this.diagram;null!==c&&(c=c.highlighteds,c.ka(),a?c.add(this):c.remove(this),c.freeze());this.g("isHighlighted",b,a);this.R();a=this.highlightedChanged; null!==a&&a(this)}}},isShadowed:{configurable:!0,get:function(){return 0!==(this.G&8192)},set:function(a){var b=0!==(this.G&8192);b!==a&&(G&&A(a,"boolean",U,"isShadowed"),this.G^=8192,this.g("isShadowed",b,a),this.R())}},isAnimated:{configurable:!0,get:function(){return 0!==(this.G&262144)},set:function(a){var b=0!==(this.G&262144);b!==a&&(G&&A(a,"boolean",U,"isAnimated"),this.G^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{configurable:!0,get:function(){return this.Bo}, set:function(a){var b=this.Bo;b!==a&&(null!==a&&A(a,"function",U,"highlightedChanged"),this.Bo=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{configurable:!0,get:function(){return this.aq},set:function(a){var b=this.aq;b!==a&&(G&&A(a,"string",U,"selectionObjectName"),this.aq=a,this.Ah=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{configurable:!0,get:function(){return this.Zp},set:function(a){var b=this.Zp;b!==a&&(G&&w(a,Le,U,"selectionAdornmentTemplate"), this.Zp=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{configurable:!0,get:function(){if(null===this.Ah){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.eb(a),null!==a?this.Ah=a:this.Ah=this):this instanceof T?(a=this.path,null!==a?this.Ah=a:this.Ah=this):this.Ah=this}return this.Ah}},selectionChanged:{configurable:!0,get:function(){return this.$p},set:function(a){var b=this.$p;b!==a&&(null!==a&&A(a,"function",U,"selectionChanged"),this.$p=a,this.g("selectionChanged", b,a))}},resizeAdornmentTemplate:{configurable:!0,get:function(){return this.Kp},set:function(a){var b=this.Kp;b!==a&&(G&&w(a,Le,U,"resizeAdornmentTemplate"),this.Kp=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{configurable:!0,get:function(){return this.Mp},set:function(a){var b=this.Mp;b!==a&&(G&&A(a,"string",U,"resizeObjectName"),this.Mp=a,this.g("resizeObjectName",b,a))}},resizeObject:{configurable:!0,get:function(){var a=this.resizeObjectName; return""!==a&&(a=this.eb(a),null!==a)?a:this}},resizeCellSize:{configurable:!0,get:function(){return this.Lp},set:function(a){var b=this.Lp;b.B(a)||(G&&w(a,Db,U,"resizeCellSize"),this.Lp=a=a.L(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{configurable:!0,get:function(){return this.Op},set:function(a){var b=this.Op;b!==a&&(G&&w(a,Le,U,"rotateAdornmentTemplate"),this.Op=a,this.g("rotateAdornmentTemplate",b,a))}},rotateObjectName:{configurable:!0, get:function(){return this.Pp},set:function(a){var b=this.Pp;b!==a&&(G&&A(a,"string",U,"rotateObjectName"),this.Pp=a,this.g("rotateObjectName",b,a))}},rotateObject:{configurable:!0,get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.eb(a),null!==a)?a:this}},rotationSpot:{configurable:!0,get:function(){return this.Qp},set:function(a){var b=this.Qp;b.B(a)||(G&&(w(a,Eb,U,"rotationSpot"),a===ed||a.fb()||v("Part.rotationSpot must be a specific Spot value or Spot.Default, not: "+ a)),this.Qp=a=a.L(),this.g("rotationSpot",b,a))}},text:{configurable:!0,get:function(){return this.Zb},set:function(a){var b=this.Zb;b!==a&&(G&&A(a,"string",U,"text"),this.Zb=a,this.g("text",b,a))}},containingGroup:{configurable:!0,get:function(){return this.si},set:function(a){if(this.Uc()){var b=this.si;if(b!==a){G&&null!==a&&w(a,yf,U,"containingGroup");null===a||this!==a&&!a.Nd(this)||(this===a&&v("Cannot make a Group a member of itself: "+this.toString()),v("Cannot make a Group indirectly contain itself: "+ this.toString()+" already contains "+a.toString()));this.C(2);var c=this.diagram;null!==b?Qo(b,this):this instanceof yf&&null!==c&&c.Kh.remove(this);this.si=a;null!==a?Po(a,this):this instanceof yf&&null!==c&&c.Kh.add(this);this.C(1);if(null!==c&&c.ba){var d=this.data,e=c.model;if(null!==d&&e.sj()){var f=e.va(null!==a?a.data:null);e.lr(d,f)}}d=this.containingGroupChanged;null!==d&&(e=!0,null!==c&&(e=c.ba,c.ba=!0),d(this,b,a),null!==c&&(c.ba=e));if(this instanceof yf)for(c=new I,al(c,this,!0,0,!0), c=c.iterator;c.next();)if(d=c.value,d instanceof V)for(d=d.linksConnected;d.next();)Vo(d.value);if(this instanceof V){for(c=this.linksConnected;c.next();)Vo(c.value);c=this.labeledLink;null!==c&&Vo(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&si(b,-1,a))}}else v("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{configurable:!0,get:function(){return this.Jn},set:function(a){var b=this.Jn;b!==a&&(null!==a&&A(a,"function",U,"containingGroupChanged"), this.Jn=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{configurable:!0,get:function(){return null!==this.containingGroup||this instanceof V&&null!==this.labeledLink?!1:!0}},layoutConditions:{configurable:!0,get:function(){return this.Ro},set:function(a){var b=this.Ro;b!==a&&(G&&A(a,"number",U,"layoutConditions"),this.Ro=a,this.g("layoutConditions",b,a))}},dragComputation:{configurable:!0,get:function(){return this.ao},set:function(a){var b=this.ao; b!==a&&(null!==a&&A(a,"function",U,"dragComputation"),this.ao=a,this.g("dragComputation",b,a))}},shadowOffset:{configurable:!0,get:function(){return this.gq},set:function(a){var b=this.gq;b.B(a)||(G&&w(a,J,U,"shadowOffset"),this.gq=a=a.L(),this.R(),this.g("shadowOffset",b,a))}},shadowColor:{configurable:!0,get:function(){return this.fq},set:function(a){var b=this.fq;b!==a&&(G&&A(a,"string",U,"shadowColor"),this.fq=a,this.R(),this.g("shadowColor",b,a))}},shadowBlur:{configurable:!0, enumerable:!0,get:function(){return this.Eg},set:function(a){var b=this.Eg;b!==a&&(G&&A(a,"number",U,"shadowBlur"),this.Eg=a,this.R(),this.g("shadowBlur",b,a))}}});U.prototype.invalidateLayout=U.prototype.C;U.prototype.findCommonContainingGroup=U.prototype.ty;U.prototype.isMemberOf=U.prototype.Nd;U.prototype.findTopLevelPart=U.prototype.pA;U.prototype.findSubGraphLevel=U.prototype.lA;U.prototype.ensureBounds=U.prototype.Xa;U.prototype.getDocumentBounds=U.prototype.pj;U.prototype.findObject=U.prototype.eb; U.prototype.moveTo=U.prototype.moveTo;U.prototype.invalidateAdornments=U.prototype.Qb;U.prototype.clearAdornments=U.prototype.tk;U.prototype.removeAdornment=U.prototype.Tf;U.prototype.addAdornment=U.prototype.Nh;U.prototype.findAdornment=U.prototype.Bk;U.prototype.updateTargetBindings=U.prototype.Ia;var No=!1;U.className="Part";U.LayoutNone=0;U.LayoutAdded=1;U.LayoutRemoved=2;U.LayoutShown=4;U.LayoutHidden=8;U.LayoutNodeSized=16;U.LayoutGroupLayout=32;U.LayoutNodeReplaced=64;U.LayoutStandard=127; U.LayoutAll=16777215;function Le(a,b){void 0===a||a instanceof Ul||"string"===typeof a?U.call(this,a):(U.call(this),a&&(b=a));this.G&=-257;this.th="Adornment";this.re=null;this.Jx=0;this.Xx=!1;this.j=a instanceof Tm?[]:Wo;this.Sa=null;b&&Object.assign(this,b)}ma(Le,U);Le.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};Le.prototype.updateRelationshipsFromData=function(){}; Le.prototype.Kk=function(a){var b=this.adornedObject.part;if(b instanceof T&&this.adornedObject instanceof Kf){var c=b.path;b.Kk(a);a=c.geometry;b=this.$.l;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof Kf&&(e.sa=a)}}};Le.prototype.wj=function(){var a=this.re;if(null===a)return!0;a=a.part;return null===a||!xj(a)};Le.prototype.Uc=function(){return!1}; Le.prototype.Sk=function(a,b,c,d,e,f,g){if(a===ue&&"elements"===b)if(e instanceof ng)null===this.Sa?this.Sa=e:G&&this.Sa!==e&&v("Cannot insert a second Placeholder into the visual tree of an Adornment.");else{if(e instanceof W){var h=e.Fm(function(a){return a instanceof ng});h instanceof ng&&(null===this.Sa?this.Sa=h:G&&this.Sa!==h&&v("Cannot insert a second Placeholder into the visual tree of an Adornment."))}}else a===ve&&"elements"===b&&null!==this.Sa&&(d===this.Sa?this.Sa=null:d instanceof W&& this.Sa.Qg(d)&&(this.Sa=null));U.prototype.Sk.call(this,a,b,c,d,e,f,g)};Le.prototype.updateAdornments=function(){};Le.prototype.zk=function(){}; na.Object.defineProperties(Le.prototype,{placeholder:{configurable:!0,get:function(){return this.Sa}},adornedObject:{configurable:!0,get:function(){return this.re},set:function(a){G&&null!==a&&w(a,O,U,"adornedObject:value");var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Tf(this.category);this.re=a;null!==c&&c.Nh(this.category,this)}},adornedPart:{configurable:!0,get:function(){var a=this.re;return null!==a?a.part:null}},containingGroup:{configurable:!0, enumerable:!0,get:function(){return null}}});var Wo=[];Le.className="Adornment";function V(a,b){void 0===a||a instanceof Ul||"string"===typeof a?U.call(this,a):(U.call(this),a&&(b=a));this.U=13;this.ib=new H;this.wq=this.Ml=this.Ni=this.To=this.So=null;this.bl=Bc;this.zc=this.cf=null;this.Hp=Xo;this.Lh=!1;b&&Object.assign(this,b)}ma(V,U); V.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.U=this.U;a.U=this.U&-17;a.So=this.So;a.To=this.To;a.Ni=this.Ni;a.wq=this.wq;a.bl=this.bl.L();a.Hp=this.Hp};t=V.prototype;t.Kf=function(a){U.prototype.Kf.call(this,a);a.xd();a.cf=this.cf;a.zc=null};function Yo(a,b){null!==b&&(null===a.cf&&(a.cf=new I),a.cf.add(b))} function Zo(a,b,c,d){if(null===b||null===a.cf)return null;for(var e=a.cf.iterator;e.next();){var f=e.value;if(f.fu===a&&f.tw===b&&f.Ry===c&&f.Sy===d||f.fu===b&&f.tw===a&&f.Ry===d&&f.Sy===c)return f}return null}t.IA=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=Zo(this,a,b,c);null!==a&&a.Km()};t.Sk=function(a,b,c,d,e,f,g){a===ue&&"elements"===b?this.zc=null:a===ve&&"elements"===b&&(this.zc=null);U.prototype.Sk.call(this,a,b,c,d,e,f,g)}; t.xd=function(a){void 0===a&&(a=null);for(var b=this.linksConnected;b.next();){var c=b.value;null!==a&&a.contains(c)||($o(c.fromPort),$o(c.toPort),c.Za())}};function vl(a,b){for(a=a.linksConnected;a.next();){var c=a.value;if(c.fromPort===b||c.toPort===b)$o(c.fromPort),$o(c.toPort),c.Za()}}function $o(a){if(null!==a){var b=a.Gp;null!==b&&b.Km();a=a.part;b=a.containingGroup;null===b||a.isVisible()||$o(b.port)}}t.wj=function(){return!0}; V.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.Dq(this.bl);return a};V.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a}; V.prototype.isVisible=function(){if(!U.prototype.isVisible.call(this))return!1;var a=!0,b=xi,c=this.diagram;if(null!==c){if(c.animationManager.hu(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===xi){if(a=this.Pg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Mk){if(a=a?this.aw():this.bw(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Nk&&(a=a?this.aw():this.bw(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink; return null!==a?a.isVisible():!0};V.prototype.Sb=function(a){U.prototype.Sb.call(this,a);for(var b=this.linksConnected;b.next();){var c=b.value;if(a&&null!==this.containingGroup){var d=c.Sq(this);null===d||d.Nd(this.containingGroup)||c.Za()}c.Sb(a)}};V.prototype.uy=function(){var a=new I,b=new I;ap(this,this,a,b);return b.iterator}; function ap(a,b,c,d){if(null!==b&&!c.has(b)){c.add(b);var e=!0,f=a.diagram;null!==f&&(e=f.isTreePathToChildren);b.linksConnected.each(function(f){f.isTreeLink?(e?f.fromNode===b:f.toNode===b)&&ap(a,e?f.toNode:f.fromNode,c,d):d.add(f)})}} V.prototype.findLinksConnected=function(a){void 0===a&&(a=null);if(null===a)return this.ib.iterator;G&&A(a,"string",V,"findLinksConnected:pid");var b=new kb(this.ib),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};t=V.prototype;t.Nq=function(a){void 0===a&&(a=null);G&&null!==a&&A(a,"string",V,"findLinksOutOf:pid");var b=new kb(this.ib),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b}; t.Ld=function(a){void 0===a&&(a=null);G&&null!==a&&A(a,"string",V,"findLinksInto:pid");var b=new kb(this.ib),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b}; t.$v=function(a){void 0===a&&(a=null);G&&null!==a&&A(a,"string",V,"findNodesConnected:pid");for(var b=null,c=null,d=this.ib.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 I,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 I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new jb(c):ib}; t.bw=function(a){void 0===a&&(a=null);G&&null!==a&&A(a,"string",V,"findNodesOutOf:pid");for(var b=null,c=null,d=this.ib.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 I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new jb(c):ib}; t.aw=function(a){void 0===a&&(a=null);G&&null!==a&&A(a,"string",V,"findNodesInto:pid");for(var b=null,c=null,d=this.ib.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 I,b.add(c),b.add(e)):c=e)}return null!==b?b.iterator:null!==c?new jb(c):ib}; t.gA=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);G&&(w(a,V,V,"findLinksBetween:othernode"),null!==b&&A(b,"string",V,"findLinksBetween:pid"),null!==c&&A(c,"string",V,"findLinksBetween:otherpid"));var d=new kb(this.ib),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.hA=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);G&&(w(a,V,V,"findLinksTo:othernode"),null!==b&&A(b,"string",V,"findLinksTo:pid"),null!==c&&A(c,"string",V,"findLinksTo:otherpid"));var d=new kb(this.ib),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 bp(a,b,c){$o(c);var d=a.ib.contains(b);d||a.ib.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.ba,g.ba=!0);e(a,b,c);null!==g&&(g.ba=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.Lh||(e.Lh=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))} function cp(a,b,c){$o(c);var d=a.ib.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.ba,e.ba=!0);f(a,b,c);null!==e&&(e.ba=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.Lh=!1),null===b||b.isTreeLeaf||(0===b.ib.count?(b.Lh=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Lk(b)))} function Lk(a){a.Lh=!1;if(0!==a.ib.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.ib.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}}}V.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=V.prototype; t.Uq=function(a){U.prototype.Uq.call(this,a);a||(Lk(this),a=this.Ml,null!==a&&dp(a,this))};t.Vq=function(a){U.prototype.Vq.call(this,a);a||(a=this.Ml,null!==a&&null!==a.td&&(a.td.remove(this),a.v()))}; t.zk=function(){if(0<this.ib.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.ib.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;U.prototype.zk.call(this)}; t.Ot=function(a){G&&A(a,"string",V,"findPort:pid");if(null===this.zc){if(""===a&&!1===this.Vh)return this;ep(this)}var b=this.zc.K(a);return null!==b||""!==a&&(b=this.zc.K(""),null!==b)?b:this};function ep(a){null===a.zc?a.zc=new zb:a.zc.clear();a.Uk(a,function(a,c){Zl(a,c)});0===a.zc.count&&a.zc.add("",a)}function Zl(a,b){var c=b.portId;null!==c&&null!==a.zc&&a.zc.add(c,b)} function Yl(a,b,c){var d=b.portId;if(null!==d&&(null!==a.zc&&a.zc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=Ma()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Oa(c)}}} t.KA=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.ib.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.ib.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.tA=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.ib.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.ib.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.dA=function(a){if(null===a)return null;G&&w(a,V,V,"findCommonTreeParent:other");if(this===a)return this;for(var b=this;null!==b;)Oo(b,!0),b=b.Pg();var c=null;for(b=a;null!==b;){if(0!==(b.G&1048576)){c=b;break}b=b.Pg()}for(b=this;null!==b;)Oo(b,!1),b=b.Pg();return c}; t.mj=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.ib.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.Pg=function(){var a=this.Lh;if(null===a)return null;if(a instanceof V)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.ib.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.Lh=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.Lh=b;return this.Lh=null};t.rA=function(){function a(b,d){if(null!==b){d.add(b);var c=b.mj();null!==c&&(d.add(c),a(b.Pg(),d))}}var b=new I;a(this,b);return b}; t.qA=function(){return fp(this,this)};function fp(a,b){b=b.Pg();return null===b?0:1+fp(a,b)}t.Pq=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new kb(this.ib);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.dw=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.ib.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 H,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 H,b.add(c),b.add(a)):c=a);return null!==b?b.iterator:null!==c?new jb(c):ib}; t.sA=function(a){void 0===a&&(a=Infinity);A(a,"number",V,"findTreeParts:level");var b=new I;al(b,this,!1,a,!0);return b};V.prototype.collapseTree=function(a){void 0===a&&(a=1);C(a,V,"collapseTree:level");1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.We){b.We=!0;var c=new I;c.add(this);gp(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===xi);b.We=!1}}; function gp(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.Nq():a.Ld();h.next();){var k=h.value;k.isTreeLink&&(k=k.Sq(a),null===k||k===a||b.contains(k)||(b.add(k),gp(k,b,c,d-1,e,f,g)))}else hp(a,b,c,e,f,g)} function hp(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.Nq():a.Ld();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.Sq(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.pk(k,e),k.Wh(),k.Sb(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||hp(k,b,c,d,e,f))}}a.isTreeExpanded=!1} V.prototype.expandTree=function(a){void 0===a&&(a=2);C(a,V,"expandTree:level");2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.We){b.We=!0;var c=new I;c.add(this);ip(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===xi);b.We=!1}}; function ip(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Nq():a.Ld();k.next();){var l=k.value;l.isTreeLink&&(h||l.zd||l.Za(),l=l.Sq(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Sb(!0),l.Wh(),g&&e.rk(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,ip(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0} na.Object.defineProperties(V.prototype,{portSpreading:{configurable:!0,get:function(){return this.Hp},set:function(a){var b=this.Hp;b!==a&&(G&&a!==jp&&a!==Xo&&a!==kp&&v("Node.portSpreading can only be set to Node.SpreadingNone, Node.SpreadingEvenly, or Node.SpreadingPacked, not: "+a),this.Hp=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.xd())}},avoidable:{configurable:!0,get:function(){return 0!==(this.U&8)},set:function(a){var b= 0!==(this.U&8);if(b!==a){G&&A(a,"boolean",V,"avoidable");this.U^=8;var c=this.diagram;null!==c&&Ek(c,this);this.g("avoidable",b,a)}}},avoidableMargin:{configurable:!0,get:function(){return this.bl},set:function(a){"number"===typeof a?a=new gc(a):w(a,gc,V,"avoidableMargin");var b=this.bl;if(!b.B(a)){this.bl=a=a.L();var c=this.diagram;null!==c&&Ek(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{configurable:!0,get:function(){return this.ib.iterator}},linkConnected:{configurable:!0, enumerable:!0,get:function(){return this.So},set:function(a){var b=this.So;b!==a&&(null!==a&&A(a,"function",V,"linkConnected"),this.So=a,this.g("linkConnected",b,a))}},linkDisconnected:{configurable:!0,get:function(){return this.To},set:function(a){var b=this.To;b!==a&&(null!==a&&A(a,"function",V,"linkDisconnected"),this.To=a,this.g("linkDisconnected",b,a))}},linkValidation:{configurable:!0,get:function(){return this.Ni},set:function(a){var b=this.Ni;b!==a&&(null!==a&& A(a,"function",V,"linkValidation"),this.Ni=a,this.g("linkValidation",b,a))}},isLinkLabel:{configurable:!0,get:function(){return null!==this.Ml}},labeledLink:{configurable:!0,get:function(){return this.Ml},set:function(a){var b=this.Ml;if(b!==a){G&&null!==a&&w(a,T,V,"labeledLink");var c=this.diagram,d=this.data;if(null!==b){null!==b.td&&(b.td.remove(this),b.v());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.uj()){var g=f.va(d); void 0!==g&&f.Ty(e,g)}}this.containingGroup=null}this.Ml=a;null!==a&&(dp(a,this),null===c||null===d||c.undoManager.isUndoingRedoing||(e=a.data,c=c.model,null!==e&&c.uj()&&(d=c.va(d),void 0!==d&&c.Iv(e,d))),this.containingGroup=a.containingGroup);Jl(this);this.g("labeledLink",b,a)}}},port:{configurable:!0,get:function(){return this.Ot("")}},ports:{configurable:!0,get:function(){null===this.zc&&ep(this);return this.zc.iteratorValues}},isTreeExpanded:{configurable:!0, get:function(){return 0!==(this.U&1)},set:function(a){var b=0!==(this.U&1);if(b!==a){G&&A(a,"boolean",V,"isTreeExpanded");this.U^=1;var c=this.diagram;this.g("isTreeExpanded",b,a);b=this.treeExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.ba,c.ba=!0);b(this);null!==c&&(c.ba=d)}null!==c&&c.undoManager.isUndoingRedoing?this.Sb(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{configurable:!0,get:function(){return 0!==(this.U&2)},set:function(a){var b=0!==(this.U&2);b!== a&&(G&&A(a,"boolean",V,"wasTreeExpanded"),this.U^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{configurable:!0,get:function(){return this.wq},set:function(a){var b=this.wq;b!==a&&(null!==a&&A(a,"function",V,"treeExpandedChanged"),this.wq=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{configurable:!0,get:function(){return 0!==(this.U&4)},set:function(a){var b=0!==(this.U&4);b!==a&&(G&&A(a,"boolean",V,"isTreeLeaf"),this.U^=4,this.g("isTreeLeaf",b,a))}}}); V.prototype.expandTree=V.prototype.expandTree;V.prototype.collapseTree=V.prototype.collapseTree;V.prototype.findTreeParts=V.prototype.sA;V.prototype.findTreeChildrenNodes=V.prototype.dw;V.prototype.findTreeChildrenLinks=V.prototype.Pq;V.prototype.findTreeLevel=V.prototype.qA;V.prototype.findTreeParentChain=V.prototype.rA;V.prototype.findTreeParentNode=V.prototype.Pg;V.prototype.findTreeParentLink=V.prototype.mj;V.prototype.findCommonTreeParent=V.prototype.dA;V.prototype.findTreeRoot=V.prototype.tA; V.prototype.isInTreeOf=V.prototype.KA;V.prototype.findPort=V.prototype.Ot;V.prototype.findLinksTo=V.prototype.hA;V.prototype.findLinksBetween=V.prototype.gA;V.prototype.findNodesInto=V.prototype.aw;V.prototype.findNodesOutOf=V.prototype.bw;V.prototype.findNodesConnected=V.prototype.$v;V.prototype.findLinksInto=V.prototype.Ld;V.prototype.findLinksOutOf=V.prototype.Nq;V.prototype.findExternalTreeLinksConnected=V.prototype.uy;V.prototype.invalidateConnectedLinks=V.prototype.xd; V.prototype.invalidateLinkBundle=V.prototype.IA;var jp=new E(V,"SpreadingNone",10),Xo=new E(V,"SpreadingEvenly",11),kp=new E(V,"SpreadingPacked",12);V.className="Node";V.SpreadingNone=jp;V.SpreadingEvenly=Xo;V.SpreadingPacked=kp;function yf(a,b){void 0===a||a instanceof Ul||"string"===typeof a?V.call(this,a):(V.call(this),a&&(b=a));this.U|=4608;this.ep=new I;this.Vl=new I;this.Sa=this.nq=this.Pi=this.fp=this.cp=this.hb=null;this.oc=new Ei;this.oc.group=this;b&&Object.assign(this,b)}ma(yf,V); yf.prototype.cloneProtected=function(a){V.prototype.cloneProtected.call(this,a);this.U=this.U&-32769;null!==this.hb&&(a.hb=this.hb.copy());a.cp=this.cp;a.fp=this.fp;a.Pi=this.Pi;a.nq=this.nq;var b=a.Fm(function(a){return a instanceof ng});b instanceof ng?a.Sa=b:a.Sa=null;null!==this.oc?(a.oc=this.oc.copy(),a.oc.group=a):(null!==a.oc&&(a.oc.group=null),a.oc=null)};t=yf.prototype; t.Kf=function(a){V.prototype.Kf.call(this,a);var b=a.Dk();for(a=a.memberParts;a.next();){var c=a.value;c.v();c.C(8);c.tk();if(c instanceof V)c.xd(b);else if(c instanceof T)for(c=c.labelNodes;c.next();)c.value.xd(b)}}; t.Sk=function(a,b,c,d,e,f,g){if(a===ue&&"elements"===b)if(e instanceof ng)null===this.Sa?this.Sa=e:this.Sa!==e&&v("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof W){var h=e.Fm(function(a){return a instanceof ng});h instanceof ng&&(null===this.Sa?this.Sa=h:this.Sa!==h&&v("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===ve&&"elements"===b&&null!==this.Sa&&(d===this.Sa?this.Sa=null:d instanceof W&&this.Sa.Qg(d)&&(this.Sa=null)); V.prototype.Sk.call(this,a,b,c,d,e,f,g)};t.Pm=function(a,b){V.prototype.Pm.call(this,a,b);this.isClipping&&this.type!==W.Spot&&this.isSubGraphExpanded&&(a=this.resizeObject,a instanceof W&&(a=a.wb()),null===this.hb&&(this.hb=new M),a.pj(this.hb),a instanceof Kf&&this.hb.Qc(-a.strokeWidth,-a.strokeWidth))};t.Ph=function(a,b,c,d){this.pf=this.Sa;V.prototype.Ph.call(this,a,b,c,d)}; t.Xa=function(){var a=this;a.isSubGraphExpanded&&this.memberParts.each(function(b){!a.computesBoundsIncludingLinks&&b instanceof T||b.Xa()});V.prototype.Xa.call(this)};t.wj=function(){if(!V.prototype.wj.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof V){if(b.isVisible()&&xj(b))return!1}else if(b instanceof T&&b.isVisible()&&xj(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0}; function Po(a,b){if(a.ep.add(b)){b instanceof yf&&a.Vl.add(b);var c=a.memberAdded;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.ba,e.ba=!0);c(a,b);null!==e&&(e.ba=d)}a.isVisible()&&a.isSubGraphExpanded||b.Sb(!1)}b instanceof T&&!a.computesBoundsIncludingLinks||(b=a.Sa,null===b&&(b=a),b.v())} function Qo(a,b){if(a.ep.remove(b)){b instanceof yf&&a.Vl.remove(b);var c=a.memberRemoved;if(null!==c){var d=!0,e=a.diagram;null!==e&&(d=e.ba,e.ba=!0);c(a,b);null!==e&&(e.ba=d)}a.isVisible()&&a.isSubGraphExpanded||b.Sb(!0)}b instanceof T&&!a.computesBoundsIncludingLinks||(b=a.Sa,null===b&&(b=a),b.v())}t.zk=function(){if(0<this.ep.count){var a=this.diagram;if(null!==a)for(var b=this.ep.copy().iterator;b.next();)a.remove(b.value)}V.prototype.zk.call(this)}; yf.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=cl(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};yf.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=cl(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d}; yf.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=yf.prototype; t.xd=function(a){void 0===a&&(a=null);var b=0!==(this.U&65536);V.prototype.xd.call(this,a);if(!b)for(0!==(this.U&65536)!==!0&&(this.U=this.U^65536),b=this.Zv();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.Nd(this)&&!d.isVisible()?($o(c.fromPort),$o(c.toPort),c.Za()):(d=c.toNode,null!==d&&d!==this&&d.Nd(this)&&!d.isVisible()&&($o(c.fromPort),$o(c.toPort),c.Za()))}}}; t.Zv=function(){var a=this.Dk();a.add(this);for(var b=new I,c=a.iterator;c.next();){var d=c.value;if(d instanceof V)for(d=d.linksConnected;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.iterator};t.fA=function(){var a=this.Dk();a.add(this);for(var b=new I,c=a.iterator;c.next();){var d=c.value;if(d instanceof V)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;null===f||a.contains(f)&&f!==this||b.add(f);e=e.toNode;null===e||a.contains(e)&&e!==this||b.add(e)}}return b.iterator}; t.eA=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new I;a(this,b);return b};t.Dk=function(){var a=new I;al(a,this,!0,0,!0);a.remove(this);return a};t.Sb=function(a){V.prototype.Sb.call(this,a);for(var b=this.memberParts;b.next();)b.value.Sb(a)};yf.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.We){a.We=!0;var b=this.Dk();lp(this,b,a,this);a.We=!1}}; function lp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Sb(!1);f instanceof yf&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,lp(f,b,c,d));if(f instanceof V)f.xd(b),c.pk(f,d);else if(f instanceof T)for(f=f.labelNodes;f.next();)f.value.xd(b)}a.isSubGraphExpanded=!1}yf.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.We){a.We=!0;var b=this.Dk();mp(this,b,a,this);a.We=!1}}; function mp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Sb(!0);f instanceof yf&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,mp(f,b,c,d));if(f instanceof V)f.xd(b),c.rk(f,d);else if(f instanceof T)for(f=f.labelNodes;f.next();)f.value.xd(b)}a.isSubGraphExpanded=!0} yf.prototype.move=function(a,b){void 0===b&&(b=!1);var c=b?this.location:this.position,d=c.x;c=c.y;var e=a.x,f=a.y;if(!(d===e||isNaN(d)&&isNaN(e))||!(c===f||isNaN(c)&&isNaN(f))){d=e-(isNaN(d)?0:d);c=f-(isNaN(c)?0:c);f=J.alloc();V.prototype.move.call(this,a,b);a=new I;for(b=this.Dk().iterator;b.next();)if(e=b.value,e instanceof T&&(e.suspendsRouting&&a.add(e),e.zd||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Xh()||e instanceof V&&e.isLinkLabel)){var g= e.position,h=e.location;g.s()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.s()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof T&&(e.suspendsRouting=a.contains(e),e.zd||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.s()?e.move(f):e.Za(),Uj(e)&&e.Za();J.free(f)}}; na.Object.defineProperties(yf.prototype,{placeholder:{configurable:!0,get:function(){return this.Sa}},computesBoundsAfterDrag:{configurable:!0,get:function(){return 0!==(this.U&2048)},set:function(a){var b=0!==(this.U&2048);b!==a&&(A(a,"boolean",yf,"computesBoundsAfterDrag"),this.U^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{configurable:!0,get:function(){return 0!==(this.U&4096)},set:function(a){A(a,"boolean",yf,"computesBoundsIncludingLinks"); var b=0!==(this.U&4096);b!==a&&(this.U^=4096,this.g("computesBoundsIncludingLinks",b,a))}},computesBoundsIncludingLocation:{configurable:!0,get:function(){return 0!==(this.U&8192)},set:function(a){A(a,"boolean",yf,"computesBoundsIncludingLocation");var b=0!==(this.U&8192);b!==a&&(this.U^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{configurable:!0,get:function(){return 0!==(this.U&16384)},set:function(a){A(a,"boolean",yf,"handlesDragDropForMembers"); var b=0!==(this.U&16384);b!==a&&(this.U^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{configurable:!0,get:function(){return this.ep.iterator}},layout:{configurable:!0,get:function(){return this.oc},set:function(a){var b=this.oc;if(b!==a){null!==a&&w(a,Ei,yf,"layout");null!==b&&(b.diagram=null,b.group=null);this.oc=a;var c=this.diagram;null!==a&&(a.diagram=c,a.group=this);null!==c&&(c.Xg=!0);this.g("layout",b,a);null!==c&&c.Kb()}}},memberAdded:{configurable:!0, enumerable:!0,get:function(){return this.cp},set:function(a){var b=this.cp;b!==a&&(null!==a&&A(a,"function",yf,"memberAdded"),this.cp=a,this.g("memberAdded",b,a))}},memberRemoved:{configurable:!0,get:function(){return this.fp},set:function(a){var b=this.fp;b!==a&&(null!==a&&A(a,"function",yf,"memberRemoved"),this.fp=a,this.g("memberRemoved",b,a))}},memberValidation:{configurable:!0,get:function(){return this.Pi},set:function(a){var b=this.Pi;b!==a&&(null!==a&&A(a,"function", yf,"memberValidation"),this.Pi=a,this.g("memberValidation",b,a))}},ungroupable:{configurable:!0,get:function(){return 0!==(this.U&256)},set:function(a){var b=0!==(this.U&256);b!==a&&(A(a,"boolean",yf,"ungroupable"),this.U^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{configurable:!0,get:function(){return 0!==(this.U&512)},set:function(a){var b=0!==(this.U&512);if(b!==a){A(a,"boolean",yf,"isSubGraphExpanded");this.U^=512;var c=this.diagram;this.g("isSubGraphExpanded", b,a);b=this.subGraphExpandedChanged;if(null!==b){var d=!0;null!==c&&(d=c.ba,c.ba=!0);b(this);null!==c&&(c.ba=d)}null!==c&&c.undoManager.isUndoingRedoing?(null!==this.Sa&&this.Sa.v(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{configurable:!0,get:function(){return 0!==(this.U&1024)},set:function(a){var b=0!==(this.U&1024);b!==a&&(A(a,"boolean",yf,"wasSubGraphExpanded"),this.U^=1024,this.g("wasSubGraphExpanded", b,a))}},subGraphExpandedChanged:{configurable:!0,get:function(){return this.nq},set:function(a){var b=this.nq;b!==a&&(null!==a&&A(a,"function",yf,"subGraphExpandedChanged"),this.nq=a,this.g("subGraphExpandedChanged",b,a))}},Zh:{configurable:!0,get:function(){return 0!==(this.U&32768)},set:function(a){0!==(this.U&32768)!==a&&(this.U^=32768)}}});yf.prototype.expandSubGraph=yf.prototype.expandSubGraph;yf.prototype.collapseSubGraph=yf.prototype.collapseSubGraph; yf.prototype.findSubGraphParts=yf.prototype.Dk;yf.prototype.findContainingGroupChain=yf.prototype.eA;yf.prototype.findExternalNodesConnected=yf.prototype.fA;yf.prototype.findExternalLinksConnected=yf.prototype.Zv;yf.prototype.ensureBounds=yf.prototype.Xa;yf.className="Group";function ng(a){O.call(this);this.nb=Ac;this.Vp=new M(NaN,NaN,NaN,NaN);a&&Object.assign(this,a)}ma(ng,O);ng.prototype.cloneProtected=function(a){O.prototype.cloneProtected.call(this,a);a.nb=this.nb.L();a.Vp=this.Vp.copy()}; ng.prototype.Rh=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return nc(0,0,b.width,b.height,a.x,a.y)}; ng.prototype.Om=function(){var a=this.part;null!==a&&(a instanceof yf||a instanceof Le)||v("Placeholder is not inside a Group or Adornment.");if(a instanceof yf){var b=this.computeBorder(this.Vp),c=this.minSize,d=this.wc;bc(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);this.Ge(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.mw(a)||isNaN(b.x)|| isNaN(b.y)||(c=J.alloc(),c.yj(b,a.locationSpot),c.B(a.location)||(a.location=c),J.free(c))}else{b=this.wc;c=this.nb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.oj();var g=0;f instanceof Kf&&(g=f.strokeWidth);var h=f.Of(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==W.Link&&(f=f.ja("Selection"===a.category?Dc:a.locationSpot,J.alloc()),a.location=f,J.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.ja(Dc,J.alloc()),f=M.allocAt(l.x,l.y,0,0),f.Ze(a.ja(Nc,l)),f.Ze(a.ja(Fc, l)),f.Ze(a.ja(Lc,l)),bc(b,f.width+d||0,f.height+e||0),this.Ge(-c.left,-c.top,b.width,b.height),J.free(l),M.free(f)):(bc(b,l+d||0,g+e||0),this.Ge(-c.left,-c.top,b.width,b.height))}};ng.prototype.Ph=function(a,b,c,d){this.actualBounds.h(a,b,c,d)}; ng.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof yf&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.Vp.s()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.Vp,a),null!==c))return c}c=M.alloc();d=this.computeMemberBounds(c);var e=this.nb;b instanceof yf&&!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));M.free(c); b instanceof yf&&b.computesBoundsIncludingLocation&&b.location.s()&&a.Ze(b.location);return a}; ng.prototype.computeMemberBounds=function(a){if(!(this.part instanceof yf))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 T){if(!b.computesBoundsIncludingLinks)continue;if(wj(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};na.Object.defineProperties(ng.prototype,{padding:{configurable:!0,get:function(){return this.nb},set:function(a){"number"===typeof a?a=new gc(a):w(a,gc,ng,"padding");var b=this.nb;b.B(a)||(this.nb=a=a.L(),this.g("padding",b,a),this.v())}}});ng.className="Placeholder"; function T(a){U.call(this,W.Link);this.Na=8;this.gf=null;this.hf="";this.Df=this.po=null;this.Ef="";this.vq=null;this.Xk=dg;this.Qn=0;this.Sn=dg;this.Tn=NaN;this.ik=np;this.iq=.5;this.td=null;this.Gb=(new H).freeze();this.wf=this.Kc=null;this.bm=new M;this.sa=new N;this.F=this.o=this.Zf=this.hg=null;this.j=[];this.Av=new J;this.gs=this.Rx=this.Qx=null;this.Tu=NaN;this.T=null;a&&Object.assign(this,a)}ma(T,U); T.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.Na=this.Na&-113;a.hf=this.hf;a.po=this.po;a.Ef=this.Ef;a.vq=this.vq;a.Xk=this.Xk;a.Qn=this.Qn;a.Sn=this.Sn;a.Tn=this.Tn;a.ik=this.ik;a.iq=this.iq;null!==this.T&&(a.T=this.T.copy())};t=T.prototype;t.Kf=function(a){U.prototype.Kf.call(this,a);this.hf=a.hf;this.Ef=a.Ef;a.Kc=null;a.Za();a.Zf=this.Zf;var b=a.fromPort;null!==b&&$o(b);a=a.toPort;null!==a&&$o(a)}; t.ob=function(a){a.classType===T?2===(a.value&2)?this.routing=a:a===gg||a===cg||a===bg?this.curve=a:a===op||a===pp||a===qp?this.adjusting=a:a!==np&&a!==dg&&v("Unknown Link enum value for a Link property: "+a):U.prototype.ob.call(this,a)};t.Rc=function(){null===this.T&&(this.T=new ml)};t.wj=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(xj(a)||yj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),xj(a)||yj(a))?!1:!0};t.Lw=function(){return!1}; t.ru=function(){};t.Uc=function(){return!1};T.prototype.computeAngle=function(a,b,c){return T.computeAngle(b,c)};T.computeAngle=function(a,b){switch(a){default:case dg:a=0;break;case bn:a=b;break;case Vm:a=b+90;break;case Xm:a=b-90;break;case rp:a=b+180;break;case cn:a=K.ar(b);90<a&&270>a&&(a-=180);break;case Wm:a=K.ar(b+90);90<a&&270>a&&(a-=180);break;case Ym:a=K.ar(b-90);90<a&&270>a&&(a-=180);break;case Zm:a=K.ar(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return K.ar(a)}; function Vo(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.ty(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.si;if(c!==b){null!==c&&Qo(c,a);a.si=b;null!==b&&Po(b,a);var e=a.containingGroupChanged;if(null!==e){var f=!0,g=a.diagram;null!==g&&(f=g.ba,g.ba=!0);e(a,c,b);null!==g&&(g.ba=f)}!a.zd||a.Qx!==c&&a.Rx!==c||a.Za()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=T.prototype; t.Wh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&U.prototype.Wh.call(this)};t.Sq=function(a){G&&w(a,V,T,"getOtherNode:node");var b=this.fromNode;return a===b?this.toNode:b};t.yA=function(a){G&&w(a,O,T,"getOtherPort:port");var b=this.fromPort;return a===b?this.toPort:b};function dp(a,b){null===a.td&&(a.td=new I);a.td.add(b);a.v()} t.Uq=function(a){U.prototype.Uq.call(this,a);sp(this)&&this.Wq(this.actualBounds);if(!a){a=this.gf;var b=null;null!==a&&(b=this.fromPort,bp(a,this,b));var c=this.Df;if(null!==c){var d=this.toPort;c===a&&d===b||bp(c,this,d)}tp(this)}};t.Vq=function(a){U.prototype.Vq.call(this,a);sp(this)&&this.Wq(this.actualBounds);if(!a){a=this.gf;var b=null;null!==a&&(b=this.fromPort,cp(a,this,b));var c=this.Df;if(null!==c){var d=this.toPort;c===a&&d===b||cp(c,this,d)}up(this)}}; t.zk=function(){this.zd=!0;if(null!==this.td){var a=this.diagram;if(null!==a)for(var b=this.td.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};T.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}}; T.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?U.prototype.move.call(this,a,!1):(a=J.allocAt(c.x+d,c.y+e),U.prototype.move.call(this,a,!1),J.free(a));tf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)}; T.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};T.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}; T.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(Pb),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()===gg))return this.sa.ew(.5,a),a.add(this.i(0)),c=this.sa.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===gg){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);K.Gz(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}; T.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Ua(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===gg))return this.sa.zy(.5);if(this.computeCurve()===gg&&4<=a){var b=(a-1)/3|0,c=3*(b/2|0);if(1===b%2){c=Math.floor(c);a=this.i(c);b=this.i(c+1);var d=this.i(c+2);c=this.i(c+3);return K.Fz(a.x,a.y,b.x,b.y,d.x,d.y,c.x,c.y)}if(0<c&&c+1<a)return this.i(c-1).Ua(this.i(c+1))}b=this.flattenedLengths;d=this.flattenedTotalLength; var e=0;c=0;for(var f;e<d/2&&c<a;){f=b[c];if(e+f>d/2)break;e+=f;c++}b=this.i(c);d=this.i(c+1);if(1>Math.abs(b.x-d.x)&&1>Math.abs(b.y-d.y)){if(0<c&&c+2<a)return this.i(c-1).Ua(this.i(c+2))}else{if(1>Math.abs(b.x-d.x))return b.y>d.y?270:90;if(1>Math.abs(b.y-d.y))return b.x>d.x?180:0}return b.Ua(d)};t=T.prototype;t.i=function(a){return this.Gb.l[a]}; t.Xc=function(a,b){G&&(w(b,J,T,"setPoint"),b.s()||v("Link.setPoint called with a Point that does not have real numbers: "+b.toString()));G&&null===this.Kc&&v("Call Link.startRoute before modifying the points of the route.");this.Gb.Wc(a,b)};t.O=function(a,b,c){G&&(C(b,T,"setPointAt:x"),C(c,T,"setPointAt:y"));G&&null===this.Kc&&v("Call Link.startRoute before modifying the points of the route.");this.Gb.Wc(a,new J(b,c))}; t.HA=function(a,b){G&&(w(b,J,T,"insertPoint"),b.s()||v("Link.insertPoint called with a Point that does not have real numbers: "+b.toString()));G&&null===this.Kc&&v("Call Link.startRoute before modifying the points of the route.");this.Gb.zb(a,b)};t.m=function(a,b,c){G&&(C(b,T,"insertPointAt:x"),C(c,T,"insertPointAt:y"));G&&null===this.Kc&&v("Call Link.startRoute before modifying the points of the route.");this.Gb.zb(a,new J(b,c))}; t.ie=function(a){G&&(w(a,J,T,"addPoint"),a.s()||v("Link.addPoint called with a Point that does not have real numbers: "+a.toString()));G&&null===this.Kc&&v("Call Link.startRoute before modifying the points of the route.");this.Gb.add(a)};t.Hf=function(a,b){G&&(C(a,T,"insertPointAt:x"),C(b,T,"insertPointAt:y"));G&&null===this.Kc&&v("Call Link.startRoute before modifying the points of the route.");this.Gb.add(new J(a,b))}; t.Bw=function(a){G&&null===this.Kc&&v("Call Link.startRoute before modifying the points of the route.");this.Gb.kb(a)};t.uk=function(){G&&null===this.Kc&&v("Call Link.startRoute before modifying the points of the route.");this.Gb.clear()}; function tf(a,b,c){if(0!==b||0!==c)if(0===a.pointsCount)a.defaultFromPoint&&a.defaultFromPoint.offset(b,c),a.defaultToPoint&&a.defaultToPoint.offset(b,c);else{for(var d=a.zd,e=new H,f=a.Gb.iterator;f.next();){var g=f.value;e.add((new J(g.x+b,g.y+c)).freeze())}e.freeze();f=a.Gb;a.Gb=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.yc?a.v():(a.ng.h(a.ng.x+b,a.ng.y+c),a.oa.h(a.oa.x+b,a.oa.y+c),Jl(a));d?vp(a):(a.defaultFromPoint&&(a.defaultFromPoint=a.i(0)),a.defaultToPoint&&(a.defaultToPoint= a.i(a.pointsCount-1)));null!==g&&g.animationManager.yc&&(b=g.animationManager,a.wf=e,b.dm.add(a));a.g("points",f,e)}}t.ai=function(){null===this.Kc&&(this.Kc=this.Gb,this.Gb=this.Gb.copy())}; t.Jf=function(){if(null!==this.Kc){for(var a=this.Kc,b=this.Gb,c=Infinity,d=Infinity,e=a.l,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.l,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.ic(!0);break}}else this.ic(!0);this.Kc=null;c=this.diagram;null!==c&&c.animationManager.yc&&(c=c.animationManager,this.wf=b,c.dm.add(this));vp(this); this.g("points",a,b)}};t.Fw=function(){null!==this.Kc&&(this.Gb=this.Kc,this.Kc=null)};function vp(a){0===a.Gb.count?a.zd=!1:(a.zd=!0,a.gs=null,a.Tu=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),wp(a,!1))} t.Za=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.cu.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.wf&&!a.isTicking&&a.isAnimating&&(this.wf=null)}a=this.path;null!==a&&(this.zd=!1,this.v(),a.v())}}; t.Ug=function(){if(!this.zd&&!this.computingPoints){var a=!0;try{this.computingPoints=!0,this.ai(),a=this.computePoints()}catch(b){this.computingPoints=!1,this.Fw()}finally{this.computingPoints=!1,a?this.Jf():this.Fw()}}}; T.prototype.computePoints=function(){if(null===this.diagram)return!1;var a=this.fromNode,b=null;null===a?(xp||(xp=new V,xp.desiredSize=Qb,xp.Xa()),this.defaultFromPoint&&(xp.location=this.defaultFromPoint,xp.Xa(),b=a=xp)):b=this.fromPort;if(null!==b&&!a.isVisible()){var c=a.findVisibleNode();null!==c&&c!==a?(a=c,b=c.port):a=c}this.Qx=a;if(null===a||!a.location.s())return!1;for(;!(null===b||b.actualBounds.s()&&b.Sf());)b=b.panel;if(null===b)return!1;var d=this.toNode,e=null;null===d?(yp||(yp=new V, yp.desiredSize=Qb,yp.Xa()),this.defaultToPoint&&(yp.location=this.defaultToPoint,yp.Xa(),e=d=yp)):e=this.toPort;null===e||d.isVisible()||(c=d.findVisibleNode(),null!==c&&c!==d?(d=c,e=c.port):d=c);this.Rx=d;if(null===d||!d.location.s())return!1;for(;!(null===e||e.actualBounds.s()&&e.Sf());)e=e.panel;if(null===e)return!1;var f=this.pointsCount,g=this.computeSpot(!0,b);c=this.computeSpot(!1,e);var h=zp(g),k=zp(c),l=b===e&&null!==b,m=this.isOrthogonal,n=this.curve===gg;this.hg=l&&!m?n=!0:!1;var p=this.computeAdjusting()=== dg||l;if(!m&&!l&&h&&k){if(h=!1,!p&&3<=f&&(p=this.getLinkPoint(a,b,g,!0,!1,d,e),k=this.getLinkPoint(d,e,c,!1,!1,a,b),h=this.adjustPoints(0,p,f-1,k))&&(p=this.getLinkPoint(a,b,g,!0,!1,d,e),k=this.getLinkPoint(d,e,c,!1,!1,a,b),this.adjustPoints(0,p,f-1,k)),!h)if(this.uk(),n){f=this.getLinkPoint(a,b,g,!0,!1,d,e);p=this.getLinkPoint(d,e,c,!1,!1,a,b);h=p.x-f.x;k=p.y-f.y;l=this.computeCurviness();n=m=0;var r=f.x+h/3,q=f.y+k/3,u=r,y=q;K.A(k,0)?y=0<h?y-l:y+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u= (0>k?-1:1)*n+r,y=m*(u-r)+q);r=f.x+2*h/3;q=f.y+2*k/3;var x=r,z=q;K.A(k,0)?z=0<h?z-l:z+l:(x=(0>k?-1:1)*n+r,z=m*(x-r)+q);this.uk();this.ie(f);this.Hf(u,y);this.Hf(x,z);this.ie(p);this.Xc(0,this.getLinkPoint(a,b,g,!0,!1,d,e));this.Xc(3,this.getLinkPoint(d,e,c,!1,!1,a,b))}else if(f=d,p=e,d=this.getLinkPoint(a,b,g,!0,!1,f,p),e=this.getLinkPoint(f,p,c,!1,!1,a,b),this.hasCurviness())p=e.x-d.x,c=e.y-d.y,g=this.computeCurviness(),a=d.x+p/2,b=d.y+c/2,f=a,h=b,K.A(c,0)?h=0<p?h-g:h+g:(p=-p/c,f=Math.sqrt(g*g/(p* p+1)),0>g&&(f=-f),f=(0>c?-1:1)*f+a,h=p*(f-a)+b),this.ie(d),this.Hf(f,h),this.ie(e);else{this.ie(d);this.ie(e);h=M.alloc();b.pj(h);k=h.ca(e);p.pj(h);l=h.ca(d);if(k||l)g=b.ja(Ap(g),new J),this.Xc(0,this.getLinkPointFromPoint(a,b,g,e,!0,g)),c=p.ja(Ap(c),new J),this.Xc(1,this.getLinkPointFromPoint(f,p,c,d,!1,c));M.free(h)}}else{n=this.isAvoiding;p&&(m&&n||l)&&this.uk();var B=l?this.computeCurviness():0;n=this.getLinkPoint(a,b,g,!0,m,d,e);r=u=q=0;if(m||!h||l)y=this.computeEndSegmentLength(a,b,g,!0),r= this.getLinkDirection(a,b,n,g,!0,m,d,e),l&&(h||g.B(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(r-=m?90:30,0>B&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(y+=Math.abs(B)*(m?1:2)),0===r?q=y:90===r?u=y:180===r?q=-y:270===r?u=-y:(q=y*Math.cos(r*Math.PI/180),u=y*Math.sin(r*Math.PI/180)),g.bc()&&l&&(y=b.ja(Jc,J.alloc()),x=J.allocAt(y.x+1E3*q,y.y+1E3*u),this.getLinkPointFromPoint(a,b,y,x,!0,n),J.free(y),J.free(x));y=this.getLinkPoint(d,e,c,!1,m,a,b);var D=z=x=0;if(m||!k||l){var F=this.computeEndSegmentLength(d,e, c,!1);D=this.getLinkDirection(d,e,y,c,!1,m,a,b);l&&(k||g.B(c)||!m&&1===g.x+c.x&&1===g.y+c.y)&&(D+=m?0:30,0>B&&(D+=180));0>D?D+=360:360<=D&&(D-=360);l&&(F+=Math.abs(B)*(m?1:2));0===D?x=F:90===D?z=F:180===D?x=-F:270===D?z=-F:(x=F*Math.cos(D*Math.PI/180),z=F*Math.sin(D*Math.PI/180));c.bc()&&l&&(c=e.ja(Jc,J.alloc()),g=J.allocAt(c.x+1E3*x,c.y+1E3*z),this.getLinkPointFromPoint(d,e,c,g,!1,y),J.free(c),J.free(g))}c=n;if(m||!h||l)c=new J(n.x+q,n.y+u);g=y;if(m||!k||l)g=new J(y.x+x,y.y+z);!p&&!m&&h&&3<f&&this.adjustPoints(0, n,f-2,g)?this.Xc(f-1,y):!p&&!m&&k&&3<f&&this.adjustPoints(1,c,f-1,y)?this.Xc(0,n):!p&&(m?6<=f:4<f)&&this.adjustPoints(1,c,f-2,g)?(this.Xc(0,n),this.Xc(f-1,y)):(this.uk(),this.ie(n),(m||!h||l)&&this.ie(c),m&&this.addOrthoPoints(c,r,g,D,a,d),(m||!k||l)&&this.ie(g),this.ie(y))}return!0};function Bp(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} T.prototype.getLinkPointFromPoint=function(a,b,c,d,e,f){void 0===f&&(f=new J);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.pe()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.je;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.Ek(e,d,g,c,f);null!== a&&f.transform(a);return f};function Cp(a,b){var c=b.Gp;null===c&&(c=new Dp,c.port=b,c.node=b.part,b.Gp=c);return Ep(c,a)} T.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new J);if(c.fb()&&!zp(c))return b.ja(c,h),h;if(c.Vc()){var k=Cp(this,b);if(null!==k){h.assign(k.Zq);if(e&&this.routing===Fp){var l=Cp(this,g);if(null!==l&&k.Dm<l.Dm){k=J.alloc();l=J.alloc();var m=new M(b.ja(Dc,k),b.ja(Nc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.Rf(Qc)||c.Rf(Rc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.Rf(Pc)||c.Rf(Sc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);J.free(k);J.free(l)}}return h}}c= b.ja(Ap(c),J.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=Bp(c,g.copy()))):(k=this.computeSpot(!d,g),f=J.alloc(),g=g.ja(Ap(k),f),e&&(g=Bp(c,g)),J.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);J.free(c);return h}; T.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.fb())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.Vc()&&(k=Cp(this,b),null!==k))switch(k.Ec){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.ja(Jc,J.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?Bp(k,h.copy()):c):(c=J.alloc(),h=h.ja(Jc,c),J.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;J.free(k);k=c}d.bc()&&g.Nd(a)&&(k+=180,360<=k&&(k-=360));if(zp(d))return k;a=b.oj();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};T.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.Vc()&&(a=Cp(this,b),null!==a))return a.Xv;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a}; T.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=Jc:(b=this.fromSpot,b.Jb()&&(b=a.fromSpot),a=b===ed?Cc:b)):(a=b?b:this.toPort,null===a?a=Jc:(b=this.toSpot,b.Jb()&&(b=a.toSpot),a=b===ed?Cc:b));return a};function zp(a){return a===Cc||.5===a.x&&.5===a.y}function Ap(a){return.5===a.x&&.5===a.y?a:Jc} T.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==dg&&4<this.pointsCount)return this.computeMidPoint(new J);a=b.Gp;a=null!==a?Ep(a,this):null;return null!==a?a.Zq:b.ja(Jc)};T.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}; T.prototype.Nf=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=Fb.alloc(),g.reset());g.multiply(this.transform);if(this.Qh(a,g))return on(this,b,c,e),void 0===f&&Fb.free(g),!0;if(this.Tc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.$.l,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=Fb.alloc();n.set(g); if(m instanceof W)h=m.Nf(a,b,c,d,e,n);else if(this.path===m){if(m instanceof Kf)if(h=a,p=d,!1===m.pickable)h=!1;else if(n.multiply(m.transform),p)b:{var r=h,q=n;if(m.Qh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.Te(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var y=J.alloc(),x=J.alloc(),z=J.alloc(),B=Fb.alloc();B.set(q);B.rw(m.transform);B.Xt();x.x=p;x.y=u;x.transform(B);y.x=h;y.y=u;y.transform(B);q=!1;Gn(m,y,x,z)?q=!0:(y.x=p,y.y=r,y.transform(B),Gn(m,y,x,z)?q=!0:(x.x= h,x.y=r,x.transform(B),Gn(m,y,x,z)?q=!0:(y.x=h,y.y=u,y.transform(B),Gn(m,y,x,z)&&(q=!0))));Fb.free(B);J.free(y);J.free(x);J.free(z);h=q}}else h=m.Qh(h,n)}else h=ql(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));Fb.free(n)}}}void 0===f&&Fb.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&Fb.free(g);return!1}; T.prototype.computeCurve=function(){if(null===this.hg){var a=this.fromPort,b=this.isOrthogonal;this.hg=null!==a&&a===this.toPort&&!b}return this.hg?gg:this.curve};T.prototype.computeCorner=function(){if(this.curve===gg)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a}; T.prototype.findMidLabel=function(){for(var a=this.path,b=this.$.l,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}; T.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=Gp;a=Math.max(a,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===bn||d===cn||d===rp?a=Math.max(a,e):d===Xm||d===Ym||d===Vm||d===Wm?a=Math.max(a,g):(b=b.ja(Jc).Ua(c.ja(Jc))/180*Math.PI,a=Math.max(a, Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===gg&&(a*=1.333)}}return a};T.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===dg&&c.Za()}}; T.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=Hp;var b=this.Zf;if(null!==b){for(var c=Ma(),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.fu===this.fromNode&&(a=-a);Oa(c)}}return a};T.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1}; T.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Zf}; T.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===pp)return!1;e===qp&&(e=op)}switch(e){case pp:var f=this.i(a),g=this.i(c);if(!f.Ya(b)||!g.Ya(d)){e=f.x;f=f.y;var h=g.x-e,k=g.y-f,l=Math.sqrt(h*h+k*k);if(!K.da(l,0)){if(K.da(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);K.da(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.Xc(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),K.da(b,0)||(K.da(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.O(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.Xc(c,d)}}return!0;case qp:f=this.i(a);n=this.i(c);if(!f.Ya(b)||!n.Ya(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 r=1;if(0!==k-h){var q=(p-m)/(k-h);r=Math.sqrt(1+1/(q*q))}else q=9E9;this.Xc(a,b);for(a+=1;a<c;a++){b=this.i(a); var u=b.x,y=b.y,x=.5;0!==l&&(x=((e-u)*(e-g)+(f-y)*(f-n))/l);var z=e+x*(g-e),B=f+x*(n-f);b=Math.sqrt((u-z)*(u-z)+(y-B)*(y-B));y<q*(u-z)+B&&(b=-b);0<q&&(b=-b);u=h+x*(k-h);x=m+x*(p-m);0!==q?(b=u+b/r,this.O(a,b,x-(b-u)/q)):this.O(a,u,x+b)}this.Xc(c,d)}return!0;case op: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,K.A(e.y,f.y)?K.A(f.x,g.x)?m=b.y:K.A(f.y,g.y)&&(h=b.x):K.A(e.x,f.x)&&(K.A(f.y,g.y)?h=b.x:K.A(f.x,g.x)&&(m=b.y)),this.O(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,K.A(e.y,f.y)?K.A(f.x,g.x)?m=d.y:K.A(f.y,g.y)&&(h=d.x):K.A(e.x,f.x)&&(K.A(f.y,g.y)?h=d.x:K.A(f.x,g.x)&&(m=d.y)),this.O(c-1,h,m),Uj(this))){this.O(a+1,n,l);this.O(c-1,k,p);c=!1;break a}this.Xc(a,b);this.Xc(c,d);c=!0}return c;default:return!1}}; T.prototype.addOrthoPoints=function(a,b,c,d,e,f){0>b?b+=360:360<=b&&(b-=360);0>d?d+=360:360<=d&&(d-=360);var g=d;b=315<=b||45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=315<=d||45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var h=e.actualBounds.copy(),k=f.actualBounds.copy();if(h.s()&&k.s()){h.Qc(Ip,Ip);k.Qc(Ip,Ip);h.Ze(a);k.Ze(c);var l=J.alloc(),m=J.alloc();if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&k.right>a.x||90===d&&c.y>a.y&&k.right>a.x)l.h(c.x,a.y),m.h(c.x,(a.y+c.y)/2),180===d?(l.x=this.computeMidOrthoPosition(a.x, a.y,c.x,c.y,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x<k.left?this.computeMidOrthoPosition(a.x,a.y,k.left,c.y,!1):a.x<k.right&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):k.right,m.x=l.x,m.y=c.y):0===d&&a.x<k.left&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l.h(a.x,c.y);m.h((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)180===d&&(k.ca(a)||h.ca(c))? l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(180===d||90===d)?l.y=this.computeMidOrthoPosition(a.x,h.top,c.x,Math.max(c.y,k.bottom),!0):c.y>a.y&&(180===d||270===d)&&(l.y=this.computeMidOrthoPosition(a.x,h.bottom,c.x,Math.min(c.y,k.top),!0)),m.x=c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x>=h.left&&c.x<=a.x||a.x<=k.right&&a.x>=c.x){if(90===d||270===d)l.h(Math.max((a.x+c.x)/2,a.x),a.y),m.h(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?h.top:Math.min(h.top, k.top)):Math.max(c.y,0===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&k.left<a.x||90===d&&c.y>a.y&&k.left<a.x)l.h(c.x,a.y),m.h(c.x,(a.y+c.y)/2),0===d?(l.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),m.x=l.x,m.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(l.x=a.x>k.right?this.computeMidOrthoPosition(a.x,a.y,k.right,c.y,!1):a.x>k.left&&(270===d&&a.y<k.top||90===d&&a.y>k.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):k.left,m.x=l.x, m.y=c.y):180===d&&a.x>k.right&&a.y>k.top&&a.y<k.bottom&&(l.x=a.x,l.y=a.y<c.y?Math.min(c.y,k.top):Math.max(c.y,k.bottom),m.y=l.y);else{l.h(a.x,c.y);m.h((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<h.top||270===d&&c.y>h.bottom)0===d&&(k.ca(a)||h.ca(c))?l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?l.y=this.computeMidOrthoPosition(a.x,h.top,c.x,Math.max(c.y,k.bottom),!0):c.y>a.y&&(0===d||270===d)&&(l.y=this.computeMidOrthoPosition(a.x,h.bottom,c.x,Math.min(c.y,k.top),!0)),m.x= c.x,m.y=l.y;if(l.y>h.top&&l.y<h.bottom)if(c.x<=h.right&&c.x>=a.x||a.x>=k.left&&a.x<=c.x){if(90===d||270===d)l.h(Math.min((a.x+c.x)/2,a.x),a.y),m.h(l.x,c.y)}else l.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?h.top:Math.min(h.top,k.top)):Math.max(c.y,180===d?h.bottom:Math.max(h.bottom,k.bottom)),m.x=c.x,m.y=l.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&k.bottom>a.y||0===d&&c.x>a.x&&k.bottom>a.y)l.h(a.x,c.y),m.h((a.x+c.x)/2,c.y),270===d?(l.y=this.computeMidOrthoPosition(a.x,a.y,c.x, c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>a.x?(l.y=a.y<k.top?this.computeMidOrthoPosition(a.x,a.y,c.x,k.top,!0):a.y<k.bottom&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):k.bottom,m.x=c.x,m.y=l.y):90===d&&a.y<k.top&&a.x>k.left&&a.x<k.right&&(l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l.h(c.x,a.y);m.h(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<h.left||180===d&&c.x>h.right)270===d&&(k.ca(a)||h.ca(c))?l.x=this.computeMidOrthoPosition(a.x, a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,a.y,Math.max(c.x,k.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,a.y,Math.min(c.x,k.left),c.y,!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y>=h.top&&c.y<=a.y||a.y<=k.bottom&&a.y>=c.y){if(0===d||180===d)l.h(a.x,Math.max((a.y+c.y)/2,a.y)),m.h(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,90===d?h.right: Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&k.top<a.y||0===d&&c.x>a.x&&k.top<a.y)l.h(a.x,c.y),m.h((a.x+c.x)/2,c.y),90===d?(l.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),m.x=c.x,m.y=l.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(l.y=a.y>k.bottom?this.computeMidOrthoPosition(a.x,a.y,c.x,k.bottom,!0):a.y>k.top&&(180===d&&a.x<k.left||0===d&&a.x>k.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):k.top,m.x=c.x,m.y=l.y):270===d&&a.y>k.bottom&&a.x>k.left&&a.x<k.right&& (l.x=a.x<c.x?Math.min(c.x,k.left):Math.max(c.x,k.right),l.y=a.y,m.x=l.x);else{l.h(c.x,a.y);m.h(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<h.left||180===d&&c.x>h.right)90===d&&(k.ca(a)||h.ca(c))?l.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?l.x=this.computeMidOrthoPosition(h.left,a.y,Math.max(c.x,k.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(l.x=this.computeMidOrthoPosition(h.right,a.y,Math.min(c.x,k.left),c.y,!1)),m.x=l.x,m.y=c.y;if(l.x>h.left&&l.x<h.right)if(c.y<=h.bottom&& c.y>=a.y||a.y>=k.top&&a.y<=c.y){if(0===d||180===d)l.h(a.x,Math.min((a.y+c.y)/2,a.y)),m.h(c.x,l.y)}else l.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?h.left:Math.min(h.left,k.left)):Math.max(c.x,270===d?h.right:Math.max(h.right,k.right)),m.x=l.x,m.y=c.y}var n=c;if(this.isAvoiding){var p=this.diagram;if(null===p||e===f||this.layer.isTemporary||!mk(p)||h.ca(n)&&!f.Nd(e)||k.ca(a)&&!e.Nd(f))b=!1;else{var r=nk(p,!0,this.containingGroup,null);if(17!==this.segmentIndex&&r.Ik(Math.min(a.x,l.x), Math.min(a.y,l.y),Math.abs(a.x-l.x),Math.abs(a.y-l.y))&&r.Ik(Math.min(l.x,m.x),Math.min(l.y,m.y),Math.abs(l.x-m.x),Math.abs(l.y-m.y))&&r.Ik(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y)))b=!1;else{e=a;f=n;var q=c=null;if(p.isVirtualized){p=r.bounds.copy();p.Qc(-r.Iq,-r.Hq);var u=J.alloc();Ck(r,a.x,a.y)||(K.Qf(p.x,p.y,p.x+p.width,p.y+p.height,a.x,a.y,l.x,l.y,u)?(c=a=u.copy(),b=u.Ua(l)):K.Qf(p.x,p.y,p.x+p.width,p.y+p.height,l.x,l.y,m.x,m.y,u)?(c=a=u.copy(),b=u.Ua(m)):K.Qf(p.x, p.y,p.x+p.width,p.y+p.height,m.x,m.y,n.x,n.y,u)&&(c=a=u.copy(),b=u.Ua(n)));Ck(r,n.x,n.y)||(K.Qf(p.x,p.y,p.x+p.width,p.y+p.height,n.x,n.y,m.x,m.y,u)?(q=n=u.copy(),d=m.Ua(u)):K.Qf(p.x,p.y,p.x+p.width,p.y+p.height,m.x,m.y,l.x,l.y,u)?(q=n=u.copy(),d=l.Ua(u)):K.Qf(p.x,p.y,p.x+p.width,p.y+p.height,l.x,l.y,a.x,a.y,u)&&(q=n=u.copy(),d=a.Ua(u)));J.free(u)}h=h.copy().Yc(k);h.Qc(r.Iq*r.az,r.Hq*r.az);Jp(r,a,b,n,d,h,!0);k=Kp(r,n.x,n.y);!r.abort&&k>=Lp&&(Bk(r),h.Qc(r.Iq*r.Ly,r.Hq*r.Ly),Jp(r,a,b,n,d,h,!1),k=Kp(r, n.x,n.y));if(!r.abort&&k<Lp&&Kp(r,n.x,n.y)!==Dk){Mp(this,r,n.x,n.y,d,!0,g);h=this.i(2);if(4>this.pointsCount)0===b||180===b?(h.x=a.x,h.y=n.y):(h.x=n.x,h.y=a.y),this.O(2,h.x,h.y),this.m(3,h.x,h.y);else if(g=this.i(3),0===b||180===b)K.A(h.x,g.x)?(h=0===b?Math.max(h.x,a.x):Math.min(h.x,a.x),this.O(2,h,a.y),this.O(3,h,g.y)):K.A(h.y,g.y)?(Math.abs(a.y-h.y)<=r.Hq/2&&(this.O(2,h.x,a.y),this.O(3,g.x,a.y)),this.m(2,h.x,a.y)):this.O(2,a.x,h.y);else if(90===b||270===b)K.A(h.y,g.y)?(h=90===b?Math.max(h.y,a.y): Math.min(h.y,a.y),this.O(2,a.x,h),this.O(3,g.x,h)):K.A(h.x,g.x)?(Math.abs(a.x-h.x)<=r.Iq/2&&(this.O(2,a.x,h.y),this.O(3,a.x,g.y)),this.m(2,a.x,h.y)):this.O(2,h.x,a.y);null!==c&&(a=this.i(1),g=this.i(2),a.x!==g.x&&a.y!==g.y?0===b||180===b?this.m(2,a.x,g.y):this.m(2,g.x,a.y):0===b||180===b?this.m(2,e.x,c.y):this.m(2,c.x,e.y));null!==q&&(0===d||180===d?this.Hf(f.x,q.y):this.Hf(q.x,f.y));b=!0}else b=!1}}}else b=!1;b||(this.ie(l.copy()),this.ie(m.copy()));J.free(l);J.free(m)}}; T.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;!this.hasCurviness()||this.computeSpot(!0,this.fromPort).Vc()||this.computeSpot(!1,this.toPort).Vc()||(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f}; function Uj(a){if(null===a.diagram||!a.isAvoiding||!mk(a.diagram))return!1;var b=a.points.l,c=b.length;if(4>c)return!1;a=nk(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.Ik(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 Mp(a,b,c,d,e,f,g){var h=b.Iq,k=b.Hq,l=Kp(b,c,d),m=c,n=d;0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k;e!==g&&l>Np&&Kp(b,m,n)!==l-1&&(Kp(b,c-h,d)===l-1?(e=180,m=c-h,n=d):Kp(b,c+h,d)===l-1?(e=0,m=c+h,n=d):Kp(b,c,d-k)===l-1?(e=270,m=c,n=d-k):Kp(b,c,d+k)===l-1&&(e=90,m=c,n=d+k));for(;l>Np&&Kp(b,m,n)===l-1;)c=m,d=n,0===e?m+=h:90===e?n+=k:180===e?m-=h:n-=k,--l;if(f){if(l>Np)if(180===e||0===e)c=Math.floor(c/h)*h+h/2;else if(90===e||270===e)d=Math.floor(d/k)*k+k/2}else c=Math.floor(c/h)*h+h/2,d=Math.floor(d/ k)*k+k/2;l>Np&&(f=e,g=c,m=d,0===e?(f=90,m+=k):90===e?(f=180,g-=h):180===e?(f=270,m-=k):270===e&&(f=0,g+=h),Kp(b,g,m)===l-1?Mp(a,b,g,m,f,!1,f):(g=c,m=d,0===e?(f=270,m-=k):90===e?(f=0,g+=h):180===e?(f=90,m+=k):270===e&&(f=180,g-=h),Kp(b,g,m)===l-1&&Mp(a,b,g,m,f,!1,f)));a.Hf(c,d)} T.prototype.bA=function(a){G&&w(a,J,T,"findClosestSegment:p");var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Hb(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=Hb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};T.prototype.ic=function(a){this.jn=!1;a&&this.v()}; T.prototype.Kk=function(a){if(!a){if(!1===this.zd)return;a=this.wb();if(this.jn&&(null===a||null!==a.geometry))return}this.sa=this.makeGeometry();a=this.path;if(null!==a){a.sa=this.sa;for(var b=this.$.l,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof Kf&&(e.sa=this.sa)}}}; T.prototype.makeGeometry=function(){var a=this.sa,b=this.pointsCount;if(2>b)return a.type=N.j,this.jn=!0,a;var c=!1,d=this.diagram;null!==d&&sp(this)&&d.gh.contains(this)&&(0!==this.bm.width||0!==this.bm.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.Gb.l;var g=this.computeCurve();if(g===gg&&3<=b&&!K.da(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.Av.x;k-=this.Av.y;e.x-=d;e.y-=k;if(2!==b||sp(this)){a.type=N.o;h=Fd(a);0!==this.computeShortLength(!0)&&(e=Op(this,e,!0,f));Gd(h,e.x,e.y,!1);if(g===gg&&3<=b&&!K.da(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=Op(this,e,!1,f)),Hd(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){b=J.allocAt(d,k);c=J.alloc();c.assign(this.i(1));f=J.allocAt(d,k);e=J.allocAt(d,k);g=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=g,r=l,q=this.i(Pp(this,l,n,!1));if(!K.da(p.x,r.x)||!K.da(r.x,q.x))if(!K.da(p.y,r.y)||!K.da(r.y,q.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var y=p.x;p=p.y;var x=r.x;r=r.y;var z=q.x;q=q.y;var B=u*Qp(y,p,x,r);u*=Qp(x,r,z,q);K.da(p,r)&&K.da(x,z)&&(x>y?q>r?(f.x= x-B,f.y=r-B,e.x=x+u,e.y=r+u):(f.x=x-B,f.y=r+B,e.x=x+u,e.y=r-u):q>r?(f.x=x+B,f.y=r-B,e.x=x-u,e.y=r+u):(f.x=x+B,f.y=r+B,e.x=x-u,e.y=r-u));K.da(y,x)&&K.da(r,q)&&(r>p?(z>x?(f.x=x-B,f.y=r-B,e.x=x+u):(f.x=x+B,f.y=r-B,e.x=x-u),e.y=r+u):(z>x?(f.x=x-B,f.y=r+B,e.x=x+u):(f.x=x+B,f.y=r+B,e.x=x-u),e.y=r-u));if(K.da(y,x)&&K.da(x,z)||K.da(p,r)&&K.da(r,q))y=.5*(y+z),p=.5*(p+q),f.x=y,f.y=p,e.x=y,e.y=p;1===n?(c.x=.5*(g.x+l.x),c.y=.5*(g.y+l.y)):2===n&&K.da(g.x,this.i(0).x)&&K.da(g.y,this.i(0).y)&&(c.x=.5*(g.x+l.x), c.y=.5*(g.y+l.y));Hd(h,c.x-d,c.y-k,f.x-d,f.y-k,l.x-d,l.y-k);b.set(f);c.set(e);g=l}}l=g.x;g=g.y;m=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(m=Op(this,m.copy(),!1,Lb));l=.5*(l+m.x);g=.5*(g+m.y);Hd(h,e.x-d,e.y-k,l-d,g-k,m.x-d,m.y-k);J.free(b);J.free(c);J.free(f);J.free(e)}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=Op(this,g.copy(),!1,Lb)),Hd(h,f.x-d,f.y-k,e.x-d,e.y-k,g.x-d,g.y-k);else{f=J.alloc();f.assign(this.i(0)); e=J.alloc();e.assign(f);g=this.computeCorner();n=1;for(l=0;n<b;){n=Pp(this,f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.B(m))0!==this.computeShortLength(!1)&&(m=Op(this,m.copy(),!1,Lb)),Rp(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),Rp(this,h,-d,-k,f,m,c),f.assign(m);break}l=Pp(this,m,n+1,n<b-3);n=-d;y=-k;p=m;x=this.i(l);u=c;if(K.A(f.y,p.y)&&K.A(p.x,x.x))if(q=Math.min(g,Math.abs(p.x-e.x)/2),q=B=Math.min(q,Math.abs(x.y-p.y)/2),K.A(q,0))Rp(this,h,n,y,f,p,u),f.assign(p);else{var D= p.x,F=p.y;r=D;z=F;p.x>f.x?D=p.x-q:D=p.x+q;x.y>p.y?z=p.y+B:z=p.y-B;x=J.allocAt(D,F);Rp(this,h,n,y,f,x,u);J.free(x);Id(h,p.x+n,p.y+y,r+n,z+y);f.h(r,z)}else K.A(f.x,p.x)&&K.A(p.y,x.y)?(q=Math.min(g,Math.abs(p.y-e.y)/2),q=B=Math.min(q,Math.abs(x.x-p.x)/2),K.A(B,0)?(Rp(this,h,n,y,f,p,u),f.assign(p)):(D=p.x,F=p.y,r=D,z=F,p.y>f.y?F=p.y-q:F=p.y+q,x.x>p.x?r=p.x+B:r=p.x-B,x=J.allocAt(D,F),Rp(this,h,n,y,f,x,u),J.free(x),Id(h,p.x+n,p.y+y,r+n,z+y),f.h(r,z))):(Rp(this,h,n,y,f,p,u),f.assign(p));e.assign(m);n=l}J.free(f)}Od= h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=Op(this,e,!0,f)),0!==this.computeShortLength(!1)&&(h=Op(this,h,!1,f)),a.type=N.j,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.jn=!0;return a};function Qp(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 K.da(a,0)?b:K.da(b,0)?a:Math.sqrt(a*a+b*b)} function Op(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=Qp(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=Qp(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 Pp(a,b,c,d){for(var e=a.pointsCount,f=b;K.da(b.x,f.x)&&K.da(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!K.da(b.x,f.x)&&!K.da(b.y,f.y))return c-1;for(var g=f;K.da(b.x,f.x)&&K.da(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||K.da(b.y,f.y)&&K.da(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}T.prototype.computeJumpLength=function(){return 10}; function Rp(a,b,c,d,e,f,g){if(!g&&sp(a)){g=a.computeJumpLength();var h=g/2,k=[],l=0;a.isVisible()&&(l=Sp(a,e,f,k));if(0<l)if(K.A(e.y,f.y))if(e.x<f.x)for(var m=0;m<l;){var n=Math.max(e.x,Math.min(k[m++]-h,f.x-g));b.lineTo(n+c,f.y+d);var p=n+c;for(var r=Math.min(n+g,f.x);m<l;)if(n=k[m],n<r+g)m++,r=Math.min(n+h,f.x);else break;n=f.y-g+d;r+=c;var q=f.y+d;a.curve===cg?Gd(b,r,q,!1):Hd(b,p,n,r,n,r,q)}else for(--l;0<=l;){m=Math.min(e.x,Math.max(k[l--]+h,f.x+g));b.lineTo(m+c,f.y+d);p=m+c;for(n=Math.max(m- g,f.x);0<=l;)if(m=k[l],m>n-g)l--,n=Math.max(m-h,f.x);else break;m=f.y-g+d;n+=c;r=f.y+d;a.curve===cg?Gd(b,n,r,!1):Hd(b,p,m,n,m,n,r)}else if(K.A(e.x,f.x))if(e.y<f.y)for(m=0;m<l;){n=Math.max(e.y,Math.min(k[m++]-h,f.y-g));b.lineTo(f.x+c,n+d);p=n+d;for(n=Math.min(n+g,f.y);m<l;)if(r=k[m],r<n+g)m++,n=Math.min(r+h,f.y);else break;r=f.x-g+c;q=f.x+c;n+=d;a.curve===cg?Gd(b,q,n,!1):Hd(b,r,p,r,n,q,n)}else for(--l;0<=l;){m=Math.min(e.y,Math.max(k[l--]+h,f.y+g));b.lineTo(f.x+c,m+d);p=m+d;for(m=Math.max(m-g,f.y);0<= l;)if(n=k[l],n>m-g)l--,m=Math.max(n-h,f.y);else break;n=f.x-g+c;r=f.x+c;m+=d;a.curve===cg?Gd(b,r,m,!1):Hd(b,n,p,n,m,r,m)}}b.lineTo(f.x+c,f.y+d)} function Sp(a,b,c,d){var e=a.diagram;if(null===e||b.B(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Ka.l;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof T){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&sp(k)){var l=k.routeBounds;l.s()&&a.routeBounds.Tc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.Sf()&&Tp(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length} function Tp(a,b,c,d){for(var e=K.A(a.y,b.y),f=d.pointsCount,g=d.i(0),h=J.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,r=b.y,q=g.x;g=g.y;var u=l.x,y=l.y;if(!K.A(m,p)){if(K.A(n,r)&&K.A(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,y)<n&&Math.max(g,y)>n&&!K.A(g,y)){h.x=q;h.y=n;m=!0;break a}}else if(!K.A(n,r)&& K.A(g,y)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!K.A(q,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}J.free(h)}function sp(a){a=a.curve;return a===bg||a===cg}function wp(a,b){if(b||sp(a))b=a.diagram,null===b||b.animationManager.isTicking||b.gh.contains(a)||0===a.bm.width&&0===a.bm.height||b.gh.add(a,a.bm.copy())} T.prototype.Wq=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c&&!c.animationManager.isTicking){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.Ka.l;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof T&&(k===this?f=!0:f&&Up(this,k,a))}}else if(d)for(f=e.Ka.l,e=f.length,g=0;g<e;g++)h=f[g],h instanceof T&&Up(this,h,a)}}}}; function Up(a,b,c){if(null!==b&&b.jn&&b.zd&&sp(b)){var d=b.routeBounds;d.s()&&(a.routeBounds.Tc(d)||c.Tc(d))&&(a.usesSamePort(b)||b.ic(!1))}}T.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.Ya(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Ya(a)||d.Ya(a)||b.Ya(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}; T.prototype.isVisible=function(){if(!U.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};T.prototype.Sb=function(a){U.prototype.Sb.call(this,a);null!==this.Zf&&this.Zf.Km();if(null!==this.td)for(var b=this.td.iterator;b.next();)b.value.Sb(a)};T.prototype.computeAdjusting=function(){return this.isAvoiding&&null!==this.diagram&&this.diagram.animationManager.defaultAnimation.isAnimating?op:this.Xk}; function tp(a){var b=a.gf;if(null!==b){var c=a.Df;if(null!==c&&isNaN(a.curviness)){for(var d=a.hf,e=a.Ef,f=a=null,g=b.ib.l,h=g.length,k=0;k<h;k++){var l=g[k];if(l.gf===b&&l.hf===d&&l.Df===c&&l.Ef===e||l.gf===c&&l.hf===e&&l.Df===b&&l.Ef===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=Zo(b,c,d,e);null===f&&(f=new Vp(b,d,c,e),Yo(b,f),Yo(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Zf=f;f.Km()}}}} function up(a){var b=a.Zf;null!==b&&isNaN(a.curviness)&&(a.Zf=null,a=b.links.indexOf(a),0<=a&&(La(b.links,a),b.Km()))}T.prototype.Xh=function(){return!0}; na.Object.defineProperties(T.prototype,{fromNode:{configurable:!0,get:function(){return this.gf},set:function(a){var b=this.gf;if(b!==a){G&&null!==a&&w(a,V,T,"fromNode");var c=this.fromPort;null!==b&&(this.Df!==b&&cp(b,this,c),up(this),this.C(2));this.gf=a;null!==a&&this.Sb(a.isVisible());this.hg=null;this.Za();var d=this.diagram;null!==d&&d.ba&&d.partManager.setFromNodeForLink(this,a,b);var e=this.fromPort,f=this.fromPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.ba,d.ba=!0);f(this, c,e);null!==d&&(d.ba=g)}null!==a&&(this.Df!==a&&bp(a,this,e),tp(this),this.C(1));this.g("fromNode",b,a);Vo(this)}}},fromPortId:{configurable:!0,get:function(){return this.hf},set:function(a){var b=this.hf;if(b!==a){G&&A(a,"string",T,"fromPortId");var c=this.fromPort;null!==c&&$o(c);up(this);this.hf=a;var d=this.fromPort;null!==d&&$o(d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.uj()&&g.Jw(f,a)}c!==d&&(this.hg=null,this.Za(),f=this.fromPortChanged,null!==f&& (g=!0,null!==e&&(g=e.ba,e.ba=!0),f(this,c,d),null!==e&&(e.ba=g)));tp(this);this.g("fromPortId",b,a)}}},fromPort:{configurable:!0,get:function(){var a=this.gf;return null===a?null:a.Ot(this.hf)}},fromPortChanged:{configurable:!0,get:function(){return this.po},set:function(a){var b=this.po;b!==a&&(null!==a&&A(a,"function",T,"fromPortChanged"),this.po=a,this.g("fromPortChanged",b,a))}},toNode:{configurable:!0,get:function(){return this.Df},set:function(a){var b= this.Df;if(b!==a){G&&null!==a&&w(a,V,T,"toNode");var c=this.toPort;null!==b&&(this.gf!==b&&cp(b,this,c),up(this),this.C(2));this.Df=a;null!==a&&this.Sb(a.isVisible());this.hg=null;this.Za();var d=this.diagram;null!==d&&d.ba&&d.partManager.setToNodeForLink(this,a,b);var e=this.toPort,f=this.toPortChanged;if(null!==f){var g=!0;null!==d&&(g=d.ba,d.ba=!0);f(this,c,e);null!==d&&(d.ba=g)}null!==a&&(this.gf!==a&&bp(a,this,e),tp(this),this.C(1));this.g("toNode",b,a);Vo(this)}}},toPortId:{configurable:!0, enumerable:!0,get:function(){return this.Ef},set:function(a){var b=this.Ef;if(b!==a){G&&A(a,"string",T,"toPortId");var c=this.toPort;null!==c&&$o(c);up(this);this.Ef=a;var d=this.toPort;null!==d&&$o(d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.uj()&&g.Nw(f,a)}c!==d&&(this.hg=null,this.Za(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.ba,e.ba=!0),f(this,c,d),null!==e&&(e.ba=g)));tp(this);this.g("toPortId",b,a)}}},toPort:{configurable:!0,get:function(){var a= this.Df;return null===a?null:a.Ot(this.Ef)}},toPortChanged:{configurable:!0,get:function(){return this.vq},set:function(a){var b=this.vq;b!==a&&(null!==a&&A(a,"function",T,"toPortChanged"),this.vq=a,this.g("toPortChanged",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.T?this.T.nh:ed},set:function(a){this.Rc();var b=this.T.nh;b.B(a)||(G&&w(a,Eb,T,"fromSpot"),a=a.L(),this.T.nh=a,this.g("fromSpot",b,a),(b.Vc()||a.Vc())&&null!==this.fromNode&&$o(this.fromPort), this.Za())}},fromEndSegmentLength:{configurable:!0,get:function(){return null!==this.T?this.T.lh:NaN},set:function(a){this.Rc();var b=this.T.lh;b!==a&&(G&&A(a,"number",T,"fromEndSegmentLength"),0>a&&Ba(a,">= 0",T,"fromEndSegmentLength"),this.T.lh=a,this.g("fromEndSegmentLength",b,a),this.Za())}},fromShortLength:{configurable:!0,get:function(){return null!==this.T?this.T.mh:NaN},set:function(a){this.Rc();var b=this.T.mh;b!==a&&(G&&A(a,"number",T,"fromShortLength"),this.T.mh= a,this.ic(!0),this.g("fromShortLength",b,a))}},toSpot:{configurable:!0,get:function(){return null!==this.T?this.T.Jh:ed},set:function(a){this.Rc();var b=this.T.Jh;b.B(a)||(G&&w(a,Eb,T,"toSpot"),a=a.L(),this.T.Jh=a,this.g("toSpot",b,a),(b.Vc()||a.Vc())&&null!==this.toNode&&$o(this.toPort),this.Za())}},toEndSegmentLength:{configurable:!0,get:function(){return null!==this.T?this.T.Hh:NaN},set:function(a){this.Rc();var b=this.T.Hh;b!==a&&(G&&A(a,"number",T,"toEndSegmentLength"), 0>a&&Ba(a,">= 0",T,"toEndSegmentLength"),this.T.Hh=a,this.g("toEndSegmentLength",b,a),this.Za())}},toShortLength:{configurable:!0,get:function(){return null!==this.T?this.T.Ih:NaN},set:function(a){this.Rc();var b=this.T.Ih;b!==a&&(G&&A(a,"number",T,"toShortLength"),this.T.Ih=a,this.ic(!0),this.g("toShortLength",b,a))}},isLabeledLink:{configurable:!0,get:function(){return null===this.td?!1:0<this.td.count}},labelNodes:{configurable:!0,get:function(){return null=== this.td?ib:this.td.iterator}},relinkableFrom:{configurable:!0,get:function(){return 0!==(this.Na&1)},set:function(a){var b=0!==(this.Na&1);b!==a&&(G&&A(a,"boolean",T,"relinkableFrom"),this.Na^=1,this.g("relinkableFrom",b,a),this.Qb())}},relinkableTo:{configurable:!0,get:function(){return 0!==(this.Na&2)},set:function(a){var b=0!==(this.Na&2);b!==a&&(G&&A(a,"boolean",T,"relinkableTo"),this.Na^=2,this.g("relinkableTo",b,a),this.Qb())}},resegmentable:{configurable:!0, get:function(){return 0!==(this.Na&4)},set:function(a){var b=0!==(this.Na&4);b!==a&&(G&&A(a,"boolean",T,"resegmentable"),this.Na^=4,this.g("resegmentable",b,a),this.Qb())}},isTreeLink:{configurable:!0,get:function(){return 0!==(this.Na&8)},set:function(a){var b=0!==(this.Na&8);b!==a&&(G&&A(a,"boolean",T,"isTreeLink"),this.Na^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Lk(this.fromNode),null!==this.toNode&&Lk(this.toNode))}},path:{configurable:!0,get:function(){var a= this.wb();return a instanceof Kf?a:null}},routeBounds:{configurable:!0,get:function(){this.Ug();var a=this.bm,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.Ze(e)}else if(this.computeCurve()===gg&&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);K.zm(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);K.zm(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.Ze(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Ze(f);this.Av.h(b-a.x,c-a.y)}return a}},midPoint:{configurable:!0, enumerable:!0,get:function(){this.Ug();return this.computeMidPoint(new J)}},midAngle:{configurable:!0,get:function(){this.Ug();return this.computeMidAngle()}},flattenedLengths:{configurable:!0,get:function(){if(null===this.gs){this.zd||vp(this);for(var a=this.gs=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);K.da(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):K.da(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Lf(e));a.push(d)}}return this.gs}},flattenedTotalLength:{configurable:!0, enumerable:!0,get:function(){var a=this.Tu;if(isNaN(a)){for(var b=this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.Tu=a}return a}},points:{configurable:!0,get:function(){return this.Gb},set:function(a){var b=this.Gb;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 H,d=0;d<a.length/2;d++)e=(new J(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(!Ga(f)||"number"!==typeof f.x||isNaN(f.x)||"number"!==typeof f.y||isNaN(f.y)){d=!1;break}}if(d)for(c=new H,d=0;d<a.length;d++)e=a[d],c.add((new J(e.x,e.y)).freeze());else G&&v("Link.points array must contain only an even number of numbers or objects with x and y properties, not: "+a)}}else if(a instanceof H)for(c=a.copy(),a=c.iterator;a.next();)a.value.freeze();else v("Link.points value is not an instance of List or Array: "+a);c.freeze();this.Gb=c;this.ic(!0);vp(this);a=this.diagram;null!== a&&(a.tj||a.undoManager.isUndoingRedoing||a.cu.add(this),a.animationManager.yc&&(a=a.animationManager,this.wf=c,a.dm.add(this)));this.g("points",b,c)}}},pointsCount:{configurable:!0,get:function(){return this.Gb.count}},zd:{configurable:!0,get:function(){return 0!==(this.Na&16)},set:function(a){0!==(this.Na&16)!==a&&(this.Na^=16)}},suspendsRouting:{configurable:!0,get:function(){return 0!==(this.Na&32)},set:function(a){0!==(this.Na&32)!==a&&(this.Na^=32)}}, computingPoints:{configurable:!0,get:function(){return 0!==(this.Na&64)},set:function(a){0!==(this.Na&64)!==a&&(this.Na^=64)}},defaultFromPoint:{configurable:!0,get:function(){return this.o},set:function(a){this.o=a.copy()}},defaultToPoint:{configurable:!0,get:function(){return this.F},set:function(a){this.F=a.copy()}},isOrthogonal:{configurable:!0,get:function(){return 2===(this.ik.value&2)}},isAvoiding:{configurable:!0,get:function(){return 4=== (this.ik.value&4)}},jn:{configurable:!0,get:function(){return 0!==(this.Na&128)},set:function(a){0!==(this.Na&128)!==a&&(this.Na^=128)}},geometry:{configurable:!0,get:function(){this.jn||(this.Ug(),this.sa=this.makeGeometry());return this.sa}},firstPickIndex:{configurable:!0,get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!zp(this.computeSpot(!0))?1:0}},lastPickIndex:{configurable:!0,get:function(){var a=this.pointsCount;return 0=== a?0:2>=a?a-1:this.isOrthogonal||!zp(this.computeSpot(!1))?a-2:a-1}},adjusting:{configurable:!0,get:function(){return this.Xk},set:function(a){var b=this.Xk;b!==a&&(G&&a!==dg&&a!==op&&a!==pp&&a!==qp&&v("Link.adjusting can only be set to Link.None, Link.End, LInk.Scale, or Link.Stretch, not: "+a),this.Xk=a,this.g("adjusting",b,a))}},corner:{configurable:!0,get:function(){return this.Qn},set:function(a){var b=this.Qn;b!==a&&(G&&A(a,"number",T,"corner"),this.Qn=a,this.ic(!0), this.g("corner",b,a))}},curve:{configurable:!0,get:function(){return this.Sn},set:function(a){var b=this.Sn;b!==a&&(G&&a!==dg&&a!==gg&&a!==cg&&a!==bg&&v("Link.curve can only be set to Link.None, Link.Bezier, LInk.JumpGap, or Link.JumpOver, not: "+a),this.Sn=a,this.Za(),this.ic(!0),wp(this,b===cg||b===bg||a===cg||a===bg),this.g("curve",b,a))}},curviness:{configurable:!0,get:function(){return this.Tn},set:function(a){var b=this.Tn;b!==a&&(G&&A(a,"number",T,"curviness"),this.Tn= a,this.Za(),this.ic(!1),this.g("curviness",b,a))}},routing:{configurable:!0,get:function(){return this.ik},set:function(a){var b=this.ik;b!==a&&(G&&a!==np&&a!==Wp&&a!==Xp&&a!==Fp&&v("Link.routing can only be set to Link.Normal, Link.Orthogonal, LInk.AvoidsNodes, not: "+a),this.ik=a,this.hg=null,this.Za(),wp(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{configurable:!0,get:function(){return this.iq},set:function(a){var b=this.iq;b!==a&&(G&& A(a,"number",T,"smoothness"),this.iq=a,this.ic(!0),this.g("smoothness",b,a))}},key:{configurable:!0,get:function(){var a=this.diagram;if(null!==a&&a.model.uj())return a.model.sc(this.data)}}});T.prototype.invalidateOtherJumpOvers=T.prototype.Wq;T.prototype.findClosestSegment=T.prototype.bA;T.prototype.updateRoute=T.prototype.Ug;T.prototype.invalidateRoute=T.prototype.Za;T.prototype.rollbackRoute=T.prototype.Fw;T.prototype.commitRoute=T.prototype.Jf;T.prototype.startRoute=T.prototype.ai; T.prototype.clearPoints=T.prototype.uk;T.prototype.removePoint=T.prototype.Bw;T.prototype.addPointAt=T.prototype.Hf;T.prototype.addPoint=T.prototype.ie;T.prototype.insertPointAt=T.prototype.m;T.prototype.insertPoint=T.prototype.HA;T.prototype.setPointAt=T.prototype.O;T.prototype.setPoint=T.prototype.Xc;T.prototype.getPoint=T.prototype.i;T.prototype.getOtherPort=T.prototype.yA;T.prototype.getOtherNode=T.prototype.Sq; var xp=null,yp=null,np=new E(T,"Normal",1),Wp=new E(T,"Orthogonal",2),Xp=new E(T,"AvoidsNodes",6),Fp=new E(T,"AvoidsNodesStraight",7),dg=new E(T,"None",0),gg=new E(T,"Bezier",9),cg=new E(T,"JumpGap",10),bg=new E(T,"JumpOver",11),op=new E(T,"End",17),pp=new E(T,"Scale",18),qp=new E(T,"Stretch",19),bn=new E(T,"OrientAlong",21),Vm=new E(T,"OrientPlus90",22),Xm=new E(T,"OrientMinus90",23),rp=new E(T,"OrientOpposite",24),cn=new E(T,"OrientUpright",25),Wm=new E(T,"OrientPlus90Upright",26),Ym=new E(T,"OrientMinus90Upright", 27),Zm=new E(T,"OrientUpright45",28),Hp=16,Gp=14,Ip=8;T.className="Link";T.Normal=np;T.Orthogonal=Wp;T.AvoidsNodes=Xp;T.AvoidsNodesStraight=Fp;T.None=dg;T.Bezier=gg;T.JumpGap=cg;T.JumpOver=bg;T.End=op;T.Scale=pp;T.Stretch=qp;T.OrientAlong=bn;T.OrientPlus90=Vm;T.OrientMinus90=Xm;T.OrientOpposite=rp;T.OrientUpright=cn;T.OrientPlus90Upright=Wm;T.OrientMinus90Upright=Ym;T.OrientUpright45=Zm;T.EndSegmentStep=8;T.CurvinessStart=Hp;T.SpacingMin=Gp;T.OrthoShortCut=Ip;T.AvoidanceCell=8;T.AvoidanceLimit=999; function Vp(a,b,c,d){cb(this);this.Be=this.os=!1;this.fu=a;this.Ry=b;this.tw=c;this.Sy=d;this.links=[]}Vp.prototype.Km=function(){if(!this.os){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.Vu.add(this),this.Be=a.undoManager.isUndoingRedoing))}this.os=!0}; Vp.prototype.Xw=function(){if(this.os){this.os=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.tj&&!this.Be;this.Be=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Zf=null,a.length=0)}0===a.length&&(a=this.fu,null!==this&&null!==a.cf&&a.cf.remove(this),a=this.tw,null!==this&&null!==a.cf&&a.cf.remove(this))}};Vp.className="LinkBundle"; function vk(){cb(this);this.$y=this.group=null;this.Wt=!0;this.abort=!1;this.Ed=this.Dd=1;this.ap=this.$o=-1;this.kc=this.jc=8;this.Vb=null;this.cj=this.bj=0;this.az=11;this.Ly=124} vk.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.Dd=Math.floor((a.x-this.jc)/this.jc)*this.jc;this.Ed=Math.floor((b-this.kc)/this.kc)*this.kc;this.$o=Math.ceil((c+2*this.jc)/this.jc)*this.jc;this.ap=Math.ceil((d+2*this.kc)/this.kc)*this.kc;a=1+(Math.ceil((this.$o-this.Dd)/this.jc)|0);b=1+(Math.ceil((this.ap-this.Ed)/this.kc)|0);if(null===this.Vb||this.bj<a-1||this.cj<b-1){c=[];for(d=0;d<=a;d++)c[d]=new Uint32Array(b);this.Vb=c;this.bj= a-1;this.cj=b-1}a=Yp;if(null!==this.Vb)for(b=0;b<=this.bj;b++)if(c=this.Vb[b],c.fill)c.fill(a);else for(d=0;d<=this.cj;d++)c[d]=a}};function Ck(a,b,c){return a.Dd<=b&&b<=a.$o&&a.Ed<=c&&c<=a.ap}function Kp(a,b,c){if(!Ck(a,b,c))return Yp;b-=a.Dd;b/=a.jc;c-=a.Ed;c/=a.kc;return a.Vb[b|0][c|0]}function Bk(a){if(null!==a.Vb)for(var b=0;b<=a.bj;b++)for(var c=a.Vb[b],d=0;d<=a.cj;d++)c[d]>=Np&&(c[d]=Yp)} vk.prototype.Ik=function(a,b,c,d){if(a>this.$o||a+c<this.Dd||b>this.ap||b+d<this.Ed)return!0;a=(a-this.Dd)/this.jc|0;b=(b-this.Ed)/this.kc|0;c=Math.max(0,c)/this.jc+1|0;var e=Math.max(0,d)/this.kc+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.bj)|0;for(c=Math.min(b+e-1,this.cj)|0;a<=d;a++){e=this.Vb[a];for(var f=b;f<=c;f++)if(e[f]===Dk)return!1}return!0}; function Zp(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.Vb[l][m];if(n>=Np&&n<Lp)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Vb[l][m]);)a.Vb[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)Zp(a,b,c,1,!e,f,g,h,k),Zp(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)Zp(a,b,c,1,!e,f,g,h,k),Zp(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)Zp(a,b,c,1,!e,f,g,h,k),Zp(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)Zp(a,b,c,1,!e,f,g,h,k),Zp(a,b,c,-1,!e,f,g,h, k)}}function $p(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Dk,m=Np;for(a.Vb[b][c]=m;l===Dk&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Vb[b][c]=m,e?c+=d:b+=d,l=a.Vb[b][c]}function aq(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Dk,m=Lp;for(a.Vb[b][c]=m;l===Dk&&b>f&&b<g&&c>h&&c<k;)a.Vb[b][c]=m,e?c+=d:b+=d,l=a.Vb[b][c]} function Jp(a,b,c,d,e,f,g){if(null!==a.Vb){a.abort=!1;var h=b.x,k=b.y;if(Ck(a,h,k)){h-=a.Dd;h/=a.jc;k-=a.Ed;k/=a.kc;var l=d.x,m=d.y;if(Ck(a,l,m))if(l-=a.Dd,l/=a.jc,m-=a.Ed,m/=a.kc,1>=Math.abs(h-l)&&1>=Math.abs(k-m))a.abort=!0;else{var n=f.x;d=f.y;b=f.x+f.width;var p=f.y+f.height;n-=a.Dd;n/=a.jc;d-=a.Ed;d/=a.kc;b-=a.Dd;b/=a.jc;p-=a.Ed;p/=a.kc;f=Math.max(0,Math.min(a.bj,n|0));b=Math.min(a.bj,Math.max(0,b|0));n=Math.max(0,Math.min(a.cj,d|0));p=Math.min(a.cj,Math.max(0,p|0));d=a.Vb;h|=0;k|=0;l|=0;m|= 0;var r=0===c||90===c?1:-1;c=90===c||270===c;d[h][k]===Dk?($p(a,h,k,r,c,f,b,n,p),$p(a,h,k,1,!c,f,b,n,p),$p(a,h,k,-1,!c,f,b,n,p)):$p(a,h,k,r,c,h,k,h,k);d[l][m]===Dk?(aq(a,l,m,0===e||90===e?1:-1,90===e||270===e,f,b,n,p),aq(a,l,m,1,!(90===e||270===e),f,b,n,p),aq(a,l,m,-1,!(90===e||270===e),f,b,n,p)):aq(a,l,m,r,c,l,m,l,m);c=Ma();if(g&&bq(a,l,m,e,h,k,c)){if(c[0]!==l||c[1]!==m)c.unshift(m),c.unshift(l);if(c[c.length-2]!==h||c[c.length-1]!==k)c.push(h),c.push(k);a=Np;e=c[c.length-2];g=c[c.length-1];d[e][g]= a++;for(f=c.length-4;0<=f;f-=2)for(e=c[f+2],g=c[f+3],b=c[f],l=c[f+1];b>e?e++:b<e?e--:l>g?g++:l<g&&g--,d[e][g]=a++,e!==b||g!==l;);}else Zp(a,h,k,1,!1,f,b,n,p),Zp(a,h,k,-1,!1,f,b,n,p),Zp(a,h,k,1,!0,f,b,n,p),Zp(a,h,k,-1,!0,f,b,n,p);Oa(c)}}}} function bq(a,b,c,d,e,f,g){for(var h=a.Vb,k=b,l=c;;){if(k===e&&l===f)return!0;var m=k,n=l;if(0===d)if(m<e)m++;else break;else if(90===d)if(n<f)n++;else break;else if(180===d)if(m>e)m--;else break;else if(n>f)n--;else break;var p=h[m][n];if(0===p||p===cq)break;k=m;l=n}for(;;){m=d;n=k;p=l;0===d?p<f?(m=90,p++):p>f&&(m=270,p--):90===d?n<e?(m=0,n++):n>e&&(m=180,n--):180===d?p<f?(m=90,p++):p>f&&(m=270,p--):n<e?(m=0,n++):n>e&&(m=180,n--);n=h[n][p];if(m!==d&&0!==n&&n!==cq){g.push(k);g.push(l);if(bq(a,k,l, m,e,f,g))return!0;g.pop();g.pop()}h[k][l]=cq;if(0===d){if(k===b)return!1;k--}else if(90===d){if(l===c)return!1;l--}else if(180===d){if(k===b)return!1;k++}else{if(l===c)return!1;l++}}} na.Object.defineProperties(vk.prototype,{bounds:{configurable:!0,get:function(){return new M(this.Dd,this.Ed,this.$o-this.Dd,this.ap-this.Ed)}},Iq:{configurable:!0,get:function(){return this.jc},set:function(a){0<a&&a!==this.jc&&(this.jc=a,this.initialize(this.bounds))}},Hq:{configurable:!0,get:function(){return this.kc},set:function(a){0<a&&a!==this.kc&&(this.kc=a,this.initialize(this.bounds))}}});var Dk=0,Np=1,Lp=999999,Yp=Lp+1,cq=Lp+2;vk.className="PositionArray"; function Dp(){cb(this);this.port=this.node=null;this.le=[];this.$q=!1}Dp.prototype.toString=function(){for(var a=this.le,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 dq(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}Dp.prototype.Km=function(){this.le.length=0}; function Ep(a,b){var c=a.le;if(0===c.length){a:if(!a.$q){c=a.$q;a.$q=!0;var d=null,e=a.node,f=e instanceof yf?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.uy();else{if(!f.actualBounds.s()){a.$q=c;break a}d=f;g=d.Zv()}f=a.le.length=0;var h=a.port.ja(Dc,J.alloc()),k=a.port.ja(Nc,J.alloc());e=M.allocAt(h.x,h.y,0,0);e.Ze(k);J.free(h);J.free(k);h=J.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.oj();for(g=g.iterator;g.next();){var l=g.value;if(l.isVisible()&& l.fromPort!==l.toPort){var m=l.fromPort===a.port||null!==l.fromNode&&l.fromNode.Nd(d),n=l.computeSpot(m,a.port);if(n.Vc()){var p=m?l.toPort:l.fromPort;if(null!==p&&(m=p.part,null!==m)){var r=m.findVisibleNode();null!==r&&r!==m&&(m=r,p=m.port);m=l.computeOtherPoint(m,p);p=h.Ua(p.ja(Jc));r=h.Ua(m);p+=(r-p)/360;p-=k;0>p?p+=360:360<=p&&(p-=360);n=dq(e,n,p,l.isOrthogonal);0===n?(n=4,180<p&&(p-=360)):90===n?(n=8,270<p&&(p-=360)):180===n?n=2:(n=1,90>p&&(p+=360));r=a.le[f];void 0===r?(r=new eq(l,p,n),a.le[f]= r):(r.link=l,r.angle=p,r.Ec=n);r.vw.set(m);f++}}}}J.free(h);a.le.sort(Dp.prototype.j);k=a.le.length;d=-1;for(f=h=0;f<k;f++)g=a.le[f],void 0!==g&&(g.Ec!==d&&(d=g.Ec,h=0),g.Tq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.le[f],void 0!==k&&(k.Ec!==d&&(d=k.Ec,h=k.Tq+1),k.Dm=h);f=a.le;n=a.port;d=a.node.portSpreading;h=J.alloc();k=J.alloc();g=J.alloc();l=J.alloc();n.ja(Dc,h);n.ja(Fc,k);n.ja(Nc,g);n.ja(Lc,l);r=p=m=n=0;if(d===kp)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var y=u.link.computeThickness(); switch(u.Ec){case 8:p+=y;break;case 2:r+=y;break;case 1:n+=y;break;default:case 4:m+=y}}}var x=q=0,z=1,B=u=0;for(y=0;y<f.length;y++){var D=f[y];if(null!==D){if(q!==D.Ec){q=D.Ec;switch(q){case 8:var F=g;x=l;break;case 2:F=l;x=h;break;case 1:F=h;x=k;break;default:case 4:F=k,x=g}u=x.x-F.x;B=x.y-F.y;switch(q){case 8:p>Math.abs(u)?(z=Math.abs(u)/p,p=Math.abs(u)):z=1;break;case 2:r>Math.abs(B)?(z=Math.abs(B)/r,r=Math.abs(B)):z=1;break;case 1:n>Math.abs(u)?(z=Math.abs(u)/n,n=Math.abs(u)):z=1;break;default:case 4:m> Math.abs(B)?(z=Math.abs(B)/m,m=Math.abs(B)):z=1}x=0}var L=D.Zq;if(d===kp){D=D.link.computeThickness();D*=z;L.set(F);switch(q){case 8:L.x=F.x+u/2+p/2-x-D/2;break;case 2:L.y=F.y+B/2+r/2-x-D/2;break;case 1:L.x=F.x+u/2-n/2+x+D/2;break;default:case 4:L.y=F.y+B/2-m/2+x+D/2}x+=D}else{var Z=.5;d===Xo&&(Z=(D.Tq+1)/(D.Dm+1));L.x=F.x+u*Z;L.y=F.y+B*Z}}}J.free(h);J.free(k);J.free(g);J.free(l);F=a.le;for(f=0;f<F.length;f++)d=F[f],null!==d&&(d.Xv=a.computeEndSegmentLength(d));a.$q=c;M.free(e)}c=a.le}for(a=0;a<c.length;a++)if(e= c[a],null!==e&&e.link===b)return e;return null}Dp.prototype.j=function(a,b){return a===b?0:null===a?-1:null===b?1:a.Ec<b.Ec?-1:a.Ec>b.Ec?1:a.angle<b.angle?-1:a.angle>b.angle?1:0}; Dp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,Cc,b.fromPort===this.port),d=a.Tq;if(0>d)return c;var e=a.Dm;if(1>=e||!b.isOrthogonal)return c;b=a.vw;var f=a.Zq;if(2===a.Ec||8===a.Ec)d=e-1-d;return((a=2===a.Ec||4===a.Ec)?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)};Dp.className="Knot";function eq(a,b,c){this.link=a;this.angle=b;this.Ec=c;this.vw=new J;this.Dm=this.Tq=0;this.Zq=new J;this.Xv=0} eq.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Ec.toString()+":"+this.Tq.toString()+"/"+this.Dm.toString()+" "+this.Zq.toString()+" "+this.Xv.toString()+" "+this.vw.toString()};eq.className="LinkInfo";function ml(){this.Jh=this.nh=ed;this.Ih=this.mh=this.Hh=this.lh=NaN;this.tq=this.no=null;this.uq=this.oo=Infinity} ml.prototype.copy=function(){var a=new ml;a.nh=this.nh.L();a.Jh=this.Jh.L();a.lh=this.lh;a.Hh=this.Hh;a.mh=this.mh;a.Ih=this.Ih;a.no=this.no;a.tq=this.tq;a.oo=this.oo;a.uq=this.uq;return a};ml.className="LinkSettings";function Ei(a){cb(this);this.o=this.D=null;this.Ei=this.Go=!0;this.Lo=!1;this.xn=(new J(0,0)).freeze();this.Io=!0;this.En=this.Ho=null;this.Ko=!1;this.j=null;this.F=0;this.bp=this.zq=null;this.Dt=!1;this.Jg=this.kk=null;this.st=!1;a&&Object.assign(this,a)} Ei.prototype.cloneProtected=function(a){a.Go=this.Go;a.Ei=this.Ei;a.Lo=this.Lo;a.xn.assign(this.xn);a.Io=this.Io;a.Ho=this.Ho;a.En=this.En;a.Ko=!0;a.bp=this.bp;a.zq=this.zq};Ei.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Ei.prototype.serializeLayoutProperties=function(a){a.arrangementOrigin={x:this.arrangementOrigin.x,y:this.arrangementOrigin.y};a.isRouting=this.isRouting}; Ei.prototype.deserializeLayoutProperties=function(a){null!==a&&(this.arrangementOrigin=new J(a.arrangementOrigin.x,a.arrangementOrigin.y),this.isRouting=a.isRouting)};Ei.prototype.ob=function(a){Ea(this,a)};Ei.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+")"}; Ei.prototype.C=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.tc(),this.isOngoing&&a.tj||this.isInitial&&!a.tj)&&(this.isValidLayout=!1,a.Kb())}}};Ei.prototype.createNetwork=function(){return new fq(this)};Ei.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof R?(b.Lg(a.nodes,!0),b.Lg(a.links,!0)):a instanceof yf?b.Lg(a.memberParts):b.Lg(a.iterator);return b}; Ei.prototype.updateParts=function(){this.isValidLayout=!0;if(!this.workerLayout()){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}try{null!==a&&a.Da("Layout"),this.commitLayout()}finally{null!==a&&a.cb("Layout")}}};Ei.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()}}; Ei.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");var b=new I;a instanceof R?(gq(this,b,a.nodes,!0,this.Zh,!0,!1,!0),gq(this,b,a.parts,!0,this.Zh,!0,!1,!0)):a instanceof yf?gq(this,b,a.memberParts,!1,this.Zh,!0,!1,!0):b.addAll(a.iterator);0<b.count&&(a=this.diagram,null!==a&&a.Da("Layout"),this.doMinimalNoNetworkLayout(b),null!==a&&a.cb("Layout"));this.isValidLayout=!0}; Ei.prototype.doMinimalNoNetworkLayout=function(a){var b=Math.ceil(Math.sqrt(a.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var c=this.arrangementOrigin.x,d=c,e=this.arrangementOrigin.y,f=0,g=0;for(a=a.iterator;a.next();){var h=a.value;hq(h);var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(d,e);h instanceof yf&&(h.Zh=!1);d+=Math.max(l,50)+20;g=Math.max(g,Math.max(k,50));f>=b-1?(f=0,d=c,e+=g+20,g=0):f++}}; Ei.prototype.doMinimalNetworkLayout=function(){var a=Math.ceil(Math.sqrt(this.network.vertexes.count));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);for(var b=this.arrangementOrigin.x,c=b,d=this.arrangementOrigin.y,e=0,f=0,g=this.network.vertexes.iterator;g.next();){var h=g.value.node;if(!(null===h||h instanceof T)&&(hq(h),this.Zh(h))){var k=h.measuredBounds,l=k.width;k=k.height;h.moveTo(c,d);h instanceof yf&&(h.Zh=!1);c+=Math.max(l,50)+20;f=Math.max(f,Math.max(k,50));e>=a-1?(e= 0,c=b,d+=f+20,f=0):e++}}};Ei.prototype.Zh=function(a){return!a.location.s()||a instanceof yf&&a.Zh?!0:!1};function gq(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 V?k.isLinkLabel||(k instanceof yf?null===k.layout?gq(a,b,k.memberParts,!1,e,f,g,h):(hq(k),b.add(k)):(hq(k),b.add(k))):g&&k instanceof T?b.add(k):!h||!k.Uc()||k instanceof V||(hq(k),b.add(k)))}} function hq(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Xa()}Ei.prototype.qj=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new M),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b}; Ei.prototype.hy=function(a){var b=new I;a instanceof R?(gq(this,b,a.nodes,!0,null,!0,!0,!0),gq(this,b,a.links,!0,null,!0,!0,!0),gq(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof yf?gq(this,b,a.memberParts,!1,null,!0,!0,!0):gq(this,b,a.iterator,!1,null,!0,!0,!0);return b}; Ei.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.ja(Dc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a};Ei.prototype.mayUseWorker=function(){return this.mayUseWorkerFunction?this.mayUseWorkerFunction(this):!1};Ei.prototype.workerLayout=function(){return!1}; function iq(a,b){if(null!==a.workerStateChanged){var c={key:a.group?a.group.key:null};void 0!==b&&(c.time=b);null!==a.kk&&(c.running=jq(a.kk));null!==a.Jg&&(c.waiting=jq(a.Jg));a.workerStateChanged(c,a)}}function jq(a){return{vertexes:a.vertexes.count,edges:a.edges.count}}Ei.prototype.Hz=function(){var a=kq(this.constructor);a&&(null!==a.$e&&a.$e.terminate(),a.$e=null,a.Mm.iteratorValues.each(function(a){a.Dt=!1;a.kk=null;a.Jg=null;a.st=!1;iq(a)}),a.Mm.clear())}; function lq(a,b){var c=kq(a);if(c){if(b)for(var d in b)c[d]=b[d]}else throw Error("Unknown Layout class: "+a);}function kq(a){var b=null;if("function"===typeof a){if(b=mq.get(a),!b){var c=Pa(a);b=mq.get(c);b||(b=new nq,b.Rv=a,b.name=c,b.j=a.name,b.Gy=oq,mq.set(c,b),mq.set(a,b),mq.set(a.name,b))}}else"string"===typeof a&&(b=mq.get(a));return b} Ei.prototype.Ww=function(){if("undefined"===typeof Worker||!pq||"undefined"===typeof self||"undefined"!==typeof self.DedicatedWorkerGlobalScope)return!1;if(!this.mayUseWorker())return this.Dt&&(this.st=!0,this.Jg=this.kk=null,iq(this)),!1;var a=kq(this.constructor);if(null===a)return!1;null===a.$e&&(a.$e=new Worker(pq),a.$e.onerror=function(a){a.preventDefault();Fa("Worker Error at: "+a.filename+" "+a.lineno+" "+a.colno+"\n "+a.message)},a.$e.j=function(a){Fa("Worker serialization error: "+a)},a.$e.onmessage= function(b){var c=b.data;if("_GoJS"===c._GoJS)if(c.version&&R.version&&c.version!==R.version)Fa("Failure: GoJS v"+R.version+" Worker v"+c.version);else if(b=a.Mm.get(c.id)){a.Mm.remove(c.id);b.Dt=!1;b.kk=null;if(b.st)b.st=!1,b.Jg=null;else{var d=qq(b,c,!1);b.network=d;b.updateParts();b.network=null;b.isValidLayout=!0}iq(b,c.time);c=b.Jg;if(null!==c)b.Jg=null;else for(d=a.Mm.iteratorValues;d.next();){var e=d.value;c=e.Jg;if(null!==c){e.Jg=null;break}}null!==c&&rq(b,c)}},a.$e.postMessage({_GoJS:"_GoJS", url:a.Gy}),Array.isArray(a.scripts)&&a.scripts.forEach(function(b){a.$e.postMessage({_GoJS:"_GoJS",url:b})}),a.$e.postMessage({_GoJS:"_GoJS",version:-1}));null!==this.kk?this.Jg=this.network:rq(this,this.network);iq(this);this.doMinimalNetworkLayout();this.network=null;return this.isValidLayout=!0};function rq(a,b){a.Dt=!0;var c=kq(a.constructor),d=sq(a,b,!0);d._GoJS="_GoJS";c.$e.postMessage(d);c.Mm.set(mb(a),a);a.kk=b} function sq(a,b,c){a.onNetworkSerialization(1,c,b,null);var d={};a.serializeLayoutProperties(d,c);var e=[];b.vertexes.each(function(a){var b={};a.serializeVertexProperties(b,c);e.push(b)});var f=[];b.edges.each(function(a){var b={};a.serializeEdgeProperties(b,c);f.push(b)});d={id:c?mb(a):a.id,layout:Pa(a.constructor),p:d,vB:e,$z:f};a.onNetworkSerialization(2,c,b,d);return d} function qq(a,b,c){c&&(a.id=b.id);var d=a.diagram,e=a.createNetwork();a.onNetworkSerialization(3,c,e,b);var f=b.vB,g=new zb;f&&f.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.Ib(a.key));null!==b?b=e.sk(b):(b=e.createVertex(),e.Mg(b));c&&null!==a.key&&(b.data={Ii:a.key});g.set(a.id,b)});var h=b.$z,k=new zb;h&&h.forEach(function(a){var b=null;null===a.key||null===d||c||(b=d.findLinkForKey(a.key));var f=e.createEdge();e.xm(f);f.link=b;c&&null!==a.key&&(f.data={Ii:a.key});k.set(a.id, f)});f&&f.forEach(function(a){var b=g.get(a.id);b&&b.deserializeVertexProperties(a,g,k,c)});h&&h.forEach(function(a){var b=k.get(a.id);b&&b.deserializeEdgeProperties(a,g,k,c)});a.deserializeLayoutProperties(b.p,g,k,c,e);a.onNetworkSerialization(4,c,e,b);return e}Ei.prototype.onNetworkSerialization=function(){}; na.Object.defineProperties(Ei.prototype,{diagram:{configurable:!0,get:function(){return this.D},set:function(a){null!==a&&w(a,R,Ei,"diagram");this.D=a}},group:{configurable:!0,get:function(){return this.o},set:function(a){this.o!==a&&(null!==a&&w(a,yf,Ei,"group"),this.o=a,null!==a&&(this.D=a.diagram))}},isOngoing:{configurable:!0,get:function(){return this.Go},set:function(a){this.Go!==a&&(A(a,"boolean",Ei,"isOngoing"),this.Go=a)}},isInitial:{configurable:!0, enumerable:!0,get:function(){return this.Ei},set:function(a){A(a,"boolean",Ei,"isInitial");this.Ei=a;a||(this.Ko=!0)}},isViewportSized:{configurable:!0,get:function(){return this.Lo},set:function(a){this.Lo!==a&&(A(a,"boolean",Ei,"isViewportSized"),(this.Lo=a)&&this.C())}},isRouting:{configurable:!0,get:function(){return this.Io},set:function(a){this.Io!==a&&(A(a,"boolean",Ei,"isRouting"),this.Io=a)}},isRealtime:{configurable:!0,get:function(){return this.Ho}, set:function(a){this.Ho!==a&&(null!==a&&A(a,"boolean",Ei,"isRealtime"),this.Ho=a)}},isValidLayout:{configurable:!0,get:function(){return this.Ko},set:function(a){this.Ko!==a&&(A(a,"boolean",Ei,"isValidLayout"),this.Ko=a,a||(a=this.diagram,null!==a&&(a.Xg=!0)))}},network:{configurable:!0,get:function(){return this.j},set:function(a){this.j!==a&&(null!==a&&w(a,fq,Ei,"network"),this.j=a,null!==a&&(a.layout=this))}},boundsComputation:{configurable:!0,get:function(){return this.En}, set:function(a){this.En!==a&&(null!==a&&A(a,"function",Ei,"boundsComputation"),this.En=a,this.C())}},arrangementOrigin:{configurable:!0,get:function(){return this.xn},set:function(a){w(a,J,Ei,"arrangementOrigin");this.xn.B(a)||(this.xn.assign(a),this.C())}},id:{configurable:!0,get:function(){return this.F},set:function(a){this.F=a}},mayUseWorkerFunction:{configurable:!0,get:function(){return this.bp},set:function(a){this.bp!==a&&(null!==a&&A(a,"function", Ei,"mayUseWorkerFunction"),this.bp=a)}},workerStateChanged:{configurable:!0,get:function(){return this.zq},set:function(a){this.zq!==a&&(null!==a&&A(a,"function",Ei,"workerStateChanged"),this.zq=a)}}});Ei.prototype.useWorker=Ei.prototype.Ww;Ei.declareWorkerLayout=lq;Ei.prototype.cancelWorker=Ei.prototype.Hz;Ei.prototype.collectParts=Ei.prototype.hy;Ei.prototype.getLayoutBounds=Ei.prototype.qj;Ei.prototype.invalidateLayout=Ei.prototype.C; var mq=new zb,oq="object"===typeof ra.document&&ra.document.currentScript?ra.document.currentScript.src:"",pq="undefined"!==typeof URL&&"function"===typeof URL.createObjectURL&&"function"===typeof Blob?URL.createObjectURL(new Blob(["self.onmessage=function(e){if(e.data.url){\nimportScripts(e.data.url);}}"],{type:"text/javascript"})):"";Ei.className="Layout";Ei.GoJSScriptURL=oq;Ei.declareWorkerLayout=lq; "undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&"undefined"!==typeof self&&"undefined"!==typeof self.DedicatedWorkerGlobalScope&&(self.onmessage=function(a){a=a.data;if("_GoJS"===a._GoJS)if(a.url)importScripts(a.url);else if(a.version)self.postMessage({_GoJS:"_GoJS",version:R.version},void 0);else{var b=performance.now(),c=null;a.layout&&(c=kq(a.layout));var d=null;c&&c.Rv&&(d=new c.Rv);if(!d)throw Error("no registered Worker Layout: "+a.layout);d.network=qq(d,a,!0); d.workerLayout=function(){var a=sq(d,d.network,!1);a._GoJS="_GoJS";a.time=performance.now()-b;self.postMessage(a,void 0);return!0};d.doLayout(new H)}});function nq(){this.Rv=null;this.Gy=this.j=this.name="";this.scripts=[];this.$e=null;this.Mm=new zb}function fq(a){cb(this);G&&!a&&v("LayoutNetwork constructor requires non-null Layout argument");this.oc=a;this.Ff=new I;this.ve=new I;this.gu=new zb;this.bu=new zb} fq.prototype.clear=function(){if(this.Ff)for(var a=this.Ff.iterator;a.next();)a.value.clear();if(this.ve)for(a=this.ve.iterator;a.next();)a.value.clear();this.Ff=new I;this.ve=new I;this.gu=new zb;this.bu=new zb}; fq.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.ve.count;if(1<a){for(var c=this.Ff.iterator;c.next();)b+="\n "+c.value.toString(a-1);for(c=this.ve.iterator;c.next();)b+="\n "+c.value.toString(a-1)}return b};fq.prototype.createVertex=function(){return new tq(this)};fq.prototype.createEdge=function(){return new uq(this)}; fq.prototype.Lg=function(a,b,c){if(null!==a){void 0===b&&(b=!1);A(b,"boolean",fq,"addParts:toplevelonly");void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof V)return!a.isLinkLabel;if(a instanceof T){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 V&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof yf&&null===d.layout)this.Lg(d.memberParts,!1);else if(null===this.nj(d)){var e= this.createVertex();e.node=d;this.Mg(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof T&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.Mq(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.Jk(f,e,d))}}}; fq.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.nj(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.nj(b);if(null!==a)return a;b=b.containingGroup}return null};t=fq.prototype;t.Mg=function(a){if(null!==a){G&&w(a,tq,fq,"addVertex:vertex");this.Ff.add(a);var b=a.node;null!==b&&this.gu.add(b,a);a.network=this}}; t.sk=function(a){if(null===a)return null;G&&w(a,V,fq,"addNode:node");var b=this.nj(a);null===b&&(b=this.createVertex(),b.node=a,this.Mg(b));return b};t.Uv=function(a){if(null!==a&&(G&&w(a,tq,fq,"deleteVertex:vertex"),vq(this,a))){for(var b=a.yd,c=b.count-1;0<=c;c--){var d=b.M(c);this.Ak(d)}b=a.Kd;for(a=b.count-1;0<=a;a--)c=b.M(a),this.Ak(c)}};function vq(a,b){if(null===b)return!1;var c=a.Ff.remove(b);c&&(b=b.node,null!==b&&a.gu.remove(b));return c} t.Tz=function(a){null!==a&&(G&&w(a,V,fq,"deleteNode:node"),a=this.nj(a),null!==a&&this.Uv(a))};t.nj=function(a){if(null===a)return null;G&&w(a,V,fq,"findVertex:node");return this.gu.K(a)};t.xm=function(a){if(null!==a){G&&w(a,uq,fq,"addEdge:edge");wq(this,a);var b=a.toVertex;null!==b&&b.Jv(a);b=a.fromVertex;null!==b&&b.Hv(a)}};function wq(a,b){if(null!==b){a.ve.add(b);var c=b.link;null!==c&&null===a.Mq(c)&&a.bu.add(c,b);b.network=a}} t.wz=function(a){if(null===a)return null;G&&w(a,T,fq,"addLink:link");var b=a.fromNode,c=a.toNode,d=this.Mq(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.sk(b)),null!==c&&(d.toVertex=this.sk(c)),this.xm(d)):(null!==b?d.fromVertex=this.sk(b):d.fromVertex=null,null!==c?d.toVertex=this.sk(c):d.toVertex=null);return d};t.Ak=function(a){if(null!==a){G&&w(a,uq,fq,"deleteEdge:edge");var b=a.toVertex;null!==b&&b.Tv(a);b=a.fromVertex;null!==b&&b.Sv(a);xq(this,a)}}; function xq(a,b){null!==b&&a.ve.remove(b)&&(b=b.link,null!==b&&a.bu.remove(b))}t.Sz=function(a){null!==a&&(G&&w(a,T,fq,"deleteLink:link"),a=this.Mq(a),null!==a&&this.Ak(a))};t.Mq=function(a){if(null===a)return null;G&&w(a,T,fq,"findEdge:link");return this.bu.K(a)}; t.Jk=function(a,b,c){if(null===a||null===b)return null;G&&(w(a,tq,fq,"linkVertexes:fromVertex"),w(b,tq,fq,"linkVertexes:toVertex"),null!==c&&w(c,T,fq,"linkVertexes:link"));if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.xm(d);return d}return null};t.Ym=function(a){if(null!==a){G&&w(a,uq,fq,"reverseEdge:edge");var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Sv(a),c.Tv(a),a.Ym(),b.Jv(a),c.Hv(a))}}; t.Kq=function(){for(var a=Ma(),b=this.ve.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.Ak(a[c]);Oa(a)};fq.prototype.deleteArtificialVertexes=function(){for(var a=Ma(),b=this.Ff.iterator;b.next();){var c=b.value;null===c.node&&null===c.data&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.Uv(a[b]);b=Ma();for(c=this.ve.iterator;c.next();){var d=c.value;null===d.link&&null===d.data&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.Ak(b[d]);Oa(a);Oa(b)}; function yq(a){for(var b=Ma(),c=a.ve.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.Ak(b[d]);Oa(b)} fq.prototype.bz=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),yq(this),this.Kq());a=new H;for(var b=!0;b;){b=!1;for(var c=this.Ff.iterator;c.next();){var d=c.value;if(0<d.yd.count||0<d.Kd.count){b=this.layout.createNetwork();a.add(b);zq(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 zq(a,b,c){if(null!==c&&c.network!==b){vq(a,c);b.Mg(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(xq(a,e),wq(b,e),zq(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(xq(a,c),wq(b,c),zq(a,b,c.toVertex))}}fq.prototype.aA=function(){for(var a=new I,b=this.Ff.iterator;b.next();)a.add(b.value.node);for(b=this.ve.iterator;b.next();)a.add(b.value.link);return a}; na.Object.defineProperties(fq.prototype,{layout:{configurable:!0,get:function(){return this.oc},set:function(a){null!==a&&(this.oc=a)}},vertexes:{configurable:!0,get:function(){return this.Ff}},edges:{configurable:!0,get:function(){return this.ve}}});fq.prototype.findAllParts=fq.prototype.aA;fq.prototype.splitIntoSubNetworks=fq.prototype.bz;fq.prototype.deleteSelfEdges=fq.prototype.Kq;fq.prototype.reverseEdge=fq.prototype.Ym;fq.prototype.linkVertexes=fq.prototype.Jk; fq.prototype.findEdge=fq.prototype.Mq;fq.prototype.deleteLink=fq.prototype.Sz;fq.prototype.deleteEdge=fq.prototype.Ak;fq.prototype.addLink=fq.prototype.wz;fq.prototype.addEdge=fq.prototype.xm;fq.prototype.findVertex=fq.prototype.nj;fq.prototype.deleteNode=fq.prototype.Tz;fq.prototype.deleteVertex=fq.prototype.Uv;fq.prototype.addNode=fq.prototype.sk;fq.prototype.addVertex=fq.prototype.Mg;fq.prototype.addParts=fq.prototype.Lg;fq.className="LayoutNetwork"; function tq(a){cb(this);G&&!a&&v("LayoutVertex constructor requires non-null LayoutNetwork argument");this.Zc=a;this.j=(new M(0,0,10,10)).freeze();this.o=(new J(5,5)).freeze();this.Qi=this.qb=null;this.yd=new H;this.Kd=new H} tq.prototype.serializeVertexProperties=function(a){a.id=mb(this);a.key=this.node?this.node.key:this.data?this.data.Ii:void 0;void 0===a.key&&(a.key=null);a.x=this.bounds.x;a.y=this.bounds.y;a.wB=this.bounds.width;a.EA=this.bounds.height;a.fx=this.focus.x;a.fy=this.focus.y;var b=[];this.yd.each(function(a){b.push(mb(a))});a.Zy=b;var c=[];this.Kd.each(function(a){c.push(mb(a))});a.ny=c}; tq.prototype.deserializeVertexProperties=function(a,b,c){if(null!==a){this.x=a.x;this.y=a.y;this.width=a.wB;this.height=a.EA;this.focusX=a.fx;this.focusY=a.fy;var d=this;a.Zy&&a.Zy.forEach(function(a){(a=c.get(a))&&d.yd.add(a)});a.ny&&a.ny.forEach(function(a){(a=c.get(a))&&d.Kd.add(a)})}};tq.prototype.clear=function(){this.Qi=this.qb=null;this.yd=new H;this.Kd=new H}; tq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+mb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.yd.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.Kd.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b}; tq.prototype.commit=function(){var a=this.qb;if(null!==a){var b=this.bounds,c=a.bounds;Ga(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 yf)){c=M.alloc();var d=this.network.layout.qj(a,c),e=a.locationObject.ja(Jc);if(d.s()&&e.s()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));M.free(c);return}M.free(c)}a.moveTo(b.x,b.y)}}; tq.prototype.Jv=function(a){null!==a&&(G&&w(a,uq,tq,"addSourceEdge:edge"),this.yd.contains(a)||this.yd.add(a))};tq.prototype.Tv=function(a){null!==a&&(G&&w(a,uq,tq,"deleteSourceEdge:edge"),this.yd.remove(a))};tq.prototype.Hv=function(a){null!==a&&(G&&w(a,uq,tq,"addDestinationEdge:edge"),this.Kd.contains(a)||this.Kd.add(a))};tq.prototype.Sv=function(a){null!==a&&(G&&w(a,uq,tq,"deleteDestinationEdge:edge"),this.Kd.remove(a))}; function Aq(a,b){G&&w(a,tq,tq,"standardComparer:m");G&&w(b,tq,tq,"standardComparer:n");a=a.Qi;b=b.Qi;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0} na.Object.defineProperties(tq.prototype,{sourceEdgesArrayAccess:{configurable:!0,get:function(){return this.yd._dataArray}},destinationEdgesArrayAccess:{configurable:!0,get:function(){return this.Kd._dataArray}},data:{configurable:!0,get:function(){return this.qb},set:function(a){this.qb=a;if(null!==a&&a.bounds){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.o.h(d/2,b/2);this.j.h(a,c,d,b)}}},node:{configurable:!0,get:function(){return this.Qi}, set:function(a){if(this.Qi!==a){G&&null!==a&&w(a,V,tq,"node");this.Qi=a;a.Xa();var b=this.network.layout,c=M.alloc(),d=b.qj(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.j.h(b,e,f,d);M.free(c);if(!(a instanceof yf)&&(a=a.locationObject.ja(Jc),a.s())){this.o.h(a.x-b,a.y-e);return}this.o.h(f/2,d/2)}}},bounds:{configurable:!0,get:function(){return this.j},set:function(a){this.j.B(a)||(G&&w(a,M,tq,"bounds"),this.j.assign(a))}},focus:{configurable:!0, get:function(){return this.o},set:function(a){this.o.B(a)||(G&&w(a,J,tq,"focus"),this.o.assign(a))}},centerX:{configurable:!0,get:function(){return this.j.x+this.o.x},set:function(a){var b=this.j;b.x+this.o.x!==a&&(G&&C(a,tq,"centerX"),b.ka(),b.x=a-this.o.x,b.freeze())}},centerY:{configurable:!0,get:function(){return this.j.y+this.o.y},set:function(a){var b=this.j;b.y+this.o.y!==a&&(G&&C(a,tq,"centerY"),b.ka(),b.y=a-this.o.y,b.freeze())}},focusX:{configurable:!0, get:function(){return this.o.x},set:function(a){var b=this.o;b.x!==a&&(b.ka(),b.x=a,b.freeze())}},focusY:{configurable:!0,get:function(){return this.o.y},set:function(a){var b=this.o;b.y!==a&&(b.ka(),b.y=a,b.freeze())}},x:{configurable:!0,get:function(){return this.j.x},set:function(a){var b=this.j;b.x!==a&&(b.ka(),b.x=a,b.freeze())}},y:{configurable:!0,get:function(){return this.j.y},set:function(a){var b=this.j;b.y!==a&&(b.ka(),b.y=a,b.freeze())}},width:{configurable:!0, enumerable:!0,get:function(){return this.j.width},set:function(a){var b=this.j;b.width!==a&&(b.ka(),b.width=a,b.freeze())}},height:{configurable:!0,get:function(){return this.j.height},set:function(a){var b=this.j;b.height!==a&&(b.ka(),b.height=a,b.freeze())}},network:{configurable:!0,get:function(){return this.Zc},set:function(a){G&&w(a,fq,tq,"network");this.Zc=a}},sourceVertexes:{configurable:!0,get:function(){for(var a=new I,b=this.sourceEdges;b.next();)a.add(b.value.fromVertex); return a.iterator}},destinationVertexes:{configurable:!0,get:function(){for(var a=new I,b=this.destinationEdges;b.next();)a.add(b.value.toVertex);return a.iterator}},vertexes:{configurable:!0,get:function(){for(var a=new I,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:{configurable:!0,get:function(){return this.yd.iterator}},destinationEdges:{configurable:!0, enumerable:!0,get:function(){return this.Kd.iterator}},edges:{configurable:!0,get:function(){for(var a=new H,b=this.sourceEdges;b.next();)a.add(b.value);for(b=this.destinationEdges;b.next();)a.add(b.value);return a.iterator}},edgesCount:{configurable:!0,get:function(){return this.yd.count+this.Kd.count}}});tq.prototype.deleteDestinationEdge=tq.prototype.Sv;tq.prototype.addDestinationEdge=tq.prototype.Hv;tq.prototype.deleteSourceEdge=tq.prototype.Tv; tq.prototype.addSourceEdge=tq.prototype.Jv;tq.className="LayoutVertex";tq.standardComparer=Aq; tq.smartComparer=function(a,b){G&&w(a,tq,tq,"smartComparer:m");G&&w(b,tq,tq,"smartComparer:n");if(null!==a){if(null!==b){a=a.Qi;var c=b.Qi;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 uq(a){cb(this);G&&!a&&v("LayoutEdge constructor requires non-null LayoutNetwork argument");this.Fc=a;this.kd=this.dd=this.Pl=this.qb=null}uq.prototype.clear=function(){this.kd=this.dd=this.Pl=this.qb=null}; uq.prototype.serializeEdgeProperties=function(a){a.id=mb(this);a.key=this.link?this.link.key:this.data?this.data.Ii:void 0;void 0===a.key&&(a.key=null);a.from=this.fromVertex?mb(this.fromVertex):null;a.rB=this.toVertex?mb(this.toVertex):null};uq.prototype.deserializeEdgeProperties=function(a,b){if(null!==a){var c=b.get(a.from);c&&(this.fromVertex=c);if(a=b.get(a.rB))this.toVertex=a}}; uq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+mb(this);0<a&&(b+=null!==this.Pl?"("+this.Pl.toString()+")":"",1<a&&(b+=" "+(this.dd?this.dd.toString():"null")+" --\x3e "+(this.kd?this.kd.toString():"null")));return b};uq.prototype.Ym=function(){var a=this.dd;this.dd=this.kd;this.kd=a};uq.prototype.commit=function(){};uq.prototype.Dy=function(a){G&&w(a,tq,uq,"getOtherVertex:v");return this.kd===a?this.dd:this.dd===a?this.kd:null}; na.Object.defineProperties(uq.prototype,{network:{configurable:!0,get:function(){return this.Fc},set:function(a){G&&w(a,fq,uq,"network");this.Fc=a}},data:{configurable:!0,get:function(){return this.qb},set:function(a){this.qb!==a&&(G&&null!==a&&A(a,"object",uq,"data"),this.qb=a)}},link:{configurable:!0,get:function(){return this.Pl},set:function(a){this.Pl!==a&&(G&&null!==a&&w(a,T,uq,"link"),this.Pl=a)}},fromVertex:{configurable:!0,get:function(){return this.dd}, set:function(a){this.dd!==a&&(G&&null!==a&&w(a,tq,uq,"fromVertex"),this.dd=a)}},toVertex:{configurable:!0,get:function(){return this.kd},set:function(a){this.kd!==a&&(G&&null!==a&&w(a,tq,uq,"toVertex"),this.kd=a)}}});uq.prototype.getOtherVertex=uq.prototype.Dy;uq.className="LayoutEdge"; function Vk(a){Ei.call(this);this.isViewportSized=!0;this.Aq=this.Bq=NaN;this.ah=(new Db(NaN,NaN)).freeze();this.yf=(new Db(10,10)).freeze();this.Bb=Bq;this.Lb=Cq;this.gd=Dq;this.bd=Eq;a&&Object.assign(this,a)}ma(Vk,Ei);Vk.prototype.cloneProtected=function(a){Ei.prototype.cloneProtected.call(this,a);a.Bq=this.Bq;a.Aq=this.Aq;a.ah.assign(this.ah);a.yf.assign(this.yf);a.Bb=this.Bb;a.Lb=this.Lb;a.gd=this.gd;a.bd=this.bd}; Vk.prototype.ob=function(a){a.classType===Vk?a===Dq||a===Fq||a===Gq||a===Hq?this.sorting=a:a===Cq||a===Iq?this.arrangement=a:a===Bq||a===Jq?this.alignment=a:v("Unknown enum value: "+a):Ei.prototype.ob.call(this,a)}; Vk.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var b=this.hy(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Xh()||null===d.fromNode&&null===d.toNode){if(d.Xa(),d instanceof yf)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.Ea();if(0!==e.length){switch(this.sorting){case Hq:e.reverse(); break;case Dq:e.sort(this.comparer);break;case Fq: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.Da("Layout");d=[];switch(this.alignment){case Jq:var h=b,k=c,l=M.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n= m=0;n<e.length;n++){var p=this.qj(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 r=this.qj(e[p],l);n=Math.max(n,r.height)}n=Math.max(n+k,1);p=this.arrangement;for(var q=r=this.arrangementOrigin.x,u=this.arrangementOrigin.y,y=0,x=0,z=0;z<e.length;z++){var B=e[z],D=this.qj(B,l),F=Math.ceil((D.width+h)/m)*m,L=Math.ceil((D.height+k)/n)*n;switch(p){case Iq:var Z=Math.abs(q-D.width);break;default:Z=q+D.width}if(0<f&&y>f-1|| 0<g&&0<y&&Z-r>g)d.push(new M(0,u,g+h,x)),y=0,q=r,u+=x,x=0;x=Math.max(x,L);switch(p){case Iq:D=-D.width;break;default:D=0}B.moveTo(q+D,u);switch(p){case Iq:q-=F;break;default:q+=F}y++}d.push(new M(0,u,g+h,x));M.free(l);break;case Bq:k=g;m=f;n=b;p=c;g=M.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=J.alloc();for(q=0;q<e.length;q++)x=e[q],y=this.qj(x,g),x=Io(x,x.locationObject,x.locationSpot,h),l=Math.max(l,x.x),u=Math.max(u,y.width-x.x),f=Math.max(f,x.y);q=this.arrangement;switch(q){case Iq:l+= n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var Q=x=this.arrangementOrigin.x;z=this.arrangementOrigin.y;u=0;k>=l&&(k-=l);l=B=0;F=Math.max(this.cellSize.height,1);D=f=0;L=!0;y=J.alloc();for(Z=0;Z<e.length;Z++){var ba=e[Z],S=this.qj(ba,g),P=Io(ba,ba.locationObject,ba.locationSpot,h);if(0<u)switch(q){case Iq:Q=(Q-x-(S.width-P.x))/r;Q=K.da(Math.round(Q),Q)?Math.round(Q):Math.floor(Q);Q=Q*r+x;break;default:Q=(Q-x+P.x)/r,Q=K.da(Math.round(Q),Q)?Math.round(Q):Math.ceil(Q),Q=Q*r+x}else switch(q){case Iq:B= Q+P.x+S.width;break;default:B=Q-P.x}switch(q){case Iq:var xa=-(Q+P.x)+B;break;default:xa=Q+S.width-P.x-B}if(0<m&&u>m-1||0<k&&0<u&&xa>k){d.push(new M(0,L?z-f:z,k+n,D+f+p));for(Q=0;Q<u&&Z!==u;Q++){xa=e[Z-u+Q];var ka=Io(xa,xa.locationObject,xa.locationSpot,y);xa.moveTo(xa.position.x,xa.position.y+f-ka.y)}D+=p;z=L?z+D:z+(D+f);u=D=f=0;Q=x;L=!1}Q===x&&(l=q===Iq?Math.max(l,S.width-P.x):Math.min(l,-P.x));f=Math.max(f,P.y);D=Math.max(D,S.height-P.y);isFinite(F)&&(D=Math.max(D,Math.max(S.height,F)-P.y));L? ba.moveTo(Q-P.x,z-P.y):ba.moveTo(Q-P.x,z);switch(q){case Iq:Q-=P.x+n;break;default:Q+=S.width-P.x+n}u++}d.push(new M(0,z,k+n,(L?D:D+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=Io(m,m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);J.free(h);J.free(y);if(q===Iq)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);M.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===Iq?this.commitLayers(d,new J(e+b/2-(f+e),g-c/2)):this.commitLayers(d,new J(e-b/2,g-c/2));null!==a&&a.cb("Layout");this.isValidLayout=!0}};Vk.prototype.commitLayers=function(){};function Eq(a,b){G&&w(a,U,Vk,"standardComparer:a");G&&w(b,U,Vk,"standardComparer:b");a=a.text;b=b.text;return a<b?-1:a>b?1:0} na.Object.defineProperties(Vk.prototype,{wrappingWidth:{configurable:!0,get:function(){return this.Bq},set:function(a){this.Bq!==a&&(A(a,"number",Vk,"wrappingWidth"),0<a||isNaN(a))&&(this.Bq=a,this.isViewportSized=isNaN(a),this.C())}},wrappingColumn:{configurable:!0,get:function(){return this.Aq},set:function(a){this.Aq!==a&&(A(a,"number",Vk,"wrappingColumn"),0<a||isNaN(a))&&(this.Aq=a,this.C())}},cellSize:{configurable:!0,get:function(){return this.ah},set:function(a){w(a, Db,Vk,"cellSize");this.ah.B(a)||(this.ah.assign(a),this.C())}},spacing:{configurable:!0,get:function(){return this.yf},set:function(a){w(a,Db,Vk,"spacing");this.yf.B(a)||(this.yf.assign(a),this.C())}},alignment:{configurable:!0,get:function(){return this.Bb},set:function(a){this.Bb!==a&&(eb(a,Vk,Vk,"alignment"),a===Bq||a===Jq)&&(this.Bb=a,this.C())}},arrangement:{configurable:!0,get:function(){return this.Lb},set:function(a){this.Lb!==a&&(eb(a,Vk,Vk,"arrangement"), a===Cq||a===Iq)&&(this.Lb=a,this.C())}},sorting:{configurable:!0,get:function(){return this.gd},set:function(a){this.gd!==a&&(eb(a,Vk,Vk,"sorting"),a===Gq||a===Hq||a===Dq||a===Fq)&&(this.gd=a,this.C())}},comparer:{configurable:!0,get:function(){return this.bd},set:function(a){this.bd!==a&&(A(a,"function",Vk,"comparer"),this.bd=a,this.C())}}}); var Jq=new E(Vk,"Position",0),Bq=new E(Vk,"Location",1),Cq=new E(Vk,"LeftToRight",2),Iq=new E(Vk,"RightToLeft",3),Gq=new E(Vk,"Forward",4),Hq=new E(Vk,"Reverse",5),Dq=new E(Vk,"Ascending",6),Fq=new E(Vk,"Descending",7);Vk.className="GridLayout";Vk.standardComparer=Eq; Vk.smartComparer=function(a,b){G&&w(a,U,Vk,"standardComparer:a");G&&w(b,U,Vk,"standardComparer: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};Vk.Position=Jq;Vk.Location=Bq;Vk.LeftToRight=Cq;Vk.RightToLeft=Iq;Vk.Forward=Gq;Vk.Reverse=Hq;Vk.Ascending=Dq;Vk.Descending=Fq;function zi(){this.tp=new I;this.Wo=new I;this.Ka=new I;this.ef=new zb;this.df=new zb;this.Vj=new zb;this.D=null;this.ur=!1}t=zi.prototype;t.clear=function(){this.tp.clear();this.Wo.clear();this.Ka.clear();this.ef.clear();this.df.clear();this.Vj.clear()}; t.me=function(a){G&&null!==a&&w(a,R,zi,"setDiagram");this.D=a};t.rj=function(a){if(a instanceof V){if(this.tp.add(a),a instanceof yf){var b=a.containingGroup;null===b?this.D.Kh.add(a):b.Vl.add(a);b=a.layout;null!==b&&(b.diagram=this.D)}}else a instanceof T?this.Wo.add(a):a instanceof Le||this.Ka.add(a);b=a.data;null===b||a instanceof Le||(a instanceof T?this.df.add(b,a):this.ef.add(b,a))}; t.Sc=function(a){a.tk();if(a instanceof V){if(this.tp.remove(a),a instanceof yf){var b=a.containingGroup;null===b?this.D.Kh.remove(a):b.Vl.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof T?this.Wo.remove(a):a instanceof Le||this.Ka.remove(a);b=a.data;null===b||a instanceof Le||(a instanceof T?this.df.remove(b):this.ef.remove(b))}; t.Pd=function(){for(var a=this.D.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.Uc()||b instanceof yf)&&v('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.D.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof yf||v('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.D.linkTemplateMap.iterator;a.next();)b= a.value,c=a.key,b instanceof T||v('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=Ma();for(b=this.D.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=Ma();for(c=this.D.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=Ma();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.Dc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.Dc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.Dc(c[d]),null!==e&&(e.location=c[d+1]);Oa(a);Oa(b);Oa(c)};zi.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)}; zi.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.$a(a)&&Kq(c,a,!1)});a.forEach(function(a){d.$a(a)&&c.resolveReferencesForData(a)});!1!==b&&ik(this.diagram,!1)}; function Kq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.ef.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.D.undoManager.isUndoingRedoing&&!a.ef.contains(b)){var d=a.Qq(b);var e=Uo(a,b,d);if(null!==e&&(og(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.$f=d;e.qb=b;a.ur&&(e.th="Tool");a.diagram.add(e);e.qb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}} zi.prototype.insertLink=function(){return null};zi.prototype.resolveReferencesForData=function(){};zi.prototype.Qq=function(a){return this.D.model.Qq(a)}; function Uo(a,b,c){a=a.D;var d=a.model;d.sj()&&d.Yt(b)?(b=a.groupTemplateMap.K(c),null===b&&(b=a.groupTemplateMap.K(""),null===b&&(Lq||(Lq=!0,Fa('No Group template found for category "'+c+'"'),Fa(" Using default group template")),b=a.Gu))):(b=a.nodeTemplateMap.K(c),null===b&&(b=a.nodeTemplateMap.K(""),null===b&&(Mq||(Mq=!0,Fa('No Node template found for category "'+c+'"'),Fa(" Using default node template")),b=a.Iu)));return b}zi.prototype.getLinkCategoryForData=function(){return""}; zi.prototype.setLinkCategoryForData=function(){};zi.prototype.setFromNodeForLink=function(){};zi.prototype.setToNodeForLink=function(){};zi.prototype.findLinkTemplateForCategory=function(a){var b=this.D.linkTemplateMap.K(a);null===b&&(b=this.D.linkTemplateMap.K(""),null===b&&(Nq||(Nq=!0,Fa('No Link template found for category "'+a+'"'),Fa(" Using default link template")),b=this.D.Hu));return b};zi.prototype.removeAllModeledParts=function(){this.lu(this.diagram.model.nodeDataArray)}; zi.prototype.lu=function(a){var b=this;a.forEach(function(a){b.hr(a)})};zi.prototype.hr=function(a){a=this.Dc(a);null!==a&&(Pj(this.diagram,a,!1),this.unresolveReferencesForPart(a))};zi.prototype.unresolveReferencesForPart=function(){};zi.prototype.removeDataForLink=function(){};zi.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.D.model.$b(a);return null!==a?this.ef.K(a):null}; zi.prototype.Ib=function(a){if(null===a||void 0===a)return null;a=this.D.model.$b(a);if(null===a)return null;a=this.ef.K(a);return a instanceof V?a:null};zi.prototype.findLinkForKey=function(){return null};t=zi.prototype;t.Dc=function(a){if(null===a)return null;var b=this.ef.K(a);return null!==b?b:b=this.df.K(a)};t.kj=function(a){if(null===a)return null;a=this.ef.K(a);return a instanceof V?a:null};t.Cc=function(a){return null===a?null:this.df.K(a)}; t.Nt=function(a){for(var b=0;b<arguments.length;++b);b=new I;for(var c=this.tp.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(Ga(g)&&Oq(this,e,g)){b.add(d);break}}}return b.iterator};t.Mt=function(a){for(var b=0;b<arguments.length;++b);b=new I;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(Ga(g)&&Oq(this,e,g)){b.add(d);break}}}return b.iterator}; function Oq(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Ha(f)){if(!Ha(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!Pq(a,e[g],h))return!1}}else if(!Pq(a,e,f))return!1}return!0}function Pq(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(Ga(b)&&Ga(c)){if(!Oq(a,b,c))return!1}else if(b!==c)return!1;return!0} zi.prototype.doModelChanged=function(a){if(this.D){var b=this.D;if(a.model===b.model){var c=a.change;b.doModelChanged(a);if(b.ba){b.ba=!1;try{var d=a.modelChange;if(""!==d)if(c===se){if("nodeCategory"===d){var e=this.Dc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.lu(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===ue){var g=a.newValue;"nodeDataArray"===d&&Ga(g)&&Kq(this,g);b.isModified=!0}else if(c===ve){var h=a.oldValue; "nodeDataArray"===d&&Ga(h)&&this.hr(h);b.isModified=!0}else c===te&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.rr(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Pd());else if(c===se){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Pd()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===ue||c===ve){var m=a.change===ue,n=m?a.newParam:a.oldParam, p=m?a.newValue:a.oldValue,r=this.Vj.K(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)un(q,p,n);else if(!(0>n)){var u=n+mn(q);q.Sc(u,!0);yn(q,u,n)}}b.isModified=!0}}finally{b.ba=!0}}}}};zi.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Ia(a);for(b=this.nodes.iterator;b.next();)b.value.Ia(a);for(b=this.links.iterator;b.next();)b.value.Ia(a)}; zi.prototype.rr=function(){for(var a=this.D.model,b=new I,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){Qq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.Dc(f)&&Rq(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()};zi.prototype.refreshDataBoundLinks=function(){};zi.prototype.updateRelationshipsFromData=function(){}; zi.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.Dc(a);if(null!==c)c.Ia(b);else{c=null;for(var d=this.Vj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].vy(a);null!==g&&(null===c&&(c=Ma()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Ia(b);Oa(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}}; function Lj(a,b){var c=b.Hi;if(Ha(c)){var d=a.Vj.K(c);if(null===d)d=[],d.push(b),a.Vj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Oj(a,b,c){Jj(b,function(a){a=a.$.l;for(var b=a.length,d=0;d<b;d++)gk(c,a[d])});var d=b.Hi;if(Ha(d)){var e=a.Vj.K(d);if(null!==e)for(var f=0;f<e.length;f++)if(e[f]===b){e.splice(f,1);0===e.length&&a.Vj.remove(d);break}}} zi.prototype.yk=function(a,b,c){void 0===c&&(c=!1);var d=new zb;if(Ha(a))for(var e=0;e<a.length;e++)Sq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Sq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.kl.dragsLink;e=new I;for(var f=new zb,g=d.iterator;g.next();){var h=g.value;if(h instanceof T)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof V&&null!==h.data&&c.Lm()){var k=h;h=g.key;var l=h.Pg();null!==l&&(l= d.K(l),null!==l?(c.ne(k.data,c.va(l.data)),k=b.Cc(k.data),h=h.mj(),null!==h&&null!==k&&f.add(h,k)):c.ne(k.data,void 0))}}0<e.count&&b.mu(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.D&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new zb;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.D.model)}for(b=d.iterator;b.next();)b.value.Ia();return d}; function Sq(a,b,c,d,e){if(null===b||e&&!b.canCopy())return null;if(d.contains(b))return d.K(b);var f=a.copyPartData(b,c);if(!(f instanceof U))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof V){for(var g=b.linksConnected;g.next();){var h=g.value;if(h.fromNode===b){var k=d.K(h);null!==k&&(k.fromNode=f)}h.toNode===b&&(h=d.K(h),null!==h&&(h.toNode=f))}if(b instanceof yf&&f instanceof yf)for(b=b.memberParts;b.next();)g=Sq(a,b.value,c,d,e),g instanceof T||null===g||(g.containingGroup= f)}else if(b instanceof T&&f instanceof T)for(g=b.fromNode,null!==g&&(g=d.K(g),null!==g&&(f.fromNode=g)),g=b.toNode,null!==g&&(g=d.K(g),null!==g&&(f.toNode=g)),b=b.labelNodes;b.next();)g=Sq(a,b.value,c,d,e),null!==g&&g instanceof V&&(g.labeledLink=f);return f} zi.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof T||(d=e.copyNodeData(d),Ga(d)&&(e.Gf(d),c=b.Dc(d)))}else og(a),c=a.copy(),null!==c&&(e=this.D,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof T||(e=b.copyNodeData(d)),Ga(e)&&(c.data=e)));return c}; na.Object.defineProperties(zi.prototype,{nodes:{configurable:!0,get:function(){return this.tp}},links:{configurable:!0,get:function(){return this.Wo}},parts:{configurable:!0,get:function(){return this.Ka}},diagram:{configurable:!0,get:function(){return this.D}},addsToTemporaryLayer:{configurable:!0,get:function(){return this.ur},set:function(a){A(a,"boolean",zi,"addsToTemporaryLayer");this.ur=a}}}); zi.prototype.updateAllRelationshipsFromData=zi.prototype.rr;zi.prototype.findLinksByExample=zi.prototype.Mt;zi.prototype.findNodesByExample=zi.prototype.Nt;zi.prototype.findLinkForData=zi.prototype.Cc;zi.prototype.findNodeForData=zi.prototype.kj;zi.prototype.findPartForData=zi.prototype.Dc;zi.prototype.findNodeForKey=zi.prototype.Ib;zi.prototype.removeModeledPart=zi.prototype.hr;zi.prototype.removeModeledParts=zi.prototype.lu;zi.prototype.rebuildParts=zi.prototype.Pd;var Mq=!1,Lq=!1,Nq=!1; zi.className="PartManager";function Tq(a){zi.apply(this,arguments)}ma(Tq,zi);Tq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Uq(this,a.linkDataArray)};Tq.prototype.addModeledParts=function(a){zi.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)Vo(a.value);ik(this.diagram,!1)};function Uq(a,b){b.forEach(function(b){Vq(a,b)});ik(a.diagram,!1)} function Vq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.df.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){og(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.$f=c;e.qb=b;c=a.diagram.model;var f=Wq(c,b,!0);""!==f&&(e.fromPortId=f);f=Xq(c,b,!0);void 0!==f&&(f=a.Ib(f),f instanceof V&&(e.fromNode=f));f=Wq(c,b,!1);""!==f&&(e.toPortId=f);f=Xq(c,b,!1);void 0!==f&&(f=a.Ib(f), f instanceof V&&(e.toNode=f));c=c.Pf(b);Array.isArray(c)&&c.forEach(function(b){b=a.Ib(b);null!==b&&(b.labeledLink=e)});a.ur&&(e.th="Tool");a.diagram.add(e);e.qb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Tq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;Yq(this,a.linkDataArray);this.lu(a.nodeDataArray)};function Yq(a,b){b.forEach(function(b){a.hr(b)})}Tq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Qt(a)}; Tq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.kr(a,b)};Tq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Iw(a.data,c.va(null!==b?b.data:null))};Tq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Mw(a.data,c.va(null!==b?b.data:null))};Tq.prototype.removeDataForLink=function(a){this.diagram.model.Tm(a.data)}; Tq.prototype.findPartForKey=function(a){var b=zi.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.Sh(a),null!==a)?this.df.K(a):b};Tq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Sh(a);return null!==a?this.df.K(a):null}; Tq.prototype.doModelChanged=function(a){var b=this;zi.prototype.doModelChanged.call(this,a);if(this.diagram){var c=this.diagram;if(a.model===c.model){var d=a.change;if(c.ba){c.ba=!1;try{var e=a.modelChange;if(""!==e)if(d===se){if("linkFromKey"===e){var f=this.Cc(a.object);if(null!==f){var g=this.Ib(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.Cc(a.object);if(null!==h){var k=this.Ib(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.Cc(a.object);if(null!==l){var m=a.newValue; "string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.Cc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.Dc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Ib(q);u instanceof yf?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var y=this.Cc(a.object);if(null!==y){var x=a.oldValue,z=a.newValue;Array.isArray(x)&&x.forEach(function(a){0<=z.indexOf(a)|| (a=b.Ib(a),null!==a&&(a.labeledLink=null))});Array.isArray(z)&&z.forEach(function(a){a=b.Ib(a);null!==a&&(a.labeledLink=y)})}}else if("linkCategory"===e){var B=this.Cc(a.object),D=a.newValue;null!==B&&"string"===typeof D&&(B.category=D)}else"linkDataArray"===e&&(Yq(this,a.oldValue),Uq(this,a.newValue));c.isModified=!0}else if(d===ue){var F=a.newValue;if("linkDataArray"===e&&"object"===typeof F&&null!==F)Vq(this,F);else if("linkLabelKeys"===e&&Zq(F)){var L=this.Cc(a.object),Z=this.Ib(F);null!==L&& null!==Z&&(Z.labeledLink=L)}c.isModified=!0}else{if(d===ve){var Q=a.oldValue;if("linkDataArray"===e&&"object"===typeof Q&&null!==Q)this.hr(Q);else if("linkLabelKeys"===e&&Zq(Q)){var ba=this.Ib(Q);null!==ba&&(ba.labeledLink=null)}c.isModified=!0}}else if(d===se){var S=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==S&&"linkToKeyProperty"!==S&&"linkFromPortIdProperty"!==S&&"linkToPortIdProperty"!==S&&"linkLabelKeysProperty"!==S&&"nodeIsGroupProperty"!==S&&"nodeGroupKeyProperty"!==S&&"linkCategoryProperty"!== S||c.undoManager.isUndoingRedoing||this.Pd();c.isModified=!0}}finally{c.ba=!0}}}}};Tq.prototype.refreshDataBoundLinks=function(){var a=this,b=this.diagram.model,c=new I,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){$q(b,a,!1)});d.forEach(function(c){null===a.Cc(c)&&ar(b,c,!1)})}; Tq.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 T){var e=Xq(d,b,!0);e=c.Ib(e);a.fromNode=e;e=Xq(d,b,!1);e=c.Ib(e);a.toNode=e;b=d.Pf(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.va(f.data)===e)return}e=(new I).addAll(b);var g=new I;a.labelNodes.each(function(a){null!==a.data&&(a=d.va(a.data),void 0!==a&&g.add(a))});b=g.copy();b.gr(e);e= e.copy();e.gr(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 Le)&&(b=d.Th(b),b=c.findPartForKey(b),null===b||b instanceof yf)&&(a.containingGroup=b)}}}; Tq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.va(a);if(void 0!==c){var d=br(b,c),e=this.Dc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.$a(g)?e instanceof yf&&b.Th(g)===c&&(g=this.Dc(g),null!==g&&(g.containingGroup=e)):(f.link=this.Cc(g),null!==f.link&&e instanceof V&&(Xq(b,g,!0)===c&&(f.link.fromNode=e),Xq(b,g,!1)===c&&(f.link.toNode=e),g=b.Pf(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}}cr(b,c)}a=b.Th(a);void 0!==a&&(a=this.Ib(a),a instanceof yf&&(e.containingGroup=a))}};Tq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.va(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)dr(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&dr(b,c,d.data));if(a instanceof yf)for(a=a.memberParts;a.next();)d=a.value.data,b.$a(d)&&dr(b,c,d)}}}; Tq.prototype.copyPartData=function(a,b){var c=zi.prototype.copyPartData.call(this,a,b);if(a instanceof T)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.Jq(a);"object"===typeof a&&null!==a&&(d.ej(a),c=b.Cc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.Jq(a),"object"===typeof b&&null!==b&&(c.data=b)));return c}; Tq.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 T){if(og(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 V&&(og(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.Jq(d),"object"=== typeof d&&null!==d))return null!==a&&er(f,d,f.va(a.data),!0),fr(f,d,h,!0),null!==c&&er(f,d,f.va(c.data),!1),fr(f,d,b,!1),f.ej(d),a=g.archetypeLabelNodeData,null===a||a instanceof V||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.Gf(a),a=f.va(a),void 0!==a&&f.Iv(d,a))),e.Cc(d);return null};Tq.prototype.findLinkForKey=Tq.prototype.findLinkForKey;Tq.prototype.findPartForKey=Tq.prototype.findPartForKey;Tq.prototype.removeAllModeledParts=Tq.prototype.removeAllModeledParts; Tq.prototype.addModeledParts=Tq.prototype.addModeledParts;Tq.prototype.addAllModeledParts=Tq.prototype.addAllModeledParts;Tq.className="GraphLinksPartManager";function gr(){zi.apply(this,arguments);this.zh=null}ma(gr,zi); function hr(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||!Of(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(og(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.$f=d; b.qb=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.qb=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}gr.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Tt(a)};gr.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.qu(a,b)}; gr.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.ne(a.data,d.va(b));else{var e=this.zh;this.zh=a;null!==c&&d.ne(c.data,void 0);d.ne(b,d.va(null!==a.toNode?a.toNode.data:null));this.zh=e}}; gr.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.zh;this.zh=a;null!==c&&d.ne(c.data,void 0);d.ne(b,d.va(null!==a.fromNode?a.fromNode.data:null));this.zh=e}else d.ne(a.data,d.va(b))};gr.prototype.removeDataForLink=function(a){this.diagram.model.ne(a.data,void 0)}; gr.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.$b(a);return null!==a?this.df.K(a):null}; gr.prototype.doModelChanged=function(a){zi.prototype.doModelChanged.call(this,a);if(this.diagram){var b=this.diagram;if(a.model===b.model){var c=a.change;if(b.ba){b.ba=!1;try{var d=a.modelChange;if(""!==d){if(c===se){if("nodeParentKey"===d){var e=a.object,f=this.Ib(a.newValue),g=this.kj(e);if(null!==this.zh)null!==f&&(this.zh.data=e,this.zh.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.mj();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:hr(this,f, g)}}else if("parentLinkCategory"===d){var k=this.kj(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.mj();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===se){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Pd());b.isModified=!0}}finally{b.ba=!0}}}}}; gr.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;a instanceof V&&(b=d.Uh(b),b=c.Ib(b),d=a.Pg(),b!==d&&(d=a.mj(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:hr(this,b,a):null!==d&&Pj(c,d,!1)))}}};gr.prototype.updateDataBindings=function(a,b){zi.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.Dc(a)&&(a=this.Cc(a),null!==a&&a.Ia(b))}; gr.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.va(a);if(void 0!==c){var d=br(b,c),e=this.Dc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.$a(f)&&e instanceof V&&b.Uh(f)===c&&hr(this,e,this.kj(f))}cr(b,c)}a=b.Uh(a);void 0!==a&&e instanceof V&&(a=this.Ib(a),hr(this,a,e))}}; gr.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof V){var c=b.va(a.data),d=this.Cc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.Sc(-1,d,!1);0<=f&&this.diagram.ab(ve,"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.$a(e)&&dr(b,c,e)}}; gr.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.ne(e.data,b.va(d.data)),e.mj()):null};gr.prototype.findLinkForKey=gr.prototype.findLinkForKey;gr.className="TreePartManager"; function X(a,b){this.Zl=new I;this.Xl=new I;this.nx=',\n "insertedNodeKeys": ';this.jz=',\n "modifiedNodeData": ';this.px=',\n "removedNodeKeys": ';this.di=null;cb(this);this.Un=this.ta="";this.kg=!1;this.j={};this.xc=[];this.jb=new zb;this.Ri="key";this.il=this.Rl=null;this.Ln=this.Mn=!1;this.On=!0;this.un=null;this.dk="category";this.fg=new zb;this.gv=new H;this.Fg=!1;this.o=null;this.undoManager=new Ee;void 0!==a&&(Ha(a)?this.nodeDataArray=a:Object.assign(this,a));b&&Object.assign(this,b)} X.prototype.cloneProtected=function(a){a.ta=this.ta;a.Un=this.Un;a.kg=this.kg;a.Ri=this.Ri;a.Rl=this.Rl;a.il=this.il;a.Mn=this.Mn;a.Ln=this.Ln;a.On=this.On;a.un=this.un;a.dk=this.dk};X.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};X.prototype.clear=function(){this.xc=[];this.jb.clear();this.fg.clear();this.undoManager.clear()}; X.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.mr();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.va(e)+":"+Qa(e)}}return b}; X.prototype.sB=function(a){w(a,re,X,"toIncrementalData:e");a.change!==te&&v("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof we))return null;ir(this,b);a=this.$w(b,"FinishedUndo"===a.propertyName);this.di=null;return a}; X.prototype.$w=function(a,b){var c=this,d=!1,e=new I,f=new I,g=new I,h=this.di;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ue?e.add(a.newValue):a.change===ve&&g.add(a.oldValue):c.$a(a.object)?f.add(a.object):a.change!==se||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.$a(a)&&f.add(a)}):a.object instanceof X||c.uj()&&c.Bc(a.object)||jr(c,a.object).each(function(a){f.add(a)})): d=!0)});var k=this.Xl;k.clear();e.each(function(a){k.add(c.va(a));b||f.add(a)});var l=this.Zl;l.clear();g.each(function(a){l.add(c.va(a));b&&f.add(a)});a=c.cloneDeep(f.Ea());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.Ea():m.insertedNodeKeys=k.Ea());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.Ea():m.removedNodeKeys=l.Ea());l.clear();k.clear();return m}; X.prototype.cloneDeep=function(a){return kr(this,a,!0)}; function kr(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=qb++,d.set(a,c),e.set(a,b))}if(!Ga(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new zb);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new zb),k=e.iterator;k.next();){var l=k.key;if(k.value===b&&(l=d.get(l)))return l}if(Array.isArray(b)){k=[];g(b,k);for(var m=0;m<b.length;m++)k.push(kr(a,b[m],!1,d,e,f))}else if(b instanceof J||b instanceof Db||b instanceof M||b instanceof gc||b instanceof Eb)k= b.copy(),g(b,k);else{if(b instanceof wl||b instanceof N||b instanceof E)return b;if(b instanceof H)k=(new H).addAll(kr(a,b.Ea(),!1,d,e,f)),g(b,k);else if(b instanceof I)k=(new I).addAll(kr(a,b.Ea(),!1,d,e,f)),g(b,k);else if(b instanceof zb)k=(new zb).addAll(kr(a,b.Ea(),!1,d,e,f)),g(b,k);else if(b instanceof Date)k=new Date(b.getTime()),g(b,k);else if(b instanceof RegExp)k=new RegExp(b),g(b,k),k.lastIndex=b.lastIndex;else if("function"===typeof b.copy)k=b.copy(),g(b,k);else for(m in k={},g(b,k),b)"__gohashid"!== m&&(k[m]=kr(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=X.prototype;t.quote=function(a){return JSON.stringify(a).replace(/[\u007F-\uFFFF]/g,function(a){return"\\u"+("0000"+a.charCodeAt(0).toString(16)).substr(-4)})}; t.kn=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.er=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);!1===a.copiesKey&&(this.copiesKey=!1);a.nodeCategoryProperty&&(this.nodeCategoryProperty=a.nodeCategoryProperty)};function lr(a,b){b=b.modelData;Ga(b)&&(a.Vm(b),a.modelData=b)} t.ax=function(){var a=this.modelData,b=!1,c;for(c in a)if(!mr(c,a[c])){b=!0;break}a="";b&&(a=',\n "modelData": '+nr(this,this.modelData));return a+',\n "nodeDataArray": '+or(this,this.nodeDataArray,!0)};t.yw=function(a){lr(this,a);a=a.nodeDataArray;Ha(a)&&(this.Vm(a),this.nodeDataArray=a)}; function ir(a,b){function c(a,b){if(b=b.part)if(b=b.data,a!==b){var c=d.get(a);null===c?(c=new I,c.add(b),d.add(a,c)):c.add(b)}}var d=a.di;null===d&&(d=new zb,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===se)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===ue||b===ve)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.di=d)}function jr(a,b){for(var c=new I,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];pr(a,b,e,e,c)}return c} function pr(a,b,c,d,e){if(Array.isArray(c))for(var f=0;f<c.length;f++){var g=c[f];if(g===b)return e.add(d),!0;if(pr(a,b,g,d,e))return!0}else if(Ga(c)&&Object.getPrototypeOf(c)===Object.prototype)for(f in c){g=c[f];if(g===b)return e.add(d),!0;if(pr(a,b,g,d,e))return!0}return!1} t.Zw=function(a,b){var c=this,d=!1,e=new I,f=new I,g=new I,h=this.di;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===ue?e.add(a.newValue):a.change===ve&&g.add(a.oldValue):c.$a(a.object)?f.add(a.object):a.change!==se||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.$a(a)&&f.add(a)}):a.object instanceof X||c.uj()&&c.Bc(a.object)||jr(c,a.object).each(function(a){f.add(a)})):d=!0)});var k= this.Xl;k.clear();e.each(function(a){k.add(c.va(a));b||f.add(a)});var l=this.Zl;l.clear();g.each(function(a){l.add(c.va(a));b&&f.add(a)});a="";d&&(a+=',\n "modelData": '+nr(this,this.modelData));0<k.count&&(a+=(b?this.px:this.nx)+or(this,k.Ea(),!0));0<f.count&&(a+=this.jz+or(this,f.Ea(),!0));0<l.count&&(a+=(b?this.nx:this.px)+or(this,l.Ea(),!0));l.clear();k.clear();return a}; t.dr=function(a){(void 0!==a.name&&a.name!==this.name||void 0!==a.dataFormat&&a.dataFormat!==this.dataFormat||void 0!==a.isReadOnly&&a.isReadOnly!==this.isReadOnly||void 0!==a.nodeKeyProperty&&a.nodeKeyProperty!==this.nodeKeyProperty||void 0!==a.copiesArrays&&a.copiesArrays!==this.copiesArrays||void 0!==a.copiesArrayObjects&&a.copiesArrayObjects!==this.copiesArrayObjects||void 0!==a.copiesKey&&a.copiesKey!==this.copiesKey||void 0!==a.nodeCategoryProperty&&a.nodeCategoryProperty!==this.nodeCategoryProperty)&& v("applyIncrementalJson cannot change Model properties");lr(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new zb;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.va(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.$b(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.bn(h,g),this.Gf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.va(e),f=this.$b(f),null!==f){for(var k in e)"__gohashid"===k|| k===this.nodeKeyProperty||this.Hk()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);this.cn(e,f)}a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.$b(a[k]),null!==b&&this.Um(b)}; t.cz=function(a,b){w(a,re,X,"toIncrementalJson:e");a.change!==te&&v("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof we))return'{ "incremental": 0 }';void 0===b&&(b=qr(this,this));ir(this,c);a=this.Zw(c,"FinishedUndo"===a.propertyName);this.di=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.kn()+a+"}"};t.tB=function(a,b){return this.cz(a,b)}; t.mr=function(a){void 0===a&&(a=qr(this,this));return'{ "class": '+this.quote(a)+this.kn()+this.ax()+"}"};t.toJSON=function(a){return this.mr(a)};t.by=function(a){var b=null;if("string"===typeof a)try{b=ra.JSON.parse(a)}catch(d){G&&Fa("JSON.parse error: "+d.toString())}else"object"===typeof a?b=a:v("Unable to modify a Model from: "+a);var c=b.incremental;"number"!==typeof c&&v("Unable to apply non-incremental changes to Model: "+a);0!==c&&(this.Da("applyIncrementalJson"),this.dr(b),this.cb("applyIncrementalJson"))}; t.Cz=function(a){return this.by(a)};X.constructGraphLinksModel=function(){G&&v("Unable to construct a Model. Provided JSON requires GraphLinksModel, which is not loaded.");return new X};t=X.prototype; t.Vm=function(a){if(Ha(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(Ga(d)){var e=c;d=this.Vm(d);Array.isArray(a)?a[e]=d:v("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(Ga(a)){for(b in a)if(c=a[b],Ga(c)&&(c=this.Vm(c),a[b]=c,"points"===b&&Array.isArray(c))){e=0===c.length%2;for(d=0;d<c.length;d++)if("number"!==typeof c[d]){e=!1;break}if(e){e=new H;for(d=0;d<c.length/2;d++)e.add(new J(c[2*d],c[2*d+1]));e.freeze();a[b]=e}}return rr(a)}return a}; t.ln=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.ln(a.valueOf()):Ha(a)?or(this,a):Ga(a)?nr(this,a):"function"===typeof a?"null":a.toString()}; function or(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new fb;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.ln(g)))}c&&1<d&&e.add("\n");e.add("]");return e.toString()}function mr(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function tr(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a} function nr(a,b){var c=b;if(c instanceof J)b={"class":"go.Point",x:tr(c.x),y:tr(c.y)};else if(c instanceof Db)b={"class":"go.Size",width:tr(c.width),height:tr(c.height)};else if(c instanceof M)b={"class":"go.Rect",x:tr(c.x),y:tr(c.y),width:tr(c.width),height:tr(c.height)};else if(c instanceof gc)b={"class":"go.Margin",top:tr(c.top),right:tr(c.right),bottom:tr(c.bottom),left:tr(c.left)};else if(c instanceof Eb)c.fb()?b={"class":"go.Spot",x:tr(c.x),y:tr(c.y),offsetX:tr(c.offsetX),offsetY:tr(c.offsetY)}: b={"class":"go.Spot","enum":c.toString()};else if(c instanceof wl){b={"class":"go.Brush",type:c.type.name};if(c.type===Dl)b.color=c.color;else if(c.type===Gl||c.type===xl)b.start=c.start,b.end=c.end,c.type===xl&&(0!==c.startRadius&&(b.startRadius=tr(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=tr(c.endRadius)));if(null!==c.colorStops){var d={};for(c=c.colorStops.iterator;c.next();)d[c.key]=c.value;b.colorStops=d}}else if(c instanceof N)b={"class":"go.Geometry",type:c.type.name},0!==c.startX&& (b.startX=tr(c.startX)),0!==c.startY&&(b.startY=tr(c.startY)),0!==c.endX&&(b.endX=tr(c.endX)),0!==c.endY&&(b.endY=tr(c.endY)),c.spot1.B(Dc)||(b.spot1=c.spot1),c.spot2.B(Nc)||(b.spot2=c.spot2),c.type===N.o&&(b.path=N.La(c));else if(c instanceof E)b={"class":"go.EnumValue",classType:qr(a,c.classType),name:c.name};else if(G&&null!==ur(qr(a,c)))return Fa("ERROR: trying to convert a GraphObject or Diagram or Model or Tool or Layout or UndoManager or other unknown data into JSON text: "+c.toString()),"{}"; d="{";c=!0;for(var e in b){var f=zn(b,e);if(!mr(e,f))if(c?c=!1:d+=",",d+=a.quote(e)+":","points"===e&&f instanceof H){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.ln(h.x);g+=",";g+=a.ln(h.y)}g+="]";d+=g}else d+=a.ln(f)}return d+"}"}function vr(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)} function rr(a){if("object"!==typeof a)return a;var b=a["class"]||"";if("NaN"===b)return NaN;if("Date"===b)return new Date(a.value);if(0!==b.indexOf("go."))return a;b=b.substr(3);var c=a;if("Point"===b)c=new J(vr(a.x),vr(a.y));else if("Size"===b)c=new Db(vr(a.width),vr(a.height));else if("Rect"===b)c=new M(vr(a.x),vr(a.y),vr(a.width),vr(a.height));else if("Margin"===b)c=new gc(vr(a.top),vr(a.right),vr(a.bottom),vr(a.left));else if("Spot"===b)"string"===typeof a["enum"]?c=ud(a["enum"]):c=new Eb(vr(a.x), vr(a.y),vr(a.offsetX),vr(a.offsetY));else if("Brush"===b){if(c=new wl,c.type=db(wl,a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof Eb&&(c.start=a.start),a.end instanceof Eb&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=vr(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=vr(a.endRadius)),a=a.colorStops,Ga(a))for(var d in a)c.addColorStop(parseFloat(d),a[d])}else"Geometry"===b?(c=null,"string"===typeof a.path?c=N.parse(a.path):c=new N,c.type=db(N, a.type),"number"===typeof a.startX&&(c.startX=vr(a.startX)),"number"===typeof a.startY&&(c.startY=vr(a.startY)),"number"===typeof a.endX&&(c.endX=vr(a.endX)),"number"===typeof a.endY&&(c.endY=vr(a.endY)),a.spot1 instanceof Eb&&(c.spot1=a.spot1),a.spot2 instanceof Eb&&(c.spot2=a.spot2)):"EnumValue"===b&&(d=a.classType,0===d.indexOf("go.")&&(d=d.substr(3)),d=ur(d),"function"===typeof d&&(c=db(d,a.name)));return c}t.Oh=function(a){A(a,"function",X,"addChangedListener:listener");this.gv.add(a);return this}; t.Tk=function(a){A(a,"function",X,"removeChangedListener:listener");this.gv.remove(a)};t.Gt=function(a){this.skipsUndoManager||this.undoManager.iw(a);for(var b=this.gv,c=b.length,d=0;d<c;d++)b.M(d)(a)};t.ab=function(a,b,c,d,e,f,g){wr(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){wr(this,"",se,a,this,b,c,d,e)};t.ju=function(a,b,c,d,e,f){wr(this,"",se,b,a,c,d,e,f)}; function wr(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new re;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.Gt(l)} X.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===se){var c=a.object,d=a.propertyName,e=a.K(b);d===this.nodeKeyProperty&&this.$a(c)&&(b=a.K(!b),void 0!==b&&this.jb.remove(b),void 0!==e&&this.jb.add(e,c));Wj(c,d,e)}else a.change===ue?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,Ga(a)&&"number"===typeof c&&(d=this.va(a),b?(this.xc[c]===a&&La(this.xc,c),void 0!==d&&this.jb.remove(d)):(this.xc[c]!==a&&Ka(this.xc,c,a),void 0!==d&&this.jb.add(d,a)))):""===a.modelChange? ((d=a.object)&&!Ha(d)&&a.propertyName&&(d=zn(a.object,a.propertyName)),Ha(d)&&"number"===typeof c&&(a=a.newValue,b?La(d,c):Ka(d,c,a))):v("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.change===ve?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,Ga(a)&&"number"===typeof c&&(d=this.va(a),b?(this.xc[c]!==a&&Ka(this.xc,c,a),void 0!==d&&this.jb.add(d,a)):(this.xc[c]===a&&La(this.xc,c),void 0!==d&&this.jb.remove(d)))):""===a.modelChange?((d=a.object)&&!Ha(d)&&a.propertyName&&(d= zn(a.object,a.propertyName)),Ha(d)&&"number"===typeof c&&(a=a.oldValue,b?Ka(d,c,a):La(d,c))):v("unknown ChangedEvent.Remove modelChange: "+a.toString())):a.change!==te&&v("unknown ChangedEvent: "+a.toString())};X.prototype.Da=function(a){return this.undoManager.Da(a)};X.prototype.cb=function(a){return this.undoManager.cb(a)};X.prototype.Uf=function(){return this.undoManager.Uf()}; X.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Da(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.cb(b):this.undoManager.Uf(),this.skipsUndoManager=c}};t=X.prototype;t.Ia=function(a,b){void 0===b&&(b="");wr(this,"SourceChanged",te,b,a,null,null)};function xr(a,b,c){"string"!==typeof a&&"function"!==typeof a&&za(a,"string or function",b,c)} t.va=function(a){if(null!==a){var b=this.Ri;if(""!==b&&(b=zn(a,b),void 0!==b)){if(Zq(b))return b;v("Key value for node data "+a+" is not a number or a string: "+b)}}}; t.bn=function(a,b){void 0!==b&&null!==b&&Zq(b)||za(b,"number or string",X,"setKeyForNodeData:key");if(null!==a){var c=this.Ri;if(""!==c)if(this.$a(a)){var d=zn(a,c);d!==b&&null===this.$b(b)&&(Wj(a,c,b),void 0!==d&&this.jb.remove(d),this.jb.add(b,a),wr(this,"nodeKey",se,c,a,d,b),"string"===typeof c&&this.Ia(a,c),this.ir(d,b))}else Wj(a,c,b)}};function Zq(a){return"number"===typeof a||"string"===typeof a}t.$a=function(a){var b=this.va(a);return void 0===b?!1:this.jb.K(b)===a}; t.$b=function(a){null===a&&v("Model.findNodeDataForKey:key must not be null");return void 0!==a&&Zq(a)?this.jb.K(a):null}; t.pw=function(a){if(null!==a){var b=this.Ri;if(""!==b){var c=this.va(a);if(void 0===c||this.jb.contains(c)){var d=this.Rl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.jb.contains(c))){Wj(a,b,c);return}if("string"===typeof c){for(d=2;this.jb.contains(c+d);)d++;Wj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.jb.count-1;this.jb.contains(c);)c--;Wj(a,b,c)}else G&&v("Model.getKeyForNodeData returned something other than a string or a number: "+c)}}}}; t.Gf=function(a){null!==a&&(ob(a),this.$a(a)||Rq(this,a,!0))};function Rq(a,b,c){var d=a.va(b);if(void 0===d||a.jb.K(d)!==b)a.pw(b),d=a.va(b),void 0===d&&v("Model.makeNodeDataKeyUnique failed on "+b+". Data not added to Model."),a.jb.add(d,b),d=null,c&&(d=a.xc.length,Ka(a.xc,d,b)),wr(a,"nodeDataArray",ue,"nodeDataArray",a,null,b,null,d),a.Xm(b),a.Wm(b)}t.yz=function(a){if(Ha(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.Um=function(a){null!==a&&Qq(this,a,!0)};function Qq(a,b,c){var d=a.va(b);void 0!==d&&a.jb.remove(d);d=null;if(c){a:if(c=a.xc,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;La(a.xc,d)}wr(a,"nodeDataArray",ve,"nodeDataArray",a,b,null,d,null);a.qr(b)}t.hB=function(a){if(Ha(a))for(var b=a.length,c=0;c<b;c++)this.Um(a[c]);else for(a=a.iterator;a.next();)this.Um(a.value)}; t.VA=function(a){if(a!==this.nodeDataArray&&Ha(a)){var b=this.Zl;b.clear();b.addAll(this.jb.iteratorKeys);var c=this.Xl;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.va(f);if(void 0!==g){c.add(g);var h=this.$b(g);h!==f&&(null!==h?(this.Eq(h,f),this.cn(f,h)):(f=this.cloneDeep(f),this.bn(f,g),this.Gf(f)))}else g=this.cloneDeep(f),this.Gf(g),c.add(this.va(g))}for(a=b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.$b(d))&&this.Um(d);b.clear();c.clear()}}; t.ir=function(a,b){void 0!==b&&(a=br(this,a),a instanceof I&&this.fg.add(b,a))};t.Uw=function(){};t.Xm=function(){};t.Wm=function(){};t.qr=function(){};function dr(a,b,c){if(void 0!==b){var d=a.fg.K(b);null===d&&(d=new I,a.fg.add(b,d));d.add(c)}}function cr(a,b,c){if(void 0!==b){var d=a.fg.K(b);d instanceof I&&(void 0===c||null===c?a.fg.remove(b):(d.remove(c),0===d.count&&a.fg.remove(b)))}}function br(a,b){if(void 0===b)return null;a=a.fg.K(b);return a instanceof I?a:null} t.Kz=function(a){void 0===a?this.fg.clear():this.fg.remove(a)};X.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.il;a=null!==b?b(a,this):yr(this,a,!0);Ga(a)&&cb(a);return a}; function yr(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=yr(a,b[c],a.copiesArrayObjects);d.push(e)}cb(d);return d}if(c&&Ga(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=zn(b,d);var g=qr(a,f);"GraphObject"===g||"Diagram"===g||"Layer"===g||"RowColumnDefinition"===g||"AnimationManager"===g||"Tool"===g||"CommandHandler"=== g||"Layout"===g||"InputEvent"===g||"DiagramEvent"===g?(G&&"_"!==d[0]&&Fa('Warning: found GraphObject or Diagram reference when copying model data on property "'+d+'" of data object: '+b.toString()+" \nModel data should not have any references to a Diagram or any part of a diagram, such as: "+f.toString()),g=!0):g=f instanceof X||f instanceof Ee||f instanceof we||f instanceof re?!0:!1;g?Wj(c,d,f):(f=yr(a,f,!1),Wj(c,d,f))}cb(c);return c}return b instanceof J?b.copy():b instanceof Db?b.copy():b instanceof M?b.copy():b instanceof Eb?b.copy():b instanceof gc?b.copy():b} X.prototype.setDataProperty=function(a,b,c){G&&(A(a,"object",X,"setDataProperty:data"),A(b,"string",X,"setDataProperty:propname"),""===b&&v("Model.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.$a(a)){if(b===this.nodeKeyProperty){this.bn(a,c);return}if(b===this.nodeCategoryProperty){this.an(a,c);return}}else!zr&&a instanceof O&&(zr=!0,Fa('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),Fa(" Is that really your intent?"));var d= zn(a,b);d!==c&&(Wj(a,b,c),this.ju(a,b,d,c))};t=X.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};t.Eq=function(a,b){if(b){var c=this.$a(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.uz=function(a,b){this.Ut(a,-1,b)}; t.Ut=function(a,b,c){G&&(Ia(a,X,"insertArrayItem:arr"),C(b,X,"insertArrayItem:idx"),a===this.xc&&v("Model.insertArrayItem or Model.addArrayItem should not be called on the Model.nodeDataArray"));0>b&&(b=a.length);Ka(a,b,c);wr(this,"",ue,"",a,null,c,null,b)}; t.Aw=function(a,b){void 0===b&&(b=-1);G&&(Ia(a,X,"removeArrayItem:arr"),C(b,X,"removeArrayItem:idx"));a===this.xc&&v("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];La(a,b);wr(this,"",ve,"",a,c,null,b,null)};t.Qq=function(a){if(null===a)return"";var b=this.dk;if(""===b)return"";b=zn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getCategoryForNodeData found a non-string category for "+a+": "+b)}; t.an=function(a,b){A(b,"string",X,"setCategoryForNodeData:cat");if(null!==a){var c=this.dk;if(""!==c)if(this.$a(a)){var d=zn(a,c);void 0===d&&(d="");d!==b&&(Wj(a,c,b),wr(this,"nodeCategory",se,c,a,d,b))}else Wj(a,c,b)}};t.cn=function(a,b){this.an(b,this.Qq(a))};t.Lm=function(){return!1};t.Hk=function(){return!1};t.uj=function(){return!1};t.$t=function(){return!1};t.sj=function(){return!1};function Ci(){return new X} function qr(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 qr(a,b.constructor);return typeof b}function ur(a){return Ar[a]?Ar[a]:void 0!==ra.go&&ra.go[a]?ra.go[a]:null}function zn(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){G&&Fa("property get error: "+d.toString())}return c} function Wj(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){G&&Fa("property set error: "+d.toString())}} na.Object.defineProperties(X.prototype,{name:{configurable:!0,get:function(){return this.ta},set:function(a){var b=this.ta;b!==a&&(A(a,"string",X,"name"),this.ta=a,this.g("name",b,a))}},dataFormat:{configurable:!0,get:function(){return this.Un},set:function(a){var b=this.Un;b!==a&&(A(a,"string",X,"dataFormat"),this.Un=a,this.g("dataFormat",b,a))}},isReadOnly:{configurable:!0,get:function(){return this.kg},set:function(a){var b=this.kg;b!==a&&(A(a,"boolean", X,"isReadOnly"),this.kg=a,this.g("isReadOnly",b,a))}},modelData:{configurable:!0,get:function(){return this.j},set:function(a){var b=this.j;b!==a&&(A(a,"object",X,"modelData"),this.j=a,this.g("modelData",b,a),this.Ia(a))}},undoManager:{configurable:!0,get:function(){return this.o},set:function(a){var b=this.o;b!==a&&(w(a,Ee,X,"undoManager"),null!==b&&b.Uy(this),this.o=a,null!==a&&a.$x(this))}},skipsUndoManager:{configurable:!0,get:function(){return this.Fg}, set:function(a){A(a,"boolean",X,"skipsUndoManager");this.Fg=a}},nodeKeyProperty:{configurable:!0,get:function(){return this.Ri},set:function(a){var b=this.Ri;b!==a&&(xr(a,X,"nodeKeyProperty"),""===a&&v("Model.nodeKeyProperty may not be the empty string"),0<this.jb.count&&v("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Ri=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{configurable:!0,get:function(){return this.Rl},set:function(a){var b= this.Rl;b!==a&&(null!==a&&A(a,"function",X,"makeUniqueKeyFunction"),this.Rl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{configurable:!0,get:function(){return this.xc},set:function(a){var b=this.xc;if(b!==a){Ia(a,X,"nodeDataArray");this.jb.clear();this.Uw();for(var c=a.length,d=0;d<c;d++){var e=a[d];Ga(e)||v("Model.nodeDataArray must only contain Objects, not: "+e);ob(e)}this.xc=a;d=new H;for(e=0;e<c;e++){var f=a[e],g=this.va(f);void 0===g?d.add(f):null!==this.jb.K(g)?d.add(f): this.jb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.pw(e),f=this.va(e),void 0!==f&&this.jb.add(f,e);wr(this,"nodeDataArray",se,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.Xm(d),this.Wm(d);Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{configurable:!0,get:function(){return this.il},set:function(a){var b=this.il;b!==a&&(null!==a&&A(a,"function",X,"copyNodeDataFunction"),this.il=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{configurable:!0, get:function(){return this.Mn},set:function(a){var b=this.Mn;b!==a&&(null!==a&&A(a,"boolean",X,"copiesArrays"),this.Mn=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{configurable:!0,get:function(){return this.Ln},set:function(a){var b=this.Ln;b!==a&&(null!==a&&A(a,"boolean",X,"copiesArrayObjects"),this.Ln=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{configurable:!0,get:function(){return this.On},set:function(a){var b=this.On;b!==a&&(null!==a&&A(a,"boolean",X,"copiesKey"), this.On=a,this.g("copiesKey",b,a))}},afterCopyFunction:{configurable:!0,get:function(){return this.un},set:function(a){var b=this.un;b!==a&&(null!==a&&A(a,"function",X,"afterCopyFunction"),this.un=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{configurable:!0,get:function(){return this.dk},set:function(a){var b=this.dk;b!==a&&(xr(a,X,"nodeCategoryProperty"),this.dk=a,this.g("nodeCategoryProperty",b,a))}},type:{configurable:!0,get:function(){return"Model"}}}); X.prototype.setCategoryForNodeData=X.prototype.an;X.prototype.getCategoryForNodeData=X.prototype.Qq;X.prototype.removeArrayItem=X.prototype.Aw;X.prototype.insertArrayItem=X.prototype.Ut;X.prototype.addArrayItem=X.prototype.uz;X.prototype.assignAllDataProperties=X.prototype.Eq;X.prototype.set=X.prototype.set;X.prototype.clearUnresolvedReferences=X.prototype.Kz;X.prototype.mergeNodeDataArray=X.prototype.VA;X.prototype.removeNodeDataCollection=X.prototype.hB;X.prototype.removeNodeData=X.prototype.Um; X.prototype.addNodeDataCollection=X.prototype.yz;X.prototype.addNodeData=X.prototype.Gf;X.prototype.makeNodeDataKeyUnique=X.prototype.pw;X.prototype.findNodeDataForKey=X.prototype.$b;X.prototype.containsNodeData=X.prototype.$a;X.prototype.setKeyForNodeData=X.prototype.bn;X.prototype.getKeyForNodeData=X.prototype.va;X.prototype.updateTargetBindings=X.prototype.Ia;X.prototype.commit=X.prototype.commit;X.prototype.rollbackTransaction=X.prototype.Uf;X.prototype.commitTransaction=X.prototype.cb; X.prototype.startTransaction=X.prototype.Da;X.prototype.raiseDataChanged=X.prototype.ju;X.prototype.raiseChanged=X.prototype.g;X.prototype.raiseChangedEvent=X.prototype.ab;X.prototype.removeChangedListener=X.prototype.Tk;X.prototype.addChangedListener=X.prototype.Oh;X.prototype.writeJsonValue=X.prototype.ln;X.prototype.replaceJsonObjects=X.prototype.Vm;X.prototype.applyIncrementalJSON=X.prototype.Cz;X.prototype.applyIncrementalJson=X.prototype.by;X.prototype.toJSON=X.prototype.toJSON; X.prototype.toJson=X.prototype.mr;X.prototype.toIncrementalJSON=X.prototype.tB;X.prototype.toIncrementalJson=X.prototype.cz;X.prototype.toIncrementalData=X.prototype.sB;X.prototype.clear=X.prototype.clear;var zr=!1,Ar={};X.className="Model"; X.fromJSON=X.fromJson=function(a,b){void 0===b&&(b=null);null!==b&&w(b,X,X,"fromJson:model");var c=null;if("string"===typeof a)try{c=ra.JSON.parse(a)}catch(f){G&&Fa("JSON.parse error: "+f.toString())}else"object"===typeof a?c=a:v("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=ur(d)):(e=ur(d),null===e&&(e=ra[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof X?b=a:v("Unable to construct a Model of declared class: "+ c["class"])}null===b&&(b=X.constructGraphLinksModel());b.er(c);b.yw(c);return b};X.safePropertyValue=zn;X.safePropertySet=Wj;Ar.Brush=wl;Ar.ChangedEvent=re;Ar.Geometry=N;Ar.Margin=gc;Ar.Panel=W;Ar.Point=J;Ar.Rect=M;Ar.Size=Db;Ar.Spot=Eb;Ar.Transaction=we;Ar.UndoManager=Ee; function Li(a,b,c,d){cb(this);this.u=!1;void 0===a?a="":A(a,"string",Li,"constructor:targetprop");void 0===b?b=a:A(b,"string",Li,"constructor:sourceprop");void 0===c?c=null:null!==c&&A(c,"function",Li,"constructor:conv");this.j=-1;this.ud=null;this.tm=a;this.sm=this.qq=0;this.ot=null;this.Jo=!1;this.lm=b;this.Kn=c;void 0===d?(this.Ul=Br,this.cl=null):(this.Ul=rn,this.cl=d);this.Qu=new I} Li.prototype.copy=function(){var a=new Li;a.tm=this.tm;a.qq=this.qq;a.sm=this.sm;a.ot=this.ot;a.Jo=this.Jo;a.lm=this.lm;a.Kn=this.Kn;a.Ul=this.Ul;a.cl=this.cl;return a};t=Li.prototype;t.ob=function(a){a.classType===Li?this.mode=a:Ea(this,a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.Cj?" "+this.Cj:"")+" "+this.mode.name+")"};t.freeze=function(){this.u=!0;return this};t.ka=function(){this.u=!1;return this}; t.Ny=function(a){void 0===a&&(a=null);null!==a&&A(a,"function",Li,"makeTwoWay");this.mode=rn;this.backConverter=a;return this};t.br=function(a){void 0===a&&(a="");G&&A(a,"string",Li,"ofObject:srcname");this.sourceName=a;this.isToModel=!1;return this};t.YA=function(){this.sourceName=null;this.isToModel=!0;return this};function pl(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.eb(a)} t.Vw=function(a,b,c){var d=this.lm;if(void 0===c||""===d||d===c){c=this.tm;var e=this.Kn;if(null===e&&""===c)Fa("Binding error: target property is the empty string: "+this.toString());else{G&&"string"===typeof c&&("function"!==typeof a.setAttribute&&0<c.length&&"_"!==c[0]&&!Ra(a,c)?Fa("Binding error: undefined target property: "+c+" on "+a.toString()):"name"===c&&a instanceof O&&Fa("Binding error: cannot modify GraphObject.name on "+a.toString()));var f=b;""!==d&&(f=zn(b,d));if(void 0!==f)if(null=== e)""!==c&&Wj(a,c,f);else try{if(""!==c){var g=e(f,a);G&&void 0===g&&Fa('Binding warning: conversion function returned undefined when setting target property "'+c+'" on '+a.toString()+", function is: "+e);Wj(a,c,g)}else e(f,a)}catch(h){G&&Fa("Binding error: "+h.toString()+' setting target property "'+c+'" on '+a.toString()+" with conversion function: "+e)}}}}; t.sr=function(a,b,c,d){if(this.Ul===rn){var e=this.tm;if(void 0===c||e===c){c=this.lm;var f=this.cl,g=a;""!==e&&(g=zn(a,e));if(void 0!==g&&!this.Qu.contains(a))try{this.Qu.add(a);var h=null!==d?d.diagram:null,k=null!==h?h.model:null;if(null===f)if(""!==c)null!==k?(G&&k.nodeKeyProperty===c&&k.$a(b)&&Fa("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),k.setDataProperty(b,c,g)):Wj(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.Aw(m,l);k.Ut(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?(G&&(k.nodeKeyProperty===c&&k.$a(b)&&Fa("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),void 0===n&&Fa('Binding warning: conversion function returned undefined when setting source property "'+c+'" on '+b.toString()+", function is: "+f)),k.setDataProperty(b,c,n)):Wj(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 r= d.itemIndex,q=d.panel.itemArray;k.Aw(q,r);k.Ut(q,r,p)}}}catch(u){G&&Fa("Binding error: "+u.toString()+' setting source property "'+c+'" on '+b.toString()+" with conversion function: "+f)}}finally{this.Qu.remove(a)}}}}; na.Object.defineProperties(Li.prototype,{Cj:{configurable:!0,get:function(){return this.j},set:function(a){this.u&&wa(this);A(a,"number",Li,"targetId");this.j=a}},targetProperty:{configurable:!0,get:function(){return this.tm},set:function(a){this.u&&wa(this);A(a,"string",Li,"targetProperty");this.tm=a}},sourceName:{configurable:!0,get:function(){return this.ot},set:function(a){this.u&&wa(this);null!==a&&A(a,"string",Li,"sourceName");this.ot=a;null!==a&&(this.Jo= !1)}},isToModel:{configurable:!0,get:function(){return this.Jo},set:function(a){this.u&&wa(this);A(a,"boolean",Li,"isToModel");this.Jo=a}},sourceProperty:{configurable:!0,get:function(){return this.lm},set:function(a){this.u&&wa(this);A(a,"string",Li,"sourceProperty");this.lm=a}},converter:{configurable:!0,get:function(){return this.Kn},set:function(a){this.u&&wa(this);null!==a&&A(a,"function",Li,"converter");this.Kn=a}},backConverter:{configurable:!0, get:function(){return this.cl},set:function(a){this.u&&wa(this);null!==a&&A(a,"function",Li,"backConverter");this.cl=a}},mode:{configurable:!0,get:function(){return this.Ul},set:function(a){this.u&&wa(this);eb(a,Li,Li,"mode");this.Ul=a}}});Li.prototype.updateSource=Li.prototype.sr;Li.prototype.updateTarget=Li.prototype.Vw;Li.prototype.ofModel=Li.prototype.YA;Li.prototype.ofObject=Li.prototype.br;Li.prototype.makeTwoWay=Li.prototype.Ny; var Sk="Binding",Br=new E(Li,"OneWay",1),rn=new E(Li,"TwoWay",2);Li.className="Binding";Li.parseEnum=function(a,b){A(a,"function",Li,"parseEnum:ctor");eb(b,a,Li,"parseEnum:defval");return function(c){c=db(a,c);return null===c?b:c}};Li.toString=Qa;Li.OneWay=Br;Li.TwoWay=rn; function Cr(a,b,c){X.call(this);this.mx=',\n "insertedLinkKeys": ';this.iz=',\n "modifiedLinkData": ';this.ox=',\n "removedLinkKeys": ';this.fd=[];this.lg=new I;this.rb=new zb;this.Mi="";this.Ej=this.hl=this.Sl=null;this.mf="from";this.nf="to";this.Zj=this.Yj="";this.Xj="category";this.ee="";this.Yl="isGroup";this.Ke="group";this.Nn=!1;void 0!==b&&(this.linkDataArray=b);void 0!==a&&(Ha(a)?this.nodeDataArray=a:Object.assign(this,a));c&&Object.assign(this,c)}ma(Cr,X); Cr.constructGraphLinksModel=X.constructGraphLinksModel;Cr.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.Mi=this.Mi;a.Sl=this.Sl;a.hl=this.hl;a.mf=this.mf;a.nf=this.nf;a.Yj=this.Yj;a.Zj=this.Zj;a.Xj=this.Xj;a.ee=this.ee;a.Yl=this.Yl;a.Ke=this.Ke;a.Nn=this.Nn};t=Cr.prototype;t.clear=function(){X.prototype.clear.call(this);this.fd=[];this.rb.clear();this.lg.clear()}; t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.mr();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.va(e)+":"+Qa(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+Xq(this,e,!0)+"--\x3e"+Xq(this,e,!1)}return b}; t.$w=function(a,b){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=X.prototype.$w.call(this,a,b),d=this,e=new I,f=new I,g=new I,h=this.di;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ue?e.add(a.newValue):a.change===ve&&g.add(a.oldValue):d.Bc(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.Bc(a)&&f.add(a)}): a.object instanceof X||d.$a(a.object)||Dr(d,a.object).each(function(a){f.add(a)})))});var k=this.Xl;k.clear();e.each(function(a){k.add(d.sc(a));b||f.add(a)});var l=this.Zl;l.clear();g.each(function(a){l.add(d.sc(a));b&&f.add(a)});a=d.cloneDeep(f.Ea());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.Ea():c.insertedLinkKeys=k.Ea());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.Ea():c.removedLinkKeys=l.Ea());l.clear();k.clear();return c}; t.kn=function(){var a=X.prototype.kn.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.er=function(a){X.prototype.er.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.ax=function(){var a=X.prototype.ax.call(this),b=',\n "linkDataArray": '+or(this,this.linkDataArray,!0);return a+b};t.yw=function(a){X.prototype.yw.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.Vm(a),this.linkDataArray=a)}; function Dr(a,b){for(var c=new I,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];pr(a,b,e,e,c)}return c} t.Zw=function(a,b){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=X.prototype.Zw.call(this,a,b),d=this,e=new I,f=new I,g=new I,h=this.di;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===ue?e.add(a.newValue):a.change===ve&&g.add(a.oldValue):d.Bc(a.object)?f.add(a.object):null!==a.object&&(null!==a.object&&h&&h.contains(a.object)?h.get(a.object).each(function(a){d.Bc(a)&&f.add(a)}): a.object instanceof X||d.$a(a.object)||Dr(d,a.object).each(function(a){f.add(a)})))});var k=this.Xl;k.clear();e.each(function(a){k.add(d.sc(a));b||f.add(a)});var l=this.Zl;l.clear();g.each(function(a){l.add(d.sc(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.ox:this.mx)+or(this,k.Ea(),!0));0<f.count&&(a+=this.iz+or(this,f.Ea(),!0));0<l.count&&(a+=(b?this.mx:this.ox)+or(this,l.Ea(),!0));l.clear();k.clear();return a}; t.dr=function(a){(void 0!==a.linkCategoryProperty&&a.linkCategoryProperty!==this.linkCategoryProperty||void 0!==a.linkKeyProperty&&a.linkKeyProperty!==this.linkKeyProperty||void 0!==a.linkFromKeyProperty&&a.linkFromKeyProperty!==this.linkFromKeyProperty||void 0!==a.linkToKeyProperty&&a.linkToKeyProperty!==this.linkToKeyProperty||void 0!==a.linkFromPortIdProperty&&a.linkFromPortIdProperty!==this.linkFromPortIdProperty||void 0!==a.linkToPortIdProperty&&a.linkToPortIdProperty!==this.linkToPortIdProperty|| void 0!==a.linkLabelKeysProperty&&a.linkLabelKeysProperty!==this.linkLabelKeysProperty||void 0!==a.nodeIsGroupProperty&&a.nodeIsGroupProperty!==this.nodeIsGroupProperty||void 0!==a.nodeGroupKeyProperty&&a.nodeGroupKeyProperty!==this.nodeGroupKeyProperty)&&v("applyIncrementalJson cannot change Model properties");X.prototype.dr.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.Sh(e);null===f&&(f=this.Jq({}),this.ou(f,e),this.ej(f))}b=a.modifiedLinkData; if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.sc(e),f=this.Sh(f),null!==f){for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);Er(this,e,f)}a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.Sh(a[b]),null!==c&&this.Tm(c)}; Cr.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===se){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.Bc(c)){var e=a.K(b);b=a.K(!b);void 0!==b&&this.rb.remove(b);void 0!==e&&this.rb.add(e,c);Wj(c,d,e);return}}else if(a.change===ue){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;Ga(a)&&"number"===typeof c&&(d=this.sc(a),b?(this.lg.remove(a),this.fd[c]===a&&this.fd.splice(c,1),void 0!==d&&this.rb.remove(d)):(this.lg.add(a),this.fd[c]!== a&&this.fd.splice(c,0,a),void 0!==d&&this.rb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.Pf(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===ve){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;Ga(a)&&"number"===typeof c&&(d=this.sc(a),b?(this.lg.add(a),this.fd[c]!==a&&this.fd.splice(c,0,a),void 0!==d&&this.rb.add(d,a)):(this.lg.remove(a),this.fd[c]=== a&&this.fd.splice(c,1),void 0!==d&&this.rb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.Pf(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}}X.prototype.changeState.call(this,a,b)}};t=Cr.prototype;t.Nm=function(a){if(void 0!==a){var b=this.Ej;if(null!==b){var c=this.$b(a);null===c&&(c=this.copyNodeData(b),Wj(c,this.nodeKeyProperty,a),this.Gf(c))}return a}}; t.By=function(a){return Xq(this,a,!0)};t.Iw=function(a,b){er(this,a,b,!0)};t.Ey=function(a){return Xq(this,a,!1)};t.Mw=function(a,b){er(this,a,b,!1)};function Xq(a,b,c){if(null!==b&&(a=c?a.mf:a.nf,""!==a&&(a=zn(b,a),void 0!==a))){if(Zq(a))return a;v((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}} function er(a,b,c,d){null===c&&(c=void 0);void 0===c||Zq(c)||za(c,"number or string",Cr,d?"setFromKeyForLinkData:key":"setToKeyForLinkData:key");if(null!==b){var e=d?a.mf:a.nf;if(""!==e)if(c=a.Nm(c),a.Bc(b)){var f=zn(b,e);f!==c&&(cr(a,f,b),Wj(b,e,c),null===a.$b(c)&&dr(a,c,b),wr(a,d?"linkFromKey":"linkToKey",se,e,b,f,c),"string"===typeof e&&a.Ia(b,e))}else Wj(b,e,c)}}t.Cy=function(a){return Wq(this,a,!0)};t.Jw=function(a,b){fr(this,a,b,!0)};t.Fy=function(a){return Wq(this,a,!1)}; t.Nw=function(a,b){fr(this,a,b,!1)};function Wq(a,b,c){if(null===b)return"";a=c?a.Yj:a.Zj;if(""===a)return"";b=zn(b,a);return void 0===b?"":b}function fr(a,b,c,d){A(c,"string",Cr,d?"setFromPortIdForLinkData:portname":"setToPortIdForLinkData:portname");if(null!==b){var e=d?a.Yj:a.Zj;if(""!==e)if(a.Bc(b)){var f=zn(b,e);void 0===f&&(f="");f!==c&&(Wj(b,e,c),wr(a,d?"linkFromPortId":"linkToPortId",se,e,b,f,c),"string"===typeof e&&a.Ia(b,e))}else Wj(b,e,c)}} t.Pf=function(a){if(null===a)return Fr;var b=this.ee;if(""===b)return Fr;a=zn(a,b);return void 0===a?Fr:a};t.pu=function(a,b){Ia(b,Cr,"setLabelKeysForLinkData:arr");if(null!==a){var c=this.ee;if(""!==c)if(this.Bc(a)){var d=zn(a,c);void 0===d&&(d=Fr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)cr(this,d[f],a);Wj(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.$b(g)&&dr(this,g,a)}wr(this,"linkLabelKeys",se,c,a,d,b);"string"===typeof c&&this.Ia(a,c)}}else Wj(a,c,b)}}; t.Iv=function(a,b){if(null!==b&&void 0!==b&&(Zq(b)||za(b,"number or string",Cr,"addLabelKeyForLinkData:key"),null!==a)){var c=this.ee;if(""!==c){var d=zn(a,c);if(void 0===d)c=[],c.push(b),this.pu(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.Bc(a)&&(null===this.$b(b)&&dr(this,b,a),wr(this,"linkLabelKeys",ue,c,a,null,b,null,e)))}else v(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}}; t.Ty=function(a,b){if(null!==b&&void 0!==b&&(Zq(b)||za(b,"number or string",Cr,"removeLabelKeyForLinkData:key"),null!==a)){var c=this.ee;if(""!==c){var d=zn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.Bc(a)&&(cr(this,b,a),wr(this,"linkLabelKeys",ve,c,a,b,null,e,null)))}else void 0!==d&&v(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}}; t.sc=function(a){if(null!==a){var b=this.Mi;if(""!==b&&(b=zn(a,b),void 0!==b)){if(Zq(b))return b;v("Key value for link data "+a+" is not a number or a string: "+b)}}};t.ou=function(a,b){void 0!==b&&null!==b&&Zq(b)||za(b,"number or string",Cr,"setKeyForLinkData:key");if(null!==a){var c=this.Mi;if(""!==c)if(this.Bc(a)){var d=zn(a,c);d!==b&&null===this.Sh(b)&&(Wj(a,c,b),void 0!==d&&this.rb.remove(d),this.rb.add(b,a),wr(this,"linkKey",se,c,a,d,b),"string"===typeof c&&this.Ia(a,c))}else Wj(a,c,b)}}; t.Sh=function(a){null===a&&v("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&Zq(a)?this.rb.K(a):null}; t.du=function(a){if(null!==a){var b=this.Mi;if(""!==b){var c=this.sc(a);if(void 0===c||this.rb.contains(c)){var d=this.Sl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.rb.contains(c))){Wj(a,b,c);return}if("string"===typeof c){for(d=2;this.rb.contains(c+d);)d++;Wj(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.rb.count-1;this.rb.contains(c);)c--;Wj(a,b,c)}else G&&v("GraphLinksModel.getKeyForLinkData returned something other than a string or a number: "+c)}}}}; t.Bc=function(a){return null===a?!1:this.lg.contains(a)};t.ej=function(a){null!==a&&(ob(a),this.Bc(a)||ar(this,a,!0))};function ar(a,b,c){if(""!==a.linkKeyProperty){var d=a.sc(b);if(void 0!==d&&a.rb.K(d)===b)return;a.du(b);d=a.sc(b);void 0===d&&v("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");a.rb.add(d,b)}a.lg.add(b);d=null;c&&(d=a.fd.length,a.fd.splice(d,0,b));wr(a,"linkDataArray",ue,"linkDataArray",a,null,b,null,d);Gr(a,b)} t.xz=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.ej(a[c]);else for(a=a.iterator;a.next();)this.ej(a.value)};t.Tm=function(a){null!==a&&$q(this,a,!0)};function $q(a,b,c){a.lg.remove(b);var d=a.sc(b);void 0!==d&&a.rb.remove(d);d=null;if(c){d=a.fd.indexOf(b);if(0>d)return;a.fd.splice(d,1)}wr(a,"linkDataArray",ve,"linkDataArray",a,b,null,d,null);c=Xq(a,b,!0);cr(a,c,b);c=Xq(a,b,!1);cr(a,c,b);d=a.Pf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],cr(a,c,b)} t.fB=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Tm(a[c]);else for(a=a.iterator;a.next();)this.Tm(a.value)}; t.UA=function(a){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(a!==this.linkDataArray&&Ha(a)){var b=this.Zl;b.clear();b.addAll(this.rb.iteratorKeys);var c=this.Xl;c.clear();for(var d=a.length,e=0;e<d;e++){var f=a[e],g=this.sc(f);if(void 0!==g){c.add(g);var h=this.Sh(g);h!==f&&(null!==h?(this.Eq(h,f),Er(this,f,h)):(f=this.cloneDeep(f),this.ou(f,g),this.ej(f)))}else g=this.cloneDeep(f),this.ej(g),c.add(this.sc(g))}for(a= b.iterator;a.next();)d=a.value,c.contains(d)||(d=this.Sh(d))&&this.Tm(d);b.clear();c.clear()}};function Gr(a,b){var c=Xq(a,b,!0);c=a.Nm(c);null===a.$b(c)&&dr(a,c,b);c=Xq(a,b,!1);c=a.Nm(c);null===a.$b(c)&&dr(a,c,b);var d=a.Pf(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.$b(c)&&dr(a,c,b)} t.Jq=function(a){if(null===a)return null;var b=this.hl;a=null!==b?b(a,this):yr(this,a,!0);Ga(a)&&(cb(a),""!==this.mf&&Wj(a,this.mf,void 0),""!==this.nf&&Wj(a,this.nf,void 0),""!==this.ee&&Wj(a,this.ee,[]));return a};t.Yt=function(a){if(null===a)return!1;var b=this.Yl;return""===b?!1:zn(a,b)?!0:!1};t.Th=function(a){if(null!==a){var b=this.Ke;if(""!==b&&(b=zn(a,b),void 0!==b)){if(Zq(b))return b;v("GroupKey value for node data "+a+" is not a number or a string: "+b)}}}; t.lr=function(a,b){null===b&&(b=void 0);void 0===b||Zq(b)||za(b,"number or string",Cr,"setGroupKeyForNodeData:key");if(null!==a){var c=this.Ke;if(""!==c)if(this.$a(a)){var d=zn(a,c);d!==b&&(cr(this,d,a),Wj(a,c,b),null===this.$b(b)&&dr(this,b,a),wr(this,"nodeGroupKey",se,c,a,d,b),"string"===typeof c&&this.Ia(a,c))}else Wj(a,c,b)}}; Cr.prototype.copyNodeData=function(a){if(null===a)return null;a=X.prototype.copyNodeData.call(this,a);this.wk||""===this.Ke||void 0===zn(a,this.Ke)||Wj(a,this.Ke,void 0);return a}; Cr.prototype.setDataProperty=function(a,b,c){G&&(A(a,"object",Cr,"setDataProperty:data"),A(b,"string",Cr,"setDataProperty:propname"),""===b&&v("GraphLinksModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.$a(a)){if(b===this.nodeKeyProperty){this.bn(a,c);return}if(b===this.nodeCategoryProperty){this.an(a,c);return}if(b===this.nodeGroupKeyProperty){this.lr(a,c);return}G&&b===this.nodeIsGroupProperty&&v("GraphLinksModel.setDataProperty: property name must not be the nodeIsGroupProperty: "+ b)}else if(this.Bc(a)){if(b===this.linkFromKeyProperty){er(this,a,c,!0);return}if(b===this.linkToKeyProperty){er(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){fr(this,a,c,!0);return}if(b===this.linkToPortIdProperty){fr(this,a,c,!1);return}if(b===this.linkKeyProperty){this.ou(a,c);return}if(b===this.linkCategoryProperty){this.kr(a,c);return}if(b===this.linkLabelKeysProperty){this.pu(a,c);return}}var d=zn(a,b);d!==c&&(Wj(a,b,c),this.ju(a,b,d,c))};t=Cr.prototype; t.Eq=function(a,b){if(b){var c=this.$a(a),d=this.Bc(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&zn(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}}; t.ir=function(a,b){X.prototype.ir.call(this,a,b);for(var c=this.jb.iterator;c.next();)this.Cw(c.value,a,b);for(c=this.lg.iterator;c.next();){var d=c.value,e=a,f=b;if(Xq(this,d,!0)===e){var g=this.mf;Wj(d,g,f);wr(this,"linkFromKey",se,g,d,e,f);"string"===typeof g&&this.Ia(d,g)}Xq(this,d,!1)===e&&(g=this.nf,Wj(d,g,f),wr(this,"linkToKey",se,g,d,e,f),"string"===typeof g&&this.Ia(d,g));g=this.Pf(d);if(Array.isArray(g))for(var h=g.length,k=this.ee,l=0;l<h;l++)g[l]===e&&(g[l]=f,wr(this,"linkLabelKeys",ue, k,d,e,f,l,l))}};t.Cw=function(a,b,c){if(this.Th(a)===b){var d=this.Ke;Wj(a,d,c);wr(this,"nodeGroupKey",se,d,a,b,c);"string"===typeof d&&this.Ia(a,d)}};t.Uw=function(){X.prototype.Uw.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)Gr(this,a[c])}; t.Xm=function(a){X.prototype.Xm.call(this,a);a=this.va(a);var b=br(this,a);if(null!==b){var c=Ma();for(b=b.iterator;b.next();){var d=b.value;if(this.$a(d)){if(this.Th(d)===a){var e=this.Ke;wr(this,"nodeGroupKey",se,e,d,a,a);"string"===typeof e&&this.Ia(d,e);c.push(d)}}else if(Xq(this,d,!0)===a&&(e=this.mf,wr(this,"linkFromKey",se,e,d,a,a),"string"===typeof e&&this.Ia(d,e),c.push(d)),Xq(this,d,!1)===a&&(e=this.nf,wr(this,"linkToKey",se,e,d,a,a),"string"===typeof e&&this.Ia(d,e),c.push(d)),e=this.Pf(d), Array.isArray(e))for(var f=e.length,g=this.ee,h=0;h<f;h++)e[h]===a&&(wr(this,"linkLabelKeys",ue,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)cr(this,a,c[b]);Oa(c)}};t.Wm=function(a){X.prototype.Wm.call(this,a);var b=this.Th(a);null===this.$b(b)&&dr(this,b,a)};t.qr=function(a){X.prototype.qr.call(this,a);var b=this.Th(a);cr(this,b,a)}; t.Qt=function(a){if(null===a)return"";var b=this.Xj;if(""===b)return"";b=zn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getCategoryForLinkData found a non-string category for "+a+": "+b)};Cr.prototype.getLinkCategoryForData=function(a){return this.Qt(a)}; Cr.prototype.kr=function(a,b){A(b,"string",Cr,"setCategoryForLinkData:cat");if(null!==a){var c=this.Xj;if(""!==c)if(this.Bc(a)){var d=zn(a,c);void 0===d&&(d="");d!==b&&(Wj(a,c,b),wr(this,"linkCategory",se,c,a,d,b),"string"===typeof c&&this.Ia(a,c))}else Wj(a,c,b)}};Cr.prototype.setLinkCategoryForData=function(a,b){this.kr(a,b)};t=Cr.prototype;t.cn=function(a,b){X.prototype.cn.call(this,a,b);this.lr(b,this.Th(a))}; function Er(a,b,c){a.kr(c,a.Qt(b));a.Iw(c,a.By(b));a.Mw(c,a.Ey(b));a.pu(c,a.Pf(b));a.Jw(c,a.Cy(b));a.Nw(c,a.Fy(b))}t.Hk=function(){return!0};t.uj=function(){return!0};t.$t=function(){return!0};t.sj=function(){return!0}; na.Object.defineProperties(Cr.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.Ej},set:function(a){var b=this.Ej;b!==a&&(null!==a&&A(a,"object",Cr,"archetypeNodeData"),this.Ej=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{configurable:!0,get:function(){return this.mf},set:function(a){var b=this.mf;b!==a&&(xr(a,Cr,"linkFromKeyProperty"),this.mf=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{configurable:!0,get:function(){return this.nf}, set:function(a){var b=this.nf;b!==a&&(xr(a,Cr,"linkToKeyProperty"),this.nf=a,this.g("linkToKeyProperty",b,a))}},linkFromPortIdProperty:{configurable:!0,get:function(){return this.Yj},set:function(a){var b=this.Yj;b!==a&&(xr(a,Cr,"linkFromPortIdProperty"),!G||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.Yj=a,this.g("linkFromPortIdProperty",b,a))}}, linkToPortIdProperty:{configurable:!0,get:function(){return this.Zj},set:function(a){var b=this.Zj;b!==a&&(xr(a,Cr,"linkToPortIdProperty"),!G||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.Zj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{configurable:!0,get:function(){return this.ee},set:function(a){var b=this.ee;b!== a&&(xr(a,Cr,"linkLabelKeysProperty"),this.ee=a,this.g("linkLabelKeysProperty",b,a))}},linkDataArray:{configurable:!0,get:function(){return this.fd},set:function(a){var b=this.fd;if(b!==a){Ia(a,Cr,"linkDataArray");this.rb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];Ga(e)||v("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);ob(e)}this.fd=a;if(""!==this.linkKeyProperty){d=new H;for(e=0;e<c;e++){var f=a[e],g=this.sc(f);void 0===g?d.add(f):null!==this.rb.K(g)?d.add(f): this.rb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.du(e),f=this.sc(e),void 0!==f&&this.rb.add(f,e)}d=new I;for(e=0;e<c;e++)d.add(a[e]);this.lg=d;wr(this,"linkDataArray",se,"linkDataArray",this,b,a);for(b=0;b<c;b++)Gr(this,a[b])}}},linkKeyProperty:{configurable:!0,get:function(){return this.Mi},set:function(a){var b=this.Mi;if(b!==a){xr(a,Cr,"linkKeyProperty");this.Mi=a;this.rb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.sc(e);void 0=== f&&(this.du(e),f=this.sc(e));void 0!==f&&this.rb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{configurable:!0,get:function(){return this.Sl},set:function(a){var b=this.Sl;b!==a&&(null!==a&&A(a,"function",Cr,"makeUniqueLinkKeyFunction"),this.Sl=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{configurable:!0,get:function(){return this.hl},set:function(a){var b=this.hl;b!==a&&(null!==a&&A(a,"function",Cr,"copyLinkDataFunction"),this.hl= a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{configurable:!0,get:function(){return this.Yl},set:function(a){var b=this.Yl;b!==a&&(xr(a,Cr,"nodeIsGroupProperty"),this.Yl=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{configurable:!0,get:function(){return this.Ke},set:function(a){var b=this.Ke;b!==a&&(xr(a,Cr,"nodeGroupKeyProperty"),this.Ke=a,this.g("nodeGroupKeyProperty",b,a))}},wk:{configurable:!0,get:function(){return this.Nn}, set:function(a){this.Nn!==a&&(A(a,"boolean",Cr,"copiesGroupKeyOfNodeData"),this.Nn=a)}},linkCategoryProperty:{configurable:!0,get:function(){return this.Xj},set:function(a){var b=this.Xj;b!==a&&(xr(a,Cr,"linkCategoryProperty"),this.Xj=a,this.g("linkCategoryProperty",b,a))}},type:{configurable:!0,get:function(){return"GraphLinksModel"}}});Cr.prototype.setCategoryForLinkData=Cr.prototype.kr;Cr.prototype.getCategoryForLinkData=Cr.prototype.Qt; Cr.prototype.assignAllDataProperties=Cr.prototype.Eq;Cr.prototype.setGroupKeyForNodeData=Cr.prototype.lr;Cr.prototype.getGroupKeyForNodeData=Cr.prototype.Th;Cr.prototype.isGroupForNodeData=Cr.prototype.Yt;Cr.prototype.copyLinkData=Cr.prototype.Jq;Cr.prototype.mergeLinkDataArray=Cr.prototype.UA;Cr.prototype.removeLinkDataCollection=Cr.prototype.fB;Cr.prototype.removeLinkData=Cr.prototype.Tm;Cr.prototype.addLinkDataCollection=Cr.prototype.xz;Cr.prototype.addLinkData=Cr.prototype.ej; Cr.prototype.containsLinkData=Cr.prototype.Bc;Cr.prototype.makeLinkDataKeyUnique=Cr.prototype.du;Cr.prototype.findLinkDataForKey=Cr.prototype.Sh;Cr.prototype.setKeyForLinkData=Cr.prototype.ou;Cr.prototype.getKeyForLinkData=Cr.prototype.sc;Cr.prototype.removeLabelKeyForLinkData=Cr.prototype.Ty;Cr.prototype.addLabelKeyForLinkData=Cr.prototype.Iv;Cr.prototype.setLabelKeysForLinkData=Cr.prototype.pu;Cr.prototype.getLabelKeysForLinkData=Cr.prototype.Pf;Cr.prototype.setToPortIdForLinkData=Cr.prototype.Nw; Cr.prototype.getToPortIdForLinkData=Cr.prototype.Fy;Cr.prototype.setFromPortIdForLinkData=Cr.prototype.Jw;Cr.prototype.getFromPortIdForLinkData=Cr.prototype.Cy;Cr.prototype.setToKeyForLinkData=Cr.prototype.Mw;Cr.prototype.getToKeyForLinkData=Cr.prototype.Ey;Cr.prototype.setFromKeyForLinkData=Cr.prototype.Iw;Cr.prototype.getFromKeyForLinkData=Cr.prototype.By;Cr.prototype.clear=Cr.prototype.clear;var Fr=Object.freeze([]);Cr.className="GraphLinksModel";Ar.GraphLinksModel=Cr; X.constructGraphLinksModel=X.constructGraphLinksModel=function(){return new Cr};X.initDiagramModel=Ci=function(){return new Cr};function Hr(a,b){X.call(this);this.Le="parent";this.Pn=!1;this.fk="parentLinkCategory";void 0!==a&&(Ha(a)?this.nodeDataArray=a:Object.assign(this,a));b&&Object.assign(this,b)}ma(Hr,X);Hr.constructGraphLinksModel=X.constructGraphLinksModel;Hr.prototype.cloneProtected=function(a){X.prototype.cloneProtected.call(this,a);a.Le=this.Le;a.Pn=this.Pn;a.fk=this.fk};t=Hr.prototype; t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.mr();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.va(e)+":"+Qa(e)}}return b};t.kn=function(){var a=X.prototype.kn.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b}; t.er=function(a){X.prototype.er.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.dr=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&v("applyIncrementalJson cannot change Model properties");X.prototype.dr.call(this,a)};t.Nm=function(a){return a}; t.Uh=function(a){if(null!==a){var b=this.Le;if(""!==b&&(b=zn(a,b),void 0!==b)){if(Zq(b))return b;v("ParentKey value for node data "+a+" is not a number or a string: "+b)}}}; t.ne=function(a,b){null===b&&(b=void 0);void 0===b||Zq(b)||za(b,"number or string",Hr,"setParentKeyForNodeData:key");if(null!==a){var c=this.Le;if(""!==c)if(b=this.Nm(b),this.$a(a)){var d=zn(a,c);d!==b&&(cr(this,d,a),Wj(a,c,b),null===this.$b(b)&&dr(this,b,a),wr(this,"nodeParentKey",se,c,a,d,b),"string"===typeof c&&this.Ia(a,c))}else Wj(a,c,b)}}; t.Tt=function(a){if(null===a)return"";var b=this.fk;if(""===b)return"";b=zn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};Hr.prototype.getLinkCategoryForData=function(a){return this.Tt(a)}; Hr.prototype.qu=function(a,b){A(b,"string",Hr,"setParentLinkCategoryForNodeData:cat");if(null!==a){var c=this.fk;if(""!==c)if(this.$a(a)){var d=zn(a,c);void 0===d&&(d="");d!==b&&(Wj(a,c,b),wr(this,"parentLinkCategory",se,c,a,d,b),"string"===typeof c&&this.Ia(a,c))}else Wj(a,c,b)}};Hr.prototype.setLinkCategoryForData=function(a,b){this.qu(a,b)}; Hr.prototype.copyNodeData=function(a){if(null===a)return null;a=X.prototype.copyNodeData.call(this,a);this.xk||""===this.Le||void 0===zn(a,this.Le)||Wj(a,this.Le,void 0);return a}; Hr.prototype.setDataProperty=function(a,b,c){G&&(A(a,"object",Hr,"setDataProperty:data"),A(b,"string",Hr,"setDataProperty:propname"),""===b&&v("TreeModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.$a(a)){if(b===this.nodeKeyProperty){this.bn(a,c);return}if(b===this.nodeCategoryProperty){this.an(a,c);return}if(b===this.nodeParentKeyProperty){this.ne(a,c);return}}var d=zn(a,b);d!==c&&(Wj(a,b,c),this.ju(a,b,d,c))};t=Hr.prototype; t.ir=function(a,b){X.prototype.ir.call(this,a,b);for(var c=this.jb.iterator;c.next();)this.Cw(c.value,a,b)};t.Cw=function(a,b,c){if(this.Uh(a)===b){var d=this.Le;Wj(a,d,c);wr(this,"nodeParentKey",se,d,a,b,c);"string"===typeof d&&this.Ia(a,d)}}; t.Xm=function(a){X.prototype.Xm.call(this,a);a=this.va(a);var b=br(this,a);if(null!==b){var c=Ma();for(b=b.iterator;b.next();){var d=b.value;if(this.$a(d)&&this.Uh(d)===a){var e=this.Le;wr(this,"nodeParentKey",se,e,d,a,a);"string"===typeof e&&this.Ia(d,e);c.push(d)}}for(b=0;b<c.length;b++)cr(this,a,c[b]);Oa(c)}};t.Wm=function(a){X.prototype.Wm.call(this,a);var b=this.Uh(a);b=this.Nm(b);null===this.$b(b)&&dr(this,b,a)};t.qr=function(a){X.prototype.qr.call(this,a);var b=this.Uh(a);cr(this,b,a)}; t.cn=function(a,b){X.prototype.cn.call(this,a,b);this.qu(b,this.Tt(a));this.ne(b,this.Uh(a))};t.Lm=function(){return!0};t.$t=function(){return!0}; na.Object.defineProperties(Hr.prototype,{nodeParentKeyProperty:{configurable:!0,get:function(){return this.Le},set:function(a){var b=this.Le;b!==a&&(xr(a,Hr,"nodeParentKeyProperty"),this.Le=a,this.g("nodeParentKeyProperty",b,a))}},xk:{configurable:!0,get:function(){return this.Pn},set:function(a){this.Pn!==a&&(A(a,"boolean",Hr,"copiesParentKeyOfNodeData"),this.Pn=a)}},parentLinkCategoryProperty:{configurable:!0,get:function(){return this.fk},set:function(a){var b= this.fk;b!==a&&(xr(a,Hr,"parentLinkCategoryProperty"),this.fk=a,this.g("parentLinkCategoryProperty",b,a))}},linkCategoryProperty:{configurable:!0,get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}},type:{configurable:!0,get:function(){return"TreeModel"}}});Hr.prototype.setParentLinkCategoryForNodeData=Hr.prototype.qu;Hr.prototype.getParentLinkCategoryForNodeData=Hr.prototype.Tt; Hr.prototype.setParentKeyForNodeData=Hr.prototype.ne;Hr.prototype.getParentKeyForNodeData=Hr.prototype.Uh;Hr.className="TreeModel";Ar.TreeModel=Hr;function Ir(a){Ei.call(this);this.Ax=this.co=this.ec=0;this.bs=360;this.zx=Jr;this.Mj=0;this.qx=new J;this.Nr=this.he=0;this.Bt=new Kr;this.Du=this.ek=0;this.nz=600;this.Ip=NaN;this.zn=1;this.lq=0;this.qm=360;this.Lb=Jr;this.N=Lr;this.gd=Mr;this.bd=Aq;this.yf=6;this.rp=Nr;a&&Object.assign(this,a)}ma(Ir,Ei); Ir.prototype.cloneProtected=function(a){Ei.prototype.cloneProtected.call(this,a);a.Ip=this.Ip;a.zn=this.zn;a.lq=this.lq;a.qm=this.qm;a.Lb=this.Lb;a.N=this.N;a.gd=this.gd;a.bd=this.bd;a.yf=this.yf;a.rp=this.rp}; Ir.prototype.ob=function(a){if(a.classType===Ir)if(a===Or||a===Pr||a===Qr||a===Rr||a===Mr)this.sorting=a;else if(a===Sr||a===Tr||a===Lr||a===Ur)this.direction=a;else if(a===Vr||a===Wr||a===Jr||a===Xr)this.arrangement=a;else{if(a===Yr||a===Nr)this.nodeDiameterFormula=a}else Ei.prototype.ob.call(this,a)};Ir.prototype.createNetwork=function(){return new Zr(this)}; Ir.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");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 H;b.addAll(a.iterator);a=new H;var c=new H;var d=this.sort(b);var e,f,g=this.Nr;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===Xr&&k===Yr?h=Jr:h===Xr&&k!==Yr&&(h=this.arrangement);if((this.direction===Sr||this.direction===Tr)&&this.sorting!==Mr){for(k=0;!(k>=d.length);k+=2){a.add(d.M(k));if(k+1>=d.length)break;c.add(d.M(k+1))}this.direction===Sr?(this.arrangement===Xr&&a.reverse(),d=new H,d.addAll(a), d.addAll(c)):(this.arrangement===Xr&&c.reverse(),d=new H,d.addAll(c),d.addAll(a))}k=d.length;for(var r=f=e=0;r<d.length;r++){var q=n+p*f*(this.direction===Lr?1:-1)/k,u=d.M(r).diameter;isNaN(u)&&(u=$r(d.M(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Xr){isNaN(b)&&(b=6);if(h!==Jr&&h!==Xr){f=-Infinity;for(g=0;g<k;g++)r=d.M(g),e=d.M(g===k-1?0:g+1),isNaN(r.diameter)&&$r(r,0),isNaN(e.diameter)&&$r(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===Vr?l=(f+b)/(2*Math.PI/k): l=as(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=as(this,e+(360<=p?k:k-1)*(h!==Xr?b:1.6*b),m,n*Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=bs(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===Jr||h===Xr)b=(r-e)/(360<=p?k:k-1)}else if(h===Jr||h===Xr)r=(r-e)/(360<=p?k:k-1),r<b?(l=as(this,e+b*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180),f=l*m):b=r;else{g=-Infinity;for(e=0;e<k;e++)q=d.M(e),u=d.M(e===k-1?0:e+1),isNaN(q.diameter)&&$r(q,0),isNaN(u.diameter)&&$r(u,0),g=Math.max(g, (q.diameter+u.diameter)/2);g+=b;e=as(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180);e>l?(l=e,f=l*m):g=r/(360<=p?k:k-1)}this.zx=h;this.ec=l;this.co=m;this.Ax=n;this.bs=p;this.Mj=b;this.he=f;this.Nr=g;b=d;d=this.zx;h=this.ec;l=this.Ax;m=this.bs;n=this.Mj;p=this.he;k=this.Nr;if(this.direction!==Sr&&this.direction!==Tr||d!==Xr)if(this.direction===Sr||this.direction===Tr){g=0;switch(d){case Wr:g=180*cs(this,h,p,l,k)/Math.PI;break;case Jr:k=b=0;g=a.first();null!==g&&(b=$r(g,Math.PI/2));g=c.first(); null!==g&&(k=$r(g,Math.PI/2));g=180*cs(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Vr:g=m/b.length}if(this.direction===Sr){switch(d){case Wr:ds(this,a,l,Ur);break;case Jr:es(this,a,l,Ur);break;case Vr:fs(this,a,m/2,l,Ur)}switch(d){case Wr:ds(this,c,l+g,Lr);break;case Jr:es(this,c,l+g,Lr);break;case Vr:fs(this,c,m/2,l+g,Lr)}}else{switch(d){case Wr:ds(this,c,l,Ur);break;case Jr:es(this,c,l,Ur);break;case Vr:fs(this,c,m/2,l,Ur)}switch(d){case Wr:ds(this,a,l+g,Lr);break;case Jr:es(this,a,l+g,Lr);break;case Vr:fs(this, a,m/2,l+g,Lr)}}}else switch(d){case Wr:ds(this,b,l,this.direction);break;case Jr:es(this,b,l,this.direction);break;case Vr:fs(this,b,m,l,this.direction);break;case Xr:gs(this,b,m,l,this.direction)}else gs(this,b,m,l-m/2,Lr)}this.updateParts();this.network=null;this.isValidLayout=!0}; function fs(a,b,c,d,e){var f=a.bs,g=a.ec;a=a.he;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===Lr?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.M(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 es(a,b,c,d){var e=a.ec,f=a.he,g=a.Mj;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.M(k),m=b.M(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)&&$r(l,0);isNaN(m.diameter)&&$r(m,0);l=cs(a,e,f,d===Lr?c:-c,(l.diameter+m.diameter)/2+g);c+=d===Lr?l:-l}} function ds(a,b,c,d){var e=a.ec,f=a.he,g=a.Nr;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.M(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=cs(a,e,f,d===Lr?c:-c,g);c+=d===Lr?l:-l}}function gs(a,b,c,d,e){var f=a.bs;a.ek=0;a.Bt=new Kr;if(360>c){for(f=d+(e===Lr?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.Du=f;hs(a,b,c,d,e)}else is(a,b,c,d,e);a.Bt.commit(b)} function is(a,b,c,d,e){var f=a.ec,g=a.Mj,h=a.co,k=f*Math.cos(d*Math.PI/180),l=a.he*Math.sin(d*Math.PI/180),m=b.Ea();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=J.alloc();for(var n=0;n<m.length;n++){m[n].centerX=k;m[n].centerY=l;if(n>=m.length-1)break;js(a,k,l,m,n,e,f)||ks(a,k,l,m,n,e,f);k=f.x;l=f.y}J.free(f);a.ek++;if(!(23<a.ek)){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),r=Math.abs(l-n)-((m[0].height+m[m.length-1].height)/2+g);g=0;1>Math.abs(r)?Math.abs(k-f)<(m[0].width+m[m.length-1].width)/2&&(g=0):g=0<r?r:1>Math.abs(p)? 0:p;k=Math.abs(f)>Math.abs(n)?0<f!==l>n:0<n!==k<f;if(k=e===Lr?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.Bt.compare(g,m);1<Math.abs(g)&&(a.ec=8>a.ek?a.ec-g/(2*Math.PI):5>m.length&&10<g?a.ec/2:a.ec-(0<g?1.7:-2.3),a.he=a.ec*h,is(a,b,c,d,e))}}} function hs(a,b,c,d,e){for(var f=a.ec,g=a.he,h=a.co,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=J.alloc(),n=b.Ea(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;js(a,k,l,n,p,e,m)||ks(a,k,l,n,p,e,m);k=m.x;l=m.y}J.free(m);a.ek++;if(!(23<a.ek)){k=Math.atan2(l,k);k=e===Lr?a.Du-k:k-a.Du;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.Bt;if(Math.abs(f)<Math.abs(g.Hm))for(g.Hm=f,g.Vk=[],g.mn=[],k=0;k<n.length;k++)g.Vk[k]=n[k].bounds.x,g.mn[k]=n[k].bounds.y; 1<Math.abs(f)&&(a.ec=8>a.ek?a.ec-f/(2*Math.PI):a.ec-(0<f?1.7:-2.3),a.he=a.ec*h,hs(a,b,c,d,e))}}function js(a,b,c,d,e,f,g){var h=a.ec,k=a.he,l=0;a=(d[e].width+d[e+1].width)/2+a.Mj;var m=!1;if(0<=c!==(f===Lr)){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 ks(a,b,c,d,e,f,g){var h=a.ec,k=a.he,l=0;a=(d[e].height+d[e+1].height)/2+a.Mj;d=!1;if(0<=b!==(f===Lr)){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}Ir.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()}; Ir.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 J(0,0):(c.x=this.arrangementOrigin.x+this.ec,c.y=this.arrangementOrigin.y+this.he);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.Xa(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.oe(c.oe(a)),this.group.move(b),this.qx=b.oe(a))}; Ir.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function bs(a,b,c,d,e){var f=a.nz;if(.001>Math.abs(a.co-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 as(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?bs(a,1,c,d,e):bs(a,1,c))}function cs(a,b,c,d,e){if(.001>Math.abs(a.co-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}} Ir.prototype.sort=function(a){switch(this.sorting){case Qr:break;case Rr:a.reverse();break;case Or:a.sort(this.comparer);break;case Pr:a.sort(this.comparer);a.reverse();break;case Mr:return this.iu(ls(a));default:v("Invalid sorting type.")}return a}; function ls(a){for(var b=[],c=0;c<a.length;c++)b.push(0);c=new H;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.M(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.M(f));b[f]=-1;f=a.M(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]++}return c} Ir.prototype.iu=function(a){for(var b=[],c=0;c<a.length;c++){var d=a.M(c);b[c]=[];for(var e,f=d.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),e!==c&&0>b[c].indexOf(e)&&b[c].push(e);for(d=d.sourceEdges;d.next();)e=a.indexOf(d.value.fromVertex),e!==c&&0>b[c].indexOf(e)&&b[c].push(e)}f=[];for(c=0;c<b.length;c++)f[c]=0;c=[];var g=[],h=[];d=[];e=new H;for(var k=0,l=0;l<b.length;l++){var m=b[l].length;if(1===m)d.push(l);else if(0===m)e.add(a.M(l));else{if(0===k)c.push(l);else{for(var n=m=Infinity, p=-1,r=[],q=0;q<c.length;q++)0>b[c[q]].indexOf(c[q===c.length-1?0:q+1])&&r.push(q===c.length-1?0:q+1);if(0===r.length)for(q=0;q<c.length;q++)r.push(q);for(q=0;q<r.length;q++){for(var u=r[q],y=b[l],x=0,z=0;z<g.length;z++){var B=f[g[z]],D=f[h[z]];if(B<D){var F=B;B=D}else F=D;if(F<u&&u<=B)for(D=0;D<y.length;D++){var L=y[D];0>c.indexOf(L)||F<f[L]&&f[L]<B||F===f[L]||B===f[L]||x++}else for(D=0;D<y.length;D++)L=y[D],0>c.indexOf(L)||F<f[L]&&f[L]<B&&F!==f[L]&&B!==f[L]&&x++}y=x;for(z=x=0;z<b[l].length;z++)F= c.indexOf(b[l][z]),0<=F&&(F=Math.abs(u-(F>=u?F+1:F)),x+=F<c.length+1-F?F:c.length+1-F);for(z=0;z<g.length;z++)F=f[g[z]],B=f[h[z]],F>=u&&F++,B>=u&&B++,F>B&&(D=B,B=F,F=D),B-F<(c.length+2)/2===(F<u&&u<=B)&&x++;if(y<m||y===m&&x<n)m=y,n=x,p=u}c.splice(p,0,l);for(m=0;m<c.length;m++)f[c[m]]=m;for(m=0;m<b[l].length;m++)n=b[l][m],0<=c.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=c.length;;){f=!0;for(h=0;h<d.length;h++)if(k=d[h],l=b[k][0],m=c.indexOf(l),0<=m){for(p=n=0;p<b[l].length;p++)r=c.indexOf(b[l][p]), 0>r||r===m||(q=r>m?r-m:m-r,n+=r<m!==q>g-q?1:-1);c.splice(0>n?m:m+1,0,k);d.splice(h,1);h--}else f=!1;if(f)break;else c.push(d[0]),d.splice(0,1)}for(b=0;b<c.length;b++)e.add(a.M(c[b]));return e}; na.Object.defineProperties(Ir.prototype,{radius:{configurable:!0,get:function(){return this.Ip},set:function(a){this.Ip!==a&&(A(a,"number",Ir,"radius"),0<a||isNaN(a))&&(this.Ip=a,this.C())}},aspectRatio:{configurable:!0,get:function(){return this.zn},set:function(a){this.zn!==a&&(A(a,"number",Ir,"aspectRatio"),0<a&&(this.zn=a,this.C()))}},startAngle:{configurable:!0,get:function(){return this.lq},set:function(a){this.lq!==a&&(A(a,"number",Ir,"startAngle"), this.lq=a,this.C())}},sweepAngle:{configurable:!0,get:function(){return this.qm},set:function(a){this.qm!==a&&(A(a,"number",Ir,"sweepAngle"),0<a&&360>=a?this.qm=a:this.qm=360,this.C())}},arrangement:{configurable:!0,get:function(){return this.Lb},set:function(a){this.Lb!==a&&(eb(a,Ir,Ir,"arrangement"),a===Xr||a===Jr||a===Wr||a===Vr)&&(this.Lb=a,this.C())}},direction:{configurable:!0,get:function(){return this.N},set:function(a){this.N!==a&&(eb(a,Ir,Ir,"direction"), a===Lr||a===Ur||a===Sr||a===Tr)&&(this.N=a,this.C())}},sorting:{configurable:!0,get:function(){return this.gd},set:function(a){this.gd!==a&&(eb(a,Ir,Ir,"sorting"),a===Qr||a===Rr||a===Or||Pr||a===Mr)&&(this.gd=a,this.C())}},comparer:{configurable:!0,get:function(){return this.bd},set:function(a){this.bd!==a&&(A(a,"function",Ir,"comparer"),this.bd=a,this.C())}},spacing:{configurable:!0,get:function(){return this.yf},set:function(a){this.yf!==a&&(A(a,"number", Ir,"spacing"),this.yf=a,this.C())}},nodeDiameterFormula:{configurable:!0,get:function(){return this.rp},set:function(a){this.rp!==a&&(eb(a,Ir,Ir,"nodeDiameterFormula"),a===Nr||a===Yr)&&(this.rp=a,this.C())}},actualXRadius:{configurable:!0,get:function(){return this.ec}},actualYRadius:{configurable:!0,get:function(){return this.he}},actualSpacing:{configurable:!0,get:function(){return this.Mj}},actualCenter:{configurable:!0,get:function(){return this.qx}}}); var Jr=new E(Ir,"ConstantSpacing",0),Wr=new E(Ir,"ConstantDistance",1),Vr=new E(Ir,"ConstantAngle",2),Xr=new E(Ir,"Packed",3),Lr=new E(Ir,"Clockwise",4),Ur=new E(Ir,"Counterclockwise",5),Sr=new E(Ir,"BidirectionalLeft",6),Tr=new E(Ir,"BidirectionalRight",7),Qr=new E(Ir,"Forwards",8),Rr=new E(Ir,"Reverse",9),Or=new E(Ir,"Ascending",10),Pr=new E(Ir,"Descending",11),Mr=new E(Ir,"Optimized",12),Nr=new E(Ir,"Pythagorean",13),Yr=new E(Ir,"Circular",14);Ir.className="CircularLayout";Ir.ConstantSpacing=Jr; Ir.ConstantDistance=Wr;Ir.ConstantAngle=Vr;Ir.Packed=Xr;Ir.Clockwise=Lr;Ir.Counterclockwise=Ur;Ir.BidirectionalLeft=Sr;Ir.BidirectionalRight=Tr;Ir.Forwards=Qr;Ir.Reverse=Rr;Ir.Ascending=Or;Ir.Descending=Pr;Ir.Optimized=Mr;Ir.Pythagorean=Nr;Ir.Circular=Yr;function Kr(){this.Hm=-Infinity;this.mn=this.Vk=null} Kr.prototype.compare=function(a,b){if(0<a&&0>this.Hm||Math.abs(a)<Math.abs(this.Hm)&&!(0>a&&0<this.Hm))for(this.Hm=a,this.Vk=[],this.mn=[],a=0;a<b.length;a++)this.Vk[a]=b[a].bounds.x,this.mn[a]=b[a].bounds.y};Kr.prototype.commit=function(a){if(null!==this.Vk&&null!==this.mn)for(var b=0;b<this.Vk.length;b++){var c=a.M(b);c.x=this.Vk[b];c.y=this.mn[b]}};Kr.className="VertexArrangement";function Zr(a){fq.call(this,a)}ma(Zr,fq);Zr.prototype.createVertex=function(){return new ms(this)}; Zr.prototype.createEdge=function(){return new ns(this)};Zr.className="CircularNetwork";function ms(a){tq.call(this,a);this.F=this.Kj=NaN}ma(ms,tq); function $r(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Xr)if(c.nodeDiameterFormula===Yr)a.Kj=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.Kj=Math.min(a.height/c,a.width/b)}else a.Kj=c.nodeDiameterFormula===Yr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.Kj} na.Object.defineProperties(ms.prototype,{diameter:{configurable:!0,get:function(){return this.Kj},set:function(a){this.Kj!==a&&(A(a,"number",ms,"diameter"),this.Kj=a)}},actualAngle:{configurable:!0,get:function(){return this.F},set:function(a){this.F!==a&&(A(a,"number",ms,"actualAngle"),this.F=a)}}});ms.className="CircularVertex";function ns(a){uq.call(this,a)}ma(ns,uq);ns.className="CircularEdge"; function os(a){Ei.call(this);this.Mh=null;this.No=0;this.Sd=(new Db(100,100)).freeze();this.yn=!1;this.xf=!0;this.pd=!1;this.Tl=100;this.ho=1;this.ig=1E3;this.kp=10;this.Jp=Math;this.ol=.05;this.nl=50;this.ll=150;this.ml=0;this.Xn=10;this.Wn=5;a&&Object.assign(this,a)}ma(os,Ei); os.prototype.cloneProtected=function(a){Ei.prototype.cloneProtected.call(this,a);a.Sd.assign(this.Sd);a.yn=this.yn;a.xf=this.xf;a.pd=this.pd;a.Tl=this.Tl;a.ho=this.ho;a.ig=this.ig;a.kp=this.kp;a.Jp=this.Jp;a.ol=this.ol;a.nl=this.nl;a.ll=this.ll;a.ml=this.ml;a.Xn=this.Xn;a.Wn=this.Wn}; os.prototype.serializeLayoutProperties=function(a,b){Ei.prototype.serializeLayoutProperties.call(this,a,b);a.arrangementSpacing={width:this.arrangementSpacing.width,height:this.arrangementSpacing.height};a.arrangesToOrigin=this.arrangesToOrigin;a.setsPortSpots=this.setsPortSpots;a.comments=this.comments;a.maxIterations=this.maxIterations;a.epsilonDistance=this.epsilonDistance;a.infinityDistance=this.infinityDistance;a.moveLimit=this.moveLimit;a.defaultSpringStiffness=this.defaultSpringStiffness;a.defaultSpringLength= this.defaultSpringLength;a.defaultElectricalCharge=this.defaultElectricalCharge;a.defaultGravitationalMass=this.defaultGravitationalMass;a.defaultCommentSpringLength=this.defaultCommentSpringLength;a.defaultCommentElectricalCharge=this.defaultCommentElectricalCharge}; os.prototype.deserializeLayoutProperties=function(a,b,c,d,e){Ei.prototype.deserializeLayoutProperties.call(this,a,b,c,d,e);this.arrangementSpacing=new Db(a.arrangementSpacing.width,a.arrangementSpacing.height);this.arrangesToOrigin=a.arrangesToOrigin;this.setsPortSpots=a.setsPortSpots;this.comments=a.comments;this.maxIterations=a.maxIterations;this.epsilonDistance=a.epsilonDistance;this.infinityDistance=a.infinityDistance;this.moveLimit=a.moveLimit;this.defaultSpringStiffness=a.defaultSpringStiffness; this.defaultSpringLength=a.defaultSpringLength;this.defaultElectricalCharge=a.defaultElectricalCharge;this.defaultGravitationalMass=a.defaultGravitationalMass;this.defaultCommentSpringLength=a.defaultCommentSpringLength;this.defaultCommentElectricalCharge=a.defaultCommentElectricalCharge};os.prototype.createNetwork=function(){return new ps(this)}; os.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));if(!this.Ww()){a=this.maxIterations;if(0<this.network.vertexes.count){this.network.Kq();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.Kv();this.No=0;if(this.needsClusterLayout()){b=this.network;c=b.bz();for(var d=c.iterator;d.next();){this.network=d.value;for(var e=this.network.vertexes.iterator;e.next();){var f=e.value;f.Od=f.vertexes.count;f.$h=1;f.vk=null;f.Ye=null}qs(this,0,a)}this.network=b;var g=d=c.iterator;G&&w(b,ps,os,"arrangeConnectedGraphs:singletons");d=this.arrangementSpacing;var h=g.count,k=!0;f=e=0;for(var l=Ma(),m=0;m<h+b.vertexes.count+2;m++)l[m]=null;h=0;g.reset();for(var n=M.alloc();g.next();)if(m= g.value,this.computeBounds(m,n),k)k=!1,e=n.x+n.width/2,f=n.y+n.height/2,l[0]=new J(n.x+n.width+d.width,n.y),l[1]=new J(n.x,n.y+n.height+d.height),h=2;else{var p=rs(l,h,e,f,n.width,n.height,d),r=l[p],q=new J(r.x+n.width+d.width,r.y),u=new J(r.x,r.y+n.height+d.height);p+1<h&&l.splice(p+1,0,null);l[p]=q;l[p+1]=u;h++;p=r.x-n.x;r=r.y-n.y;for(m=m.vertexes.iterator;m.next();)q=m.value,q.centerX+=p,q.centerY+=r}M.free(n);for(m=b.vertexes.iterator;m.next();)g=m.value,p=g.bounds,2>h?(e=p.x+p.width/2,f=p.y+ p.height/2,l[0]=new J(p.x+p.width+d.width,p.y),l[1]=new J(p.x,p.y+p.height+d.height),h=2):(k=rs(l,h,e,f,p.width,p.height,d),n=l[k],r=new J(n.x+p.width+d.width,n.y),p=new J(n.x,n.y+p.height+d.height),k+1<h&&l.splice(k+1,0,null),l[k]=r,l[k+1]=p,h++,g.centerX=n.x+g.width/2,g.centerY=n.y+g.height/2);Oa(l);for(d=c.iterator;d.next();){c=d.value;for(e=c.vertexes.iterator;e.next();)b.Mg(e.value);for(c=c.edges.iterator;c.next();)b.xm(c.value)}}ss(this,a);this.updateParts()}this.Tl=a;this.network=null;this.isValidLayout= !0}};os.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.Tc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};os.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.Yc(d.bounds)}return b}; function ts(a,b,c){G&&(C(b,os,"computeClusterLayoutIterations:level"),C(c,os,"computeClusterLayoutIterations:maxiter"));return Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10)} function qs(a,b,c){G&&(C(b,os,"layoutClusters:level"),C(c,os,"layoutClusters:maxiter"));if(us(a,b)){var d=a.ig;a.ig*=1+1/(b+1);var e=vs(a,b),f=Math.max(0,ts(a,b,c));a.maxIterations+=f;qs(a,b+1,c);ss(a,f);ws(a,e,b);c=e.vertexes.Ea();c.sort(function(a,b){return null===a||null===b||a===b?0:b.Od-a.Od});for(e=0;e<c.length;e++)xs(a,c[e],b);a.ig=d}} function us(a,b){G&&C(b,os,"hasClusters:level");if(10<b||3>a.network.vertexes.count)return!1;a.Mh=a.network.vertexes.Ea();a=a.Mh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.Od-a.Od});for(b=a.length-1;0<=b&&1>=a[b].Od;)b--;return 1<a.length-b} function vs(a,b){G&&C(b,os,"pushSubNetwork:level");for(var c=a.network,d=new ps(a),e=0;e<a.Mh.length;e++){var f=a.Mh[e];if(1<f.Od){d.Mg(f);var g=new ys;g.wu=f.Od;g.xu=f.width;g.vu=f.height;g.bx=f.focus.x;g.ex=f.focus.y;null===f.Ye&&(f.Ye=new H);f.Ye.add(g);f.Gw=f.Ye.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.xm(h):e.network===d?(h=e.vk,null===h&&(h=new H,e.vk=h),h.add(g),e.Od--,e.$h+=g.$h):g.network===d&&(h=g.vk,null=== h&&(h=new H,g.vk=h),h.add(e),g.Od--,g.$h+=e.$h)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,K.sqrt((f.fromVertex.$h+f.toVertex.$h)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.vk;if(null!==k&&0<k.count&&(g=e.Ye.M(e.Ye.count-1).wu-e.Od,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.M(m),p=null;for(f=n.edges.iterator;f.next();){var r=f.value;if(r.Dy(n)===e){p=r;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;r=m*n;1>r&&(r=1);h=K.sqrt((h+r+l*l*4/(g*g))/r);g=(h-1)*m/2;h=(h-1)*n/2;e.bounds=new M(f-p.x-g,k-p.y-h,m+2*g,n+2*h);e.focus=new J(p.x+g,p.y+h)}}a.network=d;return c} function ws(a,b,c){G&&(w(b,ps,os,"popNetwork:oldnet"),C(c,os,"popNetwork:level"));for(c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Ye){var e=d.Ye.M(d.Gw);d.Od=e.wu;var f=e.bx,g=e.ex;d.bounds=new M(d.centerX-f,d.centerY-g,e.xu,e.vu);d.focus=new J(f,g);d.Gw--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b} function xs(a,b,c){G&&(w(b,zs,os,"surroundNode:oldnet"),C(c,os,"surroundNode:level"));var d=b.vk;if(null!==d&&0!==d.count){c=b.centerX;var e=b.centerY,f=b.width,g=b.height;null!==b.Ye&&0<b.Ye.count&&(g=b.Ye.M(0),f=g.xu,g=g.vu);f=K.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.Od?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<d.count&&d.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,d=d.iterator;d.next();)if(k=d.value,!(1<k.Od||a.isFixed(k))){m=null;for(n=k.edges.iterator;n.next();){m=n.value;break}n=k.width;var p=k.height;n=K.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=c+m*Math.cos(n);k.centerY=e+m*Math.sin(n);h++}}} function rs(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}os.prototype.Kv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)}; os.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.$v();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.nj(c);null===d&&(d=this.network.sk(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.Jk(a,d,null));c.length=this.defaultCommentSpringLength}}}; function As(a,b){G&&(w(a,zs,os,"getNodeDistance:vertexA"),w(b,zs,os,"getNodeDistance:vertexB"));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,K.sqrt(c*c+a*a)):a+c<b?(d=d+e-g,a=a+c-b,K.sqrt(d*d+a*a)):g-(d+e):d>g+h?a>b+f?(c=d-g-h,a=a-b-f,K.sqrt(c*c+a*a)):a+c<b?(d=d-g-h,a=a+c-b,K.sqrt(d*d+a*a)):d-(g+h):a>b+f?a-(b+f):a+c<b?b-(a+c):.1} function ss(a,b){G&&C(b,os,"performIterations:num");a.Mh=null;for(b=a.No+b;a.No<b&&(a.No++,Bs(a)););a.Mh=null} function Bs(a){null===a.Mh&&(a.Mh=a.network.vertexes.Ea());var b=a.Mh;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.ig;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 r=d.y+h.y;if(k-l>c||l-k>c){if(e)break}else if(m-r>c||r-m>c){if(!e)break}else{var q=As(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new Cs),q=d.random(), h=d.random(),k>l?(d=Math.abs(p.bounds.right-g.bounds.x),d=(1+d)*q):k<l?(d=Math.abs(p.bounds.x-g.bounds.right),d=-(1+d)*q):(d=Math.max(p.width,g.width),d=(1+d)*q-d/2),m>r?(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)/(q*q),d=(l-k)/q*h,l=(r-m)/q*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=As(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new Cs),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;for(e=d=0;e<b.length;e++)c=b[e],a.isFixed(c)?a.moveFixedVertex(c):d=Math.max(d,a.moveVertex(c)|| 0);return d>a.epsilonDistance*a.epsilonDistance}os.prototype.moveVertex=function(a){var b=a.forceX,c=a.forceY,d=this.moveLimit;b<-d?b=-d:b>d&&(b=d);c<-d?c=-d:c>d&&(c=d);a.centerX+=b;a.centerY+=c;return b*b+c*c};os.prototype.moveFixedVertex=function(){};os.prototype.commitLayout=function(){this.Kw();this.commitNodes();this.isRouting&&this.commitLinks()}; os.prototype.Kw=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=ed,b.toSpot=ed)}};os.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=M.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;M.free(c)}c=M.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()}M.free(c)}; os.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};os.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.ol:a};os.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.nl:a};os.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.ll:a};os.prototype.electricalFieldX=function(){return 0};os.prototype.electricalFieldY=function(){return 0}; os.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.ml:a};os.prototype.gravitationalFieldX=function(){return 0};os.prototype.gravitationalFieldY=function(){return 0};os.prototype.isFixed=function(a){return a.isFixed}; na.Object.defineProperties(os.prototype,{currentIteration:{configurable:!0,get:function(){return this.No}},arrangementSpacing:{configurable:!0,get:function(){return this.Sd},set:function(a){w(a,Db,os,"arrangementSpacing");this.Sd.B(a)||(this.Sd.assign(a),this.C())}},arrangesToOrigin:{configurable:!0,get:function(){return this.yn},set:function(a){this.yn!==a&&(A(a,"boolean",os,"arrangesToOrigin"),this.yn=a,this.C())}},setsPortSpots:{configurable:!0, get:function(){return this.xf},set:function(a){this.xf!==a&&(A(a,"boolean",os,"setsPortSpots"),this.xf=a,this.C())}},comments:{configurable:!0,get:function(){return this.pd},set:function(a){this.pd!==a&&(A(a,"boolean",os,"comments"),this.pd=a,this.C())}},maxIterations:{configurable:!0,get:function(){return this.Tl},set:function(a){this.Tl!==a&&(A(a,"number",os,"maxIterations"),0<=a&&(this.Tl=a,this.C()))}},epsilonDistance:{configurable:!0,get:function(){return this.ho}, set:function(a){this.ho!==a&&(A(a,"number",os,"epsilonDistance"),0<a&&(this.ho=a,this.C()))}},infinityDistance:{configurable:!0,get:function(){return this.ig},set:function(a){this.ig!==a&&(A(a,"number",os,"infinityDistance"),1<a&&(this.ig=a,this.C()))}},moveLimit:{configurable:!0,get:function(){return this.kp},set:function(a){this.kp!==a&&(A(a,"number",os,"moveLimit"),1<a&&(this.kp=a,this.C()))}},randomNumberGenerator:{configurable:!0,get:function(){return this.Jp}, set:function(a){this.Jp!==a&&(null!==a&&"function"!==typeof a.random&&v('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.Jp=a)}},defaultSpringStiffness:{configurable:!0,get:function(){return this.ol},set:function(a){this.ol!==a&&(A(a,"number",os,"defaultSpringStiffness"),this.ol=a,this.C())}},defaultSpringLength:{configurable:!0,get:function(){return this.nl},set:function(a){this.nl!==a&&(A(a,"number",os,"defaultSpringLength"), this.nl=a,this.C())}},defaultElectricalCharge:{configurable:!0,get:function(){return this.ll},set:function(a){this.ll!==a&&(A(a,"number",os,"defaultElectricalCharge"),this.ll=a,this.C())}},defaultGravitationalMass:{configurable:!0,get:function(){return this.ml},set:function(a){this.ml!==a&&(A(a,"number",os,"defaultGravitationalMass"),this.ml=a,this.C())}},defaultCommentSpringLength:{configurable:!0,get:function(){return this.Xn},set:function(a){this.Xn!== a&&(A(a,"number",os,"defaultCommentSpringLength"),this.Xn=a,this.C())}},defaultCommentElectricalCharge:{configurable:!0,get:function(){return this.Wn},set:function(a){this.Wn!==a&&(A(a,"number",os,"defaultCommentElectricalCharge"),this.Wn=a,this.C())}}});os.className="ForceDirectedLayout";function ys(){this.ex=this.bx=this.vu=this.xu=this.wu=0}ys.className="ForceDirectedSubnet";function ps(a){fq.call(this,a)}ma(ps,fq);ps.prototype.createVertex=function(){return new zs(this)}; ps.prototype.createEdge=function(){return new Ds(this)};ps.className="ForceDirectedNetwork";function zs(a){tq.call(this,a);this.Ma=!1;this.bb=this.F=NaN;this.$h=this.Od=this.La=this.P=0;this.Ye=this.vk=null;this.Gw=0}ma(zs,tq);zs.prototype.serializeVertexProperties=function(a,b){tq.prototype.serializeVertexProperties.call(this,a,b);a.isFixed=this.isFixed;a.charge=this.charge;a.mass=this.mass}; zs.prototype.deserializeVertexProperties=function(a,b,c,d){tq.prototype.deserializeVertexProperties.call(this,a,b,c,d);this.isFixed=a.isFixed;this.charge=a.charge;this.mass=a.mass}; na.Object.defineProperties(zs.prototype,{isFixed:{configurable:!0,get:function(){return this.Ma},set:function(a){this.Ma!==a&&(A(a,"boolean",zs,"isFixed"),this.Ma=a)}},charge:{configurable:!0,get:function(){return this.F},set:function(a){this.F!==a&&(A(a,"number",zs,"charge"),this.F=a)}},mass:{configurable:!0,get:function(){return this.bb},set:function(a){this.bb!==a&&(A(a,"number",zs,"mass"),this.bb=a)}},forceX:{configurable:!0,get:function(){return this.P}, set:function(a){this.P!==a&&(A(a,"number",zs,"forceX"),this.P=a)}},forceY:{configurable:!0,get:function(){return this.La},set:function(a){this.La!==a&&(A(a,"number",zs,"forceY"),this.La=a)}}});zs.className="ForceDirectedVertex";function Ds(a){uq.call(this,a);this.j=this.o=NaN}ma(Ds,uq);Ds.prototype.serializeEdgeProperties=function(a,b){uq.prototype.serializeEdgeProperties.call(this,a,b);a.stiffness=this.stiffness;a.length=this.length}; Ds.prototype.deserializeEdgeProperties=function(a,b,c,d){uq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.stiffness=a.stiffness;this.length=a.length};na.Object.defineProperties(Ds.prototype,{stiffness:{configurable:!0,get:function(){return this.o},set:function(a){this.o!==a&&(A(a,"number",Ds,"stiffness"),this.o=a)}},length:{configurable:!0,get:function(){return this.j},set:function(a){this.j!==a&&(A(a,"number",Ds,"length"),this.j=a)}}});Ds.className="ForceDirectedEdge"; function Cs(){var a=0;void 0===a&&(a=42);this.seed=a;this.dz=48271;this.fz=2147483647;this.Q=44488.07041494893;this.gz=3399;this.ez=1/2147483647;this.random()}Cs.prototype.random=function(){var a=this.seed%this.Q*this.dz-this.seed/this.Q*this.gz;0<a?this.seed=a:this.seed=a+this.fz;return this.seed*this.ez};Cs.className="RandomNumberGenerator"; function Es(a){Ei.call(this);this.dc=this.De=25;this.N=0;this.jl=Fs;this.Ol=Gs;this.Dl=Hs;this.Wj=4;this.Yk=Is;this.xg=15;this.xf=!0;this.Vo=4;this.Ha=this.Oi=this.ya=-1;this.vc=this.wh=0;this.Pa=this.Bd=this.Cd=this.de=this.Eb=null;this.xh=0;this.np=this.bk=null;this.Jc=0;this.op=null;this.ad=new J;this.Ie=[];this.Ie.length=100;a&&Object.assign(this,a)}ma(Es,Ei); Es.prototype.cloneProtected=function(a){Ei.prototype.cloneProtected.call(this,a);a.De=this.De;a.dc=this.dc;a.N=this.N;a.jl=this.jl;a.Ol=this.Ol;a.Dl=this.Dl;a.Wj=this.Wj;a.Yk=this.Yk;a.xg=this.xg;a.xf=this.xf;a.Vo=this.Vo}; Es.prototype.serializeLayoutProperties=function(a,b){Ei.prototype.serializeLayoutProperties.call(this,a,b);a.layerSpacing=this.layerSpacing;a.columnSpacing=this.columnSpacing;a.direction=this.direction;a.cycleRemoveOption=this.cycleRemoveOption.name;a.layeringOption=this.layeringOption.name;a.initializeOption=this.initializeOption.name;a.iterations=this.iterations;a.aggressiveOption=this.aggressiveOption.name;a.packOption=this.packOption;a.setsPortSpots=this.setsPortSpots;a.linkSpacing=this.linkSpacing; a.ya=this.ya;a.Oi=this.Oi;a.Ha=this.Ha;a.wh=this.wh;a.vc=this.vc;a.Eb=this.Eb;a.xh=this.xh;a.Jc=this.Jc;a.ad={x:this.ad.x,y:this.ad.y}}; Es.prototype.deserializeLayoutProperties=function(a,b,c,d,e){Ei.prototype.deserializeLayoutProperties.call(this,a,b,c,d,e);this.layerSpacing=a.layerSpacing;this.columnSpacing=a.columnSpacing;this.direction=a.direction;this.cycleRemoveOption=db(Es,a.cycleRemoveOption);this.layeringOption=db(Es,a.layeringOption);this.initializeOption=db(Es,a.initializeOption);this.iterations=a.iterations;this.aggressiveOption=db(Es,a.aggressiveOption);this.packOption=a.packOption;this.setsPortSpots=a.setsPortSpots; this.linkSpacing=a.linkSpacing;this.ya=a.ya;this.Oi=a.Oi;this.Ha=a.Ha;this.wh=a.wh;this.vc=a.vc;this.Eb=a.Eb;this.xh=a.xh;this.Jc=a.Jc;this.ad=new J(this.ad.x,this.ad.y);e&&!d&&e.edges.each(function(a){if(!a.link&&a.fromVertex&&a.toVertex&&(null===a.fromVertex.node||null===a.toVertex.node)){for(var b=a.fromVertex;null!==b&&null===b.node&&0<b.yd.count;){var c=b.yd.M(0);if(c.link){a.link=c.link;break}b=c.fromVertex}if(!a.link){for(c=a.toVertex;null!==c&&null===c.node&&0<c.Kd.count;){var d=c.Kd.M(0); if(d.link){a.link=d.link;break}c=d.toVertex}if(!a.link)for(c=c.yd.iterator;c.next();)if(d=c.value,d.link&&d.fromVertex===b){a.link=d.link;break}}}})};Es.prototype.ob=function(a){a.classType===Es?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:v("Unknown enum value: "+a):Ei.prototype.ob.call(this,a)};Es.prototype.createNetwork=function(){return new Js(this)}; Es.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);this.Oi=-1;this.vc=this.wh=0;this.op=this.np=this.bk=null;for(a=0;a<this.Ie.length;a++)this.Ie[a]=null;if(0<this.network.vertexes.count){this.network.Kq();if(this.Ww())return;this.cycleRemoveOption!==Ks&&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===Ks&&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===e.data||null===f.node&&null===f.data)&&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 r=p;n=k;p=h;k=l;h=r}var q=e.focus;l=f.focus;var u=d.rev?f.bounds:e.bounds;r=J.alloc();m!==n?u.s()&&n.isVisible()?n.actualBounds.s()?(Io(n,p,Jc,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(Io(n,p,Jc,r),r.s()||r.assign(q)):r.assign(q):u.s()?(Io(n,p,Jc,r),r.s()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=J.alloc();g!==k?n.s()&&k.isVisible()? k.actualBounds.s()?(Io(k,h,Jc,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y):(Io(k,h,Jc,m),m.s()||m.assign(l)):m.assign(l):n.s()?(Io(k,h,Jc,m),m.s()||m.assign(l)):m.assign(l);90===this.N||270===this.N?(g=Math.round((r.x-q.x)/this.dc),k=r.x,h=Math.round((m.x-l.x)/this.dc),l=m.x):(g=Math.round((r.y-q.y)/this.dc),k=r.y,h=Math.round((m.y-l.y)/this.dc),l=m.y);J.free(r);J.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;r=e.layer;m=f.layer;n=0;u=d.link;if(null!==u){var y=u.fromPort,x=u.toPort;if(null!==y&&null!==x){var z=u.fromNode;p=u.toNode;if(null!==z&&null!==p){var B=Ls(this,!0),D=Ls(this,!1),F=this.setsPortSpots?B:u.computeSpot(!0,y);q=this.setsPortSpots?D:u.computeSpot(!1,x);var L=u.isOrthogonal;F.Vc()&&F.Rf(D)&&q.Vc()&&q.Rf(B)?n=0:(B=u.getLinkPoint(z,y,F,!0,L,p,x,J.alloc()),D=u.getLinkDirection(z,y,B,F,!0,L,p,x),J.free(B),F.Xq()||D!==Ms(this,d,!0)?this.setsPortSpots&&null!== z&&1===z.ports.count&&d.rev&&(n+=1):n+=1,F=u.getLinkPoint(p,x,q,!1,L,z,y,J.alloc()),u=u.getLinkDirection(p,x,F,q,!1,L,z,y),J.free(F),q.Xq()||u!==Ms(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)q=a.createVertex(),q.node=null,q.If=1,q.layer=r,q.near=e,a.Mg(q),e=a.Jk(e,q,d.link),e.valid=!1,e.rev=d.rev,e.portFromColOffset=g,e.portToColOffset=0,e.portFromPos=k,e.portToPos=0,e=q;u=1;n&&u--;if(r-m>u&&0<r){d.valid=!1;q= a.createVertex();q.node=null;q.If=2;q.layer=r-1;a.Mg(q);e=a.Jk(e,q,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=q;for(r--;r-m>u&&0<r;)q=a.createVertex(),q.node=null,q.If=3,q.layer=r-1,a.Mg(q),e=a.Jk(e,q,d.link),e.valid=!0,e.rev=d.rev,e.portFromColOffset=0,e.portToColOffset=0,e.portFromPos=0,e.portToPos=0,e=q,r--;e=a.Jk(q,f,d.link);e.valid=!n;n&&(q.near=f);e.rev=d.rev;e.portFromColOffset=0;e.portToColOffset=h;e.portFromPos=0;e.portToPos= l}else d.valid=!0}}a=this.Eb=[];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.Oi=-1;for(c=this.vc=this.wh=0;c<=this.ya;c++)a[c]>a[this.vc]&&(this.Oi=a[c]-1,this.vc=c),a[c]<a[this.wh]&&(this.wh=c);this.op=[];for(c=0;c<a.length;c++)this.op[c]=[];for(b.reset();b.next();)a=b.value,this.op[a.layer][a.index]=a;this.Ha=-1;for(a=0;a<=this.ya;a++){b=Ns(this,a);c=0;d=this.Eb[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.Ha=Math.max(this.Ha,c-1);Os(this,a,b)}this.reduceCrossings();this.straightenAndPack();this.updateParts()}this.network=null;this.isValidLayout=!0};Es.prototype.linkMinLength=function(){return 1};function Ps(a){var b=a.fromVertex.node||a.fromVertex.data;a=a.toVertex.node||a.toVertex.data;return null===b&&null===a?8:null===b||null===a?4:1} Es.prototype.nodeMinLayerSpace=function(a,b){return null===a.node&&null===a.data?0:90===this.N||270===this.N?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10};Es.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node&&null===a.data)return 0;var c=b?a.Nk:a.Mk;if(null!==c)return c;c=this.N;return 90===c||270===c?b?a.Nk=a.focus.x/this.dc+1|0:a.Mk=(a.bounds.width-a.focus.x)/this.dc+1|0:b?a.Nk=a.focus.y/this.dc+1|0:a.Mk=(a.bounds.height-a.focus.y)/this.dc+1|0}; function Qs(a){null===a.bk&&(a.bk=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.bk[b]=d.layer;b++;a.bk[b]=d.column;b++;a.bk[b]=d.index;b++}return a.bk}function Rs(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 Ss(a,b,c){G&&(C(b,Es,"crossingMatrix:unfixedLayer"),C(c,Es,"crossingMatrix:direction"));var d=Ns(a,b),e=a.Eb[b];if(null===a.np||a.np.length<e*e)a.np=[];for(var f=a.np,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.If===l.If||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.If===l.If||h++;var p;if(0<=c)for(k=d[g].sourceEdgesArrayAccess,l=0;l<k.length;l++){var r=k[l];if(r.valid&&r.fromVertex.layer!==b)for(n= r.fromVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++){var q=k[p];if(q.valid&&q.fromVertex.layer!==b){var u=q.fromVertex.index;var y=q.portToPos;q=q.portFromPos;m<y&&(n>u||n===u&&r>q)&&h++;y<m&&(u>n||u===n&&q>r)&&h++}}}if(0>=c)for(k=d[g].destinationEdgesArrayAccess,l=0;l<k.length;l++)if(r=k[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,r=r.portFromPos,p=l+1;p<k.length;p++)q=k[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,y=q.portToPos,q=q.portFromPos, r<q&&(n>u||n===u&&m>y)&&h++,q<r&&(u>n||u===n&&y>m)&&h++);f[g*e+g]=h;for(k=g+1;k<e;k++){var x=0,z=0;if(0<=c){h=d[g].sourceEdgesArrayAccess;var B=d[k].sourceEdgesArrayAccess;for(l=0;l<h.length;l++)if(r=h[l],r.valid&&r.fromVertex.layer!==b)for(n=r.fromVertex.index,r=r.portFromPos,p=0;p<B.length;p++)q=B[p],q.valid&&q.fromVertex.layer!==b&&(u=q.fromVertex.index,q=q.portFromPos,(n<u||n===u&&r<q)&&z++,(u<n||u===n&&q<r)&&x++)}if(0>=c)for(h=d[g].destinationEdgesArrayAccess,B=d[k].destinationEdgesArrayAccess, l=0;l<h.length;l++)if(r=h[l],r.valid&&r.toVertex.layer!==b)for(n=r.toVertex.index,m=r.portToPos,p=0;p<B.length;p++)q=B[p],q.valid&&q.toVertex.layer!==b&&(u=q.toVertex.index,y=q.portToPos,(n<u||n===u&&m<y)&&z++,(u<n||u===n&&y<m)&&x++);f[g*e+k]=x;f[k*e+g]=z}}Os(a,b,d);return f}Es.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.ya;b++)for(var c=Ss(this,b,1),d=this.Eb[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a}; function Ts(a){for(var b=0,c=0;c<=a.ya;c++){for(var d=a,e=c,f=Ns(d,e),g=d.Eb[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 r=n.toVertex.column+n.portToColOffset;h+=(Math.abs(p-r)+1)*Ps(n)}}}Os(d,e,f);b+=h}return b} Es.prototype.normalize=function(){var a=Infinity;this.Ha=-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.Ha=Math.max(this.Ha,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ha-=a}; function Us(a,b,c){G&&(C(b,Es,"barycenters:unfixedLayer"),C(c,Es,"barycenters:direction"));for(var d=Ns(a,b),e=a.Eb[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 r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(m+=r.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}Os(a,b,d);return f} function Vs(a,b,c){G&&(C(b,Es,"medians:unfixedLayer"),C(c,Es,"medians:direction"));for(var d=Ns(a,b),e=a.Eb[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 r=h.fromVertex;h.valid&&!h.rev&&r.layer!==b&&(n[m]=r.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)}Os(a,b,d);return f} function Ws(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&&Ws(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&&Ws(a,k,c,d,e,f)}} function Xs(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Xs(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Xs(a,b.value.fromVertex,c,d,e,f)}} Es.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.jl){default:case Ys: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!==Zs(a);){for(e=$s(a);null!==e;)d[c]=e,c--,e.valid=!1,e=$s(a);for(e=at(a);null!==e;)d[b]=e,b++,e.valid=!1,e=at(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.Ym(b),b.rev=!0);break;case Fs:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.Ng=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.xh=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&& bt(this,b);for(d.reset();d.next();)b=d.value,-1===b.Ng&&bt(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.Ng<b.Ng&&c<f&&(this.network.Ym(d),d.rev=!0));break;case Ks: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.Ym(b),b.rev=!0)}}};function Zs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function $s(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 at(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 bt(a,b){b.Ng=a.xh;a.xh++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.Ng&&(d.forest=!0,bt(a,e))}b.finish=a.xh;a.xh++} Es.prototype.assignLayers=function(){switch(this.Ol){case ct:dt(this);break;case et:for(var a,b=this.network.vertexes.iterator;b.next();)a=ft(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 Gs:dt(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&&gt(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 dt(a){for(var b=a.network.vertexes.iterator;b.next();){var c=ht(a,b.value);a.ya=Math.max(c,a.ya)}}function ht(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,ht(a,f)+e)}b.layer=c}else c=b.layer;return c} function ft(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,ft(a,f)+e)}b.layer=c}else c=b.layer;return c} function gt(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)gt(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&&Ws(a,h,0,-1,!0,!1)}for(Ws(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 r=0;r<e;r++){var q=p[r],u=q.fromVertex;m+=1;1!==u.component&&(f+=1,u=u.layer-l.layer,q=a.linkMinLength(q),d=Math.min(d,u-q))}p=l.destinationEdgesArrayAccess;e=p.length;for(r=0;r<e;r++)q=p[r].toVertex,--m,1!==q.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(Ws(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(r=0;r<n;r++)q=p[r].fromVertex,l+=1,1!==q.component?d+=1:m=!0;p=g.destinationEdgesArrayAccess;n=p.length;for(r=0;r<n;r++)q=p[r],u=q.toVertex,--l,1!==u.component&&(--d,u=g.layer-u.layer,q=a.linkMinLength(q),e=Math.min(e,u-q));(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 Ms(a,b,c){return 90===a.N?c&&!b.rev||!c&&b.rev?270:90:180===a.N?c&&!b.rev||!c&&b.rev?0:180:270===a.N?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0} Es.prototype.initializeIndices=function(){switch(this.Dl){default:case it:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.Eb[c];this.Eb[c]++}break;case Hs: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&&jt(this,c);break;case kt: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&&lt(this,c)}}; function jt(a,b){var c=b.layer;b.index=a.Eb[c];a.Eb[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&&jt(a,d))} function lt(a,b){var c=b.layer;b.index=a.Eb[c];a.Eb[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&&lt(a,d))} Es.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=Qs(this),c,d;for(c=0;c<this.Wj;c++){for(d=0;d<=this.ya;d++)mt(this,d,1),nt(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=Qs(this));for(d=this.ya;0<=d;d--)mt(this,d,-1),nt(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=Qs(this))}Rs(this,b);for(c=0;c<this.Wj;c++){for(d=0;d<=this.ya;d++)mt(this,d,0),nt(this,d,0);e=this.countCrossings();e<a&&(a=e,b=Qs(this));for(d=this.ya;0<=d;d--)mt(this,d,0),nt(this,d,0);e=this.countCrossings(); e<a&&(a=e,b=Qs(this))}Rs(this,b);var f,g,h;switch(this.Yk){case ot:break;case pt: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=nt(this,d,-1)||f;e=this.countCrossings();e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,1)||f;e=this.countCrossings();e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f= nt(this,d,-1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this))}break;default:case Is: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=nt(this,d,-1)||f;e=this.countCrossings();e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,1)||f;e=this.countCrossings();e>=a?Rs(this,b): (a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,-1)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=nt(this,d,0)||f;e>=a?Rs(this,b):(a=e,b=Qs(this))}}Rs(this,b)}; function mt(a,b,c){G&&(C(b,Es,"medianBarycenterCrossingReduction:unfixedLayer"),C(c,Es,"medianBarycenterCrossingReduction:direction"));var d=Ns(a,b),e=a.Eb[b],f=Vs(a,b,c),g=Us(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);Os(a,b,d)} function nt(a,b,c){var d=Ns(a,b),e=a.Eb[b];c=Ss(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,r=0,q=d[f].column,u=d[f+1].column,y=a.nodeMinColumnSpace(d[f],!0),x=a.nodeMinColumnSpace(d[f],!1),z=a.nodeMinColumnSpace(d[f+1],!0),B=a.nodeMinColumnSpace(d[f+1],!1);y=q-y+z;x=u-x+B;var D=d[f].sourceEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.fromVertex, z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z<f&&(p+=2*(f-z),r+=2*(f+1-z));z===f+1&&(p+=1);z>f+1&&(p+=4*(z-f),r+=4*(z-(f+1)))}D=d[f].destinationEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.toVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z===f+1&&(r+=1)}D=d[f+1].sourceEdges.iterator;for(D.reset();D.next();)if(z=D.value,B=z.fromVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z<f&&(p+=2*(f+1-z),r+=2*(f-z));z===f&&(r+=1);z>f+1&&(p+=4*(z-(f+1)),r+=4*(z-f))}D=d[f+1].destinationEdges.iterator; for(D.reset();D.next();)if(z=D.value,B=z.toVertex,z.valid&&B.layer===b){for(z=0;d[z]!==B;)z++;z===f&&(p+=1)}z=B=0;D=g[d[f].index];var F=h[d[f].index],L=g[d[f+1].index],Z=h[d[f+1].index];-1!==D&&(B+=Math.abs(D-q),z+=Math.abs(D-x));-1!==F&&(B+=Math.abs(F-q),z+=Math.abs(F-x));-1!==L&&(B+=Math.abs(L-u),z+=Math.abs(L-y));-1!==Z&&(B+=Math.abs(Z-u),z+=Math.abs(Z-y));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&z<B-.5)l=k=!0,d[f].column=x,d[f+1].column=y,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index= f;Os(a,b,d);return k} Es.prototype.straightenAndPack=function(){var a=0!==(this.xg&1);var b=0!==(this.xg&qt);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.Ha-c[b])>>1)+8*d;this.Ha*=8}if(0!==(this.xg&2))for(c=!0;c;){c=!1;for(b=this.vc+1;b<=this.ya;b++)c=rt(this,b,1)|| c;for(b=this.vc-1;0<=b;b--)c=rt(this,b,-1)||c;c=rt(this,this.vc,0)||c}if(0!==(this.xg&4)){for(b=this.vc+1;b<=this.ya;b++)st(this,b,1);for(b=this.vc-1;0<=b;b--)st(this,b,-1);st(this,this.vc,0)}a&&(tt(this,-1),tt(this,1));if(0!==(this.xg&2))for(c=!0;c;){c=!1;c=rt(this,this.vc,0)||c;for(b=this.vc+1;b<=this.ya;b++)c=rt(this,b,0)||c;for(b=this.vc-1;0<=b;b--)c=rt(this,b,0)||c}}; function rt(a,b,c){G&&(C(b,Es,"bendStraighten:unfixedLayer"),C(c,Es,"bendStraighten:direction"));for(var d=!1;ut(a,b,c);)d=!0;return d} function ut(a,b,c){G&&(C(b,Es,"shiftbendStraighten:unfixedLayer"),C(c,Es,"shiftbendStraighten:direction"));var d,e=Ns(a,b),f=a.Eb[b],g=Us(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Us(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),r=0;0>d-1||m-e[d-1].column-1>n+a.nodeMinColumnSpace(e[d-1],!1)?r=m-1:r=m;n=d+1>=f||e[d+1].column-m-1>p+a.nodeMinColumnSpace(e[d+1],!0)?m+1:m;var q=p=0,u= 0;if(0>=c)for(var y=e[d].sourceEdges.iterator;y.next();){var x=y.value;var z=x.fromVertex;if(x.valid&&z.layer!==b){var B=Ps(x);var D=x.portFromColOffset;x=x.portToColOffset;z=z.column;p+=(Math.abs(m+x-(z+D))+1)*B;q+=(Math.abs(r+x-(z+D))+1)*B;u+=(Math.abs(n+x-(z+D))+1)*B}}if(0<=c)for(y=e[d].destinationEdges.iterator;y.next();)x=y.value,z=x.toVertex,x.valid&&z.layer!==b&&(B=Ps(x),D=x.portFromColOffset,x=x.portToColOffset,z=z.column,p+=(Math.abs(m+D-(z+x))+1)*B,q+=(Math.abs(r+D-(z+x))+1)*B,u+=(Math.abs(n+ D-(z+x))+1)*B);x=D=B=0;y=g[e[d].index];z=h[e[d].index];-1!==y&&(B+=Math.abs(y-m),D+=Math.abs(y-r),x+=Math.abs(y-n));-1!==z&&(B+=Math.abs(z-m),D+=Math.abs(z-r),x+=Math.abs(z-n));if(q<p||q===p&&D<B)l=k=!0,e[d].column=r;else if(u<p||u===p&&x<B)l=k=!0,e[d].column=n}Os(a,b,e);a.normalize();return k} function st(a,b,c){G&&(C(b,Es,"medianStraighten:unfixedLayer"),C(c,Es,"medianStraighten:direction"));var d=Ns(a,b),e=a.Eb[b],f=Vs(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)}Os(a,b, d);a.normalize()}function vt(a,b){G&&(C(b,Es,"packAux:column"),C(1,Es,"packAux:direction"));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 wt(a,b){G&&(C(b,Es,"tightPackAux:column"),C(1,Es,"tightPackAux:direction"));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 tt(a,b){G&&C(b,Es,"componentPack:direction");for(var c=0;c<=a.Ha;c++)for(;vt(a,c););a.normalize();for(c=0;c<a.Ha;c++)for(;wt(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ha;c++){var e=Qs(a);var f=Ts(a);for(d=f+1;f<d;){d=f;xt(a,c,1);var g=Ts(a);g>f?Rs(a,e):g<f&&(f=g,e=Qs(a))}}if(0>b)for(c=a.Ha;0<=c;c--)for(e=Qs(a),f=Ts(a),d=f+1;f<d;)d=f,xt(a,c,-1),g=Ts(a),g>f?Rs(a,e):g<f&&(f=g,e=Qs(a));a.normalize()} function xt(a,b,c){a.Jc=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.Jc)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Jc);a.Jc++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Xs(a,b,a.Jc,-1,!0,!0),a.Jc++);var f;b=[];for(f=0;f<a.Jc*a.Jc;f++)b[f]=!1;e=[];for(f=0;f<(a.ya+1)*(a.Ha+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.Ha,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ha+1)+h]=f.component}for(f=0;f<=a.ya;f++){if(0<c)for(g=0;g<a.Ha;g++)-1!==e[f*(a.Ha+1)+g]&&-1!==e[f*(a.Ha+1)+g+1]&&e[f*(a.Ha+1)+g]!==e[f*(a.Ha+1)+g+1]&&(b[e[f*(a.Ha+1)+g]*a.Jc+e[f*(a.Ha+1)+g+1]]=!0);if(0>c)for(g=a.Ha;0<g;g--)-1!==e[f*(a.Ha+1)+g]&&-1!==e[f*(a.Ha+1)+g-1]&&e[f*(a.Ha+1)+g]!==e[f*(a.Ha+1)+g-1]&&(b[e[f*(a.Ha+1)+g]*a.Jc+e[f*(a.Ha+1)+g-1]]=!0)}e= [];for(f=0;f<a.Jc;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.Jc;f++)b[k*a.Jc+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)} Es.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=Ls(this,!0),b=Ls(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.Ov();this.isRouting&&this.commitLinks()};function Ls(a,b){return 270===a.N?b?ld:od:90===a.N?b?od:ld:180===a.N?b?md:nd:b?nd:md} Es.prototype.commitNodes=function(){this.de=[];this.Cd=[];this.Bd=[];this.Pa=[];for(var a=0;a<=this.ya;a++)this.de[a]=0,this.Cd[a]=0,this.Bd[a]=0,this.Pa[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.de[c]=Math.max(this.de[c],this.nodeMinLayerSpace(b,!0));this.Cd[c]=Math.max(this.Cd[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.De;for(var d=0;d<=this.ya;d++){var e=c;0>=this.de[d]+this.Cd[d]&&(e=0);0<d&&(b+=e/2);90===this.N||0===this.N?(b+=this.Cd[d],this.Bd[d]=b, b+=this.de[d]):(b+=this.de[d],this.Bd[d]=b,b+=this.Cd[d]);d<this.ya&&(b+=e/2);this.Pa[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.ya;d++)270===this.N?this.Bd[d]=b.y+this.Bd[d]:90===this.N?(this.Bd[d]=b.y+c-this.Bd[d],this.Pa[d]=c-this.Pa[d]):180===this.N?this.Bd[d]=b.x+this.Bd[d]:(this.Bd[d]=b.x+c-this.Bd[d],this.Pa[d]=c-this.Pa[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.N||90===this.N){var h=b.x+this.dc*g;f=this.Bd[f]}else h=this.Bd[f],f=b.y+ this.dc*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.ad=new J(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()}; Es.prototype.Ov=function(){for(var a=0,b=this.De,c=0;c<=this.ya;c++)a+=this.de[c],a+=this.Cd[c];a+=this.ya*b;b=[];c=this.dc*this.Ha;for(var d=this.maxLayer;0<=d;d--)270===this.N?0===d?b.push(new M(0,0,c,Math.abs(this.Pa[0]))):b.push(new M(0,this.Pa[d-1],c,Math.abs(this.Pa[d-1]-this.Pa[d]))):90===this.N?0===d?b.push(new M(0,this.Pa[0],c,Math.abs(this.Pa[0]-a))):b.push(new M(0,this.Pa[d],c,Math.abs(this.Pa[d-1]-this.Pa[d]))):180===this.N?0===d?b.push(new M(0,0,Math.abs(this.Pa[0]),c)):b.push(new M(this.Pa[d- 1],0,Math.abs(this.Pa[d-1]-this.Pa[d]),c)):0===d?b.push(new M(this.Pa[0],0,Math.abs(this.Pa[0]-a),c)):b.push(new M(this.Pa[d],0,Math.abs(this.Pa[d-1]-this.Pa[d]),c));this.commitLayers(b,this.ad)};Es.prototype.commitLayers=function(){}; Es.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.ai(),b.uk(),b.Jf());for(a.reset();a.next();)b=a.value.link,null!==b&&b.Ug();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.ai();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)}null!==f&&(k=f.findVisibleNode(),null!==k&&k!==f&&(f=k,h=k.port));var l=b.computeSpot(!0,g);k=b.computeSpot(!1,h);var m= c.fromVertex,n=c.toVertex;if(c.valid){if(b.curve===gg&&4===b.pointsCount)if(m.column===n.column)c=b.getLinkPoint(e,g,l,!0,!1,f,h),g=b.getLinkPoint(f,h,k,!1,!1,e,g),c.s()||c.set(e.actualBounds.center),g.s()||g.set(f.actualBounds.center),b.uk(),b.Hf(c.x,c.y),b.Hf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.Hf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.Hf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===Cc&&(p=!0);null!==h&&k===Cc&&(r=!0);if(p||r){var q=b.i(0).x;c=b.i(0).y;m=b.i(3).x;d=b.i(3).y;p&&(90===this.N||270===this.N?(p=q,n= (c+d)/2):(p=(q+m)/2,n=c),b.O(1,p,n),l=b.getLinkPoint(e,g,l,!0,!1,f,h),l.s()||l.set(e.actualBounds.center),b.O(0,l.x,l.y));r&&(90===this.N||270===this.N?(l=m,c=(c+d)/2):(l=(q+m)/2,c=d),b.O(2,l,c),e=b.getLinkPoint(f,h,k,!1,!1,e,g),e.s()||e.set(f.actualBounds.center),b.O(3,e.x,e.y))}}b.Jf()}else if(m.layer===n.layer)b.Jf();else{p=r=!1;q=b.firstPickIndex+1;if(b.isOrthogonal){p=!0;var u=b.pointsCount;4<u&&b.points.removeRange(2,u-3)}else if(b.curve===gg)r=!0,u=b.pointsCount,4<u&&b.points.removeRange(2, u-3),4===u&&(q=2);else{u=b.pointsCount;var y=l===Cc,x=k===Cc;2<u&&y&&x?b.points.removeRange(1,u-2):3<u&&y&&!x?b.points.removeRange(1,u-3):3<u&&!y&&x?b.points.removeRange(2,u-2):4<u&&!y&&!x&&b.points.removeRange(2,u-3)}if(c.rev){for(;null!==n&&m!==n;){var z=u=null;for(y=n.sourceEdges.iterator;y.next()&&(x=y.value,x.link!==c.link||(u=x.fromVertex,z=x.toVertex,null!==u.node)););if(null===u)break;if(u!==m){y=b.i(q-1).x;x=b.i(q-1).y;var B=u.centerX;var D=u.centerY;if(p)180===this.N||0===this.N?q===b.firstPickIndex+ 1?(b.m(q++,y,x),b.m(q++,y,D)):(null!==z?z.centerY:x)!==D&&(z=this.Pa[u.layer-1]+this.ad.x,b.m(q++,z,x),b.m(q++,z,D)):q===b.firstPickIndex+1?(b.m(q++,y,x),b.m(q++,B,x)):(null!==z?z.centerX:y)!==B&&(z=this.Pa[u.layer-1]+this.ad.y,b.m(q++,y,z),b.m(q++,B,z));else if(q===b.firstPickIndex+1){z=Math.max(10,this.de[n.layer]);var F=Math.max(10,this.Cd[n.layer]);if(r)180===this.N?B<=n.bounds.x?(n=n.bounds.x,b.m(q++,n-z,D),b.m(q++,n,D),b.m(q++,n+F,D)):(b.m(q++,B-z,D),b.m(q++,B,D),b.m(q++,B+F,D)):90===this.N? D>=n.bounds.bottom?(n=n.bounds.y+n.bounds.height,b.m(q++,B,n+F),b.m(q++,B,n),b.m(q++,B,n-z)):(b.m(q++,B,D+F),b.m(q++,B,D),b.m(q++,B,D-z)):270===this.N?D<=n.bounds.y?(n=n.bounds.y,b.m(q++,B,n-z),b.m(q++,B,n),b.m(q++,B,n+F)):(b.m(q++,B,D-z),b.m(q++,B,D),b.m(q++,B,D+F)):0===this.N&&(B>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.m(q++,n+F,D),b.m(q++,n,D),b.m(q++,n-z,D)):(b.m(q++,B+F,D),b.m(q++,B,D),b.m(q++,B-z,D)));else{b.m(q++,y,x);var L=0;if(180===this.N||0===this.N){if(180===this.N?B>=n.bounds.right: B<=n.bounds.x)L=(0===this.N?-z:F)/2;b.m(q++,y+L,D)}else{if(270===this.N?D>=n.bounds.bottom:D<=n.bounds.y)L=(90===this.N?-z:F)/2;b.m(q++,B,x+L)}b.m(q++,B,D)}}else z=Math.max(10,this.de[u.layer]),F=Math.max(10,this.Cd[u.layer]),180===this.N?(r&&b.m(q++,B-z,D),b.m(q++,B,D),r&&b.m(q++,B+F,D)):90===this.N?(r&&b.m(q++,B,D+F),b.m(q++,B,D),r&&b.m(q++,B,D-z)):270===this.N?(r&&b.m(q++,B,D-z),b.m(q++,B,D),r&&b.m(q++,B,D+F)):(r&&b.m(q++,B+F,D),b.m(q++,B,D),r&&b.m(q++,B-z,D))}n=u}if(null===h||l!==Cc||p)if(y=b.i(q- 1).x,x=b.i(q-1).y,B=b.i(q).x,D=b.i(q).y,p)n=this.Cd[m.layer],180===this.N||0===this.N?(p=x,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.N?B>=m.bounds.x:B<=m.bounds.right)&&(n=m.centerX+(180===this.N?-n:n),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.dc/2:p=m.bounds.bottom+this.dc/2,b.m(q++,n,x),b.m(q++,n,p)),b.m(q++,B,p)):(p=y,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.N?D>=m.bounds.y:D<=m.bounds.bottom)&&(n=m.centerY+(270===this.N?-n:n),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.dc/ 2:p=m.bounds.right+this.dc/2,b.m(q++,y,n),b.m(q++,p,n)),b.m(q++,p,D)),b.m(q++,B,D);else if(r)z=Math.max(10,this.de[m.layer]),F=Math.max(10,this.Cd[m.layer]),180===this.N&&B>=m.bounds.x?(n=m.bounds.x+m.bounds.width,b.O(q-2,n,x),b.O(q-1,n+F,x)):90===this.N&&D<=m.bounds.bottom?(n=m.bounds.y,b.O(q-2,y,n),b.O(q-1,y,n-z)):270===this.N&&D>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.O(q-2,y,n),b.O(q-1,y,n+F)):0===this.N&&B<=m.bounds.right&&(n=m.bounds.x,b.O(q-2,n,x),b.O(q-1,n-z,x));else{z=Math.max(10,this.de[m.layer]); F=Math.max(10,this.Cd[m.layer]);p=0;if(180===this.N||0===this.N){if(180===this.N?B<=m.bounds.x:B>=m.bounds.right)p=(0===this.N?F:-z)/2;b.m(q++,B+p,x)}else{if(270===this.N?D<=m.bounds.y:D>=m.bounds.bottom)p=(90===this.N?F:-z)/2;b.m(q++,y,D+p)}b.m(q++,B,D)}}else{for(;null!==m&&m!==n;){z=u=null;for(m=m.destinationEdges.iterator;m.next()&&(y=m.value,y.link!==c.link||(u=y.toVertex,z=y.fromVertex,null!==z.node&&(z=null),null!==u.node)););if(null===u)break;u!==n&&(y=b.i(q-1).x,x=b.i(q-1).y,B=u.centerX,D= u.centerY,p?180===this.N||0===this.N?(null!==z?z.centerY:x)!==D&&(z=this.Pa[u.layer]+this.ad.x,q===b.firstPickIndex+1&&(z=0===this.N?Math.max(z,y):Math.min(z,y)),b.m(q++,z,x),b.m(q++,z,D)):(null!==z?z.centerX:y)!==B&&(z=this.Pa[u.layer]+this.ad.y,q===b.firstPickIndex+1&&(z=90===this.N?Math.max(z,x):Math.min(z,x)),b.m(q++,y,z),b.m(q++,B,z)):(z=Math.max(10,this.de[u.layer]),F=Math.max(10,this.Cd[u.layer]),180===this.N?(b.m(q++,B+F,D),r&&b.m(q++,B,D),b.m(q++,B-z,D)):90===this.N?(b.m(q++,B,D-z),r&&b.m(q++, B,D),b.m(q++,B,D+F)):270===this.N?(b.m(q++,B,D+F),r&&b.m(q++,B,D),b.m(q++,B,D-z)):(b.m(q++,B-z,D),r&&b.m(q++,B,D),b.m(q++,B+F,D))));m=u}p&&(y=b.i(q-1).x,x=b.i(q-1).y,B=b.i(q).x,D=b.i(q).y,180===this.N||0===this.N?x!==D&&(z=0===this.N?Math.min(Math.max((B+y)/2,this.Pa[n.layer]+this.ad.x),B):Math.max(Math.min((B+y)/2,this.Pa[n.layer]+this.ad.x),B),b.m(q++,z,x),b.m(q++,z,D)):y!==B&&(z=90===this.N?Math.min(Math.max((D+x)/2,this.Pa[n.layer]+this.ad.y),D):Math.max(Math.min((D+x)/2,this.Pa[n.layer]+this.ad.y), D),b.m(q++,y,z),b.m(q++,B,z)))}null!==d&&r&&(null!==g&&(l===Cc&&(l=b.i(0),d=b.i(2),l.B(d)||b.O(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,Cc,!0,!1,f,h),l.s()||l.set(e.actualBounds.center),b.O(0,l.x,l.y)),null!==h&&(k===Cc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.B(l)||b.O(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,Cc,!1,!1,e,g),e.s()||e.set(f.actualBounds.center),b.O(b.pointsCount-1,e.x,e.y)));b.Jf();c.commit()}}}this.avoidOrthogonalOverlaps()}; Es.prototype.avoidOrthogonalOverlaps=function(){if(!(0>=this.linkSpacing)){for(var a=new H,b=this.network.edges.iterator;b.next();){var c=b.value.link;null!==c&&c.isOrthogonal&&!a.contains(c)&&a.add(c)}if(0<a.count)if(90===this.N||270===this.N){b=0;c=[];for(a=a.iterator;a.next();){var d=a.value;if(null!==d&&d.isOrthogonal)for(var e=2;e<d.pointsCount-3;e++){var f=d.i(e);var g=d.i(e+1);if(this.A(f.y,g.y)&&!this.A(f.x,g.x)){var h=new yt;h.layer=Math.floor(f.y/2);var k=d.i(0),l=d.i(d.pointsCount-1);h.first= k.x*k.x+k.y;h.cc=l.x*l.x+l.y;h.ld=Math.min(f.x,g.x);h.Ac=Math.max(f.x,g.x);h.index=e;h.link=d;if(e+2<d.pointsCount){k=d.i(e-1);l=d.i(e+2);var m=0;k.y<f.y?m=l.y<f.y?3:f.x<g.x?2:1:k.y>f.y&&(m=l.y>f.y?0:g.x<f.x?2:1);h.j=m}c.push(h)}}}if(1<c.length)for(c.sort(this.Wy),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&&c[d].layer===f;)d++;if(1<d-a)for(f=a;f<d;){g=c[f].Ac;for(e=a+1;e<d&&c[e].ld<g;)g=Math.max(g,c[e].Ac),e++;g=e-f;if(1<g){this.Aj(c,this.nu,f,f+g);m=1;h=c[f].cc;for(k=f;k<e;k++)l=c[k],l.cc!== h&&(m++,h=l.cc);this.Aj(c,this.Vy,f,f+g);var n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].cc,this.Aj(c,this.nu,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++){var p=c[n];(k?p.first:p.cc)!==h&&(m++,h=k?p.first:p.cc);var r=p.link;f=r.i(p.index);g=r.i(p.index+1);var q=this.linkSpacing*(m-(l-1)/2);if(!r.isAvoiding||zt(f.x,f.y+q,g.x,g.y+q))b++,r.ai(),r.O(p.index,f.x,f.y+q),r.O(p.index+1,g.x,g.y+q),r.Jf()}}f=e}a=d}}else{b=0;c=[];for(a=a.iterator;a.next();)if(d= a.value,null!==d&&d.isOrthogonal)for(e=2;e<d.pointsCount-3;e++)f=d.i(e),g=d.i(e+1),this.A(f.x,g.x)&&!this.A(f.y,g.y)&&(h=new yt,h.layer=Math.floor(f.x/2),k=d.i(0),l=d.i(d.pointsCount-1),h.first=k.x+k.y*k.y,h.cc=l.x+l.y*l.y,h.ld=Math.min(f.y,g.y),h.Ac=Math.max(f.y,g.y),h.index=e,h.link=d,e+2<d.pointsCount&&(k=d.i(e-1),l=d.i(e+2),m=0,k.x<f.x?m=l.x<f.x?3:f.y<g.y?2:1:k.x>f.x&&(m=l.x>f.x?0:g.y<f.y?2:1),h.j=m),c.push(h));if(1<c.length)for(c.sort(this.Wy),a=0;a<c.length;){f=c[a].layer;for(d=a+1;d<c.length&& c[d].layer===f;)d++;if(1<d-a)for(f=a;f<d;){g=c[f].Ac;for(e=a+1;e<d&&c[e].ld<g;)g=Math.max(g,c[e].Ac),e++;g=e-f;if(1<g){this.Aj(c,this.nu,f,f+g);m=1;h=c[f].cc;for(k=f;k<e;k++)l=c[k],l.cc!==h&&(m++,h=l.cc);this.Aj(c,this.Vy,f,f+g);n=1;h=c[f].first;for(k=f;k<e;k++)l=c[k],l.first!==h&&(n++,h=l.first);k=!0;l=n;m<n?(k=!1,l=m,h=c[f].cc,this.Aj(c,this.nu,f,f+g)):h=c[f].first;m=0;for(n=f;n<e;n++)if(p=c[n],(k?p.first:p.cc)!==h&&(m++,h=k?p.first:p.cc),r=p.link,f=r.i(p.index),g=r.i(p.index+1),q=this.linkSpacing* (m-(l-1)/2),!r.isAvoiding||zt(f.x+q,f.y,g.x+q,g.y))b++,r.ai(),r.O(p.index,f.x+q,f.y),r.O(p.index+1,g.x+q,g.y),r.Jf()}f=e}a=d}}}};t=Es.prototype;t.Wy=function(a,b){return a instanceof yt&&b instanceof yt&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.ld<b.ld?-1:a.ld>b.ld?1:a.Ac<b.Ac?-1:a.Ac>b.Ac?1:0:0};t.Vy=function(a,b){return a instanceof yt&&b instanceof yt&&a!==b?a.first<b.first?-1:a.first>b.first||a.j<b.j?1:a.j>b.j||a.ld<b.ld?-1:a.ld>b.ld?1:a.Ac<b.Ac?-1:a.Ac>b.Ac?1:0:0}; t.nu=function(a,b){return a instanceof yt&&b instanceof yt&&a!==b?a.cc<b.cc?-1:a.cc>b.cc||a.j<b.j?1:a.j>b.j||a.ld<b.ld?-1:a.ld>b.ld?1:a.Ac<b.Ac?-1:a.Ac>b.Ac?1:0:0};t.A=function(a,b){G&&(C(a,Es,"isApprox:a"),C(b,Es,"isApprox:b"));a-=b;return-1<a&&1>a}; t.Aj=function(a,b,c,d){var e=a.length,f=d-c;if(!(1>=f))if((0>c||c>=e-1)&&v("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 zt(a,b,c,d){G&&(C(a,Es,"isUnoccupied2:px"),C(b,Es,"isUnoccupied2:py"),C(c,Es,"isUnoccupied2:qx"),C(d,Es,"isUnoccupied2:qy"));return!0}function Ns(a,b){var c=a.Eb[b];if(c>=a.Ie.length){var d=[];for(var e=0;e<a.Ie.length;e++)d[e]=a.Ie[e];a.Ie=d}void 0===a.Ie[c]||null===a.Ie[c]?d=[]:(d=a.Ie[c],a.Ie[c]=null);a=a.op[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function Os(a,b,c){a.Ie[a.Eb[b]]=c} na.Object.defineProperties(Es.prototype,{layerSpacing:{configurable:!0,get:function(){return this.De},set:function(a){this.De!==a&&(A(a,"number",Es,"layerSpacing"),0<=a&&(this.De=a,this.C()))}},columnSpacing:{configurable:!0,get:function(){return this.dc},set:function(a){this.dc!==a&&(A(a,"number",Es,"columnSpacing"),0<a&&(this.dc=a,this.C()))}},direction:{configurable:!0,get:function(){return this.N},set:function(a){this.N!==a&&(A(a,"number",Es,"direction"), 0===a||90===a||180===a||270===a?(this.N=a,this.C()):v("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},cycleRemoveOption:{configurable:!0,get:function(){return this.jl},set:function(a){this.jl!==a&&(eb(a,Es,Es,"cycleRemoveOption"),a===Ys||a===Fs||a===Ks)&&(this.jl=a,this.C())}},layeringOption:{configurable:!0,get:function(){return this.Ol},set:function(a){this.Ol!==a&&(eb(a,Es,Es,"layeringOption"),a===Gs||a===ct||a===et)&&(this.Ol=a,this.C())}},initializeOption:{configurable:!0, enumerable:!0,get:function(){return this.Dl},set:function(a){this.Dl!==a&&(eb(a,Es,Es,"initializeOption"),a===Hs||a===kt||a===it)&&(this.Dl=a,this.C())}},iterations:{configurable:!0,get:function(){return this.Wj},set:function(a){this.Wj!==a&&(C(a,Js,"iterations"),0<=a&&(this.Wj=a,this.C()))}},aggressiveOption:{configurable:!0,get:function(){return this.Yk},set:function(a){this.Yk!==a&&(eb(a,Es,Es,"aggressiveOption"),a===ot||a===Is||a===pt)&&(this.Yk=a,this.C())}},packOption:{configurable:!0, enumerable:!0,get:function(){return this.xg},set:function(a){this.xg!==a&&(A(a,"number",Es,"packOption"),0<=a&&8>a&&(this.xg=a,this.C()))}},setsPortSpots:{configurable:!0,get:function(){return this.xf},set:function(a){this.xf!==a&&(A(a,"boolean",Es,"setsPortSpots"),this.xf=a,this.C())}},linkSpacing:{configurable:!0,get:function(){return this.Vo},set:function(a){this.Vo!==a&&(A(a,"number",Es,"linkSpacing"),0<=a&&(this.Vo=a,this.C()))}},maxLayer:{configurable:!0, get:function(){return this.ya}},maxIndex:{configurable:!0,get:function(){return this.Oi}},maxColumn:{configurable:!0,get:function(){return this.Ha}},minIndexLayer:{configurable:!0,get:function(){return this.wh}},maxIndexLayer:{configurable:!0,get:function(){return this.vc}}}); var Fs=new E(Es,"CycleDepthFirst",0),Ys=new E(Es,"CycleGreedy",1),Ks=new E(Es,"CycleFromLayers",2),Gs=new E(Es,"LayerOptimalLinkLength",0),ct=new E(Es,"LayerLongestPathSink",1),et=new E(Es,"LayerLongestPathSource",2),Hs=new E(Es,"InitDepthFirstOut",0),kt=new E(Es,"InitDepthFirstIn",1),it=new E(Es,"InitNaive",2),ot=new E(Es,"AggressiveNone",0),Is=new E(Es,"AggressiveLess",1),pt=new E(Es,"AggressiveMore",2),qt=8;Es.className="LayeredDigraphLayout";Es.CycleDepthFirst=Fs;Es.CycleGreedy=Ys; Es.CycleFromLayers=Ks;Es.LayerOptimalLinkLength=Gs;Es.LayerLongestPathSink=ct;Es.LayerLongestPathSource=et;Es.InitDepthFirstOut=Hs;Es.InitDepthFirstIn=kt;Es.InitNaive=it;Es.AggressiveNone=ot;Es.AggressiveLess=Is;Es.AggressiveMore=pt;Es.PackNone=0;Es.PackExpand=1;Es.PackStraighten=2;Es.PackMedian=4;Es.PackAll=15;function yt(){this.index=this.Ac=this.ld=this.cc=this.first=this.layer=0;this.link=null;this.j=0}yt.className="SegInfo";function Js(a){fq.call(this,a)}ma(Js,fq);Js.prototype.createVertex=function(){return new At(this)}; Js.prototype.createEdge=function(){return new Bt(this)};Js.className="LayeredDigraphNetwork";function At(a){tq.call(this,a);this.Wa=this.bh=this.Ki=-1;this.F=NaN;this.P=null;this.valid=!1;this.finish=this.Ng=NaN;this.If=0;this.Mk=this.Nk=null}ma(At,tq); At.prototype.serializeVertexProperties=function(a,b){tq.prototype.serializeVertexProperties.call(this,a,b);a.layer=this.layer;a.column=this.column;a.index=this.index;a.component=this.component;a.near=this.near?mb(this.near):null;a.valid=this.valid;a.Ng=this.Ng;a.finish=this.finish;a.If=this.If;a.Nk=this.Nk;a.Mk=this.Mk}; At.prototype.deserializeVertexProperties=function(a,b,c,d){tq.prototype.deserializeVertexProperties.call(this,a,b,c,d);this.layer=a.layer;this.column=a.column;this.index=a.index;this.component=a.component;if(b=b.get(a.near))this.near=b;this.valid=a.valid;this.Ng=a.Ng;this.finish=a.finish;this.If=a.If;this.Nk=a.Nk;this.Mk=a.Mk}; na.Object.defineProperties(At.prototype,{layer:{configurable:!0,get:function(){return this.Ki},set:function(a){this.Ki!==a&&(A(a,"number",At,"layer"),this.Ki=a)}},column:{configurable:!0,get:function(){return this.bh},set:function(a){this.bh!==a&&(A(a,"number",At,"column"),this.bh=a)}},index:{configurable:!0,get:function(){return this.Wa},set:function(a){this.Wa!==a&&(A(a,"number",At,"index"),this.Wa=a)}},component:{configurable:!0,get:function(){return this.F}, set:function(a){this.F!==a&&(A(a,"number",At,"component"),this.F=a)}},near:{configurable:!0,get:function(){return this.P},set:function(a){this.P!==a&&(G&&null!==a&&w(a,At,At,"near"),this.P=a)}}});At.className="LayeredDigraphVertex";function Bt(a){uq.call(this,a);this.j=this.Ma=this.bb=!1;this.La=this.F=NaN;this.P=this.o=0}ma(Bt,uq); Bt.prototype.serializeEdgeProperties=function(a,b){uq.prototype.serializeEdgeProperties.call(this,a,b);a.valid=this.valid;a.rev=this.rev;a.forest=this.forest;a.portFromPos=this.portFromPos;a.portToPos=this.portToPos;a.portFromColOffset=this.portFromColOffset;a.portToColOffset=this.portToColOffset}; Bt.prototype.deserializeEdgeProperties=function(a,b,c,d){uq.prototype.deserializeEdgeProperties.call(this,a,b,c,d);this.valid=a.valid;this.rev=a.rev;this.forest=a.forest;this.portFromPos=a.portFromPos;this.portToPos=a.portToPos;this.portFromColOffset=a.portFromColOffset;this.portToColOffset=a.portToColOffset}; na.Object.defineProperties(Bt.prototype,{fromVertex:{configurable:!0,get:function(){return this.dd},set:function(a){this.dd!==a&&(G&&null!==a&&w(a,At,Bt,"fromVertex"),this.dd=a)}},toVertex:{configurable:!0,get:function(){return this.kd},set:function(a){this.kd!==a&&(G&&null!==a&&w(a,At,Bt,"toVertex"),this.kd=a)}},valid:{configurable:!0,get:function(){return this.bb},set:function(a){this.bb!==a&&(A(a,"boolean",Bt,"valid"),this.bb=a)}},rev:{configurable:!0, enumerable:!0,get:function(){return this.Ma},set:function(a){this.Ma!==a&&(A(a,"boolean",Bt,"rev"),this.Ma=a)}},forest:{configurable:!0,get:function(){return this.j},set:function(a){this.j!==a&&(A(a,"boolean",Bt,"forest"),this.j=a)}},portFromPos:{configurable:!0,get:function(){return this.F},set:function(a){this.F!==a&&(A(a,"number",Bt,"portFromPos"),this.F=a)}},portToPos:{configurable:!0,get:function(){return this.La},set:function(a){this.La!==a&&(A(a,"number", Bt,"portToPos"),this.La=a)}},portFromColOffset:{configurable:!0,get:function(){return this.o},set:function(a){this.o!==a&&(A(a,"number",Bt,"portFromColOffset"),this.o=a)}},portToColOffset:{configurable:!0,get:function(){return this.P},set:function(a){this.P!==a&&(A(a,"number",Bt,"portToColOffset"),this.P=a)}}});Bt.className="LayeredDigraphEdge"; function Y(a){Ei.call(this);this.Pb=new I;this.Dp=Ct;this.qd=Dt;this.xq=Et;this.As=Ft;this.sx=[];this.pd=!0;this.Lb=Gt;this.Sd=(new Db(10,10)).freeze();var b=new Ht(this);this.Y=new It(b);this.Z=new It(b);this.zv=[];a&&Object.assign(this,a)}ma(Y,Ei);Y.prototype.cloneProtected=function(a){Ei.prototype.cloneProtected.call(this,a);a.Dp=this.Dp;a.xq=this.xq;a.As=this.As;a.pd=this.pd;a.Lb=this.Lb;a.Sd.assign(this.Sd);a.Y.copyInheritedPropertiesFrom(this.Y);a.Z.copyInheritedPropertiesFrom(this.Z)}; Y.prototype.ob=function(a){a.classType===Y?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:v("Unknown enum value: "+a):Ei.prototype.ob.call(this,a)};Y.prototype.createNetwork=function(){return new Ht(this)}; Y.prototype.makeNetwork=function(a){function b(a){if(a instanceof V)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof T){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 R?(c.Lg(a.nodes,!0,b),c.Lg(a.links,!0,b)):a instanceof yf?c.Lg(a.memberParts,!1,b):c.Lg(a.iterator,!1,b);return c}; Y.prototype.doLayout=function(a){G&&null===a&&v("Layout.doLayout(collection) argument must not be null but a Diagram, a Group, or an Iterable of Parts");null===this.network&&(this.network=this.makeNetwork(a));this.arrangement!==Jt&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof R&&(b=a);this.path===Ct&&null!==b?this.qd=b.isTreePathToChildren?Dt:Kt:this.qd=this.path===Ct?Dt:this.path;if(0<this.network.vertexes.count){this.network.Kq(); 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.Pb.count){a=new I;for(b=this.Pb.iterator;b.next();){var c=b.value;c instanceof V?(c=this.network.nj(c),null!==c&&a.add(c)):c instanceof It&&a.add(c)}this.Pb=a}0===this.Pb.count&&this.findRoots();for(a=this.Pb.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,Lt(this,b));b=this.network.vertexes;for(a=null;a=Mt(b),0<a.count;)b=Nt(this,a),null!==b&&this.Pb.add(b), b.initialized=!0,Lt(this,b),b=a;for(a=this.Pb.iterator;a.next();)b=a.value,b instanceof It&&Ot(this,b);for(a=this.Pb.iterator;a.next();)b=a.value,b instanceof It&&Pt(this,b);for(a=this.Pb.iterator;a.next();)b=a.value,b instanceof It&&Qt(this,b);this.Kv();if(this.layerStyle===Rt){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.sx=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===St)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.Pb.iterator;a.next();)b=a.value,b instanceof It&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Pb=new I;this.isValidLayout=!0};function Mt(a){var b=new I;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b} Y.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.qd){case Dt:0===c.sourceEdges.count&&this.Pb.add(c);break;case Kt:0===c.destinationEdges.count&&this.Pb.add(c);break;default:v("Unhandled path value "+this.qd.toString())}}0===this.Pb.count&&(a=Nt(this,a),null!==a&&this.Pb.add(a))}; function Nt(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.qd){case Dt:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case Kt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:v("Unhandled path value "+a.qd.toString())}}return d} function Lt(a,b){if(null!==b){G&&w(b,It,Y,"walkTree:v");switch(a.qd){case Dt:if(0<b.destinationEdges.count){for(var c=new H,d=b.destinationVertexes;d.next();){var e=d.value;Tt(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.Ea())}break;case Kt:if(0<b.sourceEdges.count){c=new H;for(d=b.sourceVertexes;d.next();)e=d.value,Tt(a,b,e)&&c.add(e);0<c.count&&(b.children=c.Ea())}break;default:v("Unhandled path value"+a.qd.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.Pb.remove(f)}for(b=0;b<d;b++)Lt(a,c[b])}}function Tt(a,b,c){G&&w(b,It,Y,"walkOK:v");G&&w(c,It,Y,"walkOK:c");if(c.initialized){if(null===b)var d=!1;else{G&&w(c,It,Y,"isAncestor:a");G&&w(b,It,Y,"isAncestor:b");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} Y.prototype.removeChild=function(a,b){if(null!==a&&null!==b){G&&w(a,It,Y,"removeChild:p");G&&w(b,It,Y,"removeChild:c");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 Ot(a,b){if(null!==b){G&&w(b,It,Y,"initializeTree:v");a.initializeTreeVertexValues(b);b.alignment===Ut&&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];Ot(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 Vt(a,b){G&&w(b,It,Y,"mom:v");switch(a.xq){default:case Et:return null!==b.parent?b.parent:a.Y;case Wt:return null===b.parent?a.Y:null===b.parent.parent?a.Z:b.parent;case Xt:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.Z:a.Y;case Yt: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.Z:null!==b.parent?b.parent:a.Y}} Y.prototype.initializeTreeVertexValues=function(a){G&&w(a,It,Y,"initializeTreeVertexValues:v");var b=Vt(this,a);a.copyInheritedPropertiesFrom(b);if(null!==a.parent&&a.parent.alignment===Ut){b=a.angle;for(var 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 Pt(a,b){if(null!==b){G&&w(b,It,Y,"assignTree:v");a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Pt(a,b[d])}}Y.prototype.assignTreeVertexValues=function(){};function Qt(a,b){if(null!==b){G&&w(b,It,Y,"sortTree:v");b.alignment!==Ut&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Qt(a,b[d])}} Y.prototype.sortTreeVertexChildren=function(a){G&&w(a,It,Y,"sortTreeVertexChildren:v");switch(a.sorting){case Zt:break;case $t:a.children.reverse();break;case au:a.children.sort(a.comparer);break;case bu:a.children.sort(a.comparer);a.children.reverse();break;default:v("Unhandled sorting value "+a.sorting.toString())}};Y.prototype.Kv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)}; Y.prototype.addComments=function(a){G&&w(a,It,Y,"addComments:v");var b=a.angle,c=a.parent,d=0;var e=!1;null!==c&&(d=c.angle,e=c.alignment,e=cu(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.$v();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Xa(),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=M.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,M.free(e))};function cu(a){return a===du||a===Ut||a===eu||a===fu}function gu(a){return a===du||a===Ut} function hu(a){G&&w(a,It,Y,"isLeftSideBus:v");var b=a.parent;if(null!==b){var c=b.alignment;if(cu(c)){if(gu(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===eu)return!0}}return!1} Y.prototype.layoutComments=function(a){G&&w(a,It,Y,"layoutComments:v");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=cu(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=hu(a),k=0,l=a.comments,m=l.length,n=J.alloc(),p=0;p<m;p++){var r=l[p],q=r.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-q.width,a.bounds.y+k),r.move(n),r=r.Ld();r.next();){var u= r.value;u.fromSpot=md;u.toSpot=nd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.Ld();r.next();)u=r.value,u.fromSpot=nd,u.toSpot=md;else if(0<=a.commentMargin)for(n.h(a.bounds.x+2*a.focus.x+a.commentMargin,a.bounds.y+k),r.move(n),r=r.Ld();r.next();)u=r.value,u.fromSpot=nd,u.toSpot=md;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Ld();r.next();)u=r.value,u.fromSpot=md,u.toSpot=nd;k=0<=a.commentSpacing?k+(q.height+a.commentSpacing):k+(a.commentSpacing- q.height)}else{if(135<e&&!f||!c&&h)if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y-a.commentMargin-q.height),r.move(n),r=r.Ld();r.next();)u=r.value,u.fromSpot=ld,u.toSpot=od;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.Ld();r.next();)u=r.value,u.fromSpot=od,u.toSpot=ld;else if(0<=a.commentMargin)for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y+a.commentMargin),r.move(n),r=r.Ld();r.next();)u=r.value,u.fromSpot=od,u.toSpot=ld;else for(n.h(a.bounds.x+k,a.bounds.y+ a.commentMargin-q.height),r.move(n),r=r.Ld();r.next();)u=r.value,u.fromSpot=ld,u.toSpot=od;k=0<=a.commentSpacing?k+(q.width+a.commentSpacing):k+(a.commentSpacing-q.width)}}J.free(n);b=k-a.commentSpacing-(d?b.height:b.width);if(this.qd===Dt)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)}}; Y.prototype.layoutTree=function(a){if(null!==a){G&&w(a,It,Y,"layoutTree:v");for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case iu:ju(this,a);break;case ku:if(a.alignment===Ut)ju(this,a);else if(G&&w(a,It,Y,"layoutTreeBlock:v"),0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=cu(c)),d=hu(a),a.W.h(0,0),a.Ca.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.la.h(0,0):180===b&&!c||(90===b||270===b)&& d?a.la.h(a.width-2*a.focus.x,0):a.la.h(0,a.height-2*a.focus.y),a.Yq=null,a.jr=null;else{var e=pu(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.Ca.width:d.Ca.height);var k=a.alignment;d=k===qu;var l=k===ru,m=cu(k),n=Math.max(0,a.breadthLimit);c=su(a);var p=a.nodeSpacing,r=tu(a),q=a.rowSpacing,u=0;if(d||l||a.Zm||a.$m&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var y=a.height,x=0,z=0,B=0,D=null,F=null,L=0,Z=0,Q=0,ba=0,S=0,P=0,xa=0,ka=0; m&&!gu(k)&&135<e&&g.reverse();if(gu(k))if(1<h)for(var Aa=0;Aa<h;Aa++)0===Aa%2&&Aa!==h-1&&(ka=Math.max(ka,b?g[Aa].Ca.width:g[Aa].Ca.height));else 1===h&&(ka=b?g[0].Ca.width:g[0].Ca.height);if(m){switch(k){case du:z=135>e?uu(a,g,ka,x,z):vu(a,g,ka,x,z);ka=z.x;x=z.width;z=z.height;break;case eu:for(D=0;D<h;D++)F=g[D],n=F.Ca,B=0===P?0:q,b?(F.W.h(f-n.width,ba+B),x=Math.max(x,n.width),z=Math.max(z,ba+B+n.height),ba+=B+n.height):(F.W.h(Q+B,f-n.height),x=Math.max(x,Q+B+n.width),z=Math.max(z,n.height),Q+=B+ n.width),P++;break;case fu:for(D=0;D<h;D++)F=g[D],f=F.Ca,n=0===P?0:q,b?(F.W.h(p/2+a.focus.x,ba+n),x=Math.max(x,f.width),z=Math.max(z,ba+n+f.height),ba+=n+f.height):(F.W.h(Q+n,p/2+a.focus.y),x=Math.max(x,Q+n+f.width),z=Math.max(z,f.height),Q+=n+f.width),P++}D=wu(this,2);F=wu(this,2);b?(D[0].h(0,0),D[1].h(0,z),F[0].h(x,0)):(D[0].h(0,0),D[1].h(x,0),F[0].h(0,z));F[1].h(x,z)}else for(Aa=0;Aa<h;Aa++){var Sa=g[Aa],vb=Sa.Ca;if(b){0<n&&0<P&&Q+p+vb.width>n&&(Q<f&&xu(a,k,f-Q,0,xa,Aa-1),S++,P=0,xa=Aa,B=z,Q=0, ba=135<e?-z-q:z+q);yu(this,Sa,0,ba);var Xa=0;if(0===P){if(D=Sa.Yq,F=Sa.jr,L=vb.width,Z=vb.height,null===D||null===F||e!==pu(Sa))D=wu(this,2),F=wu(this,2),D[0].h(0,0),D[1].h(0,Z),F[0].h(L,0),F[1].h(L,Z)}else{var Ya=Ma();Z=zu(this,a,Sa,D,F,L,Z,Ya);Xa=Z.x;D=Ya[0];F=Ya[1];L=Z.width;Z=Z.height;Oa(Ya);Q<vb.width&&0>Xa&&(Au(a,-Xa,0,xa,Aa-1),Bu(D,-Xa,0),Bu(F,-Xa,0),Xa=0)}Sa.W.h(Xa,ba);x=Math.max(x,L);z=Math.max(z,B+(0===S?0:q)+vb.height);Q=L}else{0<n&&0<P&&ba+p+vb.height>n&&(ba<f&&xu(a,k,0,f-ba,xa,Aa-1), S++,P=0,xa=Aa,B=x,ba=0,Q=135<e?-x-q:x+q);yu(this,Sa,Q,0);Xa=0;if(0===P){if(D=Sa.Yq,F=Sa.jr,L=vb.width,Z=vb.height,null===D||null===F||e!==pu(Sa))D=wu(this,2),F=wu(this,2),D[0].h(0,0),D[1].h(L,0),F[0].h(0,Z),F[1].h(L,Z)}else Ya=Ma(),Z=zu(this,a,Sa,D,F,L,Z,Ya),Xa=Z.x,D=Ya[0],F=Ya[1],L=Z.width,Z=Z.height,Oa(Ya),ba<vb.height&&0>Xa&&(Au(a,0,-Xa,xa,Aa-1),Bu(D,0,-Xa),Bu(F,0,-Xa),Xa=0);Sa.W.h(Q,Xa);z=Math.max(z,Z);x=Math.max(x,B+(0===S?0:q)+vb.width);ba=Z}P++}0<S&&(b?(z+=Math.max(0,c),Q<x&&xu(a,k,x-Q,0,xa, h-1),0<u&&(l||Au(a,u,0,0,h-1),x+=u)):(x+=Math.max(0,c),ba<z&&xu(a,k,0,z-ba,xa,h-1),0<u&&(l||Au(a,0,u,0,h-1),z+=u)));u=l=0;switch(k){case Cu:b?l+=x/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2;break;case Du:0<S?b?l+=x/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2:b?(ka=g[0].W.x+g[0].la.x,l+=ka+(g[h-1].W.x+g[h-1].la.x+2*g[h-1].focus.x-ka)/2-a.focus.x-r/2):(ka=g[0].W.y+g[0].la.y,u+=ka+(g[h-1].W.y+g[h-1].la.y+2*g[h-1].focus.y-ka)/2-a.focus.y-r/2);break;case qu:b?(l-=r,x+=r):(u-=r,z+=r);break;case ru:b?(l+=x-a.width+r, x+=r):(u+=z-a.height+r,z+=r);break;case du:b?1<h?l+=ka+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].la.x:1<h?u+=ka+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].la.y;break;case eu:b?l+=x+p/2-a.focus.x:u+=z+p/2-a.focus.y;break;case fu:break;default:v("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)ka=g[r],b?ka.W.h(ka.W.x+ka.la.x-l,ka.W.y+(135<e?(m?-z:-ka.Ca.height)+ka.la.y-c:y+c+ka.la.y)):ka.W.h(ka.W.x+(135<e?(m?-x:-ka.Ca.width)+ka.la.x-c:d+c+ka.la.x),ka.W.y+ka.la.y-u);h=g=0;m?b?(x=Eu(a, x,l),0>l&&(l=0),135<e&&(u+=z+c),z+=y+c,k===fu&&(g+=p/2+a.focus.x),h+=y+c):(135<e&&(l+=x+c),x+=d+c,z=Fu(a,z,u),0>u&&(u=0),k===fu&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>x&&(x=Gu(k,d-x,0),g=x.x,h=x.y,x=d,l=0):x=Eu(a,x,l),0>l&&(g-=l,l=0),135<e&&(u+=z+c),z=Math.max(Math.max(z,y),z+y+c),h+=y+c):(135<e&&(l+=x+c),x=Math.max(Math.max(x,d),x+d+c),null===a.comments?y>z&&(z=Gu(k,0,y-z),g=z.x,h=z.y,z=y,u=0):z=Fu(a,z,u),0>u&&(h-=u,u=0),g+=d+c);if(0<S)e=wu(this,4),S=wu(this,4),b?(e[2].h(0,y+c),e[3].h(e[2].x, z),S[2].h(x,e[2].y),S[3].h(S[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(x,e[2].y),S[2].h(e[2].x,z),S[3].h(e[3].x,S[2].y));else{e=wu(this,D.length+2);S=wu(this,F.length+2);for(k=0;k<D.length;k++)m=D[k],e[k+2].h(m.x+g,m.y+h);for(k=0;k<F.length;k++)m=F[k],S[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,y),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])),S[0].h(l+d,0),S[1].h(S[0].x,y),S[2].y<S[1].y&&(S[2].x<S[0].x?S[2].assign(S[1]): S[1].assign(S[2])),S[3].y<S[2].y&&(S[3].x<S[0].x?S[3].assign(S[2]):S[2].assign(S[3])),e[2].y-=c/2,S[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])),S[0].h(0,u+y),S[1].h(d,S[0].y),S[2].x<S[1].x&&(S[2].y<S[0].y?S[2].assign(S[1]):S[1].assign(S[2])),S[3].x<S[2].x&&(S[3].y<S[0].y?S[3].assign(S[2]):S[2].assign(S[3])),e[2].x-=c/2,S[2].x-=c/2);Hu(this,D);Hu(this,F);a.Yq=e;a.jr=S; a.la.h(l,u);a.Ca.h(x,z)}break;default:v("Unhandled compaction value "+a.compaction.toString())}}}; function ju(a,b){G&&w(b,It,Y,"layoutTreeNone:v");if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=cu(c));var e=hu(b);b.W.h(0,0);b.Ca.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.la.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.la.h(b.width-2*b.focus.x,0):b.la.h(0,b.height-2*b.focus.y)}else{d=pu(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.Ca.width:k.Ca.height)}var l= b.alignment,m=l===qu,n=l===ru;h=cu(l);var p=Math.max(0,b.breadthLimit);k=su(b);var r=b.nodeSpacing,q=tu(b),u=m||n?0:q/2,y=b.rowSpacing,x=0;if(m||n||b.Zm||b.$m&&1===b.maxGenerationCount)x=Math.max(0,b.rowIndent);m=b.width;var z=b.height,B=0,D=0,F=0,L=0,Z=0,Q=0,ba=0,S=0,P=0,xa=0;h&&!gu(l)&&135<d&&e.reverse();if(gu(l))if(1<g)for(var ka=0;ka<g;ka++){var Aa=e[ka],Sa=Aa.Ca;0===ka%2&&ka!==g-1?P=Math.max(P,(c?Sa.width:Sa.height)+Iu(Aa)-r):0!==ka%2&&(xa=Math.max(xa,(c?Sa.width:Sa.height)+Iu(Aa)-r))}else 1=== g&&(P=c?e[0].Ca.width:e[0].Ca.height);if(h)switch(l){case du:case Ut:D=135>d?uu(b,e,P,B,D):vu(b,e,P,B,D);P=D.x;B=D.width;D=D.height;break;case eu:for(a=0;a<g;a++)p=e[a],u=p.Ca,F=0===ba?0:y,c?(p.W.h(f-u.width,Z+F),B=Math.max(B,u.width),D=Math.max(D,Z+F+u.height),Z+=F+u.height):(p.W.h(L+F,f-u.height),B=Math.max(B,L+F+u.width),D=Math.max(D,u.height),L+=F+u.width),ba++;break;case fu:for(f=0;f<g;f++)a=e[f],p=a.Ca,u=0===ba?0:y,c?(a.W.h(r/2+b.focus.x,Z+u),B=Math.max(B,p.width),D=Math.max(D,Z+u+p.height), Z+=u+p.height):(a.W.h(L+u,r/2+b.focus.y),B=Math.max(B,L+u+p.width),D=Math.max(D,p.height),L+=u+p.width),ba++}else for(xa=0;xa<g;xa++)ka=e[xa],Aa=ka.Ca,c?(0<p&&0<ba&&L+r+Aa.width>p&&(L<f&&xu(b,l,f-L,0,S,xa-1),Q++,ba=0,S=xa,F=D,L=0,Z=135<d?-D-y:D+y),Sa=0===ba?u:r,yu(a,ka,0,Z),ka.W.h(L+Sa,Z),B=Math.max(B,L+Sa+Aa.width),D=Math.max(D,F+(0===Q?0:y)+Aa.height),L+=Sa+Aa.width):(0<p&&0<ba&&Z+r+Aa.height>p&&(Z<f&&xu(b,l,0,f-Z,S,xa-1),Q++,ba=0,S=xa,F=B,Z=0,L=135<d?-B-y:B+y),Sa=0===ba?u:r,yu(a,ka,L,0),ka.W.h(L, Z+Sa),D=Math.max(D,Z+Sa+Aa.height),B=Math.max(B,F+(0===Q?0:y)+Aa.width),Z+=Sa+Aa.height),ba++;0<Q&&(c?(D+=Math.max(0,k),L<B&&xu(b,l,B-L,0,S,g-1),0<x&&(n||Au(b,x,0,0,g-1),B+=x)):(B+=Math.max(0,k),Z<D&&xu(b,l,0,D-Z,S,g-1),0<x&&(n||Au(b,0,x,0,g-1),D+=x)));x=n=0;switch(l){case Cu:c?n+=B/2-b.focus.x-q/2:x+=D/2-b.focus.y-q/2;break;case Du:0<Q?c?n+=B/2-b.focus.x-q/2:x+=D/2-b.focus.y-q/2:c?(l=e[0].W.x+e[0].la.x,n+=l+(e[g-1].W.x+e[g-1].la.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].W.y+e[0].la.y,x+=l+(e[g- 1].W.y+e[g-1].la.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case qu:c?(n-=q,B+=q):(x-=q,D+=q);break;case ru:c?(n+=B-b.width+q,B+=q):(x+=D-b.height+q,D+=q);break;case du:case Ut:c?1<g?n+=P+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].la.x:1<g?x+=P+r/2-b.focus.y:x+=e[0].focus.y-b.focus.y+e[0].la.y;break;case eu:c?n+=B+r/2-b.focus.x:x+=D+r/2-b.focus.y;break;case fu:break;default:v("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.W.h(l.W.x+l.la.x-n,l.W.y+(135<d?(h?-D:-l.Ca.height)+ l.la.y-k:z+k+l.la.y)):l.W.h(l.W.x+(135<d?(h?-B:-l.Ca.width)+l.la.x-k:m+k+l.la.x),l.W.y+l.la.y-x);c?(B=Eu(b,B,n),0>n&&(n=0),135<d&&(x+=D+k),D=Math.max(Math.max(D,z),D+z+k)):(135<d&&(n+=B+k),B=Math.max(Math.max(B,m),B+m+k),D=Fu(b,D,x),0>x&&(x=0));b.la.h(n,x);b.Ca.h(B,D)}} function uu(a,b,c,d,e){G&&w(a,It,Y,"layoutBusChildrenPosDir:v");var f=b.length;if(0===f)return new M(c,0,d,e);if(1===f)return a=b[0],d=a.Ca.width,e=a.Ca.height,new M(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===pu(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.Ca,u=0===l?0:h;if(k){var y=Iu(r)-g;r.W.h(c-(q.width+y),n+u);d=Math.max(d,q.width+y);e=Math.max(e,n+u+q.height);n+=u+q.height}else y=Iu(r)-g,r.W.h(m+u,c-(q.height+y)),e=Math.max(e,q.height+y),d=Math.max(d,m+ u+q.width),m+=u+q.width;l++}l=0;r=m;p=n;k?(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];y=u.Ca;var x=0===l?0:h;if(k){var z=Iu(u)-g;u.W.h(m+z,n+x);d=Math.max(d,m+y.width+z);e=Math.max(e,n+x+y.height);n+=x+y.height}else z=Iu(u)-g,u.W.h(m+x,n+z),d=Math.max(d,m+x+y.width),e=Math.max(e,n+y.height+z),m+=x+y.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.Ca,h=Ju(b),k?(b.W.h(c+g/2-b.focus.x-b.la.x,e+h),k=c+g/2-b.focus.x-b.la.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.W.x&&(c=Ku(a,b.W.x,!1,c,g))):(b.W.h(d+h,c+g/2-b.focus.y-b.la.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.la.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.W.y&&(c=Ku(a,b.W.y,!0,c,g))));return new M(c,0,d,e)} function vu(a,b,c,d,e){G&&w(a,It,Y,"layoutBusChildrenNegDir:v");var f=b.length;if(0===f)return new M(c,0,d,e);if(1===f)return b=b[0],d=b.Ca.width,e=b.Ca.height,new M(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===pu(a),l=0,m=0,n=0,p=0;p<f;p++)if(!(0!==p%2||1<f&&p===f-1)){var r=b[p],q=r.Ca,u=0===l?0:h;if(k){var y=Iu(r)-g;n-=u+q.height;r.W.h(c-(q.width+y),n);d=Math.max(d,q.width+y);e=Math.max(e,Math.abs(n))}else y=Iu(r)-g,m-=u+q.width,r.W.h(m,c-(q.height+y)),e=Math.max(e,q.height+y),d=Math.max(d, Math.abs(m));l++}l=0;r=m;p=n;k?(m=c+g,n=0):(m=0,n=c+g);for(q=0;q<f;q++)if(0!==q%2){u=b[q];y=u.Ca;var x=0===l?0:h;if(k){var z=Iu(u)-g;n-=x+y.height;u.W.h(m+z,n);d=Math.max(d,m+y.width+z);e=Math.max(e,Math.abs(n))}else z=Iu(u)-g,m-=x+y.width,u.W.h(m,n+z),e=Math.max(e,n+y.height+z),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.Ca,q=Ju(h),k?(h.W.h(c+g/2-h.focus.x-h.la.x,-e-l.height-q),m=c+g/2-h.focus.x-h.la.x,d=Math.max(d,m+l.width),0>m&&(d-=m),e=Math.max(e,Math.abs(Math.min(p,n))+q+l.height), 0>h.W.x&&(c=Ku(a,h.W.x,!1,c,g))):(h.W.h(-d-l.width-q,c+g/2-h.focus.y-h.la.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.la.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.W.y&&(c=Ku(a,h.W.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.W.h(g.W.x,g.W.y+e):g.W.h(g.W.x+d,g.W.y);return new M(c,0,d,e)}function Iu(a){G&&w(a,It,Y,"fixRelativePostions:child");return null===a.parent?0:a.parent.nodeSpacing} function Ju(a){G&&w(a,It,Y,"fixRelativePostions:lastchild");return null===a.parent?0:a.parent.rowSpacing}function Ku(a,b,c,d,e){G&&w(a,It,Y,"fixRelativePostions:v");a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].W.h(a[g].W.x,a[g].W.y-b):a[g].W.h(a[g].W.x-b,a[g].W.y);b=a[f-1];return Math.max(d,c?b.la.y+b.focus.y-e/2:b.la.x+b.focus.x-e/2)} function Eu(a,b,c){G&&w(a,It,Y,"calculateSubwidth:v");switch(a.alignment){case Du:case Cu:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case qu:return a.width>b?a.width:b;case ru:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case du:case Ut:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case eu:return a.width-a.focus.x+a.nodeSpacing/2+b;case fu:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}} function Fu(a,b,c){G&&w(a,It,Y,"calculateSubheight:v");switch(a.alignment){case Du:case Cu:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case qu:return a.height>b?a.height:b;case ru:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case du:case Ut:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case eu:return a.height-a.focus.y+a.nodeSpacing/2+b;case fu:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}} function Gu(a,b,c){G&&w(a,E,Y,"alignOffset:align");switch(a){case Cu:b/=2;c/=2;break;case Du:b/=2;c/=2;break;case qu:c=b=0;break;case ru:break;default:v("Unhandled alignment value "+a.toString())}return new J(b,c)}function xu(a,b,c,d,e,f){G&&w(a,It,Y,"shiftRelPosAlign:v");G&&w(b,E,Y,"shiftRelPosAlign:align");b=Gu(b,c,d);Au(a,b.x,b.y,e,f)}function Au(a,b,c,d,e){G&&w(a,It,Y,"shiftRelPos:v");if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].W;f.x+=b;f.y+=c}} function yu(a,b,c,d){G&&(w(b,It,Y,"recordMidPoints:v"),A(c,"number",Y,"recordMidPoints:x"),A(d,"number",Y,"recordMidPoints:y"));var e=b.parent;switch(a.qd){case Dt:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case Kt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:v("Unhandled path value "+a.qd.toString())}}function Bu(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}} function zu(a,b,c,d,e,f,g,h){G&&w(b,It,Y,"mergeFringes:parent");G&&w(c,It,Y,"mergeFringes:child");var k=pu(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.Yq,q=c.jr;g=c.Ca;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==pu(c))r=wu(a,2),q=wu(a,2),l?(r[0].h(0,0),r[1].h(0,g.height),q[0].h(g.width,0),q[1].h(q[0].x,r[1].y)):(r[0].h(0,0),r[1].h(g.width,0),q[0].h(0,g.height),q[1].h(r[1].x,q[0].y));if(l){p=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c= 0;c<n.length&&e<r.length;){f=n[c];var y=r[e];k=y.x;l=y.y;k+=d;var x=f;c+1<n.length&&(x=n[c+1]);var z=y;y=z.x;z=z.y;e+1<r.length&&(z=r[e+1],y=z.x,z=z.y,y+=d);var B=p;f.y===l?B=k-f.x:f.y>l&&f.y<z?B=k+(f.y-l)/(z-l)*(y-k)-f.x:l>f.y&&l<x.y&&(B=k-(f.x+(l-f.y)/(x.y-f.y)*(x.x-f.x)));B<p&&(p=B);x.y<=f.y?c++:z<=l?e++:(x.y<=z&&c++,z<=x.y&&e++)}p=d-p;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=wu(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=wu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Hu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=wu(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=wu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Hu(a,m);e=f}f=Math.max(0,p)+g.width;g=u;Hu(a,b);Hu(a,r);Hu(a,n);Hu(a,q);h[0]=d;h[1]=e;return new M(p,0,f,g)}d=9999999;if(!(null===n||2>n.length||null===r||2>r.length))for(e=c=0;c<n.length&&e<r.length;)f=n[c],y=r[e],k=y.x,l=y.y,l+=p,x=f,c+1<n.length&&(x=n[c+1]),z=y,y=z.x,z=z.y,e+1<r.length&&(z=r[e+1],y=z.x,z=z.y,z+=p),B=d,f.x===k?B=l-f.y:f.x>k&&f.x<y?B=l+(f.x-k)/(y-k)*(z-l)-f.y:k>f.x&&k<x.x&&(B=l-(f.y+(k-f.x)/(x.x-f.x)*(x.y-f.y))),B<d&&(d=B),x.x<=f.x? c++:y<=k?e++:(x.x<=y&&c++,y<=x.x&&e++);p-=d;p+=m;c=r;e=p;if(null===b||2>b.length||null===c||2>c.length)d=null;else{m=wu(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=wu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);Hu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=wu(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=wu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);Hu(a,m);e=f}f=u;g=Math.max(0,p)+g.height;Hu(a,b);Hu(a,r);Hu(a,n);Hu(a,q);h[0]=d;h[1]=e;return new M(p,0,f,g)}function wu(a,b){a=a.zv[b];if(void 0!==a&&(a=a.pop(),void 0!==a))return a;a=[];for(var c=0;c<b;c++)a[c]=new J;return a} function Hu(a,b){var c=b.length,d=a.zv[c];void 0===d&&(d=[],a.zv[c]=d);d.push(b)} Y.prototype.arrangeTrees=function(){if(this.Lb===Jt)for(var a=this.Pb.iterator;a.next();){var b=a.value;if(b instanceof It){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);Lu(this,b,c,d)}}}else{a=[];for(b=this.Pb.iterator;b.next();)c=b.value,c instanceof It&&a.push(c);switch(this.sorting){case Zt:break;case $t:a.reverse();break;case au:a.sort(this.comparer);break;case bu:a.sort(this.comparer);a.reverse();break;default:v("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];Lu(this,e,b+e.la.x,c+e.la.y);switch(this.Lb){case Gt:c+=e.Ca.height+this.Sd.height;break;case Mu:b+=e.Ca.width+this.Sd.width;break;default:v("Unhandled arrangement value "+this.Lb.toString())}}}};function Lu(a,b,c,d){if(null!==b){G&&w(b,It,Y,"assignAbsolutePositions:v");b.x=c;b.y=d;b=b.children;for(var e=b.length,f=0;f<e;f++){var g=b[f];Lu(a,g,c+g.W.x,d+g.W.y)}}} Y.prototype.commitLayout=function(){this.Kw();this.commitNodes();this.Ov();this.isRouting&&this.commitLinks()};Y.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)}; Y.prototype.Ov=function(){if(this.layerStyle===Rt){for(var a=this.sx,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Yc(e.bounds);var f=b[e.level];void 0===f?f=su(e):f=Math.max(f,su(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.Qc(this.nodeSpacing/2,this.layerSpacing),d=new J(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.Qc(this.layerSpacing,this.nodeSpacing/2),d=new J(-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 M(0,f,c,h))):90===this.angle?(e.push(new M(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new M(f,0,h,c))):(e.push(new M(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};Y.prototype.commitLayers=function(){};Y.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()}; Y.prototype.Kw=function(){for(var a=this.Pb.iterator;a.next();){var b=a.value;b instanceof It&&Nu(this,b)}};function Nu(a,b){if(null!==b){G&&w(b,It,Y,"setPortSpotsTree:v");a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Nu(a,b[d])}} Y.prototype.setPortSpots=function(a){G&&w(a,It,Y,"setPortSpots:v");var b=a.alignment;if(cu(b)){G&&w(a,It,Y,"setPortSpotsBus:v");G&&w(b,E,Y,"setPortSpots:align");var c=this.qd===Dt,d=pu(a);switch(d){case 0:var e=nd;break;case 90:e=od;break;case 180:e=md;break;default:e=ld}var f=a.children,g=f.length;switch(b){case du:case Ut: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?md:ld;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k= md;break;case 90:k=ld;break;case 180:k=nd;break;default:k=od}else 0===b%2&&(k=90===d||270===d?nd:od);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case eu:d=90===d||270===d?nd:od;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 fu:for(d= 90===d||270===d?md:ld,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=pu(a),this.qd===Dt)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Jb())switch(c){case 0:d.fromSpot=nd;break;case 90:d.fromSpot=od;break;case 180:d.fromSpot=md;break;default:d.fromSpot=ld}else d.fromSpot=a.portSpot; if(a.setsChildPortSpot)if(a.childPortSpot.Jb())switch(c){case 0:d.toSpot=md;break;case 90:d.toSpot=ld;break;case 180:d.toSpot=nd;break;default:d.toSpot=od}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.Jb())switch(c){case 0:d.toSpot=nd;break;case 90:d.toSpot=od;break;case 180:d.toSpot=md;break;default:d.toSpot=ld}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Jb())switch(c){case 0:d.fromSpot=md;break; case 90:d.fromSpot=ld;break;case 180:d.fromSpot=nd;break;default:d.fromSpot=od}else d.fromSpot=a.childPortSpot}};function pu(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function su(a){G&&w(a,It,Y,"computeLayerSpacing:v");var b=pu(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 tu(a){G&&w(a,It,Y,"computeNodeIndent:v");var b=pu(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)} na.Object.defineProperties(Y.prototype,{roots:{configurable:!0,get:function(){return this.Pb},set:function(a){this.Pb!==a&&(w(a,I,Y,"roots"),this.Pb=a,this.C())}},path:{configurable:!0,get:function(){return this.Dp},set:function(a){this.Dp!==a&&(eb(a,Y,Y,"path"),this.Dp=a,this.C())}},treeStyle:{configurable:!0,get:function(){return this.xq},set:function(a){this.Lb!==a&&(eb(a,Y,Y,"treeStyle"),a===Et||a===Xt||a===Yt||a===Wt)&&(this.xq=a,this.C())}},layerStyle:{configurable:!0, enumerable:!0,get:function(){return this.As},set:function(a){this.Lb!==a&&(eb(a,Y,Y,"layerStyle"),a===Ft||a===St||a===Rt)&&(this.As=a,this.C())}},comments:{configurable:!0,get:function(){return this.pd},set:function(a){this.pd!==a&&(A(a,"boolean",Y,"comments"),this.pd=a,this.C())}},arrangement:{configurable:!0,get:function(){return this.Lb},set:function(a){this.Lb!==a&&(eb(a,Y,Y,"arrangement"),a===Gt||a===Mu||a===Jt)&&(this.Lb=a,this.C())}},arrangementSpacing:{configurable:!0, enumerable:!0,get:function(){return this.Sd},set:function(a){w(a,Db,Y,"arrangementSpacing");this.Sd.B(a)||(this.Sd.assign(a),this.C())}},rootDefaults:{configurable:!0,get:function(){return this.Y},set:function(a){this.Y!==a&&(w(a,It,Y,"rootDefaults"),this.Y=a,this.C())}},alternateDefaults:{configurable:!0,get:function(){return this.Z},set:function(a){this.Z!==a&&(w(a,It,Y,"alternateDefaults"),this.Z=a,this.C())}},sorting:{configurable:!0,get:function(){return this.Y.sorting}, set:function(a){this.Y.sorting!==a&&(eb(a,Y,Y,"sorting"),a===Zt||a===$t||a===au||bu)&&(this.Y.sorting=a,this.C())}},comparer:{configurable:!0,get:function(){return this.Y.comparer},set:function(a){this.Y.comparer!==a&&(A(a,"function",Y,"comparer"),this.Y.comparer=a,this.C())}},angle:{configurable:!0,get:function(){return this.Y.angle},set:function(a){this.Y.angle!==a&&(A(a,"number",Y,"angle"),0===a||90===a||180===a||270===a?(this.Y.angle=a,this.C()):v("TreeLayout.angle must be 0, 90, 180, or 270"))}}, alignment:{configurable:!0,get:function(){return this.Y.alignment},set:function(a){this.Y.alignment!==a&&(eb(a,Y,Y,"alignment"),this.Y.alignment=a,this.C())}},nodeIndent:{configurable:!0,get:function(){return this.Y.nodeIndent},set:function(a){this.Y.nodeIndent!==a&&(A(a,"number",Y,"nodeIndent"),0<=a&&(this.Y.nodeIndent=a,this.C()))}},nodeIndentPastParent:{configurable:!0,get:function(){return this.Y.nodeIndentPastParent},set:function(a){this.Y.nodeIndentPastParent!== a&&(A(a,"number",Y,"nodeIndentPastParent"),0<=a&&1>=a&&(this.Y.nodeIndentPastParent=a,this.C()))}},nodeSpacing:{configurable:!0,get:function(){return this.Y.nodeSpacing},set:function(a){this.Y.nodeSpacing!==a&&(A(a,"number",Y,"nodeSpacing"),this.Y.nodeSpacing=a,this.C())}},layerSpacing:{configurable:!0,get:function(){return this.Y.layerSpacing},set:function(a){this.Y.layerSpacing!==a&&(A(a,"number",Y,"layerSpacing"),this.Y.layerSpacing=a,this.C())}},layerSpacingParentOverlap:{configurable:!0, enumerable:!0,get:function(){return this.Y.layerSpacingParentOverlap},set:function(a){this.Y.layerSpacingParentOverlap!==a&&(A(a,"number",Y,"layerSpacingParentOverlap"),0<=a&&1>=a&&(this.Y.layerSpacingParentOverlap=a,this.C()))}},compaction:{configurable:!0,get:function(){return this.Y.compaction},set:function(a){this.Y.compaction!==a&&(eb(a,Y,Y,"compaction"),a===iu||a===ku)&&(this.Y.compaction=a,this.C())}},breadthLimit:{configurable:!0,get:function(){return this.Y.breadthLimit}, set:function(a){this.Y.breadthLimit!==a&&(A(a,"number",Y,"breadthLimit"),0<=a&&(this.Y.breadthLimit=a,this.C()))}},rowSpacing:{configurable:!0,get:function(){return this.Y.rowSpacing},set:function(a){this.Y.rowSpacing!==a&&(A(a,"number",Y,"rowSpacing"),this.Y.rowSpacing=a,this.C())}},rowIndent:{configurable:!0,get:function(){return this.Y.rowIndent},set:function(a){this.Y.rowIndent!==a&&(A(a,"number",Y,"rowIndent"),0<=a&&(this.Y.rowIndent=a,this.C()))}},commentSpacing:{configurable:!0, enumerable:!0,get:function(){return this.Y.commentSpacing},set:function(a){this.Y.commentSpacing!==a&&(A(a,"number",Y,"commentSpacing"),this.Y.commentSpacing=a,this.C())}},commentMargin:{configurable:!0,get:function(){return this.Y.commentMargin},set:function(a){this.Y.commentMargin!==a&&(A(a,"number",Y,"commentMargin"),this.Y.commentMargin=a,this.C())}},setsPortSpot:{configurable:!0,get:function(){return this.Y.setsPortSpot},set:function(a){this.Y.setsPortSpot!==a&&(A(a, "boolean",Y,"setsPortSpot"),this.Y.setsPortSpot=a,this.C())}},portSpot:{configurable:!0,get:function(){return this.Y.portSpot},set:function(a){w(a,Eb,Y,"portSpot");this.Y.portSpot.B(a)||(this.Y.portSpot=a,this.C())}},setsChildPortSpot:{configurable:!0,get:function(){return this.Y.setsChildPortSpot},set:function(a){this.Y.setsChildPortSpot!==a&&(A(a,"boolean",Y,"setsChildPortSpot"),this.Y.setsChildPortSpot=a,this.C())}},childPortSpot:{configurable:!0,get:function(){return this.Y.childPortSpot}, set:function(a){w(a,Eb,Y,"childPortSpot");this.Y.childPortSpot.B(a)||(this.Y.childPortSpot=a,this.C())}},alternateSorting:{configurable:!0,get:function(){return this.Z.sorting},set:function(a){this.Z.sorting!==a&&(eb(a,Y,Y,"alternateSorting"),a===Zt||a===$t||a===au||bu)&&(this.Z.sorting=a,this.C())}},alternateComparer:{configurable:!0,get:function(){return this.Z.comparer},set:function(a){this.Z.comparer!==a&&(A(a,"function",Y,"alternateComparer"),this.Z.comparer=a,this.C())}}, alternateAngle:{configurable:!0,get:function(){return this.Z.angle},set:function(a){this.Z.angle!==a&&(A(a,"number",Y,"alternateAngle"),0===a||90===a||180===a||270===a)&&(this.Z.angle=a,this.C())}},alternateAlignment:{configurable:!0,get:function(){return this.Z.alignment},set:function(a){this.Z.alignment!==a&&(eb(a,Y,Y,"alternateAlignment"),this.Z.alignment=a,this.C())}},alternateNodeIndent:{configurable:!0,get:function(){return this.Z.nodeIndent},set:function(a){this.Z.nodeIndent!== a&&(A(a,"number",Y,"alternateNodeIndent"),0<=a&&(this.Z.nodeIndent=a,this.C()))}},alternateNodeIndentPastParent:{configurable:!0,get:function(){return this.Z.nodeIndentPastParent},set:function(a){this.Z.nodeIndentPastParent!==a&&(A(a,"number",Y,"alternateNodeIndentPastParent"),0<=a&&1>=a&&(this.Z.nodeIndentPastParent=a,this.C()))}},alternateNodeSpacing:{configurable:!0,get:function(){return this.Z.nodeSpacing},set:function(a){this.Z.nodeSpacing!==a&&(A(a,"number",Y,"alternateNodeSpacing"), this.Z.nodeSpacing=a,this.C())}},alternateLayerSpacing:{configurable:!0,get:function(){return this.Z.layerSpacing},set:function(a){this.Z.layerSpacing!==a&&(A(a,"number",Y,"alternateLayerSpacing"),this.Z.layerSpacing=a,this.C())}},alternateLayerSpacingParentOverlap:{configurable:!0,get:function(){return this.Z.layerSpacingParentOverlap},set:function(a){this.Z.layerSpacingParentOverlap!==a&&(A(a,"number",Y,"alternateLayerSpacingParentOverlap"),0<=a&&1>=a&&(this.Z.layerSpacingParentOverlap= a,this.C()))}},alternateCompaction:{configurable:!0,get:function(){return this.Z.compaction},set:function(a){this.Z.compaction!==a&&(eb(a,Y,Y,"alternateCompaction"),a===iu||a===ku)&&(this.Z.compaction=a,this.C())}},alternateBreadthLimit:{configurable:!0,get:function(){return this.Z.breadthLimit},set:function(a){this.Z.breadthLimit!==a&&(A(a,"number",Y,"alternateBreadthLimit"),0<=a&&(this.Z.breadthLimit=a,this.C()))}},alternateRowSpacing:{configurable:!0,get:function(){return this.Z.rowSpacing}, set:function(a){this.Z.rowSpacing!==a&&(A(a,"number",Y,"alternateRowSpacing"),this.Z.rowSpacing=a,this.C())}},alternateRowIndent:{configurable:!0,get:function(){return this.Z.rowIndent},set:function(a){this.Z.rowIndent!==a&&(A(a,"number",Y,"alternateRowIndent"),0<=a&&(this.Z.rowIndent=a,this.C()))}},alternateCommentSpacing:{configurable:!0,get:function(){return this.Z.commentSpacing},set:function(a){this.Z.commentSpacing!==a&&(A(a,"number",Y,"alternateCommentSpacing"), this.Z.commentSpacing=a,this.C())}},alternateCommentMargin:{configurable:!0,get:function(){return this.Z.commentMargin},set:function(a){this.Z.commentMargin!==a&&(A(a,"number",Y,"alternateCommentMargin"),this.Z.commentMargin=a,this.C())}},alternateSetsPortSpot:{configurable:!0,get:function(){return this.Z.setsPortSpot},set:function(a){this.Z.setsPortSpot!==a&&(A(a,"boolean",Y,"alternateSetsPortSpot"),this.Z.setsPortSpot=a,this.C())}},alternatePortSpot:{configurable:!0, enumerable:!0,get:function(){return this.Z.portSpot},set:function(a){w(a,Eb,Y,"alternatePortSpot");this.Z.portSpot.B(a)||(this.Z.portSpot=a,this.C())}},alternateSetsChildPortSpot:{configurable:!0,get:function(){return this.Z.setsChildPortSpot},set:function(a){this.Z.setsChildPortSpot!==a&&(A(a,"boolean",Y,"alternateSetsChildPortSpot"),this.Z.setsChildPortSpot=a,this.C())}},alternateChildPortSpot:{configurable:!0,get:function(){return this.Z.childPortSpot},set:function(a){w(a, Eb,Y,"alternateChildPortSpot");this.Z.childPortSpot.B(a)||(this.Z.childPortSpot=a,this.C())}}}); var Ct=new E(Y,"PathDefault",-1),Dt=new E(Y,"PathDestination",0),Kt=new E(Y,"PathSource",1),Zt=new E(Y,"SortingForwards",10),$t=new E(Y,"SortingReverse",11),au=new E(Y,"SortingAscending",12),bu=new E(Y,"SortingDescending",13),Cu=new E(Y,"AlignmentCenterSubtrees",20),Du=new E(Y,"AlignmentCenterChildren",21),qu=new E(Y,"AlignmentStart",22),ru=new E(Y,"AlignmentEnd",23),du=new E(Y,"AlignmentBus",24),Ut=new E(Y,"AlignmentBusBranching",25),eu=new E(Y,"AlignmentTopLeftBus",26),fu=new E(Y,"AlignmentBottomRightBus", 27),iu=new E(Y,"CompactionNone",30),ku=new E(Y,"CompactionBlock",31),Et=new E(Y,"StyleLayered",40),Yt=new E(Y,"StyleLastParents",41),Xt=new E(Y,"StyleAlternating",42),Wt=new E(Y,"StyleRootOnly",43),Gt=new E(Y,"ArrangementVertical",50),Mu=new E(Y,"ArrangementHorizontal",51),Jt=new E(Y,"ArrangementFixedRoots",52),Ft=new E(Y,"LayerIndividual",60),St=new E(Y,"LayerSiblings",61),Rt=new E(Y,"LayerUniform",62);Y.className="TreeLayout";Y.PathDefault=Ct;Y.PathDestination=Dt;Y.PathSource=Kt; Y.SortingForwards=Zt;Y.SortingReverse=$t;Y.SortingAscending=au;Y.SortingDescending=bu;Y.AlignmentCenterSubtrees=Cu;Y.AlignmentCenterChildren=Du;Y.AlignmentStart=qu;Y.AlignmentEnd=ru;Y.AlignmentBus=du;Y.AlignmentBusBranching=Ut;Y.AlignmentTopLeftBus=eu;Y.AlignmentBottomRightBus=fu;Y.CompactionNone=iu;Y.CompactionBlock=ku;Y.StyleLayered=Et;Y.StyleLastParents=Yt;Y.StyleAlternating=Xt;Y.StyleRootOnly=Wt;Y.ArrangementVertical=Gt;Y.ArrangementHorizontal=Mu;Y.ArrangementFixedRoots=Jt;Y.LayerIndividual=Ft; Y.LayerSiblings=St;Y.LayerUniform=Rt;function Ht(a){fq.call(this,a)}ma(Ht,fq);Ht.prototype.createVertex=function(){return new It(this)};Ht.prototype.createEdge=function(){return new Ou(this)};Ht.className="TreeNetwork"; function It(a){tq.call(this,a);this.La=!1;this.Gc=null;this.F=[];this.Fc=this.bb=this.P=this.Ma=0;this.pd=null;this.W=new J(0,0);this.Ca=new Db(0,0);this.la=new J(0,0);this.$m=this.Zm=this.kB=!1;this.jr=this.Yq=null;this.gd=Zt;this.bd=Aq;this.Cb=0;this.Bb=Du;this.Ks=this.Js=0;this.Ls=20;this.De=50;this.zs=0;this.Lr=ku;this.Dr=0;this.Ys=25;this.Kr=this.Xs=10;this.Jr=20;this.kt=!0;this.Ts=ed;this.jt=!0;this.Gr=ed}ma(It,tq); It.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.gd=a.sorting,this.bd=a.comparer,this.Cb=a.angle,this.Bb=a.alignment,this.Js=a.nodeIndent,this.Ks=a.nodeIndentPastParent,this.Ls=a.nodeSpacing,this.De=a.layerSpacing,this.zs=a.layerSpacingParentOverlap,this.Lr=a.compaction,this.Dr=a.breadthLimit,this.Ys=a.rowSpacing,this.Xs=a.rowIndent,this.Kr=a.commentSpacing,this.Jr=a.commentMargin,this.kt=a.setsPortSpot,this.Ts=a.portSpot,this.jt=a.setsChildPortSpot,this.Gr=a.childPortSpot)}; na.Object.defineProperties(It.prototype,{initialized:{configurable:!0,get:function(){return this.La},set:function(a){this.La!==a&&(A(a,"boolean",It,"initialized"),this.La=a)}},parent:{configurable:!0,get:function(){return this.Gc},set:function(a){this.Gc!==a&&(G&&null!==a&&w(a,It,It,"parent"),this.Gc=a)}},children:{configurable:!0,get:function(){return this.F},set:function(a){if(this.F!==a){null===a||Array.isArray(a)||za(a,"Array",It,"children:value");if(null!== a)for(var b=a.length,c=0;c<b;c++){var d=a[c];G&&w(d,It,It,"children")}this.F=a}}},level:{configurable:!0,get:function(){return this.Ma},set:function(a){this.Ma!==a&&(A(a,"number",It,"level"),this.Ma=a)}},descendantCount:{configurable:!0,get:function(){return this.P},set:function(a){this.P!==a&&(A(a,"number",It,"descendantCount"),this.P=a)}},maxChildrenCount:{configurable:!0,get:function(){return this.bb},set:function(a){this.bb!==a&&(A(a,"number",It,"maxChildrenCount"), this.bb=a)}},maxGenerationCount:{configurable:!0,get:function(){return this.Fc},set:function(a){this.Fc!==a&&(A(a,"number",It,"maxGenerationCount"),this.Fc=a)}},comments:{configurable:!0,get:function(){return this.pd},set:function(a){if(this.pd!==a){null===a||Array.isArray(a)||za(a,"Array",It,"comments:value");if(null!==a)for(var b=a.length,c=0;c<b;c++){var d=a[c];G&&w(d,V,It,"comments")}this.pd=a}}},sorting:{configurable:!0,get:function(){return this.gd}, set:function(a){this.gd!==a&&(eb(a,Y,It,"sorting"),this.gd=a)}},comparer:{configurable:!0,get:function(){return this.bd},set:function(a){this.bd!==a&&(A(a,"function",It,"comparer"),this.bd=a)}},angle:{configurable:!0,get:function(){return this.Cb},set:function(a){this.Cb!==a&&(A(a,"number",It,"angle"),this.Cb=a)}},alignment:{configurable:!0,get:function(){return this.Bb},set:function(a){this.Bb!==a&&(eb(a,Y,It,"alignment"),this.Bb=a)}},nodeIndent:{configurable:!0, enumerable:!0,get:function(){return this.Js},set:function(a){this.Js!==a&&(A(a,"number",It,"nodeIndent"),this.Js=a)}},nodeIndentPastParent:{configurable:!0,get:function(){return this.Ks},set:function(a){this.Ks!==a&&(A(a,"number",It,"nodeIndentPastParent"),this.Ks=a)}},nodeSpacing:{configurable:!0,get:function(){return this.Ls},set:function(a){this.Ls!==a&&(A(a,"number",It,"nodeSpacing"),this.Ls=a)}},layerSpacing:{configurable:!0,get:function(){return this.De}, set:function(a){this.De!==a&&(A(a,"number",It,"layerSpacing"),this.De=a)}},layerSpacingParentOverlap:{configurable:!0,get:function(){return this.zs},set:function(a){this.zs!==a&&(A(a,"number",It,"layerSpacingParentOverlap"),this.zs=a)}},compaction:{configurable:!0,get:function(){return this.Lr},set:function(a){this.Lr!==a&&(eb(a,Y,It,"compaction"),this.Lr=a)}},breadthLimit:{configurable:!0,get:function(){return this.Dr},set:function(a){this.Dr!==a&&(A(a,"number", It,"breadthLimit"),this.Dr=a)}},rowSpacing:{configurable:!0,get:function(){return this.Ys},set:function(a){this.Ys!==a&&(A(a,"number",It,"rowSpacing"),this.Ys=a)}},rowIndent:{configurable:!0,get:function(){return this.Xs},set:function(a){this.Xs!==a&&(A(a,"number",It,"rowIndent"),this.Xs=a)}},commentSpacing:{configurable:!0,get:function(){return this.Kr},set:function(a){this.Kr!==a&&(A(a,"number",It,"commentSpacing"),this.Kr=a)}},commentMargin:{configurable:!0, enumerable:!0,get:function(){return this.Jr},set:function(a){this.Jr!==a&&(A(a,"number",It,"commentMargin"),this.Jr=a)}},setsPortSpot:{configurable:!0,get:function(){return this.kt},set:function(a){this.kt!==a&&(A(a,"boolean",It,"setsPortSpot"),this.kt=a)}},portSpot:{configurable:!0,get:function(){return this.Ts},set:function(a){w(a,Eb,It,"portSpot");this.Ts.B(a)||(this.Ts=a)}},setsChildPortSpot:{configurable:!0,get:function(){return this.jt},set:function(a){this.jt!== a&&(A(a,"boolean",It,"setsChildPortSpot"),this.jt=a)}},childPortSpot:{configurable:!0,get:function(){return this.Gr},set:function(a){w(a,Eb,It,"childPortSpot");this.Gr.B(a)||(this.Gr=a)}},childrenCount:{configurable:!0,get:function(){return this.children.length}},relativePosition:{configurable:!0,get:function(){return this.W},set:function(a){this.W.set(a)}},subtreeSize:{configurable:!0,get:function(){return this.Ca},set:function(a){this.Ca.set(a)}}, subtreeOffset:{configurable:!0,get:function(){return this.la},set:function(a){this.la.set(a)}}});It.className="TreeVertex";function Ou(a){uq.call(this,a);this.qv=new J(0,0)}ma(Ou,uq); Ou.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.qd){case Dt:c=this.fromVertex;d=this.toVertex;break;case Kt:c=this.toVertex;d=this.fromVertex;break;default:v("Unhandled path value "+b.qd.toString())}if(null!==c&&null!==d)if(b=this.qv,0!==b.x||0!==b.y||c.kB){d=c.bounds;var e=pu(c),f=su(c),g=c.rowSpacing;a.Ug();var h=a.curve===gg,k=a.isOrthogonal,l;a.ai();if(k||h){for(l=2;4<a.pointsCount;)a.Bw(2);var m=a.i(1);var n=a.i(2)}else{for(l= 1;3<a.pointsCount;)a.Bw(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===ru?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-tu(c))))):c.alignment===qu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+tu(c))))):e=c.Zm||c.$m&&1===c.maxGenerationCount?d.top-c.la.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===ru?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-tu(c))))):c.alignment===qu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+tu(c))))):e=c.Zm||c.$m&&1===c.maxGenerationCount?d.left-c.la.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===ru?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-tu(c))))):c.alignment===qu?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+tu(c))))):e=c.Zm||c.$m&&1===c.maxGenerationCount?d.top-c.la.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===ru?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-tu(c))))):c.alignment===qu?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+tu(c))))):e=c.Zm||c.$m&&1===c.maxGenerationCount? d.left-c.la.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))):v("Invalid angle "+e);a.Jf()}else b=d,G&&w(c,It,Ou,"adjustRouteForAngleChange:parent"),G&&w(b,It,Ou,"adjustRouteForAngleChange:child"),a=this.link,f=pu(c),f!==pu(b)&&(g=su(c),h=c.bounds,c=b.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.Ug(),c=a.curve===gg,b=a.isOrthogonal,d=cu(this.fromVertex.alignment),a.ai(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.O(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.O(5,a.i(5).x,c)):b?d?a.O(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.O(2,f,a.i(2).y),a.O(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.O(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.O(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.O(5,c,a.i(5).y)):b?d?a.O(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.O(2,a.i(2).x,f),a.O(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.O(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.O(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.O(5,a.i(5).x,c)):b?d?a.O(3,a.i(2).x,a.i(4).y): 6===a.pointsCount&&(a.O(2,f,a.i(2).y),a.O(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.O(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.O(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.O(5,c,a.i(5).y)):b?d?a.O(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.O(2,a.i(2).x,f),a.O(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.O(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)),a.Jf()))}}; na.Object.defineProperties(Ou.prototype,{fromVertex:{configurable:!0,get:function(){return this.dd},set:function(a){this.dd!==a&&(G&&null!==a&&w(a,It,Ou,"fromVertex"),this.dd=a)}},toVertex:{configurable:!0,get:function(){return this.kd},set:function(a){this.kd!==a&&(G&&null!==a&&w(a,It,Ou,"toVertex"),this.kd=a)}},relativePoint:{configurable:!0,get:function(){return this.qv},set:function(a){this.qv.set(a)}}});Ou.className="TreeEdge"; Ua.prototype.initializeStandardTools=function(){this.gb("Action",new Hg,this.mouseDownTools);this.gb("Relinking",new df,this.mouseDownTools);this.gb("LinkReshaping",new eg,this.mouseDownTools);this.gb("Rotating",new Fg,this.mouseDownTools);this.gb("Resizing",new lg,this.mouseDownTools);this.gb("Linking",new Yf,this.mouseMoveTools);this.gb("Dragging",new Xe,this.mouseMoveTools);this.gb("DragSelecting",new Kg,this.mouseMoveTools);this.gb("Panning",new Lg,this.mouseMoveTools);this.gb("ContextMenu",new Ng, this.mouseUpTools);this.gb("TextEditing",new Yg,this.mouseUpTools);this.gb("ClickCreating",new Ig,this.mouseUpTools);this.gb("ClickSelecting",new Gg,this.mouseUpTools)};An("Horizontal",new Em);An("Spot",new Gm);An("Table",new Lm);An("Viewbox",new Qm);An("TableRow",new Om);An("TableColumn",new Pm);An("Graduated",new $m);An("Grid",new Rm);yi.add("GraphLinksModel",Tq);yi.add("TreeModel",gr);lq(os,null);lq(Es,null); var Pu=ra.go,Qu={get licenseKey(){return R.licenseKey},set licenseKey(a){R.licenseKey=a},get version(){return R.version},Group:yf,EnumValue:E,List:H,Set:I,Map:zb,Point:J,Size:Db,Rect:M,Margin:gc,Spot:Eb,Geometry:N,PathFigure:le,PathSegment:me,InputEvent:oe,DiagramEvent:qe,ChangedEvent:re,Model:X,GraphLinksModel:Cr,TreeModel:Hr,Binding:Li,Transaction:we,UndoManager:Ee,CommandHandler:$k,Tool:Ge,DraggingTool:Xe,DraggingInfo:ef,DraggingOptions:Ye,LinkingBaseTool:Jf,LinkingTool:Yf,RelinkingTool:df,LinkReshapingTool:eg, ResizingTool:lg,RotatingTool:Fg,ClickSelectingTool:Gg,ActionTool:Hg,ClickCreatingTool:Ig,HTMLInfo:Qe,ContextMenuTool:Ng,DragSelectingTool:Kg,PanningTool:Lg,TextEditingTool:Yg,ToolManager:Ua,Animation:th,AnimationManager:ph,AnimationTrigger:ji,Layer:oi,Diagram:R,Palette:Tk,Overview:Wk,Brush:wl,GraphObject:O,Panel:W,RowColumnDefinition:Xj,Shape:Kf,TextBlock:Zg,Picture:fk,Part:U,Adornment:Le,Node:V,Link:T,Placeholder:ng,Layout:Ei,LayoutNetwork:fq,LayoutVertex:tq,LayoutEdge:uq,GridLayout:Vk,PanelLayout:Ul, CircularLayout:Ir,CircularNetwork:Zr,CircularVertex:ms,CircularEdge:ns,ForceDirectedLayout:os,ForceDirectedNetwork:ps,ForceDirectedVertex:zs,ForceDirectedEdge:Ds,LayeredDigraphLayout:Es,LayeredDigraphNetwork:Js,LayeredDigraphVertex:At,LayeredDigraphEdge:Bt,TreeLayout:Y,TreeNetwork:Ht,TreeVertex:It,TreeEdge:Ou};"object"===typeof Pu&&Pu.version&&v("WARNING: a `go` object on the root object is already defined. "+("Debug"in Pu?"debug ":"")+"version: "+Pu.version+", replaced with version: "+Qu.version); R.prototype.go=Qu;ra.go=Qu;("undefined"===typeof ra||"undefined"===typeof ra.module||"object"!==typeof ra.module.exports)&&ra.define&&"function"===typeof ra.define&&ra.define.amd&&ra.define(Qu);Qu.Debug=G;G.Ez(Qu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();
import"./index-c8e86d4d.js";import{C as ComponentBehavior}from"./component-4a168540.js";class DateInputBehaviour extends ComponentBehavior{static get params(){return{input:!0,localized:!0,component:"dateinput",props:["value","begin","end","mode","host","placeholder"]}}}export default DateInputBehaviour;
/*! * vue-i18n v9.0.0 * (c) 2021 kazuya kawaguchi * Released under the MIT License. */ import { getGlobalThis, format, makeSymbol, isPlainObject, isArray, isObject, isBoolean, isString, isRegExp, isFunction, isNumber, warn, isEmptyObject } from '@intlify/shared'; import { ref, getCurrentInstance, computed, watch, createVNode, Text, h, Fragment, inject, onMounted, onUnmounted, isRef } from 'vue'; import { createCompileError, createCoreContext, updateFallbackLocale, resolveValue, clearDateTimeFormat, clearNumberFormat, NOT_REOSLVED, parseTranslateArgs, translate, MISSING_RESOLVE_VALUE, parseDateTimeArgs, datetime, parseNumberArgs, number, DevToolsLabels, DevToolsPlaceholders, DevToolsTimelineColors, createEmitter } from '@intlify/core-base'; import { setupDevtoolsPlugin } from '@vue/devtools-api'; /** * Vue I18n Version * * @remarks * Semver format. Same format as the package.json `version` field. * * @VueI18nGeneral */ const VERSION = '9.0.0'; /** * This is only called in esm-bundler builds. * istanbul-ignore-next */ function initFeatureFlags() { let needWarn = false; if (typeof __VUE_I18N_FULL_INSTALL__ !== 'boolean') { needWarn = true; getGlobalThis().__VUE_I18N_FULL_INSTALL__ = true; } if (typeof __VUE_I18N_LEGACY_API__ !== 'boolean') { needWarn = true; getGlobalThis().__VUE_I18N_LEGACY_API__ = true; } if (typeof __INTLIFY_PROD_DEVTOOLS__ !== 'boolean') { needWarn = true; getGlobalThis().__INTLIFY_PROD_DEVTOOLS__ = false; } if ((process.env.NODE_ENV !== 'production') && needWarn) { console.warn(`You are running the esm-bundler build of vue-i18n. It is recommended to ` + `configure your bundler to explicitly replace feature flag globals ` + `with boolean literals to get proper tree-shaking in the final bundle.`); } } /** * This is only called development env * istanbul-ignore-next */ function initDev() { const target = getGlobalThis(); target.__INTLIFY__ = true; { console.info(`You are running a development build of vue-i18n.\n` + `Make sure to use the production build (*.prod.js) when deploying for production.`); } } const warnMessages = { [6 /* FALLBACK_TO_ROOT */]: `Fall back to {type} '{key}' with root locale.`, [7 /* NOT_SUPPORTED_PRESERVE */]: `Not supported 'preserve'.`, [8 /* NOT_SUPPORTED_FORMATTER */]: `Not supported 'formatter'.`, [9 /* NOT_SUPPORTED_PRESERVE_DIRECTIVE */]: `Not supported 'preserveDirectiveContent'.`, [10 /* NOT_SUPPORTED_GET_CHOICE_INDEX */]: `Not supported 'getChoiceIndex'.`, [11 /* COMPONENT_NAME_LEGACY_COMPATIBLE */]: `Component name legacy compatible: '{name}' -> 'i18n'`, [12 /* NOT_FOUND_PARENT_SCOPE */]: `Not found parent scope. use the global scope.` }; function getWarnMessage(code, ...args) { return format(warnMessages[code], ...args); } function createI18nError(code, ...args) { return createCompileError(code, null, (process.env.NODE_ENV !== 'production') ? { messages: errorMessages, args } : undefined); } const errorMessages = { [14 /* UNEXPECTED_RETURN_TYPE */]: 'Unexpected return type in composer', [15 /* INVALID_ARGUMENT */]: 'Invalid argument', [16 /* MUST_BE_CALL_SETUP_TOP */]: 'Must be called at the top of a `setup` function', [17 /* NOT_INSLALLED */]: 'Need to install with `app.use` function', [22 /* UNEXPECTED_ERROR */]: 'Unexpected error', [18 /* NOT_AVAILABLE_IN_LEGACY_MODE */]: 'Not available in legacy mode', [19 /* REQUIRED_VALUE */]: `Required in value: {0}`, [20 /* INVALID_VALUE */]: `Invalid value`, [21 /* CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN */]: `Cannot setup vue-devtools plugin` }; const TransrateVNodeSymbol = makeSymbol('__transrateVNode'); const DatetimePartsSymbol = makeSymbol('__datetimeParts'); const NumberPartsSymbol = makeSymbol('__numberParts'); const EnableEmitter = makeSymbol('__enableEmitter'); const DisableEmitter = makeSymbol('__disableEmitter'); const SetPluralRulesSymbol = makeSymbol('__setPluralRules'); let composerID = 0; function defineCoreMissingHandler(missing) { return ((ctx, locale, key, type) => { return missing(locale, key, getCurrentInstance() || undefined, type); }); } function getLocaleMessages(locale, options) { const { messages, __i18n } = options; // prettier-ignore const ret = isPlainObject(messages) ? messages : isArray(__i18n) ? {} : { [locale]: {} }; // merge locale messages of i18n custom block if (isArray(__i18n)) { __i18n.forEach(({ locale, resource }) => { if (locale) { ret[locale] = ret[locale] || {}; deepCopy(resource, ret[locale]); } else { deepCopy(resource, ret); } }); } return ret; } const hasOwnProperty = Object.prototype.hasOwnProperty; // eslint-disable-next-line @typescript-eslint/no-explicit-any function hasOwn(obj, key) { return hasOwnProperty.call(obj, key); } const isNotObjectOrIsArray = (val) => !isObject(val) || isArray(val); // eslint-disable-next-line @typescript-eslint/no-explicit-any function deepCopy(src, des) { // src and des should both be objects, and non of then can be a array if (isNotObjectOrIsArray(src) || isNotObjectOrIsArray(des)) { throw createI18nError(20 /* INVALID_VALUE */); } for (const key in src) { if (hasOwn(src, key)) { if (isNotObjectOrIsArray(src[key]) || isNotObjectOrIsArray(des[key])) { // replace with src[key] when: // src[key] or des[key] is not a object, or // src[key] or des[key] is a array des[key] = src[key]; } else { // src[key] and des[key] are both object, merge them deepCopy(src[key], des[key]); } } } } /** * Create composer interface factory * * @internal */ function createComposer(options = {}) { const { __root } = options; const _isGlobal = __root === undefined; let _inheritLocale = isBoolean(options.inheritLocale) ? options.inheritLocale : true; const _locale = ref( // prettier-ignore __root && _inheritLocale ? __root.locale.value : isString(options.locale) ? options.locale : 'en-US'); const _fallbackLocale = ref( // prettier-ignore __root && _inheritLocale ? __root.fallbackLocale.value : isString(options.fallbackLocale) || isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : _locale.value); const _messages = ref(getLocaleMessages(_locale.value, options)); const _datetimeFormats = ref(isPlainObject(options.datetimeFormats) ? options.datetimeFormats : { [_locale.value]: {} }); const _numberFormats = ref(isPlainObject(options.numberFormats) ? options.numberFormats : { [_locale.value]: {} }); // warning suppress options // prettier-ignore let _missingWarn = __root ? __root.missingWarn : isBoolean(options.missingWarn) || isRegExp(options.missingWarn) ? options.missingWarn : true; // prettier-ignore let _fallbackWarn = __root ? __root.fallbackWarn : isBoolean(options.fallbackWarn) || isRegExp(options.fallbackWarn) ? options.fallbackWarn : true; // prettier-ignore let _fallbackRoot = __root ? __root.fallbackRoot : isBoolean(options.fallbackRoot) ? options.fallbackRoot : true; // configure fall back to root let _fallbackFormat = !!options.fallbackFormat; // runtime missing let _missing = isFunction(options.missing) ? options.missing : null; let _runtimeMissing = isFunction(options.missing) ? defineCoreMissingHandler(options.missing) : null; // postTranslation handler let _postTranslation = isFunction(options.postTranslation) ? options.postTranslation : null; let _warnHtmlMessage = isBoolean(options.warnHtmlMessage) ? options.warnHtmlMessage : true; let _escapeParameter = !!options.escapeParameter; // custom linked modifiers // prettier-ignore const _modifiers = __root ? __root.modifiers : isPlainObject(options.modifiers) ? options.modifiers : {}; // pluralRules let _pluralRules = options.pluralRules || (__root && __root.pluralRules); // runtime context // eslint-disable-next-line prefer-const let _context; function getCoreContext() { return createCoreContext({ locale: _locale.value, fallbackLocale: _fallbackLocale.value, messages: _messages.value, datetimeFormats: _datetimeFormats.value, numberFormats: _numberFormats.value, modifiers: _modifiers, pluralRules: _pluralRules, missing: _runtimeMissing === null ? undefined : _runtimeMissing, missingWarn: _missingWarn, fallbackWarn: _fallbackWarn, fallbackFormat: _fallbackFormat, unresolving: true, postTranslation: _postTranslation === null ? undefined : _postTranslation, warnHtmlMessage: _warnHtmlMessage, escapeParameter: _escapeParameter, __datetimeFormatters: isPlainObject(_context) ? _context.__datetimeFormatters : undefined, __numberFormatters: isPlainObject(_context) ? _context.__numberFormatters : undefined, __emitter: isPlainObject(_context) ? _context.__emitter : undefined }); } _context = getCoreContext(); updateFallbackLocale(_context, _locale.value, _fallbackLocale.value); // locale const locale = computed({ get: () => _locale.value, set: val => { _locale.value = val; _context.locale = _locale.value; } }); // fallbackLocale const fallbackLocale = computed({ get: () => _fallbackLocale.value, set: val => { _fallbackLocale.value = val; _context.fallbackLocale = _fallbackLocale.value; updateFallbackLocale(_context, _locale.value, val); } }); // messages const messages = computed(() => _messages.value); // datetimeFormats const datetimeFormats = computed(() => _datetimeFormats.value); // numberFormats const numberFormats = computed(() => _numberFormats.value); // getPostTranslationHandler function getPostTranslationHandler() { return isFunction(_postTranslation) ? _postTranslation : null; } // setPostTranslationHandler function setPostTranslationHandler(handler) { _postTranslation = handler; _context.postTranslation = handler; } // getMissingHandler function getMissingHandler() { return _missing; } // setMissingHandler function setMissingHandler(handler) { if (handler !== null) { _runtimeMissing = defineCoreMissingHandler(handler); } _missing = handler; _context.missing = _runtimeMissing; } function wrapWithDeps(fn, argumentParser, warnType, fallbackSuccess, fallbackFail, successCondition) { const context = getCoreContext(); const ret = fn(context); // track reactive dependency, see the getRuntimeContext if (isNumber(ret) && ret === NOT_REOSLVED) { const key = argumentParser(); if ((process.env.NODE_ENV !== 'production') && __root) { if (!_fallbackRoot) { warn(getWarnMessage(6 /* FALLBACK_TO_ROOT */, { key, type: warnType })); } // for vue-devtools timeline event if ((process.env.NODE_ENV !== 'production')) { const { __emitter: emitter } = context; if (emitter) { emitter.emit("fallback" /* FALBACK */, { type: warnType, key, to: 'global', groupId: `${warnType}:${key}` }); } } } return __root && _fallbackRoot ? fallbackSuccess(__root) : fallbackFail(key); } else if (successCondition(ret)) { return ret; } else { /* istanbul ignore next */ throw createI18nError(14 /* UNEXPECTED_RETURN_TYPE */); } } // t function t(...args) { return wrapWithDeps(context => translate(context, ...args), () => parseTranslateArgs(...args)[0], 'translate', root => root.t(...args), key => key, val => isString(val)); } // d function d(...args) { return wrapWithDeps(context => datetime(context, ...args), () => parseDateTimeArgs(...args)[0], 'datetime format', root => root.d(...args), () => MISSING_RESOLVE_VALUE, val => isString(val)); } // n function n(...args) { return wrapWithDeps(context => number(context, ...args), () => parseNumberArgs(...args)[0], 'number format', root => root.n(...args), () => MISSING_RESOLVE_VALUE, val => isString(val)); } // for custom processor function normalize(values) { return values.map(val => isString(val) ? createVNode(Text, null, val, 0) : val); } const interpolate = (val) => val; const processor = { normalize, interpolate, type: 'vnode' }; // __transrateVNode, using for `i18n-t` component function __transrateVNode(...args) { return wrapWithDeps(context => { let ret; const _context = context; try { _context.processor = processor; ret = translate(_context, ...args); } finally { _context.processor = null; } return ret; }, () => parseTranslateArgs(...args)[0], 'translate', // eslint-disable-next-line @typescript-eslint/no-explicit-any root => root[TransrateVNodeSymbol](...args), key => [createVNode(Text, null, key, 0)], val => isArray(val)); } // __numberParts, using for `i18n-n` component function __numberParts(...args) { return wrapWithDeps(context => number(context, ...args), () => parseNumberArgs(...args)[0], 'number format', // eslint-disable-next-line @typescript-eslint/no-explicit-any root => root[NumberPartsSymbol](...args), () => [], val => isString(val) || isArray(val)); } // __datetimeParts, using for `i18n-d` component function __datetimeParts(...args) { return wrapWithDeps(context => datetime(context, ...args), () => parseDateTimeArgs(...args)[0], 'datetime format', // eslint-disable-next-line @typescript-eslint/no-explicit-any root => root[DatetimePartsSymbol](...args), () => [], val => isString(val) || isArray(val)); } function __setPluralRules(rules) { _pluralRules = rules; _context.pluralRules = _pluralRules; } // te function te(key, locale) { const targetLocale = isString(locale) ? locale : _locale.value; const message = getLocaleMessage(targetLocale); return resolveValue(message, key) !== null; } // tm function tm(key) { const messages = _messages.value[_locale.value] || {}; const target = resolveValue(messages, key); // prettier-ignore return target != null ? target : __root ? __root.tm(key) || {} : {}; } // getLocaleMessage function getLocaleMessage(locale) { return (_messages.value[locale] || {}); } // setLocaleMessage function setLocaleMessage(locale, message) { _messages.value[locale] = message; _context.messages = _messages.value; } // mergeLocaleMessage function mergeLocaleMessage(locale, message) { _messages.value[locale] = _messages.value[locale] || {}; deepCopy(message, _messages.value[locale]); _context.messages = _messages.value; } // getDateTimeFormat function getDateTimeFormat(locale) { return _datetimeFormats.value[locale] || {}; } // setDateTimeFormat function setDateTimeFormat(locale, format) { _datetimeFormats.value[locale] = format; _context.datetimeFormats = _datetimeFormats.value; clearDateTimeFormat(_context, locale, format); } // mergeDateTimeFormat function mergeDateTimeFormat(locale, format) { _datetimeFormats.value[locale] = Object.assign(_datetimeFormats.value[locale] || {}, format); _context.datetimeFormats = _datetimeFormats.value; clearDateTimeFormat(_context, locale, format); } // getNumberFormat function getNumberFormat(locale) { return _numberFormats.value[locale] || {}; } // setNumberFormat function setNumberFormat(locale, format) { _numberFormats.value[locale] = format; _context.numberFormats = _numberFormats.value; clearNumberFormat(_context, locale, format); } // mergeNumberFormat function mergeNumberFormat(locale, format) { _numberFormats.value[locale] = Object.assign(_numberFormats.value[locale] || {}, format); _context.numberFormats = _numberFormats.value; clearNumberFormat(_context, locale, format); } // for debug composerID++; // watch root locale & fallbackLocale if (__root) { watch(__root.locale, (val) => { if (_inheritLocale) { _locale.value = val; _context.locale = val; updateFallbackLocale(_context, _locale.value, _fallbackLocale.value); } }); watch(__root.fallbackLocale, (val) => { if (_inheritLocale) { _fallbackLocale.value = val; _context.fallbackLocale = val; updateFallbackLocale(_context, _locale.value, _fallbackLocale.value); } }); } // export composition API! const composer = { id: composerID, locale, fallbackLocale, get inheritLocale() { return _inheritLocale; }, set inheritLocale(val) { _inheritLocale = val; if (val && __root) { _locale.value = __root.locale.value; _fallbackLocale.value = __root.fallbackLocale.value; updateFallbackLocale(_context, _locale.value, _fallbackLocale.value); } }, get availableLocales() { return Object.keys(_messages.value).sort(); }, messages, datetimeFormats, numberFormats, get modifiers() { return _modifiers; }, get pluralRules() { return _pluralRules || {}; }, get isGlobal() { return _isGlobal; }, get missingWarn() { return _missingWarn; }, set missingWarn(val) { _missingWarn = val; _context.missingWarn = _missingWarn; }, get fallbackWarn() { return _fallbackWarn; }, set fallbackWarn(val) { _fallbackWarn = val; _context.fallbackWarn = _fallbackWarn; }, get fallbackRoot() { return _fallbackRoot; }, set fallbackRoot(val) { _fallbackRoot = val; }, get fallbackFormat() { return _fallbackFormat; }, set fallbackFormat(val) { _fallbackFormat = val; _context.fallbackFormat = _fallbackFormat; }, get warnHtmlMessage() { return _warnHtmlMessage; }, set warnHtmlMessage(val) { _warnHtmlMessage = val; _context.warnHtmlMessage = val; }, get escapeParameter() { return _escapeParameter; }, set escapeParameter(val) { _escapeParameter = val; _context.escapeParameter = val; }, t, d, n, te, tm, getLocaleMessage, setLocaleMessage, mergeLocaleMessage, getDateTimeFormat, setDateTimeFormat, mergeDateTimeFormat, getNumberFormat, setNumberFormat, mergeNumberFormat, getPostTranslationHandler, setPostTranslationHandler, getMissingHandler, setMissingHandler, [TransrateVNodeSymbol]: __transrateVNode, [NumberPartsSymbol]: __numberParts, [DatetimePartsSymbol]: __datetimeParts, [SetPluralRulesSymbol]: __setPluralRules }; // for vue-devtools timeline event if ((process.env.NODE_ENV !== 'production')) { composer[EnableEmitter] = (emitter) => { _context.__emitter = emitter; }; composer[DisableEmitter] = () => { _context.__emitter = undefined; }; } return composer; } /** * Convert to I18n Composer Options from VueI18n Options * * @internal */ function convertComposerOptions(options) { const locale = isString(options.locale) ? options.locale : 'en-US'; const fallbackLocale = isString(options.fallbackLocale) || isArray(options.fallbackLocale) || isPlainObject(options.fallbackLocale) || options.fallbackLocale === false ? options.fallbackLocale : locale; const missing = isFunction(options.missing) ? options.missing : undefined; const missingWarn = isBoolean(options.silentTranslationWarn) || isRegExp(options.silentTranslationWarn) ? !options.silentTranslationWarn : true; const fallbackWarn = isBoolean(options.silentFallbackWarn) || isRegExp(options.silentFallbackWarn) ? !options.silentFallbackWarn : true; const fallbackRoot = isBoolean(options.fallbackRoot) ? options.fallbackRoot : true; const fallbackFormat = !!options.formatFallbackMessages; const modifiers = isPlainObject(options.modifiers) ? options.modifiers : {}; const pluralizationRules = options.pluralizationRules; const postTranslation = isFunction(options.postTranslation) ? options.postTranslation : undefined; const warnHtmlMessage = isString(options.warnHtmlInMessage) ? options.warnHtmlInMessage !== 'off' : true; const escapeParameter = !!options.escapeParameterHtml; const inheritLocale = isBoolean(options.sync) ? options.sync : true; if ((process.env.NODE_ENV !== 'production') && options.formatter) { warn(getWarnMessage(8 /* NOT_SUPPORTED_FORMATTER */)); } if ((process.env.NODE_ENV !== 'production') && options.preserveDirectiveContent) { warn(getWarnMessage(9 /* NOT_SUPPORTED_PRESERVE_DIRECTIVE */)); } let messages = options.messages; if (isPlainObject(options.sharedMessages)) { const sharedMessages = options.sharedMessages; const locales = Object.keys(sharedMessages); messages = locales.reduce((messages, locale) => { const message = messages[locale] || (messages[locale] = {}); Object.assign(message, sharedMessages[locale]); return messages; }, (messages || {})); } const { __i18n, __root } = options; const datetimeFormats = options.datetimeFormats; const numberFormats = options.numberFormats; return { locale, fallbackLocale, messages, datetimeFormats, numberFormats, missing, missingWarn, fallbackWarn, fallbackRoot, fallbackFormat, modifiers, pluralRules: pluralizationRules, postTranslation, warnHtmlMessage, escapeParameter, inheritLocale, __i18n, __root }; } /** * create VueI18n interface factory * * @internal */ function createVueI18n(options = {}) { const composer = createComposer(convertComposerOptions(options)); // defines VueI18n const vueI18n = { // id id: composer.id, // locale get locale() { return composer.locale.value; }, set locale(val) { composer.locale.value = val; }, // fallbackLocale get fallbackLocale() { return composer.fallbackLocale.value; }, set fallbackLocale(val) { composer.fallbackLocale.value = val; }, // messages get messages() { return composer.messages.value; }, // datetimeFormats get datetimeFormats() { return composer.datetimeFormats.value; }, // numberFormats get numberFormats() { return composer.numberFormats.value; }, // availableLocales get availableLocales() { return composer.availableLocales; }, // formatter get formatter() { (process.env.NODE_ENV !== 'production') && warn(getWarnMessage(8 /* NOT_SUPPORTED_FORMATTER */)); // dummy return { interpolate() { return []; } }; }, set formatter(val) { (process.env.NODE_ENV !== 'production') && warn(getWarnMessage(8 /* NOT_SUPPORTED_FORMATTER */)); }, // missing get missing() { return composer.getMissingHandler(); }, set missing(handler) { composer.setMissingHandler(handler); }, // silentTranslationWarn get silentTranslationWarn() { return isBoolean(composer.missingWarn) ? !composer.missingWarn : composer.missingWarn; }, set silentTranslationWarn(val) { composer.missingWarn = isBoolean(val) ? !val : val; }, // silentFallbackWarn get silentFallbackWarn() { return isBoolean(composer.fallbackWarn) ? !composer.fallbackWarn : composer.fallbackWarn; }, set silentFallbackWarn(val) { composer.fallbackWarn = isBoolean(val) ? !val : val; }, // modifiers get modifiers() { return composer.modifiers; }, // formatFallbackMessages get formatFallbackMessages() { return composer.fallbackFormat; }, set formatFallbackMessages(val) { composer.fallbackFormat = val; }, // postTranslation get postTranslation() { return composer.getPostTranslationHandler(); }, set postTranslation(handler) { composer.setPostTranslationHandler(handler); }, // sync get sync() { return composer.inheritLocale; }, set sync(val) { composer.inheritLocale = val; }, // warnInHtmlMessage get warnHtmlInMessage() { return composer.warnHtmlMessage ? 'warn' : 'off'; }, set warnHtmlInMessage(val) { composer.warnHtmlMessage = val !== 'off'; }, // escapeParameterHtml get escapeParameterHtml() { return composer.escapeParameter; }, set escapeParameterHtml(val) { composer.escapeParameter = val; }, // preserveDirectiveContent get preserveDirectiveContent() { (process.env.NODE_ENV !== 'production') && warn(getWarnMessage(9 /* NOT_SUPPORTED_PRESERVE_DIRECTIVE */)); return true; }, set preserveDirectiveContent(val) { (process.env.NODE_ENV !== 'production') && warn(getWarnMessage(9 /* NOT_SUPPORTED_PRESERVE_DIRECTIVE */)); }, // pluralizationRules get pluralizationRules() { return composer.pluralRules || {}; }, // for internal __composer: composer, // t t(...args) { const [arg1, arg2, arg3] = args; const options = {}; let list = null; let named = null; if (!isString(arg1)) { throw createI18nError(15 /* INVALID_ARGUMENT */); } const key = arg1; if (isString(arg2)) { options.locale = arg2; } else if (isArray(arg2)) { list = arg2; } else if (isPlainObject(arg2)) { named = arg2; } if (isArray(arg3)) { list = arg3; } else if (isPlainObject(arg3)) { named = arg3; } return composer.t(key, list || named || {}, options); }, // tc tc(...args) { const [arg1, arg2, arg3] = args; const options = { plural: 1 }; let list = null; let named = null; if (!isString(arg1)) { throw createI18nError(15 /* INVALID_ARGUMENT */); } const key = arg1; if (isString(arg2)) { options.locale = arg2; } else if (isNumber(arg2)) { options.plural = arg2; } else if (isArray(arg2)) { list = arg2; } else if (isPlainObject(arg2)) { named = arg2; } if (isString(arg3)) { options.locale = arg3; } else if (isArray(arg3)) { list = arg3; } else if (isPlainObject(arg3)) { named = arg3; } return composer.t(key, list || named || {}, options); }, // te te(key, locale) { return composer.te(key, locale); }, // tm tm(key) { return composer.tm(key); }, // getLocaleMessage getLocaleMessage(locale) { return composer.getLocaleMessage(locale); }, // setLocaleMessage setLocaleMessage(locale, message) { composer.setLocaleMessage(locale, message); }, // mergeLocaleMessage mergeLocaleMessage(locale, message) { composer.mergeLocaleMessage(locale, message); }, // d d(...args) { return composer.d(...args); }, // getDateTimeFormat getDateTimeFormat(locale) { return composer.getDateTimeFormat(locale); }, // setDateTimeFormat setDateTimeFormat(locale, format) { composer.setDateTimeFormat(locale, format); }, // mergeDateTimeFormat mergeDateTimeFormat(locale, format) { composer.mergeDateTimeFormat(locale, format); }, // n n(...args) { return composer.n(...args); }, // getNumberFormat getNumberFormat(locale) { return composer.getNumberFormat(locale); }, // setNumberFormat setNumberFormat(locale, format) { composer.setNumberFormat(locale, format); }, // mergeNumberFormat mergeNumberFormat(locale, format) { composer.mergeNumberFormat(locale, format); }, // getChoiceIndex // eslint-disable-next-line @typescript-eslint/no-unused-vars getChoiceIndex(choice, choicesLength) { (process.env.NODE_ENV !== 'production') && warn(getWarnMessage(10 /* NOT_SUPPORTED_GET_CHOICE_INDEX */)); return -1; }, // for internal __onComponentInstanceCreated(target) { const { componentInstanceCreatedListener } = options; if (componentInstanceCreatedListener) { componentInstanceCreatedListener(target, vueI18n); } } }; // for vue-devtools timeline event if ((process.env.NODE_ENV !== 'production')) { vueI18n.__enableEmitter = (emitter) => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const __composer = composer; __composer[EnableEmitter] && __composer[EnableEmitter](emitter); }; vueI18n.__disableEmitter = () => { // eslint-disable-next-line @typescript-eslint/no-explicit-any const __composer = composer; __composer[DisableEmitter] && __composer[DisableEmitter](); }; } return vueI18n; } const baseFormatProps = { tag: { type: [String, Object] }, locale: { type: String }, scope: { type: String, validator: (val) => val === 'parent' || val === 'global', default: 'parent' } }; /** * Translation Component * * @remarks * See the following items for property about details * * @VueI18nSee [TranslationProps](component#translationprops) * @VueI18nSee [BaseFormatProps](component#baseformatprops) * @VueI18nSee [Component Interpolation](../../guide/advanced/component) * * @example * ```html * <div id="app"> * <!-- ... --> * <i18n path="term" tag="label" for="tos"> * <a :href="url" target="_blank">{{ $t('tos') }}</a> * </i18n> * <!-- ... --> * </div> * ``` * ```js * import { createApp } from 'vue' * import { createI18n } from 'vue-i18n' * * const messages = { * en: { * tos: 'Term of Service', * term: 'I accept xxx {0}.' * }, * ja: { * tos: '利用規約', * term: '私は xxx の{0}に同意します。' * } * } * * const i18n = createI18n({ * locale: 'en', * messages * }) * * const app = createApp({ * data: { * url: '/term' * } * }).use(i18n).mount('#app') * ``` * * @VueI18nComponent */ const Translation = { /* eslint-disable */ name: 'i18n-t', props: { ...baseFormatProps, keypath: { type: String, required: true }, plural: { type: [Number, String], // eslint-disable-next-line @typescript-eslint/no-explicit-any validator: (val) => isNumber(val) || !isNaN(val) } }, /* eslint-enable */ setup(props, context) { const { slots, attrs } = context; const i18n = useI18n({ useScope: props.scope }); const keys = Object.keys(slots).filter(key => key !== '_'); return () => { const options = {}; if (props.locale) { options.locale = props.locale; } if (props.plural !== undefined) { options.plural = isString(props.plural) ? +props.plural : props.plural; } const arg = getInterpolateArg(context, keys); // eslint-disable-next-line @typescript-eslint/no-explicit-any const children = i18n[TransrateVNodeSymbol](props.keypath, arg, options); // prettier-ignore return isString(props.tag) ? h(props.tag, { ...attrs }, children) : isObject(props.tag) ? h(props.tag, { ...attrs }, children) : h(Fragment, { ...attrs }, children); }; } }; function getInterpolateArg({ slots }, keys) { if (keys.length === 1 && keys[0] === 'default') { // default slot only return slots.default ? slots.default() : []; } else { // named slots return keys.reduce((arg, key) => { const slot = slots[key]; if (slot) { arg[key] = slot(); } return arg; }, {}); } } function renderFormatter(props, context, slotKeys, partFormatter) { const { slots, attrs } = context; return () => { const options = { part: true }; let overrides = {}; if (props.locale) { options.locale = props.locale; } if (isString(props.format)) { options.key = props.format; } else if (isObject(props.format)) { // eslint-disable-next-line @typescript-eslint/no-explicit-any if (isString(props.format.key)) { // eslint-disable-next-line @typescript-eslint/no-explicit-any options.key = props.format.key; } // Filter out number format options only overrides = Object.keys(props.format).reduce((options, prop) => { return slotKeys.includes(prop) ? Object.assign({}, options, { [prop]: props.format[prop] }) // eslint-disable-line @typescript-eslint/no-explicit-any : options; }, {}); } const parts = partFormatter(...[props.value, options, overrides]); let children = [options.key]; if (isArray(parts)) { children = parts.map((part, index) => { const slot = slots[part.type]; return slot ? slot({ [part.type]: part.value, index, parts }) : [part.value]; }); } else if (isString(parts)) { children = [parts]; } // prettier-ignore return isString(props.tag) ? h(props.tag, { ...attrs }, children) : isObject(props.tag) ? h(props.tag, { ...attrs }, children) : h(Fragment, { ...attrs }, children); }; } const NUMBER_FORMAT_KEYS = [ 'localeMatcher', 'style', 'unit', 'unitDisplay', 'currency', 'currencyDisplay', 'useGrouping', 'numberingSystem', 'minimumIntegerDigits', 'minimumFractionDigits', 'maximumFractionDigits', 'minimumSignificantDigits', 'maximumSignificantDigits', 'notation', 'formatMatcher' ]; /** * Number Format Component * * @remarks * See the following items for property about details * * @VueI18nSee [FormattableProps](component#formattableprops) * @VueI18nSee [BaseFormatProps](component#baseformatprops) * @VueI18nSee [Custom Formatting](../../guide/essentials/number#custom-formatting) * * @VueI18nDanger * Not supported IE, due to no support `Intl.NumberFormat#formatToParts` in [IE](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/NumberFormat/formatToParts) * * If you want to use it, you need to use [polyfill](https://github.com/formatjs/formatjs/tree/main/packages/intl-numberformat) * * @VueI18nComponent */ const NumberFormat = { /* eslint-disable */ name: 'i18n-n', props: { ...baseFormatProps, value: { type: Number, required: true }, format: { type: [String, Object] } }, /* eslint-enable */ setup(props, context) { const i18n = useI18n({ useScope: 'parent' }); return renderFormatter(props, context, NUMBER_FORMAT_KEYS, (...args) => // eslint-disable-next-line @typescript-eslint/no-explicit-any i18n[NumberPartsSymbol](...args)); } }; const DATETIME_FORMAT_KEYS = [ 'dateStyle', 'timeStyle', 'fractionalSecondDigits', 'calendar', 'dayPeriod', 'numberingSystem', 'localeMatcher', 'timeZone', 'hour12', 'hourCycle', 'formatMatcher', 'weekday', 'era', 'year', 'month', 'day', 'hour', 'minute', 'second', 'timeZoneName' ]; /** * Datetime Format Component * * @remarks * See the following items for property about details * * @VueI18nSee [FormattableProps](component#formattableprops) * @VueI18nSee [BaseFormatProps](component#baseformatprops) * @VueI18nSee [Custom Formatting](../../guide/essentials/datetime#custom-formatting) * * @VueI18nDanger * Not supported IE, due to no support `Intl.DateTimeFormat#formatToParts` in [IE](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Intl/DateTimeFormat/formatToParts) * * If you want to use it, you need to use [polyfill](https://github.com/formatjs/formatjs/tree/main/packages/intl-datetimeformat) * * @VueI18nComponent */ const DatetimeFormat = { /* eslint-disable */ name: 'i18n-d', props: { ...baseFormatProps, value: { type: [Number, Date], required: true }, format: { type: [String, Object] } }, /* eslint-enable */ setup(props, context) { const i18n = useI18n({ useScope: 'parent' }); return renderFormatter(props, context, DATETIME_FORMAT_KEYS, (...args) => // eslint-disable-next-line @typescript-eslint/no-explicit-any i18n[DatetimePartsSymbol](...args)); } }; function getComposer(i18n, instance) { const i18nInternal = i18n; if (i18n.mode === 'composition') { return (i18nInternal.__getInstance(instance) || i18n.global); } else { const vueI18n = i18nInternal.__getInstance(instance); return vueI18n != null ? vueI18n.__composer : i18n.global.__composer; } } function vTDirective(i18n) { const bind = (el, { instance, value, modifiers }) => { /* istanbul ignore if */ if (!instance || !instance.$) { throw createI18nError(22 /* UNEXPECTED_ERROR */); } const composer = getComposer(i18n, instance.$); if ((process.env.NODE_ENV !== 'production') && modifiers.preserve) { warn(getWarnMessage(7 /* NOT_SUPPORTED_PRESERVE */)); } const parsedValue = parseValue(value); el.textContent = composer.t(...makeParams(parsedValue)); }; return { beforeMount: bind, beforeUpdate: bind }; } function parseValue(value) { if (isString(value)) { return { path: value }; } else if (isPlainObject(value)) { if (!('path' in value)) { throw createI18nError(19 /* REQUIRED_VALUE */, 'path'); } return value; } else { throw createI18nError(20 /* INVALID_VALUE */); } } function makeParams(value) { const { path, locale, args, choice, plural } = value; const options = {}; const named = args || {}; if (isString(locale)) { options.locale = locale; } if (isNumber(choice)) { options.plural = choice; } if (isNumber(plural)) { options.plural = plural; } return [path, named, options]; } function apply(app, i18n, ...options) { const pluginOptions = isPlainObject(options[0]) ? options[0] : {}; const useI18nComponentName = !!pluginOptions.useI18nComponentName; const globalInstall = isBoolean(pluginOptions.globalInstall) ? pluginOptions.globalInstall : true; if ((process.env.NODE_ENV !== 'production') && globalInstall && useI18nComponentName) { warn(getWarnMessage(11 /* COMPONENT_NAME_LEGACY_COMPATIBLE */, { name: Translation.name })); } if (globalInstall) { // install components app.component(!useI18nComponentName ? Translation.name : 'i18n', Translation); app.component(NumberFormat.name, NumberFormat); app.component(DatetimeFormat.name, DatetimeFormat); } // install directive app.directive('t', vTDirective(i18n)); } let devtoolsApi; async function enableDevTools(app, i18n) { return new Promise((resolve, reject) => { try { setupDevtoolsPlugin({ id: "vue-devtools-plugin-vue-i18n" /* PLUGIN */, label: DevToolsLabels["vue-devtools-plugin-vue-i18n" /* PLUGIN */], app }, api => { devtoolsApi = api; api.on.walkComponentTree((payload, ctx) => { updateComponentTreeDataTags(ctx.currentAppRecord, payload.componentTreeData, i18n); }); api.on.inspectComponent(payload => { const componentInstance = payload.componentInstance; if (componentInstance.vnode.el.__INTLIFY__ && payload.instanceData) { if (i18n.mode === 'legacy') { // ignore global scope on legacy mode if (componentInstance.vnode.el.__INTLIFY__ !== i18n.global.__composer) { inspectComposer(payload.instanceData, componentInstance.vnode.el.__INTLIFY__); } } else { inspectComposer(payload.instanceData, componentInstance.vnode.el.__INTLIFY__); } } }); api.addInspector({ id: "vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */, label: DevToolsLabels["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */], icon: 'language', treeFilterPlaceholder: DevToolsPlaceholders["vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */] }); api.on.getInspectorTree(payload => { if (payload.app === app && payload.inspectorId === "vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */) { registerScope(payload, i18n); } }); api.on.getInspectorState(payload => { if (payload.app === app && payload.inspectorId === "vue-i18n-resource-inspector" /* CUSTOM_INSPECTOR */) { inspectScope(payload, i18n); } }); api.addTimelineLayer({ id: "vue-i18n-timeline" /* TIMELINE */, label: DevToolsLabels["vue-i18n-timeline" /* TIMELINE */], color: DevToolsTimelineColors["vue-i18n-timeline" /* TIMELINE */] }); resolve(true); }); } catch (e) { console.error(e); reject(false); } }); } function updateComponentTreeDataTags(appRecord, treeData, i18n) { // prettier-ignore const global = i18n.mode === 'composition' ? i18n.global : i18n.global.__composer; for (const node of treeData) { const instance = appRecord.instanceMap.get(node.id); if (instance && instance.vnode.el.__INTLIFY__) { // add custom tags local scope only if (instance.vnode.el.__INTLIFY__ !== global) { const label = instance.type.name || instance.type.displayName || instance.type.__file; const tag = { label: `i18n (${label} Scope)`, textColor: 0x000000, backgroundColor: 0xffcd19 }; node.tags.push(tag); } } updateComponentTreeDataTags(appRecord, node.children, i18n); } } function inspectComposer(instanceData, composer) { const type = 'vue-i18n: composer properties'; instanceData.state.push({ type, key: 'locale', editable: false, value: composer.locale.value }); instanceData.state.push({ type, key: 'availableLocales', editable: false, value: composer.availableLocales }); instanceData.state.push({ type, key: 'fallbackLocale', editable: false, value: composer.fallbackLocale.value }); instanceData.state.push({ type, key: 'inheritLocale', editable: false, value: composer.inheritLocale }); instanceData.state.push({ type, key: 'messages', editable: false, value: getLocaleMessageValue(composer.messages.value) }); instanceData.state.push({ type, key: 'datetimeFormats', editable: false, value: composer.datetimeFormats.value }); instanceData.state.push({ type, key: 'numberFormats', editable: false, value: composer.numberFormats.value }); } // eslint-disable-next-line @typescript-eslint/no-explicit-any function getLocaleMessageValue(messages) { const value = {}; Object.keys(messages).forEach((key) => { const v = messages[key]; if (isFunction(v) && 'source' in v) { value[key] = getMessageFunctionDetails(v); } else if (isObject(v)) { value[key] = getLocaleMessageValue(v); } else { value[key] = v; } }); return value; } const ESC = { '<': '&lt;', '>': '&gt;', '"': '&quot;', '&': '&amp;' }; function escape(s) { return s.replace(/[<>"&]/g, escapeChar); } function escapeChar(a) { return ESC[a] || a; } // eslint-disable-next-line @typescript-eslint/no-explicit-any function getMessageFunctionDetails(func) { const argString = func.source ? `("${escape(func.source)}")` : `(?)`; return { _custom: { type: 'function', display: `<span>ƒ</span> ${argString}` } }; } function registerScope(payload, i18n) { payload.rootNodes.push({ id: 'global', label: 'Global Scope' }); // prettier-ignore const global = i18n.mode === 'composition' ? i18n.global : i18n.global.__composer; for (const [keyInstance, instance] of i18n.__instances) { // prettier-ignore const composer = i18n.mode === 'composition' ? instance : instance.__composer; if (global === composer) { continue; } const label = keyInstance.type.name || keyInstance.type.displayName || keyInstance.type.__file; payload.rootNodes.push({ id: composer.id.toString(), label: `${label} Scope` }); } } function inspectScope(payload, i18n) { if (payload.nodeId === 'global') { payload.state = makeScopeInspectState(i18n.mode === 'composition' ? i18n.global : i18n.global.__composer); } else { const instance = Array.from(i18n.__instances.values()).find(item => item.id.toString() === payload.nodeId); if (instance) { const composer = i18n.mode === 'composition' ? instance : instance.__composer; payload.state = makeScopeInspectState(composer); } } } function makeScopeInspectState(composer) { const state = {}; const localeType = 'Locale related info'; const localeStates = [ { type: localeType, key: 'locale', editable: false, value: composer.locale.value }, { type: localeType, key: 'fallbackLocale', editable: false, value: composer.fallbackLocale.value }, { type: localeType, key: 'availableLocales', editable: false, value: composer.availableLocales }, { type: localeType, key: 'inheritLocale', editable: false, value: composer.inheritLocale } ]; state[localeType] = localeStates; const localeMessagesType = 'Locale messages info'; const localeMessagesStates = [ { type: localeMessagesType, key: 'messages', editable: false, value: getLocaleMessageValue(composer.messages.value) } ]; state[localeMessagesType] = localeMessagesStates; const datetimeFormatsType = 'Datetime formats info'; const datetimeFormatsStates = [ { type: datetimeFormatsType, key: 'datetimeFormats', editable: false, value: composer.datetimeFormats.value } ]; state[datetimeFormatsType] = datetimeFormatsStates; const numberFormatsType = 'Datetime formats info'; const numberFormatsStates = [ { type: numberFormatsType, key: 'numberFormats', editable: false, value: composer.numberFormats.value } ]; state[numberFormatsType] = numberFormatsStates; return state; } function addTimelineEvent(event, payload) { if (devtoolsApi) { let groupId; if (payload && 'groupId' in payload) { groupId = payload.groupId; delete payload.groupId; } devtoolsApi.addTimelineEvent({ layerId: "vue-i18n-timeline" /* TIMELINE */, event: { title: event, groupId, time: Date.now(), meta: {}, data: payload || {}, logType: event === "compile-error" /* COMPILE_ERROR */ ? 'error' : event === "fallback" /* FALBACK */ || event === "missing" /* MISSING */ ? 'warning' : 'default' } }); } } // supports compatibility for legacy vue-i18n APIs function defineMixin(vuei18n, composer, i18n) { return { beforeCreate() { const instance = getCurrentInstance(); /* istanbul ignore if */ if (!instance) { throw createI18nError(22 /* UNEXPECTED_ERROR */); } const options = this.$options; if (options.i18n) { const optionsI18n = options.i18n; if (options.__i18n) { optionsI18n.__i18n = options.__i18n; } optionsI18n.__root = composer; if (this === this.$root) { this.$i18n = mergeToRoot(vuei18n, optionsI18n); } else { this.$i18n = createVueI18n(optionsI18n); } } else if (options.__i18n) { if (this === this.$root) { this.$i18n = mergeToRoot(vuei18n, options); } else { this.$i18n = createVueI18n({ __i18n: options.__i18n, __root: composer }); } } else { // set global this.$i18n = vuei18n; } vuei18n.__onComponentInstanceCreated(this.$i18n); i18n.__setInstance(instance, this.$i18n); // defines vue-i18n legacy APIs this.$t = (...args) => this.$i18n.t(...args); this.$tc = (...args) => this.$i18n.tc(...args); this.$te = (key, locale) => this.$i18n.te(key, locale); this.$d = (...args) => this.$i18n.d(...args); this.$n = (...args) => this.$i18n.n(...args); this.$tm = (key) => this.$i18n.tm(key); }, mounted() { /* istanbul ignore if */ if (((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) && !false) { this.$el.__INTLIFY__ = this.$i18n.__composer; const emitter = (this.__emitter = createEmitter()); const _vueI18n = this.$i18n; _vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter); emitter.on('*', addTimelineEvent); } }, beforeUnmount() { const instance = getCurrentInstance(); /* istanbul ignore if */ if (!instance) { throw createI18nError(22 /* UNEXPECTED_ERROR */); } /* istanbul ignore if */ if (((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) && !false) { if (this.__emitter) { this.__emitter.off('*', addTimelineEvent); delete this.__emitter; } const _vueI18n = this.$i18n; _vueI18n.__disableEmitter && _vueI18n.__disableEmitter(); delete this.$el.__INTLIFY__; } delete this.$t; delete this.$tc; delete this.$te; delete this.$d; delete this.$n; delete this.$tm; i18n.__deleteInstance(instance); delete this.$i18n; } }; } function mergeToRoot(root, options) { root.locale = options.locale || root.locale; root.fallbackLocale = options.fallbackLocale || root.fallbackLocale; root.missing = options.missing || root.missing; root.silentTranslationWarn = options.silentTranslationWarn || root.silentFallbackWarn; root.silentFallbackWarn = options.silentFallbackWarn || root.silentFallbackWarn; root.formatFallbackMessages = options.formatFallbackMessages || root.formatFallbackMessages; root.postTranslation = options.postTranslation || root.postTranslation; root.warnHtmlInMessage = options.warnHtmlInMessage || root.warnHtmlInMessage; root.escapeParameterHtml = options.escapeParameterHtml || root.escapeParameterHtml; root.sync = options.sync || root.sync; root.__composer[SetPluralRulesSymbol](options.pluralizationRules || root.pluralizationRules); const messages = getLocaleMessages(root.locale, { messages: options.messages, __i18n: options.__i18n }); Object.keys(messages).forEach(locale => root.mergeLocaleMessage(locale, messages[locale])); if (options.datetimeFormats) { Object.keys(options.datetimeFormats).forEach(locale => root.mergeDateTimeFormat(locale, options.datetimeFormats[locale])); } if (options.numberFormats) { Object.keys(options.numberFormats).forEach(locale => root.mergeNumberFormat(locale, options.numberFormats[locale])); } return root; } /** * Vue I18n factory * * @param options - An options, see the {@link I18nOptions} * * @returns {@link I18n} instance * * @remarks * If you use Legacy API mode, you need toto specify {@link VueI18nOptions} and `legacy: true` option. * * If you use composition API mode, you need to specify {@link ComposerOptions}. * * @VueI18nSee [Getting Started](../../guide/) * @VueI18nSee [Composition API](../../guide/advanced/composition) * * @example * case: for Legacy API * ```js * import { createApp } from 'vue' * import { createI18n } from 'vue-i18n' * * // call with I18n option * const i18n = createI18n({ * locale: 'ja', * messages: { * en: { ... }, * ja: { ... } * } * }) * * const App = { * // ... * } * * const app = createApp(App) * * // install! * app.use(i18n) * app.mount('#app') * ``` * * @example * case: for composition API * ```js * import { createApp } from 'vue' * import { createI18n, useI18n } from 'vue-i18n' * * // call with I18n option * const i18n = createI18n({ * legacy: false, // you must specify 'legacy: false' option * locale: 'ja', * messages: { * en: { ... }, * ja: { ... } * } * }) * * const App = { * setup() { * // ... * const { t } = useI18n({ ... }) * return { ... , t } * } * } * * const app = createApp(App) * * // install! * app.use(i18n) * app.mount('#app') * ``` * * @VueI18nGeneral */ function createI18n(options = {}) { // prettier-ignore const __legacyMode = __VUE_I18N_LEGACY_API__ && isBoolean(options.legacy) ? options.legacy : __VUE_I18N_LEGACY_API__; const __globalInjection = !!options.globalInjection; const __instances = new Map(); // prettier-ignore const __global = __VUE_I18N_LEGACY_API__ && __legacyMode ? createVueI18n(options) : createComposer(options); const symbol = makeSymbol((process.env.NODE_ENV !== 'production') ? 'vue-i18n' : ''); const i18n = { // mode get mode() { // prettier-ignore return __VUE_I18N_LEGACY_API__ ? __legacyMode ? 'legacy' : 'composition' : 'composition'; }, // install plugin async install(app, ...options) { if (((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) && !false) { app.__VUE_I18N__ = i18n; } // setup global provider app.__VUE_I18N_SYMBOL__ = symbol; app.provide(app.__VUE_I18N_SYMBOL__, i18n); // global method and properties injection for Composition API if (!__legacyMode && __globalInjection) { injectGlobalFields(app, i18n.global); } // install built-in components and directive if (__VUE_I18N_FULL_INSTALL__) { apply(app, i18n, ...options); } // setup mixin for Legacy API if (__VUE_I18N_LEGACY_API__ && __legacyMode) { app.mixin(defineMixin(__global, __global.__composer, i18n)); } // setup vue-devtools plugin if (((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) && !false) { const ret = await enableDevTools(app, i18n); if (!ret) { throw createI18nError(21 /* CANNOT_SETUP_VUE_DEVTOOLS_PLUGIN */); } const emitter = createEmitter(); if (__legacyMode) { const _vueI18n = __global; _vueI18n.__enableEmitter && _vueI18n.__enableEmitter(emitter); } else { // eslint-disable-next-line @typescript-eslint/no-explicit-any const _composer = __global; _composer[EnableEmitter] && _composer[EnableEmitter](emitter); } emitter.on('*', addTimelineEvent); } }, // global accessor get global() { return __global; }, // @internal __instances, // @internal __getInstance(component) { return __instances.get(component) || null; }, // @internal __setInstance(component, instance) { __instances.set(component, instance); }, // @internal __deleteInstance(component) { __instances.delete(component); } }; return i18n; } /** * Use Composition API for Vue I18n * * @param options - An options, see {@link UseI18nOptions} * * @returns {@link Composer} instance * * @remarks * This function is mainly used by `setup`. * * If options are specified, Composer instance is created for each component and you can be localized on the component. * * If options are not specified, you can be localized using the global Composer. * * @example * case: Component resource base localization * ```html * <template> * <form> * <label>{{ t('language') }}</label> * <select v-model="locale"> * <option value="en">en</option> * <option value="ja">ja</option> * </select> * </form> * <p>message: {{ t('hello') }}</p> * </template> * * <script> * import { useI18n } from 'vue-i18n' * * export default { * setup() { * const { t, locale } = useI18n({ * locale: 'ja', * messages: { * en: { ... }, * ja: { ... } * } * }) * // Something to do ... * * return { ..., t, locale } * } * } * </script> * ``` * * @VueI18nComposition */ function useI18n(options = {}) { const instance = getCurrentInstance(); if (instance == null) { throw createI18nError(16 /* MUST_BE_CALL_SETUP_TOP */); } if (!instance.appContext.app.__VUE_I18N_SYMBOL__) { throw createI18nError(17 /* NOT_INSLALLED */); } const i18n = inject(instance.appContext.app.__VUE_I18N_SYMBOL__); /* istanbul ignore if */ if (!i18n) { throw createI18nError(22 /* UNEXPECTED_ERROR */); } // prettier-ignore const global = i18n.mode === 'composition' ? i18n.global : i18n.global.__composer; // prettier-ignore const scope = isEmptyObject(options) ? ('__i18n' in instance.type) ? 'local' : 'global' : !options.useScope ? 'local' : options.useScope; if (scope === 'global') { let messages = isObject(options.messages) ? options.messages : {}; if ('__i18nGlobal' in instance.type) { messages = getLocaleMessages(global.locale.value, { messages, __i18n: instance.type.__i18nGlobal }); } // merge locale messages const locales = Object.keys(messages); if (locales.length) { locales.forEach(locale => { global.mergeLocaleMessage(locale, messages[locale]); }); } // merge datetime formats if (isObject(options.datetimeFormats)) { const locales = Object.keys(options.datetimeFormats); if (locales.length) { locales.forEach(locale => { global.mergeDateTimeFormat(locale, options.datetimeFormats[locale]); }); } } // merge number formats if (isObject(options.numberFormats)) { const locales = Object.keys(options.numberFormats); if (locales.length) { locales.forEach(locale => { global.mergeNumberFormat(locale, options.numberFormats[locale]); }); } } return global; } if (scope === 'parent') { let composer = getComposer$1(i18n, instance); if (composer == null) { if ((process.env.NODE_ENV !== 'production')) { warn(getWarnMessage(12 /* NOT_FOUND_PARENT_SCOPE */)); } composer = global; } return composer; } // scope 'local' case if (i18n.mode === 'legacy') { throw createI18nError(18 /* NOT_AVAILABLE_IN_LEGACY_MODE */); } const i18nInternal = i18n; let composer = i18nInternal.__getInstance(instance); if (composer == null) { const type = instance.type; const composerOptions = { ...options }; if (type.__i18n) { composerOptions.__i18n = type.__i18n; } if (global) { composerOptions.__root = global; } composer = createComposer(composerOptions); setupLifeCycle(i18nInternal, instance, composer); i18nInternal.__setInstance(instance, composer); } return composer; } function getComposer$1(i18n, target) { let composer = null; const root = target.root; let current = target.parent; while (current != null) { const i18nInternal = i18n; if (i18n.mode === 'composition') { composer = i18nInternal.__getInstance(current); } else { const vueI18n = i18nInternal.__getInstance(current); if (vueI18n != null) { composer = vueI18n .__composer; } } if (composer != null) { break; } if (root === current) { break; } current = current.parent; } return composer; } function setupLifeCycle(i18n, target, composer) { let emitter = null; onMounted(() => { // inject composer instance to DOM for intlify-devtools if (((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) && !false && target.vnode.el) { target.vnode.el.__INTLIFY__ = composer; emitter = createEmitter(); // eslint-disable-next-line @typescript-eslint/no-explicit-any const _composer = composer; _composer[EnableEmitter] && _composer[EnableEmitter](emitter); emitter.on('*', addTimelineEvent); } }, target); onUnmounted(() => { // remove composer instance from DOM for intlify-devtools if (((process.env.NODE_ENV !== 'production') || __INTLIFY_PROD_DEVTOOLS__) && !false && target.vnode.el && target.vnode.el.__INTLIFY__) { emitter && emitter.off('*', addTimelineEvent); // eslint-disable-next-line @typescript-eslint/no-explicit-any const _composer = composer; _composer[DisableEmitter] && _composer[DisableEmitter](); delete target.vnode.el.__INTLIFY__; } i18n.__deleteInstance(target); }, target); } const globalExportProps = [ 'locale', 'fallbackLocale', 'availableLocales' ]; const globalExportMethods = ['t', 'd', 'n', 'tm']; function injectGlobalFields(app, composer) { const i18n = Object.create(null); globalExportProps.forEach(prop => { const desc = Object.getOwnPropertyDescriptor(composer, prop); if (!desc) { throw createI18nError(22 /* UNEXPECTED_ERROR */); } const wrap = isRef(desc.value) // check computed props ? { get() { return desc.value.value; }, // eslint-disable-next-line @typescript-eslint/no-explicit-any set(val) { desc.value.value = val; } } : { get() { return desc.get && desc.get(); } }; Object.defineProperty(i18n, prop, wrap); }); app.config.globalProperties.$i18n = i18n; globalExportMethods.forEach(method => { const desc = Object.getOwnPropertyDescriptor(composer, method); if (!desc) { throw createI18nError(22 /* UNEXPECTED_ERROR */); } Object.defineProperty(app.config.globalProperties, `$${method}`, desc); }); } { initFeatureFlags(); } (process.env.NODE_ENV !== 'production') && initDev(); export { DatetimeFormat, NumberFormat, Translation, VERSION, createI18n, useI18n, vTDirective };
/*! * froala_editor v3.2.5 (https://www.froala.com/wysiwyg-editor) * License https://froala.com/wysiwyg-editor/terms/ * Copyright 2014-2020 Froala Labs */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(require('froala-editor')) : typeof define === 'function' && define.amd ? define(['froala-editor'], factory) : (factory(global.FroalaEditor)); }(this, (function (FE) { 'use strict'; FE = FE && FE.hasOwnProperty('default') ? FE['default'] : FE; /** * Portuguese spoken in Portugal */ FE.LANGUAGE['pt_pt'] = { translation: { // Place holder 'Type something': 'Digite algo', // Basic formatting 'Bold': 'Negrito', 'Italic': "It\xE1lico", 'Underline': 'Sublinhado', 'Strikethrough': 'Rasurado', // Main buttons 'Insert': 'Inserir', 'Delete': 'Apagar', 'Cancel': 'Cancelar', 'OK': 'Ok', 'Back': 'Voltar', 'Remove': 'Remover', 'More': 'Mais', 'Update': 'Atualizar', 'Style': 'Estilo', // Font 'Font Family': 'Fonte', 'Font Size': 'Tamanho da fonte', // Colors 'Colors': 'Cores', 'Background': 'Fundo', 'Text': 'Texto', 'HEX Color': 'Cor hexadecimal', // Paragraphs 'Paragraph Format': 'Formatos', 'Normal': 'Normal', 'Code': "C\xF3digo", 'Heading 1': "Cabe\xE7alho 1", 'Heading 2': "Cabe\xE7alho 2", 'Heading 3': "Cabe\xE7alho 3", 'Heading 4': "Cabe\xE7alho 4", // Style 'Paragraph Style': "Estilo de par\xE1grafo", 'Inline Style': 'Estilo embutido', // Alignment 'Align': 'Alinhar', 'Align Left': "Alinhar \xE0 esquerda", 'Align Center': 'Alinhar ao centro', 'Align Right': "Alinhar \xE0 direita", 'Align Justify': 'Justificado', 'None': 'Nenhum', // Lists 'Ordered List': 'Lista ordenada', 'Unordered List': "Lista n\xE3o ordenada", // Indent 'Decrease Indent': "Diminuir avan\xE7o", 'Increase Indent': "Aumentar avan\xE7o", // Links 'Insert Link': 'Inserir link', 'Open in new tab': 'Abrir em uma nova aba', 'Open Link': 'Abrir link', 'Edit Link': 'Editar link', 'Unlink': 'Remover link', 'Choose Link': 'Escolha o link', // Images 'Insert Image': 'Inserir imagem', 'Upload Image': 'Carregar imagem', 'By URL': 'Por URL', 'Browse': 'Procurar', 'Drop image': 'Largue imagem', 'or click': 'ou clique em', 'Manage Images': 'Gerenciar as imagens', 'Loading': 'Carregando', 'Deleting': 'Excluindo', 'Tags': 'Etiquetas', 'Are you sure? Image will be deleted.': "Voc\xEA tem certeza? Imagem ser\xE1 apagada.", 'Replace': 'Substituir', 'Uploading': 'Carregando', 'Loading image': 'Carregando imagem', 'Display': 'Exibir', 'Inline': 'Em linha', 'Break Text': 'Texto de quebra', 'Alternative Text': 'Texto alternativo', 'Change Size': 'Alterar tamanho', 'Width': 'Largura', 'Height': 'Altura', 'Something went wrong. Please try again.': 'Algo deu errado. Por favor, tente novamente.', 'Image Caption': 'Legenda da imagem', 'Advanced Edit': 'Edição avançada', // Video 'Insert Video': "Inserir v\xEDdeo", 'Embedded Code': "C\xF3digo embutido", 'Paste in a video URL': 'Colar em um URL de vídeo', 'Drop video': 'Solte o video', 'Your browser does not support HTML5 video.': 'Seu navegador não suporta o vídeo html5.', 'Upload Video': 'Envio vídeo', // Tables 'Insert Table': 'Inserir tabela', 'Table Header': "Cabe\xE7alho da tabela", 'Remove Table': 'Remover tabela', 'Table Style': 'estilo de tabela', 'Horizontal Align': 'Alinhamento horizontal', 'Row': 'Linha', 'Insert row above': 'Inserir linha antes', 'Insert row below': 'Inserir linha depois', 'Delete row': 'Eliminar linha', 'Column': 'Coluna', 'Insert column before': 'Inserir coluna antes', 'Insert column after': 'Inserir coluna depois', 'Delete column': 'Eliminar coluna', 'Cell': "C\xE9lula", 'Merge cells': "Unir c\xE9lulas", 'Horizontal split': "Divis\xE3o horizontal", 'Vertical split': "Divis\xE3o vertical", 'Cell Background': "Fundo da c\xE9lula", 'Vertical Align': 'Alinhar vertical', 'Top': 'Topo', 'Middle': 'Meio', 'Bottom': 'Fundo', 'Align Top': 'Alinhar topo', 'Align Middle': 'Alinhar meio', 'Align Bottom': 'Alinhar fundo', 'Cell Style': "Estilo de c\xE9lula", // Files 'Upload File': 'Upload de arquivo', 'Drop file': 'Largar arquivo', // Emoticons 'Emoticons': 'Emoticons', 'Grinning face': 'Sorrindo a cara', 'Grinning face with smiling eyes': 'Sorrindo rosto com olhos sorridentes', 'Face with tears of joy': "Rosto com l\xE1grimas de alegria", 'Smiling face with open mouth': 'Rosto de sorriso com a boca aberta', 'Smiling face with open mouth and smiling eyes': 'Rosto de sorriso com a boca aberta e olhos sorridentes', 'Smiling face with open mouth and cold sweat': 'Rosto de sorriso com a boca aberta e suor frio', 'Smiling face with open mouth and tightly-closed eyes': 'Rosto de sorriso com a boca aberta e os olhos bem fechados', 'Smiling face with halo': 'Rosto de sorriso com halo', 'Smiling face with horns': 'Rosto de sorriso com chifres', 'Winking face': 'Pisc a rosto', 'Smiling face with smiling eyes': 'Rosto de sorriso com olhos sorridentes', 'Face savoring delicious food': 'Rosto saboreando uma deliciosa comida', 'Relieved face': 'Rosto aliviado', 'Smiling face with heart-shaped eyes': "Rosto de sorriso com os olhos em forma de cora\xE7\xE3o", 'Smiling face with sunglasses': "Rosto de sorriso com \xF3culos de sol", 'Smirking face': 'Rosto sorridente', 'Neutral face': 'Rosto neutra', 'Expressionless face': 'Rosto inexpressivo', 'Unamused face': "O rosto n\xE3o divertido", 'Face with cold sweat': 'Rosto com suor frio', 'Pensive face': 'O rosto pensativo', 'Confused face': 'Cara confusa', 'Confounded face': "Rosto at\xF4nito", 'Kissing face': 'Beijar Rosto', 'Face throwing a kiss': 'Rosto jogando um beijo', 'Kissing face with smiling eyes': 'Beijar rosto com olhos sorridentes', 'Kissing face with closed eyes': 'Beijando a cara com os olhos fechados', 'Face with stuck out tongue': "Preso de cara com a l\xEDngua para fora", 'Face with stuck out tongue and winking eye': "Rosto com estendeu a l\xEDngua e olho piscando", 'Face with stuck out tongue and tightly-closed eyes': 'Rosto com estendeu a língua e os olhos bem fechados', 'Disappointed face': 'Rosto decepcionado', 'Worried face': 'O rosto preocupado', 'Angry face': 'Rosto irritado', 'Pouting face': 'Beicinho Rosto', 'Crying face': 'Cara de choro', 'Persevering face': 'Perseverar Rosto', 'Face with look of triumph': 'Rosto com olhar de triunfo', 'Disappointed but relieved face': 'Fiquei Desapontado mas aliviado Rosto', 'Frowning face with open mouth': 'Sobrancelhas franzidas rosto com a boca aberta', 'Anguished face': 'O rosto angustiado', 'Fearful face': 'Cara com medo', 'Weary face': 'Rosto cansado', 'Sleepy face': 'Cara de sono', 'Tired face': 'Rosto cansado', 'Grimacing face': 'Fazendo caretas face', 'Loudly crying face': 'Alto chorando rosto', 'Face with open mouth': 'Enfrentar com a boca aberta', 'Hushed face': 'Flagrantes de rosto', 'Face with open mouth and cold sweat': 'Enfrentar com a boca aberta e suor frio', 'Face screaming in fear': 'Cara gritando de medo', 'Astonished face': 'Cara de surpresa', 'Flushed face': 'Rosto vermelho', 'Sleeping face': 'O rosto de sono', 'Dizzy face': 'Cara tonto', 'Face without mouth': 'Rosto sem boca', 'Face with medical mask': "Rosto com m\xE1scara m\xE9dica", // Line breaker 'Break': 'Partir', // Math 'Subscript': 'Subscrito', 'Superscript': 'Sobrescrito', // Full screen 'Fullscreen': 'Tela cheia', // Horizontal line 'Insert Horizontal Line': 'Inserir linha horizontal', // Clear formatting 'Clear Formatting': "Remover formata\xE7\xE3o", // Save 'Save': "Salve", // Undo, redo 'Undo': 'Anular', 'Redo': 'Restaurar', // Select all 'Select All': 'Seleccionar tudo', // Code view 'Code View': "Exibi\xE7\xE3o de c\xF3digo", // Quote 'Quote': "Cita\xE7\xE3o", 'Increase': 'Aumentar', 'Decrease': 'Diminuir', // Quick Insert 'Quick Insert': "Inser\xE7\xE3o r\xE1pida", // Spcial Characters 'Special Characters': 'Caracteres especiais', 'Latin': 'Latino', 'Greek': 'Grego', 'Cyrillic': 'Cirílico', 'Punctuation': 'Pontuação', 'Currency': 'Moeda', 'Arrows': 'Setas; flechas', 'Math': 'Matemática', 'Misc': 'Misc', // Print. 'Print': 'Impressão', // Spell Checker. 'Spell Checker': 'Verificador ortográfico', // Help 'Help': 'Socorro', 'Shortcuts': 'Atalhos', 'Inline Editor': 'Editor em linha', 'Show the editor': 'Mostre o editor', 'Common actions': 'Ações comuns', 'Copy': 'Cópia de', 'Cut': 'Cortar', 'Paste': 'Colar', 'Basic Formatting': 'Formatação básica', 'Increase quote level': 'Aumentar o nível de cotação', 'Decrease quote level': 'Diminuir o nível de cotação', 'Image / Video': 'Imagem / video', 'Resize larger': 'Redimensionar maior', 'Resize smaller': 'Redimensionar menor', 'Table': 'Tabela', 'Select table cell': 'Selecione a célula da tabela', 'Extend selection one cell': 'Ampliar a seleção de uma célula', 'Extend selection one row': 'Ampliar a seleção uma linha', 'Navigation': 'Navegação', 'Focus popup / toolbar': 'Foco popup / barra de ferramentas', 'Return focus to previous position': 'Retornar o foco para a posição anterior', // Embed.ly 'Embed URL': 'URL de inserção', 'Paste in a URL to embed': 'Colar em url para incorporar', // Word Paste. 'The pasted content is coming from a Microsoft Word document. Do you want to keep the format or clean it up?': 'O conteúdo colado vem de um documento Microsoft Word. Você quer manter o formato ou limpá-lo?', 'Keep': 'Guarda', 'Clean': 'Limpar limpo', 'Word Paste Detected': 'Pasta de palavras detectada', // Character Counter 'Characters': 'Caracteres', // More Buttons 'More Text': 'Mais Texto', 'More Paragraph': 'Mais Parágrafo', 'More Rich': 'Mais Rico', 'More Misc': 'Mais Misc' }, direction: 'ltr' }; }))); //# sourceMappingURL=pt_pt.js.map
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); var __chunk_1 = require('./chunk-14c82365.js'); require('./helpers.js'); var __chunk_2 = require('./chunk-185921d7.js'); var __chunk_4 = require('./chunk-925c5339.js'); var __chunk_5 = require('./chunk-13e039f5.js'); var script = { name: 'BRate', components: __chunk_1._defineProperty({}, __chunk_4.Icon.name, __chunk_4.Icon), props: { value: { type: Number, default: 0 }, max: { type: Number, default: 5 }, icon: { type: String, default: 'star' }, iconPack: String, size: String, spaced: Boolean, rtl: Boolean, disabled: Boolean, showScore: Boolean, showText: Boolean, customText: String, texts: Array, locale: { type: [String, Array], default: function _default() { return __chunk_2.config.defaultLocale; } } }, data: function data() { return { newValue: this.value, hoverValue: 0 }; }, computed: { halfStyle: function halfStyle() { return "width:".concat(this.valueDecimal, "%"); }, showMe: function showMe() { var result = ''; if (this.showScore) { result = this.disabled ? this.value : this.newValue; if (result === 0) { result = ''; } else { result = new Intl.NumberFormat(this.locale).format(this.value); } } else if (this.showText) { result = this.texts[Math.ceil(this.newValue) - 1]; } return result; }, valueDecimal: function valueDecimal() { return this.value * 100 - Math.floor(this.value) * 100; } }, watch: { // When v-model is changed set the new value. value: function value(_value) { this.newValue = _value; } }, methods: { resetNewValue: function resetNewValue() { if (this.disabled) return; this.hoverValue = 0; }, previewRate: function previewRate(index, event) { if (this.disabled) return; this.hoverValue = index; event.stopPropagation(); }, confirmValue: function confirmValue(index) { if (this.disabled) return; this.newValue = index; this.$emit('change', this.newValue); this.$emit('input', this.newValue); }, checkHalf: function checkHalf(index) { var showWhenDisabled = this.disabled && this.valueDecimal > 0 && index - 1 < this.value && index > this.value; return showWhenDisabled; }, rateClass: function rateClass(index) { var output = ''; var currentValue = this.hoverValue !== 0 ? this.hoverValue : this.newValue; if (index <= currentValue) { output = 'set-on'; } else if (this.disabled && Math.ceil(this.value) === index) { output = 'set-half'; } return output; } } }; /* script */ const __vue_script__ = script; /* template */ var __vue_render__ = function () {var _vm=this;var _h=_vm.$createElement;var _c=_vm._self._c||_h;return _c('div',{staticClass:"rate",class:{ 'is-disabled': _vm.disabled, 'is-spaced': _vm.spaced, 'is-rtl': _vm.rtl }},[_vm._l((_vm.max),function(item,index){return _c('div',{key:index,staticClass:"rate-item",class:_vm.rateClass(item),on:{"mousemove":function($event){return _vm.previewRate(item, $event)},"mouseleave":_vm.resetNewValue,"click":function($event){$event.preventDefault();return _vm.confirmValue(item)}}},[_c('b-icon',{attrs:{"pack":_vm.iconPack,"icon":_vm.icon,"size":_vm.size}}),(_vm.checkHalf(item))?_c('b-icon',{staticClass:"is-half",style:(_vm.halfStyle),attrs:{"pack":_vm.iconPack,"icon":_vm.icon,"size":_vm.size}}):_vm._e()],1)}),(_vm.showText || _vm.showScore || _vm.customText)?_c('div',{staticClass:"rate-text",class:_vm.size},[_c('span',[_vm._v(_vm._s(_vm.showMe))]),(_vm.customText && !_vm.showText)?_c('span',[_vm._v(_vm._s(_vm.customText))]):_vm._e()]):_vm._e()],2)}; var __vue_staticRenderFns__ = []; /* style */ const __vue_inject_styles__ = undefined; /* scoped */ const __vue_scope_id__ = undefined; /* module identifier */ const __vue_module_identifier__ = undefined; /* functional template */ const __vue_is_functional_template__ = false; /* style inject */ /* style inject SSR */ var Rate = __chunk_5.__vue_normalize__( { render: __vue_render__, staticRenderFns: __vue_staticRenderFns__ }, __vue_inject_styles__, __vue_script__, __vue_scope_id__, __vue_is_functional_template__, __vue_module_identifier__, undefined, undefined ); var Plugin = { install: function install(Vue) { __chunk_5.registerComponent(Vue, Rate); } }; __chunk_5.use(Plugin); exports.BRate = Rate; exports.default = Plugin;
/*! Monio: nothing.js v0.12.0 (c) 2021 Kyle Simpson MIT License: http://getify.mit-license.org */ !function UMD(n,o,e,t){"function"==typeof define&&define.amd?(e=Object.keys(e).map((n=>n.replace(/^\.\//,""))),define(n,e,t)):"undefined"!=typeof module&&module.exports?(e=Object.keys(e).map((n=>require(n))),module.exports=t(...e)):(e=Object.values(e).map((n=>o[n])),o[n]=t(...e))}("Nothing","undefined"!=typeof globalThis?globalThis:"undefined"!=typeof global?global:"undefined"!=typeof window?window:"undefined"!=typeof self?self:new Function("return this")(),{},(function DEF(){"use strict";var n={};let o={};function Nothing(){var o={map:noop,chain:noop,flatMap:noop,bind:noop,ap:noop,concat:noop,_inspect:function _inspect(){return`${o[Symbol.toStringTag]}()`},_is:function _is(o){return o===n},[Symbol.toStringTag]:"Nothing"};return o;function noop(){return o}}return o=Object.assign(Nothing,{of:Nothing,pure:Nothing,unit:Nothing,is:function is(o){return o&&"function"==typeof o._is&&o._is(n)},isEmpty:function isEmpty(n){return null==n}}),o}));
/*! UIkit 3.6.13 | https://www.getuikit.com | (c) 2014 - 2021 YOOtheme | MIT License */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('uikit-util')) : typeof define === 'function' && define.amd ? define('uikitlightbox', ['uikit-util'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.UIkitLightbox = factory(global.UIkit.util)); }(this, (function (uikitUtil) { 'use strict'; var Animations = { slide: { show: function(dir) { return [ {transform: translate(dir * -100)}, {transform: translate()} ]; }, percent: function(current) { return translated(current); }, translate: function(percent, dir) { return [ {transform: translate(dir * -100 * percent)}, {transform: translate(dir * 100 * (1 - percent))} ]; } } }; function translated(el) { return Math.abs(uikitUtil.css(el, 'transform').split(',')[4] / el.offsetWidth) || 0; } function translate(value, unit) { if ( value === void 0 ) value = 0; if ( unit === void 0 ) unit = '%'; value += value ? unit : ''; return uikitUtil.isIE ? ("translateX(" + value + ")") : ("translate3d(" + value + ", 0, 0)"); // currently not translate3d in IE, translate3d within translate3d does not work while transitioning } function scale3d(value) { return ("scale3d(" + value + ", " + value + ", 1)"); } var Animations$1 = uikitUtil.assign({}, Animations, { fade: { show: function() { return [ {opacity: 0}, {opacity: 1} ]; }, percent: function(current) { return 1 - uikitUtil.css(current, 'opacity'); }, translate: function(percent) { return [ {opacity: 1 - percent}, {opacity: percent} ]; } }, scale: { show: function() { return [ {opacity: 0, transform: scale3d(1 - .2)}, {opacity: 1, transform: scale3d(1)} ]; }, percent: function(current) { return 1 - uikitUtil.css(current, 'opacity'); }, translate: function(percent) { return [ {opacity: 1 - percent, transform: scale3d(1 - .2 * percent)}, {opacity: percent, transform: scale3d(1 - .2 + .2 * percent)} ]; } } }); var Container = { props: { container: Boolean }, data: { container: true }, computed: { container: function(ref) { var container = ref.container; return container === true && this.$container || container && uikitUtil.$(container); } } }; var Class = { connected: function() { !uikitUtil.hasClass(this.$el, this.$name) && uikitUtil.addClass(this.$el, this.$name); } }; var Togglable = { props: { cls: Boolean, animation: 'list', duration: Number, origin: String, transition: String }, data: { cls: false, animation: [false], duration: 200, origin: false, transition: 'linear', clsEnter: 'uk-togglabe-enter', clsLeave: 'uk-togglabe-leave', initProps: { overflow: '', height: '', paddingTop: '', paddingBottom: '', marginTop: '', marginBottom: '' }, hideProps: { overflow: 'hidden', height: 0, paddingTop: 0, paddingBottom: 0, marginTop: 0, marginBottom: 0 } }, computed: { hasAnimation: function(ref) { var animation = ref.animation; return !!animation[0]; }, hasTransition: function(ref) { var animation = ref.animation; return this.hasAnimation && animation[0] === true; } }, methods: { toggleElement: function(targets, toggle, animate) { var this$1 = this; return new uikitUtil.Promise(function (resolve) { return uikitUtil.Promise.all(uikitUtil.toNodes(targets).map(function (el) { var show = uikitUtil.isBoolean(toggle) ? toggle : !this$1.isToggled(el); if (!uikitUtil.trigger(el, ("before" + (show ? 'show' : 'hide')), [this$1])) { return uikitUtil.Promise.reject(); } var promise = ( uikitUtil.isFunction(animate) ? animate : animate === false || !this$1.hasAnimation ? this$1._toggle : this$1.hasTransition ? toggleHeight(this$1) : toggleAnimation(this$1) )(el, show) || uikitUtil.Promise.resolve(); uikitUtil.addClass(el, show ? this$1.clsEnter : this$1.clsLeave); uikitUtil.trigger(el, show ? 'show' : 'hide', [this$1]); promise .catch(uikitUtil.noop) .then(function () { return uikitUtil.removeClass(el, show ? this$1.clsEnter : this$1.clsLeave); }); return promise.then(function () { uikitUtil.removeClass(el, show ? this$1.clsEnter : this$1.clsLeave); uikitUtil.trigger(el, show ? 'shown' : 'hidden', [this$1]); this$1.$update(el); }); })).then(resolve, uikitUtil.noop); } ); }, isToggled: function(el) { if ( el === void 0 ) el = this.$el; return uikitUtil.hasClass(el, this.clsEnter) ? true : uikitUtil.hasClass(el, this.clsLeave) ? false : this.cls ? uikitUtil.hasClass(el, this.cls.split(' ')[0]) : !uikitUtil.hasAttr(el, 'hidden'); }, _toggle: function(el, toggled) { if (!el) { return; } toggled = Boolean(toggled); var changed; if (this.cls) { changed = uikitUtil.includes(this.cls, ' ') || toggled !== uikitUtil.hasClass(el, this.cls); changed && uikitUtil.toggleClass(el, this.cls, uikitUtil.includes(this.cls, ' ') ? undefined : toggled); } else { changed = toggled === el.hidden; changed && (el.hidden = !toggled); } uikitUtil.$$('[autofocus]', el).some(function (el) { return uikitUtil.isVisible(el) ? el.focus() || true : el.blur(); }); if (changed) { uikitUtil.trigger(el, 'toggled', [toggled, this]); this.$update(el); } } } }; function toggleHeight(ref) { var isToggled = ref.isToggled; var duration = ref.duration; var initProps = ref.initProps; var hideProps = ref.hideProps; var transition = ref.transition; var _toggle = ref._toggle; return function (el, show) { var inProgress = uikitUtil.Transition.inProgress(el); var inner = el.hasChildNodes ? uikitUtil.toFloat(uikitUtil.css(el.firstElementChild, 'marginTop')) + uikitUtil.toFloat(uikitUtil.css(el.lastElementChild, 'marginBottom')) : 0; var currentHeight = uikitUtil.isVisible(el) ? uikitUtil.height(el) + (inProgress ? 0 : inner) : 0; uikitUtil.Transition.cancel(el); if (!isToggled(el)) { _toggle(el, true); } uikitUtil.height(el, ''); // Update child components first uikitUtil.fastdom.flush(); var endHeight = uikitUtil.height(el) + (inProgress ? 0 : inner); uikitUtil.height(el, currentHeight); return (show ? uikitUtil.Transition.start(el, uikitUtil.assign({}, initProps, {overflow: 'hidden', height: endHeight}), Math.round(duration * (1 - currentHeight / endHeight)), transition) : uikitUtil.Transition.start(el, hideProps, Math.round(duration * (currentHeight / endHeight)), transition).then(function () { return _toggle(el, false); }) ).then(function () { return uikitUtil.css(el, initProps); }); }; } function toggleAnimation(cmp) { return function (el, show) { uikitUtil.Animation.cancel(el); var animation = cmp.animation; var duration = cmp.duration; var _toggle = cmp._toggle; if (show) { _toggle(el, true); return uikitUtil.Animation.in(el, animation[0], duration, cmp.origin); } return uikitUtil.Animation.out(el, animation[1] || animation[0], duration, cmp.origin).then(function () { return _toggle(el, false); }); }; } var active = []; var Modal = { mixins: [Class, Container, Togglable], props: { selPanel: String, selClose: String, escClose: Boolean, bgClose: Boolean, stack: Boolean }, data: { cls: 'uk-open', escClose: true, bgClose: true, overlay: true, stack: false }, computed: { panel: function(ref, $el) { var selPanel = ref.selPanel; return uikitUtil.$(selPanel, $el); }, transitionElement: function() { return this.panel; }, bgClose: function(ref) { var bgClose = ref.bgClose; return bgClose && this.panel; } }, beforeDisconnect: function() { if (this.isToggled()) { this.toggleElement(this.$el, false, false); } }, events: [ { name: 'click', delegate: function() { return this.selClose; }, handler: function(e) { e.preventDefault(); this.hide(); } }, { name: 'toggle', self: true, handler: function(e) { if (e.defaultPrevented) { return; } e.preventDefault(); if (this.isToggled() === uikitUtil.includes(active, this)) { this.toggle(); } } }, { name: 'beforeshow', self: true, handler: function(e) { if (uikitUtil.includes(active, this)) { return false; } if (!this.stack && active.length) { uikitUtil.Promise.all(active.map(function (modal) { return modal.hide(); })).then(this.show); e.preventDefault(); } else { active.push(this); } } }, { name: 'show', self: true, handler: function() { var this$1 = this; if (uikitUtil.width(window) - uikitUtil.width(document) && this.overlay) { uikitUtil.css(document.body, 'overflowY', 'scroll'); } if (this.stack) { uikitUtil.css(this.$el, 'zIndex', uikitUtil.toFloat(uikitUtil.css(this.$el, 'zIndex')) + active.length); } uikitUtil.addClass(document.documentElement, this.clsPage); if (this.bgClose) { uikitUtil.once(this.$el, 'hide', uikitUtil.on(document, uikitUtil.pointerDown, function (ref) { var target = ref.target; if (uikitUtil.last(active) !== this$1 || this$1.overlay && !uikitUtil.within(target, this$1.$el) || uikitUtil.within(target, this$1.panel)) { return; } uikitUtil.once(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel + " scroll"), function (ref) { var defaultPrevented = ref.defaultPrevented; var type = ref.type; var newTarget = ref.target; if (!defaultPrevented && type === uikitUtil.pointerUp && target === newTarget) { this$1.hide(); } }, true); }), {self: true}); } if (this.escClose) { uikitUtil.once(this.$el, 'hide', uikitUtil.on(document, 'keydown', function (e) { if (e.keyCode === 27 && uikitUtil.last(active) === this$1) { this$1.hide(); } }), {self: true}); } } }, { name: 'hidden', self: true, handler: function() { var this$1 = this; active.splice(active.indexOf(this), 1); if (!active.length) { uikitUtil.css(document.body, 'overflowY', ''); } uikitUtil.css(this.$el, 'zIndex', ''); if (!active.some(function (modal) { return modal.clsPage === this$1.clsPage; })) { uikitUtil.removeClass(document.documentElement, this.clsPage); } } } ], methods: { toggle: function() { return this.isToggled() ? this.hide() : this.show(); }, show: function() { var this$1 = this; if (this.isToggled()) { return uikitUtil.Promise.resolve(); } if (this.container && uikitUtil.parent(this.$el) !== this.container) { uikitUtil.append(this.container, this.$el); return new uikitUtil.Promise(function (resolve) { return requestAnimationFrame(function () { return this$1.show().then(resolve); } ); } ); } return this.toggleElement(this.$el, true, animate(this)); }, hide: function() { if (!this.isToggled()) { return uikitUtil.Promise.resolve(); } return this.toggleElement(this.$el, false, animate(this)); } } }; function animate(ref) { var transitionElement = ref.transitionElement; var _toggle = ref._toggle; return function (el, show) { return new uikitUtil.Promise(function (resolve, reject) { return uikitUtil.once(el, 'show hide', function () { el._reject && el._reject(); el._reject = reject; _toggle(el, show); var off = uikitUtil.once(transitionElement, 'transitionstart', function () { uikitUtil.once(transitionElement, 'transitionend transitioncancel', resolve, {self: true}); clearTimeout(timer); }, {self: true}); var timer = setTimeout(function () { off(); resolve(); }, uikitUtil.toMs(uikitUtil.css(transitionElement, 'transitionDuration'))); }); } ).then(function () { return delete el._reject; }); }; } function Transitioner(prev, next, dir, ref) { var animation = ref.animation; var easing = ref.easing; var percent = animation.percent; var translate = animation.translate; var show = animation.show; if ( show === void 0 ) show = uikitUtil.noop; var props = show(dir); var deferred = new uikitUtil.Deferred(); return { dir: dir, show: function(duration, percent, linear) { var this$1 = this; if ( percent === void 0 ) percent = 0; var timing = linear ? 'linear' : easing; duration -= Math.round(duration * uikitUtil.clamp(percent, -1, 1)); this.translate(percent); triggerUpdate(next, 'itemin', {percent: percent, duration: duration, timing: timing, dir: dir}); triggerUpdate(prev, 'itemout', {percent: 1 - percent, duration: duration, timing: timing, dir: dir}); uikitUtil.Promise.all([ uikitUtil.Transition.start(next, props[1], duration, timing), uikitUtil.Transition.start(prev, props[0], duration, timing) ]).then(function () { this$1.reset(); deferred.resolve(); }, uikitUtil.noop); return deferred.promise; }, cancel: function() { uikitUtil.Transition.cancel([next, prev]); }, reset: function() { for (var prop in props[0]) { uikitUtil.css([next, prev], prop, ''); } }, forward: function(duration, percent) { if ( percent === void 0 ) percent = this.percent(); uikitUtil.Transition.cancel([next, prev]); return this.show(duration, percent, true); }, translate: function(percent) { this.reset(); var props = translate(percent, dir); uikitUtil.css(next, props[1]); uikitUtil.css(prev, props[0]); triggerUpdate(next, 'itemtranslatein', {percent: percent, dir: dir}); triggerUpdate(prev, 'itemtranslateout', {percent: 1 - percent, dir: dir}); }, percent: function() { return percent(prev || next, next, dir); }, getDistance: function() { return prev && prev.offsetWidth; } }; } function triggerUpdate(el, type, data) { uikitUtil.trigger(el, uikitUtil.createEvent(type, false, false, data)); } var SliderAutoplay = { props: { autoplay: Boolean, autoplayInterval: Number, pauseOnHover: Boolean }, data: { autoplay: false, autoplayInterval: 7000, pauseOnHover: true }, connected: function() { this.autoplay && this.startAutoplay(); }, disconnected: function() { this.stopAutoplay(); }, update: function() { uikitUtil.attr(this.slides, 'tabindex', '-1'); }, events: [ { name: 'visibilitychange', el: uikitUtil.inBrowser && document, filter: function() { return this.autoplay; }, handler: function() { if (document.hidden) { this.stopAutoplay(); } else { this.startAutoplay(); } } } ], methods: { startAutoplay: function() { var this$1 = this; this.stopAutoplay(); this.interval = setInterval( function () { return (!this$1.draggable || !uikitUtil.$(':focus', this$1.$el)) && (!this$1.pauseOnHover || !uikitUtil.matches(this$1.$el, ':hover')) && !this$1.stack.length && this$1.show('next'); }, this.autoplayInterval ); }, stopAutoplay: function() { this.interval && clearInterval(this.interval); } } }; var SliderDrag = { props: { draggable: Boolean }, data: { draggable: true, threshold: 10 }, created: function() { var this$1 = this; ['start', 'move', 'end'].forEach(function (key) { var fn = this$1[key]; this$1[key] = function (e) { var pos = uikitUtil.getEventPos(e).x * (uikitUtil.isRtl ? -1 : 1); this$1.prevPos = pos !== this$1.pos ? this$1.pos : this$1.prevPos; this$1.pos = pos; fn(e); }; }); }, events: [ { name: uikitUtil.pointerDown, delegate: function() { return this.selSlides; }, handler: function(e) { if (!this.draggable || !uikitUtil.isTouch(e) && hasTextNodesOnly(e.target) || uikitUtil.closest(e.target, uikitUtil.selInput) || e.button > 0 || this.length < 2 ) { return; } this.start(e); } }, { name: 'dragstart', handler: function(e) { e.preventDefault(); } } ], methods: { start: function() { this.drag = this.pos; if (this._transitioner) { this.percent = this._transitioner.percent(); this.drag += this._transitioner.getDistance() * this.percent * this.dir; this._transitioner.cancel(); this._transitioner.translate(this.percent); this.dragging = true; this.stack = []; } else { this.prevIndex = this.index; } // Workaround for iOS's inert scrolling preventing pointerdown event // https://developer.mozilla.org/en-US/docs/Web/CSS/touch-action uikitUtil.on(this.list, 'touchmove', this.move, {passive: false}); uikitUtil.on(document, uikitUtil.pointerMove, this.move, {passive: false}); uikitUtil.on(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel), this.end, true); uikitUtil.css(this.list, 'userSelect', 'none'); }, move: function(e) { var this$1 = this; var distance = this.pos - this.drag; if (distance === 0 || this.prevPos === this.pos || !this.dragging && Math.abs(distance) < this.threshold) { return; } e.cancelable && e.preventDefault(); this.dragging = true; this.dir = (distance < 0 ? 1 : -1); var ref = this; var slides = ref.slides; var ref$1 = this; var prevIndex = ref$1.prevIndex; var dis = Math.abs(distance); var nextIndex = this.getIndex(prevIndex + this.dir, prevIndex); var width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth; while (nextIndex !== prevIndex && dis > width) { this.drag -= width * this.dir; prevIndex = nextIndex; dis -= width; nextIndex = this.getIndex(prevIndex + this.dir, prevIndex); width = this._getDistance(prevIndex, nextIndex) || slides[prevIndex].offsetWidth; } this.percent = dis / width; var prev = slides[prevIndex]; var next = slides[nextIndex]; var changed = this.index !== nextIndex; var edge = prevIndex === nextIndex; var itemShown; [this.index, this.prevIndex].filter(function (i) { return !uikitUtil.includes([nextIndex, prevIndex], i); }).forEach(function (i) { uikitUtil.trigger(slides[i], 'itemhidden', [this$1]); if (edge) { itemShown = true; this$1.prevIndex = prevIndex; } }); if (this.index === prevIndex && this.prevIndex !== prevIndex || itemShown) { uikitUtil.trigger(slides[this.index], 'itemshown', [this]); } if (changed) { this.prevIndex = prevIndex; this.index = nextIndex; !edge && uikitUtil.trigger(prev, 'beforeitemhide', [this]); uikitUtil.trigger(next, 'beforeitemshow', [this]); } this._transitioner = this._translate(Math.abs(this.percent), prev, !edge && next); if (changed) { !edge && uikitUtil.trigger(prev, 'itemhide', [this]); uikitUtil.trigger(next, 'itemshow', [this]); } }, end: function() { uikitUtil.off(this.list, 'touchmove', this.move, {passive: false}); uikitUtil.off(document, uikitUtil.pointerMove, this.move, {passive: false}); uikitUtil.off(document, (uikitUtil.pointerUp + " " + uikitUtil.pointerCancel), this.end, true); if (this.dragging) { this.dragging = null; if (this.index === this.prevIndex) { this.percent = 1 - this.percent; this.dir *= -1; this._show(false, this.index, true); this._transitioner = null; } else { var dirChange = (uikitUtil.isRtl ? this.dir * (uikitUtil.isRtl ? 1 : -1) : this.dir) < 0 === this.prevPos > this.pos; this.index = dirChange ? this.index : this.prevIndex; if (dirChange) { this.percent = 1 - this.percent; } this.show(this.dir > 0 && !dirChange || this.dir < 0 && dirChange ? 'next' : 'previous', true); } } uikitUtil.css(this.list, {userSelect: '', pointerEvents: ''}); this.drag = this.percent = null; } } }; function hasTextNodesOnly(el) { return !el.children.length && el.childNodes.length; } var SliderNav = { data: { selNav: false }, computed: { nav: function(ref, $el) { var selNav = ref.selNav; return uikitUtil.$(selNav, $el); }, selNavItem: function(ref) { var attrItem = ref.attrItem; return ("[" + attrItem + "],[data-" + attrItem + "]"); }, navItems: function(_, $el) { return uikitUtil.$$(this.selNavItem, $el); } }, update: { write: function() { var this$1 = this; if (this.nav && this.length !== this.nav.children.length) { uikitUtil.html(this.nav, this.slides.map(function (_, i) { return ("<li " + (this$1.attrItem) + "=\"" + i + "\"><a href></a></li>"); }).join('')); } this.navItems.concat(this.nav).forEach(function (el) { return el && (el.hidden = !this$1.maxIndex); }); this.updateNav(); }, events: ['resize'] }, events: [ { name: 'click', delegate: function() { return this.selNavItem; }, handler: function(e) { e.preventDefault(); this.show(uikitUtil.data(e.current, this.attrItem)); } }, { name: 'itemshow', handler: 'updateNav' } ], methods: { updateNav: function() { var this$1 = this; var i = this.getValidIndex(); this.navItems.forEach(function (el) { var cmd = uikitUtil.data(el, this$1.attrItem); uikitUtil.toggleClass(el, this$1.clsActive, uikitUtil.toNumber(cmd) === i); uikitUtil.toggleClass(el, 'uk-invisible', this$1.finite && (cmd === 'previous' && i === 0 || cmd === 'next' && i >= this$1.maxIndex)); }); } } }; var Slider = { mixins: [SliderAutoplay, SliderDrag, SliderNav], props: { clsActivated: Boolean, easing: String, index: Number, finite: Boolean, velocity: Number, selSlides: String }, data: function () { return ({ easing: 'ease', finite: false, velocity: 1, index: 0, prevIndex: -1, stack: [], percent: 0, clsActive: 'uk-active', clsActivated: false, Transitioner: false, transitionOptions: {} }); }, connected: function() { this.prevIndex = -1; this.index = this.getValidIndex(this.$props.index); this.stack = []; }, disconnected: function() { uikitUtil.removeClass(this.slides, this.clsActive); }, computed: { duration: function(ref, $el) { var velocity = ref.velocity; return speedUp($el.offsetWidth / velocity); }, list: function(ref, $el) { var selList = ref.selList; return uikitUtil.$(selList, $el); }, maxIndex: function() { return this.length - 1; }, selSlides: function(ref) { var selList = ref.selList; var selSlides = ref.selSlides; return (selList + " " + (selSlides || '> *')); }, slides: { get: function() { return uikitUtil.$$(this.selSlides, this.$el); }, watch: function() { this.$reset(); } }, length: function() { return this.slides.length; } }, events: { itemshown: function() { this.$update(this.list); } }, methods: { show: function(index, force) { var this$1 = this; if ( force === void 0 ) force = false; if (this.dragging || !this.length) { return; } var ref = this; var stack = ref.stack; var queueIndex = force ? 0 : stack.length; var reset = function () { stack.splice(queueIndex, 1); if (stack.length) { this$1.show(stack.shift(), true); } }; stack[force ? 'unshift' : 'push'](index); if (!force && stack.length > 1) { if (stack.length === 2) { this._transitioner.forward(Math.min(this.duration, 200)); } return; } var prevIndex = this.getIndex(this.index); var prev = uikitUtil.hasClass(this.slides, this.clsActive) && this.slides[prevIndex]; var nextIndex = this.getIndex(index, this.index); var next = this.slides[nextIndex]; if (prev === next) { reset(); return; } this.dir = getDirection(index, prevIndex); this.prevIndex = prevIndex; this.index = nextIndex; if (prev && !uikitUtil.trigger(prev, 'beforeitemhide', [this]) || !uikitUtil.trigger(next, 'beforeitemshow', [this, prev]) ) { this.index = this.prevIndex; reset(); return; } var promise = this._show(prev, next, force).then(function () { prev && uikitUtil.trigger(prev, 'itemhidden', [this$1]); uikitUtil.trigger(next, 'itemshown', [this$1]); return new uikitUtil.Promise(function (resolve) { uikitUtil.fastdom.write(function () { stack.shift(); if (stack.length) { this$1.show(stack.shift(), true); } else { this$1._transitioner = null; } resolve(); }); }); }); prev && uikitUtil.trigger(prev, 'itemhide', [this]); uikitUtil.trigger(next, 'itemshow', [this]); return promise; }, getIndex: function(index, prev) { if ( index === void 0 ) index = this.index; if ( prev === void 0 ) prev = this.index; return uikitUtil.clamp(uikitUtil.getIndex(index, this.slides, prev, this.finite), 0, this.maxIndex); }, getValidIndex: function(index, prevIndex) { if ( index === void 0 ) index = this.index; if ( prevIndex === void 0 ) prevIndex = this.prevIndex; return this.getIndex(index, prevIndex); }, _show: function(prev, next, force) { this._transitioner = this._getTransitioner( prev, next, this.dir, uikitUtil.assign({ easing: force ? next.offsetWidth < 600 ? 'cubic-bezier(0.25, 0.46, 0.45, 0.94)' /* easeOutQuad */ : 'cubic-bezier(0.165, 0.84, 0.44, 1)' /* easeOutQuart */ : this.easing }, this.transitionOptions) ); if (!force && !prev) { this._translate(1); return uikitUtil.Promise.resolve(); } var ref = this.stack; var length = ref.length; return this._transitioner[length > 1 ? 'forward' : 'show'](length > 1 ? Math.min(this.duration, 75 + 75 / (length - 1)) : this.duration, this.percent); }, _getDistance: function(prev, next) { return this._getTransitioner(prev, prev !== next && next).getDistance(); }, _translate: function(percent, prev, next) { if ( prev === void 0 ) prev = this.prevIndex; if ( next === void 0 ) next = this.index; var transitioner = this._getTransitioner(prev !== next ? prev : false, next); transitioner.translate(percent); return transitioner; }, _getTransitioner: function(prev, next, dir, options) { if ( prev === void 0 ) prev = this.prevIndex; if ( next === void 0 ) next = this.index; if ( dir === void 0 ) dir = this.dir || 1; if ( options === void 0 ) options = this.transitionOptions; return new this.Transitioner( uikitUtil.isNumber(prev) ? this.slides[prev] : prev, uikitUtil.isNumber(next) ? this.slides[next] : next, dir * (uikitUtil.isRtl ? -1 : 1), options ); } } }; function getDirection(index, prevIndex) { return index === 'next' ? 1 : index === 'previous' ? -1 : index < prevIndex ? -1 : 1; } function speedUp(x) { return .5 * x + 300; // parabola through (400,500; 600,600; 1800,1200) } var Slideshow = { mixins: [Slider], props: { animation: String }, data: { animation: 'slide', clsActivated: 'uk-transition-active', Animations: Animations, Transitioner: Transitioner }, computed: { animation: function(ref) { var animation = ref.animation; var Animations = ref.Animations; return uikitUtil.assign(Animations[animation] || Animations.slide, {name: animation}); }, transitionOptions: function() { return {animation: this.animation}; } }, events: { 'itemshow itemhide itemshown itemhidden': function(ref) { var target = ref.target; this.$update(target); }, beforeitemshow: function(ref) { var target = ref.target; uikitUtil.addClass(target, this.clsActive); }, itemshown: function(ref) { var target = ref.target; uikitUtil.addClass(target, this.clsActivated); }, itemhidden: function(ref) { var target = ref.target; uikitUtil.removeClass(target, this.clsActive, this.clsActivated); } } }; var LightboxPanel = { mixins: [Container, Modal, Togglable, Slideshow], functional: true, props: { delayControls: Number, preload: Number, videoAutoplay: Boolean, template: String }, data: function () { return ({ preload: 1, videoAutoplay: false, delayControls: 3000, items: [], cls: 'uk-open', clsPage: 'uk-lightbox-page', selList: '.uk-lightbox-items', attrItem: 'uk-lightbox-item', selClose: '.uk-close-large', selCaption: '.uk-lightbox-caption', pauseOnHover: false, velocity: 2, Animations: Animations$1, template: "<div class=\"uk-lightbox uk-overflow-hidden\"> <ul class=\"uk-lightbox-items\"></ul> <div class=\"uk-lightbox-toolbar uk-position-top uk-text-right uk-transition-slide-top uk-transition-opaque\"> <button class=\"uk-lightbox-toolbar-icon uk-close-large\" type=\"button\" uk-close></button> </div> <a class=\"uk-lightbox-button uk-position-center-left uk-position-medium uk-transition-fade\" href uk-slidenav-previous uk-lightbox-item=\"previous\"></a> <a class=\"uk-lightbox-button uk-position-center-right uk-position-medium uk-transition-fade\" href uk-slidenav-next uk-lightbox-item=\"next\"></a> <div class=\"uk-lightbox-toolbar uk-lightbox-caption uk-position-bottom uk-text-center uk-transition-slide-bottom uk-transition-opaque\"></div> </div>" }); }, created: function() { var $el = uikitUtil.$(this.template); var list = uikitUtil.$(this.selList, $el); this.items.forEach(function () { return uikitUtil.append(list, '<li>'); }); this.$mount(uikitUtil.append(this.container, $el)); }, computed: { caption: function(ref, $el) { var selCaption = ref.selCaption; return uikitUtil.$('.uk-lightbox-caption', $el); } }, events: [ { name: (uikitUtil.pointerMove + " " + uikitUtil.pointerDown + " keydown"), handler: 'showControls' }, { name: 'click', self: true, delegate: function() { return this.selSlides; }, handler: function(e) { if (e.defaultPrevented) { return; } this.hide(); } }, { name: 'shown', self: true, handler: function() { this.showControls(); } }, { name: 'hide', self: true, handler: function() { this.hideControls(); uikitUtil.removeClass(this.slides, this.clsActive); uikitUtil.Transition.stop(this.slides); } }, { name: 'hidden', self: true, handler: function() { this.$destroy(true); } }, { name: 'keyup', el: uikitUtil.inBrowser && document, handler: function(e) { if (!this.isToggled(this.$el) || !this.draggable) { return; } switch (e.keyCode) { case 37: this.show('previous'); break; case 39: this.show('next'); break; } } }, { name: 'beforeitemshow', handler: function(e) { if (this.isToggled()) { return; } this.draggable = false; e.preventDefault(); this.toggleElement(this.$el, true, false); this.animation = Animations$1['scale']; uikitUtil.removeClass(e.target, this.clsActive); this.stack.splice(1, 0, this.index); } }, { name: 'itemshow', handler: function() { uikitUtil.html(this.caption, this.getItem().caption || ''); for (var j = -this.preload; j <= this.preload; j++) { this.loadItem(this.index + j); } } }, { name: 'itemshown', handler: function() { this.draggable = this.$props.draggable; } }, { name: 'itemload', handler: function(_, item) { var this$1 = this; var src = item.source; var type = item.type; var alt = item.alt; if ( alt === void 0 ) alt = ''; var poster = item.poster; var attrs = item.attrs; if ( attrs === void 0 ) attrs = {}; this.setItem(item, '<span uk-spinner></span>'); if (!src) { return; } var matches; var iframeAttrs = { frameborder: '0', allow: 'autoplay', allowfullscreen: '', style: 'max-width: 100%; box-sizing: border-box;', 'uk-responsive': '', 'uk-video': ("" + (this.videoAutoplay)) }; // Image if (type === 'image' || src.match(/\.(jpe?g|png|gif|svg|webp)($|\?)/i)) { uikitUtil.getImage(src, attrs.srcset, attrs.size).then( function (ref) { var width = ref.width; var height = ref.height; return this$1.setItem(item, createEl('img', uikitUtil.assign({src: src, width: width, height: height, alt: alt}, attrs))); }, function () { return this$1.setError(item); } ); // Video } else if (type === 'video' || src.match(/\.(mp4|webm|ogv)($|\?)/i)) { var video = createEl('video', uikitUtil.assign({ src: src, poster: poster, controls: '', playsinline: '', 'uk-video': ("" + (this.videoAutoplay)) }, attrs)); uikitUtil.on(video, 'loadedmetadata', function () { uikitUtil.attr(video, {width: video.videoWidth, height: video.videoHeight}); this$1.setItem(item, video); }); uikitUtil.on(video, 'error', function () { return this$1.setError(item); }); // Iframe } else if (type === 'iframe' || src.match(/\.(html|php)($|\?)/i)) { this.setItem(item, createEl('iframe', uikitUtil.assign({ src: src, frameborder: '0', allowfullscreen: '', class: 'uk-lightbox-iframe' }, attrs))); // YouTube } else if ((matches = src.match(/\/\/(?:.*?youtube(-nocookie)?\..*?[?&]v=|youtu\.be\/)([\w-]{11})[&?]?(.*)?/))) { this.setItem(item, createEl('iframe', uikitUtil.assign({ src: ("https://www.youtube" + (matches[1] || '') + ".com/embed/" + (matches[2]) + (matches[3] ? ("?" + (matches[3])) : '')), width: 1920, height: 1080 }, iframeAttrs, attrs))); // Vimeo } else if ((matches = src.match(/\/\/.*?vimeo\.[a-z]+\/(\d+)[&?]?(.*)?/))) { uikitUtil.ajax(("https://vimeo.com/api/oembed.json?maxwidth=1920&url=" + (encodeURI(src))), { responseType: 'json', withCredentials: false }).then( function (ref) { var ref_response = ref.response; var height = ref_response.height; var width = ref_response.width; return this$1.setItem(item, createEl('iframe', uikitUtil.assign({ src: ("https://player.vimeo.com/video/" + (matches[1]) + (matches[2] ? ("?" + (matches[2])) : '')), width: width, height: height }, iframeAttrs, attrs))); }, function () { return this$1.setError(item); } ); } } } ], methods: { loadItem: function(index) { if ( index === void 0 ) index = this.index; var item = this.getItem(index); if (!this.getSlide(item).childElementCount) { uikitUtil.trigger(this.$el, 'itemload', [item]); } }, getItem: function(index) { if ( index === void 0 ) index = this.index; return this.items[uikitUtil.getIndex(index, this.slides)]; }, setItem: function(item, content) { uikitUtil.trigger(this.$el, 'itemloaded', [this, uikitUtil.html(this.getSlide(item), content) ]); }, getSlide: function(item) { return this.slides[this.items.indexOf(item)]; }, setError: function(item) { this.setItem(item, '<span uk-icon="icon: bolt; ratio: 2"></span>'); }, showControls: function() { clearTimeout(this.controlsTimer); this.controlsTimer = setTimeout(this.hideControls, this.delayControls); uikitUtil.addClass(this.$el, 'uk-active', 'uk-transition-active'); }, hideControls: function() { uikitUtil.removeClass(this.$el, 'uk-active', 'uk-transition-active'); } } }; function createEl(tag, attrs) { var el = uikitUtil.fragment(("<" + tag + ">")); uikitUtil.attr(el, attrs); return el; } var Component = { install: install, props: {toggle: String}, data: {toggle: 'a'}, computed: { toggles: { get: function(ref, $el) { var toggle = ref.toggle; return uikitUtil.$$(toggle, $el); }, watch: function() { this.hide(); } } }, disconnected: function() { this.hide(); }, events: [ { name: 'click', delegate: function() { return ((this.toggle) + ":not(.uk-disabled)"); }, handler: function(e) { e.preventDefault(); this.show(e.current); } } ], methods: { show: function(index) { var this$1 = this; var items = uikitUtil.uniqueBy(this.toggles.map(toItem), 'source'); if (uikitUtil.isElement(index)) { var ref = toItem(index); var source = ref.source; index = uikitUtil.findIndex(items, function (ref) { var src = ref.source; return source === src; }); } this.panel = this.panel || this.$create('lightboxPanel', uikitUtil.assign({}, this.$props, {items: items})); uikitUtil.on(this.panel.$el, 'hidden', function () { return this$1.panel = false; }); return this.panel.show(index); }, hide: function() { return this.panel && this.panel.hide(); } } }; function install(UIkit, Lightbox) { if (!UIkit.lightboxPanel) { UIkit.component('lightboxPanel', LightboxPanel); } uikitUtil.assign( Lightbox.props, UIkit.component('lightboxPanel').options.props ); } function toItem(el) { var item = {}; ['href', 'caption', 'type', 'poster', 'alt', 'attrs'].forEach(function (attr) { item[attr === 'href' ? 'source' : attr] = uikitUtil.data(el, attr); }); item.attrs = uikitUtil.parseOptions(item.attrs); return item; } if (typeof window !== 'undefined' && window.UIkit) { window.UIkit.component('lightbox', Component); } return Component; })));
/*! * ui-grid - v4.8.2 - 2019-10-07 * Copyright (c) 2019 ; License: MIT */ (function () { angular.module('ui.grid').config(['$provide', function($provide) { $provide.decorator('i18nService', ['$delegate', function($delegate) { $delegate.add('sv', { headerCell: { aria: { defaultFilterLabel: 'Kolumnfilter', removeFilter: 'Ta bort filter', columnMenuButtonLabel: 'Kolumnmeny', column: 'Kolumn' }, priority: 'Prioritet:', filterLabel: "Filter för kolumn: " }, aggregate: { label: 'Poster' }, groupPanel: { description: 'Dra en kolumnrubrik hit och släpp den för att gruppera efter den kolumnen.' }, search: { aria: { selected: 'Rad är vald', notSelected: 'Rad är inte vald' }, placeholder: 'Sök...', showingItems: 'Visar:', selectedItems: 'Valda:', totalItems: 'Antal:', size: 'Sidstorlek:', first: 'Första sidan', next: 'Nästa sida', previous: 'Föregående sida', last: 'Sista sidan' }, menu: { text: 'Välj kolumner:' }, sort: { ascending: 'Sortera stigande', descending: 'Sortera fallande', none: 'Ingen sortering', remove: 'Inaktivera sortering' }, column: { hide: 'Göm kolumn' }, aggregation: { count: 'Antal rader: ', sum: 'Summa: ', avg: 'Genomsnitt: ', min: 'Min: ', max: 'Max: ' }, pinning: { pinLeft: 'Fäst vänster', pinRight: 'Fäst höger', unpin: 'Lösgör' }, columnMenu: { close: 'Stäng' }, gridMenu: { aria: { buttonLabel: 'Meny' }, columns: 'Kolumner:', importerTitle: 'Importera fil', exporterAllAsCsv: 'Exportera all data som CSV', exporterVisibleAsCsv: 'Exportera synlig data som CSV', exporterSelectedAsCsv: 'Exportera markerad data som CSV', exporterAllAsPdf: 'Exportera all data som PDF', exporterVisibleAsPdf: 'Exportera synlig data som PDF', exporterSelectedAsPdf: 'Exportera markerad data som PDF', exporterAllAsExcel: 'Exportera all data till Excel', exporterVisibleAsExcel: 'Exportera synlig data till Excel', exporterSelectedAsExcel: 'Exportera markerad data till Excel', clearAllFilters: 'Nollställ alla filter' }, importer: { noHeaders: 'Kolumnnamn kunde inte härledas. Har filen ett sidhuvud?', noObjects: 'Objekt kunde inte härledas. Har filen data undantaget sidhuvud?', invalidCsv: 'Filen kunde inte behandlas, är den en giltig CSV?', invalidJson: 'Filen kunde inte behandlas, är den en giltig JSON?', jsonNotArray: 'Importerad JSON-fil måste innehålla ett fält. Import avbruten.' }, pagination: { aria: { pageToFirst: 'Gå till första sidan', pageBack: 'Gå en sida bakåt', pageSelected: 'Vald sida', pageForward: 'Gå en sida framåt', pageToLast: 'Gå till sista sidan' }, sizes: 'Poster per sida', totalItems: 'Poster', through: 'genom', of: 'av' }, grouping: { group: 'Gruppera', ungroup: 'Dela upp', aggregate_count: 'Agg: Antal', aggregate_sum: 'Agg: Summa', aggregate_max: 'Agg: Max', aggregate_min: 'Agg: Min', aggregate_avg: 'Agg: Genomsnitt', aggregate_remove: 'Agg: Ta bort' }, validate: { error: 'Error:', minLength: 'Värdet borde vara minst THRESHOLD tecken långt.', maxLength: 'Värdet borde vara max THRESHOLD tecken långt.', required: 'Ett värde krävs.' } }); return $delegate; }]); }]); })();
/** MobX - (c) Michel Weststrate 2015 - 2020 - MIT Licensed */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? factory(exports) : typeof define === 'function' && define.amd ? define(['exports'], factory) : (global = global || self, factory(global.mobx = {})); }(this, (function (exports) { 'use strict'; var OBFUSCATED_ERROR = "An invariant failed, however the error is obfuscated because this is a production build."; var EMPTY_ARRAY = []; Object.freeze(EMPTY_ARRAY); var EMPTY_OBJECT = {}; Object.freeze(EMPTY_OBJECT); function getNextId() { return ++globalState.mobxGuid; } function fail(message) { invariant(false, message); throw "X"; // unreachable } function invariant(check, message) { if (!check) throw new Error("[mobx] " + (message || OBFUSCATED_ERROR)); } /** * Prints a deprecation message, but only one time. * Returns false if the deprecated message was already printed before */ var deprecatedMessages = []; function deprecated(msg, thing) { if (process.env.NODE_ENV === "production") return false; if (thing) { return deprecated("'" + msg + "', use '" + thing + "' instead."); } if (deprecatedMessages.indexOf(msg) !== -1) return false; deprecatedMessages.push(msg); console.error("[mobx] Deprecated: " + msg); return true; } /** * Makes sure that the provided function is invoked at most once. */ function once(func) { var invoked = false; return function () { if (invoked) return; invoked = true; return func.apply(this, arguments); }; } var noop = function () { }; function unique(list) { var res = []; list.forEach(function (item) { if (res.indexOf(item) === -1) res.push(item); }); return res; } function isObject(value) { return value !== null && typeof value === "object"; } function isPlainObject(value) { if (value === null || typeof value !== "object") return false; var proto = Object.getPrototypeOf(value); return proto === Object.prototype || proto === null; } function convertToMap(dataStructure) { if (isES6Map(dataStructure) || isObservableMap(dataStructure)) { return dataStructure; } else if (Array.isArray(dataStructure)) { return new Map(dataStructure); } else if (isPlainObject(dataStructure)) { var map = new Map(); for (var key in dataStructure) { map.set(key, dataStructure[key]); } return map; } else { return fail("Cannot convert to map from '" + dataStructure + "'"); } } function addHiddenProp(object, propName, value) { Object.defineProperty(object, propName, { enumerable: false, writable: true, configurable: true, value: value }); } function addHiddenFinalProp(object, propName, value) { Object.defineProperty(object, propName, { enumerable: false, writable: false, configurable: true, value: value }); } function isPropertyConfigurable(object, prop) { var descriptor = Object.getOwnPropertyDescriptor(object, prop); return !descriptor || (descriptor.configurable !== false && descriptor.writable !== false); } function assertPropertyConfigurable(object, prop) { if (process.env.NODE_ENV !== "production" && !isPropertyConfigurable(object, prop)) fail("Cannot make property '" + prop.toString() + "' observable, it is not configurable and writable in the target object"); } function createInstanceofPredicate(name, clazz) { var propName = "isMobX" + name; clazz.prototype[propName] = true; return function (x) { return isObject(x) && x[propName] === true; }; } /** * Returns whether the argument is an array, disregarding observability. */ function isArrayLike(x) { return Array.isArray(x) || isObservableArray(x); } function isES6Map(thing) { return thing instanceof Map; } function isES6Set(thing) { return thing instanceof Set; } /** * Returns the following: own keys, prototype keys & own symbol keys, if they are enumerable. */ function getPlainObjectKeys(object) { var enumerables = new Set(); for (var key in object) enumerables.add(key); // *all* enumerables Object.getOwnPropertySymbols(object).forEach(function (k) { if (Object.getOwnPropertyDescriptor(object, k).enumerable) enumerables.add(k); }); // *own* symbols // Note: this implementation is missing enumerable, inherited, symbolic property names! That would however pretty expensive to add, // as there is no efficient iterator that returns *all* properties return Array.from(enumerables); } function stringifyKey(key) { if (key && key.toString) return key.toString(); else return new String(key).toString(); } function toPrimitive(value) { return value === null ? null : typeof value === "object" ? "" + value : value; } var ownKeys = typeof Reflect !== "undefined" && Reflect.ownKeys ? Reflect.ownKeys : Object.getOwnPropertySymbols ? function (obj) { return Object.getOwnPropertyNames(obj).concat(Object.getOwnPropertySymbols(obj)); } : /* istanbul ignore next */ Object.getOwnPropertyNames; var $mobx = Symbol("mobx administration"); var Atom = /** @class */ (function () { /** * Create a new atom. For debugging purposes it is recommended to give it a name. * The onBecomeObserved and onBecomeUnobserved callbacks can be used for resource management. */ function Atom(name) { if (name === void 0) { name = "Atom@" + getNextId(); } this.name = name; this.isPendingUnobservation = false; // for effective unobserving. BaseAtom has true, for extra optimization, so its onBecomeUnobserved never gets called, because it's not needed this.isBeingObserved = false; this.observers = new Set(); this.diffValue = 0; this.lastAccessedBy = 0; this.lowestObserverState = exports.IDerivationState.NOT_TRACKING; } Atom.prototype.onBecomeObserved = function () { if (this.onBecomeObservedListeners) { this.onBecomeObservedListeners.forEach(function (listener) { return listener(); }); } }; Atom.prototype.onBecomeUnobserved = function () { if (this.onBecomeUnobservedListeners) { this.onBecomeUnobservedListeners.forEach(function (listener) { return listener(); }); } }; /** * Invoke this method to notify mobx that your atom has been used somehow. * Returns true if there is currently a reactive context. */ Atom.prototype.reportObserved = function () { return reportObserved(this); }; /** * Invoke this method _after_ this method has changed to signal mobx that all its observers should invalidate. */ Atom.prototype.reportChanged = function () { startBatch(); propagateChanged(this); endBatch(); }; Atom.prototype.toString = function () { return this.name; }; return Atom; }()); var isAtom = createInstanceofPredicate("Atom", Atom); function createAtom(name, onBecomeObservedHandler, onBecomeUnobservedHandler) { if (onBecomeObservedHandler === void 0) { onBecomeObservedHandler = noop; } if (onBecomeUnobservedHandler === void 0) { onBecomeUnobservedHandler = noop; } var atom = new Atom(name); // default `noop` listener will not initialize the hook Set if (onBecomeObservedHandler !== noop) { onBecomeObserved(atom, onBecomeObservedHandler); } if (onBecomeUnobservedHandler !== noop) { onBecomeUnobserved(atom, onBecomeUnobservedHandler); } return atom; } function identityComparer(a, b) { return a === b; } function structuralComparer(a, b) { return deepEqual(a, b); } function shallowComparer(a, b) { return deepEqual(a, b, 1); } function defaultComparer(a, b) { return Object.is(a, b); } var comparer = { identity: identityComparer, structural: structuralComparer, default: defaultComparer, shallow: shallowComparer }; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. 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 THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABLITY OR NON-INFRINGEMENT. See the Apache Version 2.0 License for specific language governing permissions and limitations under the License. ***************************************************************************** */ /* global Reflect, Promise */ 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); }; function __extends(d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); } var __assign = function() { __assign = Object.assign || function __assign(t) { for (var s, i = 1, n = arguments.length; i < n; i++) { s = arguments[i]; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p]; } return t; }; return __assign.apply(this, arguments); }; function __values(o) { var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0; if (m) return m.call(o); return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; } function __read(o, n) { var m = typeof Symbol === "function" && o[Symbol.iterator]; if (!m) return o; var i = m.call(o), r, ar = [], e; try { while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value); } catch (error) { e = { error: error }; } finally { try { if (r && !r.done && (m = i["return"])) m.call(i); } finally { if (e) throw e.error; } } return ar; } function __spread() { for (var ar = [], i = 0; i < arguments.length; i++) ar = ar.concat(__read(arguments[i])); return ar; } var mobxDidRunLazyInitializersSymbol = Symbol("mobx did run lazy initializers"); var mobxPendingDecorators = Symbol("mobx pending decorators"); var enumerableDescriptorCache = {}; var nonEnumerableDescriptorCache = {}; function createPropertyInitializerDescriptor(prop, enumerable) { var cache = enumerable ? enumerableDescriptorCache : nonEnumerableDescriptorCache; return (cache[prop] || (cache[prop] = { configurable: true, enumerable: enumerable, get: function () { initializeInstance(this); return this[prop]; }, set: function (value) { initializeInstance(this); this[prop] = value; } })); } function initializeInstance(target) { var e_1, _a; if (target[mobxDidRunLazyInitializersSymbol] === true) return; var decorators = target[mobxPendingDecorators]; if (decorators) { addHiddenProp(target, mobxDidRunLazyInitializersSymbol, true); // Build property key array from both strings and symbols var keys = __spread(Object.getOwnPropertySymbols(decorators), Object.keys(decorators)); try { for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) { var key = keys_1_1.value; var d = decorators[key]; d.propertyCreator(target, d.prop, d.descriptor, d.decoratorTarget, d.decoratorArguments); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1); } finally { if (e_1) throw e_1.error; } } } } function createPropDecorator(propertyInitiallyEnumerable, propertyCreator) { return function decoratorFactory() { var decoratorArguments; var decorator = function decorate(target, prop, descriptor, applyImmediately // This is a special parameter to signal the direct application of a decorator, allow extendObservable to skip the entire type decoration part, // as the instance to apply the decorator to equals the target ) { if (applyImmediately === true) { propertyCreator(target, prop, descriptor, target, decoratorArguments); return null; } if (process.env.NODE_ENV !== "production" && !quacksLikeADecorator(arguments)) fail("This function is a decorator, but it wasn't invoked like a decorator"); if (!Object.prototype.hasOwnProperty.call(target, mobxPendingDecorators)) { var inheritedDecorators = target[mobxPendingDecorators]; addHiddenProp(target, mobxPendingDecorators, __assign({}, inheritedDecorators)); } target[mobxPendingDecorators][prop] = { prop: prop, propertyCreator: propertyCreator, descriptor: descriptor, decoratorTarget: target, decoratorArguments: decoratorArguments }; return createPropertyInitializerDescriptor(prop, propertyInitiallyEnumerable); }; if (quacksLikeADecorator(arguments)) { // @decorator decoratorArguments = EMPTY_ARRAY; return decorator.apply(null, arguments); } else { // @decorator(args) decoratorArguments = Array.prototype.slice.call(arguments); return decorator; } }; } function quacksLikeADecorator(args) { return (((args.length === 2 || args.length === 3) && (typeof args[1] === "string" || typeof args[1] === "symbol")) || (args.length === 4 && args[3] === true)); } function deepEnhancer(v, _, name) { // it is an observable already, done if (isObservable(v)) return v; // something that can be converted and mutated? if (Array.isArray(v)) return observable.array(v, { name: name }); if (isPlainObject(v)) return observable.object(v, undefined, { name: name }); if (isES6Map(v)) return observable.map(v, { name: name }); if (isES6Set(v)) return observable.set(v, { name: name }); return v; } function shallowEnhancer(v, _, name) { if (v === undefined || v === null) return v; if (isObservableObject(v) || isObservableArray(v) || isObservableMap(v) || isObservableSet(v)) return v; if (Array.isArray(v)) return observable.array(v, { name: name, deep: false }); if (isPlainObject(v)) return observable.object(v, undefined, { name: name, deep: false }); if (isES6Map(v)) return observable.map(v, { name: name, deep: false }); if (isES6Set(v)) return observable.set(v, { name: name, deep: false }); return fail(process.env.NODE_ENV !== "production" && "The shallow modifier / decorator can only used in combination with arrays, objects, maps and sets"); } function referenceEnhancer(newValue) { // never turn into an observable return newValue; } function refStructEnhancer(v, oldValue, name) { if (process.env.NODE_ENV !== "production" && isObservable(v)) throw "observable.struct should not be used with observable values"; if (deepEqual(v, oldValue)) return oldValue; return v; } function createDecoratorForEnhancer(enhancer) { invariant(enhancer); var decorator = createPropDecorator(true, function (target, propertyName, descriptor, _decoratorTarget, decoratorArgs) { if (process.env.NODE_ENV !== "production") { invariant(!descriptor || !descriptor.get, "@observable cannot be used on getter (property \"" + stringifyKey(propertyName) + "\"), use @computed instead."); } var initialValue = descriptor ? descriptor.initializer ? descriptor.initializer.call(target) : descriptor.value : undefined; asObservableObject(target).addObservableProp(propertyName, initialValue, enhancer); }); var res = // Extra process checks, as this happens during module initialization typeof process !== "undefined" && process.env && process.env.NODE_ENV !== "production" ? function observableDecorator() { // This wrapper function is just to detect illegal decorator invocations, deprecate in a next version // and simply return the created prop decorator if (arguments.length < 2) return fail("Incorrect decorator invocation. @observable decorator doesn't expect any arguments"); return decorator.apply(null, arguments); } : decorator; res.enhancer = enhancer; return res; } // Predefined bags of create observable options, to avoid allocating temporarily option objects // in the majority of cases var defaultCreateObservableOptions = { deep: true, name: undefined, defaultDecorator: undefined, proxy: true }; Object.freeze(defaultCreateObservableOptions); function assertValidOption(key) { if (!/^(deep|name|equals|defaultDecorator|proxy)$/.test(key)) fail("invalid option for (extend)observable: " + key); } function asCreateObservableOptions(thing) { if (thing === null || thing === undefined) return defaultCreateObservableOptions; if (typeof thing === "string") return { name: thing, deep: true, proxy: true }; if (process.env.NODE_ENV !== "production") { if (typeof thing !== "object") return fail("expected options object"); Object.keys(thing).forEach(assertValidOption); } return thing; } var deepDecorator = createDecoratorForEnhancer(deepEnhancer); var shallowDecorator = createDecoratorForEnhancer(shallowEnhancer); var refDecorator = createDecoratorForEnhancer(referenceEnhancer); var refStructDecorator = createDecoratorForEnhancer(refStructEnhancer); function getEnhancerFromOptions(options) { return options.defaultDecorator ? options.defaultDecorator.enhancer : options.deep === false ? referenceEnhancer : deepEnhancer; } /** * Turns an object, array or function into a reactive structure. * @param v the value which should become observable. */ function createObservable(v, arg2, arg3) { // @observable someProp; if (typeof arguments[1] === "string" || typeof arguments[1] === "symbol") { return deepDecorator.apply(null, arguments); } // it is an observable already, done if (isObservable(v)) return v; // something that can be converted and mutated? var res = isPlainObject(v) ? observable.object(v, arg2, arg3) : Array.isArray(v) ? observable.array(v, arg2) : isES6Map(v) ? observable.map(v, arg2) : isES6Set(v) ? observable.set(v, arg2) : v; // this value could be converted to a new observable data structure, return it if (res !== v) return res; // otherwise, just box it fail(process.env.NODE_ENV !== "production" && "The provided value could not be converted into an observable. If you want just create an observable reference to the object use 'observable.box(value)'"); } var observableFactories = { box: function (value, options) { if (arguments.length > 2) incorrectlyUsedAsDecorator("box"); var o = asCreateObservableOptions(options); return new ObservableValue(value, getEnhancerFromOptions(o), o.name, true, o.equals); }, array: function (initialValues, options) { if (arguments.length > 2) incorrectlyUsedAsDecorator("array"); var o = asCreateObservableOptions(options); return createObservableArray(initialValues, getEnhancerFromOptions(o), o.name); }, map: function (initialValues, options) { if (arguments.length > 2) incorrectlyUsedAsDecorator("map"); var o = asCreateObservableOptions(options); return new ObservableMap(initialValues, getEnhancerFromOptions(o), o.name); }, set: function (initialValues, options) { if (arguments.length > 2) incorrectlyUsedAsDecorator("set"); var o = asCreateObservableOptions(options); return new ObservableSet(initialValues, getEnhancerFromOptions(o), o.name); }, object: function (props, decorators, options) { if (typeof arguments[1] === "string") incorrectlyUsedAsDecorator("object"); var o = asCreateObservableOptions(options); if (o.proxy === false) { return extendObservable({}, props, decorators, o); } else { var defaultDecorator = getDefaultDecoratorFromObjectOptions(o); var base = extendObservable({}, undefined, undefined, o); var proxy = createDynamicObservableObject(base); extendObservableObjectWithProperties(proxy, props, decorators, defaultDecorator); return proxy; } }, ref: refDecorator, shallow: shallowDecorator, deep: deepDecorator, struct: refStructDecorator }; var observable = createObservable; // weird trick to keep our typings nicely with our funcs, and still extend the observable function Object.keys(observableFactories).forEach(function (name) { return (observable[name] = observableFactories[name]); }); function incorrectlyUsedAsDecorator(methodName) { fail( // process.env.NODE_ENV !== "production" && "Expected one or two arguments to observable." + methodName + ". Did you accidentally try to use observable." + methodName + " as decorator?"); } var computedDecorator = createPropDecorator(false, function (instance, propertyName, descriptor, decoratorTarget, decoratorArgs) { if (process.env.NODE_ENV !== "production") { invariant(descriptor && descriptor.get, "Trying to declare a computed value for unspecified getter '" + stringifyKey(propertyName) + "'"); } var get = descriptor.get, set = descriptor.set; // initialValue is the descriptor for get / set props // Optimization: faster on decorator target or instance? Assuming target // Optimization: find out if declaring on instance isn't just faster. (also makes the property descriptor simpler). But, more memory usage.. // Forcing instance now, fixes hot reloadig issues on React Native: var options = decoratorArgs[0] || {}; asObservableObject(instance).addComputedProp(instance, propertyName, __assign({ get: get, set: set, context: instance }, options)); }); var computedStructDecorator = computedDecorator({ equals: comparer.structural }); /** * Decorator for class properties: @computed get value() { return expr; }. * For legacy purposes also invokable as ES5 observable created: `computed(() => expr)`; */ var computed = function computed(arg1, arg2, arg3) { if (typeof arg2 === "string") { // @computed return computedDecorator.apply(null, arguments); } if (arg1 !== null && typeof arg1 === "object" && arguments.length === 1) { // @computed({ options }) return computedDecorator.apply(null, arguments); } // computed(expr, options?) if (process.env.NODE_ENV !== "production") { invariant(typeof arg1 === "function", "First argument to `computed` should be an expression."); invariant(arguments.length < 3, "Computed takes one or two arguments if used as function"); } var opts = typeof arg2 === "object" ? arg2 : {}; opts.get = arg1; opts.set = typeof arg2 === "function" ? arg2 : opts.set; opts.name = opts.name || arg1.name || ""; /* for generated name */ return new ComputedValue(opts); }; computed.struct = computedStructDecorator; (function (IDerivationState) { // before being run or (outside batch and not being observed) // at this point derivation is not holding any data about dependency tree IDerivationState[IDerivationState["NOT_TRACKING"] = -1] = "NOT_TRACKING"; // no shallow dependency changed since last computation // won't recalculate derivation // this is what makes mobx fast IDerivationState[IDerivationState["UP_TO_DATE"] = 0] = "UP_TO_DATE"; // some deep dependency changed, but don't know if shallow dependency changed // will require to check first if UP_TO_DATE or POSSIBLY_STALE // currently only ComputedValue will propagate POSSIBLY_STALE // // having this state is second big optimization: // don't have to recompute on every dependency change, but only when it's needed IDerivationState[IDerivationState["POSSIBLY_STALE"] = 1] = "POSSIBLY_STALE"; // A shallow dependency has changed since last computation and the derivation // will need to recompute when it's needed next. IDerivationState[IDerivationState["STALE"] = 2] = "STALE"; })(exports.IDerivationState || (exports.IDerivationState = {})); var TraceMode; (function (TraceMode) { TraceMode[TraceMode["NONE"] = 0] = "NONE"; TraceMode[TraceMode["LOG"] = 1] = "LOG"; TraceMode[TraceMode["BREAK"] = 2] = "BREAK"; })(TraceMode || (TraceMode = {})); var CaughtException = /** @class */ (function () { function CaughtException(cause) { this.cause = cause; // Empty } return CaughtException; }()); function isCaughtException(e) { return e instanceof CaughtException; } /** * Finds out whether any dependency of the derivation has actually changed. * If dependenciesState is 1 then it will recalculate dependencies, * if any dependency changed it will propagate it by changing dependenciesState to 2. * * By iterating over the dependencies in the same order that they were reported and * stopping on the first change, all the recalculations are only called for ComputedValues * that will be tracked by derivation. That is because we assume that if the first x * dependencies of the derivation doesn't change then the derivation should run the same way * up until accessing x-th dependency. */ function shouldCompute(derivation) { switch (derivation.dependenciesState) { case exports.IDerivationState.UP_TO_DATE: return false; case exports.IDerivationState.NOT_TRACKING: case exports.IDerivationState.STALE: return true; case exports.IDerivationState.POSSIBLY_STALE: { // state propagation can occur outside of action/reactive context #2195 var prevAllowStateReads = allowStateReadsStart(true); var prevUntracked = untrackedStart(); // no need for those computeds to be reported, they will be picked up in trackDerivedFunction. var obs = derivation.observing, l = obs.length; for (var i = 0; i < l; i++) { var obj = obs[i]; if (isComputedValue(obj)) { if (globalState.disableErrorBoundaries) { obj.get(); } else { try { obj.get(); } catch (e) { // we are not interested in the value *or* exception at this moment, but if there is one, notify all untrackedEnd(prevUntracked); allowStateReadsEnd(prevAllowStateReads); return true; } } // if ComputedValue `obj` actually changed it will be computed and propagated to its observers. // and `derivation` is an observer of `obj` // invariantShouldCompute(derivation) if (derivation.dependenciesState === exports.IDerivationState.STALE) { untrackedEnd(prevUntracked); allowStateReadsEnd(prevAllowStateReads); return true; } } } changeDependenciesStateTo0(derivation); untrackedEnd(prevUntracked); allowStateReadsEnd(prevAllowStateReads); return false; } } } // function invariantShouldCompute(derivation: IDerivation) { // const newDepState = (derivation as any).dependenciesState // if ( // process.env.NODE_ENV === "production" && // (newDepState === IDerivationState.POSSIBLY_STALE || // newDepState === IDerivationState.NOT_TRACKING) // ) // fail("Illegal dependency state") // } function isComputingDerivation() { return globalState.trackingDerivation !== null; // filter out actions inside computations } function checkIfStateModificationsAreAllowed(atom) { var hasObservers = atom.observers.size > 0; // Should never be possible to change an observed observable from inside computed, see #798 if (globalState.computationDepth > 0 && hasObservers) fail(process.env.NODE_ENV !== "production" && "Computed values are not allowed to cause side effects by changing observables that are already being observed. Tried to modify: " + atom.name); // Should not be possible to change observed state outside strict mode, except during initialization, see #563 if (!globalState.allowStateChanges && (hasObservers || globalState.enforceActions === "strict")) fail(process.env.NODE_ENV !== "production" && (globalState.enforceActions ? "Since strict-mode is enabled, changing observed observable values outside actions is not allowed. Please wrap the code in an `action` if this change is intended. Tried to modify: " : "Side effects like changing state are not allowed at this point. Are you trying to modify state from, for example, the render function of a React component? Tried to modify: ") + atom.name); } function checkIfStateReadsAreAllowed(observable) { if (process.env.NODE_ENV !== "production" && !globalState.allowStateReads && globalState.observableRequiresReaction) { console.warn("[mobx] Observable " + observable.name + " being read outside a reactive context"); } } /** * Executes the provided function `f` and tracks which observables are being accessed. * The tracking information is stored on the `derivation` object and the derivation is registered * as observer of any of the accessed observables. */ function trackDerivedFunction(derivation, f, context) { var prevAllowStateReads = allowStateReadsStart(true); // pre allocate array allocation + room for variation in deps // array will be trimmed by bindDependencies changeDependenciesStateTo0(derivation); derivation.newObserving = new Array(derivation.observing.length + 100); derivation.unboundDepsCount = 0; derivation.runId = ++globalState.runId; var prevTracking = globalState.trackingDerivation; globalState.trackingDerivation = derivation; var result; if (globalState.disableErrorBoundaries === true) { result = f.call(context); } else { try { result = f.call(context); } catch (e) { result = new CaughtException(e); } } globalState.trackingDerivation = prevTracking; bindDependencies(derivation); warnAboutDerivationWithoutDependencies(derivation); allowStateReadsEnd(prevAllowStateReads); return result; } function warnAboutDerivationWithoutDependencies(derivation) { if (process.env.NODE_ENV === "production") return; if (derivation.observing.length !== 0) return; if (globalState.reactionRequiresObservable || derivation.requiresObservable) { console.warn("[mobx] Derivation " + derivation.name + " is created/updated without reading any observable value"); } } /** * diffs newObserving with observing. * update observing to be newObserving with unique observables * notify observers that become observed/unobserved */ function bindDependencies(derivation) { // invariant(derivation.dependenciesState !== IDerivationState.NOT_TRACKING, "INTERNAL ERROR bindDependencies expects derivation.dependenciesState !== -1"); var prevObserving = derivation.observing; var observing = (derivation.observing = derivation.newObserving); var lowestNewObservingDerivationState = exports.IDerivationState.UP_TO_DATE; // Go through all new observables and check diffValue: (this list can contain duplicates): // 0: first occurrence, change to 1 and keep it // 1: extra occurrence, drop it var i0 = 0, l = derivation.unboundDepsCount; for (var i = 0; i < l; i++) { var dep = observing[i]; if (dep.diffValue === 0) { dep.diffValue = 1; if (i0 !== i) observing[i0] = dep; i0++; } // Upcast is 'safe' here, because if dep is IObservable, `dependenciesState` will be undefined, // not hitting the condition if (dep.dependenciesState > lowestNewObservingDerivationState) { lowestNewObservingDerivationState = dep.dependenciesState; } } observing.length = i0; derivation.newObserving = null; // newObserving shouldn't be needed outside tracking (statement moved down to work around FF bug, see #614) // Go through all old observables and check diffValue: (it is unique after last bindDependencies) // 0: it's not in new observables, unobserve it // 1: it keeps being observed, don't want to notify it. change to 0 l = prevObserving.length; while (l--) { var dep = prevObserving[l]; if (dep.diffValue === 0) { removeObserver(dep, derivation); } dep.diffValue = 0; } // Go through all new observables and check diffValue: (now it should be unique) // 0: it was set to 0 in last loop. don't need to do anything. // 1: it wasn't observed, let's observe it. set back to 0 while (i0--) { var dep = observing[i0]; if (dep.diffValue === 1) { dep.diffValue = 0; addObserver(dep, derivation); } } // Some new observed derivations may become stale during this derivation computation // so they have had no chance to propagate staleness (#916) if (lowestNewObservingDerivationState !== exports.IDerivationState.UP_TO_DATE) { derivation.dependenciesState = lowestNewObservingDerivationState; derivation.onBecomeStale(); } } function clearObserving(derivation) { // invariant(globalState.inBatch > 0, "INTERNAL ERROR clearObserving should be called only inside batch"); var obs = derivation.observing; derivation.observing = []; var i = obs.length; while (i--) removeObserver(obs[i], derivation); derivation.dependenciesState = exports.IDerivationState.NOT_TRACKING; } function untracked(action) { var prev = untrackedStart(); try { return action(); } finally { untrackedEnd(prev); } } function untrackedStart() { var prev = globalState.trackingDerivation; globalState.trackingDerivation = null; return prev; } function untrackedEnd(prev) { globalState.trackingDerivation = prev; } function allowStateReadsStart(allowStateReads) { var prev = globalState.allowStateReads; globalState.allowStateReads = allowStateReads; return prev; } function allowStateReadsEnd(prev) { globalState.allowStateReads = prev; } /** * needed to keep `lowestObserverState` correct. when changing from (2 or 1) to 0 * */ function changeDependenciesStateTo0(derivation) { if (derivation.dependenciesState === exports.IDerivationState.UP_TO_DATE) return; derivation.dependenciesState = exports.IDerivationState.UP_TO_DATE; var obs = derivation.observing; var i = obs.length; while (i--) obs[i].lowestObserverState = exports.IDerivationState.UP_TO_DATE; } // we don't use globalState for these in order to avoid possible issues with multiple // mobx versions var currentActionId = 0; var nextActionId = 1; var functionNameDescriptor = Object.getOwnPropertyDescriptor(function () { }, "name"); var isFunctionNameConfigurable = functionNameDescriptor && functionNameDescriptor.configurable; function createAction(actionName, fn, ref) { if (process.env.NODE_ENV !== "production") { invariant(typeof fn === "function", "`action` can only be invoked on functions"); if (typeof actionName !== "string" || !actionName) fail("actions should have valid names, got: '" + actionName + "'"); } var res = function () { return executeAction(actionName, fn, ref || this, arguments); }; res.isMobxAction = true; if (process.env.NODE_ENV !== "production") { if (isFunctionNameConfigurable) { Object.defineProperty(res, "name", { value: actionName }); } } return res; } function executeAction(actionName, fn, scope, args) { var runInfo = _startAction(actionName, scope, args); try { return fn.apply(scope, args); } catch (err) { runInfo.error = err; throw err; } finally { _endAction(runInfo); } } function _startAction(actionName, scope, args) { var notifySpy = isSpyEnabled() && !!actionName; var startTime = 0; if (notifySpy && process.env.NODE_ENV !== "production") { startTime = Date.now(); var l = (args && args.length) || 0; var flattendArgs = new Array(l); if (l > 0) for (var i = 0; i < l; i++) flattendArgs[i] = args[i]; spyReportStart({ type: "action", name: actionName, object: scope, arguments: flattendArgs }); } var prevDerivation = untrackedStart(); startBatch(); var prevAllowStateChanges = allowStateChangesStart(true); var prevAllowStateReads = allowStateReadsStart(true); var runInfo = { prevDerivation: prevDerivation, prevAllowStateChanges: prevAllowStateChanges, prevAllowStateReads: prevAllowStateReads, notifySpy: notifySpy, startTime: startTime, actionId: nextActionId++, parentActionId: currentActionId }; currentActionId = runInfo.actionId; return runInfo; } function _endAction(runInfo) { if (currentActionId !== runInfo.actionId) { fail("invalid action stack. did you forget to finish an action?"); } currentActionId = runInfo.parentActionId; if (runInfo.error !== undefined) { globalState.suppressReactionErrors = true; } allowStateChangesEnd(runInfo.prevAllowStateChanges); allowStateReadsEnd(runInfo.prevAllowStateReads); endBatch(); untrackedEnd(runInfo.prevDerivation); if (runInfo.notifySpy && process.env.NODE_ENV !== "production") { spyReportEnd({ time: Date.now() - runInfo.startTime }); } globalState.suppressReactionErrors = false; } function allowStateChanges(allowStateChanges, func) { var prev = allowStateChangesStart(allowStateChanges); var res; try { res = func(); } finally { allowStateChangesEnd(prev); } return res; } function allowStateChangesStart(allowStateChanges) { var prev = globalState.allowStateChanges; globalState.allowStateChanges = allowStateChanges; return prev; } function allowStateChangesEnd(prev) { globalState.allowStateChanges = prev; } function allowStateChangesInsideComputed(func) { var prev = globalState.computationDepth; globalState.computationDepth = 0; var res; try { res = func(); } finally { globalState.computationDepth = prev; } return res; } var ObservableValue = /** @class */ (function (_super) { __extends(ObservableValue, _super); function ObservableValue(value, enhancer, name, notifySpy, equals) { if (name === void 0) { name = "ObservableValue@" + getNextId(); } if (notifySpy === void 0) { notifySpy = true; } if (equals === void 0) { equals = comparer.default; } var _this = _super.call(this, name) || this; _this.enhancer = enhancer; _this.name = name; _this.equals = equals; _this.hasUnreportedChange = false; _this.value = enhancer(value, undefined, name); if (notifySpy && isSpyEnabled() && process.env.NODE_ENV !== "production") { // only notify spy if this is a stand-alone observable spyReport({ type: "create", name: _this.name, newValue: "" + _this.value }); } return _this; } ObservableValue.prototype.dehanceValue = function (value) { if (this.dehancer !== undefined) return this.dehancer(value); return value; }; ObservableValue.prototype.set = function (newValue) { var oldValue = this.value; newValue = this.prepareNewValue(newValue); if (newValue !== globalState.UNCHANGED) { var notifySpy = isSpyEnabled(); if (notifySpy && process.env.NODE_ENV !== "production") { spyReportStart({ type: "update", name: this.name, newValue: newValue, oldValue: oldValue }); } this.setNewValue(newValue); if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd(); } }; ObservableValue.prototype.prepareNewValue = function (newValue) { checkIfStateModificationsAreAllowed(this); if (hasInterceptors(this)) { var change = interceptChange(this, { object: this, type: "update", newValue: newValue }); if (!change) return globalState.UNCHANGED; newValue = change.newValue; } // apply modifier newValue = this.enhancer(newValue, this.value, this.name); return this.equals(this.value, newValue) ? globalState.UNCHANGED : newValue; }; ObservableValue.prototype.setNewValue = function (newValue) { var oldValue = this.value; this.value = newValue; this.reportChanged(); if (hasListeners(this)) { notifyListeners(this, { type: "update", object: this, newValue: newValue, oldValue: oldValue }); } }; ObservableValue.prototype.get = function () { this.reportObserved(); return this.dehanceValue(this.value); }; ObservableValue.prototype.intercept = function (handler) { return registerInterceptor(this, handler); }; ObservableValue.prototype.observe = function (listener, fireImmediately) { if (fireImmediately) listener({ object: this, type: "update", newValue: this.value, oldValue: undefined }); return registerListener(this, listener); }; ObservableValue.prototype.toJSON = function () { return this.get(); }; ObservableValue.prototype.toString = function () { return this.name + "[" + this.value + "]"; }; ObservableValue.prototype.valueOf = function () { return toPrimitive(this.get()); }; ObservableValue.prototype[Symbol.toPrimitive] = function () { return this.valueOf(); }; return ObservableValue; }(Atom)); var isObservableValue = createInstanceofPredicate("ObservableValue", ObservableValue); /** * A node in the state dependency root that observes other nodes, and can be observed itself. * * ComputedValue will remember the result of the computation for the duration of the batch, or * while being observed. * * During this time it will recompute only when one of its direct dependencies changed, * but only when it is being accessed with `ComputedValue.get()`. * * Implementation description: * 1. First time it's being accessed it will compute and remember result * give back remembered result until 2. happens * 2. First time any deep dependency change, propagate POSSIBLY_STALE to all observers, wait for 3. * 3. When it's being accessed, recompute if any shallow dependency changed. * if result changed: propagate STALE to all observers, that were POSSIBLY_STALE from the last step. * go to step 2. either way * * If at any point it's outside batch and it isn't observed: reset everything and go to 1. */ var ComputedValue = /** @class */ (function () { /** * Create a new computed value based on a function expression. * * The `name` property is for debug purposes only. * * The `equals` property specifies the comparer function to use to determine if a newly produced * value differs from the previous value. Two comparers are provided in the library; `defaultComparer` * compares based on identity comparison (===), and `structualComparer` deeply compares the structure. * Structural comparison can be convenient if you always produce a new aggregated object and * don't want to notify observers if it is structurally the same. * This is useful for working with vectors, mouse coordinates etc. */ function ComputedValue(options) { this.dependenciesState = exports.IDerivationState.NOT_TRACKING; this.observing = []; // nodes we are looking at. Our value depends on these nodes this.newObserving = null; // during tracking it's an array with new observed observers this.isBeingObserved = false; this.isPendingUnobservation = false; this.observers = new Set(); this.diffValue = 0; this.runId = 0; this.lastAccessedBy = 0; this.lowestObserverState = exports.IDerivationState.UP_TO_DATE; this.unboundDepsCount = 0; this.__mapid = "#" + getNextId(); this.value = new CaughtException(null); this.isComputing = false; // to check for cycles this.isRunningSetter = false; this.isTracing = TraceMode.NONE; invariant(options.get, "missing option for computed: get"); this.derivation = options.get; this.name = options.name || "ComputedValue@" + getNextId(); if (options.set) this.setter = createAction(this.name + "-setter", options.set); this.equals = options.equals || (options.compareStructural || options.struct ? comparer.structural : comparer.default); this.scope = options.context; this.requiresReaction = !!options.requiresReaction; this.keepAlive = !!options.keepAlive; } ComputedValue.prototype.onBecomeStale = function () { propagateMaybeChanged(this); }; ComputedValue.prototype.onBecomeObserved = function () { if (this.onBecomeObservedListeners) { this.onBecomeObservedListeners.forEach(function (listener) { return listener(); }); } }; ComputedValue.prototype.onBecomeUnobserved = function () { if (this.onBecomeUnobservedListeners) { this.onBecomeUnobservedListeners.forEach(function (listener) { return listener(); }); } }; /** * Returns the current value of this computed value. * Will evaluate its computation first if needed. */ ComputedValue.prototype.get = function () { if (this.isComputing) fail("Cycle detected in computation " + this.name + ": " + this.derivation); if (globalState.inBatch === 0 && this.observers.size === 0 && !this.keepAlive) { if (shouldCompute(this)) { this.warnAboutUntrackedRead(); startBatch(); // See perf test 'computed memoization' this.value = this.computeValue(false); endBatch(); } } else { reportObserved(this); if (shouldCompute(this)) if (this.trackAndCompute()) propagateChangeConfirmed(this); } var result = this.value; if (isCaughtException(result)) throw result.cause; return result; }; ComputedValue.prototype.peek = function () { var res = this.computeValue(false); if (isCaughtException(res)) throw res.cause; return res; }; ComputedValue.prototype.set = function (value) { if (this.setter) { invariant(!this.isRunningSetter, "The setter of computed value '" + this.name + "' is trying to update itself. Did you intend to update an _observable_ value, instead of the computed property?"); this.isRunningSetter = true; try { this.setter.call(this.scope, value); } finally { this.isRunningSetter = false; } } else invariant(false, process.env.NODE_ENV !== "production" && "[ComputedValue '" + this.name + "'] It is not possible to assign a new value to a computed value."); }; ComputedValue.prototype.trackAndCompute = function () { if (isSpyEnabled() && process.env.NODE_ENV !== "production") { spyReport({ object: this.scope, type: "compute", name: this.name }); } var oldValue = this.value; var wasSuspended = /* see #1208 */ this.dependenciesState === exports.IDerivationState.NOT_TRACKING; var newValue = this.computeValue(true); var changed = wasSuspended || isCaughtException(oldValue) || isCaughtException(newValue) || !this.equals(oldValue, newValue); if (changed) { this.value = newValue; } return changed; }; ComputedValue.prototype.computeValue = function (track) { this.isComputing = true; globalState.computationDepth++; var res; if (track) { res = trackDerivedFunction(this, this.derivation, this.scope); } else { if (globalState.disableErrorBoundaries === true) { res = this.derivation.call(this.scope); } else { try { res = this.derivation.call(this.scope); } catch (e) { res = new CaughtException(e); } } } globalState.computationDepth--; this.isComputing = false; return res; }; ComputedValue.prototype.suspend = function () { if (!this.keepAlive) { clearObserving(this); this.value = undefined; // don't hold on to computed value! } }; ComputedValue.prototype.observe = function (listener, fireImmediately) { var _this = this; var firstTime = true; var prevValue = undefined; return autorun(function () { var newValue = _this.get(); if (!firstTime || fireImmediately) { var prevU = untrackedStart(); listener({ type: "update", object: _this, newValue: newValue, oldValue: prevValue }); untrackedEnd(prevU); } firstTime = false; prevValue = newValue; }); }; ComputedValue.prototype.warnAboutUntrackedRead = function () { if (process.env.NODE_ENV === "production") return; if (this.requiresReaction === true) { fail("[mobx] Computed value " + this.name + " is read outside a reactive context"); } if (this.isTracing !== TraceMode.NONE) { console.log("[mobx.trace] '" + this.name + "' is being read outside a reactive context. Doing a full recompute"); } if (globalState.computedRequiresReaction) { console.warn("[mobx] Computed value " + this.name + " is being read outside a reactive context. Doing a full recompute"); } }; ComputedValue.prototype.toJSON = function () { return this.get(); }; ComputedValue.prototype.toString = function () { return this.name + "[" + this.derivation.toString() + "]"; }; ComputedValue.prototype.valueOf = function () { return toPrimitive(this.get()); }; ComputedValue.prototype[Symbol.toPrimitive] = function () { return this.valueOf(); }; return ComputedValue; }()); var isComputedValue = createInstanceofPredicate("ComputedValue", ComputedValue); /** * These values will persist if global state is reset */ var persistentKeys = [ "mobxGuid", "spyListeners", "enforceActions", "computedRequiresReaction", "reactionRequiresObservable", "observableRequiresReaction", "allowStateReads", "disableErrorBoundaries", "runId", "UNCHANGED" ]; var MobXGlobals = /** @class */ (function () { function MobXGlobals() { /** * MobXGlobals version. * MobX compatiblity with other versions loaded in memory as long as this version matches. * It indicates that the global state still stores similar information * * N.B: this version is unrelated to the package version of MobX, and is only the version of the * internal state storage of MobX, and can be the same across many different package versions */ this.version = 5; /** * globally unique token to signal unchanged */ this.UNCHANGED = {}; /** * Currently running derivation */ this.trackingDerivation = null; /** * Are we running a computation currently? (not a reaction) */ this.computationDepth = 0; /** * Each time a derivation is tracked, it is assigned a unique run-id */ this.runId = 0; /** * 'guid' for general purpose. Will be persisted amongst resets. */ this.mobxGuid = 0; /** * Are we in a batch block? (and how many of them) */ this.inBatch = 0; /** * Observables that don't have observers anymore, and are about to be * suspended, unless somebody else accesses it in the same batch * * @type {IObservable[]} */ this.pendingUnobservations = []; /** * List of scheduled, not yet executed, reactions. */ this.pendingReactions = []; /** * Are we currently processing reactions? */ this.isRunningReactions = false; /** * Is it allowed to change observables at this point? * In general, MobX doesn't allow that when running computations and React.render. * To ensure that those functions stay pure. */ this.allowStateChanges = true; /** * Is it allowed to read observables at this point? * Used to hold the state needed for `observableRequiresReaction` */ this.allowStateReads = true; /** * If strict mode is enabled, state changes are by default not allowed */ this.enforceActions = false; /** * Spy callbacks */ this.spyListeners = []; /** * Globally attached error handlers that react specifically to errors in reactions */ this.globalReactionErrorHandlers = []; /** * Warn if computed values are accessed outside a reactive context */ this.computedRequiresReaction = false; /** * (Experimental) * Warn if you try to create to derivation / reactive context without accessing any observable. */ this.reactionRequiresObservable = false; /** * (Experimental) * Warn if observables are accessed outside a reactive context */ this.observableRequiresReaction = false; /** * Allows overwriting of computed properties, useful in tests but not prod as it can cause * memory leaks. See https://github.com/mobxjs/mobx/issues/1867 */ this.computedConfigurable = false; /* * Don't catch and rethrow exceptions. This is useful for inspecting the state of * the stack when an exception occurs while debugging. */ this.disableErrorBoundaries = false; /* * If true, we are already handling an exception in an action. Any errors in reactions should be suppressed, as * they are not the cause, see: https://github.com/mobxjs/mobx/issues/1836 */ this.suppressReactionErrors = false; } return MobXGlobals; }()); var mockGlobal = {}; function getGlobal() { if (typeof window !== "undefined") { return window; } if (typeof global !== "undefined") { return global; } if (typeof self !== "undefined") { return self; } return mockGlobal; } var canMergeGlobalState = true; var isolateCalled = false; var globalState = (function () { var global = getGlobal(); if (global.__mobxInstanceCount > 0 && !global.__mobxGlobals) canMergeGlobalState = false; if (global.__mobxGlobals && global.__mobxGlobals.version !== new MobXGlobals().version) canMergeGlobalState = false; if (!canMergeGlobalState) { setTimeout(function () { if (!isolateCalled) { fail("There are multiple, different versions of MobX active. Make sure MobX is loaded only once or use `configure({ isolateGlobalState: true })`"); } }, 1); return new MobXGlobals(); } else if (global.__mobxGlobals) { global.__mobxInstanceCount += 1; if (!global.__mobxGlobals.UNCHANGED) global.__mobxGlobals.UNCHANGED = {}; // make merge backward compatible return global.__mobxGlobals; } else { global.__mobxInstanceCount = 1; return (global.__mobxGlobals = new MobXGlobals()); } })(); function isolateGlobalState() { if (globalState.pendingReactions.length || globalState.inBatch || globalState.isRunningReactions) fail("isolateGlobalState should be called before MobX is running any reactions"); isolateCalled = true; if (canMergeGlobalState) { if (--getGlobal().__mobxInstanceCount === 0) getGlobal().__mobxGlobals = undefined; globalState = new MobXGlobals(); } } function getGlobalState() { return globalState; } /** * For testing purposes only; this will break the internal state of existing observables, * but can be used to get back at a stable state after throwing errors */ function resetGlobalState() { var defaultGlobals = new MobXGlobals(); for (var key in defaultGlobals) if (persistentKeys.indexOf(key) === -1) globalState[key] = defaultGlobals[key]; globalState.allowStateChanges = !globalState.enforceActions; } function hasObservers(observable) { return observable.observers && observable.observers.size > 0; } function getObservers(observable) { return observable.observers; } // function invariantObservers(observable: IObservable) { // const list = observable.observers // const map = observable.observersIndexes // const l = list.length // for (let i = 0; i < l; i++) { // const id = list[i].__mapid // if (i) { // invariant(map[id] === i, "INTERNAL ERROR maps derivation.__mapid to index in list") // for performance // } else { // invariant(!(id in map), "INTERNAL ERROR observer on index 0 shouldn't be held in map.") // for performance // } // } // invariant( // list.length === 0 || Object.keys(map).length === list.length - 1, // "INTERNAL ERROR there is no junk in map" // ) // } function addObserver(observable, node) { // invariant(node.dependenciesState !== -1, "INTERNAL ERROR, can add only dependenciesState !== -1"); // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR add already added node"); // invariantObservers(observable); observable.observers.add(node); if (observable.lowestObserverState > node.dependenciesState) observable.lowestObserverState = node.dependenciesState; // invariantObservers(observable); // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR didn't add node"); } function removeObserver(observable, node) { // invariant(globalState.inBatch > 0, "INTERNAL ERROR, remove should be called only inside batch"); // invariant(observable._observers.indexOf(node) !== -1, "INTERNAL ERROR remove already removed node"); // invariantObservers(observable); observable.observers.delete(node); if (observable.observers.size === 0) { // deleting last observer queueForUnobservation(observable); } // invariantObservers(observable); // invariant(observable._observers.indexOf(node) === -1, "INTERNAL ERROR remove already removed node2"); } function queueForUnobservation(observable) { if (observable.isPendingUnobservation === false) { // invariant(observable._observers.length === 0, "INTERNAL ERROR, should only queue for unobservation unobserved observables"); observable.isPendingUnobservation = true; globalState.pendingUnobservations.push(observable); } } /** * Batch starts a transaction, at least for purposes of memoizing ComputedValues when nothing else does. * During a batch `onBecomeUnobserved` will be called at most once per observable. * Avoids unnecessary recalculations. */ function startBatch() { globalState.inBatch++; } function endBatch() { if (--globalState.inBatch === 0) { runReactions(); // the batch is actually about to finish, all unobserving should happen here. var list = globalState.pendingUnobservations; for (var i = 0; i < list.length; i++) { var observable = list[i]; observable.isPendingUnobservation = false; if (observable.observers.size === 0) { if (observable.isBeingObserved) { // if this observable had reactive observers, trigger the hooks observable.isBeingObserved = false; observable.onBecomeUnobserved(); } if (observable instanceof ComputedValue) { // computed values are automatically teared down when the last observer leaves // this process happens recursively, this computed might be the last observable of another, etc.. observable.suspend(); } } } globalState.pendingUnobservations = []; } } function reportObserved(observable) { checkIfStateReadsAreAllowed(observable); var derivation = globalState.trackingDerivation; if (derivation !== null) { /** * Simple optimization, give each derivation run an unique id (runId) * Check if last time this observable was accessed the same runId is used * if this is the case, the relation is already known */ if (derivation.runId !== observable.lastAccessedBy) { observable.lastAccessedBy = derivation.runId; // Tried storing newObserving, or observing, or both as Set, but performance didn't come close... derivation.newObserving[derivation.unboundDepsCount++] = observable; if (!observable.isBeingObserved) { observable.isBeingObserved = true; observable.onBecomeObserved(); } } return true; } else if (observable.observers.size === 0 && globalState.inBatch > 0) { queueForUnobservation(observable); } return false; } // function invariantLOS(observable: IObservable, msg: string) { // // it's expensive so better not run it in produciton. but temporarily helpful for testing // const min = getObservers(observable).reduce((a, b) => Math.min(a, b.dependenciesState), 2) // if (min >= observable.lowestObserverState) return // <- the only assumption about `lowestObserverState` // throw new Error( // "lowestObserverState is wrong for " + // msg + // " because " + // min + // " < " + // observable.lowestObserverState // ) // } /** * NOTE: current propagation mechanism will in case of self reruning autoruns behave unexpectedly * It will propagate changes to observers from previous run * It's hard or maybe impossible (with reasonable perf) to get it right with current approach * Hopefully self reruning autoruns aren't a feature people should depend on * Also most basic use cases should be ok */ // Called by Atom when its value changes function propagateChanged(observable) { // invariantLOS(observable, "changed start"); if (observable.lowestObserverState === exports.IDerivationState.STALE) return; observable.lowestObserverState = exports.IDerivationState.STALE; // Ideally we use for..of here, but the downcompiled version is really slow... observable.observers.forEach(function (d) { if (d.dependenciesState === exports.IDerivationState.UP_TO_DATE) { if (d.isTracing !== TraceMode.NONE) { logTraceInfo(d, observable); } d.onBecomeStale(); } d.dependenciesState = exports.IDerivationState.STALE; }); // invariantLOS(observable, "changed end"); } // Called by ComputedValue when it recalculate and its value changed function propagateChangeConfirmed(observable) { // invariantLOS(observable, "confirmed start"); if (observable.lowestObserverState === exports.IDerivationState.STALE) return; observable.lowestObserverState = exports.IDerivationState.STALE; observable.observers.forEach(function (d) { if (d.dependenciesState === exports.IDerivationState.POSSIBLY_STALE) d.dependenciesState = exports.IDerivationState.STALE; else if (d.dependenciesState === exports.IDerivationState.UP_TO_DATE // this happens during computing of `d`, just keep lowestObserverState up to date. ) observable.lowestObserverState = exports.IDerivationState.UP_TO_DATE; }); // invariantLOS(observable, "confirmed end"); } // Used by computed when its dependency changed, but we don't wan't to immediately recompute. function propagateMaybeChanged(observable) { // invariantLOS(observable, "maybe start"); if (observable.lowestObserverState !== exports.IDerivationState.UP_TO_DATE) return; observable.lowestObserverState = exports.IDerivationState.POSSIBLY_STALE; observable.observers.forEach(function (d) { if (d.dependenciesState === exports.IDerivationState.UP_TO_DATE) { d.dependenciesState = exports.IDerivationState.POSSIBLY_STALE; if (d.isTracing !== TraceMode.NONE) { logTraceInfo(d, observable); } d.onBecomeStale(); } }); // invariantLOS(observable, "maybe end"); } function logTraceInfo(derivation, observable) { console.log("[mobx.trace] '" + derivation.name + "' is invalidated due to a change in: '" + observable.name + "'"); if (derivation.isTracing === TraceMode.BREAK) { var lines = []; printDepTree(getDependencyTree(derivation), lines, 1); // prettier-ignore new Function("debugger;\n/*\nTracing '" + derivation.name + "'\n\nYou are entering this break point because derivation '" + derivation.name + "' is being traced and '" + observable.name + "' is now forcing it to update.\nJust follow the stacktrace you should now see in the devtools to see precisely what piece of your code is causing this update\nThe stackframe you are looking for is at least ~6-8 stack-frames up.\n\n" + (derivation instanceof ComputedValue ? derivation.derivation.toString().replace(/[*]\//g, "/") : "") + "\n\nThe dependencies for this derivation are:\n\n" + lines.join("\n") + "\n*/\n ")(); } } function printDepTree(tree, lines, depth) { if (lines.length >= 1000) { lines.push("(and many more)"); return; } lines.push("" + new Array(depth).join("\t") + tree.name); // MWE: not the fastest, but the easiest way :) if (tree.dependencies) tree.dependencies.forEach(function (child) { return printDepTree(child, lines, depth + 1); }); } var Reaction = /** @class */ (function () { function Reaction(name, onInvalidate, errorHandler, requiresObservable) { if (name === void 0) { name = "Reaction@" + getNextId(); } if (requiresObservable === void 0) { requiresObservable = false; } this.name = name; this.onInvalidate = onInvalidate; this.errorHandler = errorHandler; this.requiresObservable = requiresObservable; this.observing = []; // nodes we are looking at. Our value depends on these nodes this.newObserving = []; this.dependenciesState = exports.IDerivationState.NOT_TRACKING; this.diffValue = 0; this.runId = 0; this.unboundDepsCount = 0; this.__mapid = "#" + getNextId(); this.isDisposed = false; this._isScheduled = false; this._isTrackPending = false; this._isRunning = false; this.isTracing = TraceMode.NONE; } Reaction.prototype.onBecomeStale = function () { this.schedule(); }; Reaction.prototype.schedule = function () { if (!this._isScheduled) { this._isScheduled = true; globalState.pendingReactions.push(this); runReactions(); } }; Reaction.prototype.isScheduled = function () { return this._isScheduled; }; /** * internal, use schedule() if you intend to kick off a reaction */ Reaction.prototype.runReaction = function () { if (!this.isDisposed) { startBatch(); this._isScheduled = false; if (shouldCompute(this)) { this._isTrackPending = true; try { this.onInvalidate(); if (this._isTrackPending && isSpyEnabled() && process.env.NODE_ENV !== "production") { // onInvalidate didn't trigger track right away.. spyReport({ name: this.name, type: "scheduled-reaction" }); } } catch (e) { this.reportExceptionInDerivation(e); } } endBatch(); } }; Reaction.prototype.track = function (fn) { if (this.isDisposed) { return; // console.warn("Reaction already disposed") // Note: Not a warning / error in mobx 4 either } startBatch(); var notify = isSpyEnabled(); var startTime; if (notify && process.env.NODE_ENV !== "production") { startTime = Date.now(); spyReportStart({ name: this.name, type: "reaction" }); } this._isRunning = true; var result = trackDerivedFunction(this, fn, undefined); this._isRunning = false; this._isTrackPending = false; if (this.isDisposed) { // disposed during last run. Clean up everything that was bound after the dispose call. clearObserving(this); } if (isCaughtException(result)) this.reportExceptionInDerivation(result.cause); if (notify && process.env.NODE_ENV !== "production") { spyReportEnd({ time: Date.now() - startTime }); } endBatch(); }; Reaction.prototype.reportExceptionInDerivation = function (error) { var _this = this; if (this.errorHandler) { this.errorHandler(error, this); return; } if (globalState.disableErrorBoundaries) throw error; var message = "[mobx] Encountered an uncaught exception that was thrown by a reaction or observer component, in: '" + this + "'"; if (globalState.suppressReactionErrors) { console.warn("[mobx] (error in reaction '" + this.name + "' suppressed, fix error of causing action below)"); // prettier-ignore } else { console.error(message, error); /** If debugging brought you here, please, read the above message :-). Tnx! */ } if (isSpyEnabled()) { spyReport({ type: "error", name: this.name, message: message, error: "" + error }); } globalState.globalReactionErrorHandlers.forEach(function (f) { return f(error, _this); }); }; Reaction.prototype.dispose = function () { if (!this.isDisposed) { this.isDisposed = true; if (!this._isRunning) { // if disposed while running, clean up later. Maybe not optimal, but rare case startBatch(); clearObserving(this); endBatch(); } } }; Reaction.prototype.getDisposer = function () { var r = this.dispose.bind(this); r[$mobx] = this; return r; }; Reaction.prototype.toString = function () { return "Reaction[" + this.name + "]"; }; Reaction.prototype.trace = function (enterBreakPoint) { if (enterBreakPoint === void 0) { enterBreakPoint = false; } trace(this, enterBreakPoint); }; return Reaction; }()); function onReactionError(handler) { globalState.globalReactionErrorHandlers.push(handler); return function () { var idx = globalState.globalReactionErrorHandlers.indexOf(handler); if (idx >= 0) globalState.globalReactionErrorHandlers.splice(idx, 1); }; } /** * Magic number alert! * Defines within how many times a reaction is allowed to re-trigger itself * until it is assumed that this is gonna be a never ending loop... */ var MAX_REACTION_ITERATIONS = 100; var reactionScheduler = function (f) { return f(); }; function runReactions() { // Trampolining, if runReactions are already running, new reactions will be picked up if (globalState.inBatch > 0 || globalState.isRunningReactions) return; reactionScheduler(runReactionsHelper); } function runReactionsHelper() { globalState.isRunningReactions = true; var allReactions = globalState.pendingReactions; var iterations = 0; // While running reactions, new reactions might be triggered. // Hence we work with two variables and check whether // we converge to no remaining reactions after a while. while (allReactions.length > 0) { if (++iterations === MAX_REACTION_ITERATIONS) { console.error("Reaction doesn't converge to a stable state after " + MAX_REACTION_ITERATIONS + " iterations." + (" Probably there is a cycle in the reactive function: " + allReactions[0])); allReactions.splice(0); // clear reactions } var remainingReactions = allReactions.splice(0); for (var i = 0, l = remainingReactions.length; i < l; i++) remainingReactions[i].runReaction(); } globalState.isRunningReactions = false; } var isReaction = createInstanceofPredicate("Reaction", Reaction); function setReactionScheduler(fn) { var baseScheduler = reactionScheduler; reactionScheduler = function (f) { return fn(function () { return baseScheduler(f); }); }; } function isSpyEnabled() { return process.env.NODE_ENV !== "production" && !!globalState.spyListeners.length; } function spyReport(event) { if (process.env.NODE_ENV === "production") return; // dead code elimination can do the rest if (!globalState.spyListeners.length) return; var listeners = globalState.spyListeners; for (var i = 0, l = listeners.length; i < l; i++) listeners[i](event); } function spyReportStart(event) { if (process.env.NODE_ENV === "production") return; var change = __assign(__assign({}, event), { spyReportStart: true }); spyReport(change); } var END_EVENT = { spyReportEnd: true }; function spyReportEnd(change) { if (process.env.NODE_ENV === "production") return; if (change) spyReport(__assign(__assign({}, change), { spyReportEnd: true })); else spyReport(END_EVENT); } function spy(listener) { if (process.env.NODE_ENV === "production") { console.warn("[mobx.spy] Is a no-op in production builds"); return function () { }; } else { globalState.spyListeners.push(listener); return once(function () { globalState.spyListeners = globalState.spyListeners.filter(function (l) { return l !== listener; }); }); } } function dontReassignFields() { fail(process.env.NODE_ENV !== "production" && "@action fields are not reassignable"); } function namedActionDecorator(name) { return function (target, prop, descriptor) { if (descriptor) { if (process.env.NODE_ENV !== "production" && descriptor.get !== undefined) { return fail("@action cannot be used with getters"); } // babel / typescript // @action method() { } if (descriptor.value) { // typescript return { value: createAction(name, descriptor.value), enumerable: false, configurable: true, writable: true // for typescript, this must be writable, otherwise it cannot inherit :/ (see inheritable actions test) }; } // babel only: @action method = () => {} var initializer_1 = descriptor.initializer; return { enumerable: false, configurable: true, writable: true, initializer: function () { // N.B: we can't immediately invoke initializer; this would be wrong return createAction(name, initializer_1.call(this)); } }; } // bound instance methods return actionFieldDecorator(name).apply(this, arguments); }; } function actionFieldDecorator(name) { // Simple property that writes on first invocation to the current instance return function (target, prop, descriptor) { Object.defineProperty(target, prop, { configurable: true, enumerable: false, get: function () { return undefined; }, set: function (value) { addHiddenProp(this, prop, action(name, value)); } }); }; } function boundActionDecorator(target, propertyName, descriptor, applyToInstance) { if (applyToInstance === true) { defineBoundAction(target, propertyName, descriptor.value); return null; } if (descriptor) { // if (descriptor.value) // Typescript / Babel: @action.bound method() { } // also: babel @action.bound method = () => {} return { configurable: true, enumerable: false, get: function () { defineBoundAction(this, propertyName, descriptor.value || descriptor.initializer.call(this)); return this[propertyName]; }, set: dontReassignFields }; } // field decorator Typescript @action.bound method = () => {} return { enumerable: false, configurable: true, set: function (v) { defineBoundAction(this, propertyName, v); }, get: function () { return undefined; } }; } var action = function action(arg1, arg2, arg3, arg4) { // action(fn() {}) if (arguments.length === 1 && typeof arg1 === "function") return createAction(arg1.name || "<unnamed action>", arg1); // action("name", fn() {}) if (arguments.length === 2 && typeof arg2 === "function") return createAction(arg1, arg2); // @action("name") fn() {} if (arguments.length === 1 && typeof arg1 === "string") return namedActionDecorator(arg1); // @action fn() {} if (arg4 === true) { // apply to instance immediately addHiddenProp(arg1, arg2, createAction(arg1.name || arg2, arg3.value, this)); } else { return namedActionDecorator(arg2).apply(null, arguments); } }; action.bound = boundActionDecorator; function runInAction(arg1, arg2) { var actionName = typeof arg1 === "string" ? arg1 : arg1.name || "<unnamed action>"; var fn = typeof arg1 === "function" ? arg1 : arg2; if (process.env.NODE_ENV !== "production") { invariant(typeof fn === "function" && fn.length === 0, "`runInAction` expects a function without arguments"); if (typeof actionName !== "string" || !actionName) fail("actions should have valid names, got: '" + actionName + "'"); } return executeAction(actionName, fn, this, undefined); } function isAction(thing) { return typeof thing === "function" && thing.isMobxAction === true; } function defineBoundAction(target, propertyName, fn) { addHiddenProp(target, propertyName, createAction(propertyName, fn.bind(target))); } /** * Creates a named reactive view and keeps it alive, so that the view is always * updated if one of the dependencies changes, even when the view is not further used by something else. * @param view The reactive view * @returns disposer function, which can be used to stop the view from being updated in the future. */ function autorun(view, opts) { if (opts === void 0) { opts = EMPTY_OBJECT; } if (process.env.NODE_ENV !== "production") { invariant(typeof view === "function", "Autorun expects a function as first argument"); invariant(isAction(view) === false, "Autorun does not accept actions since actions are untrackable"); } var name = (opts && opts.name) || view.name || "Autorun@" + getNextId(); var runSync = !opts.scheduler && !opts.delay; var reaction; if (runSync) { // normal autorun reaction = new Reaction(name, function () { this.track(reactionRunner); }, opts.onError, opts.requiresObservable); } else { var scheduler_1 = createSchedulerFromOptions(opts); // debounced autorun var isScheduled_1 = false; reaction = new Reaction(name, function () { if (!isScheduled_1) { isScheduled_1 = true; scheduler_1(function () { isScheduled_1 = false; if (!reaction.isDisposed) reaction.track(reactionRunner); }); } }, opts.onError, opts.requiresObservable); } function reactionRunner() { view(reaction); } reaction.schedule(); return reaction.getDisposer(); } var run = function (f) { return f(); }; function createSchedulerFromOptions(opts) { return opts.scheduler ? opts.scheduler : opts.delay ? function (f) { return setTimeout(f, opts.delay); } : run; } function reaction(expression, effect, opts) { if (opts === void 0) { opts = EMPTY_OBJECT; } if (process.env.NODE_ENV !== "production") { invariant(typeof expression === "function", "First argument to reaction should be a function"); invariant(typeof opts === "object", "Third argument of reactions should be an object"); } var name = opts.name || "Reaction@" + getNextId(); var effectAction = action(name, opts.onError ? wrapErrorHandler(opts.onError, effect) : effect); var runSync = !opts.scheduler && !opts.delay; var scheduler = createSchedulerFromOptions(opts); var firstTime = true; var isScheduled = false; var value; var equals = opts.compareStructural ? comparer.structural : opts.equals || comparer.default; var r = new Reaction(name, function () { if (firstTime || runSync) { reactionRunner(); } else if (!isScheduled) { isScheduled = true; scheduler(reactionRunner); } }, opts.onError, opts.requiresObservable); function reactionRunner() { isScheduled = false; // Q: move into reaction runner? if (r.isDisposed) return; var changed = false; r.track(function () { var nextValue = expression(r); changed = firstTime || !equals(value, nextValue); value = nextValue; }); if (firstTime && opts.fireImmediately) effectAction(value, r); if (!firstTime && changed === true) effectAction(value, r); if (firstTime) firstTime = false; } r.schedule(); return r.getDisposer(); } function wrapErrorHandler(errorHandler, baseFn) { return function () { try { return baseFn.apply(this, arguments); } catch (e) { errorHandler.call(this, e); } }; } function onBecomeObserved(thing, arg2, arg3) { return interceptHook("onBecomeObserved", thing, arg2, arg3); } function onBecomeUnobserved(thing, arg2, arg3) { return interceptHook("onBecomeUnobserved", thing, arg2, arg3); } function interceptHook(hook, thing, arg2, arg3) { var atom = typeof arg3 === "function" ? getAtom(thing, arg2) : getAtom(thing); var cb = typeof arg3 === "function" ? arg3 : arg2; var listenersKey = hook + "Listeners"; if (atom[listenersKey]) { atom[listenersKey].add(cb); } else { atom[listenersKey] = new Set([cb]); } var orig = atom[hook]; if (typeof orig !== "function") return fail(process.env.NODE_ENV !== "production" && "Not an atom that can be (un)observed"); return function () { var hookListeners = atom[listenersKey]; if (hookListeners) { hookListeners.delete(cb); if (hookListeners.size === 0) { delete atom[listenersKey]; } } }; } function configure(options) { var enforceActions = options.enforceActions, computedRequiresReaction = options.computedRequiresReaction, computedConfigurable = options.computedConfigurable, disableErrorBoundaries = options.disableErrorBoundaries, reactionScheduler = options.reactionScheduler, reactionRequiresObservable = options.reactionRequiresObservable, observableRequiresReaction = options.observableRequiresReaction; if (options.isolateGlobalState === true) { isolateGlobalState(); } if (enforceActions !== undefined) { if (typeof enforceActions === "boolean" || enforceActions === "strict") deprecated("Deprecated value for 'enforceActions', use 'false' => '\"never\"', 'true' => '\"observed\"', '\"strict\"' => \"'always'\" instead"); var ea = void 0; switch (enforceActions) { case true: case "observed": ea = true; break; case false: case "never": ea = false; break; case "strict": case "always": ea = "strict"; break; default: fail("Invalid value for 'enforceActions': '" + enforceActions + "', expected 'never', 'always' or 'observed'"); } globalState.enforceActions = ea; globalState.allowStateChanges = ea === true || ea === "strict" ? false : true; } if (computedRequiresReaction !== undefined) { globalState.computedRequiresReaction = !!computedRequiresReaction; } if (reactionRequiresObservable !== undefined) { globalState.reactionRequiresObservable = !!reactionRequiresObservable; } if (observableRequiresReaction !== undefined) { globalState.observableRequiresReaction = !!observableRequiresReaction; globalState.allowStateReads = !globalState.observableRequiresReaction; } if (computedConfigurable !== undefined) { globalState.computedConfigurable = !!computedConfigurable; } if (disableErrorBoundaries !== undefined) { if (disableErrorBoundaries === true) console.warn("WARNING: Debug feature only. MobX will NOT recover from errors when `disableErrorBoundaries` is enabled."); globalState.disableErrorBoundaries = !!disableErrorBoundaries; } if (reactionScheduler) { setReactionScheduler(reactionScheduler); } } function decorate(thing, decorators) { process.env.NODE_ENV !== "production" && invariant(isPlainObject(decorators), "Decorators should be a key value map"); var target = typeof thing === "function" ? thing.prototype : thing; var _loop_1 = function (prop) { var propertyDecorators = decorators[prop]; if (!Array.isArray(propertyDecorators)) { propertyDecorators = [propertyDecorators]; } process.env.NODE_ENV !== "production" && invariant(propertyDecorators.every(function (decorator) { return typeof decorator === "function"; }), "Decorate: expected a decorator function or array of decorator functions for '" + prop + "'"); var descriptor = Object.getOwnPropertyDescriptor(target, prop); var newDescriptor = propertyDecorators.reduce(function (accDescriptor, decorator) { return decorator(target, prop, accDescriptor); }, descriptor); if (newDescriptor) Object.defineProperty(target, prop, newDescriptor); }; for (var prop in decorators) { _loop_1(prop); } return thing; } function extendObservable(target, properties, decorators, options) { if (process.env.NODE_ENV !== "production") { invariant(arguments.length >= 2 && arguments.length <= 4, "'extendObservable' expected 2-4 arguments"); invariant(typeof target === "object", "'extendObservable' expects an object as first argument"); invariant(!isObservableMap(target), "'extendObservable' should not be used on maps, use map.merge instead"); } options = asCreateObservableOptions(options); var defaultDecorator = getDefaultDecoratorFromObjectOptions(options); initializeInstance(target); // Fixes #1740 asObservableObject(target, options.name, defaultDecorator.enhancer); // make sure object is observable, even without initial props if (properties) extendObservableObjectWithProperties(target, properties, decorators, defaultDecorator); return target; } function getDefaultDecoratorFromObjectOptions(options) { return options.defaultDecorator || (options.deep === false ? refDecorator : deepDecorator); } function extendObservableObjectWithProperties(target, properties, decorators, defaultDecorator) { var e_1, _a, e_2, _b; if (process.env.NODE_ENV !== "production") { invariant(!isObservable(properties), "Extending an object with another observable (object) is not supported. Please construct an explicit propertymap, using `toJS` if need. See issue #540"); if (decorators) { var keys = getPlainObjectKeys(decorators); try { for (var keys_1 = __values(keys), keys_1_1 = keys_1.next(); !keys_1_1.done; keys_1_1 = keys_1.next()) { var key = keys_1_1.value; if (!(key in properties)) fail("Trying to declare a decorator for unspecified property '" + stringifyKey(key) + "'"); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (keys_1_1 && !keys_1_1.done && (_a = keys_1.return)) _a.call(keys_1); } finally { if (e_1) throw e_1.error; } } } } startBatch(); try { var keys = ownKeys(properties); try { for (var keys_2 = __values(keys), keys_2_1 = keys_2.next(); !keys_2_1.done; keys_2_1 = keys_2.next()) { var key = keys_2_1.value; var descriptor = Object.getOwnPropertyDescriptor(properties, key); if (process.env.NODE_ENV !== "production") { if (!isPlainObject(properties)) fail("'extendObservable' only accepts plain objects as second argument"); if (isComputed(descriptor.value)) fail("Passing a 'computed' as initial property value is no longer supported by extendObservable. Use a getter or decorator instead"); } var decorator = decorators && key in decorators ? decorators[key] : descriptor.get ? computedDecorator : defaultDecorator; if (process.env.NODE_ENV !== "production" && typeof decorator !== "function") fail("Not a valid decorator for '" + stringifyKey(key) + "', got: " + decorator); var resultDescriptor = decorator(target, key, descriptor, true); if (resultDescriptor // otherwise, assume already applied, due to `applyToInstance` ) Object.defineProperty(target, key, resultDescriptor); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (keys_2_1 && !keys_2_1.done && (_b = keys_2.return)) _b.call(keys_2); } finally { if (e_2) throw e_2.error; } } } finally { endBatch(); } } function getDependencyTree(thing, property) { return nodeToDependencyTree(getAtom(thing, property)); } function nodeToDependencyTree(node) { var result = { name: node.name }; if (node.observing && node.observing.length > 0) result.dependencies = unique(node.observing).map(nodeToDependencyTree); return result; } function getObserverTree(thing, property) { return nodeToObserverTree(getAtom(thing, property)); } function nodeToObserverTree(node) { var result = { name: node.name }; if (hasObservers(node)) result.observers = Array.from(getObservers(node)).map(nodeToObserverTree); return result; } var generatorId = 0; function FlowCancellationError() { this.message = "FLOW_CANCELLED"; } FlowCancellationError.prototype = Object.create(Error.prototype); function isFlowCancellationError(error) { return error instanceof FlowCancellationError; } function flow(generator) { if (arguments.length !== 1) fail(!!process.env.NODE_ENV && "Flow expects 1 argument and cannot be used as decorator"); var name = generator.name || "<unnamed flow>"; // Implementation based on https://github.com/tj/co/blob/master/index.js return function () { var ctx = this; var args = arguments; var runId = ++generatorId; var gen = action(name + " - runid: " + runId + " - init", generator).apply(ctx, args); var rejector; var pendingPromise = undefined; var promise = new Promise(function (resolve, reject) { var stepId = 0; rejector = reject; function onFulfilled(res) { pendingPromise = undefined; var ret; try { ret = action(name + " - runid: " + runId + " - yield " + stepId++, gen.next).call(gen, res); } catch (e) { return reject(e); } next(ret); } function onRejected(err) { pendingPromise = undefined; var ret; try { ret = action(name + " - runid: " + runId + " - yield " + stepId++, gen.throw).call(gen, err); } catch (e) { return reject(e); } next(ret); } function next(ret) { if (ret && typeof ret.then === "function") { // an async iterator ret.then(next, reject); return; } if (ret.done) return resolve(ret.value); pendingPromise = Promise.resolve(ret.value); return pendingPromise.then(onFulfilled, onRejected); } onFulfilled(undefined); // kick off the process }); promise.cancel = action(name + " - runid: " + runId + " - cancel", function () { try { if (pendingPromise) cancelPromise(pendingPromise); // Finally block can return (or yield) stuff.. var res = gen.return(undefined); // eat anything that promise would do, it's cancelled! var yieldedPromise = Promise.resolve(res.value); yieldedPromise.then(noop, noop); cancelPromise(yieldedPromise); // maybe it can be cancelled :) // reject our original promise rejector(new FlowCancellationError()); } catch (e) { rejector(e); // there could be a throwing finally block } }); return promise; }; } function cancelPromise(promise) { if (typeof promise.cancel === "function") promise.cancel(); } function interceptReads(thing, propOrHandler, handler) { var target; if (isObservableMap(thing) || isObservableArray(thing) || isObservableValue(thing)) { target = getAdministration(thing); } else if (isObservableObject(thing)) { if (typeof propOrHandler !== "string") return fail(process.env.NODE_ENV !== "production" && "InterceptReads can only be used with a specific property, not with an object in general"); target = getAdministration(thing, propOrHandler); } else { return fail(process.env.NODE_ENV !== "production" && "Expected observable map, object or array as first array"); } if (target.dehancer !== undefined) return fail(process.env.NODE_ENV !== "production" && "An intercept reader was already established"); target.dehancer = typeof propOrHandler === "function" ? propOrHandler : handler; return function () { target.dehancer = undefined; }; } function intercept(thing, propOrHandler, handler) { if (typeof handler === "function") return interceptProperty(thing, propOrHandler, handler); else return interceptInterceptable(thing, propOrHandler); } function interceptInterceptable(thing, handler) { return getAdministration(thing).intercept(handler); } function interceptProperty(thing, property, handler) { return getAdministration(thing, property).intercept(handler); } function _isComputed(value, property) { if (value === null || value === undefined) return false; if (property !== undefined) { if (isObservableObject(value) === false) return false; if (!value[$mobx].values.has(property)) return false; var atom = getAtom(value, property); return isComputedValue(atom); } return isComputedValue(value); } function isComputed(value) { if (arguments.length > 1) return fail(process.env.NODE_ENV !== "production" && "isComputed expects only 1 argument. Use isObservableProp to inspect the observability of a property"); return _isComputed(value); } function isComputedProp(value, propName) { if (typeof propName !== "string") return fail(process.env.NODE_ENV !== "production" && "isComputed expected a property name as second argument"); return _isComputed(value, propName); } function _isObservable(value, property) { if (value === null || value === undefined) return false; if (property !== undefined) { if (process.env.NODE_ENV !== "production" && (isObservableMap(value) || isObservableArray(value))) return fail("isObservable(object, propertyName) is not supported for arrays and maps. Use map.has or array.length instead."); if (isObservableObject(value)) { return value[$mobx].values.has(property); } return false; } // For first check, see #701 return (isObservableObject(value) || !!value[$mobx] || isAtom(value) || isReaction(value) || isComputedValue(value)); } function isObservable(value) { if (arguments.length !== 1) fail(process.env.NODE_ENV !== "production" && "isObservable expects only 1 argument. Use isObservableProp to inspect the observability of a property"); return _isObservable(value); } function isObservableProp(value, propName) { if (typeof propName !== "string") return fail(process.env.NODE_ENV !== "production" && "expected a property name as second argument"); return _isObservable(value, propName); } function keys(obj) { if (isObservableObject(obj)) { return obj[$mobx].getKeys(); } if (isObservableMap(obj)) { return Array.from(obj.keys()); } if (isObservableSet(obj)) { return Array.from(obj.keys()); } if (isObservableArray(obj)) { return obj.map(function (_, index) { return index; }); } return fail(process.env.NODE_ENV !== "production" && "'keys()' can only be used on observable objects, arrays, sets and maps"); } function values(obj) { if (isObservableObject(obj)) { return keys(obj).map(function (key) { return obj[key]; }); } if (isObservableMap(obj)) { return keys(obj).map(function (key) { return obj.get(key); }); } if (isObservableSet(obj)) { return Array.from(obj.values()); } if (isObservableArray(obj)) { return obj.slice(); } return fail(process.env.NODE_ENV !== "production" && "'values()' can only be used on observable objects, arrays, sets and maps"); } function entries(obj) { if (isObservableObject(obj)) { return keys(obj).map(function (key) { return [key, obj[key]]; }); } if (isObservableMap(obj)) { return keys(obj).map(function (key) { return [key, obj.get(key)]; }); } if (isObservableSet(obj)) { return Array.from(obj.entries()); } if (isObservableArray(obj)) { return obj.map(function (key, index) { return [index, key]; }); } return fail(process.env.NODE_ENV !== "production" && "'entries()' can only be used on observable objects, arrays and maps"); } function set(obj, key, value) { if (arguments.length === 2 && !isObservableSet(obj)) { startBatch(); var values_1 = key; try { for (var key_1 in values_1) set(obj, key_1, values_1[key_1]); } finally { endBatch(); } return; } if (isObservableObject(obj)) { var adm = obj[$mobx]; var existingObservable = adm.values.get(key); if (existingObservable) { adm.write(key, value); } else { adm.addObservableProp(key, value, adm.defaultEnhancer); } } else if (isObservableMap(obj)) { obj.set(key, value); } else if (isObservableSet(obj)) { obj.add(key); } else if (isObservableArray(obj)) { if (typeof key !== "number") key = parseInt(key, 10); invariant(key >= 0, "Not a valid index: '" + key + "'"); startBatch(); if (key >= obj.length) obj.length = key + 1; obj[key] = value; endBatch(); } else { return fail(process.env.NODE_ENV !== "production" && "'set()' can only be used on observable objects, arrays and maps"); } } function remove(obj, key) { if (isObservableObject(obj)) { obj[$mobx].remove(key); } else if (isObservableMap(obj)) { obj.delete(key); } else if (isObservableSet(obj)) { obj.delete(key); } else if (isObservableArray(obj)) { if (typeof key !== "number") key = parseInt(key, 10); invariant(key >= 0, "Not a valid index: '" + key + "'"); obj.splice(key, 1); } else { return fail(process.env.NODE_ENV !== "production" && "'remove()' can only be used on observable objects, arrays and maps"); } } function has(obj, key) { if (isObservableObject(obj)) { // return keys(obj).indexOf(key) >= 0 var adm = getAdministration(obj); return adm.has(key); } else if (isObservableMap(obj)) { return obj.has(key); } else if (isObservableSet(obj)) { return obj.has(key); } else if (isObservableArray(obj)) { return key >= 0 && key < obj.length; } else { return fail(process.env.NODE_ENV !== "production" && "'has()' can only be used on observable objects, arrays and maps"); } } function get(obj, key) { if (!has(obj, key)) return undefined; if (isObservableObject(obj)) { return obj[key]; } else if (isObservableMap(obj)) { return obj.get(key); } else if (isObservableArray(obj)) { return obj[key]; } else { return fail(process.env.NODE_ENV !== "production" && "'get()' can only be used on observable objects, arrays and maps"); } } function observe(thing, propOrCb, cbOrFire, fireImmediately) { if (typeof cbOrFire === "function") return observeObservableProperty(thing, propOrCb, cbOrFire, fireImmediately); else return observeObservable(thing, propOrCb, cbOrFire); } function observeObservable(thing, listener, fireImmediately) { return getAdministration(thing).observe(listener, fireImmediately); } function observeObservableProperty(thing, property, listener, fireImmediately) { return getAdministration(thing, property).observe(listener, fireImmediately); } var defaultOptions = { detectCycles: true, exportMapsAsObjects: true, recurseEverything: false }; function cache(map, key, value, options) { if (options.detectCycles) map.set(key, value); return value; } function toJSHelper(source, options, __alreadySeen) { if (!options.recurseEverything && !isObservable(source)) return source; if (typeof source !== "object") return source; // Directly return null if source is null if (source === null) return null; // Directly return the Date object itself if contained in the observable if (source instanceof Date) return source; if (isObservableValue(source)) return toJSHelper(source.get(), options, __alreadySeen); // make sure we track the keys of the object if (isObservable(source)) keys(source); var detectCycles = options.detectCycles === true; if (detectCycles && source !== null && __alreadySeen.has(source)) { return __alreadySeen.get(source); } if (isObservableArray(source) || Array.isArray(source)) { var res_1 = cache(__alreadySeen, source, [], options); var toAdd = source.map(function (value) { return toJSHelper(value, options, __alreadySeen); }); res_1.length = toAdd.length; for (var i = 0, l = toAdd.length; i < l; i++) res_1[i] = toAdd[i]; return res_1; } if (isObservableSet(source) || Object.getPrototypeOf(source) === Set.prototype) { if (options.exportMapsAsObjects === false) { var res_2 = cache(__alreadySeen, source, new Set(), options); source.forEach(function (value) { res_2.add(toJSHelper(value, options, __alreadySeen)); }); return res_2; } else { var res_3 = cache(__alreadySeen, source, [], options); source.forEach(function (value) { res_3.push(toJSHelper(value, options, __alreadySeen)); }); return res_3; } } if (isObservableMap(source) || Object.getPrototypeOf(source) === Map.prototype) { if (options.exportMapsAsObjects === false) { var res_4 = cache(__alreadySeen, source, new Map(), options); source.forEach(function (value, key) { res_4.set(key, toJSHelper(value, options, __alreadySeen)); }); return res_4; } else { var res_5 = cache(__alreadySeen, source, {}, options); source.forEach(function (value, key) { res_5[key] = toJSHelper(value, options, __alreadySeen); }); return res_5; } } // Fallback to the situation that source is an ObservableObject or a plain object var res = cache(__alreadySeen, source, {}, options); getPlainObjectKeys(source).forEach(function (key) { res[key] = toJSHelper(source[key], options, __alreadySeen); }); return res; } function toJS(source, options) { // backward compatibility if (typeof options === "boolean") options = { detectCycles: options }; if (!options) options = defaultOptions; options.detectCycles = options.detectCycles === undefined ? options.recurseEverything === true : options.detectCycles === true; var __alreadySeen; if (options.detectCycles) __alreadySeen = new Map(); return toJSHelper(source, options, __alreadySeen); } function trace() { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var enterBreakPoint = false; if (typeof args[args.length - 1] === "boolean") enterBreakPoint = args.pop(); var derivation = getAtomFromArgs(args); if (!derivation) { return fail(process.env.NODE_ENV !== "production" && "'trace(break?)' can only be used inside a tracked computed value or a Reaction. Consider passing in the computed value or reaction explicitly"); } if (derivation.isTracing === TraceMode.NONE) { console.log("[mobx.trace] '" + derivation.name + "' tracing enabled"); } derivation.isTracing = enterBreakPoint ? TraceMode.BREAK : TraceMode.LOG; } function getAtomFromArgs(args) { switch (args.length) { case 0: return globalState.trackingDerivation; case 1: return getAtom(args[0]); case 2: return getAtom(args[0], args[1]); } } /** * During a transaction no views are updated until the end of the transaction. * The transaction will be run synchronously nonetheless. * * @param action a function that updates some reactive state * @returns any value that was returned by the 'action' parameter. */ function transaction(action, thisArg) { if (thisArg === void 0) { thisArg = undefined; } startBatch(); try { return action.apply(thisArg); } finally { endBatch(); } } function when(predicate, arg1, arg2) { if (arguments.length === 1 || (arg1 && typeof arg1 === "object")) return whenPromise(predicate, arg1); return _when(predicate, arg1, arg2 || {}); } function _when(predicate, effect, opts) { var timeoutHandle; if (typeof opts.timeout === "number") { timeoutHandle = setTimeout(function () { if (!disposer[$mobx].isDisposed) { disposer(); var error = new Error("WHEN_TIMEOUT"); if (opts.onError) opts.onError(error); else throw error; } }, opts.timeout); } opts.name = opts.name || "When@" + getNextId(); var effectAction = createAction(opts.name + "-effect", effect); var disposer = autorun(function (r) { if (predicate()) { r.dispose(); if (timeoutHandle) clearTimeout(timeoutHandle); effectAction(); } }, opts); return disposer; } function whenPromise(predicate, opts) { if (process.env.NODE_ENV !== "production" && opts && opts.onError) return fail("the options 'onError' and 'promise' cannot be combined"); var cancel; var res = new Promise(function (resolve, reject) { var disposer = _when(predicate, resolve, __assign(__assign({}, opts), { onError: reject })); cancel = function () { disposer(); reject("WHEN_CANCELLED"); }; }); res.cancel = cancel; return res; } function getAdm(target) { return target[$mobx]; } function isPropertyKey(val) { return typeof val === "string" || typeof val === "number" || typeof val === "symbol"; } // Optimization: we don't need the intermediate objects and could have a completely custom administration for DynamicObjects, // and skip either the internal values map, or the base object with its property descriptors! var objectProxyTraps = { has: function (target, name) { if (name === $mobx || name === "constructor" || name === mobxDidRunLazyInitializersSymbol) return true; var adm = getAdm(target); // MWE: should `in` operator be reactive? If not, below code path will be faster / more memory efficient // TODO: check performance stats! // if (adm.values.get(name as string)) return true if (isPropertyKey(name)) return adm.has(name); return name in target; }, get: function (target, name) { if (name === $mobx || name === "constructor" || name === mobxDidRunLazyInitializersSymbol) return target[name]; var adm = getAdm(target); var observable = adm.values.get(name); if (observable instanceof Atom) { var result = observable.get(); if (result === undefined) { // This fixes #1796, because deleting a prop that has an // undefined value won't retrigger a observer (no visible effect), // the autorun wouldn't subscribe to future key changes (see also next comment) adm.has(name); } return result; } // make sure we start listening to future keys // note that we only do this here for optimization if (isPropertyKey(name)) adm.has(name); return target[name]; }, set: function (target, name, value) { if (!isPropertyKey(name)) return false; set(target, name, value); return true; }, deleteProperty: function (target, name) { if (!isPropertyKey(name)) return false; var adm = getAdm(target); adm.remove(name); return true; }, ownKeys: function (target) { var adm = getAdm(target); adm.keysAtom.reportObserved(); return Reflect.ownKeys(target); }, preventExtensions: function (target) { fail("Dynamic observable objects cannot be frozen"); return false; } }; function createDynamicObservableObject(base) { var proxy = new Proxy(base, objectProxyTraps); base[$mobx].proxy = proxy; return proxy; } function hasInterceptors(interceptable) { return interceptable.interceptors !== undefined && interceptable.interceptors.length > 0; } function registerInterceptor(interceptable, handler) { var interceptors = interceptable.interceptors || (interceptable.interceptors = []); interceptors.push(handler); return once(function () { var idx = interceptors.indexOf(handler); if (idx !== -1) interceptors.splice(idx, 1); }); } function interceptChange(interceptable, change) { var prevU = untrackedStart(); try { // Interceptor can modify the array, copy it to avoid concurrent modification, see #1950 var interceptors = __spread((interceptable.interceptors || [])); for (var i = 0, l = interceptors.length; i < l; i++) { change = interceptors[i](change); invariant(!change || change.type, "Intercept handlers should return nothing or a change object"); if (!change) break; } return change; } finally { untrackedEnd(prevU); } } function hasListeners(listenable) { return listenable.changeListeners !== undefined && listenable.changeListeners.length > 0; } function registerListener(listenable, handler) { var listeners = listenable.changeListeners || (listenable.changeListeners = []); listeners.push(handler); return once(function () { var idx = listeners.indexOf(handler); if (idx !== -1) listeners.splice(idx, 1); }); } function notifyListeners(listenable, change) { var prevU = untrackedStart(); var listeners = listenable.changeListeners; if (!listeners) return; listeners = listeners.slice(); for (var i = 0, l = listeners.length; i < l; i++) { listeners[i](change); } untrackedEnd(prevU); } var MAX_SPLICE_SIZE = 10000; // See e.g. https://github.com/mobxjs/mobx/issues/859 var arrayTraps = { get: function (target, name) { if (name === $mobx) return target[$mobx]; if (name === "length") return target[$mobx].getArrayLength(); if (typeof name === "number") { return arrayExtensions.get.call(target, name); } if (typeof name === "string" && !isNaN(name)) { return arrayExtensions.get.call(target, parseInt(name)); } if (arrayExtensions.hasOwnProperty(name)) { return arrayExtensions[name]; } return target[name]; }, set: function (target, name, value) { if (name === "length") { target[$mobx].setArrayLength(value); } if (typeof name === "number") { arrayExtensions.set.call(target, name, value); } if (typeof name === "symbol" || isNaN(name)) { target[name] = value; } else { // numeric string arrayExtensions.set.call(target, parseInt(name), value); } return true; }, preventExtensions: function (target) { fail("Observable arrays cannot be frozen"); return false; } }; function createObservableArray(initialValues, enhancer, name, owned) { if (name === void 0) { name = "ObservableArray@" + getNextId(); } if (owned === void 0) { owned = false; } var adm = new ObservableArrayAdministration(name, enhancer, owned); addHiddenFinalProp(adm.values, $mobx, adm); var proxy = new Proxy(adm.values, arrayTraps); adm.proxy = proxy; if (initialValues && initialValues.length) { var prev = allowStateChangesStart(true); adm.spliceWithArray(0, 0, initialValues); allowStateChangesEnd(prev); } return proxy; } var ObservableArrayAdministration = /** @class */ (function () { function ObservableArrayAdministration(name, enhancer, owned) { this.owned = owned; this.values = []; this.proxy = undefined; this.lastKnownLength = 0; this.atom = new Atom(name || "ObservableArray@" + getNextId()); this.enhancer = function (newV, oldV) { return enhancer(newV, oldV, name + "[..]"); }; } ObservableArrayAdministration.prototype.dehanceValue = function (value) { if (this.dehancer !== undefined) return this.dehancer(value); return value; }; ObservableArrayAdministration.prototype.dehanceValues = function (values) { if (this.dehancer !== undefined && values.length > 0) return values.map(this.dehancer); return values; }; ObservableArrayAdministration.prototype.intercept = function (handler) { return registerInterceptor(this, handler); }; ObservableArrayAdministration.prototype.observe = function (listener, fireImmediately) { if (fireImmediately === void 0) { fireImmediately = false; } if (fireImmediately) { listener({ object: this.proxy, type: "splice", index: 0, added: this.values.slice(), addedCount: this.values.length, removed: [], removedCount: 0 }); } return registerListener(this, listener); }; ObservableArrayAdministration.prototype.getArrayLength = function () { this.atom.reportObserved(); return this.values.length; }; ObservableArrayAdministration.prototype.setArrayLength = function (newLength) { if (typeof newLength !== "number" || newLength < 0) throw new Error("[mobx.array] Out of range: " + newLength); var currentLength = this.values.length; if (newLength === currentLength) return; else if (newLength > currentLength) { var newItems = new Array(newLength - currentLength); for (var i = 0; i < newLength - currentLength; i++) newItems[i] = undefined; // No Array.fill everywhere... this.spliceWithArray(currentLength, 0, newItems); } else this.spliceWithArray(newLength, currentLength - newLength); }; ObservableArrayAdministration.prototype.updateArrayLength = function (oldLength, delta) { if (oldLength !== this.lastKnownLength) throw new Error("[mobx] Modification exception: the internal structure of an observable array was changed."); this.lastKnownLength += delta; }; ObservableArrayAdministration.prototype.spliceWithArray = function (index, deleteCount, newItems) { var _this = this; checkIfStateModificationsAreAllowed(this.atom); var length = this.values.length; if (index === undefined) index = 0; else if (index > length) index = length; else if (index < 0) index = Math.max(0, length + index); if (arguments.length === 1) deleteCount = length - index; else if (deleteCount === undefined || deleteCount === null) deleteCount = 0; else deleteCount = Math.max(0, Math.min(deleteCount, length - index)); if (newItems === undefined) newItems = EMPTY_ARRAY; if (hasInterceptors(this)) { var change = interceptChange(this, { object: this.proxy, type: "splice", index: index, removedCount: deleteCount, added: newItems }); if (!change) return EMPTY_ARRAY; deleteCount = change.removedCount; newItems = change.added; } newItems = newItems.length === 0 ? newItems : newItems.map(function (v) { return _this.enhancer(v, undefined); }); if (process.env.NODE_ENV !== "production") { var lengthDelta = newItems.length - deleteCount; this.updateArrayLength(length, lengthDelta); // checks if internal array wasn't modified } var res = this.spliceItemsIntoValues(index, deleteCount, newItems); if (deleteCount !== 0 || newItems.length !== 0) this.notifyArraySplice(index, newItems, res); return this.dehanceValues(res); }; ObservableArrayAdministration.prototype.spliceItemsIntoValues = function (index, deleteCount, newItems) { var _a; if (newItems.length < MAX_SPLICE_SIZE) { return (_a = this.values).splice.apply(_a, __spread([index, deleteCount], newItems)); } else { var res = this.values.slice(index, index + deleteCount); this.values = this.values .slice(0, index) .concat(newItems, this.values.slice(index + deleteCount)); return res; } }; ObservableArrayAdministration.prototype.notifyArrayChildUpdate = function (index, newValue, oldValue) { var notifySpy = !this.owned && isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { object: this.proxy, type: "update", index: index, newValue: newValue, oldValue: oldValue } : null; // The reason why this is on right hand side here (and not above), is this way the uglifier will drop it, but it won't // cause any runtime overhead in development mode without NODE_ENV set, unless spying is enabled if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(__assign(__assign({}, change), { name: this.atom.name })); this.atom.reportChanged(); if (notify) notifyListeners(this, change); if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd(); }; ObservableArrayAdministration.prototype.notifyArraySplice = function (index, added, removed) { var notifySpy = !this.owned && isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { object: this.proxy, type: "splice", index: index, removed: removed, added: added, removedCount: removed.length, addedCount: added.length } : null; if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(__assign(__assign({}, change), { name: this.atom.name })); this.atom.reportChanged(); // conform: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array/observe if (notify) notifyListeners(this, change); if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd(); }; return ObservableArrayAdministration; }()); var arrayExtensions = { intercept: function (handler) { return this[$mobx].intercept(handler); }, observe: function (listener, fireImmediately) { if (fireImmediately === void 0) { fireImmediately = false; } var adm = this[$mobx]; return adm.observe(listener, fireImmediately); }, clear: function () { return this.splice(0); }, replace: function (newItems) { var adm = this[$mobx]; return adm.spliceWithArray(0, adm.values.length, newItems); }, /** * Converts this array back to a (shallow) javascript structure. * For a deep clone use mobx.toJS */ toJS: function () { return this.slice(); }, toJSON: function () { // Used by JSON.stringify return this.toJS(); }, /* * functions that do alter the internal structure of the array, (based on lib.es6.d.ts) * since these functions alter the inner structure of the array, the have side effects. * Because the have side effects, they should not be used in computed function, * and for that reason the do not call dependencyState.notifyObserved */ splice: function (index, deleteCount) { var newItems = []; for (var _i = 2; _i < arguments.length; _i++) { newItems[_i - 2] = arguments[_i]; } var adm = this[$mobx]; switch (arguments.length) { case 0: return []; case 1: return adm.spliceWithArray(index); case 2: return adm.spliceWithArray(index, deleteCount); } return adm.spliceWithArray(index, deleteCount, newItems); }, spliceWithArray: function (index, deleteCount, newItems) { var adm = this[$mobx]; return adm.spliceWithArray(index, deleteCount, newItems); }, push: function () { var items = []; for (var _i = 0; _i < arguments.length; _i++) { items[_i] = arguments[_i]; } var adm = this[$mobx]; adm.spliceWithArray(adm.values.length, 0, items); return adm.values.length; }, pop: function () { return this.splice(Math.max(this[$mobx].values.length - 1, 0), 1)[0]; }, shift: function () { return this.splice(0, 1)[0]; }, unshift: function () { var items = []; for (var _i = 0; _i < arguments.length; _i++) { items[_i] = arguments[_i]; } var adm = this[$mobx]; adm.spliceWithArray(0, 0, items); return adm.values.length; }, reverse: function () { // reverse by default mutates in place before returning the result // which makes it both a 'derivation' and a 'mutation'. // so we deviate from the default and just make it an dervitation if (process.env.NODE_ENV !== "production") { console.warn("[mobx] `observableArray.reverse()` will not update the array in place. Use `observableArray.slice().reverse()` to suppress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().reverse())` to reverse & update in place"); } var clone = this.slice(); return clone.reverse.apply(clone, arguments); }, sort: function (compareFn) { // sort by default mutates in place before returning the result // which goes against all good practices. Let's not change the array in place! if (process.env.NODE_ENV !== "production") { console.warn("[mobx] `observableArray.sort()` will not update the array in place. Use `observableArray.slice().sort()` to suppress this warning and perform the operation on a copy, or `observableArray.replace(observableArray.slice().sort())` to sort & update in place"); } var clone = this.slice(); return clone.sort.apply(clone, arguments); }, remove: function (value) { var adm = this[$mobx]; var idx = adm.dehanceValues(adm.values).indexOf(value); if (idx > -1) { this.splice(idx, 1); return true; } return false; }, get: function (index) { var adm = this[$mobx]; if (adm) { if (index < adm.values.length) { adm.atom.reportObserved(); return adm.dehanceValue(adm.values[index]); } console.warn("[mobx.array] Attempt to read an array index (" + index + ") that is out of bounds (" + adm.values.length + "). Please check length first. Out of bound indices will not be tracked by MobX"); } return undefined; }, set: function (index, newValue) { var adm = this[$mobx]; var values = adm.values; if (index < values.length) { // update at index in range checkIfStateModificationsAreAllowed(adm.atom); var oldValue = values[index]; if (hasInterceptors(adm)) { var change = interceptChange(adm, { type: "update", object: adm.proxy, index: index, newValue: newValue }); if (!change) return; newValue = change.newValue; } newValue = adm.enhancer(newValue, oldValue); var changed = newValue !== oldValue; if (changed) { values[index] = newValue; adm.notifyArrayChildUpdate(index, newValue, oldValue); } } else if (index === values.length) { // add a new item adm.spliceWithArray(index, 0, [newValue]); } else { // out of bounds throw new Error("[mobx.array] Index out of bounds, " + index + " is larger than " + values.length); } } }; [ "concat", "flat", "includes", "indexOf", "join", "lastIndexOf", "slice", "toString", "toLocaleString" ].forEach(function (funcName) { // Feature detection (eg flat may not be available) if (typeof Array.prototype[funcName] !== "function") { return; } arrayExtensions[funcName] = function () { var adm = this[$mobx]; adm.atom.reportObserved(); var res = adm.dehanceValues(adm.values); return res[funcName].apply(res, arguments); }; }); ["every", "filter", "find", "findIndex", "flatMap", "forEach", "map", "some"].forEach(function (funcName) { // Feature detection (eg flatMap may not be available) if (typeof Array.prototype[funcName] !== "function") { return; } arrayExtensions[funcName] = function (callback, thisArg) { var _this = this; var adm = this[$mobx]; adm.atom.reportObserved(); return adm.values[funcName](function (element, index) { element = adm.dehanceValue(element); return callback.call(thisArg, element, index, _this); }, thisArg); }; }); ["reduce", "reduceRight"].forEach(function (funcName) { arrayExtensions[funcName] = function (callback, initialValue) { var _this = this; var adm = this[$mobx]; adm.atom.reportObserved(); return adm.values[funcName](function (accumulator, currentValue, index) { currentValue = adm.dehanceValue(currentValue); return callback(accumulator, currentValue, index, _this); }, initialValue); }; }); var isObservableArrayAdministration = createInstanceofPredicate("ObservableArrayAdministration", ObservableArrayAdministration); function isObservableArray(thing) { return isObject(thing) && isObservableArrayAdministration(thing[$mobx]); } var _a; var ObservableMapMarker = {}; // just extend Map? See also https://gist.github.com/nestharus/13b4d74f2ef4a2f4357dbd3fc23c1e54 // But: https://github.com/mobxjs/mobx/issues/1556 var ObservableMap = /** @class */ (function () { function ObservableMap(initialData, enhancer, name) { if (enhancer === void 0) { enhancer = deepEnhancer; } if (name === void 0) { name = "ObservableMap@" + getNextId(); } this.enhancer = enhancer; this.name = name; this[_a] = ObservableMapMarker; this._keysAtom = createAtom(this.name + ".keys()"); this[Symbol.toStringTag] = "Map"; if (typeof Map !== "function") { throw new Error("mobx.map requires Map polyfill for the current browser. Check babel-polyfill or core-js/es6/map.js"); } this._data = new Map(); this._hasMap = new Map(); this.merge(initialData); } ObservableMap.prototype._has = function (key) { return this._data.has(key); }; ObservableMap.prototype.has = function (key) { var _this = this; if (!globalState.trackingDerivation) return this._has(key); var entry = this._hasMap.get(key); if (!entry) { // todo: replace with atom (breaking change) var newEntry = (entry = new ObservableValue(this._has(key), referenceEnhancer, this.name + "." + stringifyKey(key) + "?", false)); this._hasMap.set(key, newEntry); onBecomeUnobserved(newEntry, function () { return _this._hasMap.delete(key); }); } return entry.get(); }; ObservableMap.prototype.set = function (key, value) { var hasKey = this._has(key); if (hasInterceptors(this)) { var change = interceptChange(this, { type: hasKey ? "update" : "add", object: this, newValue: value, name: key }); if (!change) return this; value = change.newValue; } if (hasKey) { this._updateValue(key, value); } else { this._addValue(key, value); } return this; }; ObservableMap.prototype.delete = function (key) { var _this = this; checkIfStateModificationsAreAllowed(this._keysAtom); if (hasInterceptors(this)) { var change = interceptChange(this, { type: "delete", object: this, name: key }); if (!change) return false; } if (this._has(key)) { var notifySpy = isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { type: "delete", object: this, oldValue: this._data.get(key).value, name: key } : null; if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); transaction(function () { _this._keysAtom.reportChanged(); _this._updateHasMapEntry(key, false); var observable = _this._data.get(key); observable.setNewValue(undefined); _this._data.delete(key); }); if (notify) notifyListeners(this, change); if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd(); return true; } return false; }; ObservableMap.prototype._updateHasMapEntry = function (key, value) { var entry = this._hasMap.get(key); if (entry) { entry.setNewValue(value); } }; ObservableMap.prototype._updateValue = function (key, newValue) { var observable = this._data.get(key); newValue = observable.prepareNewValue(newValue); if (newValue !== globalState.UNCHANGED) { var notifySpy = isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { type: "update", object: this, oldValue: observable.value, name: key, newValue: newValue } : null; if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); observable.setNewValue(newValue); if (notify) notifyListeners(this, change); if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd(); } }; ObservableMap.prototype._addValue = function (key, newValue) { var _this = this; checkIfStateModificationsAreAllowed(this._keysAtom); transaction(function () { var observable = new ObservableValue(newValue, _this.enhancer, _this.name + "." + stringifyKey(key), false); _this._data.set(key, observable); newValue = observable.value; // value might have been changed _this._updateHasMapEntry(key, true); _this._keysAtom.reportChanged(); }); var notifySpy = isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { type: "add", object: this, name: key, newValue: newValue } : null; if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); if (notify) notifyListeners(this, change); if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd(); }; ObservableMap.prototype.get = function (key) { if (this.has(key)) return this.dehanceValue(this._data.get(key).get()); return this.dehanceValue(undefined); }; ObservableMap.prototype.dehanceValue = function (value) { if (this.dehancer !== undefined) { return this.dehancer(value); } return value; }; ObservableMap.prototype.keys = function () { this._keysAtom.reportObserved(); return this._data.keys(); }; ObservableMap.prototype.values = function () { var self = this; var keys = this.keys(); return makeIterable({ next: function () { var _b = keys.next(), done = _b.done, value = _b.value; return { done: done, value: done ? undefined : self.get(value) }; } }); }; ObservableMap.prototype.entries = function () { var self = this; var keys = this.keys(); return makeIterable({ next: function () { var _b = keys.next(), done = _b.done, value = _b.value; return { done: done, value: done ? undefined : [value, self.get(value)] }; } }); }; ObservableMap.prototype[(_a = $mobx, Symbol.iterator)] = function () { return this.entries(); }; ObservableMap.prototype.forEach = function (callback, thisArg) { var e_1, _b; try { for (var _c = __values(this), _d = _c.next(); !_d.done; _d = _c.next()) { var _e = __read(_d.value, 2), key = _e[0], value = _e[1]; callback.call(thisArg, value, key, this); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_b = _c.return)) _b.call(_c); } finally { if (e_1) throw e_1.error; } } }; /** Merge another object into this object, returns this. */ ObservableMap.prototype.merge = function (other) { var _this = this; if (isObservableMap(other)) { other = other.toJS(); } transaction(function () { if (isPlainObject(other)) getPlainObjectKeys(other).forEach(function (key) { return _this.set(key, other[key]); }); else if (Array.isArray(other)) other.forEach(function (_b) { var _c = __read(_b, 2), key = _c[0], value = _c[1]; return _this.set(key, value); }); else if (isES6Map(other)) { if (other.constructor !== Map) fail("Cannot initialize from classes that inherit from Map: " + other.constructor.name); // prettier-ignore other.forEach(function (value, key) { return _this.set(key, value); }); } else if (other !== null && other !== undefined) fail("Cannot initialize map from " + other); }); return this; }; ObservableMap.prototype.clear = function () { var _this = this; transaction(function () { untracked(function () { var e_2, _b; try { for (var _c = __values(_this.keys()), _d = _c.next(); !_d.done; _d = _c.next()) { var key = _d.value; _this.delete(key); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_d && !_d.done && (_b = _c.return)) _b.call(_c); } finally { if (e_2) throw e_2.error; } } }); }); }; ObservableMap.prototype.replace = function (values) { var _this = this; // Implementation requirements: // - respect ordering of replacement map // - allow interceptors to run and potentially prevent individual operations // - don't recreate observables that already exist in original map (so we don't destroy existing subscriptions) // - don't _keysAtom.reportChanged if the keys of resulting map are indentical (order matters!) // - note that result map may differ from replacement map due to the interceptors transaction(function () { var e_3, _b, e_4, _c; // Convert to map so we can do quick key lookups var replacementMap = convertToMap(values); var orderedData = new Map(); // Used for optimization var keysReportChangedCalled = false; try { // Delete keys that don't exist in replacement map // if the key deletion is prevented by interceptor // add entry at the beginning of the result map for (var _d = __values(_this._data.keys()), _e = _d.next(); !_e.done; _e = _d.next()) { var key = _e.value; // Concurrently iterating/deleting keys // iterator should handle this correctly if (!replacementMap.has(key)) { var deleted = _this.delete(key); // Was the key removed? if (deleted) { // _keysAtom.reportChanged() was already called keysReportChangedCalled = true; } else { // Delete prevented by interceptor var value = _this._data.get(key); orderedData.set(key, value); } } } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (_e && !_e.done && (_b = _d.return)) _b.call(_d); } finally { if (e_3) throw e_3.error; } } try { // Merge entries for (var _f = __values(replacementMap.entries()), _g = _f.next(); !_g.done; _g = _f.next()) { var _h = __read(_g.value, 2), key = _h[0], value = _h[1]; // We will want to know whether a new key is added var keyExisted = _this._data.has(key); // Add or update value _this.set(key, value); // The addition could have been prevent by interceptor if (_this._data.has(key)) { // The update could have been prevented by interceptor // and also we want to preserve existing values // so use value from _data map (instead of replacement map) var value_1 = _this._data.get(key); orderedData.set(key, value_1); // Was a new key added? if (!keyExisted) { // _keysAtom.reportChanged() was already called keysReportChangedCalled = true; } } } } catch (e_4_1) { e_4 = { error: e_4_1 }; } finally { try { if (_g && !_g.done && (_c = _f.return)) _c.call(_f); } finally { if (e_4) throw e_4.error; } } // Check for possible key order change if (!keysReportChangedCalled) { if (_this._data.size !== orderedData.size) { // If size differs, keys are definitely modified _this._keysAtom.reportChanged(); } else { var iter1 = _this._data.keys(); var iter2 = orderedData.keys(); var next1 = iter1.next(); var next2 = iter2.next(); while (!next1.done) { if (next1.value !== next2.value) { _this._keysAtom.reportChanged(); break; } next1 = iter1.next(); next2 = iter2.next(); } } } // Use correctly ordered map _this._data = orderedData; }); return this; }; Object.defineProperty(ObservableMap.prototype, "size", { get: function () { this._keysAtom.reportObserved(); return this._data.size; }, enumerable: true, configurable: true }); /** * Returns a plain object that represents this map. * Note that all the keys being stringified. * If there are duplicating keys after converting them to strings, behaviour is undetermined. */ ObservableMap.prototype.toPOJO = function () { var e_5, _b; var res = {}; try { for (var _c = __values(this), _d = _c.next(); !_d.done; _d = _c.next()) { var _e = __read(_d.value, 2), key = _e[0], value = _e[1]; // We lie about symbol key types due to https://github.com/Microsoft/TypeScript/issues/1863 res[typeof key === "symbol" ? key : stringifyKey(key)] = value; } } catch (e_5_1) { e_5 = { error: e_5_1 }; } finally { try { if (_d && !_d.done && (_b = _c.return)) _b.call(_c); } finally { if (e_5) throw e_5.error; } } return res; }; /** * Returns a shallow non observable object clone of this map. * Note that the values migth still be observable. For a deep clone use mobx.toJS. */ ObservableMap.prototype.toJS = function () { return new Map(this); }; ObservableMap.prototype.toJSON = function () { // Used by JSON.stringify return this.toPOJO(); }; ObservableMap.prototype.toString = function () { var _this = this; return (this.name + "[{ " + Array.from(this.keys()) .map(function (key) { return stringifyKey(key) + ": " + ("" + _this.get(key)); }) .join(", ") + " }]"); }; /** * Observes this object. Triggers for the events 'add', 'update' and 'delete'. * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe * for callback details */ ObservableMap.prototype.observe = function (listener, fireImmediately) { process.env.NODE_ENV !== "production" && invariant(fireImmediately !== true, "`observe` doesn't support fireImmediately=true in combination with maps."); return registerListener(this, listener); }; ObservableMap.prototype.intercept = function (handler) { return registerInterceptor(this, handler); }; return ObservableMap; }()); /* 'var' fixes small-build issue */ var isObservableMap = createInstanceofPredicate("ObservableMap", ObservableMap); var _a$1; var ObservableSetMarker = {}; var ObservableSet = /** @class */ (function () { function ObservableSet(initialData, enhancer, name) { if (enhancer === void 0) { enhancer = deepEnhancer; } if (name === void 0) { name = "ObservableSet@" + getNextId(); } this.name = name; this[_a$1] = ObservableSetMarker; this._data = new Set(); this._atom = createAtom(this.name); this[Symbol.toStringTag] = "Set"; if (typeof Set !== "function") { throw new Error("mobx.set requires Set polyfill for the current browser. Check babel-polyfill or core-js/es6/set.js"); } this.enhancer = function (newV, oldV) { return enhancer(newV, oldV, name); }; if (initialData) { this.replace(initialData); } } ObservableSet.prototype.dehanceValue = function (value) { if (this.dehancer !== undefined) { return this.dehancer(value); } return value; }; ObservableSet.prototype.clear = function () { var _this = this; transaction(function () { untracked(function () { var e_1, _b; try { for (var _c = __values(_this._data.values()), _d = _c.next(); !_d.done; _d = _c.next()) { var value = _d.value; _this.delete(value); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_b = _c.return)) _b.call(_c); } finally { if (e_1) throw e_1.error; } } }); }); }; ObservableSet.prototype.forEach = function (callbackFn, thisArg) { var e_2, _b; try { for (var _c = __values(this), _d = _c.next(); !_d.done; _d = _c.next()) { var value = _d.value; callbackFn.call(thisArg, value, value, this); } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (_d && !_d.done && (_b = _c.return)) _b.call(_c); } finally { if (e_2) throw e_2.error; } } }; Object.defineProperty(ObservableSet.prototype, "size", { get: function () { this._atom.reportObserved(); return this._data.size; }, enumerable: true, configurable: true }); ObservableSet.prototype.add = function (value) { var _this = this; checkIfStateModificationsAreAllowed(this._atom); if (hasInterceptors(this)) { var change = interceptChange(this, { type: "add", object: this, newValue: value }); if (!change) return this; // TODO: ideally, value = change.value would be done here, so that values can be // changed by interceptor. Same applies for other Set and Map api's. } if (!this.has(value)) { transaction(function () { _this._data.add(_this.enhancer(value, undefined)); _this._atom.reportChanged(); }); var notifySpy = isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { type: "add", object: this, newValue: value } : null; if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(change); if (notify) notifyListeners(this, change); if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd(); } return this; }; ObservableSet.prototype.delete = function (value) { var _this = this; if (hasInterceptors(this)) { var change = interceptChange(this, { type: "delete", object: this, oldValue: value }); if (!change) return false; } if (this.has(value)) { var notifySpy = isSpyEnabled(); var notify = hasListeners(this); var change = notify || notifySpy ? { type: "delete", object: this, oldValue: value } : null; if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name })); transaction(function () { _this._atom.reportChanged(); _this._data.delete(value); }); if (notify) notifyListeners(this, change); if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd(); return true; } return false; }; ObservableSet.prototype.has = function (value) { this._atom.reportObserved(); return this._data.has(this.dehanceValue(value)); }; ObservableSet.prototype.entries = function () { var nextIndex = 0; var keys = Array.from(this.keys()); var values = Array.from(this.values()); return makeIterable({ next: function () { var index = nextIndex; nextIndex += 1; return index < values.length ? { value: [keys[index], values[index]], done: false } : { done: true }; } }); }; ObservableSet.prototype.keys = function () { return this.values(); }; ObservableSet.prototype.values = function () { this._atom.reportObserved(); var self = this; var nextIndex = 0; var observableValues = Array.from(this._data.values()); return makeIterable({ next: function () { return nextIndex < observableValues.length ? { value: self.dehanceValue(observableValues[nextIndex++]), done: false } : { done: true }; } }); }; ObservableSet.prototype.replace = function (other) { var _this = this; if (isObservableSet(other)) { other = other.toJS(); } transaction(function () { if (Array.isArray(other)) { _this.clear(); other.forEach(function (value) { return _this.add(value); }); } else if (isES6Set(other)) { _this.clear(); other.forEach(function (value) { return _this.add(value); }); } else if (other !== null && other !== undefined) { fail("Cannot initialize set from " + other); } }); return this; }; ObservableSet.prototype.observe = function (listener, fireImmediately) { // TODO 'fireImmediately' can be true? process.env.NODE_ENV !== "production" && invariant(fireImmediately !== true, "`observe` doesn't support fireImmediately=true in combination with sets."); return registerListener(this, listener); }; ObservableSet.prototype.intercept = function (handler) { return registerInterceptor(this, handler); }; ObservableSet.prototype.toJS = function () { return new Set(this); }; ObservableSet.prototype.toString = function () { return this.name + "[ " + Array.from(this).join(", ") + " ]"; }; ObservableSet.prototype[(_a$1 = $mobx, Symbol.iterator)] = function () { return this.values(); }; return ObservableSet; }()); var isObservableSet = createInstanceofPredicate("ObservableSet", ObservableSet); var ObservableObjectAdministration = /** @class */ (function () { function ObservableObjectAdministration(target, values, name, defaultEnhancer) { if (values === void 0) { values = new Map(); } this.target = target; this.values = values; this.name = name; this.defaultEnhancer = defaultEnhancer; this.keysAtom = new Atom(name + ".keys"); } ObservableObjectAdministration.prototype.read = function (key) { return this.values.get(key).get(); }; ObservableObjectAdministration.prototype.write = function (key, newValue) { var instance = this.target; var observable = this.values.get(key); if (observable instanceof ComputedValue) { observable.set(newValue); return; } // intercept if (hasInterceptors(this)) { var change = interceptChange(this, { type: "update", object: this.proxy || instance, name: key, newValue: newValue }); if (!change) return; newValue = change.newValue; } newValue = observable.prepareNewValue(newValue); // notify spy & observers if (newValue !== globalState.UNCHANGED) { var notify = hasListeners(this); var notifySpy = isSpyEnabled(); var change = notify || notifySpy ? { type: "update", object: this.proxy || instance, oldValue: observable.value, name: key, newValue: newValue } : null; if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); observable.setNewValue(newValue); if (notify) notifyListeners(this, change); if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd(); } }; ObservableObjectAdministration.prototype.has = function (key) { var map = this.pendingKeys || (this.pendingKeys = new Map()); var entry = map.get(key); if (entry) return entry.get(); else { var exists = !!this.values.get(key); // Possible optimization: Don't have a separate map for non existing keys, // but store them in the values map instead, using a special symbol to denote "not existing" entry = new ObservableValue(exists, referenceEnhancer, this.name + "." + stringifyKey(key) + "?", false); map.set(key, entry); return entry.get(); // read to subscribe } }; ObservableObjectAdministration.prototype.addObservableProp = function (propName, newValue, enhancer) { if (enhancer === void 0) { enhancer = this.defaultEnhancer; } var target = this.target; assertPropertyConfigurable(target, propName); if (hasInterceptors(this)) { var change = interceptChange(this, { object: this.proxy || target, name: propName, type: "add", newValue: newValue }); if (!change) return; newValue = change.newValue; } var observable = new ObservableValue(newValue, enhancer, this.name + "." + stringifyKey(propName), false); this.values.set(propName, observable); newValue = observable.value; // observableValue might have changed it Object.defineProperty(target, propName, generateObservablePropConfig(propName)); this.notifyPropertyAddition(propName, newValue); }; ObservableObjectAdministration.prototype.addComputedProp = function (propertyOwner, // where is the property declared? propName, options) { var target = this.target; options.name = options.name || this.name + "." + stringifyKey(propName); this.values.set(propName, new ComputedValue(options)); if (propertyOwner === target || isPropertyConfigurable(propertyOwner, propName)) Object.defineProperty(propertyOwner, propName, generateComputedPropConfig(propName)); }; ObservableObjectAdministration.prototype.remove = function (key) { if (!this.values.has(key)) return; var target = this.target; if (hasInterceptors(this)) { var change = interceptChange(this, { object: this.proxy || target, name: key, type: "remove" }); if (!change) return; } try { startBatch(); var notify = hasListeners(this); var notifySpy = isSpyEnabled(); var oldObservable = this.values.get(key); var oldValue = oldObservable && oldObservable.get(); oldObservable && oldObservable.set(undefined); // notify key and keyset listeners this.keysAtom.reportChanged(); this.values.delete(key); if (this.pendingKeys) { var entry = this.pendingKeys.get(key); if (entry) entry.set(false); } // delete the prop delete this.target[key]; var change = notify || notifySpy ? { type: "remove", object: this.proxy || target, oldValue: oldValue, name: key } : null; if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); if (notify) notifyListeners(this, change); if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd(); } finally { endBatch(); } }; ObservableObjectAdministration.prototype.illegalAccess = function (owner, propName) { /** * This happens if a property is accessed through the prototype chain, but the property was * declared directly as own property on the prototype. * * E.g.: * class A { * } * extendObservable(A.prototype, { x: 1 }) * * classB extens A { * } * console.log(new B().x) * * It is unclear whether the property should be considered 'static' or inherited. * Either use `console.log(A.x)` * or: decorate(A, { x: observable }) * * When using decorate, the property will always be redeclared as own property on the actual instance */ console.warn("Property '" + propName + "' of '" + owner + "' was accessed through the prototype chain. Use 'decorate' instead to declare the prop or access it statically through it's owner"); }; /** * Observes this object. Triggers for the events 'add', 'update' and 'delete'. * See: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/observe * for callback details */ ObservableObjectAdministration.prototype.observe = function (callback, fireImmediately) { process.env.NODE_ENV !== "production" && invariant(fireImmediately !== true, "`observe` doesn't support the fire immediately property for observable objects."); return registerListener(this, callback); }; ObservableObjectAdministration.prototype.intercept = function (handler) { return registerInterceptor(this, handler); }; ObservableObjectAdministration.prototype.notifyPropertyAddition = function (key, newValue) { var notify = hasListeners(this); var notifySpy = isSpyEnabled(); var change = notify || notifySpy ? { type: "add", object: this.proxy || this.target, name: key, newValue: newValue } : null; if (notifySpy && process.env.NODE_ENV !== "production") spyReportStart(__assign(__assign({}, change), { name: this.name, key: key })); if (notify) notifyListeners(this, change); if (notifySpy && process.env.NODE_ENV !== "production") spyReportEnd(); if (this.pendingKeys) { var entry = this.pendingKeys.get(key); if (entry) entry.set(true); } this.keysAtom.reportChanged(); }; ObservableObjectAdministration.prototype.getKeys = function () { var e_1, _a; this.keysAtom.reportObserved(); // return Reflect.ownKeys(this.values) as any var res = []; try { for (var _b = __values(this.values), _c = _b.next(); !_c.done; _c = _b.next()) { var _d = __read(_c.value, 2), key = _d[0], value = _d[1]; if (value instanceof ObservableValue) res.push(key); } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_c && !_c.done && (_a = _b.return)) _a.call(_b); } finally { if (e_1) throw e_1.error; } } return res; }; return ObservableObjectAdministration; }()); function asObservableObject(target, name, defaultEnhancer) { if (name === void 0) { name = ""; } if (defaultEnhancer === void 0) { defaultEnhancer = deepEnhancer; } if (Object.prototype.hasOwnProperty.call(target, $mobx)) return target[$mobx]; process.env.NODE_ENV !== "production" && invariant(Object.isExtensible(target), "Cannot make the designated object observable; it is not extensible"); if (!isPlainObject(target)) name = (target.constructor.name || "ObservableObject") + "@" + getNextId(); if (!name) name = "ObservableObject@" + getNextId(); var adm = new ObservableObjectAdministration(target, new Map(), stringifyKey(name), defaultEnhancer); addHiddenProp(target, $mobx, adm); return adm; } var observablePropertyConfigs = Object.create(null); var computedPropertyConfigs = Object.create(null); function generateObservablePropConfig(propName) { return (observablePropertyConfigs[propName] || (observablePropertyConfigs[propName] = { configurable: true, enumerable: true, get: function () { return this[$mobx].read(propName); }, set: function (v) { this[$mobx].write(propName, v); } })); } function getAdministrationForComputedPropOwner(owner) { var adm = owner[$mobx]; if (!adm) { // because computed props are declared on proty, // the current instance might not have been initialized yet initializeInstance(owner); return owner[$mobx]; } return adm; } function generateComputedPropConfig(propName) { return (computedPropertyConfigs[propName] || (computedPropertyConfigs[propName] = { configurable: globalState.computedConfigurable, enumerable: false, get: function () { return getAdministrationForComputedPropOwner(this).read(propName); }, set: function (v) { getAdministrationForComputedPropOwner(this).write(propName, v); } })); } var isObservableObjectAdministration = createInstanceofPredicate("ObservableObjectAdministration", ObservableObjectAdministration); function isObservableObject(thing) { if (isObject(thing)) { // Initializers run lazily when transpiling to babel, so make sure they are run... initializeInstance(thing); return isObservableObjectAdministration(thing[$mobx]); } return false; } function getAtom(thing, property) { if (typeof thing === "object" && thing !== null) { if (isObservableArray(thing)) { if (property !== undefined) fail(process.env.NODE_ENV !== "production" && "It is not possible to get index atoms from arrays"); return thing[$mobx].atom; } if (isObservableSet(thing)) { return thing[$mobx]; } if (isObservableMap(thing)) { var anyThing = thing; if (property === undefined) return anyThing._keysAtom; var observable = anyThing._data.get(property) || anyThing._hasMap.get(property); if (!observable) fail(process.env.NODE_ENV !== "production" && "the entry '" + property + "' does not exist in the observable map '" + getDebugName(thing) + "'"); return observable; } // Initializers run lazily when transpiling to babel, so make sure they are run... initializeInstance(thing); if (property && !thing[$mobx]) thing[property]; // See #1072 if (isObservableObject(thing)) { if (!property) return fail(process.env.NODE_ENV !== "production" && "please specify a property"); var observable = thing[$mobx].values.get(property); if (!observable) fail(process.env.NODE_ENV !== "production" && "no observable property '" + property + "' found on the observable object '" + getDebugName(thing) + "'"); return observable; } if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) { return thing; } } else if (typeof thing === "function") { if (isReaction(thing[$mobx])) { // disposer function return thing[$mobx]; } } return fail(process.env.NODE_ENV !== "production" && "Cannot obtain atom from " + thing); } function getAdministration(thing, property) { if (!thing) fail("Expecting some object"); if (property !== undefined) return getAdministration(getAtom(thing, property)); if (isAtom(thing) || isComputedValue(thing) || isReaction(thing)) return thing; if (isObservableMap(thing) || isObservableSet(thing)) return thing; // Initializers run lazily when transpiling to babel, so make sure they are run... initializeInstance(thing); if (thing[$mobx]) return thing[$mobx]; fail(process.env.NODE_ENV !== "production" && "Cannot obtain administration from " + thing); } function getDebugName(thing, property) { var named; if (property !== undefined) named = getAtom(thing, property); else if (isObservableObject(thing) || isObservableMap(thing) || isObservableSet(thing)) named = getAdministration(thing); else named = getAtom(thing); // valid for arrays as well return named.name; } var toString = Object.prototype.toString; function deepEqual(a, b, depth) { if (depth === void 0) { depth = -1; } return eq(a, b, depth); } // Copied from https://github.com/jashkenas/underscore/blob/5c237a7c682fb68fd5378203f0bf22dce1624854/underscore.js#L1186-L1289 // Internal recursive comparison function for `isEqual`. function eq(a, b, depth, aStack, bStack) { // Identical objects are equal. `0 === -0`, but they aren't identical. // See the [Harmony `egal` proposal](http://wiki.ecmascript.org/doku.php?id=harmony:egal). if (a === b) return a !== 0 || 1 / a === 1 / b; // `null` or `undefined` only equal to itself (strict comparison). if (a == null || b == null) return false; // `NaN`s are equivalent, but non-reflexive. if (a !== a) return b !== b; // Exhaust primitive checks var type = typeof a; if (type !== "function" && type !== "object" && typeof b != "object") return false; // Compare `[[Class]]` names. var className = toString.call(a); if (className !== toString.call(b)) return false; switch (className) { // Strings, numbers, regular expressions, dates, and booleans are compared by value. case "[object RegExp]": // RegExps are coerced to strings for comparison (Note: '' + /a/i === '/a/i') case "[object String]": // Primitives and their corresponding object wrappers are equivalent; thus, `"5"` is // equivalent to `new String("5")`. return "" + a === "" + b; case "[object Number]": // `NaN`s are equivalent, but non-reflexive. // Object(NaN) is equivalent to NaN. if (+a !== +a) return +b !== +b; // An `egal` comparison is performed for other numeric values. return +a === 0 ? 1 / +a === 1 / b : +a === +b; case "[object Date]": case "[object Boolean]": // Coerce dates and booleans to numeric primitive values. Dates are compared by their // millisecond representations. Note that invalid dates with millisecond representations // of `NaN` are not equivalent. return +a === +b; case "[object Symbol]": return (typeof Symbol !== "undefined" && Symbol.valueOf.call(a) === Symbol.valueOf.call(b)); case "[object Map]": case "[object Set]": // Maps and Sets are unwrapped to arrays of entry-pairs, adding an incidental level. // Hide this extra level by increasing the depth. if (depth >= 0) { depth++; } break; } // Unwrap any wrapped objects. a = unwrap(a); b = unwrap(b); var areArrays = className === "[object Array]"; if (!areArrays) { if (typeof a != "object" || typeof b != "object") return false; // Objects with different constructors are not equivalent, but `Object`s or `Array`s // from different frames are. var aCtor = a.constructor, bCtor = b.constructor; if (aCtor !== bCtor && !(typeof aCtor === "function" && aCtor instanceof aCtor && typeof bCtor === "function" && bCtor instanceof bCtor) && ("constructor" in a && "constructor" in b)) { return false; } } if (depth === 0) { return false; } else if (depth < 0) { depth = -1; } // Assume equality for cyclic structures. The algorithm for detecting cyclic // structures is adapted from ES 5.1 section 15.12.3, abstract operation `JO`. // Initializing stack of traversed objects. // It's done here since we only need them for objects and arrays comparison. aStack = aStack || []; bStack = bStack || []; var length = aStack.length; while (length--) { // Linear search. Performance is inversely proportional to the number of // unique nested structures. if (aStack[length] === a) return bStack[length] === b; } // Add the first object to the stack of traversed objects. aStack.push(a); bStack.push(b); // Recursively compare objects and arrays. if (areArrays) { // Compare array lengths to determine if a deep comparison is necessary. length = a.length; if (length !== b.length) return false; // Deep compare the contents, ignoring non-numeric properties. while (length--) { if (!eq(a[length], b[length], depth - 1, aStack, bStack)) return false; } } else { // Deep compare objects. var keys = Object.keys(a); var key = void 0; length = keys.length; // Ensure that both objects contain the same number of properties before comparing deep equality. if (Object.keys(b).length !== length) return false; while (length--) { // Deep compare each member key = keys[length]; if (!(has$1(b, key) && eq(a[key], b[key], depth - 1, aStack, bStack))) return false; } } // Remove the first object from the stack of traversed objects. aStack.pop(); bStack.pop(); return true; } function unwrap(a) { if (isObservableArray(a)) return a.slice(); if (isES6Map(a) || isObservableMap(a)) return Array.from(a.entries()); if (isES6Set(a) || isObservableSet(a)) return Array.from(a.entries()); return a; } function has$1(a, key) { return Object.prototype.hasOwnProperty.call(a, key); } function makeIterable(iterator) { iterator[Symbol.iterator] = getSelf; return iterator; } function getSelf() { return this; } /** * (c) Michel Weststrate 2015 - 2018 * MIT Licensed * * Welcome to the mobx sources! To get an global overview of how MobX internally works, * this is a good place to start: * https://medium.com/@mweststrate/becoming-fully-reactive-an-in-depth-explanation-of-mobservable-55995262a254#.xvbh6qd74 * * Source folders: * =============== * * - api/ Most of the public static methods exposed by the module can be found here. * - core/ Implementation of the MobX algorithm; atoms, derivations, reactions, dependency trees, optimizations. Cool stuff can be found here. * - types/ All the magic that is need to have observable objects, arrays and values is in this folder. Including the modifiers like `asFlat`. * - utils/ Utility stuff. * */ if (typeof Proxy === "undefined" || typeof Symbol === "undefined") { throw new Error("[mobx] MobX 5+ requires Proxy and Symbol objects. If your environment doesn't support Symbol or Proxy objects, please downgrade to MobX 4. For React Native Android, consider upgrading JSCore."); } try { // define process.env if needed // if this is not a production build in the first place // (in which case the expression below would be substituted with 'production') process.env.NODE_ENV; } catch (e) { var g = getGlobal(); if (typeof process === "undefined") g.process = {}; g.process.env = {}; } (function () { function testCodeMinification() { } if (testCodeMinification.name !== "testCodeMinification" && process.env.NODE_ENV !== "production" && typeof process !== 'undefined' && process.env.IGNORE_MOBX_MINIFY_WARNING !== "true") { // trick so it doesn't get replaced var varName = ["process", "env", "NODE_ENV"].join("."); console.warn("[mobx] you are running a minified build, but '" + varName + "' was not set to 'production' in your bundler. This results in an unnecessarily large and slow bundle"); } })(); if (typeof __MOBX_DEVTOOLS_GLOBAL_HOOK__ === "object") { // See: https://github.com/andykog/mobx-devtools/ __MOBX_DEVTOOLS_GLOBAL_HOOK__.injectMobx({ spy: spy, extras: { getDebugName: getDebugName }, $mobx: $mobx }); } exports.$mobx = $mobx; exports.FlowCancellationError = FlowCancellationError; exports.ObservableMap = ObservableMap; exports.ObservableSet = ObservableSet; exports.Reaction = Reaction; exports._allowStateChanges = allowStateChanges; exports._allowStateChangesInsideComputed = allowStateChangesInsideComputed; exports._allowStateReadsEnd = allowStateReadsEnd; exports._allowStateReadsStart = allowStateReadsStart; exports._endAction = _endAction; exports._getAdministration = getAdministration; exports._getGlobalState = getGlobalState; exports._interceptReads = interceptReads; exports._isComputingDerivation = isComputingDerivation; exports._resetGlobalState = resetGlobalState; exports._startAction = _startAction; exports.action = action; exports.autorun = autorun; exports.comparer = comparer; exports.computed = computed; exports.configure = configure; exports.createAtom = createAtom; exports.decorate = decorate; exports.entries = entries; exports.extendObservable = extendObservable; exports.flow = flow; exports.get = get; exports.getAtom = getAtom; exports.getDebugName = getDebugName; exports.getDependencyTree = getDependencyTree; exports.getObserverTree = getObserverTree; exports.has = has; exports.intercept = intercept; exports.isAction = isAction; exports.isArrayLike = isArrayLike; exports.isBoxedObservable = isObservableValue; exports.isComputed = isComputed; exports.isComputedProp = isComputedProp; exports.isFlowCancellationError = isFlowCancellationError; exports.isObservable = isObservable; exports.isObservableArray = isObservableArray; exports.isObservableMap = isObservableMap; exports.isObservableObject = isObservableObject; exports.isObservableProp = isObservableProp; exports.isObservableSet = isObservableSet; exports.keys = keys; exports.observable = observable; exports.observe = observe; exports.onBecomeObserved = onBecomeObserved; exports.onBecomeUnobserved = onBecomeUnobserved; exports.onReactionError = onReactionError; exports.reaction = reaction; exports.remove = remove; exports.runInAction = runInAction; exports.set = set; exports.spy = spy; exports.toJS = toJS; exports.trace = trace; exports.transaction = transaction; exports.untracked = untracked; exports.values = values; exports.when = when; Object.defineProperty(exports, '__esModule', { value: true }); })));
var through = require('through2') module.exports = function (filename) { return through(function (buf, enc, next) { next(null, buf.toString().toUpperCase()) }) }
Array.prototype.equals = function(array) { // if the other array is a falsy value, return if (!array) return false; // compare lengths - can save a lot of time if (this.length != array.length) return false; for (var i = 0, l = this.length; i < l; i++) { // Check if we have nested arrays if (this[i] instanceof Array && array[i] instanceof Array) { // recurse into the nested arrays if (!this[i].equals(array[i])) return false; } else if (this[i] != array[i]) { // Warning - two different object instances will never be equal: {x:20} != {x:20} return false; } } return true; } var installed_date = new Date().getTime(); var DefaultSettings = { "installed_date": installed_date, "timestamp": "absolute", "full_after_24h": false, "name_display": "both", "typeahead_display_username_only": true, "circled_avatars": true, "no_columns_icons": true, "yt_rm_button": true, "small_icons_compose": true, "grayscale_notification_icons": false, "url_redirection": true, "blurred_modals": true, "only_one_thumbnails": true, "minimal_mode": true, "flash_tweets": "mentions", "shorten_text": false, "share_button": true, "providers": { "500px": true, "bandcamp": true, "cloudapp": true, "dailymotion": true, "deviantart": true, "dribbble": true, "droplr": true, "flickr": true, "imgly": true, "imgur": true, "instagram": true, "mobyto": true, "soundcloud": true, "ted": true, "toresize": true, "tumblr": true, "vimeo": true, "yfrog": true, } }; var currentOptions; function onInstall() { chrome.tabs.create({ url: "options/options.html#installed" }); } function onUpdate() { chrome.tabs.create({ url: "options/options.html#updated" }); } function getVersion() { var details = chrome.app.getDetails(); return details.version; } var currVersion = getVersion(); if (!localStorage['version']) { localStorage['version'] = currVersion; } var prevVersion = localStorage['version']; function init() { const TWEETDECK_WEB_URL = 'https://tweetdeck.twitter.com'; /** * Step 2: Collate a list of all the open tabs. */ function gatherTabs(urls, itemInfos) { var allTheTabs = []; var windowsChecked = 0; console.log("gatherTabs", itemInfos.timestamp); // First get all the windows... chrome.windows.getAll(function(windows) { for (var i = 0; i < windows.length; i++) { // ... and then all their tabs. chrome.tabs.getAllInWindow(windows[i].id, function(tabs) { windowsChecked++; allTheTabs = allTheTabs.concat(tabs); if (windowsChecked === windows.length) { // We have all the tabs! Search for a TweetDeck... openApp(urls, allTheTabs, itemInfos); } }); } }); } function openApp(urls, tabs, itemInfos) { console.log("openApp", itemInfos.timestamp); // Search urls in priority order... for (var i = 0; i < urls.length; i++) { var url = urls[i]; // Search tabs... for (var j = 0; j < tabs.length; j++) { var tab = tabs[j]; if (tab.url.indexOf(url) === 0) { // Found it! var tabId = tab.id; chrome.windows.update(tab.windowId, { focused: true }); chrome.tabs.update(tabId, { selected: true, active: true, highlighted: true }, function() { console.log("update", itemInfos.timestamp); var text = itemInfos.text; var url = itemInfos.url; chrome.tabs.sendMessage(tabId, { text: text, url: url, timestamp: itemInfos.timestamp, count: 2 }) }); return; } } } // Didn't find it! Open a new one! chrome.tabs.create({ url: urls[0] }, function(tab) { var count = 0; chrome.tabs.onUpdated.addListener(function(tabId, info) { if (info.status == "complete") { count += 1; console.log("onUpdated", itemInfos.timestamp, count); chrome.tabs.sendMessage(tabId, { text: itemInfos.text, url: itemInfos.url, timestamp: itemInfos.timestamp, count: count }); } }) }); }; var clickHandler = function(info, tab) { var text; var url; if (info.selectionText && currentOptions.shorten_text) { text = "\"" + info.selectionText.substr(0, 110) + "\""; } else if (info.selectionText) { text = "\"" + info.selectionText + "\""; } else { text = tab.title.substr(0, 110); } if (info.linkUrl) { url = info.linkUrl } else { url = info.pageUrl; } if (info.mediaType === "image") { url = info.srcUrl; text = ""; } gatherTabs([TWEETDECK_WEB_URL], { "text": text, "url": url, "timestamp": new Date().getTime() }); }; if (currentOptions.share_button) { console.debug('Share button enabled'); chrome.contextMenus.create({ "title": "Share on (Better) TweetDeck", "contexts": ["page", "selection", "image", "link"], "onclick": clickHandler }); } } chrome.storage.sync.get("BTDSettings", function(obj) { if (obj.BTDSettings !== undefined) { currentOptions = obj.BTDSettings; var reApply = false; for (var setting in DefaultSettings) { if (currentOptions[setting] == undefined) { console.debug("Defining", setting, "to default value", DefaultSettings[setting]); currentOptions[setting] = DefaultSettings[setting]; reApply = true; } } if (currVersion != prevVersion) { if (!(prevVersion.split(".")[0] == currVersion.split(".")[0] && prevVersion.split(".")[1] == currVersion.split(".")[1])) { onUpdate(); } localStorage['version'] = currVersion; } for (var provider in DefaultSettings["providers"]) { if (currentOptions["providers"][provider] == undefined) { console.log("Adding", provider, "as a new provider with value", DefaultSettings["providers"][provider]); currentOptions["providers"][provider] = DefaultSettings["providers"][provider]; reApply = true; } } for (var setting in currentOptions) { if (DefaultSettings[setting] == undefined) { console.log("Deleting", setting); delete currentOptions[setting]; reApply = true; } } for (var setting in currentOptions["providers"]) { if (DefaultSettings["providers"][setting] == undefined) { delete currentOptions["providers"][setting]; reApply = true; } } if (reApply === true) { chrome.storage.sync.set({ "BTDSettings": currentOptions }, function() { console.log("Options updated!"); console.log(currentOptions); init(); }); } else { init(); } } else { chrome.storage.sync.set({ "BTDSettings": DefaultSettings }, function() { console.log("Default options set"); onInstall(); init(); }) } });
const assert = require('assert') const {ipcRenderer, remote} = require('electron') const {BrowserWindow, Menu, MenuItem} = remote const {closeWindow} = require('./window-helpers') describe('menu module', function () { describe('Menu.buildFromTemplate', function () { it('should be able to attach extra fields', function () { var menu = Menu.buildFromTemplate([ { label: 'text', extra: 'field' } ]) assert.equal(menu.items[0].extra, 'field') }) it('does not modify the specified template', function () { var template = ipcRenderer.sendSync('eval', "var template = [{label: 'text', submenu: [{label: 'sub'}]}];\nrequire('electron').Menu.buildFromTemplate(template);\ntemplate;") assert.deepStrictEqual(template, [ { label: 'text', submenu: [ { label: 'sub' } ] } ]) }) it('does not throw exceptions for undefined/null values', function () { assert.doesNotThrow(function () { Menu.buildFromTemplate([ { label: 'text', accelerator: undefined }, { label: 'text again', accelerator: null } ]) }) }) describe('Menu.buildFromTemplate should reorder based on item position specifiers', function () { it('should position before existing item', function () { var menu = Menu.buildFromTemplate([ { label: '2', id: '2' }, { label: '3', id: '3' }, { label: '1', id: '1', position: 'before=2' } ]) assert.equal(menu.items[0].label, '1') assert.equal(menu.items[1].label, '2') assert.equal(menu.items[2].label, '3') }) it('should position after existing item', function () { var menu = Menu.buildFromTemplate([ { label: '1', id: '1' }, { label: '3', id: '3' }, { label: '2', id: '2', position: 'after=1' } ]) assert.equal(menu.items[0].label, '1') assert.equal(menu.items[1].label, '2') assert.equal(menu.items[2].label, '3') }) it('should position at endof existing separator groups', function () { var menu = Menu.buildFromTemplate([ { type: 'separator', id: 'numbers' }, { type: 'separator', id: 'letters' }, { label: 'a', id: 'a', position: 'endof=letters' }, { label: '1', id: '1', position: 'endof=numbers' }, { label: 'b', id: 'b', position: 'endof=letters' }, { label: '2', id: '2', position: 'endof=numbers' }, { label: 'c', id: 'c', position: 'endof=letters' }, { label: '3', id: '3', position: 'endof=numbers' } ]) assert.equal(menu.items[0].id, 'numbers') assert.equal(menu.items[1].label, '1') assert.equal(menu.items[2].label, '2') assert.equal(menu.items[3].label, '3') assert.equal(menu.items[4].id, 'letters') assert.equal(menu.items[5].label, 'a') assert.equal(menu.items[6].label, 'b') assert.equal(menu.items[7].label, 'c') }) it('should create separator group if endof does not reference existing separator group', function () { var menu = Menu.buildFromTemplate([ { label: 'a', id: 'a', position: 'endof=letters' }, { label: '1', id: '1', position: 'endof=numbers' }, { label: 'b', id: 'b', position: 'endof=letters' }, { label: '2', id: '2', position: 'endof=numbers' }, { label: 'c', id: 'c', position: 'endof=letters' }, { label: '3', id: '3', position: 'endof=numbers' } ]) assert.equal(menu.items[0].id, 'letters') assert.equal(menu.items[1].label, 'a') assert.equal(menu.items[2].label, 'b') assert.equal(menu.items[3].label, 'c') assert.equal(menu.items[4].id, 'numbers') assert.equal(menu.items[5].label, '1') assert.equal(menu.items[6].label, '2') assert.equal(menu.items[7].label, '3') }) it('should continue inserting items at next index when no specifier is present', function () { var menu = Menu.buildFromTemplate([ { label: '4', id: '4' }, { label: '5', id: '5' }, { label: '1', id: '1', position: 'before=4' }, { label: '2', id: '2' }, { label: '3', id: '3' } ]) assert.equal(menu.items[0].label, '1') assert.equal(menu.items[1].label, '2') assert.equal(menu.items[2].label, '3') assert.equal(menu.items[3].label, '4') assert.equal(menu.items[4].label, '5') }) }) }) describe('Menu.insert', function () { it('should store item in @items by its index', function () { var menu = Menu.buildFromTemplate([ { label: '1' }, { label: '2' }, { label: '3' } ]) var item = new MenuItem({ label: 'inserted' }) menu.insert(1, item) assert.equal(menu.items[0].label, '1') assert.equal(menu.items[1].label, 'inserted') assert.equal(menu.items[2].label, '2') assert.equal(menu.items[3].label, '3') }) }) describe('Menu.popup', function () { let w = null afterEach(function () { return closeWindow(w).then(function () { w = null }) }) it('returns immediately (default async)', function () { w = new BrowserWindow({show: false, width: 200, height: 200}) const menu = Menu.buildFromTemplate([ { label: '1' }, { label: '2' }, { label: '3' } ]) menu.popup(w, {x: 100, y: 100}) menu.closePopup(w) }) }) describe('MenuItem.click', function () { it('should be called with the item object passed', function (done) { var menu = Menu.buildFromTemplate([ { label: 'text', click: function (item) { assert.equal(item.constructor.name, 'MenuItem') assert.equal(item.label, 'text') done() } } ]) menu.delegate.executeCommand({}, menu.items[0].commandId) }) }) describe('MenuItem with checked property', function () { it('clicking an checkbox item should flip the checked property', function () { var menu = Menu.buildFromTemplate([ { label: 'text', type: 'checkbox' } ]) assert.equal(menu.items[0].checked, false) menu.delegate.executeCommand({}, menu.items[0].commandId) assert.equal(menu.items[0].checked, true) }) it('clicking an radio item should always make checked property true', function () { var menu = Menu.buildFromTemplate([ { label: 'text', type: 'radio' } ]) menu.delegate.executeCommand({}, menu.items[0].commandId) assert.equal(menu.items[0].checked, true) menu.delegate.executeCommand({}, menu.items[0].commandId) assert.equal(menu.items[0].checked, true) }) it('at least have one item checked in each group', function () { var i, j, k, menu, template template = [] for (i = j = 0; j <= 10; i = ++j) { template.push({ label: '' + i, type: 'radio' }) } template.push({ type: 'separator' }) for (i = k = 12; k <= 20; i = ++k) { template.push({ label: '' + i, type: 'radio' }) } menu = Menu.buildFromTemplate(template) menu.delegate.menuWillShow() assert.equal(menu.items[0].checked, true) assert.equal(menu.items[12].checked, true) }) it('should assign groupId automatically', function () { var groupId, i, j, k, l, m, menu, template template = [] for (i = j = 0; j <= 10; i = ++j) { template.push({ label: '' + i, type: 'radio' }) } template.push({ type: 'separator' }) for (i = k = 12; k <= 20; i = ++k) { template.push({ label: '' + i, type: 'radio' }) } menu = Menu.buildFromTemplate(template) groupId = menu.items[0].groupId for (i = l = 0; l <= 10; i = ++l) { assert.equal(menu.items[i].groupId, groupId) } for (i = m = 12; m <= 20; i = ++m) { assert.equal(menu.items[i].groupId, groupId + 1) } }) it("setting 'checked' should flip other items' 'checked' property", function () { var i, j, k, l, m, menu, n, o, p, q, template template = [] for (i = j = 0; j <= 10; i = ++j) { template.push({ label: '' + i, type: 'radio' }) } template.push({ type: 'separator' }) for (i = k = 12; k <= 20; i = ++k) { template.push({ label: '' + i, type: 'radio' }) } menu = Menu.buildFromTemplate(template) for (i = l = 0; l <= 10; i = ++l) { assert.equal(menu.items[i].checked, false) } menu.items[0].checked = true assert.equal(menu.items[0].checked, true) for (i = m = 1; m <= 10; i = ++m) { assert.equal(menu.items[i].checked, false) } menu.items[10].checked = true assert.equal(menu.items[10].checked, true) for (i = n = 0; n <= 9; i = ++n) { assert.equal(menu.items[i].checked, false) } for (i = o = 12; o <= 20; i = ++o) { assert.equal(menu.items[i].checked, false) } menu.items[12].checked = true assert.equal(menu.items[10].checked, true) for (i = p = 0; p <= 9; i = ++p) { assert.equal(menu.items[i].checked, false) } assert.equal(menu.items[12].checked, true) for (i = q = 13; q <= 20; i = ++q) { assert.equal(menu.items[i].checked, false) } }) }) describe('MenuItem command id', function () { it('cannot be overwritten', function () { var item = new MenuItem({ label: 'item' }) var commandId = item.commandId assert(commandId != null) item.commandId = '' + commandId + '-modified' assert.equal(item.commandId, commandId) }) }) describe('MenuItem with invalid type', function () { it('throws an exception', function () { assert.throws(function () { Menu.buildFromTemplate([ { label: 'text', type: 'not-a-type' } ]) }, /Unknown menu item type: not-a-type/) }) }) describe('MenuItem with submenu type and missing submenu', function () { it('throws an exception', function () { assert.throws(function () { Menu.buildFromTemplate([ { label: 'text', type: 'submenu' } ]) }, /Invalid submenu/) }) }) describe('MenuItem role', function () { it('includes a default label and accelerator', function () { var item = new MenuItem({role: 'close'}) assert.equal(item.label, process.platform === 'darwin' ? 'Close Window' : 'Close') assert.equal(item.accelerator, undefined) assert.equal(item.getDefaultRoleAccelerator(), 'CommandOrControl+W') item = new MenuItem({role: 'close', label: 'Other', accelerator: 'D'}) assert.equal(item.label, 'Other') assert.equal(item.accelerator, 'D') assert.equal(item.getDefaultRoleAccelerator(), 'CommandOrControl+W') item = new MenuItem({role: 'help'}) assert.equal(item.label, 'Help') assert.equal(item.accelerator, undefined) assert.equal(item.getDefaultRoleAccelerator(), undefined) item = new MenuItem({role: 'hide'}) assert.equal(item.label, 'Hide Electron Test') assert.equal(item.accelerator, undefined) assert.equal(item.getDefaultRoleAccelerator(), 'Command+H') }) }) })
/** settings.js */
const gulp = require('gulp') const plugins = require('gulp-load-plugins')() const rupture = require('rupture') gulp.task('css', function () { return gulp.src('./static/styl/index.styl') .pipe(plugins.stylus({ use: [rupture()] })) .pipe(plugins.autoprefixer()) .pipe(plugins.csso()) .pipe(gulp.dest('./dist')) })
var through = require('through2') var split = require('split2') var duplexer = require('duplexer2') module.exports = function (opt) { opt = opt || {} var out = through() var parse = split() .on('data', function (buf) { var str = buf.toString() var match = /^\[.+console\([0-9]+\)\]\s*\"(.*)\"/i.exec(str) if (match) { if (opt.verbose) { out.push(match[1] + '\n') } } else if (!/^\[[0-9]+[\/\:]/.test(str)) { out.push(str + '\n') } }) return duplexer(parse, out) }
//------------------------------------------------------------------------------------------------------- // Copyright (C) Microsoft. All rights reserved. // Licensed under the MIT license. See LICENSE.txt file in the project root for full license information. //------------------------------------------------------------------------------------------------------- if (this.WScript && this.WScript.LoadScriptFile) { // Check for running in ch this.WScript.LoadScriptFile("..\\UnitTestFramework\\UnitTestFramework.js"); } var tests = [ { name: "Increment BigInt literal", body: function () { var x = 123n; assert.isTrue(x == 123n); x++; assert.isTrue(x == 124n); ++x; assert.isTrue(x == 125n); } }, { name: "Increment negative BigInt literal", body: function () { var x = -123n; assert.isTrue(x == -123n); x++; assert.isTrue(x == -122n); ++x; assert.isTrue(x == -121n); } }, { name: "Increment -1n", body: function () { var x = -1n; assert.isTrue(x == -1n); x++; assert.isTrue(x == 0n); ++x; assert.isTrue(x == 1n); } }, { name: "Increment to change length", body: function () { var x = 4294967295n; assert.isTrue(x == 4294967295n); x++; assert.isTrue(x == 4294967296n); ++x; assert.isTrue(x == 4294967297n); var y = -4294967297n; assert.isTrue(y == -4294967297n); y++; assert.isTrue(y == -4294967296n); ++y; assert.isTrue(y == -4294967295n); } }, { name: "Increment BigInt Object", body: function () { var x = BigInt(12345678901234567890n); var y = BigInt(12345678901234567891n); assert.isTrue(x < y); ++x; assert.isTrue(x == y); x++; assert.isTrue(x >= y); } }, { name: "Out of 64 bit range", body: function () { var x = 1234567890123456789012345678901234567890n; var y = BigInt(1234567890123456789012345678901234567891n); assert.isFalse(x == y); x++; ++y; assert.isTrue(x < y); ++x; assert.isTrue(x == y); } }, { name: "Very big", body: function () { var x = eval('1234567890'.repeat(20)+'0n'); var y = BigInt(eval('1234567890'.repeat(20)+'1n')); assert.isFalse(x == y); x++; ++y; assert.isTrue(x < y); ++x; assert.isTrue(x == y); } }, { name: "With assign", body: function () { var x = 3n; var y = x++; assert.isTrue(x == 4n); assert.isTrue(y == 3n); y = ++x; assert.isTrue(x == 5n); assert.isTrue(y == 5n); } }, ]; testRunner.runTests(tests, { verbose: WScript.Arguments[0] != "summary" });
(function() { 'use strict'; angular .module('siteApp') .constant('paginationConstants', { 'itemsPerPage': 20 }); })();
/*! * Copyright (c) 2015-2017 Cisco Systems, Inc. See LICENSE file. */ import {patterns} from '@ciscospark/common'; const usersByEmail = new WeakMap(); const usersById = new WeakMap(); /** * @class */ export default class UserUUIDStore { /** * @constructs {UserUUIDStore} */ constructor() { usersByEmail.set(this, new Map()); usersById.set(this, new Map()); } /** * Adds a user object to the store * @param {Object} user * @param {string} user.id * @param {string} user.emailAddress * @returns {Promise} */ add(user) { if (!user.id) { return Promise.reject(new Error('`user.id` is required')); } if (!user.emailAddress) { return Promise.reject(new Error('`user.emailAddress` is required')); } if (!patterns.uuid.test(user.id)) { return Promise.reject(new Error('`user.id` does not appear to be a uuid')); } if (!patterns.email.test(user.emailAddress)) { return Promise.reject(new Error('`user.emailAddress` does not appear to be an email address')); } const p1 = this.getById(user.id) .then((u) => usersById.get(this).set(user.id, Object.assign({}, u, user))) .catch(() => usersById.get(this).set(user.id, Object.assign({}, user))); const p2 = this.getByEmail(user.emailAddress) .then((u) => usersByEmail.get(this).set(user.emailAddress, Object.assign({}, u, user))) .catch(() => usersByEmail.get(this).set(user.emailAddress, Object.assign({}, user))); return Promise.all([p1, p2]); } /** * Retrievves the specified user object from the store * @param {string} id * @returns {Promise<Object>} */ get(id) { if (patterns.uuid.test(id)) { return this.getById(id); } if (patterns.email.test(id)) { return this.getByEmail(id); } return Promise.reject(new Error('`id` does not appear to be a valid user identifier')); } /** * Retrieves the specified user object by id from the store * @param {Object} id * @returns {Promise<Object>} */ getById(id) { const ret = usersById.get(this).get(id); if (ret) { return Promise.resolve(ret); } return Promise.reject(new Error('No user found by specified id')); } /** * Retrieves the specified user object by id from the store * @param {Object} email * @returns {Promise<Object>} */ getByEmail(email) { const ret = usersByEmail.get(this).get(email); if (ret) { return Promise.resolve(ret); } return Promise.reject(new Error('No user found by specified email address')); } }
var assert = require('assert') , fs = require('fs'); var DB_PATH = __dirname + '/../../tmp/db'; var USERS = { 1: {name: 'Pedro', age: 35, sex: 'm'} , 2: {name: 'John', age: 32, sex: 'm'} , 3: {name: 'Bruno', age: 28, sex: 'm'} , 4: {name: 'Sandra', age: 35, sex: 'f'} , 5: {name: 'Patricia', age: 42, sex: 'f'} , 6: {name: 'Joana', age: 29, sex: 'f'} , 7: {name: 'Susana', age: 30, sex: 'f'} }; var USER_COUNT = 7; module.exports.setup = function(next) { fs.readdirSync(DB_PATH).forEach(function(dir) { fs.unlinkSync(DB_PATH + '/' + dir); }); next(); }; module.exports.run = function(next) { var alfred = require('../../lib/alfred'); var timeout = setTimeout(function() { throw new Error('timeout'); }, 5000); alfred.open(DB_PATH, function(err, db) { if (err) { next(err); return; } db.ensure_key_map_attached('users', null, function(err) { if (err) { next(err); return; } var age_transform_function = function(user) { return user.age; }; var sex_transform_function = function(user) { return user.sex; }; db.users.ensureIndex('sex', {ordered: true}, sex_transform_function, function(err) { if (err) { next(err); return; } db.users.ensureIndex('age', {ordered: true}, age_transform_function, function(err) { if (err) { next(err); return; } var users_in = 0; for (var id in USERS) { if (USERS.hasOwnProperty(id)) { (function(id) { var user = USERS[id]; db.users.put(id, user, function(err) { if (err) { next(err); return; } users_in ++; if (users_in == USER_COUNT) { // all users done var users_1_found = 0; var users_2_found = 0; var users_3_found = 0; var users_4 = false var end_test = function() { if (users_1_found == 2 && users_2_found == 4 && users_3_found == 6 && users_4) { db.close(function(err) { if (err) { next(err); return; } clearTimeout(timeout); next(); }) } }; db.users.find({'age' : {$gt: 29, $lt: 42, $lte: 35}, 'sex': {$eq: 'f'}}) (function(err, key, value) { if (err) { next(err); return; } assert.deepEqual(value, USERS[key]); assert.ok(value.age > 29 && value.age <= 35, 'age is not equal to > 29 and < 35 for found user with key ' + key); assert.ok(value.sex =='f', 'sex != \'f\' for found user with key ' + key); users_1_found ++; assert.ok(users_1_found <= 2, 'already found ' + users_1_found + ' users'); end_test(); }) .reset() .where({'age' : {$gt: 29, $lt: 42}}) (function(err, key, value) { if (err) { next(err); return; } assert.deepEqual(value, USERS[key]); assert.ok(value.age > 29 && value.age < 42, 'age is not equal to > 29 and < 35 for found user with key ' + key); users_2_found ++; assert.ok(users_2_found <= 4, 'already found ' + users_2_found + ' users'); end_test(); }) .reset() .where({'age' : {$gt: 29, $lt: 35}}) .or({'sex': {$eq: 'f'}}) (function(err, key, value) { if (err) { next(err); return; } assert.deepEqual(value, USERS[key]); assert.ok((value.age > 29 && value.age < 35) || value.sex == 'f', '(age is not equal to > 29 and < 35) or sex == \'f\' for found user with key ' + key); users_3_found ++; assert.ok(users_3_found <= 6, 'already found ' + users_3_found + ' users'); end_test(); }) .bulk(function(err, records) { if (err) { next(err); return; } assert.equal(6, records.length); records.forEach(function(record) { assert.deepEqual(record.value, USERS[record.key]); }); users_4 = true; end_test(); }); } }); })(id); } } }); }); }) }); };
module.exports={A:{A:{"2":"K D G E A B iB"},B:{"2":"2 C d J M H I AB"},C:{"2":"0 1 2 3 4 6 7 8 9 fB FB F N K D G E A B C d J M H I O P Q R S T U V W X Y Z a b c e f g h i j k l m n o L q r s t u v w x y z IB BB CB DB GB ZB YB"},D:{"2":"0 1 2 3 4 6 7 8 9 F N K D G E A B C d J M H I O P Q R S T U V W X Y Z a b c e f g h i j k l m n o L q r s t u v w x y z IB BB CB DB GB SB OB MB lB NB KB AB PB QB"},E:{"2":"F N K D G E A B RB JB TB UB VB WB XB","132":"5 C p aB"},F:{"2":"0 1 5 6 E B C J M H I O P Q R S T U V W X Y Z a b c e f g h i j k l m n o L q r s t u v w x y z bB cB dB eB p EB gB"},G:{"2":"G JB hB HB jB kB LB mB nB oB pB qB rB","132":"sB tB uB"},H:{"2":"vB"},I:{"2":"4 FB F wB xB yB zB HB 0B 1B"},J:{"2":"D A"},K:{"2":"5 A B C L p EB"},L:{"2":"KB"},M:{"2":"3"},N:{"2":"A B"},O:{"2":"2B"},P:{"2":"F 3B 4B 5B 6B 7B"},Q:{"2":"8B"},R:{"2":"9B"},S:{"2":"AC"}},B:5,C:"CSS math functions min(), max() and clamp()"};
define(['marionette', '../../../shared/component/componentLayoutTemplate.hbs', './treeHtmlCodeTemplate.hbs', './treeJsCodeTemplate.hbs', './treeBodyView', './treeTestView', '../../../shared/component/componentExampleCodeView', 'rup.tree'], function(Marionette, ComponentLayoutTemplate, TreeHtmlCodeTemplate, TreeJsCodeTemplate, TreeBodyView, TreeTestView, ComponentExampleCodeView){ var TreeView = Marionette.LayoutView.extend({ template: ComponentLayoutTemplate, regions:{ Main: '#componentMainBody', Example: '#exampleCode', Test: '#componentTest' }, onRender: fncOnRender }); function fncOnRender(){ var $view = this; $view.Main.show(new TreeBodyView()); $view.Example.show(new ComponentExampleCodeView({ templateHtml: TreeHtmlCodeTemplate, templateJs: TreeJsCodeTemplate })); window.$ = $; $view.Test.show(new TreeTestView()); } return TreeView; });
'use strict'; /** * Module dependencies. */ var errorHandler = require('./errors.server.controller'), db = require('../models/fixsession.server.model'), _ = require('lodash'), bluebird = require('bluebird'); /** * Create a Fixsession */ exports.create = function(req, res) { db.FixSession.create({ name: req.body.name, assignedFixManager: req.body.assignedFixManager, assignedTcpManager: req.body.assignedTcpManager, initiator : req.body.initiator, host: req.body.host, port: req.body.port, username: req.body.username, password: req.body.password, defaultRoute: req.body.defaultRoute, assignedOOBProcessor: req.body.assignedOOBProcessor }).complete(function(err, results){ res.sendStatus(201); }); }; /** * List of Fixsessions */ exports.list = function(req, res) { db.FixSession.findAll() .complete(function(err, results){ res.json(results); }); };
BASE.require([ "BASE.data.Edm", "BASE.odata4.ODataAnnotation" ], function () { var ODataAnnotation = BASE.odata4.ODataAnnotation; BASE.namespace("BASE.data.testing"); var HumanoidType = function () { }; HumanoidType.annotations = [new ODataAnnotation("Namespace.HumanoidType")]; HumanoidType.None = new Enum(0); HumanoidType.None.name = "None"; HumanoidType.Human = new Enum(1); HumanoidType.Human.name = "Human"; HumanoidType.Vulcan = new Enum(2); HumanoidType.Vulcan.name = "Vulcan"; BASE.data.testing.HumanoidType = HumanoidType; });
import React, { Component } from 'react'; import { GoogleMapLoader, GoogleMap, Marker, SearchBox } from 'react-google-maps'; class CreateMapView extends Component { constructor(props) { super(props); this.state = { coordinates: '', }; this.handlePlacesChanged = this.handlePlacesChanged.bind(this); } handlePlacesChanged() { const places = this.refs.searchBox.getPlaces(); const address = places[0].formatted_address; const lat = places[0].geometry.location.lat().toString(); const lng = places[0].geometry.location.lng().toString(); const coordinates = lat.concat(',').concat(lng); this.props.addMarker(coordinates); this.props.onLocationChange(address); } render() { return ( <div className="ui card"> <GoogleMapLoader options={{ mapTypeControl: false }} containerElement={ <div {...this.props} style={{ height: '250px', width: '500px', }} /> } googleMapElement={ <GoogleMap zoom={this.props.zoom} center={this.props.center} onClick={this.props.addMarker.bind(this)} options={{ disableDefaultUI: true }} > <SearchBox className="searchBox" ref="searchBox" bounds={this.props.bounds} controlPosition={google.maps.ControlPosition.TOP_CENTER} placeholder="Enter spread location (e.g. a park)" onPlacesChanged={this.handlePlacesChanged.bind(this)} /> {this.props.markers.map((marker) => { return ( <Marker {...marker} /> ); })} </GoogleMap> } /> </div> ); } } export default CreateMapView;
"use strict" var redrawService = require("./redraw") module.exports = require("./api/router")(window, redrawService)
global.requireWithCoverage = function (libName) { if (process.env.NODE_CHESS_COVERAGE) { return require('../lib-cov/' + libName + '.js'); } if (libName === 'index') { return require('../lib'); } else { return require('../lib/' + libName + '.js'); } }; global.chai = require('chai'); global.assert = chai.assert; global.expect = chai.expect; global.should = chai.should();
var express = require('express'); var router = express.Router(); /* GET home page. */ router.get('/', function(req, res, next) { res.render('index', { title: 'SALTI Test Express Site' }); }); module.exports = router;