code
stringlengths
2
1.05M
var mage = require('../../../mage'); exports.acl = ['*']; exports.execute = function (state, engineName, command, params, cb) { var engine; try { engine = mage.ident.getEngine(engineName); } catch (error) { return state.error('ident', error, cb); } if (!engine.run) { return state.error('ident', 'Engine has no run method', cb); } engine.run(state, command, params || {}, function (error, data) { if (error) { return state.error('ident', error, cb); } if (data) { state.respond(data); } cb(); }); };
Template.header.helpers({ pageTitle: function() { return Session.get('pageTitle') || 'Qiao Door' ; } , audioLetEnabled: function() { return Meteor.isCordova ; } }); Template.header.events({ 'click .audiolet': function(e) { e.preventDefault(); AudioLet.wavPlay('0E07|2|290|26|68|41|011111111221111111111111133331',48000,2,1000,function(response){ alert('response:' + response ); },function(errMsg){ alert(errMsg); }); } });
/* * GoJS v2.1.19 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-2020 by Northwoods Software Corporation. All Rights Reserved. * THIS SOFTWARE IS LICENSED. THE LICENSE AGREEMENT IS AT: https://gojs.net/2.1.19/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 ba(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 ka=fa; function la(a,b){a.prototype=ea(b.prototype);a.prototype.constructor=a;if(ka)ka(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.lB=b.prototype}var ma="undefined"!=typeof window&&window===self?self:"undefined"!=typeof global&&null!=global?global:self,na="function"==typeof Object.defineProperties?Object.defineProperty:function(a,b,c){a!=Array.prototype&&a!=Object.prototype&&(a[b]=c.value)}; function pa(a){if(a){for(var b=ma,c=["Array","prototype","fill"],d=0;d<c.length-1;d++){var e=c[d];e in b||(b[e]={});b=b[e]}c=c[c.length-1];d=b[c];a=a(d);a!=d&&null!=a&&na(b,c,{configurable:!0,writable:!0,value:a})}}pa(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 qa="object"===typeof self&&self.self===self&&self||"object"===typeof global&&global.global===global&&global||"object"===typeof window&&window.window===window&&window||{};void 0===qa.requestAnimationFrame&&(qa.requestAnimationFrame=qa.setImmediate);function ra(){}function sa(a,b){var c=-1;return function(){var d=this,e=arguments;-1!==c&&qa.clearTimeout(c);c=ta(function(){c=-1;a.apply(d,e)},b)}}function ta(a,b){return qa.setTimeout(a,b)}function ua(a){return qa.document.createElement(a)} function v(a){throw Error(a);}function va(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=wa(c),void 0!==d&&(c+="."+d),xa(a,b,c))}function A(a,b,c,d){typeof a!==b&&(c=wa(c),void 0!==d&&(c+="."+d),xa(a,b,c))}function C(a,b,c){"number"===typeof a&&isFinite(a)||(b=wa(b),void 0!==c&&(b+="."+c),v(b+" must be a real number type, and not NaN or Infinity: "+a))} function xa(a,b,c,d){b=wa(b);c=wa(c);void 0!==d&&(c+="."+d);"string"===typeof a?v(c+" value is not an instance of "+b+': "'+a+'"'):v(c+" value is not an instance of "+b+": "+a)}function ya(a,b,c,d){c=wa(c);void 0!==d&&(c+="."+d);v(c+" is not in the range "+b+": "+a)}function za(a){v(("string"===typeof a.className?a.className:"")+" constructor cannot take any arguments.")} function Aa(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 Ba(a,b){v("No property to set for this enum value: "+b+" on "+a.toString())}function Ca(a){qa.console&&qa.console.log(a)} function Ea(){qa.console&&qa.console.log("Warning: List/Map/Set constructors no longer take an argument that enforces type.Instead they take an optional collection of Values to add to the collection. See 2.0 changelog for details.")}function Fa(a){return"object"===typeof a&&null!==a}function Ga(a){return Array.isArray(a)||qa.NodeList&&a instanceof qa.NodeList||qa.HTMLCollection&&a instanceof qa.HTMLCollection}function Ha(a,b,c){Ga(a)||xa(a,"Array or NodeList or HTMLCollection",b,c)} function Ia(a){return Array.prototype.slice.call(a)}function Ja(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 Ka(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 La(){var a=Na.pop();return void 0===a?[]:a}function Oa(a){a.length=0;Na.push(a)} function wa(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(Fa(a)&&a.constructor)return Pa(a.constructor);return typeof a} function Qa(a){var b=a;Fa(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.bB;if(c&&c[b])return!0;a=Object.getPrototypeOf(a)}return!1} function Sa(a,b,c){Object.defineProperty(Ua.prototype,a,{get:b,set:c})}function Wa(){var a=Xa;if(0===a.length)for(var b=qa.document.getElementsByTagName("canvas"),c=b.length,d=0;d<c;d++){var e=b[d];e.parentElement&&e.parentElement.B&&a.push(e.parentElement.B)}return a} function Ya(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 Za=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("MSIE 9.0"),$a=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("MSIE 10.0"),bb=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("Trident/7"),cb=void 0!==qa.navigator&&0<qa.navigator.userAgent.indexOf("Edge/"),db=void 0!==qa.navigator&&void 0!==qa.navigator.platform&&0<=qa.navigator.platform.toUpperCase().indexOf("MAC"),eb=void 0!==qa.navigator&&void 0!==qa.navigator.platform&&null!==qa.navigator.platform.match(/(iPhone|iPod|iPad)/i), Na=[];Object.freeze([]);var Xa=[];ra.className="Util";ra.Dx="32ab5ff3b26f42dc0ed90f21442913b5";ra.adym="gojs.net";ra.vfo="28e647fdb26f";ra.className="Util";function E(a,b,c){fb(this);this.l=a;this.Wa=b;this.w=c}E.prototype.toString=function(){return"EnumValue."+this.Wa};function gb(a,b){return void 0===b||null===b||""===b?null:a[b]}function hb(a,b,c,d){a.classType!==b&&(c=wa(c),void 0!==d&&(c+="."+d),xa(a,"function"==="a constant of class "+typeof b.className?b.className:"",c))} ma.Object.defineProperties(E.prototype,{classType:{configurable:!0,get:function(){return this.l}},name:{configurable:!0,get:function(){return this.Wa}},value:{configurable:!0,get:function(){return this.w}}});E.className="EnumValue";function ib(){this.hx=[]}ib.prototype.toString=function(){return this.hx.join("")};ib.prototype.add=function(a){""!==a&&this.hx.push(a)};ib.className="StringBuilder";function jb(){}jb.className="PropertyCollection"; var F={pm:!1,Zx:!1,Dz:!1,eB:!1,iB:!1,my:!1,cB:null,trace:function(a){qa.console&&qa.console.log(a)},dB: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)},iz: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.Lm=Object.getOwnPropertyNames(d.prototype);for(var e={vk:0};e.vk<b.Lm.length;e={vk:e.vk},e.vk++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.Lm[e.vk]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype, b.Lm[e.vk],{set:function(a,b){return function(){throw Error("Property "+a.Lm[b.vk]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={Lm:b.Lm,x:b.x}}}};function kb(){}kb.prototype.reset=function(){};kb.prototype.next=function(){return!1};kb.prototype.ld=function(){return!1};kb.prototype.first=function(){return null};kb.prototype.any=function(){return!1};kb.prototype.all=function(){return!0};kb.prototype.each=function(){return this};kb.prototype.map=function(){return this};kb.prototype.filter=function(){return this}; kb.prototype.Kd=function(){};kb.prototype.toString=function(){return"EmptyIterator"};ma.Object.defineProperties(kb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 0}}});kb.prototype.first=kb.prototype.first;kb.prototype.hasNext=kb.prototype.ld;kb.prototype.next=kb.prototype.next;kb.prototype.reset=kb.prototype.reset;var lb=null;kb.className="EmptyIterator";lb=new kb;function mb(a){this.key=-1;this.value=a} mb.prototype.reset=function(){this.key=-1};mb.prototype.next=function(){return-1===this.key?(this.key=0,!0):!1};mb.prototype.ld=function(){return this.next()};mb.prototype.first=function(){this.key=0;return this.value};mb.prototype.any=function(a){this.key=-1;return a(this.value)};mb.prototype.all=function(a){this.key=-1;return a(this.value)};mb.prototype.each=function(a){this.key=-1;a(this.value);return this};mb.prototype.map=function(a){return new mb(a(this.value))}; mb.prototype.filter=function(a){return a(this.value)?new mb(this.value):lb};mb.prototype.Kd=function(){this.value=null};mb.prototype.toString=function(){return"SingletonIterator("+this.value+")"};ma.Object.defineProperties(mb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return 1}}});mb.prototype.first=mb.prototype.first;mb.prototype.hasNext=mb.prototype.ld;mb.prototype.next=mb.prototype.next; mb.prototype.reset=mb.prototype.reset;mb.className="SingletonIterator";function nb(a){this.ub=a;this.mf=null;a.Ka=null;this.oa=a.v;this.Ua=-1}nb.prototype.reset=function(){var a=this.ub;a.Ka=null;this.oa=a.v;this.Ua=-1};nb.prototype.next=function(){var a=this.ub;if(a.v!==this.oa){if(0>this.key)return!1;Aa(a)}a=a.j;var b=a.length,c=++this.Ua,d=this.mf;if(null!==d)for(;c<b;){var e=a[c];if(d(e))return this.key=this.Ua=c,this.value=e,!0;c++}else{if(c<b)return this.key=c,this.value=a[c],!0;this.Kd()}return!1}; nb.prototype.ld=function(){return this.next()};nb.prototype.first=function(){var a=this.ub;this.oa=a.v;this.Ua=0;a=a.j;var b=a.length,c=this.mf;if(null!==c){for(var d=0;d<b;){var e=a[d];if(c(e))return this.key=this.Ua=d,this.value=e;d++}return null}return 0<b?(a=a[0],this.key=0,this.value=a):null};nb.prototype.any=function(a){var b=this.ub;b.Ka=null;var c=b.v;this.Ua=-1;for(var d=b.j,e=d.length,f=this.mf,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(a(h))return!0;b.v!==c&&Aa(b)}}return!1}; nb.prototype.all=function(a){var b=this.ub;b.Ka=null;var c=b.v;this.Ua=-1;for(var d=b.j,e=d.length,f=this.mf,g=0;g<e;g++){var h=d[g];if(null===f||f(h)){if(!a(h))return!1;b.v!==c&&Aa(b)}}return!0};nb.prototype.each=function(a){var b=this.ub;b.Ka=null;var c=b.v;this.Ua=-1;for(var d=b.j,e=d.length,f=this.mf,g=0;g<e;g++){var h=d[g];if(null===f||f(h))a(h),b.v!==c&&Aa(b)}return this}; nb.prototype.map=function(a){var b=this.ub;b.Ka=null;var c=b.v;this.Ua=-1;for(var d=[],e=b.j,f=e.length,g=this.mf,h=0;h<f;h++){var k=e[h];if(null===g||g(k))d.push(a(k)),b.v!==c&&Aa(b)}a=new H;a.j=d;a.qb();return a.iterator};nb.prototype.filter=function(a){var b=this.ub;b.Ka=null;var c=b.v;this.Ua=-1;for(var d=[],e=b.j,f=e.length,g=this.mf,h=0;h<f;h++){var k=e[h];if(null===g||g(k))a(k)&&d.push(k),b.v!==c&&Aa(b)}a=new H;a.j=d;a.qb();return a.iterator}; nb.prototype.Kd=function(){this.key=-1;this.value=null;this.oa=-1;this.mf=null;this.ub.Ka=this};nb.prototype.toString=function(){return"ListIterator@"+this.Ua+"/"+this.ub.count}; ma.Object.defineProperties(nb.prototype,{iterator:{configurable:!0,get:function(){return this}},predicate:{configurable:!0,get:function(){return this.mf},set:function(a){this.mf=a}},count:{configurable:!0,get:function(){var a=this.mf;if(null!==a){for(var b=0,c=this.ub.j,d=c.length,e=0;e<d;e++)a(c[e])&&b++;return b}return this.ub.j.length}}});nb.prototype.first=nb.prototype.first;nb.prototype.hasNext=nb.prototype.ld;nb.prototype.next=nb.prototype.next; nb.prototype.reset=nb.prototype.reset;nb.className="ListIterator";function ob(a){this.ub=a;a.lh=null;this.oa=a.v;this.Ua=a.j.length}ob.prototype.reset=function(){var a=this.ub;a.lh=null;this.oa=a.v;this.Ua=a.j.length};ob.prototype.next=function(){var a=this.ub;if(a.v!==this.oa){if(0>this.key)return!1;Aa(a)}var b=--this.Ua;if(0<=b)return this.key=b,this.value=a.j[b],!0;this.Kd();return!1};ob.prototype.ld=function(){return this.next()}; ob.prototype.first=function(){var a=this.ub;this.oa=a.v;var b=a.j;this.Ua=a=b.length-1;return 0<=a?(b=b[a],this.key=a,this.value=b):null};ob.prototype.any=function(a){var b=this.ub;b.lh=null;var c=b.v,d=b.j,e=d.length;this.Ua=e;for(--e;0<=e;e--){if(a(d[e]))return!0;b.v!==c&&Aa(b)}return!1};ob.prototype.all=function(a){var b=this.ub;b.lh=null;var c=b.v,d=b.j,e=d.length;this.Ua=e;for(--e;0<=e;e--){if(!a(d[e]))return!1;b.v!==c&&Aa(b)}return!0}; ob.prototype.each=function(a){var b=this.ub;b.lh=null;var c=b.v,d=b.j,e=d.length;this.Ua=e;for(--e;0<=e;e--)a(d[e]),b.v!==c&&Aa(b);return this};ob.prototype.map=function(a){var b=this.ub;b.lh=null;var c=b.v,d=[],e=b.j,f=e.length;this.Ua=f;for(--f;0<=f;f--)d.push(a(e[f])),b.v!==c&&Aa(b);a=new H;a.j=d;a.qb();return a.iterator}; ob.prototype.filter=function(a){var b=this.ub;b.lh=null;var c=b.v,d=[],e=b.j,f=e.length;this.Ua=f;for(--f;0<=f;f--){var g=e[f];a(g)&&d.push(g);b.v!==c&&Aa(b)}a=new H;a.j=d;a.qb();return a.iterator};ob.prototype.Kd=function(){this.key=-1;this.value=null;this.oa=-1;this.ub.lh=this};ob.prototype.toString=function(){return"ListIteratorBackwards("+this.Ua+"/"+this.ub.count+")"}; ma.Object.defineProperties(ob.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.ub.j.length}}});ob.prototype.first=ob.prototype.first;ob.prototype.hasNext=ob.prototype.ld;ob.prototype.next=ob.prototype.next;ob.prototype.reset=ob.prototype.reset;ob.className="ListIteratorBackwards"; function H(a){fb(this);this.s=!1;this.j=[];this.v=0;this.lh=this.Ka=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Ea():this.addAll(a))}t=H.prototype;t.qb=function(){var a=this.v;a++;999999999<a&&(a=0);this.v=a};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.toString=function(){return"List()#"+pb(this)};t.add=function(a){if(null===a)return this;this.s&&va(this,a);this.j.push(a);this.qb();return this};t.push=function(a){this.add(a)}; t.addAll=function(a){if(null===a)return this;this.s&&va(this);var b=this.j;if(Ga(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.qb();return this};t.clear=function(){this.s&&va(this);this.j.length=0;this.qb()};t.contains=function(a){return null===a?!1:-1!==this.j.indexOf(a)};t.has=function(a){return this.contains(a)};t.indexOf=function(a){return null===a?-1:this.j.indexOf(a)}; t.O=function(a){F&&C(a,H,"elt:i");var b=this.j;(0>a||a>=b.length)&&ya(a,"0 <= i < length",H,"elt:i");return b[a]};t.get=function(a){return this.O(a)};t.od=function(a,b){F&&C(a,H,"setElt:i");var c=this.j;(0>a||a>=c.length)&&ya(a,"0 <= i < length",H,"setElt:i");this.s&&va(this,a);c[a]=b};t.set=function(a,b){this.od(a,b)};t.first=function(){var a=this.j;return 0===a.length?null:a[0]};t.cc=function(){var a=this.j,b=a.length;return 0<b?a[b-1]:null}; t.pop=function(){this.s&&va(this);var a=this.j;return 0<a.length?a.pop():null};H.prototype.any=function(a){for(var b=this.j,c=this.v,d=b.length,e=0;e<d;e++){if(a(b[e]))return!0;this.v!==c&&Aa(this)}return!1};H.prototype.all=function(a){for(var b=this.j,c=this.v,d=b.length,e=0;e<d;e++){if(!a(b[e]))return!1;this.v!==c&&Aa(this)}return!0};H.prototype.each=function(a){for(var b=this.j,c=this.v,d=b.length,e=0;e<d;e++)a(b[e]),this.v!==c&&Aa(this);return this}; H.prototype.map=function(a){for(var b=new H,c=[],d=this.j,e=this.v,f=d.length,g=0;g<f;g++)c.push(a(d[g])),this.v!==e&&Aa(this);b.j=c;b.qb();return b};H.prototype.filter=function(a){for(var b=new H,c=[],d=this.j,e=this.v,f=d.length,g=0;g<f;g++){var h=d[g];a(h)&&c.push(h);this.v!==e&&Aa(this)}b.j=c;b.qb();return b};t=H.prototype;t.yb=function(a,b){F&&C(a,H,"insertAt:i");0>a&&ya(a,">= 0",H,"insertAt:i");this.s&&va(this,a);var c=this.j;a>=c.length?c.push(b):c.splice(a,0,b);this.qb()}; t.remove=function(a){if(null===a)return!1;this.s&&va(this,a);var b=this.j;a=b.indexOf(a);if(-1===a)return!1;a===b.length-1?b.pop():b.splice(a,1);this.qb();return!0};t.delete=function(a){return this.remove(a)};t.hb=function(a){F&&C(a,H,"removeAt:i");var b=this.j;(0>a||a>=b.length)&&ya(a,"0 <= i < length",H,"removeAt:i");this.s&&va(this,a);a===b.length-1?b.pop():b.splice(a,1);this.qb()}; t.removeRange=function(a,b){F&&(C(a,H,"removeRange:from"),C(b,H,"removeRange:to"));var c=this.j,d=c.length;if(0>a)a=0;else if(a>=d)return this;if(0>b)return this;b>=d&&(b=d-1);if(a>b)return this;this.s&&va(this);for(var e=a,f=b+1;f<d;)c[e++]=c[f++];c.length=d-(b-a+1);this.qb();return this};H.prototype.copy=function(){var a=new H,b=this.j;0<b.length&&(a.j=Array.prototype.slice.call(b));return a};t=H.prototype;t.ua=function(){for(var a=this.j,b=this.count,c=Array(b),d=0;d<b;d++)c[d]=a[d];return c}; t.Ew=function(){for(var a=new I,b=this.j,c=this.count,d=0;d<c;d++)a.add(b[d]);return a};t.sort=function(a){F&&A(a,"function",H,"sort:sortfunc");this.s&&va(this);this.j.sort(a);this.qb();return this}; t.qj=function(a,b,c){var d=this.j,e=d.length;void 0===b&&(b=0);void 0===c&&(c=e);F&&(A(a,"function",H,"sortRange:sortfunc"),C(b,H,"sortRange:from"),C(c,H,"sortRange:to"));this.s&&va(this);var f=c-b;if(1>=f)return this;(0>b||b>=e-1)&&ya(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.qb()),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.qb();return this};t.reverse=function(){this.s&&va(this);this.j.reverse();this.qb();return this}; ma.Object.defineProperties(H.prototype,{_dataArray:{configurable:!0,get:function(){return this.j}},count:{configurable:!0,get:function(){return this.j.length}},size:{configurable:!0,get:function(){return this.j.length}},length:{configurable:!0,get:function(){return this.j.length}},iterator:{configurable:!0,get:function(){if(0>=this.j.length)return lb;var a=this.Ka;return null!==a?(a.reset(),a):new nb(this)}},iteratorBackwards:{configurable:!0, enumerable:!0,get:function(){if(0>=this.j.length)return lb;var a=this.lh;return null!==a?(a.reset(),a):new ob(this)}}});H.prototype.reverse=H.prototype.reverse;H.prototype.sortRange=H.prototype.qj;H.prototype.sort=H.prototype.sort;H.prototype.toSet=H.prototype.Ew;H.prototype.toArray=H.prototype.ua;H.prototype.removeRange=H.prototype.removeRange;H.prototype.removeAt=H.prototype.hb;H.prototype["delete"]=H.prototype.delete;H.prototype.remove=H.prototype.remove;H.prototype.insertAt=H.prototype.yb; 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.od;H.prototype.get=H.prototype.get;H.prototype.elt=H.prototype.O;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 tb(a){this.Ag=a;a.Ka=null;this.oa=a.v;this.ra=null}tb.prototype.reset=function(){var a=this.Ag;a.Ka=null;this.oa=a.v;this.ra=null};tb.prototype.next=function(){var a=this.Ag;if(a.v!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.ra;b=null===b?a.ga:b.va;if(null!==b)return this.ra=b,this.value=b.value,this.key=b.key,!0;this.Kd();return!1};tb.prototype.ld=function(){return this.next()}; tb.prototype.first=function(){var a=this.Ag;this.oa=a.v;a=a.ga;if(null!==a){this.ra=a;var b=a.value;this.key=a.key;return this.value=b}return null};tb.prototype.any=function(a){var b=this.Ag;b.Ka=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.v!==c&&Aa(b);d=d.va}return!1};tb.prototype.all=function(a){var b=this.Ag;b.Ka=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.v!==c&&Aa(b);d=d.va}return!0}; tb.prototype.each=function(a){var b=this.Ag;b.Ka=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;)a(d.value),b.v!==c&&Aa(b),d=d.va;return this};tb.prototype.map=function(a){var b=this.Ag;b.Ka=null;for(var c=new H,d=b.v,e=b.ga;null!==e;)c.add(a(e.value)),b.v!==d&&Aa(b),e=e.va;return c.iterator};tb.prototype.filter=function(a){var b=this.Ag;b.Ka=null;for(var c=new H,d=b.v,e=b.ga;null!==e;){var f=e.value;a(f)&&c.add(f);b.v!==d&&Aa(b);e=e.va}return c.iterator}; tb.prototype.Kd=function(){this.value=this.key=null;this.oa=-1;this.Ag.Ka=this};tb.prototype.toString=function(){return null!==this.ra?"SetIterator@"+this.ra.value:"SetIterator"};ma.Object.defineProperties(tb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.Ag.Jb}}});tb.prototype.first=tb.prototype.first;tb.prototype.hasNext=tb.prototype.ld;tb.prototype.next=tb.prototype.next;tb.prototype.reset=tb.prototype.reset; tb.className="SetIterator";function I(a){fb(this);this.s=!1;this.Lb={};this.Jb=0;this.Ka=null;this.v=0;this.ff=this.ga=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Ea():this.addAll(a))}t=I.prototype;t.qb=function(){var a=this.v;a++;999999999<a&&(a=0);this.v=a};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.toString=function(){return"Set()#"+pb(this)}; t.add=function(a){if(null===a)return this;this.s&&va(this,a);var b=a;Fa(a)&&(b=ub(a));void 0===this.Lb[b]&&(this.Jb++,a=new vb(a,a),this.Lb[b]=a,b=this.ff,null===b?this.ga=a:(a.Ql=b,b.va=a),this.ff=a,this.qb());return this};t.addAll=function(a){if(null===a)return this;this.s&&va(this);if(Ga(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 Fa(a)&&(b=pb(a),void 0===b)?!1:void 0!==this.Lb[b]};t.has=function(a){return this.contains(a)};t.oz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.pz=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.v,c=this.ga;null!==c;){if(a(c.value))return!0;this.v!==b&&Aa(this);c=c.va}return!1};I.prototype.all=function(a){for(var b=this.v,c=this.ga;null!==c;){if(!a(c.value))return!1;this.v!==b&&Aa(this);c=c.va}return!0};I.prototype.each=function(a){for(var b=this.v,c=this.ga;null!==c;)a(c.value),this.v!==b&&Aa(this),c=c.va;return this};I.prototype.map=function(a){for(var b=new I,c=this.v,d=this.ga;null!==d;)b.add(a(d.value)),this.v!==c&&Aa(this),d=d.va;return b}; I.prototype.filter=function(a){for(var b=new I,c=this.v,d=this.ga;null!==d;){var e=d.value;a(e)&&b.add(e);this.v!==c&&Aa(this);d=d.va}return b};t=I.prototype;t.remove=function(a){if(null===a)return!1;this.s&&va(this,a);var b=a;if(Fa(a)&&(b=pb(a),void 0===b))return!1;a=this.Lb[b];if(void 0===a)return!1;var c=a.va,d=a.Ql;null!==c&&(c.Ql=d);null!==d&&(d.va=c);this.ga===a&&(this.ga=c);this.ff===a&&(this.ff=d);delete this.Lb[b];this.Jb--;this.qb();return!0};t.delete=function(a){return this.remove(a)}; t.Wq=function(a){if(null===a)return this;this.s&&va(this);if(Ga(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.NA=function(a){if(null===a||0===this.count)return this;this.s&&va(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.Wq(a);return this};t.clear=function(){this.s&&va(this);this.Lb={};this.Jb=0;null!==this.Ka&&this.Ka.reset();this.ff=this.ga=null;this.qb()}; I.prototype.copy=function(){var a=new I,b=this.Lb,c;for(c in b)a.add(b[c].value);return a};I.prototype.ua=function(){var a=Array(this.Jb),b=this.Lb,c=0,d;for(d in b)a[c]=b[d].value,c++;return a};I.prototype.Dw=function(){var a=new H,b=this.Lb,c;for(c in b)a.add(b[c].value);return a};function fb(a){a.__gohashid=wb++}function ub(a){var b=a.__gohashid;void 0===b&&(b=wb++,a.__gohashid=b);return b}function pb(a){return a.__gohashid} ma.Object.defineProperties(I.prototype,{count:{configurable:!0,get:function(){return this.Jb}},size:{configurable:!0,get:function(){return this.Jb}},iterator:{configurable:!0,get:function(){if(0>=this.Jb)return lb;var a=this.Ka;return null!==a?(a.reset(),a):new tb(this)}}});I.prototype.toList=I.prototype.Dw;I.prototype.toArray=I.prototype.ua;I.prototype.clear=I.prototype.clear;I.prototype.retainAll=I.prototype.NA;I.prototype.removeAll=I.prototype.Wq; I.prototype["delete"]=I.prototype.delete;I.prototype.remove=I.prototype.remove;I.prototype.first=I.prototype.first;I.prototype.containsAny=I.prototype.pz;I.prototype.containsAll=I.prototype.oz;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 wb=1;I.className="Set";I.uniqueHash=fb;I.hashIdUnique=ub;I.hashId=pb; function zb(a){this.la=a;this.oa=a.v;this.ra=null}zb.prototype.reset=function(){this.oa=this.la.v;this.ra=null};zb.prototype.next=function(){var a=this.la;if(a.v!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.ra;b=null===b?a.ga:b.va;if(null!==b)return this.ra=b,this.value=this.key=a=b.key,!0;this.Kd();return!1};zb.prototype.ld=function(){return this.next()};zb.prototype.first=function(){var a=this.la;this.oa=a.v;a=a.ga;return null!==a?(this.ra=a,this.value=this.key=a=a.key):null}; zb.prototype.any=function(a){var b=this.la,c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(a(d.key))return!0;b.v!==c&&Aa(b);d=d.va}return!1};zb.prototype.all=function(a){var b=this.la,c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(!a(d.key))return!1;b.v!==c&&Aa(b);d=d.va}return!0};zb.prototype.each=function(a){var b=this.la,c=b.v;this.ra=null;for(var d=b.ga;null!==d;)a(d.key),b.v!==c&&Aa(b),d=d.va;return this}; zb.prototype.map=function(a){var b=this.la,c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e.key)),b.v!==c&&Aa(b),e=e.va;return d.iterator};zb.prototype.filter=function(a){var b=this.la,c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;){var f=e.key;a(f)&&d.add(f);b.v!==c&&Aa(b);e=e.va}return d.iterator};zb.prototype.Kd=function(){this.value=this.key=null;this.oa=-1};zb.prototype.toString=function(){return null!==this.ra?"MapKeySetIterator@"+this.ra.value:"MapKeySetIterator"}; ma.Object.defineProperties(zb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Jb}}});zb.prototype.first=zb.prototype.first;zb.prototype.hasNext=zb.prototype.ld;zb.prototype.next=zb.prototype.next;zb.prototype.reset=zb.prototype.reset;zb.className="MapKeySetIterator";function Ab(a){I.call(this);fb(this);this.s=!0;this.la=a}la(Ab,I);t=Ab.prototype;t.freeze=function(){return this};t.ka=function(){return this}; t.toString=function(){return"MapKeySet("+this.la.toString()+")"};t.add=function(){v("This Set is read-only: "+this.toString());return this};t.contains=function(a){return this.la.contains(a)};t.has=function(a){return this.contains(a)};t.remove=function(){v("This Set is read-only: "+this.toString());return!1};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.la.ga;return null!==a?a.key:null}; Ab.prototype.any=function(a){for(var b=this.la.ga;null!==b;){if(a(b.key))return!0;b=b.va}return!1};Ab.prototype.all=function(a){for(var b=this.la.ga;null!==b;){if(!a(b.key))return!1;b=b.va}return!0};Ab.prototype.each=function(a){for(var b=this.la.ga;null!==b;)a(b.key),b=b.va;return this};Ab.prototype.map=function(a){for(var b=new I,c=this.la.ga;null!==c;)b.add(a(c.key)),c=c.va;return b};Ab.prototype.filter=function(a){for(var b=new I,c=this.la.ga;null!==c;){var d=c.key;a(d)&&b.add(d);c=c.va}return b}; Ab.prototype.copy=function(){return new Ab(this.la)};Ab.prototype.Ew=function(){var a=new I,b=this.la.Lb,c;for(c in b)a.add(b[c].key);return a};Ab.prototype.ua=function(){var a=this.la.Lb,b=Array(this.la.Jb),c=0,d;for(d in a)b[c]=a[d].key,c++;return b};Ab.prototype.Dw=function(){var a=new H,b=this.la.Lb,c;for(c in b)a.add(b[c].key);return a}; ma.Object.defineProperties(Ab.prototype,{count:{configurable:!0,get:function(){return this.la.Jb}},size:{configurable:!0,get:function(){return this.la.Jb}},iterator:{configurable:!0,get:function(){return 0>=this.la.Jb?lb:new zb(this.la)}}});Ab.prototype.toList=Ab.prototype.Dw;Ab.prototype.toArray=Ab.prototype.ua;Ab.prototype.toSet=Ab.prototype.Ew;Ab.prototype.first=Ab.prototype.first;Ab.prototype.clear=Ab.prototype.clear;Ab.prototype["delete"]=Ab.prototype.delete; Ab.prototype.remove=Ab.prototype.remove;Ab.prototype.has=Ab.prototype.has;Ab.prototype.contains=Ab.prototype.contains;Ab.prototype.add=Ab.prototype.add;Ab.prototype.thaw=Ab.prototype.ka;Ab.prototype.freeze=Ab.prototype.freeze;Ab.className="MapKeySet";function Bb(a){this.la=a;a.ef=null;this.oa=a.v;this.ra=null}Bb.prototype.reset=function(){var a=this.la;a.ef=null;this.oa=a.v;this.ra=null}; Bb.prototype.next=function(){var a=this.la;if(a.v!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.ra;b=null===b?a.ga:b.va;if(null!==b)return this.ra=b,this.value=b.value,this.key=b.key,!0;this.Kd();return!1};Bb.prototype.ld=function(){return this.next()};Bb.prototype.first=function(){var a=this.la;this.oa=a.v;a=a.ga;if(null!==a){this.ra=a;var b=a.value;this.key=a.key;return this.value=b}return null}; Bb.prototype.any=function(a){var b=this.la;b.ef=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(a(d.value))return!0;b.v!==c&&Aa(b);d=d.va}return!1};Bb.prototype.all=function(a){var b=this.la;b.ef=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(!a(d.value))return!1;b.v!==c&&Aa(b);d=d.va}return!0};Bb.prototype.each=function(a){var b=this.la;b.ef=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;)a(d.value),b.v!==c&&Aa(b),d=d.va;return this}; Bb.prototype.map=function(a){var b=this.la;b.ef=null;var c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e.value)),b.v!==c&&Aa(b),e=e.va;return d.iterator};Bb.prototype.filter=function(a){var b=this.la;b.ef=null;var c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;){var f=e.value;a(f)&&d.add(f);b.v!==c&&Aa(b);e=e.va}return d.iterator};Bb.prototype.Kd=function(){this.value=this.key=null;this.oa=-1;this.la.ef=this}; Bb.prototype.toString=function(){return null!==this.ra?"MapValueSetIterator@"+this.ra.value:"MapValueSetIterator"};ma.Object.defineProperties(Bb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Jb}}});Bb.prototype.first=Bb.prototype.first;Bb.prototype.hasNext=Bb.prototype.ld;Bb.prototype.next=Bb.prototype.next;Bb.prototype.reset=Bb.prototype.reset;Bb.className="MapValueSetIterator"; function vb(a,b){this.key=a;this.value=b;this.Ql=this.va=null}vb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};vb.className="KeyValuePair";function Cb(a){this.la=a;a.Ka=null;this.oa=a.v;this.ra=null}Cb.prototype.reset=function(){var a=this.la;a.Ka=null;this.oa=a.v;this.ra=null}; Cb.prototype.next=function(){var a=this.la;if(a.v!==this.oa){if(null===this.key)return!1;Aa(a)}var b=this.ra;b=null===b?a.ga:b.va;if(null!==b)return this.ra=b,this.key=b.key,this.value=b.value,!0;this.Kd();return!1};Cb.prototype.ld=function(){return this.next()};Cb.prototype.first=function(){var a=this.la;this.oa=a.v;a=a.ga;return null!==a?(this.ra=a,this.key=a.key,this.value=a.value,a):null}; Cb.prototype.any=function(a){var b=this.la;b.Ka=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(a(d))return!0;b.v!==c&&Aa(b);d=d.va}return!1};Cb.prototype.all=function(a){var b=this.la;b.Ka=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;){if(!a(d))return!1;b.v!==c&&Aa(b);d=d.va}return!0};Cb.prototype.each=function(a){var b=this.la;b.Ka=null;var c=b.v;this.ra=null;for(var d=b.ga;null!==d;)a(d),b.v!==c&&Aa(b),d=d.va;return this}; Cb.prototype.map=function(a){var b=this.la;b.Ka=null;var c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;)d.add(a(e)),b.v!==c&&Aa(b),e=e.va;return d.iterator};Cb.prototype.filter=function(a){var b=this.la;b.Ka=null;var c=b.v;this.ra=null;for(var d=new H,e=b.ga;null!==e;)a(e)&&d.add(e),b.v!==c&&Aa(b),e=e.va;return d.iterator};Cb.prototype.Kd=function(){this.value=this.key=null;this.oa=-1;this.la.Ka=this};Cb.prototype.toString=function(){return null!==this.ra?"MapIterator@"+this.ra:"MapIterator"}; ma.Object.defineProperties(Cb.prototype,{iterator:{configurable:!0,get:function(){return this}},count:{configurable:!0,get:function(){return this.la.Jb}}});Cb.prototype.first=Cb.prototype.first;Cb.prototype.hasNext=Cb.prototype.ld;Cb.prototype.next=Cb.prototype.next;Cb.prototype.reset=Cb.prototype.reset;Cb.className="MapIterator"; function Db(a){fb(this);this.s=!1;this.Lb={};this.Jb=0;this.ef=this.Ka=null;this.v=0;this.ff=this.ga=null;void 0!==a&&("function"===typeof a||"string"===typeof a?Ea():this.addAll(a))}t=Db.prototype;t.qb=function(){var a=this.v;a++;999999999<a&&(a=0);this.v=a};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.toString=function(){return"Map()#"+pb(this)}; t.add=function(a,b){this.s&&va(this,a);var c=a;Fa(a)&&(c=ub(a));var d=this.Lb[c];void 0===d?(this.Jb++,a=new vb(a,b),this.Lb[c]=a,c=this.ff,null===c?this.ga=a:(a.Ql=c,c.va=a),this.ff=a,this.qb()):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(Ga(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 Db)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};Db.prototype.any=function(a){for(var b=this.v,c=this.ga;null!==c;){if(a(c))return!0;this.v!==b&&Aa(this);c=c.va}return!1}; Db.prototype.all=function(a){for(var b=this.v,c=this.ga;null!==c;){if(!a(c))return!1;this.v!==b&&Aa(this);c=c.va}return!0};Db.prototype.each=function(a){for(var b=this.v,c=this.ga;null!==c;)a(c),this.v!==b&&Aa(this),c=c.va;return this};Db.prototype.map=function(a){for(var b=new Db,c=this.v,d=this.ga;null!==d;)b.add(d.key,a(d)),this.v!==c&&Aa(this),d=d.va;return b};Db.prototype.filter=function(a){for(var b=new Db,c=this.v,d=this.ga;null!==d;)a(d)&&b.add(d.key,d.value),this.v!==c&&Aa(this),d=d.va;return b}; t=Db.prototype;t.contains=function(a){var b=a;return Fa(a)&&(b=pb(a),void 0===b)?!1:void 0!==this.Lb[b]};t.has=function(a){return this.contains(a)};t.K=function(a){var b=a;if(Fa(a)&&(b=pb(a),void 0===b))return null;a=this.Lb[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.s&&va(this,a);var b=a;if(Fa(a)&&(b=pb(a),void 0===b))return!1;a=this.Lb[b];if(void 0===a)return!1;var c=a.va,d=a.Ql;null!==c&&(c.Ql=d);null!==d&&(d.va=c);this.ga===a&&(this.ga=c);this.ff===a&&(this.ff=d);delete this.Lb[b];this.Jb--;this.qb();return!0};t.delete=function(a){return this.remove(a)};t.clear=function(){this.s&&va(this);this.Lb={};this.Jb=0;null!==this.Ka&&this.Ka.reset();null!==this.ef&&this.ef.reset();this.ff=this.ga=null;this.qb()}; Db.prototype.copy=function(){var a=new Db,b=this.Lb,c;for(c in b){var d=b[c];a.add(d.key,d.value)}return a};Db.prototype.ua=function(){var a=this.Lb,b=Array(this.Jb),c=0,d;for(d in a){var e=a[d];b[c]=new vb(e.key,e.value);c++}return b};Db.prototype.Of=function(){return new Ab(this)}; ma.Object.defineProperties(Db.prototype,{count:{configurable:!0,get:function(){return this.Jb}},size:{configurable:!0,get:function(){return this.Jb}},iterator:{configurable:!0,get:function(){if(0>=this.count)return lb;var a=this.Ka;return null!==a?(a.reset(),a):new Cb(this)}},iteratorKeys:{configurable:!0,get:function(){return 0>=this.count?lb:new zb(this)}},iteratorValues:{configurable:!0,get:function(){if(0>=this.count)return lb; var a=this.ef;return null!==a?(a.reset(),a):new Bb(this)}}});Db.prototype.toKeySet=Db.prototype.Of;Db.prototype.toArray=Db.prototype.ua;Db.prototype.clear=Db.prototype.clear;Db.prototype["delete"]=Db.prototype.delete;Db.prototype.remove=Db.prototype.remove;Db.prototype.get=Db.prototype.get;Db.prototype.getValue=Db.prototype.K;Db.prototype.has=Db.prototype.has;Db.prototype.contains=Db.prototype.contains;Db.prototype.first=Db.prototype.first;Db.prototype.addAll=Db.prototype.addAll; Db.prototype.set=Db.prototype.set;Db.prototype.add=Db.prototype.add;Db.prototype.thaw=Db.prototype.ka;Db.prototype.freeze=Db.prototype.freeze;Db.className="Map";function J(a,b){void 0===a?this.H=this.G=0:"number"===typeof a&&"number"===typeof b?(this.G=a,this.H=b):v("Invalid arguments to Point constructor: "+a+", "+b);this.s=!1}J.prototype.assign=function(a){this.G=a.G;this.H=a.H;return this};J.prototype.h=function(a,b){this.G=a;this.H=b;return this}; J.prototype.Og=function(a,b){F&&(A(a,"number",J,"setTo:x"),A(b,"number",J,"setTo:y"),this.ha());this.G=a;this.H=b;return this};J.prototype.set=function(a){F&&(w(a,J,J,"set:p"),this.ha());this.G=a.G;this.H=a.H;return this};J.prototype.copy=function(){var a=new J;a.G=this.G;a.H=this.H;return a};t=J.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this};t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this}; t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Point is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+=" to value: "+a);v(b)}};function Eb(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 Fb(a){F&&w(a,J);return a.x.toString()+" "+a.y.toString()}t.toString=function(){return"Point("+this.x+","+this.y+")"};t.A=function(a){return a instanceof J?this.G===a.x&&this.H===a.y:!1};t.bj=function(a,b){return this.G===a&&this.H===b};t.Sa=function(a){return K.C(this.G,a.x)&&K.C(this.H,a.y)};t.add=function(a){F&&(w(a,J,J,"add:p"),this.ha());this.G+=a.x;this.H+=a.y;return this};t.ie=function(a){F&&(w(a,J,J,"subtract:p"),this.ha());this.G-=a.x;this.H-=a.y;return this}; t.offset=function(a,b){F&&(C(a,J,"offset:dx"),C(b,J,"offset:dy"),this.ha());this.G+=a;this.H+=b;return this};J.prototype.rotate=function(a){F&&(C(a,J,"rotate:angle"),this.ha());if(0===a)return this;var b=this.G,c=this.H;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.G=a*b-d*c;this.H=d*b+a*c;return this};t=J.prototype; t.scale=function(a,b){F&&(C(a,J,"scale:sx"),C(b,J,"scale:sy"),this.ha());this.G*=a;this.H*=b;return this};t.Pe=function(a){F&&w(a,J,J,"distanceSquaredPoint:p");var b=a.x-this.G;a=a.y-this.H;return b*b+a*a};t.kd=function(a,b){F&&(C(a,J,"distanceSquared:px"),C(b,J,"distanceSquared:py"));a-=this.G;b-=this.H;return a*a+b*b};t.normalize=function(){F&&this.ha();var a=this.G,b=this.H,c=Math.sqrt(a*a+b*b);0<c&&(this.G=a/c,this.H=b/c);return this}; t.Xa=function(a){F&&w(a,J,J,"directionPoint:p");return Gb(a.x-this.G,a.y-this.H)};t.direction=function(a,b){F&&(C(a,J,"direction:px"),C(b,J,"direction:py"));return Gb(a-this.G,b-this.H)};function Gb(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.GA=function(a,b,c,d){F&&(C(a,J,"projectOntoLineSegment:px"),C(b,J,"projectOntoLineSegment:py"),C(c,J,"projectOntoLineSegment:qx"),C(d,J,"projectOntoLineSegment:qy"));K.Th(a,b,c,d,this.G,this.H,this);return this};t.HA=function(a,b){F&&(w(a,J,J,"projectOntoLineSegmentPoint:p"),w(b,J,J,"projectOntoLineSegmentPoint:q"));K.Th(a.x,a.y,b.x,b.y,this.G,this.H,this);return this}; t.TA=function(a,b,c,d){F&&(C(a,J,"snapToGrid:originx"),C(b,J,"snapToGrid:originy"),C(c,J,"snapToGrid:cellwidth"),C(d,J,"snapToGrid:cellheight"));K.Cq(this.G,this.H,a,b,c,d,this);return this};t.UA=function(a,b){F&&(w(a,J,J,"snapToGridPoint:p"),w(b,Hb,J,"snapToGridPoint:q"));K.Cq(this.G,this.H,a.x,a.y,b.width,b.height,this);return this};t.pj=function(a,b){F&&(w(a,L,J,"setRectSpot:r"),w(b,M,J,"setRectSpot:spot"),this.ha());this.G=a.x+b.x*a.width+b.offsetX;this.H=a.y+b.y*a.height+b.offsetY;return this}; t.Jk=function(a,b,c,d,e){F&&(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,M,J,"setSpot:spot"),this.ha());this.G=a+e.x*c+e.offsetX;this.H=b+e.y*d+e.offsetY;return this};t.transform=function(a){F&&w(a,Ib,J,"transform:t");a.xa(this);return this};function Jb(a,b){F&&w(b,Ib,J,"transformInverted:t");b.de(a);return a} function Kb(a,b,c,d,e,f){F&&(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 Lb(a,b,c,d){F&&(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 Mb(a,b,c,d){F&&(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.o=function(){return isFinite(this.x)&&isFinite(this.y)};J.alloc=function(){var a=Nb.pop();return void 0===a?new J:a};J.allocAt=function(a,b){var c=Nb.pop();if(void 0===c)return new J(a,b);c.x=a;c.y=b;return c};J.free=function(a){Nb.push(a)}; ma.Object.defineProperties(J.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){F&&(A(a,"number",J,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){F&&(A(a,"number",J,"y"),this.ha(a));this.H=a}}});J.prototype.isReal=J.prototype.o;J.prototype.setSpot=J.prototype.Jk;J.prototype.setRectSpot=J.prototype.pj;J.prototype.snapToGridPoint=J.prototype.UA;J.prototype.snapToGrid=J.prototype.TA; J.prototype.projectOntoLineSegmentPoint=J.prototype.HA;J.prototype.projectOntoLineSegment=J.prototype.GA;J.intersectingLineSegments=function(a,b,c,d,e,f,g,h){F&&(C(a,L,"intersectingLineSegments:a1x"),C(b,L,"intersectingLineSegments:a1y"),C(c,L,"intersectingLineSegments:a2x"),C(d,L,"intersectingLineSegments:a2y"),C(e,L,"intersectingLineSegments:b1x"),C(f,L,"intersectingLineSegments:b1y"),C(g,L,"intersectingLineSegments:b2x"),C(h,L,"intersectingLineSegments:b2y"));return K.Iq(a,b,c,d,e,f,g,h)}; J.prototype.direction=J.prototype.direction;J.prototype.directionPoint=J.prototype.Xa;J.prototype.normalize=J.prototype.normalize;J.prototype.distanceSquared=J.prototype.kd;J.prototype.distanceSquaredPoint=J.prototype.Pe;J.prototype.scale=J.prototype.scale;J.prototype.rotate=J.prototype.rotate;J.prototype.offset=J.prototype.offset;J.prototype.subtract=J.prototype.ie;J.prototype.add=J.prototype.add;J.prototype.equalsApprox=J.prototype.Sa;J.prototype.equalTo=J.prototype.bj;J.prototype.equals=J.prototype.A; J.prototype.set=J.prototype.set;J.prototype.setTo=J.prototype.Og;var Rb=null,Sb=null,Tb=null,Ub=null,Vb=null,Nb=[];J.className="Point";J.parse=Eb;J.stringify=Fb;J.distanceLineSegmentSquared=Kb;J.distanceSquared=Lb;J.direction=Mb;J.Origin=Rb=(new J(0,0)).ia();J.InfiniteTopLeft=Sb=(new J(-Infinity,-Infinity)).ia();J.InfiniteBottomRight=Tb=(new J(Infinity,Infinity)).ia();J.SixPoint=Ub=(new J(6,6)).ia();J.NoPoint=Vb=(new J(NaN,NaN)).ia();J.parse=Eb;J.stringify=Fb;J.distanceLineSegmentSquared=Kb; J.distanceSquared=Lb;J.direction=Mb;function Hb(a,b){void 0===a?this.da=this.ea=0:"number"===typeof a&&(0<=a||isNaN(a))&&"number"===typeof b&&(0<=b||isNaN(b))?(this.ea=a,this.da=b):v("Invalid arguments to Size constructor: "+a+", "+b);this.s=!1}var Wb,Xb,Zb,$b,ac,bc,cc;Hb.prototype.assign=function(a){this.ea=a.ea;this.da=a.da;return this};Hb.prototype.h=function(a,b){this.ea=a;this.da=b;return this}; Hb.prototype.Og=function(a,b){F&&(A(a,"number",Hb,"setTo:w"),A(b,"number",Hb,"setTo:h"),0>a&&ya(a,">= 0",Hb,"setTo:w"),0>b&&ya(b,">= 0",Hb,"setTo:h"),this.ha());this.ea=a;this.da=b;return this};Hb.prototype.set=function(a){F&&(w(a,Hb,Hb,"set:s"),this.ha());this.ea=a.ea;this.da=a.da;return this};Hb.prototype.copy=function(){var a=new Hb;a.ea=this.ea;a.da=this.da;return a};t=Hb.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this}; t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Size is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+=" to value: "+a);v(b)}}; function dc(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 Hb(c,e)}return new Hb}function ec(a){F&&w(a,Hb);return a.width.toString()+" "+a.height.toString()}t.toString=function(){return"Size("+this.width+","+this.height+")"};t.A=function(a){return a instanceof Hb?this.ea===a.width&&this.da===a.height:!1};t.bj=function(a,b){return this.ea===a&&this.da===b}; t.Sa=function(a){return K.C(this.ea,a.width)&&K.C(this.da,a.height)};t.o=function(){return isFinite(this.width)&&isFinite(this.height)};Hb.alloc=function(){var a=fc.pop();return void 0===a?new Hb:a};Hb.free=function(a){fc.push(a)}; ma.Object.defineProperties(Hb.prototype,{width:{configurable:!0,get:function(){return this.ea},set:function(a){F&&(A(a,"number",Hb,"width"),this.ha(a));0>a&&ya(a,">= 0",Hb,"width");this.ea=a}},height:{configurable:!0,get:function(){return this.da},set:function(a){F&&(A(a,"number",Hb,"height"),this.ha(a));0>a&&ya(a,">= 0",Hb,"height");this.da=a}}});Hb.prototype.isReal=Hb.prototype.o;Hb.prototype.equalsApprox=Hb.prototype.Sa;Hb.prototype.equalTo=Hb.prototype.bj; Hb.prototype.equals=Hb.prototype.A;Hb.prototype.set=Hb.prototype.set;Hb.prototype.setTo=Hb.prototype.Og;var fc=[];Hb.className="Size";Hb.parse=dc;Hb.stringify=ec;Hb.ZeroSize=Wb=(new Hb(0,0)).ia();Hb.OneSize=Xb=(new Hb(1,1)).ia();Hb.SixSize=Zb=(new Hb(6,6)).ia();Hb.EightSize=$b=(new Hb(8,8)).ia();Hb.TenSize=ac=(new Hb(10,10)).ia();Hb.InfiniteSize=bc=(new Hb(Infinity,Infinity)).ia();Hb.NoSize=cc=(new Hb(NaN,NaN)).ia();Hb.parse=dc;Hb.stringify=ec; function L(a,b,c,d){void 0===a?this.da=this.ea=this.H=this.G=0:a instanceof J?(c=a.x,a=a.y,b instanceof J?(d=b.x,b=b.y,this.G=Math.min(c,d),this.H=Math.min(a,b),this.ea=Math.abs(c-d),this.da=Math.abs(a-b)):b instanceof Hb?(this.G=c,this.H=a,this.ea=b.width,this.da=b.height):v("Incorrect arguments supplied to Rect constructor")):"number"===typeof a&&"number"===typeof b&&"number"===typeof c&&(0<=c||isNaN(c))&&"number"===typeof d&&(0<=d||isNaN(d))?(this.G=a,this.H=b,this.ea=c,this.da=d):v("Invalid arguments to Rect constructor: "+ a+", "+b+", "+c+", "+d);this.s=!1}t=L.prototype;t.assign=function(a){this.G=a.G;this.H=a.H;this.ea=a.ea;this.da=a.da;return this};t.h=function(a,b,c,d){this.G=a;this.H=b;this.ea=c;this.da=d;return this};function gc(a,b,c){a.ea=b;a.da=c}t.Og=function(a,b,c,d){F&&(A(a,"number",L,"setTo:x"),A(b,"number",L,"setTo:y"),A(c,"number",L,"setTo:w"),A(d,"number",L,"setTo:h"),0>c&&ya(c,">= 0",L,"setTo:w"),0>d&&ya(d,">= 0",L,"setTo:h"),this.ha());this.G=a;this.H=b;this.ea=c;this.da=d;return this}; t.set=function(a){F&&(w(a,L,L,"set:r"),this.ha());this.G=a.G;this.H=a.H;this.ea=a.ea;this.da=a.da;return this};t.pd=function(a){F&&(w(a,J,L,"setPoint:p"),this.ha());this.G=a.x;this.H=a.y;return this};t.RA=function(a){F&&(w(a,Hb,L,"setSize:s"),this.ha());this.ea=a.width;this.da=a.height;return this};L.prototype.copy=function(){var a=new L;a.G=this.G;a.H=this.H;a.ea=this.ea;a.da=this.da;return a};t=L.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this}; t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Rect is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+=" to value: "+a);v(b)}}; function hc(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 L(c,e,f,g)}return new L}function ic(a){F&&w(a,L);return a.x.toString()+" "+a.y.toString()+" "+a.width.toString()+" "+a.height.toString()} t.toString=function(){return"Rect("+this.x+","+this.y+","+this.width+","+this.height+")"};t.A=function(a){return a instanceof L?this.G===a.x&&this.H===a.y&&this.ea===a.width&&this.da===a.height:!1};t.bj=function(a,b,c,d){return this.G===a&&this.H===b&&this.ea===c&&this.da===d};t.Sa=function(a){return K.C(this.G,a.x)&&K.C(this.H,a.y)&&K.C(this.ea,a.width)&&K.C(this.da,a.height)};function jc(a,b){return K.ca(a.G,b.x)&&K.ca(a.H,b.y)&&K.ca(a.ea,b.width)&&K.ca(a.da,b.height)} t.fa=function(a){F&&w(a,J,L,"containsPoint:p");return this.G<=a.x&&this.G+this.ea>=a.x&&this.H<=a.y&&this.H+this.da>=a.y};t.Oe=function(a){F&&w(a,L,L,"containsRect:r");return this.G<=a.x&&a.x+a.width<=this.G+this.ea&&this.H<=a.y&&a.y+a.height<=this.H+this.da}; t.contains=function(a,b,c,d){F?(C(a,L,"contains:x"),C(b,L,"contains:y"),void 0===c?c=0:C(c,L,"contains:w"),void 0===d?d=0:C(d,L,"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.G<=a&&a+c<=this.G+this.ea&&this.H<=b&&b+d<=this.H+this.da};t.offset=function(a,b){F&&(C(a,L,"offset:dx"),C(b,L,"offset:dy"),this.ha());this.G+=a;this.H+=b;return this}; t.cd=function(a,b){F&&(C(a,L,"inflate:w"),C(b,L,"inflate:h"));return kc(this,b,a,b,a)};t.tq=function(a){F&&w(a,lc,L,"addMargin:m");return kc(this,a.top,a.right,a.bottom,a.left)};t.Cw=function(a){F&&w(a,lc,L,"subtractMargin:m");return kc(this,-a.top,-a.right,-a.bottom,-a.left)};t.jA=function(a,b,c,d){F&&(C(a,L,"grow:t"),C(b,L,"grow:r"),C(c,L,"grow:b"),C(d,L,"grow:l"));return kc(this,a,b,c,d)}; function kc(a,b,c,d,e){F&&a.ha();var f=a.ea;c+e<=-f?(a.G+=f/2,a.ea=0):(a.G-=e,a.ea+=c+e);c=a.da;b+d<=-c?(a.H+=c/2,a.da=0):(a.H-=b,a.da+=b+d);return a}t.nA=function(a){F&&w(a,L,L,"intersectRect:r");return mc(this,a.x,a.y,a.width,a.height)};t.Xv=function(a,b,c,d){F&&(C(a,L,"intersect:x"),C(b,L,"intersect:y"),C(c,L,"intersect:w"),C(d,L,"intersect:h"),(0>c||0>d)&&v("Rect.intersect:Width and height cannot be negative"));return mc(this,a,b,c,d)}; function mc(a,b,c,d,e){F&&a.ha();var f=Math.max(a.G,b),g=Math.max(a.H,c);b=Math.min(a.G+a.ea,b+d);c=Math.min(a.H+a.da,c+e);a.G=f;a.H=g;a.ea=Math.max(0,b-f);a.da=Math.max(0,c-g);return a}t.Mc=function(a){F&&w(a,L,L,"intersectsRect:r");return this.Yv(a.x,a.y,a.width,a.height)}; t.Yv=function(a,b,c,d){F&&(C(a,L,"intersects:x"),C(b,L,"intersects:y"),C(a,L,"intersects:w"),C(b,L,"intersects:h"),(0>c||0>d)&&v("Rect.intersects:Width and height cannot be negative"));var e=this.ea,f=this.G;if(Infinity!==e&&Infinity!==c&&(e+=f,c+=a,isNaN(c)||isNaN(e)||f>c||a>e))return!1;a=this.da;c=this.H;return Infinity!==a&&Infinity!==d&&(a+=c,d+=b,isNaN(d)||isNaN(a)||c>d||b>a)?!1:!0}; function nc(a,b){var c=a.ea,d=a.G,e=b.x-10;if(d>b.width+10+10+e||e>c+d)return!1;c=a.da;a=a.H;d=b.y-10;return a>b.height+10+10+d||d>c+a?!1:!0}t.Ve=function(a){F&&w(a,J,L,"unionPoint:p");return qc(this,a.x,a.y,0,0)};t.Nc=function(a){F&&w(a,L,L,"unionRect:r");return qc(this,a.G,a.H,a.ea,a.da)}; t.Jw=function(a,b,c,d){F?(C(a,L,"union:x"),C(b,L,"union:y"),void 0===c?c=0:C(c,L,"union:w"),void 0===d?d=0:C(d,L,"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 qc(this,a,b,c,d)};function qc(a,b,c,d,e){var f=Math.min(a.G,b),g=Math.min(a.H,c);b=Math.max(a.G+a.ea,b+d);c=Math.max(a.H+a.da,c+e);a.G=f;a.H=g;a.ea=b-f;a.da=c-g;return a} t.Jk=function(a,b,c){F&&(C(a,L,"setSpot:x"),C(b,L,"setSpot:y"),w(c,M,L,"setSpot:spot"),this.ha());this.G=a-c.offsetX-c.x*this.ea;this.H=b-c.offsetY-c.y*this.da;return this}; function rc(a,b,c,d,e,f,g,h){F?(C(a,L,"contains:rx"),C(b,L,"contains:ry"),C(c,L,"contains:rw"),C(d,L,"contains:rh"),C(e,L,"contains:x"),C(f,L,"contains:y"),void 0===g?g=0:C(g,L,"contains:w"),void 0===h?h=0:C(h,L,"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 sc(a,b,c,d,e,f,g,h){F&&(C(a,L,"intersects:rx"),C(b,L,"intersects:ry"),C(c,L,"intersects:rw"),C(d,L,"intersects:rh"),C(e,L,"intersects:x"),C(f,L,"intersects:y"),C(g,L,"intersects:w"),C(h,L,"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.o=function(){return isFinite(this.x)&&isFinite(this.y)&&isFinite(this.width)&&isFinite(this.height)};t.pA=function(){return 0===this.width&&0===this.height}; L.alloc=function(){var a=uc.pop();return void 0===a?new L:a};L.allocAt=function(a,b,c,d){var e=uc.pop();return void 0===e?new L(a,b,c,d):e.h(a,b,c,d)};L.free=function(a){uc.push(a)}; ma.Object.defineProperties(L.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){F&&(A(a,"number",L,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){F&&(A(a,"number",L,"y"),this.ha(a));this.H=a}},width:{configurable:!0,get:function(){return this.ea},set:function(a){F&&(A(a,"number",L,"width"),this.ha(a));0>a&&ya(a,">= 0",L,"width");this.ea=a}},height:{configurable:!0,get:function(){return this.da}, set:function(a){F&&(A(a,"number",L,"height"),this.ha(a));0>a&&ya(a,">= 0",L,"height");this.da=a}},left:{configurable:!0,get:function(){return this.G},set:function(a){F&&(A(a,"number",L,"left"),this.ha(a));this.G=a}},top:{configurable:!0,get:function(){return this.H},set:function(a){F&&(A(a,"number",L,"top"),this.ha(a));this.H=a}},right:{configurable:!0,get:function(){return this.G+this.ea},set:function(a){F&&(C(a,L,"right"),this.ha(a));this.G+=a-(this.G+this.ea)}}, bottom:{configurable:!0,get:function(){return this.H+this.da},set:function(a){F&&(C(a,L,"top"),this.ha(a));this.H+=a-(this.H+this.da)}},position:{configurable:!0,get:function(){return new J(this.G,this.H)},set:function(a){F&&(w(a,J,L,"position"),this.ha(a));this.G=a.x;this.H=a.y}},size:{configurable:!0,get:function(){return new Hb(this.ea,this.da)},set:function(a){F&&(w(a,Hb,L,"size"),this.ha(a));this.ea=a.width;this.da=a.height}},center:{configurable:!0, enumerable:!0,get:function(){return new J(this.G+this.ea/2,this.H+this.da/2)},set:function(a){F&&(w(a,J,L,"center"),this.ha(a));this.G=a.x-this.ea/2;this.H=a.y-this.da/2}},centerX:{configurable:!0,get:function(){return this.G+this.ea/2},set:function(a){F&&(C(a,L,"centerX"),this.ha(a));this.G=a-this.ea/2}},centerY:{configurable:!0,get:function(){return this.H+this.da/2},set:function(a){F&&(C(a,L,"centerY"),this.ha(a));this.H=a-this.da/2}}});L.prototype.isEmpty=L.prototype.pA; L.prototype.isReal=L.prototype.o;L.intersectsLineSegment=function(a,b,c,d,e,f,g,h){F&&(C(a,L,"intersectsLineSegment:x"),C(b,L,"intersectsLineSegment:y"),C(c,L,"intersectsLineSegment:w"),C(d,L,"intersectsLineSegment:h"),C(e,L,"intersectsLineSegment:p1x"),C(f,L,"intersectsLineSegment:p1y"),C(g,L,"intersectsLineSegment:p2x"),C(h,L,"intersectsLineSegment:p2y"),(0>c||0>d)&&v("Rect.intersectsLineSegment: width and height cannot be negative"));return K.ny(a,b,c,d,e,f,g,h)};L.prototype.setSpot=L.prototype.Jk; L.prototype.union=L.prototype.Jw;L.prototype.unionRect=L.prototype.Nc;L.prototype.unionPoint=L.prototype.Ve;L.prototype.intersects=L.prototype.Yv;L.prototype.intersectsRect=L.prototype.Mc;L.prototype.intersect=L.prototype.Xv;L.prototype.intersectRect=L.prototype.nA;L.prototype.grow=L.prototype.jA;L.prototype.subtractMargin=L.prototype.Cw;L.prototype.addMargin=L.prototype.tq;L.prototype.inflate=L.prototype.cd;L.prototype.offset=L.prototype.offset;L.prototype.contains=L.prototype.contains; L.prototype.containsRect=L.prototype.Oe;L.prototype.containsPoint=L.prototype.fa;L.prototype.equalsApprox=L.prototype.Sa;L.prototype.equalTo=L.prototype.bj;L.prototype.equals=L.prototype.A;L.prototype.setSize=L.prototype.RA;L.prototype.setPoint=L.prototype.pd;L.prototype.set=L.prototype.set;L.prototype.setTo=L.prototype.Og;var vc=null,wc=null,uc=[];L.className="Rect";L.parse=hc;L.stringify=ic;L.contains=rc;L.intersects=sc;L.ZeroRect=vc=(new L(0,0,0,0)).ia();L.NoRect=wc=(new L(NaN,NaN,NaN,NaN)).ia(); L.parse=hc;L.stringify=ic;L.contains=rc;L.intersects=sc;function lc(a,b,c,d){void 0===a?this.ze=this.me=this.Ie=this.Ke=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.s=!1}lc.prototype.assign=function(a){this.Ke=a.Ke;this.Ie=a.Ie;this.me=a.me;this.ze=a.ze;return this}; lc.prototype.Og=function(a,b,c,d){F&&(A(a,"number",lc,"setTo:t"),A(b,"number",lc,"setTo:r"),A(c,"number",lc,"setTo:b"),A(d,"number",lc,"setTo:l"),this.ha());this.Ke=a;this.Ie=b;this.me=c;this.ze=d;return this};lc.prototype.set=function(a){F&&(w(a,lc,lc,"assign:m"),this.ha());this.Ke=a.Ke;this.Ie=a.Ie;this.me=a.me;this.ze=a.ze;return this};lc.prototype.copy=function(){var a=new lc;a.Ke=this.Ke;a.Ie=this.Ie;a.me=this.me;a.ze=this.ze;return a};t=lc.prototype; t.ia=function(){this.s=!0;Object.freeze(this);return this};t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Margin is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+=" to value: "+a);v(b)}}; function xc(a){if("string"===typeof a){a=a.split(" ");for(var b=0,c=NaN;""===a[b];)b++;var d=a[b++];d&&(c=parseFloat(d));if(isNaN(c))return new lc;for(var e=NaN;""===a[b];)b++;(d=a[b++])&&(e=parseFloat(d));if(isNaN(e))return new lc(c);for(var f=NaN;""===a[b];)b++;(d=a[b++])&&(f=parseFloat(d));if(isNaN(f))return new lc(c,e);for(var g=NaN;""===a[b];)b++;(d=a[b++])&&(g=parseFloat(d));return isNaN(g)?new lc(c,e):new lc(c,e,f,g)}return new lc} function yc(a){F&&w(a,lc);return a.top.toString()+" "+a.right.toString()+" "+a.bottom.toString()+" "+a.left.toString()}t.toString=function(){return"Margin("+this.top+","+this.right+","+this.bottom+","+this.left+")"};t.A=function(a){return a instanceof lc?this.Ke===a.top&&this.Ie===a.right&&this.me===a.bottom&&this.ze===a.left:!1};t.bj=function(a,b,c,d){return this.Ke===a&&this.Ie===b&&this.me===c&&this.ze===d}; t.Sa=function(a){return K.C(this.Ke,a.top)&&K.C(this.Ie,a.right)&&K.C(this.me,a.bottom)&&K.C(this.ze,a.left)};t.o=function(){return isFinite(this.top)&&isFinite(this.right)&&isFinite(this.bottom)&&isFinite(this.left)};lc.alloc=function(){var a=Dc.pop();return void 0===a?new lc:a};lc.free=function(a){Dc.push(a)}; ma.Object.defineProperties(lc.prototype,{top:{configurable:!0,get:function(){return this.Ke},set:function(a){F&&(C(a,lc,"top"),this.ha(a));this.Ke=a}},right:{configurable:!0,get:function(){return this.Ie},set:function(a){F&&(C(a,lc,"right"),this.ha(a));this.Ie=a}},bottom:{configurable:!0,get:function(){return this.me},set:function(a){F&&(C(a,lc,"bottom"),this.ha(a));this.me=a}},left:{configurable:!0,get:function(){return this.ze},set:function(a){F&& (C(a,lc,"left"),this.ha(a));this.ze=a}}});lc.prototype.isReal=lc.prototype.o;lc.prototype.equalsApprox=lc.prototype.Sa;lc.prototype.equalTo=lc.prototype.bj;lc.prototype.equals=lc.prototype.A;lc.prototype.set=lc.prototype.set;lc.prototype.setTo=lc.prototype.Og;var Ec=null,Fc=null,Dc=[];lc.className="Margin";lc.parse=xc;lc.stringify=yc;lc.ZeroMargin=Ec=(new lc(0,0,0,0)).ia();lc.TwoMargin=Fc=(new lc(2,2,2,2)).ia();lc.parse=xc;lc.stringify=yc; function M(a,b,c,d){void 0===a?this.Yd=this.Xd=this.H=this.G=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.s=!1}var Gc,Hc,Ic,Jc,Lc,Mc,Nc,Oc,Pc,Sc,Tc,Uc,Vc,Wc,Xc,Yc,Zc,ad,bd,cd,dd,ed,fd,gd,kd,ld,md,nd,od,pd,qd,rd,sd,td,ud,vd;M.prototype.assign=function(a){this.G=a.G;this.H=a.H;this.Xd=a.Xd;this.Yd=a.Yd;return this}; M.prototype.Og=function(a,b,c,d){F&&(wd(a,"setTo:x"),wd(b,"setTo:y"),xd(c,"setTo:offx"),xd(d,"setTo:offy"),this.ha());this.G=a;this.H=b;this.Xd=c;this.Yd=d;return this};M.prototype.set=function(a){F&&(w(a,M,M,"set:s"),this.ha());this.G=a.G;this.H=a.H;this.Xd=a.Xd;this.Yd=a.Yd;return this};M.prototype.copy=function(){var a=new M;a.G=this.G;a.H=this.H;a.Xd=this.Xd;a.Yd=this.Yd;return a};t=M.prototype;t.ia=function(){this.s=!0;Object.freeze(this);return this}; t.J=function(){return this.s||Object.isFrozen(this)?this:this.copy().freeze()};t.freeze=function(){this.s=!0;return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;return this};t.ha=function(a){if(F&&this.s){var b="The Spot is frozen, so its properties cannot be set: "+this.toString();void 0!==a&&(b+=" to value: "+a);v(b)}};function yd(a,b){a.G=NaN;a.H=NaN;a.Xd=b;return a}function wd(a,b){(isNaN(a)||1<a||0>a)&&ya(a,"0 <= "+b+" <= 1",M,b)} function xd(a,b){(isNaN(a)||Infinity===a||-Infinity===a)&&ya(a,"real number, not NaN or Infinity",M,b)} function zd(a){if("string"===typeof a){a=a.trim();if("None"===a)return Gc;if("TopLeft"===a)return Hc;if("Top"===a||"TopCenter"===a||"MiddleTop"===a)return Ic;if("TopRight"===a)return Jc;if("Left"===a||"LeftCenter"===a||"MiddleLeft"===a)return Lc;if("Center"===a)return Mc;if("Right"===a||"RightCenter"===a||"MiddleRight"===a)return Nc;if("BottomLeft"===a)return Oc;if("Bottom"===a||"BottomCenter"===a||"MiddleBottom"===a)return Pc;if("BottomRight"===a)return Sc;if("TopSide"===a)return Tc;if("LeftSide"=== a)return Uc;if("RightSide"===a)return Vc;if("BottomSide"===a)return Wc;if("TopBottomSides"===a)return Xc;if("LeftRightSides"===a)return Yc;if("TopLeftSides"===a)return Zc;if("TopRightSides"===a)return ad;if("BottomLeftSides"===a)return bd;if("BottomRightSides"===a)return cd;if("NotTopSide"===a)return dd;if("NotLeftSide"===a)return ed;if("NotRightSide"===a)return fd;if("NotBottomSide"===a)return gd;if("AllSides"===a)return kd;if("Default"===a)return ld;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 M(c,e,f,g)}return new M}function Ad(a){F&&w(a,M);return a.ab()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()} t.toString=function(){return this.ab()?0===this.Xd&&0===this.Yd?"Spot("+this.x+","+this.y+")":"Spot("+this.x+","+this.y+","+this.offsetX+","+this.offsetY+")":this.A(Gc)?"None":this.A(Hc)?"TopLeft":this.A(Ic)?"Top":this.A(Jc)?"TopRight":this.A(Lc)?"Left":this.A(Mc)?"Center":this.A(Nc)?"Right":this.A(Oc)?"BottomLeft":this.A(Pc)?"Bottom":this.A(Sc)?"BottomRight":this.A(Tc)?"TopSide":this.A(Uc)?"LeftSide":this.A(Vc)?"RightSide":this.A(Wc)?"BottomSide":this.A(Xc)?"TopBottomSides":this.A(Yc)?"LeftRightSides": this.A(Zc)?"TopLeftSides":this.A(ad)?"TopRightSides":this.A(bd)?"BottomLeftSides":this.A(cd)?"BottomRightSides":this.A(dd)?"NotTopSide":this.A(ed)?"NotLeftSide":this.A(fd)?"NotRightSide":this.A(gd)?"NotBottomSide":this.A(kd)?"AllSides":this.A(ld)?"Default":"None"};t.A=function(a){return a instanceof M?(this.G===a.x||isNaN(this.G)&&isNaN(a.x))&&(this.H===a.y||isNaN(this.H)&&isNaN(a.y))&&this.Xd===a.offsetX&&this.Yd===a.offsetY:!1}; t.hw=function(){return new M(.5-(this.G-.5),.5-(this.H-.5),-this.Xd,-this.Yd)};t.If=function(a){if(!this.nd())return!1;if(!a.nd())if(a.A(md))a=Uc;else if(a.A(nd))a=Vc;else if(a.A(od))a=Tc;else if(a.A(pd))a=Wc;else return!1;a=a.offsetY;return(this.Yd&a)===a};t.ab=function(){return!isNaN(this.x)&&!isNaN(this.y)};t.Sb=function(){return isNaN(this.x)||isNaN(this.y)};t.nd=function(){return isNaN(this.x)&&isNaN(this.y)&&1===this.offsetX&&0!==this.offsetY}; t.Kq=function(){return isNaN(this.x)&&isNaN(this.y)&&0===this.offsetX&&0===this.offsetY};t.Gb=function(){return isNaN(this.x)&&isNaN(this.y)&&-1===this.offsetX&&0===this.offsetY};M.alloc=function(){var a=Dd.pop();return void 0===a?new M:a};M.free=function(a){Dd.push(a)}; ma.Object.defineProperties(M.prototype,{x:{configurable:!0,get:function(){return this.G},set:function(a){F&&(wd(a,"x"),this.ha(a));this.G=a}},y:{configurable:!0,get:function(){return this.H},set:function(a){F&&(wd(a,"y"),this.ha(a));this.H=a}},offsetX:{configurable:!0,get:function(){return this.Xd},set:function(a){F&&(xd(a,"offsetX"),this.ha(a));this.Xd=a}},offsetY:{configurable:!0,get:function(){return this.Yd},set:function(a){F&&(xd(a,"offsetY"), this.ha(a));this.Yd=a}}});M.prototype.isDefault=M.prototype.Gb;M.prototype.isNone=M.prototype.Kq;M.prototype.isSide=M.prototype.nd;M.prototype.isNoSpot=M.prototype.Sb;M.prototype.isSpot=M.prototype.ab;M.prototype.includesSide=M.prototype.If;M.prototype.opposite=M.prototype.hw;M.prototype.equals=M.prototype.A;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.Og;var Dd=[];M.className="Spot";M.parse=zd;M.stringify=Ad;M.None=Gc=yd(new M(0,0,0,0),0).ia();M.Default=ld=yd(new M(0,0,-1,0),-1).ia(); M.TopLeft=Hc=(new M(0,0,0,0)).ia();M.TopCenter=Ic=(new M(.5,0,0,0)).ia();M.TopRight=Jc=(new M(1,0,0,0)).ia();M.LeftCenter=Lc=(new M(0,.5,0,0)).ia();M.Center=Mc=(new M(.5,.5,0,0)).ia();M.RightCenter=Nc=(new M(1,.5,0,0)).ia();M.BottomLeft=Oc=(new M(0,1,0,0)).ia();M.BottomCenter=Pc=(new M(.5,1,0,0)).ia();M.BottomRight=Sc=(new M(1,1,0,0)).ia();M.MiddleTop=qd=Ic;M.MiddleLeft=rd=Lc;M.MiddleRight=sd=Nc;M.MiddleBottom=td=Pc;M.Top=od=Ic;M.Left=md=Lc;M.Right=nd=Nc;M.Bottom=pd=Pc; M.TopSide=Tc=yd(new M(0,0,1,1),1).ia();M.LeftSide=Uc=yd(new M(0,0,1,2),1).ia();M.RightSide=Vc=yd(new M(0,0,1,4),1).ia();M.BottomSide=Wc=yd(new M(0,0,1,8),1).ia();M.TopBottomSides=Xc=yd(new M(0,0,1,9),1).ia();M.LeftRightSides=Yc=yd(new M(0,0,1,6),1).ia();M.TopLeftSides=Zc=yd(new M(0,0,1,3),1).ia();M.TopRightSides=ad=yd(new M(0,0,1,5),1).ia();M.BottomLeftSides=bd=yd(new M(0,0,1,10),1).ia();M.BottomRightSides=cd=yd(new M(0,0,1,12),1).ia();M.NotTopSide=dd=yd(new M(0,0,1,14),1).ia(); M.NotLeftSide=ed=yd(new M(0,0,1,13),1).ia();M.NotRightSide=fd=yd(new M(0,0,1,11),1).ia();M.NotBottomSide=gd=yd(new M(0,0,1,7),1).ia();M.AllSides=kd=yd(new M(0,0,1,15),1).ia();ud=(new M(.156,.156)).ia();vd=(new M(.844,.844)).ia();M.parse=zd;M.stringify=Ad;function Ib(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0}Ib.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}; Ib.prototype.copy=function(){var a=new Ib;a.m11=this.m11;a.m12=this.m12;a.m21=this.m21;a.m22=this.m22;a.dx=this.dx;a.dy=this.dy;return a};t=Ib.prototype;t.toString=function(){return"Transform("+this.m11+","+this.m12+","+this.m21+","+this.m22+","+this.dx+","+this.dy+")"};t.A=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};t.Mt=function(){return 0===this.dx&&0===this.dy&&1===this.m11&&0===this.m12&&0===this.m21&&1===this.m22}; t.reset=function(){this.m11=1;this.m21=this.m12=0;this.m22=1;this.dy=this.dx=0;return this};t.multiply=function(a){var b=this.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}; t.dw=function(a){var b=1/(a.m11*a.m22-a.m12*a.m21),c=a.m22*b,d=-a.m12*b,e=-a.m21*b,f=a.m11*b,g=b*(a.m21*a.dy-a.m22*a.dx);a=b*(a.m12*a.dx-a.m11*a.dy);b=this.m11*c+this.m21*d;c=this.m12*c+this.m22*d;d=this.m11*e+this.m21*f;e=this.m12*e+this.m22*f;this.dx=this.m11*g+this.m21*a+this.dx;this.dy=this.m12*g+this.m22*a+this.dy;this.m11=b;this.m12=c;this.m21=d;this.m22=e;return this}; t.Kt=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}; Ib.prototype.rotate=function(a,b,c){F&&(C(a,Ib,"rotate:angle"),C(b,Ib,"rotate:rx"),C(c,Ib,"rotate:ry"));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=Ib.prototype; t.translate=function(a,b){F&&(C(a,Ib,"translate:x"),C(b,Ib,"translate:y"));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);F&&(C(a,Ib,"translate:sx"),C(b,Ib,"translate:sy"));this.m11*=a;this.m12*=a;this.m21*=b;this.m22*=b;return this};t.xa=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.de=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.Iw=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};Ib.alloc=function(){var a=Ed.pop();return void 0===a?new Ib:a}; Ib.free=function(a){Ed.push(a)};Ib.prototype.transformRect=Ib.prototype.Iw;Ib.prototype.invertedTransformPoint=Ib.prototype.de;Ib.prototype.transformPoint=Ib.prototype.xa;Ib.prototype.scale=Ib.prototype.scale;Ib.prototype.translate=Ib.prototype.translate;Ib.prototype.rotate=Ib.prototype.rotate;Ib.prototype.invert=Ib.prototype.Kt;Ib.prototype.multiplyInverted=Ib.prototype.dw;Ib.prototype.multiply=Ib.prototype.multiply;Ib.prototype.reset=Ib.prototype.reset;Ib.prototype.isIdentity=Ib.prototype.Mt; Ib.prototype.equals=Ib.prototype.A;Ib.prototype.set=Ib.prototype.set;var Ed=[];Ib.className="Transform";Ib.xF="54a702f3e53909c447824c6706603faf4c"; var K={$A:"7da71ca0ad381e90",Rg:(Math.sqrt(2)-1)/3*4,Yw:null,sqrt:function(a){if(0>=a)return 0;var b=K.Yw;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);K.Yw=b}return 1>a?(c=1/a,2E3>=c?1/b[c|0]:Math.sqrt(a)):2E3>=a?b[a|0]:Math.sqrt(a)},C:function(a,b){a-=b;return.5>a&&-.5<a},ca:function(a,b){a-=b;return 5E-8>a&&-5E-8<a},Tb: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},rt:function(a,b,c,d,e,f,g,h,k,l,m,n){if(K.Tb(a,b,g,h,n,c,d)&&K.Tb(a,b,g,h,n,e,f))return K.Tb(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 x=(d+q)/2,y=(c+u)/2;return K.rt(a, b,p,r,d,c,x,y,k,l,m,n)||K.rt(x,y,q,u,e,f,g,h,k,l,m,n)},kz: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},jz:function(a,b,c,d,e,f,g,h){var k=(c+e)/2,l=(d+f)/2;return Mb(((a+c)/2+k)/2,((b+d)/2+l)/2,(k+(e+g)/2)/2,(l+(f+h)/2)/2)},om:function(a,b,c,d,e,f,g,h,k,l){if(K.Tb(a,b,g,h,k,c,d)&&K.Tb(a,b,g,h,k,e,f))qc(l,a,b,0,0),qc(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.om(a,b,m,n,d,c,q,u,k,l);K.om(q,u,p,r,e,f,g,h,k,l)}return l},Ne:function(a,b,c,d,e,f,g,h,k,l){if(K.Tb(a,b,g,h,k,c,d)&&K.Tb(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.Ne(a,b,m,n,d,c,q,u,k,l);K.Ne(q,u,p,r,e,f,g,h,k,l)}return l},kw:function(a,b,c,d,e,f,g,h,k,l){if(K.Tb(a,b,e,f,l,c,d))return K.Tb(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.kw(a,b,m,n,p,r,g,h,k,l)||K.kw(p,r,c,d,e,f,g,h,k,l)},jB: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},jw:function(a,b,c,d,e,f,g,h){if(K.Tb(a,b,e,f,g,c,d))qc(h,a,b,0,0),qc(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.jw(a,b,k,l,m,n,g,h);K.jw(m,n,c,d,e,f,g,h)}return h},Tq:function(a,b,c,d,e,f,g,h){if(K.Tb(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.Tq(a,b,k,l,m,n,g,h);K.Tq(m,n,c,d,e,f,g,h)}return h},uq:function(a,b,c,d,e,f,g,h,k,l,m,n,p,r){if(K.Tb(a,b,g,h,p,c,d)&&K.Tb(a,b,g,h,p,e,f)){var q=(a-g)*(l-n)-(b-h)*(k-m);if(0===q)return!1;p=((a*h-b*g)*(k-m)-(a-g)*(k*n-l*m))/q;q=((a*h-b*g)*(l-n)-(b-h)*(k*n-l*m))/q;if((k>m?k-m:m-k)<(l>n?l-n:n-l)){if(b<h?g=b:(g=h,h=b),q<g||q>h)return!1}else if(a<g?h=a:(h=g,g=a),p<h||p>g)return!1;r.h(p,q);return!0}q= (a+c)/2;var u=(b+d)/2;c=(c+e)/2;d=(d+f)/2;e=(e+g)/2;f=(f+h)/2;var x=(q+c)/2,y=(u+d)/2;c=(c+e)/2;d=(d+f)/2;var z=(x+c)/2,B=(y+d)/2,D=(m-k)*(m-k)+(n-l)*(n-l),G=!1;K.uq(a,b,q,u,x,y,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,G=!0));a=r.x;b=r.y;K.uq(z,B,c,d,e,f,g,h,k,l,m,n,p,r)&&((r.x-k)*(r.x-k)+(r.y-l)*(r.y-l)<D?G=!0:r.h(a,b));return G},vq:function(a,b,c,d,e,f,g,h,k,l,m,n,p){var r=0;if(K.Tb(a,b,g,h,p,c,d)&&K.Tb(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?(a=b,b=h):a=h,u<a||u>b)return r}else if(a<g?(b=a,a=g):b=g,q<b||q>a)return r;0<p?r++:0>p&&r--}else{q=(a+c)/2;u=(b+d)/2;var x=(c+e)/2,y=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+x)/2;c=(u+y)/2;x=(x+e)/2;y=(y+f)/2;var z=(d+x)/2,B=(c+y)/2;r+=K.vq(a,b,q,u,d,c,z,B,k,l,m,n,p);r+=K.vq(z,B,x,y,e,f,g,h,k,l,m,n,p)}return r},Th:function(a,b,c,d,e,f,g){if(K.ca(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.ca(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},Se:function(a,b,c,d,e,f,g,h,k){if(K.C(a,c)&&K.C(b,d))return k.h(a,b),!1;if(K.ca(e,g))return K.ca(a,c)?(K.Th(a,b,c,d,e,f,k),!1):K.Th(a,b,c,d,e,(d-b)/(c-a)*(e-a)+b,k);h=(h-f)/(g-e);if(K.ca(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.ca(h,g))return K.Th(a,b,c,d,e,f,k),!1;e=(g*a-h*e+f-b)/(g-h);if(K.ca(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.Th(a,b,c,d,e,g*(e-a)+b,k)},hB:function(a,b,c,d,e){return K.Se(c.x,c.y,d.x,d.y,a.x,a.y,b.x,b.y,e)},gB: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}, bd:function(a,b,c,d,e,f,g,h,k){var l=1E21,m=a,n=b;if(K.Se(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.Se(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.Se(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.Se(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},fB: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},It:function(a,b,c){return K.ny(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},ny: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):rc(a,b,c,d,e,f)||rc(a,b,c,d,g,h)||K.Iq(a,b,k,b,e,f,g,h)||K.Iq(k,b,k,l,e,f,g,h)||K.Iq(k,l,a,l,e,f,g,h)||K.Iq(a,l,a,b,e,f,g,h)?!0:!1},Iq:function(a,b,c,d,e,f,g,h){return 0>= K.ut(a,b,c,d,e,f)*K.ut(a,b,c,d,g,h)&&0>=K.ut(e,f,g,h,a,b)*K.ut(e,f,g,h,c,d)},ut:function(a,b,c,d,e,f){c-=a;d-=b;a=e-a;b=f-b;f=a*d-b*c;0===f&&(f=a*c+b*d,0<f&&(f=(a-c)*c+(b-d)*d,0>f&&(f=0)));return 0>f?-1:0<f?1:0},Qq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},Vx: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.rz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},rz: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)]},Cq: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},iy: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},xz: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.yz(k,0===g?a:b,l,c,0,0)},yz: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},ke:new jb,an:new jb,Wh:new jb,Xh:0};K.za=K.$A; function Fd(a){F&&1<arguments.length&&v("Geometry constructor can take at most one optional argument, the Geometry type.");fb(this);this.s=!1;void 0===a?a=Gd:F&&hb(a,Fd,Fd,"constructor:type");this.ta=a;this.rc=this.kc=this.Zc=this.Yc=0;this.Dj=new H;this.Ur=this.Dj.v;this.Cr=(new L).freeze();this.wa=!0;this.hn=this.Tk=null;this.jn=NaN;this.vf=Hc;this.wf=Sc;this.wl=this.xl=NaN;this.Zf=Hd} Fd.prototype.copy=function(){var a=new Fd;a.ta=this.ta;a.Yc=this.Yc;a.Zc=this.Zc;a.kc=this.kc;a.rc=this.rc;for(var b=this.Dj.j,c=b.length,d=a.Dj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Ur=this.Ur;a.Cr.assign(this.Cr);a.wa=this.wa;a.Tk=this.Tk;a.hn=this.hn;a.jn=this.jn;a.vf=this.vf.J();a.wf=this.wf.J();a.xl=this.xl;a.wl=this.wl;a.Zf=this.Zf;return a};t=Fd.prototype;t.ia=function(){this.freeze();Object.freeze(this);return this}; t.freeze=function(){this.s=!0;var a=this.figures;a.freeze();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].freeze();return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;var a=this.figures;a.ka();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ka();return this}; t.Sa=function(a){if(!(a instanceof Fd))return!1;if(this.type!==a.type)return this.type===Id&&a.type===Gd?Jd(this,a):a.type===Id&&this.type===Gd?Jd(a,this):!1;if(this.type===Gd){var b=this.figures.j;a=a.figures.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Sa(a[d]))return!1;return!0}return K.C(this.startX,a.startX)&&K.C(this.startY,a.startY)&&K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)}; function Jd(a,b){return a.type!==Id||b.type!==Gd?!1:1===b.figures.count&&(b=b.figures.O(0),1===b.segments.count&&K.C(a.startX,b.startX)&&K.C(a.startY,b.startY)&&(b=b.segments.O(0),b.type===Kd&&K.C(a.endX,b.endX)&&K.C(a.endY,b.endY)))?!0:!1}function Ld(a){return a.toString()}t.mb=function(a){a.classType===Fd?this.type=a:Ba(this,a)}; t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case Id: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 Md:var b=new L(this.startX,this.startY,0,0);b.Jw(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 Ud:b=new L(this.startX,this.startY,0,0);b.Jw(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 Gd:b="";c=this.figures.j;for(var d=c.length,e=0;e<d;e++){var f=c[e];0<e&&(b+=" x ");f.isFilled&&(b+="F ");b+=f.toString(a)}return b;default:return this.type.toString()}}; function Vd(a,b){function c(){return u>=D-1?!0:null!==k[u+1].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/)}function d(){u++;return k[u]}function e(){var a=new J(parseFloat(d()),parseFloat(d()));x===x.toLowerCase()&&(a.x=B.x+a.x,a.y=B.y+a.y);return a}function f(){return B=e()}function g(){return z=e()}function h(){var a=y.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&&xa(a,"string",Fd,"parse:str");a=a.replace(/,/gm," ");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm, "$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])([^\s])/gm,"$1 $2");a=a.replace(/([^\s])([UuBbMmZzLlHhVvCcSsQqTtAaFfXx])/gm,"$1 $2");a=a.replace(/([0-9])([+\-])/gm,"$1 $2");a=a.replace(/([Aa](\s+[0-9]+){3})\s+([01])\s*([01])/gm,"$1 $3 $4 ");a=a.replace(/[\s\r\t\n]+/gm," ");a=a.replace(/^\s+|\s+$/g,"");var k=a.split(" ");for(a=0;a<k.length;a++){var l=k[a];if(null!==l.match(/(\.[0-9]*)(\.)/gm)){for(var m= La(),n="",p=!1,r=0;r<l.length;r++){var q=l[r];"."!==q||p?"."===q?(m.push(n),n="."):n+=q:(p=!0,n+=q)}m.push(n);k.splice(a,1);for(l=0;l<m.length;l++)k.splice(a+l,0,m[l]);a+=m.length-1;Oa(m)}}var u=-1,x="",y="";m=new J(0,0);var z=new J(0,0),B=new J(0,0),D=k.length;a=Wd(null);n=l=!1;p=!0;for(r=null;!(u>=D-1);)if(y=x,x=d(),""!==x)switch(x.toUpperCase()){case "X":p=!0;n=l=!1;break;case "M":r=f();null===a.lc||!0===p?(Xd(a,r.x,r.y,l,!n),p=!1):a.moveTo(r.x,r.y);for(m=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((x===x.toLowerCase()?B.x:0)+parseFloat(d()),B.y),a.lineTo(B.x,B.y);break;case "V":for(;!c();)B=new J(B.x,(x===x.toLowerCase()?B.y:0)+parseFloat(d())),a.lineTo(B.x,B.y);break;case "C":for(;!c();){r=e();q=g();var G=f();Yd(a,r.x,r.y,q.x,q.y,G.x,G.y)}break;case "S":for(;!c();)r=h(),q=g(),G=f(),Yd(a,r.x,r.y,q.x,q.y,G.x,G.y);break;case "Q":for(;!c();)r=g(),q=f(),Zd(a,r.x,r.y,q.x,q.y);break;case "T":for(;!c();)z=r=h(),q=f(),Zd(a, r.x,r.y,q.x,q.y);break;case "B":for(;!c();){r=parseFloat(d());q=parseFloat(d());G=parseFloat(d());var O=parseFloat(d()),X=parseFloat(d()),Q=X,ca=!1;c()||(Q=parseFloat(d()),c()||(ca=0!==parseFloat(d())));x===x.toLowerCase()&&(G+=B.x,O+=B.y);a.arcTo(r,q,G,O,X,Q,ca)}break;case "A":for(;!c();)r=Math.abs(parseFloat(d())),q=Math.abs(parseFloat(d())),G=parseFloat(d()),O=!!parseFloat(d()),X=!!parseFloat(d()),Q=f(),de(a,r,q,G,O,X,Q.x,Q.y);break;case "Z":ee(a);B=m;break;case "F":r="";for(q=1;k[u+q];)if(null!== k[u+q].match(/[Uu]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?l=!0:0<a.lc.segments.length&&(a.lc.isFilled=!0);break;case "U":r="";for(q=1;k[u+q];)if(null!==k[u+q].match(/[Ff]/))q++;else if(null===k[u+q].match(/[UuBbMmZzLlHhVvCcSsQqTtAaFfXx]/))q++;else{r=k[u+q];break}r.match(/[Mm]/)?n=!0:a.br(!1)}m=a.Dt;fe=a;if(b)for(b=m.figures.iterator;b.next();)b.value.isFilled=!0;return m} function ge(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.xa(d);f[0]=d.x;f[1]=d.y;d.x=f[2];d.y=f[3];b.xa(d);f[2]=d.x;f[3]=d.y;d.x=f[4];d.y=f[5];b.xa(d);f[4]=d.x;f[5]=d.y;d.x=f[6];d.y=f[7];b.xa(d);f[6]=d.x;f[7]=d.y}J.free(d)}t.aw=function(){if(this.wa||this.Ur!==this.figures.v)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].aw())return!0;return!1}; Fd.prototype.computeBounds=function(){this.wa=!1;this.hn=this.Tk=null;this.jn=NaN;this.Ur=this.figures.v;for(var a=this.figures.j,b=a.length,c=0;c<b;c++){var d=a[c];d.wa=!1;var e=d.segments;d.Zs=e.v;d=e.j;e=d.length;for(var f=0;f<e;f++){var g=d[f];g.wa=!1;g.Xe=null}}a=this.Cr;a.ka();isNaN(this.xl)||isNaN(this.wl)?a.h(0,0,0,0):a.h(0,0,this.xl,this.wl);he(this,a,!1);qc(a,0,0,0,0);a.freeze()};Fd.prototype.Ux=function(){var a=new L;he(this,a,!0);return a}; function he(a,b,c){switch(a.type){case Id:case Md:case Ud:c?b.h(a.Yc,a.Zc,0,0):qc(b,a.Yc,a.Zc,0,0);qc(b,a.kc,a.rc,0,0);break;case Gd:var d=a.figures;a=d.j;d=d.length;for(var e=0;e<d;e++){var f=a[e];c&&0===e?b.h(f.startX,f.startY,0,0):qc(b,f.startX,f.startY,0,0);for(var g=f.segments.j,h=g.length,k=f.startX,l=f.startY,m=0;m<h;m++){var n=g[m];switch(n.type){case Kd:case ie:k=n.endX;l=n.endY;qc(b,k,l,0,0);break;case je:K.om(k,l,n.point1X,n.point1Y,n.point2X,n.point2Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY; break;case ke:K.jw(k,l,n.point1X,n.point1Y,n.endX,n.endY,.5,b);k=n.endX;l=n.endY;break;case le:case me:var p=n.type===le?ne(n,f):oe(n,f,k,l),r=p.length;if(0===r){k=n.centerX;l=n.centerY;qc(b,k,l,0,0);break}n=null;for(var q=0;q<r;q++)n=p[q],K.om(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)}} Fd.prototype.normalize=function(){this.s&&va(this);var a=this.Ux();this.offset(-a.x,-a.y);return new J(-a.x,-a.y)};Fd.prototype.offset=function(a,b){this.s&&va(this);F&&(C(a,Fd,"offset"),C(b,Fd,"offset"));this.transform(1,0,0,1,a,b);return this};Fd.prototype.scale=function(a,b){this.s&&va(this);F&&(C(a,Fd,"scale:x"),C(b,Fd,"scale:y"),0===a&&ya(a,"scale must be non-zero",Fd,"scale:x"),0===b&&ya(b,"scale must be non-zero",Fd,"scale:y"));this.transform(a,0,0,b,0,0);return this}; Fd.prototype.rotate=function(a,b,c){this.s&&va(this);void 0===b&&(b=0);void 0===c&&(c=0);F&&(C(a,Fd,"rotate:angle"),C(b,Fd,"rotate:x"),C(c,Fd,"rotate:y"));var d=Ib.alloc();d.reset();d.rotate(a,b,c);this.transform(d.m11,d.m12,d.m21,d.m22,d.dx,d.dy);Ib.free(d);return this};t=Fd.prototype; t.transform=function(a,b,c,d,e,f){switch(this.type){case Id:case Md:case Ud:var g=this.Yc;var h=this.Zc;this.Yc=g*a+h*c+e;this.Zc=g*b+h*d+f;g=this.kc;h=this.rc;this.kc=g*a+h*c+e;this.rc=g*b+h*d+f;break;case Gd:for(var k=this.figures.j,l=k.length,m=0;m<l;m++){var n=k[m];g=n.startX;h=n.startY;n.startX=g*a+h*c+e;n.startY=g*b+h*d+f;n=n.segments.j;for(var p=n.length,r=0;r<p;r++){var q=n[r];switch(q.type){case Kd:case ie:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;break;case je: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 ke: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 le: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 me:g=q.endX;h=q.endY;q.endX=g*a+h*c+e;q.endY=g*b+h*d+f;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.wa=!0;return this}; t.fa=function(a,b){void 0===b&&(b=0);var c=this.Yc,d=this.Zc,e=this.kc,f=this.rc;switch(this.type){case Id:return K.Tb(c,d,e,f,b,a.x,a.y);case Md:var g=L.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.fa(a);L.free(g);return a;case Ud: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 Gd:return pe(this,a,b,!0,!1);default:return!1}}; function pe(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.j,r=p.length,q=0;q<r;q++){var u=p[q];if(u.isFilled){if(d&&u.fa(f,b,c))return!0;var x=u.segments;k=u.startX;l=u.startY;for(var y=k,z=l,B=x.j,D=0;D<=x.length;D++){var G=void 0;if(D!==x.length){G=B[D];var O=G.type;a=G.endX;n=G.endY}else O=Kd,a=y,n=z;switch(O){case ie:y=qe(f,b,g,b,k,l,y,z);if(isNaN(y))return!0;h+=y;y=a;z=n;break;case Kd:k=qe(f,b,g,b,k,l,a,n);if(isNaN(k))return!0;h+=k;break;case je:m=K.vq(k,l,G.point1X, G.point1Y,G.point2X,G.point2Y,a,n,g,b,f,b,.5);h+=m;break;case ke:m=K.vq(k,l,(k+2*G.point1X)/3,(l+2*G.point1Y)/3,(2*G.point1X+a)/3,(2*G.point1Y+n)/3,a,n,g,b,f,b,.5);h+=m;break;case le:case me:O=G.type===le?ne(G,u):oe(G,u,k,l);var X=O.length;if(0===X){k=qe(f,b,g,b,k,l,G.centerX,G.centerY);if(isNaN(k))return!0;h+=k;break}G=null;for(var Q=0;Q<X;Q++){G=O[Q];if(0===Q){m=qe(f,b,g,b,k,l,G[0],G[1]);if(isNaN(m))return!0;h+=m}m=K.vq(G[0],G[1],G[2],G[3],G[4],G[5],G[6],G[7],g,b,f,b,.5);h+=m}null!==G&&(a=G[6], n=G[7]);break;default:v("Unknown Segment type: "+G.type)}k=a;l=n}if(0!==h)return!0;h=0}else if(u.fa(f,b,e?c:c+2))return!0}return 0!==h}function qe(a,b,c,d,e,f,g,h){if(K.Tb(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 re(a,b,c,d){a=a.figures.j;for(var e=a.length,f=0;f<e;f++)if(a[f].fa(b,c,d))return!0;return!1} t.Sv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=new J);if(this.type===Id)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.jy=function(a){0>a?a=0:1<a&&(a=1);if(this.type===Id)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.Tv=function(a,b){0>a?a=0:1<a&&(a=1);void 0===b&&(b=[]);b.length=3;if(this.type===Id)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.ky=function(a){if(this.type===Id){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.Th(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===Md){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 x= p[u],y=p[u+1];if(0!==u){K.Th(l,m,x,y,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=x;m=y}J.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0}; function se(a){if(null===a.Tk){var b=a.Tk=[],c=a.hn=[],d=[],e=[];if(a.type===Id)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===Md)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===Ud){var f=new te;f.startX=a.endX;f.startY=(a.startY+a.endY)/2;var g=new ue(le);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=ne(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.Ne(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(ve(d))}else for(a=a.figures.iterator;a.next();){e=a.value;d=[];d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;h=g;k=f;for(var l=e.segments.j,m=l.length,n=0;n<m;n++){var p=l[n];switch(p.type){case ie:4<=d.length&&(b.push(d),c.push(ve(d)));d=[];d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;h=g;k=f;break;case Kd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case je:K.Ne(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY, .5,d);g=p.endX;f=p.endY;break;case ke:K.Tq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case le:var r=ne(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 x=r[u];K.Ne(g,f,x[2],x[3],x[4],x[5],x[6],x[7],.5,d);g=x[6];f=x[7]}break;case me:r=oe(p,e,g,f);q=r.length;if(0===q){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(u=0;u<q;u++)x=r[u],K.Ne(g,f,x[2],x[3],x[4],x[5],x[6],x[7],.5,d),g=x[6], f=x[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(ve(d)))}}}function ve(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(Lb(c,d,g,h)),b.push(c));c=g;d=h}return b}t.add=function(a){this.Dj.add(a);return this};t.Ym=function(a,b,c,d,e,f,g,h){this.s&&va(this);this.vf=(new M(a,b,e,f)).freeze();this.wf=(new M(c,d,g,h)).freeze();return this}; ma.Object.defineProperties(Fd.prototype,{flattenedSegments:{configurable:!0,get:function(){se(this);return this.Tk}},flattenedLengths:{configurable:!0,get:function(){se(this);return this.hn}},flattenedTotalLength:{configurable:!0,get:function(){var a=this.jn;if(isNaN(a)){if(this.type===Id){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===Md)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.jn=a}return a}},type:{configurable:!0,get:function(){return this.ta},set:function(a){this.ta!==a&&(F&&hb(a,Fd,Fd,"type"),this.s&&va(this,a),this.ta=a,this.wa=!0)}},startX:{configurable:!0,get:function(){return this.Yc},set:function(a){this.Yc!==a&&(F&&C(a,Fd,"startX"),this.s&&va(this,a),this.Yc=a,this.wa=!0)}},startY:{configurable:!0, get:function(){return this.Zc},set:function(a){this.Zc!==a&&(F&&C(a,Fd,"startY"),this.s&&va(this,a),this.Zc=a,this.wa=!0)}},endX:{configurable:!0,get:function(){return this.kc},set:function(a){this.kc!==a&&(F&&C(a,Fd,"endX"),this.s&&va(this,a),this.kc=a,this.wa=!0)}},endY:{configurable:!0,get:function(){return this.rc},set:function(a){this.rc!==a&&(F&&C(a,Fd,"endY"),this.s&&va(this,a),this.rc=a,this.wa=!0)}},figures:{configurable:!0,get:function(){return this.Dj}, set:function(a){this.Dj!==a&&(F&&w(a,H,Fd,"figures"),this.s&&va(this,a),this.Dj=a,this.wa=!0)}},spot1:{configurable:!0,get:function(){return this.vf},set:function(a){F&&w(a,M,Fd,"spot1");this.s&&va(this,a);this.vf=a.J()}},spot2:{configurable:!0,get:function(){return this.wf},set:function(a){F&&w(a,M,Fd,"spot2");this.s&&va(this,a);this.wf=a.J()}},defaultStretch:{configurable:!0,get:function(){return this.Zf},set:function(a){F&&hb(a,N,Fd,"stretch");this.s&& va(this,a);this.Zf=a}},bounds:{configurable:!0,get:function(){this.aw()&&this.computeBounds();return this.Cr}}});Fd.prototype.setSpots=Fd.prototype.Ym;Fd.prototype.add=Fd.prototype.add;Fd.prototype.getFractionForPoint=Fd.prototype.ky;Fd.prototype.getPointAndAngleAlongPath=Fd.prototype.Tv;Fd.prototype.getAngleAlongPath=Fd.prototype.jy;Fd.prototype.getPointAlongPath=Fd.prototype.Sv;Fd.prototype.containsPoint=Fd.prototype.fa;Fd.prototype.transform=Fd.prototype.transform; Fd.prototype.rotate=Fd.prototype.rotate;Fd.prototype.scale=Fd.prototype.scale;Fd.prototype.offset=Fd.prototype.offset;Fd.prototype.normalize=Fd.prototype.normalize;Fd.prototype.computeBoundsWithoutOrigin=Fd.prototype.Ux;Fd.prototype.equalsApprox=Fd.prototype.Sa;var Id=new E(Fd,"Line",0),Md=new E(Fd,"Rectangle",1),Ud=new E(Fd,"Ellipse",2),Gd=new E(Fd,"Path",3);Fd.className="Geometry";Fd.stringify=Ld; Fd.fillPath=function(a){"string"!==typeof a&&xa(a,"string",Fd,"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};Fd.parse=Vd;Fd.Line=Id;Fd.Rectangle=Md;Fd.Ellipse=Ud;Fd.Path=Gd; function te(a,b,c,d){fb(this);this.s=!1;void 0===c&&(c=!0);this.es=c;void 0===d&&(d=!0);this.js=d;void 0!==a?(F&&C(a,te,"sx"),this.Yc=a):this.Yc=0;void 0!==b?(F&&C(b,te,"sy"),this.Zc=b):this.Zc=0;this.Xl=new H;this.Zs=this.Xl.v;this.wa=!0}te.prototype.copy=function(){var a=new te;a.es=this.es;a.js=this.js;a.Yc=this.Yc;a.Zc=this.Zc;for(var b=this.Xl.j,c=b.length,d=a.Xl,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Zs=this.Zs;a.wa=this.wa;return a};t=te.prototype; t.Sa=function(a){if(!(a instanceof te&&K.C(this.startX,a.startX)&&K.C(this.startY,a.startY)))return!1;var b=this.segments.j;a=a.segments.j;var c=b.length;if(c!==a.length)return!1;for(var d=0;d<c;d++)if(!b[d].Sa(a[d]))return!1;return!0};t.toString=function(a){void 0===a&&(a=-1);var b=0>a?"M"+this.startX.toString()+" "+this.startY.toString():"M"+this.startX.toFixed(a)+" "+this.startY.toFixed(a);for(var c=this.segments.j,d=c.length,e=0;e<d;e++)b+=" "+c[e].toString(a);return b}; t.freeze=function(){this.s=!0;var a=this.segments;a.freeze();var b=a.j;a=a.length;for(var c=0;c<a;c++)b[c].freeze();return this};t.ka=function(){this.s=!1;var a=this.segments;a.ka();a=a.j;for(var b=a.length,c=0;c<b;c++)a[c].ka();return this};t.aw=function(){if(this.wa)return!0;var a=this.segments;if(this.Zs!==a.v)return!0;a=a.j;for(var b=a.length,c=0;c<b;c++)if(a[c].wa)return!0;return!1};t.add=function(a){this.Xl.add(a);return this}; t.fa=function(a,b,c){for(var d=this.startX,e=this.startY,f=d,g=e,h=this.segments.j,k=h.length,l=0;l<k;l++){var m=h[l];switch(m.type){case ie:f=m.endX;g=m.endY;d=m.endX;e=m.endY;break;case Kd:if(K.Tb(d,e,m.endX,m.endY,c,a,b))return!0;d=m.endX;e=m.endY;break;case je:if(K.rt(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 ke:if(K.kw(d,e,m.point1X,m.point1Y,m.endX,m.endY,.5,a,b,c))return!0;d=m.endX;e=m.endY;break;case le:case me:var n=m.type=== le?ne(m,this):oe(m,this,d,e),p=n.length;if(0===p){if(K.Tb(d,e,m.centerX,m.centerY,c,a,b))return!0;d=m.centerX;e=m.centerY;break}for(var r=null,q=0;q<p;q++)if(r=n[q],0===q&&K.Tb(d,e,r[0],r[1],c,a,b)||K.rt(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.Tb(d,e,f,g,c,a,b))return!0}return!1}; ma.Object.defineProperties(te.prototype,{isFilled:{configurable:!0,get:function(){return this.es},set:function(a){F&&A(a,"boolean",te,"isFilled");this.s&&va(this,a);this.es=a}},isShadowed:{configurable:!0,get:function(){return this.js},set:function(a){F&&A(a,"boolean",te,"isShadowed");this.s&&va(this,a);this.js=a}},startX:{configurable:!0,get:function(){return this.Yc},set:function(a){F&&C(a,te,"startX");this.s&&va(this,a);this.Yc=a;this.wa=!0}},startY:{configurable:!0, enumerable:!0,get:function(){return this.Zc},set:function(a){F&&C(a,te,"startY");this.s&&va(this,a);this.Zc=a;this.wa=!0}},segments:{configurable:!0,get:function(){return this.Xl},set:function(a){F&&w(a,H,te,"segments");this.s&&va(this,a);this.Xl=a;this.wa=!0}}});te.prototype.add=te.prototype.add;te.prototype.equalsApprox=te.prototype.Sa;te.className="PathFigure"; function ue(a,b,c,d,e,f,g,h){fb(this);this.s=!1;void 0===a?a=Kd:F&&hb(a,ue,ue,"constructor:type");this.ta=a;void 0!==b?(F&&C(b,ue,"ex"),this.kc=b):this.kc=0;void 0!==c?(F&&C(c,ue,"ey"),this.rc=c):this.rc=0;void 0===d&&(d=0);void 0===e&&(e=0);void 0===f&&(f=0);void 0===g&&(g=0);a===me?(a=f%360,0>a&&(a+=360),this.He=a,this.Oi=0,F&&C(d,ue,"x1"),this.Pi=Math.max(d,0),F&&C(e,ue,"y1"),this.sh=Math.max(e,0),this.Fl="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.Xk=!!h):(F&&C(d,ue,"x1"),this.He=d, F&&C(e,ue,"y1"),this.Oi=e,F&&C(f,ue,"x2"),a===le&&(f=Math.max(f,0)),this.Pi=f,"number"===typeof g?(a===le&&(g=Math.max(g,0)),this.sh=g):this.sh=0,this.Xk=this.Fl=!1);this.Ij=!1;this.wa=!0;this.Xe=null}ue.prototype.copy=function(){var a=new ue;a.ta=this.ta;a.kc=this.kc;a.rc=this.rc;a.He=this.He;a.Oi=this.Oi;a.Pi=this.Pi;a.sh=this.sh;a.Fl=this.Fl;a.Xk=this.Xk;a.Ij=this.Ij;a.wa=this.wa;return a};t=ue.prototype; t.Sa=function(a){if(!(a instanceof ue)||this.type!==a.type||this.isClosed!==a.isClosed)return!1;switch(this.type){case ie:case Kd:return K.C(this.endX,a.endX)&&K.C(this.endY,a.endY);case je:return K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)&&K.C(this.point1X,a.point1X)&&K.C(this.point1Y,a.point1Y)&&K.C(this.point2X,a.point2X)&&K.C(this.point2Y,a.point2Y);case ke:return K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)&&K.C(this.point1X,a.point1X)&&K.C(this.point1Y,a.point1Y);case le:return K.C(this.startAngle, a.startAngle)&&K.C(this.sweepAngle,a.sweepAngle)&&K.C(this.centerX,a.centerX)&&K.C(this.centerY,a.centerY)&&K.C(this.radiusX,a.radiusX)&&K.C(this.radiusY,a.radiusY);case me:return this.isClockwiseArc===a.isClockwiseArc&&this.isLargeArc===a.isLargeArc&&K.C(this.xAxisRotation,a.xAxisRotation)&&K.C(this.endX,a.endX)&&K.C(this.endY,a.endY)&&K.C(this.radiusX,a.radiusX)&&K.C(this.radiusY,a.radiusY);default:return!1}};t.mb=function(a){a.classType===ue?this.type=a:Ba(this,a)}; t.toString=function(a){void 0===a&&(a=-1);switch(this.type){case ie:a=0>a?"M"+this.endX.toString()+" "+this.endY.toString():"M"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case Kd:a=0>a?"L"+this.endX.toString()+" "+this.endY.toString():"L"+this.endX.toFixed(a)+" "+this.endY.toFixed(a);break;case je: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 ke: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 le: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 me: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.Ij?"z":"")};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.close=function(){this.Ij=!0;return this}; function ne(a,b){if(null!==a.Xe&&!1===b.wa)return a.Xe;var c=a.radiusX,d=a.radiusY;void 0===d&&(d=c);if(0===c||0===d)return a.Xe=[],a.Xe;b=a.He;var e=a.Oi,f=K.Vx(0,0,c<d?c:d,a.startAngle,a.startAngle+a.sweepAngle,!1);if(c!==d){var g=Ib.alloc();g.reset();c<d?g.scale(1,d/c):g.scale(c/d,1);ge(f,g);Ib.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.Xe=f;return a.Xe} function oe(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.Xe&&!1===b.wa)return a.Xe;b=a.Pi;var f=a.sh;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.He,h=a.Fl,k=a.Xk,l=a.kc,m=a.rc,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.Vx(0,0,b>f?b:f,m,m+g,!0);f=Ib.alloc();f.reset();f.translate(c,d);f.rotate(a.He,0,0);f.scale(k,r);ge(b,f);Ib.free(f);a.Xe=b;return a.Xe} ma.Object.defineProperties(ue.prototype,{isClosed:{configurable:!0,get:function(){return this.Ij},set:function(a){this.Ij!==a&&(this.Ij=a,this.wa=!0)}},type:{configurable:!0,get:function(){return this.ta},set:function(a){F&&hb(a,ue,ue,"type");this.s&&va(this,a);this.ta=a;this.wa=!0}},endX:{configurable:!0,get:function(){return this.kc},set:function(a){F&&C(a,ue,"endX");this.s&&va(this,a);this.kc=a;this.wa=!0}},endY:{configurable:!0,get:function(){return this.rc}, set:function(a){F&&C(a,ue,"endY");this.s&&va(this,a);this.rc=a;this.wa=!0}},point1X:{configurable:!0,get:function(){return this.He},set:function(a){F&&C(a,ue,"point1X");this.s&&va(this,a);this.He=a;this.wa=!0}},point1Y:{configurable:!0,get:function(){return this.Oi},set:function(a){F&&C(a,ue,"point1Y");this.s&&va(this,a);this.Oi=a;this.wa=!0}},point2X:{configurable:!0,get:function(){return this.Pi},set:function(a){F&&C(a,ue,"point2X");this.s&&va(this,a);this.Pi= a;this.wa=!0}},point2Y:{configurable:!0,get:function(){return this.sh},set:function(a){F&&C(a,ue,"point2Y");this.s&&va(this,a);this.sh=a;this.wa=!0}},centerX:{configurable:!0,get:function(){return this.He},set:function(a){F&&C(a,ue,"centerX");this.s&&va(this,a);this.He=a;this.wa=!0}},centerY:{configurable:!0,get:function(){return this.Oi},set:function(a){F&&C(a,ue,"centerY");this.s&&va(this,a);this.Oi=a;this.wa=!0}},radiusX:{configurable:!0, get:function(){return this.Pi},set:function(a){F&&C(a,ue,"radiusX");0>a&&ya(a,">= zero",ue,"radiusX");this.s&&va(this,a);this.Pi=a;this.wa=!0}},radiusY:{configurable:!0,get:function(){return this.sh},set:function(a){F&&C(a,ue,"radiusY");0>a&&ya(a,">= zero",ue,"radiusY");this.s&&va(this,a);this.sh=a;this.wa=!0}},startAngle:{configurable:!0,get:function(){return this.kc},set:function(a){this.kc!==a&&(this.s&&va(this,a),F&&C(a,ue,"startAngle"),a%=360,0>a&&(a+=360),this.kc= a,this.wa=!0)}},sweepAngle:{configurable:!0,get:function(){return this.rc},set:function(a){F&&C(a,ue,"sweepAngle");this.s&&va(this,a);360<a&&(a=360);-360>a&&(a=-360);this.rc=a;this.wa=!0}},isClockwiseArc:{configurable:!0,get:function(){return this.Xk},set:function(a){this.s&&va(this,a);this.Xk=a;this.wa=!0}},isLargeArc:{configurable:!0,get:function(){return this.Fl},set:function(a){this.s&&va(this,a);this.Fl=a;this.wa=!0}},xAxisRotation:{configurable:!0, get:function(){return this.He},set:function(a){F&&C(a,ue,"xAxisRotation");a%=360;0>a&&(a+=360);this.s&&va(this,a);this.He=a;this.wa=!0}}});ue.prototype.equalsApprox=ue.prototype.Sa;var ie=new E(ue,"Move",0),Kd=new E(ue,"Line",1),je=new E(ue,"Bezier",2),ke=new E(ue,"QuadraticBezier",3),le=new E(ue,"Arc",4),me=new E(ue,"SvgArc",4);ue.className="PathSegment";ue.Move=ie;ue.Line=Kd;ue.Bezier=je;ue.QuadraticBezier=ke;ue.Arc=le;ue.SvgArc=me; function we(){this.B=null;this.qv=(new J(0,0)).freeze();this.Au=(new J(0,0)).freeze();this.ur=this.ws=0;this.vr=1;this.ns="";this.mt=this.Or=!1;this.Lr=this.xr=0;this.Vg=this.Xr=this.gs=!1;this.Tr=null;this.ht=0;this.jd=this.gt=null}we.prototype.copy=function(){var a=new we;return this.clone(a)}; we.prototype.clone=function(a){a.B=this.B;a.qv.assign(this.viewPoint);a.Au.assign(this.documentPoint);a.ws=this.ws;a.ur=this.ur;a.vr=this.vr;a.ns=this.ns;a.Or=this.Or;a.mt=this.mt;a.xr=this.xr;a.Lr=this.Lr;a.gs=this.gs;a.Xr=this.Xr;a.Vg=this.Vg;a.Tr=this.Tr;a.ht=this.ht;a.gt=this.gt;a.jd=this.jd;return a}; we.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};we.prototype.Eq=function(a,b){var c=this.diagram;if(null===c)return b;Ee(c,this.event,a,b);return b}; we.prototype.bA=function(a,b){var c=this.diagram;if(null===c)return b;Ee(c,this.event,a,b);b.assign(c.gu(b));return b}; ma.Object.defineProperties(we.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){this.B=a}},viewPoint:{configurable:!0,get:function(){return this.qv},set:function(a){w(a,J,we,"viewPoint");this.qv.assign(a)}},documentPoint:{configurable:!0,get:function(){return this.Au},set:function(a){w(a,J,we,"documentPoint");this.Au.assign(a)}},modifiers:{configurable:!0,get:function(){return this.ws},set:function(a){this.ws= a}},button:{configurable:!0,get:function(){return this.ur},set:function(a){this.ur=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.vr},set:function(a){this.vr=a}},key:{configurable:!0,get:function(){return this.ns},set:function(a){this.ns=a}},down:{configurable:!0,get:function(){return this.Or},set:function(a){this.Or=a}},up:{configurable:!0, enumerable:!0,get:function(){return this.mt},set:function(a){this.mt=a}},clickCount:{configurable:!0,get:function(){return this.xr},set:function(a){this.xr=a}},delta:{configurable:!0,get:function(){return this.Lr},set:function(a){this.Lr=a}},isMultiTouch:{configurable:!0,get:function(){return this.gs},set:function(a){this.gs=a}},handled:{configurable:!0,get:function(){return this.Xr},set:function(a){this.Xr=a}},bubbles:{configurable:!0, get:function(){return this.Vg},set:function(a){this.Vg=a}},event:{configurable:!0,get:function(){return this.Tr},set:function(a){this.Tr=a}},isTouchEvent:{configurable:!0,get:function(){var a=qa.TouchEvent,b=this.event;return a&&b instanceof a?!0:(a=qa.PointerEvent)&&b instanceof a&&("touch"===b.pointerType||"pen"===b.pointerType)}},timestamp:{configurable:!0,get:function(){return this.ht},set:function(a){this.ht=a}},targetDiagram:{configurable:!0, get:function(){return this.gt},set:function(a){this.gt=a}},targetObject:{configurable:!0,get:function(){return this.jd},set:function(a){this.jd=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}}});we.prototype.getMultiTouchDocumentPoint=we.prototype.bA;we.prototype.getMultiTouchViewPoint=we.prototype.Eq;we.className="InputEvent";function Fe(){this.B=null;this.Wa="";this.Gs=this.ft=null}Fe.prototype.copy=function(){var a=new Fe;a.B=this.B;a.Wa=this.Wa;a.ft=this.ft;a.Gs=this.Gs;return a}; Fe.prototype.toString=function(){var a="*"+this.name;null!==this.subject&&(a+=":"+this.subject.toString());null!==this.parameter&&(a+="("+this.parameter.toString()+")");return a}; ma.Object.defineProperties(Fe.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){this.B=a}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){this.Wa=a}},subject:{configurable:!0,get:function(){return this.ft},set:function(a){this.ft=a}},parameter:{configurable:!0,get:function(){return this.Gs},set:function(a){this.Gs=a}}});Fe.className="DiagramEvent"; function Ge(){this.tn=He;this.nf=this.vs="";this.ep=this.fp=this.lp=this.mp=this.kp=this.B=this.gc=null}Ge.prototype.clear=function(){this.ep=this.fp=this.lp=this.mp=this.kp=this.B=this.gc=null}; Ge.prototype.copy=function(){var a=new Ge;a.tn=this.tn;a.vs=this.vs;a.nf=this.nf;a.gc=this.gc;a.B=this.B;a.kp=this.kp;var b=this.mp;a.mp=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.lp;a.lp=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.fp;a.fp=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.ep;a.ep=Fa(b)&&"function"===typeof b.J?b.J():b;return a};Ge.prototype.mb=function(a){a.classType===Ge?this.change=a:Ba(this,a)}; Ge.prototype.toString=function(){var a="";a=this.change===Ie?a+"* ":this.change===He?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===Ie?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};Ge.prototype.K=function(a){return a?this.oldValue:this.newValue};Ge.prototype.dA=function(a){return a?this.oldParam:this.newParam};Ge.prototype.canUndo=function(){return null!==this.model||null!==this.diagram?!0:!1}; Ge.prototype.undo=function(){this.canUndo()&&(null!==this.model?this.model.changeState(this,!0):null!==this.diagram&&this.diagram.changeState(this,!0))};Ge.prototype.canRedo=function(){return null!==this.model||null!==this.diagram?!0:!1};Ge.prototype.redo=function(){this.canRedo()&&(null!==this.model?this.model.changeState(this,!1):null!==this.diagram&&this.diagram.changeState(this,!1))}; ma.Object.defineProperties(Ge.prototype,{model:{configurable:!0,get:function(){return this.gc},set:function(a){this.gc=a}},diagram:{configurable:!0,get:function(){return this.B},set:function(a){this.B=a}},change:{configurable:!0,get:function(){return this.tn},set:function(a){F&&hb(a,Ge,Ge,"change");this.tn=a}},modelChange:{configurable:!0,get:function(){return this.vs},set:function(a){F&&A(a,"string",Ge,"modelChange");this.vs=a}},propertyName:{configurable:!0, enumerable:!0,get:function(){return this.nf},set:function(a){F&&"string"!==typeof a&&A(a,"function",Ge,"propertyName");this.nf=a}},isTransactionFinished:{configurable:!0,get:function(){return this.tn===Ie&&("CommittedTransaction"===this.nf||"FinishedUndo"===this.nf||"FinishedRedo"===this.nf)}},object:{configurable:!0,get:function(){return this.kp},set:function(a){this.kp=a}},oldValue:{configurable:!0,get:function(){return this.mp},set:function(a){this.mp= a}},oldParam:{configurable:!0,get:function(){return this.lp},set:function(a){this.lp=a}},newValue:{configurable:!0,get:function(){return this.fp},set:function(a){this.fp=a}},newParam:{configurable:!0,get:function(){return this.ep},set:function(a){this.ep=a}}});Ge.prototype.redo=Ge.prototype.redo;Ge.prototype.canRedo=Ge.prototype.canRedo;Ge.prototype.undo=Ge.prototype.undo;Ge.prototype.canUndo=Ge.prototype.canUndo;Ge.prototype.getParam=Ge.prototype.dA; Ge.prototype.getValue=Ge.prototype.K;Ge.prototype.clear=Ge.prototype.clear;var Ie=new E(Ge,"Transaction",-1),He=new E(Ge,"Property",0),Je=new E(Ge,"Insert",1),Ke=new E(Ge,"Remove",2);Ge.className="ChangedEvent";Ge.Transaction=Ie;Ge.Property=He;Ge.Insert=Je;Ge.Remove=Ke;function Le(){this.w=(new H).freeze();this.Wa="";this.l=!1} Le.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.O(c);null!==d&&(b+="\n "+d.toString())}}return b};Le.prototype.clear=function(){var a=this.changes;a.ka();for(var b=a.count-1;0<=b;b--){var c=a.O(b);null!==c&&c.clear()}a.clear();a.freeze()};Le.prototype.canUndo=function(){return this.isComplete}; Le.prototype.undo=function(){if(this.canUndo())for(var a=this.changes.count-1;0<=a;a--){var b=this.changes.O(a);null!==b&&b.undo()}};Le.prototype.canRedo=function(){return this.isComplete};Le.prototype.redo=function(){if(this.canRedo())for(var a=this.changes.count,b=0;b<a;b++){var c=this.changes.O(b);null!==c&&c.redo()}}; ma.Object.defineProperties(Le.prototype,{changes:{configurable:!0,get:function(){return this.w}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){this.Wa=a}},isComplete:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}}});Le.prototype.redo=Le.prototype.redo;Le.prototype.canRedo=Le.prototype.canRedo;Le.prototype.undo=Le.prototype.undo;Le.prototype.canUndo=Le.prototype.canUndo;Le.prototype.clear=Le.prototype.clear; Le.className="Transaction";function Me(){this.Zu=new I;this.Tc=!1;this.L=(new H).freeze();this.Pd=-1;this.w=999;this.we=!1;this.Ir=null;this.Wi=0;this.l=!1;F&&(this.l=!0);this.De=(new H).freeze();this.Nl=new H;this.Hu=!0;this.Tu=this.Ru=this.Qu=!1} Me.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.O(d);b+="]";if(void 0!==a&&0<a)for(c=this.history.count,d=0;d<c;d++)b+="\n "+this.history.O(d).toString(a-1);return b}; Me.prototype.clear=function(){var a=this.history;a.ka();for(var b=a.count-1;0<=b;b--){var c=a.O(b);null!==c&&c.clear()}a.clear();this.Pd=-1;a.freeze();this.we=!1;this.Ir=null;this.Wi=0;this.De.ka();this.De.clear();this.De.freeze();this.Nl.clear();this.Ru=this.Qu=!1};Me.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=Me.prototype;t.Nx=function(a){this.Zu.add(a)};t.zy=function(a){this.Zu.remove(a)}; t.Ba=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Hu&&(this.Hu=!1,this.Wi++,this.Db("StartingFirstTransaction",a,this.currentTransaction),0<this.Wi&&this.Wi--);this.isEnabled&&(this.De.ka(),this.De.add(a),this.De.freeze(),null===this.currentTransaction?this.Nl.add(0):this.Nl.add(this.currentTransaction.changes.count));this.Wi++;var b=1===this.transactionLevel;b&&this.Db("StartedTransaction",a,this.currentTransaction);return b}; t.$a=function(a){void 0===a&&(a="");return Ne(this,!0,a)};t.Mf=function(){return Ne(this,!1,"")}; function Ne(a,b,c){if(a.isUndoingRedoing)return!1;a.checksTransactionLevel&&1>a.transactionLevel&&Ca("Ending transaction without having started a transaction: "+c);var d=1===a.transactionLevel,e=a.currentTransaction;d&&b&&(a.Db("CommittingTransaction",c,e),null===e&&""!==c&&(e=a.currentTransaction));var f=0;if(0<a.transactionLevel&&(a.Wi--,a.isEnabled)){var g=a.De.count;0<g&&(""===c&&(c=a.De.O(0)),a.De.ka(),a.De.hb(g-1),a.De.freeze());g=a.Nl.count;0<g&&(f=a.Nl.O(g-1),a.Nl.hb(g-1))}if(d){if(b){a.Tu= !1;if(a.isEnabled&&null!==e){e.isComplete=!0;e.name=c;b=a.history;b.ka();for(d=b.count-1;d>a.historyIndex;d--)f=b.O(d),null!==f&&f.clear(),b.hb(d),a.Tu=!0;d=a.maxHistoryLength;0<=d&&(0===d?b.clear():b.count>=d&&(f=b.O(0),null!==f&&f.clear(),b.hb(0),a.Pd--));0!==d&&(b.add(e),a.Pd++);b.freeze()}a.Db("CommittedTransaction",c,e)}else{a.we=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.Db("RolledBackTransaction",c,e),a.we=!1}null!==e&&e.clear()}a.Ir=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.O(e),null!==b&&b.undo(),c.ka(),c.hb(e);c.freeze()}return!1}Me.prototype.canUndo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToUndo;return null!==a&&a.canUndo()?!0:!1}; Me.prototype.undo=function(){if(this.canUndo()){var a=this.transactionToUndo;try{this.we=!0,this.Db("StartingUndo","Undo",a),this.Pd--,a.undo()}catch(b){Ca("undo error: "+b.toString())}finally{this.Db("FinishedUndo","Undo",a),this.we=!1}}};Me.prototype.canRedo=function(){if(!this.isEnabled||0<this.transactionLevel)return!1;var a=this.transactionToRedo;return null!==a&&a.canRedo()?!0:!1}; Me.prototype.redo=function(){if(this.canRedo()){var a=this.transactionToRedo;try{this.we=!0,this.Db("StartingRedo","Redo",a),this.Pd++,a.redo()}catch(b){Ca("redo error: "+b.toString())}finally{this.Db("FinishedRedo","Redo",a),this.we=!1}}};Me.prototype.Db=function(a,b,c){void 0===c&&(c=null);var d=new Ge;d.change=Ie;d.propertyName=a;d.object=c;d.oldValue=b;for(a=this.models;a.next();)b=a.value,d.model=b,b.st(d)}; Me.prototype.Wv=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Ir=b=new Le);var c=a.copy();b=b.changes;b.ka();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Hu&&(a=a.diagram,null!==a&&!1===a.xk||Ca("Change not within a transaction: "+c.toString()))}}; Me.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}; ma.Object.defineProperties(Me.prototype,{models:{configurable:!0,get:function(){return this.Zu.iterator}},isEnabled:{configurable:!0,get:function(){return this.Tc},set:function(a){this.Tc=a}},transactionToUndo:{configurable:!0,get:function(){return 0<=this.historyIndex&&this.historyIndex<=this.history.count-1?this.history.O(this.historyIndex):null}},transactionToRedo:{configurable:!0,get:function(){return this.historyIndex<this.history.count- 1?this.history.O(this.historyIndex+1):null}},isUndoingRedoing:{configurable:!0,get:function(){return this.we}},history:{configurable:!0,get:function(){return this.L}},maxHistoryLength:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a}},historyIndex:{configurable:!0,get:function(){return this.Pd}},currentTransaction:{configurable:!0,get:function(){return this.Ir}},transactionLevel:{configurable:!0, get:function(){return this.Wi}},isInTransaction:{configurable:!0,get:function(){return 0<this.Wi}},checksTransactionLevel:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}},nestedTransactionNames:{configurable:!0,get:function(){return this.De}},isPendingClear:{configurable:!0,get:function(){return this.Qu},set:function(a){this.Qu=a}},isPendingUnmodified:{configurable:!0,get:function(){return this.Ru},set:function(a){this.Ru= a}}});Me.prototype.handleChanged=Me.prototype.Wv;Me.prototype.redo=Me.prototype.redo;Me.prototype.undo=Me.prototype.undo;Me.prototype.canUndo=Me.prototype.canUndo;Me.prototype.rollbackTransaction=Me.prototype.Mf;Me.prototype.commitTransaction=Me.prototype.$a;Me.prototype.startTransaction=Me.prototype.Ba;Me.prototype.removeModel=Me.prototype.zy;Me.prototype.addModel=Me.prototype.Nx;Me.prototype.clear=Me.prototype.clear;Me.className="UndoManager"; function Oe(){0<arguments.length&&za(Oe);fb(this);this.B=Pe;this.Wa="";this.Tc=!0;this.qd=!1;this.Xw=null;this.Yy=new we;this.pt=-1}Oe.prototype.toString=function(){return""!==this.name?this.name+" Tool":Pa(this.constructor)};Oe.prototype.updateAdornments=function(){};Oe.prototype.canStart=function(){return this.isEnabled};Oe.prototype.doStart=function(){};Oe.prototype.doActivate=function(){this.isActive=!0};Oe.prototype.doDeactivate=function(){this.isActive=!1};Oe.prototype.doStop=function(){}; Oe.prototype.doCancel=function(){this.transactionResult=null;this.stopTool()};Oe.prototype.stopTool=function(){var a=this.diagram;a.currentTool===this&&(a.currentTool=null,a.currentCursor="")};Oe.prototype.doMouseDown=function(){!this.isActive&&this.canStart()&&this.doActivate()};Oe.prototype.doMouseMove=function(){};Oe.prototype.doMouseUp=function(){this.stopTool()};Oe.prototype.doMouseWheel=function(){};Oe.prototype.canStartMultiTouch=function(){return!0}; Oe.prototype.standardPinchZoomStart=function(){var a=this.diagram,b=a.lastInput,c=b.Eq(0,J.allocAt(NaN,NaN)),d=b.Eq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.Am("hasGestureZoom"))){a.Pl=a.scale;var e=d.x-c.x,f=d.y-c.y;a.kv=Math.sqrt(e*e+f*f);b.bubbles=!1}J.free(c);J.free(d)}; Oe.prototype.standardPinchZoomMove=function(){var a=this.diagram,b=a.lastInput,c=b.Eq(0,J.allocAt(NaN,NaN)),d=b.Eq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.Am("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.kv;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.Pl;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)}; Oe.prototype.doKeyDown=function(){"Esc"===this.diagram.lastInput.key&&this.doCancel()};Oe.prototype.doKeyUp=function(){};Oe.prototype.Ba=function(a){void 0===a&&(a=this.name);this.transactionResult=null;return this.diagram.Ba(a)};Oe.prototype.Qg=function(){var a=this.diagram;return null===this.transactionResult?a.Mf():a.$a(this.transactionResult)}; Oe.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.xm(b.documentPoint,!1);if(null!==c)if(db?b.meta:b.control){a.U("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!b.isSelected);a.U("ChangedSelection",a.selection)}else if(b.shift){if(!c.isSelected){a.U("ChangingSelection",a.selection);for(b=c;null!==b&&!b.canSelect();)b=b.containingGroup;null!==b&&(b.isSelected=!0);a.U("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||(db?b.meta:b.control)||b.shift||a.clearSelection()}};Oe.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.$b(d.documentPoint,a,b);d.targetObject=a;Qe(a,d,c);return d.handled}; function Qe(a,b,c){b.handled=!1;if(null===a||a.Ng()){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.U(e,a)}else{switch(d){case 1:e="BackgroundSingleClicked";break;case 2:e="BackgroundDoubleClicked";break;case 3:e="BackgroundContextClicked"}0!==d&&c.U(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)}}} Oe.prototype.standardMouseOver=function(){var a=this.diagram,b=a.lastInput;if(!0!==a.animationManager.wc){var c=a.skipsUndoManager;a.skipsUndoManager=!0;var d=a.viewportBounds.fa(b.documentPoint)?a.$b(b.documentPoint,null,null):null;b.targetObject=d;var e=!1;if(d!==a.yj){var f=a.yj,g=f;a.yj=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.Mg(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.Mg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.yj}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.Vb();a.skipsUndoManager=c}};Oe.prototype.doCurrentObjectChanged=function(){}; Oe.prototype.standardMouseWheel=function(){var a=this.diagram,b=a.lastInput,c=b.delta;if(0!==c&&a.documentBounds.o()){var d=a.commandHandler,e=a.toolManager.mouseWheelBehavior;if(null!==d&&(e===Re&&!b.shift||e===Se&&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===Re&&b.shift||e===Se&&!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($a||bb||cb)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.A(d)||(b.bubbles=!1)}}};Oe.prototype.standardWaitAfter=function(a,b){F&&A(a,"number",Oe,"standardWaitAfter:delay");void 0===b&&(b=this.diagram.lastInput);this.cancelWaitAfter();var c=this,d=b.clone(this.Yy);this.pt=ta(function(){c.doWaitAfter(d)},a)}; Oe.prototype.cancelWaitAfter=function(){-1!==this.pt&&qa.clearTimeout(this.pt);this.pt=-1};Oe.prototype.doWaitAfter=function(){};Oe.prototype.findToolHandleAt=function(a,b){a=this.diagram.$b(a,function(a){for(;null!==a&&!(a.panel instanceof Te);)a=a.panel;return a});return null===a?null:a.part.category===b?a:null}; Oe.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}; ma.Object.defineProperties(Oe.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){a instanceof P&&(this.B=a)}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){A(a,"string",Oe,"name");this.Wa=a}},isEnabled:{configurable:!0,get:function(){return this.Tc},set:function(a){A(a,"boolean",Oe,"isEnabled");this.Tc=a}},isActive:{configurable:!0,get:function(){return this.qd},set:function(a){A(a,"boolean", Oe,"isActive");this.qd=a}},transactionResult:{configurable:!0,get:function(){return this.Xw},set:function(a){null!==a&&A(a,"string",Oe,"transactionResult");this.Xw=a}}});Oe.prototype.stopTransaction=Oe.prototype.Qg;Oe.prototype.startTransaction=Oe.prototype.Ba;Oe.className="Tool";function Ua(){Oe.call(this);this.name="ToolManager";this.Oc=new H;this.Pc=new H;this.Pf=new H;this.$=this.Ma=850;this.w=(new Hb(2,2)).ia();this.ib=5E3;this.Na=Se;this.L=Ue;this.Hr=this.l=null;this.bk=-1} la(Ua,Oe);Ua.prototype.initializeStandardTools=function(){};Ua.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Te&&this.Hr===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===Ze&&(b.bubbles=!1);if(b.isMultiTouch){this.cancelWaitAfter();if(this.gestureBehavior===$e){b.bubbles=!0;return}if(this.gestureBehavior===Ze)return;if(a.currentTool.canStartMultiTouch()){a.currentTool.standardPinchZoomStart();return}}var c=a.undoManager;F&&c.checksTransactionLevel&&0!==c.transactionLevel&&Ca("WARNING: In ToolManager.doMouseDown: UndoManager.transactionLevel is not zero");c=this.mouseDownTools.length; for(var d=0;d<c;d++){var e=this.mouseDownTools.O(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===Se?this.mouseWheelBehavior=Re:this.mouseWheelBehavior===Re&&(this.mouseWheelBehavior=Se));this.doActivate();this.standardWaitAfter(this.holdDelay,b)}; Ua.prototype.doMouseMove=function(){var a=this.diagram,b=a.lastInput;if(b.isMultiTouch){if(this.gestureBehavior===$e){b.bubbles=!0;return}if(this.gestureBehavior===Ze)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.O(d);e.diagram=this.diagram;if(e.canStart()){a.doFocus();a.currentTool=e;a.currentTool===e&&(e.isActive||e.doActivate(),e.doMouseMove());return}}af(this, a);a=b.event;null===a||"mousemove"!==a.type&&"pointermove"!==a.type&&a.cancelable||(b.bubbles=!0)};function af(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 Te&&(b===a||b.Mg(a))||this.hideToolTip()}; Ua.prototype.doWaitAfter=function(a){var b=this.diagram;b.ya&&(this.doMouseHover(),this.isActive||this.doToolTip(),a.isTouchEvent&&!b.lastInput.handled&&(a=a.copy(),a.button=2,a.buttons=2,b.lastInput=a,b.ak=!0,b.doMouseUp()))}; Ua.prototype.doMouseHover=function(){var a=this.diagram,b=a.lastInput;null===b.targetObject&&(b.targetObject=a.$b(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.$b(b.documentPoint,null,null));b=b.targetObject;if(null!==b){if(a=this.currentToolTip,!(a instanceof Te)||b!==a&&!b.Mg(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){!F||a instanceof Te||a instanceof bf||v("showToolTip:tooltip must be an Adornment or HTMLInfo.");null!==b&&w(b,N,Ua,"showToolTip:obj");var c=this.diagram;a!==this.currentToolTip&&this.hideToolTip();if(a instanceof Te){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.Eb();this.positionToolTip(a, b)}else a instanceof bf&&a!==this.currentToolTip&&a.show(b,c,this);this.currentToolTip=a;-1!==this.bk&&(qa.clearTimeout(this.bk),this.bk=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.bk=ta(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.bk&&(qa.clearTimeout(this.bk),this.bk=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof Te?(a.remove(b),null!==this.Hr&&this.Hr.Lf(b.category),b.data=null,b.adornedObject=null):b instanceof bf&&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.O(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.O(c);if(d.name===a)return d}b=this.mouseMoveTools.length;for(c=0;c<b;c++)if(d=this.mouseMoveTools.O(c),d.name===a)return d;b=this.mouseUpTools.length;for(c=0;c<b;c++)if(d=this.mouseUpTools.O(c),d.name===a)return d;return null}; Ua.prototype.replaceTool=function(a,b){A(a,"string",Ua,"replaceTool:name");null!==b&&(w(b,Oe,Ua,"replaceTool:newtool"),b.diagram=this.diagram);for(var c=this.mouseDownTools.length,d=0;d<c;d++){var e=this.mouseDownTools.O(d);if(e.name===a)return null!==b?this.mouseDownTools.od(d,b):this.mouseDownTools.hb(d),e}c=this.mouseMoveTools.length;for(d=0;d<c;d++)if(e=this.mouseMoveTools.O(d),e.name===a)return null!==b?this.mouseMoveTools.od(d,b):this.mouseMoveTools.hb(d),e;c=this.mouseUpTools.length;for(d= 0;d<c;d++)if(e=this.mouseUpTools.O(d),e.name===a)return null!==b?this.mouseUpTools.od(d,b):this.mouseUpTools.hb(d),e;return null};Ua.prototype.bb=function(a,b,c){A(a,"string",Ua,"replaceStandardTool:name");w(c,H,Ua,"replaceStandardTool:list");null!==b&&(w(b,Oe,Ua,"replaceStandardTool:newtool"),b.name=a,b.diagram=this.diagram);this.findTool(a)?this.replaceTool(a,b):null!==b&&c.add(b)}; ma.Object.defineProperties(Ua.prototype,{mouseWheelBehavior:{configurable:!0,get:function(){return this.Na},set:function(a){hb(a,Ua,Ua,"mouseWheelBehavior");this.Na=a}},gestureBehavior:{configurable:!0,get:function(){return this.L},set:function(a){hb(a,Ua,Ua,"gestureBehavior");this.L=a}},currentToolTip:{configurable:!0,get:function(){return this.l},set:function(a){!F||null===a||a instanceof Te||a instanceof bf||v("ToolManager.currentToolTip must be an Adornment or HTMLInfo."); this.l=a;this.Hr=null!==a&&a instanceof Te?a.adornedPart:null}},mouseDownTools:{configurable:!0,get:function(){return this.Oc}},mouseMoveTools:{configurable:!0,get:function(){return this.Pc}},mouseUpTools:{configurable:!0,get:function(){return this.Pf}},hoverDelay:{configurable:!0,get:function(){return this.Ma},set:function(a){A(a,"number",Ua,"hoverDelay");this.Ma=a}},holdDelay:{configurable:!0,get:function(){return this.$},set:function(a){A(a, "number",Ua,"holdDelay");this.$=a}},dragSize:{configurable:!0,get:function(){return this.w},set:function(a){w(a,Hb,Ua,"dragSize");this.w=a.J()}},toolTipDuration:{configurable:!0,get:function(){return this.ib},set:function(a){A(a,"number",Ua,"toolTipDuration");this.ib=a}}});Ua.prototype.replaceStandardTool=Ua.prototype.bb; var Se=new E(Ua,"WheelScroll",0),Re=new E(Ua,"WheelZoom",1),cf=new E(Ua,"WheelNone",2),Ue=new E(Ua,"GestureZoom",3),Ze=new E(Ua,"GestureCancel",4),$e=new E(Ua,"GestureNone",5);Ua.className="ToolManager";Ua.WheelScroll=Se;Ua.WheelZoom=Re;Ua.WheelNone=cf;Ua.GestureZoom=Ue;Ua.GestureCancel=Ze;Ua.GestureNone=$e; function df(){Oe.call(this);0<arguments.length&&za(df);this.name="Dragging";this.L=this.Pc=!0;this.w=this.ib=this.Ma=this.xg=null;this.Qn=this.Pf=!1;this.cm=new J(NaN,NaN);this.dt=new J;this.Oc=!0;this.hl=100;this.bh=[];this.ir=(new I).freeze();this.Na=new ef;this.Ao=null;this.$="copy";this.Yh="";this.Zh="no-drop"}la(df,Oe); df.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.hl)?!1:null!==this.findDraggablePart()}; df.prototype.findDraggablePart=function(){var a=this.diagram;a=a.xm(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}; df.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.xm(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.U("ChangingSelection",a.selection),b=a.lastInput,(db?b.meta:b.control)||b.shift||a.clearSelection(!0),this.currentPart.isSelected=!0,a.U("ChangedSelection",a.selection))}}}; df.prototype.doActivate=function(){var a=this.diagram;this.Ao=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(ff=null,this.isActive=!0,this.cm.set(a.position),gf(this,a.selection),this.bh.length=0,this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.fu=!0,!0===a.Qe("temporaryPixelRatio")&&30<a.Qx&&hf(a),jf(a,this.draggedParts),this.Ba("Drag"),this.startPoint=a.firstInput.documentPoint,a.isMouseCaptured= !0,a.allowDragOut&&(this.isDragOutStarted=!0,this.Qn=!1,ff=this,kf=this.diagram,this.doSimulatedDragOut()))};function gf(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.wk()&&1===b.count&&b.first()instanceof R?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.jk(),a.xg=c.toolManager.findTool("Relinking"),null===a.xg&&(a.xg=new lf,a.xg.diagram=c)):(a.draggedLink=null,a.xg=null))}} df.prototype.computeEffectiveCollection=function(a,b){return this.diagram.commandHandler.computeEffectiveCollection(a,b)};df.prototype.zd=function(a){return void 0===a?new mf(Rb):this.isGridSnapEnabled?new mf(new J(Math.round(a.x),Math.round(a.y))):new mf(a.copy())}; df.prototype.doDeactivate=function(){this.isActive=!1;var a=this.diagram;a.Nf();nf(this);sf(a,this.draggedParts);this.draggedParts=this.currentPart=this.Ao=null;this.Qn=this.isDragOutStarted=!1;if(0<tf.count){for(var b=tf,c=b.length,d=0;d<c;d++){var e=b.O(d);uf(e);vf(e);nf(e);e.diagram.Nf()}b.clear()}uf(this);this.cm.h(NaN,NaN);ff=kf=null;vf(this);a.isMouseCaptured=!1;a.currentCursor="";a.fu=!1;this.Qg();wf(a,!0)}; function nf(a){var b=a.diagram,c=b.skipsUndoManager;b.skipsUndoManager=!0;xf(a,b.lastInput,null);b.skipsUndoManager=c;a.bh.length=0}function yf(){var a=ff;vf(a);zf(a);var b=a.diagram;a.cm.o()&&(b.position=a.cm);b.Nf()}df.prototype.doCancel=function(){vf(this);zf(this);var a=this.diagram;this.cm.o()&&(a.position=this.cm);this.stopTool()};df.prototype.doKeyDown=function(){this.isActive&&("Esc"===this.diagram.lastInput.key?this.doCancel():this.doMouseMove())}; df.prototype.doKeyUp=function(){this.isActive&&this.doMouseMove()};function Af(a,b){var c=Infinity,d=Infinity,e=-Infinity,f=-Infinity;for(a=a.iterator;a.next();){var g=a.value;if(g.bc()&&g.isVisible()){var h=g.location;g=h.x;h=h.y;isNaN(g)||isNaN(h)||(g<c&&(c=g),h<d&&(d=h),g>e&&(e=g),h>f&&(f=h))}}Infinity===c?b.h(0,0,0,0):b.h(c,d,e-c,f-d)} function Bf(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.Mf(),c.Ba("Drag")):zf(a);c.skipsUndoManager=!b;c.partManager.addsToTemporaryLayer=!b;a.startPoint=c.firstInput.documentPoint;b=a.copiesEffectiveCollection?a.draggedParts.Of():c.selection;c=c.pk(b,c,!0);for(b=c.iterator;b.next();)b.value.location= b.key.location;b=L.alloc();Af(c,b);L.free(b);b=new Db;for(d=a.draggedParts.iterator;d.next();){var e=d.key;e.bc()&&e.canCopy()&&(e=c.K(e),null!==e&&(e.Eb(),b.add(e,a.zd(e.location))))}for(c=c.iterator;c.next();)d=c.value,d instanceof R&&d.canCopy()&&b.add(d,a.zd());a.copiedParts=b;gf(a,b.Of());null!==a.draggedLink&&(c=a.draggedLink,b=c.routeBounds,Cf(c,a.startPoint.x-(b.x+b.width/2),a.startPoint.y-(b.y+b.height/2)))}}} function vf(a){var b=a.diagram;if(null!==a.copiedParts&&(b.$t(a.copiedParts.Of(),!1),a.copiedParts=null,null!==a.draggedParts))for(var c=a.draggedParts.iterator;c.next();)c.key instanceof R&&(c.value.point=new J(0,0));b.skipsUndoManager=!1;b.partManager.addsToTemporaryLayer=!1;a.startPoint=b.firstInput.documentPoint} function uf(a){if(null!==a.draggedLink){if(a.dragsLink&&null!==a.xg){var b=a.xg;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.xg=null}}function Df(a,b,c){var d=a.diagram,e=a.startPoint,f=J.alloc();f.assign(d.lastInput.documentPoint);a.moveParts(b,f.ie(e),c);J.free(f);!0===d.Qe("temporaryPixelRatio")&&null===d.Ch&&30<d.Qx&&(hf(d),d.Yt())}df.prototype.moveParts=function(a,b,c){var d=this.diagram;null!==d&&Ef(d,a,b,this.dragOptions,c)}; function zf(a){if(null!==a.draggedParts){for(var b=a.diagram,c=a.draggedParts.iterator;c.next();){var d=c.key;d.bc()&&(d.location=c.value.point)}for(c=a.draggedParts.iterator;c.next();)if(d=c.key,d instanceof R&&d.suspendsRouting){var e=c.value.point;a.draggedParts.add(d,a.zd());Cf(d,-e.x,-e.y)}b.dd()}} function Ff(a,b){var c=a.diagram;a.dragsLink&&(null!==a.draggedLink&&(a.draggedLink.fromNode=null,a.draggedLink.toNode=null),Gf(a,!1));var d=a.findDragOverObject(b),e=c.lastInput;e.targetObject=d;a.doUpdateCursor(d);var f=c.skipsUndoManager,g=!1;try{c.skipsUndoManager=!0;g=xf(a,e,d);if(!a.isActive&&null===ff)return;var h=null!==d?d.part:null;if(null===h||c.handlesDragDropForTopLevelParts&&h.isTopLevel&&!(h instanceof Hf)){var k=c.mouseDragOver;null!==k&&(k(e),g=!0)}if(!a.isActive&&null===ff)return; a.doDragOver(b,d);if(!a.isActive&&null===ff)return}finally{c.skipsUndoManager=f,g&&c.dd()}a.Ao=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.xt(e.viewPoint)}df.prototype.findDragOverObject=function(a){var b=this;return If(this.diagram,a,null,function(a){null===a?a=!0:(a=a.part,a=null===a||a instanceof Te||a.layer.isTemporary||b.draggedParts&&b.draggedParts.contains(a)||b.copiedParts&&b.copiedParts.contains(a)?!0:!1);return!a})}; df.prototype.doUpdateCursor=function(a){var b=this.diagram;this.Ao!==a&&(!this.diagram.currentTool.isActive||this.mayCopy()?b.currentCursor=this.copyCursor:this.mayMove()?b.currentCursor=this.moveCursor:this.mayDragOut()&&(b.currentCursor=this.nodropCursor))}; function xf(a,b,c){var d=!1,e=a.bh.length,f=0<e?a.bh[0]:null;if(c===f)return!1;b.handled=!1;for(var g=0;g<e;g++){var h=a.bh[g],k=h.mouseDragLeave;if(null!==k&&(k(b,h,c),d=!0,b.handled))break}a.bh.length=0;if(!a.isActive&&null===ff||null===c)return d;b.handled=!1;for(e=c;null!==e;)a.bh.push(e),e=Jf(e);e=a.bh.length;for(c=0;c<e&&(g=a.bh[c],h=g.mouseDragEnter,null===h||(h(b,g,f),d=!0,!b.handled));c++);return d} function Jf(a){var b=a.panel;return null!==b?b:a instanceof S&&!(a instanceof Hf)&&(a=a.containingGroup,null!==a&&a.handlesDragDropForMembers)?a:null}function Kf(a,b,c){var d=a.xg;if(null===d)return null;var e=a.diagram.Jg(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.ma(Mc,a);k=b.Pe(k);k<f&&(g=h,f=k)}}J.free(a);return g} function Gf(a,b){var c=a.draggedLink;if(null!==c&&!(2>c.pointsCount)){var d=a.diagram;if(!d.isReadOnly){var e=a.xg;if(null!==e){var f=null,g=null;null===c.fromNode&&(f=Kf(a,c.i(0),!1),null!==f&&(g=f.part));var h=null,k=null;null===c.toNode&&(h=Kf(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.uy&&d.U("LinkRelinked",c,d.uy),c.toPort!==d.vy&&d.U("LinkRelinked",c,d.vy)):Lf(e,g,f,k,h):Lf(e,null,null,null,null)}}}}df.prototype.doDragOver=function(){}; function Rf(a,b){var c=a.diagram;a.dragsLink&&Gf(a,!0);nf(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;Sf(a,e,f);f=Jf(f)}}else f=c.mouseDrop,null!==f&&f(e);if(a.isActive||null!==ff){for(e=(a.copiedParts||a.draggedParts).iterator;e.next();)f=e.key,f instanceof T&&f.linksConnected.each(function(a){a.suspendsRouting=!1});a.doDropOnto(b,d);if(a.isActive||null!==ff){a=L.alloc();for(b= c.selection.iterator;b.next();)d=b.value,d instanceof T&&Tf(c,d,a);L.free(a)}}}function Sf(a,b,c){a=a.diagram;c=c.part;!a.handlesDragDropForTopLevelParts||!c.isTopLevel||c instanceof Hf||(c=a.mouseDrop,null!==c&&c(b))}function Tf(a,b,c){var d=!1;b.getAvoidableRect(c);a.viewportBounds.Oe(c)&&(d=!0);a=a.Ov(c,function(a){return a.part},function(a){return a instanceof R},!0,function(a){return a instanceof R},d);if(0!==a.count)for(a=a.iterator;a.next();)c=a.value,!c.ee(b)&&c.isAvoiding&&c.Ya()} df.prototype.doDropOnto=function(){};df.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()?(Bf(this,!1),jf(a,this.copiedParts),Df(this,this.copiedParts,!1),sf(a,this.copiedParts)):this.mayMove()?(vf(this),Df(this,this.draggedParts,!0)):this.mayDragOut()?(Bf(this,!1),Df(this,this.copiedParts,!1)):vf(this),Ff(this,a.lastInput.documentPoint))}}; df.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?(vf(this),Bf(this,!0),jf(a,this.copiedParts),Df(this,this.copiedParts,!1),sf(a,this.copiedParts),null!==this.copiedParts&&(a.U("ChangingSelection",a.selection),a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}))):(b=!0,vf(this),this.mayMove()&&(Df(this,this.draggedParts, !0),Ff(this,a.lastInput.documentPoint)));this.Qn=!0;Rf(this,a.lastInput.documentPoint);if(this.isActive){var d=c?this.copiedParts.Of():this.draggedParts.Of();this.copiedParts=null;b&&Uf(this);a.Ta();sf(a,this.draggedParts);this.transactionResult=c?"Copy":"Move";a.U(c?"SelectionCopied":"SelectionMoved",d)}this.stopTool();c&&a.U("ChangedSelection",a.selection)}}}; df.prototype.simulatedMouseMove=function(a,b,c){if(null===ff)return!1;var d=ff.diagram;c instanceof P||(c=null);var e=kf;c!==e&&(null!==e&&e!==d&&(e.Nf(),ff.isDragOutStarted=!1,e=e.toolManager.findTool("Dragging"),null!==e&&e.doSimulatedDragLeave()),kf=c,null!==c&&c!==d&&(yf(),e=c.toolManager.findTool("Dragging"),null!==e&&(tf.contains(e)||tf.add(e),e.doSimulatedDragEnter())));if(null===c||c===d||!c.allowDrop||c.isReadOnly||!c.allowInsert)return!1;d=c.toolManager.findTool("Dragging");null!==d&&(null!== a&&(void 0!==a.targetTouches&&(0<a.targetTouches.length?a=a.targetTouches[0]:0<a.changedTouches.length&&(a=a.changedTouches[0])),b=c.getMouse(a)),c.lastInput.documentPoint=b,c.lastInput.viewPoint=c.dr(b),c.lastInput.down=!1,c.lastInput.up=!1,d.doSimulatedDragOver());return!0}; df.prototype.simulatedMouseUp=function(a,b,c){if(null===ff)return!1;var d=kf,e=ff.diagram;if(null===c)return ff.doCancel(),!0;if(c!==d){var f=d.toolManager.findTool("Dragging");if(null!==d&&d!==e&&null!==f)return d.Nf(),ff.isDragOutStarted=!1,f.doSimulatedDragLeave(),!1;kf=c;d=c.toolManager.findTool("Dragging");null!==d&&(yf(),tf.contains(d)||tf.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.dr(b),c.lastInput.down=!1,c.lastInput.up=!0,a=c.toolManager.findTool("Dragging"),null!==a&&a.doSimulatedDrop(),a=ff,null!==a&&(c=a.mayCopy(),a.transactionResult=c?"Copy":"Move",a.stopTool()),!0):!1}; function Uf(a){if(null!==a.draggedParts)for(var b=a.draggedParts.iterator;b.next();){var c=b.key;c instanceof T&&(c=c.containingGroup,null===c||null===c.placeholder||a.draggedParts.contains(c)||c.placeholder.u())}} df.prototype.mayCopy=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowCopy||(db?!a.lastInput.alt:!a.lastInput.control))return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1}; df.prototype.mayDragOut=function(){if(!this.isCopyEnabled)return!1;var a=this.diagram;if(!a.allowDragOut||!a.allowCopy||a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canCopy())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canCopy()?!0:!1}; df.prototype.mayMove=function(){var a=this.diagram;if(a.isReadOnly||!a.allowMove)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canMove())return!0}return null!==this.draggedLink&&this.dragsLink&&this.draggedLink.canMove()?!0:!1};df.prototype.computeBorder=function(a,b,c){return this.Qn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};df.prototype.Zz=function(){return ff}; df.prototype.mayDragIn=function(){var a=this.diagram;if(!a.allowDrop||a.isReadOnly||a.isModelReadOnly||!a.allowInsert)return!1;var b=ff;return null===b||b.diagram.model.dataFormat!==a.model.dataFormat?!1:!0};df.prototype.doSimulatedDragEnter=function(){if(this.mayDragIn()){var a=this.diagram;a.animationManager.ed();Vf(a);a.animationManager.ed();var b=ff;null!==b&&(b.diagram.fu=!1);this.doUpdateCursor(a.grid)}}; df.prototype.doSimulatedDragLeave=function(){var a=ff;null!==a&&a.doSimulatedDragOut();this.doCancel()};df.prototype.doSimulatedDragOver=function(){var a=this.diagram;a.animationManager.rn=!0;var b=ff;if(null!==b&&null!==b.draggedParts){if(!this.mayDragIn())return;Wf(this,b.draggedParts.Of(),!1,a.firstInput);Df(this,this.copiedParts,!1);Ff(this,a.lastInput.documentPoint)}a.animationManager.rn=!1}; df.prototype.doSimulatedDrop=function(){var a=this.diagram,b=ff;if(null!==b){var c=b.diagram;b.Qn=!0;vf(this);if(!this.mayDragIn())return;a.animationManager.rn=!0;a.U("ChangingSelection",a.selection);this.Ba("Drop");Wf(this,b.draggedParts.Of(),!0,a.lastInput);Df(this,this.copiedParts,!1);null!==this.copiedParts&&(a.clearSelection(!0),this.copiedParts.iteratorKeys.each(function(a){a.isSelected=!0}));Rf(this,a.lastInput.documentPoint);a.Ta();b=a.selection;null!==this.copiedParts?this.transactionResult= "ExternalCopy":b=new I;this.copiedParts=null;a.doFocus();a.U("ExternalObjectsDropped",b,c);this.Qg();a.U("ChangedSelection",a.selection)}a.animationManager.rn=!1}; function Wf(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.pk(b,e,!0);var f=L.alloc();Af(b,f);d=f.x+f.width/2;e=f.y+f.height/2;L.free(f);f=a.dt;var g=new Db,h=J.alloc();for(b=b.iterator;b.next();){var k=b.value,l=c.K(k);k.bc()&&k.canCopy()?(k=k.location,h.h(f.x-(d-k.x),f.y-(e-k.y)),l.location=h,l.Eb(),g.add(l,a.zd(h))):l instanceof R&&k.canCopy()&&(Cf(l,f.x-d,f.y-e), g.add(l,a.zd()))}J.free(h);a.copiedParts=g;gf(a,g.Of());null!==a.draggedLink&&(c=a.draggedLink,d=c.routeBounds,Cf(c,a.startPoint.x-(d.x+d.width/2),a.startPoint.y-(d.y+d.height/2)))}}}df.prototype.doSimulatedDragOut=function(){var a=this.diagram;a.fu=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.Ao=null};df.prototype.computeMove=function(a,b,c,d){c=this.diagram;return null!==c?c.computeMove(a,b,this.dragOptions,d):new J}; ma.Object.defineProperties(df.prototype,{isCopyEnabled:{configurable:!0,get:function(){return this.Pc},set:function(a){A(a,"boolean",df,"isCopyEnabled");this.Pc=a}},copiesEffectiveCollection:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"boolean",df,"copiesEffectiveCollection");this.L=a}},dragOptions:{configurable:!0,get:function(){return this.Na},set:function(a){w(a,ef,df,"dragOptions");this.Na=a}},isGridSnapEnabled:{configurable:!0, enumerable:!0,get:function(){return this.dragOptions.isGridSnapEnabled},set:function(a){A(a,"boolean",df,"isGridSnapEnabled");this.dragOptions.isGridSnapEnabled=a}},isComplexRoutingRealtime:{configurable:!0,get:function(){return this.Oc},set:function(a){A(a,"boolean",df,"isComplexRoutingRealtime");this.Oc=a}},isGridSnapRealtime:{configurable:!0,get:function(){return this.dragOptions.isGridSnapRealtime},set:function(a){A(a,"boolean",df,"isGridSnapRealtime");this.dragOptions.isGridSnapRealtime= a}},gridSnapCellSize:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSize},set:function(a){w(a,Hb,df,"gridSnapCellSize");this.dragOptions.gridSnapCellSize.A(a)||(a=a.J(),this.dragOptions.gridSnapCellSize=a)}},gridSnapCellSpot:{configurable:!0,get:function(){return this.dragOptions.gridSnapCellSpot},set:function(a){w(a,M,df,"gridSnapCellSpot");this.dragOptions.gridSnapCellSpot.A(a)||(a=a.J(),this.dragOptions.gridSnapCellSpot=a)}},gridSnapOrigin:{configurable:!0, enumerable:!0,get:function(){return this.dragOptions.gridSnapOrigin},set:function(a){w(a,J,df,"gridSnapOrigin");this.dragOptions.gridSnapOrigin.A(a)||(a=a.J(),this.dragOptions.gridSnapOrigin=a)}},dragsLink:{configurable:!0,get:function(){return this.dragOptions.dragsLink},set:function(a){A(a,"boolean",df,"dragsLink");this.dragOptions.dragsLink=a}},dragsTree:{configurable:!0,get:function(){return this.dragOptions.dragsTree},set:function(a){A(a,"boolean",df,"dragsTree"); this.dragOptions.dragsTree=a}},copyCursor:{configurable:!0,get:function(){return this.$},set:function(a){this.$=a}},moveCursor:{configurable:!0,get:function(){return this.Yh},set:function(a){this.Yh=a}},nodropCursor:{configurable:!0,get:function(){return this.Zh},set:function(a){this.Zh=a}},currentPart:{configurable:!0,get:function(){return this.Ma},set:function(a){null!==a&&w(a,S,df,"currentPart");this.Ma=a}},copiedParts:{configurable:!0, get:function(){return this.w},set:function(a){this.w=a}},draggedParts:{configurable:!0,get:function(){return this.ib},set:function(a){this.ib=a}},draggingParts:{configurable:!0,get:function(){return null!==this.copiedParts?this.copiedParts.Of():null!==this.draggedParts?this.draggedParts.Of():this.ir}},draggedLink:{configurable:!0,get:function(){return this.diagram.draggedLink},set:function(a){null!==a&&w(a,R,df,"draggedLink");this.diagram.draggedLink=a}}, isDragOutStarted:{configurable:!0,get:function(){return this.Pf},set:function(a){this.Pf=a}},startPoint:{configurable:!0,get:function(){return this.dt},set:function(a){w(a,J,df,"startPoint");this.dt.A(a)||this.dt.assign(a)}},delay:{configurable:!0,get:function(){return this.hl},set:function(a){A(a,"number",df,"delay");this.hl=a}}});df.prototype.getDraggingSource=df.prototype.Zz;var tf=null,ff=null,kf=null;df.className="DraggingTool";tf=new H; Sa("draggingTool",function(){return this.findTool("Dragging")},function(a){this.bb("Dragging",a,this.mouseMoveTools)});Ua.prototype.doCancel=function(){null!==ff&&ff.doCancel();Oe.prototype.doCancel.call(this)}; function Xf(){0<arguments.length&&za(Xf);Oe.call(this);this.Zh=100;this.Na=!1;this.ri="pointer";var a=new R,b=new Yf;b.isPanelMain=!0;b.stroke="blue";a.add(b);b=new Yf;b.toArrow="Standard";b.fill="blue";b.stroke="blue";a.add(b);a.layerName="Tool";this.Vw=a;a=new T;b=new Yf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke="magenta";b.strokeWidth=2;b.desiredSize=Xb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Uw=a;this.l=b;a=new T;b=new Yf;b.portId="";b.figure="Rectangle";b.fill=null;b.stroke= "magenta";b.strokeWidth=2;b.desiredSize=Xb;a.add(b);a.selectable=!1;a.layerName="Tool";this.Ww=a;this.w=b;this.Yh=this.Pf=this.Oc=this.ib=this.Pc=null;this.Ma=!0;this.Py=new Db;this.ir=this.Ii=this.Tw=null}la(Xf,Oe);Xf.prototype.doStop=function(){this.diagram.Nf();this.originalToPort=this.originalToNode=this.originalFromPort=this.originalFromNode=this.originalLink=null;this.validPortsCache.clear();this.targetPort=null}; Xf.prototype.copyPortProperties=function(a,b,c,d,e){if(null!==a&&null!==b&&null!==c&&null!==d){var f=b.Gf(),g=Hb.alloc();g.width=b.naturalBounds.width*f;g.height=b.naturalBounds.height*f;d.desiredSize=g;Hb.free(g);e?(d.toSpot=b.toSpot,d.toEndSegmentLength=b.toEndSegmentLength):(d.fromSpot=b.fromSpot,d.fromEndSegmentLength=b.fromEndSegmentLength);c.locationSpot=Mc;f=J.alloc();c.location=b.ma(Mc,f);J.free(f);d.angle=b.hj();null!==this.portTargeted&&this.portTargeted(a,b,c,d,e)}}; Xf.prototype.setNoTargetPortProperties=function(a,b,c){null!==b&&(b.desiredSize=Xb,b.fromSpot=Gc,b.toSpot=Gc);null!==a&&(a.location=this.diagram.lastInput.documentPoint);null!==this.portTargeted&&this.portTargeted(null,null,a,b,c)};Xf.prototype.doMouseDown=function(){this.isActive&&this.doMouseMove()}; Xf.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort&&this.targetPort.part instanceof T){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.xt(a.lastInput.viewPoint)}};Xf.prototype.findValidLinkablePort=function(a,b){if(null===a)return null;var c=a.part;if(!(c instanceof T))return null;for(;null!==a;){var d=b?a.toLinkable:a.fromLinkable;if(!0===d&&(null!==a.portId||a instanceof T)&&(b?this.isValidTo(c,a):this.isValidFrom(c,a)))return a;if(!1===d)break;a=a.panel}return null}; Xf.prototype.findTargetPort=function(a){var b=this.diagram,c=b.lastInput.documentPoint,d=this.portGravity;0>=d&&(d=.1);var e=this,f=b.Jg(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 T){var k=g.ma(Mc,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 T&&(null===c.layer||c.layer.allowLink))?b:null}; Xf.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.Bq(b).count>=c)return!1}return!0}; Xf.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.Dd(b).count>=c)return!1}return!0}; Xf.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};Xf.prototype.isLinked=function(a,b){if(null===a||null===b)return!1;var c=a.part;if(!(c instanceof T))return!1;a=a.portId;null===a&&(a="");var d=b.part;if(!(d instanceof T))return!1;b=b.portId;null===b&&(b="");for(b=d.Dd(b);b.next();)if(d=b.value,d.fromNode===c&&d.fromPortId===a)return!0;return!1}; Xf.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};Xf.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 Zf(this,c,b,d)}; function Zf(a,b,c,d){if(b===c)return!0;var e=b.fromNode;if(null!==e&&e.isLinkLabel&&(d.add(e),Zf(a,e.labeledLink,c,d)))return!0;b=b.toNode;return null!==b&&b.isLinkLabel&&(d.add(b),Zf(a,b.labeledLink,c,d))?!0:!1} Xf.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!==$f){if(d===ag){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!bg(this,a,b,c,!0)}if(d===cg){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!bg(this,a,b,c,!0)}if(d===dg)return a===b?a=!0:(d=new I,d.add(b),a=eg(this,d,a,b,c)),!a;if(d===fg)return!bg(this,a,b,c,!1);if(d===gg)return a===b?a=!0:(d=new I,d.add(b),a=hg(this,d,a,b,c)),!a}return!0};function bg(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&&bg(a,g,c,d,e)))return!0}return!1} function eg(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&&eg(a,b,g,d,e)))return!0}return!1}function hg(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&&hg(a,b,h,d,e))return!0}}return!1} ma.Object.defineProperties(Xf.prototype,{portGravity:{configurable:!0,get:function(){return this.Zh},set:function(a){A(a,"number",Xf,"portGravity");0<=a&&(this.Zh=a)}},isUnconnectedLinkValid:{configurable:!0,get:function(){return this.Na},set:function(a){A(a,"boolean",Xf,"isUnconnectedLinkValid");this.Na=a}},linkingCursor:{configurable:!0,get:function(){return this.ri},set:function(a){this.ri=a}},temporaryLink:{configurable:!0,get:function(){return this.Vw}, set:function(a){w(a,R,Xf,"temporaryLink");this.Vw=a}},temporaryFromNode:{configurable:!0,get:function(){return this.Uw},set:function(a){w(a,T,Xf,"temporaryFromNode");if(this.Uw=a)this.l=a.port}},temporaryFromPort:{configurable:!0,get:function(){return this.l},set:function(a){w(a,N,Xf,"temporaryFromPort");if(null!==this.l){var b=this.l.panel;if(null!==b){var c=b.Z.indexOf(this.l);b.hb(c);b.yb(c,a)}}this.l=a}},temporaryToNode:{configurable:!0,get:function(){return this.Ww}, set:function(a){w(a,T,Xf,"temporaryToNode");if(this.Ww=a)this.w=a.port}},temporaryToPort:{configurable:!0,get:function(){return this.w},set:function(a){w(a,N,Xf,"temporaryToPort");if(null!==this.w){var b=this.w.panel;if(null!==b){var c=b.Z.indexOf(this.w);b.hb(c);b.yb(c,a)}}this.w=a}},originalLink:{configurable:!0,get:function(){return this.Pc},set:function(a){null!==a&&w(a,R,Xf,"originalLink");this.Pc=a}},originalFromNode:{configurable:!0,get:function(){return this.ib}, set:function(a){null!==a&&w(a,T,Xf,"originalFromNode");this.ib=a}},originalFromPort:{configurable:!0,get:function(){return this.Oc},set:function(a){null!==a&&w(a,N,Xf,"originalFromPort");this.Oc=a}},originalToNode:{configurable:!0,get:function(){return this.Pf},set:function(a){null!==a&&w(a,T,Xf,"originalToNode");this.Pf=a}},originalToPort:{configurable:!0,get:function(){return this.Yh},set:function(a){null!==a&&w(a,N,Xf,"originalToPort");this.Yh=a}},isForwards:{configurable:!0, enumerable:!0,get:function(){return this.Ma},set:function(a){A(a,"boolean",Xf,"isForwards");this.Ma=a}},validPortsCache:{configurable:!0,get:function(){return this.Py}},targetPort:{configurable:!0,get:function(){return this.Tw},set:function(a){null!==a&&w(a,N,Xf,"targetPort");this.Tw=a}},linkValidation:{configurable:!0,get:function(){return this.Ii},set:function(a){null!==a&&A(a,"function",Xf,"linkValidation");this.Ii=a}},portTargeted:{configurable:!0, get:function(){return this.ir},set:function(a){null!==a&&A(a,"function",Xf,"portTargeted");this.ir=a}}});Xf.className="LinkingBaseTool";function ig(){0<arguments.length&&za(ig);Xf.call(this);this.name="Linking";this.$={};this.L=null;this.M=jg;this.bn=null}la(ig,Xf);ig.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowLink||!a.model.Nt()||!a.lastInput.left||a.currentTool!==this&&!this.isBeyondDragSize()?!1:null!==this.findLinkablePort()}; ig.prototype.findLinkablePort=function(){var a=this.diagram,b=this.startObject;null===b&&(b=a.$b(a.firstInput.documentPoint,null,null));if(null===b||!(b.part instanceof T))return null;a=this.direction;if(a===jg||a===kg){var c=this.findValidLinkablePort(b,!1);if(null!==c)return this.isForwards=!0,c}if(a===jg||a===lg)if(b=this.findValidLinkablePort(b,!0),null!==b)return this.isForwards=!1,b;return null}; ig.prototype.doActivate=function(){var a=this.diagram,b=this.findLinkablePort();null!==b&&(this.Ba(this.name),a.isMouseCaptured=!0,a.currentCursor=this.linkingCursor,this.isForwards?(null===this.temporaryToNode||this.temporaryToNode.location.o()||(this.temporaryToNode.location=a.lastInput.documentPoint),this.originalFromPort=b,b=this.originalFromPort.part,b instanceof T&&(this.originalFromNode=b),this.copyPortProperties(this.originalFromNode,this.originalFromPort,this.temporaryFromNode,this.temporaryFromPort, !1)):(null===this.temporaryFromNode||this.temporaryFromNode.location.o()||(this.temporaryFromNode.location=a.lastInput.documentPoint),this.originalToPort=b,b=this.originalToPort.part,b instanceof T&&(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.Ya(),a.add(this.temporaryLink)),this.isActive=!0)};ig.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.Qg()};ig.prototype.doStop=function(){Xf.prototype.doStop.call(this);this.startObject=null}; ig.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var 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 T&&(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.U("ChangingSelection",a.selection),a.clearSelection(!0),f.isSelected=!0),this.transactionResult=this.name,a.U("LinkDrawn",f)):(a.model.wq(),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.U("ChangedSelection",a.selection)}}}; ig.prototype.isNewTreeLink=function(){var a=this.archetypeLinkData;if(null===a)return!0;if(a instanceof R)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};ig.prototype.insertLink=function(a,b,c,d){return this.diagram.partManager.insertLink(a,b,c,d)};ig.prototype.doNoLink=function(){}; ma.Object.defineProperties(ig.prototype,{archetypeLinkData:{configurable:!0,get:function(){return this.$},set:function(a){null!==a&&A(a,"object",ig,"archetypeLinkData");a instanceof N&&w(a,R,ig,"archetypeLinkData");this.$=a}},archetypeLabelNodeData:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&A(a,"object",ig,"archetypeLabelNodeData");a instanceof N&&w(a,T,ig,"archetypeLabelNodeData");this.L=a}},direction:{configurable:!0,get:function(){return this.M}, set:function(a){hb(a,ig,ig,"direction");this.M=a}},startObject:{configurable:!0,get:function(){return this.bn},set:function(a){null!==a&&w(a,N,ig,"startObject");this.bn=a}}});var jg=new E(ig,"Either",0),kg=new E(ig,"ForwardsOnly",0),lg=new E(ig,"BackwardsOnly",0);ig.className="LinkingTool";ig.Either=jg;ig.ForwardsOnly=kg;ig.BackwardsOnly=lg; function lf(){0<arguments.length&&za(lf);Xf.call(this);this.name="Relinking";var a=new Yf;a.figure="Diamond";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=0;this.$=a;a=new Yf;a.figure="Diamond";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.cursor=this.linkingCursor;a.segmentIndex=-1;this.bn=a;this.L=null;this.yx=new L}la(lf,Xf); lf.prototype.updateAdornments=function(a){if(null!==a&&a instanceof R){var b="RelinkFrom",c=null;if(a.isSelected&&!this.diagram.isReadOnly){var d=a.selectionObject;null!==d&&a.canRelinkFrom()&&a.actualBounds.o()&&a.isVisible()&&d.actualBounds.o()&&d.Kf()&&(c=a.sk(b),null===c&&(c=this.makeAdornment(d,!1),a.Kh(b,c)))}null===c&&a.Lf(b);b="RelinkTo";c=null;a.isSelected&&!this.diagram.isReadOnly&&(d=a.selectionObject,null!==d&&a.canRelinkTo()&&a.actualBounds.o()&&a.isVisible()&&d.actualBounds.o()&&d.Kf()&& (c=a.sk(b),null===c?(c=this.makeAdornment(d,!0),a.Kh(b,c)):c.u()));null===c&&a.Lf(b)}};lf.prototype.makeAdornment=function(a,b){var c=new Te;c.type=U.Link;b=b?this.toHandleArchetype:this.fromHandleArchetype;null!==b&&c.add(b.copy());c.adornedObject=a;return c}; lf.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowRelink||!a.model.Nt()||!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}; lf.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 Te&&c.adornedPart instanceof R))return;this.handle=b;this.isForwards=null===c||"RelinkTo"===c.category;this.originalLink=c.adornedPart}this.Ba(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.yx.set(this.originalLink.actualBounds);null!==this.originalLink&&0<this.originalLink.pointsCount&&(null===this.originalLink.fromNode&&(null!==this.temporaryFromPort&&(this.temporaryFromPort.desiredSize=Wb),null!==this.temporaryFromNode&&(this.temporaryFromNode.location=this.originalLink.i(0))),null===this.originalLink.toNode&& (null!==this.temporaryToPort&&(this.temporaryToPort.desiredSize=Wb),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.Ya(),a.add(this.temporaryLink));this.isActive=!0}; lf.prototype.copyLinkProperties=function(a,b){if(null!==a&&null!==b){b.adjusting=a.adjusting;b.corner=a.corner;var c=a.curve;if(c===mg||c===ng)c=og;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}}; lf.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.Qg()};lf.prototype.doStop=function(){Xf.prototype.doStop.call(this);this.handle=null}; lf.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;this.transactionResult=null;var b=this.originalFromNode,c=this.originalFromPort,d=this.originalToNode,e=this.originalToPort,f=this.originalLink;this.targetPort=this.findTargetPort(this.isForwards);if(null!==this.targetPort){var g=this.targetPort.part;g instanceof T&&(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.Ya()),a.allowSelect&&(f.isSelected=!0),this.transactionResult=this.name,a.U("LinkRelinked",f,this.isForwards?this.originalToPort:this.originalFromPort)):this.doNoRelink(this.originalLink,this.isForwards);this.originalLink.Jq(this.yx)}this.stopTool()}; lf.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};lf.prototype.doNoRelink=function(){}; function Lf(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)} ma.Object.defineProperties(lf.prototype,{fromHandleArchetype:{configurable:!0,get:function(){return this.$},set:function(a){null!==a&&w(a,N,lf,"fromHandleArchetype");this.$=a}},toHandleArchetype:{configurable:!0,get:function(){return this.bn},set:function(a){null!==a&&w(a,N,lf,"toHandleArchetype");this.bn=a}},handle:{configurable:!0,get:function(){return this.L},set:function(a){if(null!==a&&(w(a,N,lf,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+ a);this.L=a}}});lf.className="RelinkingTool";Sa("linkingTool",function(){return this.findTool("Linking")},function(a){this.bb("Linking",a,this.mouseMoveTools)});Sa("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.bb("Relinking",a,this.mouseDownTools)}); function pg(){0<arguments.length&&za(pg);Oe.call(this);this.name="LinkReshaping";var a=new Yf;a.figure="Rectangle";a.desiredSize=Zb;a.fill="lightblue";a.stroke="dodgerblue";this.w=a;a=new Yf;a.figure="Diamond";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.cursor="move";this.L=a;this.$=3;this.ou=this.l=null;this.zx=new J;this.Fs=new H}la(pg,Oe);pg.prototype.Uv=function(a){return a&&a.Ms&&0!==a.Ms.value?a.Ms:qg}; pg.prototype.Xm=function(a,b){w(a,N,pg,"setReshapingBehavior:obj");hb(b,pg,pg,"setReshapingBehavior:behavior");a.Ms=b}; pg.prototype.updateAdornments=function(a){if(null!==a&&a instanceof R){var b=null;if(a.isSelected&&!this.diagram.isReadOnly){var c=a.path;null!==c&&a.canReshape()&&a.actualBounds.o()&&a.isVisible()&&c.actualBounds.o()&&c.Kf()&&(b=a.sk(this.name),null===b||b.vx!==a.pointsCount||b.Kx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.vx=a.pointsCount,b.Kx=a.resegmentable,a.Kh(this.name,b)))}null===b&&a.Lf(this.name)}}; pg.prototype.makeAdornment=function(a){var b=a.part,c=b.pointsCount,d=b.isOrthogonal,e=null;if(null!==b.points&&1<c){e=new Te;e.type=U.Link;c=b.firstPickIndex;var f=b.lastPickIndex,g=d?1:0;if(b.resegmentable&&b.computeCurve()!==rg)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.C(k.x,l.x)&& K.C(k.y,l.y)&&(l=b.i(c-1));K.C(k.x,l.x)?(this.Xm(h,sg),h.cursor="n-resize"):K.C(k.y,l.y)&&(this.Xm(h,tg),h.cursor="w-resize")}else g===f-1&&d?(k=b.i(f-1),l=b.i(f),K.C(k.x,l.x)&&K.C(k.y,l.y)&&(k=b.i(f+1)),K.C(k.x,l.x)?(this.Xm(h,sg),h.cursor="n-resize"):K.C(k.y,l.y)&&(this.Xm(h,tg),h.cursor="w-resize")):g!==f&&(this.Xm(h,ug),h.cursor="move");e.add(h)}e.adornedObject=a}return e};pg.prototype.makeHandle=function(){var a=this.handleArchetype;return null===a?null:a.copy()}; pg.prototype.makeResegmentHandle=function(){var a=this.midHandleArchetype;return null===a?null:a.copy()};pg.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}; pg.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 R){this.ou=b;a.isMouseCaptured=!0;this.Ba(this.name);if(b.resegmentable&&999===this.handle.fromMaxLinks){var c=b.points.copy(),d=this.getResegmentingPoint();c.yb(this.handle.segmentIndex+1,d);b.isOrthogonal&&c.yb(this.handle.segmentIndex+1,d);b.points=c;b.Rb();b.updateAdornments(); this.handle=this.findToolHandleAt(a.firstInput.documentPoint,this.name);if(null===this.handle){this.doDeactivate();return}}this.zx=b.i(this.handle.segmentIndex);this.Fs=b.points.copy();this.isActive=!0}}};pg.prototype.doDeactivate=function(){this.Qg();this.ou=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};pg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Fs);this.stopTool()};pg.prototype.getResegmentingPoint=function(){return this.handle.ma(Mc)}; pg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeReshape(a.lastInput.documentPoint),this.reshape(a))}; pg.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&&(vg(this,g,d,e,f,!0)||vg(this,g,d,e,f,!1))){var h=b.points.copy();vg(this,g,d, e,f,!0)?(h.od(c-2,new J(g.x,(f.y+g.y)/2)),h.od(c+1,new J(f.x,(f.y+g.y)/2))):(h.od(c-2,new J((f.x+g.x)/2,g.y)),h.od(c+1,new J((f.x+g.x)/2,f.y)));h.hb(c);h.hb(c-1);b.points=h;b.Rb()}else g=b.i(c+2),Math.abs(e.x-f.x)<this.resegmentingDistance&&Math.abs(e.y-f.y)<this.resegmentingDistance&&(vg(this,d,e,f,g,!0)||vg(this,d,e,f,g,!1))&&(h=b.points.copy(),vg(this,d,e,f,g,!0)?(h.od(c-1,new J(d.x,(d.y+g.y)/2)),h.od(c+2,new J(g.x,(d.y+g.y)/2))):(h.od(c-1,new J((d.x+g.x)/2,d.y)),h.od(c+2,new J((d.x+g.x)/2,g.y))), h.hb(c+1),h.hb(c),b.points=h,b.Rb())}}else g=J.alloc(),K.Th(d.x,d.y,f.x,f.y,e.x,e.y,g)&&g.Pe(e)<this.resegmentingDistance*this.resegmentingDistance&&(d=b.points.copy(),d.hb(c),b.points=d,b.Rb()),J.free(g)}a.Ta();this.transactionResult=this.name;a.U("LinkReshaped",this.adornedLink,this.Fs)}this.stopTool()}; function vg(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} pg.prototype.reshape=function(a){var b=this.adornedLink;b.Vh();var c=this.handle.segmentIndex,d=this.Uv(this.handle);if(b.isOrthogonal)if(c===b.firstPickIndex+1)c=b.firstPickIndex+1,d===sg?(b.N(c,b.i(c-1).x,a.y),b.N(c+1,b.i(c+2).x,a.y)):d===tg&&(b.N(c,a.x,b.i(c-1).y),b.N(c+1,a.x,b.i(c+2).y));else if(c===b.lastPickIndex-1)c=b.lastPickIndex-1,d===sg?(b.N(c-1,b.i(c-2).x,a.y),b.N(c,b.i(c+1).x,a.y)):d===tg&&(b.N(c-1,a.x,b.i(c-2).y),b.N(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.C(f.x, e.x)&&K.C(e.y,g.y)?(K.C(f.x,b.i(d-2).x)&&!K.C(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.N(d-1,a.x,f.y),K.C(g.y,b.i(d+2).y)&&!K.C(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.N(d+1,g.x,a.y)):K.C(f.y,e.y)&&K.C(e.x,g.x)?(K.C(f.y,b.i(d-2).y)&&!K.C(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.N(d-1,f.x,a.y),K.C(g.x,b.i(d+2).x)&&!K.C(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.N(d+1,a.x,g.y)):K.C(f.x,e.x)&&K.C(e.x,g.x)?(K.C(f.x,b.i(d-2).x)&&!K.C(f.y,b.i(d-2).y)?(b.m(d,a.x,f.y),c++,d++):b.N(d-1,a.x,f.y),K.C(g.x,b.i(d+2).x)&& !K.C(g.y,b.i(d+2).y)?b.m(d+1,a.x,g.y):b.N(d+1,a.x,g.y)):K.C(f.y,e.y)&&K.C(e.y,g.y)&&(K.C(f.y,b.i(d-2).y)&&!K.C(f.x,b.i(d-2).x)?(b.m(d,f.x,a.y),c++,d++):b.N(d-1,f.x,a.y),K.C(g.y,b.i(d+2).y)&&!K.C(g.x,b.i(d+2).x)?b.m(d+1,g.x,a.y):b.N(d+1,g.x,a.y));b.N(c,a.x,a.y)}else b.N(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).Sb()&&(f=e.ma(Mc,J.alloc()),d=b.getLinkPointFromPoint(d,e,f,a,!0,J.alloc()),b.N(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).Sb()&&(c=e.ma(Mc,J.alloc()),a=b.getLinkPointFromPoint(d,e,c,a,!1,J.alloc()),b.N(b.pointsCount-1,a.x,a.y),J.free(c),J.free(a));b.Df()};pg.prototype.computeReshape=function(a){var b=this.adornedLink,c=this.handle.segmentIndex;switch(this.Uv(this.handle)){case ug:return a;case sg:return new J(b.i(c).x,a.y);case tg:return new J(a.x,b.i(c).y);default:case qg:return b.i(c)}}; ma.Object.defineProperties(pg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&w(a,N,pg,"handleArchetype");this.w=a}},midHandleArchetype:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&w(a,N,pg,"midHandleArchetype");this.L=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(w(a,N,pg,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+ a);this.l=a}},adornedLink:{configurable:!0,get:function(){return this.ou}},resegmentingDistance:{configurable:!0,get:function(){return this.$},set:function(a){A(a,"number",pg,"resegmentingDistance");this.$=a}},originalPoint:{configurable:!0,get:function(){return this.zx}},originalPoints:{configurable:!0,get:function(){return this.Fs}}});pg.prototype.setReshapingBehavior=pg.prototype.Xm;pg.prototype.getReshapingBehavior=pg.prototype.Uv; var qg=new E(pg,"None",0),tg=new E(pg,"Horizontal",1),sg=new E(pg,"Vertical",2),ug=new E(pg,"All",3);pg.className="LinkReshapingTool";pg.None=qg;pg.Horizontal=tg;pg.Vertical=sg;pg.All=ug;Sa("linkReshapingTool",function(){return this.findTool("LinkReshaping")},function(a){this.bb("LinkReshaping",a,this.mouseDownTools)}); function Ig(){0<arguments.length&&za(Ig);Oe.call(this);this.name="Resizing";this.ng=(new Hb(1,1)).freeze();this.mg=(new Hb(9999,9999)).freeze();this.Wg=(new Hb(NaN,NaN)).freeze();this.L=!1;this.le=null;var a=new Yf;a.alignmentFocus=Mc;a.figure="Rectangle";a.desiredSize=Zb;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.w=a;this.l=null;this.Es=new J;this.xx=new Hb;this.np=new J;this.Fu=new Hb(0,0);this.Eu=new Hb(Infinity,Infinity);this.Du=new Hb(1,1);this.ux=!0} la(Ig,Oe);Ig.prototype.updateAdornments=function(a){if(!(null===a||a instanceof R)){if(a.isSelected&&!this.diagram.isReadOnly){var b=a.resizeObject,c=a.sk(this.name);if(null!==b&&a.canResize()&&a.actualBounds.o()&&a.isVisible()&&b.actualBounds.o()&&b.Kf()){if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){b=b.hj();Jg(a)&&this.updateResizeHandles(c,b);a.Kh(this.name,c);return}}}a.Lf(this.name)}}; Ig.prototype.makeAdornment=function(a){var b=a.part.resizeAdornmentTemplate;if(null===b){b=new Te;b.type=U.Spot;b.locationSpot=Mc;var c=new Kg;c.isPanelMain=!0;b.add(c);b.add(this.makeHandle(a,Hc));b.add(this.makeHandle(a,Jc));b.add(this.makeHandle(a,Sc));b.add(this.makeHandle(a,Oc));b.add(this.makeHandle(a,qd));b.add(this.makeHandle(a,sd));b.add(this.makeHandle(a,td));b.add(this.makeHandle(a,rd))}else if(Lg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b}; Ig.prototype.makeHandle=function(a,b){a=this.handleArchetype;if(null===a)return null;a=a.copy();a.alignment=b;return a}; Ig.prototype.updateResizeHandles=function(a,b){if(null!==a)if(!a.alignment.Gb()&&("pointer"===a.cursor||0<a.cursor.indexOf("resize")))a:{var c=a.alignment;c.Sb()&&(c=Mc);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 U)for(a=a.elements;a.next();)this.updateResizeHandles(a.value,b)};Ig.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}; Ig.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&&(this.Es.set(this.adornedObject.ma(this.handle.alignment.hw())),this.np.set(this.adornedObject.part.location),this.xx.set(this.adornedObject.desiredSize),this.Du=this.computeCellSize(),this.Fu=this.computeMinSize(),this.Eu=this.computeMaxSize(),a.isMouseCaptured= !0,this.ux=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.Ba(this.name),this.isActive=!0))};Ig.prototype.doDeactivate=function(){var a=this.diagram;this.Qg();this.le=this.handle=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.ux};Ig.prototype.doCancel=function(){null!==this.adornedObject&&(this.adornedObject.desiredSize=this.originalDesiredSize,this.adornedObject.part.location=this.originalLocation);this.stopTool()}; Ig.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive){var b=this.Fu,c=this.Eu,d=this.Du,e=this.adornedObject.Ft(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.dd();J.free(e)}}; Ig.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Fu,c=this.Eu,d=this.Du,e=this.adornedObject.Ft(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.Ta();this.transactionResult=this.name;a.U("PartResized",this.adornedObject,this.originalDesiredSize)}this.stopTool()}; Ig.prototype.resize=function(a){var b=this.diagram,c=this.adornedObject;if(null!==c){c.desiredSize=a.size;a=c.part;a.Eb();c=c.ma(this.handle.alignment.hw());if(a instanceof Hf){var d=new H;d.add(a);b.moveParts(d,this.oppositePoint.copy().ie(c),!0)}else a.location=a.location.copy().ie(c).add(this.oppositePoint);b.dd()}}; Ig.prototype.computeResize=function(a,b,c,d,e,f){b.Sb()&&(b=Mc);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.Cq(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};Ig.prototype.computeReshape=function(){var a=Mg;this.adornedObject instanceof Yf&&(a=Ng(this.adornedObject));return!(a===Og||this.diagram.lastInput.shift)}; Ig.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};Ig.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}; Ig.prototype.computeCellSize=function(){var a=new Hb(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}; ma.Object.defineProperties(Ig.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&w(a,N,Ig,"handleArchetype");this.w=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(w(a,N,Ig,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{configurable:!0,get:function(){return this.le},set:function(a){if(null!==a&&(w(a,N, Ig,"handle"),a.part instanceof Te))throw Error("new handle must not be in an Adornment: "+a);this.le=a}},minSize:{configurable:!0,get:function(){return this.ng},set:function(a){w(a,Hb,Ig,"minSize");if(!this.ng.A(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.ng.h(b,a)}}},maxSize:{configurable:!0,get:function(){return this.mg},set:function(a){w(a,Hb,Ig,"maxSize");if(!this.mg.A(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity); this.mg.h(b,a)}}},cellSize:{configurable:!0,get:function(){return this.Wg},set:function(a){w(a,Hb,Ig,"cellSize");this.Wg.A(a)||this.Wg.assign(a)}},isGridSnapEnabled:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"boolean",Ig,"isGridSnapEnabled");this.L=a}},oppositePoint:{configurable:!0,get:function(){return this.Es},set:function(a){w(a,J,Ig,"oppositePoint");this.Es.A(a)||this.Es.assign(a)}},originalDesiredSize:{configurable:!0, get:function(){return this.xx}},originalLocation:{configurable:!0,get:function(){return this.np}}});Ig.className="ResizingTool";Sa("resizingTool",function(){return this.findTool("Resizing")},function(a){this.bb("Resizing",a,this.mouseDownTools)}); function Pg(){0<arguments.length&&za(Pg);Oe.call(this);this.name="Rotating";this.Na=45;this.Ma=2;this.np=new J;this.le=null;var a=new Yf;a.figure="Ellipse";a.desiredSize=$b;a.fill="lightblue";a.stroke="dodgerblue";a.strokeWidth=1;a.cursor="pointer";this.w=a;this.l=null;this.wx=0;this.ev=new J(NaN,NaN);this.L=0;this.$=50}la(Pg,Oe); Pg.prototype.updateAdornments=function(a){if(null!==a){if(a.Sh()){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.o()&&a.isVisible()&&b.actualBounds.o()&&b.Kf())){var c=a.sk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.hj();null===c.placeholder&&(c.location=this.computeAdornmentLocation(b));a.Kh(this.name,c);return}}a.Lf(this.name)}}; Pg.prototype.makeAdornment=function(a){var b=a.part.rotateAdornmentTemplate;if(null===b){b=new Te;b.type=U.Position;b.locationSpot=Mc;var c=this.handleArchetype;null!==c&&b.add(c.copy())}else if(Lg(b),b=b.copy(),null===b)return null;b.adornedObject=a;return b};Pg.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}; Pg.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&&(this.wx=this.adornedObject.angle,this.ev=this.computeRotationPoint(this.adornedObject),this.np=this.adornedObject.part.location.copy(),a.isMouseCaptured=!0,a.delaysLayout=!0,this.Ba(this.name),this.isActive=!0)}; Pg.prototype.computeRotationPoint=function(a){var b=a.part,c=b.locationObject;return b.rotationSpot.ab()?a.ma(b.rotationSpot):a===b||a===c?c.ma(b.locationSpot):a.ma(Mc)}; Pg.prototype.computeAdornmentLocation=function(a){var b=this.rotationPoint;b.o()||(b=this.computeRotationPoint(a));b=a.Ft(b);var c=this.handleAngle;0>c?c+=360:360<=c&&(c-=360);c=Math.round(45*Math.round(c/45));var d=this.handleDistance;0===c?b.x=a.naturalBounds.width+d:45===c?(b.x=a.naturalBounds.width+d,b.y=a.naturalBounds.height+d):90===c?b.y=a.naturalBounds.height+d:135===c?(b.x=-d,b.y=a.naturalBounds.height+d):180===c?b.x=-d:225===c?(b.x=-d,b.y=-d):270===c?b.y=-d:315===c&&(b.x=a.naturalBounds.width+ d,b.y=-d);return a.ma(b)};Pg.prototype.doDeactivate=function(){var a=this.diagram;this.Qg();this.le=this.handle=null;this.ev=new J(NaN,NaN);this.isActive=a.isMouseCaptured=!1};Pg.prototype.doCancel=function(){this.diagram.delaysLayout=!1;this.rotate(this.originalAngle);this.stopTool()};Pg.prototype.doMouseMove=function(){var a=this.diagram;this.isActive&&(a=this.computeRotate(a.lastInput.documentPoint),this.rotate(a))}; Pg.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){a.delaysLayout=!1;var b=this.computeRotate(a.lastInput.documentPoint);this.rotate(b);a.Ta();this.transactionResult=this.name;a.U("PartRotated",this.adornedObject,this.originalAngle)}this.stopTool()}; Pg.prototype.rotate=function(a){F&&C(a,Pg,"rotate:newangle");var b=this.adornedObject;if(null!==b){b.angle=a;b=b.part;b.Eb();var c=b.locationObject,d=b.rotateObject;if(c===d||c.Mg(d))c=this.np.copy(),b.location=c.ie(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.dd()}}; Pg.prototype.computeRotate=function(a){a=this.rotationPoint.Xa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.hj());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}; ma.Object.defineProperties(Pg.prototype,{handleArchetype:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&w(a,N,Pg,"handleArchetype");this.w=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(w(a,N,Pg,"handle"),!(a.part instanceof Te)))throw Error("new handle is not in an Adornment: "+a);this.l=a}},adornedObject:{configurable:!0,get:function(){return this.le},set:function(a){if(null!==a&&(w(a,N, Pg,"handle"),a.part instanceof Te))throw Error("new handle must not be in an Adornment: "+a);this.le=a}},snapAngleMultiple:{configurable:!0,get:function(){return this.Na},set:function(a){A(a,"number",Pg,"snapAngleMultiple");this.Na=a}},snapAngleEpsilon:{configurable:!0,get:function(){return this.Ma},set:function(a){A(a,"number",Pg,"snapAngleEpsilon");this.Ma=a}},originalAngle:{configurable:!0,get:function(){return this.wx}},rotationPoint:{configurable:!0, enumerable:!0,get:function(){return this.ev}},handleAngle:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"number",Pg,"handleAngle");this.L=a}},handleDistance:{configurable:!0,get:function(){return this.$},set:function(a){A(a,"number",Pg,"handleDistance");this.$=a}}});Pg.className="RotatingTool";Sa("rotatingTool",function(){return this.findTool("Rotating")},function(a){this.bb("Rotating",a,this.mouseDownTools)}); function Qg(){Oe.call(this);0<arguments.length&&za(Qg);this.name="ClickSelecting"}la(Qg,Oe);Qg.prototype.canStart=function(){return!this.isEnabled||this.isBeyondDragSize()?!1:!0};Qg.prototype.doMouseUp=function(){this.isActive&&(this.standardMouseSelect(),!this.standardMouseClick()&&this.diagram.lastInput.isTouchEvent&&this.diagram.toolManager.doToolTip());this.stopTool()};Qg.className="ClickSelectingTool";function Rg(){Oe.call(this);0<arguments.length&&za(Rg);this.name="Action";this.Ok=null} la(Rg,Oe);Rg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram,b=a.lastInput,c=a.$b(b.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a});if(null!==c){if(!c.isActionable)return!1;this.Ok=c;a.yj=a.$b(b.documentPoint,null,null);return!0}return!1};Rg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Ok;null!==b&&(a.targetObject=b,null!==b.actionDown&&b.actionDown(a,b))}else this.canStart()&&this.doActivate()}; Rg.prototype.doMouseMove=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Ok;null!==b&&(a.targetObject=b,null!==b.actionMove&&b.actionMove(a,b))}};Rg.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Ok;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()}; Rg.prototype.doCancel=function(){var a=this.diagram.lastInput,b=this.Ok;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};Rg.prototype.doStop=function(){this.Ok=null};Rg.className="ActionTool";function Sg(){Oe.call(this);0<arguments.length&&za(Sg);this.name="ClickCreating";this.uj=null;this.w=!0;this.l=!1;this.nx=new J(0,0)}la(Sg,Oe); Sg.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.nx=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.nx))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.xm(a.lastInput.documentPoint,!0)?!1:!0}; Sg.prototype.doMouseUp=function(){var a=this.diagram;this.isActive&&this.insertPart(a.lastInput.documentPoint);this.stopTool()}; Sg.prototype.insertPart=function(a){var b=this.diagram,c=this.archetypeNodeData;if(null===c)return null;var d=null;try{b.U("ChangingSelection",b.selection);this.Ba(this.name);if(c instanceof S)c.bc()&&(Lg(c),d=c.copy(),null!==d&&b.add(d));else if(null!==c){var e=b.model.copyNodeData(c);Fa(e)&&(b.model.Bf(e),d=b.Cc(e))}if(null!==d){var f=J.allocAt(a.x,a.y);this.isGridSnapEnabled&&Tg(this.diagram,d,a,f);d.location=f;b.allowSelect&&(b.clearSelection(!0),d.isSelected=!0);J.free(f)}b.Ta();this.transactionResult= this.name;b.U("PartCreated",d)}finally{this.Qg(),b.U("ChangedSelection",b.selection)}return d}; ma.Object.defineProperties(Sg.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.uj},set:function(a){null!==a&&A(a,"object",Sg,"archetypeNodeData");this.uj=a}},isDoubleClick:{configurable:!0,get:function(){return this.w},set:function(a){A(a,"boolean",Sg,"isDoubleClick");this.w=a}},isGridSnapEnabled:{configurable:!0,get:function(){return this.l},set:function(a){A(a,"boolean",Sg,"isGridSnapEnabled");this.l=a}}});Sg.className="ClickCreatingTool"; function Ug(){Oe.call(this);0<arguments.length&&za(Ug);this.name="DragSelecting";this.hl=175;this.w=!1;var a=new S;a.layerName="Tool";a.selectable=!1;var b=new Yf;b.name="SHAPE";b.figure="Rectangle";b.fill=null;b.stroke="magenta";a.add(b);this.l=a}la(Ug,Oe); Ug.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.xm(b.documentPoint,!0))?!1:!0};Ug.prototype.doActivate=function(){var a=this.diagram;this.isActive=!0;a.isMouseCaptured=!0;a.skipsUndoManager=!0;a.add(this.box);this.doMouseMove()}; Ug.prototype.doDeactivate=function(){var a=this.diagram;a.Nf();a.remove(this.box);a.skipsUndoManager=!1;this.isActive=a.isMouseCaptured=!1};Ug.prototype.doMouseMove=function(){var a=this.diagram;if(this.isActive&&null!==this.box){var b=this.computeBoxBounds(),c=this.box.fb("SHAPE");null===c&&(c=this.box.Fb());var d=Hb.alloc().h(b.width,b.height);b=J.allocAt(b.x,b.y);c.desiredSize=d;this.box.position=b;Hb.free(d);J.free(b);(a.allowHorizontalScroll||a.allowVerticalScroll)&&a.xt(a.lastInput.viewPoint)}}; Ug.prototype.doMouseUp=function(){if(this.isActive){var a=this.diagram;a.remove(this.box);try{a.currentCursor="wait",a.U("ChangingSelection",a.selection),this.selectInRect(this.computeBoxBounds()),a.U("ChangedSelection",a.selection)}finally{a.currentCursor=""}}this.stopTool()};Ug.prototype.computeBoxBounds=function(){var a=this.diagram;return new L(a.firstInput.documentPoint,a.lastInput.documentPoint)}; Ug.prototype.selectInRect=function(a){var b=this.diagram,c=b.lastInput;a=b.hy(a,this.isPartialInclusion);if(db?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)}};ma.Object.defineProperties(Ug.prototype,{delay:{configurable:!0,get:function(){return this.hl},set:function(a){A(a,"number",Ug,"delay");this.hl=a}},isPartialInclusion:{configurable:!0,get:function(){return this.w},set:function(a){A(a,"boolean",Ug,"isPartialInclusion");this.w=a}},box:{configurable:!0,get:function(){return this.l},set:function(a){null!==a&&w(a,S,Ug,"box");this.l=a}}}); Ug.className="DragSelectingTool";function Vg(){Oe.call(this);0<arguments.length&&za(Vg);this.name="Panning";this.bv=new J;this.Xy=new J;this.Vg=!1;var a=this;this.Cx=function(){var b=a.diagram;null!==b&&b.removeEventListener(qa.document,"scroll",a.Cx,!1);a.stopTool()}}la(Vg,Oe);Vg.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}; Vg.prototype.doActivate=function(){var a=this.diagram;this.Vg?(a.lastInput.bubbles=!0,a.addEventListener(qa.document,"scroll",this.Cx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.bv.assign(a.position));this.isActive=!0};Vg.prototype.doDeactivate=function(){var a=this.diagram;a.currentCursor="";this.isActive=a.isMouseCaptured=!1};Vg.prototype.doCancel=function(){var a=this.diagram;a.position=this.bv;a.isMouseCaptured=!1;this.stopTool()};Vg.prototype.doMouseMove=function(){this.move()}; Vg.prototype.doMouseUp=function(){this.move();this.stopTool()};Vg.prototype.move=function(){var a=this.diagram;if(this.isActive&&a)if(this.Vg)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.Xy.h(e,c)}}; ma.Object.defineProperties(Vg.prototype,{bubbles:{configurable:!0,get:function(){return this.Vg},set:function(a){A(a,"boolean",Vg,"bubbles");this.Vg=a}},originalPosition:{configurable:!0,get:function(){return this.bv}}});Vg.className="PanningTool";Sa("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.bb("ClickCreating",a,this.mouseUpTools)}); Sa("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.bb("ClickSelecting",a,this.mouseUpTools)});Sa("panningTool",function(){return this.findTool("Panning")},function(a){this.bb("Panning",a,this.mouseMoveTools)});Sa("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.bb("DragSelecting",a,this.mouseMoveTools)});Sa("actionTool",function(){return this.findTool("Action")},function(a){this.bb("Action",a,this.mouseDownTools)}); function bf(){this.$=this.L=this.l=this.w=null} ma.Object.defineProperties(bf.prototype,{mainElement:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&w(a,HTMLElement,bf,"mainElement");this.L=a}},show:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(null!==a&&A(a,"function",bf,"show"),this.w=a)}},hide:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(null!==a&&A(a,"function",bf,"hide"),this.l=a)}},valueFunction:{configurable:!0, enumerable:!0,get:function(){return this.$},set:function(a){this.$=a}}});bf.className="HTMLInfo";function Wg(a,b,c){this.text=a;this.Tx=b;this.visible=c}Wg.className="ContextMenuButtonInfo";function Xg(){Oe.call(this);0<arguments.length&&za(Xg);this.name="ContextMenu";this.w=this.uu=this.l=null;this.tx=new J;this.vu=null;this.Pu=!1;var a=this;this.ov=function(){a.stopTool()}}la(Xg,Oe); function Yg(a){var b=new bf;b.show=function(a,b,c){c.showDefaultContextMenu()};b.hide=function(a,b){b.hideDefaultContextMenu()};Zg=b;a.ov=function(){a.stopTool()};b=ua("div");var c=ua("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=ua("style");qa.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",$g,!1),d.addEventListener(b,"selectstart", $g,!1),d.addEventListener(c,"contextmenu",$g,!1));b.className="goCXforeground";c.className="goCXbackground";qa.document.body&&(qa.document.body.appendChild(b),qa.document.body.appendChild(c));ah=b;bh=c;ch=!0}function $g(a){a.preventDefault();return!1}Xg.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;return this.isBeyondDragSize()||!a.lastInput.right?!1:a.lastInput.isTouchEvent&&null!==this.defaultTouchContextMenu||null!==this.findObjectWithContextMenu()?!0:!1}; Xg.prototype.doStart=function(){this.tx.set(this.diagram.firstInput.documentPoint)};Xg.prototype.doStop=function(){this.hideContextMenu();this.currentObject=null}; Xg.prototype.findObjectWithContextMenu=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.lastInput,d=null;a instanceof P||(a instanceof N?d=a:d=b.$b(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};Xg.prototype.doActivate=function(){}; Xg.prototype.doMouseDown=function(){Oe.prototype.doMouseDown.call(this);if(this.isActive&&this.currentContextMenu instanceof Te){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doMouseDown(),a.doDeactivate())}this.diagram.toolManager.mouseDownTools.contains(this)&&dh(this)}; Xg.prototype.doMouseUp=function(){if(this.isActive&&this.currentContextMenu instanceof Te){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.canStart()&&(a.doActivate(),a.doCancel(),a.doDeactivate())}dh(this)}; function dh(a){var b=a.diagram;if(a.isActive){var c=a.currentContextMenu;if(null!==c){if(!(c instanceof bf)){var d=b.$b(b.lastInput.documentPoint,null,null);null!==d&&d.Mg(c)&&a.standardMouseClick(null,null)}a.stopTool();a.canStart()&&(b.currentTool=a,a.doMouseUp())}}else a.canStart()&&(eh(a,!0),a.isActive||a.stopTool())} function eh(a,b,c){void 0===c&&(c=null);if(!a.Pu&&(a.Pu=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.Pu=!1,!b))if(a.isActive=!0,b=Zg,null===c&&(c=a.findObjectWithContextMenu()),null!==c){var d=c.contextMenu;null!==d?(a.currentObject=c instanceof N?c:null,a.showContextMenu(d,a.currentObject)):null!==b&&a.showContextMenu(b,a.currentObject)}else null!==b&&a.showContextMenu(b,null)} Xg.prototype.doMouseMove=function(){var a=this.diagram.toolManager.findTool("Action");null!==a&&a.doMouseMove();this.isActive&&this.diagram.toolManager.doMouseMove()}; Xg.prototype.showContextMenu=function(a,b){!F||a instanceof Te||a instanceof bf||v("showContextMenu:contextMenu must be an Adornment or HTMLInfo.");null!==b&&w(b,N,Xg,"showContextMenu:obj");var c=this.diagram;a!==this.currentContextMenu&&this.hideContextMenu();if(a instanceof Te){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.Eb();this.positionContextMenu(a,b)}else a instanceof bf&&a.show(b,c,this);this.currentContextMenu=a};Xg.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}}; Xg.prototype.hideContextMenu=function(){var a=this.diagram,b=this.currentContextMenu;null!==b&&(b instanceof Te?(a.remove(b),null!==this.uu&&this.uu.Lf(b.category),b.data=null,b.adornedObject=null):b instanceof bf&&(null!==b.hide?b.hide(a,this):null!==b.mainElement&&(b.mainElement.style.display="none")),this.currentContextMenu=null,this.standardMouseOver())}; function fh(a){var b=new H;b.add(new Wg("Copy",function(a){a.commandHandler.copySelection()},function(a){return a.commandHandler.canCopySelection()}));b.add(new Wg("Cut",function(a){a.commandHandler.cutSelection()},function(a){return a.commandHandler.canCutSelection()}));b.add(new Wg("Delete",function(a){a.commandHandler.deleteSelection()},function(a){return a.commandHandler.canDeleteSelection()}));b.add(new Wg("Paste",function(b){b.commandHandler.pasteSelection(a.mouseDownPoint)},function(b){return b.commandHandler.canPasteSelection(a.mouseDownPoint)})); b.add(new Wg("Select All",function(a){a.commandHandler.selectAll()},function(a){return a.commandHandler.canSelectAll()}));b.add(new Wg("Undo",function(a){a.commandHandler.undo()},function(a){return a.commandHandler.canUndo()}));b.add(new Wg("Redo",function(a){a.commandHandler.redo()},function(a){return a.commandHandler.canRedo()}));b.add(new Wg("Scroll To Part",function(a){a.commandHandler.scrollToPart()},function(a){return a.commandHandler.canScrollToPart()}));b.add(new Wg("Zoom To Fit",function(a){a.commandHandler.zoomToFit()}, function(a){return a.commandHandler.canZoomToFit()}));b.add(new Wg("Reset Zoom",function(a){a.commandHandler.resetZoom()},function(a){return a.commandHandler.canResetZoom()}));b.add(new Wg("Group Selection",function(a){a.commandHandler.groupSelection()},function(a){return a.commandHandler.canGroupSelection()}));b.add(new Wg("Ungroup Selection",function(a){a.commandHandler.ungroupSelection()},function(a){return a.commandHandler.canUngroupSelection()}));b.add(new Wg("Edit Text",function(a){a.commandHandler.editTextBlock()}, function(a){return a.commandHandler.canEditTextBlock()}));return b} Xg.prototype.showDefaultContextMenu=function(){var a=this.diagram;null===this.vu&&(this.vu=fh(this));ah.innerHTML="";bh.addEventListener("click",this.ov,!1);var b=this,c=ua("ul");c.className="goCXul";ah.appendChild(c);c.innerHTML="";for(var d=this.vu.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.Tx&&("function"!==typeof f||f(a))){f=ua("li");f.className="goCXli";var g=ua("a");g.className="goCXa";g.href="#";g.Ry=e.Tx;g.addEventListener("click",function(c){this.Ry(a);b.stopTool(); c.preventDefault();return!1},!1);g.textContent=e.text;f.appendChild(g);c.appendChild(f)}}ah.style.display="block";bh.style.display="block"};Xg.prototype.hideDefaultContextMenu=function(){if(null!==this.currentContextMenu&&this.currentContextMenu===Zg){ah.style.display="none";bh.style.display="none";var a=this.diagram;null!==a&&a.removeEventListener(bh,"click",this.ov,!1);this.currentContextMenu=null}}; ma.Object.defineProperties(Xg.prototype,{currentContextMenu:{configurable:!0,get:function(){return this.l},set:function(a){!F||null===a||a instanceof Te||a instanceof bf||v("ContextMenuTool.currentContextMenu must be an Adornment or HTMLInfo.");this.l=a;this.uu=a instanceof Te?a.adornedPart:null}},defaultTouchContextMenu:{configurable:!0,get:function(){!1===ch&&null===Zg&&gh&&Yg(this);return Zg},set:function(a){!F||null===a||a instanceof Te||a instanceof bf||v("ContextMenuTool.defaultTouchContextMenu must be an Adornment or HTMLInfo."); null===a&&(ch=!0);Zg=a}},currentObject:{configurable:!0,get:function(){return this.w},set:function(a){null!==a&&w(a,N,Xg,"currentObject");this.w=a}},mouseDownPoint:{configurable:!0,get:function(){return this.tx}}});var Zg=null,ch=!1,bh=null,ah=null;Xg.className="ContextMenuTool";Sa("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.bb("ContextMenu",a,this.mouseUpTools)}); function hh(){0<arguments.length&&za(hh);Oe.call(this);this.name="TextEditing";this.Dh=new ih;this.Na=null;this.Ma=jh;this.Ui=null;this.oa=kh;this.L=1;this.$=!0;this.w=null;this.l=new bf;this.zu=null;lh(this,this.l)}la(hh,Oe); function lh(a,b){if(gh){var c=ua("textarea");a.zu=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.ty(this.value);this.style.width=20+b.measuredBounds.width*this.VA+"px";this.rows=b.lineCount}},!1);c.addEventListener("keydown",function(b){if(null!==a.textBlock){var c=b.which;13===c?(!1===a.textBlock.isMultiline&&b.preventDefault(),a.acceptText(mh)):9===c?(a.acceptText(nh),b.preventDefault()):27===c&&(a.doCancel(),null!==a.diagram&&a.diagram.doFocus())}},!1);c.addEventListener("focus", function(){if(null!==a.currentTextEditor&&a.state!==kh){var b=a.zu;a.oa===oh&&(a.oa=ph);"function"===typeof b.select&&a.selectsTextOnActivate&&(b.select(),b.setSelectionRange(0,9999))}},!1);c.addEventListener("blur",function(){if(null!==a.currentTextEditor&&a.state!==kh){var b=a.zu;"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 ih&&f instanceof hh)if(f.state===qh)c.style.border="3px solid red",c.focus();else{var d=a.ma(Mc),e=b.position,k=b.scale,l=a.Gf()*k;l<f.minimumEditorScale&&(l=f.minimumEditorScale);var m=a.naturalBounds.width*l+6,n=a.naturalBounds.height*l+2,p=(d.x-e.x)*k;d=(d.y-e.y)*k;c.value=a.text;b.div.style.font=a.font;c.style.position="absolute";c.style.zIndex="100";c.style.font="inherit";c.style.fontSize=100*l+"%";c.style.lineHeight="normal";c.style.width=m+"px";c.style.left=(p-m/2|0)-1+ "px";c.style.top=(d-n/2|0)-1+"px";c.style.textAlign=a.textAlign;c.style.margin="0";c.style.padding="1px";c.style.border="0";c.style.outline="none";c.style.whiteSpace="pre-wrap";c.style.overflow="hidden";c.rows=a.lineCount;c.VA=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)}}} hh.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||a.isReadOnly||rh&&rh!==this&&(rh.acceptText(sh),rh&&rh!==this)||!a.lastInput.left||this.isBeyondDragSize())return!1;var b=a.$b(a.lastInput.documentPoint);if(!(null!==b&&b instanceof ih&&b.editable&&b.part.canEdit()))return!1;b=b.part;return null===b||this.starting===jh&&!b.isSelected||this.starting===th&&2>a.lastInput.clickCount?!1:!0};hh.prototype.doStart=function(){rh=this;null!==this.textBlock&&this.doActivate()}; hh.prototype.doActivate=function(){if(!this.isActive){var a=this.diagram;if(null!==a){var b=this.textBlock;null===b&&(b=a.$b(a.lastInput.documentPoint));if(null!==b&&b instanceof ih&&(this.textBlock=b,null!==b.part)){this.isActive=!0;this.oa=oh;var c=this.defaultTextEditor;null!==b.textEditor&&(c=b.textEditor);this.Dh=this.textBlock.copy();var d=new L(this.textBlock.ma(Hc),this.textBlock.ma(Sc));a.vw(d);c.show(b,a,this);this.currentTextEditor=c}}}};hh.prototype.doCancel=function(){this.stopTool()}; hh.prototype.doMouseUp=function(){this.canStart()&&this.doActivate()};hh.prototype.doMouseDown=function(){this.isActive&&this.acceptText(sh)};hh.prototype.acceptText=function(a){switch(a){case sh:if(this.oa===uh)this.currentTextEditor instanceof HTMLElement&&this.currentTextEditor.focus();else if(this.oa===oh||this.oa===qh||this.oa===ph)this.oa=vh,wh(this);break;case xh:case mh:case nh:if(mh!==a||!0!==this.textBlock.isMultiline)if(this.oa===oh||this.oa===qh||this.oa===ph)this.oa=vh,wh(this)}}; function wh(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());if(a.isValidText(b,e,f))a.Ba(a.name),a.oa=uh,a.transactionResult=a.name,b.text=f,d=a.textBlock,null!==d.textEdited&&d.textEdited(d,e,f),null!==c&&c.U("TextEdited",b,e),a.Qg(),a.stopTool(),null!==c&&c.doFocus();else{a.oa=qh;var g=a.textBlock;null!==g.errorFunction&&g.errorFunction(a,e,f);d.show(b,c,a)}}} hh.prototype.doDeactivate=function(){var a=this.diagram;null!==a&&(this.oa=kh,this.textBlock=null,null!==this.currentTextEditor&&this.currentTextEditor.hide(a,this),this.isActive=!1)};hh.prototype.doStop=function(){rh=null};hh.prototype.isValidText=function(a,b,c){w(a,ih,hh,"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};hh.prototype.ty=function(a){var b=this.Dh;b.text=a;b.measure(this.textBlock.Ei,Infinity);return b}; ma.Object.defineProperties(hh.prototype,{textBlock:{configurable:!0,get:function(){return this.Na},set:function(a){null!==a&&w(a,ih,hh,"textBlock");this.Na=a}},currentTextEditor:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a}},defaultTextEditor:{configurable:!0,get:function(){return this.l},set:function(a){!F||a instanceof bf||v("TextEditingTool.defaultTextEditor must be an HTMLInfo.");this.l=a}},starting:{configurable:!0, get:function(){return this.Ma},set:function(a){hb(a,hh,hh,"starting");this.Ma=a}},textValidation:{configurable:!0,get:function(){return this.Ui},set:function(a){null!==a&&A(a,"function",hh,"textValidation");this.Ui=a}},minimumEditorScale:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&A(a,"number",hh,"minimumEditorScale");this.L=a}},selectsTextOnActivate:{configurable:!0,get:function(){return this.$},set:function(a){null!==a&&A(a, "boolean",hh,"selectsTextOnActivate");this.$=a}},state:{configurable:!0,get:function(){return this.oa},set:function(a){this.oa!==a&&(hb(a,hh,hh,"starting"),this.oa=a)}}});hh.prototype.measureTemporaryTextBlock=hh.prototype.ty; var xh=new E(hh,"LostFocus",0),sh=new E(hh,"MouseDown",1),nh=new E(hh,"Tab",2),mh=new E(hh,"Enter",3),yh=new E(hh,"SingleClick",0),jh=new E(hh,"SingleClickSelected",1),th=new E(hh,"DoubleClick",2),kh=new E(hh,"StateNone",0),oh=new E(hh,"StateActive",1),ph=new E(hh,"StateEditing",2),vh=new E(hh,"StateValidating",3),qh=new E(hh,"StateInvalid",4),uh=new E(hh,"StateValidated",5),rh=null;hh.className="TextEditingTool";hh.LostFocus=xh;hh.MouseDown=sh;hh.Tab=nh;hh.Enter=mh;hh.SingleClick=yh; hh.SingleClickSelected=jh;hh.DoubleClick=th;hh.StateNone=kh;hh.StateActive=oh;hh.StateEditing=ph;hh.StateValidating=vh;hh.StateInvalid=qh;hh.StateValidated=uh;Sa("textEditingTool",function(){return this.findTool("TextEditing")},function(a){this.bb("TextEditing",a,this.mouseUpTools)}); function zh(){Ah||(Bh(),Ah=!0);this.B=Pe;this.tl=this.lf=this.wc=this.ks=this.nc=!1;this.Ix=!0;this.ul=Ch;this.rn=!1;this.Ai=this.Tc=!0;this.dh=600;this.ex=this.Hx=!1;this.We=new I;this.Jd=new Dh;this.Jd.Qc=this;this.Pk=new I;this.lv=new I;this.it=new I}zh.prototype.he=function(a){this.B=a};zh.prototype.canStart=function(){return!0};function Eh(a,b){Fh(a,b)&&(a.lf=!0)}function Fh(a,b){if(!a.Tc||!a.canStart(b))return!1;a.We.add(b);a.defaultAnimation.isAnimating&&a.ed();return a.wc=!0} function Gh(a){if(a.Tc&&a.wc){var b=a.Jd,c=a.B,d=a.We.contains("Model");d&&(a.tl=!0,a.ul===Ch?(b.isViewportUnconstrained=!0,b.vc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.ul===Th&&b.vc.clear(),a.Ix=a.ul===Uh&&c.Qs.A(c.sa)?!0:!1,c.U("InitialAnimationStarting",a));d&&!a.Ai||0===b.vc.count?(a.We.clear(),a.wc=!1,a.lf=!1,b.vc.clear(),Vh(b),a.tl=!1,c.P()):(a.We.clear(),c.Le=!1,qa.requestAnimationFrame(function(){!1===a.wc||b.nc||(c.Qe("temporaryPixelRatio")&& hf(c),Wh(c),a.wc=!1,a.lf=!1,b.start(),Xh(a),c.Ta(),Yh(b,0),Vf(c,!0),Zh(a),c.U("AnimationStarting",a))}))}}function $h(a,b,c,d){b instanceof R&&(null!==b.fromNode||null!==b.toNode)||a.Jd.add(b,"position",c,d,!1)}t=zh.prototype;t.Ut=function(a){return this.Jd.Ut(a)};t.$v=function(a){return this.Jd.$v(a)}; function ai(a,b){function c(){0<e.it.count&&(d.addAll(e.it),e.it.clear(),e.nc=!0);if(!1!==e.nc&&0!==d.count){e.lv.addAll(d);for(var a=e.lv.iterator;a.next();){var b=a.value;if(!1!==b.nc){a:if(0<b.jm.count)var h=!0;else{for(h=b.vc.iterator;h.next();){var k=h.key;if(k instanceof N&&null!==k.diagram||k instanceof P){h=!0;break a}}h=!1}h?bi(b,!1):b.Cl=!0}}e.lv.clear();Xh(e);Vf(e.B);Zh(e);qa.requestAnimationFrame(c)}}var d=a.Pk,e=a;a.nc?a.it.add(b):(a.nc=!0,d.add(b),qa.requestAnimationFrame(function(){c()}))} function ci(a){for(a=a.Pk.iterator;a.next();)a.value.Cl=!1}function Xh(a){if(!a.ks){var b=a.B;a.Hx=b.skipsUndoManager;a.ex=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.ks=!0}}function Zh(a){var b=a.B;b.skipsUndoManager=a.Hx;b.skipsModelSourceBindings=a.ex;a.ks=!1} t.ed=function(a){var b=this.Jd;!0===this.wc&&(this.tl=this.lf=this.wc=!1,this.We.clear(),0<b.vc.count&&this.B.Vb());if(this.nc&&this.Tc){if(b.um(!0),b.vc.clear(),Vh(b),!0===a)for(a=this.Pk.ua(),b=0;b<a.length;b++)a[b].um(!0)}else b.vc.clear(),Vh(b)};t.um=function(a){a===this.defaultAnimation&&this.defaultAnimation.vc.clear();this.Pk.remove(a);0===this.Pk.count&&(this.nc=!1,this.B.Vb());a===this.defaultAnimation&&(this.defaultAnimation.vc.clear(),this.B.U("AnimationFinished",this))}; t.gk=function(a,b){this.lf&&(this.We.contains("Expand Tree")||this.We.contains("Expand SubGraph"))&&this.Jd.gk(a,b)};t.ek=function(a,b){this.lf&&(this.We.contains("Collapse Tree")||this.We.contains("Collapse SubGraph"))&&(this.Jd.ek(a,b),di(this.Jd,b,"position",b.position,b.position))};function ei(a,b,c){a.lf&&!b.A(c)&&(a.B.xk||(b=c.copy()),di(a.Jd,a.B,"position",b,c))} function fi(a,b,c,d,e){null===a&&(a="rgba(0,0,0,0)");null===b&&(b="rgba(0,0,0,0)");gi(a);hi();var f=ii.l,g=ii.L,h=ii.w;a=ii.$;gi(b);hi();var k=ii.L,l=ii.w;b=ii.$;f=e(c,f,ii.l-f,d);g=e(c,g,k-g,d);h=e(c,h,l-h,d);c=e(c,a,b-a,d);return"hsla("+f+", "+g+"%, "+h+"%, "+c+")"} function Bh(){var a=new Db;a.add("position:diagram",function(a,c,d,e,f,g){a.position=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position",function(a,c,d,e,f,g){f<g?a.ar(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!1):a.position=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("location",function(a,c,d,e,f,g){f<g?a.ar(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g),!0):a.location=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:placeholder",function(a,c,d,e,f,g){f<g?a.ar(e(f,c.x,d.x-c.x, g),e(f,c.y,d.y-c.y,g),!1):a.position=new J(e(f,c.x,d.x-c.x,g),e(f,c.y,d.y-c.y,g))});a.add("position:node",function(a,c,d,e,f,g){var b=a.actualBounds,k=d.actualBounds;d=k.x+k.width/2-b.width/2;b=k.y+k.height/2-b.height/2;f<g?a.ar(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g),!1):a.position=new J(e(f,c.x,d-c.x,g),e(f,c.y,b-c.y,g))});a.add("desiredSize",function(a,c,d,e,f,g){a.desiredSize=new L(e(f,c.width,d.width-c.width,g),e(f,c.height,d.height-c.height,g))});a.add("width",function(a,c,d,e,f,g){a.width=e(f,c, d-c,g)});a.add("height",function(a,c,d,e,f,g){a.height=e(f,c,d-c,g)});a.add("fill",function(a,c,d,e,f,g){a.fill=fi(c,d,f,g,e)});a.add("stroke",function(a,c,d,e,f,g){a.stroke=fi(c,d,f,g,e)});a.add("strokeWidth",function(a,c,d,e,f,g){a.strokeWidth=e(f,c,d-c,g)});a.add("strokeDashOffset",function(a,c,d,e,f,g){a.strokeDashOffset=e(f,c,d-c,g)});a.add("background",function(a,c,d,e,f,g){a.background=fi(c,d,f,g,e)});a.add("areaBackground",function(a,c,d,e,f,g){a.areaBackground=fi(c,d,f,g,e)});a.add("opacity", function(a,c,d,e,f,g){a.opacity=e(f,c,d-c,g)});a.add("scale",function(a,c,d,e,f,g){a.scale=e(f,c,d-c,g)});a.add("angle",function(a,c,d,e,f,g){a.angle=e(f,c,d-c,g)});ji=a} ma.Object.defineProperties(zh.prototype,{animationReasons:{configurable:!0,get:function(){return this.We}},isEnabled:{configurable:!0,get:function(){return this.Tc},set:function(a){A(a,"boolean",zh,"isEnabled");this.Tc=a}},duration:{configurable:!0,get:function(){return this.dh},set:function(a){A(a,"number",zh,"duration");1>a&&ya(a,">= 1",zh,"duration");this.dh=a}},isAnimating:{configurable:!0,get:function(){return this.nc}},isTicking:{configurable:!0, enumerable:!0,get:function(){return this.ks}},isInitial:{configurable:!0,get:function(){return this.Ai},set:function(a){A(a,"boolean",zh,"isInitial");this.Ai=a}},defaultAnimation:{configurable:!0,get:function(){return this.Jd}},activeAnimations:{configurable:!0,get:function(){return this.Pk}},initialAnimationStyle:{configurable:!0,get:function(){return this.ul},set:function(a){F&&hb(a,zh,zh,"initialAnimationStyle");this.ul=a}}}); zh.prototype.stopAnimation=zh.prototype.ed;var ji=null,Ah=!1,Ch=new E(zh,"Default",1),Uh=new E(zh,"AnimateLocations",2),Th=new E(zh,"None",3);zh.className="AnimationManager";zh.defineAnimationEffect=function(a,b){Ah||(Bh(),Ah=!0);ji.add(a,b)};zh.Default=Ch;zh.AnimateLocations=Uh;zh.None=Th; function Dh(){this.pv=this.Gx=this.Qc=this.B=null;this.Cl=this.nc=this.l=!1;this.Wn=this.Ad=0;this.Fr=this.Cu=ki;this.Bl=this.Cp=!1;this.fv=1;this.dv=0;this.td=this.dh=NaN;this.ix=0;this.Xn=null;this.w=Rb;this.vc=new Db;this.$u=new Db;this.jm=new I;this.av=new I;this.gx=li}Dh.prototype.suspend=function(){this.Cl=!0};Dh.prototype.advanceTo=function(a,b){b&&(this.Cl=!1);this.Cp&&a>=this.td&&(this.Bl=!0,a-=this.td);this.ix=a;bi(this,!0);Xh(this.Qc);Vf(this.B);Zh(this.Qc);this.B.ge()}; function Vh(a){a.$u.clear();a.Bl=!1;a.dv=0;a.td=NaN;0<a.jm.count&&a.jm.clear();0<a.av.count&&a.av.clear()}t=Dh.prototype; t.start=function(){if(0!==this.vc.count&&!this.nc){for(var a=this.B,b=this.vc.iterator;b.next();){var c=b.value.end,d=b.key;if(c["position:placeholder"]){var e=d.findVisibleNode();if(e instanceof Hf&&null!==e.placeholder){var f=e.placeholder;e=f.ma(Hc);f=f.padding;e.x+=f.left;e.y+=f.top;c["position:placeholder"]=e}}null===a&&(d instanceof P?a=d:d instanceof N&&(a=d.diagram))}null!==a&&(this.B=a,b=this.Qc=a.animationManager,this.td=isNaN(this.dh)?b.duration:this.dh,this.Fr=this.Cu,b.tl&&b.ul===Ch&& this===b.defaultAnimation&&(this.Fr=mi,this.td=isNaN(this.dh)?600===b.duration?900:b.duration:this.dh),this.gx=a.scrollMode,this.isViewportUnconstrained&&(a.Ri=ni),Xh(b),this.jm.each(function(b){b.data=null;a.add(b)}),Zh(b),this.nc=!0,this.Ad=+new Date,this.Wn=this.Ad+this.td,ai(b,this))}}; t.ez=function(a,b){a.bc()&&(F&&(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.B&&this.B!==b&&v("addTemporaryPart: A different Diagram is already associated with this Animation: "+this.B.toString())),this.jm.add(a),this.B=b)}; t.add=function(a,b,c,d,e){"position"===b&&c.A(d)||(null===this.B&&(a instanceof P?this.B=a:a instanceof N&&null!==a.diagram&&(this.B=a.diagram)),a instanceof S&&!a.isAnimated||di(this,a,b,c,d,e))}; function di(a,b,c,d,e,f){var g=a.vc;b instanceof P&&"position"===c&&(c="position:diagram");if(g.contains(b)){var h=g.K(b);var k=h.start;var l=h.end;void 0===k[c]&&(k[c]=oi(d));l[c]=oi(e)}else k={},l={},k[c]=oi(d),l[c]=oi(e),h=k.position,b instanceof N&&h instanceof J&&!h.o()&&b.diagram.animationManager.We.contains("Expand SubGraph")&&h.assign(l.position),h=new pi(k,l,f),g.add(b,h);g=k[c];g instanceof J&&!g.o()&&g.assign(a.w);f&&0===c.indexOf("position:")&&b instanceof S?h.Jv.location=oi(b.location): f&&(h.Jv[c]=oi(d))}function oi(a){return a instanceof J?a.copy():a instanceof Hb?a.copy():a}t.Ut=function(a){if(!this.nc)return!1;a=this.vc.K(a);return null!==a&&a.mw};t.$v=function(a){if(!this.nc)return!1;a=this.vc.K(a);return null!==a&&(a.start.position||a.start.location)}; function bi(a,b){if(!a.Cl||b){var c=a.Qc;if(!1!==a.nc){var d=+new Date,e=d>a.Wn?a.td:d-a.Ad;b&&(e=a.ix,e<a.td?(a.Ad=+new Date-e,a.Wn=a.Ad+a.td):e=a.td);Xh(c);Yh(a,e);Vf(a.B,!0);Zh(c);d>a.Wn&&(a.Cp&&!a.Bl?(a.Ad=+new Date,a.Wn=a.Ad+a.td,a.Bl=!0):a.um(!1))}}} function Yh(a,b){for(var c=a.td,d=a.vc.iterator,e=a.Bl;d.next();){var f=d.key;if(!(f instanceof N&&null===f.diagram)){var g=d.value,h=e?g.end:g.start;g=e?g.start:g.end;var k=ji,l;for(l in g)"position"===l&&(g["position:placeholder"]||g["position:node"])||null===k.get(l)||k.get(l)(f,h[l],g[l],a.Fr,b,c,a)}}}t.stop=function(){this.nc&&this.um(!0)}; t.um=function(a){null!==this.pv&&this.pv.Jp.remove(this.Gx);if(this.nc){var b=this.B,c=this.Qc;this.Cl=this.nc=c.tl=!1;Xh(c);for(var d=this.vc,e=this.jm.iterator;e.next();)b.remove(e.value);for(e=this.av.iterator;e.next();)e.value.u();e=this.Cp;d=d.iterator;for(var f=ji;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.Jv,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Cv||"position:node"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:h.Cv?k[n]: l[n],this.Fr,this.td,this.td,this)}h.Cv&&void 0!==m.location&&g instanceof S&&(g.location=m.location);h.mw&&g instanceof S&&g.Ub(!1)}if(c.defaultAnimation===this)for(n=this.B.links;n.next();)e=n.value,null===e.wh?(d=e.path,null!==d&&(e.rd=!1,e.u(),d.u())):(e.points=e.wh,e.wh=null);b.Pt.clear();wf(b,!1);b.Ta();b.P();Vf(b,!0);this.isViewportUnconstrained&&(b.scrollMode=this.gx);Zh(c);this.dv++;!a&&this.fv>this.dv?(this.Bl=!1,this.start()):(this.Xn&&this.Xn(this),Vh(this),c.um(this),b.Vb())}}; t.gk=function(a,b){var c=b.actualBounds,d=null;b instanceof Hf&&(d=b.placeholder);null!==d?(c=d.ma(Hc),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 Hf)for(a=a.memberParts;a.next();)d=a.value,d instanceof T&&this.gk(d,b)}; t.ek=function(a,b){if(a.isVisible()){var c=null;b instanceof Hf&&(c=b.placeholder);null!==c?this.add(a,"position:placeholder",a.position,c,!0):this.add(a,"position:node",a.position,b,!0);this.add(a,"scale",a.scale,.01,!0);c=this.vc;c.contains(a)&&(c.K(a).mw=!0);if(a instanceof Hf)for(a=a.memberParts;a.next();)c=a.value,c instanceof T&&this.ek(c,b)}};t.eA=function(a){var b=this.$u.get(a);null===b&&(b={},this.$u.add(a,b));return b}; ma.Object.defineProperties(Dh.prototype,{duration:{configurable:!0,get:function(){return this.dh},set:function(a){A(a,"number",Dh,"duration");1>a&&ya(a,">= 1",Dh,"duration");this.dh=a}},reversible:{configurable:!0,get:function(){return this.Cp},set:function(a){this.Cp=a}},runCount:{configurable:!0,get:function(){return this.fv},set:function(a){0<a?this.fv=a:v("Animation.runCount value must be a positive integer.")}},finished:{configurable:!0, get:function(){return this.Xn},set:function(a){this.Xn!==a&&(null!==a&&A(a,"function",P,"click"),this.Xn=a)}},easing:{configurable:!0,get:function(){return this.Cu},set:function(a){this.Cu=a}},isViewportUnconstrained:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}},isAnimating:{configurable:!0,get:function(){return this.nc}}});Dh.prototype.getTemporaryState=Dh.prototype.eA;Dh.prototype.stop=Dh.prototype.stop;Dh.prototype.add=Dh.prototype.add; Dh.prototype.addTemporaryPart=Dh.prototype.ez;function ki(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function mi(a,b,c,d){return a===d?b+c:c*(-Math.pow(2,-10*a/d)+1)+b}Dh.className="Animation";Dh.EaseLinear=function(a,b,c,d){return c*a/d+b};Dh.EaseInOutQuad=ki;Dh.EaseInQuad=function(a,b,c,d){return c*(a/=d)*a+b};Dh.EaseOutQuad=function(a,b,c,d){return-c*(a/=d)*(a-2)+b};Dh.EaseInExpo=function(a,b,c,d){return 0===a?b:c*Math.pow(2,10*(a/d-1))+b};Dh.EaseOutExpo=mi; function pi(a,b,c){this.start=a;this.end=b;this.Jv={};this.Cv=c;this.mw=!1}pi.className="AnimationState";function qi(a,b,c){this.jd=null;this.nf=a;this.bq=c||ri;this.Uk=null;void 0!==b&&(this.Uk=b,void 0===c&&(this.bq=si))}qi.prototype.copy=function(){var a=new qi(this.nf);a.bq=this.bq;var b=this.Uk;if(null!==b){var c={};void 0!==b.duration&&(c.$x=b.duration);void 0!==b.finished&&(c.$x=b.finished);void 0!==b.easing&&(c.$x=b.easing);a.Uk=c}return a}; function ti(a,b){a=a.Uk;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))} ma.Object.defineProperties(qi.prototype,{propertyName:{configurable:!0,get:function(){return this.nf},set:function(a){this.nf=a}},animationSettings:{configurable:!0,get:function(){return this.Uk},set:function(a){this.Uk=a}},startCondition:{configurable:!0,get:function(){return this.bq},set:function(a){F&&hb(a,qi,qi,"startCondition");this.bq=a}}});var ri=new E(qi,"Default",1),si=new E(qi,"Immediate",2),ui=new E(qi,"Bundled",3);qi.className="AnimationTrigger"; qi.Default=ri;qi.Immediate=si;qi.Bundled=ui;function vi(){0<arguments.length&&za(vi);fb(this);this.B=null;this.Ha=new H;this.Wa="";this.wb=1;this.w=!1;this.Mi=this.L=this.ki=this.ji=this.ii=this.hi=this.fi=this.gi=this.ei=this.mi=this.di=this.li=this.ci=this.bi=!0;this.l=!1;this.op=[]}t=vi.prototype;t.clear=function(){this.Ha.clear();this.op.length=0};t.he=function(a){this.B=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.Ha.iterator;h.next();){var k=h.value;k instanceof Hf?e++:k instanceof T?d++:k instanceof R?f++:k instanceof Te?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.Ha.iterator;a.next();)c=a.value,h+="\n "+c.toString(),d=c.data,null!==d&&pb(d)&&(h+=" #"+pb(d)),c instanceof T?h+=" "+ Qa(d):c instanceof R&&(h+=" "+Qa(c.fromNode)+" "+Qa(c.toNode));return b+" "+this.Ha.count+": "+h}; t.$b=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);if(!1===this.Mi)return null;F&&!a.o()&&v("findObjectAt: Point must have a real value, not: "+a.toString());var d=!1;null!==this.diagram&&this.diagram.viewportBounds.fa(a)&&(d=!0);for(var e=J.alloc(),f=this.Ha.j,g=f.length;g--;){var h=f[g];if((!0!==d||!1!==Jg(h))&&h.isVisible()&&(e.assign(a),Jb(e,h.Cd),h=h.$b(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.dj=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.Mi)return d;F&&!a.o()&&v("findObjectsAt: Point must have a real value, not: "+a.toString());var e=!1;null!==this.diagram&&this.diagram.viewportBounds.fa(a)&&(e=!0);for(var f=J.alloc(),g=this.Ha.j,h=g.length;h--;){var k=g[h];if((!0!==e||!1!==Jg(k))&&k.isVisible()){f.assign(a);Jb(f,k.Cd);var l=k;k.dj(f,b,c,d)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||d.add(l))}}J.free(f);return d}; t.Ff=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.Mi)return e;F&&!a.o()&&v("findObjectsIn: Rect must have a real value, not: "+a.toString());var f=!1;null!==this.diagram&&this.diagram.viewportBounds.Oe(a)&&(f=!0);for(var g=this.Ha.j,h=g.length;h--;){var k=g[h];if((!0!==f||!1!==Jg(k))&&k.isVisible()){var l=k;k.Ff(a,b,c,d,e)&&(null!==b&&(l=b(l)),null===l||null!==c&&!c(l)||e.add(l))}}return e}; t.Ov=function(a,b,c,d,e,f,g){if(!1===this.Mi)return e;for(var h=this.Ha.j,k=h.length;k--;){var l=h[k];if((!0!==g||!1!==Jg(l))&&f(l)&&l.isVisible()){var m=l;l.Ff(a,b,c,d,e)&&(null!==b&&(m=b(m)),null===m||null!==c&&!c(m)||e.add(m))}}return e}; t.Jg=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.Mi)return f;F&&!a.o()&&v("findObjectsNear: Point must have a real value, not: "+a.toString());var g=!1;null!==this.diagram&&this.diagram.viewportBounds.fa(a)&&(g=!0);for(var h=J.alloc(),k=J.alloc(),l=this.Ha.j,m=l.length;m--;){var n=l[m];if((!0!==g||!1!==Jg(n))&&n.isVisible()){h.assign(a);Jb(h,n.Cd); k.h(a.x+b,a.y);Jb(k,n.Cd);var p=n;n.Jg(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.Gd=function(a,b){if(this.visible){var c=void 0===b?a.viewportBounds:b;var d=this.Ha.j,e=d.length;a=La();b=La();for(var f=0;f<e;f++){var g=d[f];g.qx=f;g instanceof R&&!1===g.rd||g instanceof Te&&null!==g.adornedPart||(nc(g.actualBounds,c)?(g.Gd(!0),a.push(g)):(g.Gd(!1),null!==g.adornments&&0<g.adornments.count&&b.push(g)))}for(c=0;c<a.length;c++)for(d=a[c],wi(d),d=d.adornments;d.next();)e=d.value,e.measure(Infinity,Infinity),e.arrange(),e.Gd(!0);for(c=0;c<b.length;c++)d=b[c],d.updateAdornments(), xi(d,!0);Oa(a);Oa(b)}};function yi(a,b){var c=1;1!==a.wb&&(c=b.globalAlpha,b.globalAlpha=c*a.wb);return c}t.hc=function(a,b,c){if(this.visible&&0!==this.wb&&(void 0===c&&(c=!0),c||!this.isTemporary)){c=this.Ha.j;var d=c.length;if(0!==d){var e=yi(this,a),f=this.op;f.length=0;for(var g=b.scale,h=L.alloc(),k=0;k<d;k++)this.$i(a,c[k],b,f,g,h);L.free(h);a.globalAlpha=e}}}; t.$i=function(a,b,c,d,e,f){if(null!==d&&b instanceof R&&(b.isOrthogonal&&d.push(b),!1===b.rd))return;var g=b.actualBounds;d=!1;var h=b.containingGroup;if(null!==h&&h.isClipping&&h.type!==U.Spot){h.locationObject.zm(f);if(!f.Mc(g))return;d=!f.Oe(g)}d&&(a.save(),a.beginPath(),a.rect(f.x,f.y,f.width,f.height),a.clip());g.width*e>c.Ro||g.height*e>c.Ro?b.hc(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&& (zi(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(zi(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),zi(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.Mt()||(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.yc(!0))}; t.g=function(a,b,c,d,e){var f=this.diagram;null!==f&&f.gb(He,a,this,b,c,d,e)};t.lj=function(a,b,c){var d=this.Ha;b.Fi=this;if(a>=d.count)a=d.count;else if(d.O(a)===b)return-1;d.yb(a,b);b.Gq(c);d=this.diagram;null!==d&&(c?d.P():d.lj(b));Ai(this,a,b);return a}; t.Lc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.Lc(a,b,c);var d=this.Ha;if(0>a||a>=d.length){if(a=d.indexOf(b),0>a)return-1}else if(d.O(a)!==b&&(a=d.indexOf(b),0>a))return-1;b.Hq(c);d.hb(a);d=this.diagram;null!==d&&(c?d.P():d.Lc(b));b.Fi=null;return a}; function Ai(a,b,c){b=Bi(a,b,c);if(c instanceof Hf&&null!==c&&isNaN(c.zOrder)){if(0!==c.memberParts.count){for(var d=-1,e=a.Ha.j,f=e.length,g=0;g<f;g++){var h=e[g];if(h===c&&(b=g,0<=d))break;if(0>d&&h.containingGroup===c&&(d=g,0<=b))break}!(0>d)&&d<b&&(e=a.Ha,e.hb(b),e.yb(d,c))}c=c.containingGroup;null!==c&&Ai(a,-1,c)}} function Bi(a,b,c){var d=c.zOrder;if(isNaN(d))return b;a=a.Ha;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.O(f).zOrder;if(!isNaN(g))break;f--}for(var h=b+1,k=NaN;h<e;){k=a.O(h).zOrder;if(!isNaN(k))break;h++}if(!isNaN(g)&&g>d)for(;;){if(-1===f||g<=d){f++;if(f===b)break;a.hb(b);a.yb(f,c);return f}for(g=NaN;0<=--f&&(g=a.O(f).zOrder,isNaN(g)););}else if(!isNaN(k)&&k<d)for(;;){if(h===e||k>=d){h--;if(h===b)break;a.hb(b);a.yb(h,c);return h}for(k=NaN;++h< e&&(k=a.O(h).zOrder,isNaN(k)););}return b} ma.Object.defineProperties(vi.prototype,{parts:{configurable:!0,get:function(){return this.Ha.iterator}},partsBackwards:{configurable:!0,get:function(){return this.Ha.iteratorBackwards}},diagram:{configurable:!0,get:function(){return this.B}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){A(a,"string",vi,"name");var b=this.Wa;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.Wa=a;this.g("name",b,a);for(a=this.Ha.iterator;a.next();)a.value.layerName=this.Wa}}},opacity:{configurable:!0,get:function(){return this.wb},set:function(a){var b=this.wb;b!==a&&(A(a,"number",vi,"opacity"),(0>a||1<a)&&ya(a,"0 <= value <= 1",vi,"opacity"),this.wb=a,this.g("opacity",b,a),a=this.diagram,null!==a&&a.P())}},isTemporary:{configurable:!0,get:function(){return this.w}, set:function(a){var b=this.w;b!==a&&(A(a,"boolean",vi,"isTemporary"),this.w=a,this.g("isTemporary",b,a))}},visible:{configurable:!0,get:function(){return this.L},set:function(a){var b=this.L;if(b!==a){A(a,"boolean",vi,"visible");this.L=a;this.g("visible",b,a);for(b=this.Ha.iterator;b.next();)b.value.Ub(a);a=this.diagram;null!==a&&a.P()}}},pickable:{configurable:!0,get:function(){return this.Mi},set:function(a){var b=this.Mi;b!==a&&(A(a,"boolean",vi,"pickable"),this.Mi= a,this.g("pickable",b,a))}},isBoundsIncluded:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(this.l=a,null!==this.diagram&&this.diagram.Ta())}},allowCopy:{configurable:!0,get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(A(a,"boolean",vi,"allowCopy"),this.bi=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.ci},set:function(a){var b=this.ci;b!==a&&(A(a,"boolean",vi,"allowDelete"), this.ci=a,this.g("allowDelete",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.li},set:function(a){var b=this.li;b!==a&&(A(a,"boolean",vi,"allowTextEdit"),this.li=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0,get:function(){return this.di},set:function(a){var b=this.di;b!==a&&(A(a,"boolean",vi,"allowGroup"),this.di=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.mi},set:function(a){var b= this.mi;b!==a&&(A(a,"boolean",vi,"allowUngroup"),this.mi=a,this.g("allowUngroup",b,a))}},allowLink:{configurable:!0,get:function(){return this.ei},set:function(a){var b=this.ei;b!==a&&(A(a,"boolean",vi,"allowLink"),this.ei=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.gi},set:function(a){var b=this.gi;b!==a&&(A(a,"boolean",vi,"allowRelink"),this.gi=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0,get:function(){return this.fi}, set:function(a){var b=this.fi;b!==a&&(A(a,"boolean",vi,"allowMove"),this.fi=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(A(a,"boolean",vi,"allowReshape"),this.hi=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(A(a,"boolean",vi,"allowResize"),this.ii=a,this.g("allowResize",b,a))}},allowRotate:{configurable:!0, enumerable:!0,get:function(){return this.ji},set:function(a){var b=this.ji;b!==a&&(A(a,"boolean",vi,"allowRotate"),this.ji=a,this.g("allowRotate",b,a))}},allowSelect:{configurable:!0,get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(A(a,"boolean",vi,"allowSelect"),this.ki=a,this.g("allowSelect",b,a))}}});vi.prototype.findObjectsNear=vi.prototype.Jg;vi.prototype.findObjectsIn=vi.prototype.Ff;vi.prototype.findObjectsAt=vi.prototype.dj;vi.prototype.findObjectAt=vi.prototype.$b; vi.className="Layer"; function P(a){function b(){c.removeEventListener(qa.document,"DOMContentLoaded",b,!1);c.setRTL()}1<arguments.length&&v("Diagram constructor can only take one optional argument, the DIV HTML element or its id.");Ci||(Di(),Ci=!0);fb(this);Pe=this;Xa=[];this.Xb=!0;this.Qc=new zh;this.Qc.he(this);this.rb=17;this.Al=this.hv=!1;this.Ps="default";this.Ra=null;var c=this;gh&&(null!==qa.document.body?this.setRTL():c.addEventListener(qa.document,"DOMContentLoaded",b,!1));this.Oa=new H;this.Ca=this.Da=0;this.ya= null;this.Bx=new Db;this.pf=this.Kb=null;this.tw();this.Hj=null;this.sw();this.wb=1;this.sa=(new J(NaN,NaN)).freeze();this.Qs=new J(NaN,NaN);this.Nn=this.Fa=1;this.$r=(new J(NaN,NaN)).freeze();this.bs=NaN;this.us=1E-4;this.ss=100;this.sb=new Ib;this.qt=(new J(NaN,NaN)).freeze();this.Vr=(new L(NaN,NaN,NaN,NaN)).freeze();this.Qi=(new lc(0,0,0,0)).freeze();this.Ri=li;this.Ys=!1;this.Rs=this.Ls=null;this.Ug=Ei;this.xj=ld;this.fg=Ei;this.oo=ld;this.cs=this.Zr=Hc;this.Gc=!0;this.yl=!1;this.ud=new I;this.ah= new Db;this.jl=!0;this.on=250;this.vj=-1;this.qn=(new lc(16,16,16,16)).freeze();this.Bj=this.Le=!1;this.Ej=!0;this.cg=new we;this.cg.diagram=this;this.Zd=new we;this.Zd.diagram=this;this.mh=new we;this.mh.diagram=this;this.Be=this.Vf=null;this.ak=!1;this.Mr=this.Nr=null;this.kn=qa.PointerEvent&&($a||bb||cb)&&qa.navigator&&!1!==qa.navigator.msPointerEnabled;Fi(this);this.Hh=new I;this.ls=!0;this.lt=Gi;this.Mu=!1;this.nt=$f;this.Na=null;Hi.add("Model",Ii);this.Gr=this.Jr=this.jt=null;this.Mn=this.Er= "auto";this.og=this.xs=this.qg=this.rg=this.tg=this.Xf=this.ag=this.Wf=null;this.Yr=!1;this.Yf=this.Dg=this.sg=this.pg=null;this.ys=!1;this.Js={};this.Wj=[null,null];this.yr=null;this.Kr=this.bt=this.jv=this.Bg=!1;this.Su=!0;this.zi=this.Hc=!1;this.gc=null;var d=this;this.qd=function(a){var b=d.partManager;if(a.model===b.diagram.model&&b.diagram.ba){b.diagram.ba=!1;try{var c=a.change;""===a.modelChange&&c===He&&b.updateDataBindings(a.object,a.propertyName)}finally{b.diagram.ba=!0}}};this.Oc=function(a){d.partManager.doModelChanged(a)}; this.rv=!0;this.Pd=-2;this.Ni=new Db;this.Is=new H;this.hg=!1;this.ci=this.bi=this.kr=this.Tc=!0;this.lr=!1;this.sr=this.qr=this.ki=this.ji=this.ii=this.hi=this.fi=this.gi=this.ei=this.pr=this.mi=this.di=this.li=this.mr=!0;this.gg=this.Ou=!1;this.rr=this.nr=this.ql=this.pl=!0;this.Xs=this.Ts=16;this.Ss=this.Lp=!1;this.Mp=this.Vs=null;this.Us=this.Ws=0;this.lb=(new lc(5)).freeze();this.iv=(new I).freeze();this.ts=999999999;this.Ju=(new I).freeze();this.yi=this.xi=this.wi=!0;this.df=this.te=!1;this.oc= null;this.Rf=!0;this.ue=!1;this.sx=new I;this.Ku=new I;this.Nb=null;this.Pl=1;this.kv=0;this.$d={scale:1,position:new J,bounds:new L,bw:!1};this.Jx=(new L(NaN,NaN,NaN,NaN)).freeze();this.lm=(new Hb(NaN,NaN)).freeze();this.On=(new L(NaN,NaN,NaN,NaN)).freeze();this.ms=!1;this.Go=this.mo=this.hp=this.xu=this.wu=this.yu=this.jg=this.kh=this.kf=this.Qr=null;Ji(this);this.Mb=null;this.lo=!1;this.yj=null;this.partManager=new Ii;this.toolManager=new Ua;this.toolManager.initializeStandardTools();this.currentTool= this.defaultTool=this.toolManager;this.Pr=null;this.cl=new ef;this.Ds=this.Cs=null;this.eq=!1;this.commandHandler=Ki();this.model=Li();this.Bg=!0;Mi(this);this.layout=new Ni;this.Bg=!1;this.kx=this.Bu=null;this.Yb=1;this.Ch=null;this.Ro=1;this.Yo=0;this.Zo=[0,0,0,0,0];this.$o=0;this.vd=1;this.Mj=0;this.Bo=new J;this.kt=500;this.pn=new J;this.ve=!1;this.preventDefault=this.Yt=this.Jm=this.Km=this.Im=this.Hm=this.Dk=this.Fk=this.Ek=this.Bk=this.Ck=this.Nw=this.Fw=this.Gw=this.Hw=this.vh=this.Tl=this.uh= this.Sl=null;this.ro=!1;this.vi=new Oi;this.fq=!1;void 0!==a&&Pi(this,a);this.Yn=null;this.Zn=Vb;this.Xb=!1}P.prototype.clear=function(){this.animationManager.ed();this.model.clear();Qi=null;Ri="";Yi(this,!1);this.Ta();Zi(this);this.P()}; function Yi(a,b){a.animationManager.ed(!0);a.iv=(new I).freeze();a.Ju=(new I).freeze();var c=a.skipsUndoManager;null!==a.model&&(a.skipsUndoManager=!0);var d=null;null!==a.Mb&&(d=a.Mb.part,null!==d&&a.remove(d));var e=[],f=a.Oa.length;if(b){for(b=0;b<f;b++)for(var g=a.Oa.j[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.Oa.j[b].clear();a.partManager.clear();a.ud.clear();a.ah.clear();a.Hh.clear();a.yj=null;Na=[];null!==d&&(a.add(d), a.partManager.parts.remove(d));null!==a.model&&(a.skipsUndoManager=c);return e}function Ki(){return null} P.prototype.reset=function(){this.clear();this.Xb=!0;this.Qc=new zh;this.Qc.he(this);this.rb=17;this.Al=this.hv=!1;this.Ps="default";this.Oa=new H;this.Bx=new Db;this.pf=null;this.tw();this.Hj=null;this.sw();this.wb=1;this.sa=(new J(NaN,NaN)).freeze();this.Qs=new J(NaN,NaN);this.Nn=this.Fa=1;this.$r=(new J(NaN,NaN)).freeze();this.bs=NaN;this.us=1E-4;this.ss=100;this.sb=new Ib;this.qt=(new J(NaN,NaN)).freeze();this.Vr=(new L(NaN,NaN,NaN,NaN)).freeze();this.Qi=(new lc(0,0,0,0)).freeze();this.Ri=li; this.Ys=!1;this.Rs=this.Ls=null;this.Ug=Ei;this.xj=ld;this.fg=Ei;this.oo=ld;this.cs=this.Zr=Hc;this.Gc=!0;this.yl=!1;this.ud=new I;this.ah=new Db;this.jl=!0;this.on=250;this.vj=-1;this.qn=(new lc(16,16,16,16)).freeze();this.Bj=this.Le=!1;this.Ej=!0;this.cg=new we;this.cg.diagram=this;this.Zd=new we;this.Zd.diagram=this;this.mh=new we;this.mh.diagram=this;this.Be=this.Vf=null;this.ak=!1;this.Mr=this.Nr=null;this.kn=qa.PointerEvent&&($a||bb||cb)&&qa.navigator&&!1!==qa.navigator.msPointerEnabled;Fi(this); this.Hh=new I;this.ls=!0;this.lt=Gi;this.Mu=!1;this.nt=$f;this.Gr=this.Jr=this.jt=null;this.Mn=this.Er="auto";this.og=this.xs=this.qg=this.rg=this.tg=this.Xf=this.ag=this.Wf=null;this.Yr=!1;this.Yf=this.Dg=this.sg=this.pg=null;this.ys=!1;this.Js={};this.Wj=[null,null];this.yr=null;this.Kr=this.bt=this.jv=this.Bg=!1;this.Su=!0;this.zi=this.Hc=!1;this.rv=!0;this.Pd=-2;this.Ni=new Db;this.Is=new H;this.hg=!1;this.ci=this.bi=this.kr=this.Tc=!0;this.lr=!1;this.sr=this.qr=this.ki=this.ji=this.ii=this.hi= this.fi=this.gi=this.ei=this.pr=this.mi=this.di=this.li=this.mr=!0;this.gg=this.Ou=!1;this.rr=this.nr=this.ql=this.pl=!0;this.Xs=this.Ts=16;this.Ss=this.Lp=!1;this.Us=this.Ws=0;this.lb=(new lc(5)).freeze();this.iv=(new I).freeze();this.ts=999999999;this.Ju=(new I).freeze();this.yi=this.xi=this.wi=!0;this.df=this.te=!1;this.oc=null;this.Rf=!0;this.ue=!1;this.sx=new I;this.Ku=new I;this.Nb=null;this.Pl=1;this.kv=0;this.$d={scale:1,position:new J,bounds:new L,bw:!1};this.Jx=(new L(NaN,NaN,NaN,NaN)).freeze(); this.lm=(new Hb(NaN,NaN)).freeze();this.On=(new L(NaN,NaN,NaN,NaN)).freeze();this.ms=!1;this.Go=this.mo=this.hp=this.xu=this.wu=this.yu=this.jg=this.kh=this.kf=null;Ji(this);this.Mb=null;this.lo=!1;this.yj=null;this.partManager=new Ii;this.toolManager=new Ua;this.toolManager.initializeStandardTools();this.currentTool=this.defaultTool=this.toolManager;this.Pr=null;this.cl=new ef;this.Ds=this.Cs=null;this.eq=!1;this.commandHandler=Ki();this.Bg=!0;Mi(this);this.layout=new Ni;this.Bg=!1;this.model=Li(); this.model.undoManager=new Me;this.ue=!1;this.Ej=!0;this.Le=!1;this.Yb=1;this.Ch=null;this.Ro=1;this.Yo=0;this.Zo=[0,0,0,0,0];this.$o=0;this.vd=1;this.Mj=0;this.Bo=new J;this.kt=500;this.pn=new J;this.ve=!1;this.vh=this.Tl=this.uh=this.Sl=null;this.fq=this.ro=!1;this.Yn=null;this.Zn=Vb;this.Xb=!1;this.P()}; function Ji(a){a.kf=new Db;var b=new T,c=new ih;c.bind(new $i("text","",Qa));b.add(c);a.yu=b;a.kf.add("",b);b=new T;c=new ih;c.stroke="brown";c.bind(new $i("text","",Qa));b.add(c);a.kf.add("Comment",b);b=new T;b.selectable=!1;b.avoidable=!1;c=new Yf;c.figure="Ellipse";c.fill="black";c.stroke=null;c.desiredSize=(new Hb(3,3)).ia();b.add(c);a.kf.add("LinkLabel",b);a.kh=new Db;b=new Hf;b.selectionObjectName="GROUPPANEL";b.type=U.Vertical;c=new ih;c.font="bold 12pt sans-serif";c.bind(new $i("text","", Qa));b.add(c);c=new U(U.Auto);c.name="GROUPPANEL";var d=new Yf;d.figure="Rectangle";d.fill="rgba(128,128,128,0.2)";d.stroke="black";c.add(d);d=new Kg;d.padding=(new lc(5,5,5,5)).ia();c.add(d);b.add(c);a.wu=b;a.kh.add("",b);a.jg=new Db;b=new R;c=new Yf;c.isPanelMain=!0;b.add(c);c=new Yf;c.toArrow="Standard";c.fill="black";c.stroke=null;c.strokeWidth=0;b.add(c);a.xu=b;a.jg.add("",b);b=new R;c=new Yf;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.jg.add("Comment",b);b=new Te;b.type=U.Auto;c=new Yf;c.fill= null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);c=new Kg;c.margin=(new lc(1.5,1.5,1.5,1.5)).ia();b.add(c);a.hp=b;a.mo=b;b=new Te;b.type=U.Link;c=new Yf;c.isPanelMain=!0;c.fill=null;c.stroke="dodgerblue";c.strokeWidth=3;b.add(c);a.Go=b} P.prototype.setRTL=function(a){a=void 0===a?this.div:a;null===a&&(a=qa.document.body);var b=ua("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.Ps=c}; P.prototype.setScrollWidth=function(a){a=void 0===a?this.div:a;null===a&&(a=qa.document.body);var b=0;if(gh){var c=aj;b=bj;null===c&&(c=aj=ua("p"),c.style.width="100%",c.style.height="200px",c.style.boxSizing="content-box",b=bj=ua("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||eb||(b=11)}this.rb=b;this.hv=!0};P.prototype.mb=function(a){a.classType===P?this.autoScale=a:Ba(this,a)};P.prototype.toString=function(a){void 0===a&&(a=0);var b="";this.div&&this.div.id&&(b=this.div.id);b='Diagram "'+b+'"';if(0>=a)return b;for(var c=this.Oa.iterator;c.next();)b+="\n "+c.value.toString(a-1);return b};P.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,d)}; P.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,d)}; function cj(a){var b=a.ya.Ja;b instanceof HTMLCanvasElement&&(a.kn?(a.addEventListener(b,"pointerdown",a.Hm,!1),a.addEventListener(b,"pointermove",a.Im,!1),a.addEventListener(b,"pointerup",a.Km,!1),a.addEventListener(b,"pointerout",a.Jm,!1)):(a.addEventListener(b,"touchstart",a.Hw,!1),a.addEventListener(b,"touchmove",a.Gw,!1),a.addEventListener(b,"touchend",a.Fw,!1),a.addEventListener(b,"mousemove",a.Ck,!1),a.addEventListener(b,"mousedown",a.Bk,!1),a.addEventListener(b,"mouseup",a.Ek,!1),a.addEventListener(b, "mouseout",a.Dk,!1)),a.addEventListener(b,"mouseenter",a.zz,!1),a.addEventListener(b,"mouseleave",a.Az,!1),a.addEventListener(b,"wheel",a.Fk,!1),a.addEventListener(b,"keydown",a.sA,!1),a.addEventListener(b,"keyup",a.tA,!1),a.addEventListener(b,"blur",a.lz,!1),a.addEventListener(b,"focus",a.mz,!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(b,"gesturestart",function(b){a.toolManager.gestureBehavior!== $e&&(a.toolManager.gestureBehavior===Ze?b.preventDefault():a.ve&&a.lastInput.handled||(b.preventDefault(),a.Pl=a.scale,a.currentTool.doCancel()))},!1),a.addEventListener(b,"gesturechange",function(b){if(a.toolManager.gestureBehavior!==$e)if(a.toolManager.gestureBehavior===Ze)b.preventDefault();else if(!a.ve||!a.lastInput.handled){b.preventDefault();var c=b.scale;if(null!==a.Pl){var e=a.ya.getBoundingClientRect();b=new J(b.pageX-window.scrollX-a.Da/e.width*e.left,b.pageY-window.scrollY-a.Ca/e.height* e.top);c=a.Pl*c;e=a.commandHandler;if(c!==a.scale&&e.canResetZoom(c)){var f=a.zoomPoint;a.zoomPoint=b;e.resetZoom(c);a.zoomPoint=f}}}},!1),a.addEventListener(qa,"resize",a.Nw,!1))}function hf(a){30<a.Yo&&(a.Ch=1)}function wf(a,b){null!==a.Ch&&(a.Ch=null,b&&a.Yt(),a.Yo=0,a.Zo=[0,0,0,0,0],a.$o=0)}P.prototype.computePixelRatio=function(){return null!==this.Ch?this.Ch:qa.devicePixelRatio||1};P.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};P.prototype.doMouseDown=function(){this.currentTool.doMouseDown()}; P.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};P.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};P.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};P.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};P.prototype.doFocus=function(){this.focus()};P.prototype.focus=function(){if(this.ya)if(this.scrollsPageOnFocus)this.ya.focus();else{var a=qa.scrollX||qa.pageXOffset,b=qa.scrollY||qa.pageYOffset;this.ya.focus();qa.scrollTo(a,b)}};P.prototype.mz=function(){this.B.U("GainedFocus")}; P.prototype.lz=function(){this.B.U("LostFocus")};function Wh(a){if(null!==a.ya){var b=a.Ra;if(0!==b.clientWidth&&0!==b.clientHeight){a.hv||a.setScrollWidth();var c=a.df?a.rb:0,d=a.te?a.rb:0,e=a.Yb;a.Yb=a.computePixelRatio();a.Yb!==e&&(a.yl=!0,a.Vb());if(b.clientWidth!==a.Da+c||b.clientHeight!==a.Ca+d)a.xi=!0,a.Gc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===Ei&&(a.Bj=!0,b.D()),a.Hc||a.Vb()}}} function Mi(a){var b=new vi;b.name="Background";a.mm(b);b=new vi;b.name="";a.mm(b);b=new vi;b.name="Foreground";a.mm(b);b=new vi;b.name="Adornment";b.isTemporary=!0;a.mm(b);b=new vi;b.name="Tool";b.isTemporary=!0;b.isBoundsIncluded=!0;a.mm(b);b=new vi;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;a.Mx(b,a.wm("Background"))} function dj(a){a.Mb=new U(U.Grid);a.Mb.name="GRID";var b=new Yf;b.figure="LineH";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Mb.add(b);b=new Yf;b.figure="LineH";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Mb.add(b);b=new Yf;b.figure="LineH";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Mb.add(b);b=new Yf;b.figure="LineV";b.stroke="lightgray";b.strokeWidth=.5;b.interval=1;a.Mb.add(b);b=new Yf;b.figure="LineV";b.stroke="gray";b.strokeWidth=.5;b.interval=5;a.Mb.add(b);b=new Yf;b.figure= "LineV";b.stroke="gray";b.strokeWidth=1;b.interval=10;a.Mb.add(b);b=new S;b.add(a.Mb);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.Mb.visible=!1}function ej(){this.B.Ss?this.B.Ss=!1:this.B.isEnabled?this.B.Wx(this):fj(this.B)}function gj(a){this.B.isEnabled?(this.B.Ws=a.target.scrollTop,this.B.Us=a.target.scrollLeft):fj(this.B)} P.prototype.Wx=function(a){if(null!==this.ya){this.Lp=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.Qi,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.Al)switch(this.Ps){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.Us!==u&&(q.x=u/c+e,this.Us=u),this.allowVerticalScroll&&this.Ws!==a.scrollTop&&(q.y=a.scrollTop/c+f,this.Ws=a.scrollTop),this.position=q,J.free(q),this.xi=this.Lp=!1):(q=J.alloc(),a.Uy&&this.allowHorizontalScroll&&(e<l&&(this.position=q.h(u+e,this.position.y)),k>p&&(this.position=q.h(-(this.Vs.scrollWidth-this.Da)+u-this.Da/c+k,this.position.y))),a.Vy&&this.allowVerticalScroll&&(f<b&&(this.position=q.h(this.position.x,a.scrollTop+f)),d>r&&(this.position=q.h(this.position.x, -(this.Vs.scrollHeight-this.Ca)+a.scrollTop-this.Ca/c+d))),J.free(q),hj(this),this.xi=this.Lp=!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.Mp.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.Mp.style.height="1px"))}};P.prototype.computeBounds=function(){0<this.ud.count&&ij(this);return jj(this)}; function jj(a){if(a.fixedBounds.o()){var b=a.fixedBounds.copy();b.tq(a.lb);return b}for(var c=!0,d=a.Oa.j,e=d.length,f=0;f<e;f++){var g=d[f];if(g.visible&&(!g.isTemporary||g.isBoundsIncluded)){g=g.Ha.j;for(var h=g.length,k=0;k<h;k++){var l=g[k];l.isInDocumentBounds&&l.isVisible()&&(l=l.actualBounds,l.o()&&(c?(c=!1,b=l.copy()):b.Nc(l)))}}}c&&(b=new L(0,0,0,0));b.tq(a.lb);return b} P.prototype.computePartsBounds=function(a,b){void 0===b&&(b=!1);var c=null;if(Ga(a))for(var d=0;d<a.length;d++){var e=a[d];!b&&e instanceof R||(e.Eb(),null===c?c=e.actualBounds.copy():c.Nc(e.actualBounds))}else for(a=a.iterator;a.next();)d=a.value,!b&&d instanceof R||(d.Eb(),null===c?c=d.actualBounds.copy():c.Nc(d.actualBounds));return null===c?new L(NaN,NaN,0,0):c}; function kj(a,b){if((b||a.ue)&&!a.Xb&&null!==a.ya&&a.documentBounds.o()){if(b){var c=a.initialPosition;if(c.o()){a.position=c;return}c=J.alloc();c.pj(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=L.allocAt(0,0,d.width,d.height);var e=J.alloc();e.pj(d,a.initialViewportSpot);e.h(c.x-e.x,c.y-e.y);a.position=e;L.free(d);J.free(e);J.free(c)}a.Xb=!0;c=a.Ug;b&&a.fg!==Ei&&(c=a.fg);d=c!==Ei?lj(a,c):a.scale;c=a.viewportBounds.copy();e=a.Da/d;var f=a.Ca/d,g=a.xj,h=a.oo;b&&!g.ab()&&(h.ab()|| h.Gb())&&(g=h.Gb()?Mc:h);mj(a,a.documentBounds,e,f,g,b);b=a.scale;a.scale=d;a.Xb=!1;d=a.viewportBounds;d.Sa(c)||a.Sq(c,d,b,!1);nj(a);oj(a,!0,!1)}} function lj(a,b){var c=a.Nn;if(null===a.ya)return c;Zi(a);var d=a.documentBounds;if(!d.o())return c;var e=d.width;d=d.height;var f=a.Da+(a.df?a.rb:0),g=a.Ca+(a.te?a.rb:0),h=f/e,k=g/d;return b===pj?(b=Math.min(k,h),b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):b===qj?(b=k>h?(g-a.rb)/d:(f-a.rb)/e,b>c&&(b=c),b<a.minScale&&(b=a.minScale),b>a.maxScale&&(b=a.maxScale),b):a.scale} P.prototype.zoomToFit=function(){var a=this.Ri;this.Ri=li;this.scale=lj(this,pj);a!==li&&(kj(this,!1),mj(this,this.documentBounds,this.Da/this.Fa,this.Ca/this.Fa,this.xj,!1));this.Ri=a};t=P.prototype; t.aB=function(a,b){void 0===b&&(b=pj);var c=a.width,d=a.height;if(!(0===c||0===d||isNaN(c)&&isNaN(d))){var e=1;if(b===pj||b===qj)if(isNaN(c))e=this.viewportBounds.height*this.scale/d;else if(isNaN(d))e=this.viewportBounds.width*this.scale/c;else{e=this.Da;var f=this.Ca;e=b===qj?f/d>e/c?(f-(this.te?this.rb:0))/d:(e-(this.df?this.rb:0))/c:Math.min(f/d,e/c)}this.scale=e;this.position=new J(a.x,a.y)}}; t.fz=function(a,b){Zi(this);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.Yz=function(a){if(a instanceof N){this.Yn=a;var b=J.alloc();this.Zn=this.dr(a.ma(Hc,b));J.free(b)}else this.Yn=null,this.Zn=Vb}; function mj(a,b,c,d,e,f){var g=J.allocAt(a.sa.x,a.sa.y),h=g.x,k=g.y;if(null!==a.Yn){var l=J.alloc();l=a.Yn.ma(Hc,l);h=l.x-a.Zn.x/a.scale;k=l.y-a.Zn.y/a.scale;e=Gc;J.free(l)}if(f||a.scrollMode===li)e.ab()&&(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.Qi,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.lb.left;g.y=isFinite(k)?k:-a.lb.top;null!==a.positionComputation&&(b=a.positionComputation(a,g),g.x=b.x,g.y=b.y);a.Qc.wc&&ei(a.Qc,a.sa,g);a.sa.h(g.x,g.y);J.free(g)} t.xm=function(a,b){void 0===b&&(b=!0);if(b){if(a=If(this,a,function(a){return a.part},function(a){return a.canSelect()}),a instanceof S)return a}else if(a=If(this,a,function(a){return a.part}),a instanceof S)return a;return null};t.$b=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);ij(this);for(var d=this.Oa.iteratorBackwards;d.next();){var e=d.value;if(e.visible&&(e=e.$b(a,b,c),null!==e))return e}return null}; function If(a,b,c,d){void 0===c&&(c=null);void 0===d&&(d=null);ij(a);for(a=a.Oa.iteratorBackwards;a.next();){var e=a.value;if(e.visible&&!e.isTemporary&&(e=e.$b(b,c,d),null!==e))return e}return null}t.Mz=function(a,b,c){void 0===b&&(b=!0);return rj(this,a,function(a){return a.part},b?function(a){return a instanceof S&&a.canSelect()}:null,c)}; function rj(a,b,c,d,e){void 0===c&&(c=null);void 0===d&&(d=null);e instanceof H||e instanceof I||(e=new I);ij(a);for(a=a.Oa.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.dj(b,c,d,e)}return e}t.dj=function(a,b,c,d){void 0===b&&(b=null);void 0===c&&(c=null);d instanceof H||d instanceof I||(d=new I);ij(this);for(var e=this.Oa.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.dj(a,b,c,d)}return d}; t.hy=function(a,b,c,d){void 0===b&&(b=!1);void 0===c&&(c=!0);return sj(this,a,function(a){return a instanceof S&&(!c||a.canSelect())},b,d)};t.Ff=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);ij(this);for(var f=this.Oa.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.Ff(a,b,c,d,e)}return e}; t.Ov=function(a,b,c,d,e,f){var g=new I;ij(this);for(var h=this.Oa.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.Ov(a,b,c,d,g,e,f)}return g};function sj(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);ij(a);for(a=a.Oa.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.Ff(b,f,c,d,e)}return e} t.Nz=function(a,b,c,d,e){void 0===c&&(c=!0);void 0===d&&(d=!0);return tj(this,a,b,function(a){return a instanceof S&&(!d||a.canSelect())},c,e)};t.Jg=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);ij(this);for(var g=this.Oa.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.Jg(a,b,c,d,e,f)}return f}; function tj(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);ij(a);for(a=a.Oa.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.Jg(b,c,g,d,e,f)}return f}P.prototype.acceptEvent=function(a){return uj(this,a,a instanceof MouseEvent)}; function uj(a,b,c){var d=a.Zd;a.Zd=a.mh;a.mh=d;d.diagram=a;d.event=b;c?vj(a,b,d):(d.viewPoint=a.Zd.viewPoint,d.documentPoint=a.Zd.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||Za||(d.buttons=b.buttons);db&&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=wj(b);d.targetObject=null;return d} function wj(a){var b=a.target.B;if(!b){var c=a.path;c||"function"!==typeof a.composedPath||(c=a.composedPath());c&&c[0]&&(b=c[0].B)}return b?b:null}function xj(a,b,c,d){var e=yj(a,b,!0,!1,!0,d);vj(a,c,e);e.targetDiagram=wj(b);e.targetObject=null;d||e.clone(a.cg);return e} function zj(a,b,c,d){var e;d=yj(a,b,!1,!1,!1,d);null!==c?((e=qa.document.elementFromPoint(c.clientX,c.clientY))&&e.B?(b=c,c=e.B):(b=void 0!==b.targetTouches?b.targetTouches[0]:b,c=a),d.targetDiagram=c,vj(a,b,d)):null!==a.Zd?(d.documentPoint=a.Zd.documentPoint,d.viewPoint=a.Zd.viewPoint,d.targetDiagram=a.Zd.targetDiagram):null!==a.cg&&(d.documentPoint=a.cg.documentPoint,d.viewPoint=a.cg.viewPoint,d.targetDiagram=a.cg.targetDiagram);d.targetObject=null;return d} function yj(a,b,c,d,e,f){var g=a.Zd;a.Zd=a.mh;a.mh=g;g.diagram=a;g.clickCount=1;var h=g.delta=0;b.ctrlKey&&(h+=1);b.altKey&&(h+=2);b.shiftKey&&(h+=4);b.metaKey&&(h+=8);g.modifiers=h;g.button=0;g.buttons=1;g.event=b;g.timestamp=b.timeStamp;a.kn&&b instanceof qa.PointerEvent&&"touch"!==b.pointerType&&(g.button=b.button,void 0===b.buttons||Za||(g.buttons=b.buttons),db&&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 Aj(a,b,c){if(b.bubbles)return F&&F.my&&Ca("NOT handled "+c.type+" "+b.toString()),!0;F&&F.my&&Ca("handled "+c.type+" "+a.currentTool.name+" "+b.toString());void 0!==c.stopPropagation&&c.stopPropagation();!1!==c.cancelable&&c.preventDefault();c.cancelBubble=!0;return!1} P.prototype.sA=function(a){var b=this.B;if(!this.B.isEnabled)return!1;var c=uj(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 Aj(b,c,a)}; P.prototype.tA=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=uj(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 Aj(b,c,a)}; P.prototype.zz=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=uj(b,a,!0);null!==b.mouseEnter&&b.mouseEnter(c);return Aj(b,c,a)};P.prototype.Az=function(a){var b=this.B;if(!b.isEnabled)return!1;var c=uj(b,a,!0);null!==b.mouseLeave&&b.mouseLeave(c);return Aj(b,c,a)}; P.prototype.getMouse=function(a){var b=this.ya;if(null===b)return new J(0,0);var c=b.getBoundingClientRect();b=a.clientX-this.Da/c.width*c.left;a=a.clientY-this.Ca/c.height*c.top;return null!==this.sb?Jb(new J(b,a),this.sb):new J(b,a)}; function vj(a,b,c){var d=a.ya,e=a.Da,f=a.Ca,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.sb?(b=J.allocAt(g,h),a.sb.de(b),c.documentPoint.assign(b),J.free(b)):c.documentPoint.h(g,h)} function Ee(a,b,c,d){if(void 0!==b.targetTouches){if(2>b.targetTouches.length)return;b=b.targetTouches[c]}else if(null!==a.Wj[0])b=a.Wj[c];else return;c=a.ya;null!==c&&(c=c.getBoundingClientRect(),d.h(b.clientX-a.Da/c.width*c.left,b.clientY-a.Ca/c.height*c.top))}t=P.prototype;t.Ta=function(){this.wi||(this.wi=!0,this.Vb(!0))};function Bj(a){a.Hc||ij(a);Zi(a)}t.ge=function(){this.Xb||this.Hc||(this.P(),nj(this),hj(this),this.Ta(),this.dd())};t.rA=function(){return this.Le}; t.uz=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.ed();b.isEnabled=!1;Vf(this);this.ue=!1;this.Qs=new J(NaN,NaN);b.isEnabled=c;null!==a&&ta(function(){Eh(b,"Model");a()},1)};t.Vb=function(a){void 0===a&&(a=!1);if(!0!==this.Le&&!(this.Xb||!1===a&&this.Hc)){this.Le=!0;var b=this;qa.requestAnimationFrame(function(){b.Le&&b.dd()})}};t.dd=function(){if(!this.Ej||this.Le)this.Ej&&(this.Ej=!1),Vf(this)}; function oj(a,b,c){a.animationManager.defaultAnimation.isAnimating||a.Xb||!a.xi||fj(a)||(b&&ij(a),c&&kj(a,!1))} function Vf(a,b){if(!a.Hc&&(a.Le=!1,null!==a.Ra||a.lm.o())){a.Hc=!0;var c=a.animationManager,d=a.Is;if(!c.isAnimating&&0!==d.length){for(var e=d.j,f=e.length,g=0;g<f;g++){var h=e[g];Cj(h,!1);h.u()}d.clear()}d=a.Ku;0<d.count&&(d.each(function(a){a.Mw()}),d.clear());e=d=!1;c.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.wc||Wh(a);oj(a,!1,!1);null!==a.Mb&&(a.Mb.visible&&!a.lo&&(Dj(a),a.lo=!0),!a.Mb.visible&&a.lo&&(a.lo=!1));ij(a);f=!1;if(!a.ue||a.Rf)a.ue?Ej(a,!a.Bj):(a.Ba("Initial Layout"), !1===c.isEnabled&&c.ed(),Ej(a,!1)),f=!0;a.Bj=!1;ij(a);a.bt||Bj(a);oj(a,!0,!1);g=!1;f?(c=L.alloc(),c.assign(a.viewportBounds),a.ue||(g=a.ue=!0,a.skipsUndoManager||(a.undoManager.isPendingClear=!0),a.undoManager.isPendingUnmodified=!0,Fj(a)),a.U("LayoutCompleted"),c.A(a.viewportBounds)||oj(a,!0,!1),L.free(c)):c.tl&&c.Ix&&(a.fg!==Ei?a.scale=lj(a,a.fg):a.Ug!==Ei?a.scale=lj(a,a.Ug):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),kj(a,!0));ij(a);f&&g&&a.$a("Initial Layout");a.yv();b||a.hc(a.Kb);e&&(a.skipsUndoManager= d);a.Hc=!1}}function Fj(a){var b=a.Fa;if(a.fg!==Ei)a.scale=lj(a,a.fg);else if(a.Ug!==Ei)a.scale=lj(a,a.Ug);else{var c=a.initialScale;isFinite(c)&&0<c&&(a.scale=c)}a.Fa!==b&&(nj(a),oj(a,!0,!1));kj(a,!0);b=a.Oa.j;a.Gd(b,b.length,a);a.U("InitialLayoutCompleted");a.Qs.assign(a.sa);Dj(a)} function ij(a){if((a.Hc||!a.animationManager.isTicking)&&0!==a.ud.count){for(var b=0;23>b;b++){var c=a.ud.iterator;if(null===c||0===a.ud.count)break;a.ud=new I;a.Mw(c,a.ud);F&&22===b&&Ca("failure to validate parts")}a.nodes.each(function(a){a instanceof Hf&&0!==(a.T&65536)!==!1&&(a.T=a.T^65536)})}} t.Mw=function(a,b){for(a.reset();a.next();){var c=a.value;!c.bc()||c instanceof Hf||(c.nj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}for(a.reset();a.next();)c=a.value,c instanceof Hf&&c.isVisible()&&Gj(this,c);for(a.reset();a.next();)c=a.value,c instanceof R&&c.isVisible()&&(c.nj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Te&&c.isVisible()&&(c.nj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c))}; function Gj(a,b){for(var c=La(),d=La(),e=b.memberParts;e.next();){var f=e.value;f.isVisible()&&(f instanceof Hf?(Hj(f)||Ij(f)||Jj(f))&&Gj(a,f):f instanceof R?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.Gd=function(a,b,c,d){if(this.yi||this.animationManager.isAnimating)for(var e=0;e<b;e++)a[e].Gd(c,d)}; t.hc=function(a,b){void 0===b&&(b=null);if(null!==this.Ra){null===this.ya&&v("No canvas specified");var c=this.animationManager;if(!c.wc&&(!c.isAnimating||c.isTicking)){var d=new Date;Kj(this);if("0"!==this.Ra.style.opacity){var e=a!==this.Kb,f=this.Oa.j,g=f.length,h=this;this.Gd(f,g,h);if(e)a.yc(!0),hj(this);else if(!this.Gc&&null===b&&!c.isAnimating)return;g=this.sa;var k=this.Fa,l=Math.round(g.x*k)/k,m=Math.round(g.y*k)/k;c=this.sb;c.reset();1!==k&&c.scale(k);0===g.x&&0===g.y||c.translate(-l,-m); k=this.Yb;a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.clearRect(0,0,this.Da,this.Ca);a.setTransform(1,0,0,1,0,0);a.scale(k,k);a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);F&&F.pm&&F.Gv&&F.Gv(this,a);Lj(this,a);a.globalAlpha=this.wb;l=null!==b?function(c){var d=b;if(c.visible&&0!==c.wb){var e=c.Ha.j,f=e.length;if(0!==f){var g=yi(c,a),k=c.op;k.length=0;for(var l=h.scale,m=L.alloc(),n=0;n<f;n++){var D=e[n];d.contains(D)||c.$i(a,D,h,k,l,m)}L.free(m);a.globalAlpha=g}}}:function(b){b.hc(a,h)};g=f.length; for(m=0;m<g;m++)a.setTransform(1,0,0,1,0,0),a.scale(k,k),a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy),l(f[m]);this.vi&&Mj(this.vi,this)&&this.Qr();F&&(F.Zx||F.pm)&&F.Hv&&F.Hv(a,this,c);e?(this.Kb.yc(!0),hj(this)):this.Gc=this.yi=!1;e=+new Date-+d;if(null===this.Ch){d=this.Zo;d[this.$o]=e;this.$o=(this.$o+1)%d.length;for(f=e=0;f<this.Zo.length;f++)e+=this.Zo[f];this.Yo=e/d.length}}}}}; function Nj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ra){null===a.ya&&v("No canvas specified");void 0===g&&(g=null);void 0===h&&(h=null);void 0===k&&(k=!1);void 0===l&&(l=!1);Kj(a);a.Kb.yc(!0);hj(a);a.zi=!0;var m=a.Fa;a.Fa=e;var n=a.Oa.j,p=n.length;try{var r=new L(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.tq(c);Dj(a,q);ij(a);a.Gd(n,p,a,r);var u=a.Yb;b.setTransform(1,0,0,1,0,0);b.scale(u,u);b.clearRect(0,0,d.width,d.height);null!==h&&""!==h&&(b.fillStyle=h,b.fillRect(0,0,d.width,d.height));var x=Ib.alloc(); x.reset();x.translate(c.left,c.top);x.scale(e);0===f.x&&0===f.y||x.translate(-f.x,-f.y);b.setTransform(x.m11,x.m12,x.m21,x.m22,x.dx,x.dy);Ib.free(x);Lj(a,b);b.globalAlpha=a.wb;if(null!==g){var y=new I,z=g.iterator;for(z.reset();z.next();){var B=z.value;!1===l&&"Grid"===B.layer.name||null===B||y.add(B)}var D=function(c){if(c.visible&&0!==c.wb&&(k||!c.isTemporary)){var d=c.Ha.j,e=d.length;if(0!==e){var f=yi(c,b),g=c.op;g.length=0;for(var h=a.scale,l=L.alloc(),m=0;m<e;m++){var n=d[m];y.contains(n)&& c.$i(b,n,a,g,h,l)}L.free(l);b.globalAlpha=f}}}}else if(!k&&l){var G=a.grid.part,O=G.layer;D=function(c){c===O?G.hc(b,a):c.hc(b,a,k)}}else D=function(c){c.hc(b,a,k)};for(c=0;c<p;c++)D(n[c]);a.zi=!1;a.vi&&Mj(a.vi,a)&&a.Qr()}finally{a.Fa=m,a.Kb.yc(!0),hj(a),a.Gd(n,p,a),Dj(a)}}}t.Qe=function(a){return this.pf[a]};t.Gy=function(a,b){"minDrawingLength"===a&&(this.Ro=b);this.pf[a]=b;this.ge()}; t.tw=function(){this.pf=new jb;this.pf.drawShadows=!0;this.pf.textGreeking=!0;this.pf.viewportOptimizations=eb||$a||bb?!1:!0;this.pf.temporaryPixelRatio=!0;this.pf.pictureRatioOptimization=!0;this.Ro=this.pf.minDrawingLength=1};function Lj(a,b){a=a.pf;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.Fy(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.Am=function(a){return this.Hj[a]};t.QA=function(a,b){this.Hj[a]=b}; t.sw=function(){this.Hj=new jb;this.Hj.extraTouchArea=10;this.Hj.extraTouchThreshold=10;this.Hj.hasGestureZoom=!0};t.Aw=function(a){Oj(this,a)}; function Oj(a,b){var c=a instanceof U,d=a instanceof P,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.fb(k);else if(f=a[k],void 0===f||null===f)f=a.toolManager[k];Fa(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.Ox(b[g]);continue}else if(d&&"Changed"===g){a.Lh(b[g]);continue}else if(d&& Ra(a.toolManager,g))f=a.toolManager;else if(d&&Pj(a,g)){a.fk(g,b[g]);continue}else if(a instanceof W&&"Changed"===g){a.Lh(b[g]);continue}else v('Trying to set undefined property "'+g+'" on object: '+f.toString());f[g]=b[e];"_"===g[0]&&f instanceof N&&f.Lx(g)}}t.yv=function(){if(0===this.undoManager.transactionLevel&&0!==this.ah.count){for(;0<this.ah.count;){var a=this.ah;this.ah=new Db;for(a=a.iterator;a.next();){var b=a.key;b.Jq(a.value);b.ic()}}this.P()}}; t.P=function(a){void 0===a&&(a=null);if(null===a)this.Gc=!0,this.Vb();else{var b=this.viewportBounds;null!==a&&a.o()&&b.Mc(a)&&(this.Gc=!0,this.Vb())}this.U("InvalidateDraw")}; t.oy=function(a,b){if(!0!==this.Gc){this.Gc=!0;var c=!0===this.Qe("temporaryPixelRatio");if(!0===this.Qe("viewportOptimizations")&&this.scrollMode!==ni&&this.Qi.bj(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=L.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.fq&&0<d.width&&0<d.height){if(!(this.Hc||(this.Le=!1,null===this.Ra||(this.Hc=!0,this.yv(),this.documentBounds.o()|| Qj(this,this.computeBounds()),e=this.ya,null===e||e instanceof Rj)))){var g=this.Yb;f=this.Da*g;var h=this.Ca*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.Bu;a=this.kx;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.Ja,n,p,r,q,0,0,r,q);Mj(this.vi,this)&&a.clearRect(0,0,k,m);e=La();a=La();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 L(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 x=this.sb;x.reset();x.scale(g,g);1!==this.Fa&&x.scale(this.Fa);g=this.sa;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&x.translate(-g.x,-g.y);Jb(n,x);Jb(q,x);e.push(new L(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 L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x- q.x),Math.abs(n.y-q.y)));Jb(n,x);Jb(q,x);e.push(new L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y)));Mj(this.vi,this)&&(f=0<l?0:-l,h=0<b?0:-b,n.h(f,h),q.h(k+f,m+h),a.push(new L(Math.min(n.x,q.x),Math.min(n.y,q.y),Math.abs(n.x-q.x),Math.abs(n.y-q.y))),Jb(n,x),Jb(q,x),e.push(new L(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);oj(this,!1,!0);null===this.Ra&&v("No div specified");null===this.ya&&v("No canvas specified");if(!this.animationManager.wc&& (f=this.Kb,this.Gc)){Kj(this);h=this.Yb;f.setTransform(1,0,0,1,0,0);f.clearRect(0,0,this.Da*h,this.Ca*h);f.drawImage(this.Bu.Ja,0<l?0:Math.round(-l),0<b?0:Math.round(-b));b=this.sa;g=this.Fa;k=Math.round(b.x*g)/g;m=Math.round(b.y*g)/g;l=this.sb;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);F&&F.pm&&F.Gv&&F.Gv(this,f);h=this.Oa.j;b=h.length;this.Gd(h,b,this);Lj(this,f);f.globalAlpha=this.wb;for(g=0;g<b;g++)if(k=h[g],m=e,k.visible&&0!==k.wb){p=yi(k,f);n=k.op;n.length=0;r=this.scale;q=L.alloc();x=k.Ha.j;u=x.length;for(var y=m.length,z=0;z<u;z++){var B=x[z];a:{var D=Sj(B,B.actualBounds);for(var G=m,O=y,X=2/r,Q=4/r,ca=0;ca<O;ca++){var Y=G[ca];if(0!==Y.width&&0!==Y.height&&D.Yv(Y.x-X,Y.y-X,Y.width+Q,Y.height+Q)){D=!0;break a}}D= !1}D&&k.$i(f,B,this,n,r,q)}L.free(q);f.globalAlpha=p}f.restore();f.yc(!0);F&&(F.Zx||F.pm)&&F.Hv&&F.Hv(f,this,l);this.vi&&Mj(this.vi,this)&&this.Qr();this.Gc=this.yi=!1;this.Yt()}Oa(e);Oa(a);this.Hc=!1}}else this.dd();L.free(d);c&&(hf(this),this.dd(),wf(this,!0))}else c?(hf(this),this.dd(),wf(this,!0)):this.dd()}};function nj(a){!1===a.xi&&(a.xi=!0)}function hj(a){!1===a.yi&&(a.yi=!0)}function Kj(a){!1!==a.yl&&(a.yl=!1,Tj(a,a.Da,a.Ca))} function Tj(a,b,c){var d=a.Yb;a.ya.resize(b*d,c*d,b,c)&&(a.Gc=!0,a.Kb.yc(!0))} function fj(a){var b=a.ya;if(null===b)return!0;var c=a.Ra,d=a.Da,e=a.Ca,f=a.viewportBounds.copy();if(!f.o())return!0;var g=!1,h=a.df?a.rb:0,k=a.te?a.rb:0,l=c.clientWidth||d+h,m=c.clientHeight||e+k;if(l!==d+h||m!==e+k)a.df=!1,a.te=!1,k=h=0,a.Da=l,a.Ca=m,g=a.yl=!0;if(!(g||a.df||a.te||a.pl||a.ql))return!0;a.xi=!1;var n=a.viewportBounds,p=a.documentBounds,r=0,q=0,u=0,x=0;c=n.width;var y=n.height,z=a.Qi;a.contentAlignment.ab()?(p.width>c&&(r=z.left,q=z.right),p.height>y&&(u=z.top,x=z.bottom)):(r=z.left, q=z.right,u=z.top,x=z.bottom);z=p.width+r+q;var B=p.height+u+x;r=p.x-r;var D=n.x;q=p.right+q;var G=n.right+h;u=p.y-u;var O=n.y;p=p.bottom+x;n=n.bottom+k;var X="1px",Q="1px";x=a.scale;l=z>l/x;m=B>m/x;a.scrollMode===li&&(l||m)&&(l&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l=1,r+1<D&&(l=Math.max((D-r)*x+a.Da,l)),q>G+1&&(l=Math.max((q-G)*x+a.Da,l)),c+h+1<z&&(l=Math.max((z-c)*x+a.Da,l)),X=l.toString()+"px"),m&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(l=1,u+1<O&&(l=Math.max((O-u)*x+a.Ca, l)),p>n+1&&(l=Math.max((p-n)*x+a.Ca,l)),y+k+1<B&&(l=Math.max((B-y)*x+a.Ca,l)),Q=l.toString()+"px"));l="1px"!==X;m="1px"!==Q;l&&m||!l&&!m||(m&&(G-=a.rb),l&&(n-=a.rb),z<c+h||!a.hasHorizontalScrollbar||!a.allowHorizontalScroll||(h=1,r+1<D&&(h=Math.max((D-r)*x+a.Da,h)),q>G+1&&(h=Math.max((q-G)*x+a.Da,h)),c+1<z&&(h=Math.max((z-c)*x+a.Da,h)),X=h.toString()+"px"),l="1px"!==X,h=a.Ca,l!==a.te&&(h=l?a.Ca-a.rb:a.Ca+a.rb),B<y+k||!a.hasVerticalScrollbar||!a.allowVerticalScroll||(k=1,u+1<O&&(k=Math.max((O-u)*x+ h,k)),p>n+1&&(k=Math.max((p-n)*x+h,k)),y+1<B&&(k=Math.max((B-y)*x+h,k)),Q=k.toString()+"px"),m="1px"!==Q);if(a.Lp&&l===a.te&&m===a.df)return d===a.Da&&e===a.Ca||a.dd(),!1;l!==a.te&&("1px"===X?a.Ca=a.Ca+a.rb:a.Ca=Math.max(a.Ca-a.rb,1),g=!0);a.te=l;a.Mp.style.width=X;m!==a.df&&("1px"===Q?a.Da=a.Da+a.rb:a.Da=Math.max(a.Da-a.rb,1),g=!0,a.Al&&(k=J.alloc(),m?(b.style.left=a.rb+"px",a.position=k.h(a.sa.x+a.rb/a.scale,a.sa.y)):(b.style.left="0px",a.position=k.h(a.sa.x-a.rb/a.scale,a.sa.y)),J.free(k)));a.df= m;a.Mp.style.height=Q;a.Ss=!0;g&&(a.yl=!0);b=a.Vs;k=b.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(c+1<z?k=(a.position.x-r)*x:r+1<D?k=b.scrollWidth-b.clientWidth:q>G+1&&(k=a.position.x*x));if(a.Al)switch(a.Ps){case "negative":k=-(b.scrollWidth-k-b.clientWidth);break;case "reverse":k=b.scrollWidth-k-b.clientWidth}b.scrollLeft=k;a.hasVerticalScrollbar&&a.allowVerticalScroll&&(y+1<B?b.scrollTop=(a.position.y-u)*x:u+1<O?b.scrollTop=b.scrollHeight-b.clientHeight:p>n+1&&(b.scrollTop=a.position.y* x));l=a.Da;m=a.Ca;b.style.width=l+(a.df?a.rb:0)+"px";b.style.height=m+(a.te?a.rb:0)+"px";return d!==l||e!==m||a.animationManager.wc?(a.Sq(f,a.viewportBounds,x,g),!1):!0} t.add=function(a){w(a,S,P,"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.wm(a.layerName),null===b&&(b=this.wm("")),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.lj(99999999,a,a.diagram===this);0<=c&&this.gb(Je,"parts",b,null,a,null,c);b.isTemporary||this.Ta();a.D(1);c=a.layerChanged;null!==c&&c(a,null, b)}};t.lj=function(a){this.partManager.lj(a);var b=this;Uj(a,function(a){Vj(b,a)});(a instanceof Te||a instanceof Hf&&null!==a.placeholder)&&a.u();null!==a.data&&Uj(a,function(a){Wj(b.partManager,a)});!0!==Ij(a)&&!0!==Jj(a)||this.ud.add(a);Xj(a,!0,this);Yj(a)?(a.actualBounds.o()&&this.P(Sj(a,a.actualBounds)),this.Ta()):a.isVisible()&&a.actualBounds.o()&&this.P(Sj(a,a.actualBounds));this.Vb()}; t.Lc=function(a){a.jk();this.partManager.Lc(a);var b=this;null!==a.data&&Uj(a,function(a){Zj(b.partManager,a,b)});this.ud.remove(a);Yj(a)?(a.actualBounds.o()&&this.P(Sj(a,a.actualBounds)),this.Ta()):a.isVisible()&&a.actualBounds.o()&&this.P(Sj(a,a.actualBounds));this.Vb()};t.remove=function(a){w(a,S,P,"remove:part");ak(this,a,!0)}; function ak(a,b,c){var d=b.layer;null!==d&&d.diagram===a&&(b.isSelected=!1,b.isHighlighted=!1,b.D(2),c&&b.qk(),c=d.Lc(-1,b,!1),0<=c&&a.gb(Ke,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.$t=function(a,b){if(Ga(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.pk=function(a,b,c){return this.partManager.pk(a,b,c)}; P.prototype.moveParts=function(a,b,c,d){void 0===d&&(d=bk(this));w(b,J,P,"moveParts:offset");if(null!==this.toolManager){var e=new Db;if(null!==a)if(Ga(a))for(var f=0;f<a.length;f++)ck(this,e,a[f],c,d);else for(a=a.iterator;a.next();)ck(this,e,a.value,c,d);else{for(a=this.parts;a.next();)ck(this,e,a.value,c,d);for(a=this.nodes;a.next();)ck(this,e,a.value,c,d);for(a=this.links;a.next();)ck(this,e,a.value,c,d)}Ef(this,e,b,d,c)}}; function ck(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=bk(a)),c instanceof T){b.add(c,a.zd(e,c,c.location));if(c instanceof Hf)for(f=c.memberParts;f.next();)ck(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)&&ck(a,b,g,d,e)}}if(e.dragsTree)for(c=c.Pv();c.next();)ck(a,b,c.value,d,e)}else if(c instanceof R)for(b.add(c, a.zd(e,c)),c=c.labelNodes;c.next();)ck(a,b,c.value,d,e);else c instanceof Te||b.add(c,a.zd(e,c,c.location))} function Ef(a,b,c,d,e){if(null!==b&&(w(b,Db,P,"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.eq)||jf(a,b);for(var h=La(),k=La(),l=b.iterator,m=J.alloc();l.next();){var n=l.key,p=l.value;if(n.bc()){var r=dk(a,n,b);if(null!==r)h.push(new ek(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.ie(r))}else l.key instanceof R&&k.push(l.ra)}J.free(m); e=h.length;for(l=0;l<e;l++)n=h[l],f.assign(n.info.point),void 0===n.Vv.shifted&&(n.Vv.shifted=new J),n.node.location=f.add(n.Vv.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 R)if(r.suspendsRouting){r.wh=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.zd(d,r,g)),Cf(r,g.x-u.x,g.y-u.y);else{q=J.allocAt(0,0);(m=r.i(0))&&m.o()&&q.assign(m);var x=m=J.alloc().assign(q).add(g);d.isGridSnapEnabled&& (d.isGridSnapRealtime||a.lastInput.up)&&(x=J.alloc(),Tg(a,r,m,x,d));m.assign(r.dragComputation(r,m,x)).ie(q);b.add(r,a.zd(d,r,m));Cf(r,m.x-u.x,m.y-u.y);J.free(q);J.free(m);x!==m&&J.free(x)}else null!==m&&(e.assign(m.location),x=b.K(m),null!==x&&e.ie(x.point)),null!==u&&(l.assign(u.location),x=b.K(u),null!==x&&l.ie(x.point)),null!==m&&null!==u?e.Sa(l)?(m=q.value.point,u=f,u.assign(e),u.ie(m),b.add(r,a.zd(d,r,e)),Cf(r,u.x,u.y)):(r.suspendsRouting=!1,r.Ya()):(q=q.value.point,m=null!==m?e:null!==u?l: g,b.add(r,a.zd(d,r,m)),Cf(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.zd(d,r,g)),Cf(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||(ij(a),sf(a,b))}} P.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(),Tg(this,a,b,e,c));c=null!==a.dragComputation?a.dragComputation(a,b,e):e;var g=a.minLocation,h=g.x;isNaN(h)&&(h=f?Math.round(a.location.x):a.location.x);g=g.y;isNaN(g)&&(g=f?Math.round(a.location.y):a.location.y);var k=a.maxLocation,l=k.x;isNaN(l)&&(l=f?Math.round(a.location.x):a.location.x);k=k.y;isNaN(k)&&(k=f?Math.round(a.location.y): a.location.y);d.h(Math.max(h,Math.min(c.x,l)),Math.max(g,Math.min(c.y,k)));e!==b&&J.free(e);return d};function bk(a){var b=a.toolManager.findTool("Dragging");return null!==b?b.dragOptions:a.cl} function Tg(a,b,c,d,e){void 0===e&&(e=bk(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.Jk(0,0,a,b,e);K.Cq(c.x,c.y,h+f.x,g+f.y,a,b,d);J.free(f)}}function jf(a,b){if(null!==b)for(a.eq=!0,a=b.iterator;a.next();)b=a.key,b instanceof R&&(b.suspendsRouting=!0)} function sf(a,b){if(null!==b){for(b=b.iterator;b.next();){var c=b.key;c instanceof R&&(c.suspendsRouting=!1,fk(c)&&c.Ya())}a.eq=!1}}function dk(a,b,c){b=b.containingGroup;if(null!==b){a=dk(a,b,c);if(null!==a)return a;a=c.K(b);if(null!==a)return a}return null}t=P.prototype;t.zd=function(a,b,c){if(void 0===c)return new mf(Rb);var d=a.isGridSnapEnabled;a.groupsSnapMembers||null===b.containingGroup||(d=!1);return d?new mf(new J(Math.round(c.x),Math.round(c.y))):new mf(c.copy())}; function gk(a,b,c){w(b,vi,P,"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,vi,P,"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.Oa;c=a.count;for(var d=0;d<c;d++)a.O(d).name===b&&v("Cannot add Layer with the name '"+ b+"'; a Layer with the same name is already present in this Diagram.")}}t.mm=function(a){gk(this,a,null);a.he(this);var b=this.Oa,c=b.count-1;if(!a.isTemporary)for(;0<=c&&b.O(c).isTemporary;)c--;b.yb(c+1,a);null!==this.gc&&this.gb(Je,"layers",this,null,a,null,c+1);this.P();this.Ta()}; t.Mx=function(a,b){gk(this,a,b);a.he(this);var c=this.Oa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.gc&&this.gb(Ke,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.O(f)===b){c.yb(f,a);break}null!==this.gc&&this.gb(Je,"layers",this,null,a,null,f);this.P();0>d&&this.Ta()}; t.$y=function(a,b){gk(this,a,b);a.he(this);var c=this.Oa,d=c.indexOf(a);0<=d&&(c.remove(a),null!==this.gc&&this.gb(Ke,"layers",this,a,null,d,null));var e=c.count,f;for(f=0;f<e;f++)if(c.O(f)===b){c.yb(f+1,a);break}null!==this.gc&&this.gb(Je,"layers",this,null,a,null,f+1);this.P();0>d&&this.Ta()}; t.JA=function(a){w(a,vi,P,"removeLayer:layer");a.diagram!==this&&v("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Oa,c=b.indexOf(a);if(b.remove(a)){for(b=a.Ha.copy().iterator;b.next();){var d=b.value,e=d.layerName;e!==a.name?d.layerName=e:d.layerName=""}null!==this.gc&&this.gb(Ke,"layers",this,a,null,c,null);this.P();this.Ta()}}};t.wm=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null}; t.Ox=function(a){A(a,"function",P,"addModelChangedListener:listener");null===this.Be&&(this.Be=new H);this.Be.add(a);this.model.Lh(a)};t.LA=function(a){A(a,"function",P,"removeModelChangedListener:listener");null!==this.Be&&(this.Be.remove(a),0===this.Be.count&&(this.Be=null));this.model.Ik(a)};t.Lh=function(a){A(a,"function",P,"addChangedListener:listener");null===this.Vf&&(this.Vf=new H);this.Vf.add(a)}; t.Ik=function(a){A(a,"function",P,"removeChangedListener:listener");null!==this.Vf&&(this.Vf.remove(a),0===this.Vf.count&&(this.Vf=null))};t.st=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.Wv(a);a.change!==Ie&&(this.isModified=!0);if(null!==this.Vf)for(var b=this.Vf,c=b.length,d=0;d<c;d++)b.O(d)(a)}; t.gb=function(a,b,c,d,e,f,g){void 0===f&&(f=null);void 0===g&&(g=null);var h=new Ge;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.st(h)};t.g=function(a,b,c,d,e){this.gb(He,a,this,b,c,d,e)}; P.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===He){var e=a.object;hk(e,a.propertyName,a.K(b));if(e instanceof N){var f=e.part;null!==f&&f.Rb()}this.isModified=!0}else if(d===Je){var g=a.object,h=a.newParam,k=a.newValue;if(g instanceof U)if("number"===typeof h&&k instanceof N){b?g.Lc(h):g.yb(h,k);var l=g.part;null!==l&&l.Rb()}else{if("number"===typeof h&&k instanceof ik)if(b)k.isRow? g.qw(h):g.ow(h);else{var m=k.isRow?g.getRowDefinition(k.index):g.getColumnDefinition(k.index);m.vt(k)}}else if(g instanceof vi){var n=!0===a.oldParam;"number"===typeof h&&k instanceof S&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Rb(),g.Lc(n?h:-1,k,n)):g.lj(h,k,n))}else g instanceof P?"number"===typeof h&&k instanceof vi&&(b?this.Oa.hb(h):(k.he(this),this.Oa.yb(h,k))):v("unknown ChangedEvent.Insert object: "+a.toString());this.isModified=!0}else if(d===Ke){var p=a.object,r=a.oldParam,q=a.oldValue;if(p instanceof U)"number"===typeof r&&q instanceof N?b?p.yb(r,q):p.Lc(r):"number"===typeof r&&q instanceof ik&&(b?(m=q.isRow?p.getRowDefinition(q.index):p.getColumnDefinition(q.index),m.vt(q)):q.isRow?p.qw(r):p.ow(r));else if(p instanceof vi){var u=!0===a.newParam;"number"===typeof r&&q instanceof S&&(b?0>p.Ha.indexOf(q)&&p.lj(r,q,u):(q.isSelected=!1,q.isHighlighted=!1,q.Rb(),p.Lc(u?r:-1,q,u)))}else p instanceof P?"number"===typeof r&&q instanceof vi&&(b?(q.he(this),this.Oa.yb(r,q)):this.Oa.hb(r)):v("unknown ChangedEvent.Remove object: "+ a.toString());this.isModified=!0}else d!==Ie&&v("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};P.prototype.Ba=function(a){return this.undoManager.Ba(a)};P.prototype.$a=function(a){return this.undoManager.$a(a)};P.prototype.Mf=function(){return this.undoManager.Mf()}; P.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ba(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.$a(b):this.undoManager.Mf(),this.skipsUndoManager=c}};P.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};P.prototype.fr=function(){this.partManager.fr()}; function jk(a,b,c){var d=a.animationManager;if(a.Xb||a.Hc)a.Fa=c,d.lf&&d.Jd.add(d.B,"scale",b,a.Fa);else if(null===a.ya)a.Fa=c;else{a.Xb=!0;var e=a.viewportBounds.copy(),f=a.Da,g=a.Ca;e.width=a.Da/b;e.height=a.Ca/b;var h=a.zoomPoint.x,k=a.zoomPoint.y,l=a.contentAlignment;isNaN(h)&&(l.nd()?l.If(Uc)?h=0:l.If(Vc)&&(h=f-1):h=l.ab()?l.x*(f-1):f/2);isNaN(k)&&(l.nd()?l.If(Tc)?k=0:l.If(Wc)&&(k=g-1):k=l.ab()?l.y*(g-1):g/2);null===a.scaleComputation||a.animationManager.isAnimating||(c=a.scaleComputation(a, c));c<a.minScale&&(c=a.minScale);c>a.maxScale&&(c=a.maxScale);f=J.allocAt(a.sa.x+h/b-h/c,a.sa.y+k/b-k/c);a.position=f;J.free(f);a.Fa=c;a.Sq(e,a.viewportBounds,b,!1);a.Xb=!1;kj(a,!1);d.lf&&d.Jd.add(d.B,"scale",b,a.Fa);a.P();nj(a)}} P.prototype.Sq=function(a,b,c,d){if(!a.A(b)){void 0===d&&(d=!1);d||nj(this);hj(this);var e=this.layout;null===e||!e.isViewportSized||this.autoScale!==Ei||d||a.width===b.width&&a.height===b.height||e.D();e=this.currentTool;!0===this.gg&&e instanceof Ua&&(this.lastInput.documentPoint=this.gu(this.lastInput.viewPoint),af(e,this));this.Xb||this.oy(a,b);Dj(this);this.$d.scale=c;this.$d.position.x=a.x;this.$d.position.y=a.y;this.$d.bounds.assign(a);this.$d.bw=d;this.U("ViewportBoundsChanged",this.$d,a); this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Mc(b)&&a.Ya()})}}; function Dj(a,b){void 0===b&&(b=null);var c=a.Mb;if(null!==c&&c.visible){for(var d=Hb.alloc(),e=1,f=1,g=c.Z.j,h=g.length,k=0;k<h;k++){var l=g[k],m=l.interval;2>m||(kk(l.figure)?f=f*m/K.iy(f,m):e=e*m/K.iy(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=L.alloc();a=a.viewportBounds;b.h(a.x,a.y,a.width,a.height);if(!b.o()){L.free(b);return}e=b.width;f=b.height;a=b.x;g=b.y;L.free(b)}c.width=e+2*d.width;c.height=f+2*d.height;b=J.alloc();K.Cq(a,g,0,0, d.width,d.height,b);b.offset(-d.width,-d.height);Hb.free(d);c.part.location=b;J.free(b)}}P.prototype.clearSelection=function(a){void 0===a&&(a=!1);var b=this.selection;if(0!==b.count){a||this.U("ChangingSelection",b);for(var c=b.ua(),d=c.length,e=0;e<d;e++)c[e].isSelected=!1;b.ka();b.clear();b.freeze();a||this.U("ChangedSelection",b)}}; P.prototype.select=function(a){null!==a&&(w(a,S,P,"select:part"),a.layer.diagram===this&&(!a.isSelected||1<this.selection.count)&&(this.U("ChangingSelection",this.selection),this.clearSelection(!0),a.isSelected=!0,this.U("ChangedSelection",this.selection)))}; P.prototype.PA=function(a){this.U("ChangingSelection",this.selection);this.clearSelection(!0);if(Ga(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];d instanceof S||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 S||v("Diagram.selectCollection given something that is not a Part: "+b),b.isSelected=!0;this.U("ChangedSelection",this.selection)}; P.prototype.clearHighlighteds=function(){var a=this.highlighteds;if(0<a.count){for(var b=a.ua(),c=b.length,d=0;d<c;d++)b[d].isHighlighted=!1;a.ka();a.clear();a.freeze()}};t=P.prototype;t.kA=function(a){null!==a&&a.layer.diagram===this&&(w(a,S,P,"highlight:part"),!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)}; t.lA=function(a){a=(new I).addAll(a);for(var b=this.highlighteds.copy().Wq(a).iterator;b.next();)b.value.isHighlighted=!1;for(a=a.iterator;a.next();)b=a.value,b instanceof S||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.vw=function(a){var b=this.viewportBounds;b.Oe(a)||(a=a.center,a.x-=b.width/2,a.y-=b.height/2,this.position=a)};t.tt=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.dr=function(a){var b=this.sb;b.reset();1!==this.Fa&&b.scale(this.Fa);var c=this.sa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return a.copy().transform(this.sb)}; t.YA=function(a){var b=this.sb,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 L(f,r,p-f,b-r)}; t.gu=function(a){var b=this.sb;b.reset();1!==this.Fa&&b.scale(this.Fa);var c=this.sa;(0!==c.x||0!==c.y)&&isFinite(c.x)&&isFinite(c.y)&&b.translate(-c.x,-c.y);return Jb(a.copy(),this.sb)};function lk(a){var b=a.isModified;a.rv!==b&&(a.rv=b,a.U("Modified"))}function mk(a){a=Hi.get(a);return null!==a?new a:new Ii} P.prototype.doModelChanged=function(a){var b=this;if(a.model===this.model){var c=a.change,d=a.propertyName;if(c===Ie&&"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.Hc||this.ue||(this.Bj=!0,this.Ej&&(this.Le=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&& a.ed(),this.U("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.ed());else if(this.ba){this.ba=!1;try{if(""===a.modelChange&&c===Ie){if("FinishedUndo"===d||"FinishedRedo"===d)this.U("ChangedSelection",this.selection),ij(this);var f=this.animationManager;"RolledBackTransaction"===d&&f.ed();this.Bj=!0;this.dd();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||Gh(f);"CommittedTransaction"=== d&&this.undoManager.Tu&&(this.Pd=Math.min(this.Pd,this.undoManager.historyIndex-1));"CommittedTransaction"!==d&&"RolledBackTransaction"!==d||!this.undoManager.isPendingUnmodified||setTimeout(function(){b.isModified=!1},1);var g=a.isTransactionFinished;g&&(lk(this),this.Pt.clear(),ci(this.animationManager));if(!this.ys&&g){this.ys=!0;var h=this;ta(function(){h.currentTool.standardMouseOver();h.ys=!1},10)}}}finally{this.ba=!0}}}};function Vj(a,b){b=b.Z.j;for(var c=b.length,d=0;d<c;d++)nk(a,b[d])} function nk(a,b){if(b instanceof xk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){var d=b.eh;null!==d&&(d.ol instanceof Event&&null!==b.Fc&&b.Fc(b,d.ol),!0===d.fs&&(null!==b.xf&&b.xf(b,d.gv),null!==b.diagram&&b.diagram.Is.add(b)));c=c.getAttribute("src");d=a.Ni.K(c);if(null===d)d=[],d.push(b),a.Ni.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}} function Bk(a,b){if(b instanceof xk){var c=b.element;if(null!==c&&c instanceof HTMLImageElement){c=c.getAttribute("src");var d=a.Ni.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.Ni.remove(c),Ck(c));break}}}}P.prototype.Fd=function(){this.partManager.Fd()};P.prototype.ek=function(a,b){this.Qc.ek(a,b)};P.prototype.gk=function(a,b){this.Qc.gk(a,b)};P.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};P.prototype.Qb=function(a){return this.partManager.Qb(a)}; P.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=P.prototype;t.Cc=function(a){return this.partManager.Cc(a)};t.cj=function(a){return this.partManager.cj(a)};t.Bc=function(a){return this.partManager.Bc(a)};t.Bt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Bt.apply(this.partManager,b instanceof Array?b:da(ba(b)))}; t.At=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.At.apply(this.partManager,b instanceof Array?b:da(ba(b)))};function Qj(a,b){a.wi=!1;var c=a.On;c.A(b)||(b=b.J(),a.On=b,kj(a,!1),a.U("DocumentBoundsChanged",null,c.copy()),nj(a))}function Zi(a){a.wi&&Qj(a,a.computeBounds())}t.Rz=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.Qz=function(){return this.Hh.iterator}; t.wA=function(a){ij(this);a&&Dk(this,!0);this.Bj=!0;Vf(this)};function Dk(a,b){for(var c=a.Hh.iterator;c.next();)Ek(a,c.value,b);null!==a.layout&&(b?a.layout.isValidLayout=!1:a.layout.D())}function Ek(a,b,c){if(null!==b){for(var d=b.Ml.iterator;d.next();)Ek(a,d.value,c);null!==b.layout&&(c?b.layout.isValidLayout=!1:b.layout.D())}} function Ej(a,b){if(a.Rf&&!a.Kr){var c=a.ba;a.ba=!0;var d=a.undoManager.transactionLevel,e=a.layout;try{0===d&&a.Ba("Layout");var f=a.animationManager;1>=d&&!f.isAnimating&&!f.wc&&(b||Eh(f,"Layout"));a.Rf=!1;for(var g=a.Hh.iterator;g.next();)Fk(a,g.value,b,d);e.isValidLayout||(!b||e.isRealtime||null===e.isRealtime||0===d?(e.doLayout(a),ij(a),e.isValidLayout=!0):a.Rf=!0)}finally{0===d&&a.$a("Layout"),a.Rf=!e.isValidLayout,a.ba=c}}} function Fk(a,b,c,d){if(null!==b){for(var e=b.Ml.iterator;e.next();)Fk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.Gk=!b.location.o(),e.doLayout(b),b.D(32),Gj(a,b),e.isValidLayout=!0):a.Rf=!0)}}t.Xz=function(){for(var a=new H,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.fj()&&a.add(c)}return a.iterator}; function Fi(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 Db,d=new Db;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.Nr=c;a.Mr=d} function Pj(a,b){var c=a.Mr.K(b);return null!==c?c:a.Mr.K(b.toLowerCase())}function Gk(a,b){var c=a.Nr.K(b);if(null!==c)return c;c=a.Nr.K(b.toLowerCase());if(null!==c)return c;v("Unknown DiagramEvent name: "+b)}t.fk=function(a,b){A(a,"string",P,"addDiagramListener:name");A(b,"function",P,"addDiagramListener:listener");a=Gk(this,a);null!==a&&a.add(b)};t.Nm=function(a,b){A(a,"string",P,"removeDiagramListener:name");A(b,"function",P,"addDiagramListener:listener");a=Gk(this,a);null!==a&&a.remove(b)}; t.U=function(a,b,c){F&&A(a,"string",P,"raiseDiagramEvent:name");var d=Gk(this,a),e=new Fe;e.diagram=this;a=Pj(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.O(0)(e);else if(0!==b)for(d=d.ua(),c=0;c<b;c++)(0,d[c])(e)};function Hk(a){if(a.animationManager.isAnimating)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.eq||b.isComplexRoutingRealtime:!0} t.yk=function(a,b){void 0===b&&(b=null);return Ik(this,!1,null,b).yk(a.x,a.y,a.width,a.height)};P.prototype.computeOccupiedArea=function(){return this.isVirtualized?this.viewportBounds.copy():this.wi?jj(this):this.documentBounds.copy()}; function Ik(a,b,c,d){null===a.Nb&&(a.Nb=new Jk);if(a.Nb.Jt||a.Nb.group!==c||a.Nb.Jy!==d){if(null===c){b=a.computeOccupiedArea();b.cd(100,100);a.Nb.initialize(b);b=L.alloc();for(var e=a.nodes;e.next();){var f=e.value,g=f.layer;null!==g&&g.visible&&!g.isTemporary&&Kk(a,f,d,b)}L.free(b)}else{0<c.memberParts.count&&(b=a.computePartsBounds(c.memberParts,!1),b.cd(20,20),a.Nb.initialize(b));b=L.alloc();for(e=c.memberParts;e.next();)f=e.value,f instanceof T&&Kk(a,f,d,b);L.free(b)}a.Nb.group=c;a.Nb.Jy=d;a.Nb.Jt= !1}else b&&Lk(a.Nb);return a.Nb}function Kk(a,b,c,d){if(b!==c)if(b.isVisible()&&b.avoidable&&!b.isLinkLabel){var e=b.getAvoidableRect(d),f=a.Nb.rm;c=a.Nb.qm;d=e.x+e.width;b=e.y+e.height;for(var g=e.x;g<d;g+=f){for(var h=e.y;h<b;h+=c)Mk(a.Nb,g,h);Mk(a.Nb,g,b)}for(e=e.y;e<b;e+=c)Mk(a.Nb,d,e);Mk(a.Nb,d,b)}else if(b instanceof Hf)for(b=b.memberParts;b.next();)e=b.value,e instanceof T&&Kk(a,e,c,d)} function Nk(a,b){null!==a.Nb&&!a.Nb.Jt&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Nb.Jt=!0)}t=P.prototype;t.xt=function(a){this.pn.assign(a);Ok(this,this.pn).Sa(this.position)?this.Nf():Pk(this)}; function Pk(a){-1===a.vj&&(a.vj=ta(function(){if(-1!==a.vj&&(a.Nf(),null!==a.lastInput.event)){var b=Ok(a,a.pn);b.Sa(a.position)||(a.position=b,a.lastInput.documentPoint=a.gu(a.pn),a.doMouseMove(),a.wi=!0,Qj(a,a.documentBounds.copy().Nc(a.computeBounds())),a.Gc=!0,a.dd(),Pk(a))}},a.on))}t.Nf=function(){-1!==this.vj&&(qa.clearTimeout(this.vj),this.vj=-1)}; function Ok(a,b){var c=a.position,d=a.qn;if(0>=d.top&&0>=d.left&&0>=d.right&&0>=d.bottom)return c;var e=a.viewportBounds,f=a.scale;e=L.allocAt(0,0,e.width*f,e.height*f);var g=J.allocAt(0,0);if(b.x>=e.x&&b.x<e.x+d.left){var h=Math.max(a.scrollHorizontalLineChange,1);h|=0;g.x-=h;b.x<e.x+d.left/2&&(g.x-=h);b.x<e.x+d.left/4&&(g.x-=4*h)}else b.x<=e.x+e.width&&b.x>e.x+e.width-d.right&&(h=Math.max(a.scrollHorizontalLineChange,1),h|=0,g.x+=h,b.x>e.x+e.width-d.right/2&&(g.x+=h),b.x>e.x+e.width-d.right/4&& (g.x+=4*h));b.y>=e.y&&b.y<e.y+d.top?(a=Math.max(a.scrollVerticalLineChange,1),a|=0,g.y-=a,b.y<e.y+d.top/2&&(g.y-=a),b.y<e.y+d.top/4&&(g.y-=4*a)):b.y<=e.y+e.height&&b.y>e.y+e.height-d.bottom&&(a=Math.max(a.scrollVerticalLineChange,1),a|=0,g.y+=a,b.y>e.y+e.height-d.bottom/2&&(g.y+=a),b.y>e.y+e.height-d.bottom/4&&(g.y+=4*a));g.Sa(Rb)||(c=new J(c.x+g.x/f,c.y+g.y/f));L.free(e);J.free(g);return c}t.Rt=function(){return null};t.cw=function(){return null};t.dz=function(a,b){this.Bx.add(a,b)}; function Qk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].Il){f=!1;break}f||a-l>k?b(c,e,h):qa.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.Ni.iterator;g.next();)if(!g.value[0].Il){f=!1;break}if("function"!==typeof e||f)return b(c,e,a);var h=a,k=c.callbackTimeout||300,l=+new Date;qa.requestAnimationFrame(function(){d()});return null}t.yA=function(a){if(!gh)return null;void 0===a&&(a=new jb);a.returnType="Image";return this.qy(a)}; t.qy=function(a){void 0===a&&(a=new jb);return Qk(this,this.zA,a)}; t.zA=function(a,b,c){var d=Rk(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 "imagedata":e=d.getImageData(0,0,c.width,c.height);break;case "image":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 Rk(a,b,c,d){a.animationManager.ed();a.dd();if(null===a.ya)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 Hb(Infinity,Infinity):new Hb(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 lc(m):m instanceof lc||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.Kb.yc(!0);p=new Sk(null,r);var x=p.context;if(!(f||g||l||k)){p.width=a.Da+Math.ceil(m.left+m.right);p.height=a.Ca+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.zq=q;Nj(a,d.context,m,new Hb(p.width,p.height),a.Fa,a.sa,l,n,u,b);return d.context}a.jl=!1;Nj(a,x,m,new Hb(p.width,p.height),a.Fa,a.sa,l,n,u,b);a.jl=!0;return p.context}var y=a.Nn,z=a.documentBounds.copy();z.Cw(a.lb);if(u)for(var B=a.Oa.j,D=B.length,G=0;G<D;G++){var O=B[G];if(O.visible&&O.isTemporary){O=O.Ha.j;for(var X=O.length,Q=0;Q<X;Q++){var ca=O[Q];ca.isInDocumentBounds&&ca.isVisible()&&(ca=ca.actualBounds,ca.o()&& z.Nc(ca))}}}B=new J(z.x,z.y);if(null!==l){D=!0;G=l.iterator;for(G.reset();G.next();)if(O=G.value,O instanceof S&&(X=O.layer,(null===X||X.visible)&&(null===X||u||!X.isTemporary)&&O.isVisible()&&(O=O.actualBounds,O.o())))if(D){D=!1;var Y=O.copy()}else Y.Nc(O);D&&(Y=new L(0,0,0,0));z.width=Y.width;z.height=Y.height;B.x=Y.x;B.y=Y.y}null!==k&&k.o()&&(B=k,g||(g=y));Y=k=0;null!==m&&(k=m.left+m.right,Y=m.top+m.bottom);D=G=0;null!==f&&(G=f.width,D=f.height,isFinite(G)&&(G=Math.max(0,G-k)),isFinite(D)&&(D= Math.max(0,D-Y)));null!==f&&null!==g?("NaN"===g&&(g=y),f.o()?(f=G,z=D):isNaN(D)?(f=G,z=z.height*g):(f=z.width*g,z=D)):null!==f?f.o()?(g=Math.min(G/z.width,D/z.height),f=G,z=D):isNaN(D)?(g=G/z.width,f=G,z=z.height*g):(g=D/z.height,f=z.width*g,z=D):null!==g?"NaN"===g&&h.o()?(g=Math.min((h.width-k)/z.width,(h.height-Y)/z.height),g>y?(g=y,f=z.width,z=z.height):(f=h.width,z=h.height)):(f=z.width*g,z=z.height*g):(g=y,f=z.width,z=z.height);null!==m?(f+=k,z+=Y):m=new lc(0);null!==h&&(y=h.width,h=h.height, "SVG"!==c&&e&&!Tk&&F&&(f>y||z>h)&&(Ca("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."),Tk=!0),isNaN(y)&&(y=2E3),isNaN(h)&&(h=2E3),isFinite(y)&&(f=Math.min(f,y)),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.zq=q;Nj(a,d.context,m,new Hb(Math.ceil(f), Math.ceil(z)),g,B,l,n,u,b);return d.context}a.jl=!1;Nj(a,x,m,new Hb(Math.ceil(f),Math.ceil(z)),g,B,l,n,u,b);a.jl=!0;return p.context} ma.Object.defineProperties(P.prototype,{div:{configurable:!0,get:function(){return this.Ra},set:function(a){null!==a&&w(a,HTMLDivElement,P,"div");if(this.Ra!==a){Xa=[];var b=this.Ra;null!==b?(b.B=void 0,b.innerHTML="",null!==this.ya&&(b=this.ya.Ja,this.removeEventListener(b,"touchstart",this.Hw,!1),this.removeEventListener(b,"touchmove",this.Gw,!1),this.removeEventListener(b,"touchend",this.Fw,!1),this.ya.Xx()),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.Kb=this.ya=null,this.removeEventListener(qa,"resize",this.Nw,!1),this.removeEventListener(qa,"mousemove",this.Ck,!0),this.removeEventListener(qa,"mousedown",this.Bk,!0),this.removeEventListener(qa,"mouseup",this.Ek,!0),this.removeEventListener(qa,"wheel",this.Fk,!0),this.removeEventListener(qa,"mouseout",this.Dk,!0),Pe===this&&(Pe=null)): this.ue=!1;this.Ra=null;if(null!==a){if(b=a.B)b.div=null;Pi(this,a);this.ge()}}}},Qx:{configurable:!0,get:function(){return this.Yo}},xk:{configurable:!0,get:function(){return this.ue}},draggedLink:{configurable:!0,get:function(){return this.Pr},set:function(a){this.Pr!==a&&(this.Pr=a,null!==a&&(this.Cs=a.fromPort,this.Ds=a.toPort))}},uy:{configurable:!0,get:function(){return this.Cs},set:function(a){this.Cs=a}},vy:{configurable:!0, get:function(){return this.Ds},set:function(a){this.Ds=a}},animationManager:{configurable:!0,get:function(){return this.Qc}},undoManager:{configurable:!0,get:function(){return this.gc.undoManager}},skipsUndoManager:{configurable:!0,get:function(){return this.Bg},set:function(a){A(a,"boolean",P,"skipsUndoManager");this.Bg=a;this.gc.skipsUndoManager=a}},delaysLayout:{configurable:!0,get:function(){return this.Kr},set:function(a){this.Kr=a}},opacity:{configurable:!0, enumerable:!0,get:function(){return this.wb},set:function(a){var b=this.wb;b!==a&&(A(a,"number",P,"opacity"),(0>a||1<a)&&ya(a,"0 <= value <= 1",P,"opacity"),this.wb=a,this.g("opacity",b,a),this.P())}},validCycle:{configurable:!0,get:function(){return this.nt},set:function(a){var b=this.nt;b!==a&&(hb(a,P,P,"validCycle"),this.nt=a,this.g("validCycle",b,a))}},layers:{configurable:!0,get:function(){return this.Oa.iterator}},isModelReadOnly:{configurable:!0,get:function(){var a= this.gc;return null===a?!1:a.isReadOnly},set:function(a){var b=this.gc;null!==b&&(b.isReadOnly=a)}},isReadOnly:{configurable:!0,get:function(){return this.hg},set:function(a){var b=this.hg;b!==a&&(A(a,"boolean",P,"isReadOnly"),this.hg=a,this.g("isReadOnly",b,a))}},isEnabled:{configurable:!0,get:function(){return this.Tc},set:function(a){var b=this.Tc;b!==a&&(A(a,"boolean",P,"isEnabled"),this.Tc=a,this.g("isEnabled",b,a))}},allowClipboard:{configurable:!0, get:function(){return this.kr},set:function(a){var b=this.kr;b!==a&&(A(a,"boolean",P,"allowClipboard"),this.kr=a,this.g("allowClipboard",b,a))}},allowCopy:{configurable:!0,get:function(){return this.bi},set:function(a){var b=this.bi;b!==a&&(A(a,"boolean",P,"allowCopy"),this.bi=a,this.g("allowCopy",b,a))}},allowDelete:{configurable:!0,get:function(){return this.ci},set:function(a){var b=this.ci;b!==a&&(A(a,"boolean",P,"allowDelete"),this.ci=a,this.g("allowDelete",b,a))}}, allowDragOut:{configurable:!0,get:function(){return this.lr},set:function(a){var b=this.lr;b!==a&&(A(a,"boolean",P,"allowDragOut"),this.lr=a,this.g("allowDragOut",b,a))}},allowDrop:{configurable:!0,get:function(){return this.mr},set:function(a){var b=this.mr;b!==a&&(A(a,"boolean",P,"allowDrop"),this.mr=a,this.g("allowDrop",b,a))}},allowTextEdit:{configurable:!0,get:function(){return this.li},set:function(a){var b=this.li;b!==a&&(A(a,"boolean",P,"allowTextEdit"), this.li=a,this.g("allowTextEdit",b,a))}},allowGroup:{configurable:!0,get:function(){return this.di},set:function(a){var b=this.di;b!==a&&(A(a,"boolean",P,"allowGroup"),this.di=a,this.g("allowGroup",b,a))}},allowUngroup:{configurable:!0,get:function(){return this.mi},set:function(a){var b=this.mi;b!==a&&(A(a,"boolean",P,"allowUngroup"),this.mi=a,this.g("allowUngroup",b,a))}},allowInsert:{configurable:!0,get:function(){return this.pr},set:function(a){var b= this.pr;b!==a&&(A(a,"boolean",P,"allowInsert"),this.pr=a,this.g("allowInsert",b,a))}},allowLink:{configurable:!0,get:function(){return this.ei},set:function(a){var b=this.ei;b!==a&&(A(a,"boolean",P,"allowLink"),this.ei=a,this.g("allowLink",b,a))}},allowRelink:{configurable:!0,get:function(){return this.gi},set:function(a){var b=this.gi;b!==a&&(A(a,"boolean",P,"allowRelink"),this.gi=a,this.g("allowRelink",b,a))}},allowMove:{configurable:!0,get:function(){return this.fi}, set:function(a){var b=this.fi;b!==a&&(A(a,"boolean",P,"allowMove"),this.fi=a,this.g("allowMove",b,a))}},allowReshape:{configurable:!0,get:function(){return this.hi},set:function(a){var b=this.hi;b!==a&&(A(a,"boolean",P,"allowReshape"),this.hi=a,this.g("allowReshape",b,a))}},allowResize:{configurable:!0,get:function(){return this.ii},set:function(a){var b=this.ii;b!==a&&(A(a,"boolean",P,"allowResize"),this.ii=a,this.g("allowResize",b,a))}},allowRotate:{configurable:!0, get:function(){return this.ji},set:function(a){var b=this.ji;b!==a&&(A(a,"boolean",P,"allowRotate"),this.ji=a,this.g("allowRotate",b,a))}},allowSelect:{configurable:!0,get:function(){return this.ki},set:function(a){var b=this.ki;b!==a&&(A(a,"boolean",P,"allowSelect"),this.ki=a,this.g("allowSelect",b,a))}},allowUndo:{configurable:!0,get:function(){return this.qr},set:function(a){var b=this.qr;b!==a&&(A(a,"boolean",P,"allowUndo"),this.qr=a,this.g("allowUndo",b,a))}},allowZoom:{configurable:!0, enumerable:!0,get:function(){return this.sr},set:function(a){var b=this.sr;b!==a&&(A(a,"boolean",P,"allowZoom"),this.sr=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{configurable:!0,get:function(){return this.ql},set:function(a){var b=this.ql;b!==a&&(A(a,"boolean",P,"hasVerticalScrollbar"),this.ql=a,nj(this),this.P(),this.g("hasVerticalScrollbar",b,a),kj(this,!1))}},hasHorizontalScrollbar:{configurable:!0,get:function(){return this.pl},set:function(a){var b=this.pl; b!==a&&(A(a,"boolean",P,"hasHorizontalScrollbar"),this.pl=a,nj(this),this.P(),this.g("hasHorizontalScrollbar",b,a),kj(this,!1))}},allowHorizontalScroll:{configurable:!0,get:function(){return this.nr},set:function(a){var b=this.nr;b!==a&&(A(a,"boolean",P,"allowHorizontalScroll"),this.nr=a,this.g("allowHorizontalScroll",b,a),kj(this,!1))}},allowVerticalScroll:{configurable:!0,get:function(){return this.rr},set:function(a){var b=this.rr;b!==a&&(A(a,"boolean",P,"allowVerticalScroll"), this.rr=a,this.g("allowVerticalScroll",b,a),kj(this,!1))}},scrollHorizontalLineChange:{configurable:!0,get:function(){return this.Ts},set:function(a){var b=this.Ts;b!==a&&(A(a,"number",P,"scrollHorizontalLineChange"),0>a&&ya(a,">= 0",P,"scrollHorizontalLineChange"),this.Ts=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{configurable:!0,get:function(){return this.Xs},set:function(a){var b=this.Xs;b!==a&&(A(a,"number",P,"scrollVerticalLineChange"), 0>a&&ya(a,">= 0",P,"scrollVerticalLineChange"),this.Xs=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{configurable:!0,get:function(){return this.mh},set:function(a){F&&w(a,we,P,"lastInput");this.mh=a}},firstInput:{configurable:!0,get:function(){return this.cg},set:function(a){F&&w(a,we,P,"firstInput");this.cg=a}},currentCursor:{configurable:!0,get:function(){return this.Er},set:function(a){""===a&&(a=this.Mn);if(this.Er!==a){A(a,"string",P,"currentCursor"); var b=this.ya,c=this.Ra;if(null!==b){this.Er=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.Mn},set:function(a){""===a&&(a="auto");var b=this.Mn;b!==a&&(A(a,"string",P,"defaultCursor"),this.Mn=a,this.g("defaultCursor", b,a))}},click:{configurable:!0,get:function(){return this.Wf},set:function(a){var b=this.Wf;b!==a&&(null!==a&&A(a,"function",P,"click"),this.Wf=a,this.g("click",b,a))}},doubleClick:{configurable:!0,get:function(){return this.ag},set:function(a){var b=this.ag;b!==a&&(null!==a&&A(a,"function",P,"doubleClick"),this.ag=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,get:function(){return this.Xf},set:function(a){var b=this.Xf;b!==a&&(null!==a&&A(a, "function",P,"contextClick"),this.Xf=a,this.g("contextClick",b,a))}},mouseOver:{configurable:!0,get:function(){return this.tg},set:function(a){var b=this.tg;b!==a&&(null!==a&&A(a,"function",P,"mouseOver"),this.tg=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return this.rg},set:function(a){var b=this.rg;b!==a&&(null!==a&&A(a,"function",P,"mouseHover"),this.rg=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,get:function(){return this.qg}, set:function(a){var b=this.qg;b!==a&&(null!==a&&A(a,"function",P,"mouseHold"),this.qg=a,this.g("mouseHold",b,a))}},mouseDragOver:{configurable:!0,get:function(){return this.xs},set:function(a){var b=this.xs;b!==a&&(null!==a&&A(a,"function",P,"mouseDragOver"),this.xs=a,this.g("mouseDragOver",b,a))}},mouseDrop:{configurable:!0,get:function(){return this.og},set:function(a){var b=this.og;b!==a&&(F&&null!==a&&A(a,"function",P,"mouseDrop"),this.og=a,this.g("mouseDrop",b,a))}}, handlesDragDropForTopLevelParts:{configurable:!0,get:function(){return this.Yr},set:function(a){var b=this.Yr;b!==a&&(A(a,"boolean",P,"handlesDragDropForTopLevelParts"),this.Yr=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{configurable:!0,get:function(){return this.pg},set:function(a){var b=this.pg;b!==a&&(null!==a&&A(a,"function",P,"mouseEnter"),this.pg=a,this.g("mouseEnter",b,a))}},mouseLeave:{configurable:!0,get:function(){return this.sg}, set:function(a){var b=this.sg;b!==a&&(null!==a&&A(a,"function",P,"mouseLeave"),this.sg=a,this.g("mouseLeave",b,a))}},toolTip:{configurable:!0,get:function(){return this.Dg},set:function(a){var b=this.Dg;b!==a&&(!F||null===a||a instanceof Te||a instanceof bf||v("Diagram.toolTip must be an Adornment or HTMLInfo."),this.Dg=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return this.Yf},set:function(a){var b=this.Yf;b!==a&&(!F||a instanceof Te||a instanceof bf||v("Diagram.contextMenu must be an Adornment or HTMLInfo."),this.Yf=a,this.g("contextMenu",b,a))}},commandHandler:{configurable:!0,get:function(){return this.yr},set:function(a){this.yr!==a&&(this.yr=a,a.he(this))}},toolManager:{configurable:!0,get:function(){return this.jt},set:function(a){this.jt!==a&&(w(a,Ua,P,"toolManager"),this.jt=a,a.diagram=this)}},defaultTool:{configurable:!0,get:function(){return this.Jr},set:function(a){var b=this.Jr;b!==a&&(w(a, Oe,P,"defaultTool"),this.Jr=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{configurable:!0,get:function(){return this.Gr},set:function(a){var b=this.Gr;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(w(a,Oe,P,"currentTool"),this.Gr=a,a.diagram=this,a.doStart())}},selection:{configurable:!0,get:function(){return this.iv}},maxSelectionCount:{configurable:!0,get:function(){return this.ts}, set:function(a){var b=this.ts;if(b!==a)if(A(a,"number",P,"maxSelectionCount"),0<=a&&!isNaN(a)){if(this.ts=a,this.g("maxSelectionCount",b,a),!this.undoManager.isUndoingRedoing&&(a=this.selection.count-a,0<a)){this.U("ChangingSelection",this.selection);b=this.selection.ua();for(var c=0;c<a;c++)b[c].isSelected=!1;this.U("ChangedSelection",this.selection)}}else ya(a,">= 0",P,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.hp},set:function(a){var b= this.hp;b!==a&&(w(a,Te,P,"nodeSelectionAdornmentTemplate"),this.hp=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.mo},set:function(a){var b=this.mo;b!==a&&(w(a,Te,P,"groupSelectionAdornmentTemplate"),this.mo=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.Go},set:function(a){var b=this.Go;b!==a&&(w(a,Te,P,"linkSelectionAdornmentTemplate"), this.Go=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{configurable:!0,get:function(){return this.Ju}},isModified:{configurable:!0,get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.ro&&this.Pd!==a.historyIndex:this.ro},set:function(a){if(this.ro!==a){A(a,"boolean",P,"isModified");this.ro=a;var b=this.undoManager;!a&&b.isEnabled&&(this.Pd=b.historyIndex);a||lk(this)}}},model:{configurable:!0,get:function(){return this.gc}, set:function(a){var b=this.gc;if(b!==a){w(a,W,P,"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.ed(!0);var c=Yi(this,!0);this.ue=!1;this.Ej=!0;this.Pd=-2;this.Le=!1;var d=this.Hc;this.Hc=!0;Eh(this.animationManager,"Model");null!==b&&(null!==this.Be&&this.Be.each(function(a){b.Ik(a)}),b.Ik(this.Oc));this.gc=a;this.partManager=mk(this.gc.constructor.type); for(var e=0;e<c.length;e++)this.add(c[e]);a.Lh(this.qd);this.partManager.addAllModeledParts();a.Ik(this.qd);a.Lh(this.Oc);null!==this.Be&&this.Be.each(function(b){a.Lh(b)});this.Hc=d;this.Xb||this.P();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},ba:{configurable:!0,get:function(){return this.Su},set:function(a){this.Su=a}},Pt:{configurable:!0,get:function(){return this.sx}},skipsModelSourceBindings:{configurable:!0,get:function(){return this.jv}, set:function(a){this.jv=a}},fu:{configurable:!0,get:function(){return this.bt},set:function(a){this.bt=a}},nodeTemplate:{configurable:!0,get:function(){return this.kf.K("")},set:function(a){var b=this.kf.K("");b!==a&&(w(a,S,P,"nodeTemplate"),this.kf.add("",a),this.g("nodeTemplate",b,a),this.undoManager.isUndoingRedoing||this.Fd())}},nodeTemplateMap:{configurable:!0,get:function(){return this.kf},set:function(a){var b=this.kf;b!==a&&(w(a,Db,P,"nodeTemplateMap"), this.kf=a,this.g("nodeTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Fd())}},groupTemplate:{configurable:!0,get:function(){return this.kh.K("")},set:function(a){var b=this.kh.K("");b!==a&&(w(a,Hf,P,"groupTemplate"),this.kh.add("",a),this.g("groupTemplate",b,a),this.undoManager.isUndoingRedoing||this.Fd())}},groupTemplateMap:{configurable:!0,get:function(){return this.kh},set:function(a){var b=this.kh;b!==a&&(w(a,Db,P,"groupTemplateMap"),this.kh=a,this.g("groupTemplateMap", b,a),this.undoManager.isUndoingRedoing||this.Fd())}},linkTemplate:{configurable:!0,get:function(){return this.jg.K("")},set:function(a){var b=this.jg.K("");b!==a&&(w(a,R,P,"linkTemplate"),this.jg.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Fd())}},linkTemplateMap:{configurable:!0,get:function(){return this.jg},set:function(a){var b=this.jg;b!==a&&(w(a,Db,P,"linkTemplateMap"),this.jg=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing|| this.Fd())}},isMouseCaptured:{configurable:!0,get:function(){return this.Ou},set:function(a){var b=this.ya;null!==b&&(b=b.Ja,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.kn?(this.removeEventListener(b,"pointermove",this.Im,!1),this.removeEventListener(b,"pointerdown",this.Hm,!1),this.removeEventListener(b,"pointerup",this.Km,!1),this.removeEventListener(b,"pointerout",this.Jm,!1),this.addEventListener(qa,"pointermove",this.Im,!0),this.addEventListener(qa,"pointerdown", this.Hm,!0),this.addEventListener(qa,"pointerup",this.Km,!0),this.addEventListener(qa,"pointerout",this.Jm,!0)):(this.removeEventListener(b,"mousemove",this.Ck,!1),this.removeEventListener(b,"mousedown",this.Bk,!1),this.removeEventListener(b,"mouseup",this.Ek,!1),this.removeEventListener(b,"mouseout",this.Dk,!1),this.addEventListener(qa,"mousemove",this.Ck,!0),this.addEventListener(qa,"mousedown",this.Bk,!0),this.addEventListener(qa,"mouseup",this.Ek,!0),this.addEventListener(qa,"mouseout",this.Dk, !0)),this.removeEventListener(b,"wheel",this.Fk,!1),this.addEventListener(qa,"wheel",this.Fk,!0),this.addEventListener(qa,"selectstart",this.preventDefault,!1)):(this.kn?(this.removeEventListener(qa,"pointermove",this.Im,!0),this.removeEventListener(qa,"pointerdown",this.Hm,!0),this.removeEventListener(qa,"pointerup",this.Km,!0),this.removeEventListener(qa,"pointerout",this.Jm,!0),this.addEventListener(b,"pointermove",this.Im,!1),this.addEventListener(b,"pointerdown",this.Hm,!1),this.addEventListener(b, "pointerup",this.Km,!1),this.addEventListener(b,"pointerout",this.Jm,!1)):(this.removeEventListener(qa,"mousemove",this.Ck,!0),this.removeEventListener(qa,"mousedown",this.Bk,!0),this.removeEventListener(qa,"mouseup",this.Ek,!0),this.removeEventListener(qa,"mouseout",this.Dk,!0),this.addEventListener(b,"mousemove",this.Ck,!1),this.addEventListener(b,"mousedown",this.Bk,!1),this.addEventListener(b,"mouseup",this.Ek,!1),this.addEventListener(b,"mouseout",this.Dk,!1)),this.removeEventListener(qa,"wheel", this.Fk,!0),this.removeEventListener(qa,"selectstart",this.preventDefault,!1),this.addEventListener(b,"wheel",this.Fk,!1)),this.Ou=a))}},position:{configurable:!0,get:function(){return this.sa},set:function(a){var b=J.alloc().assign(this.sa);if(!b.A(a)){w(a,J,P,"position");var c=this.viewportBounds.copy();this.sa.assign(a);ei(this.animationManager,b,this.sa);this.Xb||null===this.ya&&!this.lm.o()||(this.Xb=!0,a=this.scale,mj(this,this.On,this.Da/a,this.Ca/a,this.xj,!1),this.Xb=!1);this.Xb|| this.Sq(c,this.viewportBounds,this.Fa,!1)}J.free(b)}},initialPosition:{configurable:!0,get:function(){return this.$r},set:function(a){this.$r.A(a)||(w(a,J,P,"initialPosition"),this.$r=a.J())}},initialScale:{configurable:!0,get:function(){return this.bs},set:function(a){this.bs!==a&&(A(a,"number",P,"initialScale"),this.bs=a)}},grid:{configurable:!0,get:function(){null===this.Mb&&dj(this);return this.Mb},set:function(a){var b=this.Mb;if(b!==a){null===b&&(dj(this), b=this.Mb);w(a,U,P,"grid");a.type!==U.Grid&&v("Diagram.grid must be a Panel of type Panel.Grid");var c=b.panel;null!==c&&c.remove(b);this.Mb=a;a.name="GRID";null!==c&&c.add(a);Dj(this);this.P();this.g("grid",b,a)}}},viewportBounds:{configurable:!0,get:function(){var a=this.Jx,b=this.sa,c=this.Fa;if(null===this.ya)return this.lm.o()&&a.h(b.x,b.y,this.Da/c,this.Ca/c),a;a.h(b.x,b.y,Math.max(this.Da,0)/c,Math.max(this.Ca,0)/c);return a}},viewSize:{configurable:!0,get:function(){return this.lm}, set:function(a){var b=this.viewSize;b.A(a)||(w(a,Hb,P,"viewSize"),this.lm=a=a.J(),this.Da=a.width,this.Ca=a.height,this.Ta(),this.g("viewSize",b,a))}},fixedBounds:{configurable:!0,get:function(){return this.Vr},set:function(a){var b=this.Vr;b.A(a)||(w(a,L,P,"fixedBounds"),(F&&Infinity===a.width||-Infinity===a.width||Infinity===a.height||-Infinity===a.height)&&v("fixedBounds width/height must not be Infinity"),this.Vr=a=a.J(),this.Ta(),this.g("fixedBounds",b,a))}},scrollMargin:{configurable:!0, enumerable:!0,get:function(){return this.Qi},set:function(a){"number"===typeof a?a=new lc(a):w(a,lc,P,"scrollMargin");var b=this.Qi;b.A(a)||(this.Qi=a=a.J(),this.g("scrollMargin",b,a),this.ge())}},scrollMode:{configurable:!0,get:function(){return this.Ri},set:function(a){var b=this.Ri;b!==a&&(hb(a,P,P,"scrollMode"),this.Ri=a,a===li&&kj(this,!1),this.g("scrollMode",b,a),this.P())}},scrollsPageOnFocus:{configurable:!0,get:function(){return this.Ys},set:function(a){var b= this.Ys;b!==a&&(A(a,"boolean",P,"scrollsPageOnFocus"),this.Ys=a,this.g("scrollsPageOnFocus",b,a))}},positionComputation:{configurable:!0,get:function(){return this.Ls},set:function(a){var b=this.Ls;b!==a&&(null!==a&&A(a,"function",P,"positionComputation"),this.Ls=a,kj(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{configurable:!0,get:function(){return this.Rs},set:function(a){var b=this.Rs;b!==a&&(null!==a&&A(a,"function",P,"scaleComputation"),this.Rs= a,jk(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{configurable:!0,get:function(){return this.On}},isVirtualized:{configurable:!0,get:function(){return this.ms},set:function(a){var b=this.ms;b!==a&&(A(a,"boolean",P,"isVirtualized"),this.ms=a,this.g("isVirtualized",b,a))}},scale:{configurable:!0,get:function(){return this.Fa},set:function(a){var b=this.Fa;C(a,P,"scale");b!==a&&jk(this,b,a)}},defaultScale:{configurable:!0, get:function(){return this.Nn},set:function(a){F&&C(a,P,"defaultScale");!F||0<a||v("defaultScale must be larger than zero, not: "+a);this.Nn=a}},autoScale:{configurable:!0,get:function(){return this.Ug},set:function(a){var b=this.Ug;b!==a&&(hb(a,P,P,"autoScale"),this.Ug=a,this.g("autoScale",b,a),a!==Ei&&kj(this,!1))}},initialAutoScale:{configurable:!0,get:function(){return this.fg},set:function(a){var b=this.fg;b!==a&&(hb(a,P,P,"initialAutoScale"),this.fg=a,this.g("initialAutoScale", b,a))}},initialViewportSpot:{configurable:!0,get:function(){return this.cs},set:function(a){var b=this.cs;b!==a&&(w(a,M,P,"initialViewportSpot"),a.ab()||v("initialViewportSpot must be a specific Spot: "+a),this.cs=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{configurable:!0,get:function(){return this.Zr},set:function(a){var b=this.Zr;b!==a&&(w(a,M,P,"initialDocumentSpot"),a.ab()||v("initialViewportSpot must be a specific Spot: "+a),this.Zr=a,this.g("initialDocumentSpot", b,a))}},minScale:{configurable:!0,get:function(){return this.us},set:function(a){C(a,P,"minScale");var b=this.us;b!==a&&(0<a?(this.us=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):ya(a,"> 0",P,"minScale"))}},maxScale:{configurable:!0,get:function(){return this.ss},set:function(a){C(a,P,"maxScale");var b=this.ss;b!==a&&(0<a?(this.ss=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):ya(a,"> 0",P,"maxScale"))}},zoomPoint:{configurable:!0,get:function(){return this.qt}, set:function(a){this.qt.A(a)||(w(a,J,P,"zoomPoint"),this.qt=a=a.J())}},contentAlignment:{configurable:!0,get:function(){return this.xj},set:function(a){var b=this.xj;b.A(a)||(w(a,M,P,"contentAlignment"),this.xj=a=a.J(),this.g("contentAlignment",b,a),kj(this,!1))}},initialContentAlignment:{configurable:!0,get:function(){return this.oo},set:function(a){var b=this.oo;b.A(a)||(w(a,M,P,"initialContentAlignment"),this.oo=a=a.J(),this.g("initialContentAlignment",b,a))}},padding:{configurable:!0, enumerable:!0,get:function(){return this.lb},set:function(a){"number"===typeof a?a=new lc(a):w(a,lc,P,"padding");var b=this.lb;b.A(a)||(this.lb=a=a.J(),this.Ta(),this.g("padding",b,a))}},partManager:{configurable:!0,get:function(){return this.Na},set:function(a){var b=this.Na;b!==a&&(w(a,Ii,P,"partManager"),null!==a.diagram&&v("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.he(null),this.Na=a,a.he(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,Ni,P,"layout"),this.oc=a,a.diagram=this,a.group=null,this.Rf=!0,this.g("layout",b,a),this.Vb())}},isTreePathToChildren:{configurable:!0,get:function(){return this.ls},set:function(a){var b=this.ls; if(b!==a&&(A(a,"boolean",P,"isTreePathToChildren"),this.ls=a,this.g("isTreePathToChildren",b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Uk(a.value)}},treeCollapsePolicy:{configurable:!0,get:function(){return this.lt},set:function(a){var b=this.lt;b!==a&&(a!==Gi&&a!==Vk&&a!==Wk&&v("Unknown Diagram.treeCollapsePolicy: "+a),this.lt=a,this.g("treeCollapsePolicy",b,a))}},Re:{configurable:!0,get:function(){return this.Mu},set:function(a){this.Mu=a}},autoScrollInterval:{configurable:!0, enumerable:!0,get:function(){return this.on},set:function(a){var b=this.on;C(a,P,"scale");b!==a&&(this.on=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{configurable:!0,get:function(){return this.qn},set:function(a){"number"===typeof a?a=new lc(a):w(a,lc,P,"autoScrollRegion");var b=this.qn;b.A(a)||(this.qn=a=a.J(),this.Ta(),this.g("autoScrollRegion",b,a))}}}); ma.Object.defineProperties(P,{licenseKey:{configurable:!0,get:function(){return Xk.cc()},set:function(a){Xk.add(a)}},version:{configurable:!0,get:function(){return Yk}}});P.prototype.makeImageData=P.prototype.qy;P.prototype.makeImage=P.prototype.yA;P.prototype.addRenderer=P.prototype.dz;P.prototype.makeSVG=P.prototype.cw;P.prototype.makeSvg=P.prototype.Rt;P.prototype.stopAutoScroll=P.prototype.Nf;P.prototype.doAutoScroll=P.prototype.xt;P.prototype.isUnoccupied=P.prototype.yk; P.prototype.raiseDiagramEvent=P.prototype.U;P.prototype.removeDiagramListener=P.prototype.Nm;P.prototype.addDiagramListener=P.prototype.fk;P.prototype.findTreeRoots=P.prototype.Xz;P.prototype.layoutDiagram=P.prototype.wA;P.prototype.findTopLevelGroups=P.prototype.Qz;P.prototype.findTopLevelNodesAndLinks=P.prototype.Rz;P.prototype.findLinksByExample=P.prototype.At;P.prototype.findNodesByExample=P.prototype.Bt;P.prototype.findLinkForData=P.prototype.Bc;P.prototype.findNodeForData=P.prototype.cj; P.prototype.findPartForData=P.prototype.Cc;P.prototype.findLinkForKey=P.prototype.findLinkForKey;P.prototype.findNodeForKey=P.prototype.Qb;P.prototype.findPartForKey=P.prototype.findPartForKey;P.prototype.rebuildParts=P.prototype.Fd;P.prototype.transformViewToDoc=P.prototype.gu;P.prototype.transformRectDocToView=P.prototype.YA;P.prototype.transformDocToView=P.prototype.dr;P.prototype.centerRect=P.prototype.tt;P.prototype.scrollToRect=P.prototype.vw;P.prototype.scroll=P.prototype.scroll; P.prototype.highlightCollection=P.prototype.lA;P.prototype.highlight=P.prototype.kA;P.prototype.selectCollection=P.prototype.PA;P.prototype.select=P.prototype.select;P.prototype.updateAllRelationshipsFromData=P.prototype.fr;P.prototype.updateAllTargetBindings=P.prototype.updateAllTargetBindings;P.prototype.commit=P.prototype.commit;P.prototype.rollbackTransaction=P.prototype.Mf;P.prototype.commitTransaction=P.prototype.$a;P.prototype.startTransaction=P.prototype.Ba;P.prototype.raiseChanged=P.prototype.g; P.prototype.raiseChangedEvent=P.prototype.gb;P.prototype.removeChangedListener=P.prototype.Ik;P.prototype.addChangedListener=P.prototype.Lh;P.prototype.removeModelChangedListener=P.prototype.LA;P.prototype.addModelChangedListener=P.prototype.Ox;P.prototype.findLayer=P.prototype.wm;P.prototype.removeLayer=P.prototype.JA;P.prototype.addLayerAfter=P.prototype.$y;P.prototype.addLayerBefore=P.prototype.Mx;P.prototype.addLayer=P.prototype.mm;P.prototype.moveParts=P.prototype.moveParts; P.prototype.copyParts=P.prototype.pk;P.prototype.removeParts=P.prototype.$t;P.prototype.remove=P.prototype.remove;P.prototype.add=P.prototype.add;P.prototype.clearDelayedGeometries=P.prototype.yv;P.prototype.setProperties=P.prototype.Aw;P.prototype.resetInputOptions=P.prototype.sw;P.prototype.setInputOption=P.prototype.QA;P.prototype.getInputOption=P.prototype.Am;P.prototype.resetRenderingHints=P.prototype.tw;P.prototype.setRenderingHint=P.prototype.Gy;P.prototype.getRenderingHint=P.prototype.Qe; P.prototype.maybeUpdate=P.prototype.dd;P.prototype.requestUpdate=P.prototype.Vb;P.prototype.delayInitialization=P.prototype.uz;P.prototype.isUpdateRequested=P.prototype.rA;P.prototype.redraw=P.prototype.ge;P.prototype.invalidateDocumentBounds=P.prototype.Ta;P.prototype.findObjectsNear=P.prototype.Jg;P.prototype.findPartsNear=P.prototype.Nz;P.prototype.findObjectsIn=P.prototype.Ff;P.prototype.findPartsIn=P.prototype.hy;P.prototype.findObjectsAt=P.prototype.dj;P.prototype.findPartsAt=P.prototype.Mz; P.prototype.findObjectAt=P.prototype.$b;P.prototype.findPartAt=P.prototype.xm;P.prototype.focusObject=P.prototype.Yz;P.prototype.alignDocument=P.prototype.fz;P.prototype.zoomToRect=P.prototype.aB;P.prototype.zoomToFit=P.prototype.zoomToFit;P.prototype.diagramScroll=P.prototype.Wx;P.prototype.focus=P.prototype.focus;P.prototype.reset=P.prototype.reset;P.useDOM=function(a){gh=a?void 0!==qa.document:!1};P.isUsingDOM=function(){return gh}; var Pe=null,Hi=new Db,bj=null,aj=null,gh=void 0!==qa.document,Qi=null,Ri="",Ei=new E(P,"None",0),pj=new E(P,"Uniform",1),qj=new E(P,"UniformToFill",2),$f=new E(P,"CycleAll",10),dg=new E(P,"CycleNotDirected",11),fg=new E(P,"CycleNotDirectedFast",12),gg=new E(P,"CycleNotUndirected",13),ag=new E(P,"CycleDestinationTree",14),cg=new E(P,"CycleSourceTree",15),li=new E(P,"DocumentScroll",1),ni=new E(P,"InfiniteScroll",2),Gi=new E(P,"TreeParentCollapsed",21),Vk=new E(P,"AllParentsCollapsed",22),Wk=new E(P, "AnyParentsCollapsed",23),Xk=new H,Yk="2.1.19",Tk=!1,Zk=null,Ci=!1; function Di(){if(gh){var a=qa.document.createElement("canvas"),b=a.getContext("2d"),c=Ya("7ca11abfd022028846");b[c]=Ya("398c3597c01238");for(var d=["5da73c80a36455d5038e4972187c3cae51fd22",ra.Dx+"4ae6247590da4bb21c324ba3a84e385776",Ib.xF+"fb236cdfda5de14c134ba1a95a2d4c7cc6f93c1387",K.za],e=1;5>e;e++)b[Ya("7ca11abfd7330390")](Ya(d[e-1]),10,15*e);b[c]=Ya("39f046ebb36e4b");for(c=1;5>c;c++)b[Ya("7ca11abfd7330390")](Ya(d[c-1]),10,15*c);Zk=a}}P.className="Diagram"; P.fromDiv=function(a){var b=a;"string"===typeof a&&(b=qa.document.getElementById(a));return b instanceof HTMLDivElement&&b.B instanceof P?b.B:null};P.inherit=function(a,b){function c(){}if(Object.getPrototypeOf(a).prototype)throw Error("Used go.Diagram.inherit defining already defined class \n"+a);A(a,"function",P,"inherit");A(b,"function",P,"inherit");c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};P.None=Ei;P.Uniform=pj;P.UniformToFill=qj;P.CycleAll=$f;P.CycleNotDirected=dg; P.CycleNotDirectedFast=fg;P.CycleNotUndirected=gg;P.CycleDestinationTree=ag;P.CycleSourceTree=cg;P.DocumentScroll=li;P.InfiniteScroll=ni;P.TreeParentCollapsed=Gi;P.AllParentsCollapsed=Vk;P.AnyParentsCollapsed=Wk;function Oi(){this.Wy=null;this.l="zz@orderNum";"63ad05bbe23a1786468a4c741b6d2"===this._tk?this.af=this.l=!0:this.af=null} function Mj(a,b){b.Kb.setTransform(b.Yb,0,0,b.Yb,0,0);if(null===a.af){b="f";var c=qa[Ya("76a715b2f73f148a")][Ya("72ba13b5")];a.af=!0;if(gh){var d=P[Ya("76a115b6ed251eaf4692")];if(d)for(var e=Xk.iterator;e.next();){d=e.value;d=Ya(d).split(Ya("39e9"));if(6>d.length)break;var f=Ya(d[1]).split(".");if("7da71ca0"!==d[4])break;var g=Ya(ra[Ya("6cae19")]).split(".");if(f[0]>g[0]||f[0]===g[0]&&f[1]>=g[1]){f=c[Ya("76ad18b4f73e")];for(g=c[Ya("73a612b6fb191d")](Ya("35e7"))+2;g<f;g++)b+=c[g];f=b[Ya("73a612b6fb191d")](Ya(d[2])); 0>f&&Ya(d[2])!==Ya("7da71ca0ad381e90")&&(f=b[Ya("73a612b6fb191d")](Ya("76a715b2ef3e149757")));0>f&&(f=b[Ya("73a612b6fb191d")](Ya("76a715b2ef3e149757")));0>f&&(f=c[Ya("73a612b6fb191d")](Ya("7baa19a6f76c1988428554")));a.af=!(0<=f&&f<b[Ya("73a612b6fb191d")](Ya("35"))||-1===b[Ya("73a612b6fb191d")](Ya("35")));if(!a.af)break;f=Ya(d[2]);if("#"!==f[0])break;g=qa.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[Ya("79a417a0f0181a8946")]=d;if(qa.document[Ya("78a712aa")]){qa.document[Ya("78a712aa")][Ya("7bb806b6ed32388c4a875b")](g);h=qa.getComputedStyle(g).getPropertyValue(Ya("78a704b7e62456904c9b12701b6532a8"));qa.document[Ya("78a712aa")][Ya("68ad1bbcf533388c4a875b")](g);if(!h)break;if(-1!==h.indexOf(parseInt(f[1]+f[2],16))&&-1!==h.indexOf(parseInt(f[3]+f[4],16))){a.af=!1;break}else if(Za||$a||bb||cb)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.af=!1;break}}}else a.af=null,a.af=!1}}else{k=c[Ya("76ad18b4f73e")];for(e=c[Ya("73a612b6fb191d")](Ya("35e7"))+2;e<k;e++)b+=c[e];c=b[Ya("73a612b6fb191d")](Ya("7da71ca0ad381e90"));a.af=!(0<=c&&c<b[Ya("73a612b6fb191d")](Ya("35")))}}}return 0<a.af&&a!==a.Wy?!0:!1} function Pi(a,b){if(gh){void 0!==b&&null!==b||v("Diagram setup requires an argument DIV.");null!==a.Ra&&v("Diagram has already completed setup.");"string"===typeof b?a.Ra=qa.document.getElementById(b):b instanceof HTMLDivElement?a.Ra=b:v("No DIV or DIV id supplied: "+b);null===a.Ra&&v("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ra.B&&v("Invalid div id; div already has a Diagram associated with it.");"static"===qa.getComputedStyle(a.Ra,null).position&&(a.Ra.style.position="relative"); a.Ra.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.Ra.style["-ms-touch-action"]="none";a.Ra.innerHTML="";a.Ra.B=a;var c=a.fq?new Rj(a):new Sk(a);void 0!==c.style&&(c.style.position="absolute",c.style.top="0px",c.style.left="0px","rtl"===qa.getComputedStyle(a.Ra,null).getPropertyValue("direction")&&(a.Al=!0),c.style.zIndex="2",c.style.userSelect="none",c.style.webkitUserSelect="none",c.style.MozUserSelect="none");a.ya=c;a.Kb=c.context;b=a.Kb;a.Yb=a.computePixelRatio();a.Da=a.Ra.clientWidth|| 1;a.Ca=a.Ra.clientHeight||1;Tj(a,a.Da,a.Ca);a.Qr=b.aa[Ya("7eba17a4ca3b1a8346")][Ya("78a118b7")](b.aa,Zk,4,4);a.Ra.insertBefore(c.Ja,a.Ra.firstChild);c=new Sk(null);c.width=1;c.height=1;a.Bu=c;a.kx=c.context;if(gh){c=ua("div");var d=ua("div");c.style.position="absolute";c.style.overflow="auto";c.style.width=a.Da+"px";c.style.height=a.Ca+"px";c.style.zIndex="1";d.style.position="absolute";d.style.width="1px";d.style.height="1px";a.Ra.appendChild(c);c.appendChild(d);c.onscroll=ej;c.onmousedown=gj;c.ontouchstart= gj;c.B=a;c.Uy=!0;c.Vy=!0;a.Vs=c;a.Mp=d}a.Yt=sa(function(){a.Ch=null;a.P()},300);a.Nw=sa(function(){Wh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.Ck=function(b){if(a.isEnabled){a.gg=!0;var c=uj(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.vd=0);Aj(a,c,b)}};a.Bk=function(b){if(a.isEnabled)if(a.gg=!0,a.ve)b.preventDefault();else{var c=uj(a,b,!0);c.down=!0;c.clickCount=b.detail;if($a||bb)b.timeStamp-a.Mj<a.kt&&!a.currentTool.isBeyondDragSize()?a.vd++:a.vd=1,a.Mj= b.timeStamp,c.clickCount=a.vd;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():Aj(a,c,b)}};a.Ek=function(b){if(a.isEnabled)if(a.ve&&2===b.button)b.preventDefault();else if(a.ve&&0===b.button&&(a.ve=!1),a.ak)b.preventDefault();else{a.gg=!0;var c=uj(a,b,!0);c.up=!0;c.clickCount=b.detail;if($a||bb)c.clickCount=a.vd;c.bubbles=b.bubbles;c.targetDiagram=wj(b);a.doMouseUp();a.Nf();Aj(a,c,b)}};a.Fk=function(b){if(a.isEnabled){var c=uj(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();Aj(a,c,b)}};a.Dk=function(b){a.isEnabled&&(a.gg=!1,uj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())}; a.Hw=function(b){if(a.isEnabled){a.ak=!1;a.ve=!0;var c=xj(a,b,b.targetTouches[0],1<b.touches.length),d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);if(null!==d){var e=d.screenX;d=d.screenY;var k=a.Bo;b.timeStamp-a.Mj<a.kt&&!(25<Math.abs(k.x-e)||25<Math.abs(k.y-d))?a.vd++:a.vd=1;c.clickCount=a.vd;a.Mj=b.timeStamp;a.Bo.h(e,d)}a.doMouseDown();Aj(a,c,b)}};a.Gw=function(b){if(a.isEnabled){var c=null;0<b.targetTouches.length?c=b.targetTouches[0]: 0<b.changedTouches.length&&(c=b.changedTouches[0]);c=zj(a,b,c,1<b.touches.length);a.doMouseMove();Aj(a,c,b)}};a.Fw=function(b){if(a.isEnabled)if(a.ak)b.preventDefault();else if(!(1<b.touches.length)){var c=null,d=null;0<b.targetTouches.length?d=b.targetTouches[0]:0<b.changedTouches.length&&(d=b.changedTouches[0]);var e=yj(a,b,!1,!0,!1,!1);null!==d&&(c=qa.document.elementFromPoint(d.clientX,d.clientY),null!==c&&c.B instanceof P&&c.B!==a&&vj(c.B,d,e),vj(a,d,e),e.clickCount=a.vd);null===c?e.targetDiagram= wj(b):c.B?e.targetDiagram=c.B:e.targetDiagram=null;e.targetObject=null;a.doMouseUp();Aj(a,e,b);a.ve=!1}};a.Hm=function(b){if(a.isEnabled){a.gg=!0;var c=a.Js;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.Wj;var d=!1;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else if(null!==c[1]&&c[1].pointerId===b.pointerId)c[1]=b,d=!0;else if(null===c[0])c[0]=b;else if(null===c[1])c[1]=b,d=!0;else{b.preventDefault();return}if("touch"===b.pointerType||"pen"===b.pointerType)a.ak=!1,a.ve=!0;c=xj(a,b,b,d); d=a.Bo;var e="touch"===b.pointerType||"pen"===b.pointerType?25:10;b.timeStamp-a.Mj<a.kt&&!(Math.abs(d.x-b.screenX)>e||Math.abs(d.y-b.screenY)>e)?a.vd++:a.vd=1;c.clickCount=a.vd;a.Mj=b.timeStamp;a.Bo.Og(b.screenX,b.screenY);a.doMouseDown();1===b.button?b.preventDefault():Aj(a,c,b)}};a.Im=function(b){if(a.isEnabled){a.gg=!0;var c=a.Wj;if(null!==c[0]&&c[0].pointerId===b.pointerId)c[0]=b;else{if(null!==c[1]&&c[1].pointerId===b.pointerId){c[1]=b;return}if(null===c[0])c[0]=b;else return}c[0].pointerId=== b.pointerId&&(c=zj(a,b,b,null!==c[1]),c.targetDiagram=wj(b),a.doMouseMove(),Aj(a,c,b))}};a.Km=function(b){if(a.isEnabled){a.gg=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.Js;if(c&&a.ak)delete d[b.pointerId],b.preventDefault();else if(d=a.Wj,null!==d[0]&&d[0].pointerId===b.pointerId){d[0]=null;d=yj(a,b,!1,!0,!0,!1);var e=qa.document.elementFromPoint(b.clientX,b.clientY);null!==e&&e.B instanceof P&&e.B!==a&&vj(e.B,b,d);vj(a,b,d);d.clickCount=a.vd;null===e?d.targetDiagram=wj(b):e.B?d.targetDiagram= e.B:d.targetDiagram=null;d.targetObject=null;a.doMouseUp();Aj(a,d,b);c&&(a.ve=!1)}else null!==d[1]&&d[1].pointerId===b.pointerId&&(d[1]=null)}};a.Jm=function(b){if(a.isEnabled){a.gg=!1;var c=a.Js;c[b.pointerId]&&delete c[b.pointerId];c=a.Wj;null!==c[0]&&c[0].pointerId===b.pointerId&&(c[0]=null);null!==c[1]&&c[1].pointerId===b.pointerId&&(c[1]=null);"touch"!==b.pointerType&&"pen"!==b.pointerType&&(b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())}};b.yc(!0);cj(a)}}Oi.className="DiagramHelper"; function mf(a){this.l=void 0===a?new J:a;this.w=new J}ma.Object.defineProperties(mf.prototype,{point:{configurable:!0,get:function(){return this.l},set:function(a){this.l=a}},shifted:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a}}});mf.className="DraggingInfo";function ek(a,b,c){this.node=a;this.info=b;this.Vv=c}ek.className="DraggingNodeInfoPair";function ef(){this.reset()} ef.prototype.reset=function(){this.isGridSnapEnabled=!1;this.isGridSnapRealtime=!0;this.gridSnapCellSize=(new Hb(NaN,NaN)).freeze();this.gridSnapCellSpot=Hc;this.gridSnapOrigin=(new J(NaN,NaN)).freeze();this.groupsSnapMembers=this.dragsTree=this.dragsLink=!1;this.groupsAlwaysMove=!0};ef.className="DraggingOptions";function $k(a){1<arguments.length&&v("Palette constructor can only take one optional argument, the DIV HTML element or its id.");P.call(this,a);al(this)}la($k,P); function al(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=Ic;a.layout=new bl}$k.prototype.reset=function(){P.prototype.reset.call(this);al(this)};$k.className="Palette"; function cl(a){1<arguments.length&&v("Overview constructor can only take one optional argument, the DIV HTML element or its id.");P.call(this,a);var b=this;this.animationManager.isEnabled=!1;this.Xb=!0;this.Ma=null;this.ql=this.pl=!1;this.w=this.L=!0;this.ib=0;this.$=!1;this.Zl=null;this.Gy("drawShadows",!1);var c=new S,d=new Yf;d.stroke="magenta";d.strokeWidth=2;d.fill="transparent";d.name="BOXSHAPE";c.selectable=!0;c.selectionAdorned=!1;c.selectionObjectName="BOXSHAPE";c.locationObjectName="BOXSHAPE"; c.resizeObjectName="BOXSHAPE";c.cursor="move";c.add(d);this.l=c;this.allowDelete=this.allowCopy=!1;this.allowSelect=!0;this.autoScrollRegion=new lc(0,0,0,0);this.sa.h(0,0);this.toolManager.bb("Dragging",new dl,this.toolManager.mouseMoveTools);this.click=function(){var a=b.observed;if(null!==a){var c=a.viewportBounds,d=b.lastInput.documentPoint;a.position=new J(d.x-c.width/2,d.y-c.height/2)}};this.Zh=function(){b.Ta();el(b)};this.Pf=function(){null!==b.observed&&(b.Ta(),b.P())};this.Yh=function(){1> b.updateDelay?b.P():b.$||(b.$=!0,setTimeout(function(){b.$=!1;fl(b);b.P()},b.updateDelay))};this.Pc=function(){null!==b.observed&&el(b)};this.autoScale=pj;this.Xb=!1}la(cl,P);cl.prototype.computePixelRatio=function(){return 1}; cl.prototype.hc=function(){null===this.Ra&&v("No div specified");null===this.ya&&v("No canvas specified");if(!(this.ya instanceof Rj)&&(wi(this.box),this.Gc)){var a=this.observed;if(null!==a&&!a.animationManager.isAnimating){Kj(this);var b=this.ya;a=this.Kb;a.yc(!0);a.setTransform(1,0,0,1,0,0);a.clearRect(0,0,b.width,b.height);1>this.updateDelay?gl(this):null!==this.Zl&&(a.drawImage(this.Zl.Ja,0,0),b=this.sb,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.Oa.j;for(var c=b.length,d=0;d<c;d++)b[d].hc(a,this);this.Gc=this.yi=!1}}};function fl(a){var b=a.ya,c=a.Kb;if(null!==b&&null!==c){Kj(a);if(null===a.Zl){var d=new Sk(null);d.width=b.width;d.height=b.height;a.Zl=d}try{a.ya=a.Zl,a.Kb=a.ya.context,a.Kb.yc(!0),a.Kb.setTransform(1,0,0,1,0,0),a.Kb.clearRect(0,0,a.ya.width,a.ya.height),gl(a)}finally{a.ya=b,a.Kb=c}}} function gl(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=L.alloc().assign(a.viewportBounds).Nc(b.viewportBounds),Dj(b,e),L.free(e),ij(b));var f=a.sb;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.Kb;e.scale(a.Yb,a.Yb);e.transform(f.m11,f.m12,f.m21,f.m22,f.dx,f.dy);b=b.Oa.j;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=yi(h,e),l.hc(e,k),e.globalAlpha=h);else{for(var m=yi(h,e),n=k.scale,p=L.alloc(),r=h.Ha.j,q=r.length,u=0;u<q;u++){var x=r[u];(d||x!==l)&&h.$i(e,x,k,null,n,p)}L.free(p);e.globalAlpha=m}}}}} function el(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Gc=!0;c=c.viewportBounds;var d=b.selectionObject,e=Hb.alloc();e.h(c.width,c.height);d.desiredSize=e;Hb.free(e);a=2/a.scale;d instanceof Yf&&(d.strokeWidth=a);b.location=new J(c.x-a/2,c.y-a/2);b.isSelected=!0}}}cl.prototype.computeBounds=function(){var a=this.observed;if(null===a)return vc;var b=a.documentBounds.copy();b.Nc(a.viewportBounds);return b};cl.prototype.oy=function(){!0!==this.Gc&&(this.Gc=!0,this.Vb())}; cl.prototype.Sq=function(a,b,c,d){this.Xb||(hj(this),this.P(),nj(this),this.Ta(),el(this),this.$d.scale=c,this.$d.position.x=a.x,this.$d.position.y=a.y,this.$d.bounds.assign(a),this.$d.bw=d,this.U("ViewportBoundsChanged",this.$d,a))}; ma.Object.defineProperties(cl.prototype,{observed:{configurable:!0,get:function(){return this.Ma},set:function(a){var b=this.Ma;null!==a&&w(a,P,cl,"observed");a instanceof cl&&v("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.Nm("ViewportBoundsChanged",this.Zh),b.Nm("DocumentBoundsChanged",this.Pf),b.Nm("InvalidateDraw",this.Yh),b.Nm("AnimationFinished",this.Pc));this.Ma=a;null!==a&&(a.fk("ViewportBoundsChanged",this.Zh),a.fk("DocumentBoundsChanged", this.Pf),a.fk("InvalidateDraw",this.Yh),a.fk("AnimationFinished",this.Pc),this.add(this.box),el(this));this.Ta();if(null===a){this.Zl=null;var c=this.ya,d=this.Kb;c&&d&&(d.setTransform(1,0,0,1,0,0),d.clearRect(0,0,c.width,c.height))}else fl(this),el(this),this.P();this.g("observed",b,a)}}},box:{configurable:!0,get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(this.l=a,this.remove(b),this.add(this.l),el(this),this.g("box",b,a))}},drawsTemporaryLayers:{configurable:!0, enumerable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(this.L=a,this.ge())}},drawsGrid:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(this.w=a,this.ge())}},updateDelay:{configurable:!0,get:function(){return this.ib},set:function(a){0>a&&(a=0);this.ib!==a&&(this.ib=a)}}});cl.className="Overview";function dl(){df.call(this);this.l=null}la(dl,df); dl.prototype.canStart=function(){if(!this.isEnabled)return!1;var a=this.diagram;if(null===a||!a.allowMove||!a.allowSelect)return!1;var b=a.observed;if(null===b)return!1;var c=a.lastInput;if(!c.left||a.currentTool!==this&&(!this.isBeyondDragSize()||c.isTouchEvent&&c.timestamp-a.firstInput.timestamp<this.delay))return!1;null===this.findDraggablePart()&&(c=b.viewportBounds,this.l=new J(c.width/2,c.height/2),a=a.firstInput.documentPoint,b.position=new J(a.x-this.l.x,a.y-this.l.y));return!0}; dl.prototype.doActivate=function(){this.l=null;df.prototype.doActivate.call(this)};dl.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};dl.prototype.moveParts=function(){var a=this.diagram,b=a.observed;if(null!==b){var c=a.box;if(null!==c){if(null===this.l){var d=a.firstInput.documentPoint;c=c.location;this.l=new J(d.x-c.x,d.y-c.y)}a=a.lastInput.documentPoint;b.position=new J(a.x-this.l.x,a.y-this.l.y)}}};dl.className="OverviewDraggingTool"; function hl(){0<arguments.length&&za(hl);fb(this);this.B=Pe;this.ib=this.L=this.w=!0;this.$=this.Ma=this.qd=this.Na=!1;this.Ji=this.l=null;this.Pc=1.05;this.Uu=NaN;this.px=null;this.tv=NaN;this.sv=vc;this.yg=null;this.Oc=200}hl.prototype.toString=function(){return"CommandHandler"};hl.prototype.he=function(a){this.B=a}; hl.prototype.doKeyDown=function(){var a=this.diagram,b=a.lastInput,c=db?b.meta:b.control,d=b.shift,e=b.alt,f=b.key;!c||"C"!==f&&"Insert"!==f?c&&"X"===f||d&&"Del"===f?this.canCutSelection()&&this.cutSelection():c&&"V"===f||d&&"Insert"===f?this.canPasteSelection()&&this.pasteSelection():c&&"Y"===f||e&&d&&"Backspace"===f?this.canRedo()&&this.redo():c&&"Z"===f||e&&"Backspace"===f?this.canUndo()&&this.undo():"Del"===f||"Backspace"===f?this.canDeleteSelection()&&this.deleteSelection():c&&"A"===f?this.canSelectAll()&& this.selectAll():"Esc"===f?this.canStopCommand()&&this.stopCommand():"Up"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","up"):a.scroll("line","up")):"Down"===f?a.allowVerticalScroll&&(c?a.scroll("pixel","down"):a.scroll("line","down")):"Left"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","left"):a.scroll("line","left")):"Right"===f?a.allowHorizontalScroll&&(c?a.scroll("pixel","right"):a.scroll("line","right")):"PageUp"===f?d&&a.allowHorizontalScroll?a.scroll("page","left"):a.allowVerticalScroll&& a.scroll("page","up"):"PageDown"===f?d&&a.allowHorizontalScroll?a.scroll("page","right"):a.allowVerticalScroll&&a.scroll("page","down"):"Home"===f?c&&a.allowVerticalScroll?a.scroll("document","up"):!c&&a.allowHorizontalScroll&&a.scroll("document","left"):"End"===f?c&&a.allowVerticalScroll?a.scroll("document","down"):!c&&a.allowHorizontalScroll&&a.scroll("document","right"):" "===f?this.canScrollToPart()&&this.scrollToPart():"Subtract"===f?this.canDecreaseZoom()&&this.decreaseZoom():"Add"===f?this.canIncreaseZoom()&& this.increaseZoom():c&&"0"===f?this.canResetZoom()&&this.resetZoom():d&&"Z"===f?this.canZoomToFit()&&this.zoomToFit():c&&!d&&"G"===f?this.canGroupSelection()&&this.groupSelection():c&&d&&"G"===f?this.canUngroupSelection()&&this.ungroupSelection():b.event&&113===b.event.which?this.canEditTextBlock()&&this.editTextBlock():b.event&&93===b.event.which?this.canShowContextMenu()&&this.showContextMenu():b.bubbles=!0:this.canCopySelection()&&this.copySelection()}; hl.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};hl.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Ua&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};hl.prototype.canStopCommand=function(){return!0}; hl.prototype.selectAll=function(){var a=this.diagram;a.P();try{a.currentCursor="wait";a.U("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.U("ChangedSelection",a.selection),a.currentCursor=""}};hl.prototype.canSelectAll=function(){return this.diagram.allowSelect}; hl.prototype.deleteSelection=function(){var a=this.diagram;try{a.currentCursor="wait";a.U("ChangingSelection",a.selection);a.Ba("Delete");a.U("SelectionDeleting",a.selection);for(var b=new I,c=a.selection.iterator;c.next();)il(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.$t(b,!0);a.U("SelectionDeleted",b)}finally{a.$a("Delete"),a.U("ChangedSelection",a.selection),a.currentCursor=""}}; hl.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};hl.prototype.copySelection=function(){var a=this.diagram,b=new I;for(a=a.selection.iterator;a.next();)il(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};hl.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1}; hl.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};hl.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1}; hl.prototype.copyToClipboard=function(a){var b=this.diagram,c=null;if(null===a)Qi=null,Ri="";else{c=b.model;var d=!1,e=!1,f=null;try{c.Em()&&(d=c.nk,c.nk=this.copiesParentKey),c.wk()&&(e=c.mk,c.mk=this.copiesGroupKey),f=b.pk(a,null,!0)}finally{c.Em()&&(c.nk=d),c.wk()&&(c.mk=e),c=new H,c.addAll(f),Qi=c,Ri=b.model.dataFormat}}b.U("ClipboardChanged",c)}; hl.prototype.pasteFromClipboard=function(){var a=new I,b=Qi;if(null===b)return a;var c=this.diagram;if(Ri!==c.model.dataFormat)return a;var d=c.model,e=!1,f=!1,g=null;try{d.Em()&&(e=d.nk,d.nk=this.copiesParentKey),d.wk()&&(f=d.mk,d.mk=this.copiesGroupKey),g=c.pk(b,c,!1)}finally{for(d.Em()&&(d.nk=e),d.wk()&&(d.mk=f),b=g.iterator;b.next();)c=b.value,d=b.key,c.location.o()||(d.location.o()?c.location=d.location:!c.position.o()&&d.position.o()&&(c.position=d.position)),a.add(c)}return a}; hl.prototype.pasteSelection=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.currentCursor="wait";b.U("ChangingSelection",b.selection);b.Ba("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.o()){var f=this.computeEffectiveCollection(b.selection,b.cl);Ef(b,f,new J(a.x-e.centerX,a.y-e.centerY),b.cl,!1)}}b.U("ClipboardPasted",c)}finally{b.$a("Paste"),b.U("ChangedSelection", b.selection),b.currentCursor=""}};hl.prototype.canPasteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowClipboard||null===Qi||0===Qi.count||Ri!==a.model.dataFormat?!1:!0};hl.prototype.undo=function(){this.diagram.undoManager.undo()};hl.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};hl.prototype.redo=function(){this.diagram.undoManager.redo()}; hl.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};hl.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);C(a,hl,"decreaseZoom:factor");var b=this.diagram;b.autoScale===Ei&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))}; hl.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);C(a,hl,"canDecreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Ei)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};hl.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);C(a,hl,"increaseZoom:factor");var b=this.diagram;b.autoScale===Ei&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))}; hl.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);C(a,hl,"canIncreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Ei)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};hl.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);C(a,hl,"resetZoom:newscale");var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)}; hl.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);C(a,hl,"canResetZoom:newscale");var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom}; hl.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.ed();a.ge();var c=a.position,d=a.scale;Eh(b,"Zoom To Fit");d===this.tv&&!isNaN(this.Uu)&&a.documentBounds.A(this.sv)?(a.scale=this.Uu,a.position=this.px,this.tv=NaN,this.sv=vc):(this.Uu=d,this.px=c.copy(),a.zoomToFit(),this.tv=a.scale,this.sv=a.documentBounds.copy());Gh(b)};hl.prototype.canZoomToFit=function(){return this.diagram.allowZoom}; hl.prototype.scrollToPart=function(a){void 0===a&&(a=null);null!==a&&w(a,S,hl,"part");var b=this.diagram;Zi(b);if(null===a){try{null!==this.yg&&(this.yg.next()?a=this.yg.value:this.yg=null)}catch(k){this.yg=null}null===a&&(0<b.highlighteds.count?this.yg=b.highlighteds.iterator:0<b.selection.count&&(this.yg=b.selection.iterator),null!==this.yg&&this.yg.next()&&(a=this.yg.value))}if(null!==a){var c=b.animationManager;Eh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=jl(this,a,[a]);if(1=== e.length)b.Ba(),b.tt(a.actualBounds),b.$a("Scroll To Part");else{var f=function(){b.Ba();for(var a=e.pop();0<e.length&&a instanceof T&&a.isTreeExpanded&&(!(a instanceof Hf)||a.isSubGraphExpanded);)a=e.pop();0<e.length?(a instanceof S&&b.vw(a.actualBounds),a instanceof T&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof Hf&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof S&&b.tt(a.actualBounds),b.Nm("LayoutCompleted",g));b.$a("Scroll To Part")},g=function(){ta(f,(c.isEnabled?c.duration: 0)+d)};b.fk("LayoutCompleted",g);f()}}else{var h=b.position.copy();b.tt(a.actualBounds);h.Sa(b.position)&&c.ed()}}}; function jl(a,b,c){if(b.isVisible())return c;if(b instanceof Te)jl(a,b.adornedPart,c);else if(b instanceof R){var d=b.fromNode;null!==d&&jl(a,d,c);b=b.toNode;null!==b&&jl(a,b,c)}else b instanceof T&&(d=b.labeledLink,null!==d&&jl(a,d,c),d=b.Kg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),jl(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),jl(a,b,c));return c} hl.prototype.canScrollToPart=function(a){void 0===a&&(a=null);if(null!==a&&!(a instanceof S))return!1;a=this.diagram;return 0===a.selection.count&&0===a.highlighteds.count?!1:a.allowHorizontalScroll&&a.allowVerticalScroll}; hl.prototype.collapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ba("Collapse Tree");Eh(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 T&&e.isTreeExpanded&&(e.collapseTree(),c.add(e))}b.U("TreeCollapsed",c)}finally{b.$a("Collapse Tree")}}; hl.prototype.canCollapseTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof T&&a.isTreeExpanded))return!1;if(0<a.Dq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&b.isTreeExpanded&&0<b.Dq().count)return!0;return!1}; hl.prototype.expandTree=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ba("Expand Tree");Eh(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 T&&!e.isTreeExpanded&&(e.expandTree(),c.add(e))}b.U("TreeExpanded",c)}finally{b.$a("Expand Tree")}}; hl.prototype.canExpandTree=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a){if(!(a instanceof T)||a.isTreeExpanded)return!1;if(0<a.Dq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&!b.isTreeExpanded&&0<b.Dq().count)return!0;return!1}; hl.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.mj()){var c=this.archetypeGroupData;if(null!==c){var d=null;try{a.currentCursor="wait";a.U("ChangingSelection",a.selection);a.Ba("Group");for(var e=new H,f=a.selection.iterator;f.next();){var g=f.value;g.bc()&&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.ee(m.value)){f=!0;break}f||h.add(l)}if(0<h.count){var n=h.first().containingGroup;if(null!==n)for(;null!== n;){e=!1;for(var p=h.iterator;p.next();)if(!p.value.ee(n)){e=!0;break}if(e)n=n.containingGroup;else break}if(c instanceof Hf)Lg(c),d=c.copy(),null!==d&&a.add(d);else if(b.Lt(c)){var r=b.copyNodeData(c);Fa(r)&&(b.Bf(r),d=a.cj(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.U("SelectionGrouped",d)}finally{a.$a("Group"),a.U("ChangedSelection", a.selection),a.currentCursor=""}}}};hl.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.mj()||null===this.archetypeGroupData)return!1;for(a=a.selection.iterator;a.next();){var b=a.value;if(b.bc()&&b.canGroup())return!0}return!1}; function kl(a){var b=La();for(a=a.iterator;a.next();){var c=a.value;c instanceof R||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.ee(b[g])){f=!1;break}f&&a.add(e)}Oa(b);return a} hl.prototype.isValidMember=function(a,b){if(null===b||a===b||b instanceof R)return!1;if(null!==a){if(a===b||a.ee(b))return!1;var c=a.memberValidation;if(null!==c&&!c(a,b)||null===a.data&&null!==b.data||null!==a.data&&null===b.data)return!1}c=this.memberValidation;return null!==c?c(a,b):!0}; hl.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.mj())try{b.currentCursor="wait";b.U("ChangingSelection",b.selection);b.Ba("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 Hf&&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.pa(l.data):void 0;g.addAll(k.memberParts); for(var n=g.iterator;n.next();){var p=n.value;p.isSelected=!0;if(!(p instanceof R)){var r=p.data;null!==r?c.cu(r,m):p.containingGroup=l}}b.remove(k)}}b.U("SelectionUngrouped",d,g)}finally{b.$a("Ungroup"),b.U("ChangedSelection",b.selection),b.currentCursor=""}}; hl.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.mj())return!1;if(null!==a){if(!(a instanceof Hf))return!1;if(a.canUngroup())return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof Hf&&b.canUngroup())return!0;return!1}; hl.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=kl(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c}; hl.prototype.collapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ba("Collapse SubGraph");Eh(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 Hf&&e.isSubGraphExpanded&&(e.collapseSubGraph(),c.add(e))}b.U("SubGraphCollapsed",c)}finally{b.$a("Collapse SubGraph")}}; hl.prototype.canCollapseSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof Hf&&a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof Hf&&b.isSubGraphExpanded)return!0;return!1}; hl.prototype.expandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;try{b.Ba("Expand SubGraph");Eh(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 Hf&&!e.isSubGraphExpanded&&(e.expandSubGraph(),c.add(e))}b.U("SubGraphExpanded",c)}finally{b.$a("Expand SubGraph")}}; hl.prototype.canExpandSubGraph=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly)return!1;if(null!==a)return a instanceof Hf&&!a.isSubGraphExpanded?!0:!1;for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof Hf&&!b.isSubGraphExpanded)return!0;return!1}; hl.prototype.editTextBlock=function(a){void 0===a&&(a=null);null!==a&&w(a,ih,hl,"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.vm(function(a){return a instanceof ih&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}}; hl.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 ih))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.vm(function(a){return a instanceof ih&&a.editable}),null!==a))return!0;return!1}; hl.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 N?e=a.ma(Mc):b.viewportBounds.fa(d.documentPoint)||(e=b.viewportBounds,e=new J(e.x+e.width/2,e.y+e.height/2));null!==e&&(d.viewPoint=b.dr(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;eh(c,!1,a)}}; hl.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}; hl.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.cl);d=new Db;if(null===a)return d;for(var f=a.iterator;f.next();)ck(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 R&&(b=a.fromNode,null===b||d.contains(b)?(b=a.toNode,null===b||d.contains(b)||d.remove(a)):d.remove(a));return d}; ma.Object.defineProperties(hl.prototype,{diagram:{configurable:!0,get:function(){return this.B}},copiesClipboardData:{configurable:!0,get:function(){return this.w},set:function(a){A(a,"boolean",hl,"copiesClipboardData");this.w=a}},copiesConnectedLinks:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"boolean",hl,"copiesConnectedLinks");this.L=a}},deletesConnectedLinks:{configurable:!0,get:function(){return this.ib},set:function(a){A(a, "boolean",hl,"deletesConnectedLinks");this.ib=a}},copiesTree:{configurable:!0,get:function(){return this.Na},set:function(a){A(a,"boolean",hl,"copiesTree");this.Na=a}},deletesTree:{configurable:!0,get:function(){return this.qd},set:function(a){A(a,"boolean",hl,"deletesTree");this.qd=a}},copiesParentKey:{configurable:!0,get:function(){return this.Ma},set:function(a){A(a,"boolean",hl,"copiesParentKey");this.Ma=a}},copiesGroupKey:{configurable:!0, get:function(){return this.$},set:function(a){A(a,"boolean",hl,"copiesGroupKey");this.$=a}},archetypeGroupData:{configurable:!0,get:function(){return this.l},set:function(a){null!==a&&A(a,"object",hl,"archetypeGroupData");var b=this.diagram;F&&(b=b.model,!b.mj()||a instanceof Hf||b.Lt(a)||v("CommandHandler.archetypeGroupData must be either a Group or a data object for which GraphLinksModel.isGroupForNodeData is true: "+a));this.l=a}},memberValidation:{configurable:!0,get:function(){return this.Ji}, set:function(a){null!==a&&A(a,"function",hl,"memberValidation");this.Ji=a}},defaultScale:{configurable:!0,get:function(){return this.diagram.defaultScale},set:function(a){this.diagram.defaultScale=a}},zoomFactor:{configurable:!0,get:function(){return this.Pc},set:function(a){C(a,hl,"zoomFactor");1<a||v("zoomFactor must be larger than 1.0, not: "+a);this.Pc=a}},scrollToPartPause:{configurable:!0,get:function(){return this.Oc},set:function(a){C(a,hl,"scrollToPartPause"); this.Oc=a}}});hl.className="CommandHandler";Ki=function(){return new hl}; function N(){fb(this);this.I=4225027;this.wb=1;this.wg=null;this.Wa="";this.jc=this.ob=null;this.sa=(new J(NaN,NaN)).freeze();this.Sc=cc;this.ng=Wb;this.mg=bc;this.sb=new Ib;this.ai=new Ib;this.kg=new Ib;this.Fa=this.il=1;this.dc=0;this.Je=ll;this.oh=Ec;this.sc=(new L(NaN,NaN,NaN,NaN)).freeze();this.Ab=(new L(NaN,NaN,NaN,NaN)).freeze();this.tc=(new L(0,0,NaN,NaN)).freeze();this.S=this.tp=this.vp=null;this.Sk=this.Bb=ld;this.Gp=0;this.Hp=1;this.Xg=0;this.wn=1;this.$p=null;this.Np=-Infinity;this.Ul= 0;this.Vl=Rb;this.Wl=og;this.ri="";this.jb=this.R=null;this.Wk=-1;this.Yl=this.sd=this.pi=this.bm=null;this.Ms=Mg;this.Jp=this.Tg=this.Vj=null}var Hd,Mg,Og,ll,ml,nl,ol,pl,ql,rl; N.prototype.cloneProtected=function(a){a.I=this.I|6144;a.wb=this.wb;a.Wa=this.Wa;a.ob=this.ob;a.jc=this.jc;a.Tg=this.Tg;a.sa.assign(this.sa);a.Sc=this.Sc.J();a.ng=this.ng.J();a.mg=this.mg.J();a.kg=this.kg.copy();a.Fa=this.Fa;a.dc=this.dc;a.Je=this.Je;a.oh=this.oh.J();a.sc.assign(this.sc);a.Ab.assign(this.Ab);a.tc.assign(this.tc);a.tp=this.tp;null!==this.S&&(a.S=this.S.copy());a.Bb=this.Bb.J();a.Sk=this.Sk.J();a.Gp=this.Gp;a.Hp=this.Hp;a.Xg=this.Xg;a.wn=this.wn;a.$p=this.$p;a.Np=this.Np;a.Ul=this.Ul; a.Vl=this.Vl.J();a.Wl=this.Wl;a.ri=this.ri;null!==this.R&&(a.R=this.R.copy());a.jb=this.jb;a.Wk=this.Wk;null!==this.pi&&(a.pi=Ia(this.pi));null!==this.sd&&(a.sd=this.sd.copy());a.Yl=this.Yl};N.prototype.Lx=function(a){var b=this.pi;if(Ga(b))for(var c=0;c<b.length;c++){if(b[c]===a)return}else this.pi=b=[];b.push(a)};N.prototype.Ef=function(a){a.vp=null;a.Vj=null;a.u()}; N.prototype.clone=function(){var a=new this.constructor;this.cloneProtected(a);if(null!==this.pi)for(var b=0;b<this.pi.length;b++){var c=this.pi[b];a[c]=this[c]}return a};N.prototype.copy=function(){return this.clone()};t=N.prototype;t.mb=function(a){a.classType===R?0===a.name.indexOf("Orient")?this.segmentOrientation=a:v("Unknown Link enum value for GraphObject.segmentOrientation property: "+a):a.classType===N?this.stretch=a:Ba(this,a)};t.toString=function(){return Pa(this.constructor)+"#"+pb(this)}; function sl(a){null===a.R&&(a.R=new tl)}t.Kc=function(){if(null===this.S){var a=new ul;a.hh=Gc;a.Gh=Gc;a.fh=10;a.Eh=10;a.gh=0;a.Fh=0;this.S=a}}; t.gb=function(a,b,c,d,e,f,g){var h=this.part;if(null!==h&&(h.Hk(a,b,c,d,e,f,g),c===this&&a===He&&vl(this)&&wl(this,h,b),f=this.diagram,null===this.Tg||null===f||!f.xk||f.undoManager.isUndoingRedoing||f.currentTool!==f.toolManager||f.animationManager.rn||(a=this.Tg.get(b),null===a||f.animationManager.isTicking||(null===this.Jp&&(this.Jp=new Db),g=0===f.undoManager.transactionLevel,a.startCondition===si?g=!0:a.startCondition===ui&&(g=!1),g?(f=new Dh,ti(a,f),g=this.Jp.get(a),null!==g&&g.stop(),this.Jp.add(a, f),f.pv=this,f.Gx=a,f.add(this,b,d,e),f.start()):(Fh(f.animationManager,"Trigger"),f.animationManager.defaultAnimation.add(this,b,d,e)))),this instanceof U&&c===h&&0!==(h.I&16777216)&&null!==h.data))for(c=this.Z.j,d=c.length,e=0;e<d;e++)h=c[e],h instanceof U&&Uj(h,function(a){null!==a.data&&0!==(a.I&16777216)&&a.Ga(b)})}; function wl(a,b,c){var d=a.ej();if(null!==d)for(var e=a.jb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=xl(f,d,a);if(null===g)continue;f.gr(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.gr(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.gr(a,h,c,d)}g===a&&(h=d.zt(f.sj),null!==h&&f.Lw(h,g,c))}}t.zt=function(a){return this.Wk===a?this:null}; t.g=function(a,b,c){this.gb(He,a,this,b,c)};function yl(a,b,c,d,e){var f=a.sc,g=a.kg;g.reset();zl(a,g,b,c,d,e);a.kg=g;f.h(b,c,d,e);g.Mt()||g.Iw(f)}function Al(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Mc(b,d):a.Oh(b,d)} t.gy=function(a,b,c){if(!1===this.pickable)return!1;var d=this.naturalBounds;b=a.Pe(b);return c?Kb(a.x,a.y,0,0,0,d.height)<=b||Kb(a.x,a.y,0,d.height,d.width,d.height)<=b||Kb(a.x,a.y,d.width,d.height,d.width,0)<=b||Kb(a.x,a.y,d.width,0,0,0)<=b:a.kd(0,0)<=b&&a.kd(0,d.height)<=b&&a.kd(d.width,0)<=b&&a.kd(d.width,d.height)<=b};t.je=function(){return!0}; t.fa=function(a){F&&w(a,J,N,"containsPoint:p");var b=J.alloc();b.assign(a);this.transform.xa(b);var c=this.actualBounds;if(!c.o())return J.free(b),!1;var d=this.diagram;if(null!==d&&d.ve){var e=d.Am("extraTouchThreshold"),f=d.Am("extraTouchArea"),g=f/2,h=this.naturalBounds;d=this.Gf()*d.scale;var k=1/d;if(h.width*d<e&&h.height*d<e)return a=rc(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 Te||this instanceof Yf?rc(c.x-5,c.y-5,c.width+10,c.height+10,b.x,b.y): c.fa(b))this.sd&&!this.sd.fa(b)?e=!1:null!==this.jc&&c.fa(b)?e=!0:null!==this.ob&&this.tc.fa(a)?e=!0:e=this.Ph(a);J.free(b);return e};t.Ph=function(a){var b=this.naturalBounds;return rc(0,0,b.width,b.height,a.x,a.y)}; t.Oe=function(a){F&&w(a,L,N,"containsRect:r");if(0===this.angle)return this.actualBounds.Oe(a);var b=this.naturalBounds;b=L.allocAt(0,0,b.width,b.height);var c=this.transform,d=!1,e=J.allocAt(a.x,a.y);b.fa(c.de(e))&&(e.h(a.x,a.bottom),b.fa(c.de(e))&&(e.h(a.right,a.bottom),b.fa(c.de(e))&&(e.h(a.right,a.y),b.fa(c.de(e))&&(d=!0))));J.free(e);L.free(b);return d}; t.Oh=function(a,b){F&&w(a,L,N,"containedInRect:r");if(void 0===b)return a.Oe(this.actualBounds);var c=this.naturalBounds,d=!1,e=J.allocAt(0,0);a.fa(b.xa(e))&&(e.h(0,c.height),a.fa(b.xa(e))&&(e.h(c.width,c.height),a.fa(b.xa(e))&&(e.h(c.width,0),a.fa(b.xa(e))&&(d=!0))));J.free(e);return d}; t.Mc=function(a,b){F&&w(a,L,N,"intersectsRect:r");if(void 0===b&&(b=this.transform,0===this.angle))return a.Mc(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.fa(b.xa(d))||a.fa(b.xa(e))||a.fa(b.xa(f))||a.fa(b.xa(g)))h=!0;else{c=L.allocAt(0,0,c.width,c.height);var k=J.allocAt(a.x,a.y);c.fa(b.de(k))?h=!0:(k.h(a.x,a.bottom),c.fa(b.de(k))?h=!0:(k.h(a.right,a.bottom),c.fa(b.de(k))?h=!0:(k.h(a.right,a.y), c.fa(b.de(k))&&(h=!0))));J.free(k);L.free(c);!h&&(K.It(a,d,e)||K.It(a,e,f)||K.It(a,f,g)||K.It(a,g,d))&&(h=!0)}J.free(d);J.free(e);J.free(f);J.free(g);return h};t.ma=function(a,b){void 0===b&&(b=new J);if(a instanceof M){F&&a.Sb()&&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.Cd.xa(b);return b}; t.zm=function(a){void 0===a&&(a=new L);var b=this.naturalBounds,c=this.Cd,d=J.allocAt(0,0).transform(c);a.h(d.x,d.y,0,0);d.h(b.width,0).transform(c);qc(a,d.x,d.y,0,0);d.h(b.width,b.height).transform(c);qc(a,d.x,d.y,0,0);d.h(0,b.height).transform(c);qc(a,d.x,d.y,0,0);J.free(d);return a};t.hj=function(){var a=this.Cd;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.Gf=function(){if(0!==(this.I&4096)===!1)return this.il;var a=this.Fa;return null!==this.panel?a*this.panel.Gf():a};t.Ft=function(a,b){void 0===b&&(b=new J);b.assign(a);this.Cd.de(b);return b};t.bd=function(a,b,c){return this.uk(a.x,a.y,b.x,b.y,c)}; t.uk=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.bd(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.bd(0,0,d.width,d.height,g,a,b,c,e);e.transform(f);return c}; N.prototype.measure=function(a,b,c,d){if(!1!==Hj(this)){var e=this.oh,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 Yf&&(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 U;switch(Bl(this,!0)){case Mg:g=e=0;h&&(b=a=Infinity); break;case Hd:isFinite(a)&&a>c&&(e=a);isFinite(b)&&b>d&&(g=b);break;case ml:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case nl:isFinite(b)&&b>d&&(g=b),e=0,h&&(a=Infinity)}h=this.maxSize;var k=this.minSize;e>h.width&&k.width<h.width&&(e=h.width);g>h.height&&k.height<h.height&&(g=h.height);c=Math.max(e/this.scale,k.width);d=Math.max(g/this.scale,k.height);h.width<c&&(c=Math.min(k.width,c));h.height<d&&(d=Math.min(k.height,d));a=Math.min(h.width,a);b=Math.min(h.height,b);a=Math.max(c,a);b=Math.max(d, b);if(90===f||270===f)f=a,a=b,b=f,f=c,c=d,d=f;this.sc.ka();this.Gm(a,b,c,d);this.sc.freeze();this.sc.o()||v("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.sc.toString());Cj(this,!1)}};N.prototype.Gm=function(){};N.prototype.Jf=function(){return!1}; N.prototype.arrange=function(a,b,c,d,e){this.zl();var f=L.alloc();f.assign(this.Ab);this.Ab.ka();!1===Ij(this)?this.Ab.h(a,b,c,d):this.Nh(a,b,c,d);this.Ab.freeze();void 0===e?this.sd=null:this.sd=e;c=!1;if(void 0!==e)c=!0;else if(e=this.panel,null===e||e.type!==U.TableRow&&e.type!==U.TableColumn||(e=e.panel),null!==e&&(e=e.tc,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 ih&&(a=this.naturalBounds, this.rs>a.height||this.vb>a.width)))c=!0;this.I=c?this.I|256:this.I&-257;this.Ab.o()||v("Non-real actualBounds has been set. Object "+this+", actualBounds: "+this.Ab.toString());this.Vt(f,this.Ab);Cl(this,!1);L.free(f)};t=N.prototype;t.Nh=function(){}; function Dl(a,b,c,d,e){a.Ab.h(b,c,d,e);if(!a.desiredSize.o()){var f=a.sc;c=a.oh;b=c.right+c.left;var g=c.top+c.bottom;c=f.width+b;f=f.height+g;d+=b;e+=g;b=Bl(a,!0);c===d&&f===e&&(b=Mg);switch(b){case Mg:if(c>d||f>e)Cj(a,!0),a.measure(c>d?d:c,f>e?e:f,0,0);break;case Hd:Cj(a,!0);a.measure(d,e,0,0);break;case ml:Cj(a,!0);a.measure(d,f,0,0);break;case nl:Cj(a,!0),a.measure(c,e,0,0)}}} t.Vt=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||El(c,!0),this.P(),jc(a,b)||(c.Rh(),this.jp(c)))};t.jp=function(a){null!==this.portId&&(El(a,!0),a instanceof T&&Fl(a,this))}; t.hc=function(a,b){if(this.visible){var c=this instanceof U&&(this.type===U.TableRow||this.type===U.TableColumn),d=this.Ab;if(c||0!==d.width&&0!==d.height&&!isNaN(d.x)&&!isNaN(d.y)){var e=this.opacity;if(0!==e){var f=1;1!==e&&(f=a.globalAlpha,a.globalAlpha=f*e);if(!this.Yx(a,b))if(c)Gl(this,a,b);else{this instanceof R&&this.Ak(!1);F&&F.pm&&F.Bz&&F.Bz(a,this);c=this.transform;var g=this.panel;0!==(this.I&4096)===!0&&Hl(this);var h=this.part,k=!1,l=0;if(h&&b.Qe("drawShadows")&&(k=h.isShadowed)){var m= h.shadowOffset;l=Math.max(m.y,m.x)*b.scale*b.Yb}if(!(m=b.zi||!this.Jf())){var n=this.naturalBounds;m=this.ai;var p=m.m11,r=m.m21,q=m.dx,u=m.m12,x=m.m22,y=m.dy,z,B=z=0;m=z*p+B*r+q;var D=z*u+B*x+y;z=n.width+l;B=0;var G=z*p+B*r+q;z=z*u+B*x+y;B=Math.min(m,G);var O=Math.min(D,z);var X=Math.max(m+0,G)-B;var Q=Math.max(D+0,z)-O;m=B;D=O;z=n.width+l;B=n.height+l;G=z*p+B*r+q;z=z*u+B*x+y;B=Math.min(m,G);O=Math.min(D,z);X=Math.max(m+X,G)-B;Q=Math.max(D+Q,z)-O;m=B;D=O;z=0;B=n.height+l;G=z*p+B*r+q;z=z*u+B*x+y; B=Math.min(m,G);O=Math.min(D,z);X=Math.max(m+X,G)-B;Q=Math.max(D+Q,z)-O;m=B;D=O;l=b.viewportBounds;n=l.x;p=l.y;m=!(m>l.width+n||n>X+m||D>l.height+p||p>Q+D)}if(m){m=0!==(this.I&256);a.clipInsteadOfFill&&(m=!1);this instanceof ih&&(a.font=this.font);if(m){F&&F.Dz&&Ca("clip"+this.toString());D=g.je()?g.naturalBounds:g.actualBounds;null!==this.sd?(n=this.sd,X=n.x,Q=n.y,l=n.width,n=n.height):(X=Math.max(d.x,D.x),Q=Math.max(d.y,D.y),l=Math.min(d.right,D.right)-X,n=Math.min(d.bottom,D.bottom)-Q);if(X>d.width+ d.x||d.x>D.width+D.x){1!==e&&(a.globalAlpha=f);return}a.save();a.beginPath();a.rect(X,Q,l,n);a.clip()}if(this.Jf()){if(!h.isVisible()){1!==e&&(a.globalAlpha=f);return}k&&(D=h.shadowOffset,a.Bw(D.x*b.scale*b.Yb,D.y*b.scale*b.Yb,h.shadowBlur),Il(a),a.shadowColor=h.shadowColor)}!0===this.shadowVisible?Il(a):!1===this.shadowVisible&&Jl(a);h=this.naturalBounds;null!==this.jc&&(zi(this,a,this.jc,!0,!0,h,d),this.jc instanceof Kl&&this.jc.type===Ll?(a.beginPath(),a.rect(d.x,d.y,d.width,d.height),a.ce(this.jc)): a.fillRect(d.x,d.y,d.width,d.height));a.transform(c.m11,c.m12,c.m21,c.m22,c.dx,c.dy);k&&(null!==g&&0!==(g.I&512)||null!==g&&(g.type===U.Auto||g.type===U.Spot)&&g.Fb()!==this)&&null===this.shadowVisible&&Jl(a);null!==this.ob&&(l=this.naturalBounds,X=D=0,Q=l.width,l=l.height,n=0,this instanceof Yf&&(l=this.qa.bounds,D=l.x,X=l.y,Q=l.width,l=l.height,n=this.strokeWidth),zi(this,a,this.ob,!0,!1,h,d),this.ob instanceof Kl&&this.ob.type===Ll?(a.beginPath(),a.rect(D-n/2,X-n/2,Q+n,l+n),a.ce(this.ob)):a.fillRect(D- n/2,X-n/2,Q+n,l+n));F&&F.pm&&F.Cz&&F.Cz(a,this);k&&(null!==this.ob||null!==this.jc||null!==g&&0!==(g.I&512)||null!==g&&(g.type===U.Auto||g.type===U.Spot)&&g.Fb()!==this)?(Ml(this,!0),null===this.shadowVisible&&Jl(a)):Ml(this,!1);this.aj(a,b);k&&0!==(this.I&512)===!0&&Il(a);this.Jf()&&k&&Jl(a);m?(a.restore(),this instanceof U?a.yc(!0):a.yc(!1)):c.Mt()||(b=1/(c.m11*c.m22-c.m12*c.m21),a.transform(c.m22*b,-c.m12*b,-c.m21*b,c.m11*b,b*(c.m21*c.dy-c.m22*c.dx),b*(c.m12*c.dx-c.m11*c.dy)))}}1!==e&&(a.globalAlpha= f)}}}};t.Yx=function(){return!1};function Gl(a,b,c){var d=a.Ab,e=a.tc;null!==a.jc&&(zi(a,b,a.jc,!0,!0,e,d),a.jc instanceof Kl&&a.jc.type===Ll?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.ce(a.jc)):b.fillRect(d.x,d.y,d.width,d.height));null!==a.ob&&(zi(a,b,a.ob,!0,!1,e,d),a.ob instanceof Kl&&a.ob.type===Ll?(b.beginPath(),b.rect(d.x,d.y,d.width,d.height),b.ce(a.ob)):b.fillRect(d.x,d.y,d.width,d.height));a.aj(b,c)}t.aj=function(){}; function zi(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===Nl)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{h=f.width;k=f.height;e&&(h=g.width,k=g.height);if((f=b instanceof Ol)&&c.oe&&(c.type===Pl||c.Zk===h&&c.su===k))var l=c.oe;else{var m=0,n=0,p=0,r=0,q=0,u=0;u=q=0;e&&(q=g.x,u=g.y);m=c.start.x*h+c.start.offsetX;n=c.start.y*k+c.start.offsetY;p=c.end.x*h+c.end.offsetX;r=c.end.y*k+c.end.offsetY;m+=q;p+=q;n+=u;r+=u;if(c.type===Ql)l= b.createLinearGradient(m,n,p,r);else if(c.type===Ll)u=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(q=0,u=Math.max(h,k)/2):q=c.startRadius,l=b.createRadialGradient(m,n,q,p,r,u);else if(c.type===Pl)try{l=b.createPattern(c.pattern,"repeat")}catch(y){l=null}else xa(c.type,"Brush type");if(c.type!==Pl&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)l.addColorStop(e.key,e.value);if(f&&(c.oe=l,null!==l&&(c.Zk=h,c.su=k),null===l&&c.type===Pl&&-1!==c.Zk)){c.Zk=-1;var x=a.diagram; null!==x&&-1===c.Zk&&ta(function(){x.ge()},600)}}d?b.fillStyle=l:b.strokeStyle=l}}}t.Mg=function(a){if(a instanceof U)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.Kf=function(){if(!this.visible)return!1;var a=this.panel;return null!==a?a.Kf():!0};t.Ng=function(){for(var a=this instanceof U?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a}; function Hl(a){if(0!==(a.I&2048)===!0){var b=a.sb;b.reset();if(!a.Ab.o()||!a.sc.o()){Rl(a,!1);return}b.translate(a.Ab.x-a.sc.x,a.Ab.y-a.sc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;zl(a,b,c.x,c.y,c.width,c.height)}Rl(a,!1);Sl(a,!0)}0!==(a.I&4096)===!0&&(b=a.panel,null===b?(a.ai.set(a.sb),a.il=a.scale,Sl(a,!1)):null!==b.Cd&&(c=a.ai,c.reset(),b.je()?c.multiply(b.ai):null!==b.panel&&c.multiply(b.panel.ai),c.multiply(a.sb),a.il=a.scale*b.il,Sl(a,!1)))} function zl(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.dc){var g=Mc;a.Jf()&&a.locationSpot.ab()&&(g=a.locationSpot);var h=J.alloc();if(a instanceof S&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.Jk(d.x,d.y,d.width,d.height,g),c.kg.xa(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.kg.xa(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.Jk(c,d,e,f,g);b.rotate(a.dc,h.x,h.y);J.free(h)}} t.u=function(a){void 0===a&&(a=!1);if(!0!==Hj(this)){Cj(this,!0);Cl(this,!0);var b=this.panel;null===b||a||b.u()}};t.Cm=function(){!0!==Hj(this)&&(Cj(this,!0),Cl(this,!0))};function Tl(a){if(!1===Ij(a)){var b=a.panel;null!==b?b.u():a.Jf()&&(b=a.diagram,null!==b&&(b.ud.add(a),a instanceof T&&a.md(),b.Vb()));Cl(a,!0)}}t.zl=function(){0!==(this.I&2048)===!1&&(Rl(this,!0),Sl(this,!0))};t.Zv=function(){Sl(this,!0)};t.P=function(){var a=this.part;null!==a&&a.P()}; function Bl(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===U.Table)return Ul(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===U.Auto&&d.Fb()===a)return Vl(a,Hd,b);if(c===ll){if(null!==d){if(d.type===U.Spot&&d.Fb()===a)return Vl(a,Hd,b);c=d.defaultStretch;return c===ll?Vl(a,Mg,b):Vl(a,c,b)}return Vl(a,Mg,b)}return Vl(a,c,b)} function Ul(a,b,c,d){var e=a.stretch;if(e!==ll)return Vl(a,e,d);var f=e=null;switch(b.stretch){case nl:f=!0;break;case Hd:f=!0}switch(c.stretch){case ml:e=!0;break;case Hd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===ml||b===Hd);null===f&&(f=b===nl||b===Hd);return!0===e&&!0===f?Vl(a,Hd,d):!0===e?Vl(a,ml,d):!0===f?Vl(a,nl,d):Vl(a,Mg,d)} function Vl(a,b,c){if(c)return b;if(b===Mg)return Mg;c=a.desiredSize;if(c.o())return Mg;a=a.angle;if(!isNaN(c.width))if(90!==a&&270!==a){if(b===ml)return Mg;if(b===Hd)return nl}else{if(b===nl)return Mg;if(b===Hd)return ml}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===nl)return Mg;if(b===Hd)return ml}else{if(b===ml)return Mg;if(b===Hd)return nl}return b}function Ml(a,b){a.I=b?a.I|512:a.I&-513}function vl(a){return 0!==(a.I&1024)}function Wl(a,b){a.I=b?a.I|1024:a.I&-1025} function Rl(a,b){a.I=b?a.I|2048:a.I&-2049}function Sl(a,b){a.I=b?a.I|4096:a.I&-4097}function Hj(a){return 0!==(a.I&8192)}function Cj(a,b){a.I=b?a.I|8192:a.I&-8193}function Ij(a){return 0!==(a.I&16384)}function Cl(a,b){a.I=b?a.I|16384:a.I&-16385}t.oj=function(a){this.wg=a};t.eu=function(){};t.zw=function(a){this.sa.assign(a);Tl(this);return!0};t.ar=function(a,b){if(this.sa.x!==a||this.sa.y!==b)this.sa.h(a,b),this.zl()}; function Xl(a){var b=a.part;if(b instanceof T&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||Fl(b,a)}}function Yl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof U?a instanceof T?a.md():a.Lk(a,function(a){Xl(a)}):Xl(a))}t.bind=function(a){a.jd=this;var b=this.ej();null!==b&&Zl(b)&&v("Cannot add a Binding to a template that has already been copied: "+a);null===this.jb&&(this.jb=new H);this.jb.add(a)}; t.ej=function(){for(var a=this instanceof U?this:this.panel;null!==a;){if(null!==a.ni)return a;a=a.panel}return null};t.Aw=function(a){Oj(this,a)};function $l(a,b){b.jd=a;null===a.Tg&&(a.Tg=new Db);a.Tg.add(b.propertyName,b)} function am(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=bm.K(a);"function"===typeof f?(c=Ia(arguments),d=f(c),Fa(d)||v('GraphObject.make invoked object builder "'+a+'", but it did not return an Object')):e=qa.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 P&&1<c.length){f= d;var g=c[1];if("string"===typeof g||g instanceof HTMLDivElement)Pi(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):cm(d,f);return d} function cm(a,b){if("string"===typeof b)if(a instanceof ih)a.text=b;else if(a instanceof Yf)a.figure=b;else if(a instanceof xk)a.source=b;else if(a instanceof U){var c=dm.K(b);null!==c?a.type=c:F&&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 Kl?(c=gb(Kl,b),null!==c?a.type=c:v("Unknown Brush type as an argument to GraphObject.make: "+b)):a instanceof Fd?(c=gb(Fd,b),null!==c?a.type=c:F&&v("Unknown Geometry type as an argument to GraphObject.make: "+ b)):a instanceof ue?(c=gb(ue,b),null!==c?a.type=c:F&&v("Unknown PathSegment type as an argument to GraphObject.make: "+b)):F&&v("Unable to use a string as an argument to GraphObject.make: "+b);else if(b instanceof N)a instanceof U||v("A GraphObject can only be added to a Panel, not to: "+a),a.add(b);else if(b instanceof ik){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 ik?d.vt(b):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.mb?a.mb(b):Ba(a,b);else if(b instanceof em)a.type=b;else if(b instanceof $i)a instanceof N?a.bind(b):a instanceof ik?a.bind(b):v("A Binding can only be applied to a GraphObject or RowColumnDefinition, not to: "+a);else if(b instanceof qi)a instanceof N?$l(a,b):v("An AnimationTrigger can only be applied to a GraphObject, not to: "+ a);else if(b instanceof te)a instanceof Fd?a.figures.add(b):v("A PathFigure can only be added to a Geometry, not to: "+a);else if(b instanceof ue)a instanceof te?a.segments.add(b):v("A PathSegment can only be added to a PathFigure, not to: "+a);else if(b instanceof Ni)a instanceof P?a.layout=b:a instanceof Hf?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++)cm(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof Kl){c=new jb;for(var e in b)d=parseFloat(e),isNaN(d)?c[e]=b[e]:a.addColorStop(d,b[e]);Oj(a,c)}else if(a instanceof ik){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 jb;for(c in b)"row"!== c&&"column"!==c&&(e[c]=b[c]);Oj(a,e)}else Oj(a,b);else v('Unknown initializer "'+b+'" for object being constructed by GraphObject.make: '+a)}function fm(a,b){A(a,"string",N,"defineBuilder:name");A(b,"function",N,"defineBuilder:func");var c=a.toLowerCase();F&&(""===a||"none"===c||a===c)&&v("Shape.defineFigureGenerator name must not be empty or None or all-lower-case: "+a);bm.add(a,b)} function gm(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} ma.Object.defineProperties(N.prototype,{shadowVisible:{configurable:!0,get:function(){return this.Yl},set:function(a){var b=this.Yl;b!==a&&(F&&null!==a&&A(a,"boolean",N,"shadowVisible"),this.Yl=a,this.P(),this.g("shadowVisible",b,a))}},enabledChanged:{configurable:!0,get:function(){return null!==this.R?this.R.Tn:null},set:function(a){sl(this);var b=this.R.Tn;b!==a&&(null!==a&&A(a,"function",N,"enabledChanged"),this.R.Tn=a,this.g("enabledChanged",b,a))}},segmentOrientation:{configurable:!0, enumerable:!0,get:function(){return this.Wl},set:function(a){var b=this.Wl;b!==a&&(F&&hb(a,R,N,"segmentOrientation"),this.Wl=a,this.u(),this.g("segmentOrientation",b,a),a===og&&(this.angle=0))}},segmentIndex:{configurable:!0,get:function(){return this.Np},set:function(a){F&&A(a,"number",N,"segmentIndex");a=Math.round(a);var b=this.Np;b!==a&&(this.Np=a,this.u(),this.g("segmentIndex",b,a))}},segmentFraction:{configurable:!0,get:function(){return this.Ul},set:function(a){F&& A(a,"number",N,"segmentFraction");isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Ul;b!==a&&(this.Ul=a,this.u(),this.g("segmentFraction",b,a))}},segmentOffset:{configurable:!0,get:function(){return this.Vl},set:function(a){var b=this.Vl;b.A(a)||(F&&w(a,J,N,"segmentOffset"),this.Vl=a=a.J(),this.u(),this.g("segmentOffset",b,a))}},stretch:{configurable:!0,get:function(){return this.Je},set:function(a){var b=this.Je;b!==a&&(F&&hb(a,N,N,"stretch"),this.Je=a,this.u(),this.g("stretch", b,a))}},name:{configurable:!0,get:function(){return this.Wa},set:function(a){var b=this.Wa;b!==a&&(F&&A(a,"string",N,"name"),this.Wa=a,null!==this.part&&(this.part.Rj=null),this.g("name",b,a))}},opacity:{configurable:!0,get:function(){return this.wb},set:function(a){var b=this.wb;b!==a&&(A(a,"number",N,"opacity"),(0>a||1<a)&&ya(a,"0 <= value <= 1",N,"opacity"),this.wb=a,this.g("opacity",b,a),a=this.diagram,b=this.part,null!==a&&null!==b&&a.P(Sj(b,b.actualBounds)))}},visible:{configurable:!0, enumerable:!0,get:function(){return 0!==(this.I&1)},set:function(a){var b=0!==(this.I&1);b!==a&&(F&&A(a,"boolean",N,"visible"),this.I^=1,this.g("visible",b,a),b=this.panel,null!==b?b.u():this.Jf()&&this.Ub(a),this.P(),Yl(this))}},pickable:{configurable:!0,get:function(){return 0!==(this.I&2)},set:function(a){var b=0!==(this.I&2);b!==a&&(F&&A(a,"boolean",N,"pickable"),this.I^=2,this.g("pickable",b,a))}},fromLinkableDuplicates:{configurable:!0,get:function(){return 0!==(this.I& 4)},set:function(a){var b=0!==(this.I&4);b!==a&&(F&&A(a,"boolean",N,"fromLinkableDuplicates"),this.I^=4,this.g("fromLinkableDuplicates",b,a))}},fromLinkableSelfNode:{configurable:!0,get:function(){return 0!==(this.I&8)},set:function(a){var b=0!==(this.I&8);b!==a&&(F&&A(a,"boolean",N,"fromLinkableSelfNode"),this.I^=8,this.g("fromLinkableSelfNode",b,a))}},toLinkableDuplicates:{configurable:!0,get:function(){return 0!==(this.I&16)},set:function(a){var b=0!==(this.I&16);b!== a&&(F&&A(a,"boolean",N,"toLinkableDuplicates"),this.I^=16,this.g("toLinkableDuplicates",b,a))}},toLinkableSelfNode:{configurable:!0,get:function(){return 0!==(this.I&32)},set:function(a){var b=0!==(this.I&32);b!==a&&(F&&A(a,"boolean",N,"toLinkableSelfNode"),this.I^=32,this.g("toLinkableSelfNode",b,a))}},isPanelMain:{configurable:!0,get:function(){return 0!==(this.I&64)},set:function(a){var b=0!==(this.I&64);b!==a&&(F&&A(a,"boolean",N,"isPanelMain"),this.I^=64,this.u(), this.g("isPanelMain",b,a))}},isActionable:{configurable:!0,get:function(){return 0!==(this.I&128)},set:function(a){var b=0!==(this.I&128);b!==a&&(F&&A(a,"boolean",N,"isActionable"),this.I^=128,this.g("isActionable",b,a))}},areaBackground:{configurable:!0,get:function(){return this.jc},set:function(a){var b=this.jc;b!==a&&(null!==a&&hm(a,"GraphObject.areaBackground"),a instanceof Kl&&a.freeze(),this.jc=a,this.P(),this.g("areaBackground",b,a))}},background:{configurable:!0, enumerable:!0,get:function(){return this.ob},set:function(a){var b=this.ob;b!==a&&(null!==a&&hm(a,"GraphObject.background"),a instanceof Kl&&a.freeze(),this.ob=a,this.P(),this.g("background",b,a))}},part:{configurable:!0,get:function(){if(this.Jf())return this;if(null!==this.Vj)return this.Vj;var a;for(a=this.panel;a;){if(a instanceof S)return this.Vj=a;a=a.panel}return null}},svg:{configurable:!0,get:function(){return this.fq},set:function(a){this.fq=a}},panel:{configurable:!0, enumerable:!0,get:function(){return this.wg}},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.sa},set:function(a){F&&w(a,J,N,"position");var b=a.x,c=a.y,d=this.sa,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))?this.eu():(a=a.copy(),this.zw(a,d)&&this.g("position", d.copy(),a))}},actualBounds:{configurable:!0,get:function(){return this.Ab}},scale:{configurable:!0,get:function(){return this.Fa},set:function(a){var b=this.Fa;b!==a&&(F&&C(a,N,"scale"),0>=a&&v("GraphObject.scale for "+this+" must be greater than zero, not: "+a),this.Fa=a,this.u(),this.g("scale",b,a))}},angle:{configurable:!0,get:function(){return this.dc},set:function(a){var b=this.dc;b!==a&&(F&&C(a,N,"angle"),a%=360,0>a&&(a+=360),b!==a&&(this.dc=a,Yl(this), this.u(),this.g("angle",b,a)))}},desiredSize:{configurable:!0,get:function(){return this.Sc},set:function(a){F&&w(a,Hb,N,"desiredSize");var b=a.width,c=a.height,d=this.Sc,e=d.width,f=d.height;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(this.Sc=a=a.J(),this.u(),this instanceof Yf&&this.ic(),this.g("desiredSize",d,a),vl(this)&&(a=this.part,null!==a&&(wl(this,a,"width"),wl(this,a,"height"))))}},width:{configurable:!0,get:function(){return this.Sc.width},set:function(a){var b= this.Sc.width;b===a||isNaN(b)&&isNaN(a)||(F&&A(a,"number",N,"width"),b=this.Sc,this.Sc=a=(new Hb(a,this.Sc.height)).freeze(),this.u(),this instanceof Yf&&this.ic(),this.g("desiredSize",b,a),vl(this)&&(a=this.part,null!==a&&wl(this,a,"width")))}},height:{configurable:!0,get:function(){return this.Sc.height},set:function(a){var b=this.Sc.height;b===a||isNaN(b)&&isNaN(a)||(F&&A(a,"number",N,"height"),b=this.Sc,this.Sc=a=(new Hb(this.Sc.width,a)).freeze(),this.u(),this instanceof Yf&&this.ic(), this.g("desiredSize",b,a),vl(this)&&(a=this.part,null!==a&&wl(this,a,"height")))}},minSize:{configurable:!0,get:function(){return this.ng},set:function(a){var b=this.ng;b.A(a)||(F&&w(a,Hb,N,"minSize"),a=a.copy(),isNaN(a.width)&&(a.width=0),isNaN(a.height)&&(a.height=0),a.freeze(),this.ng=a,this.u(),this.g("minSize",b,a))}},maxSize:{configurable:!0,get:function(){return this.mg},set:function(a){var b=this.mg;b.A(a)||(F&&w(a,Hb,N,"maxSize"),a=a.copy(),isNaN(a.width)&&(a.width= Infinity),isNaN(a.height)&&(a.height=Infinity),a.freeze(),this.mg=a,this.u(),this.g("maxSize",b,a))}},measuredBounds:{configurable:!0,get:function(){return this.sc}},naturalBounds:{configurable:!0,get:function(){return this.tc}},margin:{configurable:!0,get:function(){return this.oh},set:function(a){"number"===typeof a?a=new lc(a):F&&w(a,lc,N,"margin");var b=this.oh;b.A(a)||(this.oh=a=a.J(),this.u(),this.g("margin",b,a))}},transform:{configurable:!0, get:function(){0!==(this.I&2048)===!0&&Hl(this);return this.sb}},Cd:{configurable:!0,get:function(){0!==(this.I&4096)===!0&&Hl(this);return this.ai}},alignment:{configurable:!0,get:function(){return this.Bb},set:function(a){var b=this.Bb;b.A(a)||(F&&w(a,M,N,"alignment"),a.Sb()&&!a.Gb()&&v("GraphObject.alignment for "+this+" must be a real Spot or Spot.Default, not: "+a),this.Bb=a=a.J(),Tl(this),this.g("alignment",b,a))}},column:{configurable:!0,get:function(){return this.Xg}, set:function(a){F&&C(a,N,"column");a=Math.round(a);var b=this.Xg;b!==a&&(0>a&&ya(a,">= 0",N,"column"),this.Xg=a,this.u(),this.g("column",b,a))}},columnSpan:{configurable:!0,get:function(){return this.wn},set:function(a){F&&A(a,"number",N,"columnSpan");a=Math.round(a);var b=this.wn;b!==a&&(1>a&&ya(a,">= 1",N,"columnSpan"),this.wn=a,this.u(),this.g("columnSpan",b,a))}},row:{configurable:!0,get:function(){return this.Gp},set:function(a){F&&C(a,N,"row");a=Math.round(a);var b= this.Gp;b!==a&&(0>a&&ya(a,">= 0",N,"row"),this.Gp=a,this.u(),this.g("row",b,a))}},rowSpan:{configurable:!0,get:function(){return this.Hp},set:function(a){F&&A(a,"number",N,"rowSpan");a=Math.round(a);var b=this.Hp;b!==a&&(1>a&&ya(a,">= 1",N,"rowSpan"),this.Hp=a,this.u(),this.g("rowSpan",b,a))}},spanAllocation:{configurable:!0,get:function(){return this.$p},set:function(a){var b=this.$p;b!==a&&(null!==a&&A(a,"function",N,"spanAllocation"),this.$p=a,this.u(),this.g("spanAllocation", b,a))}},alignmentFocus:{configurable:!0,get:function(){return this.Sk},set:function(a){var b=this.Sk;b.A(a)||(F&&w(a,M,N,"alignmentFocus"),!F||!a.Sb()||a.Gb()||a.Kq()&&this instanceof T||v("GraphObject.alignmentFocus must be a real Spot or Spot.Default, not: "+a),this.Sk=a=a.J(),this.u(),this.g("alignmentFocus",b,a))}},portId:{configurable:!0,get:function(){return this.tp},set:function(a){var b=this.tp;if(b!==a){F&&null!==a&&A(a,"string",N,"portId");var c=this.part;null=== c||c instanceof T||(v("Cannot set portID on a Link: "+a),c=null);null!==b&&null!==c&&im(c,this);this.tp=a;null!==a&&null!==c&&(c.Qh=!0,jm(c,this));this.g("portId",b,a)}}},toSpot:{configurable:!0,get:function(){return null!==this.S?this.S.Gh:Gc},set:function(a){this.Kc();var b=this.S.Gh;b.A(a)||(F&&w(a,M,N,"toSpot"),a=a.J(),this.S.Gh=a,this.g("toSpot",b,a),Xl(this))}},toEndSegmentLength:{configurable:!0,get:function(){return null!==this.S?this.S.Eh:10},set:function(a){this.Kc(); var b=this.S.Eh;b!==a&&(F&&A(a,"number",N,"toEndSegmentLength"),0>a&&ya(a,">= 0",N,"toEndSegmentLength"),this.S.Eh=a,this.g("toEndSegmentLength",b,a),Xl(this))}},toShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.Fh:0},set:function(a){this.Kc();var b=this.S.Fh;b!==a&&(F&&A(a,"number",N,"toShortLength"),this.S.Fh=a,this.g("toShortLength",b,a),Xl(this))}},toLinkable:{configurable:!0,get:function(){return null!==this.S?this.S.jq:null},set:function(a){this.Kc(); var b=this.S.jq;b!==a&&(F&&null!==a&&A(a,"boolean",N,"toLinkable"),this.S.jq=a,this.g("toLinkable",b,a))}},toMaxLinks:{configurable:!0,get:function(){return null!==this.S?this.S.kq:Infinity},set:function(a){this.Kc();var b=this.S.kq;b!==a&&(F&&A(a,"number",N,"toMaxLinks"),0>a&&ya(a,">= 0",N,"toMaxLinks"),this.S.kq=a,this.g("toMaxLinks",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.S?this.S.hh:Gc},set:function(a){this.Kc();var b=this.S.hh;b.A(a)||(F&& w(a,M,N,"fromSpot"),a=a.J(),this.S.hh=a,this.g("fromSpot",b,a),Xl(this))}},fromEndSegmentLength:{configurable:!0,get:function(){return null!==this.S?this.S.fh:10},set:function(a){this.Kc();var b=this.S.fh;b!==a&&(F&&A(a,"number",N,"fromEndSegmentLength"),0>a&&ya(a,">= 0",N,"fromEndSegmentLength"),this.S.fh=a,this.g("fromEndSegmentLength",b,a),Xl(this))}},fromShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.gh:0},set:function(a){this.Kc();var b=this.S.gh; b!==a&&(F&&A(a,"number",N,"fromShortLength"),this.S.gh=a,this.g("fromShortLength",b,a),Xl(this))}},fromLinkable:{configurable:!0,get:function(){return null!==this.S?this.S.$n:null},set:function(a){this.Kc();var b=this.S.$n;b!==a&&(F&&null!==a&&A(a,"boolean",N,"fromLinkable"),this.S.$n=a,this.g("fromLinkable",b,a))}},fromMaxLinks:{configurable:!0,get:function(){return null!==this.S?this.S.ao:Infinity},set:function(a){this.Kc();var b=this.S.ao;b!==a&&(F&&A(a,"number",N,"fromMaxLinks"), 0>a&&ya(a,">= 0",N,"fromMaxLinks"),this.S.ao=a,this.g("fromMaxLinks",b,a))}},cursor:{configurable:!0,get:function(){return this.ri},set:function(a){var b=this.ri;b!==a&&(A(a,"string",N,"cursor"),this.ri=a,this.g("cursor",b,a))}},click:{configurable:!0,get:function(){return null!==this.R?this.R.Wf:null},set:function(a){sl(this);var b=this.R.Wf;b!==a&&(null!==a&&A(a,"function",N,"click"),this.R.Wf=a,this.g("click",b,a))}},doubleClick:{configurable:!0,get:function(){return null!== this.R?this.R.ag:null},set:function(a){sl(this);var b=this.R.ag;b!==a&&(null!==a&&A(a,"function",N,"doubleClick"),this.R.ag=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,get:function(){return null!==this.R?this.R.Xf:null},set:function(a){sl(this);var b=this.R.Xf;b!==a&&(null!==a&&A(a,"function",N,"contextClick"),this.R.Xf=a,this.g("contextClick",b,a))}},mouseEnter:{configurable:!0,get:function(){return null!==this.R?this.R.pg:null},set:function(a){sl(this); var b=this.R.pg;b!==a&&(null!==a&&A(a,"function",N,"mouseEnter"),this.R.pg=a,this.g("mouseEnter",b,a))}},mouseLeave:{configurable:!0,get:function(){return null!==this.R?this.R.sg:null},set:function(a){sl(this);var b=this.R.sg;b!==a&&(null!==a&&A(a,"function",N,"mouseLeave"),this.R.sg=a,this.g("mouseLeave",b,a))}},mouseOver:{configurable:!0,get:function(){return null!==this.R?this.R.tg:null},set:function(a){sl(this);var b=this.R.tg;b!==a&&(null!==a&&A(a,"function",N,"mouseOver"), this.R.tg=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return null!==this.R?this.R.rg:null},set:function(a){sl(this);var b=this.R.rg;b!==a&&(null!==a&&A(a,"function",N,"mouseHover"),this.R.rg=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,get:function(){return null!==this.R?this.R.qg:null},set:function(a){sl(this);var b=this.R.qg;b!==a&&(null!==a&&A(a,"function",N,"mouseHold"),this.R.qg=a,this.g("mouseHold",b,a))}},mouseDragEnter:{configurable:!0, enumerable:!0,get:function(){return null!==this.R?this.R.Vo:null},set:function(a){sl(this);var b=this.R.Vo;b!==a&&(null!==a&&A(a,"function",N,"mouseDragEnter"),this.R.Vo=a,this.g("mouseDragEnter",b,a))}},mouseDragLeave:{configurable:!0,get:function(){return null!==this.R?this.R.Wo:null},set:function(a){sl(this);var b=this.R.Wo;b!==a&&(null!==a&&A(a,"function",N,"mouseDragLeave"),this.R.Wo=a,this.g("mouseDragLeave",b,a))}},mouseDrop:{configurable:!0,get:function(){return null!== this.R?this.R.og:null},set:function(a){sl(this);var b=this.R.og;b!==a&&(null!==a&&A(a,"function",N,"mouseDrop"),this.R.og=a,this.g("mouseDrop",b,a))}},actionDown:{configurable:!0,get:function(){return null!==this.R?this.R.dn:null},set:function(a){sl(this);var b=this.R.dn;b!==a&&(null!==a&&A(a,"function",N,"actionDown"),this.R.dn=a,this.g("actionDown",b,a))}},actionMove:{configurable:!0,get:function(){return null!==this.R?this.R.en:null},set:function(a){sl(this);var b=this.R.en; b!==a&&(null!==a&&A(a,"function",N,"actionMove"),this.R.en=a,this.g("actionMove",b,a))}},actionUp:{configurable:!0,get:function(){return null!==this.R?this.R.fn:null},set:function(a){sl(this);var b=this.R.fn;b!==a&&(null!==a&&A(a,"function",N,"actionUp"),this.R.fn=a,this.g("actionUp",b,a))}},actionCancel:{configurable:!0,get:function(){return null!==this.R?this.R.cn:null},set:function(a){sl(this);var b=this.R.cn;b!==a&&(null!==a&&A(a,"function",N,"actionCancel"),this.R.cn= a,this.g("actionCancel",b,a))}},toolTip:{configurable:!0,get:function(){return null!==this.R?this.R.Dg:null},set:function(a){sl(this);var b=this.R.Dg;b!==a&&(!F||null===a||a instanceof Te||a instanceof bf||v("GraphObject.toolTip must be an Adornment or HTMLInfo."),this.R.Dg=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return null!==this.R?this.R.Yf:null},set:function(a){sl(this);var b=this.R.Yf;b!==a&&(!F||a instanceof Te||a instanceof bf||v("GraphObject.contextMenu must be an Adornment or HTMLInfo."), this.R.Yf=a,this.g("contextMenu",b,a))}}});N.prototype.setProperties=N.prototype.Aw;N.prototype.findTemplateBinder=N.prototype.ej;N.prototype.bind=N.prototype.bind;N.prototype.isEnabledObject=N.prototype.Ng;N.prototype.isVisibleObject=N.prototype.Kf;N.prototype.isContainedBy=N.prototype.Mg;N.prototype.getNearestIntersectionPoint=N.prototype.bd;N.prototype.getLocalPoint=N.prototype.Ft;N.prototype.getDocumentScale=N.prototype.Gf;N.prototype.getDocumentAngle=N.prototype.hj; N.prototype.getDocumentBounds=N.prototype.zm;N.prototype.getDocumentPoint=N.prototype.ma;N.prototype.intersectsRect=N.prototype.Mc;N.prototype.containedInRect=N.prototype.Oh;N.prototype.containsRect=N.prototype.Oe;N.prototype.containsPoint=N.prototype.fa;N.prototype.raiseChanged=N.prototype.g;N.prototype.raiseChangedEvent=N.prototype.gb;N.prototype.addCopyProperty=N.prototype.Lx;var bm=null;N.className="GraphObject";bm=new Db; fm("Button",function(){function a(a,b){return null!==a.diagram.$b(a.documentPoint,function(a){for(;null!==a.panel&&!a.isActionable;)a=a.panel;return a},function(a){return a===b})}var b=am(U,U.Auto,{isActionable:!0,enabledChanged:function(a,b){if(a instanceof U){var c=a.fb("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"},am(Yf,{name:"ButtonBorder",figure:"RoundedRectangle",spot1:new M(0,0,2.76142374915397,2.761423749153969),spot2:new M(1,1,-2.76142374915397,-2.761423749153969),parameter1:2,parameter2:2,fill:"#F5F5F5",stroke:"#BDBDBD"}));b.mouseEnter=function(a,b){if(b.Ng()&&b instanceof U&&(a=b.fb("ButtonBorder"),a instanceof Yf)){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.Ng()&&b instanceof U&&(a=b.fb("ButtonBorder"),a instanceof Yf&&(a.fill=b._buttonFillNormal,a.stroke=b._buttonStrokeNormal))};b.actionDown=function(a,b){if(b.Ng()&&b instanceof U&&null!==b._buttonFillPressed&&0===a.button){var c=b.fb("ButtonBorder");if(c instanceof Yf){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.Ng()&&d instanceof U&&null!==d._buttonFillPressed&&0===b.button){var c=d.fb("ButtonBorder");if(c instanceof Yf){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.Ng()&&d instanceof U&&null!==d._buttonFillPressed){var c=d.fb("ButtonBorder");if(c instanceof Yf){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.Ng()&&d instanceof U&&null!==d._buttonFillPressed){var c=b.diagram;if(0===c.firstInput.button&&(c.currentTool.standardMouseOver(),a(b,d)&&(b=d.fb("ButtonBorder"),b instanceof Yf))){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}); fm("TreeExpanderButton",function(){var a=am("Button",{_treeExpandedFigure:"MinusLine",_treeCollapsedFigure:"PlusLine"},am(Yf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:$b},(new $i("figure","isTreeExpanded",function(a,c){c=c.panel;return a?c._treeExpandedFigure:c._treeCollapsedFigure})).Rq()),{visible:!1},(new $i("visible","isTreeLeaf",function(a){return!a})).Rq());a.click=function(a,c){c=c.part;c instanceof Te&&(c=c.adornedPart);if(c instanceof T){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}); fm("SubGraphExpanderButton",function(){var a=am("Button",{_subGraphExpandedFigure:"MinusLine",_subGraphCollapsedFigure:"PlusLine"},am(Yf,{name:"ButtonIcon",figure:"MinusLine",stroke:"#424242",strokeWidth:2,desiredSize:$b},(new $i("figure","isSubGraphExpanded",function(a,c){c=c.panel;return a?c._subGraphExpandedFigure:c._subGraphCollapsedFigure})).Rq()));a.click=function(a,c){c=c.part;c instanceof Te&&(c=c.adornedPart);if(c instanceof Hf){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});fm("ToolTip",function(){return am(Te,U.Auto,{isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},am(Yf,{name:"Border",figure:"RoundedRectangle",parameter1:1,parameter2:1,fill:"#F5F5F5",stroke:"#F0F0F0",spot1:new M(0,0,4,6),spot2:new M(1,1,-4,-4)}))}); fm("ContextMenu",function(){return am(Te,U.Vertical,{background:"#F5F5F5",isShadowed:!0,shadowColor:"rgba(0, 0, 0, .4)",shadowOffset:new J(0,3),shadowBlur:5},new $i("background","",function(a){return null!==a.adornedPart&&null!==a.placeholder?null:"#F5F5F5"}))});fm("ContextMenuButton",function(){var a=am("Button");a.stretch=ml;var b=a.fb("ButtonBorder");b instanceof Yf&&(b.figure="Rectangle",b.strokeWidth=0,b.spot1=new M(0,0,2,3),b.spot2=new M(1,1,-2,-2));return a}); fm("PanelExpanderButton",function(a){var b=gm(a,"COLLAPSIBLE"),c=am("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},am(Yf,{name:"ButtonIcon",strokeWidth:2},(new $i("geometryString","visible",function(a){return a?c._buttonExpandedFigure:c._buttonCollapsedFigure})).Rq(b))); a=c.fb("ButtonBorder");a instanceof Yf&&(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.ej();null===e&&(e=c.part);null!==e&&(c=e.fb(b),null!==c&&(a.handled=!0,d.Ba("Collapse/Expand Panel"),c.visible=!c.visible,d.$a("Collapse/Expand Panel")))}};return c}); fm("CheckBoxButton",function(a){var b=gm(a);a=am("Button",{desiredSize:new Hb(14,14)},am(Yf,{name:"ButtonIcon",geometryString:"M0 0 M0 8.85 L4.9 13.75 16.2 2.45 M16.2 16.2",strokeWidth:2,stretch:Hd,geometryStretch:Og,visible:!1},""!==b?(new $i("visible",b)).sy():[]));a.click=function(a,d){if(d instanceof U){var c=a.diagram;if(!(null===c||c.isReadOnly||""!==b&&c.model.isReadOnly)){a.handled=!0;var f=d.fb("ButtonIcon");c.Ba("checkbox");f.visible=!f.visible;"function"===typeof d._doClick&&d._doClick(a, d);c.$a("checkbox")}}};return a}); fm("CheckBox",function(a){a=gm(a);a=am("CheckBoxButton",a,{name:"Button",isActionable:!1,margin:new lc(0,1,0,0)});var b=am(U,"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});N.None=Mg=new E(N,"None",0);N.Default=ll=new E(N,"Default",0);N.Vertical=nl=new E(N,"Vertical",4);N.Horizontal=ml=new E(N,"Horizontal",5);N.Fill=Hd=new E(N,"Fill",3);N.Uniform=Og=new E(N,"Uniform",1); N.UniformToFill=ol=new E(N,"UniformToFill",2);N.FlipVertical=pl=new E(N,"FlipVertical",1);N.FlipHorizontal=ql=new E(N,"FlipHorizontal",2);N.FlipBoth=rl=new E(N,"FlipBoth",3);N.make=am;N.getBuilders=function(){var a=new Db,b;for(b in bm)if(b!==b.toLowerCase()){var c=bm.K(b);"function"===typeof c&&a.add(b,c)}a.freeze();return a};N.defineBuilder=fm;N.takeBuilderArgument=gm; function tl(){this.Tn=this.Yf=this.Dg=this.cn=this.fn=this.en=this.dn=this.og=this.Wo=this.Vo=this.qg=this.rg=this.tg=this.sg=this.pg=this.Xf=this.ag=this.Wf=null}tl.prototype.copy=function(){var a=new tl;a.Wf=this.Wf;a.ag=this.ag;a.Xf=this.Xf;a.pg=this.pg;a.sg=this.sg;a.tg=this.tg;a.rg=this.rg;a.qg=this.qg;a.Vo=this.Vo;a.Wo=this.Wo;a.og=this.og;a.dn=this.dn;a.en=this.en;a.fn=this.fn;a.cn=this.cn;a.Dg=this.Dg;a.Yf=this.Yf;a.Tn=this.Tn;return a};tl.className="GraphObjectEventHandlers"; function km(){this.Qa=[1,0,0,1,0,0]}km.prototype.copy=function(){var a=new km;a.Qa[0]=this.Qa[0];a.Qa[1]=this.Qa[1];a.Qa[2]=this.Qa[2];a.Qa[3]=this.Qa[3];a.Qa[4]=this.Qa[4];a.Qa[5]=this.Qa[5];return a};km.prototype.translate=function(a,b){this.Qa[4]+=this.Qa[0]*a+this.Qa[2]*b;this.Qa[5]+=this.Qa[1]*a+this.Qa[3]*b};km.prototype.scale=function(a,b){this.Qa[0]*=a;this.Qa[1]*=a;this.Qa[2]*=b;this.Qa[3]*=b};km.className="STransform"; function lm(a){this.type=a;this.r2=this.y2=this.x2=this.r1=this.y1=this.x1=0;this.Sx=[];this.pattern=null}lm.prototype.addColorStop=function(a,b){this.Sx.push({offset:a,color:b})};lm.className="SGradient"; function Rj(a,b){this.ownerDocument=a=void 0===b?qa.document:b;this.DA="http://www.w3.org/2000/svg";void 0!==a&&(this.Ja=this.zb("svg",{width:"1px",height:"1px",viewBox:"0 0 1 1"}),this.Ja.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns","http://www.w3.org/2000/svg"),this.Ja.setAttributeNS("http://www.w3.org/2000/xmlns/","xmlns:xlink","http://www.w3.org/1999/xlink"));this.zq=null;this.context=new mm(this)} Rj.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.Ja.setAttributeNS(null,"width",c+"px"),this.Ja.setAttributeNS(null,"height",d+"px"),this.Ja.setAttributeNS(null,"viewBox","0 0 "+c+" "+d),this.context.Wu.firstElementChild.setAttributeNS(null,"width",c+"px"),this.context.Wu.firstElementChild.setAttributeNS(null,"height",d+"px"),!0):!1}; Rj.prototype.zb=function(a,b,c){a=this.ownerDocument.createElementNS(this.DA,a);if(Fa(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};Rj.prototype.getBoundingClientRect=function(){return this.Ja.getBoundingClientRect()};Rj.prototype.focus=function(){this.Ja.focus()};Rj.prototype.Xx=function(){this.ownerDocument=null}; ma.Object.defineProperties(Rj.prototype,{width:{configurable:!0,get:function(){return this.Ja.width.baseVal.value},set:function(a){this.Ja.width=a}},height:{configurable:!0,get:function(){return this.Ja.height.baseVal.value},set:function(a){this.Ja.height=a}},style:{configurable:!0,get:function(){return this.Ja.style}}});Rj.className="SVGSurface"; function mm(a){this.Kk=a;this.svg=a.Ja;this.stack=[];this.Dc=[];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.rf=this.Wp=this.Vp=0;this.Lq=null;this.path=[];this.Nu=!1;this.zh=null;this.Ah=0;this.be=new km; nm(this,1,0,0,1,0,0);var b=wb++,c=this.zb("clipPath",{id:"mainClip"+b});c.appendChild(this.zb("rect",{x:0,y:0,width:a.width,height:a.height}));this.Wu=c;this.Kk.Ja.appendChild(c);this.Dc[0].setAttributeNS(null,"clip-path","url(#mainClip"+b+")");this.FA={}}t=mm.prototype; t.reset=function(){this.stack=[];this.Dc=[];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.rf=this.Wp=this.Vp=0;this.Lq=null;this.path=[];this.be=new km;nm(this,1,0,0,1,0,0);var a=wb++,b=this.zb("clipPath", {id:"mainClip"+a});b.appendChild(this.zb("rect",{x:0,y:0,width:this.Kk.width,height:this.Kk.height}));this.Wu=b;this.Kk.Ja.appendChild(b);this.Dc[0].setAttributeNS(null,"clip-path","url(#mainClip"+a+")")}; t.arc=function(a,b,c,d,e,f,g,h){var k=2*Math.PI,l=k-1E-6,m=c*Math.cos(d),n=c*Math.sin(d),p=a+m,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.be);this.addPath("clipPath",this.path,new km)};t.closePath=function(){this.path.push(["z"])};t.createLinearGradient=function(a,b,c,d){var e=new lm("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.FA;if(c[b])return"url(#"+c[b]+")";var d="PATTERN"+wb++,e={x:0,y:0,width:a.width,height:a.height,href:b};a=this.zb("pattern",{width:a.width,height:a.height,id:d,patternUnits:"userSpaceOnUse"});a.appendChild(this.zb("image",e));this.svg.appendChild(a);c[b]=d;return"url(#"+d+")"}; t.createRadialGradient=function(a,b,c,d,e,f){var g=new lm("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.ca(d,h)&&K.ca(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"+wb++,g=this.zb("clipPath",{id:f}),g.appendChild(this.zb("rect",{x:b,y:c,width:d,height:e})),this.svg.appendChild(g),a["clip-path"]="url(#"+f+")";om(this,"image",a,this.be,l);this.addElement("image",a)};t.fill=function(){this.addPath("fill",this.path,this.be)}; t.ce=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]};om(this,"fill",a,this.be);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};om(this,"fill",b,this.be);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.be=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.be.copy())}; t.setTransform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||nm(this,a,b,c,d,e,f)};t.scale=function(a,b){this.be.scale(a,b)};t.translate=function(a,b){this.be.translate(a,b)};t.transform=function(){};t.stroke=function(){this.addPath("stroke",this.path,this.be)};t.rj=function(){this.clipInsteadOfFill||this.stroke()};t.zb=function(a,b,c){return this.Kk.zb(a,b,c)}; t.addElement=function(a,b,c){a=this.zb(a,b,c);0<this.Dc.length?this.Dc[this.Dc.length-1].appendChild(a):this.svg.appendChild(a);return this.Lq=a}; function om(a,b,c,d,e){1!==a.globalAlpha&&(c.opacity=a.globalAlpha);"fill"===b?(a.fillStyle instanceof lm?c.fill=pm(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 lm?c.stroke=pm(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.Qa;d="matrix("+d[0]+", "+d[1]+", "+d[2]+", "+d[3]+", "+d[4]+", "+d[5]+")";void 0!==e&&(d+=e);c.transform=d} function pm(a,b){var c="GRAD"+wb++;if("linear"===b.type)var d=a.zb("linearGradient",{x1:b.x1,x2:b.x2,y1:b.y1,y2:b.y2,id:c,gradientUnits:"userSpaceOnUse"});else if("radial"===b.type)d=a.zb("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.Sx;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.zb("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=Ia(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.Nu&&(b["stroke-dasharray"]=this.zh.toString(),b["stroke-dashoffset"]=this.Ah);om(this,a,b,c);"clipPath"===a?(a="CLIP"+wb++,c=this.zb("clipPath",{id:a}),c.appendChild(this.zb("path",b)),this.svg.appendChild(c), 0<this.Dc.length&&this.Dc[this.Dc.length-1].setAttributeNS(null,"clip-path","url(#"+a+")")):this.addElement("path",b)};function nm(a,b,c,d,e,f,g){var h=new km;h.Qa=[b,c,d,e,f,g];b={};om(a,"g",b,h);h=a.addElement("g",b);a.Dc.push(h)} t.br=function(){if(0!==this.shadowOffsetX||0!==this.shadowOffsetY||0!==this.shadowBlur){var a="SHADOW"+wb++,b=this.addElement("filter",{id:a,x:"-100%",y:"-100%",width:"300%",height:"300%"},null);var c=this.zb("feGaussianBlur",{"in":"SourceAlpha",result:"blur",kB:this.shadowBlur/2});var d=this.zb("feFlood",{"in":"blur",result:"flood","flood-color":this.shadowColor});var e=this.zb("feComposite",{"in":"flood",in2:"blur",operator:"in",result:"comp"});var f=this.zb("feOffset",{"in":"comp",result:"offsetBlur", dx:this.shadowOffsetX,dy:this.shadowOffsetY});var g=this.zb("feMerge",{});g.appendChild(this.zb("feMergeNode",{"in":"offsetBlur"}));g.appendChild(this.zb("feMergeNode",{"in":"SourceGraphic"}));b.appendChild(c);b.appendChild(d);b.appendChild(e);b.appendChild(f);b.appendChild(g);0<this.Dc.length&&this.Dc[this.Dc.length-1].setAttributeNS(null,"filter","url(#"+a+")")}};t.Bw=function(a,b,c){this.Vp=a;this.Wp=b;this.rf=c};function Jl(a){a.shadowOffsetX=0;a.shadowOffsetY=0;a.shadowBlur=0} function Il(a){a.shadowOffsetX=a.Vp;a.shadowOffsetY=a.Wp;a.shadowBlur=a.rf}t.yt=function(a,b){this.Nu=!0;this.zh=a;this.Ah=b};t.wt=function(){this.Nu=!1};t.yc=function(){};t.Fy=function(){};mm.prototype.rotate=function(){};mm.prototype.getImageData=function(){return null};mm.prototype.measureText=function(){return null};mm.className="SVGContext"; P.prototype.Rt=function(a){var b=new Rj(this,qa.document);void 0===a&&(a=new jb);var c=this;return Qk(this,function(a,e){a=Rk(c,a,"SVG",b);a=null!==a?a.svg:null;return"function"===typeof e?(e(a),null):a},a)};P.prototype.makeSvg=P.prototype.Rt;P.prototype.cw=function(a){return this.Rt(a)};P.prototype.makeSVG=P.prototype.cw; N.prototype.Yx=function(a,b){if(!(a instanceof mm))return!1;if(!this.visible)return!0;var c=null,d=a.Lq;if(this instanceof U&&(this.type===U.TableRow||this.type===U.TableColumn))return Gl(this,a,b),!0;var e=this.Ab;if(0===e.width||0===e.height||isNaN(e.x)||isNaN(e.y))return!0;var f=this.transform,g=this.panel;0!==(this.I&4096)===!0&&Hl(this);var h=0!==(this.I&256),k=!1;this instanceof ih&&(a.font=this.font);if(h){k=g.je()?g.naturalBounds:g.actualBounds;if(null!==this.sd){var l=this.sd;var m=l.x;var n= l.y;var p=l.width;l=l.height}else m=Math.max(e.x,k.x),n=Math.max(e.y,k.y),p=Math.min(e.right,k.right)-m,l=Math.min(e.bottom,k.bottom)-n;if(m>e.width+e.x||e.x>k.width+k.x||n>e.height+e.y||e.y>k.height+k.y)return!0;k=!0;nm(a,1,0,0,1,0,0);a.save();a.beginPath();a.rect(m,n,p,l);a.clip()}if(this.Jf()&&!this.isVisible())return!0;a.be.Qa=[1,0,0,1,0,0];(this instanceof ih&&1<this.lineCount||this instanceof Yf&&1<this.geometry.figures.length)&&nm(a,1,0,0,1,0,0);m=!1;this.Jf()&&this.isShadowed&&b.Qe("drawShadows")&& (n=this.shadowOffset,a.Bw(n.x*b.scale*b.Yb,n.y*b.scale*b.Yb,this.shadowBlur),Il(a),a.shadowColor=this.shadowColor);n=!1;this.part&&b.Qe("drawShadows")&&(n=this.part.isShadowed);!0===this.shadowVisible?(Il(a),!1===m&&n&&(nm(a,1,0,0,1,0,0),a.br(),m=!0)):!1===this.shadowVisible&&Jl(a);p=this.naturalBounds;null!==this.areaBackground&&(zi(this,a,this.areaBackground,!0,!0,p,e),!1===m&&n&&(nm(a,1,0,0,1,0,0),a.br(),m=!0),this.areaBackground instanceof Kl&&this.areaBackground.type===Ll?(a.beginPath(),a.rect(e.x, e.y,e.width,e.height),a.ce(this.areaBackground)):a.fillRect(e.x,e.y,e.width,e.height));this instanceof U?nm(a,f.m11,f.m12,f.m21,f.m22,f.dx,f.dy):a.be.Qa=[f.m11,f.m12,f.m21,f.m22,f.dx,f.dy];if(null!==this.background){!1===m&&n&&(nm(a,1,0,0,1,0,0),a.br(),m=!0);var r=this.naturalBounds;l=f=0;var q=r.width;r=r.height;var u=0;this instanceof Yf&&(r=this.geometry.bounds,f=r.x,l=r.y,q=r.width,r=r.height,u=this.strokeWidth);zi(this,a,this.background,!0,!1,p,e);this.background instanceof Kl&&this.background.type=== Ll?(a.beginPath(),a.rect(f-u/2,l-u/2,q+u,r+u),a.ce(this.background)):a.fillRect(f-u/2,l-u/2,q+u,r+u)}n&&(null!==this.background||null!==this.areaBackground||null!==g&&0!==(g.I&512)||null!==g&&(g.type===U.Auto||g.type===U.Spot)&&g.Fb()!==this)?(Ml(this,!0),null===this.shadowVisible&&Jl(a)):Ml(this,!1);this.aj(a,b);n&&0!==(this.I&512)===!0&&Il(a);this.Jf()&&n&&Jl(a);h&&(a.restore(),k&&a.Dc.pop());this instanceof U&&(c=a.Dc.pop());!0===m&&a.Dc.pop();if(this instanceof ih&&1<this.lineCount||this instanceof Yf&&1<this.geometry.figures.length)c=a.Dc.pop();null!==a.Kk.zq&&(null===c&&(d===a.Lq?(nm(a,1,0,0,1,0,0),c=a.Dc.pop()):c=a.Lq),a.Kk.zq(this,c));this.svg=c;return!0};function Sk(a,b){this.ownerDocument=b=void 0===b?qa.document:b;this.zq=null;b=b.createElement("canvas");b.tabIndex=0;this.Ja=b;this.Ja.innerHTML="This text is displayed if your browser does not support the Canvas HTML element.";this.context=new Ol(b);b.B=a} Sk.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};Sk.prototype.toDataURL=function(a,b){return this.Ja.toDataURL(a,b)};Sk.prototype.getBoundingClientRect=function(){return this.Ja.getBoundingClientRect()};Sk.prototype.focus=function(){this.Ja.focus()};Sk.prototype.Xx=function(){this.ownerDocument=this.Ja.B=null}; ma.Object.defineProperties(Sk.prototype,{width:{configurable:!0,get:function(){return this.Ja.width},set:function(a){this.Ja.width=a}},height:{configurable:!0,get:function(){return this.Ja.height},set:function(a){this.Ja.height=a}},style:{configurable:!0,get:function(){return this.Ja.style}}});Sk.className="CanvasSurface"; function Ol(a){a.getContext&&a.getContext("2d")||v("Browser does not support HTML Canvas Element");this.aa=a.getContext("2d");this.pu=this.ru=this.qu="";this.vn=!1;this.rf=this.Wp=this.Vp=0}t=Ol.prototype;t.Fy=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.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()};Ol.prototype.rotate=function(a){this.aa.rotate(a)};t=Ol.prototype; t.save=function(){this.aa.save()};t.setTransform=function(a,b,c,d,e,f){this.aa.setTransform(a,b,c,d,e,f)};t.scale=function(a,b){this.aa.scale(a,b)};t.stroke=function(){this.aa.stroke()};t.transform=function(a,b,c,d,e,f){1===a&&0===b&&0===c&&1===d&&0===e&&0===f||this.aa.transform(a,b,c,d,e,f)};t.translate=function(a,b){this.aa.translate(a,b)}; t.ce=function(a){if(a instanceof Kl&&a.type===Ll){var b=a.Zk;a=a.su;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.vn?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.vn?this.clip():this.fill()};t.rj=function(){this.vn||this.stroke()};t.Bw=function(a,b,c){this.Vp=a;this.Wp=b;this.rf=c}; t.yt=function(a,b){var c=this.aa;void 0!==c.setLineDash&&(c.setLineDash(a),c.lineDashOffset=b)};t.wt=function(){var a=this.aa;void 0!==a.setLineDash&&(a.setLineDash(qm),a.lineDashOffset=0)};t.yc=function(a){a&&(this.qu="");this.pu=this.ru=""}; ma.Object.defineProperties(Ol.prototype,{fillStyle:{configurable:!0,get:function(){return this.aa.fillStyle},set:function(a){this.pu!==a&&(this.pu=this.aa.fillStyle=a)}},font:{configurable:!0,get:function(){return this.aa.font},set:function(a){this.qu!==a&&(this.qu=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.ru!==a&&(this.ru=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.vn}, set:function(a){this.vn=a}}});var qm=Object.freeze([]);Ol.className="CanvasSurfaceContext";function rm(){this.$=this.w=this.L=this.l=0}rm.className="ColorNumbers"; function Kl(a){F&&1<arguments.length&&v("Brush constructor can take at most one optional argument, the Brush type.");sm||(tm(),sm=!0);fb(this);this.s=!1;void 0===a?(this.ta=Nl,this.Yk="black"):"string"===typeof a?(this.ta=Nl,F&&!um(a)&&v('Color "'+a+'" is not a valid color string for Brush constructor'),this.Yk=a):(F&&hb(a,Kl,Kl,"constructor:type"),this.ta=a,this.Yk="black");var b=this.ta;b===Ql?(this.Ad=Ic,this.kl=Pc):this.kl=b===Ll?this.Ad=Mc:this.Ad=Gc;this.et=0;this.Sr=NaN;this.oe=this.Hs=this.ne= null;this.su=this.Zk=0}Kl.prototype.copy=function(){var a=new Kl;a.ta=this.ta;a.Yk=this.Yk;a.Ad=this.Ad.J();a.kl=this.kl.J();a.et=this.et;a.Sr=this.Sr;null!==this.ne&&(a.ne=this.ne.copy());a.Hs=this.Hs;return a};t=Kl.prototype;t.freeze=function(){this.s=!0;null!==this.ne&&this.ne.freeze();return this};t.ka=function(){Object.isFrozen(this)&&v("cannot thaw constant: "+this);this.s=!1;null!==this.ne&&this.ne.ka();return this};t.mb=function(a){a.classType===Kl?this.type=a:Ba(this,a)}; t.toString=function(){var a="Brush(";if(this.type===Nl)a+=this.color;else if(a=this.type===Ql?a+"Linear ":this.type===Ll?a+"Radial ":this.type===Pl?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.s&&va(this);("number"!==typeof a||!isFinite(a)||1<a||0>a)&&ya(a,"0 <= loc <= 1",Kl,"addColorStop:loc");A(b,"string",Kl,"addColorStop:color");F&&!um(b)&&v('Color "'+b+'" is not a valid color string for Brush.addColorStop');null===this.ne&&(this.ne=new Db);this.ne.add(a,b);this.ta===Nl&&(this.type=Ql);this.oe=null;return this}; function um(a){if("black"===a)return!0;if(""===a)return!1;F&&A(a,"string",Kl,"isValidColor");sm||(tm(),sm=!0);var b=vm;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.xA=function(a,b){this.s&&va(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?wm:b;if(this.type===Nl)gi(this.color),this.color=xm(a,b);else if((this.type===Ql||this.type===Ll)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)gi(c.value),this.addColorStop(c.key,xm(a,b));return this};function ym(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?wm:c;gi(a);return xm(b,c)} t.sz=function(a,b){this.s&&va(this);a=void 0===a||"number"!==typeof a?.2:a;b=void 0===b?wm:b;if(this.type===Nl)gi(this.color),this.color=xm(-a,b);else if((this.type===Ql||this.type===Ll)&&null!==this.colorStops)for(var c=this.colorStops.iterator;c.next();)gi(c.value),this.addColorStop(c.key,xm(-a,b));return this};function zm(a,b,c){b=void 0===b||"number"!==typeof b?.2:b;c=void 0===c?wm:c;gi(a);return xm(-b,c)} function Am(a,b,c){gi(a);a=Bm.l;var d=Bm.L,e=Bm.w,f=Bm.$;gi(b);void 0===c&&(c=.5);return"rgba("+Math.round((Bm.l-a)*c+a)+", "+Math.round((Bm.L-d)*c+d)+", "+Math.round((Bm.w-e)*c+e)+", "+Math.round((Bm.$-f)*c+f)+")"} t.py=function(){if(this.type===Nl)return Cm(this.color);if((this.type===Ql||this.type===Ll)&&null!==this.colorStops){var a=this.colorStops;if(this.type===Ll)return Cm(a.first().value);if(null!==a.get(.5))return Cm(a.get(.5));if(2===a.count)return a=a.ua(),Cm(Am(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 Cm(Am(a.get(c),a.get(d),1-f/e))}return!1}; function Cm(a){if(null===a)return null;if(a instanceof Kl)return a.py();gi(a);return 128>(299*Bm.l+587*Bm.L+114*Bm.w)/1E3} function xm(a,b){switch(b){case wm:b=100*Dm(Bm.l);var c=100*Dm(Bm.L),d=100*Dm(Bm.w);Em.l=.4124564*b+.3575761*c+.1804375*d;Em.L=.2126729*b+.7151522*c+.072175*d;Em.w=.0193339*b+.119192*c+.9503041*d;Em.$=Bm.$;b=Fm(Em.l/Gm[0]);c=Fm(Em.L/Gm[1]);d=Fm(Em.w/Gm[2]);Hm.l=116*c-16;Hm.L=500*(b-c);Hm.w=200*(c-d);Hm.$=Em.$;Hm.l=Math.min(100,Math.max(0,Hm.l+100*a));a=(Hm.l+16)/116;b=a-Hm.w/200;Em.l=Gm[0]*Im(Hm.L/500+a);Em.L=Gm[1]*(Hm.l>Jm*Km?Math.pow(a,3):Hm.l/Jm);Em.w=Gm[2]*Im(b);Em.$=Hm.$;a=-.969266*Em.l+1.8760108* Em.L+.041556*Em.w;b=.0556434*Em.l+-.2040259*Em.L+1.0572252*Em.w;Bm.l=255*Lm((3.2404542*Em.l+-1.5371385*Em.L+-.4985314*Em.w)/100);Bm.L=255*Lm(a/100);Bm.w=255*Lm(b/100);Bm.$=Em.$;Bm.l=Math.round(Bm.l);255<Bm.l?Bm.l=255:0>Bm.l&&(Bm.l=0);Bm.L=Math.round(Bm.L);255<Bm.L?Bm.L=255:0>Bm.L&&(Bm.L=0);Bm.w=Math.round(Bm.w);255<Bm.w?Bm.w=255:0>Bm.w&&(Bm.w=0);return"rgba("+Bm.l+", "+Bm.L+", "+Bm.w+", "+Bm.$+")";case Mm:return hi(),ii.w=Math.min(100,Math.max(0,ii.w+100*a)),"hsla("+ii.l+", "+ii.L+"%, "+ii.w+"%, "+ ii.$+")";default:return v("Unknown color space: "+b),"rgba(0, 0, 0, 1)"}}function gi(a){sm||(tm(),sm=!0);var b=vm;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,Bm.l=a[0],Bm.L=a[1],Bm.w=a[2],Bm.$=a[3]/255):(b.fillStyle="#FFFFFF",c=b.fillStyle,b.fillStyle=a,b.fillStyle===c&&F&&v('Color "'+a+'" is not a valid color string for RGBA color conversion'),Bm.l=0,Bm.L=0,Bm.w=0,Bm.$=1)}} function hi(){var a=Bm.l/255,b=Bm.L/255,c=Bm.w/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))}ii.l=Math.round(g);ii.L=Math.round(100*a);ii.w=Math.round(100*e);ii.$=Bm.$}function Dm(a){a/=255;return.04045>=a?a/12.92:Math.pow((a+.055)/1.055,2.4)}function Lm(a){return.0031308>=a?12.92*a:1.055*Math.pow(a,1/2.4)-.055} function Fm(a){return a>Km?Math.pow(a,1/3):(Jm*a+16)/116}function Im(a){var b=a*a*a;return b>Km?b:(116*a-16)/Jm}function hm(a,b){"string"===typeof a?F&&!um(a)&&v('Color "'+a+'" is not a valid color string for '+b):a instanceof Kl||v("Value for "+b+" must be a color string or a Brush, not "+a)}function tm(){vm=gh?(new Sk(null)).context:null} ma.Object.defineProperties(Kl.prototype,{type:{configurable:!0,get:function(){return this.ta},set:function(a){this.s&&va(this,a);hb(a,Kl,Kl,"type");this.ta=a;this.start.Sb()&&(a===Ql?this.start=Ic:a===Ll&&(this.start=Mc));this.end.Sb()&&(a===Ql?this.end=Pc:a===Ll&&(this.end=Mc));this.oe=null}},color:{configurable:!0,get:function(){return this.Yk},set:function(a){this.s&&va(this,a);F&&!um(a)&&v('Color "'+a+'" is not a valid color string for Brush.color');this.Yk=a;this.oe= null}},start:{configurable:!0,get:function(){return this.Ad},set:function(a){this.s&&va(this,a);w(a,M,Kl,"start");this.Ad=a.J();this.oe=null}},end:{configurable:!0,get:function(){return this.kl},set:function(a){this.s&&va(this,a);w(a,M,Kl,"end");this.kl=a.J();this.oe=null}},startRadius:{configurable:!0,get:function(){return this.et},set:function(a){this.s&&va(this,a);C(a,Kl,"startRadius");0>a&&ya(a,">= zero",Kl,"startRadius");this.et=a;this.oe=null}},endRadius:{configurable:!0, enumerable:!0,get:function(){return this.Sr},set:function(a){this.s&&va(this,a);C(a,Kl,"endRadius");0>a&&ya(a,">= zero",Kl,"endRadius");this.Sr=a;this.oe=null}},colorStops:{configurable:!0,get:function(){return this.ne},set:function(a){this.s&&va(this,a);F&&w(a,Db,Kl,"colorStops");this.ne=a;this.oe=null}},pattern:{configurable:!0,get:function(){return this.Hs},set:function(a){this.s&&va(this,a);this.Hs=a;this.oe=null}}});Kl.prototype.isDark=Kl.prototype.py; Kl.prototype.darkenBy=Kl.prototype.sz;Kl.prototype.lightenBy=Kl.prototype.xA;Kl.prototype.addColorStop=Kl.prototype.addColorStop;var Km=216/24389,Jm=24389/27,Gm=[95.047,100,108.883],vm=null,Bm=new rm,ii=new rm,Em=new rm,Hm=new rm,sm=!1;Kl.className="Brush";var Nl;Kl.Solid=Nl=new E(Kl,"Solid",0);var Ql;Kl.Linear=Ql=new E(Kl,"Linear",1);var Ll;Kl.Radial=Ll=new E(Kl,"Radial",2);var Pl;Kl.Pattern=Pl=new E(Kl,"Pattern",4);var wm;Kl.Lab=wm=new E(Kl,"Lab",5);var Mm;Kl.HSL=Mm=new E(Kl,"HSL",6); Kl.randomColor=function(a,b){void 0===a&&(a=128);F&&(C(a,Kl,"randomColor:min"),(0>a||255<a)&&ya(a,"0 <= min <= 255",Kl,"randomColor:min"));void 0===b&&(b=Math.max(a,255));F&&(C(b,Kl,"randomColor:max"),(b<a||255<b)&&ya(b,"min <= max <= 255",Kl,"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};Kl.isValidColor=um;Kl.lighten=function(a){return ym(a)};Kl.lightenBy=ym;Kl.darken=function(a){return zm(a)};Kl.darkenBy=zm;Kl.mix=Am;Kl.isDark=Cm;function em(){this.name="Base"}em.prototype.measure=function(){};em.prototype.AA=function(a,b,c,d,e){a.measure(b,c,d,e)};em.prototype.arrange=function(){};em.prototype.hz=function(a,b,c,d,e,f){a.arrange(b,c,d,e,f)};em.prototype.hc=function(){};ma.Object.defineProperties(em.prototype,{classType:{configurable:!0,get:function(){return U}}}); em.prototype.arrangeElement=em.prototype.hz;em.prototype.measureElement=em.prototype.AA;em.className="PanelLayout";function Nm(){this.name="Base"}la(Nm,em); Nm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;a=Om(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 Yf&&l.isGeometryPositioned&&(l=l.strokeWidth/2,p-=l,r-=l);qc(e,p,r,n,m)}}}; Nm.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 Yf&&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 Pm(){this.name="Base"}la(Pm,em); Pm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length;b=La();f=Om(a);for(var k=0;k<h;k++){var l=d[k];if(l.visible||l===f){var m=Bl(l,!1);if(m!==Mg&&m!==ml)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)}; Pm.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,x=Bl(m,!1);if(isNaN(m.desiredSize.height)&&x===Hd||x===nl)u=Math.max(c.height-r-q,0);r=u+r+q;q=m.alignment;q.Gb()&&(q=a.defaultAlignment);q.ab()||(q=Mc);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 Qm(){this.name="Base"}la(Qm,em); Qm.prototype.measure=function(a,b,c,d,e,f){var g=d.length;c=La();for(var h=Om(a),k=0;k<g;k++){var l=d[k];if(l.visible||l===h){var m=Bl(l,!1);if(m!==Mg&&m!==nl)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;gc(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)}}; Qm.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,x=Bl(m,!1);if(isNaN(m.desiredSize.width)&&x===Hd||x===ml)u=Math.max(c.width-r-q,0);r=u+r+q;q=m.alignment;q.Gb()&&(q=a.defaultAlignment);q.ab()||(q=Mc);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 Rm(){this.name="Base"}la(Rm,em); Rm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.Fb(),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);for(var u=a.isClipping,x=L.allocAt(-l.left,-l.top,r,q),y=!0,z=Om(a),B=0;B<h;B++){var D=d[B];if(D!==k&&(D.visible||D===z)){l=D.margin;r=l.right+l.left;q=l.top+l.bottom;p=Bl(D,!1);switch(p){case Hd:b=f;c=g;break;case ml:b=f;break;case nl:c=g}D.measure(b,c,0,0);p=D.measuredBounds;r= Math.max(p.width+r,0);q=Math.max(p.height+q,0);var G=D.alignment;G.Gb()&&(G=a.defaultAlignment);G.ab()||(G=Mc);var O=D.alignmentFocus;O.Gb()&&(O=Mc);var X=null;D instanceof U&&""!==D.Sg&&(D.arrange(0,0,p.width,p.height),X=D.fb(D.Sg),X===D&&(X=null));if(null!==X){l=X.naturalBounds;p=X.margin;for(l=J.allocAt(O.x*l.width-O.offsetX-p.left,O.y*l.height-O.offsetY-p.top);X!==D;)X.transform.xa(l),X=X.panel;D=G.x*f+G.offsetX-l.x;p=G.y*g+G.offsetY-l.y;J.free(l)}else D=G.x*f+G.offsetX-(O.x*p.width+O.offsetX)- l.left,p=G.y*g+G.offsetY-(O.y*p.height+O.offsetY)-l.top;y?(y=!1,e.h(D,p,r,q)):qc(e,D,p,r,q)}}y?e.assign(x):u?e.Xv(x.x,x.y,x.width,x.height):qc(e,x.x,x.y,x.width,x.height);L.free(x);p=k.stretch;p===ll&&(p=Bl(k,!1));switch(p){case Mg:return;case Hd:if(!isFinite(b)&&!isFinite(c))return;break;case ml:if(!isFinite(b))return;break;case nl: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=L.allocAt(-l.left,-l.top,r,q);for(b=0;b<h;b++)c=d[b],c=== k||!c.visible&&c!==z||(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.Gb()&&(m=a.defaultAlignment),m.ab()||(m=Mc),c=c.alignmentFocus,c.Gb()&&(c=Mc),y?(y=!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)):qc(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));y?e.assign(x):u?e.Xv(x.x,x.y,x.width,x.height):qc(e,x.x, x.y,x.width,x.height);L.free(x)}; Rm.prototype.arrange=function(a,b,c){var d=b.length,e=a.Fb(),f=e.measuredBounds,g=f.width;f=f.height;var h=a.padding,k=h.left;h=h.top;var l=k-c.x,m=h-c.y;e.arrange(l,m,g,f);for(var n=0;n<d;n++){var p=b[n];if(p!==e){var r=p.measuredBounds,q=r.width;r=r.height;m=p.alignment;m.Gb()&&(m=a.defaultAlignment);m.ab()||(m=Mc);var u=p.alignmentFocus;u.Gb()&&(u=Mc);l=null;p instanceof U&&""!==p.Sg&&(l=p.fb(p.Sg),l===p&&(l=null));if(null!==l){var x=l.naturalBounds;for(u=J.allocAt(u.x*x.width-u.offsetX,u.y*x.height- u.offsetY);l!==p;)l.transform.xa(u),l=l.panel;l=m.x*g+m.offsetX-u.x;m=m.y*f+m.offsetY-u.y;J.free(u)}else l=m.x*g+m.offsetX-(u.x*q+u.offsetX),m=m.y*f+m.offsetY-(u.y*r+u.offsetY);l-=c.x;m-=c.y;p.visible&&p.arrange(k+l,h+m,q,r)}}};function Sm(){this.name="Base"}la(Sm,em); Sm.prototype.measure=function(a,b,c,d,e,f,g){var h=d.length,k=a.Fb(),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 Yf&&(u=k,q=u.strokeWidth*u.scale);var x=Math.max(l.width+p,0);l=Math.max(l.height+r,0);var y=Tm(k),z=y.x*x+y.offsetX;y=y.y*l+y.offsetY;var B=Um(k),D=B.x*x+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(y-B)-q,0));q=Hb.alloc();q.h(0,0);a=Om(a);for(B=0;B< h;B++)y=d[B],y===k||!y.visible&&y!==a||(l=y.margin,x=l.right+l.left,z=l.top+l.bottom,y.measure(m,n,0,0),l=y.measuredBounds,x=Math.max(l.width+x,0),l=Math.max(l.height+z,0),q.h(Math.max(x,q.width),Math.max(l,q.height)));if(1===h)e.width=x,e.height=l,Hb.free(q);else{y=Tm(k);B=Um(k);h=d=0;B.x!==y.x&&B.y!==y.y&&(d=q.width/Math.abs(B.x-y.x),h=q.height/Math.abs(B.y-y.y));Hb.free(q);q=0;null!==u&&(q=u.strokeWidth*u.scale,Ng(u)===Og&&(d=h=Math.max(d,h)));d+=Math.abs(y.offsetX)+Math.abs(B.offsetX)+q;h+=Math.abs(y.offsetY)+ Math.abs(B.offsetY)+q;u=k.stretch;u===ll&&(u=Bl(k,!1));switch(u){case Mg:g=f=0;break;case Hd:isFinite(b)&&(d=b);isFinite(c)&&(h=c);break;case ml:isFinite(b)&&(d=b);g=0;break;case nl:f=0,isFinite(c)&&(h=c)}k.Cm();k.measure(d,h,f,g);e.width=k.measuredBounds.width+p;e.height=k.measuredBounds.height+r}}; Sm.prototype.arrange=function(a,b){var c=b.length,d=a.Fb(),e=d.measuredBounds,f=L.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=Tm(d),n=Um(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;qc(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.Gb()&&(p=a.defaultAlignment),p.ab()||(p=Mc),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&&(rc(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 L(f.x,f.y,f.width,f.height))));L.free(f)};function Vm(){this.name="Base";this.name="Table"}la(Vm,em); Vm.prototype.measure=function(a,b,c,d,e,f,g){for(var h=d.length,k=La(),l=La(),m=0;m<h;m++){var n=d[m],p=n instanceof U?n:null;if(null===p||p.type!==U.TableRow&&p.type!==U.TableColumn||!n.visible)k.push(n);else{F&&(p.desiredSize.o()&&v(p.toString()+" TableRow/TableColumn Panels cannot set a desiredSize: "+p.desiredSize.toString()),p.minSize.A(Wb)||v(p.toString()+" TableRow/TableColumn Panels cannot set a minSize: "+p.minSize.toString()),p.maxSize.A(bc)||v(p.toString()+" TableRow/TableColumn Panels cannot set a maxSize: "+ p.maxSize.toString()));l.push(p);for(var r=p.Z.j,q=r.length,u=0;u<q;u++){var x=r[u];p.type===U.TableRow?x.row=n.row:p.type===U.TableColumn&&(x.column=n.column);k.push(x)}}}h=k.length;0===h&&(a.getRowDefinition(0),a.getColumnDefinition(0));for(var y=[],z=0;z<h;z++){var B=k[z];Cj(B,!0);Cl(B,!0);y[B.row]||(y[B.row]=[]);y[B.row][B.column]||(y[B.row][B.column]=[]);y[B.row][B.column].push(B)}Oa(k);var D=La(),G=La(),O=La(),X={count:0},Q={count:0},ca=b,Y=c,oa=a.xb;h=oa.length;for(var Da=0;Da<h;Da++){var V= oa[Da];void 0!==V&&(V.actual=0)}oa=a.tb;h=oa.length;for(var Ma=0;Ma<h;Ma++)V=oa[Ma],void 0!==V&&(V.actual=0);for(var Va=y.length,xb=0,Ta=0;Ta<Va;Ta++)y[Ta]&&(xb=Math.max(xb,y[Ta].length));var Ob=Math.min(a.topIndex,Va-1),Nd=Math.min(a.leftIndex,xb-1),yb=0;Va=y.length;for(var oc=Om(a),qb=0;qb<Va;qb++)if(y[qb]){xb=y[qb].length;for(var $d=a.getRowDefinition(qb),Kc=$d.actual=0;Kc<xb;Kc++)if(y[qb][Kc]){var Mf=a.getColumnDefinition(Kc);void 0===D[Kc]&&(Mf.actual=0,D[Kc]=!0);for(var of=y[qb][Kc],Ve=of.length, Hh=0;Hh<Ve;Hh++){var Qc=of[Hh];if(Qc.visible||Qc===oc){var Nf=1<Qc.rowSpan||1<Qc.columnSpan;Nf&&(qb<Ob||Kc<Nd||G.push(Qc));var pf=Qc.margin,ae=pf.right+pf.left,ok=pf.top+pf.bottom;var Yb=Ul(Qc,$d,Mf,!1);var Of=Qc.desiredSize,Od=!isNaN(Of.height),zc=!isNaN(Of.width)&&Od;Nf||Yb===Mg||zc||qb<Ob||Kc<Nd||(void 0!==X[Kc]||Yb!==Hd&&Yb!==ml||(X[Kc]=-1,X.count++),void 0!==Q[qb]||Yb!==Hd&&Yb!==nl||(Q[qb]=-1,Q.count++),O.push(Qc));Qc.measure(Infinity,Infinity,0,0);if(!(qb<Ob||Kc<Nd)){var qf=Qc.measuredBounds, hd=Math.max(qf.width+ae,0),wg=Math.max(qf.height+ok,0);if(1===Qc.rowSpan&&(Yb===Mg||Yb===ml)){V=a.getRowDefinition(qb);var Ih=V.Ac();yb=Math.max(wg-V.actual,0);yb+Ih>Y&&(yb=Math.max(Y-Ih,0));var In=0===V.actual;V.actual=V.actual+yb;Y=Math.max(Y-(yb+(In?Ih:0)),0)}if(1===Qc.columnSpan&&(Yb===Mg||Yb===nl)){V=a.getColumnDefinition(Kc);var xg=V.Ac();yb=Math.max(hd-V.actual,0);yb+xg>ca&&(yb=Math.max(ca-xg,0));var pk=0===V.actual;V.actual=V.actual+yb;ca=Math.max(ca-(yb+(pk?xg:0)),0)}Nf&&Qc.Cm()}}}}}Oa(D); var pc=0,$c=0;h=a.columnCount;for(var tc=0;tc<h;tc++){var yg=a.tb[tc];void 0!==yg&&(pc+=yg.na,0!==yg.na&&(pc+=yg.Ac()))}h=a.rowCount;for(var Jh=0;Jh<h;Jh++){var rf=a.xb[Jh];void 0!==rf&&($c+=rf.na,0!==rf.na&&($c+=rf.Ac()))}ca=Math.max(b-pc,0);var Si=Y=Math.max(c-$c,0),xe=ca;h=O.length;for(var We=0;We<h;We++){var Ac=O[We],qk=a.getRowDefinition(Ac.row),Jn=a.getColumnDefinition(Ac.column),zg=Ac.measuredBounds,Pb=Ac.margin,Ag=Pb.right+Pb.left,rk=Pb.top+Pb.bottom;X[Ac.column]=0===Jn.actual&&void 0!==X[Ac.column]? Math.max(zg.width+Ag,X[Ac.column]):null;Q[Ac.row]=0===qk.actual&&void 0!==Q[Ac.row]?Math.max(zg.height+rk,Q[Ac.row]):null}var Ti=0,Bg=0,Pf;for(Pf in Q)"count"!==Pf&&(Ti+=Q[Pf]);for(Pf in X)"count"!==Pf&&(Bg+=X[Pf]);for(var rb=Hb.alloc(),Cg=0;Cg<h;Cg++){var Bc=O[Cg];if(Bc.visible||Bc===oc){var Rc=a.getRowDefinition(Bc.row),sb=a.getColumnDefinition(Bc.column),Pd=0;isFinite(sb.width)?Pd=sb.width:(isFinite(ca)&&null!==X[Bc.column]?0===Bg?Pd=sb.actual+ca:Pd=X[Bc.column]/Bg*xe:null!==X[Bc.column]?Pd=ca: Pd=sb.actual||ca,Pd=Math.max(0,Pd-sb.Ac()));var Qd=0;isFinite(Rc.height)?Qd=Rc.height:(isFinite(Y)&&null!==Q[Bc.row]?0===Ti?Qd=Rc.actual+Y:Qd=Q[Bc.row]/Ti*Si:null!==Q[Bc.row]?Qd=Y:Qd=Rc.actual||Y,Qd=Math.max(0,Qd-Rc.Ac()));rb.h(Math.max(sb.minimum,Math.min(Pd,sb.maximum)),Math.max(Rc.minimum,Math.min(Qd,Rc.maximum)));Yb=Ul(Bc,Rc,sb,!1);switch(Yb){case ml:rb.height=Math.max(rb.height,Rc.actual+Y);break;case nl:rb.width=Math.max(rb.width,sb.actual+ca)}var be=Bc.margin,Kn=be.right+be.left,Kh=be.top+ be.bottom;Bc.Cm();Bc.measure(rb.width,rb.height,sb.minimum,Rc.minimum);var Lh=Bc.measuredBounds,Mh=Math.max(Lh.width+Kn,0),Nh=Math.max(Lh.height+Kh,0);isFinite(ca)&&(Mh=Math.min(Mh,rb.width));isFinite(Y)&&(Nh=Math.min(Nh,rb.height));var Dg=0;Dg=Rc.actual;Rc.actual=Math.max(Rc.actual,Nh);yb=Rc.actual-Dg;Y=Math.max(Y-yb,0);Dg=sb.actual;sb.actual=Math.max(sb.actual,Mh);yb=sb.actual-Dg;ca=Math.max(ca-yb,0)}}Oa(O);var Rd=Hb.alloc(),id=La(),ye=La();h=G.length;if(0!==h)for(var Qb=0;Qb<Va;Qb++)if(y[Qb]){xb= y[Qb].length;var Ui=a.getRowDefinition(Qb);id[Qb]=Ui.actual;for(var jd=0;jd<xb;jd++)if(y[Qb][jd]){var Ln=a.getColumnDefinition(jd);ye[jd]=Ln.actual}}for(var ze=0;ze<h;ze++){var ab=G[ze];if(ab.visible||ab===oc){var Sd=a.getRowDefinition(ab.row),Cc=a.getColumnDefinition(ab.column);rb.h(Math.max(Cc.minimum,Math.min(b,Cc.maximum)),Math.max(Sd.minimum,Math.min(c,Sd.maximum)));Yb=Ul(ab,Sd,Cc,!1);switch(Yb){case Hd:0!==ye[Cc.index]&&(rb.width=Math.min(rb.width,ye[Cc.index]));0!==id[Sd.index]&&(rb.height= Math.min(rb.height,id[Sd.index]));break;case ml:0!==ye[Cc.index]&&(rb.width=Math.min(rb.width,ye[Cc.index]));break;case nl:0!==id[Sd.index]&&(rb.height=Math.min(rb.height,id[Sd.index]))}isFinite(Cc.width)&&(rb.width=Cc.width);isFinite(Sd.height)&&(rb.height=Sd.height);Rd.h(0,0);for(var Ae=1;Ae<ab.rowSpan&&!(ab.row+Ae>=a.rowCount);Ae++)V=a.getRowDefinition(ab.row+Ae),yb=0,yb=Yb===Hd||Yb===nl?Math.max(V.minimum,0===id[ab.row+Ae]?V.maximum:Math.min(id[ab.row+Ae],V.maximum)):Math.max(V.minimum,isNaN(V.Wc)? V.maximum:Math.min(V.Wc,V.maximum)),Rd.height+=yb;for(var Be=1;Be<ab.columnSpan&&!(ab.column+Be>=a.columnCount);Be++)V=a.getColumnDefinition(ab.column+Be),yb=0,yb=Yb===Hd||Yb===ml?Math.max(V.minimum,0===ye[ab.column+Be]?V.maximum:Math.min(ye[ab.column+Be],V.maximum)):Math.max(V.minimum,isNaN(V.Wc)?V.maximum:Math.min(V.Wc,V.maximum)),Rd.width+=yb;rb.width+=Rd.width;rb.height+=Rd.height;var Oh=ab.margin,Ph=Oh.right+Oh.left,ce=Oh.top+Oh.bottom;ab.measure(rb.width,rb.height,f,g);for(var Ce=ab.measuredBounds, Xe=Math.max(Ce.width+Ph,0),Ye=Math.max(Ce.height+ce,0),De=0,Bd=0;Bd<ab.rowSpan&&!(ab.row+Bd>=a.rowCount);Bd++)V=a.getRowDefinition(ab.row+Bd),De+=V.total||0;if(De<Ye){var Qf=Ye-De,Eg=Ye-De;if(null!==ab.spanAllocation)for(var Mn=ab.spanAllocation,Qh=0;Qh<ab.rowSpan&&!(0>=Qf)&&!(ab.row+Qh>=a.rowCount);Qh++){V=a.getRowDefinition(ab.row+Qh);var Td=V.na||0,Fg=Mn(ab,V,Eg);F&&"number"!==typeof Fg&&v(ab+" spanAllocation does not return a number: "+Fg);V.actual=Math.min(V.maximum,Td+Fg);V.na!==Td&&(Qf-=V.na- Td)}for(;0<Qf;){var Rh=V.na||0;isNaN(V.height)&&V.maximum>Rh&&(V.actual=Math.min(V.maximum,Rh+Qf),V.na!==Rh&&(Qf-=V.na-Rh));if(0===V.index)break;V=a.getRowDefinition(V.index-1)}}for(var Sh=0,sk=0;sk<ab.columnSpan&&!(ab.column+sk>=a.columnCount);sk++)V=a.getColumnDefinition(ab.column+sk),Sh+=V.total||0;if(Sh<Xe){var Vi=Xe-Sh,fu=Xe-Sh;if(null!==ab.spanAllocation)for(var gu=ab.spanAllocation,tk=0;tk<ab.columnSpan&&!(0>=Vi)&&!(ab.column+tk>=a.columnCount);tk++){V=a.getColumnDefinition(ab.column+tk);var Nn= V.na||0,On=gu(ab,V,fu);F&&"number"!==typeof On&&v(ab+" spanAllocation does not return a number: "+On);V.actual=Math.min(V.maximum,Nn+On);V.na!==Nn&&(Vi-=V.na-Nn)}for(;0<Vi;){var uk=V.na||0;isNaN(V.width)&&V.maximum>uk&&(V.actual=Math.min(V.maximum,uk+Vi),V.na!==uk&&(Vi-=V.na-uk));if(0===V.index)break;V=a.getColumnDefinition(V.index-1)}}}}Oa(G);Hb.free(Rd);Hb.free(rb);void 0!==id&&Oa(id);void 0!==ye&&Oa(ye);var Gg=0,Hg=0,vk=a.desiredSize,Ar=a.maxSize;Yb=Bl(a,!0);var Wi=$c=pc=0,Xi=0;h=a.columnCount; for(var wk=0;wk<h;wk++)void 0!==a.tb[wk]&&(V=a.getColumnDefinition(wk),isFinite(V.width)?(Wi+=V.width,Wi+=V.Ac()):Wm(V)===Xm?(Wi+=V.na,Wi+=V.Ac()):0!==V.na&&(pc+=V.na,pc+=V.Ac()));isFinite(vk.width)?Gg=Math.min(vk.width,Ar.width):Gg=Yb!==Mg&&isFinite(b)?b:pc;Gg=Math.max(Gg,a.minSize.width);Gg=Math.max(Gg-Wi,0);for(var hu=0===pc?1:Math.max(Gg/pc,1),yk=0;yk<h;yk++)void 0!==a.tb[yk]&&(V=a.getColumnDefinition(yk),isFinite(V.width)||Wm(V)===Xm||(V.actual=V.na*hu),V.position=e.width,0!==V.na&&(e.width+= V.na,e.width+=V.Ac()));h=a.rowCount;for(var zk=0;zk<h;zk++)void 0!==a.xb[zk]&&(V=a.getRowDefinition(zk),isFinite(V.height)?(Xi+=V.height,Xi+=V.Ac()):Wm(V)===Xm?(Xi+=V.na,Xi+=V.Ac()):0!==V.na&&($c+=V.na,0!==V.na&&($c+=V.Ac())));isFinite(vk.height)?Hg=Math.min(vk.height,Ar.height):Hg=Yb!==Mg&&isFinite(c)?c:$c;Hg=Math.max(Hg,a.minSize.height);Hg=Math.max(Hg-Xi,0);for(var iu=0===$c?1:Math.max(Hg/$c,1),Ak=0;Ak<h;Ak++)void 0!==a.xb[Ak]&&(V=a.getRowDefinition(Ak),isFinite(V.height)||Wm(V)===Xm||(V.actual= V.na*iu),V.position=e.height,0!==V.na&&(e.height+=V.na,0!==V.na&&(e.height+=V.Ac())));h=l.length;for(var Pn=0;Pn<h;Pn++){var Cd=l[Pn],Qn=0,Rn=0;Cd.type===U.TableRow?(Qn=e.width,V=a.getRowDefinition(Cd.row),Rn=V.actual):(V=a.getColumnDefinition(Cd.column),Qn=V.actual,Rn=e.height);Cd.measuredBounds.h(0,0,Qn,Rn);Cj(Cd,!1);y[Cd.row]||(y[Cd.row]=[]);y[Cd.row][Cd.column]||(y[Cd.row][Cd.column]=[]);y[Cd.row][Cd.column].push(Cd)}Oa(l);a.Ip=y}; Vm.prototype.arrange=function(a,b,c){var d=b.length,e=a.padding,f=e.left;e=e.top;for(var g=a.Ip,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.xb[n]||0===a.xb[n].na);)n++;n=Math.min(n,l-1);n=-a.xb[n].position;for(h=Math.min(a.leftIndex,m-1);h!==m&&(void 0===a.tb[h]||0===a.tb[h].na);)h++;h=Math.min(h,m-1);for(var p=-a.tb[h].position,r=Hb.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.na&& (k+=u.Av());for(var x=0;x<m;x++)if(g[q][x]){var y=a.getColumnDefinition(x);h=y.position+p+f;0!==y.na&&(h+=y.Av());for(var z=g[q][x],B=z.length,D=0;D<B;D++){var G=z[D],O=G.measuredBounds,X=G instanceof U?G:null;if(null===X||X.type!==U.TableRow&&X.type!==U.TableColumn){r.h(0,0);for(var Q=1;Q<G.rowSpan&&!(q+Q>=a.rowCount);Q++)X=a.getRowDefinition(q+Q),r.height+=X.total;for(Q=1;Q<G.columnSpan&&!(x+Q>=a.columnCount);Q++)X=a.getColumnDefinition(x+Q),r.width+=X.total;var ca=y.na+r.width,Y=u.na+r.height; Q=h;X=k;var oa=ca,Da=Y,V=h,Ma=k,Va=ca,xb=Y;h+ca>c.width&&(Va=Math.max(c.width-h,0));k+Y>c.height&&(xb=Math.max(c.height-k,0));var Ta=G.alignment;if(Ta.Gb()){Ta=a.defaultAlignment;Ta.ab()||(Ta=Mc);var Ob=Ta.x;var Nd=Ta.y;var yb=Ta.offsetX;Ta=Ta.offsetY;var oc=y.alignment,qb=u.alignment;oc.ab()&&(Ob=oc.x,yb=oc.offsetX);qb.ab()&&(Nd=qb.y,Ta=qb.offsetY)}else Ob=Ta.x,Nd=Ta.y,yb=Ta.offsetX,Ta=Ta.offsetY;if(isNaN(Ob)||isNaN(Nd))Nd=Ob=.5,Ta=yb=0;oc=O.width;qb=O.height;var $d=G.margin,Kc=$d.left+$d.right, Mf=$d.top+$d.bottom,of=Ul(G,u,y,!1);!isNaN(G.desiredSize.width)||of!==Hd&&of!==ml||(oc=Math.max(ca-Kc,0));!isNaN(G.desiredSize.height)||of!==Hd&&of!==nl||(qb=Math.max(Y-Mf,0));ca=G.maxSize;Y=G.minSize;oc=Math.min(ca.width,oc);qb=Math.min(ca.height,qb);oc=Math.max(Y.width,oc);qb=Math.max(Y.height,qb);ca=qb+Mf;Q+=oa*Ob-(oc+Kc)*Ob+yb+$d.left;X+=Da*Nd-ca*Nd+Ta+$d.top;G.visible&&(rc(V,Ma,Va,xb,Q,X,O.width,O.height)?G.arrange(Q,X,oc,qb):G.arrange(Q,X,oc,qb,new L(V,Ma,Va,xb)))}else G.zl(),G.actualBounds.ka(), oa=G.actualBounds,Q=L.allocAt(oa.x,oa.y,oa.width,oa.height),oa.x=X.type===U.TableRow?f:h,oa.y=X.type===U.TableColumn?e:k,oa.width=O.width,oa.height=O.height,G.actualBounds.freeze(),Cl(G,!1),jc(Q,oa)||(O=G.part,null!==O&&(O.Rh(),G.jp(O))),L.free(Q)}}}Hb.free(r);for(a=0;a<d;a++)c=b[a],f=c instanceof U?c:null,null===f||f.type!==U.TableRow&&f.type!==U.TableColumn||(f=c.actualBounds,c.naturalBounds.ka(),c.naturalBounds.h(0,0,f.width,f.height),c.naturalBounds.freeze())};function Ym(){this.name="Base"} la(Ym,em);Ym.prototype.measure=function(){};Ym.prototype.arrange=function(){};function Zm(){this.name="Base"}la(Zm,em);Zm.prototype.measure=function(){};Zm.prototype.arrange=function(){};function $m(){this.name="Base"}la($m,em); $m.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.Fa=1;d.Cm();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===Og?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.Fa*=q;m!==d.scale&&(Cj(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)};$m.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.Gb()&&(g=a.defaultAlignment);g.ab()||(g=Mc);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 an(){this.name="Base"}la(an,em);an.prototype.measure=function(){}; an.prototype.arrange=function(){}; an.prototype.hc=function(a,b,c){c=a.Gf()*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;b.save();b.beginPath();b.rect(0,0,h,k);b.clip();for(var p=[],r=a.Z.j,q=r.length,u=0;u<q;u++){var x=r[u],y=[];p.push(y);if(x.visible){var z=x.interval;if(!(0>z)){x=kk(x.figure);for(var B=0;B<q;B++)if(B!==u){var D=r[B];D.visible&&kk(D.figure)===x&&(D=D.interval,D>z&&y.push(D))}}}}r=a.Z.j;q= r.length;for(u=0;u<q;u++){var G=r[u];if(G.visible&&(y=G.interval,!(2>e*Math.abs(y)*c))){z=G.opacity;x=1;if(1!==z){if(0===z)continue;x=b.globalAlpha;b.globalAlpha=x*z}B=p[u];D=!1;var O=G.strokeDashArray;null!==O&&(D=!0,b.yt(O,G.strokeDashOffset));if("LineV"===G.figure&&null!==G.stroke&&0<G.strokeWidth){b.lineWidth=G.strokeWidth;zi(a,b,G.stroke,!1,!1,f,g);b.beginPath();for(O=G=Math.floor(-n.x/e);O<=G+l;O++){var X=O*e+n.x;0<=X&&X<=h&&bn(O,y,B)&&(b.moveTo(X,0),b.lineTo(X,k))}b.stroke()}else if("LineH"=== G.figure&&null!==G.stroke&&0<G.strokeWidth){b.lineWidth=G.strokeWidth;zi(a,b,G.stroke,!1,!1,f,g);b.beginPath();for(O=G=Math.floor(-n.y/d);O<=G+m;O++)X=O*d+n.y,0<=X&&X<=k&&bn(O,y,B)&&(b.moveTo(0,X),b.lineTo(h,X));b.stroke()}else if("BarV"===G.figure&&null!==G.fill)for(zi(a,b,G.fill,!0,!1,f,g),G=G.width,isNaN(G)&&(G=e),X=O=Math.floor(-n.x/e);X<=O+l;X++){var Q=X*e+n.x;0<=Q&&Q<=h&&bn(X,y,B)&&b.fillRect(Q,0,G,k)}else if("BarH"===G.figure&&null!==G.fill)for(zi(a,b,G.fill,!0,!1,f,g),G=G.height,isNaN(G)&& (G=d),X=O=Math.floor(-n.y/d);X<=O+m;X++)Q=X*d+n.y,0<=Q&&Q<=k&&bn(X,y,B)&&b.fillRect(0,Q,h,G);D&&b.wt();1!==z&&(b.globalAlpha=x)}}b.restore();b.yc(!1)};function bn(a,b,c){if(0>b)return 0===a%b;if(0!==a%b)return!1;b=c.length;for(var d=0;d<b;d++)if(0===a%c[d])return!1;return!0}function cn(){this.name="Base"}la(cn,em); cn.prototype.measure=function(a,b,c,d,e){c=d.length;if(a instanceof Te||a instanceof R){var f=null,g=null,h=null;a instanceof R&&(g=f=a);a instanceof Te&&(h=a,f=h.adornedPart);if(f instanceof R){var k=f;if(0===c)gc(a.naturalBounds,0,0),a.measuredBounds.h(0,0,0,0);else{var l=a instanceof Te?null:f.path,m=f.routeBounds;b=a.Eg;b.h(0,0,m.width,m.height);var n=k.points;f=f.pointsCount;null!==h?h.Ak(!1):null!==g&&g.Ak(!1);var p=m.width,r=m.height;a.location.h(m.x,m.y);a.l.length=0;null!==l&&(dn(a,p,r,l), h=l.measuredBounds,b.Nc(h),a.l.push(h));h=Ib.alloc();for(var q=J.alloc(),u=J.alloc(),x=0;x<c;x++){var y=d[x];if(y!==l)if(y.isPanelMain&&y instanceof Yf){dn(a,p,r,y);var z=y.measuredBounds;b.Nc(z);a.l.push(z)}else if(2>f)y.measure(Infinity,Infinity,0,0),z=y.measuredBounds,b.Nc(z),a.l.push(z);else{var B=y.segmentIndex,D=y.segmentFraction,G=y.alignmentFocus;G.Sb()&&(G=Mc);var O=y.segmentOrientation,X=y.segmentOffset;if(isNaN(B)){var Q=k.qa;z=La();Q.Tv(D,z);var ca=J.allocAt(z[0],z[1]);ca.add(k.i(0)); Q.type===Id?ca.offset(-Q.startX,-Q.startY):(Q=Q.figures.first(),ca.offset(-Q.startX,-Q.startY));Q=z[2];if(O!==og){var Y=k.computeAngle(y,O,Q);y.dc=Y}Y=ca.x-m.x;var oa=ca.y-m.y;J.free(ca);Oa(z)}else if(B<-f||B>=f)oa=k.midPoint,Q=k.midAngle,O!==og&&(Y=k.computeAngle(y,O,Q),y.dc=Y),Y=oa.x-m.x,oa=oa.y-m.y;else{Y=0;0<=B?(oa=n.O(B),z=B<f-1?n.O(B+1):oa):(Y=f+B,oa=n.O(Y),z=0<Y?n.O(Y-1):oa);if(oa.Sa(z)){0<=B?(Q=0<B?n.O(B-1):oa,Y=B<f-2?n.O(B+2):z):(Q=Y<f-1?n.O(Y+1):oa,Y=1<Y?n.O(Y-2):z);ca=Q.Pe(oa);var Da=z.Pe(Y); Q=ca>Da+10?0<=B?Q.Xa(oa):oa.Xa(Q):Da>ca+10?0<=B?z.Xa(Y):Y.Xa(z):0<=B?Q.Xa(Y):Y.Xa(Q)}else Q=0<=B?oa.Xa(z):z.Xa(oa);O!==og&&(Y=k.computeAngle(y,O,Q),y.dc=Y);Y=oa.x+(z.x-oa.x)*D-m.x;oa=oa.y+(z.y-oa.y)*D-m.y}y.measure(Infinity,Infinity,0,0);z=y.measuredBounds;ca=y.naturalBounds;var V=0;y instanceof Yf&&(V=y.strokeWidth);Da=ca.width+V;var Ma=ca.height+V;h.reset();h.translate(-z.x,-z.y);h.scale(y.scale,y.scale);h.rotate(O===og?y.angle:Q,Da/2,Ma/2);O!==en&&O!==fn||h.rotate(90,Da/2,Ma/2);O!==gn&&O!==hn|| h.rotate(-90,Da/2,Ma/2);O===jn&&(45<Q&&135>Q||225<Q&&315>Q)&&h.rotate(-Q,Da/2,Ma/2);ca=new L(0,0,Da,Ma);q.pj(ca,G);h.xa(q);G=-q.x+V/2*y.scale;y=-q.y+V/2*y.scale;u.assign(X);V=isNaN(X.x);var Va=isNaN(X.y);if(V||Va){Da=Da/2+3;Ma=Ma/2+3;var xb=45<=Q&&135>=Q,Ta=225<=Q&&315>=Q;O===og&&(xb||Ta)?(u.x=Va?Da:X.y,u.y=V?Ma:X.x,xb?0<=B||isNaN(B)&&.5>D||!V||(u.y=-Ma):Ta&&((0<=B||isNaN(B)&&.5>D)&&V&&(u.y=-Ma),Va&&(u.x=-Da))):(V&&(u.x=0<=B||isNaN(B)&&.5>D?Da:-Da),Va&&(u.y=-Ma),u.rotate(Q))}else u.rotate(Q);Y+=u.x; oa+=u.y;ca.set(z);ca.h(Y+G,oa+y,z.width,z.height);a.l.push(ca);b.Nc(ca)}}if(null!==g)for(d=g.labelNodes;d.next();)d.value.measure(Infinity,Infinity);a.Eg=b;a=a.location;a.h(a.x+b.x,a.y+b.y);gc(e,b.width||0,b.height||0);Ib.free(h);J.free(q);J.free(u)}}}}; cn.prototype.arrange=function(a,b){var c=b.length;if(a instanceof Te||a instanceof R){var d=null,e=null,f=null;a instanceof R&&(e=d=a);a instanceof Te&&(f=a,d=f.adornedPart);var g=a instanceof Te?null:d.path;if(0!==a.l.length){var h=a.l,k=0;if(null!==g&&k<a.l.length){var l=h[k];k++;g.arrange(l.x-a.Eg.x,l.y-a.Eg.y,l.width,l.height)}for(l=0;l<c;l++){var m=b[l];if(m!==g&&k<a.l.length){var n=h[k];k++;m.arrange(n.x-a.Eg.x,n.y-a.Eg.y,n.width,n.height)}}}b=d.points;c=b.count;if(2<=c&&a instanceof R)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.qa;var q=La();n.Tv(k,q);var u=J.allocAt(q[0],q[1]);u.add(p.i(0));n.type===Id?u.offset(-n.startX,-n.startY):(n=n.figures.first(),u.offset(-n.startX,-n.startY));n=q[2];l!==og&&(p=p.computeAngle(g,l,n),g.angle=p);p=u.x;var x=u.y;J.free(u);Oa(q)}else if(h<-c||h>=c)x=p.midPoint,n=p.midAngle,l!==og&&(p=p.computeAngle(g,l,n),g.angle=p),p=x.x,x=x.y; else{u=0;0<=h?(q=b.j[h],x=h<c-1?b.j[h+1]:q):(u=c+h,q=b.j[u],x=0<u?b.j[u-1]:q);if(q.Sa(x)){0<=h?(n=0<h?b.j[h-1]:q,u=h<c-2?b.j[h+2]:x):(n=u<c-1?b.j[u+1]:q,u=1<u?b.j[u-2]:x);var y=n.Pe(q),z=x.Pe(u);n=y>z+10?0<=h?n.Xa(q):q.Xa(n):z>y+10?0<=h?x.Xa(u):u.Xa(x):0<=h?n.Xa(u):u.Xa(n)}else n=0<=h?q.Xa(x):x.Xa(q);l!==og&&(p=p.computeAngle(g,l,n),g.angle=p);p=q.x+(x.x-q.x)*k;x=q.y+(x.y-q.y)*k}if(r.Kq())g.location=new J(p,x);else{r.Sb()&&(r=Mc);q=Ib.alloc();q.reset();q.scale(g.scale,g.scale);q.rotate(g.angle,0, 0);var B=g.naturalBounds;u=L.allocAt(0,0,B.width,B.height);y=J.alloc();y.pj(u,r);q.xa(y);r=-y.x;z=-y.y;var D=B.width,G=B.height;B=J.alloc();B.assign(m);var O=isNaN(m.x),X=isNaN(m.y);if(O||X){D=D/2+3;G=G/2+3;var Q=45<=n&&135>=n,ca=225<=n&&315>=n;l===og&&(Q||ca)?(B.x=X?D:m.y,B.y=O?G:m.x,Q?0<=h||isNaN(h)&&.5>k||!O||(B.y=-G):ca&&((0<=h||isNaN(h)&&.5>k)&&O&&(B.y=-G),X&&(B.x=-D))):(O&&(B.x=0<=h||isNaN(h)&&.5>k?D:-D),X&&(B.y=-G),B.rotate(n))}else B.rotate(n);p+=B.x;x+=B.y;q.Iw(u);r+=u.x;z+=u.y;h=J.allocAt(p+ r,x+z);g.move(h);J.free(h);J.free(B);J.free(y);L.free(u);Ib.free(q)}}null!==f?f.Ak(!1):null!==e&&e.Ak(!1)}}; function dn(a,b,c,d){if(!1!==Hj(d)){var e=d.strokeWidth;0===e&&a instanceof Te&&a.type===U.Link&&a.adornedObject instanceof Yf&&(e=a.adornedObject.strokeWidth);e*=d.Fa;a instanceof R&&null!==a.qa?(a=a.qa.bounds,yl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):a instanceof Te&&null!==a.adornedPart.qa?(a=a.adornedPart.qa.bounds,yl(d,a.x-e/2,a.y-e/2,a.width+e,a.height+e)):yl(d,-(e/2),-(e/2),b+e,c+e);Cj(d,!1)}}function kn(){this.name="Base"}la(kn,em); kn.prototype.measure=function(a,b,c,d,e,f,g){var h=a.Fb();a.ih=[];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 L(-k.left,-k.top,Math.max(n.width+l,0),Math.max(n.height+m,0));a.ih.push(p);e.assign(p);for(var r=h.geometry,q=h.strokeWidth,u=r.flattenedSegments,x=r.flattenedLengths,y=r.flattenedTotalLength,z=u.length,B=0,D=0,G=La(),O=0;O<z;O++){var X=u[O],Q=[];D=B=0;for(var ca=X.length,Y=0;Y<ca;Y+=2){var oa=X[Y],Da=X[Y+1];if(0!==Y){var V=180*Math.atan2(Da- D,oa-B)/Math.PI;0>V&&(V+=360);Q.push(V)}B=oa;D=Da}G.push(Q)}if(null===a.jh){for(var Ma=[],Va=a.Z.j,xb=Va.length,Ta=0;Ta<xb;Ta++){var Ob=Va[Ta],Nd=[];Ma.push(Nd);if(Ob.visible){var yb=Ob.interval;if(!(0>yb))for(var oc=0;oc<xb;oc++)if(oc!==Ta){var qb=Va[oc];if(qb.visible&&Ob.constructor===qb.constructor){var $d=qb.interval;$d>yb&&Nd.push($d)}}}}a.jh=Ma}var Kc=a.jh;var Mf=a.Z.j,of=Mf.length,Ve=0,Hh=0,Qc=y;a.Gj=[];for(var Nf,pf=0;pf<of;pf++){var ae=Mf[pf];Nf=[];if(ae.visible&&ae!==h){var ok=Math.abs(ae.interval), Yb=a.graduatedTickUnit;if(!(2>Yb*ok*y/a.graduatedRange)){var Of=x[0][0],Od=0,zc=0;Hh=y*ae.graduatedStart-1E-4;Qc=y*ae.graduatedEnd+1E-4;var qf=Yb*ok,hd=a.graduatedTickBase;if(hd<a.graduatedMin){var wg=(a.graduatedMin-hd)/qf;wg=0===wg%1?wg:Math.floor(wg+1);hd+=wg*qf}else hd>a.graduatedMin+qf&&(hd-=Math.floor((hd-a.graduatedMin)/qf)*qf);for(var Ih=Kc[pf];hd<=a.graduatedMax;){a:{for(var In=Ih.length,xg=0;xg<In;xg++)if(K.ca((hd-a.graduatedTickBase)%(Ih[xg]*a.graduatedTickUnit),0)){var pk=!1;break a}pk= !0}if(pk&&(null===ae.graduatedSkip||!ae.graduatedSkip(hd))&&(Ve=(hd-a.graduatedMin)*y/a.graduatedRange,Ve>y&&(Ve=y),Hh<=Ve&&Ve<=Qc)){for(var pc=G[Od][zc],$c=x[Od][zc];Od<x.length;){for(;Ve>Of&&zc<x[Od].length-1;)zc++,pc=G[Od][zc],$c=x[Od][zc],Of+=$c;if(Ve<=Of)break;Od++;zc=0;pc=G[Od][zc];$c=x[Od][zc];Of+=$c}var tc=u[Od],yg=tc[2*zc],Jh=tc[2*zc+1],rf=(Ve-(Of-$c))/$c,Si=new J(yg+(tc[2*zc+2]-yg)*rf+q/2-r.bounds.x,Jh+(tc[2*zc+3]-Jh)*rf+q/2-r.bounds.y);Si.scale(h.scale,h.scale);var xe=pc,We=G[Od];1E-4> rf?0<zc?xe=We[zc-1]:K.ca(tc[0],tc[tc.length-2])&&K.ca(tc[1],tc[tc.length-1])&&(xe=We[We.length-1]):.9999<rf&&(zc+1<We.length?xe=We[zc+1]:K.ca(tc[0],tc[tc.length-2])&&K.ca(tc[1],tc[tc.length-1])&&(xe=We[0]));pc!==xe&&(180<Math.abs(pc-xe)&&(pc<xe?pc+=360:xe+=360),pc=(pc+xe)/2%360);if(ae instanceof ih){var Ac="";null!==ae.graduatedFunction?(Ac=ae.graduatedFunction(hd),Ac=null!==Ac&&void 0!==Ac?Ac.toString():""):Ac=(+hd.toFixed(2)).toString();""!==Ac&&Nf.push({Mm:Si,angle:pc,text:Ac})}else Nf.push({Mm:Si, angle:pc})}hd+=qf}}}a.Gj.push(Nf)}Oa(G);var qk=a.Gj;if(null!==qk)for(var Jn=d.length,zg=0;zg<Jn;zg++){var Pb=d[zg],Ag=qk[zg];if(Pb.visible&&Pb!==h&&0!==Ag.length){if(Pb instanceof Yf){var rk=a,Ti=e,Bg=Pb.alignmentFocus;Bg.Sb()&&(Bg=Ic);var Pf=Pb.angle;Pb.dc=0;Pb.measure(Infinity,Infinity,0,0);Pb.dc=Pf;var rb=Pb.measuredBounds,Cg=rb.width,Bc=rb.height,Rc=L.allocAt(0,0,Cg,Bc),sb=J.alloc();sb.pj(Rc,Bg);L.free(Rc);for(var Pd=-sb.x,Qd=-sb.y,be=new L,Kn=Ag.length,Kh=0;Kh<Kn;Kh++)for(var Lh=Ag[Kh],Mh=Lh.Mm.x, Nh=Lh.Mm.y,Dg=Lh.angle,Rd=0;4>Rd;Rd++){switch(Rd){case 0:sb.h(Pd,Qd);break;case 1:sb.h(Pd+Cg,Qd);break;case 2:sb.h(Pd,Qd+Bc);break;case 3:sb.h(Pd+Cg,Qd+Bc)}sb.rotate(Dg+Pb.angle);sb.offset(Mh,Nh);0===Kh&&0===Rd?be.h(sb.x,sb.y,0,0):be.Ve(sb);sb.offset(-Mh,-Nh);sb.rotate(-Dg-Pb.angle)}J.free(sb);null!==rk.ih&&rk.ih.push(be);qc(Ti,be.x,be.y,be.width,be.height)}else if(Pb instanceof ih){var id=a,ye=e;null===id.Dh&&(id.Dh=new ih);var Qb=id.Dh;ln(Qb,Pb);var Ui=Pb.alignmentFocus;Ui.Sb()&&(Ui=Ic);for(var jd= Pb.segmentOrientation,Ln=Pb.segmentOffset,ze=new L,ab=0,Sd=0,Cc=0,Ae=0,Be=0,Oh=Ag.length,Ph=0;Ph<Oh;Ph++){var ce=Ag[Ph];ab=ce.Mm.x;Sd=ce.Mm.y;Cc=ce.angle;Be=Ae=Pb.angle;jd!==og&&(Be=jd===mn||jd===nn?Cc+Pb.angle:Cc,Ae=R.computeAngle(jd,Be));Qb.dc=Ae;Qb.text=ce.text||"";Qb.measure(Infinity,Infinity,0,0);var Ce=Qb.measuredBounds,Xe=Qb.naturalBounds,Ye=Xe.width,De=Xe.height,Bd=Ib.alloc();Bd.reset();Bd.translate(-Ce.x,-Ce.y);Bd.scale(Qb.scale,Qb.scale);Bd.rotate(Be,Ye/2,De/2);jd!==en&&jd!==fn||Bd.rotate(90, Ye/2,De/2);jd!==gn&&jd!==hn||Bd.rotate(-90,Ye/2,De/2);jd===jn&&(45<Cc&&135>Cc||225<Cc&&315>Cc)&&Bd.rotate(-Cc,Ye/2,De/2);var Qf=L.allocAt(0,0,Ye,De),Eg=J.alloc();Eg.pj(Qf,Ui);Bd.xa(Eg);var Mn=-Eg.x,Qh=-Eg.y,Td=J.alloc();Td.assign(Ln);isNaN(Td.x)&&(Td.x=Ye/2+3);isNaN(Td.y)&&(Td.y=-(De/2+3));Td.rotate(Cc);ab+=Td.x+Mn;Sd+=Td.y+Qh;var Fg=new L(ab,Sd,Ce.width,Ce.height),Rh=new L(Ce.x,Ce.y,Ce.width,Ce.height),Sh=new L(Xe.x,Xe.y,Xe.width,Xe.height);ce.uA=Ae;ce.lineCount=Qb.lineCount;ce.lines=[Qb.vb,Qb.Ei, Qb.se,Qb.Ge,Qb.Wb,Qb.nb,Qb.qe];ce.actualBounds=Fg;ce.measuredBounds=Rh;ce.naturalBounds=Sh;0===Ph?ze.assign(Fg):ze.Nc(Fg);J.free(Td);J.free(Eg);L.free(Qf);Ib.free(Bd)}null!==id.ih&&id.ih.push(ze);qc(ye,ze.x,ze.y,ze.width,ze.height)}Cj(Pb,!1)}}}; kn.prototype.arrange=function(a,b,c){if(null!==a.ih){var d=a.Fb(),e=a.Gj;if(null!==e){var f=a.ih,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.ih=null}}}; kn.prototype.hc=function(a,b,c){var d=c.zi;c.zi=!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.Fb();f.hc(b,c);e=a.Gf()*c.scale;0>=e&&(e=1);for(var g=f.actualBounds,h=a.Z.j,k=a.Gj,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 Yf){if(!(2>a.graduatedTickUnit*n.interval*f.geometry.flattenedTotalLength/a.graduatedRange*e)){var q=n.measuredBounds,u=n.strokeWidth*n.scale,x=n.alignmentFocus;x.Sb()&& (x=Ic);for(var y=0;y<r;y++){var z=p[y].Mm,B=p[y].angle,D=x,G=n.sb;G.reset();G.translate(z.x+g.x,z.y+g.y);G.rotate(B+n.angle,0,0);G.translate(-q.width*D.x+D.offsetX+u/2,-q.height*D.y+D.offsetY+u/2);G.scale(n.scale,n.scale);Rl(n,!1);n.ai.set(n.sb);n.il=n.scale;Sl(n,!1);n.hc(b,c);n.sb.reset()}}}else if(n instanceof ih)for(null===a.Dh&&(a.Dh=new ih),q=a.Dh,ln(q,n),n=0;n<r;n++)u=p[n],u.actualBounds&&u.measuredBounds&&u.naturalBounds&&(q.Zb=u.text||"",q.dc=u.uA||0,q.Uc=u.lineCount||0,x=u.lines,void 0!== x&&(q.vb=x[0],q.Ei=x[1],q.se=x[2],q.Ge=x[3],q.Wb=x[4],q.nb=x[5],q.qe=x[6]),u.naturalBounds&&(q.tc=u.naturalBounds),u.actualBounds&&(x=u.actualBounds,q.arrange(x.x,x.y,x.width,x.height)),x=u.actualBounds,q.arrange(x.x,x.y,x.width,x.height),y=u.measuredBounds,u=u.naturalBounds,z=q.sb,z.reset(),z.translate(x.x+g.x,x.y+g.y),z.translate(-y.x,-y.y),zl(q,z,u.x,u.y,u.width,u.height),Rl(q,!1),q.ai.set(q.sb),q.il=q.scale,Sl(q,!1),q.hc(b,c))}c.zi=d;b.restore();b.yc(!0)}; function U(a){N.call(this);void 0===a?this.ta=U.Position:(w(a,em,U,"type"),this.ta=a);null===this.ta&&v("Panel type not specified or PanelLayout not loaded: "+a);this.Z=new H;this.lb=Ec;this.ta===U.Grid&&(this.isAtomic=!0);this.Jn=ld;this.Zf=ll;this.ta===U.Table&&on(this);this.oq=Og;this.jo=ac;this.ko=Rb;this.fo=0;this.eo=100;this.io=10;this.ho=0;this.ni=this.pb=this.jh=this.ih=this.Gj=null;this.yo=NaN;this.xe=this.Di=null;this.Dl="category";this.Rd=null;this.Eg=new L(NaN,NaN,NaN,NaN);this.Dh=this.Ip= this.Si=null;this.Sg=""}la(U,N);function on(a){a.zj=Ec;a.$g=1;a.ui=null;a.ti=null;a.Zg=1;a.Yg=null;a.si=null;a.xb=[];a.tb=[];a.Yj=pn;a.wj=pn;a.Vi=0;a.Gi=0} U.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.ta=this.ta;a.lb=this.lb.J();a.Jn=this.Jn.J();a.Zf=this.Zf;if(a.ta===U.Table){a.zj=this.zj.J();a.$g=this.$g;a.ui=this.ui;a.ti=this.ti;a.Zg=this.Zg;a.Yg=this.Yg;a.si=this.si;var b=[];if(0<this.xb.length)for(var c=this.xb,d=c.length,e=0;e<d;e++)if(void 0!==c[e]){var f=c[e].copy();f.oj(a);b[e]=f}a.xb=b;b=[];if(0<this.tb.length)for(c=this.tb,d=c.length,e=0;e<d;e++)void 0!==c[e]&&(f=c[e].copy(),f.oj(a),b[e]=f);a.tb=b;a.Yj= this.Yj;a.wj=this.wj;a.Vi=this.Vi;a.Gi=this.Gi}a.oq=this.oq;a.jo=this.jo.J();a.ko=this.ko.J();a.fo=this.fo;a.eo=this.eo;a.io=this.io;a.ho=this.ho;a.Gj=this.Gj;a.jh=this.jh;a.pb=this.pb;a.ni=this.ni;a.yo=this.yo;a.Di=this.Di;a.xe=this.xe;a.Dl=this.Dl;a.Eg.assign(this.Eg);a.Sg=this.Sg;null!==this.Ip&&(a.Ip=this.Ip)};U.prototype.Ef=function(a){N.prototype.Ef.call(this,a);a.Z=this.Z;for(var b=a.Z.j,c=b.length,d=0;d<c;d++)b[d].wg=a;a.Si=null}; U.prototype.copy=function(){var a=N.prototype.copy.call(this);if(null!==a){for(var b=this.Z.j,c=b.length,d=0;d<c;d++){var e=b[d].copy();e.oj(a);e.Vj=null;var f=a.Z,g=f.count;f.yb(g,e);f=a.part;if(null!==f){f.Rj=null;null!==e.portId&&f instanceof T&&(f.Qh=!0);var h=a.diagram;null!==h&&h.undoManager.isUndoingRedoing||f.gb(Je,"elements",a,null,e,null,g)}}return a}return null};t=U.prototype;t.toString=function(){return"Panel("+this.type+")#"+pb(this)}; t.jp=function(a){N.prototype.jp.call(this,a);for(var b=this.Z.j,c=b.length,d=0;d<c;d++)b[d].jp(a)}; t.aj=function(a,b){if(this.ta===U.Grid)this.ta.hc(this,a,b);else if(this.ta===U.Graduated)this.ta.hc(this,a,b);else{this.ta===U.Table&&(a.lineCap="butt",qn(this,a,!0,this.xb,!0),qn(this,a,!1,this.tb,!0),rn(this,a,!0,this.xb),rn(this,a,!1,this.tb),qn(this,a,!0,this.xb,!1),qn(this,a,!1,this.tb,!1));var c=this.isClipping&&this.ta===U.Spot;c&&a.save();for(var d=this.Fb(),e=this.Z.j,f=e.length,g=0;g<f;g++){var h=e[g];c&&h===d&&(a.clipInsteadOfFill=!0);h.hc(a,b);c&&h===d&&(a.clipInsteadOfFill=!1)}c&&(a.restore(), a.yc(!0))}}; function rn(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.$g:a.Zg);var n=l.separatorStroke;null===n&&(n=c?a.ui:a.Yg);if(0!==m&&null!==n){zi(a,b,n,!1,!1,g,f);n=!1;var p=l.separatorDashArray;null===p&&(p=c?a.ti:a.si);null!==p&&(n=!0,b.yt(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.lb;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.wt()}}}} function qn(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.Ac(),p=l.separatorStrokeWidth;isNaN(p)&&(p=c?a.$g:a.Zg);var r=l.separatorStroke;null===r&&(r=c?a.ui:a.Yg);null===r&&(p=0);n-=p;p=l.position+p;n+=l.actual;p+n>m&&(n=m-p);0>=n||(m=a.lb,zi(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 kk(a){return"LineV"===a||"BarV"===a} t.uk=function(a,b,c,d,e){var f=this.je(),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.bd(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.bd(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.Z.j;r=n.length;m=J.alloc();p=null;b=Infinity;var q=null,u=this.isClipping&&this.ta===U.Spot;u&&(q=J.alloc(),p=this.Fb(),(l=p.uk(h,a,k,c,q))&&(b=(h-q.x)*(h-q.x)+(a-q.y)*(a-q.y)));for(var x=0;x<r;x++){var y=n[x];y.visible&&y!==p&&y.uk(h,a,k,c,m)&&(l=!0,y=(h-m.x)*(h-m.x)+(a-m.y)*(a-m.y),y<d&&(d=y,e.set(m)))}u&&(b>d&&e.set(q),J.free(q));J.free(m);f&&e.transform(g);return l}; t.u=function(a){if(!0!==Hj(this)){N.prototype.u.call(this,a);a=null;if(this.ta===U.Auto||this.ta===U.Link)a=this.Fb();for(var b=this.Z.j,c=b.length,d=0;d<c;d++){var e=b[d];(e===a||e.isPanelMain)&&e.u(!0);if(!e.desiredSize.o()){var f=Bl(e,!1);(e instanceof Kg||e instanceof U||e instanceof ih||f!==Mg)&&e.u(!0)}}}};t.Cm=function(){if(!1===Hj(this)){Cj(this,!0);Cl(this,!0);for(var a=this.Z.j,b=a.length,c=0;c<b;c++)a[c].Cm()}}; t.zl=function(){if(0!==(this.I&2048)===!1){Rl(this,!0);Sl(this,!0);for(var a=this.Z.j,b=a.length,c=0;c<b;c++)a[c].Zv()}};t.Zv=function(){Sl(this,!0);for(var a=this.Z.j,b=a.length,c=0;c<b;c++)a[c].Zv()}; t.Gm=function(a,b,c,d){var e=this.Eg;e.h(0,0,0,0);var f=this.desiredSize,g=this.minSize;void 0===c&&(c=g.width,d=g.height);c=Math.max(c,g.width);d=Math.max(d,g.height);var h=this.maxSize;isNaN(f.width)||(a=Math.min(f.width,h.width));isNaN(f.height)||(b=Math.min(f.height,h.height));a=Math.max(c,a);b=Math.max(d,b);var k=this.lb;a=Math.max(a-k.left-k.right,0);b=Math.max(b-k.top-k.bottom,0);var l=this.Z.j;0!==l.length&&this.ta.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);gc(e,a,k);gc(this.naturalBounds,a,k);yl(this,0,0,a,k)};t.Fb=function(){if(null===this.Si){var a=this.Z.j,b=a.length;if(0===b)return null;for(var c=0;c<b;c++){var d=a[c];if(!0===d.isPanelMain)return this.Si=d}this.Si=a[0]}return this.Si};function Om(a){return null!==a.part?a.part.locationObject:null} t.Nh=function(a,b,c,d){var e=this.Z.j;this.actualBounds.h(a,b,c,d);if(0!==e.length){if(!this.desiredSize.o()){a=Bl(this,!0);var f=this.measuredBounds;b=f.width;f=f.height;var g=this.oh,h=g.left+g.right;g=g.top+g.bottom;b===c&&f===d&&(a=Mg);switch(a){case Mg:if(b>c||f>d)this.u(),this.measure(b>c?c:b,f>d?d:f,0,0);break;case Hd:this.u(!0);this.measure(c+h,d+g,0,0);break;case ml:this.u(!0);this.measure(c+h,f+g,0,0);break;case nl:this.u(!0),this.measure(b+h,d+g,0,0)}}this.ta.arrange(this,e,this.Eg)}}; t.Ph=function(a){var b=this.naturalBounds,c=Om(this);if(rc(0,0,b.width,b.height,a.x,a.y)){b=this.Z.j;for(var d=b.length,e=J.allocAt(0,0);d--;){var f=b[d];if(f.visible||f===c)if(Jb(e.set(a),f.transform),f.fa(e))return J.free(e),!0}J.free(e);return null===this.ob&&null===this.jc?!1:!0}return!1};t.zt=function(a){if(this.Wk===a)return this;for(var b=this.Z.j,c=b.length,d=0;d<c;d++){var e=b[d].zt(a);if(null!==e)return e}return null}; t.Lk=function(a,b){b(this,a);if(a instanceof U){a=a.Z.j;for(var c=a.length,d=0;d<c;d++)this.Lk(a[d],b)}};function Uj(a,b){sn(a,a,b)}function sn(a,b,c){c(b);b=b.Z.j;for(var d=b.length,e=0;e<d;e++){var f=b[e];f instanceof U&&sn(a,f,c)}}function tn(a,b){un(a,a,b)}function un(a,b,c){c(b);if(b instanceof U){b=b.Z.j;for(var d=b.length,e=0;e<d;e++)un(a,b[e],c)}}t.vm=function(a){return vn(this,this,a)}; function vn(a,b,c){if(c(b))return b;if(b instanceof U){b=b.Z.j;for(var d=b.length,e=0;e<d;e++){var f=vn(a,b[e],c);if(null!==f)return f}}return null}t.fb=function(a){if(this.name===a)return this;var b=this.Z.j,c=b.length;null===this.Di&&null===this.xe||(c=wn(this));for(var d=0;d<c;d++){var e=b[d];if(e instanceof U){var f=e.fb(a);if(null!==f)return f}if(e.name===a)return e}return null}; function xn(a){a=a.Z.j;for(var b=a.length,c=0,d=0;d<b;d++){var e=a[d];e instanceof U?c=Math.max(c,xn(e)):e instanceof Yf&&(c=Math.max(c,e.Bh/2*e.$j*e.Gf()))}return c}t.je=function(){return!(this.type===U.TableRow||this.type===U.TableColumn)}; t.$b=function(a,b,c){if(!1===this.pickable)return null;void 0===b&&(b=null);void 0===c&&(c=null);if(Ij(this))return null;var d=this.naturalBounds,e=1/this.Gf(),f=this.je(),g=f?a:Jb(J.allocAt(a.x,a.y),this.transform),h=this.diagram,k=10,l=5;null!==h&&(k=h.Am("extraTouchArea"),l=k/2);if(rc(-(l*e),-(l*e),d.width+k*e,d.height+k*e,g.x,g.y)){if(!this.isAtomic){e=this.Z.j;var m=e.length;h=J.alloc();l=(k=this.isClipping&&this.ta===U.Spot)?this.Fb():null;if(k&&(l.je()?Jb(h.set(a),l.transform):h.set(a),!l.fa(h)))return J.free(h), f||J.free(g),null;for(var n=Om(this);m--;){var p=e[m];if(p.visible||p===n)if(p.je()?Jb(h.set(a),p.transform):h.set(a),!k||p!==l){var r=null;p instanceof U?r=p.$b(h,b,c):!0===p.pickable&&p.fa(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=rc(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.dj=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.je(),g=f?a:Jb(J.allocAt(a.x,a.y),this.transform),h=this.type===U.TableRow||this.type===U.TableColumn;e=rc(0,0,e.width,e.height,g.x,g.y);if(h||e){if(!this.isAtomic){h=this.Z.j;for(var k=h.length,l=J.alloc(),m=Om(this);k--;){var n=h[k];if(n.visible||n===m){n.je()?Jb(l.set(a),n.transform):l.set(a);var p=n;n=n instanceof U?n:null;(null!==n?n.dj(l,b,c,d):p.fa(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.Ff=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=Ib.alloc(),g.reset());g.multiply(this.transform);if(this.Oh(a,g))return yn(this,b,c,e),void 0===f&&Ib.free(g),!0;if(this.Mc(a,g)){if(!this.isAtomic)for(var h=Om(this),k=this.Z.j,l=k.length;l--;){var m=k[l];if(m.visible||m===h){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=m;m=m instanceof U?m:null;p=Ib.alloc();p.set(g); if(null!==m?m.Ff(a,b,c,d,e,p):Al(n,a,d,p))null!==b&&(n=b(n)),null===n||null!==c&&!c(n)||e.add(n);Ib.free(p)}}}void 0===f&&Ib.free(g);return d}void 0===f&&Ib.free(g);return!1};function yn(a,b,c,d){for(var e=a.Z.j,f=e.length;f--;){var g=e[f];if(g.visible){var h=g.actualBounds,k=a.naturalBounds;h.x>k.width||h.y>k.height||0>h.x+h.width||0>h.y+h.height||(g instanceof U&&yn(g,b,c,d),null!==b&&(g=b(g)),null===g||null!==c&&!c(g)||d.add(g))}}} t.Jg=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.je(),k=h?a:Jb(J.allocAt(a.x,a.y),this.transform),l=h?b:Jb(J.allocAt(b.x,b.y),this.transform),m=k.Pe(l),n=0<k.x&&k.x<g.width&&0<k.y&&k.y<g.height||Kb(k.x,k.y,0,0,0,g.height)<=m||Kb(k.x,k.y,0,g.height,g.width,g.height)<=m||Kb(k.x,k.y,g.width,g.height,g.width,0)<=m||Kb(k.x,k.y,g.width,0,0,0)<=m;g=k.kd(0,0)<=m&&k.kd(0,g.height)<=m&&k.kd(g.width,0)<=m&&k.kd(g.width,g.height)<= m;h||(J.free(k),J.free(l));if(n){if(!this.isAtomic){k=J.alloc();l=J.alloc();m=Om(this);for(var p=this.Z.j,r=p.length;r--;){var q=p[r];if(q.visible||q===m){var u=q.actualBounds,x=this.naturalBounds;if(!h||!(u.x>x.width||u.y>x.height||0>u.x+u.width||0>u.y+u.height))if(q.je()?(u=q.transform,Jb(k.set(a),u),Jb(l.set(b),u)):(k.set(a),l.set(b)),u=q,q=q instanceof U?q:null,null!==q?q.Jg(k,l,c,d,e,f):u.gy(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 Tm(a){var b=null;a instanceof Yf&&(b=a.spot1,b===ld&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot1));null===b&&(b=Hc);return b}function Um(a){var b=null;a instanceof Yf&&(b=a.spot2,b===ld&&(b=null),a=a.geometry,null!==a&&null===b&&(b=a.spot2));null===b&&(b=Sc);return b}t.add=function(a){w(a,N,U,"add:element");this.yb(this.Z.count,a)};t.O=function(a){return this.Z.O(a)}; t.yb=function(a,b){b instanceof S&&v("Cannot add a Part to a Panel: "+b+"; use a Panel instead");if(this===b||this.Mg(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.ta!==U.Grid||b instanceof Yf||v("Can only add Shapes to a Grid Panel, not: "+b);this.ta!==U.Graduated||b instanceof Yf||b instanceof ih||v("Can only add Shapes or TextBlocks to a Graduated Panel, not: "+b);b.oj(this);b.Vj=null;if(null!==this.itemArray){var d=b.data;null!==d&&"object"===typeof d&&(null===this.Rd&&(this.Rd=new Db),this.Rd.add(d,b))}var e=this.Z;d=-1;if(c===this){for(var f=-1,g=this.Z.j,h=g.length,k=0;k<h;k++)if(g[k]===b){f=k;break}if(-1!==f){if(f===a||f+1>=e.count&&a>=e.count)return; e.hb(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.yb(a,b);if(0===a||b.isPanelMain)this.Si=null;Hj(this)||this.u();b.u(!1);null!==b.portId?this.Qh=!0:b instanceof U&&!0===b.Qh&&(this.Qh=!0);this.jh=null;c=this.part;null!==c&&(c.Rj=null,c.ph=NaN,this.Qh&&c instanceof T&&(c.Qh=!0),c.Qh&&c instanceof T&&(c.xc=null),e=this.diagram,null!==e&&e.undoManager.isUndoingRedoing||(-1!==d&&c.gb(Ke,"elements",this,b,null,d,null),c.gb(Je, "elements",this,null,b,null,a),this.Ng()||zn(this,b,!1)))};function An(a,b){a.I=b?a.I|16777216:a.I&-16777217}t.remove=function(a){w(a,N,U,"remove:element");for(var b=this.Z.j,c=b.length,d=-1,e=0;e<c;e++)if(b[e]===a){d=e;break}-1!==d&&this.Lc(d,!0)};t.hb=function(a){F&&C(a,U,"removeAt:idx");0<=a&&this.Lc(a,!0)}; t.Lc=function(a,b){var c=this.Z,d=c.O(a);d.Vj=null;d.oj(null);if(null!==this.Rd){var e=d.data;"object"===typeof e&&this.Rd.remove(e)}c.hb(a);Cj(this,!1);this.u();this.Si===d&&(this.Si=null);this.jh=null;var f=this.part;null!==f&&(f.Rj=null,f.ph=NaN,f.Rb(),f instanceof T&&(d instanceof U?d.Lk(d,function(a,c){im(f,c,b)}):im(f,d,b)),c=this.diagram,null!==c&&c.undoManager.isUndoingRedoing||f.gb(Ke,"elements",this,d,null,a,null))}; U.prototype.getRowDefinition=function(a){F&&C(a,U,"getRowDefinition:idx");0>a&&ya(a,">= 0",U,"getRowDefinition:idx");a=Math.round(a);var b=this.xb;if(void 0===b)return null;if(void 0===b[a]){var c=new ik;c.oj(this);c.isRow=!0;c.index=a;b[a]=c}return b[a]};U.prototype.qw=function(a){F&&C(a,U,"removeRowDefinition:idx");0>a&&ya(a,">= 0",U,"removeRowDefinition:idx");a=Math.round(a);var b=this.xb;void 0!==b&&(this.gb(Ke,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.u())}; U.prototype.getColumnDefinition=function(a){F&&C(a,U,"getColumnDefinition:idx");0>a&&ya(a,">= 0",U,"getColumnDefinition:idx");a=Math.round(a);var b=this.tb;if(void 0===b)return null;if(void 0===b[a]){var c=new ik;c.oj(this);c.isRow=!1;c.index=a;b[a]=c}return b[a]};t=U.prototype;t.ow=function(a){F&&C(a,U,"removeColumnDefinition:idx");0>a&&ya(a,">= 0",U,"removeColumnDefinition:idx");a=Math.round(a);var b=this.tb;void 0!==b&&(this.gb(Ke,"coldefs",this,b[a],null,a,null),b[a]&&delete b[a],this.u())}; t.Oz=function(a){if(0>a||this.type!==U.Table)return-1;for(var b=0,c=this.xb,d=c.length,e=this.Vi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e};t.Gz=function(a){if(0>a||this.type!==U.Table)return-1;for(var b=0,c=this.tb,d=c.length,e=this.Gi;e<d;e++){var f=c[e];if(void 0!==f&&(b+=f.total,a<b))break}return e}; t.hA=function(a,b){void 0===b&&(b=new J(NaN,NaN));if(this.type!==U.Graduated)return b.h(NaN,NaN),b;a=Math.min(Math.max(a,this.graduatedMin),this.graduatedMax);var c=this.Fb();c.geometry.Sv((a-this.graduatedMin)/this.graduatedRange,b);return c.transform.xa(b)};t.iA=function(a){if(this.type!==U.Graduated)return NaN;var b=this.Fb();b.transform.de(a);return b.geometry.ky(a)*this.graduatedRange+this.graduatedMin};function Zl(a){a=a.ni;return null!==a&&a.s} function Lg(a){var b=a.ni;if(null===b)null!==a.data&&v("Template cannot have .data be non-null: "+a),a.ni=b=new H;else if(b.s)return;var c=new H;An(a,!1);a.Lk(a,function(a,d){var e=d.jb;if(null!==e)for(Wl(d,!1),e=e.iterator;e.next();){var f=e.value;f.mode===Bn&&Wl(d,!0);var g=f.sourceName;null!==g&&("/"===g&&An(a,!0),g=xl(f,a,d),null!==g&&(c.add(g),null===g.bm&&(g.bm=new H),g.bm.add(f)));b.add(f)}if(d instanceof U&&d.type===U.Table){if(0<d.xb.length)for(a=d.xb,e=a.length,f=0;f<e;f++)if(g=a[f],void 0!== g&&null!==g.jb)for(var h=g.jb.iterator;h.next();){var k=h.value;k.jd=g;k.gq=2;k.hm=g.index;b.add(k)}if(0<d.tb.length)for(d=d.tb,a=d.length,e=0;e<a;e++)if(f=d[e],void 0!==f&&null!==f.jb)for(g=f.jb.iterator;g.next();)h=g.value,h.jd=f,h.gq=1,h.hm=f.index,b.add(h)}});for(var d=c.iterator;d.next();){var e=d.value;if(null!==e.bm){Wl(e,!0);for(var f=e.bm.iterator;f.next();){var g=f.value;null===e.jb&&(e.jb=new H);e.jb.add(g)}}e.bm=null}for(var h=b.iterator;h.next();)if(d=h.value,e=d.jd,null!==e){d.jd=null; g=d.targetProperty;var k=g.indexOf(".");0<k&&e instanceof U&&(f=g.substring(0,k),g=g.substr(k+1),k=e.fb(f),null!==k?(e=k,d.targetProperty=g):Ca('Warning: unable to find GraphObject named "'+f+'" for Binding: '+d.toString()));e instanceof ik?(f=pb(e.panel),d.sj=void 0===f?-1:f,e.panel.Wk=d.sj):e instanceof N?(f=pb(e),d.sj=void 0===f?-1:f,e.Wk=d.sj):v("Unknown type of binding target: "+e)}b.freeze();a instanceof S&&(a.bc()&&a.Eb(),F&&!Cn&&a.Lk(a,function(a,c){if(c instanceof U&&(c.type===U.Auto||c.type=== U.Spot||c.type===U.Graduated)&&1>=c.elements.count&&!(c instanceof S)){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||(Ca("Auto, Spot, or Graduated Panel should not have zero or one elements: "+c.toString()+" in "+a.toString()),Cn=!0)}}))} t.qz=function(){var a=this.copy();tn(a,function(a){a instanceof U&&(a.ni=null,a.pb=null);var b=a.jb;null!==b&&(a.jb=null,b.each(function(b){a.bind(b.copy())}));b=a.Tg;null!==b&&(a.Tg=null,b.each(function(b){$l(a,b.value.copy())}))});return a}; t.Ga=function(a){var b=this.ni;if(null!==b)for(void 0===a&&(a=""),b=b.iterator;b.next();){var c=b.value,d=c.sourceProperty;if(""===a||""===d||d===a)if(d=c.targetProperty,null!==c.converter||""!==d){d=this.data;var e=c.sourceName;if(null!==e)d=""===e?this:"/"===e?this:"."===e?this:".."===e?this:this.fb(e);else{var f=this.diagram;null!==f&&c.isToModel&&(d=f.model.modelData)}if(null===d)F&&Ca("Binding error: missing GraphObject named "+e+" in "+this.toString());else{f=this;var g=c.sj;if(-1!==g){if(f= this.zt(g),null===f)continue}else null!==c.jd&&(f=c.jd);"/"===e?d=f.part:"."===e?d=f:".."===e&&(d=f.panel);e=c.gq;if(0!==e){if(!(f instanceof U))continue;1===e?f=f.getColumnDefinition(c.hm):2===e&&(f=f.getRowDefinition(c.hm))}void 0!==f&&c.Lw(f,d)}}}}; function Dn(a,b){a=a.Z.j;for(var c=a.length,d=b.length,e=0,f=null;e<c&&!(f=a[e],f instanceof U&&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 U)||f.data!==b[g])return!0;e++;g++}return!1} function wn(a){if(a.type===U.Spot||a.type===U.Auto)return Math.min(a.Z.length,1);if(a.type===U.Link){a=a.Z;for(var b=a.length,c=0;c<b;c++){var d=a.O(c);if(!(d instanceof Yf&&d.isPanelMain))break}return c}return a.type===U.Table&&0<a.Z.length&&(a=a.Z.O(0),a.isPanelMain&&a instanceof U&&(a.type===U.TableRow||a.type===U.TableColumn))?1:0}t.Xt=function(){for(var a=wn(this);this.Z.length>a;)this.Lc(this.Z.length-1,!1);a=this.itemArray;if(null!==a)for(var b=a.length,c=0;c<b;c++)En(this,a[c],c)}; t.ey=function(a){if(void 0===a||null===a||null===this.Rd)return null;A(a,"object",U,"findItemPanelForData");return this.Rd.K(a)}; function En(a,b,c){if(!(void 0===b||null===b||0>c)){var d=Fn(a,b),e=a.itemTemplateMap,f=null;null!==e&&(f=e.K(d));null===f&&(Gn||(Gn=!0,Ca('No item template Panel found for category "'+d+'" on '+a),Ca(" Using default item template."),d=new U,e=new ih,e.bind(new $i("text","",Qa)),d.add(e),Hn=d),f=Hn);d=f;null!==d&&(Lg(d),d=d.copy(),0!==(d.I&16777216)&&(e=a.ej(),null!==e&&An(e,!0)),"object"===typeof b&&(null===a.Rd&&(a.Rd=new Db),a.Rd.add(b,d)),e=c+wn(a),a.yb(e,d),d.pb=b,Sn(a,e,c),d.pb=null,d.data= b)}}function Sn(a,b,c){for(a=a.Z;b<a.length;){var d=a.O(b);if(d instanceof U){var e=b,f=c;d.type===U.TableRow?d.row=e:d.type===U.TableColumn&&(d.column=e);d.itemIndex=f}b++;c++}}function Fn(a,b){if(null===b)return"";a=a.Dl;if("function"===typeof a)a=a(b);else if("string"===typeof a&&"object"===typeof b){if(""===a)return"";a=Tn(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);return""} function zn(a,b,c){var d=b.enabledChanged;null!==d&&d(b,c);if(b instanceof U){b=b.Z.j;d=b.length;for(var e=0;e<d;e++){var f=b[e];c&&f instanceof U&&!f.isEnabled||zn(a,f,c)}}}function Un(a,b){b.name=a;dm.add(a,b)} ma.Object.defineProperties(U.prototype,{type:{configurable:!0,get:function(){return this.ta},set:function(a){var b=this.ta;b!==a&&(this.ta=a,this.ta===U.Grid?this.isAtomic=!0:this.ta===U.Table&&on(this),this.u(),this.g("type",b,a))}},elements:{configurable:!0,get:function(){return this.Z.iterator}},naturalBounds:{configurable:!0,get:function(){return this.tc}},padding:{configurable:!0,get:function(){return this.lb},set:function(a){"number"=== typeof a?(0>a&&ya(a,">= 0",U,"padding"),a=new lc(a)):(w(a,lc,U,"padding"),0>a.left&&ya(a.left,">= 0",U,"padding:value.left"),0>a.right&&ya(a.right,">= 0",U,"padding:value.right"),0>a.top&&ya(a.top,">= 0",U,"padding:value.top"),0>a.bottom&&ya(a.bottom,">= 0",U,"padding:value.bottom"));var b=this.lb;b.A(a)||(this.lb=a=a.J(),this.u(),this.g("padding",b,a))}},defaultAlignment:{configurable:!0,get:function(){return this.Jn},set:function(a){var b=this.Jn;b.A(a)||(F&&w(a,M,U,"defaultAlignment"), this.Jn=a=a.J(),this.u(),this.g("defaultAlignment",b,a))}},defaultStretch:{configurable:!0,get:function(){return this.Zf},set:function(a){var b=this.Zf;b!==a&&(hb(a,N,U,"defaultStretch"),this.Zf=a,this.u(),this.g("defaultStretch",b,a))}},defaultSeparatorPadding:{configurable:!0,get:function(){return void 0===this.zj?Ec:this.zj},set:function(a){if(void 0!==this.zj){"number"===typeof a?a=new lc(a):F&&w(a,lc,U,"defaultSeparatorPadding");var b=this.zj;b.A(a)||(this.zj=a=a.J(), this.u(),this.g("defaultSeparatorPadding",b,a))}}},defaultRowSeparatorStroke:{configurable:!0,get:function(){return void 0===this.ui?null:this.ui},set:function(a){var b=this.ui;b!==a&&(null===a||"string"===typeof a||a instanceof Kl)&&(a instanceof Kl&&a.freeze(),this.ui=a,this.P(),this.g("defaultRowSeparatorStroke",b,a))}},defaultRowSeparatorStrokeWidth:{configurable:!0,get:function(){return void 0===this.$g?1:this.$g},set:function(a){if(void 0!==this.$g){var b=this.$g; b!==a&&isFinite(a)&&0<=a&&(this.$g=a,this.u(),this.g("defaultRowSeparatorStrokeWidth",b,a))}}},defaultRowSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.ti?null:this.ti},set:function(a){if(void 0!==this.ti){var b=this.ti;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",U,"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.ti=a;this.P();this.g("defaultRowSeparatorDashArray",b,a)}}}},defaultColumnSeparatorStroke:{configurable:!0,get:function(){return void 0===this.Yg?null:this.Yg},set:function(a){if(void 0!==this.Yg){var b=this.Yg;b!==a&&(null===a||"string"===typeof a||a instanceof Kl)&&(a instanceof Kl&&a.freeze(),this.Yg=a,this.P(),this.g("defaultColumnSeparatorStroke",b,a))}}},defaultColumnSeparatorStrokeWidth:{configurable:!0, enumerable:!0,get:function(){return void 0===this.Zg?1:this.Zg},set:function(a){if(void 0!==this.Zg){var b=this.Zg;b!==a&&isFinite(a)&&0<=a&&(this.Zg=a,this.u(),this.g("defaultColumnSeparatorStrokeWidth",b,a))}}},defaultColumnSeparatorDashArray:{configurable:!0,get:function(){return void 0===this.si?null:this.si},set:function(a){if(void 0!==this.si){var b=this.si;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",U,"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.si=a;this.P();this.g("defaultColumnSeparatorDashArray",b,a)}}}},viewboxStretch:{configurable:!0,get:function(){return this.oq},set:function(a){var b=this.oq;b!==a&&(hb(a,N,U,"viewboxStretch"),this.oq=a,this.u(),this.g("viewboxStretch",b,a))}},gridCellSize:{configurable:!0, enumerable:!0,get:function(){return this.jo},set:function(a){var b=this.jo;if(!b.A(a)){w(a,Hb,U,"gridCellSize");a.o()&&0!==a.width&&0!==a.height||v("Invalid Panel.gridCellSize: "+a);this.jo=a.J();var c=this.diagram;null!==c&&this===c.grid&&Dj(c);this.P();this.g("gridCellSize",b,a)}}},gridOrigin:{configurable:!0,get:function(){return this.ko},set:function(a){var b=this.ko;if(!b.A(a)){w(a,J,U,"gridOrigin");a.o()||v("Invalid Panel.gridOrigin: "+a);this.ko=a.J();var c=this.diagram;null!== c&&this===c.grid&&Dj(c);this.P();this.g("gridOrigin",b,a)}}},graduatedMin:{configurable:!0,get:function(){return this.fo},set:function(a){C(a,U,"graduatedMin");var b=this.fo;b!==a&&(this.fo=a,this.u(),this.g("graduatedMin",b,a),vl(this)&&(a=this.part,null!==a&&wl(this,a,"graduatedRange")))}},graduatedMax:{configurable:!0,get:function(){return this.eo},set:function(a){C(a,U,"graduatedMax");var b=this.eo;b!==a&&(this.eo=a,this.u(),this.g("graduatedMax",b,a),vl(this)&&(a= this.part,null!==a&&wl(this,a,"graduatedRange")))}},graduatedRange:{configurable:!0,get:function(){return this.graduatedMax-this.graduatedMin}},graduatedTickUnit:{configurable:!0,get:function(){return this.io},set:function(a){C(a,U,"graduatedTickUnit");var b=this.io;b!==a&&0<a&&(this.io=a,this.u(),this.g("graduatedTickUnit",b,a))}},graduatedTickBase:{configurable:!0,get:function(){return this.ho},set:function(a){C(a,U,"graduatedTickBase");var b=this.ho;b!== a&&(this.ho=a,this.u(),this.g("graduatedTickBase",b,a))}},Qh:{configurable:!0,get:function(){return 0!==(this.I&8388608)},set:function(a){0!==(this.I&8388608)!==a&&(this.I^=8388608)}},rowCount:{configurable:!0,get:function(){return void 0===this.xb?0:this.xb.length}},columnCount:{configurable:!0,get:function(){return void 0===this.tb?0:this.tb.length}},rowSizing:{configurable:!0,get:function(){return void 0===this.Yj?pn:this.Yj},set:function(a){if(void 0!== this.Yj){var b=this.Yj;b!==a&&(F&&a!==pn&&a!==Xm&&v("Panel.rowSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.Yj=a,this.u(),this.g("rowSizing",b,a))}}},columnSizing:{configurable:!0,get:function(){return void 0===this.wj?pn:this.wj},set:function(a){if(void 0!==this.wj){var b=this.wj;b!==a&&(F&&a!==pn&&a!==Xm&&v("Panel.columnSizing must be RowColumnDefinition.ProportionalExtra or RowColumnDefinition.None, not: "+a),this.wj=a,this.u(),this.g("columnSizing", b,a))}}},topIndex:{configurable:!0,get:function(){return void 0===this.Vi?0:this.Vi},set:function(a){if(void 0!==this.Vi){var b=this.Vi;b!==a&&((!isFinite(a)||0>a)&&v("Panel.topIndex must be greater than zero and a real number, not: "+a),this.Vi=a,this.u(),this.g("topIndex",b,a))}}},leftIndex:{configurable:!0,get:function(){return void 0===this.Gi?0:this.Gi},set:function(a){if(void 0!==this.Gi){var b=this.Gi;b!==a&&((!isFinite(a)||0>a)&&v("Panel.leftIndex must be greater than zero and a real number, not: "+ a),this.Gi=a,this.u(),this.g("leftIndex",b,a))}}},data:{configurable:!0,get:function(){return this.pb},set:function(a){var b=this.pb;if(b!==a){var c=this instanceof S&&!(this instanceof Te);c&&A(a,"object",U,"data");Lg(this);this.pb=a;var d=this.diagram;null!==d&&(c?(c=d.partManager,this instanceof R?(null!==b&&c.Ze.remove(b),null!==a&&c.Ze.add(a,this)):this instanceof S&&(null!==b&&c.$e.remove(b),null!==a&&c.$e.add(a,this))):(c=this.panel,null!==c&&null!==c.Rd&&(null!==b&&c.Rd.remove(b), null!==a&&c.Rd.add(a,this))));this.g("data",b,a);null!==d&&d.undoManager.isUndoingRedoing||null!==a&&this.Ga()}}},itemIndex:{configurable:!0,get:function(){return this.yo},set:function(a){var b=this.yo;b!==a&&(this.yo=a,this.g("itemIndex",b,a))}},itemArray:{configurable:!0,get:function(){return this.Di},set:function(a){var b=this.Di;if(b!==a||null!==a&&Dn(this,a)){F&&null!==a&&!Ga(a)&&v("Panel.itemArray must be an Array-like object or null, not: "+a);var c=this.diagram; b!==a&&(null!==c&&null!==b&&Zj(c.partManager,this,c),this.Di=a,null!==c&&null!==a&&Wj(c.partManager,this));this.g("itemArray",b,a);null!==c&&c.undoManager.isUndoingRedoing||this.Xt()}}},itemTemplate:{configurable:!0,get:function(){return null===this.xe?null:this.xe.K("")},set:function(a){if(null===this.xe){if(null===a)return;this.xe=new Db}var b=this.xe.K("");b!==a&&(w(a,U,U,"itemTemplate"),(a instanceof S||a.isPanelMain)&&v("Panel.itemTemplate must not be a Part or be Panel.isPanelMain: "+ a),this.xe.add("",a),this.g("itemTemplate",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.Xt())}},itemTemplateMap:{configurable:!0,get:function(){return this.xe},set:function(a){var b=this.xe;if(b!==a){w(a,Db,U,"itemTemplateMap");for(var c=a.iterator;c.next();){var d=c.value;F&&(d instanceof S||d.isPanelMain)&&v("Template in Panel.itemTemplateMap must not be a Part or be Panel.isPanelMain: "+d)}this.xe=a;this.g("itemTemplateMap",b,a);a=this.diagram;null!==a&&a.undoManager.isUndoingRedoing|| this.Xt()}}},itemCategoryProperty:{configurable:!0,get:function(){return this.Dl},set:function(a){var b=this.Dl;b!==a&&("string"!==typeof a&&"function"!==typeof a&&xa(a,"string or function",U,"itemCategoryProperty"),this.Dl=a,this.g("itemCategoryProperty",b,a))}},isAtomic:{configurable:!0,get:function(){return 0!==(this.I&1048576)},set:function(a){var b=0!==(this.I&1048576);b!==a&&(A(a,"boolean",U,"isAtomic"),this.I^=1048576,this.g("isAtomic",b,a))}},isClipping:{configurable:!0, enumerable:!0,get:function(){return 0!==(this.I&2097152)},set:function(a){var b=0!==(this.I&2097152);b!==a&&(A(a,"boolean",U,"isClipping"),a&&this.type!==U.Spot&&Ca("Warning: Panel.isClipping set on non-Spot Panel: "+this.toString()),this.I^=2097152,this.u(),this.g("isClipping",b,a))}},isOpposite:{configurable:!0,get:function(){return 0!==(this.I&33554432)},set:function(a){var b=0!==(this.I&33554432);b!==a&&(A(a,"boolean",U,"isOpposite"),this.I^=33554432,this.u(),this.g("isOpposite", b,a))}},isEnabled:{configurable:!0,get:function(){return 0!==(this.I&4194304)},set:function(a){var b=0!==(this.I&4194304);if(b!==a){A(a,"boolean",U,"isEnabled");var c=null===this.panel||this.panel.Ng();this.I^=4194304;this.g("isEnabled",b,a);b=this.diagram;null!==b&&b.undoManager.isUndoingRedoing||c&&zn(this,this,a)}}},alignmentFocusName:{configurable:!0,get:function(){return this.Sg},set:function(a){var b=this.Sg;b!==a&&(F&&A(a,"string",U,"alignmentFocusName"),this.Sg= a,this.u(),this.g("alignmentFocusName",b,a))}}}); ma.Object.defineProperties(U,{Position:{configurable:!0,get:function(){return dm.K("Position")}},Horizontal:{configurable:!0,get:function(){return dm.K("Horizontal")}},Vertical:{configurable:!0,get:function(){return dm.K("Vertical")}},Spot:{configurable:!0,get:function(){return dm.K("Spot")}},Auto:{configurable:!0,get:function(){return dm.K("Auto")}},Table:{configurable:!0,get:function(){return dm.K("Table")}},Viewbox:{configurable:!0, enumerable:!0,get:function(){return dm.K("Viewbox")}},TableRow:{configurable:!0,get:function(){return dm.K("TableRow")}},TableColumn:{configurable:!0,get:function(){return dm.K("TableColumn")}},Link:{configurable:!0,get:function(){return dm.K("Link")}},Grid:{configurable:!0,get:function(){return dm.K("Grid")}},Graduated:{configurable:!0,get:function(){return dm.K("Graduated")}}});U.prototype.findItemPanelForData=U.prototype.ey; U.prototype.rebuildItemElements=U.prototype.Xt;U.prototype.updateTargetBindings=U.prototype.Ga;U.prototype.copyTemplate=U.prototype.qz;U.prototype.graduatedValueForPoint=U.prototype.iA;U.prototype.graduatedPointForValue=U.prototype.hA;U.prototype.findColumnForLocalX=U.prototype.Gz;U.prototype.findRowForLocalY=U.prototype.Oz;U.prototype.removeColumnDefinition=U.prototype.ow;U.prototype.removeRowDefinition=U.prototype.qw;U.prototype.removeAt=U.prototype.hb;U.prototype.remove=U.prototype.remove; U.prototype.insertAt=U.prototype.yb;U.prototype.elt=U.prototype.O;U.prototype.add=U.prototype.add;U.prototype.findObject=U.prototype.fb;U.prototype.findInVisualTree=U.prototype.vm;U.prototype.walkVisualTreeFrom=U.prototype.Lk;U.prototype.findMainElement=U.prototype.Fb;var Cn=!1,Gn=!1,Hn=null,dm=new Db;U.className="Panel";U.definePanelLayout=Un;Un("Position",new Nm);Un("Vertical",new Qm);Un("Auto",new Sm);Un("Link",new cn); function ik(){fb(this);this.wg=null;this.hs=!0;this.Ua=0;this.Wc=NaN;this.rh=0;this.qh=Infinity;this.Bb=ld;this.sa=this.na=0;this.jb=null;this.Xp=Vn;this.Je=ll;this.Rp=this.zg=null;this.Sp=NaN;this.ob=this.Zj=null;this.Fn=!1} ik.prototype.copy=function(){var a=new ik;a.hs=this.hs;a.Ua=this.Ua;a.Wc=this.Wc;a.rh=this.rh;a.qh=this.qh;a.Bb=this.Bb;a.na=this.na;a.sa=this.sa;a.Je=this.Je;a.Xp=this.Xp;null===this.zg?a.zg=null:a.zg=this.zg.J();a.Rp=this.Rp;a.Sp=this.Sp;a.Zj=null;null!==this.Zj&&(a.separatorDashArray=Ia(this.separatorDashArray));a.ob=this.ob;a.Fn=this.Fn;a.jb=this.jb;return a};t=ik.prototype; t.vt=function(a){w(a,ik,ik,"copyFrom:pd");a.isRow?this.height=a.height:this.width=a.width;this.minimum=a.minimum;this.maximum=a.maximum;this.alignment=a.alignment;this.stretch=a.stretch;this.sizing=a.sizing;this.zg=null===a.separatorPadding?null:a.separatorPadding.J();this.separatorStroke=a.separatorStroke;this.separatorStrokeWidth=a.separatorStrokeWidth;this.Zj=null;a.separatorDashArray&&(this.Zj=Ia(a.separatorDashArray));this.background=a.background;this.coversSeparators=a.coversSeparators;this.jb= a.jb};t.mb=function(a){a.classType===ik?this.sizing=a:Ba(this,a)};t.toString=function(){return"RowColumnDefinition "+(this.isRow?"(Row ":"(Column ")+this.index+") #"+pb(this)};t.oj=function(a){this.wg=a}; t.Av=function(){var a=0,b=0,c=this.wg,d=this.isRow;if(null!==c&&c.type===U.Table)for(var e=d?c.xb.length:c.tb.length,f=0;f<e;f++){var g=d?c.xb[f]:c.tb[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.zg;if(null===b)if(null!==c)b= c.defaultSeparatorPadding;else return a;return a+(this.isRow?b.top:b.left)}; t.Ac=function(){var a=0,b=this.wg,c=0,d=this.isRow;if(null!==b&&b.type===U.Table)for(var e=d?b.xb.length:b.tb.length,f=0;f<e;f++){var g=d?b.xb[f]:b.tb[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.zg;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.Db=function(a,b,c){var d=this.wg;if(null!==d&&(d.gb(He,a,this,b,c,void 0,void 0),null!==this.jb&&(b=d.diagram,null!==b&&!b.skipsModelSourceBindings&&(d=d.ej(),null!==d&&(b=d.data,null!==b)))))for(c=this.jb.iterator;c.next();)c.value.gr(this,b,a,d)};function Wm(a){if(a.sizing===Vn){var b=a.wg;return a.isRow?b.rowSizing:b.columnSizing}return a.sizing} t.bind=function(a){a.jd=this;var b=this.panel;if(null!==b){var c=b.ej();null!==c&&Zl(c)&&v("Cannot add a Binding to a RowColumnDefinition that is already frozen: "+a+" on "+b)}null===this.jb&&(this.jb=new H);this.jb.add(a)}; ma.Object.defineProperties(ik.prototype,{panel:{configurable:!0,get:function(){return this.wg}},isRow:{configurable:!0,get:function(){return this.hs},set:function(a){this.hs=a}},index:{configurable:!0,get:function(){return this.Ua},set:function(a){this.Ua=a}},height:{configurable:!0,get:function(){return this.Wc},set:function(a){var b=this.Wc;b!==a&&(F&&A(a,"number",ik,"height"),0>a&&ya(a,">= 0",ik,"height"),this.Wc=a,this.actual=this.na,null!== this.panel&&this.panel.u(),this.Db("height",b,a))}},width:{configurable:!0,get:function(){return this.Wc},set:function(a){var b=this.Wc;b!==a&&(F&&A(a,"number",ik,"width"),0>a&&ya(a,">= 0",ik,"width"),this.Wc=a,this.actual=this.na,null!==this.panel&&this.panel.u(),this.Db("width",b,a))}},minimum:{configurable:!0,get:function(){return this.rh},set:function(a){var b=this.rh;b!==a&&(F&&A(a,"number",ik,"minimum"),(0>a||!isFinite(a))&&ya(a,">= 0",ik,"minimum"),this.rh=a,this.actual= this.na,null!==this.panel&&this.panel.u(),this.Db("minimum",b,a))}},maximum:{configurable:!0,get:function(){return this.qh},set:function(a){var b=this.qh;b!==a&&(F&&A(a,"number",ik,"maximum"),0>a&&ya(a,">= 0",ik,"maximum"),this.qh=a,this.actual=this.na,null!==this.panel&&this.panel.u(),this.Db("maximum",b,a))}},alignment:{configurable:!0,get:function(){return this.Bb},set:function(a){var b=this.Bb;b.A(a)||(F&&w(a,M,ik,"alignment"),this.Bb=a.J(),null!==this.panel&&this.panel.u(), this.Db("alignment",b,a))}},stretch:{configurable:!0,get:function(){return this.Je},set:function(a){var b=this.Je;b!==a&&(F&&hb(a,N,ik,"stretch"),this.Je=a,null!==this.panel&&this.panel.u(),this.Db("stretch",b,a))}},separatorPadding:{configurable:!0,get:function(){return this.zg},set:function(a){"number"===typeof a?a=new lc(a):null!==a&&F&&w(a,lc,ik,"separatorPadding");var b=this.zg;null!==a&&null!==b&&b.A(a)||(null!==a&&(a=a.J()),this.zg=a,null!==this.panel&&this.panel.u(), this.Db("separatorPadding",b,a))}},separatorStroke:{configurable:!0,get:function(){return this.Rp},set:function(a){var b=this.Rp;b!==a&&(null!==a&&hm(a,"RowColumnDefinition.separatorStroke"),a instanceof Kl&&a.freeze(),this.Rp=a,null!==this.panel&&this.panel.u(),this.Db("separatorStroke",b,a))}},separatorStrokeWidth:{configurable:!0,get:function(){return this.Sp},set:function(a){var b=this.Sp;b!==a&&(this.Sp=a,null!==this.panel&&this.panel.u(),this.Db("separatorStrokeWidth", b,a))}},separatorDashArray:{configurable:!0,get:function(){return this.Zj},set:function(a){var b=this.Zj;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",ik,"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.Zj=a;null!==this.panel&&this.panel.P();this.Db("separatorDashArray", b,a)}}},background:{configurable:!0,get:function(){return this.ob},set:function(a){var b=this.ob;b!==a&&(null!==a&&hm(a,"RowColumnDefinition.background"),a instanceof Kl&&a.freeze(),this.ob=a,null!==this.panel&&this.panel.P(),this.Db("background",b,a))}},coversSeparators:{configurable:!0,get:function(){return this.Fn},set:function(a){var b=this.Fn;b!==a&&(A(a,"boolean",ik,"coversSeparators"),this.Fn=a,null!==this.panel&&this.panel.P(),this.Db("coversSeparators",b,a))}}, sizing:{configurable:!0,get:function(){return this.Xp},set:function(a){var b=this.Xp;b!==a&&(F&&hb(a,ik,ik,"sizing"),this.Xp=a,null!==this.panel&&this.panel.u(),this.Db("sizing",b,a))}},actual:{configurable:!0,get:function(){return this.na},set:function(a){this.na=isNaN(this.Wc)?Math.max(Math.min(this.qh,a),this.rh):Math.max(Math.min(this.qh,this.Wc),this.rh)}},total:{configurable:!0,get:function(){return this.na+this.Ac()},set:function(a){this.na=isNaN(this.Wc)? Math.max(Math.min(this.qh,a),this.rh):Math.max(Math.min(this.qh,this.Wc),this.rh);this.na=Math.max(0,this.na-this.Ac())}},position:{configurable:!0,get:function(){return this.sa},set:function(a){this.sa=a}}});ik.prototype.bind=ik.prototype.bind;ik.prototype.computeEffectiveSpacing=ik.prototype.Ac;ik.prototype.computeEffectiveSpacingTop=ik.prototype.Av;var Vn=new E(ik,"Default",0),Xm=new E(ik,"None",1),pn=new E(ik,"ProportionalExtra",2);ik.className="RowColumnDefinition";ik.Default=Vn; ik.None=Xm;ik.ProportionalExtra=pn;function Yf(){N.call(this);this.Bd=this.qa=null;this.Vn="None";this.co=ll;this.Jc=this.ll="black";this.Bh=1;this.dm="butt";this.em="miter";this.$j=10;this.zh=null;this.Ah=0;this.wf=this.vf=ld;this.qp=this.pp=NaN;this.qo=!1;this.sp=null;this.nl=this.km="None";this.Qd=1;this.Od=0;this.Md=1;this.Nd=null}la(Yf,N); Yf.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.qa=this.qa;a.Vn=this.Vn;a.co=this.co;a.Bd=this.Bd;a.ll=this.ll;a.Jc=this.Jc;a.Bh=this.Bh;a.dm=this.dm;a.em=this.em;a.$j=this.$j;null!==this.zh&&(a.zh=Ia(this.zh));a.Ah=this.Ah;a.vf=this.vf.J();a.wf=this.wf.J();a.pp=this.pp;a.qp=this.qp;a.qo=this.qo;a.sp=this.sp;a.km=this.km;a.nl=this.nl;a.Qd=this.Qd;a.Od=this.Od;a.Md=this.Md;a.Nd=this.Nd};t=Yf.prototype; t.mb=function(a){a===Mg||a===Og||a===ol||a===ll?this.geometryStretch=a:N.prototype.mb.call(this,a)};t.toString=function(){return"Shape("+("None"!==this.figure?this.figure:"None"!==this.toArrow?this.toArrow:this.fromArrow)+")#"+pb(this)}; function Wn(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,x=La(),y=2;y<e;y+=2)l=c[y],m=c[y+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),x.push([n,r,p,q]),u+=q,h=l,k=m;h=c[0];k=c[1];n=d.measuredBounds.width;d instanceof Yf&&(n-=d.strokeWidth);1>n&&(n=1);e=c=n;l=g/2;m=0===l?!1:!0;y=0;q=x[y];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(x);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.aj(a,b);a.translate(g/2,f/2);a.rotate(-r);a.translate(-h,-k);u-=e;q-=e;if(0!==z){y++;if(y===x.length){Oa(x);return}q=x[y];n=q[0];r=q[1];p=q[2];q=q[3];e=z}}Oa(x)}} t.aj=function(a,b){var c=this.Jc,d=this.ll;if(null!==c||null!==d){var e=this.actualBounds,f=this.naturalBounds;null!==d&&zi(this,a,d,!0,!1,f,e);var g=this.part,h=this.Bh;null!==c&&0===h&&null!==g&&(h=g.type===U.Link&&g instanceof Te&&"Selection"===g.category&&g.adornedObject instanceof Yf&&g.adornedPart.Fb()===g.adornedObject?g.adornedObject.strokeWidth:0);null!==c&&0!==h&&(zi(this,a,c,!1,!1,f,e),a.lineWidth=h,a.lineJoin=this.em,a.lineCap=this.dm,a.miterLimit=this.$j);e=!1;g&&b.Qe("drawShadows")&& (e=g.isShadowed);g=!0;null===c||null!==d&&"transparent"!==d||(g=!1);f=!1;var k=this.strokeDashArray;null!==k&&(f=!0,a.yt(k,this.Ah));var l=this.qa;if(null!==l){if(l.type===Id)a.beginPath(),a.moveTo(l.startX,l.startY),a.lineTo(l.endX,l.endY),null!==d&&a.ce(d),0!==h&&null!==c&&a.rj();else if(l.type===Md){var m=l.startX;k=l.startY;var n=l.endX,p=l.endY;l=Math.min(m,n);var r=Math.min(k,p);m=Math.abs(n-m);k=Math.abs(p-k);a.beginPath();a.rect(l,r,m,k);null!==d&&a.ce(d);if(null!==c){g&&e&&Jl(a);if(0!==h){if(0=== m||0===k)a.beginPath(),a.rect(l,r,Math.max(m,.1),Math.max(k,.1));a.rj()}g&&e&&Il(a)}}else if(l.type===Ud)m=l.startX,k=l.startY,n=l.endX,p=l.endY,l=Math.abs(n-m)/2,r=Math.abs(p-k)/2,m=Math.min(m,n)+l,k=Math.min(k,p)+r,a.beginPath(),a.moveTo(m,k-r),a.bezierCurveTo(m+K.Rg*l,k-r,m+l,k-K.Rg*r,m+l,k),a.bezierCurveTo(m+l,k+K.Rg*r,m+K.Rg*l,k+r,m,k+r),a.bezierCurveTo(m-K.Rg*l,k+r,m-l,k+K.Rg*r,m-l,k),a.bezierCurveTo(m-l,k-K.Rg*r,m-K.Rg*l,k-r,m,k-r),a.closePath(),null!==d&&a.ce(d),0!==h&&null!==c&&(g&&e?(Jl(a), a.rj(),Il(a)):a.rj());else if(l.type===Gd)for(k=l.figures,l=k.length,r=0;r<l;r++){m=k.j[r];a.beginPath();a.moveTo(m.startX,m.startY);n=m.segments.j;p=n.length;for(var q=null,u=0;u<p;u++){var x=n[u];switch(x.type){case ie:a.moveTo(x.endX,x.endY);break;case Kd:a.lineTo(x.endX,x.endY);break;case je:a.bezierCurveTo(x.point1X,x.point1Y,x.point2X,x.point2Y,x.endX,x.endY);break;case ke:a.quadraticCurveTo(x.point1X,x.point1Y,x.endX,x.endY);break;case le:if(x.radiusX===x.radiusY){var y=Math.PI/180;a.arc(x.point1X, x.point1Y,x.radiusX,x.startAngle*y,(x.startAngle+x.sweepAngle)*y,0>x.sweepAngle,null!==q?q.endX:m.startX,null!==q?q.endY:m.startY)}else if(q=ne(x,m),y=q.length,0===y)a.lineTo(x.centerX,x.centerY);else for(var z=0;z<y;z++){var B=q[z];0===z&&a.lineTo(B[0],B[1]);a.bezierCurveTo(B[2],B[3],B[4],B[5],B[6],B[7])}break;case me:z=y=0;if(null!==q&&q.type===le){q=ne(q,m);B=q.length;if(0===B){a.lineTo(x.centerX,x.centerY);break}q=q[B-1]||null;null!==q&&(y=q[6],z=q[7])}else y=null!==q?q.endX:m.startX,z=null!== q?q.endY:m.startY;q=oe(x,m,y,z);y=q.length;if(0===y){a.lineTo(x.centerX,x.centerY);break}for(z=0;z<y;z++)B=q[z],a.bezierCurveTo(B[2],B[3],B[4],B[5],B[6],B[7]);break;default:v("Segment not of valid type: "+x.type)}x.isClosed&&a.closePath();q=x}e?m.isShadowed?(!0===m.isFilled&&"transparent"!==d&&null!==d&&a.ce(d),0!==h&&null!==c&&(g&&Jl(a),a.rj(),g&&Il(a))):(g&&Jl(a),!0===m.isFilled&&"transparent"!==d&&null!==d&&a.ce(d),0!==h&&null!==c&&a.rj(),g&&Il(a)):(!0===m.isFilled&&null!==d&&a.ce(d),0!==h&&null!== c&&a.rj())}f&&a.wt();if(null!==this.pathPattern){c=this.pathPattern;c.measure(Infinity,Infinity);d=c.measuredBounds;c.arrange(0,0,d.width,d.height);h=this.geometry;a.save();a.beginPath();d=La();if(h.type===Id)d.push(h.startX),d.push(h.startY),d.push(h.endX),d.push(h.endY),Wn(a,b,d,c);else if(h.type===Gd)for(h=h.figures.iterator;h.next();){e=h.value;d.length=0;d.push(e.startX);d.push(e.startY);g=e.startX;f=e.startY;k=g;l=f;r=e.segments.j;m=r.length;for(n=0;n<m;n++){p=r[n];switch(p.type){case ie:Wn(a, b,d,c);d.length=0;d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;k=g;l=f;break;case Kd:d.push(p.endX);d.push(p.endY);g=p.endX;f=p.endY;break;case je:K.Ne(g,f,p.point1X,p.point1Y,p.point2X,p.point2Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case ke:K.Tq(g,f,p.point1X,p.point1Y,p.endX,p.endY,.5,d);g=p.endX;f=p.endY;break;case le:u=ne(p,e);x=u.length;if(0===x){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<x;q++)y=u[q],K.Ne(g,f,y[2],y[3],y[4],y[5],y[6],y[7],.5,d),g=y[6], f=y[7];break;case me:u=oe(p,e,g,f);x=u.length;if(0===x){d.push(p.centerX);d.push(p.centerY);g=p.centerX;f=p.centerY;break}for(q=0;q<x;q++)y=u[q],K.Ne(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(k),d.push(l),Wn(a,b,d,c))}Wn(a,b,d,c)}else if(h.type===Md)d.push(h.startX),d.push(h.startY),d.push(h.endX),d.push(h.startY),d.push(h.endX),d.push(h.endY),d.push(h.startX),d.push(h.endY),d.push(h.startX),d.push(h.startY),Wn(a, b,d,c);else if(h.type===Ud){f=new te;f.startX=h.endX;f.startY=(h.startY+h.endY)/2;g=new ue(le);g.startAngle=0;g.sweepAngle=360;g.centerX=(h.startX+h.endX)/2;g.centerY=(h.startY+h.endY)/2;g.radiusX=Math.abs(h.startX-h.endX)/2;g.radiusY=Math.abs(h.startY-h.endY)/2;f.add(g);h=ne(g,f);e=h.length;if(0===e)d.push(g.centerX),d.push(g.centerY);else for(g=f.startX,f=f.startY,k=0;k<e;k++)l=h[k],K.Ne(g,f,l[2],l[3],l[4],l[5],l[6],l[7],.5,d),g=l[6],f=l[7];Wn(a,b,d,c)}Oa(d);a.restore();a.yc(!1)}}}}; t.ma=function(a,b){void 0===b&&(b=new J);if(a instanceof M){a.Sb()&&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.Cd.xa(b);return b}; t.zm=function(a){void 0===a&&(a=new L);var b=this.naturalBounds,c=this.Cd;b=L.allocAt(b.x,b.y,b.width,b.height);var d=this.strokeWidth;b.cd(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);qc(a,d.x,d.y,0,0);d.h(b.right,b.bottom).transform(c);qc(a,d.x,d.y,0,0);d.h(b.x,b.bottom).transform(c);qc(a,d.x,d.y,0,0);L.free(b);J.free(d);return a}; t.Ph=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!==Id||b||(e+=2);var f=L.alloc();f.assign(d);f.cd(e+2,e+2);if(!f.fa(a))return L.free(f),!1;d=e+1E-4;if(c.type===Id){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;L.free(f);return K.Tb(c.startX,c.startY,c.endX,c.endY,e,a.x,a.y)}if(c.type=== Md){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.cd(-d,-d);if(f.fa(a))return L.free(f),!1;f.cd(d,d)}null!==this.stroke&&f.cd(e,e);a=f.fa(a);L.free(f);return a}if(c.type===Ud){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 L.free(f),!1; g+=d;e+=d}null!==this.stroke&&(g+=d,e+=d);L.free(f);return 0>=g||0>=e?!1:1>=c*c/(g*g)+b*b/(e*e)}if(c.type===Gd)return L.free(f),null===this.fill?re(c,a.x,a.y,e):pe(c,a,e,1<this.strokeWidth,b);v("Unknown Geometry type: "+c.type);return!1}; t.Gm=function(a,b,c,d){var e=this.desiredSize,f=this.Bh;a=Math.max(a,0);b=Math.max(b,0);if(null!==this.Bd)var g=this.geometry.bounds;else{var h=this.figure,k=Xn[h];if(void 0===k){var l=K.ke[h];"string"===typeof l&&(l=K.ke[l]);"function"===typeof l?(k=l(null,100,100),Xn[h]=k):v("Unsupported Figure: "+h)}g=k.bounds}h=g.width;k=g.height;l=g.width;var m=g.height;switch(Bl(this,!0)){case Mg:d=c=0;break;case Hd:l=Math.max(a-f,0);m=Math.max(b-f,0);break;case ml:l=Math.max(a-f,0);d=0;break;case nl: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=Ng(this);switch(c){case Mg:break;case Hd:h=l;k=m;break;case Og: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.Bd?(h=Math.max(h,.01),k=Math.max(k, .01),g=null!==this.Bd?this.Bd:this.qa,e=h,d=k,c=g.copy(),g=g.bounds,e/=g.width,d/=g.height,isFinite(e)||(e=1),isFinite(d)||(d=1),1===e&&1===d||c.scale(e,d),F&&c.freeze(),this.qa=c):null!==this.qa&&K.ca(this.qa.xl,a-f)&&K.ca(this.qa.wl,b-f)||(this.qa=Yf.makeGeometry(this,h,k));g=this.qa.bounds;Infinity===a||Infinity===b?yl(this,g.x-f/2,g.y-f/2,0===a&&0===h?0:g.width+f,0===b&&0===k?0:g.height+f):yl(this,-(f/2),-(f/2),l+f,m+f)}; function Ng(a){var b=a.geometryStretch;return null!==a.Bd?b===ll?Hd:b:b===ll?Xn[a.figure].defaultStretch:b}t.Nh=function(a,b,c,d){Dl(this,a,b,c,d)};t.bd=function(a,b,c){return this.uk(a.x,a.y,b.x,b.y,c)}; t.uk=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.Bh/2;l=this.qa;null===l&&(this.measure(Infinity,Infinity),l=this.qa);p=l.bounds;m=!1;if(l.type===Id)if(1.5>=this.strokeWidth)m=K.Se(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=La();a=new J;K.Se(l.startX+d,l.startY+m,l.endX+d,l.endY+m,f,g,h,k,a)&&b.push(a);a=new J;K.Se(l.startX-d,l.startY-m,l.endX-d,l.endY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Se(l.startX+d,l.startY+m,l.startX-d,l.startY-m,f,g,h,k,a)&&b.push(a);a=new J;K.Se(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===Md)m=K.bd(p.x-n,p.y-n,p.x+p.width+ n,p.y+p.height+n,f,g,h,k,e);else if(l.type===Ud){b=L.allocAt(p.x,p.y,p.width,p.height).cd(n,n);a:if(0===b.width)m=K.Se(b.x,b.y,b.x,b.y+b.height,f,g,h,k,e);else if(0===b.height)m=K.Se(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}L.free(b)}else if(l.type===Gd){p=J.alloc();var r=h-f;var q=k-g;var u=r*r+q*q;e.x=h;e.y=k;for(var x=0;x<l.figures.count;x++){var y=l.figures.j[x],z=y.segments;r=y.startX;q=y.startY;for(var B=r,D=q,G=0;G<z.count;G++){var O= z.j[G],X=O.type;var Q=O.endX;var ca=O.endY;var Y=!1;switch(X){case ie:B=Q;D=ca;break;case Kd:Y=Yn(r,q,Q,ca,f,g,h,k,p);break;case je:Y=K.uq(r,q,O.point1X,O.point1Y,O.point2X,O.point2Y,Q,ca,f,g,h,k,.6,p);break;case ke:Y=K.uq(r,q,(r+2*O.point1X)/3,(q+2*O.point1Y)/3,(2*O.point1X+Q)/3,(2*O.point1X+Q)/3,Q,ca,f,g,h,k,.6,p);break;case le:case me:X=O.type===le?ne(O,y):oe(O,y,r,q);var oa=X.length;if(0===oa){Y=Yn(r,q,O.centerX,O.centerY,f,g,h,k,p);break}ca=null;for(Q=0;Q<oa;Q++){ca=X[Q];if(0===Q&&Yn(r,q,ca[0], ca[1],f,g,h,k,p)){var Da=Zn(f,g,p,u,e);Da<u&&(u=Da,m=!0)}K.uq(ca[0],ca[1],ca[2],ca[3],ca[4],ca[5],ca[6],ca[7],f,g,h,k,.6,p)&&(Da=Zn(f,g,p,u,e),Da<u&&(u=Da,m=!0))}Q=ca[6];ca=ca[7];break;default:v("Unknown Segment type: "+X)}r=Q;q=ca;Y&&(Y=Zn(f,g,p,u,e),Y<u&&(u=Y,m=!0));O.isClosed&&(Q=B,ca=D,Yn(r,q,Q,ca,f,g,h,k,p)&&(O=Zn(f,g,p,u,e),O<u&&(u=O,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.xa(e); return!0};function Zn(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 Yn(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.ca(k.y,a))&&(k.y<b||K.ca(k.y,b))&&(l=!0)):(b=a<c?a:c,a=a<c?c:a,(k.x>b||K.ca(k.x,b))&&(k.x<a||K.ca(k.x,a))&&(l=!0));return l} t.Oh=function(a,b){if(void 0===b)return a.Oe(this.actualBounds);var c=this.qa;null===c&&(this.measure(Infinity,Infinity),c=this.qa);c=c.bounds;var d=this.strokeWidth/2,e=!1,f=J.alloc();f.h(c.x-d,c.y-d);a.fa(b.xa(f))&&(f.h(c.x-d,c.bottom+d),a.fa(b.xa(f))&&(f.h(c.right+d,c.bottom+d),a.fa(b.xa(f))&&(f.h(c.right+d,c.y-d),a.fa(b.xa(f))&&(e=!0))));J.free(f);return e}; t.Mc=function(a,b){if(this.Oh(a,b)||void 0===b&&(b=this.transform,a.Oe(this.actualBounds)))return!0;var c=Ib.alloc();c.set(b);c.Kt();var d=a.left,e=a.right,f=a.top;a=a.bottom;var g=J.alloc();g.h(d,f);c.xa(g);if(this.Ph(g,!0))return J.free(g),!0;g.h(e,f);c.xa(g);if(this.Ph(g,!0))return J.free(g),!0;g.h(d,a);c.xa(g);if(this.Ph(g,!0))return J.free(g),!0;g.h(e,a);c.xa(g);if(this.Ph(g,!0))return J.free(g),!0;var h=J.alloc(),k=J.alloc();c.set(b);c.dw(this.transform);c.Kt();h.x=e;h.y=f;h.transform(c);g.x= d;g.y=f;g.transform(c);b=!1;$n(this,g,h,k)?b=!0:(g.x=e,g.y=a,g.transform(c),$n(this,g,h,k)?b=!0:(h.x=d,h.y=a,h.transform(c),$n(this,g,h,k)?b=!0:(g.x=d,g.y=f,g.transform(c),$n(this,g,h,k)&&(b=!0))));J.free(g);Ib.free(c);J.free(h);J.free(k);return b};function $n(a,b,c,d){if(!a.bd(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.gy=function(a,b,c){function d(a,b){for(var c=a.length,d=0;d<c;d+=2)if(b.kd(a[d],a[d+1])>e)return!0;return!1}if(c&&null!==this.fill&&this.Ph(a,!0))return!0;var e=a.Pe(b),f=e;1.5<this.strokeWidth&&(e=this.strokeWidth/2+Math.sqrt(e),e*=e);b=this.qa;if(null===b&&(this.measure(Infinity,Infinity),b=this.qa,null===b))return!1;if(!c){var g=b.bounds,h=g.x,k=g.y,l=g.x+g.width;g=g.y+g.height;if(Lb(a.x,a.y,h,k)<=e&&Lb(a.x,a.y,l,k)<=e&&Lb(a.x,a.y,h,g)<=e&&Lb(a.x,a.y,l,g)<=e)return!0}h=b.startX;k=b.startY;l= b.endX;g=b.endY;if(b.type===Id){if(c=Kb(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===Md)return b=!1,c&&(b=Kb(a.x,a.y,h,k,h,g)<=e||Kb(a.x,a.y,h,k,l,k)<=e||Kb(a.x,a.y,l,k,l,g)<=e||Kb(a.x,a.y,h,g,l,g)<=e),b;if(b.type===Ud){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 Kb(a.x,a.y,h,k,l,g)<=e?!0:!1;if(c){if(a=K.xz(m,n,b,f),a*a<=e)return!0}else return Lb(b,f,-m,0)>=e||Lb(b,f,0,-n)>=e|| Lb(b,f,0,n)>=e||Lb(b,f,m,0)>=e?!1:!0}else if(b.type===Gd){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&&Kb(a.x,a.y,f,h,f,l)>e&&Kb(a.x,a.y,f,h,k,h)>e&&Kb(a.x,a.y,k,l,f,l)>e&&Kb(a.x,a.y,k,l,k,h)>e)return!1;f=Math.sqrt(e);if(c){if(null===this.fill?re(b,a.x,a.y,f):pe(b,a,f,!0,!1))return!0}else{c=b.figures;for(b=0;b<c.count;b++){f=c.j[b];g=f.startX;m=f.startY;if(a.kd(g,m)>e)return!1;h=f.segments.j;k=h.length;for(l=0;l<k;l++)switch(n=h[l],n.type){case ie:case Kd:g=n.endX; m=n.endY;if(a.kd(g,m)>e)return!1;break;case je:var p=La();K.Ne(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.kd(g,m)>e)return!1;break;case ke:p=La();K.Tq(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.kd(g,m)>e)return!1;break;case le:case me:p=n.type===le?ne(n,f):oe(n,f,g,m);var r=p.length;if(0===r){g=n.centerX;m=n.centerY;if(a.kd(g,m)>e)return!1;break}n=null;for(var q=La(),u=0;u< r;u++)if(n=p[u],q.length=0,K.Ne(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.qa=null};function ao(a){var b=a.diagram;null!==b&&b.undoManager.isUndoingRedoing||(a.segmentOrientation=mn,"None"!==a.km?(a.segmentIndex=-1,a.alignmentFocus=sd):"None"!==a.nl&&(a.segmentIndex=0,a.alignmentFocus=new M(1-sd.x,sd.y)))} Yf.makeGeometry=function(a,b,c){if("None"!==a.toArrow)var d=bo[a.toArrow];else"None"!==a.fromArrow?d=bo[a.fromArrow]:(d=K.ke[a.figure],"string"===typeof d&&(d=K.ke[d]),void 0===d&&v("Unknown Shape.figure: "+a.figure),d=d(a,b,c),d.xl=b,d.wl=c);if(null===d){var e=K.ke.Rectangle;"function"===typeof e&&(d=e(a,b,c))}F&&(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 co(a){var b=bo[a];if(void 0===b){var c=a.toLowerCase();if("none"===c)return"None";b=bo[c];if(void 0===b){var d=null,e;for(e in K.an)if(e.toLowerCase()===c){d=e;break}if(null!==d)return a=Vd(K.an[d],!1),bo[d]=a,c!==d&&(bo[c]=d),d}}return"string"===typeof b?b:b instanceof Fd?a:null} ma.Object.defineProperties(Yf.prototype,{geometry:{configurable:!0,get:function(){return null!==this.qa?this.qa:this.Bd},set:function(a){var b=this.qa,c=this.Bd;if(b!==a){null!==a?(F&&w(a,Fd,Yf,"geometry"),this.Bd=this.qa=a.freeze()):this.Bd=this.qa=null;var d=this.part;null!==d&&(d.ph=NaN);this.u();this.g("geometry",b||c,a);vl(this)&&(a=this.part,null!==a&&wl(this,a,"geometryString"))}}},geometryString:{configurable:!0,get:function(){return null===this.geometry?"":this.geometry.toString()}, set:function(a){a=Vd(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.qo},set:function(a){F&&A(a,"boolean",Yf,"isGeometryPositioned");var b=this.qo;b!==a&&(this.qo=a,this.u(),this.g("isGeometryPositioned",b,a))}},fill:{configurable:!0,get:function(){return this.ll},set:function(a){var b=this.ll;b!==a&&(null!==a&&hm(a,"Shape.fill"),a instanceof Kl&&a.freeze(),this.ll= a,this.P(),this.g("fill",b,a))}},stroke:{configurable:!0,get:function(){return this.Jc},set:function(a){var b=this.Jc;b!==a&&(null!==a&&hm(a,"Shape.stroke"),a instanceof Kl&&a.freeze(),this.Jc=a,this.P(),this.g("stroke",b,a))}},strokeWidth:{configurable:!0,get:function(){return this.Bh},set:function(a){var b=this.Bh;if(b!==a)if(F&&C(a,Yf,"strokeWidth"),0<=a){this.Bh=a;this.u();var c=this.part;null!==c&&(c.ph=NaN);this.g("strokeWidth",b,a)}else ya(a,"value >= 0",Yf,"strokeWidth:value")}}, strokeCap:{configurable:!0,get:function(){return this.dm},set:function(a){var b=this.dm;b!==a&&("string"!==typeof a||"butt"!==a&&"round"!==a&&"square"!==a?ya(a,'"butt", "round", or "square"',Yf,"strokeCap"):(this.dm=a,this.P(),this.g("strokeCap",b,a)))}},strokeJoin:{configurable:!0,get:function(){return this.em},set:function(a){var b=this.em;b!==a&&("string"!==typeof a||"miter"!==a&&"bevel"!==a&&"round"!==a?ya(a,'"miter", "bevel", or "round"',Yf,"strokeJoin"):(this.em= a,this.P(),this.g("strokeJoin",b,a)))}},strokeMiterLimit:{configurable:!0,get:function(){return this.$j},set:function(a){var b=this.$j;if(b!==a)if(F&&C(a,Yf,"strokeMiterLimit"),1<=a){this.$j=a;this.P();var c=this.part;null!==c&&(c.ph=NaN);this.g("strokeMiterLimit",b,a)}else F&&ya(a,"value >= 1",Yf,"strokeWidth:value")}},strokeDashArray:{configurable:!0,get:function(){return this.zh},set:function(a){var b=this.zh;if(b!==a){null===a||Array.isArray(a)||xa(a,"Array",Yf,"strokeDashArray:value"); if(null!==a){for(var c=a.length,d=0,e=0;e<c;e++){var f=a[e];(!F||"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.zh=a;this.P();this.g("strokeDashArray",b,a)}}},strokeDashOffset:{configurable:!0,get:function(){return this.Ah},set:function(a){var b=this.Ah;b!==a&&(F&&C(a,Yf,"strokeDashOffset"),0<=a&&(this.Ah=a,this.P(),this.g("strokeDashOffset",b,a)))}},figure:{configurable:!0, enumerable:!0,get:function(){return this.Vn},set:function(a){var b=this.Vn;if(b!==a){F&&A(a,"string",Yf,"figure");var c=K.ke[a];"function"===typeof c?c=a:(c=K.ke[a.toLowerCase()])||v("Unknown Shape.figure: "+a);b!==c&&(a=this.part,null!==a&&(a.ph=NaN),this.Vn=c,this.Bd=null,this.ic(),this.u(),this.g("figure",b,c))}}},toArrow:{configurable:!0,get:function(){return this.km},set:function(a){var b=this.km;!0===a?a="Standard":!1===a&&(a="");if(b!==a){F&&A(a,"string",Yf,"toArrow");var c=co(a); null===c?v("Unknown Shape.toArrow: "+a):b!==c&&(this.km=c,this.Bd=null,this.ic(),this.u(),ao(this),this.g("toArrow",b,c))}}},fromArrow:{configurable:!0,get:function(){return this.nl},set:function(a){var b=this.nl;!0===a?a="Standard":!1===a&&(a="");if(b!==a){F&&A(a,"string",Yf,"fromArrow");var c=co(a);null===c?v("Unknown Shape.fromArrow: "+a):b!==c&&(this.nl=c,this.Bd=null,this.ic(),this.u(),ao(this),this.g("fromArrow",b,c))}}},spot1:{configurable:!0,get:function(){return this.vf}, set:function(a){w(a,M,Yf,"spot1");var b=this.vf;b.A(a)||(this.vf=a=a.J(),this.u(),this.g("spot1",b,a))}},spot2:{configurable:!0,get:function(){return this.wf},set:function(a){w(a,M,Yf,"spot2");var b=this.wf;b.A(a)||(this.wf=a=a.J(),this.u(),this.g("spot2",b,a))}},parameter1:{configurable:!0,get:function(){return this.pp},set:function(a){var b=this.pp;b!==a&&(this.pp=a,this.ic(),this.u(),this.g("parameter1",b,a))}},parameter2:{configurable:!0,get:function(){return this.qp}, set:function(a){var b=this.qp;b!==a&&(this.qp=a,this.ic(),this.u(),this.g("parameter2",b,a))}},naturalBounds:{configurable:!0,get:function(){if(null!==this.qa)return this.tc.assign(this.qa.bounds),this.tc;var a=this.desiredSize;return new L(0,0,a.width,a.height)}},pathPattern:{configurable:!0,get:function(){return this.sp},set:function(a){var b=this.sp;b!==a&&(F&&null!==a&&w(a,N,Yf,"pathPattern"),this.sp=a,this.P(),this.g("pathPattern",b,a))}},geometryStretch:{configurable:!0, enumerable:!0,get:function(){return this.co},set:function(a){var b=this.co;b!==a&&(hb(a,N,Yf,"geometryStretch"),this.co=a,this.g("geometryStretch",b,a))}},interval:{configurable:!0,get:function(){return this.Qd},set:function(a){var b=this.Qd;F&&C(a,Yf,"interval");a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Qd=a;var c=this.diagram;null!==c&&this.panel===c.grid&&Dj(c);this.u();c=this.panel;null!==c&&(c.jh=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0, get:function(){return this.Od},set:function(a){var b=this.Od;F&&C(a,Yf,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Od=a,this.u(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.Md},set:function(a){var b=this.Md;F&&C(a,Yf,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.Md=a,this.u(),this.g("graduatedEnd",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.Nd},set:function(a){var b=this.Nd;b!==a&&(null!==a&&A(a, "function",Yf,"graduatedSkip"),this.Nd=a,this.u(),this.g("graduatedSkip",b,a))}}});Yf.prototype.intersectsRect=Yf.prototype.Mc;Yf.prototype.containedInRect=Yf.prototype.Oh;Yf.prototype.getNearestIntersectionPoint=Yf.prototype.bd;Yf.prototype.getDocumentBounds=Yf.prototype.zm;Yf.prototype.getDocumentPoint=Yf.prototype.ma;var bo=new jb,Xn=new jb;Yf.className="Shape";Yf.getFigureGenerators=function(){var a=new Db,b;for(b in K.ke)b!==b.toLowerCase()&&a.add(b,K.ke[b]);a.freeze();return a}; Yf.defineFigureGenerator=function(a,b){A(a,"string",Yf,"defineFigureGenerator:name");"string"===typeof b?!F||""!==b&&K.ke[b]||v("Shape.defineFigureGenerator synonym must not be empty or None or not a defined figure name: "+b):A(b,"function",Yf,"defineFigureGenerator:func");var c=a.toLowerCase();!F||""!==a&&a!==c||v("Shape.defineFigureGenerator name must not be empty or all-lower-case: "+a);var d=K.ke;d[a]=b;d[c]=a}; Yf.getArrowheadGeometries=function(){var a=new Db;for(d in K.an)if(void 0===bo[d]){var b=Vd(K.an[d],!1);bo[d]=b;b=d.toLowerCase();b!==d&&(bo[b]=d)}for(var c in bo)if(c!==c.toLowerCase()){var d=bo[c];d instanceof Fd&&a.add(c,d)}a.freeze();return a}; Yf.defineArrowheadGeometry=function(a,b){A(a,"string",Yf,"defineArrowheadGeometry:name");"string"===typeof b?(A(b,"string",Yf,"defineArrowheadGeometry:pathstr"),b=Vd(b,!1)):w(b,Fd,Yf,"defineArrowheadGeometry:pathstr");var c=a.toLowerCase();(F&&""===a||"none"===c||a===c)&&v("Shape.defineArrowheadGeometry name must not be empty or None or all-lower-case: "+a);var d=bo;d[a]=b;d[c]=a}; function ih(){N.call(this);eo||(fo=gh?(new Sk(null)).context:null,eo=!0);this.Ax=this.Zb="";this.Jc="black";this.re="13px sans-serif";this.Ti="start";this.Ld=Mg;this.Xi=od;this.Jj=!0;this.Bi=this.Ci=!1;this.ug=go;this.Fg=ho;this.rs=this.vb=this.Uc=0;this.Xu=this.Yu=null;this.Sn=!1;this.Fc=this.un=this.hq=this.Ui=this.iq=null;this.uf=this.tf=0;this.Ae=Infinity;this.Ei=0;this.se=null;this.Ge=0;this.qe=this.nb=this.Wb=null;this.Qd=1;this.Od=0;this.Md=1;this.Nd=this.Fj=null}la(ih,N); ih.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.Zb=this.Zb;a.Ax=this.Ax;a.Jc=this.Jc;a.re=this.re;a.Ti=this.Ti;a.Ld=this.Ld;a.Xi=this.Xi;a.Jj=this.Jj;a.Ci=this.Ci;a.Bi=this.Bi;a.ug=this.ug;a.Fg=this.Fg;a.Uc=this.Uc;a.rs=this.rs;a.vb=this.vb;a.Yu=this.Yu;a.Xu=this.Xu;a.Sn=this.Sn;a.iq=this.iq;a.Ui=this.Ui;a.hq=this.hq;a.un=this.un;a.Fc=this.Fc;a.tf=this.tf;a.uf=this.uf;a.Ae=this.Ae;a.se=this.se;a.Ge=this.Ge;a.Wb=this.Wb;a.nb=this.nb;a.qe=this.qe;a.Ei=this.Ei;a.Qd= this.Qd;a.Od=this.Od;a.Md=this.Md;a.Fj=this.Fj;a.Nd=this.Nd}; function ln(a,b){a.I=b.I|6144;a.wb=b.opacity;a.ob=b.background;a.jc=b.areaBackground;a.Sc=b.desiredSize.J();a.ng=b.minSize.J();a.mg=b.maxSize.J();a.kg=b.kg.copy();a.Fa=b.scale;a.dc=b.angle;a.Je=b.stretch;a.oh=b.margin.J();a.Bb=b.alignment.J();a.Sk=b.alignmentFocus.J();a.Ul=b.segmentFraction;a.Vl=b.segmentOffset.J();a.Wl=b.segmentOrientation;null!==b.sd&&(a.sd=b.sd.copy());a.Yl=b.shadowVisible;b instanceof ih&&(a.Zb=b.Zb,a.Jc=b.Jc,a.re=b.re,a.Ti=b.Ti,a.Ld=b.Ld,a.Xi=b.Xi,a.Jj=b.Jj,a.Ci=b.Ci,a.Bi=b.Bi, a.ug=b.ug,a.Fg=b.Fg,a.se=null,a.tf=b.tf,a.uf=b.uf,a.Ae=b.Ae,a.Ei=b.Ei,a.Qd=b.Qd,a.Od=b.Od,a.Md=b.Md,a.Fj=b.Fj,a.Nd=b.Nd)}t=ih.prototype;t.mb=function(a){a.classType===ih?this.wrap=a:N.prototype.mb.call(this,a)};t.toString=function(){return 22<this.Zb.length?'TextBlock("'+this.Zb.substring(0,20)+'"...)':'TextBlock("'+this.Zb+'")'};t.u=function(){N.prototype.u.call(this);this.Xu=this.Yu=null}; function io(a){eo||(fo=gh?(new Sk(null)).context:null,eo=!0);if(null===fo)return!0;var b=fo.font;if(a===b||"10px sans-serif"===a)return!0;fo.font="10px sans-serif";fo.font=a;var c=fo.font;if("10px sans-serif"!==c)return fo.font=b,!0;fo.font="19px serif";var d=fo.font;fo.font=a;c=fo.font;fo.font=b;return c!==d} t.aj=function(a,b){if(null!==this.Jc&&0!==this.Zb.length&&null!==this.re){var c=this.naturalBounds,d=this.actualBounds,e=c.width,f=c.height,g=jo(this),h=a.textAlign=this.Ti,k=b.Al;"start"===h?h=k?"right":"left":"end"===h&&(h=k?"left":"right");k=this.Ci;var l=this.Bi;zi(this,a,this.Jc,!0,!1,c,d);(k||l)&&zi(this,a,this.Jc,!1,!1,c,d);d=0;c=!1;var m=J.allocAt(0,0);this.Cd.xa(m);var n=J.allocAt(0,g);this.Cd.xa(n);var p=m.Pe(n);J.free(m);J.free(n);m=b.scale;8>p*m*m&&(c=!0);b.Kb!==a&&(c=!1);!1===b.Qe("textGreeking")&& (c=!1);b=this.tf;p=this.uf;switch(this.flip){case ql:a.translate(e,0);a.scale(-1,1);break;case pl:a.translate(0,f);a.scale(1,-1);break;case rl:a.translate(e,f),a.scale(-1,-1)}m=this.Uc;n=(b+g+p)*m;f>n&&(d=this.Xi,d=d.y*f-d.y*n+d.offsetY);if(1===m&&null!==this.qe)p=this.vb,p>e&&(p=e),this.$i(this.qe,a,0,d+b,e,g,p,c,h,k,l);else if(null!==this.Wb&&null!==this.nb)for(n=0;n<m;n++){var r=this.Wb[n];r>e&&(r=e);d+=b;this.$i(this.nb[n],a,0,d,e,g,r,c,h,k,l);d+=g+p}switch(this.flip){case ql:a.scale(-1,1);a.translate(-e, 0);break;case pl:a.scale(1,-1);a.translate(0,-f);break;case rl:a.scale(-1,-1),a.translate(-e,-f)}}}; t.$i=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!==ko?ko(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!==lo?lo(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.Gm=function(a,b,c,d){this.Ei=a;var e=this.re;null!==fo&&mo!==e&&(mo=fo.font=e);this.vb=this.Ge=0;this.qe=this.nb=this.Wb=this.se=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);f=Math.max(f,no(e.substr(g,k-g).trim()));g=k+1}e=f}else f=e.indexOf("\n",0),0<=f&&(e=e.substr(0,f)),e=no(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=oo(this,e);isNaN(this.desiredSize.height)?f=Math.min(f,b/this.scale):f=this.desiredSize.height;g=f;if(0!==this.vb&&null!==this.Wb&&null!==this.nb&&this.ug===po&&(b=this.re,b=this.ug===po?qo(b):0,h=this.tf+this.uf,h=Math.max(0,jo(this)+h),g=Math.min(this.maxLines-1,Math.max(Math.floor(g/h+.01)-1,0)),!(g+1>=this.nb.length))){h=this.nb[g];for(b=Math.max(1,a-b);no(h)>b&&1<h.length;)h=h.substr(0,h.length-1);h+=ro;b=no(h); this.nb[g]=h;this.nb=this.nb.slice(0,g+1);this.Wb[g]=b;this.Wb=this.Wb.slice(0,g+1);this.Ge=this.nb.length;this.vb=Math.max(this.vb,b);this.Uc=this.Ge;1===this.Uc&&(this.qe=this.nb[0])}if(this.wrap===so||isNaN(this.desiredSize.width))e=isNaN(a)?this.vb:Math.min(a,this.vb),isNaN(this.desiredSize.width)&&(e=Math.max(8,e));e=Math.max(c,e);f=Math.max(d,f);gc(this.tc,e,f);yl(this,0,0,e,f)};t.Nh=function(a,b,c,d){Dl(this,a,b,c,d)}; function to(a,b,c){if(null===a.qe)a.qe=b,a.vb=c;else{if(null===a.nb||null===a.Wb)a.nb=[],a.Wb=[],a.nb.push(a.qe),a.Wb.push(a.vb);a.nb.push(b);a.Wb.push(c)}} function uo(a,b,c,d){b=b.trim();var e=0;var f=a.re;var g=a.tf+a.uf;g=Math.max(0,jo(a)+g);var h=a.ug===po?qo(f):0;if(a.Uc>=a.Ae)null!==d&&d.h(0,g);else{var k=b;if(a.Fg===vo)if(a.Ge=1,f=no(b),0===h||f<=c)a.vb=Math.max(a.vb,f),to(a,b,a.vb),null!==d&&d.h(f,g);else{e=wo(a,k);k=k.substr(e.length);b=wo(a,k);for(f=no(e+b);0<b.length&&f<=c;)e+=b,k=k.substr(b.length),b=wo(a,k),f=no((e+b).trim());e+=b.trim();for(c=Math.max(1,c-h);no(e)>c&&1<e.length;)e=e.substr(0,e.length-1);e+=ro;b=no(e);a.vb=b;to(a,e,b);null!== d&&d.h(b,g)}else{h=0;0===k.length&&(h=1,to(a,k,0));for(;0<k.length;){var l=wo(a,k);for(k=k.substr(l.length);no(l)>c;){var m=1;f=no(l.substr(0,m));for(b=0;f<=c;)m++,b=f,f=no(l.substr(0,m));if(1===m){var n=f;e=Math.max(e,f)}else n=b,e=Math.max(e,b);m--;1>m&&(m=1);to(a,l.substr(0,m),n);h++;l=l.substr(m);if(a.Uc+h>a.Ae)break}b=wo(a,k);for(f=no(l+b);0<b.length&&f<=c;)l+=b,k=k.substr(b.length),b=wo(a,k),f=no((l+b).trim());l=l.trim();if(""!==l&&("\u00ad"===l[l.length-1]&&(l=l.substring(0,l.length-1)+"\u2010"), 0===b.length?(m=f,e=Math.max(e,f)):(m=b=no(l),e=Math.max(e,b)),to(a,l,m),h++,a.Uc+h>a.Ae))break}a.Ge=Math.min(a.Ae,h);a.vb=Math.max(a.vb,e);null!==d&&d.h(a.vb,g*a.Ge)}}}function wo(a,b){if(a.Fg===xo)return b.substr(0,1);a=b.length;for(var c=0,d=yo;c<a&&!d.test(b.charAt(c));)c++;for(;c<a&&d.test(b.charAt(c));)c++;return c>=a?b:b.substr(0,c)}function no(a){return null===fo?8*a.length:fo.measureText(a).width} function jo(a){if(null!==a.se)return a.se;var b=a.re;if(null===fo){var c=16;return a.se=c}void 0!==zo[b]&&5E3>Ao?c=zo[b]:(c=1.3*fo.measureText("M").width,zo[b]=c,Ao++);return a.se=c}function qo(a){if(null===fo)return 6;if(void 0!==Bo[a]&&5E3>Co)var b=Bo[a];else b=fo.measureText(ro).width,Bo[a]=b,Co++;return b} function oo(a,b){var c=a.Zb.replace(/\r\n/g,"\n").replace(/\r/g,"\n"),d=a.tf+a.uf;d=Math.max(0,jo(a)+d);if(0===c.length)return a.vb=0,a.Uc=1,d;if(!a.isMultiline){var e=c.indexOf("\n",0);0<=e&&(c=c.substr(0,e))}e=0;for(var f=a.Uc=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.Fg!==vo){a.Ge=0;var k=Hb.alloc();uo(a,f,b,k);e+=k.height;Hb.free(k);a.Uc+=a.Ge}else uo(a,f,b,null),e+=d,a.Uc++;a.Uc===a.Ae&&(h=!0)}f=g+1}return a.rs=e} ma.Object.defineProperties(ih.prototype,{font:{configurable:!0,get:function(){return this.re},set:function(a){var b=this.re;b!==a&&(F&&(A(a,"string",ih,"font"),io(a)||v('Not a valid font: "'+a+'"')),this.re=a,this.se=null,this.u(),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.u(),this.g("text",b,a))}},textAlign:{configurable:!0,get:function(){return this.Ti}, set:function(a){var b=this.Ti;b!==a&&(F&&A(a,"string",ih,"textAlign"),"start"===a||"end"===a||"left"===a||"right"===a||"center"===a?(this.Ti=a,this.P(),this.g("textAlign",b,a)):F&&ya(a,'"start", "end", "left", "right", or "center"',ih,"textAlign"))}},flip:{configurable:!0,get:function(){return this.Ld},set:function(a){var b=this.Ld;b!==a&&(hb(a,N,ih,"flip"),this.Ld=a,this.P(),this.g("flip",b,a))}},verticalAlignment:{configurable:!0,get:function(){return this.Xi},set:function(a){var b= this.Xi;b.A(a)||(F&&(w(a,M,ih,"verticalAlignment"),a.Sb()&&v("TextBlock.verticalAlignment for "+this+" must be a real Spot, not:"+a)),this.Xi=a=a.J(),Tl(this),this.g("verticalAlignment",b,a))}},naturalBounds:{configurable:!0,get:function(){if(!this.tc.o()){var a=Hb.alloc();uo(this,this.Zb,999999,a);var b=a.width;Hb.free(a);a=oo(this,b);var c=this.desiredSize;isNaN(c.width)||(b=c.width);isNaN(c.height)||(a=c.height);gc(this.tc,b,a)}return this.tc}},isMultiline:{configurable:!0, get:function(){return this.Jj},set:function(a){var b=this.Jj;b!==a&&(F&&A(a,"boolean",ih,"isMultiline"),this.Jj=a,this.u(),this.g("isMultiline",b,a))}},isUnderline:{configurable:!0,get:function(){return this.Ci},set:function(a){var b=this.Ci;b!==a&&(F&&A(a,"boolean",ih,"isUnderline"),this.Ci=a,this.P(),this.g("isUnderline",b,a))}},isStrikethrough:{configurable:!0,get:function(){return this.Bi},set:function(a){var b=this.Bi;b!==a&&(F&&A(a,"boolean",ih,"isStrikethrough"), this.Bi=a,this.P(),this.g("isStrikethrough",b,a))}},wrap:{configurable:!0,get:function(){return this.Fg},set:function(a){var b=this.Fg;b!==a&&(F&&hb(a,ih,ih,"wrap"),this.Fg=a,this.u(),this.g("wrap",b,a))}},overflow:{configurable:!0,get:function(){return this.ug},set:function(a){var b=this.ug;b!==a&&(F&&hb(a,ih,ih,"overflow"),this.ug=a,this.u(),this.g("overflow",b,a))}},stroke:{configurable:!0,get:function(){return this.Jc},set:function(a){var b=this.Jc;b!== a&&(null!==a&&hm(a,"TextBlock.stroke"),a instanceof Kl&&a.freeze(),this.Jc=a,this.P(),this.g("stroke",b,a))}},lineCount:{configurable:!0,get:function(){return this.Uc}},editable:{configurable:!0,get:function(){return this.Sn},set:function(a){var b=this.Sn;b!==a&&(F&&A(a,"boolean",ih,"editable"),this.Sn=a,this.g("editable",b,a))}},textEditor:{configurable:!0,get:function(){return this.iq},set:function(a){var b=this.iq;b!==a&&(!F||a instanceof bf||v("TextBlock.textEditor must be an HTMLInfo."), this.iq=a,this.g("textEditor",b,a))}},errorFunction:{configurable:!0,get:function(){return this.Fc},set:function(a){var b=this.Fc;b!==a&&(null!==a&&A(a,"function",ih,"errorFunction"),this.Fc=a,this.g("errorFunction",b,a))}},interval:{configurable:!0,get:function(){return this.Qd},set:function(a){var b=this.Qd;F&&C(a,ih,"interval");a=Math.round(a);if(b!==a&&0!==a&&isFinite(a)){this.Qd=a;this.u();var c=this.panel;null!==c&&(c.jh=null);this.g("interval",b,a)}}},graduatedStart:{configurable:!0, enumerable:!0,get:function(){return this.Od},set:function(a){var b=this.Od;F&&C(a,ih,"graduatedStart");b!==a&&(0>a?a=0:1<a&&(a=1),this.Od=a,this.u(),this.g("graduatedStart",b,a))}},graduatedEnd:{configurable:!0,get:function(){return this.Md},set:function(a){var b=this.Md;F&&C(a,ih,"graduatedEnd");b!==a&&(0>a?a=0:1<a&&(a=1),this.Md=a,this.u(),this.g("graduatedEnd",b,a))}},graduatedFunction:{configurable:!0,get:function(){return this.Fj},set:function(a){var b=this.Fj;b!== a&&(null!==a&&A(a,"function",ih,"graduatedFunction"),this.Fj=a,this.u(),this.g("graduatedFunction",b,a))}},graduatedSkip:{configurable:!0,get:function(){return this.Nd},set:function(a){var b=this.Nd;b!==a&&(null!==a&&A(a,"function",ih,"graduatedSkip"),this.Nd=a,this.u(),this.g("graduatedSkip",b,a))}},textValidation:{configurable:!0,get:function(){return this.Ui},set:function(a){var b=this.Ui;b!==a&&(null!==a&&A(a,"function",ih,"textValidation"),this.Ui=a,this.g("textValidation", b,a))}},textEdited:{configurable:!0,get:function(){return this.hq},set:function(a){var b=this.hq;b!==a&&(null!==a&&A(a,"function",ih,"textEdited"),this.hq=a,this.g("textEdited",b,a))}},spacingAbove:{configurable:!0,get:function(){return this.tf},set:function(a){var b=this.tf;b!==a&&(F&&A(a,"number",ih,"spacingAbove"),this.tf=a,this.g("spacingAbove",b,a))}},spacingBelow:{configurable:!0,get:function(){return this.uf},set:function(a){var b=this.uf;b!==a&&(F&& A(a,"number",ih,"spacingBelow"),this.uf=a,this.g("spacingBelow",b,a))}},maxLines:{configurable:!0,get:function(){return this.Ae},set:function(a){var b=this.Ae;b!==a&&(F&&A(a,"number",ih,"maxLines"),a=Math.floor(a),0>=a&&ya(a,"> 0",ih,"maxLines"),this.Ae=a,this.g("maxLines",b,a),this.u())}},metrics:{configurable:!0,get:function(){return{arrSize:null!==this.Wb?this.Wb:[this.vb],arrText:null!==this.nb?this.nb:[this.qe],maxLineWidth:this.vb,fontHeight:this.se}}},choices:{configurable:!0, enumerable:!0,get:function(){return this.un},set:function(a){var b=this.un;b!==a&&(F&&null!==a&&!Array.isArray(a)&&xa(a,"Array",ih,"choices:value"),this.un=a,this.g("choices",b,a))}}});var ko=null,lo=null,vo=new E(ih,"None",0),so=new E(ih,"WrapFit",1),ho=new E(ih,"WrapDesiredSize",2),xo=new E(ih,"WrapBreakAll",3),go=new E(ih,"OverflowClip",0),po=new E(ih,"OverflowEllipsis",1),yo=/[ \u200b\u00ad]/,zo=new jb,Ao=0,Bo=new jb,Co=0,ro="...",mo="",fo=null,eo=!1;ih.className="TextBlock";ih.getEllipsis=function(){return ro}; ih.setEllipsis=function(a){ro=a;Bo=new jb;Co=0};ih.getBaseline=function(){return ko};ih.setBaseline=function(a){ko=a;a=Wa();for(var b=a.length,c=0;c<b;c++)a[c].ge()};ih.getUnderline=function(){return lo};ih.setUnderline=function(a){lo=a;a=Wa();for(var b=a.length,c=0;c<b;c++)a[c].ge()};ih.isValidFont=io;ih.None=vo;ih.WrapFit=so;ih.WrapDesiredSize=ho;ih.WrapBreakAll=xo;ih.OverflowClip=go;ih.OverflowEllipsis=po;function Do(){this.Wb=[];this.nb=[]}Do.prototype.reset=function(){this.Wb=[];this.nb=[]}; Do.prototype.vt=function(a){this.Wb=Ia(a.Wb);this.nb=Ia(a.nb)};Do.className="TextBlockMetrics";function xk(){N.call(this);this.eh=null;this.Zp="";this.yh=wc;this.sl=Hd;this.xf=this.Fc=null;this.rl=Mc;this.Ld=Mg;this.gm=null;this.Lu=!1;this.ml=!0;this.Il=!1;this.$l=null}la(xk,N);xk.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.element=this.eh;a.Zp=this.Zp;a.yh=this.yh.J();a.sl=this.sl;a.Ld=this.Ld;a.Fc=this.Fc;a.xf=this.xf;a.rl=this.rl.J();a.ml=this.ml;a.$l=this.$l}; t=xk.prototype;t.mb=function(a){a===Mg||a===Og||a===ol?this.imageStretch=a:N.prototype.mb.call(this,a)};t.toString=function(){return"Picture("+this.source+")#"+pb(this)};function Ck(a){void 0===a&&(a="");A(a,"string",xk,"clearCache:url");""!==a?Eo[a]&&(delete Eo[a],Fo--):(Eo=new jb,Fo=0)} function Go(a,b){a.fs=!0;a.ol=!1;for(var c,d=Wa(),e=d.length,f=0;f<e;f++){var g=d[f];c=a.getAttribute("src");var h=g.Ni.K(c);if(null!==h)for(var k=h.length,l=0;l<k;l++)c=h[l],g.Is.add(c),g.Vb(),void 0===a.gv&&(a.gv=b,null!==c.xf&&c.xf(c,b))}}function Ho(a,b){a.ol=b;for(var c,d=Wa(),e=d.length,f=0;f<e;f++){var g=d[f],h=a.getAttribute("src");c=g.Ni.K(h);if(null!==c){g=c.length;h=La();for(var k=0;k<g;k++)h.push(c[k]);for(k=0;k<g;k++)c=h[k],null!==c.Fc&&c.Fc(c,b);Oa(h)}}} t.IA=function(){if(""!==this.source){Ck(this.source);var a=this.source;this.source="";this.source=a}};t.ge=function(){this.P()}; t.aj=function(a,b){var c=this.eh;if(null!==c){var d=c.getAttribute("src");c instanceof HTMLImageElement&&(null===d||""===d)&&v('Element has no source ("src") attribute: '+c);if(!(c.ol instanceof Event)){d=this.naturalBounds;var e=0,f=0,g=this.Lu,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.o()&&(e=this.yh.x,f=this.yh.y,h=this.yh.width, g=this.yh.height);var m=h,n=g,p=this.sl,r=this.rl;switch(p){case Mg:if(this.sourceRect.o())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 Hd:m=d.width;n=d.height;break;case Og:case ol:p===Og?(p=Math.min(d.height/n,d.width/m),m*=p,n*=p):p===ol&&(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.Gf()*b.scale;var q=m*p*n*p,u=h*g/q,x=c.__goCache;p=null;var y=Io;if(c.fs&&void 0!==x&&4<q&&u>y*y)for(null===x.Zi&&(Jo(x,4,k,l,c),Jo(x,16,k,l,c)),k=x.Zi,l=k.length,q=0;q<l;q++)if(k[q].ratio*k[q].ratio<u)p=k[q];else break;if(!b.jl){if(null===this.gm)if(null===this.eh)this.gm=!1;else{k=(new Sk(null)).context;k.drawImage(this.eh,0,0);try{k.getImageData(0,0,1,1).data[3]&&(this.gm=!1),this.gm=!1}catch(z){this.gm=!0}}if(this.gm)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 ql:a.translate(Math.min(d.width,m),0);a.scale(-1,1);break;case pl:a.translate(0,Math.min(d.height,n));a.scale(1,-1);break;case rl:a.translate(Math.min(d.width,m),Math.min(d.height,n)),a.scale(-1,-1)}if(b.Qe("pictureRatioOptimization")&&!b.zi&&void 0!==x&&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){F&&this.ml&&Ca(z.toString()),this.ml=!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){F&&this.ml&&Ca(z.toString()),this.ml=!1}switch(this.flip){case ql:a.scale(-1,1);a.translate(-Math.min(d.width,m),0);break;case pl:a.scale(1,-1);a.translate(0,-Math.min(d.height,n));break;case rl:a.scale(-1,-1),a.translate(-Math.min(d.width,m),-Math.min(d.height,n))}}}}}; t.Gm=function(a,b,c,d){var e=this.desiredSize,f=Bl(this,!0),g=this.eh,h=this.Lu;if(h||!this.Il&&g&&g.complete)this.Il=!0;null===g&&(isFinite(e.width)||(a=0),isFinite(e.height)||(b=0));isFinite(e.width)||f===Hd||f===ml?(isFinite(a)||(a=this.sourceRect.o()?this.sourceRect.width:h?+g.width:g.naturalWidth),c=0):null!==g&&!1!==this.Il&&(a=this.sourceRect.o()?this.sourceRect.width:h?+g.width:g.naturalWidth);isFinite(e.height)||f===Hd||f===nl?(isFinite(b)||(b=this.sourceRect.o()?this.sourceRect.height:h? +g.height:g.naturalHeight),d=0):null!==g&&!1!==this.Il&&(b=this.sourceRect.o()?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));gc(this.tc,a,b);yl(this,0,0,a,b)};t.Nh=function(a,b,c,d){Dl(this,a,b,c,d)}; ma.Object.defineProperties(xk.prototype,{element:{configurable:!0,get:function(){return this.eh},set:function(a){var b=this.eh;if(b!==a){null===a||a instanceof HTMLImageElement||a instanceof HTMLVideoElement||a instanceof HTMLCanvasElement||v("Picture.element must be an instance of Image, Canvas, or Video, not: "+a);this.Lu=a instanceof HTMLCanvasElement;this.eh=a;if(null!==a)if(a instanceof HTMLCanvasElement||!0===a.complete)a.ol instanceof Event&&null!==this.Fc&&this.Fc(this,a.ol), !0===a.fs&&null!==this.xf&&this.xf(this,a.gv),a.fs=!0,this.desiredSize.o()||(Cj(this,!1),this.u());else{var c=this;a.ox||(a.addEventListener("load",function(b){Go(a,b);c.desiredSize.o()||(Cj(c,!1),c.u())}),a.addEventListener("error",function(b){Ho(a,b)}),a.ox=!0)}this.g("element",b,a);this.P()}}},source:{configurable:!0,get:function(){return this.Zp},set:function(a){var b=this.Zp;if(b!==a){A(a,"string",xk,"source");this.Zp=a;var c=Eo,d=this.diagram,e=null;if(void 0!==c[a])e=c[a];else{30< Fo&&(Ck(),c=Eo);e=ua("img");var f=this;e.addEventListener("load",function(a){Go(e,a);f.desiredSize.o()||(Cj(f,!1),f.u())});e.addEventListener("error",function(a){Ho(e,a)});e.ox=!0;var g=this.$l;null!==g&&(e.crossOrigin=g(this));e.src=a;c[a]=e;Fo++}null!==d&&Bk(d,this);this.element=e;null!==d&&nk(d,this);void 0===e.__goCache&&(e.__goCache=new Ko);this.u();this.P();this.g("source",b,a)}}},sourceCrossOrigin:{configurable:!0,get:function(){return this.$l},set:function(a){if(this.$l!==a&& (null!==a&&A(a,"function",xk,"sourceCrossOrigin"),this.$l=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.yh},set:function(a){var b=this.yh;b.A(a)||(w(a,L,xk,"sourceRect"),this.yh=a=a.J(),this.P(),this.g("sourceRect",b,a))}},imageStretch:{configurable:!0,get:function(){return this.sl}, set:function(a){var b=this.sl;b!==a&&(hb(a,N,xk,"imageStretch"),this.sl=a,this.P(),this.g("imageStretch",b,a))}},flip:{configurable:!0,get:function(){return this.Ld},set:function(a){var b=this.Ld;b!==a&&(hb(a,N,xk,"flip"),this.Ld=a,this.P(),this.g("flip",b,a))}},imageAlignment:{configurable:!0,get:function(){return this.rl},set:function(a){w(a,M,xk,"imageAlignment");var b=this.rl;b.A(a)||(this.rl=a=a.J(),this.u(),this.g("imageAlignment",b,a))}},errorFunction:{configurable:!0, enumerable:!0,get:function(){return this.Fc},set:function(a){var b=this.Fc;b!==a&&(null!==a&&A(a,"function",xk,"errorFunction"),this.Fc=a,this.g("errorFunction",b,a))}},successFunction:{configurable:!0,get:function(){return this.xf},set:function(a){var b=this.xf;b!==a&&(null!==a&&A(a,"function",xk,"successFunction"),this.xf=a,this.g("successFunction",b,a))}},naturalBounds:{configurable:!0,get:function(){return this.tc}}});xk.prototype.redraw=xk.prototype.ge; xk.prototype.reloadSource=xk.prototype.IA;var Eo=null,Fo=0,Io=4;xk.className="Picture";Eo=new jb;xk.clearCache=Ck;function Ko(){this.Zi=null}function Jo(a,b,c,d,e){null===a.Zi&&(a.Zi=[]);var f=new Sk(null),g=f.context,h=1/b;f.width=c/b;f.height=d/b;0!==f.width&&0!==f.height&&(b=new Lo(f.Ja,b),c=1,0<a.Zi.length&&(c=a.Zi[a.Zi.length-1],e=c.source,c=c.ratio),g.setTransform(h*c,0,0,h*c,0,0),g.drawImage(e,0,0),a.Zi.push(b))}Ko.className="PictureCacheArray";function Lo(a,b){this.source=a;this.ratio=b} Lo.className="PictureCacheInstance";function Mo(){this.Dt=new Fd;this.lc=null}t=Mo.prototype;t.reset=function(a){null!==a?(a.ka(),this.Dt=a,a.figures.clear()):this.Dt=new Fd;this.lc=null};function Xd(a,b,c,d,e){a.lc=new te;a.lc.startX=b;a.lc.startY=c;a.lc.isFilled=d;a.Dt.figures.add(a.lc);void 0!==e&&(a.lc.isShadowed=e)}function ee(a){var b=a.lc.segments.length;0<b&&a.lc.segments.O(b-1).close()}t.br=function(a){this.lc.isShadowed=a}; t.moveTo=function(a,b,c){void 0===c&&(c=!1);var d=new ue(ie);d.endX=a;d.endY=b;c&&d.close();this.lc.segments.add(d)};t.lineTo=function(a,b,c){void 0===c&&(c=!1);var d=new ue(Kd);d.endX=a;d.endY=b;c&&d.close();this.lc.segments.add(d)};function Yd(a,b,c,d,e,f,g){var h;void 0===h&&(h=!1);var k=new ue(je);k.point1X=b;k.point1Y=c;k.point2X=d;k.point2Y=e;k.endX=f;k.endY=g;h&&k.close();a.lc.segments.add(k)} function Zd(a,b,c,d,e){var f;void 0===f&&(f=!1);var g=new ue(ke);g.point1X=b;g.point1Y=c;g.endX=d;g.endY=e;f&&g.close();a.lc.segments.add(g)}t.arcTo=function(a,b,c,d,e,f,g){void 0===f&&(f=0);void 0===g&&(g=!1);var h=new ue(le);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.lc.segments.add(h)};function de(a,b,c,d,e,f,g,h){var k;void 0===k&&(k=!1);b=new ue(me,g,h,b,c,d,e,f);k&&b.close();a.lc.segments.add(b)} function Wd(a){var b=fe;if(null!==b)return fe=null,b.reset(a),b;b=new Mo;b.reset(a);return b}var fe=null;Mo.className="StreamGeometryContext";function No(a,b){var c=a.toLowerCase(),d=K.ke;d[a]=b;d[c]=a}No("Rectangle",function(a,b,c){a="r"+b+","+c;var d=K.Wh[a];if(void 0!==d)return d;d=new Fd(Md);d.endX=b;d.endY=c;50>K.Xh&&(K.Wh[a]=d,K.Xh++);return d}); No("Square",function(a,b,c){a="s"+b+","+c;var d=K.Wh[a];if(void 0!==d)return d;d=new Fd(Md);d.endX=b;d.endY=c;d.defaultStretch=Og;50>K.Xh&&(K.Wh[a]=d,K.Xh++);return d}); No("RoundedRectangle",function(a,b,c){var d=a?a.parameter1:NaN;if(isNaN(d)||0>d)d=5;d=Math.min(d,b/3);d=Math.min(d,c/3);a=d*K.Rg;b=(new Fd).add((new te(d,0,!0)).add(new ue(Kd,b-d,0)).add(new ue(je,b,d,b-a,0,b,a)).add(new ue(Kd,b,c-d)).add(new ue(je,b-d,c,b,c-a,b-a,c)).add(new ue(Kd,d,c)).add(new ue(je,0,c-d,a,c,0,c-a)).add(new ue(Kd,0,d)).add((new ue(je,d,0,0,a,a,0)).close()));1<a&&(b.spot1=new M(0,0,a,a),b.spot2=new M(1,1,-a,-a));return b});No("Border","RoundedRectangle"); No("Ellipse",function(a,b,c){a="e"+b+","+c;var d=K.Wh[a];if(void 0!==d)return d;d=new Fd(Ud);d.endX=b;d.endY=c;d.spot1=ud;d.spot2=vd;50>K.Xh&&(K.Wh[a]=d,K.Xh++);return d});No("Circle",function(a,b,c){a="c"+b+","+c;var d=K.Wh[a];if(void 0!==d)return d;d=new Fd(Ud);d.endX=b;d.endY=c;d.spot1=ud;d.spot2=vd;d.defaultStretch=Og;50>K.Xh&&(K.Wh[a]=d,K.Xh++);return d});No("TriangleRight",function(a,b,c){return(new Fd).add((new te(0,0)).add(new ue(Kd,b,.5*c)).add((new ue(Kd,0,c)).close())).Ym(0,.25,.5,.75)}); No("TriangleDown",function(a,b,c){return(new Fd).add((new te(0,0)).add(new ue(Kd,b,0)).add((new ue(Kd,.5*b,c)).close())).Ym(.25,0,.75,.5)});No("TriangleLeft",function(a,b,c){return(new Fd).add((new te(b,c)).add(new ue(Kd,0,.5*c)).add((new ue(Kd,b,0)).close())).Ym(.5,.25,1,.75)});No("TriangleUp",function(a,b,c){return(new Fd).add((new te(b,c)).add(new ue(Kd,0,c)).add((new ue(Kd,.5*b,0)).close())).Ym(.25,.5,.75,1)});No("Triangle","TriangleUp"); No("Diamond",function(a,b,c){return(new Fd).add((new te(.5*b,0)).add(new ue(Kd,0,.5*c)).add(new ue(Kd,.5*b,c)).add((new ue(Kd,b,.5*c)).close())).Ym(.25,.25,.75,.75)});No("LineH",function(a,b,c){a=new Fd(Id);a.startX=0;a.startY=c/2;a.endX=b;a.endY=c/2;return a});No("LineV",function(a,b,c){a=new Fd(Id);a.startX=b/2;a.startY=0;a.endX=b/2;a.endY=c;return a});No("None","Rectangle");No("BarH","Rectangle");No("BarV","Rectangle");No("MinusLine","LineH"); No("PlusLine",function(a,b,c){return(new Fd).add((new te(0,c/2,!1)).add(new ue(Kd,b,c/2)).add(new ue(ie,b/2,0)).add(new ue(Kd,b/2,c)))});No("XLine",function(a,b,c){return(new Fd).add((new te(0,c,!1)).add(new ue(Kd,b,0)).add(new ue(ie,0,0)).add(new ue(Kd,b,c)))}); K.an={"":"",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 S(a){U.call(this,a);this.F=2408959;this.nh=this.Uf="";this.Dp=this.zp=this.Op=this.Co=null;this.Qp="";this.Qf=this.no=this.Pp=this.xh=null;this.Bp="";this.Ap=cc;this.Zb=this.Ep="";this.Fi=this.xn=this.oi=null;this.lg=(new J(NaN,NaN)).freeze();this.Jo="";this.jf=null;this.Ko=Hc;this.Fp=ld;this.To=Sb;this.Lo=Tb;this.Pn=null;this.Do=127;this.Up=Ub;this.Tp="gray";this.rf=4;this.qx=-1;this.rq=NaN;this.Sy=new L;this.Rj=null;this.ph=NaN}la(S,U); S.prototype.cloneProtected=function(a){U.prototype.cloneProtected.call(this,a);a.F=this.F&-4097|49152;a.Uf=this.Uf;a.nh=this.nh;a.Co=this.Co;a.Op=this.Op;a.zp=this.zp;a.Dp=this.Dp;a.Qp=this.Qp;a.Pp=this.Pp;a.no=this.no;a.Qf=null;a.Bp=this.Bp;a.Ap=this.Ap.J();a.Ep=this.Ep;a.Fp=this.Fp.J();a.Zb=this.Zb;a.xn=this.xn;a.lg.assign(this.lg);a.Jo=this.Jo;a.Ko=this.Ko.J();a.To=this.To.J();a.Lo=this.Lo.J();a.Pn=this.Pn;a.Do=this.Do;a.Up=this.Up.J();a.Tp=this.Tp;a.rf=this.rf;a.rq=this.rq}; S.prototype.Ef=function(a){U.prototype.Ef.call(this,a);a.Rh();a.xh=null;a.jf=null;a.Rj=null};S.prototype.toString=function(){var a=Pa(this.constructor)+"#"+pb(this);null!==this.data&&(a+="("+Qa(this.data)+")");return a};S.prototype.Hk=function(a,b,c,d,e,f,g){var h=this.diagram;null!==h&&(a===Je&&"elements"===b?e instanceof U?Uj(e,function(a){Wj(h.partManager,a);Vj(h,a)}):nk(h,e):a===Ke&&"elements"===b&&(e instanceof U?Uj(e,function(a){Zj(h.partManager,a,h)}):Bk(h,e)),h.gb(a,b,c,d,e,f,g))}; S.prototype.Ga=function(a){U.prototype.Ga.call(this,a);if(null!==this.data){for(var b=this.Z.j,c=b.length,d=0;d<c;d++){var e=b[d];e instanceof U&&Uj(e,function(a){null!==a.data&&a.Ga()})}for(b=this.adornments;b.next();)b.value.Ga(a)}};S.prototype.updateRelationshipsFromData=function(){null!==this.data&&this.diagram.partManager.updateRelationshipsFromData(this)};S.prototype.sk=function(a){F&&A(a,"string",S,"findAdornment:category");var b=this.Qf;return null===b?null:b.K(a)}; S.prototype.Kh=function(a,b){if(null!==b){F&&(A(a,"string",S,"addAdornment:category"),w(b,Te,S,"addAdornment:ad"));var c=null,d=this.Qf;null!==d&&(c=d.K(a));if(c!==b){if(null!==c){var e=c.diagram;null!==e&&e.remove(c)}null===d&&(this.Qf=d=new Db);b.Uf!==a&&(b.category=a);d.add(a,b);a=this.diagram;null!==a&&(a.add(b),a=b.adornedObject,null!==a&&(a=a.ej(),null!==a&&(b.data=a.data)))}}}; S.prototype.Lf=function(a){F&&A(a,"string",S,"removeAdornment:category");var b=this.Qf;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.Qf=null)}};S.prototype.jk=function(){var a=this.Qf;if(null!==a){var b=La();for(a=a.iterator;a.next();)b.push(a.key);a=b.length;for(var c=0;c<a;c++)this.Lf(b[c]);Oa(b)}}; S.prototype.updateAdornments=function(){var a=this.diagram;if(null!==a){for(var b=this.adornments;b.next();){var c=b.value;c.u();c.placeholder&&c.placeholder.u()}a:{if(this.isSelected&&this.selectionAdorned&&(b=this.selectionObject,null!==b&&this.actualBounds.o()&&this.isVisible()&&b.Kf()&&b.actualBounds.o())){c=this.sk("Selection");if(null===c){c=this.selectionAdornmentTemplate;null===c&&(c=this.Sh()?a.linkSelectionAdornmentTemplate:this instanceof Hf?a.groupSelectionAdornmentTemplate:a.nodeSelectionAdornmentTemplate); if(!(c instanceof Te))break a;Lg(c);c=c.copy();null!==c&&(this.Sh()&&this.selectionObject===this.path&&(c.type=U.Link),c.adornedObject=b)}if(null!==c){c.type===U.Link&&c.u();this.Kh("Selection",c);break a}}this.Lf("Selection")}Oo(this,a);for(b=this.adornments;b.next();)b.value.Ga()}};S.prototype.Rb=function(){var a=this.diagram;null!==a&&(hj(a),0!==(this.F&16384)!==!0&&(xi(this,!0),a.Vb()))};function wi(a){0!==(a.F&16384)!==!1&&(a.updateAdornments(),xi(a,!1))} function Oo(a,b){b.toolManager.mouseDownTools.each(function(b){b.isEnabled&&b.updateAdornments(a)});b.toolManager.updateAdornments(a)}function Po(a){if(!1===Jj(a)){Qo(a,!0);a.zl();var b=a.diagram;null!==b&&(b.ud.add(a),b.Vb())}}function Ro(a){a.F|=2097152;if(!1!==Jj(a)){var b=a.position,c=a.location;c.o()&&b.o()||So(a,b,c);c=a.Ab;var d=L.alloc().assign(c);c.ka();c.x=b.x;c.y=b.y;c.freeze();a.Vt(d,c);L.free(d);Qo(a,!1)}}S.prototype.move=function(a,b){!0===b?this.location=a:this.position=a}; S.prototype.moveTo=function(a,b,c){a=J.allocAt(a,b);this.move(a,c);J.free(a)};S.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.Ut(this))return!0}a=this.containingGroup;return null===a||a.isSubGraphExpanded&&a.isVisible()?!0:!1};t=S.prototype;t.Ub=function(a){var b=this.diagram;a?(this.D(4),this.Rb(),null!==b&&b.ud.add(this)):(this.D(8),this.jk());this.Rh();null!==b&&(b.Ta(),b.P())}; t.fb=function(a){if(this.name===a)return this;var b=this.Rj;null===b&&(this.Rj=b=new Db);if(null!==b.K(a))return b.K(a);var c=U.prototype.fb.call(this,a);if(null!==c)return b.set(a,c),c;b.set(a,null);return null};t.Hf=function(a,b,c){void 0===c&&(c=new J);b=b.Sb()?Mc:b;var d=a.naturalBounds;c.h(d.width*b.x+b.offsetX,d.height*b.y+b.offsetY);if(null===a||a===this)return c;a.transform.xa(c);for(a=a.panel;null!==a&&a!==this;)a.transform.xa(c),a=a.panel;this.kg.xa(c);c.offset(-this.sc.x,-this.sc.y);return c}; t.zm=function(a){void 0===a&&(a=new L);return a.assign(this.actualBounds)};t.Eb=function(){!0===Hj(this)&&this.measure(Infinity,Infinity);this.arrange()};function Sj(a,b){var c=a.Sy;isNaN(a.ph)&&(a.ph=xn(a));var d=a.ph;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} S.prototype.arrange=function(){if(!1===Ij(this))Ro(this);else{var a=this.Ab,b=L.alloc();b.assign(a);a.ka();var c=Jg(this);this.Nh(0,0,this.sc.width,this.sc.height);var d=this.position;So(this,d,this.location);a.x=d.x;a.y=d.y;a.freeze();this.Vt(b,a);Cl(this,!1);b.A(a)?this.Gd(c):!this.bc()||K.C(b.width,a.width)&&K.C(b.height,a.height)||0<=this.qx&&this.D(16);L.free(b);Qo(this,!1)}};t=S.prototype; t.Vt=function(a,b){var c=this.diagram;if(null!==c){var d=!1;if(!1===c.wi&&a.o()){var e=L.alloc();e.assign(c.documentBounds);e.Cw(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);L.free(e)}0!==(this.F&65536)!==!0&&a.A(b)||Xj(this,d,c);c.P();jc(a,b)||(this instanceof T&&!c.undoManager.isUndoingRedoing&&this.md(),this.Rh())}}; t.zw=function(a,b){if(this.Sh()||!a.o())return!1;var c=this.diagram;if(null!==c&&(To(this,c,a,b),!0===c.undoManager.isUndoingRedoing))return!0;this.sa=a;this.F&=-2097153;c=this.lg;if(c.o()){var d=c.copy();c.h(c.x+(a.x-b.x),c.y+(a.y-b.y));this.g("location",d,c.copy())}!1===Jj(this)&&!1===Ij(this)&&(Po(this),Ro(this));return!0};function To(a,b,c,d){null===b||a instanceof Te||(b=b.animationManager,b.lf&&$h(b,a,d.copy(),c.copy()))} t.ar=function(a,b,c){var d=this.lg,e=this.sa;if(c){if(d.x===a&&d.y===b)return;Jj(this)||Ij(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;Jj(this)||Ij(this)?this.eu():d.h(d.x+a-e.x,d.y+b-e.y);e.h(a,b)}Po(this)};t.eu=function(){this.F&=-2097153;Po(this)}; function So(a,b,c){var d=J.alloc(),e=a.locationSpot,f=a.locationObject;e.Sb()&&v("determineOffset: Part's locationSpot must be real: "+e.toString());var g=f.naturalBounds,h=f instanceof Yf?f.strokeWidth:0;d.Jk(0,0,g.width+h,g.height+h,e);if(f!==a)for(d.offset(-h/2,-h/2),f.transform.xa(d),e=f.panel;null!==e&&e!==a;)e.transform.xa(d),e=e.panel;a.kg.xa(d);d.offset(-a.sc.x,-a.sc.y);e=a.diagram;f=c.o();g=b.o();f&&g?0!==(a.F&2097152)?Uo(a,b,c,e,d):Vo(a,b,c,e,d):f?Uo(a,b,c,e,d):g&&Vo(a,b,c,e,d);a.F|=2097152; J.free(d);a.zl()}function Uo(a,b,c,d,e){var f=b.x,g=b.y;b.h(c.x-e.x,c.y-e.y);null!==d&&(c=d.animationManager,(e=c.isAnimating)||!c.lf||a instanceof Te||$h(c,a,new J(f,g),b),e||b.x===f&&b.y===g||(c=d.skipsUndoManager,d.skipsUndoManager=!0,a.g("position",new J(f,g),b),d.skipsUndoManager=c))}function Vo(a,b,c,d,e){var f=c.copy();c.h(b.x+e.x,b.y+e.y);c.A(f)||null===d||(b=d.skipsUndoManager,d.skipsUndoManager=!0,a.g("location",f,c.copy()),d.skipsUndoManager=b)} function Xj(a,b,c){El(a,!1);a instanceof T&&Nk(c,a);a.layer.isTemporary||b||c.Ta();b=a.Ab;var d=c.viewportBounds;d.o()?Jg(a)?(nc(b,d)||a.Gd(!1),a.updateAdornments()):b.Mc(d)?(a.Gd(!0),a.updateAdornments()):a.Rb():c.yi=!0}t.nj=function(){return!0};t.bc=function(){return!0};t.Sh=function(){return!1};t.Jf=function(){return!0}; function Wo(a,b,c,d){b.constructor===a.constructor||Xo||(Xo=!0,Ca('Should not change the class of the Part when changing category from "'+c+'" to "'+d+'"'),Ca(" Old class: "+Pa(a.constructor)+", new class: "+Pa(b.constructor)+", part: "+a.toString()));a.jk();var e=a.data;c=a.layerName;var f=a.isSelected,g=a.isHighlighted,h=!0,k=!0,l=!1;a instanceof T&&(h=a.isTreeLeaf,k=a.isTreeExpanded,l=a.wasTreeExpanded);b.Ef(a);b.cloneProtected(a);a.Uf=d;a.u();a.P();b=a.diagram;d=!0;null!==b&&(d=b.skipsUndoManager, b.skipsUndoManager=!0);a.pb=e;a.F=f?a.F|4096:a.F&-4097;a.F=g?a.F|524288:a.F&-524289;a instanceof T&&(a.T=h?a.T|4:a.T&-5,a.T=k?a.T|1:a.T&-2,a.T=l?a.T|2:a.T&-3);null!==e&&a.Ga();e=a.layerName;e!==c&&(a.nh=c,a.layerName=e);null!==b&&(b.skipsUndoManager=d);a.bc()&&a.D(64)}S.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}; S.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};S.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}; S.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};S.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}; S.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};S.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}; S.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};S.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 xi(a,b){a.F=b?a.F|16384:a.F&-16385}function Jj(a){return 0!==(a.F&32768)}function Qo(a,b){a.F=b?a.F|32768:a.F&-32769} function El(a,b){a.F=b?a.F|65536:a.F&-65537}function Jg(a){return 0!==(a.F&131072)}t=S.prototype;t.Gd=function(a){this.F=a?this.F|131072:this.F&-131073};function Yo(a,b){a.F=b?a.F|1048576:a.F&-1048577}t.Rh=function(){var a=this.containingGroup;null!==a&&(a.u(),null!==a.placeholder&&a.placeholder.u(),a.md())};t.P=function(){var a=this.diagram;null!==a&&!Ij(this)&&!Jj(this)&&this.isVisible()&&this.Ab.o()&&a.P(Sj(this,this.Ab))}; t.u=function(){U.prototype.u.call(this);var a=this.diagram;null!==a&&(a.ud.add(this),this instanceof T&&null!==this.labeledLink&&Tl(this.labeledLink),a.Vb(!0))};t.Gq=function(a){a||(a=this.oi,null!==a&&Zo(a,this))};t.Hq=function(a){a||(a=this.oi,null!==a&&$o(a,this))};t.qk=function(){var a=this.data;if(null!==a){var b=this.diagram;null!==b&&(b=b.model,null!==b&&b.Pm(a))}};t.Pz=function(){return ap(this,this)}; function ap(a,b){var c=b.containingGroup;return null!==c?1+ap(a,c):b instanceof T&&(b=b.labeledLink,null!==b)?ap(a,b):0}t.Sz=function(){return bp(this,this)};function bp(a,b){var c=b.containingGroup;return null!==c||b instanceof T&&(c=b.labeledLink,null!==c)?bp(a,c):b}t.ee=function(a){return a instanceof Hf?cp(this,this,a):!1};function cp(a,b,c){if(b===c||null===c)return!1;var d=b.containingGroup;return null===d||d!==c&&!cp(a,d,c)?b instanceof T&&(b=b.labeledLink,null!==b)?cp(a,b,c):!1:!0} t.ay=function(a){if(null===a)return null;F&&w(a,S,S,"findCommonContainingGroup:other");if(this===a)return this.containingGroup;for(var b=this;null!==b;){b instanceof Hf&&Yo(b,!0);if(b instanceof T){var c=b.labeledLink;null!==c&&(b=c)}b=b.containingGroup}c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b instanceof T&&(a=b.labeledLink,null!==a&&(b=a));b=b.containingGroup}for(b=this;null!==b;)b instanceof Hf&&Yo(b,!1),b instanceof T&&(a=b.labeledLink,null!==a&&(b=a)),b=b.containingGroup;return c}; S.prototype.canLayout=function(){if(!this.isLayoutPositioned||!this.isVisible())return!1;var a=this.layer;return null!==a&&a.isTemporary||this instanceof T&&this.isLinkLabel?!1:!0}; S.prototype.D=function(a){void 0===a&&(a=16777215);if(this.isLayoutPositioned&&0!==(a&this.layoutConditions)){var b=this.layer;null!==b&&b.isTemporary||this instanceof T&&this.isLinkLabel?b=!1:(b=this.diagram,b=null!==b&&b.undoManager.isUndoingRedoing?!1:!0)}else b=!1;if(b)if(b=this.oi,null!==b){var c=b.layout;null!==c?c.D():b.D(a)}else a=this.diagram,null!==a&&(a=a.layout,null!==a&&a.D())};function Yj(a){if(!a.isVisible())return!1;a=a.layer;return null!==a&&a.isTemporary?!1:!0} function il(a,b,c,d,e,f){void 0===f&&(f=null);if(!(a.contains(b)||null!==f&&!f(b)||b instanceof Te))if(a.add(b),b instanceof T){if(c&&b instanceof Hf)for(var g=b.memberParts;g.next();)il(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)&&il(a,h,c,d,e,f)}}if(1<d)for(b=b.Pv();b.next();)il(a,b.value,c,d-1,e,f)}else if(b instanceof R)for(b=b.labelNodes;b.next();)il(a, b.value,c,d,e,f)} ma.Object.defineProperties(S.prototype,{key:{configurable:!0,get:function(){var a=this.diagram;if(null!==a)return a.model.pa(this.data)}},adornments:{configurable:!0,get:function(){return null===this.Qf?lb:this.Qf.iteratorValues}},layer:{configurable:!0,get:function(){return this.Fi}},diagram:{configurable:!0,get:function(){var a=this.Fi;return null!==a?a.diagram:null}},layerName:{configurable:!0,get:function(){return this.nh},set:function(a){var b= this.nh;if(b!==a){A(a,"string",S,"layerName");var c=this.diagram;if(null===c||null!==c.wm(a)&&!c.partManager.addsToTemporaryLayer)if(this.nh=a,null!==c&&c.Ta(),this.g("layerName",b,a),b=this.layer,null!==b&&b.name!==a&&(c=b.diagram,null!==c&&(a=c.wm(a),null!==a&&a!==b))){var d=b.Lc(-1,this,!0);0<=d&&c.gb(Ke,"parts",b,this,null,d,!0);d=a.lj(99999999,this,!0);b.visible!==a.visible&&this.Ub(a.visible);0<=d&&c.gb(Je,"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.Co},set:function(a){var b=this.Co;b!==a&&(null!==a&&A(a,"function",S,"layerChanged"),this.Co=a,this.g("layerChanged",b,a))}},zOrder:{configurable:!0,get:function(){return this.rq},set:function(a){var b=this.rq;if(b!==a){A(a,"number",S,"zOrder");this.rq=a;var c=this.layer;null!==c&&Ai(c,-1,this);this.g("zOrder",b,a);a=this.diagram;null!==a&&a.P()}}},locationObject:{configurable:!0,get:function(){if(null=== this.jf){var a=this.locationObjectName;""!==a?(a=this.fb(a),null!==a?this.jf=a:this.jf=this):this instanceof Te?this.type!==U.Link&&null!==this.placeholder?this.jf=this.placeholder:this.jf=this:this.jf=this}return this.jf.visible?this.jf:this}},minLocation:{configurable:!0,get:function(){return this.To},set:function(a){var b=this.To;b.A(a)||(F&&w(a,J,S,"minLocation"),this.To=a=a.J(),this.g("minLocation",b,a))}},maxLocation:{configurable:!0,get:function(){return this.Lo}, set:function(a){var b=this.Lo;b.A(a)||(F&&w(a,J,S,"maxLocation"),this.Lo=a=a.J(),this.g("maxLocation",b,a))}},locationObjectName:{configurable:!0,get:function(){return this.Jo},set:function(a){var b=this.Jo;b!==a&&(F&&A(a,"string",S,"locationObjectName"),this.Jo=a,this.jf=null,this.u(),this.g("locationObjectName",b,a))}},locationSpot:{configurable:!0,get:function(){return this.Ko},set:function(a){var b=this.Ko;b.A(a)||(F&&(w(a,M,S,"locationSpot"),a.ab()||v("Part.locationSpot must be a specific Spot value, not: "+ a)),this.Ko=a=a.J(),this.u(),this.g("locationSpot",b,a))}},location:{configurable:!0,get:function(){return this.lg},set:function(a){F&&w(a,J,S,"location");var b=a.x,c=a.y,d=this.lg,e=d.x,f=d.y;(e===b||isNaN(e)&&isNaN(b))&&(f===c||isNaN(f)&&isNaN(c))||(a=a.copy(),e=a,this.Sh()?b=!1:(this.lg=e,this.F|=2097152,!1===Ij(this)&&(Po(this),b=this.sa,b.o()&&(c=b.copy(),b.h(b.x+(e.x-d.x),b.y+(e.y-d.y)),To(this,this.diagram,b,c),e=this.diagram,null!==e?(f=e.skipsUndoManager,e.skipsUndoManager= !0,this.g("position",c,b),e.skipsUndoManager=f):this.g("position",c,b))),b=!0),b&&this.g("location",d.copy(),a.copy()))}},category:{configurable:!0,get:function(){return this.Uf},set:function(a){var b=this.Uf;if(b!==a){A(a,"string",S,"category");var c=this.diagram,d=this.data,e=null;if(null!==c&&null!==d&&!(this instanceof Te)){var f=c.model.undoManager;f.isEnabled&&!f.isUndoingRedoing&&(e=this.clone(),e.Z.addAll(this.Z))}this.Uf=a;this.g("category",b,a);null===c||null===d||this instanceof Te?this instanceof Te&&(e=this.adornedPart,null!==e&&(a=e.Qf,null!==a&&a.remove(b),e.Kh(this.category,this))):(f=c.model,f.undoManager.isUndoingRedoing||(this.Sh()?(c.partManager.setLinkCategoryForData(d,a),c=c.partManager.findLinkTemplateForCategory(a),null!==c&&(Lg(c),c=c.copy(),null!==c&&Wo(this,c,b,a))):(null!==f&&f.$q(d,a),c=dp(c.partManager,d,a),null!==c&&(Lg(c),c=c.copy(),null===c||c instanceof R||(d=this.location.copy(),Wo(this,c,b,a),this.location.o()||(this.location=d)))),null!==e&&(b=this.clone(), b.Z.addAll(this.Z),this.g("self",e,b))))}}},self:{configurable:!0,get:function(){return this},set:function(a){Wo(this,a,this.category,a.category)}},copyable:{configurable:!0,get:function(){return 0!==(this.F&1)},set:function(a){var b=0!==(this.F&1);b!==a&&(F&&A(a,"boolean",S,"copyable"),this.F^=1,this.g("copyable",b,a))}},deletable:{configurable:!0,get:function(){return 0!==(this.F&2)},set:function(a){var b=0!==(this.F&2);b!==a&&(F&&A(a,"boolean",S,"deletable"), this.F^=2,this.g("deletable",b,a))}},textEditable:{configurable:!0,get:function(){return 0!==(this.F&4)},set:function(a){var b=0!==(this.F&4);b!==a&&(F&&A(a,"boolean",S,"textEditable"),this.F^=4,this.g("textEditable",b,a),this.Rb())}},groupable:{configurable:!0,get:function(){return 0!==(this.F&8)},set:function(a){var b=0!==(this.F&8);b!==a&&(F&&A(a,"boolean",S,"groupable"),this.F^=8,this.g("groupable",b,a))}},movable:{configurable:!0,get:function(){return 0!== (this.F&16)},set:function(a){var b=0!==(this.F&16);b!==a&&(F&&A(a,"boolean",S,"movable"),this.F^=16,this.g("movable",b,a))}},selectionAdorned:{configurable:!0,get:function(){return 0!==(this.F&32)},set:function(a){var b=0!==(this.F&32);b!==a&&(F&&A(a,"boolean",S,"selectionAdorned"),this.F^=32,this.g("selectionAdorned",b,a),this.Rb())}},isInDocumentBounds:{configurable:!0,get:function(){return 0!==(this.F&64)},set:function(a){var b=0!==(this.F&64);if(b!==a){F&&A(a,"boolean", S,"isInDocumentBounds");this.F^=64;var c=this.diagram;null!==c&&c.Ta();this.g("isInDocumentBounds",b,a)}}},isLayoutPositioned:{configurable:!0,get:function(){return 0!==(this.F&128)},set:function(a){var b=0!==(this.F&128);b!==a&&(F&&A(a,"boolean",S,"isLayoutPositioned"),this.F^=128,this.g("isLayoutPositioned",b,a),this.D(a?4:8))}},selectable:{configurable:!0,get:function(){return 0!==(this.F&256)},set:function(a){var b=0!==(this.F&256);b!==a&&(F&&A(a,"boolean",S,"selectable"), this.F^=256,this.g("selectable",b,a),this.Rb())}},reshapable:{configurable:!0,get:function(){return 0!==(this.F&512)},set:function(a){var b=0!==(this.F&512);b!==a&&(F&&A(a,"boolean",S,"reshapable"),this.F^=512,this.g("reshapable",b,a),this.Rb())}},resizable:{configurable:!0,get:function(){return 0!==(this.F&1024)},set:function(a){var b=0!==(this.F&1024);b!==a&&(F&&A(a,"boolean",S,"resizable"),this.F^=1024,this.g("resizable",b,a),this.Rb())}},rotatable:{configurable:!0, enumerable:!0,get:function(){return 0!==(this.F&2048)},set:function(a){var b=0!==(this.F&2048);b!==a&&(F&&A(a,"boolean",S,"rotatable"),this.F^=2048,this.g("rotatable",b,a),this.Rb())}},isSelected:{configurable:!0,get:function(){return 0!==(this.F&4096)},set:function(a){var b=0!==(this.F&4096);if(b!==a){F&&A(a,"boolean",S,"isSelected");var c=this.diagram;if(!a||this.canSelect()&&!(null!==c&&c.selection.count>=c.maxSelectionCount)){this.F^=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.Rb();a=this.selectionChanged;null!==a&&a(this);null!==c&&(c.Vb(),c.skipsUndoManager=d)}}}},isHighlighted:{configurable:!0,get:function(){return 0!==(this.F&524288)},set:function(a){var b=0!==(this.F&524288);if(b!==a){F&&A(a,"boolean",S,"isHighlighted");this.F^=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.P();a=this.highlightedChanged;null!==a&&a(this)}}},isShadowed:{configurable:!0,get:function(){return 0!==(this.F&8192)},set:function(a){var b=0!==(this.F&8192);b!==a&&(F&&A(a,"boolean",S,"isShadowed"),this.F^=8192,this.g("isShadowed",b,a),this.P())}},isAnimated:{configurable:!0,get:function(){return 0!==(this.F&262144)},set:function(a){var b=0!==(this.F&262144);b!==a&&(F&&A(a,"boolean",S,"isAnimated"),this.F^=262144,this.g("isAnimated",b,a))}},highlightedChanged:{configurable:!0, enumerable:!0,get:function(){return this.no},set:function(a){var b=this.no;b!==a&&(null!==a&&A(a,"function",S,"highlightedChanged"),this.no=a,this.g("highlightedChanged",b,a))}},selectionObjectName:{configurable:!0,get:function(){return this.Qp},set:function(a){var b=this.Qp;b!==a&&(F&&A(a,"string",S,"selectionObjectName"),this.Qp=a,this.xh=null,this.g("selectionObjectName",b,a))}},selectionAdornmentTemplate:{configurable:!0,get:function(){return this.Op},set:function(a){var b= this.Op;b!==a&&(F&&w(a,Te,S,"selectionAdornmentTemplate"),this.Op=a,this.g("selectionAdornmentTemplate",b,a))}},selectionObject:{configurable:!0,get:function(){if(null===this.xh){var a=this.selectionObjectName;null!==a&&""!==a?(a=this.fb(a),null!==a?this.xh=a:this.xh=this):this instanceof R?(a=this.path,null!==a?this.xh=a:this.xh=this):this.xh=this}return this.xh}},selectionChanged:{configurable:!0,get:function(){return this.Pp},set:function(a){var b=this.Pp;b!==a&&(null!== a&&A(a,"function",S,"selectionChanged"),this.Pp=a,this.g("selectionChanged",b,a))}},resizeAdornmentTemplate:{configurable:!0,get:function(){return this.zp},set:function(a){var b=this.zp;b!==a&&(F&&w(a,Te,S,"resizeAdornmentTemplate"),this.zp=a,this.g("resizeAdornmentTemplate",b,a))}},resizeObjectName:{configurable:!0,get:function(){return this.Bp},set:function(a){var b=this.Bp;b!==a&&(F&&A(a,"string",S,"resizeObjectName"),this.Bp=a,this.g("resizeObjectName",b,a))}},resizeObject:{configurable:!0, enumerable:!0,get:function(){var a=this.resizeObjectName;return""!==a&&(a=this.fb(a),null!==a)?a:this}},resizeCellSize:{configurable:!0,get:function(){return this.Ap},set:function(a){var b=this.Ap;b.A(a)||(F&&w(a,Hb,S,"resizeCellSize"),this.Ap=a=a.J(),this.g("resizeCellSize",b,a))}},rotateAdornmentTemplate:{configurable:!0,get:function(){return this.Dp},set:function(a){var b=this.Dp;b!==a&&(F&&w(a,Te,S,"rotateAdornmentTemplate"),this.Dp=a,this.g("rotateAdornmentTemplate", b,a))}},rotateObjectName:{configurable:!0,get:function(){return this.Ep},set:function(a){var b=this.Ep;b!==a&&(F&&A(a,"string",S,"rotateObjectName"),this.Ep=a,this.g("rotateObjectName",b,a))}},rotateObject:{configurable:!0,get:function(){var a=this.rotateObjectName;return""!==a&&(a=this.fb(a),null!==a)?a:this}},rotationSpot:{configurable:!0,get:function(){return this.Fp},set:function(a){var b=this.Fp;b.A(a)||(F&&(w(a,M,S,"rotationSpot"),a===ld||a.ab()||v("Part.rotationSpot must be a specific Spot value or Spot.Default, not: "+ a)),this.Fp=a=a.J(),this.g("rotationSpot",b,a))}},text:{configurable:!0,get:function(){return this.Zb},set:function(a){var b=this.Zb;b!==a&&(F&&A(a,"string",S,"text"),this.Zb=a,this.g("text",b,a))}},containingGroup:{configurable:!0,get:function(){return this.oi},set:function(a){if(this.bc()){var b=this.oi;if(b!==a){F&&null!==a&&w(a,Hf,S,"containingGroup");null===a||this!==a&&!a.ee(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.D(2);var c=this.diagram;null!==b?$o(b,this):this instanceof Hf&&null!==c&&c.Hh.remove(this);this.oi=a;null!==a?Zo(a,this):this instanceof Hf&&null!==c&&c.Hh.add(this);this.D(1);if(null!==c&&c.ba){var d=this.data,e=c.model;if(null!==d&&e.mj()){var f=e.pa(null!==a?a.data:null);e.cu(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 Hf)for(c=new I,il(c,this,!0,0,!0), c=c.iterator;c.next();)if(d=c.value,d instanceof T)for(d=d.linksConnected;d.next();)ep(d.value);if(this instanceof T){for(c=this.linksConnected;c.next();)ep(c.value);c=this.labeledLink;null!==c&&ep(c)}this.g("containingGroup",b,a);null!==a&&(b=a.layer,null!==b&&Ai(b,-1,a))}}else v("cannot set the Part.containingGroup of a Link or Adornment")}},containingGroupChanged:{configurable:!0,get:function(){return this.xn},set:function(a){var b=this.xn;b!==a&&(null!==a&&A(a,"function",S,"containingGroupChanged"), this.xn=a,this.g("containingGroupChanged",b,a))}},isTopLevel:{configurable:!0,get:function(){return null!==this.containingGroup||this instanceof T&&null!==this.labeledLink?!1:!0}},layoutConditions:{configurable:!0,get:function(){return this.Do},set:function(a){var b=this.Do;b!==a&&(F&&A(a,"number",S,"layoutConditions"),this.Do=a,this.g("layoutConditions",b,a))}},dragComputation:{configurable:!0,get:function(){return this.Pn},set:function(a){var b=this.Pn; b!==a&&(null!==a&&A(a,"function",S,"dragComputation"),this.Pn=a,this.g("dragComputation",b,a))}},shadowOffset:{configurable:!0,get:function(){return this.Up},set:function(a){var b=this.Up;b.A(a)||(F&&w(a,J,S,"shadowOffset"),this.Up=a=a.J(),this.P(),this.g("shadowOffset",b,a))}},shadowColor:{configurable:!0,get:function(){return this.Tp},set:function(a){var b=this.Tp;b!==a&&(F&&A(a,"string",S,"shadowColor"),this.Tp=a,this.P(),this.g("shadowColor",b,a))}},shadowBlur:{configurable:!0, enumerable:!0,get:function(){return this.rf},set:function(a){var b=this.rf;b!==a&&(F&&A(a,"number",S,"shadowBlur"),this.rf=a,this.P(),this.g("shadowBlur",b,a))}}});S.prototype.invalidateLayout=S.prototype.D;S.prototype.findCommonContainingGroup=S.prototype.ay;S.prototype.isMemberOf=S.prototype.ee;S.prototype.findTopLevelPart=S.prototype.Sz;S.prototype.findSubGraphLevel=S.prototype.Pz;S.prototype.ensureBounds=S.prototype.Eb;S.prototype.getDocumentBounds=S.prototype.zm; S.prototype.getRelativePoint=S.prototype.Hf;S.prototype.findObject=S.prototype.fb;S.prototype.moveTo=S.prototype.moveTo;S.prototype.invalidateAdornments=S.prototype.Rb;S.prototype.clearAdornments=S.prototype.jk;S.prototype.removeAdornment=S.prototype.Lf;S.prototype.addAdornment=S.prototype.Kh;S.prototype.findAdornment=S.prototype.sk;S.prototype.updateTargetBindings=S.prototype.Ga;var Xo=!1;S.className="Part";S.LayoutNone=0;S.LayoutAdded=1;S.LayoutRemoved=2;S.LayoutShown=4;S.LayoutHidden=8; S.LayoutNodeSized=16;S.LayoutGroupLayout=32;S.LayoutNodeReplaced=64;S.LayoutStandard=127;S.LayoutAll=16777215;function Te(a){S.call(this,a);this.F&=-257;this.nh="Adornment";this.le=null;this.vx=0;this.Kx=!1;this.l=[];this.Pa=null}la(Te,S);Te.prototype.toString=function(){var a=this.adornedPart;return"Adornment("+this.category+")"+(null!==a?a.toString():"")};Te.prototype.updateRelationshipsFromData=function(){}; Te.prototype.Ak=function(a){var b=this.adornedObject.part;if(b instanceof R&&this.adornedObject instanceof Yf){var c=b.path;b.Ak(a);a=c.geometry;b=this.Z.j;c=b.length;for(var d=0;d<c;d++){var e=b[d];e.isPanelMain&&e instanceof Yf&&(e.qa=a)}}};Te.prototype.nj=function(){var a=this.le;if(null===a)return!0;a=a.part;return null===a||!Ij(a)};Te.prototype.bc=function(){return!1}; Te.prototype.Hk=function(a,b,c,d,e,f,g){if(a===Je&&"elements"===b)if(e instanceof Kg)null===this.Pa?this.Pa=e:F&&this.Pa!==e&&v("Cannot insert a second Placeholder into the visual tree of an Adornment.");else{if(e instanceof U){var h=e.vm(function(a){return a instanceof Kg});h instanceof Kg&&(null===this.Pa?this.Pa=h:F&&this.Pa!==h&&v("Cannot insert a second Placeholder into the visual tree of an Adornment."))}}else a===Ke&&"elements"===b&&null!==this.Pa&&(d===this.Pa?this.Pa=null:d instanceof U&& this.Pa.Mg(d)&&(this.Pa=null));S.prototype.Hk.call(this,a,b,c,d,e,f,g)};Te.prototype.updateAdornments=function(){};Te.prototype.qk=function(){}; ma.Object.defineProperties(Te.prototype,{placeholder:{configurable:!0,get:function(){return this.Pa}},adornedObject:{configurable:!0,get:function(){return this.le},set:function(a){F&&null!==a&&w(a,N,S,"adornedObject:value");var b=this.adornedPart,c=null;null!==a&&(c=a.part);null===b||null!==a&&b===c||b.Lf(this.category);this.le=a;null!==c&&c.Kh(this.category,this)}},adornedPart:{configurable:!0,get:function(){var a=this.le;return null!==a?a.part:null}},containingGroup:{configurable:!0, enumerable:!0,get:function(){return null}}});Te.className="Adornment";function T(a){S.call(this,a);this.T=13;this.cb=new H;this.mq=this.El=this.Ii=this.Fo=this.Eo=null;this.Vk=Fc;this.xc=this.Ye=null;this.wp=fp;this.Ih=!1}la(T,S);T.prototype.cloneProtected=function(a){S.prototype.cloneProtected.call(this,a);a.T=this.T;a.T=this.T&-17;a.Eo=this.Eo;a.Fo=this.Fo;a.Ii=this.Ii;a.mq=this.mq;a.Vk=this.Vk.J();a.wp=this.wp};t=T.prototype; t.Ef=function(a){S.prototype.Ef.call(this,a);a.md();a.Ye=this.Ye;a.xc=null};function gp(a,b){null!==b&&(null===a.Ye&&(a.Ye=new I),a.Ye.add(b))}function hp(a,b,c,d){if(null===b||null===a.Ye)return null;for(var e=a.Ye.iterator;e.next();){var f=e.value;if(f.St===a&&f.ew===b&&f.wy===c&&f.xy===d||f.St===b&&f.ew===a&&f.wy===d&&f.xy===c)return f}return null}t.oA=function(a,b,c){if(void 0===b||null===b)b="";if(void 0===c||null===c)c="";a=hp(this,a,b,c);null!==a&&a.Bm()}; t.Hk=function(a,b,c,d,e,f,g){a===Je&&"elements"===b?this.xc=null:a===Ke&&"elements"===b&&(this.xc=null);S.prototype.Hk.call(this,a,b,c,d,e,f,g)};t.md=function(a){void 0===a&&(a=null);for(var b=this.linksConnected;b.next();){var c=b.value;null!==a&&a.contains(c)||(ip(this,c.fromPort),ip(this,c.toPort),c.Ya())}};function Fl(a,b){for(var c=a.linksConnected;c.next();){var d=c.value;if(d.fromPort===b||d.toPort===b)ip(a,d.fromPort),ip(a,d.toPort),d.Ya()}} function ip(a,b){null!==b&&(b=b.vp,null!==b&&b.Bm(),a=a.containingGroup,null===a||a.isSubGraphExpanded||ip(a,a.port))}t.nj=function(){return!0};T.prototype.getAvoidableRect=function(a){a.set(this.actualBounds);a.tq(this.Vk);return a};T.prototype.findVisibleNode=function(){for(var a=this;null!==a&&!a.isVisible();)a=a.containingGroup;return a}; T.prototype.isVisible=function(){if(!S.prototype.isVisible.call(this))return!1;var a=!0,b=Gi,c=this.diagram;if(null!==c){if(c.animationManager.Ut(this))return!0;a=c.isTreePathToChildren;b=c.treeCollapsePolicy}if(b===Gi){if(a=this.Kg(),null!==a&&!a.isTreeExpanded)return!1}else if(b===Vk){if(a=a?this.Mv():this.Nv(),0<a.count&&a.all(function(a){return!a.isTreeExpanded}))return!1}else if(b===Wk&&(a=a?this.Mv():this.Nv(),0<a.count&&a.any(function(a){return!a.isTreeExpanded})))return!1;a=this.labeledLink; return null!==a?a.isVisible():!0};T.prototype.Ub=function(a){S.prototype.Ub.call(this,a);for(var b=this.linksConnected;b.next();)b.value.Ub(a)};T.prototype.by=function(){var a=new I,b=new I;jp(this,this,a,b);return b.iterator};function jp(a,b,c,d){if(!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)&&jp(a,e?f.toNode:f.fromNode,c,d):d.add(f)})}} T.prototype.findLinksConnected=function(a){void 0===a&&(a=null);if(null===a)return this.cb.iterator;F&&A(a,"string",T,"findLinksConnected:pid");var b=new nb(this.cb),c=this;b.predicate=function(b){return b.fromNode===c&&b.fromPortId===a||b.toNode===c&&b.toPortId===a};return b};t=T.prototype;t.Bq=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",T,"findLinksOutOf:pid");var b=new nb(this.cb),c=this;b.predicate=function(b){return b.fromNode!==c?!1:null===a?!0:b.fromPortId===a};return b}; t.Dd=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",T,"findLinksInto:pid");var b=new nb(this.cb),c=this;b.predicate=function(b){return b.toNode!==c?!1:null===a?!0:b.toPortId===a};return b}; t.Lv=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",T,"findNodesConnected:pid");for(var b=null,c=null,d=this.cb.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 mb(c):lb}; t.Nv=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",T,"findNodesOutOf:pid");for(var b=null,c=null,d=this.cb.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 mb(c):lb}; t.Mv=function(a){void 0===a&&(a=null);F&&null!==a&&A(a,"string",T,"findNodesInto:pid");for(var b=null,c=null,d=this.cb.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 mb(c):lb}; t.Kz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);F&&(w(a,T,T,"findLinksBetween:othernode"),null!==b&&A(b,"string",T,"findLinksBetween:pid"),null!==c&&A(c,"string",T,"findLinksBetween:otherpid"));var d=new nb(this.cb),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.Lz=function(a,b,c){void 0===b&&(b=null);void 0===c&&(c=null);F&&(w(a,T,T,"findLinksTo:othernode"),null!==b&&A(b,"string",T,"findLinksTo:pid"),null!==c&&A(c,"string",T,"findLinksTo:otherpid"));var d=new nb(this.cb),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 kp(a,b,c){ip(a,c);var d=a.cb.contains(b);d||a.cb.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.Ih||(e.Ih=f),!f.isTreeLeaf||null!==a&&a.undoManager.isUndoingRedoing||(d?c===f&&(f.isTreeLeaf=!1):b===f&&(f.isTreeLeaf=!1))))} function lp(a,b,c){ip(a,c);var d=a.cb.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.Ih=!1),null===b||b.isTreeLeaf||(0===b.cb.count?(b.Ih=null,null!==e&&e.undoManager.isUndoingRedoing||(b.isTreeLeaf=!0)):Uk(b)))} function Uk(a){a.Ih=!1;if(0!==a.cb.count){var b=!0,c=a.diagram;if(null===c||!c.undoManager.isUndoingRedoing){null!==c&&(b=c.isTreePathToChildren);for(c=a.cb.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}}}T.prototype.updateRelationshipsFromData=function(){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)};t=T.prototype; t.Gq=function(a){S.prototype.Gq.call(this,a);a||(Uk(this),a=this.El,null!==a&&mp(a,this))};t.Hq=function(a){S.prototype.Hq.call(this,a);a||(a=this.El,null!==a&&null!==a.hd&&(a.hd.remove(this),a.u()))}; t.qk=function(){if(0<this.cb.count){var a=this.diagram;if(null!==a)for(var b=null!==a.commandHandler?a.commandHandler.deletesConnectedLinks:!0,c=this.cb.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;S.prototype.qk.call(this)}; t.Ct=function(a){F&&A(a,"string",T,"findPort:pid");if(null===this.xc){if(""===a&&!1===this.Qh)return this;np(this)}var b=this.xc.K(a);return null!==b||""!==a&&(b=this.xc.K(""),null!==b)?b:this};function np(a){null===a.xc?a.xc=new Db:a.xc.clear();a.Lk(a,function(a,c){jm(a,c)});0===a.xc.count&&a.xc.add("",a)}function jm(a,b){var c=b.portId;null!==c&&null!==a.xc&&a.xc.add(c,b)} function im(a,b,c){var d=b.portId;if(null!==d&&(null!==a.xc&&a.xc.remove(d),b=a.diagram,null!==b&&c)){c=null;for(a=a.findLinksConnected(d);a.next();)d=a.value,null===c&&(c=La()),c.push(d);if(null!==c){for(a=0;a<c.length;a++)b.remove(c[a]);Oa(c)}}} t.qA=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.cb.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.cb.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.Wz=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this;if(a)for(;;){a=null;for(var c=b.cb.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.cb.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.Hz=function(a){if(null===a)return null;F&&w(a,T,T,"findCommonTreeParent:other");if(this===a)return this;for(var b=this;null!==b;)Yo(b,!0),b=b.Kg();var c=null;for(b=a;null!==b;){if(0!==(b.F&1048576)){c=b;break}b=b.Kg()}for(b=this;null!==b;)Yo(b,!1),b=b.Kg();return c}; t.fj=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=this.cb.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.Kg=function(){var a=this.Ih;if(null===a)return null;if(a instanceof T)return a;var b=!0;a=this.diagram;null!==a&&(b=a.isTreePathToChildren);a=this.cb.iterator;if(b)for(;a.next();){if(b=a.value,b.isTreeLink&&(b=b.fromNode,b!==this))return this.Ih=b}else for(;a.next();)if(b=a.value,b.isTreeLink&&(b=b.toNode,b!==this))return this.Ih=b;return this.Ih=null};t.Uz=function(){function a(b,d){if(null!==b){d.add(b);var c=b.fj();null!==c&&(d.add(c),a(b.Kg(),d))}}var b=new I;a(this,b);return b}; t.Tz=function(){return op(this,this)};function op(a,b){b=b.Kg();return null===b?0:1+op(a,b)}t.Dq=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);b=new nb(this.cb);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.Pv=function(){var a=!0,b=this.diagram;null!==b&&(a=b.isTreePathToChildren);var c=b=null,d=this.cb.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 mb(c):lb}; t.Vz=function(a){void 0===a&&(a=Infinity);A(a,"number",T,"findTreeParts:level");var b=new I;il(b,this,!1,a,!0);return b};T.prototype.collapseTree=function(a){void 0===a&&(a=1);C(a,T,"collapseTree:level");1>a&&(a=1);var b=this.diagram;if(null!==b&&!b.Re){b.Re=!0;var c=new I;c.add(this);pp(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Gi);b.Re=!1}}; function pp(a,b,c,d,e,f,g){if(1<d)for(var h=c?a.Bq():a.Dd();h.next();){var k=h.value;k.isTreeLink&&(k=k.Gt(a),null===k||k===a||b.contains(k)||(b.add(k),pp(k,b,c,d-1,e,f,g)))}else qp(a,b,c,e,f,g)} function qp(a,b,c,d,e,f){for(var g=e===a?!0:a.isTreeExpanded,h=c?a.Bq():a.Dd();h.next();){var k=h.value;if(k.isTreeLink&&(k=k.Gt(a),null!==k&&k!==a)){var l=b.contains(k);l||b.add(k);g&&(f&&d.ek(k,e),k.Rh(),k.Ub(!1));k.isTreeExpanded&&(k.wasTreeExpanded=k.isTreeExpanded,l||qp(k,b,c,d,e,f))}}a.isTreeExpanded=!1} T.prototype.expandTree=function(a){void 0===a&&(a=2);C(a,T,"expandTree:level");2>a&&(a=2);var b=this.diagram;if(null!==b&&!b.Re){b.Re=!0;var c=new I;c.add(this);rp(this,c,b.isTreePathToChildren,a,b,this,b.treeCollapsePolicy===Gi);b.Re=!1}}; function rp(a,b,c,d,e,f,g){for(var h=f===a?!1:a.isTreeExpanded,k=c?a.Bq():a.Dd();k.next();){var l=k.value;l.isTreeLink&&(h||l.rd||l.Ya(),l=l.Gt(a),null!==l&&l!==a&&!b.contains(l)&&(b.add(l),h||(l.Ub(!0),l.Rh(),g&&e.gk(l,f)),2<d||l.wasTreeExpanded))&&(l.wasTreeExpanded=!1,rp(l,b,c,d-1,e,f,g))}a.isTreeExpanded=!0} ma.Object.defineProperties(T.prototype,{portSpreading:{configurable:!0,get:function(){return this.wp},set:function(a){var b=this.wp;b!==a&&(F&&hb(a,T,T,"portSpreading"),this.wp=a,this.g("portSpreading",b,a),a=this.diagram,null!==a&&a.undoManager.isUndoingRedoing||this.md())}},avoidable:{configurable:!0,get:function(){return 0!==(this.T&8)},set:function(a){var b=0!==(this.T&8);if(b!==a){F&&A(a,"boolean",T,"avoidable");this.T^=8;var c=this.diagram;null!==c&&Nk(c,this);this.g("avoidable", b,a)}}},avoidableMargin:{configurable:!0,get:function(){return this.Vk},set:function(a){"number"===typeof a?a=new lc(a):w(a,lc,T,"avoidableMargin");var b=this.Vk;if(!b.A(a)){this.Vk=a=a.J();var c=this.diagram;null!==c&&Nk(c,this);this.g("avoidableMargin",b,a)}}},linksConnected:{configurable:!0,get:function(){return this.cb.iterator}},linkConnected:{configurable:!0,get:function(){return this.Eo},set:function(a){var b=this.Eo;b!==a&&(null!==a&&A(a,"function", T,"linkConnected"),this.Eo=a,this.g("linkConnected",b,a))}},linkDisconnected:{configurable:!0,get:function(){return this.Fo},set:function(a){var b=this.Fo;b!==a&&(null!==a&&A(a,"function",T,"linkDisconnected"),this.Fo=a,this.g("linkDisconnected",b,a))}},linkValidation:{configurable:!0,get:function(){return this.Ii},set:function(a){var b=this.Ii;b!==a&&(null!==a&&A(a,"function",T,"linkValidation"),this.Ii=a,this.g("linkValidation",b,a))}},isLinkLabel:{configurable:!0, get:function(){return null!==this.El}},labeledLink:{configurable:!0,get:function(){return this.El},set:function(a){var b=this.El;if(b!==a){F&&null!==a&&w(a,R,T,"labeledLink");var c=this.diagram,d=this.data;if(null!==b){null!==b.hd&&(b.hd.remove(this),b.u());if(null!==c&&null!==d&&!c.undoManager.isUndoingRedoing){var e=b.data,f=c.model;if(null!==e&&f.Dm()){var g=f.pa(d);void 0!==g&&f.yy(e,g)}}this.containingGroup=null}this.El=a;null!==a&&(mp(a,this),null===c||null===d||c.undoManager.isUndoingRedoing|| (e=a.data,c=c.model,null!==e&&c.Dm()&&(d=c.pa(d),void 0!==d&&c.vv(e,d))),this.containingGroup=a.containingGroup);Tl(this);this.g("labeledLink",b,a)}}},port:{configurable:!0,get:function(){return this.Ct("")}},ports:{configurable:!0,get:function(){null===this.xc&&np(this);return this.xc.iteratorValues}},isTreeExpanded:{configurable:!0,get:function(){return 0!==(this.T&1)},set:function(a){var b=0!==(this.T&1);if(b!==a){F&&A(a,"boolean",T,"isTreeExpanded");this.T^= 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.Ub(a):a?this.expandTree():this.collapseTree()}}},wasTreeExpanded:{configurable:!0,get:function(){return 0!==(this.T&2)},set:function(a){var b=0!==(this.T&2);b!==a&&(F&&A(a,"boolean",T,"wasTreeExpanded"),this.T^=2,this.g("wasTreeExpanded",b,a))}},treeExpandedChanged:{configurable:!0, get:function(){return this.mq},set:function(a){var b=this.mq;b!==a&&(null!==a&&A(a,"function",T,"treeExpandedChanged"),this.mq=a,this.g("treeExpandedChanged",b,a))}},isTreeLeaf:{configurable:!0,get:function(){return 0!==(this.T&4)},set:function(a){var b=0!==(this.T&4);b!==a&&(F&&A(a,"boolean",T,"isTreeLeaf"),this.T^=4,this.g("isTreeLeaf",b,a))}}});T.prototype.expandTree=T.prototype.expandTree;T.prototype.collapseTree=T.prototype.collapseTree;T.prototype.findTreeParts=T.prototype.Vz; T.prototype.findTreeChildrenNodes=T.prototype.Pv;T.prototype.findTreeChildrenLinks=T.prototype.Dq;T.prototype.findTreeLevel=T.prototype.Tz;T.prototype.findTreeParentChain=T.prototype.Uz;T.prototype.findTreeParentNode=T.prototype.Kg;T.prototype.findTreeParentLink=T.prototype.fj;T.prototype.findCommonTreeParent=T.prototype.Hz;T.prototype.findTreeRoot=T.prototype.Wz;T.prototype.isInTreeOf=T.prototype.qA;T.prototype.findPort=T.prototype.Ct;T.prototype.findLinksTo=T.prototype.Lz; T.prototype.findLinksBetween=T.prototype.Kz;T.prototype.findNodesInto=T.prototype.Mv;T.prototype.findNodesOutOf=T.prototype.Nv;T.prototype.findNodesConnected=T.prototype.Lv;T.prototype.findLinksInto=T.prototype.Dd;T.prototype.findLinksOutOf=T.prototype.Bq;T.prototype.findExternalTreeLinksConnected=T.prototype.by;T.prototype.invalidateConnectedLinks=T.prototype.md;T.prototype.invalidateLinkBundle=T.prototype.oA; var sp=new E(T,"SpreadingNone",10),fp=new E(T,"SpreadingEvenly",11),tp=new E(T,"SpreadingPacked",12);T.className="Node";T.SpreadingNone=sp;T.SpreadingEvenly=fp;T.SpreadingPacked=tp;function Hf(a){T.call(this,a);this.T|=4608;this.Po=new I;this.Ml=new I;this.Pa=this.cq=this.Ji=this.Qo=this.Oo=null;this.oc=new Ni;this.oc.group=this}la(Hf,T); Hf.prototype.cloneProtected=function(a){T.prototype.cloneProtected.call(this,a);this.T=this.T&-32769;a.Oo=this.Oo;a.Qo=this.Qo;a.Ji=this.Ji;a.cq=this.cq;var b=a.vm(function(a){return a instanceof Kg});b instanceof Kg?a.Pa=b:a.Pa=null;null!==this.oc?(a.oc=this.oc.copy(),a.oc.group=a):(null!==a.oc&&(a.oc.group=null),a.oc=null)};t=Hf.prototype; t.Ef=function(a){T.prototype.Ef.call(this,a);var b=a.tk();for(a=a.memberParts;a.next();){var c=a.value;c.u();c.D(8);c.jk();if(c instanceof T)c.md(b);else if(c instanceof R)for(c=c.labelNodes;c.next();)c.value.md(b)}}; t.Hk=function(a,b,c,d,e,f,g){if(a===Je&&"elements"===b)if(e instanceof Kg)null===this.Pa?this.Pa=e:this.Pa!==e&&v("Cannot insert a second Placeholder into the visual tree of a Group.");else{if(e instanceof U){var h=e.vm(function(a){return a instanceof Kg});h instanceof Kg&&(null===this.Pa?this.Pa=h:this.Pa!==h&&v("Cannot insert a second Placeholder into the visual tree of a Group."))}}else a===Ke&&"elements"===b&&null!==this.Pa&&(d===this.Pa?this.Pa=null:d instanceof U&&this.Pa.Mg(d)&&(this.Pa=null)); T.prototype.Hk.call(this,a,b,c,d,e,f,g)};t.Nh=function(a,b,c,d){this.jf=this.Pa;T.prototype.Nh.call(this,a,b,c,d)};t.Eb=function(){this.memberParts.each(function(a){a.Eb()});T.prototype.Eb.call(this)};t.nj=function(){if(!T.prototype.nj.call(this))return!1;for(var a=this.memberParts;a.next();){var b=a.value;if(b instanceof T){if(b.isVisible()&&Ij(b))return!1}else if(b instanceof R&&b.isVisible()&&Ij(b)&&b.fromNode!==this&&b.toNode!==this)return!1}return!0}; function Zo(a,b){if(a.Po.add(b)){b instanceof Hf&&a.Ml.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.Ub(!1)}b instanceof R&&!a.computesBoundsIncludingLinks||(b=a.Pa,null===b&&(b=a),b.u())} function $o(a,b){if(a.Po.remove(b)){b instanceof Hf&&a.Ml.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.Ub(!0)}b instanceof R&&!a.computesBoundsIncludingLinks||(b=a.Pa,null===b&&(b=a),b.u())}t.qk=function(){if(0<this.Po.count){var a=this.diagram;if(null!==a)for(var b=this.Po.copy().iterator;b.next();)a.remove(b.value)}T.prototype.qk.call(this)}; Hf.prototype.canAddMembers=function(a){var b=this.diagram;if(null===b)return!1;b=b.commandHandler;for(a=kl(a).iterator;a.next();)if(!b.isValidMember(this,a.value))return!1;return!0};Hf.prototype.addMembers=function(a,b){var c=this.diagram;if(null===c)return!1;c=c.commandHandler;var d=!0;for(a=kl(a).iterator;a.next();){var e=a.value;!b||c.isValidMember(this,e)?e.containingGroup=this:d=!1}return d}; Hf.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=Hf.prototype; t.md=function(a){void 0===a&&(a=null);var b=0!==(this.T&65536);T.prototype.md.call(this,a);if(!b)for(0!==(this.T&65536)!==!0&&(this.T=this.T^65536),b=this.Kv();b.next();){var c=b.value;if(null===a||!a.contains(c)){var d=c.fromNode;null!==d&&d!==this&&d.ee(this)&&!d.isVisible()?(ip(d,c.fromPort),ip(d,c.toPort),c.Ya()):(d=c.toNode,null!==d&&d!==this&&d.ee(this)&&!d.isVisible()&&(ip(d,c.fromPort),ip(d,c.toPort),c.Ya()))}}}; t.Kv=function(){var a=this.tk();a.add(this);for(var b=new I,c=a.iterator;c.next();){var d=c.value;if(d instanceof T)for(d=d.linksConnected;d.next();){var e=d.value;a.contains(e)||b.add(e)}}return b.iterator};t.Jz=function(){var a=this.tk();a.add(this);for(var b=new I,c=a.iterator;c.next();){var d=c.value;if(d instanceof T)for(d=d.linksConnected;d.next();){var e=d.value,f=e.fromNode;a.contains(f)&&f!==this||b.add(f);e=e.toNode;a.contains(e)&&e!==this||b.add(e)}}return b.iterator}; t.Iz=function(){function a(b,d){null!==b&&(d.add(b),a(b.containingGroup,d))}var b=new I;a(this,b);return b};t.tk=function(){var a=new I;il(a,this,!0,0,!0);a.remove(this);return a};t.Ub=function(a){T.prototype.Ub.call(this,a);for(var b=this.memberParts;b.next();)b.value.Ub(a)};Hf.prototype.collapseSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Re){a.Re=!0;var b=this.tk();up(this,b,a,this);a.Re=!1}}; function up(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ub(!1);f instanceof Hf&&f.isSubGraphExpanded&&(f.wasSubGraphExpanded=f.isSubGraphExpanded,up(f,b,c,d));if(f instanceof T)f.md(b),c.ek(f,d);else if(f instanceof R)for(f=f.labelNodes;f.next();)f.value.md(b)}a.isSubGraphExpanded=!1}Hf.prototype.expandSubGraph=function(){var a=this.diagram;if(null!==a&&!a.Re){a.Re=!0;var b=this.tk();vp(this,b,a,this);a.Re=!1}}; function vp(a,b,c,d){for(var e=a.memberParts;e.next();){var f=e.value;f.Ub(!0);f instanceof Hf&&f.wasSubGraphExpanded&&(f.wasSubGraphExpanded=!1,vp(f,b,c,d));if(f instanceof T)f.md(b),c.gk(f,d);else if(f instanceof R)for(f=f.labelNodes;f.next();)f.value.md(b)}a.isSubGraphExpanded=!0} Hf.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();T.prototype.move.call(this,a,b);a=new I;for(b=this.tk().iterator;b.next();)if(e=b.value,e instanceof R&&(e.suspendsRouting&&a.add(e),e.rd||e.fromNode!==this&&e.toNode!==this))e.suspendsRouting=!0;for(b.reset();b.next();)if(e=b.value,!(e.Sh()||e instanceof T&&e.isLinkLabel)){var g= e.position,h=e.location;g.o()?(f.x=g.x+d,f.y=g.y+c,e.position=f):h.o()&&(f.x=h.x+d,f.y=h.y+c,e.location=f)}for(b.reset();b.next();)if(e=b.value,e instanceof R&&(e.suspendsRouting=a.contains(e),e.rd||e.fromNode!==this&&e.toNode!==this))g=e.position,f.x=g.x+d,f.y=g.y+c,f.o()?e.move(f):e.Ya(),fk(e)&&e.Ya();J.free(f)}}; ma.Object.defineProperties(Hf.prototype,{placeholder:{configurable:!0,get:function(){return this.Pa}},computesBoundsAfterDrag:{configurable:!0,get:function(){return 0!==(this.T&2048)},set:function(a){var b=0!==(this.T&2048);b!==a&&(A(a,"boolean",Hf,"computesBoundsAfterDrag"),this.T^=2048,this.g("computesBoundsAfterDrag",b,a))}},computesBoundsIncludingLinks:{configurable:!0,get:function(){return 0!==(this.T&4096)},set:function(a){A(a,"boolean",Hf,"computesBoundsIncludingLinks"); var b=0!==(this.T&4096);b!==a&&(this.T^=4096,this.g("computesBoundsIncludingLinks",b,a))}},computesBoundsIncludingLocation:{configurable:!0,get:function(){return 0!==(this.T&8192)},set:function(a){A(a,"boolean",Hf,"computesBoundsIncludingLocation");var b=0!==(this.T&8192);b!==a&&(this.T^=8192,this.g("computesBoundsIncludingLocation",b,a))}},handlesDragDropForMembers:{configurable:!0,get:function(){return 0!==(this.T&16384)},set:function(a){A(a,"boolean",Hf,"handlesDragDropForMembers"); var b=0!==(this.T&16384);b!==a&&(this.T^=16384,this.g("handlesDragDropForMembers",b,a))}},memberParts:{configurable:!0,get:function(){return this.Po.iterator}},layout:{configurable:!0,get:function(){return this.oc},set:function(a){var b=this.oc;if(b!==a){null!==a&&w(a,Ni,Hf,"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.Rf=!0);this.g("layout",b,a);null!==c&&c.Vb()}}},memberAdded:{configurable:!0, enumerable:!0,get:function(){return this.Oo},set:function(a){var b=this.Oo;b!==a&&(null!==a&&A(a,"function",Hf,"memberAdded"),this.Oo=a,this.g("memberAdded",b,a))}},memberRemoved:{configurable:!0,get:function(){return this.Qo},set:function(a){var b=this.Qo;b!==a&&(null!==a&&A(a,"function",Hf,"memberRemoved"),this.Qo=a,this.g("memberRemoved",b,a))}},memberValidation:{configurable:!0,get:function(){return this.Ji},set:function(a){var b=this.Ji;b!==a&&(null!==a&&A(a,"function", Hf,"memberValidation"),this.Ji=a,this.g("memberValidation",b,a))}},ungroupable:{configurable:!0,get:function(){return 0!==(this.T&256)},set:function(a){var b=0!==(this.T&256);b!==a&&(A(a,"boolean",Hf,"ungroupable"),this.T^=256,this.g("ungroupable",b,a))}},isSubGraphExpanded:{configurable:!0,get:function(){return 0!==(this.T&512)},set:function(a){var b=0!==(this.T&512);if(b!==a){A(a,"boolean",Hf,"isSubGraphExpanded");this.T^=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.Pa&&this.Pa.u(),this.memberParts.each(function(a){a.updateAdornments()})):a?this.expandSubGraph():this.collapseSubGraph()}}},wasSubGraphExpanded:{configurable:!0,get:function(){return 0!==(this.T&1024)},set:function(a){var b=0!==(this.T&1024);b!==a&&(A(a,"boolean",Hf,"wasSubGraphExpanded"),this.T^=1024,this.g("wasSubGraphExpanded", b,a))}},subGraphExpandedChanged:{configurable:!0,get:function(){return this.cq},set:function(a){var b=this.cq;b!==a&&(null!==a&&A(a,"function",Hf,"subGraphExpandedChanged"),this.cq=a,this.g("subGraphExpandedChanged",b,a))}},Gk:{configurable:!0,get:function(){return 0!==(this.T&32768)},set:function(a){0!==(this.T&32768)!==a&&(this.T^=32768)}}});Hf.prototype.expandSubGraph=Hf.prototype.expandSubGraph;Hf.prototype.collapseSubGraph=Hf.prototype.collapseSubGraph; Hf.prototype.findSubGraphParts=Hf.prototype.tk;Hf.prototype.findContainingGroupChain=Hf.prototype.Iz;Hf.prototype.findExternalNodesConnected=Hf.prototype.Jz;Hf.prototype.findExternalLinksConnected=Hf.prototype.Kv;Hf.prototype.ensureBounds=Hf.prototype.Eb;Hf.className="Group";function Kg(){N.call(this);this.lb=Ec;this.Kp=new L(NaN,NaN,NaN,NaN)}la(Kg,N);Kg.prototype.cloneProtected=function(a){N.prototype.cloneProtected.call(this,a);a.lb=this.lb.J();a.Kp=this.Kp.copy()}; Kg.prototype.Ph=function(a){if(null===this.background&&null===this.areaBackground)return!1;var b=this.naturalBounds;return rc(0,0,b.width,b.height,a.x,a.y)}; Kg.prototype.Gm=function(){var a=this.part;null!==a&&(a instanceof Hf||a instanceof Te)||v("Placeholder is not inside a Group or Adornment.");if(a instanceof Hf){var b=this.computeBorder(this.Kp),c=this.minSize,d=this.tc;gc(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);yl(this,0,0,d.width,d.height);d=a.memberParts;for(c=!1;d.next();)if(d.value.isVisible()){c=!0;break}d=a.diagram;!c||null===d||d.animationManager.$v(a)||isNaN(b.x)|| isNaN(b.y)||(c=J.alloc(),c.pj(b,a.locationSpot),c.A(a.location)||(a.location=new J(c.x,c.y)),J.free(c))}else{b=this.tc;c=this.lb;d=c.left+c.right;var e=c.top+c.bottom,f=a.adornedObject;a.angle=f.hj();var g=0;f instanceof Yf&&(g=f.strokeWidth);var h=f.Gf(),k=f.naturalBounds,l=(k.width+g)*h;g=(k.height+g)*h;a.type!==U.Link&&(f=f.ma("Selection"===a.category?Hc:a.locationSpot,J.alloc()),a.location=f,J.free(f));isNaN(l)||isNaN(g)?(a=a.adornedObject,l=a.ma(Hc,J.alloc()),f=L.allocAt(l.x,l.y,0,0),f.Ve(a.ma(Sc, l)),f.Ve(a.ma(Jc,l)),f.Ve(a.ma(Oc,l)),gc(b,f.width+d||0,f.height+e||0),yl(this,-c.left,-c.top,b.width,b.height),J.free(l),L.free(f)):(gc(b,l+d||0,g+e||0),yl(this,-c.left,-c.top,b.width,b.height))}};Kg.prototype.Nh=function(a,b,c,d){this.actualBounds.h(a,b,c,d)}; Kg.prototype.computeBorder=function(a){var b=this.part,c=b.diagram;if(null!==c&&b instanceof Hf&&!b.layer.isTemporary&&b.computesBoundsAfterDrag&&this.Kp.o()){var d=c.toolManager.findTool("Dragging");if(d===c.currentTool&&(c=d.computeBorder(b,this.Kp,a),null!==c))return c}c=L.alloc();d=this.computeMemberBounds(c);var e=this.lb;b instanceof Hf&&!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));L.free(c); b instanceof Hf&&b.computesBoundsIncludingLocation&&b.location.o()&&a.Ve(b.location);return a}; Kg.prototype.computeMemberBounds=function(a){if(!(this.part instanceof Hf))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 R){if(!b.computesBoundsIncludingLinks)continue;if(Hj(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};ma.Object.defineProperties(Kg.prototype,{padding:{configurable:!0,get:function(){return this.lb},set:function(a){"number"===typeof a?a=new lc(a):w(a,lc,Kg,"padding");var b=this.lb;b.A(a)||(this.lb=a=a.J(),this.g("padding",b,a),this.u())}}});Kg.className="Placeholder"; function R(){S.call(this,U.Link);this.Va=8;this.bf=null;this.cf="";this.yf=this.bo=null;this.zf="";this.lq=null;this.Qk=og;this.En=0;this.Gn=og;this.Hn=NaN;this.Xj=wp;this.Yp=.5;this.hd=null;this.Cb=(new H).freeze();this.wh=this.Ic=null;this.Rl=new L;this.qa=new Fd;this.po=!0;this.L=this.w=this.Tf=this.bg=null;this.l=[];this.nv=new J;this.Wr=this.Fx=this.Ex=null;this.Iu=NaN;this.S=null}la(R,S); R.prototype.cloneProtected=function(a){S.prototype.cloneProtected.call(this,a);a.Va=this.Va&-113;a.cf=this.cf;a.bo=this.bo;a.zf=this.zf;a.lq=this.lq;a.Qk=this.Qk;a.En=this.En;a.Gn=this.Gn;a.Hn=this.Hn;a.Xj=this.Xj;a.Yp=this.Yp;null!==this.S&&(a.S=this.S.copy())};t=R.prototype;t.Ef=function(a){S.prototype.Ef.call(this,a);this.cf=a.cf;this.zf=a.zf;a.Ic=null;a.Ya();a.Tf=this.Tf;var b=a.fromPort;null!==b&&ip(a.fromNode,b);b=a.toPort;null!==b&&ip(a.toNode,b)}; t.mb=function(a){a.classType===R?2===(a.value&2)?this.routing=a:a===rg||a===ng||a===mg?this.curve=a:a===xp||a===yp||a===zp?this.adjusting=a:a!==wp&&a!==og&&v("Unknown Link enum value for a Link property: "+a):S.prototype.mb.call(this,a)};t.Kc=function(){null===this.S&&(this.S=new ul)};t.nj=function(){var a=this.fromNode;if(null!==a){var b=a.findVisibleNode();null!==b&&(a=b);if(Ij(a)||Jj(a))return!1}a=this.toNode;return null!==a&&(b=a.findVisibleNode(),null!==b&&(a=b),Ij(a)||Jj(a))?!1:!0};t.zw=function(){return!1}; t.eu=function(){};t.bc=function(){return!1};R.prototype.computeAngle=function(a,b,c){return R.computeAngle(b,c)};R.computeAngle=function(a,b){switch(a){default:case og:a=0;break;case mn:a=b;break;case en:a=b+90;break;case gn:a=b-90;break;case Ap:a=b+180;break;case nn:a=K.Qq(b);90<a&&270>a&&(a-=180);break;case fn:a=K.Qq(b+90);90<a&&270>a&&(a-=180);break;case hn:a=K.Qq(b-90);90<a&&270>a&&(a-=180);break;case jn:a=K.Qq(b);if(45<a&&135>a||225<a&&315>a)return 0;90<a&&270>a&&(a-=180)}return K.Qq(a)}; function ep(a){var b=a.fromNode,c=a.toNode,d=null;null!==b?d=null!==c?b.ay(c):b.containingGroup:null!==c?d=c.containingGroup:d=null;b=d;c=a.oi;if(c!==b){null!==c&&$o(c,a);a.oi=b;null!==b&&Zo(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.rd||a.Ex!==c&&a.Fx!==c||a.Ya()}if(a.isLabeledLink)for(a=a.labelNodes;a.next();)a.value.containingGroup=d}t=R.prototype; t.Rh=function(){var a=this.containingGroup;null!==a&&this.fromNode!==a&&this.toNode!==a&&a.computesBoundsIncludingLinks&&S.prototype.Rh.call(this)};t.Gt=function(a){F&&w(a,T,R,"getOtherNode:node");var b=this.fromNode;return a===b?this.toNode:b};t.cA=function(a){F&&w(a,N,R,"getOtherPort:port");var b=this.fromPort;return a===b?this.toPort:b};function mp(a,b){null===a.hd&&(a.hd=new I);a.hd.add(b);a.u()} t.Gq=function(a){S.prototype.Gq.call(this,a);Bp(this)&&this.Jq(this.actualBounds);if(!a){a=this.bf;var b=null;null!==a&&(b=this.fromPort,kp(a,this,b));var c=this.yf;if(null!==c){var d=this.toPort;c===a&&d===b||kp(c,this,d)}Cp(this)}};t.Hq=function(a){S.prototype.Hq.call(this,a);Bp(this)&&this.Jq(this.actualBounds);if(!a){a=this.bf;var b=null;null!==a&&(b=this.fromPort,lp(a,this,b));var c=this.yf;if(null!==c){var d=this.toPort;c===a&&d===b||lp(c,this,d)}Dp(this)}}; t.qk=function(){this.rd=!0;if(null!==this.hd){var a=this.diagram;if(null!==a)for(var b=this.hd.copy().iterator;b.next();)a.remove(b.value)}null!==this.data&&(a=this.diagram,null!==a&&a.partManager.removeDataForLink(this))};R.prototype.updateRelationshipsFromData=function(){if(null!==this.data){var a=this.diagram;null!==a&&a.partManager.updateRelationshipsFromData(this)}}; R.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?S.prototype.move.call(this,a,!1):(a=J.allocAt(c.x+d,c.y+e),S.prototype.move.call(this,a,!1),J.free(a));Cf(this,d,e);for(a=this.labelNodes;a.next();)b=a.value,c=b.position,b.moveTo(c.x+d,c.y+e)}; R.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};R.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}; R.prototype.computeMidPoint=function(a){var b=this.pointsCount;if(0===b)return a.assign(Vb),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()===rg))return this.qa.Sv(.5,a),a.add(this.i(0)),c=this.qa.figures.first(),a.offset(-c.startX,-c.startY),a;if(this.computeCurve()===rg){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.kz(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}; R.prototype.computeMidAngle=function(){var a=this.pointsCount;if(2>a)return NaN;if(2===a)return this.i(0).Xa(this.i(1));if(this.isOrthogonal&&(15<=this.computeCorner()||this.computeCurve()===rg))return this.qa.jy(.5);if(this.computeCurve()===rg&&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.jz(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).Xa(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).Xa(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.Xa(d)};t=R.prototype;t.i=function(a){return this.Cb.j[a]}; t.pd=function(a,b){F&&(w(b,J,R,"setPoint"),b.o()||v("Link.setPoint called with a Point that does not have real numbers: "+b.toString()));F&&null===this.Ic&&v("Call Link.startRoute before modifying the points of the route.");this.Cb.od(a,b)};t.N=function(a,b,c){F&&(C(b,R,"setPointAt:x"),C(c,R,"setPointAt:y"));F&&null===this.Ic&&v("Call Link.startRoute before modifying the points of the route.");this.Cb.od(a,new J(b,c))}; t.mA=function(a,b){F&&(w(b,J,R,"insertPoint"),b.o()||v("Link.insertPoint called with a Point that does not have real numbers: "+b.toString()));F&&null===this.Ic&&v("Call Link.startRoute before modifying the points of the route.");this.Cb.yb(a,b)};t.m=function(a,b,c){F&&(C(b,R,"insertPointAt:x"),C(c,R,"insertPointAt:y"));F&&null===this.Ic&&v("Call Link.startRoute before modifying the points of the route.");this.Cb.yb(a,new J(b,c))}; t.Me=function(a){F&&(w(a,J,R,"addPoint"),a.o()||v("Link.addPoint called with a Point that does not have real numbers: "+a.toString()));F&&null===this.Ic&&v("Call Link.startRoute before modifying the points of the route.");this.Cb.add(a)};t.Cf=function(a,b){F&&(C(a,R,"insertPointAt:x"),C(b,R,"insertPointAt:y"));F&&null===this.Ic&&v("Call Link.startRoute before modifying the points of the route.");this.Cb.add(new J(a,b))}; t.pw=function(a){F&&null===this.Ic&&v("Call Link.startRoute before modifying the points of the route.");this.Cb.hb(a)};t.kk=function(){F&&null===this.Ic&&v("Call Link.startRoute before modifying the points of the route.");this.Cb.clear()}; function Cf(a,b,c){if(0!==b||0!==c){for(var d=a.rd,e=new H,f=a.Cb.iterator;f.next();){var g=f.value;e.add((new J(g.x+b,g.y+c)).freeze())}e.freeze();f=a.Cb;a.Cb=e;g=a.diagram;isNaN(b)||isNaN(c)||null!==g&&g.animationManager.wc?a.u():(a.lg.h(a.lg.x+b,a.lg.y+c),a.sa.h(a.sa.x+b,a.sa.y+c),Tl(a));d&&Ep(a);null!==g&&g.animationManager.wc&&(a.wh=e);a.g("points",f,e)}}t.Vh=function(){null===this.Ic&&(this.Ic=this.Cb,this.Cb=this.Cb.copy())}; t.Df=function(){if(null!==this.Ic){for(var a=this.Ic,b=this.Cb,c=Infinity,d=Infinity,e=a.j,f=e.length,g=0;g<f;g++){var h=e[g];c=Math.min(h.x,c);d=Math.min(h.y,d)}h=g=Infinity;for(var k=b.j,l=k.length,m=0;m<l;m++){var n=k[m];g=Math.min(n.x,g);h=Math.min(n.y,h);n.freeze()}b.freeze();if(l===f)for(f=0;f<l;f++){if(m=e[f],n=k[f],m.x-c!==n.x-g||m.y-d!==n.y-h){this.u();this.ic();break}}else this.u(),this.ic();this.Ic=null;c=this.diagram;null!==c&&c.animationManager.wc&&(this.wh=b);Ep(this);this.g("points", a,b)}};t.Ay=function(){null!==this.Ic&&(this.Cb=this.Ic,this.Ic=null)};function Ep(a){0===a.Cb.count?a.rd=!1:(a.rd=!0,a.Wr=null,a.Iu=NaN,a.defaultFromPoint=a.i(0),a.defaultToPoint=a.i(a.pointsCount-1),Fp(a,!1))} t.Ya=function(){if(!this.suspendsRouting){var a=this.diagram;if(a){if(a.Pt.contains(this)||a.undoManager.isUndoingRedoing)return;a=a.animationManager;if(a.isTicking&&!a.isAnimating)return;null!==this.wh&&!a.isTicking&&a.isAnimating&&(this.wh=null)}a=this.path;null!==a&&(this.rd=!1,this.u(),a.u())}};t.tj=function(){if(!this.rd&&!this.Bv){var a=!0;try{this.Bv=!0,this.Vh(),a=this.computePoints()}finally{this.Bv=!1,a?this.Df():this.Ay()}}}; R.prototype.computePoints=function(){var a=this.diagram;if(null===a)return!1;var b=this.fromNode,c=null;null===b?(a.uh||(a.Sl=new Yf,a.Sl.desiredSize=Wb,a.Sl.strokeWidth=0,a.uh=new T,a.uh.add(a.Sl),a.uh.Eb()),this.defaultFromPoint&&(a.uh.position=a.uh.location=this.defaultFromPoint,a.uh.Eb(),b=a.uh,c=a.Sl)):c=this.fromPort;if(null!==c&&!b.isVisible()){var d=b.findVisibleNode();null!==d&&d!==b?(b=d,c=d.port):b=d}this.Ex=b;if(null===b||!b.location.o())return!1;for(;!(null===c||c.actualBounds.o()&&c.Kf());)c= c.panel;if(null===c)return!1;var e=this.toNode,f=null;null===e?(a.vh||(a.Tl=new Yf,a.Tl.desiredSize=Wb,a.Tl.strokeWidth=0,a.vh=new T,a.vh.add(a.Tl),a.vh.Eb()),this.defaultToPoint&&(a.vh.position=a.vh.location=this.defaultToPoint,a.vh.Eb(),e=a.vh,f=a.Tl)):f=this.toPort;null===f||e.isVisible()||(a=e.findVisibleNode(),null!==a&&a!==e?(e=a,f=a.port):e=a);this.Fx=e;if(null===e||!e.location.o())return!1;for(;!(null===f||f.actualBounds.o()&&f.Kf());)f=f.panel;if(null===f)return!1;var g=this.pointsCount; d=this.computeSpot(!0,c);a=this.computeSpot(!1,f);var h=Gp(d),k=Gp(a),l=c===f&&null!==c,m=this.isOrthogonal,n=this.curve===rg;this.bg=l&&!m?n=!0:!1;var p=this.computeAdjusting()===og||l;if(!m&&!l&&h&&k){if(h=!1,!p&&3<=g&&(p=this.getLinkPoint(b,c,d,!0,!1,e,f),k=this.getLinkPoint(e,f,a,!1,!1,b,c),h=this.adjustPoints(0,p,g-1,k))&&(p=this.getLinkPoint(b,c,d,!0,!1,e,f),k=this.getLinkPoint(e,f,a,!1,!1,b,c),this.adjustPoints(0,p,g-1,k)),!h)if(this.kk(),n){g=this.getLinkPoint(b,c,d,!0,!1,e,f);p=this.getLinkPoint(e, f,a,!1,!1,b,c);h=p.x-g.x;k=p.y-g.y;l=this.computeCurviness();n=m=0;var r=g.x+h/3,q=g.y+k/3,u=r,x=q;K.C(k,0)?x=0<h?x-l:x+l:(m=-h/k,n=Math.sqrt(l*l/(m*m+1)),0>l&&(n=-n),u=(0>k?-1:1)*n+r,x=m*(u-r)+q);r=g.x+2*h/3;q=g.y+2*k/3;var y=r,z=q;K.C(k,0)?z=0<h?z-l:z+l:(y=(0>k?-1:1)*n+r,z=m*(y-r)+q);this.kk();this.Me(g);this.Cf(u,x);this.Cf(y,z);this.Me(p);this.pd(0,this.getLinkPoint(b,c,d,!0,!1,e,f));this.pd(3,this.getLinkPoint(e,f,a,!1,!1,b,c))}else d=this.getLinkPoint(b,c,d,!0,!1,e,f),a=this.getLinkPoint(e, f,a,!1,!1,b,c),this.hasCurviness()?(p=a.x-d.x,e=a.y-d.y,f=this.computeCurviness(),b=d.x+p/2,c=d.y+e/2,g=b,h=c,K.C(e,0)?h=0<p?h-f:h+f:(p=-p/e,g=Math.sqrt(f*f/(p*p+1)),0>f&&(g=-g),g=(0>e?-1:1)*g+b,h=p*(g-b)+c),this.Me(d),this.Cf(g,h)):this.Me(d),this.Me(a)}else{n=this.isAvoiding;p&&(m&&n||l)&&this.kk();var B=l?this.computeCurviness():0;n=this.getLinkPoint(b,c,d,!0,m,e,f);r=u=q=0;if(m||!h||l)x=this.computeEndSegmentLength(b,c,d,!0),r=this.getLinkDirection(b,c,n,d,!0,m,e,f),l&&(h||d.A(a)||!m&&1===d.x+ a.x&&1===d.y+a.y)&&(r-=m?90:30,0>B&&(r-=180)),0>r?r+=360:360<=r&&(r-=360),l&&(x+=Math.abs(B)*(m?1:2)),0===r?q=x:90===r?u=x:180===r?q=-x:270===r?u=-x:(q=x*Math.cos(r*Math.PI/180),u=x*Math.sin(r*Math.PI/180)),d.Sb()&&l&&(x=c.ma(Mc,J.alloc()),y=J.allocAt(x.x+1E3*q,x.y+1E3*u),this.getLinkPointFromPoint(b,c,x,y,!0,n),J.free(x),J.free(y));x=this.getLinkPoint(e,f,a,!1,m,b,c);var D=z=y=0;if(m||!k||l){var G=this.computeEndSegmentLength(e,f,a,!1);D=this.getLinkDirection(e,f,x,a,!1,m,b,c);l&&(k||d.A(a)||!m&& 1===d.x+a.x&&1===d.y+a.y)&&(D+=m?0:30,0>B&&(D+=180));0>D?D+=360:360<=D&&(D-=360);l&&(G+=Math.abs(B)*(m?1:2));0===D?y=G:90===D?z=G:180===D?y=-G:270===D?z=-G:(y=G*Math.cos(D*Math.PI/180),z=G*Math.sin(D*Math.PI/180));a.Sb()&&l&&(a=f.ma(Mc,J.alloc()),d=J.allocAt(a.x+1E3*y,a.y+1E3*z),this.getLinkPointFromPoint(e,f,a,d,!1,x),J.free(a),J.free(d))}a=n;if(m||!h||l)a=new J(n.x+q,n.y+u);d=x;if(m||!k||l)d=new J(x.x+y,x.y+z);!p&&!m&&h&&3<g&&this.adjustPoints(0,n,g-2,d)?this.pd(g-1,x):!p&&!m&&k&&3<g&&this.adjustPoints(1, a,g-1,x)?this.pd(0,n):!p&&(m?6<=g:4<g)&&this.adjustPoints(1,a,g-2,d)?(this.pd(0,n),this.pd(g-1,x)):(this.kk(),this.Me(n),(m||!h||l)&&this.Me(a),m&&this.addOrthoPoints(a,r,d,D,b,e),(m||!k||l)&&this.Me(d),this.Me(x))}return!0};function Hp(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} R.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.je()||(e=e.panel);if(null===e){e=d.x;d=d.y;var g=c.x;c=c.y}else{a=e.Cd;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.uk(e,d,g,c,f);null!== a&&f.transform(a);return f};function Ip(a,b){var c=b.vp;null===c&&(c=new Jp,c.port=b,c.node=b.part,b.vp=c);return Kp(c,a)} R.prototype.getLinkPoint=function(a,b,c,d,e,f,g,h){void 0===h&&(h=new J);if(c.ab()&&!Gp(c))return b.ma(c,h),h;if(c.nd()){var k=Ip(this,b);if(null!==k){h.assign(k.Nq);if(e&&this.routing===Lp){var l=Ip(this,g);if(null!==l&&k.sm<l.sm){k=J.alloc();l=J.alloc();var m=new L(b.ma(Hc,k),b.ma(Sc,l)),n=this.computeSpot(!d,g);a=this.getLinkPoint(f,g,n,!d,e,a,b,l);(c.If(Uc)||c.If(Vc))&&a.y>=m.y&&a.y<=m.y+m.height?h.y=a.y:(c.If(Tc)||c.If(Wc))&&a.x>=m.x&&a.x<=m.x+m.width&&(h.x=a.x);J.free(k);J.free(l)}}return h}}c= b.ma(.5===c.x&&.5===c.y?c:Mc,J.alloc());this.pointsCount>(e?6:2)?(g=d?this.i(1):this.i(this.pointsCount-2),e&&(g=Hp(c,g.copy()))):(k=this.computeSpot(!d,g),f=J.alloc(),g=g.ma(.5===k.x&&.5===k.y?k:Mc,f),e&&(g=Hp(c,g)),J.free(f));this.getLinkPointFromPoint(a,b,c,g,d,h);J.free(c);return h}; R.prototype.getLinkDirection=function(a,b,c,d,e,f,g,h){a:if(d.ab())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.nd()&&(k=Ip(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.ma(Mc,J.alloc());this.pointsCount>(f?6:2)?(h=e?this.i(1):this.i(this.pointsCount-2),h=f?Hp(k,h.copy()):c):(c=J.alloc(),h=h.ma(Mc,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.Sb()&&g.ee(a)&&(k+=180,360<=k&&(k-=360));if(Gp(d))return k;a=b.hj();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};R.prototype.computeEndSegmentLength=function(a,b,c,d){if(null!==b&&c.nd()&&(a=Ip(this,b),null!==a))return a.Iv;a=d?this.fromEndSegmentLength:this.toEndSegmentLength;null!==b&&isNaN(a)&&(a=d?b.fromEndSegmentLength:b.toEndSegmentLength);isNaN(a)&&(a=10);return a}; R.prototype.computeSpot=function(a,b){void 0===b&&(b=null);a?(a=b?b:this.fromPort,null===a?a=Mc:(b=this.fromSpot,b.Gb()&&(b=a.fromSpot),a=b===ld?Gc:b)):(a=b?b:this.toPort,null===a?a=Mc:(b=this.toSpot,b.Gb()&&(b=a.toSpot),a=b===ld?Gc:b));return a};function Gp(a){return a===Gc||.5===a.x&&.5===a.y}R.prototype.computeOtherPoint=function(a,b){if(this.computeAdjusting()!==og&&4<this.pointsCount)return this.computeMidPoint(new J);a=b.ma(Mc);b=b.vp;b=null!==b?Kp(b,this):null;null!==b&&(a=b.Nq);return a}; R.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}; R.prototype.Ff=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=Ib.alloc(),g.reset());g.multiply(this.transform);if(this.Oh(a,g))return yn(this,b,c,e),void 0===f&&Ib.free(g),!0;if(this.Mc(a,g)){var h=!1;if(!this.isAtomic)for(var k=this.Z.j,l=k.length;l--;){var m=k[l];if(m.visible||m===this.locationObject){var n=m.actualBounds,p=this.naturalBounds;if(!(n.x>p.width||n.y>p.height||0>n.x+n.width||0>n.y+n.height)){n=Ib.alloc();n.set(g); if(m instanceof U)h=m.Ff(a,b,c,d,e,n);else if(this.path===m){if(m instanceof Yf)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.Oh(r,q))h=!0;else{if(void 0===q&&(q=m.transform,r.Oe(m.actualBounds))){h=!0;break b}h=r.left;p=r.right;var u=r.top;r=r.bottom;var x=J.alloc(),y=J.alloc(),z=J.alloc(),B=Ib.alloc();B.set(q);B.dw(m.transform);B.Kt();y.x=p;y.y=u;y.transform(B);x.x=h;x.y=u;x.transform(B);q=!1;$n(m,x,y,z)?q=!0:(x.x=p,x.y=r,x.transform(B),$n(m,x,y,z)?q=!0:(y.x= h,y.y=r,y.transform(B),$n(m,x,y,z)?q=!0:(x.x=h,x.y=u,x.transform(B),$n(m,x,y,z)&&(q=!0))));Ib.free(B);J.free(x);J.free(y);J.free(z);h=q}}else h=m.Oh(h,n)}else h=Al(m,a,d,n);h&&(p=m,null!==b&&(p=b(m)),p&&(null===c||c(p))&&e.add(p));Ib.free(n)}}}void 0===f&&Ib.free(g);return h||null!==this.background||null!==this.areaBackground}void 0===f&&Ib.free(g);return!1}; R.prototype.computeCurve=function(){if(null===this.bg){var a=this.fromPort,b=this.isOrthogonal;this.bg=null!==a&&a===this.toPort&&!b}return this.bg?rg:this.curve};R.prototype.computeCorner=function(){if(this.curve===rg)return 0;var a=this.corner;if(isNaN(a)||0>a)a=10;return a}; R.prototype.findMidLabel=function(){for(var a=this.path,b=this.Z.j,c=b.length,d=0;d<c;d++){var e=b[d];if(e!==a&&!e.isPanelMain&&(-Infinity===e.segmentIndex||isNaN(e.segmentIndex)))return e}for(a=this.labelNodes;a.next();)if(b=a.value,-Infinity===b.segmentIndex||isNaN(b.segmentIndex))return b;return null}; R.prototype.computeSpacing=function(){if(!this.isVisible())return 0;var a=Math.max(14,this.computeThickness());var b=this.fromPort,c=this.toPort;if(null!==b&&null!==c){var d=this.findMidLabel();if(null!==d){var e=d.naturalBounds,f=d.margin,g=isNaN(e.width)?30:e.width*d.scale+f.left+f.right;e=isNaN(e.height)?14:e.height*d.scale+f.top+f.bottom;d=d.segmentOrientation;d===mn||d===nn||d===Ap?a=Math.max(a,e):d===gn||d===hn||d===en||d===fn?a=Math.max(a,g):(b=b.ma(Mc).Xa(c.ma(Mc))/180*Math.PI,a=Math.max(a, Math.abs(Math.sin(b)*g)+Math.abs(Math.cos(b)*e)+1));this.curve===rg&&(a*=1.333)}}return a};R.prototype.arrangeBundledLinks=function(a,b){if(b)for(b=0;b<a.length;b++){var c=a[b];c.computeAdjusting()===og&&c.Ya()}}; R.prototype.computeCurviness=function(){var a=this.curviness;if(isNaN(a)){a=16;var b=this.Tf;if(null!==b){for(var c=La(),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.St===this.fromNode&&(a=-a);Oa(c)}}return a};R.prototype.computeThickness=function(){if(!this.isVisible())return 0;var a=this.path;return null!==a?Math.max(a.strokeWidth,1):1}; R.prototype.hasCurviness=function(){return!isNaN(this.curviness)||null!==this.Tf}; R.prototype.adjustPoints=function(a,b,c,d){var e=this.computeAdjusting();if(this.isOrthogonal){if(e===yp)return!1;e===zp&&(e=xp)}switch(e){case yp:var f=this.i(a),g=this.i(c);if(!f.Sa(b)||!g.Sa(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.ca(l,0)){if(K.ca(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.ca(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.pd(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.ca(b,0)||(K.ca(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.N(a,g+b*Math.cos(h),n+b*Math.sin(h)));this.pd(c,d)}}return!0;case zp:f=this.i(a);n=this.i(c);if(!f.Sa(b)||!n.Sa(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.pd(a,b);for(a+=1;a<c;a++){b=this.i(a); var u=b.x,x=b.y,y=.5;0!==l&&(y=((e-u)*(e-g)+(f-x)*(f-n))/l);var z=e+y*(g-e),B=f+y*(n-f);b=Math.sqrt((u-z)*(u-z)+(x-B)*(x-B));x<q*(u-z)+B&&(b=-b);0<q&&(b=-b);u=h+y*(k-h);y=m+y*(p-m);0!==q?(b=u+b/r,this.N(a,b,y-(b-u)/q)):this.N(a,u,y+b)}this.pd(c,d)}return!0;case xp: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.C(e.y,f.y)?K.C(f.x,g.x)?m=b.y:K.C(f.y,g.y)&&(h=b.x):K.C(e.x,f.x)&&(K.C(f.y,g.y)?h=b.x:K.C(f.x,g.x)&&(m=b.y)),this.N(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.C(e.y,f.y)?K.C(f.x,g.x)?m=d.y:K.C(f.y,g.y)&&(h=d.x):K.C(e.x,f.x)&&(K.C(f.y,g.y)?h=d.x:K.C(f.x,g.x)&&(m=d.y)),this.N(c-1,h,m),fk(this))){this.N(a+1,n,l);this.N(c-1,k,p);c=!1;break a}this.pd(a,b);this.pd(c,d);c=!0}return c;default:return!1}}; R.prototype.addOrthoPoints=function(a,b,c,d,e,f){b=-45<=b&&45>b?0:45<=b&&135>b?90:135<=b&&225>b?180:270;d=-45<=d&&45>d?0:45<=d&&135>d?90:135<=d&&225>d?180:270;var g=e.actualBounds.copy(),h=f.actualBounds.copy();if(g.o()&&h.o()){g.cd(8,8);h.cd(8,8);g.Ve(a);h.Ve(c);if(0===b)if(c.x>a.x||270===d&&c.y<a.y&&h.right>a.x||90===d&&c.y>a.y&&h.right>a.x){var k=new J(c.x,a.y);var l=new J(c.x,(a.y+c.y)/2);180===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.y<a.y||90===d&& c.y>a.y?(k.x=a.x<h.left?this.computeMidOrthoPosition(a.x,a.y,h.left,c.y,!1):a.x<h.right&&(270===d&&a.y<h.top||90===d&&a.y>h.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.right,l.x=k.x,l.y=c.y):0===d&&a.x<h.left&&a.y>h.top&&a.y<h.bottom&&(k.x=a.x,k.y=a.y<c.y?Math.min(c.y,h.top):Math.max(c.y,h.bottom),l.y=k.y)}else{k=new J(a.x,c.y);l=new J((a.x+c.x)/2,c.y);if(180===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)180===d&&(h.fa(a)||g.fa(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0): c.y<a.y&&(180===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(180===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x>=g.left&&c.x<=a.x||a.x<=h.right&&a.x>=c.x){if(90===d||270===d)k=new J(Math.max((a.x+c.x)/2,a.x),a.y),l=new J(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,0===d?g.top:Math.min(g.top,h.top)):Math.max(c.y,0===d?g.bottom:Math.max(g.bottom, h.bottom)),l.x=c.x,l.y=k.y}else if(180===b)if(c.x<a.x||270===d&&c.y<a.y&&h.left<a.x||90===d&&c.y>a.y&&h.left<a.x)k=new J(c.x,a.y),l=new J(c.x,(a.y+c.y)/2),0===d?(k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1),l.x=k.x,l.y=c.y):270===d&&c.y<a.y||90===d&&c.y>a.y?(k.x=a.x>h.right?this.computeMidOrthoPosition(a.x,a.y,h.right,c.y,!1):a.x>h.left&&(270===d&&a.y<h.top||90===d&&a.y>h.bottom)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):h.left,l.x=k.x,l.y=c.y):180===d&&a.x>h.right&&a.y>h.top&&a.y< h.bottom&&(k.x=a.x,k.y=a.y<c.y?Math.min(c.y,h.top):Math.max(c.y,h.bottom),l.y=k.y);else{k=new J(a.x,c.y);l=new J((a.x+c.x)/2,c.y);if(0===d||90===d&&c.y<g.top||270===d&&c.y>g.bottom)0===d&&(h.fa(a)||g.fa(c))?k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):c.y<a.y&&(0===d||90===d)?k.y=this.computeMidOrthoPosition(a.x,g.top,c.x,Math.max(c.y,h.bottom),!0):c.y>a.y&&(0===d||270===d)&&(k.y=this.computeMidOrthoPosition(a.x,g.bottom,c.x,Math.min(c.y,h.top),!0)),l.x=c.x,l.y=k.y;if(k.y>g.top&&k.y<g.bottom)if(c.x<= g.right&&c.x>=a.x||a.x>=h.left&&a.x<=c.x){if(90===d||270===d)k=new J(Math.min((a.x+c.x)/2,a.x),a.y),l=new J(k.x,c.y)}else k.y=270===d||(0===d||180===d)&&c.y<a.y?Math.min(c.y,180===d?g.top:Math.min(g.top,h.top)):Math.max(c.y,180===d?g.bottom:Math.max(g.bottom,h.bottom)),l.x=c.x,l.y=k.y}else if(90===b)if(c.y>a.y||180===d&&c.x<a.x&&h.bottom>a.y||0===d&&c.x>a.x&&h.bottom>a.y)k=new J(a.x,c.y),l=new J((a.x+c.x)/2,c.y),270===d?(k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),l.x=c.x,l.y=k.y):180=== d&&c.x<a.x||0===d&&c.x>a.x?(k.y=a.y<h.top?this.computeMidOrthoPosition(a.x,a.y,c.x,h.top,!0):a.y<h.bottom&&(180===d&&a.x<h.left||0===d&&a.x>h.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.bottom,l.x=c.x,l.y=k.y):90===d&&a.y<h.top&&a.x>h.left&&a.x<h.right&&(k.x=a.x<c.x?Math.min(c.x,h.left):Math.max(c.x,h.right),k.y=a.y,l.x=k.x);else{k=new J(c.x,a.y);l=new J(c.x,(a.y+c.y)/2);if(270===d||0===d&&c.x<g.left||180===d&&c.x>g.right)270===d&&(h.fa(a)||g.fa(c))?k.x=this.computeMidOrthoPosition(a.x, a.y,c.x,c.y,!1):c.x<a.x&&(270===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(270===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&&k.x<g.right)if(c.y>=g.top&&c.y<=a.y||a.y<=h.bottom&&a.y>=c.y){if(0===d||180===d)k=new J(a.x,Math.max((a.y+c.y)/2,a.y)),l=new J(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,90===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,90=== d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}else if(c.y<a.y||180===d&&c.x<a.x&&h.top<a.y||0===d&&c.x>a.x&&h.top<a.y)k=new J(a.x,c.y),l=new J((a.x+c.x)/2,c.y),90===d?(k.y=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0),l.x=c.x,l.y=k.y):180===d&&c.x<a.x||0===d&&c.x>=a.x?(k.y=a.y>h.bottom?this.computeMidOrthoPosition(a.x,a.y,c.x,h.bottom,!0):a.y>h.top&&(180===d&&a.x<h.left||0===d&&a.x>h.right)?this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!0):h.top,l.x=c.x,l.y=k.y):270===d&&a.y>h.bottom&&a.x> h.left&&a.x<h.right&&(k.x=a.x<c.x?Math.min(c.x,h.left):Math.max(c.x,h.right),k.y=a.y,l.x=k.x);else{k=new J(c.x,a.y);l=new J(c.x,(a.y+c.y)/2);if(90===d||0===d&&c.x<g.left||180===d&&c.x>g.right)90===d&&(h.fa(a)||g.fa(c))?k.x=this.computeMidOrthoPosition(a.x,a.y,c.x,c.y,!1):c.x<a.x&&(90===d||0===d)?k.x=this.computeMidOrthoPosition(g.left,a.y,Math.max(c.x,h.right),c.y,!1):c.x>a.x&&(90===d||180===d)&&(k.x=this.computeMidOrthoPosition(g.right,a.y,Math.min(c.x,h.left),c.y,!1)),l.x=k.x,l.y=c.y;if(k.x>g.left&& k.x<g.right)if(c.y<=g.bottom&&c.y>=a.y||a.y>=h.top&&a.y<=c.y){if(0===d||180===d)k=new J(a.x,Math.min((a.y+c.y)/2,a.y)),l=new J(c.x,k.y)}else k.x=180===d||(90===d||270===d)&&c.x<a.x?Math.min(c.x,270===d?g.left:Math.min(g.left,h.left)):Math.max(c.x,270===d?g.right:Math.max(g.right,h.right)),l.x=k.x,l.y=c.y}var m=k,n=l,p=c;if(this.isAvoiding){var r=this.diagram;if(null===r||!Hk(r)||g.fa(p)&&!f.ee(e)||h.fa(a)&&!e.ee(f)||e===f||this.layer.isTemporary)b=!1;else{var q=Ik(r,!0,this.containingGroup,null); if(17!==this.segmentIndex&&q.yk(Math.min(a.x,m.x),Math.min(a.y,m.y),Math.abs(a.x-m.x),Math.abs(a.y-m.y))&&q.yk(Math.min(m.x,n.x),Math.min(m.y,n.y),Math.abs(m.x-n.x),Math.abs(m.y-n.y))&&q.yk(Math.min(n.x,p.x),Math.min(n.y,p.y),Math.abs(n.x-p.x),Math.abs(n.y-p.y)))b=!1;else{e=a;f=p;var u=c=null;if(r.isVirtualized){r=q.bounds.copy();r.cd(-q.rm,-q.qm);var x=J.alloc();Mp(q,a.x,a.y)||(K.bd(r.x,r.y,r.x+r.width,r.y+r.height,a.x,a.y,m.x,m.y,x)?(c=a=x.copy(),b=x.Xa(m)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height, m.x,m.y,n.x,n.y,x)?(c=a=x.copy(),b=x.Xa(n)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,p.x,p.y,x)&&(c=a=x.copy(),b=x.Xa(p)));Mp(q,p.x,p.y)||(K.bd(r.x,r.y,r.x+r.width,r.y+r.height,p.x,p.y,n.x,n.y,x)?(u=p=x.copy(),d=n.Xa(x)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height,n.x,n.y,m.x,m.y,x)?(u=p=x.copy(),d=m.Xa(x)):K.bd(r.x,r.y,r.x+r.width,r.y+r.height,m.x,m.y,a.x,a.y,x)&&(u=p=x.copy(),d=a.Xa(x)));J.free(x)}g=g.copy().Nc(h);h=q.SA;g.cd(q.rm*h,q.qm*h);Np(q,a,b,p,d,g);h=Op(q,p.x,p.y);!q.abort&&h>=Pp&&(Lk(q), h=q.vA,g.cd(q.rm*h,q.qm*h),Np(q,a,b,p,d,g),h=Op(q,p.x,p.y));!q.abort&&h>=Pp&&q.ZA&&(Lk(q),Np(q,a,b,p,d,q.bounds),h=Op(q,p.x,p.y));if(!q.abort&&h<Pp&&Op(q,p.x,p.y)!==Qp){Rp(this,q,p.x,p.y,d,!0);g=this.i(2);if(4>this.pointsCount)0===b||180===b?(g.x=a.x,g.y=p.y):(g.x=p.x,g.y=a.y),this.N(2,g.x,g.y),this.m(3,g.x,g.y);else if(p=this.i(3),0===b||180===b)K.C(g.x,p.x)?(g=0===b?Math.max(g.x,a.x):Math.min(g.x,a.x),this.N(2,g,a.y),this.N(3,g,p.y)):K.C(g.y,p.y)?(Math.abs(a.y-g.y)<=q.qm/2&&(this.N(2,g.x,a.y),this.N(3, p.x,a.y)),this.m(2,g.x,a.y)):this.N(2,a.x,g.y);else if(90===b||270===b)K.C(g.y,p.y)?(g=90===b?Math.max(g.y,a.y):Math.min(g.y,a.y),this.N(2,a.x,g),this.N(3,p.x,g)):K.C(g.x,p.x)?(Math.abs(a.x-g.x)<=q.rm/2&&(this.N(2,a.x,g.y),this.N(3,a.x,p.y)),this.m(2,a.x,g.y)):this.N(2,g.x,a.y);null!==c&&(a=this.i(1),p=this.i(2),a.x!==p.x&&a.y!==p.y?0===b||180===b?this.m(2,a.x,p.y):this.m(2,p.x,a.y):0===b||180===b?this.m(2,e.x,c.y):this.m(2,c.x,e.y));null!==u&&(0===d||180===d?this.Cf(f.x,u.y):this.Cf(u.x,f.y));b= !0}else b=!1}}}else b=!1;b||(this.Me(k),this.Me(l))}};R.prototype.computeMidOrthoPosition=function(a,b,c,d,e){var f=0;this.hasCurviness()&&(f=this.computeCurviness());return e?(b+d)/2+f:(a+c)/2+f}; function fk(a){if(null===a.diagram||!a.isAvoiding||!Hk(a.diagram))return!1;var b=a.points.j,c=b.length;if(4>c)return!1;a=Ik(a.diagram,!0,a.containingGroup,null);for(var d=1;d<c-2;d++){var e=b[d],f=b[d+1];if(!a.yk(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 Rp(a,b,c,d,e,f){var g=b.rm,h=b.qm,k=Op(b,c,d),l=c,m=d;for(0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h;k>Sp&&Op(b,l,m)===k-1;)c=l,d=m,0===e?l+=g:90===e?m+=h:180===e?l-=g:m-=h,--k;if(f){if(k>Sp)if(180===e||0===e)c=Math.floor(c/g)*g+g/2;else if(90===e||270===e)d=Math.floor(d/h)*h+h/2}else c=Math.floor(c/g)*g+g/2,d=Math.floor(d/h)*h+h/2;k>Sp&&(f=e,l=c,m=d,0===e?(f=90,m+=h):90===e?(f=180,l-=g):180===e?(f=270,m-=h):270===e&&(f=0,l+=g),Op(b,l,m)===k-1?Rp(a,b,l,m,f,!1):(l=c,m=d,0===e?(f=270,m-=h):90=== e?(f=0,l+=g):180===e?(f=90,m+=h):270===e&&(f=180,l-=g),Op(b,l,m)===k-1&&Rp(a,b,l,m,f,!1)));a.Cf(c,d)}R.prototype.Fz=function(a){F&&w(a,J,R,"findClosestSegment:p");var b=a.x;a=a.y;for(var c=this.i(0),d=this.i(1),e=Kb(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=Kb(b,a,d.x,d.y,c.x,c.y);d=c;h<e&&(f=g,e=h)}return f};R.prototype.ic=function(){this.po=!0}; R.prototype.Ak=function(a){if(!a){if(!1===this.rd)return;a=this.Fb();if(!this.po&&(null===a||null!==a.geometry))return}this.qa=this.makeGeometry();a=this.path;if(null!==a){a.qa=this.qa;for(var b=this.Z.j,c=b.length,d=0;d<c;d++){var e=b[d];e!==a&&e.isPanelMain&&e instanceof Yf&&(e.qa=this.qa)}}}; R.prototype.makeGeometry=function(){var a=this.qa,b=this.pointsCount;if(2>b)return a.type=Id,this.po=!1,a;var c=!1,d=this.diagram;null!==d&&Bp(this)&&d.ah.contains(this)&&(0!==this.Rl.width||0!==this.Rl.height)&&(c=!0);var e=this.i(0).copy(),f=e.copy();d=this.Cb.j;var g=this.computeCurve();if(g===rg&&3<=b&&!K.ca(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.nv.x;k-=this.nv.y;e.x-=d;e.y-=k;if(2!==b||Bp(this)){a.type=Gd;h=Wd(a);0!==this.computeShortLength(!0)&&(e=Tp(this,e,!0,f));Xd(h,e.x,e.y,!1);if(g===rg&&3<=b&&!K.ca(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=Tp(this,e,!1,f)),Yd(h,b,c,b,c,e.x,e.y);else if(this.isOrthogonal){f=new J(d,k);e=this.i(1).copy();g=new J(d,k);b=new J(d,k);c=this.i(0);for(var l,m=this.smoothness/3,n=1;n<this.pointsCount-1;n++){l=this.i(n);var p=c,r=l,q=this.i(Up(this,l,n,!1));if(!K.ca(p.x,r.x)||!K.ca(r.x,q.x))if(!K.ca(p.y,r.y)||!K.ca(r.y,q.y)){var u=m;isNaN(u)&&(u=this.smoothness/3);var x=p.x;p=p.y;var y=r.x;r=r.y;var z=q.x;q=q.y;var B=u*Vp(x,p,y,r);u*=Vp(y,r,z,q);K.ca(p,r)&&K.ca(y,z)&&(y>x?q>r?(g.x=y-B,g.y=r-B,b.x=y+u,b.y= r+u):(g.x=y-B,g.y=r+B,b.x=y+u,b.y=r-u):q>r?(g.x=y+B,g.y=r-B,b.x=y-u,b.y=r+u):(g.x=y+B,g.y=r+B,b.x=y-u,b.y=r-u));K.ca(x,y)&&K.ca(r,q)&&(r>p?(z>y?(g.x=y-B,g.y=r-B,b.x=y+u):(g.x=y+B,g.y=r-B,b.x=y-u),b.y=r+u):(z>y?(g.x=y-B,g.y=r+B,b.x=y+u):(g.x=y+B,g.y=r+B,b.x=y-u),b.y=r-u));if(K.ca(x,y)&&K.ca(y,z)||K.ca(p,r)&&K.ca(r,q))x=.5*(x+z),p=.5*(p+q),g.x=x,g.y=p,b.x=x,b.y=p;1===n?(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y)):2===n&&K.ca(c.x,this.i(0).x)&&K.ca(c.y,this.i(0).y)&&(e.x=.5*(c.x+l.x),e.y=.5*(c.y+l.y));Yd(h,e.x- d,e.y-k,g.x-d,g.y-k,l.x-d,l.y-k);f.set(g);e.set(b);c=l}}f=c.x;c=c.y;e=this.i(this.pointsCount-1);0!==this.computeShortLength(!1)&&(e=Tp(this,e.copy(),!1,Rb));f=.5*(f+e.x);c=.5*(c+e.y);Yd(h,b.x-d,b.y-k,f-d,c-k,e.x-d,e.y-k)}else for(c=3;c<b;c+=3)f=this.i(c-2),c+3>=b&&(c=b-1),e=this.i(c-1),g=this.i(c),c===b-1&&0!==this.computeShortLength(!1)&&(g=Tp(this,g.copy(),!1,Rb)),Yd(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=Up(this,f,n,1<n);m=this.i(n);if(n>=b-1){if(!f.A(m))0!==this.computeShortLength(!1)&&(m=Tp(this,m.copy(),!1,Rb)),Wp(this,h,-d,-k,f,m,c);else if(0===l)for(n=1;n<b;)e.assign(f),m=this.i(n++),Wp(this,h,-d,-k,f,m,c),f.assign(m);break}l=Up(this,m,n+1,n<b-3);n=-d;x=-k;p=m;u=this.i(l);y=c;if(K.C(f.y,p.y)&&K.C(p.x,u.x))if(r=Math.min(g,Math.abs(p.x-e.x)/2),r=z=Math.min(r,Math.abs(u.y-p.y)/2),K.C(r,0))Wp(this,h,n,x,f,p,y),f.assign(p);else{q=p.x;B=p.y;var D=q,G=B;p.x>f.x?q=p.x-r:q=p.x+r;u.y>p.y?G=p.y+ z:G=p.y-z;Wp(this,h,n,x,f,new J(q,B),y);Zd(h,p.x+n,p.y+x,D+n,G+x);f.h(D,G)}else K.C(f.x,p.x)&&K.C(p.y,u.y)?(r=Math.min(g,Math.abs(p.y-e.y)/2),r=z=Math.min(r,Math.abs(u.x-p.x)/2),K.C(z,0)?(Wp(this,h,n,x,f,p,y),f.assign(p)):(q=p.x,B=p.y,D=q,G=B,p.y>f.y?B=p.y-r:B=p.y+r,u.x>p.x?D=p.x+z:D=p.x-z,Wp(this,h,n,x,f,new J(q,B),y),Zd(h,p.x+n,p.y+x,D+n,G+x),f.h(D,G))):(Wp(this,h,n,x,f,p,y),f.assign(p));e.assign(m);n=l}J.free(f)}fe=h}else h=this.i(1).copy(),h.x-=d,h.y-=k,0!==this.computeShortLength(!0)&&(e=Tp(this, e,!0,f)),0!==this.computeShortLength(!1)&&(h=Tp(this,h,!1,f)),a.type=Id,a.startX=e.x,a.startY=e.y,a.endX=h.x,a.endY=h.y;this.po=!1;return a};function Vp(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.ca(a,0)?b:K.ca(b,0)?a:Math.sqrt(a*a+b*b)} function Tp(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=Vp(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=Vp(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 Up(a,b,c,d){for(var e=a.pointsCount,f=b;K.ca(b.x,f.x)&&K.ca(b.y,f.y);){if(c>=e)return e-1;f=a.i(c++)}if(!K.ca(b.x,f.x)&&!K.ca(b.y,f.y))return c-1;for(var g=f;K.ca(b.x,f.x)&&K.ca(f.x,g.x)&&(!d||(b.y>=f.y?f.y>=g.y:f.y<=g.y))||K.ca(b.y,f.y)&&K.ca(f.y,g.y)&&(!d||(b.x>=f.x?f.x>=g.x:f.x<=g.x));){if(c>=e)return e-1;g=a.i(c++)}return c-2} function Wp(a,b,c,d,e,f,g){if(!g&&Bp(a)){g=[];var h=0;a.isVisible()&&(h=Xp(a,e,f,g));if(0<h)if(K.C(e.y,f.y))if(e.x<f.x)for(var k=0;k<h;){var l=Math.max(e.x,Math.min(g[k++]-5,f.x-10));b.lineTo(l+c,f.y+d);var m=l+c;for(var n=Math.min(l+10,f.x);k<h;)if(l=g[k],l<n+10)k++,n=Math.min(l+5,f.x);else break;l=f.y-10+d;n+=c;var p=f.y+d;a.curve===ng?Xd(b,n,p,!1):Yd(b,m,l,n,l,n,p)}else for(--h;0<=h;){k=Math.min(e.x,Math.max(g[h--]+5,f.x+10));b.lineTo(k+c,f.y+d);m=k+c;for(l=Math.max(k-10,f.x);0<=h;)if(k=g[h],k> l-10)h--,l=Math.max(k-5,f.x);else break;k=f.y-10+d;l+=c;n=f.y+d;a.curve===ng?Xd(b,l,n,!1):Yd(b,m,k,l,k,l,n)}else if(K.C(e.x,f.x))if(e.y<f.y)for(k=0;k<h;){l=Math.max(e.y,Math.min(g[k++]-5,f.y-10));b.lineTo(f.x+c,l+d);m=l+d;for(l=Math.min(l+10,f.y);k<h;)if(n=g[k],n<l+10)k++,l=Math.min(n+5,f.y);else break;n=f.x-10+c;p=f.x+c;l+=d;a.curve===ng?Xd(b,p,l,!1):Yd(b,n,m,n,l,p,l)}else for(--h;0<=h;){k=Math.min(e.y,Math.max(g[h--]+5,f.y+10));b.lineTo(f.x+c,k+d);m=k+d;for(k=Math.max(k-10,f.y);0<=h;)if(l=g[h], l>k-10)h--,k=Math.max(l-5,f.y);else break;l=f.x-10+c;n=f.x+c;k+=d;a.curve===ng?Xd(b,n,k,!1):Yd(b,l,m,l,k,n,k)}}b.lineTo(f.x+c,f.y+d)} function Xp(a,b,c,d){var e=a.diagram;if(null===e||b.A(c))return 0;for(e=e.layers;e.next();){var f=e.value;if(null!==f&&f.visible){f=f.Ha.j;for(var g=f.length,h=0;h<g;h++){var k=f[h];if(k instanceof R){if(k===a)return 0<d.length&&d.sort(function(a,b){return a-b}),d.length;if(k.isVisible()&&Bp(k)){var l=k.routeBounds;l.o()&&a.routeBounds.Mc(l)&&!a.usesSamePort(k)&&(l=k.path,null!==l&&l.Kf()&&Yp(b,c,d,k))}}}}}0<d.length&&d.sort(function(a,b){return a-b});return d.length} function Yp(a,b,c,d){for(var e=K.C(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,x=l.y;if(!K.C(m,p)){if(K.C(n,r)&&K.C(q,u)&&Math.min(m,p)<q&&Math.max(m,p)>q&&Math.min(g,x)<n&&Math.max(g,x)>n&&!K.C(g,x)){h.x=q;h.y=n;m=!0;break a}}else if(!K.C(n,r)&& K.C(g,x)&&Math.min(n,r)<g&&Math.max(n,r)>g&&Math.min(q,u)<m&&Math.max(q,u)>m&&!K.C(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 Bp(a){a=a.curve;return a===mg||a===ng}function Fp(a,b){if(b||Bp(a))b=a.diagram,null===b||b.animationManager.isTicking||b.ah.contains(a)||0===a.Rl.width&&0===a.Rl.height||b.ah.add(a,a.Rl.copy())} R.prototype.Jq=function(a){var b=this.layer;if(null!==b&&b.visible&&!b.isTemporary){var c=b.diagram;if(null!==c&&!c.animationManager.isAnimating){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.Ha.j;for(var g=e.length,h=0;h<g;h++){var k=e[h];k instanceof R&&(k===this?f=!0:f&&Zp(this,k,a))}}else if(d)for(f=e.Ha.j,e=f.length,g=0;g<e;g++)h=f[g],h instanceof R&&Zp(this,h,a)}}}}; function Zp(a,b,c){if(null!==b&&null!==b.qa&&Bp(b)){var d=b.routeBounds;d.o()&&(a.routeBounds.Mc(d)||c.Mc(d))&&(a.usesSamePort(b)||b.ic())}}R.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.Sa(e))return!0;b=this.i(b-1);a=a.i(c-1);if(b.Sa(a)||d.Sa(a)||b.Sa(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}; R.prototype.isVisible=function(){if(!S.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};R.prototype.Ub=function(a){S.prototype.Ub.call(this,a);null!==this.Tf&&this.Tf.Bm();if(null!==this.hd)for(var b=this.hd.iterator;b.next();)b.value.Ub(a)};R.prototype.computeAdjusting=function(){return null!==this.diagram&&this.diagram.animationManager.isAnimating?xp:this.Qk}; function Cp(a){var b=a.bf;if(null!==b){var c=a.yf;if(null!==c){for(var d=a.cf,e=a.zf,f=a=null,g=b.cb.j,h=g.length,k=0;k<h;k++){var l=g[k];if(l.bf===b&&l.cf===d&&l.yf===c&&l.zf===e||l.bf===c&&l.cf===e&&l.yf===b&&l.zf===d)null===f?f=l:(null===a&&(a=[],a.push(f)),a.push(l))}if(null!==a){f=hp(b,c,d,e);null===f&&(f=new $p(b,d,c,e),gp(b,f),gp(c,f));f.links=a;for(b=0;b<a.length;b++)a[b].Tf=f;f.Bm()}}}}function Dp(a){var b=a.Tf;null!==b&&(a.Tf=null,a=b.links.indexOf(a),0<=a&&(Ka(b.links,a),b.Bm()))} R.prototype.Sh=function(){return!0}; ma.Object.defineProperties(R.prototype,{fromNode:{configurable:!0,get:function(){return this.bf},set:function(a){var b=this.bf;if(b!==a){F&&null!==a&&w(a,T,R,"fromNode");var c=this.fromPort;null!==b&&(this.yf!==b&&lp(b,this,c),Dp(this),this.D(2));this.bf=a;null!==a&&this.Ub(a.isVisible());this.bg=null;this.Ya();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.yf!==a&&kp(a,this,e),Cp(this),this.D(1));this.g("fromNode",b,a);ep(this)}}},fromPortId:{configurable:!0,get:function(){return this.cf},set:function(a){var b=this.cf;if(b!==a){F&&A(a,"string",R,"fromPortId");var c=this.fromPort;null!==c&&ip(this.fromNode,c);Dp(this);this.cf=a;var d=this.fromPort;null!==d&&ip(this.fromNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Dm()&&g.Ey(f,a)}c!==d&&(this.bg=null,this.Ya(),f=this.fromPortChanged, null!==f&&(g=!0,null!==e&&(g=e.ba,e.ba=!0),f(this,c,d),null!==e&&(e.ba=g)));Cp(this);this.g("fromPortId",b,a)}}},fromPort:{configurable:!0,get:function(){var a=this.bf;return null===a?null:a.Ct(this.cf)}},fromPortChanged:{configurable:!0,get:function(){return this.bo},set:function(a){var b=this.bo;b!==a&&(null!==a&&A(a,"function",R,"fromPortChanged"),this.bo=a,this.g("fromPortChanged",b,a))}},toNode:{configurable:!0,get:function(){return this.yf},set:function(a){var b= this.yf;if(b!==a){F&&null!==a&&w(a,T,R,"toNode");var c=this.toPort;null!==b&&(this.bf!==b&&lp(b,this,c),Dp(this),this.D(2));this.yf=a;null!==a&&this.Ub(a.isVisible());this.bg=null;this.Ya();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.bf!==a&&kp(a,this,e),Cp(this),this.D(1));this.g("toNode",b,a);ep(this)}}},toPortId:{configurable:!0, enumerable:!0,get:function(){return this.zf},set:function(a){var b=this.zf;if(b!==a){F&&A(a,"string",R,"toPortId");var c=this.toPort;null!==c&&ip(this.toNode,c);Dp(this);this.zf=a;var d=this.toPort;null!==d&&ip(this.toNode,d);var e=this.diagram;if(null!==e){var f=this.data,g=e.model;null!==f&&g.Dm()&&g.Iy(f,a)}c!==d&&(this.bg=null,this.Ya(),f=this.toPortChanged,null!==f&&(g=!0,null!==e&&(g=e.ba,e.ba=!0),f(this,c,d),null!==e&&(e.ba=g)));Cp(this);this.g("toPortId",b,a)}}},toPort:{configurable:!0, get:function(){var a=this.yf;return null===a?null:a.Ct(this.zf)}},toPortChanged:{configurable:!0,get:function(){return this.lq},set:function(a){var b=this.lq;b!==a&&(null!==a&&A(a,"function",R,"toPortChanged"),this.lq=a,this.g("toPortChanged",b,a))}},fromSpot:{configurable:!0,get:function(){return null!==this.S?this.S.hh:ld},set:function(a){this.Kc();var b=this.S.hh;if(!b.A(a)){F&&w(a,M,R,"fromSpot");a=a.J();this.S.hh=a;this.g("fromSpot",b,a);if(b.nd()||a.nd())a=this.fromNode, null!==a&&ip(a,this.fromPort);this.Ya()}}},fromEndSegmentLength:{configurable:!0,get:function(){return null!==this.S?this.S.fh:NaN},set:function(a){this.Kc();var b=this.S.fh;b!==a&&(F&&A(a,"number",R,"fromEndSegmentLength"),0>a&&ya(a,">= 0",R,"fromEndSegmentLength"),this.S.fh=a,this.g("fromEndSegmentLength",b,a),this.Ya())}},fromShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.gh:NaN},set:function(a){this.Kc();var b=this.S.gh;b!==a&&(F&&A(a,"number", R,"fromShortLength"),this.S.gh=a,this.g("fromShortLength",b,a),this.ic())}},toSpot:{configurable:!0,get:function(){return null!==this.S?this.S.Gh:ld},set:function(a){this.Kc();var b=this.S.Gh;if(!b.A(a)){F&&w(a,M,R,"toSpot");a=a.J();this.S.Gh=a;this.g("toSpot",b,a);if(b.nd()||a.nd())a=this.toNode,null!==a&&ip(a,this.toPort);this.Ya()}}},toEndSegmentLength:{configurable:!0,get:function(){return null!==this.S?this.S.Eh:NaN},set:function(a){this.Kc();var b=this.S.Eh;b!==a&& (F&&A(a,"number",R,"toEndSegmentLength"),0>a&&ya(a,">= 0",R,"toEndSegmentLength"),this.S.Eh=a,this.g("toEndSegmentLength",b,a),this.Ya())}},toShortLength:{configurable:!0,get:function(){return null!==this.S?this.S.Fh:NaN},set:function(a){this.Kc();var b=this.S.Fh;b!==a&&(F&&A(a,"number",R,"toShortLength"),this.S.Fh=a,this.g("toShortLength",b,a),this.ic())}},isLabeledLink:{configurable:!0,get:function(){return null===this.hd?!1:0<this.hd.count}},labelNodes:{configurable:!0, enumerable:!0,get:function(){return null===this.hd?lb:this.hd.iterator}},relinkableFrom:{configurable:!0,get:function(){return 0!==(this.Va&1)},set:function(a){var b=0!==(this.Va&1);b!==a&&(F&&A(a,"boolean",R,"relinkableFrom"),this.Va^=1,this.g("relinkableFrom",b,a),this.Rb())}},relinkableTo:{configurable:!0,get:function(){return 0!==(this.Va&2)},set:function(a){var b=0!==(this.Va&2);b!==a&&(F&&A(a,"boolean",R,"relinkableTo"),this.Va^=2,this.g("relinkableTo",b,a),this.Rb())}}, resegmentable:{configurable:!0,get:function(){return 0!==(this.Va&4)},set:function(a){var b=0!==(this.Va&4);b!==a&&(F&&A(a,"boolean",R,"resegmentable"),this.Va^=4,this.g("resegmentable",b,a),this.Rb())}},isTreeLink:{configurable:!0,get:function(){return 0!==(this.Va&8)},set:function(a){var b=0!==(this.Va&8);b!==a&&(F&&A(a,"boolean",R,"isTreeLink"),this.Va^=8,this.g("isTreeLink",b,a),null!==this.fromNode&&Uk(this.fromNode),null!==this.toNode&&Uk(this.toNode))}},path:{configurable:!0, enumerable:!0,get:function(){var a=this.Fb();return a instanceof Yf?a:null}},routeBounds:{configurable:!0,get:function(){this.tj();var a=this.Rl,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.Ve(e)}else if(this.computeCurve()===rg&&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.om(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.om(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.Ve(f),e=2;e<d;e++)f=this.i(e),b=Math.min(f.x,b),c=Math.min(f.y,c),a.Ve(f);this.nv.h(b- a.x,c-a.y)}return a}},midPoint:{configurable:!0,get:function(){this.tj();return this.computeMidPoint(new J)}},midAngle:{configurable:!0,get:function(){this.tj();return this.computeMidAngle()}},flattenedLengths:{configurable:!0,get:function(){if(null===this.Wr){this.rd||Ep(this);for(var a=this.Wr=[],b=this.pointsCount,c=0;c<b-1;c++){var d=this.i(c);var e=this.i(c+1);K.ca(d.x,e.x)?(d=e.y-d.y,0>d&&(d=-d)):K.ca(d.y,e.y)?(d=e.x-d.x,0>d&&(d=-d)):d=Math.sqrt(d.Pe(e)); a.push(d)}}return this.Wr}},flattenedTotalLength:{configurable:!0,get:function(){var a=this.Iu;if(isNaN(a)){for(var b=this.flattenedLengths,c=b.length,d=a=0;d<c;d++)a+=b[d];this.Iu=a}return a}},points:{configurable:!0,get:function(){return this.Cb},set:function(a){var b=this.Cb;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(!Fa(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 F&&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.Cb=c;this.ic();this.u();Ep(this);a=this.diagram;null!==a&&(a.xk||a.undoManager.isUndoingRedoing||a.Pt.add(this),a.animationManager.wc&&(this.wh=c));this.g("points",b,c)}}},pointsCount:{configurable:!0,get:function(){return this.Cb.count}},rd:{configurable:!0,get:function(){return 0!==(this.Va&16)},set:function(a){0!==(this.Va&16)!==a&&(this.Va^=16)}},suspendsRouting:{configurable:!0,get:function(){return 0!==(this.Va&32)},set:function(a){0!== (this.Va&32)!==a&&(this.Va^=32)}},Bv:{configurable:!0,get:function(){return 0!==(this.Va&64)},set:function(a){0!==(this.Va&64)!==a&&(this.Va^=64)}},defaultFromPoint:{configurable:!0,get:function(){return this.w},set:function(a){this.w=a.copy()}},defaultToPoint:{configurable:!0,get:function(){return this.L},set:function(a){this.L=a.copy()}},isOrthogonal:{configurable:!0,get:function(){return 2===(this.Xj.value&2)}},isAvoiding:{configurable:!0, enumerable:!0,get:function(){return 4===(this.Xj.value&4)}},geometry:{configurable:!0,get:function(){this.po&&(this.tj(),this.qa=this.makeGeometry());return this.qa}},firstPickIndex:{configurable:!0,get:function(){return 2>=this.pointsCount?0:this.isOrthogonal||!Gp(this.computeSpot(!0))?1:0}},lastPickIndex:{configurable:!0,get:function(){var a=this.pointsCount;return 0===a?0:2>=a?a-1:this.isOrthogonal||!Gp(this.computeSpot(!1))?a-2:a-1}},adjusting:{configurable:!0, enumerable:!0,get:function(){return this.Qk},set:function(a){var b=this.Qk;b!==a&&(F&&hb(a,R,R,"adjusting"),this.Qk=a,this.g("adjusting",b,a))}},corner:{configurable:!0,get:function(){return this.En},set:function(a){var b=this.En;b!==a&&(F&&A(a,"number",R,"corner"),this.En=a,this.ic(),this.g("corner",b,a))}},curve:{configurable:!0,get:function(){return this.Gn},set:function(a){var b=this.Gn;b!==a&&(F&&hb(a,R,R,"curve"),this.Gn=a,this.Ya(),this.ic(),Fp(this,b===ng||b=== mg||a===ng||a===mg),this.g("curve",b,a))}},curviness:{configurable:!0,get:function(){return this.Hn},set:function(a){var b=this.Hn;b!==a&&(F&&A(a,"number",R,"curviness"),this.Hn=a,this.Ya(),this.ic(),this.g("curviness",b,a))}},routing:{configurable:!0,get:function(){return this.Xj},set:function(a){var b=this.Xj;b!==a&&(F&&hb(a,R,R,"routing"),this.Xj=a,this.bg=null,this.Ya(),Fp(this,2===(b.value&2)||2===(a.value&2)),this.g("routing",b,a))}},smoothness:{configurable:!0, get:function(){return this.Yp},set:function(a){var b=this.Yp;b!==a&&(F&&A(a,"number",R,"smoothness"),this.Yp=a,this.ic(),this.g("smoothness",b,a))}},key:{configurable:!0,get:function(){var a=this.diagram;if(null!==a&&a.model.Dm())return a.model.ac(this.data)}}});R.prototype.invalidateOtherJumpOvers=R.prototype.Jq;R.prototype.findClosestSegment=R.prototype.Fz;R.prototype.updateRoute=R.prototype.tj;R.prototype.invalidateRoute=R.prototype.Ya;R.prototype.rollbackRoute=R.prototype.Ay; R.prototype.commitRoute=R.prototype.Df;R.prototype.startRoute=R.prototype.Vh;R.prototype.clearPoints=R.prototype.kk;R.prototype.removePoint=R.prototype.pw;R.prototype.addPointAt=R.prototype.Cf;R.prototype.addPoint=R.prototype.Me;R.prototype.insertPointAt=R.prototype.m;R.prototype.insertPoint=R.prototype.mA;R.prototype.setPointAt=R.prototype.N;R.prototype.setPoint=R.prototype.pd;R.prototype.getPoint=R.prototype.i;R.prototype.getOtherPort=R.prototype.cA;R.prototype.getOtherNode=R.prototype.Gt; var wp=new E(R,"Normal",1),aq=new E(R,"Orthogonal",2),bq=new E(R,"AvoidsNodes",6),Lp=new E(R,"AvoidsNodesStraight",7),og=new E(R,"None",0),rg=new E(R,"Bezier",9),ng=new E(R,"JumpGap",10),mg=new E(R,"JumpOver",11),xp=new E(R,"End",17),yp=new E(R,"Scale",18),zp=new E(R,"Stretch",19),mn=new E(R,"OrientAlong",21),en=new E(R,"OrientPlus90",22),gn=new E(R,"OrientMinus90",23),Ap=new E(R,"OrientOpposite",24),nn=new E(R,"OrientUpright",25),fn=new E(R,"OrientPlus90Upright",26),hn=new E(R,"OrientMinus90Upright", 27),jn=new E(R,"OrientUpright45",28);R.className="Link";R.Normal=wp;R.Orthogonal=aq;R.AvoidsNodes=bq;R.AvoidsNodesStraight=Lp;R.None=og;R.Bezier=rg;R.JumpGap=ng;R.JumpOver=mg;R.End=xp;R.Scale=yp;R.Stretch=zp;R.OrientAlong=mn;R.OrientPlus90=en;R.OrientMinus90=gn;R.OrientOpposite=Ap;R.OrientUpright=nn;R.OrientPlus90Upright=fn;R.OrientMinus90Upright=hn;R.OrientUpright45=jn;function $p(a,b,c,d){fb(this);this.we=this.ds=!1;this.St=a;this.wy=b;this.ew=c;this.xy=d;this.links=[]} $p.prototype.Bm=function(){if(!this.ds){var a=this.links;0<a.length&&(a=a[0].diagram,null!==a&&(a.Ku.add(this),this.we=a.undoManager.isUndoingRedoing))}this.ds=!0};$p.prototype.Mw=function(){if(this.ds){this.ds=!1;var a=this.links;if(0<a.length){var b=a[0],c=b.diagram;c=null===c||c.xk&&!this.we;this.we=!1;b.arrangeBundledLinks(a,c);1===a.length&&(b.Tf=null,a.length=0)}0===a.length&&(a=this.St,null!==this&&null!==a.Ye&&a.Ye.remove(this),a=this.ew,null!==this&&null!==a.Ye&&a.Ye.remove(this))}}; $p.className="LinkBundle";function Jk(){fb(this);this.Jy=this.group=null;this.Jt=!0;this.abort=!1;this.Vd=this.Ud=1;this.No=this.Mo=-1;this.qc=this.pc=8;this.Ib=[[]];this.dk=this.ck=0;this.ZA=!1;this.SA=22;this.vA=111} Jk.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.Ud=Math.floor((a.x-this.pc)/this.pc)*this.pc;this.Vd=Math.floor((b-this.qc)/this.qc)*this.qc;this.Mo=Math.ceil((c+2*this.pc)/this.pc)*this.pc;this.No=Math.ceil((d+2*this.qc)/this.qc)*this.qc;a=1+(Math.ceil((this.Mo-this.Ud)/this.pc)|0);b=1+(Math.ceil((this.No-this.Vd)/this.qc)|0);if(null===this.Ib||this.ck<a-1||this.dk<b-1){c=[];for(d=0;d<=a;d++)c[d]=[];this.Ib=c;this.ck=a-1;this.dk=b-1}a= cq;if(null!==this.Ib)for(b=0;b<=this.ck;b++)for(c=0;c<=this.dk;c++)this.Ib[b][c]=a}};function Mp(a,b,c){return a.Ud<=b&&b<=a.Mo&&a.Vd<=c&&c<=a.No}function Op(a,b,c){if(!Mp(a,b,c))return cq;b-=a.Ud;b/=a.pc;c-=a.Vd;c/=a.qc;return a.Ib[b|0][c|0]}function Mk(a,b,c){Mp(a,b,c)&&(b-=a.Ud,b/=a.pc,c-=a.Vd,c/=a.qc,a.Ib[b|0][c|0]=Qp)}function Lk(a){if(null!==a.Ib)for(var b=0;b<=a.ck;b++)for(var c=0;c<=a.dk;c++)a.Ib[b][c]>=Sp&&(a.Ib[b][c]=cq)} Jk.prototype.yk=function(a,b,c,d){if(a>this.Mo||a+c<this.Ud||b>this.No||b+d<this.Vd)return!0;a=(a-this.Ud)/this.pc|0;b=(b-this.Vd)/this.qc|0;c=Math.max(0,c)/this.pc+1|0;var e=Math.max(0,d)/this.qc+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.ck)|0;for(c=Math.min(b+e-1,this.dk)|0;a<=d;a++)for(e=b;e<=c;e++)if(this.Ib[a][e]===Qp)return!1;return!0}; function dq(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.Ib[l][m];if(n>=Sp&&n<Pp)for(e?m+=d:l+=d,n+=1;f<=l&&l<=g&&h<=m&&m<=k&&!(n>=a.Ib[l][m]);)a.Ib[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)dq(a,b,c,1,!e,f,g,h,k),dq(a,b,c,-1,!e,f,g,h,k);else for(c+=d;c>l;c+=d)dq(a,b,c,1,!e,f,g,h,k),dq(a,b,c,-1,!e,f,g,h,k);else if(0<d)for(b+=d;b<l;b+=d)dq(a,b,c,1,!e,f,g,h,k),dq(a,b,c,-1,!e,f,g,h,k);else for(b+=d;b>l;b+=d)dq(a,b,c,1,!e,f,g,h,k),dq(a,b,c,-1,!e,f,g,h, k)}}function eq(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Qp,m=Sp;for(a.Ib[b][c]=m;l===Qp&&b>f&&b<g&&c>h&&c<k;)m+=1,a.Ib[b][c]=m,e?c+=d:b+=d,l=a.Ib[b][c]}function fq(a,b,c,d,e,f,g,h,k){b|=0;c|=0;var l=Qp,m=Pp;for(a.Ib[b][c]=m;l===Qp&&b>f&&b<g&&c>h&&c<k;)a.Ib[b][c]=m,e?c+=d:b+=d,l=a.Ib[b][c]} function Np(a,b,c,d,e,f){if(null!==a.Ib){a.abort=!1;var g=b.x,h=b.y;if(Mp(a,g,h)&&(g-=a.Ud,g/=a.pc,h-=a.Vd,h/=a.qc,b=d.x,d=d.y,Mp(a,b,d)))if(b-=a.Ud,b/=a.pc,d-=a.Vd,d/=a.qc,1>=Math.abs(g-b)&&1>=Math.abs(h-d))a.abort=!0;else{var k=f.x,l=f.y,m=f.x+f.width,n=f.y+f.height;k-=a.Ud;k/=a.pc;l-=a.Vd;l/=a.qc;m-=a.Ud;m/=a.pc;n-=a.Vd;n/=a.qc;f=Math.max(0,Math.min(a.ck,k|0));m=Math.min(a.ck,Math.max(0,m|0));l=Math.max(0,Math.min(a.dk,l|0));n=Math.min(a.dk,Math.max(0,n|0));g|=0;h|=0;b|=0;d|=0;k=0===c||90===c? 1:-1;c=90===c||270===c;a.Ib[g][h]===Qp?(eq(a,g,h,k,c,f,m,l,n),eq(a,g,h,1,!c,f,m,l,n),eq(a,g,h,-1,!c,f,m,l,n)):eq(a,g,h,k,c,g,h,g,h);a.Ib[b][d]===Qp?(fq(a,b,d,0===e||90===e?1:-1,90===e||270===e,f,m,l,n),fq(a,b,d,1,!(90===e||270===e),f,m,l,n),fq(a,b,d,-1,!(90===e||270===e),f,m,l,n)):fq(a,b,d,k,c,b,d,b,d);a.abort||(dq(a,g,h,1,!1,f,m,l,n),dq(a,g,h,-1,!1,f,m,l,n),dq(a,g,h,1,!0,f,m,l,n),dq(a,g,h,-1,!0,f,m,l,n))}}} ma.Object.defineProperties(Jk.prototype,{bounds:{configurable:!0,get:function(){return new L(this.Ud,this.Vd,this.Mo-this.Ud,this.No-this.Vd)}},rm:{configurable:!0,get:function(){return this.pc},set:function(a){0<a&&a!==this.pc&&(this.pc=a,this.initialize(this.bounds))}},qm:{configurable:!0,get:function(){return this.qc},set:function(a){0<a&&a!==this.qc&&(this.qc=a,this.initialize(this.bounds))}}});var Qp=0,Sp=1,Pp=999999,cq=Pp+1;Jk.className="PositionArray"; function Jp(){fb(this);this.port=this.node=null;this.fe=[];this.Pq=!1}Jp.prototype.toString=function(){for(var a=this.fe,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 gq(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}Jp.prototype.Bm=function(){this.fe.length=0}; function Kp(a,b){var c=a.fe;if(0===c.length){a:if(!a.Pq){c=a.Pq;a.Pq=!0;var d=null,e=a.node,f=e instanceof Hf?e:null;if(null===f||f.isSubGraphExpanded)var g=e.isTreeExpanded?e.findLinksConnected(a.port.portId):e.by();else{if(!f.actualBounds.o()){a.Pq=c;break a}d=f;g=d.Kv()}f=a.fe.length=0;var h=a.port.ma(Hc,J.alloc()),k=a.port.ma(Sc,J.alloc());e=L.allocAt(h.x,h.y,0,0);e.Ve(k);J.free(h);J.free(k);h=J.allocAt(e.x+e.width/2,e.y+e.height/2);k=a.port.hj();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.ee(d),n=l.computeSpot(m,a.port);if(n.nd()&&(m=m?l.toPort:l.fromPort,null!==m)){var p=m.part;if(null!==p){var r=p.findVisibleNode();null!==r&&r!==p&&(p=r,m=p.port);m=l.computeOtherPoint(p,m);p=h.Xa(m);p-=k;0>p&&(p+=360);n=gq(e,n,p,l.isOrthogonal);0===n?(n=4,180<p&&(p-=360)):n=90===n?8:180===n?2:1;r=a.fe[f];void 0===r?(r=new hq(l,p,n),a.fe[f]=r):(r.link=l,r.angle=p,r.Ec=n);r.iw.set(m);f++}}}}J.free(h);a.fe.sort(Jp.prototype.l); k=a.fe.length;d=-1;for(f=h=0;f<k;f++)g=a.fe[f],void 0!==g&&(g.Ec!==d&&(d=g.Ec,h=0),g.Fq=h,h++);d=-1;h=0;for(f=k-1;0<=f;f--)k=a.fe[f],void 0!==k&&(k.Ec!==d&&(d=k.Ec,h=k.Fq+1),k.sm=h);f=a.fe;n=a.port;d=a.node.portSpreading;h=J.alloc();k=J.alloc();g=J.alloc();l=J.alloc();n.ma(Hc,h);n.ma(Jc,k);n.ma(Sc,g);n.ma(Oc,l);r=p=m=n=0;if(d===tp)for(var q=0;q<f.length;q++){var u=f[q];if(null!==u){var x=u.link.computeThickness();switch(u.Ec){case 8:p+=x;break;case 2:r+=x;break;case 1:n+=x;break;default:case 4:m+= x}}}var y=q=0,z=1,B=u=0;for(x=0;x<f.length;x++){var D=f[x];if(null!==D){if(q!==D.Ec){q=D.Ec;switch(q){case 8:var G=g;y=l;break;case 2:G=l;y=h;break;case 1:G=h;y=k;break;default:case 4:G=k,y=g}u=y.x-G.x;B=y.y-G.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}y=0}var O=D.Nq;if(d===tp){D= D.link.computeThickness();D*=z;O.set(G);switch(q){case 8:O.x=G.x+u/2+p/2-y-D/2;break;case 2:O.y=G.y+B/2+r/2-y-D/2;break;case 1:O.x=G.x+u/2-n/2+y+D/2;break;default:case 4:O.y=G.y+B/2-m/2+y+D/2}y+=D}else{var X=.5;d===fp&&(X=(D.Fq+1)/(D.sm+1));O.x=G.x+u*X;O.y=G.y+B*X}}}J.free(h);J.free(k);J.free(g);J.free(l);G=a.fe;for(f=0;f<G.length;f++)d=G[f],null!==d&&(d.Iv=a.computeEndSegmentLength(d));a.Pq=c;L.free(e)}c=a.fe}for(a=0;a<c.length;a++)if(e=c[a],null!==e&&e.link===b)return e;return null} Jp.prototype.l=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};Jp.prototype.computeEndSegmentLength=function(a){var b=a.link,c=b.computeEndSegmentLength(this.node,this.port,Gc,b.fromPort===this.port),d=a.Fq;if(0>d)return c;var e=a.sm;if(1>=e||!b.isOrthogonal)return c;b=a.iw;var f=a.Nq;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)};Jp.className="Knot"; function hq(a,b,c){this.link=a;this.angle=b;this.Ec=c;this.iw=new J;this.sm=this.Fq=0;this.Nq=new J;this.Iv=0}hq.prototype.toString=function(){return this.link.toString()+" "+this.angle.toString()+" "+this.Ec.toString()+":"+this.Fq.toString()+"/"+this.sm.toString()+" "+this.Nq.toString()+" "+this.Iv.toString()+" "+this.iw.toString()};hq.className="LinkInfo";function ul(){this.Gh=this.hh=ld;this.Fh=this.gh=this.Eh=this.fh=NaN;this.jq=this.$n=null;this.kq=this.ao=Infinity} ul.prototype.copy=function(){var a=new ul;a.hh=this.hh.J();a.Gh=this.Gh.J();a.fh=this.fh;a.Eh=this.Eh;a.gh=this.gh;a.Fh=this.Fh;a.$n=this.$n;a.jq=this.jq;a.ao=this.ao;a.kq=this.kq;return a};ul.className="LinkSettings";function Ni(){0<arguments.length&&za(Ni);fb(this);this.L=this.B=null;this.Ai=this.so=!0;this.xo=!1;this.ln=(new J(0,0)).freeze();this.uo=!0;this.to=null;this.jx="";this.w=null;this.wo=!1;this.l=null} Ni.prototype.cloneProtected=function(a){a.so=this.so;a.Ai=this.Ai;a.xo=this.xo;a.ln.assign(this.ln);a.uo=this.uo;a.to=this.to;a.jx=this.jx;a.wo=!0};Ni.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};Ni.prototype.mb=function(a){Ba(this,a)};Ni.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+")"}; Ni.prototype.D=function(){if(this.isValidLayout){var a=this.diagram;if(null!==a&&!a.undoManager.isUndoingRedoing){var b=a.animationManager;!b.isTicking&&(b.defaultAnimation.isAnimating&&b.ed(),this.isOngoing&&a.xk||this.isInitial&&!a.xk)&&(this.isValidLayout=!1,a.Vb())}}};Ni.prototype.createNetwork=function(){return new iq(this)};Ni.prototype.makeNetwork=function(a){var b=this.createNetwork();a instanceof P?(b.Gg(a.nodes,!0),b.Gg(a.links,!0)):a instanceof Hf?b.Gg(a.memberParts):b.Gg(a.iterator);return b}; Ni.prototype.updateParts=function(){var a=this.diagram;if(null===a&&null!==this.network)for(var b=this.network.vertexes.iterator;b.next();){var c=b.value.node;if(null!==c&&(a=c.diagram,null!==a))break}this.isValidLayout=!0;try{null!==a&&a.Ba("Layout"),this.commitLayout()}finally{null!==a&&a.$a("Layout")}};Ni.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()}}; Ni.prototype.doLayout=function(a){F&&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 P?(jq(this,b,a.nodes,!0,this.Gk,!0,!1,!0),jq(this,b,a.parts,!0,this.Gk,!0,!1,!0)):a instanceof Hf?jq(this,b,a.memberParts,!1,this.Gk,!0,!1,!0):b.addAll(a.iterator);var c=b.count;if(0<c){a=this.diagram;null!==a&&a.Ba("Layout");c=Math.ceil(Math.sqrt(c));this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin);var d= this.arrangementOrigin.x,e=d,f=this.arrangementOrigin.y,g=0,h=0;for(b=b.iterator;b.next();){var k=b.value;kq(k);var l=k.measuredBounds,m=l.width;l=l.height;k.moveTo(e,f);k instanceof Hf&&(k.Gk=!1);e+=Math.max(m,50)+20;h=Math.max(h,Math.max(l,50));g>=c-1?(g=0,e=d,f+=h+20,h=0):g++}null!==a&&a.$a("Layout")}this.isValidLayout=!0};Ni.prototype.Gk=function(a){return!a.location.o()||a instanceof Hf&&a.Gk?!0:!1}; function jq(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 T?k.isLinkLabel||(k instanceof Hf?null===k.layout?jq(a,b,k.memberParts,!1,e,f,g,h):(kq(k),b.add(k)):(kq(k),b.add(k))):g&&k instanceof R?b.add(k):!h||!k.bc()||k instanceof T||(kq(k),b.add(k)))}}function kq(a){var b=a.actualBounds;(0===b.width||0===b.height||isNaN(b.width)||isNaN(b.height))&&a.Eb()} Ni.prototype.jj=function(a,b){var c=this.boundsComputation;if(null!==c)return b||(b=new L),c(a,this,b);if(!b)return a.actualBounds;b.set(a.actualBounds);return b};Ni.prototype.Rx=function(a){var b=new I;a instanceof P?(jq(this,b,a.nodes,!0,null,!0,!0,!0),jq(this,b,a.links,!0,null,!0,!0,!0),jq(this,b,a.parts,!0,null,!0,!0,!0)):a instanceof Hf?jq(this,b,a.memberParts,!1,null,!0,!0,!0):jq(this,b,a.iterator,!1,null,!0,!0,!0);return b}; Ni.prototype.initialOrigin=function(a){var b=this.group;if(null!==b){var c=b.position.copy();(isNaN(c.x)||isNaN(c.y))&&c.set(a);b=b.placeholder;null!==b&&(c=b.ma(Hc),(isNaN(c.x)||isNaN(c.y))&&c.set(a),a=b.padding,c.x+=a.left,c.y+=a.top);return c}return a}; ma.Object.defineProperties(Ni.prototype,{diagram:{configurable:!0,get:function(){return this.B},set:function(a){null!==a&&w(a,P,Ni,"diagram");this.B=a}},group:{configurable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(null!==a&&w(a,Hf,Ni,"group"),this.L=a,null!==a&&(this.B=a.diagram))}},isOngoing:{configurable:!0,get:function(){return this.so},set:function(a){this.so!==a&&(A(a,"boolean",Ni,"isOngoing"),this.so=a)}},isInitial:{configurable:!0, enumerable:!0,get:function(){return this.Ai},set:function(a){A(a,"boolean",Ni,"isInitial");this.Ai=a;a||(this.wo=!0)}},isViewportSized:{configurable:!0,get:function(){return this.xo},set:function(a){this.xo!==a&&(A(a,"boolean",Ni,"isViewportSized"),(this.xo=a)&&this.D())}},isRouting:{configurable:!0,get:function(){return this.uo},set:function(a){this.uo!==a&&(A(a,"boolean",Ni,"isRouting"),this.uo=a)}},isRealtime:{configurable:!0,get:function(){return this.to}, set:function(a){this.to!==a&&(null!==a&&A(a,"boolean",Ni,"isRealtime"),this.to=a)}},isValidLayout:{configurable:!0,get:function(){return this.wo},set:function(a){this.wo!==a&&(A(a,"boolean",Ni,"isValidLayout"),this.wo=a,a||(a=this.diagram,null!==a&&(a.Rf=!0)))}},network:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(null!==a&&w(a,iq,Ni,"network"),this.l=a,null!==a&&(a.layout=this))}},boundsComputation:{configurable:!0,get:function(){return this.w}, set:function(a){this.w!==a&&(null!==a&&A(a,"function",Ni,"boundsComputation"),this.w=a,this.D())}},arrangementOrigin:{configurable:!0,get:function(){return this.ln},set:function(a){w(a,J,Ni,"arrangementOrigin");this.ln.A(a)||(this.ln.assign(a),this.D())}}});Ni.prototype.collectParts=Ni.prototype.Rx;Ni.prototype.getLayoutBounds=Ni.prototype.jj;Ni.prototype.invalidateLayout=Ni.prototype.D;Ni.className="Layout"; function iq(a){fb(this);F&&!a&&v("LayoutNetwork constructor requires non-null Layout argument");this.oc=a;this.Af=new I;this.pe=new I;this.Tt=new Db;this.Ot=new Db}iq.prototype.clear=function(){if(this.Af)for(var a=this.Af.iterator;a.next();)a.value.clear();if(this.pe)for(a=this.pe.iterator;a.next();)a.value.clear();this.Af=new I;this.pe=new I;this.Tt=new Db;this.Ot=new Db}; iq.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.Af.count+" edges: "+this.pe.count;if(1<a){for(var c=this.Af.iterator;c.next();)b+="\n "+c.value.toString(a-1);for(c=this.pe.iterator;c.next();)b+="\n "+c.value.toString(a-1)}return b};iq.prototype.createVertex=function(){return new lq(this)};iq.prototype.createEdge=function(){return new mq(this)}; iq.prototype.Gg=function(a,b,c){if(null!==a){void 0===b&&(b=!1);A(b,"boolean",iq,"addParts:toplevelonly");void 0===c&&(c=null);null===c&&(c=function(a){if(a instanceof T)return!a.isLinkLabel;if(a instanceof R){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 T&&(!b||d.isTopLevel)&&d.canLayout()&&c(d))if(d instanceof Hf&&null===d.layout)this.Gg(d.memberParts,!1);else if(null===this.gj(d)){var e= this.createVertex();e.node=d;this.Mh(e)}}for(a.reset();a.next();)if(d=a.value,d instanceof R&&(!b||d.isTopLevel)&&d.canLayout()&&c(d)&&null===this.Aq(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.zk(f,e,d))}}}; iq.prototype.findGroupVertex=function(a){if(null===a)return null;var b=a.findVisibleNode();if(null===b)return null;a=this.gj(b);if(null!==a)return a;for(b=b.containingGroup;null!==b;){a=this.gj(b);if(null!==a)return a;b=b.containingGroup}return null};t=iq.prototype;t.Mh=function(a){if(null!==a){F&&w(a,lq,iq,"addVertex:vertex");this.Af.add(a);var b=a.node;null!==b&&this.Tt.add(b,a);a.network=this}}; t.nm=function(a){if(null===a)return null;F&&w(a,T,iq,"addNode:node");var b=this.gj(a);null===b&&(b=this.createVertex(),b.node=a,this.Mh(b));return b};t.Fv=function(a){if(null!==a&&(F&&w(a,lq,iq,"deleteVertex:vertex"),nq(this,a))){for(var b=a.Pg,c=b.count-1;0<=c;c--){var d=b.O(c);this.rk(d)}b=a.Hg;for(a=b.count-1;0<=a;a--)c=b.O(a),this.rk(c)}};function nq(a,b){if(null===b)return!1;var c=a.Af.remove(b);c&&(b=b.node,null!==b&&a.Tt.remove(b));return c} t.wz=function(a){null!==a&&(F&&w(a,T,iq,"deleteNode:node"),a=this.gj(a),null!==a&&this.Fv(a))};t.gj=function(a){if(null===a)return null;F&&w(a,T,iq,"findVertex:node");return this.Tt.K(a)};t.sq=function(a){if(null!==a){F&&w(a,mq,iq,"addEdge:edge");oq(this,a);var b=a.toVertex;null!==b&&b.wv(a);b=a.fromVertex;null!==b&&b.uv(a)}};function oq(a,b){if(null!==b){a.pe.add(b);var c=b.link;null!==c&&null===a.Aq(c)&&a.Ot.add(c,b);b.network=a}} t.az=function(a){if(null===a)return null;F&&w(a,R,iq,"addLink:link");var b=a.fromNode,c=a.toNode,d=this.Aq(a);null===d?(d=this.createEdge(),d.link=a,null!==b&&(d.fromVertex=this.nm(b)),null!==c&&(d.toVertex=this.nm(c)),this.sq(d)):(null!==b?d.fromVertex=this.nm(b):d.fromVertex=null,null!==c?d.toVertex=this.nm(c):d.toVertex=null);return d};t.rk=function(a){if(null!==a){F&&w(a,mq,iq,"deleteEdge:edge");var b=a.toVertex;null!==b&&b.Ev(a);b=a.fromVertex;null!==b&&b.Dv(a);pq(this,a)}}; function pq(a,b){null!==b&&a.pe.remove(b)&&(b=b.link,null!==b&&a.Ot.remove(b))}t.vz=function(a){null!==a&&(F&&w(a,R,iq,"deleteLink:link"),a=this.Aq(a),null!==a&&this.rk(a))};t.Aq=function(a){if(null===a)return null;F&&w(a,R,iq,"findEdge:link");return this.Ot.K(a)}; t.zk=function(a,b,c){if(null===a||null===b)return null;F&&(w(a,lq,iq,"linkVertexes:fromVertex"),w(b,lq,iq,"linkVertexes:toVertex"),null!==c&&w(c,R,iq,"linkVertexes:link"));if(a.network===this&&b.network===this){var d=this.createEdge();d.link=c;d.fromVertex=a;d.toVertex=b;this.sq(d);return d}return null};t.Tm=function(a){if(null!==a){F&&w(a,mq,iq,"reverseEdge:edge");var b=a.fromVertex,c=a.toVertex;null!==b&&null!==c&&(b.Dv(a),c.Ev(a),a.Tm(),b.wv(a),c.uv(a))}}; t.yq=function(){for(var a=La(),b=this.pe.iterator;b.next();){var c=b.value;c.fromVertex===c.toVertex&&a.push(c)}b=a.length;for(c=0;c<b;c++)this.rk(a[c]);Oa(a)};iq.prototype.deleteArtificialVertexes=function(){for(var a=La(),b=this.Af.iterator;b.next();){var c=b.value;null===c.node&&a.push(c)}c=a.length;for(b=0;b<c;b++)this.Fv(a[b]);b=La();for(c=this.pe.iterator;c.next();){var d=c.value;null===d.link&&b.push(d)}c=b.length;for(d=0;d<c;d++)this.rk(b[d]);Oa(a);Oa(b)}; function qq(a){for(var b=La(),c=a.pe.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.rk(b[d]);Oa(b)} iq.prototype.Ky=function(a){void 0===a&&(a=!0);a&&(this.deleteArtificialVertexes(),qq(this),this.yq());a=new H;for(var b=!0;b;){b=!1;for(var c=this.Af.iterator;c.next();){var d=c.value;if(0<d.Pg.count||0<d.Hg.count){b=this.layout.createNetwork();a.add(b);rq(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 rq(a,b,c){if(null!==c&&c.network!==b){nq(a,c);b.Mh(c);for(var d=c.sourceEdges;d.next();){var e=d.value;e.network!==b&&(pq(a,e),oq(b,e),rq(a,b,e.fromVertex))}for(d=c.destinationEdges;d.next();)c=d.value,c.network!==b&&(pq(a,c),oq(b,c),rq(a,b,c.toVertex))}}iq.prototype.Ez=function(){for(var a=new I,b=this.Af.iterator;b.next();)a.add(b.value.node);for(b=this.pe.iterator;b.next();)a.add(b.value.link);return a}; ma.Object.defineProperties(iq.prototype,{layout:{configurable:!0,get:function(){return this.oc},set:function(a){null!==a&&(this.oc=a)}},vertexes:{configurable:!0,get:function(){return this.Af}},edges:{configurable:!0,get:function(){return this.pe}}});iq.prototype.findAllParts=iq.prototype.Ez;iq.prototype.splitIntoSubNetworks=iq.prototype.Ky;iq.prototype.deleteSelfEdges=iq.prototype.yq;iq.prototype.reverseEdge=iq.prototype.Tm;iq.prototype.linkVertexes=iq.prototype.zk; iq.prototype.findEdge=iq.prototype.Aq;iq.prototype.deleteLink=iq.prototype.vz;iq.prototype.deleteEdge=iq.prototype.rk;iq.prototype.addLink=iq.prototype.az;iq.prototype.addEdge=iq.prototype.sq;iq.prototype.findVertex=iq.prototype.gj;iq.prototype.deleteNode=iq.prototype.wz;iq.prototype.deleteVertex=iq.prototype.Fv;iq.prototype.addNode=iq.prototype.nm;iq.prototype.addVertex=iq.prototype.Mh;iq.prototype.addParts=iq.prototype.Gg;iq.className="LayoutNetwork"; function lq(a){fb(this);F&&!a&&v("LayoutVertex constructor requires non-null LayoutNetwork argument");this.Pc=a;this.l=(new L(0,0,10,10)).freeze();this.w=(new J(5,5)).freeze();this.Ki=this.pb=null;this.Pg=new H;this.Hg=new H}lq.prototype.clear=function(){this.Ki=this.pb=null;this.Pg=new H;this.Hg=new H}; lq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutVertex#"+pb(this);if(0<a&&(b+=null!==this.node?"("+this.node.toString()+")":"",1<a)){a="";for(var c=!0,d=this.Pg.iterator;d.next();){var e=d.value;c?c=!1:a+=",";a+=e.toString(0)}e="";c=!0;for(d=this.Hg.iterator;d.next();){var f=d.value;c?c=!1:e+=",";e+=f.toString(0)}b+=" sources: "+a+" destinations: "+e}return b}; lq.prototype.commit=function(){var a=this.pb;if(null!==a){var b=this.bounds,c=a.bounds;Fa(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 Hf)){c=L.alloc();var d=this.network.layout.jj(a,c),e=a.locationObject.ma(Mc);if(d.o()&&e.o()){a.moveTo(b.x+this.focusX-(e.x-d.x),b.y+this.focusY-(e.y-d.y));L.free(c);return}L.free(c)}a.moveTo(b.x,b.y)}}; lq.prototype.wv=function(a){null!==a&&(F&&w(a,mq,lq,"addSourceEdge:edge"),this.Pg.contains(a)||this.Pg.add(a))};lq.prototype.Ev=function(a){null!==a&&(F&&w(a,mq,lq,"deleteSourceEdge:edge"),this.Pg.remove(a))};lq.prototype.uv=function(a){null!==a&&(F&&w(a,mq,lq,"addDestinationEdge:edge"),this.Hg.contains(a)||this.Hg.add(a))};lq.prototype.Dv=function(a){null!==a&&(F&&w(a,mq,lq,"deleteDestinationEdge:edge"),this.Hg.remove(a))}; function sq(a,b){F&&w(a,lq,lq,"standardComparer:m");F&&w(b,lq,lq,"standardComparer:n");a=a.Ki;b=b.Ki;return a?b?(a=a.text,b=b.text,a<b?-1:a>b?1:0):1:null!==b?-1:0} ma.Object.defineProperties(lq.prototype,{sourceEdgesArrayAccess:{configurable:!0,get:function(){return this.Pg._dataArray}},destinationEdgesArrayAccess:{configurable:!0,get:function(){return this.Hg._dataArray}},data:{configurable:!0,get:function(){return this.pb},set:function(a){this.pb=a;if(null!==a){var b=a.bounds;a=b.x;var c=b.y,d=b.width;b=b.height;this.w.h(d/2,b/2);this.l.h(a,c,d,b)}}},node:{configurable:!0,get:function(){return this.Ki}, set:function(a){if(this.Ki!==a){F&&null!==a&&w(a,T,lq,"node");this.Ki=a;a.Eb();var b=this.network.layout,c=L.alloc(),d=b.jj(a,c);b=d.x;var e=d.y,f=d.width;d=d.height;isNaN(b)&&(b=0);isNaN(e)&&(e=0);this.l.h(b,e,f,d);L.free(c);if(!(a instanceof Hf)&&(a=a.locationObject.ma(Mc),a.o())){this.w.h(a.x-b,a.y-e);return}this.w.h(f/2,d/2)}}},bounds:{configurable:!0,get:function(){return this.l},set:function(a){this.l.A(a)||(F&&w(a,L,lq,"bounds"),this.l.assign(a))}},focus:{configurable:!0, get:function(){return this.w},set:function(a){this.w.A(a)||(F&&w(a,J,lq,"focus"),this.w.assign(a))}},centerX:{configurable:!0,get:function(){return this.l.x+this.w.x},set:function(a){var b=this.l;b.x+this.w.x!==a&&(F&&C(a,lq,"centerX"),b.ka(),b.x=a-this.w.x,b.freeze())}},centerY:{configurable:!0,get:function(){return this.l.y+this.w.y},set:function(a){var b=this.l;b.y+this.w.y!==a&&(F&&C(a,lq,"centerY"),b.ka(),b.y=a-this.w.y,b.freeze())}},focusX:{configurable:!0, get:function(){return this.w.x},set:function(a){var b=this.w;b.x!==a&&(b.ka(),b.x=a,b.freeze())}},focusY:{configurable:!0,get:function(){return this.w.y},set:function(a){var b=this.w;b.y!==a&&(b.ka(),b.y=a,b.freeze())}},x:{configurable:!0,get:function(){return this.l.x},set:function(a){var b=this.l;b.x!==a&&(b.ka(),b.x=a,b.freeze())}},y:{configurable:!0,get:function(){return this.l.y},set:function(a){var b=this.l;b.y!==a&&(b.ka(),b.y=a,b.freeze())}},width:{configurable:!0, enumerable:!0,get:function(){return this.l.width},set:function(a){var b=this.l;b.width!==a&&(b.ka(),b.width=a,b.freeze())}},height:{configurable:!0,get:function(){return this.l.height},set:function(a){var b=this.l;b.height!==a&&(b.ka(),b.height=a,b.freeze())}},network:{configurable:!0,get:function(){return this.Pc},set:function(a){F&&w(a,iq,lq,"network");this.Pc=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.Pg.iterator}},destinationEdges:{configurable:!0, enumerable:!0,get:function(){return this.Hg.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.Pg.count+this.Hg.count}}});lq.prototype.deleteDestinationEdge=lq.prototype.Dv;lq.prototype.addDestinationEdge=lq.prototype.uv;lq.prototype.deleteSourceEdge=lq.prototype.Ev; lq.prototype.addSourceEdge=lq.prototype.wv;lq.className="LayoutVertex";lq.standardComparer=sq; lq.smartComparer=function(a,b){F&&w(a,lq,lq,"smartComparer:m");F&&w(b,lq,lq,"smartComparer:n");if(null!==a){if(null!==b){a=a.Ki;var c=b.Ki;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 mq(a){fb(this);F&&!a&&v("LayoutEdge constructor requires non-null LayoutNetwork argument");this.qd=a;this.Cg=this.dg=this.Hl=this.pb=null}mq.prototype.clear=function(){this.Cg=this.dg=this.Hl=this.pb=null}; mq.prototype.toString=function(a){void 0===a&&(a=0);var b="LayoutEdge#"+pb(this);0<a&&(b+=null!==this.Hl?"("+this.Hl.toString()+")":"",1<a&&(b+=" "+(this.dg?this.dg.toString():"null")+" --\x3e "+(this.Cg?this.Cg.toString():"null")));return b};mq.prototype.Tm=function(){var a=this.dg;this.dg=this.Cg;this.Cg=a};mq.prototype.commit=function(){};mq.prototype.ly=function(a){F&&w(a,lq,mq,"getOtherVertex:v");return this.Cg===a?this.dg:this.dg===a?this.Cg:null}; ma.Object.defineProperties(mq.prototype,{network:{configurable:!0,get:function(){return this.qd},set:function(a){F&&w(a,iq,mq,"network");this.qd=a}},data:{configurable:!0,get:function(){return this.pb},set:function(a){this.pb!==a&&(F&&null!==a&&A(a,"object",mq,"data"),this.pb=a)}},link:{configurable:!0,get:function(){return this.Hl},set:function(a){this.Hl!==a&&(F&&null!==a&&w(a,R,mq,"link"),this.Hl=a)}},fromVertex:{configurable:!0,get:function(){return this.dg}, set:function(a){this.dg!==a&&(F&&null!==a&&w(a,lq,mq,"network"),this.dg=a)}},toVertex:{configurable:!0,get:function(){return this.Cg},set:function(a){this.Cg!==a&&(F&&null!==a&&w(a,lq,mq,"network"),this.Cg=a)}}});mq.prototype.getOtherVertex=mq.prototype.ly;mq.className="LayoutEdge"; function bl(){0<arguments.length&&za(bl);Ni.call(this);this.isViewportSized=!0;this.pq=this.qq=NaN;this.Wg=(new Hb(NaN,NaN)).freeze();this.sf=(new Hb(10,10)).freeze();this.Bb=tq;this.Hb=uq;this.Xc=vq;this.Rc=wq}la(bl,Ni);bl.prototype.cloneProtected=function(a){Ni.prototype.cloneProtected.call(this,a);a.qq=this.qq;a.pq=this.pq;a.Wg.assign(this.Wg);a.sf.assign(this.sf);a.Bb=this.Bb;a.Hb=this.Hb;a.Xc=this.Xc;a.Rc=this.Rc}; bl.prototype.mb=function(a){a.classType===bl?a===vq||a===xq||a===yq||a===zq?this.sorting=a:a===uq||a===Aq?this.arrangement=a:a===tq||a===Bq?this.alignment=a:v("Unknown enum value: "+a):Ni.prototype.mb.call(this,a)}; bl.prototype.doLayout=function(a){F&&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.Rx(a);a=this.diagram;for(var c=b.copy().iterator;c.next();){var d=c.value;if(!d.Sh()||null===d.fromNode&&null===d.toNode){if(d.Eb(),d instanceof Hf)for(d=d.memberParts;d.next();)b.remove(d.value)}else b.remove(d)}var e=b.ua();if(0!==e.length){switch(this.sorting){case zq:e.reverse(); break;case vq:e.sort(this.comparer);break;case xq: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.Ba("Layout");d=[];switch(this.alignment){case Bq:var h=b,k=c,l=L.alloc(),m=Math.max(this.cellSize.width,1);if(!isFinite(m))for(var n= m=0;n<e.length;n++){var p=this.jj(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.jj(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,x=0,y=0,z=0;z<e.length;z++){var B=e[z],D=this.jj(B,l),G=Math.ceil((D.width+h)/m)*m,O=Math.ceil((D.height+k)/n)*n;switch(p){case Aq:var X=Math.abs(q-D.width);break;default:X=q+D.width}if(0<f&&x>f-1|| 0<g&&0<x&&X-r>g)d.push(new L(0,u,g+h,y)),x=0,q=r,u+=y,y=0;y=Math.max(y,O);switch(p){case Aq:D=-D.width;break;default:D=0}B.moveTo(q+D,u);switch(p){case Aq:q-=G;break;default:q+=G}x++}d.push(new L(0,u,g+h,y));L.free(l);break;case tq:k=g;m=f;n=b;p=c;g=L.alloc();r=Math.max(this.cellSize.width,1);f=u=l=0;h=J.alloc();for(q=0;q<e.length;q++)y=e[q],x=this.jj(y,g),y=y.Hf(y.locationObject,y.locationSpot,h),l=Math.max(l,y.x),u=Math.max(u,x.width-y.x),f=Math.max(f,y.y);q=this.arrangement;switch(q){case Aq:l+= n;break;default:u+=n}r=isFinite(r)?Math.max(r+n,1):Math.max(l+u,1);var Q=y=this.arrangementOrigin.x;z=this.arrangementOrigin.y;u=0;k>=l&&(k-=l);l=B=0;G=Math.max(this.cellSize.height,1);D=f=0;O=!0;x=J.alloc();for(X=0;X<e.length;X++){var ca=e[X],Y=this.jj(ca,g),oa=ca.Hf(ca.locationObject,ca.locationSpot,h);if(0<u)switch(q){case Aq:Q=(Q-y-(Y.width-oa.x))/r;Q=K.ca(Math.round(Q),Q)?Math.round(Q):Math.floor(Q);Q=Q*r+y;break;default:Q=(Q-y+oa.x)/r,Q=K.ca(Math.round(Q),Q)?Math.round(Q):Math.ceil(Q),Q=Q*r+ y}else switch(q){case Aq:B=Q+oa.x+Y.width;break;default:B=Q-oa.x}switch(q){case Aq:var Da=-(Q+oa.x)+B;break;default:Da=Q+Y.width-oa.x-B}if(0<m&&u>m-1||0<k&&0<u&&Da>k){d.push(new L(0,O?z-f:z,k+n,D+f+p));for(Q=0;Q<u&&X!==u;Q++){Da=e[X-u+Q];var V=Da.Hf(Da.locationObject,Da.locationSpot,x);Da.moveTo(Da.position.x,Da.position.y+f-V.y)}D+=p;z=O?z+D:z+(D+f);u=D=f=0;Q=y;O=!1}Q===y&&(l=q===Aq?Math.max(l,Y.width-oa.x):Math.min(l,-oa.x));f=Math.max(f,oa.y);D=Math.max(D,Y.height-oa.y);isFinite(G)&&(D=Math.max(D, Math.max(Y.height,G)-oa.y));O?ca.moveTo(Q-oa.x,z-oa.y):ca.moveTo(Q-oa.x,z);switch(q){case Aq:Q-=oa.x+n;break;default:Q+=Y.width-oa.x+n}u++}d.push(new L(0,z,k+n,(O?D:D+f)+p));if(e.length!==u)for(k=0;k<u;k++)m=e[e.length-u+k],n=m.Hf(m.locationObject,m.locationSpot,h),m.moveTo(m.position.x,m.position.y+f-n.y);J.free(h);J.free(x);if(q===Aq)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);L.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===Aq?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.$a("Layout");this.isValidLayout=!0}};bl.prototype.commitLayers=function(){};function wq(a,b){F&&w(a,S,bl,"standardComparer:a");F&&w(b,S,bl,"standardComparer:b");a=a.text;b=b.text;return a<b?-1:a>b?1:0} ma.Object.defineProperties(bl.prototype,{wrappingWidth:{configurable:!0,get:function(){return this.qq},set:function(a){this.qq!==a&&(A(a,"number",bl,"wrappingWidth"),0<a||isNaN(a))&&(this.qq=a,this.isViewportSized=isNaN(a),this.D())}},wrappingColumn:{configurable:!0,get:function(){return this.pq},set:function(a){this.pq!==a&&(A(a,"number",bl,"wrappingColumn"),0<a||isNaN(a))&&(this.pq=a,this.D())}},cellSize:{configurable:!0,get:function(){return this.Wg},set:function(a){w(a, Hb,bl,"cellSize");this.Wg.A(a)||(this.Wg.assign(a),this.D())}},spacing:{configurable:!0,get:function(){return this.sf},set:function(a){w(a,Hb,bl,"spacing");this.sf.A(a)||(this.sf.assign(a),this.D())}},alignment:{configurable:!0,get:function(){return this.Bb},set:function(a){this.Bb!==a&&(hb(a,bl,bl,"alignment"),a===tq||a===Bq)&&(this.Bb=a,this.D())}},arrangement:{configurable:!0,get:function(){return this.Hb},set:function(a){this.Hb!==a&&(hb(a,bl,bl,"arrangement"), a===uq||a===Aq)&&(this.Hb=a,this.D())}},sorting:{configurable:!0,get:function(){return this.Xc},set:function(a){this.Xc!==a&&(hb(a,bl,bl,"sorting"),a===yq||a===zq||a===vq||a===xq)&&(this.Xc=a,this.D())}},comparer:{configurable:!0,get:function(){return this.Rc},set:function(a){this.Rc!==a&&(A(a,"function",bl,"comparer"),this.Rc=a,this.D())}}}); var Bq=new E(bl,"Position",0),tq=new E(bl,"Location",1),uq=new E(bl,"LeftToRight",2),Aq=new E(bl,"RightToLeft",3),yq=new E(bl,"Forward",4),zq=new E(bl,"Reverse",5),vq=new E(bl,"Ascending",6),xq=new E(bl,"Descending",7);bl.className="GridLayout";bl.standardComparer=wq; bl.smartComparer=function(a,b){F&&w(a,S,bl,"standardComparer:a");F&&w(b,S,bl,"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};bl.Position=Bq;bl.Location=tq;bl.LeftToRight=uq;bl.RightToLeft=Aq;bl.Forward=yq;bl.Reverse=zq;bl.Ascending=vq;bl.Descending=xq;function Ii(){this.ip=new I;this.Io=new I;this.Ha=new I;this.$e=new Db;this.Ze=new Db;this.Kj=new Db;this.B=null;this.jr=!1}t=Ii.prototype;t.clear=function(){this.ip.clear();this.Io.clear();this.Ha.clear();this.$e.clear();this.Ze.clear();this.Kj.clear()}; t.he=function(a){F&&null!==a&&w(a,P,Ii,"setDiagram");this.B=a};t.lj=function(a){if(a instanceof T){if(this.ip.add(a),a instanceof Hf){var b=a.containingGroup;null===b?this.B.Hh.add(a):b.Ml.add(a);b=a.layout;null!==b&&(b.diagram=this.B)}}else a instanceof R?this.Io.add(a):a instanceof Te||this.Ha.add(a);b=a.data;null===b||a instanceof Te||(a instanceof R?this.Ze.add(b,a):this.$e.add(b,a))}; t.Lc=function(a){a.jk();if(a instanceof T){if(this.ip.remove(a),a instanceof Hf){var b=a.containingGroup;null===b?this.B.Hh.remove(a):b.Ml.remove(a);b=a.layout;null!==b&&(b.diagram=null)}}else a instanceof R?this.Io.remove(a):a instanceof Te||this.Ha.remove(a);b=a.data;null===b||a instanceof Te||(a instanceof R?this.Ze.remove(b):this.$e.remove(b))}; t.Fd=function(){for(var a=this.B.nodeTemplateMap.iterator;a.next();){var b=a.value,c=a.key;(!b.bc()||b instanceof Hf)&&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.B.groupTemplateMap.iterator;a.next();)b=a.value,c=a.key,b instanceof Hf||v('Invalid group template in Diagram.groupTemplateMap: template for "'+c+'" must be a Group, not a normal Node or Link: '+b);for(a=this.B.linkTemplateMap.iterator;a.next();)b= a.value,c=a.key,b instanceof R||v('Invalid link template in Diagram.linkTemplateMap: template for "'+c+'" must be a Link, not a normal Node or simple Part: '+b);a=La();for(b=this.B.selection.iterator;b.next();)(c=b.value.data)&&a.push(c);b=La();for(c=this.B.highlighteds.iterator;c.next();){var d=c.value.data;d&&b.push(d)}c=La();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.Cc(a[d]),null!==e&&(e.isSelected=!0);for(d=0;d<b.length;d++)e=this.Cc(b[d]),null!==e&&(e.isHighlighted=!0);for(d=0;d<c.length;d+=2)e=this.Cc(c[d]),null!==e&&(e.location=c[d+1]);Oa(a);Oa(b);Oa(c)};Ii.prototype.addAllModeledParts=function(){this.addModeledParts(this.diagram.model.nodeDataArray)}; Ii.prototype.addModeledParts=function(a,b){var c=this,d=this.diagram.model;a.forEach(function(a){d.eb(a)&&Cq(c,a,!1)});a.forEach(function(a){d.eb(a)&&c.resolveReferencesForData(a)});!1!==b&&Dk(this.diagram,!1)}; function Cq(a,b,c){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.$e.contains(b)){void 0===c&&(c=!0);a:{if(void 0!==b&&null!==b&&!a.B.undoManager.isUndoingRedoing&&!a.$e.contains(b)){var d=a.Et(b);var e=dp(a,b,d);if(null!==e&&(Lg(e),e=e.copy(),null!==e)){var f=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Uf=d;e.pb=b;a.jr&&(e.nh="Tool");a.diagram.add(e);e.pb=null;e.data=b;a.diagram.skipsModelSourceBindings=f;d=e;break a}}d=null}null!==d&&c&&a.resolveReferencesForData(b)}} Ii.prototype.insertLink=function(){return null};Ii.prototype.resolveReferencesForData=function(){};Ii.prototype.Et=function(a){return this.B.model.Et(a)}; function dp(a,b,c){a=a.B;var d=a.model;d.mj()&&d.Lt(b)?(b=a.groupTemplateMap.K(c),null===b&&(b=a.groupTemplateMap.K(""),null===b&&(Dq||(Dq=!0,Ca('No Group template found for category "'+c+'"'),Ca(" Using default group template")),b=a.wu))):(b=a.nodeTemplateMap.K(c),null===b&&(b=a.nodeTemplateMap.K(""),null===b&&(Eq||(Eq=!0,Ca('No Node template found for category "'+c+'"'),Ca(" Using default node template")),b=a.yu)));return b}Ii.prototype.getLinkCategoryForData=function(){return""}; Ii.prototype.setLinkCategoryForData=function(){};Ii.prototype.setFromNodeForLink=function(){};Ii.prototype.setToNodeForLink=function(){};Ii.prototype.findLinkTemplateForCategory=function(a){var b=this.B.linkTemplateMap.K(a);null===b&&(b=this.B.linkTemplateMap.K(""),null===b&&(Fq||(Fq=!0,Ca('No Link template found for category "'+a+'"'),Ca(" Using default link template")),b=this.B.xu));return b};Ii.prototype.removeAllModeledParts=function(){this.Zt(this.diagram.model.nodeDataArray)}; Ii.prototype.Zt=function(a){var b=this;a.forEach(function(a){b.Xq(a)})};Ii.prototype.Xq=function(a){a=this.Cc(a);null!==a&&(ak(this.diagram,a,!1),this.unresolveReferencesForPart(a))};Ii.prototype.unresolveReferencesForPart=function(){};Ii.prototype.removeDataForLink=function(){};Ii.prototype.findPartForKey=function(a){if(null===a||void 0===a)return null;a=this.B.model.Pb(a);return null!==a?this.$e.K(a):null}; Ii.prototype.Qb=function(a){if(null===a||void 0===a)return null;a=this.B.model.Pb(a);if(null===a)return null;a=this.$e.K(a);return a instanceof T?a:null};Ii.prototype.findLinkForKey=function(){return null};t=Ii.prototype;t.Cc=function(a){if(null===a)return null;var b=this.$e.K(a);return null!==b?b:b=this.Ze.K(a)};t.cj=function(a){if(null===a)return null;a=this.$e.K(a);return a instanceof T?a:null};t.Bc=function(a){return null===a?null:this.Ze.K(a)}; t.Bt=function(a){for(var b=0;b<arguments.length;++b);b=new I;for(var c=this.ip.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(Fa(g)&&Gq(this,e,g)){b.add(d);break}}}return b.iterator};t.At=function(a){for(var b=0;b<arguments.length;++b);b=new I;for(var c=this.Io.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(Fa(g)&&Gq(this,e,g)){b.add(d);break}}}return b.iterator}; function Gq(a,b,c){for(var d in c){var e=b[d],f=c[d];if(Ga(f)){if(!Ga(e)||e.length<f.length)return!1;for(var g=0;g<e.length;g++){var h=f[g];if(void 0!==h&&!Hq(a,e[g],h))return!1}}else if(!Hq(a,e,f))return!1}return!0}function Hq(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(Fa(b)&&Fa(c)){if(!Gq(a,b,c))return!1}else if(b!==c)return!1;return!0} Ii.prototype.doModelChanged=function(a){if(this.B){var b=this.B;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===He){if("nodeCategory"===d){var e=this.Cc(a.object),f=a.newValue;null!==e&&"string"===typeof f&&(e.category=f)}else"nodeDataArray"===d&&(this.Zt(a.oldValue),this.addModeledParts(a.newValue));b.isModified=!0}else if(c===Je){var g=a.newValue;"nodeDataArray"===d&&Fa(g)&&Cq(this,g);b.isModified=!0}else if(c===Ke){var h=a.oldValue; "nodeDataArray"===d&&Fa(h)&&this.Xq(h);b.isModified=!0}else c===Ie&&("SourceChanged"===d?null!==a.object?this.updateDataBindings(a.object,a.propertyName):(this.fr(),this.updateAllTargetBindings()):"ModelDisplaced"===d&&this.Fd());else if(c===He){var k=a.propertyName,l=a.object;if(l===b.model){if("nodeKeyProperty"===k||"nodeCategoryProperty"===k)b.undoManager.isUndoingRedoing||this.Fd()}else this.updateDataBindings(l,k);b.isModified=!0}else if(c===Je||c===Ke){var m=a.change===Je,n=m?a.newParam:a.oldParam, p=m?a.newValue:a.oldValue,r=this.Kj.K(a.object);if(Array.isArray(r))for(a=0;a<r.length;a++){var q=r[a];if(m)En(q,p,n);else if(!(0>n)){var u=n+wn(q);q.Lc(u,!0);Sn(q,u,n)}}b.isModified=!0}}finally{b.ba=!0}}}}};Ii.prototype.updateAllTargetBindings=function(a){void 0===a&&(a="");for(var b=this.parts.iterator;b.next();)b.value.Ga(a);for(b=this.nodes.iterator;b.next();)b.value.Ga(a);for(b=this.links.iterator;b.next();)b.value.Ga(a)}; Ii.prototype.fr=function(){for(var a=this.B.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){Iq(a,b,!1)});for(d=0;d<c.length;d++){var f=c[d];null===this.Cc(f)&&Jq(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()};Ii.prototype.refreshDataBoundLinks=function(){};Ii.prototype.updateRelationshipsFromData=function(){}; Ii.prototype.updateDataBindings=function(a,b){if("string"===typeof b){var c=this.Cc(a);if(null!==c)c.Ga(b);else{c=null;for(var d=this.Kj.iterator;d.next();){for(var e=d.value,f=0;f<e.length;f++){var g=e[f].ey(a);null!==g&&(null===c&&(c=La()),c.push(g))}if(null!==c)break}if(null!==c){for(d=0;d<c.length;d++)c[d].Ga(b);Oa(c)}}a===this.diagram.model.modelData&&this.updateAllTargetBindings(b)}}; function Wj(a,b){var c=b.Di;if(Ga(c)){var d=a.Kj.K(c);if(null===d)d=[],d.push(b),a.Kj.add(c,d);else{for(a=0;a<d.length;a++)if(d[a]===b)return;d.push(b)}}}function Zj(a,b,c){Uj(b,function(a){a=a.Z.j;for(var b=a.length,d=0;d<b;d++)Bk(c,a[d])});var d=b.Di;if(Ga(d)){var e=a.Kj.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.Kj.remove(d);break}}} Ii.prototype.pk=function(a,b,c){var d=new Db;if(Ga(a))for(var e=0;e<a.length;e++)Kq(this,a[e],b,d,c);else for(a=a.iterator;a.next();)Kq(this,a.value,b,d,c);if(null!==b){c=b.model;a=b.toolManager.findTool("Dragging");a=null!==a?a.dragOptions.dragsLink:b.cl.dragsLink;e=new I;for(var f=new Db,g=d.iterator;g.next();){var h=g.value;if(h instanceof R)a||null!==h.fromNode&&null!==h.toNode||e.add(h);else if(h instanceof T&&null!==h.data&&c.Em()){var k=h;h=g.key;var l=h.Kg();null!==l&&(l=d.K(l),null!==l?(c.Ue(k.data, c.pa(l.data)),k=b.Bc(k.data),h=h.fj(),null!==h&&null!==k&&f.add(h,k)):c.Ue(k.data,void 0))}}0<e.count&&b.$t(e,!1);if(0<f.count)for(c=f.iterator;c.next();)d.add(c.key,c.value)}if(null!==b&&null!==this.B&&(b=b.model,c=b.afterCopyFunction,null!==c)){var m=new Db;d.each(function(a){null!==a.key.data&&m.add(a.key.data,a.value.data)});c(m,b,this.B.model)}for(b=d.iterator;b.next();)b.value.Ga();return d}; function Kq(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 S))return null;f.isSelected=!1;f.isHighlighted=!1;d.add(b,f);if(b instanceof T){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 Hf&&f instanceof Hf)for(b=b.memberParts;b.next();)g=Kq(a,b.value,c,d,e),g instanceof R||null===g||(g.containingGroup= f)}else if(b instanceof R&&f instanceof R)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=Kq(a,b.value,c,d,e),null!==g&&g instanceof T&&(g.labeledLink=f);return f} Ii.prototype.copyPartData=function(a,b){var c=null,d=a.data;if(null!==d&&null!==b){var e=b.model;a instanceof R||(d=e.copyNodeData(d),Fa(d)&&(e.Bf(d),c=b.Cc(d)))}else Lg(a),c=a.copy(),null!==c&&(e=this.B,null!==b?b.add(c):null!==d&&null!==e&&null!==e.commandHandler&&e.commandHandler.copiesClipboardData&&(b=e.model,e=null,c instanceof R||(e=b.copyNodeData(d)),Fa(e)&&(c.data=e)));return c}; ma.Object.defineProperties(Ii.prototype,{nodes:{configurable:!0,get:function(){return this.ip}},links:{configurable:!0,get:function(){return this.Io}},parts:{configurable:!0,get:function(){return this.Ha}},diagram:{configurable:!0,get:function(){return this.B}},addsToTemporaryLayer:{configurable:!0,get:function(){return this.jr},set:function(a){A(a,"boolean",Ii,"addsToTemporaryLayer");this.jr=a}}}); Ii.prototype.updateAllRelationshipsFromData=Ii.prototype.fr;Ii.prototype.findLinksByExample=Ii.prototype.At;Ii.prototype.findNodesByExample=Ii.prototype.Bt;Ii.prototype.findLinkForData=Ii.prototype.Bc;Ii.prototype.findNodeForData=Ii.prototype.cj;Ii.prototype.findPartForData=Ii.prototype.Cc;Ii.prototype.findNodeForKey=Ii.prototype.Qb;Ii.prototype.removeModeledPart=Ii.prototype.Xq;Ii.prototype.removeModeledParts=Ii.prototype.Zt;Ii.prototype.rebuildParts=Ii.prototype.Fd;var Eq=!1,Dq=!1,Fq=!1; Ii.className="PartManager";function Lq(a){Ii.apply(this,arguments)}la(Lq,Ii);Lq.prototype.addAllModeledParts=function(){var a=this.diagram.model;this.addModeledParts(a.nodeDataArray);Mq(this,a.linkDataArray)};Lq.prototype.addModeledParts=function(a){Ii.prototype.addModeledParts.call(this,a,!1);for(a=this.links.iterator;a.next();)ep(a.value);Dk(this.diagram,!1)};function Mq(a,b){b.forEach(function(b){Nq(a,b)});Dk(a.diagram,!1)} function Nq(a,b){if(void 0!==b&&null!==b&&!a.diagram.undoManager.isUndoingRedoing&&!a.Ze.contains(b)){var c=a.getLinkCategoryForData(b),d=a.findLinkTemplateForCategory(c);if(null!==d){Lg(d);var e=d.copy();if(null!==e){d=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;e.Uf=c;e.pb=b;c=a.diagram.model;var f=Oq(c,b,!0);""!==f&&(e.fromPortId=f);f=Pq(c,b,!0);void 0!==f&&(f=a.Qb(f),f instanceof T&&(e.fromNode=f));f=Oq(c,b,!1);""!==f&&(e.toPortId=f);f=Pq(c,b,!1);void 0!==f&&(f=a.Qb(f), f instanceof T&&(e.toNode=f));c=c.Lg(b);Array.isArray(c)&&c.forEach(function(b){b=a.Qb(b);null!==b&&(b.labeledLink=e)});a.jr&&(e.nh="Tool");a.diagram.add(e);e.pb=null;e.data=b;a.diagram.skipsModelSourceBindings=d}}}}Lq.prototype.removeAllModeledParts=function(){var a=this.diagram.model;Qq(this,a.linkDataArray);this.Zt(a.nodeDataArray)};function Qq(a,b){b.forEach(function(b){a.Xq(b)})}Lq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Qv(a)}; Lq.prototype.setLinkCategoryForData=function(a,b){return this.diagram.model.bu(a,b)};Lq.prototype.setFromNodeForLink=function(a,b){var c=this.diagram.model;c.Dy(a.data,c.pa(null!==b?b.data:null))};Lq.prototype.setToNodeForLink=function(a,b){var c=this.diagram.model;c.Hy(a.data,c.pa(null!==b?b.data:null))};Lq.prototype.removeDataForLink=function(a){this.diagram.model.Om(a.data)}; Lq.prototype.findPartForKey=function(a){var b=Ii.prototype.findPartForKey.call(this,a);return null===b&&(a=this.diagram.model.Ig(a),null!==a)?this.Ze.K(a):b};Lq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Ig(a);return null!==a?this.Ze.K(a):null}; Lq.prototype.doModelChanged=function(a){var b=this;Ii.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===He){if("linkFromKey"===e){var f=this.Bc(a.object);if(null!==f){var g=this.Qb(a.newValue);f.fromNode=g}}else if("linkToKey"===e){var h=this.Bc(a.object);if(null!==h){var k=this.Qb(a.newValue);h.toNode=k}}else if("linkFromPortId"===e){var l=this.Bc(a.object);if(null!==l){var m=a.newValue; "string"===typeof m&&(l.fromPortId=m)}}else if("linkToPortId"===e){var n=this.Bc(a.object);if(null!==n){var p=a.newValue;"string"===typeof p&&(n.toPortId=p)}}else if("nodeGroupKey"===e){var r=this.Cc(a.object);if(null!==r){var q=a.newValue;if(void 0!==q){var u=this.Qb(q);u instanceof Hf?r.containingGroup=u:r.containingGroup=null}else r.containingGroup=null}}else if("linkLabelKeys"===e){var x=this.Bc(a.object);if(null!==x){var y=a.oldValue,z=a.newValue;Array.isArray(y)&&y.forEach(function(a){a=b.Qb(a); null!==a&&(a.labeledLink=null)});Array.isArray(z)&&z.forEach(function(a){a=b.Qb(a);null!==a&&(a.labeledLink=x)})}}else if("linkCategory"===e){var B=this.Bc(a.object),D=a.newValue;null!==B&&"string"===typeof D&&(B.category=D)}else"linkDataArray"===e&&(Qq(this,a.oldValue),Mq(this,a.newValue));c.isModified=!0}else if(d===Je){var G=a.newValue;if("linkDataArray"===e&&"object"===typeof G&&null!==G)Nq(this,G);else if("linkLabelKeys"===e&&Rq(G)){var O=this.Bc(a.object),X=this.Qb(G);null!==O&&null!==X&&(X.labeledLink= O)}c.isModified=!0}else{if(d===Ke){var Q=a.oldValue;if("linkDataArray"===e&&"object"===typeof Q&&null!==Q)this.Xq(Q);else if("linkLabelKeys"===e&&Rq(Q)){var ca=this.Qb(Q);null!==ca&&(ca.labeledLink=null)}c.isModified=!0}}else if(d===He){var Y=a.propertyName;a.object!==c.model||"linkFromKeyProperty"!==Y&&"linkToKeyProperty"!==Y&&"linkFromPortIdProperty"!==Y&&"linkToPortIdProperty"!==Y&&"linkLabelKeysProperty"!==Y&&"nodeIsGroupProperty"!==Y&&"nodeGroupKeyProperty"!==Y&&"linkCategoryProperty"!==Y||c.undoManager.isUndoingRedoing|| this.Fd();c.isModified=!0}}finally{c.ba=!0}}}}};Lq.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){Sq(b,a,!1)});d.forEach(function(c){null===a.Bc(c)&&Tq(b,c,!1)})}; Lq.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 R){var e=Pq(d,b,!0);e=c.Qb(e);a.fromNode=e;e=Pq(d,b,!1);e=c.Qb(e);a.toNode=e;b=d.Lg(b);if(0<b.length||0<a.labelNodes.count){if(1===b.length&&1===a.labelNodes.count){e=b[0];var f=a.labelNodes.first();if(d.pa(f.data)===e)return}e=(new I).addAll(b);var g=new I;a.labelNodes.each(function(a){null!==a.data&&(a=d.pa(a.data),void 0!==a&&g.add(a))});b=g.copy();b.Wq(e);e= e.copy();e.Wq(g);if(0<b.count||0<e.count)b.each(function(b){b=c.Qb(b);null!==b&&b.labeledLink===a&&(b.labeledLink=null)}),e.each(function(b){b=c.Qb(b);null!==b&&b.labeledLink!==a&&(b.labeledLink=a)})}}else!(a instanceof Te)&&(b=d.ij(b),b=c.findPartForKey(b),null===b||b instanceof Hf)&&(a.containingGroup=b)}}}; Lq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=Uq(b,c),e=this.Cc(a);if(null!==d&&null!==e){d=d.iterator;for(var f={};d.next();){var g=d.value;b.eb(g)?e instanceof Hf&&b.ij(g)===c&&(g=this.Cc(g),null!==g&&(g.containingGroup=e)):(f.link=this.Bc(g),null!==f.link&&e instanceof T&&(Pq(b,g,!0)===c&&(f.link.fromNode=e),Pq(b,g,!1)===c&&(f.link.toNode=e),g=b.Lg(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}}Vq(b,c)}a=b.ij(a);void 0!==a&&(a=this.Qb(a),a instanceof Hf&&(e.containingGroup=a))}};Lq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof T){var c=b.pa(a.data);if(void 0!==c){for(var d=a.linksConnected;d.next();)Wq(b,c,d.value.data);a.isLinkLabel&&(d=a.labeledLink,null!==d&&Wq(b,c,d.data));if(a instanceof Hf)for(a=a.memberParts;a.next();)d=a.value.data,b.eb(d)&&Wq(b,c,d)}}}; Lq.prototype.copyPartData=function(a,b){var c=Ii.prototype.copyPartData.call(this,a,b);if(a instanceof R)if(a=a.data,null!==a&&null!==b){var d=b.model;a=d.xq(a);"object"===typeof a&&null!==a&&(d.Yi(a),c=b.Bc(a))}else null!==c&&(b=this.diagram,null!==a&&null!==b&&null!==b.commandHandler&&b.commandHandler.copiesClipboardData&&(b=b.model.xq(a),"object"===typeof b&&null!==b&&(c.data=b)));return c}; Lq.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 R){if(Lg(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 T&&(Lg(a),a=a.copy(),null!==a&&(a.labeledLink=f,e.add(a))),f}else if(null!==d&&(d=f.xq(d),"object"=== typeof d&&null!==d))return null!==a&&Xq(f,d,f.pa(a.data),!0),Yq(f,d,h,!0),null!==c&&Xq(f,d,f.pa(c.data),!1),Yq(f,d,b,!1),f.Yi(d),a=g.archetypeLabelNodeData,null===a||a instanceof T||(a=f.copyNodeData(a),"object"===typeof a&&null!==a&&(f.Bf(a),a=f.pa(a),void 0!==a&&f.vv(d,a))),e.Bc(d);return null};Lq.prototype.findLinkForKey=Lq.prototype.findLinkForKey;Lq.prototype.findPartForKey=Lq.prototype.findPartForKey;Lq.prototype.removeAllModeledParts=Lq.prototype.removeAllModeledParts; Lq.prototype.addModeledParts=Lq.prototype.addModeledParts;Lq.prototype.addAllModeledParts=Lq.prototype.addAllModeledParts;Lq.className="GraphLinksPartManager";function Zq(){Ii.apply(this,arguments);this.th=null}la(Zq,Ii); function $q(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||!bg(d,e,f,null,!0))if(d=a.getLinkCategoryForData(c.data),b=a.findLinkTemplateForCategory(d),null!==b&&(Lg(b),b=b.copy(),null!==b)){var g=a.diagram.skipsModelSourceBindings;a.diagram.skipsModelSourceBindings=!0;b.Uf=d; b.pb=c.data;b.fromNode=e;b.toNode=f;a.diagram.add(b);b.pb=null;b.data=c.data;a.diagram.skipsModelSourceBindings=g}}}Zq.prototype.getLinkCategoryForData=function(a){return this.diagram.model.Rv(a)};Zq.prototype.setLinkCategoryForData=function(a,b){this.diagram.model.xw(a,b)}; Zq.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.Ue(a.data,d.pa(b));else{var e=this.th;this.th=a;null!==c&&d.Ue(c.data,void 0);d.Ue(b,d.pa(null!==a.toNode?a.toNode.data:null));this.th=e}}; Zq.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.th;this.th=a;null!==c&&d.Ue(c.data,void 0);d.Ue(b,d.pa(null!==a.fromNode?a.fromNode.data:null));this.th=e}else d.Ue(a.data,d.pa(b))};Zq.prototype.removeDataForLink=function(a){this.diagram.model.Ue(a.data,void 0)}; Zq.prototype.findLinkForKey=function(a){if(null===a||void 0===a)return null;a=this.diagram.model.Pb(a);return null!==a?this.Ze.K(a):null}; Zq.prototype.doModelChanged=function(a){Ii.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===He){if("nodeParentKey"===d){var e=a.object,f=this.Qb(a.newValue),g=this.cj(e);if(null!==this.th)null!==f&&(this.th.data=e,this.th.category=this.getLinkCategoryForData(e));else if(null!==g){var h=g.fj();null!==h?null===f?b.remove(h):b.isTreePathToChildren?h.fromNode=f:h.toNode=f:$q(this,f, g)}}else if("parentLinkCategory"===d){var k=this.cj(a.object),l=a.newValue;if(null!==k&&"string"===typeof l){var m=k.fj();null!==m&&(m.category=l)}}b.isModified=!0}}else if(c===He){var n=a.propertyName;a.object===b.model&&"nodeParentKeyProperty"===n&&(b.undoManager.isUndoingRedoing||this.Fd());b.isModified=!0}}finally{b.ba=!0}}}}}; Zq.prototype.updateRelationshipsFromData=function(a){var b=a.data;if(null!==b){var c=a.diagram;if(null!==c){var d=c.model;a instanceof T&&(b=d.kj(b),b=c.Qb(b),d=a.Kg(),b!==d&&(d=a.fj(),null!==b?null!==d?c.isTreePathToChildren?d.fromNode=b:d.toNode=b:$q(this,b,a):null!==d&&ak(c,d,!1)))}}};Zq.prototype.updateDataBindings=function(a,b){Ii.prototype.updateDataBindings.call(this,a,b);"string"===typeof b&&null!==this.Cc(a)&&(a=this.Bc(a),null!==a&&a.Ga(b))}; Zq.prototype.resolveReferencesForData=function(a){var b=this.diagram.model,c=b.pa(a);if(void 0!==c){var d=Uq(b,c),e=this.Cc(a);if(null!==d&&null!==e){for(d=d.iterator;d.next();){var f=d.value;b.eb(f)&&e instanceof T&&b.kj(f)===c&&$q(this,e,this.cj(f))}Vq(b,c)}a=b.kj(a);void 0!==a&&e instanceof T&&(a=this.Qb(a),$q(this,a,e))}}; Zq.prototype.unresolveReferencesForPart=function(a){var b=this.diagram.model;if(a instanceof T){var c=b.pa(a.data),d=this.Bc(a.data);if(null!==d){d.isSelected=!1;d.isHighlighted=!1;var e=d.layer;if(null!==e){var f=e.Lc(-1,d,!1);0<=f&&this.diagram.gb(Ke,"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.eb(e)&&Wq(b,c,e)}}; Zq.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.Ue(e.data,b.pa(d.data)),e.fj()):null};Zq.prototype.findLinkForKey=Zq.prototype.findLinkForKey;Zq.className="TreePartManager"; function W(a){this.lu=',\n "insertedNodeKeys": ';this.$w=',\n "modifiedNodeData": ';this.nu=',\n "removedNodeKeys": ';this.$h=null;F&&1<arguments.length&&v("Model constructor can only take one optional argument, the Array of node data.");fb(this);this.In=this.Wa="";this.hg=!1;this.l={};this.uc=[];this.Za=new Db;this.Li="key";this.al=this.Jl=null;this.zn=this.An=!1;this.Cn=!0;this.gn=null;this.Sj="category";this.$f=new Db;this.Vu=new H;this.Bg=!1;this.w=null;this.undoManager=new Me;void 0!==a&& (this.nodeDataArray=a)}W.prototype.cloneProtected=function(a){a.Wa=this.Wa;a.In=this.In;a.hg=this.hg;a.Li=this.Li;a.Jl=this.Jl;a.al=this.al;a.An=this.An;a.zn=this.zn;a.Cn=this.Cn;a.gn=this.gn;a.Sj=this.Sj};W.prototype.copy=function(){var a=new this.constructor;this.cloneProtected(a);return a};W.prototype.clear=function(){this.uc=[];this.Za.clear();this.$f.clear();this.undoManager.clear()}; W.prototype.toString=function(a){void 0===a&&(a=0);if(1<a)return this.cr();var b=(""!==this.name?this.name:"")+" Model";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}}return b}; W.prototype.WA=function(a){w(a,Ge,W,"toIncrementalData:e");a.change!==Ie&&v("Model.toIncrementalData argument is not a Transaction ChangedEvent:"+a.toString());var b=a.object;if(!(a.isTransactionFinished&&b instanceof Le))return null;ar(this,b);a=this.Pw(b,"FinishedUndo"===a.propertyName);this.$h=null;return a}; W.prototype.Pw=function(a,b){var c=this,d=!1,e=new I,f=new I,g=new I,h=this.$h;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):c.eb(a.object)?f.add(a.object):a.change!==He||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.eb(a)&&f.add(a)}):br(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=new I;e.each(function(a){k.add(c.pa(a)); b||f.add(a)});var l=new I;g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a=c.cloneDeep(f.ua());var m=null;d&&(null===m&&(m={}),m.modelData=this.cloneDeep(this.modelData));0<k.count&&(null===m&&(m={}),b?m.removedNodeKeys=k.ua():m.insertedNodeKeys=k.ua());0<a.length&&(null===m&&(m={}),m.modifiedNodeData=a);0<l.count&&(null===m&&(m={}),b?m.insertedNodeKeys=l.ua():m.removedNodeKeys=l.ua());return m};W.prototype.cloneDeep=function(a){return cr(this,a,!0)}; function cr(a,b,c,d,e,f){function g(a,c){h?(void 0===a.__gohashid&&f.push(a),d.set(a,c)):(a=wb++,d.set(a,c),e.set(a,b))}if(!Fa(b))return b;f||(f=[]);var h=Object.isExtensible(b);d||(d=new Db);if(h){var k=d.get(b);if(k)return k}else for(e||(e=new Db),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(cr(a,b[m],!1,d,e,f))}else if(b instanceof J||b instanceof Hb||b instanceof L||b instanceof lc||b instanceof M)k= b.copy(),g(b,k);else{if(b instanceof Kl||b instanceof Fd||b instanceof E)return b;if(b instanceof H)k=(new H).addAll(cr(a,b.ua(),!1,d,e,f)),g(b,k);else if(b instanceof I)k=(new I).addAll(cr(a,b.ua(),!1,d,e,f)),g(b,k);else if(b instanceof Db)k=(new Db).addAll(cr(a,b.ua(),!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]=cr(a,b[m],!1,d,e,f))}c&&f.forEach(function(a){delete a.__gohashid});return k}t=W.prototype; t.Mk=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.Vq=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 dr(a){return',\n "modelData": '+er(a,a.modelData)} function fr(a,b){b=b.modelData;Fa(b)&&(a.Qm(b),a.modelData=b)}t.Qw=function(){var a=this.modelData,b=!1,c;for(c in a)if(!gr(c,a[c])){b=!0;break}a="";b&&(a=dr(this));return a+',\n "nodeDataArray": '+hr(this,this.nodeDataArray,!0)};t.lw=function(a){fr(this,a);a=a.nodeDataArray;Ga(a)&&(this.Qm(a),this.nodeDataArray=a)}; function ir(a,b,c,d){if(b===c)return!0;if(typeof b!==typeof c||"function"===typeof b||"function"===typeof c)return!1;if(Array.isArray(b)&&Array.isArray(c)){if(d.K(b)===c)return!0;d.add(b,c);if(b.length!==c.length)return!1;for(var e=0;e<b.length;e++)if(!ir(a,b[e],c[e],d))return!1;return!0}if(Fa(b)&&Fa(c)){if(d.K(b)===c)return!0;d.add(b,c);for(var f in b){var g=b[f];if(!gr(f,g)){var h=c[f];if(void 0===h||!ir(a,g,h,d))return!1}}for(e in c)if(f=c[e],!gr(e,f)&&(g=b[e],void 0===g||!ir(a,g,f,d)))return!1; return!0}return!1}function jr(a,b,c){a[c]!==b[c]&&v("Model.computeJsonDifference: Model."+c+' is not the same in both models: "'+a[c]+'" and "'+b[c]+'"')} t.hr=function(a){jr(this,a,"nodeKeyProperty");for(var b=new I,c=new I,d=(new I).addAll(this.Za.iteratorKeys),e=new Db,f=a.nodeDataArray,g=f.length,h=0;h<g;h++){var k=f[h],l=a.pa(k);if(void 0!==l){d.remove(l);var m=this.Pb(l);null===m?(b.add(l),c.add(k)):ir(this,m,k,e)||c.add(k)}else this.Qt(k),l=this.pa(k),b.add(l),c.add(k)}f="";ir(this,this.modelData,a.modelData,e)||(f+=dr(this));0<b.count&&(f+=this.lu+hr(this,b.ua(),!0));0<c.count&&(f+=this.$w+hr(this,c.ua(),!0));0<d.count&&(f+=this.nu+hr(this, d.ua(),!0));return f};t.nz=function(a,b){w(a,W,W,"computeJsonDifference:newmodel");void 0===b&&(b=kr(this,this));return'{ "class": '+this.quote(b)+', "incremental": 1'+this.Mk()+this.hr(a)+"}"}; function ar(a,b){function c(a,b){b=b.part.data;if(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.$h;null===d&&(d=new Db,b.changes.each(function(a){if(null!==a.diagram){var b=a.change;if(b===He)(a=a.object.panel)&&(b=a.data)&&c(b,a);else if(b===Je||b===Ke)a=a.object,(b=a.itemArray)&&c(b,a)}}),a.$h=d)}function br(a,b){for(var c=new I,d=0;d<a.nodeDataArray.length;d++){var e=a.nodeDataArray[d];lr(a,b,e,e,c)}return c} function lr(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(lr(a,b,g,d,e))return!0}else if(Fa(c)&&Object.getPrototypeOf(c)===Object.prototype)for(f in c){g=c[f];if(g===b)return e.add(d),!0;if(lr(a,b,g,d,e))return!0}return!1} t.Ow=function(a,b){var c=this,d=!1,e=new I,f=new I,g=new I,h=this.$h;a.changes.each(function(a){a.model===c&&("nodeDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):c.eb(a.object)?f.add(a.object):a.change!==He||c.modelData!==a.object&&"modelData"!==a.propertyName?null!==a.object&&(h&&h.contains(a.object)?h.get(a.object).each(function(a){c.eb(a)&&f.add(a)}):br(c,a.object).each(function(a){f.add(a)})):d=!0)});var k=new I;e.each(function(a){k.add(c.pa(a));b|| f.add(a)});var l=new I;g.each(function(a){l.add(c.pa(a));b&&f.add(a)});a="";d&&(a+=dr(this));0<k.count&&(a+=(b?this.nu:this.lu)+hr(this,k.ua(),!0));0<f.count&&(a+=this.$w+hr(this,f.ua(),!0));0<l.count&&(a+=(b?this.lu:this.nu)+hr(this,l.ua(),!0));return a}; t.Uq=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");fr(this,a);var b=a.insertedNodeKeys,c=a.modifiedNodeData,d=new Db;if(Array.isArray(c))for(var e=0;e<c.length;e++){var f=c[e],g=this.pa(f);void 0!==g&&null!==g&&d.set(g,f)}if(Array.isArray(b))for(e=b.length,f=0;f<e;f++){g=b[f];var h=this.Pb(g);null===h&&(h=(h=d.get(g))?h:this.copyNodeData({}),this.Wm(h,g),this.Bf(h))}if(Array.isArray(c))for(b=c.length,d=0;d<b;d++)if(e=c[d],f=this.pa(e),f=this.Pb(f),null!==f)for(var k in e)"__gohashid"===k||k=== this.nodeKeyProperty||this.wk()&&k===this.nodeIsGroupProperty||this.setDataProperty(f,k,e[k]);a=a.removedNodeKeys;if(Array.isArray(a))for(c=a.length,k=0;k<c;k++)b=this.Pb(a[k]),null!==b&&this.Pm(b)}; t.Ly=function(a,b){w(a,Ge,W,"toIncrementalJson:e");a.change!==Ie&&v("Model.toIncrementalJson argument is not a Transaction ChangedEvent:"+a.toString());var c=a.object;if(!(a.isTransactionFinished&&c instanceof Le))return'{ "incremental": 0 }';void 0===b&&(b=kr(this,this));ar(this,c);a=this.Ow(c,"FinishedUndo"===a.propertyName);this.$h=null;return"2"===b?'{ "incremental": 2'+a+"}":'{ "class": '+this.quote(b)+', "incremental": 1'+this.Mk()+a+"}"};t.XA=function(a,b){return this.Ly(a,b)}; t.cr=function(a){void 0===a&&(a=kr(this,this));return'{ "class": '+this.quote(a)+this.Mk()+this.Qw()+"}"};t.toJSON=function(a){return this.cr(a)};t.Px=function(a){var b=null;if("string"===typeof a)try{b=qa.JSON.parse(a)}catch(d){F&&Ca("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.Ba("applyIncrementalJson"),this.Uq(b),this.$a("applyIncrementalJson"))}; t.gz=function(a){return this.Px(a)};W.constructGraphLinksModel=function(){F&&v("Unable to construct a Model. Provided JSON requires GraphLinksModel, which is not loaded.");return new W};t=W.prototype; t.Qm=function(a){if(Ga(a))for(var b=a.length,c=0;c<b;c++){var d=a[c];if(Fa(d)){var e=c;d=this.Qm(d);Array.isArray(a)?a[e]=d:v("Cannot replace an object in an HTMLCollection or NodeList at "+e)}}else if(Fa(a)){for(c in a)if(e=a[c],Fa(e)&&(e=this.Qm(e),a[c]=e,"points"===c&&Array.isArray(e))){d=0===e.length%2;for(var f=0;f<e.length;f++)if("number"!==typeof e[f]){d=!1;break}if(d){d=new H;for(f=0;f<e.length/2;f++)d.add(new J(e[2*f],e[2*f+1]));d.freeze();a[c]=d}}if("object"===typeof a){c=a;e=a["class"]|| "";0===e.indexOf("go.")&&(e=e.substr(3));if("NaN"===e)c=NaN;else if("Date"===e)c=new Date(a.value);else if("Point"===e)c=new J(mr(a.x),mr(a.y));else if("Size"===e)c=new Hb(mr(a.width),mr(a.height));else if("Rect"===e)c=new L(mr(a.x),mr(a.y),mr(a.width),mr(a.height));else if("Margin"===e)c=new lc(mr(a.top),mr(a.right),mr(a.bottom),mr(a.left));else if("Spot"===e)"string"===typeof a["enum"]?c=zd(a["enum"]):c=new M(mr(a.x),mr(a.y),mr(a.offsetX),mr(a.offsetY));else if("Brush"===e){if(c=new Kl,c.type=gb(Kl, a.type),"string"===typeof a.color&&(c.color=a.color),a.start instanceof M&&(c.start=a.start),a.end instanceof M&&(c.end=a.end),"number"===typeof a.startRadius&&(c.startRadius=mr(a.startRadius)),"number"===typeof a.endRadius&&(c.endRadius=mr(a.endRadius)),a=a.colorStops,Fa(a))for(b in a)c.addColorStop(parseFloat(b),a[b])}else"Geometry"===e?(b=null,"string"===typeof a.path?b=Vd(a.path):b=new Fd,b.type=gb(Fd,a.type),"number"===typeof a.startX&&(b.startX=mr(a.startX)),"number"===typeof a.startY&&(b.startY= mr(a.startY)),"number"===typeof a.endX&&(b.endX=mr(a.endX)),"number"===typeof a.endY&&(b.endY=mr(a.endY)),a.spot1 instanceof M&&(b.spot1=a.spot1),a.spot2 instanceof M&&(b.spot2=a.spot2),c=b):"EnumValue"===e&&(b=a.classType,0===b.indexOf("go.")&&(b=b.substr(3)),b=nr(b),"function"===typeof b&&(c=gb(b,a.name)));a=c}}return a}; t.quote=function(a){for(var b="",c=a.length,d=0;d<c;d++){var e=a[d];if('"'===e||"\\"===e)b+="\\"+e;else if("\b"===e)b+="\\b";else if("\f"===e)b+="\\f";else if("\n"===e)b+="\\n";else if("\r"===e)b+="\\r";else if("\t"===e)b+="\\t";else{var f=a.charCodeAt(d);b=16>f?b+("\\u000"+a.charCodeAt(d).toString(16)):32>f?b+("\\u00"+a.charCodeAt(d).toString(16)):8232===f?b+"\\u2028":8233===f?b+"\\u2029":b+e}}return'"'+b+'"'}; t.Zm=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.Zm(a.valueOf()):Ga(a)?hr(this,a):Fa(a)?er(this,a):"function"===typeof a?"null":a.toString()}; function hr(a,b,c){void 0===c&&(c=!1);var d=b.length;if(0>=d)return"[]";var e=new ib;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.Zm(g)))}c&&1<d&&e.add("\n");e.add(" ]");return e.toString()}function gr(a,b){return void 0===b||"__gohashid"===a||"_"===a[0]||"function"===typeof b?!0:!1}function or(a){return isNaN(a)?"NaN":Infinity===a?"9e9999":-Infinity===a?"-9e9999":a} function er(a,b){var c=b;if(c instanceof J)b={"class":"go.Point",x:or(c.x),y:or(c.y)};else if(c instanceof Hb)b={"class":"go.Size",width:or(c.width),height:or(c.height)};else if(c instanceof L)b={"class":"go.Rect",x:or(c.x),y:or(c.y),width:or(c.width),height:or(c.height)};else if(c instanceof lc)b={"class":"go.Margin",top:or(c.top),right:or(c.right),bottom:or(c.bottom),left:or(c.left)};else if(c instanceof M)c.ab()?b={"class":"go.Spot",x:or(c.x),y:or(c.y),offsetX:or(c.offsetX),offsetY:or(c.offsetY)}: b={"class":"go.Spot","enum":c.toString()};else if(c instanceof Kl){b={"class":"go.Brush",type:c.type.name};if(c.type===Nl)b.color=c.color;else if(c.type===Ql||c.type===Ll)b.start=c.start,b.end=c.end,c.type===Ll&&(0!==c.startRadius&&(b.startRadius=or(c.startRadius)),isNaN(c.endRadius)||(b.endRadius=or(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 Fd)b={"class":"go.Geometry",type:c.type.name},0!==c.startX&& (b.startX=or(c.startX)),0!==c.startY&&(b.startY=or(c.startY)),0!==c.endX&&(b.endX=or(c.endX)),0!==c.endY&&(b.endY=or(c.endY)),c.spot1.A(Hc)||(b.spot1=c.spot1),c.spot2.A(Sc)||(b.spot2=c.spot2),c.type===Gd&&(b.path=Ld(c));else if(c instanceof E)b={"class":"go.EnumValue",classType:kr(a,c.classType),name:c.name};else if(F&&null!==nr(kr(a,c)))return Ca("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=Tn(b,e);if(!gr(e,f))if(c?c=!1:d+=", ",d+='"'+e+'":',"points"===e&&f instanceof H){var g="[";for(f=f.iterator;f.next();){var h=f.value;1<g.length&&(g+=",");g+=a.Zm(h.x);g+=",";g+=a.Zm(h.y)}g+="]";d+=g}else d+=a.Zm(f)}return d+"}"}function mr(a){return"number"===typeof a?a:"NaN"===a?NaN:"9e9999"===a?Infinity:"-9e9999"===a?-Infinity:parseFloat(a)}t.Lh=function(a){A(a,"function",W,"addChangedListener:listener");this.Vu.add(a)}; t.Ik=function(a){A(a,"function",W,"removeChangedListener:listener");this.Vu.remove(a)};t.st=function(a){this.skipsUndoManager||this.undoManager.Wv(a);for(var b=this.Vu,c=b.length,d=0;d<c;d++)b.O(d)(a)};t.gb=function(a,b,c,d,e,f,g){pr(this,"",a,b,c,d,e,f,g)};t.g=function(a,b,c,d,e){pr(this,"",He,a,this,b,c,d,e)};t.Wt=function(a,b,c,d,e,f){pr(this,"",He,b,a,c,d,e,f)}; function pr(a,b,c,d,e,f,g,h,k){void 0===h&&(h=null);void 0===k&&(k=null);var l=new Ge;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.st(l)} W.prototype.changeState=function(a,b){if(null!==a&&a.model===this)if(a.change===He){var c=a.object,d=a.propertyName,e=a.K(b);d===this.nodeKeyProperty&&this.eb(c)&&(b=a.K(!b),void 0!==b&&this.Za.remove(b),void 0!==e&&this.Za.add(e,c));hk(c,d,e)}else a.change===Je?(c=a.newParam,"nodeDataArray"===a.modelChange?(a=a.newValue,Fa(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.uc[c]===a&&Ka(this.uc,c),void 0!==d&&this.Za.remove(d)):(this.uc[c]!==a&&Ja(this.uc,c,a),void 0!==d&&this.Za.add(d,a)))):""===a.modelChange? ((d=a.object)&&!Ga(d)&&a.propertyName&&(d=Tn(a.object,a.propertyName)),Ga(d)&&"number"===typeof c&&(a=a.newValue,b?Ka(d,c):Ja(d,c,a))):v("unknown ChangedEvent.Insert modelChange: "+a.toString())):a.change===Ke?(c=a.oldParam,"nodeDataArray"===a.modelChange?(a=a.oldValue,Fa(a)&&"number"===typeof c&&(d=this.pa(a),b?(this.uc[c]!==a&&Ja(this.uc,c,a),void 0!==d&&this.Za.add(d,a)):(this.uc[c]===a&&Ka(this.uc,c),void 0!==d&&this.Za.remove(d)))):""===a.modelChange?((d=a.object)&&!Ga(d)&&a.propertyName&&(d= Tn(a.object,a.propertyName)),Ga(d)&&"number"===typeof c&&(a=a.oldValue,b?Ja(d,c,a):Ka(d,c))):v("unknown ChangedEvent.Remove modelChange: "+a.toString())):a.change!==Ie&&v("unknown ChangedEvent: "+a.toString())};W.prototype.Ba=function(a){return this.undoManager.Ba(a)};W.prototype.$a=function(a){return this.undoManager.$a(a)};W.prototype.Mf=function(){return this.undoManager.Mf()}; W.prototype.commit=function(a,b){void 0===b&&(b="");var c=this.skipsUndoManager;null===b&&(this.skipsUndoManager=!0,b="");this.undoManager.Ba(b);var d=!1;try{a(this),d=!0}finally{d?this.undoManager.$a(b):this.undoManager.Mf(),this.skipsUndoManager=c}};t=W.prototype;t.Ga=function(a,b){void 0===b&&(b="");pr(this,"SourceChanged",Ie,b,a,null,null)};function qr(a,b,c){"string"!==typeof a&&"function"!==typeof a&&xa(a,"string or function",b,c)} t.pa=function(a){if(null!==a){var b=this.Li;if(""!==b&&(b=Tn(a,b),void 0!==b)){if(Rq(b))return b;v("Key value for node data "+a+" is not a number or a string: "+b)}}}; t.Wm=function(a,b){void 0!==b&&null!==b&&Rq(b)||xa(b,"number or string",W,"setKeyForNodeData:key");if(null!==a){var c=this.Li;if(""!==c)if(this.eb(a)){var d=Tn(a,c);d!==b&&null===this.Pb(b)&&(hk(a,c,b),void 0!==d&&this.Za.remove(d),this.Za.add(b,a),pr(this,"nodeKey",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c),this.Yq(d,b))}else hk(a,c,b)}};function Rq(a){return"number"===typeof a||"string"===typeof a}t.eb=function(a){var b=this.pa(a);return void 0===b?!1:this.Za.K(b)===a}; t.Pb=function(a){null===a&&v("Model.findNodeDataForKey:key must not be null");return void 0!==a&&Rq(a)?this.Za.K(a):null}; t.Qt=function(a){if(null!==a){var b=this.Li;if(""!==b){var c=this.pa(a);if(void 0===c||this.Za.contains(c)){var d=this.Jl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.Za.contains(c))){hk(a,b,c);return}if("string"===typeof c){for(d=2;this.Za.contains(c+d);)d++;hk(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.Za.count-1;this.Za.contains(c);)c--;hk(a,b,c)}else F&&v("Model.getKeyForNodeData returned something other than a string or a number: "+c)}}}}; t.Bf=function(a){null!==a&&(ub(a),this.eb(a)||Jq(this,a,!0))};function Jq(a,b,c){var d=a.pa(b);if(void 0===d||a.Za.K(d)!==b)a.Qt(b),d=a.pa(b),void 0===d?v("Model.makeNodeDataKeyUnique failed on "+b+". Data not added to Model."):(a.Za.add(d,b),d=null,c&&(d=a.uc.length,Ja(a.uc,d,b)),pr(a,"nodeDataArray",Je,"nodeDataArray",a,null,b,null,d),a.Sm(b),a.Rm(b))}t.cz=function(a){if(Ga(a))for(var b=a.length,c=0;c<b;c++)this.Bf(a[c]);else for(a=a.iterator;a.next();)this.Bf(a.value)}; t.Pm=function(a){null!==a&&Iq(this,a,!0)};function Iq(a,b,c){var d=a.pa(b);void 0!==d&&a.Za.remove(d);d=null;if(c){a:if(c=a.uc,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;Ka(a.uc,d)}pr(a,"nodeDataArray",Ke,"nodeDataArray",a,b,null,d,null);a.er(b)}t.MA=function(a){if(Ga(a))for(var b=a.length,c=0;c<b;c++)this.Pm(a[c]);else for(a=a.iterator;a.next();)this.Pm(a.value)}; t.CA=function(a){if(Ga(a)){for(var b=new I(this.Za.iteratorKeys),c=new I,d=a.length,e=0;e<d;e++){var f=a[e],g=this.pa(f);if(void 0!==g){c.add(g);var h=this.Pb(g);null!==h?this.ik(h,f):(h={},this.Wm(h,g),this.ik(h,f),this.Bf(h))}else this.Bf(f),c.add(this.pa(f))}for(a=b.iterator;a.next();)b=a.value,c.contains(b)||(b=this.Pb(b))&&this.Pm(b);this.wq()}};t.Yq=function(a,b){void 0!==b&&(a=Uq(this,a),a instanceof I&&this.$f.add(b,a))};t.Kw=function(){};t.Sm=function(){};t.Rm=function(){};t.er=function(){}; function Wq(a,b,c){if(void 0!==b){var d=a.$f.K(b);null===d&&(d=new I,a.$f.add(b,d));d.add(c)}}function Vq(a,b,c){if(void 0!==b){var d=a.$f.K(b);d instanceof I&&(void 0===c||null===c?a.$f.remove(b):(d.remove(c),0===d.count&&a.$f.remove(b)))}}function Uq(a,b){if(void 0===b)return null;a=a.$f.K(b);return a instanceof I?a:null}t.wq=function(a){void 0===a?this.$f.clear():this.$f.remove(a)}; W.prototype.copyNodeData=function(a){if(null===a)return null;var b=this.al;a=null!==b?b(a,this):rr(this,a,!0);Fa(a)&&fb(a);return a}; function rr(a,b,c){if(a.copiesArrays&&Array.isArray(b)){var d=[];for(c=0;c<b.length;c++){var e=rr(a,b[c],a.copiesArrayObjects);d.push(e)}fb(d);return d}if(c&&Fa(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=Tn(b,d);var g=kr(a,f);"GraphObject"===g||"Diagram"===g||"Layer"===g||"RowColumnDefinition"===g||"AnimationManager"===g||"Tool"===g||"CommandHandler"=== g||"Layout"===g||"InputEvent"===g||"DiagramEvent"===g?(F&&"_"!==d[0]&&Ca('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 W||f instanceof Me||f instanceof Le||f instanceof Ge?!0:!1;g?hk(c,d,f):(f=rr(a,f,!1),hk(c,d,f))}fb(c);return c}return b instanceof J?b.copy():b instanceof Hb?b.copy():b instanceof L?b.copy():b instanceof M?b.copy():b instanceof lc?b.copy():b} W.prototype.setDataProperty=function(a,b,c){F&&(A(a,"object",W,"setDataProperty:data"),A(b,"string",W,"setDataProperty:propname"),""===b&&v("Model.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.eb(a))if(b===this.nodeKeyProperty)this.Wm(a,c);else{if(b===this.nodeCategoryProperty){this.$q(a,c);return}}else!sr&&a instanceof N&&(sr=!0,Ca('Model.setDataProperty is modifying a GraphObject, "'+a.toString()+'"'),Ca(" Is that really your intent?"));var d=Tn(a, b);d!==c&&(hk(a,b,c),this.Wt(a,b,d,c))};t=W.prototype;t.set=function(a,b,c){this.setDataProperty(a,b,c)};t.ik=function(a,b){if(b){var c=this.eb(a),d;for(d in b)"__gohashid"===d||c&&d===this.nodeKeyProperty||this.setDataProperty(a,d,b[d])}};t.Zy=function(a,b){this.Ht(a,-1,b)}; t.Ht=function(a,b,c){F&&(Ha(a,W,"insertArrayItem:arr"),C(b,W,"insertArrayItem:idx"),a===this.uc&&v("Model.insertArrayItem or Model.addArrayItem should not be called on the Model.nodeDataArray"));0>b&&(b=a.length);Ja(a,b,c);pr(this,"",Je,"",a,null,c,null,b)}; t.nw=function(a,b){void 0===b&&(b=-1);F&&(Ha(a,W,"removeArrayItem:arr"),C(b,W,"removeArrayItem:idx"));a===this.uc&&v("Model.removeArrayItem should not be called on the Model.nodeDataArray");-1===b&&(b=a.length-1);var c=a[b];Ka(a,b);pr(this,"",Ke,"",a,c,null,b,null)};t.Et=function(a){if(null===a)return"";var b=this.Sj;if(""===b)return"";b=Tn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getCategoryForNodeData found a non-string category for "+a+": "+b);return""}; t.$q=function(a,b){A(b,"string",W,"setCategoryForNodeData:cat");if(null!==a){var c=this.Sj;if(""!==c)if(this.eb(a)){var d=Tn(a,c);void 0===d&&(d="");d!==b&&(hk(a,c,b),pr(this,"nodeCategory",He,c,a,d,b))}else hk(a,c,b)}};t.Em=function(){return!1};t.wk=function(){return!1};t.Dm=function(){return!1};t.Nt=function(){return!1};t.mj=function(){return!1};function Li(){return new W} function kr(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 kr(a,b.constructor);return typeof b}function nr(a){return tr[a]?tr[a]:void 0!==qa.go&&qa.go[a]?qa.go[a]:null}function Tn(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){F&&Ca("property get error: "+d.toString())}return c} function hk(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){F&&Ca("property set error: "+d.toString())}} ma.Object.defineProperties(W.prototype,{name:{configurable:!0,get:function(){return this.Wa},set:function(a){var b=this.Wa;b!==a&&(A(a,"string",W,"name"),this.Wa=a,this.g("name",b,a))}},dataFormat:{configurable:!0,get:function(){return this.In},set:function(a){var b=this.In;b!==a&&(A(a,"string",W,"dataFormat"),this.In=a,this.g("dataFormat",b,a))}},isReadOnly:{configurable:!0,get:function(){return this.hg},set:function(a){var b=this.hg;b!==a&&(A(a,"boolean", W,"isReadOnly"),this.hg=a,this.g("isReadOnly",b,a))}},modelData:{configurable:!0,get:function(){return this.l},set:function(a){var b=this.l;b!==a&&(A(a,"object",W,"modelData"),this.l=a,this.g("modelData",b,a),this.Ga(a))}},undoManager:{configurable:!0,get:function(){return this.w},set:function(a){var b=this.w;b!==a&&(w(a,Me,W,"undoManager"),null!==b&&b.zy(this),this.w=a,null!==a&&a.Nx(this))}},skipsUndoManager:{configurable:!0,get:function(){return this.Bg}, set:function(a){A(a,"boolean",W,"skipsUndoManager");this.Bg=a}},nodeKeyProperty:{configurable:!0,get:function(){return this.Li},set:function(a){var b=this.Li;b!==a&&(qr(a,W,"nodeKeyProperty"),""===a&&v("Model.nodeKeyProperty may not be the empty string"),0<this.Za.count&&v("Cannot set Model.nodeKeyProperty when there is existing node data"),this.Li=a,this.g("nodeKeyProperty",b,a))}},makeUniqueKeyFunction:{configurable:!0,get:function(){return this.Jl},set:function(a){var b= this.Jl;b!==a&&(null!==a&&A(a,"function",W,"makeUniqueKeyFunction"),this.Jl=a,this.g("makeUniqueKeyFunction",b,a))}},nodeDataArray:{configurable:!0,get:function(){return this.uc},set:function(a){var b=this.uc;if(b!==a){Ha(a,W,"nodeDataArray");this.Za.clear();this.Kw();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Fa(e)){v("Model.nodeDataArray must only contain Objects, not: "+e);return}ub(e)}this.uc=a;d=new H;for(e=0;e<c;e++){var f=a[e],g=this.pa(f);void 0===g?d.add(f):null!==this.Za.K(g)? d.add(f):this.Za.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Qt(e),f=this.pa(e),void 0!==f&&this.Za.add(f,e);pr(this,"nodeDataArray",He,"nodeDataArray",this,b,a);for(b=0;b<c;b++)d=a[b],this.Sm(d),this.Rm(d);this.wq();Array.isArray(a)||(this.isReadOnly=!0)}}},copyNodeDataFunction:{configurable:!0,get:function(){return this.al},set:function(a){var b=this.al;b!==a&&(null!==a&&A(a,"function",W,"copyNodeDataFunction"),this.al=a,this.g("copyNodeDataFunction",b,a))}},copiesArrays:{configurable:!0, enumerable:!0,get:function(){return this.An},set:function(a){var b=this.An;b!==a&&(null!==a&&A(a,"boolean",W,"copiesArrays"),this.An=a,this.g("copiesArrays",b,a))}},copiesArrayObjects:{configurable:!0,get:function(){return this.zn},set:function(a){var b=this.zn;b!==a&&(null!==a&&A(a,"boolean",W,"copiesArrayObjects"),this.zn=a,this.g("copiesArrayObjects",b,a))}},copiesKey:{configurable:!0,get:function(){return this.Cn},set:function(a){var b=this.Cn;b!==a&&(null!==a&&A(a, "boolean",W,"copiesKey"),this.Cn=a,this.g("copiesKey",b,a))}},afterCopyFunction:{configurable:!0,get:function(){return this.gn},set:function(a){var b=this.gn;b!==a&&(null!==a&&A(a,"function",W,"afterCopyFunction"),this.gn=a,this.g("afterCopyFunction",b,a))}},nodeCategoryProperty:{configurable:!0,get:function(){return this.Sj},set:function(a){var b=this.Sj;b!==a&&(qr(a,W,"nodeCategoryProperty"),this.Sj=a,this.g("nodeCategoryProperty",b,a))}}}); ma.Object.defineProperties(W,{type:{configurable:!0,get:function(){return"Model"}}});W.prototype.setCategoryForNodeData=W.prototype.$q;W.prototype.getCategoryForNodeData=W.prototype.Et;W.prototype.removeArrayItem=W.prototype.nw;W.prototype.insertArrayItem=W.prototype.Ht;W.prototype.addArrayItem=W.prototype.Zy;W.prototype.assignAllDataProperties=W.prototype.ik;W.prototype.set=W.prototype.set;W.prototype.clearUnresolvedReferences=W.prototype.wq;W.prototype.mergeNodeDataArray=W.prototype.CA; W.prototype.removeNodeDataCollection=W.prototype.MA;W.prototype.removeNodeData=W.prototype.Pm;W.prototype.addNodeDataCollection=W.prototype.cz;W.prototype.addNodeData=W.prototype.Bf;W.prototype.makeNodeDataKeyUnique=W.prototype.Qt;W.prototype.findNodeDataForKey=W.prototype.Pb;W.prototype.containsNodeData=W.prototype.eb;W.prototype.setKeyForNodeData=W.prototype.Wm;W.prototype.getKeyForNodeData=W.prototype.pa;W.prototype.updateTargetBindings=W.prototype.Ga;W.prototype.commit=W.prototype.commit; W.prototype.rollbackTransaction=W.prototype.Mf;W.prototype.commitTransaction=W.prototype.$a;W.prototype.startTransaction=W.prototype.Ba;W.prototype.raiseDataChanged=W.prototype.Wt;W.prototype.raiseChanged=W.prototype.g;W.prototype.raiseChangedEvent=W.prototype.gb;W.prototype.removeChangedListener=W.prototype.Ik;W.prototype.addChangedListener=W.prototype.Lh;W.prototype.writeJsonValue=W.prototype.Zm;W.prototype.replaceJsonObjects=W.prototype.Qm;W.prototype.applyIncrementalJSON=W.prototype.gz; W.prototype.applyIncrementalJson=W.prototype.Px;W.prototype.toJSON=W.prototype.toJSON;W.prototype.toJson=W.prototype.cr;W.prototype.toIncrementalJSON=W.prototype.XA;W.prototype.toIncrementalJson=W.prototype.Ly;W.prototype.computeJsonDifference=W.prototype.nz;W.prototype.toIncrementalData=W.prototype.WA;W.prototype.clear=W.prototype.clear;var sr=!1,tr={};W.className="Model"; W.fromJSON=W.fromJson=function(a,b){void 0===b&&(b=null);null!==b&&w(b,W,W,"fromJson:model");var c=null;if("string"===typeof a)try{c=qa.JSON.parse(a)}catch(f){F&&Ca("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=nr(d)):(e=nr(d),null===e&&(e=qa[d]));"function"===typeof e&&(a=new e)}catch(f){}null===a||a instanceof W?b=a:v("Unable to construct a Model of declared class: "+ c["class"])}null===b&&(b=W.constructGraphLinksModel());b.Vq(c);b.lw(c);return b};W.safePropertyValue=Tn;W.safePropertySet=hk;tr.Brush=Kl;tr.ChangedEvent=Ge;tr.Geometry=Fd;tr.Margin=lc;tr.Panel=U;tr.Point=J;tr.Rect=L;tr.Size=Hb;tr.Spot=M;tr.Transaction=Le;tr.UndoManager=Me; function $i(a,b,c){fb(this);this.s=!1;void 0===a?a="":A(a,"string",$i,"constructor:targetprop");void 0===b?b=a:A(b,"string",$i,"constructor:sourceprop");void 0===c?c=null:null!==c&&A(c,"function",$i,"constructor:conv");this.l=-1;this.jd=null;this.im=a;this.hm=this.gq=0;this.ct=null;this.vo=!1;this.am=b;this.yn=c;this.Uo=ur;this.sn=null;this.Gu=new I} $i.prototype.copy=function(){var a=new $i;a.im=this.im;a.gq=this.gq;a.hm=this.hm;a.ct=this.ct;a.vo=this.vo;a.am=this.am;a.yn=this.yn;a.Uo=this.Uo;a.sn=this.sn;return a};t=$i.prototype;t.mb=function(a){a.classType===$i?this.mode=a:Ba(this,a)};t.toString=function(){return"Binding("+this.targetProperty+":"+this.sourceProperty+(-1!==this.sj?" "+this.sj:"")+" "+this.mode.name+")"};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this}; t.sy=function(a){void 0===a&&(a=null);null!==a&&A(a,"function",$i,"makeTwoWay");this.mode=Bn;this.backConverter=a;return this};t.Rq=function(a){void 0===a&&(a="");F&&A(a,"string",$i,"ofObject:srcname");this.sourceName=a;this.isToModel=!1;return this};t.EA=function(){this.sourceName=null;this.isToModel=!0;return this};function xl(a,b,c){a=a.sourceName;return null===a||""===a?b:"/"===a?c.part:"."===a?c:".."===a?c.panel:b.fb(a)} t.Lw=function(a,b,c){var d=this.am;if(void 0===c||""===d||d===c){c=this.im;var e=this.yn;if(null===e&&""===c)Ca("Binding error: target property is the empty string: "+this.toString());else{F&&"string"===typeof c&&("function"!==typeof a.setAttribute&&0<c.length&&"_"!==c[0]&&!Ra(a,c)?Ca("Binding error: undefined target property: "+c+" on "+a.toString()):"name"===c&&a instanceof N&&Ca("Binding error: cannot modify GraphObject.name on "+a.toString()));var f=b;""!==d&&(f=Tn(b,d));if(void 0!==f)if(null=== e)""!==c&&hk(a,c,f);else try{if(""!==c){var g=e(f,a);F&&void 0===g&&Ca('Binding warning: conversion function returned undefined when setting target property "'+c+'" on '+a.toString()+", function is: "+e);hk(a,c,g)}else e(f,a)}catch(h){F&&Ca("Binding error: "+h.toString()+' setting target property "'+c+'" on '+a.toString()+" with conversion function: "+e)}}}}; t.gr=function(a,b,c,d){if(this.Uo===Bn){var e=this.im;if(void 0===c||e===c){c=this.am;var f=this.sn,g=a;""!==e&&(g=Tn(a,e));if(void 0!==g&&!this.Gu.contains(a))try{this.Gu.add(a);var h=null!==d?d.diagram:null,k=null!==h?h.model:null;if(null===f)if(""!==c)null!==k?(F&&k.nodeKeyProperty===c&&k.eb(b)&&Ca("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),k.setDataProperty(b,c,g)):hk(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.nw(m,l);k.Ht(m,l,g)}}else try{if(""!==c){var n=f(g,b,k);null!==k?(F&&(k.nodeKeyProperty===c&&k.eb(b)&&Ca("Binding error: cannot have TwoWay Binding on node data key property: "+this.toString()),void 0===n&&Ca('Binding warning: conversion function returned undefined when setting source property "'+c+'" on '+b.toString()+", function is: "+f)),k.setDataProperty(b,c,n)):hk(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.nw(q,r);k.Ht(q,r,p)}}}catch(u){F&&Ca("Binding error: "+u.toString()+' setting source property "'+c+'" on '+b.toString()+" with conversion function: "+f)}}finally{this.Gu.remove(a)}}}}; ma.Object.defineProperties($i.prototype,{sj:{configurable:!0,get:function(){return this.l},set:function(a){this.s&&va(this);A(a,"number",$i,"targetId");this.l=a}},targetProperty:{configurable:!0,get:function(){return this.im},set:function(a){this.s&&va(this);A(a,"string",$i,"targetProperty");this.im=a}},sourceName:{configurable:!0,get:function(){return this.ct},set:function(a){this.s&&va(this);null!==a&&A(a,"string",$i,"sourceName");this.ct=a;null!==a&&(this.vo= !1)}},isToModel:{configurable:!0,get:function(){return this.vo},set:function(a){this.s&&va(this);A(a,"boolean",$i,"isToModel");this.vo=a}},sourceProperty:{configurable:!0,get:function(){return this.am},set:function(a){this.s&&va(this);A(a,"string",$i,"sourceProperty");this.am=a}},converter:{configurable:!0,get:function(){return this.yn},set:function(a){this.s&&va(this);null!==a&&A(a,"function",$i,"converter");this.yn=a}},backConverter:{configurable:!0, get:function(){return this.sn},set:function(a){this.s&&va(this);null!==a&&A(a,"function",$i,"backConverter");this.sn=a}},mode:{configurable:!0,get:function(){return this.Uo},set:function(a){this.s&&va(this);hb(a,$i,$i,"mode");this.Uo=a}}});$i.prototype.updateSource=$i.prototype.gr;$i.prototype.updateTarget=$i.prototype.Lw;$i.prototype.ofModel=$i.prototype.EA;$i.prototype.ofObject=$i.prototype.Rq;$i.prototype.makeTwoWay=$i.prototype.sy; var ur=new E($i,"OneWay",1),Bn=new E($i,"TwoWay",2);$i.className="Binding";$i.parseEnum=function(a,b){A(a,"function",$i,"parseEnum:ctor");hb(b,a,$i,"parseEnum:defval");return function(c){c=gb(a,c);return null===c?b:c}};$i.toString=Qa;$i.OneWay=ur;$i.TwoWay=Bn; function vr(a,b){W.call(this);this.ku=',\n "insertedLinkKeys": ';this.Zw=',\n "modifiedLinkData": ';this.mu=',\n "removedLinkKeys": ';F&&2<arguments.length&&v("GraphLinksModel constructor can only take two optional arguments, the Array of node data and the Array of link data.");this.Vc=[];this.ig=new I;this.kb=new Db;this.Hi="";this.uj=this.$k=this.Kl=null;this.gf="from";this.hf="to";this.Pj=this.Oj="";this.Nj="category";this.Td="";this.Ol="isGroup";this.Ee="group";this.Bn=!1;void 0!==a&&(this.nodeDataArray= a);void 0!==b&&(this.linkDataArray=b)}la(vr,W);vr.constructGraphLinksModel=W.constructGraphLinksModel;vr.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);a.Hi=this.Hi;a.Kl=this.Kl;a.$k=this.$k;a.gf=this.gf;a.hf=this.hf;a.Oj=this.Oj;a.Pj=this.Pj;a.Nj=this.Nj;a.Td=this.Td;a.Ol=this.Ol;a.Ee=this.Ee;a.Bn=this.Bn};t=vr.prototype;t.clear=function(){W.prototype.clear.call(this);this.Vc=[];this.kb.clear();this.ig.clear()}; t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.cr();var b=(""!==this.name?this.name:"")+" GraphLinksModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;var c=a.length,d;for(d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}b+="\n link data:";a=this.linkDataArray;c=a.length;for(d=0;d<c;d++)e=a[d],b+=" "+Pq(this,e,!0)+"--\x3e"+Pq(this,e,!1)}return b}; t.Pw=function(a,b){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalData() to succeed.");var c=W.prototype.Pw.call(this,a,b),d=this,e=new I,f=new I,g=new I,h=this.$h;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):d.ad(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.ad(a)&&f.add(a)}): wr(d,a.object).each(function(a){f.add(a)})))});var k=new I;e.each(function(a){k.add(d.ac(a));b||f.add(a)});var l=new I;g.each(function(a){l.add(d.ac(a));b&&f.add(a)});a=d.cloneDeep(f.ua());0<k.count&&(null===c&&(c={}),b?c.removedLinkKeys=k.ua():c.insertedLinkKeys=k.ua());0<a.length&&(null===c&&(c={}),c.modifiedLinkData=a);0<l.count&&(null===c&&(c={}),b?c.insertedLinkKeys=l.ua():c.removedLinkKeys=l.ua());return c}; t.Mk=function(){var a=W.prototype.Mk.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.Vq=function(a){W.prototype.Vq.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.Qw=function(){var a=W.prototype.Qw.call(this),b=',\n "linkDataArray": '+hr(this,this.linkDataArray,!0);return a+b};t.lw=function(a){W.prototype.lw.call(this,a);a=a.linkDataArray;Array.isArray(a)&&(this.Qm(a),this.linkDataArray=a)}; t.hr=function(a){if(!(a instanceof vr))return v("Model.computeJsonDifference: newmodel must be a GraphLinksModel"),"";""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .computeJsonDifference() to succeed.");var b=W.prototype.hr.call(this,a);jr(this,a,"linkKeyProperty");jr(this,a,"linkFromKeyProperty");jr(this,a,"linkToKeyProperty");jr(this,a,"linkLabelKeysProperty");jr(this,a,"nodeIsGroupProperty");jr(this,a,"nodeGroupKeyProperty");for(var c=new I,d=new I, e=(new I).addAll(this.kb.iteratorKeys),f=new Db,g=a.linkDataArray,h=g.length,k=0;k<h;k++){var l=g[k],m=a.ac(l);if(void 0!==m){e.remove(m);var n=this.Ig(m);null===n?(c.add(m),d.add(l)):ir(this,n,l,f)||d.add(l)}else this.Oq(l),m=this.ac(l),c.add(m),d.add(l)}a=b;0<c.count&&(a+=this.ku+hr(this,c.ua(),!0));0<d.count&&(a+=this.Zw+hr(this,d.ua(),!0));0<e.count&&(a+=this.mu+hr(this,e.ua(),!0));return a}; function wr(a,b){for(var c=new I,d=0;d<a.linkDataArray.length;d++){var e=a.linkDataArray[d];lr(a,b,e,e,c)}return c} t.Ow=function(a,b){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .toIncrementalJson() to succeed.");var c=W.prototype.Ow.call(this,a,b),d=this,e=new I,f=new I,g=new I,h=this.$h;a.changes.each(function(a){a.model===d&&("linkDataArray"===a.modelChange?a.change===Je?e.add(a.newValue):a.change===Ke&&g.add(a.oldValue):d.ad(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.ad(a)&&f.add(a)}): wr(d,a.object).each(function(a){f.add(a)})))});var k=new I;e.each(function(a){k.add(d.ac(a));b||f.add(a)});var l=new I;g.each(function(a){l.add(d.ac(a));b&&f.add(a)});a=c;0<k.count&&(a+=(b?this.mu:this.ku)+hr(this,k.ua(),!0));0<f.count&&(a+=this.Zw+hr(this,f.ua(),!0));0<l.count&&(a+=(b?this.ku:this.mu)+hr(this,l.ua(),!0));return a}; t.Uq=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");W.prototype.Uq.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.Ig(e);null===f&&(f=this.xq({}),this.du(f,e),this.Yi(f))}b=a.modifiedLinkData; if(Array.isArray(b))for(c=b.length,d=0;d<c;d++)if(e=b[d],f=this.ac(e),f=this.Ig(f),null!==f)for(var g in e)"__gohashid"!==g&&g!==this.linkKeyProperty&&this.setDataProperty(f,g,e[g]);a=a.removedLinkKeys;if(Array.isArray(a))for(g=a.length,b=0;b<g;b++)c=this.Ig(a[b]),null!==c&&this.Om(c)}; vr.prototype.changeState=function(a,b){if(null!==a&&a.model===this){if(a.change===He){var c=a.object,d=a.propertyName;if(d===this.linkKeyProperty&&this.ad(c)){var e=a.K(b);b=a.K(!b);void 0!==b&&this.kb.remove(b);void 0!==e&&this.kb.add(e,c);hk(c,d,e);return}}else if(a.change===Je){c=a.newParam;if("linkDataArray"===a.modelChange){a=a.newValue;Fa(a)&&"number"===typeof c&&(d=this.ac(a),b?(this.ig.remove(a),this.Vc[c]===a&&this.Vc.splice(c,1),void 0!==d&&this.kb.remove(d)):(this.ig.add(a),this.Vc[c]!== a&&this.Vc.splice(c,0,a),void 0!==d&&this.kb.add(d,a)));return}if("linkLabelKeys"===a.modelChange){d=this.Lg(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===Ke){c=a.oldParam;if("linkDataArray"===a.modelChange){a=a.oldValue;Fa(a)&&"number"===typeof c&&(d=this.ac(a),b?(this.ig.add(a),this.Vc[c]!==a&&this.Vc.splice(c,0,a),void 0!==d&&this.kb.add(d,a)):(this.ig.remove(a),this.Vc[c]=== a&&this.Vc.splice(c,1),void 0!==d&&this.kb.remove(d)));return}if("linkLabelKeys"===a.modelChange){d=this.Lg(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}}W.prototype.changeState.call(this,a,b)}};t=vr.prototype;t.Fm=function(a){if(void 0!==a){var b=this.uj;if(null!==b){var c=this.Pb(a);null===c&&(c=this.copyNodeData(b),hk(c,this.nodeKeyProperty,a),this.Bf(c))}return a}}; t.$z=function(a){return Pq(this,a,!0)};t.Dy=function(a,b){Xq(this,a,b,!0)};t.fA=function(a){return Pq(this,a,!1)};t.Hy=function(a,b){Xq(this,a,b,!1)};function Pq(a,b,c){if(null!==b&&(a=c?a.gf:a.hf,""!==a&&(a=Tn(b,a),void 0!==a))){if(Rq(a))return a;v((c?"FromKey":"ToKey")+" value for link data "+b+" is not a number or a string: "+a)}} function Xq(a,b,c,d){null===c&&(c=void 0);void 0===c||Rq(c)||xa(c,"number or string",vr,d?"setFromKeyForLinkData:key":"setToKeyForLinkData:key");if(null!==b){var e=d?a.gf:a.hf;if(""!==e)if(c=a.Fm(c),a.ad(b)){var f=Tn(b,e);f!==c&&(Vq(a,f,b),hk(b,e,c),null===a.Pb(c)&&Wq(a,c,b),pr(a,d?"linkFromKey":"linkToKey",He,e,b,f,c),"string"===typeof e&&a.Ga(b,e))}else hk(b,e,c)}}t.aA=function(a){return Oq(this,a,!0)};t.Ey=function(a,b){Yq(this,a,b,!0)};t.gA=function(a){return Oq(this,a,!1)}; t.Iy=function(a,b){Yq(this,a,b,!1)};function Oq(a,b,c){if(null===b)return"";a=c?a.Oj:a.Pj;if(""===a)return"";b=Tn(b,a);return void 0===b?"":b}function Yq(a,b,c,d){A(c,"string",vr,d?"setFromPortIdForLinkData:portname":"setToPortIdForLinkData:portname");if(null!==b){var e=d?a.Oj:a.Pj;if(""!==e)if(a.ad(b)){var f=Tn(b,e);void 0===f&&(f="");f!==c&&(hk(b,e,c),pr(a,d?"linkFromPortId":"linkToPortId",He,e,b,f,c),"string"===typeof e&&a.Ga(b,e))}else hk(b,e,c)}} t.Lg=function(a){if(null===a)return xr;var b=this.Td;if(""===b)return xr;a=Tn(a,b);return void 0===a?xr:a};t.ww=function(a,b){Ha(b,vr,"setLabelKeysForLinkData:arr");if(null!==a){var c=this.Td;if(""!==c)if(this.ad(a)){var d=Tn(a,c);void 0===d&&(d=xr);if(d!==b){if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)Vq(this,d[f],a);hk(a,c,b);e=b.length;for(f=0;f<e;f++){var g=b[f];null===this.Pb(g)&&Wq(this,g,a)}pr(this,"linkLabelKeys",He,c,a,d,b);"string"===typeof c&&this.Ga(a,c)}}else hk(a,c,b)}}; t.vv=function(a,b){if(null!==b&&void 0!==b&&(Rq(b)||xa(b,"number or string",vr,"addLabelKeyForLinkData:key"),null!==a)){var c=this.Td;if(""!==c){var d=Tn(a,c);if(void 0===d)c=[],c.push(b),this.ww(a,c);else if(Array.isArray(d)){var e=d.indexOf(b);0<=e||(e=d.length,d.push(b),this.ad(a)&&(null===this.Pb(b)&&Wq(this,b,a),pr(this,"linkLabelKeys",Je,c,a,null,b,null,e)))}else v(c+" property is not an Array; cannot addLabelKeyForLinkData: "+a)}}}; t.yy=function(a,b){if(null!==b&&void 0!==b&&(Rq(b)||xa(b,"number or string",vr,"removeLabelKeyForLinkData:key"),null!==a)){var c=this.Td;if(""!==c){var d=Tn(a,c);if(Array.isArray(d)){var e=d.indexOf(b);0>e||(d.splice(e,1),this.ad(a)&&(Vq(this,b,a),pr(this,"linkLabelKeys",Ke,c,a,b,null,e,null)))}else void 0!==d&&v(c+" property is not an Array; cannot removeLabelKeyforLinkData: "+a)}}}; t.ac=function(a){if(null!==a){var b=this.Hi;if(""!==b&&(b=Tn(a,b),void 0!==b)){if(Rq(b))return b;v("Key value for link data "+a+" is not a number or a string: "+b)}}};t.du=function(a,b){void 0!==b&&null!==b&&Rq(b)||xa(b,"number or string",vr,"setKeyForLinkData:key");if(null!==a){var c=this.Hi;if(""!==c)if(this.ad(a)){var d=Tn(a,c);d!==b&&null===this.Ig(b)&&(hk(a,c,b),void 0!==d&&this.kb.remove(d),this.kb.add(b,a),pr(this,"linkKey",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c))}else hk(a,c,b)}}; t.Ig=function(a){null===a&&v("GraphLinksModel.findLinkDataForKey:key must not be null");return void 0!==a&&Rq(a)?this.kb.K(a):null}; t.Oq=function(a){if(null!==a){var b=this.Hi;if(""!==b){var c=this.ac(a);if(void 0===c||this.kb.contains(c)){var d=this.Kl;if(null!==d&&(c=d(this,a),void 0!==c&&null!==c&&!this.kb.contains(c))){hk(a,b,c);return}if("string"===typeof c){for(d=2;this.kb.contains(c+d);)d++;hk(a,b,c+d)}else if(void 0===c||"number"===typeof c){for(c=-this.kb.count-1;this.kb.contains(c);)c--;hk(a,b,c)}else F&&v("GraphLinksModel.getKeyForLinkData returned something other than a string or a number: "+c)}}}}; t.ad=function(a){return null===a?!1:this.ig.contains(a)};t.Yi=function(a){null!==a&&(ub(a),this.ad(a)||Tq(this,a,!0))};function Tq(a,b,c){if(""!==a.linkKeyProperty){var d=a.ac(b);if(void 0!==d&&a.kb.K(d)===b)return;a.Oq(b);d=a.ac(b);if(void 0===d){v("GraphLinksModel.makeLinkDataKeyUnique failed on "+b+". Data not added to model.");return}a.kb.add(d,b)}a.ig.add(b);d=null;c&&(d=a.Vc.length,a.Vc.splice(d,0,b));pr(a,"linkDataArray",Je,"linkDataArray",a,null,b,null,d);yr(a,b)} t.bz=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Yi(a[c]);else for(a=a.iterator;a.next();)this.Yi(a.value)};t.Om=function(a){null!==a&&Sq(this,a,!0)};function Sq(a,b,c){a.ig.remove(b);var d=a.ac(b);void 0!==d&&a.kb.remove(d);d=null;if(c){d=a.Vc.indexOf(b);if(0>d)return;a.Vc.splice(d,1)}pr(a,"linkDataArray",Ke,"linkDataArray",a,b,null,d,null);c=Pq(a,b,!0);Vq(a,c,b);c=Pq(a,b,!1);Vq(a,c,b);d=a.Lg(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],Vq(a,c,b)} t.KA=function(a){if(Array.isArray(a))for(var b=a.length,c=0;c<b;c++)this.Om(a[c]);else for(a=a.iterator;a.next();)this.Om(a.value)}; t.BA=function(a){""===this.linkKeyProperty&&v("GraphLinksModel.linkKeyProperty must not be an empty string for .mergeLinkDataArray() to succeed.");if(Ga(a)){for(var b=new I(this.kb.iteratorKeys),c=new I,d=a.length,e=0;e<d;e++){var f=a[e],g=this.ac(f);if(void 0!==g){c.add(g);var h=this.Ig(g);null!==h?this.ik(h,f):(h={},this.du(h,g),this.ik(h,f),this.Yi(h))}else this.Yi(f),c.add(this.ac(f))}for(a=b.iterator;a.next();)b=a.value,c.contains(b)||(b=this.Ig(b))&&this.Om(b);this.wq()}}; function yr(a,b){var c=Pq(a,b,!0);c=a.Fm(c);null===a.Pb(c)&&Wq(a,c,b);c=Pq(a,b,!1);c=a.Fm(c);null===a.Pb(c)&&Wq(a,c,b);var d=a.Lg(b);if(Array.isArray(d))for(var e=d.length,f=0;f<e;f++)c=d[f],null===a.Pb(c)&&Wq(a,c,b)}t.xq=function(a){if(null===a)return null;var b=this.$k;a=null!==b?b(a,this):rr(this,a,!0);Fa(a)&&(fb(a),""!==this.gf&&hk(a,this.gf,void 0),""!==this.hf&&hk(a,this.hf,void 0),""!==this.Td&&hk(a,this.Td,[]));return a}; t.Lt=function(a){if(null===a)return!1;var b=this.Ol;return""===b?!1:Tn(a,b)?!0:!1};t.ij=function(a){if(null!==a){var b=this.Ee;if(""!==b&&(b=Tn(a,b),void 0!==b)){if(Rq(b))return b;v("GroupKey value for node data "+a+" is not a number or a string: "+b)}}}; t.cu=function(a,b){null===b&&(b=void 0);void 0===b||Rq(b)||xa(b,"number or string",vr,"setGroupKeyForNodeData:key");if(null!==a){var c=this.Ee;if(""!==c)if(this.eb(a)){var d=Tn(a,c);d!==b&&(Vq(this,d,a),hk(a,c,b),null===this.Pb(b)&&Wq(this,b,a),pr(this,"nodeGroupKey",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c))}else hk(a,c,b)}}; vr.prototype.copyNodeData=function(a){if(null===a)return null;a=W.prototype.copyNodeData.call(this,a);this.mk||""===this.Ee||void 0===Tn(a,this.Ee)||hk(a,this.Ee,void 0);return a}; vr.prototype.setDataProperty=function(a,b,c){F&&(A(a,"object",vr,"setDataProperty:data"),A(b,"string",vr,"setDataProperty:propname"),""===b&&v("GraphLinksModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.eb(a))if(b===this.nodeKeyProperty)this.Wm(a,c);else{if(b===this.nodeCategoryProperty){this.$q(a,c);return}if(b===this.nodeGroupKeyProperty){this.cu(a,c);return}F&&b===this.nodeIsGroupProperty&&v("GraphLinksModel.setDataProperty: property name must not be the nodeIsGroupProperty: "+ b)}else if(this.ad(a)){if(b===this.linkFromKeyProperty){Xq(this,a,c,!0);return}if(b===this.linkToKeyProperty){Xq(this,a,c,!1);return}if(b===this.linkFromPortIdProperty){Yq(this,a,c,!0);return}if(b===this.linkToPortIdProperty){Yq(this,a,c,!1);return}if(b===this.linkKeyProperty){this.du(a,c);return}if(b===this.linkCategoryProperty){this.bu(a,c);return}if(b===this.linkLabelKeysProperty){this.ww(a,c);return}}var d=Tn(a,b);d!==c&&(hk(a,b,c),this.Wt(a,b,d,c))};t=vr.prototype; t.ik=function(a,b){if(b){var c=this.eb(a),d=this.ad(a),e;for(e in b)"__gohashid"===e||c&&e===this.nodeKeyProperty||c&&e===this.nodeIsGroupProperty&&Tn(a,e)===b[e]||d&&e===this.linkKeyProperty||this.setDataProperty(a,e,b[e])}}; t.Yq=function(a,b){W.prototype.Yq.call(this,a,b);for(var c=this.Za.iterator;c.next();)this.rw(c.value,a,b);for(c=this.ig.iterator;c.next();){var d=c.value,e=a,f=b;if(Pq(this,d,!0)===e){var g=this.gf;hk(d,g,f);pr(this,"linkFromKey",He,g,d,e,f);"string"===typeof g&&this.Ga(d,g)}Pq(this,d,!1)===e&&(g=this.hf,hk(d,g,f),pr(this,"linkToKey",He,g,d,e,f),"string"===typeof g&&this.Ga(d,g));g=this.Lg(d);if(Array.isArray(g))for(var h=g.length,k=this.Td,l=0;l<h;l++)g[l]===e&&(g[l]=f,pr(this,"linkLabelKeys",Je, k,d,e,f,l,l))}};t.rw=function(a,b,c){if(this.ij(a)===b){var d=this.Ee;hk(a,d,c);pr(this,"nodeGroupKey",He,d,a,b,c);"string"===typeof d&&this.Ga(a,d)}};t.Kw=function(){W.prototype.Kw.call(this);for(var a=this.linkDataArray,b=a.length,c=0;c<b;c++)yr(this,a[c])}; t.Sm=function(a){W.prototype.Sm.call(this,a);a=this.pa(a);var b=Uq(this,a);if(null!==b){var c=La();for(b=b.iterator;b.next();){var d=b.value;if(this.eb(d)){if(this.ij(d)===a){var e=this.Ee;pr(this,"nodeGroupKey",He,e,d,a,a);"string"===typeof e&&this.Ga(d,e);c.push(d)}}else if(Pq(this,d,!0)===a&&(e=this.gf,pr(this,"linkFromKey",He,e,d,a,a),"string"===typeof e&&this.Ga(d,e),c.push(d)),Pq(this,d,!1)===a&&(e=this.hf,pr(this,"linkToKey",He,e,d,a,a),"string"===typeof e&&this.Ga(d,e),c.push(d)),e=this.Lg(d), Array.isArray(e))for(var f=e.length,g=this.Td,h=0;h<f;h++)e[h]===a&&(pr(this,"linkLabelKeys",Je,g,d,a,a,h,h),c.push(d))}for(b=0;b<c.length;b++)Vq(this,a,c[b]);Oa(c)}};t.Rm=function(a){W.prototype.Rm.call(this,a);var b=this.ij(a);null===this.Pb(b)&&Wq(this,b,a)};t.er=function(a){W.prototype.er.call(this,a);var b=this.ij(a);Vq(this,b,a)}; t.Qv=function(a){if(null===a)return"";var b=this.Nj;if(""===b)return"";b=Tn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getCategoryForLinkData found a non-string category for "+a+": "+b);return""};vr.prototype.getLinkCategoryForData=function(a){return this.Qv(a)}; vr.prototype.bu=function(a,b){A(b,"string",vr,"setCategoryForLinkData:cat");if(null!==a){var c=this.Nj;if(""!==c)if(this.ad(a)){var d=Tn(a,c);void 0===d&&(d="");d!==b&&(hk(a,c,b),pr(this,"linkCategory",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c))}else hk(a,c,b)}};vr.prototype.setLinkCategoryForData=function(a,b){this.bu(a,b)};vr.prototype.wk=function(){return!0};vr.prototype.Dm=function(){return!0};vr.prototype.Nt=function(){return!0};vr.prototype.mj=function(){return!0}; ma.Object.defineProperties(vr.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.uj},set:function(a){var b=this.uj;b!==a&&(null!==a&&A(a,"object",vr,"archetypeNodeData"),this.uj=a,this.g("archetypeNodeData",b,a))}},linkFromKeyProperty:{configurable:!0,get:function(){return this.gf},set:function(a){var b=this.gf;b!==a&&(qr(a,vr,"linkFromKeyProperty"),this.gf=a,this.g("linkFromKeyProperty",b,a))}},linkToKeyProperty:{configurable:!0,get:function(){return this.hf}, set:function(a){var b=this.hf;b!==a&&(qr(a,vr,"linkToKeyProperty"),this.hf=a,this.g("linkToKeyProperty",b,a))}},linkFromPortIdProperty:{configurable:!0,get:function(){return this.Oj},set:function(a){var b=this.Oj;b!==a&&(qr(a,vr,"linkFromPortIdProperty"),!F||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.Oj=a,this.g("linkFromPortIdProperty",b,a))}}, linkToPortIdProperty:{configurable:!0,get:function(){return this.Pj},set:function(a){var b=this.Pj;b!==a&&(qr(a,vr,"linkToPortIdProperty"),!F||a!==this.linkFromKeyProperty&&a!==this.linkToKeyProperty||v("linkFromPortIdProperty name must not be the same as the GraphLinksModel.linkFromKeyProperty or linkToKeyProperty: "+a),this.Pj=a,this.g("linkToPortIdProperty",b,a))}},linkLabelKeysProperty:{configurable:!0,get:function(){return this.Td},set:function(a){var b=this.Td;b!== a&&(qr(a,vr,"linkLabelKeysProperty"),this.Td=a,this.g("linkLabelKeysProperty",b,a))}},linkDataArray:{configurable:!0,get:function(){return this.Vc},set:function(a){var b=this.Vc;if(b!==a){Ha(a,vr,"linkDataArray");this.kb.clear();for(var c=a.length,d=0;d<c;d++){var e=a[d];if(!Fa(e)){v("GraphLinksModel.linkDataArray must only contain Objects, not: "+e);return}ub(e)}this.Vc=a;if(""!==this.linkKeyProperty){d=new H;for(e=0;e<c;e++){var f=a[e],g=this.ac(f);void 0===g?d.add(f):null!==this.kb.K(g)? d.add(f):this.kb.add(g,f)}for(d=d.iterator;d.next();)e=d.value,this.Oq(e),f=this.ac(e),void 0!==f&&this.kb.add(f,e)}d=new I;for(e=0;e<c;e++)d.add(a[e]);this.ig=d;pr(this,"linkDataArray",He,"linkDataArray",this,b,a);for(b=0;b<c;b++)yr(this,a[b])}}},linkKeyProperty:{configurable:!0,get:function(){return this.Hi},set:function(a){var b=this.Hi;if(b!==a){qr(a,vr,"linkKeyProperty");this.Hi=a;this.kb.clear();for(var c=this.linkDataArray.length,d=0;d<c;d++){var e=this.linkDataArray[d],f=this.ac(e); void 0===f&&(this.Oq(e),f=this.ac(e));void 0!==f&&this.kb.add(f,e)}this.g("linkKeyProperty",b,a)}}},makeUniqueLinkKeyFunction:{configurable:!0,get:function(){return this.Kl},set:function(a){var b=this.Kl;b!==a&&(null!==a&&A(a,"function",vr,"makeUniqueLinkKeyFunction"),this.Kl=a,this.g("makeUniqueLinkKeyFunction",b,a))}},copyLinkDataFunction:{configurable:!0,get:function(){return this.$k},set:function(a){var b=this.$k;b!==a&&(null!==a&&A(a,"function",vr,"copyLinkDataFunction"), this.$k=a,this.g("copyLinkDataFunction",b,a))}},nodeIsGroupProperty:{configurable:!0,get:function(){return this.Ol},set:function(a){var b=this.Ol;b!==a&&(qr(a,vr,"nodeIsGroupProperty"),this.Ol=a,this.g("nodeIsGroupProperty",b,a))}},nodeGroupKeyProperty:{configurable:!0,get:function(){return this.Ee},set:function(a){var b=this.Ee;b!==a&&(qr(a,vr,"nodeGroupKeyProperty"),this.Ee=a,this.g("nodeGroupKeyProperty",b,a))}},mk:{configurable:!0,get:function(){return this.Bn}, set:function(a){this.Bn!==a&&(A(a,"boolean",vr,"copiesGroupKeyOfNodeData"),this.Bn=a)}},linkCategoryProperty:{configurable:!0,get:function(){return this.Nj},set:function(a){var b=this.Nj;b!==a&&(qr(a,vr,"linkCategoryProperty"),this.Nj=a,this.g("linkCategoryProperty",b,a))}}});ma.Object.defineProperties(vr,{type:{configurable:!0,get:function(){return"GraphLinksModel"}}});vr.prototype.setCategoryForLinkData=vr.prototype.bu;vr.prototype.getCategoryForLinkData=vr.prototype.Qv; vr.prototype.assignAllDataProperties=vr.prototype.ik;vr.prototype.setGroupKeyForNodeData=vr.prototype.cu;vr.prototype.getGroupKeyForNodeData=vr.prototype.ij;vr.prototype.isGroupForNodeData=vr.prototype.Lt;vr.prototype.copyLinkData=vr.prototype.xq;vr.prototype.mergeLinkDataArray=vr.prototype.BA;vr.prototype.removeLinkDataCollection=vr.prototype.KA;vr.prototype.removeLinkData=vr.prototype.Om;vr.prototype.addLinkDataCollection=vr.prototype.bz;vr.prototype.addLinkData=vr.prototype.Yi; vr.prototype.containsLinkData=vr.prototype.ad;vr.prototype.makeLinkDataKeyUnique=vr.prototype.Oq;vr.prototype.findLinkDataForKey=vr.prototype.Ig;vr.prototype.setKeyForLinkData=vr.prototype.du;vr.prototype.getKeyForLinkData=vr.prototype.ac;vr.prototype.removeLabelKeyForLinkData=vr.prototype.yy;vr.prototype.addLabelKeyForLinkData=vr.prototype.vv;vr.prototype.setLabelKeysForLinkData=vr.prototype.ww;vr.prototype.getLabelKeysForLinkData=vr.prototype.Lg;vr.prototype.setToPortIdForLinkData=vr.prototype.Iy; vr.prototype.getToPortIdForLinkData=vr.prototype.gA;vr.prototype.setFromPortIdForLinkData=vr.prototype.Ey;vr.prototype.getFromPortIdForLinkData=vr.prototype.aA;vr.prototype.setToKeyForLinkData=vr.prototype.Hy;vr.prototype.getToKeyForLinkData=vr.prototype.fA;vr.prototype.setFromKeyForLinkData=vr.prototype.Dy;vr.prototype.getFromKeyForLinkData=vr.prototype.$z;vr.prototype.clear=vr.prototype.clear;var xr=Object.freeze([]);vr.className="GraphLinksModel";tr.GraphLinksModel=vr; W.constructGraphLinksModel=W.constructGraphLinksModel=function(){return new vr};W.initDiagramModel=Li=function(){return new vr};function zr(a){F&&1<arguments.length&&v("TreeModel constructor can only take one optional argument, the Array of node data.");W.call(this);this.Fe="parent";this.Dn=!1;this.Uj="parentLinkCategory";void 0!==a&&(this.nodeDataArray=a)}la(zr,W);zr.constructGraphLinksModel=W.constructGraphLinksModel; zr.prototype.cloneProtected=function(a){W.prototype.cloneProtected.call(this,a);a.Fe=this.Fe;a.Dn=this.Dn;a.Uj=this.Uj};t=zr.prototype;t.toString=function(a){void 0===a&&(a=0);if(2<=a)return this.cr();var b=(""!==this.name?this.name:"")+" TreeModel";if(0<a){b+="\n node data:";a=this.nodeDataArray;for(var c=a.length,d=0;d<c;d++){var e=a[d];b+=" "+this.pa(e)+":"+Qa(e)}}return b}; t.Mk=function(){var a=W.prototype.Mk.call(this),b="";"parent"!==this.nodeParentKeyProperty&&"string"===typeof this.nodeParentKeyProperty&&(b+=',\n "nodeParentKeyProperty": '+this.quote(this.nodeParentKeyProperty));return a+b};t.Vq=function(a){W.prototype.Vq.call(this,a);a.nodeParentKeyProperty&&(this.nodeParentKeyProperty=a.nodeParentKeyProperty)};t.hr=function(a){jr(this,a,"nodeParentKeyProperty");return W.prototype.hr.call(this,a)}; t.Uq=function(a){void 0!==a.nodeParentKeyProperty&&a.nodeParentKeyProperty!==this.nodeParentKeyProperty&&v("applyIncrementalJson cannot change Model properties");W.prototype.Uq.call(this,a)};t.Fm=function(a){return a};t.kj=function(a){if(null!==a){var b=this.Fe;if(""!==b&&(b=Tn(a,b),void 0!==b)){if(Rq(b))return b;v("ParentKey value for node data "+a+" is not a number or a string: "+b)}}}; t.Ue=function(a,b){null===b&&(b=void 0);void 0===b||Rq(b)||xa(b,"number or string",zr,"setParentKeyForNodeData:key");if(null!==a){var c=this.Fe;if(""!==c)if(b=this.Fm(b),this.eb(a)){var d=Tn(a,c);d!==b&&(Vq(this,d,a),hk(a,c,b),null===this.Pb(b)&&Wq(this,b,a),pr(this,"nodeParentKey",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c))}else hk(a,c,b)}}; t.Rv=function(a){if(null===a)return"";var b=this.Uj;if(""===b)return"";b=Tn(a,b);if(void 0===b)return"";if("string"===typeof b)return b;v("getParentLinkCategoryForNodeData found a non-string category for "+a+": "+b);return""};zr.prototype.getLinkCategoryForData=function(a){return this.Rv(a)}; zr.prototype.xw=function(a,b){A(b,"string",zr,"setParentLinkCategoryForNodeData:cat");if(null!==a){var c=this.Uj;if(""!==c)if(this.eb(a)){var d=Tn(a,c);void 0===d&&(d="");d!==b&&(hk(a,c,b),pr(this,"parentLinkCategory",He,c,a,d,b),"string"===typeof c&&this.Ga(a,c))}else hk(a,c,b)}};zr.prototype.setLinkCategoryForData=function(a,b){this.xw(a,b)}; zr.prototype.copyNodeData=function(a){if(null===a)return null;a=W.prototype.copyNodeData.call(this,a);this.nk||""===this.Fe||void 0===Tn(a,this.Fe)||hk(a,this.Fe,void 0);return a}; zr.prototype.setDataProperty=function(a,b,c){F&&(A(a,"object",zr,"setDataProperty:data"),A(b,"string",zr,"setDataProperty:propname"),""===b&&v("TreeModel.setDataProperty: property name must not be an empty string when setting "+a+" to "+c));if(this.eb(a))if(b===this.nodeKeyProperty)this.Wm(a,c);else{if(b===this.nodeCategoryProperty){this.$q(a,c);return}if(b===this.nodeParentKeyProperty){this.Ue(a,c);return}}var d=Tn(a,b);d!==c&&(hk(a,b,c),this.Wt(a,b,d,c))};t=zr.prototype; t.Yq=function(a,b){W.prototype.Yq.call(this,a,b);for(var c=this.Za.iterator;c.next();)this.rw(c.value,a,b)};t.rw=function(a,b,c){if(this.kj(a)===b){var d=this.Fe;hk(a,d,c);pr(this,"nodeParentKey",He,d,a,b,c);"string"===typeof d&&this.Ga(a,d)}}; t.Sm=function(a){W.prototype.Sm.call(this,a);a=this.pa(a);var b=Uq(this,a);if(null!==b){var c=La();for(b=b.iterator;b.next();){var d=b.value;if(this.eb(d)&&this.kj(d)===a){var e=this.Fe;pr(this,"nodeParentKey",He,e,d,a,a);"string"===typeof e&&this.Ga(d,e);c.push(d)}}for(b=0;b<c.length;b++)Vq(this,a,c[b]);Oa(c)}};t.Rm=function(a){W.prototype.Rm.call(this,a);var b=this.kj(a);b=this.Fm(b);null===this.Pb(b)&&Wq(this,b,a)};t.er=function(a){W.prototype.er.call(this,a);var b=this.kj(a);Vq(this,b,a)}; t.Em=function(){return!0};t.Nt=function(){return!0}; ma.Object.defineProperties(zr.prototype,{nodeParentKeyProperty:{configurable:!0,get:function(){return this.Fe},set:function(a){var b=this.Fe;b!==a&&(qr(a,zr,"nodeParentKeyProperty"),this.Fe=a,this.g("nodeParentKeyProperty",b,a))}},nk:{configurable:!0,get:function(){return this.Dn},set:function(a){this.Dn!==a&&(A(a,"boolean",zr,"copiesParentKeyOfNodeData"),this.Dn=a)}},parentLinkCategoryProperty:{configurable:!0,get:function(){return this.Uj},set:function(a){var b= this.Uj;b!==a&&(qr(a,zr,"parentLinkCategoryProperty"),this.Uj=a,this.g("parentLinkCategoryProperty",b,a))}},linkCategoryProperty:{configurable:!0,get:function(){return this.parentLinkCategoryProperty},set:function(a){this.parentLinkCategoryProperty=a}}});ma.Object.defineProperties(zr,{type:{configurable:!0,get:function(){return"TreeModel"}}});zr.prototype.setParentLinkCategoryForNodeData=zr.prototype.xw;zr.prototype.getParentLinkCategoryForNodeData=zr.prototype.Rv; zr.prototype.setParentKeyForNodeData=zr.prototype.Ue;zr.prototype.getParentKeyForNodeData=zr.prototype.kj;zr.className="TreeModel";tr.TreeModel=zr;function Br(){0<arguments.length&&za(Br);Ni.call(this);this.mx=this.Rn=this.fc=0;this.Rr=360;this.lx=Cr;this.Cj=0;this.ax=new J;this.Dr=this.ae=0;this.ot=new Dr;this.tu=this.Tj=0;this.Ty=600;this.xp=NaN;this.nn=1;this.aq=0;this.fm=360;this.Hb=Cr;this.M=Er;this.Xc=Fr;this.Rc=sq;this.sf=6;this.gp=Gr}la(Br,Ni); Br.prototype.cloneProtected=function(a){Ni.prototype.cloneProtected.call(this,a);a.xp=this.xp;a.nn=this.nn;a.aq=this.aq;a.fm=this.fm;a.Hb=this.Hb;a.M=this.M;a.Xc=this.Xc;a.Rc=this.Rc;a.sf=this.sf;a.gp=this.gp}; Br.prototype.mb=function(a){if(a.classType===Br)if(a===Hr||a===Ir||a===Jr||a===Kr||a===Fr)this.sorting=a;else if(a===Lr||a===Mr||a===Er||a===Nr)this.direction=a;else if(a===Or||a===Pr||a===Cr||a===Qr)this.arrangement=a;else{if(a===Rr||a===Gr)this.nodeDiameterFormula=a}else Ni.prototype.mb.call(this,a)};Br.prototype.createNetwork=function(){return new Sr(this)}; Br.prototype.doLayout=function(a){F&&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.Dr;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===Qr&&k===Rr?h=Cr:h===Qr&&k!==Rr&&(h=this.arrangement);if((this.direction===Lr||this.direction===Mr)&&this.sorting!==Fr){for(k=0;!(k>=d.length);k+=2){a.add(d.O(k));if(k+1>=d.length)break;c.add(d.O(k+1))}this.direction===Lr?(this.arrangement===Qr&&a.reverse(),d=new H,d.addAll(a), d.addAll(c)):(this.arrangement===Qr&&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===Er?1:-1)/k,u=d.O(r).diameter;isNaN(u)&&(u=Tr(d.O(r),q));360>p&&(0===r||r===d.length-1)&&(u/=2);e+=u;f++}if(isNaN(l)||h===Qr){isNaN(b)&&(b=6);if(h!==Cr&&h!==Qr){f=-Infinity;for(g=0;g<k;g++)r=d.O(g),e=d.O(g===k-1?0:g+1),isNaN(r.diameter)&&Tr(r,0),isNaN(e.diameter)&&Tr(e,0),f=Math.max(f,(r.diameter+e.diameter)/2);g=f+b;h===Or?l=(f+b)/(2*Math.PI/k): l=Ur(this,g*(360<=p?k:k-1),m,n*Math.PI/180,p*Math.PI/180)}else l=Ur(this,e+(360<=p?k:k-1)*(h!==Qr?b:1.6*b),m,n*Math.PI/180,p*Math.PI/180);f=l*m}else if(f=l*m,r=Vr(this,l,f,n*Math.PI/180,p*Math.PI/180),isNaN(b)){if(h===Cr||h===Qr)b=(r-e)/(360<=p?k:k-1)}else if(h===Cr||h===Qr)r=(r-e)/(360<=p?k:k-1),r<b?(l=Ur(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.O(e),u=d.O(e===k-1?0:e+1),isNaN(q.diameter)&&Tr(q,0),isNaN(u.diameter)&&Tr(u,0),g=Math.max(g, (q.diameter+u.diameter)/2);g+=b;e=Ur(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.lx=h;this.fc=l;this.Rn=m;this.mx=n;this.Rr=p;this.Cj=b;this.ae=f;this.Dr=g;b=d;d=this.lx;h=this.fc;l=this.mx;m=this.Rr;n=this.Cj;p=this.ae;k=this.Dr;if(this.direction!==Lr&&this.direction!==Mr||d!==Qr)if(this.direction===Lr||this.direction===Mr){g=0;switch(d){case Pr:g=180*Wr(this,h,p,l,k)/Math.PI;break;case Cr:k=b=0;g=a.first();null!==g&&(b=Tr(g,Math.PI/2));g=c.first(); null!==g&&(k=Tr(g,Math.PI/2));g=180*Wr(this,h,p,l,n+(b+k)/2)/Math.PI;break;case Or:g=m/b.length}if(this.direction===Lr){switch(d){case Pr:Xr(this,a,l,Nr);break;case Cr:Yr(this,a,l,Nr);break;case Or:Zr(this,a,m/2,l,Nr)}switch(d){case Pr:Xr(this,c,l+g,Er);break;case Cr:Yr(this,c,l+g,Er);break;case Or:Zr(this,c,m/2,l+g,Er)}}else{switch(d){case Pr:Xr(this,c,l,Nr);break;case Cr:Yr(this,c,l,Nr);break;case Or:Zr(this,c,m/2,l,Nr)}switch(d){case Pr:Xr(this,a,l+g,Er);break;case Cr:Yr(this,a,l+g,Er);break;case Or:Zr(this, a,m/2,l+g,Er)}}}else switch(d){case Pr:Xr(this,b,l,this.direction);break;case Cr:Yr(this,b,l,this.direction);break;case Or:Zr(this,b,m,l,this.direction);break;case Qr:$r(this,b,m,l,this.direction)}else $r(this,b,m,l-m/2,Er)}this.updateParts();this.network=null;this.isValidLayout=!0}; function Zr(a,b,c,d,e){var f=a.Rr,g=a.fc;a=a.ae;d=d*Math.PI/180;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=d+(e===Er?k*c/(360<=f?h:h-1):-(k*c)/h),m=b.O(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 Yr(a,b,c,d){var e=a.fc,f=a.ae,g=a.Cj;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.O(k),m=b.O(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)&&Tr(l,0);isNaN(m.diameter)&&Tr(m,0);l=Wr(a,e,f,d===Er?c:-c,(l.diameter+m.diameter)/2+g);c+=d===Er?l:-l}} function Xr(a,b,c,d){var e=a.fc,f=a.ae,g=a.Dr;c=c*Math.PI/180;for(var h=b.length,k=0;k<h;k++){var l=b.O(k);l.centerX=e*Math.cos(c);l.centerY=f*Math.sin(c);l.actualAngle=180*c/Math.PI;l=Wr(a,e,f,d===Er?c:-c,g);c+=d===Er?l:-l}}function $r(a,b,c,d,e){var f=a.Rr;a.Tj=0;a.ot=new Dr;if(360>c){for(f=d+(e===Er?f:-f);0>f;)f+=360;f%=360;180<f&&(f-=360);f*=Math.PI/180;a.tu=f;as(a,b,c,d,e)}else bs(a,b,c,d,e);a.ot.commit(b)} function bs(a,b,c,d,e){var f=a.fc,g=a.Cj,h=a.Rn,k=f*Math.cos(d*Math.PI/180),l=a.ae*Math.sin(d*Math.PI/180),m=b.ua();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;cs(a,k,l,m,n,e,f)||ds(a,k,l,m,n,e,f);k=f.x;l=f.y}J.free(f);a.Tj++;if(!(23<a.Tj)){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===Er?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.ot.compare(g,m);1<Math.abs(g)&&(a.fc=8>a.Tj?a.fc-g/(2*Math.PI):5>m.length&&10<g?a.fc/2:a.fc-(0<g?1.7:-2.3),a.ae=a.fc*h,bs(a,b,c,d,e))}}} function as(a,b,c,d,e){for(var f=a.fc,g=a.ae,h=a.Rn,k=f*Math.cos(d*Math.PI/180),l=g*Math.sin(d*Math.PI/180),m=J.alloc(),n=b.ua(),p=0;p<n.length;p++){n[p].centerX=k;n[p].centerY=l;if(p>=n.length-1)break;cs(a,k,l,n,p,e,m)||ds(a,k,l,n,p,e,m);k=m.x;l=m.y}J.free(m);a.Tj++;if(!(23<a.Tj)){k=Math.atan2(l,k);k=e===Er?a.tu-k:k-a.tu;k=Math.abs(k)<Math.abs(k-2*Math.PI)?k:k-2*Math.PI;f=k*(f+g)/2;g=a.ot;if(Math.abs(f)<Math.abs(g.ym))for(g.ym=f,g.Nk=[],g.$m=[],k=0;k<n.length;k++)g.Nk[k]=n[k].bounds.x,g.$m[k]=n[k].bounds.y; 1<Math.abs(f)&&(a.fc=8>a.Tj?a.fc-f/(2*Math.PI):a.fc-(0<f?1.7:-2.3),a.ae=a.fc*h,as(a,b,c,d,e))}}function cs(a,b,c,d,e,f,g){var h=a.fc,k=a.ae,l=0;a=(d[e].width+d[e+1].width)/2+a.Cj;var m=!1;if(0<=c!==(f===Er)){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 ds(a,b,c,d,e,f,g){var h=a.fc,k=a.ae,l=0;a=(d[e].height+d[e+1].height)/2+a.Cj;d=!1;if(0<=b!==(f===Er)){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}Br.prototype.commitLayout=function(){this.commitNodes();this.isRouting&&this.commitLinks()}; Br.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.fc,c.y=this.arrangementOrigin.y+this.ae);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.Eb(),a=this.group.position.copy(),c=this.group.location.copy(),b=b.ie(c.ie(a)),this.group.move(b),this.ax=b.ie(a))}; Br.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};function Vr(a,b,c,d,e){var f=a.Ty;if(.001>Math.abs(a.Rn-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 Ur(a,b,c,d,e){return b/(void 0!==d&&void 0!==e?Vr(a,1,c,d,e):Vr(a,1,c))}function Wr(a,b,c,d,e){if(.001>Math.abs(a.Rn-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}} Br.prototype.sort=function(a){switch(this.sorting){case Jr:break;case Kr:a.reverse();break;case Hr:a.sort(this.comparer);break;case Ir:a.sort(this.comparer);a.reverse();break;case Fr: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.O(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.O(f));b[f]=-1;f=a.O(f);for(g=f.sourceEdges;g.next();)e=a.indexOf(g.value.fromVertex),0>e||0<= b[e]&&b[e]++;for(f=f.destinationEdges;f.next();)e=a.indexOf(f.value.toVertex),0>e||0<=b[e]&&b[e]++}a=[];for(b=0;b<c.length;b++){e=c.O(b);a[b]=[];for(f=e.destinationEdges;f.next();)d=c.indexOf(f.value.toVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d);for(e=e.sourceEdges;e.next();)d=c.indexOf(e.value.fromVertex),d!==b&&0>a[b].indexOf(d)&&a[b].push(d)}f=[];for(b=0;b<a.length;b++)f[b]=0;b=[];g=[];h=[];e=[];d=new H;for(var k=0,l=0;l<a.length;l++){var m=a[l].length;if(1===m)e.push(l);else if(0===m)d.add(c.O(l)); else{if(0===k)b.push(l);else{for(var n=m=Infinity,p=-1,r=[],q=0;q<b.length;q++)0>a[b[q]].indexOf(b[q===b.length-1?0:q+1])&&r.push(q===b.length-1?0:q+1);if(0===r.length)for(q=0;q<b.length;q++)r.push(q);for(q=0;q<r.length;q++){for(var u=r[q],x=a[l],y=0,z=0;z<g.length;z++){var B=f[g[z]],D=f[h[z]];if(B<D){var G=B;B=D}else G=D;if(G<u&&u<=B)for(D=0;D<x.length;D++){var O=x[D];0>b.indexOf(O)||G<f[O]&&f[O]<B||G===f[O]||B===f[O]||y++}else for(D=0;D<x.length;D++)O=x[D],0>b.indexOf(O)||G<f[O]&&f[O]<B&&G!==f[O]&& B!==f[O]&&y++}x=y;for(z=y=0;z<a[l].length;z++)G=b.indexOf(a[l][z]),0<=G&&(G=Math.abs(u-(G>=u?G+1:G)),y+=G<b.length+1-G?G:b.length+1-G);for(z=0;z<g.length;z++)G=f[g[z]],B=f[h[z]],G>=u&&G++,B>=u&&B++,G>B&&(D=B,B=G,G=D),B-G<(b.length+2)/2===(G<u&&u<=B)&&y++;if(x<m||x===m&&y<n)m=x,n=y,p=u}b.splice(p,0,l);for(m=0;m<b.length;m++)f[b[m]]=m;for(m=0;m<a[l].length;m++)n=a[l][m],0<=b.indexOf(n)&&(g.push(l),h.push(n))}k++}}for(g=b.length;;){f=!0;for(h=0;h<e.length;h++)if(k=e[h],l=a[k][0],m=b.indexOf(l),0<=m){for(p= n=0;p<a[l].length;p++)r=b.indexOf(a[l][p]),0>r||r===m||(q=r>m?r-m:m-r,n+=r<m!==q>g-q?1:-1);b.splice(0>n?m:m+1,0,k);e.splice(h,1);h--}else f=!1;if(f)break;else b.push(e[0]),e.splice(0,1)}for(a=0;a<b.length;a++)d.add(c.O(b[a]));return d;default:v("Invalid sorting type.")}return a}; ma.Object.defineProperties(Br.prototype,{radius:{configurable:!0,get:function(){return this.xp},set:function(a){this.xp!==a&&(A(a,"number",Br,"radius"),0<a||isNaN(a))&&(this.xp=a,this.D())}},aspectRatio:{configurable:!0,get:function(){return this.nn},set:function(a){this.nn!==a&&(A(a,"number",Br,"aspectRatio"),0<a&&(this.nn=a,this.D()))}},startAngle:{configurable:!0,get:function(){return this.aq},set:function(a){this.aq!==a&&(A(a,"number",Br,"startAngle"), this.aq=a,this.D())}},sweepAngle:{configurable:!0,get:function(){return this.fm},set:function(a){this.fm!==a&&(A(a,"number",Br,"sweepAngle"),0<a&&360>=a?this.fm=a:this.fm=360,this.D())}},arrangement:{configurable:!0,get:function(){return this.Hb},set:function(a){this.Hb!==a&&(hb(a,Br,Br,"arrangement"),a===Qr||a===Cr||a===Pr||a===Or)&&(this.Hb=a,this.D())}},direction:{configurable:!0,get:function(){return this.M},set:function(a){this.M!==a&&(hb(a,Br,Br,"direction"), a===Er||a===Nr||a===Lr||a===Mr)&&(this.M=a,this.D())}},sorting:{configurable:!0,get:function(){return this.Xc},set:function(a){this.Xc!==a&&(hb(a,Br,Br,"sorting"),a===Jr||a===Kr||a===Hr||Ir||a===Fr)&&(this.Xc=a,this.D())}},comparer:{configurable:!0,get:function(){return this.Rc},set:function(a){this.Rc!==a&&(A(a,"function",Br,"comparer"),this.Rc=a,this.D())}},spacing:{configurable:!0,get:function(){return this.sf},set:function(a){this.sf!==a&&(A(a,"number", Br,"spacing"),this.sf=a,this.D())}},nodeDiameterFormula:{configurable:!0,get:function(){return this.gp},set:function(a){this.gp!==a&&(hb(a,Br,Br,"nodeDiameterFormula"),a===Gr||a===Rr)&&(this.gp=a,this.D())}},actualXRadius:{configurable:!0,get:function(){return this.fc}},actualYRadius:{configurable:!0,get:function(){return this.ae}},actualSpacing:{configurable:!0,get:function(){return this.Cj}},actualCenter:{configurable:!0,get:function(){return this.ax}}}); var Cr=new E(Br,"ConstantSpacing",0),Pr=new E(Br,"ConstantDistance",1),Or=new E(Br,"ConstantAngle",2),Qr=new E(Br,"Packed",3),Er=new E(Br,"Clockwise",4),Nr=new E(Br,"Counterclockwise",5),Lr=new E(Br,"BidirectionalLeft",6),Mr=new E(Br,"BidirectionalRight",7),Jr=new E(Br,"Forwards",8),Kr=new E(Br,"Reverse",9),Hr=new E(Br,"Ascending",10),Ir=new E(Br,"Descending",11),Fr=new E(Br,"Optimized",12),Gr=new E(Br,"Pythagorean",13),Rr=new E(Br,"Circular",14);Br.className="CircularLayout";Br.ConstantSpacing=Cr; Br.ConstantDistance=Pr;Br.ConstantAngle=Or;Br.Packed=Qr;Br.Clockwise=Er;Br.Counterclockwise=Nr;Br.BidirectionalLeft=Lr;Br.BidirectionalRight=Mr;Br.Forwards=Jr;Br.Reverse=Kr;Br.Ascending=Hr;Br.Descending=Ir;Br.Optimized=Fr;Br.Pythagorean=Gr;Br.Circular=Rr;function Dr(){this.ym=-Infinity;this.$m=this.Nk=null} Dr.prototype.compare=function(a,b){if(0<a&&0>this.ym||Math.abs(a)<Math.abs(this.ym)&&!(0>a&&0<this.ym))for(this.ym=a,this.Nk=[],this.$m=[],a=0;a<b.length;a++)this.Nk[a]=b[a].bounds.x,this.$m[a]=b[a].bounds.y};Dr.prototype.commit=function(a){if(null!==this.Nk&&null!==this.$m)for(var b=0;b<this.Nk.length;b++){var c=a.O(b);c.x=this.Nk[b];c.y=this.$m[b]}};Dr.className="VertexArrangement";function Sr(a){iq.call(this,a)}la(Sr,iq);Sr.prototype.createVertex=function(){return new es(this)}; Sr.prototype.createEdge=function(){return new fs(this)};Sr.className="CircularNetwork";function es(a){lq.call(this,a);this.L=this.Aj=NaN}la(es,lq); function Tr(a,b){var c=a.network;if(null===c)return NaN;c=c.layout;if(null===c)return NaN;if(c.arrangement===Qr)if(c.nodeDiameterFormula===Rr)a.Aj=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.Aj=Math.min(a.height/c,a.width/b)}else a.Aj=c.nodeDiameterFormula===Rr?Math.max(a.width,a.height):Math.sqrt(a.width*a.width+a.height*a.height);return a.Aj} ma.Object.defineProperties(es.prototype,{diameter:{configurable:!0,get:function(){return this.Aj},set:function(a){this.Aj!==a&&(A(a,"number",es,"diameter"),this.Aj=a)}},actualAngle:{configurable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(A(a,"number",es,"actualAngle"),this.L=a)}}});es.className="CircularVertex";function fs(a){mq.call(this,a)}la(fs,mq);fs.className="CircularEdge"; function gs(){0<arguments.length&&za(gs);Ni.call(this);this.Jh=null;this.zo=0;this.Hd=(new Hb(100,100)).freeze();this.mn=!1;this.qf=!0;this.fd=!1;this.Ll=100;this.Un=1;this.eg=1E3;this.Xo=10;this.yp=Math;this.gl=.05;this.fl=50;this.dl=150;this.el=0;this.Ln=10;this.Kn=5}la(gs,Ni); gs.prototype.cloneProtected=function(a){Ni.prototype.cloneProtected.call(this,a);a.Hd.assign(this.Hd);a.mn=this.mn;a.qf=this.qf;a.fd=this.fd;a.Ll=this.Ll;a.Un=this.Un;a.eg=this.eg;a.Xo=this.Xo;a.yp=this.yp;a.gl=this.gl;a.fl=this.fl;a.dl=this.dl;a.el=this.el;a.Ln=this.Ln;a.Kn=this.Kn};gs.prototype.createNetwork=function(){return new hs(this)}; gs.prototype.doLayout=function(a){F&&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));a=this.maxIterations;if(0<this.network.vertexes.count){this.network.yq();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.xv();this.zo=0;if(this.needsClusterLayout()){b=this.network;for(c=b.Ky().iterator;c.next();){this.network=c.value;for(var d=this.network.vertexes.iterator;d.next();){var e=d.value;e.Ed=e.vertexes.count;e.Uh=1;e.lk=null;e.Te=null}is(this,0,a)}this.network=b;c.reset();F&&w(b,hs,gs,"arrangeConnectedGraphs:singletons");d=this.arrangementSpacing;for(var f=c.count,g=!0,h=e=0,k=La(),l=0;l<f+b.vertexes.count+2;l++)k[l]=null;f=0;c.reset();for(var m=L.alloc();c.next();)if(l= c.value,this.computeBounds(l,m),g)g=!1,e=m.x+m.width/2,h=m.y+m.height/2,k[0]=new J(m.x+m.width+d.width,m.y),k[1]=new J(m.x,m.y+m.height+d.height),f=2;else{var n=js(k,f,e,h,m.width,m.height,d),p=k[n],r=new J(p.x+m.width+d.width,p.y),q=new J(p.x,p.y+m.height+d.height);n+1<f&&k.splice(n+1,0,null);k[n]=r;k[n+1]=q;f++;n=p.x-m.x;p=p.y-m.y;for(l=l.vertexes.iterator;l.next();)r=l.value,r.centerX+=n,r.centerY+=p}L.free(m);for(l=b.vertexes.iterator;l.next();)g=l.value,r=g.bounds,2>f?(e=r.x+r.width/2,h=r.y+ r.height/2,k[0]=new J(r.x+r.width+d.width,r.y),k[1]=new J(r.x,r.y+r.height+d.height),f=2):(m=js(k,f,e,h,r.width,r.height,d),p=k[m],n=new J(p.x+r.width+d.width,p.y),r=new J(p.x,p.y+r.height+d.height),m+1<f&&k.splice(m+1,0,null),k[m]=n,k[m+1]=r,f++,g.centerX=p.x+g.width/2,g.centerY=p.y+g.height/2);Oa(k);for(c.reset();c.next();){d=c.value;for(e=d.vertexes.iterator;e.next();)b.Mh(e.value);for(d=d.edges.iterator;d.next();)b.sq(d.value)}}ks(this,a);this.updateParts()}this.Ll=a;this.network=null;this.isValidLayout= !0};gs.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.Mc(c)&&(a++,2<a))return!0;if(10<b)break;b++}return!1};gs.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.Nc(d.bounds)}return b}; function ls(a,b,c){F&&(C(b,gs,"computeClusterLayoutIterations:level"),C(c,gs,"computeClusterLayoutIterations:maxiter"));return Math.max(Math.min(a.network.vertexes.count,c*(b+1)/11),10)} function is(a,b,c){F&&(C(b,gs,"layoutClusters:level"),C(c,gs,"layoutClusters:maxiter"));if(ms(a,b)){var d=a.eg;a.eg*=1+1/(b+1);var e=ns(a,b),f=Math.max(0,ls(a,b,c));a.maxIterations+=f;is(a,b+1,c);ks(a,f);os(a,e,b);c=e.vertexes.ua();c.sort(function(a,b){return null===a||null===b||a===b?0:b.Ed-a.Ed});for(e=0;e<c.length;e++)ps(a,c[e],b);a.eg=d}} function ms(a,b){F&&C(b,gs,"hasClusters:level");if(10<b||3>a.network.vertexes.count)return!1;a.Jh=a.network.vertexes.ua();a=a.Jh;a.sort(function(a,b){return null===a||null===b||a===b?0:b.Ed-a.Ed});for(b=a.length-1;0<=b&&1>=a[b].Ed;)b--;return 1<a.length-b} function ns(a,b){F&&C(b,gs,"pushSubNetwork:level");for(var c=a.network,d=new hs(a),e=0;e<a.Jh.length;e++){var f=a.Jh[e];if(1<f.Ed){d.Mh(f);var g=new qs;g.iu=f.Ed;g.ju=f.width;g.hu=f.height;g.Rw=f.focus.x;g.Sw=f.focus.y;null===f.Te&&(f.Te=new H);f.Te.add(g);f.uw=f.Te.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.sq(h):e.network===d?(h=e.lk,null===h&&(h=new H,e.lk=h),h.add(g),e.Ed--,e.Uh+=g.Uh):g.network===d&&(h=g.lk,null=== h&&(h=new H,g.lk=h),h.add(e),g.Ed--,g.Uh+=e.Uh)}for(e=d.edges.iterator;e.next();)f=e.value,f.length*=Math.max(1,K.sqrt((f.fromVertex.Uh+f.toVertex.Uh)/(4*b+1)));for(b=d.vertexes.iterator;b.next();){e=b.value;var k=e.lk;if(null!==k&&0<k.count&&(g=e.Te.O(e.Te.count-1).iu-e.Ed,!(0>=g))){for(var l=h=0,m=k.count-g;m<k.count;m++){var n=k.O(m),p=null;for(f=n.edges.iterator;f.next();){var r=f.value;if(r.ly(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 L(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 os(a,b,c){F&&(w(b,hs,gs,"popNetwork:oldnet"),C(c,gs,"popNetwork:level"));for(c=a.network.vertexes.iterator;c.next();){var d=c.value;d.network=b;if(null!==d.Te){var e=d.Te.O(d.uw);d.Ed=e.iu;var f=e.Rw,g=e.Sw;d.bounds=new L(d.centerX-f,d.centerY-g,e.ju,e.hu);d.focus=new J(f,g);d.uw--}}for(c=a.network.edges.iterator;c.next();)c.value.network=b;a.network=b} function ps(a,b,c){F&&(w(b,rs,gs,"surroundNode:oldnet"),C(c,gs,"surroundNode:level"));var d=b.lk;if(null!==d&&0!==d.count){c=b.centerX;var e=b.centerY,f=b.width,g=b.height;null!==b.Te&&0<b.Te.count&&(g=b.Te.O(0),f=g.ju,g=g.hu);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.Ed?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.Ed||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 js(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}gs.prototype.xv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)}; gs.prototype.addComments=function(a){var b=a.node;if(null!==b)for(b=b.Lv();b.next();){var c=b.value;if("Comment"===c.category&&c.isVisible()){var d=this.network.gj(c);null===d&&(d=this.network.nm(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.zk(a,d,null));c.length=this.defaultCommentSpringLength}}}; function ss(a,b){F&&(w(a,rs,gs,"getNodeDistance:vertexA"),w(b,rs,gs,"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 ks(a,b){F&&C(b,gs,"performIterations:num");a.Jh=null;for(b=a.zo+b;a.zo<b&&(a.zo++,ts(a)););a.Jh=null} function ts(a){null===a.Jh&&(a.Jh=a.network.vertexes.ua());var b=a.Jh;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.eg;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=ss(g,p);1>q?(d=a.randomNumberGenerator,null===d&&(a.randomNumberGenerator=d=new us),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=ss(c,f),1>n?(n=a.randomNumberGenerator,null===n&&(a.randomNumberGenerator=n=new us),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}gs.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};gs.prototype.moveFixedVertex=function(){};gs.prototype.commitLayout=function(){this.yw();this.commitNodes();this.isRouting&&this.commitLinks()}; gs.prototype.yw=function(){if(this.setsPortSpots)for(var a=this.network.edges.iterator;a.next();){var b=a.value.link;null!==b&&(b.fromSpot=ld,b.toSpot=ld)}};gs.prototype.commitNodes=function(){var a=0,b=0;if(this.arrangesToOrigin){var c=L.alloc();this.computeBounds(this.network,c);b=this.arrangementOrigin;a=b.x-c.x;b=b.y-c.y;L.free(c)}c=L.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()}L.free(c)}; gs.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()};gs.prototype.springStiffness=function(a){a=a.stiffness;return isNaN(a)?this.gl:a};gs.prototype.springLength=function(a){a=a.length;return isNaN(a)?this.fl:a};gs.prototype.electricalCharge=function(a){a=a.charge;return isNaN(a)?this.dl:a};gs.prototype.electricalFieldX=function(){return 0};gs.prototype.electricalFieldY=function(){return 0}; gs.prototype.gravitationalMass=function(a){a=a.mass;return isNaN(a)?this.el:a};gs.prototype.gravitationalFieldX=function(){return 0};gs.prototype.gravitationalFieldY=function(){return 0};gs.prototype.isFixed=function(a){return a.isFixed}; ma.Object.defineProperties(gs.prototype,{currentIteration:{configurable:!0,get:function(){return this.zo}},arrangementSpacing:{configurable:!0,get:function(){return this.Hd},set:function(a){w(a,Hb,gs,"arrangementSpacing");this.Hd.A(a)||(this.Hd.assign(a),this.D())}},arrangesToOrigin:{configurable:!0,get:function(){return this.mn},set:function(a){this.mn!==a&&(A(a,"boolean",gs,"arrangesToOrigin"),this.mn=a,this.D())}},setsPortSpots:{configurable:!0, get:function(){return this.qf},set:function(a){this.qf!==a&&(A(a,"boolean",gs,"setsPortSpots"),this.qf=a,this.D())}},comments:{configurable:!0,get:function(){return this.fd},set:function(a){this.fd!==a&&(A(a,"boolean",gs,"comments"),this.fd=a,this.D())}},maxIterations:{configurable:!0,get:function(){return this.Ll},set:function(a){this.Ll!==a&&(A(a,"number",gs,"maxIterations"),0<=a&&(this.Ll=a,this.D()))}},epsilonDistance:{configurable:!0,get:function(){return this.Un}, set:function(a){this.Un!==a&&(A(a,"number",gs,"epsilonDistance"),0<a&&(this.Un=a,this.D()))}},infinityDistance:{configurable:!0,get:function(){return this.eg},set:function(a){this.eg!==a&&(A(a,"number",gs,"infinityDistance"),1<a&&(this.eg=a,this.D()))}},moveLimit:{configurable:!0,get:function(){return this.Xo},set:function(a){this.Xo!==a&&(A(a,"number",gs,"moveLimit"),1<a&&(this.Xo=a,this.D()))}},randomNumberGenerator:{configurable:!0,get:function(){return this.yp}, set:function(a){this.yp!==a&&(null!==a&&"function"!==typeof a.random&&v('ForceDirectedLayout.randomNumberGenerator must have a "random()" function on it: '+a),this.yp=a)}},defaultSpringStiffness:{configurable:!0,get:function(){return this.gl},set:function(a){this.gl!==a&&(A(a,"number",gs,"defaultSpringStiffness"),this.gl=a,this.D())}},defaultSpringLength:{configurable:!0,get:function(){return this.fl},set:function(a){this.fl!==a&&(A(a,"number",gs,"defaultSpringLength"), this.fl=a,this.D())}},defaultElectricalCharge:{configurable:!0,get:function(){return this.dl},set:function(a){this.dl!==a&&(A(a,"number",gs,"defaultElectricalCharge"),this.dl=a,this.D())}},defaultGravitationalMass:{configurable:!0,get:function(){return this.el},set:function(a){this.el!==a&&(A(a,"number",gs,"defaultGravitationalMass"),this.el=a,this.D())}},defaultCommentSpringLength:{configurable:!0,get:function(){return this.Ln},set:function(a){this.Ln!== a&&(A(a,"number",gs,"defaultCommentSpringLength"),this.Ln=a,this.D())}},defaultCommentElectricalCharge:{configurable:!0,get:function(){return this.Kn},set:function(a){this.Kn!==a&&(A(a,"number",gs,"defaultCommentElectricalCharge"),this.Kn=a,this.D())}}});gs.className="ForceDirectedLayout";function qs(){this.Sw=this.Rw=this.hu=this.ju=this.iu=0}qs.className="ForceDirectedSubnet";function hs(a){iq.call(this,a)}la(hs,iq);hs.prototype.createVertex=function(){return new rs(this)}; hs.prototype.createEdge=function(){return new vs(this)};hs.className="ForceDirectedNetwork";function rs(a){lq.call(this,a);this.Na=!1;this.ib=this.L=NaN;this.Uh=this.Ed=this.Ma=this.$=0;this.Te=this.lk=null;this.uw=0}la(rs,lq); ma.Object.defineProperties(rs.prototype,{isFixed:{configurable:!0,get:function(){return this.Na},set:function(a){this.Na!==a&&(A(a,"boolean",rs,"isFixed"),this.Na=a)}},charge:{configurable:!0,get:function(){return this.L},set:function(a){this.L!==a&&(A(a,"number",rs,"charge"),this.L=a)}},mass:{configurable:!0,get:function(){return this.ib},set:function(a){this.ib!==a&&(A(a,"number",rs,"mass"),this.ib=a)}},forceX:{configurable:!0,get:function(){return this.$}, set:function(a){this.$!==a&&(A(a,"number",rs,"forceX"),this.$=a)}},forceY:{configurable:!0,get:function(){return this.Ma},set:function(a){this.Ma!==a&&(A(a,"number",rs,"forceY"),this.Ma=a)}}});rs.className="ForceDirectedVertex";function vs(a){mq.call(this,a);this.l=this.w=NaN}la(vs,mq); ma.Object.defineProperties(vs.prototype,{stiffness:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(A(a,"number",vs,"stiffness"),this.w=a)}},length:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(A(a,"number",vs,"length"),this.l=a)}}});vs.className="ForceDirectedEdge"; function us(){var a=0;void 0===a&&(a=42);this.seed=a;this.My=48271;this.Oy=2147483647;this.Q=44488.07041494893;this.Qy=3399;this.Ny=1/2147483647;this.random()}us.prototype.random=function(){var a=this.seed%this.Q*this.My-this.seed/this.Q*this.Qy;0<a?this.seed=a:this.seed=a+this.Oy;return this.seed*this.Ny};us.className="RandomNumberGenerator"; function ws(){0<arguments.length&&za(ws);Ni.call(this);this.ec=this.ye=25;this.M=0;this.bl=xs;this.Gl=ys;this.vl=zs;this.Lj=4;this.Rk=As;this.vg=7;this.qf=!0;this.Ho=4;this.Ia=this.qs=this.Ea=-1;this.yd=this.So=0;this.La=this.wd=this.xd=this.Sd=this.mc=null;this.bp=0;this.ap=this.Qj=null;this.Wd=0;this.cp=null;this.Sf=new J;this.Ce=[];this.Ce.length=100}la(ws,Ni); ws.prototype.cloneProtected=function(a){Ni.prototype.cloneProtected.call(this,a);a.ye=this.ye;a.ec=this.ec;a.M=this.M;a.bl=this.bl;a.Gl=this.Gl;a.vl=this.vl;a.Lj=this.Lj;a.Rk=this.Rk;a.vg=this.vg;a.qf=this.qf;a.Ho=this.Ho}; ws.prototype.mb=function(a){a.classType===ws?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):Ni.prototype.mb.call(this,a)};ws.prototype.createNetwork=function(){return new Bs(this)}; ws.prototype.doLayout=function(a){F&&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.qs=-1;this.yd=this.So=0;this.cp=this.ap=this.Qj=null;for(a=0;a<this.Ce.length;a++)this.Ce[a]=null;if(0<this.network.vertexes.count){this.network.yq();this.cycleRemoveOption!==Cs&&this.removeCycles();for(a=this.network.vertexes.iterator;a.next();)a.value.layer= -1;this.Ea=-1;this.assignLayers();for(a.reset();a.next();)this.Ea=Math.max(this.Ea,a.value.layer);this.cycleRemoveOption===Cs&&this.removeCycles();a=this.network;for(var b=[],c=a.edges.iterator;c.next();){var d=c.value;d.valid=!1;b.push(d)}for(c=0;c<b.length;c++){d=b[c];var e=d.fromVertex,f=d.toVertex;if(!d.valid&&(null!==e.node&&null!==f.node||e.layer!==f.layer)){var g=0,h=0,k=0,l=0;if(null!==d.link){h=d.link;if(null===h)continue;var m=e.node;g=f.node;if(null===m||null===g)continue;var n=h.fromNode; k=h.toNode;var p=h.fromPort;h=h.toPort;if(d.rev){l=n;var 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.o()&&n.isVisible()?n.actualBounds.o()?(n.Hf(p,Mc,r),r.x+=n.actualBounds.x-u.x,r.y+=n.actualBounds.y-u.y):(n.Hf(p,Mc,r),r.o()||r.assign(q)):r.assign(q):u.o()?(n.Hf(p,Mc,r),r.o()||r.assign(q)):r.assign(q);n=d.rev?e.bounds:f.bounds;m=J.alloc();g!==k?n.o()&&k.isVisible()?k.actualBounds.o()?(k.Hf(h,Mc,m),m.x+=k.actualBounds.x-n.x,m.y+=k.actualBounds.y-n.y): (k.Hf(h,Mc,m),m.o()||m.assign(l)):m.assign(l):n.o()?(k.Hf(h,Mc,m),m.o()||m.assign(l)):m.assign(l);90===this.M||270===this.M?(g=Math.round((r.x-q.x)/this.ec),k=r.x,h=Math.round((m.x-l.x)/this.ec),l=m.x):(g=Math.round((r.y-q.y)/this.ec),k=r.y,h=Math.round((m.y-l.y)/this.ec),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 x= u.fromPort,y=u.toPort;if(null!==x&&null!==y){var z=u.fromNode;p=u.toNode;if(null!==z&&null!==p){var B=Ds(this,!0),D=Ds(this,!1),G=this.setsPortSpots?B:u.computeSpot(!0,x);q=this.setsPortSpots?D:u.computeSpot(!1,y);var O=u.isOrthogonal;G.nd()&&G.If(D)&&q.nd()&&q.If(B)?n=0:(B=u.getLinkPoint(z,x,G,!0,O,p,y,J.alloc()),D=u.getLinkDirection(z,x,B,G,!0,O,p,y),J.free(B),G.Kq()||D!==Es(this,d,!0)?this.setsPortSpots&&null!==z&&1===z.ports.count&&d.rev&&(n+=1):n+=1,G=u.getLinkPoint(p,y,q,!1,O,z,x,J.alloc()), u=u.getLinkDirection(p,y,G,q,!1,O,z,x),J.free(G),q.Kq()||u!==Es(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.hk=1,q.layer=r,q.near=e,a.Mh(q),e=a.zk(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.hk=2;q.layer=r-1;a.Mh(q);e=a.zk(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.hk=3,q.layer=r-1,a.Mh(q),e=a.zk(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.zk(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.mc=[];for(b=0;b<=this.Ea;b++)a[b]=0;for(b=this.network.vertexes.iterator;b.next();)b.value.index= -1;this.initializeIndices();this.qs=-1;for(c=this.yd=this.So=0;c<=this.Ea;c++)a[c]>a[this.yd]&&(this.qs=a[c]-1,this.yd=c),a[c]<a[this.So]&&(this.So=c);this.cp=[];for(c=0;c<a.length;c++)this.cp[c]=[];for(b.reset();b.next();)a=b.value,this.cp[a.layer][a.index]=a;this.Ia=-1;for(a=0;a<=this.Ea;a++){b=Fs(this,a);c=0;d=this.mc[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.Ia=Math.max(this.Ia,c-1);Gs(this,a,b)}this.reduceCrossings();this.straightenAndPack(); this.updateParts()}this.network=null;this.isValidLayout=!0};ws.prototype.linkMinLength=function(){return 1};function Hs(a){var b=a.fromVertex.node;a=a.toVertex.node;return null===b&&null===a?8:null===b||null===a?4:1}ws.prototype.nodeMinLayerSpace=function(a,b){return null===a.node?0:90===this.M||270===this.M?b?a.focus.y+10:a.bounds.height-a.focus.y+10:b?a.focus.x+10:a.bounds.width-a.focus.x+10}; ws.prototype.nodeMinColumnSpace=function(a,b){if(null===a.node)return 0;var c=b?a.gw:a.fw;if(null!==c)return c;c=this.M;return 90===c||270===c?b?a.gw=a.focus.x/this.ec+1|0:a.fw=(a.bounds.width-a.focus.x)/this.ec+1|0:b?a.gw=a.focus.y/this.ec+1|0:a.fw=(a.bounds.height-a.focus.y)/this.ec+1|0};function Is(a){null===a.Qj&&(a.Qj=[]);for(var b=0,c=a.network.vertexes.iterator;c.next();){var d=c.value;a.Qj[b]=d.layer;b++;a.Qj[b]=d.column;b++;a.Qj[b]=d.index;b++}return a.Qj} function Js(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 Ks(a,b,c){F&&(C(b,ws,"crossingMatrix:unfixedLayer"),C(c,ws,"crossingMatrix:direction"));var d=Fs(a,b),e=a.mc[b];if(null===a.ap||a.ap.length<e*e)a.ap=[];for(var f=a.ap,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.hk===l.hk||h++}else for(m=g-1;m>k;m--)n=d[m],n.near===l&&n.hk===l.hk||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 x=q.portToPos;q=q.portFromPos;m<x&&(n>u||n===u&&r>q)&&h++;x<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,x=q.portToPos,q=q.portFromPos, r<q&&(n>u||n===u&&m>x)&&h++,q<r&&(u>n||u===n&&x>m)&&h++);f[g*e+g]=h;for(k=g+1;k<e;k++){var y=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)&&y++)}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,x=q.portToPos,(n<u||n===u&&m<x)&&z++,(u<n||u===n&&x<m)&&y++);f[g*e+k]=y;f[k*e+g]=z}}Gs(a,b,d);return f}ws.prototype.countCrossings=function(){for(var a=0,b=0;b<=this.Ea;b++)for(var c=Ks(this,b,1),d=this.mc[b],e=0;e<d;e++)for(var f=e;f<d;f++)a+=c[e*d+f];return a}; function Ls(a){for(var b=0,c=0;c<=a.Ea;c++){for(var d=a,e=c,f=Fs(d,e),g=d.mc[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)*Hs(n)}}}Gs(d,e,f);b+=h}return b} ws.prototype.normalize=function(){var a=Infinity;this.Ia=-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.Ia=Math.max(this.Ia,c.column+this.nodeMinColumnSpace(c,!1))}for(b.reset();b.next();)b.value.column-=a;this.Ia-=a}; function Ms(a,b,c){F&&(C(b,ws,"barycenters:unfixedLayer"),C(c,ws,"barycenters:direction"));for(var d=Fs(a,b),e=a.mc[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}Gs(a,b,d);return f} function Ns(a,b,c){F&&(C(b,ws,"medians:unfixedLayer"),C(c,ws,"medians:direction"));for(var d=Fs(a,b),e=a.mc[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)}Gs(a,b,d);return f} function Os(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&&Os(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&&Os(a,k,c,d,e,f)}} function Ps(a,b,c,d,e,f){if(b.component===d){b.component=c;if(e)for(var g=b.destinationEdges;g.next();)Ps(a,g.value.toVertex,c,d,e,f);if(f)for(b=b.sourceEdges;b.next();)Ps(a,b.value.fromVertex,c,d,e,f)}} ws.prototype.removeCycles=function(){for(var a=this.network.edges.iterator;a.next();)a.value.rev=!1;switch(this.bl){default:case Qs: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!==Rs(a);){for(e=Ss(a);null!==e;)d[c]=e,c--,e.valid=!1,e=Ss(a);for(e=Ts(a);null!==e;)d[b]=e,b++,e.valid=!1,e=Ts(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.Tm(b),b.rev=!0);break;case xs:for(d=this.network.vertexes.iterator;d.next();)a=d.value,a.tm=-1,a.finish=-1;for(a=this.network.edges.iterator;a.next();)a.value.forest=!1;this.bp=0;for(d.reset();d.next();)b=d.value,0===b.sourceEdges.count&& Us(this,b);for(d.reset();d.next();)b=d.value,-1===b.tm&&Us(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.tm<b.tm&&c<f&&(this.network.Tm(d),d.rev=!0));break;case Cs: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.Tm(b),b.rev=!0)}}};function Rs(a){for(a=a.vertexes.iterator;a.next();){var b=a.value;if(b.valid)return b}return null}function Ss(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 Ts(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 Us(a,b){b.tm=a.bp;a.bp++;for(var c=b.destinationEdges;c.next();){var d=c.value,e=d.toVertex;-1===e.tm&&(d.forest=!0,Us(a,e))}b.finish=a.bp;a.bp++} ws.prototype.assignLayers=function(){switch(this.Gl){case Vs:Ws(this);break;case Xs:for(var a,b=this.network.vertexes.iterator;b.next();)a=Ys(this,b.value),this.Ea=Math.max(a,this.Ea);for(b.reset();b.next();)a=b.value,a.layer=this.Ea-a.layer;break;default:case ys:Ws(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&&Zs(this,a);a=Infinity;for(b.reset();b.next();)a=Math.min(a,b.value.layer);this.Ea=-1;for(b.reset();b.next();){var c= b.value;c.layer-=a;this.Ea=Math.max(this.Ea,c.layer)}}};function Ws(a){for(var b=a.network.vertexes.iterator;b.next();){var c=$s(a,b.value);a.Ea=Math.max(c,a.Ea)}}function $s(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,$s(a,f)+e)}b.layer=c}else c=b.layer;return c} function Ys(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,Ys(a,f)+e)}b.layer=c}else c=b.layer;return c} function Zs(a,b){if(!b.valid){b.valid=!0;for(var c=b.destinationEdges;c.next();)Zs(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&&Os(a,h,0,-1,!0,!1)}for(Os(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(Os(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 Es(a,b,c){return 90===a.M?c&&!b.rev||!c&&b.rev?270:90:180===a.M?c&&!b.rev||!c&&b.rev?0:180:270===a.M?c&&!b.rev||!c&&b.rev?90:270:c&&!b.rev||!c&&b.rev?180:0} ws.prototype.initializeIndices=function(){switch(this.vl){default:case at:for(var a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;b.index=this.mc[c];this.mc[c]++}break;case zs:a=this.network.vertexes.iterator;for(b=this.Ea;0<=b;b--)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&bt(this,c);break;case ct:for(a=this.network.vertexes.iterator,b=0;b<=this.Ea;b++)for(a.reset();a.next();)c=a.value,c.layer===b&&-1===c.index&&dt(this,c)}}; function bt(a,b){var c=b.layer;b.index=a.mc[c];a.mc[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&&bt(a,d))} function dt(a,b){var c=b.layer;b.index=a.mc[c];a.mc[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&&dt(a,d))} ws.prototype.reduceCrossings=function(){var a=this.countCrossings(),b=Is(this),c,d;for(c=0;c<this.Lj;c++){for(d=0;d<=this.Ea;d++)et(this,d,1),ft(this,d,1);var e=this.countCrossings();e<a&&(a=e,b=Is(this));for(d=this.Ea;0<=d;d--)et(this,d,-1),ft(this,d,-1);e=this.countCrossings();e<a&&(a=e,b=Is(this))}Js(this,b);for(c=0;c<this.Lj;c++){for(d=0;d<=this.Ea;d++)et(this,d,0),ft(this,d,0);e=this.countCrossings();e<a&&(a=e,b=Is(this));for(d=this.Ea;0<=d;d--)et(this,d,0),ft(this,d,0);e=this.countCrossings(); e<a&&(a=e,b=Is(this))}Js(this,b);var f,g,h;switch(this.Rk){case gt:break;case ht:for(h=a+1;(d=this.countCrossings())<h;)for(h=d,c=this.Ea;0<=c;c--)for(g=0;g<=c;g++){for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,-1)||f;e=this.countCrossings();e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,1)||f;e=this.countCrossings();e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ft(this,d,1)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f= ft(this,d,-1)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,0)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ft(this,d,0)||f;e>=a?Js(this,b):(a=e,b=Is(this))}break;default:case As:for(c=this.Ea,g=0,h=a+1;(d=this.countCrossings())<h;){h=d;for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,-1)||f;e=this.countCrossings();e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,1)||f;e=this.countCrossings();e>=a?Js(this,b): (a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ft(this,d,1)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ft(this,d,-1)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=c;d>=g;d--)f=ft(this,d,0)||f;e>=a?Js(this,b):(a=e,b=Is(this));for(f=!0;f;)for(f=!1,d=g;d<=c;d++)f=ft(this,d,0)||f;e>=a?Js(this,b):(a=e,b=Is(this))}}Js(this,b)}; function et(a,b,c){F&&(C(b,ws,"medianBarycenterCrossingReduction:unfixedLayer"),C(c,ws,"medianBarycenterCrossingReduction:direction"));var d=Fs(a,b),e=a.mc[b],f=Ns(a,b,c),g=Ms(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);Gs(a,b,d)} function ft(a,b,c){var d=Fs(a,b),e=a.mc[b];c=Ks(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,x=a.nodeMinColumnSpace(d[f],!0),y=a.nodeMinColumnSpace(d[f],!1),z=a.nodeMinColumnSpace(d[f+1],!0),B=a.nodeMinColumnSpace(d[f+1],!1);x=q-x+z;y=u-y+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 G=h[d[f].index],O=g[d[f+1].index],X=h[d[f+1].index];-1!==D&&(B+=Math.abs(D-q),z+=Math.abs(D-y));-1!==G&&(B+=Math.abs(G-q),z+=Math.abs(G-y));-1!==O&&(B+=Math.abs(O-u),z+=Math.abs(O-x));-1!==X&&(B+=Math.abs(X-u),z+=Math.abs(X-x));if(r<p-.5||r===p&&n<m-.5||r===p&&n===m&&z<B-.5)l=k=!0,d[f].column=y,d[f+1].column=x,m=d[f],d[f]=d[f+1],d[f+1]=m}for(f=0;f<e;f++)d[f].index= f;Gs(a,b,d);return k} ws.prototype.straightenAndPack=function(){var a=0!==(this.vg&1);var b=7===this.vg;1E3<this.network.edges.count&&!b&&(a=!1);if(a){var c=[];for(b=0;b<=this.Ea;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.Ia-c[b])>>1)+8*d;this.Ia*=8}if(0!==(this.vg&2))for(c=!0;c;){c=!1;for(b=this.yd+1;b<=this.Ea;b++)c=it(this,b,1)||c;for(b= this.yd-1;0<=b;b--)c=it(this,b,-1)||c;c=it(this,this.yd,0)||c}if(0!==(this.vg&4)){for(b=this.yd+1;b<=this.Ea;b++)jt(this,b,1);for(b=this.yd-1;0<=b;b--)jt(this,b,-1);jt(this,this.yd,0)}a&&(kt(this,-1),kt(this,1));if(0!==(this.vg&2))for(c=!0;c;){c=!1;c=it(this,this.yd,0)||c;for(b=this.yd+1;b<=this.Ea;b++)c=it(this,b,0)||c;for(b=this.yd-1;0<=b;b--)c=it(this,b,0)||c}}; function it(a,b,c){F&&(C(b,ws,"bendStraighten:unfixedLayer"),C(c,ws,"bendStraighten:direction"));for(var d=!1;lt(a,b,c);)d=!0;return d} function lt(a,b,c){F&&(C(b,ws,"shiftbendStraighten:unfixedLayer"),C(c,ws,"shiftbendStraighten:direction"));var d,e=Fs(a,b),f=a.mc[b],g=Ms(a,b,-1);if(0<c)for(d=0;d<f;d++)g[d]=-1;var h=Ms(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 x=e[d].sourceEdges.iterator;x.next();){var y=x.value;var z=y.fromVertex;if(y.valid&&z.layer!==b){var B=Hs(y);var D=y.portFromColOffset;y=y.portToColOffset;z=z.column;p+=(Math.abs(m+y-(z+D))+1)*B;q+=(Math.abs(r+y-(z+D))+1)*B;u+=(Math.abs(n+y-(z+D))+1)*B}}if(0<=c)for(x=e[d].destinationEdges.iterator;x.next();)y=x.value,z=y.toVertex,y.valid&&z.layer!==b&&(B=Hs(y),D=y.portFromColOffset,y=y.portToColOffset,z=z.column,p+=(Math.abs(m+D-(z+y))+1)*B,q+=(Math.abs(r+D-(z+y))+1)*B,u+=(Math.abs(n+ D-(z+y))+1)*B);y=D=B=0;x=g[e[d].index];z=h[e[d].index];-1!==x&&(B+=Math.abs(x-m),D+=Math.abs(x-r),y+=Math.abs(x-n));-1!==z&&(B+=Math.abs(z-m),D+=Math.abs(z-r),y+=Math.abs(z-n));if(q<p||q===p&&D<B)l=k=!0,e[d].column=r;else if(u<p||u===p&&y<B)l=k=!0,e[d].column=n}Gs(a,b,e);a.normalize();return k} function jt(a,b,c){F&&(C(b,ws,"medianStraighten:unfixedLayer"),C(c,ws,"medianStraighten:direction"));var d=Fs(a,b),e=a.mc[b],f=Ns(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)}Gs(a,b, d);a.normalize()}function mt(a,b){F&&(C(b,ws,"packAux:column"),C(1,ws,"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 nt(a,b){F&&(C(b,ws,"tightPackAux:column"),C(1,ws,"tightPackAux:direction"));var c=b+1;var d,e=[],f=[];for(d=0;d<=a.Ea;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.Ea;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 kt(a,b){F&&C(b,ws,"componentPack:direction");for(var c=0;c<=a.Ia;c++)for(;mt(a,c););a.normalize();for(c=0;c<a.Ia;c++)for(;nt(a,c););a.normalize();var d;if(0<b)for(c=0;c<=a.Ia;c++){var e=Is(a);var f=Ls(a);for(d=f+1;f<d;){d=f;ot(a,c,1);var g=Ls(a);g>f?Js(a,e):g<f&&(f=g,e=Is(a))}}if(0>b)for(c=a.Ia;0<=c;c--)for(e=Is(a),f=Ls(a),d=f+1;f<d;)d=f,ot(a,c,-1),g=Ls(a),g>f?Js(a,e):g<f&&(f=g,e=Is(a));a.normalize()} function ot(a,b,c){a.Wd=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.Wd)}if(0>c)for(d.reset();d.next();)e=d.value,e.column+a.nodeMinColumnSpace(e,!1)>=b&&(e.component=a.Wd);a.Wd++;for(d.reset();d.next();)b=d.value,-1===b.component&&(Ps(a,b,a.Wd,-1,!0,!0),a.Wd++);var f;b=[];for(f=0;f<a.Wd*a.Wd;f++)b[f]=!1;e=[];for(f=0;f<(a.Ea+1)*(a.Ia+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.Ia,f.column+a.nodeMinColumnSpace(f,!1));h<=k;h++)e[g*(a.Ia+1)+h]=f.component}for(f=0;f<=a.Ea;f++){if(0<c)for(g=0;g<a.Ia;g++)-1!==e[f*(a.Ia+1)+g]&&-1!==e[f*(a.Ia+1)+g+1]&&e[f*(a.Ia+1)+g]!==e[f*(a.Ia+1)+g+1]&&(b[e[f*(a.Ia+1)+g]*a.Wd+e[f*(a.Ia+1)+g+1]]=!0);if(0>c)for(g=a.Ia;0<g;g--)-1!==e[f*(a.Ia+1)+g]&&-1!==e[f*(a.Ia+1)+g-1]&&e[f*(a.Ia+1)+g]!==e[f*(a.Ia+1)+g-1]&&(b[e[f*(a.Ia+1)+g]*a.Wd+e[f*(a.Ia+1)+g-1]]=!0)}e= [];for(f=0;f<a.Wd;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.Wd;f++)b[k*a.Wd+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)} ws.prototype.commitLayout=function(){if(this.setsPortSpots)for(var a=Ds(this,!0),b=Ds(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.zv();this.isRouting&&this.commitLinks()};function Ds(a,b){return 270===a.M?b?qd:td:90===a.M?b?td:qd:180===a.M?b?rd:sd:b?sd:rd} ws.prototype.commitNodes=function(){this.Sd=[];this.xd=[];this.wd=[];this.La=[];for(var a=0;a<=this.Ea;a++)this.Sd[a]=0,this.xd[a]=0,this.wd[a]=0,this.La[a]=0;for(a=this.network.vertexes.iterator;a.next();){var b=a.value,c=b.layer;this.Sd[c]=Math.max(this.Sd[c],this.nodeMinLayerSpace(b,!0));this.xd[c]=Math.max(this.xd[c],this.nodeMinLayerSpace(b,!1))}b=0;c=this.ye;for(var d=0;d<=this.Ea;d++){var e=c;0>=this.Sd[d]+this.xd[d]&&(e=0);0<d&&(b+=e/2);90===this.M||0===this.M?(b+=this.xd[d],this.wd[d]=b, b+=this.Sd[d]):(b+=this.Sd[d],this.wd[d]=b,b+=this.xd[d]);d<this.Ea&&(b+=e/2);this.La[d]=b}c=b;b=this.arrangementOrigin;for(d=0;d<=this.Ea;d++)270===this.M?this.wd[d]=b.y+this.wd[d]:90===this.M?(this.wd[d]=b.y+c-this.wd[d],this.La[d]=c-this.La[d]):180===this.M?this.wd[d]=b.x+this.wd[d]:(this.wd[d]=b.x+c-this.wd[d],this.La[d]=c-this.La[d]);a.reset();for(c=d=Infinity;a.next();){e=a.value;var f=e.layer,g=e.column|0;if(270===this.M||90===this.M){var h=b.x+this.ec*g;f=this.wd[f]}else h=this.wd[f],f=b.y+ this.ec*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.Sf=new J(d,b);for(a.reset();a.next();)c=a.value,c.x+=d,c.y+=b,c.commit()}; ws.prototype.zv=function(){for(var a=0,b=this.ye,c=0;c<=this.Ea;c++)a+=this.Sd[c],a+=this.xd[c];a+=this.Ea*b;b=[];c=this.ec*this.Ia;for(var d=this.maxLayer;0<=d;d--)270===this.M?0===d?b.push(new L(0,0,c,Math.abs(this.La[0]))):b.push(new L(0,this.La[d-1],c,Math.abs(this.La[d-1]-this.La[d]))):90===this.M?0===d?b.push(new L(0,this.La[0],c,Math.abs(this.La[0]-a))):b.push(new L(0,this.La[d],c,Math.abs(this.La[d-1]-this.La[d]))):180===this.M?0===d?b.push(new L(0,0,Math.abs(this.La[0]),c)):b.push(new L(this.La[d- 1],0,Math.abs(this.La[d-1]-this.La[d]),c)):0===d?b.push(new L(this.La[0],0,Math.abs(this.La[0]-a),c)):b.push(new L(this.La[d],0,Math.abs(this.La[d-1]-this.La[d]),c));this.commitLayers(b,this.Sf)};ws.prototype.commitLayers=function(){}; ws.prototype.commitLinks=function(){for(var a=this.network.edges.iterator,b;a.next();)b=a.value.link,null!==b&&(b.Vh(),b.kk(),b.Df());for(a.reset();a.next();)b=a.value.link,null!==b&&b.tj();for(a.reset();a.next();){var c=a.value;b=c.link;if(null!==b){b.Vh();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===rg&&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.o()||c.set(e.actualBounds.center),g.o()||g.set(f.actualBounds.center),b.kk(),b.Cf(c.x,c.y),b.Cf((2*c.x+g.x)/3,(2*c.y+g.y)/3),b.Cf((c.x+2*g.x)/3,(c.y+2*g.y)/3),b.Cf(g.x,g.y);else{var p=!1,r=!1;null!==g&&l===Gc&&(p=!0);null!==h&&k===Gc&&(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.M||270===this.M?(p=q,n= (c+d)/2):(p=(q+m)/2,n=c),b.N(1,p,n),l=b.getLinkPoint(e,g,l,!0,!1,f,h),l.o()||l.set(e.actualBounds.center),b.N(0,l.x,l.y));r&&(90===this.M||270===this.M?(l=m,c=(c+d)/2):(l=(q+m)/2,c=d),b.N(2,l,c),e=b.getLinkPoint(f,h,k,!1,!1,e,g),e.o()||e.set(f.actualBounds.center),b.N(3,e.x,e.y))}}b.Df()}else if(m.layer===n.layer)b.Df();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===rg)r=!0,u=b.pointsCount,4<u&&b.points.removeRange(2, u-3),4===u&&(q=2);else{u=b.pointsCount;var x=l===Gc,y=k===Gc;2<u&&x&&y?b.points.removeRange(1,u-2):3<u&&x&&!y?b.points.removeRange(1,u-3):3<u&&!x&&y?b.points.removeRange(2,u-2):4<u&&!x&&!y&&b.points.removeRange(2,u-3)}if(c.rev){for(;null!==n&&m!==n;){var z=u=null;for(x=n.sourceEdges.iterator;x.next()&&(y=x.value,y.link!==c.link||(u=y.fromVertex,z=y.toVertex,null!==u.node)););if(u!==m){x=b.i(q-1).x;y=b.i(q-1).y;var B=u.centerX;var D=u.centerY;if(p)180===this.M||0===this.M?q===b.firstPickIndex+1?(b.m(q++, x,y),b.m(q++,x,D)):(null!==z?z.centerY:y)!==D&&(z=this.La[u.layer-1]+this.Sf.x,b.m(q++,z,y),b.m(q++,z,D)):q===b.firstPickIndex+1?(b.m(q++,x,y),b.m(q++,B,y)):(null!==z?z.centerX:x)!==B&&(z=this.La[u.layer-1]+this.Sf.y,b.m(q++,x,z),b.m(q++,B,z));else if(q===b.firstPickIndex+1){z=Math.max(10,this.Sd[n.layer]);var G=Math.max(10,this.xd[n.layer]);if(r)180===this.M?B<=n.bounds.x?(n=n.bounds.x,b.m(q++,n-z,D),b.m(q++,n,D),b.m(q++,n+G,D)):(b.m(q++,B-z,D),b.m(q++,B,D),b.m(q++,B+G,D)):90===this.M?D>=n.bounds.bottom? (n=n.bounds.y+n.bounds.height,b.m(q++,B,n+G),b.m(q++,B,n),b.m(q++,B,n-z)):(b.m(q++,B,D+G),b.m(q++,B,D),b.m(q++,B,D-z)):270===this.M?D<=n.bounds.y?(n=n.bounds.y,b.m(q++,B,n-z),b.m(q++,B,n),b.m(q++,B,n+G)):(b.m(q++,B,D-z),b.m(q++,B,D),b.m(q++,B,D+G)):0===this.M&&(B>=n.bounds.right?(n=n.bounds.x+n.bounds.width,b.m(q++,n+G,D),b.m(q++,n,D),b.m(q++,n-z,D)):(b.m(q++,B+G,D),b.m(q++,B,D),b.m(q++,B-z,D)));else{b.m(q++,x,y);var O=0;if(180===this.M||0===this.M){if(180===this.M?B>=n.bounds.right:B<=n.bounds.x)O= (0===this.M?-z:G)/2;b.m(q++,x+O,D)}else{if(270===this.M?D>=n.bounds.bottom:D<=n.bounds.y)O=(90===this.M?-z:G)/2;b.m(q++,B,y+O)}b.m(q++,B,D)}}else z=Math.max(10,this.Sd[u.layer]),G=Math.max(10,this.xd[u.layer]),180===this.M?(r&&b.m(q++,B-z,D),b.m(q++,B,D),r&&b.m(q++,B+G,D)):90===this.M?(r&&b.m(q++,B,D+G),b.m(q++,B,D),r&&b.m(q++,B,D-z)):270===this.M?(r&&b.m(q++,B,D-z),b.m(q++,B,D),r&&b.m(q++,B,D+G)):(r&&b.m(q++,B+G,D),b.m(q++,B,D),r&&b.m(q++,B-z,D))}n=u}if(null===h||l!==Gc||p)if(x=b.i(q-1).x,y=b.i(q- 1).y,B=b.i(q).x,D=b.i(q).y,p)n=this.xd[m.layer],180===this.M||0===this.M?(p=y,p>=m.bounds.y&&p<=m.bounds.bottom&&(180===this.M?B>=m.bounds.x:B<=m.bounds.right)&&(n=m.centerX+(180===this.M?-n:n),p<m.bounds.y+m.bounds.height/2?p=m.bounds.y-this.ec/2:p=m.bounds.bottom+this.ec/2,b.m(q++,n,y),b.m(q++,n,p)),b.m(q++,B,p)):(p=x,p>=m.bounds.x&&p<=m.bounds.right&&(270===this.M?D>=m.bounds.y:D<=m.bounds.bottom)&&(n=m.centerY+(270===this.M?-n:n),p<m.bounds.x+m.bounds.width/2?p=m.bounds.x-this.ec/2:p=m.bounds.right+ this.ec/2,b.m(q++,x,n),b.m(q++,p,n)),b.m(q++,p,D)),b.m(q++,B,D);else if(r)z=Math.max(10,this.Sd[m.layer]),G=Math.max(10,this.xd[m.layer]),180===this.M&&B>=m.bounds.x?(n=m.bounds.x+m.bounds.width,b.N(q-2,n,y),b.N(q-1,n+G,y)):90===this.M&&D<=m.bounds.bottom?(n=m.bounds.y,b.N(q-2,x,n),b.N(q-1,x,n-z)):270===this.M&&D>=m.bounds.y?(n=m.bounds.y+m.bounds.height,b.N(q-2,x,n),b.N(q-1,x,n+G)):0===this.M&&B<=m.bounds.right&&(n=m.bounds.x,b.N(q-2,n,y),b.N(q-1,n-z,y));else{z=Math.max(10,this.Sd[m.layer]);G=Math.max(10, this.xd[m.layer]);p=0;if(180===this.M||0===this.M){if(180===this.M?B<=m.bounds.x:B>=m.bounds.right)p=(0===this.M?G:-z)/2;b.m(q++,B+p,y)}else{if(270===this.M?D<=m.bounds.y:D>=m.bounds.bottom)p=(90===this.M?G:-z)/2;b.m(q++,x,D+p)}b.m(q++,B,D)}}else{for(;null!==m&&m!==n;){z=u=null;for(m=m.destinationEdges.iterator;m.next()&&(x=m.value,x.link!==c.link||(u=x.toVertex,z=x.fromVertex,null!==z.node&&(z=null),null!==u.node)););u!==n&&(x=b.i(q-1).x,y=b.i(q-1).y,B=u.centerX,D=u.centerY,p?180===this.M||0===this.M? (null!==z?z.centerY:y)!==D&&(z=this.La[u.layer]+this.Sf.x,q===b.firstPickIndex+1&&(z=0===this.M?Math.max(z,x):Math.min(z,x)),b.m(q++,z,y),b.m(q++,z,D)):(null!==z?z.centerX:x)!==B&&(z=this.La[u.layer]+this.Sf.y,q===b.firstPickIndex+1&&(z=90===this.M?Math.max(z,y):Math.min(z,y)),b.m(q++,x,z),b.m(q++,B,z)):(z=Math.max(10,this.Sd[u.layer]),G=Math.max(10,this.xd[u.layer]),180===this.M?(b.m(q++,B+G,D),r&&b.m(q++,B,D),b.m(q++,B-z,D)):90===this.M?(b.m(q++,B,D-z),r&&b.m(q++,B,D),b.m(q++,B,D+G)):270===this.M? (b.m(q++,B,D+G),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+G,D))));m=u}p&&(x=b.i(q-1).x,y=b.i(q-1).y,B=b.i(q).x,D=b.i(q).y,180===this.M||0===this.M?y!==D&&(z=0===this.M?Math.min(Math.max((B+x)/2,this.La[n.layer]+this.Sf.x),B):Math.max(Math.min((B+x)/2,this.La[n.layer]+this.Sf.x),B),b.m(q++,z,y),b.m(q++,z,D)):x!==B&&(z=90===this.M?Math.min(Math.max((D+y)/2,this.La[n.layer]+this.Sf.y),D):Math.max(Math.min((D+y)/2,this.La[n.layer]+this.Sf.y),D),b.m(q++,x,z),b.m(q++,B,z)))}null!== d&&r&&(null!==g&&(l===Gc&&(l=b.i(0),d=b.i(2),l.A(d)||b.N(1,(l.x+d.x)/2,(l.y+d.y)/2)),l=b.getLinkPoint(e,g,Gc,!0,!1,f,h),l.o()||l.set(e.actualBounds.center),b.N(0,l.x,l.y)),null!==h&&(k===Gc&&(k=b.i(b.pointsCount-1),l=b.i(b.pointsCount-3),k.A(l)||b.N(b.pointsCount-2,(k.x+l.x)/2,(k.y+l.y)/2)),e=b.getLinkPoint(f,h,Gc,!1,!1,e,g),e.o()||e.set(f.actualBounds.center),b.N(b.pointsCount-1,e.x,e.y)));b.Df();c.commit()}}}this.avoidOrthogonalOverlaps()}; ws.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.M||270===this.M){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.C(f.y,g.y)&&!this.C(f.x,g.x)){var h=new pt;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.$c=Math.min(f.x,g.x);h.zc=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.l=m}c.push(h)}}}if(1<c.length)for(c.sort(this.Cy),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].zc;for(e=a+1;e<d&&c[e].$c<g;)g=Math.max(g,c[e].zc),e++;g=e-f;if(1<g){this.qj(c,this.au,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.qj(c,this.By,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.qj(c,this.au,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||qt(f.x,f.y+q,g.x,g.y+q))b++,r.Vh(),r.N(p.index,f.x,f.y+q),r.N(p.index+1,g.x,g.y+q),r.Df()}}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.C(f.x,g.x)&&!this.C(f.y,g.y)&&(h=new pt,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.$c=Math.min(f.y,g.y),h.zc=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.l=m),c.push(h));if(1<c.length)for(c.sort(this.Cy),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].zc;for(e=a+1;e<d&&c[e].$c<g;)g=Math.max(g,c[e].zc),e++;g=e-f;if(1<g){this.qj(c,this.au,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.qj(c,this.By,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.qj(c,this.au,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||qt(f.x+q,f.y,g.x+q,g.y))b++,r.Vh(),r.N(p.index,f.x+q,f.y),r.N(p.index+1,g.x+q,g.y),r.Df()}f=e}a=d}}}};t=ws.prototype;t.Cy=function(a,b){return a instanceof pt&&b instanceof pt&&a!==b?a.layer<b.layer?-1:a.layer>b.layer?1:a.$c<b.$c?-1:a.$c>b.$c?1:a.zc<b.zc?-1:a.zc>b.zc?1:0:0};t.By=function(a,b){return a instanceof pt&&b instanceof pt&&a!==b?a.first<b.first?-1:a.first>b.first||a.l<b.l?1:a.l>b.l||a.$c<b.$c?-1:a.$c>b.$c?1:a.zc<b.zc?-1:a.zc>b.zc?1:0:0}; t.au=function(a,b){return a instanceof pt&&b instanceof pt&&a!==b?a.cc<b.cc?-1:a.cc>b.cc||a.l<b.l?1:a.l>b.l||a.$c<b.$c?-1:a.$c>b.$c?1:a.zc<b.zc?-1:a.zc>b.zc?1:0:0};t.C=function(a,b){F&&(C(a,ws,"isApprox:a"),C(b,ws,"isApprox:b"));a-=b;return-1<a&&1>a}; t.qj=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 qt(a,b,c,d){F&&(C(a,ws,"isUnoccupied2:px"),C(b,ws,"isUnoccupied2:py"),C(c,ws,"isUnoccupied2:qx"),C(d,ws,"isUnoccupied2:qy"));return!0}function Fs(a,b){var c=a.mc[b];if(c>=a.Ce.length){var d=[];for(var e=0;e<a.Ce.length;e++)d[e]=a.Ce[e];a.Ce=d}void 0===a.Ce[c]||null===a.Ce[c]?d=[]:(d=a.Ce[c],a.Ce[c]=null);a=a.cp[b];for(b=0;b<a.length;b++)c=a[b],d[c.index]=c;return d}function Gs(a,b,c){a.Ce[a.mc[b]]=c} ma.Object.defineProperties(ws.prototype,{layerSpacing:{configurable:!0,get:function(){return this.ye},set:function(a){this.ye!==a&&(A(a,"number",ws,"layerSpacing"),0<=a&&(this.ye=a,this.D()))}},columnSpacing:{configurable:!0,get:function(){return this.ec},set:function(a){this.ec!==a&&(A(a,"number",ws,"columnSpacing"),0<a&&(this.ec=a,this.D()))}},direction:{configurable:!0,get:function(){return this.M},set:function(a){this.M!==a&&(A(a,"number",ws,"direction"), 0===a||90===a||180===a||270===a?(this.M=a,this.D()):v("LayeredDigraphLayout.direction must be 0, 90, 180, or 270"))}},cycleRemoveOption:{configurable:!0,get:function(){return this.bl},set:function(a){this.bl!==a&&(hb(a,ws,ws,"cycleRemoveOption"),a===Qs||a===xs||a===Cs)&&(this.bl=a,this.D())}},layeringOption:{configurable:!0,get:function(){return this.Gl},set:function(a){this.Gl!==a&&(hb(a,ws,ws,"layeringOption"),a===ys||a===Vs||a===Xs)&&(this.Gl=a,this.D())}},initializeOption:{configurable:!0, enumerable:!0,get:function(){return this.vl},set:function(a){this.vl!==a&&(hb(a,ws,ws,"initializeOption"),a===zs||a===ct||a===at)&&(this.vl=a,this.D())}},iterations:{configurable:!0,get:function(){return this.Lj},set:function(a){this.Lj!==a&&(C(a,Bs,"iterations"),0<=a&&(this.Lj=a,this.D()))}},aggressiveOption:{configurable:!0,get:function(){return this.Rk},set:function(a){this.Rk!==a&&(hb(a,ws,ws,"aggressiveOption"),a===gt||a===As||a===ht)&&(this.Rk=a,this.D())}},packOption:{configurable:!0, enumerable:!0,get:function(){return this.vg},set:function(a){this.vg!==a&&(A(a,"number",ws,"packOption"),0<=a&&8>a&&(this.vg=a,this.D()))}},setsPortSpots:{configurable:!0,get:function(){return this.qf},set:function(a){this.qf!==a&&(A(a,"boolean",ws,"setsPortSpots"),this.qf=a,this.D())}},linkSpacing:{configurable:!0,get:function(){return this.Ho},set:function(a){this.Ho!==a&&(A(a,"number",ws,"linkSpacing"),0<=a&&(this.Ho=a,this.D()))}},maxLayer:{configurable:!0, get:function(){return this.Ea}},maxIndex:{configurable:!0,get:function(){return this.qs}},maxColumn:{configurable:!0,get:function(){return this.Ia}},minIndexLayer:{configurable:!0,get:function(){return this.So}},maxIndexLayer:{configurable:!0,get:function(){return this.yd}}}); var xs=new E(ws,"CycleDepthFirst",0),Qs=new E(ws,"CycleGreedy",1),Cs=new E(ws,"CycleFromLayers",2),ys=new E(ws,"LayerOptimalLinkLength",0),Vs=new E(ws,"LayerLongestPathSink",1),Xs=new E(ws,"LayerLongestPathSource",2),zs=new E(ws,"InitDepthFirstOut",0),ct=new E(ws,"InitDepthFirstIn",1),at=new E(ws,"InitNaive",2),gt=new E(ws,"AggressiveNone",0),As=new E(ws,"AggressiveLess",1),ht=new E(ws,"AggressiveMore",2);ws.className="LayeredDigraphLayout";ws.CycleDepthFirst=xs;ws.CycleGreedy=Qs; ws.CycleFromLayers=Cs;ws.LayerOptimalLinkLength=ys;ws.LayerLongestPathSink=Vs;ws.LayerLongestPathSource=Xs;ws.InitDepthFirstOut=zs;ws.InitDepthFirstIn=ct;ws.InitNaive=at;ws.AggressiveNone=gt;ws.AggressiveLess=As;ws.AggressiveMore=ht;ws.PackNone=0;ws.PackExpand=1;ws.PackStraighten=2;ws.PackMedian=4;ws.PackAll=7;function pt(){this.index=this.zc=this.$c=this.cc=this.first=this.layer=0;this.link=null;this.l=0}pt.className="SegInfo";function Bs(a){iq.call(this,a)}la(Bs,iq);Bs.prototype.createVertex=function(){return new rt(this)}; Bs.prototype.createEdge=function(){return new st(this)};Bs.className="LayeredDigraphNetwork";function rt(a){lq.call(this,a);this.Ua=this.Xg=this.Fi=-1;this.L=NaN;this.$=null;this.valid=!1;this.finish=this.tm=NaN;this.hk=0;this.fw=this.gw=null}la(rt,lq); ma.Object.defineProperties(rt.prototype,{layer:{configurable:!0,get:function(){return this.Fi},set:function(a){this.Fi!==a&&(A(a,"number",rt,"layer"),this.Fi=a)}},column:{configurable:!0,get:function(){return this.Xg},set:function(a){this.Xg!==a&&(A(a,"number",rt,"column"),this.Xg=a)}},index:{configurable:!0,get:function(){return this.Ua},set:function(a){this.Ua!==a&&(A(a,"number",rt,"index"),this.Ua=a)}},component:{configurable:!0,get:function(){return this.L}, set:function(a){this.L!==a&&(A(a,"number",rt,"component"),this.L=a)}},near:{configurable:!0,get:function(){return this.$},set:function(a){this.$!==a&&(F&&null!==a&&w(a,rt,rt,"near"),this.$=a)}}});rt.className="LayeredDigraphVertex";function st(a){mq.call(this,a);this.l=this.Na=this.ib=!1;this.Ma=this.L=NaN;this.$=this.w=0}la(st,mq); ma.Object.defineProperties(st.prototype,{valid:{configurable:!0,get:function(){return this.ib},set:function(a){this.ib!==a&&(A(a,"boolean",st,"valid"),this.ib=a)}},rev:{configurable:!0,get:function(){return this.Na},set:function(a){this.Na!==a&&(A(a,"boolean",st,"rev"),this.Na=a)}},forest:{configurable:!0,get:function(){return this.l},set:function(a){this.l!==a&&(A(a,"boolean",st,"forest"),this.l=a)}},portFromPos:{configurable:!0,get:function(){return this.L}, set:function(a){this.L!==a&&(A(a,"number",st,"portFromPos"),this.L=a)}},portToPos:{configurable:!0,get:function(){return this.Ma},set:function(a){this.Ma!==a&&(A(a,"number",st,"portToPos"),this.Ma=a)}},portFromColOffset:{configurable:!0,get:function(){return this.w},set:function(a){this.w!==a&&(A(a,"number",st,"portFromColOffset"),this.w=a)}},portToColOffset:{configurable:!0,get:function(){return this.$},set:function(a){this.$!==a&&(A(a,"number",st,"portToColOffset"), this.$=a)}}});st.className="LayeredDigraphEdge";function Z(){0<arguments.length&&za(Z);Ni.call(this);this.Ob=new I;this.rp=tt;this.gd=ut;this.nq=vt;this.ps=wt;this.bx=[];this.fd=!0;this.Hb=xt;this.Hd=(new Hb(10,10)).freeze();var a=new yt(this);this.W=new zt(a);this.Y=new zt(a);this.mv=[]}la(Z,Ni); Z.prototype.cloneProtected=function(a){Ni.prototype.cloneProtected.call(this,a);a.rp=this.rp;a.nq=this.nq;a.ps=this.ps;a.fd=this.fd;a.Hb=this.Hb;a.Hd.assign(this.Hd);a.W.copyInheritedPropertiesFrom(this.W);a.Y.copyInheritedPropertiesFrom(this.Y)}; Z.prototype.mb=function(a){a.classType===Z?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):Ni.prototype.mb.call(this,a)};Z.prototype.createNetwork=function(){return new yt(this)}; Z.prototype.makeNetwork=function(a){function b(a){if(a instanceof T)return!a.isLinkLabel&&"Comment"!==a.category;if(a instanceof R){var b=a.fromNode;if(null===b||b.isLinkLabel||"Comment"===b.category)return!1;a=a.toNode;return null===a||a.isLinkLabel||"Comment"===a.category?!1:!0}return!1}var c=this.createNetwork();a instanceof P?(c.Gg(a.nodes,!0,b),c.Gg(a.links,!0,b)):a instanceof Hf?c.Gg(a.memberParts,!1,b):c.Gg(a.iterator,!1,b);return c}; Z.prototype.doLayout=function(a){F&&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!==At&&(this.arrangementOrigin=this.initialOrigin(this.arrangementOrigin));var b=this.diagram;null===b&&a instanceof P&&(b=a);this.path===tt&&null!==b?this.gd=b.isTreePathToChildren?ut:Bt:this.gd=this.path===tt?ut:this.path;if(0<this.network.vertexes.count){this.network.yq(); 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.Ob.count){a=new I;for(b=this.Ob.iterator;b.next();){var c=b.value;c instanceof T?(c=this.network.gj(c),null!==c&&a.add(c)):c instanceof zt&&a.add(c)}this.Ob=a}0===this.Ob.count&&this.findRoots();for(a=this.Ob.copy().iterator;a.next();)b=a.value,b.initialized||(b.initialized=!0,Ct(this,b));b=this.network.vertexes;for(a=null;a=Dt(b),0<a.count;)b=Et(this,a),null!==b&&this.Ob.add(b), b.initialized=!0,Ct(this,b),b=a;for(a=this.Ob.iterator;a.next();)b=a.value,b instanceof zt&&Ft(this,b);for(a=this.Ob.iterator;a.next();)b=a.value,b instanceof zt&&Gt(this,b);for(a=this.Ob.iterator;a.next();)b=a.value,b instanceof zt&&Ht(this,b);this.xv();if(this.layerStyle===It){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.bx=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===Jt)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.Ob.iterator;a.next();)b=a.value,b instanceof zt&&this.layoutTree(b);this.arrangeTrees();this.updateParts()}this.network=null;this.Ob=new I;this.isValidLayout=!0};function Dt(a){var b=new I;for(a=a.iterator;a.next();){var c=a.value;c.initialized||b.add(c)}return b} Z.prototype.findRoots=function(){for(var a=this.network.vertexes,b=a.iterator;b.next();){var c=b.value;switch(this.gd){case ut:0===c.sourceEdges.count&&this.Ob.add(c);break;case Bt:0===c.destinationEdges.count&&this.Ob.add(c);break;default:v("Unhandled path value "+this.gd.toString())}}0===this.Ob.count&&(a=Et(this,a),null!==a&&this.Ob.add(a))}; function Et(a,b){var c=999999,d=null;for(b=b.iterator;b.next();){var e=b.value;switch(a.gd){case ut:e.sourceEdges.count<c&&(c=e.sourceEdges.count,d=e);break;case Bt:e.destinationEdges.count<c&&(c=e.destinationEdges.count,d=e);break;default:v("Unhandled path value "+a.gd.toString())}}return d} function Ct(a,b){if(null!==b){F&&w(b,zt,Z,"walkTree:v");switch(a.gd){case ut:if(0<b.destinationEdges.count){for(var c=new H,d=b.destinationVertexes;d.next();){var e=d.value;Kt(a,b,e)&&c.add(e)}0<c.count&&(b.children=c.ua())}break;case Bt:if(0<b.sourceEdges.count){c=new H;for(d=b.sourceVertexes;d.next();)e=d.value,Kt(a,b,e)&&c.add(e);0<c.count&&(b.children=c.ua())}break;default:v("Unhandled path value"+a.gd.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.Ob.remove(f)}for(b=0;b<d;b++)Ct(a,c[b])}}function Kt(a,b,c){F&&w(b,zt,Z,"walkOK:v");F&&w(c,zt,Z,"walkOK:c");if(c.initialized){if(null===b)var d=!1;else{F&&w(c,zt,Z,"isAncestor:a");F&&w(b,zt,Z,"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} Z.prototype.removeChild=function(a,b){if(null!==a&&null!==b){F&&w(a,zt,Z,"removeChild:p");F&&w(b,zt,Z,"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 Ft(a,b){if(null!==b){F&&w(b,zt,Z,"initializeTree:v");a.initializeTreeVertexValues(b);b.alignment===Lt&&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];Ft(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 Mt(a,b){F&&w(b,zt,Z,"mom:v");switch(a.nq){default:case vt:return null!==b.parent?b.parent:a.W;case Nt:return null===b.parent?a.W:null===b.parent.parent?a.Y:b.parent;case Ot:return null!==b.parent?null!==b.parent.parent?b.parent.parent:a.Y:a.W;case Pt: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.Y:null!==b.parent?b.parent:a.W}} Z.prototype.initializeTreeVertexValues=function(a){F&&w(a,zt,Z,"initializeTreeVertexValues:v");var b=Mt(this,a);a.copyInheritedPropertiesFrom(b);if(null!==a.parent&&a.parent.alignment===Lt){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 Gt(a,b){if(null!==b){F&&w(b,zt,Z,"assignTree:v");a.assignTreeVertexValues(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Gt(a,b[d])}}Z.prototype.assignTreeVertexValues=function(){};function Ht(a,b){if(null!==b){F&&w(b,zt,Z,"sortTree:v");b.alignment!==Lt&&a.sortTreeVertexChildren(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Ht(a,b[d])}} Z.prototype.sortTreeVertexChildren=function(a){F&&w(a,zt,Z,"sortTreeVertexChildren:v");switch(a.sorting){case Qt:break;case Rt:a.children.reverse();break;case St:a.children.sort(a.comparer);break;case Tt:a.children.sort(a.comparer);a.children.reverse();break;default:v("Unhandled sorting value "+a.sorting.toString())}};Z.prototype.xv=function(){if(this.comments)for(var a=this.network.vertexes.iterator;a.next();)this.addComments(a.value)}; Z.prototype.addComments=function(a){F&&w(a,zt,Z,"addComments:v");var b=a.angle,c=a.parent,d=0;var e=!1;null!==c&&(d=c.angle,e=c.alignment,e=Ut(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.Lv();l.next();){var m=l.value;"Comment"===m.category&&m.canLayout()&&(null===a.comments&&(a.comments=[]),a.comments.push(m),m.Eb(),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=L.allocAt(0,0,a.bounds.width+f,a.bounds.height+g),a.bounds=e,L.free(e))};function Ut(a){return a===Vt||a===Lt||a===Wt||a===Xt}function Yt(a){return a===Vt||a===Lt} function Zt(a){F&&w(a,zt,Z,"isLeftSideBus:v");var b=a.parent;if(null!==b){var c=b.alignment;if(Ut(c)){if(Yt(c)){b=b.children;for(c=0;c<b.length&&a!==b[c];)c++;return 0===c%2}if(c===Wt)return!0}}return!1} Z.prototype.layoutComments=function(a){F&&w(a,zt,Z,"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=Ut(f));d=90===d||270===d;c=90===e||270===e;for(var g=0===a.childrenCount,h=Zt(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.Dd();r.next();){var u= r.value;u.fromSpot=rd;u.toSpot=sd}else for(n.h(a.bounds.x+2*a.focus.x-a.commentMargin,a.bounds.y+k),r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=sd,u.toSpot=rd;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.Dd();r.next();)u=r.value,u.fromSpot=sd,u.toSpot=rd;else for(n.h(a.bounds.x+a.commentMargin-q.width,a.bounds.y+k),r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=rd,u.toSpot=sd;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.Dd();r.next();)u=r.value,u.fromSpot=qd,u.toSpot=td;else for(n.h(a.bounds.x+k,a.bounds.y+2*a.focus.y-a.commentMargin),r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=td,u.toSpot=qd;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.Dd();r.next();)u=r.value,u.fromSpot=td,u.toSpot=qd;else for(n.h(a.bounds.x+k,a.bounds.y+ a.commentMargin-q.height),r.move(n),r=r.Dd();r.next();)u=r.value,u.fromSpot=qd,u.toSpot=td;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.gd===ut)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)}}; Z.prototype.layoutTree=function(a){if(null!==a){F&&w(a,zt,Z,"layoutTree:v");for(var b=a.children,c=b.length,d=0;d<c;d++)this.layoutTree(b[d]);switch(a.compaction){case $t:au(this,a);break;case bu:if(a.alignment===Lt)au(this,a);else if(F&&w(a,zt,Z,"layoutTreeBlock:v"),0===a.childrenCount)d=a.parent,c=!1,b=0,null!==d&&(b=d.angle,c=d.alignment,c=Ut(c)),d=Zt(a),a.V.h(0,0),a.Aa.h(a.width,a.height),null===a.parent||null===a.comments||(180!==b&&270!==b||c)&&!d?a.ja.h(0,0):180===b&&!c||(90===b||270===b)&& d?a.ja.h(a.width-2*a.focus.x,0):a.ja.h(0,a.height-2*a.focus.y),a.Mq=null,a.Zq=null;else{var e=cu(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.Aa.width:d.Aa.height);var k=a.alignment;d=k===du;var l=k===eu,m=Ut(k),n=Math.max(0,a.breadthLimit);c=ju(a);var p=a.nodeSpacing,r=ku(a),q=a.rowSpacing,u=0;if(d||l||a.Um||a.Vm&&1===a.maxGenerationCount)u=Math.max(0,a.rowIndent);d=a.width;var x=a.height,y=0,z=0,B=0,D=null,G=null,O=0,X=0,Q=0,ca=0,Y=0,oa=0,Da=0,V=0; m&&!Yt(k)&&135<e&&g.reverse();if(Yt(k))if(1<h)for(var Ma=0;Ma<h;Ma++)0===Ma%2&&Ma!==h-1&&(V=Math.max(V,b?g[Ma].Aa.width:g[Ma].Aa.height));else 1===h&&(V=b?g[0].Aa.width:g[0].Aa.height);if(m){switch(k){case Vt:z=135>e?lu(a,g,V,y,z):mu(a,g,V,y,z);V=z.x;y=z.width;z=z.height;break;case Wt:for(D=0;D<h;D++)G=g[D],n=G.Aa,B=0===oa?0:q,b?(G.V.h(f-n.width,ca+B),y=Math.max(y,n.width),z=Math.max(z,ca+B+n.height),ca+=B+n.height):(G.V.h(Q+B,f-n.height),y=Math.max(y,Q+B+n.width),z=Math.max(z,n.height),Q+=B+n.width), oa++;break;case Xt:for(D=0;D<h;D++)G=g[D],f=G.Aa,n=0===oa?0:q,b?(G.V.h(p/2+a.focus.x,ca+n),y=Math.max(y,f.width),z=Math.max(z,ca+n+f.height),ca+=n+f.height):(G.V.h(Q+n,p/2+a.focus.y),y=Math.max(y,Q+n+f.width),z=Math.max(z,f.height),Q+=n+f.width),oa++}D=nu(this,2);G=nu(this,2);b?(D[0].h(0,0),D[1].h(0,z),G[0].h(y,0)):(D[0].h(0,0),D[1].h(y,0),G[0].h(0,z));G[1].h(y,z)}else for(Ma=0;Ma<h;Ma++){var Va=g[Ma],xb=Va.Aa;if(b){0<n&&0<oa&&Q+p+xb.width>n&&(Q<f&&ou(a,k,f-Q,0,Da,Ma-1),Y++,oa=0,Da=Ma,B=z,Q=0,ca= 135<e?-z-q:z+q);pu(this,Va,0,ca);var Ta=0;if(0===oa){if(D=Va.Mq,G=Va.Zq,O=xb.width,X=xb.height,null===D||null===G||e!==cu(Va))D=nu(this,2),G=nu(this,2),D[0].h(0,0),D[1].h(0,X),G[0].h(O,0),G[1].h(O,X)}else{var Ob=La();X=qu(this,a,Va,D,G,O,X,Ob);Ta=X.x;D=Ob[0];G=Ob[1];O=X.width;X=X.height;Oa(Ob);Q<xb.width&&0>Ta&&(ru(a,-Ta,0,Da,Ma-1),su(D,-Ta,0),su(G,-Ta,0),Ta=0)}Va.V.h(Ta,ca);y=Math.max(y,O);z=Math.max(z,B+(0===Y?0:q)+xb.height);Q=O}else{0<n&&0<oa&&ca+p+xb.height>n&&(ca<f&&ou(a,k,0,f-ca,Da,Ma-1),Y++, oa=0,Da=Ma,B=y,ca=0,Q=135<e?-y-q:y+q);pu(this,Va,Q,0);Ta=0;if(0===oa){if(D=Va.Mq,G=Va.Zq,O=xb.width,X=xb.height,null===D||null===G||e!==cu(Va))D=nu(this,2),G=nu(this,2),D[0].h(0,0),D[1].h(O,0),G[0].h(0,X),G[1].h(O,X)}else Ob=La(),X=qu(this,a,Va,D,G,O,X,Ob),Ta=X.x,D=Ob[0],G=Ob[1],O=X.width,X=X.height,Oa(Ob),ca<xb.height&&0>Ta&&(ru(a,0,-Ta,Da,Ma-1),su(D,0,-Ta),su(G,0,-Ta),Ta=0);Va.V.h(Q,Ta);z=Math.max(z,X);y=Math.max(y,B+(0===Y?0:q)+xb.width);ca=X}oa++}0<Y&&(b?(z+=Math.max(0,c),Q<y&&ou(a,k,y-Q,0,Da, h-1),0<u&&(l||ru(a,u,0,0,h-1),y+=u)):(y+=Math.max(0,c),ca<z&&ou(a,k,0,z-ca,Da,h-1),0<u&&(l||ru(a,0,u,0,h-1),z+=u)));u=l=0;switch(k){case tu:b?l+=y/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2;break;case uu:0<Y?b?l+=y/2-a.focus.x-r/2:u+=z/2-a.focus.y-r/2:b?(V=g[0].V.x+g[0].ja.x,l+=V+(g[h-1].V.x+g[h-1].ja.x+2*g[h-1].focus.x-V)/2-a.focus.x-r/2):(V=g[0].V.y+g[0].ja.y,u+=V+(g[h-1].V.y+g[h-1].ja.y+2*g[h-1].focus.y-V)/2-a.focus.y-r/2);break;case du:b?(l-=r,y+=r):(u-=r,z+=r);break;case eu:b?(l+=y-a.width+r,y+=r): (u+=z-a.height+r,z+=r);break;case Vt:b?1<h?l+=V+p/2-a.focus.x:l+=g[0].focus.x-a.focus.x+g[0].ja.x:1<h?u+=V+p/2-a.focus.y:u+=g[0].focus.y-a.focus.y+g[0].ja.y;break;case Wt:b?l+=y+p/2-a.focus.x:u+=z+p/2-a.focus.y;break;case Xt:break;default:v("Unhandled alignment value "+k.toString())}for(r=0;r<h;r++)V=g[r],b?V.V.h(V.V.x+V.ja.x-l,V.V.y+(135<e?(m?-z:-V.Aa.height)+V.ja.y-c:x+c+V.ja.y)):V.V.h(V.V.x+(135<e?(m?-y:-V.Aa.width)+V.ja.x-c:d+c+V.ja.x),V.V.y+V.ja.y-u);h=g=0;m?b?(y=vu(a,y,l),0>l&&(l=0),135<e&& (u+=z+c),z+=x+c,k===Xt&&(g+=p/2+a.focus.x),h+=x+c):(135<e&&(l+=y+c),y+=d+c,z=wu(a,z,u),0>u&&(u=0),k===Xt&&(h+=p/2+a.focus.y),g+=d+c):b?(null===a.comments?d>y&&(y=xu(k,d-y,0),g=y.x,h=y.y,y=d,l=0):y=vu(a,y,l),0>l&&(g-=l,l=0),135<e&&(u+=z+c),z=Math.max(Math.max(z,x),z+x+c),h+=x+c):(135<e&&(l+=y+c),y=Math.max(Math.max(y,d),y+d+c),null===a.comments?x>z&&(z=xu(k,0,x-z),g=z.x,h=z.y,z=x,u=0):z=wu(a,z,u),0>u&&(h-=u,u=0),g+=d+c);if(0<Y)e=nu(this,4),Y=nu(this,4),b?(e[2].h(0,x+c),e[3].h(e[2].x,z),Y[2].h(y,e[2].y), Y[3].h(Y[2].x,e[3].y)):(e[2].h(d+c,0),e[3].h(y,e[2].y),Y[2].h(e[2].x,z),Y[3].h(e[3].x,Y[2].y));else{e=nu(this,D.length+2);Y=nu(this,G.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<G.length;k++)m=G[k],Y[k+2].h(m.x+g,m.y+h)}b?(e[0].h(l,0),e[1].h(e[0].x,x),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])),Y[0].h(l+d,0),Y[1].h(Y[0].x,x),Y[2].y<Y[1].y&&(Y[2].x<Y[0].x?Y[2].assign(Y[1]):Y[1].assign(Y[2])), Y[3].y<Y[2].y&&(Y[3].x<Y[0].x?Y[3].assign(Y[2]):Y[2].assign(Y[3])),e[2].y-=c/2,Y[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])),Y[0].h(0,u+x),Y[1].h(d,Y[0].y),Y[2].x<Y[1].x&&(Y[2].y<Y[0].y?Y[2].assign(Y[1]):Y[1].assign(Y[2])),Y[3].x<Y[2].x&&(Y[3].y<Y[0].y?Y[3].assign(Y[2]):Y[2].assign(Y[3])),e[2].x-=c/2,Y[2].x-=c/2);yu(this,D);yu(this,G);a.Mq=e;a.Zq=Y;a.ja.h(l,u);a.Aa.h(y, z)}break;default:v("Unhandled compaction value "+a.compaction.toString())}}}; function au(a,b){F&&w(b,zt,Z,"layoutTreeNone:v");if(0===b.childrenCount){var c=!1,d=0;null!==b.parent&&(d=b.parent.angle,c=b.parent.alignment,c=Ut(c));var e=Zt(b);b.V.h(0,0);b.Aa.h(b.width,b.height);null===b.parent||null===b.comments||(180!==d&&270!==d||c)&&!e?b.ja.h(0,0):180===d&&!c||(90===d||270===d)&&e?b.ja.h(b.width-2*b.focus.x,0):b.ja.h(0,b.height-2*b.focus.y)}else{d=cu(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.Aa.width:k.Aa.height)}var l= b.alignment,m=l===du,n=l===eu;h=Ut(l);var p=Math.max(0,b.breadthLimit);k=ju(b);var r=b.nodeSpacing,q=ku(b),u=m||n?0:q/2,x=b.rowSpacing,y=0;if(m||n||b.Um||b.Vm&&1===b.maxGenerationCount)y=Math.max(0,b.rowIndent);m=b.width;var z=b.height,B=0,D=0,G=0,O=0,X=0,Q=0,ca=0,Y=0,oa=0,Da=0;h&&!Yt(l)&&135<d&&e.reverse();if(Yt(l))if(1<g)for(var V=0;V<g;V++){var Ma=e[V],Va=Ma.Aa;0===V%2&&V!==g-1?oa=Math.max(oa,(c?Va.width:Va.height)+zu(Ma)-r):0!==V%2&&(Da=Math.max(Da,(c?Va.width:Va.height)+zu(Ma)-r))}else 1===g&& (oa=c?e[0].Aa.width:e[0].Aa.height);if(h)switch(l){case Vt:case Lt:D=135>d?lu(b,e,oa,B,D):mu(b,e,oa,B,D);oa=D.x;B=D.width;D=D.height;break;case Wt:for(a=0;a<g;a++)p=e[a],u=p.Aa,G=0===ca?0:x,c?(p.V.h(f-u.width,X+G),B=Math.max(B,u.width),D=Math.max(D,X+G+u.height),X+=G+u.height):(p.V.h(O+G,f-u.height),B=Math.max(B,O+G+u.width),D=Math.max(D,u.height),O+=G+u.width),ca++;break;case Xt:for(f=0;f<g;f++)a=e[f],p=a.Aa,u=0===ca?0:x,c?(a.V.h(r/2+b.focus.x,X+u),B=Math.max(B,p.width),D=Math.max(D,X+u+p.height), X+=u+p.height):(a.V.h(O+u,r/2+b.focus.y),B=Math.max(B,O+u+p.width),D=Math.max(D,p.height),O+=u+p.width),ca++}else for(Da=0;Da<g;Da++)V=e[Da],Ma=V.Aa,c?(0<p&&0<ca&&O+r+Ma.width>p&&(O<f&&ou(b,l,f-O,0,Y,Da-1),Q++,ca=0,Y=Da,G=D,O=0,X=135<d?-D-x:D+x),Va=0===ca?u:r,pu(a,V,0,X),V.V.h(O+Va,X),B=Math.max(B,O+Va+Ma.width),D=Math.max(D,G+(0===Q?0:x)+Ma.height),O+=Va+Ma.width):(0<p&&0<ca&&X+r+Ma.height>p&&(X<f&&ou(b,l,0,f-X,Y,Da-1),Q++,ca=0,Y=Da,G=B,X=0,O=135<d?-B-x:B+x),Va=0===ca?u:r,pu(a,V,O,0),V.V.h(O,X+Va), D=Math.max(D,X+Va+Ma.height),B=Math.max(B,G+(0===Q?0:x)+Ma.width),X+=Va+Ma.height),ca++;0<Q&&(c?(D+=Math.max(0,k),O<B&&ou(b,l,B-O,0,Y,g-1),0<y&&(n||ru(b,y,0,0,g-1),B+=y)):(B+=Math.max(0,k),X<D&&ou(b,l,0,D-X,Y,g-1),0<y&&(n||ru(b,0,y,0,g-1),D+=y)));y=n=0;switch(l){case tu:c?n+=B/2-b.focus.x-q/2:y+=D/2-b.focus.y-q/2;break;case uu:0<Q?c?n+=B/2-b.focus.x-q/2:y+=D/2-b.focus.y-q/2:c?(l=e[0].V.x+e[0].ja.x,n+=l+(e[g-1].V.x+e[g-1].ja.x+2*e[g-1].focus.x-l)/2-b.focus.x-q/2):(l=e[0].V.y+e[0].ja.y,y+=l+(e[g-1].V.y+ e[g-1].ja.y+2*e[g-1].focus.y-l)/2-b.focus.y-q/2);break;case du:c?(n-=q,B+=q):(y-=q,D+=q);break;case eu:c?(n+=B-b.width+q,B+=q):(y+=D-b.height+q,D+=q);break;case Vt:case Lt:c?1<g?n+=oa+r/2-b.focus.x:n+=e[0].focus.x-b.focus.x+e[0].ja.x:1<g?y+=oa+r/2-b.focus.y:y+=e[0].focus.y-b.focus.y+e[0].ja.y;break;case Wt:c?n+=B+r/2-b.focus.x:y+=D+r/2-b.focus.y;break;case Xt:break;default:v("Unhandled alignment value "+l.toString())}for(q=0;q<g;q++)l=e[q],c?l.V.h(l.V.x+l.ja.x-n,l.V.y+(135<d?(h?-D:-l.Aa.height)+l.ja.y- k:z+k+l.ja.y)):l.V.h(l.V.x+(135<d?(h?-B:-l.Aa.width)+l.ja.x-k:m+k+l.ja.x),l.V.y+l.ja.y-y);c?(B=vu(b,B,n),0>n&&(n=0),135<d&&(y+=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=wu(b,D,y),0>y&&(y=0));b.ja.h(n,y);b.Aa.h(B,D)}} function lu(a,b,c,d,e){F&&w(a,zt,Z,"layoutBusChildrenPosDir:v");var f=b.length;if(0===f)return new L(c,0,d,e);if(1===f)return a=b[0],d=a.Aa.width,e=a.Aa.height,new L(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=90===cu(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.Aa,u=0===l?0:h;if(k){var x=zu(r)-g;r.V.h(c-(q.width+x),n+u);d=Math.max(d,q.width+x);e=Math.max(e,n+u+q.height);n+=u+q.height}else x=zu(r)-g,r.V.h(m+u,c-(q.height+x)),e=Math.max(e,q.height+x),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];x=u.Aa;var y=0===l?0:h;if(k){var z=zu(u)-g;u.V.h(m+z,n+y);d=Math.max(d,m+x.width+z);e=Math.max(e,n+y+x.height);n+=y+x.height}else z=zu(u)-g,u.V.h(m+y,n+z),d=Math.max(d,m+y+x.width),e=Math.max(e,n+x.height+z),m+=y+x.width;l++}1<f&&1===f%2&&(b=b[f-1],f=b.Aa,h=Au(b),k?(b.V.h(c+g/2-b.focus.x-b.ja.x,e+h),k=c+g/2-b.focus.x-b.ja.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.V.x&&(c=Bu(a,b.V.x,!1,c,g))):(b.V.h(d+h,c+g/2-b.focus.y-b.ja.y),d=Math.max(d,Math.max(r,m)+h+f.width),n=c+g/2-b.focus.y-b.ja.y,e=Math.max(e,n+f.height),0>n&&(e-=n),0>b.V.y&&(c=Bu(a,b.V.y,!0,c,g))));return new L(c,0,d,e)} function mu(a,b,c,d,e){F&&w(a,zt,Z,"layoutBusChildrenNegDir:v");var f=b.length;if(0===f)return new L(c,0,d,e);if(1===f)return b=b[0],d=b.Aa.width,e=b.Aa.height,new L(c,0,d,e);for(var g=a.nodeSpacing,h=a.rowSpacing,k=270===cu(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.Aa,u=0===l?0:h;if(k){var x=zu(r)-g;n-=u+q.height;r.V.h(c-(q.width+x),n);d=Math.max(d,q.width+x);e=Math.max(e,Math.abs(n))}else x=zu(r)-g,m-=u+q.width,r.V.h(m,c-(q.height+x)),e=Math.max(e,q.height+x),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];x=u.Aa;var y=0===l?0:h;if(k){var z=zu(u)-g;n-=y+x.height;u.V.h(m+z,n);d=Math.max(d,m+x.width+z);e=Math.max(e,Math.abs(n))}else z=zu(u)-g,m-=y+x.width,u.V.h(m,n+z),e=Math.max(e,n+x.height+z),d=Math.max(d,Math.abs(m));l++}1<f&&1===f%2&&(h=b[f-1],l=h.Aa,q=Au(h),k?(h.V.h(c+g/2-h.focus.x-h.ja.x,-e-l.height-q),m=c+g/2-h.focus.x-h.ja.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.V.x&&(c=Bu(a,h.V.x,!1,c,g))):(h.V.h(-d-l.width-q,c+g/2-h.focus.y-h.ja.y),d=Math.max(d,Math.abs(Math.min(r,m))+q+l.width),n=c+g/2-h.focus.y-h.ja.y,e=Math.max(e,n+l.height),0>n&&(e-=n),0>h.V.y&&(c=Bu(a,h.V.y,!0,c,g))));for(a=0;a<f;a++)g=b[a],k?g.V.h(g.V.x,g.V.y+e):g.V.h(g.V.x+d,g.V.y);return new L(c,0,d,e)}function zu(a){F&&w(a,zt,Z,"fixRelativePostions:child");return null===a.parent?0:a.parent.nodeSpacing} function Au(a){F&&w(a,zt,Z,"fixRelativePostions:lastchild");return null===a.parent?0:a.parent.rowSpacing}function Bu(a,b,c,d,e){F&&w(a,zt,Z,"fixRelativePostions:v");a=a.children;for(var f=a.length,g=0;g<f;g++)c?a[g].V.h(a[g].V.x,a[g].V.y-b):a[g].V.h(a[g].V.x-b,a[g].V.y);b=a[f-1];return Math.max(d,c?b.ja.y+b.focus.y-e/2:b.ja.x+b.focus.x-e/2)} function vu(a,b,c){F&&w(a,zt,Z,"calculateSubwidth:v");switch(a.alignment){case uu:case tu:return c+a.width>b&&(b=c+a.width),0>c&&(b-=c),b;case du:return a.width>b?a.width:b;case eu:return 2*a.focus.x>b?a.width:b+a.width-2*a.focus.x;case Vt:case Lt:return Math.max(a.width,Math.max(b,c+a.width)-Math.min(0,c));case Wt:return a.width-a.focus.x+a.nodeSpacing/2+b;case Xt:return Math.max(a.width,a.focus.x+a.nodeSpacing/2+b);default:return b}} function wu(a,b,c){F&&w(a,zt,Z,"calculateSubheight:v");switch(a.alignment){case uu:case tu:return c+a.height>b&&(b=c+a.height),0>c&&(b-=c),b;case du:return a.height>b?a.height:b;case eu:return 2*a.focus.y>b?a.height:b+a.height-2*a.focus.y;case Vt:case Lt:return Math.max(a.height,Math.max(b,c+a.height)-Math.min(0,c));case Wt:return a.height-a.focus.y+a.nodeSpacing/2+b;case Xt:return Math.max(a.height,a.focus.y+a.nodeSpacing/2+b);default:return b}} function xu(a,b,c){F&&w(a,E,Z,"alignOffset:align");switch(a){case tu:b/=2;c/=2;break;case uu:b/=2;c/=2;break;case du:c=b=0;break;case eu:break;default:v("Unhandled alignment value "+a.toString())}return new J(b,c)}function ou(a,b,c,d,e,f){F&&w(a,zt,Z,"shiftRelPosAlign:v");F&&w(b,E,Z,"shiftRelPosAlign:align");b=xu(b,c,d);ru(a,b.x,b.y,e,f)}function ru(a,b,c,d,e){F&&w(a,zt,Z,"shiftRelPos:v");if(0!==b||0!==c)for(a=a.children;d<=e;d++){var f=a[d].V;f.x+=b;f.y+=c}} function pu(a,b,c,d){F&&(w(b,zt,Z,"recordMidPoints:v"),A(c,"number",Z,"recordMidPoints:x"),A(d,"number",Z,"recordMidPoints:y"));var e=b.parent;switch(a.gd){case ut:for(a=b.sourceEdges;a.next();)b=a.value,b.fromVertex===e&&b.relativePoint.h(c,d);break;case Bt:for(a=b.destinationEdges;a.next();)b=a.value,b.toVertex===e&&b.relativePoint.h(c,d);break;default:v("Unhandled path value "+a.gd.toString())}}function su(a,b,c){for(var d=0;d<a.length;d++){var e=a[d];e.x+=b;e.y+=c}} function qu(a,b,c,d,e,f,g,h){F&&w(b,zt,Z,"mergeFringes:parent");F&&w(c,zt,Z,"mergeFringes:child");var k=cu(b),l=90===k||270===k,m=b.nodeSpacing;b=d;var n=e;d=f;var p=g,r=c.Mq,q=c.Zq;g=c.Aa;var u=l?Math.max(p,g.height):Math.max(d,g.width);if(null===r||k!==cu(c))r=nu(a,2),q=nu(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 x=r[e];k=x.x;l=x.y;k+=d;var y=f;c+1<n.length&&(y=n[c+1]);var z=x;x=z.x;z=z.y;e+1<r.length&&(z=r[e+1],x=z.x,z=z.y,x+=d);var B=p;f.y===l?B=k-f.x:f.y>l&&f.y<z?B=k+(f.y-l)/(z-l)*(x-k)-f.x:l>f.y&&l<y.y&&(B=k-(f.x+(l-f.y)/(y.y-f.y)*(y.x-f.x)));B<p&&(p=B);y.y<=f.y?c++:z<=l?e++:(y.y<=z&&c++,z<=y.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=nu(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=nu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);yu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=nu(a,n.length+f.length);for(e=l=c=0;c<n.length&&n[c].y<f[0].y;)y=n[c++],m[e++].h(y.x,y.y);for(;l<f.length;)y=f[l++],m[e++].h(y.x+k,y.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=nu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);yu(a,m);e=f}f=Math.max(0,p)+g.width;g=u;yu(a,b);yu(a,r);yu(a,n);yu(a,q);h[0]=d;h[1]=e;return new L(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],x=r[e],k=x.x,l=x.y,l+=p,y=f,c+1<n.length&&(y=n[c+1]),z=x,x=z.x,z=z.y,e+1<r.length&&(z=r[e+1],x=z.x,z=z.y,z+=p),B=d,f.x===k?B=l-f.y:f.x>k&&f.x<x?B=l+(f.x-k)/(x-k)*(z-l)-f.y:k>f.x&&k<y.x&&(B=l-(f.y+(k-f.x)/(y.x-f.x)*(y.y-f.y))),B<d&&(d=B),y.x<=f.x? c++:x<=k?e++:(y.x<=x&&c++,x<=y.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=nu(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=nu(a,d);for(k=0;k<d;k++)c[k].assign(m[k]);yu(a,m);d=c}f=q;k=p;if(null===n||2>n.length||null===f||2>f.length)e=null;else{m=nu(a,n.length+f.length); for(e=l=c=0;c<n.length&&n[c].x<f[0].x;)y=n[c++],m[e++].h(y.x,y.y);for(;l<f.length;)y=f[l++],m[e++].h(y.x,y.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=nu(a,e);for(c=0;c<e;c++)f[c].assign(m[c]);yu(a,m);e=f}f=u;g=Math.max(0,p)+g.height;yu(a,b);yu(a,r);yu(a,n);yu(a,q);h[0]=d;h[1]=e;return new L(p,0,f,g)}function nu(a,b){a=a.mv[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 yu(a,b){var c=b.length,d=a.mv[c];void 0===d&&(d=[],a.mv[c]=d);d.push(b)} Z.prototype.arrangeTrees=function(){if(this.Hb===At)for(var a=this.Ob.iterator;a.next();){var b=a.value;if(b instanceof zt){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);Cu(this,b,c,d)}}}else{a=[];for(b=this.Ob.iterator;b.next();)c=b.value,c instanceof zt&&a.push(c);switch(this.sorting){case Qt:break;case Rt:a.reverse();break;case St:a.sort(this.comparer);break;case Tt: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];Cu(this,e,b+e.ja.x,c+e.ja.y);switch(this.Hb){case xt:c+=e.Aa.height+this.Hd.height;break;case Du:b+=e.Aa.width+this.Hd.width;break;default:v("Unhandled arrangement value "+this.Hb.toString())}}}};function Cu(a,b,c,d){if(null!==b){F&&w(b,zt,Z,"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];Cu(a,g,c+g.V.x,d+g.V.y)}}} Z.prototype.commitLayout=function(){this.yw();this.commitNodes();this.zv();this.isRouting&&this.commitLinks()};Z.prototype.commitNodes=function(){for(var a=this.network.vertexes.iterator;a.next();)a.value.commit();for(a.reset();a.next();)this.layoutComments(a.value)}; Z.prototype.zv=function(){if(this.layerStyle===It){for(var a=this.bx,b=[],c=null,d=this.network.vertexes.iterator;d.next();){var e=d.value;null===c?c=e.bounds.copy():c.Nc(e.bounds);var f=b[e.level];void 0===f?f=ju(e):f=Math.max(f,ju(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.cd(this.nodeSpacing/2,this.layerSpacing),d=new J(-this.nodeSpacing/2,-this.layerSpacing/2)):(c.cd(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 L(0,f,c,h))):90===this.angle?(e.push(new L(0,f,c,h)),f+=h):180===this.angle?(f-=h,e.push(new L(f,0,h,c))):(e.push(new L(f,0,h,c)),f+=h)}this.commitLayers(e,d)}};Z.prototype.commitLayers=function(){};Z.prototype.commitLinks=function(){for(var a=this.network.edges.iterator;a.next();)a.value.commit()}; Z.prototype.yw=function(){for(var a=this.Ob.iterator;a.next();){var b=a.value;b instanceof zt&&Eu(this,b)}};function Eu(a,b){if(null!==b){F&&w(b,zt,Z,"setPortSpotsTree:v");a.setPortSpots(b);b=b.children;for(var c=b.length,d=0;d<c;d++)Eu(a,b[d])}} Z.prototype.setPortSpots=function(a){F&&w(a,zt,Z,"setPortSpots:v");var b=a.alignment;if(Ut(b)){F&&w(a,zt,Z,"setPortSpotsBus:v");F&&w(b,E,Z,"setPortSpots:align");var c=this.gd===ut,d=cu(a);switch(d){case 0:var e=sd;break;case 90:e=td;break;case 180:e=rd;break;default:e=qd}var f=a.children,g=f.length;switch(b){case Vt:case Lt: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?rd:qd;if(1===g||b===g-1&&1===g%2)switch(d){case 0:k= rd;break;case 90:k=qd;break;case 180:k=sd;break;default:k=td}else 0===b%2&&(k=90===d||270===d?sd:td);c?(a.setsPortSpot&&(h.fromSpot=e),a.setsChildPortSpot&&(h.toSpot=k)):(a.setsPortSpot&&(h.fromSpot=k),a.setsChildPortSpot&&(h.toSpot=e))}}break;case Wt:d=90===d||270===d?sd:td;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 Xt:for(d= 90===d||270===d?rd:qd,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=cu(a),this.gd===ut)for(e=a.destinationEdges;e.next();){if(d=e.value.link,null!==d){if(a.setsPortSpot)if(a.portSpot.Gb())switch(c){case 0:d.fromSpot=sd;break;case 90:d.fromSpot=td;break;case 180:d.fromSpot=rd;break;default:d.fromSpot=qd}else d.fromSpot=a.portSpot; if(a.setsChildPortSpot)if(a.childPortSpot.Gb())switch(c){case 0:d.toSpot=rd;break;case 90:d.toSpot=qd;break;case 180:d.toSpot=sd;break;default:d.toSpot=td}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.Gb())switch(c){case 0:d.toSpot=sd;break;case 90:d.toSpot=td;break;case 180:d.toSpot=rd;break;default:d.toSpot=qd}else d.toSpot=a.portSpot;if(a.setsChildPortSpot)if(a.childPortSpot.Gb())switch(c){case 0:d.fromSpot=rd;break; case 90:d.fromSpot=qd;break;case 180:d.fromSpot=sd;break;default:d.fromSpot=td}else d.fromSpot=a.childPortSpot}};function cu(a){a=a.angle;return 45>=a?0:135>=a?90:225>=a?180:315>=a?270:0}function ju(a){F&&w(a,zt,Z,"computeLayerSpacing:v");var b=cu(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 ku(a){F&&w(a,zt,Z,"computeNodeIndent:v");var b=cu(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)} ma.Object.defineProperties(Z.prototype,{roots:{configurable:!0,get:function(){return this.Ob},set:function(a){this.Ob!==a&&(w(a,I,Z,"roots"),this.Ob=a,this.D())}},path:{configurable:!0,get:function(){return this.rp},set:function(a){this.rp!==a&&(hb(a,Z,Z,"path"),this.rp=a,this.D())}},treeStyle:{configurable:!0,get:function(){return this.nq},set:function(a){this.Hb!==a&&(hb(a,Z,Z,"treeStyle"),a===vt||a===Ot||a===Pt||a===Nt)&&(this.nq=a,this.D())}},layerStyle:{configurable:!0, enumerable:!0,get:function(){return this.ps},set:function(a){this.Hb!==a&&(hb(a,Z,Z,"layerStyle"),a===wt||a===Jt||a===It)&&(this.ps=a,this.D())}},comments:{configurable:!0,get:function(){return this.fd},set:function(a){this.fd!==a&&(A(a,"boolean",Z,"comments"),this.fd=a,this.D())}},arrangement:{configurable:!0,get:function(){return this.Hb},set:function(a){this.Hb!==a&&(hb(a,Z,Z,"arrangement"),a===xt||a===Du||a===At)&&(this.Hb=a,this.D())}},arrangementSpacing:{configurable:!0, enumerable:!0,get:function(){return this.Hd},set:function(a){w(a,Hb,Z,"arrangementSpacing");this.Hd.A(a)||(this.Hd.assign(a),this.D())}},rootDefaults:{configurable:!0,get:function(){return this.W},set:function(a){this.W!==a&&(w(a,zt,Z,"rootDefaults"),this.W=a,this.D())}},alternateDefaults:{configurable:!0,get:function(){return this.Y},set:function(a){this.Y!==a&&(w(a,zt,Z,"alternateDefaults"),this.Y=a,this.D())}},sorting:{configurable:!0,get:function(){return this.W.sorting}, set:function(a){this.W.sorting!==a&&(hb(a,Z,Z,"sorting"),a===Qt||a===Rt||a===St||Tt)&&(this.W.sorting=a,this.D())}},comparer:{configurable:!0,get:function(){return this.W.comparer},set:function(a){this.W.comparer!==a&&(A(a,"function",Z,"comparer"),this.W.comparer=a,this.D())}},angle:{configurable:!0,get:function(){return this.W.angle},set:function(a){this.W.angle!==a&&(A(a,"number",Z,"angle"),0===a||90===a||180===a||270===a?(this.W.angle=a,this.D()):v("TreeLayout.angle must be 0, 90, 180, or 270"))}}, alignment:{configurable:!0,get:function(){return this.W.alignment},set:function(a){this.W.alignment!==a&&(hb(a,Z,Z,"alignment"),this.W.alignment=a,this.D())}},nodeIndent:{configurable:!0,get:function(){return this.W.nodeIndent},set:function(a){this.W.nodeIndent!==a&&(A(a,"number",Z,"nodeIndent"),0<=a&&(this.W.nodeIndent=a,this.D()))}},nodeIndentPastParent:{configurable:!0,get:function(){return this.W.nodeIndentPastParent},set:function(a){this.W.nodeIndentPastParent!== a&&(A(a,"number",Z,"nodeIndentPastParent"),0<=a&&1>=a&&(this.W.nodeIndentPastParent=a,this.D()))}},nodeSpacing:{configurable:!0,get:function(){return this.W.nodeSpacing},set:function(a){this.W.nodeSpacing!==a&&(A(a,"number",Z,"nodeSpacing"),this.W.nodeSpacing=a,this.D())}},layerSpacing:{configurable:!0,get:function(){return this.W.layerSpacing},set:function(a){this.W.layerSpacing!==a&&(A(a,"number",Z,"layerSpacing"),this.W.layerSpacing=a,this.D())}},layerSpacingParentOverlap:{configurable:!0, enumerable:!0,get:function(){return this.W.layerSpacingParentOverlap},set:function(a){this.W.layerSpacingParentOverlap!==a&&(A(a,"number",Z,"layerSpacingParentOverlap"),0<=a&&1>=a&&(this.W.layerSpacingParentOverlap=a,this.D()))}},compaction:{configurable:!0,get:function(){return this.W.compaction},set:function(a){this.W.compaction!==a&&(hb(a,Z,Z,"compaction"),a===$t||a===bu)&&(this.W.compaction=a,this.D())}},breadthLimit:{configurable:!0,get:function(){return this.W.breadthLimit}, set:function(a){this.W.breadthLimit!==a&&(A(a,"number",Z,"breadthLimit"),0<=a&&(this.W.breadthLimit=a,this.D()))}},rowSpacing:{configurable:!0,get:function(){return this.W.rowSpacing},set:function(a){this.W.rowSpacing!==a&&(A(a,"number",Z,"rowSpacing"),this.W.rowSpacing=a,this.D())}},rowIndent:{configurable:!0,get:function(){return this.W.rowIndent},set:function(a){this.W.rowIndent!==a&&(A(a,"number",Z,"rowIndent"),0<=a&&(this.W.rowIndent=a,this.D()))}},commentSpacing:{configurable:!0, enumerable:!0,get:function(){return this.W.commentSpacing},set:function(a){this.W.commentSpacing!==a&&(A(a,"number",Z,"commentSpacing"),this.W.commentSpacing=a,this.D())}},commentMargin:{configurable:!0,get:function(){return this.W.commentMargin},set:function(a){this.W.commentMargin!==a&&(A(a,"number",Z,"commentMargin"),this.W.commentMargin=a,this.D())}},setsPortSpot:{configurable:!0,get:function(){return this.W.setsPortSpot},set:function(a){this.W.setsPortSpot!==a&&(A(a, "boolean",Z,"setsPortSpot"),this.W.setsPortSpot=a,this.D())}},portSpot:{configurable:!0,get:function(){return this.W.portSpot},set:function(a){w(a,M,Z,"portSpot");this.W.portSpot.A(a)||(this.W.portSpot=a,this.D())}},setsChildPortSpot:{configurable:!0,get:function(){return this.W.setsChildPortSpot},set:function(a){this.W.setsChildPortSpot!==a&&(A(a,"boolean",Z,"setsChildPortSpot"),this.W.setsChildPortSpot=a,this.D())}},childPortSpot:{configurable:!0,get:function(){return this.W.childPortSpot}, set:function(a){w(a,M,Z,"childPortSpot");this.W.childPortSpot.A(a)||(this.W.childPortSpot=a,this.D())}},alternateSorting:{configurable:!0,get:function(){return this.Y.sorting},set:function(a){this.Y.sorting!==a&&(hb(a,Z,Z,"alternateSorting"),a===Qt||a===Rt||a===St||Tt)&&(this.Y.sorting=a,this.D())}},alternateComparer:{configurable:!0,get:function(){return this.Y.comparer},set:function(a){this.Y.comparer!==a&&(A(a,"function",Z,"alternateComparer"),this.Y.comparer=a,this.D())}}, alternateAngle:{configurable:!0,get:function(){return this.Y.angle},set:function(a){this.Y.angle!==a&&(A(a,"number",Z,"alternateAngle"),0===a||90===a||180===a||270===a)&&(this.Y.angle=a,this.D())}},alternateAlignment:{configurable:!0,get:function(){return this.Y.alignment},set:function(a){this.Y.alignment!==a&&(hb(a,Z,Z,"alternateAlignment"),this.Y.alignment=a,this.D())}},alternateNodeIndent:{configurable:!0,get:function(){return this.Y.nodeIndent},set:function(a){this.Y.nodeIndent!== a&&(A(a,"number",Z,"alternateNodeIndent"),0<=a&&(this.Y.nodeIndent=a,this.D()))}},alternateNodeIndentPastParent:{configurable:!0,get:function(){return this.Y.nodeIndentPastParent},set:function(a){this.Y.nodeIndentPastParent!==a&&(A(a,"number",Z,"alternateNodeIndentPastParent"),0<=a&&1>=a&&(this.Y.nodeIndentPastParent=a,this.D()))}},alternateNodeSpacing:{configurable:!0,get:function(){return this.Y.nodeSpacing},set:function(a){this.Y.nodeSpacing!==a&&(A(a,"number",Z,"alternateNodeSpacing"), this.Y.nodeSpacing=a,this.D())}},alternateLayerSpacing:{configurable:!0,get:function(){return this.Y.layerSpacing},set:function(a){this.Y.layerSpacing!==a&&(A(a,"number",Z,"alternateLayerSpacing"),this.Y.layerSpacing=a,this.D())}},alternateLayerSpacingParentOverlap:{configurable:!0,get:function(){return this.Y.layerSpacingParentOverlap},set:function(a){this.Y.layerSpacingParentOverlap!==a&&(A(a,"number",Z,"alternateLayerSpacingParentOverlap"),0<=a&&1>=a&&(this.Y.layerSpacingParentOverlap= a,this.D()))}},alternateCompaction:{configurable:!0,get:function(){return this.Y.compaction},set:function(a){this.Y.compaction!==a&&(hb(a,Z,Z,"alternateCompaction"),a===$t||a===bu)&&(this.Y.compaction=a,this.D())}},alternateBreadthLimit:{configurable:!0,get:function(){return this.Y.breadthLimit},set:function(a){this.Y.breadthLimit!==a&&(A(a,"number",Z,"alternateBreadthLimit"),0<=a&&(this.Y.breadthLimit=a,this.D()))}},alternateRowSpacing:{configurable:!0,get:function(){return this.Y.rowSpacing}, set:function(a){this.Y.rowSpacing!==a&&(A(a,"number",Z,"alternateRowSpacing"),this.Y.rowSpacing=a,this.D())}},alternateRowIndent:{configurable:!0,get:function(){return this.Y.rowIndent},set:function(a){this.Y.rowIndent!==a&&(A(a,"number",Z,"alternateRowIndent"),0<=a&&(this.Y.rowIndent=a,this.D()))}},alternateCommentSpacing:{configurable:!0,get:function(){return this.Y.commentSpacing},set:function(a){this.Y.commentSpacing!==a&&(A(a,"number",Z,"alternateCommentSpacing"), this.Y.commentSpacing=a,this.D())}},alternateCommentMargin:{configurable:!0,get:function(){return this.Y.commentMargin},set:function(a){this.Y.commentMargin!==a&&(A(a,"number",Z,"alternateCommentMargin"),this.Y.commentMargin=a,this.D())}},alternateSetsPortSpot:{configurable:!0,get:function(){return this.Y.setsPortSpot},set:function(a){this.Y.setsPortSpot!==a&&(A(a,"boolean",Z,"alternateSetsPortSpot"),this.Y.setsPortSpot=a,this.D())}},alternatePortSpot:{configurable:!0, enumerable:!0,get:function(){return this.Y.portSpot},set:function(a){w(a,M,Z,"alternatePortSpot");this.Y.portSpot.A(a)||(this.Y.portSpot=a,this.D())}},alternateSetsChildPortSpot:{configurable:!0,get:function(){return this.Y.setsChildPortSpot},set:function(a){this.Y.setsChildPortSpot!==a&&(A(a,"boolean",Z,"alternateSetsChildPortSpot"),this.Y.setsChildPortSpot=a,this.D())}},alternateChildPortSpot:{configurable:!0,get:function(){return this.Y.childPortSpot},set:function(a){w(a, M,Z,"alternateChildPortSpot");this.Y.childPortSpot.A(a)||(this.Y.childPortSpot=a,this.D())}}}); var tt=new E(Z,"PathDefault",-1),ut=new E(Z,"PathDestination",0),Bt=new E(Z,"PathSource",1),Qt=new E(Z,"SortingForwards",10),Rt=new E(Z,"SortingReverse",11),St=new E(Z,"SortingAscending",12),Tt=new E(Z,"SortingDescending",13),tu=new E(Z,"AlignmentCenterSubtrees",20),uu=new E(Z,"AlignmentCenterChildren",21),du=new E(Z,"AlignmentStart",22),eu=new E(Z,"AlignmentEnd",23),Vt=new E(Z,"AlignmentBus",24),Lt=new E(Z,"AlignmentBusBranching",25),Wt=new E(Z,"AlignmentTopLeftBus",26),Xt=new E(Z,"AlignmentBottomRightBus", 27),$t=new E(Z,"CompactionNone",30),bu=new E(Z,"CompactionBlock",31),vt=new E(Z,"StyleLayered",40),Pt=new E(Z,"StyleLastParents",41),Ot=new E(Z,"StyleAlternating",42),Nt=new E(Z,"StyleRootOnly",43),xt=new E(Z,"ArrangementVertical",50),Du=new E(Z,"ArrangementHorizontal",51),At=new E(Z,"ArrangementFixedRoots",52),wt=new E(Z,"LayerIndividual",60),Jt=new E(Z,"LayerSiblings",61),It=new E(Z,"LayerUniform",62);Z.className="TreeLayout";Z.PathDefault=tt;Z.PathDestination=ut;Z.PathSource=Bt; Z.SortingForwards=Qt;Z.SortingReverse=Rt;Z.SortingAscending=St;Z.SortingDescending=Tt;Z.AlignmentCenterSubtrees=tu;Z.AlignmentCenterChildren=uu;Z.AlignmentStart=du;Z.AlignmentEnd=eu;Z.AlignmentBus=Vt;Z.AlignmentBusBranching=Lt;Z.AlignmentTopLeftBus=Wt;Z.AlignmentBottomRightBus=Xt;Z.CompactionNone=$t;Z.CompactionBlock=bu;Z.StyleLayered=vt;Z.StyleLastParents=Pt;Z.StyleAlternating=Ot;Z.StyleRootOnly=Nt;Z.ArrangementVertical=xt;Z.ArrangementHorizontal=Du;Z.ArrangementFixedRoots=At;Z.LayerIndividual=wt; Z.LayerSiblings=Jt;Z.LayerUniform=It;function yt(a){iq.call(this,a)}la(yt,iq);yt.prototype.createVertex=function(){return new zt(this)};yt.prototype.createEdge=function(){return new Fu(this)};yt.className="TreeNetwork"; function zt(a){lq.call(this,a);this.Ma=!1;this.Oc=null;this.L=[];this.qd=this.ib=this.$=this.Na=0;this.fd=null;this.V=new J(0,0);this.Aa=new Hb(0,0);this.ja=new J(0,0);this.Vm=this.Um=this.OA=!1;this.Zq=this.Mq=null;this.Xc=Qt;this.Rc=sq;this.dc=0;this.Bb=uu;this.As=this.zs=0;this.Bs=20;this.ye=50;this.os=0;this.Br=bu;this.tr=0;this.Os=25;this.Ar=this.Ns=10;this.zr=20;this.at=!0;this.Ks=ld;this.$s=!0;this.wr=ld}la(zt,lq); zt.prototype.copyInheritedPropertiesFrom=function(a){null!==a&&(this.Xc=a.sorting,this.Rc=a.comparer,this.dc=a.angle,this.Bb=a.alignment,this.zs=a.nodeIndent,this.As=a.nodeIndentPastParent,this.Bs=a.nodeSpacing,this.ye=a.layerSpacing,this.os=a.layerSpacingParentOverlap,this.Br=a.compaction,this.tr=a.breadthLimit,this.Os=a.rowSpacing,this.Ns=a.rowIndent,this.Ar=a.commentSpacing,this.zr=a.commentMargin,this.at=a.setsPortSpot,this.Ks=a.portSpot,this.$s=a.setsChildPortSpot,this.wr=a.childPortSpot)}; ma.Object.defineProperties(zt.prototype,{initialized:{configurable:!0,get:function(){return this.Ma},set:function(a){this.Ma!==a&&(A(a,"boolean",zt,"initialized"),this.Ma=a)}},parent:{configurable:!0,get:function(){return this.Oc},set:function(a){this.Oc!==a&&(F&&null!==a&&w(a,zt,zt,"parent"),this.Oc=a)}},children:{configurable:!0,get:function(){return this.L},set:function(a){if(this.L!==a){null===a||Array.isArray(a)||xa(a,"Array",zt,"children:value");if(null!== a)for(var b=a.length,c=0;c<b;c++){var d=a[c];F&&w(d,zt,zt,"children")}this.L=a}}},level:{configurable:!0,get:function(){return this.Na},set:function(a){this.Na!==a&&(A(a,"number",zt,"level"),this.Na=a)}},descendantCount:{configurable:!0,get:function(){return this.$},set:function(a){this.$!==a&&(A(a,"number",zt,"descendantCount"),this.$=a)}},maxChildrenCount:{configurable:!0,get:function(){return this.ib},set:function(a){this.ib!==a&&(A(a,"number",zt,"maxChildrenCount"), this.ib=a)}},maxGenerationCount:{configurable:!0,get:function(){return this.qd},set:function(a){this.qd!==a&&(A(a,"number",zt,"maxGenerationCount"),this.qd=a)}},comments:{configurable:!0,get:function(){return this.fd},set:function(a){if(this.fd!==a){null===a||Array.isArray(a)||xa(a,"Array",zt,"comments:value");if(null!==a)for(var b=a.length,c=0;c<b;c++){var d=a[c];F&&w(d,T,zt,"comments")}this.fd=a}}},sorting:{configurable:!0,get:function(){return this.Xc}, set:function(a){this.Xc!==a&&(hb(a,Z,zt,"sorting"),this.Xc=a)}},comparer:{configurable:!0,get:function(){return this.Rc},set:function(a){this.Rc!==a&&(A(a,"function",zt,"comparer"),this.Rc=a)}},angle:{configurable:!0,get:function(){return this.dc},set:function(a){this.dc!==a&&(A(a,"number",zt,"angle"),this.dc=a)}},alignment:{configurable:!0,get:function(){return this.Bb},set:function(a){this.Bb!==a&&(hb(a,Z,zt,"alignment"),this.Bb=a)}},nodeIndent:{configurable:!0, enumerable:!0,get:function(){return this.zs},set:function(a){this.zs!==a&&(A(a,"number",zt,"nodeIndent"),this.zs=a)}},nodeIndentPastParent:{configurable:!0,get:function(){return this.As},set:function(a){this.As!==a&&(A(a,"number",zt,"nodeIndentPastParent"),this.As=a)}},nodeSpacing:{configurable:!0,get:function(){return this.Bs},set:function(a){this.Bs!==a&&(A(a,"number",zt,"nodeSpacing"),this.Bs=a)}},layerSpacing:{configurable:!0,get:function(){return this.ye}, set:function(a){this.ye!==a&&(A(a,"number",zt,"layerSpacing"),this.ye=a)}},layerSpacingParentOverlap:{configurable:!0,get:function(){return this.os},set:function(a){this.os!==a&&(A(a,"number",zt,"layerSpacingParentOverlap"),this.os=a)}},compaction:{configurable:!0,get:function(){return this.Br},set:function(a){this.Br!==a&&(hb(a,Z,zt,"compaction"),this.Br=a)}},breadthLimit:{configurable:!0,get:function(){return this.tr},set:function(a){this.tr!==a&&(A(a,"number", zt,"breadthLimit"),this.tr=a)}},rowSpacing:{configurable:!0,get:function(){return this.Os},set:function(a){this.Os!==a&&(A(a,"number",zt,"rowSpacing"),this.Os=a)}},rowIndent:{configurable:!0,get:function(){return this.Ns},set:function(a){this.Ns!==a&&(A(a,"number",zt,"rowIndent"),this.Ns=a)}},commentSpacing:{configurable:!0,get:function(){return this.Ar},set:function(a){this.Ar!==a&&(A(a,"number",zt,"commentSpacing"),this.Ar=a)}},commentMargin:{configurable:!0, enumerable:!0,get:function(){return this.zr},set:function(a){this.zr!==a&&(A(a,"number",zt,"commentMargin"),this.zr=a)}},setsPortSpot:{configurable:!0,get:function(){return this.at},set:function(a){this.at!==a&&(A(a,"boolean",zt,"setsPortSpot"),this.at=a)}},portSpot:{configurable:!0,get:function(){return this.Ks},set:function(a){w(a,M,zt,"portSpot");this.Ks.A(a)||(this.Ks=a)}},setsChildPortSpot:{configurable:!0,get:function(){return this.$s},set:function(a){this.$s!== a&&(A(a,"boolean",zt,"setsChildPortSpot"),this.$s=a)}},childPortSpot:{configurable:!0,get:function(){return this.wr},set:function(a){w(a,M,zt,"childPortSpot");this.wr.A(a)||(this.wr=a)}},childrenCount:{configurable:!0,get:function(){return this.children.length}},relativePosition:{configurable:!0,get:function(){return this.V},set:function(a){this.V.set(a)}},subtreeSize:{configurable:!0,get:function(){return this.Aa},set:function(a){this.Aa.set(a)}}, subtreeOffset:{configurable:!0,get:function(){return this.ja},set:function(a){this.ja.set(a)}}});zt.className="TreeVertex";function Fu(a){mq.call(this,a);this.cv=new J(0,0)}la(Fu,mq); Fu.prototype.commit=function(){var a=this.link;if(null!==a&&!a.isAvoiding){var b=this.network.layout,c=null,d=null;switch(b.gd){case ut:c=this.fromVertex;d=this.toVertex;break;case Bt:c=this.toVertex;d=this.fromVertex;break;default:v("Unhandled path value "+b.gd.toString())}if(null!==c&&null!==d)if(b=this.cv,0!==b.x||0!==b.y||c.OA){d=c.bounds;var e=cu(c),f=ju(c),g=c.rowSpacing;a.tj();var h=a.curve===rg,k=a.isOrthogonal,l;a.Vh();if(k||h){for(l=2;4<a.pointsCount;)a.pw(2);var m=a.i(1);var n=a.i(2)}else{for(l= 1;3<a.pointsCount;)a.pw(1);m=a.i(0);n=a.i(a.pointsCount-1)}var p=a.i(a.pointsCount-1);0===e?(c.alignment===eu?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-ku(c))))):c.alignment===du?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+ku(c))))):e=c.Um||c.Vm&&1===c.maxGenerationCount?d.top-c.ja.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===eu?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-ku(c))))):c.alignment===du?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+ku(c))))):e=c.Um||c.Vm&&1===c.maxGenerationCount?d.left-c.ja.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===eu?(e=d.bottom+b.y,0===b.y&&m.y>p.y+c.rowIndent&&(e=Math.min(e,Math.max(m.y,e-ku(c))))):c.alignment===du?(e=d.top+b.y,0===b.y&&m.y<p.y-c.rowIndent&&(e=Math.max(e,Math.min(m.y,e+ku(c))))):e=c.Um||c.Vm&&1===c.maxGenerationCount?d.top-c.ja.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===eu?(e=d.right+b.x,0===b.x&&m.x>p.x+c.rowIndent&&(e=Math.min(e,Math.max(m.x,e-ku(c))))):c.alignment===du?(e=d.left+b.x,0===b.x&&m.x<p.x-c.rowIndent&&(e=Math.max(e,Math.min(m.x,e+ku(c))))):e=c.Um||c.Vm&&1===c.maxGenerationCount? d.left-c.ja.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.Df()}else b=d,F&&w(c,zt,Fu,"adjustRouteForAngleChange:parent"),F&&w(b,zt,Fu,"adjustRouteForAngleChange:child"),a=this.link,f=cu(c),f!==cu(b)&&(g=ju(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.tj(),c=a.curve===rg,b=a.isOrthogonal,d=Ut(this.fromVertex.alignment),a.Vh(),0===f?(f=h.right+g/2,c?4===a.pointsCount&&(c=a.i(3).y,a.N(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.N(5,a.i(5).x,c)):b?d?a.N(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.N(2,f,a.i(2).y),a.N(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.N(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.N(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.N(5,c,a.i(5).y)):b?d?a.N(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.N(2,a.i(2).x,f),a.N(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.N(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.N(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.N(5,a.i(5).x,c)):b?d?a.N(3,a.i(2).x,a.i(4).y): 6===a.pointsCount&&(a.N(2,f,a.i(2).y),a.N(3,f,a.i(3).y)):4===a.pointsCount?a.m(2,f,a.i(2).y):3===a.pointsCount?a.N(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.N(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.N(5,c,a.i(5).y)):b?d?a.N(3,a.i(2).x,a.i(4).y):6===a.pointsCount&&(a.N(2,a.i(2).x,f),a.N(3,a.i(3).x,f)):4===a.pointsCount?a.m(2,a.i(2).x,f):3===a.pointsCount?a.N(1,a.i(2).x,f):2===a.pointsCount&&a.m(1,a.i(1).x,f)),a.Df()))}}; ma.Object.defineProperties(Fu.prototype,{relativePoint:{configurable:!0,get:function(){return this.cv},set:function(a){this.cv.set(a)}}});Fu.className="TreeEdge"; Ua.prototype.initializeStandardTools=function(){this.bb("Action",new Rg,this.mouseDownTools);this.bb("Relinking",new lf,this.mouseDownTools);this.bb("LinkReshaping",new pg,this.mouseDownTools);this.bb("Rotating",new Pg,this.mouseDownTools);this.bb("Resizing",new Ig,this.mouseDownTools);this.bb("Linking",new ig,this.mouseMoveTools);this.bb("Dragging",new df,this.mouseMoveTools);this.bb("DragSelecting",new Ug,this.mouseMoveTools);this.bb("Panning",new Vg,this.mouseMoveTools);this.bb("ContextMenu",new Xg, this.mouseUpTools);this.bb("TextEditing",new hh,this.mouseUpTools);this.bb("ClickCreating",new Sg,this.mouseUpTools);this.bb("ClickSelecting",new Qg,this.mouseUpTools)};Un("Horizontal",new Pm);Un("Spot",new Rm);Un("Table",new Vm);Un("Viewbox",new $m);Un("TableRow",new Ym);Un("TableColumn",new Zm);Un("Graduated",new kn);Un("Grid",new an);Hi.add(vr.type,Lq);Hi.add(zr.type,Zq); var Gu=qa.go,Hu={get licenseKey(){return P.licenseKey},set licenseKey(a){P.licenseKey=a},get version(){return P.version},Group:Hf,EnumValue:E,List:H,Set:I,Map:Db,Point:J,Size:Hb,Rect:L,Margin:lc,Spot:M,Geometry:Fd,PathFigure:te,PathSegment:ue,InputEvent:we,DiagramEvent:Fe,ChangedEvent:Ge,Model:W,GraphLinksModel:vr,TreeModel:zr,Binding:$i,Transaction:Le,UndoManager:Me,CommandHandler:hl,Tool:Oe,DraggingTool:df,DraggingInfo:mf,DraggingOptions:ef,LinkingBaseTool:Xf,LinkingTool:ig,RelinkingTool:lf,LinkReshapingTool:pg, ResizingTool:Ig,RotatingTool:Pg,ClickSelectingTool:Qg,ActionTool:Rg,ClickCreatingTool:Sg,HTMLInfo:bf,ContextMenuTool:Xg,DragSelectingTool:Ug,PanningTool:Vg,TextEditingTool:hh,ToolManager:Ua,Animation:Dh,AnimationManager:zh,AnimationTrigger:qi,Layer:vi,Diagram:P,Palette:$k,Overview:cl,Brush:Kl,GraphObject:N,Panel:U,RowColumnDefinition:ik,Shape:Yf,TextBlock:ih,TextBlockMetrics:Do,Picture:xk,Part:S,Adornment:Te,Node:T,Link:R,Placeholder:Kg,Layout:Ni,LayoutNetwork:iq,LayoutVertex:lq,LayoutEdge:mq,GridLayout:bl, PanelLayout:em,CircularLayout:Br,CircularNetwork:Sr,CircularVertex:es,CircularEdge:fs,ForceDirectedLayout:gs,ForceDirectedNetwork:hs,ForceDirectedVertex:rs,ForceDirectedEdge:vs,LayeredDigraphLayout:ws,LayeredDigraphNetwork:Bs,LayeredDigraphVertex:rt,LayeredDigraphEdge:st,TreeLayout:Z,TreeNetwork:yt,TreeVertex:zt,TreeEdge:Fu};Gu&&Gu.version!==Hu.version&&v("WARNING: a `go` object on the root object is already defined with a version mismatch."+Gu.version+". Replaced with version: "+Hu.version); qa.go=Hu;("undefined"===typeof qa||"undefined"===typeof qa.module||"object"!==typeof qa.module.exports)&&qa.define&&"function"===typeof qa.define&&qa.define.amd&&qa.define(Hu);Hu.Debug=F;F.iz(Hu); 'undefined'!==typeof module&&'object'===typeof module.exports&&(module.exports='undefined'!==typeof global?global.go:self.go); })();
define(['./utils/utils', './xm'], function(utils, xm) { var defaultCfg = { debug: false }; return { config: function(cfg) { }, create: function(opt) { return new xm(opt); } } });
require.config({ // baseUrl: "../dist/js", baseUrl: "/static/js", paths: { "jquery": ["libs/jquery-2.1.4.min", "libs/jquery-1.7.2.min", "http://libs.baidu.com/jquery/2.0.3/jquery"], "zepto": "libs/zepto.min", "mobile": "libs/date/jquery.mobile-1.4.5.min", "mobiscroll": "libs/date/mobiscroll", //通过shim绑定关联模块jquery "iscroll": "libs/iscroll", "iosselect": "libs/iosselect/iosSelect",//ios select样式 "vue": "libs/vue",//vue "vue_resource": "libs/vue-resource",//vue "yanzheng": "common/yanzheng", //将通用方法放在同一个模块中 "ajaxps": "common/ajaxps", //在模块中调用其他模块的方法 "date": "common/date", //在模块中调用其他模块的方法--日期插件 "close_tip": "common/close_tip", //在模块中调用其他模块的方法--关闭弹框 "date_change": "common/date_change",//时间格式化 从2016-09-22 11:22:33到2016.9.18 "jsonp": "libs/jquery.jsonp", "ajax_rule": "common/ajax_rule",//ajax框架 "scroll_more": "common/scroll_more",//滑动查看更多 "scroll_down": "common/scroll_down",//缓慢滚动到底部 "add_bounced": "common/add_bounced",//弹框,包括load动画和遮层 "localstorage":"common/localstorage",//存储localstorage "date_get": "common/date_get",//获取年月日--创建活动日期 "date_day": "common/date_day",//获取年月日--生日 "if_menu": "common/if_menu",//判断 处置活动首页显示右上角导航 "jsbridge": "common/jsbridge",//环境还未准备好,bridge 还未注入,H5跟 Native还不能交互,放进队列中 "native": "common/native",//解析app方法 "alert_word": "common/alert_word",//提示文字 "JSTools":"common/js_tools",//js工具 }, shim: {       'mobiscroll': {         deps: ['jquery'],          exports: 'mobiscroll'       },       'jsonp': {         deps: ['jquery'],          exports: 'jsonp'       }, 'zepto': {                 exports: '$'       }, 'vue':{ exports:'vue' }, // 'vue_resource': {         // deps: ['vue'], //          // exports: 'vue_resource'       // }, } });
/*! * libvorbis plugin for videojs-record * @version 4.3.0 * @see https://github.com/collab-project/videojs-record * @copyright 2014-2021 Collab * @license MIT */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(require("video.js")); else if(typeof define === 'function' && define.amd) define("VideojsRecord", ["video.js"], factory); else if(typeof exports === 'object') exports["VideojsRecord"] = factory(require("video.js")); else root["VideojsRecord"] = root["VideojsRecord"] || {}, root["VideojsRecord"]["libvorbis"] = factory(root["videojs"]); })(self, function(__WEBPACK_EXTERNAL_MODULE_video_js__) { return /******/ (() => { // webpackBootstrap /******/ var __webpack_modules__ = ({ /***/ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js": /*!**********************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/assertThisInitialized.js ***! \**********************************************************************/ /***/ ((module) => { function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } module.exports = _assertThisInitialized; /***/ }), /***/ "./node_modules/@babel/runtime/helpers/classCallCheck.js": /*!***************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/classCallCheck.js ***! \***************************************************************/ /***/ ((module) => { function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } module.exports = _classCallCheck; /***/ }), /***/ "./node_modules/@babel/runtime/helpers/createClass.js": /*!************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/createClass.js ***! \************************************************************/ /***/ ((module) => { function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } module.exports = _createClass; /***/ }), /***/ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js": /*!***************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/getPrototypeOf.js ***! \***************************************************************/ /***/ ((module) => { function _getPrototypeOf(o) { module.exports = _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } module.exports = _getPrototypeOf; /***/ }), /***/ "./node_modules/@babel/runtime/helpers/inherits.js": /*!*********************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/inherits.js ***! \*********************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var setPrototypeOf = __webpack_require__(/*! ./setPrototypeOf */ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js"); function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) setPrototypeOf(subClass, superClass); } module.exports = _inherits; /***/ }), /***/ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js": /*!**********************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/interopRequireDefault.js ***! \**********************************************************************/ /***/ ((module) => { function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { "default": obj }; } module.exports = _interopRequireDefault; /***/ }), /***/ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js": /*!**************************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js ***! \**************************************************************************/ /***/ ((module, __unused_webpack_exports, __webpack_require__) => { var _typeof = __webpack_require__(/*! ../helpers/typeof */ "./node_modules/@babel/runtime/helpers/typeof.js"); var assertThisInitialized = __webpack_require__(/*! ./assertThisInitialized */ "./node_modules/@babel/runtime/helpers/assertThisInitialized.js"); function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return assertThisInitialized(self); } module.exports = _possibleConstructorReturn; /***/ }), /***/ "./node_modules/@babel/runtime/helpers/setPrototypeOf.js": /*!***************************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/setPrototypeOf.js ***! \***************************************************************/ /***/ ((module) => { function _setPrototypeOf(o, p) { module.exports = _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } module.exports = _setPrototypeOf; /***/ }), /***/ "./node_modules/@babel/runtime/helpers/typeof.js": /*!*******************************************************!*\ !*** ./node_modules/@babel/runtime/helpers/typeof.js ***! \*******************************************************/ /***/ ((module) => { function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { module.exports = _typeof = function _typeof(obj) { return typeof obj; }; } else { module.exports = _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } module.exports = _typeof; /***/ }), /***/ "./src/js/plugins/libvorbis-plugin.js": /*!********************************************!*\ !*** ./src/js/plugins/libvorbis-plugin.js ***! \********************************************/ /***/ ((module, exports, __webpack_require__) => { "use strict"; var _interopRequireDefault = __webpack_require__(/*! @babel/runtime/helpers/interopRequireDefault */ "./node_modules/@babel/runtime/helpers/interopRequireDefault.js"); Object.defineProperty(exports, "__esModule", ({ value: true })); exports.default = void 0; var _classCallCheck2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/classCallCheck */ "./node_modules/@babel/runtime/helpers/classCallCheck.js")); var _createClass2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/createClass */ "./node_modules/@babel/runtime/helpers/createClass.js")); var _inherits2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/inherits */ "./node_modules/@babel/runtime/helpers/inherits.js")); var _possibleConstructorReturn2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/possibleConstructorReturn */ "./node_modules/@babel/runtime/helpers/possibleConstructorReturn.js")); var _getPrototypeOf2 = _interopRequireDefault(__webpack_require__(/*! @babel/runtime/helpers/getPrototypeOf */ "./node_modules/@babel/runtime/helpers/getPrototypeOf.js")); var _video = _interopRequireDefault(__webpack_require__(/*! video.js */ "video.js")); function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = (0, _getPrototypeOf2.default)(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = (0, _getPrototypeOf2.default)(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return (0, _possibleConstructorReturn2.default)(this, result); }; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function () {})); return true; } catch (e) { return false; } } var RecordEngine = _video.default.getComponent('RecordEngine'); var LibVorbisEngine = function (_RecordEngine) { (0, _inherits2.default)(LibVorbisEngine, _RecordEngine); var _super = _createSuper(LibVorbisEngine); function LibVorbisEngine(player, options) { var _this; (0, _classCallCheck2.default)(this, LibVorbisEngine); _this = _super.call(this, player, options); _this.debug = false; _this.sampleRate = 32000; return _this; } (0, _createClass2.default)(LibVorbisEngine, [{ key: "setup", value: function setup(stream, mediaType, debug) { this.inputStream = stream; this.mediaType = mediaType; this.debug = debug; this.options = { audioBitsPerSecond: this.sampleRate }; } }, { key: "start", value: function start() { this.chunks = []; this.engine = new VorbisMediaRecorder(this.inputStream, this.options); this.engine.ondataavailable = this.onData.bind(this); this.engine.onstop = this.onRecordingAvailable.bind(this); this.engine.start(); } }, { key: "stop", value: function stop() { try { this.engine.stop(); } catch (err) {} } }, { key: "onData", value: function onData(event) { this.chunks.push(event.data); } }, { key: "onRecordingAvailable", value: function onRecordingAvailable() { var blob = new Blob(this.chunks, { type: this.chunks[0].type }); this.chunks = []; this.onStopRecording(blob); } }]); return LibVorbisEngine; }(RecordEngine); _video.default.LibVorbisEngine = LibVorbisEngine; var _default = LibVorbisEngine; exports.default = _default; module.exports = exports.default; /***/ }), /***/ "video.js": /*!*************************************************************************************************!*\ !*** external {"commonjs":"video.js","commonjs2":"video.js","amd":"video.js","root":"videojs"} ***! \*************************************************************************************************/ /***/ ((module) => { "use strict"; module.exports = __WEBPACK_EXTERNAL_MODULE_video_js__; /***/ }) /******/ }); /************************************************************************/ /******/ // The module cache /******/ var __webpack_module_cache__ = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ // Check if module is in cache /******/ if(__webpack_module_cache__[moduleId]) { /******/ return __webpack_module_cache__[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = __webpack_module_cache__[moduleId] = { /******/ // no module.id needed /******/ // no module.loaded needed /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ __webpack_modules__[moduleId](module, module.exports, __webpack_require__); /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /************************************************************************/ /******/ /******/ // startup /******/ // Load entry module and return exports /******/ // This entry module is referenced by other modules so it can't be inlined /******/ var __webpack_exports__ = __webpack_require__("./src/js/plugins/libvorbis-plugin.js"); /******/ /******/ return __webpack_exports__; /******/ })() ; });
import { OpKind, RpcClient } from '@taquito/rpc'; export { OpKind } from '@taquito/rpc'; import { combineLatest, ReplaySubject, from, defer, timer, throwError, of, range, concat, Subject, NEVER, Observable } from 'rxjs'; import { distinctUntilChanged, map, takeWhile, tap, shareReplay, filter, first, switchMap, distinctUntilKeyChanged, timeoutWith, startWith, concatMap, mapTo, switchMapTo, retry, takeUntil, catchError, pluck, publishReplay, refCount } from 'rxjs/operators'; import BigNumber from 'bignumber.js'; import { Schema, ParameterSchema, MichelsonMap } from '@taquito/michelson-encoder'; export { MichelsonMap, UnitValue } from '@taquito/michelson-encoder'; import { HttpResponseError, STATUS_CODE } from '@taquito/http-utils'; import { encodeExpr } from '@taquito/utils'; import { Parser, packDataBytes } from '@taquito/michel-codec'; /*! ***************************************************************************** Copyright (c) Microsoft Corporation. Permission to use, copy, modify, and/or distribute this software for any purpose with or without fee is hereby granted. THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE. ***************************************************************************** */ /* 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 (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; }; return extendStatics(d, b); }; function __extends(d, b) { if (typeof b !== "function" && b !== null) throw new TypeError("Class extends value " + String(b) + " is not a constructor or null"); 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 __rest(s, e) { var t = {}; for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p) && e.indexOf(p) < 0) t[p] = s[p]; if (s != null && typeof Object.getOwnPropertySymbols === "function") for (var i = 0, p = Object.getOwnPropertySymbols(s); i < p.length; i++) { if (e.indexOf(p[i]) < 0 && Object.prototype.propertyIsEnumerable.call(s, p[i])) t[p[i]] = s[p[i]]; } return t; } function __awaiter(thisArg, _arguments, P, generator) { function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); } return new (P || (P = Promise))(function (resolve, reject) { function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } } function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } } function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); } step((generator = generator.apply(thisArg, _arguments || [])).next()); }); } function __generator(thisArg, body) { var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g; return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g; function verb(n) { return function (v) { return step([n, v]); }; } function step(op) { if (f) throw new TypeError("Generator is already executing."); while (_) try { if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t; if (y = 0, t) op = [op[0] & 2, t.value]; switch (op[0]) { case 0: case 1: t = op; break; case 4: _.label++; return { value: op[1], done: false }; case 5: _.label++; y = op[1]; op = [0]; continue; case 7: op = _.ops.pop(); _.trys.pop(); continue; default: if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; } if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; } if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; } if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; } if (t[2]) _.ops.pop(); _.trys.pop(); continue; } op = body.call(thisArg, _); } catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; } if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true }; } } function __values(o) { var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0; if (m) return m.call(o); if (o && typeof o.length === "number") return { next: function () { if (o && i >= o.length) o = void 0; return { value: o && o[i++], done: !o }; } }; throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined."); } 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 __spreadArray(to, from) { for (var i = 0, il = from.length, j = to.length; i < il; i++, j++) to[j] = from[i]; return to; } var RpcForger = /** @class */ (function () { function RpcForger(context) { this.context = context; } RpcForger.prototype.forge = function (_a) { var branch = _a.branch, contents = _a.contents; return this.context.rpc.forgeOperations({ branch: branch, contents: contents }); }; return RpcForger; }()); var RpcInjector = /** @class */ (function () { function RpcInjector(context) { this.context = context; } RpcInjector.prototype.inject = function (signedOperationBytes) { return this.context.rpc.injectOperation(signedOperationBytes); }; return RpcInjector; }()); var UnconfiguredSignerError = /** @class */ (function () { function UnconfiguredSignerError() { this.name = 'UnconfiguredSignerError'; this.message = 'No signer has been configured. Please configure one by calling setProvider({signer}) on your TezosToolkit instance.'; } return UnconfiguredSignerError; }()); /** * @description Default signer implementation which does nothing and produce invalid signature */ var NoopSigner = /** @class */ (function () { function NoopSigner() { } NoopSigner.prototype.publicKey = function () { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { throw new UnconfiguredSignerError(); }); }); }; NoopSigner.prototype.publicKeyHash = function () { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { throw new UnconfiguredSignerError(); }); }); }; NoopSigner.prototype.secretKey = function () { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { throw new UnconfiguredSignerError(); }); }); }; NoopSigner.prototype.sign = function (_bytes, _watermark) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { throw new UnconfiguredSignerError(); }); }); }; return NoopSigner; }()); var attachKind = function (op, kind) { return __assign(__assign({}, op), { kind: kind }); }; var findWithKind = function (arr, kind) { if (Array.isArray(arr)) { var found = arr.find(function (op) { return op.kind === kind; }); if (found && isKind(found, kind)) { return found; } } }; var isKind = function (op, kind) { return op.kind === kind; }; var isOpWithFee = function (op) { return ['transaction', 'delegation', 'origination', 'reveal'].indexOf(op.kind) !== -1; }; var isOpRequireReveal = function (op) { return ['transaction', 'delegation', 'origination'].indexOf(op.kind) !== -1; }; var hasMetadata = function (op) { return 'metadata' in op; }; var hasMetadataWithResult = function (op) { return hasMetadata(op) && 'operation_result' in op.metadata; }; var hasMetadataWithInternalOperationResult = function (op) { return hasMetadata(op) && 'internal_operation_results' in op.metadata; }; var isErrorWithMessage = function (error) { return 'with' in error; }; var TezosOperationError = /** @class */ (function () { function TezosOperationError(errors) { this.errors = errors; this.name = 'TezosOperationError'; // Last error is 'often' the one with more detail var lastError = errors[errors.length - 1]; this.id = lastError.id; this.kind = lastError.kind; this.message = "(" + this.kind + ") " + this.id; if (isErrorWithMessage(lastError) && lastError.with.string) { this.message = lastError.with.string; } } return TezosOperationError; }()); var TezosPreapplyFailureError = /** @class */ (function () { function TezosPreapplyFailureError(result) { this.result = result; this.name = 'TezosPreapplyFailureError'; this.message = 'Preapply returned an unexpected result'; } return TezosPreapplyFailureError; }()); // Flatten all operation content results and internal operation results into a single array // Some cases where we can have multiple operation results or internal operation results are: // - When an operation includes a reveal operation // - When an operation is made using the batch API // - Smart contract call can contains internal operation results when they call other smart contract internally or originate contracts var flattenOperationResult = function (response) { var results = Array.isArray(response) ? response : [response]; var returnedResults = []; for (var i = 0; i < results.length; i++) { for (var j = 0; j < results[i].contents.length; j++) { var content = results[i].contents[j]; if (hasMetadataWithResult(content)) { returnedResults.push(__assign({ fee: content.fee }, content.metadata.operation_result)); if (Array.isArray(content.metadata.internal_operation_results)) { content.metadata.internal_operation_results.forEach(function (x) { return returnedResults.push(x.result); }); } } } } return returnedResults; }; /*** * @description Flatten all error from preapply response (including internal error) */ var flattenErrors = function (response, status) { var e_1, _a; if (status === void 0) { status = 'failed'; } var results = Array.isArray(response) ? response : [response]; var errors = []; // Transaction that do not fail will be backtracked in case one failure occur for (var i = 0; i < results.length; i++) { for (var j = 0; j < results[i].contents.length; j++) { var content = results[i].contents[j]; if (hasMetadata(content)) { if (hasMetadataWithResult(content) && content.metadata.operation_result.status === status) { errors = errors.concat(content.metadata.operation_result.errors || []); } if (hasMetadataWithInternalOperationResult(content) && Array.isArray(content.metadata.internal_operation_results)) { try { for (var _b = (e_1 = void 0, __values(content.metadata.internal_operation_results)), _c = _b.next(); !_c.done; _c = _b.next()) { var internalResult = _c.value; if ('result' in internalResult && internalResult.result.status === status) { errors = errors.concat(internalResult.result.errors || []); } } } 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 errors; }; var receiptFromOperation = function (op, _a) { var _b = _a === void 0 ? { ALLOCATION_BURN: 257, ORIGINATION_BURN: 257, } : _a, ALLOCATION_BURN = _b.ALLOCATION_BURN, ORIGINATION_BURN = _b.ORIGINATION_BURN; var operationResults = flattenOperationResult({ contents: op }); var totalGas = new BigNumber(0); var totalStorage = new BigNumber(0); var totalFee = new BigNumber(0); var totalOriginationBurn = new BigNumber(0); var totalAllocationBurn = new BigNumber(0); var totalPaidStorageDiff = new BigNumber(0); operationResults.forEach(function (result) { totalFee = totalFee.plus(result.fee || 0); totalOriginationBurn = totalOriginationBurn.plus(Array.isArray(result.originated_contracts) ? result.originated_contracts.length * ORIGINATION_BURN : 0); totalAllocationBurn = totalAllocationBurn.plus('allocated_destination_contract' in result ? ALLOCATION_BURN : 0); totalGas = totalGas.plus(result.consumed_gas || 0); totalPaidStorageDiff = totalPaidStorageDiff.plus('paid_storage_size_diff' in result ? Number(result.paid_storage_size_diff) || 0 : 0); }); totalStorage = totalStorage .plus(totalAllocationBurn) .plus(totalOriginationBurn) .plus(totalPaidStorageDiff); return { totalFee: totalFee, totalGas: totalGas, totalStorage: totalStorage, totalAllocationBurn: totalAllocationBurn, totalOriginationBurn: totalOriginationBurn, totalPaidStorageDiff: totalPaidStorageDiff, totalStorageBurn: new BigNumber(totalStorage.multipliedBy(1000)), }; }; var MissedBlockDuringConfirmationError = /** @class */ (function () { function MissedBlockDuringConfirmationError() { this.name = 'MissedBlockDuringConfirmationError'; this.message = 'Taquito missed a block while waiting for operation confirmation and was not able to find the operation'; } return MissedBlockDuringConfirmationError; }()); var MAX_BRANCH_ANCESTORS = 60; /** * @description WalletOperation allows to monitor operation inclusion on chains and surface information related to the operation */ var WalletOperation = /** @class */ (function () { /** * * @param opHash Operation hash * @param raw Raw operation that was injected * @param context Taquito context allowing access to rpc and signer */ function WalletOperation(opHash, context, _newHead$) { var _this = this; this.opHash = opHash; this.context = context; this._newHead$ = _newHead$; this._operationResult = new ReplaySubject(1); this._includedInBlock = new ReplaySubject(1); this._included = false; this.newHead$ = this._newHead$.pipe(tap(function (newHead) { if (!_this._included && _this.lastHead && newHead.header.level - _this.lastHead.header.level > 1) { throw new MissedBlockDuringConfirmationError(); } _this.lastHead = newHead; }), shareReplay({ bufferSize: 1, refCount: true })); // Observable that emit once operation is seen in a block this.confirmed$ = this.newHead$.pipe(map(function (head) { var e_1, _a, e_2, _b; try { for (var _c = __values(head.operations), _d = _c.next(); !_d.done; _d = _c.next()) { var opGroup = _d.value; try { for (var opGroup_1 = (e_2 = void 0, __values(opGroup)), opGroup_1_1 = opGroup_1.next(); !opGroup_1_1.done; opGroup_1_1 = opGroup_1.next()) { var op = opGroup_1_1.value; if (op.hash === _this.opHash) { _this._included = true; _this._includedInBlock.next(head); _this._operationResult.next(op.contents); // Return the block where the operation was found return head; } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (opGroup_1_1 && !opGroup_1_1.done && (_b = opGroup_1.return)) _b.call(opGroup_1); } finally { if (e_2) throw e_2.error; } } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_d && !_d.done && (_a = _c.return)) _a.call(_c); } finally { if (e_1) throw e_1.error; } } }), filter(function (x) { return typeof x !== 'undefined'; }), first(), shareReplay({ bufferSize: 1, refCount: true })); this.confirmed$.pipe(first()).subscribe(); } WalletOperation.prototype.operationResults = function () { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, this._operationResult.pipe(first()).toPromise()]; }); }); }; /** * @description Receipt expose the total amount of tezos token burn and spent on fees * The promise returned by receipt will resolve only once the transaction is included */ WalletOperation.prototype.receipt = function () { return __awaiter(this, void 0, void 0, function () { var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: _a = receiptFromOperation; return [4 /*yield*/, this.operationResults()]; case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent()])]; } }); }); }; WalletOperation.prototype.getCurrentConfirmation = function () { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { if (!this._included) { return [2 /*return*/, 0]; } return [2 /*return*/, combineLatest([this._includedInBlock, from(this.context.rpc.getBlock())]) .pipe(map(function (_a) { var _b = __read(_a, 2), foundAtBlock = _b[0], head = _b[1]; return head.header.level - foundAtBlock.header.level + 1; }), first()) .toPromise()]; }); }); }; WalletOperation.prototype.isInCurrentBranch = function (tipBlockIdentifier) { if (tipBlockIdentifier === void 0) { tipBlockIdentifier = 'head'; } return __awaiter(this, void 0, void 0, function () { var tipBlockHeader, inclusionBlock, levelDiff, tipBlockLevel, blocks, _a; return __generator(this, function (_b) { switch (_b.label) { case 0: // By default it is assumed that the operation is in the current branch if (!this._included) { return [2 /*return*/, true]; } return [4 /*yield*/, this.context.rpc.getBlockHeader({ block: tipBlockIdentifier })]; case 1: tipBlockHeader = _b.sent(); return [4 /*yield*/, this._includedInBlock.pipe(first()).toPromise()]; case 2: inclusionBlock = _b.sent(); levelDiff = tipBlockHeader.level - inclusionBlock.header.level; // Block produced before the operation is included are assumed to be part of the current branch if (levelDiff <= 0) { return [2 /*return*/, true]; } tipBlockLevel = Math.min(inclusionBlock.header.level + levelDiff, inclusionBlock.header.level + MAX_BRANCH_ANCESTORS); _a = Set.bind; return [4 /*yield*/, this.context.rpc.getLiveBlocks({ block: String(tipBlockLevel) })]; case 3: blocks = new (_a.apply(Set, [void 0, _b.sent()]))(); return [2 /*return*/, blocks.has(inclusionBlock.hash)]; } }); }); }; WalletOperation.prototype.confirmationObservable = function (confirmations) { var _this = this; if (typeof confirmations !== 'undefined' && confirmations < 1) { throw new Error('Confirmation count must be at least 1'); } var defaultConfirmationCount = this.context.config.defaultConfirmationCount; var conf = confirmations !== undefined ? confirmations : defaultConfirmationCount; if (conf === undefined) { throw new Error('Default confirmation count can not be undefined!'); } return combineLatest([this._includedInBlock, this.newHead$]).pipe(distinctUntilChanged(function (_a, _b) { var _c = __read(_a, 2), previousHead = _c[1]; var _d = __read(_b, 2), newHead = _d[1]; return previousHead.hash === newHead.hash; }), map(function (_a) { var _b = __read(_a, 2), foundAtBlock = _b[0], head = _b[1]; return { block: head, expectedConfirmation: conf, currentConfirmation: head.header.level - foundAtBlock.header.level + 1, completed: head.header.level - foundAtBlock.header.level >= conf - 1, isInCurrentBranch: function () { return _this.isInCurrentBranch(head.hash); }, }; }), takeWhile(function (_a) { var completed = _a.completed; return !completed; }, true)); }; /** * * @param confirmations [0] Number of confirmation to wait for */ WalletOperation.prototype.confirmation = function (confirmations) { return this.confirmationObservable(confirmations).toPromise(); }; return WalletOperation; }()); var DelegationWalletOperation = /** @class */ (function (_super) { __extends(DelegationWalletOperation, _super); function DelegationWalletOperation(opHash, context, newHead$) { var _this = _super.call(this, opHash, context, newHead$) || this; _this.opHash = opHash; _this.context = context; return _this; } DelegationWalletOperation.prototype.revealOperation = function () { return __awaiter(this, void 0, void 0, function () { var operationResult; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.operationResults()]; case 1: operationResult = _a.sent(); return [2 /*return*/, operationResult.find(function (x) { return x.kind === OpKind.REVEAL; })]; } }); }); }; DelegationWalletOperation.prototype.delegationOperation = function () { return __awaiter(this, void 0, void 0, function () { var operationResult; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.operationResults()]; case 1: operationResult = _a.sent(); return [2 /*return*/, operationResult.find(function (x) { return x.kind === OpKind.DELEGATION; })]; } }); }); }; DelegationWalletOperation.prototype.status = function () { return __awaiter(this, void 0, void 0, function () { var op; return __generator(this, function (_a) { switch (_a.label) { case 0: if (!this._included) { return [2 /*return*/, 'pending']; } return [4 /*yield*/, this.delegationOperation()]; case 1: op = _a.sent(); if (!op) { return [2 /*return*/, 'unknown']; } return [2 /*return*/, op.metadata.operation_result.status]; } }); }); }; return DelegationWalletOperation; }(WalletOperation)); var OriginationWalletOperation = /** @class */ (function (_super) { __extends(OriginationWalletOperation, _super); function OriginationWalletOperation(opHash, context, newHead$) { var _this = _super.call(this, opHash, context, newHead$) || this; _this.opHash = opHash; _this.context = context; return _this; } OriginationWalletOperation.prototype.originationOperation = function () { return __awaiter(this, void 0, void 0, function () { var operationResult; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.operationResults()]; case 1: operationResult = _a.sent(); return [2 /*return*/, findWithKind(operationResult, OpKind.ORIGINATION)]; } }); }); }; OriginationWalletOperation.prototype.revealOperation = function () { return __awaiter(this, void 0, void 0, function () { var operationResult; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.operationResults()]; case 1: operationResult = _a.sent(); return [2 /*return*/, findWithKind(operationResult, OpKind.REVEAL)]; } }); }); }; OriginationWalletOperation.prototype.status = function () { return __awaiter(this, void 0, void 0, function () { var op; return __generator(this, function (_a) { switch (_a.label) { case 0: if (!this._included) { return [2 /*return*/, 'pending']; } return [4 /*yield*/, this.originationOperation()]; case 1: op = _a.sent(); if (!op) { return [2 /*return*/, 'unknown']; } return [2 /*return*/, op.metadata.operation_result.status]; } }); }); }; OriginationWalletOperation.prototype.contract = function () { return __awaiter(this, void 0, void 0, function () { var op, address; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.originationOperation()]; case 1: op = _a.sent(); address = (op.metadata.operation_result.originated_contracts || [])[0]; return [2 /*return*/, this.context.wallet.at(address)]; } }); }); }; return OriginationWalletOperation; }(WalletOperation)); var TransactionWalletOperation = /** @class */ (function (_super) { __extends(TransactionWalletOperation, _super); function TransactionWalletOperation(opHash, context, newHead$) { var _this = _super.call(this, opHash, context, newHead$) || this; _this.opHash = opHash; _this.context = context; return _this; } TransactionWalletOperation.prototype.revealOperation = function () { return __awaiter(this, void 0, void 0, function () { var operationResult; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.operationResults()]; case 1: operationResult = _a.sent(); return [2 /*return*/, operationResult.find(function (x) { return x.kind === OpKind.REVEAL; })]; } }); }); }; TransactionWalletOperation.prototype.transactionOperation = function () { return __awaiter(this, void 0, void 0, function () { var operationResult; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.operationResults()]; case 1: operationResult = _a.sent(); return [2 /*return*/, operationResult.find(function (x) { return x.kind === OpKind.TRANSACTION; })]; } }); }); }; TransactionWalletOperation.prototype.status = function () { return __awaiter(this, void 0, void 0, function () { var op; return __generator(this, function (_a) { switch (_a.label) { case 0: if (!this._included) { return [2 /*return*/, 'pending']; } return [4 /*yield*/, this.transactionOperation()]; case 1: op = _a.sent(); if (!op) { return [2 /*return*/, 'unknown']; } return [2 /*return*/, op.metadata.operation_result.status]; } }); }); }; return TransactionWalletOperation; }(WalletOperation)); var cacheUntil = function (cacheUntilObs) { return function (source) { var subject = null; return defer(function () { if (!subject) { subject = new ReplaySubject(); source.pipe(first()).subscribe(subject); cacheUntilObs.pipe(first()).subscribe(function () { subject = null; }); } return subject; }); }; }; var createNewPollingBasedHeadObservable = function (pollingTimer, sharedHeadOb, context, scheduler) { if (context.config.confirmationPollingTimeoutSecond === undefined) { throw new Error('Confirmation polling timeout second can not be undefined!'); } return pollingTimer.pipe(switchMap(function () { return sharedHeadOb; }), distinctUntilKeyChanged('hash'), timeoutWith(context.config.confirmationPollingTimeoutSecond * 1000, throwError(new Error('Confirmation polling timed out')), scheduler), shareReplay({ refCount: true, scheduler: scheduler, })); }; var OperationFactory = /** @class */ (function () { function OperationFactory(context) { var _this = this; this.context = context; // Cache the last block for one second across all operations this.sharedHeadObs = defer(function () { return from(_this.context.rpc.getBlock()); }).pipe(cacheUntil(timer(0, 1000))); } OperationFactory.prototype.createNewHeadObservable = function () { return __awaiter(this, void 0, void 0, function () { var confirmationPollingIntervalSecond, _a; return __generator(this, function (_b) { switch (_b.label) { case 0: if (!(this.context.config.confirmationPollingIntervalSecond !== undefined)) return [3 /*break*/, 1]; _a = this.context.config.confirmationPollingIntervalSecond; return [3 /*break*/, 3]; case 1: return [4 /*yield*/, this.context.getConfirmationPollingInterval()]; case 2: _a = _b.sent(); _b.label = 3; case 3: confirmationPollingIntervalSecond = _a; return [2 /*return*/, createNewPollingBasedHeadObservable(timer(0, confirmationPollingIntervalSecond * 1000), this.sharedHeadObs, this.context)]; } }); }); }; OperationFactory.prototype.createPastBlockWalker = function (startBlock, count) { var _this = this; if (count === void 0) { count = 1; } return from(this.context.rpc.getBlock({ block: startBlock })).pipe(switchMap(function (block) { if (count === 1) { return of(block); } return range(block.header.level, count - 1).pipe(startWith(block), concatMap(function (level) { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, this.context.rpc.getBlock({ block: String(level) })]; }); }); })); })); }; OperationFactory.prototype.createHeadObservableFromConfig = function (_a) { var blockIdentifier = _a.blockIdentifier; return __awaiter(this, void 0, void 0, function () { var observableSequence, _b, _c; return __generator(this, function (_d) { switch (_d.label) { case 0: observableSequence = []; if (blockIdentifier) { observableSequence.push(this.createPastBlockWalker(blockIdentifier)); } _c = (_b = observableSequence).push; return [4 /*yield*/, this.createNewHeadObservable()]; case 1: _c.apply(_b, [_d.sent()]); return [2 /*return*/, concat.apply(void 0, __spreadArray([], __read(observableSequence)))]; } }); }); }; OperationFactory.prototype.createOperation = function (hash, config) { if (config === void 0) { config = {}; } return __awaiter(this, void 0, void 0, function () { var _a, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _a = WalletOperation.bind; _b = [void 0, hash, this.context.clone()]; return [4 /*yield*/, this.createHeadObservableFromConfig(config)]; case 1: return [2 /*return*/, new (_a.apply(WalletOperation, _b.concat([_c.sent()])))()]; } }); }); }; OperationFactory.prototype.createTransactionOperation = function (hash, config) { if (config === void 0) { config = {}; } return __awaiter(this, void 0, void 0, function () { var _a, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _a = TransactionWalletOperation.bind; _b = [void 0, hash, this.context.clone()]; return [4 /*yield*/, this.createHeadObservableFromConfig(config)]; case 1: return [2 /*return*/, new (_a.apply(TransactionWalletOperation, _b.concat([_c.sent()])))()]; } }); }); }; OperationFactory.prototype.createDelegationOperation = function (hash, config) { if (config === void 0) { config = {}; } return __awaiter(this, void 0, void 0, function () { var _a, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _a = DelegationWalletOperation.bind; _b = [void 0, hash, this.context.clone()]; return [4 /*yield*/, this.createHeadObservableFromConfig(config)]; case 1: return [2 /*return*/, new (_a.apply(DelegationWalletOperation, _b.concat([_c.sent()])))()]; } }); }); }; OperationFactory.prototype.createOriginationOperation = function (hash, config) { if (config === void 0) { config = {}; } return __awaiter(this, void 0, void 0, function () { var _a, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _a = OriginationWalletOperation.bind; _b = [void 0, hash, this.context.clone()]; return [4 /*yield*/, this.createHeadObservableFromConfig(config)]; case 1: return [2 /*return*/, new (_a.apply(OriginationWalletOperation, _b.concat([_c.sent()])))()]; } }); }); }; return OperationFactory; }()); var DEFAULT_GAS_LIMIT; (function (DEFAULT_GAS_LIMIT) { DEFAULT_GAS_LIMIT[DEFAULT_GAS_LIMIT["DELEGATION"] = 10600] = "DELEGATION"; DEFAULT_GAS_LIMIT[DEFAULT_GAS_LIMIT["ORIGINATION"] = 10600] = "ORIGINATION"; DEFAULT_GAS_LIMIT[DEFAULT_GAS_LIMIT["TRANSFER"] = 10600] = "TRANSFER"; DEFAULT_GAS_LIMIT[DEFAULT_GAS_LIMIT["REVEAL"] = 10600] = "REVEAL"; })(DEFAULT_GAS_LIMIT || (DEFAULT_GAS_LIMIT = {})); var DEFAULT_FEE; (function (DEFAULT_FEE) { DEFAULT_FEE[DEFAULT_FEE["DELEGATION"] = 1257] = "DELEGATION"; DEFAULT_FEE[DEFAULT_FEE["ORIGINATION"] = 10000] = "ORIGINATION"; DEFAULT_FEE[DEFAULT_FEE["TRANSFER"] = 10000] = "TRANSFER"; DEFAULT_FEE[DEFAULT_FEE["REVEAL"] = 1420] = "REVEAL"; })(DEFAULT_FEE || (DEFAULT_FEE = {})); var DEFAULT_STORAGE_LIMIT; (function (DEFAULT_STORAGE_LIMIT) { DEFAULT_STORAGE_LIMIT[DEFAULT_STORAGE_LIMIT["DELEGATION"] = 0] = "DELEGATION"; DEFAULT_STORAGE_LIMIT[DEFAULT_STORAGE_LIMIT["ORIGINATION"] = 257] = "ORIGINATION"; DEFAULT_STORAGE_LIMIT[DEFAULT_STORAGE_LIMIT["TRANSFER"] = 257] = "TRANSFER"; DEFAULT_STORAGE_LIMIT[DEFAULT_STORAGE_LIMIT["REVEAL"] = 0] = "REVEAL"; })(DEFAULT_STORAGE_LIMIT || (DEFAULT_STORAGE_LIMIT = {})); var Protocols; (function (Protocols) { Protocols["Pt24m4xi"] = "Pt24m4xiPbLDhVgVfABUjirbmda3yohdN82Sp9FeuAXJ4eV9otd"; Protocols["PsBABY5H"] = "PsBABY5HQTSkA4297zNHfsZNKtxULfL18y95qb3m53QJiXGmrbU"; Protocols["PsBabyM1"] = "PsBabyM1eUXZseaJdmXFApDSBqj8YBfwELoxZHHW77EMcAbbwAS"; Protocols["PsCARTHA"] = "PsCARTHAGazKbHtnKfLzQg3kms52kSRpgnDY982a9oYsSXRLQEb"; Protocols["PsDELPH1"] = "PsDELPH1Kxsxt8f9eWbxQeRxkjfbxoqM52jvs5Y5fBxWWh4ifpo"; Protocols["PtEdo2Zk"] = "PtEdo2ZkT9oKpimTah6x2embF25oss54njMuPzkJTEi5RqfdZFA"; Protocols["PsFLorena"] = "PsFLorenaUUuikDWvMDr6fGBRG8kt3e3D3fHoXK1j1BFRxeSH4i"; Protocols["PtGRANADs"] = "PtGRANADsDU8R9daYKAgWnQYAJ64omN1o3KMGVCykShA97vQbvV"; })(Protocols || (Protocols = {})); var protocols = { '004': [Protocols.Pt24m4xi], '005': [Protocols.PsBABY5H, Protocols.PsBabyM1], '006': [Protocols.PsCARTHA], '007': [Protocols.PsDELPH1], '008': [Protocols.PtEdo2Zk], '009': [Protocols.PsFLorena], '010': [Protocols.PtGRANADs] }; var DefaultLambdaAddresses; (function (DefaultLambdaAddresses) { DefaultLambdaAddresses["MAINNET"] = "KT1CPuTzwC7h7uLXd5WQmpMFso1HxrLBUtpE"; DefaultLambdaAddresses["CARTHAGENET"] = "KT1VAy1o1FGiXYfD3YT7x7k5eF5HSHhmc1u6"; DefaultLambdaAddresses["DELPHINET"] = "KT19abMFs3haqyKYwqdLjK9GbtofryZLvpiK"; DefaultLambdaAddresses["EDONET"] = "KT1A64nVZDccAHGAsf1ZyVajXZcbiwjV3SnN"; DefaultLambdaAddresses["FLORENCENET"] = "KT1KCe3YqGnudsiCWb5twbe2DH5T3EMdLpSE"; DefaultLambdaAddresses["GRANADANET"] = "KT1BCun2vsA4GBQvsKAuGD5x873MfW2jsN9z"; })(DefaultLambdaAddresses || (DefaultLambdaAddresses = {})); var ChainIds; (function (ChainIds) { ChainIds["MAINNET"] = "NetXdQprcVkpaWU"; ChainIds["CARTHAGENET"] = "NetXjD3HPJJjmcd"; ChainIds["DELPHINET"] = "NetXm8tYqnMWky1"; ChainIds["EDONET"] = "NetXSgo1ZT2DRUG"; ChainIds["FLORENCENET"] = "NetXxkAx4woPLyu"; ChainIds["GRANADANET"] = "NetXz969SFaFn8k"; })(ChainIds || (ChainIds = {})); // RPC requires a signature but does not verify it var SIGNATURE_STUB = 'edsigtkpiSSschcaCt9pUVrpNPf7TTcgvgDEDD6NCEHMy8NNQJCGnMfLZzYoQj74yLjo9wx6MPVV29CvVzgi7qEcEUok3k7AuMg'; var OperationEmitter = /** @class */ (function () { function OperationEmitter(context) { var _this = this; this.context = context; this.constructOps = function (cOps, publicKeyHash, headCounter, counterFunction, source) { var counters = {}; // tslint:disable strict-type-predicates return cOps.map(function (op) { switch (op.kind) { case OpKind.ACTIVATION: return __assign({}, op); case OpKind.REVEAL: return __assign(__assign(__assign(__assign({}, op), _this.getSource(op, publicKeyHash, source)), counterFunction(publicKeyHash, headCounter, counters)), _this.getFee(op)); case OpKind.ORIGINATION: return __assign(__assign(__assign(__assign(__assign({}, op), { balance: typeof op.balance !== 'undefined' ? "" + op.balance : '0' }), _this.getSource(op, publicKeyHash, source)), counterFunction(publicKeyHash, headCounter, counters)), _this.getFee(op)); case OpKind.TRANSACTION: var cops = __assign(__assign(__assign(__assign(__assign({}, op), { amount: typeof op.amount !== 'undefined' ? "" + op.amount : '0' }), _this.getSource(op, publicKeyHash, source)), counterFunction(publicKeyHash, headCounter, counters)), _this.getFee(op)); if (cops.source.toLowerCase().startsWith('kt1')) { throw new Error("KT1 addresses are not supported as source since " + Protocols.PsBabyM1); } return cops; case OpKind.DELEGATION: return __assign(__assign(__assign(__assign({}, op), _this.getSource(op, publicKeyHash, source)), counterFunction(publicKeyHash, headCounter, counters)), _this.getFee(op)); default: throw new Error('Unsupported operation'); } }); }; this.getFee = function (op) { return { // tslint:disable-next-line: strict-type-predicates fee: typeof op.fee === 'undefined' ? '0' : "" + op.fee, // tslint:disable-next-line: strict-type-predicates gas_limit: typeof op.gas_limit === 'undefined' ? '0' : "" + op.gas_limit, // tslint:disable-next-line: strict-type-predicates storage_limit: typeof op.storage_limit === 'undefined' ? '0' : "" + op.storage_limit, }; }; this.getSource = function (op, publicKeyHash, source) { return { source: typeof op.source === 'undefined' ? source || publicKeyHash : op.source, }; }; this.getContextCounter = function (publicKeyHash, headCounter) { if (!_this.context.counters[publicKeyHash] || _this.context.counters[publicKeyHash] < headCounter) { _this.context.counters[publicKeyHash] = headCounter; } var opCounter = ++_this.context.counters[publicKeyHash]; return { counter: "" + opCounter, }; }; this.getScopeCounter = function (publicKeyHash, headCounter, countersScope) { if (!countersScope[publicKeyHash] || countersScope[publicKeyHash] < headCounter) { countersScope[publicKeyHash] = headCounter; } return { counter: "" + ++countersScope[publicKeyHash], }; }; } Object.defineProperty(OperationEmitter.prototype, "rpc", { get: function () { return this.context.rpc; }, enumerable: false, configurable: true }); Object.defineProperty(OperationEmitter.prototype, "signer", { get: function () { return this.context.signer; }, enumerable: false, configurable: true }); OperationEmitter.prototype.isRevealOpNeeded = function (op, pkh) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.isAccountRevealRequired(pkh)]; case 1: return [2 /*return*/, !(_a.sent()) || !this.isRevealRequiredForOpType(op) ? false : true]; } }); }); }; OperationEmitter.prototype.isAccountRevealRequired = function (publicKeyHash) { return __awaiter(this, void 0, void 0, function () { var manager, haveManager; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.rpc.getManagerKey(publicKeyHash)]; case 1: manager = _a.sent(); haveManager = manager && typeof manager === 'object' ? !!manager.key : !!manager; return [2 /*return*/, !haveManager]; } }); }); }; OperationEmitter.prototype.isRevealRequiredForOpType = function (op) { var e_1, _a; var opRequireReveal = false; try { for (var op_1 = __values(op), op_1_1 = op_1.next(); !op_1_1.done; op_1_1 = op_1.next()) { var operation = op_1_1.value; if (isOpRequireReveal(operation)) { opRequireReveal = true; } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (op_1_1 && !op_1_1.done && (_a = op_1.return)) _a.call(op_1); } finally { if (e_1) throw e_1.error; } } return opRequireReveal; }; OperationEmitter.prototype.prepareOpAndSimulation = function (_a) { var operation = _a.operation, source = _a.source; return __awaiter(this, void 0, void 0, function () { var ops, publicKeyHash, _b, counter, hash, protocol, preparedOpSimulation, preparedOp; return __generator(this, function (_c) { switch (_c.label) { case 0: ops = []; if (Array.isArray(operation)) { ops = __spreadArray([], __read(operation)); } else { ops = [operation]; } return [4 /*yield*/, this.signer.publicKeyHash()]; case 1: publicKeyHash = _c.sent(); return [4 /*yield*/, this.getCounterHashAndProtocol(ops, publicKeyHash)]; case 2: _b = _c.sent(), counter = _b.counter, hash = _b.hash, protocol = _b.protocol; if (!this.context.counters[publicKeyHash] || this.context.counters[publicKeyHash] < counter) { this.context.counters[publicKeyHash] = counter; } // This is a work around to the counter_in_the_future error returned by the RPC when calling the run_operation // The preparedOpSimulation will be used to prevalidate the operation instead of the preparedOp // The counter of an operation in preparedOpSimulation will be the head counter + 1 // The counter in preparedOp will be incremented accordingly if sending many operations in a row by keeping it on the context if (counter !== this.context.counters[publicKeyHash]) { preparedOpSimulation = { opOb: { branch: hash, contents: this.constructOps(ops, publicKeyHash, counter, this.getScopeCounter, source), }, counter: counter, }; } preparedOp = { opOb: { branch: hash, contents: this.constructOps(ops, publicKeyHash, counter, this.getContextCounter, source), protocol: protocol, }, counter: counter, }; return [2 /*return*/, { preparedOp: preparedOp, preparedOpSimulation: preparedOpSimulation, }]; } }); }); }; OperationEmitter.prototype.getCounterHashAndProtocol = function (ops, publicKeyHash) { return __awaiter(this, void 0, void 0, function () { var blockHeaderPromise, blockMetaPromise, counterPromise, i, counter_1, _a, header, metadata, headCounter, counter; return __generator(this, function (_b) { switch (_b.label) { case 0: blockHeaderPromise = this.rpc.getBlockHeader(); blockMetaPromise = this.rpc.getBlockMetadata(); counterPromise = Promise.resolve(undefined); i = 0; _b.label = 1; case 1: if (!(i < ops.length)) return [3 /*break*/, 4]; if (!(isOpRequireReveal(ops[i]) || ops[i].kind === 'reveal')) return [3 /*break*/, 3]; return [4 /*yield*/, this.rpc.getContract(publicKeyHash)]; case 2: counter_1 = (_b.sent()).counter; counterPromise = Promise.resolve(counter_1); return [3 /*break*/, 4]; case 3: i++; return [3 /*break*/, 1]; case 4: return [4 /*yield*/, Promise.all([ blockHeaderPromise, blockMetaPromise, counterPromise, ])]; case 5: _a = __read.apply(void 0, [_b.sent(), 3]), header = _a[0], metadata = _a[1], headCounter = _a[2]; if (!header) { throw new Error('Unable to fetch latest block header'); } if (!metadata) { throw new Error('Unable to fetch latest metadata'); } counter = parseInt(headCounter || '0', 10); return [2 /*return*/, { counter: counter, hash: header.hash, protocol: metadata.next_protocol, }]; } }); }); }; OperationEmitter.prototype.prepareOperationEstimation = function (_a) { var operation = _a.operation, source = _a.source; return __awaiter(this, void 0, void 0, function () { var countersScope, ops, publicKeyHash, _b, _c, counter, hash; return __generator(this, function (_d) { switch (_d.label) { case 0: countersScope = {}; ops = []; if (Array.isArray(operation)) { ops = __spreadArray([], __read(operation)); } else { ops = [operation]; } if (!source) return [3 /*break*/, 1]; _b = source; return [3 /*break*/, 3]; case 1: return [4 /*yield*/, this.signer.publicKeyHash()]; case 2: _b = _d.sent(); _d.label = 3; case 3: publicKeyHash = _b; return [4 /*yield*/, this.getCounterHashAndProtocol(ops, publicKeyHash)]; case 4: _c = _d.sent(), counter = _c.counter, hash = _c.hash; if (!countersScope[publicKeyHash] || countersScope[publicKeyHash] < counter) { countersScope[publicKeyHash] = counter; } return [2 /*return*/, { opOb: { branch: hash, contents: this.constructOps(ops, publicKeyHash, counter, this.getScopeCounter, source), }, counter: counter, }]; } }); }); }; OperationEmitter.prototype.preValidate = function (prepared, forgedOperation) { return __awaiter(this, void 0, void 0, function () { var _a, _b; var _c; return __generator(this, function (_d) { switch (_d.label) { case 0: if (!prepared.preparedOpSimulation) return [3 /*break*/, 2]; // we call runOperation instead of preapply // to avoid having to produce 2 signatures (op with incremented counter and op used for simulation) _b = this.runOperation; _c = { operation: __assign({ signature: SIGNATURE_STUB }, prepared.preparedOpSimulation.opOb) }; return [4 /*yield*/, this.rpc.getChainId()]; case 1: // we call runOperation instead of preapply // to avoid having to produce 2 signatures (op with incremented counter and op used for simulation) _a = _b.apply(// If we want to inject many operations in a same block this, [(_c.chain_id = _d.sent(), _c)]); return [3 /*break*/, 3]; case 2: _a = this.preapplyOperation(forgedOperation.opOb); _d.label = 3; case 3: return [2 /*return*/, _a]; } }); }); }; OperationEmitter.prototype.forgeOperation = function (_a) { var _b = _a.opOb, branch = _b.branch, contents = _b.contents; return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_c) { return [2 /*return*/, this.context.forger.forge({ branch: branch, contents: contents })]; }); }); }; OperationEmitter.prototype.forge = function (_a) { var _b = _a.opOb, branch = _b.branch, contents = _b.contents, protocol = _b.protocol, counter = _a.counter; return __awaiter(this, void 0, void 0, function () { var forgedBytes; return __generator(this, function (_c) { switch (_c.label) { case 0: return [4 /*yield*/, this.context.forger.forge({ branch: branch, contents: contents })]; case 1: forgedBytes = _c.sent(); return [2 /*return*/, { opbytes: forgedBytes, opOb: { branch: branch, contents: contents, protocol: protocol, }, counter: counter, }]; } }); }); }; OperationEmitter.prototype.simulate = function (op) { return __awaiter(this, void 0, void 0, function () { var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: _a = {}; return [4 /*yield*/, this.rpc.runOperation(op)]; case 1: return [2 /*return*/, (_a.opResponse = _b.sent(), _a.op = op, _a.context = this.context.clone(), _a)]; } }); }); }; OperationEmitter.prototype.estimate = function (_a, estimator) { var fee = _a.fee, gasLimit = _a.gasLimit, storageLimit = _a.storageLimit, rest = __rest(_a, ["fee", "gasLimit", "storageLimit"]); return __awaiter(this, void 0, void 0, function () { var calculatedFee, calculatedGas, calculatedStorage, estimation; return __generator(this, function (_b) { switch (_b.label) { case 0: calculatedFee = fee; calculatedGas = gasLimit; calculatedStorage = storageLimit; if (!(fee === undefined || gasLimit === undefined || storageLimit === undefined)) return [3 /*break*/, 2]; return [4 /*yield*/, estimator(__assign({ fee: fee, gasLimit: gasLimit, storageLimit: storageLimit }, rest))]; case 1: estimation = _b.sent(); if (calculatedFee === undefined) { calculatedFee = estimation.suggestedFeeMutez; } if (calculatedGas === undefined) { calculatedGas = estimation.gasLimit; } if (calculatedStorage === undefined) { calculatedStorage = estimation.storageLimit; } _b.label = 2; case 2: return [2 /*return*/, { fee: calculatedFee, gasLimit: calculatedGas, storageLimit: calculatedStorage, }]; } }); }); }; OperationEmitter.prototype.signOperation = function (forgedBytes) { return __awaiter(this, void 0, void 0, function () { var signed; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.signer.sign(forgedBytes.opbytes, new Uint8Array([3]))]; case 1: signed = _a.sent(); forgedBytes.opbytes = signed.sbytes; forgedBytes.opOb.signature = signed.prefixSig; return [2 /*return*/, forgedBytes]; } }); }); }; OperationEmitter.prototype.runOperation = function (op) { return __awaiter(this, void 0, void 0, function () { var opResponse, results, j, errors; return __generator(this, function (_a) { switch (_a.label) { case 0: opResponse = []; return [4 /*yield*/, this.rpc.runOperation(op)]; case 1: results = _a.sent(); for (j = 0; j < results.contents.length; j++) { opResponse.push(results.contents[j]); } errors = flattenErrors(results); if (errors.length) { // @ts-ignore throw new TezosOperationError(errors); } return [2 /*return*/, opResponse]; } }); }); }; OperationEmitter.prototype.preapplyOperation = function (opOb) { return __awaiter(this, void 0, void 0, function () { var opResponse, results, i, j, errors; return __generator(this, function (_a) { switch (_a.label) { case 0: opResponse = []; return [4 /*yield*/, this.rpc.preapplyOperations([opOb])]; case 1: results = _a.sent(); if (!Array.isArray(results)) { throw new TezosPreapplyFailureError(results); } for (i = 0; i < results.length; i++) { for (j = 0; j < results[i].contents.length; j++) { opResponse.push(results[i].contents[j]); } } errors = flattenErrors(results); if (errors.length) { // @ts-ignore throw new TezosOperationError(errors); } return [2 /*return*/, opResponse]; } }); }); }; OperationEmitter.prototype.injectOperation = function (signedOperationBytes) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, this.context.injector.inject(signedOperationBytes)]; }); }); }; return OperationEmitter; }()); /** * @description Utility class to interact with Tezos operations */ var Operation = /** @class */ (function () { /** * * @param hash Operation hash * @param raw Raw operation that was injected * @param context Taquito context allowing access to rpc and signer */ function Operation(hash, raw, results, context) { var _this = this; this.hash = hash; this.raw = raw; this.results = results; this.context = context; this._pollingConfig$ = new ReplaySubject(1); this._currentHeadPromise = undefined; // Caching the current head for one second this.currentHead$ = defer(function () { if (!_this._currentHeadPromise) { _this._currentHeadPromise = _this.context.rpc.getBlock(); timer(1000) .pipe(first()) .subscribe(function () { _this._currentHeadPromise = undefined; }); } return from(_this._currentHeadPromise); }); // Polling observable that emit until timeout is reached this.polling$ = defer(function () { return _this._pollingConfig$.pipe(tap(function (_a) { var timeout = _a.timeout, interval = _a.interval; if (timeout <= 0) { throw new Error('Timeout must be more than 0'); } if (interval <= 0) { throw new Error('Interval must be more than 0'); } }), map(function (config) { return (__assign(__assign({}, config), { timeoutAt: Math.ceil(config.timeout / config.interval) + 1, count: 0 })); }), switchMap(function (config) { return timer(0, config.interval * 1000).pipe(mapTo(config)); }), tap(function (config) { config.count++; if (config.count > config.timeoutAt) { throw new Error("Confirmation polling timed out"); } })); }); // Observable that emit once operation is seen in a block this.confirmed$ = this.polling$.pipe(switchMapTo(this.currentHead$), map(function (head) { for (var i = 3; i >= 0; i--) { head.operations[i].forEach(function (op) { if (op.hash === _this.hash) { _this._foundAt = head.header.level; } }); } if (head.header.level - _this._foundAt >= 0) { return _this._foundAt; } }), filter(function (x) { return x !== undefined; }), first(), shareReplay()); this._foundAt = Number.POSITIVE_INFINITY; this.confirmed$.pipe(first()).subscribe(); } Object.defineProperty(Operation.prototype, "includedInBlock", { get: function () { return this._foundAt; }, enumerable: false, configurable: true }); Object.defineProperty(Operation.prototype, "revealOperation", { get: function () { return (Array.isArray(this.results) && this.results.find(function (op) { return op.kind === 'reveal'; })); }, enumerable: false, configurable: true }); Object.defineProperty(Operation.prototype, "revealStatus", { get: function () { if (this.revealOperation) { return this.revealOperation.metadata.operation_result.status; } else { return 'unknown'; } }, enumerable: false, configurable: true }); Object.defineProperty(Operation.prototype, "status", { get: function () { return (this.results.map(function (result) { if (hasMetadataWithResult(result)) { return result.metadata.operation_result.status; } else { return 'unknown'; } })[0] || 'unknown'); }, enumerable: false, configurable: true }); /** * * @param confirmations [0] Number of confirmation to wait for * @param interval [10] Polling interval * @param timeout [180] Timeout */ Operation.prototype.confirmation = function (confirmations, interval, timeout) { return __awaiter(this, void 0, void 0, function () { var confirmationPollingIntervalSecond, _a, _b, defaultConfirmationCount, confirmationPollingTimeoutSecond, conf; var _this = this; return __generator(this, function (_c) { switch (_c.label) { case 0: if (typeof confirmations !== 'undefined' && confirmations < 1) { throw new Error('Confirmation count must be at least 1'); } if (!(this.context.config.confirmationPollingIntervalSecond !== undefined)) return [3 /*break*/, 1]; _a = this.context.config.confirmationPollingIntervalSecond; return [3 /*break*/, 3]; case 1: return [4 /*yield*/, this.context.getConfirmationPollingInterval()]; case 2: _a = _c.sent(); _c.label = 3; case 3: confirmationPollingIntervalSecond = _a; _b = this.context.config, defaultConfirmationCount = _b.defaultConfirmationCount, confirmationPollingTimeoutSecond = _b.confirmationPollingTimeoutSecond; this._pollingConfig$.next({ interval: interval || confirmationPollingIntervalSecond, timeout: timeout || confirmationPollingTimeoutSecond, }); conf = confirmations !== undefined ? confirmations : defaultConfirmationCount; if (conf === undefined) { throw new Error('Default confirmation count can not be undefined!'); } return [2 /*return*/, new Promise(function (resolve, reject) { _this.confirmed$ .pipe(switchMap(function () { return _this.polling$; }), switchMap(function () { return _this.currentHead$; }), filter(function (head) { return head.header.level - _this._foundAt >= conf - 1; }), first()) .subscribe(function (_) { resolve(_this._foundAt + (conf - 1)); }, reject); })]; } }); }); }; return Operation; }()); var RpcTzProvider = /** @class */ (function (_super) { __extends(RpcTzProvider, _super); function RpcTzProvider(context) { return _super.call(this, context) || this; } RpcTzProvider.prototype.getBalance = function (address) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, this.rpc.getBalance(address)]; }); }); }; RpcTzProvider.prototype.getDelegate = function (address) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, this.rpc.getDelegate(address)]; }); }); }; RpcTzProvider.prototype.activate = function (pkh, secret) { return __awaiter(this, void 0, void 0, function () { var operation, prepared, forgedBytes, bytes, _a; return __generator(this, function (_b) { switch (_b.label) { case 0: operation = { kind: OpKind.ACTIVATION, pkh: pkh, secret: secret, }; return [4 /*yield*/, this.prepareOpAndSimulation({ operation: [operation], source: pkh })]; case 1: prepared = _b.sent(); return [4 /*yield*/, this.forge(prepared.preparedOp)]; case 2: forgedBytes = _b.sent(); bytes = forgedBytes.opbytes + "00000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000000"; _a = Operation.bind; return [4 /*yield*/, this.rpc.injectOperation(bytes)]; case 3: return [2 /*return*/, new (_a.apply(Operation, [void 0, _b.sent(), __assign(__assign({}, forgedBytes), { opbytes: bytes }), [], this.context.clone()]))()]; } }); }); }; return RpcTzProvider; }(OperationEmitter)); var MINIMAL_FEE_MUTEZ = 100; var MINIMAL_FEE_PER_BYTE_MUTEZ = 1; var MINIMAL_FEE_PER_GAS_MUTEZ = 0.1; var GAS_BUFFER = 100; /** * Examples of use : * * Estimate a transfer operation : * ``` * // Assuming that provider and signer are already configured... * * const amount = 2; * const address = 'tz1h3rQ8wBxFd8L9B3d7Jhaawu6Z568XU3xY'; * * // Estimate gasLimit, storageLimit and fees for a transfer operation * const est = await Tezos.estimate.transfer({ to: address, amount: amount }) * console.log(est.burnFeeMutez, est.gasLimit, est.minimalFeeMutez, est.storageLimit, * est.suggestedFeeMutez, est.totalCost, est.usingBaseFeeMutez) * * ``` * * Estimate a contract origination : * ``` * // generic.json is referring to a Michelson Smart Contract * * const genericMultisigJSON = require('./generic.json') * const est = await Tezos.estimate.originate({ * code: genericMultisigJSON, * storage: { * stored_counter: 0, * threshold: 1, * keys: ['edpkuLxx9PQD8fZ45eUzrK3BhfDZJHhBuK4Zi49DcEGANwd2rpX82t'] * } * }) * console.log(est.burnFeeMutez, est.gasLimit, est.minimalFeeMutez, est.storageLimit, * est.suggestedFeeMutez, est.totalCost, est.usingBaseFeeMutez) * * ``` */ var Estimate = /** @class */ (function () { function Estimate(_milligasLimit, _storageLimit, opSize, minimalFeePerStorageByteMutez, /** * @description Base fee in mutez (1 mutez = 1e10−6 tez) */ baseFeeMutez) { if (baseFeeMutez === void 0) { baseFeeMutez = MINIMAL_FEE_MUTEZ; } this._milligasLimit = _milligasLimit; this._storageLimit = _storageLimit; this.opSize = opSize; this.minimalFeePerStorageByteMutez = minimalFeePerStorageByteMutez; this.baseFeeMutez = baseFeeMutez; } Object.defineProperty(Estimate.prototype, "burnFeeMutez", { /** * @description The number of Mutez that will be burned for the storage of the [operation](https://tezos.gitlab.io/user/glossary.html#operations). (Storage + Allocation fees) */ get: function () { return this.roundUp(Number(this.storageLimit) * Number(this.minimalFeePerStorageByteMutez)); }, enumerable: false, configurable: true }); Object.defineProperty(Estimate.prototype, "storageLimit", { /** * @description The limit on the amount of storage an [operation](https://tezos.gitlab.io/user/glossary.html#operations) can use. */ get: function () { var limit = Math.max(Number(this._storageLimit), 0); return limit > 0 ? limit : 0; }, enumerable: false, configurable: true }); Object.defineProperty(Estimate.prototype, "gasLimit", { /** * @description The limit on the amount of [gas](https://tezos.gitlab.io/user/glossary.html#gas) a given operation can consume. */ get: function () { return this.roundUp(Number(this._milligasLimit) / 1000 + GAS_BUFFER); }, enumerable: false, configurable: true }); Object.defineProperty(Estimate.prototype, "operationFeeMutez", { get: function () { return ((Number(this._milligasLimit) / 1000 + GAS_BUFFER) * MINIMAL_FEE_PER_GAS_MUTEZ + Number(this.opSize) * MINIMAL_FEE_PER_BYTE_MUTEZ); }, enumerable: false, configurable: true }); Estimate.prototype.roundUp = function (nanotez) { return Math.ceil(Number(nanotez)); }; Object.defineProperty(Estimate.prototype, "minimalFeeMutez", { /** * @description Minimum fees for the [operation](https://tezos.gitlab.io/user/glossary.html#operations) according to [baker](https://tezos.gitlab.io/user/glossary.html#baker) defaults. */ get: function () { return this.roundUp(MINIMAL_FEE_MUTEZ + this.operationFeeMutez); }, enumerable: false, configurable: true }); Object.defineProperty(Estimate.prototype, "suggestedFeeMutez", { /** * @description The suggested fee for the operation which includes minimal fees and a small buffer. */ get: function () { return this.roundUp(this.operationFeeMutez + MINIMAL_FEE_MUTEZ * 2); }, enumerable: false, configurable: true }); Object.defineProperty(Estimate.prototype, "usingBaseFeeMutez", { /** * @description Fees according to your specified base fee will ensure that at least minimum fees are used. */ get: function () { return (Math.max(Number(this.baseFeeMutez), MINIMAL_FEE_MUTEZ) + this.roundUp(this.operationFeeMutez)); }, enumerable: false, configurable: true }); Object.defineProperty(Estimate.prototype, "totalCost", { /** * @description The sum of `minimalFeeMutez` + `burnFeeMutez`. */ get: function () { return this.minimalFeeMutez + this.burnFeeMutez; }, enumerable: false, configurable: true }); Object.defineProperty(Estimate.prototype, "consumedMilligas", { /** * @description Since Delphinet, consumed gas is provided in milligas for more precision. * This function returns an estimation of the gas that operation will consume in milligas. */ get: function () { return Number(this._milligasLimit); }, enumerable: false, configurable: true }); Estimate.createEstimateInstanceFromProperties = function (estimateProperties) { var milligasLimit = 0; var storageLimit = 0; var opSize = 0; var minimalFeePerStorageByteMutez = 0; var baseFeeMutez; estimateProperties.forEach(function (estimate) { milligasLimit += estimate.milligasLimit; storageLimit += estimate.storageLimit; opSize += estimate.opSize; minimalFeePerStorageByteMutez = Math.max(estimate.minimalFeePerStorageByteMutez, minimalFeePerStorageByteMutez); if (estimate.baseFeeMutez) { baseFeeMutez = baseFeeMutez ? baseFeeMutez + estimate.baseFeeMutez : estimate.baseFeeMutez; } }); return new Estimate(milligasLimit, storageLimit, opSize, minimalFeePerStorageByteMutez, baseFeeMutez); }; Estimate.createArrayEstimateInstancesFromProperties = function (estimateProperties) { return estimateProperties.map(function (x) { return new Estimate(x.milligasLimit, x.storageLimit, x.opSize, x.minimalFeePerStorageByteMutez, x.baseFeeMutez); }); }; return Estimate; }()); var TZ_DECIMALS = 6; var MTZ_DECIMALS = 3; function getDecimal(format) { switch (format) { case 'tz': return TZ_DECIMALS; case 'mtz': return MTZ_DECIMALS; case 'mutez': default: return 0; } } function format(from, to, amount) { if (from === void 0) { from = 'mutez'; } if (to === void 0) { to = 'mutez'; } var bigNum = new BigNumber(amount); if (bigNum.isNaN()) { return amount; } return bigNum .multipliedBy(Math.pow(10, getDecimal(from))) .dividedBy(Math.pow(10, getDecimal(to))); } var InvalidParameterError = /** @class */ (function () { function InvalidParameterError(smartContractMethodName, sigs, args) { this.smartContractMethodName = smartContractMethodName; this.sigs = sigs; this.args = args; this.name = 'Invalid parameters error'; this.message = smartContractMethodName + " Received " + args.length + " arguments while expecting one of the following signatures (" + JSON.stringify(sigs) + ")"; } return InvalidParameterError; }()); var UndefinedLambdaContractError = /** @class */ (function () { function UndefinedLambdaContractError() { this.name = 'Undefined LambdaContract error'; this.message = "This might happen if you are using a sandbox. Please provide the address of a lambda contract as a parameter of the read method."; } return UndefinedLambdaContractError; }()); var InvalidDelegationSource = /** @class */ (function () { function InvalidDelegationSource(source) { this.source = source; this.name = 'Invalid delegation source error'; this.message = "Since Babylon delegation source can no longer be a contract address " + source + ". Please use the smart contract abstraction to set your delegate."; } return InvalidDelegationSource; }()); var InvalidCodeParameter = /** @class */ (function () { function InvalidCodeParameter(message, data) { this.message = message; this.data = data; this.name = 'InvalidCodeParameter'; } return InvalidCodeParameter; }()); var InvalidInitParameter = /** @class */ (function () { function InvalidInitParameter(message, data) { this.message = message; this.data = data; this.name = 'InvalidInitParameter'; } return InvalidInitParameter; }()); var createOriginationOperation = function (_a) { var code = _a.code, init = _a.init, _b = _a.balance, balance = _b === void 0 ? "0" : _b, delegate = _a.delegate, storage = _a.storage, _c = _a.fee, fee = _c === void 0 ? DEFAULT_FEE.ORIGINATION : _c, _d = _a.gasLimit, gasLimit = _d === void 0 ? DEFAULT_GAS_LIMIT.ORIGINATION : _d, _e = _a.storageLimit, storageLimit = _e === void 0 ? DEFAULT_STORAGE_LIMIT.ORIGINATION : _e, _f = _a.mutez, mutez = _f === void 0 ? false : _f; return __awaiter(void 0, void 0, void 0, function () { var contractStorage, storageType, schema, script, operation; return __generator(this, function (_g) { // tslint:disable-next-line: strict-type-predicates if (storage !== undefined && init !== undefined) { throw new Error("Storage and Init cannot be set a the same time. Please either use storage or init but not both."); } if (!Array.isArray(code)) { throw new InvalidCodeParameter('Wrong code parameter type, expected an array', code); } if (storage !== undefined) { storageType = code.find(function (p) { return ('prim' in p) && p.prim === 'storage'; }); if ((storageType === null || storageType === void 0 ? void 0 : storageType.args) === undefined) { throw new InvalidCodeParameter('The storage section is missing from the script', code); } schema = new Schema(storageType.args[0]); contractStorage = schema.Encode(storage); } else if (init !== undefined && typeof init === 'object') { contractStorage = init; } else { throw new InvalidInitParameter('Wrong init parameter type, expected JSON Michelson', init); } script = { code: code, storage: contractStorage, }; operation = { kind: OpKind.ORIGINATION, fee: fee, gas_limit: gasLimit, storage_limit: storageLimit, balance: mutez ? balance.toString() : format('tz', 'mutez', balance).toString(), script: script, }; if (delegate) { operation.delegate = delegate; } return [2 /*return*/, operation]; }); }); }; var createTransferOperation = function (_a) { var to = _a.to, amount = _a.amount, parameter = _a.parameter, _b = _a.fee, fee = _b === void 0 ? DEFAULT_FEE.TRANSFER : _b, _c = _a.gasLimit, gasLimit = _c === void 0 ? DEFAULT_GAS_LIMIT.TRANSFER : _c, _d = _a.storageLimit, storageLimit = _d === void 0 ? DEFAULT_STORAGE_LIMIT.TRANSFER : _d, _e = _a.mutez, mutez = _e === void 0 ? false : _e; return __awaiter(void 0, void 0, void 0, function () { var operation; return __generator(this, function (_f) { operation = { kind: OpKind.TRANSACTION, fee: fee, gas_limit: gasLimit, storage_limit: storageLimit, amount: mutez ? amount.toString() : format("tz", "mutez", amount).toString(), destination: to, parameters: parameter, }; return [2 /*return*/, operation]; }); }); }; var createSetDelegateOperation = function (_a) { var delegate = _a.delegate, source = _a.source, _b = _a.fee, fee = _b === void 0 ? DEFAULT_FEE.DELEGATION : _b, _c = _a.gasLimit, gasLimit = _c === void 0 ? DEFAULT_GAS_LIMIT.DELEGATION : _c, _d = _a.storageLimit, storageLimit = _d === void 0 ? DEFAULT_STORAGE_LIMIT.DELEGATION : _d; return __awaiter(void 0, void 0, void 0, function () { var operation; return __generator(this, function (_e) { operation = { kind: OpKind.DELEGATION, source: source, fee: fee, gas_limit: gasLimit, storage_limit: storageLimit, delegate: delegate, }; return [2 /*return*/, operation]; }); }); }; var createRegisterDelegateOperation = function (_a, source) { var _b = _a.fee, fee = _b === void 0 ? DEFAULT_FEE.DELEGATION : _b, _c = _a.gasLimit, gasLimit = _c === void 0 ? DEFAULT_GAS_LIMIT.DELEGATION : _c, _d = _a.storageLimit, storageLimit = _d === void 0 ? DEFAULT_STORAGE_LIMIT.DELEGATION : _d; return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_e) { return [2 /*return*/, { kind: OpKind.DELEGATION, fee: fee, gas_limit: gasLimit, storage_limit: storageLimit, delegate: source, }]; }); }); }; var createRevealOperation = function (_a, source, publicKey) { var _b = _a.fee, fee = _b === void 0 ? DEFAULT_FEE.REVEAL : _b, _c = _a.gasLimit, gasLimit = _c === void 0 ? DEFAULT_GAS_LIMIT.REVEAL : _c, _d = _a.storageLimit, storageLimit = _d === void 0 ? DEFAULT_STORAGE_LIMIT.REVEAL : _d; return __awaiter(void 0, void 0, void 0, function () { return __generator(this, function (_e) { return [2 /*return*/, { kind: OpKind.REVEAL, fee: fee, public_key: publicKey, source: source, gas_limit: gasLimit, storage_limit: storageLimit }]; }); }); }; var mergeLimits = function (userDefinedLimit, defaultLimits) { return { fee: typeof userDefinedLimit.fee === 'undefined' ? defaultLimits.fee : userDefinedLimit.fee, gasLimit: typeof userDefinedLimit.gasLimit === 'undefined' ? defaultLimits.gasLimit : userDefinedLimit.gasLimit, storageLimit: typeof userDefinedLimit.storageLimit === 'undefined' ? defaultLimits.storageLimit : userDefinedLimit.storageLimit, }; }; var RPCEstimateProvider = /** @class */ (function (_super) { __extends(RPCEstimateProvider, _super); function RPCEstimateProvider() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.ALLOCATION_STORAGE = 257; _this.ORIGINATION_STORAGE = 257; _this.OP_SIZE_REVEAL = 128; return _this; } // Maximum values defined by the protocol RPCEstimateProvider.prototype.getAccountLimits = function (pkh, numberOfOps) { return __awaiter(this, void 0, void 0, function () { var balance, _a, hard_gas_limit_per_operation, hard_gas_limit_per_block, hard_storage_limit_per_operation, cost_per_byte; return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, this.rpc.getBalance(pkh)]; case 1: balance = _b.sent(); return [4 /*yield*/, this.rpc.getConstants()]; case 2: _a = _b.sent(), hard_gas_limit_per_operation = _a.hard_gas_limit_per_operation, hard_gas_limit_per_block = _a.hard_gas_limit_per_block, hard_storage_limit_per_operation = _a.hard_storage_limit_per_operation, cost_per_byte = _a.cost_per_byte; return [2 /*return*/, { fee: 0, gasLimit: numberOfOps ? Math.floor(this.ajustGasForBatchOperation(hard_gas_limit_per_block, hard_gas_limit_per_operation, numberOfOps).toNumber()) : hard_gas_limit_per_operation.toNumber(), storageLimit: Math.floor(BigNumber.min(balance.dividedBy(cost_per_byte), hard_storage_limit_per_operation).toNumber()), }]; } }); }); }; // Fix for Granada where the total gasLimit of a batch can not exceed the hard_gas_limit_per_block. // If the total gasLimit of the batch is higher than the hard_gas_limit_per_block, // the gasLimit is calculated by dividing the hard_gas_limit_per_block by the number of operation in the batch (numberOfOps). // numberOfOps is incremented by 1 for safety in case a reveal operation is needed RPCEstimateProvider.prototype.ajustGasForBatchOperation = function (gasLimitBlock, gaslimitOp, numberOfOps) { return BigNumber.min(gaslimitOp, gasLimitBlock.div(numberOfOps + 1)); }; RPCEstimateProvider.prototype.getEstimationPropertiesFromOperationContent = function (content, size, costPerByte) { var _this = this; var operationResults = flattenOperationResult({ contents: [content] }); var totalGas = 0; var totalMilligas = 0; var totalStorage = 0; operationResults.forEach(function (result) { totalStorage += 'originated_contracts' in result && typeof result.originated_contracts !== 'undefined' ? result.originated_contracts.length * _this.ORIGINATION_STORAGE : 0; totalStorage += 'allocated_destination_contract' in result ? _this.ALLOCATION_STORAGE : 0; totalGas += Number(result.consumed_gas) || 0; totalMilligas += Number(result.consumed_milligas) || 0; totalStorage += 'paid_storage_size_diff' in result ? Number(result.paid_storage_size_diff) || 0 : 0; }); if (totalGas !== 0 && totalMilligas === 0) { // This will convert gas to milligas for Carthagenet where result does not contain consumed gas in milligas. totalMilligas = totalGas * 1000; } if (isOpWithFee(content)) { return { milligasLimit: totalMilligas || 0, storageLimit: Number(totalStorage || 0), opSize: size, minimalFeePerStorageByteMutez: costPerByte.toNumber(), }; } else { return { milligasLimit: 0, storageLimit: 0, opSize: size, minimalFeePerStorageByteMutez: costPerByte.toNumber(), baseFeeMutez: 0, }; } }; RPCEstimateProvider.prototype.prepareEstimate = function (params) { return __awaiter(this, void 0, void 0, function () { var preparedSimulation, opbytes, operation, opResponse, cost_per_byte, errors, numberOfOps; var _a; var _this = this; return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, this.prepareOperationEstimation(params)]; case 1: preparedSimulation = _b.sent(); return [4 /*yield*/, this.forgeOperation(preparedSimulation)]; case 2: opbytes = _b.sent(); _a = { operation: { branch: preparedSimulation.opOb.branch, contents: preparedSimulation.opOb.contents, signature: SIGNATURE_STUB, } }; return [4 /*yield*/, this.rpc.getChainId()]; case 3: operation = (_a.chain_id = _b.sent(), _a); return [4 /*yield*/, this.simulate(operation)]; case 4: opResponse = (_b.sent()).opResponse; return [4 /*yield*/, this.rpc.getConstants()]; case 5: cost_per_byte = (_b.sent()).cost_per_byte; errors = __spreadArray(__spreadArray([], __read(flattenErrors(opResponse, 'backtracked'))), __read(flattenErrors(opResponse))); // Fail early in case of errors if (errors.length) { throw new TezosOperationError(errors); } numberOfOps = 1; if (Array.isArray(params.operation) && params.operation.length > 1) { numberOfOps = opResponse.contents[0].kind === 'reveal' ? params.operation.length - 1 : params.operation.length; } return [2 /*return*/, opResponse.contents.map(function (x) { return _this.getEstimationPropertiesFromOperationContent(x, // TODO: Calculate a specific opSize for each operation. x.kind === 'reveal' ? _this.OP_SIZE_REVEAL / 2 : opbytes.length / 2 / numberOfOps, cost_per_byte); })]; } }); }); }; /** * * @description Estimate gasLimit, storageLimit and fees for an origination operation * * @returns An estimation of gasLimit, storageLimit and fees for the operation * * @param OriginationOperation Originate operation parameter */ RPCEstimateProvider.prototype.originate = function (_a) { var fee = _a.fee, storageLimit = _a.storageLimit, gasLimit = _a.gasLimit, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]); return __awaiter(this, void 0, void 0, function () { var pkh, DEFAULT_PARAMS, op, _b, isRevealNeeded, ops, _c, estimateProperties; return __generator(this, function (_d) { switch (_d.label) { case 0: return [4 /*yield*/, this.signer.publicKeyHash()]; case 1: pkh = _d.sent(); return [4 /*yield*/, this.getAccountLimits(pkh)]; case 2: DEFAULT_PARAMS = _d.sent(); _b = createOriginationOperation; return [4 /*yield*/, this.context.parser.prepareCodeOrigination(__assign(__assign({}, rest), mergeLimits({ fee: fee, storageLimit: storageLimit, gasLimit: gasLimit }, DEFAULT_PARAMS)))]; case 3: return [4 /*yield*/, _b.apply(void 0, [_d.sent()])]; case 4: op = _d.sent(); return [4 /*yield*/, this.isRevealOpNeeded([op], pkh)]; case 5: isRevealNeeded = _d.sent(); if (!isRevealNeeded) return [3 /*break*/, 7]; return [4 /*yield*/, this.addRevealOp([op], pkh)]; case 6: _c = _d.sent(); return [3 /*break*/, 8]; case 7: _c = op; _d.label = 8; case 8: ops = _c; return [4 /*yield*/, this.prepareEstimate({ operation: ops, source: pkh, })]; case 9: estimateProperties = _d.sent(); if (isRevealNeeded) { estimateProperties.shift(); } return [2 /*return*/, Estimate.createEstimateInstanceFromProperties(estimateProperties)]; } }); }); }; /** * * @description Estimate gasLimit, storageLimit and fees for an transfer operation * * @returns An estimation of gasLimit, storageLimit and fees for the operation * * @param TransferOperation Originate operation parameter */ RPCEstimateProvider.prototype.transfer = function (_a) { var fee = _a.fee, storageLimit = _a.storageLimit, gasLimit = _a.gasLimit, rest = __rest(_a, ["fee", "storageLimit", "gasLimit"]); return __awaiter(this, void 0, void 0, function () { var pkh, DEFAULT_PARAMS, op, isRevealNeeded, ops, _b, estimateProperties; return __generator(this, function (_c) { switch (_c.label) { case 0: return [4 /*yield*/, this.signer.publicKeyHash()]; case 1: pkh = _c.sent(); return [4 /*yield*/, this.getAccountLimits(pkh)]; case 2: DEFAULT_PARAMS = _c.sent(); return [4 /*yield*/, createTransferOperation(__assign(__assign({}, rest), mergeLimits({ fee: fee, storageLimit: storageLimit, gasLimit: gasLimit }, DEFAULT_PARAMS)))]; case 3: op = _c.sent(); return [4 /*yield*/, this.isRevealOpNeeded([op], pkh)]; case 4: isRevealNeeded = _c.sent(); if (!isRevealNeeded) return [3 /*break*/, 6]; return [4 /*yield*/, this.addRevealOp([op], pkh)]; case 5: _b = _c.sent(); return [3 /*break*/, 7]; case 6: _b = op; _c.label = 7; case 7: ops = _b; return [4 /*yield*/, this.prepareEstimate({ operation: ops, source: pkh })]; case 8: estimateProperties = _c.sent(); if (isRevealNeeded) { estimateProperties.shift(); } return [2 /*return*/, Estimate.createEstimateInstanceFromProperties(estimateProperties)]; } }); }); }; /** * * @description Estimate gasLimit, storageLimit and fees for a delegate operation * * @returns An estimation of gasLimit, storageLimit and fees for the operation * * @param Estimate */ RPCEstimateProvider.prototype.setDelegate = function (_a) { var fee = _a.fee, gasLimit = _a.gasLimit, storageLimit = _a.storageLimit, rest = __rest(_a, ["fee", "gasLimit", "storageLimit"]); return __awaiter(this, void 0, void 0, function () { var pkh, sourceOrDefault, DEFAULT_PARAMS, op, isRevealNeeded, ops, _b, estimateProperties; return __generator(this, function (_c) { switch (_c.label) { case 0: return [4 /*yield*/, this.signer.publicKeyHash()]; case 1: pkh = _c.sent(); sourceOrDefault = rest.source || pkh; return [4 /*yield*/, this.getAccountLimits(sourceOrDefault)]; case 2: DEFAULT_PARAMS = _c.sent(); return [4 /*yield*/, createSetDelegateOperation(__assign(__assign({}, rest), mergeLimits({ fee: fee, storageLimit: storageLimit, gasLimit: gasLimit }, DEFAULT_PARAMS)))]; case 3: op = _c.sent(); return [4 /*yield*/, this.isRevealOpNeeded([op], pkh)]; case 4: isRevealNeeded = _c.sent(); if (!isRevealNeeded) return [3 /*break*/, 6]; return [4 /*yield*/, this.addRevealOp([op], pkh)]; case 5: _b = _c.sent(); return [3 /*break*/, 7]; case 6: _b = op; _c.label = 7; case 7: ops = _b; return [4 /*yield*/, this.prepareEstimate({ operation: ops, source: pkh })]; case 8: estimateProperties = _c.sent(); if (isRevealNeeded) { estimateProperties.shift(); } return [2 /*return*/, Estimate.createEstimateInstanceFromProperties(estimateProperties)]; } }); }); }; /** * * @description Estimate gasLimit, storageLimit and fees for a each operation in the batch * * @returns An array of Estimate objects. If a reveal operation is needed, the first element of the array is the Estimate for the reveal operation. */ RPCEstimateProvider.prototype.batch = function (params) { return __awaiter(this, void 0, void 0, function () { var pkh, operations, DEFAULT_PARAMS, params_1, params_1_1, param, _a, _b, _c, _d, _e, _f, _g, _h, e_1_1, isRevealNeeded, _j, estimateProperties; var e_1, _k; return __generator(this, function (_l) { switch (_l.label) { case 0: return [4 /*yield*/, this.signer.publicKeyHash()]; case 1: pkh = _l.sent(); operations = []; return [4 /*yield*/, this.getAccountLimits(pkh, params.length)]; case 2: DEFAULT_PARAMS = _l.sent(); _l.label = 3; case 3: _l.trys.push([3, 16, 17, 18]); params_1 = __values(params), params_1_1 = params_1.next(); _l.label = 4; case 4: if (!!params_1_1.done) return [3 /*break*/, 15]; param = params_1_1.value; _a = param.kind; switch (_a) { case OpKind.TRANSACTION: return [3 /*break*/, 5]; case OpKind.ORIGINATION: return [3 /*break*/, 7]; case OpKind.DELEGATION: return [3 /*break*/, 10]; case OpKind.ACTIVATION: return [3 /*break*/, 12]; } return [3 /*break*/, 13]; case 5: _c = (_b = operations).push; return [4 /*yield*/, createTransferOperation(__assign(__assign({}, param), mergeLimits(param, DEFAULT_PARAMS)))]; case 6: _c.apply(_b, [_l.sent()]); return [3 /*break*/, 14]; case 7: _e = (_d = operations).push; _f = createOriginationOperation; return [4 /*yield*/, this.context.parser.prepareCodeOrigination(__assign(__assign({}, param), mergeLimits(param, DEFAULT_PARAMS)))]; case 8: return [4 /*yield*/, _f.apply(void 0, [_l.sent()])]; case 9: _e.apply(_d, [_l.sent()]); return [3 /*break*/, 14]; case 10: _h = (_g = operations).push; return [4 /*yield*/, createSetDelegateOperation(__assign(__assign({}, param), mergeLimits(param, DEFAULT_PARAMS)))]; case 11: _h.apply(_g, [_l.sent()]); return [3 /*break*/, 14]; case 12: operations.push(__assign(__assign({}, param), DEFAULT_PARAMS)); return [3 /*break*/, 14]; case 13: throw new Error("Unsupported operation kind: " + param.kind); case 14: params_1_1 = params_1.next(); return [3 /*break*/, 4]; case 15: return [3 /*break*/, 18]; case 16: e_1_1 = _l.sent(); e_1 = { error: e_1_1 }; return [3 /*break*/, 18]; case 17: try { if (params_1_1 && !params_1_1.done && (_k = params_1.return)) _k.call(params_1); } finally { if (e_1) throw e_1.error; } return [7 /*endfinally*/]; case 18: return [4 /*yield*/, this.isRevealOpNeeded(operations, pkh)]; case 19: isRevealNeeded = _l.sent(); if (!isRevealNeeded) return [3 /*break*/, 21]; return [4 /*yield*/, this.addRevealOp(operations, pkh)]; case 20: _j = _l.sent(); return [3 /*break*/, 22]; case 21: _j = operations; _l.label = 22; case 22: operations = _j; return [4 /*yield*/, this.prepareEstimate({ operation: operations, source: pkh })]; case 23: estimateProperties = _l.sent(); return [2 /*return*/, Estimate.createArrayEstimateInstancesFromProperties(estimateProperties)]; } }); }); }; /** * * @description Estimate gasLimit, storageLimit and fees for a delegate operation * * @returns An estimation of gasLimit, storageLimit and fees for the operation * * @param Estimate */ RPCEstimateProvider.prototype.registerDelegate = function (params) { return __awaiter(this, void 0, void 0, function () { var pkh, DEFAULT_PARAMS, op, isRevealNeeded, ops, _a, estimateProperties; return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, this.signer.publicKeyHash()]; case 1: pkh = _b.sent(); return [4 /*yield*/, this.getAccountLimits(pkh)]; case 2: DEFAULT_PARAMS = _b.sent(); return [4 /*yield*/, createRegisterDelegateOperation(__assign(__assign({}, params), DEFAULT_PARAMS), pkh)]; case 3: op = _b.sent(); return [4 /*yield*/, this.isRevealOpNeeded([op], pkh)]; case 4: isRevealNeeded = _b.sent(); if (!isRevealNeeded) return [3 /*break*/, 6]; return [4 /*yield*/, this.addRevealOp([op], pkh)]; case 5: _a = _b.sent(); return [3 /*break*/, 7]; case 6: _a = op; _b.label = 7; case 7: ops = _a; return [4 /*yield*/, this.prepareEstimate({ operation: ops, source: pkh })]; case 8: estimateProperties = _b.sent(); if (isRevealNeeded) { estimateProperties.shift(); } return [2 /*return*/, Estimate.createEstimateInstanceFromProperties(estimateProperties)]; } }); }); }; /** * * @description Estimate gasLimit, storageLimit and fees to reveal the current account * * @returns An estimation of gasLimit, storageLimit and fees for the operation or undefined if the account is already revealed * * @param Estimate */ RPCEstimateProvider.prototype.reveal = function (params) { return __awaiter(this, void 0, void 0, function () { var pkh, DEFAULT_PARAMS, op, _a, _b, estimateProperties; return __generator(this, function (_c) { switch (_c.label) { case 0: return [4 /*yield*/, this.signer.publicKeyHash()]; case 1: pkh = _c.sent(); return [4 /*yield*/, this.isAccountRevealRequired(pkh)]; case 2: if (!_c.sent()) return [3 /*break*/, 7]; return [4 /*yield*/, this.getAccountLimits(pkh)]; case 3: DEFAULT_PARAMS = _c.sent(); _a = createRevealOperation; _b = [__assign(__assign({}, params), DEFAULT_PARAMS), pkh]; return [4 /*yield*/, this.signer.publicKey()]; case 4: return [4 /*yield*/, _a.apply(void 0, _b.concat([_c.sent()]))]; case 5: op = _c.sent(); return [4 /*yield*/, this.prepareEstimate({ operation: op, source: pkh })]; case 6: estimateProperties = _c.sent(); return [2 /*return*/, Estimate.createEstimateInstanceFromProperties(estimateProperties)]; case 7: return [2 /*return*/]; } }); }); }; RPCEstimateProvider.prototype.addRevealOp = function (op, pkh) { return __awaiter(this, void 0, void 0, function () { var _a, _b, _c, _d; return __generator(this, function (_e) { switch (_e.label) { case 0: _b = (_a = op).unshift; _c = createRevealOperation; _d = [__assign({ fee: DEFAULT_FEE.REVEAL, gasLimit: DEFAULT_GAS_LIMIT.REVEAL, storageLimit: DEFAULT_STORAGE_LIMIT.REVEAL, }), pkh]; return [4 /*yield*/, this.signer.publicKey()]; case 1: return [4 /*yield*/, _c.apply(void 0, _d.concat([_e.sent()]))]; case 2: _b.apply(_a, [_e.sent()]); return [2 /*return*/, op]; } }); }); }; return RPCEstimateProvider; }(OperationEmitter)); var BatchOperation = /** @class */ (function (_super) { __extends(BatchOperation, _super); function BatchOperation(hash, params, source, raw, results, context) { var _this = _super.call(this, hash, raw, results, context) || this; _this.params = params; _this.source = source; return _this; } BatchOperation.prototype.sumProp = function (arr, prop) { return arr.reduce(function (prev, current) { return prop in current ? Number(current[prop]) + prev : prev; }, 0); }; Object.defineProperty(BatchOperation.prototype, "status", { get: function () { return (this.results .filter(function (result) { return BATCH_KINDS.indexOf(result.kind) !== -1; }) .map(function (result) { if (hasMetadataWithResult(result)) { return result.metadata.operation_result.status; } else { return 'unknown'; } })[0] || 'unknown'); }, enumerable: false, configurable: true }); Object.defineProperty(BatchOperation.prototype, "fee", { get: function () { return this.sumProp(this.params, 'fee'); }, enumerable: false, configurable: true }); Object.defineProperty(BatchOperation.prototype, "gasLimit", { get: function () { return this.sumProp(this.params, 'gas_limit'); }, enumerable: false, configurable: true }); Object.defineProperty(BatchOperation.prototype, "storageLimit", { get: function () { return this.sumProp(this.params, 'storage_limit'); }, enumerable: false, configurable: true }); Object.defineProperty(BatchOperation.prototype, "consumedGas", { get: function () { return String(this.sumProp(flattenOperationResult({ contents: this.results }), 'consumed_gas')); }, enumerable: false, configurable: true }); Object.defineProperty(BatchOperation.prototype, "storageDiff", { get: function () { return String(this.sumProp(flattenOperationResult({ contents: this.results }), 'paid_storage_size_diff')); }, enumerable: false, configurable: true }); Object.defineProperty(BatchOperation.prototype, "errors", { get: function () { return flattenErrors({ contents: this.results }); }, enumerable: false, configurable: true }); return BatchOperation; }(Operation)); var BATCH_KINDS = [ OpKind.ACTIVATION, OpKind.ORIGINATION, OpKind.TRANSACTION, OpKind.DELEGATION, ]; var OperationBatch = /** @class */ (function (_super) { __extends(OperationBatch, _super); function OperationBatch(context, estimator) { var _this = _super.call(this, context) || this; _this.estimator = estimator; _this.operations = []; return _this; } /** * * @description Add a transaction operation to the batch * * @param params Transfer operation parameter */ OperationBatch.prototype.withTransfer = function (params) { this.operations.push(__assign({ kind: OpKind.TRANSACTION }, params)); return this; }; /** * * @description Add a transaction operation to the batch * * @param params Transfer operation parameter */ OperationBatch.prototype.withContractCall = function (params) { return this.withTransfer(params.toTransferParams()); }; /** * * @description Add a delegation operation to the batch * * @param params Delegation operation parameter */ OperationBatch.prototype.withDelegation = function (params) { this.operations.push(__assign({ kind: OpKind.DELEGATION }, params)); return this; }; /** * * @description Add an activation operation to the batch * * @param params Activation operation parameter */ OperationBatch.prototype.withActivation = function (_a) { var pkh = _a.pkh, secret = _a.secret; this.operations.push({ kind: OpKind.ACTIVATION, pkh: pkh, secret: secret }); return this; }; /** * * @description Add an origination operation to the batch * * @param params Origination operation parameter */ OperationBatch.prototype.withOrigination = function (params) { this.operations.push(__assign({ kind: OpKind.ORIGINATION }, params)); return this; }; OperationBatch.prototype.getRPCOp = function (param) { return __awaiter(this, void 0, void 0, function () { var _a, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _a = param.kind; switch (_a) { case OpKind.TRANSACTION: return [3 /*break*/, 1]; case OpKind.ORIGINATION: return [3 /*break*/, 2]; case OpKind.DELEGATION: return [3 /*break*/, 4]; case OpKind.ACTIVATION: return [3 /*break*/, 5]; } return [3 /*break*/, 6]; case 1: return [2 /*return*/, createTransferOperation(__assign({}, param))]; case 2: _b = createOriginationOperation; return [4 /*yield*/, this.context.parser.prepareCodeOrigination(__assign({}, param))]; case 3: return [2 /*return*/, _b.apply(void 0, [_c.sent()])]; case 4: return [2 /*return*/, createSetDelegateOperation(__assign({}, param))]; case 5: return [2 /*return*/, __assign({}, param)]; case 6: throw new Error("Unsupported operation kind: " + param.kind); } }); }); }; /** * * @description Add a group operation to the batch. Operation will be applied in the order they are in the params array * * @param params Operations parameter */ OperationBatch.prototype.with = function (params) { var e_1, _a; try { for (var params_1 = __values(params), params_1_1 = params_1.next(); !params_1_1.done; params_1_1 = params_1.next()) { var param = params_1_1.value; switch (param.kind) { case OpKind.TRANSACTION: this.withTransfer(param); break; case OpKind.ORIGINATION: this.withOrigination(param); break; case OpKind.DELEGATION: this.withDelegation(param); break; case OpKind.ACTIVATION: this.withActivation(param); break; default: throw new Error("Unsupported operation kind: " + param.kind); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (params_1_1 && !params_1_1.done && (_a = params_1.return)) _a.call(params_1); } finally { if (e_1) throw e_1.error; } } return this; }; /** * * @description Forge and Inject the operation batch * * @param params Optionally specify the source of the operation */ OperationBatch.prototype.send = function (params) { return __awaiter(this, void 0, void 0, function () { var publicKeyHash, publicKey, estimates, revealNeeded, i, ops, _a, _b, op, estimated, _c, _d, e_2_1, reveal, estimatedReveal, _e, _f, source, prepared, forgedBytes, signedOperation, opResponse, hash; var e_2, _g; var _this = this; return __generator(this, function (_h) { switch (_h.label) { case 0: return [4 /*yield*/, this.signer.publicKeyHash()]; case 1: publicKeyHash = _h.sent(); return [4 /*yield*/, this.signer.publicKey()]; case 2: publicKey = _h.sent(); return [4 /*yield*/, this.estimator.batch(this.operations)]; case 3: estimates = _h.sent(); return [4 /*yield*/, this.isRevealOpNeeded(this.operations, publicKeyHash)]; case 4: revealNeeded = _h.sent(); i = revealNeeded ? 1 : 0; ops = []; _h.label = 5; case 5: _h.trys.push([5, 13, 14, 15]); _a = __values(this.operations), _b = _a.next(); _h.label = 6; case 6: if (!!_b.done) return [3 /*break*/, 12]; op = _b.value; if (!isOpWithFee(op)) return [3 /*break*/, 9]; return [4 /*yield*/, this.estimate(op, function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, estimates[i]]; }); }); })]; case 7: estimated = _h.sent(); _d = (_c = ops).push; return [4 /*yield*/, this.getRPCOp(__assign(__assign({}, op), estimated))]; case 8: _d.apply(_c, [_h.sent()]); return [3 /*break*/, 10]; case 9: ops.push(__assign({}, op)); _h.label = 10; case 10: i++; _h.label = 11; case 11: _b = _a.next(); return [3 /*break*/, 6]; case 12: return [3 /*break*/, 15]; case 13: e_2_1 = _h.sent(); e_2 = { error: e_2_1 }; return [3 /*break*/, 15]; case 14: try { if (_b && !_b.done && (_g = _a.return)) _g.call(_a); } finally { if (e_2) throw e_2.error; } return [7 /*endfinally*/]; case 15: if (!revealNeeded) return [3 /*break*/, 18]; reveal = { kind: OpKind.REVEAL }; return [4 /*yield*/, this.estimate(reveal, function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, estimates[0]]; }); }); })]; case 16: estimatedReveal = _h.sent(); _f = (_e = ops).unshift; return [4 /*yield*/, createRevealOperation(__assign({}, estimatedReveal), publicKeyHash, publicKey)]; case 17: _f.apply(_e, [_h.sent()]); _h.label = 18; case 18: source = (params && params.source) || publicKeyHash; return [4 /*yield*/, this.prepareOpAndSimulation({ operation: ops, source: source })]; case 19: prepared = _h.sent(); return [4 /*yield*/, this.forge(prepared.preparedOp)]; case 20: forgedBytes = _h.sent(); return [4 /*yield*/, this.signOperation(forgedBytes)]; case 21: signedOperation = _h.sent(); return [4 /*yield*/, this.preValidate(prepared, signedOperation)]; case 22: opResponse = _h.sent(); return [4 /*yield*/, this.injectOperation(signedOperation.opbytes)]; case 23: hash = _h.sent(); return [2 /*return*/, new BatchOperation(hash, ops, source, forgedBytes, opResponse, this.context.clone())]; } }); }); }; return OperationBatch; }(OperationEmitter)); var RPCBatchProvider = /** @class */ (function () { function RPCBatchProvider(context, estimator) { this.context = context; this.estimator = estimator; } /*** * * @description Batch a group of operation together. Operations will be applied in the order in which they are added to the batch * * @param params List of operation to batch together */ RPCBatchProvider.prototype.batch = function (params) { var batch = new OperationBatch(this.context, this.estimator); if (Array.isArray(params)) { batch.with(params); } return batch; }; return RPCBatchProvider; }()); /** * @description Delegation operation provide utility function to fetch newly issued delegation * * @warn Currently support only one delegation per operation */ var DelegateOperation = /** @class */ (function (_super) { __extends(DelegateOperation, _super); function DelegateOperation(hash, params, source, raw, results, context) { var _this = _super.call(this, hash, raw, results, context) || this; _this.params = params; _this.source = source; return _this; } Object.defineProperty(DelegateOperation.prototype, "operationResults", { get: function () { var delegationOp = Array.isArray(this.results) && this.results.find(function (op) { return op.kind === 'delegation'; }); var result = delegationOp && delegationOp.metadata && delegationOp.metadata.operation_result; return result ? result : undefined; }, enumerable: false, configurable: true }); Object.defineProperty(DelegateOperation.prototype, "status", { get: function () { var operationResults = this.operationResults; if (operationResults) { return operationResults.status; } else { return 'unknown'; } }, enumerable: false, configurable: true }); Object.defineProperty(DelegateOperation.prototype, "delegate", { get: function () { return this.delegate; }, enumerable: false, configurable: true }); Object.defineProperty(DelegateOperation.prototype, "isRegisterOperation", { get: function () { return this.delegate === this.source; }, enumerable: false, configurable: true }); Object.defineProperty(DelegateOperation.prototype, "fee", { get: function () { return this.params.fee; }, enumerable: false, configurable: true }); Object.defineProperty(DelegateOperation.prototype, "gasLimit", { get: function () { return this.params.gas_limit; }, enumerable: false, configurable: true }); Object.defineProperty(DelegateOperation.prototype, "storageLimit", { get: function () { return this.params.storage_limit; }, enumerable: false, configurable: true }); Object.defineProperty(DelegateOperation.prototype, "consumedGas", { get: function () { var consumedGas = this.operationResults && this.operationResults.consumed_gas; return consumedGas ? consumedGas : undefined; }, enumerable: false, configurable: true }); Object.defineProperty(DelegateOperation.prototype, "errors", { get: function () { return this.operationResults && this.operationResults.errors; }, enumerable: false, configurable: true }); return DelegateOperation; }(Operation)); /** * @description Origination operation provide utility function to fetch newly originated contract * * @warn Currently support only one origination per operation */ var OriginationOperation = /** @class */ (function (_super) { __extends(OriginationOperation, _super); function OriginationOperation(hash, params, raw, results, context, contractProvider) { var _this = _super.call(this, hash, raw, results, context) || this; _this.params = params; _this.contractProvider = contractProvider; var originatedContracts = _this.operationResults && _this.operationResults.originated_contracts; if (Array.isArray(originatedContracts)) { _this.contractAddress = originatedContracts[0]; } return _this; } Object.defineProperty(OriginationOperation.prototype, "status", { get: function () { var operationResults = this.operationResults; if (operationResults) { return operationResults.status; } else { return 'unknown'; } }, enumerable: false, configurable: true }); Object.defineProperty(OriginationOperation.prototype, "operationResults", { get: function () { var originationOp = Array.isArray(this.results) && this.results.find(function (op) { return op.kind === 'origination'; }); var result = originationOp && hasMetadataWithResult(originationOp) && originationOp.metadata.operation_result; return result ? result : undefined; }, enumerable: false, configurable: true }); Object.defineProperty(OriginationOperation.prototype, "fee", { get: function () { return this.params.fee; }, enumerable: false, configurable: true }); Object.defineProperty(OriginationOperation.prototype, "gasLimit", { get: function () { return this.params.gas_limit; }, enumerable: false, configurable: true }); Object.defineProperty(OriginationOperation.prototype, "storageLimit", { get: function () { return this.params.storage_limit; }, enumerable: false, configurable: true }); Object.defineProperty(OriginationOperation.prototype, "consumedGas", { get: function () { var consumedGas = this.operationResults && this.operationResults.consumed_gas; return consumedGas ? consumedGas : undefined; }, enumerable: false, configurable: true }); Object.defineProperty(OriginationOperation.prototype, "storageDiff", { get: function () { var storageDiff = this.operationResults && this.operationResults.paid_storage_size_diff; return storageDiff ? storageDiff : undefined; }, enumerable: false, configurable: true }); Object.defineProperty(OriginationOperation.prototype, "storageSize", { get: function () { var storageSize = this.operationResults && this.operationResults.storage_size; return storageSize ? storageSize : undefined; }, enumerable: false, configurable: true }); Object.defineProperty(OriginationOperation.prototype, "errors", { get: function () { return this.operationResults && this.operationResults.errors; }, enumerable: false, configurable: true }); /** * @description Provide the contract abstract of the newly originated contract */ OriginationOperation.prototype.contract = function (confirmations, interval, timeout) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { switch (_a.label) { case 0: if (!this.contractAddress) { throw new Error('No contract was originated in this operation'); } return [4 /*yield*/, this.confirmation(confirmations, interval, timeout)]; case 1: _a.sent(); return [2 /*return*/, this.contractProvider.at(this.contractAddress)]; } }); }); }; return OriginationOperation; }(Operation)); /** * @description Reveal operation provides utility functions to fetch a newly issued revelation */ var RevealOperation = /** @class */ (function (_super) { __extends(RevealOperation, _super); function RevealOperation(hash, params, source, raw, results, context) { var _this = _super.call(this, hash, raw, results, context) || this; _this.params = params; _this.source = source; return _this; } Object.defineProperty(RevealOperation.prototype, "operationResults", { get: function () { var revealOp = Array.isArray(this.results) && this.results.find(function (op) { return op.kind === 'reveal'; }); return revealOp ? [revealOp] : []; }, enumerable: false, configurable: true }); Object.defineProperty(RevealOperation.prototype, "status", { get: function () { var operationResults = this.operationResults; var txResult = operationResults[0]; if (txResult) { return txResult.metadata.operation_result.status; } else { return 'unknown'; } }, enumerable: false, configurable: true }); Object.defineProperty(RevealOperation.prototype, "fee", { get: function () { return this.params.fee; }, enumerable: false, configurable: true }); Object.defineProperty(RevealOperation.prototype, "gasLimit", { get: function () { return this.params.gas_limit; }, enumerable: false, configurable: true }); Object.defineProperty(RevealOperation.prototype, "storageLimit", { get: function () { return this.params.storage_limit; }, enumerable: false, configurable: true }); Object.defineProperty(RevealOperation.prototype, "publicKey", { get: function () { return this.params.public_key; }, enumerable: false, configurable: true }); RevealOperation.prototype.sumProp = function (arr, prop) { return arr.reduce(function (prev, current) { return prop in current ? Number(current[prop]) + prev : prev; }, 0); }; Object.defineProperty(RevealOperation.prototype, "consumedGas", { get: function () { return String(this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'consumed_gas')); }, enumerable: false, configurable: true }); Object.defineProperty(RevealOperation.prototype, "storageDiff", { get: function () { return String(this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'paid_storage_size_diff')); }, enumerable: false, configurable: true }); Object.defineProperty(RevealOperation.prototype, "storageSize", { get: function () { return String(this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'storage_size')); }, enumerable: false, configurable: true }); Object.defineProperty(RevealOperation.prototype, "errors", { get: function () { return flattenErrors({ contents: this.operationResults }); }, enumerable: false, configurable: true }); return RevealOperation; }(Operation)); /** * @description Transaction operation provides utility functions to fetch a newly issued transaction * * @warn Currently supports one transaction per operation */ var TransactionOperation = /** @class */ (function (_super) { __extends(TransactionOperation, _super); function TransactionOperation(hash, params, source, raw, results, context) { var _this = _super.call(this, hash, raw, results, context) || this; _this.params = params; _this.source = source; return _this; } Object.defineProperty(TransactionOperation.prototype, "operationResults", { get: function () { var transactionOp = Array.isArray(this.results) && this.results.find(function (op) { return op.kind === 'transaction'; }); return transactionOp ? [transactionOp] : []; }, enumerable: false, configurable: true }); Object.defineProperty(TransactionOperation.prototype, "status", { get: function () { var operationResults = this.operationResults; var txResult = operationResults[0]; if (txResult) { return txResult.metadata.operation_result.status; } else { return 'unknown'; } }, enumerable: false, configurable: true }); Object.defineProperty(TransactionOperation.prototype, "amount", { get: function () { return new BigNumber(this.params.amount); }, enumerable: false, configurable: true }); Object.defineProperty(TransactionOperation.prototype, "destination", { get: function () { return this.params.destination; }, enumerable: false, configurable: true }); Object.defineProperty(TransactionOperation.prototype, "fee", { get: function () { return this.params.fee; }, enumerable: false, configurable: true }); Object.defineProperty(TransactionOperation.prototype, "gasLimit", { get: function () { return this.params.gas_limit; }, enumerable: false, configurable: true }); Object.defineProperty(TransactionOperation.prototype, "storageLimit", { get: function () { return this.params.storage_limit; }, enumerable: false, configurable: true }); TransactionOperation.prototype.sumProp = function (arr, prop) { return arr.reduce(function (prev, current) { return prop in current ? Number(current[prop]) + prev : prev; }, 0); }; Object.defineProperty(TransactionOperation.prototype, "consumedGas", { get: function () { return String(this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'consumed_gas')); }, enumerable: false, configurable: true }); Object.defineProperty(TransactionOperation.prototype, "storageDiff", { get: function () { return String(this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'paid_storage_size_diff')); }, enumerable: false, configurable: true }); Object.defineProperty(TransactionOperation.prototype, "storageSize", { get: function () { return String(this.sumProp(flattenOperationResult({ contents: this.operationResults }), 'storage_size')); }, enumerable: false, configurable: true }); Object.defineProperty(TransactionOperation.prototype, "errors", { get: function () { return flattenErrors({ contents: this.operationResults }); }, enumerable: false, configurable: true }); return TransactionOperation; }(Operation)); var setDelegate = function (key) { return [ { prim: 'DROP' }, { prim: 'NIL', args: [{ prim: 'operation' }] }, { prim: 'PUSH', args: [{ prim: 'key_hash' }, { string: key }], }, { prim: 'SOME' }, { prim: 'SET_DELEGATE' }, { prim: 'CONS' }, ]; }; var transferImplicit = function (key, mutez) { return [ { prim: 'DROP' }, { prim: 'NIL', args: [{ prim: 'operation' }] }, { prim: 'PUSH', args: [{ prim: 'key_hash' }, { string: key }], }, { prim: 'IMPLICIT_ACCOUNT' }, { prim: 'PUSH', args: [{ prim: 'mutez' }, { int: "" + mutez }], }, { prim: 'UNIT' }, { prim: 'TRANSFER_TOKENS' }, { prim: 'CONS' }, ]; }; var removeDelegate = function () { return [ { prim: 'DROP' }, { prim: 'NIL', args: [{ prim: 'operation' }] }, { prim: 'NONE', args: [{ prim: 'key_hash' }] }, { prim: 'SET_DELEGATE' }, { prim: 'CONS' }, ]; }; var transferToContract = function (key, amount) { return [ { prim: 'DROP' }, { prim: 'NIL', args: [{ prim: 'operation' }] }, { prim: 'PUSH', args: [{ prim: 'address' }, { string: key }], }, { prim: 'CONTRACT', args: [{ prim: 'unit' }] }, [ { prim: 'IF_NONE', args: [[[{ prim: 'UNIT' }, { prim: 'FAILWITH' }]], []], }, ], { prim: 'PUSH', args: [{ prim: 'mutez' }, { int: "" + amount }], }, { prim: 'UNIT' }, { prim: 'TRANSFER_TOKENS' }, { prim: 'CONS' }, ]; }; var MANAGER_LAMBDA = { setDelegate: setDelegate, removeDelegate: removeDelegate, transferImplicit: transferImplicit, transferToContract: transferToContract, }; var code = [ { prim: 'parameter', args: [ { prim: 'lambda', args: [ { prim: 'unit' }, { prim: 'pair', args: [{ prim: 'list', args: [{ prim: 'operation' }] }, { prim: 'unit' }], }, ], }, ], }, { prim: 'storage', args: [{ prim: 'unit' }] }, { prim: 'code', args: [[{ prim: 'CAR' }, { prim: 'UNIT' }, { prim: 'EXEC' }]] }, ]; var storage = 'Unit'; var VIEW_LAMBDA = { code: code, storage: storage }; function compose(functioncomposer1, functioncomposer2) { return function (contractAbstraction, context) { return functioncomposer2(functioncomposer1(contractAbstraction, context), context); }; } var WalletOperationBatch = /** @class */ (function () { function WalletOperationBatch(walletProvider, context) { this.walletProvider = walletProvider; this.context = context; this.operations = []; } /** * * @description Add a transaction operation to the batch * * @param params Transfer operation parameter */ WalletOperationBatch.prototype.withTransfer = function (params) { this.operations.push(__assign({ kind: OpKind.TRANSACTION }, params)); return this; }; /** * * @description Add a transaction operation to the batch * * @param params Transfer operation parameter */ WalletOperationBatch.prototype.withContractCall = function (params) { return this.withTransfer(params.toTransferParams()); }; /** * * @description Add a delegation operation to the batch * * @param params Delegation operation parameter */ WalletOperationBatch.prototype.withDelegation = function (params) { this.operations.push(__assign({ kind: OpKind.DELEGATION }, params)); return this; }; /** * * @description Add an origination operation to the batch * * @param params Origination operation parameter */ WalletOperationBatch.prototype.withOrigination = function (params) { this.operations.push(__assign({ kind: OpKind.ORIGINATION }, params)); return this; }; WalletOperationBatch.prototype.mapOperation = function (param) { return __awaiter(this, void 0, void 0, function () { var _this = this; return __generator(this, function (_a) { switch (param.kind) { case OpKind.TRANSACTION: return [2 /*return*/, this.walletProvider.mapTransferParamsToWalletParams(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, param]; }); }); })]; case OpKind.ORIGINATION: return [2 /*return*/, this.walletProvider.mapOriginateParamsToWalletParams(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, this.context.parser.prepareCodeOrigination(__assign({}, param))]; }); }); })]; case OpKind.DELEGATION: return [2 /*return*/, this.walletProvider.mapDelegateParamsToWalletParams(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, param]; }); }); })]; default: throw new Error("Unsupported operation kind: " + param.kind); } }); }); }; /** * * @description Add a group operation to the batch. Operation will be applied in the order they are in the params array * * @param params Operations parameter */ WalletOperationBatch.prototype.with = function (params) { var e_1, _a; try { for (var params_1 = __values(params), params_1_1 = params_1.next(); !params_1_1.done; params_1_1 = params_1.next()) { var param = params_1_1.value; switch (param.kind) { case OpKind.TRANSACTION: this.withTransfer(param); break; case OpKind.ORIGINATION: this.withOrigination(param); break; case OpKind.DELEGATION: this.withDelegation(param); break; default: throw new Error("Unsupported operation kind: " + param.kind); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (params_1_1 && !params_1_1.done && (_a = params_1.return)) _a.call(params_1); } finally { if (e_1) throw e_1.error; } } return this; }; /** * * @description Submit batch operation to wallet * */ WalletOperationBatch.prototype.send = function () { return __awaiter(this, void 0, void 0, function () { var ops, _a, _b, op, _c, _d, e_2_1, opHash; var e_2, _e; return __generator(this, function (_f) { switch (_f.label) { case 0: ops = []; _f.label = 1; case 1: _f.trys.push([1, 6, 7, 8]); _a = __values(this.operations), _b = _a.next(); _f.label = 2; case 2: if (!!_b.done) return [3 /*break*/, 5]; op = _b.value; _d = (_c = ops).push; return [4 /*yield*/, this.mapOperation(op)]; case 3: _d.apply(_c, [_f.sent()]); _f.label = 4; case 4: _b = _a.next(); return [3 /*break*/, 2]; case 5: return [3 /*break*/, 8]; case 6: e_2_1 = _f.sent(); e_2 = { error: e_2_1 }; return [3 /*break*/, 8]; case 7: try { if (_b && !_b.done && (_e = _a.return)) _e.call(_a); } finally { if (e_2) throw e_2.error; } return [7 /*endfinally*/]; case 8: return [4 /*yield*/, this.walletProvider.sendOperations(ops)]; case 9: opHash = _f.sent(); return [2 /*return*/, this.context.operationFactory.createOperation(opHash)]; } }); }); }; return WalletOperationBatch; }()); var Wallet = /** @class */ (function () { function Wallet(context) { this.context = context; this.walletCommand = function (send) { return { send: send, }; }; } Object.defineProperty(Wallet.prototype, "walletProvider", { get: function () { return this.context.walletProvider; }, enumerable: false, configurable: true }); /** * @description Retrieve the PKH of the account that is currently in use by the wallet * * @param option Option to use while fetching the PKH. * If forceRefetch is specified the wallet provider implementation will refetch the PKH from the wallet */ Wallet.prototype.pkh = function (_a) { var _b = _a === void 0 ? {} : _a, forceRefetch = _b.forceRefetch; return __awaiter(this, void 0, void 0, function () { var _c; return __generator(this, function (_d) { switch (_d.label) { case 0: if (!(!this._pkh || forceRefetch)) return [3 /*break*/, 2]; _c = this; return [4 /*yield*/, this.walletProvider.getPKH()]; case 1: _c._pkh = _d.sent(); _d.label = 2; case 2: return [2 /*return*/, this._pkh]; } }); }); }; /** * * @description Originate a new contract according to the script in parameters. * * @returns An operation handle with the result from the rpc node * * @param originateParams Originate operation parameter */ Wallet.prototype.originate = function (params) { var _this = this; return this.walletCommand(function () { return __awaiter(_this, void 0, void 0, function () { var mappedParams, opHash, _a; var _this = this; return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, this.walletProvider.mapOriginateParamsToWalletParams(function () { return _this.context.parser.prepareCodeOrigination(__assign({}, params)); })]; case 1: mappedParams = _b.sent(); return [4 /*yield*/, this.walletProvider.sendOperations([mappedParams])]; case 2: opHash = _b.sent(); if (!!this.context.proto) return [3 /*break*/, 4]; _a = this.context; return [4 /*yield*/, this.context.rpc.getBlock()]; case 3: _a.proto = (_b.sent()).protocol; _b.label = 4; case 4: return [2 /*return*/, this.context.operationFactory.createOriginationOperation(opHash)]; } }); }); }); }; /** * * @description Set the delegate for a contract. * * @returns An operation handle with the result from the rpc node * * @param delegateParams operation parameter */ Wallet.prototype.setDelegate = function (params) { var _this = this; return this.walletCommand(function () { return __awaiter(_this, void 0, void 0, function () { var mappedParams, opHash; var _this = this; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.walletProvider.mapDelegateParamsToWalletParams(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, params]; }); }); })]; case 1: mappedParams = _a.sent(); return [4 /*yield*/, this.walletProvider.sendOperations([mappedParams])]; case 2: opHash = _a.sent(); return [2 /*return*/, this.context.operationFactory.createDelegationOperation(opHash)]; } }); }); }); }; /** * * @description Register the current address as delegate. * * @returns An operation handle with the result from the rpc node * */ Wallet.prototype.registerDelegate = function () { var _this = this; return this.walletCommand(function () { return __awaiter(_this, void 0, void 0, function () { var mappedParams, opHash; var _this = this; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.walletProvider.mapDelegateParamsToWalletParams(function () { return __awaiter(_this, void 0, void 0, function () { var delegate; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.pkh()]; case 1: delegate = _a.sent(); return [2 /*return*/, { delegate: delegate }]; } }); }); })]; case 1: mappedParams = _a.sent(); return [4 /*yield*/, this.walletProvider.sendOperations([mappedParams])]; case 2: opHash = _a.sent(); return [2 /*return*/, this.context.operationFactory.createDelegationOperation(opHash)]; } }); }); }); }; /** * * @description Transfer tezos tokens from current address to a specific address or call a smart contract. * * @returns A wallet command from which we can send the operation to the wallet * * @param params operation parameter */ Wallet.prototype.transfer = function (params) { var _this = this; return this.walletCommand(function () { return __awaiter(_this, void 0, void 0, function () { var mappedParams, opHash; var _this = this; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.walletProvider.mapTransferParamsToWalletParams(function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, params]; }); }); })]; case 1: mappedParams = _a.sent(); return [4 /*yield*/, this.walletProvider.sendOperations([mappedParams])]; case 2: opHash = _a.sent(); return [2 /*return*/, this.context.operationFactory.createTransactionOperation(opHash)]; } }); }); }); }; /** * * @description Create a batch of operation * * @returns A batch object from which we can add more operation or send a command to the wallet to execute the batch * * @param params List of operation to initialize the batch with */ Wallet.prototype.batch = function (params) { var batch = new WalletOperationBatch(this.walletProvider, this.context); if (Array.isArray(params)) { batch.with(params); } return batch; }; /** * * @description Create an smart contract abstraction for the address specified. Calling entrypoints with the returned * smart contract abstraction will leverage the wallet provider to make smart contract calls * * @param address Smart contract address */ Wallet.prototype.at = function (address, contractAbstractionComposer) { if (contractAbstractionComposer === void 0) { contractAbstractionComposer = function (x) { return x; }; } return __awaiter(this, void 0, void 0, function () { var script, entrypoints, blockHeader, chainId, abs; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.context.rpc.getScript(address)]; case 1: script = _a.sent(); return [4 /*yield*/, this.context.rpc.getEntrypoints(address)]; case 2: entrypoints = _a.sent(); return [4 /*yield*/, this.context.rpc.getBlockHeader()]; case 3: blockHeader = _a.sent(); chainId = blockHeader.chain_id; abs = new ContractAbstraction(address, script, this, this.context.contract, entrypoints, chainId); return [2 /*return*/, contractAbstractionComposer(abs, this.context)]; } }); }); }; return Wallet; }()); var LegacyWalletProvider = /** @class */ (function () { function LegacyWalletProvider(context) { this.context = context; } LegacyWalletProvider.prototype.getPKH = function () { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, this.context.signer.publicKeyHash()]; }); }); }; LegacyWalletProvider.prototype.mapTransferParamsToWalletParams = function (params) { return __awaiter(this, void 0, void 0, function () { var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: _a = attachKind; return [4 /*yield*/, params()]; case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent(), OpKind.TRANSACTION])]; } }); }); }; LegacyWalletProvider.prototype.mapOriginateParamsToWalletParams = function (params) { return __awaiter(this, void 0, void 0, function () { var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: _a = attachKind; return [4 /*yield*/, params()]; case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent(), OpKind.ORIGINATION])]; } }); }); }; LegacyWalletProvider.prototype.mapDelegateParamsToWalletParams = function (params) { return __awaiter(this, void 0, void 0, function () { var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: _a = attachKind; return [4 /*yield*/, params()]; case 1: return [2 /*return*/, _a.apply(void 0, [_b.sent(), OpKind.DELEGATION])]; } }); }); }; LegacyWalletProvider.prototype.sendOperations = function (params) { return __awaiter(this, void 0, void 0, function () { var op; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.context.batch.batch(params).send()]; case 1: op = _a.sent(); return [2 /*return*/, op.hash]; } }); }); }; return LegacyWalletProvider; }()); var LambdaView = /** @class */ (function () { function LambdaView(lambdaContract, viewContract, viewMethod, contractParameter) { if (viewMethod === void 0) { viewMethod = 'default'; } if (contractParameter === void 0) { contractParameter = { prim: 'Unit' }; } this.lambdaContract = lambdaContract; this.viewContract = viewContract; this.viewMethod = viewMethod; this.contractParameter = contractParameter; this.voidLambda = this.createVoidLambda(); } LambdaView.prototype.execute = function () { return __awaiter(this, void 0, void 0, function () { var ex_1, lastError, failedWith; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); return [4 /*yield*/, this.lambdaContract.methods.default(this.voidLambda).send()]; case 1: _a.sent(); return [3 /*break*/, 3]; case 2: ex_1 = _a.sent(); if (ex_1 instanceof TezosOperationError) { lastError = ex_1.errors[ex_1.errors.length - 1]; failedWith = lastError.with; return [2 /*return*/, failedWith]; } else { throw ex_1; } case 3: return [2 /*return*/]; } }); }); }; LambdaView.prototype.createVoidLambda = function () { var _a = __read(this.getView(), 2), parameter = _a[0], callback = _a[1]; var contractArgs = [ { prim: 'pair', args: [parameter, { prim: 'contract', args: [callback] }], }, ]; if (this.viewMethod === 'default') { contractArgs = [{ string: '%default' }].concat(contractArgs); } return [ { prim: 'PUSH', args: [{ prim: 'mutez' }, { int: '0' }] }, { prim: 'NONE', args: [{ prim: 'key_hash' }] }, { prim: 'CREATE_CONTRACT', args: [ [ { prim: 'parameter', args: [callback] }, { prim: 'storage', args: [{ prim: 'unit' }] }, { prim: 'code', args: [[{ prim: 'CAR' }, { prim: 'FAILWITH' }]], }, ], ], }, { prim: 'DIP', args: [ [ { prim: 'DIP', args: [ [ { prim: 'LAMBDA', args: [ { prim: 'pair', args: [{ prim: 'address' }, { prim: 'unit' }], }, { prim: 'pair', args: [{ prim: 'list', args: [{ prim: 'operation' }] }, { prim: 'unit' }], }, [ { prim: 'CAR' }, { prim: 'CONTRACT', args: [callback] }, { prim: 'IF_NONE', args: [ [ { prim: 'PUSH', args: [{ prim: 'string' }, { string: "Callback type unmatched" }], }, { prim: 'FAILWITH' }, ], [], ], }, { prim: 'PUSH', args: [parameter, this.contractParameter], }, { prim: 'PAIR' }, { prim: 'DIP', args: [ [ { prim: 'PUSH', args: [ { prim: 'address' }, { string: this.viewContract.address + "%" + this.viewMethod }, ], }, { prim: 'DUP' }, { prim: 'CONTRACT', args: contractArgs }, { prim: 'IF_NONE', args: [ [ { prim: 'PUSH', args: [ { prim: 'string' }, { string: "Contract does not exist" }, ], }, { prim: 'FAILWITH' }, ], [{ prim: 'DIP', args: [[{ prim: 'DROP' }]] }], ], }, { prim: 'PUSH', args: [{ prim: 'mutez' }, { int: '0' }], }, ], ], }, { prim: 'TRANSFER_TOKENS' }, { prim: 'DIP', args: [[{ prim: 'NIL', args: [{ prim: 'operation' }] }]], }, { prim: 'CONS' }, { prim: 'DIP', args: [[{ prim: 'UNIT' }]] }, { prim: 'PAIR' }, ], ], }, ], ], }, { prim: 'APPLY' }, { prim: 'DIP', args: [ [ { prim: 'PUSH', args: [{ prim: 'address' }, { string: this.lambdaContract.address }], }, { prim: 'DUP' }, { prim: 'CONTRACT', args: [ { prim: 'lambda', args: [ { prim: 'unit' }, { prim: 'pair', args: [ { prim: 'list', args: [{ prim: 'operation' }] }, { prim: 'unit' }, ], }, ], }, ], }, { prim: 'IF_NONE', args: [ [ { prim: 'PUSH', args: [{ prim: 'string' }, { string: "Contract does not exists" }], }, { prim: 'FAILWITH' }, ], [{ prim: 'DIP', args: [[{ prim: 'DROP' }]] }], ], }, { prim: 'PUSH', args: [{ prim: 'mutez' }, { int: '0' }] }, ], ], }, { prim: 'TRANSFER_TOKENS' }, { prim: 'DIP', args: [[{ prim: 'NIL', args: [{ prim: 'operation' }] }]], }, { prim: 'CONS' }, ], ], }, { prim: 'CONS' }, { prim: 'DIP', args: [[{ prim: 'UNIT' }]] }, { prim: 'PAIR' }, ]; }; LambdaView.prototype.getView = function () { var entrypoints = this.viewContract.entrypoints.entrypoints; var entrypoint = entrypoints[this.viewMethod]; if (!entrypoint) { throw Error("Contract at " + this.viewContract.address + " does not have entrypoint: " + this.viewMethod); } if (!('prim' in entrypoint) || !entrypoint.args) { // TODO: Enhance this error message to be more descriptive throw Error('Entrypoint args undefined'); } var args = Array.from(entrypoint.args); var _a = __read(args, 2), parameter = _a[0], callbackContract = _a[1]; if ('annots' in parameter) { delete parameter['annots']; } if (!('prim' in callbackContract) || !callbackContract.args) { // TODO: Enhance this error message to be more descriptive throw Error('Callback contract args undefined'); } var message; if (entrypoint.prim !== 'pair') { message = "Expected {'prim': 'pair', ..} but found {'prim': " + entrypoint.prim + ", ..}"; } else if (args.length !== 2) { message = "Expected an Array of length 2, but found: " + args; } else if (callbackContract.prim !== 'contract') { message = "Expected a {prim: 'contract', ...}, but found: " + callbackContract.prim; } else if (callbackContract.args && callbackContract.args.length !== 1) { message = "Expected a single argument to 'contract', but found: " + callbackContract.args; } if (message) throw Error(message); return [parameter, callbackContract.args[0]]; }; return LambdaView; }()); var DEFAULT_SMART_CONTRACT_METHOD_NAME = 'default'; /** * @description Utility class to send smart contract operation */ var ContractMethod = /** @class */ (function () { function ContractMethod(provider, address, parameterSchema, name, args, isMultipleEntrypoint, isAnonymous) { if (isMultipleEntrypoint === void 0) { isMultipleEntrypoint = true; } if (isAnonymous === void 0) { isAnonymous = false; } this.provider = provider; this.address = address; this.parameterSchema = parameterSchema; this.name = name; this.args = args; this.isMultipleEntrypoint = isMultipleEntrypoint; this.isAnonymous = isAnonymous; } Object.defineProperty(ContractMethod.prototype, "schema", { /** * @description Get the schema of the smart contract method */ get: function () { return this.isAnonymous ? this.parameterSchema.ExtractSchema()[this.name] : this.parameterSchema.ExtractSchema(); }, enumerable: false, configurable: true }); /** * * @description Send the smart contract operation * * @param Options generic operation parameter */ ContractMethod.prototype.send = function (params) { if (params === void 0) { params = {}; } if (this.provider instanceof Wallet) { // TODO got around TS2352: Conversion of type 'T & Wallet' to type 'Wallet' by adding `as unknown`. Needs clarification return this.provider.transfer(this.toTransferParams(params)).send(); } else { return this.provider.transfer(this.toTransferParams(params)); } }; /** * * @description Create transfer params to be used with TezosToolkit.contract.transfer methods * * @param Options generic transfer operation parameters */ ContractMethod.prototype.toTransferParams = function (_a) { var _b, _c; var _d = _a === void 0 ? {} : _a, fee = _d.fee, gasLimit = _d.gasLimit, storageLimit = _d.storageLimit, source = _d.source, _e = _d.amount, amount = _e === void 0 ? 0 : _e, _f = _d.mutez, mutez = _f === void 0 ? false : _f; var fullTransferParams = { to: this.address, amount: amount, fee: fee, mutez: mutez, source: source, gasLimit: gasLimit, storageLimit: storageLimit, parameter: { entrypoint: this.isMultipleEntrypoint ? this.name : 'default', value: this.isAnonymous ? (_b = this.parameterSchema).Encode.apply(_b, __spreadArray([this.name], __read(this.args))) : (_c = this.parameterSchema).Encode.apply(_c, __spreadArray([], __read(this.args))), }, }; return fullTransferParams; }; return ContractMethod; }()); /** * @description Utility class to retrieve data from a smart contract's storage without incurring fees via a contract's view method */ var ContractView = /** @class */ (function () { function ContractView(currentContract, provider, name, chainId, callbackParametersSchema, parameterSchema, args) { this.currentContract = currentContract; this.provider = provider; this.name = name; this.chainId = chainId; this.callbackParametersSchema = callbackParametersSchema; this.parameterSchema = parameterSchema; this.args = args; } /** * * @description Find which lambda contract to use based on the current network, * encode parameters to Michelson, * create an instance of Lambdaview to retrive data, and * Decode Michelson response * * @param Options Address of a lambda contract (sandbox users) */ ContractView.prototype.read = function (customLambdaAddress) { return __awaiter(this, void 0, void 0, function () { var lambdaAddress, lambdaContract, arg, lambdaView, failedWith, response; var _a; return __generator(this, function (_b) { switch (_b.label) { case 0: // TODO Verify if the 'customLambdaAdress' is a valid originated contract and if not, return an appropriate error message. if (customLambdaAddress) { lambdaAddress = customLambdaAddress; } else if (this.chainId === ChainIds.EDONET) { lambdaAddress = DefaultLambdaAddresses.EDONET; } else if (this.chainId === ChainIds.FLORENCENET) { lambdaAddress = DefaultLambdaAddresses.FLORENCENET; } else if (this.chainId === ChainIds.GRANADANET) { lambdaAddress = DefaultLambdaAddresses.GRANADANET; } else if (this.chainId === ChainIds.MAINNET) { lambdaAddress = DefaultLambdaAddresses.MAINNET; } else { throw new UndefinedLambdaContractError(); } return [4 /*yield*/, this.provider.at(lambdaAddress)]; case 1: lambdaContract = _b.sent(); arg = (_a = this.parameterSchema).Encode.apply(_a, __spreadArray([], __read(this.args))); lambdaView = new LambdaView(lambdaContract, this.currentContract, this.name, arg); return [4 /*yield*/, lambdaView.execute()]; case 2: failedWith = _b.sent(); response = this.callbackParametersSchema.Execute(failedWith); return [2 /*return*/, response]; } }); }); }; return ContractView; }()); var validateArgs = function (args, schema, name) { var sigs = schema.ExtractSignatures(); if (!sigs.find(function (x) { return x.length === args.length; })) { throw new InvalidParameterError(name, sigs, args); } }; var isView = function (schema) { var isView = false; var sigs = schema.ExtractSignatures(); if ((sigs[0][sigs[0].length - 1] === 'contract')) { isView = true; } return isView; }; var isContractProvider = function (variableToCheck) { return variableToCheck.contractProviderTypeSymbol !== undefined; }; /** * @description Smart contract abstraction */ var ContractAbstraction = /** @class */ (function () { function ContractAbstraction(address, script, provider, storageProvider, entrypoints, chainId) { this.address = address; this.script = script; this.storageProvider = storageProvider; this.entrypoints = entrypoints; this.chainId = chainId; /** * @description Contains methods that are implemented by the target Tezos Smart Contract, and offers the user to call the Smart Contract methods as if they were native TS/JS methods. * NB: if the contract contains annotation it will include named properties; if not it will be indexed by a number. * */ this.methods = {}; this.views = {}; this.schema = Schema.fromRPCResponse({ script: this.script }); this.parameterSchema = ParameterSchema.fromRPCResponse({ script: this.script }); this._initializeMethods(this, address, provider, this.entrypoints.entrypoints, this.chainId); } ContractAbstraction.prototype._initializeMethods = function (currentContract, address, provider, entrypoints, chainId) { var _this = this; var parameterSchema = this.parameterSchema; var keys = Object.keys(entrypoints); if (parameterSchema.isMultipleEntryPoint) { keys.forEach(function (smartContractMethodName) { var smartContractMethodSchema = new ParameterSchema(entrypoints[smartContractMethodName]); var method = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } validateArgs(args, smartContractMethodSchema, smartContractMethodName); return new ContractMethod(provider, address, smartContractMethodSchema, smartContractMethodName, args); }; _this.methods[smartContractMethodName] = method; if (isContractProvider(provider)) { if (isView(smartContractMethodSchema)) { var view = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } var entrypointParamWithoutCallback = entrypoints[smartContractMethodName].args[0]; var smartContractMethodSchemaWithoutCallback = new ParameterSchema(entrypointParamWithoutCallback); var parametersCallback = entrypoints[smartContractMethodName].args[1].args[0]; var smartContractMethodCallbackSchema = new ParameterSchema(parametersCallback); validateArgs(args, smartContractMethodSchemaWithoutCallback, smartContractMethodName); return new ContractView(currentContract, provider, smartContractMethodName, chainId, smartContractMethodCallbackSchema, smartContractMethodSchemaWithoutCallback, args); }; _this.views[smartContractMethodName] = view; } } }); // Deal with methods with no annotations which were not discovered by the RPC endpoint // Methods with no annotations are discovered using parameter schema var anonymousMethods = Object.keys(parameterSchema.ExtractSchema()).filter(function (key) { return Object.keys(entrypoints).indexOf(key) === -1; }); anonymousMethods.forEach(function (smartContractMethodName) { var method = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } validateArgs(__spreadArray([smartContractMethodName], __read(args)), parameterSchema, smartContractMethodName); return new ContractMethod(provider, address, parameterSchema, smartContractMethodName, args, false, true); }; _this.methods[smartContractMethodName] = method; }); } else { var smartContractMethodSchema_1 = this.parameterSchema; var method = function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } validateArgs(args, parameterSchema, DEFAULT_SMART_CONTRACT_METHOD_NAME); return new ContractMethod(provider, address, smartContractMethodSchema_1, DEFAULT_SMART_CONTRACT_METHOD_NAME, args, false); }; this.methods[DEFAULT_SMART_CONTRACT_METHOD_NAME] = method; } }; /** * @description Return a friendly representation of the smart contract storage */ ContractAbstraction.prototype.storage = function () { return this.storageProvider.getStorage(this.address, this.schema); }; /** * * @description Return a friendly representation of the smart contract big map value * * @param key BigMap key to fetch * * @deprecated getBigMapKey has been deprecated in favor of getBigMapKeyByID * * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-context-contracts-contract-id-big-map-get */ ContractAbstraction.prototype.bigMap = function (key) { // tslint:disable-next-line: deprecation return this.storageProvider.getBigMapKey(this.address, key, this.schema); }; return ContractAbstraction; }()); var BigMapAbstraction = /** @class */ (function () { function BigMapAbstraction(id, schema, provider) { this.id = id; this.schema = schema; this.provider = provider; } /** * * @description Fetch one value in a big map * * @param keysToEncode Key to query (will be encoded properly according to the schema) * @param block optional block level to fetch the values from (head will be use by default) * @returns Return a well formatted json object of a big map value or undefined if the key is not found in the big map * */ BigMapAbstraction.prototype.get = function (keyToEncode, block) { return __awaiter(this, void 0, void 0, function () { var id, e_1; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); return [4 /*yield*/, this.provider.getBigMapKeyByID(this.id.toString(), keyToEncode, this.schema, block)]; case 1: id = _a.sent(); return [2 /*return*/, id]; case 2: e_1 = _a.sent(); if (e_1 instanceof HttpResponseError && e_1.status === STATUS_CODE.NOT_FOUND) { return [2 /*return*/, undefined]; } else { throw e_1; } case 3: return [2 /*return*/]; } }); }); }; /** * * @description Fetch multiple values in a big map * All values will be fetched on the same block level. If a block is specified in the request, the values will be fetched at it. * Otherwise, a first request will be done to the node to fetch the level of the head and all values will be fetched at this level. * If one of the keys does not exist in the big map, its value will be set to undefined. * * @param keysToEncode Array of keys to query (will be encoded properly according to the schema) * @param block optional block level to fetch the values from * @param batchSize optional batch size representing the number of requests to execute in parallel * @returns A MichelsonMap containing the keys queried in the big map and their value in a well-formatted JSON object format * */ BigMapAbstraction.prototype.getMultipleValues = function (keysToEncode, block, batchSize) { if (batchSize === void 0) { batchSize = 5; } return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, this.provider.getBigMapKeysByID(this.id.toString(), keysToEncode, this.schema, block, batchSize)]; }); }); }; BigMapAbstraction.prototype.toJSON = function () { return this.id.toString(); }; BigMapAbstraction.prototype.toString = function () { return this.id.toString(); }; return BigMapAbstraction; }()); var SaplingStateAbstraction = /** @class */ (function () { function SaplingStateAbstraction(id, provider) { this.id = id; this.provider = provider; } /** * * @description Fetch the sapling state * * @param block optional block level to fetch the values from (head will be use by default) * @returns Return a json object of the sapling_state * */ SaplingStateAbstraction.prototype.getSaplingDiff = function (block) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, this.provider.getSaplingDiffByID(this.id.toString(), block)]; }); }); }; SaplingStateAbstraction.prototype.getId = function () { return this.id.toString(); }; return SaplingStateAbstraction; }()); // Override the default michelson encoder semantic to provide richer abstraction over storage properties var smartContractAbstractionSemantic = function (provider) { return ({ // Provide a specific abstraction for BigMaps big_map: function (val, code) { if (!val || !('int' in val) || val.int === undefined) { // Return an empty object in case of missing big map ID return {}; } else { var schema = new Schema(code); return new BigMapAbstraction(new BigNumber(val.int), schema, provider); } }, sapling_state: function (val) { if (!val || !('int' in val) || val.int === undefined) { // Return an empty object in case of missing sapling state ID return {}; } else { return new SaplingStateAbstraction(new BigNumber(val.int), provider); } } /* // TODO: embed useful other abstractions 'contract': () => {}, 'address': () => {} */ }); }; var RpcContractProvider = /** @class */ (function (_super) { __extends(RpcContractProvider, _super); function RpcContractProvider(context, estimator) { var _this = _super.call(this, context) || this; _this.estimator = estimator; _this.contractProviderTypeSymbol = Symbol.for('taquito--provider-type-symbol'); return _this; } /** * * @description Return a well formatted json object of the contract storage * * @param contract contract address you want to get the storage from * @param schema optional schema can either be the contract script rpc response or a michelson-encoder schema * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-contracts-contract-id-script */ RpcContractProvider.prototype.getStorage = function (contract, schema) { return __awaiter(this, void 0, void 0, function () { var contractSchema, storage; return __generator(this, function (_a) { switch (_a.label) { case 0: if (!!schema) return [3 /*break*/, 2]; return [4 /*yield*/, this.rpc.getScript(contract)]; case 1: schema = _a.sent(); _a.label = 2; case 2: if (Schema.isSchema(schema)) { contractSchema = schema; } else { contractSchema = Schema.fromRPCResponse({ script: schema }); } return [4 /*yield*/, this.rpc.getStorage(contract)]; case 3: storage = _a.sent(); return [2 /*return*/, contractSchema.Execute(storage, smartContractAbstractionSemantic(this))]; // Cast into T because only the caller can know the true type of the storage } }); }); }; /** * * @description Return a well formatted json object of the contract big map storage * * @param contract contract address you want to get the storage from * @param key contract big map key to fetch value from * @param schema optional schema can either be the contract script rpc response or a michelson-encoder schema * * @deprecated Deprecated in favor of getBigMapKeyByID * * @see https://tezos.gitlab.io/api/rpc.html#post-block-id-context-contracts-contract-id-big-map-get */ RpcContractProvider.prototype.getBigMapKey = function (contract, key, schema) { return __awaiter(this, void 0, void 0, function () { var contractSchema, encodedKey, val; return __generator(this, function (_a) { switch (_a.label) { case 0: if (!!schema) return [3 /*break*/, 2]; return [4 /*yield*/, this.rpc.getScript(contract)]; case 1: schema = _a.sent(); _a.label = 2; case 2: if (Schema.isSchema(schema)) { contractSchema = schema; } else { contractSchema = Schema.fromRPCResponse({ script: schema }); } encodedKey = contractSchema.EncodeBigMapKey(key); return [4 /*yield*/, this.rpc.getBigMapKey(contract, encodedKey)]; case 3: val = _a.sent(); return [2 /*return*/, contractSchema.ExecuteOnBigMapValue(val)]; // Cast into T because only the caller can know the true type of the storage } }); }); }; /** * * @description Return a well formatted json object of a big map value * * @param id Big Map ID * @param keyToEncode key to query (will be encoded properly according to the schema) * @param schema Big Map schema (can be determined using your contract type) * @param block optional block level to fetch the values from * * @see https://tezos.gitlab.io/api/rpc.html#get-block-id-context-big-maps-big-map-id-script-expr */ RpcContractProvider.prototype.getBigMapKeyByID = function (id, keyToEncode, schema, block) { return __awaiter(this, void 0, void 0, function () { var _a, key, type, packed, encodedExpr, bigMapValue, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _a = schema.EncodeBigMapKey(keyToEncode), key = _a.key, type = _a.type; return [4 /*yield*/, this.context.packer.packData({ data: key, type: type })]; case 1: packed = (_c.sent()).packed; encodedExpr = encodeExpr(packed); if (!block) return [3 /*break*/, 3]; return [4 /*yield*/, this.context.rpc.getBigMapExpr(id.toString(), encodedExpr, { block: String(block) })]; case 2: _b = _c.sent(); return [3 /*break*/, 5]; case 3: return [4 /*yield*/, this.context.rpc.getBigMapExpr(id.toString(), encodedExpr)]; case 4: _b = _c.sent(); _c.label = 5; case 5: bigMapValue = _b; return [2 /*return*/, schema.ExecuteOnBigMapValue(bigMapValue, smartContractAbstractionSemantic(this))]; } }); }); }; /** * * @description Fetch multiple values in a big map * All values will be fetched on the same block level. If a block is specified in the request, the values will be fetched at it. * Otherwise, a first request will be done to the node to fetch the level of the head and all values will be fetched at this level. * If one of the keys does not exist in the big map, its value will be set to undefined. * * @param id Big Map ID * @param keys Array of keys to query (will be encoded properly according to the schema) * @param schema Big Map schema (can be determined using your contract type) * @param block optional block level to fetch the values from * @param batchSize optional batch size representing the number of requests to execute in parallel * @returns A MichelsonMap containing the keys queried in the big map and their value in a well-formatted JSON object format * */ RpcContractProvider.prototype.getBigMapKeysByID = function (id, keys, schema, block, batchSize) { if (batchSize === void 0) { batchSize = 5; } return __awaiter(this, void 0, void 0, function () { var level, bigMapValues, position, results, keysBatch, batch, _a, i; var _this = this; return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, this.getBlockForRequest(keys, block)]; case 1: level = _b.sent(); bigMapValues = new MichelsonMap(); position = 0; results = []; _b.label = 2; case 2: if (!(position < keys.length)) return [3 /*break*/, 4]; keysBatch = keys.slice(position, position + batchSize); batch = keysBatch.map(function (keyToEncode) { return _this.getBigMapValueOrUndefined(keyToEncode, id, schema, level); }); _a = [__spreadArray([], __read(results))]; return [4 /*yield*/, Promise.all(batch)]; case 3: results = __spreadArray.apply(void 0, _a.concat([__read.apply(void 0, [_b.sent()])])); position += batchSize; return [3 /*break*/, 2]; case 4: for (i = 0; i < results.length; i++) { bigMapValues.set(keys[i], results[i]); } return [2 /*return*/, bigMapValues]; } }); }); }; RpcContractProvider.prototype.getBlockForRequest = function (keys, block) { var _a; return __awaiter(this, void 0, void 0, function () { var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: if (!(keys.length === 1 || typeof block !== 'undefined')) return [3 /*break*/, 1]; _b = block; return [3 /*break*/, 3]; case 1: return [4 /*yield*/, this.rpc.getBlock()]; case 2: _b = (_a = (_c.sent())) === null || _a === void 0 ? void 0 : _a.header.level; _c.label = 3; case 3: return [2 /*return*/, _b]; } }); }); }; RpcContractProvider.prototype.getBigMapValueOrUndefined = function (keyToEncode, id, schema, level) { return __awaiter(this, void 0, void 0, function () { var ex_1; return __generator(this, function (_a) { switch (_a.label) { case 0: _a.trys.push([0, 2, , 3]); return [4 /*yield*/, this.getBigMapKeyByID(id, keyToEncode, schema, level)]; case 1: return [2 /*return*/, _a.sent()]; case 2: ex_1 = _a.sent(); if (ex_1 instanceof HttpResponseError && ex_1.status === STATUS_CODE.NOT_FOUND) { return [2 /*return*/]; } else { throw ex_1; } case 3: return [2 /*return*/]; } }); }); }; /** * * @description Return a well formatted json object of a sapling state * * @param id Sapling state ID * @param block optional block level to fetch the value from * */ RpcContractProvider.prototype.getSaplingDiffByID = function (id, block) { return __awaiter(this, void 0, void 0, function () { var saplingState, _a; return __generator(this, function (_b) { switch (_b.label) { case 0: if (!block) return [3 /*break*/, 2]; return [4 /*yield*/, this.context.rpc.getSaplingDiffById(id.toString(), { block: String(block) })]; case 1: _a = _b.sent(); return [3 /*break*/, 4]; case 2: return [4 /*yield*/, this.context.rpc.getSaplingDiffById(id.toString())]; case 3: _a = _b.sent(); _b.label = 4; case 4: saplingState = _a; return [2 /*return*/, saplingState]; } }); }); }; RpcContractProvider.prototype.addRevealOperationIfNeeded = function (operation, publicKeyHash) { return __awaiter(this, void 0, void 0, function () { var ops, publicKey, estimateReveal_1, reveal, estimatedReveal, _a, _b; var _this = this; return __generator(this, function (_c) { switch (_c.label) { case 0: if (!isOpRequireReveal(operation)) return [3 /*break*/, 5]; ops = [operation]; return [4 /*yield*/, this.signer.publicKey()]; case 1: publicKey = _c.sent(); return [4 /*yield*/, this.estimator.reveal()]; case 2: estimateReveal_1 = _c.sent(); if (!estimateReveal_1) return [3 /*break*/, 5]; reveal = { kind: OpKind.REVEAL }; return [4 /*yield*/, this.estimate(reveal, function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, estimateReveal_1]; }); }); })]; case 3: estimatedReveal = _c.sent(); _b = (_a = ops).unshift; return [4 /*yield*/, createRevealOperation(__assign({}, estimatedReveal), publicKeyHash, publicKey)]; case 4: _b.apply(_a, [_c.sent()]); return [2 /*return*/, ops]; case 5: return [2 /*return*/, operation]; } }); }); }; /** * * @description Originate a new contract according to the script in parameters. Will sign and inject an operation using the current context * * @returns An operation handle with the result from the rpc node * * @warn You cannot specify storage and init at the same time (use init to pass the raw michelson representation of storage) * * @param OriginationOperation Originate operation parameter */ RpcContractProvider.prototype.originate = function (params) { return __awaiter(this, void 0, void 0, function () { var estimate, publicKeyHash, operation, _a, ops, preparedOrigination, forgedOrigination, signedOperation, opResponse, hash; return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, this.estimate(params, this.estimator.originate.bind(this.estimator))]; case 1: estimate = _b.sent(); return [4 /*yield*/, this.signer.publicKeyHash()]; case 2: publicKeyHash = _b.sent(); _a = createOriginationOperation; return [4 /*yield*/, this.context.parser.prepareCodeOrigination(__assign(__assign({}, params), estimate))]; case 3: return [4 /*yield*/, _a.apply(void 0, [_b.sent()])]; case 4: operation = _b.sent(); return [4 /*yield*/, this.addRevealOperationIfNeeded(operation, publicKeyHash)]; case 5: ops = _b.sent(); return [4 /*yield*/, this.prepareOpAndSimulation({ operation: ops, source: publicKeyHash })]; case 6: preparedOrigination = _b.sent(); return [4 /*yield*/, this.forge(preparedOrigination.preparedOp)]; case 7: forgedOrigination = _b.sent(); return [4 /*yield*/, this.signOperation(forgedOrigination)]; case 8: signedOperation = _b.sent(); return [4 /*yield*/, this.preValidate(preparedOrigination, signedOperation)]; case 9: opResponse = _b.sent(); return [4 /*yield*/, this.injectOperation(signedOperation.opbytes)]; case 10: hash = _b.sent(); return [2 /*return*/, new OriginationOperation(hash, operation, signedOperation, opResponse, this.context.clone(), this)]; } }); }); }; /** * * @description Set the delegate for a contract. Will sign and inject an operation using the current context * * @returns An operation handle with the result from the rpc node * * @param SetDelegate operation parameter */ RpcContractProvider.prototype.setDelegate = function (params) { return __awaiter(this, void 0, void 0, function () { var estimate, publicKeyHash, operation, sourceOrDefault, ops, prepared, opBytes, signedOperation, opResponse, hash; return __generator(this, function (_a) { switch (_a.label) { case 0: // Since babylon delegation source cannot smart contract if (/kt1/i.test(params.source)) { throw new InvalidDelegationSource(params.source); } return [4 /*yield*/, this.estimate(params, this.estimator.setDelegate.bind(this.estimator))]; case 1: estimate = _a.sent(); return [4 /*yield*/, this.signer.publicKeyHash()]; case 2: publicKeyHash = _a.sent(); return [4 /*yield*/, createSetDelegateOperation(__assign(__assign({}, params), estimate))]; case 3: operation = _a.sent(); sourceOrDefault = params.source || publicKeyHash; return [4 /*yield*/, this.addRevealOperationIfNeeded(operation, publicKeyHash)]; case 4: ops = _a.sent(); return [4 /*yield*/, this.prepareOpAndSimulation({ operation: ops, source: sourceOrDefault })]; case 5: prepared = _a.sent(); return [4 /*yield*/, this.forge(prepared.preparedOp)]; case 6: opBytes = _a.sent(); return [4 /*yield*/, this.signOperation(opBytes)]; case 7: signedOperation = _a.sent(); return [4 /*yield*/, this.preValidate(prepared, signedOperation)]; case 8: opResponse = _a.sent(); return [4 /*yield*/, this.injectOperation(signedOperation.opbytes)]; case 9: hash = _a.sent(); return [2 /*return*/, new DelegateOperation(hash, operation, sourceOrDefault, signedOperation, opResponse, this.context.clone())]; } }); }); }; /** * * @description Register the current address as delegate. Will sign and inject an operation using the current context * * @returns An operation handle with the result from the rpc node * * @param RegisterDelegate operation parameter */ RpcContractProvider.prototype.registerDelegate = function (params) { return __awaiter(this, void 0, void 0, function () { var estimate, source, operation, ops, prepared, opBytes, signedOperation, opResponse, hash; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.estimate(params, this.estimator.registerDelegate.bind(this.estimator))]; case 1: estimate = _a.sent(); return [4 /*yield*/, this.signer.publicKeyHash()]; case 2: source = _a.sent(); return [4 /*yield*/, createRegisterDelegateOperation(__assign(__assign({}, params), estimate), source)]; case 3: operation = _a.sent(); return [4 /*yield*/, this.addRevealOperationIfNeeded(operation, source)]; case 4: ops = _a.sent(); return [4 /*yield*/, this.prepareOpAndSimulation({ operation: ops, source: source })]; case 5: prepared = _a.sent(); return [4 /*yield*/, this.forge(prepared.preparedOp)]; case 6: opBytes = _a.sent(); return [4 /*yield*/, this.signOperation(opBytes)]; case 7: signedOperation = _a.sent(); return [4 /*yield*/, this.preValidate(prepared, signedOperation)]; case 8: opResponse = _a.sent(); return [4 /*yield*/, this.injectOperation(signedOperation.opbytes)]; case 9: hash = _a.sent(); return [2 /*return*/, new DelegateOperation(hash, operation, source, signedOperation, opResponse, this.context.clone())]; } }); }); }; /** * * @description Transfer tz from current address to a specific address. Will sign and inject an operation using the current context * * @returns An operation handle with the result from the rpc node * * @param Transfer operation parameter */ RpcContractProvider.prototype.transfer = function (params) { return __awaiter(this, void 0, void 0, function () { var publicKeyHash, estimate, operation, source, ops, prepared, forgedOperation, signedOperation, opResponse, hash; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.signer.publicKeyHash()]; case 1: publicKeyHash = _a.sent(); return [4 /*yield*/, this.estimate(params, this.estimator.transfer.bind(this.estimator))]; case 2: estimate = _a.sent(); return [4 /*yield*/, createTransferOperation(__assign(__assign({}, params), estimate))]; case 3: operation = _a.sent(); source = params.source || publicKeyHash; return [4 /*yield*/, this.addRevealOperationIfNeeded(operation, publicKeyHash)]; case 4: ops = _a.sent(); return [4 /*yield*/, this.prepareOpAndSimulation({ operation: ops, source: source })]; case 5: prepared = _a.sent(); return [4 /*yield*/, this.forge(prepared.preparedOp)]; case 6: forgedOperation = _a.sent(); return [4 /*yield*/, this.signOperation(forgedOperation)]; case 7: signedOperation = _a.sent(); return [4 /*yield*/, this.preValidate(prepared, signedOperation)]; case 8: opResponse = _a.sent(); return [4 /*yield*/, this.injectOperation(signedOperation.opbytes)]; case 9: hash = _a.sent(); return [2 /*return*/, new TransactionOperation(hash, operation, source, signedOperation, opResponse, this.context.clone())]; } }); }); }; /** * * @description Reveal the current address. Will throw an error if the address is already revealed. * * @returns An operation handle with the result from the rpc node * * @param RevealParams operation parameter */ RpcContractProvider.prototype.reveal = function (params) { return __awaiter(this, void 0, void 0, function () { var publicKeyHash, estimateReveal, estimated, operation, _a, _b, prepared, opBytes, signedOperation, opResponse, hash; var _this = this; return __generator(this, function (_c) { switch (_c.label) { case 0: return [4 /*yield*/, this.signer.publicKeyHash()]; case 1: publicKeyHash = _c.sent(); return [4 /*yield*/, this.estimator.reveal(params)]; case 2: estimateReveal = _c.sent(); if (!estimateReveal) return [3 /*break*/, 11]; return [4 /*yield*/, this.estimate(params, function () { return __awaiter(_this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, estimateReveal]; }); }); })]; case 3: estimated = _c.sent(); _a = createRevealOperation; _b = [__assign({}, estimated), publicKeyHash]; return [4 /*yield*/, this.signer.publicKey()]; case 4: return [4 /*yield*/, _a.apply(void 0, _b.concat([_c.sent()]))]; case 5: operation = _c.sent(); return [4 /*yield*/, this.prepareOpAndSimulation({ operation: operation, source: publicKeyHash })]; case 6: prepared = _c.sent(); return [4 /*yield*/, this.forge(prepared.preparedOp)]; case 7: opBytes = _c.sent(); return [4 /*yield*/, this.signOperation(opBytes)]; case 8: signedOperation = _c.sent(); return [4 /*yield*/, this.preValidate(prepared, signedOperation)]; case 9: opResponse = _c.sent(); return [4 /*yield*/, this.injectOperation(signedOperation.opbytes)]; case 10: hash = _c.sent(); return [2 /*return*/, new RevealOperation(hash, operation, publicKeyHash, signedOperation, opResponse, this.context.clone())]; case 11: throw new Error('The current address is already revealed.'); } }); }); }; RpcContractProvider.prototype.at = function (address, contractAbstractionComposer) { if (contractAbstractionComposer === void 0) { contractAbstractionComposer = function (x) { return x; }; } return __awaiter(this, void 0, void 0, function () { var script, entrypoints, blockHeader, chainId, abs; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.rpc.getScript(address)]; case 1: script = _a.sent(); return [4 /*yield*/, this.rpc.getEntrypoints(address)]; case 2: entrypoints = _a.sent(); return [4 /*yield*/, this.rpc.getBlockHeader()]; case 3: blockHeader = _a.sent(); chainId = blockHeader.chain_id; abs = new ContractAbstraction(address, script, this, this, entrypoints, chainId); return [2 /*return*/, contractAbstractionComposer(abs, this.context)]; } }); }); }; /** * * @description Batch a group of operation together. Operations will be applied in the order in which they are added to the batch * * @returns A batch object from which we can add more operation or send a command to execute the batch * * @param params List of operation to batch together */ RpcContractProvider.prototype.batch = function (params) { var batch = new OperationBatch(this.context, this.estimator); if (Array.isArray(params)) { batch.with(params); } return batch; }; return RpcContractProvider; }(OperationEmitter)); var MichelCodecParser = /** @class */ (function () { function MichelCodecParser(context) { this.context = context; } MichelCodecParser.prototype.getNextProto = function () { return __awaiter(this, void 0, void 0, function () { var next_protocol; return __generator(this, function (_a) { switch (_a.label) { case 0: return [4 /*yield*/, this.context.rpc.getBlockMetadata()]; case 1: next_protocol = (_a.sent()).next_protocol; return [2 /*return*/, next_protocol]; } }); }); }; MichelCodecParser.prototype.parseScript = function (src) { return __awaiter(this, void 0, void 0, function () { var parser, _a; var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _a = Parser.bind; _b = {}; return [4 /*yield*/, this.getNextProto()]; case 1: parser = new (_a.apply(Parser, [void 0, (_b.protocol = _c.sent(), _b)]))(); return [2 /*return*/, parser.parseScript(src)]; } }); }); }; MichelCodecParser.prototype.parseMichelineExpression = function (src) { return __awaiter(this, void 0, void 0, function () { var parser, _a; var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _a = Parser.bind; _b = {}; return [4 /*yield*/, this.getNextProto()]; case 1: parser = new (_a.apply(Parser, [void 0, (_b.protocol = _c.sent(), _b)]))(); return [2 /*return*/, parser.parseMichelineExpression(src)]; } }); }); }; MichelCodecParser.prototype.parseJSON = function (src) { return __awaiter(this, void 0, void 0, function () { var parser, _a; var _b; return __generator(this, function (_c) { switch (_c.label) { case 0: _a = Parser.bind; _b = {}; return [4 /*yield*/, this.getNextProto()]; case 1: parser = new (_a.apply(Parser, [void 0, (_b.protocol = _c.sent(), _b)]))(); return [2 /*return*/, parser.parseJSON(src)]; } }); }); }; MichelCodecParser.prototype.prepareCodeOrigination = function (params) { return __awaiter(this, void 0, void 0, function () { var parsedParams, _a, _b; return __generator(this, function (_c) { switch (_c.label) { case 0: parsedParams = params; _a = parsedParams; return [4 /*yield*/, this.formatCodeParam(params.code)]; case 1: _a.code = _c.sent(); if (!params.init) return [3 /*break*/, 3]; _b = parsedParams; return [4 /*yield*/, this.formatInitParam(params.init)]; case 2: _b.init = _c.sent(); _c.label = 3; case 3: return [2 /*return*/, parsedParams]; } }); }); }; MichelCodecParser.prototype.formatCodeParam = function (code) { return __awaiter(this, void 0, void 0, function () { var parsedCode, c, c, order_1; return __generator(this, function (_a) { switch (_a.label) { case 0: if (!(typeof code === 'string')) return [3 /*break*/, 2]; return [4 /*yield*/, this.parseScript(code)]; case 1: c = _a.sent(); if (c === null) { throw new InvalidCodeParameter('Invalid code parameter', code); } parsedCode = c; return [3 /*break*/, 4]; case 2: return [4 /*yield*/, this.parseJSON(code)]; case 3: c = _a.sent(); order_1 = ['parameter', 'storage', 'code']; // Ensure correct ordering for RPC parsedCode = c.sort(function (a, b) { return order_1.indexOf(a.prim) - order_1.indexOf(b.prim); }); _a.label = 4; case 4: return [2 /*return*/, parsedCode]; } }); }); }; MichelCodecParser.prototype.formatInitParam = function (init) { return __awaiter(this, void 0, void 0, function () { var parsedInit, c; return __generator(this, function (_a) { switch (_a.label) { case 0: if (!(typeof init === 'string')) return [3 /*break*/, 2]; return [4 /*yield*/, this.parseMichelineExpression(init)]; case 1: c = _a.sent(); if (c === null) { throw new InvalidInitParameter('Invalid init parameter', init); } parsedInit = c; return [3 /*break*/, 4]; case 2: return [4 /*yield*/, this.parseJSON(init)]; case 3: parsedInit = _a.sent(); _a.label = 4; case 4: return [2 /*return*/, parsedInit]; } }); }); }; return MichelCodecParser; }()); var RpcPacker = /** @class */ (function () { function RpcPacker(context) { this.context = context; } RpcPacker.prototype.packData = function (data) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, this.context.rpc.packData(data)]; }); }); }; return RpcPacker; }()); var defaultConfig = { defaultConfirmationCount: 1, confirmationPollingTimeoutSecond: 180, shouldObservableSubscriptionRetry: false, observableSubscriptionRetryFunction: retry(), }; /** * @description Encapsulate common service used throughout different part of the library */ var Context = /** @class */ (function () { function Context(_rpc, _signer, _proto, _config, forger, injector, packer, wallet, parser) { if (_signer === void 0) { _signer = new NoopSigner(); } this._rpc = _rpc; this._signer = _signer; this._proto = _proto; this._config = _config; this._counters = {}; this.tz = new RpcTzProvider(this); this.estimate = new RPCEstimateProvider(this); this.contract = new RpcContractProvider(this, this.estimate); this.batch = new RPCBatchProvider(this, this.estimate); this.wallet = new Wallet(this); if (typeof this._rpc === 'string') { this._rpcClient = new RpcClient(this._rpc); } else { this._rpcClient = this._rpc; } this.config = _config; this._forger = forger ? forger : new RpcForger(this); this._injector = injector ? injector : new RpcInjector(this); this.operationFactory = new OperationFactory(this); this._walletProvider = wallet ? wallet : new LegacyWalletProvider(this); this._parser = parser ? parser : new MichelCodecParser(this); this._packer = packer ? packer : new RpcPacker(this); } Object.defineProperty(Context.prototype, "config", { get: function () { return this._config; }, set: function (value) { this._config = __assign(__assign({}, defaultConfig), value); }, enumerable: false, configurable: true }); Object.defineProperty(Context.prototype, "rpc", { get: function () { return this._rpcClient; }, set: function (value) { this._rpcClient = value; }, enumerable: false, configurable: true }); Object.defineProperty(Context.prototype, "injector", { get: function () { return this._injector; }, set: function (value) { this._injector = value; }, enumerable: false, configurable: true }); Object.defineProperty(Context.prototype, "forger", { get: function () { return this._forger; }, set: function (value) { this._forger = value; }, enumerable: false, configurable: true }); Object.defineProperty(Context.prototype, "signer", { get: function () { return this._signer; }, set: function (value) { this._signer = value; }, enumerable: false, configurable: true }); Object.defineProperty(Context.prototype, "walletProvider", { get: function () { return this._walletProvider; }, set: function (value) { this._walletProvider = value; }, enumerable: false, configurable: true }); Object.defineProperty(Context.prototype, "proto", { get: function () { return this._proto; }, set: function (value) { this._proto = value; }, enumerable: false, configurable: true }); Object.defineProperty(Context.prototype, "parser", { get: function () { return this._parser; }, set: function (value) { this._parser = value; }, enumerable: false, configurable: true }); Object.defineProperty(Context.prototype, "packer", { get: function () { return this._packer; }, set: function (value) { this._packer = value; }, enumerable: false, configurable: true }); Object.defineProperty(Context.prototype, "counters", { get: function () { return this._counters; }, set: function (value) { this._counters[value.key] = value.counter; }, enumerable: false, configurable: true }); Context.prototype.isAnyProtocolActive = function (protocol) { if (protocol === void 0) { protocol = []; } return __awaiter(this, void 0, void 0, function () { var next_protocol; return __generator(this, function (_a) { switch (_a.label) { case 0: if (!this._proto) return [3 /*break*/, 1]; return [2 /*return*/, protocol.includes(this._proto)]; case 1: return [4 /*yield*/, this.rpc.getBlockMetadata()]; case 2: next_protocol = (_a.sent()).next_protocol; return [2 /*return*/, protocol.includes(next_protocol)]; } }); }); }; Context.prototype.getConfirmationPollingInterval = function () { return __awaiter(this, void 0, void 0, function () { var defaultInterval, constants, blockTime, confirmationPollingInterval; return __generator(this, function (_a) { switch (_a.label) { case 0: defaultInterval = 5; _a.label = 1; case 1: _a.trys.push([1, 3, , 4]); return [4 /*yield*/, this.rpc.getConstants()]; case 2: constants = _a.sent(); blockTime = constants.time_between_blocks[0]; if (constants.minimal_block_delay !== undefined) { blockTime = constants.minimal_block_delay; } confirmationPollingInterval = BigNumber.sum(blockTime, new BigNumber(constants.delay_per_missing_endorsement) .multipliedBy(Math.max(0, constants.initial_endorsers - constants.endorsers_per_block))); // Divide the polling interval by a constant 3 // to improvise for polling time to work in prod, // testnet and sandbox enviornment. confirmationPollingInterval = confirmationPollingInterval.dividedBy(3); if (confirmationPollingInterval.toNumber() > defaultInterval) { // Fix for the transistion from Florence to Granada this.config.confirmationPollingIntervalSecond = defaultInterval; } else { this.config.confirmationPollingIntervalSecond = confirmationPollingInterval.toNumber() === 0 ? 0.1 : confirmationPollingInterval.toNumber(); } return [2 /*return*/, this.config.confirmationPollingIntervalSecond]; case 3: _a.sent(); // Return default value if there is // an issue returning from constants // file. return [2 /*return*/, defaultInterval]; case 4: return [2 /*return*/]; } }); }); }; /** * @description Create a copy of the current context. Useful when you have long running operation and you do not want a context change to affect the operation */ Context.prototype.clone = function () { return new Context(this.rpc, this.signer, this.proto, this.config, this.forger, this._injector, this.packer); }; return Context; }()); var opHashFilter = function (op, filter) { return op.hash === filter.opHash; }; var sourceFilter = function (x, filter) { switch (x.kind) { case 'endorsement': return 'metadata' in x && x.metadata.delegate === filter.source; case 'activate_account': return 'metadata' in x && x.pkh === filter.source; default: return 'source' in x && x.source === filter.source; } }; var kindFilter = function (x, filter) { return 'kind' in x && x.kind === filter.kind; }; var destinationFilter = function (x, filter) { switch (x.kind) { case 'delegation': return x.delegate === filter.destination; case 'origination': if ('metadata' in x && 'operation_result' in x.metadata && 'originated_contracts' in x.metadata.operation_result && Array.isArray(x.metadata.operation_result.originated_contracts)) { return x.metadata.operation_result.originated_contracts.some(function (contract) { return contract === filter.destination; }); } break; case 'transaction': return x.destination === filter.destination; default: return false; } }; var evaluateOpFilter = function (op, filter) { if ('opHash' in filter) { return opHashFilter(op, filter); } else if ('source' in filter) { return sourceFilter(op, filter); } else if ('kind' in filter) { return kindFilter(op, filter); } else if ('destination' in filter) { return destinationFilter(op, filter); } return false; }; var evaluateExpression = function (op, exp) { if (Array.isArray(exp.and)) { return exp.and.every(function (x) { return evaluateFilter(op, x); }); } else if (Array.isArray(exp.or)) { return exp.or.some(function (x) { return evaluateFilter(op, x); }); } else { throw new Error('Filter expression must contains either and/or property'); } }; var evaluateFilter = function (op, filter) { var filters = []; if (!Array.isArray(filter)) { filters.push(filter); } else { filters.push.apply(filters, __spreadArray([], __read(filter))); } return filters.every(function (filterOrExp) { if ('and' in filterOrExp || 'or' in filterOrExp) { return evaluateExpression(op, filterOrExp); } else { return evaluateOpFilter(op, filterOrExp); } }); }; var ObservableSubscription = /** @class */ (function () { function ObservableSubscription(obs, shouldRetry, operatorFunction) { var _this = this; if (shouldRetry === void 0) { shouldRetry = false; } if (operatorFunction === void 0) { operatorFunction = retry(); } this.shouldRetry = shouldRetry; this.operatorFunction = operatorFunction; this.errorListeners = []; this.messageListeners = []; this.closeListeners = []; this.completed$ = new Subject(); obs .pipe(takeUntil(this.completed$), tap(function (data) { _this.call(_this.messageListeners, data); }, function (error) { _this.call(_this.errorListeners, error); }, function () { _this.call(_this.closeListeners); }), this.shouldRetry ? operatorFunction : tap(), catchError(function () { return NEVER; })) .subscribe(); } ObservableSubscription.prototype.call = function (listeners, value) { var e_1, _a; try { for (var listeners_1 = __values(listeners), listeners_1_1 = listeners_1.next(); !listeners_1_1.done; listeners_1_1 = listeners_1.next()) { var l = listeners_1_1.value; try { l(value); } catch (ex) { console.error(ex); } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (listeners_1_1 && !listeners_1_1.done && (_a = listeners_1.return)) _a.call(listeners_1); } finally { if (e_1) throw e_1.error; } } }; ObservableSubscription.prototype.remove = function (listeners, value) { var idx = listeners.indexOf(value); if (idx !== -1) { listeners.splice(idx, 1); } }; ObservableSubscription.prototype.on = function (type, cb) { switch (type) { case 'data': this.messageListeners.push(cb); break; case 'error': this.errorListeners.push(cb); break; case 'close': this.closeListeners.push(cb); break; default: throw new Error("Trying to register on an unsupported event: " + type); } }; ObservableSubscription.prototype.off = function (type, cb) { switch (type) { case 'data': this.remove(this.messageListeners, cb); break; case 'error': this.remove(this.errorListeners, cb); break; case 'close': this.remove(this.closeListeners, cb); break; default: throw new Error("Trying to unregister on an unsupported event: " + type); } }; ObservableSubscription.prototype.close = function () { this.completed$.next(); }; return ObservableSubscription; }()); var getLastBlock = function (context) { return from(context.rpc.getBlock()).pipe(first()); }; var applyFilter = function (filter) { return concatMap(function (block) { return new Observable(function (sub) { var e_1, _a, e_2, _b, e_3, _c; try { for (var _d = __values(block.operations), _e = _d.next(); !_e.done; _e = _d.next()) { var ops = _e.value; try { for (var ops_1 = (e_2 = void 0, __values(ops)), ops_1_1 = ops_1.next(); !ops_1_1.done; ops_1_1 = ops_1.next()) { var op = ops_1_1.value; try { for (var _f = (e_3 = void 0, __values(op.contents)), _g = _f.next(); !_g.done; _g = _f.next()) { var content = _g.value; if (evaluateFilter(__assign({ hash: op.hash }, content), filter)) { sub.next(__assign({ hash: op.hash }, content)); } } } catch (e_3_1) { e_3 = { error: e_3_1 }; } finally { try { if (_g && !_g.done && (_c = _f.return)) _c.call(_f); } finally { if (e_3) throw e_3.error; } } } } catch (e_2_1) { e_2 = { error: e_2_1 }; } finally { try { if (ops_1_1 && !ops_1_1.done && (_b = ops_1.return)) _b.call(ops_1); } finally { if (e_2) throw e_2.error; } } } } catch (e_1_1) { e_1 = { error: e_1_1 }; } finally { try { if (_e && !_e.done && (_a = _d.return)) _a.call(_d); } finally { if (e_1) throw e_1.error; } } sub.complete(); }); }); }; var PollingSubscribeProvider = /** @class */ (function () { function PollingSubscribeProvider(context, POLL_INTERVAL) { var _this = this; if (POLL_INTERVAL === void 0) { POLL_INTERVAL = 20000; } this.context = context; this.POLL_INTERVAL = POLL_INTERVAL; this.newBlock$ = timer(0, this.POLL_INTERVAL).pipe(map(function () { return _this.context; }), switchMap(getLastBlock), distinctUntilKeyChanged('hash'), publishReplay(), refCount()); } PollingSubscribeProvider.prototype.subscribe = function (_filter) { return new ObservableSubscription(this.newBlock$.pipe(pluck('hash')), this.context.config.shouldObservableSubscriptionRetry, this.context.config.observableSubscriptionRetryFunction); }; PollingSubscribeProvider.prototype.subscribeOperation = function (filter) { return new ObservableSubscription(this.newBlock$.pipe(applyFilter(filter)), this.context.config.shouldObservableSubscriptionRetry, this.context.config.observableSubscriptionRetryFunction); }; return PollingSubscribeProvider; }()); // IMPORTANT: THIS FILE IS AUTO GENERATED! DO NOT MANUALLY EDIT OR CHECKIN! /* tslint:disable */ var VERSION = { "commitHash": "88089857fb6e5f9a7ebcec072cd4dbea9b3e4572", "version": "9.2.0-stablelib.0" }; /* tslint:enable */ var ForgingMismatchError = /** @class */ (function () { function ForgingMismatchError(results) { this.results = results; this.name = 'ForgingMismatchError'; this.message = 'Forging mismatch error'; } return ForgingMismatchError; }()); var CompositeForger = /** @class */ (function () { function CompositeForger(forgers) { this.forgers = forgers; if (forgers.length === 0) { throw new Error('At least one forger must be specified'); } } CompositeForger.prototype.forge = function (_a) { var branch = _a.branch, contents = _a.contents; return __awaiter(this, void 0, void 0, function () { var results, lastResult, currentResult; return __generator(this, function (_b) { switch (_b.label) { case 0: return [4 /*yield*/, Promise.all(this.forgers.map(function (forger) { return forger.forge({ branch: branch, contents: contents }); }))]; case 1: results = _b.sent(); if (results.length === 0) { throw new Error('At least one forger must be specified'); } lastResult = results.pop(); while (results.length) { currentResult = results.pop(); if (currentResult !== lastResult) { throw new ForgingMismatchError([lastResult, currentResult]); } lastResult = currentResult; } return [2 /*return*/, lastResult]; } }); }); }; return CompositeForger; }()); var NoopParser = /** @class */ (function () { function NoopParser() { } NoopParser.prototype.prepareCodeOrigination = function (params) { return __awaiter(this, void 0, void 0, function () { return __generator(this, function (_a) { return [2 /*return*/, params]; }); }); }; return NoopParser; }()); var MichelCodecPacker = /** @class */ (function () { function MichelCodecPacker() { } MichelCodecPacker.prototype.packData = function (data) { return __awaiter(this, void 0, void 0, function () { var bytes; return __generator(this, function (_a) { bytes = packDataBytes(data.data, data.type).bytes; return [2 /*return*/, { packed: bytes }]; }); }); }; return MichelCodecPacker; }()); /** * @packageDocumentation * @module @taquito/taquito */ /** * @description Facade class that surfaces all of the libraries capability and allow it's configuration * * @param _rpc The RPC server to use */ var TezosToolkit = /** @class */ (function () { function TezosToolkit(_rpc) { this._rpc = _rpc; this._options = {}; this.format = format; if (typeof this._rpc === 'string') { this._rpcClient = new RpcClient(this._rpc); } else { this._rpcClient = this._rpc; } this._context = new Context(_rpc); this._wallet = new Wallet(this._context); this.setProvider({ rpc: this._rpcClient }); // tslint:disable-next-line: deprecation this.batch = this._context.batch.batch.bind(this._context.batch); } /** * @description Sets configuration on the Tezos Taquito instance. Allows user to choose which signer, rpc client, rpc url, forger and so forth * * @param options rpc url or rpcClient to use to interact with the Tezos network * * @example Tezos.setProvider({rpc: 'https://api.tez.ie/rpc/mainnet', signer: new InMemorySigner.fromSecretKey(“edsk...”)}) * @example Tezos.setProvider({ config: { confirmationPollingTimeoutSecond: 300 }}) * */ TezosToolkit.prototype.setProvider = function (_a) { var rpc = _a.rpc, stream = _a.stream, signer = _a.signer, protocol = _a.protocol, config = _a.config, forger = _a.forger, wallet = _a.wallet, packer = _a.packer; this.setRpcProvider(rpc); this.setStreamProvider(stream); this.setSignerProvider(signer); this.setForgerProvider(forger); this.setWalletProvider(wallet); this.setPackerProvider(packer); this._context.proto = protocol; this._context.config = config; }; /** * @description Sets signer provider on the Tezos Taquito instance. * * @param options signer to use to interact with the Tezos network * * @example Tezos.setSignerProvider(new InMemorySigner.fromSecretKey('edsk...')) * */ TezosToolkit.prototype.setSignerProvider = function (signer) { if (!this._options.signer && typeof signer === 'undefined') { this._context.signer = new NoopSigner(); this._options.signer = signer; } else if (typeof signer !== 'undefined') { this._context.signer = signer; this._options.signer = signer; } }; /** * @description Sets rpc provider on the Tezos Taquito instance * * @param options rpc url or rpcClient to use to interact with the Tezos network * * @example Tezos.setRpcProvider('https://api.tez.ie/rpc/mainnet') * */ TezosToolkit.prototype.setRpcProvider = function (rpc) { if (typeof rpc === 'string') { this._rpcClient = new RpcClient(rpc); } else if (rpc instanceof RpcClient) { this._rpcClient = rpc; } /* else if (this._options.rpc === undefined) { this._rpcClient = new RpcClient(); } */ this._options.rpc = this._rpcClient; this._context.rpc = this._rpcClient; }; /** * @description Sets forger provider on the Tezos Taquito instance * * @param options forger to use to interact with the Tezos network * * @example Tezos.setForgerProvider(localForger) * */ TezosToolkit.prototype.setForgerProvider = function (forger) { var f = typeof forger === 'undefined' ? this.getFactory(RpcForger)() : forger; this._options.forger = f; this._context.forger = f; }; /** * @description Sets stream provider on the Tezos Taquito instance * * @param options stream to use to interact with the Tezos network * * @example Tezos.setStreamProvider(...) * */ TezosToolkit.prototype.setStreamProvider = function (stream) { if (typeof stream === 'string') { this._stream = new PollingSubscribeProvider(new Context(new RpcClient(stream))); } else if (typeof stream !== 'undefined') { this._stream = stream; } else if (this._options.stream === undefined) { this._stream = this.getFactory(PollingSubscribeProvider)(); } this._options.stream = stream; }; /** * @description Sets wallet provider on the Tezos Taquito instance * * @param options wallet to use to interact with the Tezos network * * @example Tezos.setWalletProvider(...) * */ TezosToolkit.prototype.setWalletProvider = function (wallet) { if (!this._options.wallet && typeof wallet === 'undefined') { var w = this.getFactory(LegacyWalletProvider)(); this._options.wallet = w; this._context.walletProvider = w; } else if (typeof wallet !== 'undefined') { this._options.wallet = wallet; this._context.walletProvider = wallet; } }; /** * @description Sets Packer provider on the Tezos Taquito instance * * @param options packer to use to interact with the Tezos network * * @example Tezos.setPackerProvider(new MichelCodecPacker()) * */ TezosToolkit.prototype.setPackerProvider = function (packer) { var p = typeof packer === 'undefined' ? this.getFactory(RpcPacker)() : packer; this._options.packer = p; this._context.packer = p; }; Object.defineProperty(TezosToolkit.prototype, "tz", { /** * @description Provide access to tezos account management */ get: function () { return this._context.tz; }, enumerable: false, configurable: true }); Object.defineProperty(TezosToolkit.prototype, "contract", { /** * @description Provide access to smart contract utilities */ get: function () { return this._context.contract; }, enumerable: false, configurable: true }); Object.defineProperty(TezosToolkit.prototype, "wallet", { get: function () { return this._wallet; }, enumerable: false, configurable: true }); Object.defineProperty(TezosToolkit.prototype, "operation", { get: function () { return this._context.operationFactory; }, enumerable: false, configurable: true }); Object.defineProperty(TezosToolkit.prototype, "estimate", { /** * @description Provide access to operation estimation utilities */ get: function () { return this._context.estimate; }, enumerable: false, configurable: true }); Object.defineProperty(TezosToolkit.prototype, "stream", { /** * @description Provide access to streaming utilities backed by an streamer implementation */ get: function () { return this._stream; }, enumerable: false, configurable: true }); Object.defineProperty(TezosToolkit.prototype, "rpc", { /** * @description Provide access to the currently used rpc client */ get: function () { return this._context.rpc; }, enumerable: false, configurable: true }); Object.defineProperty(TezosToolkit.prototype, "signer", { /** * @description Provide access to the currently used signer */ get: function () { return this._context.signer; }, enumerable: false, configurable: true }); /** * @description Allow to add a module to the TezosToolkit instance. This method adds the appropriate Providers(s) required by the module to the internal context. * * @param module extension to add to the TezosToolkit instance * * @example Tezos.addExtension(new Tzip16Module()); */ TezosToolkit.prototype.addExtension = function (module) { module.configureContext(this._context); }; TezosToolkit.prototype.getFactory = function (ctor) { var _this = this; return function () { var args = []; for (var _i = 0; _i < arguments.length; _i++) { args[_i] = arguments[_i]; } return new (ctor.bind.apply(ctor, __spreadArray([void 0, _this._context], __read(args))))(); }; }; /** * @description Gets an object containing the version of Taquito library and git sha of the commit this library is compiled from */ TezosToolkit.prototype.getVersionInfo = function () { return VERSION; }; return TezosToolkit; }()); export { BatchOperation, BigMapAbstraction, ChainIds, CompositeForger, Context, ContractAbstraction, ContractMethod, ContractView, DEFAULT_FEE, DEFAULT_GAS_LIMIT, DEFAULT_STORAGE_LIMIT, DefaultLambdaAddresses, DelegateOperation, DelegationWalletOperation, InvalidCodeParameter, InvalidDelegationSource, InvalidInitParameter, InvalidParameterError, LegacyWalletProvider, MANAGER_LAMBDA, MichelCodecPacker, MichelCodecParser, MissedBlockDuringConfirmationError, NoopParser, Operation, OperationBatch, OriginationOperation, OriginationWalletOperation, PollingSubscribeProvider, Protocols, RpcForger, RpcPacker, TezosOperationError, TezosPreapplyFailureError, TezosToolkit, TransactionOperation, TransactionWalletOperation, UndefinedLambdaContractError, VIEW_LAMBDA, Wallet, WalletOperation, WalletOperationBatch, compose, createOriginationOperation, createRegisterDelegateOperation, createRevealOperation, createSetDelegateOperation, createTransferOperation, defaultConfig, protocols }; //# sourceMappingURL=taquito.es5.js.map
var _typeof = typeof Symbol === "function" && typeof Symbol.iterator === "symbol" ? function (obj) { return typeof obj; } : function (obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; /* Tabulator v4.5.1 (c) Oliver Folkerd */ var Edit = function Edit(table) { this.table = table; //hold Tabulator object this.currentCell = false; //hold currently editing cell this.mouseClick = false; //hold mousedown state to prevent click binding being overriden by editor opening this.recursionBlock = false; //prevent focus recursion this.invalidEdit = false; }; //initialize column editor Edit.prototype.initializeColumn = function (column) { var self = this, config = { editor: false, blocked: false, check: column.definition.editable, params: column.definition.editorParams || {} }; //set column editor switch (_typeof(column.definition.editor)) { case "string": if (column.definition.editor === "tick") { column.definition.editor = "tickCross"; console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); } if (self.editors[column.definition.editor]) { config.editor = self.editors[column.definition.editor]; } else { console.warn("Editor Error - No such editor found: ", column.definition.editor); } break; case "function": config.editor = column.definition.editor; break; case "boolean": if (column.definition.editor === true) { if (typeof column.definition.formatter !== "function") { if (column.definition.formatter === "tick") { column.definition.formatter = "tickCross"; console.warn("DEPRECATION WARNING - the tick editor has been deprecated, please use the tickCross editor"); } if (self.editors[column.definition.formatter]) { config.editor = self.editors[column.definition.formatter]; } else { config.editor = self.editors["input"]; } } else { console.warn("Editor Error - Cannot auto lookup editor for a custom formatter: ", column.definition.formatter); } } break; } if (config.editor) { column.modules.edit = config; } }; Edit.prototype.getCurrentCell = function () { return this.currentCell ? this.currentCell.getComponent() : false; }; Edit.prototype.clearEditor = function () { var cell = this.currentCell, cellEl; this.invalidEdit = false; if (cell) { this.currentCell = false; cellEl = cell.getElement(); cellEl.classList.remove("tabulator-validation-fail"); cellEl.classList.remove("tabulator-editing"); while (cellEl.firstChild) { cellEl.removeChild(cellEl.firstChild); }cell.row.getElement().classList.remove("tabulator-row-editing"); } }; Edit.prototype.cancelEdit = function () { if (this.currentCell) { var cell = this.currentCell; var component = this.currentCell.getComponent(); this.clearEditor(); cell.setValueActual(cell.getValue()); if (cell.column.cellEvents.cellEditCancelled) { cell.column.cellEvents.cellEditCancelled.call(this.table, component); } this.table.options.cellEditCancelled.call(this.table, component); } }; //return a formatted value for a cell Edit.prototype.bindEditor = function (cell) { var self = this, element = cell.getElement(); element.setAttribute("tabindex", 0); element.addEventListener("click", function (e) { if (!element.classList.contains("tabulator-editing")) { element.focus(); } }); element.addEventListener("mousedown", function (e) { self.mouseClick = true; }); element.addEventListener("focus", function (e) { if (!self.recursionBlock) { self.edit(cell, e, false); } }); }; Edit.prototype.focusCellNoEvent = function (cell, block) { this.recursionBlock = true; if (!(block && this.table.browser === "ie")) { cell.getElement().focus(); } this.recursionBlock = false; }; Edit.prototype.editCell = function (cell, forceEdit) { this.focusCellNoEvent(cell); this.edit(cell, false, forceEdit); }; Edit.prototype.edit = function (cell, e, forceEdit) { var self = this, allowEdit = true, rendered = function rendered() {}, element = cell.getElement(), cellEditor, component, params; //prevent editing if another cell is refusing to leave focus (eg. validation fail) if (this.currentCell) { if (!this.invalidEdit) { this.cancelEdit(); } return; } //handle successfull value change function success(value) { if (self.currentCell === cell) { var valid = true; if (cell.column.modules.validate && self.table.modExists("validate")) { valid = self.table.modules.validate.validate(cell.column.modules.validate, cell.getComponent(), value); } if (valid === true) { self.clearEditor(); cell.setValue(value, true); if (self.table.options.dataTree && self.table.modExists("dataTree")) { self.table.modules.dataTree.checkForRestyle(cell); } return true; } else { self.invalidEdit = true; element.classList.add("tabulator-validation-fail"); self.focusCellNoEvent(cell, true); rendered(); self.table.options.validationFailed.call(self.table, cell.getComponent(), value, valid); return false; } } else { // console.warn("Edit Success Error - cannot call success on a cell that is no longer being edited"); } } //handle aborted edit function cancel() { if (self.currentCell === cell) { self.cancelEdit(); if (self.table.options.dataTree && self.table.modExists("dataTree")) { self.table.modules.dataTree.checkForRestyle(cell); } } else { // console.warn("Edit Success Error - cannot call cancel on a cell that is no longer being edited"); } } function onRendered(callback) { rendered = callback; } if (!cell.column.modules.edit.blocked) { if (e) { e.stopPropagation(); } switch (_typeof(cell.column.modules.edit.check)) { case "function": allowEdit = cell.column.modules.edit.check(cell.getComponent()); break; case "boolean": allowEdit = cell.column.modules.edit.check; break; } if (allowEdit || forceEdit) { self.cancelEdit(); self.currentCell = cell; component = cell.getComponent(); if (this.mouseClick) { this.mouseClick = false; if (cell.column.cellEvents.cellClick) { cell.column.cellEvents.cellClick.call(this.table, e, component); } } if (cell.column.cellEvents.cellEditing) { cell.column.cellEvents.cellEditing.call(this.table, component); } self.table.options.cellEditing.call(this.table, component); params = typeof cell.column.modules.edit.params === "function" ? cell.column.modules.edit.params(component) : cell.column.modules.edit.params; cellEditor = cell.column.modules.edit.editor.call(self, component, onRendered, success, cancel, params); //if editor returned, add to DOM, if false, abort edit if (cellEditor !== false) { if (cellEditor instanceof Node) { element.classList.add("tabulator-editing"); cell.row.getElement().classList.add("tabulator-row-editing"); while (element.firstChild) { element.removeChild(element.firstChild); }element.appendChild(cellEditor); //trigger onRendered Callback rendered(); //prevent editing from triggering rowClick event var children = element.children; for (var i = 0; i < children.length; i++) { children[i].addEventListener("click", function (e) { e.stopPropagation(); }); } } else { console.warn("Edit Error - Editor should return an instance of Node, the editor returned:", cellEditor); element.blur(); return false; } } else { element.blur(); return false; } return true; } else { this.mouseClick = false; element.blur(); return false; } } else { this.mouseClick = false; element.blur(); return false; } }; //default data editors Edit.prototype.editors = { //input element input: function input(cell, onRendered, success, cancel, editorParams) { //create and style input var cellValue = cell.getValue(), input = document.createElement("input"); input.setAttribute("type", editorParams.search ? "search" : "text"); input.style.padding = "4px"; input.style.width = "100%"; input.style.boxSizing = "border-box"; if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { for (var key in editorParams.elementAttributes) { if (key.charAt(0) == "+") { key = key.slice(1); input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); } else { input.setAttribute(key, editorParams.elementAttributes[key]); } } } input.value = typeof cellValue !== "undefined" ? cellValue : ""; onRendered(function () { input.focus(); input.style.height = "100%"; }); function onChange(e) { if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value != cellValue) { if (success(input.value)) { cellValue = input.value; //persist value if successfully validated incase editor is used as header filter } } else { cancel(); } } //submit new value on blur or change input.addEventListener("change", onChange); input.addEventListener("blur", onChange); //submit new value on enter input.addEventListener("keydown", function (e) { switch (e.keyCode) { case 13: onChange(e); break; case 27: cancel(); break; } }); return input; }, //resizable text area element textarea: function textarea(cell, onRendered, success, cancel, editorParams) { var self = this, cellValue = cell.getValue(), vertNav = editorParams.verticalNavigation || "hybrid", value = String(cellValue !== null && typeof cellValue !== "undefined" ? cellValue : ""), count = (value.match(/(?:\r\n|\r|\n)/g) || []).length + 1, input = document.createElement("textarea"), scrollHeight = 0; //create and style input input.style.display = "block"; input.style.padding = "2px"; input.style.height = "100%"; input.style.width = "100%"; input.style.boxSizing = "border-box"; input.style.whiteSpace = "pre-wrap"; input.style.resize = "none"; if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { for (var key in editorParams.elementAttributes) { if (key.charAt(0) == "+") { key = key.slice(1); input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); } else { input.setAttribute(key, editorParams.elementAttributes[key]); } } } input.value = value; onRendered(function () { input.focus(); input.style.height = "100%"; }); function onChange(e) { if ((cellValue === null || typeof cellValue === "undefined") && input.value !== "" || input.value != cellValue) { if (success(input.value)) { cellValue = input.value; //persist value if successfully validated incase editor is used as header filter } setTimeout(function () { cell.getRow().normalizeHeight(); }, 300); } else { cancel(); } } //submit new value on blur or change input.addEventListener("change", onChange); input.addEventListener("blur", onChange); input.addEventListener("keyup", function () { input.style.height = ""; var heightNow = input.scrollHeight; input.style.height = heightNow + "px"; if (heightNow != scrollHeight) { scrollHeight = heightNow; cell.getRow().normalizeHeight(); } }); input.addEventListener("keydown", function (e) { switch (e.keyCode) { case 27: cancel(); break; case 38: //up arrow if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart) { e.stopImmediatePropagation(); e.stopPropagation(); } break; case 40: //down arrow if (vertNav == "editor" || vertNav == "hybrid" && input.selectionStart !== input.value.length) { e.stopImmediatePropagation(); e.stopPropagation(); } break; } }); return input; }, //input element with type of number number: function number(cell, onRendered, success, cancel, editorParams) { var cellValue = cell.getValue(), vertNav = editorParams.verticalNavigation || "editor", input = document.createElement("input"); input.setAttribute("type", "number"); if (typeof editorParams.max != "undefined") { input.setAttribute("max", editorParams.max); } if (typeof editorParams.min != "undefined") { input.setAttribute("min", editorParams.min); } if (typeof editorParams.step != "undefined") { input.setAttribute("step", editorParams.step); } //create and style input input.style.padding = "4px"; input.style.width = "100%"; input.style.boxSizing = "border-box"; if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { for (var key in editorParams.elementAttributes) { if (key.charAt(0) == "+") { key = key.slice(1); input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); } else { input.setAttribute(key, editorParams.elementAttributes[key]); } } } input.value = cellValue; var blurFunc = function blurFunc(e) { onChange(); }; onRendered(function () { //submit new value on blur input.removeEventListener("blur", blurFunc); input.focus(); input.style.height = "100%"; //submit new value on blur input.addEventListener("blur", blurFunc); }); function onChange() { var value = input.value; if (!isNaN(value) && value !== "") { value = Number(value); } if (value != cellValue) { if (success(value)) { cellValue = value; //persist value if successfully validated incase editor is used as header filter } } else { cancel(); } } //submit new value on enter input.addEventListener("keydown", function (e) { switch (e.keyCode) { case 13: // case 9: onChange(); break; case 27: cancel(); break; case 38: //up arrow case 40: //down arrow if (vertNav == "editor") { e.stopImmediatePropagation(); e.stopPropagation(); } break; } }); return input; }, //input element with type of number range: function range(cell, onRendered, success, cancel, editorParams) { var cellValue = cell.getValue(), input = document.createElement("input"); input.setAttribute("type", "range"); if (typeof editorParams.max != "undefined") { input.setAttribute("max", editorParams.max); } if (typeof editorParams.min != "undefined") { input.setAttribute("min", editorParams.min); } if (typeof editorParams.step != "undefined") { input.setAttribute("step", editorParams.step); } //create and style input input.style.padding = "4px"; input.style.width = "100%"; input.style.boxSizing = "border-box"; if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { for (var key in editorParams.elementAttributes) { if (key.charAt(0) == "+") { key = key.slice(1); input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); } else { input.setAttribute(key, editorParams.elementAttributes[key]); } } } input.value = cellValue; onRendered(function () { input.focus(); input.style.height = "100%"; }); function onChange() { var value = input.value; if (!isNaN(value) && value !== "") { value = Number(value); } if (value != cellValue) { if (success(value)) { cellValue = value; //persist value if successfully validated incase editor is used as header filter } } else { cancel(); } } //submit new value on blur input.addEventListener("blur", function (e) { onChange(); }); //submit new value on enter input.addEventListener("keydown", function (e) { switch (e.keyCode) { case 13: case 9: onChange(); break; case 27: cancel(); break; } }); return input; }, //select select: function select(cell, onRendered, success, cancel, editorParams) { var self = this, cellEl = cell.getElement(), initialValue = cell.getValue(), vertNav = editorParams.verticalNavigation || "editor", initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? initialValue : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : "", input = document.createElement("input"), listEl = document.createElement("div"), dataItems = [], displayItems = [], currentItem = {}, blurable = true; this.table.rowManager.element.addEventListener("scroll", cancelItem); if (Array.isArray(editorParams) || !Array.isArray(editorParams) && (typeof editorParams === "undefined" ? "undefined" : _typeof(editorParams)) === "object" && !editorParams.values) { console.warn("DEPRECATION WANRING - values for the select editor must now be passed into the values property of the editorParams object, not as the editorParams object"); editorParams = { values: editorParams }; } function getUniqueColumnValues(field) { var output = {}, data = self.table.getData(), column; if (field) { column = self.table.columnManager.getColumnByField(field); } else { column = cell.getColumn()._getSelf(); } if (column) { data.forEach(function (row) { var val = column.getFieldValue(row); if (val !== null && typeof val !== "undefined" && val !== "") { output[val] = true; } }); if (editorParams.sortValuesList) { if (editorParams.sortValuesList == "asc") { output = Object.keys(output).sort(); } else { output = Object.keys(output).sort().reverse(); } } else { output = Object.keys(output); } } else { console.warn("unable to find matching column to create select lookup list:", field); } return output; } function parseItems(inputValues, curentValue) { var dataList = []; var displayList = []; function processComplexListItem(item) { var item = { label: editorParams.listItemFormatter ? editorParams.listItemFormatter(item.value, item.label) : item.label, value: item.value, element: false }; if (item.value === curentValue || !isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue)) { setCurrentItem(item); } dataList.push(item); displayList.push(item); return item; } if (typeof inputValues == "function") { inputValues = inputValues(cell); } if (Array.isArray(inputValues)) { inputValues.forEach(function (value) { var item; if ((typeof value === "undefined" ? "undefined" : _typeof(value)) === "object") { if (value.options) { item = { label: value.label, group: true, element: false }; displayList.push(item); value.options.forEach(function (item) { processComplexListItem(item); }); } else { processComplexListItem(value); } } else { item = { label: editorParams.listItemFormatter ? editorParams.listItemFormatter(value, value) : value, value: value, element: false }; if (item.value === curentValue || !isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue)) { setCurrentItem(item); } dataList.push(item); displayList.push(item); } }); } else { for (var key in inputValues) { var item = { label: editorParams.listItemFormatter ? editorParams.listItemFormatter(key, inputValues[key]) : inputValues[key], value: key, element: false }; if (item.value === curentValue || !isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue)) { setCurrentItem(item); } dataList.push(item); displayList.push(item); } } dataItems = dataList; displayItems = displayList; fillList(); } function fillList() { while (listEl.firstChild) { listEl.removeChild(listEl.firstChild); }displayItems.forEach(function (item) { var el = item.element; if (!el) { if (item.group) { el = document.createElement("div"); el.classList.add("tabulator-edit-select-list-group"); el.tabIndex = 0; el.innerHTML = item.label === "" ? "&nbsp;" : item.label; } else { el = document.createElement("div"); el.classList.add("tabulator-edit-select-list-item"); el.tabIndex = 0; el.innerHTML = item.label === "" ? "&nbsp;" : item.label; el.addEventListener("click", function () { setCurrentItem(item); chooseItem(); }); if (item === currentItem) { el.classList.add("active"); } } el.addEventListener("mousedown", function () { blurable = false; setTimeout(function () { blurable = true; }, 10); }); item.element = el; } listEl.appendChild(el); }); } function setCurrentItem(item) { if (currentItem && currentItem.element) { currentItem.element.classList.remove("active"); } currentItem = item; input.value = item.label === "&nbsp;" ? "" : item.label; if (item.element) { item.element.classList.add("active"); } } function chooseItem() { hideList(); if (initialValue !== currentItem.value) { initialValue = currentItem.value; success(currentItem.value); } else { cancel(); } } function cancelItem() { hideList(); cancel(); } function showList() { if (!listEl.parentNode) { if (editorParams.values === true) { parseItems(getUniqueColumnValues(), initialDisplayValue); } else if (typeof editorParams.values === "string") { parseItems(getUniqueColumnValues(editorParams.values), initialDisplayValue); } else { parseItems(editorParams.values || [], initialDisplayValue); } var offset = Tabulator.prototype.helpers.elOffset(cellEl); listEl.style.minWidth = cellEl.offsetWidth + "px"; listEl.style.top = offset.top + cellEl.offsetHeight + "px"; listEl.style.left = offset.left + "px"; document.body.appendChild(listEl); } } function hideList() { if (listEl.parentNode) { listEl.parentNode.removeChild(listEl); } removeScrollListener(); } function removeScrollListener() { self.table.rowManager.element.removeEventListener("scroll", cancelItem); } //style input input.setAttribute("type", "text"); input.style.padding = "4px"; input.style.width = "100%"; input.style.boxSizing = "border-box"; input.style.cursor = "default"; input.readOnly = this.currentCell != false; if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { for (var key in editorParams.elementAttributes) { if (key.charAt(0) == "+") { key = key.slice(1); input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); } else { input.setAttribute(key, editorParams.elementAttributes[key]); } } } input.value = typeof initialValue !== "undefined" || initialValue === null ? initialValue : ""; // if(editorParams.values === true){ // parseItems(getUniqueColumnValues(), initialValue); // }else if(typeof editorParams.values === "string"){ // parseItems(getUniqueColumnValues(editorParams.values), initialValue); // }else{ // parseItems(editorParams.values || [], initialValue); // } //allow key based navigation input.addEventListener("keydown", function (e) { var index; switch (e.keyCode) { case 38: //up arrow index = dataItems.indexOf(currentItem); if (vertNav == "editor" || vertNav == "hybrid" && index) { e.stopImmediatePropagation(); e.stopPropagation(); e.preventDefault(); if (index > 0) { setCurrentItem(dataItems[index - 1]); } } break; case 40: //down arrow index = dataItems.indexOf(currentItem); if (vertNav == "editor" || vertNav == "hybrid" && index < dataItems.length - 1) { e.stopImmediatePropagation(); e.stopPropagation(); e.preventDefault(); if (index < dataItems.length - 1) { if (index == -1) { setCurrentItem(dataItems[0]); } else { setCurrentItem(dataItems[index + 1]); } } } break; case 37: //left arrow case 39: //right arrow e.stopImmediatePropagation(); e.stopPropagation(); e.preventDefault(); break; case 13: //enter chooseItem(); break; case 27: //escape cancelItem(); break; } }); input.addEventListener("blur", function (e) { if (blurable) { cancelItem(); } }); input.addEventListener("focus", function (e) { showList(); }); //style list element listEl = document.createElement("div"); listEl.classList.add("tabulator-edit-select-list"); onRendered(function () { input.style.height = "100%"; input.focus(); }); return input; }, //autocomplete autocomplete: function autocomplete(cell, onRendered, success, cancel, editorParams) { var self = this, cellEl = cell.getElement(), initialValue = cell.getValue(), vertNav = editorParams.verticalNavigation || "editor", initialDisplayValue = typeof initialValue !== "undefined" || initialValue === null ? initialValue : typeof editorParams.defaultValue !== "undefined" ? editorParams.defaultValue : "", input = document.createElement("input"), listEl = document.createElement("div"), allItems = [], displayItems = [], values = [], currentItem = {}, blurable = true; this.table.rowManager.element.addEventListener("scroll", cancelItem); function getUniqueColumnValues(field) { var output = {}, data = self.table.getData(), column; if (field) { column = self.table.columnManager.getColumnByField(field); } else { column = cell.getColumn()._getSelf(); } if (column) { data.forEach(function (row) { var val = column.getFieldValue(row); if (val !== null && typeof val !== "undefined" && val !== "") { output[val] = true; } }); if (editorParams.sortValuesList) { if (editorParams.sortValuesList == "asc") { output = Object.keys(output).sort(); } else { output = Object.keys(output).sort().reverse(); } } else { output = Object.keys(output); } } else { console.warn("unable to find matching column to create autocomplete lookup list:", field); } return output; } function parseItems(inputValues, curentValue) { var itemList = []; if (Array.isArray(inputValues)) { inputValues.forEach(function (value) { var item = { title: editorParams.listItemFormatter ? editorParams.listItemFormatter(value, value) : value, value: value, element: false }; if (item.value === curentValue || !isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue)) { setCurrentItem(item); } itemList.push(item); }); } else { for (var key in inputValues) { var item = { title: editorParams.listItemFormatter ? editorParams.listItemFormatter(key, inputValues[key]) : inputValues[key], value: key, element: false }; if (item.value === curentValue || !isNaN(parseFloat(item.value)) && !isNaN(parseFloat(item.value)) && parseFloat(item.value) === parseFloat(curentValue)) { setCurrentItem(item); } itemList.push(item); } } if (editorParams.searchFunc) { itemList.forEach(function (item) { item.search = { title: item.title, value: item.value }; }); } allItems = itemList; } function filterList(term, intialLoad) { var matches = [], searchObjs = [], searchResults = []; if (editorParams.searchFunc) { allItems.forEach(function (item) { searchObjs.push(item.search); }); searchResults = editorParams.searchFunc(term, searchObjs); searchResults.forEach(function (result) { var match = allItems.find(function (item) { return item.search === result; }); if (match) { matches.push(match); } }); } else { if (term === "") { if (editorParams.showListOnEmpty) { allItems.forEach(function (item) { matches.push(item); }); } } else { allItems.forEach(function (item) { if (item.value !== null || typeof item.value !== "undefined") { if (String(item.value).toLowerCase().indexOf(String(term).toLowerCase()) > -1 || String(item.title).toLowerCase().indexOf(String(term).toLowerCase()) > -1) { matches.push(item); } } }); } } displayItems = matches; fillList(intialLoad); } function fillList(intialLoad) { var current = false; while (listEl.firstChild) { listEl.removeChild(listEl.firstChild); }displayItems.forEach(function (item) { var el = item.element; if (!el) { el = document.createElement("div"); el.classList.add("tabulator-edit-select-list-item"); el.tabIndex = 0; el.innerHTML = item.title; el.addEventListener("click", function () { setCurrentItem(item); chooseItem(); }); el.addEventListener("mousedown", function () { blurable = false; setTimeout(function () { blurable = true; }, 10); }); item.element = el; if (intialLoad && item.value == initialValue) { input.value = item.title; item.element.classList.add("active"); current = true; } if (item === currentItem) { item.element.classList.add("active"); current = true; } } listEl.appendChild(el); }); if (!current) { setCurrentItem(false); } } function setCurrentItem(item, showInputValue) { if (currentItem && currentItem.element) { currentItem.element.classList.remove("active"); } currentItem = item; if (item && item.element) { item.element.classList.add("active"); } } function chooseItem() { hideList(); if (currentItem) { if (initialValue !== currentItem.value) { initialValue = currentItem.value; input.value = currentItem.title; success(currentItem.value); } else { cancel(); } } else { if (editorParams.freetext) { initialValue = input.value; success(input.value); } else { if (editorParams.allowEmpty && input.value === "") { initialValue = input.value; success(input.value); } else { cancel(); } } } } function cancelItem() { hideList(); cancel(); } function showList() { if (!listEl.parentNode) { while (listEl.firstChild) { listEl.removeChild(listEl.firstChild); }if (editorParams.values === true) { values = getUniqueColumnValues(); } else if (typeof editorParams.values === "string") { values = getUniqueColumnValues(editorParams.values); } else { values = editorParams.values || []; } parseItems(values, initialValue); var offset = Tabulator.prototype.helpers.elOffset(cellEl); listEl.style.minWidth = cellEl.offsetWidth + "px"; listEl.style.top = offset.top + cellEl.offsetHeight + "px"; listEl.style.left = offset.left + "px"; document.body.appendChild(listEl); } } function hideList() { if (listEl.parentNode) { listEl.parentNode.removeChild(listEl); } removeScrollListener(); } function removeScrollListener() { self.table.rowManager.element.removeEventListener("scroll", cancelItem); } //style input input.setAttribute("type", "search"); input.style.padding = "4px"; input.style.width = "100%"; input.style.boxSizing = "border-box"; if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { for (var key in editorParams.elementAttributes) { if (key.charAt(0) == "+") { key = key.slice(1); input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); } else { input.setAttribute(key, editorParams.elementAttributes[key]); } } } //allow key based navigation input.addEventListener("keydown", function (e) { var index; switch (e.keyCode) { case 38: //up arrow index = displayItems.indexOf(currentItem); if (vertNav == "editor" || vertNav == "hybrid" && index) { e.stopImmediatePropagation(); e.stopPropagation(); e.preventDefault(); if (index > 0) { setCurrentItem(displayItems[index - 1]); } else { setCurrentItem(false); } } break; case 40: //down arrow index = displayItems.indexOf(currentItem); if (vertNav == "editor" || vertNav == "hybrid" && index < displayItems.length - 1) { e.stopImmediatePropagation(); e.stopPropagation(); e.preventDefault(); if (index < displayItems.length - 1) { if (index == -1) { setCurrentItem(displayItems[0]); } else { setCurrentItem(displayItems[index + 1]); } } } break; case 37: //left arrow case 39: //right arrow e.stopImmediatePropagation(); e.stopPropagation(); e.preventDefault(); break; case 13: //enter chooseItem(); break; case 27: //escape cancelItem(); break; case 36: //home case 35: //end //prevent table navigation while using input element e.stopImmediatePropagation(); break; } }); input.addEventListener("keyup", function (e) { switch (e.keyCode) { case 38: //up arrow case 37: //left arrow case 39: //up arrow case 40: //right arrow case 13: //enter case 27: //escape break; default: filterList(input.value); } }); input.addEventListener("search", function (e) { filterList(input.value); }); input.addEventListener("blur", function (e) { if (blurable) { chooseItem(); } }); input.addEventListener("focus", function (e) { var value = initialDisplayValue; showList(); input.value = value; filterList(value, true); }); //style list element listEl = document.createElement("div"); listEl.classList.add("tabulator-edit-select-list"); onRendered(function () { input.style.height = "100%"; input.focus(); }); return input; }, //start rating star: function star(cell, onRendered, success, cancel, editorParams) { var self = this, element = cell.getElement(), value = cell.getValue(), maxStars = element.getElementsByTagName("svg").length || 5, size = element.getElementsByTagName("svg")[0] ? element.getElementsByTagName("svg")[0].getAttribute("width") : 14, stars = [], starsHolder = document.createElement("div"), star = document.createElementNS('http://www.w3.org/2000/svg', "svg"); //change star type function starChange(val) { stars.forEach(function (star, i) { if (i < val) { if (self.table.browser == "ie") { star.setAttribute("class", "tabulator-star-active"); } else { star.classList.replace("tabulator-star-inactive", "tabulator-star-active"); } star.innerHTML = '<polygon fill="#488CE9" stroke="#014AAE" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>'; } else { if (self.table.browser == "ie") { star.setAttribute("class", "tabulator-star-inactive"); } else { star.classList.replace("tabulator-star-active", "tabulator-star-inactive"); } star.innerHTML = '<polygon fill="#010155" stroke="#686868" stroke-width="37.6152" stroke-linecap="round" stroke-linejoin="round" stroke-miterlimit="10" points="259.216,29.942 330.27,173.919 489.16,197.007 374.185,309.08 401.33,467.31 259.216,392.612 117.104,467.31 144.25,309.08 29.274,197.007 188.165,173.919 "/>'; } }); } //build stars function buildStar(i) { var starHolder = document.createElement("span"); var nextStar = star.cloneNode(true); stars.push(nextStar); starHolder.addEventListener("mouseenter", function (e) { e.stopPropagation(); e.stopImmediatePropagation(); starChange(i); }); starHolder.addEventListener("mousemove", function (e) { e.stopPropagation(); e.stopImmediatePropagation(); }); starHolder.addEventListener("click", function (e) { e.stopPropagation(); e.stopImmediatePropagation(); success(i); }); starHolder.appendChild(nextStar); starsHolder.appendChild(starHolder); } //handle keyboard navigation value change function changeValue(val) { value = val; starChange(val); } //style cell element.style.whiteSpace = "nowrap"; element.style.overflow = "hidden"; element.style.textOverflow = "ellipsis"; //style holding element starsHolder.style.verticalAlign = "middle"; starsHolder.style.display = "inline-block"; starsHolder.style.padding = "4px"; //style star star.setAttribute("width", size); star.setAttribute("height", size); star.setAttribute("viewBox", "0 0 512 512"); star.setAttribute("xml:space", "preserve"); star.style.padding = "0 1px"; if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { for (var key in editorParams.elementAttributes) { if (key.charAt(0) == "+") { key = key.slice(1); starsHolder.setAttribute(key, starsHolder.getAttribute(key) + editorParams.elementAttributes["+" + key]); } else { starsHolder.setAttribute(key, editorParams.elementAttributes[key]); } } } //create correct number of stars for (var i = 1; i <= maxStars; i++) { buildStar(i); } //ensure value does not exceed number of stars value = Math.min(parseInt(value), maxStars); // set initial styling of stars starChange(value); starsHolder.addEventListener("mousemove", function (e) { starChange(0); }); starsHolder.addEventListener("click", function (e) { success(0); }); element.addEventListener("blur", function (e) { cancel(); }); //allow key based navigation element.addEventListener("keydown", function (e) { switch (e.keyCode) { case 39: //right arrow changeValue(value + 1); break; case 37: //left arrow changeValue(value - 1); break; case 13: //enter success(value); break; case 27: //escape cancel(); break; } }); return starsHolder; }, //draggable progress bar progress: function progress(cell, onRendered, success, cancel, editorParams) { var element = cell.getElement(), max = typeof editorParams.max === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("max") || 100 : editorParams.max, min = typeof editorParams.min === "undefined" ? element.getElementsByTagName("div")[0].getAttribute("min") || 0 : editorParams.min, percent = (max - min) / 100, value = cell.getValue() || 0, handle = document.createElement("div"), bar = document.createElement("div"), mouseDrag, mouseDragWidth; //set new value function updateValue() { var calcVal = percent * Math.round(bar.offsetWidth / (element.clientWidth / 100)) + min; success(calcVal); element.setAttribute("aria-valuenow", calcVal); element.setAttribute("aria-label", value); } //style handle handle.style.position = "absolute"; handle.style.right = "0"; handle.style.top = "0"; handle.style.bottom = "0"; handle.style.width = "5px"; handle.classList.add("tabulator-progress-handle"); //style bar bar.style.display = "inline-block"; bar.style.position = "relative"; // bar.style.top = "8px"; // bar.style.bottom = "8px"; // bar.style.left = "4px"; // bar.style.marginRight = "4px"; bar.style.height = "100%"; bar.style.backgroundColor = "#488CE9"; bar.style.maxWidth = "100%"; bar.style.minWidth = "0%"; if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { for (var key in editorParams.elementAttributes) { if (key.charAt(0) == "+") { key = key.slice(1); bar.setAttribute(key, bar.getAttribute(key) + editorParams.elementAttributes["+" + key]); } else { bar.setAttribute(key, editorParams.elementAttributes[key]); } } } //style cell element.style.padding = "4px 4px"; //make sure value is in range value = Math.min(parseFloat(value), max); value = Math.max(parseFloat(value), min); //workout percentage value = Math.round((value - min) / percent); // bar.style.right = value + "%"; bar.style.width = value + "%"; element.setAttribute("aria-valuemin", min); element.setAttribute("aria-valuemax", max); bar.appendChild(handle); handle.addEventListener("mousedown", function (e) { mouseDrag = e.screenX; mouseDragWidth = bar.offsetWidth; }); handle.addEventListener("mouseover", function () { handle.style.cursor = "ew-resize"; }); element.addEventListener("mousemove", function (e) { if (mouseDrag) { bar.style.width = mouseDragWidth + e.screenX - mouseDrag + "px"; } }); element.addEventListener("mouseup", function (e) { if (mouseDrag) { e.stopPropagation(); e.stopImmediatePropagation(); mouseDrag = false; mouseDragWidth = false; updateValue(); } }); //allow key based navigation element.addEventListener("keydown", function (e) { switch (e.keyCode) { case 39: //right arrow bar.style.width = bar.clientWidth + element.clientWidth / 100 + "px"; break; case 37: //left arrow bar.style.width = bar.clientWidth - element.clientWidth / 100 + "px"; break; case 13: //enter updateValue(); break; case 27: //escape cancel(); break; } }); element.addEventListener("blur", function () { cancel(); }); return bar; }, //checkbox tickCross: function tickCross(cell, onRendered, success, cancel, editorParams) { var value = cell.getValue(), input = document.createElement("input"), tristate = editorParams.tristate, indetermValue = typeof editorParams.indeterminateValue === "undefined" ? null : editorParams.indeterminateValue, indetermState = false; input.setAttribute("type", "checkbox"); input.style.marginTop = "5px"; input.style.boxSizing = "border-box"; if (editorParams.elementAttributes && _typeof(editorParams.elementAttributes) == "object") { for (var key in editorParams.elementAttributes) { if (key.charAt(0) == "+") { key = key.slice(1); input.setAttribute(key, input.getAttribute(key) + editorParams.elementAttributes["+" + key]); } else { input.setAttribute(key, editorParams.elementAttributes[key]); } } } input.value = value; if (tristate && (typeof value === "undefined" || value === indetermValue || value === "")) { indetermState = true; input.indeterminate = true; } if (this.table.browser != "firefox") { //prevent blur issue on mac firefox onRendered(function () { input.focus(); }); } input.checked = value === true || value === "true" || value === "True" || value === 1; function setValue(blur) { if (tristate) { if (!blur) { if (input.checked && !indetermState) { input.checked = false; input.indeterminate = true; indetermState = true; return indetermValue; } else { indetermState = false; return input.checked; } } else { if (indetermState) { return indetermValue; } else { return input.checked; } } } else { return input.checked; } } //submit new value on blur input.addEventListener("change", function (e) { success(setValue()); }); input.addEventListener("blur", function (e) { success(setValue(true)); }); //submit new value on enter input.addEventListener("keydown", function (e) { if (e.keyCode == 13) { success(setValue()); } if (e.keyCode == 27) { cancel(); } }); return input; } }; Tabulator.prototype.registerModule("edit", Edit);
/*! * DevExtreme-Quill Editor v.0.10.3 * https://js.devexpress.com/ * Copyright (c) 2020, Developer Express Inc. * Copyright (c) 2017, Slab * Copyright (c) 2014, Jason Chen * Copyright (c) 2013, salesforce.com */ (function webpackUniversalModuleDefinition(root, factory) { if(typeof exports === 'object' && typeof module === 'object') module.exports = factory(); else if(typeof define === 'function' && define.amd) define([], factory); else if(typeof exports === 'object') exports["Quill"] = factory(); else root["DevExpress"] = root["DevExpress"] || {}, root["DevExpress"]["Quill"] = factory(); })(this, function() { return /******/ (function(modules) { // webpackBootstrap /******/ // The module cache /******/ var installedModules = {}; /******/ /******/ // The require function /******/ function __webpack_require__(moduleId) { /******/ /******/ // Check if module is in cache /******/ if(installedModules[moduleId]) { /******/ return installedModules[moduleId].exports; /******/ } /******/ // Create a new module (and put it into the cache) /******/ var module = installedModules[moduleId] = { /******/ i: moduleId, /******/ l: false, /******/ exports: {} /******/ }; /******/ /******/ // Execute the module function /******/ modules[moduleId].call(module.exports, module, module.exports, __webpack_require__); /******/ /******/ // Flag the module as loaded /******/ module.l = true; /******/ /******/ // Return the exports of the module /******/ return module.exports; /******/ } /******/ /******/ /******/ // expose the modules object (__webpack_modules__) /******/ __webpack_require__.m = modules; /******/ /******/ // expose the module cache /******/ __webpack_require__.c = installedModules; /******/ /******/ // define getter function for harmony exports /******/ __webpack_require__.d = function(exports, name, getter) { /******/ if(!__webpack_require__.o(exports, name)) { /******/ Object.defineProperty(exports, name, { enumerable: true, get: getter }); /******/ } /******/ }; /******/ /******/ // define __esModule on exports /******/ __webpack_require__.r = function(exports) { /******/ if(typeof Symbol !== 'undefined' && Symbol.toStringTag) { /******/ Object.defineProperty(exports, Symbol.toStringTag, { value: 'Module' }); /******/ } /******/ Object.defineProperty(exports, '__esModule', { value: true }); /******/ }; /******/ /******/ // create a fake namespace object /******/ // mode & 1: value is a module id, require it /******/ // mode & 2: merge all properties of value into the ns /******/ // mode & 4: return value when already ns object /******/ // mode & 8|1: behave like require /******/ __webpack_require__.t = function(value, mode) { /******/ if(mode & 1) value = __webpack_require__(value); /******/ if(mode & 8) return value; /******/ if((mode & 4) && typeof value === 'object' && value && value.__esModule) return value; /******/ var ns = Object.create(null); /******/ __webpack_require__.r(ns); /******/ Object.defineProperty(ns, 'default', { enumerable: true, value: value }); /******/ if(mode & 2 && typeof value != 'string') for(var key in value) __webpack_require__.d(ns, key, function(key) { return value[key]; }.bind(null, key)); /******/ return ns; /******/ }; /******/ /******/ // getDefaultExport function for compatibility with non-harmony modules /******/ __webpack_require__.n = function(module) { /******/ var getter = module && module.__esModule ? /******/ function getDefault() { return module['default']; } : /******/ function getModuleExports() { return module; }; /******/ __webpack_require__.d(getter, 'a', getter); /******/ return getter; /******/ }; /******/ /******/ // Object.prototype.hasOwnProperty.call /******/ __webpack_require__.o = function(object, property) { return Object.prototype.hasOwnProperty.call(object, property); }; /******/ /******/ // __webpack_public_path__ /******/ __webpack_require__.p = ""; /******/ /******/ /******/ // Load entry module and return exports /******/ return __webpack_require__(__webpack_require__.s = 133); /******/ }) /************************************************************************/ /******/ ([ /* 0 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; var fast_diff_1 = __importDefault(__webpack_require__(85)); var lodash_clonedeep_1 = __importDefault(__webpack_require__(12)); var lodash_isequal_1 = __importDefault(__webpack_require__(19)); var AttributeMap_1 = __importDefault(__webpack_require__(86)); var Op_1 = __importDefault(__webpack_require__(63)); var NULL_CHARACTER = String.fromCharCode(0); // Placeholder char for embed in diff() var Delta = /** @class */ (function () { function Delta(ops) { // Assume we are given a well formed ops if (Array.isArray(ops)) { this.ops = ops; } else if (ops != null && Array.isArray(ops.ops)) { this.ops = ops.ops; } else { this.ops = []; } } Delta.prototype.insert = function (arg, attributes) { var newOp = {}; if (typeof arg === 'string' && arg.length === 0) { return this; } newOp.insert = arg; if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) { newOp.attributes = attributes; } return this.push(newOp); }; Delta.prototype.delete = function (length) { if (length <= 0) { return this; } return this.push({ delete: length }); }; Delta.prototype.retain = function (length, attributes) { if (length <= 0) { return this; } var newOp = { retain: length }; if (attributes != null && typeof attributes === 'object' && Object.keys(attributes).length > 0) { newOp.attributes = attributes; } return this.push(newOp); }; Delta.prototype.push = function (newOp) { var index = this.ops.length; var lastOp = this.ops[index - 1]; newOp = lodash_clonedeep_1.default(newOp); if (typeof lastOp === 'object') { if (typeof newOp.delete === 'number' && typeof lastOp.delete === 'number') { this.ops[index - 1] = { delete: lastOp.delete + newOp.delete }; return this; } // Since it does not matter if we insert before or after deleting at the same index, // always prefer to insert first if (typeof lastOp.delete === 'number' && newOp.insert != null) { index -= 1; lastOp = this.ops[index - 1]; if (typeof lastOp !== 'object') { this.ops.unshift(newOp); return this; } } if (lodash_isequal_1.default(newOp.attributes, lastOp.attributes)) { if (typeof newOp.insert === 'string' && typeof lastOp.insert === 'string') { this.ops[index - 1] = { insert: lastOp.insert + newOp.insert }; if (typeof newOp.attributes === 'object') { this.ops[index - 1].attributes = newOp.attributes; } return this; } else if (typeof newOp.retain === 'number' && typeof lastOp.retain === 'number') { this.ops[index - 1] = { retain: lastOp.retain + newOp.retain }; if (typeof newOp.attributes === 'object') { this.ops[index - 1].attributes = newOp.attributes; } return this; } } } if (index === this.ops.length) { this.ops.push(newOp); } else { this.ops.splice(index, 0, newOp); } return this; }; Delta.prototype.chop = function () { var lastOp = this.ops[this.ops.length - 1]; if (lastOp && lastOp.retain && !lastOp.attributes) { this.ops.pop(); } return this; }; Delta.prototype.filter = function (predicate) { return this.ops.filter(predicate); }; Delta.prototype.forEach = function (predicate) { this.ops.forEach(predicate); }; Delta.prototype.map = function (predicate) { return this.ops.map(predicate); }; Delta.prototype.partition = function (predicate) { var passed = []; var failed = []; this.forEach(function (op) { var target = predicate(op) ? passed : failed; target.push(op); }); return [passed, failed]; }; Delta.prototype.reduce = function (predicate, initialValue) { return this.ops.reduce(predicate, initialValue); }; Delta.prototype.changeLength = function () { return this.reduce(function (length, elem) { if (elem.insert) { return length + Op_1.default.length(elem); } else if (elem.delete) { return length - elem.delete; } return length; }, 0); }; Delta.prototype.length = function () { return this.reduce(function (length, elem) { return length + Op_1.default.length(elem); }, 0); }; Delta.prototype.slice = function (start, end) { if (start === void 0) { start = 0; } if (end === void 0) { end = Infinity; } var ops = []; var iter = Op_1.default.iterator(this.ops); var index = 0; while (index < end && iter.hasNext()) { var nextOp = void 0; if (index < start) { nextOp = iter.next(start - index); } else { nextOp = iter.next(end - index); ops.push(nextOp); } index += Op_1.default.length(nextOp); } return new Delta(ops); }; Delta.prototype.compose = function (other) { var thisIter = Op_1.default.iterator(this.ops); var otherIter = Op_1.default.iterator(other.ops); var ops = []; var firstOther = otherIter.peek(); if (firstOther != null && typeof firstOther.retain === 'number' && firstOther.attributes == null) { var firstLeft = firstOther.retain; while (thisIter.peekType() === 'insert' && thisIter.peekLength() <= firstLeft) { firstLeft -= thisIter.peekLength(); ops.push(thisIter.next()); } if (firstOther.retain - firstLeft > 0) { otherIter.next(firstOther.retain - firstLeft); } } var delta = new Delta(ops); while (thisIter.hasNext() || otherIter.hasNext()) { if (otherIter.peekType() === 'insert') { delta.push(otherIter.next()); } else if (thisIter.peekType() === 'delete') { delta.push(thisIter.next()); } else { var length_1 = Math.min(thisIter.peekLength(), otherIter.peekLength()); var thisOp = thisIter.next(length_1); var otherOp = otherIter.next(length_1); if (typeof otherOp.retain === 'number') { var newOp = {}; if (typeof thisOp.retain === 'number') { newOp.retain = length_1; } else { newOp.insert = thisOp.insert; } // Preserve null when composing with a retain, otherwise remove it for inserts var attributes = AttributeMap_1.default.compose(thisOp.attributes, otherOp.attributes, typeof thisOp.retain === 'number'); if (attributes) { newOp.attributes = attributes; } delta.push(newOp); // Optimization if rest of other is just retain if (!otherIter.hasNext() && lodash_isequal_1.default(delta.ops[delta.ops.length - 1], newOp)) { var rest = new Delta(thisIter.rest()); return delta.concat(rest).chop(); } // Other op should be delete, we could be an insert or retain // Insert + delete cancels out } else if (typeof otherOp.delete === 'number' && typeof thisOp.retain === 'number') { delta.push(otherOp); } } } return delta.chop(); }; Delta.prototype.concat = function (other) { var delta = new Delta(this.ops.slice()); if (other.ops.length > 0) { delta.push(other.ops[0]); delta.ops = delta.ops.concat(other.ops.slice(1)); } return delta; }; Delta.prototype.diff = function (other, cursor) { if (this.ops === other.ops) { return new Delta(); } var strings = [this, other].map(function (delta) { return delta .map(function (op) { if (op.insert != null) { return typeof op.insert === 'string' ? op.insert : NULL_CHARACTER; } var prep = delta === other ? 'on' : 'with'; throw new Error('diff() called ' + prep + ' non-document'); }) .join(''); }); var retDelta = new Delta(); var diffResult = fast_diff_1.default(strings[0], strings[1], cursor); var thisIter = Op_1.default.iterator(this.ops); var otherIter = Op_1.default.iterator(other.ops); diffResult.forEach(function (component) { var length = component[1].length; while (length > 0) { var opLength = 0; switch (component[0]) { case fast_diff_1.default.INSERT: opLength = Math.min(otherIter.peekLength(), length); retDelta.push(otherIter.next(opLength)); break; case fast_diff_1.default.DELETE: opLength = Math.min(length, thisIter.peekLength()); thisIter.next(opLength); retDelta.delete(opLength); break; case fast_diff_1.default.EQUAL: opLength = Math.min(thisIter.peekLength(), otherIter.peekLength(), length); var thisOp = thisIter.next(opLength); var otherOp = otherIter.next(opLength); if (lodash_isequal_1.default(thisOp.insert, otherOp.insert)) { retDelta.retain(opLength, AttributeMap_1.default.diff(thisOp.attributes, otherOp.attributes)); } else { retDelta.push(otherOp).delete(opLength); } break; } length -= opLength; } }); return retDelta.chop(); }; Delta.prototype.eachLine = function (predicate, newline) { if (newline === void 0) { newline = '\n'; } var iter = Op_1.default.iterator(this.ops); var line = new Delta(); var i = 0; while (iter.hasNext()) { if (iter.peekType() !== 'insert') { return; } var thisOp = iter.peek(); var start = Op_1.default.length(thisOp) - iter.peekLength(); var index = typeof thisOp.insert === 'string' ? thisOp.insert.indexOf(newline, start) - start : -1; if (index < 0) { line.push(iter.next()); } else if (index > 0) { line.push(iter.next(index)); } else { if (predicate(line, iter.next(1).attributes || {}, i) === false) { return; } i += 1; line = new Delta(); } } if (line.length() > 0) { predicate(line, {}, i); } }; Delta.prototype.invert = function (base) { var inverted = new Delta(); this.reduce(function (baseIndex, op) { if (op.insert) { inverted.delete(Op_1.default.length(op)); } else if (op.retain && op.attributes == null) { inverted.retain(op.retain); return baseIndex + op.retain; } else if (op.delete || (op.retain && op.attributes)) { var length_2 = (op.delete || op.retain); var slice = base.slice(baseIndex, baseIndex + length_2); slice.forEach(function (baseOp) { if (op.delete) { inverted.push(baseOp); } else if (op.retain && op.attributes) { inverted.retain(Op_1.default.length(baseOp), AttributeMap_1.default.invert(op.attributes, baseOp.attributes)); } }); return baseIndex + length_2; } return baseIndex; }, 0); return inverted.chop(); }; Delta.prototype.transform = function (arg, priority) { if (priority === void 0) { priority = false; } priority = !!priority; if (typeof arg === 'number') { return this.transformPosition(arg, priority); } var other = arg; var thisIter = Op_1.default.iterator(this.ops); var otherIter = Op_1.default.iterator(other.ops); var delta = new Delta(); while (thisIter.hasNext() || otherIter.hasNext()) { if (thisIter.peekType() === 'insert' && (priority || otherIter.peekType() !== 'insert')) { delta.retain(Op_1.default.length(thisIter.next())); } else if (otherIter.peekType() === 'insert') { delta.push(otherIter.next()); } else { var length_3 = Math.min(thisIter.peekLength(), otherIter.peekLength()); var thisOp = thisIter.next(length_3); var otherOp = otherIter.next(length_3); if (thisOp.delete) { // Our delete either makes their delete redundant or removes their retain continue; } else if (otherOp.delete) { delta.push(otherOp); } else { // We retain either their retain or insert delta.retain(length_3, AttributeMap_1.default.transform(thisOp.attributes, otherOp.attributes, priority)); } } } return delta.chop(); }; Delta.prototype.transformPosition = function (index, priority) { if (priority === void 0) { priority = false; } priority = !!priority; var thisIter = Op_1.default.iterator(this.ops); var offset = 0; while (thisIter.hasNext() && offset <= index) { var length_4 = thisIter.peekLength(); var nextType = thisIter.peekType(); thisIter.next(); if (nextType === 'delete') { index -= Math.min(length_4, index - offset); continue; } else if (nextType === 'insert' && (offset < index || !priority)) { index += length_4; } offset += length_4; } return index; }; Delta.Op = Op_1.default; Delta.AttributeMap = AttributeMap_1.default; return Delta; }()); module.exports = Delta; /***/ }), /* 1 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return globalRegistry; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return expandConfig; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return overload; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Quill; }); /* harmony import */ var quill_delta__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /* harmony import */ var quill_delta__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(quill_delta__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var lodash_clonedeep__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12); /* harmony import */ var lodash_clonedeep__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_clonedeep__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(26); /* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2); /* harmony import */ var _editor__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(4); /* harmony import */ var _emitter__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(3); /* harmony import */ var _module__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11); /* harmony import */ var _selection__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(6); /* harmony import */ var _instances__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(29); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(15); /* harmony import */ var _theme__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(40); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var debug = Object(_logger__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"])('quill'); var globalRegistry = new parchment__WEBPACK_IMPORTED_MODULE_3__["Registry"](); parchment__WEBPACK_IMPORTED_MODULE_3__["ParentBlot"].uiClass = 'ql-ui'; var Quill = /*#__PURE__*/function () { _createClass(Quill, null, [{ key: "debug", value: function debug(limit) { if (limit === true) { limit = 'log'; } _logger__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"].level(limit); } }, { key: "find", value: function find(node) { return _instances__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].get(node) || globalRegistry.find(node); } }, { key: "import", value: function _import(name) { if (this.imports[name] == null) { debug.error("Cannot import ".concat(name, ". Are you sure it was registered?")); } return this.imports[name]; } }, { key: "register", value: function register(path, target) { var _this = this; var overwrite = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false; if (typeof path !== 'string') { var name = path.attrName || path.blotName; if (typeof name === 'string') { // register(Blot | Attributor, overwrite) this.register("formats/".concat(name), path, target); } else { Object.keys(path).forEach(function (key) { _this.register(key, path[key], target); }); } } else { if (this.imports[path] != null && !overwrite) { debug.warn("Overwriting ".concat(path, " with"), target); } this.imports[path] = target; if ((path.indexOf('blots/') === 0 || path.indexOf('formats/') === 0) && target.blotName !== 'abstract') { globalRegistry.register(target); } if (typeof target.register === 'function') { target.register(globalRegistry); } } } }]); function Quill(container) { var _this2 = this; var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Quill); this.options = expandConfig(container, options); this.container = this.options.container; if (this.container == null) { return debug.error('Invalid Quill container', container); } if (this.options.debug) { Quill.debug(this.options.debug); } var html = this.container.innerHTML.trim(); this.container.classList.add('ql-container'); this.container.innerHTML = ''; _instances__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"].set(this.container, this); this.root = this.addContainer('ql-editor'); this.root.classList.add('ql-blank'); this.scrollingContainer = this.options.scrollingContainer || this.root; this.emitter = new _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"](); var ScrollBlot = this.options.registry.query(parchment__WEBPACK_IMPORTED_MODULE_3__["ScrollBlot"].blotName); this.scroll = new ScrollBlot(this.options.registry, this.root, { emitter: this.emitter }); this.editor = new _editor__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"](this.scroll); this.selection = new _selection__WEBPACK_IMPORTED_MODULE_7__[/* default */ "b"](this.scroll, this.emitter); this.theme = new this.options.theme(this, this.options); // eslint-disable-line new-cap this.keyboard = this.theme.addModule('keyboard'); this.clipboard = this.theme.addModule('clipboard'); this.history = this.theme.addModule('history'); this.uploader = this.theme.addModule('uploader'); this.theme.init(); this.emitter.on(_emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].events.EDITOR_CHANGE, function (type) { if (type === _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].events.TEXT_CHANGE) { _this2.root.classList.toggle('ql-blank', _this2.editor.isBlank()); } }); this.emitter.on(_emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].events.SCROLL_UPDATE, function (source, mutations) { var oldRange = _this2.selection.lastRange; var _this2$selection$getR = _this2.selection.getRange(), _this2$selection$getR2 = _slicedToArray(_this2$selection$getR, 1), newRange = _this2$selection$getR2[0]; var selectionInfo = oldRange && newRange ? { oldRange: oldRange, newRange: newRange } : undefined; modify.call(_this2, function () { return _this2.editor.update(null, mutations, selectionInfo); }, source); }); var contents = this.clipboard.convert({ html: "".concat(html, "<p><br></p>"), text: '\n' }); this.setContents(contents); this.history.clear(); if (this.options.placeholder) { this.root.setAttribute('data-placeholder', this.options.placeholder); } if (this.options.readOnly) { this.disable(); } this.allowReadOnlyEdits = false; } _createClass(Quill, [{ key: "addContainer", value: function addContainer(container) { var refNode = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : null; if (typeof container === 'string') { var className = container; container = document.createElement('div'); container.classList.add(className); } this.container.insertBefore(container, refNode); return container; } }, { key: "blur", value: function blur() { this.selection.setRange(null); } }, { key: "deleteText", value: function deleteText(index, length, source) { var _this3 = this; var _overload = overload(index, length, source); var _overload2 = _slicedToArray(_overload, 4); index = _overload2[0]; length = _overload2[1]; source = _overload2[3]; return modify.call(this, function () { return _this3.editor.deleteText(index, length); }, source, index, -1 * length); } }, { key: "disable", value: function disable() { this.enable(false); } }, { key: "editReadOnly", value: function editReadOnly(modifier) { this.allowReadOnlyEdits = true; var value = modifier(); this.allowReadOnlyEdits = false; return value; } }, { key: "enable", value: function enable() { var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.scroll.enable(enabled); this.container.classList.toggle('ql-disabled', !enabled); } }, { key: "focus", value: function focus() { var scrollTop = this.scrollingContainer.scrollTop; this.selection.focus(); this.scrollingContainer.scrollTop = scrollTop; this.scrollIntoView(); } }, { key: "format", value: function format(name, value) { var _this4 = this; var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.API; return modify.call(this, function () { var range = _this4.getSelection(true); var change = new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a(); if (range == null) return change; if (_this4.scroll.query(name, parchment__WEBPACK_IMPORTED_MODULE_3__["Scope"].BLOCK)) { change = _this4.editor.formatLine(range.index, range.length, _defineProperty({}, name, value)); } else if (range.length === 0) { _this4.selection.format(name, value); return change; } else { change = _this4.editor.formatText(range.index, range.length, _defineProperty({}, name, value)); } _this4.setSelection(range, _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.SILENT); return change; }, source); } }, { key: "formatLine", value: function formatLine(index, length, name, value, source) { var _this5 = this; var formats; // eslint-disable-next-line prefer-const var _overload3 = overload(index, length, name, value, source); var _overload4 = _slicedToArray(_overload3, 4); index = _overload4[0]; length = _overload4[1]; formats = _overload4[2]; source = _overload4[3]; return modify.call(this, function () { return _this5.editor.formatLine(index, length, formats); }, source, index, 0); } }, { key: "formatText", value: function formatText(index, length, name, value, source) { var _this6 = this; var formats; // eslint-disable-next-line prefer-const var _overload5 = overload(index, length, name, value, source); var _overload6 = _slicedToArray(_overload5, 4); index = _overload6[0]; length = _overload6[1]; formats = _overload6[2]; source = _overload6[3]; return modify.call(this, function () { return _this6.editor.formatText(index, length, formats); }, source, index, 0); } }, { key: "getBounds", value: function getBounds(index) { var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var bounds; if (typeof index === 'number') { bounds = this.selection.getBounds(index, length); } else { bounds = this.selection.getBounds(index.index, index.length); } var containerBounds = this.container.getBoundingClientRect(); return { bottom: bounds.bottom - containerBounds.top, height: bounds.height, left: bounds.left - containerBounds.left, right: bounds.right - containerBounds.left, top: bounds.top - containerBounds.top, width: bounds.width }; } }, { key: "getContents", value: function getContents() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index; var _overload7 = overload(index, length); var _overload8 = _slicedToArray(_overload7, 2); index = _overload8[0]; length = _overload8[1]; return this.editor.getContents(index, length); } }, { key: "getFormat", value: function getFormat() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : this.getSelection(true); var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; if (typeof index === 'number') { return this.editor.getFormat(index, length); } return this.editor.getFormat(index.index, index.length); } }, { key: "getIndex", value: function getIndex(blot) { return blot.offset(this.scroll); } }, { key: "getLength", value: function getLength() { return this.scroll.length(); } }, { key: "getLeaf", value: function getLeaf(index) { return this.scroll.leaf(index); } }, { key: "getLine", value: function getLine(index) { return this.scroll.line(index); } }, { key: "getLines", value: function getLines() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE; if (typeof index !== 'number') { return this.scroll.lines(index.index, index.length); } return this.scroll.lines(index, length); } }, { key: "getModule", value: function getModule(name) { return this.theme.modules[name]; } }, { key: "getSelection", value: function getSelection() { var focus = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : false; if (focus) this.focus(); this.update(); // Make sure we access getRange with editor in consistent state return this.selection.getRange()[0]; } }, { key: "getSemanticHTML", value: function getSemanticHTML() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index; var _overload9 = overload(index, length); var _overload10 = _slicedToArray(_overload9, 2); index = _overload10[0]; length = _overload10[1]; return this.editor.getHTML(index, length); } }, { key: "getText", value: function getText() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : this.getLength() - index; var _overload11 = overload(index, length); var _overload12 = _slicedToArray(_overload11, 2); index = _overload12[0]; length = _overload12[1]; return this.editor.getText(index, length); } }, { key: "hasFocus", value: function hasFocus() { return this.selection.hasFocus(); } }, { key: "insertEmbed", value: function insertEmbed(index, embed, value) { var _this7 = this; var source = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : Quill.sources.API; return modify.call(this, function () { return _this7.editor.insertEmbed(index, embed, value); }, source, index); } }, { key: "insertText", value: function insertText(index, text, name, value, source) { var _this8 = this; var formats; // eslint-disable-next-line prefer-const var _overload13 = overload(index, 0, name, value, source); var _overload14 = _slicedToArray(_overload13, 4); index = _overload14[0]; formats = _overload14[2]; source = _overload14[3]; return modify.call(this, function () { return _this8.editor.insertText(index, text, formats); }, source, index, text.length); } }, { key: "isEnabled", value: function isEnabled() { return this.scroll.isEnabled(); } }, { key: "off", value: function off() { var _this$emitter; return (_this$emitter = this.emitter).off.apply(_this$emitter, arguments); } }, { key: "on", value: function on() { var _this$emitter2; return (_this$emitter2 = this.emitter).on.apply(_this$emitter2, arguments); } }, { key: "once", value: function once() { var _this$emitter3; return (_this$emitter3 = this.emitter).once.apply(_this$emitter3, arguments); } }, { key: "removeFormat", value: function removeFormat(index, length, source) { var _this9 = this; var _overload15 = overload(index, length, source); var _overload16 = _slicedToArray(_overload15, 4); index = _overload16[0]; length = _overload16[1]; source = _overload16[3]; return modify.call(this, function () { return _this9.editor.removeFormat(index, length); }, source, index); } }, { key: "scrollIntoView", value: function scrollIntoView() { this.selection.scrollIntoView(this.scrollingContainer); } }, { key: "setContents", value: function setContents(delta) { var _this10 = this; var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.API; return modify.call(this, function () { delta = new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a(delta); var length = _this10.getLength(); // Quill will set empty editor to \n var delete1 = _this10.editor.deleteText(0, length); // delta always applied before existing content var applied = _this10.editor.applyDelta(delta); // Remove extra \n from empty editor initialization var delete2 = _this10.editor.deleteText(_this10.getLength() - 1, 1); return delete1.compose(applied).compose(delete2); }, source); } }, { key: "setSelection", value: function setSelection(index, length, source) { if (index == null) { this.selection.setRange(null, length || Quill.sources.API); } else { var _overload17 = overload(index, length, source); var _overload18 = _slicedToArray(_overload17, 4); index = _overload18[0]; length = _overload18[1]; source = _overload18[3]; this.selection.setRange(new _selection__WEBPACK_IMPORTED_MODULE_7__[/* Range */ "a"](Math.max(0, index), length), source); if (source !== _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.SILENT) { this.selection.scrollIntoView(this.scrollingContainer); } } } }, { key: "setText", value: function setText(text) { var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.API; var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a().insert(text); return this.setContents(delta, source); } }, { key: "update", value: function update() { var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.USER; var change = this.scroll.update(source); // Will update selection before selection.update() does if text changes this.selection.update(source); // TODO this is usually undefined return change; } }, { key: "updateContents", value: function updateContents(delta) { var _this11 = this; var source = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.API; return modify.call(this, function () { delta = new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a(delta); return _this11.editor.applyDelta(delta, source); }, source, true); } }]); return Quill; }(); Quill.DEFAULTS = { bounds: null, modules: {}, placeholder: '', readOnly: false, registry: globalRegistry, scrollingContainer: null, theme: 'default' }; Quill.events = _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].events; Quill.sources = _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources; // eslint-disable-next-line no-undef Quill.version = false ? undefined : "0.10.3"; Quill.imports = { delta: quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a, parchment: parchment__WEBPACK_IMPORTED_MODULE_3__, 'core/module': _module__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"], 'core/theme': _theme__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"] }; function expandConfig(container, userConfig) { userConfig = lodash_merge__WEBPACK_IMPORTED_MODULE_2___default()({ container: container, modules: { clipboard: true, keyboard: true, history: true, uploader: true } }, userConfig); if (!userConfig.theme || userConfig.theme === Quill.DEFAULTS.theme) { userConfig.theme = _theme__WEBPACK_IMPORTED_MODULE_10__[/* default */ "a"]; } else { userConfig.theme = Quill.import("themes/".concat(userConfig.theme)); if (userConfig.theme == null) { throw new Error("Invalid theme ".concat(userConfig.theme, ". Did you register it?")); } } var themeConfig = lodash_clonedeep__WEBPACK_IMPORTED_MODULE_1___default()(userConfig.theme.DEFAULTS); [themeConfig, userConfig].forEach(function (config) { config.modules = config.modules || {}; Object.keys(config.modules).forEach(function (module) { if (config.modules[module] === true) { config.modules[module] = {}; } }); }); var moduleNames = Object.keys(themeConfig.modules).concat(Object.keys(userConfig.modules)); var moduleConfig = moduleNames.reduce(function (config, name) { var moduleClass = Quill.import("modules/".concat(name)); if (moduleClass == null) { debug.error("Cannot load ".concat(name, " module. Are you sure you registered it?")); } else { config[name] = moduleClass.DEFAULTS || {}; } return config; }, {}); // Special case toolbar shorthand if (userConfig.modules != null && userConfig.modules.toolbar && userConfig.modules.toolbar.constructor !== Object) { userConfig.modules.toolbar = { container: userConfig.modules.toolbar }; } userConfig = lodash_merge__WEBPACK_IMPORTED_MODULE_2___default()({}, Quill.DEFAULTS, { modules: moduleConfig }, themeConfig, userConfig); ['bounds', 'container', 'scrollingContainer'].forEach(function (key) { if (typeof userConfig[key] === 'string') { userConfig[key] = document.querySelector(userConfig[key]); } }); userConfig.modules = Object.keys(userConfig.modules).reduce(function (config, name) { if (userConfig.modules[name]) { config[name] = userConfig.modules[name]; } return config; }, {}); return userConfig; } // Handle selection preservation and TEXT_CHANGE emission // common to modification APIs function modify(modifier, source, index, shift) { if (!this.isEnabled() && source === _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.USER && !this.allowReadOnlyEdits) { return new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a(); } var range = index == null ? null : this.getSelection(); var oldDelta = this.editor.delta; var change = modifier(); if (range != null) { if (index === true) { index = range.index; // eslint-disable-line prefer-destructuring } if (shift == null) { range = shiftRange(range, change, source); } else if (shift !== 0) { range = shiftRange(range, index, shift, source); } this.setSelection(range, _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.SILENT); } if (change.length() > 0) { var _this$emitter4; var args = [_emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].events.TEXT_CHANGE, change, oldDelta, source]; (_this$emitter4 = this.emitter).emit.apply(_this$emitter4, [_emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].events.EDITOR_CHANGE].concat(args)); if (source !== _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.SILENT) { var _this$emitter5; (_this$emitter5 = this.emitter).emit.apply(_this$emitter5, args); } } return change; } function overload(index, length, name, value, source) { var formats = {}; if (typeof index.index === 'number' && typeof index.length === 'number') { // Allow for throwaway end (used by insertText/insertEmbed) if (typeof length !== 'number') { source = value; value = name; name = length; length = index.length; // eslint-disable-line prefer-destructuring index = index.index; // eslint-disable-line prefer-destructuring } else { length = index.length; // eslint-disable-line prefer-destructuring index = index.index; // eslint-disable-line prefer-destructuring } } else if (typeof length !== 'number') { source = value; value = name; name = length; length = 0; } // Handle format being object, two format name/value strings or excluded if (_typeof(name) === 'object') { formats = name; source = value; } else if (typeof name === 'string') { if (value != null) { formats[name] = value; } else { source = name; } } // Handle optional source source = source || _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.API; return [index, length, formats, source]; } function shiftRange(range, index, length, source) { if (range == null) return null; var start; var end; if (index instanceof quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a) { var _map = [range.index, range.index + range.length].map(function (pos) { return index.transformPosition(pos, source !== _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.USER); }); var _map2 = _slicedToArray(_map, 2); start = _map2[0]; end = _map2[1]; } else { var _map3 = [range.index, range.index + range.length].map(function (pos) { if (pos < index || pos === index && source === _emitter__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"].sources.USER) return pos; if (length >= 0) { return pos + length; } return Math.max(index, pos + length); }); var _map4 = _slicedToArray(_map3, 2); start = _map4[0]; end = _map4[1]; } return new _selection__WEBPACK_IMPORTED_MODULE_7__[/* Range */ "a"](start, end - start); } /***/ }), /* 2 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXPORTS __webpack_require__.d(__webpack_exports__, "ParentBlot", function() { return /* reexport */ abstract_parent; }); __webpack_require__.d(__webpack_exports__, "ContainerBlot", function() { return /* reexport */ container; }); __webpack_require__.d(__webpack_exports__, "LeafBlot", function() { return /* reexport */ leaf; }); __webpack_require__.d(__webpack_exports__, "EmbedBlot", function() { return /* reexport */ blot_embed; }); __webpack_require__.d(__webpack_exports__, "ScrollBlot", function() { return /* reexport */ blot_scroll; }); __webpack_require__.d(__webpack_exports__, "BlockBlot", function() { return /* reexport */ block; }); __webpack_require__.d(__webpack_exports__, "InlineBlot", function() { return /* reexport */ inline; }); __webpack_require__.d(__webpack_exports__, "TextBlot", function() { return /* reexport */ blot_text; }); __webpack_require__.d(__webpack_exports__, "Attributor", function() { return /* reexport */ attributor; }); __webpack_require__.d(__webpack_exports__, "ClassAttributor", function() { return /* reexport */ attributor_class; }); __webpack_require__.d(__webpack_exports__, "StyleAttributor", function() { return /* reexport */ style; }); __webpack_require__.d(__webpack_exports__, "AttributorStore", function() { return /* reexport */ store; }); __webpack_require__.d(__webpack_exports__, "Registry", function() { return /* reexport */ registry; }); __webpack_require__.d(__webpack_exports__, "Scope", function() { return /* reexport */ src_scope; }); // CONCATENATED MODULE: ./node_modules/parchment/src/scope.ts var Scope; (function (Scope) { Scope[Scope["TYPE"] = 3] = "TYPE"; Scope[Scope["LEVEL"] = 12] = "LEVEL"; Scope[Scope["ATTRIBUTE"] = 13] = "ATTRIBUTE"; Scope[Scope["BLOT"] = 14] = "BLOT"; Scope[Scope["INLINE"] = 7] = "INLINE"; Scope[Scope["BLOCK"] = 11] = "BLOCK"; Scope[Scope["BLOCK_BLOT"] = 10] = "BLOCK_BLOT"; Scope[Scope["INLINE_BLOT"] = 6] = "INLINE_BLOT"; Scope[Scope["BLOCK_ATTRIBUTE"] = 9] = "BLOCK_ATTRIBUTE"; Scope[Scope["INLINE_ATTRIBUTE"] = 5] = "INLINE_ATTRIBUTE"; Scope[Scope["ANY"] = 15] = "ANY"; })(Scope || (Scope = {})); /* harmony default export */ var src_scope = (Scope); // CONCATENATED MODULE: ./node_modules/parchment/src/collection/linked-list.ts var LinkedList = /** @class */ function () { function LinkedList() { this.head = null; this.tail = null; this.length = 0; } LinkedList.prototype.append = function () { var nodes = []; for (var _i = 0; _i < arguments.length; _i++) { nodes[_i] = arguments[_i]; } this.insertBefore(nodes[0], null); if (nodes.length > 1) { var rest = nodes.slice(1); this.append.apply(this, rest); } }; LinkedList.prototype.at = function (index) { var next = this.iterator(); var cur = next(); while (cur && index > 0) { index -= 1; cur = next(); } return cur; }; LinkedList.prototype.contains = function (node) { var next = this.iterator(); var cur = next(); while (cur) { if (cur === node) { return true; } cur = next(); } return false; }; LinkedList.prototype.indexOf = function (node) { var next = this.iterator(); var cur = next(); var index = 0; while (cur) { if (cur === node) { return index; } index += 1; cur = next(); } return -1; }; LinkedList.prototype.insertBefore = function (node, refNode) { if (node == null) { return; } this.remove(node); node.next = refNode; if (refNode != null) { node.prev = refNode.prev; if (refNode.prev != null) { refNode.prev.next = node; } refNode.prev = node; if (refNode === this.head) { this.head = node; } } else if (this.tail != null) { this.tail.next = node; node.prev = this.tail; this.tail = node; } else { node.prev = null; this.head = this.tail = node; } this.length += 1; }; LinkedList.prototype.offset = function (target) { var index = 0; var cur = this.head; while (cur != null) { if (cur === target) { return index; } index += cur.length(); cur = cur.next; } return -1; }; LinkedList.prototype.remove = function (node) { if (!this.contains(node)) { return; } if (node.prev != null) { node.prev.next = node.next; } if (node.next != null) { node.next.prev = node.prev; } if (node === this.head) { this.head = node.next; } if (node === this.tail) { this.tail = node.prev; } this.length -= 1; }; LinkedList.prototype.iterator = function (curNode) { if (curNode === void 0) { curNode = this.head; } // TODO use yield when we can return function () { var ret = curNode; if (curNode != null) { curNode = curNode.next; } return ret; }; }; LinkedList.prototype.find = function (index, inclusive) { if (inclusive === void 0) { inclusive = false; } var next = this.iterator(); var cur = next(); while (cur) { var length = cur.length(); if (index < length || inclusive && index === length && (cur.next == null || cur.next.length() !== 0)) { return [cur, index]; } index -= length; cur = next(); } return [null, 0]; }; LinkedList.prototype.forEach = function (callback) { var next = this.iterator(); var cur = next(); while (cur) { callback(cur); cur = next(); } }; LinkedList.prototype.forEachAt = function (index, length, callback) { if (length <= 0) { return; } var _a = this.find(index), startNode = _a[0], offset = _a[1]; var curIndex = index - offset; var next = this.iterator(startNode); var cur = next(); while (cur && curIndex < index + length) { var curLength = cur.length(); if (index > curIndex) { callback(cur, index - curIndex, Math.min(length, curIndex + curLength - index)); } else { callback(cur, 0, Math.min(curLength, index + length - curIndex)); } curIndex += curLength; cur = next(); } }; LinkedList.prototype.map = function (callback) { return this.reduce(function (memo, cur) { memo.push(callback(cur)); return memo; }, []); }; LinkedList.prototype.reduce = function (callback, memo) { var next = this.iterator(); var cur = next(); while (cur) { memo = callback(memo, cur); cur = next(); } return memo; }; return LinkedList; }(); /* harmony default export */ var linked_list = (LinkedList); // CONCATENATED MODULE: ./node_modules/parchment/src/error.ts var __extends = undefined && undefined.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var ParchmentError = /** @class */ function (_super) { __extends(ParchmentError, _super); function ParchmentError(message) { var _this = this; message = '[Parchment] ' + message; _this = _super.call(this, message) || this; _this.message = message; _this.name = _this.constructor.name; return _this; } return ParchmentError; }(Error); /* harmony default export */ var error = (ParchmentError); // CONCATENATED MODULE: ./node_modules/parchment/src/registry.ts var registry_Registry = /** @class */ function () { function Registry() { this.attributes = {}; this.classes = {}; this.tags = {}; this.types = {}; } Registry.find = function (node, bubble) { if (bubble === void 0) { bubble = false; } if (node == null) { return null; } if (this.blots.has(node)) { return this.blots.get(node) || null; } if (bubble) { return this.find(node.parentNode, bubble); } return null; }; Registry.prototype.create = function (scroll, input, value) { var match = this.query(input); if (match == null) { throw new error("Unable to create " + input + " blot"); } var blotClass = match; var node = // @ts-ignore input instanceof Node || input.nodeType === Node.TEXT_NODE ? input : blotClass.create(value); var blot = new blotClass(scroll, node, value); Registry.blots.set(blot.domNode, blot); return blot; }; Registry.prototype.find = function (node, bubble) { if (bubble === void 0) { bubble = false; } return Registry.find(node, bubble); }; Registry.prototype.query = function (query, scope) { var _this = this; if (scope === void 0) { scope = src_scope.ANY; } var match; if (typeof query === 'string') { match = this.types[query] || this.attributes[query]; // @ts-ignore } else if (query instanceof Text || query.nodeType === Node.TEXT_NODE) { match = this.types.text; } else if (typeof query === 'number') { if (query & src_scope.LEVEL & src_scope.BLOCK) { match = this.types.block; } else if (query & src_scope.LEVEL & src_scope.INLINE) { match = this.types.inline; } } else if (query instanceof HTMLElement) { var names = (query.getAttribute('class') || '').split(/\s+/); names.some(function (name) { match = _this.classes[name]; if (match) { return true; } return false; }); match = match || this.tags[query.tagName]; } if (match == null) { return null; } // @ts-ignore if (scope & src_scope.LEVEL & match.scope && scope & src_scope.TYPE & match.scope) { return match; } return null; }; Registry.prototype.register = function () { var _this = this; var definitions = []; for (var _i = 0; _i < arguments.length; _i++) { definitions[_i] = arguments[_i]; } if (definitions.length > 1) { return definitions.map(function (d) { return _this.register(d); }); } var definition = definitions[0]; if (typeof definition.blotName !== 'string' && typeof definition.attrName !== 'string') { throw new error('Invalid definition'); } else if (definition.blotName === 'abstract') { throw new error('Cannot register abstract class'); } this.types[definition.blotName || definition.attrName] = definition; if (typeof definition.keyName === 'string') { this.attributes[definition.keyName] = definition; } else { if (definition.className != null) { this.classes[definition.className] = definition; } if (definition.tagName != null) { if (Array.isArray(definition.tagName)) { definition.tagName = definition.tagName.map(function (tagName) { return tagName.toUpperCase(); }); } else { definition.tagName = definition.tagName.toUpperCase(); } var tagNames = Array.isArray(definition.tagName) ? definition.tagName : [definition.tagName]; tagNames.forEach(function (tag) { if (_this.tags[tag] == null || definition.className == null) { _this.tags[tag] = definition; } }); } } return definition; }; Registry.blots = new WeakMap(); return Registry; }(); /* harmony default export */ var registry = (registry_Registry); // CONCATENATED MODULE: ./node_modules/parchment/src/blot/abstract/shadow.ts var shadow_ShadowBlot = /** @class */ function () { function ShadowBlot(scroll, domNode) { this.scroll = scroll; this.domNode = domNode; registry.blots.set(domNode, this); this.prev = null; this.next = null; } ShadowBlot.create = function (value) { if (this.tagName == null) { throw new error('Blot definition missing tagName'); } var node; if (Array.isArray(this.tagName)) { if (typeof value === 'string') { value = value.toUpperCase(); if (parseInt(value, 10).toString() === value) { value = parseInt(value, 10); } } if (typeof value === 'number') { node = document.createElement(this.tagName[value - 1]); } else if (this.tagName.indexOf(value) > -1) { node = document.createElement(value); } else { node = document.createElement(this.tagName[0]); } } else { node = document.createElement(this.tagName); } if (this.className) { node.classList.add(this.className); } return node; }; Object.defineProperty(ShadowBlot.prototype, "statics", { // Hack for accessing inherited static methods get: function get() { return this.constructor; }, enumerable: true, configurable: true }); ShadowBlot.prototype.attach = function () {// Nothing to do }; ShadowBlot.prototype.clone = function () { var domNode = this.domNode.cloneNode(false); return this.scroll.create(domNode); }; ShadowBlot.prototype.detach = function () { if (this.parent != null) { this.parent.removeChild(this); } registry.blots.delete(this.domNode); }; ShadowBlot.prototype.deleteAt = function (index, length) { var blot = this.isolate(index, length); blot.remove(); }; ShadowBlot.prototype.formatAt = function (index, length, name, value) { var blot = this.isolate(index, length); if (this.scroll.query(name, src_scope.BLOT) != null && value) { blot.wrap(name, value); } else if (this.scroll.query(name, src_scope.ATTRIBUTE) != null) { var parent = this.scroll.create(this.statics.scope); blot.wrap(parent); parent.format(name, value); } }; ShadowBlot.prototype.insertAt = function (index, value, def) { var blot = def == null ? this.scroll.create('text', value) : this.scroll.create(value, def); var ref = this.split(index); this.parent.insertBefore(blot, ref || undefined); }; ShadowBlot.prototype.isolate = function (index, length) { var target = this.split(index); if (target == null) { throw new Error('Attempt to isolate at end'); } target.split(length); return target; }; ShadowBlot.prototype.length = function () { return 1; }; ShadowBlot.prototype.offset = function (root) { if (root === void 0) { root = this.parent; } if (this.parent == null || this === root) { return 0; } return this.parent.children.offset(this) + this.parent.offset(root); }; ShadowBlot.prototype.optimize = function (_context) { if (this.statics.requiredContainer && !(this.parent instanceof this.statics.requiredContainer)) { this.wrap(this.statics.requiredContainer.blotName); } }; ShadowBlot.prototype.remove = function () { if (this.domNode.parentNode != null) { this.domNode.parentNode.removeChild(this.domNode); } this.detach(); }; ShadowBlot.prototype.replaceWith = function (name, value) { var replacement = typeof name === 'string' ? this.scroll.create(name, value) : name; if (this.parent != null) { this.parent.insertBefore(replacement, this.next || undefined); this.remove(); } return replacement; }; ShadowBlot.prototype.split = function (index, _force) { return index === 0 ? this : this.next; }; ShadowBlot.prototype.update = function (_mutations, _context) {// Nothing to do by default }; ShadowBlot.prototype.wrap = function (name, value) { var wrapper = typeof name === 'string' ? this.scroll.create(name, value) : name; if (this.parent != null) { this.parent.insertBefore(wrapper, this.next || undefined); } if (typeof wrapper.appendChild !== 'function') { throw new error("Cannot wrap " + name); } wrapper.appendChild(this); return wrapper; }; ShadowBlot.blotName = 'abstract'; return ShadowBlot; }(); /* harmony default export */ var shadow = (shadow_ShadowBlot); // CONCATENATED MODULE: ./node_modules/parchment/src/blot/abstract/parent.ts var parent_extends = undefined && undefined.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); function makeAttachedBlot(node, scroll) { var blot = scroll.find(node); if (blot == null) { try { blot = scroll.create(node); } catch (e) { blot = scroll.create(src_scope.INLINE); Array.from(node.childNodes).forEach(function (child) { // @ts-ignore blot.domNode.appendChild(child); }); if (node.parentNode) { node.parentNode.replaceChild(blot.domNode, node); } blot.attach(); } } return blot; } var parent_ParentBlot = /** @class */ function (_super) { parent_extends(ParentBlot, _super); function ParentBlot(scroll, domNode) { var _this = _super.call(this, scroll, domNode) || this; _this.uiNode = null; _this.build(); return _this; } ParentBlot.prototype.appendChild = function (other) { this.insertBefore(other); }; ParentBlot.prototype.attach = function () { _super.prototype.attach.call(this); this.children.forEach(function (child) { child.attach(); }); }; ParentBlot.prototype.attachUI = function (node) { if (this.uiNode != null) { this.uiNode.remove(); } this.uiNode = node; if (ParentBlot.uiClass) { this.uiNode.classList.add(ParentBlot.uiClass); } this.uiNode.setAttribute('contenteditable', 'false'); this.domNode.insertBefore(this.uiNode, this.domNode.firstChild); }; ParentBlot.prototype.build = function () { var _this = this; this.children = new linked_list(); // Need to be reversed for if DOM nodes already in order Array.from(this.domNode.childNodes).filter(function (node) { return node !== _this.uiNode; }).reverse().forEach(function (node) { try { var child = makeAttachedBlot(node, _this.scroll); _this.insertBefore(child, _this.children.head || undefined); } catch (err) { if (err instanceof error) { return; } else { throw err; } } }); }; ParentBlot.prototype.deleteAt = function (index, length) { if (index === 0 && length === this.length()) { return this.remove(); } this.children.forEachAt(index, length, function (child, offset, childLength) { child.deleteAt(offset, childLength); }); }; ParentBlot.prototype.descendant = function (criteria, index) { if (index === void 0) { index = 0; } var _a = this.children.find(index), child = _a[0], offset = _a[1]; if (criteria.blotName == null && criteria(child) || criteria.blotName != null && child instanceof criteria) { return [child, offset]; } else if (child instanceof ParentBlot) { return child.descendant(criteria, offset); } else { return [null, -1]; } }; ParentBlot.prototype.descendants = function (criteria, index, length) { if (index === void 0) { index = 0; } if (length === void 0) { length = Number.MAX_VALUE; } var descendants = []; var lengthLeft = length; this.children.forEachAt(index, length, function (child, childIndex, childLength) { if (criteria.blotName == null && criteria(child) || criteria.blotName != null && child instanceof criteria) { descendants.push(child); } if (child instanceof ParentBlot) { descendants = descendants.concat(child.descendants(criteria, childIndex, lengthLeft)); } lengthLeft -= childLength; }); return descendants; }; ParentBlot.prototype.detach = function () { this.children.forEach(function (child) { child.detach(); }); _super.prototype.detach.call(this); }; ParentBlot.prototype.enforceAllowedChildren = function () { var _this = this; var done = false; this.children.forEach(function (child) { if (done) { return; } var allowed = _this.statics.allowedChildren.some(function (def) { return child instanceof def; }); if (allowed) { return; } if (child.statics.scope === src_scope.BLOCK_BLOT) { if (child.next != null) { _this.splitAfter(child); } if (child.prev != null) { _this.splitAfter(child.prev); } child.parent.unwrap(); done = true; } else if (child instanceof ParentBlot) { child.unwrap(); } else { child.remove(); } }); }; ParentBlot.prototype.formatAt = function (index, length, name, value) { this.children.forEachAt(index, length, function (child, offset, childLength) { child.formatAt(offset, childLength, name, value); }); }; ParentBlot.prototype.insertAt = function (index, value, def) { var _a = this.children.find(index), child = _a[0], offset = _a[1]; if (child) { child.insertAt(offset, value, def); } else { var blot = def == null ? this.scroll.create('text', value) : this.scroll.create(value, def); this.appendChild(blot); } }; ParentBlot.prototype.insertBefore = function (childBlot, refBlot) { if (childBlot.parent != null) { childBlot.parent.children.remove(childBlot); } var refDomNode = null; this.children.insertBefore(childBlot, refBlot || null); childBlot.parent = this; if (refBlot != null) { refDomNode = refBlot.domNode; } if (this.domNode.parentNode !== childBlot.domNode || this.domNode.nextSibling !== refDomNode) { this.domNode.insertBefore(childBlot.domNode, refDomNode); } childBlot.attach(); }; ParentBlot.prototype.length = function () { return this.children.reduce(function (memo, child) { return memo + child.length(); }, 0); }; ParentBlot.prototype.moveChildren = function (targetParent, refNode) { this.children.forEach(function (child) { targetParent.insertBefore(child, refNode); }); }; ParentBlot.prototype.optimize = function (context) { _super.prototype.optimize.call(this, context); this.enforceAllowedChildren(); if (this.uiNode != null && this.uiNode !== this.domNode.firstChild) { this.domNode.insertBefore(this.uiNode, this.domNode.firstChild); } if (this.children.length === 0) { if (this.statics.defaultChild != null) { var child = this.scroll.create(this.statics.defaultChild.blotName); this.appendChild(child); // TODO double check if necessary // child.optimize(context); } else { this.remove(); } } }; ParentBlot.prototype.path = function (index, inclusive) { if (inclusive === void 0) { inclusive = false; } var _a = this.children.find(index, inclusive), child = _a[0], offset = _a[1]; var position = [[this, index]]; if (child instanceof ParentBlot) { return position.concat(child.path(offset, inclusive)); } else if (child != null) { position.push([child, offset]); } return position; }; ParentBlot.prototype.removeChild = function (child) { this.children.remove(child); }; ParentBlot.prototype.replaceWith = function (name, value) { var replacement = typeof name === 'string' ? this.scroll.create(name, value) : name; if (replacement instanceof ParentBlot) { this.moveChildren(replacement); } return _super.prototype.replaceWith.call(this, replacement); }; ParentBlot.prototype.split = function (index, force) { if (force === void 0) { force = false; } if (!force) { if (index === 0) { return this; } if (index === this.length()) { return this.next; } } var after = this.clone(); if (this.parent) { this.parent.insertBefore(after, this.next || undefined); } this.children.forEachAt(index, this.length(), function (child, offset, _length) { var split = child.split(offset, force); if (split != null) { after.appendChild(split); } }); return after; }; ParentBlot.prototype.splitAfter = function (child) { var after = this.clone(); while (child.next != null) { after.appendChild(child.next); } if (this.parent) { this.parent.insertBefore(after, this.next || undefined); } return after; }; ParentBlot.prototype.unwrap = function () { if (this.parent) { this.moveChildren(this.parent, this.next || undefined); } this.remove(); }; ParentBlot.prototype.update = function (mutations, _context) { var _this = this; var addedNodes = []; var removedNodes = []; mutations.forEach(function (mutation) { if (mutation.target === _this.domNode && mutation.type === 'childList') { addedNodes.push.apply(addedNodes, mutation.addedNodes); removedNodes.push.apply(removedNodes, mutation.removedNodes); } }); removedNodes.forEach(function (node) { // Check node has actually been removed // One exception is Chrome does not immediately remove IFRAMEs // from DOM but MutationRecord is correct in its reported removal if (node.parentNode != null && // @ts-ignore node.tagName !== 'IFRAME' && document.body.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) { return; } var blot = _this.scroll.find(node); if (blot == null) { return; } if (blot.domNode.parentNode == null || blot.domNode.parentNode === _this.domNode) { blot.detach(); } }); addedNodes.filter(function (node) { return node.parentNode === _this.domNode || node === _this.uiNode; }).sort(function (a, b) { if (a === b) { return 0; } if (a.compareDocumentPosition(b) & Node.DOCUMENT_POSITION_FOLLOWING) { return 1; } return -1; }).forEach(function (node) { var refBlot = null; if (node.nextSibling != null) { refBlot = _this.scroll.find(node.nextSibling); } var blot = makeAttachedBlot(node, _this.scroll); if (blot.next !== refBlot || blot.next == null) { if (blot.parent != null) { blot.parent.removeChild(_this); } _this.insertBefore(blot, refBlot || undefined); } }); this.enforceAllowedChildren(); }; ParentBlot.uiClass = ''; return ParentBlot; }(shadow); /* harmony default export */ var abstract_parent = (parent_ParentBlot); // CONCATENATED MODULE: ./node_modules/parchment/src/blot/abstract/container.ts var container_extends = undefined && undefined.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var container_ContainerBlot = /** @class */ function (_super) { container_extends(ContainerBlot, _super); function ContainerBlot() { return _super !== null && _super.apply(this, arguments) || this; } ContainerBlot.prototype.checkMerge = function () { return this.next !== null && this.next.statics.blotName === this.statics.blotName; }; ContainerBlot.prototype.deleteAt = function (index, length) { _super.prototype.deleteAt.call(this, index, length); this.enforceAllowedChildren(); }; ContainerBlot.prototype.formatAt = function (index, length, name, value) { _super.prototype.formatAt.call(this, index, length, name, value); this.enforceAllowedChildren(); }; ContainerBlot.prototype.insertAt = function (index, value, def) { _super.prototype.insertAt.call(this, index, value, def); this.enforceAllowedChildren(); }; ContainerBlot.prototype.optimize = function (context) { _super.prototype.optimize.call(this, context); if (this.children.length > 0 && this.next != null && this.checkMerge()) { this.next.moveChildren(this); this.next.remove(); } }; ContainerBlot.blotName = 'container'; ContainerBlot.scope = src_scope.BLOCK_BLOT; return ContainerBlot; }(abstract_parent); /* harmony default export */ var container = (container_ContainerBlot); // CONCATENATED MODULE: ./node_modules/parchment/src/blot/abstract/leaf.ts var leaf_extends = undefined && undefined.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var leaf_LeafBlot = /** @class */ function (_super) { leaf_extends(LeafBlot, _super); function LeafBlot() { return _super !== null && _super.apply(this, arguments) || this; } LeafBlot.value = function (_domNode) { return true; }; LeafBlot.prototype.index = function (node, offset) { if (this.domNode === node || this.domNode.compareDocumentPosition(node) & Node.DOCUMENT_POSITION_CONTAINED_BY) { return Math.min(offset, 1); } return -1; }; LeafBlot.prototype.position = function (index, _inclusive) { var childNodes = Array.from(this.parent.domNode.childNodes); var offset = childNodes.indexOf(this.domNode); if (index > 0) { offset += 1; } return [this.parent.domNode, offset]; }; LeafBlot.prototype.value = function () { var _a; return _a = {}, _a[this.statics.blotName] = this.statics.value(this.domNode) || true, _a; }; LeafBlot.scope = src_scope.INLINE_BLOT; return LeafBlot; }(shadow); /* harmony default export */ var leaf = (leaf_LeafBlot); // CONCATENATED MODULE: ./node_modules/parchment/src/attributor/attributor.ts var attributor_Attributor = /** @class */ function () { function Attributor(attrName, keyName, options) { if (options === void 0) { options = {}; } this.attrName = attrName; this.keyName = keyName; var attributeBit = src_scope.TYPE & src_scope.ATTRIBUTE; this.scope = options.scope != null ? // Ignore type bits, force attribute bit options.scope & src_scope.LEVEL | attributeBit : src_scope.ATTRIBUTE; if (options.whitelist != null) { this.whitelist = options.whitelist; } } Attributor.keys = function (node) { return Array.from(node.attributes).map(function (item) { return item.name; }); }; Attributor.prototype.add = function (node, value) { if (!this.canAdd(node, value)) { return false; } node.setAttribute(this.keyName, value); return true; }; Attributor.prototype.canAdd = function (_node, value) { if (this.whitelist == null) { return true; } if (typeof value === 'string') { return this.whitelist.indexOf(value.replace(/["']/g, '')) > -1; } else { return this.whitelist.indexOf(value) > -1; } }; Attributor.prototype.remove = function (node) { node.removeAttribute(this.keyName); }; Attributor.prototype.value = function (node) { var value = node.getAttribute(this.keyName); if (this.canAdd(node, value) && value) { return value; } return ''; }; return Attributor; }(); /* harmony default export */ var attributor = (attributor_Attributor); // CONCATENATED MODULE: ./node_modules/parchment/src/attributor/class.ts var class_extends = undefined && undefined.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); function class_match(node, prefix) { var className = node.getAttribute('class') || ''; return className.split(/\s+/).filter(function (name) { return name.indexOf(prefix + "-") === 0; }); } var ClassAttributor = /** @class */ function (_super) { class_extends(ClassAttributor, _super); function ClassAttributor() { return _super !== null && _super.apply(this, arguments) || this; } ClassAttributor.keys = function (node) { return (node.getAttribute('class') || '').split(/\s+/).map(function (name) { return name.split('-').slice(0, -1).join('-'); }); }; ClassAttributor.prototype.add = function (node, value) { if (!this.canAdd(node, value)) { return false; } this.remove(node); node.classList.add(this.keyName + "-" + value); return true; }; ClassAttributor.prototype.remove = function (node) { var matches = class_match(node, this.keyName); matches.forEach(function (name) { node.classList.remove(name); }); if (node.classList.length === 0) { node.removeAttribute('class'); } }; ClassAttributor.prototype.value = function (node) { var result = class_match(node, this.keyName)[0] || ''; var value = result.slice(this.keyName.length + 1); // +1 for hyphen return this.canAdd(node, value) ? value : ''; }; return ClassAttributor; }(attributor); /* harmony default export */ var attributor_class = (ClassAttributor); // CONCATENATED MODULE: ./node_modules/parchment/src/attributor/style.ts var style_extends = undefined && undefined.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); function camelize(name) { var parts = name.split('-'); var rest = parts.slice(1).map(function (part) { return part[0].toUpperCase() + part.slice(1); }).join(''); return parts[0] + rest; } var StyleAttributor = /** @class */ function (_super) { style_extends(StyleAttributor, _super); function StyleAttributor() { return _super !== null && _super.apply(this, arguments) || this; } StyleAttributor.keys = function (node) { return (node.getAttribute('style') || '').split(';').map(function (value) { var arr = value.split(':'); return arr[0].trim(); }); }; StyleAttributor.prototype.add = function (node, value) { if (!this.canAdd(node, value)) { return false; } // @ts-ignore node.style[camelize(this.keyName)] = value; return true; }; StyleAttributor.prototype.remove = function (node) { // @ts-ignore node.style[camelize(this.keyName)] = ''; if (!node.getAttribute('style')) { node.removeAttribute('style'); } }; StyleAttributor.prototype.value = function (node) { // @ts-ignore var value = node.style[camelize(this.keyName)]; return this.canAdd(node, value) ? value : ''; }; return StyleAttributor; }(attributor); /* harmony default export */ var style = (StyleAttributor); // CONCATENATED MODULE: ./node_modules/parchment/src/attributor/store.ts var store_AttributorStore = /** @class */ function () { function AttributorStore(domNode) { this.attributes = {}; this.domNode = domNode; this.build(); } AttributorStore.prototype.attribute = function (attribute, value) { // verb if (value) { if (attribute.add(this.domNode, value)) { if (attribute.value(this.domNode) != null) { this.attributes[attribute.attrName] = attribute; } else { delete this.attributes[attribute.attrName]; } } } else { attribute.remove(this.domNode); delete this.attributes[attribute.attrName]; } }; AttributorStore.prototype.build = function () { var _this = this; this.attributes = {}; var blot = registry.find(this.domNode); if (blot == null) { return; } var attributes = attributor.keys(this.domNode); var classes = attributor_class.keys(this.domNode); var styles = style.keys(this.domNode); attributes.concat(classes).concat(styles).forEach(function (name) { var attr = blot.scroll.query(name, src_scope.ATTRIBUTE); if (attr instanceof attributor) { _this.attributes[attr.attrName] = attr; } }); }; AttributorStore.prototype.copy = function (target) { var _this = this; Object.keys(this.attributes).forEach(function (key) { var value = _this.attributes[key].value(_this.domNode); target.format(key, value); }); }; AttributorStore.prototype.move = function (target) { var _this = this; this.copy(target); Object.keys(this.attributes).forEach(function (key) { _this.attributes[key].remove(_this.domNode); }); this.attributes = {}; }; AttributorStore.prototype.values = function () { var _this = this; return Object.keys(this.attributes).reduce(function (attributes, name) { attributes[name] = _this.attributes[name].value(_this.domNode); return attributes; }, {}); }; return AttributorStore; }(); /* harmony default export */ var store = (store_AttributorStore); // CONCATENATED MODULE: ./node_modules/parchment/src/blot/inline.ts var inline_extends = undefined && undefined.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); // Shallow object comparison function isEqual(obj1, obj2) { if (Object.keys(obj1).length !== Object.keys(obj2).length) { return false; } // @ts-ignore for (var prop in obj1) { // @ts-ignore if (obj1[prop] !== obj2[prop]) { return false; } } return true; } var inline_InlineBlot = /** @class */ function (_super) { inline_extends(InlineBlot, _super); function InlineBlot(scroll, domNode) { var _this = _super.call(this, scroll, domNode) || this; _this.attributes = new store(_this.domNode); return _this; } InlineBlot.formats = function (domNode, scroll) { var match = scroll.query(InlineBlot.blotName); if (match != null && domNode.tagName === match.tagName) { return undefined; } else if (typeof this.tagName === 'string') { return true; } else if (Array.isArray(this.tagName)) { return domNode.tagName.toLowerCase(); } return undefined; }; InlineBlot.prototype.format = function (name, value) { var _this = this; if (name === this.statics.blotName && !value) { this.children.forEach(function (child) { if (!(child instanceof InlineBlot)) { child = child.wrap(InlineBlot.blotName, true); } _this.attributes.copy(child); }); this.unwrap(); } else { var format = this.scroll.query(name, src_scope.INLINE); if (format == null) { return; } if (format instanceof attributor) { this.attributes.attribute(format, value); } else if (value && (name !== this.statics.blotName || this.formats()[name] !== value)) { this.replaceWith(name, value); } } }; InlineBlot.prototype.formats = function () { var formats = this.attributes.values(); var format = this.statics.formats(this.domNode, this.scroll); if (format != null) { formats[this.statics.blotName] = format; } return formats; }; InlineBlot.prototype.formatAt = function (index, length, name, value) { if (this.formats()[name] != null || this.scroll.query(name, src_scope.ATTRIBUTE)) { var blot = this.isolate(index, length); blot.format(name, value); } else { _super.prototype.formatAt.call(this, index, length, name, value); } }; InlineBlot.prototype.optimize = function (context) { _super.prototype.optimize.call(this, context); var formats = this.formats(); if (Object.keys(formats).length === 0) { return this.unwrap(); // unformatted span } var next = this.next; if (next instanceof InlineBlot && next.prev === this && isEqual(formats, next.formats())) { next.moveChildren(this); next.remove(); } }; InlineBlot.prototype.replaceWith = function (name, value) { var replacement = _super.prototype.replaceWith.call(this, name, value); this.attributes.copy(replacement); return replacement; }; InlineBlot.prototype.update = function (mutations, context) { var _this = this; _super.prototype.update.call(this, mutations, context); var attributeChanged = mutations.some(function (mutation) { return mutation.target === _this.domNode && mutation.type === 'attributes'; }); if (attributeChanged) { this.attributes.build(); } }; InlineBlot.prototype.wrap = function (name, value) { var wrapper = _super.prototype.wrap.call(this, name, value); if (wrapper instanceof InlineBlot) { this.attributes.move(wrapper); } return wrapper; }; InlineBlot.allowedChildren = [InlineBlot, leaf]; InlineBlot.blotName = 'inline'; InlineBlot.scope = src_scope.INLINE_BLOT; InlineBlot.tagName = 'SPAN'; return InlineBlot; }(abstract_parent); /* harmony default export */ var inline = (inline_InlineBlot); // CONCATENATED MODULE: ./node_modules/parchment/src/blot/block.ts var block_extends = undefined && undefined.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var block_BlockBlot = /** @class */ function (_super) { block_extends(BlockBlot, _super); function BlockBlot(scroll, domNode) { var _this = _super.call(this, scroll, domNode) || this; _this.attributes = new store(_this.domNode); return _this; } BlockBlot.formats = function (domNode, scroll) { var match = scroll.query(BlockBlot.blotName); if (match != null && domNode.tagName === match.tagName) { return undefined; } else if (typeof this.tagName === 'string') { return true; } else if (Array.isArray(this.tagName)) { return domNode.tagName.toLowerCase(); } }; BlockBlot.prototype.format = function (name, value) { var format = this.scroll.query(name, src_scope.BLOCK); if (format == null) { return; } else if (format instanceof attributor) { this.attributes.attribute(format, value); } else if (name === this.statics.blotName && !value) { this.replaceWith(BlockBlot.blotName); } else if (value && (name !== this.statics.blotName || this.formats()[name] !== value)) { this.replaceWith(name, value); } }; BlockBlot.prototype.formats = function () { var formats = this.attributes.values(); var format = this.statics.formats(this.domNode, this.scroll); if (format != null) { formats[this.statics.blotName] = format; } return formats; }; BlockBlot.prototype.formatAt = function (index, length, name, value) { if (this.scroll.query(name, src_scope.BLOCK) != null) { this.format(name, value); } else { _super.prototype.formatAt.call(this, index, length, name, value); } }; BlockBlot.prototype.insertAt = function (index, value, def) { if (def == null || this.scroll.query(value, src_scope.INLINE) != null) { // Insert text or inline _super.prototype.insertAt.call(this, index, value, def); } else { var after = this.split(index); if (after != null) { var blot = this.scroll.create(value, def); after.parent.insertBefore(blot, after); } else { throw new Error('Attempt to insertAt after block boundaries'); } } }; BlockBlot.prototype.replaceWith = function (name, value) { var replacement = _super.prototype.replaceWith.call(this, name, value); this.attributes.copy(replacement); return replacement; }; BlockBlot.prototype.update = function (mutations, context) { var _this = this; _super.prototype.update.call(this, mutations, context); var attributeChanged = mutations.some(function (mutation) { return mutation.target === _this.domNode && mutation.type === 'attributes'; }); if (attributeChanged) { this.attributes.build(); } }; BlockBlot.blotName = 'block'; BlockBlot.scope = src_scope.BLOCK_BLOT; BlockBlot.tagName = 'P'; BlockBlot.allowedChildren = [inline, BlockBlot, leaf]; return BlockBlot; }(abstract_parent); /* harmony default export */ var block = (block_BlockBlot); // CONCATENATED MODULE: ./node_modules/parchment/src/blot/embed.ts var embed_extends = undefined && undefined.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var EmbedBlot = /** @class */ function (_super) { embed_extends(EmbedBlot, _super); function EmbedBlot() { return _super !== null && _super.apply(this, arguments) || this; } EmbedBlot.formats = function (_domNode, _scroll) { return undefined; }; EmbedBlot.prototype.format = function (name, value) { // super.formatAt wraps, which is what we want in general, // but this allows subclasses to overwrite for formats // that just apply to particular embeds _super.prototype.formatAt.call(this, 0, this.length(), name, value); }; EmbedBlot.prototype.formatAt = function (index, length, name, value) { if (index === 0 && length === this.length()) { this.format(name, value); } else { _super.prototype.formatAt.call(this, index, length, name, value); } }; EmbedBlot.prototype.formats = function () { return this.statics.formats(this.domNode, this.scroll); }; return EmbedBlot; }(leaf); /* harmony default export */ var blot_embed = (EmbedBlot); // CONCATENATED MODULE: ./node_modules/parchment/src/blot/scroll.ts var scroll_extends = undefined && undefined.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var OBSERVER_CONFIG = { attributes: true, characterData: true, characterDataOldValue: true, childList: true, subtree: true }; var MAX_OPTIMIZE_ITERATIONS = 100; var scroll_ScrollBlot = /** @class */ function (_super) { scroll_extends(ScrollBlot, _super); function ScrollBlot(registry, node) { var _this = // @ts-ignore _super.call(this, null, node) || this; _this.registry = registry; _this.scroll = _this; _this.build(); _this.observer = new MutationObserver(function (mutations) { _this.update(mutations); }); _this.observer.observe(_this.domNode, OBSERVER_CONFIG); _this.attach(); return _this; } ScrollBlot.prototype.create = function (input, value) { return this.registry.create(this, input, value); }; ScrollBlot.prototype.find = function (node, bubble) { if (bubble === void 0) { bubble = false; } return this.registry.find(node, bubble); }; ScrollBlot.prototype.query = function (query, scope) { if (scope === void 0) { scope = src_scope.ANY; } return this.registry.query(query, scope); }; ScrollBlot.prototype.register = function () { var _a; var definitions = []; for (var _i = 0; _i < arguments.length; _i++) { definitions[_i] = arguments[_i]; } return (_a = this.registry).register.apply(_a, definitions); }; ScrollBlot.prototype.build = function () { if (this.scroll == null) { return; } _super.prototype.build.call(this); }; ScrollBlot.prototype.detach = function () { _super.prototype.detach.call(this); this.observer.disconnect(); }; ScrollBlot.prototype.deleteAt = function (index, length) { this.update(); if (index === 0 && length === this.length()) { this.children.forEach(function (child) { child.remove(); }); } else { _super.prototype.deleteAt.call(this, index, length); } }; ScrollBlot.prototype.formatAt = function (index, length, name, value) { this.update(); _super.prototype.formatAt.call(this, index, length, name, value); }; ScrollBlot.prototype.insertAt = function (index, value, def) { this.update(); _super.prototype.insertAt.call(this, index, value, def); }; ScrollBlot.prototype.optimize = function (mutations, context) { var _this = this; if (mutations === void 0) { mutations = []; } if (context === void 0) { context = {}; } _super.prototype.optimize.call(this, context); var mutationsMap = context.mutationsMap || new WeakMap(); // We must modify mutations directly, cannot make copy and then modify var records = Array.from(this.observer.takeRecords()); // Array.push currently seems to be implemented by a non-tail recursive function // so we cannot just mutations.push.apply(mutations, this.observer.takeRecords()); while (records.length > 0) { mutations.push(records.pop()); } var mark = function mark(blot, markParent) { if (markParent === void 0) { markParent = true; } if (blot == null || blot === _this) { return; } if (blot.domNode.parentNode == null) { return; } if (!mutationsMap.has(blot.domNode)) { mutationsMap.set(blot.domNode, []); } if (markParent) { mark(blot.parent); } }; var optimize = function optimize(blot) { // Post-order traversal if (!mutationsMap.has(blot.domNode)) { return; } if (blot instanceof abstract_parent) { blot.children.forEach(optimize); } mutationsMap.delete(blot.domNode); blot.optimize(context); }; var remaining = mutations; for (var i = 0; remaining.length > 0; i += 1) { if (i >= MAX_OPTIMIZE_ITERATIONS) { throw new Error('[Parchment] Maximum optimize iterations reached'); } remaining.forEach(function (mutation) { var blot = _this.find(mutation.target, true); if (blot == null) { return; } if (blot.domNode === mutation.target) { if (mutation.type === 'childList') { mark(_this.find(mutation.previousSibling, false)); Array.from(mutation.addedNodes).forEach(function (node) { var child = _this.find(node, false); mark(child, false); if (child instanceof abstract_parent) { child.children.forEach(function (grandChild) { mark(grandChild, false); }); } }); } else if (mutation.type === 'attributes') { mark(blot.prev); } } mark(blot); }); this.children.forEach(optimize); remaining = Array.from(this.observer.takeRecords()); records = remaining.slice(); while (records.length > 0) { mutations.push(records.pop()); } } }; ScrollBlot.prototype.update = function (mutations, context) { var _this = this; if (context === void 0) { context = {}; } mutations = mutations || this.observer.takeRecords(); var mutationsMap = new WeakMap(); mutations.map(function (mutation) { var blot = registry.find(mutation.target, true); if (blot == null) { return null; } if (mutationsMap.has(blot.domNode)) { mutationsMap.get(blot.domNode).push(mutation); return null; } else { mutationsMap.set(blot.domNode, [mutation]); return blot; } }).forEach(function (blot) { if (blot != null && blot !== _this && mutationsMap.has(blot.domNode)) { blot.update(mutationsMap.get(blot.domNode) || [], context); } }); context.mutationsMap = mutationsMap; if (mutationsMap.has(this.domNode)) { _super.prototype.update.call(this, mutationsMap.get(this.domNode), context); } this.optimize(mutations, context); }; ScrollBlot.blotName = 'scroll'; ScrollBlot.defaultChild = block; ScrollBlot.allowedChildren = [block, container]; ScrollBlot.scope = src_scope.BLOCK_BLOT; ScrollBlot.tagName = 'DIV'; return ScrollBlot; }(abstract_parent); /* harmony default export */ var blot_scroll = (scroll_ScrollBlot); // CONCATENATED MODULE: ./node_modules/parchment/src/blot/text.ts var text_extends = undefined && undefined.__extends || function () { var _extendStatics = function extendStatics(d, b) { _extendStatics = Object.setPrototypeOf || { __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; } || function (d, b) { for (var p in b) { if (b.hasOwnProperty(p)) d[p] = b[p]; } }; return _extendStatics(d, b); }; return function (d, b) { _extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; }(); var text_TextBlot = /** @class */ function (_super) { text_extends(TextBlot, _super); function TextBlot(scroll, node) { var _this = _super.call(this, scroll, node) || this; _this.text = _this.statics.value(_this.domNode); return _this; } TextBlot.create = function (value) { return document.createTextNode(value); }; TextBlot.value = function (domNode) { return domNode.data; }; TextBlot.prototype.deleteAt = function (index, length) { this.domNode.data = this.text = this.text.slice(0, index) + this.text.slice(index + length); }; TextBlot.prototype.index = function (node, offset) { if (this.domNode === node) { return offset; } return -1; }; TextBlot.prototype.insertAt = function (index, value, def) { if (def == null) { this.text = this.text.slice(0, index) + value + this.text.slice(index); this.domNode.data = this.text; } else { _super.prototype.insertAt.call(this, index, value, def); } }; TextBlot.prototype.length = function () { return this.text.length; }; TextBlot.prototype.optimize = function (context) { _super.prototype.optimize.call(this, context); this.text = this.statics.value(this.domNode); if (this.text.length === 0) { this.remove(); } else if (this.next instanceof TextBlot && this.next.prev === this) { this.insertAt(this.length(), this.next.value()); this.next.remove(); } }; TextBlot.prototype.position = function (index, _inclusive) { if (_inclusive === void 0) { _inclusive = false; } return [this.domNode, index]; }; TextBlot.prototype.split = function (index, force) { if (force === void 0) { force = false; } if (!force) { if (index === 0) { return this; } if (index === this.length()) { return this.next; } } var after = this.scroll.create(this.domNode.splitText(index)); this.parent.insertBefore(after, this.next || undefined); this.text = this.statics.value(this.domNode); return after; }; TextBlot.prototype.update = function (mutations, _context) { var _this = this; if (mutations.some(function (mutation) { return mutation.type === 'characterData' && mutation.target === _this.domNode; })) { this.text = this.statics.value(this.domNode); } }; TextBlot.prototype.value = function () { return this.text; }; TextBlot.blotName = 'text'; TextBlot.scope = src_scope.INLINE_BLOT; return TextBlot; }(leaf); /* harmony default export */ var blot_text = (text_TextBlot); // CONCATENATED MODULE: ./node_modules/parchment/src/parchment.ts /***/ }), /* 3 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(64); /* harmony import */ var eventemitter3__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(eventemitter3__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var _utils_hasWindow__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(10); /* harmony import */ var _instances__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(29); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(15); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var debug = Object(_logger__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])('quill:events'); var EVENTS = ['selectionchange', 'mousedown', 'mouseup', 'click']; if (Object(_utils_hasWindow__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"])()) { EVENTS.forEach(function (eventName) { document.addEventListener(eventName, function () { for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) { args[_key] = arguments[_key]; } Array.from(document.querySelectorAll('.ql-container')).forEach(function (node) { var quill = _instances__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"].get(node); if (quill && quill.emitter) { var _quill$emitter; (_quill$emitter = quill.emitter).handleDOM.apply(_quill$emitter, args); } }); }); }); } var Emitter = /*#__PURE__*/function (_EventEmitter) { _inherits(Emitter, _EventEmitter); var _super = _createSuper(Emitter); function Emitter() { var _this; _classCallCheck(this, Emitter); _this = _super.call(this); _this.listeners = {}; _this.on('error', debug.error); return _this; } _createClass(Emitter, [{ key: "emit", value: function emit() { var _debug$log, _get2; for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) { args[_key2] = arguments[_key2]; } (_debug$log = debug.log).call.apply(_debug$log, [debug].concat(args)); (_get2 = _get(_getPrototypeOf(Emitter.prototype), "emit", this)).call.apply(_get2, [this].concat(args)); } }, { key: "handleDOM", value: function handleDOM(event) { for (var _len3 = arguments.length, args = new Array(_len3 > 1 ? _len3 - 1 : 0), _key3 = 1; _key3 < _len3; _key3++) { args[_key3 - 1] = arguments[_key3]; } (this.listeners[event.type] || []).forEach(function (_ref) { var node = _ref.node, handler = _ref.handler; if (event.target === node || node.contains(event.target)) { handler.apply(void 0, [event].concat(args)); } }); } }, { key: "listenDOM", value: function listenDOM(eventName, node, handler) { if (!this.listeners[eventName]) { this.listeners[eventName] = []; } this.listeners[eventName].push({ node: node, handler: handler }); } }]); return Emitter; }(eventemitter3__WEBPACK_IMPORTED_MODULE_0___default.a); Emitter.events = { EDITOR_CHANGE: 'editor-change', SCROLL_BEFORE_UPDATE: 'scroll-before-update', SCROLL_BLOT_MOUNT: 'scroll-blot-mount', SCROLL_BLOT_UNMOUNT: 'scroll-blot-unmount', SCROLL_OPTIMIZE: 'scroll-optimize', SCROLL_UPDATE: 'scroll-update', SELECTION_CHANGE: 'selection-change', TEXT_CHANGE: 'text-change' }; Emitter.sources = { API: 'api', SILENT: 'silent', USER: 'user' }; /* harmony default export */ __webpack_exports__["a"] = (Emitter); /***/ }), /* 4 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var lodash_clonedeep__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12); /* harmony import */ var lodash_clonedeep__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_clonedeep__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var lodash_isequal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(19); /* harmony import */ var lodash_isequal__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isequal__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(26); /* harmony import */ var lodash_merge__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_merge__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var quill_delta__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(0); /* harmony import */ var quill_delta__WEBPACK_IMPORTED_MODULE_3___default = /*#__PURE__*/__webpack_require__.n(quill_delta__WEBPACK_IMPORTED_MODULE_3__); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(2); /* harmony import */ var _selection__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(6); /* harmony import */ var _blots_cursor__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(17); /* harmony import */ var _blots_block__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(5); /* harmony import */ var _blots_break__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(8); /* harmony import */ var _blots_text__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(7); function _toArray(arr) { return _arrayWithHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableRest(); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var ASCII = /^[ -~]*$/; var Editor = /*#__PURE__*/function () { function Editor(scroll) { _classCallCheck(this, Editor); this.scroll = scroll; this.delta = this.getDelta(); } _createClass(Editor, [{ key: "applyDelta", value: function applyDelta(delta) { var _this = this; var consumeNextNewline = false; this.scroll.update(); var scrollLength = this.scroll.length(); this.scroll.batchStart(); var normalizedDelta = normalizeDelta(delta); normalizedDelta.reduce(function (index, op) { var length = op.retain || op.delete || op.insert.length || 1; var attributes = op.attributes || {}; if (op.insert != null) { if (typeof op.insert === 'string') { var text = op.insert; if (text.endsWith('\n') && consumeNextNewline) { consumeNextNewline = false; text = text.slice(0, -1); } if ((index >= scrollLength || _this.scroll.descendant(_blots_block__WEBPACK_IMPORTED_MODULE_7__[/* BlockEmbed */ "a"], index)[0]) && !text.endsWith('\n')) { consumeNextNewline = true; } _this.scroll.insertAt(index, text); var _this$scroll$line = _this.scroll.line(index), _this$scroll$line2 = _slicedToArray(_this$scroll$line, 2), line = _this$scroll$line2[0], offset = _this$scroll$line2[1]; var formats = lodash_merge__WEBPACK_IMPORTED_MODULE_2___default()({}, Object(_blots_block__WEBPACK_IMPORTED_MODULE_7__[/* bubbleFormats */ "c"])(line)); if (line instanceof _blots_block__WEBPACK_IMPORTED_MODULE_7__[/* default */ "d"]) { var _line$descendant = line.descendant(parchment__WEBPACK_IMPORTED_MODULE_4__["LeafBlot"], offset), _line$descendant2 = _slicedToArray(_line$descendant, 1), leaf = _line$descendant2[0]; formats = lodash_merge__WEBPACK_IMPORTED_MODULE_2___default()(formats, Object(_blots_block__WEBPACK_IMPORTED_MODULE_7__[/* bubbleFormats */ "c"])(leaf)); } attributes = quill_delta__WEBPACK_IMPORTED_MODULE_3__["AttributeMap"].diff(formats, attributes) || {}; } else if (_typeof(op.insert) === 'object') { var key = Object.keys(op.insert)[0]; // There should only be one key if (key == null) return index; _this.scroll.insertAt(index, key, op.insert[key]); } scrollLength += length; } Object.keys(attributes).forEach(function (name) { _this.scroll.formatAt(index, length, name, attributes[name]); }); return index + length; }, 0); normalizedDelta.reduce(function (index, op) { if (typeof op.delete === 'number') { _this.scroll.deleteAt(index, op.delete); return index; } return index + (op.retain || op.insert.length || 1); }, 0); this.scroll.batchEnd(); this.scroll.optimize(); return this.update(normalizedDelta); } }, { key: "deleteText", value: function deleteText(index, length) { this.scroll.deleteAt(index, length); return this.update(new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a().retain(index).delete(length)); } }, { key: "formatLine", value: function formatLine(index, length) { var _this2 = this; var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; this.scroll.update(); Object.keys(formats).forEach(function (format) { _this2.scroll.lines(index, Math.max(length, 1)).forEach(function (line) { line.format(format, formats[format]); }); }); this.scroll.optimize(); var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a().retain(index).retain(length, lodash_clonedeep__WEBPACK_IMPORTED_MODULE_0___default()(formats)); return this.update(delta); } }, { key: "formatText", value: function formatText(index, length) { var _this3 = this; var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; Object.keys(formats).forEach(function (format) { _this3.scroll.formatAt(index, length, format, formats[format]); }); var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a().retain(index).retain(length, lodash_clonedeep__WEBPACK_IMPORTED_MODULE_0___default()(formats)); return this.update(delta); } }, { key: "getContents", value: function getContents(index, length) { return this.delta.slice(index, index + length); } }, { key: "getDelta", value: function getDelta() { return this.scroll.lines().reduce(function (delta, line) { return delta.concat(line.delta()); }, new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a()); } }, { key: "getFormat", value: function getFormat(index) { var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var lines = []; var leaves = []; if (length === 0) { this.scroll.path(index).forEach(function (path) { var _path = _slicedToArray(path, 1), blot = _path[0]; if (blot instanceof _blots_block__WEBPACK_IMPORTED_MODULE_7__[/* default */ "d"]) { lines.push(blot); } else if (blot instanceof parchment__WEBPACK_IMPORTED_MODULE_4__["LeafBlot"]) { leaves.push(blot); } }); } else { lines = this.scroll.lines(index, length); leaves = this.scroll.descendants(parchment__WEBPACK_IMPORTED_MODULE_4__["LeafBlot"], index, length); } var _map = [lines, leaves].map(function (blots) { if (blots.length === 0) return {}; var formats = Object(_blots_block__WEBPACK_IMPORTED_MODULE_7__[/* bubbleFormats */ "c"])(blots.shift()); while (Object.keys(formats).length > 0) { var blot = blots.shift(); if (blot == null) return formats; formats = combineFormats(Object(_blots_block__WEBPACK_IMPORTED_MODULE_7__[/* bubbleFormats */ "c"])(blot), formats); } return formats; }); var _map2 = _slicedToArray(_map, 2); lines = _map2[0]; leaves = _map2[1]; return _objectSpread(_objectSpread({}, lines), leaves); } }, { key: "getHTML", value: function getHTML(index, length) { var _this$scroll$line3 = this.scroll.line(index), _this$scroll$line4 = _slicedToArray(_this$scroll$line3, 2), line = _this$scroll$line4[0], lineOffset = _this$scroll$line4[1]; if (line.length() >= lineOffset + length) { return convertHTML(line, lineOffset, length, true); } return convertHTML(this.scroll, index, length, true); } }, { key: "getText", value: function getText(index, length) { return this.getContents(index, length).filter(function (op) { return typeof op.insert === 'string'; }).map(function (op) { return op.insert; }).join(''); } }, { key: "insertEmbed", value: function insertEmbed(index, embed, value) { this.scroll.insertAt(index, embed, value); return this.update(new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a().retain(index).insert(_defineProperty({}, embed, value))); } }, { key: "insertText", value: function insertText(index, text) { var _this4 = this; var formats = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; text = text.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); this.scroll.insertAt(index, text); Object.keys(formats).forEach(function (format) { _this4.scroll.formatAt(index, text.length, format, formats[format]); }); return this.update(new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a().retain(index).insert(text, lodash_clonedeep__WEBPACK_IMPORTED_MODULE_0___default()(formats))); } }, { key: "isBlank", value: function isBlank() { if (this.scroll.children.length === 0) return true; if (this.scroll.children.length > 1) return false; var block = this.scroll.children.head; if (block.statics.blotName !== _blots_block__WEBPACK_IMPORTED_MODULE_7__[/* default */ "d"].blotName) return false; if (block.children.length > 1) return false; return block.children.head instanceof _blots_break__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"]; } }, { key: "removeFormat", value: function removeFormat(index, length) { var text = this.getText(index, length); var _this$scroll$line5 = this.scroll.line(index + length), _this$scroll$line6 = _slicedToArray(_this$scroll$line5, 2), line = _this$scroll$line6[0], offset = _this$scroll$line6[1]; var suffixLength = 0; var suffix = new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a(); if (line != null) { suffixLength = line.length() - offset; suffix = line.delta().slice(offset, offset + suffixLength - 1).insert('\n'); } var contents = this.getContents(index, length + suffixLength); var diff = contents.diff(new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a().insert(text).concat(suffix)); var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a().retain(index).concat(diff); return this.applyDelta(delta); } }, { key: "update", value: function update(change) { var mutations = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : []; var selectionInfo = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : undefined; var oldDelta = this.delta; if (mutations.length === 1 && mutations[0].type === 'characterData' && mutations[0].target.data.match(ASCII) && this.scroll.find(mutations[0].target)) { // Optimization for character changes var textBlot = this.scroll.find(mutations[0].target); var _formats = Object(_blots_block__WEBPACK_IMPORTED_MODULE_7__[/* bubbleFormats */ "c"])(textBlot); var index = textBlot.offset(this.scroll); var oldValue = mutations[0].oldValue.replace(_blots_cursor__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].CONTENTS, ''); var oldText = new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a().insert(oldValue); var newText = new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a().insert(textBlot.value()); var relativeSelectionInfo = selectionInfo && { oldRange: shiftRange(selectionInfo.oldRange, -index), newRange: shiftRange(selectionInfo.newRange, -index) }; var diffDelta = new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a().retain(index).concat(oldText.diff(newText, relativeSelectionInfo)); change = diffDelta.reduce(function (delta, op) { if (op.insert) { return delta.insert(op.insert, _formats); } return delta.push(op); }, new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a()); this.delta = oldDelta.compose(change); } else { this.delta = this.getDelta(); if (!change || !lodash_isequal__WEBPACK_IMPORTED_MODULE_1___default()(oldDelta.compose(change), this.delta)) { change = oldDelta.diff(this.delta, selectionInfo); } } return change; } }]); return Editor; }(); function convertListHTML(items, lastIndent, types) { if (items.length === 0) { var _getListType = getListType(types.pop()), _getListType2 = _slicedToArray(_getListType, 1), _endTag = _getListType2[0]; if (lastIndent <= 0) { return "</li></".concat(_endTag, ">"); } return "</li></".concat(_endTag, ">").concat(convertListHTML([], lastIndent - 1, types)); } var _items = _toArray(items), _items$ = _items[0], child = _items$.child, offset = _items$.offset, length = _items$.length, indent = _items$.indent, type = _items$.type, rest = _items.slice(1); var _getListType3 = getListType(type, child), _getListType4 = _slicedToArray(_getListType3, 2), tag = _getListType4[0], attribute = _getListType4[1]; if (indent > lastIndent) { types.push(type); if (indent === lastIndent + 1) { return "<".concat(tag, "><li").concat(attribute, ">").concat(convertHTML(child, offset, length)).concat(convertListHTML(rest, indent, types)); } return "<".concat(tag, "><li>").concat(convertListHTML(items, lastIndent + 1, types)); } var previousType = types[types.length - 1]; if (indent === lastIndent && type === previousType) { return "</li><li".concat(attribute, ">").concat(convertHTML(child, offset, length)).concat(convertListHTML(rest, indent, types)); } var _getListType5 = getListType(types.pop()), _getListType6 = _slicedToArray(_getListType5, 1), endTag = _getListType6[0]; return "</li></".concat(endTag, ">").concat(convertListHTML(items, lastIndent - 1, types)); } function convertHTML(blot, index, length) { var isRoot = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : false; if (typeof blot.html === 'function') { return blot.html(index, length); } if (blot instanceof _blots_text__WEBPACK_IMPORTED_MODULE_9__[/* default */ "a"]) { return Object(_blots_text__WEBPACK_IMPORTED_MODULE_9__[/* escapeText */ "b"])(blot.value().slice(index, index + length)); } if (blot.children) { // TODO fix API if (blot.statics.blotName === 'list-container') { var items = []; blot.children.forEachAt(index, length, function (child, offset, childLength) { var formats = child.formats(); items.push({ child: child, offset: offset, length: childLength, indent: formats.indent || 0, type: formats.list }); }); return convertListHTML(items, -1, []); } var parts = []; blot.children.forEachAt(index, length, function (child, offset, childLength) { parts.push(convertHTML(child, offset, childLength)); }); handleBreakLine(blot.children, parts); if (isRoot || blot.statics.blotName === 'list') { return parts.join(''); } var _blot$domNode = blot.domNode, outerHTML = _blot$domNode.outerHTML, innerHTML = _blot$domNode.innerHTML; var _outerHTML$split = outerHTML.split(">".concat(innerHTML, "<")), _outerHTML$split2 = _slicedToArray(_outerHTML$split, 2), start = _outerHTML$split2[0], end = _outerHTML$split2[1]; // TODO cleanup if (start === '<table') { return "<table style=\"border: 1px solid #000;\">".concat(parts.join(''), "<").concat(end); } return "".concat(start, ">").concat(parts.join(''), "<").concat(end); } return blot.domNode.outerHTML; } function handleBreakLine(linkedList, parts) { if (linkedList.length === 1 && linkedList.head instanceof _blots_break__WEBPACK_IMPORTED_MODULE_8__[/* default */ "a"]) { parts.push('<br>'); } } function combineFormats(formats, combined) { return Object.keys(combined).reduce(function (merged, name) { if (formats[name] == null) return merged; if (combined[name] === formats[name]) { merged[name] = combined[name]; } else if (Array.isArray(combined[name])) { if (combined[name].indexOf(formats[name]) < 0) { merged[name] = combined[name].concat([formats[name]]); } } else { merged[name] = [combined[name], formats[name]]; } return merged; }, {}); } function getListType(type, child) { var tag = type === 'ordered' ? 'ol' : 'ul'; var attributes = child ? "".concat(getBlotNodeAttributes(child)) : ''; switch (type) { case 'checked': return [tag, "".concat(attributes, " data-list=\"checked\"")]; case 'unchecked': return [tag, "".concat(attributes, " data-list=\"unchecked\"")]; default: return [tag, attributes]; } } function getBlotNodeAttributes(_ref) { var domNode = _ref.domNode; if (!domNode.hasAttributes()) { return ''; } var attributes = domNode.attributes; var attributesString = ' '; for (var i = 0; i < attributes.length; i += 1) { var name = attributes[i].name; var value = attributes[i].value; if (name === 'class') { value = removeIndentClass(value); } if (value.length && name.indexOf('data-') === -1) { attributesString += "".concat(name, "=\"").concat(value, "\""); } } return attributesString.length > 1 ? attributesString : ''; } function removeIndentClass(classString) { return classString.replace(/ql-indent-\d/g, '').trim(); } function normalizeDelta(delta) { return delta.reduce(function (normalizedDelta, op) { if (typeof op.insert === 'string') { var text = op.insert.replace(/\r\n/g, '\n').replace(/\r/g, '\n'); return normalizedDelta.insert(text, op.attributes); } return normalizedDelta.push(op); }, new quill_delta__WEBPACK_IMPORTED_MODULE_3___default.a()); } function shiftRange(_ref2, amount) { var index = _ref2.index, length = _ref2.length; return new _selection__WEBPACK_IMPORTED_MODULE_5__[/* Range */ "a"](index + amount, length); } /* harmony default export */ __webpack_exports__["a"] = (Editor); /***/ }), /* 5 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return blockDelta; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return bubbleFormats; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BlockEmbed; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "d", function() { return Block; }); /* harmony import */ var quill_delta__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /* harmony import */ var quill_delta__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(quill_delta__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(8); /* harmony import */ var _inline__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9); /* harmony import */ var _text__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var NEWLINE_LENGTH = 1; var Block = /*#__PURE__*/function (_BlockBlot) { _inherits(Block, _BlockBlot); var _super = _createSuper(Block); function Block(scroll, domNode) { var _this; _classCallCheck(this, Block); _this = _super.call(this, scroll, domNode); _this.cache = {}; return _this; } _createClass(Block, [{ key: "delta", value: function delta() { if (this.cache.delta == null) { this.cache.delta = blockDelta(this); } return this.cache.delta; } }, { key: "deleteAt", value: function deleteAt(index, length) { _get(_getPrototypeOf(Block.prototype), "deleteAt", this).call(this, index, length); this.cache = {}; } }, { key: "formatAt", value: function formatAt(index, length, name, value) { if (length <= 0) return; if (this.scroll.query(name, parchment__WEBPACK_IMPORTED_MODULE_1__["Scope"].BLOCK)) { if (index + length === this.length()) { this.format(name, value); } } else { _get(_getPrototypeOf(Block.prototype), "formatAt", this).call(this, index, Math.min(length, this.length() - index - 1), name, value); } this.cache = {}; } }, { key: "insertAt", value: function insertAt(index, value, def) { if (def != null) { _get(_getPrototypeOf(Block.prototype), "insertAt", this).call(this, index, value, def); this.cache = {}; return; } if (value.length === 0) return; var lines = value.split('\n'); var text = lines.shift(); if (text.length > 0) { if (index < this.length() - 1 || this.children.tail == null) { _get(_getPrototypeOf(Block.prototype), "insertAt", this).call(this, Math.min(index, this.length() - 1), text); } else { this.children.tail.insertAt(this.children.tail.length(), text); } this.cache = {}; } var block = this; lines.reduce(function (lineIndex, line) { block = block.split(lineIndex, true); block.insertAt(0, line); return line.length; }, index + text.length); } }, { key: "insertBefore", value: function insertBefore(blot, ref) { var head = this.children.head; _get(_getPrototypeOf(Block.prototype), "insertBefore", this).call(this, blot, ref); if (head instanceof _break__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"]) { head.remove(); } this.cache = {}; } }, { key: "length", value: function length() { if (this.cache.length == null) { this.cache.length = _get(_getPrototypeOf(Block.prototype), "length", this).call(this) + NEWLINE_LENGTH; } return this.cache.length; } }, { key: "moveChildren", value: function moveChildren(target, ref) { _get(_getPrototypeOf(Block.prototype), "moveChildren", this).call(this, target, ref); this.cache = {}; } }, { key: "optimize", value: function optimize(context) { _get(_getPrototypeOf(Block.prototype), "optimize", this).call(this, context); this.cache = {}; } }, { key: "path", value: function path(index) { return _get(_getPrototypeOf(Block.prototype), "path", this).call(this, index, true); } }, { key: "removeChild", value: function removeChild(child) { _get(_getPrototypeOf(Block.prototype), "removeChild", this).call(this, child); this.cache = {}; } }, { key: "split", value: function split(index) { var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (force && (index === 0 || index >= this.length() - NEWLINE_LENGTH)) { var clone = this.clone(); if (index === 0) { this.parent.insertBefore(clone, this); return this; } this.parent.insertBefore(clone, this.next); return clone; } var next = _get(_getPrototypeOf(Block.prototype), "split", this).call(this, index, force); this.cache = {}; return next; } }]); return Block; }(parchment__WEBPACK_IMPORTED_MODULE_1__["BlockBlot"]); Block.blotName = 'block'; Block.tagName = 'P'; Block.defaultChild = _break__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"]; Block.allowedChildren = [_break__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"], _inline__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"], parchment__WEBPACK_IMPORTED_MODULE_1__["EmbedBlot"], _text__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]]; var BlockEmbed = /*#__PURE__*/function (_EmbedBlot) { _inherits(BlockEmbed, _EmbedBlot); var _super2 = _createSuper(BlockEmbed); function BlockEmbed() { _classCallCheck(this, BlockEmbed); return _super2.apply(this, arguments); } _createClass(BlockEmbed, [{ key: "attach", value: function attach() { _get(_getPrototypeOf(BlockEmbed.prototype), "attach", this).call(this); this.attributes = new parchment__WEBPACK_IMPORTED_MODULE_1__["AttributorStore"](this.domNode); } }, { key: "delta", value: function delta() { return new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a().insert(this.value(), _objectSpread(_objectSpread({}, this.formats()), this.attributes.values())); } }, { key: "format", value: function format(name, value) { var attribute = this.scroll.query(name, parchment__WEBPACK_IMPORTED_MODULE_1__["Scope"].BLOCK_ATTRIBUTE); if (attribute != null) { this.attributes.attribute(attribute, value); } } }, { key: "formatAt", value: function formatAt(index, length, name, value) { this.format(name, value); } }, { key: "insertAt", value: function insertAt(index, value, def) { if (typeof value === 'string' && value.endsWith('\n')) { var block = this.scroll.create(Block.blotName); this.parent.insertBefore(block, index === 0 ? this : this.next); block.insertAt(0, value.slice(0, -1)); } else { _get(_getPrototypeOf(BlockEmbed.prototype), "insertAt", this).call(this, index, value, def); } } }]); return BlockEmbed; }(parchment__WEBPACK_IMPORTED_MODULE_1__["EmbedBlot"]); BlockEmbed.scope = parchment__WEBPACK_IMPORTED_MODULE_1__["Scope"].BLOCK_BLOT; // It is important for cursor behavior BlockEmbeds use tags that are block level elements function blockDelta(blot) { var filter = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : true; return blot.descendants(parchment__WEBPACK_IMPORTED_MODULE_1__["LeafBlot"]).reduce(function (delta, leaf) { if (leaf.length() === 0) { return delta; } return delta.insert(leaf.value(), bubbleFormats(leaf, {}, filter)); }, new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a()).insert('\n', bubbleFormats(blot)); } function bubbleFormats(blot) { var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var filter = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : true; if (blot == null) return formats; if (typeof blot.formats === 'function') { formats = _objectSpread(_objectSpread({}, formats), blot.formats()); if (filter) { // exclude syntax highlighting from deltas and getFormat() delete formats['code-token']; } } if (blot.parent == null || blot.parent.statics.blotName === 'scroll' || blot.parent.statics.scope !== blot.statics.scope) { return formats; } return bubbleFormats(blot.parent, formats, filter); } /***/ }), /* 6 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Range; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Selection; }); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var lodash_clonedeep__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(12); /* harmony import */ var lodash_clonedeep__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_clonedeep__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var lodash_isequal__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(19); /* harmony import */ var lodash_isequal__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(lodash_isequal__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var _emitter__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(3); /* harmony import */ var _logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(15); function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _unsupportedIterableToArray(arr) || _nonIterableSpread(); } function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _iterableToArray(iter) { if (typeof Symbol !== "undefined" && Symbol.iterator in Object(iter)) return Array.from(iter); } function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) return _arrayLikeToArray(arr); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var debug = Object(_logger__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])('quill:selection'); var Range = function Range(index) { var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; _classCallCheck(this, Range); this.index = index; this.length = length; }; var Selection = /*#__PURE__*/function () { function Selection(scroll, emitter) { var _this = this; _classCallCheck(this, Selection); this.emitter = emitter; this.scroll = scroll; this.composing = false; this.mouseDown = false; this.root = this.scroll.domNode; this.cursor = this.scroll.create('cursor', this); // savedRange is last non-null range this.savedRange = new Range(0, 0); this.lastRange = this.savedRange; this.lastNative = null; this.handleComposition(); this.handleDragging(); this.emitter.listenDOM('selectionchange', document, function () { if (!_this.mouseDown && !_this.composing) { setTimeout(_this.update.bind(_this, _emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.USER), 1); } }); this.emitter.on(_emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].events.SCROLL_BEFORE_UPDATE, function () { if (!_this.hasFocus()) return; var native = _this.getNativeRange(); if (native == null) return; if (native.start.node === _this.cursor.textNode) return; // cursor.restore() will handle _this.emitter.once(_emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].events.SCROLL_UPDATE, function () { try { if (_this.root.contains(native.start.node) && _this.root.contains(native.end.node)) { _this.setNativeRange(native.start.node, native.start.offset, native.end.node, native.end.offset); } _this.update(_emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.SILENT); } catch (ignored) {// ignore } }); }); this.emitter.on(_emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].events.SCROLL_OPTIMIZE, function (mutations, context) { if (context.range) { var _context$range = context.range, _startNode = _context$range.startNode, _startOffset = _context$range.startOffset, endNode = _context$range.endNode, endOffset = _context$range.endOffset; _this.setNativeRange(_startNode, _startOffset, endNode, endOffset); _this.update(_emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.SILENT); } }); this.update(_emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.SILENT); } _createClass(Selection, [{ key: "handleComposition", value: function handleComposition() { var _this2 = this; this.root.addEventListener('compositionstart', function () { _this2.composing = true; _this2.scroll.batchStart(); }); this.root.addEventListener('compositionend', function () { _this2.scroll.batchEnd(); _this2.composing = false; if (_this2.cursor.parent) { var range = _this2.cursor.restore(); if (!range) return; setTimeout(function () { _this2.setNativeRange(range.startNode, range.startOffset, range.endNode, range.endOffset); }, 1); } }); } }, { key: "handleDragging", value: function handleDragging() { var _this3 = this; this.emitter.listenDOM('mousedown', document.body, function () { _this3.mouseDown = true; }); this.emitter.listenDOM('mouseup', document.body, function () { _this3.mouseDown = false; _this3.update(_emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.USER); }); } }, { key: "focus", value: function focus() { if (this.hasFocus()) return; this.root.focus(); this.setRange(this.savedRange); } }, { key: "format", value: function format(_format, value) { this.scroll.update(); var nativeRange = this.getNativeRange(); if (nativeRange == null || !nativeRange.native.collapsed || this.scroll.query(_format, parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].BLOCK)) return; if (nativeRange.start.node !== this.cursor.textNode) { var blot = this.scroll.find(nativeRange.start.node, false); if (blot == null) return; // TODO Give blot ability to not split if (blot instanceof parchment__WEBPACK_IMPORTED_MODULE_0__["LeafBlot"]) { var after = blot.split(nativeRange.start.offset); blot.parent.insertBefore(this.cursor, after); } else { blot.insertBefore(this.cursor, nativeRange.start.node); // Should never happen } this.cursor.attach(); } this.cursor.format(_format, value); this.scroll.optimize(); this.setNativeRange(this.cursor.textNode, this.cursor.textNode.data.length); this.update(); } }, { key: "getBounds", value: function getBounds(index) { var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 0; var scrollLength = this.scroll.length(); index = Math.min(index, scrollLength - 1); length = Math.min(index + length, scrollLength - 1) - index; var node; var _this$scroll$leaf = this.scroll.leaf(index), _this$scroll$leaf2 = _slicedToArray(_this$scroll$leaf, 2), leaf = _this$scroll$leaf2[0], offset = _this$scroll$leaf2[1]; if (leaf == null) return null; var _leaf$position = leaf.position(offset, true); var _leaf$position2 = _slicedToArray(_leaf$position, 2); node = _leaf$position2[0]; offset = _leaf$position2[1]; var range = document.createRange(); if (length > 0) { range.setStart(node, offset); var _this$scroll$leaf3 = this.scroll.leaf(index + length); var _this$scroll$leaf4 = _slicedToArray(_this$scroll$leaf3, 2); leaf = _this$scroll$leaf4[0]; offset = _this$scroll$leaf4[1]; if (leaf == null) return null; var _leaf$position3 = leaf.position(offset, true); var _leaf$position4 = _slicedToArray(_leaf$position3, 2); node = _leaf$position4[0]; offset = _leaf$position4[1]; range.setEnd(node, offset); return range.getBoundingClientRect(); } var side = 'left'; var rect; if (node instanceof Text) { if (offset < node.data.length) { range.setStart(node, offset); range.setEnd(node, offset + 1); } else { range.setStart(node, offset - 1); range.setEnd(node, offset); side = 'right'; } rect = range.getBoundingClientRect(); } else { rect = leaf.domNode.getBoundingClientRect(); if (offset > 0) side = 'right'; } return { bottom: rect.top + rect.height, height: rect.height, left: rect[side], right: rect[side], top: rect.top, width: 0 }; } }, { key: "getNativeRange", value: function getNativeRange() { var selection = document.getSelection(); if (selection == null || selection.rangeCount <= 0) return null; var nativeRange = selection.getRangeAt(0); if (nativeRange == null) return null; var range = this.normalizeNative(nativeRange); debug.info('getNativeRange', range); return range; } }, { key: "getRange", value: function getRange() { var normalized = this.getNativeRange(); if (normalized == null) return [null, null]; var range = this.normalizedToRange(normalized); return [range, normalized]; } }, { key: "hasFocus", value: function hasFocus() { return document.activeElement === this.root || contains(this.root, document.activeElement); } }, { key: "normalizedToRange", value: function normalizedToRange(range) { var _this4 = this; var positions = [[range.start.node, range.start.offset]]; if (!range.native.collapsed) { positions.push([range.end.node, range.end.offset]); } var indexes = positions.map(function (position) { var _position = _slicedToArray(position, 2), node = _position[0], offset = _position[1]; var blot = _this4.scroll.find(node, true); var index = blot.offset(_this4.scroll); if (offset === 0) { return index; } if (blot instanceof parchment__WEBPACK_IMPORTED_MODULE_0__["LeafBlot"]) { return index + blot.index(node, offset); } return index + blot.length(); }); var end = Math.min(Math.max.apply(Math, _toConsumableArray(indexes)), this.scroll.length() - 1); var start = Math.min.apply(Math, [end].concat(_toConsumableArray(indexes))); return new Range(start, end - start); } }, { key: "normalizeNative", value: function normalizeNative(nativeRange) { if (!contains(this.root, nativeRange.startContainer) || !nativeRange.collapsed && !contains(this.root, nativeRange.endContainer)) { return null; } var range = { start: { node: nativeRange.startContainer, offset: nativeRange.startOffset }, end: { node: nativeRange.endContainer, offset: nativeRange.endOffset }, native: nativeRange }; [range.start, range.end].forEach(function (position) { var node = position.node, offset = position.offset; while (!(node instanceof Text) && node.childNodes.length > 0) { if (node.childNodes.length > offset) { node = node.childNodes[offset]; offset = 0; } else if (node.childNodes.length === offset) { node = node.lastChild; if (node instanceof Text) { offset = node.data.length; } else if (node.childNodes.length > 0) { // Container case offset = node.childNodes.length; } else { // Embed case offset = node.childNodes.length + 1; } } else { break; } } position.node = node; position.offset = offset; }); return range; } }, { key: "rangeToNative", value: function rangeToNative(range) { var _this5 = this; var indexes = range.collapsed ? [range.index] : [range.index, range.index + range.length]; var args = []; var scrollLength = this.scroll.length(); indexes.forEach(function (index, i) { index = Math.min(scrollLength - 1, index); var _this5$scroll$leaf = _this5.scroll.leaf(index), _this5$scroll$leaf2 = _slicedToArray(_this5$scroll$leaf, 2), leaf = _this5$scroll$leaf2[0], leafOffset = _this5$scroll$leaf2[1]; var _leaf$position5 = leaf.position(leafOffset, i !== 0), _leaf$position6 = _slicedToArray(_leaf$position5, 2), node = _leaf$position6[0], offset = _leaf$position6[1]; args.push(node, offset); }); if (args.length < 2) { return args.concat(args); } return args; } }, { key: "scrollIntoView", value: function scrollIntoView(scrollingContainer) { var range = this.lastRange; if (range == null) return; var bounds = this.getBounds(range.index, range.length); if (bounds == null) return; var limit = this.scroll.length() - 1; var _this$scroll$line = this.scroll.line(Math.min(range.index, limit)), _this$scroll$line2 = _slicedToArray(_this$scroll$line, 1), first = _this$scroll$line2[0]; var last = first; if (range.length > 0) { var _this$scroll$line3 = this.scroll.line(Math.min(range.index + range.length, limit)); var _this$scroll$line4 = _slicedToArray(_this$scroll$line3, 1); last = _this$scroll$line4[0]; } if (first == null || last == null) return; var scrollBounds = scrollingContainer.getBoundingClientRect(); if (bounds.top < scrollBounds.top) { scrollingContainer.scrollTop -= scrollBounds.top - bounds.top; } else if (bounds.bottom > scrollBounds.bottom) { scrollingContainer.scrollTop += bounds.bottom - scrollBounds.bottom; } } }, { key: "setNativeRange", value: function setNativeRange(startNode, startOffset) { var endNode = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : startNode; var endOffset = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : startOffset; var force = arguments.length > 4 && arguments[4] !== undefined ? arguments[4] : false; debug.info('setNativeRange', startNode, startOffset, endNode, endOffset); if (startNode != null && (this.root.parentNode == null || startNode.parentNode == null || endNode.parentNode == null)) { return; } var selection = document.getSelection(); if (selection == null) return; if (startNode != null) { if (!this.hasFocus()) this.root.focus(); var _ref = this.getNativeRange() || {}, native = _ref.native; if (native == null || force || startNode !== native.startContainer || startOffset !== native.startOffset || endNode !== native.endContainer || endOffset !== native.endOffset) { if (startNode.tagName === 'BR') { startOffset = Array.from(startNode.parentNode.childNodes).indexOf(startNode); startNode = startNode.parentNode; } if (endNode.tagName === 'BR') { endOffset = Array.from(endNode.parentNode.childNodes).indexOf(endNode); endNode = endNode.parentNode; } var range = document.createRange(); range.setStart(startNode, startOffset); range.setEnd(endNode, endOffset); selection.removeAllRanges(); selection.addRange(range); } } else { selection.removeAllRanges(); this.root.blur(); document.body.focus(); // root.blur() not enough for IE11 } } }, { key: "setRange", value: function setRange(range) { var force = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.API; if (typeof force === 'string') { source = force; force = false; } debug.info('setRange', range); if (range != null) { var args = this.rangeToNative(range); this.setNativeRange.apply(this, _toConsumableArray(args).concat([force])); } else { this.setNativeRange(null); } this.update(source); } }, { key: "update", value: function update() { var source = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : _emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.USER; var oldRange = this.lastRange; var _this$getRange = this.getRange(), _this$getRange2 = _slicedToArray(_this$getRange, 2), lastRange = _this$getRange2[0], nativeRange = _this$getRange2[1]; this.lastRange = lastRange; this.lastNative = nativeRange; if (this.lastRange != null) { this.savedRange = this.lastRange; } if (!lodash_isequal__WEBPACK_IMPORTED_MODULE_2___default()(oldRange, this.lastRange)) { var _this$emitter; if (!this.composing && nativeRange != null && nativeRange.native.collapsed && nativeRange.start.node !== this.cursor.textNode) { var range = this.cursor.restore(); if (range) { this.setNativeRange(range.startNode, range.startOffset, range.endNode, range.endOffset); } } var args = [_emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].events.SELECTION_CHANGE, lodash_clonedeep__WEBPACK_IMPORTED_MODULE_1___default()(this.lastRange), lodash_clonedeep__WEBPACK_IMPORTED_MODULE_1___default()(oldRange), source]; (_this$emitter = this.emitter).emit.apply(_this$emitter, [_emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].events.EDITOR_CHANGE].concat(args)); if (source !== _emitter__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.SILENT) { var _this$emitter2; (_this$emitter2 = this.emitter).emit.apply(_this$emitter2, args); } } } }]); return Selection; }(); function contains(parent, descendant) { try { // Firefox inserts inaccessible nodes around video elements descendant.parentNode; // eslint-disable-line no-unused-expressions } catch (e) { return false; } // IE11 has bug with Text nodes // https://connect.microsoft.com/IE/feedback/details/780874/node-contains-is-incorrect if (descendant instanceof Text) { descendant = descendant.parentNode; } return parent.contains(descendant); } /***/ }), /* 7 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Text; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return escapeText; }); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(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"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var Text = /*#__PURE__*/function (_TextBlot) { _inherits(Text, _TextBlot); var _super = _createSuper(Text); function Text() { _classCallCheck(this, Text); return _super.apply(this, arguments); } return Text; }(parchment__WEBPACK_IMPORTED_MODULE_0__["TextBlot"]); function escapeText(text) { return text.replace(/[&<>"']/g, function (s) { // https://lodash.com/docs#escape var entityMap = { '&': '&amp;', '<': '&lt;', '>': '&gt;', '"': '&quot;', "'": '&#39;' }; return entityMap[s]; }); } /***/ }), /* 8 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var Break = /*#__PURE__*/function (_EmbedBlot) { _inherits(Break, _EmbedBlot); var _super = _createSuper(Break); function Break() { _classCallCheck(this, Break); return _super.apply(this, arguments); } _createClass(Break, [{ key: "optimize", value: function optimize() { if (this.prev || this.next) { this.remove(); } } }, { key: "length", value: function length() { return 0; } }, { key: "value", value: function value() { return ''; } }], [{ key: "value", value: function value() { return undefined; } }]); return Break; }(parchment__WEBPACK_IMPORTED_MODULE_0__["EmbedBlot"]); Break.blotName = 'break'; Break.tagName = 'BR'; /* harmony default export */ __webpack_exports__["a"] = (Break); /***/ }), /* 9 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8); /* harmony import */ var _text__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(7); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var Inline = /*#__PURE__*/function (_InlineBlot) { _inherits(Inline, _InlineBlot); var _super = _createSuper(Inline); function Inline() { _classCallCheck(this, Inline); return _super.apply(this, arguments); } _createClass(Inline, [{ key: "formatAt", value: function formatAt(index, length, name, value) { if (Inline.compare(this.statics.blotName, name) < 0 && this.scroll.query(name, parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].BLOT)) { var blot = this.isolate(index, length); if (value) { blot.wrap(name, value); } } else { _get(_getPrototypeOf(Inline.prototype), "formatAt", this).call(this, index, length, name, value); } } }, { key: "optimize", value: function optimize(context) { _get(_getPrototypeOf(Inline.prototype), "optimize", this).call(this, context); if (this.parent instanceof Inline && Inline.compare(this.statics.blotName, this.parent.statics.blotName) > 0) { var parent = this.parent.isolate(this.offset(), this.length()); this.moveChildren(parent); parent.wrap(this); } } }], [{ key: "compare", value: function compare(self, other) { var selfIndex = Inline.order.indexOf(self); var otherIndex = Inline.order.indexOf(other); if (selfIndex >= 0 || otherIndex >= 0) { return selfIndex - otherIndex; } if (self === other) { return 0; } if (self < other) { return -1; } return 1; } }]); return Inline; }(parchment__WEBPACK_IMPORTED_MODULE_0__["InlineBlot"]); Inline.allowedChildren = [Inline, _break__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], parchment__WEBPACK_IMPORTED_MODULE_0__["EmbedBlot"], _text__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"]]; // Lower index means deeper in the DOM tree, since not found (-1) is for embeds Inline.order = ['cursor', 'inline', // Must be lower 'link', // Chrome wants <a> to be lower 'underline', 'strike', 'italic', 'bold', 'script', 'code' // Must be higher ]; /* harmony default export */ __webpack_exports__["a"] = (Inline); /***/ }), /* 10 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var hasWindow = function hasWindow() { return typeof window !== 'undefined'; }; /* harmony default export */ __webpack_exports__["a"] = (hasWindow); /***/ }), /* 11 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } var Module = function Module(quill) { var options = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; _classCallCheck(this, Module); this.quill = quill; this.options = options; }; Module.DEFAULTS = {}; /* harmony default export */ __webpack_exports__["a"] = (Module); /***/ }), /* 12 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, module) {/** * lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright jQuery Foundation and other contributors <https://jquery.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', objectTag = '[object Object]', promiseTag = '[object Promise]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to match `RegExp` flags from their coerced string values. */ var reFlags = /\w*$/; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Used to identify `toStringTag` values supported by `_.clone`. */ var cloneableTags = {}; cloneableTags[argsTag] = cloneableTags[arrayTag] = cloneableTags[arrayBufferTag] = cloneableTags[dataViewTag] = cloneableTags[boolTag] = cloneableTags[dateTag] = cloneableTags[float32Tag] = cloneableTags[float64Tag] = cloneableTags[int8Tag] = cloneableTags[int16Tag] = cloneableTags[int32Tag] = cloneableTags[mapTag] = cloneableTags[numberTag] = cloneableTags[objectTag] = cloneableTags[regexpTag] = cloneableTags[setTag] = cloneableTags[stringTag] = cloneableTags[symbolTag] = cloneableTags[uint8Tag] = cloneableTags[uint8ClampedTag] = cloneableTags[uint16Tag] = cloneableTags[uint32Tag] = true; cloneableTags[errorTag] = cloneableTags[funcTag] = cloneableTags[weakMapTag] = false; /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** Detect free variable `exports`. */ var freeExports = true && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** * Adds the key-value `pair` to `map`. * * @private * @param {Object} map The map to modify. * @param {Array} pair The key-value pair to add. * @returns {Object} Returns `map`. */ function addMapEntry(map, pair) { // Don't return `map.set` because it's not chainable in IE 11. map.set(pair[0], pair[1]); return map; } /** * Adds `value` to `set`. * * @private * @param {Object} set The set to modify. * @param {*} value The value to add. * @returns {Object} Returns `set`. */ function addSetEntry(set, value) { // Don't return `set.add` because it's not chainable in IE 11. set.add(value); return set; } /** * A specialized version of `_.forEach` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns `array`. */ function arrayEach(array, iteratee) { var index = -1, length = array ? array.length : 0; while (++index < length) { if (iteratee(array[index], index, array) === false) { break; } } return array; } /** * Appends the elements of `values` to `array`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to append. * @returns {Array} Returns `array`. */ function arrayPush(array, values) { var index = -1, length = values.length, offset = array.length; while (++index < length) { array[offset + index] = values[index]; } return array; } /** * A specialized version of `_.reduce` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {*} [accumulator] The initial value. * @param {boolean} [initAccum] Specify using the first element of `array` as * the initial value. * @returns {*} Returns the accumulated value. */ function arrayReduce(array, iteratee, accumulator, initAccum) { var index = -1, length = array ? array.length : 0; if (initAccum && length) { accumulator = array[++index]; } while (++index < length) { accumulator = iteratee(accumulator, array[index], index, array); } return accumulator; } /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /** * Checks if `value` is a host object in IE < 9. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a host object, else `false`. */ function isHostObject(value) { // Many host objects are `Object` objects that can coerce to strings // despite having improperly defined `toString` methods. var result = false; if (value != null && typeof value.toString != 'function') { try { result = !!(value + ''); } catch (e) {} } return result; } /** * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } /** * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } /** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var objectToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ var Buffer = moduleExports ? root.Buffer : undefined, Symbol = root.Symbol, Uint8Array = root.Uint8Array, getPrototype = overArg(Object.getPrototypeOf, Object), objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols = Object.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeKeys = overArg(Object.keys, Object); /* Built-in method references that are verified to be native. */ var DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), Promise = getNative(root, 'Promise'), Set = getNative(root, 'Set'), WeakMap = getNative(root, 'WeakMap'), nativeCreate = getNative(Object, 'create'); /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; } /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { return this.has(key) && delete this.__data__[key]; } /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? data[key] !== undefined : hasOwnProperty.call(data, key); } /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; } /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } return true; } /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { data.push([key, value]); } else { data[index][1] = value; } return this; } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries ? entries.length : 0; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { return getMapData(this, key)['delete'](key); } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { getMapData(this, key).set(key, value); return this; } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { this.__data__ = new ListCache(entries); } /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = new ListCache; } /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { return this.__data__['delete'](key); } /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { return this.__data__.get(key); } /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { return this.__data__.has(key); } /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var cache = this.__data__; if (cache instanceof ListCache) { var pairs = cache.__data__; if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); return this; } cache = this.__data__ = new MapCache(pairs); } cache.set(key, value); return this; } // Add methods to `Stack`. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { // Safari 8.1 makes `arguments.callee` enumerable in strict mode. // Safari 9 makes `arguments.length` enumerable in strict mode. var result = (isArray(value) || isArguments(value)) ? baseTimes(value.length, String) : []; var length = result.length, skipIndexes = !!length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && (key == 'length' || isIndex(key, length)))) { result.push(key); } } return result; } /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignValue(object, key, value) { var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { object[key] = value; } } /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * The base implementation of `_.assign` without support for multiple sources * or `customizer` functions. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @returns {Object} Returns `object`. */ function baseAssign(object, source) { return object && copyObject(source, keys(source), object); } /** * The base implementation of `_.clone` and `_.cloneDeep` which tracks * traversed objects. * * @private * @param {*} value The value to clone. * @param {boolean} [isDeep] Specify a deep clone. * @param {boolean} [isFull] Specify a clone including symbols. * @param {Function} [customizer] The function to customize cloning. * @param {string} [key] The key of `value`. * @param {Object} [object] The parent object of `value`. * @param {Object} [stack] Tracks traversed objects and their clone counterparts. * @returns {*} Returns the cloned value. */ function baseClone(value, isDeep, isFull, customizer, key, object, stack) { var result; if (customizer) { result = object ? customizer(value, key, object, stack) : customizer(value); } if (result !== undefined) { return result; } if (!isObject(value)) { return value; } var isArr = isArray(value); if (isArr) { result = initCloneArray(value); if (!isDeep) { return copyArray(value, result); } } else { var tag = getTag(value), isFunc = tag == funcTag || tag == genTag; if (isBuffer(value)) { return cloneBuffer(value, isDeep); } if (tag == objectTag || tag == argsTag || (isFunc && !object)) { if (isHostObject(value)) { return object ? value : {}; } result = initCloneObject(isFunc ? {} : value); if (!isDeep) { return copySymbols(value, baseAssign(result, value)); } } else { if (!cloneableTags[tag]) { return object ? value : {}; } result = initCloneByTag(value, tag, baseClone, isDeep); } } // Check for circular references and return its corresponding clone. stack || (stack = new Stack); var stacked = stack.get(value); if (stacked) { return stacked; } stack.set(value, result); if (!isArr) { var props = isFull ? getAllKeys(value) : keys(value); } arrayEach(props || value, function(subValue, key) { if (props) { key = subValue; subValue = value[key]; } // Recursively populate clone (susceptible to call stack limits). assignValue(result, key, baseClone(subValue, isDeep, isFull, customizer, key, value, stack)); }); return result; } /** * The base implementation of `_.create` without support for assigning * properties to the created object. * * @private * @param {Object} prototype The object to inherit from. * @returns {Object} Returns the new object. */ function baseCreate(proto) { return isObject(proto) ? objectCreate(proto) : {}; } /** * The base implementation of `getAllKeys` and `getAllKeysIn` which uses * `keysFunc` and `symbolsFunc` to get the enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @param {Function} keysFunc The function to get the keys of `object`. * @param {Function} symbolsFunc The function to get the symbols of `object`. * @returns {Array} Returns the array of property names and symbols. */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); } /** * The base implementation of `getTag`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { return objectToString.call(value); } /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = (isFunction(value) || isHostObject(value)) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } /** * Creates a clone of `buffer`. * * @private * @param {Buffer} buffer The buffer to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Buffer} Returns the cloned buffer. */ function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var result = new buffer.constructor(buffer.length); buffer.copy(result); return result; } /** * Creates a clone of `arrayBuffer`. * * @private * @param {ArrayBuffer} arrayBuffer The array buffer to clone. * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneArrayBuffer(arrayBuffer) { var result = new arrayBuffer.constructor(arrayBuffer.byteLength); new Uint8Array(result).set(new Uint8Array(arrayBuffer)); return result; } /** * Creates a clone of `dataView`. * * @private * @param {Object} dataView The data view to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned data view. */ function cloneDataView(dataView, isDeep) { var buffer = isDeep ? cloneArrayBuffer(dataView.buffer) : dataView.buffer; return new dataView.constructor(buffer, dataView.byteOffset, dataView.byteLength); } /** * Creates a clone of `map`. * * @private * @param {Object} map The map to clone. * @param {Function} cloneFunc The function to clone values. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned map. */ function cloneMap(map, isDeep, cloneFunc) { var array = isDeep ? cloneFunc(mapToArray(map), true) : mapToArray(map); return arrayReduce(array, addMapEntry, new map.constructor); } /** * Creates a clone of `regexp`. * * @private * @param {Object} regexp The regexp to clone. * @returns {Object} Returns the cloned regexp. */ function cloneRegExp(regexp) { var result = new regexp.constructor(regexp.source, reFlags.exec(regexp)); result.lastIndex = regexp.lastIndex; return result; } /** * Creates a clone of `set`. * * @private * @param {Object} set The set to clone. * @param {Function} cloneFunc The function to clone values. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned set. */ function cloneSet(set, isDeep, cloneFunc) { var array = isDeep ? cloneFunc(setToArray(set), true) : setToArray(set); return arrayReduce(array, addSetEntry, new set.constructor); } /** * Creates a clone of the `symbol` object. * * @private * @param {Object} symbol The symbol object to clone. * @returns {Object} Returns the cloned symbol object. */ function cloneSymbol(symbol) { return symbolValueOf ? Object(symbolValueOf.call(symbol)) : {}; } /** * Creates a clone of `typedArray`. * * @private * @param {Object} typedArray The typed array to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } /** * Copies the values of `source` to `array`. * * @private * @param {Array} source The array to copy values from. * @param {Array} [array=[]] The array to copy values to. * @returns {Array} Returns `array`. */ function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } /** * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; assignValue(object, key, newValue === undefined ? source[key] : newValue); } return object; } /** * Copies own symbol properties of `source` to `object`. * * @private * @param {Object} source The object to copy symbols from. * @param {Object} [object={}] The object to copy symbols to. * @returns {Object} Returns `object`. */ function copySymbols(source, object) { return copyObject(source, getSymbols(source), object); } /** * Creates an array of own enumerable property names and symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeys(object) { return baseGetAllKeys(object, keys, getSymbols); } /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } /** * Creates an array of the own enumerable symbol properties of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbols = nativeGetSymbols ? overArg(nativeGetSymbols, Object) : stubArray; /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11, // for data views in Edge < 14, and promises in Node.js. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = objectToString.call(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : undefined; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } /** * Initializes an array clone. * * @private * @param {Array} array The array to clone. * @returns {Array} Returns the initialized clone. */ function initCloneArray(array) { var length = array.length, result = array.constructor(length); // Add properties assigned by `RegExp#exec`. if (length && typeof array[0] == 'string' && hasOwnProperty.call(array, 'index')) { result.index = array.index; result.input = array.input; } return result; } /** * Initializes an object clone. * * @private * @param {Object} object The object to clone. * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) ? baseCreate(getPrototype(object)) : {}; } /** * Initializes an object clone based on its `toStringTag`. * * **Note:** This function only supports cloning values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to clone. * @param {string} tag The `toStringTag` of the object to clone. * @param {Function} cloneFunc The function to clone values. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the initialized clone. */ function initCloneByTag(object, tag, cloneFunc, isDeep) { var Ctor = object.constructor; switch (tag) { case arrayBufferTag: return cloneArrayBuffer(object); case boolTag: case dateTag: return new Ctor(+object); case dataViewTag: return cloneDataView(object, isDeep); case float32Tag: case float64Tag: case int8Tag: case int16Tag: case int32Tag: case uint8Tag: case uint8ClampedTag: case uint16Tag: case uint32Tag: return cloneTypedArray(object, isDeep); case mapTag: return cloneMap(object, isDeep, cloneFunc); case numberTag: case stringTag: return new Ctor(object); case regexpTag: return cloneRegExp(object); case setTag: return cloneSet(object, isDeep, cloneFunc); case symbolTag: return cloneSymbol(object); } } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == 'number' || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } /** * Converts `func` to its source code. * * @private * @param {Function} func The function to process. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } /** * This method is like `_.clone` except that it recursively clones `value`. * * @static * @memberOf _ * @since 1.0.0 * @category Lang * @param {*} value The value to recursively clone. * @returns {*} Returns the deep cloned value. * @see _.clone * @example * * var objects = [{ 'a': 1 }, { 'b': 2 }]; * * var deep = _.cloneDeep(objects); * console.log(deep[0] === objects[0]); * // => false */ function cloneDeep(value) { return baseClone(value, true, true); } /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ function isArguments(value) { // Safari 8.1 makes `arguments.callee` enumerable in strict mode. return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') && (!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag); } /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = nativeIsBuffer || stubFalse; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 8-9 which returns 'object' for typed array and other constructors. var tag = isObject(value) ? objectToString.call(value) : ''; return tag == funcTag || tag == genTag; } /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return !!value && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return !!value && typeof value == 'object'; } /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** * This method returns a new empty array. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {Array} Returns the new empty array. * @example * * var arrays = _.times(2, _.stubArray); * * console.log(arrays); * // => [[], []] * * console.log(arrays[0] === arrays[1]); * // => false */ function stubArray() { return []; } /** * This method returns `false`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `false`. * @example * * _.times(2, _.stubFalse); * // => [false, false] */ function stubFalse() { return false; } module.exports = cloneDeep; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(41), __webpack_require__(45)(module))) /***/ }), /* 13 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Code; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return CodeBlockContainer; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return CodeBlock; }); /* harmony import */ var _blots_block__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(5); /* harmony import */ var _blots_break__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(8); /* harmony import */ var _blots_cursor__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(17); /* harmony import */ var _blots_inline__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(9); /* harmony import */ var _blots_text__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(7); /* harmony import */ var _blots_container__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(16); /* harmony import */ var _core_quill__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(1); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var CodeBlockContainer = /*#__PURE__*/function (_Container) { _inherits(CodeBlockContainer, _Container); var _super = _createSuper(CodeBlockContainer); function CodeBlockContainer() { _classCallCheck(this, CodeBlockContainer); return _super.apply(this, arguments); } _createClass(CodeBlockContainer, [{ key: "code", value: function code(index, length) { var text = this.children.map(function (child) { return child.length() <= 1 ? '' : child.domNode.innerText; }).join('\n').slice(index, index + length); return Object(_blots_text__WEBPACK_IMPORTED_MODULE_4__[/* escapeText */ "b"])(text); } }, { key: "html", value: function html(index, length) { // `\n`s are needed in order to support empty lines at the beginning and the end. // https://html.spec.whatwg.org/multipage/syntax.html#element-restrictions return "<pre>\n".concat(this.code(index, length), "\n</pre>"); } }], [{ key: "create", value: function create(value) { var domNode = _get(_getPrototypeOf(CodeBlockContainer), "create", this).call(this, value); domNode.setAttribute('spellcheck', false); return domNode; } }]); return CodeBlockContainer; }(_blots_container__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"]); var CodeBlock = /*#__PURE__*/function (_Block) { _inherits(CodeBlock, _Block); var _super2 = _createSuper(CodeBlock); function CodeBlock() { _classCallCheck(this, CodeBlock); return _super2.apply(this, arguments); } _createClass(CodeBlock, null, [{ key: "register", value: function register() { _core_quill__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"].register(CodeBlockContainer); } }]); return CodeBlock; }(_blots_block__WEBPACK_IMPORTED_MODULE_0__[/* default */ "d"]); var Code = /*#__PURE__*/function (_Inline) { _inherits(Code, _Inline); var _super3 = _createSuper(Code); function Code() { _classCallCheck(this, Code); return _super3.apply(this, arguments); } return Code; }(_blots_inline__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"]); Code.blotName = 'code'; Code.tagName = 'CODE'; CodeBlock.blotName = 'code-block'; CodeBlock.className = 'ql-code-block'; CodeBlock.tagName = 'DIV'; CodeBlockContainer.blotName = 'code-block-container'; CodeBlockContainer.className = 'ql-code-block-container'; CodeBlockContainer.tagName = 'DIV'; CodeBlockContainer.allowedChildren = [CodeBlock]; CodeBlock.allowedChildren = [_blots_text__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"], _blots_break__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"], _blots_cursor__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"]]; CodeBlock.requiredContainer = CodeBlockContainer; CodeBlock.TAB = ' '; /***/ }), /* 14 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var _core_emitter__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(3); /* harmony import */ var _block__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5); /* harmony import */ var _break__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(8); /* harmony import */ var _container__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(16); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } function isLine(blot) { return blot instanceof _block__WEBPACK_IMPORTED_MODULE_2__[/* default */ "d"] || blot instanceof _block__WEBPACK_IMPORTED_MODULE_2__[/* BlockEmbed */ "a"]; } var Scroll = /*#__PURE__*/function (_ScrollBlot) { _inherits(Scroll, _ScrollBlot); var _super = _createSuper(Scroll); function Scroll(registry, domNode, _ref) { var _this; var emitter = _ref.emitter; _classCallCheck(this, Scroll); _this = _super.call(this, registry, domNode); _this.emitter = emitter; _this.batch = false; _this.optimize(); _this.enable(); _this.domNode.addEventListener('dragstart', function (e) { return _this.handleDragStart(e); }); return _this; } _createClass(Scroll, [{ key: "batchStart", value: function batchStart() { if (!Array.isArray(this.batch)) { this.batch = []; } } }, { key: "batchEnd", value: function batchEnd() { var mutations = this.batch; this.batch = false; this.update(mutations); } }, { key: "emitMount", value: function emitMount(blot) { this.emitter.emit(_core_emitter__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].events.SCROLL_BLOT_MOUNT, blot); } }, { key: "emitUnmount", value: function emitUnmount(blot) { this.emitter.emit(_core_emitter__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].events.SCROLL_BLOT_UNMOUNT, blot); } }, { key: "deleteAt", value: function deleteAt(index, length) { var _this$line = this.line(index), _this$line2 = _slicedToArray(_this$line, 2), first = _this$line2[0], offset = _this$line2[1]; var _this$line3 = this.line(index + length), _this$line4 = _slicedToArray(_this$line3, 1), last = _this$line4[0]; _get(_getPrototypeOf(Scroll.prototype), "deleteAt", this).call(this, index, length); if (last != null && first !== last && offset > 0) { if (first instanceof _block__WEBPACK_IMPORTED_MODULE_2__[/* BlockEmbed */ "a"] || last instanceof _block__WEBPACK_IMPORTED_MODULE_2__[/* BlockEmbed */ "a"]) { this.optimize(); return; } var ref = last.children.head instanceof _break__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"] ? null : last.children.head; first.moveChildren(last, ref); first.remove(); } this.optimize(); } }, { key: "enable", value: function enable() { var enabled = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : true; this.domNode.setAttribute('contenteditable', enabled); } }, { key: "formatAt", value: function formatAt(index, length, format, value) { _get(_getPrototypeOf(Scroll.prototype), "formatAt", this).call(this, index, length, format, value); this.optimize(); } }, { key: "handleDragStart", value: function handleDragStart(event) { event.preventDefault(); } }, { key: "insertAt", value: function insertAt(index, value, def) { if (index >= this.length()) { if (def == null || this.scroll.query(value, parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].BLOCK) == null) { var blot = this.scroll.create(this.statics.defaultChild.blotName); this.appendChild(blot); if (def == null && value.endsWith('\n')) { blot.insertAt(0, value.slice(0, -1), def); } else { blot.insertAt(0, value, def); } } else { var embed = this.scroll.create(value, def); this.appendChild(embed); } } else { _get(_getPrototypeOf(Scroll.prototype), "insertAt", this).call(this, index, value, def); } this.optimize(); } }, { key: "insertBefore", value: function insertBefore(blot, ref) { if (blot.statics.scope === parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].INLINE_BLOT) { var wrapper = this.scroll.create(this.statics.defaultChild.blotName); wrapper.appendChild(blot); _get(_getPrototypeOf(Scroll.prototype), "insertBefore", this).call(this, wrapper, ref); } else { _get(_getPrototypeOf(Scroll.prototype), "insertBefore", this).call(this, blot, ref); } } }, { key: "isEnabled", value: function isEnabled() { return this.domNode.getAttribute('contenteditable') === 'true'; } }, { key: "leaf", value: function leaf(index) { return this.path(index).pop() || [null, -1]; } }, { key: "line", value: function line(index) { if (index === this.length()) { return this.line(index - 1); } return this.descendant(isLine, index); } }, { key: "lines", value: function lines() { var index = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : 0; var length = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : Number.MAX_VALUE; var getLines = function getLines(blot, blotIndex, blotLength) { var lines = []; var lengthLeft = blotLength; blot.children.forEachAt(blotIndex, blotLength, function (child, childIndex, childLength) { if (isLine(child)) { lines.push(child); } else if (child instanceof parchment__WEBPACK_IMPORTED_MODULE_0__["ContainerBlot"]) { lines = lines.concat(getLines(child, childIndex, lengthLeft)); } lengthLeft -= childLength; }); return lines; }; return getLines(this, index, length); } }, { key: "optimize", value: function optimize() { var mutations = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : []; var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (this.batch) return; _get(_getPrototypeOf(Scroll.prototype), "optimize", this).call(this, mutations, context); if (mutations.length > 0) { this.emitter.emit(_core_emitter__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].events.SCROLL_OPTIMIZE, mutations, context); } } }, { key: "path", value: function path(index) { return _get(_getPrototypeOf(Scroll.prototype), "path", this).call(this, index).slice(1); // Exclude self } }, { key: "remove", value: function remove() {// Never remove self } }, { key: "update", value: function update(mutations) { if (this.batch) { if (Array.isArray(mutations)) { this.batch = this.batch.concat(mutations); } return; } var source = _core_emitter__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].sources.USER; if (typeof mutations === 'string') { source = mutations; } if (!Array.isArray(mutations)) { mutations = this.observer.takeRecords(); } if (mutations.length > 0) { this.emitter.emit(_core_emitter__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].events.SCROLL_BEFORE_UPDATE, source, mutations); } _get(_getPrototypeOf(Scroll.prototype), "update", this).call(this, mutations.concat([])); // pass copy if (mutations.length > 0) { this.emitter.emit(_core_emitter__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].events.SCROLL_UPDATE, source, mutations); } } }]); return Scroll; }(parchment__WEBPACK_IMPORTED_MODULE_0__["ScrollBlot"]); Scroll.blotName = 'scroll'; Scroll.className = 'ql-editor'; Scroll.tagName = 'DIV'; Scroll.defaultChild = _block__WEBPACK_IMPORTED_MODULE_2__[/* default */ "d"]; Scroll.allowedChildren = [_block__WEBPACK_IMPORTED_MODULE_2__[/* default */ "d"], _block__WEBPACK_IMPORTED_MODULE_2__[/* BlockEmbed */ "a"], _container__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"]]; /* harmony default export */ __webpack_exports__["a"] = (Scroll); /***/ }), /* 15 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; var levels = ['error', 'warn', 'log', 'info']; var level = 'warn'; function debug(method) { if (levels.indexOf(method) <= levels.indexOf(level)) { var _console; for (var _len = arguments.length, args = new Array(_len > 1 ? _len - 1 : 0), _key = 1; _key < _len; _key++) { args[_key - 1] = arguments[_key]; } (_console = console)[method].apply(_console, args); // eslint-disable-line no-console } } function namespace(ns) { return levels.reduce(function (logger, method) { logger[method] = debug.bind(console, method, ns); return logger; }, {}); } namespace.level = function (newLevel) { level = newLevel; }; debug.level = namespace.level; /* harmony default export */ __webpack_exports__["a"] = (namespace); /***/ }), /* 16 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(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"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var Container = /*#__PURE__*/function (_ContainerBlot) { _inherits(Container, _ContainerBlot); var _super = _createSuper(Container); function Container() { _classCallCheck(this, Container); return _super.apply(this, arguments); } return Container; }(parchment__WEBPACK_IMPORTED_MODULE_0__["ContainerBlot"]); /* harmony default export */ __webpack_exports__["a"] = (Container); /***/ }), /* 17 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var _text__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var Cursor = /*#__PURE__*/function (_EmbedBlot) { _inherits(Cursor, _EmbedBlot); var _super = _createSuper(Cursor); _createClass(Cursor, null, [{ key: "value", value: function value() { return undefined; } }]); function Cursor(scroll, domNode, selection) { var _this; _classCallCheck(this, Cursor); _this = _super.call(this, scroll, domNode); _this.selection = selection; _this.textNode = document.createTextNode(Cursor.CONTENTS); _this.domNode.appendChild(_this.textNode); _this.savedLength = 0; return _this; } _createClass(Cursor, [{ key: "detach", value: function detach() { // super.detach() will also clear domNode.__blot if (this.parent != null) this.parent.removeChild(this); } }, { key: "format", value: function format(name, value) { if (this.savedLength !== 0) { _get(_getPrototypeOf(Cursor.prototype), "format", this).call(this, name, value); return; } var target = this; var index = 0; while (target != null && target.statics.scope !== parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].BLOCK_BLOT) { index += target.offset(target.parent); target = target.parent; } if (target != null) { this.savedLength = Cursor.CONTENTS.length; target.optimize(); target.formatAt(index, Cursor.CONTENTS.length, name, value); this.savedLength = 0; } } }, { key: "index", value: function index(node, offset) { if (node === this.textNode) return 0; return _get(_getPrototypeOf(Cursor.prototype), "index", this).call(this, node, offset); } }, { key: "length", value: function length() { return this.savedLength; } }, { key: "position", value: function position() { return [this.textNode, this.textNode.data.length]; } }, { key: "remove", value: function remove() { _get(_getPrototypeOf(Cursor.prototype), "remove", this).call(this); this.parent = null; } }, { key: "restore", value: function restore() { if (this.selection.composing || this.parent == null) return null; var range = this.selection.getNativeRange(); // Link format will insert text outside of anchor tag while (this.domNode.lastChild != null && this.domNode.lastChild !== this.textNode) { this.domNode.parentNode.insertBefore(this.domNode.lastChild, this.domNode); } var prevTextBlot = this.prev instanceof _text__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"] ? this.prev : null; var prevTextLength = prevTextBlot ? prevTextBlot.length() : 0; var nextTextBlot = this.next instanceof _text__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"] ? this.next : null; var nextText = nextTextBlot ? nextTextBlot.text : ''; var textNode = this.textNode; // take text from inside this blot and reset it var newText = textNode.data.split(Cursor.CONTENTS).join(''); textNode.data = Cursor.CONTENTS; // proactively merge TextBlots around cursor so that optimization // doesn't lose the cursor. the reason we are here in cursor.restore // could be that the user clicked in prevTextBlot or nextTextBlot, or // the user typed something. var mergedTextBlot; if (prevTextBlot) { mergedTextBlot = prevTextBlot; if (newText || nextTextBlot) { prevTextBlot.insertAt(prevTextBlot.length(), newText + nextText); if (nextTextBlot) { nextTextBlot.remove(); } } } else if (nextTextBlot) { mergedTextBlot = nextTextBlot; nextTextBlot.insertAt(0, newText); } else { var newTextNode = document.createTextNode(newText); mergedTextBlot = this.scroll.create(newTextNode); this.parent.insertBefore(mergedTextBlot, this); } this.remove(); if (range) { // calculate selection to restore var remapOffset = function remapOffset(node, offset) { if (prevTextBlot && node === prevTextBlot.domNode) { return offset; } if (node === textNode) { return prevTextLength + offset - 1; } if (nextTextBlot && node === nextTextBlot.domNode) { return prevTextLength + newText.length + offset; } return null; }; var start = remapOffset(range.start.node, range.start.offset); var end = remapOffset(range.end.node, range.end.offset); if (start !== null && end !== null) { return { startNode: mergedTextBlot.domNode, startOffset: start, endNode: mergedTextBlot.domNode, endOffset: end }; } } return null; } }, { key: "update", value: function update(mutations, context) { var _this2 = this; if (mutations.some(function (mutation) { return mutation.type === 'characterData' && mutation.target === _this2.textNode; })) { var range = this.restore(); if (range) context.range = range; } } }, { key: "value", value: function value() { return ''; } }]); return Cursor; }(parchment__WEBPACK_IMPORTED_MODULE_0__["EmbedBlot"]); Cursor.blotName = 'cursor'; Cursor.className = 'ql-cursor'; Cursor.tagName = 'span'; Cursor.CONTENTS = "\uFEFF"; // Zero width no break space /* harmony default export */ __webpack_exports__["a"] = (Cursor); /***/ }), /* 18 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; // ESM COMPAT FLAG __webpack_require__.r(__webpack_exports__); // EXTERNAL MODULE: ./core/quill.js var quill = __webpack_require__(1); // EXTERNAL MODULE: ./blots/block.js var block = __webpack_require__(5); // EXTERNAL MODULE: ./blots/break.js var blots_break = __webpack_require__(8); // EXTERNAL MODULE: ./blots/container.js var container = __webpack_require__(16); // EXTERNAL MODULE: ./blots/cursor.js var cursor = __webpack_require__(17); // EXTERNAL MODULE: ./blots/embed.js var blots_embed = __webpack_require__(43); // EXTERNAL MODULE: ./blots/inline.js var inline = __webpack_require__(9); // EXTERNAL MODULE: ./blots/scroll.js var blots_scroll = __webpack_require__(14); // EXTERNAL MODULE: ./blots/text.js var blots_text = __webpack_require__(7); // EXTERNAL MODULE: ./modules/clipboard.js var clipboard = __webpack_require__(44); // EXTERNAL MODULE: ./modules/history.js var modules_history = __webpack_require__(34); // EXTERNAL MODULE: ./modules/keyboard.js var keyboard = __webpack_require__(23); // EXTERNAL MODULE: ./node_modules/quill-delta/dist/Delta.js var Delta = __webpack_require__(0); var Delta_default = /*#__PURE__*/__webpack_require__.n(Delta); // EXTERNAL MODULE: ./core/emitter.js var emitter = __webpack_require__(3); // EXTERNAL MODULE: ./core/module.js var core_module = __webpack_require__(11); // EXTERNAL MODULE: ./utils/hasWindow.js var hasWindow = __webpack_require__(10); // CONCATENATED MODULE: ./modules/uploader.js function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var uploader_Uploader = /*#__PURE__*/function (_Module) { _inherits(Uploader, _Module); var _super = _createSuper(Uploader); function Uploader(quill, options) { var _this; _classCallCheck(this, Uploader); _this = _super.call(this, quill, options); _this.addDragOverHandler(); _this.addDropHandler(); return _this; } _createClass(Uploader, [{ key: "addDragOverHandler", value: function addDragOverHandler() { if (Object(hasWindow["a" /* default */])()) { var ua = window.navigator.userAgent.toLowerCase(); var isMsIe = ua.indexOf('msie ') !== -1 || ua.indexOf('trident/') !== -1 || ua.indexOf('edge/') !== -1; if (isMsIe) { this.quill.root.addEventListener('dragover', function (e) { e.preventDefault(); }); } } } }, { key: "addDropHandler", value: function addDropHandler() { var _this2 = this; this.quill.root.addEventListener('drop', function (e) { e.preventDefault(); var native; var onDrop = _this2.options.onDrop; if (onDrop && typeof onDrop === 'function') { onDrop(e); } if (document.caretRangeFromPoint) { native = document.caretRangeFromPoint(e.clientX, e.clientY); } else if (document.caretPositionFromPoint) { var position = document.caretPositionFromPoint(e.clientX, e.clientY); native = document.createRange(); native.setStart(position.offsetNode, position.offset); native.setEnd(position.offsetNode, position.offset); } else { return; } var normalized = _this2.quill.selection.normalizeNative(native); var range = _this2.quill.selection.normalizedToRange(normalized); _this2.upload(range, e.dataTransfer.files); }); } }, { key: "upload", value: function upload(range, files) { var _this3 = this; var uploads = []; Array.from(files).forEach(function (file) { if (file && _this3.options.mimetypes.indexOf(file.type) !== -1) { uploads.push(file); } }); if (uploads.length > 0) { this.options.handler.call(this, range, uploads, this.options.imageBlot); } } }]); return Uploader; }(core_module["a" /* default */]); uploader_Uploader.DEFAULTS = { mimetypes: ['image/png', 'image/jpeg'], imageBlot: 'image', handler: function handler(range, files, blotName) { var _this4 = this; var promises = files.map(function (file) { return new Promise(function (resolve) { var reader = new FileReader(); reader.onload = function (e) { resolve(e.target.result); }; reader.readAsDataURL(file); }); }); Promise.all(promises).then(function (images) { var update = images.reduce(function (delta, image) { return delta.insert(_defineProperty({}, blotName, image)); }, new Delta_default.a().retain(range.index).delete(range.length)); _this4.quill.updateContents(update, emitter["a" /* default */].sources.USER); _this4.quill.setSelection(range.index + images.length, emitter["a" /* default */].sources.SILENT); }); } }; /* harmony default export */ var uploader = (uploader_Uploader); // CONCATENATED MODULE: ./core.js quill["a" /* default */].register({ 'blots/block': block["d" /* default */], 'blots/block/embed': block["a" /* BlockEmbed */], 'blots/break': blots_break["a" /* default */], 'blots/container': container["a" /* default */], 'blots/cursor': cursor["a" /* default */], 'blots/embed': blots_embed["a" /* default */], 'blots/inline': inline["a" /* default */], 'blots/scroll': blots_scroll["a" /* default */], 'blots/text': blots_text["a" /* default */], 'modules/clipboard': clipboard["a" /* default */], 'modules/history': modules_history["a" /* default */], 'modules/keyboard': keyboard["b" /* default */], 'modules/uploader': uploader }); /* harmony default export */ var core = __webpack_exports__["default"] = (quill["a" /* default */]); /***/ }), /* 19 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, module) {/** * Lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright JS Foundation and other contributors <https://js.foundation/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used to compose bitmasks for value comparisons. */ var COMPARE_PARTIAL_FLAG = 1, COMPARE_UNORDERED_FLAG = 2; /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', asyncTag = '[object AsyncFunction]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', nullTag = '[object Null]', objectTag = '[object Object]', promiseTag = '[object Promise]', proxyTag = '[object Proxy]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', symbolTag = '[object Symbol]', undefinedTag = '[object Undefined]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** Detect free variable `exports`. */ var freeExports = true && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process; /** Used to access faster Node.js helpers. */ var nodeUtil = (function() { try { return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }()); /* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; /** * A specialized version of `_.filter` for arrays without support for * iteratee shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {Array} Returns the new filtered array. */ function arrayFilter(array, predicate) { var index = -1, length = array == null ? 0 : array.length, resIndex = 0, result = []; while (++index < length) { var value = array[index]; if (predicate(value, index, array)) { result[resIndex++] = value; } } return result; } /** * Appends the elements of `values` to `array`. * * @private * @param {Array} array The array to modify. * @param {Array} values The values to append. * @returns {Array} Returns `array`. */ function arrayPush(array, values) { var index = -1, length = values.length, offset = array.length; while (++index < length) { array[offset + index] = values[index]; } return array; } /** * A specialized version of `_.some` for arrays without support for iteratee * shorthands. * * @private * @param {Array} [array] The array to iterate over. * @param {Function} predicate The function invoked per iteration. * @returns {boolean} Returns `true` if any element passes the predicate check, * else `false`. */ function arraySome(array, predicate) { var index = -1, length = array == null ? 0 : array.length; while (++index < length) { if (predicate(array[index], index, array)) { return true; } } return false; } /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } /** * The base implementation of `_.unary` without support for storing metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. */ function baseUnary(func) { return function(value) { return func(value); }; } /** * Checks if a `cache` value for `key` exists. * * @private * @param {Object} cache The cache to query. * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function cacheHas(cache, key) { return cache.has(key); } /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /** * Converts `map` to its key-value pairs. * * @private * @param {Object} map The map to convert. * @returns {Array} Returns the key-value pairs. */ function mapToArray(map) { var index = -1, result = Array(map.size); map.forEach(function(value, key) { result[++index] = [key, value]; }); return result; } /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } /** * Converts `set` to an array of its values. * * @private * @param {Object} set The set to convert. * @returns {Array} Returns the values. */ function setToArray(set) { var index = -1, result = Array(set.size); set.forEach(function(value) { result[++index] = value; }); return result; } /** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ var Buffer = moduleExports ? root.Buffer : undefined, Symbol = root.Symbol, Uint8Array = root.Uint8Array, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, symToStringTag = Symbol ? Symbol.toStringTag : undefined; /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeGetSymbols = Object.getOwnPropertySymbols, nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeKeys = overArg(Object.keys, Object); /* Built-in method references that are verified to be native. */ var DataView = getNative(root, 'DataView'), Map = getNative(root, 'Map'), Promise = getNative(root, 'Promise'), Set = getNative(root, 'Set'), WeakMap = getNative(root, 'WeakMap'), nativeCreate = getNative(Object, 'create'); /** Used to detect maps, sets, and weakmaps. */ var dataViewCtorString = toSource(DataView), mapCtorString = toSource(Map), promiseCtorString = toSource(Promise), setCtorString = toSource(Set), weakMapCtorString = toSource(WeakMap); /** Used to convert symbols to primitives and strings. */ var symbolProto = Symbol ? Symbol.prototype : undefined, symbolValueOf = symbolProto ? symbolProto.valueOf : undefined; /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); } /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; this.size = 0; } /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { var result = getMapData(this, key)['delete'](key); this.size -= result ? 1 : 0; return result; } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { var data = getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; /** * * Creates an array cache object to store unique values. * * @private * @constructor * @param {Array} [values] The values to cache. */ function SetCache(values) { var index = -1, length = values == null ? 0 : values.length; this.__data__ = new MapCache; while (++index < length) { this.add(values[index]); } } /** * Adds `value` to the array cache. * * @private * @name add * @memberOf SetCache * @alias push * @param {*} value The value to cache. * @returns {Object} Returns the cache instance. */ function setCacheAdd(value) { this.__data__.set(value, HASH_UNDEFINED); return this; } /** * Checks if `value` is in the array cache. * * @private * @name has * @memberOf SetCache * @param {*} value The value to search for. * @returns {number} Returns `true` if `value` is found, else `false`. */ function setCacheHas(value) { return this.__data__.has(value); } // Add methods to `SetCache`. SetCache.prototype.add = SetCache.prototype.push = setCacheAdd; SetCache.prototype.has = setCacheHas; /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { var data = this.__data__ = new ListCache(entries); this.size = data.size; } /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = new ListCache; this.size = 0; } /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { var data = this.__data__, result = data['delete'](key); this.size = data.size; return result; } /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { return this.__data__.get(key); } /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { return this.__data__.has(key); } /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var data = this.__data__; if (data instanceof ListCache) { var pairs = data.__data__; if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new MapCache(pairs); } data.set(key, value); this.size = data.size; return this; } // Add methods to `Stack`. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode. key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers. (isBuff && (key == 'offset' || key == 'parent')) || // PhantomJS 2 has enumerable non-index properties on typed arrays. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || // Skip index properties. isIndex(key, length) ))) { result.push(key); } } return result; } /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * The base implementation of `getAllKeys` and `getAllKeysIn` which uses * `keysFunc` and `symbolsFunc` to get the enumerable property names and * symbols of `object`. * * @private * @param {Object} object The object to query. * @param {Function} keysFunc The function to get the keys of `object`. * @param {Function} symbolsFunc The function to get the symbols of `object`. * @returns {Array} Returns the array of property names and symbols. */ function baseGetAllKeys(object, keysFunc, symbolsFunc) { var result = keysFunc(object); return isArray(object) ? result : arrayPush(result, symbolsFunc(object)); } /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } /** * The base implementation of `_.isArguments`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } /** * The base implementation of `_.isEqual` which supports partial comparisons * and tracks traversed objects. * * @private * @param {*} value The value to compare. * @param {*} other The other value to compare. * @param {boolean} bitmask The bitmask flags. * 1 - Unordered comparison * 2 - Partial comparison * @param {Function} [customizer] The function to customize comparisons. * @param {Object} [stack] Tracks traversed `value` and `other` objects. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. */ function baseIsEqual(value, other, bitmask, customizer, stack) { if (value === other) { return true; } if (value == null || other == null || (!isObjectLike(value) && !isObjectLike(other))) { return value !== value && other !== other; } return baseIsEqualDeep(value, other, bitmask, customizer, baseIsEqual, stack); } /** * A specialized version of `baseIsEqual` for arrays and objects which performs * deep comparisons and tracks traversed objects enabling objects with circular * references to be compared. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} [stack] Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function baseIsEqualDeep(object, other, bitmask, customizer, equalFunc, stack) { var objIsArr = isArray(object), othIsArr = isArray(other), objTag = objIsArr ? arrayTag : getTag(object), othTag = othIsArr ? arrayTag : getTag(other); objTag = objTag == argsTag ? objectTag : objTag; othTag = othTag == argsTag ? objectTag : othTag; var objIsObj = objTag == objectTag, othIsObj = othTag == objectTag, isSameTag = objTag == othTag; if (isSameTag && isBuffer(object)) { if (!isBuffer(other)) { return false; } objIsArr = true; objIsObj = false; } if (isSameTag && !objIsObj) { stack || (stack = new Stack); return (objIsArr || isTypedArray(object)) ? equalArrays(object, other, bitmask, customizer, equalFunc, stack) : equalByTag(object, other, objTag, bitmask, customizer, equalFunc, stack); } if (!(bitmask & COMPARE_PARTIAL_FLAG)) { var objIsWrapped = objIsObj && hasOwnProperty.call(object, '__wrapped__'), othIsWrapped = othIsObj && hasOwnProperty.call(other, '__wrapped__'); if (objIsWrapped || othIsWrapped) { var objUnwrapped = objIsWrapped ? object.value() : object, othUnwrapped = othIsWrapped ? other.value() : other; stack || (stack = new Stack); return equalFunc(objUnwrapped, othUnwrapped, bitmask, customizer, stack); } } if (!isSameTag) { return false; } stack || (stack = new Stack); return equalObjects(object, other, bitmask, customizer, equalFunc, stack); } /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } /** * The base implementation of `_.isTypedArray` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** * The base implementation of `_.keys` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeys(object) { if (!isPrototype(object)) { return nativeKeys(object); } var result = []; for (var key in Object(object)) { if (hasOwnProperty.call(object, key) && key != 'constructor') { result.push(key); } } return result; } /** * A specialized version of `baseIsEqualDeep` for arrays with support for * partial deep comparisons. * * @private * @param {Array} array The array to compare. * @param {Array} other The other array to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `array` and `other` objects. * @returns {boolean} Returns `true` if the arrays are equivalent, else `false`. */ function equalArrays(array, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, arrLength = array.length, othLength = other.length; if (arrLength != othLength && !(isPartial && othLength > arrLength)) { return false; } // Assume cyclic values are equal. var stacked = stack.get(array); if (stacked && stack.get(other)) { return stacked == other; } var index = -1, result = true, seen = (bitmask & COMPARE_UNORDERED_FLAG) ? new SetCache : undefined; stack.set(array, other); stack.set(other, array); // Ignore non-index properties. while (++index < arrLength) { var arrValue = array[index], othValue = other[index]; if (customizer) { var compared = isPartial ? customizer(othValue, arrValue, index, other, array, stack) : customizer(arrValue, othValue, index, array, other, stack); } if (compared !== undefined) { if (compared) { continue; } result = false; break; } // Recursively compare arrays (susceptible to call stack limits). if (seen) { if (!arraySome(other, function(othValue, othIndex) { if (!cacheHas(seen, othIndex) && (arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack))) { return seen.push(othIndex); } })) { result = false; break; } } else if (!( arrValue === othValue || equalFunc(arrValue, othValue, bitmask, customizer, stack) )) { result = false; break; } } stack['delete'](array); stack['delete'](other); return result; } /** * A specialized version of `baseIsEqualDeep` for comparing objects of * the same `toStringTag`. * * **Note:** This function only supports comparing values with tags of * `Boolean`, `Date`, `Error`, `Number`, `RegExp`, or `String`. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {string} tag The `toStringTag` of the objects to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalByTag(object, other, tag, bitmask, customizer, equalFunc, stack) { switch (tag) { case dataViewTag: if ((object.byteLength != other.byteLength) || (object.byteOffset != other.byteOffset)) { return false; } object = object.buffer; other = other.buffer; case arrayBufferTag: if ((object.byteLength != other.byteLength) || !equalFunc(new Uint8Array(object), new Uint8Array(other))) { return false; } return true; case boolTag: case dateTag: case numberTag: // Coerce booleans to `1` or `0` and dates to milliseconds. // Invalid dates are coerced to `NaN`. return eq(+object, +other); case errorTag: return object.name == other.name && object.message == other.message; case regexpTag: case stringTag: // Coerce regexes to strings and treat strings, primitives and objects, // as equal. See http://www.ecma-international.org/ecma-262/7.0/#sec-regexp.prototype.tostring // for more details. return object == (other + ''); case mapTag: var convert = mapToArray; case setTag: var isPartial = bitmask & COMPARE_PARTIAL_FLAG; convert || (convert = setToArray); if (object.size != other.size && !isPartial) { return false; } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked) { return stacked == other; } bitmask |= COMPARE_UNORDERED_FLAG; // Recursively compare objects (susceptible to call stack limits). stack.set(object, other); var result = equalArrays(convert(object), convert(other), bitmask, customizer, equalFunc, stack); stack['delete'](object); return result; case symbolTag: if (symbolValueOf) { return symbolValueOf.call(object) == symbolValueOf.call(other); } } return false; } /** * A specialized version of `baseIsEqualDeep` for objects with support for * partial deep comparisons. * * @private * @param {Object} object The object to compare. * @param {Object} other The other object to compare. * @param {number} bitmask The bitmask flags. See `baseIsEqual` for more details. * @param {Function} customizer The function to customize comparisons. * @param {Function} equalFunc The function to determine equivalents of values. * @param {Object} stack Tracks traversed `object` and `other` objects. * @returns {boolean} Returns `true` if the objects are equivalent, else `false`. */ function equalObjects(object, other, bitmask, customizer, equalFunc, stack) { var isPartial = bitmask & COMPARE_PARTIAL_FLAG, objProps = getAllKeys(object), objLength = objProps.length, othProps = getAllKeys(other), othLength = othProps.length; if (objLength != othLength && !isPartial) { return false; } var index = objLength; while (index--) { var key = objProps[index]; if (!(isPartial ? key in other : hasOwnProperty.call(other, key))) { return false; } } // Assume cyclic values are equal. var stacked = stack.get(object); if (stacked && stack.get(other)) { return stacked == other; } var result = true; stack.set(object, other); stack.set(other, object); var skipCtor = isPartial; while (++index < objLength) { key = objProps[index]; var objValue = object[key], othValue = other[key]; if (customizer) { var compared = isPartial ? customizer(othValue, objValue, key, other, object, stack) : customizer(objValue, othValue, key, object, other, stack); } // Recursively compare objects (susceptible to call stack limits). if (!(compared === undefined ? (objValue === othValue || equalFunc(objValue, othValue, bitmask, customizer, stack)) : compared )) { result = false; break; } skipCtor || (skipCtor = key == 'constructor'); } if (result && !skipCtor) { var objCtor = object.constructor, othCtor = other.constructor; // Non `Object` object instances with different constructors are not equal. if (objCtor != othCtor && ('constructor' in object && 'constructor' in other) && !(typeof objCtor == 'function' && objCtor instanceof objCtor && typeof othCtor == 'function' && othCtor instanceof othCtor)) { result = false; } } stack['delete'](object); stack['delete'](other); return result; } /** * Creates an array of own enumerable property names and symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names and symbols. */ function getAllKeys(object) { return baseGetAllKeys(object, keys, getSymbols); } /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } /** * Creates an array of the own enumerable symbols of `object`. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of symbols. */ var getSymbols = !nativeGetSymbols ? stubArray : function(object) { if (object == null) { return []; } object = Object(object); return arrayFilter(nativeGetSymbols(object), function(symbol) { return propertyIsEnumerable.call(object, symbol); }); }; /** * Gets the `toStringTag` of `value`. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ var getTag = baseGetTag; // Fallback for data views, maps, sets, and weak maps in IE 11 and promises in Node.js < 6. if ((DataView && getTag(new DataView(new ArrayBuffer(1))) != dataViewTag) || (Map && getTag(new Map) != mapTag) || (Promise && getTag(Promise.resolve()) != promiseTag) || (Set && getTag(new Set) != setTag) || (WeakMap && getTag(new WeakMap) != weakMapTag)) { getTag = function(value) { var result = baseGetTag(value), Ctor = result == objectTag ? value.constructor : undefined, ctorString = Ctor ? toSource(Ctor) : ''; if (ctorString) { switch (ctorString) { case dataViewCtorString: return dataViewTag; case mapCtorString: return mapTag; case promiseCtorString: return promiseTag; case setCtorString: return setTag; case weakMapCtorString: return weakMapTag; } } return result; }; } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (typeof value == 'number' || reIsUint.test(value)) && (value > -1 && value % 1 == 0 && value < length); } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } /** * Converts `func` to its source code. * * @private * @param {Function} func The function to convert. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = nativeIsBuffer || stubFalse; /** * Performs a deep comparison between two values to determine if they are * equivalent. * * **Note:** This method supports comparing arrays, array buffers, booleans, * date objects, error objects, maps, numbers, `Object` objects, regexes, * sets, strings, symbols, and typed arrays. `Object` objects are compared * by their own, not inherited, enumerable properties. Functions and DOM * nodes are compared by strict equality, i.e. `===`. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.isEqual(object, other); * // => true * * object === other; * // => false */ function isEqual(value, other) { return baseIsEqual(value, other); } /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == 'object'; } /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; /** * Creates an array of the own enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. See the * [ES spec](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * for more details. * * @static * @since 0.1.0 * @memberOf _ * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keys(new Foo); * // => ['a', 'b'] (iteration order is not guaranteed) * * _.keys('hi'); * // => ['0', '1'] */ function keys(object) { return isArrayLike(object) ? arrayLikeKeys(object) : baseKeys(object); } /** * This method returns a new empty array. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {Array} Returns the new empty array. * @example * * var arrays = _.times(2, _.stubArray); * * console.log(arrays); * // => [[], []] * * console.log(arrays[0] === arrays[1]); * // => false */ function stubArray() { return []; } /** * This method returns `false`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `false`. * @example * * _.times(2, _.stubFalse); * // => [false, false] */ function stubFalse() { return false; } module.exports = isEqual; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(41), __webpack_require__(45)(module))) /***/ }), /* 20 */, /* 21 */, /* 22 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return ColorAttributor; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return ColorClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return ColorStyle; }); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var ColorAttributor = /*#__PURE__*/function (_StyleAttributor) { _inherits(ColorAttributor, _StyleAttributor); var _super = _createSuper(ColorAttributor); function ColorAttributor() { _classCallCheck(this, ColorAttributor); return _super.apply(this, arguments); } _createClass(ColorAttributor, [{ key: "value", value: function value(domNode) { var value = _get(_getPrototypeOf(ColorAttributor.prototype), "value", this).call(this, domNode); if (value.indexOf('rgb(') !== 0) return value; value = value.replace(/^[^\d]+/, '').replace(/[^\d]+$/, ''); var hex = value.split(',').map(function (component) { return "00".concat(parseInt(component, 10).toString(16)).slice(-2); }).join(''); return "#".concat(hex); } }]); return ColorAttributor; }(parchment__WEBPACK_IMPORTED_MODULE_0__["StyleAttributor"]); var ColorClass = new parchment__WEBPACK_IMPORTED_MODULE_0__["ClassAttributor"]('color', 'ql-color', { scope: parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].INLINE }); var ColorStyle = new ColorAttributor('color', 'color', { scope: parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].INLINE }); /***/ }), /* 23 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return Keyboard; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SHORTKEY; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return normalize; }); /* harmony import */ var lodash_clonedeep__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(12); /* harmony import */ var lodash_clonedeep__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(lodash_clonedeep__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var lodash_isequal__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(19); /* harmony import */ var lodash_isequal__WEBPACK_IMPORTED_MODULE_1___default = /*#__PURE__*/__webpack_require__.n(lodash_isequal__WEBPACK_IMPORTED_MODULE_1__); /* harmony import */ var quill_delta__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(0); /* harmony import */ var quill_delta__WEBPACK_IMPORTED_MODULE_2___default = /*#__PURE__*/__webpack_require__.n(quill_delta__WEBPACK_IMPORTED_MODULE_2__); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(2); /* harmony import */ var _core_quill__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(1); /* harmony import */ var _core_logger__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(15); /* harmony import */ var _core_module__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(11); /* harmony import */ var _utils_hasWindow__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(10); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var debug = Object(_core_logger__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"])('quill:keyboard'); var KEY_NAMES = { backspace: 'backspace', tab: 'tab', enter: 'enter', escape: 'escape', pageup: 'pageUp', pagedown: 'pageDown', end: 'end', home: 'home', arrowleft: 'leftArrow', arrowup: 'upArrow', arrowright: 'rightArrow', arrowdown: 'downArrow', delete: 'del', ' ': 'space', '*': 'asterisk', '-': 'minus', alt: 'alt', control: 'control', shift: 'shift', // IE11: left: 'leftArrow', up: 'upArrow', right: 'rightArrow', down: 'downArrow', multiply: 'asterisk', spacebar: 'space', del: 'del', subtract: 'minus', esc: 'escape' }; var KEY_CODES = { // iOS 10.2 and lower didn't supports KeyboardEvent.key '8': 'backspace', '9': 'tab', '13': 'enter', '27': 'escape', '33': 'pageUp', '34': 'pageDown', '35': 'end', '36': 'home', '37': 'leftArrow', '38': 'upArrow', '39': 'rightArrow', '40': 'downArrow', '46': 'del', '32': 'space', '106': 'asterisk', '109': 'minus', '189': 'minus', '173': 'minus', '16': 'shift', '17': 'control', '18': 'alt' }; var SHORTKEY = Object(_utils_hasWindow__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])() && /Mac/i.test(navigator.platform) ? 'metaKey' : 'ctrlKey'; var Keyboard = /*#__PURE__*/function (_Module) { _inherits(Keyboard, _Module); var _super = _createSuper(Keyboard); _createClass(Keyboard, null, [{ key: "match", value: function match(evt, binding) { if (['altKey', 'ctrlKey', 'metaKey', 'shiftKey'].some(function (key) { return !!binding[key] !== evt[key] && binding[key] !== null; })) { return false; } return binding.key === Keyboard.normalizeKeyName(evt) || binding.key === evt.which; } }, { key: "normalizeKeyName", value: function normalizeKeyName(_ref) { var key = _ref.key, which = _ref.which; var isKeySupported = !!key; key = isKeySupported ? key : which; if (key) { if (isKeySupported) { key = KEY_NAMES[key.toLowerCase()] || key; } else { key = KEY_CODES[key] || String.fromCharCode(key); } } return key; } }]); function Keyboard(quill, options) { var _this; _classCallCheck(this, Keyboard); _this = _super.call(this, quill, options); _this.bindings = {}; Object.keys(_this.options.bindings).forEach(function (name) { if (_this.options.bindings[name]) { _this.addBinding(_this.options.bindings[name]); } }); _this.addBinding({ key: 'enter', shiftKey: null }, _this.handleEnter); _this.addBinding({ key: 'enter', metaKey: null, ctrlKey: null, altKey: null }, function () {}); if (Object(_utils_hasWindow__WEBPACK_IMPORTED_MODULE_7__[/* default */ "a"])() && /Firefox/i.test(navigator.userAgent)) { // Need to handle delete and backspace for Firefox in the general case #1171 _this.addBinding({ key: 'backspace' }, { collapsed: true }, _this.handleBackspace); _this.addBinding({ key: 'del' }, { collapsed: true }, _this.handleDelete); } else { _this.addBinding({ key: 'backspace' }, { collapsed: true, prefix: /^.?$/ }, _this.handleBackspace); _this.addBinding({ key: 'del' }, { collapsed: true, suffix: /^.?$/ }, _this.handleDelete); } _this.addBinding({ key: 'backspace' }, { collapsed: false }, _this.handleDeleteRange); _this.addBinding({ key: 'del' }, { collapsed: false }, _this.handleDeleteRange); _this.addBinding({ key: 'backspace', altKey: null, ctrlKey: null, metaKey: null, shiftKey: null }, { collapsed: true, offset: 0 }, _this.handleBackspace); _this.listen(); return _this; } _createClass(Keyboard, [{ key: "addBinding", value: function addBinding(keyBinding) { var _this2 = this; var context = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; var handler = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {}; var binding = normalize(keyBinding); if (binding == null) { debug.warn('Attempted to add invalid keyboard binding', binding); return; } if (typeof context === 'function') { context = { handler: context }; } if (typeof handler === 'function') { handler = { handler: handler }; } var keys = Array.isArray(binding.key) ? binding.key : [binding.key]; keys.forEach(function (key) { var singleBinding = _objectSpread(_objectSpread(_objectSpread({}, binding), {}, { key: key }, context), handler); _this2.bindings[singleBinding.key] = _this2.bindings[singleBinding.key] || []; _this2.bindings[singleBinding.key].push(singleBinding); }); } }, { key: "listen", value: function listen() { var _this3 = this; this.quill.root.addEventListener('keydown', function (evt) { if (evt.defaultPrevented || evt.isComposing) return; _this3.raiseOnKeydownCallback(evt); var keyName = Keyboard.normalizeKeyName(evt); var bindings = (_this3.bindings[keyName] || []).concat(_this3.bindings[evt.which] || []); var matches = bindings.filter(function (binding) { return Keyboard.match(evt, binding); }); if (matches.length === 0) return; var range = _this3.quill.getSelection(); if (range == null || !_this3.quill.hasFocus()) return; var _this3$quill$getLine = _this3.quill.getLine(range.index), _this3$quill$getLine2 = _slicedToArray(_this3$quill$getLine, 2), line = _this3$quill$getLine2[0], offset = _this3$quill$getLine2[1]; var _this3$quill$getLeaf = _this3.quill.getLeaf(range.index), _this3$quill$getLeaf2 = _slicedToArray(_this3$quill$getLeaf, 2), leafStart = _this3$quill$getLeaf2[0], offsetStart = _this3$quill$getLeaf2[1]; var _ref2 = range.length === 0 ? [leafStart, offsetStart] : _this3.quill.getLeaf(range.index + range.length), _ref3 = _slicedToArray(_ref2, 2), leafEnd = _ref3[0], offsetEnd = _ref3[1]; var prefixText = leafStart instanceof parchment__WEBPACK_IMPORTED_MODULE_3__["TextBlot"] ? leafStart.value().slice(0, offsetStart) : ''; var suffixText = leafEnd instanceof parchment__WEBPACK_IMPORTED_MODULE_3__["TextBlot"] ? leafEnd.value().slice(offsetEnd) : ''; var curContext = { collapsed: range.length === 0, empty: range.length === 0 && line.length() <= 1, format: _this3.quill.getFormat(range), line: line, offset: offset, prefix: prefixText, suffix: suffixText, event: evt }; var prevented = matches.some(function (binding) { if (binding.collapsed != null && binding.collapsed !== curContext.collapsed) { return false; } if (binding.empty != null && binding.empty !== curContext.empty) { return false; } if (binding.offset != null && binding.offset !== curContext.offset) { return false; } if (Array.isArray(binding.format)) { // any format is present if (binding.format.every(function (name) { return curContext.format[name] == null; })) { return false; } } else if (_typeof(binding.format) === 'object') { // all formats must match if (!Object.keys(binding.format).every(function (name) { if (binding.format[name] === true) return curContext.format[name] != null; if (binding.format[name] === false) return curContext.format[name] == null; return lodash_isequal__WEBPACK_IMPORTED_MODULE_1___default()(binding.format[name], curContext.format[name]); })) { return false; } } if (binding.prefix != null && !binding.prefix.test(curContext.prefix)) { return false; } if (binding.suffix != null && !binding.suffix.test(curContext.suffix)) { return false; } return binding.handler.call(_this3, range, curContext, binding) !== true; }); if (prevented) { evt.preventDefault(); } }); } }, { key: "raiseOnKeydownCallback", value: function raiseOnKeydownCallback(event) { var callback = this.options.onKeydown; if (callback && typeof callback === 'function') { callback(event); } } }, { key: "handleBackspace", value: function handleBackspace(range, context) { // Check for astral symbols var length = /[\uD800-\uDBFF][\uDC00-\uDFFF]$/.test(context.prefix) ? 2 : 1; if (range.index === 0 || this.quill.getLength() <= 1) return; var formats = {}; var _this$quill$getLine = this.quill.getLine(range.index), _this$quill$getLine2 = _slicedToArray(_this$quill$getLine, 1), line = _this$quill$getLine2[0]; var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_2___default.a().retain(range.index - length).delete(length); if (context.offset === 0) { // Always deleting newline here, length always 1 var _this$quill$getLine3 = this.quill.getLine(range.index - 1), _this$quill$getLine4 = _slicedToArray(_this$quill$getLine3, 1), prev = _this$quill$getLine4[0]; if (prev) { var isPrevLineEmpty = prev.statics.blotName === 'block' && prev.length() <= 1; if (!isPrevLineEmpty) { var curFormats = line.formats(); var prevFormats = this.quill.getFormat(range.index - 1, 1); formats = quill_delta__WEBPACK_IMPORTED_MODULE_2__["AttributeMap"].diff(curFormats, prevFormats) || {}; if (Object.keys(formats).length > 0) { // line.length() - 1 targets \n in line, another -1 for newline being deleted var formatDelta = new quill_delta__WEBPACK_IMPORTED_MODULE_2___default.a().retain(range.index + line.length() - 2).retain(1, formats); delta = delta.compose(formatDelta); } } } } this.quill.updateContents(delta, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.focus(); } }, { key: "handleDelete", value: function handleDelete(range, context) { // Check for astral symbols var length = /^[\uD800-\uDBFF][\uDC00-\uDFFF]/.test(context.suffix) ? 2 : 1; if (range.index >= this.quill.getLength() - length) return; var formats = {}; var _this$quill$getLine5 = this.quill.getLine(range.index), _this$quill$getLine6 = _slicedToArray(_this$quill$getLine5, 1), line = _this$quill$getLine6[0]; var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_2___default.a().retain(range.index).delete(length); if (context.offset >= line.length() - 1) { var _this$quill$getLine7 = this.quill.getLine(range.index + 1), _this$quill$getLine8 = _slicedToArray(_this$quill$getLine7, 1), next = _this$quill$getLine8[0]; if (next) { var curFormats = line.formats(); var nextFormats = this.quill.getFormat(range.index, 1); formats = quill_delta__WEBPACK_IMPORTED_MODULE_2__["AttributeMap"].diff(curFormats, nextFormats) || {}; if (Object.keys(formats).length > 0) { delta = delta.retain(next.length() - 1).retain(1, formats); } } } this.quill.updateContents(delta, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.focus(); } }, { key: "handleDeleteRange", value: function handleDeleteRange(range, context) { var lines = this.quill.getLines(range); var formats = {}; if (lines.length > 1) { var firstFormats = lines[0].formats(); var lastFormats = lines[lines.length - 1].formats(); formats = quill_delta__WEBPACK_IMPORTED_MODULE_2__["AttributeMap"].diff(lastFormats, firstFormats) || {}; } this.quill.deleteText(range, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); if (Object.keys(formats).length > 0) { this.raiseOnKeydownCallback(context.event); this.quill.formatLine(range.index, 1, formats, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } this.quill.setSelection(range.index, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.SILENT); this.quill.focus(); } }, { key: "handleEnter", value: function handleEnter(range, context) { var _this4 = this; var lineFormats = Object.keys(context.format).reduce(function (formats, format) { if (_this4.quill.scroll.query(format, parchment__WEBPACK_IMPORTED_MODULE_3__["Scope"].BLOCK) && !Array.isArray(context.format[format])) { formats[format] = context.format[format]; } return formats; }, {}); var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_2___default.a().retain(range.index).delete(range.length).insert('\n', lineFormats); this.quill.updateContents(delta, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.setSelection(range.index + 1, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.SILENT); this.quill.focus(); Object.keys(context.format).forEach(function (name) { if (lineFormats[name] != null) return; if (Array.isArray(context.format[name])) return; if (name === 'code' || name === 'link') return; _this4.raiseOnKeydownCallback(context.event); _this4.quill.format(name, context.format[name], _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); }); } }]); return Keyboard; }(_core_module__WEBPACK_IMPORTED_MODULE_6__[/* default */ "a"]); Keyboard.DEFAULTS = { bindings: { bold: makeFormatHandler('bold'), italic: makeFormatHandler('italic'), underline: makeFormatHandler('underline'), indent: { // highlight tab or tab at beginning of list, indent or blockquote key: 'tab', format: ['blockquote', 'indent', 'list'], handler: function handler(range, context) { if (context.collapsed && context.offset !== 0) return true; this.quill.format('indent', '+1', _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); return false; } }, outdent: { key: 'tab', shiftKey: true, format: ['blockquote', 'indent', 'list'], // highlight tab or tab at beginning of list, indent or blockquote handler: function handler(range, context) { if (context.collapsed && context.offset !== 0) return true; this.quill.format('indent', '-1', _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); return false; } }, 'outdent backspace': { key: 'backspace', collapsed: true, shiftKey: null, metaKey: null, ctrlKey: null, altKey: null, format: ['indent', 'list'], offset: 0, handler: function handler(range, context) { if (context.format.indent != null) { this.quill.format('indent', '-1', _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } else if (context.format.list != null) { this.quill.format('list', false, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } } }, 'indent code-block': makeCodeBlockHandler(true), 'outdent code-block': makeCodeBlockHandler(false), 'remove tab': { key: 'tab', shiftKey: true, collapsed: true, prefix: /\t$/, handler: function handler(range) { this.quill.deleteText(range.index - 1, 1, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } }, tab: { key: 'tab', handler: function handler(range, context) { if (context.format.table) return true; this.quill.history.cutoff(); var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_2___default.a().retain(range.index).delete(range.length).insert('\t'); this.quill.updateContents(delta, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.history.cutoff(); this.quill.setSelection(range.index + 1, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.SILENT); return false; } }, 'blockquote empty enter': { key: 'enter', collapsed: true, format: ['blockquote'], empty: true, handler: function handler() { this.quill.format('blockquote', false, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } }, 'list empty enter': { key: 'enter', collapsed: true, format: ['list'], empty: true, handler: function handler(range, context) { var formats = { list: false }; if (context.format.indent) { formats.indent = false; } this.quill.formatLine(range.index, range.length, formats, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } }, 'checklist enter': { key: 'enter', collapsed: true, format: { list: 'checked' }, handler: function handler(range) { var _this$quill$getLine9 = this.quill.getLine(range.index), _this$quill$getLine10 = _slicedToArray(_this$quill$getLine9, 2), line = _this$quill$getLine10[0], offset = _this$quill$getLine10[1]; var formats = _objectSpread(_objectSpread({}, line.formats()), {}, { list: 'checked' }); var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_2___default.a().retain(range.index).insert('\n', formats).retain(line.length() - offset - 1).retain(1, { list: 'unchecked' }); this.quill.updateContents(delta, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.setSelection(range.index + 1, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.SILENT); this.quill.scrollIntoView(); } }, 'header enter': { key: 'enter', collapsed: true, format: ['header'], suffix: /^$/, handler: function handler(range, context) { var _this$quill$getLine11 = this.quill.getLine(range.index), _this$quill$getLine12 = _slicedToArray(_this$quill$getLine11, 2), line = _this$quill$getLine12[0], offset = _this$quill$getLine12[1]; var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_2___default.a().retain(range.index).insert('\n', context.format).retain(line.length() - offset - 1).retain(1, { header: null }); this.quill.updateContents(delta, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.setSelection(range.index + 1, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.SILENT); this.quill.scrollIntoView(); } }, 'table backspace': { key: 'backspace', format: ['table'], collapsed: true, offset: 0, handler: function handler() {} }, 'table delete': { key: 'del', format: ['table'], collapsed: true, suffix: /^$/, handler: function handler() {} }, 'table enter': { key: 'enter', shiftKey: null, format: ['table'], handler: function handler(range) { var module = this.quill.getModule('table'); if (module) { var _module$getTable = module.getTable(range), _module$getTable2 = _slicedToArray(_module$getTable, 4), table = _module$getTable2[0], row = _module$getTable2[1], cell = _module$getTable2[2], offset = _module$getTable2[3]; var shift = tableSide(table, row, cell, offset); if (shift == null) return; var index = table.offset(); if (shift < 0) { var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_2___default.a().retain(index).insert('\n'); this.quill.updateContents(delta, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.setSelection(range.index + 1, range.length, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.SILENT); } else if (shift > 0) { index += table.length(); var _delta = new quill_delta__WEBPACK_IMPORTED_MODULE_2___default.a().retain(index).insert('\n'); this.quill.updateContents(_delta, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.setSelection(index, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } } } }, 'table tab': { key: 'tab', shiftKey: null, format: ['table'], handler: function handler(range, context) { var event = context.event, cell = context.line; var offset = cell.offset(this.quill.scroll); if (event.shiftKey) { this.quill.setSelection(offset - 1, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } else { this.quill.setSelection(offset + cell.length(), _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } } }, 'list autofill': { key: 'space', shiftKey: null, collapsed: true, format: { list: false, 'code-block': false, blockquote: false, header: false, table: false }, prefix: /^\s*?(\d+\.|-|\*|\[ ?\]|\[x\])$/, handler: function handler(range, context) { if (this.quill.scroll.query('list') == null) return true; var length = context.prefix.length; var _this$quill$getLine13 = this.quill.getLine(range.index), _this$quill$getLine14 = _slicedToArray(_this$quill$getLine13, 2), line = _this$quill$getLine14[0], offset = _this$quill$getLine14[1]; if (offset > length) return true; var value; switch (context.prefix.trim()) { case '[]': case '[ ]': value = 'unchecked'; break; case '[x]': value = 'checked'; break; case '-': case '*': value = 'bullet'; break; default: value = 'ordered'; } this.quill.insertText(range.index, ' ', _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.history.cutoff(); var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_2___default.a().retain(range.index - offset).delete(length + 1).retain(line.length() - 2 - offset).retain(1, { list: value }); this.raiseOnKeydownCallback(context.event); this.quill.updateContents(delta, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.history.cutoff(); this.quill.setSelection(range.index - length, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.SILENT); return false; } }, 'code exit': { key: 'enter', collapsed: true, format: ['code-block'], prefix: /^$/, suffix: /^\s*$/, handler: function handler(range) { var _this$quill$getLine15 = this.quill.getLine(range.index), _this$quill$getLine16 = _slicedToArray(_this$quill$getLine15, 2), line = _this$quill$getLine16[0], offset = _this$quill$getLine16[1]; var numLines = 2; var cur = line; while (cur != null && cur.length() <= 1 && cur.formats()['code-block']) { cur = cur.prev; numLines -= 1; // Requisite prev lines are empty if (numLines <= 0) { var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_2___default.a().retain(range.index + line.length() - offset - 2).retain(1, { 'code-block': null }).delete(1); this.quill.updateContents(delta, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.setSelection(range.index - 1, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.SILENT); return false; } } return true; } }, 'embed left': makeEmbedArrowHandler('ArrowLeft', false), 'embed left shift': makeEmbedArrowHandler('ArrowLeft', true), 'embed right': makeEmbedArrowHandler('ArrowRight', false), 'embed right shift': makeEmbedArrowHandler('ArrowRight', true), 'table down': makeTableArrowHandler(false), 'table up': makeTableArrowHandler(true) } }; function makeCodeBlockHandler(indent) { return { key: 'tab', shiftKey: !indent, format: { 'code-block': true }, handler: function handler(range) { var CodeBlock = this.quill.scroll.query('code-block'); var lines = range.length === 0 ? this.quill.getLines(range.index, 1) : this.quill.getLines(range); var index = range.index, length = range.length; lines.forEach(function (line, i) { if (indent) { line.insertAt(0, CodeBlock.TAB); if (i === 0) { index += CodeBlock.TAB.length; } else { length += CodeBlock.TAB.length; } } else if (line.domNode.textContent.indexOf(CodeBlock.TAB) === 0) { line.deleteAt(0, CodeBlock.TAB.length); if (i === 0) { index -= CodeBlock.TAB.length; } else { length -= CodeBlock.TAB.length; } } }); this.quill.update(_core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); this.quill.setSelection(index, length, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.SILENT); } }; } function makeEmbedArrowHandler(key, shiftKey) { var _ref4; var where = key === 'leftArrow' ? 'prefix' : 'suffix'; return _ref4 = { key: key, shiftKey: shiftKey, altKey: null }, _defineProperty(_ref4, where, /^$/), _defineProperty(_ref4, "handler", function handler(range) { var index = range.index; if (key === 'rightArrow') { index += range.length + 1; } var _this$quill$getLeaf = this.quill.getLeaf(index), _this$quill$getLeaf2 = _slicedToArray(_this$quill$getLeaf, 1), leaf = _this$quill$getLeaf2[0]; if (!(leaf instanceof parchment__WEBPACK_IMPORTED_MODULE_3__["EmbedBlot"])) return true; if (key === 'ArrowLeft') { if (shiftKey) { this.quill.setSelection(range.index - 1, range.length + 1, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } else { this.quill.setSelection(range.index - 1, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } } else if (shiftKey) { this.quill.setSelection(range.index, range.length + 1, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } else { this.quill.setSelection(range.index + range.length + 1, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } return false; }), _ref4; } function makeFormatHandler(format) { return { key: format[0], shortKey: true, handler: function handler(range, context) { this.quill.format(format, !context.format[format], _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } }; } function makeTableArrowHandler(up) { return { key: up ? 'upArrow' : 'downArrow', collapsed: true, format: ['table'], handler: function handler(range, context) { // TODO move to table module var key = up ? 'prev' : 'next'; var cell = context.line; var targetRow = cell.parent[key]; if (targetRow != null) { if (targetRow.statics.blotName === 'table-row') { var targetCell = targetRow.children.head; var cur = cell; while (cur.prev != null) { cur = cur.prev; targetCell = targetCell.next; } var index = targetCell.offset(this.quill.scroll) + Math.min(context.offset, targetCell.length() - 1); this.quill.setSelection(index, 0, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } } else { var targetLine = cell.table()[key]; if (targetLine != null) { if (up) { this.quill.setSelection(targetLine.offset(this.quill.scroll) + targetLine.length() - 1, 0, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } else { this.quill.setSelection(targetLine.offset(this.quill.scroll), 0, _core_quill__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"].sources.USER); } } } return false; } }; } function normalize(binding) { if (typeof binding === 'string' || typeof binding === 'number') { binding = { key: binding }; } else if (_typeof(binding) === 'object') { binding = lodash_clonedeep__WEBPACK_IMPORTED_MODULE_0___default()(binding); } else { return null; } if (binding.shortKey) { binding[SHORTKEY] = binding.shortKey; delete binding.shortKey; } return binding; } function tableSide(table, row, cell, offset) { if (row.prev == null && row.next == null) { if (cell.prev == null && cell.next == null) { return offset === 0 ? -1 : 1; } return cell.prev == null ? -1 : 1; } if (row.prev == null) { return -1; } if (row.next == null) { return 1; } return null; } /***/ }), /* 24 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return DirectionAttribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return DirectionClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return DirectionStyle; }); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); var config = { scope: parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].BLOCK, whitelist: ['rtl'] }; var DirectionAttribute = new parchment__WEBPACK_IMPORTED_MODULE_0__["Attributor"]('direction', 'dir', config); var DirectionClass = new parchment__WEBPACK_IMPORTED_MODULE_0__["ClassAttributor"]('direction', 'ql-direction', config); var DirectionStyle = new parchment__WEBPACK_IMPORTED_MODULE_0__["StyleAttributor"]('direction', 'direction', config); /***/ }), /* 25 */, /* 26 */ /***/ (function(module, exports, __webpack_require__) { /* WEBPACK VAR INJECTION */(function(global, module) {/** * Lodash (Custom Build) <https://lodash.com/> * Build: `lodash modularize exports="npm" -o ./` * Copyright OpenJS Foundation and other contributors <https://openjsf.org/> * Released under MIT license <https://lodash.com/license> * Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE> * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors */ /** Used as the size to enable large array optimizations. */ var LARGE_ARRAY_SIZE = 200; /** Used to stand-in for `undefined` hash values. */ var HASH_UNDEFINED = '__lodash_hash_undefined__'; /** Used to detect hot functions by number of calls within a span of milliseconds. */ var HOT_COUNT = 800, HOT_SPAN = 16; /** Used as references for various `Number` constants. */ var MAX_SAFE_INTEGER = 9007199254740991; /** `Object#toString` result references. */ var argsTag = '[object Arguments]', arrayTag = '[object Array]', asyncTag = '[object AsyncFunction]', boolTag = '[object Boolean]', dateTag = '[object Date]', errorTag = '[object Error]', funcTag = '[object Function]', genTag = '[object GeneratorFunction]', mapTag = '[object Map]', numberTag = '[object Number]', nullTag = '[object Null]', objectTag = '[object Object]', proxyTag = '[object Proxy]', regexpTag = '[object RegExp]', setTag = '[object Set]', stringTag = '[object String]', undefinedTag = '[object Undefined]', weakMapTag = '[object WeakMap]'; var arrayBufferTag = '[object ArrayBuffer]', dataViewTag = '[object DataView]', float32Tag = '[object Float32Array]', float64Tag = '[object Float64Array]', int8Tag = '[object Int8Array]', int16Tag = '[object Int16Array]', int32Tag = '[object Int32Array]', uint8Tag = '[object Uint8Array]', uint8ClampedTag = '[object Uint8ClampedArray]', uint16Tag = '[object Uint16Array]', uint32Tag = '[object Uint32Array]'; /** * Used to match `RegExp` * [syntax characters](http://ecma-international.org/ecma-262/7.0/#sec-patterns). */ var reRegExpChar = /[\\^$.*+?()[\]{}|]/g; /** Used to detect host constructors (Safari). */ var reIsHostCtor = /^\[object .+?Constructor\]$/; /** Used to detect unsigned integer values. */ var reIsUint = /^(?:0|[1-9]\d*)$/; /** Used to identify `toStringTag` values of typed arrays. */ var typedArrayTags = {}; typedArrayTags[float32Tag] = typedArrayTags[float64Tag] = typedArrayTags[int8Tag] = typedArrayTags[int16Tag] = typedArrayTags[int32Tag] = typedArrayTags[uint8Tag] = typedArrayTags[uint8ClampedTag] = typedArrayTags[uint16Tag] = typedArrayTags[uint32Tag] = true; typedArrayTags[argsTag] = typedArrayTags[arrayTag] = typedArrayTags[arrayBufferTag] = typedArrayTags[boolTag] = typedArrayTags[dataViewTag] = typedArrayTags[dateTag] = typedArrayTags[errorTag] = typedArrayTags[funcTag] = typedArrayTags[mapTag] = typedArrayTags[numberTag] = typedArrayTags[objectTag] = typedArrayTags[regexpTag] = typedArrayTags[setTag] = typedArrayTags[stringTag] = typedArrayTags[weakMapTag] = false; /** Detect free variable `global` from Node.js. */ var freeGlobal = typeof global == 'object' && global && global.Object === Object && global; /** Detect free variable `self`. */ var freeSelf = typeof self == 'object' && self && self.Object === Object && self; /** Used as a reference to the global object. */ var root = freeGlobal || freeSelf || Function('return this')(); /** Detect free variable `exports`. */ var freeExports = true && exports && !exports.nodeType && exports; /** Detect free variable `module`. */ var freeModule = freeExports && typeof module == 'object' && module && !module.nodeType && module; /** Detect the popular CommonJS extension `module.exports`. */ var moduleExports = freeModule && freeModule.exports === freeExports; /** Detect free variable `process` from Node.js. */ var freeProcess = moduleExports && freeGlobal.process; /** Used to access faster Node.js helpers. */ var nodeUtil = (function() { try { // Use `util.types` for Node.js 10+. var types = freeModule && freeModule.require && freeModule.require('util').types; if (types) { return types; } // Legacy `process.binding('util')` for Node.js < 10. return freeProcess && freeProcess.binding && freeProcess.binding('util'); } catch (e) {} }()); /* Node.js helper references. */ var nodeIsTypedArray = nodeUtil && nodeUtil.isTypedArray; /** * A faster alternative to `Function#apply`, this function invokes `func` * with the `this` binding of `thisArg` and the arguments of `args`. * * @private * @param {Function} func The function to invoke. * @param {*} thisArg The `this` binding of `func`. * @param {Array} args The arguments to invoke `func` with. * @returns {*} Returns the result of `func`. */ function apply(func, thisArg, args) { switch (args.length) { case 0: return func.call(thisArg); case 1: return func.call(thisArg, args[0]); case 2: return func.call(thisArg, args[0], args[1]); case 3: return func.call(thisArg, args[0], args[1], args[2]); } return func.apply(thisArg, args); } /** * The base implementation of `_.times` without support for iteratee shorthands * or max array length checks. * * @private * @param {number} n The number of times to invoke `iteratee`. * @param {Function} iteratee The function invoked per iteration. * @returns {Array} Returns the array of results. */ function baseTimes(n, iteratee) { var index = -1, result = Array(n); while (++index < n) { result[index] = iteratee(index); } return result; } /** * The base implementation of `_.unary` without support for storing metadata. * * @private * @param {Function} func The function to cap arguments for. * @returns {Function} Returns the new capped function. */ function baseUnary(func) { return function(value) { return func(value); }; } /** * Gets the value at `key` of `object`. * * @private * @param {Object} [object] The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function getValue(object, key) { return object == null ? undefined : object[key]; } /** * Creates a unary function that invokes `func` with its argument transformed. * * @private * @param {Function} func The function to wrap. * @param {Function} transform The argument transform. * @returns {Function} Returns the new function. */ function overArg(func, transform) { return function(arg) { return func(transform(arg)); }; } /** Used for built-in method references. */ var arrayProto = Array.prototype, funcProto = Function.prototype, objectProto = Object.prototype; /** Used to detect overreaching core-js shims. */ var coreJsData = root['__core-js_shared__']; /** Used to resolve the decompiled source of functions. */ var funcToString = funcProto.toString; /** Used to check objects for own properties. */ var hasOwnProperty = objectProto.hasOwnProperty; /** Used to detect methods masquerading as native. */ var maskSrcKey = (function() { var uid = /[^.]+$/.exec(coreJsData && coreJsData.keys && coreJsData.keys.IE_PROTO || ''); return uid ? ('Symbol(src)_1.' + uid) : ''; }()); /** * Used to resolve the * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) * of values. */ var nativeObjectToString = objectProto.toString; /** Used to infer the `Object` constructor. */ var objectCtorString = funcToString.call(Object); /** Used to detect if a method is native. */ var reIsNative = RegExp('^' + funcToString.call(hasOwnProperty).replace(reRegExpChar, '\\$&') .replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g, '$1.*?') + '$' ); /** Built-in value references. */ var Buffer = moduleExports ? root.Buffer : undefined, Symbol = root.Symbol, Uint8Array = root.Uint8Array, allocUnsafe = Buffer ? Buffer.allocUnsafe : undefined, getPrototype = overArg(Object.getPrototypeOf, Object), objectCreate = Object.create, propertyIsEnumerable = objectProto.propertyIsEnumerable, splice = arrayProto.splice, symToStringTag = Symbol ? Symbol.toStringTag : undefined; var defineProperty = (function() { try { var func = getNative(Object, 'defineProperty'); func({}, '', {}); return func; } catch (e) {} }()); /* Built-in method references for those with the same name as other `lodash` methods. */ var nativeIsBuffer = Buffer ? Buffer.isBuffer : undefined, nativeMax = Math.max, nativeNow = Date.now; /* Built-in method references that are verified to be native. */ var Map = getNative(root, 'Map'), nativeCreate = getNative(Object, 'create'); /** * The base implementation of `_.create` without support for assigning * properties to the created object. * * @private * @param {Object} proto The object to inherit from. * @returns {Object} Returns the new object. */ var baseCreate = (function() { function object() {} return function(proto) { if (!isObject(proto)) { return {}; } if (objectCreate) { return objectCreate(proto); } object.prototype = proto; var result = new object; object.prototype = undefined; return result; }; }()); /** * Creates a hash object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Hash(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the hash. * * @private * @name clear * @memberOf Hash */ function hashClear() { this.__data__ = nativeCreate ? nativeCreate(null) : {}; this.size = 0; } /** * Removes `key` and its value from the hash. * * @private * @name delete * @memberOf Hash * @param {Object} hash The hash to modify. * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function hashDelete(key) { var result = this.has(key) && delete this.__data__[key]; this.size -= result ? 1 : 0; return result; } /** * Gets the hash value for `key`. * * @private * @name get * @memberOf Hash * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function hashGet(key) { var data = this.__data__; if (nativeCreate) { var result = data[key]; return result === HASH_UNDEFINED ? undefined : result; } return hasOwnProperty.call(data, key) ? data[key] : undefined; } /** * Checks if a hash value for `key` exists. * * @private * @name has * @memberOf Hash * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function hashHas(key) { var data = this.__data__; return nativeCreate ? (data[key] !== undefined) : hasOwnProperty.call(data, key); } /** * Sets the hash `key` to `value`. * * @private * @name set * @memberOf Hash * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the hash instance. */ function hashSet(key, value) { var data = this.__data__; this.size += this.has(key) ? 0 : 1; data[key] = (nativeCreate && value === undefined) ? HASH_UNDEFINED : value; return this; } // Add methods to `Hash`. Hash.prototype.clear = hashClear; Hash.prototype['delete'] = hashDelete; Hash.prototype.get = hashGet; Hash.prototype.has = hashHas; Hash.prototype.set = hashSet; /** * Creates an list cache object. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function ListCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the list cache. * * @private * @name clear * @memberOf ListCache */ function listCacheClear() { this.__data__ = []; this.size = 0; } /** * Removes `key` and its value from the list cache. * * @private * @name delete * @memberOf ListCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function listCacheDelete(key) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { return false; } var lastIndex = data.length - 1; if (index == lastIndex) { data.pop(); } else { splice.call(data, index, 1); } --this.size; return true; } /** * Gets the list cache value for `key`. * * @private * @name get * @memberOf ListCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function listCacheGet(key) { var data = this.__data__, index = assocIndexOf(data, key); return index < 0 ? undefined : data[index][1]; } /** * Checks if a list cache value for `key` exists. * * @private * @name has * @memberOf ListCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function listCacheHas(key) { return assocIndexOf(this.__data__, key) > -1; } /** * Sets the list cache `key` to `value`. * * @private * @name set * @memberOf ListCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the list cache instance. */ function listCacheSet(key, value) { var data = this.__data__, index = assocIndexOf(data, key); if (index < 0) { ++this.size; data.push([key, value]); } else { data[index][1] = value; } return this; } // Add methods to `ListCache`. ListCache.prototype.clear = listCacheClear; ListCache.prototype['delete'] = listCacheDelete; ListCache.prototype.get = listCacheGet; ListCache.prototype.has = listCacheHas; ListCache.prototype.set = listCacheSet; /** * Creates a map cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function MapCache(entries) { var index = -1, length = entries == null ? 0 : entries.length; this.clear(); while (++index < length) { var entry = entries[index]; this.set(entry[0], entry[1]); } } /** * Removes all key-value entries from the map. * * @private * @name clear * @memberOf MapCache */ function mapCacheClear() { this.size = 0; this.__data__ = { 'hash': new Hash, 'map': new (Map || ListCache), 'string': new Hash }; } /** * Removes `key` and its value from the map. * * @private * @name delete * @memberOf MapCache * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function mapCacheDelete(key) { var result = getMapData(this, key)['delete'](key); this.size -= result ? 1 : 0; return result; } /** * Gets the map value for `key`. * * @private * @name get * @memberOf MapCache * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function mapCacheGet(key) { return getMapData(this, key).get(key); } /** * Checks if a map value for `key` exists. * * @private * @name has * @memberOf MapCache * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function mapCacheHas(key) { return getMapData(this, key).has(key); } /** * Sets the map `key` to `value`. * * @private * @name set * @memberOf MapCache * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the map cache instance. */ function mapCacheSet(key, value) { var data = getMapData(this, key), size = data.size; data.set(key, value); this.size += data.size == size ? 0 : 1; return this; } // Add methods to `MapCache`. MapCache.prototype.clear = mapCacheClear; MapCache.prototype['delete'] = mapCacheDelete; MapCache.prototype.get = mapCacheGet; MapCache.prototype.has = mapCacheHas; MapCache.prototype.set = mapCacheSet; /** * Creates a stack cache object to store key-value pairs. * * @private * @constructor * @param {Array} [entries] The key-value pairs to cache. */ function Stack(entries) { var data = this.__data__ = new ListCache(entries); this.size = data.size; } /** * Removes all key-value entries from the stack. * * @private * @name clear * @memberOf Stack */ function stackClear() { this.__data__ = new ListCache; this.size = 0; } /** * Removes `key` and its value from the stack. * * @private * @name delete * @memberOf Stack * @param {string} key The key of the value to remove. * @returns {boolean} Returns `true` if the entry was removed, else `false`. */ function stackDelete(key) { var data = this.__data__, result = data['delete'](key); this.size = data.size; return result; } /** * Gets the stack value for `key`. * * @private * @name get * @memberOf Stack * @param {string} key The key of the value to get. * @returns {*} Returns the entry value. */ function stackGet(key) { return this.__data__.get(key); } /** * Checks if a stack value for `key` exists. * * @private * @name has * @memberOf Stack * @param {string} key The key of the entry to check. * @returns {boolean} Returns `true` if an entry for `key` exists, else `false`. */ function stackHas(key) { return this.__data__.has(key); } /** * Sets the stack `key` to `value`. * * @private * @name set * @memberOf Stack * @param {string} key The key of the value to set. * @param {*} value The value to set. * @returns {Object} Returns the stack cache instance. */ function stackSet(key, value) { var data = this.__data__; if (data instanceof ListCache) { var pairs = data.__data__; if (!Map || (pairs.length < LARGE_ARRAY_SIZE - 1)) { pairs.push([key, value]); this.size = ++data.size; return this; } data = this.__data__ = new MapCache(pairs); } data.set(key, value); this.size = data.size; return this; } // Add methods to `Stack`. Stack.prototype.clear = stackClear; Stack.prototype['delete'] = stackDelete; Stack.prototype.get = stackGet; Stack.prototype.has = stackHas; Stack.prototype.set = stackSet; /** * Creates an array of the enumerable property names of the array-like `value`. * * @private * @param {*} value The value to query. * @param {boolean} inherited Specify returning inherited property names. * @returns {Array} Returns the array of property names. */ function arrayLikeKeys(value, inherited) { var isArr = isArray(value), isArg = !isArr && isArguments(value), isBuff = !isArr && !isArg && isBuffer(value), isType = !isArr && !isArg && !isBuff && isTypedArray(value), skipIndexes = isArr || isArg || isBuff || isType, result = skipIndexes ? baseTimes(value.length, String) : [], length = result.length; for (var key in value) { if ((inherited || hasOwnProperty.call(value, key)) && !(skipIndexes && ( // Safari 9 has enumerable `arguments.length` in strict mode. key == 'length' || // Node.js 0.10 has enumerable non-index properties on buffers. (isBuff && (key == 'offset' || key == 'parent')) || // PhantomJS 2 has enumerable non-index properties on typed arrays. (isType && (key == 'buffer' || key == 'byteLength' || key == 'byteOffset')) || // Skip index properties. isIndex(key, length) ))) { result.push(key); } } return result; } /** * This function is like `assignValue` except that it doesn't assign * `undefined` values. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignMergeValue(object, key, value) { if ((value !== undefined && !eq(object[key], value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); } } /** * Assigns `value` to `key` of `object` if the existing value is not equivalent * using [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * for equality comparisons. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function assignValue(object, key, value) { var objValue = object[key]; if (!(hasOwnProperty.call(object, key) && eq(objValue, value)) || (value === undefined && !(key in object))) { baseAssignValue(object, key, value); } } /** * Gets the index at which the `key` is found in `array` of key-value pairs. * * @private * @param {Array} array The array to inspect. * @param {*} key The key to search for. * @returns {number} Returns the index of the matched value, else `-1`. */ function assocIndexOf(array, key) { var length = array.length; while (length--) { if (eq(array[length][0], key)) { return length; } } return -1; } /** * The base implementation of `assignValue` and `assignMergeValue` without * value checks. * * @private * @param {Object} object The object to modify. * @param {string} key The key of the property to assign. * @param {*} value The value to assign. */ function baseAssignValue(object, key, value) { if (key == '__proto__' && defineProperty) { defineProperty(object, key, { 'configurable': true, 'enumerable': true, 'value': value, 'writable': true }); } else { object[key] = value; } } /** * The base implementation of `baseForOwn` which iterates over `object` * properties returned by `keysFunc` and invokes `iteratee` for each property. * Iteratee functions may exit iteration early by explicitly returning `false`. * * @private * @param {Object} object The object to iterate over. * @param {Function} iteratee The function invoked per iteration. * @param {Function} keysFunc The function to get the keys of `object`. * @returns {Object} Returns `object`. */ var baseFor = createBaseFor(); /** * The base implementation of `getTag` without fallbacks for buggy environments. * * @private * @param {*} value The value to query. * @returns {string} Returns the `toStringTag`. */ function baseGetTag(value) { if (value == null) { return value === undefined ? undefinedTag : nullTag; } return (symToStringTag && symToStringTag in Object(value)) ? getRawTag(value) : objectToString(value); } /** * The base implementation of `_.isArguments`. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, */ function baseIsArguments(value) { return isObjectLike(value) && baseGetTag(value) == argsTag; } /** * The base implementation of `_.isNative` without bad shim checks. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a native function, * else `false`. */ function baseIsNative(value) { if (!isObject(value) || isMasked(value)) { return false; } var pattern = isFunction(value) ? reIsNative : reIsHostCtor; return pattern.test(toSource(value)); } /** * The base implementation of `_.isTypedArray` without Node.js optimizations. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. */ function baseIsTypedArray(value) { return isObjectLike(value) && isLength(value.length) && !!typedArrayTags[baseGetTag(value)]; } /** * The base implementation of `_.keysIn` which doesn't treat sparse arrays as dense. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function baseKeysIn(object) { if (!isObject(object)) { return nativeKeysIn(object); } var isProto = isPrototype(object), result = []; for (var key in object) { if (!(key == 'constructor' && (isProto || !hasOwnProperty.call(object, key)))) { result.push(key); } } return result; } /** * The base implementation of `_.merge` without support for multiple sources. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {number} srcIndex The index of `source`. * @param {Function} [customizer] The function to customize merged values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMerge(object, source, srcIndex, customizer, stack) { if (object === source) { return; } baseFor(source, function(srcValue, key) { stack || (stack = new Stack); if (isObject(srcValue)) { baseMergeDeep(object, source, key, srcIndex, baseMerge, customizer, stack); } else { var newValue = customizer ? customizer(safeGet(object, key), srcValue, (key + ''), object, source, stack) : undefined; if (newValue === undefined) { newValue = srcValue; } assignMergeValue(object, key, newValue); } }, keysIn); } /** * A specialized version of `baseMerge` for arrays and objects which performs * deep merges and tracks traversed objects enabling objects with circular * references to be merged. * * @private * @param {Object} object The destination object. * @param {Object} source The source object. * @param {string} key The key of the value to merge. * @param {number} srcIndex The index of `source`. * @param {Function} mergeFunc The function to merge values. * @param {Function} [customizer] The function to customize assigned values. * @param {Object} [stack] Tracks traversed source values and their merged * counterparts. */ function baseMergeDeep(object, source, key, srcIndex, mergeFunc, customizer, stack) { var objValue = safeGet(object, key), srcValue = safeGet(source, key), stacked = stack.get(srcValue); if (stacked) { assignMergeValue(object, key, stacked); return; } var newValue = customizer ? customizer(objValue, srcValue, (key + ''), object, source, stack) : undefined; var isCommon = newValue === undefined; if (isCommon) { var isArr = isArray(srcValue), isBuff = !isArr && isBuffer(srcValue), isTyped = !isArr && !isBuff && isTypedArray(srcValue); newValue = srcValue; if (isArr || isBuff || isTyped) { if (isArray(objValue)) { newValue = objValue; } else if (isArrayLikeObject(objValue)) { newValue = copyArray(objValue); } else if (isBuff) { isCommon = false; newValue = cloneBuffer(srcValue, true); } else if (isTyped) { isCommon = false; newValue = cloneTypedArray(srcValue, true); } else { newValue = []; } } else if (isPlainObject(srcValue) || isArguments(srcValue)) { newValue = objValue; if (isArguments(objValue)) { newValue = toPlainObject(objValue); } else if (!isObject(objValue) || isFunction(objValue)) { newValue = initCloneObject(srcValue); } } else { isCommon = false; } } if (isCommon) { // Recursively merge objects and arrays (susceptible to call stack limits). stack.set(srcValue, newValue); mergeFunc(newValue, srcValue, srcIndex, customizer, stack); stack['delete'](srcValue); } assignMergeValue(object, key, newValue); } /** * The base implementation of `_.rest` which doesn't validate or coerce arguments. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @returns {Function} Returns the new function. */ function baseRest(func, start) { return setToString(overRest(func, start, identity), func + ''); } /** * The base implementation of `setToString` without support for hot loop shorting. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var baseSetToString = !defineProperty ? identity : function(func, string) { return defineProperty(func, 'toString', { 'configurable': true, 'enumerable': false, 'value': constant(string), 'writable': true }); }; /** * Creates a clone of `buffer`. * * @private * @param {Buffer} buffer The buffer to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Buffer} Returns the cloned buffer. */ function cloneBuffer(buffer, isDeep) { if (isDeep) { return buffer.slice(); } var length = buffer.length, result = allocUnsafe ? allocUnsafe(length) : new buffer.constructor(length); buffer.copy(result); return result; } /** * Creates a clone of `arrayBuffer`. * * @private * @param {ArrayBuffer} arrayBuffer The array buffer to clone. * @returns {ArrayBuffer} Returns the cloned array buffer. */ function cloneArrayBuffer(arrayBuffer) { var result = new arrayBuffer.constructor(arrayBuffer.byteLength); new Uint8Array(result).set(new Uint8Array(arrayBuffer)); return result; } /** * Creates a clone of `typedArray`. * * @private * @param {Object} typedArray The typed array to clone. * @param {boolean} [isDeep] Specify a deep clone. * @returns {Object} Returns the cloned typed array. */ function cloneTypedArray(typedArray, isDeep) { var buffer = isDeep ? cloneArrayBuffer(typedArray.buffer) : typedArray.buffer; return new typedArray.constructor(buffer, typedArray.byteOffset, typedArray.length); } /** * Copies the values of `source` to `array`. * * @private * @param {Array} source The array to copy values from. * @param {Array} [array=[]] The array to copy values to. * @returns {Array} Returns `array`. */ function copyArray(source, array) { var index = -1, length = source.length; array || (array = Array(length)); while (++index < length) { array[index] = source[index]; } return array; } /** * Copies properties of `source` to `object`. * * @private * @param {Object} source The object to copy properties from. * @param {Array} props The property identifiers to copy. * @param {Object} [object={}] The object to copy properties to. * @param {Function} [customizer] The function to customize copied values. * @returns {Object} Returns `object`. */ function copyObject(source, props, object, customizer) { var isNew = !object; object || (object = {}); var index = -1, length = props.length; while (++index < length) { var key = props[index]; var newValue = customizer ? customizer(object[key], source[key], key, object, source) : undefined; if (newValue === undefined) { newValue = source[key]; } if (isNew) { baseAssignValue(object, key, newValue); } else { assignValue(object, key, newValue); } } return object; } /** * Creates a function like `_.assign`. * * @private * @param {Function} assigner The function to assign values. * @returns {Function} Returns the new assigner function. */ function createAssigner(assigner) { return baseRest(function(object, sources) { var index = -1, length = sources.length, customizer = length > 1 ? sources[length - 1] : undefined, guard = length > 2 ? sources[2] : undefined; customizer = (assigner.length > 3 && typeof customizer == 'function') ? (length--, customizer) : undefined; if (guard && isIterateeCall(sources[0], sources[1], guard)) { customizer = length < 3 ? undefined : customizer; length = 1; } object = Object(object); while (++index < length) { var source = sources[index]; if (source) { assigner(object, source, index, customizer); } } return object; }); } /** * Creates a base function for methods like `_.forIn` and `_.forOwn`. * * @private * @param {boolean} [fromRight] Specify iterating from right to left. * @returns {Function} Returns the new base function. */ function createBaseFor(fromRight) { return function(object, iteratee, keysFunc) { var index = -1, iterable = Object(object), props = keysFunc(object), length = props.length; while (length--) { var key = props[fromRight ? length : ++index]; if (iteratee(iterable[key], key, iterable) === false) { break; } } return object; }; } /** * Gets the data for `map`. * * @private * @param {Object} map The map to query. * @param {string} key The reference key. * @returns {*} Returns the map data. */ function getMapData(map, key) { var data = map.__data__; return isKeyable(key) ? data[typeof key == 'string' ? 'string' : 'hash'] : data.map; } /** * Gets the native function at `key` of `object`. * * @private * @param {Object} object The object to query. * @param {string} key The key of the method to get. * @returns {*} Returns the function if it's native, else `undefined`. */ function getNative(object, key) { var value = getValue(object, key); return baseIsNative(value) ? value : undefined; } /** * A specialized version of `baseGetTag` which ignores `Symbol.toStringTag` values. * * @private * @param {*} value The value to query. * @returns {string} Returns the raw `toStringTag`. */ function getRawTag(value) { var isOwn = hasOwnProperty.call(value, symToStringTag), tag = value[symToStringTag]; try { value[symToStringTag] = undefined; var unmasked = true; } catch (e) {} var result = nativeObjectToString.call(value); if (unmasked) { if (isOwn) { value[symToStringTag] = tag; } else { delete value[symToStringTag]; } } return result; } /** * Initializes an object clone. * * @private * @param {Object} object The object to clone. * @returns {Object} Returns the initialized clone. */ function initCloneObject(object) { return (typeof object.constructor == 'function' && !isPrototype(object)) ? baseCreate(getPrototype(object)) : {}; } /** * Checks if `value` is a valid array-like index. * * @private * @param {*} value The value to check. * @param {number} [length=MAX_SAFE_INTEGER] The upper bounds of a valid index. * @returns {boolean} Returns `true` if `value` is a valid index, else `false`. */ function isIndex(value, length) { var type = typeof value; length = length == null ? MAX_SAFE_INTEGER : length; return !!length && (type == 'number' || (type != 'symbol' && reIsUint.test(value))) && (value > -1 && value % 1 == 0 && value < length); } /** * Checks if the given arguments are from an iteratee call. * * @private * @param {*} value The potential iteratee value argument. * @param {*} index The potential iteratee index or key argument. * @param {*} object The potential iteratee object argument. * @returns {boolean} Returns `true` if the arguments are from an iteratee call, * else `false`. */ function isIterateeCall(value, index, object) { if (!isObject(object)) { return false; } var type = typeof index; if (type == 'number' ? (isArrayLike(object) && isIndex(index, object.length)) : (type == 'string' && index in object) ) { return eq(object[index], value); } return false; } /** * Checks if `value` is suitable for use as unique object key. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is suitable, else `false`. */ function isKeyable(value) { var type = typeof value; return (type == 'string' || type == 'number' || type == 'symbol' || type == 'boolean') ? (value !== '__proto__') : (value === null); } /** * Checks if `func` has its source masked. * * @private * @param {Function} func The function to check. * @returns {boolean} Returns `true` if `func` is masked, else `false`. */ function isMasked(func) { return !!maskSrcKey && (maskSrcKey in func); } /** * Checks if `value` is likely a prototype object. * * @private * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a prototype, else `false`. */ function isPrototype(value) { var Ctor = value && value.constructor, proto = (typeof Ctor == 'function' && Ctor.prototype) || objectProto; return value === proto; } /** * This function is like * [`Object.keys`](http://ecma-international.org/ecma-262/7.0/#sec-object.keys) * except that it includes inherited enumerable properties. * * @private * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. */ function nativeKeysIn(object) { var result = []; if (object != null) { for (var key in Object(object)) { result.push(key); } } return result; } /** * Converts `value` to a string using `Object.prototype.toString`. * * @private * @param {*} value The value to convert. * @returns {string} Returns the converted string. */ function objectToString(value) { return nativeObjectToString.call(value); } /** * A specialized version of `baseRest` which transforms the rest array. * * @private * @param {Function} func The function to apply a rest parameter to. * @param {number} [start=func.length-1] The start position of the rest parameter. * @param {Function} transform The rest array transform. * @returns {Function} Returns the new function. */ function overRest(func, start, transform) { start = nativeMax(start === undefined ? (func.length - 1) : start, 0); return function() { var args = arguments, index = -1, length = nativeMax(args.length - start, 0), array = Array(length); while (++index < length) { array[index] = args[start + index]; } index = -1; var otherArgs = Array(start + 1); while (++index < start) { otherArgs[index] = args[index]; } otherArgs[start] = transform(array); return apply(func, this, otherArgs); }; } /** * Gets the value at `key`, unless `key` is "__proto__" or "constructor". * * @private * @param {Object} object The object to query. * @param {string} key The key of the property to get. * @returns {*} Returns the property value. */ function safeGet(object, key) { if (key === 'constructor' && typeof object[key] === 'function') { return; } if (key == '__proto__') { return; } return object[key]; } /** * Sets the `toString` method of `func` to return `string`. * * @private * @param {Function} func The function to modify. * @param {Function} string The `toString` result. * @returns {Function} Returns `func`. */ var setToString = shortOut(baseSetToString); /** * Creates a function that'll short out and invoke `identity` instead * of `func` when it's called `HOT_COUNT` or more times in `HOT_SPAN` * milliseconds. * * @private * @param {Function} func The function to restrict. * @returns {Function} Returns the new shortable function. */ function shortOut(func) { var count = 0, lastCalled = 0; return function() { var stamp = nativeNow(), remaining = HOT_SPAN - (stamp - lastCalled); lastCalled = stamp; if (remaining > 0) { if (++count >= HOT_COUNT) { return arguments[0]; } } else { count = 0; } return func.apply(undefined, arguments); }; } /** * Converts `func` to its source code. * * @private * @param {Function} func The function to convert. * @returns {string} Returns the source code. */ function toSource(func) { if (func != null) { try { return funcToString.call(func); } catch (e) {} try { return (func + ''); } catch (e) {} } return ''; } /** * Performs a * [`SameValueZero`](http://ecma-international.org/ecma-262/7.0/#sec-samevaluezero) * comparison between two values to determine if they are equivalent. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to compare. * @param {*} other The other value to compare. * @returns {boolean} Returns `true` if the values are equivalent, else `false`. * @example * * var object = { 'a': 1 }; * var other = { 'a': 1 }; * * _.eq(object, object); * // => true * * _.eq(object, other); * // => false * * _.eq('a', 'a'); * // => true * * _.eq('a', Object('a')); * // => false * * _.eq(NaN, NaN); * // => true */ function eq(value, other) { return value === other || (value !== value && other !== other); } /** * Checks if `value` is likely an `arguments` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an `arguments` object, * else `false`. * @example * * _.isArguments(function() { return arguments; }()); * // => true * * _.isArguments([1, 2, 3]); * // => false */ var isArguments = baseIsArguments(function() { return arguments; }()) ? baseIsArguments : function(value) { return isObjectLike(value) && hasOwnProperty.call(value, 'callee') && !propertyIsEnumerable.call(value, 'callee'); }; /** * Checks if `value` is classified as an `Array` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array, else `false`. * @example * * _.isArray([1, 2, 3]); * // => true * * _.isArray(document.body.children); * // => false * * _.isArray('abc'); * // => false * * _.isArray(_.noop); * // => false */ var isArray = Array.isArray; /** * Checks if `value` is array-like. A value is considered array-like if it's * not a function and has a `value.length` that's an integer greater than or * equal to `0` and less than or equal to `Number.MAX_SAFE_INTEGER`. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is array-like, else `false`. * @example * * _.isArrayLike([1, 2, 3]); * // => true * * _.isArrayLike(document.body.children); * // => true * * _.isArrayLike('abc'); * // => true * * _.isArrayLike(_.noop); * // => false */ function isArrayLike(value) { return value != null && isLength(value.length) && !isFunction(value); } /** * This method is like `_.isArrayLike` except that it also checks if `value` * is an object. * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an array-like object, * else `false`. * @example * * _.isArrayLikeObject([1, 2, 3]); * // => true * * _.isArrayLikeObject(document.body.children); * // => true * * _.isArrayLikeObject('abc'); * // => false * * _.isArrayLikeObject(_.noop); * // => false */ function isArrayLikeObject(value) { return isObjectLike(value) && isArrayLike(value); } /** * Checks if `value` is a buffer. * * @static * @memberOf _ * @since 4.3.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a buffer, else `false`. * @example * * _.isBuffer(new Buffer(2)); * // => true * * _.isBuffer(new Uint8Array(2)); * // => false */ var isBuffer = nativeIsBuffer || stubFalse; /** * Checks if `value` is classified as a `Function` object. * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a function, else `false`. * @example * * _.isFunction(_); * // => true * * _.isFunction(/abc/); * // => false */ function isFunction(value) { if (!isObject(value)) { return false; } // The use of `Object#toString` avoids issues with the `typeof` operator // in Safari 9 which returns 'object' for typed arrays and other constructors. var tag = baseGetTag(value); return tag == funcTag || tag == genTag || tag == asyncTag || tag == proxyTag; } /** * Checks if `value` is a valid array-like length. * * **Note:** This method is loosely based on * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength). * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a valid length, else `false`. * @example * * _.isLength(3); * // => true * * _.isLength(Number.MIN_VALUE); * // => false * * _.isLength(Infinity); * // => false * * _.isLength('3'); * // => false */ function isLength(value) { return typeof value == 'number' && value > -1 && value % 1 == 0 && value <= MAX_SAFE_INTEGER; } /** * Checks if `value` is the * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types) * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`) * * @static * @memberOf _ * @since 0.1.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is an object, else `false`. * @example * * _.isObject({}); * // => true * * _.isObject([1, 2, 3]); * // => true * * _.isObject(_.noop); * // => true * * _.isObject(null); * // => false */ function isObject(value) { var type = typeof value; return value != null && (type == 'object' || type == 'function'); } /** * Checks if `value` is object-like. A value is object-like if it's not `null` * and has a `typeof` result of "object". * * @static * @memberOf _ * @since 4.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is object-like, else `false`. * @example * * _.isObjectLike({}); * // => true * * _.isObjectLike([1, 2, 3]); * // => true * * _.isObjectLike(_.noop); * // => false * * _.isObjectLike(null); * // => false */ function isObjectLike(value) { return value != null && typeof value == 'object'; } /** * Checks if `value` is a plain object, that is, an object created by the * `Object` constructor or one with a `[[Prototype]]` of `null`. * * @static * @memberOf _ * @since 0.8.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a plain object, else `false`. * @example * * function Foo() { * this.a = 1; * } * * _.isPlainObject(new Foo); * // => false * * _.isPlainObject([1, 2, 3]); * // => false * * _.isPlainObject({ 'x': 0, 'y': 0 }); * // => true * * _.isPlainObject(Object.create(null)); * // => true */ function isPlainObject(value) { if (!isObjectLike(value) || baseGetTag(value) != objectTag) { return false; } var proto = getPrototype(value); if (proto === null) { return true; } var Ctor = hasOwnProperty.call(proto, 'constructor') && proto.constructor; return typeof Ctor == 'function' && Ctor instanceof Ctor && funcToString.call(Ctor) == objectCtorString; } /** * Checks if `value` is classified as a typed array. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to check. * @returns {boolean} Returns `true` if `value` is a typed array, else `false`. * @example * * _.isTypedArray(new Uint8Array); * // => true * * _.isTypedArray([]); * // => false */ var isTypedArray = nodeIsTypedArray ? baseUnary(nodeIsTypedArray) : baseIsTypedArray; /** * Converts `value` to a plain object flattening inherited enumerable string * keyed properties of `value` to own properties of the plain object. * * @static * @memberOf _ * @since 3.0.0 * @category Lang * @param {*} value The value to convert. * @returns {Object} Returns the converted plain object. * @example * * function Foo() { * this.b = 2; * } * * Foo.prototype.c = 3; * * _.assign({ 'a': 1 }, new Foo); * // => { 'a': 1, 'b': 2 } * * _.assign({ 'a': 1 }, _.toPlainObject(new Foo)); * // => { 'a': 1, 'b': 2, 'c': 3 } */ function toPlainObject(value) { return copyObject(value, keysIn(value)); } /** * Creates an array of the own and inherited enumerable property names of `object`. * * **Note:** Non-object values are coerced to objects. * * @static * @memberOf _ * @since 3.0.0 * @category Object * @param {Object} object The object to query. * @returns {Array} Returns the array of property names. * @example * * function Foo() { * this.a = 1; * this.b = 2; * } * * Foo.prototype.c = 3; * * _.keysIn(new Foo); * // => ['a', 'b', 'c'] (iteration order is not guaranteed) */ function keysIn(object) { return isArrayLike(object) ? arrayLikeKeys(object, true) : baseKeysIn(object); } /** * This method is like `_.assign` except that it recursively merges own and * inherited enumerable string keyed properties of source objects into the * destination object. Source properties that resolve to `undefined` are * skipped if a destination value exists. Array and plain object properties * are merged recursively. Other objects and value types are overridden by * assignment. Source objects are applied from left to right. Subsequent * sources overwrite property assignments of previous sources. * * **Note:** This method mutates `object`. * * @static * @memberOf _ * @since 0.5.0 * @category Object * @param {Object} object The destination object. * @param {...Object} [sources] The source objects. * @returns {Object} Returns `object`. * @example * * var object = { * 'a': [{ 'b': 2 }, { 'd': 4 }] * }; * * var other = { * 'a': [{ 'c': 3 }, { 'e': 5 }] * }; * * _.merge(object, other); * // => { 'a': [{ 'b': 2, 'c': 3 }, { 'd': 4, 'e': 5 }] } */ var merge = createAssigner(function(object, source, srcIndex) { baseMerge(object, source, srcIndex); }); /** * Creates a function that returns `value`. * * @static * @memberOf _ * @since 2.4.0 * @category Util * @param {*} value The value to return from the new function. * @returns {Function} Returns the new constant function. * @example * * var objects = _.times(2, _.constant({ 'a': 1 })); * * console.log(objects); * // => [{ 'a': 1 }, { 'a': 1 }] * * console.log(objects[0] === objects[1]); * // => true */ function constant(value) { return function() { return value; }; } /** * This method returns the first argument it receives. * * @static * @since 0.1.0 * @memberOf _ * @category Util * @param {*} value Any value. * @returns {*} Returns `value`. * @example * * var object = { 'a': 1 }; * * console.log(_.identity(object) === object); * // => true */ function identity(value) { return value; } /** * This method returns `false`. * * @static * @memberOf _ * @since 4.13.0 * @category Util * @returns {boolean} Returns `false`. * @example * * _.times(2, _.stubFalse); * // => [false, false] */ function stubFalse() { return false; } module.exports = merge; /* WEBPACK VAR INJECTION */}.call(this, __webpack_require__(41), __webpack_require__(45)(module))) /***/ }), /* 27 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return AlignAttribute; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return AlignClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "c", function() { return AlignStyle; }); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); var config = { scope: parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].BLOCK, whitelist: ['right', 'center', 'justify'] }; var AlignAttribute = new parchment__WEBPACK_IMPORTED_MODULE_0__["Attributor"]('align', 'align', config); var AlignClass = new parchment__WEBPACK_IMPORTED_MODULE_0__["ClassAttributor"]('align', 'ql-align', config); var AlignStyle = new parchment__WEBPACK_IMPORTED_MODULE_0__["StyleAttributor"]('align', 'text-align', config); /***/ }), /* 28 */, /* 29 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony default export */ __webpack_exports__["a"] = (new WeakMap()); /***/ }), /* 30 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return BackgroundClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return BackgroundStyle; }); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var _color__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(22); var BackgroundClass = new parchment__WEBPACK_IMPORTED_MODULE_0__["ClassAttributor"]('background', 'ql-bg', { scope: parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].INLINE }); var BackgroundStyle = new _color__WEBPACK_IMPORTED_MODULE_1__[/* ColorAttributor */ "a"]('background', 'background-color', { scope: parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].INLINE }); /***/ }), /* 31 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return FontStyle; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return FontClass; }); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var config = { scope: parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].INLINE, whitelist: ['serif', 'monospace'] }; var FontClass = new parchment__WEBPACK_IMPORTED_MODULE_0__["ClassAttributor"]('font', 'ql-font', config); var FontStyleAttributor = /*#__PURE__*/function (_StyleAttributor) { _inherits(FontStyleAttributor, _StyleAttributor); var _super = _createSuper(FontStyleAttributor); function FontStyleAttributor() { _classCallCheck(this, FontStyleAttributor); return _super.apply(this, arguments); } _createClass(FontStyleAttributor, [{ key: "value", value: function value(node) { return _get(_getPrototypeOf(FontStyleAttributor.prototype), "value", this).call(this, node).replace(/["']/g, ''); } }]); return FontStyleAttributor; }(parchment__WEBPACK_IMPORTED_MODULE_0__["StyleAttributor"]); var FontStyle = new FontStyleAttributor('font', 'font-family', config); /***/ }), /* 32 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return SizeClass; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return SizeStyle; }); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); var SizeClass = new parchment__WEBPACK_IMPORTED_MODULE_0__["ClassAttributor"]('size', 'ql-size', { scope: parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].INLINE, whitelist: ['small', 'large', 'huge'] }); var SizeStyle = new parchment__WEBPACK_IMPORTED_MODULE_0__["StyleAttributor"]('size', 'font-size', { scope: parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].INLINE, whitelist: ['10px', '18px', '32px'] }); /***/ }), /* 33 */, /* 34 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return History; }); /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return getLastChangeIndex; }); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var _core_quill__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(1); /* harmony import */ var _core_module__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(11); /* harmony import */ var _utils_hasWindow__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(10); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var History = /*#__PURE__*/function (_Module) { _inherits(History, _Module); var _super = _createSuper(History); function History(quill, options) { var _this; _classCallCheck(this, History); _this = _super.call(this, quill, options); _this.lastRecorded = 0; _this.ignoreChange = false; _this.clear(); _this.quill.on(_core_quill__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].events.EDITOR_CHANGE, function (eventName, delta, oldDelta, source) { if (eventName !== _core_quill__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].events.TEXT_CHANGE || _this.ignoreChange) return; if (!_this.options.userOnly || source === _core_quill__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].sources.USER) { _this.record(delta, oldDelta); } else { _this.transform(delta); } }); _this.quill.keyboard.addBinding({ key: 'z', shortKey: true }, _this.undo.bind(_assertThisInitialized(_this))); _this.quill.keyboard.addBinding({ key: 'z', shortKey: true, shiftKey: true }, _this.redo.bind(_assertThisInitialized(_this))); if (Object(_utils_hasWindow__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"])() && /Win/i.test(navigator.platform)) { _this.quill.keyboard.addBinding({ key: 'y', shortKey: true }, _this.redo.bind(_assertThisInitialized(_this))); } _this.quill.root.addEventListener('beforeinput', function (event) { if (event.inputType === 'historyUndo') { _this.undo(); event.preventDefault(); } else if (event.inputType === 'historyRedo') { _this.redo(); event.preventDefault(); } }); return _this; } _createClass(History, [{ key: "change", value: function change(source, dest) { if (this.stack[source].length === 0) return; var delta = this.stack[source].pop(); var base = this.quill.getContents(); var inverseDelta = delta.invert(base); this.stack[dest].push(inverseDelta); this.lastRecorded = 0; this.ignoreChange = true; this.quill.updateContents(delta, _core_quill__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"].sources.USER); this.ignoreChange = false; var index = getLastChangeIndex(this.quill.scroll, delta); this.quill.setSelection(index); } }, { key: "clear", value: function clear() { this.stack = { undo: [], redo: [] }; } }, { key: "cutoff", value: function cutoff() { this.lastRecorded = 0; } }, { key: "record", value: function record(changeDelta, oldDelta) { if (changeDelta.ops.length === 0) return; this.stack.redo = []; var undoDelta = changeDelta.invert(oldDelta); var timestamp = Date.now(); if (this.lastRecorded + this.options.delay > timestamp && this.stack.undo.length > 0) { var delta = this.stack.undo.pop(); undoDelta = undoDelta.compose(delta); } else { this.lastRecorded = timestamp; } if (undoDelta.length() === 0) return; this.stack.undo.push(undoDelta); if (this.stack.undo.length > this.options.maxStack) { this.stack.undo.shift(); } } }, { key: "redo", value: function redo() { this.change('redo', 'undo'); } }, { key: "transform", value: function transform(delta) { transformStack(this.stack.undo, delta); transformStack(this.stack.redo, delta); } }, { key: "undo", value: function undo() { this.change('undo', 'redo'); } }]); return History; }(_core_module__WEBPACK_IMPORTED_MODULE_2__[/* default */ "a"]); History.DEFAULTS = { delay: 1000, maxStack: 100, userOnly: false }; function transformStack(stack, delta) { var remoteDelta = delta; for (var i = stack.length - 1; i >= 0; i -= 1) { var oldDelta = stack[i]; stack[i] = remoteDelta.transform(oldDelta, true); remoteDelta = oldDelta.transform(remoteDelta); if (stack[i].length() === 0) { stack.splice(i, 1); } } } function endsWithNewlineChange(scroll, delta) { var lastOp = delta.ops[delta.ops.length - 1]; if (lastOp == null) return false; if (lastOp.insert != null) { return typeof lastOp.insert === 'string' && lastOp.insert.endsWith('\n'); } if (lastOp.attributes != null) { return Object.keys(lastOp.attributes).some(function (attr) { return scroll.query(attr, parchment__WEBPACK_IMPORTED_MODULE_0__["Scope"].BLOCK) != null; }); } return false; } function getLastChangeIndex(scroll, delta) { var deleteLength = delta.reduce(function (length, op) { return length + (op.delete || 0); }, 0); var changeIndex = delta.length() - deleteLength; if (endsWithNewlineChange(scroll, delta)) { changeIndex -= 1; } return changeIndex; } /***/ }), /* 35 */, /* 36 */, /* 37 */, /* 38 */, /* 39 */, /* 40 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } var Theme = /*#__PURE__*/function () { function Theme(quill, options) { _classCallCheck(this, Theme); this.quill = quill; this.options = options; this.modules = {}; } _createClass(Theme, [{ key: "init", value: function init() { var _this = this; Object.keys(this.options.modules).forEach(function (name) { if (_this.modules[name] == null) { _this.addModule(name); } }); } }, { key: "addModule", value: function addModule(name) { var ModuleClass = this.quill.constructor.import("modules/".concat(name)); this.modules[name] = new ModuleClass(this.quill, this.options.modules[name] || {}); return this.modules[name]; } }]); return Theme; }(); Theme.DEFAULTS = { modules: {} }; Theme.themes = { default: Theme }; /* harmony default export */ __webpack_exports__["a"] = (Theme); /***/ }), /* 41 */ /***/ (function(module, exports) { var g; // This works in non-strict mode g = (function() { return this; })(); try { // This works if eval is allowed (see CSP) g = g || new Function("return this")(); } catch (e) { // This works if the window reference is available if (typeof window === "object") g = window; } // g can still be undefined, but nothing to do about it... // We return undefined, instead of nothing here, so it's // easier to handle this case. if(!global) { ...} module.exports = g; /***/ }), /* 42 */, /* 43 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(2); /* harmony import */ var _text__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(7); function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _get(target, property, receiver) { if (typeof Reflect !== "undefined" && Reflect.get) { _get = Reflect.get; } else { _get = function _get(target, property, receiver) { var base = _superPropBase(target, property); if (!base) return; var desc = Object.getOwnPropertyDescriptor(base, property); if (desc.get) { return desc.get.call(receiver); } return desc.value; }; } return _get(target, property, receiver || target); } function _superPropBase(object, property) { while (!Object.prototype.hasOwnProperty.call(object, property)) { object = _getPrototypeOf(object); if (object === null) break; } return object; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var GUARD_TEXT = "\uFEFF"; var Embed = /*#__PURE__*/function (_EmbedBlot) { _inherits(Embed, _EmbedBlot); var _super = _createSuper(Embed); function Embed(scroll, node) { var _this; _classCallCheck(this, Embed); _this = _super.call(this, scroll, node); _this.contentNode = document.createElement('span'); _this.contentNode.setAttribute('contenteditable', false); Array.from(_this.domNode.childNodes).forEach(function (childNode) { _this.contentNode.appendChild(childNode); }); _this.leftGuard = document.createTextNode(GUARD_TEXT); _this.rightGuard = document.createTextNode(GUARD_TEXT); _this.domNode.appendChild(_this.leftGuard); _this.domNode.appendChild(_this.contentNode); _this.domNode.appendChild(_this.rightGuard); return _this; } _createClass(Embed, [{ key: "index", value: function index(node, offset) { if (node === this.leftGuard) return 0; if (node === this.rightGuard) return 1; return _get(_getPrototypeOf(Embed.prototype), "index", this).call(this, node, offset); } }, { key: "restore", value: function restore(node) { var range; var textNode; var text = node.data.split(GUARD_TEXT).join(''); if (node === this.leftGuard) { if (this.prev instanceof _text__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]) { var prevLength = this.prev.length(); this.prev.insertAt(prevLength, text); range = { startNode: this.prev.domNode, startOffset: prevLength + text.length }; } else { textNode = document.createTextNode(text); this.parent.insertBefore(this.scroll.create(textNode), this); range = { startNode: textNode, startOffset: text.length }; } } else if (node === this.rightGuard) { if (this.next instanceof _text__WEBPACK_IMPORTED_MODULE_1__[/* default */ "a"]) { this.next.insertAt(0, text); range = { startNode: this.next.domNode, startOffset: text.length }; } else { textNode = document.createTextNode(text); this.parent.insertBefore(this.scroll.create(textNode), this.next); range = { startNode: textNode, startOffset: text.length }; } } node.data = GUARD_TEXT; return range; } }, { key: "update", value: function update(mutations, context) { var _this2 = this; mutations.forEach(function (mutation) { if (mutation.type === 'characterData' && (mutation.target === _this2.leftGuard || mutation.target === _this2.rightGuard)) { var range = _this2.restore(mutation.target); if (range) context.range = range; } }); } }]); return Embed; }(parchment__WEBPACK_IMPORTED_MODULE_0__["EmbedBlot"]); /* harmony default export */ __webpack_exports__["a"] = (Embed); /***/ }), /* 44 */ /***/ (function(module, __webpack_exports__, __webpack_require__) { "use strict"; /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "a", function() { return Clipboard; }); /* unused harmony export matchAttributor */ /* unused harmony export matchBlot */ /* unused harmony export matchNewline */ /* unused harmony export matchText */ /* harmony export (binding) */ __webpack_require__.d(__webpack_exports__, "b", function() { return traverse; }); /* harmony import */ var quill_delta__WEBPACK_IMPORTED_MODULE_0__ = __webpack_require__(0); /* harmony import */ var quill_delta__WEBPACK_IMPORTED_MODULE_0___default = /*#__PURE__*/__webpack_require__.n(quill_delta__WEBPACK_IMPORTED_MODULE_0__); /* harmony import */ var parchment__WEBPACK_IMPORTED_MODULE_1__ = __webpack_require__(2); /* harmony import */ var _blots_block__WEBPACK_IMPORTED_MODULE_2__ = __webpack_require__(5); /* harmony import */ var _core_quill__WEBPACK_IMPORTED_MODULE_3__ = __webpack_require__(1); /* harmony import */ var _core_logger__WEBPACK_IMPORTED_MODULE_4__ = __webpack_require__(15); /* harmony import */ var _core_module__WEBPACK_IMPORTED_MODULE_5__ = __webpack_require__(11); /* harmony import */ var _formats_align__WEBPACK_IMPORTED_MODULE_6__ = __webpack_require__(27); /* harmony import */ var _formats_background__WEBPACK_IMPORTED_MODULE_7__ = __webpack_require__(30); /* harmony import */ var _formats_code__WEBPACK_IMPORTED_MODULE_8__ = __webpack_require__(13); /* harmony import */ var _formats_color__WEBPACK_IMPORTED_MODULE_9__ = __webpack_require__(22); /* harmony import */ var _formats_direction__WEBPACK_IMPORTED_MODULE_10__ = __webpack_require__(24); /* harmony import */ var _formats_font__WEBPACK_IMPORTED_MODULE_11__ = __webpack_require__(31); /* harmony import */ var _formats_size__WEBPACK_IMPORTED_MODULE_12__ = __webpack_require__(32); function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; } function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; } function _typeof(obj) { "@babel/helpers - typeof"; if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); } function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; } function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest(); } function _nonIterableRest() { throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method."); } function _unsupportedIterableToArray(o, minLen) { if (!o) return; if (typeof o === "string") return _arrayLikeToArray(o, minLen); var n = Object.prototype.toString.call(o).slice(8, -1); if (n === "Object" && o.constructor) n = o.constructor.name; if (n === "Map" || n === "Set") return Array.from(o); if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)) return _arrayLikeToArray(o, minLen); } function _arrayLikeToArray(arr, len) { if (len == null || len > arr.length) len = arr.length; for (var i = 0, arr2 = new Array(len); i < len; i++) { arr2[i] = arr[i]; } return arr2; } function _iterableToArrayLimit(arr, i) { if (typeof Symbol === "undefined" || !(Symbol.iterator in Object(arr))) return; var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i["return"] != null) _i["return"](); } finally { if (_d) throw _e; } } return _arr; } function _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; } function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a 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); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _inherits(subClass, superClass) { if (typeof superClass !== "function" && superClass !== null) { throw new TypeError("Super expression must either be null or a function"); } subClass.prototype = Object.create(superClass && superClass.prototype, { constructor: { value: subClass, writable: true, configurable: true } }); if (superClass) _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } function _createSuper(Derived) { var hasNativeReflectConstruct = _isNativeReflectConstruct(); return function _createSuperInternal() { var Super = _getPrototypeOf(Derived), result; if (hasNativeReflectConstruct) { var NewTarget = _getPrototypeOf(this).constructor; result = Reflect.construct(Super, arguments, NewTarget); } else { result = Super.apply(this, arguments); } return _possibleConstructorReturn(this, result); }; } function _possibleConstructorReturn(self, call) { if (call && (_typeof(call) === "object" || typeof call === "function")) { return call; } return _assertThisInitialized(self); } function _assertThisInitialized(self) { if (self === void 0) { throw new ReferenceError("this hasn't been initialised - super() hasn't been called"); } return self; } function _isNativeReflectConstruct() { if (typeof Reflect === "undefined" || !Reflect.construct) return false; if (Reflect.construct.sham) return false; if (typeof Proxy === "function") return true; try { Date.prototype.toString.call(Reflect.construct(Date, [], function () {})); return true; } catch (e) { return false; } } function _getPrototypeOf(o) { _getPrototypeOf = Object.setPrototypeOf ? Object.getPrototypeOf : function _getPrototypeOf(o) { return o.__proto__ || Object.getPrototypeOf(o); }; return _getPrototypeOf(o); } var debug = Object(_core_logger__WEBPACK_IMPORTED_MODULE_4__[/* default */ "a"])('quill:clipboard'); var ELEMENT_NODE = 1; var TEXT_NODE = 3; var CLIPBOARD_CONFIG = [[TEXT_NODE, matchText], [TEXT_NODE, matchNewline], ['br', matchBreak], [ELEMENT_NODE, matchNewline], [ELEMENT_NODE, matchBlot], [ELEMENT_NODE, matchAttributor], [ELEMENT_NODE, matchStyles], ['li', matchIndent], ['ol, ul', matchList], ['pre', matchCodeBlock], ['tr', matchTable], ['b', matchAlias.bind(matchAlias, 'bold')], ['i', matchAlias.bind(matchAlias, 'italic')], ['strike', matchAlias.bind(matchAlias, 'strike')], ['style', matchIgnore]]; var ATTRIBUTE_ATTRIBUTORS = [_formats_align__WEBPACK_IMPORTED_MODULE_6__[/* AlignAttribute */ "a"], _formats_direction__WEBPACK_IMPORTED_MODULE_10__[/* DirectionAttribute */ "a"]].reduce(function (memo, attr) { memo[attr.keyName] = attr; return memo; }, {}); var STYLE_ATTRIBUTORS = [_formats_align__WEBPACK_IMPORTED_MODULE_6__[/* AlignStyle */ "c"], _formats_background__WEBPACK_IMPORTED_MODULE_7__[/* BackgroundStyle */ "b"], _formats_color__WEBPACK_IMPORTED_MODULE_9__[/* ColorStyle */ "c"], _formats_direction__WEBPACK_IMPORTED_MODULE_10__[/* DirectionStyle */ "c"], _formats_font__WEBPACK_IMPORTED_MODULE_11__[/* FontStyle */ "b"], _formats_size__WEBPACK_IMPORTED_MODULE_12__[/* SizeStyle */ "b"]].reduce(function (memo, attr) { memo[attr.keyName] = attr; return memo; }, {}); var Clipboard = /*#__PURE__*/function (_Module) { _inherits(Clipboard, _Module); var _super = _createSuper(Clipboard); function Clipboard(quill, options) { var _this; _classCallCheck(this, Clipboard); _this = _super.call(this, quill, options); _this.quill.root.addEventListener('copy', function (e) { return _this.onCaptureCopy(e, false); }); _this.quill.root.addEventListener('cut', function (e) { return _this.onCaptureCopy(e, true); }); _this.quill.root.addEventListener('paste', _this.onCapturePaste.bind(_assertThisInitialized(_this))); _this.matchers = []; CLIPBOARD_CONFIG.concat(_this.options.matchers).forEach(function (_ref) { var _ref2 = _slicedToArray(_ref, 2), selector = _ref2[0], matcher = _ref2[1]; _this.addMatcher(selector, matcher); }); return _this; } _createClass(Clipboard, [{ key: "addMatcher", value: function addMatcher(selector, matcher) { this.matchers.push([selector, matcher]); } }, { key: "convert", value: function convert(_ref3) { var html = _ref3.html, text = _ref3.text; var formats = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {}; if (formats[_formats_code__WEBPACK_IMPORTED_MODULE_8__[/* default */ "c"].blotName]) { return new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a().insert(text, _defineProperty({}, _formats_code__WEBPACK_IMPORTED_MODULE_8__[/* default */ "c"].blotName, formats[_formats_code__WEBPACK_IMPORTED_MODULE_8__[/* default */ "c"].blotName])); } return html ? this.applyMatchers(html, formats) : this.applyTextMatchers(text); } }, { key: "applyTextMatchers", value: function applyTextMatchers() { var _this2 = this; var text = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : ''; if (text.length === 0) { return new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a(); } var matchers = this.prepareTextMatching(); var element = this.quill.root.ownerDocument.createElement('div'); element.textContent = text; var node = element.childNodes[0]; return matchers.reduce(function (delta, matcher) { return matcher(node, delta, _this2.quill.scroll); }, new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a()); } }, { key: "applyMatchers", value: function applyMatchers(html, formats) { var doc = new DOMParser().parseFromString(html, 'text/html'); var container = doc.body; var nodeMatches = new WeakMap(); var _this$prepareMatching = this.prepareMatching(container, nodeMatches), _this$prepareMatching2 = _slicedToArray(_this$prepareMatching, 2), elementMatchers = _this$prepareMatching2[0], textMatchers = _this$prepareMatching2[1]; var delta = traverse(this.quill.scroll, container, elementMatchers, textMatchers, nodeMatches); // Remove trailing newline if (deltaEndsWith(delta, '\n') && (delta.ops[delta.ops.length - 1].attributes == null || formats.table)) { return delta.compose(new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a().retain(delta.length() - 1).delete(1)); } return delta; } }, { key: "dangerouslyPasteHTML", value: function dangerouslyPasteHTML(index, html) { var source = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : _core_quill__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.API; if (typeof index === 'string') { var delta = this.convert({ html: index, text: '' }); this.quill.setContents(delta, html); this.quill.setSelection(0, _core_quill__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.SILENT); } else { var paste = this.convert({ html: html, text: '' }); this.quill.updateContents(new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a().retain(index).concat(paste), source); this.quill.setSelection(index + paste.length(), _core_quill__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.SILENT); } } }, { key: "onCaptureCopy", value: function onCaptureCopy(e) { var isCut = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : false; if (e.defaultPrevented) return; if (e.clipboardData) { e.preventDefault(); } else { return; } var _this$quill$selection = this.quill.selection.getRange(), _this$quill$selection2 = _slicedToArray(_this$quill$selection, 1), range = _this$quill$selection2[0]; if (range == null) return; var _this$onCopy = this.onCopy(range, isCut), html = _this$onCopy.html, text = _this$onCopy.text; e.clipboardData.setData('text/plain', text); e.clipboardData.setData('text/html', html); if (isCut) { this.raiseCallback('onCut', e); this.quill.deleteText(range, _core_quill__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.USER); } } }, { key: "onCapturePaste", value: function onCapturePaste(e) { if (e.defaultPrevented || !this.quill.isEnabled()) return; this.raiseCallback('onPaste', e); if (e.clipboardData) { e.preventDefault(); } else { return; } var range = this.quill.getSelection(true); if (range == null) return; var html = e.clipboardData.getData('text/html'); var text = e.clipboardData.getData('text/plain'); var files = Array.from(e.clipboardData.files || []); if (!html && files.length > 0) { this.quill.uploader.upload(range, files); } else { this.onPaste(range, { html: html, text: text }); } } }, { key: "raiseCallback", value: function raiseCallback(name, event) { var callback = this.options[name]; if (callback && typeof callback === 'function') { callback(event); } } }, { key: "onCopy", value: function onCopy(range) { var text = this.quill.getText(range); var html = this.quill.getSemanticHTML(range); return { html: html, text: text }; } }, { key: "onPaste", value: function onPaste(range, _ref4) { var text = _ref4.text, html = _ref4.html; var formats = this.quill.getFormat(range.index); var pastedDelta = this.convert({ text: text, html: html }, formats); debug.log('onPaste', pastedDelta, { text: text, html: html }); var delta = new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a().retain(range.index).delete(range.length).concat(pastedDelta); this.quill.updateContents(delta, _core_quill__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.USER); // range.length contributes to delta.length() this.quill.setSelection(delta.length() - range.length, _core_quill__WEBPACK_IMPORTED_MODULE_3__[/* default */ "a"].sources.SILENT); this.quill.scrollIntoView(); } }, { key: "prepareMatching", value: function prepareMatching(container, nodeMatches) { var elementMatchers = []; var textMatchers = []; this.matchers.forEach(function (pair) { var _pair = _slicedToArray(pair, 2), selector = _pair[0], matcher = _pair[1]; switch (selector) { case TEXT_NODE: textMatchers.push(matcher); break; case ELEMENT_NODE: elementMatchers.push(matcher); break; default: Array.from(container.querySelectorAll(selector)).forEach(function (node) { if (nodeMatches.has(node)) { var matches = nodeMatches.get(node); matches.push(matcher); } else { nodeMatches.set(node, [matcher]); } }); break; } }); return [elementMatchers, textMatchers]; } }, { key: "prepareTextMatching", value: function prepareTextMatching() { var textMatchers = []; this.matchers.forEach(function (pair) { var _pair2 = _slicedToArray(pair, 2), selector = _pair2[0], matcher = _pair2[1]; if (selector === TEXT_NODE) { textMatchers.push(matcher); } }); return textMatchers; } }]); return Clipboard; }(_core_module__WEBPACK_IMPORTED_MODULE_5__[/* default */ "a"]); Clipboard.DEFAULTS = { matchers: [] }; function applyFormat(delta, format, value) { if (_typeof(format) === 'object') { return Object.keys(format).reduce(function (newDelta, key) { return applyFormat(newDelta, key, format[key]); }, delta); } return delta.reduce(function (newDelta, op) { if (op.attributes && op.attributes[format]) { return newDelta.push(op); } var formats = value ? _defineProperty({}, format, value) : {}; return newDelta.insert(op.insert, _objectSpread(_objectSpread({}, formats), op.attributes)); }, new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a()); } function deltaEndsWith(delta, text) { var endText = ''; for (var i = delta.ops.length - 1; i >= 0 && endText.length < text.length; --i // eslint-disable-line no-plusplus ) { var op = delta.ops[i]; if (typeof op.insert !== 'string') break; endText = op.insert + endText; } return endText.slice(-1 * text.length) === text; } function isLine(node) { if (node.childNodes.length === 0) return false; // Exclude embed blocks return ['address', 'article', 'blockquote', 'canvas', 'dd', 'div', 'dl', 'dt', 'fieldset', 'figcaption', 'figure', 'footer', 'form', 'h1', 'h2', 'h3', 'h4', 'h5', 'h6', 'header', 'iframe', 'li', 'main', 'nav', 'ol', 'output', 'p', 'pre', 'section', 'table', 'td', 'tr', 'ul', 'video'].indexOf(node.tagName.toLowerCase()) !== -1; } var preNodes = new WeakMap(); function isPre(node) { if (node == null) return false; if (!preNodes.has(node)) { if (node.tagName === 'PRE') { preNodes.set(node, true); } else { preNodes.set(node, isPre(node.parentNode)); } } return preNodes.get(node); } function traverse(scroll, node, elementMatchers, textMatchers, nodeMatches) { // Post-order if (node.nodeType === node.TEXT_NODE) { return textMatchers.reduce(function (delta, matcher) { return matcher(node, delta, scroll); }, new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a()); } if (node.nodeType === node.ELEMENT_NODE) { return Array.from(node.childNodes || []).reduce(function (delta, childNode) { var childrenDelta = traverse(scroll, childNode, elementMatchers, textMatchers, nodeMatches); if (childNode.nodeType === node.ELEMENT_NODE) { childrenDelta = elementMatchers.reduce(function (reducedDelta, matcher) { return matcher(childNode, reducedDelta, scroll); }, childrenDelta); childrenDelta = (nodeMatches.get(childNode) || []).reduce(function (reducedDelta, matcher) { return matcher(childNode, reducedDelta, scroll); }, childrenDelta); } return delta.concat(childrenDelta); }, new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a()); } return new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a(); } function matchAlias(format, node, delta) { return applyFormat(delta, format, true); } function matchAttributor(node, delta, scroll) { var attributes = parchment__WEBPACK_IMPORTED_MODULE_1__["Attributor"].keys(node); var classes = parchment__WEBPACK_IMPORTED_MODULE_1__["ClassAttributor"].keys(node); var styles = parchment__WEBPACK_IMPORTED_MODULE_1__["StyleAttributor"].keys(node); var formats = {}; attributes.concat(classes).concat(styles).forEach(function (name) { var attr = scroll.query(name, parchment__WEBPACK_IMPORTED_MODULE_1__["Scope"].ATTRIBUTE); if (attr != null) { formats[attr.attrName] = attr.value(node); if (formats[attr.attrName]) return; } attr = ATTRIBUTE_ATTRIBUTORS[name]; if (attr != null && (attr.attrName === name || attr.keyName === name)) { formats[attr.attrName] = attr.value(node) || undefined; } attr = STYLE_ATTRIBUTORS[name]; if (attr != null && (attr.attrName === name || attr.keyName === name)) { attr = STYLE_ATTRIBUTORS[name]; formats[attr.attrName] = attr.value(node) || undefined; } }); if (Object.keys(formats).length > 0) { return applyFormat(delta, formats); } return delta; } function matchBlot(node, delta, scroll) { var match = scroll.query(node); if (match == null) return delta; if (match.prototype instanceof parchment__WEBPACK_IMPORTED_MODULE_1__["EmbedBlot"]) { var embed = {}; var value = match.value(node); if (value != null) { embed[match.blotName] = value; return new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a().insert(embed, match.formats(node, scroll)); } } else { if (match.prototype instanceof parchment__WEBPACK_IMPORTED_MODULE_1__["BlockBlot"] && !deltaEndsWith(delta, '\n')) { delta.insert('\n'); } if (typeof match.formats === 'function') { return applyFormat(delta, match.blotName, match.formats(node, scroll)); } } return delta; } function matchBreak(node, delta) { if (!deltaEndsWith(delta, '\n')) { delta.insert('\n'); } return delta; } function matchCodeBlock(node, delta, scroll) { var match = scroll.query('code-block'); var language = match ? match.formats(node, scroll) : true; return applyFormat(delta, 'code-block', language); } function matchIgnore() { return new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a(); } function matchIndent(node, delta, scroll) { var match = scroll.query(node); if (match == null || match.blotName !== 'list' || !deltaEndsWith(delta, '\n')) { return delta; } var indent = -1; var parent = node.parentNode; while (parent != null) { if (['OL', 'UL'].indexOf(parent.tagName) !== -1) { indent += 1; } parent = parent.parentNode; } if (indent <= 0) return delta; return delta.reduce(function (composed, op) { if (op.attributes && typeof op.attributes.indent === 'number') { return composed.push(op); } return composed.insert(op.insert, _objectSpread({ indent: indent }, op.attributes || {})); }, new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a()); } function matchList(node, delta) { var list = node.tagName === 'OL' ? 'ordered' : 'bullet'; return applyFormat(delta, 'list', list); } function matchNewline(node, delta, scroll) { if (!deltaEndsWith(delta, '\n')) { if (isLine(node)) { return delta.insert('\n'); } if (delta.length() > 0 && node.nextSibling) { var nextSibling = node.nextSibling; while (nextSibling != null) { if (isLine(nextSibling)) { return delta.insert('\n'); } var match = scroll.query(nextSibling); if (match && match.prototype instanceof _blots_block__WEBPACK_IMPORTED_MODULE_2__[/* BlockEmbed */ "a"]) { return delta.insert('\n'); } nextSibling = nextSibling.firstChild; } } } return delta; } function matchStyles(node, delta) { var formats = {}; var style = node.style || {}; if (style.fontStyle === 'italic') { formats.italic = true; } if (style.textDecoration.indexOf('underline') !== -1) { formats.underline = true; } if (style.textDecoration.indexOf('line-through') !== -1) { formats.strike = true; } if (style.fontWeight.indexOf('bold') === 0 || parseInt(style.fontWeight, 10) >= 700) { formats.bold = true; } if (Object.keys(formats).length > 0) { delta = applyFormat(delta, formats); } if (parseFloat(style.textIndent || 0) > 0) { // Could be 0.5in return new quill_delta__WEBPACK_IMPORTED_MODULE_0___default.a().insert('\t').concat(delta); } return delta; } function matchTable(node, delta) { var table = node.parentNode.tagName === 'TABLE' ? node.parentNode : node.parentNode.parentNode; var rows = Array.from(table.querySelectorAll('tr')); var row = rows.indexOf(node) + 1; return applyFormat(delta, 'table', row); } function matchText(node, delta) { var text = node.data; // Word represents empty line with <o:p>&nbsp;</o:p> if (node.parentNode.tagName === 'O:P') { return delta.insert(text.trim()); } if (text.trim().length === 0 && text.indexOf('\n') !== -1) { return delta; } if (!isPre(node)) { var replacer = function replacer(collapse, match) { var replaced = match.replace(/[^\u00a0]/g, ''); // \u00a0 is nbsp; return replaced.length < 1 && collapse ? ' ' : replaced; }; text = text.replace(/\r\n/g, ' ').replace(/\n/g, ' '); text = text.replace(/\s\s+/g, replacer.bind(replacer, true)); // collapse whitespace if (node.previousSibling == null && isLine(node.parentNode) || node.previousSibling != null && isLine(node.previousSibling)) { text = text.replace(/^\s+/, replacer.bind(replacer, false)); } if (node.nextSibling == null && isLine(node.parentNode) || node.nextSibling != null && isLine(node.nextSibling)) { text = text.replace(/\s+$/, replacer.bind(replacer, false)); } } return delta.insert(text); } /***/ }), /* 45 */ /***/ (function(module, exports) { module.exports = function(module) { if (!module.webpackPolyfill) { module.deprecate = function() {}; module.paths = []; // module.parent = undefined by default if (!module.children) module.children = []; Object.defineProperty(module, "loaded", { enumerable: true, get: function() { return module.l; } }); Object.defineProperty(module, "id", { enumerable: true, get: function() { return module.i; } }); module.webpackPolyfill = 1; } return module; }; /***/ }), /* 46 */, /* 47 */, /* 48 */, /* 49 */, /* 50 */, /* 51 */, /* 52 */, /* 53 */, /* 54 */, /* 55 */, /* 56 */, /* 57 */, /* 58 */, /* 59 */, /* 60 */, /* 61 */, /* 62 */, /* 63 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var Iterator_1 = __importDefault(__webpack_require__(87)); var Op; (function (Op) { function iterator(ops) { return new Iterator_1.default(ops); } Op.iterator = iterator; function length(op) { if (typeof op.delete === 'number') { return op.delete; } else if (typeof op.retain === 'number') { return op.retain; } else { return typeof op.insert === 'string' ? op.insert.length : 1; } } Op.length = length; })(Op || (Op = {})); exports.default = Op; /***/ }), /* 64 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var has = Object.prototype.hasOwnProperty , prefix = '~'; /** * Constructor to create a storage for our `EE` objects. * An `Events` instance is a plain object whose properties are event names. * * @constructor * @private */ function Events() {} // // We try to not inherit from `Object.prototype`. In some engines creating an // instance in this way is faster than calling `Object.create(null)` directly. // If `Object.create(null)` is not supported we prefix the event names with a // character to make sure that the built-in object properties are not // overridden or used as an attack vector. // if (Object.create) { Events.prototype = Object.create(null); // // This hack is needed because the `__proto__` property is still inherited in // some old browsers like Android 4, iPhone 5.1, Opera 11 and Safari 5. // if (!new Events().__proto__) prefix = false; } /** * Representation of a single event listener. * * @param {Function} fn The listener function. * @param {*} context The context to invoke the listener with. * @param {Boolean} [once=false] Specify if the listener is a one-time listener. * @constructor * @private */ function EE(fn, context, once) { this.fn = fn; this.context = context; this.once = once || false; } /** * Add a listener for a given event. * * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} context The context to invoke the listener with. * @param {Boolean} once Specify if the listener is a one-time listener. * @returns {EventEmitter} * @private */ function addListener(emitter, event, fn, context, once) { if (typeof fn !== 'function') { throw new TypeError('The listener must be a function'); } var listener = new EE(fn, context || emitter, once) , evt = prefix ? prefix + event : event; if (!emitter._events[evt]) emitter._events[evt] = listener, emitter._eventsCount++; else if (!emitter._events[evt].fn) emitter._events[evt].push(listener); else emitter._events[evt] = [emitter._events[evt], listener]; return emitter; } /** * Clear event by name. * * @param {EventEmitter} emitter Reference to the `EventEmitter` instance. * @param {(String|Symbol)} evt The Event name. * @private */ function clearEvent(emitter, evt) { if (--emitter._eventsCount === 0) emitter._events = new Events(); else delete emitter._events[evt]; } /** * Minimal `EventEmitter` interface that is molded against the Node.js * `EventEmitter` interface. * * @constructor * @public */ function EventEmitter() { this._events = new Events(); this._eventsCount = 0; } /** * Return an array listing the events for which the emitter has registered * listeners. * * @returns {Array} * @public */ EventEmitter.prototype.eventNames = function eventNames() { var names = [] , events , name; if (this._eventsCount === 0) return names; for (name in (events = this._events)) { if (has.call(events, name)) names.push(prefix ? name.slice(1) : name); } if (Object.getOwnPropertySymbols) { return names.concat(Object.getOwnPropertySymbols(events)); } return names; }; /** * Return the listeners registered for a given event. * * @param {(String|Symbol)} event The event name. * @returns {Array} The registered listeners. * @public */ EventEmitter.prototype.listeners = function listeners(event) { var evt = prefix ? prefix + event : event , handlers = this._events[evt]; if (!handlers) return []; if (handlers.fn) return [handlers.fn]; for (var i = 0, l = handlers.length, ee = new Array(l); i < l; i++) { ee[i] = handlers[i].fn; } return ee; }; /** * Return the number of listeners listening to a given event. * * @param {(String|Symbol)} event The event name. * @returns {Number} The number of listeners. * @public */ EventEmitter.prototype.listenerCount = function listenerCount(event) { var evt = prefix ? prefix + event : event , listeners = this._events[evt]; if (!listeners) return 0; if (listeners.fn) return 1; return listeners.length; }; /** * Calls each of the listeners registered for a given event. * * @param {(String|Symbol)} event The event name. * @returns {Boolean} `true` if the event had listeners, else `false`. * @public */ EventEmitter.prototype.emit = function emit(event, a1, a2, a3, a4, a5) { var evt = prefix ? prefix + event : event; if (!this._events[evt]) return false; var listeners = this._events[evt] , len = arguments.length , args , i; if (listeners.fn) { if (listeners.once) this.removeListener(event, listeners.fn, undefined, true); switch (len) { case 1: return listeners.fn.call(listeners.context), true; case 2: return listeners.fn.call(listeners.context, a1), true; case 3: return listeners.fn.call(listeners.context, a1, a2), true; case 4: return listeners.fn.call(listeners.context, a1, a2, a3), true; case 5: return listeners.fn.call(listeners.context, a1, a2, a3, a4), true; case 6: return listeners.fn.call(listeners.context, a1, a2, a3, a4, a5), true; } for (i = 1, args = new Array(len -1); i < len; i++) { args[i - 1] = arguments[i]; } listeners.fn.apply(listeners.context, args); } else { var length = listeners.length , j; for (i = 0; i < length; i++) { if (listeners[i].once) this.removeListener(event, listeners[i].fn, undefined, true); switch (len) { case 1: listeners[i].fn.call(listeners[i].context); break; case 2: listeners[i].fn.call(listeners[i].context, a1); break; case 3: listeners[i].fn.call(listeners[i].context, a1, a2); break; case 4: listeners[i].fn.call(listeners[i].context, a1, a2, a3); break; default: if (!args) for (j = 1, args = new Array(len -1); j < len; j++) { args[j - 1] = arguments[j]; } listeners[i].fn.apply(listeners[i].context, args); } } } return true; }; /** * Add a listener for a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.on = function on(event, fn, context) { return addListener(this, event, fn, context, false); }; /** * Add a one-time listener for a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn The listener function. * @param {*} [context=this] The context to invoke the listener with. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.once = function once(event, fn, context) { return addListener(this, event, fn, context, true); }; /** * Remove the listeners of a given event. * * @param {(String|Symbol)} event The event name. * @param {Function} fn Only remove the listeners that match this function. * @param {*} context Only remove the listeners that have this context. * @param {Boolean} once Only remove one-time listeners. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.removeListener = function removeListener(event, fn, context, once) { var evt = prefix ? prefix + event : event; if (!this._events[evt]) return this; if (!fn) { clearEvent(this, evt); return this; } var listeners = this._events[evt]; if (listeners.fn) { if ( listeners.fn === fn && (!once || listeners.once) && (!context || listeners.context === context) ) { clearEvent(this, evt); } } else { for (var i = 0, events = [], length = listeners.length; i < length; i++) { if ( listeners[i].fn !== fn || (once && !listeners[i].once) || (context && listeners[i].context !== context) ) { events.push(listeners[i]); } } // // Reset the array, or remove it completely if we have no more listeners. // if (events.length) this._events[evt] = events.length === 1 ? events[0] : events; else clearEvent(this, evt); } return this; }; /** * Remove all listeners, or those of the specified event. * * @param {(String|Symbol)} [event] The event name. * @returns {EventEmitter} `this`. * @public */ EventEmitter.prototype.removeAllListeners = function removeAllListeners(event) { var evt; if (event) { evt = prefix ? prefix + event : event; if (this._events[evt]) clearEvent(this, evt); } else { this._events = new Events(); this._eventsCount = 0; } return this; }; // // Alias methods names because people roll like that. // EventEmitter.prototype.off = EventEmitter.prototype.removeListener; EventEmitter.prototype.addListener = EventEmitter.prototype.on; // // Expose the prefix. // EventEmitter.prefixed = prefix; // // Allow `EventEmitter` to be imported as module namespace. // EventEmitter.EventEmitter = EventEmitter; // // Expose the module. // if (true) { module.exports = EventEmitter; } /***/ }), /* 65 */, /* 66 */, /* 67 */, /* 68 */, /* 69 */, /* 70 */, /* 71 */, /* 72 */, /* 73 */, /* 74 */, /* 75 */, /* 76 */, /* 77 */, /* 78 */, /* 79 */, /* 80 */, /* 81 */, /* 82 */, /* 83 */, /* 84 */, /* 85 */ /***/ (function(module, exports) { /** * This library modifies the diff-patch-match library by Neil Fraser * by removing the patch and match functionality and certain advanced * options in the diff function. The original license is as follows: * * === * * Diff Match and Patch * * Copyright 2006 Google Inc. * http://code.google.com/p/google-diff-match-patch/ * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ /** * The data structure representing a diff is an array of tuples: * [[DIFF_DELETE, 'Hello'], [DIFF_INSERT, 'Goodbye'], [DIFF_EQUAL, ' world.']] * which means: delete 'Hello', add 'Goodbye' and keep ' world.' */ var DIFF_DELETE = -1; var DIFF_INSERT = 1; var DIFF_EQUAL = 0; /** * Find the differences between two texts. Simplifies the problem by stripping * any common prefix or suffix off the texts before diffing. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @param {Int|Object} [cursor_pos] Edit position in text1 or object with more info * @return {Array} Array of diff tuples. */ function diff_main(text1, text2, cursor_pos, _fix_unicode) { // Check for equality if (text1 === text2) { if (text1) { return [[DIFF_EQUAL, text1]]; } return []; } if (cursor_pos != null) { var editdiff = find_cursor_edit_diff(text1, text2, cursor_pos); if (editdiff) { return editdiff; } } // Trim off common prefix (speedup). var commonlength = diff_commonPrefix(text1, text2); var commonprefix = text1.substring(0, commonlength); text1 = text1.substring(commonlength); text2 = text2.substring(commonlength); // Trim off common suffix (speedup). commonlength = diff_commonSuffix(text1, text2); var commonsuffix = text1.substring(text1.length - commonlength); text1 = text1.substring(0, text1.length - commonlength); text2 = text2.substring(0, text2.length - commonlength); // Compute the diff on the middle block. var diffs = diff_compute_(text1, text2); // Restore the prefix and suffix. if (commonprefix) { diffs.unshift([DIFF_EQUAL, commonprefix]); } if (commonsuffix) { diffs.push([DIFF_EQUAL, commonsuffix]); } diff_cleanupMerge(diffs, _fix_unicode); return diffs; }; /** * Find the differences between two texts. Assumes that the texts do not * have any common prefix or suffix. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @return {Array} Array of diff tuples. */ function diff_compute_(text1, text2) { var diffs; if (!text1) { // Just add some text (speedup). return [[DIFF_INSERT, text2]]; } if (!text2) { // Just delete some text (speedup). return [[DIFF_DELETE, text1]]; } var longtext = text1.length > text2.length ? text1 : text2; var shorttext = text1.length > text2.length ? text2 : text1; var i = longtext.indexOf(shorttext); if (i !== -1) { // Shorter text is inside the longer text (speedup). diffs = [ [DIFF_INSERT, longtext.substring(0, i)], [DIFF_EQUAL, shorttext], [DIFF_INSERT, longtext.substring(i + shorttext.length)] ]; // Swap insertions for deletions if diff is reversed. if (text1.length > text2.length) { diffs[0][0] = diffs[2][0] = DIFF_DELETE; } return diffs; } if (shorttext.length === 1) { // Single character string. // After the previous speedup, the character can't be an equality. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; } // Check to see if the problem can be split in two. var hm = diff_halfMatch_(text1, text2); if (hm) { // A half-match was found, sort out the return data. var text1_a = hm[0]; var text1_b = hm[1]; var text2_a = hm[2]; var text2_b = hm[3]; var mid_common = hm[4]; // Send both pairs off for separate processing. var diffs_a = diff_main(text1_a, text2_a); var diffs_b = diff_main(text1_b, text2_b); // Merge the results. return diffs_a.concat([[DIFF_EQUAL, mid_common]], diffs_b); } return diff_bisect_(text1, text2); }; /** * Find the 'middle snake' of a diff, split the problem in two * and return the recursively constructed diff. * See Myers 1986 paper: An O(ND) Difference Algorithm and Its Variations. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @return {Array} Array of diff tuples. * @private */ function diff_bisect_(text1, text2) { // Cache the text lengths to prevent multiple calls. var text1_length = text1.length; var text2_length = text2.length; var max_d = Math.ceil((text1_length + text2_length) / 2); var v_offset = max_d; var v_length = 2 * max_d; var v1 = new Array(v_length); var v2 = new Array(v_length); // Setting all elements to -1 is faster in Chrome & Firefox than mixing // integers and undefined. for (var x = 0; x < v_length; x++) { v1[x] = -1; v2[x] = -1; } v1[v_offset + 1] = 0; v2[v_offset + 1] = 0; var delta = text1_length - text2_length; // If the total number of characters is odd, then the front path will collide // with the reverse path. var front = (delta % 2 !== 0); // Offsets for start and end of k loop. // Prevents mapping of space beyond the grid. var k1start = 0; var k1end = 0; var k2start = 0; var k2end = 0; for (var d = 0; d < max_d; d++) { // Walk the front path one step. for (var k1 = -d + k1start; k1 <= d - k1end; k1 += 2) { var k1_offset = v_offset + k1; var x1; if (k1 === -d || (k1 !== d && v1[k1_offset - 1] < v1[k1_offset + 1])) { x1 = v1[k1_offset + 1]; } else { x1 = v1[k1_offset - 1] + 1; } var y1 = x1 - k1; while ( x1 < text1_length && y1 < text2_length && text1.charAt(x1) === text2.charAt(y1) ) { x1++; y1++; } v1[k1_offset] = x1; if (x1 > text1_length) { // Ran off the right of the graph. k1end += 2; } else if (y1 > text2_length) { // Ran off the bottom of the graph. k1start += 2; } else if (front) { var k2_offset = v_offset + delta - k1; if (k2_offset >= 0 && k2_offset < v_length && v2[k2_offset] !== -1) { // Mirror x2 onto top-left coordinate system. var x2 = text1_length - v2[k2_offset]; if (x1 >= x2) { // Overlap detected. return diff_bisectSplit_(text1, text2, x1, y1); } } } } // Walk the reverse path one step. for (var k2 = -d + k2start; k2 <= d - k2end; k2 += 2) { var k2_offset = v_offset + k2; var x2; if (k2 === -d || (k2 !== d && v2[k2_offset - 1] < v2[k2_offset + 1])) { x2 = v2[k2_offset + 1]; } else { x2 = v2[k2_offset - 1] + 1; } var y2 = x2 - k2; while ( x2 < text1_length && y2 < text2_length && text1.charAt(text1_length - x2 - 1) === text2.charAt(text2_length - y2 - 1) ) { x2++; y2++; } v2[k2_offset] = x2; if (x2 > text1_length) { // Ran off the left of the graph. k2end += 2; } else if (y2 > text2_length) { // Ran off the top of the graph. k2start += 2; } else if (!front) { var k1_offset = v_offset + delta - k2; if (k1_offset >= 0 && k1_offset < v_length && v1[k1_offset] !== -1) { var x1 = v1[k1_offset]; var y1 = v_offset + x1 - k1_offset; // Mirror x2 onto top-left coordinate system. x2 = text1_length - x2; if (x1 >= x2) { // Overlap detected. return diff_bisectSplit_(text1, text2, x1, y1); } } } } } // Diff took too long and hit the deadline or // number of diffs equals number of characters, no commonality at all. return [[DIFF_DELETE, text1], [DIFF_INSERT, text2]]; }; /** * Given the location of the 'middle snake', split the diff in two parts * and recurse. * @param {string} text1 Old string to be diffed. * @param {string} text2 New string to be diffed. * @param {number} x Index of split point in text1. * @param {number} y Index of split point in text2. * @return {Array} Array of diff tuples. */ function diff_bisectSplit_(text1, text2, x, y) { var text1a = text1.substring(0, x); var text2a = text2.substring(0, y); var text1b = text1.substring(x); var text2b = text2.substring(y); // Compute both diffs serially. var diffs = diff_main(text1a, text2a); var diffsb = diff_main(text1b, text2b); return diffs.concat(diffsb); }; /** * Determine the common prefix of two strings. * @param {string} text1 First string. * @param {string} text2 Second string. * @return {number} The number of characters common to the start of each * string. */ function diff_commonPrefix(text1, text2) { // Quick check for common null cases. if (!text1 || !text2 || text1.charAt(0) !== text2.charAt(0)) { return 0; } // Binary search. // Performance analysis: http://neil.fraser.name/news/2007/10/09/ var pointermin = 0; var pointermax = Math.min(text1.length, text2.length); var pointermid = pointermax; var pointerstart = 0; while (pointermin < pointermid) { if ( text1.substring(pointerstart, pointermid) == text2.substring(pointerstart, pointermid) ) { pointermin = pointermid; pointerstart = pointermin; } else { pointermax = pointermid; } pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); } if (is_surrogate_pair_start(text1.charCodeAt(pointermid - 1))) { pointermid--; } return pointermid; }; /** * Determine the common suffix of two strings. * @param {string} text1 First string. * @param {string} text2 Second string. * @return {number} The number of characters common to the end of each string. */ function diff_commonSuffix(text1, text2) { // Quick check for common null cases. if (!text1 || !text2 || text1.slice(-1) !== text2.slice(-1)) { return 0; } // Binary search. // Performance analysis: http://neil.fraser.name/news/2007/10/09/ var pointermin = 0; var pointermax = Math.min(text1.length, text2.length); var pointermid = pointermax; var pointerend = 0; while (pointermin < pointermid) { if ( text1.substring(text1.length - pointermid, text1.length - pointerend) == text2.substring(text2.length - pointermid, text2.length - pointerend) ) { pointermin = pointermid; pointerend = pointermin; } else { pointermax = pointermid; } pointermid = Math.floor((pointermax - pointermin) / 2 + pointermin); } if (is_surrogate_pair_end(text1.charCodeAt(text1.length - pointermid))) { pointermid--; } return pointermid; }; /** * Do the two texts share a substring which is at least half the length of the * longer text? * This speedup can produce non-minimal diffs. * @param {string} text1 First string. * @param {string} text2 Second string. * @return {Array.<string>} Five element Array, containing the prefix of * text1, the suffix of text1, the prefix of text2, the suffix of * text2 and the common middle. Or null if there was no match. */ function diff_halfMatch_(text1, text2) { var longtext = text1.length > text2.length ? text1 : text2; var shorttext = text1.length > text2.length ? text2 : text1; if (longtext.length < 4 || shorttext.length * 2 < longtext.length) { return null; // Pointless. } /** * Does a substring of shorttext exist within longtext such that the substring * is at least half the length of longtext? * Closure, but does not reference any external variables. * @param {string} longtext Longer string. * @param {string} shorttext Shorter string. * @param {number} i Start index of quarter length substring within longtext. * @return {Array.<string>} Five element Array, containing the prefix of * longtext, the suffix of longtext, the prefix of shorttext, the suffix * of shorttext and the common middle. Or null if there was no match. * @private */ function diff_halfMatchI_(longtext, shorttext, i) { // Start with a 1/4 length substring at position i as a seed. var seed = longtext.substring(i, i + Math.floor(longtext.length / 4)); var j = -1; var best_common = ''; var best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b; while ((j = shorttext.indexOf(seed, j + 1)) !== -1) { var prefixLength = diff_commonPrefix( longtext.substring(i), shorttext.substring(j)); var suffixLength = diff_commonSuffix( longtext.substring(0, i), shorttext.substring(0, j)); if (best_common.length < suffixLength + prefixLength) { best_common = shorttext.substring( j - suffixLength, j) + shorttext.substring(j, j + prefixLength); best_longtext_a = longtext.substring(0, i - suffixLength); best_longtext_b = longtext.substring(i + prefixLength); best_shorttext_a = shorttext.substring(0, j - suffixLength); best_shorttext_b = shorttext.substring(j + prefixLength); } } if (best_common.length * 2 >= longtext.length) { return [ best_longtext_a, best_longtext_b, best_shorttext_a, best_shorttext_b, best_common ]; } else { return null; } } // First check if the second quarter is the seed for a half-match. var hm1 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 4)); // Check again based on the third quarter. var hm2 = diff_halfMatchI_(longtext, shorttext, Math.ceil(longtext.length / 2)); var hm; if (!hm1 && !hm2) { return null; } else if (!hm2) { hm = hm1; } else if (!hm1) { hm = hm2; } else { // Both matched. Select the longest. hm = hm1[4].length > hm2[4].length ? hm1 : hm2; } // A half-match was found, sort out the return data. var text1_a, text1_b, text2_a, text2_b; if (text1.length > text2.length) { text1_a = hm[0]; text1_b = hm[1]; text2_a = hm[2]; text2_b = hm[3]; } else { text2_a = hm[0]; text2_b = hm[1]; text1_a = hm[2]; text1_b = hm[3]; } var mid_common = hm[4]; return [text1_a, text1_b, text2_a, text2_b, mid_common]; }; /** * Reorder and merge like edit sections. Merge equalities. * Any edit section can move as long as it doesn't cross an equality. * @param {Array} diffs Array of diff tuples. * @param {boolean} fix_unicode Whether to normalize to a unicode-correct diff */ function diff_cleanupMerge(diffs, fix_unicode) { diffs.push([DIFF_EQUAL, '']); // Add a dummy entry at the end. var pointer = 0; var count_delete = 0; var count_insert = 0; var text_delete = ''; var text_insert = ''; var commonlength; while (pointer < diffs.length) { if (pointer < diffs.length - 1 && !diffs[pointer][1]) { diffs.splice(pointer, 1); continue; } switch (diffs[pointer][0]) { case DIFF_INSERT: count_insert++; text_insert += diffs[pointer][1]; pointer++; break; case DIFF_DELETE: count_delete++; text_delete += diffs[pointer][1]; pointer++; break; case DIFF_EQUAL: var previous_equality = pointer - count_insert - count_delete - 1; if (fix_unicode) { // prevent splitting of unicode surrogate pairs. when fix_unicode is true, // we assume that the old and new text in the diff are complete and correct // unicode-encoded JS strings, but the tuple boundaries may fall between // surrogate pairs. we fix this by shaving off stray surrogates from the end // of the previous equality and the beginning of this equality. this may create // empty equalities or a common prefix or suffix. for example, if AB and AC are // emojis, `[[0, 'A'], [-1, 'BA'], [0, 'C']]` would turn into deleting 'ABAC' and // inserting 'AC', and then the common suffix 'AC' will be eliminated. in this // particular case, both equalities go away, we absorb any previous inequalities, // and we keep scanning for the next equality before rewriting the tuples. if (previous_equality >= 0 && ends_with_pair_start(diffs[previous_equality][1])) { var stray = diffs[previous_equality][1].slice(-1); diffs[previous_equality][1] = diffs[previous_equality][1].slice(0, -1); text_delete = stray + text_delete; text_insert = stray + text_insert; if (!diffs[previous_equality][1]) { // emptied out previous equality, so delete it and include previous delete/insert diffs.splice(previous_equality, 1); pointer--; var k = previous_equality - 1; if (diffs[k] && diffs[k][0] === DIFF_INSERT) { count_insert++; text_insert = diffs[k][1] + text_insert; k--; } if (diffs[k] && diffs[k][0] === DIFF_DELETE) { count_delete++; text_delete = diffs[k][1] + text_delete; k--; } previous_equality = k; } } if (starts_with_pair_end(diffs[pointer][1])) { var stray = diffs[pointer][1].charAt(0); diffs[pointer][1] = diffs[pointer][1].slice(1); text_delete += stray; text_insert += stray; } } if (pointer < diffs.length - 1 && !diffs[pointer][1]) { // for empty equality not at end, wait for next equality diffs.splice(pointer, 1); break; } if (text_delete.length > 0 || text_insert.length > 0) { // note that diff_commonPrefix and diff_commonSuffix are unicode-aware if (text_delete.length > 0 && text_insert.length > 0) { // Factor out any common prefixes. commonlength = diff_commonPrefix(text_insert, text_delete); if (commonlength !== 0) { if (previous_equality >= 0) { diffs[previous_equality][1] += text_insert.substring(0, commonlength); } else { diffs.splice(0, 0, [DIFF_EQUAL, text_insert.substring(0, commonlength)]); pointer++; } text_insert = text_insert.substring(commonlength); text_delete = text_delete.substring(commonlength); } // Factor out any common suffixes. commonlength = diff_commonSuffix(text_insert, text_delete); if (commonlength !== 0) { diffs[pointer][1] = text_insert.substring(text_insert.length - commonlength) + diffs[pointer][1]; text_insert = text_insert.substring(0, text_insert.length - commonlength); text_delete = text_delete.substring(0, text_delete.length - commonlength); } } // Delete the offending records and add the merged ones. var n = count_insert + count_delete; if (text_delete.length === 0 && text_insert.length === 0) { diffs.splice(pointer - n, n); pointer = pointer - n; } else if (text_delete.length === 0) { diffs.splice(pointer - n, n, [DIFF_INSERT, text_insert]); pointer = pointer - n + 1; } else if (text_insert.length === 0) { diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete]); pointer = pointer - n + 1; } else { diffs.splice(pointer - n, n, [DIFF_DELETE, text_delete], [DIFF_INSERT, text_insert]); pointer = pointer - n + 2; } } if (pointer !== 0 && diffs[pointer - 1][0] === DIFF_EQUAL) { // Merge this equality with the previous one. diffs[pointer - 1][1] += diffs[pointer][1]; diffs.splice(pointer, 1); } else { pointer++; } count_insert = 0; count_delete = 0; text_delete = ''; text_insert = ''; break; } } if (diffs[diffs.length - 1][1] === '') { diffs.pop(); // Remove the dummy entry at the end. } // Second pass: look for single edits surrounded on both sides by equalities // which can be shifted sideways to eliminate an equality. // e.g: A<ins>BA</ins>C -> <ins>AB</ins>AC var changes = false; pointer = 1; // Intentionally ignore the first and last element (don't need checking). while (pointer < diffs.length - 1) { if (diffs[pointer - 1][0] === DIFF_EQUAL && diffs[pointer + 1][0] === DIFF_EQUAL) { // This is a single edit surrounded by equalities. if (diffs[pointer][1].substring(diffs[pointer][1].length - diffs[pointer - 1][1].length) === diffs[pointer - 1][1]) { // Shift the edit over the previous equality. diffs[pointer][1] = diffs[pointer - 1][1] + diffs[pointer][1].substring(0, diffs[pointer][1].length - diffs[pointer - 1][1].length); diffs[pointer + 1][1] = diffs[pointer - 1][1] + diffs[pointer + 1][1]; diffs.splice(pointer - 1, 1); changes = true; } else if (diffs[pointer][1].substring(0, diffs[pointer + 1][1].length) == diffs[pointer + 1][1]) { // Shift the edit over the next equality. diffs[pointer - 1][1] += diffs[pointer + 1][1]; diffs[pointer][1] = diffs[pointer][1].substring(diffs[pointer + 1][1].length) + diffs[pointer + 1][1]; diffs.splice(pointer + 1, 1); changes = true; } } pointer++; } // If shifts were made, the diff needs reordering and another shift sweep. if (changes) { diff_cleanupMerge(diffs, fix_unicode); } }; function is_surrogate_pair_start(charCode) { return charCode >= 0xD800 && charCode <= 0xDBFF; } function is_surrogate_pair_end(charCode) { return charCode >= 0xDC00 && charCode <= 0xDFFF; } function starts_with_pair_end(str) { return is_surrogate_pair_end(str.charCodeAt(0)); } function ends_with_pair_start(str) { return is_surrogate_pair_start(str.charCodeAt(str.length - 1)); } function remove_empty_tuples(tuples) { var ret = []; for (var i = 0; i < tuples.length; i++) { if (tuples[i][1].length > 0) { ret.push(tuples[i]); } } return ret; } function make_edit_splice(before, oldMiddle, newMiddle, after) { if (ends_with_pair_start(before) || starts_with_pair_end(after)) { return null; } return remove_empty_tuples([ [DIFF_EQUAL, before], [DIFF_DELETE, oldMiddle], [DIFF_INSERT, newMiddle], [DIFF_EQUAL, after] ]); } function find_cursor_edit_diff(oldText, newText, cursor_pos) { // note: this runs after equality check has ruled out exact equality var oldRange = typeof cursor_pos === 'number' ? { index: cursor_pos, length: 0 } : cursor_pos.oldRange; var newRange = typeof cursor_pos === 'number' ? null : cursor_pos.newRange; // take into account the old and new selection to generate the best diff // possible for a text edit. for example, a text change from "xxx" to "xx" // could be a delete or forwards-delete of any one of the x's, or the // result of selecting two of the x's and typing "x". var oldLength = oldText.length; var newLength = newText.length; if (oldRange.length === 0 && (newRange === null || newRange.length === 0)) { // see if we have an insert or delete before or after cursor var oldCursor = oldRange.index; var oldBefore = oldText.slice(0, oldCursor); var oldAfter = oldText.slice(oldCursor); var maybeNewCursor = newRange ? newRange.index : null; editBefore: { // is this an insert or delete right before oldCursor? var newCursor = oldCursor + newLength - oldLength; if (maybeNewCursor !== null && maybeNewCursor !== newCursor) { break editBefore; } if (newCursor < 0 || newCursor > newLength) { break editBefore; } var newBefore = newText.slice(0, newCursor); var newAfter = newText.slice(newCursor); if (newAfter !== oldAfter) { break editBefore; } var prefixLength = Math.min(oldCursor, newCursor); var oldPrefix = oldBefore.slice(0, prefixLength); var newPrefix = newBefore.slice(0, prefixLength); if (oldPrefix !== newPrefix) { break editBefore; } var oldMiddle = oldBefore.slice(prefixLength); var newMiddle = newBefore.slice(prefixLength); return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldAfter); } editAfter: { // is this an insert or delete right after oldCursor? if (maybeNewCursor !== null && maybeNewCursor !== oldCursor) { break editAfter; } var cursor = oldCursor; var newBefore = newText.slice(0, cursor); var newAfter = newText.slice(cursor); if (newBefore !== oldBefore) { break editAfter; } var suffixLength = Math.min(oldLength - cursor, newLength - cursor); var oldSuffix = oldAfter.slice(oldAfter.length - suffixLength); var newSuffix = newAfter.slice(newAfter.length - suffixLength); if (oldSuffix !== newSuffix) { break editAfter; } var oldMiddle = oldAfter.slice(0, oldAfter.length - suffixLength); var newMiddle = newAfter.slice(0, newAfter.length - suffixLength); return make_edit_splice(oldBefore, oldMiddle, newMiddle, oldSuffix); } } if (oldRange.length > 0 && newRange && newRange.length === 0) { replaceRange: { // see if diff could be a splice of the old selection range var oldPrefix = oldText.slice(0, oldRange.index); var oldSuffix = oldText.slice(oldRange.index + oldRange.length); var prefixLength = oldPrefix.length; var suffixLength = oldSuffix.length; if (newLength < prefixLength + suffixLength) { break replaceRange; } var newPrefix = newText.slice(0, prefixLength); var newSuffix = newText.slice(newLength - suffixLength); if (oldPrefix !== newPrefix || oldSuffix !== newSuffix) { break replaceRange; } var oldMiddle = oldText.slice(prefixLength, oldLength - suffixLength); var newMiddle = newText.slice(prefixLength, newLength - suffixLength); return make_edit_splice(oldPrefix, oldMiddle, newMiddle, oldSuffix); } } return null; } function diff(text1, text2, cursor_pos) { // only pass fix_unicode=true at the top level, not when diff_main is // recursively invoked return diff_main(text1, text2, cursor_pos, true); } diff.INSERT = DIFF_INSERT; diff.DELETE = DIFF_DELETE; diff.EQUAL = DIFF_EQUAL; module.exports = diff; /***/ }), /* 86 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var lodash_clonedeep_1 = __importDefault(__webpack_require__(12)); var lodash_isequal_1 = __importDefault(__webpack_require__(19)); var AttributeMap; (function (AttributeMap) { function compose(a, b, keepNull) { if (a === void 0) { a = {}; } if (b === void 0) { b = {}; } if (typeof a !== 'object') { a = {}; } if (typeof b !== 'object') { b = {}; } var attributes = lodash_clonedeep_1.default(b); if (!keepNull) { attributes = Object.keys(attributes).reduce(function (copy, key) { if (attributes[key] != null) { copy[key] = attributes[key]; } return copy; }, {}); } for (var key in a) { if (a[key] !== undefined && b[key] === undefined) { attributes[key] = a[key]; } } return Object.keys(attributes).length > 0 ? attributes : undefined; } AttributeMap.compose = compose; function diff(a, b) { if (a === void 0) { a = {}; } if (b === void 0) { b = {}; } if (typeof a !== 'object') { a = {}; } if (typeof b !== 'object') { b = {}; } var attributes = Object.keys(a) .concat(Object.keys(b)) .reduce(function (attrs, key) { if (!lodash_isequal_1.default(a[key], b[key])) { attrs[key] = b[key] === undefined ? null : b[key]; } return attrs; }, {}); return Object.keys(attributes).length > 0 ? attributes : undefined; } AttributeMap.diff = diff; function invert(attr, base) { if (attr === void 0) { attr = {}; } if (base === void 0) { base = {}; } attr = attr || {}; var baseInverted = Object.keys(base).reduce(function (memo, key) { if (base[key] !== attr[key] && attr[key] !== undefined) { memo[key] = base[key]; } return memo; }, {}); return Object.keys(attr).reduce(function (memo, key) { if (attr[key] !== base[key] && base[key] === undefined) { memo[key] = null; } return memo; }, baseInverted); } AttributeMap.invert = invert; function transform(a, b, priority) { if (priority === void 0) { priority = false; } if (typeof a !== 'object') { return b; } if (typeof b !== 'object') { return undefined; } if (!priority) { return b; // b simply overwrites us without priority } var attributes = Object.keys(b).reduce(function (attrs, key) { if (a[key] === undefined) { attrs[key] = b[key]; // null is a valid value } return attrs; }, {}); return Object.keys(attributes).length > 0 ? attributes : undefined; } AttributeMap.transform = transform; })(AttributeMap || (AttributeMap = {})); exports.default = AttributeMap; /***/ }), /* 87 */ /***/ (function(module, exports, __webpack_require__) { "use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); var Op_1 = __importDefault(__webpack_require__(63)); var Iterator = /** @class */ (function () { function Iterator(ops) { this.ops = ops; this.index = 0; this.offset = 0; } Iterator.prototype.hasNext = function () { return this.peekLength() < Infinity; }; Iterator.prototype.next = function (length) { if (!length) { length = Infinity; } var nextOp = this.ops[this.index]; if (nextOp) { var offset = this.offset; var opLength = Op_1.default.length(nextOp); if (length >= opLength - offset) { length = opLength - offset; this.index += 1; this.offset = 0; } else { this.offset += length; } if (typeof nextOp.delete === 'number') { return { delete: length }; } else { var retOp = {}; if (nextOp.attributes) { retOp.attributes = nextOp.attributes; } if (typeof nextOp.retain === 'number') { retOp.retain = length; } else if (typeof nextOp.insert === 'string') { retOp.insert = nextOp.insert.substr(offset, length); } else { // offset should === 0, length should === 1 retOp.insert = nextOp.insert; } return retOp; } } else { return { retain: Infinity }; } }; Iterator.prototype.peek = function () { return this.ops[this.index]; }; Iterator.prototype.peekLength = function () { if (this.ops[this.index]) { // Should never return 0 if our index is being managed correctly return Op_1.default.length(this.ops[this.index]) - this.offset; } else { return Infinity; } }; Iterator.prototype.peekType = function () { if (this.ops[this.index]) { if (typeof this.ops[this.index].delete === 'number') { return 'delete'; } else if (typeof this.ops[this.index].retain === 'number') { return 'retain'; } else { return 'insert'; } } return 'retain'; }; Iterator.prototype.rest = function () { if (!this.hasNext()) { return []; } else if (this.offset === 0) { return this.ops.slice(this.index); } else { var offset = this.offset; var index = this.index; var next = this.next(); var rest = this.ops.slice(this.index); this.offset = offset; this.index = index; return [next].concat(rest); } }; return Iterator; }()); exports.default = Iterator; /***/ }), /* 88 */, /* 89 */, /* 90 */, /* 91 */, /* 92 */, /* 93 */, /* 94 */, /* 95 */, /* 96 */, /* 97 */, /* 98 */, /* 99 */, /* 100 */, /* 101 */, /* 102 */, /* 103 */, /* 104 */, /* 105 */, /* 106 */, /* 107 */, /* 108 */, /* 109 */, /* 110 */, /* 111 */, /* 112 */, /* 113 */, /* 114 */, /* 115 */, /* 116 */, /* 117 */, /* 118 */, /* 119 */, /* 120 */, /* 121 */, /* 122 */, /* 123 */, /* 124 */, /* 125 */, /* 126 */, /* 127 */, /* 128 */, /* 129 */, /* 130 */, /* 131 */, /* 132 */, /* 133 */ /***/ (function(module, exports, __webpack_require__) { module.exports = __webpack_require__(18); /***/ }) /******/ ])["default"]; });
/** * Copyright (c) Tiny Technologies, Inc. All rights reserved. * Licensed under the LGPL or a commercial license. * For LGPL see License.txt in the project root for license information. * For commercial licenses see https://www.tiny.cloud/ * * Version: 5.9.2 (2021-09-08) */ (function () { 'use strict'; var global$1 = tinymce.util.Tools.resolve('tinymce.PluginManager'); var global = tinymce.util.Tools.resolve('tinymce.Env'); var register$1 = function (editor) { editor.addCommand('mcePrint', function () { if (global.browser.isIE()) { editor.getDoc().execCommand('print', false, null); } else { editor.getWin().print(); } }); }; var register = function (editor) { var onAction = function () { return editor.execCommand('mcePrint'); }; editor.ui.registry.addButton('print', { icon: 'print', tooltip: 'Print', onAction: onAction }); editor.ui.registry.addMenuItem('print', { text: 'Print...', icon: 'print', onAction: onAction }); }; function Plugin () { global$1.add('print', function (editor) { register$1(editor); register(editor); editor.addShortcut('Meta+P', '', 'mcePrint'); }); } Plugin(); }());
import{B as Behavior,k as enableFocus,m as generateId,n as query,q as queryById,o as removeInnerRef,p as setInnerRef,t as setAriaRef}from"./index-da59e341.js";class LabelBehavior extends Behavior{init(){const{host:e}=this;e.addEventListener("click",()=>{const e=this.link();e&&(e.focus(),e.click(),enableFocus())})}connected(){this.link()}changed(e){"for"===e&&this.isConnected&&this.link()}link(){const{host:e}=this,t=e.getAttribute("for");let s;return this.id||generateId(e),s=(s=t?queryById(e,t):query(e,"[is-input]"))&&s.nuRef||s,this.linkedEl===s?s:(this.linkedEl&&removeInnerRef(s,"labelledby"),this.linkedEl=s,s&&(setInnerRef(s,"labelledby",e.id),setAriaRef(s,"labelledby")),s)}}export default LabelBehavior;
/** * @license Highstock JS v9.1.1 (2021-06-04) * * All technical indicators for Highcharts Stock * * (c) 2010-2021 Pawel Fus * * License: www.highcharts.com/license */ 'use strict'; (function (factory) { if (typeof module === 'object' && module.exports) { factory['default'] = factory; module.exports = factory; } else if (typeof define === 'function' && define.amd) { define('highcharts/indicators/indicators-all', ['highcharts', 'highcharts/modules/stock'], function (Highcharts) { factory(Highcharts); factory.Highcharts = Highcharts; return factory; }); } else { factory(typeof Highcharts !== 'undefined' ? Highcharts : undefined); } }(function (Highcharts) { var _modules = Highcharts ? Highcharts._modules : {}; function _registerModule(obj, path, args, fn) { if (!obj.hasOwnProperty(path)) { obj[path] = fn.apply(null, args); } } _registerModule(_modules, 'Mixins/IndicatorRequired.js', [_modules['Core/Utilities.js']], function (U) { /** * * (c) 2010-2021 Daniel Studencki * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var error = U.error; /* eslint-disable no-invalid-this, valid-jsdoc */ var requiredIndicatorMixin = { /** * Check whether given indicator is loaded, else throw error. * @private * @param {Highcharts.Indicator} indicator * Indicator constructor function. * @param {string} requiredIndicator * Required indicator type. * @param {string} type * Type of indicator where function was called (parent). * @param {Highcharts.IndicatorCallbackFunction} callback * Callback which is triggered if the given indicator is loaded. * Takes indicator as an argument. * @param {string} errMessage * Error message that will be logged in console. * @return {boolean} * Returns false when there is no required indicator loaded. */ isParentLoaded: function (indicator, requiredIndicator, type, callback, errMessage) { if (indicator) { return callback ? callback(indicator) : true; } error(errMessage || this.generateMessage(type, requiredIndicator)); return false; }, /** * @private * @param {string} indicatorType * Indicator type * @param {string} required * Required indicator * @return {string} * Error message */ generateMessage: function (indicatorType, required) { return 'Error: "' + indicatorType + '" indicator type requires "' + required + '" indicator loaded before. Please read docs: ' + 'https://api.highcharts.com/highstock/plotOptions.' + indicatorType; } }; return requiredIndicatorMixin; }); _registerModule(_modules, 'Stock/Indicators/SMA/SMAComposition.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var Series = SeriesRegistry.series, ohlcProto = SeriesRegistry.seriesTypes.ohlc.prototype; var addEvent = U.addEvent, extend = U.extend; /* * * * Composition * * */ addEvent(Series, 'init', function (eventOptions) { // eslint-disable-next-line no-invalid-this var series = this, options = eventOptions.options; if (options.useOhlcData && options.id !== 'highcharts-navigator-series') { extend(series, { pointValKey: ohlcProto.pointValKey, // keys: ohlcProto.keys, // @todo potentially nonsense pointArrayMap: ohlcProto.pointArrayMap, toYData: ohlcProto.toYData }); } }); addEvent(Series, 'afterSetOptions', function (e) { var options = e.options, dataGrouping = options.dataGrouping; if (dataGrouping && options.useOhlcData && options.id !== 'highcharts-navigator-series') { dataGrouping.approximation = 'ohlc'; } }); }); _registerModule(_modules, 'Stock/Indicators/SMA/SMAIndicator.js', [_modules['Mixins/IndicatorRequired.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (RequiredIndicatorMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var LineSeries = SeriesRegistry.seriesTypes.line; var addEvent = U.addEvent, error = U.error, extend = U.extend, isArray = U.isArray, merge = U.merge, pick = U.pick, splat = U.splat; var generateMessage = RequiredIndicatorMixin.generateMessage; /* * * * Class * * */ /** * The SMA series type. * * @private */ var SMAIndicator = /** @class */ (function (_super) { __extends(SMAIndicator, _super); function SMAIndicator() { /* * * * Static Properties * * */ var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.dataEventsToUnbind = void 0; _this.linkedParent = void 0; _this.options = void 0; _this.points = void 0; return _this; /* eslint-enable valid-jsdoc */ } /* * * * Functions * * */ /* eslint-disable valid-jsdoc */ /** * @private */ SMAIndicator.prototype.destroy = function () { this.dataEventsToUnbind.forEach(function (unbinder) { unbinder(); }); _super.prototype.destroy.apply(this, arguments); }; /** * @private */ SMAIndicator.prototype.getName = function () { var name = this.name, params = []; if (!name) { (this.nameComponents || []).forEach(function (component, index) { params.push(this.options.params[component] + pick(this.nameSuffixes[index], '')); }, this); name = (this.nameBase || this.type.toUpperCase()) + (this.nameComponents ? ' (' + params.join(', ') + ')' : ''); } return name; }; /** * @private */ SMAIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal.length, range = 0, sum = 0, SMA = [], xData = [], yData = [], index = -1, i, SMAPoint; if (xVal.length < period) { return; } // Switch index for OHLC / Candlestick / Arearange if (isArray(yVal[0])) { index = params.index ? params.index : 0; } // Accumulate first N-points while (range < period - 1) { sum += index < 0 ? yVal[range] : yVal[range][index]; range++; } // Calculate value one-by-one for each period in visible data for (i = range; i < yValLen; i++) { sum += index < 0 ? yVal[i] : yVal[i][index]; SMAPoint = [xVal[i], sum / period]; SMA.push(SMAPoint); xData.push(SMAPoint[0]); yData.push(SMAPoint[1]); sum -= (index < 0 ? yVal[i - range] : yVal[i - range][index]); } return { values: SMA, xData: xData, yData: yData }; }; /** * @private */ SMAIndicator.prototype.init = function (chart, options) { var indicator = this, requiredIndicators = indicator.requireIndicators(); // Check whether all required indicators are loaded. if (!requiredIndicators.allLoaded) { return error(generateMessage(indicator.type, requiredIndicators.needed)); } _super.prototype.init.call(indicator, chart, options); // Make sure we find series which is a base for an indicator chart.linkSeries(); indicator.dataEventsToUnbind = []; /** * @private * @return {void} */ function recalculateValues() { var oldData = indicator.points || [], oldDataLength = (indicator.xData || []).length, processedData = (indicator.getValues(indicator.linkedParent, indicator.options.params) || { values: [], xData: [], yData: [] }), croppedDataValues = [], overwriteData = true, oldFirstPointIndex, oldLastPointIndex, croppedData, min, max, i; // We need to update points to reflect changes in all, // x and y's, values. However, do it only for non-grouped // data - grouping does it for us (#8572) if (oldDataLength && !indicator.hasGroupedData && indicator.visible && indicator.points) { // When data is cropped update only avaliable points (#9493) if (indicator.cropped) { if (indicator.xAxis) { min = indicator.xAxis.min; max = indicator.xAxis.max; } croppedData = indicator.cropData(processedData.xData, processedData.yData, min, max); for (i = 0; i < croppedData.xData.length; i++) { // (#10774) croppedDataValues.push([ croppedData.xData[i] ].concat(splat(croppedData.yData[i]))); } oldFirstPointIndex = processedData.xData.indexOf(indicator.xData[0]); oldLastPointIndex = processedData.xData.indexOf(indicator.xData[indicator.xData.length - 1]); // Check if indicator points should be shifted (#8572) if (oldFirstPointIndex === -1 && oldLastPointIndex === processedData.xData.length - 2) { if (croppedDataValues[0][0] === oldData[0].x) { croppedDataValues.shift(); } } indicator.updateData(croppedDataValues); // Omit addPoint() and removePoint() cases } else if (processedData.xData.length !== oldDataLength - 1 && processedData.xData.length !== oldDataLength + 1) { overwriteData = false; indicator.updateData(processedData.values); } } if (overwriteData) { indicator.xData = processedData.xData; indicator.yData = processedData.yData; indicator.options.data = processedData.values; } // Removal of processedXData property is required because on // first translate processedXData array is empty if (indicator.bindTo.series === false) { delete indicator.processedXData; indicator.isDirty = true; indicator.redraw(); } indicator.isDirtyData = false; } if (!indicator.linkedParent) { return error('Series ' + indicator.options.linkedTo + ' not found! Check `linkedTo`.', false, chart); } indicator.dataEventsToUnbind.push(addEvent(indicator.bindTo.series ? indicator.linkedParent : indicator.linkedParent.xAxis, indicator.bindTo.eventName, recalculateValues)); if (indicator.calculateOn === 'init') { recalculateValues(); } else { var unbinder_1 = addEvent(indicator.chart, indicator.calculateOn, function () { recalculateValues(); // Call this just once, on init unbinder_1(); }); } // return indicator; }; /** * @private */ SMAIndicator.prototype.processData = function () { var series = this, compareToMain = series.options.compareToMain, linkedParent = series.linkedParent; _super.prototype.processData.apply(series, arguments); if (linkedParent && linkedParent.compareValue && compareToMain) { series.compareValue = linkedParent.compareValue; } return; }; /** * @private */ SMAIndicator.prototype.requireIndicators = function () { var obj = { allLoaded: true }; // Check whether all required indicators are loaded, else return // the object with missing indicator's name. this.requiredIndicators.forEach(function (indicator) { if (SeriesRegistry.seriesTypes[indicator]) { SeriesRegistry.seriesTypes[indicator].prototype.requireIndicators(); } else { obj.allLoaded = false; obj.needed = indicator; } }); return obj; }; /** * The parameter allows setting line series type and use OHLC indicators. * Data in OHLC format is required. * * @sample {highstock} stock/indicators/use-ohlc-data * Use OHLC data format to plot line chart * * @type {boolean} * @product highstock * @apioption plotOptions.line.useOhlcData */ /** * Simple moving average indicator (SMA). This series requires `linkedTo` * option to be set. * * @sample stock/indicators/sma * Simple moving average indicator * * @extends plotOptions.line * @since 6.0.0 * @excluding allAreas, colorAxis, dragDrop, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, * stacking, useOhlcData * @product highstock * @requires stock/indicators/indicators * @optionparent plotOptions.sma */ SMAIndicator.defaultOptions = merge(LineSeries.defaultOptions, { /** * The name of the series as shown in the legend, tooltip etc. If not * set, it will be based on a technical indicator type and default * params. * * @type {string} */ name: void 0, tooltip: { /** * Number of decimals in indicator series. */ valueDecimals: 4 }, /** * The main series ID that indicator will be based on. Required for this * indicator. * * @type {string} */ linkedTo: void 0, /** * Whether to compare indicator to the main series values * or indicator values. * * @sample {highstock} stock/plotoptions/series-comparetomain/ * Difference between comparing SMA values to the main series * and its own values. * * @type {boolean} */ compareToMain: false, /** * Paramters used in calculation of regression series' points. */ params: { /** * The point index which indicator calculations will base. For * example using OHLC data, index=2 means the indicator will be * calculated using Low values. */ index: 0, /** * The base period for indicator calculations. This is the number of * data points which are taken into account for the indicator * calculations. */ period: 14 } }); return SMAIndicator; }(LineSeries)); extend(SMAIndicator.prototype, { bindTo: { series: true, eventName: 'updatedData' }, calculateOn: 'init', hasDerivedData: true, nameComponents: ['period'], nameSuffixes: [], // Defines on which other indicators is this indicator based on. requiredIndicators: [], useCommonDataGrouping: true }); SeriesRegistry.registerSeriesType('sma', SMAIndicator); /* * * * Default Export * * */ /* * * * API Options * * */ /** * A `SMA` series. If the [type](#series.sma.type) option is not specified, it * is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.sma * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL, useOhlcData * @requires stock/indicators/indicators * @apioption series.sma */ ''; // adds doclet above to the transpiled file return SMAIndicator; }); _registerModule(_modules, 'Stock/Indicators/AD/ADIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var error = U.error, extend = U.extend, merge = U.merge; /** * The AD series type. * * @private * @class * @name Highcharts.seriesTypes.ad * * @augments Highcharts.Series */ var ADIndicator = /** @class */ (function (_super) { __extends(ADIndicator, _super); function ADIndicator() { /* * * * Static Properties * * */ var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Static Functions * * */ ADIndicator.populateAverage = function (xVal, yVal, yValVolume, i, _period) { var high = yVal[i][1], low = yVal[i][2], close = yVal[i][3], volume = yValVolume[i], adY = close === high && close === low || high === low ? 0 : ((2 * close - low - high) / (high - low)) * volume, adX = xVal[i]; return [adX, adY]; }; /* * * * Functions * * */ ADIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, volumeSeriesID = params.volumeSeriesID, volumeSeries = series.chart.get(volumeSeriesID), yValVolume = volumeSeries && volumeSeries.yData, yValLen = yVal ? yVal.length : 0, AD = [], xData = [], yData = [], len, i, ADPoint; if (xVal.length <= period && yValLen && yVal[0].length !== 4) { return; } if (!volumeSeries) { error('Series ' + volumeSeriesID + ' not found! Check `volumeSeriesID`.', true, series.chart); return; } // i = period <-- skip first N-points // Calculate value one-by-one for each period in visible data for (i = period; i < yValLen; i++) { len = AD.length; ADPoint = ADIndicator.populateAverage(xVal, yVal, yValVolume, i, period); if (len > 0) { ADPoint[1] += AD[len - 1][1]; } AD.push(ADPoint); xData.push(ADPoint[0]); yData.push(ADPoint[1]); } return { values: AD, xData: xData, yData: yData }; }; /** * Accumulation Distribution (AD). This series requires `linkedTo` option to * be set. * * @sample stock/indicators/accumulation-distribution * Accumulation/Distribution indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/accumulation-distribution * @optionparent plotOptions.ad */ ADIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index */ params: { index: void 0, /** * The id of volume series which is mandatory. * For example using OHLC data, volumeSeriesID='volume' means * the indicator will be calculated using OHLC and volume values. * * @since 6.0.0 */ volumeSeriesID: 'volume' } }); return ADIndicator; }(SMAIndicator)); extend(ADIndicator.prototype, { nameComponents: false, nameBase: 'Accumulation/Distribution' }); SeriesRegistry.registerSeriesType('ad', ADIndicator); /* * * * Default Export * * */ /* * * * API Options * * */ /** * A `AD` series. If the [type](#series.ad.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.ad * @since 6.0.0 * @excluding dataParser, dataURL * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/accumulation-distribution * @apioption series.ad */ ''; // add doclet above to transpiled file return ADIndicator; }); _registerModule(_modules, 'Stock/Indicators/AO/AOIndicator.js', [_modules['Core/Globals.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js'], _modules['Core/Color/Palette.js']], function (H, SeriesRegistry, U, palette) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var noop = H.noop; var _a = SeriesRegistry.seriesTypes, SMAIndicator = _a.sma, ColumnSeries = _a.column; var extend = U.extend, merge = U.merge, correctFloat = U.correctFloat, isArray = U.isArray; /* * * * Class * * */ /** * The AO series type * * @private * @class * @name Highcharts.seriesTypes.ao * * @augments Highcharts.Series */ var AOIndicator = /** @class */ (function (_super) { __extends(AOIndicator, _super); function AOIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /** * * Properties * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /** * * Functions * */ AOIndicator.prototype.drawGraph = function () { var indicator = this, options = indicator.options, points = indicator.points, userColor = indicator.userOptions.color, positiveColor = options.greaterBarColor, negativeColor = options.lowerBarColor, firstPoint = points[0], i; if (!userColor && firstPoint) { firstPoint.color = positiveColor; for (i = 1; i < points.length; i++) { if (points[i].y > points[i - 1].y) { points[i].color = positiveColor; } else if (points[i].y < points[i - 1].y) { points[i].color = negativeColor; } else { points[i].color = points[i - 1].color; } } } }; AOIndicator.prototype.getValues = function (series) { var shortPeriod = 5, longPeriod = 34, xVal = series.xData || [], yVal = series.yData || [], yValLen = yVal.length, AO = [], // 0- date, 1- Awesome Oscillator xData = [], yData = [], high = 1, low = 2, shortSum = 0, longSum = 0, shortSMA, // Shorter Period SMA longSMA, // Longer Period SMA awesome, shortLastIndex, longLastIndex, price, i, j; if (xVal.length <= longPeriod || !isArray(yVal[0]) || yVal[0].length !== 4) { return; } for (i = 0; i < longPeriod - 1; i++) { price = (yVal[i][high] + yVal[i][low]) / 2; if (i >= longPeriod - shortPeriod) { shortSum = correctFloat(shortSum + price); } longSum = correctFloat(longSum + price); } for (j = longPeriod - 1; j < yValLen; j++) { price = (yVal[j][high] + yVal[j][low]) / 2; shortSum = correctFloat(shortSum + price); longSum = correctFloat(longSum + price); shortSMA = shortSum / shortPeriod; longSMA = longSum / longPeriod; awesome = correctFloat(shortSMA - longSMA); AO.push([xVal[j], awesome]); xData.push(xVal[j]); yData.push(awesome); shortLastIndex = j + 1 - shortPeriod; longLastIndex = j + 1 - longPeriod; shortSum = correctFloat(shortSum - (yVal[shortLastIndex][high] + yVal[shortLastIndex][low]) / 2); longSum = correctFloat(longSum - (yVal[longLastIndex][high] + yVal[longLastIndex][low]) / 2); } return { values: AO, xData: xData, yData: yData }; }; /** * Awesome Oscillator. This series requires the `linkedTo` option to * be set and should be loaded after the `stock/indicators/indicators.js` * * @sample {highstock} stock/indicators/ao * Awesome * * @extends plotOptions.sma * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, joinBy, keys, navigatorOptions, * params, pointInterval, pointIntervalUnit, pointPlacement, * pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/ao * @optionparent plotOptions.ao */ AOIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { // Index and period are unchangeable, do not inherit (#15362) index: void 0, period: void 0 }, /** * Color of the Awesome oscillator series bar that is greater than the * previous one. Note that if a `color` is defined, the `color` * takes precedence and the `greaterBarColor` is ignored. * * @sample {highstock} stock/indicators/ao/ * greaterBarColor * * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} * @since 7.0.0 */ greaterBarColor: palette.positiveColor, /** * Color of the Awesome oscillator series bar that is lower than the * previous one. Note that if a `color` is defined, the `color` * takes precedence and the `lowerBarColor` is ignored. * * @sample {highstock} stock/indicators/ao/ * lowerBarColor * * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} * @since 7.0.0 */ lowerBarColor: palette.negativeColor, threshold: 0, groupPadding: 0.2, pointPadding: 0.2, crisp: false, states: { hover: { halo: { size: 0 } } } }); return AOIndicator; }(SMAIndicator)); extend(AOIndicator.prototype, { nameBase: 'AO', nameComponents: false, // Columns support: markerAttribs: noop, getColumnMetrics: ColumnSeries.prototype.getColumnMetrics, crispCol: ColumnSeries.prototype.crispCol, translate: ColumnSeries.prototype.translate, drawPoints: ColumnSeries.prototype.drawPoints }); SeriesRegistry.registerSeriesType('ao', AOIndicator); /* * * * Default Export * * */ /** * An `AO` series. If the [type](#series.ao.type) * option is not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.ao * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, dataParser, dataURL, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/ao * @apioption series.ao */ ''; // for including the above in the doclets return AOIndicator; }); _registerModule(_modules, 'Mixins/MultipleLines.js', [_modules['Core/Globals.js'], _modules['Core/Utilities.js']], function (H, U) { /** * * (c) 2010-2021 Wojciech Chmiel * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var defined = U.defined, error = U.error, merge = U.merge; var SMA = H.seriesTypes.sma; /** * Mixin useful for all indicators that have more than one line. * Merge it with your implementation where you will provide * getValues method appropriate to your indicator and pointArrayMap, * pointValKey, linesApiNames properites. Notice that pointArrayMap * should be consistent with amount of lines calculated in getValues method. * * @private * @mixin multipleLinesMixin */ var multipleLinesMixin = { /* eslint-disable valid-jsdoc */ /** * Lines ids. Required to plot appropriate amount of lines. * Notice that pointArrayMap should have more elements than * linesApiNames, because it contains main line and additional lines ids. * Also it should be consistent with amount of lines calculated in * getValues method from your implementation. * * @private * @name multipleLinesMixin.pointArrayMap * @type {Array<string>} */ pointArrayMap: ['top', 'bottom'], /** * Main line id. * * @private * @name multipleLinesMixin.pointValKey * @type {string} */ pointValKey: 'top', /** * Additional lines DOCS names. Elements of linesApiNames array should * be consistent with DOCS line names defined in your implementation. * Notice that linesApiNames should have decreased amount of elements * relative to pointArrayMap (without pointValKey). * * @private * @name multipleLinesMixin.linesApiNames * @type {Array<string>} */ linesApiNames: ['bottomLine'], /** * Create translatedLines Collection based on pointArrayMap. * * @private * @function multipleLinesMixin.getTranslatedLinesNames * @param {string} [excludedValue] * Main line id * @return {Array<string>} * Returns translated lines names without excluded value. */ getTranslatedLinesNames: function (excludedValue) { var translatedLines = []; (this.pointArrayMap || []).forEach(function (propertyName) { if (propertyName !== excludedValue) { translatedLines.push('plot' + propertyName.charAt(0).toUpperCase() + propertyName.slice(1)); } }); return translatedLines; }, /** * @private * @function multipleLinesMixin.toYData * @param {Highcharts.Point} point * Indicator point * @return {Array<number>} * Returns point Y value for all lines */ toYData: function (point) { var pointColl = []; (this.pointArrayMap || []).forEach(function (propertyName) { pointColl.push(point[propertyName]); }); return pointColl; }, /** * Add lines plot pixel values. * * @private * @function multipleLinesMixin.translate * @return {void} */ translate: function () { var indicator = this, pointArrayMap = indicator.pointArrayMap, LinesNames = [], value; LinesNames = indicator.getTranslatedLinesNames(); SMA.prototype.translate.apply(indicator, arguments); indicator.points.forEach(function (point) { pointArrayMap.forEach(function (propertyName, i) { value = point[propertyName]; if (value !== null) { point[LinesNames[i]] = indicator.yAxis.toPixels(value, true); } }); }); }, /** * Draw main and additional lines. * * @private * @function multipleLinesMixin.drawGraph * @return {void} */ drawGraph: function () { var indicator = this, pointValKey = indicator.pointValKey, linesApiNames = indicator.linesApiNames, mainLinePoints = indicator.points, pointsLength = mainLinePoints.length, mainLineOptions = indicator.options, mainLinePath = indicator.graph, gappedExtend = { options: { gapSize: mainLineOptions.gapSize } }, // additional lines point place holders: secondaryLines = [], secondaryLinesNames = indicator.getTranslatedLinesNames(pointValKey), point; // Generate points for additional lines: secondaryLinesNames.forEach(function (plotLine, index) { // create additional lines point place holders secondaryLines[index] = []; while (pointsLength--) { point = mainLinePoints[pointsLength]; secondaryLines[index].push({ x: point.x, plotX: point.plotX, plotY: point[plotLine], isNull: !defined(point[plotLine]) }); } pointsLength = mainLinePoints.length; }); // Modify options and generate additional lines: linesApiNames.forEach(function (lineName, i) { if (secondaryLines[i]) { indicator.points = secondaryLines[i]; if (mainLineOptions[lineName]) { indicator.options = merge(mainLineOptions[lineName].styles, gappedExtend); } else { error('Error: "There is no ' + lineName + ' in DOCS options declared. Check if linesApiNames' + ' are consistent with your DOCS line names."' + ' at mixin/multiple-line.js:34'); } indicator.graph = indicator['graph' + lineName]; SMA.prototype.drawGraph.call(indicator); // Now save lines: indicator['graph' + lineName] = indicator.graph; } else { error('Error: "' + lineName + ' doesn\'t have equivalent ' + 'in pointArrayMap. To many elements in linesApiNames ' + 'relative to pointArrayMap."'); } }); // Restore options and draw a main line: indicator.points = mainLinePoints; indicator.options = mainLineOptions; indicator.graph = mainLinePath; SMA.prototype.drawGraph.call(indicator); } }; return multipleLinesMixin; }); _registerModule(_modules, 'Stock/Indicators/Aroon/AroonIndicator.js', [_modules['Mixins/MultipleLines.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (MultipleLinesMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var extend = U.extend, merge = U.merge, pick = U.pick; /* eslint-disable valid-jsdoc */ // Utils // Index of element with extreme value from array (min or max) /** * @private */ function getExtremeIndexInArray(arr, extreme) { var extremeValue = arr[0], valueIndex = 0, i; for (i = 1; i < arr.length; i++) { if (extreme === 'max' && arr[i] >= extremeValue || extreme === 'min' && arr[i] <= extremeValue) { extremeValue = arr[i]; valueIndex = i; } } return valueIndex; } /* eslint-enable valid-jsdoc */ /* * * * Class * * */ /** * The Aroon series type. * * @private * @class * @name Highcharts.seriesTypes.aroon * * @augments Highcharts.Series */ var AroonIndicator = /** @class */ (function (_super) { __extends(AroonIndicator, _super); function AroonIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ AroonIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, // 0- date, 1- Aroon Up, 2- Aroon Down AR = [], xData = [], yData = [], slicedY, low = 2, high = 1, aroonUp, aroonDown, xLow, xHigh, i; // For a N-period, we start from N-1 point, to calculate Nth point // That is why we later need to comprehend slice() elements list // with (+1) for (i = period - 1; i < yValLen; i++) { slicedY = yVal.slice(i - period + 1, i + 2); xLow = getExtremeIndexInArray(slicedY.map(function (elem) { return pick(elem[low], elem); }), 'min'); xHigh = getExtremeIndexInArray(slicedY.map(function (elem) { return pick(elem[high], elem); }), 'max'); aroonUp = (xHigh / period) * 100; aroonDown = (xLow / period) * 100; if (xVal[i + 1]) { AR.push([xVal[i + 1], aroonUp, aroonDown]); xData.push(xVal[i + 1]); yData.push([aroonUp, aroonDown]); } } return { values: AR, xData: xData, yData: yData }; }; /** * Aroon. This series requires the `linkedTo` option to be * set and should be loaded after the `stock/indicators/indicators.js`. * * @sample {highstock} stock/indicators/aroon * Aroon * * @extends plotOptions.sma * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, * stacking * @requires stock/indicators/indicators * @requires stock/indicators/aroon * @optionparent plotOptions.aroon */ AroonIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * Paramters used in calculation of aroon series points. * * @excluding index */ params: { index: void 0, period: 25 }, marker: { enabled: false }, tooltip: { pointFormat: '<span style="color:{point.color}">\u25CF</span><b> {series.name}</b><br/>Aroon Up: {point.y}<br/>Aroon Down: {point.aroonDown}<br/>' }, /** * aroonDown line options. */ aroonDown: { /** * Styles for an aroonDown line. */ styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. If not set, it's inherited from * [plotOptions.aroon.color](#plotOptions.aroon.color). * * @type {Highcharts.ColorString} */ lineColor: void 0 } }, dataGrouping: { approximation: 'averages' } }); return AroonIndicator; }(SMAIndicator)); extend(AroonIndicator.prototype, { linesApiNames: ['aroonDown'], nameBase: 'Aroon', pointArrayMap: ['y', 'aroonDown'], pointValKey: 'y', drawGraph: MultipleLinesMixin.drawGraph, getTranslatedLinesNames: MultipleLinesMixin.getTranslatedLinesNames, toYData: MultipleLinesMixin.toYData, translate: MultipleLinesMixin.translate }); SeriesRegistry.registerSeriesType('aroon', AroonIndicator); /* * * * Default Export * * */ /** * A Aroon indicator. If the [type](#series.aroon.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.aroon * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, dataParser, dataURL, * joinBy, keys, navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/aroon * @apioption series.aroon */ ''; // to avoid removal of the above jsdoc return AroonIndicator; }); _registerModule(_modules, 'Stock/Indicators/AroonOscillator/AroonOscillatorIndicator.js', [_modules['Mixins/MultipleLines.js'], _modules['Mixins/IndicatorRequired.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (multipleLinesMixin, requiredIndicator, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var AroonIndicator = SeriesRegistry.seriesTypes.aroon; var extend = U.extend, merge = U.merge; var AROON = SeriesRegistry.seriesTypes.aroon; /* * * * Class * * */ /** * The Aroon Oscillator series type. * * @private * @class * @name Highcharts.seriesTypes.aroonoscillator * * @augments Highcharts.Series */ var AroonOscillatorIndicator = /** @class */ (function (_super) { __extends(AroonOscillatorIndicator, _super); function AroonOscillatorIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ AroonOscillatorIndicator.prototype.getValues = function (series, params) { // 0- date, 1- Aroon Oscillator var ARO = [], xData = [], yData = [], aroon, aroonUp, aroonDown, oscillator, i; aroon = AROON.prototype.getValues.call(this, series, params); for (i = 0; i < aroon.yData.length; i++) { aroonUp = aroon.yData[i][0]; aroonDown = aroon.yData[i][1]; oscillator = aroonUp - aroonDown; ARO.push([aroon.xData[i], oscillator]); xData.push(aroon.xData[i]); yData.push(oscillator); } return { values: ARO, xData: xData, yData: yData }; }; AroonOscillatorIndicator.prototype.init = function () { var args = arguments, ctx = this; requiredIndicator.isParentLoaded(AROON, 'aroon', ctx.type, function (indicator) { indicator.prototype.init.apply(ctx, args); return; }); }; /** * Aroon Oscillator. This series requires the `linkedTo` option to be set * and should be loaded after the `stock/indicators/indicators.js` and * `stock/indicators/aroon.js`. * * @sample {highstock} stock/indicators/aroon-oscillator * Aroon Oscillator * * @extends plotOptions.aroon * @since 7.0.0 * @product highstock * @excluding allAreas, aroonDown, colorAxis, compare, compareBase, * joinBy, keys, navigatorOptions, pointInterval, * pointIntervalUnit, pointPlacement, pointRange, pointStart, * showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/aroon * @requires stock/indicators/aroon-oscillator * @optionparent plotOptions.aroonoscillator */ AroonOscillatorIndicator.defaultOptions = merge(AroonIndicator.defaultOptions, { tooltip: { pointFormat: '<span style="color:{point.color}">\u25CF</span><b> {series.name}</b>: {point.y}' } }); return AroonOscillatorIndicator; }(AroonIndicator)); extend(AroonOscillatorIndicator.prototype, merge(multipleLinesMixin, { nameBase: 'Aroon Oscillator', pointArrayMap: ['y'], pointValKey: 'y', linesApiNames: [] })); SeriesRegistry.registerSeriesType('aroonoscillator', AroonOscillatorIndicator); /* * * * Default Export * * */ /** * An `Aroon Oscillator` series. If the [type](#series.aroonoscillator.type) * option is not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.aroonoscillator * @since 7.0.0 * @product highstock * @excluding allAreas, aroonDown, colorAxis, compare, compareBase, dataParser, * dataURL, joinBy, keys, navigatorOptions, pointInterval, * pointIntervalUnit, pointPlacement, pointRange, pointStart, * showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/aroon * @requires stock/indicators/aroon-oscillator * @apioption series.aroonoscillator */ ''; // adds doclet above to the transpiled file return AroonOscillatorIndicator; }); _registerModule(_modules, 'Stock/Indicators/ATR/ATRIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var isArray = U.isArray, merge = U.merge; /* eslint-disable valid-jsdoc */ // Utils: /** * @private */ function accumulateAverage(points, xVal, yVal, i) { var xValue = xVal[i], yValue = yVal[i]; points.push([xValue, yValue]); } /** * @private */ function getTR(currentPoint, prevPoint) { var pointY = currentPoint, prevY = prevPoint, HL = pointY[1] - pointY[2], HCp = typeof prevY === 'undefined' ? 0 : Math.abs(pointY[1] - prevY[3]), LCp = typeof prevY === 'undefined' ? 0 : Math.abs(pointY[2] - prevY[3]), TR = Math.max(HL, HCp, LCp); return TR; } /** * @private */ function populateAverage(points, xVal, yVal, i, period, prevATR) { var x = xVal[i - 1], TR = getTR(yVal[i - 1], yVal[i - 2]), y; y = (((prevATR * (period - 1)) + TR) / period); return [x, y]; } /* eslint-enable valid-jsdoc */ /* * * * Class * * */ /** * The ATR series type. * * @private * @class * @name Highcharts.seriesTypes.atr * * @augments Highcharts.Series */ var ATRIndicator = /** @class */ (function (_super) { __extends(ATRIndicator, _super); function ATRIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.points = void 0; _this.options = void 0; return _this; } /* * * * Functions * * */ ATRIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, xValue = xVal[0], yValue = yVal[0], range = 1, prevATR = 0, TR = 0, ATR = [], xData = [], yData = [], point, i, points; points = [[xValue, yValue]]; if ((xVal.length <= period) || !isArray(yVal[0]) || yVal[0].length !== 4) { return; } for (i = 1; i <= yValLen; i++) { accumulateAverage(points, xVal, yVal, i); if (period < range) { point = populateAverage(points, xVal, yVal, i, period, prevATR); prevATR = point[1]; ATR.push(point); xData.push(point[0]); yData.push(point[1]); } else if (period === range) { prevATR = TR / (i - 1); ATR.push([xVal[i - 1], prevATR]); xData.push(xVal[i - 1]); yData.push(prevATR); range++; } else { TR += getTR(yVal[i - 1], yVal[i - 2]); range++; } } return { values: ATR, xData: xData, yData: yData }; }; /** * Average true range indicator (ATR). This series requires `linkedTo` * option to be set. * * @sample stock/indicators/atr * ATR indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/atr * @optionparent plotOptions.atr */ ATRIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index */ params: { index: void 0 // unused index, do not inherit (#15362) } }); return ATRIndicator; }(SMAIndicator)); SeriesRegistry.registerSeriesType('atr', ATRIndicator); /* * * * Default Export * * */ /** * A `ATR` series. If the [type](#series.atr.type) option is not specified, it * is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.atr * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/atr * @apioption series.atr */ ''; // to include the above in the js output return ATRIndicator; }); _registerModule(_modules, 'Stock/Indicators/BB/BBIndicator.js', [_modules['Mixins/MultipleLines.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (MultipleLinesMixin, SeriesRegistry, U) { /** * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var extend = U.extend, isArray = U.isArray, merge = U.merge; /* eslint-disable valid-jsdoc */ // Utils: /** * @private */ function getStandardDeviation(arr, index, isOHLC, mean) { var variance = 0, arrLen = arr.length, std = 0, i = 0, value; for (; i < arrLen; i++) { value = (isOHLC ? arr[i][index] : arr[i]) - mean; variance += value * value; } variance = variance / (arrLen - 1); std = Math.sqrt(variance); return std; } /* eslint-enable valid-jsdoc */ /** * Bollinger Bands series type. * * @private * @class * @name Highcharts.seriesTypes.bb * * @augments Highcharts.Series */ var BBIndicator = /** @class */ (function (_super) { __extends(BBIndicator, _super); function BBIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Prototype Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } BBIndicator.prototype.init = function () { SeriesRegistry.seriesTypes.sma.prototype.init.apply(this, arguments); // Set default color for lines: this.options = merge({ topLine: { styles: { lineColor: this.color } }, bottomLine: { styles: { lineColor: this.color } } }, this.options); }; BBIndicator.prototype.getValues = function (series, params) { var period = params.period, standardDeviation = params.standardDeviation, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, // 0- date, 1-middle line, 2-top line, 3-bottom line BB = [], // middle line, top line and bottom line ML, TL, BL, date, xData = [], yData = [], slicedX, slicedY, stdDev, isOHLC, point, i; if (xVal.length < period) { return; } isOHLC = isArray(yVal[0]); for (i = period; i <= yValLen; i++) { slicedX = xVal.slice(i - period, i); slicedY = yVal.slice(i - period, i); point = SeriesRegistry.seriesTypes.sma.prototype.getValues.call(this, { xData: slicedX, yData: slicedY }, params); date = point.xData[0]; ML = point.yData[0]; stdDev = getStandardDeviation(slicedY, params.index, isOHLC, ML); TL = ML + standardDeviation * stdDev; BL = ML - standardDeviation * stdDev; BB.push([date, TL, ML, BL]); xData.push(date); yData.push([TL, ML, BL]); } return { values: BB, xData: xData, yData: yData }; }; /** * Bollinger bands (BB). This series requires the `linkedTo` option to be * set and should be loaded after the `stock/indicators/indicators.js` file. * * @sample stock/indicators/bollinger-bands * Bollinger bands * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/bollinger-bands * @optionparent plotOptions.bb */ BBIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { period: 20, /** * Standard deviation for top and bottom bands. */ standardDeviation: 2, index: 3 }, /** * Bottom line options. */ bottomLine: { /** * Styles for a bottom line. */ styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. If not set, it's inherited from * [plotOptions.bb.color](#plotOptions.bb.color). * * @type {Highcharts.ColorString} */ lineColor: void 0 } }, /** * Top line options. * * @extends plotOptions.bb.bottomLine */ topLine: { styles: { lineWidth: 1, /** * @type {Highcharts.ColorString} */ lineColor: void 0 } }, tooltip: { pointFormat: '<span style="color:{point.color}">\u25CF</span><b> {series.name}</b><br/>Top: {point.top}<br/>Middle: {point.middle}<br/>Bottom: {point.bottom}<br/>' }, marker: { enabled: false }, dataGrouping: { approximation: 'averages' } }); return BBIndicator; }(SMAIndicator)); extend(BBIndicator.prototype, { pointArrayMap: ['top', 'middle', 'bottom'], pointValKey: 'middle', nameComponents: ['period', 'standardDeviation'], linesApiNames: ['topLine', 'bottomLine'], drawGraph: MultipleLinesMixin.drawGraph, getTranslatedLinesNames: MultipleLinesMixin.getTranslatedLinesNames, translate: MultipleLinesMixin.translate, toYData: MultipleLinesMixin.toYData }); SeriesRegistry.registerSeriesType('bb', BBIndicator); /* * * * Default Export * * */ /** * A bollinger bands indicator. If the [type](#series.bb.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.bb * @since 6.0.0 * @excluding dataParser, dataURL * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/bollinger-bands * @apioption series.bb */ ''; // to include the above in the js output return BBIndicator; }); _registerModule(_modules, 'Stock/Indicators/CCI/CCIIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var isArray = U.isArray, merge = U.merge; /* eslint-disable valid-jsdoc */ // Utils: /** * @private */ function sumArray(array) { return array.reduce(function (prev, cur) { return prev + cur; }, 0); } /** * @private */ function meanDeviation(arr, sma) { var len = arr.length, sum = 0, i; for (i = 0; i < len; i++) { sum += Math.abs(sma - (arr[i])); } return sum; } /* eslint-enable valid-jsdoc */ /* * * * Class * * */ /** * The CCI series type. * * @private * @class * @name Highcharts.seriesTypes.cci * * @augments Highcharts.Series */ var CCIIndicator = /** @class */ (function (_super) { __extends(CCIIndicator, _super); function CCIIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.points = void 0; _this.options = void 0; return _this; } /* * * * Functions * * */ CCIIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, TP = [], periodTP = [], range = 1, CCI = [], xData = [], yData = [], CCIPoint, p, len, smaTP, TPtemp, meanDev, i; // CCI requires close value if (xVal.length <= period || !isArray(yVal[0]) || yVal[0].length !== 4) { return; } // accumulate first N-points while (range < period) { p = yVal[range - 1]; TP.push((p[1] + p[2] + p[3]) / 3); range++; } for (i = period; i <= yValLen; i++) { p = yVal[i - 1]; TPtemp = (p[1] + p[2] + p[3]) / 3; len = TP.push(TPtemp); periodTP = TP.slice(len - period); smaTP = sumArray(periodTP) / period; meanDev = meanDeviation(periodTP, smaTP) / period; CCIPoint = ((TPtemp - smaTP) / (0.015 * meanDev)); CCI.push([xVal[i - 1], CCIPoint]); xData.push(xVal[i - 1]); yData.push(CCIPoint); } return { values: CCI, xData: xData, yData: yData }; }; /** * Commodity Channel Index (CCI). This series requires `linkedTo` option to * be set. * * @sample stock/indicators/cci * CCI indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/cci * @optionparent plotOptions.cci */ CCIIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index */ params: { index: void 0 // unused index, do not inherit (#15362) } }); return CCIIndicator; }(SMAIndicator)); SeriesRegistry.registerSeriesType('cci', CCIIndicator); /* * * * Default Export * * */ /** * A `CCI` series. If the [type](#series.cci.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.cci * @since 6.0.0 * @excluding dataParser, dataURL * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/cci * @apioption series.cci */ ''; // to include the above in the js output return CCIIndicator; }); _registerModule(_modules, 'Stock/Indicators/CMF/CMFIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * (c) 2010-2021 Highsoft AS * * Author: Sebastian Domas * * Chaikin Money Flow indicator for Highcharts Stock * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var merge = U.merge; /** * The CMF series type. * * @private * @class * @name Highcharts.seriesTypes.cmf * * @augments Highcharts.Series */ var CMFIndicator = /** @class */ (function (_super) { __extends(CMFIndicator, _super); function CMFIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; _this.volumeSeries = void 0; _this.linkedParent = void 0; _this.yData = void 0; _this.nameBase = 'Chaikin Money Flow'; return _this; } /** * Checks if the series and volumeSeries are accessible, number of * points.x is longer than period, is series has OHLC data * @private * @param {Highcharts.CMFIndicator} this indicator to use. * @return {boolean} True if series is valid and can be computed, * otherwise false. */ CMFIndicator.prototype.isValid = function () { var chart = this.chart, options = this.options, series = this.linkedParent, volumeSeries = (this.volumeSeries || (this.volumeSeries = chart.get(options.params.volumeSeriesID))), isSeriesOHLC = (series && series.yData && series.yData[0].length === 4); /** * @private * @param {Highcharts.Series} serie to check length validity on. * @return {boolean|undefined} true if length is valid. */ function isLengthValid(serie) { return serie.xData && serie.xData.length >= options.params.period; } return !!(series && volumeSeries && isLengthValid(series) && isLengthValid(volumeSeries) && isSeriesOHLC); }; /** * Returns indicator's data. * @private * @param {Highcharts.CMFIndicator} this indicator to use. * @param {Highcharts.Series} series to calculate values from * @param {Highcharts.CMFIndicatorParamsOptions} params to pass * @return {boolean|Highcharts.IndicatorNullableValuesObject} Returns false if the * indicator is not valid, otherwise returns Values object. */ CMFIndicator.prototype.getValues = function (series, params) { if (!this.isValid()) { return; } return this.getMoneyFlow(series.xData, series.yData, this.volumeSeries.yData, params.period); }; /** * @private * @param {Array<number>} xData - x timestamp values * @param {Array<number>} seriesYData - yData of basic series * @param {Array<number>} volumeSeriesYData - yData of volume series * @param {number} period - indicator's param * @return {Highcharts.IndicatorNullableValuesObject} object containing computed money * flow data */ CMFIndicator.prototype.getMoneyFlow = function (xData, seriesYData, volumeSeriesYData, period) { var len = seriesYData.length, moneyFlowVolume = [], sumVolume = 0, sumMoneyFlowVolume = 0, moneyFlowXData = [], moneyFlowYData = [], values = [], i, point, nullIndex = -1; /** * Calculates money flow volume, changes i, nullIndex vars from * upper scope! * @private * @param {Array<number>} ohlc - OHLC point * @param {number} volume - Volume point's y value * @return {number|null} - volume * moneyFlowMultiplier **/ function getMoneyFlowVolume(ohlc, volume) { var high = ohlc[1], low = ohlc[2], close = ohlc[3], isValid = volume !== null && high !== null && low !== null && close !== null && high !== low; /** * @private * @param {number} h - High value * @param {number} l - Low value * @param {number} c - Close value * @return {number} calculated multiplier for the point **/ function getMoneyFlowMultiplier(h, l, c) { return ((c - l) - (h - c)) / (h - l); } return isValid ? getMoneyFlowMultiplier(high, low, close) * volume : ((nullIndex = i), null); } if (period > 0 && period <= len) { for (i = 0; i < period; i++) { moneyFlowVolume[i] = getMoneyFlowVolume(seriesYData[i], volumeSeriesYData[i]); sumVolume += volumeSeriesYData[i]; sumMoneyFlowVolume += moneyFlowVolume[i]; } moneyFlowXData.push(xData[i - 1]); moneyFlowYData.push(i - nullIndex >= period && sumVolume !== 0 ? sumMoneyFlowVolume / sumVolume : null); values.push([moneyFlowXData[0], moneyFlowYData[0]]); for (; i < len; i++) { moneyFlowVolume[i] = getMoneyFlowVolume(seriesYData[i], volumeSeriesYData[i]); sumVolume -= volumeSeriesYData[i - period]; sumVolume += volumeSeriesYData[i]; sumMoneyFlowVolume -= moneyFlowVolume[i - period]; sumMoneyFlowVolume += moneyFlowVolume[i]; point = [ xData[i], i - nullIndex >= period ? sumMoneyFlowVolume / sumVolume : null ]; moneyFlowXData.push(point[0]); moneyFlowYData.push(point[1]); values.push([point[0], point[1]]); } } return { values: values, xData: moneyFlowXData, yData: moneyFlowYData }; }; /** * Chaikin Money Flow indicator (cmf). * * @sample stock/indicators/cmf/ * Chaikin Money Flow indicator * * @extends plotOptions.sma * @since 6.0.0 * @excluding animationLimit * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/cmf * @optionparent plotOptions.cmf */ CMFIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index */ params: { index: void 0, /** * The id of another series to use its data as volume data for the * indiator calculation. */ volumeSeriesID: 'volume' } }); return CMFIndicator; }(SMAIndicator)); SeriesRegistry.registerSeriesType('cmf', CMFIndicator); /* * * * Default Export * * */ /** * A `CMF` series. If the [type](#series.cmf.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.cmf * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/cmf * @apioption series.cmf */ ''; // adds doclet above to the transpiled file return CMFIndicator; }); _registerModule(_modules, 'Stock/Indicators/DMI/DMIIndicator.js', [_modules['Mixins/MultipleLines.js'], _modules['Core/Color/Palette.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (MultipleLinesMixin, palette, SeriesRegistry, U) { /* * * (c) 2010-2021 Rafal Sebestjanski * * Directional Movement Index (DMI) indicator for Highcharts Stock * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var correctFloat = U.correctFloat, extend = U.extend, isArray = U.isArray, merge = U.merge; /* * * * Class * * */ /** * The Directional Movement Index (DMI) series type. * * @private * @class * @name Highcharts.seriesTypes.dmi * * @augments Highcharts.Series */ var DMIIndicator = /** @class */ (function (_super) { __extends(DMIIndicator, _super); function DMIIndicator() { return _super !== null && _super.apply(this, arguments) || this; } /* * * * Functions * * */ DMIIndicator.prototype.calculateDM = function (yVal, i, isPositiveDM) { var currentHigh = yVal[i][1], currentLow = yVal[i][2], previousHigh = yVal[i - 1][1], previousLow = yVal[i - 1][2]; var DM; if (currentHigh - previousHigh > previousLow - currentLow) { // for +DM DM = isPositiveDM ? Math.max(currentHigh - previousHigh, 0) : 0; } else { // for -DM DM = !isPositiveDM ? Math.max(previousLow - currentLow, 0) : 0; } return correctFloat(DM); }; DMIIndicator.prototype.calculateDI = function (smoothedDM, tr) { return smoothedDM / tr * 100; }; DMIIndicator.prototype.calculateDX = function (plusDI, minusDI) { return correctFloat(Math.abs(plusDI - minusDI) / Math.abs(plusDI + minusDI) * 100); }; DMIIndicator.prototype.smoothValues = function (accumulatedValues, currentValue, period) { return correctFloat(accumulatedValues - accumulatedValues / period + currentValue); }; DMIIndicator.prototype.getTR = function (currentPoint, prevPoint) { return correctFloat(Math.max( // currentHigh - currentLow currentPoint[1] - currentPoint[2], // currentHigh - previousClose !prevPoint ? 0 : Math.abs(currentPoint[1] - prevPoint[3]), // currentLow - previousClose !prevPoint ? 0 : Math.abs(currentPoint[2] - prevPoint[3]))); }; DMIIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, DMI = [], xData = [], yData = []; if ( // Check period, if bigger than points length, skip (xVal.length <= period) || // Only ohlc data is valid !isArray(yVal[0]) || yVal[0].length !== 4) { return; } var prevSmoothedPlusDM = 0, prevSmoothedMinusDM = 0, prevSmoothedTR = 0, i; for (i = 1; i < yValLen; i++) { var smoothedPlusDM = void 0, smoothedMinusDM = void 0, smoothedTR = void 0, plusDM = void 0, // +DM minusDM = void 0, // -DM TR = void 0, plusDI = void 0, // +DI minusDI = void 0, // -DI DX = void 0; if (i <= period) { plusDM = this.calculateDM(yVal, i, true); minusDM = this.calculateDM(yVal, i); TR = this.getTR(yVal[i], yVal[i - 1]); // Accumulate first period values to smooth them later prevSmoothedPlusDM += plusDM; prevSmoothedMinusDM += minusDM; prevSmoothedTR += TR; // Get all values for the first point if (i === period) { plusDI = this.calculateDI(prevSmoothedPlusDM, prevSmoothedTR); minusDI = this.calculateDI(prevSmoothedMinusDM, prevSmoothedTR); DX = this.calculateDX(prevSmoothedPlusDM, prevSmoothedMinusDM); DMI.push([xVal[i], DX, plusDI, minusDI]); xData.push(xVal[i]); yData.push([DX, plusDI, minusDI]); } } else { // Calculate current values plusDM = this.calculateDM(yVal, i, true); minusDM = this.calculateDM(yVal, i); TR = this.getTR(yVal[i], yVal[i - 1]); // Smooth +DM, -DM and TR smoothedPlusDM = this.smoothValues(prevSmoothedPlusDM, plusDM, period); smoothedMinusDM = this.smoothValues(prevSmoothedMinusDM, minusDM, period); smoothedTR = this.smoothValues(prevSmoothedTR, TR, period); // Save current smoothed values for the next step prevSmoothedPlusDM = smoothedPlusDM; prevSmoothedMinusDM = smoothedMinusDM; prevSmoothedTR = smoothedTR; // Get all next points (except the first one calculated above) plusDI = this.calculateDI(prevSmoothedPlusDM, prevSmoothedTR); minusDI = this.calculateDI(prevSmoothedMinusDM, prevSmoothedTR); DX = this.calculateDX(prevSmoothedPlusDM, prevSmoothedMinusDM); DMI.push([xVal[i], DX, plusDI, minusDI]); xData.push(xVal[i]); yData.push([DX, plusDI, minusDI]); } } return { values: DMI, xData: xData, yData: yData }; }; /** * Directional Movement Index (DMI). * This series requires the `linkedTo` option to be set and should * be loaded after the `stock/indicators/indicators.js` file. * * @sample stock/indicators/dmi * DMI indicator * * @extends plotOptions.sma * @since 9.1.0 * @product highstock * @excluding allAreas, colorAxis, joinBy, keys, navigatorOptions, * pointInterval, pointIntervalUnit, pointPlacement, * pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/dmi * @optionparent plotOptions.dmi */ DMIIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index */ params: { index: void 0 // unused index, do not inherit (#15362) }, marker: { enabled: false }, tooltip: { pointFormat: '<span style="color: {point.color}">\u25CF</span><b> {series.name}</b><br/>' + '<span style="color: {point.color}">DX</span>: {point.y}<br/>' + '<span style="color: {point.series.options.plusDILine.styles.lineColor}">+DI</span>' + ': {point.plusDI}<br/>' + '<span style="color: {point.series.options.minusDILine.styles.lineColor}">-DI</span>' + ': {point.minusDI}<br/>' }, /** * +DI line options. */ plusDILine: { /** * Styles for the +DI line. */ styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. * * @type {Highcharts.ColorString} */ lineColor: palette.positiveColor // green-ish } }, /** * -DI line options. */ minusDILine: { /** * Styles for the -DI line. */ styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. * * @type {Highcharts.ColorString} */ lineColor: palette.negativeColor // red-ish } }, dataGrouping: { approximation: 'averages' } }); return DMIIndicator; }(SMAIndicator)); extend(DMIIndicator.prototype, { nameBase: 'DMI', pointArrayMap: ['y', 'plusDI', 'minusDI'], parallelArrays: ['x', 'y', 'plusDI', 'minusDI'], pointValKey: 'y', linesApiNames: ['plusDILine', 'minusDILine'], drawGraph: MultipleLinesMixin.drawGraph, getTranslatedLinesNames: MultipleLinesMixin.getTranslatedLinesNames, translate: MultipleLinesMixin.translate, toYData: MultipleLinesMixin.toYData }); SeriesRegistry.registerSeriesType('dmi', DMIIndicator); /* * * * Default Export * * */ /** * The Directional Movement Index (DMI) indicator series. * If the [type](#series.dmi.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.dmi * @since 9.1.0 * @product highstock * @excluding allAreas, colorAxis, dataParser, dataURL, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/dmi * @apioption series.dmi */ ''; // to include the above in the js output return DMIIndicator; }); _registerModule(_modules, 'Stock/Indicators/DPO/DPOIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var extend = U.extend, merge = U.merge, correctFloat = U.correctFloat, pick = U.pick; /* eslint-disable valid-jsdoc */ // Utils: /** * @private */ function accumulatePoints(sum, yVal, i, index, subtract) { var price = pick(yVal[i][index], yVal[i]); if (subtract) { return correctFloat(sum - price); } return correctFloat(sum + price); } /* * * * Class * * */ /** * The DPO series type. * * @private * @class * @name Highcharts.seriesTypes.dpo * * @augments Highcharts.Series */ var DPOIndicator = /** @class */ (function (_super) { __extends(DPOIndicator, _super); function DPOIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.options = void 0; _this.data = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ /** * @lends Highcharts.Series# */ DPOIndicator.prototype.getValues = function (series, params) { var period = params.period, index = params.index, offset = Math.floor(period / 2 + 1), range = period + offset, xVal = series.xData || [], yVal = series.yData || [], yValLen = yVal.length, // 0- date, 1- Detrended Price Oscillator DPO = [], xData = [], yData = [], sum = 0, oscillator, periodIndex, rangeIndex, price, i, j; if (xVal.length <= range) { return; } // Accumulate first N-points for SMA for (i = 0; i < period - 1; i++) { sum = accumulatePoints(sum, yVal, i, index); } // Detrended Price Oscillator formula: // DPO = Price - Simple moving average [from (n / 2 + 1) days ago] for (j = 0; j <= yValLen - range; j++) { periodIndex = j + period - 1; rangeIndex = j + range - 1; // adding the last period point sum = accumulatePoints(sum, yVal, periodIndex, index); price = pick(yVal[rangeIndex][index], yVal[rangeIndex]); oscillator = price - sum / period; // substracting the first period point sum = accumulatePoints(sum, yVal, j, index, true); DPO.push([xVal[rangeIndex], oscillator]); xData.push(xVal[rangeIndex]); yData.push(oscillator); } return { values: DPO, xData: xData, yData: yData }; }; /** * Detrended Price Oscillator. This series requires the `linkedTo` option to * be set and should be loaded after the `stock/indicators/indicators.js`. * * @sample {highstock} stock/indicators/dpo * Detrended Price Oscillator * * @extends plotOptions.sma * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, * stacking * @requires stock/indicators/indicators * @requires stock/indicators/dpo * @optionparent plotOptions.dpo */ DPOIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * Parameters used in calculation of Detrended Price Oscillator series * points. */ params: { index: 0, /** * Period for Detrended Price Oscillator */ period: 21 } }); return DPOIndicator; }(SMAIndicator)); extend(DPOIndicator.prototype, { nameBase: 'DPO' }); SeriesRegistry.registerSeriesType('dpo', DPOIndicator); /* * * * Default Export * * */ /** * A Detrended Price Oscillator. If the [type](#series.dpo.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.dpo * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, dataParser, dataURL, * joinBy, keys, navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/dpo * @apioption series.dpo */ ''; // to include the above in the js output' return DPOIndicator; }); _registerModule(_modules, 'Stock/Indicators/EMA/EMAIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var correctFloat = U.correctFloat, isArray = U.isArray, merge = U.merge; /* * * * Class * * */ /** * The EMA series type. * * @private * @class * @name Highcharts.seriesTypes.ema * * @augments Highcharts.Series */ var EMAIndicator = /** @class */ (function (_super) { __extends(EMAIndicator, _super); function EMAIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ EMAIndicator.prototype.accumulatePeriodPoints = function (period, index, yVal) { var sum = 0, i = 0, y = 0; while (i < period) { y = index < 0 ? yVal[i] : yVal[i][index]; sum = sum + y; i++; } return sum; }; EMAIndicator.prototype.calculateEma = function (xVal, yVal, i, EMApercent, calEMA, index, SMA) { var x = xVal[i - 1], yValue = index < 0 ? yVal[i - 1] : yVal[i - 1][index], y; y = typeof calEMA === 'undefined' ? SMA : correctFloat((yValue * EMApercent) + (calEMA * (1 - EMApercent))); return [x, y]; }; EMAIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, EMApercent = 2 / (period + 1), sum = 0, EMA = [], xData = [], yData = [], index = -1, SMA = 0, calEMA, EMAPoint, i; // Check period, if bigger than points length, skip if (yValLen < period) { return; } // Switch index for OHLC / Candlestick / Arearange if (isArray(yVal[0])) { index = params.index ? params.index : 0; } // Accumulate first N-points sum = this.accumulatePeriodPoints(period, index, yVal); // first point SMA = sum / period; // Calculate value one-by-one for each period in visible data for (i = period; i < yValLen + 1; i++) { EMAPoint = this.calculateEma(xVal, yVal, i, EMApercent, calEMA, index, SMA); EMA.push(EMAPoint); xData.push(EMAPoint[0]); yData.push(EMAPoint[1]); calEMA = EMAPoint[1]; } return { values: EMA, xData: xData, yData: yData }; }; /** * Exponential moving average indicator (EMA). This series requires the * `linkedTo` option to be set. * * @sample stock/indicators/ema * Exponential moving average indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/ema * @optionparent plotOptions.ema */ EMAIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { /** * The point index which indicator calculations will base. For * example using OHLC data, index=2 means the indicator will be * calculated using Low values. * * By default index value used to be set to 0. Since * Highcharts Stock 7 by default index is set to 3 * which means that the ema indicator will be * calculated using Close values. */ index: 3, period: 9 // @merge 14 in v6.2 } }); return EMAIndicator; }(SMAIndicator)); SeriesRegistry.registerSeriesType('ema', EMAIndicator); /* * * * Default Export * * */ /** * A `EMA` series. If the [type](#series.ema.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.ema * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/ema * @apioption series.ema */ ''; // adds doclet above to the transpiled file return EMAIndicator; }); _registerModule(_modules, 'Stock/Indicators/Chaikin/ChaikinIndicator.js', [_modules['Mixins/IndicatorRequired.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (RequiredIndicatorMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var _a = SeriesRegistry.seriesTypes, AD = _a.ad, EMAIndicator = _a.ema; var correctFloat = U.correctFloat, extend = U.extend, merge = U.merge, error = U.error; /* * * * Class * * */ /** * The Chaikin series type. * * @private * @class * @name Highcharts.seriesTypes.chaikin * * @augments Highcharts.Series */ var ChaikinIndicator = /** @class */ (function (_super) { __extends(ChaikinIndicator, _super); function ChaikinIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ ChaikinIndicator.prototype.init = function () { var args = arguments, ctx = this; RequiredIndicatorMixin.isParentLoaded(EMAIndicator, 'ema', ctx.type, function (indicator) { indicator.prototype.init.apply(ctx, args); return; }); }; ChaikinIndicator.prototype.getValues = function (series, params) { var periods = params.periods, period = params.period, // Accumulation Distribution Line data ADL, // 0- date, 1- Chaikin Oscillator CHA = [], xData = [], yData = [], periodsOffset, // Shorter Period EMA SPE, // Longer Period EMA LPE, oscillator, i; // Check if periods are correct if (periods.length !== 2 || periods[1] <= periods[0]) { error('Error: "Chaikin requires two periods. Notice, first ' + 'period should be lower than the second one."'); return; } ADL = AD.prototype.getValues.call(this, series, { volumeSeriesID: params.volumeSeriesID, period: period }); // Check if adl is calculated properly, if not skip if (!ADL) { return; } SPE = EMAIndicator.prototype.getValues.call(this, ADL, { period: periods[0] }); LPE = EMAIndicator.prototype.getValues.call(this, ADL, { period: periods[1] }); // Check if ema is calculated properly, if not skip if (!SPE || !LPE) { return; } periodsOffset = periods[1] - periods[0]; for (i = 0; i < LPE.yData.length; i++) { oscillator = correctFloat(SPE.yData[i + periodsOffset] - LPE.yData[i]); CHA.push([LPE.xData[i], oscillator]); xData.push(LPE.xData[i]); yData.push(oscillator); } return { values: CHA, xData: xData, yData: yData }; }; /** * Chaikin Oscillator. This series requires the `linkedTo` option to * be set and should be loaded after the `stock/indicators/indicators.js` * and `stock/indicators/ema.js`. * * @sample {highstock} stock/indicators/chaikin * Chaikin Oscillator * * @extends plotOptions.ema * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, joinBy, keys, navigatorOptions, * pointInterval, pointIntervalUnit, pointPlacement, * pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/ema * @requires stock/indicators/chaikin * @optionparent plotOptions.chaikin */ ChaikinIndicator.defaultOptions = merge(EMAIndicator.defaultOptions, { /** * Paramters used in calculation of Chaikin Oscillator * series points. * * @excluding index */ params: { index: void 0, /** * The id of volume series which is mandatory. * For example using OHLC data, volumeSeriesID='volume' means * the indicator will be calculated using OHLC and volume values. */ volumeSeriesID: 'volume', /** * Parameter used indirectly for calculating the `AD` indicator. * Decides about the number of data points that are taken * into account for the indicator calculations. */ period: 9, /** * Periods for Chaikin Oscillator calculations. * * @type {Array<number>} * @default [3, 10] */ periods: [3, 10] } }); return ChaikinIndicator; }(EMAIndicator)); extend(ChaikinIndicator.prototype, { nameBase: 'Chaikin Osc', nameComponents: ['periods'] }); SeriesRegistry.registerSeriesType('chaikin', ChaikinIndicator); /* * * * Default Export * * */ /** * A `Chaikin Oscillator` series. If the [type](#series.chaikin.type) * option is not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.chaikin * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, dataParser, dataURL, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, stacking, showInNavigator * @requires stock/indicators/indicators * @requires stock/indicators/ema * @requires stock/indicators/chaikin * @apioption series.chaikin */ ''; // to include the above in the js output return ChaikinIndicator; }); _registerModule(_modules, 'Stock/Indicators/CMO/CMOIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var isNumber = U.isNumber, merge = U.merge; /* eslint-enable require-jsdoc */ /** * The CMO series type. * * @private * @class * @name Highcharts.seriesTypes.cmo * * @augments Highcharts.Series */ var CMOIndicator = /** @class */ (function (_super) { __extends(CMOIndicator, _super); function CMOIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ CMOIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, CMO = [], xData = [], yData = []; var i, index = params.index, values; if (xVal.length < period) { return; } if (isNumber(yVal[0])) { values = yVal; } else { // In case of the situation, where the series type has data length // shorter then 4 (HLC, range), this ensures that we are not trying // to reach the index out of bounds index = Math.min(index, yVal[0].length - 1); values = yVal.map(function (value) { return value[index]; }); } var firstAddedSum = 0, sumOfHigherValues = 0, sumOfLowerValues = 0, y; // Calculate first point, check if the first value // was added to sum of higher/lower values, and what was the value. for (var j = period; j > 0; j--) { if (values[j] > values[j - 1]) { sumOfHigherValues += values[j] - values[j - 1]; } else if (values[j] < values[j - 1]) { sumOfLowerValues += values[j - 1] - values[j]; } } // You might devide by 0 if all values are equal, // so return 0 in this case. y = sumOfHigherValues + sumOfLowerValues > 0 ? (100 * (sumOfHigherValues - sumOfLowerValues)) / (sumOfHigherValues + sumOfLowerValues) : 0; xData.push(xVal[period]); yData.push(y); CMO.push([xVal[period], y]); for (i = period + 1; i < yValLen; i++) { firstAddedSum = Math.abs(values[i - period - 1] - values[i - period]); if (values[i] > values[i - 1]) { sumOfHigherValues += values[i] - values[i - 1]; } else if (values[i] < values[i - 1]) { sumOfLowerValues += values[i - 1] - values[i]; } // Check, to which sum was the first value added to, // and substract this value from given sum. if (values[i - period] > values[i - period - 1]) { sumOfHigherValues -= firstAddedSum; } else { sumOfLowerValues -= firstAddedSum; } // Same as above. y = sumOfHigherValues + sumOfLowerValues > 0 ? (100 * (sumOfHigherValues - sumOfLowerValues)) / (sumOfHigherValues + sumOfLowerValues) : 0; xData.push(xVal[i]); yData.push(y); CMO.push([xVal[i], y]); } return { values: CMO, xData: xData, yData: yData }; }; /** * Chande Momentum Oscilator (CMO) technical indicator. This series * requires the `linkedTo` option to be set and should be loaded after * the `stock/indicators/indicators.js` file. * * @sample stock/indicators/cmo * CMO indicator * * @extends plotOptions.sma * @since 9.1.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/cmo * @optionparent plotOptions.cmo */ CMOIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { period: 20, index: 3 } }); return CMOIndicator; }(SMAIndicator)); SeriesRegistry.registerSeriesType('cmo', CMOIndicator); /* * * * Default Export * * */ /** * A `CMO` series. If the [type](#series.cmo.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.cmo * @since 9.1.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/cmo * @apioption series.cmo */ (''); // to include the above in the js output return CMOIndicator; }); _registerModule(_modules, 'Stock/Indicators/DEMA/DEMAIndicator.js', [_modules['Mixins/IndicatorRequired.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (RequiredIndicatorMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var EMAIndicator = SeriesRegistry.seriesTypes.ema; var correctFloat = U.correctFloat, isArray = U.isArray, merge = U.merge; /** * The DEMA series Type * * @private * @class * @name Highcharts.seriesTypes.dema * * @augments Highcharts.Series */ var DEMAIndicator = /** @class */ (function (_super) { __extends(DEMAIndicator, _super); function DEMAIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.EMApercent = void 0; _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } DEMAIndicator.prototype.init = function () { var args = arguments, ctx = this; RequiredIndicatorMixin.isParentLoaded(EMAIndicator, 'ema', ctx.type, function (indicator) { indicator.prototype.init.apply(ctx, args); return; }); }; DEMAIndicator.prototype.getEMA = function (yVal, prevEMA, SMA, index, i, xVal) { return EMAIndicator.prototype.calculateEma(xVal || [], yVal, typeof i === 'undefined' ? 1 : i, this.EMApercent, prevEMA, typeof index === 'undefined' ? -1 : index, SMA); }; DEMAIndicator.prototype.getValues = function (series, params) { var period = params.period, doubledPeriod = 2 * period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, index = -1, accumulatePeriodPoints = 0, SMA = 0, DEMA = [], xDataDema = [], yDataDema = [], EMA = 0, // EMA(EMA) EMAlevel2, // EMA of previous point prevEMA, prevEMAlevel2, // EMA values array EMAvalues = [], i, DEMAPoint; this.EMApercent = (2 / (period + 1)); // Check period, if bigger than EMA points length, skip if (yValLen < 2 * period - 1) { return; } // Switch index for OHLC / Candlestick / Arearange if (isArray(yVal[0])) { index = params.index ? params.index : 0; } // Accumulate first N-points accumulatePeriodPoints = EMAIndicator.prototype.accumulatePeriodPoints(period, index, yVal); // first point SMA = accumulatePeriodPoints / period; accumulatePeriodPoints = 0; // Calculate value one-by-one for each period in visible data for (i = period; i < yValLen + 2; i++) { if (i < yValLen + 1) { EMA = this.getEMA(yVal, prevEMA, SMA, index, i)[1]; EMAvalues.push(EMA); } prevEMA = EMA; // Summing first period points for EMA(EMA) if (i < doubledPeriod) { accumulatePeriodPoints += EMA; } else { // Calculate DEMA // First DEMA point if (i === doubledPeriod) { SMA = accumulatePeriodPoints / period; } EMA = EMAvalues[i - period - 1]; EMAlevel2 = this.getEMA([EMA], prevEMAlevel2, SMA)[1]; DEMAPoint = [ xVal[i - 2], correctFloat(2 * EMA - EMAlevel2) ]; DEMA.push(DEMAPoint); xDataDema.push(DEMAPoint[0]); yDataDema.push(DEMAPoint[1]); prevEMAlevel2 = EMAlevel2; } } return { values: DEMA, xData: xDataDema, yData: yDataDema }; }; /** * Double exponential moving average (DEMA) indicator. This series requires * `linkedTo` option to be set and should be loaded after the * `stock/indicators/indicators.js` and `stock/indicators/ema.js`. * * @sample {highstock} stock/indicators/dema * DEMA indicator * * @extends plotOptions.ema * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, * stacking * @requires stock/indicators/indicators * @requires stock/indicators/ema * @requires stock/indicators/dema * @optionparent plotOptions.dema */ DEMAIndicator.defaultOptions = merge(EMAIndicator.defaultOptions); return DEMAIndicator; }(EMAIndicator)); SeriesRegistry.registerSeriesType('dema', DEMAIndicator); /* * * * Default Export * * */ /** * A `DEMA` series. If the [type](#series.dema.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.dema * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, dataParser, dataURL, * joinBy, keys, navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/ema * @requires stock/indicators/dema * @apioption series.dema */ ''; // adds doclet above to the transpiled file return DEMAIndicator; }); _registerModule(_modules, 'Stock/Indicators/TEMA/TEMAIndicator.js', [_modules['Mixins/IndicatorRequired.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (RequiredIndicatorMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var EMAIndicator = SeriesRegistry.seriesTypes.ema; var correctFloat = U.correctFloat, isArray = U.isArray, merge = U.merge; /** * The TEMA series type. * * @private * @class * @name Highcharts.seriesTypes.tema * * @augments Highcharts.Series */ var TEMAIndicator = /** @class */ (function (_super) { __extends(TEMAIndicator, _super); function TEMAIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.EMApercent = void 0; _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } TEMAIndicator.prototype.init = function () { var args = arguments, ctx = this; RequiredIndicatorMixin.isParentLoaded(EMAIndicator, 'ema', ctx.type, function (indicator) { indicator.prototype.init.apply(ctx, args); return; }); }; TEMAIndicator.prototype.getEMA = function (yVal, prevEMA, SMA, index, i, xVal) { return EMAIndicator.prototype.calculateEma(xVal || [], yVal, typeof i === 'undefined' ? 1 : i, this.EMApercent, prevEMA, typeof index === 'undefined' ? -1 : index, SMA); }; TEMAIndicator.prototype.getTemaPoint = function (xVal, tripledPeriod, EMAlevels, i) { var TEMAPoint = [ xVal[i - 3], correctFloat(3 * EMAlevels.level1 - 3 * EMAlevels.level2 + EMAlevels.level3) ]; return TEMAPoint; }; TEMAIndicator.prototype.getValues = function (series, params) { var period = params.period, doubledPeriod = 2 * period, tripledPeriod = 3 * period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, index = -1, accumulatePeriodPoints = 0, SMA = 0, TEMA = [], xDataTema = [], yDataTema = [], // EMA of previous point prevEMA, prevEMAlevel2, // EMA values array EMAvalues = [], EMAlevel2values = [], i, TEMAPoint, // This object contains all EMA EMAlevels calculated like below // EMA = level1 // EMA(EMA) = level2, // EMA(EMA(EMA)) = level3, EMAlevels = {}; this.EMApercent = (2 / (period + 1)); // Check period, if bigger than EMA points length, skip if (yValLen < 3 * period - 2) { return; } // Switch index for OHLC / Candlestick / Arearange if (isArray(yVal[0])) { index = params.index ? params.index : 0; } // Accumulate first N-points accumulatePeriodPoints = EMAIndicator.prototype.accumulatePeriodPoints(period, index, yVal); // first point SMA = accumulatePeriodPoints / period; accumulatePeriodPoints = 0; // Calculate value one-by-one for each period in visible data for (i = period; i < yValLen + 3; i++) { if (i < yValLen + 1) { EMAlevels.level1 = this.getEMA(yVal, prevEMA, SMA, index, i)[1]; EMAvalues.push(EMAlevels.level1); } prevEMA = EMAlevels.level1; // Summing first period points for ema(ema) if (i < doubledPeriod) { accumulatePeriodPoints += EMAlevels.level1; } else { // Calculate dema // First dema point if (i === doubledPeriod) { SMA = accumulatePeriodPoints / period; accumulatePeriodPoints = 0; } EMAlevels.level1 = EMAvalues[i - period - 1]; EMAlevels.level2 = this.getEMA([EMAlevels.level1], prevEMAlevel2, SMA)[1]; EMAlevel2values.push(EMAlevels.level2); prevEMAlevel2 = EMAlevels.level2; // Summing first period points for ema(ema(ema)) if (i < tripledPeriod) { accumulatePeriodPoints += EMAlevels.level2; } else { // Calculate tema // First tema point if (i === tripledPeriod) { SMA = accumulatePeriodPoints / period; } if (i === yValLen + 1) { // Calculate the last ema and emaEMA points EMAlevels.level1 = EMAvalues[i - period - 1]; EMAlevels.level2 = this.getEMA([EMAlevels.level1], prevEMAlevel2, SMA)[1]; EMAlevel2values.push(EMAlevels.level2); } EMAlevels.level1 = EMAvalues[i - period - 2]; EMAlevels.level2 = EMAlevel2values[i - 2 * period - 1]; EMAlevels.level3 = this.getEMA([EMAlevels.level2], EMAlevels.prevLevel3, SMA)[1]; TEMAPoint = this.getTemaPoint(xVal, tripledPeriod, EMAlevels, i); // Make sure that point exists (for TRIX oscillator) if (TEMAPoint) { TEMA.push(TEMAPoint); xDataTema.push(TEMAPoint[0]); yDataTema.push(TEMAPoint[1]); } EMAlevels.prevLevel3 = EMAlevels.level3; } } } return { values: TEMA, xData: xDataTema, yData: yDataTema }; }; /** * Triple exponential moving average (TEMA) indicator. This series requires * `linkedTo` option to be set and should be loaded after the * `stock/indicators/indicators.js` and `stock/indicators/ema.js`. * * @sample {highstock} stock/indicators/tema * TEMA indicator * * @extends plotOptions.ema * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, * stacking * @requires stock/indicators/indicators * @requires stock/indicators/ema * @requires stock/indicators/tema * @optionparent plotOptions.tema */ TEMAIndicator.defaultOptions = merge(EMAIndicator.defaultOptions); return TEMAIndicator; }(EMAIndicator)); SeriesRegistry.registerSeriesType('tema', TEMAIndicator); /* * * * Default Export * * */ /** * A `TEMA` series. If the [type](#series.tema.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.tema * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, dataParser, dataURL, * joinBy, keys, navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/ema * @requires stock/indicators/tema * @apioption series.tema */ ''; // to include the above in the js output return TEMAIndicator; }); _registerModule(_modules, 'Stock/Indicators/TRIX/TRIXIndicator.js', [_modules['Mixins/IndicatorRequired.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (RequiredIndicatorMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var TEMAIndicator = SeriesRegistry.seriesTypes.tema; var correctFloat = U.correctFloat, merge = U.merge; /** * The TRIX series type. * * @private * @class * @name Highcharts.seriesTypes.trix * * @augments Highcharts.Series */ var TRIXIndicator = /** @class */ (function (_super) { __extends(TRIXIndicator, _super); function TRIXIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } TRIXIndicator.prototype.init = function () { var args = arguments, ctx = this; RequiredIndicatorMixin.isParentLoaded(SeriesRegistry.seriesTypes.tema, 'tema', ctx.type, function (indicator) { indicator.prototype.init.apply(ctx, args); return; }); }; // TRIX is calculated using TEMA so we just extend getTemaPoint method. TRIXIndicator.prototype.getTemaPoint = function (xVal, tripledPeriod, EMAlevels, i) { if (i > tripledPeriod) { return [ xVal[i - 3], EMAlevels.prevLevel3 !== 0 ? correctFloat(EMAlevels.level3 - EMAlevels.prevLevel3) / EMAlevels.prevLevel3 * 100 : null ]; } }; /** * Triple exponential average (TRIX) oscillator. This series requires * `linkedTo` option to be set. * * Requires https://code.highcharts.com/stock/indicators/ema.js * and https://code.highcharts.com/stock/indicators/tema.js. * * @sample {highstock} stock/indicators/trix * TRIX indicator * * @extends plotOptions.tema * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, * stacking * @optionparent plotOptions.trix */ TRIXIndicator.defaultOptions = merge(TEMAIndicator.defaultOptions); return TRIXIndicator; }(TEMAIndicator)); SeriesRegistry.registerSeriesType('trix', TRIXIndicator); /* * * * Default Export * * */ /** * A `TRIX` series. If the [type](#series.trix.type) option is not specified, it * is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.trix * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, dataParser, dataURL, * joinBy, keys, navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @apioption series.trix */ ''; // to include the above in the js output return TRIXIndicator; }); _registerModule(_modules, 'Stock/Indicators/APO/APOIndicator.js', [_modules['Mixins/IndicatorRequired.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (RequiredIndicatorMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var EMAIndicator = SeriesRegistry.seriesTypes.ema; var extend = U.extend, merge = U.merge, error = U.error; /* * * * Class * * */ /** * The APO series type. * * @private * @class * @name Highcharts.seriesTypes.apo * * @augments Highcharts.Series */ var APOIndicator = /** @class */ (function (_super) { __extends(APOIndicator, _super); function APOIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ APOIndicator.prototype.getValues = function (series, params) { var periods = params.periods, index = params.index, // 0- date, 1- Absolute price oscillator APO = [], xData = [], yData = [], periodsOffset, // Shorter Period EMA SPE, // Longer Period EMA LPE, oscillator, i; // Check if periods are correct if (periods.length !== 2 || periods[1] <= periods[0]) { error('Error: "APO requires two periods. Notice, first period ' + 'should be lower than the second one."'); return; } SPE = EMAIndicator.prototype.getValues.call(this, series, { index: index, period: periods[0] }); LPE = EMAIndicator.prototype.getValues.call(this, series, { index: index, period: periods[1] }); // Check if ema is calculated properly, if not skip if (!SPE || !LPE) { return; } periodsOffset = periods[1] - periods[0]; for (i = 0; i < LPE.yData.length; i++) { oscillator = (SPE.yData[i + periodsOffset] - LPE.yData[i]); APO.push([LPE.xData[i], oscillator]); xData.push(LPE.xData[i]); yData.push(oscillator); } return { values: APO, xData: xData, yData: yData }; }; APOIndicator.prototype.init = function () { var args = arguments, ctx = this; RequiredIndicatorMixin.isParentLoaded(EMAIndicator, 'ema', ctx.type, function (indicator) { indicator.prototype.init.apply(ctx, args); return; }); }; /** * Absolute Price Oscillator. This series requires the `linkedTo` option to * be set and should be loaded after the `stock/indicators/indicators.js` * and `stock/indicators/ema.js`. * * @sample {highstock} stock/indicators/apo * Absolute Price Oscillator * * @extends plotOptions.ema * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, joinBy, keys, navigatorOptions, * pointInterval, pointIntervalUnit, pointPlacement, * pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/ema * @requires stock/indicators/apo * @optionparent plotOptions.apo */ APOIndicator.defaultOptions = merge(EMAIndicator.defaultOptions, { /** * Paramters used in calculation of Absolute Price Oscillator * series points. * * @excluding period */ params: { period: void 0, /** * Periods for Absolute Price Oscillator calculations. * * @type {Array<number>} * @default [10, 20] * @since 7.0.0 */ periods: [10, 20] } }); return APOIndicator; }(EMAIndicator)); extend(APOIndicator.prototype, { nameBase: 'APO', nameComponents: ['periods'] }); SeriesRegistry.registerSeriesType('apo', APOIndicator); /* * * * Default Export * * */ /** * An `Absolute Price Oscillator` series. If the [type](#series.apo.type) option * is not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.apo * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, dataParser, dataURL, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/ema * @requires stock/indicators/apo * @apioption series.apo */ ''; // to include the above in the js output return APOIndicator; }); _registerModule(_modules, 'Stock/Indicators/IKH/IKHIndicator.js', [_modules['Core/Color/Color.js'], _modules['Core/Globals.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (Color, H, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var color = Color.parse; var SMAIndicator = SeriesRegistry.seriesTypes.sma; var defined = U.defined, extend = U.extend, isArray = U.isArray, isNumber = U.isNumber, merge = U.merge, objectEach = U.objectEach; /* eslint-disable require-jsdoc */ // Utils: function maxHigh(arr) { return arr.reduce(function (max, res) { return Math.max(max, res[1]); }, -Infinity); } function minLow(arr) { return arr.reduce(function (min, res) { return Math.min(min, res[2]); }, Infinity); } function highlowLevel(arr) { return { high: maxHigh(arr), low: minLow(arr) }; } function getClosestPointRange(axis) { var closestDataRange, loopLength, distance, xData, i; axis.series.forEach(function (series) { if (series.xData) { xData = series.xData; loopLength = series.xIncrement ? 1 : xData.length - 1; for (i = loopLength; i > 0; i--) { distance = xData[i] - xData[i - 1]; if (typeof closestDataRange === 'undefined' || distance < closestDataRange) { closestDataRange = distance; } } } }); return closestDataRange; } // Check two lines intersection (line a1-a2 and b1-b2) // Source: https://en.wikipedia.org/wiki/Line%E2%80%93line_intersection function checkLineIntersection(a1, a2, b1, b2) { if (a1 && a2 && b1 && b2) { var saX = a2.plotX - a1.plotX, // Auxiliary section a2-a1 X saY = a2.plotY - a1.plotY, // Auxiliary section a2-a1 Y sbX = b2.plotX - b1.plotX, // Auxiliary section b2-b1 X sbY = b2.plotY - b1.plotY, // Auxiliary section b2-b1 Y sabX = a1.plotX - b1.plotX, // Auxiliary section a1-b1 X sabY = a1.plotY - b1.plotY, // Auxiliary section a1-b1 Y // First degree Bézier parameters u = void 0, t = void 0; u = (-saY * sabX + saX * sabY) / (-sbX * saY + saX * sbY); t = (sbX * sabY - sbY * sabX) / (-sbX * saY + saX * sbY); if (u >= 0 && u <= 1 && t >= 0 && t <= 1) { return { plotX: a1.plotX + t * saX, plotY: a1.plotY + t * saY }; } } return false; } // Parameter opt (indicator options object) include indicator, points, // nextPoints, color, options, gappedExtend and graph properties function drawSenkouSpan(opt) { var indicator = opt.indicator; indicator.points = opt.points; indicator.nextPoints = opt.nextPoints; indicator.color = opt.color; indicator.options = merge(opt.options.senkouSpan.styles, opt.gap); indicator.graph = opt.graph; indicator.fillGraph = true; SeriesRegistry.seriesTypes.sma.prototype.drawGraph.call(indicator); } // Data integrity in Ichimoku is different than default 'averages': // Point: [undefined, value, value, ...] is correct // Point: [undefined, undefined, undefined, ...] is incorrect H.approximations['ichimoku-averages'] = function () { var ret = [], isEmptyRange; [].forEach.call(arguments, function (arr, i) { ret.push(H.approximations.average(arr)); isEmptyRange = !isEmptyRange && typeof ret[i] === 'undefined'; }); // Return undefined when first elem. is undefined and let // sum method handle null (#7377) return isEmptyRange ? void 0 : ret; }; /* eslint-enable require-jsdoc */ /** * The IKH series type. * * @private * @class * @name Highcharts.seriesTypes.ikh * * @augments Highcharts.Series */ /* * * * Class * * */ var IKHIndicator = /** @class */ (function (_super) { __extends(IKHIndicator, _super); function IKHIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; _this.graphCollection = void 0; _this.graphsenkouSpan = void 0; _this.ikhMap = void 0; _this.nextPoints = void 0; return _this; } /* * * * Functions * * */ IKHIndicator.prototype.init = function () { SeriesRegistry.seriesTypes.sma.prototype.init.apply(this, arguments); // Set default color for lines: this.options = merge({ tenkanLine: { styles: { lineColor: this.color } }, kijunLine: { styles: { lineColor: this.color } }, chikouLine: { styles: { lineColor: this.color } }, senkouSpanA: { styles: { lineColor: this.color, fill: color(this.color).setOpacity(0.5).get() } }, senkouSpanB: { styles: { lineColor: this.color, fill: color(this.color).setOpacity(0.5).get() } }, senkouSpan: { styles: { fill: color(this.color).setOpacity(0.2).get() } } }, this.options); }; IKHIndicator.prototype.toYData = function (point) { return [ point.tenkanSen, point.kijunSen, point.chikouSpan, point.senkouSpanA, point.senkouSpanB ]; }; IKHIndicator.prototype.translate = function () { var indicator = this; SeriesRegistry.seriesTypes.sma.prototype.translate.apply(indicator); indicator.points.forEach(function (point) { indicator.pointArrayMap.forEach(function (key) { var pointValue = point[key]; if (isNumber(pointValue)) { point['plot' + key] = indicator.yAxis.toPixels(pointValue, true); // Add extra parameters for support tooltip in moved // lines point.plotY = point['plot' + key]; point.tooltipPos = [ point.plotX, point['plot' + key] ]; point.isNull = false; } }); }); }; IKHIndicator.prototype.drawGraph = function () { var indicator = this, mainLinePoints = indicator.points, pointsLength = mainLinePoints.length, mainLineOptions = indicator.options, mainLinePath = indicator.graph, mainColor = indicator.color, gappedExtend = { options: { gapSize: mainLineOptions.gapSize } }, pointArrayMapLength = indicator.pointArrayMap.length, allIchimokuPoints = [ [], [], [], [], [], [] ], ikhMap = { tenkanLine: allIchimokuPoints[0], kijunLine: allIchimokuPoints[1], chikouLine: allIchimokuPoints[2], senkouSpanA: allIchimokuPoints[3], senkouSpanB: allIchimokuPoints[4], senkouSpan: allIchimokuPoints[5] }, intersectIndexColl = [], senkouSpanOptions = indicator .options.senkouSpan, color = senkouSpanOptions.color || senkouSpanOptions.styles.fill, negativeColor = senkouSpanOptions.negativeColor, // Points to create color and negativeColor senkouSpan points = [ [], [] // Points negative color ], // For span, we need an access to the next points, used in // getGraphPath() nextPoints = [ [], [] // NextPoints negative color ], lineIndex = 0, position, point, i, startIntersect, endIntersect, sectionPoints, sectionNextPoints, pointsPlotYSum, nextPointsPlotYSum, senkouSpanTempColor, concatArrIndex, j, k; indicator.ikhMap = ikhMap; // Generate points for all lines and spans lines: while (pointsLength--) { point = mainLinePoints[pointsLength]; for (i = 0; i < pointArrayMapLength; i++) { position = indicator.pointArrayMap[i]; if (defined(point[position])) { allIchimokuPoints[i].push({ plotX: point.plotX, plotY: point['plot' + position], isNull: false }); } } if (negativeColor && pointsLength !== mainLinePoints.length - 1) { // Check if lines intersect var index = ikhMap.senkouSpanB.length - 1, intersect = checkLineIntersection(ikhMap.senkouSpanA[index - 1], ikhMap.senkouSpanA[index], ikhMap.senkouSpanB[index - 1], ikhMap.senkouSpanB[index]), intersectPointObj = { plotX: intersect.plotX, plotY: intersect.plotY, isNull: false, intersectPoint: true }; if (intersect) { // Add intersect point to ichimoku points collection // Create senkouSpan sections ikhMap.senkouSpanA.splice(index, 0, intersectPointObj); ikhMap.senkouSpanB.splice(index, 0, intersectPointObj); intersectIndexColl.push(index); } } } // Modify options and generate lines: objectEach(ikhMap, function (values, lineName) { if (mainLineOptions[lineName] && lineName !== 'senkouSpan') { // First line is rendered by default option indicator.points = allIchimokuPoints[lineIndex]; indicator.options = merge(mainLineOptions[lineName].styles, gappedExtend); indicator.graph = indicator['graph' + lineName]; indicator.fillGraph = false; indicator.color = mainColor; SeriesRegistry.seriesTypes.sma.prototype.drawGraph.call(indicator); // Now save line indicator['graph' + lineName] = indicator.graph; } lineIndex++; }); // Generate senkouSpan area: // If graphColection exist then remove svg // element and indicator property if (indicator.graphCollection) { indicator.graphCollection.forEach(function (graphName) { indicator[graphName].destroy(); delete indicator[graphName]; }); } // Clean grapCollection or initialize it indicator.graphCollection = []; // When user set negativeColor property if (negativeColor && ikhMap.senkouSpanA[0] && ikhMap.senkouSpanB[0]) { // Add first and last point to senkouSpan area sections intersectIndexColl.unshift(0); intersectIndexColl.push(ikhMap.senkouSpanA.length - 1); // Populate points and nextPoints arrays for (j = 0; j < intersectIndexColl.length - 1; j++) { startIntersect = intersectIndexColl[j]; endIntersect = intersectIndexColl[j + 1]; sectionPoints = ikhMap.senkouSpanB.slice(startIntersect, endIntersect + 1); sectionNextPoints = ikhMap.senkouSpanA.slice(startIntersect, endIntersect + 1); // Add points to color or negativeColor arrays // Check the middle point (if exist) if (Math.floor(sectionPoints.length / 2) >= 1) { var x = Math.floor(sectionPoints.length / 2); // When middle points has equal values // Compare all ponints plotY value sum if (sectionPoints[x].plotY === sectionNextPoints[x].plotY) { pointsPlotYSum = 0; nextPointsPlotYSum = 0; for (k = 0; k < sectionPoints.length; k++) { pointsPlotYSum += sectionPoints[k].plotY; nextPointsPlotYSum += sectionNextPoints[k].plotY; } concatArrIndex = pointsPlotYSum > nextPointsPlotYSum ? 0 : 1; points[concatArrIndex] = points[concatArrIndex].concat(sectionPoints); nextPoints[concatArrIndex] = nextPoints[concatArrIndex].concat(sectionNextPoints); } else { // Compare middle point of the section concatArrIndex = sectionPoints[x].plotY > sectionNextPoints[x].plotY ? 0 : 1; points[concatArrIndex] = points[concatArrIndex].concat(sectionPoints); nextPoints[concatArrIndex] = nextPoints[concatArrIndex].concat(sectionNextPoints); } } else { // Compare first point of the section concatArrIndex = sectionPoints[0].plotY > sectionNextPoints[0].plotY ? 0 : 1; points[concatArrIndex] = points[concatArrIndex].concat(sectionPoints); nextPoints[concatArrIndex] = nextPoints[concatArrIndex].concat(sectionNextPoints); } } // Render color and negativeColor paths ['graphsenkouSpanColor', 'graphsenkouSpanNegativeColor'].forEach(function (areaName, i) { if (points[i].length && nextPoints[i].length) { senkouSpanTempColor = i === 0 ? color : negativeColor; drawSenkouSpan({ indicator: indicator, points: points[i], nextPoints: nextPoints[i], color: senkouSpanTempColor, options: mainLineOptions, gap: gappedExtend, graph: indicator[areaName] }); // Now save line indicator[areaName] = indicator.graph; indicator.graphCollection.push(areaName); } }); } else { // When user set only senkouSpan style.fill property drawSenkouSpan({ indicator: indicator, points: ikhMap.senkouSpanB, nextPoints: ikhMap.senkouSpanA, color: color, options: mainLineOptions, gap: gappedExtend, graph: indicator.graphsenkouSpan }); // Now save line indicator.graphsenkouSpan = indicator.graph; } // Clean temporary properties: delete indicator.nextPoints; delete indicator.fillGraph; // Restore options and draw the Tenkan line: indicator.points = mainLinePoints; indicator.options = mainLineOptions; indicator.graph = mainLinePath; indicator.color = mainColor; }; IKHIndicator.prototype.getGraphPath = function (points) { var indicator = this, path = [], spanA, spanAarr = []; points = points || this.points; // Render Senkou Span if (indicator.fillGraph && indicator.nextPoints) { spanA = SeriesRegistry.seriesTypes.sma.prototype.getGraphPath.call(indicator, // Reverse points, so Senkou Span A will start from the end: indicator.nextPoints); if (spanA && spanA.length) { spanA[0][0] = 'L'; path = SeriesRegistry.seriesTypes.sma.prototype.getGraphPath.call(indicator, points); spanAarr = spanA.slice(0, path.length); for (var i = spanAarr.length - 1; i >= 0; i--) { path.push(spanAarr[i]); } } } else { path = SeriesRegistry.seriesTypes.sma.prototype.getGraphPath.apply(indicator, arguments); } return path; }; IKHIndicator.prototype.getValues = function (series, params) { var period = params.period, periodTenkan = params.periodTenkan, periodSenkouSpanB = params.periodSenkouSpanB, xVal = series.xData, yVal = series.yData, xAxis = series.xAxis, yValLen = (yVal && yVal.length) || 0, closestPointRange = getClosestPointRange(xAxis), IKH = [], xData = [], dateStart, date, slicedTSY, slicedKSY, slicedSSBY, pointTS, pointKS, pointSSB, i, TS, KS, CS, SSA, SSB; // Ikh requires close value if (xVal.length <= period || !isArray(yVal[0]) || yVal[0].length !== 4) { return; } // Add timestamps at the beginning dateStart = xVal[0] - period * closestPointRange; for (i = 0; i < period; i++) { xData.push(dateStart + i * closestPointRange); } for (i = 0; i < yValLen; i++) { // Tenkan Sen if (i >= periodTenkan) { slicedTSY = yVal.slice(i - periodTenkan, i); pointTS = highlowLevel(slicedTSY); TS = (pointTS.high + pointTS.low) / 2; } if (i >= period) { slicedKSY = yVal.slice(i - period, i); pointKS = highlowLevel(slicedKSY); KS = (pointKS.high + pointKS.low) / 2; SSA = (TS + KS) / 2; } if (i >= periodSenkouSpanB) { slicedSSBY = yVal.slice(i - periodSenkouSpanB, i); pointSSB = highlowLevel(slicedSSBY); SSB = (pointSSB.high + pointSSB.low) / 2; } CS = yVal[i][3]; date = xVal[i]; if (typeof IKH[i] === 'undefined') { IKH[i] = []; } if (typeof IKH[i + period] === 'undefined') { IKH[i + period] = []; } IKH[i + period][0] = TS; IKH[i + period][1] = KS; IKH[i + period][2] = void 0; IKH[i][2] = CS; if (i <= period) { IKH[i + period][3] = void 0; IKH[i + period][4] = void 0; } if (typeof IKH[i + 2 * period] === 'undefined') { IKH[i + 2 * period] = []; } IKH[i + 2 * period][3] = SSA; IKH[i + 2 * period][4] = SSB; xData.push(date); } // Add timestamps for further points for (i = 1; i <= period; i++) { xData.push(date + i * closestPointRange); } return { values: IKH, xData: xData, yData: IKH }; }; /** * Ichimoku Kinko Hyo (IKH). This series requires `linkedTo` option to be * set. * * @sample stock/indicators/ichimoku-kinko-hyo * Ichimoku Kinko Hyo indicator * * @extends plotOptions.sma * @since 6.0.0 * @excluding allAreas, colorAxis, compare, compareBase, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, * stacking * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/ichimoku-kinko-hyo * @optionparent plotOptions.ikh */ IKHIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index */ params: { index: void 0, period: 26, /** * The base period for Tenkan calculations. */ periodTenkan: 9, /** * The base period for Senkou Span B calculations */ periodSenkouSpanB: 52 }, marker: { enabled: false }, tooltip: { pointFormat: '<span style="color:{point.color}">\u25CF</span> <b> {series.name}</b><br/>' + 'TENKAN SEN: {point.tenkanSen:.3f}<br/>' + 'KIJUN SEN: {point.kijunSen:.3f}<br/>' + 'CHIKOU SPAN: {point.chikouSpan:.3f}<br/>' + 'SENKOU SPAN A: {point.senkouSpanA:.3f}<br/>' + 'SENKOU SPAN B: {point.senkouSpanB:.3f}<br/>' }, /** * The styles for Tenkan line */ tenkanLine: { styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. * * @type {Highcharts.ColorString} */ lineColor: void 0 } }, /** * The styles for Kijun line */ kijunLine: { styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. * * @type {Highcharts.ColorString} */ lineColor: void 0 } }, /** * The styles for Chikou line */ chikouLine: { styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. * * @type {Highcharts.ColorString} */ lineColor: void 0 } }, /** * The styles for Senkou Span A line */ senkouSpanA: { styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. * * @type {Highcharts.ColorString} */ lineColor: void 0 } }, /** * The styles for Senkou Span B line */ senkouSpanB: { styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. * * @type {Highcharts.ColorString} */ lineColor: void 0 } }, /** * The styles for area between Senkou Span A and B. */ senkouSpan: { /** * Color of the area between Senkou Span A and B, * when Senkou Span A is above Senkou Span B. Note that if * a `style.fill` is defined, the `color` takes precedence and * the `style.fill` is ignored. * * @see [senkouSpan.styles.fill](#series.ikh.senkouSpan.styles.fill) * * @sample stock/indicators/ichimoku-kinko-hyo * Ichimoku Kinko Hyo color * * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} * @since 7.0.0 * @apioption plotOptions.ikh.senkouSpan.color */ /** * Color of the area between Senkou Span A and B, * when Senkou Span A is under Senkou Span B. * * @sample stock/indicators/ikh-negative-color * Ichimoku Kinko Hyo negativeColor * * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} * @since 7.0.0 * @apioption plotOptions.ikh.senkouSpan.negativeColor */ styles: { /** * Color of the area between Senkou Span A and B. * * @deprecated * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} */ fill: 'rgba(255, 0, 0, 0.5)' } }, dataGrouping: { approximation: 'ichimoku-averages' } }); return IKHIndicator; }(SMAIndicator)); extend(IKHIndicator.prototype, { pointArrayMap: [ 'tenkanSen', 'kijunSen', 'chikouSpan', 'senkouSpanA', 'senkouSpanB' ], pointValKey: 'tenkanSen', nameComponents: ['periodSenkouSpanB', 'period', 'periodTenkan'] }); SeriesRegistry.registerSeriesType('ikh', IKHIndicator); /** * A `IKH` series. If the [type](#series.ikh.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.ikh * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/ichimoku-kinko-hyo * @apioption series.ikh */ (''); // add doclet above to transpiled file return IKHIndicator; }); _registerModule(_modules, 'Stock/Indicators/KeltnerChannels/KeltnerChannelsIndicator.js', [_modules['Mixins/MultipleLines.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (MultipleLinesMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var _a = SeriesRegistry.seriesTypes, SMAIndicator = _a.sma, EMAIndicator = _a.ema, ATRIndicator = _a.atr; var correctFloat = U.correctFloat, extend = U.extend, merge = U.merge; /** * The Keltner Channels series type. * * @private * @class * @name Highcharts.seriesTypes.keltnerchannels * * @augments Highcharts.Series */ var KeltnerChannelsIndicator = /** @class */ (function (_super) { __extends(KeltnerChannelsIndicator, _super); function KeltnerChannelsIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } KeltnerChannelsIndicator.prototype.init = function () { SeriesRegistry.seriesTypes.sma.prototype.init.apply(this, arguments); // Set default color for lines: this.options = merge({ topLine: { styles: { lineColor: this.color } }, bottomLine: { styles: { lineColor: this.color } } }, this.options); }; KeltnerChannelsIndicator.prototype.getValues = function (series, params) { var period = params.period, periodATR = params.periodATR, multiplierATR = params.multiplierATR, index = params.index, yVal = series.yData, yValLen = yVal ? yVal.length : 0, // Keltner Channels array structure: // 0-date, 1-top line, 2-middle line, 3-bottom line KC = [], // middle line, top line and bottom lineI ML, TL, BL, date, seriesEMA = SeriesRegistry.seriesTypes.ema.prototype.getValues(series, { period: period, index: index }), seriesATR = SeriesRegistry.seriesTypes.atr.prototype.getValues(series, { period: periodATR }), pointEMA, pointATR, xData = [], yData = [], i; if (yValLen < period) { return; } for (i = period; i <= yValLen; i++) { pointEMA = seriesEMA.values[i - period]; pointATR = seriesATR.values[i - periodATR]; date = pointEMA[0]; TL = correctFloat(pointEMA[1] + (multiplierATR * pointATR[1])); BL = correctFloat(pointEMA[1] - (multiplierATR * pointATR[1])); ML = pointEMA[1]; KC.push([date, TL, ML, BL]); xData.push(date); yData.push([TL, ML, BL]); } return { values: KC, xData: xData, yData: yData }; }; /** * Keltner Channels. This series requires the `linkedTo` option to be set * and should be loaded after the `stock/indicators/indicators.js`, * `stock/indicators/atr.js`, and `stock/ema/.js`. * * @sample {highstock} stock/indicators/keltner-channels * Keltner Channels * * @extends plotOptions.sma * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart,showInNavigator, * stacking * @requires stock/indicators/indicators * @requires stock/indicators/keltner-channels * @optionparent plotOptions.keltnerchannels */ KeltnerChannelsIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { period: 20, /** * The ATR period. */ periodATR: 10, /** * The ATR multiplier. */ multiplierATR: 2 }, /** * Bottom line options. * */ bottomLine: { /** * Styles for a bottom line. * */ styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. If not set, it's inherited from * `plotOptions.keltnerchannels.color` */ lineColor: void 0 } }, /** * Top line options. * * @extends plotOptions.keltnerchannels.bottomLine */ topLine: { styles: { lineWidth: 1, lineColor: void 0 } }, tooltip: { pointFormat: '<span style="color:{point.color}">\u25CF</span><b> {series.name}</b><br/>Upper Channel: {point.top}<br/>EMA({series.options.params.period}): {point.middle}<br/>Lower Channel: {point.bottom}<br/>' }, marker: { enabled: false }, dataGrouping: { approximation: 'averages' }, lineWidth: 1 }); return KeltnerChannelsIndicator; }(SMAIndicator)); extend(KeltnerChannelsIndicator.prototype, { pointArrayMap: ['top', 'middle', 'bottom'], pointValKey: 'middle', nameBase: 'Keltner Channels', nameComponents: ['period', 'periodATR', 'multiplierATR'], linesApiNames: ['topLine', 'bottomLine'], requiredIndicators: ['ema', 'atr'], drawGraph: MultipleLinesMixin.drawGraph, getTranslatedLinesNames: MultipleLinesMixin.getTranslatedLinesNames, translate: MultipleLinesMixin.translate, toYData: MultipleLinesMixin.toYData }); SeriesRegistry.registerSeriesType('keltnerchannels', KeltnerChannelsIndicator); /* * * * Default Export * * */ /** * A Keltner Channels indicator. If the [type](#series.keltnerchannels.type) * option is not specified, it is inherited from[chart.type](#chart.type). * * @extends series,plotOptions.keltnerchannels * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, dataParser, dataURL, * joinBy, keys, navigatorOptions, pointInterval, * pointIntervalUnit, pointPlacement, pointRange, pointStart, * stacking, showInNavigator * @requires stock/indicators/indicators * @requires stock/indicators/keltner-channels * @apioption series.keltnerchannels */ ''; // to include the above in the js output return KeltnerChannelsIndicator; }); _registerModule(_modules, 'Stock/Indicators/Klinger/KlingerIndicator.js', [_modules['Mixins/IndicatorRequired.js'], _modules['Mixins/MultipleLines.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (RequiredIndicatorMixin, MultipleLinesMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var _a = SeriesRegistry.seriesTypes, SMAIndicator = _a.sma, EMAIndicator = _a.ema; var correctFloat = U.correctFloat, error = U.error, extend = U.extend, isArray = U.isArray, merge = U.merge; /** * The Klinger oscillator series type. * * @private * @class * @name Highcharts.seriesTypes.klinger * * @augments Highcharts.Series */ var KlingerIndicator = /** @class */ (function (_super) { __extends(KlingerIndicator, _super); function KlingerIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.points = void 0; _this.options = void 0; _this.volumeSeries = void 0; return _this; } /* * * * Functions * * */ KlingerIndicator.prototype.init = function () { var args = arguments, ctx = this; // Check if the EMA module is added. RequiredIndicatorMixin.isParentLoaded(EMAIndicator, 'ema', ctx.type, function (indicator) { indicator.prototype.init.apply(ctx, args); return; }); }; KlingerIndicator.prototype.calculateTrend = function (yVal, i) { var isUpward = yVal[i][1] + yVal[i][2] + yVal[i][3] > yVal[i - 1][1] + yVal[i - 1][2] + yVal[i - 1][3]; return isUpward ? 1 : -1; }; // Checks if the series and volumeSeries are accessible, number of // points.x is longer than period, is series has OHLC data KlingerIndicator.prototype.isValidData = function (firstYVal) { var chart = this.chart, options = this.options, series = this.linkedParent, isSeriesOHLC = isArray(firstYVal) && firstYVal.length === 4, volumeSeries = this.volumeSeries || (this.volumeSeries = chart.get(options.params.volumeSeriesID)); if (!volumeSeries) { error('Series ' + options.params.volumeSeriesID + ' not found! Check `volumeSeriesID`.', true, series.chart); } var isLengthValid = [series, volumeSeries].every(function (series) { return series && series.xData && series.xData.length >= options.params.slowAvgPeriod; }); return !!(isLengthValid && isSeriesOHLC); }; KlingerIndicator.prototype.getCM = function (previousCM, DM, trend, previousTrend, prevoiusDM) { return correctFloat(DM + (trend === previousTrend ? previousCM : prevoiusDM)); }; KlingerIndicator.prototype.getDM = function (high, low) { return correctFloat(high - low); }; KlingerIndicator.prototype.getVolumeForce = function (yVal) { var volumeForce = []; var CM = 0, // cumulative measurement DM, // daily measurement force, i = 1, // start from second point previousCM = 0, previousDM = yVal[0][1] - yVal[0][2], // initial DM previousTrend = 0, trend; for (i; i < yVal.length; i++) { trend = this.calculateTrend(yVal, i); DM = this.getDM(yVal[i][1], yVal[i][2]); // For the first iteration when the previousTrend doesn't exist, // previousCM doesn't exist either, but it doesn't matter becouse // it's filltered out in the getCM method in else statement, // (in this iteration, previousCM can be raplaced with the DM). CM = this.getCM(previousCM, DM, trend, previousTrend, previousDM); force = this.volumeSeries.yData[i] * trend * Math.abs(2 * ((DM / CM) - 1)) * 100; volumeForce.push([force]); // Before next iteration, assign the current as the previous. previousTrend = trend; previousCM = CM; previousDM = DM; } return volumeForce; }; KlingerIndicator.prototype.getEMA = function (yVal, prevEMA, SMA, EMApercent, index, i, xVal) { return EMAIndicator.prototype.calculateEma(xVal || [], yVal, typeof i === 'undefined' ? 1 : i, EMApercent, prevEMA, typeof index === 'undefined' ? -1 : index, SMA); }; KlingerIndicator.prototype.getSMA = function (period, index, values) { return EMAIndicator.prototype .accumulatePeriodPoints(period, index, values) / period; }; KlingerIndicator.prototype.getValues = function (series, params) { var Klinger = [], xVal = series.xData, yVal = series.yData, xData = [], yData = [], calcSingal = []; var KO, i = 0, fastEMA = 0, slowEMA, // signalEMA: number|undefined = void 0, previousFastEMA = void 0, previousSlowEMA = void 0, signal = null; // If the necessary conditions are not fulfilled, don't proceed. if (!this.isValidData(yVal[0])) { return; } // Calculate the Volume Force array. var volumeForce = this.getVolumeForce(yVal); // Calculate SMA for the first points. var SMAFast = this.getSMA(params.fastAvgPeriod, 0, volumeForce), SMASlow = this.getSMA(params.slowAvgPeriod, 0, volumeForce); // Calculate EMApercent for the first points. var fastEMApercent = 2 / (params.fastAvgPeriod + 1), slowEMApercent = 2 / (params.slowAvgPeriod + 1); // Calculate KO for (i; i < yVal.length; i++) { // Get EMA for fast period. if (i >= params.fastAvgPeriod) { fastEMA = this.getEMA(volumeForce, previousFastEMA, SMAFast, fastEMApercent, 0, i, xVal)[1]; previousFastEMA = fastEMA; } // Get EMA for slow period. if (i >= params.slowAvgPeriod) { slowEMA = this.getEMA(volumeForce, previousSlowEMA, SMASlow, slowEMApercent, 0, i, xVal)[1]; previousSlowEMA = slowEMA; KO = correctFloat(fastEMA - slowEMA); calcSingal.push(KO); // Calculate signal SMA if (calcSingal.length >= params.signalPeriod) { signal = calcSingal.slice(-params.signalPeriod) .reduce(function (prev, curr) { return prev + curr; }) / params.signalPeriod; } Klinger.push([xVal[i], KO, signal]); xData.push(xVal[i]); yData.push([KO, signal]); } } return { values: Klinger, xData: xData, yData: yData }; }; /** * Klinger oscillator. This series requires the `linkedTo` option to be set * and should be loaded after the `stock/indicators/indicators.js` file. * * @sample stock/indicators/klinger * Klinger oscillator * * @extends plotOptions.sma * @since 9.1.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/klinger * @optionparent plotOptions.klinger */ KlingerIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * Paramters used in calculation of Klinger Oscillator. * * @excluding index, period */ params: { /** * The fast period for indicator calculations. */ fastAvgPeriod: 34, /** * The slow period for indicator calculations. */ slowAvgPeriod: 55, /** * The base period for signal calculations. */ signalPeriod: 13, /** * The id of another series to use its data as volume data for the * indiator calculation. */ volumeSeriesID: 'volume' }, signalLine: { /** * Styles for a signal line. */ styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. If not set, it's inherited from * [plotOptions.klinger.color * ](#plotOptions.klinger.color). * * @type {Highcharts.ColorString} */ lineColor: '#ff0000' } }, dataGrouping: { approximation: 'averages' }, tooltip: { pointFormat: '<span style="color: {point.color}">\u25CF</span><b> {series.name}</b><br/>' + '<span style="color: {point.color}">Klinger</span>: {point.y}<br/>' + '<span style="color: {point.series.options.signalLine.styles.lineColor}">Signal</span>' + ': {point.signal}<br/>' } }); return KlingerIndicator; }(SMAIndicator)); extend(KlingerIndicator.prototype, { linesApiNames: ['signalLine'], nameBase: 'Klinger', nameComponents: ['fastAvgPeriod', 'slowAvgPeriod'], pointArrayMap: ['y', 'signal'], parallelArrays: ['x', 'y', 'signal'], pointValKey: 'y', drawGraph: MultipleLinesMixin.drawGraph, getTranslatedLinesNames: MultipleLinesMixin.getTranslatedLinesNames, translate: MultipleLinesMixin.translate, toYData: MultipleLinesMixin.toYData }); SeriesRegistry.registerSeriesType('klinger', KlingerIndicator); /* * * * Default Export * * */ /** * A Klinger oscillator. If the [type](#series.klinger.type) * option is not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.klinger * @since 9.1.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/ema * @requires stock/indicators/klinger * @apioption series.klinger */ ''; // to include the above in the js output return KlingerIndicator; }); _registerModule(_modules, 'Stock/Indicators/MACD/MACDIndicator.js', [_modules['Core/Globals.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (H, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var noop = H.noop; var _a = SeriesRegistry.seriesTypes, SMAIndicator = _a.sma, ColumnSeries = _a.column; var extend = U.extend, correctFloat = U.correctFloat, defined = U.defined, merge = U.merge; /** * * Class * */ /** * The MACD series type. * * @private * @class * @name Highcharts.seriesTypes.macd * * @augments Highcharts.Series */ var MACDIndicator = /** @class */ (function (_super) { __extends(MACDIndicator, _super); function MACDIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /** * * Properties * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; _this.currentLineZone = void 0; _this.graphmacd = void 0; _this.graphsignal = void 0; _this.macdZones = void 0; _this.signalZones = void 0; return _this; } /** * * Functions * */ MACDIndicator.prototype.init = function () { SeriesRegistry.seriesTypes.sma.prototype.init.apply(this, arguments); // Check whether series is initialized. It may be not initialized, // when any of required indicators is missing. if (this.options) { // Set default color for a signal line and the histogram: this.options = merge({ signalLine: { styles: { lineColor: this.color } }, macdLine: { styles: { color: this.color } } }, this.options); // Zones have indexes automatically calculated, we need to // translate them to support multiple lines within one indicator this.macdZones = { zones: this.options.macdLine.zones, startIndex: 0 }; this.signalZones = { zones: this.macdZones.zones.concat(this.options.signalLine.zones), startIndex: this.macdZones.zones.length }; this.resetZones = true; } }; MACDIndicator.prototype.toYData = function (point) { return [point.y, point.signal, point.MACD]; }; MACDIndicator.prototype.translate = function () { var indicator = this, plotNames = ['plotSignal', 'plotMACD']; H.seriesTypes.column.prototype.translate.apply(indicator); indicator.points.forEach(function (point) { [point.signal, point.MACD].forEach(function (value, i) { if (value !== null) { point[plotNames[i]] = indicator.yAxis.toPixels(value, true); } }); }); }; MACDIndicator.prototype.destroy = function () { // this.graph is null due to removing two times the same SVG element this.graph = null; this.graphmacd = this.graphmacd && this.graphmacd.destroy(); this.graphsignal = this.graphsignal && this.graphsignal.destroy(); SeriesRegistry.seriesTypes.sma.prototype.destroy.apply(this, arguments); }; MACDIndicator.prototype.drawGraph = function () { var indicator = this, mainLinePoints = indicator.points, pointsLength = mainLinePoints.length, mainLineOptions = indicator.options, histogramZones = indicator.zones, gappedExtend = { options: { gapSize: mainLineOptions.gapSize } }, otherSignals = [[], []], point; // Generate points for top and bottom lines: while (pointsLength--) { point = mainLinePoints[pointsLength]; if (defined(point.plotMACD)) { otherSignals[0].push({ plotX: point.plotX, plotY: point.plotMACD, isNull: !defined(point.plotMACD) }); } if (defined(point.plotSignal)) { otherSignals[1].push({ plotX: point.plotX, plotY: point.plotSignal, isNull: !defined(point.plotMACD) }); } } // Modify options and generate smoothing line: ['macd', 'signal'].forEach(function (lineName, i) { indicator.points = otherSignals[i]; indicator.options = merge(mainLineOptions[lineName + 'Line'].styles, gappedExtend); indicator.graph = indicator['graph' + lineName]; // Zones extension: indicator.currentLineZone = lineName + 'Zones'; indicator.zones = indicator[indicator.currentLineZone].zones; SeriesRegistry.seriesTypes.sma.prototype.drawGraph.call(indicator); indicator['graph' + lineName] = indicator.graph; }); // Restore options: indicator.points = mainLinePoints; indicator.options = mainLineOptions; indicator.zones = histogramZones; indicator.currentLineZone = null; // indicator.graph = null; }; MACDIndicator.prototype.getZonesGraphs = function (props) { var allZones = _super.prototype.getZonesGraphs.call(this, props), currentZones = allZones; if (this.currentLineZone) { currentZones = allZones.splice(this[this.currentLineZone].startIndex + 1); if (!currentZones.length) { // Line has no zones, return basic graph "zone" currentZones = [props[0]]; } else { // Add back basic prop: currentZones.splice(0, 0, props[0]); } } return currentZones; }; MACDIndicator.prototype.applyZones = function () { // Histogram zones are handled by drawPoints method // Here we need to apply zones for all lines var histogramZones = this.zones; // signalZones.zones contains all zones: this.zones = this.signalZones.zones; SeriesRegistry.seriesTypes.sma.prototype.applyZones.call(this); // applyZones hides only main series.graph, hide macd line manually if (this.graphmacd && this.options.macdLine.zones.length) { this.graphmacd.hide(); } this.zones = histogramZones; }; MACDIndicator.prototype.getValues = function (series, params) { var indexToShift = params.longPeriod - params.shortPeriod, // #14197 j = 0, MACD = [], xMACD = [], yMACD = [], signalLine = [], shortEMA, longEMA, i; if (series.xData.length < params.longPeriod + params.signalPeriod) { return; } // Calculating the short and long EMA used when calculating the MACD shortEMA = SeriesRegistry.seriesTypes.ema.prototype.getValues(series, { period: params.shortPeriod, index: params.index }); longEMA = SeriesRegistry.seriesTypes.ema.prototype.getValues(series, { period: params.longPeriod, index: params.index }); shortEMA = shortEMA.values; longEMA = longEMA.values; // Subtract each Y value from the EMA's and create the new dataset // (MACD) for (i = 0; i <= shortEMA.length; i++) { if (defined(longEMA[i]) && defined(longEMA[i][1]) && defined(shortEMA[i + indexToShift]) && defined(shortEMA[i + indexToShift][0])) { MACD.push([ shortEMA[i + indexToShift][0], 0, null, shortEMA[i + indexToShift][1] - longEMA[i][1] ]); } } // Set the Y and X data of the MACD. This is used in calculating the // signal line. for (i = 0; i < MACD.length; i++) { xMACD.push(MACD[i][0]); yMACD.push([0, null, MACD[i][3]]); } // Setting the signalline (Signal Line: X-day EMA of MACD line). signalLine = SeriesRegistry.seriesTypes.ema.prototype.getValues({ xData: xMACD, yData: yMACD }, { period: params.signalPeriod, index: 2 }); signalLine = signalLine.values; // Setting the MACD Histogram. In comparison to the loop with pure // MACD this loop uses MACD x value not xData. for (i = 0; i < MACD.length; i++) { // detect the first point if (MACD[i][0] >= signalLine[0][0]) { MACD[i][2] = signalLine[j][1]; yMACD[i] = [0, signalLine[j][1], MACD[i][3]]; if (MACD[i][3] === null) { MACD[i][1] = 0; yMACD[i][0] = 0; } else { MACD[i][1] = correctFloat(MACD[i][3] - signalLine[j][1]); yMACD[i][0] = correctFloat(MACD[i][3] - signalLine[j][1]); } j++; } } return { values: MACD, xData: xMACD, yData: yMACD }; }; /** * Moving Average Convergence Divergence (MACD). This series requires * `linkedTo` option to be set and should be loaded after the * `stock/indicators/indicators.js` and `stock/indicators/ema.js`. * * @sample stock/indicators/macd * MACD indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/macd * @optionparent plotOptions.macd */ MACDIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { /** * The short period for indicator calculations. */ shortPeriod: 12, /** * The long period for indicator calculations. */ longPeriod: 26, /** * The base period for signal calculations. */ signalPeriod: 9, period: 26 }, /** * The styles for signal line */ signalLine: { /** * @sample stock/indicators/macd-zones * Zones in MACD * * @extends plotOptions.macd.zones */ zones: [], styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. * * @type {Highcharts.ColorString} */ lineColor: void 0 } }, /** * The styles for macd line */ macdLine: { /** * @sample stock/indicators/macd-zones * Zones in MACD * * @extends plotOptions.macd.zones */ zones: [], styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. * * @type {Highcharts.ColorString} */ lineColor: void 0 } }, /** * @type {number|null} */ threshold: 0, groupPadding: 0.1, pointPadding: 0.1, crisp: false, states: { hover: { halo: { size: 0 } } }, tooltip: { pointFormat: '<span style="color:{point.color}">\u25CF</span> <b> {series.name}</b><br/>' + 'Value: {point.MACD}<br/>' + 'Signal: {point.signal}<br/>' + 'Histogram: {point.y}<br/>' }, dataGrouping: { approximation: 'averages' }, minPointLength: 0 }); return MACDIndicator; }(SMAIndicator)); extend(MACDIndicator.prototype, { nameComponents: ['longPeriod', 'shortPeriod', 'signalPeriod'], requiredIndicators: ['ema'], // "y" value is treated as Histogram data pointArrayMap: ['y', 'signal', 'MACD'], parallelArrays: ['x', 'y', 'signal', 'MACD'], pointValKey: 'y', // Columns support: markerAttribs: noop, getColumnMetrics: H.seriesTypes.column.prototype.getColumnMetrics, crispCol: H.seriesTypes.column.prototype.crispCol, drawPoints: H.seriesTypes.column.prototype.drawPoints }); SeriesRegistry.registerSeriesType('macd', MACDIndicator); /* * * * Default Export * * */ /** * A `MACD` series. If the [type](#series.macd.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.macd * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/macd * @apioption series.macd */ ''; // to include the above in the js output return MACDIndicator; }); _registerModule(_modules, 'Stock/Indicators/MFI/MFIIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * Money Flow Index indicator for Highcharts Stock * * (c) 2010-2021 Grzegorz Blachliński * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var extend = U.extend, merge = U.merge, error = U.error, isArray = U.isArray; /* eslint-disable require-jsdoc */ // Utils: function sumArray(array) { return array.reduce(function (prev, cur) { return prev + cur; }); } function toFixed(a, n) { return parseFloat(a.toFixed(n)); } function calculateTypicalPrice(point) { return (point[1] + point[2] + point[3]) / 3; } function calculateRawMoneyFlow(typicalPrice, volume) { return typicalPrice * volume; } /* eslint-enable require-jsdoc */ /* * * * Class * * */ /** * The MFI series type. * * @private * @class * @name Highcharts.seriesTypes.mfi * * @augments Highcharts.Series */ var MFIIndicator = /** @class */ (function (_super) { __extends(MFIIndicator, _super); function MFIIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ MFIIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, decimals = params.decimals, // MFI starts calculations from the second point // Cause we need to calculate change between two points range = 1, volumeSeries = series.chart.get(params.volumeSeriesID), yValVolume = (volumeSeries && volumeSeries.yData), MFI = [], isUp = false, xData = [], yData = [], positiveMoneyFlow = [], negativeMoneyFlow = [], newTypicalPrice, oldTypicalPrice, rawMoneyFlow, negativeMoneyFlowSum, positiveMoneyFlowSum, moneyFlowRatio, MFIPoint, i; if (!volumeSeries) { error('Series ' + params.volumeSeriesID + ' not found! Check `volumeSeriesID`.', true, series.chart); return; } // MFI requires high low and close values if ((xVal.length <= period) || !isArray(yVal[0]) || yVal[0].length !== 4 || !yValVolume) { return; } // Calculate first typical price newTypicalPrice = calculateTypicalPrice(yVal[range]); // Accumulate first N-points while (range < period + 1) { // Calculate if up or down oldTypicalPrice = newTypicalPrice; newTypicalPrice = calculateTypicalPrice(yVal[range]); isUp = newTypicalPrice >= oldTypicalPrice; // Calculate raw money flow rawMoneyFlow = calculateRawMoneyFlow(newTypicalPrice, yValVolume[range]); // Add to array positiveMoneyFlow.push(isUp ? rawMoneyFlow : 0); negativeMoneyFlow.push(isUp ? 0 : rawMoneyFlow); range++; } for (i = range - 1; i < yValLen; i++) { if (i > range - 1) { // Remove first point from array positiveMoneyFlow.shift(); negativeMoneyFlow.shift(); // Calculate if up or down oldTypicalPrice = newTypicalPrice; newTypicalPrice = calculateTypicalPrice(yVal[i]); isUp = newTypicalPrice > oldTypicalPrice; // Calculate raw money flow rawMoneyFlow = calculateRawMoneyFlow(newTypicalPrice, yValVolume[i]); // Add to array positiveMoneyFlow.push(isUp ? rawMoneyFlow : 0); negativeMoneyFlow.push(isUp ? 0 : rawMoneyFlow); } // Calculate sum of negative and positive money flow: negativeMoneyFlowSum = sumArray(negativeMoneyFlow); positiveMoneyFlowSum = sumArray(positiveMoneyFlow); moneyFlowRatio = positiveMoneyFlowSum / negativeMoneyFlowSum; MFIPoint = toFixed(100 - (100 / (1 + moneyFlowRatio)), decimals); MFI.push([xVal[i], MFIPoint]); xData.push(xVal[i]); yData.push(MFIPoint); } return { values: MFI, xData: xData, yData: yData }; }; /** * Money Flow Index. This series requires `linkedTo` option to be set and * should be loaded after the `stock/indicators/indicators.js` file. * * @sample stock/indicators/mfi * Money Flow Index Indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/mfi * @optionparent plotOptions.mfi */ MFIIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index */ params: { index: void 0, /** * The id of volume series which is mandatory. * For example using OHLC data, volumeSeriesID='volume' means * the indicator will be calculated using OHLC and volume values. */ volumeSeriesID: 'volume', /** * Number of maximum decimals that are used in MFI calculations. */ decimals: 4 } }); return MFIIndicator; }(SMAIndicator)); extend(MFIIndicator.prototype, { nameBase: 'Money Flow Index' }); SeriesRegistry.registerSeriesType('mfi', MFIIndicator); /* * * * Default Export * * */ /** * A `MFI` series. If the [type](#series.mfi.type) option is not specified, it * is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.mfi * @since 6.0.0 * @excluding dataParser, dataURL * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/mfi * @apioption series.mfi */ ''; // to include the above in the js output return MFIIndicator; }); _registerModule(_modules, 'Stock/Indicators/Momentum/MomentumIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var extend = U.extend, isArray = U.isArray, merge = U.merge; /* eslint-disable require-jsdoc */ function populateAverage(xVal, yVal, i, period, index) { var mmY = yVal[i - 1][index] - yVal[i - period - 1][index], mmX = xVal[i - 1]; return [mmX, mmY]; } /* eslint-enable require-jsdoc */ /** * The Momentum series type. * * @private * @class * @name Highcharts.seriesTypes.momentum * * @augments Highcharts.Series */ var MomentumIndicator = /** @class */ (function (_super) { __extends(MomentumIndicator, _super); function MomentumIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } MomentumIndicator.prototype.getValues = function (series, params) { var period = params.period, index = params.index, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, yValue = yVal[0], MM = [], xData = [], yData = [], i, MMPoint; if (xVal.length <= period) { return; } // Switch index for OHLC / Candlestick / Arearange if (isArray(yVal[0])) { yValue = yVal[0][index]; } else { return; } // Calculate value one-by-one for each period in visible data for (i = (period + 1); i < yValLen; i++) { MMPoint = populateAverage(xVal, yVal, i, period, index); MM.push(MMPoint); xData.push(MMPoint[0]); yData.push(MMPoint[1]); } MMPoint = populateAverage(xVal, yVal, i, period, index); MM.push(MMPoint); xData.push(MMPoint[0]); yData.push(MMPoint[1]); return { values: MM, xData: xData, yData: yData }; }; /** * Momentum. This series requires `linkedTo` option to be set. * * @sample stock/indicators/momentum * Momentum indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/momentum * @optionparent plotOptions.momentum */ MomentumIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { index: 3 } }); return MomentumIndicator; }(SMAIndicator)); extend(MomentumIndicator.prototype, { nameBase: 'Momentum' }); SeriesRegistry.registerSeriesType('momentum', MomentumIndicator); /* * * * Default Export * * */ /** * A `Momentum` series. If the [type](#series.momentum.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.momentum * @since 6.0.0 * @excluding dataParser, dataURL * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/momentum * @apioption series.momentum */ ''; // to include the above in the js output return MomentumIndicator; }); _registerModule(_modules, 'Stock/Indicators/NATR/NATRIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var ATRIndicator = SeriesRegistry.seriesTypes.atr; var merge = U.merge, extend = U.extend; /** * The NATR series type. * * @private * @class * @name Highcharts.seriesTypes.natr * * @augments Highcharts.Series */ var NATRIndicator = /** @class */ (function (_super) { __extends(NATRIndicator, _super); function NATRIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /** * @lends Highcharts.Series# */ /* * * * Properties * * */ _this.data = void 0; _this.points = void 0; _this.options = void 0; return _this; } /* * * * Functions * * */ NATRIndicator.prototype.getValues = function (series, params) { var atrData = (ATRIndicator.prototype.getValues.apply(this, arguments)), atrLength = atrData.values.length, period = params.period - 1, yVal = series.yData, i = 0; if (!atrData) { return; } for (; i < atrLength; i++) { atrData.yData[i] = (atrData.values[i][1] / yVal[period][3] * 100); atrData.values[i][1] = atrData.yData[i]; period++; } return atrData; }; /** * Normalized average true range indicator (NATR). This series requires * `linkedTo` option to be set and should be loaded after the * `stock/indicators/indicators.js` and `stock/indicators/atr.js`. * * @sample {highstock} stock/indicators/natr * NATR indicator * * @extends plotOptions.atr * @since 7.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/natr * @optionparent plotOptions.natr */ NATRIndicator.defaultOptions = merge(ATRIndicator.defaultOptions, { tooltip: { valueSuffix: '%' } }); return NATRIndicator; }(ATRIndicator)); extend(NATRIndicator.prototype, { requiredIndicators: ['atr'] }); SeriesRegistry.registerSeriesType('natr', NATRIndicator); /* * * * Default Export * * */ /** * A `NATR` series. If the [type](#series.natr.type) option is not specified, it * is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.natr * @since 7.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/natr * @apioption series.natr */ ''; // to include the above in the js output' return NATRIndicator; }); _registerModule(_modules, 'Stock/Indicators/OBV/OBVIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var isNumber = U.isNumber, error = U.error, extend = U.extend, merge = U.merge; /* * * * Class * * */ /** * The OBV series type. * * @private * @class * @name Highcharts.seriesTypes.obv * * @augments Highcharts.Series */ var OBVIndicator = /** @class */ (function (_super) { __extends(OBVIndicator, _super); function OBVIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.points = void 0; _this.options = void 0; return _this; } /* * * * Functions * * */ OBVIndicator.prototype.getValues = function (series, params) { var volumeSeries = series.chart.get(params.volumeSeriesID), xVal = series.xData, yVal = series.yData, OBV = [], xData = [], yData = [], hasOHLC = !isNumber(yVal[0]); var OBVPoint = [], i = 1, previousOBV = 0, curentOBV = 0, previousClose = 0, curentClose = 0, volume; // Checks if volume series exists. if (volumeSeries) { volume = volumeSeries.yData; // Add first point and get close value. OBVPoint = [xVal[0], previousOBV]; previousClose = hasOHLC ? yVal[0][3] : yVal[0]; OBV.push(OBVPoint); xData.push(xVal[0]); yData.push(OBVPoint[1]); for (i; i < yVal.length; i++) { curentClose = hasOHLC ? yVal[i][3] : yVal[i]; if (curentClose > previousClose) { // up curentOBV = previousOBV + volume[i]; } else if (curentClose === previousClose) { // constant curentOBV = previousOBV; } else { // down curentOBV = previousOBV - volume[i]; } // Add point. OBVPoint = [xVal[i], curentOBV]; // Assign current as previous for next iteration. previousOBV = curentOBV; previousClose = curentClose; OBV.push(OBVPoint); xData.push(xVal[i]); yData.push(OBVPoint[1]); } } else { error('Series ' + params.volumeSeriesID + ' not found! Check `volumeSeriesID`.', true, series.chart); return; } return { values: OBV, xData: xData, yData: yData }; }; /** * On-Balance Volume (OBV) technical indicator. This series * requires the `linkedTo` option to be set and should be loaded after * the `stock/indicators/indicators.js` file. Through the `volumeSeriesID` * there also should be linked the volume series. * * @sample stock/indicators/obv * OBV indicator * * @extends plotOptions.sma * @since 9.1.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/obv * @excluding allAreas, colorAxis, joinBy, keys, navigatorOptions, * pointInterval, pointIntervalUnit, pointPlacement, * pointRange, pointStart, showInNavigator, stacking * @optionparent plotOptions.obv */ OBVIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { marker: { enabled: false }, /** * @excluding index, period */ params: { // Index and period are unchangeable, do not inherit (#15362) index: void 0, period: void 0, /** * The id of another series to use its data as volume data for the * indiator calculation. */ volumeSeriesID: 'volume' }, tooltip: { valueDecimals: 0 } }); return OBVIndicator; }(SMAIndicator)); extend(OBVIndicator.prototype, { nameComponents: void 0 }); SeriesRegistry.registerSeriesType('obv', OBVIndicator); /* * * * Default Export * * */ /** * A `OBV` series. If the [type](#series.obv.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.obv * @since 9.1.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/obv * @apioption series.obv */ ''; // to include the above in the js output return OBVIndicator; }); _registerModule(_modules, 'Stock/Indicators/PivotPoints/PivotPointsPoint.js', [_modules['Core/Series/SeriesRegistry.js']], function (SeriesRegistry) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; /* eslint-disable valid-jsdoc */ /** * @private */ function destroyExtraLabels(point, functionName) { var props = point.series.pointArrayMap, prop, i = props.length; SeriesRegistry.seriesTypes.sma.prototype.pointClass.prototype[functionName].call(point); while (i--) { prop = 'dataLabel' + props[i]; // S4 dataLabel could be removed by parent method: if (point[prop] && point[prop].element) { point[prop].destroy(); } point[prop] = null; } } /* eslint-enable valid-jsdoc */ /* * * * Class * * */ var PivotPointsPoint = /** @class */ (function (_super) { __extends(PivotPointsPoint, _super); function PivotPointsPoint() { /** * * Properties * */ var _this = _super !== null && _super.apply(this, arguments) || this; _this.P = void 0; _this.pivotLine = void 0; _this.series = void 0; return _this; } /** * * Functions * */ PivotPointsPoint.prototype.destroyElements = function () { destroyExtraLabels(this, 'destroyElements'); }; // This method is called when removing points, e.g. series.update() PivotPointsPoint.prototype.destroy = function () { destroyExtraLabels(this, 'destroyElements'); }; return PivotPointsPoint; }(SMAIndicator.prototype.pointClass)); /* * * * Default Export * * */ return PivotPointsPoint; }); _registerModule(_modules, 'Stock/Indicators/PivotPoints/PivotPointsIndicator.js', [_modules['Stock/Indicators/PivotPoints/PivotPointsPoint.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (PivotPointsPoint, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var merge = U.merge, extend = U.extend, defined = U.defined, isArray = U.isArray; /** * * Class * **/ /** * The Pivot Points series type. * * @private * @class * @name Highcharts.seriesTypes.pivotpoints * * @augments Highcharts.Series */ var PivotPointsIndicator = /** @class */ (function (_super) { __extends(PivotPointsIndicator, _super); function PivotPointsIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /** * * Properties * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; _this.endPoint = void 0; _this.plotEndPoint = void 0; return _this; } /** * * Functions * */ PivotPointsIndicator.prototype.toYData = function (point) { return [point.P]; // The rest should not affect extremes }; PivotPointsIndicator.prototype.translate = function () { var indicator = this; SeriesRegistry.seriesTypes.sma.prototype.translate.apply(indicator); indicator.points.forEach(function (point) { indicator.pointArrayMap.forEach(function (value) { if (defined(point[value])) { point['plot' + value] = (indicator.yAxis.toPixels(point[value], true)); } }); }); // Pivot points are rendered as horizontal lines // And last point start not from the next one (as it's the last one) // But from the approximated last position in a given range indicator.plotEndPoint = indicator.xAxis.toPixels(indicator.endPoint, true); }; PivotPointsIndicator.prototype.getGraphPath = function (points) { var indicator = this, pointsLength = points.length, allPivotPoints = ([[], [], [], [], [], [], [], [], []]), path = [], endPoint = indicator.plotEndPoint, pointArrayMapLength = indicator.pointArrayMap.length, position, point, i; while (pointsLength--) { point = points[pointsLength]; for (i = 0; i < pointArrayMapLength; i++) { position = indicator.pointArrayMap[i]; if (defined(point[position])) { allPivotPoints[i].push({ // Start left: plotX: point.plotX, plotY: point['plot' + position], isNull: false }, { // Go to right: plotX: endPoint, plotY: point['plot' + position], isNull: false }, { // And add null points in path to generate breaks: plotX: endPoint, plotY: null, isNull: true }); } } endPoint = point.plotX; } allPivotPoints.forEach(function (pivotPoints) { path = path.concat(SeriesRegistry.seriesTypes.sma.prototype.getGraphPath.call(indicator, pivotPoints)); }); return path; }; // TODO: Rewrite this logic to use multiple datalabels PivotPointsIndicator.prototype.drawDataLabels = function () { var indicator = this, pointMapping = indicator.pointArrayMap, currentLabel, pointsLength, point, i; if (indicator.options.dataLabels.enabled) { pointsLength = indicator.points.length; // For every Ressitance/Support group we need to render labels. // Add one more item, which will just store dataLabels from // previous iteration pointMapping.concat([false]).forEach(function (position, k) { i = pointsLength; while (i--) { point = indicator.points[i]; if (!position) { // Store S4 dataLabel too: point['dataLabel' + pointMapping[k - 1]] = point.dataLabel; } else { point.y = point[position]; point.pivotLine = position; point.plotY = point['plot' + position]; currentLabel = point['dataLabel' + position]; // Store previous label if (k) { point['dataLabel' + pointMapping[k - 1]] = point.dataLabel; } if (!point.dataLabels) { point.dataLabels = []; } point.dataLabels[0] = point.dataLabel = currentLabel = currentLabel && currentLabel.element ? currentLabel : null; } } SeriesRegistry.seriesTypes.sma.prototype.drawDataLabels.apply(indicator, arguments); }); } }; PivotPointsIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, placement = this[params.algorithm + 'Placement'], // 0- from, 1- to, 2- R1, 3- R2, 4- pivot, 5- S1 etc. PP = [], endTimestamp, xData = [], yData = [], slicedXLen, slicedX, slicedY, lastPP, pivot, avg, i; // Pivot Points requires high, low and close values if (xVal.length < period || !isArray(yVal[0]) || yVal[0].length !== 4) { return; } for (i = period + 1; i <= yValLen + period; i += period) { slicedX = xVal.slice(i - period - 1, i); slicedY = yVal.slice(i - period - 1, i); slicedXLen = slicedX.length; endTimestamp = slicedX[slicedXLen - 1]; pivot = this.getPivotAndHLC(slicedY); avg = placement(pivot); lastPP = PP.push([endTimestamp] .concat(avg)); xData.push(endTimestamp); yData.push(PP[lastPP - 1].slice(1)); } // We don't know exact position in ordinal axis // So we use simple logic: // Get first point in last range, calculate visible average range // and multiply by period this.endPoint = slicedX[0] + ((endTimestamp - slicedX[0]) / slicedXLen) * period; return { values: PP, xData: xData, yData: yData }; }; PivotPointsIndicator.prototype.getPivotAndHLC = function (values) { var high = -Infinity, low = Infinity, close = values[values.length - 1][3], pivot; values.forEach(function (p) { high = Math.max(high, p[1]); low = Math.min(low, p[2]); }); pivot = (high + low + close) / 3; return [pivot, high, low, close]; }; PivotPointsIndicator.prototype.standardPlacement = function (values) { var diff = values[1] - values[2], avg = [ null, null, values[0] + diff, values[0] * 2 - values[2], values[0], values[0] * 2 - values[1], values[0] - diff, null, null ]; return avg; }; PivotPointsIndicator.prototype.camarillaPlacement = function (values) { var diff = values[1] - values[2], avg = [ values[3] + diff * 1.5, values[3] + diff * 1.25, values[3] + diff * 1.1666, values[3] + diff * 1.0833, values[0], values[3] - diff * 1.0833, values[3] - diff * 1.1666, values[3] - diff * 1.25, values[3] - diff * 1.5 ]; return avg; }; PivotPointsIndicator.prototype.fibonacciPlacement = function (values) { var diff = values[1] - values[2], avg = [ null, values[0] + diff, values[0] + diff * 0.618, values[0] + diff * 0.382, values[0], values[0] - diff * 0.382, values[0] - diff * 0.618, values[0] - diff, null ]; return avg; }; /** * Pivot points indicator. This series requires the `linkedTo` option to be * set and should be loaded after `stock/indicators/indicators.js` file. * * @sample stock/indicators/pivot-points * Pivot points * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/pivotpoints * @optionparent plotOptions.pivotpoints */ PivotPointsIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index */ params: { index: void 0, period: 28, /** * Algorithm used to calculate ressistance and support lines based * on pivot points. Implemented algorithms: `'standard'`, * `'fibonacci'` and `'camarilla'` */ algorithm: 'standard' }, marker: { enabled: false }, enableMouseTracking: false, dataLabels: { enabled: true, format: '{point.pivotLine}' }, dataGrouping: { approximation: 'averages' } }); return PivotPointsIndicator; }(SMAIndicator)); extend(PivotPointsIndicator.prototype, { nameBase: 'Pivot Points', pointArrayMap: ['R4', 'R3', 'R2', 'R1', 'P', 'S1', 'S2', 'S3', 'S4'], pointValKey: 'P', pointClass: PivotPointsPoint }); /* * * * Registry * * */ SeriesRegistry.registerSeriesType('pivotpoints', PivotPointsIndicator); /* * * * Default Export * * */ /** * A pivot points indicator. If the [type](#series.pivotpoints.type) option is * not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.pivotpoints * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/pivotpoints * @apioption series.pivotpoints */ ''; // to include the above in the js output' return PivotPointsIndicator; }); _registerModule(_modules, 'Stock/Indicators/PPO/PPOIndicator.js', [_modules['Mixins/IndicatorRequired.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (RequiredIndicatorMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var EMAIndicator = SeriesRegistry.seriesTypes.ema; var correctFloat = U.correctFloat, extend = U.extend, merge = U.merge, error = U.error; /* * * * Class * * */ /** * The PPO series type. * * @private * @class * @name Highcharts.seriesTypes.ppo * * @augments Highcharts.Series */ var PPOIndicator = /** @class */ (function (_super) { __extends(PPOIndicator, _super); function PPOIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ PPOIndicator.prototype.init = function () { var args = arguments, ctx = this; RequiredIndicatorMixin.isParentLoaded(EMAIndicator, 'ema', ctx.type, function (indicator) { indicator.prototype.init.apply(ctx, args); return; }); }; PPOIndicator.prototype.getValues = function (series, params) { var periods = params.periods, index = params.index, // 0- date, 1- Percentage Price Oscillator PPO = [], xData = [], yData = [], periodsOffset, // Shorter Period EMA SPE, // Longer Period EMA LPE, oscillator, i; // Check if periods are correct if (periods.length !== 2 || periods[1] <= periods[0]) { error('Error: "PPO requires two periods. Notice, first period ' + 'should be lower than the second one."'); return; } SPE = EMAIndicator.prototype.getValues.call(this, series, { index: index, period: periods[0] }); LPE = EMAIndicator.prototype.getValues.call(this, series, { index: index, period: periods[1] }); // Check if ema is calculated properly, if not skip if (!SPE || !LPE) { return; } periodsOffset = periods[1] - periods[0]; for (i = 0; i < LPE.yData.length; i++) { oscillator = correctFloat((SPE.yData[i + periodsOffset] - LPE.yData[i]) / LPE.yData[i] * 100); PPO.push([LPE.xData[i], oscillator]); xData.push(LPE.xData[i]); yData.push(oscillator); } return { values: PPO, xData: xData, yData: yData }; }; /** * Percentage Price Oscillator. This series requires the * `linkedTo` option to be set and should be loaded after the * `stock/indicators/indicators.js` and `stock/indicators/ema.js`. * * @sample {highstock} stock/indicators/ppo * Percentage Price Oscillator * * @extends plotOptions.ema * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, joinBy, keys, navigatorOptions, * pointInterval, pointIntervalUnit, pointPlacement, * pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/ema * @requires stock/indicators/ppo * @optionparent plotOptions.ppo */ PPOIndicator.defaultOptions = merge(EMAIndicator.defaultOptions, { /** * Paramters used in calculation of Percentage Price Oscillator series * points. * * @excluding period */ params: { period: void 0, /** * Periods for Percentage Price Oscillator calculations. * * @type {Array<number>} * @default [12, 26] */ periods: [12, 26] } }); return PPOIndicator; }(EMAIndicator)); extend(PPOIndicator.prototype, { nameBase: 'PPO', nameComponents: ['periods'] }); SeriesRegistry.registerSeriesType('ppo', PPOIndicator); /* * * * Default Export * * */ /** * A `Percentage Price Oscillator` series. If the [type](#series.ppo.type) * option is not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.ppo * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, dataParser, dataURL, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/ema * @requires stock/indicators/ppo * @apioption series.ppo */ ''; // to include the above in the js output return PPOIndicator; }); _registerModule(_modules, 'Mixins/ReduceArray.js', [], function () { /** * * (c) 2010-2021 Pawel Fus & Daniel Studencki * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var reduceArrayMixin = { /** * Get min value of array filled by OHLC data. * @private * @param {Array<*>} arr Array of OHLC points (arrays). * @param {string} index Index of "low" value in point array. * @return {number} Returns min value. */ minInArray: function (arr, index) { return arr.reduce(function (min, target) { return Math.min(min, target[index]); }, Number.MAX_VALUE); }, /** * Get max value of array filled by OHLC data. * @private * @param {Array<*>} arr Array of OHLC points (arrays). * @param {string} index Index of "high" value in point array. * @return {number} Returns max value. */ maxInArray: function (arr, index) { return arr.reduce(function (max, target) { return Math.max(max, target[index]); }, -Number.MAX_VALUE); }, /** * Get extremes of array filled by OHLC data. * @private * @param {Array<*>} arr Array of OHLC points (arrays). * @param {string} minIndex Index of "low" value in point array. * @param {string} maxIndex Index of "high" value in point array. * @return {Array<number,number>} Returns array with min and max value. */ getArrayExtremes: function (arr, minIndex, maxIndex) { return arr.reduce(function (prev, target) { return [ Math.min(prev[0], target[minIndex]), Math.max(prev[1], target[maxIndex]) ]; }, [Number.MAX_VALUE, -Number.MAX_VALUE]); } }; return reduceArrayMixin; }); _registerModule(_modules, 'Stock/Indicators/PC/PCIndicator.js', [_modules['Core/Color/Palette.js'], _modules['Mixins/MultipleLines.js'], _modules['Mixins/ReduceArray.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (palette, MultipleLinesMixin, ReduceArrayMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var merge = U.merge, extend = U.extend; var getArrayExtremes = ReduceArrayMixin.getArrayExtremes; /* * * * Class * * */ /** * The Price Channel series type. * * @private * @class * @name Highcharts.seriesTypes.pc * * @augments Highcharts.Series */ var PCIndicator = /** @class */ (function (_super) { __extends(PCIndicator, _super); function PCIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ PCIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, // 0- date, 1-top line, 2-middle line, 3-bottom line PC = [], // middle line, top line and bottom line ML, TL, BL, date, low = 2, high = 1, xData = [], yData = [], slicedY, extremes, i; if (yValLen < period) { return; } for (i = period; i <= yValLen; i++) { date = xVal[i - 1]; slicedY = yVal.slice(i - period, i); extremes = getArrayExtremes(slicedY, low, high); TL = extremes[1]; BL = extremes[0]; ML = (TL + BL) / 2; PC.push([date, TL, ML, BL]); xData.push(date); yData.push([TL, ML, BL]); } return { values: PC, xData: xData, yData: yData }; }; /** * Price channel (PC). This series requires the `linkedTo` option to be * set and should be loaded after the `stock/indicators/indicators.js`. * * @sample {highstock} stock/indicators/price-channel * Price Channel * * @extends plotOptions.sma * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, * stacking * @requires stock/indicators/indicators * @requires stock/indicators/price-channel * @optionparent plotOptions.pc */ PCIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index */ params: { index: void 0, period: 20 }, lineWidth: 1, topLine: { styles: { /** * Color of the top line. If not set, it's inherited from * [plotOptions.pc.color](#plotOptions.pc.color). * * @type {Highcharts.ColorString} */ lineColor: palette.colors[2], /** * Pixel width of the line. */ lineWidth: 1 } }, bottomLine: { styles: { /** * Color of the bottom line. If not set, it's inherited from * [plotOptions.pc.color](#plotOptions.pc.color). * * @type {Highcharts.ColorString} */ lineColor: palette.colors[8], /** * Pixel width of the line. */ lineWidth: 1 } }, dataGrouping: { approximation: 'averages' } }); return PCIndicator; }(SMAIndicator)); extend(PCIndicator.prototype, { getTranslatedLinesNames: MultipleLinesMixin.getTranslatedLinesNames, drawGraph: MultipleLinesMixin.drawGraph, toYData: MultipleLinesMixin.toYData, pointArrayMap: ['top', 'middle', 'bottom'], pointValKey: 'middle', nameBase: 'Price Channel', nameComponents: ['period'], linesApiNames: ['topLine', 'bottomLine'], translate: MultipleLinesMixin.translate }); SeriesRegistry.registerSeriesType('pc', PCIndicator); /* * * * Default Export * * */ /** * A Price channel indicator. If the [type](#series.pc.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.pc * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, dataParser, dataURL, * joinBy, keys, navigatorOptions, pointInterval, * pointIntervalUnit, pointPlacement, pointRange, pointStart, * showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/price-channel * @apioption series.pc */ ''; // to include the above in the js output return PCIndicator; }); _registerModule(_modules, 'Stock/Indicators/PriceEnvelopes/PriceEnvelopesIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var extend = U.extend, isArray = U.isArray, merge = U.merge; /** * The Price Envelopes series type. * * @private * @class * @name Highcharts.seriesTypes.priceenvelopes * * @augments Highcharts.Series */ var PriceEnvelopesIndicator = /** @class */ (function (_super) { __extends(PriceEnvelopesIndicator, _super); function PriceEnvelopesIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } PriceEnvelopesIndicator.prototype.init = function () { SeriesRegistry.seriesTypes.sma.prototype.init.apply(this, arguments); // Set default color for lines: this.options = merge({ topLine: { styles: { lineColor: this.color } }, bottomLine: { styles: { lineColor: this.color } } }, this.options); }; PriceEnvelopesIndicator.prototype.toYData = function (point) { return [point.top, point.middle, point.bottom]; }; PriceEnvelopesIndicator.prototype.translate = function () { var indicator = this, translatedEnvelopes = ['plotTop', 'plotMiddle', 'plotBottom']; SeriesRegistry.seriesTypes.sma.prototype.translate.apply(indicator); indicator.points.forEach(function (point) { [point.top, point.middle, point.bottom].forEach(function (value, i) { if (value !== null) { point[translatedEnvelopes[i]] = indicator.yAxis.toPixels(value, true); } }); }); }; PriceEnvelopesIndicator.prototype.drawGraph = function () { var indicator = this, middleLinePoints = indicator.points, pointsLength = middleLinePoints.length, middleLineOptions = (indicator.options), middleLinePath = indicator.graph, gappedExtend = { options: { gapSize: middleLineOptions.gapSize } }, deviations = [[], []], // top and bottom point place holders point; // Generate points for top and bottom lines: while (pointsLength--) { point = middleLinePoints[pointsLength]; deviations[0].push({ plotX: point.plotX, plotY: point.plotTop, isNull: point.isNull }); deviations[1].push({ plotX: point.plotX, plotY: point.plotBottom, isNull: point.isNull }); } // Modify options and generate lines: ['topLine', 'bottomLine'].forEach(function (lineName, i) { indicator.points = deviations[i]; indicator.options = merge(middleLineOptions[lineName].styles, gappedExtend); indicator.graph = indicator['graph' + lineName]; SeriesRegistry.seriesTypes.sma.prototype.drawGraph.call(indicator); // Now save lines: indicator['graph' + lineName] = indicator.graph; }); // Restore options and draw a middle line: indicator.points = middleLinePoints; indicator.options = middleLineOptions; indicator.graph = middleLinePath; SeriesRegistry.seriesTypes.sma.prototype.drawGraph.call(indicator); }; PriceEnvelopesIndicator.prototype.getValues = function (series, params) { var period = params.period, topPercent = params.topBand, botPercent = params.bottomBand, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, // 0- date, 1-top line, 2-middle line, 3-bottom line PE = [], // middle line, top line and bottom line ML, TL, BL, date, xData = [], yData = [], slicedX, slicedY, point, i; // Price envelopes requires close value if (xVal.length < period || !isArray(yVal[0]) || yVal[0].length !== 4) { return; } for (i = period; i <= yValLen; i++) { slicedX = xVal.slice(i - period, i); slicedY = yVal.slice(i - period, i); point = SeriesRegistry.seriesTypes.sma.prototype.getValues.call(this, { xData: slicedX, yData: slicedY }, params); date = point.xData[0]; ML = point.yData[0]; TL = ML * (1 + topPercent); BL = ML * (1 - botPercent); PE.push([date, TL, ML, BL]); xData.push(date); yData.push([TL, ML, BL]); } return { values: PE, xData: xData, yData: yData }; }; /** * Price envelopes indicator based on [SMA](#plotOptions.sma) calculations. * This series requires the `linkedTo` option to be set and should be loaded * after the `stock/indicators/indicators.js` file. * * @sample stock/indicators/price-envelopes * Price envelopes * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/price-envelopes * @optionparent plotOptions.priceenvelopes */ PriceEnvelopesIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { marker: { enabled: false }, tooltip: { pointFormat: '<span style="color:{point.color}">\u25CF</span><b> {series.name}</b><br/>Top: {point.top}<br/>Middle: {point.middle}<br/>Bottom: {point.bottom}<br/>' }, params: { period: 20, /** * Percentage above the moving average that should be displayed. * 0.1 means 110%. Relative to the calculated value. */ topBand: 0.1, /** * Percentage below the moving average that should be displayed. * 0.1 means 90%. Relative to the calculated value. */ bottomBand: 0.1 }, /** * Bottom line options. */ bottomLine: { styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. If not set, it's inherited from * [plotOptions.priceenvelopes.color]( * #plotOptions.priceenvelopes.color). * * @type {Highcharts.ColorString} */ lineColor: void 0 } }, /** * Top line options. * * @extends plotOptions.priceenvelopes.bottomLine */ topLine: { styles: { lineWidth: 1 } }, dataGrouping: { approximation: 'averages' } }); return PriceEnvelopesIndicator; }(SMAIndicator)); extend(PriceEnvelopesIndicator.prototype, { nameComponents: ['period', 'topBand', 'bottomBand'], nameBase: 'Price envelopes', pointArrayMap: ['top', 'middle', 'bottom'], parallelArrays: ['x', 'y', 'top', 'bottom'], pointValKey: 'middle' }); SeriesRegistry.registerSeriesType('priceenvelopes', PriceEnvelopesIndicator); /* * * * Default Export * * */ /** * A price envelopes indicator. If the [type](#series.priceenvelopes.type) * option is not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.priceenvelopes * @since 6.0.0 * @excluding dataParser, dataURL * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/price-envelopes * @apioption series.priceenvelopes */ ''; // to include the above in the js output return PriceEnvelopesIndicator; }); _registerModule(_modules, 'Stock/Indicators/PSAR/PSARIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * Parabolic SAR indicator for Highcharts Stock * * (c) 2010-2021 Grzegorz Blachliński * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var merge = U.merge, extend = U.extend; /* eslint-disable require-jsdoc */ // Utils: function toFixed(a, n) { return parseFloat(a.toFixed(n)); } function calculateDirection(previousDirection, low, high, PSAR) { if ((previousDirection === 1 && low > PSAR) || (previousDirection === -1 && high > PSAR)) { return 1; } return -1; } /* * * Method for calculating acceleration factor * dir - direction * pDir - previous Direction * eP - extreme point * pEP - previous extreme point * inc - increment for acceleration factor * maxAcc - maximum acceleration factor * initAcc - initial acceleration factor */ function getAccelerationFactor(dir, pDir, eP, pEP, pAcc, inc, maxAcc, initAcc) { if (dir === pDir) { if (dir === 1 && (eP > pEP)) { return (pAcc === maxAcc) ? maxAcc : toFixed(pAcc + inc, 2); } if (dir === -1 && (eP < pEP)) { return (pAcc === maxAcc) ? maxAcc : toFixed(pAcc + inc, 2); } return pAcc; } return initAcc; } function getExtremePoint(high, low, previousDirection, previousExtremePoint) { if (previousDirection === 1) { return (high > previousExtremePoint) ? high : previousExtremePoint; } return (low < previousExtremePoint) ? low : previousExtremePoint; } function getEPMinusPSAR(EP, PSAR) { return EP - PSAR; } function getAccelerationFactorMultiply(accelerationFactor, EPMinusSAR) { return accelerationFactor * EPMinusSAR; } /* * * Method for calculating PSAR * pdir - previous direction * sDir - second previous Direction * PSAR - previous PSAR * pACCMultiply - previous acceleration factor multiply * sLow - second previous low * pLow - previous low * sHigh - second previous high * pHigh - previous high * pEP - previous extreme point */ function getPSAR(pdir, sDir, PSAR, pACCMulti, sLow, pLow, pHigh, sHigh, pEP) { if (pdir === sDir) { if (pdir === 1) { return (PSAR + pACCMulti < Math.min(sLow, pLow)) ? PSAR + pACCMulti : Math.min(sLow, pLow); } return (PSAR + pACCMulti > Math.max(sHigh, pHigh)) ? PSAR + pACCMulti : Math.max(sHigh, pHigh); } return pEP; } /* eslint-enable require-jsdoc */ /* * * * Class * * */ /** * The Parabolic SAR series type. * * @private * @class * @name Highcharts.seriesTypes.psar * * @augments Highcharts.Series */ var PSARIndicator = /** @class */ (function (_super) { __extends(PSARIndicator, _super); function PSARIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.points = void 0; _this.options = void 0; return _this; } /* * * * Functions * * */ PSARIndicator.prototype.getValues = function (series, params) { var xVal = series.xData, yVal = series.yData, // Extreme point is the lowest low for falling and highest high // for rising psar - and we are starting with falling extremePoint = yVal[0][1], accelerationFactor = params.initialAccelerationFactor, maxAccelerationFactor = params.maxAccelerationFactor, increment = params.increment, // Set initial acc factor (for every new trend!) initialAccelerationFactor = params.initialAccelerationFactor, PSAR = yVal[0][2], decimals = params.decimals, index = params.index, PSARArr = [], xData = [], yData = [], previousDirection = 1, direction, EPMinusPSAR, accelerationFactorMultiply, newDirection, prevLow, prevPrevLow, prevHigh, prevPrevHigh, newExtremePoint, high, low, ind; if (index >= yVal.length) { return; } for (ind = 0; ind < index; ind++) { extremePoint = Math.max(yVal[ind][1], extremePoint); PSAR = Math.min(yVal[ind][2], toFixed(PSAR, decimals)); } direction = (yVal[ind][1] > PSAR) ? 1 : -1; EPMinusPSAR = getEPMinusPSAR(extremePoint, PSAR); accelerationFactor = params.initialAccelerationFactor; accelerationFactorMultiply = getAccelerationFactorMultiply(accelerationFactor, EPMinusPSAR); PSARArr.push([xVal[index], PSAR]); xData.push(xVal[index]); yData.push(toFixed(PSAR, decimals)); for (ind = index + 1; ind < yVal.length; ind++) { prevLow = yVal[ind - 1][2]; prevPrevLow = yVal[ind - 2][2]; prevHigh = yVal[ind - 1][1]; prevPrevHigh = yVal[ind - 2][1]; high = yVal[ind][1]; low = yVal[ind][2]; // Null points break PSAR if (prevPrevLow !== null && prevPrevHigh !== null && prevLow !== null && prevHigh !== null && high !== null && low !== null) { PSAR = getPSAR(direction, previousDirection, PSAR, accelerationFactorMultiply, prevPrevLow, prevLow, prevHigh, prevPrevHigh, extremePoint); newExtremePoint = getExtremePoint(high, low, direction, extremePoint); newDirection = calculateDirection(previousDirection, low, high, PSAR); accelerationFactor = getAccelerationFactor(newDirection, direction, newExtremePoint, extremePoint, accelerationFactor, increment, maxAccelerationFactor, initialAccelerationFactor); EPMinusPSAR = getEPMinusPSAR(newExtremePoint, PSAR); accelerationFactorMultiply = getAccelerationFactorMultiply(accelerationFactor, EPMinusPSAR); PSARArr.push([xVal[ind], toFixed(PSAR, decimals)]); xData.push(xVal[ind]); yData.push(toFixed(PSAR, decimals)); previousDirection = direction; direction = newDirection; extremePoint = newExtremePoint; } } return { values: PSARArr, xData: xData, yData: yData }; }; /** * Parabolic SAR. This series requires `linkedTo` * option to be set and should be loaded * after `stock/indicators/indicators.js` file. * * @sample stock/indicators/psar * Parabolic SAR Indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/psar * @optionparent plotOptions.psar */ PSARIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { lineWidth: 0, marker: { enabled: true }, states: { hover: { lineWidthPlus: 0 } }, /** * @excluding period */ params: { period: void 0, /** * The initial value for acceleration factor. * Acceleration factor is starting with this value * and increases by specified increment each time * the extreme point makes a new high. * AF can reach a maximum of maxAccelerationFactor, * no matter how long the uptrend extends. */ initialAccelerationFactor: 0.02, /** * The Maximum value for acceleration factor. * AF can reach a maximum of maxAccelerationFactor, * no matter how long the uptrend extends. */ maxAccelerationFactor: 0.2, /** * Acceleration factor increases by increment each time * the extreme point makes a new high. * * @since 6.0.0 */ increment: 0.02, /** * Index from which PSAR is starting calculation * * @since 6.0.0 */ index: 2, /** * Number of maximum decimals that are used in PSAR calculations. * * @since 6.0.0 */ decimals: 4 } }); return PSARIndicator; }(SMAIndicator)); extend(PSARIndicator.prototype, { nameComponents: void 0 }); SeriesRegistry.registerSeriesType('psar', PSARIndicator); /* * * * Default Export * * */ /** * A `PSAR` series. If the [type](#series.psar.type) option is not specified, it * is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.psar * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/psar * @apioption series.psar */ ''; // to include the above in the js output return PSARIndicator; }); _registerModule(_modules, 'Stock/Indicators/ROC/ROCIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * (c) 2010-2021 Kacper Madej * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var isArray = U.isArray, merge = U.merge, extend = U.extend; /* eslint-disable require-jsdoc */ // Utils: function populateAverage(xVal, yVal, i, period, index) { /* Calculated as: (Closing Price [today] - Closing Price [n days ago]) / Closing Price [n days ago] * 100 Return y as null when avoiding division by zero */ var nDaysAgoY, rocY; if (index < 0) { // y data given as an array of values nDaysAgoY = yVal[i - period]; rocY = nDaysAgoY ? (yVal[i] - nDaysAgoY) / nDaysAgoY * 100 : null; } else { // y data given as an array of arrays and the index should be used nDaysAgoY = yVal[i - period][index]; rocY = nDaysAgoY ? (yVal[i][index] - nDaysAgoY) / nDaysAgoY * 100 : null; } return [xVal[i], rocY]; } /* eslint-enable require-jsdoc */ /* * * * Class * * */ /** * The ROC series type. * * @private * @class * @name Highcharts.seriesTypes.roc * * @augments Highcharts.Series */ var ROCIndicator = /** @class */ (function (_super) { __extends(ROCIndicator, _super); function ROCIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ ROCIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, ROC = [], xData = [], yData = [], i, index = -1, ROCPoint; // Period is used as a number of time periods ago, so we need more // (at least 1 more) data than the period value if (xVal.length <= period) { return; } // Switch index for OHLC / Candlestick / Arearange if (isArray(yVal[0])) { index = params.index; } // i = period <-- skip first N-points // Calculate value one-by-one for each period in visible data for (i = period; i < yValLen; i++) { ROCPoint = populateAverage(xVal, yVal, i, period, index); ROC.push(ROCPoint); xData.push(ROCPoint[0]); yData.push(ROCPoint[1]); } return { values: ROC, xData: xData, yData: yData }; }; /** * Rate of change indicator (ROC). The indicator value for each point * is defined as: * * `(C - Cn) / Cn * 100` * * where: `C` is the close value of the point of the same x in the * linked series and `Cn` is the close value of the point `n` periods * ago. `n` is set through [period](#plotOptions.roc.params.period). * * This series requires `linkedTo` option to be set. * * @sample stock/indicators/roc * Rate of change indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/roc * @optionparent plotOptions.roc */ ROCIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { index: 3, period: 9 } }); return ROCIndicator; }(SMAIndicator)); extend(ROCIndicator.prototype, { nameBase: 'Rate of Change' }); SeriesRegistry.registerSeriesType('roc', ROCIndicator); /* * * * Default Export * * */ /** * A `ROC` series. If the [type](#series.wma.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * Rate of change indicator (ROC). The indicator value for each point * is defined as: * * `(C - Cn) / Cn * 100` * * where: `C` is the close value of the point of the same x in the * linked series and `Cn` is the close value of the point `n` periods * ago. `n` is set through [period](#series.roc.params.period). * * This series requires `linkedTo` option to be set. * * @extends series,plotOptions.roc * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/roc * @apioption series.roc */ ''; // to include the above in the js output return ROCIndicator; }); _registerModule(_modules, 'Stock/Indicators/RSI/RSIIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var isNumber = U.isNumber, merge = U.merge; /* eslint-disable require-jsdoc */ // Utils: function toFixed(a, n) { return parseFloat(a.toFixed(n)); } /* eslint-enable require-jsdoc */ /** * The RSI series type. * * @private * @class * @name Highcharts.seriesTypes.rsi * * @augments Highcharts.Series */ var RSIIndicator = /** @class */ (function (_super) { __extends(RSIIndicator, _super); function RSIIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.points = void 0; _this.options = void 0; return _this; } /* * * * Functions * * */ RSIIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, decimals = params.decimals, // RSI starts calculations from the second point // Cause we need to calculate change between two points range = 1, RSI = [], xData = [], yData = [], index = params.index, gain = 0, loss = 0, RSIPoint, change, avgGain, avgLoss, i, values; if ((xVal.length < period)) { return; } if (isNumber(yVal[0])) { values = yVal; } else { // in case of the situation, where the series type has data length // longer then 4 (HLC, range), this ensures that we are not trying // to reach the index out of bounds index = Math.min(index, yVal[0].length - 1); values = yVal.map(function (value) { return value[index]; }); } // Calculate changes for first N points while (range < period) { change = toFixed(values[range] - values[range - 1], decimals); if (change > 0) { gain += change; } else { loss += Math.abs(change); } range++; } // Average for first n-1 points: avgGain = toFixed(gain / (period - 1), decimals); avgLoss = toFixed(loss / (period - 1), decimals); for (i = range; i < yValLen; i++) { change = toFixed(values[i] - values[i - 1], decimals); if (change > 0) { gain = change; loss = 0; } else { gain = 0; loss = Math.abs(change); } // Calculate smoothed averages, RS, RSI values: avgGain = toFixed((avgGain * (period - 1) + gain) / period, decimals); avgLoss = toFixed((avgLoss * (period - 1) + loss) / period, decimals); // If average-loss is equal zero, then by definition RSI is set // to 100: if (avgLoss === 0) { RSIPoint = 100; // If average-gain is equal zero, then by definition RSI is set // to 0: } else if (avgGain === 0) { RSIPoint = 0; } else { RSIPoint = toFixed(100 - (100 / (1 + (avgGain / avgLoss))), decimals); } RSI.push([xVal[i], RSIPoint]); xData.push(xVal[i]); yData.push(RSIPoint); } return { values: RSI, xData: xData, yData: yData }; }; /** * Relative strength index (RSI) technical indicator. This series * requires the `linkedTo` option to be set and should be loaded after * the `stock/indicators/indicators.js` file. * * @sample stock/indicators/rsi * RSI indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/rsi * @optionparent plotOptions.rsi */ RSIIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { decimals: 4, index: 3 } }); return RSIIndicator; }(SMAIndicator)); SeriesRegistry.registerSeriesType('rsi', RSIIndicator); /* * * * Default Export * * */ /** * A `RSI` series. If the [type](#series.rsi.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.rsi * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/rsi * @apioption series.rsi */ ''; // to include the above in the js output return RSIIndicator; }); _registerModule(_modules, 'Stock/Indicators/Stochastic/StochasticIndicator.js', [_modules['Mixins/MultipleLines.js'], _modules['Mixins/ReduceArray.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (MultipleLinesMixin, ReduceArrayMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var extend = U.extend, isArray = U.isArray, merge = U.merge; /** * The Stochastic series type. * * @private * @class * @name Highcharts.seriesTypes.stochastic * * @augments Highcharts.Series */ var StochasticIndicator = /** @class */ (function (_super) { __extends(StochasticIndicator, _super); function StochasticIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } StochasticIndicator.prototype.init = function () { SeriesRegistry.seriesTypes.sma.prototype.init.apply(this, arguments); // Set default color for lines: this.options = merge({ smoothedLine: { styles: { lineColor: this.color } } }, this.options); }; StochasticIndicator.prototype.getValues = function (series, params) { var periodK = params.periods[0], periodD = params.periods[1], xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, // 0- date, 1-%K, 2-%D SO = [], xData = [], yData = [], slicedY, close = 3, low = 2, high = 1, CL, HL, LL, K, D = null, points, extremes, i; // Stochastic requires close value if (yValLen < periodK || !isArray(yVal[0]) || yVal[0].length !== 4) { return; } // For a N-period, we start from N-1 point, to calculate Nth point // That is why we later need to comprehend slice() elements list // with (+1) for (i = periodK - 1; i < yValLen; i++) { slicedY = yVal.slice(i - periodK + 1, i + 1); // Calculate %K extremes = ReduceArrayMixin.getArrayExtremes(slicedY, low, high); LL = extremes[0]; // Lowest low in %K periods CL = yVal[i][close] - LL; HL = extremes[1] - LL; K = CL / HL * 100; xData.push(xVal[i]); yData.push([K, null]); // Calculate smoothed %D, which is SMA of %K if (i >= (periodK - 1) + (periodD - 1)) { points = SeriesRegistry.seriesTypes.sma.prototype.getValues.call(this, { xData: xData.slice(-periodD), yData: yData.slice(-periodD) }, { period: periodD }); D = points.yData[0]; } SO.push([xVal[i], K, D]); yData[yData.length - 1][1] = D; } return { values: SO, xData: xData, yData: yData }; }; /** * Stochastic oscillator. This series requires the `linkedTo` option to be * set and should be loaded after the `stock/indicators/indicators.js` file. * * @sample stock/indicators/stochastic * Stochastic oscillator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @excluding allAreas, colorAxis, joinBy, keys, navigatorOptions, * pointInterval, pointIntervalUnit, pointPlacement, * pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/stochastic * @optionparent plotOptions.stochastic */ StochasticIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index, period */ params: { // Index and period are unchangeable, do not inherit (#15362) index: void 0, period: void 0, /** * Periods for Stochastic oscillator: [%K, %D]. * * @type {Array<number,number>} * @default [14, 3] */ periods: [14, 3] }, marker: { enabled: false }, tooltip: { pointFormat: '<span style="color:{point.color}">\u25CF</span><b> {series.name}</b><br/>%K: {point.y}<br/>%D: {point.smoothed}<br/>' }, /** * Smoothed line options. */ smoothedLine: { /** * Styles for a smoothed line. */ styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. If not set, it's inherited from * [plotOptions.stochastic.color * ](#plotOptions.stochastic.color). * * @type {Highcharts.ColorString} */ lineColor: void 0 } }, dataGrouping: { approximation: 'averages' } }); return StochasticIndicator; }(SMAIndicator)); extend(StochasticIndicator.prototype, { nameComponents: ['periods'], nameBase: 'Stochastic', pointArrayMap: ['y', 'smoothed'], parallelArrays: ['x', 'y', 'smoothed'], pointValKey: 'y', linesApiNames: ['smoothedLine'], drawGraph: MultipleLinesMixin.drawGraph, getTranslatedLinesNames: MultipleLinesMixin.getTranslatedLinesNames, translate: MultipleLinesMixin.translate, toYData: MultipleLinesMixin.toYData }); SeriesRegistry.registerSeriesType('stochastic', StochasticIndicator); /* * * * Default Export * * */ /** * A Stochastic indicator. If the [type](#series.stochastic.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.stochastic * @since 6.0.0 * @product highstock * @excluding allAreas, colorAxis, dataParser, dataURL, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/stochastic * @apioption series.stochastic */ ''; // to include the above in the js output return StochasticIndicator; }); _registerModule(_modules, 'Stock/Indicators/SlowStochastic/SlowStochasticIndicator.js', [_modules['Mixins/IndicatorRequired.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (RequiredIndicatorMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var StochasticIndicator = SeriesRegistry.seriesTypes.stochastic; var seriesTypes = SeriesRegistry.seriesTypes; var extend = U.extend, merge = U.merge; /** * The Slow Stochastic series type. * * @private * @class * @name Highcharts.seriesTypes.slowstochastic * * @augments Highcharts.Series */ var SlowStochasticIndicator = /** @class */ (function (_super) { __extends(SlowStochasticIndicator, _super); function SlowStochasticIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } SlowStochasticIndicator.prototype.init = function () { var args = arguments, ctx = this; RequiredIndicatorMixin.isParentLoaded(seriesTypes.stochastic, 'stochastic', ctx.type, function (indicator) { indicator.prototype.init.apply(ctx, args); return; }); }; SlowStochasticIndicator.prototype.getValues = function (series, params) { var periods = params.periods, fastValues = seriesTypes.stochastic.prototype.getValues.call(this, series, params), slowValues = { values: [], xData: [], yData: [] }; var i = 0; if (!fastValues) { return; } slowValues.xData = fastValues.xData.slice(periods[1] - 1); var fastYData = fastValues.yData.slice(periods[1] - 1); // Get SMA(%D) var smoothedValues = seriesTypes.sma.prototype.getValues.call(this, { xData: slowValues.xData, yData: fastYData }, { index: 1, period: periods[2] }); if (!smoothedValues) { return; } var xDataLen = slowValues.xData.length; // Format data for (; i < xDataLen; i++) { slowValues.yData[i] = [ fastYData[i][1], smoothedValues.yData[i - periods[2] + 1] || null ]; slowValues.values[i] = [ slowValues.xData[i], fastYData[i][1], smoothedValues.yData[i - periods[2] + 1] || null ]; } return slowValues; }; /** * Slow Stochastic oscillator. This series requires the `linkedTo` option * to be set and should be loaded after `stock/indicators/indicators.js` * and `stock/indicators/stochastic.js` files. * * @sample stock/indicators/slow-stochastic * Slow Stochastic oscillator * * @extends plotOptions.stochastic * @since 8.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/stochastic * @requires stock/indicators/slowstochastic * @optionparent plotOptions.slowstochastic */ SlowStochasticIndicator.defaultOptions = merge(StochasticIndicator.defaultOptions, { params: { /** * Periods for Slow Stochastic oscillator: [%K, %D, SMA(%D)]. * * @type {Array<number,number,number>} * @default [14, 3, 3] */ periods: [14, 3, 3] } }); return SlowStochasticIndicator; }(StochasticIndicator)); extend(SlowStochasticIndicator.prototype, { nameBase: 'Slow Stochastic' }); SeriesRegistry.registerSeriesType('slowstochastic', SlowStochasticIndicator); /* * * * Default Export * * */ /** * A Slow Stochastic indicator. If the [type](#series.slowstochastic.type) * option is not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.slowstochastic * @since 8.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/stochastic * @requires stock/indicators/slowstochastic * @apioption series.slowstochastic */ ''; // to include the above in the js output return SlowStochasticIndicator; }); _registerModule(_modules, 'Stock/Indicators/Supertrend/SupertrendIndicator.js', [_modules['Core/Color/Palette.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (palette, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var _a = SeriesRegistry.seriesTypes, ATRIndicator = _a.atr, SMAIndicator = _a.sma; var correctFloat = U.correctFloat, isArray = U.isArray, extend = U.extend, merge = U.merge, objectEach = U.objectEach; /* eslint-disable require-jsdoc */ // Utils: function createPointObj(mainSeries, index, close) { return { index: index, close: mainSeries.yData[index][close], x: mainSeries.xData[index] }; } /* eslint-enable require-jsdoc */ /* * * * Class * * */ /** * The Supertrend series type. * * @private * @class * @name Highcharts.seriesTypes.supertrend * * @augments Highcharts.Series */ var SupertrendIndicator = /** @class */ (function (_super) { __extends(SupertrendIndicator, _super); function SupertrendIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.linkedParent = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ SupertrendIndicator.prototype.init = function () { var options, parentOptions; SMAIndicator.prototype.init.apply(this, arguments); options = this.options; parentOptions = this.linkedParent.options; // Indicator cropThreshold has to be equal linked series one // reduced by period due to points comparison in drawGraph method // (#9787) options.cropThreshold = (parentOptions.cropThreshold - (options.params.period - 1)); }; SupertrendIndicator.prototype.drawGraph = function () { var indicator = this, indicOptions = indicator.options, // Series that indicator is linked to mainSeries = indicator.linkedParent, mainLinePoints = (mainSeries ? mainSeries.points : []), indicPoints = indicator.points, indicPath = indicator.graph, indicPointsLen = indicPoints.length, // Points offset between lines tempOffset = mainLinePoints.length - indicPointsLen, offset = tempOffset > 0 ? tempOffset : 0, // @todo: fix when ichi-moku indicator is merged to master. gappedExtend = { options: { gapSize: indicOptions.gapSize } }, // Sorted supertrend points array groupedPoitns = { top: [], bottom: [], intersect: [] // Change trend line points }, // Options for trend lines supertrendLineOptions = { top: { styles: { lineWidth: indicOptions.lineWidth, lineColor: (indicOptions.fallingTrendColor || indicOptions.color), dashStyle: indicOptions.dashStyle } }, bottom: { styles: { lineWidth: indicOptions.lineWidth, lineColor: (indicOptions.risingTrendColor || indicOptions.color), dashStyle: indicOptions.dashStyle } }, intersect: indicOptions.changeTrendLine }, close = 3, // Supertrend line point point, // Supertrend line next point (has smaller x pos than point) nextPoint, // Main series points mainPoint, nextMainPoint, // Used when supertrend and main points are shifted // relative to each other prevMainPoint, prevPrevMainPoint, // Used when particular point color is set pointColor, // Temporary points that fill groupedPoitns array newPoint, newNextPoint; // Loop which sort supertrend points while (indicPointsLen--) { point = indicPoints[indicPointsLen]; nextPoint = indicPoints[indicPointsLen - 1]; mainPoint = mainLinePoints[indicPointsLen - 1 + offset]; nextMainPoint = mainLinePoints[indicPointsLen - 2 + offset]; prevMainPoint = mainLinePoints[indicPointsLen + offset]; prevPrevMainPoint = mainLinePoints[indicPointsLen + offset + 1]; pointColor = point.options.color; newPoint = { x: point.x, plotX: point.plotX, plotY: point.plotY, isNull: false }; // When mainPoint is the last one (left plot area edge) // but supertrend has additional one if (!nextMainPoint && mainPoint && mainSeries.yData[mainPoint.index - 1]) { nextMainPoint = createPointObj(mainSeries, mainPoint.index - 1, close); } // When prevMainPoint is the last one (right plot area edge) // but supertrend has additional one (and points are shifted) if (!prevPrevMainPoint && prevMainPoint && mainSeries.yData[prevMainPoint.index + 1]) { prevPrevMainPoint = createPointObj(mainSeries, prevMainPoint.index + 1, close); } // When points are shifted (right or left plot area edge) if (!mainPoint && nextMainPoint && mainSeries.yData[nextMainPoint.index + 1]) { mainPoint = createPointObj(mainSeries, nextMainPoint.index + 1, close); } else if (!mainPoint && prevMainPoint && mainSeries.yData[prevMainPoint.index - 1]) { mainPoint = createPointObj(mainSeries, prevMainPoint.index - 1, close); } // Check if points are shifted relative to each other if (point && mainPoint && prevMainPoint && nextMainPoint && point.x !== mainPoint.x) { if (point.x === prevMainPoint.x) { nextMainPoint = mainPoint; mainPoint = prevMainPoint; } else if (point.x === nextMainPoint.x) { mainPoint = nextMainPoint; nextMainPoint = { close: mainSeries.yData[mainPoint.index - 1][close], x: mainSeries.xData[mainPoint.index - 1] }; } else if (prevPrevMainPoint && point.x === prevPrevMainPoint.x) { mainPoint = prevPrevMainPoint; nextMainPoint = prevMainPoint; } } if (nextPoint && nextMainPoint && mainPoint) { newNextPoint = { x: nextPoint.x, plotX: nextPoint.plotX, plotY: nextPoint.plotY, isNull: false }; if (point.y >= mainPoint.close && nextPoint.y >= nextMainPoint.close) { point.color = (pointColor || indicOptions.fallingTrendColor || indicOptions.color); groupedPoitns.top.push(newPoint); } else if (point.y < mainPoint.close && nextPoint.y < nextMainPoint.close) { point.color = (pointColor || indicOptions.risingTrendColor || indicOptions.color); groupedPoitns.bottom.push(newPoint); } else { groupedPoitns.intersect.push(newPoint); groupedPoitns.intersect.push(newNextPoint); // Additional null point to make a gap in line groupedPoitns.intersect.push(merge(newNextPoint, { isNull: true })); if (point.y >= mainPoint.close && nextPoint.y < nextMainPoint.close) { point.color = (pointColor || indicOptions.fallingTrendColor || indicOptions.color); nextPoint.color = (pointColor || indicOptions.risingTrendColor || indicOptions.color); groupedPoitns.top.push(newPoint); groupedPoitns.top.push(merge(newNextPoint, { isNull: true })); } else if (point.y < mainPoint.close && nextPoint.y >= nextMainPoint.close) { point.color = (pointColor || indicOptions.risingTrendColor || indicOptions.color); nextPoint.color = (pointColor || indicOptions.fallingTrendColor || indicOptions.color); groupedPoitns.bottom.push(newPoint); groupedPoitns.bottom.push(merge(newNextPoint, { isNull: true })); } } } else if (mainPoint) { if (point.y >= mainPoint.close) { point.color = (pointColor || indicOptions.fallingTrendColor || indicOptions.color); groupedPoitns.top.push(newPoint); } else { point.color = (pointColor || indicOptions.risingTrendColor || indicOptions.color); groupedPoitns.bottom.push(newPoint); } } } // Generate lines: objectEach(groupedPoitns, function (values, lineName) { indicator.points = values; indicator.options = merge(supertrendLineOptions[lineName].styles, gappedExtend); indicator.graph = indicator['graph' + lineName + 'Line']; SMAIndicator.prototype.drawGraph.call(indicator); // Now save line indicator['graph' + lineName + 'Line'] = indicator.graph; }); // Restore options: indicator.points = indicPoints; indicator.options = indicOptions; indicator.graph = indicPath; }; // Supertrend (Multiplier, Period) Formula: // BASIC UPPERBAND = (HIGH + LOW) / 2 + Multiplier * ATR(Period) // BASIC LOWERBAND = (HIGH + LOW) / 2 - Multiplier * ATR(Period) // FINAL UPPERBAND = // IF( // Current BASICUPPERBAND < Previous FINAL UPPERBAND AND // Previous Close > Previous FINAL UPPERBAND // ) THEN (Current BASIC UPPERBAND) // ELSE (Previous FINALUPPERBAND) // FINAL LOWERBAND = // IF( // Current BASIC LOWERBAND > Previous FINAL LOWERBAND AND // Previous Close < Previous FINAL LOWERBAND // ) THEN (Current BASIC LOWERBAND) // ELSE (Previous FINAL LOWERBAND) // SUPERTREND = // IF( // Previous Supertrend == Previous FINAL UPPERBAND AND // Current Close < Current FINAL UPPERBAND // ) THAN Current FINAL UPPERBAND // ELSE IF( // Previous Supertrend == Previous FINAL LOWERBAND AND // Current Close < Current FINAL LOWERBAND // ) THAN Current FINAL UPPERBAND // ELSE IF( // Previous Supertrend == Previous FINAL UPPERBAND AND // Current Close > Current FINAL UPPERBAND // ) THAN Current FINAL LOWERBAND // ELSE IF( // Previous Supertrend == Previous FINAL LOWERBAND AND // Current Close > Current FINAL LOWERBAND // ) THAN Current FINAL LOWERBAND SupertrendIndicator.prototype.getValues = function (series, params) { var period = params.period, multiplier = params.multiplier, xVal = series.xData, yVal = series.yData, ATRData = [], // 0- date, 1- Supertrend indicator ST = [], xData = [], yData = [], close = 3, low = 2, high = 1, periodsOffset = (period === 0) ? 0 : period - 1, basicUp, basicDown, finalUp = [], finalDown = [], supertrend, prevFinalUp, prevFinalDown, prevST, // previous Supertrend prevY, y, i; if ((xVal.length <= period) || !isArray(yVal[0]) || yVal[0].length !== 4 || period < 0) { return; } ATRData = ATRIndicator.prototype.getValues.call(this, series, { period: period }).yData; for (i = 0; i < ATRData.length; i++) { y = yVal[periodsOffset + i]; prevY = yVal[periodsOffset + i - 1] || []; prevFinalUp = finalUp[i - 1]; prevFinalDown = finalDown[i - 1]; prevST = yData[i - 1]; if (i === 0) { prevFinalUp = prevFinalDown = prevST = 0; } basicUp = correctFloat((y[high] + y[low]) / 2 + multiplier * ATRData[i]); basicDown = correctFloat((y[high] + y[low]) / 2 - multiplier * ATRData[i]); if ((basicUp < prevFinalUp) || (prevY[close] > prevFinalUp)) { finalUp[i] = basicUp; } else { finalUp[i] = prevFinalUp; } if ((basicDown > prevFinalDown) || (prevY[close] < prevFinalDown)) { finalDown[i] = basicDown; } else { finalDown[i] = prevFinalDown; } if (prevST === prevFinalUp && y[close] < finalUp[i] || prevST === prevFinalDown && y[close] < finalDown[i]) { supertrend = finalUp[i]; } else if (prevST === prevFinalUp && y[close] > finalUp[i] || prevST === prevFinalDown && y[close] > finalDown[i]) { supertrend = finalDown[i]; } ST.push([xVal[periodsOffset + i], supertrend]); xData.push(xVal[periodsOffset + i]); yData.push(supertrend); } return { values: ST, xData: xData, yData: yData }; }; /** * Supertrend indicator. This series requires the `linkedTo` option to be * set and should be loaded after the `stock/indicators/indicators.js` and * `stock/indicators/sma.js`. * * @sample {highstock} stock/indicators/supertrend * Supertrend indicator * * @extends plotOptions.sma * @since 7.0.0 * @product highstock * @excluding allAreas, cropThreshold, negativeColor, colorAxis, joinBy, * keys, navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, * stacking, threshold * @requires stock/indicators/indicators * @requires stock/indicators/supertrend * @optionparent plotOptions.supertrend */ SupertrendIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * Paramters used in calculation of Supertrend indicator series points. * * @excluding index */ params: { index: void 0, /** * Multiplier for Supertrend Indicator. */ multiplier: 3, /** * The base period for indicator Supertrend Indicator calculations. * This is the number of data points which are taken into account * for the indicator calculations. */ period: 10 }, /** * Color of the Supertrend series line that is beneath the main series. * * @sample {highstock} stock/indicators/supertrend/ * Example with risingTrendColor * * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} */ risingTrendColor: palette.positiveColor, /** * Color of the Supertrend series line that is above the main series. * * @sample {highstock} stock/indicators/supertrend/ * Example with fallingTrendColor * * @type {Highcharts.ColorString|Highcharts.GradientColorObject|Highcharts.PatternObject} */ fallingTrendColor: palette.negativeColor, /** * The styles for the Supertrend line that intersect main series. * * @sample {highstock} stock/indicators/supertrend/ * Example with changeTrendLine */ changeTrendLine: { styles: { /** * Pixel width of the line. */ lineWidth: 1, /** * Color of the line. * * @type {Highcharts.ColorString} */ lineColor: palette.neutralColor80, /** * The dash or dot style of the grid lines. For possible * values, see * [this demonstration](https://jsfiddle.net/gh/get/library/pure/highcharts/highcharts/tree/master/samples/highcharts/plotoptions/series-dashstyle-all/). * * @sample {highcharts} highcharts/yaxis/gridlinedashstyle/ * Long dashes * @sample {highstock} stock/xaxis/gridlinedashstyle/ * Long dashes * * @type {Highcharts.DashStyleValue} * @since 7.0.0 */ dashStyle: 'LongDash' } } }); return SupertrendIndicator; }(SMAIndicator)); extend(SupertrendIndicator.prototype, { nameBase: 'Supertrend', nameComponents: ['multiplier', 'period'], requiredIndicators: ['atr'] }); SeriesRegistry.registerSeriesType('supertrend', SupertrendIndicator); /* * * * Default Export * * */ /** * A `Supertrend indicator` series. If the [type](#series.supertrend.type) * option is not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.supertrend * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, cropThreshold, data, dataParser, dataURL, * joinBy, keys, navigatorOptions, negativeColor, pointInterval, * pointIntervalUnit, pointPlacement, pointRange, pointStart, * showInNavigator, stacking, threshold * @requires stock/indicators/indicators * @requires stock/indicators/supertrend * @apioption series.supertrend */ ''; // to include the above in the js output return SupertrendIndicator; }); _registerModule(_modules, 'Stock/Indicators/VBP/VBPIndicator.js', [_modules['Core/Animation/AnimationUtilities.js'], _modules['Core/Globals.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (A, H, SeriesRegistry, U) { /* * * * (c) 2010-2021 Paweł Dalek * * Volume By Price (VBP) indicator for Highcharts Stock * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var animObject = A.animObject; var noop = H.noop; var SMAIndicator = SeriesRegistry.seriesTypes.sma; var addEvent = U.addEvent, arrayMax = U.arrayMax, arrayMin = U.arrayMin, correctFloat = U.correctFloat, error = U.error, extend = U.extend, isArray = U.isArray, merge = U.merge; /* eslint-disable require-jsdoc */ // Utils function arrayExtremesOHLC(data) { var dataLength = data.length, min = data[0][3], max = min, i = 1, currentPoint; for (; i < dataLength; i++) { currentPoint = data[i][3]; if (currentPoint < min) { min = currentPoint; } if (currentPoint > max) { max = currentPoint; } } return { min: min, max: max }; } /* eslint-enable require-jsdoc */ var abs = Math.abs, columnPrototype = SeriesRegistry.seriesTypes.column.prototype; /** * The Volume By Price (VBP) series type. * * @private * @class * @name Highcharts.seriesTypes.vbp * * @augments Highcharts.Series */ var VBPIndicator = /** @class */ (function (_super) { __extends(VBPIndicator, _super); function VBPIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.data = void 0; _this.negWidths = void 0; _this.options = void 0; _this.points = void 0; _this.posWidths = void 0; _this.priceZones = void 0; _this.rangeStep = void 0; _this.volumeDataArray = void 0; _this.zoneStarts = void 0; _this.zoneLinesSVG = void 0; return _this; } VBPIndicator.prototype.init = function (chart) { var indicator = this, params, baseSeries, volumeSeries; H.seriesTypes.sma.prototype.init.apply(indicator, arguments); params = indicator.options.params; baseSeries = indicator.linkedParent; volumeSeries = chart.get(params.volumeSeriesID); indicator.addCustomEvents(baseSeries, volumeSeries); return indicator; }; // Adds events related with removing series VBPIndicator.prototype.addCustomEvents = function (baseSeries, volumeSeries) { var indicator = this; /* eslint-disable require-jsdoc */ function toEmptyIndicator() { indicator.chart.redraw(); indicator.setData([]); indicator.zoneStarts = []; if (indicator.zoneLinesSVG) { indicator.zoneLinesSVG = indicator.zoneLinesSVG.destroy(); } } /* eslint-enable require-jsdoc */ // If base series is deleted, indicator series data is filled with // an empty array indicator.dataEventsToUnbind.push(addEvent(baseSeries, 'remove', function () { toEmptyIndicator(); })); // If volume series is deleted, indicator series data is filled with // an empty array if (volumeSeries) { indicator.dataEventsToUnbind.push(addEvent(volumeSeries, 'remove', function () { toEmptyIndicator(); })); } return indicator; }; // Initial animation VBPIndicator.prototype.animate = function (init) { var series = this, inverted = series.chart.inverted, group = series.group, attr = {}, position; if (!init && group) { position = inverted ? series.yAxis.top : series.xAxis.left; if (inverted) { group['forceAnimate:translateY'] = true; attr.translateY = position; } else { group['forceAnimate:translateX'] = true; attr.translateX = position; } group.animate(attr, extend(animObject(series.options.animation), { step: function (val, fx) { series.group.attr({ scaleX: Math.max(0.001, fx.pos) }); } })); } }; VBPIndicator.prototype.drawPoints = function () { var indicator = this; if (indicator.options.volumeDivision.enabled) { indicator.posNegVolume(true, true); columnPrototype.drawPoints.apply(indicator, arguments); indicator.posNegVolume(false, false); } columnPrototype.drawPoints.apply(indicator, arguments); }; // Function responsible for dividing volume into positive and negative VBPIndicator.prototype.posNegVolume = function (initVol, pos) { var indicator = this, signOrder = pos ? ['positive', 'negative'] : ['negative', 'positive'], volumeDivision = indicator.options.volumeDivision, pointLength = indicator.points.length, posWidths = [], negWidths = [], i = 0, pointWidth, priceZone, wholeVol, point; if (initVol) { indicator.posWidths = posWidths; indicator.negWidths = negWidths; } else { posWidths = indicator.posWidths; negWidths = indicator.negWidths; } for (; i < pointLength; i++) { point = indicator.points[i]; point[signOrder[0] + 'Graphic'] = point.graphic; point.graphic = point[signOrder[1] + 'Graphic']; if (initVol) { pointWidth = point.shapeArgs.width; priceZone = indicator.priceZones[i]; wholeVol = priceZone.wholeVolumeData; if (wholeVol) { posWidths.push(pointWidth / wholeVol * priceZone.positiveVolumeData); negWidths.push(pointWidth / wholeVol * priceZone.negativeVolumeData); } else { posWidths.push(0); negWidths.push(0); } } point.color = pos ? volumeDivision.styles.positiveColor : volumeDivision.styles.negativeColor; point.shapeArgs.width = pos ? indicator.posWidths[i] : indicator.negWidths[i]; point.shapeArgs.x = pos ? point.shapeArgs.x : indicator.posWidths[i]; } }; VBPIndicator.prototype.translate = function () { var indicator = this, options = indicator.options, chart = indicator.chart, yAxis = indicator.yAxis, yAxisMin = yAxis.min, zoneLinesOptions = indicator.options.zoneLines, priceZones = (indicator.priceZones), yBarOffset = 0, indicatorPoints, volumeDataArray, maxVolume, primalBarWidth, barHeight, barHeightP, oldBarHeight, barWidth, pointPadding, chartPlotTop, barX, barY; columnPrototype.translate.apply(indicator); indicatorPoints = indicator.points; // Do translate operation when points exist if (indicatorPoints.length) { pointPadding = options.pointPadding < 0.5 ? options.pointPadding : 0.1; volumeDataArray = indicator.volumeDataArray; maxVolume = arrayMax(volumeDataArray); primalBarWidth = chart.plotWidth / 2; chartPlotTop = chart.plotTop; barHeight = abs(yAxis.toPixels(yAxisMin) - yAxis.toPixels(yAxisMin + indicator.rangeStep)); oldBarHeight = abs(yAxis.toPixels(yAxisMin) - yAxis.toPixels(yAxisMin + indicator.rangeStep)); if (pointPadding) { barHeightP = abs(barHeight * (1 - 2 * pointPadding)); yBarOffset = abs((barHeight - barHeightP) / 2); barHeight = abs(barHeightP); } indicatorPoints.forEach(function (point, index) { barX = point.barX = point.plotX = 0; barY = point.plotY = (yAxis.toPixels(priceZones[index].start) - chartPlotTop - (yAxis.reversed ? (barHeight - oldBarHeight) : barHeight) - yBarOffset); barWidth = correctFloat(primalBarWidth * priceZones[index].wholeVolumeData / maxVolume); point.pointWidth = barWidth; point.shapeArgs = indicator.crispCol.apply(// eslint-disable-line no-useless-call indicator, [barX, barY, barWidth, barHeight]); point.volumeNeg = priceZones[index].negativeVolumeData; point.volumePos = priceZones[index].positiveVolumeData; point.volumeAll = priceZones[index].wholeVolumeData; }); if (zoneLinesOptions.enabled) { indicator.drawZones(chart, yAxis, indicator.zoneStarts, zoneLinesOptions.styles); } } }; VBPIndicator.prototype.getValues = function (series, params) { var indicator = this, xValues = series.processedXData, yValues = series.processedYData, chart = indicator.chart, ranges = params.ranges, VBP = [], xData = [], yData = [], isOHLC, volumeSeries, priceZones; // Checks if base series exists if (!series.chart) { error('Base series not found! In case it has been removed, add ' + 'a new one.', true, chart); return; } // Checks if volume series exists if (!(volumeSeries = (chart.get(params.volumeSeriesID)))) { error('Series ' + params.volumeSeriesID + ' not found! Check `volumeSeriesID`.', true, chart); return; } // Checks if series data fits the OHLC format isOHLC = isArray(yValues[0]); if (isOHLC && yValues[0].length !== 4) { error('Type of ' + series.name + ' series is different than line, OHLC or candlestick.', true, chart); return; } // Price zones contains all the information about the zones (index, // start, end, volumes, etc.) priceZones = indicator.priceZones = indicator.specifyZones(isOHLC, xValues, yValues, ranges, volumeSeries); priceZones.forEach(function (zone, index) { VBP.push([zone.x, zone.end]); xData.push(VBP[index][0]); yData.push(VBP[index][1]); }); return { values: VBP, xData: xData, yData: yData }; }; // Specifing where each zone should start ans end VBPIndicator.prototype.specifyZones = function (isOHLC, xValues, yValues, ranges, volumeSeries) { var indicator = this, rangeExtremes = (isOHLC ? arrayExtremesOHLC(yValues) : false), lowRange = rangeExtremes ? rangeExtremes.min : arrayMin(yValues), highRange = rangeExtremes ? rangeExtremes.max : arrayMax(yValues), zoneStarts = indicator.zoneStarts = [], priceZones = [], i = 0, j = 1, rangeStep, zoneStartsLength; if (!lowRange || !highRange) { if (this.points.length) { this.setData([]); this.zoneStarts = []; if (this.zoneLinesSVG) { this.zoneLinesSVG = this.zoneLinesSVG.destroy(); } } return []; } rangeStep = indicator.rangeStep = correctFloat(highRange - lowRange) / ranges; zoneStarts.push(lowRange); for (; i < ranges - 1; i++) { zoneStarts.push(correctFloat(zoneStarts[i] + rangeStep)); } zoneStarts.push(highRange); zoneStartsLength = zoneStarts.length; // Creating zones for (; j < zoneStartsLength; j++) { priceZones.push({ index: j - 1, x: xValues[0], start: zoneStarts[j - 1], end: zoneStarts[j] }); } return indicator.volumePerZone(isOHLC, priceZones, volumeSeries, xValues, yValues); }; // Calculating sum of volume values for a specific zone VBPIndicator.prototype.volumePerZone = function (isOHLC, priceZones, volumeSeries, xValues, yValues) { var indicator = this, volumeXData = volumeSeries.processedXData, volumeYData = volumeSeries.processedYData, lastZoneIndex = priceZones.length - 1, baseSeriesLength = yValues.length, volumeSeriesLength = volumeYData.length, previousValue, startFlag, endFlag, value, i; // Checks if each point has a corresponding volume value if (abs(baseSeriesLength - volumeSeriesLength)) { // If the first point don't have volume, add 0 value at the // beggining of the volume array if (xValues[0] !== volumeXData[0]) { volumeYData.unshift(0); } // If the last point don't have volume, add 0 value at the end // of the volume array if (xValues[baseSeriesLength - 1] !== volumeXData[volumeSeriesLength - 1]) { volumeYData.push(0); } } indicator.volumeDataArray = []; priceZones.forEach(function (zone) { zone.wholeVolumeData = 0; zone.positiveVolumeData = 0; zone.negativeVolumeData = 0; for (i = 0; i < baseSeriesLength; i++) { startFlag = false; endFlag = false; value = isOHLC ? yValues[i][3] : yValues[i]; previousValue = i ? (isOHLC ? yValues[i - 1][3] : yValues[i - 1]) : value; // Checks if this is the point with the // lowest close value and if so, adds it calculations if (value <= zone.start && zone.index === 0) { startFlag = true; } // Checks if this is the point with the highest // close value and if so, adds it calculations if (value >= zone.end && zone.index === lastZoneIndex) { endFlag = true; } if ((value > zone.start || startFlag) && (value < zone.end || endFlag)) { zone.wholeVolumeData += volumeYData[i]; if (previousValue > value) { zone.negativeVolumeData += volumeYData[i]; } else { zone.positiveVolumeData += volumeYData[i]; } } } indicator.volumeDataArray.push(zone.wholeVolumeData); }); return priceZones; }; // Function responsoble for drawing additional lines indicating zones VBPIndicator.prototype.drawZones = function (chart, yAxis, zonesValues, zonesStyles) { var indicator = this, renderer = chart.renderer, zoneLinesSVG = indicator.zoneLinesSVG, zoneLinesPath = [], leftLinePos = 0, rightLinePos = chart.plotWidth, verticalOffset = chart.plotTop, verticalLinePos; zonesValues.forEach(function (value) { verticalLinePos = yAxis.toPixels(value) - verticalOffset; zoneLinesPath = zoneLinesPath.concat(chart.renderer.crispLine([[ 'M', leftLinePos, verticalLinePos ], [ 'L', rightLinePos, verticalLinePos ]], zonesStyles.lineWidth)); }); // Create zone lines one path or update it while animating if (zoneLinesSVG) { zoneLinesSVG.animate({ d: zoneLinesPath }); } else { zoneLinesSVG = indicator.zoneLinesSVG = renderer.path(zoneLinesPath).attr({ 'stroke-width': zonesStyles.lineWidth, 'stroke': zonesStyles.color, 'dashstyle': zonesStyles.dashStyle, 'zIndex': indicator.group.zIndex + 0.1 }) .add(indicator.group); } }; /** * Volume By Price indicator. * * This series requires `linkedTo` option to be set. * * @sample stock/indicators/volume-by-price * Volume By Price indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/volume-by-price * @optionparent plotOptions.vbp */ VBPIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index, period */ params: { // Index and period are unchangeable, do not inherit (#15362) index: void 0, period: void 0, /** * The number of price zones. */ ranges: 12, /** * The id of volume series which is mandatory. For example using * OHLC data, volumeSeriesID='volume' means the indicator will be * calculated using OHLC and volume values. */ volumeSeriesID: 'volume' }, /** * The styles for lines which determine price zones. */ zoneLines: { /** * Enable/disable zone lines. */ enabled: true, /** * Specify the style of zone lines. * * @type {Highcharts.CSSObject} * @default {"color": "#0A9AC9", "dashStyle": "LongDash", "lineWidth": 1} */ styles: { /** @ignore-options */ color: '#0A9AC9', /** @ignore-options */ dashStyle: 'LongDash', /** @ignore-options */ lineWidth: 1 } }, /** * The styles for bars when volume is divided into positive/negative. */ volumeDivision: { /** * Option to control if volume is divided. */ enabled: true, styles: { /** * Color of positive volume bars. * * @type {Highcharts.ColorString} */ positiveColor: 'rgba(144, 237, 125, 0.8)', /** * Color of negative volume bars. * * @type {Highcharts.ColorString} */ negativeColor: 'rgba(244, 91, 91, 0.8)' } }, // To enable series animation; must be animationLimit > pointCount animationLimit: 1000, enableMouseTracking: false, pointPadding: 0, zIndex: -1, crisp: true, dataGrouping: { enabled: false }, dataLabels: { allowOverlap: true, enabled: true, format: 'P: {point.volumePos:.2f} | N: {point.volumeNeg:.2f}', padding: 0, style: { /** @internal */ fontSize: '7px' }, verticalAlign: 'top' } }); return VBPIndicator; }(SMAIndicator)); extend(VBPIndicator.prototype, { nameBase: 'Volume by Price', nameComponents: ['ranges'], bindTo: { series: false, eventName: 'afterSetExtremes' }, calculateOn: 'render', markerAttribs: noop, drawGraph: noop, getColumnMetrics: columnPrototype.getColumnMetrics, crispCol: columnPrototype.crispCol }); SeriesRegistry.registerSeriesType('vbp', VBPIndicator); /* * * * Default Export * * */ /** * A `Volume By Price (VBP)` series. If the [type](#series.vbp.type) option is * not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.vbp * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/volume-by-price * @apioption series.vbp */ ''; // to include the above in the js output return VBPIndicator; }); _registerModule(_modules, 'Stock/Indicators/VWAP/VWAPIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * (c) 2010-2021 Paweł Dalek * * Volume Weighted Average Price (VWAP) indicator for Highcharts Stock * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var error = U.error, isArray = U.isArray, merge = U.merge; /* * * * Class * * */ /** * The Volume Weighted Average Price (VWAP) series type. * * @private * @class * @name Highcharts.seriesTypes.vwap * * @augments Highcharts.Series */ var VWAPIndicator = /** @class */ (function (_super) { __extends(VWAPIndicator, _super); function VWAPIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.points = void 0; _this.options = void 0; return _this; } /* * * * Functions * * */ VWAPIndicator.prototype.getValues = function (series, params) { var indicator = this, chart = series.chart, xValues = series.xData, yValues = series.yData, period = params.period, isOHLC = true, volumeSeries; // Checks if volume series exists if (!(volumeSeries = (chart.get(params.volumeSeriesID)))) { error('Series ' + params.volumeSeriesID + ' not found! Check `volumeSeriesID`.', true, chart); return; } // Checks if series data fits the OHLC format if (!(isArray(yValues[0]))) { isOHLC = false; } return indicator.calculateVWAPValues(isOHLC, xValues, yValues, volumeSeries, period); }; /** * Main algorithm used to calculate Volume Weighted Average Price (VWAP) * values * @private * @param {boolean} isOHLC - says if data has OHLC format * @param {Array<number>} xValues - array of timestamps * @param {Array<number|Array<number,number,number,number>>} yValues - * array of yValues, can be an array of a four arrays (OHLC) or array of * values (line) * @param {Array<*>} volumeSeries - volume series * @param {number} period - number of points to be calculated * @return {object} - Object contains computed VWAP **/ VWAPIndicator.prototype.calculateVWAPValues = function (isOHLC, xValues, yValues, volumeSeries, period) { var volumeValues = volumeSeries.yData, volumeLength = volumeSeries.xData.length, pointsLength = xValues.length, cumulativePrice = [], cumulativeVolume = [], xData = [], yData = [], VWAP = [], commonLength, typicalPrice, cPrice, cVolume, i, j; if (pointsLength <= volumeLength) { commonLength = pointsLength; } else { commonLength = volumeLength; } for (i = 0, j = 0; i < commonLength; i++) { // Depending on whether series is OHLC or line type, price is // average of the high, low and close or a simple value typicalPrice = isOHLC ? ((yValues[i][1] + yValues[i][2] + yValues[i][3]) / 3) : yValues[i]; typicalPrice *= volumeValues[i]; cPrice = j ? (cumulativePrice[i - 1] + typicalPrice) : typicalPrice; cVolume = j ? (cumulativeVolume[i - 1] + volumeValues[i]) : volumeValues[i]; cumulativePrice.push(cPrice); cumulativeVolume.push(cVolume); VWAP.push([xValues[i], (cPrice / cVolume)]); xData.push(VWAP[i][0]); yData.push(VWAP[i][1]); j++; if (j === period) { j = 0; } } return { values: VWAP, xData: xData, yData: yData }; }; /** * Volume Weighted Average Price indicator. * * This series requires `linkedTo` option to be set. * * @sample stock/indicators/vwap * Volume Weighted Average Price indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/vwap * @optionparent plotOptions.vwap */ VWAPIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index */ params: { index: void 0, period: 30, /** * The id of volume series which is mandatory. For example using * OHLC data, volumeSeriesID='volume' means the indicator will be * calculated using OHLC and volume values. */ volumeSeriesID: 'volume' } }); return VWAPIndicator; }(SMAIndicator)); SeriesRegistry.registerSeriesType('vwap', VWAPIndicator); /* * * * Default Export * * */ /** * A `Volume Weighted Average Price (VWAP)` series. If the * [type](#series.vwap.type) option is not specified, it is inherited from * [chart.type](#chart.type). * * @extends series,plotOptions.vwap * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/vwap * @apioption series.vwap */ ''; // to include the above in the js output return VWAPIndicator; }); _registerModule(_modules, 'Stock/Indicators/WilliamsR/WilliamsRIndicator.js', [_modules['Mixins/ReduceArray.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (ReduceArrayMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var getArrayExtremes = ReduceArrayMixin.getArrayExtremes; var SMAIndicator = SeriesRegistry.seriesTypes.sma; var extend = U.extend, isArray = U.isArray, merge = U.merge; /** * The Williams %R series type. * * @private * @class * @name Highcharts.seriesTypes.williamsr * * @augments Highcharts.Series */ var WilliamsRIndicator = /** @class */ (function (_super) { __extends(WilliamsRIndicator, _super); function WilliamsRIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } WilliamsRIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, WR = [], // 0- date, 1- Williams %R xData = [], yData = [], slicedY, close = 3, low = 2, high = 1, extremes, R, HH, // Highest high value in period LL, // Lowest low value in period CC, // Current close value i; // Williams %R requires close value if (xVal.length < period || !isArray(yVal[0]) || yVal[0].length !== 4) { return; } // For a N-period, we start from N-1 point, to calculate Nth point // That is why we later need to comprehend slice() elements list // with (+1) for (i = period - 1; i < yValLen; i++) { slicedY = yVal.slice(i - period + 1, i + 1); extremes = getArrayExtremes(slicedY, low, high); LL = extremes[0]; HH = extremes[1]; CC = yVal[i][close]; R = ((HH - CC) / (HH - LL)) * -100; if (xVal[i]) { WR.push([xVal[i], R]); xData.push(xVal[i]); yData.push(R); } } return { values: WR, xData: xData, yData: yData }; }; /** * Williams %R. This series requires the `linkedTo` option to be * set and should be loaded after the `stock/indicators/indicators.js`. * * @sample {highstock} stock/indicators/williams-r * Williams %R * * @extends plotOptions.sma * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, joinBy, keys, navigatorOptions, * pointInterval, pointIntervalUnit, pointPlacement, * pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/williams-r * @optionparent plotOptions.williamsr */ WilliamsRIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * Paramters used in calculation of Williams %R series points. * @excluding index */ params: { index: void 0, /** * Period for Williams %R oscillator */ period: 14 } }); return WilliamsRIndicator; }(SMAIndicator)); extend(WilliamsRIndicator.prototype, { nameBase: 'Williams %R' }); SeriesRegistry.registerSeriesType('williamsr', WilliamsRIndicator); /* * * * Default Export * * */ /** * A `Williams %R Oscillator` series. If the [type](#series.williamsr.type) * option is not specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.williamsr * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, dataParser, dataURL, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/williams-r * @apioption series.williamsr */ ''; // adds doclets above to the transpiled file return WilliamsRIndicator; }); _registerModule(_modules, 'Stock/Indicators/WMA/WMAIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * (c) 2010-2021 Kacper Madej * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var isArray = U.isArray, merge = U.merge; /* eslint-disable valid-jsdoc */ // Utils: /** * @private */ function accumulateAverage(points, xVal, yVal, i, index) { var xValue = xVal[i], yValue = index < 0 ? yVal[i] : yVal[i][index]; points.push([xValue, yValue]); } /** * @private */ function weightedSumArray(array, pLen) { // The denominator is the sum of the number of days as a triangular number. // If there are 5 days, the triangular numbers are 5, 4, 3, 2, and 1. // The sum is 5 + 4 + 3 + 2 + 1 = 15. var denominator = (pLen + 1) / 2 * pLen; // reduce VS loop => reduce return array.reduce(function (prev, cur, i) { return [null, prev[1] + cur[1] * (i + 1)]; })[1] / denominator; } /** * @private */ function populateAverage(points, xVal, yVal, i) { var pLen = points.length, wmaY = weightedSumArray(points, pLen), wmaX = xVal[i - 1]; points.shift(); // remove point until range < period return [wmaX, wmaY]; } /* eslint-enable valid-jsdoc */ /** * The SMA series type. * * @private * @class * @name Highcharts.seriesTypes.wma * * @augments Highcharts.Series */ var WMAIndicator = /** @class */ (function (_super) { __extends(WMAIndicator, _super); function WMAIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } WMAIndicator.prototype.getValues = function (series, params) { var period = params.period, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, range = 1, xValue = xVal[0], yValue = yVal[0], WMA = [], xData = [], yData = [], index = -1, i, points, WMAPoint; if (xVal.length < period) { return; } // Switch index for OHLC / Candlestick if (isArray(yVal[0])) { index = params.index; yValue = yVal[0][index]; } // Starting point points = [[xValue, yValue]]; // Accumulate first N-points while (range !== period) { accumulateAverage(points, xVal, yVal, range, index); range++; } // Calculate value one-by-one for each period in visible data for (i = range; i < yValLen; i++) { WMAPoint = populateAverage(points, xVal, yVal, i); WMA.push(WMAPoint); xData.push(WMAPoint[0]); yData.push(WMAPoint[1]); accumulateAverage(points, xVal, yVal, i, index); } WMAPoint = populateAverage(points, xVal, yVal, i); WMA.push(WMAPoint); xData.push(WMAPoint[0]); yData.push(WMAPoint[1]); return { values: WMA, xData: xData, yData: yData }; }; /** * Weighted moving average indicator (WMA). This series requires `linkedTo` * option to be set. * * @sample stock/indicators/wma * Weighted moving average indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/wma * @optionparent plotOptions.wma */ WMAIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { index: 3, period: 9 } }); return WMAIndicator; }(SMAIndicator)); SeriesRegistry.registerSeriesType('wma', WMAIndicator); /* * * * Default Export * * */ /** * A `WMA` series. If the [type](#series.wma.type) option is not specified, it * is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.wma * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/wma * @apioption series.wma */ ''; // adds doclet above to the transpiled file return WMAIndicator; }); _registerModule(_modules, 'Stock/Indicators/Zigzag/ZigzagIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * (c) 2010-2021 Kacper Madej * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var merge = U.merge, extend = U.extend; /* * * * Class * * */ /** * The Zig Zag series type. * * @private * @class * @name Highcharts.seriesTypes.zigzag * * @augments Highcharts.Series */ var ZigzagIndicator = /** @class */ (function (_super) { __extends(ZigzagIndicator, _super); function ZigzagIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.points = void 0; _this.options = void 0; return _this; } /* * * * Functions * * */ ZigzagIndicator.prototype.getValues = function (series, params) { var lowIndex = params.lowIndex, highIndex = params.highIndex, deviation = params.deviation / 100, deviations = { 'low': 1 + deviation, 'high': 1 - deviation }, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, zigzag = [], xData = [], yData = [], i, j, zigzagPoint, firstZigzagLow, firstZigzagHigh, directionUp, zigzagLen, exitLoop = false, yIndex = false; // Exit if not enught points or no low or high values if (!xVal || xVal.length <= 1 || (yValLen && (typeof yVal[0][lowIndex] === 'undefined' || typeof yVal[0][highIndex] === 'undefined'))) { return; } // Set first zigzag point candidate firstZigzagLow = yVal[0][lowIndex]; firstZigzagHigh = yVal[0][highIndex]; // Search for a second zigzag point candidate, // this will also set first zigzag point for (i = 1; i < yValLen; i++) { // requried change to go down if (yVal[i][lowIndex] <= firstZigzagHigh * deviations.high) { zigzag.push([xVal[0], firstZigzagHigh]); // second zigzag point candidate zigzagPoint = [xVal[i], yVal[i][lowIndex]]; // next line will be going up directionUp = true; exitLoop = true; // requried change to go up } else if (yVal[i][highIndex] >= firstZigzagLow * deviations.low) { zigzag.push([xVal[0], firstZigzagLow]); // second zigzag point candidate zigzagPoint = [xVal[i], yVal[i][highIndex]]; // next line will be going down directionUp = false; exitLoop = true; } if (exitLoop) { xData.push(zigzag[0][0]); yData.push(zigzag[0][1]); j = i++; i = yValLen; } } // Search for next zigzags for (i = j; i < yValLen; i++) { if (directionUp) { // next line up // lower when going down -> change zigzag candidate if (yVal[i][lowIndex] <= zigzagPoint[1]) { zigzagPoint = [xVal[i], yVal[i][lowIndex]]; } // requried change to go down -> new zigzagpoint and // direction change if (yVal[i][highIndex] >= zigzagPoint[1] * deviations.low) { yIndex = highIndex; } } else { // next line down // higher when going up -> change zigzag candidate if (yVal[i][highIndex] >= zigzagPoint[1]) { zigzagPoint = [xVal[i], yVal[i][highIndex]]; } // requried change to go down -> new zigzagpoint and // direction change if (yVal[i][lowIndex] <= zigzagPoint[1] * deviations.high) { yIndex = lowIndex; } } if (yIndex !== false) { // new zigzag point and direction change zigzag.push(zigzagPoint); xData.push(zigzagPoint[0]); yData.push(zigzagPoint[1]); zigzagPoint = [xVal[i], yVal[i][yIndex]]; directionUp = !directionUp; yIndex = false; } } zigzagLen = zigzag.length; // no zigzag for last point if (zigzagLen !== 0 && zigzag[zigzagLen - 1][0] < xVal[yValLen - 1]) { // set last point from zigzag candidate zigzag.push(zigzagPoint); xData.push(zigzagPoint[0]); yData.push(zigzagPoint[1]); } return { values: zigzag, xData: xData, yData: yData }; }; /** * Zig Zag indicator. * * This series requires `linkedTo` option to be set. * * @sample stock/indicators/zigzag * Zig Zag indicator * * @extends plotOptions.sma * @since 6.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/zigzag * @optionparent plotOptions.zigzag */ ZigzagIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding index, period */ params: { // Index and period are unchangeable, do not inherit (#15362) index: void 0, period: void 0, /** * The point index which indicator calculations will base - low * value. * * For example using OHLC data, index=2 means the indicator will be * calculated using Low values. */ lowIndex: 2, /** * The point index which indicator calculations will base - high * value. * * For example using OHLC data, index=1 means the indicator will be * calculated using High values. */ highIndex: 1, /** * The threshold for the value change. * * For example deviation=1 means the indicator will ignore all price * movements less than 1%. */ deviation: 1 } }); return ZigzagIndicator; }(SMAIndicator)); extend(ZigzagIndicator.prototype, { nameComponents: ['deviation'], nameSuffixes: ['%'], nameBase: 'Zig Zag' }); SeriesRegistry.registerSeriesType('zigzag', ZigzagIndicator); /* * * * Default Export * * */ /** * A `Zig Zag` series. If the [type](#series.zigzag.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.zigzag * @since 6.0.0 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/zigzag * @apioption series.zigzag */ ''; // adds doclets above to transpiled file return ZigzagIndicator; }); _registerModule(_modules, 'Stock/Indicators/LinearRegression/LinearRegression.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /** * * (c) 2010-2021 Kamil Kulig * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var isArray = U.isArray, extend = U.extend, merge = U.merge; /* * * * Class * * */ /** * Linear regression series type. * * @private * @class * @name Highcharts.seriesTypes.linearregression * * @augments Highcharts.Series */ var LinearRegressionIndicator = /** @class */ (function (_super) { __extends(LinearRegressionIndicator, _super); function LinearRegressionIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ /** * Return the slope and intercept of a straight line function. * @private * @param {Highcharts.LinearRegressionIndicator} this indicator to use * @param {Array<number>} xData - list of all x coordinates in a period * @param {Array<number>} yData - list of all y coordinates in a period * @return {Highcharts.RegressionLineParametersObject} * object that contains the slope and the intercept * of a straight line function */ LinearRegressionIndicator.prototype.getRegressionLineParameters = function (xData, yData) { // least squares method var yIndex = this.options.params.index, getSingleYValue = function (yValue, yIndex) { return isArray(yValue) ? yValue[yIndex] : yValue; }, xSum = xData.reduce(function (accX, val) { return val + accX; }, 0), ySum = yData.reduce(function (accY, val) { return getSingleYValue(val, yIndex) + accY; }, 0), xMean = xSum / xData.length, yMean = ySum / yData.length, xError, yError, formulaNumerator = 0, formulaDenominator = 0, i, slope; for (i = 0; i < xData.length; i++) { xError = xData[i] - xMean; yError = getSingleYValue(yData[i], yIndex) - yMean; formulaNumerator += xError * yError; formulaDenominator += Math.pow(xError, 2); } slope = formulaDenominator ? formulaNumerator / formulaDenominator : 0; // don't divide by 0 return { slope: slope, intercept: yMean - slope * xMean }; }; /** * Return the y value on a straight line. * @private * @param {Highcharts.RegressionLineParametersObject} lineParameters * object that contains the slope and the intercept * of a straight line function * @param {number} endPointX - x coordinate of the point * @return {number} - y value of the point that lies on the line */ LinearRegressionIndicator.prototype.getEndPointY = function (lineParameters, endPointX) { return lineParameters.slope * endPointX + lineParameters.intercept; }; /** * Transform the coordinate system so that x values start at 0 and * apply xAxisUnit. * @private * @param {Array<number>} xData - list of all x coordinates in a period * @param {number} xAxisUnit - option (see the API) * @return {Array<number>} - array of transformed x data */ LinearRegressionIndicator.prototype.transformXData = function (xData, xAxisUnit) { var xOffset = xData[0]; return xData.map(function (xValue) { return (xValue - xOffset) / xAxisUnit; }); }; /** * Find the closest distance between points in the base series. * @private * @param {Array<number>} xData list of all x coordinates in the base series * @return {number} - closest distance between points in the base series */ LinearRegressionIndicator.prototype.findClosestDistance = function (xData) { var distance, closestDistance, i; for (i = 1; i < xData.length - 1; i++) { distance = xData[i] - xData[i - 1]; if (distance > 0 && (typeof closestDistance === 'undefined' || distance < closestDistance)) { closestDistance = distance; } } return closestDistance; }; // Required to be implemented - starting point for indicator's logic LinearRegressionIndicator.prototype.getValues = function (baseSeries, regressionSeriesParams) { var xData = baseSeries.xData, yData = baseSeries.yData, period = regressionSeriesParams.period, lineParameters, i, periodStart, periodEnd, // format required to be returned indicatorData = { xData: [], yData: [], values: [] }, endPointX, endPointY, periodXData, periodYData, periodTransformedXData, xAxisUnit = this.options.params.xAxisUnit || this.findClosestDistance(xData); // Iteration logic: x value of the last point within the period // (end point) is used to represent the y value (regression) // of the entire period. for (i = period - 1; i <= xData.length - 1; i++) { periodStart = i - period + 1; // adjusted for slice() function periodEnd = i + 1; // (as above) endPointX = xData[i]; periodXData = xData.slice(periodStart, periodEnd); periodYData = yData.slice(periodStart, periodEnd); periodTransformedXData = this.transformXData(periodXData, xAxisUnit); lineParameters = this.getRegressionLineParameters(periodTransformedXData, periodYData); endPointY = this.getEndPointY(lineParameters, periodTransformedXData[periodTransformedXData.length - 1]); // @todo this is probably not used anywhere indicatorData.values.push({ regressionLineParameters: lineParameters, x: endPointX, y: endPointY }); indicatorData.xData.push(endPointX); indicatorData.yData.push(endPointY); } return indicatorData; }; /** * Linear regression indicator. This series requires `linkedTo` option to be * set. * * @sample {highstock} stock/indicators/linear-regression * Linear regression indicator * * @extends plotOptions.sma * @since 7.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/linearregression * @optionparent plotOptions.linearregression */ LinearRegressionIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { /** * Unit (in milliseconds) for the x axis distances used to * compute the regression line paramters (slope & intercept) for * every range. In Highcharts Stock the x axis values are always * represented in milliseconds which may cause that distances * between points are "big" integer numbers. * * Highcharts Stock's linear regression algorithm (least squares * method) will utilize these "big" integers for finding the * slope and the intercept of the regression line for each * period. In consequence, this value may be a very "small" * decimal number that's hard to interpret by a human. * * For instance: `xAxisUnit` equealed to `86400000` ms (1 day) * forces the algorithm to treat `86400000` as `1` while * computing the slope and the intercept. This may enchance the * legiblitity of the indicator's values. * * Default value is the closest distance between two data * points. * * In `v9.0.2`, the default value has been changed * from `undefined` to `null`. * * @sample {highstock} stock/plotoptions/linear-regression-xaxisunit * xAxisUnit set to 1 minute * * @example * // In Liniear Regression Slope Indicator series `xAxisUnit`is * // `86400000` (1 day) and period is `3`. There're 3 points in * // the base series: * * data: [ * [Date.UTC(2020, 0, 1), 1], * [Date.UTC(2020, 0, 2), 3], * [Date.UTC(2020, 0, 3), 5] * ] * * // This will produce one point in the indicator series that * // has a `y` value of `2` (slope of the regression line). If * // we change the `xAxisUnit` to `1` (ms) the value of the * // indicator's point will be `2.3148148148148148e-8` which is * // harder to interpert for a human. * * @type {null|number} * @product highstock */ xAxisUnit: null }, tooltip: { valueDecimals: 4 } }); return LinearRegressionIndicator; }(SMAIndicator)); extend(LinearRegressionIndicator.prototype, { nameBase: 'Linear Regression Indicator' }); SeriesRegistry.registerSeriesType('linearRegression', LinearRegressionIndicator); /* * * * Default Export * * */ /** * A linear regression series. If the * [type](#series.linearregression.type) option is not specified, it is * inherited from [chart.type](#chart.type). * * @extends series,plotOptions.linearregression * @since 7.0.0 * @product highstock * @excluding dataParser,dataURL * @requires stock/indicators/indicators * @requires stock/indicators/linearregression * @apioption series.linearregression */ ''; // to include the above in the js output return LinearRegressionIndicator; }); _registerModule(_modules, 'Stock/Indicators/LinearRegressionSlopes/LinearRegressionSlopes.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /** * * (c) 2010-2021 Kamil Kulig * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var LinearRegressionIndicator = SeriesRegistry.seriesTypes.linearRegression; var extend = U.extend, merge = U.merge; /* * * * Class * * */ /** * The Linear Regression Slope series type. * * @private * @class * @name Highcharts.seriesTypes.linearRegressionSlope * * @augments Highcharts.Series */ var LinearRegressionSlopesIndicator = /** @class */ (function (_super) { __extends(LinearRegressionSlopesIndicator, _super); function LinearRegressionSlopesIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ LinearRegressionSlopesIndicator.prototype.getEndPointY = function (lineParameters) { return lineParameters.slope; }; /** * Linear regression slope indicator. This series requires `linkedTo` * option to be set. * * @sample {highstock} stock/indicators/linear-regression-slope * Linear regression slope indicator * * @extends plotOptions.linearregression * @since 7.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/linearregression * @optionparent plotOptions.linearregressionslope */ LinearRegressionSlopesIndicator.defaultOptions = merge(LinearRegressionIndicator.defaultOptions); return LinearRegressionSlopesIndicator; }(LinearRegressionIndicator)); extend(LinearRegressionSlopesIndicator.prototype, { nameBase: 'Linear Regression Slope Indicator' }); SeriesRegistry.registerSeriesType('linearRegressionSlope', LinearRegressionSlopesIndicator); /* * * * Default Export * * */ /** * A linear regression intercept series. If the * [type](#series.linearregressionslope.type) option is not specified, it is * inherited from [chart.type](#chart.type). * * @extends series,plotOptions.linearregressionslope * @since 7.0.0 * @product highstock * @excluding dataParser,dataURL * @requires stock/indicators/indicators * @requires stock/indicators/linearregressionslope * @apioption series.linearregressionslope */ ''; // to include the above in the js output return LinearRegressionSlopesIndicator; }); _registerModule(_modules, 'Stock/Indicators/LinearRegressionIntercept/LinearRegressionIntercept.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /** * * (c) 2010-2021 Kamil Kulig * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var LinearRegressionIndicator = SeriesRegistry.seriesTypes.linearRegression; var extend = U.extend, merge = U.merge; /* * * * Class * * */ /** * The Linear Regression Intercept series type. * * @private * @class * @name Highcharts.seriesTypes.linearRegressionIntercept * * @augments Highcharts.Series */ var LinearRegressionInterceptIndicator = /** @class */ (function (_super) { __extends(LinearRegressionInterceptIndicator, _super); function LinearRegressionInterceptIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ LinearRegressionInterceptIndicator.prototype.getEndPointY = function (lineParameters) { return lineParameters.intercept; }; /** * Linear regression intercept indicator. This series requires `linkedTo` * option to be set. * * @sample {highstock} stock/indicators/linear-regression-intercept * Linear intercept slope indicator * * @extends plotOptions.linearregression * @since 7.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/linearregressionintercept * @optionparent plotOptions.linearregressionintercept */ LinearRegressionInterceptIndicator.defaultOptions = merge(LinearRegressionIndicator.defaultOptions); return LinearRegressionInterceptIndicator; }(LinearRegressionIndicator)); extend(LinearRegressionInterceptIndicator.prototype, { nameBase: 'Linear Regression Intercept Indicator' }); SeriesRegistry.registerSeriesType('linearRegressionIntercept', LinearRegressionInterceptIndicator); /* * * * Default Export * * */ /** * A linear regression intercept series. If the * [type](#series.linearregressionintercept.type) option is not specified, it is * inherited from [chart.type](#chart.type). * * @extends series,plotOptions.linearregressionintercept * @since 7.0.0 * @product highstock * @excluding dataParser,dataURL * @requires stock/indicators/indicators * @requires stock/indicators/linearregressionintercept * @apioption series.linearregressionintercept */ ''; // to include the above in the js output return LinearRegressionInterceptIndicator; }); _registerModule(_modules, 'Stock/Indicators/LinearRegressionAngle/LinearRegressionAngle.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /** * * (c) 2010-2021 Kamil Kulig * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var LinearRegressionIndicator = SeriesRegistry.seriesTypes.linearRegression; var extend = U.extend, merge = U.merge; /* * * * Class * * */ /** * The Linear Regression Angle series type. * * @private * @class * @name Highcharts.seriesTypes.linearRegressionAngle * * @augments Highcharts.Series */ var LinearRegressionAngleIndicator = /** @class */ (function (_super) { __extends(LinearRegressionAngleIndicator, _super); function LinearRegressionAngleIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ /** * Convert a slope of a line to angle (in degrees) between * the line and x axis * @private * @param {number} slope of the straight line function * @return {number} angle in degrees */ LinearRegressionAngleIndicator.prototype.slopeToAngle = function (slope) { return Math.atan(slope) * (180 / Math.PI); // rad to deg }; LinearRegressionAngleIndicator.prototype.getEndPointY = function (lineParameters) { return this.slopeToAngle(lineParameters.slope); }; /** * Linear regression angle indicator. This series requires `linkedTo` * option to be set. * * @sample {highstock} stock/indicators/linear-regression-angle * Linear intercept angle indicator * * @extends plotOptions.linearregression * @since 7.0.0 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/linearregressionangle * @optionparent plotOptions.linearregressionangle */ LinearRegressionAngleIndicator.defaultOptions = merge(LinearRegressionIndicator.defaultOptions, { tooltip: { pointFormat: '<span style="color:{point.color}">\u25CF</span>' + '{series.name}: <b>{point.y}°</b><br/>' } }); return LinearRegressionAngleIndicator; }(LinearRegressionIndicator)); extend(LinearRegressionAngleIndicator.prototype, { nameBase: 'Linear Regression Angle Indicator' }); SeriesRegistry.registerSeriesType('linearRegressionAngle', LinearRegressionAngleIndicator); /* * * * Default Export * * */ /** * A linear regression intercept series. If the * [type](#series.linearregressionangle.type) option is not specified, it is * inherited from [chart.type](#chart.type). * * @extends series,plotOptions.linearregressionangle * @since 7.0.0 * @product highstock * @excluding dataParser,dataURL * @requires stock/indicators/indicators * @requires stock/indicators/linearregressionangle * @apioption series.linearregressionangle */ ''; // to include the above in the js output return LinearRegressionAngleIndicator; }); _registerModule(_modules, 'Stock/Indicators/ABands/ABandsIndicator.js', [_modules['Mixins/MultipleLines.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (MultipleLinesMixin, SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var correctFloat = U.correctFloat, extend = U.extend, merge = U.merge; /* eslint-disable valid-jsdoc */ /** * @private */ function getBaseForBand(low, high, factor) { return (((correctFloat(high - low)) / ((correctFloat(high + low)) / 2)) * 1000) * factor; } /** * @private */ function getPointUB(high, base) { return high * (correctFloat(1 + 2 * base)); } /** * @private */ function getPointLB(low, base) { return low * (correctFloat(1 - 2 * base)); } /* eslint-enable valid-jsdoc */ /** * The ABands series type * * @private * @class * @name Highcharts.seriesTypes.abands * * @augments Highcharts.Series */ var ABandsIndicator = /** @class */ (function (_super) { __extends(ABandsIndicator, _super); function ABandsIndicator() { /* * * * Static Properties * * */ var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ ABandsIndicator.prototype.getValues = function (series, params) { var period = params.period, factor = params.factor, index = params.index, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, // Upperbands UB = [], // Lowerbands LB = [], // ABANDS array structure: // 0-date, 1-top line, 2-middle line, 3-bottom line ABANDS = [], // middle line, top line and bottom line ML, TL, BL, date, bandBase, pointSMA, ubSMA, lbSMA, low = 2, high = 1, xData = [], yData = [], slicedX, slicedY, i; if (yValLen < period) { return; } for (i = 0; i <= yValLen; i++) { // Get UB and LB values of every point. This condition // is necessary, because there is a need to calculate current // UB nad LB values simultaneously with given period SMA // in one for loop. if (i < yValLen) { bandBase = getBaseForBand(yVal[i][low], yVal[i][high], factor); UB.push(getPointUB(yVal[i][high], bandBase)); LB.push(getPointLB(yVal[i][low], bandBase)); } if (i >= period) { slicedX = xVal.slice(i - period, i); slicedY = yVal.slice(i - period, i); ubSMA = _super.prototype.getValues.call(this, { xData: slicedX, yData: UB.slice(i - period, i) }, { period: period }); lbSMA = _super.prototype.getValues.call(this, { xData: slicedX, yData: LB.slice(i - period, i) }, { period: period }); pointSMA = _super.prototype.getValues.call(this, { xData: slicedX, yData: slicedY }, { period: period, index: index }); date = pointSMA.xData[0]; TL = ubSMA.yData[0]; BL = lbSMA.yData[0]; ML = pointSMA.yData[0]; ABANDS.push([date, TL, ML, BL]); xData.push(date); yData.push([TL, ML, BL]); } } return { values: ABANDS, xData: xData, yData: yData }; }; /** * Acceleration bands (ABANDS). This series requires the `linkedTo` option * to be set and should be loaded after the * `stock/indicators/indicators.js`. * * @sample {highstock} stock/indicators/acceleration-bands * Acceleration Bands * * @extends plotOptions.sma * @mixes Highcharts.MultipleLinesMixin * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, * stacking, * @requires stock/indicators/indicators * @requires stock/indicators/acceleration-bands * @optionparent plotOptions.abands */ ABandsIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { period: 20, /** * The algorithms factor value used to calculate bands. * * @product highstock */ factor: 0.001, index: 3 }, lineWidth: 1, topLine: { styles: { /** * Pixel width of the line. */ lineWidth: 1 } }, bottomLine: { styles: { /** * Pixel width of the line. */ lineWidth: 1 } }, dataGrouping: { approximation: 'averages' } }); return ABandsIndicator; }(SMAIndicator)); extend(ABandsIndicator.prototype, { drawGraph: MultipleLinesMixin.drawGraph, getTranslatedLinesNames: MultipleLinesMixin.getTranslatedLinesNames, linesApiNames: ['topLine', 'bottomLine'], nameBase: 'Acceleration Bands', nameComponents: ['period', 'factor'], pointArrayMap: ['top', 'middle', 'bottom'], pointValKey: 'middle', toYData: MultipleLinesMixin.toYData, translate: MultipleLinesMixin.translate }); SeriesRegistry.registerSeriesType('abands', ABandsIndicator); /* * * * Default Export * * */ /* * * * API Options * * */ /** * An Acceleration bands indicator. If the [type](#series.abands.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.abands * @since 7.0.0 * @product highstock * @excluding allAreas, colorAxis, compare, compareBase, dataParser, dataURL, * joinBy, keys, navigatorOptions, pointInterval, * pointIntervalUnit, pointPlacement, pointRange, pointStart, * stacking, showInNavigator, * @requires stock/indicators/indicators * @requires stock/indicators/acceleration-bands * @apioption series.abands */ ''; // to include the above in jsdoc return ABandsIndicator; }); _registerModule(_modules, 'Stock/Indicators/TrendLine/TrendLineIndicator.js', [_modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (SeriesRegistry, U) { /* * * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var extend = U.extend, merge = U.merge, isArray = U.isArray; /* * * * Class * * */ /** * The Trend line series type. * * @private * @class * @name Highcharts.seriesTypes.trendline * * @augments Highcharts.Series */ var TrendLineIndicator = /** @class */ (function (_super) { __extends(TrendLineIndicator, _super); function TrendLineIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ TrendLineIndicator.prototype.getValues = function (series, params) { var xVal = series.xData, yVal = series.yData, LR = [], xData = [], yData = [], sumX = 0, sumY = 0, sumXY = 0, sumX2 = 0, xValLength = xVal.length, index = params.index, alpha, beta, i, x, y; // Get sums: for (i = 0; i < xValLength; i++) { x = xVal[i]; y = isArray(yVal[i]) ? yVal[i][index] : yVal[i]; sumX += x; sumY += y; sumXY += x * y; sumX2 += x * x; } // Get slope and offset: alpha = (xValLength * sumXY - sumX * sumY) / (xValLength * sumX2 - sumX * sumX); if (isNaN(alpha)) { alpha = 0; } beta = (sumY - alpha * sumX) / xValLength; // Calculate linear regression: for (i = 0; i < xValLength; i++) { x = xVal[i]; y = alpha * x + beta; // Prepare arrays required for getValues() method LR[i] = [x, y]; xData[i] = x; yData[i] = y; } return { xData: xData, yData: yData, values: LR }; }; /** * Trendline (linear regression) fits a straight line to the selected data * using a method called the Sum Of Least Squares. This series requires the * `linkedTo` option to be set. * * @sample stock/indicators/trendline * Trendline indicator * * @extends plotOptions.sma * @since 7.1.3 * @product highstock * @requires stock/indicators/indicators * @requires stock/indicators/trendline * @optionparent plotOptions.trendline */ TrendLineIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { /** * @excluding period */ params: { period: void 0, /** * The point index which indicator calculations will base. For * example using OHLC data, index=2 means the indicator will be * calculated using Low values. * * @default 3 */ index: 3 } }); return TrendLineIndicator; }(SMAIndicator)); extend(TrendLineIndicator.prototype, { nameBase: 'Trendline', nameComponents: false }); SeriesRegistry.registerSeriesType('trendline', TrendLineIndicator); /* * * * Default Export * * */ /** * A `TrendLine` series. If the [type](#series.trendline.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.trendline * @since 7.1.3 * @product highstock * @excluding dataParser, dataURL * @requires stock/indicators/indicators * @requires stock/indicators/trendline * @apioption series.trendline */ ''; // to include the above in the js output return TrendLineIndicator; }); _registerModule(_modules, 'Stock/Indicators/DisparityIndex/DisparityIndexIndicator.js', [_modules['Mixins/IndicatorRequired.js'], _modules['Core/Series/SeriesRegistry.js'], _modules['Core/Utilities.js']], function (RequiredIndicatorMixin, SeriesRegistry, U) { /* * * (c) 2010-2021 Rafal Sebestjanski * * Disparity Index technical indicator for Highcharts Stock * * License: www.highcharts.com/license * * !!!!!!! SOURCE GETS TRANSPILED BY TYPESCRIPT. EDIT TS FILE ONLY. !!!!!!! * * */ var __extends = (this && this.__extends) || (function () { var extendStatics = function (d, b) { extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return extendStatics(d, b); }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); var SMAIndicator = SeriesRegistry.seriesTypes.sma; var correctFloat = U.correctFloat, defined = U.defined, extend = U.extend, isArray = U.isArray, merge = U.merge; /* * * * Class * * */ /** * The Disparity Index series type. * * @private * @class * @name Highcharts.seriesTypes.disparityindex * * @augments Highcharts.Series */ var DisparityIndexIndicator = /** @class */ (function (_super) { __extends(DisparityIndexIndicator, _super); function DisparityIndexIndicator() { var _this = _super !== null && _super.apply(this, arguments) || this; /* * * * Properties * * */ _this.averageIndicator = void 0; _this.data = void 0; _this.options = void 0; _this.points = void 0; return _this; } /* * * * Functions * * */ DisparityIndexIndicator.prototype.init = function () { var args = arguments, ctx = this, // Disparity Index indicator params = args[1].params, // options.params averageType = params && params.average ? params.average : void 0; ctx.averageIndicator = SeriesRegistry.seriesTypes[averageType] || SMAIndicator; // Check if the required average indicator modules is loaded RequiredIndicatorMixin.isParentLoaded(ctx.averageIndicator, averageType, ctx.type, function (indicator) { indicator.prototype.init.apply(ctx, args); return; }); }; DisparityIndexIndicator.prototype.calculateDisparityIndex = function (curPrice, periodAverage) { return correctFloat(curPrice - periodAverage) / periodAverage * 100; }; DisparityIndexIndicator.prototype.getValues = function (series, params) { var index = params.index, xVal = series.xData, yVal = series.yData, yValLen = yVal ? yVal.length : 0, disparityIndexPoint = [], xData = [], yData = [], // "as any" because getValues doesn't exist on typeof Series averageIndicator = this.averageIndicator, isOHLC = isArray(yVal[0]), // Get the average indicator's values values = averageIndicator.prototype.getValues(series, params), yValues = values.yData, start = xVal.indexOf(values.xData[0]); // Check period, if bigger than points length, skip if (!yValues || yValues.length === 0 || !defined(index) || yVal.length <= start) { return; } // Get the Disparity Index indicator's values for (var i = start; i < yValLen; i++) { var disparityIndexValue = this.calculateDisparityIndex(isOHLC ? yVal[i][index] : yVal[i], yValues[i - start]); disparityIndexPoint.push([ xVal[i], disparityIndexValue ]); xData.push(xVal[i]); yData.push(disparityIndexValue); } return { values: disparityIndexPoint, xData: xData, yData: yData }; }; /** * Disparity Index. * This series requires the `linkedTo` option to be set and should * be loaded after the `stock/indicators/indicators.js` file. * * @sample stock/indicators/disparity-index * Disparity Index indicator * * @extends plotOptions.sma * @since 9.1.0 * @product highstock * @excluding allAreas, colorAxis, joinBy, keys, navigatorOptions, * pointInterval, pointIntervalUnit, pointPlacement, * pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/disparity-index * @optionparent plotOptions.disparityindex */ DisparityIndexIndicator.defaultOptions = merge(SMAIndicator.defaultOptions, { params: { /** * The average used to calculate the Disparity Index indicator. * By default it uses SMA. To use other averages, e.g. EMA, * the `stock/indicators/ema.js` file needs to be loaded. * * If value is different than ema|dema|tema|wma, then sma is used. */ average: 'sma', index: 3 }, marker: { enabled: false }, dataGrouping: { approximation: 'averages' } }); return DisparityIndexIndicator; }(SMAIndicator)); extend(DisparityIndexIndicator.prototype, { nameBase: 'Disparity Index', nameComponents: ['period', 'average'] }); SeriesRegistry.registerSeriesType('disparityindex', DisparityIndexIndicator); /* * * * Default Export * * */ /** * The Disparity Index indicator series. * If the [type](#series.disparityindex.type) option is not * specified, it is inherited from [chart.type](#chart.type). * * @extends series,plotOptions.disparityindex * @since 9.1.0 * @product highstock * @excluding allAreas, colorAxis, dataParser, dataURL, joinBy, keys, * navigatorOptions, pointInterval, pointIntervalUnit, * pointPlacement, pointRange, pointStart, showInNavigator, stacking * @requires stock/indicators/indicators * @requires stock/indicators/disparity-index * @apioption series.disparityindex */ ''; // to include the above in the js output return DisparityIndexIndicator; }); _registerModule(_modules, 'masters/indicators/indicators-all.src.js', [], function () { // eslint-disable-next-line max-len // eslint-disable-next-line max-len }); }));
/**! Qoopido.nucleus 3.2.6 | http://nucleus.qoopido.com | (c) 2020 Dirk Lueth */ !function(e){"use strict";provide(["/demand/pledge","../todataurl"],(function(t,a){var n=t.defer();return a.then((function(){0===e.createElement("canvas").toDataURL("image/webp").indexOf("data:image/webp")?n.resolve():n.reject()}),n.reject),n.pledge}))}(document); //# sourceMappingURL=webp.js.map
'use strict'; Object.defineProperty(exports, '__esModule', { value: true }); require('./chunk-805257cc.js'); var __chunk_5 = require('./chunk-13e039f5.js'); require('./chunk-c5b5b708.js'); var __chunk_12 = require('./chunk-385dea12.js'); var Plugin = { install: function install(Vue) { __chunk_5.registerComponent(Vue, __chunk_12.Dropdown); __chunk_5.registerComponent(Vue, __chunk_12.DropdownItem); } }; __chunk_5.use(Plugin); exports.BDropdown = __chunk_12.Dropdown; exports.BDropdownItem = __chunk_12.DropdownItem; exports.default = Plugin;
'use strict' let cli = require('heroku-cli-util') let co = require('co') function * run (context, heroku) { const resolve = require('../../lib/resolve') let id = context.args.addon.split(':')[0] let addon = yield heroku.get(`/addon-services/${encodeURIComponent(id)}`).catch(() => null) if (!addon) addon = (yield resolve.addon(heroku, context.app, id)).addon_service let url = `https://devcenter.heroku.com/articles/${addon.name}` if (context.flags['show-url']) { cli.log(url) } else { cli.log(`Opening ${cli.color.cyan(url)}...`) yield cli.open(url) } } module.exports = { topic: 'addons', command: 'docs', wantsApp: true, needsAuth: true, args: [{name: 'addon'}], flags: [{name: 'show-url', description: 'show URL, do not open browser'}], run: cli.command({preauth: true}, co.wrap(run)), description: "open an add-on's Dev Center documentation in your browser" }
var path = require('path'), problem = require('../problem'); function testIt(tape, result, value, done) { tape.deepEqual( result, {value: value, done: done}, 'iterator.next().value == {value: ' + value + ', done: ' + done + '}' ); } function testRange(tape, solution, isEven, min, max) { var tester = testIt.bind(null, tape), iterator, result; iterator = solution(isEven); tape.equal( typeof iterator.next, 'function', 'returns an ' + (isEven ? 'even' : 'odd') + ' iterator with .next()' ); for (var i = min; i <= max; i += 2) { result = iterator.next(); tester(result, i, false); } } module.exports = { title: 'Introduction To Generators', problem: problem(__dirname, function (args, t) { var solution = require(path.resolve(args[0])); t.equal(typeof solution, 'function', 'you exported a function'); testRange(t, solution, true, 2, 10); testRange(t, solution, false, 1, 9); t.end(); }) }
'use strict' const jsonfile = require('jsonfile') const spawn = require('child_process').spawn const exec = require('child_process').exec const path = require('path') const source = path.join(__dirname, 'fixtures/injection-endpoints.json') const async = require('async') const chalk = require('chalk') const endpoints = jsonfile.readFileSync(source, { throws: false }) if (!endpoints) { console.error('Invalid JSON file.') process.exit(1) } function findPython2 (pythonCommand, done) { return exec(`${pythonCommand} --version`, function (err, stdout, stderr) { if (err) { return done(null, false) } if (stderr.indexOf('Python 2.') >= 0) { console.log(chalk.green(`'${pythonCommand}' is a valid Python2 ✔️`)) return done(null, true) } return done(null, false) }) } function executeMap (command, config, urlDescription, done) { console.log('Python command that will be used:', command) const params = [ `./node_modules/sqlmap/sqlmap.py`, `--url=${urlDescription.url}`, `--method=${urlDescription.method}`, `--headers=${urlDescription.headers}`, `--level=${config.level}`, `--risk=${config.risk}`, `--dbms=${config.dbms}`, `--timeout=${config.timeout}`, `-v`, `${config.verbose}`, `--flush-session`, `--batch` ] if (urlDescription.params) { params.push(`-p`) params.push(`${urlDescription.params}`) } if (urlDescription.data) { params.push(`--data=${urlDescription.data}`) } console.log(chalk.green('executing sqlmap with: ', (['' + command].concat(params)).join(' '))) const sql = spawn(command, params) let vulnerabilities = false sql.stdout.on('data', (data) => { if (data.length > 1) { console.log(`sqlmap: ${data}`) } if (data.indexOf('identified the following injection') >= 0) { vulnerabilities = true } }) sql.stderr.on('data', (data) => { done(data) }) sql.on('error', (error) => { console.error(chalk.red(error)) done(new Error('failed to start child process')) }) sql.on('close', (code) => { console.log(chalk.green(`child process exited with code ${code}\n`)) done(null, vulnerabilities) }) } const hapi = spawn('node', ['./index.js']) async.detect(['python2', 'python'], findPython2, function (err, python) { if (err) { return console.error(chalk.red(err)) } hapi.stdout.once('data', (data) => { console.log(chalk.green(`hapi: ${data}`)) async.everySeries(endpoints.urls, (urlDescription, done) => { executeMap(python, endpoints, urlDescription, (err, vulnerabilities) => { if (err) { console.error(chalk.red(err)) return done(err, false) } done(null, !vulnerabilities) }) }, (err, result) => { if (err) { console.error(chalk.red(err)) return process.exit(1) } console.log('\n\n') hapi.kill() if (result) { console.log(chalk.green('no injection vulnerabilities found\n\n`')) return process.exit(0) } else { console.error(chalk.red('[CRITICAL] FOUND injection vulnerabilities\n\n')) return process.exit(1) } }) }) hapi.stderr.on('data', (data) => { console.error(chalk.red(`stderr: ${data}`)) }) hapi.on('close', (code) => { console.log(chalk.green(`child process exited with code ${code}`)) }) })
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "m17.73 12.02 3.98-3.98c.39-.39.39-1.02 0-1.41l-4.34-4.34a.9959.9959 0 0 0-1.41 0l-3.98 3.98L8 2.29C7.8 2.1 7.55 2 7.29 2c-.25 0-.51.1-.7.29L2.25 6.63c-.39.39-.39 1.02 0 1.41l3.98 3.98L2.25 16c-.39.39-.39 1.02 0 1.41l4.34 4.34c.39.39 1.02.39 1.41 0l3.98-3.98 3.98 3.98c.2.2.45.29.71.29.26 0 .51-.1.71-.29l4.34-4.34c.39-.39.39-1.02 0-1.41l-3.99-3.98zM12 9c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm-4.71 1.96L3.66 7.34l3.63-3.63 3.62 3.62-3.62 3.63zM10 13c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm2 2c-.55 0-1-.45-1-1s.45-1 1-1 1 .45 1 1-.45 1-1 1zm2-4c.55 0 1 .45 1 1s-.45 1-1 1-1-.45-1-1 .45-1 1-1zm2.66 9.34-3.63-3.62 3.63-3.63 3.62 3.62-3.62 3.63z" }), 'HealingOutlined'); exports.default = _default;
var _ = require('lodash'); module.exports = function(Bookshelf) { var Knex = require('knex'); var config = require(process.env.BOOKSHELF_TEST || './integration/helpers/config'); var Promise = global.testPromise; var MySQL = Bookshelf.initialize({ client: 'mysql', connection: config.mysql, pool: { afterCreate: function(connection, callback) { return Promise.promisify(connection.query, connection)("SET sql_mode='TRADITIONAL';", []).then(function() { callback(null, connection); }); } } }); var PostgreSQL = Bookshelf.initialize({ client: 'postgres', connection: config.postgres, }); var SQLite3 = Bookshelf.initialize({ client: 'sqlite3', connection: config.sqlite3, }); var knexSqlite3 = Knex.initialize({ client: 'sqlite3', connection: config.sqlite3 }); it('should allow creating a Bookshelf client from a Knex instance', function() { var bookshelf = Bookshelf.initialize(knexSqlite3); expect(bookshelf.knex).to.equal(knexSqlite3); }); it('should allow creating a new Bookshelf instance with "new"', function() { var bookshelf = new Bookshelf(knexSqlite3); expect(bookshelf.knex).to.equal(knexSqlite3); }); _.each([MySQL, PostgreSQL, SQLite3], function(bookshelf) { describe('Dialect: ' + bookshelf.knex.client.dialect, function() { before(function() { return require('./integration/helpers/migration')(bookshelf).then(function() { return require('./integration/helpers/inserts')(bookshelf); }); }); this.dialect = bookshelf.knex.client.dialect; // Only testing this against mysql for now, just so the toString is reliable... if (bookshelf.knex.client.dialect === 'mysql') { require('./integration/relation')(bookshelf); } require('./integration/model')(bookshelf); require('./integration/collection')(bookshelf); require('./integration/relations')(bookshelf); require('./integration/plugin')(bookshelf); require('./integration/plugins/virtuals')(bookshelf); require('./integration/plugins/visibility')(bookshelf); require('./integration/plugins/registry')(bookshelf); }); }); };
/*! * # Semantic UI - Dropdown * http://github.com/semantic-org/semantic-ui/ * * * Copyright 2014 Contributors * Released under the MIT license * http://opensource.org/licenses/MIT * */ ;(function ( $, window, document, undefined ) { "use strict"; $.fn.dropdown = function(parameters) { var $allModules = $(this), $document = $(document), moduleSelector = $allModules.selector || '', hasTouch = ('ontouchstart' in document.documentElement), time = new Date().getTime(), performance = [], query = arguments[0], methodInvoked = (typeof query == 'string'), queryArguments = [].slice.call(arguments, 1), returnedValue ; $allModules .each(function() { var settings = ( $.isPlainObject(parameters) ) ? $.extend(true, {}, $.fn.dropdown.settings, parameters) : $.extend({}, $.fn.dropdown.settings), className = settings.className, metadata = settings.metadata, namespace = settings.namespace, selector = settings.selector, error = settings.error, eventNamespace = '.' + namespace, moduleNamespace = 'module-' + namespace, $module = $(this), $text = $module.find(selector.text), $search = $module.find(selector.search), $input = $module.find(selector.input), $combo = ($module.prev().find(selector.text).length > 0) ? $module.prev().find(selector.text) : $module.prev(), $menu = $module.children(selector.menu), $item = $menu.find(selector.item), activated = false, itemActivated = false, element = this, instance = $module.data(moduleNamespace), elementNamespace, id, observer, module ; module = { initialize: function() { module.debug('Initializing dropdown', settings); if( module.is.alreadySetup() ) { module.error(error.alreadySetup); } else { module.setup.layout(); } module.save.defaults(); module.set.selected(); module.create.id(); if(hasTouch) { module.bind.touchEvents(); } module.bind.mouseEvents(); module.bind.keyboardEvents(); module.observeChanges(); module.instantiate(); }, instantiate: function() { module.verbose('Storing instance of dropdown', module); instance = module; $module .data(moduleNamespace, module) ; }, destroy: function() { module.verbose('Destroying previous dropdown for', $module); module.remove.tabbable(); $module .off(eventNamespace) .removeData(moduleNamespace) ; $menu .off(eventNamespace) ; $document .off(elementNamespace) ; }, observeChanges: function() { if('MutationObserver' in window) { observer = new MutationObserver(function(mutations) { if( module.is.selectMutation(mutations) ) { module.debug('<select> modified, recreating menu'); module.setup.select(); } else { module.debug('DOM tree modified, updating selector cache'); module.refresh(); } }); observer.observe(element, { childList : true, subtree : true }); module.debug('Setting up mutation observer', observer); } }, create: { id: function() { id = (Math.random().toString(16) + '000000000').substr(2,8); elementNamespace = '.' + id; module.verbose('Creating unique id for element', id); } }, search: function() { var query ; query = $search.val(); module.verbose('Searching for query', query); module.filter(query); if(module.is.searchSelection() && module.can.show() ) { module.show(); } }, setup: { layout: function() { if( $module.is('select') ) { module.setup.select(); } if( module.is.search() && !module.is.searchable() ) { $search = $('<input />') .addClass(className.search) .insertBefore($text) ; } if(settings.allowTab) { module.set.tabbable(); } }, select: function() { var selectValues = module.get.selectValues() ; module.debug('Dropdown initialized on a select', selectValues); if( $module.is('select') ) { $input = $module; } // see if select is placed correctly already if($input.parent(selector.dropdown).length > 0) { module.debug('UI dropdown already exists. Creating dropdown menu only'); $module = $input.closest(selector.dropdown); $menu = $module.children(selector.menu); if($menu.length === 0) { $menu = $('<div />') .addClass(className.menu) .appendTo($module) ; } $menu.html( settings.templates.menu( selectValues )); } else { module.debug('Creating entire dropdown from select'); $module = $('<div />') .attr('class', $input.attr('class') ) .addClass(className.selection) .addClass(className.dropdown) .html( settings.templates.dropdown(selectValues) ) .insertBefore($input) ; $input .removeAttr('class') .prependTo($module) ; } module.refresh(); } }, refresh: function() { module.verbose('Refreshing selector cache'); $text = $module.find(selector.text); $search = $module.find(selector.search); $input = $module.find(selector.input); $combo = ($module.prev().find(selector.text).length > 0) ? $module.prev().find(selector.text) : $module.prev() ; $menu = $module.children(selector.menu); $item = $menu.find(selector.item); }, toggle: function() { module.verbose('Toggling menu visibility'); if( !module.is.active() ) { module.show(); } else { module.hide(); } }, show: function(callback) { callback = $.isFunction(callback) ? callback : function(){} ; if( module.is.searchSelection() && module.is.allFiltered() ) { return; } if( module.can.show() && !module.is.active() ) { module.debug('Showing dropdown'); module.animate.show(function() { if( module.can.click() ) { module.bind.intent(); } module.set.visible(); callback.call(element); }); settings.onShow.call(element); } }, hide: function(callback) { callback = $.isFunction(callback) ? callback : function(){} ; if( module.is.active() ) { module.debug('Hiding dropdown'); module.animate.hide(function() { module.remove.visible(); callback.call(element); }); settings.onHide.call(element); } }, hideOthers: function() { module.verbose('Finding other dropdowns to hide'); $allModules .not($module) .has(selector.menu + ':visible:not(.' + className.animating + ')') .dropdown('hide') ; }, hideSubMenus: function() { var $subMenus = $menu.find(selector.menu) ; $subMenus.transition('hide'); }, bind: { keyboardEvents: function() { module.debug('Binding keyboard events'); $module .on('keydown' + eventNamespace, module.event.keydown) ; if( module.is.searchable() ) { $module .on(module.get.inputEvent(), selector.search, module.event.input) ; } }, touchEvents: function() { module.debug('Touch device detected binding additional touch events'); if( module.is.searchSelection() ) { // do nothing special yet } else { $module .on('touchstart' + eventNamespace, module.event.test.toggle) ; } $menu .on('touchstart' + eventNamespace, selector.item, module.event.item.mouseenter) ; }, mouseEvents: function() { module.verbose('Mouse detected binding mouse events'); if( module.is.searchSelection() ) { $module .on('mousedown' + eventNamespace, selector.menu, module.event.menu.activate) .on('mouseup' + eventNamespace, selector.menu, module.event.menu.deactivate) .on('click' + eventNamespace, selector.search, module.show) .on('focus' + eventNamespace, selector.search, module.event.searchFocus) .on('blur' + eventNamespace, selector.search, module.event.searchBlur) .on('click' + eventNamespace, selector.text, module.event.searchTextFocus) ; } else { if(settings.on == 'click') { $module .on('click' + eventNamespace, module.event.test.toggle) ; } else if(settings.on == 'hover') { $module .on('mouseenter' + eventNamespace, module.delay.show) .on('mouseleave' + eventNamespace, module.delay.hide) ; } else { $module .on(settings.on + eventNamespace, module.toggle) ; } $module .on('mousedown' + eventNamespace, module.event.mousedown) .on('mouseup' + eventNamespace, module.event.mouseup) .on('focus' + eventNamespace, module.event.focus) .on('blur' + eventNamespace, module.event.blur) ; } $menu .on('mouseenter' + eventNamespace, selector.item, module.event.item.mouseenter) .on('mouseleave' + eventNamespace, selector.item, module.event.item.mouseleave) .on('click' + eventNamespace, selector.item, module.event.item.click) ; }, intent: function() { module.verbose('Binding hide intent event to document'); if(hasTouch) { $document .on('touchstart' + elementNamespace, module.event.test.touch) .on('touchmove' + elementNamespace, module.event.test.touch) ; } $document .on('click' + elementNamespace, module.event.test.hide) ; } }, unbind: { intent: function() { module.verbose('Removing hide intent event from document'); if(hasTouch) { $document .off('touchstart' + elementNamespace) .off('touchmove' + elementNamespace) ; } $document .off('click' + elementNamespace) ; } }, filter: function(searchTerm) { var $results = $(), escapedTerm = module.escape.regExp(searchTerm), exactRegExp = new RegExp('^' + escapedTerm, 'igm'), fullTextRegExp = new RegExp(escapedTerm, 'ig'), allItemsFiltered ; module.verbose('Searching for matching values'); $item .each(function(){ var $choice = $(this), text = String(module.get.choiceText($choice, false)), value = String(module.get.choiceValue($choice, text)) ; if( text.match(exactRegExp) || value.match(exactRegExp) ) { $results = $results.add($choice); } else if(settings.fullTextSearch) { if( text.match(fullTextRegExp) || value.match(fullTextRegExp) ) { $results = $results.add($choice); } } }) ; module.debug('Setting filter', searchTerm); module.remove.filteredItem(); $item .not($results) .addClass(className.filtered) ; module.verbose('Selecting first non-filtered element'); module.remove.selectedItem(); $item .not('.' + className.filtered) .eq(0) .addClass(className.selected) ; if( module.is.allFiltered() ) { module.debug('All items filtered, hiding dropdown', searchTerm); if(module.is.searchSelection()) { module.hide(); } settings.onNoResults.call(element, searchTerm); } }, focusSearch: function() { if( module.is.search() ) { $search .focus() ; } }, forceSelection: function() { var $currentlySelected = $item.not(className.filtered).filter('.' + className.selected).eq(0), $activeItem = $item.filter('.' + className.active).eq(0), $selectedItem = ($currentlySelected.length > 0) ? $currentlySelected : $activeItem, hasSelected = ($selectedItem.size() > 0) ; if(hasSelected) { module.event.item.click.call($selectedItem); module.remove.filteredItem(); } }, event: { // prevents focus callback from occuring on mousedown mousedown: function() { activated = true; }, mouseup: function() { activated = false; }, focus: function() { if(!activated && module.is.hidden()) { module.show(); } }, blur: function(event) { var pageLostFocus = (document.activeElement === this) ; if(!activated && !pageLostFocus) { module.hide(); } }, searchFocus: function() { activated = true; module.show(); }, searchBlur: function(event) { var pageLostFocus = (document.activeElement === this) ; if(!itemActivated && !pageLostFocus) { if(settings.forceSelection) { module.forceSelection(); } else { module.hide(); } } }, searchTextFocus: function(event) { activated = true; $search.focus(); }, input: function(event) { if(module.is.searchSelection()) { module.set.filtered(); } clearTimeout(module.timer); module.timer = setTimeout(module.search, settings.delay.search); }, keydown: function(event) { var $currentlySelected = $item.not(className.filtered).filter('.' + className.selected).eq(0), $activeItem = $menu.children('.' + className.active).eq(0), $selectedItem = ($currentlySelected.length > 0) ? $currentlySelected : $activeItem, $visibleItems = ($selectedItem.length > 0) ? $selectedItem.siblings(':not(.' + className.filtered +')').andSelf() : $menu.children(':not(.' + className.filtered +')'), $subMenu = $selectedItem.children(selector.menu), $parentMenu = $selectedItem.closest(selector.menu), isSubMenuItem = $parentMenu[0] !== $menu[0], inVisibleMenu = $parentMenu.is(':visible'), pressedKey = event.which, keys = { enter : 13, escape : 27, leftArrow : 37, upArrow : 38, rightArrow : 39, downArrow : 40 }, hasSubMenu = ($subMenu.length> 0), hasSelectedItem = ($selectedItem.length > 0), lastVisibleIndex = ($visibleItems.size() - 1), $nextItem, newIndex ; // visible menu keyboard shortcuts if(module.is.visible()) { // enter (select or sub-menu) if(pressedKey == keys.enter && hasSelectedItem) { if(hasSubMenu && !settings.allowCategorySelection) { module.verbose('Pressed enter on unselectable category, opening sub menu'); pressedKey = keys.rightArrow; } else { module.verbose('Enter key pressed, choosing selected item'); module.event.item.click.call($selectedItem, event); } } // left arrow (hide sub-menu) if(pressedKey == keys.leftArrow) { if(isSubMenuItem) { module.verbose('Left key pressed, closing sub-menu'); module.animate.hide(false, $parentMenu); $selectedItem .removeClass(className.selected) ; $parentMenu .closest(selector.item) .addClass(className.selected) ; } event.preventDefault(); } // right arrow (show sub-menu) if(pressedKey == keys.rightArrow) { if(hasSubMenu) { module.verbose('Right key pressed, opening sub-menu'); module.animate.show(false, $subMenu); $selectedItem .removeClass(className.selected) ; $subMenu .find(selector.item).eq(0) .addClass(className.selected) ; } event.preventDefault(); } // up arrow (traverse menu up) if(pressedKey == keys.upArrow) { $nextItem = (hasSelectedItem && inVisibleMenu) ? $selectedItem.prevAll(selector.item + ':not(.' + className.filtered + ')').eq(0) : $item.eq(0) ; if($visibleItems.index( $nextItem ) < 0) { module.verbose('Up key pressed but reached top of current menu'); return; } else { module.verbose('Up key pressed, changing active item'); $selectedItem .removeClass(className.selected) ; $nextItem .addClass(className.selected) ; module.set.scrollPosition($nextItem); } event.preventDefault(); } // down arrow (traverse menu down) if(pressedKey == keys.downArrow) { $nextItem = (hasSelectedItem && inVisibleMenu) ? $nextItem = $selectedItem.nextAll(selector.item + ':not(.' + className.filtered + ')').eq(0) : $item.eq(0) ; if($nextItem.length === 0) { module.verbose('Down key pressed but reached bottom of current menu'); return; } else { module.verbose('Down key pressed, changing active item'); $item .removeClass(className.selected) ; $nextItem .addClass(className.selected) ; module.set.scrollPosition($nextItem); } event.preventDefault(); } } else { // enter (open menu) if(pressedKey == keys.enter) { module.verbose('Enter key pressed, showing dropdown'); module.show(); } // escape (close menu) if(pressedKey == keys.escape) { module.verbose('Escape key pressed, closing dropdown'); module.hide(); } // down arrow (open menu) if(pressedKey == keys.downArrow) { module.verbose('Down key pressed, showing dropdown'); module.show(); } } }, test: { toggle: function(event) { if( module.determine.eventInMenu(event, module.toggle) ) { event.preventDefault(); } }, touch: function(event) { module.determine.eventInMenu(event, function() { if(event.type == 'touchstart') { module.timer = setTimeout(module.hide, settings.delay.touch); } else if(event.type == 'touchmove') { clearTimeout(module.timer); } }); event.stopPropagation(); }, hide: function(event) { module.determine.eventInModule(event, module.hide); } }, menu: { activate: function() { itemActivated = true; }, deactivate: function() { itemActivated = false; } }, item: { mouseenter: function(event) { var $subMenu = $(this).children(selector.menu), $otherMenus = $(this).siblings(selector.item).children(selector.menu) ; if( $subMenu.length > 0 ) { clearTimeout(module.itemTimer); module.itemTimer = setTimeout(function() { module.verbose('Showing sub-menu', $subMenu); $.each($otherMenus, function() { module.animate.hide(false, $(this)); }); module.animate.show(false, $subMenu); }, settings.delay.show); event.preventDefault(); } }, mouseleave: function(event) { var $subMenu = $(this).children(selector.menu) ; if($subMenu.length > 0) { clearTimeout(module.itemTimer); module.itemTimer = setTimeout(function() { module.verbose('Hiding sub-menu', $subMenu); module.animate.hide(false, $subMenu); }, settings.delay.hide); } }, click: function (event) { var $choice = $(this), $target = (event) ? $(event.target) : $(''), $subMenu = $choice.find(selector.menu), text = module.get.choiceText($choice), value = module.get.choiceValue($choice, text), callback = function() { module.remove.searchTerm(); module.determine.selectAction(text, value); }, hasSubMenu = ($subMenu.length > 0), isBubbledEvent = ($subMenu.find($target).length > 0) ; if(!isBubbledEvent && (!hasSubMenu || settings.allowCategorySelection)) { callback(); } } }, resetStyle: function() { $(this).removeAttr('style'); } }, determine: { selectAction: function(text, value) { module.verbose('Determining action', settings.action); if( $.isFunction( module.action[settings.action] ) ) { module.verbose('Triggering preset action', settings.action, text, value); module.action[ settings.action ](text, value); } else if( $.isFunction(settings.action) ) { module.verbose('Triggering user action', settings.action, text, value); settings.action(text, value); } else { module.error(error.action, settings.action); } }, eventInModule: function(event, callback) { callback = $.isFunction(callback) ? callback : function(){} ; if( $(event.target).closest($module).length === 0 ) { module.verbose('Triggering event', callback); callback(); return true; } else { module.verbose('Event occurred in dropdown, canceling callback'); return false; } }, eventInMenu: function(event, callback) { callback = $.isFunction(callback) ? callback : function(){} ; if( $(event.target).closest($menu).length === 0 ) { module.verbose('Triggering event', callback); callback(); return true; } else { module.verbose('Event occurred in dropdown menu, canceling callback'); return false; } } }, action: { nothing: function() {}, activate: function(text, value) { value = (value !== undefined) ? value : text ; module.set.selected(value); module.hide(function() { module.remove.filteredItem(); }); }, select: function(text, value) { value = (value !== undefined) ? value : text ; module.set.selected(value); module.hide(function() { module.remove.filteredItem(); }); }, combo: function(text, value) { value = (value !== undefined) ? value : text ; module.set.selected(value); module.hide(function() { module.remove.filteredItem(); }); }, hide: function() { module.hide(function() { module.remove.filteredItem(); }); } }, get: { id: function() { return id; }, text: function() { return $text.text(); }, value: function() { return ($input.length > 0) ? $input.val() : $module.data(metadata.value) ; }, choiceText: function($choice, preserveHTML) { preserveHTML = (preserveHTML !== undefined) ? preserveHTML : settings.preserveHTML ; if($choice !== undefined) { if($choice.find(selector.menu).length > 0) { module.verbose('Retreiving text of element with sub-menu'); $choice = $choice.clone(); $choice.find(selector.menu).remove(); $choice.find(selector.menuIcon).remove(); } return ($choice.data(metadata.text) !== undefined) ? $choice.data(metadata.text) : (preserveHTML) ? $choice.html().trim() : $choice.text().trim() ; } }, choiceValue: function($choice, choiceText) { choiceText = choiceText || module.get.choiceText($choice); return ($choice.data(metadata.value) !== undefined) ? $choice.data(metadata.value) : (typeof choiceText === 'string') ? choiceText.toLowerCase().trim() : choiceText.trim() ; }, inputEvent: function() { var input = $search[0] ; if(input) { return (input.oninput !== undefined) ? 'input' : (input.onpropertychange !== undefined) ? 'propertychange' : 'keyup' ; } return false; }, selectValues: function() { var select = {} ; select.values = (settings.sortSelect) ? {} // properties will be sorted in object when re-accessed : [] // properties will keep original order in array ; $module .find('option') .each(function() { var name = $(this).html(), value = ( $(this).attr('value') !== undefined ) ? $(this).attr('value') : name ; if(value === '') { select.placeholder = name; } else { if(settings.sortSelect) { select.values[value] = { name : name, value : value }; } else { select.values.push({ name: name, value: value }); } } }) ; if(settings.sortSelect) { module.debug('Retrieved and sorted values from select', select); } else { module.debug('Retreived values from select', select); } return select; }, activeItem: function() { return $item.filter('.' + className.active); }, item: function(value, strict) { var $selectedItem = false ; value = (value !== undefined) ? value : ( module.get.value() !== undefined) ? module.get.value() : module.get.text() ; strict = (value === '' || value === 0) ? true : strict || false ; if(value !== undefined) { $item .each(function() { var $choice = $(this), optionText = module.get.choiceText($choice), optionValue = module.get.choiceValue($choice, optionText) ; if(strict) { module.verbose('Ambiguous dropdown value using strict type check', $choice, value); if( optionValue === value ) { $selectedItem = $(this); } else if( !$selectedItem && optionText === value ) { $selectedItem = $(this); } } else { if( optionValue == value ) { module.verbose('Found select item by value', optionValue, value); $selectedItem = $(this); } else if( !$selectedItem && optionText == value ) { module.verbose('Found select item by text', optionText, value); $selectedItem = $(this); } } }) ; } else { value = module.get.text(); } return $selectedItem || false; } }, restore: { defaults: function() { module.restore.defaultText(); module.restore.defaultValue(); }, defaultText: function() { var defaultText = $module.data(metadata.defaultText) ; module.debug('Restoring default text', defaultText); module.set.text(defaultText); $text.addClass(className.placeholder); }, defaultValue: function() { var defaultValue = $module.data(metadata.defaultValue) ; if(defaultValue !== undefined) { module.debug('Restoring default value', defaultValue); if(defaultValue.length) { module.set.selected(defaultValue); } else { module.remove.activeItem(); module.remove.selectedItem(); } } } }, save: { defaults: function() { module.save.defaultText(); module.save.placeholderText(); module.save.defaultValue(); }, defaultValue: function() { $module.data(metadata.defaultValue, module.get.value() ); }, defaultText: function() { $module.data(metadata.defaultText, $text.text() ); }, placeholderText: function() { if($text.hasClass(className.placeholder)) { $module.data(metadata.placeholderText, $text.text()); } } }, clear: function() { var placeholderText = $module.data(metadata.placeholderText) ; module.set.text(placeholderText); module.set.value(''); module.remove.activeItem(); module.remove.selectedItem(); $text.addClass(className.placeholder); }, set: { filtered: function() { var searchValue = $search.val(), hasSearchValue = (typeof searchValue === 'string' && searchValue.length > 0) ; if(hasSearchValue) { $text.addClass(className.filtered); } else { $text.removeClass(className.filtered); } }, tabbable: function() { if( module.is.searchable() ) { module.debug('Searchable dropdown initialized'); $search .val('') .attr('tabindex', 0) ; $menu .attr('tabindex', '-1') ; } else { module.debug('Simple selection dropdown initialized'); if(!$module.attr('tabindex') ) { $module .attr('tabindex', 0) ; $menu .attr('tabindex', '-1') ; } } }, scrollPosition: function($item, forceScroll) { var edgeTolerance = 5, hasActive, offset, itemHeight, itemOffset, menuOffset, menuScroll, menuHeight, abovePage, belowPage ; $item = $item || module.get.activeItem(); hasActive = ($item && $item.length > 0); forceScroll = (forceScroll !== undefined) ? forceScroll : false ; if($item && hasActive) { if(!$menu.hasClass(className.visible)) { $menu.addClass(className.loading); } menuHeight = $menu.height(); itemHeight = $item.height(); menuScroll = $menu.scrollTop(); menuOffset = $menu.offset().top; itemOffset = $item.offset().top; offset = menuScroll - menuOffset + itemOffset; belowPage = menuScroll + menuHeight < (offset + edgeTolerance); abovePage = ((offset - edgeTolerance) < menuScroll); module.debug('Scrolling to active item', offset); if(abovePage || belowPage || forceScroll) { $menu .scrollTop(offset) .removeClass(className.loading) ; } } }, text: function(text) { if(settings.action == 'combo') { module.debug('Changing combo button text', text, $combo); if(settings.preserveHTML) { $combo.html(text); } else { $combo.text(text); } } else if(settings.action !== 'select') { module.debug('Changing text', text, $text); $text .removeClass(className.filtered) .removeClass(className.placeholder) ; if(settings.preserveHTML) { $text.html(text); } else { $text.text(text); } } }, value: function(value) { module.debug('Adding selected value to hidden input', value, $input); if($input.length > 0) { $input .val(value) .trigger('change') ; } else { $module.data(metadata.value, value); } }, active: function() { $module .addClass(className.active) ; }, visible: function() { $module.addClass(className.visible); }, selected: function(value) { var $selectedItem = module.get.item(value), selectedText, selectedValue ; if($selectedItem) { module.debug('Setting selected menu item to', $selectedItem); module.remove.activeItem(); module.remove.selectedItem(); $selectedItem .addClass(className.active) .addClass(className.selected) ; selectedText = module.get.choiceText($selectedItem); selectedValue = module.get.choiceValue($selectedItem, selectedText); module.set.text(selectedText); module.set.value(selectedValue); settings.onChange.call(element, value, selectedText, $selectedItem); } } }, remove: { active: function() { $module.removeClass(className.active); }, visible: function() { $module.removeClass(className.visible); }, activeItem: function() { $item.removeClass(className.active); }, filteredItem: function() { $item.removeClass(className.filtered); }, searchTerm: function() { $search.val(''); }, selectedItem: function() { $item.removeClass(className.selected); }, tabbable: function() { if( module.is.searchable() ) { module.debug('Searchable dropdown initialized'); $search .attr('tabindex', '-1') ; $menu .attr('tabindex', '-1') ; } else { module.debug('Simple selection dropdown initialized'); $module .attr('tabindex', '-1') ; $menu .attr('tabindex', '-1') ; } } }, is: { active: function() { return $module.hasClass(className.active); }, alreadySetup: function() { return ($module.is('select') && $module.parent(selector.dropdown).length > 0); }, animating: function($subMenu) { return ($subMenu) ? $subMenu.is(':animated') || $subMenu.transition && $subMenu.transition('is animating') : $menu.is(':animated') || $menu.transition && $menu.transition('is animating') ; }, allFiltered: function() { return ($item.filter('.' + className.filtered).length === $item.length); }, hidden: function($subMenu) { return ($subMenu) ? $subMenu.is(':hidden') : $menu.is(':hidden') ; }, selectMutation: function(mutations) { var selectChanged = false ; $.each(mutations, function(index, mutation) { if(mutation.target && $(mutation.target).is('select')) { selectChanged = true; return true; } }); return selectChanged; }, search: function() { return $module.hasClass(className.search); }, searchable: function() { return ($search.length > 0); }, searchSelection: function() { return ( module.is.searchable() && $search.parent().is($module) ); }, selection: function() { return $module.hasClass(className.selection); }, upward: function() { return $module.hasClass(className.upward); }, visible: function($subMenu) { return ($subMenu) ? $subMenu.is(':visible') : $menu.is(':visible') ; } }, can: { click: function() { return (hasTouch || settings.on == 'click'); }, show: function() { return !$module.hasClass(className.disabled); } }, animate: { show: function(callback, $subMenu) { var $currentMenu = $subMenu || $menu, start = ($subMenu) ? function() {} : function() { module.hideSubMenus(); module.hideOthers(); module.set.active(); } ; callback = $.isFunction(callback) ? callback : function(){} ; module.set.scrollPosition(module.get.activeItem(), true); module.verbose('Doing menu show animation', $currentMenu); if( module.is.hidden($currentMenu) || module.is.animating($currentMenu) ) { if(settings.transition == 'auto') { settings.transition = module.is.upward() ? 'slide up' : 'slide down' ; module.verbose('Automatically determining animation based on animation direction', settings.transition); } if(settings.transition == 'none') { callback.call(element); } else if($.fn.transition !== undefined && $module.transition('is supported')) { $currentMenu .transition({ animation : settings.transition + ' in', debug : settings.debug, verbose : settings.verbose, duration : settings.duration, queue : true, onStart : start, onComplete : function() { callback.call(element); } }) ; } else if(settings.transition == 'slide down') { start(); $currentMenu .hide() .clearQueue() .children() .clearQueue() .css('opacity', 0) .delay(50) .animate({ opacity : 1 }, settings.duration, 'easeOutQuad', module.event.resetStyle) .end() .slideDown(100, 'easeOutQuad', function() { module.event.resetStyle.call(this); callback.call(element); }) ; } else if(settings.transition == 'fade') { start(); $currentMenu .hide() .clearQueue() .fadeIn(settings.duration, function() { module.event.resetStyle.call(this); callback.call(element); }) ; } else { module.error(error.transition, settings.transition); } } }, hide: function(callback, $subMenu) { var $currentMenu = $subMenu || $menu, duration = ($subMenu) ? (settings.duration * 0.9) : settings.duration, start = ($subMenu) ? function() {} : function() { if( module.can.click() ) { module.unbind.intent(); } module.focusSearch(); module.remove.active(); } ; callback = $.isFunction(callback) ? callback : function(){} ; if( module.is.visible($currentMenu) || module.is.animating($currentMenu) ) { module.verbose('Doing menu hide animation', $currentMenu); if(settings.transition == 'auto') { settings.transition = module.is.upward() ? 'slide up' : 'slide down' ; } $input.trigger('blur'); if(settings.transition == 'none') { callback.call(element); } else if($.fn.transition !== undefined && $module.transition('is supported')) { $currentMenu .transition({ animation : settings.transition + ' out', duration : settings.duration, debug : settings.debug, verbose : settings.verbose, queue : true, onStart : start, onComplete : function() { callback.call(element); } }) ; } else if(settings.transition == 'slide down') { start(); $currentMenu .show() .clearQueue() .children() .clearQueue() .css('opacity', 1) .animate({ opacity : 0 }, 100, 'easeOutQuad', module.event.resetStyle) .end() .delay(50) .slideUp(100, 'easeOutQuad', function() { module.event.resetStyle.call(this); callback.call(element); }) ; } else if(settings.transition == 'fade') { start(); $currentMenu .show() .clearQueue() .fadeOut(150, function() { module.event.resetStyle.call(this); callback.call(element); }) ; } else { module.error(error.transition); } } } }, delay: { show: function() { module.verbose('Delaying show event to ensure user intent'); clearTimeout(module.timer); module.timer = setTimeout(module.show, settings.delay.show); }, hide: function() { module.verbose('Delaying hide event to ensure user intent'); clearTimeout(module.timer); module.timer = setTimeout(module.hide, settings.delay.hide); } }, escape: { regExp: function(text) { text = String(text); return text.replace(/[-[\]{}()*+?.,\\^$|#\s]/g, '\\$&'); } }, setting: function(name, value) { module.debug('Changing setting', name, value); if( $.isPlainObject(name) ) { $.extend(true, settings, name); } else if(value !== undefined) { settings[name] = value; } else { return settings[name]; } }, internal: function(name, value) { if( $.isPlainObject(name) ) { $.extend(true, module, name); } else if(value !== undefined) { module[name] = value; } else { return module[name]; } }, debug: function() { if(settings.debug) { if(settings.performance) { module.performance.log(arguments); } else { module.debug = Function.prototype.bind.call(console.info, console, settings.name + ':'); module.debug.apply(console, arguments); } } }, verbose: function() { if(settings.verbose && settings.debug) { if(settings.performance) { module.performance.log(arguments); } else { module.verbose = Function.prototype.bind.call(console.info, console, settings.name + ':'); module.verbose.apply(console, arguments); } } }, error: function() { module.error = Function.prototype.bind.call(console.error, console, settings.name + ':'); module.error.apply(console, arguments); }, performance: { log: function(message) { var currentTime, executionTime, previousTime ; if(settings.performance) { currentTime = new Date().getTime(); previousTime = time || currentTime; executionTime = currentTime - previousTime; time = currentTime; performance.push({ 'Name' : message[0], 'Arguments' : [].slice.call(message, 1) || '', 'Element' : element, 'Execution Time' : executionTime }); } clearTimeout(module.performance.timer); module.performance.timer = setTimeout(module.performance.display, 100); }, display: function() { var title = settings.name + ':', totalTime = 0 ; time = false; clearTimeout(module.performance.timer); $.each(performance, function(index, data) { totalTime += data['Execution Time']; }); title += ' ' + totalTime + 'ms'; if(moduleSelector) { title += ' \'' + moduleSelector + '\''; } if( (console.group !== undefined || console.table !== undefined) && performance.length > 0) { console.groupCollapsed(title); if(console.table) { console.table(performance); } else { $.each(performance, function(index, data) { console.log(data['Name'] + ': ' + data['Execution Time']+'ms'); }); } console.groupEnd(); } performance = []; } }, invoke: function(query, passedArguments, context) { var object = instance, maxDepth, found, response ; passedArguments = passedArguments || queryArguments; context = element || context; if(typeof query == 'string' && object !== undefined) { query = query.split(/[\. ]/); maxDepth = query.length - 1; $.each(query, function(depth, value) { var camelCaseValue = (depth != maxDepth) ? value + query[depth + 1].charAt(0).toUpperCase() + query[depth + 1].slice(1) : query ; if( $.isPlainObject( object[camelCaseValue] ) && (depth != maxDepth) ) { object = object[camelCaseValue]; } else if( object[camelCaseValue] !== undefined ) { found = object[camelCaseValue]; return false; } else if( $.isPlainObject( object[value] ) && (depth != maxDepth) ) { object = object[value]; } else if( object[value] !== undefined ) { found = object[value]; return false; } else { module.error(error.method, query); return false; } }); } if ( $.isFunction( found ) ) { response = found.apply(context, passedArguments); } else if(found !== undefined) { response = found; } if($.isArray(returnedValue)) { returnedValue.push(response); } else if(returnedValue !== undefined) { returnedValue = [returnedValue, response]; } else if(response !== undefined) { returnedValue = response; } return found; } }; if(methodInvoked) { if(instance === undefined) { module.initialize(); } module.invoke(query); } else { if(instance !== undefined) { instance.invoke('destroy'); } module.initialize(); } }) ; return (returnedValue !== undefined) ? returnedValue : this ; }; $.fn.dropdown.settings = { debug : false, verbose : true, performance : true, on : 'click', action : 'activate', allowTab : true, fullTextSearch : false, preserveHTML : true, sortSelect : false, allowCategorySelection : false, delay : { hide : 300, show : 200, search : 50, touch : 50 }, forceSelection: true, transition : 'auto', duration : 250, /* Callbacks */ onNoResults : function(searchTerm){}, onChange : function(value, text){}, onShow : function(){}, onHide : function(){}, /* Component */ name : 'Dropdown', namespace : 'dropdown', error : { action : 'You called a dropdown action that was not defined', alreadySetup : 'Once a select has been initialized behaviors must be called on the created ui dropdown', method : 'The method you called is not defined.', transition : 'The requested transition was not found' }, metadata: { defaultText : 'defaultText', defaultValue : 'defaultValue', placeholderText : 'placeholderText', text : 'text', value : 'value' }, selector : { dropdown : '.ui.dropdown', input : '> input[type="hidden"], > select', item : '.item', menu : '.menu', menuIcon : '.dropdown.icon', search : '> input.search, .menu > .search > input, .menu > input.search', text : '> .text:not(.icon)' }, className : { active : 'active', animating : 'animating', disabled : 'disabled', dropdown : 'ui dropdown', filtered : 'filtered', loading : 'loading', menu : 'menu', placeholder : 'default', search : 'search', selected : 'selected', selection : 'selection', upward : 'upward', visible : 'visible' } }; /* Templates */ $.fn.dropdown.settings.templates = { menu: function(select) { var placeholder = select.placeholder || false, values = select.values || {}, html = '' ; $.each(select.values, function(index, option) { html += '<div class="item" data-value="' + option.value + '">' + option.name + '</div>'; }); return html; }, dropdown: function(select) { var placeholder = select.placeholder || false, values = select.values || {}, html = '' ; html += '<i class="dropdown icon"></i>'; if(select.placeholder) { html += '<div class="default text">' + placeholder + '</div>'; } else { html += '<div class="text"></div>'; } html += '<div class="menu">'; $.each(select.values, function(index, option) { html += '<div class="item" data-value="' + option.value + '">' + option.name + '</div>'; }); html += '</div>'; return html; } }; /* Dependencies */ $.extend( $.easing, { easeOutQuad: function (x, t, b, c, d) { return -c *(t/=d)*(t-2) + b; }, }); })( jQuery, window , document );
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "M22 4h-5.17L15 2H9L7.17 4H2v16h20V4zm-7 11.5V13H9v2.5L5.5 12 9 8.5V11h6V8.5l3.5 3.5-3.5 3.5z" }), 'SwitchCameraSharp'); exports.default = _default;
(function ($) { 'use strict'; $.fn.extend({ moveBlocks: function () { var $element = $(this); $element.on('click', '.app-move-up', function (event) { event.preventDefault(); var $block = $(this).closest('[data-form-collection=item]'); moveUp($block); }); $element.on('click', '.app-move-down', function (event) { event.preventDefault(); var $block = $(this).closest('[data-form-collection=item]'); moveDown($block); }); } }); /** * @param {jQuery} $block */ function moveUp($block) { var $previousBlock = $block.prev(); if ($previousBlock.length === 0) { return; } $block.hide('slow', function () { $previousBlock.insertAfter($block); $('html, body').animate({ scrollTop: $previousBlock.offset().top }, 1000); $block.show('slow'); recalculatePositions($block.closest('[data-form-collection=list]')); }); } /** * @param {jQuery} $block */ function moveDown($block) { var $nextBlock = $block.next(); if ($nextBlock.length === 0) { return; } $block.hide('slow', function () { $block.insertAfter($nextBlock); $('html, body').animate({ scrollTop: $nextBlock.offset().top }, 1000); $block.show('slow'); recalculatePositions($block.closest('[data-form-collection=list]')); }); } /** * @param {jQuery} $list */ function recalculatePositions($list) { $('[data-form-collection=item]', $list).each(function (key) { var $item = $(this); $('.position', $item).val(key); }); } })(jQuery);
'use strict' module.exports = function (dep) { const storagePath = function () { const { join, process } = dep return join(process.cwd(), 'patata.yml') } const get = function () { const { yaml, shell, validation, help } = dep const path = path() if (!validation.isPatataRootDir()) { help.errorDueRootPath() } var yamlContent = shell.cat(path) var config = yaml.safeLoad(yamlContent) || {} return config } const set = function (obj) { const { yaml, fs, log, help, validation } = dep const path = storagePath() if (!validation.isPatataRootDir(dep)) { help.errorDueRootPath(dep) } log.log(`Saving changes in ${path}`) let yamlContent = yaml.safeDump(obj) fs.writeFileSync(path, yamlContent) } return {get, set, storagePath} }
(function() { 'use strict'; angular .module('app.widgets') .directive('confirmPassword', confirmPassword); function confirmPassword() { var directive = { restrict: 'A', require: 'ngModel', link: link }; return directive; function link(scope, element, attrs, ngModelCtrl) { function validateEqual(value) { var valid = (value === scope.$eval(attrs.confirmPassword)); ngModelCtrl.$setValidity('equal', valid); return valid ? value : undefined; } ngModelCtrl.$parsers.push(validateEqual); ngModelCtrl.$formatters.push(validateEqual); scope.$watch(attrs.confirmPassword, function() { if (scope.signupForm.confirmPassword.$viewValue === scope.$eval(attrs.confirmPassword)) { ngModelCtrl.$setValidity('equal', true); scope.signupForm.confirmPassword.$invalid = false; } else { ngModelCtrl.$setValidity('equal', false); } ngModelCtrl.$setViewValue(ngModelCtrl.$viewValue); }); } } }());
var status = require("../status.json"); var questions = require("../questions.json"); var userData = require("../userData.json"); exports.play = function(req, res) { status["loginStatus"]["questionNumber"]=0; status["loginStatus"]["score"]=0; status["loginStatus"]["totalScore"]=0; var course=status["loginStatus"]["currentCourseID"]; if(course =="" || course==-1 || course==undefined) { res.redirect('/student'); } else { var qs; var arr = questions["course"]; for(var i=0;i<arr.length;i++) { var obj = arr[i]; var problems, cID; for(var key in obj) { var attrName = key; var attrValue = obj[key]; if(attrName == "courseID") { cID=attrValue; } if(attrName == "problems") { problems=attrValue; } } if(course==cID) { qs=problems[status["loginStatus"]["questionNumber"]]; } } status["loginStatus"]["questionNumber"] = status["loginStatus"]["questionNumber"] + 1; res.render('play', {"status": status, "qs":qs}); } }; exports.submitAnswer = function(req, res) { var course=status["loginStatus"]["currentCourseID"]; if(course =="" || course==-1 || course==undefined) { res.redirect('/student'); } else { var qs; var arr = questions["course"]; for(var i=0;i<arr.length;i++) { var obj = arr[i]; var problems, cID; for(var key in obj) { var attrName = key; var attrValue = obj[key]; if(attrName == "courseID") { cID=attrValue; } if(attrName == "problems") { problems=attrValue; } } if(course==cID) { status["loginStatus"]["totalScore"]=status["loginStatus"]["totalScore"] + 1; if (req.query.studentAnswer==problems[status["loginStatus"]["questionNumber"]-1]["correctAnswer"]) { console.log("correct"); status["loginStatus"]["score"]=status["loginStatus"]["score"] + 1; } else { console.log("incorrect"); } qs=problems[status["loginStatus"]["questionNumber"]]; } } if(qs==undefined) { var newScore=status["loginStatus"]["score"]; var arr=userData["loginData"]; var username = status["loginStatus"]["username"]; var bestScore =newScore; var rand = Math.floor((Math.random() * (status["loginStatus"]["totalScore"]+1))); console.log(rand); status["loginStatus"]["opponentScore"]=rand; if(newScore > rand) { status["loginStatus"]["result"] = "You Won!"; } else if(newScore < rand) { status["loginStatus"]["result"] = "You Lost!"; } else { status["loginStatus"]["result"] = "It's a tie!"; } for(var i=0;i<arr.length;i++) { var obj = arr[i]; var uname, courses; for(var key in obj) { var attrName = key; var attrValue = obj[key]; if(attrName == "username") { uname=attrValue; } if(attrName == "courses") { courses=attrValue; } } if(username==uname) { var arr=courses; for(var i=0;i<arr.length;i++) { var obj = arr[i]; var cID; for(var key in obj) { var attrName = key; var attrValue = obj[key]; if(attrName == "courseID") { cID=attrValue; } if(attrName == "bestScore") { if(course==cID) { if(newScore>attrValue) { obj[key]=newScore; } else { bestScore=attrValue; } } } if(attrName == "wins" && course==cID && newScore>rand) { obj[key]++; } else if(attrName == "losses" && course==cID && newScore<rand) { obj[key]++; } else if(attrName == "ties" && course==cID && newScore==rand) { obj[key]++; } } } } } res.render('endOfMatch', {"status": status, "bestScore": bestScore}); } else { status["loginStatus"]["questionNumber"] = status["loginStatus"]["questionNumber"] + 1; res.render('play', {"status": status, "qs":qs}); } } };
var express = require('express'), config = require('../config/config'), glob = require('glob'), mongoose = require('mongoose'); var db = {}; mongoose.connect(config.db); mongoose.set('debug', true); var connection = mongoose.connection; connection.on('connected', function () { console.log('資料庫連接成功'); }); connection.on('error', function () { throw new Error('unable to connect to database at ' + config.db); }); var models = glob.sync(config.root + '/app/models/*.js'); models.forEach(function (model) { var modelObject = require(model); db[modelObject.modelName] = modelObject; }); module.exports = db;
/** * Copyright © 2013-2017 Magento, Inc. All rights reserved. * See COPYING.txt for license details. */ define([ 'Magento_Ui/js/form/element/select', 'Magento_Catalog/js/components/visible-on-option/strategy' ], function (Element, strategy) { 'use strict'; return Element.extend(strategy); });
foo?.(...[], 1); foo?.bar(...[], 1) foo.bar?.(foo.bar, ...[], 1) foo?.bar?.(foo.bar, ...[], 1) foo?.(...[], 1).bar foo?.(...[], 1)?.bar foo.bar?.(...[], 1).baz foo.bar?.(...[], 1)?.baz foo?.bar?.(...[], 1).baz foo?.bar?.(...[], 1)?.baz
module('JSHint - controllers'); test('controllers/contacts.js should pass jshint', function() { ok(true, 'controllers/contacts.js should pass jshint.'); });
var searchData= [ ['primarykeyviolated',['PrimaryKeyViolated',['../namespaceResults.html#a104d9a9b355e69cdd867b0681474dba9ad96397a017d11ff569cbb1fab8a9c234',1,'Results']]] ];
/** * @class escape * @namespace util * @module hexo * @static */ /** * Converts the string to a proper filename. * * Transform: * - 1: Lower case * - 2: Upper case * * @method filename * @param {String} str * @param {Number} [transform] * @return {String} * @static */ exports.filename = function(str, transform){ var result = str.toString().toLowerCase() .replace(/\s/g, '-') .replace(/\/|\\|\?|%|\*|:|\||'|"|<|>|\.|#/g, ''); if (transform == 1){ result = result.toLowerCase(); } else if (transform == 2){ result = result.toUpperCase(); } return result; }; /** * Converts the string to a proper path. * * Transform: * - 1: Lower case * - 2: Upper case * * @method path * @param {String} str * @param {Number} transform * @return {String} * @static */ exports.path = function(str, transform){ var result = str.toString() .replace(/\s/g, '-') .replace(/:|\/|\?|#|\[|\]|@|!|\$|&|'|\(|\)|\*|\+|,|;|=|\\|%|<|>|\./g, ''); if (transform == 1){ result = result.toLowerCase(); } else if (transform == 2){ result = result.toUpperCase(); } return result; }; /** * Converts all tabs to spaces in the string. * * @method yaml * @param {String} str * @return {String} * @static */ exports.yaml = function(str){ return str.replace(/\n(\t+)/g, function(match, tabs){ var result = '\n'; for (var i=0, len=tabs.length; i<len; i++){ result += ' '; } return result; }); };
module.exports = { Button: require('./Button'), DropdownButton: require('./DropdownButton'), Form: require('./Form'), FormField: require('./FormField'), FormInput: require('./FormInput'), FormLabel: require('./FormLabel'), FormNote: require('./FormNote'), Glyph: require('./Glyph'), GlyphButton: require('./GlyphButton'), LoadingButton: require('./LoadingButton'), ScreenReaderOnly: require('./ScreenReaderOnly'), Spinner: require('./Spinner'), ResponsiveText: require('./ResponsiveText'), };
angular.module('KHO_CRM').factory('Todos', dataTodos); dataTodos.$inject = ['$http', '$resource']; function dataTodos($http, $resource) { return { get : function() { return $http.get('/api/todos'); }, create : function(todoData) { return $http.post('/api/todos', todoData); }, delete : function(id) { return $http.delete('/api/todos/' + id); }, findById : function(id) { return $http.get('/api/todos/findById/' + id); }, findByEmail : function(email){ return $http.get('/api/todos/findByEmail/' + email) }, findByIdAttempt : function(id) { return $http.get('/api/todos/findByIdAttempt/' + id); }, update : function(todoData){ return $http.put('/api/todos/updateScout', todoData); }, updateAttempt : function(todoData){ return $http.put('/api/todos/updateAttempt', todoData); }, addAttempt : function(user_id, todoData){ console.log("HERE"); return $http.put('/api/todos/addAttempt/' + user_id, todoData); }, checkRole : function(emial){ return $http.get('/api/todos/checkRole/' + emial); }, deleteAttempt : function(user_id, attempt_id){ return $http.delete('/api/todos/deleteAttempt/' + user_id + '/' + attempt_id); }, deleteMeeting : function(meetingId){ return $http.delete('/api/todos/deleteMeeting/' + meetingId); }, findByIdTask : function(taskId){ return $http.get('/api/todos/findTask/' + taskId); }, addComment: function(taskId, commData){ return $http.post('/api/todos/createComment/' + taskId, commData); }, addMeeting: function(formData){ return $http.post('/api/todos/createMeeting/', formData); }, confirmPresent: function(formData){ $http.put('/api/todos/confirmPresent/sendEmail', formData); return $http.put('/api/todos/confirmPresent/', formData); }, getMeeting: function(){ return $http.get('/api/todos/getMeetings/'); }, addPersonToMeeting: function(todoData){ //$http.put('/api/meeting/adduser/sendEmail', todoData); $http.put('/api/todos/confirmPresentReport/sendEmail', todoData); return $http.put('/api/meeting/adduser', todoData); }, getAll : function(){ return $http.get('/api/users').then(handleSuccess, handleError('Error getting all users')); }, getById : function(id){ return $http.get('/api/users/' + id).then(handleSuccess, handleError('Error getting user by id')); }, getByUsername: function(username){ return $http.get('/api/users/' + username).then(handleSuccess, handleError('Error getting user by username')); }, sendEmail: function(mailOptions){ return $http.put('/api/sendEmail', mailOptions); }, readFiles: function(username){ return $http.post('/api/readFiles/', username); } } }
// // 91websql.js // WebSQL database support // (c) 2014, Andrey Gershun // var SQLITE = alasql.engines.SQLITE = function (){}; SQLITE.createDatabase = function(wdbid, args, ifnotexists, dbid, cb){ throw new Error('Connot create SQLITE database in memory. Attach it.'); }; SQLITE.dropDatabase = function(databaseid){ throw new Error('This is impossible to drop SQLite database. Detach it.'); }; SQLITE.attachDatabase = function(sqldbid, dbid, args, params, cb){ var res = 1; if(alasql.databases[dbid]) { throw new Error('Unable to attach database as "'+dbid+'" because it already exists'); }; if(args[0] && (args[0] instanceof yy.StringValue) || (args[0] instanceof yy.ParamValue)) { if(args[0] instanceof yy.StringValue) { var value = args[0].value; } else if(args[0] instanceof yy.ParamValue) { var value = params[args[0].param]; } alasql.utils.loadBinaryFile(value,true,function(data){ var db = new alasql.Database(dbid || sqldbid); db.engineid = "SQLITE"; db.sqldbid = sqldbid; var sqldb = db.sqldb = new SQL.Database(data); db.tables = []; var tables = sqldb.exec("SELECT * FROM sqlite_master WHERE type='table'")[0].values; tables.forEach(function(tbl){ db.tables[tbl[1]] = {}; var columns = db.tables[tbl[1]].columns = []; var ast = alasql.parse(tbl[4]); // console.log(ast); var coldefs = ast.statements[0].columns; if(coldefs && coldefs.length>0) { coldefs.forEach(function(cd){ columns.push(cd); }); } }); // console.log(35,db.tables); cb(1); }, function(err){ throw new Error('Cannot open SQLite database file "'+args[0].value+'"'); }) return res; } else { throw new Error('Cannot attach SQLite database without a file'); }; return res; } SQLITE.fromTable = function(databaseid, tableid, cb, idx, query){ var data = alasql.databases[databaseid].sqldb.exec("SELECT * FROM "+tableid); var columns = query.sources[idx].columns = []; if(data[0].columns.length > 0) { data[0].columns.forEach(function(columnid) { columns.push({columnid:columnid}); }); }; var res = []; if(data[0].values.length > 0) { data[0].values.forEach(function(d){ var r = {}; columns.forEach(function(col,idx){ r[col.columnid] = d[idx]; }); res.push(r); }); } if(cb) cb(res, idx, query); }; SQLITE.intoTable = function(databaseid, tableid, value, columns, cb) { var sqldb = alasql.databases[databaseid].sqldb; for(var i=0, ilen = value.length;i<ilen;i++) { var s = "INSERT INTO "+tableid+" ("; var d = value[i]; var keys = Object.keys(d); s += keys.join(","); s += ") VALUES ("; s += keys.map(function(k){ v = d[k]; if(typeof v == 'string') v = "'"+v+"'"; return v; }).join(","); s += ")"; sqldb.exec(s); }; var res = ilen; if(cb) cb(res); return res; };
/*! simple-js-views Version 0.1.1 Copyright © 2015 Juhana Räsänen Licensed under the MIT license. */ (function() { 'use strict'; var oldWindowLoad = window.onload; var initializers = {}; function SimpleViews() { // Empty for now } /* Executes an initializer function if one is registered for the given element on page. Checks if the HTML element defining the initializer has argument attributes (beginning with "data-sv-arg-") and passes those to the init function if found. */ function executeInitializer(element) { var initname = element.getAttribute('data-sv-init'); if (initname && initializers[initname] && initializers[initname].initfunc) { var args = {}; for (var i=0; i<element.attributes.length; i++) { var a = element.attributes[i]; if (a.name.toLowerCase().indexOf('data-sv-arg-') == 0) { var name = a.name.toLowerCase().substr(12); args[name] = a.value; } } initializers[initname].initfunc.call(element, args); } } /* Registers an init function */ SimpleViews.registerInitializer = function(name, initfunc) { initializers[name] = { initfunc: initfunc }; }; /* Executes the init function on given element. */ SimpleViews.executeInitializer = function(element_id) { var element = document.getElementById(element_id); executeInitializer(element); }; /* When page loads, run the init functions found on page */ window.onload = function() { if (oldWindowLoad) { oldWindowLoad(); } // Always execute the <body> initializer first, if found var body = document.getElementsByTagName('body')[0]; if (body) { executeInitializer(body); } // Then check all elements that have the magic class var elements = document.getElementsByClassName('sv-init'); for (var i=0; i<elements.length; i++) { // Make sure not to execute body initializer twice, if it happens to have the magic class if (elements[i].nodeName != 'BODY') { executeInitializer(elements[i]); } } }; window.SimpleViews = SimpleViews; }());
(function () { "use strict"; angular.module('public') .component('menuCategory', { templateUrl: 'js/public/menu-category/menu-category.html', bindings: { category: '<' } }); })();
/** * @license Copyright (c) 2003-2015, CKSource - Frederico Knabben. All rights reserved. * For licensing, see LICENSE.md or http://ckeditor.com/license */ 'use strict'; ( function() { CKEDITOR.plugins.add( 'link', { requires: 'dialog,fakeobjects', // jscs:disable maximumLineLength lang: 'af,ar,bg,bn,bs,ca,cs,cy,da,de,el,en,en-au,en-ca,en-gb,eo,es,et,eu,fa,fi,fo,fr,fr-ca,gl,gu,he,hi,hr,hu,id,is,it,ja,ka,km,ko,ku,lt,lv,mk,mn,ms,nb,nl,no,pl,pt,pt-br,ro,ru,si,sk,sl,sq,sr,sr-latn,sv,th,tr,tt,ug,uk,vi,zh,zh-cn', // %REMOVE_LINE_CORE% // jscs:enable maximumLineLength icons: 'anchor,anchor-rtl,link,unlink', // %REMOVE_LINE_CORE% hidpi: true, // %REMOVE_LINE_CORE% onLoad: function() { // Add the CSS styles for anchor placeholders. var iconPath = CKEDITOR.getUrl( this.path + 'images' + ( CKEDITOR.env.hidpi ? '/hidpi' : '' ) + '/anchor.png' ), baseStyle = 'background:url(' + iconPath + ') no-repeat %1 center;border:1px dotted #00f;background-size:16px;'; var template = '.%2 a.cke_anchor,' + '.%2 a.cke_anchor_empty' + ',.cke_editable.%2 a[name]' + ',.cke_editable.%2 a[data-cke-saved-name]' + '{' + baseStyle + 'padding-%1:18px;' + // Show the arrow cursor for the anchor image (FF at least). 'cursor:auto;' + '}' + '.%2 img.cke_anchor' + '{' + baseStyle + 'width:16px;' + 'min-height:15px;' + // The default line-height on IE. 'height:1.15em;' + // Opera works better with "middle" (even if not perfect) 'vertical-align:text-bottom;' + '}'; // Styles with contents direction awareness. function cssWithDir( dir ) { return template.replace( /%1/g, dir == 'rtl' ? 'right' : 'left' ).replace( /%2/g, 'cke_contents_' + dir ); } CKEDITOR.addCss( cssWithDir( 'ltr' ) + cssWithDir( 'rtl' ) ); }, init: function( editor ) { var allowed = 'a[!href]', required = 'a[href]'; if ( CKEDITOR.dialog.isTabEnabled( editor, 'link', 'advanced' ) ) allowed = allowed.replace( ']', ',accesskey,charset,dir,id,lang,name,rel,tabindex,title,type]{*}(*)' ); if ( CKEDITOR.dialog.isTabEnabled( editor, 'link', 'target' ) ) allowed = allowed.replace( ']', ',target,onclick]' ); // Add the link and unlink buttons. editor.addCommand( 'link', new CKEDITOR.dialogCommand( 'link', { allowedContent: allowed, requiredContent: required } ) ); editor.addCommand( 'anchor', new CKEDITOR.dialogCommand( 'anchor', { allowedContent: 'a[!name,id]', requiredContent: 'a[name]' } ) ); editor.addCommand( 'unlink', new CKEDITOR.unlinkCommand() ); editor.addCommand( 'removeAnchor', new CKEDITOR.removeAnchorCommand() ); editor.setKeystroke( CKEDITOR.CTRL + 76 /*L*/, 'link' ); if ( editor.ui.addButton ) { editor.ui.addButton( 'Link', { label: editor.lang.link.toolbar, command: 'link', toolbar: 'links,10' } ); editor.ui.addButton( 'Unlink', { label: editor.lang.link.unlink, command: 'unlink', toolbar: 'links,20' } ); editor.ui.addButton( 'Anchor', { label: editor.lang.link.anchor.toolbar, command: 'anchor', toolbar: 'links,30' } ); } CKEDITOR.dialog.add( 'link', this.path + 'dialogs/link.js' ); CKEDITOR.dialog.add( 'anchor', this.path + 'dialogs/anchor.js' ); editor.on( 'doubleclick', function( evt ) { var element = CKEDITOR.plugins.link.getSelectedLink( editor ) || evt.data.element; if ( !element.isReadOnly() ) { if ( element.is( 'a' ) ) { evt.data.dialog = ( element.getAttribute( 'name' ) && ( !element.getAttribute( 'href' ) || !element.getChildCount() ) ) ? 'anchor' : 'link'; // Pass the link to be selected along with event data. evt.data.link = element; } else if ( CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, element ) ) { evt.data.dialog = 'anchor'; } } }, null, null, 0 ); // If event was cancelled, link passed in event data will not be selected. editor.on( 'doubleclick', function( evt ) { // Make sure both links and anchors are selected (#11822). if ( evt.data.dialog in { link: 1, anchor: 1 } && evt.data.link ) editor.getSelection().selectElement( evt.data.link ); }, null, null, 20 ); // If the "menu" plugin is loaded, register the menu items. if ( editor.addMenuItems ) { editor.addMenuItems( { anchor: { label: editor.lang.link.anchor.menu, command: 'anchor', group: 'anchor', order: 1 }, removeAnchor: { label: editor.lang.link.anchor.remove, command: 'removeAnchor', group: 'anchor', order: 5 }, link: { label: editor.lang.link.menu, command: 'link', group: 'link', order: 1 }, unlink: { label: editor.lang.link.unlink, command: 'unlink', group: 'link', order: 5 } } ); } // If the "contextmenu" plugin is loaded, register the listeners. if ( editor.contextMenu ) { editor.contextMenu.addListener( function( element ) { if ( !element || element.isReadOnly() ) return null; var anchor = CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, element ); if ( !anchor && !( anchor = CKEDITOR.plugins.link.getSelectedLink( editor ) ) ) return null; var menu = {}; if ( anchor.getAttribute( 'href' ) && anchor.getChildCount() ) menu = { link: CKEDITOR.TRISTATE_OFF, unlink: CKEDITOR.TRISTATE_OFF }; if ( anchor && anchor.hasAttribute( 'name' ) ) menu.anchor = menu.removeAnchor = CKEDITOR.TRISTATE_OFF; return menu; } ); } this.compiledProtectionFunction = getCompiledProtectionFunction( editor ); }, afterInit: function( editor ) { // Empty anchors upcasting to fake objects. editor.dataProcessor.dataFilter.addRules( { elements: { a: function( element ) { if ( !element.attributes.name ) return null; if ( !element.children.length ) return editor.createFakeParserElement( element, 'cke_anchor', 'anchor' ); return null; } } } ); var pathFilters = editor._.elementsPath && editor._.elementsPath.filters; if ( pathFilters ) { pathFilters.push( function( element, name ) { if ( name == 'a' ) { if ( CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, element ) || ( element.getAttribute( 'name' ) && ( !element.getAttribute( 'href' ) || !element.getChildCount() ) ) ) return 'anchor'; } } ); } } } ); // Loads the parameters in a selected link to the link dialog fields. var javascriptProtocolRegex = /^javascript:/, emailRegex = /^mailto:([^?]+)(?:\?(.+))?$/, emailSubjectRegex = /subject=([^;?:@&=$,\/]*)/i, emailBodyRegex = /body=([^;?:@&=$,\/]*)/i, anchorRegex = /^#(.*)$/, urlRegex = /^((?:http|https|ftp|news):\/\/)?(.*)$/, selectableTargets = /^(_(?:self|top|parent|blank))$/, encodedEmailLinkRegex = /^javascript:void\(location\.href='mailto:'\+String\.fromCharCode\(([^)]+)\)(?:\+'(.*)')?\)$/, functionCallProtectedEmailLinkRegex = /^javascript:([^(]+)\(([^)]+)\)$/, popupRegex = /\s*window.open\(\s*this\.href\s*,\s*(?:'([^']*)'|null)\s*,\s*'([^']*)'\s*\)\s*;\s*return\s*false;*\s*/, popupFeaturesRegex = /(?:^|,)([^=]+)=(\d+|yes|no)/gi; var advAttrNames = { id: 'advId', dir: 'advLangDir', accessKey: 'advAccessKey', // 'data-cke-saved-name': 'advName', name: 'advName', lang: 'advLangCode', tabindex: 'advTabIndex', title: 'advTitle', type: 'advContentType', 'class': 'advCSSClasses', charset: 'advCharset', style: 'advStyles', rel: 'advRel' }; function unescapeSingleQuote( str ) { return str.replace( /\\'/g, '\'' ); } function escapeSingleQuote( str ) { return str.replace( /'/g, '\\$&' ); } function protectEmailAddressAsEncodedString( address ) { var charCode, length = address.length, encodedChars = []; for ( var i = 0; i < length; i++ ) { charCode = address.charCodeAt( i ); encodedChars.push( charCode ); } return 'String.fromCharCode(' + encodedChars.join( ',' ) + ')'; } function protectEmailLinkAsFunction( editor, email ) { var plugin = editor.plugins.link, name = plugin.compiledProtectionFunction.name, params = plugin.compiledProtectionFunction.params, paramName, paramValue, retval; retval = [ name, '(' ]; for ( var i = 0; i < params.length; i++ ) { paramName = params[ i ].toLowerCase(); paramValue = email[ paramName ]; i > 0 && retval.push( ',' ); retval.push( '\'', paramValue ? escapeSingleQuote( encodeURIComponent( email[ paramName ] ) ) : '', '\'' ); } retval.push( ')' ); return retval.join( '' ); } function getCompiledProtectionFunction( editor ) { var emailProtection = editor.config.emailProtection || '', compiledProtectionFunction; // Compile the protection function pattern. if ( emailProtection && emailProtection != 'encode' ) { compiledProtectionFunction = {}; emailProtection.replace( /^([^(]+)\(([^)]+)\)$/, function( match, funcName, params ) { compiledProtectionFunction.name = funcName; compiledProtectionFunction.params = []; params.replace( /[^,\s]+/g, function( param ) { compiledProtectionFunction.params.push( param ); } ); } ); } return compiledProtectionFunction; } /** * Set of Link plugin helpers. * * @class * @singleton */ CKEDITOR.plugins.link = { /** * Get the surrounding link element of the current selection. * * CKEDITOR.plugins.link.getSelectedLink( editor ); * * // The following selections will all return the link element. * * <a href="#">li^nk</a> * <a href="#">[link]</a> * text[<a href="#">link]</a> * <a href="#">li[nk</a>] * [<b><a href="#">li]nk</a></b>] * [<a href="#"><b>li]nk</b></a> * * @since 3.2.1 * @param {CKEDITOR.editor} editor */ getSelectedLink: function( editor ) { var selection = editor.getSelection(); var selectedElement = selection.getSelectedElement(); if ( selectedElement && selectedElement.is( 'a' ) ) return selectedElement; var range = selection.getRanges()[ 0 ]; if ( range ) { range.shrink( CKEDITOR.SHRINK_TEXT ); return editor.elementPath( range.getCommonAncestor() ).contains( 'a', 1 ); } return null; }, /** * Collects anchors available in the editor (i.e. used by the Link plugin). * Note that the scope of search is different for inline (the "global" document) and * classic (`iframe`-based) editors (the "inner" document). * * @since 4.3.3 * @param {CKEDITOR.editor} editor * @returns {CKEDITOR.dom.element[]} An array of anchor elements. */ getEditorAnchors: function( editor ) { var editable = editor.editable(), // The scope of search for anchors is the entire document for inline editors // and editor's editable for classic editor/divarea (#11359). scope = ( editable.isInline() && !editor.plugins.divarea ) ? editor.document : editable, links = scope.getElementsByTag( 'a' ), imgs = scope.getElementsByTag( 'img' ), anchors = [], i = 0, item; // Retrieve all anchors within the scope. while ( ( item = links.getItem( i++ ) ) ) { if ( item.data( 'cke-saved-name' ) || item.hasAttribute( 'name' ) ) { anchors.push( { name: item.data( 'cke-saved-name' ) || item.getAttribute( 'name' ), id: item.getAttribute( 'id' ) } ); } } // Retrieve all "fake anchors" within the scope. i = 0; while ( ( item = imgs.getItem( i++ ) ) ) { if ( ( item = this.tryRestoreFakeAnchor( editor, item ) ) ) { anchors.push( { name: item.getAttribute( 'name' ), id: item.getAttribute( 'id' ) } ); } } return anchors; }, /** * Opera and WebKit do not make it possible to select empty anchors. Fake * elements must be used for them. * * @readonly * @deprecated 4.3.3 It is set to `true` in every browser. * @property {Boolean} */ fakeAnchor: true, /** * For browsers that do not support CSS3 `a[name]:empty()`. Note that IE9 is included because of #7783. * * @readonly * @deprecated 4.3.3 It is set to `false` in every browser. * @property {Boolean} synAnchorSelector */ /** * For browsers that have editing issues with an empty anchor. * * @readonly * @deprecated 4.3.3 It is set to `false` in every browser. * @property {Boolean} emptyAnchorFix */ /** * Returns an element representing a real anchor restored from a fake anchor. * * @param {CKEDITOR.editor} editor * @param {CKEDITOR.dom.element} element * @returns {CKEDITOR.dom.element} Restored anchor element or nothing if the * passed element was not a fake anchor. */ tryRestoreFakeAnchor: function( editor, element ) { if ( element && element.data( 'cke-real-element-type' ) && element.data( 'cke-real-element-type' ) == 'anchor' ) { var link = editor.restoreRealElement( element ); if ( link.data( 'cke-saved-name' ) ) return link; } }, /** * Parses attributes of the link element and returns an object representing * the current state (data) of the link. This data format is a plain object accepted * e.g. by the Link dialog window and {@link #getLinkAttributes}. * * **Note:** Data model format produced by the parser must be compatible with the Link * plugin dialog because it is passed directly to {@link CKEDITOR.dialog#setupContent}. * * @since 4.4 * @param {CKEDITOR.editor} editor * @param {CKEDITOR.dom.element} element * @returns {Object} An object of link data. */ parseLinkAttributes: function( editor, element ) { var href = ( element && ( element.data( 'cke-saved-href' ) || element.getAttribute( 'href' ) ) ) || '', compiledProtectionFunction = editor.plugins.link.compiledProtectionFunction, emailProtection = editor.config.emailProtection, javascriptMatch, emailMatch, anchorMatch, urlMatch, retval = {}; if ( ( javascriptMatch = href.match( javascriptProtocolRegex ) ) ) { if ( emailProtection == 'encode' ) { href = href.replace( encodedEmailLinkRegex, function( match, protectedAddress, rest ) { // Without it 'undefined' is appended to e-mails without subject and body (#9192). rest = rest || ''; return 'mailto:' + String.fromCharCode.apply( String, protectedAddress.split( ',' ) ) + unescapeSingleQuote( rest ); } ); } // Protected email link as function call. else if ( emailProtection ) { href.replace( functionCallProtectedEmailLinkRegex, function( match, funcName, funcArgs ) { if ( funcName == compiledProtectionFunction.name ) { retval.type = 'email'; var email = retval.email = {}; var paramRegex = /[^,\s]+/g, paramQuoteRegex = /(^')|('$)/g, paramsMatch = funcArgs.match( paramRegex ), paramsMatchLength = paramsMatch.length, paramName, paramVal; for ( var i = 0; i < paramsMatchLength; i++ ) { paramVal = decodeURIComponent( unescapeSingleQuote( paramsMatch[ i ].replace( paramQuoteRegex, '' ) ) ); paramName = compiledProtectionFunction.params[ i ].toLowerCase(); email[ paramName ] = paramVal; } email.address = [ email.name, email.domain ].join( '@' ); } } ); } } if ( !retval.type ) { if ( ( anchorMatch = href.match( anchorRegex ) ) ) { retval.type = 'anchor'; retval.anchor = {}; retval.anchor.name = retval.anchor.id = anchorMatch[ 1 ]; } // Protected email link as encoded string. else if ( ( emailMatch = href.match( emailRegex ) ) ) { var subjectMatch = href.match( emailSubjectRegex ), bodyMatch = href.match( emailBodyRegex ); retval.type = 'email'; var email = ( retval.email = {} ); email.address = emailMatch[ 1 ]; subjectMatch && ( email.subject = decodeURIComponent( subjectMatch[ 1 ] ) ); bodyMatch && ( email.body = decodeURIComponent( bodyMatch[ 1 ] ) ); } // urlRegex matches empty strings, so need to check for href as well. else if ( href && ( urlMatch = href.match( urlRegex ) ) ) { retval.type = 'url'; retval.url = {}; retval.url.protocol = urlMatch[ 1 ]; retval.url.url = urlMatch[ 2 ]; } } // Load target and popup settings. if ( element ) { var target = element.getAttribute( 'target' ); // IE BUG: target attribute is an empty string instead of null in IE if it's not set. if ( !target ) { var onclick = element.data( 'cke-pa-onclick' ) || element.getAttribute( 'onclick' ), onclickMatch = onclick && onclick.match( popupRegex ); if ( onclickMatch ) { retval.target = { type: 'popup', name: onclickMatch[ 1 ] }; var featureMatch; while ( ( featureMatch = popupFeaturesRegex.exec( onclickMatch[ 2 ] ) ) ) { // Some values should remain numbers (#7300) if ( ( featureMatch[ 2 ] == 'yes' || featureMatch[ 2 ] == '1' ) && !( featureMatch[ 1 ] in { height: 1, width: 1, top: 1, left: 1 } ) ) retval.target[ featureMatch[ 1 ] ] = true; else if ( isFinite( featureMatch[ 2 ] ) ) retval.target[ featureMatch[ 1 ] ] = featureMatch[ 2 ]; } } } else { retval.target = { type: target.match( selectableTargets ) ? target : 'frame', name: target }; } var advanced = {}; for ( var a in advAttrNames ) { var val = element.getAttribute( a ); if ( val ) advanced[ advAttrNames[ a ] ] = val; } var advName = element.data( 'cke-saved-name' ) || advanced.advName; if ( advName ) advanced.advName = advName; if ( !CKEDITOR.tools.isEmpty( advanced ) ) retval.advanced = advanced; } return retval; }, /** * Converts link data produced by {@link #parseLinkAttributes} into an object which consists * of attributes to be set (with their values) and an array of attributes to be removed. * This method can be used to compose or to update any link element with the given data. * * @since 4.4 * @param {CKEDITOR.editor} editor * @param {Object} data Data in {@link #parseLinkAttributes} format. * @returns {Object} An object consisting of two keys, i.e.: * * { * // Attributes to be set. * set: { * href: 'http://foo.bar', * target: 'bang' * }, * // Attributes to be removed. * removed: [ * 'id', 'style' * ] * } * */ getLinkAttributes: function( editor, data ) { var emailProtection = editor.config.emailProtection || '', set = {}; // Compose the URL. switch ( data.type ) { case 'url': var protocol = ( data.url && data.url.protocol !== undefined ) ? data.url.protocol : 'http://', url = ( data.url && CKEDITOR.tools.trim( data.url.url ) ) || ''; set[ 'data-cke-saved-href' ] = ( url.indexOf( '/' ) === 0 ) ? url : protocol + url; break; case 'anchor': var name = ( data.anchor && data.anchor.name ), id = ( data.anchor && data.anchor.id ); set[ 'data-cke-saved-href' ] = '#' + ( name || id || '' ); break; case 'email': var email = data.email, address = email.address, linkHref; switch ( emailProtection ) { case '': case 'encode': var subject = encodeURIComponent( email.subject || '' ), body = encodeURIComponent( email.body || '' ), argList = []; // Build the e-mail parameters first. subject && argList.push( 'subject=' + subject ); body && argList.push( 'body=' + body ); argList = argList.length ? '?' + argList.join( '&' ) : ''; if ( emailProtection == 'encode' ) { linkHref = [ 'javascript:void(location.href=\'mailto:\'+', // jshint ignore:line protectEmailAddressAsEncodedString( address ) ]; // parameters are optional. argList && linkHref.push( '+\'', escapeSingleQuote( argList ), '\'' ); linkHref.push( ')' ); } else { linkHref = [ 'mailto:', address, argList ]; } break; default: // Separating name and domain. var nameAndDomain = address.split( '@', 2 ); email.name = nameAndDomain[ 0 ]; email.domain = nameAndDomain[ 1 ]; linkHref = [ 'javascript:', protectEmailLinkAsFunction( editor, email ) ]; // jshint ignore:line } set[ 'data-cke-saved-href' ] = linkHref.join( '' ); break; } // Popups and target. if ( data.target ) { if ( data.target.type == 'popup' ) { var onclickList = [ 'window.open(this.href, \'', data.target.name || '', '\', \'' ], featureList = [ 'resizable', 'status', 'location', 'toolbar', 'menubar', 'fullscreen', 'scrollbars', 'dependent' ], featureLength = featureList.length, addFeature = function( featureName ) { if ( data.target[ featureName ] ) featureList.push( featureName + '=' + data.target[ featureName ] ); }; for ( var i = 0; i < featureLength; i++ ) featureList[ i ] = featureList[ i ] + ( data.target[ featureList[ i ] ] ? '=yes' : '=no' ); addFeature( 'width' ); addFeature( 'left' ); addFeature( 'height' ); addFeature( 'top' ); onclickList.push( featureList.join( ',' ), '\'); return false;' ); set[ 'data-cke-pa-onclick' ] = onclickList.join( '' ); } else if ( data.target.type != 'notSet' && data.target.name ) { set.target = data.target.name; } } // Advanced attributes. if ( data.advanced ) { for ( var a in advAttrNames ) { var val = data.advanced[ advAttrNames[ a ] ]; if ( val ) set[ a ] = val; } if ( set.name ) set[ 'data-cke-saved-name' ] = set.name; } // Browser need the "href" fro copy/paste link to work. (#6641) if ( set[ 'data-cke-saved-href' ] ) set.href = set[ 'data-cke-saved-href' ]; var removed = { target: 1, onclick: 1, 'data-cke-pa-onclick': 1, 'data-cke-saved-name': 1 }; if ( data.advanced ) CKEDITOR.tools.extend( removed, advAttrNames ); // Remove all attributes which are not currently set. for ( var s in set ) delete removed[ s ]; return { set: set, removed: CKEDITOR.tools.objectKeys( removed ) }; } }; // TODO Much probably there's no need to expose these as public objects. CKEDITOR.unlinkCommand = function() {}; CKEDITOR.unlinkCommand.prototype = { exec: function( editor ) { var style = new CKEDITOR.style( { element: 'a', type: CKEDITOR.STYLE_INLINE, alwaysRemoveElement: 1 } ); editor.removeStyle( style ); }, refresh: function( editor, path ) { // Despite our initial hope, document.queryCommandEnabled() does not work // for this in Firefox. So we must detect the state by element paths. var element = path.lastElement && path.lastElement.getAscendant( 'a', true ); if ( element && element.getName() == 'a' && element.getAttribute( 'href' ) && element.getChildCount() ) this.setState( CKEDITOR.TRISTATE_OFF ); else this.setState( CKEDITOR.TRISTATE_DISABLED ); }, contextSensitive: 1, startDisabled: 1, requiredContent: 'a[href]' }; CKEDITOR.removeAnchorCommand = function() {}; CKEDITOR.removeAnchorCommand.prototype = { exec: function( editor ) { var sel = editor.getSelection(), bms = sel.createBookmarks(), anchor; if ( sel && ( anchor = sel.getSelectedElement() ) && ( !anchor.getChildCount() ? CKEDITOR.plugins.link.tryRestoreFakeAnchor( editor, anchor ) : anchor.is( 'a' ) ) ) anchor.remove( 1 ); else { if ( ( anchor = CKEDITOR.plugins.link.getSelectedLink( editor ) ) ) { if ( anchor.hasAttribute( 'href' ) ) { anchor.removeAttributes( { name: 1, 'data-cke-saved-name': 1 } ); anchor.removeClass( 'cke_anchor' ); } else { anchor.remove( 1 ); } } } sel.selectBookmarks( bms ); }, requiredContent: 'a[name]' }; CKEDITOR.tools.extend( CKEDITOR.config, { /** * Whether to show the Advanced tab in the Link dialog window. * * @cfg {Boolean} [linkShowAdvancedTab=true] * @member CKEDITOR.config */ linkShowAdvancedTab: true, /** * Whether to show the Target tab in the Link dialog window. * * @cfg {Boolean} [linkShowTargetTab=true] * @member CKEDITOR.config */ linkShowTargetTab: true /** * Whether JavaScript code is allowed as a `href` attribute in an anchor tag. * With this option enabled it is possible to create links like: * * <a href="javascript:alert('Hello world!')">hello world</a> * * By default JavaScript links are not allowed and will not pass * the Link dialog window validation. * * @since 4.4.1 * @cfg {Boolean} [linkJavaScriptLinksAllowed=false] * @member CKEDITOR.config */ } ); } )();
import React from 'react' import Icon from 'react-icon-base' const MdHdrWeak = props => ( <Icon viewBox="0 0 40 40" {...props}> <g><path d="m28.4 26.6c3.6 0 6.6-2.9 6.6-6.6s-3-6.6-6.6-6.6-6.8 2.9-6.8 6.6 3.1 6.6 6.8 6.6z m0-16.6c5.5 0 10 4.5 10 10s-4.5 10-10 10-10-4.5-10-10 4.4-10 10-10z m-20 3.4c3.6 0 6.6 2.9 6.6 6.6s-3 6.6-6.6 6.6-6.8-2.9-6.8-6.6 3.1-6.6 6.8-6.6z"/></g> </Icon> ) export default MdHdrWeak
$(document).ready(function(){ var touch = $('#resp-menu'); var menu = $('.menu'); $(touch).on('click', function(e) { e.preventDefault(); menu.slideToggle(); }); $(window).resize(function(){ var w = $(window).width(); if(w > 767 && menu.is(':hidden')) { menu.removeAttr('style'); } }); });
// It is required by normal call on onReady callbacks describe("Launching tests", function() { jasmine.DEFAULT_TIMEOUT_INTERVAL = 400; it("and setting launch timeout", function(done) { setTimeout(function() { done(); }, 300); }); });
var Foo = /*#__PURE__*/function (_Bar) { "use strict"; babelHelpers.inherits(Foo, _Bar); var _super = babelHelpers.createSuper(Foo); function Foo(...args) { var _this; babelHelpers.classCallCheck(this, Foo); _this = _super.call(this, ...args); babelHelpers.defineProperty(babelHelpers.assertThisInitialized(_this), "bar", "foo"); return _this; } return babelHelpers.createClass(Foo); }(Bar);
/** * @author Richard Davey <rich@photonstorm.com> * @copyright 2018 Photon Storm Ltd. * @license {@link https://github.com/photonstorm/phaser/blob/master/license.txt|MIT License} */ // Transposes the elements of the given matrix (array of arrays). // The transpose of a matrix is a new matrix whose rows are the columns of the original. /** * [description] * * @function Phaser.Utils.Array.Matrix.TransposeMatrix * @since 3.0.0 * * @param {array} array - The array matrix to transpose. * * @return {array} A new array matrix which is a transposed version of the given array. */ var TransposeMatrix = function (array) { var sourceRowCount = array.length; var sourceColCount = array[0].length; var result = new Array(sourceColCount); for (var i = 0; i < sourceColCount; i++) { result[i] = new Array(sourceRowCount); for (var j = sourceRowCount - 1; j > -1; j--) { result[i][j] = array[j][i]; } } return result; }; module.exports = TransposeMatrix;
#!/usr/bin/env node /** * Tmplify prototype. */ 'use strict' process.chdir(`${__dirname}/..`) const path = require('path') const fs = require('fs') const { runTasks } = require('ape-tasking') const tmplconv = require('tmplconv') const scaffold = require('../lib') let demo = path.dirname(require.resolve('apeman-demo-web/package.json')) let demoPkg = require('apeman-demo-web/package.json') runTasks('tmplify', [ () => tmplconv.tmplify(demo, 'asset/tmpl', { clean: true, mode: '444', pattern: [ '**/*.*', '.*', 'src/.*.json', '*/.*.bud', '+(ui|test)/**/.*.bud', '*/.*.hbs' ], ignore: [ 'node_modules/**/*.*', 'dist/**/*.*', 'public/**/*.*', 'shim/**/*.*', '.DS_Store', '.svg' ], data: { 'github_repository': 'apeman-demo-labo/apeman-demo-web', 'package_name': demoPkg.name, 'package_description': demoPkg.description, 'domain_name': 'demo-web.apeman.info', 'app_name': 'Apeman Demo Web', 'app_description': 'Demo web site with apeman framework.', 'author_name': demoPkg.author.name, 'author_email': demoPkg.author.email, 'author_url': demoPkg.author.url, 'ga_tracking_id': 'UA-88384782-1' }, prefix: scaffold.prefix, suffix: scaffold.suffix }), () => tmplconv.tmplify(__dirname + '/..', 'asset/tmpl', { pattern: [ '.gitignore' ], prefix: scaffold.prefix, suffix: scaffold.suffix }), (callback) => { let filename = require.resolve('../asset/tmpl/package.json.tmpl') let str = fs.readFileSync(filename).toString() let pkg = JSON.parse(str) fs.chmodSync(filename, '644') fs.writeFileSync(filename, JSON.stringify({ name: pkg.name, version: '1.0.0', description: pkg.description, main: pkg.main, scripts: pkg.scripts, repository: pkg.repository.url.split(/\//g).slice(-1).join('/').replace(/\.git$/, ''), keywords: pkg.keywords, author: pkg.author, license: pkg.license, bugs: pkg.bugs, homepage: pkg.homepage, dependencies: pkg.dependencies, devDependencies: pkg.devDependencies, engines: pkg.engines }, null, 2)) fs.chmodSync(filename, '444') callback(null) } ], true)
'use strict'; module.exports = function(Chart) { var helpers = Chart.helpers; Chart.defaults.bar = { hover: { mode: 'label' }, scales: { xAxes: [{ type: 'category', // Specific to Bar Controller categoryPercentage: 0.8, barPercentage: 0.9, // grid line settings gridLines: { offsetGridLines: true } }], yAxes: [{ type: 'linear' }] } }; Chart.controllers.bar = Chart.DatasetController.extend({ dataElementType: Chart.elements.Rectangle, initialize: function(chart, datasetIndex) { Chart.DatasetController.prototype.initialize.call(this, chart, datasetIndex); var me = this; var meta = me.getMeta(); var dataset = me.getDataset(); meta.stack = dataset.stack; // Use this to indicate that this is a bar dataset. meta.bar = true; }, // Correctly calculate the bar width accounting for stacks and the fact that not all bars are visible getStackCount: function() { var me = this; var meta = me.getMeta(); var yScale = me.getScaleForId(meta.yAxisID); var stacks = []; helpers.each(me.chart.data.datasets, function(dataset, datasetIndex) { var dsMeta = me.chart.getDatasetMeta(datasetIndex); if (dsMeta.bar && me.chart.isDatasetVisible(datasetIndex) && (yScale.options.stacked === false || (yScale.options.stacked === true && stacks.indexOf(dsMeta.stack) === -1) || (yScale.options.stacked === undefined && (dsMeta.stack === undefined || stacks.indexOf(dsMeta.stack) === -1)))) { stacks.push(dsMeta.stack); } }, me); return stacks.length; }, update: function(reset) { var me = this; helpers.each(me.getMeta().data, function(rectangle, index) { me.updateElement(rectangle, index, reset); }, me); }, updateElement: function(rectangle, index, reset) { var me = this; var meta = me.getMeta(); var xScale = me.getScaleForId(meta.xAxisID); var yScale = me.getScaleForId(meta.yAxisID); var scaleBase = yScale.getBasePixel(); var rectangleElementOptions = me.chart.options.elements.rectangle; var custom = rectangle.custom || {}; var dataset = me.getDataset(); rectangle._xScale = xScale; rectangle._yScale = yScale; rectangle._datasetIndex = me.index; rectangle._index = index; var ruler = me.getRuler(index); // The index argument for compatible rectangle._model = { x: me.calculateBarX(index, me.index, ruler), y: reset ? scaleBase : me.calculateBarY(index, me.index), // Tooltip label: me.chart.data.labels[index], datasetLabel: dataset.label, // Appearance horizontal: false, base: reset ? scaleBase : me.calculateBarBase(me.index, index), width: me.calculateBarWidth(ruler), backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor), borderSkipped: custom.borderSkipped ? custom.borderSkipped : rectangleElementOptions.borderSkipped, borderColor: custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor), borderWidth: custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth) }; rectangle.pivot(); }, calculateBarBase: function(datasetIndex, index) { var me = this; var meta = me.getMeta(); var yScale = me.getScaleForId(meta.yAxisID); var base = yScale.getBaseValue(); var original = base; if ((yScale.options.stacked === true) || (yScale.options.stacked === undefined && meta.stack !== undefined)) { var chart = me.chart; var datasets = chart.data.datasets; var value = Number(datasets[datasetIndex].data[index]); for (var i = 0; i < datasetIndex; i++) { var currentDs = datasets[i]; var currentDsMeta = chart.getDatasetMeta(i); if (currentDsMeta.bar && currentDsMeta.yAxisID === yScale.id && chart.isDatasetVisible(i) && meta.stack === currentDsMeta.stack) { var currentVal = Number(currentDs.data[index]); base += value < 0 ? Math.min(currentVal, original) : Math.max(currentVal, original); } } return yScale.getPixelForValue(base); } return yScale.getBasePixel(); }, getRuler: function() { var me = this; var meta = me.getMeta(); var xScale = me.getScaleForId(meta.xAxisID); var stackCount = me.getStackCount(); var tickWidth = xScale.width / xScale.ticks.length; var categoryWidth = tickWidth * xScale.options.categoryPercentage; var categorySpacing = (tickWidth - (tickWidth * xScale.options.categoryPercentage)) / 2; var fullBarWidth = categoryWidth / stackCount; var barWidth = fullBarWidth * xScale.options.barPercentage; var barSpacing = fullBarWidth - (fullBarWidth * xScale.options.barPercentage); return { stackCount: stackCount, tickWidth: tickWidth, categoryWidth: categoryWidth, categorySpacing: categorySpacing, fullBarWidth: fullBarWidth, barWidth: barWidth, barSpacing: barSpacing }; }, calculateBarWidth: function(ruler) { var me = this; var meta = me.getMeta(); var xScale = me.getScaleForId(meta.xAxisID); if (xScale.options.barThickness) { return xScale.options.barThickness; } return xScale.options.stacked ? ruler.categoryWidth * xScale.options.barPercentage : ruler.barWidth; }, // Get stack index from the given dataset index accounting for stacks and the fact that not all bars are visible getStackIndex: function(datasetIndex) { var me = this; var meta = me.chart.getDatasetMeta(datasetIndex); var yScale = me.getScaleForId(meta.yAxisID); var dsMeta, j; var stacks = [meta.stack]; for (j = 0; j < datasetIndex; ++j) { dsMeta = this.chart.getDatasetMeta(j); if (dsMeta.bar && this.chart.isDatasetVisible(j) && (yScale.options.stacked === false || (yScale.options.stacked === true && stacks.indexOf(dsMeta.stack) === -1) || (yScale.options.stacked === undefined && (dsMeta.stack === undefined || stacks.indexOf(dsMeta.stack) === -1)))) { stacks.push(dsMeta.stack); } } return stacks.length - 1; }, calculateBarX: function(index, datasetIndex, ruler) { var me = this; var meta = me.getMeta(); var xScale = me.getScaleForId(meta.xAxisID); var stackIndex = me.getStackIndex(datasetIndex); var leftTick = xScale.getPixelForValue(null, index, datasetIndex, me.chart.isCombo); leftTick -= me.chart.isCombo ? (ruler.tickWidth / 2) : 0; if (xScale.options.stacked) { return leftTick + (ruler.categoryWidth / 2) + ruler.categorySpacing; } return leftTick + (ruler.barWidth / 2) + ruler.categorySpacing + (ruler.barWidth * stackIndex) + (ruler.barSpacing / 2) + (ruler.barSpacing * stackIndex); }, calculateBarY: function(index, datasetIndex) { var me = this; var meta = me.getMeta(); var yScale = me.getScaleForId(meta.yAxisID); var value = Number(me.getDataset().data[index]); if (yScale.options.stacked || (yScale.options.stacked === undefined && meta.stack !== undefined)) { var base = yScale.getBaseValue(); var sumPos = base, sumNeg = base; for (var i = 0; i < datasetIndex; i++) { var ds = me.chart.data.datasets[i]; var dsMeta = me.chart.getDatasetMeta(i); if (dsMeta.bar && dsMeta.yAxisID === yScale.id && me.chart.isDatasetVisible(i) && meta.stack === dsMeta.stack) { var stackedVal = Number(ds.data[index]); if (stackedVal < 0) { sumNeg += stackedVal || 0; } else { sumPos += stackedVal || 0; } } } if (value < 0) { return yScale.getPixelForValue(sumNeg + value); } return yScale.getPixelForValue(sumPos + value); } return yScale.getPixelForValue(value); }, draw: function() { var me = this; var chart = me.chart; var elements = me.getMeta().data; var dataset = me.getDataset(); var ilen = elements.length; var i = 0; var d; Chart.canvasHelpers.clipArea(chart.ctx, chart.chartArea); for (; i<ilen; ++i) { d = dataset.data[i]; if (d !== null && d !== undefined && !isNaN(d)) { elements[i].draw(); } } Chart.canvasHelpers.unclipArea(chart.ctx); }, setHoverStyle: function(rectangle) { var dataset = this.chart.data.datasets[rectangle._datasetIndex]; var index = rectangle._index; var custom = rectangle.custom || {}; var model = rectangle._model; model.backgroundColor = custom.hoverBackgroundColor ? custom.hoverBackgroundColor : helpers.getValueAtIndexOrDefault(dataset.hoverBackgroundColor, index, helpers.getHoverColor(model.backgroundColor)); model.borderColor = custom.hoverBorderColor ? custom.hoverBorderColor : helpers.getValueAtIndexOrDefault(dataset.hoverBorderColor, index, helpers.getHoverColor(model.borderColor)); model.borderWidth = custom.hoverBorderWidth ? custom.hoverBorderWidth : helpers.getValueAtIndexOrDefault(dataset.hoverBorderWidth, index, model.borderWidth); }, removeHoverStyle: function(rectangle) { var dataset = this.chart.data.datasets[rectangle._datasetIndex]; var index = rectangle._index; var custom = rectangle.custom || {}; var model = rectangle._model; var rectangleElementOptions = this.chart.options.elements.rectangle; model.backgroundColor = custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor); model.borderColor = custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor); model.borderWidth = custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth); } }); // including horizontalBar in the bar file, instead of a file of its own // it extends bar (like pie extends doughnut) Chart.defaults.horizontalBar = { hover: { mode: 'label' }, scales: { xAxes: [{ type: 'linear', position: 'bottom' }], yAxes: [{ position: 'left', type: 'category', // Specific to Horizontal Bar Controller categoryPercentage: 0.8, barPercentage: 0.9, // grid line settings gridLines: { offsetGridLines: true } }] }, elements: { rectangle: { borderSkipped: 'left' } }, tooltips: { callbacks: { title: function(tooltipItems, data) { // Pick first xLabel for now var title = ''; if (tooltipItems.length > 0) { if (tooltipItems[0].yLabel) { title = tooltipItems[0].yLabel; } else if (data.labels.length > 0 && tooltipItems[0].index < data.labels.length) { title = data.labels[tooltipItems[0].index]; } } return title; }, label: function(tooltipItem, data) { var datasetLabel = data.datasets[tooltipItem.datasetIndex].label || ''; return datasetLabel + ': ' + tooltipItem.xLabel; } } } }; Chart.controllers.horizontalBar = Chart.controllers.bar.extend({ // Correctly calculate the bar width accounting for stacks and the fact that not all bars are visible getStackCount: function() { var me = this; var meta = me.getMeta(); var xScale = me.getScaleForId(meta.xAxisID); var stacks = []; helpers.each(me.chart.data.datasets, function(dataset, datasetIndex) { var dsMeta = me.chart.getDatasetMeta(datasetIndex); if (dsMeta.bar && me.chart.isDatasetVisible(datasetIndex) && (xScale.options.stacked === false || (xScale.options.stacked === true && stacks.indexOf(dsMeta.stack) === -1) || (xScale.options.stacked === undefined && (dsMeta.stack === undefined || stacks.indexOf(dsMeta.stack) === -1)))) { stacks.push(dsMeta.stack); } }, me); return stacks.length; }, updateElement: function(rectangle, index, reset) { var me = this; var meta = me.getMeta(); var xScale = me.getScaleForId(meta.xAxisID); var yScale = me.getScaleForId(meta.yAxisID); var scaleBase = xScale.getBasePixel(); var custom = rectangle.custom || {}; var dataset = me.getDataset(); var rectangleElementOptions = me.chart.options.elements.rectangle; rectangle._xScale = xScale; rectangle._yScale = yScale; rectangle._datasetIndex = me.index; rectangle._index = index; var ruler = me.getRuler(index); // The index argument for compatible rectangle._model = { x: reset ? scaleBase : me.calculateBarX(index, me.index), y: me.calculateBarY(index, me.index, ruler), // Tooltip label: me.chart.data.labels[index], datasetLabel: dataset.label, // Appearance horizontal: true, base: reset ? scaleBase : me.calculateBarBase(me.index, index), height: me.calculateBarHeight(ruler), backgroundColor: custom.backgroundColor ? custom.backgroundColor : helpers.getValueAtIndexOrDefault(dataset.backgroundColor, index, rectangleElementOptions.backgroundColor), borderSkipped: custom.borderSkipped ? custom.borderSkipped : rectangleElementOptions.borderSkipped, borderColor: custom.borderColor ? custom.borderColor : helpers.getValueAtIndexOrDefault(dataset.borderColor, index, rectangleElementOptions.borderColor), borderWidth: custom.borderWidth ? custom.borderWidth : helpers.getValueAtIndexOrDefault(dataset.borderWidth, index, rectangleElementOptions.borderWidth) }; rectangle.pivot(); }, calculateBarBase: function(datasetIndex, index) { var me = this; var meta = me.getMeta(); var xScale = me.getScaleForId(meta.xAxisID); var base = xScale.getBaseValue(); var originalBase = base; if (xScale.options.stacked || (xScale.options.stacked === undefined && meta.stack !== undefined)) { var chart = me.chart; var datasets = chart.data.datasets; var value = Number(datasets[datasetIndex].data[index]); for (var i = 0; i < datasetIndex; i++) { var currentDs = datasets[i]; var currentDsMeta = chart.getDatasetMeta(i); if (currentDsMeta.bar && currentDsMeta.xAxisID === xScale.id && chart.isDatasetVisible(i) && meta.stack === currentDsMeta.stack) { var currentVal = Number(currentDs.data[index]); base += value < 0 ? Math.min(currentVal, originalBase) : Math.max(currentVal, originalBase); } } return xScale.getPixelForValue(base); } return xScale.getBasePixel(); }, getRuler: function() { var me = this; var meta = me.getMeta(); var yScale = me.getScaleForId(meta.yAxisID); var stackCount = me.getStackCount(); var tickHeight = yScale.height / yScale.ticks.length; var categoryHeight = tickHeight * yScale.options.categoryPercentage; var categorySpacing = (tickHeight - (tickHeight * yScale.options.categoryPercentage)) / 2; var fullBarHeight = categoryHeight / stackCount; var barHeight = fullBarHeight * yScale.options.barPercentage; var barSpacing = fullBarHeight - (fullBarHeight * yScale.options.barPercentage); return { stackCount: stackCount, tickHeight: tickHeight, categoryHeight: categoryHeight, categorySpacing: categorySpacing, fullBarHeight: fullBarHeight, barHeight: barHeight, barSpacing: barSpacing }; }, calculateBarHeight: function(ruler) { var me = this; var meta = me.getMeta(); var yScale = me.getScaleForId(meta.yAxisID); if (yScale.options.barThickness) { return yScale.options.barThickness; } return yScale.options.stacked ? ruler.categoryHeight * yScale.options.barPercentage : ruler.barHeight; }, // Get stack index from the given dataset index accounting for stacks and the fact that not all bars are visible getStackIndex: function(datasetIndex) { var me = this; var meta = me.chart.getDatasetMeta(datasetIndex); var xScale = me.getScaleForId(meta.xAxisID); var dsMeta, j; var stacks = [meta.stack]; for (j = 0; j < datasetIndex; ++j) { dsMeta = this.chart.getDatasetMeta(j); if (dsMeta.bar && this.chart.isDatasetVisible(j) && (xScale.options.stacked === false || (xScale.options.stacked === true && stacks.indexOf(dsMeta.stack) === -1) || (xScale.options.stacked === undefined && (dsMeta.stack === undefined || stacks.indexOf(dsMeta.stack) === -1)))) { stacks.push(dsMeta.stack); } } return stacks.length - 1; }, calculateBarX: function(index, datasetIndex) { var me = this; var meta = me.getMeta(); var xScale = me.getScaleForId(meta.xAxisID); var value = Number(me.getDataset().data[index]); if (xScale.options.stacked || (xScale.options.stacked === undefined && meta.stack !== undefined)) { var base = xScale.getBaseValue(); var sumPos = base, sumNeg = base; for (var i = 0; i < datasetIndex; i++) { var ds = me.chart.data.datasets[i]; var dsMeta = me.chart.getDatasetMeta(i); if (dsMeta.bar && dsMeta.xAxisID === xScale.id && me.chart.isDatasetVisible(i) && meta.stack === dsMeta.stack) { var stackedVal = Number(ds.data[index]); if (stackedVal < 0) { sumNeg += stackedVal || 0; } else { sumPos += stackedVal || 0; } } } if (value < 0) { return xScale.getPixelForValue(sumNeg + value); } return xScale.getPixelForValue(sumPos + value); } return xScale.getPixelForValue(value); }, calculateBarY: function(index, datasetIndex, ruler) { var me = this; var meta = me.getMeta(); var yScale = me.getScaleForId(meta.yAxisID); var stackIndex = me.getStackIndex(datasetIndex); var topTick = yScale.getPixelForValue(null, index, datasetIndex, me.chart.isCombo); topTick -= me.chart.isCombo ? (ruler.tickHeight / 2) : 0; if (yScale.options.stacked) { return topTick + (ruler.categoryHeight / 2) + ruler.categorySpacing; } return topTick + (ruler.barHeight / 2) + ruler.categorySpacing + (ruler.barHeight * stackIndex) + (ruler.barSpacing / 2) + (ruler.barSpacing * stackIndex); } }); };
/** * ProjectController * * @module :: Controller * @description :: A set of functions called `actions`. * * Actions contain code telling Sails how to respond to a certain type of request. * (i.e. do stuff, then send some JSON, show an HTML page, or redirect to another URL) * * You can configure the blueprint URLs which trigger these actions (`config/controllers.js`) * and/or override them with custom routes (`config/routes.js`) * * NOTE: The code you write here supports both HTTP and Socket.io automatically. * * @docs :: http://sailsjs.org/#!documentation/controllers * * @bugs :: api/controllers/ProjectController.js:636:62 */ var async = require("async"); module.exports = { /** * Overrides for the settings in `config/controllers.js` * (specific to ProjectController) */ _config: {}, /** * Project add action. This will render a GUI for new project add. * * @param {Request} request Request object * @param {Response} response Response object */ add: function(request, response) { async.parallel( { // Fetch users users: function(callback) { DataService.getUsers({}, callback); } }, /** * Callback function which is been called after all parallel jobs are processed. * * @param {null|Error} error * @param {{users: sails.model.user[]}} data */ function(error, data) { if (error) { ResponseService.makeError(error, request, response); } else { response.view(data); } } ); }, /** * Project edit action. This will render a GUI for specified project edit. * * @param {Request} request Request object * @param {Response} response Response object */ edit: function(request, response) { var projectId = parseInt(request.param("id"), 10); async.parallel( { // Fetch project data. project: function(callback) { DataService.getProject(projectId, callback); }, // Fetch taskboard user data. users: function(callback) { DataService.getUsers({}, callback); } }, /** * Callback function which is been called after all parallel jobs are processed. * * @param {null|Error} error Possible error * @param {{ * project: sails.model.project * users: sails.model.user[] * }} data Object that contains 'project' and 'users' objects */ function(error, data) { if (error) { ResponseService.makeError(error, request, response); } else { response.view(data); } } ); }, /** * Project backlog action that will render a GUI that contains all stories * that are not yet assigned to any sprint. These stories are in project backlog. * * @param {Request} request Request object * @param {Response} response Response object */ backlog: function(request, response) { var projectId = parseInt(request.param("id"), 10); async.parallel( { // Fetch user role role: function(callback) { AuthService.hasProjectAccess(request.user, projectId, callback, true); }, // Fetch project data. project: function(callback) { DataService.getProject(projectId, callback); }, // Fetch project stories that are in backlog. stories: function(callback) { DataService.getStories({ projectId: projectId, sprintId: 0 }, callback); } }, /** * Callback function which is been called after all parallel jobs are processed. * * @param {null|Error} error Possible error * @param {{ * role: sails.helper.role * project: sails.model.project * stories: sails.model.story[] * }} data Data that contains 'role', 'project' and 'stories' */ function(error, data) { if (error) { ResponseService.makeError(error, request, response); } else { response.view(data); } } ); }, /** * Project milestones action, this will render a GUI that shows all milestones for specified * project and some statistics data of those progress. * * @param {Request} request Request object * @param {Response} response Response object */ milestones: function(request, response) { var projectId = parseInt(request.param("id"), 10); var data = { role: 0, milestones: false, project: false, progressMilestones: 0, progressStories: 0, progressTasks: 0, cntMilestonesDone: 0, cntMilestonesTotal: 0, cntStoriesDone: 0, cntStoriesTotal: 0, cntTasksDone: 0, cntTasksTotal: 0 }; async.parallel( { // Fetch user role role: function(callback) { AuthService.hasProjectAccess(request.user, projectId, callback, true); }, // Fetch project data. project: function(callback) { DataService.getProject(projectId, callback); }, // Fetch project milestone data. milestones: function(callback) { DataService.getMilestones({projectId: projectId}, callback); } }, /** * Callback function which is been called after all parallel jobs are processed. * * @param {null|Error} error * @param {{ * role: sails.helper.role * project: sails.model.project * milestones: sails.model.milestone[] * }} results */ function(error, results) { if (error) { ResponseService.makeError(error, request, response); } else { data.role = results.role; data.project = results.project; data.milestones = results.milestones; data.cntMilestonesTotal = data.milestones.length; // Iterate each milestones and fetch stories of those async.each(data.milestones, fetchStories, renderView); } } ); /** * Private function to fetch all stories that belongs to specified milestone. * * @param {sails.model.milestone} milestone Milestone object * @param {Function} callback Callback function to call when processing is done */ function fetchStories(milestone, callback) { milestone.stories = false; // Fetch stories that belongs to specified milestone DataService.getStories({milestoneId: milestone.id}, function(error, stories) { if (error) { callback(error); } else { milestone.doneStories = _.reduce(stories, function(memo, story) { return (story.isDone) ? memo + 1 : memo; }, 0); data.cntStoriesTotal = data.cntStoriesTotal + stories.length; data.cntStoriesDone = data.cntStoriesDone + milestone.doneStories; if (milestone.doneStories > 0) { if (stories.length === milestone.doneStories) { data.cntMilestonesDone = data.cntMilestonesDone + 1; } milestone.progress = Math.round(milestone.doneStories / stories.length * 100); } else { milestone.progress = 0; } var storyIds = _.map(stories, function(story) { return { storyId: story.id }; }); // Add stories to milestone data milestone.stories = stories; // We have some stories, so fetch tasks of those if (storyIds.length > 0) { fetchTasks(milestone, storyIds, callback); } else { // Add tasks to milestone data milestone.tasks = []; callback(null); } } }); } /** * Private function to fetch all tasks that belongs to specified stories. * * @param {sails.model.milestone} milestone Milestone object * @param {{storyId: {Number}}[]} storyIds Story ids as an array of objects * @param {Function} callback Callback function to call whenever process is "done" */ function fetchTasks(milestone, storyIds, callback) { // Fetch tasks DataService.getTasks({or: storyIds}, function(error, tasks) { if (error) { callback(error); } else { data.cntTasksTotal = data.cntTasksTotal + tasks.length; data.cntTasksDone = data.cntTasksDone + _.reduce(tasks, function(memo, task) { return (task.isDone) ? memo + 1 : memo; }, 0); // Add tasks to milestone data milestone.tasks = tasks; callback(null); } }); } /** * Private function to render actual view. This is called whenever error occurs in * sub-processes or all of those jobs are processed successfully. * * @param {null|Error} error Possible error */ function renderView(error) { if (error) { ResponseService.makeError(error, request, response); } else { if (data.cntMilestonesDone > 0) { data.progressMilestones = Math.round(data.cntMilestonesDone / data.cntMilestonesTotal * 100); } else { data.progressMilestones = 0; } if (data.cntStoriesDone > 0) { data.progressStories = Math.round(data.cntStoriesDone / data.cntStoriesTotal * 100); } else { data.progressStories = 0; } if (data.cntTasksDone > 0) { data.progressTasks = Math.round(data.cntTasksDone / data.cntTasksTotal * 100); } else { data.progressTasks = 0; } response.view(data); } } }, /** * Project planning action. This will render a simple GUI for project planning * where user can drag&drop stories between sprints and project backlog. * * @param {Request} request Request object * @param {Response} response Response object */ planning: function(request, response) { var projectId = parseInt(request.param("id"), 10); async.parallel( { // Fetch project data. project: function(callback) { DataService.getProject(projectId, callback); }, // Fetch project story data stories: function(callback) { DataService.getStories({projectId: projectId}, callback); }, // Fetch project sprint data sprints: function(callback) { DataService.getSprints({projectId: projectId}, callback); }, // Fetch user role role: function(callback) { AuthService.hasProjectAccess(request.user, projectId, callback, true); } }, /** * Callback function which is been called after all parallel jobs are processed. * * @param {null|Error} error Possible error * @param {{ * project: sails.model.project, * stories: sails.model.story[], * sprints: sails.model.sprint[], * role: sails.helper.role * }} data Object that contains 'project', 'stories', 'sprints' and 'role' */ function(error, data) { if (error) { ResponseService.makeError(error, request, response); } else { response.view(data); } } ); }, /** * Project statistics action. This is really "heavy" action to process because basically we're * fetching whole project data from database and make some calculations for that data. * * @todo should we just return basic data and handle drill downs by clicking on the gui? * @todo should we store some statistic data to main objects, so calculations are not needed? * * @param {Request} request Request object * @param {Response} response Response object */ statistics: function(request, response) { var projectId = parseInt(request.param("id"), 10); // Specify template data to use var data = { project: { data: false }, milestones: { data: false, stories: [], progress: 0, cntDone: 0, cntTotal: 0 }, sprints: { data: false, stories: [], progress: 0, cntDone: 0, cntTotal: 0 }, stories: { data: false, progress: 0, cntDone: 0, cntTotal: 0 }, tasks: { data: false, progress: 0, cntDone: 0, cntTotal: 0 } }; async.parallel( { // Fetch project data project: function(callback) { DataService.getProject(projectId, callback); }, // Fetch project milestones milestones: function(callback) { DataService.getMilestones({projectId: projectId}, callback); }, // Fetch project sprint data sprints: function(callback) { DataService.getSprints({projectId: projectId}, callback); }, // Fetch project phases data phases: function(callback) { DataService.getPhases({projectId: projectId}, callback); } }, /** * Callback function which is been called after all parallel jobs are processed. * * @param {null|Error} error Possible error * @param {{ * project: sails.model.project, * milestones: sails.model.milestone[], * sprints: sails.model.sprint[], * phases: sails.model.phase[] * }} results Object that contains 'project', 'milestones', 'sprints' and 'phases' */ function(error, results) { if (error) { ResponseService.makeError(error, request, response); } else { data.project.data = results.project; data.milestones.data = results.milestones; data.milestones.cntTotal = results.milestones.length; data.sprints.data = results.sprints; data.sprints.cntTotal = results.sprints.length; data.phases = results.phases; // Fetch needed related data for view fetchRelatedData(); } } ); /** * Private function to fetch needed related data that are needed for GUI. Related data * are following: sum of phase durations, stories, and tasks that are attached to these * stories. * * Note that tasks are fetched in sub process in story fetching. */ function fetchRelatedData() { async.parallel( [ // Determine phase durations function(callback) { fetchPhaseDuration(callback); }, // Fetch stories and task data of those function(callback) { fetchStories(callback); } ], /** * Callback function which is called after all parallel jobs are done. * * @param {null|Error} error Possible error */ function(error) { if (error) { ResponseService.makeError(error, request, response); } else { // Calculate statistics data makeDetailedStatistics(); // Render view response.view(data); } } ); } /** * Private function to fetch project task phase duration times. This will sum tasks durations * for each phase in this project. * * @param {Function} next Main callback function which must be called after all is done */ function fetchPhaseDuration(next) { async.map( data.phases, /** * Function to determine duration in specified phase. * * @param {sails.model.phase} phase * @param {Function} callback */ function(phase, callback) { PhaseDuration .find({ sum: "duration" }) .where({phaseId: phase.id}) .where({projectId: data.project.data.id}) .done(function(error, result) { if (error) { callback(error); } else { phase.duration = result[0].duration ? result[0].duration : 0; callback(null); } }); }, /** * Main callback function which is called after all phases are processed. * * @param {null|Error} error Possible error */ function(error) { next(error) } ); } /** * Private function to fetch all stories that are attached to current project. Note that if stories * are found in project function triggers task fetch process, which will eventually call the main * callback function. * * @param {Function} next Main callback function which must be called after all is done */ function fetchStories(next) { DataService.getStories({projectId: projectId}, function(error, stories) { if (error) { next(error) } else { data.stories.data = stories; data.stories.cntTotal = stories.length; data.stories.cntDone = _.reduce(stories, function(memo, story) { return (story.isDone) ? memo + 1 : memo; }, 0); if (data.stories.cntDone > 0) { data.stories.progress = Math.round(data.stories.cntDone / data.stories.cntTotal * 100); } if (stories.length > 0) { fetchStoriesTasks(next); } else { next(null); } } }); } /** * Private function to fetch all tasks that are attached to project stories. This is only * called if project contains any stories. * * @param {Function} next Main callback function which must be called after all is done */ function fetchStoriesTasks(next) { var storyIds = _.map(data.stories.data, function(story) { return { storyId: story.id }; }); DataService.getTasks({or: storyIds}, function(error, tasks) { if (error) { next(error); } else { data.tasks.data = tasks; data.tasks.cntTotal = tasks.length; data.tasks.cntDone = _.reduce(tasks, function(memo, task) { return (task.isDone) ? memo + 1 : memo; }, 0); if (data.tasks.cntDone > 0) { data.tasks.progress = Math.round(data.tasks.cntDone / data.tasks.cntTotal * 100); } next(null); } }); } /** * Private function makes detailed statistics from fetched data. This function is * called right before rendering the statistics GUI. * * Basically this is just a data "formatter" function that process fetched data and * make some basic calculations about those. */ function makeDetailedStatistics() { var totalTime = 0; var totalTimeNoFirst = 0; if (data.phases.length > 0) { totalTime =_.pluck(data.phases, "duration").reduce(function(memo, i) { return memo + i; }); totalTimeNoFirst = _.pluck(_.reject(data.phases, function(phase) { return phase.order === 0; }), "duration").reduce(function(memo, i) { return memo + i; }); } data.phaseDuration = { totalTime: totalTime, totalTimeNoFirst: totalTimeNoFirst }; _.each(data.phases, function(phase) { phase.durationPercentage = (phase.duration > 0 && phase.order !== 0) ? phase.duration / totalTimeNoFirst * 100 : 0; phase.durationPercentageTotal = (phase.duration > 0) ? phase.duration / totalTime * 100 : 0; }); _.each(data.stories.data, function(story) { story.tasks = { data: [], cntTotal: 0, cntDone: 0, progress: 0 }; story.tasks.data = _.filter(data.tasks.data, function(task) { return task.storyId === story.id; }); story.tasks.cntTotal = story.tasks.data.length; story.tasks.cntDone = _.reduce(story.tasks.data, function(memo, task) { return (task.isDone) ? memo + 1 : memo; }, 0); if (story.tasks.cntDone > 0) { story.tasks.progress = Math.round(story.tasks.cntDone / story.tasks.cntTotal * 100); } }); // Sort stories by tasks progress, story title and priority data.stories.data.sort(HelperService.dynamicSortMultiple("!tasks.progress", "title", "priority")); /** * Iterate fetched sprints and add story data and stories statistics * data to it */ _.each(data.sprints.data, function(sprint) { sprint.stories = { data: [], cntTotal: 0, cntDone: 0, progress: 0 }; sprint.stories.data = _.filter(data.stories.data, function(story) { return story.sprintId === sprint.id; }); sprint.stories.cntTotal = sprint.stories.data.length; sprint.stories.cntDone = _.reduce(sprint.stories.data, function(memo, story) { return (story.isDone) ? memo + 1 : memo; }, 0); if (sprint.stories.cntDone > 0) { sprint.stories.progress = Math.round(sprint.stories.cntDone / sprint.stories.cntTotal * 100); if (sprint.stories.cntDone === sprint.stories.cntTotal) { data.sprints.cntDone = data.sprints.cntDone + 1; } } }); // Calculate sprints total progress if we have any done sprint if (data.sprints.cntDone > 0) { data.sprints.progress = Math.round(data.sprints.cntDone / data.sprints.cntTotal * 100); } _.each(data.milestones.data, function(milestone) { milestone.stories = { data: [], cntTotal: 0, cntDone: 0, progress: 0 }; milestone.stories.data = _.filter(data.stories.data, function(story) { return story.milestoneId === milestone.id; }); milestone.stories.cntTotal = milestone.stories.data.length; milestone.stories.cntDone = _.reduce(milestone.stories.data, function(memo, story) { return (story.isDone) ? memo + 1 : memo; }, 0); if (milestone.stories.cntDone > 0) { milestone.stories.progress = Math.round(milestone.stories.cntDone / milestone.stories.cntTotal * 100); if (milestone.stories.cntDone === milestone.stories.cntTotal) { data.milestones.cntDone = data.milestones.cntDone + 1; } } }); if (data.milestones.cntDone > 0) { data.milestones.progress = Math.round(data.milestones.cntDone / data.milestones.cntTotal * 100); } } }, /** * Project sprints action. This will render a GUI with project sprint progress and list of * those. Within this list user can edit sprints. * * @param {Request} request Request object * @param {Response} response Response object */ sprints: function(request, response) { var projectId = parseInt(request.param("id"), 10); var data = { role: false, project: false, sprints: false, stories: false, tasks: false, progressSprints: 0, progressStories: 0, progressTasks: 0, cntSprintsDone: 0, cntSprintsTotal: 0, cntStoriesDone: 0, cntStoriesTotal: 0, cntTasksDone: 0, cntTasksTotal: 0 }; async.parallel( { // Fetch user role role: function(callback) { AuthService.hasProjectAccess(request.user, projectId, callback, true); }, // Fetch project data. project: function(callback) { DataService.getProject(projectId, callback); }, // Fetch project sprint data sprints: function(callback) { DataService.getSprints({ projectId: projectId }, callback); } }, /** * Callback function which is been called after all parallel jobs are processed. * * @param {null|Error} error * @param {{ * role: sails.helper.role, * project: sails.model.project, * sprints: sails.model.sprint[] * }} results */ function(error, results) { if (error) { ResponseService.makeError(error, request, response); } else { data.role = results.role; data.project = results.project; data.sprints = results.sprints; data.cntSprintsTotal = data.sprints.length; // Fetch story data fetchStoryData(); } } ); /** * Private function to determine attached story data in current project sprints. This * will map each sprints and fetch stories that are attached to them. * * If stories are found function will call private function to fetch task data of each * sprint and determine current status of those. */ function fetchStoryData() { async.map( data.sprints, /** * Iterator function which is called to every sprint that project contains. This will * fetch all attached stories of sprint and after that iterator will call private function * to fetch tasks that are attached to sprint stories. * * @param {sails.model.sprint} sprint Sprint object * @param {Function} callback Callback function to call after job is done */ function(sprint, callback) { DataService.getStories({sprintId: sprint.id}, function(error, stories) { if (error) { callback(error, null); } else { // Add stories to sprint data sprint.stories = stories; // Calculate done stories count sprint.doneStories = _.reduce(stories, function(memo, story) { return (story.isDone) ? memo + 1 : memo; }, 0); // Add global story counter data data.cntStoriesTotal = data.cntStoriesTotal + stories.length; data.cntStoriesDone = data.cntStoriesDone + sprint.doneStories; // Some of sprint stories are done, so calculate sprint progress if (sprint.doneStories > 0) { if (stories.length === sprint.doneStories) { data.cntSprintsDone = data.cntSprintsDone + 1; } sprint.progress = Math.round(sprint.doneStories / stories.length * 100); } else { // Otherwise sprint progress is zero sprint.progress = 0; } // Fetch task data fetchTaskData(sprint, callback); } }); }, /** * Main callback function which will eventually render the GUI for user. * * @param {null|Error} error Possible error * @param {sails.model.sprint[]} results Sprint data */ function(error, results) { if (error) { ResponseService.makeError(error, request, response); } else { data.sprints = results; if (data.cntSprintsDone > 0) { data.progressSprints = Math.round(data.cntSprintsDone / data.cntSprintsTotal * 100); } else { data.progressSprints = 0; } if (data.cntStoriesDone > 0) { data.progressStories = Math.round(data.cntStoriesDone / data.cntStoriesTotal * 100); } else { data.progressStories = 0; } if (data.cntTasksDone > 0) { data.progressTasks = Math.round(data.cntTasksDone / data.cntTasksTotal * 100); } else { data.progressTasks = 0; } response.view(data); } } ) } /** * Private function to fetch task data which are attached to current sprint stories. * * @param {sails.model.sprint} sprint Sprint object * @param {Function} next Callback function which must be called after this job */ function fetchTaskData(sprint, next) { // Determine story id values for task data fetch var storyIds = _.map(sprint.stories, function(story) { return { storyId: story.id }; }); // We have stories so determine tasks of those stories if (storyIds.length > 0) { DataService.getTasks({or: storyIds}, function(error, tasks) { if (error) { next(error, null); } else { data.cntTasksTotal = data.cntTasksTotal + tasks.length; data.cntTasksDone = data.cntTasksDone + _.reduce(tasks, function(memo, task) { return (task.isDone) ? memo + 1 : memo; }, 0); // Add tasks to sprint data sprint.tasks = tasks; next(null, sprint); } }); } else { // Oh nou, no stories on this sprint sprint.tasks = []; next(null, sprint); } } } };
define(["require", "exports", '../validation/utilities'], function (require, exports, utilities_1) { exports.data = { settings: { 'numericRegex': /^-?(?:\d+)(?:\,\d+)?$/ }, messages: { 'isRequired': 'est obligatoire', 'onValidateCallback': "n'est pas une valeur valide", 'AlphaNumericOrWhitespaceValidationRule': function (newValue, threshold) { return "ne peut contenir que des caract\u00E8res alphanum\u00E9riques ou des espaces"; }, 'AlphaNumericValidationRule': function (newValue, threshold) { return "ne peut contenir que des caract\u00E8res alphanum\u00E9riques"; }, 'AlphaValidationRule': function (newValue, threshold) { return "ne peut contenir que des lettres"; }, 'AlphaOrWhitespaceValidationRule': function (newValue, threshold) { return "ne peut contenir que des lettres ou des espaces"; }, 'BetweenLengthValidationRule': function (newValue, threshold) { return "doit contenir de " + utilities_1.Utilities.getValue(threshold.minimumLength) + " \u00E0 " + utilities_1.Utilities.getValue(threshold.maximumLength) + " caract\u00E8res"; }, 'BetweenValueValidationRule': function (newValue, threshold) { return "doit \u00EAtre entre " + utilities_1.Utilities.getValue(threshold.minimumValue) + " et " + utilities_1.Utilities.getValue(threshold.maximumValue); }, 'CustomFunctionValidationRule': function (newValue, threshold) { return "n'est pas une valeur valide"; }, 'DigitValidationRule': function (newValue, threshold) { return "doit contenir uniquement des caract\u00E8res num\u00E9riques"; }, 'EmailValidationRule': function (newValue, threshold) { return "n'est pas une adresse email valide"; }, 'EqualityValidationRule': function (newValue, threshold) { return "doit \u00EAtre " + utilities_1.Utilities.getValue(threshold.otherValue); }, 'InEqualityValidationRule': function (newValue, threshold) { return "ne peut pas \u00EAtre " + utilities_1.Utilities.getValue(threshold.otherValue); }, 'EqualityWithOtherLabelValidationRule': function (newValue, threshold) { return "doit correspondre \u00E0 " + utilities_1.Utilities.getValue(threshold.otherValueLabel); }, 'InEqualityWithOtherLabelValidationRule': function (newValue, threshold) { return "ne doit pas correspondre \u00E0 " + utilities_1.Utilities.getValue(threshold.otherValueLabel); }, 'InCollectionValidationRule': function (newValue, threshold) { return "n'est pas une valeur valide"; }, 'MinimumInclusiveValueValidationRule': function (newValue, threshold) { return "doit \u00EAtre " + utilities_1.Utilities.getValue(threshold) + " ou plus"; }, 'MinimumLengthValidationRule': function (newValue, threshold) { return "doit contenir au moins " + utilities_1.Utilities.getValue(threshold) + " caract\u00E8res"; }, 'MinimumValueValidationRule': function (newValue, threshold) { return "doit \u00EAtre plus que " + utilities_1.Utilities.getValue(threshold); }, 'MaximumInclusiveValueValidationRule': function (newValue, threshold) { return "doit \u00EAtre moins que " + utilities_1.Utilities.getValue(threshold); }, 'MaximumLengthValidationRule': function (newValue, threshold) { return "ne doit pas contenir plus de " + utilities_1.Utilities.getValue(threshold) + " caract\u00E8res"; }, 'MaximumValueValidationRule': function (newValue, threshold) { return "doit \u00EAtre " + utilities_1.Utilities.getValue(threshold) + " ou moins"; }, 'NumericValidationRule': function (newValue, threshold) { return "doit \u00EAtre une valeur num\u00E9rique"; }, 'RegexValidationRule': function (newValue, threshold) { return "n'est pas une valeur valide"; }, 'ContainsOnlyValidationRule': function (newValue, threshold) { return "n'est pas une valeur valide"; }, 'StrongPasswordValidationRule': function (newValue, threshold) { return "doit contenir une combinaison de lettres minuscules, de lettres majuscules, de caract\u00E8res num\u00E9riques et de caract\u00E8res sp\u00E9ciaux"; }, 'MediumPasswordValidationRule': function (newValue, threshold) { return "doit contenir au moins " + utilities_1.Utilities.getValue(threshold) + " des caract\u00E9ristiques suivantes : lettres minuscules, lettres majuscules, caract\u00E8res num\u00E9riques ou caract\u00E8res sp\u00E9ciaux"; } } }; });
var test = require("tape") var multiline = require("multiline") var logger = require("./util/logger") var runner = require("./util/runner") test("heading 1", function (t) { var md = multiline.stripIndent(function () {/* # Hello World Boring text * Item one * Sub item one * Sub item two - Item two + Item three */}) var tokens = [ ["heading","#"], ["whitespace"," "], ["text","Hello"], ["whitespace"," "], ["text","World"], ["new line","\n"], ["new line","\n"], ["text","Boring"], ["whitespace"," "], ["text","text"], ["new line","\n"], ["new line","\n"], ["star","*"], ["whitespace"," "], ["text","Item"], ["whitespace"," "], ["text","one"], ["new line","\n"], ["whitespace"," "], ["star","*"], ["whitespace"," "], ["text","Sub"], ["whitespace"," "], ["text","item"], ["whitespace"," "], ["text","one"], ["new line","\n"], ["whitespace"," "], ["star","*"], ["whitespace"," "], ["text","Sub"], ["whitespace"," "], ["text","item"], ["whitespace"," "], ["text","two"], ["new line","\n"], ["list item dash","-"], ["whitespace"," "], ["text","Item"], ["whitespace"," "], ["text","two"], ["new line","\n"], ["list item plus","+"], ["whitespace"," "], ["text","Item"], ["whitespace"," "], ["text","three"], ["new line","\n"] ] //logger(md) runner(t, md, tokens) })
import path from 'path'; import { execSync } from 'child_process'; import fs from 'fs'; import { dependencies } from '../../app/package.json'; const nodeModulesPath = path.join(__dirname, '..', '..', 'app', 'node_modules'); if ( Object.keys(dependencies || {}).length > 0 && fs.existsSync(nodeModulesPath) ) { const electronRebuildCmd = '../node_modules/.bin/electron-rebuild --parallel --force --types prod,dev,optional --module-dir .'; const cmd = process.platform === 'win32' ? electronRebuildCmd.replace(/\//g, '\\') : electronRebuildCmd; execSync(cmd, { cwd: path.join(__dirname, '..', '..', 'app'), stdio: 'inherit', }); }
var path = require('path'); var url = require('url'); var closure = require('closure-util'); var nomnom = require('nomnom'); var log = closure.log; var options = nomnom.options({ port: { abbr: 'p', 'default': 3000, help: 'Port for incoming connections', metavar: 'PORT' }, loglevel: { abbr: 'l', choices: ['silly', 'verbose', 'info', 'warn', 'error'], 'default': 'info', help: 'Log level', metavar: 'LEVEL' } }).parse(); /** @type {string} */ log.level = options.loglevel; log.info('ngeo', 'Parsing dependencies ...'); var manager = new closure.Manager({ closure: true, // use the bundled Closure Library lib: [ 'src/**/*.js', 'node_modules/openlayers/src/**/*.js' ], main: 'examples/*.js' }); manager.on('error', function(e) { log.error('ngeo', e.message); }); manager.on('ready', function() { var server = new closure.Server({ manager: manager }); server.listen(options.port, function() { log.info('ngeo', 'Listening on http://localhost:' + options.port + '/ (Ctrl+C to stop)'); }); server.on('error', function(err) { log.error('ngeo', 'Server failed to start: ' + err.message); process.exit(1); }); });
version https://git-lfs.github.com/spec/v1 oid sha256:a9f560cca4fcf758103b61db9beab23af2138e9d0d108de8d23d959293e6223f size 6290
/** * Angular directive to render Markdown text. It's built on blazingly fast markdown parser 'marked'. * @version v1.1.1 - 2015-11-24 * @link https://github.com/tinkkit/tink-md-angular * @license MIT License, http://www.opensource.org/licenses/MIT */ /* global angular, hljs, marked */ 'use strict'; angular.module('yaru22.md', []).directive('md', [ '$templateRequest', function ($templateRequest) { if (typeof hljs !== 'undefined') { marked.setOptions({ highlight: function (code, lang) { if (lang) { return hljs.highlight(lang, code).value; } else { return hljs.highlightAuto(code).value; } }, headerPrefix: 'md-' }); } return { restrict: 'E', require: '?ngModel', link: function ($scope, $elem, $attrs, ngModel) { if ($attrs.url) { $templateRequest($attrs.url).then(function (template) { var html = marked(template); $elem.html(html); }, function () { console.warn('couldn\'t read url: ' + $attrs.url); }); return; } else if (!ngModel) { // render transcluded text var html = marked($elem.text()); $elem.html(html); return; } ngModel.$render = function () { var html = marked(ngModel.$viewValue || ''); $elem.html(html); }; } // link function }; } ]);
// External Requirements var React = require('react'); var MortarJS = require('../../../../../app-container').MortarJS; // Bricks var Br = MortarJS.require('components', 'Row', 'Column', 'Form', 'Table', 'Modal'); // Stores var FormStore = MortarJS.Stores.FormStore; // Mixins var ResourceComponentMixin = MortarJS.Mixins.ResourceComponentMixin; /** * Draggable Rows * * @type {*|Function} */ var DraggableTable = React.createClass({ mixins: [ResourceComponentMixin], getInitialState: function() { return { params : {}, formIsValid : true }; }, pageConfig: function() { return { stores: [ { store: FormStore } ] }; }, componentDidMount: function() { this._componentDidMount(); }, componentWillUnmount: function() { this._componentWillUnmount(); }, render: function() { var tableOptions = { draggable: true }; return ( <div id="page-wrapper"> <div id="page-content"> <Br.Row> <Br.Column grid="lg" size="12"> <Br.Table data={this.props.workingResource} dataKeys={this.props.tableKeys} title={'Table'} options={tableOptions} /> </Br.Column> </Br.Row> </div> </div> ); } }); module.exports = DraggableTable;
'use strict'; const BRACKET_MINIMUM_UPDATE_INTERVAL = 2 * 1000; const AUTO_DISQUALIFY_WARNING_TIMEOUT = 30 * 1000; const AUTO_START_MINIMUM_TIMEOUT = 30 * 1000; const MAX_REASON_LENGTH = 300; let TournamentGenerators = Object.create(null); let generatorFiles = { 'roundrobin': 'generator-round-robin.js', 'elimination': 'generator-elimination.js', }; for (let type in generatorFiles) { TournamentGenerators[type] = require('./' + generatorFiles[type]); } exports.tournaments = {}; function usersToNames(users) { return users.map(user => user.name); } class Tournament { constructor(room, format, generator, playerCap, isRated) { format = toId(format); this.id = room.id; this.room = room; this.title = Tools.getFormat(format).name + ' tournament'; this.allowRenames = false; this.players = Object.create(null); this.playerCount = 0; this.playerCap = parseInt(playerCap) || Config.tournamentDefaultPlayerCap || 0; this.format = format; this.generator = generator; this.isRated = isRated; this.scouting = true; this.modjoin = false; this.autostartcap = false; if (Config.tournamentDefaultPlayerCap && this.playerCap > Config.tournamentDefaultPlayerCap) { Monitor.log('[TourMonitor] Room ' + room.id + ' starting a tour over default cap (' + this.playerCap + ')'); } this.isBracketInvalidated = true; this.lastBracketUpdate = 0; this.bracketUpdateTimer = null; this.bracketCache = null; this.isTournamentStarted = false; this.availableMatches = null; this.inProgressMatches = null; this.isAvailableMatchesInvalidated = true; this.availableMatchesCache = null; this.pendingChallenges = null; this.autoDisqualifyTimeout = Infinity; this.autoDisqualifyTimer = null; this.autoStartTimeout = Infinity; this.autoStartTimer = null; this.isEnded = false; room.add('|tournament|create|' + this.format + '|' + generator.name + '|' + this.playerCap); room.send('|tournament|update|' + JSON.stringify({ format: this.format, generator: generator.name, playerCap: this.playerCap, isStarted: false, isJoined: false, })); this.update(); } setGenerator(generator, output) { if (this.isTournamentStarted) { output.sendReply('|tournament|error|BracketFrozen'); return; } let isErrored = false; this.generator.getUsers().forEach(user => { let error = generator.addUser(user); if (typeof error === 'string') { output.sendReply('|tournament|error|' + error); isErrored = true; } }); if (isErrored) return; this.generator = generator; this.room.send('|tournament|update|' + JSON.stringify({generator: generator.name})); this.isBracketInvalidated = true; this.update(); return true; } forceEnd() { if (this.isTournamentStarted) { if (this.autoDisqualifyTimer) clearTimeout(this.autoDisqualifyTimer); this.inProgressMatches.forEach(match => { if (match) { delete match.room.tour; match.room.addRaw("<div class=\"broadcast-red\"><b>The tournament was forcefully ended.</b><br />You can finish playing, but this battle is no longer considered a tournament battle.</div>"); } }); } else if (this.autoStartTimer) { clearTimeout(this.autoStartTimer); } for (let i in this.players) { this.players[i].destroy(); } this.room.add('|tournament|forceend'); this.isEnded = true; } updateFor(targetUser, connection) { if (!connection) connection = targetUser; if (this.isEnded) return; if ((!this.bracketUpdateTimer && this.isBracketInvalidated) || (this.isTournamentStarted && this.isAvailableMatchesInvalidated)) { this.room.add( "Error: update() called with a target user when data invalidated: " + (!this.bracketUpdateTimer && this.isBracketInvalidated) + ", " + (this.isTournamentStarted && this.isAvailableMatchesInvalidated) + "; Please report this to an admin." ); return; } let isJoined = targetUser.userid in this.players; connection.sendTo(this.room, '|tournament|update|' + JSON.stringify({ format: this.format, generator: this.generator.name, isStarted: this.isTournamentStarted, isJoined: isJoined, bracketData: this.bracketCache, })); if (this.isTournamentStarted && isJoined) { connection.sendTo(this.room, '|tournament|update|' + JSON.stringify({ challenges: usersToNames(this.availableMatchesCache.challenges.get(this.players[targetUser.userid])), challengeBys: usersToNames(this.availableMatchesCache.challengeBys.get(this.players[targetUser.userid])), })); let pendingChallenge = this.pendingChallenges.get(this.players[targetUser.userid]); if (pendingChallenge) { if (pendingChallenge.to) { connection.sendTo(this.room, '|tournament|update|' + JSON.stringify({challenging: pendingChallenge.to.name})); } else if (pendingChallenge.from) { connection.sendTo(this.room, '|tournament|update|' + JSON.stringify({challenged: pendingChallenge.from.name})); } } } connection.sendTo(this.room, '|tournament|updateEnd'); } update(targetUser) { if (targetUser) throw new Error("Please use updateFor() to update the tournament for a specific user."); if (this.isEnded) return; if (this.isBracketInvalidated) { if (Date.now() < this.lastBracketUpdate + BRACKET_MINIMUM_UPDATE_INTERVAL) { if (this.bracketUpdateTimer) clearTimeout(this.bracketUpdateTimer); this.bracketUpdateTimer = setTimeout(() => { this.bracketUpdateTimer = null; this.update(); }, BRACKET_MINIMUM_UPDATE_INTERVAL); } else { this.lastBracketUpdate = Date.now(); this.bracketCache = this.getBracketData(); this.isBracketInvalidated = false; this.room.send('|tournament|update|' + JSON.stringify({bracketData: this.bracketCache})); } } if (this.isTournamentStarted && this.isAvailableMatchesInvalidated) { this.availableMatchesCache = this.getAvailableMatches(); this.isAvailableMatchesInvalidated = false; this.availableMatchesCache.challenges.forEach((opponents, player) => { player.sendRoom('|tournament|update|' + JSON.stringify({challenges: usersToNames(opponents)})); }); this.availableMatchesCache.challengeBys.forEach((opponents, player) => { player.sendRoom('|tournament|update|' + JSON.stringify({challengeBys: usersToNames(opponents)})); }); } this.room.send('|tournament|updateEnd'); } removeBannedUser(user) { if (!(user.userid in this.players)) return; if (this.isTournamentStarted) { if (!this.disqualifiedUsers.get(this.players[user.userid])) { this.disqualifyUser(user.userid, user, null); } } else { this.removeUser(user); } this.room.update(); } addUser(user, isAllowAlts, output) { if (!user.named) { output.sendReply('|tournament|error|UserNotNamed'); return; } if (user.userid in this.players) { output.sendReply('|tournament|error|UserAlreadyAdded'); return; } if (this.playerCap && this.playerCount >= this.playerCap) { output.sendReply('|tournament|error|Full'); return; } if (!isAllowAlts) { let users = this.generator.getUsers(); for (let i = 0; i < users.length; i++) { let otherUser = Users.get(users[i].userid); if (otherUser && otherUser.latestIp === user.latestIp) { output.sendReply('|tournament|error|AltUserAlreadyAdded'); return; } } } let player = new Rooms.RoomGamePlayer(user, this); let error = this.generator.addUser(player); if (typeof error === 'string') { output.sendReply('|tournament|error|' + error); player.destroy(); return; } this.players[user.userid] = player; this.playerCount++; this.room.add('|tournament|join|' + user.name); user.sendTo(this.room, '|tournament|update|{"isJoined":true}'); this.isBracketInvalidated = true; this.update(); if (this.playerCount === this.playerCap) { if (this.autostartcap === true) { this.startTournament(output); } else { this.room.add("The tournament is now full."); } } } removeUser(user, output) { if (!(user.userid in this.players)) { output.sendReply('|tournament|error|UserNotAdded'); return; } let error = this.generator.removeUser(this.players[user.userid]); if (typeof error === 'string') { output.sendReply('|tournament|error|' + error); return; } this.players[user.userid].destroy(); delete this.players[user.userid]; this.playerCount--; this.room.add('|tournament|leave|' + user.name); user.sendTo(this.room, '|tournament|update|{"isJoined":false}'); this.isBracketInvalidated = true; this.update(); } replaceUser(user, replacementUser, output) { if (!(user.userid in this.players)) { output.sendReply('|tournament|error|UserNotAdded'); return; } if (replacementUser.userid in this.players) { output.sendReply('|tournament|error|UserAlreadyAdded'); return; } let player = new Rooms.RoomGamePlayer(replacementUser, this); this.generator.replaceUser(this.players[user.userid], player); this.players[user.userid].destroy(); delete this.players[user.userid]; this.players[replacementUser.userid] = player; this.room.add('|tournament|replace|' + user.name + '|' + replacementUser.name); user.sendTo(this.room, '|tournament|update|{"isJoined":false}'); replacementUser.sendTo(this.room, '|tournament|update|{"isJoined":true}'); this.isBracketInvalidated = true; this.update(); } getBracketData() { let data = this.generator.getBracketData(); if (data.type === 'tree') { if (!data.rootNode) { data.users = usersToNames(this.generator.getUsers().sort()); return data; } let queue = [data.rootNode]; while (queue.length > 0) { let node = queue.shift(); if (node.state === 'available') { let pendingChallenge = this.pendingChallenges.get(node.children[0].team); if (pendingChallenge && node.children[1].team === pendingChallenge.to) { node.state = 'challenging'; } let inProgressMatch = this.inProgressMatches.get(node.children[0].team); if (inProgressMatch && node.children[1].team === inProgressMatch.to) { node.state = 'inprogress'; node.room = inProgressMatch.room.id; } } if (node.team) node.team = node.team.name; node.children.forEach(child => { queue.push(child); }); } } else if (data.type === 'table') { if (this.isTournamentStarted) { data.tableContents.forEach((row, r) => { let pendingChallenge = this.pendingChallenges.get(data.tableHeaders.rows[r]); let inProgressMatch = this.inProgressMatches.get(data.tableHeaders.rows[r]); if (pendingChallenge || inProgressMatch) { row.forEach((cell, c) => { if (!cell) return; if (pendingChallenge && data.tableHeaders.cols[c] === pendingChallenge.to) { cell.state = 'challenging'; } if (inProgressMatch && data.tableHeaders.cols[c] === inProgressMatch.to) { cell.state = 'inprogress'; cell.room = inProgressMatch.room.id; } }); } }); } data.tableHeaders.cols = usersToNames(data.tableHeaders.cols); data.tableHeaders.rows = usersToNames(data.tableHeaders.rows); } return data; } startTournament(output) { if (this.isTournamentStarted) { output.sendReply('|tournament|error|AlreadyStarted'); return false; } let users = this.generator.getUsers(); if (users.length < 2) { output.sendReply('|tournament|error|NotEnoughUsers'); return false; } if (this.generator.generateBracket) this.generator.generateBracket(); this.generator.freezeBracket(); this.availableMatches = new Map(); this.inProgressMatches = new Map(); this.pendingChallenges = new Map(); this.disqualifiedUsers = new Map(); this.isAutoDisqualifyWarned = new Map(); this.lastActionTimes = new Map(); users.forEach(user => { this.availableMatches.set(user, new Map()); this.inProgressMatches.set(user, null); this.pendingChallenges.set(user, null); this.disqualifiedUsers.set(user, false); this.isAutoDisqualifyWarned.set(user, false); this.lastActionTimes.set(user, Date.now()); }); this.isTournamentStarted = true; if (this.autoStartTimer) clearTimeout(this.autoStartTimer); this.isBracketInvalidated = true; this.room.add('|tournament|start'); this.room.send('|tournament|update|{"isStarted":true}'); this.update(); return true; } getAvailableMatches() { let matches = this.generator.getAvailableMatches(); if (typeof matches === 'string') { this.room.add("Unexpected error from getAvailableMatches(): " + matches + ". Please report this to an admin."); return; } let users = this.generator.getUsers(); let challenges = new Map(); let challengeBys = new Map(); let oldAvailableMatches = new Map(); users.forEach(user => { challenges.set(user, []); challengeBys.set(user, []); let oldAvailableMatch = false; let availableMatches = this.availableMatches.get(user); if (availableMatches.size) { oldAvailableMatch = true; availableMatches.clear(); } oldAvailableMatches.set(user, oldAvailableMatch); }); matches.forEach(match => { challenges.get(match[0]).push(match[1]); challengeBys.get(match[1]).push(match[0]); this.availableMatches.get(match[0]).set(match[1], true); }); this.availableMatches.forEach((availableMatches, user) => { if (oldAvailableMatches.get(user)) return; if (availableMatches.size) this.lastActionTimes.set(user, Date.now()); }); return { challenges: challenges, challengeBys: challengeBys, }; } disqualifyUser(userid, output, reason) { if (!this.isTournamentStarted) { output.sendReply('|tournament|error|NotStarted'); return false; } if (!(userid in this.players)) { output.sendReply('|tournament|error|UserNotAdded'); return false; } let player = this.players[userid]; if (this.disqualifiedUsers.get(player)) { output.sendReply('|tournament|error|AlreadyDisqualified'); return false; } let error = this.generator.disqualifyUser(player); if (error) { output.sendReply('|tournament|error|' + error); return false; } this.disqualifiedUsers.set(player, true); this.generator.setUserBusy(player, false); let challenge = this.pendingChallenges.get(player); if (challenge) { this.pendingChallenges.set(player, null); if (challenge.to) { this.generator.setUserBusy(challenge.to, false); this.pendingChallenges.set(challenge.to, null); challenge.to.sendRoom('|tournament|update|{"challenged":null}'); } else if (challenge.from) { this.generator.setUserBusy(challenge.from, false); this.pendingChallenges.set(challenge.from, null); challenge.from.sendRoom('|tournament|update|{"challenging":null}'); } } let matchFrom = this.inProgressMatches.get(player); if (matchFrom) { this.generator.setUserBusy(matchFrom.to, false); this.inProgressMatches.set(player, null); delete matchFrom.room.tour; if (matchFrom.room.battle) matchFrom.room.battle.forfeit(player.userid); } let matchTo = null; this.inProgressMatches.forEach((match, playerFrom) => { if (match && match.to === player) matchTo = playerFrom; }); if (matchTo) { this.generator.setUserBusy(matchTo, false); let matchRoom = this.inProgressMatches.get(matchTo).room; delete matchRoom.tour; if (matchRoom.battle) matchRoom.battle.forfeit(player.userid); this.inProgressMatches.set(matchTo, null); } this.room.add('|tournament|disqualify|' + player.name); let user = Users.get(userid); if (user) { user.sendTo(this.room, '|tournament|update|{"isJoined":false}'); if (reason !== null) user.popup("|modal|You have been disqualified from the tournament in " + this.room.title + (reason ? ":\n\n" + reason : ".")); } this.isBracketInvalidated = true; this.isAvailableMatchesInvalidated = true; if (this.generator.isTournamentEnded()) { this.onTournamentEnd(); } else { this.update(); } return true; } setAutoStartTimeout(timeout, output) { if (this.isTournamentStarted) { output.sendReply('|tournament|error|AlreadyStarted'); return false; } timeout = parseFloat(timeout); if (timeout < AUTO_START_MINIMUM_TIMEOUT || isNaN(timeout)) { output.sendReply('|tournament|error|InvalidAutoStartTimeout'); return false; } if (this.autoStartTimer) clearTimeout(this.autoStartTimer); if (timeout === Infinity) { this.room.add('|tournament|autostart|off'); } else { this.autoStartTimer = setTimeout(() => this.startTournament(output), timeout); this.room.add('|tournament|autostart|on|' + timeout); } this.autoStartTimeout = timeout; return true; } setAutoDisqualifyTimeout(timeout, output) { if (timeout < AUTO_DISQUALIFY_WARNING_TIMEOUT || isNaN(timeout)) { output.sendReply('|tournament|error|InvalidAutoDisqualifyTimeout'); return false; } this.autoDisqualifyTimeout = parseFloat(timeout); if (this.autoDisqualifyTimeout === Infinity) { this.room.add('|tournament|autodq|off'); } else { this.room.add('|tournament|autodq|on|' + this.autoDisqualifyTimeout); } if (this.isTournamentStarted) this.runAutoDisqualify(); return true; } runAutoDisqualify(output) { if (!this.isTournamentStarted) { output.sendReply('|tournament|error|NotStarted'); return false; } if (this.autoDisqualifyTimer) clearTimeout(this.autoDisqualifyTimer); this.lastActionTimes.forEach((time, player) => { let availableMatches = false; if (this.availableMatches.get(player).size) availableMatches = true; let pendingChallenge = this.pendingChallenges.get(player); if (!availableMatches && !pendingChallenge) return; if (pendingChallenge && pendingChallenge.to) return; if (Date.now() > time + this.autoDisqualifyTimeout && this.isAutoDisqualifyWarned.get(player)) { this.disqualifyUser(player.userid, output, "You failed to make or accept the challenge in time."); this.room.update(); } else if (Date.now() > time + this.autoDisqualifyTimeout - AUTO_DISQUALIFY_WARNING_TIMEOUT && !this.isAutoDisqualifyWarned.get(player)) { let remainingTime = this.autoDisqualifyTimeout - Date.now() + time; if (remainingTime <= 0) { remainingTime = AUTO_DISQUALIFY_WARNING_TIMEOUT; this.lastActionTimes.set(player, Date.now() - this.autoDisqualifyTimeout + AUTO_DISQUALIFY_WARNING_TIMEOUT); } this.isAutoDisqualifyWarned.set(player, true); player.sendRoom('|tournament|autodq|target|' + remainingTime); } else { this.isAutoDisqualifyWarned.set(player, false); } }); if (this.autoDisqualifyTimeout !== Infinity && !this.isEnded) this.autoDisqualifyTimer = setTimeout(() => this.runAutoDisqualify(), this.autoDisqualifyTimeout); } challenge(user, targetUserid, output) { if (!this.isTournamentStarted) { output.sendReply('|tournament|error|NotStarted'); return; } if (!(user.userid in this.players)) { output.sendReply('|tournament|error|UserNotAdded'); return; } if (!(targetUserid in this.players)) { output.sendReply('|tournament|error|InvalidMatch'); return; } let from = this.players[user.userid]; let to = this.players[targetUserid]; if (!this.availableMatches.get(from) || !this.availableMatches.get(from).get(to)) { output.sendReply('|tournament|error|InvalidMatch'); return; } if (this.generator.getUserBusy(from) || this.generator.getUserBusy(to)) { this.room.add("Tournament backend breaks specifications. Please report this to an admin."); return; } this.generator.setUserBusy(from, true); this.generator.setUserBusy(to, true); this.isAvailableMatchesInvalidated = true; this.update(); user.prepBattle(this.format, 'tournament', user).then(result => this.finishChallenge(user, to, output, result)); } finishChallenge(user, to, output, result) { let from = this.players[user.userid]; if (!result) { this.generator.setUserBusy(from, false); this.generator.setUserBusy(to, false); this.isAvailableMatchesInvalidated = true; this.update(); return; } let now = Date.now(); this.lastActionTimes.set(from, now); this.lastActionTimes.set(to, now); this.pendingChallenges.set(from, {to: to, team: user.team}); this.pendingChallenges.set(to, {from: from, team: user.team}); from.sendRoom('|tournament|update|' + JSON.stringify({challenging: to.name})); to.sendRoom('|tournament|update|' + JSON.stringify({challenged: from.name})); this.isBracketInvalidated = true; this.update(); } cancelChallenge(user, output) { if (!this.isTournamentStarted) { output.sendReply('|tournament|error|NotStarted'); return; } if (!(user.userid in this.players)) { output.sendReply('|tournament|error|UserNotAdded'); return; } let player = this.players[user.userid]; let challenge = this.pendingChallenges.get(player); if (!challenge || challenge.from) return; this.generator.setUserBusy(player, false); this.generator.setUserBusy(challenge.to, false); this.pendingChallenges.set(player, null); this.pendingChallenges.set(challenge.to, null); user.sendTo(this.room, '|tournament|update|{"challenging":null}'); challenge.to.sendRoom('|tournament|update|{"challenged":null}'); this.isBracketInvalidated = true; this.isAvailableMatchesInvalidated = true; this.update(); } acceptChallenge(user, output) { if (!this.isTournamentStarted) { output.sendReply('|tournament|error|NotStarted'); return; } if (!(user.userid in this.players)) { output.sendReply('|tournament|error|UserNotAdded'); return; } let player = this.players[user.userid]; let challenge = this.pendingChallenges.get(player); if (!challenge || !challenge.from) return; user.prepBattle(this.format, 'tournament', user).then(result => this.finishAcceptChallenge(user, challenge, result)); } finishAcceptChallenge(user, challenge, result) { if (!result) return; // Prevent battles between offline users from starting let from = Users.get(challenge.from.userid); if (!from || !from.connected || !user.connected) return; // Prevent double accepts and users that have been disqualified while between these two functions if (!this.pendingChallenges.get(challenge.from)) return; let player = this.players[user.userid]; if (!this.pendingChallenges.get(player)) return; let room = Rooms.global.startBattle(from, user, this.format, challenge.team, user.team, {rated: this.isRated, tour: this}); if (!room) return; this.pendingChallenges.set(challenge.from, null); this.pendingChallenges.set(player, null); from.sendTo(this.room, '|tournament|update|{"challenging":null}'); user.sendTo(this.room, '|tournament|update|{"challenged":null}'); this.inProgressMatches.set(challenge.from, {to: player, room: room}); this.room.add('|tournament|battlestart|' + from.name + '|' + user.name + '|' + room.id).update(); this.isBracketInvalidated = true; this.runAutoDisqualify(this.room); this.update(); } onConnect(user, connection) { this.updateFor(user, connection); } onUpdateConnection(user, connection) { this.updateFor(user, connection); } onRename(user, oldUserid) { if (oldUserid in this.players) { if (user.userid === oldUserid) { this.players[user.userid].name = user.name; } else { this.players[user.userid] = this.players[oldUserid]; this.players[user.userid].userid = user.userid; this.players[user.userid].name = user.name; delete this.players[oldUserid]; } } this.updateFor(user); } onBattleJoin(room, user) { if (this.scouting || this.isEnded || user.latestIp === room.p1.latestIp || user.latestIp === room.p2.latestIp) return; let users = this.generator.getUsers(true); for (let i = 0; i < users.length; i++) { let otherUser = Users.get(users[i].userid); if (otherUser && otherUser.latestIp === user.latestIp) { return "Scouting is banned: tournament players can't watch other tournament battles."; } } } onBattleWin(room, winnerid) { let from = this.players[room.p1.userid]; let to = this.players[room.p2.userid]; let winner = this.players[winnerid]; let result = 'draw'; if (from === winner) { result = 'win'; } else if (to === winner) { result = 'loss'; } if (result === 'draw' && !this.generator.isDrawingSupported) { this.room.add('|tournament|battleend|' + from.name + '|' + to.name + '|' + result + '|' + room.battle.score.join(',') + '|fail'); this.generator.setUserBusy(from, false); this.generator.setUserBusy(to, false); this.inProgressMatches.set(from, null); this.isBracketInvalidated = true; this.isAvailableMatchesInvalidated = true; this.runAutoDisqualify(); this.update(); return this.room.update(); } let error = this.generator.setMatchResult([from, to], result, room.battle.score); if (error) { // Should never happen return this.room.add("Unexpected " + error + " from setMatchResult([" + room.p1.userid + ", " + room.p2.userid + "], " + result + ", " + room.battle.score + ") in onBattleWin(" + room.id + ", " + winnerid + "). Please report this to an admin.").update(); } this.room.add('|tournament|battleend|' + from.name + '|' + to.name + '|' + result + '|' + room.battle.score.join(',')); this.generator.setUserBusy(from, false); this.generator.setUserBusy(to, false); this.inProgressMatches.set(from, null); this.isBracketInvalidated = true; this.isAvailableMatchesInvalidated = true; if (this.generator.isTournamentEnded()) { this.onTournamentEnd(); } else { this.runAutoDisqualify(); this.update(); } this.room.update(); } onTournamentEnd() { this.room.add('|tournament|end|' + JSON.stringify({ results: this.generator.getResults().map(usersToNames), format: this.format, generator: this.generator.name, bracketData: this.getBracketData(), })); this.isEnded = true; if (this.autoDisqualifyTimer) clearTimeout(this.autoDisqualifyTimer); // // Tournament Winnings // let color = '#088cc7'; let sizeRequiredToEarn = 4; let currencyName = function (amount) { let name = " buck"; return amount === 1 ? name : name + "s"; }; let data = this.generator.getResults().map(usersToNames).toString(); let winner, runnerUp; if (data.indexOf(',') >= 0) { data = data.split(','); winner = data[0]; if (data[1]) runnerUp = data[1]; } else { winner = data; } let wid = toId(winner); let rid = toId(runnerUp); let tourSize = this.generator.users.size; if (this.room.isOfficial && tourSize >= sizeRequiredToEarn) { let firstMoney = Math.round(tourSize / 4); let secondMoney = Math.round(firstMoney / 2); Db('money').set(wid, Db('money').get(wid, 0) + firstMoney); this.room.addRaw("<b><font color='" + color + "'>" + Tools.escapeHTML(winner) + "</font> has won " + "<font color='" + color + "'>" + firstMoney + "</font>" + currencyName(firstMoney) + " for winning the tournament!</b>"); if (runnerUp) { Db('money').set(rid, Db('money').get(rid, 0) + secondMoney); this.room.addRaw("<b><font color='" + color + "'>" + Tools.escapeHTML(runnerUp) + "</font> has won " + "<font color='" + color + "'>" + secondMoney + "</font>" + currencyName(secondMoney) + " for winning the tournament!</b>"); } } delete exports.tournaments[this.room.id]; delete this.room.game; for (let i in this.players) { this.players[i].destroy(); } } } function createTournamentGenerator(generator, args, output) { let Generator = TournamentGenerators[toId(generator)]; if (!Generator) { output.errorReply(generator + " is not a valid type."); output.errorReply("Valid types: " + Object.keys(TournamentGenerators).join(", ")); return; } args.unshift(null); return new (Generator.bind.apply(Generator, args))(); } function createTournament(room, format, generator, playerCap, isRated, args, output) { if (room.type !== 'chat') { output.errorReply("Tournaments can only be created in chat rooms."); return; } if (room.game) { output.errorReply("You cannot have a tournament until the current room activity is over: " + room.game.title); return; } if (Rooms.global.lockdown) { output.errorReply("The server is restarting soon, so a tournament cannot be created."); return; } format = Tools.getFormat(format); if (format.effectType !== 'Format' || !format.tournamentShow) { output.errorReply(format.id + " is not a valid tournament format."); output.errorReply("Valid formats: " + Object.values(Tools.data.Formats).filter(f => f.effectType === 'Format' && f.tournamentShow).map(format => format.name).join(", ")); return; } if (!TournamentGenerators[toId(generator)]) { output.errorReply(generator + " is not a valid type."); output.errorReply("Valid types: " + Object.keys(TournamentGenerators).join(", ")); return; } if (playerCap && playerCap < 2) { output.errorReply("You cannot have a player cap that is less than 2."); return; } return (room.game = exports.tournaments[room.id] = new Tournament(room, format, createTournamentGenerator(generator, args, output), playerCap, isRated)); } function deleteTournament(id, output) { let tournament = exports.tournaments[id]; if (!tournament) { output.errorReply(id + " doesn't exist."); return false; } tournament.forceEnd(output); delete exports.tournaments[id]; let room = Rooms(id); if (room) delete room.game; return true; } function getTournament(id, output) { if (exports.tournaments[id]) { return exports.tournaments[id]; } } let commands = { basic: { j: 'join', in: 'join', join: function (tournament, user) { tournament.addUser(user, false, this); }, l: 'leave', out: 'leave', leave: function (tournament, user) { if (tournament.isTournamentStarted) { tournament.disqualifyUser(user.userid, this); } else { tournament.removeUser(user, this); } }, /***remind: function (tournament, user) { for (let users in tournament.generator.getUsers(true)) { users.popup('You have a tournament Battle Waiting.') count++; } },***/ getusers: function (tournament) { if (!this.runBroadcast()) return; let users = usersToNames(tournament.generator.getUsers(true).sort()); this.sendReplyBox("<strong>" + users.length + " users remain in this tournament:</strong><br />" + Tools.escapeHTML(users.join(", "))); }, getupdate: function (tournament, user) { tournament.updateFor(user); this.sendReply("Your tournament bracket has been updated."); }, challenge: function (tournament, user, params, cmd) { if (params.length < 1) { return this.sendReply("Usage: " + cmd + " <user>"); } tournament.challenge(user, toId(params[0]), this); }, cancelchallenge: function (tournament, user) { tournament.cancelChallenge(user, this); }, acceptchallenge: function (tournament, user) { tournament.acceptChallenge(user, this); }, }, creation: { settype: function (tournament, user, params, cmd) { if (params.length < 1) { return this.sendReply("Usage: " + cmd + " <type> [, <comma-separated arguments>]"); } let playerCap = parseInt(params.splice(1, 1)); let generator = createTournamentGenerator(params.shift(), params, this); if (generator && tournament.setGenerator(generator, this)) { if (playerCap && playerCap >= 2) { tournament.playerCap = playerCap; if (Config.tournamentDefaultPlayerCap && tournament.playerCap > Config.tournamentDefaultPlayerCap) { Monitor.log('[TourMonitor] Room ' + tournament.room.id + ' starting a tour over default cap (' + tournament.playerCap + ')'); } } else if (tournament.playerCap && !playerCap) { tournament.playerCap = 0; } this.sendReply("Tournament set to " + generator.name + (tournament.playerCap ? " with a player cap of " + tournament.playerCap : "") + "."); } }, end: 'delete', stop: 'delete', delete: function (tournament, user) { if (deleteTournament(tournament.room.id, this)) { this.privateModCommand("(" + user.name + " forcibly ended a tournament.)"); } }, }, moderation: { begin: 'start', start: function (tournament, user) { if (tournament.startTournament(this)) { this.sendModCommand("(" + user.name + " started the tournament.)"); } }, dq: 'disqualify', disqualify: function (tournament, user, params, cmd) { if (params.length < 1) { return this.sendReply("Usage: " + cmd + " <user>"); } let targetUser = Users.get(params[0]) || params[0]; let targetUserid = toId(targetUser); let reason = ''; if (params[1]) { reason = params[1].trim(); if (reason.length > MAX_REASON_LENGTH) return this.errorReply("The reason is too long. It cannot exceed " + MAX_REASON_LENGTH + " characters."); } if (tournament.disqualifyUser(targetUserid, this, reason)) { this.privateModCommand("(" + (targetUser.name || targetUserid) + " was disqualified from the tournament by " + user.name + (reason ? " (" + reason + ")" : "") + ")"); } }, autostart: 'setautostart', setautostart: function (tournament, user, params, cmd) { if (params.length < 1) { return this.sendReply("Usage: " + cmd + " <on|minutes|off>"); } let option = params[0].toLowerCase(); if (option === 'on' || option === 'true' || option === 'start') { if (tournament.isTournamentStarted) { return this.errorReply("The tournament has already started."); } else if (!tournament.playerCap) { return this.errorReply("The tournament does not have a player cap set."); } else { if (tournament.autostartcap) return this.errorReply("The tournament is already set to autostart when the player cap is reached."); tournament.autostartcap = true; this.room.add("The tournament will start once " + tournament.playerCap + " players have joined."); this.privateModCommand("(The tournament was set to autostart when the player cap is reached by " + user.name + ")"); } } else { if (option === '0' || option === 'infinity' || option === 'off' || option === 'false' || option === 'stop' || option === 'remove') { if (!tournament.autostartcap && tournament.autoStartTimeout === Infinity) return this.errorReply("The automatic tournament start timer is already off."); params[0] = 'off'; tournament.autostartcap = false; } let timeout = params[0].toLowerCase() === 'off' ? Infinity : params[0]; if (tournament.setAutoStartTimeout(timeout * 60 * 1000, this)) { this.privateModCommand("(The tournament auto start timer was set to " + params[0] + " by " + user.name + ")"); } } }, autodq: 'setautodq', setautodq: function (tournament, user, params, cmd) { if (params.length < 1) { if (tournament.autoDisqualifyTimeout !== Infinity) { return this.sendReply("Usage: " + cmd + " <minutes|off>; The current automatic disqualify timer is set to " + (tournament.autoDisqualifyTimeout / 1000 / 60) + " minute(s)"); } else { return this.sendReply("Usage: " + cmd + " <minutes|off>"); } } if (params[0].toLowerCase() === 'infinity' || params[0] === '0') params[0] = 'off'; let timeout = params[0].toLowerCase() === 'off' ? Infinity : params[0] * 60 * 1000; if (timeout === tournament.autoDisqualifyTimeout) return this.errorReply("The automatic tournament disqualify timer is already set to " + params[0] + " minute(s)."); if (tournament.setAutoDisqualifyTimeout(timeout, this)) { this.privateModCommand("(The tournament auto disqualify timer was set to " + params[0] + " by " + user.name + ")"); } }, runautodq: function (tournament) { tournament.runAutoDisqualify(this); }, scout: 'setscouting', scouting: 'setscouting', setscout: 'setscouting', setscouting: function (tournament, user, params, cmd) { if (params.length < 1) { if (tournament.scouting) { return this.sendReply("This tournament allows spectating other battles while in a tournament."); } else { return this.sendReply("This tournament disallows spectating other battles while in a tournament."); } } let option = params[0].toLowerCase(); if (option === 'on' || option === 'true' || option === 'allow' || option === 'allowed') { if (tournament.scouting) return this.errorReply("Scouting for this tournament is already set to allowed."); tournament.scouting = true; tournament.modjoin = false; this.room.add('|tournament|scouting|allow'); this.privateModCommand("(The tournament was set to allow scouting by " + user.name + ")"); } else if (option === 'off' || option === 'false' || option === 'disallow' || option === 'disallowed') { if (!tournament.scouting) return this.errorReply("Scouting for this tournament is already disabled."); tournament.scouting = false; tournament.modjoin = true; this.room.add('|tournament|scouting|disallow'); this.privateModCommand("(The tournament was set to disallow scouting by " + user.name + ")"); } else { return this.sendReply("Usage: " + cmd + " <allow|disallow>"); } }, modjoin: 'setmodjoin', setmodjoin: function (tournament, user, params, cmd) { if (params.length < 1) { if (tournament.modjoin) { return this.sendReply("This tournament allows players to modjoin their battles."); } else { return this.sendReply("This tournament does not allow players to modjoin their battles."); } } let option = params[0].toLowerCase(); if (option === 'on' || option === 'true' || option === 'allow' || option === 'allowed') { if (tournament.modjoin) return this.errorReply("Modjoining is already allowed for this tournament."); tournament.modjoin = true; this.room.add('Modjoining is now allowed (Players can modjoin their tournament battles).'); this.privateModCommand("(The tournament was set to allow modjoin by " + user.name + ")"); } else if (option === 'off' || option === 'false' || option === 'disallow' || option === 'disallowed') { if (!tournament.modjoin) return this.errorReply("Modjoining is already not allowed for this tournament."); tournament.modjoin = false; this.room.add('Modjoining is now banned (Players cannot modjoin their tournament battles).'); this.privateModCommand("(The tournament was set to disallow modjoin by " + user.name + ")"); } else { return this.sendReply("Usage: " + cmd + " <allow|disallow>"); } }, }, }; CommandParser.commands.tour = 'tournament'; CommandParser.commands.tours = 'tournament'; CommandParser.commands.tournaments = 'tournament'; CommandParser.commands.tournament = function (paramString, room, user) { let cmdParts = paramString.split(' '); let cmd = cmdParts.shift().trim().toLowerCase(); let params = cmdParts.join(' ').split(',').map(param => param.trim()); if (!params[0]) params = []; if (cmd === '') { if (!this.runBroadcast()) return; this.sendReply('|tournaments|info|' + JSON.stringify(Object.keys(exports.tournaments).filter(tournament => { tournament = exports.tournaments[tournament]; return !tournament.room.isPrivate && !tournament.room.isPersonal && !tournament.room.staffRoom; }).map(tournament => { tournament = exports.tournaments[tournament]; return {room: tournament.room.id, format: tournament.format, generator: tournament.generator.name, isStarted: tournament.isTournamentStarted}; }))); } else if (cmd === 'help') { return this.parse('/help tournament'); } else if (cmd === 'on' || cmd === 'enable') { if (!this.can('tournamentsmanagement', null, room)) return; if (room.toursEnabled) { return this.errorReply("Tournaments are already enabled."); } room.toursEnabled = true; if (room.chatRoomData) { room.chatRoomData.toursEnabled = true; Rooms.global.writeChatRoomData(); } return this.sendReply("Tournaments enabled."); } else if (cmd === 'off' || cmd === 'disable') { if (!this.can('tournamentsmanagement', null, room)) return; if (!room.toursEnabled) { return this.errorReply("Tournaments are already disabled."); } delete room.toursEnabled; if (room.chatRoomData) { delete room.chatRoomData.toursEnabled; Rooms.global.writeChatRoomData(); } return this.sendReply("Tournaments disabled."); } else if (cmd === 'announce' || cmd === 'announcements') { if (!this.can('tournamentsmanagement', null, room)) return; if (!Config.tourannouncements.includes(room.id)) { return this.errorReply("Tournaments in this room cannot be announced."); } if (params.length < 1) { if (room.tourAnnouncements) { return this.sendReply("Tournament announcements are enabled."); } else { return this.sendReply("Tournament announcements are disabled."); } } let option = params[0].toLowerCase(); if (option === 'on' || option === 'enable') { if (room.tourAnnouncements) return this.errorReply("Tournament announcements are already enabled."); room.tourAnnouncements = true; this.privateModCommand("(Tournament announcements were enabled by " + user.name + ")"); } else if (option === 'off' || option === 'disable') { if (!room.tourAnnouncements) return this.errorReply("Tournament announcements are already disabled."); room.tourAnnouncements = false; this.privateModCommand("(Tournament announcements were disabled by " + user.name + ")"); } else { return this.sendReply("Usage: " + cmd + " <on|off>"); } if (room.chatRoomData) { room.chatRoomData.tourAnnouncements = room.tourAnnouncements; Rooms.global.writeChatRoomData(); } } else if (cmd === 'create' || cmd === 'new') { if (room.toursEnabled) { if (!this.can('tournaments', null, room)) return; } else { if (!user.can('tournamentsmanagement', null, room)) { return this.errorReply("Tournaments are disabled in this room (" + room.id + ")."); } } if (params.length < 2) { return this.sendReply("Usage: " + cmd + " <format>, <type> [, <comma-separated arguments>]"); } let tour = createTournament(room, params.shift(), params.shift(), params.shift(), Config.istournamentsrated, params, this); if (tour) { this.privateModCommand("(" + user.name + " created a tournament in " + tour.format + " format.)"); if (room.tourAnnouncements) { let tourRoom = Rooms.search(Config.tourroom || 'tournaments'); if (tourRoom && tourRoom !== room) tourRoom.addRaw('<div class="infobox"><a href="/' + room.id + '" class="ilink"><strong>' + Tools.escapeHTML(Tools.getFormat(tour.format).name) + '</strong> tournament created in <strong>' + Tools.escapeHTML(room.title) + '</strong>.</a></div>').update(); } } } else { let tournament = getTournament(room.id); if (!tournament) { return this.sendReply("There is currently no tournament running in this room."); } let commandHandler = null; if (commands.basic[cmd]) { commandHandler = typeof commands.basic[cmd] === 'string' ? commands.basic[commands.basic[cmd]] : commands.basic[cmd]; } if (commands.creation[cmd]) { if (room.toursEnabled) { if (!this.can('tournaments', null, room)) return; } else { if (!user.can('tournamentsmanagement', null, room)) { return this.errorReply("Tournaments are disabled in this room (" + room.id + ")."); } } commandHandler = typeof commands.creation[cmd] === 'string' ? commands.creation[commands.creation[cmd]] : commands.creation[cmd]; } if (commands.moderation[cmd]) { if (!user.can('tournamentsmoderation', null, room)) { return this.errorReply(cmd + " - Access denied."); } commandHandler = typeof commands.moderation[cmd] === 'string' ? commands.moderation[commands.moderation[cmd]] : commands.moderation[cmd]; } if (!commandHandler) { this.errorReply(cmd + " is not a tournament command."); } else { commandHandler.call(this, tournament, user, params, cmd); } } }; CommandParser.commands.tournamenthelp = function (target, room, user) { if (!this.runBroadcast()) return; return this.sendReplyBox( "- create/new &lt;format>, &lt;type> [, &lt;comma-separated arguments>]: Creates a new tournament in the current room.<br />" + "- settype &lt;type> [, &lt;comma-separated arguments>]: Modifies the type of tournament after it's been created, but before it has started.<br />" + "- end/stop/delete: Forcibly ends the tournament in the current room.<br />" + "- begin/start: Starts the tournament in the current room.<br />" + "- autostart/setautostart &lt;on|minutes|off>: Sets the automatic start timeout.<br />" + "- dq/disqualify &lt;user>: Disqualifies a user.<br />" + "- autodq/setautodq &lt;minutes|off>: Sets the automatic disqualification timeout.<br />" + "- runautodq: Manually run the automatic disqualifier.<br />" + "- scouting &lt;allow|disallow>: Specifies whether joining tournament matches while in a tournament is allowed.<br />" + "- modjoin &lt;allow|disallow>: Specifies whether players can modjoin their battles.<br />" + "- getusers: Lists the users in the current tournament.<br />" + "- on/off: Enables/disables allowing mods to start tournaments in the current room.<br />" + "- announce/announcements &lt;on|off>: Enables/disables tournament announcements for the current room.<br />" + "More detailed help can be found <a href=\"https://www.smogon.com/forums/threads/3570628/#post-6777489\">here</a>" ); }; exports.Tournament = Tournament; exports.TournamentGenerators = TournamentGenerators; exports.createTournament = createTournament; exports.deleteTournament = deleteTournament; exports.get = getTournament; exports.commands = commands;
import React, { Component } from 'react' import { FlexGrid, Button } from 'components' import { setMetrikaTarget } from 'helpers' import s from './ItemPageParameters.sass' import { itempage as config } from 'config' export default class ItemPageParameters extends Component { state = {isOpen: false}; maxLength = config.optionsMaxLength; renderContent = (data) => ( <div className={s.td}> {data.map(({name, value}, key) => ( <div className={s.td__item} key={key}> {`${name} – ${value}`} </div> ))} </div> ); renderRow = (title, data, key) => ( <FlexGrid key={key} justify="center" align="center" className={s.tr}> <div className={s.td_title}>{title}</div> {this.renderContent(data)} </FlexGrid> ); renderRows = (data, limit) => ( <div className={s.content}> {data.map(({title, data}, key) => ( limit ? // render rows with limit key < limit ? this.renderRow(title, data, key) : null // without : this.renderRow(title, data, key) ))} </div> ); renderNull = () => ( <div>Характеристик еще нет.</div> ); toggleRows = () => this.setState({isOpen: !this.state.isOpen}, () => ( this.state.isOpen && setMetrikaTarget('SeeMoreParameters') )); render() { const { data } = this.props; if (!data) { return this.renderNull(); } const { isOpen } = this.state; const supportExpanding = data.length > this.maxLength; const buttonContent = isOpen ? 'Показать меньше' : 'Показать больше'; return ( <div className={s.char}> {this.renderRows(data, supportExpanding && !isOpen && this.maxLength)} {supportExpanding && !isOpen && <div className={s.overlay} />} {supportExpanding && <Button className={s.btn} type="pink" onClick={this.toggleRows}>{buttonContent}</Button>} </div> ) } };
import { Meteor } from 'meteor/meteor'; import { WebApp } from 'meteor/webapp'; import { OAuth2Server } from 'meteor/rocketchat:oauth2-server'; import { OAuthApps, Users } from '../../../models'; import { API } from '../../../api'; const oauth2server = new OAuth2Server({ accessTokensCollectionName: 'rocketchat_oauth_access_tokens', refreshTokensCollectionName: 'rocketchat_oauth_refresh_tokens', authCodesCollectionName: 'rocketchat_oauth_auth_codes', clientsCollection: OAuthApps.model, debug: true, }); oauth2server.app.disable('x-powered-by'); oauth2server.routes.disable('x-powered-by'); WebApp.connectHandlers.use(oauth2server.app); oauth2server.routes.get('/oauth/userinfo', function(req, res) { if (req.headers.authorization == null) { return res.sendStatus(401).send('No token'); } const accessToken = req.headers.authorization.replace('Bearer ', ''); const token = oauth2server.oauth.model.AccessTokens.findOne({ accessToken, }); if (token == null) { return res.sendStatus(401).send('Invalid Token'); } const user = Users.findOneById(token.userId); if (user == null) { return res.sendStatus(401).send('Invalid Token'); } return res.send({ sub: user._id, name: user.name, email: user.emails[0].address, email_verified: user.emails[0].verified, department: '', birthdate: '', preffered_username: user.username, updated_at: user._updatedAt, picture: `${ Meteor.absoluteUrl() }avatar/${ user.username }`, }); }); Meteor.publish('oauthClient', function(clientId) { if (!this.userId) { return this.ready(); } return OAuthApps.find({ clientId, active: true, }, { fields: { name: 1, }, }); }); API.v1.addAuthMethod(function() { let headerToken = this.request.headers.authorization; const getToken = this.request.query.access_token; if (headerToken != null) { const matches = headerToken.match(/Bearer\s(\S+)/); if (matches) { headerToken = matches[1]; } else { headerToken = undefined; } } const bearerToken = headerToken || getToken; if (bearerToken == null) { return; } const getAccessToken = Meteor.wrapAsync(oauth2server.oauth.model.getAccessToken, oauth2server.oauth.model); const accessToken = getAccessToken(bearerToken); if (accessToken == null) { return; } if ((accessToken.expires != null) && accessToken.expires !== 0 && accessToken.expires < new Date()) { return; } const user = Users.findOne(accessToken.userId); if (user == null) { return; } return { user }; });
"use strict"; var PioneerDeploymentScheduleView = Backbone.View.extend({ initialize: function() { _.bindAll(this, "render"); var self = this; self.render(); }, template: JST['ooiui/static/js/partials/PioneerDeploymentSchedule.html'], render: function() { this.$el.html(this.template()); }  });
angular.module('AuctionItemService', []).factory('AuctionItem', ['$resource', function ($resource) { return $resource('/api/auctionitem/:itemId', { itemId: '@id' }, { update: { method: 'PUT' } }); } ]);
import Model from "ember-data/system/model/model"; import { Map } from "ember-data/system/map"; /** @module ember-data */ var get = Ember.get; /** @class Model @namespace DS */ Model.reopenClass({ /** A map whose keys are the attributes of the model (properties described by DS.attr) and whose values are the meta object for the property. Example ```javascript App.Person = DS.Model.extend({ firstName: attr('string'), lastName: attr('string'), birthday: attr('date') }); var attributes = Ember.get(App.Person, 'attributes') attributes.forEach(function(name, meta) { console.log(name, meta); }); // prints: // firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"} // lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"} // birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"} ``` @property attributes @static @type {Ember.Map} @readOnly */ attributes: Ember.computed(function() { var map = Map.create(); this.eachComputedProperty(function(name, meta) { if (meta.isAttribute) { Ember.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + this.toString(), name !== 'id'); meta.name = name; map.set(name, meta); } }); return map; }).readOnly(), /** A map whose keys are the attributes of the model (properties described by DS.attr) and whose values are type of transformation applied to each attribute. This map does not include any attributes that do not have an transformation type. Example ```javascript App.Person = DS.Model.extend({ firstName: attr(), lastName: attr('string'), birthday: attr('date') }); var transformedAttributes = Ember.get(App.Person, 'transformedAttributes') transformedAttributes.forEach(function(field, type) { console.log(field, type); }); // prints: // lastName string // birthday date ``` @property transformedAttributes @static @type {Ember.Map} @readOnly */ transformedAttributes: Ember.computed(function() { var map = Map.create(); this.eachAttribute(function(key, meta) { if (meta.type) { map.set(key, meta.type); } }); return map; }).readOnly(), /** Iterates through the attributes of the model, calling the passed function on each attribute. The callback method you provide should have the following signature (all parameters are optional): ```javascript function(name, meta); ``` - `name` the name of the current property in the iteration - `meta` the meta object for the attribute property in the iteration Note that in addition to a callback, you can also pass an optional target object that will be set as `this` on the context. Example ```javascript App.Person = DS.Model.extend({ firstName: attr('string'), lastName: attr('string'), birthday: attr('date') }); App.Person.eachAttribute(function(name, meta) { console.log(name, meta); }); // prints: // firstName {type: "string", isAttribute: true, options: Object, parentType: function, name: "firstName"} // lastName {type: "string", isAttribute: true, options: Object, parentType: function, name: "lastName"} // birthday {type: "date", isAttribute: true, options: Object, parentType: function, name: "birthday"} ``` @method eachAttribute @param {Function} callback The callback to execute @param {Object} [target] The target object to use @static */ eachAttribute: function(callback, binding) { get(this, 'attributes').forEach(function(meta, name) { callback.call(binding, name, meta); }, binding); }, /** Iterates through the transformedAttributes of the model, calling the passed function on each attribute. Note the callback will not be called for any attributes that do not have an transformation type. The callback method you provide should have the following signature (all parameters are optional): ```javascript function(name, type); ``` - `name` the name of the current property in the iteration - `type` a string containing the name of the type of transformed applied to the attribute Note that in addition to a callback, you can also pass an optional target object that will be set as `this` on the context. Example ```javascript App.Person = DS.Model.extend({ firstName: attr(), lastName: attr('string'), birthday: attr('date') }); App.Person.eachTransformedAttribute(function(name, type) { console.log(name, type); }); // prints: // lastName string // birthday date ``` @method eachTransformedAttribute @param {Function} callback The callback to execute @param {Object} [target] The target object to use @static */ eachTransformedAttribute: function(callback, binding) { get(this, 'transformedAttributes').forEach(function(type, name) { callback.call(binding, name, type); }); } }); Model.reopen({ eachAttribute: function(callback, binding) { this.constructor.eachAttribute(callback, binding); } }); function getDefaultValue(record, options, key) { if (typeof options.defaultValue === "function") { return options.defaultValue.apply(null, arguments); } else { return options.defaultValue; } } function hasValue(record, key) { return record._attributes.hasOwnProperty(key) || record._inFlightAttributes.hasOwnProperty(key) || record._data.hasOwnProperty(key); } function getValue(record, key) { if (record._attributes.hasOwnProperty(key)) { return record._attributes[key]; } else if (record._inFlightAttributes.hasOwnProperty(key)) { return record._inFlightAttributes[key]; } else { return record._data[key]; } } /** `DS.attr` defines an attribute on a [DS.Model](/api/data/classes/DS.Model.html). By default, attributes are passed through as-is, however you can specify an optional type to have the value automatically transformed. Ember Data ships with four basic transform types: `string`, `number`, `boolean` and `date`. You can define your own transforms by subclassing [DS.Transform](/api/data/classes/DS.Transform.html). Note that you cannot use `attr` to define an attribute of `id`. `DS.attr` takes an optional hash as a second parameter, currently supported options are: - `defaultValue`: Pass a string or a function to be called to set the attribute to a default value if none is supplied. Example ```javascript var attr = DS.attr; App.User = DS.Model.extend({ username: attr('string'), email: attr('string'), verified: attr('boolean', {defaultValue: false}) }); ``` @namespace @method attr @for DS @param {String} type the attribute type @param {Object} options a hash of options @return {Attribute} */ export default function attr(type, options) { options = options || {}; var meta = { type: type, isAttribute: true, options: options }; return Ember.computed('data', function(key, value) { if (arguments.length > 1) { Ember.assert("You may not set `id` as an attribute on your model. Please remove any lines that look like: `id: DS.attr('<type>')` from " + this.constructor.toString(), key !== 'id'); var oldValue = getValue(this, key); if (value !== oldValue) { // Add the new value to the changed attributes hash; it will get deleted by // the 'didSetProperty' handler if it is no different from the original value this._attributes[key] = value; this.send('didSetProperty', { name: key, oldValue: oldValue, originalValue: this._data[key], value: value }); } return value; } else if (hasValue(this, key)) { return getValue(this, key); } else { return getDefaultValue(this, options, key); } // `data` is never set directly. However, it may be // invalidated from the state manager's setData // event. }).meta(meta); };
import * as React from 'react'; import createSvgIcon from './utils/createSvgIcon'; export default createSvgIcon( <path d="M15 21h2v-2h-2v2zm4 0h2v-2h-2v2zM7 21h2v-2H7v2zm4 0h2v-2h-2v2zm8-4h2v-2h-2v2zm0-4h2v-2h-2v2zM3 3v18h2V5h16V3H3zm16 6h2V7h-2v2z" /> , 'BorderStyleSharp');
//OpenLayers.ProxyHost = "/cgi-bin/proxy.cgi?url="; // reference local blank image Ext.BLANK_IMAGE_URL = 'mfbase/ext/resources/images/default/s.gif'; var map; var popup; var minOpacity = 0.1; var selectFeat; var clickedPopup; function toggleClicked(){ clickedPopup = (clickedPopup != true); } function feature_info_hover(feature) { selectFeat.select(feature); if (popup != null) { if (!popup.visible()) { map.removePopup(popup); popup.destroy(); popup = null; } } if (popup == null) //TODO Use the feature editing properties from edit.html instead of hardcoding { popup = new OpenLayers.Popup.FramedCloud("Info", feature.geometry.getBounds().getCenterLonLat(), new OpenLayers.Size(200,100), "<div style='font-size:9pt'>" + "<br />Feature Name:<b>"+feature.attributes.FeatName+ "</b><br /> Feature Type: "+feature.attributes.FeatType+ "<br /> Build Num: "+feature.attributes.BNum+ "<br /> <br /> Year1: "+feature.attributes.HistYear1+ "<br /> Year2: "+feature.attributes.HistYear2+ "<br /> Source: "+feature.attributes.SourceAu+ "<br /> Source Date: "+feature.attributes.SourceDa+ "<br /> Added By: "+feature.attributes.CreatedBy+ "</div>", feature.marker, false); popup.setOpacity(0.8); //popup.setBackgroundColor("yellow"); feature.popup = popup; map.addPopup(popup); } else { map.removePopup(popup); popup.destroy(); popup = null; } //OpenLayers.Event.stop(evt); } function feature_info_hide() { selectFeat.unselectAll(); if (popup != null) { map.removePopup(popup); popup.destroy(); popup = null; } // OpenLayers.Event.stop(evt); } var initialExtent; Ext.onReady(function() { Ext.QuickTips.init(); var store; var options, layer; var sourceLayers = new Array(); // var extent = new OpenLayers.Bounds(-74.163,40.571,-73.7368,40.779); // var extent = new OpenLayers.Bounds(-8256422,4949565,-8208878,4981592); initialExtent = new OpenLayers.Bounds(-8242519.9312756,4965368.2981726,-8230633.9733794,4972094.7566604); options = { maxExtent: new OpenLayers.Bounds(-180, -90, 180, 90) }; var options = { projection: new OpenLayers.Projection("EPSG:900913"), displayProjection: new OpenLayers.Projection("EPSG:4326"), units: "m", numZoomLevels:21, maxResolution: 156543.0339, maxExtent: new OpenLayers.Bounds(-20037508, -20037508, 20037508, 20037508.34) }; var mapnik = new OpenLayers.Layer.TMS( "OSM Mapnik", "http://tile.openstreetmap.org/", { type: 'png', getURL: osm_getTileURL, displayOutsideMaxExtent: true, attribution: '<a href="http://www.openstreetmap.org/">OpenStreetMap</a>' } ); var nyc = new OpenLayers.Layer.WMS("New York City (zoom in)", "http://dev.maps.nypl.org/mapserv?map=/home/tim/geowarper/warper/tmp/nyc.map&", {layers: "NYC",TRANSPARENT:'true', reproject: 'true' }, {numZoomLevels: 23}, {isBaseLayer: true}); nyc.setIsBaseLayer(true); nyc.setVisibility(false); map = new OpenLayers.Map(options); map.addLayer(mapnik); map.addLayer(nyc); //TODO add in: // wms, wfs layers for the 3 layers // onclick to get feature (cycle through 3 of them?) // use title / name? var demopoly = new OpenLayers.Layer.WFS( "NYPL Areas and Structures", "http://dev.maps.nypl.org/geoserver/wfs", {typename: 'topp:NYC_Structures_demo2'}, { typename: 'NYC_Structures_demo2', featurePrefix: 'topp', projection: new OpenLayers.Projection("EPSG:4326"), geometryName: 'the_geom', extractAttributes: true } ); demopoly.style = OpenLayers.Util.applyDefaults({strokeColor: "#22ee00"}, OpenLayers.Feature.Vector.style["default"]); var demoPOI = new OpenLayers.Layer.WFS( "NYPL Points of Interest", "http://dev.maps.nypl.org/geoserver/wfs", {typename: 'topp:NYC_POI_demo'}, { typename: 'NYC_POI_demo', featurePrefix: 'topp', projection: new OpenLayers.Projection("EPSG:4326"), geometryName: 'the_geom', extractAttributes: true } ); demoPOI.style = OpenLayers.Util.applyDefaults({strokeColor: "#22ff00"}, OpenLayers.Feature.Vector.style["default"]); map.addLayers([demopoly, demoPOI]); var hoverstyle = OpenLayers.Util.extend({}, OpenLayers.Feature.Vector.style['select']); OpenLayers.Util.extend(hoverstyle, {pointRadius: 2,hoverPointRadius:2,fillOpacity:0.7,strokeWidth:0, strokeOpacity:0.5}); selectFeat= new OpenLayers.Control.SelectFeature([demopoly,demoPOI], { hover:true, selectStyle: OpenLayers.Util.applyDefaults({fillColor: "red"}, OpenLayers.Feature.Vector.style["select"]), callbacks: { 'over': feature_info_hover, 'out':feature_info_hide //, 'click': toggleClicked } }); map.addControl(selectFeat); selectFeat.activate(); var setupMap = function(viewport) { }; var mapPanel = new GeoExt.MapPanel({ region: 'center', title: "Map", map: map, extent: initialExtent }); var layerList = new GeoExt.tree.LayerContainer({ text: "All Layers", layerStore: mapPanel.layers, leaf: false, height: 100, expanded: true }); var root = new Ext.tree.TreeNode({ text: "All Layers", expanded: true }); root.appendChild(new GeoExt.tree.BaseLayerContainer({ text: "Base Layers", map: map, expanded: true })); var overlayContainer = new GeoExt.tree.OverlayLayerContainer({ text: "Overlays", map: map, expanded: true }); root.appendChild(overlayContainer); var addLayerButton = new Ext.Button({ text: "Add Layer", handler: function(pressed){ //OpenLayers.Console.log("add layer button pressed"); layerWindow.show(); } }); var layerToolBar = new Ext.Toolbar({items: [addLayerButton]}); var layerTree = new Ext.tree.TreePanel({ title: "Map Layers", root: root, enableDD: true, collapsible: true, height: 200, tbar: layerToolBar, expanded: true }); layerTree.on('contextmenu', menuShow, this); var subMenu = new Ext.menu.Menu({id:'exportMenu'}); subMenu.add( new Ext.menu.Item({id: 'shape-zip', text: 'SHP (zipped)', handler: taskExport}), new Ext.menu.Item({id: 'GML2', text: 'GML v2', handler: taskExport}), new Ext.menu.Item({id: 'csv', text: 'CSV', handler: taskExport}), new Ext.menu.Item({id: 'georss',text: 'GeoRSS', handler: taskExport, disabled: true}), new Ext.menu.Item({id: 'pdf', text: 'PDF', handler: taskExport, disabled:true}), new Ext.menu.Item({id: 'svg',text: 'SVG', handler: taskExport, disabled:true}) ); var menuC = new Ext.menu.Menu('mainContext'); menuC.add( new Ext.menu.Item({text: 'Zoom to Layer', handler: taskZoom}), new Ext.menu.Separator(), { text: 'Export', menu: subMenu } ); function taskZoom(node) { var selectedLayer = map.getLayersByName(node.parentMenu.activeLayer)[0]; //console.log(selectedLayer); var layerExtent = selectedLayer.getDataExtent(); if (layerExtent){ map.zoomToExtent(layerExtent); }else { map.zoomToExtent(initialExtent); } } function taskExport(node){ var selectedLayer = map.getLayersByName(node.parentMenu.parentMenu.activeLayer)[0]; var url =""; //http://dev.maps.nypl.org:8080/geoserver/wms?bbox=-74.81458064799999,39.844969352,-72.859419352,41.800130648&styles=&Format=application/rss%2Bxml&request=GetMap&version=1.1.1&layers=topp:NYC_Structures_demo2&width=600&height=550&srs=EPSG:4326 if (node.id == "kml") { url = "/geoserver/wms/kml?layers=topp:"+selectedLayer.typename; } else if (node.id == "georss"){ //Format=application/rss+xml"; } else if (node.id == "svg"){ // "&Format=image/svg+xml"; }else if (node.id == "pdf"){ //application/pdf"; }else{ url = selectedLayer.getFullRequestString() + "&OutputFormat="+node.id; } // console.log(url); var newWin = window.open(url, '_blank') newWin.focus(); } function menuShow(node){ menuC.activeLayer = node.text; if (node.layer && node.layer.CLASS_NAME == "OpenLayers.Layer.WFS"){ menuC.show(node.ui.getAnchor()); } } var vp = new Ext.Viewport({ layout: 'border', listeners: {'afterlayout': {'fn': setupMap}}, items: [ new Ext.BoxComponent({ region: 'north', el: 'north', height: 74 }), { region: 'east', id: 'east-panel', width: 400, autoScroll: true, items: [ layerTree, { title: 'Help', id: 'help', contentEl: 'helptext', collapsible: true }] }, mapPanel ] }); wmscapurl = "http://dev.maps.nypl.org/warper-dev/layers/wms2?SERVICE=WMS&REQUEST=GetCapabilities"; // create a new WMS capabilities store store = new GeoExt.data.WMSCapabilitiesStore({ url: wmscapurl }); // load the store with records derived from the doc at the above url store.load(); // create a grid to display records from the store var grid = new Ext.grid.GridPanel({ // title: "WMS Capabilities", store: store, columns: [ //{header: "Name", dataIndex: "name", sortable: true}, {header: "Layer", dataIndex: "title", id: "title", sortable: true}, {header: "Description", dataIndex: "abstract", id: "abstract", sortable: true} ], autoExpandColumn: "title", sm: new Ext.grid.RowSelectionModel({singleSelect:true}), height: 300, width: 650, listeners: { rowdblclick: clickLayer } }); var layerWindow = new Ext.Window({ title: "Layer List", width: 600, height: 300, minWidth: 300, minHeight: 200, layout: 'fit', modal: true, plain: false, bodyStyle: 'padding:5px;', items: [grid], closeAction:'hide', buttons: [{ text: 'Close', handler: function(){ layerWindow.hide(); } }] }); //layerWindow.show(); var addLayer = new Ext.Button({ text: "Add Layer To Map", handler: function(pressed){ // OpenLayers.Console.log("add layer button pressed"); } }); var layerTb = new Ext.Toolbar({items: [addLayer]}); function clickLayer(grid, index) { var record = grid.getStore().getAt(index); var layer = record.get("layer").clone(); layer.setIsBaseLayer(false); //layer.setOpacity(0.8); // OpenLayers.Console.log(layer); //layer.DEFAULT_PARAMS.format = "image/png"; layer.params.FORMAT = "image/png"; map.addLayer(layer); sourceLayers.push(layer); // OpenLayers.Console.log(sourceLayers); for (var a=0;a<sourceLayers.length;a++){ //OpenLayers.Console.log(sourceLayers[a]); if (sourceLayers[a].getVisibility()){ //OpenLayers.Console.log("this layer is visible"); } } //TODO when double clicked, show a preview? // var mapWin = new Ext.Window({ // title: "Preview: " + record.get("title"), // width: 512, // height: 256, // layout: "fit", // modal: true, // tbar: layerTb, // items: [{ // xtype: "gx_mappanel", // layers: [layer], // extent: record.get("llbbox") // }] // }); // mapWin.show(); } }); function osm_getTileURL(bounds) { var res = this.map.getResolution(); var x = Math.round((bounds.left - this.maxExtent.left) / (res * this.tileSize.w)); var y = Math.round((this.maxExtent.top - bounds.top) / (res * this.tileSize.h)); var z = this.map.getZoom(); var limit = Math.pow(2, z); if (y < 0 || y >= limit) { return OpenLayers.Util.getImagesLocation() + "404.png"; } else { x = ((x % limit) + limit) % limit; return this.url + z + "/" + x + "/" + y + "." + this.type; } }
/** * Copyright (C) 2014 KO GmbH <copyright@kogmbh.com> * * @licstart * This file is part of WebODF. * * WebODF is free software: you can redistribute it and/or modify it * under the terms of the GNU Affero General Public License (GNU AGPL) * as published by the Free Software Foundation, either version 3 of * the License, or (at your option) any later version. * * WebODF is distributed in the hope that it will be useful, but * WITHOUT ANY WARRANTY; without even the implied warranty of * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the * GNU Affero General Public License for more details. * * You should have received a copy of the GNU Affero General Public License * along with WebODF. If not, see <http://www.gnu.org/licenses/>. * @licend * * @source: http://www.webodf.org/ * @source: https://github.com/kogmbh/WebODF/ */ /*global runtime, odf*/ /** * Object that retrieves properties lazily and caches them. * If the element does not define the property it is retrieved from a parent * LazyStyleProperties object. * An object with getters functions is passed into the constructor. There must * be a getter function for each property. * @constructor * @param {!odf.LazyStyleProperties|undefined} parent * @param {!Object.<!string,function():*>} getters */ odf.LazyStyleProperties = function (parent, getters) { "use strict"; var /**@type{!Object.<!string,*>}*/ data = {}; /** * Retrieve a value by name. * The getter for the value must be defined in the getters object. * If the getter returns undefined and a parent object is provided, the * value is gotten from the parent object. * @param {!string} name * @return {*} */ this.value = function (name) { var /**@type{*}*/ v; if (data.hasOwnProperty(name)) { v = data[name]; } else { v = getters[name](); if (v === undefined && parent) { v = parent.value(name); } data[name] = v; } return v; }; /** * Give a new parent to the LazyStyleProperties. * The cache is invalidated when this is done. * @param {!odf.LazyStyleProperties|undefined} p * @return {undefined} */ this.reset = function (p) { parent = p; data = {}; }; }; /** * A collection of helper functions for parsing style attributes. * @constructor */ odf.StyleParseUtils = function () { "use strict"; var stylens = odf.Namespaces.stylens; /** * Returns the length split as value and unit, from an ODF attribute. * If the length does not match the regular expression, null is returned. * @param {?string|undefined} length * @return {?{value:!number,unit:!string}} */ function splitLength(length) { var re = /(-?[0-9]*[0-9][0-9]*(\.[0-9]*)?|0+\.[0-9]*[1-9][0-9]*|\.[0-9]*[1-9][0-9]*)((cm)|(mm)|(in)|(pt)|(pc)|(px))/, m = re.exec(length); if (!m) { return null; } return {value: parseFloat(m[1]), unit: m[3]}; } /** * Convert a unit in a string to number of pixels at 96 dpi. * If the input value has unit 'px' or is a number, the number is taken as * is. Other allowed unit: cm, mm, pt, pc. * If the value cannot be parsed, the value undefined is returned. * @param {?string|undefined} val * @return {!number|undefined} */ function parseLength(val) { var n, length, unit; length = splitLength(val); unit = length && length.unit; if (unit === "px") { n = length.value; } else if (unit === "cm") { n = length.value / 2.54 * 96; } else if (unit === "mm") { n = length.value / 25.4 * 96; } else if (unit === "in") { n = length.value * 96; } else if (unit === "pt") { n = length.value / 0.75; } else if (unit === "pc") { n = length.value * 16; } return n; } this.parseLength = parseLength; /** * Parse a percentage of the form -?([0-9]+(\.[0-9]*)?|\.[0-9]+)%. * If parsing fails undefined is returned. * @param {?string|undefined} value * @return {!number|undefined} */ function parsePercent(value) { var v; if (value) { v = parseFloat(value.substr(0, value.indexOf("%"))); if (isNaN(v)) { v = undefined; } } return v; } /** * Parse a value that is a positive length or a percentage. * If parsing fails undefined is returned. * @param {?string|undefined} value * @param {!string} name * @param {!odf.LazyStyleProperties|undefined} parent * @return {!number|undefined} */ function parsePositiveLengthOrPercent(value, name, parent) { var v = parsePercent(value), parentValue; if (v !== undefined) { if (parent) { parentValue = parent.value(name); } if (parentValue === undefined) { v = undefined; } else { v *= /**@type{!number}*/(parentValue) / 100; } } else { v = parseLength(value); } return v; } this.parsePositiveLengthOrPercent = parsePositiveLengthOrPercent; /** * Find a child element from the ODF style namespace with the given local * name. * The search is started after the given previousPropertyElement or, if * previousPropertyElement is not given, from the first child element. * @param {!string} name * @param {!Element} styleElement * @param {?Element=} previousPropertyElement * @return {?Element} */ function getPropertiesElement(name, styleElement, previousPropertyElement) { var e = previousPropertyElement ? previousPropertyElement.nextElementSibling : styleElement.firstElementChild; while (e !== null && (e.localName !== name || e.namespaceURI !== stylens)) { e = e.nextElementSibling; } return e; } this.getPropertiesElement = getPropertiesElement; /** * Split a space-separated attribute list into it's list items. Ignores leading & trailing * whitespace, and collapses excessive internal whitespace. If the input text is null, undefined * or pure whitespace, an empty array will be returned. * * @param {?string|undefined} text * @return {!Array.<!string>} */ /*jslint regexp: true*/ function parseAttributeList(text) { if (text) { text = text.replace(/^\s*(.*?)\s*$/g, "$1"); // Trim leading + trailing whitespace } // Calling split on an empty string returns a [""]. Avoid this by only attempting to split if the // string is non-zero-length return text && text.length > 0 ? text.split(/\s+/) : []; } /*jslint regexp: false*/ this.parseAttributeList = parseAttributeList; };
/* Copyright (c) 2003-2016, CKSource - Frederico Knabben. All rights reserved. For licensing, see LICENSE.md or http://ckeditor.com/license */ CKEDITOR.plugins.setLang( 'colordialog', 'fr-ca', { clear: 'Effacer', highlight: 'Surligner', options: 'Options de couleur', selected: 'Couleur sélectionnée', title: 'Choisir une couleur' } );
(function($){ $( document ).ready( function() { var ET_Select_Image = function(element, options){ this.element = element; this.custom_select_link = null; this.custom_dropdown = null; this.frontend_customizer = $('body').hasClass( 'et_frontend_customizer' ) ? true : false; this.options = jQuery.extend({}, this.defaults, options); this.create_dropdown(); }, $iframe_preview = 'old' === et_divi_customizer_data.is_old_wp ? $( '#customize-preview' ) : $( '.wp-full-overlay' ), all_device_classes = 'old' === et_divi_customizer_data.is_old_wp ? 'et_divi_phone et_divi_tablet' : 'preview-tablet preview-mobile preview-desktop', tablet_class = 'old' === et_divi_customizer_data.is_old_wp ? 'et_divi_tablet' : 'preview-tablet'; phone_class = 'old' === et_divi_customizer_data.is_old_wp ? 'et_divi_phone' : 'preview-mobile'; desktop_class = 'old' === et_divi_customizer_data.is_old_wp ? '' : 'preview-desktop'; if ( typeof window.location.search !== 'undefined' && window.location.search.search( 'et_customizer_option_set=module' ) !== -1 ) { $( 'body' ).addClass( 'et_modules_customizer_option_set' ); } else { $( 'body' ).addClass( 'et_theme_customizer_option_set' ); } ET_Select_Image.prototype = { defaults: { apply_value_to : 'body' }, create_dropdown: function(){ var $et_select_image_main_select = this.element, et_filter_options_html = '', $selected_option, $dropdown_selected_option, self = this; if ( $et_select_image_main_select.length ) { $et_select_image_main_select.hide().addClass( 'et_select_image_main_select' ); $et_select_image_main_select.change( $.proxy( self.change_option, self ) ); $et_select_image_main_select.find( 'option' ).each( function() { var $this_option = $(this), selected = $(this).is( ':selected' ) ? ' class="et_select_image_active"' : '', option_class = 0 === $this_option.attr( 'value' ).indexOf( '_' ) ? $this_option.attr( 'value' ) : '_' + $this_option.attr( 'value' ); et_filter_options_html += '<li class="et_si' + option_class + '_column" data-value="' + $this_option.attr( 'value' ) + '"' + selected +'>' + $this_option.text() + '</li>'; } ); $et_select_image_main_select.after( '<a href="#" class="et_select_image_custom_select">' + '<span class="et_filter_text"></span>' + '</a>' + '<ul class="et_select_image_options '+ self.esc_classname( $et_select_image_main_select.attr('data-customize-setting-link') ) +'">' + et_filter_options_html + '</ul>' ); } this.custom_select_link = $et_select_image_main_select.next( '.et_select_image_custom_select' ); this.custom_dropdown = this.custom_select_link.next('.et_select_image_options'); $selected_option = $et_select_image_main_select.find( ':selected' ); if ( $selected_option.length ) { var selected_option_class = 0 === $selected_option.attr( 'value' ).indexOf( '_' ) ? $selected_option.attr( 'value' ) : '_' + $selected_option.attr( 'value' ); this.custom_select_link.find('.et_filter_text').text( $selected_option.text() ).addClass( 'et_si' + selected_option_class + '_column' ); $dropdown_selected_option = ( $selected_option.val() == 'none' ) ? this.custom_dropdown.find('li').eq(0) : this.custom_dropdown.find('li[data-value="' + $selected_option.text() + '"]'); this.custom_select_link.find('.et_filter_text').addClass( $dropdown_selected_option.attr('class') ).attr( 'data-si-class', $dropdown_selected_option.attr('class') ); $dropdown_selected_option.addClass( 'et_select_image_active' ); } this.custom_select_link.click( $.proxy( self.open_dropdown, self ) ); this.custom_dropdown.find('li').click( $.proxy( self.select_option, self ) ); }, open_dropdown: function(event) { var self = this, $this_link = $(event.target); if ( self.custom_dropdown.hasClass( 'et_select_image_open' ) ) return false; self.custom_dropdown.show().addClass( 'et_select_image_open' ); $this_link.hide(); return false; }, select_option: function(event) { var self = this, $this_option = $(event.target), this_option_value = $this_option.attr('data-value'), $main_text = self.custom_select_link.find( '.et_filter_text' ), $main_select_active_element = self.element.find( 'option[value="' + this_option_value + '"]' ); if ( $this_option.hasClass( 'et_select_image_active' ) ) { self.close_dropdown(); return false; } $this_option.siblings().removeClass( 'et_select_image_active' ); $main_text.removeClass(function(index, css){ return (css.match(/\bet_si_\S+/g) || []).join(' '); }); $main_text.addClass( $this_option.attr( 'class' ) ).attr( 'data-si-class', $this_option.attr( 'class' ) ); $this_option.addClass('et_select_image_active'); self.close_dropdown(); if ( ! $main_select_active_element.length ) self.element.val( 'none' ).trigger( 'change' ); else self.element.val( this_option_value ).trigger( 'change' ); return false; }, close_dropdown: function() { this.custom_select_link.find( '.et_filter_text' ).show(); this.custom_dropdown.hide().removeClass( 'et_select_image_open' ); }, change_option: function() { var self = this, $active_option = self.element.find('option:selected'), active_option_value = $active_option.val(), $this_option = this.custom_dropdown.find('li[data-value="' + active_option_value + '"]'), $main_text = self.custom_select_link.find( '.et_filter_text' ), main_text_si_class = $main_text.attr( 'data-si-class' ); // set correct custom dropdown values on first load if ( this.custom_dropdown.find('li.et_select_image_active').data( 'value' ) !== active_option_value ) { this.custom_dropdown.find('li').removeClass( 'et_select_image_active' ); $main_text.removeClass( main_text_si_class ).addClass( $this_option.attr( 'class' ) ).attr( 'data-si-class', $this_option.attr( 'class' ) ); $this_option.addClass('et_select_image_active'); } }, esc_classname: function( option_value ) { return 'et_si_' + option_value.replace(/[ +\/\[\]]/g,'_').toLowerCase(); } }; $.fn.et_select_image = function(options){ new ET_Select_Image(this, options); return this; }; $('select[data-customize-setting-link="et_divi[footer_columns]"]').et_select_image({ apply_value_to: 'body' }); $( '.et_divi_reset_slider' ).click( function () { var $this_input = $( this ).closest( 'label' ).find( 'input' ), input_name = $this_input.data( 'customize-setting-link' ), input_default = $this_input.data( 'reset_value' ); $this_input.val( input_default ); $this_input.change(); }); $( '#accordion-section-et_divi_mobile_tablet h3, #accordion-panel-et_divi_mobile h3' ).click( function () { $iframe_preview.removeClass( all_device_classes ).addClass( tablet_class ); if ( 'old' !== et_divi_customizer_data.is_old_wp ) { $( '#customize-footer-actions .devices' ).css( { display: 'none' } ); } }); $( '#accordion-section-et_divi_mobile_phone h3, #accordion-section-et_divi_mobile_menu h3' ).click( function () { $iframe_preview.removeClass( all_device_classes ).addClass( phone_class ); if ( 'old' !== et_divi_customizer_data.is_old_wp ) { $( '#customize-footer-actions .devices' ).css( { display: 'none' } ); } }); $( '.control-panel-back, .customize-panel-back' ).click( function () { $iframe_preview.removeClass( all_device_classes ).addClass( desktop_class ); if ( 'old' !== et_divi_customizer_data.is_old_wp ) { $( '#customize-footer-actions .devices' ).css( { display: 'block' } ); } }); $( 'input[type=range]' ).on( 'mousedown', function() { var $range = $(this), $range_input = $range.parent().children( '.et-pb-range-input' ); value = $( this ).attr( 'value' ); $range_input.val( value ); $( this ).mousemove(function() { value = $( this ).attr( 'value' ); $range_input.val( value ); }); }); var et_range_input_number_timeout; function et_autocorrect_range_input_number( input_number, timeout ) { var $range_input = input_number, $range = $range_input.parent().find('input[type="range"]'), value = parseFloat( $range_input.val() ), reset = parseFloat( $range.attr('data-reset_value') ), step = parseFloat( $range_input.attr('step') ), min = parseFloat( $range_input.attr('min') ), max = parseFloat( $range_input.attr('max') ); clearTimeout( et_range_input_number_timeout ); et_range_input_number_timeout = setTimeout( function() { if ( isNaN( value ) ) { $range_input.val( reset ); $range.val( reset ).trigger( 'change' ); return; } if ( step >= 1 && value % 1 !== 0 ) { value = Math.round( value ); $range_input.val( value ); $range.val( value ); } if ( value > max ) { $range_input.val( max ); $range.val( max ).trigger( 'change' ); } if ( value < min ) { $range_input.val( min ); $range.val( min ).trigger( 'change' ); } }, timeout ); $range.val( value ).trigger( 'change' ); } $('input.et-pb-range-input').on( 'change keyup', function() { et_autocorrect_range_input_number( $(this), 1000 ); }).on( 'focusout', function() { et_autocorrect_range_input_number( $(this), 0 ); }); $('input.et_font_style_checkbox[type=checkbox]').live('change', function(){ var $this_el = $(this), $main_option = $this_el.closest( 'span' ).siblings( 'input.et_font_styles' ), value = $this_el.val(), current_value = $main_option.val(), values = ( current_value != 'false' ) ? current_value.split( '|' ) : [], query = $.inArray( value, values ), result = ''; if ( $this_el.prop('checked' ) === true ) { if ( current_value.length ) { if ( query < 0 ) { values.push( value ); result = values.join( '|' ); } } else { result = value; } } else { if ( current_value.length !== 0 ) { if ( query >= 0 ) { values.splice( query, 1 ); result = values.join( '|' ); } else { result = current_value; } } } $main_option.val( result ).trigger( 'change' ); }); $( 'span.et_font_style' ).click( function() { var style_checkbox = $( this ).find( 'input' ); $( this ).toggleClass( 'et_font_style_checked' ); if ( style_checkbox.is( ':checked' ) ) { style_checkbox.prop( 'checked', false ); } else { style_checkbox.prop( 'checked', true ); } style_checkbox.change(); }); var $vertical_nav_option = $( '#customize-control-et_divi-vertical_nav' ), $vertical_nav_input = $vertical_nav_option.find( 'input[type=checkbox]' ), $nav_fullwidth_control = $( '#customize-control-et_divi-nav_fullwidth' ), $hide_navigation_until_scroll_control = $('#customize-control-et_divi-hide_nav'), $header_style_option = $( '#customize-control-et_divi-header_style select' ), $secondary_menu_options = $( '#accordion-section-et_divi_header_secondary' ), $slide_header_section = $( '#accordion-section-et_divi_header_slide' ), $show_top_bar_input = $( '#customize-control-et_divi-slide_nav_show_top_bar input[type=checkbox]' ), $top_bar_related_options = $( '#customize-control-et_divi-slide_nav_bg_top, #customize-control-et_divi-slide_nav_top_color, #customize-control-et_divi-slide_nav_search, #customize-control-et_divi-slide_nav_search_bg'), $primary_header_options = $( '#customize-control-et_divi-primary_nav_font_size, #customize-control-et_divi-primary_nav_font_spacing, #customize-control-et_divi-primary_nav_font, #customize-control-et_divi-primary_nav_font_style, #customize-control-et_divi-menu_link_active, #customize-control-et_divi-primary_nav_dropdown_bg, #customize-control-et_divi-primary_nav_dropdown_line_color, #customize-control-et_divi-primary_nav_dropdown_link_color, #customize-control-et_divi-primary_nav_dropdown_animation, #customize-control-et_divi-fixed_primary_nav_font_size, #customize-control-et_divi-fixed_secondary_nav_bg, #customize-control-et_divi-fixed_menu_link, #customize-control-et_divi-fixed_secondary_menu_link, #customize-control-et_divi-fixed_menu_link_active' ), $slide_only_options = $( '#customize-control-et_divi-slide_nav_width, #customize-control-et_divi-slide_nav_search, #customize-control-et_divi-slide_nav_search_bg, #customize-control-et_divi-slide_nav_font_size, #customize-control-et_divi-slide_nav_top_font_size' ), $fullscreen_only_options = $( '#customize-control-et_divi-fullscreen_nav_font_size, #customize-control-et_divi-fullscreen_nav_top_font_size' ), $vertical_orientation = $( '#customize-control-et_divi-vertical_nav_orientation' ), $menu_height = $( '#customize-control-et_divi-menu_height' ), $menu_margin_top = $( '#customize-control-et_divi-menu_margin_top' ); if ( $vertical_nav_input.is( ':checked') ) { $nav_fullwidth_control.hide(); $hide_navigation_until_scroll_control.hide(); $vertical_orientation.show(); $menu_height.hide(); $menu_margin_top.show(); } else { $nav_fullwidth_control.show(); $hide_navigation_until_scroll_control.show(); $vertical_orientation.hide(); $menu_height.show(); $menu_margin_top.hide(); } if ( 'slide' === $header_style_option.val() || 'fullscreen' === $header_style_option.val() ) { $vertical_nav_option.hide(); $vertical_nav_input.attr( 'checked', false ); $vertical_nav_input.change(); $secondary_menu_options.addClass( 'et_hidden_section' ); $primary_header_options.hide(); $slide_header_section.removeClass( 'et_hidden_section' ); if ( 'slide' === $header_style_option.val() ) { $slide_only_options.removeClass( 'et_hidden_section' ); $fullscreen_only_options.addClass( 'et_hidden_section' ); } else { $slide_only_options.addClass( 'et_hidden_section' ); $fullscreen_only_options.removeClass( 'et_hidden_section' ); } } else { $vertical_nav_option.show(); $secondary_menu_options.removeClass( 'et_hidden_section' ); $primary_header_options.show(); $slide_header_section.addClass( 'et_hidden_section' ); } if ( $show_top_bar_input.is( ':checked' ) ) { $top_bar_related_options.show(); } else { $top_bar_related_options.hide(); } $('#customize-theme-controls').on( 'change', '#customize-control-et_divi-vertical_nav input[type=checkbox]', function(){ var is_checked = $(this).is(':checked'); if ( is_checked ) { $menu_height.hide(); $menu_margin_top.show(); } else { $menu_height.show(); $menu_margin_top.hide(); } }); $('#customize-theme-controls').on( 'change', '#customize-control-et_divi-vertical_nav input[type=checkbox]', function(){ $input = $(this); if ( $input.is(':checked') ) { $nav_fullwidth_control.hide(); $hide_navigation_until_scroll_control.hide(); $vertical_orientation.show(); } else { $nav_fullwidth_control.show(); $hide_navigation_until_scroll_control.show(); $vertical_orientation.hide(); } }); $( '#customize-theme-controls' ).on( 'change', '#customize-control-et_divi-header_style select', function(){ $input = $(this); if ( 'slide' === $input.val() || 'fullscreen' === $input.val() ) { $vertical_nav_option.hide(); $vertical_nav_input.attr( 'checked', false ); $vertical_nav_input.change(); $secondary_menu_options.addClass( 'et_hidden_section' ); $primary_header_options.hide(); $slide_header_section.removeClass( 'et_hidden_section' ); if ( 'slide' === $header_style_option.val() ) { $slide_only_options.removeClass( 'et_hidden_section' ); $fullscreen_only_options.addClass( 'et_hidden_section' ); } else { $slide_only_options.addClass( 'et_hidden_section' ); $fullscreen_only_options.removeClass( 'et_hidden_section' ); } } else { $vertical_nav_option.show(); $secondary_menu_options.removeClass( 'et_hidden_section' ); $primary_header_options.show(); $slide_header_section.addClass( 'et_hidden_section' ); } }); $( '#customize-theme-controls' ).on( 'change', '#customize-control-et_divi-slide_nav_show_top_bar input[type=checkbox]', function(){ $input = $(this); if ( $input.is( ':checked' ) ) { $top_bar_related_options.show(); } else { $top_bar_related_options.hide(); } }); function toggle_sidebar_width_control() { var $checkbox = $('#customize-control-et_divi-use_sidebar_width input[type="checkbox"]'), $sidebar_width_control = $( '#customize-control-et_divi-sidebar_width' ); if ( $checkbox.is( ':checked' ) ) { $sidebar_width_control.fadeIn(); } else { $sidebar_width_control.fadeOut(); } } toggle_sidebar_width_control(); $('#customize-theme-controls').on( 'change', '#customize-control-et_divi-use_sidebar_width input[type=checkbox]', function(){ toggle_sidebar_width_control(); }); }); var api = wp.customize; api.ET_ColorAlphaControl = api.Control.extend({ ready: function() { var control = this, picker = control.container.find('.color-picker-hex'); picker.val( control.setting() ).wpColorPicker({ change: function() { var et_color_picker_value = picker.wpColorPicker('color'); if ( '' === et_color_picker_value || 'string' !== typeof et_color_picker_value ) { return; } try { control.setting.set( et_color_picker_value.toLowerCase() ); } catch( err ) { // Value is not a properly formatted color, let's see if we can fix it. if ( /^[\da-z]{3}([\da-z]{3})?$/i.test(et_color_picker_value) ) { // Value looks like a hex color but is missing hash character. et_color_picker_value = '#' + et_color_picker_value.toLowerCase(); control.setting.set( et_color_picker_value ); } } }, clear: function() { control.setting.set( false ); } }); control.setting.bind( function( value ) { picker.val( value ); picker.wpColorPicker( 'color', value ); }); /** * Adding following event whenever footer_menu_text_color is changed, due to its relationship with footer_menu_active_link_color. */ if ( 'et_divi[footer_menu_text_color]' === this.id ) { // Whenever user change footer_menu_text_color, do the following this.setting.bind( 'change', function( value ){ // Set footer_menu_active_link_color equal to the newly changed footer_menu_text_color api( 'et_divi[footer_menu_active_link_color]' ).set( value ); // Update default color of footer_menu_active_link_color equal to the newly changed footer_menu_text_color. // If afterward user change the color and not happy with it, they can click reset and back to footer_menu_text_color color api.control( 'et_divi[footer_menu_active_link_color]' ).container.find( '.color-picker-hex' ) .data( 'data-default-color', value ) .wpColorPicker({ 'defaultColor' : value, 'color' : value }); }); } } }); $( 'body' ).on( 'click', '.et_font_icon li', function() { var $this_el = $( this ), $this_input; if ( ! $this_el.hasClass( 'active' ) ) { $( '.et_font_icon li' ).removeClass( 'et_active' ); $this_el.addClass( 'et_active' ); $this_input = $this_el.closest( 'label' ).find( '.et_selected_icon' ); $this_input.val( $this_el.data( 'icon' ) ); $this_input.change(); } }); api.controlConstructor.et_coloralpha = api.ET_ColorAlphaControl; wp.customize.bind('ready', function() { // Unbind built-in & sanitized control and replaced it with straightforward control // to ensure compatibility with Divi option's data type var normalizedBackgroundImageOptions = ['background_repeat', 'background_attachment']; _.each(normalizedBackgroundImageOptions, function(option) { // Unbind WordPress' built-in option js control var defaultControl = api.control(option); if ( _.isUndefined( defaultControl ) ) { return; } defaultControl.container.find('input').unbind(); // Re-bind background_repeat option which is compatible with Divi's option var defaultControlNewInputs = new api.Element( defaultControl.container.find('input') ); defaultControlNewInputs.bind(function( to ) { defaultControl.setting.set( to ); } ); defaultControl.setting.bind( function( to ) { defaultControlNewInputs.set( to ); } ); }); // Toggle customizer control visibility based on other control's value function et_toggle_control_visibility( controls, visibility ) { _.each( controls, function( controlId ) { api.control( controlId, function( controlChild ) { // Use inline CSS + !important styling combo to overwrite WordPress' // built-in customizer appearance dependency if ( visibility ) { $( controlChild.container ).show().removeClass('et_hidden_section'); } else { $( controlChild.container ).hide().addClass('et_hidden_section'); } }); }); } // Stretch Background Image api.control( 'et_divi[cover_background]', function( control ) { var coverBackgroundValue = control.setting.get(), backgroundImageValue = api.control( 'background_image' ).setting.get() !== '', affectedControls = ['background_repeat', 'background_position_x' ], affectedControlsVisibility = ! coverBackgroundValue && backgroundImageValue; // Toggle visibility on page load et_toggle_control_visibility( affectedControls, affectedControlsVisibility ); // Toggle visibility on checkbox change control.setting.bind( 'change', function( coverBackgroundValueChanged ) { var backgroundImageValueChanged = api.control( 'background_image' ).setting.get() !== '', affectedControlsVisibilityChanged = ! coverBackgroundValueChanged && backgroundImageValueChanged; et_toggle_control_visibility( affectedControls, affectedControlsVisibilityChanged ); }); }); // Get background image's dynamic affected controls function et_background_image_affected_controls() { var coverBackgroundValue = api.control( 'et_divi[cover_background]' ).setting.get(), affectedControls = [ 'et_divi[cover_background]' ]; if ( ! coverBackgroundValue ) { affectedControls = $.merge( affectedControls, [ 'background_repeat', 'background_position_x' ] ); } return affectedControls; } // Background Image api.control('background_image', function( control ) { var backgroundImageValue = control.setting.get(), hasBackgroundImage = backgroundImageValue !== ''; // Toggle visibility on page load et_toggle_control_visibility( et_background_image_affected_controls(), hasBackgroundImage ); // Toggle visibility on background image change control.setting.bind( 'change', function( changedBackgroundImageValue ) { var hasChangedBackgroundImage = changedBackgroundImageValue !== ''; et_toggle_control_visibility( et_background_image_affected_controls(), hasChangedBackgroundImage ); }); }); }); $( window ).load( function() { var $et_custom_footer_credits_disable_control = $('#customize-control-et_divi-disable_custom_footer_credits input'), $et_custom_footer_credits_control = $('#customize-control-et_divi-custom_footer_credits'); if ( $et_custom_footer_credits_disable_control.is(':checked') ) { $et_custom_footer_credits_control.hide(); } $et_custom_footer_credits_disable_control.change( function() { if ( $(this).is(':checked') ) { $et_custom_footer_credits_control.hide(); } else { $et_custom_footer_credits_control.show(); } } ); if ( $( '#accordion-section-et_divi_buttons' ).length ) { var $icon_options_trigger = $( '#customize-control-et_divi-all_buttons_icon select' ), icon_options_trigger_val = $icon_options_trigger.val(); trigger_button_options( icon_options_trigger_val ); $icon_options_trigger.change( function() { icon_options_trigger_val = $( this ).val(); trigger_button_options( icon_options_trigger_val ); }); } function trigger_button_options( trigger_val ) { var icon_options_set = [ 'all_buttons_icon_color', 'all_buttons_icon_placement', 'all_buttons_icon_hover', 'all_buttons_selected_icon' ]; $.each( icon_options_set, function( i, option_name ) { if ( 'yes' === trigger_val ) { $( '#customize-control-et_divi-' + option_name ).show(); } else { $( '#customize-control-et_divi-' + option_name ).hide(); } } ); } if ( $( '.et_font_icon' ).length ) { $( '.et_font_icon' ).each( function(){ var $this_el = $( this ), this_input_val = $this_el.closest( 'label' ).find( '.et_selected_icon' ).val(); $this_el.find( 'li[data-icon="' + this_input_val + '"]').addClass( 'et_active' ); }); } } ); })(jQuery);
/** * Copyright 2015 Google Inc. All Rights Reserved. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ 'use strict'; var traceLabels = require('./trace-labels.js'); var pjson = require('../package.json'); var constants = require('./constants.js'); var EventEmitter = require('events').EventEmitter; var headers = {}; headers[constants.TRACE_AGENT_REQUEST_HEADER] = 1; /** * Creates a basic trace writer. * @param {!Logger} logger * @constructor */ function TraceWriter(logger, config) { /** @private */ this.logger_ = logger; /** @private */ this.config_ = config; /** @private {Array<string>} stringified traces to be published */ this.buffer_ = []; /** @private {Object} default labels to be attached to written spans */ this.defaultLabels_ = {}; /** @private {Boolean} whether the trace writer is active */ this.isActive = true; } TraceWriter.prototype.__proto__ = EventEmitter.prototype; TraceWriter.prototype.stop = function() { this.isActive = false; }; /** * Ensures that all sub spans of the provided spanData are * closed and then queues the span data to be published. * * @param {SpanData} spanData The trace to be queued. */ TraceWriter.prototype.writeSpan = function(spanData) { for (var i = 0; i < spanData.trace.spans.length; i++) { if (spanData.trace.spans[i].endTime === '') { spanData.trace.spans[i].close(); } } // Copy properties from the default labels. for (var k in this.defaultLabels_) { if (this.defaultLabels_.hasOwnProperty(k)) { spanData.addLabel(k, this.defaultLabels_[k]); } } this.emit('transaction', spanData.trace); if (process.env.NODE_ENV === 'test') this.queueTrace_(spanData.trace); }; /** * Buffers the provided trace to be published. * * @private * @param {Trace} trace The trace to be queued. */ TraceWriter.prototype.queueTrace_ = function(trace) { var that = this; that.buffer_.push(JSON.stringify(trace)); that.logger_.debug('queued trace. new size:', that.buffer_.length); // Publish soon if the buffer is getting big if (that.buffer_.length >= that.config_.bufferSize) { that.logger_.info('Flushing: trace buffer full'); setImmediate(function() { that.flushBuffer_(); }); } }; /** * Flushes the buffer of traces at a regular interval * controlled by the flushDelay property of this * TraceWriter's config. */ TraceWriter.prototype.scheduleFlush_ = function() { this.logger_.info('Flushing: performing periodic flush'); this.flushBuffer_(); // Do it again after delay if (this.isActive) { setTimeout(this.scheduleFlush_.bind(this), this.config_.flushDelaySeconds * 1000).unref(); } }; /** * Serializes the buffered traces to be published asynchronously. * * @param {number} projectId The id of the project that traces should publish on. */ TraceWriter.prototype.flushBuffer_ = function() { if (this.buffer_.length === 0) { return; } // Privatize and clear the buffer. var buffer = this.buffer_; this.buffer_ = []; this.logger_.debug('Flushing traces', buffer); }; /** * Publishes flushed traces to the network. * * @param {number} projectId The id of the project that traces should publish on. * @param {string} json The stringified json representation of the queued traces. */ TraceWriter.prototype.publish_ = function(json) { if (process.send) process.send({ type: 'axm:trace', data: json }); }; /** * Export TraceWriter. * FIXME(ofrobots): TraceWriter should be a singleton. We should export * a get function that returns the instance instead. */ module.exports = TraceWriter;
"use strict"; var sec = require('./security'); module.exports = function () { var sapp = this; var remotes = this.remotes; var authorize = authorizer(sapp); remotes.before('**', function (ctx, next, method) { var req = ctx.request; var Model = method.ctor; var modelInstance = ctx.instance; var modelId = modelInstance && modelInstance.id || req.param('id'); var modelSettings = Model.settings || {}; var errStatusCode = modelSettings.aclErrorStatus || sapp.get('aclErrorStatus') || 401; if (!req.accessToken) { errStatusCode = 401; } authorize( req.accessToken, modelId, method, ctx, function (err, allowed) { if (err) return next(err); if (!allowed) { var messages = { 403: 'Access Denied', 404: 'Could not find a model with id ' + modelId, 401: 'Authorization Required' }; var e = new Error(messages[errStatusCode] || messages[403]); e.statusCode = errStatusCode; return next(e); } next(); } ); }); }; function authorizer(sapp) { /** * Check if the given access token can invoke the method * * @param {Object} token The access token * @param {*} modelId The model ID. * @param {SharedMethod} sharedMethod The method in question * @param {Object} [ctx] The remotes context * @param {Function} cb The callback function (err, allowed) */ return function (token, modelId, sharedMethod, ctx, cb) { if (typeof ctx === 'function') { cb = ctx; ctx = null } ctx = ctx || {}; var AccessToken = sapp.models['AccessToken']; var ACL = sapp.models['ACL']; var ANONYMOUS = AccessToken.ANONYMOUS; token = token || ANONYMOUS; ACL.checkAccessForContext({ accessToken: token, model: sharedMethod.ctor, property: sharedMethod.name, method: sharedMethod.name, sharedMethod: sharedMethod, modelId: modelId, accessType: sec.getAccessTypeForMethod(sharedMethod), remoteContext: ctx }, function (err, accessRequest) { if (err) return cb(err); cb(null, accessRequest.isAllowed()); }); } }
/* */ "format global"; var captionPlaceholder = {}; ko.bindingHandlers['options'] = { 'init': function(element) { if (ko.utils.tagNameLower(element) !== "select") throw new Error("options binding applies only to SELECT elements"); // Remove all existing <option>s. while (element.length > 0) { element.remove(0); } // Ensures that the binding processor doesn't try to bind the options return { 'controlsDescendantBindings': true }; }, 'update': function (element, valueAccessor, allBindings) { function selectedOptions() { return ko.utils.arrayFilter(element.options, function (node) { return node.selected; }); } var selectWasPreviouslyEmpty = element.length == 0, multiple = element.multiple, previousScrollTop = (!selectWasPreviouslyEmpty && multiple) ? element.scrollTop : null, unwrappedArray = ko.utils.unwrapObservable(valueAccessor()), valueAllowUnset = allBindings.get('valueAllowUnset') && allBindings['has']('value'), includeDestroyed = allBindings.get('optionsIncludeDestroyed'), arrayToDomNodeChildrenOptions = {}, captionValue, filteredArray, previousSelectedValues = []; if (!valueAllowUnset) { if (multiple) { previousSelectedValues = ko.utils.arrayMap(selectedOptions(), ko.selectExtensions.readValue); } else if (element.selectedIndex >= 0) { previousSelectedValues.push(ko.selectExtensions.readValue(element.options[element.selectedIndex])); } } if (unwrappedArray) { if (typeof unwrappedArray.length == "undefined") // Coerce single value into array unwrappedArray = [unwrappedArray]; // Filter out any entries marked as destroyed filteredArray = ko.utils.arrayFilter(unwrappedArray, function(item) { return includeDestroyed || item === undefined || item === null || !ko.utils.unwrapObservable(item['_destroy']); }); // If caption is included, add it to the array if (allBindings['has']('optionsCaption')) { captionValue = ko.utils.unwrapObservable(allBindings.get('optionsCaption')); // If caption value is null or undefined, don't show a caption if (captionValue !== null && captionValue !== undefined) { filteredArray.unshift(captionPlaceholder); } } } else { // If a falsy value is provided (e.g. null), we'll simply empty the select element } function applyToObject(object, predicate, defaultValue) { var predicateType = typeof predicate; if (predicateType == "function") // Given a function; run it against the data value return predicate(object); else if (predicateType == "string") // Given a string; treat it as a property name on the data value return object[predicate]; else // Given no optionsText arg; use the data value itself return defaultValue; } // The following functions can run at two different times: // The first is when the whole array is being updated directly from this binding handler. // The second is when an observable value for a specific array entry is updated. // oldOptions will be empty in the first case, but will be filled with the previously generated option in the second. var itemUpdate = false; function optionForArrayItem(arrayEntry, index, oldOptions) { if (oldOptions.length) { previousSelectedValues = !valueAllowUnset && oldOptions[0].selected ? [ ko.selectExtensions.readValue(oldOptions[0]) ] : []; itemUpdate = true; } var option = element.ownerDocument.createElement("option"); if (arrayEntry === captionPlaceholder) { ko.utils.setTextContent(option, allBindings.get('optionsCaption')); ko.selectExtensions.writeValue(option, undefined); } else { // Apply a value to the option element var optionValue = applyToObject(arrayEntry, allBindings.get('optionsValue'), arrayEntry); ko.selectExtensions.writeValue(option, ko.utils.unwrapObservable(optionValue)); // Apply some text to the option element var optionText = applyToObject(arrayEntry, allBindings.get('optionsText'), optionValue); ko.utils.setTextContent(option, optionText); } return [option]; } // By using a beforeRemove callback, we delay the removal until after new items are added. This fixes a selection // problem in IE<=8 and Firefox. See https://github.com/knockout/knockout/issues/1208 arrayToDomNodeChildrenOptions['beforeRemove'] = function (option) { element.removeChild(option); }; function setSelectionCallback(arrayEntry, newOptions) { if (itemUpdate && valueAllowUnset) { // The model value is authoritative, so make sure its value is the one selected // There is no need to use dependencyDetection.ignore since setDomNodeChildrenFromArrayMapping does so already. ko.selectExtensions.writeValue(element, ko.utils.unwrapObservable(allBindings.get('value')), true /* allowUnset */); } else if (previousSelectedValues.length) { // IE6 doesn't like us to assign selection to OPTION nodes before they're added to the document. // That's why we first added them without selection. Now it's time to set the selection. var isSelected = ko.utils.arrayIndexOf(previousSelectedValues, ko.selectExtensions.readValue(newOptions[0])) >= 0; ko.utils.setOptionNodeSelectionState(newOptions[0], isSelected); // If this option was changed from being selected during a single-item update, notify the change if (itemUpdate && !isSelected) { ko.dependencyDetection.ignore(ko.utils.triggerEvent, null, [element, "change"]); } } } var callback = setSelectionCallback; if (allBindings['has']('optionsAfterRender') && typeof allBindings.get('optionsAfterRender') == "function") { callback = function(arrayEntry, newOptions) { setSelectionCallback(arrayEntry, newOptions); ko.dependencyDetection.ignore(allBindings.get('optionsAfterRender'), null, [newOptions[0], arrayEntry !== captionPlaceholder ? arrayEntry : undefined]); } } ko.utils.setDomNodeChildrenFromArrayMapping(element, filteredArray, optionForArrayItem, arrayToDomNodeChildrenOptions, callback); ko.dependencyDetection.ignore(function () { if (valueAllowUnset) { // The model value is authoritative, so make sure its value is the one selected ko.selectExtensions.writeValue(element, ko.utils.unwrapObservable(allBindings.get('value')), true /* allowUnset */); } else { // Determine if the selection has changed as a result of updating the options list var selectionChanged; if (multiple) { // For a multiple-select box, compare the new selection count to the previous one // But if nothing was selected before, the selection can't have changed selectionChanged = previousSelectedValues.length && selectedOptions().length < previousSelectedValues.length; } else { // For a single-select box, compare the current value to the previous value // But if nothing was selected before or nothing is selected now, just look for a change in selection selectionChanged = (previousSelectedValues.length && element.selectedIndex >= 0) ? (ko.selectExtensions.readValue(element.options[element.selectedIndex]) !== previousSelectedValues[0]) : (previousSelectedValues.length || element.selectedIndex >= 0); } // Ensure consistency between model value and selected option. // If the dropdown was changed so that selection is no longer the same, // notify the value or selectedOptions binding. if (selectionChanged) { ko.utils.triggerEvent(element, "change"); } } }); // Workaround for IE bug ko.utils.ensureSelectElementIsRenderedCorrectly(element); if (previousScrollTop && Math.abs(previousScrollTop - element.scrollTop) > 20) element.scrollTop = previousScrollTop; } }; ko.bindingHandlers['options'].optionValueDomDataKey = ko.utils.domData.nextKey();
import Vue from 'vue' import App from './App' new Vue(App).$mount('app')
{ "name": "flattenr.js", "url": "https://github.com/raitucarp/flattenr.js.git" }
version https://git-lfs.github.com/spec/v1 oid sha256:2ff7595a63720fdf0e7997235b2084a91df4bc23986d12dc3583de03d5102002 size 128807
/* Widget: columnSelector (responsive table widget) - updated 2018-08-03 (v2.31.2) *//* * Requires tablesorter v2.8+ and jQuery 1.7+ * by Justin Hallett & Rob Garrison */ /*jshint browser:true, jquery:true, unused:false */ /*global jQuery: false */ ;(function($) { 'use strict'; var ts = $.tablesorter, namespace = '.tscolsel', tsColSel = ts.columnSelector = { queryAll : '@media only all { [columns] { display: none; } } ', queryBreak : '@media all and (min-width: [size]) { [columns] { display: table-cell; } } ', init: function(table, c, wo) { var $t, colSel, debug = ts.debug(c, 'columnSelector'); // abort if no input is contained within the layout $t = $(wo.columnSelector_layout); if (!$t.find('input').add( $t.filter('input') ).length) { if (debug) { console.error('ColumnSelector >> ERROR: Column Selector aborting, no input found in the layout! ***'); } return; } // unique table class name c.$table.addClass( c.namespace.slice(1) + 'columnselector' ); // build column selector/state array colSel = c.selector = { $container : $(wo.columnSelector_container || '<div>') }; colSel.$style = $('<style></style>').prop('disabled', true).appendTo('head'); colSel.$breakpoints = $('<style></style>').prop('disabled', true).appendTo('head'); colSel.isInitializing = true; tsColSel.setUpColspan(c, wo); tsColSel.setupSelector(c, wo); if (wo.columnSelector_mediaquery) { tsColSel.setupBreakpoints(c, wo); } colSel.isInitializing = false; if (colSel.$container.length) { tsColSel.updateCols(c, wo); } else if (debug) { console.warn('ColumnSelector >> container not found'); } c.$table .off('refreshColumnSelector' + namespace) /* $('table').trigger('refreshColumnSelector', arguments ); showing arguments below undefined = refresh current settings (update css hiding columns) 'selectors' = update container contents (replace inputs/labels) [ [2,3,4] ] = set visible columns; turn off "auto" mode. [ 'columns', [2,3,4] ] = set visible columns; turn off "auto" mode. [ 'auto', [2,3,4] ] = set visible columns; turn on "auto" mode. true = turn on "auto" mode. */ .on('refreshColumnSelector' + namespace, function( e, optName, optState ) { // make sure we're using current config settings tsColSel.refreshColumns( this.config, optName, optState ); }); if (debug) { console.log('ColumnSelector >> Widget initialized'); } }, refreshColumns: function( c, optName, optState ) { var i, arry, $el, val, colSel = c.selector, isArry = $.isArray(optState || optName), wo = c.widgetOptions; // see #798 if (typeof optName !== 'undefined' && optName !== null && colSel.$container.length) { // pass "selectors" to update the all of the container contents if ( optName === 'selectors' ) { colSel.$container.empty(); tsColSel.setupSelector(c, wo); tsColSel.setupBreakpoints(c, wo); // if optState is undefined, maintain the current "auto" state if ( typeof optState === 'undefined' && optState !== null ) { optState = colSel.auto; } } // pass an array of column zero-based indexes to turn off auto mode & toggle selected columns if (isArry) { arry = optState || optName; // make sure array contains numbers $.each(arry, function(i, v) { arry[i] = parseInt(v, 10); }); for (i = 0; i < c.columns; i++) { val = $.inArray( i, arry ) >= 0; $el = colSel.$container.find( 'input[data-column=' + i + ']' ); if ( $el.length ) { $el.prop( 'checked', val ); colSel.states[i] = val; } } } // if passing an array, set auto to false to allow manual column selection & update columns // refreshColumns( c, 'auto', true ) === refreshColumns( c, true ); val = optState === true || optName === true || optName === 'auto' && optState !== false; $el = colSel.$container.find( 'input[data-column="auto"]' ).prop( 'checked', val ); tsColSel.updateAuto( c, wo, $el ); } else { tsColSel.updateBreakpoints(c, wo); tsColSel.updateCols(c, wo); } tsColSel.saveValues( c, wo ); tsColSel.adjustColspans( c, wo ); }, setupSelector: function(c, wo) { var index, name, $header, priority, col, colId, $el, colSel = c.selector, $container = colSel.$container, useStorage = wo.columnSelector_saveColumns && ts.storage, // get stored column states saved = useStorage ? ts.storage( c.table, 'tablesorter-columnSelector' ) : [], state = useStorage ? ts.storage( c.table, 'tablesorter-columnSelector-auto') : {}; // initial states colSel.auto = $.isEmptyObject(state) || $.type(state.auto) !== 'boolean' ? wo.columnSelector_mediaqueryState : state.auto; colSel.states = []; colSel.$column = []; colSel.$wrapper = []; colSel.$checkbox = []; // populate the selector container for ( index = 0; index < c.columns; index++ ) { $header = c.$headerIndexed[ index ]; // if no data-priority is assigned, default to 1, but don't remove it from the selector list priority = $header.attr(wo.columnSelector_priority) || 1; colId = $header.attr('data-column'); col = ts.getColumnData( c.table, c.headers, colId ); state = ts.getData( $header, col, 'columnSelector'); // if this column not hidable at all // include getData check (includes 'columnSelector-false' class, data attribute, etc) if ( isNaN(priority) && priority.length > 0 || state === 'disable' || ( wo.columnSelector_columns[colId] && wo.columnSelector_columns[colId] === 'disable') ) { colSel.states[colId] = null; continue; // goto next } // set default state; storage takes priority colSel.states[colId] = saved && (typeof saved[colId] !== 'undefined' && saved[colId] !== null) ? saved[colId] : (typeof wo.columnSelector_columns[colId] !== 'undefined' && wo.columnSelector_columns[colId] !== null) ? wo.columnSelector_columns[colId] : (state === 'true' || state !== 'false'); colSel.$column[colId] = $(this); if ($container.length) { // set default col title name = $header.attr(wo.columnSelector_name) || $header.text().trim(); if (typeof wo.columnSelector_layoutCustomizer === 'function') { $el = $header.find('.' + ts.css.headerIn); name = wo.columnSelector_layoutCustomizer( $el.length ? $el : $header, name, parseInt(colId, 10) ); } colSel.$wrapper[colId] = $(wo.columnSelector_layout.replace(/\{name\}/g, name)).appendTo($container); colSel.$checkbox[colId] = colSel.$wrapper[colId] // input may not be wrapped within the layout template .find('input').add( colSel.$wrapper[colId].filter('input') ) .attr('data-column', colId) .toggleClass( wo.columnSelector_cssChecked, colSel.states[colId] ) .prop('checked', colSel.states[colId]) .on('change', function() { if (!colSel.isInitializing) { // ensure states is accurate var colId = $(this).attr('data-column'); if (tsColSel.checkChange(c, this.checked)) { // if (wo.columnSelector_maxVisible) c.selector.states[colId] = this.checked; tsColSel.updateCols(c, wo); } else { this.checked = !this.checked; return false; } } }).change(); } } }, checkChange: function(c, checked) { var wo = c.widgetOptions, max = wo.columnSelector_maxVisible, min = wo.columnSelector_minVisible, states = c.selector.states, indx = states.length, count = 0; while (indx-- >= 0) { if (states[indx]) { count++; } } if ((checked & max !== null && count >= max) || (!checked && min !== null && count <= min)) { return false; } return true; }, setupBreakpoints: function(c, wo) { var colSel = c.selector; // add responsive breakpoints if (wo.columnSelector_mediaquery) { // used by window resize function colSel.lastIndex = -1; tsColSel.updateBreakpoints(c, wo); c.$table .off('updateAll' + namespace) .on('updateAll' + namespace, function() { tsColSel.setupSelector(c, wo); tsColSel.setupBreakpoints(c, wo); tsColSel.updateBreakpoints(c, wo); tsColSel.updateCols(c, wo); }); } if (colSel.$container.length) { // Add media queries toggle if (wo.columnSelector_mediaquery) { colSel.$auto = $( wo.columnSelector_layout.replace(/\{name\}/g, wo.columnSelector_mediaqueryName) ).prependTo(colSel.$container); colSel.$auto // needed in case the input in the layout is not wrapped .find('input').add( colSel.$auto.filter('input') ) .attr('data-column', 'auto') .prop('checked', colSel.auto) .toggleClass( wo.columnSelector_cssChecked, colSel.auto ) .on('change', function() { tsColSel.updateAuto(c, wo, $(this)); }).change(); } // Add a bind on update to re-run col setup c.$table.off('update' + namespace).on('update' + namespace, function() { tsColSel.updateCols(c, wo); }); } }, updateAuto: function(c, wo, $el) { var colSel = c.selector; colSel.auto = $el.prop('checked') || false; $.each( colSel.$checkbox, function(i, $cb) { if ($cb) { $cb[0].disabled = colSel.auto; colSel.$wrapper[i].toggleClass('disabled', colSel.auto); } }); if (wo.columnSelector_mediaquery) { tsColSel.updateBreakpoints(c, wo); } tsColSel.updateCols(c, wo); // copy the column selector to a popup/tooltip if (c.selector.$popup) { c.selector.$popup.find('.tablesorter-column-selector') .html( colSel.$container.html() ) .find('input').each(function() { var indx = $(this).attr('data-column'); $(this).prop( 'checked', indx === 'auto' ? colSel.auto : colSel.states[indx] ); }); } tsColSel.saveValues( c, wo ); tsColSel.adjustColspans( c, wo ); // trigger columnUpdate if auto is true (it gets skipped in updateCols() if (colSel.auto) { c.$table.triggerHandler(wo.columnSelector_updated); } }, addSelectors: function( wo, prefix, column ) { var array = [], temp = ' col:nth-child(' + column + ')'; array.push(prefix + temp + ',' + prefix + '_extra_table' + temp); temp = ' tr:not(.' + wo.columnSelector_classHasSpan + ') th[data-column="' + ( column - 1 ) + '"]'; array.push(prefix + temp + ',' + prefix + '_extra_table' + temp); temp = ' tr:not(.' + wo.columnSelector_classHasSpan + ') td:nth-child(' + column + ')'; array.push(prefix + temp + ',' + prefix + '_extra_table' + temp); // for other cells in colspan columns temp = ' tr td:not(' + prefix + wo.columnSelector_classHasSpan + ')[data-column="' + (column - 1) + '"]'; array.push(prefix + temp + ',' + prefix + '_extra_table' + temp); return array; }, updateBreakpoints: function(c, wo) { var priority, col, column, breaks, isHidden = [], colSel = c.selector, prefix = c.namespace + 'columnselector', mediaAll = [], breakpts = ''; if (wo.columnSelector_mediaquery && !colSel.auto) { colSel.$breakpoints.prop('disabled', true); colSel.$style.prop('disabled', false); return; } if (wo.columnSelector_mediaqueryHidden) { // add columns to be hidden; even when "auto" is set - see #964 for ( column = 0; column < c.columns; column++ ) { col = ts.getColumnData( c.table, c.headers, column ); isHidden[ column + 1 ] = ts.getData( c.$headerIndexed[ column ], col, 'columnSelector' ) === 'false'; if ( isHidden[ column + 1 ] ) { // hide columnSelector false column (in auto mode) mediaAll = mediaAll.concat( tsColSel.addSelectors( wo, prefix, column + 1 ) ); } } } // only 6 breakpoints (same as jQuery Mobile) for (priority = 0; priority < wo.columnSelector_maxPriorities; priority++) { /*jshint loopfunc:true */ breaks = []; c.$headers.filter('[' + wo.columnSelector_priority + '=' + (priority + 1) + ']').each(function() { column = parseInt($(this).attr('data-column'), 10) + 1; // don't reveal columnSelector false columns if ( !isHidden[ column ] ) { breaks = breaks.concat( tsColSel.addSelectors( wo, prefix, column ) ); } }); if (breaks.length) { mediaAll = mediaAll.concat( breaks ); breakpts += tsColSel.queryBreak .replace(/\[size\]/g, wo.columnSelector_breakpoints[priority]) .replace(/\[columns\]/g, breaks.join(',')); } } if (colSel.$style) { colSel.$style.prop('disabled', true); } if (mediaAll.length) { colSel.$breakpoints .prop('disabled', false) .text( tsColSel.queryAll.replace(/\[columns\]/g, mediaAll.join(',')) + breakpts ); } }, updateCols: function(c, wo) { if (wo.columnSelector_mediaquery && c.selector.auto || c.selector.isInitializing) { return; } var column, colSel = c.selector, styles = [], prefix = c.namespace + 'columnselector'; colSel.$container.find('input[data-column]').filter('[data-column!="auto"]').each(function() { if (!this.checked) { column = parseInt( $(this).attr('data-column'), 10 ) + 1; styles = styles.concat( tsColSel.addSelectors( wo, prefix, column ) ); } $(this).toggleClass( wo.columnSelector_cssChecked, this.checked ); }); if (wo.columnSelector_mediaquery) { colSel.$breakpoints.prop('disabled', true); } if (colSel.$style) { colSel.$style.prop('disabled', false).text( styles.length ? styles.join(',') + ' { display: none; }' : '' ); } tsColSel.saveValues( c, wo ); tsColSel.adjustColspans( c, wo ); c.$table.triggerHandler(wo.columnSelector_updated); }, setUpColspan: function(c, wo) { var index, span, nspace, $window = $( window ), hasSpans = false, $cells = c.$table .add( $(c.namespace + '_extra_table') ) .children() .children('tr') .children('th, td'), len = $cells.length; for ( index = 0; index < len; index++ ) { span = $cells[ index ].colSpan; if ( span > 1 ) { hasSpans = true; $cells.eq( index ) .addClass( c.namespace.slice( 1 ) + 'columnselector' + wo.columnSelector_classHasSpan ) .attr( 'data-col-span', span ); // add data-column values ts.computeColumnIndex( $cells.eq( index ).parent().addClass( wo.columnSelector_classHasSpan ) ); } } // only add resize end if using media queries if ( hasSpans && wo.columnSelector_mediaquery ) { nspace = c.namespace + 'columnselector'; // Setup window.resizeEnd event $window .off( nspace ) .on( 'resize' + nspace, ts.window_resize ) .on( 'resizeEnd' + nspace, function() { // IE calls resize when you modify content, so we have to unbind the resize event // so we don't end up with an infinite loop. we can rebind after we're done. $window.off( 'resize' + nspace, ts.window_resize ); tsColSel.adjustColspans( c, wo ); $window.on( 'resize' + nspace, ts.window_resize ); }); } }, // Extracted from buildHeaders in core; needed for scroller widget compatibility findHeaders : function(c) { var indx, $temp, sel = '.' + ts.css.scrollerHeader + ' thead > tr > ', $headers = $(sel + 'th,' + sel + 'td'), result = []; for ( indx = 0; indx < c.columns; indx++ ) { // Use $headers.parent() in case selectorHeaders doesn't point to the th/td $temp = $headers.filter( '[data-column="' + indx + '"]' ); // target sortable column cells, unless there are none, then use non-sortable cells // .last() added in jQuery 1.4; use .filter(':last') to maintain compatibility with jQuery v1.2.6 result[ indx ] = $temp.length ? $temp.not( '.sorter-false' ).length ? $temp.not( '.sorter-false' ).filter( ':last' ) : $temp.filter( ':last' ) : $(); } return result; }, adjustColspans: function(c, wo) { var index, cols, col, span, end, $cell, colSel = c.selector, filtered = wo.filter_filteredRow || 'filtered', autoModeOn = wo.columnSelector_mediaquery && colSel.auto, // find all header/footer cells in case a regular column follows a colspan; see #1238 $headers = c.$table.children( 'thead, tfoot' ).children().children() .add( $(c.namespace + '_extra_table').children( 'thead, tfoot' ).children().children() ) // include grouping widget headers (they have colspans!) .add( c.$table.find( '.group-header' ).children() ), len = $headers.length, $headerIndexed = ts.hasWidget(c.table, 'scroller') ? tsColSel.findHeaders(c) : c.$headerIndexed; for ( index = 0; index < len; index++ ) { $cell = $headers.eq(index); col = parseInt( $cell.attr('data-column'), 10 ) || $cell[0].cellIndex; span = parseInt( $cell.attr('data-col-span'), 10 ) || 1; end = col + span; if ( span > 1 ) { for ( cols = col; cols < end; cols++ ) { if ( !autoModeOn && colSel.states[ cols ] === false || autoModeOn && $headerIndexed[ cols ] && !$headerIndexed[ cols ].is(':visible') ) { span--; } } if ( span ) { $cell.removeClass( filtered )[0].colSpan = span; } else { $cell.addClass( filtered ); } } else if ( typeof colSel.states[ col ] !== 'undefined' && colSel.states[ col ] !== null ) { $cell.toggleClass( filtered, !autoModeOn && !colSel.states[ col ] ); } } }, saveValues : function( c, wo ) { if ( wo.columnSelector_saveColumns && ts.storage ) { var colSel = c.selector; ts.storage( c.$table[0], 'tablesorter-columnSelector-auto', { auto : colSel.auto } ); ts.storage( c.$table[0], 'tablesorter-columnSelector', colSel.states ); } }, attachTo : function(table, elm) { table = $(table)[0]; var colSel, wo, indx, c = table.config, $popup = $(elm); if ($popup.length && c) { if (!$popup.find('.tablesorter-column-selector').length) { // add a wrapper to add the selector into, in case the popup has other content $popup.append('<span class="tablesorter-column-selector"></span>'); } colSel = c.selector; wo = c.widgetOptions; $popup.find('.tablesorter-column-selector') .html( colSel.$container.html() ) .find('input').each(function() { var indx = $(this).attr('data-column'), isChecked = indx === 'auto' ? colSel.auto : colSel.states[indx]; $(this) .toggleClass( wo.columnSelector_cssChecked, isChecked ) .prop( 'checked', isChecked ); }); colSel.$popup = $popup.on('change', 'input', function() { if (!colSel.isInitializing) { if (tsColSel.checkChange(c, this.checked)) { // data input indx = $(this).toggleClass( wo.columnSelector_cssChecked, this.checked ).attr('data-column'); // update original popup colSel.$container.find('input[data-column="' + indx + '"]') .prop('checked', this.checked) .trigger('change'); } else { this.checked = !this.checked; return false; } } }); } } }; /* Add window resizeEnd event (also used by scroller widget) */ ts.window_resize = function() { if ( ts.timer_resize ) { clearTimeout( ts.timer_resize ); } ts.timer_resize = setTimeout( function() { $( window ).trigger( 'resizeEnd' ); }, 250 ); }; ts.addWidget({ id: 'columnSelector', priority: 10, options: { // target the column selector markup columnSelector_container : null, // column status, true = display, false = hide // disable = do not display on list columnSelector_columns : {}, // remember selected columns columnSelector_saveColumns: true, // container layout columnSelector_layout : '<label><input type="checkbox">{name}</label>', // layout customizer callback called for each column // function($cell, name, column) { return name || $cell.html(); } columnSelector_layoutCustomizer : null, // data attribute containing column name to use in the selector container columnSelector_name : 'data-selector-name', /* Responsive Media Query settings */ // enable/disable mediaquery breakpoints columnSelector_mediaquery : true, // toggle checkbox name columnSelector_mediaqueryName : 'Auto: ', // breakpoints checkbox initial setting columnSelector_mediaqueryState : true, // hide columnSelector false columns while in auto mode columnSelector_mediaqueryHidden : false, // set the maximum and/or minimum number of visible columns columnSelector_maxVisible : null, columnSelector_minVisible : null, // responsive table hides columns with priority 1-6 at these breakpoints // see http://view.jquerymobile.com/1.3.2/dist/demos/widgets/table-column-toggle/#Applyingapresetbreakpoint // *** set to false to disable *** columnSelector_breakpoints : [ '20em', '30em', '40em', '50em', '60em', '70em' ], // maximum number of priority settings; if this value is changed (especially increased), // then make sure to modify the columnSelector_breakpoints - see #1204 columnSelector_maxPriorities : 6, // data attribute containing column priority // duplicates how jQuery mobile uses priorities: // http://view.jquerymobile.com/1.3.2/dist/demos/widgets/table-column-toggle/ columnSelector_priority : 'data-priority', // class name added to checked checkboxes - this fixes an issue with Chrome not updating FontAwesome // applied icons; use this class name (input.checked) instead of input:checked columnSelector_cssChecked : 'checked', // class name added to rows that have a span (e.g. grouping widget & other rows inside the tbody) columnSelector_classHasSpan : 'hasSpan', // event triggered when columnSelector completes columnSelector_updated : 'columnUpdate' }, init: function(table, thisWidget, c, wo) { tsColSel.init(table, c, wo); }, remove: function(table, c, wo, refreshing) { var csel = c.selector; if ( refreshing || !csel ) { return; } if ( csel ) { csel.$container.empty(); } if ( csel.$popup ) { csel.$popup.empty(); } csel.$style.remove(); csel.$breakpoints.remove(); $( c.namespace + 'columnselector' + wo.columnSelector_classHasSpan ) .removeClass( wo.filter_filteredRow || 'filtered' ); c.$table.find('[data-col-span]').each(function(indx, el) { var $el = $(el); $el.attr('colspan', $el.attr('data-col-span')); }); c.$table.off('updateAll' + namespace + ' update' + namespace); } }); })(jQuery);
var UserForm = { init: function(options) { var ops = $.extend(true, this.getDefaultOptions(), options); Validation.init(ops); }, getDefaultOptions: function() { return { src: '.form', isAjax: false, submitAjax: function(validation) { // }, validate: { rules: { first_name: { required: true }, last_name: { required: true }, email: { required: true, email: true }, password: { minlength: 6 }, password_confirmation: { minlength: 6, equalTo: "#password" } }, messages: messagesOfRules } } } };
/* * * Copyright (c) 2012-2014 Adobe Systems Incorporated. All rights reserved. * Permission is hereby granted, free of charge, to any person obtaining a * copy of this software and associated documentation files (the "Software"), * to deal in the Software without restriction, including without limitation * the rights to use, copy, modify, merge, publish, distribute, sublicense, * and/or sell copies of the Software, and to permit persons to whom the * Software is furnished to do so, subject to the following conditions: * * The above copyright notice and this permission notice shall be included in * all copies or substantial portions of the Software. * * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER * DEALINGS IN THE SOFTWARE. * */ (function($) { "use strict"; var endpointGenerator = function(webappName) { return "/api/v2/admin/sites/current/webapps/" + webappName + "/fields"; } /** * This class provides support for custom fields description belonging to {@link BCAPI.Models.WebApp.App} * * ## Create a new custom field * * ```javascript * var customField = new BCAPI.Models.WebApp.CustomField("Test webapp", { * "id": 1, * "name": "Part code", * "type": "DataSource", * "listItems": null, * "dataSource": "Part Codes", * "required": false * }, true); * * customField.save({ * success: function(fieldModel) { * // do something on success. * } * }); * ``` * * In the attributes, the id must be passed. * * The last parameter specifies if the custom field is new or exists already. This is used * to determine the correct HTTP verb to call since the id is always passed. * If omitted, it is assumed that the custom field is new. * * @name CustomField * @class * @constructor * @memberOf BCAPI.Models.WebApp */ BCAPI.Models.WebApp.CustomField = BCAPI.Models.Model.extend({ constructor: function(webappName, attributes, isNew, options) { BCAPI.Models.Model.call(this, attributes, options); this._isNew = _.isBoolean(isNew) ? isNew : true; if(this._isNew && (_.isUndefined(attributes) || _.isUndefined(attributes["id"]))) { throw new Error("The id for the custom field must be specified."); } var id = Number(attributes["id"]); if(!_.isNumber(id) || _.isNaN(id) || id <= 0) { throw new Error("The id for the custom field must be a positive number."); } this._webappName = webappName; this.set({webapp: new BCAPI.Models.WebApp.App({name: webappName})}); }, /** * This method returns the endpoint for custom fields api. * * @method * @instance * @memberOf BCAPI.Models.WebApp.CustomField */ endpoint: function() { return endpointGenerator(this._webappName); }, /** * This method is overriden in order to remove *webapp* field from API request. * Webapp it's a pseudo attribute used internally by an item collection. * * @method * @instance * @memberOf BCAPI.Models.WebApp.CustomField */ toJSON: function(options) { var result = BCAPI.Models.Model.prototype.toJSON.call(this, options); delete result["webapp"]; return result; }, /** * This method is overriden in order to use the correct HTTP verb on creation and update * since the id of the item is always passed. */ isNew: function() { return this._isNew; } }); /** * This class provides a collection for working with web app custom fields. In order to use this collection you must provide * a webapp name. For more information regarding custom fields read {@link BCAPI.Models.WebApp.Item}. * * @name CustomFieldCollection * @class * @constructor * @memberOf BCAPI.Models.WebApp * @example * var fieldsCollection = new BCAPI.Models.WebApp.CustomFieldCollection("Sample webapp"); */ BCAPI.Models.WebApp.CustomFieldCollection = BCAPI.Models.Collection.extend({ constructor: function(webappName, attributes, options) { BCAPI.Models.Collection.call(this, attributes, options); this._webappName = webappName; }, model: BCAPI.Models.WebApp.CustomField, /** * This method is overriden because we need access to members in order to create the endpoint. * * @method * @instance * @memberOf BCAPI.Models.WebApp.CustomField * @returns {string} An absolute entry point API. */ urlRoot: function() { return this.model.prototype.urlRoot(endpointGenerator(this._webappName)); }, /** * We override this method in order to transform each returned item into a strong typed * {@link BCAPI.Models.WebApp.CustomField} models. * * @method * @instance * @param {Object} response The JSON response received from CustomField api. * @returns A list of web app custom fields. * @memberOf BCAPI.Models.WebApp.CustomField */ parse: function(response) { response = BCAPI.Models.Collection.prototype.parse.call(this, response); var fields = [], self = this; _.each(response, function(field) { fields.push(new self.model(self._webappName, field, false)); }); return fields; } }); })(jQuery);
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); var index_1 = require("../index"); /** * If entity is a child table of some table, it should have a discriminator value. * This decorator sets custom discriminator value for the entity. */ function DiscriminatorValue(value) { return function (target) { var args = { target: target, value: value }; index_1.getMetadataArgsStorage().discriminatorValues.push(args); }; } exports.DiscriminatorValue = DiscriminatorValue; //# sourceMappingURL=DiscriminatorValue.js.map
// Our custom component is managing whether the Modal is visible var CustomModalTrigger = React.createClass({ mixins: [OverlayMixin], getInitialState: function () { return { isModalOpen: false }; }, handleToggle: function () { this.setState({ isModalOpen: !this.state.isModalOpen }); }, render: function () { return ( <Button onClick={this.handleToggle} bsStyle="primary">Launch</Button> ); }, // This is called by the `OverlayMixin` when this component // is mounted or updated and the return value is appended to the body. renderOverlay: function () { if (!this.state.isModalOpen) { return <span/>; } return ( <Modal bsStyle="primary" title="Modal heading" onRequestHide={this.handleToggle}> <div className="modal-body"> This modal is controlled by our custom trigger component. </div> <div className="modal-footer"> <Button onClick={this.handleToggle}>Close</Button> </div> </Modal> ); } }); React.render(<CustomModalTrigger />, mountNode);
/** * Created by lundfall on 9/28/16. */ var _ = require('lodash'); exports.onHandleAST = function (ev) { /*var mockedData = { type: 'ExportNamedDeclaration', start: 0, end: 10, loc: {start: {line: 24, column: 0}, end: {line: 24, column: 0}}, specifiers: [], source: null, declaration: { type: 'FunctionDeclaration', start: 530, end: 555, id: { type: 'Identifier', start: 543, end: 548, loc: {start: {line: 24, column: 0}, end: {line: 24, column: 0}, identifierName: 'injectedFunction'}, name: 'injectedFunction', leadingComments: null }, generator: false, expression: false, async: false, params: [], body: { type: 'BlockStatement', start: 551, end: 555, loc: [{start: {line: 24, column: 0}, end: {line: 24, column: 0}}], body: [], directives: [], leadingComments: null, trailingComments: null }, leadingComments: null, trailingComments: null }, leadingComments: [{ type: 'CommentBlock', value: ` /!** * This is an injected function * @param {String} a * @param b * @param c * @return {String} something *!/`, start: 0, end: 10, loc: {start: {line: 24, column: 0}, end: {line: 24, column: 0}} }], trailingComments: null };*/ var pushedFns = []; ev.data.ast.program.body.forEach((item, index) => { if(item.declaration === null){ item.declaration = undefined; } /* Extracts documented inner properties in objects and fakes them at the end of the file */ try { if (item && item.type === 'ExportNamedDeclaration' && item.declaration && item.declaration.type === 'VariableDeclaration' && item.declaration.declarations && item.declaration.declarations.length) { var propertyName = item.declaration.declarations[0].id.name; item.declaration.declarations.forEach(function searchForObjectExpression(declaration) { var leadingCommentsInsertion = []; if (declaration.init && declaration.init.type === 'ObjectExpression' && declaration.init.properties) { (function searchForFunctionExpression(properties, propertyName) { properties.forEach((property) => { if (property.value && property.value.type === 'ObjectExpression') { searchForFunctionExpression(property.value.properties,propertyName + "." + property.key.name); } if (property.leadingComments && property.value && property.value.type === 'FunctionExpression') { var injectedProperty = _.clone(property); injectedProperty.type = 'ExportNamedDeclaration'; delete injectedProperty.method; delete injectedProperty.shorthand; delete injectedProperty.computed; injectedProperty.specifiers = []; injectedProperty.source = null; injectedProperty.trailingComments = null; injectedProperty.declaration = _.clone(injectedProperty.value); if (!injectedProperty.declaration.id) { injectedProperty.declaration.id = _.clone(injectedProperty.key); injectedProperty.declaration.id.leadingComments = null; } injectedProperty.declaration.id.name = propertyName + '.' + injectedProperty.declaration.id.name; injectedProperty.declaration.type = 'FunctionDeclaration'; injectedProperty.declaration.body.body = []; delete injectedProperty.value; delete injectedProperty.key; pushedFns.push(injectedProperty); leadingCommentsInsertion = leadingCommentsInsertion.concat(property.leadingComments); } }); })(declaration.init.properties, propertyName); } }); } }catch(e){ console.log("Exception", e); } }); ev.data.ast.program.body = ev.data.ast.program.body.concat(pushedFns); return ev; } ; exports.onHandleHTML = function (ev) { /* Remove all statements that go import {layout.size} from 'arva-js/layout.Decorators.js', etc*/ ev.data.html = ev.data.html.replace(/(.*?import\s+\{.*?\..*?\}.*)/g, ''); /* Remove the 'src/' in all statements that go import {layout} from 'arva-js/src/layout.Decorators.js', etc*/ ev.data.html = ev.data.html.replace(/(.*?import\s+\{.*?\}\s+from.*arva-js\/)src\//g, '$1'); var headIndex = ev.data.html.indexOf('<head>'); if(~headIndex){ ev.data.html = ev.data.html.slice(0, headIndex) + `<link href='http://fonts.googleapis.com/css?family=Lato:400,700' rel='stylesheet' type='text/css'>` + ev.data.html.slice(headIndex); } };
// In IE stylesheets that are added via innerHTML are not applied // fix is to reset their 'href' attributes after they're inserted into DOM // We need to do it just in IE (that's why `link.sizes` check) as in other browsers // it may produce flash of unstyled content 'use strict'; var isParentNode = require('dom-ext/parent-node/is') , isStyleSheet = require('html-dom-ext/link/is-style-sheet') , forEach = Array.prototype.forEach; var fixLink = function (link) { if (!isStyleSheet(link)) return; if (!link.hasAttribute('href')) return; if (!link.sizes) link.setAttribute('href', link.getAttribute('href')); }; module.exports = function self(node) { if (isStyleSheet(node)) { fixLink(node); return; } if (!isParentNode(node)) return; if (node.getElementsByTagName) { forEach.call(node.getElementsByTagName('link'), fixLink); return; } forEach.call(node.childNodes, self); };
/*! @license Firebase v4.4.0 Build: rev-380121f Terms: https://firebase.google.com/terms/ */ 'use strict'; Object.defineProperty(exports, "__esModule", { value: true }); exports.WriteTreeRef = exports.WriteTree = undefined; var _obj = require('../../utils/obj'); var _assert = require('../../utils/assert'); var _Path = require('./util/Path'); var _CompoundWrite = require('./CompoundWrite'); var _PriorityIndex = require('./snap/indexes/PriorityIndex'); var _ChildrenNode = require('./snap/ChildrenNode'); /** * WriteTree tracks all pending user-initiated writes and has methods to calculate the result of merging them * with underlying server data (to create "event cache" data). Pending writes are added with addOverwrite() * and addMerge(), and removed with removeWrite(). * * @constructor */ /** * Copyright 2017 Google Inc. * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. */ var WriteTree = /** @class */function () { function WriteTree() { /** * A tree tracking the result of applying all visible writes. This does not include transactions with * applyLocally=false or writes that are completely shadowed by other writes. * * @type {!CompoundWrite} * @private */ this.visibleWrites_ = _CompoundWrite.CompoundWrite.Empty; /** * A list of all pending writes, regardless of visibility and shadowed-ness. Used to calculate arbitrary * sets of the changed data, such as hidden writes (from transactions) or changes with certain writes excluded (also * used by transactions). * * @type {!Array.<!WriteRecord>} * @private */ this.allWrites_ = []; this.lastWriteId_ = -1; } /** * Create a new WriteTreeRef for the given path. For use with a new sync point at the given path. * * @param {!Path} path * @return {!WriteTreeRef} */ WriteTree.prototype.childWrites = function (path) { return new WriteTreeRef(path, this); }; /** * Record a new overwrite from user code. * * @param {!Path} path * @param {!Node} snap * @param {!number} writeId * @param {boolean=} visible This is set to false by some transactions. It should be excluded from event caches */ WriteTree.prototype.addOverwrite = function (path, snap, writeId, visible) { (0, _assert.assert)(writeId > this.lastWriteId_, 'Stacking an older write on top of newer ones'); if (visible === undefined) { visible = true; } this.allWrites_.push({ path: path, snap: snap, writeId: writeId, visible: visible }); if (visible) { this.visibleWrites_ = this.visibleWrites_.addWrite(path, snap); } this.lastWriteId_ = writeId; }; /** * Record a new merge from user code. * * @param {!Path} path * @param {!Object.<string, !Node>} changedChildren * @param {!number} writeId */ WriteTree.prototype.addMerge = function (path, changedChildren, writeId) { (0, _assert.assert)(writeId > this.lastWriteId_, 'Stacking an older merge on top of newer ones'); this.allWrites_.push({ path: path, children: changedChildren, writeId: writeId, visible: true }); this.visibleWrites_ = this.visibleWrites_.addWrites(path, changedChildren); this.lastWriteId_ = writeId; }; /** * @param {!number} writeId * @return {?WriteRecord} */ WriteTree.prototype.getWrite = function (writeId) { for (var i = 0; i < this.allWrites_.length; i++) { var record = this.allWrites_[i]; if (record.writeId === writeId) { return record; } } return null; }; /** * Remove a write (either an overwrite or merge) that has been successfully acknowledge by the server. Recalculates * the tree if necessary. We return true if it may have been visible, meaning views need to reevaluate. * * @param {!number} writeId * @return {boolean} true if the write may have been visible (meaning we'll need to reevaluate / raise * events as a result). */ WriteTree.prototype.removeWrite = function (writeId) { // Note: disabling this check. It could be a transaction that preempted another transaction, and thus was applied // out of order. //const validClear = revert || this.allWrites_.length === 0 || writeId <= this.allWrites_[0].writeId; //assert(validClear, "Either we don't have this write, or it's the first one in the queue"); var _this = this; var idx = this.allWrites_.findIndex(function (s) { return s.writeId === writeId; }); (0, _assert.assert)(idx >= 0, 'removeWrite called with nonexistent writeId.'); var writeToRemove = this.allWrites_[idx]; this.allWrites_.splice(idx, 1); var removedWriteWasVisible = writeToRemove.visible; var removedWriteOverlapsWithOtherWrites = false; var i = this.allWrites_.length - 1; while (removedWriteWasVisible && i >= 0) { var currentWrite = this.allWrites_[i]; if (currentWrite.visible) { if (i >= idx && this.recordContainsPath_(currentWrite, writeToRemove.path)) { // The removed write was completely shadowed by a subsequent write. removedWriteWasVisible = false; } else if (writeToRemove.path.contains(currentWrite.path)) { // Either we're covering some writes or they're covering part of us (depending on which came first). removedWriteOverlapsWithOtherWrites = true; } } i--; } if (!removedWriteWasVisible) { return false; } else if (removedWriteOverlapsWithOtherWrites) { // There's some shadowing going on. Just rebuild the visible writes from scratch. this.resetTree_(); return true; } else { // There's no shadowing. We can safely just remove the write(s) from visibleWrites. if (writeToRemove.snap) { this.visibleWrites_ = this.visibleWrites_.removeWrite(writeToRemove.path); } else { var children = writeToRemove.children; (0, _obj.forEach)(children, function (childName) { _this.visibleWrites_ = _this.visibleWrites_.removeWrite(writeToRemove.path.child(childName)); }); } return true; } }; /** * Return a complete snapshot for the given path if there's visible write data at that path, else null. * No server data is considered. * * @param {!Path} path * @return {?Node} */ WriteTree.prototype.getCompleteWriteData = function (path) { return this.visibleWrites_.getCompleteNode(path); }; /** * Given optional, underlying server data, and an optional set of constraints (exclude some sets, include hidden * writes), attempt to calculate a complete snapshot for the given path * * @param {!Path} treePath * @param {?Node} completeServerCache * @param {Array.<number>=} writeIdsToExclude An optional set to be excluded * @param {boolean=} includeHiddenWrites Defaults to false, whether or not to layer on writes with visible set to false * @return {?Node} */ WriteTree.prototype.calcCompleteEventCache = function (treePath, completeServerCache, writeIdsToExclude, includeHiddenWrites) { if (!writeIdsToExclude && !includeHiddenWrites) { var shadowingNode = this.visibleWrites_.getCompleteNode(treePath); if (shadowingNode != null) { return shadowingNode; } else { var subMerge = this.visibleWrites_.childCompoundWrite(treePath); if (subMerge.isEmpty()) { return completeServerCache; } else if (completeServerCache == null && !subMerge.hasCompleteWrite(_Path.Path.Empty)) { // We wouldn't have a complete snapshot, since there's no underlying data and no complete shadow return null; } else { var layeredCache = completeServerCache || _ChildrenNode.ChildrenNode.EMPTY_NODE; return subMerge.apply(layeredCache); } } } else { var merge = this.visibleWrites_.childCompoundWrite(treePath); if (!includeHiddenWrites && merge.isEmpty()) { return completeServerCache; } else { // If the server cache is null, and we don't have a complete cache, we need to return null if (!includeHiddenWrites && completeServerCache == null && !merge.hasCompleteWrite(_Path.Path.Empty)) { return null; } else { var filter = function filter(write) { return (write.visible || includeHiddenWrites) && (!writeIdsToExclude || !~writeIdsToExclude.indexOf(write.writeId)) && (write.path.contains(treePath) || treePath.contains(write.path)); }; var mergeAtPath = WriteTree.layerTree_(this.allWrites_, filter, treePath); var layeredCache = completeServerCache || _ChildrenNode.ChildrenNode.EMPTY_NODE; return mergeAtPath.apply(layeredCache); } } } }; /** * With optional, underlying server data, attempt to return a children node of children that we have complete data for. * Used when creating new views, to pre-fill their complete event children snapshot. * * @param {!Path} treePath * @param {?ChildrenNode} completeServerChildren * @return {!ChildrenNode} */ WriteTree.prototype.calcCompleteEventChildren = function (treePath, completeServerChildren) { var completeChildren = _ChildrenNode.ChildrenNode.EMPTY_NODE; var topLevelSet = this.visibleWrites_.getCompleteNode(treePath); if (topLevelSet) { if (!topLevelSet.isLeafNode()) { // we're shadowing everything. Return the children. topLevelSet.forEachChild(_PriorityIndex.PRIORITY_INDEX, function (childName, childSnap) { completeChildren = completeChildren.updateImmediateChild(childName, childSnap); }); } return completeChildren; } else if (completeServerChildren) { // Layer any children we have on top of this // We know we don't have a top-level set, so just enumerate existing children var merge_1 = this.visibleWrites_.childCompoundWrite(treePath); completeServerChildren.forEachChild(_PriorityIndex.PRIORITY_INDEX, function (childName, childNode) { var node = merge_1.childCompoundWrite(new _Path.Path(childName)).apply(childNode); completeChildren = completeChildren.updateImmediateChild(childName, node); }); // Add any complete children we have from the set merge_1.getCompleteChildren().forEach(function (namedNode) { completeChildren = completeChildren.updateImmediateChild(namedNode.name, namedNode.node); }); return completeChildren; } else { // We don't have anything to layer on top of. Layer on any children we have // Note that we can return an empty snap if we have a defined delete var merge = this.visibleWrites_.childCompoundWrite(treePath); merge.getCompleteChildren().forEach(function (namedNode) { completeChildren = completeChildren.updateImmediateChild(namedNode.name, namedNode.node); }); return completeChildren; } }; /** * Given that the underlying server data has updated, determine what, if anything, needs to be * applied to the event cache. * * Possibilities: * * 1. No writes are shadowing. Events should be raised, the snap to be applied comes from the server data * * 2. Some write is completely shadowing. No events to be raised * * 3. Is partially shadowed. Events * * Either existingEventSnap or existingServerSnap must exist * * @param {!Path} treePath * @param {!Path} childPath * @param {?Node} existingEventSnap * @param {?Node} existingServerSnap * @return {?Node} */ WriteTree.prototype.calcEventCacheAfterServerOverwrite = function (treePath, childPath, existingEventSnap, existingServerSnap) { (0, _assert.assert)(existingEventSnap || existingServerSnap, 'Either existingEventSnap or existingServerSnap must exist'); var path = treePath.child(childPath); if (this.visibleWrites_.hasCompleteWrite(path)) { // At this point we can probably guarantee that we're in case 2, meaning no events // May need to check visibility while doing the findRootMostValueAndPath call return null; } else { // No complete shadowing. We're either partially shadowing or not shadowing at all. var childMerge = this.visibleWrites_.childCompoundWrite(path); if (childMerge.isEmpty()) { // We're not shadowing at all. Case 1 return existingServerSnap.getChild(childPath); } else { // This could be more efficient if the serverNode + updates doesn't change the eventSnap // However this is tricky to find out, since user updates don't necessary change the server // snap, e.g. priority updates on empty nodes, or deep deletes. Another special case is if the server // adds nodes, but doesn't change any existing writes. It is therefore not enough to // only check if the updates change the serverNode. // Maybe check if the merge tree contains these special cases and only do a full overwrite in that case? return childMerge.apply(existingServerSnap.getChild(childPath)); } } }; /** * Returns a complete child for a given server snap after applying all user writes or null if there is no * complete child for this ChildKey. * * @param {!Path} treePath * @param {!string} childKey * @param {!CacheNode} existingServerSnap * @return {?Node} */ WriteTree.prototype.calcCompleteChild = function (treePath, childKey, existingServerSnap) { var path = treePath.child(childKey); var shadowingNode = this.visibleWrites_.getCompleteNode(path); if (shadowingNode != null) { return shadowingNode; } else { if (existingServerSnap.isCompleteForChild(childKey)) { var childMerge = this.visibleWrites_.childCompoundWrite(path); return childMerge.apply(existingServerSnap.getNode().getImmediateChild(childKey)); } else { return null; } } }; /** * Returns a node if there is a complete overwrite for this path. More specifically, if there is a write at * a higher path, this will return the child of that write relative to the write and this path. * Returns null if there is no write at this path. * * @param {!Path} path * @return {?Node} */ WriteTree.prototype.shadowingWrite = function (path) { return this.visibleWrites_.getCompleteNode(path); }; /** * This method is used when processing child remove events on a query. If we can, we pull in children that were outside * the window, but may now be in the window. * * @param {!Path} treePath * @param {?Node} completeServerData * @param {!NamedNode} startPost * @param {!number} count * @param {boolean} reverse * @param {!Index} index * @return {!Array.<!NamedNode>} */ WriteTree.prototype.calcIndexedSlice = function (treePath, completeServerData, startPost, count, reverse, index) { var toIterate; var merge = this.visibleWrites_.childCompoundWrite(treePath); var shadowingNode = merge.getCompleteNode(_Path.Path.Empty); if (shadowingNode != null) { toIterate = shadowingNode; } else if (completeServerData != null) { toIterate = merge.apply(completeServerData); } else { // no children to iterate on return []; } toIterate = toIterate.withIndex(index); if (!toIterate.isEmpty() && !toIterate.isLeafNode()) { var nodes = []; var cmp = index.getCompare(); var iter = reverse ? toIterate.getReverseIteratorFrom(startPost, index) : toIterate.getIteratorFrom(startPost, index); var next = iter.getNext(); while (next && nodes.length < count) { if (cmp(next, startPost) !== 0) { nodes.push(next); } next = iter.getNext(); } return nodes; } else { return []; } }; /** * @param {!WriteRecord} writeRecord * @param {!Path} path * @return {boolean} * @private */ WriteTree.prototype.recordContainsPath_ = function (writeRecord, path) { if (writeRecord.snap) { return writeRecord.path.contains(path); } else { // findKey can return undefined, so use !! to coerce to boolean return !!(0, _obj.findKey)(writeRecord.children, function (childSnap, childName) { return writeRecord.path.child(childName).contains(path); }); } }; /** * Re-layer the writes and merges into a tree so we can efficiently calculate event snapshots * @private */ WriteTree.prototype.resetTree_ = function () { this.visibleWrites_ = WriteTree.layerTree_(this.allWrites_, WriteTree.DefaultFilter_, _Path.Path.Empty); if (this.allWrites_.length > 0) { this.lastWriteId_ = this.allWrites_[this.allWrites_.length - 1].writeId; } else { this.lastWriteId_ = -1; } }; /** * The default filter used when constructing the tree. Keep everything that's visible. * * @param {!WriteRecord} write * @return {boolean} * @private */ WriteTree.DefaultFilter_ = function (write) { return write.visible; }; /** * Static method. Given an array of WriteRecords, a filter for which ones to include, and a path, construct the tree of * event data at that path. * * @param {!Array.<!WriteRecord>} writes * @param {!function(!WriteRecord):boolean} filter * @param {!Path} treeRoot * @return {!CompoundWrite} * @private */ WriteTree.layerTree_ = function (writes, filter, treeRoot) { var compoundWrite = _CompoundWrite.CompoundWrite.Empty; for (var i = 0; i < writes.length; ++i) { var write = writes[i]; // Theory, a later set will either: // a) abort a relevant transaction, so no need to worry about excluding it from calculating that transaction // b) not be relevant to a transaction (separate branch), so again will not affect the data for that transaction if (filter(write)) { var writePath = write.path; var relativePath = void 0; if (write.snap) { if (treeRoot.contains(writePath)) { relativePath = _Path.Path.relativePath(treeRoot, writePath); compoundWrite = compoundWrite.addWrite(relativePath, write.snap); } else if (writePath.contains(treeRoot)) { relativePath = _Path.Path.relativePath(writePath, treeRoot); compoundWrite = compoundWrite.addWrite(_Path.Path.Empty, write.snap.getChild(relativePath)); } else { // There is no overlap between root path and write path, ignore write } } else if (write.children) { if (treeRoot.contains(writePath)) { relativePath = _Path.Path.relativePath(treeRoot, writePath); compoundWrite = compoundWrite.addWrites(relativePath, write.children); } else if (writePath.contains(treeRoot)) { relativePath = _Path.Path.relativePath(writePath, treeRoot); if (relativePath.isEmpty()) { compoundWrite = compoundWrite.addWrites(_Path.Path.Empty, write.children); } else { var child = (0, _obj.safeGet)(write.children, relativePath.getFront()); if (child) { // There exists a child in this node that matches the root path var deepNode = child.getChild(relativePath.popFront()); compoundWrite = compoundWrite.addWrite(_Path.Path.Empty, deepNode); } } } else { // There is no overlap between root path and write path, ignore write } } else { throw (0, _assert.assertionError)('WriteRecord should have .snap or .children'); } } } return compoundWrite; }; return WriteTree; }(); exports.WriteTree = WriteTree; /** * A WriteTreeRef wraps a WriteTree and a path, for convenient access to a particular subtree. All of the methods * just proxy to the underlying WriteTree. * * @constructor */ var WriteTreeRef = /** @class */function () { /** * @param {!Path} path * @param {!WriteTree} writeTree */ function WriteTreeRef(path, writeTree) { this.treePath_ = path; this.writeTree_ = writeTree; } /** * If possible, returns a complete event cache, using the underlying server data if possible. In addition, can be used * to get a cache that includes hidden writes, and excludes arbitrary writes. Note that customizing the returned node * can lead to a more expensive calculation. * * @param {?Node} completeServerCache * @param {Array.<number>=} writeIdsToExclude Optional writes to exclude. * @param {boolean=} includeHiddenWrites Defaults to false, whether or not to layer on writes with visible set to false * @return {?Node} */ WriteTreeRef.prototype.calcCompleteEventCache = function (completeServerCache, writeIdsToExclude, includeHiddenWrites) { return this.writeTree_.calcCompleteEventCache(this.treePath_, completeServerCache, writeIdsToExclude, includeHiddenWrites); }; /** * If possible, returns a children node containing all of the complete children we have data for. The returned data is a * mix of the given server data and write data. * * @param {?ChildrenNode} completeServerChildren * @return {!ChildrenNode} */ WriteTreeRef.prototype.calcCompleteEventChildren = function (completeServerChildren) { return this.writeTree_.calcCompleteEventChildren(this.treePath_, completeServerChildren); }; /** * Given that either the underlying server data has updated or the outstanding writes have updated, determine what, * if anything, needs to be applied to the event cache. * * Possibilities: * * 1. No writes are shadowing. Events should be raised, the snap to be applied comes from the server data * * 2. Some write is completely shadowing. No events to be raised * * 3. Is partially shadowed. Events should be raised * * Either existingEventSnap or existingServerSnap must exist, this is validated via an assert * * @param {!Path} path * @param {?Node} existingEventSnap * @param {?Node} existingServerSnap * @return {?Node} */ WriteTreeRef.prototype.calcEventCacheAfterServerOverwrite = function (path, existingEventSnap, existingServerSnap) { return this.writeTree_.calcEventCacheAfterServerOverwrite(this.treePath_, path, existingEventSnap, existingServerSnap); }; /** * Returns a node if there is a complete overwrite for this path. More specifically, if there is a write at * a higher path, this will return the child of that write relative to the write and this path. * Returns null if there is no write at this path. * * @param {!Path} path * @return {?Node} */ WriteTreeRef.prototype.shadowingWrite = function (path) { return this.writeTree_.shadowingWrite(this.treePath_.child(path)); }; /** * This method is used when processing child remove events on a query. If we can, we pull in children that were outside * the window, but may now be in the window * * @param {?Node} completeServerData * @param {!NamedNode} startPost * @param {!number} count * @param {boolean} reverse * @param {!Index} index * @return {!Array.<!NamedNode>} */ WriteTreeRef.prototype.calcIndexedSlice = function (completeServerData, startPost, count, reverse, index) { return this.writeTree_.calcIndexedSlice(this.treePath_, completeServerData, startPost, count, reverse, index); }; /** * Returns a complete child for a given server snap after applying all user writes or null if there is no * complete child for this ChildKey. * * @param {!string} childKey * @param {!CacheNode} existingServerCache * @return {?Node} */ WriteTreeRef.prototype.calcCompleteChild = function (childKey, existingServerCache) { return this.writeTree_.calcCompleteChild(this.treePath_, childKey, existingServerCache); }; /** * Return a WriteTreeRef for a child. * * @param {string} childName * @return {!WriteTreeRef} */ WriteTreeRef.prototype.child = function (childName) { return new WriteTreeRef(this.treePath_.child(childName), this.writeTree_); }; return WriteTreeRef; }(); exports.WriteTreeRef = WriteTreeRef; //# sourceMappingURL=WriteTree.js.map
/** * 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. * * @generated SignedSource<<af471072358e1505cd0d27587edcebdf>> * @flow * @lightSyntaxTransform * @nogrep */ /* eslint-disable */ 'use strict'; /*:: import type { NormalizationSplitOperation } from 'relay-runtime'; */ var node/*: NormalizationSplitOperation*/ = { "kind": "SplitOperation", "metadata": {}, "name": "fetchQueryInternalTestMarkdown1Fragment_name$normalization", "selections": [ { "alias": null, "args": null, "kind": "ScalarField", "name": "__typename", "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", "name": "markdown", "storageKey": null }, { "alias": null, "args": null, "concreteType": "MarkdownUserNameData", "kind": "LinkedField", "name": "data", "plural": false, "selections": [ { "alias": null, "args": null, "kind": "ScalarField", "name": "markup", "storageKey": null }, { "alias": null, "args": null, "kind": "ScalarField", "name": "id", "storageKey": null } ], "storageKey": null } ] }; if (__DEV__) { (node/*: any*/).hash = "c23b64d2c536a5ff15a088b0ad49e3b9"; } module.exports = node;
run_spec(__dirname, ["flow", "typescript"], { bracketSameLine: true }); run_spec(__dirname, ["flow", "typescript"], { bracketSameLine: false });
"use strict"; var _interopRequireDefault = require("@babel/runtime/helpers/interopRequireDefault"); Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _createSvgIcon = _interopRequireDefault(require("./utils/createSvgIcon")); var _jsxRuntime = require("react/jsx-runtime"); var _default = (0, _createSvgIcon.default)( /*#__PURE__*/(0, _jsxRuntime.jsx)("path", { d: "m14 11.05-3.42-3.42c.32-.34.74-.57 1.23-.61.48-.04.84.07 1.2.26.19.1.39.22.63.46l1.29 1.43c.98 1.08 2.53 1.85 4.07 1.83v2c-1.75-.01-3.71-.88-5-1.95zM12 6c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zM2.81 2.81 1.39 4.22 10 12.83V15c0 1.1.9 2 2 2h2.17l5.61 5.61 1.41-1.41L2.81 2.81zM10 20c-1.66 0-3-1.34-3-3 0-1.31.84-2.41 2-2.83V12.1c-2.28.46-4 2.48-4 4.9 0 2.76 2.24 5 5 5 2.42 0 4.44-1.72 4.9-4h-2.07c-.41 1.16-1.52 2-2.83 2z" }), 'NotAccessible'); exports.default = _default;
var vows = require('vows'); var assert = require('assert'); var util = require('util'); var YahooStrategy = require('passport-yahoo/strategy'); vows.describe('YahooStrategy').addBatch({ 'strategy': { topic: function() { return new YahooStrategy({ returnURL: 'https://www.example.com/auth/yahoo/return' }, function() {} ); }, 'should be named yahoo': function (strategy) { assert.equal(strategy.name, 'yahoo'); }, 'should have correct provider URL': function (strategy) { assert.equal(strategy._providerURL, 'http://open.login.yahooapis.com/openid20/www.yahoo.com/xrds'); }, }, }).export(module);
'use strict'; var expect = require('chai').expect; var merge = require('ember-cli-lodash-subset').merge; var MockUI = require('../../helpers/mock-ui'); var MockAnalytics = require('../../helpers/mock-analytics'); var Command = require('../../../lib/models/command'); var Yam = require('yam'); describe('.ember-cli', function() { var ui; var analytics; var project; var settings; var homeSettings; before(function() { ui = new MockUI(); analytics = new MockAnalytics(); project = { isEmberCLIProject: function() { return true; }}; homeSettings = { proxy: 'http://iamstef.net/ember-cli', liveReload: false, environment: 'mock-development', host: '0.1.0.1' }; settings = new Yam('ember-cli', { secondary: process.cwd() + '/tests/fixtures/home', primary: process.cwd() + '/tests/fixtures/project' }).getAll(); }); it('local settings take precendence over global settings', function() { var command = new Command({ ui: ui, analytics: analytics, project: project, settings: settings }); var args = command.parseArgs(); expect(args.options).to.include( merge(homeSettings, { port: 999, liveReload: false }) ); }); });
/** * A shape configuration holds common configuration data for constructing a shape. * Shape configurations can be reused safely. * @author saharan */ OIMO.ShapeConfig = function(){ // The position of the shape in parent's coordinate system. this.relativePosition = new OIMO.Vec3(); // The rotation matrix of the shape in parent's coordinate system. this.relativeRotation = new OIMO.Mat33(); // The coefficient of friction of the shape. this.friction = 0.4; // The coefficient of restitution of the shape. this.restitution = 0.2; // The density of the shape. this.density = 1; // The bits of the collision groups to which the shape belongs. this.belongsTo = 1; // The bits of the collision groups with which the shape collides. this.collidesWith = 0xffffffff; }
'use strict'; /** * Module dependencies. */ var _ = require('lodash'), chalk = require('chalk'), glob = require('glob'), fs = require('fs'), path = require('path'); /** * Get files by glob patterns */ var getGlobbedPaths = function (globPatterns, excludes) { // URL paths regex var urlRegex = new RegExp('^(?:[a-z]+:)?\/\/', 'i'); // The output array var output = []; // If glob pattern is array then we use each pattern in a recursive way, otherwise we use glob if (_.isArray(globPatterns)) { globPatterns.forEach(function (globPattern) { output = _.union(output, getGlobbedPaths(globPattern, excludes)); }); } else if (_.isString(globPatterns)) { if (urlRegex.test(globPatterns)) { output.push(globPatterns); } else { var files = glob.sync(globPatterns); if (excludes) { files = files.map(function (file) { if (_.isArray(excludes)) { for (var i in excludes) { if (excludes.hasOwnProperty(i)) { file = file.replace(excludes[i], ''); } } } else { file = file.replace(excludes, ''); } return file; }); } output = _.union(output, files); } } return output; }; /** * Validate NODE_ENV existence */ var validateEnvironmentVariable = function () { var environmentFiles = glob.sync('./config/env/' + process.env.NODE_ENV + '.js'); console.log(); if (!environmentFiles.length) { if (process.env.NODE_ENV) { console.error(chalk.red('+ Error: No configuration file found for "' + process.env.NODE_ENV + '" environment using development instead')); } else { console.error(chalk.red('+ Error: NODE_ENV is not defined! Using default development environment')); } process.env.NODE_ENV = 'development'; } // Reset console color console.log(chalk.white('')); }; /** Validate config.domain is set */ var validateDomainIsSet = function (config) { if (!config.domain) { console.log(chalk.red('+ Important warning: config.domain is empty. It should be set to the fully qualified domain of the app.')); } }; /** * Validate Secure=true parameter can actually be turned on * because it requires certs and key files to be available */ var validateSecureMode = function (config) { if (!config.secure || config.secure.ssl !== true) { return true; } var privateKey = fs.existsSync(path.resolve(config.secure.privateKey)); var certificate = fs.existsSync(path.resolve(config.secure.certificate)); if (!privateKey || !certificate) { console.log(chalk.red('+ Error: Certificate file or key file is missing, falling back to non-SSL mode')); console.log(chalk.red(' To create them, simply run the following from your shell: sh ./scripts/generate-ssl-certs.sh')); console.log(); config.secure.ssl = false; } }; /** * Validate Session Secret parameter is not set to default in production */ var validateSessionSecret = function (config, testing) { if (process.env.NODE_ENV !== 'production') { return true; } if (config.sessionSecret === 'MEAN') { if (!testing) { console.log(chalk.red('+ WARNING: It is strongly recommended that you change sessionSecret config while running in production!')); console.log(chalk.red(' Please add `sessionSecret: process.env.SESSION_SECRET || \'super amazing secret\'` to ')); console.log(chalk.red(' `config/env/production.js` or `config/env/local.js`')); console.log(); } return false; } else { return true; } }; /** * Initialize global configuration files */ var initGlobalConfigFolders = function (config, assets) { // Appending files config.folders = { server: {}, client: {} }; // Setting globbed client paths config.folders.client = getGlobbedPaths(path.join(process.cwd(), 'modules/*/client/'), process.cwd().replace(new RegExp(/\\/g), '/')); }; /** * Initialize global configuration files */ var initGlobalConfigFiles = function (config, assets) { // Appending files config.files = { server: {}, client: {} }; // Setting Globbed model files config.files.server.models = getGlobbedPaths(assets.server.models); // Setting Globbed route files config.files.server.routes = getGlobbedPaths(assets.server.routes); // Setting Globbed config files config.files.server.configs = getGlobbedPaths(assets.server.config); // Setting Globbed socket files config.files.server.sockets = getGlobbedPaths(assets.server.sockets); // Setting Globbed policies files config.files.server.policies = getGlobbedPaths(assets.server.policies); // Setting Globbed test files config.files.client.entries = getGlobbedPaths(assets.client.entries); }; /** * Load All Menu Items from server.config files * MenuItem -> SubMenuItem (support hierarchy) */ var initMenuItems = function (config,assets) { config.menus = []; var menuConfigFiles = getGlobbedPaths(assets.server.menus); menuConfigFiles.forEach(function(menuConfigPath){ var menuItems = require(path.resolve(menuConfigPath)); config.menus = _.union(config.menus,menuItems.menus); }) } var getMenuItems = function (config,user){ var roles = (user && user.roles ) || ['guest']; var filteredMenuItems = []; config.menus.forEach(function(configMenu){ if(_.intersection(configMenu.roles, roles).length>0){ var menu = configMenu; if(configMenu.type =='dropdown'){ var subMenus = []; configMenu.subMenus.forEach(function(configSubMenu){ if(!configSubMenu.roles || _.intersection(configSubMenu.roles, roles).length>0){ subMenus.push(configSubMenu); } }); menu.subMenus = subMenus; } filteredMenuItems.push(menu); } }) return _.sortBy(filteredMenuItems,['sequence']); } /** * Initialize global configuration */ var initGlobalConfig = function () { // Validate NODE_ENV existence validateEnvironmentVariable(); // Get the default assets var defaultAssets = require(path.join(process.cwd(), 'config/assets/default')); // Get the current assets var environmentAssets = require(path.join(process.cwd(), 'config/assets/', process.env.NODE_ENV)) || {}; // Merge assets var assets = _.merge(defaultAssets, environmentAssets); // Get the default config var defaultConfig = require(path.join(process.cwd(), 'config/env/default')); // Get the current config var environmentConfig = require(path.join(process.cwd(), 'config/env/', process.env.NODE_ENV)) || {}; // Merge config files var config = _.merge(defaultConfig, environmentConfig); // read package.json for MEAN.JS project information var pkg = require(path.resolve('./package.json')); config.meanjs = pkg; // Extend the config object with the local-NODE_ENV.js custom/local environment. This will override any settings present in the local configuration. config = _.merge(config, (fs.existsSync(path.join(process.cwd(), 'config/env/local-' + process.env.NODE_ENV + '.js')) && require(path.join(process.cwd(), 'config/env/local-' + process.env.NODE_ENV + '.js'))) || {}); // Initialize global globbed files initGlobalConfigFiles(config, assets); // Initialize global globbed folders initGlobalConfigFolders(config, assets); // Validate Secure SSL mode can be used validateSecureMode(config); // Validate session secret validateSessionSecret(config); // Print a warning if config.domain is not set validateDomainIsSet(config); // Initial Menu Items initMenuItems(config,assets); // Expose configuration utilities config.utils = { getGlobbedPaths: getGlobbedPaths, validateSessionSecret: validateSessionSecret, getMenuItems: getMenuItems }; return config; }; /** * Set configuration object */ module.exports = initGlobalConfig();
angular.module('app', ['ngRoute', 'ui.bootstrap', 'angular.filter', 'ngAnimate']) // Initialize Firebase firebase.initializeApp ({ apiKey: "AIzaSyC_yMinncyZrC7PgC8ItDbDx-PZF96yFg4", authDomain: "fed-capstone.firebaseapp.com", databaseURL: "https://fed-capstone.firebaseio.com", storageBucket: "fed-capstone.appspot.com", }); window.onunload = function () { firebase.auth().signOut() .then($location.path($location, '/')) .then($timeout) }
import styled from 'styled-components'; export default styled.section` position: relative; overflow: hidden; width: 100vw; transition: height .3s linear; height: calc(100vh - ${p => p.yOffset ? p.yOffset : '0px'}); `;
{ "ADP_currencyISO" : "Peseta Andorrana", "ADP_currencySymbol" : "ADP", "AED_currencyISO" : "Dirham degli Emirati Arabi Uniti", "AED_currencySymbol" : "AED", "AFA_currencyISO" : "Afgani (1927-2002)", "AFA_currencySymbol" : "AFA", "AFN_currencyISO" : "Afgani", "AFN_currencySymbol" : "Af", "ALK_currencyISO" : "Afgani", "ALK_currencySymbol" : "Af", "ALL_currencyISO" : "Lek Albanese", "ALL_currencySymbol" : "ALL", "AMD_currencyISO" : "Dram Armeno", "AMD_currencySymbol" : "AMD", "ANG_currencyISO" : "Fiorino delle Antille Olandesi", "ANG_currencySymbol" : "NAf.", "AOA_currencyISO" : "Kwanza Angolano", "AOA_currencySymbol" : "Kz", "AOK_currencyISO" : "Kwanza Angolano (1977-1990)", "AOK_currencySymbol" : "AOK", "AON_currencyISO" : "Nuovo Kwanza Angolano (1990-2000)", "AON_currencySymbol" : "AON", "AOR_currencyISO" : "Kwanza Reajustado Angolano (1995-1999)", "AOR_currencySymbol" : "AOR", "ARA_currencyISO" : "Austral Argentino", "ARA_currencySymbol" : "₳", "ARL_currencyISO" : "ARL", "ARL_currencySymbol" : "$L", "ARM_currencyISO" : "ARM", "ARM_currencySymbol" : "m$n", "ARP_currencyISO" : "Peso Argentino (vecchio Cod.)", "ARP_currencySymbol" : "ARP", "ARS_currencyISO" : "Peso Argentino", "ARS_currencySymbol" : "AR$", "ATS_currencyISO" : "Scellino Austriaco", "ATS_currencySymbol" : "ATS", "AUD_currencyISO" : "Dollaro Australiano", "AUD_currencySymbol" : "AU$", "AWG_currencyISO" : "Fiorino di Aruba", "AWG_currencySymbol" : "Afl.", "AZM_currencyISO" : "Manat Azero (1993-2006)", "AZM_currencySymbol" : "AZM", "AZN_currencyISO" : "manat azero", "AZN_currencySymbol" : "man.", "BAD_currencyISO" : "Dinar Bosnia-Herzegovina", "BAD_currencySymbol" : "BAD", "BAM_currencyISO" : "Marco Conv. Bosnia-Erzegovina", "BAM_currencySymbol" : "KM", "BAN_currencyISO" : "Marco Conv. Bosnia-Erzegovina", "BAN_currencySymbol" : "KM", "BBD_currencyISO" : "Dollaro di Barbados", "BBD_currencySymbol" : "Bds$", "BDT_currencyISO" : "Taka Bangladese", "BDT_currencySymbol" : "Tk", "BEC_currencyISO" : "Franco Belga (convertibile)", "BEC_currencySymbol" : "BEC", "BEF_currencyISO" : "Franco Belga", "BEF_currencySymbol" : "BF", "BEL_currencyISO" : "Franco Belga (finanziario)", "BEL_currencySymbol" : "BEL", "BGL_currencyISO" : "Lev Bulgaro", "BGL_currencySymbol" : "BGL", "BGM_currencyISO" : "Lev Bulgaro", "BGM_currencySymbol" : "BGL", "BGN_currencyISO" : "Nuovo Lev Bulgaro", "BGN_currencySymbol" : "BGN", "BGO_currencyISO" : "Nuovo Lev Bulgaro", "BGO_currencySymbol" : "BGN", "BHD_currencyISO" : "Dinaro del Bahraini", "BHD_currencySymbol" : "BD", "BIF_currencyISO" : "Franco del Burundi", "BIF_currencySymbol" : "FBu", "BMD_currencyISO" : "Dollaro delle Bermuda", "BMD_currencySymbol" : "BD$", "BND_currencyISO" : "Dollaro del Brunei", "BND_currencySymbol" : "BN$", "BOB_currencyISO" : "Boliviano", "BOB_currencySymbol" : "Bs", "BOL_currencyISO" : "Boliviano", "BOL_currencySymbol" : "Bs", "BOP_currencyISO" : "Peso Boliviano", "BOP_currencySymbol" : "$b.", "BOV_currencyISO" : "Mvdol Boliviano", "BOV_currencySymbol" : "BOV", "BRB_currencyISO" : "Cruzeiro Novo Brasiliano (1967-1986)", "BRB_currencySymbol" : "BRB", "BRC_currencyISO" : "Cruzado Brasiliano", "BRC_currencySymbol" : "BRC", "BRE_currencyISO" : "Cruzeiro Brasiliano (1990-1993)", "BRE_currencySymbol" : "BRE", "BRL_currencyISO" : "Real Brasiliano", "BRL_currencySymbol" : "R$", "BRN_currencyISO" : "Cruzado Novo Brasiliano", "BRN_currencySymbol" : "BRN", "BRR_currencyISO" : "Cruzeiro Brasiliano", "BRR_currencySymbol" : "BRR", "BRZ_currencyISO" : "Cruzeiro Brasiliano", "BRZ_currencySymbol" : "BRR", "BSD_currencyISO" : "Dollaro delle Bahamas", "BSD_currencySymbol" : "BS$", "BTN_currencyISO" : "Ngultrum Butanese", "BTN_currencySymbol" : "Nu.", "BUK_currencyISO" : "Kyat Birmano", "BUK_currencySymbol" : "BUK", "BWP_currencyISO" : "Pula del Botswana", "BWP_currencySymbol" : "BWP", "BYB_currencyISO" : "Nuovo Rublo Bielorussia (1994-1999)", "BYB_currencySymbol" : "BYB", "BYR_currencyISO" : "Rublo Bielorussia", "BYR_currencySymbol" : "BYR", "BZD_currencyISO" : "Dollaro Belize", "BZD_currencySymbol" : "BZ$", "CAD_currencyISO" : "Dollaro Canadese", "CAD_currencySymbol" : "CA$", "CDF_currencyISO" : "Franco Congolese", "CDF_currencySymbol" : "CDF", "CHE_currencyISO" : "Franco Congolese", "CHE_currencySymbol" : "CDF", "CHF_currencyISO" : "Franco Svizzero", "CHF_currencySymbol" : "CHF", "CHW_currencyISO" : "Franco Svizzero", "CHW_currencySymbol" : "CHF", "CLE_currencyISO" : "CLE", "CLE_currencySymbol" : "Eº", "CLF_currencyISO" : "Unidades de Fomento Chilene", "CLF_currencySymbol" : "CLF", "CLP_currencyISO" : "Peso Cileno", "CLP_currencySymbol" : "CL$", "CNX_currencyISO" : "Peso Cileno", "CNX_currencySymbol" : "CL$", "CNY_currencyISO" : "Renmimbi Cinese", "CNY_currencySymbol" : "CN¥", "COP_currencyISO" : "Peso Colombiano", "COP_currencySymbol" : "CO$", "COU_currencyISO" : "Peso Colombiano", "COU_currencySymbol" : "CO$", "CRC_currencyISO" : "Colón Costaricano", "CRC_currencySymbol" : "₡", "CSD_currencyISO" : "antico dinaro serbo", "CSD_currencySymbol" : "CSD", "CSK_currencyISO" : "Corona forte cecoslovacca", "CSK_currencySymbol" : "CSK", "CUC_currencyISO" : "CUC", "CUC_currencySymbol" : "CUC$", "CUP_currencyISO" : "Peso Cubano", "CUP_currencySymbol" : "CU$", "CVE_currencyISO" : "Escudo del Capo Verde", "CVE_currencySymbol" : "CV$", "CYP_currencyISO" : "Sterlina Cipriota", "CYP_currencySymbol" : "CY£", "CZK_currencyISO" : "Corona Ceca", "CZK_currencySymbol" : "Kč", "DDM_currencyISO" : "Ostmark della Germania Orientale", "DDM_currencySymbol" : "DDM", "DEM_currencyISO" : "Marco Tedesco", "DEM_currencySymbol" : "DM", "DJF_currencyISO" : "Franco Gibutiano", "DJF_currencySymbol" : "Fdj", "DKK_currencyISO" : "Corona Danese", "DKK_currencySymbol" : "Dkr", "DOP_currencyISO" : "Peso Dominicano", "DOP_currencySymbol" : "RD$", "DZD_currencyISO" : "Dinaro Algerino", "DZD_currencySymbol" : "DA", "ECS_currencyISO" : "Sucre dell’Ecuador", "ECS_currencySymbol" : "ECS", "ECV_currencyISO" : "Unidad de Valor Constante (UVC) dell’Ecuador", "ECV_currencySymbol" : "ECV", "EEK_currencyISO" : "Corona dell’Estonia", "EEK_currencySymbol" : "Ekr", "EGP_currencyISO" : "Sterlina Egiziana", "EGP_currencySymbol" : "EG£", "ERN_currencyISO" : "Nakfa Eritreo", "ERN_currencySymbol" : "Nfk", "ESA_currencyISO" : "peseta spagnola account", "ESA_currencySymbol" : "ESA", "ESB_currencyISO" : "peseta spagnola account convertibile", "ESB_currencySymbol" : "ESB", "ESP_currencyISO" : "Peseta Spagnola", "ESP_currencySymbol" : "Pts", "ETB_currencyISO" : "Birr Etiopico", "ETB_currencySymbol" : "Br", "EUR_currencyISO" : "Euro", "EUR_currencySymbol" : "€", "FIM_currencyISO" : "Markka Finlandese", "FIM_currencySymbol" : "mk", "FJD_currencyISO" : "Dollaro delle Figi", "FJD_currencySymbol" : "FJ$", "FKP_currencyISO" : "Sterlina delle Falkland", "FKP_currencySymbol" : "FK£", "FRF_currencyISO" : "Franco Francese", "FRF_currencySymbol" : "₣", "GBP_currencyISO" : "Sterlina Inglese", "GBP_currencySymbol" : "£", "GEK_currencyISO" : "Kupon Larit Georgiano", "GEK_currencySymbol" : "GEK", "GEL_currencyISO" : "Lari Georgiano", "GEL_currencySymbol" : "GEL", "GHC_currencyISO" : "Cedi del Ghana", "GHC_currencySymbol" : "₵", "GHS_currencyISO" : "Cedi ghanese", "GHS_currencySymbol" : "GH₵", "GIP_currencyISO" : "Sterlina di Gibilterra", "GIP_currencySymbol" : "GI£", "GMD_currencyISO" : "Dalasi del Gambia", "GMD_currencySymbol" : "GMD", "GNF_currencyISO" : "Franco della Guinea", "GNF_currencySymbol" : "FG", "GNS_currencyISO" : "Syli della Guinea", "GNS_currencySymbol" : "GNS", "GQE_currencyISO" : "Ekwele della Guinea Equatoriale", "GQE_currencySymbol" : "GQE", "GRD_currencyISO" : "Dracma Greca", "GRD_currencySymbol" : "₯", "GTQ_currencyISO" : "Quetzal Guatemalteco", "GTQ_currencySymbol" : "GTQ", "GWE_currencyISO" : "Escudo della Guinea portoghese", "GWE_currencySymbol" : "GWE", "GWP_currencyISO" : "Peso della Guinea-Bissau", "GWP_currencySymbol" : "GWP", "GYD_currencyISO" : "Dollaro della Guyana", "GYD_currencySymbol" : "GY$", "HKD_currencyISO" : "Dollaro di Hong Kong", "HKD_currencySymbol" : "HK$", "HNL_currencyISO" : "Lempira Hoduregno", "HNL_currencySymbol" : "HNL", "HRD_currencyISO" : "Dinaro Croato", "HRD_currencySymbol" : "HRD", "HRK_currencyISO" : "Kuna Croata", "HRK_currencySymbol" : "kn", "HTG_currencyISO" : "Gourde Haitiano", "HTG_currencySymbol" : "HTG", "HUF_currencyISO" : "Fiorino Ungherese", "HUF_currencySymbol" : "Ft", "IDR_currencyISO" : "Rupia Indonesiana", "IDR_currencySymbol" : "Rp", "IEP_currencyISO" : "Sterlina irlandese", "IEP_currencySymbol" : "IR£", "ILP_currencyISO" : "Sterlina Israeliana", "ILP_currencySymbol" : "I£", "ILR_currencyISO" : "Sterlina Israeliana", "ILR_currencySymbol" : "I£", "ILS_currencyISO" : "Nuovo sheqel israeliano", "ILS_currencySymbol" : "₪", "INR_currencyISO" : "Rupia Indiana", "INR_currencySymbol" : "Rs", "IQD_currencyISO" : "Dinaro Iracheno", "IQD_currencySymbol" : "IQD", "IRR_currencyISO" : "Rial Iraniano", "IRR_currencySymbol" : "IRR", "ISJ_currencyISO" : "Rial Iraniano", "ISJ_currencySymbol" : "IRR", "ISK_currencyISO" : "Corona Islandese", "ISK_currencySymbol" : "Ikr", "ITL_currencyISO" : "Lira Italiana", "ITL_currencySymbol" : "IT₤", "JMD_currencyISO" : "Dollaro Giamaicano", "JMD_currencySymbol" : "J$", "JOD_currencyISO" : "Dinaro Giordano", "JOD_currencySymbol" : "JD", "JPY_currencyISO" : "Yen Giapponese", "JPY_currencySymbol" : "JP¥", "KES_currencyISO" : "Scellino Keniota", "KES_currencySymbol" : "Ksh", "KGS_currencyISO" : "Som Kirghiso", "KGS_currencySymbol" : "KGS", "KHR_currencyISO" : "Riel Cambogiano", "KHR_currencySymbol" : "KHR", "KMF_currencyISO" : "Franco Comoriano", "KMF_currencySymbol" : "CF", "KPW_currencyISO" : "Won Nordcoreano", "KPW_currencySymbol" : "KPW", "KRH_currencyISO" : "Won Nordcoreano", "KRH_currencySymbol" : "KPW", "KRO_currencyISO" : "Won Nordcoreano", "KRO_currencySymbol" : "KPW", "KRW_currencyISO" : "Won Sudcoreano", "KRW_currencySymbol" : "₩", "KWD_currencyISO" : "Dinaro Kuwaitiano", "KWD_currencySymbol" : "KD", "KYD_currencyISO" : "Dollaro delle Isole Cayman", "KYD_currencySymbol" : "KY$", "KZT_currencyISO" : "Tenge Kazaco", "KZT_currencySymbol" : "KZT", "LAK_currencyISO" : "Kip Laotiano", "LAK_currencySymbol" : "₭", "LBP_currencyISO" : "Sterlina Libanese", "LBP_currencySymbol" : "LB£", "LKR_currencyISO" : "Rupia di Sri Lanka", "LKR_currencySymbol" : "SLRs", "LRD_currencyISO" : "Dollaro Liberiano", "LRD_currencySymbol" : "L$", "LSL_currencyISO" : "Loti del Lesotho", "LSL_currencySymbol" : "LSL", "LTL_currencyISO" : "Lita Lituana", "LTL_currencySymbol" : "Lt", "LTT_currencyISO" : "Talonas Lituani", "LTT_currencySymbol" : "LTT", "LUC_currencyISO" : "franco convertibile del Lussemburgo", "LUC_currencySymbol" : "LUC", "LUF_currencyISO" : "Franco del Lussemburgo", "LUF_currencySymbol" : "LUF", "LUL_currencyISO" : "franco finanziario del Lussemburgo", "LUL_currencySymbol" : "LUL", "LVL_currencyISO" : "Lat Lettone", "LVL_currencySymbol" : "Ls", "LVR_currencyISO" : "Rublo Lettone", "LVR_currencySymbol" : "LVR", "LYD_currencyISO" : "Dinaro Libico", "LYD_currencySymbol" : "LD", "MAD_currencyISO" : "Dirham Marocchino", "MAD_currencySymbol" : "MAD", "MAF_currencyISO" : "Franco Marocchino", "MAF_currencySymbol" : "MAF", "MCF_currencyISO" : "Franco Marocchino", "MCF_currencySymbol" : "MAF", "MDC_currencyISO" : "Franco Marocchino", "MDC_currencySymbol" : "MAF", "MDL_currencyISO" : "Leu Moldavo", "MDL_currencySymbol" : "MDL", "MGA_currencyISO" : "Ariary Malgascio", "MGA_currencySymbol" : "MGA", "MGF_currencyISO" : "Franco Malgascio", "MGF_currencySymbol" : "MGF", "MKD_currencyISO" : "Dinaro Macedone", "MKD_currencySymbol" : "MKD", "MKN_currencyISO" : "Dinaro Macedone", "MKN_currencySymbol" : "MKD", "MLF_currencyISO" : "Franco di Mali", "MLF_currencySymbol" : "MLF", "MMK_currencyISO" : "Kyat di Myanmar", "MMK_currencySymbol" : "MMK", "MNT_currencyISO" : "Tugrik Mongolo", "MNT_currencySymbol" : "₮", "MOP_currencyISO" : "Pataca di Macao", "MOP_currencySymbol" : "MOP$", "MRO_currencyISO" : "Ouguiya della Mauritania", "MRO_currencySymbol" : "UM", "MTL_currencyISO" : "Lira Maltese", "MTL_currencySymbol" : "Lm", "MTP_currencyISO" : "Sterlina Maltese", "MTP_currencySymbol" : "MT£", "MUR_currencyISO" : "Rupia Mauriziana", "MUR_currencySymbol" : "MURs", "MVP_currencyISO" : "Rupia Mauriziana", "MVP_currencySymbol" : "MURs", "MVR_currencyISO" : "Rufiyaa delle Maldive", "MVR_currencySymbol" : "MVR", "MWK_currencyISO" : "Kwacha Malawiano", "MWK_currencySymbol" : "MWK", "MXN_currencyISO" : "Peso Messicano", "MXN_currencySymbol" : "MX$", "MXP_currencyISO" : "Peso messicano d’argento (1861-1992)", "MXP_currencySymbol" : "MXP", "MXV_currencyISO" : "Unidad de Inversion (UDI) Messicana", "MXV_currencySymbol" : "MXV", "MYR_currencyISO" : "Ringgit della Malesia", "MYR_currencySymbol" : "RM", "MZE_currencyISO" : "Escudo del Mozambico", "MZE_currencySymbol" : "MZE", "MZM_currencyISO" : "MZM", "MZM_currencySymbol" : "Mt", "MZN_currencyISO" : "Metical del Mozambico", "MZN_currencySymbol" : "MTn", "NAD_currencyISO" : "Dollaro Namibiano", "NAD_currencySymbol" : "N$", "NGN_currencyISO" : "Naira Nigeriana", "NGN_currencySymbol" : "₦", "NIC_currencyISO" : "Cordoba Nicaraguense", "NIC_currencySymbol" : "NIC", "NIO_currencyISO" : "Córdoba oro nicaraguense", "NIO_currencySymbol" : "C$", "NLG_currencyISO" : "Fiorino Olandese", "NLG_currencySymbol" : "fl", "NOK_currencyISO" : "Corona Norvegese", "NOK_currencySymbol" : "Nkr", "NPR_currencyISO" : "Rupia Nepalese", "NPR_currencySymbol" : "NPRs", "NZD_currencyISO" : "Dollaro Neozelandese", "NZD_currencySymbol" : "NZ$", "OMR_currencyISO" : "Rial Omanita", "OMR_currencySymbol" : "OMR", "PAB_currencyISO" : "Balboa di Panama", "PAB_currencySymbol" : "B/.", "PEI_currencyISO" : "Inti Peruviano", "PEI_currencySymbol" : "I/.", "PEN_currencyISO" : "Sol Nuevo Peruviano", "PEN_currencySymbol" : "S/.", "PES_currencyISO" : "Sol Peruviano", "PES_currencySymbol" : "PES", "PGK_currencyISO" : "Kina della Papua Nuova Guinea", "PGK_currencySymbol" : "PGK", "PHP_currencyISO" : "Peso delle Filippine", "PHP_currencySymbol" : "₱", "PKR_currencyISO" : "Rupia del Pakistan", "PKR_currencySymbol" : "PKRs", "PLN_currencyISO" : "Zloty Polacco", "PLN_currencySymbol" : "zł", "PLZ_currencyISO" : "Zloty Polacco (1950-1995)", "PLZ_currencySymbol" : "PLZ", "PTE_currencyISO" : "Escudo Portoghese", "PTE_currencySymbol" : "Esc", "PYG_currencyISO" : "Guarani del Paraguay", "PYG_currencySymbol" : "₲", "QAR_currencyISO" : "Rial del Qatar", "QAR_currencySymbol" : "QR", "RHD_currencyISO" : "dollaro della Rhodesia", "RHD_currencySymbol" : "RH$", "ROL_currencyISO" : "Leu della Romania", "ROL_currencySymbol" : "ROL", "RON_currencyISO" : "leu rumeno", "RON_currencySymbol" : "RON", "RSD_currencyISO" : "Dinaro serbo", "RSD_currencySymbol" : "din.", "RUB_currencyISO" : "Rublo Russo", "RUB_currencySymbol" : "RUB", "RUR_currencyISO" : "Rublo della CSI", "RUR_currencySymbol" : "RUR", "RWF_currencyISO" : "Franco Ruandese", "RWF_currencySymbol" : "RWF", "SAR_currencyISO" : "Ryal Saudita", "SAR_currencySymbol" : "SR", "SBD_currencyISO" : "Dollaro delle Isole Solomon", "SBD_currencySymbol" : "SI$", "SCR_currencyISO" : "Rupia delle Seychelles", "SCR_currencySymbol" : "SRe", "SDD_currencyISO" : "Dinaro Sudanese", "SDD_currencySymbol" : "LSd", "SDG_currencyISO" : "Sterlina sudanese", "SDG_currencySymbol" : "SDG", "SDP_currencyISO" : "Sterlina sudanese", "SDP_currencySymbol" : "SDG", "SEK_currencyISO" : "Corona Svedese", "SEK_currencySymbol" : "Skr", "SGD_currencyISO" : "Dollaro di Singapore", "SGD_currencySymbol" : "S$", "SHP_currencyISO" : "Sterlina di Sant’Elena", "SHP_currencySymbol" : "SH£", "SIT_currencyISO" : "Tallero Sloveno", "SIT_currencySymbol" : "SIT", "SKK_currencyISO" : "Corona Slovacca", "SKK_currencySymbol" : "Sk", "SLL_currencyISO" : "Leone della Sierra Leone", "SLL_currencySymbol" : "Le", "SOS_currencyISO" : "Scellino Somalo", "SOS_currencySymbol" : "Ssh", "SRD_currencyISO" : "Dollaro surinamese", "SRD_currencySymbol" : "SR$", "SRG_currencyISO" : "Fiorino del Suriname", "SRG_currencySymbol" : "Sf", "SSP_currencyISO" : "Fiorino del Suriname", "SSP_currencySymbol" : "Sf", "STD_currencyISO" : "Dobra di Sao Tomé e Principe", "STD_currencySymbol" : "Db", "SUR_currencyISO" : "Rublo Sovietico", "SUR_currencySymbol" : "SUR", "SVC_currencyISO" : "Colón Salvadoregno", "SVC_currencySymbol" : "SV₡", "SYP_currencyISO" : "Sterlina Siriana", "SYP_currencySymbol" : "SY£", "SZL_currencyISO" : "Lilangeni dello Swaziland", "SZL_currencySymbol" : "SZL", "THB_currencyISO" : "Baht Tailandese", "THB_currencySymbol" : "฿", "TJR_currencyISO" : "Rublo del Tajikistan", "TJR_currencySymbol" : "TJR", "TJS_currencyISO" : "Somoni del Tajikistan", "TJS_currencySymbol" : "TJS", "TMM_currencyISO" : "Manat Turkmeno", "TMM_currencySymbol" : "TMM", "TMT_currencyISO" : "Manat Turkmeno", "TMT_currencySymbol" : "TMM", "TND_currencyISO" : "Dinaro Tunisino", "TND_currencySymbol" : "DT", "TOP_currencyISO" : "Paʻanga di Tonga", "TOP_currencySymbol" : "T$", "TPE_currencyISO" : "Escudo di Timor", "TPE_currencySymbol" : "TPE", "TRL_currencyISO" : "Lira Turca", "TRL_currencyPlural" : "lire turche", "TRL_currencySingular" : "lira turca", "TRL_currencySymbol" : "TRL", "TRY_currencyISO" : "nuova Lira turca", "TRY_currencyPlural" : "nuove Lire turche", "TRY_currencySingular" : "nuova Lira turca", "TRY_currencySymbol" : "TL", "TTD_currencyISO" : "Dollaro di Trinidad e Tobago", "TTD_currencyPlural" : "nuove Lire turche", "TTD_currencySingular" : "nuova Lira turca", "TTD_currencySymbol" : "TT$", "TWD_currencyISO" : "Nuovo dollaro taiwanese", "TWD_currencyPlural" : "nuove Lire turche", "TWD_currencySingular" : "nuova Lira turca", "TWD_currencySymbol" : "NT$", "TZS_currencyISO" : "Scellino della Tanzania", "TZS_currencyPlural" : "nuove Lire turche", "TZS_currencySingular" : "nuova Lira turca", "TZS_currencySymbol" : "TSh", "UAH_currencyISO" : "Hrivna Ucraina", "UAH_currencyPlural" : "nuove Lire turche", "UAH_currencySingular" : "nuova Lira turca", "UAH_currencySymbol" : "₴", "UAK_currencyISO" : "Karbovanetz Ucraino", "UAK_currencyPlural" : "nuove Lire turche", "UAK_currencySingular" : "nuova Lira turca", "UAK_currencySymbol" : "UAK", "UGS_currencyISO" : "Scellino Ugandese (1966-1987)", "UGS_currencyPlural" : "nuove Lire turche", "UGS_currencySingular" : "nuova Lira turca", "UGS_currencySymbol" : "UGS", "UGX_currencyISO" : "Scellino Ugandese", "UGX_currencyPlural" : "nuove Lire turche", "UGX_currencySingular" : "nuova Lira turca", "UGX_currencySymbol" : "USh", "USD_currencyISO" : "Dollaro Statunitense", "USD_currencyPlural" : "nuove Lire turche", "USD_currencySingular" : "nuova Lira turca", "USD_currencySymbol" : "US$", "USN_currencyISO" : "Dollaro Statunitense (Next day)", "USN_currencyPlural" : "nuove Lire turche", "USN_currencySingular" : "nuova Lira turca", "USN_currencySymbol" : "USN", "USS_currencyISO" : "Dollaro Statunitense (Same day)", "USS_currencyPlural" : "nuove Lire turche", "USS_currencySingular" : "nuova Lira turca", "USS_currencySymbol" : "USS", "UYI_currencyISO" : "Peso uruguaiano in unità indicizzate", "UYI_currencyPlural" : "nuove Lire turche", "UYI_currencySingular" : "nuova Lira turca", "UYI_currencySymbol" : "UYI", "UYP_currencyISO" : "Peso Uruguaiano (1975-1993)", "UYP_currencyPlural" : "nuove Lire turche", "UYP_currencySingular" : "nuova Lira turca", "UYP_currencySymbol" : "UYP", "UYU_currencyISO" : "Peso Uruguayo uruguaiano", "UYU_currencyPlural" : "nuove Lire turche", "UYU_currencySingular" : "nuova Lira turca", "UYU_currencySymbol" : "$U", "UZS_currencyISO" : "Sum dell’Uzbekistan", "UZS_currencyPlural" : "nuove Lire turche", "UZS_currencySingular" : "nuova Lira turca", "UZS_currencySymbol" : "UZS", "VEB_currencyISO" : "Bolivar Venezuelano", "VEB_currencyPlural" : "nuove Lire turche", "VEB_currencySingular" : "nuova Lira turca", "VEB_currencySymbol" : "VEB", "VEF_currencyISO" : "Bolívar venezuelano forte", "VEF_currencyPlural" : "nuove Lire turche", "VEF_currencySingular" : "nuova Lira turca", "VEF_currencySymbol" : "Bs.F.", "VND_currencyISO" : "Dong Vietnamita", "VND_currencyPlural" : "nuove Lire turche", "VND_currencySingular" : "nuova Lira turca", "VND_currencySymbol" : "₫", "VNN_currencyISO" : "Dong Vietnamita", "VNN_currencyPlural" : "nuove Lire turche", "VNN_currencySingular" : "nuova Lira turca", "VNN_currencySymbol" : "₫", "VUV_currencyISO" : "Vatu di Vanuatu", "VUV_currencyPlural" : "nuove Lire turche", "VUV_currencySingular" : "nuova Lira turca", "VUV_currencySymbol" : "VT", "WST_currencyISO" : "Tala della Samoa Occidentale", "WST_currencyPlural" : "nuove Lire turche", "WST_currencySingular" : "nuova Lira turca", "WST_currencySymbol" : "WS$", "XAF_currencyISO" : "Franco CFA BEAC", "XAF_currencyPlural" : "nuove Lire turche", "XAF_currencySingular" : "nuova Lira turca", "XAF_currencySymbol" : "FCFA", "XAG_currencyISO" : "Argento", "XAG_currencyPlural" : "nuove Lire turche", "XAG_currencySingular" : "nuova Lira turca", "XAG_currencySymbol" : "XAG", "XAU_currencyISO" : "Oro", "XAU_currencyPlural" : "nuove Lire turche", "XAU_currencySingular" : "nuova Lira turca", "XAU_currencySymbol" : "XAU", "XBA_currencyISO" : "Unità composita europea", "XBA_currencyPlural" : "nuove Lire turche", "XBA_currencySingular" : "nuova Lira turca", "XBA_currencySymbol" : "XBA", "XBB_currencyISO" : "Unità monetaria europea", "XBB_currencyPlural" : "nuove Lire turche", "XBB_currencySingular" : "nuova Lira turca", "XBB_currencySymbol" : "XBB", "XBC_currencyISO" : "Unità di acconto europea (XBC)", "XBC_currencyPlural" : "nuove Lire turche", "XBC_currencySingular" : "nuova Lira turca", "XBC_currencySymbol" : "XBC", "XBD_currencyISO" : "Unità di acconto europea (XBD)", "XBD_currencyPlural" : "nuove Lire turche", "XBD_currencySingular" : "nuova Lira turca", "XBD_currencySymbol" : "XBD", "XCD_currencyISO" : "Dollaro dei Caraibi Orientali", "XCD_currencyPlural" : "nuove Lire turche", "XCD_currencySingular" : "nuova Lira turca", "XCD_currencySymbol" : "EC$", "XDR_currencyISO" : "Diritti Speciali di Incasso", "XDR_currencyPlural" : "nuove Lire turche", "XDR_currencySingular" : "nuova Lira turca", "XDR_currencySymbol" : "XDR", "XEU_currencyISO" : "Diritti Speciali di Incasso", "XEU_currencyPlural" : "nuove Lire turche", "XEU_currencySingular" : "nuova Lira turca", "XEU_currencySymbol" : "XDR", "XFO_currencyISO" : "Franco Oro Francese", "XFO_currencyPlural" : "nuove Lire turche", "XFO_currencySingular" : "nuova Lira turca", "XFO_currencySymbol" : "XFO", "XFU_currencyISO" : "Franco UIC Francese", "XFU_currencyPlural" : "nuove Lire turche", "XFU_currencySingular" : "nuova Lira turca", "XFU_currencySymbol" : "XFU", "XOF_currencyISO" : "Franco CFA BCEAO", "XOF_currencyPlural" : "nuove Lire turche", "XOF_currencySingular" : "nuova Lira turca", "XOF_currencySymbol" : "CFA", "XPD_currencyISO" : "Palladio", "XPD_currencyPlural" : "nuove Lire turche", "XPD_currencySingular" : "nuova Lira turca", "XPD_currencySymbol" : "XPD", "XPF_currencyISO" : "Franco CFP", "XPF_currencyPlural" : "nuove Lire turche", "XPF_currencySingular" : "nuova Lira turca", "XPF_currencySymbol" : "CFPF", "XPT_currencyISO" : "platino", "XPT_currencyPlural" : "nuove Lire turche", "XPT_currencySingular" : "nuova Lira turca", "XPT_currencySymbol" : "XPT", "XRE_currencyISO" : "fondi RINET", "XRE_currencyPlural" : "nuove Lire turche", "XRE_currencySingular" : "nuova Lira turca", "XRE_currencySymbol" : "XRE", "XSU_currencyISO" : "fondi RINET", "XSU_currencyPlural" : "nuove Lire turche", "XSU_currencySingular" : "nuova Lira turca", "XSU_currencySymbol" : "XRE", "XTS_currencyISO" : "codice di verifica della valuta", "XTS_currencyPlural" : "nuove Lire turche", "XTS_currencySingular" : "nuova Lira turca", "XTS_currencySymbol" : "XTS", "XUA_currencyISO" : "codice di verifica della valuta", "XUA_currencyPlural" : "nuove Lire turche", "XUA_currencySingular" : "nuova Lira turca", "XUA_currencySymbol" : "XTS", "XXX_currencyISO" : "Nessuna valuta", "XXX_currencyPlural" : "nuove Lire turche", "XXX_currencySingular" : "valuta sconosciuta/non valida", "XXX_currencySymbol" : "XXX", "YDD_currencyISO" : "Dinaro dello Yemen", "YDD_currencyPlural" : "nuove Lire turche", "YDD_currencySingular" : "valuta sconosciuta/non valida", "YDD_currencySymbol" : "YDD", "YER_currencyISO" : "Rial dello Yemen", "YER_currencyPlural" : "nuove Lire turche", "YER_currencySingular" : "valuta sconosciuta/non valida", "YER_currencySymbol" : "YR", "YUD_currencyISO" : "Dinaro Forte Yugoslavo", "YUD_currencyPlural" : "nuove Lire turche", "YUD_currencySingular" : "valuta sconosciuta/non valida", "YUD_currencySymbol" : "YUD", "YUM_currencyISO" : "Dinaro Noviy Yugoslavo", "YUM_currencyPlural" : "nuove Lire turche", "YUM_currencySingular" : "valuta sconosciuta/non valida", "YUM_currencySymbol" : "YUM", "YUN_currencyISO" : "Dinaro Convertibile Yugoslavo", "YUN_currencyPlural" : "nuove Lire turche", "YUN_currencySingular" : "valuta sconosciuta/non valida", "YUN_currencySymbol" : "YUN", "YUR_currencyISO" : "Dinaro Convertibile Yugoslavo", "YUR_currencyPlural" : "nuove Lire turche", "YUR_currencySingular" : "valuta sconosciuta/non valida", "YUR_currencySymbol" : "YUN", "ZAL_currencyISO" : "Rand Sudafricano (finanziario)", "ZAL_currencyPlural" : "nuove Lire turche", "ZAL_currencySingular" : "valuta sconosciuta/non valida", "ZAL_currencySymbol" : "ZAL", "ZAR_currencyISO" : "Rand Sudafricano", "ZAR_currencyPlural" : "nuove Lire turche", "ZAR_currencySingular" : "valuta sconosciuta/non valida", "ZAR_currencySymbol" : "R", "ZMK_currencyISO" : "Kwacha dello Zambia", "ZMK_currencyPlural" : "nuove Lire turche", "ZMK_currencySingular" : "valuta sconosciuta/non valida", "ZMK_currencySymbol" : "ZK", "ZRN_currencyISO" : "Nuovo Zaire dello Zaire", "ZRN_currencyPlural" : "nuove Lire turche", "ZRN_currencySingular" : "valuta sconosciuta/non valida", "ZRN_currencySymbol" : "NZ", "ZRZ_currencyISO" : "Zaire dello Zaire", "ZRZ_currencyPlural" : "nuove Lire turche", "ZRZ_currencySingular" : "valuta sconosciuta/non valida", "ZRZ_currencySymbol" : "ZRZ", "ZWD_currencyISO" : "Dollaro dello Zimbabwe", "ZWD_currencyPlural" : "nuove Lire turche", "ZWD_currencySingular" : "valuta sconosciuta/non valida", "ZWD_currencySymbol" : "Z$", "ZWL_currencyISO" : "Dollaro dello Zimbabwe", "ZWL_currencyPlural" : "nuove Lire turche", "ZWL_currencySingular" : "valuta sconosciuta/non valida", "ZWL_currencySymbol" : "Z$", "ZWR_currencyISO" : "Dollaro dello Zimbabwe", "ZWR_currencyPlural" : "nuove Lire turche", "ZWR_currencySingular" : "valuta sconosciuta/non valida", "ZWR_currencySymbol" : "Z$", "currencyFormat" : "¤ #,##0.00;¤-#,##0.00", "currencyPatternPlural" : "e u", "currencyPatternSingular" : "{0} {1}", "decimalFormat" : "#,##0.###", "decimalSeparator" : ".", "defaultCurrency" : "CHF", "exponentialSymbol" : "E", "groupingSeparator" : "'", "infinitySign" : "∞", "minusSign" : "-", "nanSymbol" : "NaN", "numberZero" : "0", "perMilleSign" : "‰", "percentFormat" : "#,##0%", "percentSign" : "%", "plusSign" : "+", "scientificFormat" : "#E0" }
/** * @author Titus Wormer * @copyright 2015 Titus Wormer * @license MIT * @module remark:parse:tokenize:delete * @fileoverview Tokenise strikethrough. */ 'use strict'; /* Dependencies. */ var whitespace = require('is-whitespace-character'); var locate = require('../locate/delete'); /* Expose. */ module.exports = strikethrough; strikethrough.locator = locate; /* Constants. */ var C_TILDE = '~'; var DOUBLE = '~~'; /** * Tokenise strikethrough. * * @property {Function} locator. * @param {function(string)} eat - Eater. * @param {string} value - Rest of content. * @param {boolean?} [silent] - Whether this is a dry run. * @return {Node?|boolean} - `delete` node. */ function strikethrough(eat, value, silent) { var self = this; var character = ''; var previous = ''; var preceding = ''; var subvalue = ''; var index; var length; var now; if ( !self.options.gfm || value.charAt(0) !== C_TILDE || value.charAt(1) !== C_TILDE || whitespace(value.charAt(2)) ) { return; } index = 1; length = value.length; now = eat.now(); now.column += 2; now.offset += 2; while (++index < length) { character = value.charAt(index); if ( character === C_TILDE && previous === C_TILDE && (!preceding || !whitespace(preceding)) ) { /* istanbul ignore if - never used (yet) */ if (silent) { return true; } return eat(DOUBLE + subvalue + DOUBLE)({ type: 'delete', children: self.tokenizeInline(subvalue, now) }); } subvalue += previous; preceding = previous; previous = character; } }
import { expirationOptions, privacyOptions } from '../config/constants'; const maxFileSize = 50000000; const maxTextLength = 50000000; const minTextLength = 3; export const fileValidation = (file) => { let errors = []; if (file.size > maxFileSize) { errors.push('File larger than 50mb file size limit.'); } return { passed: !errors.length, errors }; }; /** * A validation module for posting pastes. * This allows consistency of validation for client and server. * @param {object} data * @returns {object} */ export const pasteValidation = (data) => { let errors = []; // Validations if a file upload exists if (data.file) { errors = errors.concat(fileValidation(data.file).errors); } else if (!data.text) { errors.push('Please provide text or a file.'); } else if (data.text.length < 3) { errors.push(`Minimum text length is ${minTextLength} characters.`); } else if (data.text.length > maxTextLength) { errors.push('Exceeded maximum text length.'); } if (!expirationOptions.includes(data.expiration)) { errors.push('Please select a valid expiration option.'); } if (!Object.keys(privacyOptions).includes(data.privacy)) { errors.push('Please select a valid privacy option.'); } return { passed: !errors.length, errors }; };
import { module, test } from 'qunit'; import Ember from "ember"; import { visit } from 'ember-native-dom-helpers'; import require from 'require'; const { run, A: emberA, Application } = Ember; let EmberDebug; let port, name, message; let App; function setupApp() { App = Application.create(); App.setupForTesting(); App.injectTestHelpers(); App.Router.map(function() { this.route('simple'); }); } module("Container Debug", { beforeEach() { EmberDebug = require('ember-debug/main').default; EmberDebug.Port = EmberDebug.Port.extend({ init() {}, send(n, m) { name = n; message = m; } }); run(function() { setupApp(); EmberDebug.set('application', App); }); run(EmberDebug, 'start'); port = EmberDebug.port; }, afterEach() { name = null; message = null; EmberDebug.destroyContainer(); run(App, 'destroy'); } }); test("#getTypes", async function t(assert) { await visit('/simple'); port.trigger('container:getTypes'); await wait(); assert.equal(name, 'container:types'); let types = emberA(message.types); assert.ok(types.findBy('name', 'controller')); assert.ok(types.findBy('name', 'route')); }); test("#getInstances", async function t(assert) { await visit('/simple'); port.trigger('container:getInstances', { containerType: 'controller' }); await wait(); assert.equal(name, 'container:instances'); let instances = emberA(message.instances); assert.ok(instances.findBy('name', 'simple')); }); test("#getInstances on a non existing type", async function t(assert) { await visit('/simple'); port.trigger('container:getInstances', { containerType: 'not-here' }); await wait(); assert.equal(name, 'container:instances'); assert.equal(message.status, 404); });
'use strict'; var crypto = require('crypto'); var x11hash = require('x11-hash'); var bignum = require('bignum'); var Binary = require('binary'); var Put = require('bufferput'); var buffertools = require('buffertools'); var sjcl = require('../lib/sjcl'); if (process.browser) { var hashjs = require('hash.js'); } exports.x11 = function(data) { return x11hash.digest(data); }; var sha256 = exports.sha256 = function(data) { return new Buffer(crypto.createHash('sha256').update(data).digest('binary'), 'binary'); }; var sha512 = exports.sha512 = function(data) { if (process.browser) { var datahex = data.toString('hex'); var databits = sjcl.codec.hex.toBits(datahex); var hashbits = sjcl.hash.sha512.hash(databits); var hashhex = sjcl.codec.hex.fromBits(hashbits); var hash = new Buffer(hashhex, 'hex'); return hash; }; return new Buffer(crypto.createHash('sha512').update(data).digest('binary'), 'binary'); }; var sha512hmac = exports.sha512hmac = function(data, key) { if (process.browser) { var skey = sjcl.codec.hex.toBits(key.toString('hex')); var sdata = sjcl.codec.hex.toBits(data.toString('hex')); var hmac = new sjcl.misc.hmac(skey, sjcl.hash.sha512); var encrypted = hmac.encrypt(sdata); var enchex = sjcl.codec.hex.fromBits(encrypted); var encbuf = new Buffer(enchex, 'hex'); return encbuf; }; var hmac = crypto.createHmac('sha512', key); var hash = hmac.update(data).digest(); return hash; }; var ripe160 = exports.ripe160 = function(data) { if (process.browser) { return new Buffer(hashjs.ripemd160().update(data).digest()); } return new Buffer(crypto.createHash('rmd160').update(data).digest('binary'), 'binary'); }; var sha1 = exports.sha1 = function(data) { return new Buffer(crypto.createHash('sha1').update(data).digest('binary'), 'binary'); }; var twoSha256 = exports.twoSha256 = function(data) { return sha256(sha256(data)); }; var sha256ripe160 = exports.sha256ripe160 = function(data) { return ripe160(sha256(data)); }; /** * Format a block hash like the official client does. */ var formatHash = exports.formatHash = function(hash) { var hashEnd = new Buffer(10); hash.copy(hashEnd, 0, 22, 32); return buffertools.reverse(hashEnd).toString('hex'); }; /** * Display the whole hash, as hex, in correct endian order. */ var formatHashFull = exports.formatHashFull = function(hash) { var copy = new Buffer(hash.length); hash.copy(copy); var hex = buffertools.toHex(buffertools.reverse(copy)); return hex; }; /** * Format a block hash like Block Explorer does. * * Formats a block hash by removing leading zeros and truncating to 10 characters. */ var formatHashAlt = exports.formatHashAlt = function(hash) { var hex = formatHashFull(hash); hex = hex.replace(/^0*/, ''); return hex.substr(0, 10); }; var formatBuffer = exports.formatBuffer = function(buffer, maxLen) { // Calculate amount of bytes to display if (maxLen === null) { maxLen = 10; } if (maxLen > buffer.length || maxLen === 0) { maxLen = buffer.length; } // Copy those bytes into a temporary buffer var temp = new Buffer(maxLen); buffer.copy(temp, 0, 0, maxLen); // Format as string var output = buffertools.toHex(temp); if (temp.length < buffer.length) { output += "..."; } return output; }; var valueToBigInt = exports.valueToBigInt = function(valueBuffer) { if (Buffer.isBuffer(valueBuffer)) { return bignum.fromBuffer(valueBuffer, { endian: 'little', size: 8 }); } else { return valueBuffer; } }; var bigIntToValue = exports.bigIntToValue = function(valueBigInt) { if (Buffer.isBuffer(valueBigInt)) { return valueBigInt; } else { return valueBigInt.toBuffer({ endian: 'little', size: 8 }); } }; var fitsInNBits = function(integer, n) { // TODO: make this efficient!!! return integer.toString(2).replace('-', '').length < n; }; var bytesNeededToStore = exports.bytesNeededToStore = function(integer) { if (integer === 0) return 0; return Math.ceil(((integer).toString(2).replace('-', '').length + 1) / 8); }; var negativeBuffer = exports.negativeBuffer = function(b) { // implement two-complement negative var c = new Buffer(b.length); // negate each byte for (var i = 0; i < b.length; i++) { c[i] = ~b[i]; if (c[i] < 0) c[i] += 256; } // add one for (var i = b.length - 1; i >= 0; i--) { c[i] += 1; if (c[i] >= 256) c[i] -= 256; if (c[i] !== 0) break; } return c; }; /* * Transforms an integer into a buffer using two-complement encoding * For example, 1 is encoded as 01 and -1 is encoded as ff * For more info see: * http://en.wikipedia.org/wiki/Signed_number_representations#Two.27s_complement */ exports.intToBuffer2C = function(integer) { var size = bytesNeededToStore(integer); var buf = new Put(); var s = integer.toString(16); var neg = s[0] === '-'; s = s.replace('-', ''); for (var i = 0; i < size; i++) { var si = s.substring(s.length - 2 * (i + 1), s.length - 2 * (i)); if (si.length === 1) { si = '0' + si; } var pi = parseInt(si, 16); buf.word8(pi); } var ret = buf.buffer(); if (neg) { ret = buffertools.reverse(ret); ret = negativeBuffer(ret); ret = buffertools.reverse(ret); } return ret; }; var padSign = function(b) { var c; if (b[0] & 0x80) { c = new Buffer(b.length + 1); b.copy(c, 1); c[0] = 0; } else { c = b; } return c; } /* * Transforms an integer into a buffer using sign+magnitude encoding * For example, 1 is encoded as 01 and -1 is encoded as 81 * For more info see: * http://en.wikipedia.org/wiki/Signed_number_representations#Signed_magnitude_representation */ exports.intToBufferSM = function(v) { if ("number" === typeof v) { v = bignum(v); } var b, c; var cmp = v.cmp(0); if (cmp > 0) { b = v.toBuffer(); c = padSign(b); c = buffertools.reverse(c); } else if (cmp == 0) { c = new Buffer([]); } else { b = v.neg().toBuffer(); c = padSign(b); c[0] |= 0x80; c = buffertools.reverse(c); } return c; }; /* * Reverse of intToBufferSM */ exports.bufferSMToInt = function(v) { if (!v.length) { return bignum(0); } // Arithmetic operands must be in range [-2^31...2^31] if (v.length > 4) { throw new Error('Bigint cast overflow (> 4 bytes)'); } var w = new Buffer(v.length); v.copy(w); w = buffertools.reverse(w); var isNeg = w[0] & 0x80; if (isNeg) { w[0] &= 0x7f; return bignum.fromBuffer(w).neg(); } else { return bignum.fromBuffer(w); } }; var formatValue = exports.formatValue = function(valueBuffer) { var value = valueToBigInt(valueBuffer).toString(); var integerPart = value.length > 8 ? value.substr(0, value.length - 8) : '0'; var decimalPart = value.length > 8 ? value.substr(value.length - 8) : value; while (decimalPart.length < 8) { decimalPart = "0" + decimalPart; } decimalPart = decimalPart.replace(/0*$/, ''); while (decimalPart.length < 2) { decimalPart += "0"; } return integerPart + "." + decimalPart; }; var reFullVal = /^\s*(\d+)\.(\d+)/; var reFracVal = /^\s*\.(\d+)/; var reWholeVal = /^\s*(\d+)$/; var reSciNotation = /[+\-]?(?:0|[1-9]\d*)(?:\.\d*)?(?:[eE][+\-]?\d+)?/; function padFrac(frac) { frac = frac.substr(0, 8); //truncate to 8 decimal places while (frac.length < 8) frac = frac + '0'; return frac; } function parseFullValue(res) { return bignum(res[1]).mul('100000000').add(padFrac(res[2])); } function parseFracValue(res) { return bignum(padFrac(res[1])); } function parseWholeValue(res) { return bignum(res[1]).mul('100000000'); } exports.parseValue = function parseValue(valueStr) { if (typeof valueStr !== 'string') valueStr = valueStr.toString(); var res; res = valueStr.match(reFracVal); if (res) return parseFracValue(res); res = valueStr.match(reSciNotation); if (res) { var f = parseFloat(res[0]); valueStr = f.toFixed(8).toString(); } res = valueStr.match(reFullVal); if (res) return parseFullValue(res); res = valueStr.match(reWholeVal); if (res) return parseWholeValue(res); return undefined; }; // Utility that synchronizes function calls based on a key var createSynchrotron = exports.createSynchrotron = function(fn) { var table = {}; return function(key) { var args = Array.prototype.slice.call(arguments); var run = function() { // Function fn() will call when it finishes args[0] = function next() { if (table[key]) { if (table[key].length) { table[key].shift()(); } else { delete table[key]; } } }; fn.apply(null, args); }; if (!table[key]) { table[key] = []; run(); } else { table[key].push(run); } }; }; /** * Decode difficulty bits. * * This function calculates the difficulty target given the difficulty bits. */ var decodeDiffBits = exports.decodeDiffBits = function(diffBits, asBigInt) { diffBits = +diffBits; var target = bignum(diffBits & 0xffffff); /* * shiftLeft is not implemented on the bignum browser * * target = target.shiftLeft(8*((diffBits >>> 24) - 3)); */ var mov = 8 * ((diffBits >>> 24) - 3); while (mov-- > 0) target = target.mul(2); if (asBigInt) { return target; } // Convert to buffer var diffBuf = target.toBuffer(); var targetBuf = new Buffer(32); buffertools.fill(targetBuf, 0); diffBuf.copy(targetBuf, 32 - diffBuf.length); return targetBuf; }; /** * Encode difficulty bits. * * This function calculates the compact difficulty, given a difficulty target. */ var encodeDiffBits = exports.encodeDiffBits = function encodeDiffBits(target) { if (Buffer.isBuffer(target)) { target = bignum.fromBuffer(target); } else if ("function" === typeof target.toBuffer) { // duck-typing bignum // Nothing to do } else { throw new Error("Incorrect variable type for difficulty"); } var mpiBuf = target.toBuffer("mpint"); var size = mpiBuf.length - 4; var compact = size << 24; if (size >= 1) compact |= mpiBuf[4] << 16; if (size >= 2) compact |= mpiBuf[5] << 8; if (size >= 3) compact |= mpiBuf[6]; return compact; }; /** * Calculate "difficulty". * * This function calculates the maximum difficulty target divided by the given * difficulty target. */ var calcDifficulty = exports.calcDifficulty = function(target) { if (!Buffer.isBuffer(target)) { target = decodeDiffBits(target); } var targetBigint = bignum.fromBuffer(target, { order: 'forward' }); var maxBigint = bignum.fromBuffer(MAX_TARGET, { order: 'forward' }); return maxBigint.div(targetBigint).toNumber(); }; var reverseBytes32 = exports.reverseBytes32 = function(data) { if (data.length % 4) { throw new Error("Util.reverseBytes32(): Data length must be multiple of 4"); } var put = new Put(); var parser = Binary.parse(data); while (!parser.eof()) { var word = parser.word32le('word').vars.word; put.word32be(word); } return put.buffer(); }; var getVarIntSize = exports.getVarIntSize = function getVarIntSize(i) { if (i < 253) { // unsigned char return 1; } else if (i < 0x10000) { // unsigned short (LE) return 3; } else if (i < 0x100000000) { // unsigned int (LE) return 5; } else { // unsigned long long (LE) return 9; } }; var varIntBuf = exports.varIntBuf = function varIntBuf(n) { var buf = undefined; if (n < 253) { buf = new Buffer(1); buf.writeUInt8(n, 0); } else if (n < 0x10000) { buf = new Buffer(1 + 2); buf.writeUInt8(253, 0); buf.writeUInt16LE(n, 1); } else if (n < 0x100000000) { buf = new Buffer(1 + 4); buf.writeUInt8(254, 0); buf.writeUInt32LE(n, 1); } else { buf = new Buffer(1 + 8); buf.writeUInt8(255, 0); buf.writeInt32LE(n & -1, 1); buf.writeUInt32LE(Math.floor(n / 0x100000000), 5); } return buf; }; var varStrBuf = exports.varStrBuf = function varStrBuf(s) { return Buffer.concat([varIntBuf(s.length), s]); }; // Initializations exports.NULL_HASH = buffertools.fill(new Buffer(32), 0); exports.EMPTY_BUFFER = new Buffer(0); exports.ZERO_VALUE = buffertools.fill(new Buffer(8), 0); var INT64_MAX = new Buffer('ffffffffffffffff', 'hex'); exports.INT64_MAX = INT64_MAX; // How much of Bitcoin's internal integer coin representation // makes 1 BTC exports.COIN = 100000000; exports.BIT = 100; var MAX_TARGET = exports.MAX_TARGET = new Buffer('00000000FFFF0000000000000000000000000000000000000000000000000000', 'hex');
"use strict"; module.exports = EntryWriter; var tar = require("../tar.js"), TarHeader = require("./header.js"), Entry = require("./entry.js"), inherits = require("inherits"), BlockStream = require("block-stream"), ExtendedHeaderWriter, Stream = require("stream").Stream, EOF = {}; inherits(EntryWriter, Stream); function EntryWriter(props) { var me = this; if (!(me instanceof EntryWriter)) { return new EntryWriter(props); } Stream.apply(this); me.writable = true; me.readable = true; me._stream = new BlockStream(512); me._stream.on("data", function (c) { me.emit("data", c); }); me._stream.on("drain", function () { me.emit("drain"); }); me._stream.on("end", function () { me.emit("end"); me.emit("close"); }); me.props = props; if (props.type === "Directory") { props.size = 0; } props.ustar = "ustar\0"; props.ustarver = "00"; me.path = props.path; me._buffer = []; me._didHeader = false; me._meta = false; me.on("pipe", function () { me._process(); }); } EntryWriter.prototype.write = function (c) { // console.error(".. ew write") if (this._ended) return this.emit("error", new Error("write after end")); this._buffer.push(c); this._process(); this._needDrain = this._buffer.length > 0; return !this._needDrain; }; EntryWriter.prototype.end = function (c) { // console.error(".. ew end") if (c) this._buffer.push(c); this._buffer.push(EOF); this._ended = true; this._process(); this._needDrain = this._buffer.length > 0; }; EntryWriter.prototype.pause = function () { // console.error(".. ew pause") this._paused = true; this.emit("pause"); }; EntryWriter.prototype.resume = function () { // console.error(".. ew resume") this._paused = false; this.emit("resume"); this._process(); }; EntryWriter.prototype.add = function (entry) { // console.error(".. ew add") if (!this.parent) return this.emit("error", new Error("no parent")); // make sure that the _header and such is emitted, and clear out // the _currentEntry link on the parent. if (!this._ended) this.end(); return this.parent.add(entry); }; EntryWriter.prototype._header = function () { // console.error(".. ew header") if (this._didHeader) return; this._didHeader = true; var headerBlock = TarHeader.encode(this.props); if (this.props.needExtended && !this._meta) { var me = this; ExtendedHeaderWriter = ExtendedHeaderWriter || require("./extended-header-writer.js"); ExtendedHeaderWriter(this.props).on("data", function (c) { me.emit("data", c); }).on("error", function (er) { me.emit("error", er); }).end(); } // console.error(".. .. ew headerBlock emitting") this.emit("data", headerBlock); this.emit("header"); }; EntryWriter.prototype._process = function () { // console.error(".. .. ew process") if (!this._didHeader && !this._meta) { this._header(); } if (this._paused || this._processing) { // console.error(".. .. .. paused=%j, processing=%j", this._paused, this._processing) return; } this._processing = true; var buf = this._buffer; for (var i = 0; i < buf.length; i++) { // console.error(".. .. .. i=%d", i) var c = buf[i]; if (c === EOF) this._stream.end();else this._stream.write(c); if (this._paused) { // console.error(".. .. .. paused mid-emission") this._processing = false; if (i < buf.length) { this._needDrain = true; this._buffer = buf.slice(i + 1); } return; } } // console.error(".. .. .. emitted") this._buffer.length = 0; this._processing = false; // console.error(".. .. .. emitting drain") this.emit("drain"); }; EntryWriter.prototype.destroy = function () {}; //# sourceMappingURL=entry-writer-compiled.js.map
'use strict'; var React = require('react'); var SvgIcon = require('../../svg-icon'); var AvPlayCircleFilled = React.createClass({ displayName: 'AvPlayCircleFilled', render: function render() { return React.createElement( SvgIcon, this.props, React.createElement('path', { d: 'M12 2C6.48 2 2 6.48 2 12s4.48 10 10 10 10-4.48 10-10S17.52 2 12 2zm-2 14.5v-9l6 4.5-6 4.5z' }) ); } }); module.exports = AvPlayCircleFilled;
(function() { 'use strict'; angular .module('siteApp') .config(stateConfig); stateConfig.$inject = ['$stateProvider']; function stateConfig($stateProvider) { $stateProvider.state('jhi-health', { parent: 'admin', url: '/health', data: { authorities: ['ROLE_ADMIN'], pageTitle: 'Health Checks' }, views: { 'content@': { templateUrl: 'app/admin/health/health.html', controller: 'JhiHealthCheckController', controllerAs: 'vm' } } }); } })();
var fragmentShaderHeader = ['' // PREDEFINED STUFF FOR FRAGMENT SHADERS ,' precision highp float;' ].join('\n'); function SceneObject(vertices) { var bpe = Float32Array.BYTES_PER_ELEMENT; this.vertexSize = 6; this.setVertices = function(vertices) { this.vertices = vertices; } this.init = function(gl) { if (! this.gl) { this.gl = gl; if (! this.buffer) { this.buffer = gl.createBuffer(); this.vertexData = new Float32Array(this.vertices); } } gl.bindBuffer(gl.ARRAY_BUFFER, this.buffer); gl.bufferData(gl.ARRAY_BUFFER, this.vertexData, gl.STATIC_DRAW); this.bindVertexAttribute('aPos', 3, gl.FLOAT, 6, 0); this.bindVertexAttribute('aNor', 3, gl.FLOAT, 6, 3); } this.bindVertexAttribute = function(name, len, type, stride, offset) { var gl = this.gl; var attr = gl.getAttribLocation(gl.program, name); gl.enableVertexAttribArray(attr); gl.vertexAttribPointer(attr, len, type, false, stride * bpe, offset * bpe); } } function Scene() { this.objects = []; this.addObject = function(obj) { this.objects.push(obj); } this.init = function(gl) { for (var n = 0 ; n < this.objects.length ; n++) this.objects[n].init(gl); } } function gl_start(canvas, vertexShader, fragmentShader) { // START WEBGL RUNNING IN A CANVAS try { canvas.gl = canvas.getContext('experimental-webgl'); // Make sure WebGl is supported. } catch (e) { throw 'Sorry, your browser does not support WebGL.'; } setTimeout(function() { canvas.setShaders = function(vertexShader, fragmentShader) { // Add the vertex and fragment shaders: var gl = this.gl, program = gl.createProgram(); // Create the WebGL program. function addshader(type, src) { // Create and attach a WebGL shader. var shader = gl.createShader(type); gl.shaderSource(shader, src); gl.compileShader(shader); if (! gl.getShaderParameter(shader, gl.COMPILE_STATUS)) console.log('Cannot compile shader:\n\n' + gl.getShaderInfoLog(shader)); gl.attachShader(program, shader); }; addshader(gl.VERTEX_SHADER , vertexShader ); // Add the vertex and fragment shaders. addshader(gl.FRAGMENT_SHADER, fragmentShaderHeader + fragmentShader); gl.linkProgram(program); // Link the program and report any errors. if (! gl.getProgramParameter(program, gl.LINK_STATUS)) console.log('Could not link the shader program!'); gl.useProgram(program); gl.uTime = gl.getUniformLocation(program, 'uTime'); // Remember address of uTime variable. gl.program = program; } canvas.setShaders(vertexShader, fragmentShader); // Initialize everything, setInterval(function() { // Start the animation loop. var gl = canvas.gl, scene = canvas.scene; if (! scene || ! gl.program) return; if (gl.startTime === undefined) // First time through, gl.startTime = Date.now(); // record the start time. gl.uniform1f(gl.uTime, (Date.now() - gl.startTime) / 1000); // Set time for the shaders. for (var n = 0 ; n < scene.objects.length ; n++) { var obj = scene.objects[n]; obj.init(gl); gl.drawArrays(gl.TRIANGLES, 0, obj.vertices.length / obj.vertexSize); } }, 30); }, 100); // Wait 100 milliseconds after page has loaded before starting WebGL. } function addTextEditor(code, callback) { // Add a text editor to the web page: document.body.innerHTML = ['' ,'<table><tr><td width=10></td><td valign=top>' // Insert new html for textArea into the page. ,'<textArea id=textArea ' ,'style="font:13px courier;outline-width:0;border-style:none;resize:none;overflow:scroll;"' ,'></textArea>' ,'</td><td valign=top>' + document.body.innerHTML + '</td></tr></table>' ].join(''); textArea.value = code; // Set its current text to user-provided code. var i = 0, text = textArea.value.split('\n'); // Set the correct number of rows and columns. textArea.rows = Math.max(text.length, 50); while (i < text.length) textArea.cols = Math.max(textArea.cols, text[i++].length); textArea.style.backgroundColor = 'black'; // Set the text editor's text and bg colors. textArea.style.color = 'white'; textArea.onkeyup = callback; // User-provided callback function on keystroke. }
import createSvgIcon from './utils/createSvgIcon'; import { jsx as _jsx } from "react/jsx-runtime"; export default createSvgIcon( /*#__PURE__*/_jsx("path", { d: "M12 12.75c1.63 0 3.07.39 4.24.9 1.08.48 1.76 1.56 1.76 2.73V18H6v-1.61c0-1.18.68-2.26 1.76-2.73 1.17-.52 2.61-.91 4.24-.91zM4 13c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm1.13 1.1c-.37-.06-.74-.1-1.13-.1-.99 0-1.93.21-2.78.58C.48 14.9 0 15.62 0 16.43V18h4.5v-1.61c0-.83.23-1.61.63-2.29zM20 13c1.1 0 2-.9 2-2s-.9-2-2-2-2 .9-2 2 .9 2 2 2zm4 3.43c0-.81-.48-1.53-1.22-1.85-.85-.37-1.79-.58-2.78-.58-.39 0-.76.04-1.13.1.4.68.63 1.46.63 2.29V18H24v-1.57zM12 6c1.66 0 3 1.34 3 3s-1.34 3-3 3-3-1.34-3-3 1.34-3 3-3z" }), 'GroupsSharp');
(function () { 'use strict'; angular .module('app.pages.viewCv', []) .config(config); /** @ngInject */ function config($stateProvider, $translatePartialLoaderProvider, msApiProvider, msNavigationServiceProvider) { // State $stateProvider .state('app.viewCv', { url : '/viewcv', views : { 'content@app': { templateUrl: 'app/main/cvs/viewcv/viewCv.html', controller : 'viewCv' } }, }); // Api msApiProvider.register('sample', ['app/data/sample/sample.json']); // Navigation // msNavigationServiceProvider.saveItem('fuse', { // title : 'viewCv', // group : true, // weight: 1 // }); // // msNavigationServiceProvider.saveItem('fuse.viewCv', { // title : 'Sample', // icon : 'icon-tile-four', // state : 'app.viewCv', // /*stateParams: { // 'param1': 'page' // },*/ // weight : 1 // }); } })();
'use strict'; const expect = require('chai').expect; const EventEmitter = require('events'); const risk = require('../../lib'); describe('start game', function () { const gameListener = new EventEmitter(); const playerListener = new EventEmitter(); const options = { listener: gameListener, players: [ { id: '1', listener: playerListener }, { id: '2', listener: playerListener }, { id: '3', listener: playerListener } ] }; let game = null; before(function () { game = risk.Game(options); }); it('has correct property values', function () { expect(game.options).to.be.an('object'); expect(game.options).to.have.all.keys([ 'players', 'map', 'debug', 'jokerCard', 'jokerCards', 'cardBonus', 'cardTypes', 'startUnits', 'listener' ]); expect(game.phase).to.equal('setup_a'); expect(game.turnPhase).to.equal('placement'); expect(game.isGameOver()).to.equal(false); expect(game.players.length).to.equal(3); expect(game.getAvailableUnits('1')).to.equal(35); expect(game.battle).to.equal(null); expect(game.getPlayer('2')).to.deep.equal({ id: '2', dead: false, territoryIds: [], cardsCount: 0 }); for (const actionName of Object.keys(game.act)) { const action = game.act[actionName]; expect(() => action()).to.throw('Game has not started.'); } }); context('start game', function () { const gameEvents = Object.keys(risk.GAME_EVENTS).reduce((prev, eventName) => { prev[eventName] = []; return prev; }, {}); const playerEvents = Object.keys(risk.PLAYER_EVENTS).reduce((prev, eventName) => { prev[eventName] = []; return prev; }, {}); let startedBefore = null; let startedAfter = null; before(function () { gameListener.on(risk.GAME_EVENTS.GAME_START, data => { gameEvents.GAME_START.push(data); }); gameListener.on(risk.GAME_EVENTS.TURN_CHANGE, data => { gameEvents.TURN_CHANGE.push(data); }); gameListener.on(risk.GAME_EVENTS.PHASE_CHANGE, data => { gameEvents.PHASE_CHANGE.push(data); }); playerListener.on(risk.PLAYER_EVENTS.REQUIRE_TERRITORY_CLAIM, data => { playerEvents.REQUIRE_TERRITORY_CLAIM.push(data); }); startedBefore = game.isStarted(); game.start(); startedAfter = game.isStarted(); }); it('throws errors when forbidden methods are called', function () { const forbiddenActions = Object.keys(risk.PHASE_METHODS).reduce((prev, phase) => { return phase !== 'setup_a' ? prev.concat(risk.PHASE_METHODS[phase]) : prev; }, []); for (const actionName of forbiddenActions) { expect(() => game.act[actionName]()).to.throw('Action is not allowed in game phase "setup_a".'); } }); it('game is started', function () { expect(startedBefore).to.equal(false); expect(startedAfter).to.equal(true); }); it('emitted GAME_START game event', function () { expect(gameEvents.GAME_START).to.deep.equal([ { message: 'The game has started.' } ]); }); it('emitted TURN_CHANGE game event', function () { expect(gameEvents.TURN_CHANGE[0]).to.have.property('message'); expect(gameEvents.TURN_CHANGE[0].message).to.match(/^The turn has changed to player/); expect(gameEvents.TURN_CHANGE[0]).to.have.property('playerId'); expect(gameEvents.TURN_CHANGE[0].playerId).to.be.oneOf(options.players.map(player => player.id)); }); it('emitted PHASE_CHANGE game event', function () { const playerId = gameEvents.TURN_CHANGE[0].playerId; expect(gameEvents.PHASE_CHANGE[0]).to.have.property('message'); expect(gameEvents.PHASE_CHANGE[0].message).to.match(/^The game phase has changed to "setup_a". Turn is to player/); expect(gameEvents.PHASE_CHANGE[0]).to.have.property('playerId'); expect(gameEvents.PHASE_CHANGE[0].playerId).to.equal(playerId); expect(gameEvents.PHASE_CHANGE[0]).to.have.property('phase', 'setup_a'); }); it('emitted REQUIRE_TERRITORY_CLAIM player event', function () { const playerId = gameEvents.TURN_CHANGE[0].playerId; expect(playerEvents.REQUIRE_TERRITORY_CLAIM[0]).to.have.property('territoryIds'); expect(playerEvents.REQUIRE_TERRITORY_CLAIM[0].territoryIds).to.be.an('array'); expect(playerEvents.REQUIRE_TERRITORY_CLAIM[0]).to.have.property('message'); expect(playerEvents.REQUIRE_TERRITORY_CLAIM[0].message).to.match(/^You must claim a territory. Available/); expect(playerEvents.REQUIRE_TERRITORY_CLAIM[0]).to.have.property('playerId'); expect(playerEvents.REQUIRE_TERRITORY_CLAIM[0].playerId).to.equal(playerId); }); }); });
/* jquery.nexTree.checkbox.js http://www.extgrid.com author:nobo qq:505931977 QQ交流群:13197510 email:zere.nobo@gmail.com or QQ邮箱 +----------------------------------------------------------------------------------------------------------------------------+ */ ;(function($){ "use strict"; $.fn.toTree = function(cfg){//如果url='' 只能处理简单的table比如 表头不会包含的合并之类 var undef; cfg = Nex.tree._undef(cfg,{}); var list = []; var _tree = new Nex.tree(); var ifield = _tree.C(); var list = []; this.each(function(i){ if( $(this).attr( 'data-options' ) ) { var opt = "{"+ $(this).attr( 'data-options' ) +"}"; opt = eval("("+opt+")"); } else { var opt = {}; } $.extend(opt,cfg); opt.cls = $(this).attr("class"); var _attrs = $.extend({},ifield,opt); var fields = {}; for( var _p in _attrs ) { if(/[a-zA-z0-9]Field$/.test(_p)) { fields[_p] = _attrs[_p]; } } var nodes = []; //遍历ul var map_node = function(ul,parent){ $(">li",$(ul)).each(function(i){ var d = {}; var li = $(this); for( var f in fields ) { if( f === 'childrenField' ) continue; var field = fields[f]; if( li.attr(field) === undef || !li.attr(field).toString().length ) continue; d[fields[f]] = li.attr(fields[f]); } d[fields['textField']] = $.trim(li.find(">span").html()); if( parent !== undef ) { parent.children = parent.children === undef ? [] : parent.children; parent.children.push(d); } var _ul = $(">ul",li); if( _ul.length ) { map_node(_ul,d); } if( parent === undef ) { nodes.push(d); } }); }; map_node( $(this) ); opt.data = nodes; if( opt.renderTo && $(opt.renderTo).length ){ var tree = $(opt.renderTo).nexTree(opt); $(this).remove(); } else { var wid = 'wtree'+Nex.aid++; var wraper = $("<div id='"+wid+"'></div>").appendTo(document.body); var tree = wraper.nexTree(opt); list.push(tree); $(this).after(wraper); $(this).remove(); $("#"+tree.C('id')).unwrap(); } }); return list.length === 1? list[0] : list; }; })(jQuery);
/*! * Bootstrap v5.0.0-beta2 (https://getbootstrap.com/) * Copyright 2011-2021 The Bootstrap Authors (https://github.com/twbs/bootstrap/graphs/contributors) * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) */ (function (global, factory) { typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory(require('@popperjs/core')) : typeof define === 'function' && define.amd ? define(['@popperjs/core'], factory) : (global = typeof globalThis !== 'undefined' ? globalThis : global || self, global.bootstrap = factory(global.Popper)); }(this, (function (Popper) { 'use strict'; function _interopNamespace(e) { if (e && e.__esModule) return e; var n = Object.create(null); if (e) { Object.keys(e).forEach(function (k) { if (k !== 'default') { var d = Object.getOwnPropertyDescriptor(e, k); Object.defineProperty(n, k, d.get ? d : { enumerable: true, get: function () { return e[k]; } }); } }); } n['default'] = e; return Object.freeze(n); } var Popper__namespace = /*#__PURE__*/_interopNamespace(Popper); function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } } function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; } function _extends() { _extends = Object.assign || function (target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i]; for (var key in source) { if (Object.prototype.hasOwnProperty.call(source, key)) { target[key] = source[key]; } } } return target; }; return _extends.apply(this, arguments); } function _inheritsLoose(subClass, superClass) { subClass.prototype = Object.create(superClass.prototype); subClass.prototype.constructor = subClass; _setPrototypeOf(subClass, superClass); } function _setPrototypeOf(o, p) { _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf(o, p) { o.__proto__ = p; return o; }; return _setPrototypeOf(o, p); } /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-beta2): util/index.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ var MAX_UID = 1000000; var MILLISECONDS_MULTIPLIER = 1000; var TRANSITION_END = 'transitionend'; // Shoutout AngusCroll (https://goo.gl/pxwQGp) var toType = function toType(obj) { if (obj === null || obj === undefined) { return "" + obj; } return {}.toString.call(obj).match(/\s([a-z]+)/i)[1].toLowerCase(); }; /** * -------------------------------------------------------------------------- * Public Util Api * -------------------------------------------------------------------------- */ var getUID = function getUID(prefix) { do { prefix += Math.floor(Math.random() * MAX_UID); } while (document.getElementById(prefix)); return prefix; }; var getSelector = function getSelector(element) { var selector = element.getAttribute('data-bs-target'); if (!selector || selector === '#') { var hrefAttr = element.getAttribute('href'); // The only valid content that could double as a selector are IDs or classes, // so everything starting with `#` or `.`. If a "real" URL is used as the selector, // `document.querySelector` will rightfully complain it is invalid. // See https://github.com/twbs/bootstrap/issues/32273 if (!hrefAttr || !hrefAttr.includes('#') && !hrefAttr.startsWith('.')) { return null; } // Just in case some CMS puts out a full URL with the anchor appended if (hrefAttr.includes('#') && !hrefAttr.startsWith('#')) { hrefAttr = '#' + hrefAttr.split('#')[1]; } selector = hrefAttr && hrefAttr !== '#' ? hrefAttr.trim() : null; } return selector; }; var getSelectorFromElement = function getSelectorFromElement(element) { var selector = getSelector(element); if (selector) { return document.querySelector(selector) ? selector : null; } return null; }; var getElementFromSelector = function getElementFromSelector(element) { var selector = getSelector(element); return selector ? document.querySelector(selector) : null; }; var getTransitionDurationFromElement = function getTransitionDurationFromElement(element) { if (!element) { return 0; } // Get transition-duration of the element var _window$getComputedSt = window.getComputedStyle(element), transitionDuration = _window$getComputedSt.transitionDuration, transitionDelay = _window$getComputedSt.transitionDelay; var floatTransitionDuration = Number.parseFloat(transitionDuration); var floatTransitionDelay = Number.parseFloat(transitionDelay); // Return 0 if element or transition duration is not found if (!floatTransitionDuration && !floatTransitionDelay) { return 0; } // If multiple durations are defined, take the first transitionDuration = transitionDuration.split(',')[0]; transitionDelay = transitionDelay.split(',')[0]; return (Number.parseFloat(transitionDuration) + Number.parseFloat(transitionDelay)) * MILLISECONDS_MULTIPLIER; }; var triggerTransitionEnd = function triggerTransitionEnd(element) { element.dispatchEvent(new Event(TRANSITION_END)); }; var isElement = function isElement(obj) { return (obj[0] || obj).nodeType; }; var emulateTransitionEnd = function emulateTransitionEnd(element, duration) { var called = false; var durationPadding = 5; var emulatedDuration = duration + durationPadding; function listener() { called = true; element.removeEventListener(TRANSITION_END, listener); } element.addEventListener(TRANSITION_END, listener); setTimeout(function () { if (!called) { triggerTransitionEnd(element); } }, emulatedDuration); }; var typeCheckConfig = function typeCheckConfig(componentName, config, configTypes) { Object.keys(configTypes).forEach(function (property) { var expectedTypes = configTypes[property]; var value = config[property]; var valueType = value && isElement(value) ? 'element' : toType(value); if (!new RegExp(expectedTypes).test(valueType)) { throw new TypeError(componentName.toUpperCase() + ": " + ("Option \"" + property + "\" provided type \"" + valueType + "\" ") + ("but expected type \"" + expectedTypes + "\".")); } }); }; var isVisible = function isVisible(element) { if (!element) { return false; } if (element.style && element.parentNode && element.parentNode.style) { var elementStyle = getComputedStyle(element); var parentNodeStyle = getComputedStyle(element.parentNode); return elementStyle.display !== 'none' && parentNodeStyle.display !== 'none' && elementStyle.visibility !== 'hidden'; } return false; }; var findShadowRoot = function findShadowRoot(element) { if (!document.documentElement.attachShadow) { return null; } // Can find the shadow root otherwise it'll return the document if (typeof element.getRootNode === 'function') { var root = element.getRootNode(); return root instanceof ShadowRoot ? root : null; } if (element instanceof ShadowRoot) { return element; } // when we don't find a shadow root if (!element.parentNode) { return null; } return findShadowRoot(element.parentNode); }; var noop = function noop() { return function () {}; }; var reflow = function reflow(element) { return element.offsetHeight; }; var getjQuery = function getjQuery() { var _window = window, jQuery = _window.jQuery; if (jQuery && !document.body.hasAttribute('data-bs-no-jquery')) { return jQuery; } return null; }; var onDOMContentLoaded = function onDOMContentLoaded(callback) { if (document.readyState === 'loading') { document.addEventListener('DOMContentLoaded', callback); } else { callback(); } }; var isRTL = function isRTL() { return document.documentElement.dir === 'rtl'; }; var defineJQueryPlugin = function defineJQueryPlugin(name, plugin) { onDOMContentLoaded(function () { var $ = getjQuery(); /* istanbul ignore if */ if ($) { var JQUERY_NO_CONFLICT = $.fn[name]; $.fn[name] = plugin.jQueryInterface; $.fn[name].Constructor = plugin; $.fn[name].noConflict = function () { $.fn[name] = JQUERY_NO_CONFLICT; return plugin.jQueryInterface; }; } }); }; /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-beta2): dom/data.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var elementMap = new Map(); var Data = { set: function set(element, key, instance) { if (!elementMap.has(element)) { elementMap.set(element, new Map()); } var instanceMap = elementMap.get(element); // make it clear we only want one instance per element // can be removed later when multiple key/instances are fine to be used if (!instanceMap.has(key) && instanceMap.size !== 0) { // eslint-disable-next-line no-console console.error("Bootstrap doesn't allow more than one instance per element. Bound instance: " + Array.from(instanceMap.keys())[0] + "."); return; } instanceMap.set(key, instance); }, get: function get(element, key) { if (elementMap.has(element)) { return elementMap.get(element).get(key) || null; } return null; }, remove: function remove(element, key) { if (!elementMap.has(element)) { return; } var instanceMap = elementMap.get(element); instanceMap.delete(key); // free up element references if there are no instances left for an element if (instanceMap.size === 0) { elementMap.delete(element); } } }; /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-beta2): dom/event-handler.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var namespaceRegex = /[^.]*(?=\..*)\.|.*/; var stripNameRegex = /\..*/; var stripUidRegex = /::\d+$/; var eventRegistry = {}; // Events storage var uidEvent = 1; var customEvents = { mouseenter: 'mouseover', mouseleave: 'mouseout' }; var nativeEvents = new Set(['click', 'dblclick', 'mouseup', 'mousedown', 'contextmenu', 'mousewheel', 'DOMMouseScroll', 'mouseover', 'mouseout', 'mousemove', 'selectstart', 'selectend', 'keydown', 'keypress', 'keyup', 'orientationchange', 'touchstart', 'touchmove', 'touchend', 'touchcancel', 'pointerdown', 'pointermove', 'pointerup', 'pointerleave', 'pointercancel', 'gesturestart', 'gesturechange', 'gestureend', 'focus', 'blur', 'change', 'reset', 'select', 'submit', 'focusin', 'focusout', 'load', 'unload', 'beforeunload', 'resize', 'move', 'DOMContentLoaded', 'readystatechange', 'error', 'abort', 'scroll']); /** * ------------------------------------------------------------------------ * Private methods * ------------------------------------------------------------------------ */ function getUidEvent(element, uid) { return uid && uid + "::" + uidEvent++ || element.uidEvent || uidEvent++; } function getEvent(element) { var uid = getUidEvent(element); element.uidEvent = uid; eventRegistry[uid] = eventRegistry[uid] || {}; return eventRegistry[uid]; } function bootstrapHandler(element, fn) { return function handler(event) { event.delegateTarget = element; if (handler.oneOff) { EventHandler.off(element, event.type, fn); } return fn.apply(element, [event]); }; } function bootstrapDelegationHandler(element, selector, fn) { return function handler(event) { var domElements = element.querySelectorAll(selector); for (var target = event.target; target && target !== this; target = target.parentNode) { for (var i = domElements.length; i--;) { if (domElements[i] === target) { event.delegateTarget = target; if (handler.oneOff) { // eslint-disable-next-line unicorn/consistent-destructuring EventHandler.off(element, event.type, fn); } return fn.apply(target, [event]); } } } // To please ESLint return null; }; } function findHandler(events, handler, delegationSelector) { if (delegationSelector === void 0) { delegationSelector = null; } var uidEventList = Object.keys(events); for (var i = 0, len = uidEventList.length; i < len; i++) { var event = events[uidEventList[i]]; if (event.originalHandler === handler && event.delegationSelector === delegationSelector) { return event; } } return null; } function normalizeParams(originalTypeEvent, handler, delegationFn) { var delegation = typeof handler === 'string'; var originalHandler = delegation ? delegationFn : handler; // allow to get the native events from namespaced events ('click.bs.button' --> 'click') var typeEvent = originalTypeEvent.replace(stripNameRegex, ''); var custom = customEvents[typeEvent]; if (custom) { typeEvent = custom; } var isNative = nativeEvents.has(typeEvent); if (!isNative) { typeEvent = originalTypeEvent; } return [delegation, originalHandler, typeEvent]; } function addHandler(element, originalTypeEvent, handler, delegationFn, oneOff) { if (typeof originalTypeEvent !== 'string' || !element) { return; } if (!handler) { handler = delegationFn; delegationFn = null; } var _normalizeParams = normalizeParams(originalTypeEvent, handler, delegationFn), delegation = _normalizeParams[0], originalHandler = _normalizeParams[1], typeEvent = _normalizeParams[2]; var events = getEvent(element); var handlers = events[typeEvent] || (events[typeEvent] = {}); var previousFn = findHandler(handlers, originalHandler, delegation ? handler : null); if (previousFn) { previousFn.oneOff = previousFn.oneOff && oneOff; return; } var uid = getUidEvent(originalHandler, originalTypeEvent.replace(namespaceRegex, '')); var fn = delegation ? bootstrapDelegationHandler(element, handler, delegationFn) : bootstrapHandler(element, handler); fn.delegationSelector = delegation ? handler : null; fn.originalHandler = originalHandler; fn.oneOff = oneOff; fn.uidEvent = uid; handlers[uid] = fn; element.addEventListener(typeEvent, fn, delegation); } function removeHandler(element, events, typeEvent, handler, delegationSelector) { var fn = findHandler(events[typeEvent], handler, delegationSelector); if (!fn) { return; } element.removeEventListener(typeEvent, fn, Boolean(delegationSelector)); delete events[typeEvent][fn.uidEvent]; } function removeNamespacedHandlers(element, events, typeEvent, namespace) { var storeElementEvent = events[typeEvent] || {}; Object.keys(storeElementEvent).forEach(function (handlerKey) { if (handlerKey.includes(namespace)) { var event = storeElementEvent[handlerKey]; removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); } }); } var EventHandler = { on: function on(element, event, handler, delegationFn) { addHandler(element, event, handler, delegationFn, false); }, one: function one(element, event, handler, delegationFn) { addHandler(element, event, handler, delegationFn, true); }, off: function off(element, originalTypeEvent, handler, delegationFn) { if (typeof originalTypeEvent !== 'string' || !element) { return; } var _normalizeParams2 = normalizeParams(originalTypeEvent, handler, delegationFn), delegation = _normalizeParams2[0], originalHandler = _normalizeParams2[1], typeEvent = _normalizeParams2[2]; var inNamespace = typeEvent !== originalTypeEvent; var events = getEvent(element); var isNamespace = originalTypeEvent.startsWith('.'); if (typeof originalHandler !== 'undefined') { // Simplest case: handler is passed, remove that listener ONLY. if (!events || !events[typeEvent]) { return; } removeHandler(element, events, typeEvent, originalHandler, delegation ? handler : null); return; } if (isNamespace) { Object.keys(events).forEach(function (elementEvent) { removeNamespacedHandlers(element, events, elementEvent, originalTypeEvent.slice(1)); }); } var storeElementEvent = events[typeEvent] || {}; Object.keys(storeElementEvent).forEach(function (keyHandlers) { var handlerKey = keyHandlers.replace(stripUidRegex, ''); if (!inNamespace || originalTypeEvent.includes(handlerKey)) { var event = storeElementEvent[keyHandlers]; removeHandler(element, events, typeEvent, event.originalHandler, event.delegationSelector); } }); }, trigger: function trigger(element, event, args) { if (typeof event !== 'string' || !element) { return null; } var $ = getjQuery(); var typeEvent = event.replace(stripNameRegex, ''); var inNamespace = event !== typeEvent; var isNative = nativeEvents.has(typeEvent); var jQueryEvent; var bubbles = true; var nativeDispatch = true; var defaultPrevented = false; var evt = null; if (inNamespace && $) { jQueryEvent = $.Event(event, args); $(element).trigger(jQueryEvent); bubbles = !jQueryEvent.isPropagationStopped(); nativeDispatch = !jQueryEvent.isImmediatePropagationStopped(); defaultPrevented = jQueryEvent.isDefaultPrevented(); } if (isNative) { evt = document.createEvent('HTMLEvents'); evt.initEvent(typeEvent, bubbles, true); } else { evt = new CustomEvent(event, { bubbles: bubbles, cancelable: true }); } // merge custom information in our event if (typeof args !== 'undefined') { Object.keys(args).forEach(function (key) { Object.defineProperty(evt, key, { get: function get() { return args[key]; } }); }); } if (defaultPrevented) { evt.preventDefault(); } if (nativeDispatch) { element.dispatchEvent(evt); } if (evt.defaultPrevented && typeof jQueryEvent !== 'undefined') { jQueryEvent.preventDefault(); } return evt; } }; /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var VERSION = '5.0.0-beta2'; var BaseComponent = /*#__PURE__*/function () { function BaseComponent(element) { element = typeof element === 'string' ? document.querySelector(element) : element; if (!element) { return; } this._element = element; Data.set(this._element, this.constructor.DATA_KEY, this); } var _proto = BaseComponent.prototype; _proto.dispose = function dispose() { Data.remove(this._element, this.constructor.DATA_KEY); this._element = null; } /** Static */ ; BaseComponent.getInstance = function getInstance(element) { return Data.get(element, this.DATA_KEY); }; _createClass(BaseComponent, null, [{ key: "VERSION", get: function get() { return VERSION; } }]); return BaseComponent; }(); /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME$b = 'alert'; var DATA_KEY$b = 'bs.alert'; var EVENT_KEY$b = "." + DATA_KEY$b; var DATA_API_KEY$8 = '.data-api'; var SELECTOR_DISMISS = '[data-bs-dismiss="alert"]'; var EVENT_CLOSE = "close" + EVENT_KEY$b; var EVENT_CLOSED = "closed" + EVENT_KEY$b; var EVENT_CLICK_DATA_API$7 = "click" + EVENT_KEY$b + DATA_API_KEY$8; var CLASS_NAME_ALERT = 'alert'; var CLASS_NAME_FADE$5 = 'fade'; var CLASS_NAME_SHOW$8 = 'show'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var Alert = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(Alert, _BaseComponent); function Alert() { return _BaseComponent.apply(this, arguments) || this; } var _proto = Alert.prototype; // Public _proto.close = function close(element) { var rootElement = element ? this._getRootElement(element) : this._element; var customEvent = this._triggerCloseEvent(rootElement); if (customEvent === null || customEvent.defaultPrevented) { return; } this._removeElement(rootElement); } // Private ; _proto._getRootElement = function _getRootElement(element) { return getElementFromSelector(element) || element.closest("." + CLASS_NAME_ALERT); }; _proto._triggerCloseEvent = function _triggerCloseEvent(element) { return EventHandler.trigger(element, EVENT_CLOSE); }; _proto._removeElement = function _removeElement(element) { var _this = this; element.classList.remove(CLASS_NAME_SHOW$8); if (!element.classList.contains(CLASS_NAME_FADE$5)) { this._destroyElement(element); return; } var transitionDuration = getTransitionDurationFromElement(element); EventHandler.one(element, 'transitionend', function () { return _this._destroyElement(element); }); emulateTransitionEnd(element, transitionDuration); }; _proto._destroyElement = function _destroyElement(element) { if (element.parentNode) { element.parentNode.removeChild(element); } EventHandler.trigger(element, EVENT_CLOSED); } // Static ; Alert.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.get(this, DATA_KEY$b); if (!data) { data = new Alert(this); } if (config === 'close') { data[config](this); } }); }; Alert.handleDismiss = function handleDismiss(alertInstance) { return function (event) { if (event) { event.preventDefault(); } alertInstance.close(this); }; }; _createClass(Alert, null, [{ key: "DATA_KEY", get: // Getters function get() { return DATA_KEY$b; } }]); return Alert; }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ EventHandler.on(document, EVENT_CLICK_DATA_API$7, SELECTOR_DISMISS, Alert.handleDismiss(new Alert())); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .Alert to jQuery only if jQuery is present */ defineJQueryPlugin(NAME$b, Alert); /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME$a = 'button'; var DATA_KEY$a = 'bs.button'; var EVENT_KEY$a = "." + DATA_KEY$a; var DATA_API_KEY$7 = '.data-api'; var CLASS_NAME_ACTIVE$3 = 'active'; var SELECTOR_DATA_TOGGLE$5 = '[data-bs-toggle="button"]'; var EVENT_CLICK_DATA_API$6 = "click" + EVENT_KEY$a + DATA_API_KEY$7; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var Button = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(Button, _BaseComponent); function Button() { return _BaseComponent.apply(this, arguments) || this; } var _proto = Button.prototype; // Public _proto.toggle = function toggle() { // Toggle class and sync the `aria-pressed` attribute with the return value of the `.toggle()` method this._element.setAttribute('aria-pressed', this._element.classList.toggle(CLASS_NAME_ACTIVE$3)); } // Static ; Button.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.get(this, DATA_KEY$a); if (!data) { data = new Button(this); } if (config === 'toggle') { data[config](); } }); }; _createClass(Button, null, [{ key: "DATA_KEY", get: // Getters function get() { return DATA_KEY$a; } }]); return Button; }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ EventHandler.on(document, EVENT_CLICK_DATA_API$6, SELECTOR_DATA_TOGGLE$5, function (event) { event.preventDefault(); var button = event.target.closest(SELECTOR_DATA_TOGGLE$5); var data = Data.get(button, DATA_KEY$a); if (!data) { data = new Button(button); } data.toggle(); }); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .Button to jQuery only if jQuery is present */ defineJQueryPlugin(NAME$a, Button); /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-beta2): dom/manipulator.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ function normalizeData(val) { if (val === 'true') { return true; } if (val === 'false') { return false; } if (val === Number(val).toString()) { return Number(val); } if (val === '' || val === 'null') { return null; } return val; } function normalizeDataKey(key) { return key.replace(/[A-Z]/g, function (chr) { return "-" + chr.toLowerCase(); }); } var Manipulator = { setDataAttribute: function setDataAttribute(element, key, value) { element.setAttribute("data-bs-" + normalizeDataKey(key), value); }, removeDataAttribute: function removeDataAttribute(element, key) { element.removeAttribute("data-bs-" + normalizeDataKey(key)); }, getDataAttributes: function getDataAttributes(element) { if (!element) { return {}; } var attributes = {}; Object.keys(element.dataset).filter(function (key) { return key.startsWith('bs'); }).forEach(function (key) { var pureKey = key.replace(/^bs/, ''); pureKey = pureKey.charAt(0).toLowerCase() + pureKey.slice(1, pureKey.length); attributes[pureKey] = normalizeData(element.dataset[key]); }); return attributes; }, getDataAttribute: function getDataAttribute(element, key) { return normalizeData(element.getAttribute("data-bs-" + normalizeDataKey(key))); }, offset: function offset(element) { var rect = element.getBoundingClientRect(); return { top: rect.top + document.body.scrollTop, left: rect.left + document.body.scrollLeft }; }, position: function position(element) { return { top: element.offsetTop, left: element.offsetLeft }; } }; /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-beta2): dom/selector-engine.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NODE_TEXT = 3; var SelectorEngine = { find: function find(selector, element) { var _ref; if (element === void 0) { element = document.documentElement; } return (_ref = []).concat.apply(_ref, Element.prototype.querySelectorAll.call(element, selector)); }, findOne: function findOne(selector, element) { if (element === void 0) { element = document.documentElement; } return Element.prototype.querySelector.call(element, selector); }, children: function children(element, selector) { var _ref2; return (_ref2 = []).concat.apply(_ref2, element.children).filter(function (child) { return child.matches(selector); }); }, parents: function parents(element, selector) { var parents = []; var ancestor = element.parentNode; while (ancestor && ancestor.nodeType === Node.ELEMENT_NODE && ancestor.nodeType !== NODE_TEXT) { if (ancestor.matches(selector)) { parents.push(ancestor); } ancestor = ancestor.parentNode; } return parents; }, prev: function prev(element, selector) { var previous = element.previousElementSibling; while (previous) { if (previous.matches(selector)) { return [previous]; } previous = previous.previousElementSibling; } return []; }, next: function next(element, selector) { var next = element.nextElementSibling; while (next) { if (next.matches(selector)) { return [next]; } next = next.nextElementSibling; } return []; } }; /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME$9 = 'carousel'; var DATA_KEY$9 = 'bs.carousel'; var EVENT_KEY$9 = "." + DATA_KEY$9; var DATA_API_KEY$6 = '.data-api'; var ARROW_LEFT_KEY = 'ArrowLeft'; var ARROW_RIGHT_KEY = 'ArrowRight'; var TOUCHEVENT_COMPAT_WAIT = 500; // Time for mouse compat events to fire after touch var SWIPE_THRESHOLD = 40; var Default$7 = { interval: 5000, keyboard: true, slide: false, pause: 'hover', wrap: true, touch: true }; var DefaultType$7 = { interval: '(number|boolean)', keyboard: 'boolean', slide: '(boolean|string)', pause: '(string|boolean)', wrap: 'boolean', touch: 'boolean' }; var DIRECTION_NEXT = 'next'; var DIRECTION_PREV = 'prev'; var DIRECTION_LEFT = 'left'; var DIRECTION_RIGHT = 'right'; var EVENT_SLIDE = "slide" + EVENT_KEY$9; var EVENT_SLID = "slid" + EVENT_KEY$9; var EVENT_KEYDOWN = "keydown" + EVENT_KEY$9; var EVENT_MOUSEENTER = "mouseenter" + EVENT_KEY$9; var EVENT_MOUSELEAVE = "mouseleave" + EVENT_KEY$9; var EVENT_TOUCHSTART = "touchstart" + EVENT_KEY$9; var EVENT_TOUCHMOVE = "touchmove" + EVENT_KEY$9; var EVENT_TOUCHEND = "touchend" + EVENT_KEY$9; var EVENT_POINTERDOWN = "pointerdown" + EVENT_KEY$9; var EVENT_POINTERUP = "pointerup" + EVENT_KEY$9; var EVENT_DRAG_START = "dragstart" + EVENT_KEY$9; var EVENT_LOAD_DATA_API$1 = "load" + EVENT_KEY$9 + DATA_API_KEY$6; var EVENT_CLICK_DATA_API$5 = "click" + EVENT_KEY$9 + DATA_API_KEY$6; var CLASS_NAME_CAROUSEL = 'carousel'; var CLASS_NAME_ACTIVE$2 = 'active'; var CLASS_NAME_SLIDE = 'slide'; var CLASS_NAME_END = 'carousel-item-end'; var CLASS_NAME_START = 'carousel-item-start'; var CLASS_NAME_NEXT = 'carousel-item-next'; var CLASS_NAME_PREV = 'carousel-item-prev'; var CLASS_NAME_POINTER_EVENT = 'pointer-event'; var SELECTOR_ACTIVE$1 = '.active'; var SELECTOR_ACTIVE_ITEM = '.active.carousel-item'; var SELECTOR_ITEM = '.carousel-item'; var SELECTOR_ITEM_IMG = '.carousel-item img'; var SELECTOR_NEXT_PREV = '.carousel-item-next, .carousel-item-prev'; var SELECTOR_INDICATORS = '.carousel-indicators'; var SELECTOR_INDICATOR = '[data-bs-target]'; var SELECTOR_DATA_SLIDE = '[data-bs-slide], [data-bs-slide-to]'; var SELECTOR_DATA_RIDE = '[data-bs-ride="carousel"]'; var POINTER_TYPE_TOUCH = 'touch'; var POINTER_TYPE_PEN = 'pen'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var Carousel = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(Carousel, _BaseComponent); function Carousel(element, config) { var _this; _this = _BaseComponent.call(this, element) || this; _this._items = null; _this._interval = null; _this._activeElement = null; _this._isPaused = false; _this._isSliding = false; _this.touchTimeout = null; _this.touchStartX = 0; _this.touchDeltaX = 0; _this._config = _this._getConfig(config); _this._indicatorsElement = SelectorEngine.findOne(SELECTOR_INDICATORS, _this._element); _this._touchSupported = 'ontouchstart' in document.documentElement || navigator.maxTouchPoints > 0; _this._pointerEvent = Boolean(window.PointerEvent); _this._addEventListeners(); return _this; } // Getters var _proto = Carousel.prototype; // Public _proto.next = function next() { if (!this._isSliding) { this._slide(DIRECTION_NEXT); } }; _proto.nextWhenVisible = function nextWhenVisible() { // Don't call next when the page isn't visible // or the carousel or its parent isn't visible if (!document.hidden && isVisible(this._element)) { this.next(); } }; _proto.prev = function prev() { if (!this._isSliding) { this._slide(DIRECTION_PREV); } }; _proto.pause = function pause(event) { if (!event) { this._isPaused = true; } if (SelectorEngine.findOne(SELECTOR_NEXT_PREV, this._element)) { triggerTransitionEnd(this._element); this.cycle(true); } clearInterval(this._interval); this._interval = null; }; _proto.cycle = function cycle(event) { if (!event) { this._isPaused = false; } if (this._interval) { clearInterval(this._interval); this._interval = null; } if (this._config && this._config.interval && !this._isPaused) { this._updateInterval(); this._interval = setInterval((document.visibilityState ? this.nextWhenVisible : this.next).bind(this), this._config.interval); } }; _proto.to = function to(index) { var _this2 = this; this._activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); var activeIndex = this._getItemIndex(this._activeElement); if (index > this._items.length - 1 || index < 0) { return; } if (this._isSliding) { EventHandler.one(this._element, EVENT_SLID, function () { return _this2.to(index); }); return; } if (activeIndex === index) { this.pause(); this.cycle(); return; } var direction = index > activeIndex ? DIRECTION_NEXT : DIRECTION_PREV; this._slide(direction, this._items[index]); }; _proto.dispose = function dispose() { EventHandler.off(this._element, EVENT_KEY$9); this._items = null; this._config = null; this._interval = null; this._isPaused = null; this._isSliding = null; this._activeElement = null; this._indicatorsElement = null; _BaseComponent.prototype.dispose.call(this); } // Private ; _proto._getConfig = function _getConfig(config) { config = _extends({}, Default$7, config); typeCheckConfig(NAME$9, config, DefaultType$7); return config; }; _proto._handleSwipe = function _handleSwipe() { var absDeltax = Math.abs(this.touchDeltaX); if (absDeltax <= SWIPE_THRESHOLD) { return; } var direction = absDeltax / this.touchDeltaX; this.touchDeltaX = 0; // swipe left if (direction > 0) { if (isRTL()) { this.next(); } else { this.prev(); } } // swipe right if (direction < 0) { if (isRTL()) { this.prev(); } else { this.next(); } } }; _proto._addEventListeners = function _addEventListeners() { var _this3 = this; if (this._config.keyboard) { EventHandler.on(this._element, EVENT_KEYDOWN, function (event) { return _this3._keydown(event); }); } if (this._config.pause === 'hover') { EventHandler.on(this._element, EVENT_MOUSEENTER, function (event) { return _this3.pause(event); }); EventHandler.on(this._element, EVENT_MOUSELEAVE, function (event) { return _this3.cycle(event); }); } if (this._config.touch && this._touchSupported) { this._addTouchEventListeners(); } }; _proto._addTouchEventListeners = function _addTouchEventListeners() { var _this4 = this; var start = function start(event) { if (_this4._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) { _this4.touchStartX = event.clientX; } else if (!_this4._pointerEvent) { _this4.touchStartX = event.touches[0].clientX; } }; var move = function move(event) { // ensure swiping with one touch and not pinching if (event.touches && event.touches.length > 1) { _this4.touchDeltaX = 0; } else { _this4.touchDeltaX = event.touches[0].clientX - _this4.touchStartX; } }; var end = function end(event) { if (_this4._pointerEvent && (event.pointerType === POINTER_TYPE_PEN || event.pointerType === POINTER_TYPE_TOUCH)) { _this4.touchDeltaX = event.clientX - _this4.touchStartX; } _this4._handleSwipe(); if (_this4._config.pause === 'hover') { // If it's a touch-enabled device, mouseenter/leave are fired as // part of the mouse compatibility events on first tap - the carousel // would stop cycling until user tapped out of it; // here, we listen for touchend, explicitly pause the carousel // (as if it's the second time we tap on it, mouseenter compat event // is NOT fired) and after a timeout (to allow for mouse compatibility // events to fire) we explicitly restart cycling _this4.pause(); if (_this4.touchTimeout) { clearTimeout(_this4.touchTimeout); } _this4.touchTimeout = setTimeout(function (event) { return _this4.cycle(event); }, TOUCHEVENT_COMPAT_WAIT + _this4._config.interval); } }; SelectorEngine.find(SELECTOR_ITEM_IMG, this._element).forEach(function (itemImg) { EventHandler.on(itemImg, EVENT_DRAG_START, function (e) { return e.preventDefault(); }); }); if (this._pointerEvent) { EventHandler.on(this._element, EVENT_POINTERDOWN, function (event) { return start(event); }); EventHandler.on(this._element, EVENT_POINTERUP, function (event) { return end(event); }); this._element.classList.add(CLASS_NAME_POINTER_EVENT); } else { EventHandler.on(this._element, EVENT_TOUCHSTART, function (event) { return start(event); }); EventHandler.on(this._element, EVENT_TOUCHMOVE, function (event) { return move(event); }); EventHandler.on(this._element, EVENT_TOUCHEND, function (event) { return end(event); }); } }; _proto._keydown = function _keydown(event) { if (/input|textarea/i.test(event.target.tagName)) { return; } if (event.key === ARROW_LEFT_KEY) { event.preventDefault(); if (isRTL()) { this.next(); } else { this.prev(); } } else if (event.key === ARROW_RIGHT_KEY) { event.preventDefault(); if (isRTL()) { this.prev(); } else { this.next(); } } }; _proto._getItemIndex = function _getItemIndex(element) { this._items = element && element.parentNode ? SelectorEngine.find(SELECTOR_ITEM, element.parentNode) : []; return this._items.indexOf(element); }; _proto._getItemByDirection = function _getItemByDirection(direction, activeElement) { var isNextDirection = direction === DIRECTION_NEXT; var isPrevDirection = direction === DIRECTION_PREV; var activeIndex = this._getItemIndex(activeElement); var lastItemIndex = this._items.length - 1; var isGoingToWrap = isPrevDirection && activeIndex === 0 || isNextDirection && activeIndex === lastItemIndex; if (isGoingToWrap && !this._config.wrap) { return activeElement; } var delta = direction === DIRECTION_PREV ? -1 : 1; var itemIndex = (activeIndex + delta) % this._items.length; return itemIndex === -1 ? this._items[this._items.length - 1] : this._items[itemIndex]; }; _proto._triggerSlideEvent = function _triggerSlideEvent(relatedTarget, eventDirectionName) { var targetIndex = this._getItemIndex(relatedTarget); var fromIndex = this._getItemIndex(SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element)); return EventHandler.trigger(this._element, EVENT_SLIDE, { relatedTarget: relatedTarget, direction: eventDirectionName, from: fromIndex, to: targetIndex }); }; _proto._setActiveIndicatorElement = function _setActiveIndicatorElement(element) { if (this._indicatorsElement) { var activeIndicator = SelectorEngine.findOne(SELECTOR_ACTIVE$1, this._indicatorsElement); activeIndicator.classList.remove(CLASS_NAME_ACTIVE$2); activeIndicator.removeAttribute('aria-current'); var indicators = SelectorEngine.find(SELECTOR_INDICATOR, this._indicatorsElement); for (var i = 0; i < indicators.length; i++) { if (Number.parseInt(indicators[i].getAttribute('data-bs-slide-to'), 10) === this._getItemIndex(element)) { indicators[i].classList.add(CLASS_NAME_ACTIVE$2); indicators[i].setAttribute('aria-current', 'true'); break; } } } }; _proto._updateInterval = function _updateInterval() { var element = this._activeElement || SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); if (!element) { return; } var elementInterval = Number.parseInt(element.getAttribute('data-bs-interval'), 10); if (elementInterval) { this._config.defaultInterval = this._config.defaultInterval || this._config.interval; this._config.interval = elementInterval; } else { this._config.interval = this._config.defaultInterval || this._config.interval; } }; _proto._slide = function _slide(direction, element) { var _this5 = this; var activeElement = SelectorEngine.findOne(SELECTOR_ACTIVE_ITEM, this._element); var activeElementIndex = this._getItemIndex(activeElement); var nextElement = element || activeElement && this._getItemByDirection(direction, activeElement); var nextElementIndex = this._getItemIndex(nextElement); var isCycling = Boolean(this._interval); var directionalClassName = direction === DIRECTION_NEXT ? CLASS_NAME_START : CLASS_NAME_END; var orderClassName = direction === DIRECTION_NEXT ? CLASS_NAME_NEXT : CLASS_NAME_PREV; var eventDirectionName = direction === DIRECTION_NEXT ? DIRECTION_LEFT : DIRECTION_RIGHT; if (nextElement && nextElement.classList.contains(CLASS_NAME_ACTIVE$2)) { this._isSliding = false; return; } var slideEvent = this._triggerSlideEvent(nextElement, eventDirectionName); if (slideEvent.defaultPrevented) { return; } if (!activeElement || !nextElement) { // Some weirdness is happening, so we bail return; } this._isSliding = true; if (isCycling) { this.pause(); } this._setActiveIndicatorElement(nextElement); this._activeElement = nextElement; if (this._element.classList.contains(CLASS_NAME_SLIDE)) { nextElement.classList.add(orderClassName); reflow(nextElement); activeElement.classList.add(directionalClassName); nextElement.classList.add(directionalClassName); var transitionDuration = getTransitionDurationFromElement(activeElement); EventHandler.one(activeElement, 'transitionend', function () { nextElement.classList.remove(directionalClassName, orderClassName); nextElement.classList.add(CLASS_NAME_ACTIVE$2); activeElement.classList.remove(CLASS_NAME_ACTIVE$2, orderClassName, directionalClassName); _this5._isSliding = false; setTimeout(function () { EventHandler.trigger(_this5._element, EVENT_SLID, { relatedTarget: nextElement, direction: eventDirectionName, from: activeElementIndex, to: nextElementIndex }); }, 0); }); emulateTransitionEnd(activeElement, transitionDuration); } else { activeElement.classList.remove(CLASS_NAME_ACTIVE$2); nextElement.classList.add(CLASS_NAME_ACTIVE$2); this._isSliding = false; EventHandler.trigger(this._element, EVENT_SLID, { relatedTarget: nextElement, direction: eventDirectionName, from: activeElementIndex, to: nextElementIndex }); } if (isCycling) { this.cycle(); } } // Static ; Carousel.carouselInterface = function carouselInterface(element, config) { var data = Data.get(element, DATA_KEY$9); var _config = _extends({}, Default$7, Manipulator.getDataAttributes(element)); if (typeof config === 'object') { _config = _extends({}, _config, config); } var action = typeof config === 'string' ? config : _config.slide; if (!data) { data = new Carousel(element, _config); } if (typeof config === 'number') { data.to(config); } else if (typeof action === 'string') { if (typeof data[action] === 'undefined') { throw new TypeError("No method named \"" + action + "\""); } data[action](); } else if (_config.interval && _config.ride) { data.pause(); data.cycle(); } }; Carousel.jQueryInterface = function jQueryInterface(config) { return this.each(function () { Carousel.carouselInterface(this, config); }); }; Carousel.dataApiClickHandler = function dataApiClickHandler(event) { var target = getElementFromSelector(this); if (!target || !target.classList.contains(CLASS_NAME_CAROUSEL)) { return; } var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this)); var slideIndex = this.getAttribute('data-bs-slide-to'); if (slideIndex) { config.interval = false; } Carousel.carouselInterface(target, config); if (slideIndex) { Data.get(target, DATA_KEY$9).to(slideIndex); } event.preventDefault(); }; _createClass(Carousel, null, [{ key: "Default", get: function get() { return Default$7; } }, { key: "DATA_KEY", get: function get() { return DATA_KEY$9; } }]); return Carousel; }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ EventHandler.on(document, EVENT_CLICK_DATA_API$5, SELECTOR_DATA_SLIDE, Carousel.dataApiClickHandler); EventHandler.on(window, EVENT_LOAD_DATA_API$1, function () { var carousels = SelectorEngine.find(SELECTOR_DATA_RIDE); for (var i = 0, len = carousels.length; i < len; i++) { Carousel.carouselInterface(carousels[i], Data.get(carousels[i], DATA_KEY$9)); } }); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .Carousel to jQuery only if jQuery is present */ defineJQueryPlugin(NAME$9, Carousel); /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME$8 = 'collapse'; var DATA_KEY$8 = 'bs.collapse'; var EVENT_KEY$8 = "." + DATA_KEY$8; var DATA_API_KEY$5 = '.data-api'; var Default$6 = { toggle: true, parent: '' }; var DefaultType$6 = { toggle: 'boolean', parent: '(string|element)' }; var EVENT_SHOW$5 = "show" + EVENT_KEY$8; var EVENT_SHOWN$5 = "shown" + EVENT_KEY$8; var EVENT_HIDE$5 = "hide" + EVENT_KEY$8; var EVENT_HIDDEN$5 = "hidden" + EVENT_KEY$8; var EVENT_CLICK_DATA_API$4 = "click" + EVENT_KEY$8 + DATA_API_KEY$5; var CLASS_NAME_SHOW$7 = 'show'; var CLASS_NAME_COLLAPSE = 'collapse'; var CLASS_NAME_COLLAPSING = 'collapsing'; var CLASS_NAME_COLLAPSED = 'collapsed'; var WIDTH = 'width'; var HEIGHT = 'height'; var SELECTOR_ACTIVES = '.show, .collapsing'; var SELECTOR_DATA_TOGGLE$4 = '[data-bs-toggle="collapse"]'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var Collapse = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(Collapse, _BaseComponent); function Collapse(element, config) { var _this; _this = _BaseComponent.call(this, element) || this; _this._isTransitioning = false; _this._config = _this._getConfig(config); _this._triggerArray = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4 + "[href=\"#" + _this._element.id + "\"]," + (SELECTOR_DATA_TOGGLE$4 + "[data-bs-target=\"#" + _this._element.id + "\"]")); var toggleList = SelectorEngine.find(SELECTOR_DATA_TOGGLE$4); for (var i = 0, len = toggleList.length; i < len; i++) { var elem = toggleList[i]; var selector = getSelectorFromElement(elem); var filterElement = SelectorEngine.find(selector).filter(function (foundElem) { return foundElem === _this._element; }); if (selector !== null && filterElement.length) { _this._selector = selector; _this._triggerArray.push(elem); } } _this._parent = _this._config.parent ? _this._getParent() : null; if (!_this._config.parent) { _this._addAriaAndCollapsedClass(_this._element, _this._triggerArray); } if (_this._config.toggle) { _this.toggle(); } return _this; } // Getters var _proto = Collapse.prototype; // Public _proto.toggle = function toggle() { if (this._element.classList.contains(CLASS_NAME_SHOW$7)) { this.hide(); } else { this.show(); } }; _proto.show = function show() { var _this2 = this; if (this._isTransitioning || this._element.classList.contains(CLASS_NAME_SHOW$7)) { return; } var actives; var activesData; if (this._parent) { actives = SelectorEngine.find(SELECTOR_ACTIVES, this._parent).filter(function (elem) { if (typeof _this2._config.parent === 'string') { return elem.getAttribute('data-bs-parent') === _this2._config.parent; } return elem.classList.contains(CLASS_NAME_COLLAPSE); }); if (actives.length === 0) { actives = null; } } var container = SelectorEngine.findOne(this._selector); if (actives) { var tempActiveData = actives.find(function (elem) { return container !== elem; }); activesData = tempActiveData ? Data.get(tempActiveData, DATA_KEY$8) : null; if (activesData && activesData._isTransitioning) { return; } } var startEvent = EventHandler.trigger(this._element, EVENT_SHOW$5); if (startEvent.defaultPrevented) { return; } if (actives) { actives.forEach(function (elemActive) { if (container !== elemActive) { Collapse.collapseInterface(elemActive, 'hide'); } if (!activesData) { Data.set(elemActive, DATA_KEY$8, null); } }); } var dimension = this._getDimension(); this._element.classList.remove(CLASS_NAME_COLLAPSE); this._element.classList.add(CLASS_NAME_COLLAPSING); this._element.style[dimension] = 0; if (this._triggerArray.length) { this._triggerArray.forEach(function (element) { element.classList.remove(CLASS_NAME_COLLAPSED); element.setAttribute('aria-expanded', true); }); } this.setTransitioning(true); var complete = function complete() { _this2._element.classList.remove(CLASS_NAME_COLLAPSING); _this2._element.classList.add(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); _this2._element.style[dimension] = ''; _this2.setTransitioning(false); EventHandler.trigger(_this2._element, EVENT_SHOWN$5); }; var capitalizedDimension = dimension[0].toUpperCase() + dimension.slice(1); var scrollSize = "scroll" + capitalizedDimension; var transitionDuration = getTransitionDurationFromElement(this._element); EventHandler.one(this._element, 'transitionend', complete); emulateTransitionEnd(this._element, transitionDuration); this._element.style[dimension] = this._element[scrollSize] + "px"; }; _proto.hide = function hide() { var _this3 = this; if (this._isTransitioning || !this._element.classList.contains(CLASS_NAME_SHOW$7)) { return; } var startEvent = EventHandler.trigger(this._element, EVENT_HIDE$5); if (startEvent.defaultPrevented) { return; } var dimension = this._getDimension(); this._element.style[dimension] = this._element.getBoundingClientRect()[dimension] + "px"; reflow(this._element); this._element.classList.add(CLASS_NAME_COLLAPSING); this._element.classList.remove(CLASS_NAME_COLLAPSE, CLASS_NAME_SHOW$7); var triggerArrayLength = this._triggerArray.length; if (triggerArrayLength > 0) { for (var i = 0; i < triggerArrayLength; i++) { var trigger = this._triggerArray[i]; var elem = getElementFromSelector(trigger); if (elem && !elem.classList.contains(CLASS_NAME_SHOW$7)) { trigger.classList.add(CLASS_NAME_COLLAPSED); trigger.setAttribute('aria-expanded', false); } } } this.setTransitioning(true); var complete = function complete() { _this3.setTransitioning(false); _this3._element.classList.remove(CLASS_NAME_COLLAPSING); _this3._element.classList.add(CLASS_NAME_COLLAPSE); EventHandler.trigger(_this3._element, EVENT_HIDDEN$5); }; this._element.style[dimension] = ''; var transitionDuration = getTransitionDurationFromElement(this._element); EventHandler.one(this._element, 'transitionend', complete); emulateTransitionEnd(this._element, transitionDuration); }; _proto.setTransitioning = function setTransitioning(isTransitioning) { this._isTransitioning = isTransitioning; }; _proto.dispose = function dispose() { _BaseComponent.prototype.dispose.call(this); this._config = null; this._parent = null; this._triggerArray = null; this._isTransitioning = null; } // Private ; _proto._getConfig = function _getConfig(config) { config = _extends({}, Default$6, config); config.toggle = Boolean(config.toggle); // Coerce string values typeCheckConfig(NAME$8, config, DefaultType$6); return config; }; _proto._getDimension = function _getDimension() { return this._element.classList.contains(WIDTH) ? WIDTH : HEIGHT; }; _proto._getParent = function _getParent() { var _this4 = this; var parent = this._config.parent; if (isElement(parent)) { // it's a jQuery object if (typeof parent.jquery !== 'undefined' || typeof parent[0] !== 'undefined') { parent = parent[0]; } } else { parent = SelectorEngine.findOne(parent); } var selector = SELECTOR_DATA_TOGGLE$4 + "[data-bs-parent=\"" + parent + "\"]"; SelectorEngine.find(selector, parent).forEach(function (element) { var selected = getElementFromSelector(element); _this4._addAriaAndCollapsedClass(selected, [element]); }); return parent; }; _proto._addAriaAndCollapsedClass = function _addAriaAndCollapsedClass(element, triggerArray) { if (!element || !triggerArray.length) { return; } var isOpen = element.classList.contains(CLASS_NAME_SHOW$7); triggerArray.forEach(function (elem) { if (isOpen) { elem.classList.remove(CLASS_NAME_COLLAPSED); } else { elem.classList.add(CLASS_NAME_COLLAPSED); } elem.setAttribute('aria-expanded', isOpen); }); } // Static ; Collapse.collapseInterface = function collapseInterface(element, config) { var data = Data.get(element, DATA_KEY$8); var _config = _extends({}, Default$6, Manipulator.getDataAttributes(element), typeof config === 'object' && config ? config : {}); if (!data && _config.toggle && typeof config === 'string' && /show|hide/.test(config)) { _config.toggle = false; } if (!data) { data = new Collapse(element, _config); } if (typeof config === 'string') { if (typeof data[config] === 'undefined') { throw new TypeError("No method named \"" + config + "\""); } data[config](); } }; Collapse.jQueryInterface = function jQueryInterface(config) { return this.each(function () { Collapse.collapseInterface(this, config); }); }; _createClass(Collapse, null, [{ key: "Default", get: function get() { return Default$6; } }, { key: "DATA_KEY", get: function get() { return DATA_KEY$8; } }]); return Collapse; }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ EventHandler.on(document, EVENT_CLICK_DATA_API$4, SELECTOR_DATA_TOGGLE$4, function (event) { // preventDefault only for <a> elements (which change the URL) not inside the collapsible element if (event.target.tagName === 'A' || event.delegateTarget && event.delegateTarget.tagName === 'A') { event.preventDefault(); } var triggerData = Manipulator.getDataAttributes(this); var selector = getSelectorFromElement(this); var selectorElements = SelectorEngine.find(selector); selectorElements.forEach(function (element) { var data = Data.get(element, DATA_KEY$8); var config; if (data) { // update parent attribute if (data._parent === null && typeof triggerData.parent === 'string') { data._config.parent = triggerData.parent; data._parent = data._getParent(); } config = 'toggle'; } else { config = triggerData; } Collapse.collapseInterface(element, config); }); }); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .Collapse to jQuery only if jQuery is present */ defineJQueryPlugin(NAME$8, Collapse); /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME$7 = 'dropdown'; var DATA_KEY$7 = 'bs.dropdown'; var EVENT_KEY$7 = "." + DATA_KEY$7; var DATA_API_KEY$4 = '.data-api'; var ESCAPE_KEY$2 = 'Escape'; var SPACE_KEY = 'Space'; var TAB_KEY = 'Tab'; var ARROW_UP_KEY = 'ArrowUp'; var ARROW_DOWN_KEY = 'ArrowDown'; var RIGHT_MOUSE_BUTTON = 2; // MouseEvent.button value for the secondary button, usually the right button var REGEXP_KEYDOWN = new RegExp(ARROW_UP_KEY + "|" + ARROW_DOWN_KEY + "|" + ESCAPE_KEY$2); var EVENT_HIDE$4 = "hide" + EVENT_KEY$7; var EVENT_HIDDEN$4 = "hidden" + EVENT_KEY$7; var EVENT_SHOW$4 = "show" + EVENT_KEY$7; var EVENT_SHOWN$4 = "shown" + EVENT_KEY$7; var EVENT_CLICK = "click" + EVENT_KEY$7; var EVENT_CLICK_DATA_API$3 = "click" + EVENT_KEY$7 + DATA_API_KEY$4; var EVENT_KEYDOWN_DATA_API = "keydown" + EVENT_KEY$7 + DATA_API_KEY$4; var EVENT_KEYUP_DATA_API = "keyup" + EVENT_KEY$7 + DATA_API_KEY$4; var CLASS_NAME_DISABLED$2 = 'disabled'; var CLASS_NAME_SHOW$6 = 'show'; var CLASS_NAME_DROPUP = 'dropup'; var CLASS_NAME_DROPEND = 'dropend'; var CLASS_NAME_DROPSTART = 'dropstart'; var CLASS_NAME_NAVBAR = 'navbar'; var SELECTOR_DATA_TOGGLE$3 = '[data-bs-toggle="dropdown"]'; var SELECTOR_FORM_CHILD = '.dropdown form'; var SELECTOR_MENU = '.dropdown-menu'; var SELECTOR_NAVBAR_NAV = '.navbar-nav'; var SELECTOR_VISIBLE_ITEMS = '.dropdown-menu .dropdown-item:not(.disabled):not(:disabled)'; var PLACEMENT_TOP = isRTL() ? 'top-end' : 'top-start'; var PLACEMENT_TOPEND = isRTL() ? 'top-start' : 'top-end'; var PLACEMENT_BOTTOM = isRTL() ? 'bottom-end' : 'bottom-start'; var PLACEMENT_BOTTOMEND = isRTL() ? 'bottom-start' : 'bottom-end'; var PLACEMENT_RIGHT = isRTL() ? 'left-start' : 'right-start'; var PLACEMENT_LEFT = isRTL() ? 'right-start' : 'left-start'; var Default$5 = { offset: [0, 2], boundary: 'clippingParents', reference: 'toggle', display: 'dynamic', popperConfig: null }; var DefaultType$5 = { offset: '(array|string|function)', boundary: '(string|element)', reference: '(string|element|object)', display: 'string', popperConfig: '(null|object|function)' }; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var Dropdown = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(Dropdown, _BaseComponent); function Dropdown(element, config) { var _this; _this = _BaseComponent.call(this, element) || this; _this._popper = null; _this._config = _this._getConfig(config); _this._menu = _this._getMenuElement(); _this._inNavbar = _this._detectNavbar(); _this._addEventListeners(); return _this; } // Getters var _proto = Dropdown.prototype; // Public _proto.toggle = function toggle() { if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$2)) { return; } var isActive = this._element.classList.contains(CLASS_NAME_SHOW$6); Dropdown.clearMenus(); if (isActive) { return; } this.show(); }; _proto.show = function show() { if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$2) || this._menu.classList.contains(CLASS_NAME_SHOW$6)) { return; } var parent = Dropdown.getParentFromElement(this._element); var relatedTarget = { relatedTarget: this._element }; var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$4, relatedTarget); if (showEvent.defaultPrevented) { return; } // Totally disable Popper for Dropdowns in Navbar if (this._inNavbar) { Manipulator.setDataAttribute(this._menu, 'popper', 'none'); } else { if (typeof Popper__namespace === 'undefined') { throw new TypeError('Bootstrap\'s dropdowns require Popper (https://popper.js.org)'); } var referenceElement = this._element; if (this._config.reference === 'parent') { referenceElement = parent; } else if (isElement(this._config.reference)) { referenceElement = this._config.reference; // Check if it's jQuery element if (typeof this._config.reference.jquery !== 'undefined') { referenceElement = this._config.reference[0]; } } else if (typeof this._config.reference === 'object') { referenceElement = this._config.reference; } var popperConfig = this._getPopperConfig(); var isDisplayStatic = popperConfig.modifiers.find(function (modifier) { return modifier.name === 'applyStyles' && modifier.enabled === false; }); this._popper = Popper.createPopper(referenceElement, this._menu, popperConfig); if (isDisplayStatic) { Manipulator.setDataAttribute(this._menu, 'popper', 'static'); } } // If this is a touch-enabled device we add extra // empty mouseover listeners to the body's immediate children; // only needed because of broken event delegation on iOS // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html if ('ontouchstart' in document.documentElement && !parent.closest(SELECTOR_NAVBAR_NAV)) { var _ref; (_ref = []).concat.apply(_ref, document.body.children).forEach(function (elem) { return EventHandler.on(elem, 'mouseover', null, noop()); }); } this._element.focus(); this._element.setAttribute('aria-expanded', true); this._menu.classList.toggle(CLASS_NAME_SHOW$6); this._element.classList.toggle(CLASS_NAME_SHOW$6); EventHandler.trigger(this._element, EVENT_SHOWN$4, relatedTarget); }; _proto.hide = function hide() { if (this._element.disabled || this._element.classList.contains(CLASS_NAME_DISABLED$2) || !this._menu.classList.contains(CLASS_NAME_SHOW$6)) { return; } var relatedTarget = { relatedTarget: this._element }; var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$4, relatedTarget); if (hideEvent.defaultPrevented) { return; } if (this._popper) { this._popper.destroy(); } this._menu.classList.toggle(CLASS_NAME_SHOW$6); this._element.classList.toggle(CLASS_NAME_SHOW$6); Manipulator.removeDataAttribute(this._menu, 'popper'); EventHandler.trigger(this._element, EVENT_HIDDEN$4, relatedTarget); }; _proto.dispose = function dispose() { EventHandler.off(this._element, EVENT_KEY$7); this._menu = null; if (this._popper) { this._popper.destroy(); this._popper = null; } _BaseComponent.prototype.dispose.call(this); }; _proto.update = function update() { this._inNavbar = this._detectNavbar(); if (this._popper) { this._popper.update(); } } // Private ; _proto._addEventListeners = function _addEventListeners() { var _this2 = this; EventHandler.on(this._element, EVENT_CLICK, function (event) { event.preventDefault(); event.stopPropagation(); _this2.toggle(); }); }; _proto._getConfig = function _getConfig(config) { config = _extends({}, this.constructor.Default, Manipulator.getDataAttributes(this._element), config); typeCheckConfig(NAME$7, config, this.constructor.DefaultType); if (typeof config.reference === 'object' && !isElement(config.reference) && typeof config.reference.getBoundingClientRect !== 'function') { // Popper virtual elements require a getBoundingClientRect method throw new TypeError(NAME$7.toUpperCase() + ": Option \"reference\" provided type \"object\" without a required \"getBoundingClientRect\" method."); } return config; }; _proto._getMenuElement = function _getMenuElement() { return SelectorEngine.next(this._element, SELECTOR_MENU)[0]; }; _proto._getPlacement = function _getPlacement() { var parentDropdown = this._element.parentNode; if (parentDropdown.classList.contains(CLASS_NAME_DROPEND)) { return PLACEMENT_RIGHT; } if (parentDropdown.classList.contains(CLASS_NAME_DROPSTART)) { return PLACEMENT_LEFT; } // We need to trim the value because custom properties can also include spaces var isEnd = getComputedStyle(this._menu).getPropertyValue('--bs-position').trim() === 'end'; if (parentDropdown.classList.contains(CLASS_NAME_DROPUP)) { return isEnd ? PLACEMENT_TOPEND : PLACEMENT_TOP; } return isEnd ? PLACEMENT_BOTTOMEND : PLACEMENT_BOTTOM; }; _proto._detectNavbar = function _detectNavbar() { return this._element.closest("." + CLASS_NAME_NAVBAR) !== null; }; _proto._getOffset = function _getOffset() { var _this3 = this; var offset = this._config.offset; if (typeof offset === 'string') { return offset.split(',').map(function (val) { return Number.parseInt(val, 10); }); } if (typeof offset === 'function') { return function (popperData) { return offset(popperData, _this3._element); }; } return offset; }; _proto._getPopperConfig = function _getPopperConfig() { var defaultBsPopperConfig = { placement: this._getPlacement(), modifiers: [{ name: 'preventOverflow', options: { boundary: this._config.boundary } }, { name: 'offset', options: { offset: this._getOffset() } }] }; // Disable Popper if we have a static display if (this._config.display === 'static') { defaultBsPopperConfig.modifiers = [{ name: 'applyStyles', enabled: false }]; } return _extends({}, defaultBsPopperConfig, typeof this._config.popperConfig === 'function' ? this._config.popperConfig(defaultBsPopperConfig) : this._config.popperConfig); } // Static ; Dropdown.dropdownInterface = function dropdownInterface(element, config) { var data = Data.get(element, DATA_KEY$7); var _config = typeof config === 'object' ? config : null; if (!data) { data = new Dropdown(element, _config); } if (typeof config === 'string') { if (typeof data[config] === 'undefined') { throw new TypeError("No method named \"" + config + "\""); } data[config](); } }; Dropdown.jQueryInterface = function jQueryInterface(config) { return this.each(function () { Dropdown.dropdownInterface(this, config); }); }; Dropdown.clearMenus = function clearMenus(event) { if (event && (event.button === RIGHT_MOUSE_BUTTON || event.type === 'keyup' && event.key !== TAB_KEY)) { return; } var toggles = SelectorEngine.find(SELECTOR_DATA_TOGGLE$3); for (var i = 0, len = toggles.length; i < len; i++) { var context = Data.get(toggles[i], DATA_KEY$7); var relatedTarget = { relatedTarget: toggles[i] }; if (event && event.type === 'click') { relatedTarget.clickEvent = event; } if (!context) { continue; } var dropdownMenu = context._menu; if (!toggles[i].classList.contains(CLASS_NAME_SHOW$6)) { continue; } if (event && (event.type === 'click' && /input|textarea/i.test(event.target.tagName) || event.type === 'keyup' && event.key === TAB_KEY) && dropdownMenu.contains(event.target)) { continue; } var hideEvent = EventHandler.trigger(toggles[i], EVENT_HIDE$4, relatedTarget); if (hideEvent.defaultPrevented) { continue; } // If this is a touch-enabled device we remove the extra // empty mouseover listeners we added for iOS support if ('ontouchstart' in document.documentElement) { var _ref2; (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (elem) { return EventHandler.off(elem, 'mouseover', null, noop()); }); } toggles[i].setAttribute('aria-expanded', 'false'); if (context._popper) { context._popper.destroy(); } dropdownMenu.classList.remove(CLASS_NAME_SHOW$6); toggles[i].classList.remove(CLASS_NAME_SHOW$6); Manipulator.removeDataAttribute(dropdownMenu, 'popper'); EventHandler.trigger(toggles[i], EVENT_HIDDEN$4, relatedTarget); } }; Dropdown.getParentFromElement = function getParentFromElement(element) { return getElementFromSelector(element) || element.parentNode; }; Dropdown.dataApiKeydownHandler = function dataApiKeydownHandler(event) { // If not input/textarea: // - And not a key in REGEXP_KEYDOWN => not a dropdown command // If input/textarea: // - If space key => not a dropdown command // - If key is other than escape // - If key is not up or down => not a dropdown command // - If trigger inside the menu => not a dropdown command if (/input|textarea/i.test(event.target.tagName) ? event.key === SPACE_KEY || event.key !== ESCAPE_KEY$2 && (event.key !== ARROW_DOWN_KEY && event.key !== ARROW_UP_KEY || event.target.closest(SELECTOR_MENU)) : !REGEXP_KEYDOWN.test(event.key)) { return; } event.preventDefault(); event.stopPropagation(); if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED$2)) { return; } var parent = Dropdown.getParentFromElement(this); var isActive = this.classList.contains(CLASS_NAME_SHOW$6); if (event.key === ESCAPE_KEY$2) { var button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; button.focus(); Dropdown.clearMenus(); return; } if (!isActive && (event.key === ARROW_UP_KEY || event.key === ARROW_DOWN_KEY)) { var _button = this.matches(SELECTOR_DATA_TOGGLE$3) ? this : SelectorEngine.prev(this, SELECTOR_DATA_TOGGLE$3)[0]; _button.click(); return; } if (!isActive || event.key === SPACE_KEY) { Dropdown.clearMenus(); return; } var items = SelectorEngine.find(SELECTOR_VISIBLE_ITEMS, parent).filter(isVisible); if (!items.length) { return; } var index = items.indexOf(event.target); // Up if (event.key === ARROW_UP_KEY && index > 0) { index--; } // Down if (event.key === ARROW_DOWN_KEY && index < items.length - 1) { index++; } // index is -1 if the first keydown is an ArrowUp index = index === -1 ? 0 : index; items[index].focus(); }; _createClass(Dropdown, null, [{ key: "Default", get: function get() { return Default$5; } }, { key: "DefaultType", get: function get() { return DefaultType$5; } }, { key: "DATA_KEY", get: function get() { return DATA_KEY$7; } }]); return Dropdown; }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_DATA_TOGGLE$3, Dropdown.dataApiKeydownHandler); EventHandler.on(document, EVENT_KEYDOWN_DATA_API, SELECTOR_MENU, Dropdown.dataApiKeydownHandler); EventHandler.on(document, EVENT_CLICK_DATA_API$3, Dropdown.clearMenus); EventHandler.on(document, EVENT_KEYUP_DATA_API, Dropdown.clearMenus); EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_DATA_TOGGLE$3, function (event) { event.preventDefault(); event.stopPropagation(); Dropdown.dropdownInterface(this, 'toggle'); }); EventHandler.on(document, EVENT_CLICK_DATA_API$3, SELECTOR_FORM_CHILD, function (e) { return e.stopPropagation(); }); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .Dropdown to jQuery only if jQuery is present */ defineJQueryPlugin(NAME$7, Dropdown); /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME$6 = 'modal'; var DATA_KEY$6 = 'bs.modal'; var EVENT_KEY$6 = "." + DATA_KEY$6; var DATA_API_KEY$3 = '.data-api'; var ESCAPE_KEY$1 = 'Escape'; var Default$4 = { backdrop: true, keyboard: true, focus: true }; var DefaultType$4 = { backdrop: '(boolean|string)', keyboard: 'boolean', focus: 'boolean' }; var EVENT_HIDE$3 = "hide" + EVENT_KEY$6; var EVENT_HIDE_PREVENTED = "hidePrevented" + EVENT_KEY$6; var EVENT_HIDDEN$3 = "hidden" + EVENT_KEY$6; var EVENT_SHOW$3 = "show" + EVENT_KEY$6; var EVENT_SHOWN$3 = "shown" + EVENT_KEY$6; var EVENT_FOCUSIN$1 = "focusin" + EVENT_KEY$6; var EVENT_RESIZE = "resize" + EVENT_KEY$6; var EVENT_CLICK_DISMISS$2 = "click.dismiss" + EVENT_KEY$6; var EVENT_KEYDOWN_DISMISS = "keydown.dismiss" + EVENT_KEY$6; var EVENT_MOUSEUP_DISMISS = "mouseup.dismiss" + EVENT_KEY$6; var EVENT_MOUSEDOWN_DISMISS = "mousedown.dismiss" + EVENT_KEY$6; var EVENT_CLICK_DATA_API$2 = "click" + EVENT_KEY$6 + DATA_API_KEY$3; var CLASS_NAME_SCROLLBAR_MEASURER = 'modal-scrollbar-measure'; var CLASS_NAME_BACKDROP = 'modal-backdrop'; var CLASS_NAME_OPEN = 'modal-open'; var CLASS_NAME_FADE$4 = 'fade'; var CLASS_NAME_SHOW$5 = 'show'; var CLASS_NAME_STATIC = 'modal-static'; var SELECTOR_DIALOG = '.modal-dialog'; var SELECTOR_MODAL_BODY = '.modal-body'; var SELECTOR_DATA_TOGGLE$2 = '[data-bs-toggle="modal"]'; var SELECTOR_DATA_DISMISS$2 = '[data-bs-dismiss="modal"]'; var SELECTOR_FIXED_CONTENT$1 = '.fixed-top, .fixed-bottom, .is-fixed, .sticky-top'; var SELECTOR_STICKY_CONTENT$1 = '.sticky-top'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var Modal = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(Modal, _BaseComponent); function Modal(element, config) { var _this; _this = _BaseComponent.call(this, element) || this; _this._config = _this._getConfig(config); _this._dialog = SelectorEngine.findOne(SELECTOR_DIALOG, _this._element); _this._backdrop = null; _this._isShown = false; _this._isBodyOverflowing = false; _this._ignoreBackdropClick = false; _this._isTransitioning = false; _this._scrollbarWidth = 0; return _this; } // Getters var _proto = Modal.prototype; // Public _proto.toggle = function toggle(relatedTarget) { return this._isShown ? this.hide() : this.show(relatedTarget); }; _proto.show = function show(relatedTarget) { var _this2 = this; if (this._isShown || this._isTransitioning) { return; } if (this._element.classList.contains(CLASS_NAME_FADE$4)) { this._isTransitioning = true; } var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$3, { relatedTarget: relatedTarget }); if (this._isShown || showEvent.defaultPrevented) { return; } this._isShown = true; this._checkScrollbar(); this._setScrollbar(); this._adjustDialog(); this._setEscapeEvent(); this._setResizeEvent(); EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, SELECTOR_DATA_DISMISS$2, function (event) { return _this2.hide(event); }); EventHandler.on(this._dialog, EVENT_MOUSEDOWN_DISMISS, function () { EventHandler.one(_this2._element, EVENT_MOUSEUP_DISMISS, function (event) { if (event.target === _this2._element) { _this2._ignoreBackdropClick = true; } }); }); this._showBackdrop(function () { return _this2._showElement(relatedTarget); }); }; _proto.hide = function hide(event) { var _this3 = this; if (event) { event.preventDefault(); } if (!this._isShown || this._isTransitioning) { return; } var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$3); if (hideEvent.defaultPrevented) { return; } this._isShown = false; var transition = this._element.classList.contains(CLASS_NAME_FADE$4); if (transition) { this._isTransitioning = true; } this._setEscapeEvent(); this._setResizeEvent(); EventHandler.off(document, EVENT_FOCUSIN$1); this._element.classList.remove(CLASS_NAME_SHOW$5); EventHandler.off(this._element, EVENT_CLICK_DISMISS$2); EventHandler.off(this._dialog, EVENT_MOUSEDOWN_DISMISS); if (transition) { var transitionDuration = getTransitionDurationFromElement(this._element); EventHandler.one(this._element, 'transitionend', function (event) { return _this3._hideModal(event); }); emulateTransitionEnd(this._element, transitionDuration); } else { this._hideModal(); } }; _proto.dispose = function dispose() { [window, this._element, this._dialog].forEach(function (htmlElement) { return EventHandler.off(htmlElement, EVENT_KEY$6); }); _BaseComponent.prototype.dispose.call(this); /** * `document` has 2 events `EVENT_FOCUSIN` and `EVENT_CLICK_DATA_API` * Do not move `document` in `htmlElements` array * It will remove `EVENT_CLICK_DATA_API` event that should remain */ EventHandler.off(document, EVENT_FOCUSIN$1); this._config = null; this._dialog = null; this._backdrop = null; this._isShown = null; this._isBodyOverflowing = null; this._ignoreBackdropClick = null; this._isTransitioning = null; this._scrollbarWidth = null; }; _proto.handleUpdate = function handleUpdate() { this._adjustDialog(); } // Private ; _proto._getConfig = function _getConfig(config) { config = _extends({}, Default$4, config); typeCheckConfig(NAME$6, config, DefaultType$4); return config; }; _proto._showElement = function _showElement(relatedTarget) { var _this4 = this; var transition = this._element.classList.contains(CLASS_NAME_FADE$4); var modalBody = SelectorEngine.findOne(SELECTOR_MODAL_BODY, this._dialog); if (!this._element.parentNode || this._element.parentNode.nodeType !== Node.ELEMENT_NODE) { // Don't move modal's DOM position document.body.appendChild(this._element); } this._element.style.display = 'block'; this._element.removeAttribute('aria-hidden'); this._element.setAttribute('aria-modal', true); this._element.setAttribute('role', 'dialog'); this._element.scrollTop = 0; if (modalBody) { modalBody.scrollTop = 0; } if (transition) { reflow(this._element); } this._element.classList.add(CLASS_NAME_SHOW$5); if (this._config.focus) { this._enforceFocus(); } var transitionComplete = function transitionComplete() { if (_this4._config.focus) { _this4._element.focus(); } _this4._isTransitioning = false; EventHandler.trigger(_this4._element, EVENT_SHOWN$3, { relatedTarget: relatedTarget }); }; if (transition) { var transitionDuration = getTransitionDurationFromElement(this._dialog); EventHandler.one(this._dialog, 'transitionend', transitionComplete); emulateTransitionEnd(this._dialog, transitionDuration); } else { transitionComplete(); } }; _proto._enforceFocus = function _enforceFocus() { var _this5 = this; EventHandler.off(document, EVENT_FOCUSIN$1); // guard against infinite focus loop EventHandler.on(document, EVENT_FOCUSIN$1, function (event) { if (document !== event.target && _this5._element !== event.target && !_this5._element.contains(event.target)) { _this5._element.focus(); } }); }; _proto._setEscapeEvent = function _setEscapeEvent() { var _this6 = this; if (this._isShown) { EventHandler.on(this._element, EVENT_KEYDOWN_DISMISS, function (event) { if (_this6._config.keyboard && event.key === ESCAPE_KEY$1) { event.preventDefault(); _this6.hide(); } else if (!_this6._config.keyboard && event.key === ESCAPE_KEY$1) { _this6._triggerBackdropTransition(); } }); } else { EventHandler.off(this._element, EVENT_KEYDOWN_DISMISS); } }; _proto._setResizeEvent = function _setResizeEvent() { var _this7 = this; if (this._isShown) { EventHandler.on(window, EVENT_RESIZE, function () { return _this7._adjustDialog(); }); } else { EventHandler.off(window, EVENT_RESIZE); } }; _proto._hideModal = function _hideModal() { var _this8 = this; this._element.style.display = 'none'; this._element.setAttribute('aria-hidden', true); this._element.removeAttribute('aria-modal'); this._element.removeAttribute('role'); this._isTransitioning = false; this._showBackdrop(function () { document.body.classList.remove(CLASS_NAME_OPEN); _this8._resetAdjustments(); _this8._resetScrollbar(); EventHandler.trigger(_this8._element, EVENT_HIDDEN$3); }); }; _proto._removeBackdrop = function _removeBackdrop() { this._backdrop.parentNode.removeChild(this._backdrop); this._backdrop = null; }; _proto._showBackdrop = function _showBackdrop(callback) { var _this9 = this; var animate = this._element.classList.contains(CLASS_NAME_FADE$4) ? CLASS_NAME_FADE$4 : ''; if (this._isShown && this._config.backdrop) { this._backdrop = document.createElement('div'); this._backdrop.className = CLASS_NAME_BACKDROP; if (animate) { this._backdrop.classList.add(animate); } document.body.appendChild(this._backdrop); EventHandler.on(this._element, EVENT_CLICK_DISMISS$2, function (event) { if (_this9._ignoreBackdropClick) { _this9._ignoreBackdropClick = false; return; } if (event.target !== event.currentTarget) { return; } if (_this9._config.backdrop === 'static') { _this9._triggerBackdropTransition(); } else { _this9.hide(); } }); if (animate) { reflow(this._backdrop); } this._backdrop.classList.add(CLASS_NAME_SHOW$5); if (!animate) { callback(); return; } var backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); EventHandler.one(this._backdrop, 'transitionend', callback); emulateTransitionEnd(this._backdrop, backdropTransitionDuration); } else if (!this._isShown && this._backdrop) { this._backdrop.classList.remove(CLASS_NAME_SHOW$5); var callbackRemove = function callbackRemove() { _this9._removeBackdrop(); callback(); }; if (this._element.classList.contains(CLASS_NAME_FADE$4)) { var _backdropTransitionDuration = getTransitionDurationFromElement(this._backdrop); EventHandler.one(this._backdrop, 'transitionend', callbackRemove); emulateTransitionEnd(this._backdrop, _backdropTransitionDuration); } else { callbackRemove(); } } else { callback(); } }; _proto._triggerBackdropTransition = function _triggerBackdropTransition() { var _this10 = this; var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE_PREVENTED); if (hideEvent.defaultPrevented) { return; } var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; if (!isModalOverflowing) { this._element.style.overflowY = 'hidden'; } this._element.classList.add(CLASS_NAME_STATIC); var modalTransitionDuration = getTransitionDurationFromElement(this._dialog); EventHandler.off(this._element, 'transitionend'); EventHandler.one(this._element, 'transitionend', function () { _this10._element.classList.remove(CLASS_NAME_STATIC); if (!isModalOverflowing) { EventHandler.one(_this10._element, 'transitionend', function () { _this10._element.style.overflowY = ''; }); emulateTransitionEnd(_this10._element, modalTransitionDuration); } }); emulateTransitionEnd(this._element, modalTransitionDuration); this._element.focus(); } // ---------------------------------------------------------------------- // the following methods are used to handle overflowing modals // ---------------------------------------------------------------------- ; _proto._adjustDialog = function _adjustDialog() { var isModalOverflowing = this._element.scrollHeight > document.documentElement.clientHeight; if (!this._isBodyOverflowing && isModalOverflowing && !isRTL() || this._isBodyOverflowing && !isModalOverflowing && isRTL()) { this._element.style.paddingLeft = this._scrollbarWidth + "px"; } if (this._isBodyOverflowing && !isModalOverflowing && !isRTL() || !this._isBodyOverflowing && isModalOverflowing && isRTL()) { this._element.style.paddingRight = this._scrollbarWidth + "px"; } }; _proto._resetAdjustments = function _resetAdjustments() { this._element.style.paddingLeft = ''; this._element.style.paddingRight = ''; }; _proto._checkScrollbar = function _checkScrollbar() { var rect = document.body.getBoundingClientRect(); this._isBodyOverflowing = Math.round(rect.left + rect.right) < window.innerWidth; this._scrollbarWidth = this._getScrollbarWidth(); }; _proto._setScrollbar = function _setScrollbar() { var _this11 = this; if (this._isBodyOverflowing) { this._setElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight', function (calculatedValue) { return calculatedValue + _this11._scrollbarWidth; }); this._setElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight', function (calculatedValue) { return calculatedValue - _this11._scrollbarWidth; }); this._setElementAttributes('body', 'paddingRight', function (calculatedValue) { return calculatedValue + _this11._scrollbarWidth; }); } document.body.classList.add(CLASS_NAME_OPEN); }; _proto._setElementAttributes = function _setElementAttributes(selector, styleProp, callback) { var _this12 = this; SelectorEngine.find(selector).forEach(function (element) { if (element !== document.body && window.innerWidth > element.clientWidth + _this12._scrollbarWidth) { return; } var actualValue = element.style[styleProp]; var calculatedValue = window.getComputedStyle(element)[styleProp]; Manipulator.setDataAttribute(element, styleProp, actualValue); element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px'; }); }; _proto._resetScrollbar = function _resetScrollbar() { this._resetElementAttributes(SELECTOR_FIXED_CONTENT$1, 'paddingRight'); this._resetElementAttributes(SELECTOR_STICKY_CONTENT$1, 'marginRight'); this._resetElementAttributes('body', 'paddingRight'); }; _proto._resetElementAttributes = function _resetElementAttributes(selector, styleProp) { SelectorEngine.find(selector).forEach(function (element) { var value = Manipulator.getDataAttribute(element, styleProp); if (typeof value === 'undefined' && element === document.body) { element.style[styleProp] = ''; } else { Manipulator.removeDataAttribute(element, styleProp); element.style[styleProp] = value; } }); }; _proto._getScrollbarWidth = function _getScrollbarWidth() { // thx d.walsh var scrollDiv = document.createElement('div'); scrollDiv.className = CLASS_NAME_SCROLLBAR_MEASURER; document.body.appendChild(scrollDiv); var scrollbarWidth = scrollDiv.getBoundingClientRect().width - scrollDiv.clientWidth; document.body.removeChild(scrollDiv); return scrollbarWidth; } // Static ; Modal.jQueryInterface = function jQueryInterface(config, relatedTarget) { return this.each(function () { var data = Data.get(this, DATA_KEY$6); var _config = _extends({}, Default$4, Manipulator.getDataAttributes(this), typeof config === 'object' && config ? config : {}); if (!data) { data = new Modal(this, _config); } if (typeof config === 'string') { if (typeof data[config] === 'undefined') { throw new TypeError("No method named \"" + config + "\""); } data[config](relatedTarget); } }); }; _createClass(Modal, null, [{ key: "Default", get: function get() { return Default$4; } }, { key: "DATA_KEY", get: function get() { return DATA_KEY$6; } }]); return Modal; }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ EventHandler.on(document, EVENT_CLICK_DATA_API$2, SELECTOR_DATA_TOGGLE$2, function (event) { var _this13 = this; var target = getElementFromSelector(this); if (this.tagName === 'A' || this.tagName === 'AREA') { event.preventDefault(); } EventHandler.one(target, EVENT_SHOW$3, function (showEvent) { if (showEvent.defaultPrevented) { // only register focus restorer if modal will actually get shown return; } EventHandler.one(target, EVENT_HIDDEN$3, function () { if (isVisible(_this13)) { _this13.focus(); } }); }); var data = Data.get(target, DATA_KEY$6); if (!data) { var config = _extends({}, Manipulator.getDataAttributes(target), Manipulator.getDataAttributes(this)); data = new Modal(target, config); } data.toggle(this); }); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .Modal to jQuery only if jQuery is present */ defineJQueryPlugin(NAME$6, Modal); /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-beta2): util/scrollBar.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ var SELECTOR_FIXED_CONTENT = '.fixed-top, .fixed-bottom, .is-fixed'; var SELECTOR_STICKY_CONTENT = '.sticky-top'; var getWidth = function getWidth() { // https://developer.mozilla.org/en-US/docs/Web/API/Window/innerWidth#usage_notes var documentWidth = document.documentElement.clientWidth; return Math.abs(window.innerWidth - documentWidth); }; var hide = function hide(width) { if (width === void 0) { width = getWidth(); } document.body.style.overflow = 'hidden'; _setElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight', function (calculatedValue) { return calculatedValue + width; }); _setElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight', function (calculatedValue) { return calculatedValue - width; }); _setElementAttributes('body', 'paddingRight', function (calculatedValue) { return calculatedValue + width; }); }; var _setElementAttributes = function _setElementAttributes(selector, styleProp, callback) { var scrollbarWidth = getWidth(); SelectorEngine.find(selector).forEach(function (element) { if (element !== document.body && window.innerWidth > element.clientWidth + scrollbarWidth) { return; } var actualValue = element.style[styleProp]; var calculatedValue = window.getComputedStyle(element)[styleProp]; Manipulator.setDataAttribute(element, styleProp, actualValue); element.style[styleProp] = callback(Number.parseFloat(calculatedValue)) + 'px'; }); }; var reset = function reset() { document.body.style.overflow = 'auto'; _resetElementAttributes(SELECTOR_FIXED_CONTENT, 'paddingRight'); _resetElementAttributes(SELECTOR_STICKY_CONTENT, 'marginRight'); _resetElementAttributes('body', 'paddingRight'); }; var _resetElementAttributes = function _resetElementAttributes(selector, styleProp) { SelectorEngine.find(selector).forEach(function (element) { var value = Manipulator.getDataAttribute(element, styleProp); if (typeof value === 'undefined' && element === document.body) { element.style.removeProperty(styleProp); } else { Manipulator.removeDataAttribute(element, styleProp); element.style[styleProp] = value; } }); }; /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME$5 = 'offcanvas'; var DATA_KEY$5 = 'bs.offcanvas'; var EVENT_KEY$5 = "." + DATA_KEY$5; var DATA_API_KEY$2 = '.data-api'; var ESCAPE_KEY = 'Escape'; var DATA_BODY_ACTIONS = 'data-bs-body'; var CLASS_NAME_BACKDROP_BODY = 'offcanvas-backdrop'; var CLASS_NAME_DISABLED$1 = 'disabled'; var CLASS_NAME_SHOW$4 = 'show'; var CLASS_NAME_TOGGLING = 'offcanvas-toggling'; var ACTIVE_SELECTOR = ".offcanvas.show, ." + CLASS_NAME_TOGGLING; var EVENT_SHOW$2 = "show" + EVENT_KEY$5; var EVENT_SHOWN$2 = "shown" + EVENT_KEY$5; var EVENT_HIDE$2 = "hide" + EVENT_KEY$5; var EVENT_HIDDEN$2 = "hidden" + EVENT_KEY$5; var EVENT_FOCUSIN = "focusin" + EVENT_KEY$5; var EVENT_CLICK_DATA_API$1 = "click" + EVENT_KEY$5 + DATA_API_KEY$2; var EVENT_CLICK_DISMISS$1 = "click.dismiss" + EVENT_KEY$5; var SELECTOR_DATA_DISMISS$1 = '[data-bs-dismiss="offcanvas"]'; var SELECTOR_DATA_TOGGLE$1 = '[data-bs-toggle="offcanvas"]'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var OffCanvas = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(OffCanvas, _BaseComponent); function OffCanvas(element) { var _this; _this = _BaseComponent.call(this, element) || this; _this._isShown = element.classList.contains(CLASS_NAME_SHOW$4); _this._bodyOptions = element.getAttribute(DATA_BODY_ACTIONS) || ''; _this._addEventListeners(); return _this; } // Public var _proto = OffCanvas.prototype; _proto.toggle = function toggle(relatedTarget) { return this._isShown ? this.hide() : this.show(relatedTarget); }; _proto.show = function show(relatedTarget) { var _this2 = this; if (this._isShown) { return; } var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$2, { relatedTarget: relatedTarget }); if (showEvent.defaultPrevented) { return; } this._isShown = true; this._element.style.visibility = 'visible'; if (this._bodyOptionsHas('backdrop') || !this._bodyOptions.length) { document.body.classList.add(CLASS_NAME_BACKDROP_BODY); } if (!this._bodyOptionsHas('scroll')) { hide(); } this._element.classList.add(CLASS_NAME_TOGGLING); this._element.removeAttribute('aria-hidden'); this._element.setAttribute('aria-modal', true); this._element.setAttribute('role', 'dialog'); this._element.classList.add(CLASS_NAME_SHOW$4); var completeCallBack = function completeCallBack() { _this2._element.classList.remove(CLASS_NAME_TOGGLING); EventHandler.trigger(_this2._element, EVENT_SHOWN$2, { relatedTarget: relatedTarget }); _this2._enforceFocusOnElement(_this2._element); }; setTimeout(completeCallBack, getTransitionDurationFromElement(this._element)); }; _proto.hide = function hide() { var _this3 = this; if (!this._isShown) { return; } var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE$2); if (hideEvent.defaultPrevented) { return; } this._element.classList.add(CLASS_NAME_TOGGLING); EventHandler.off(document, EVENT_FOCUSIN); this._element.blur(); this._isShown = false; this._element.classList.remove(CLASS_NAME_SHOW$4); var completeCallback = function completeCallback() { _this3._element.setAttribute('aria-hidden', true); _this3._element.removeAttribute('aria-modal'); _this3._element.removeAttribute('role'); _this3._element.style.visibility = 'hidden'; if (_this3._bodyOptionsHas('backdrop') || !_this3._bodyOptions.length) { document.body.classList.remove(CLASS_NAME_BACKDROP_BODY); } if (!_this3._bodyOptionsHas('scroll')) { reset(); } EventHandler.trigger(_this3._element, EVENT_HIDDEN$2); _this3._element.classList.remove(CLASS_NAME_TOGGLING); }; setTimeout(completeCallback, getTransitionDurationFromElement(this._element)); }; _proto._enforceFocusOnElement = function _enforceFocusOnElement(element) { EventHandler.off(document, EVENT_FOCUSIN); // guard against infinite focus loop EventHandler.on(document, EVENT_FOCUSIN, function (event) { if (document !== event.target && element !== event.target && !element.contains(event.target)) { element.focus(); } }); element.focus(); }; _proto._bodyOptionsHas = function _bodyOptionsHas(option) { return this._bodyOptions.split(',').includes(option); }; _proto._addEventListeners = function _addEventListeners() { var _this4 = this; EventHandler.on(this._element, EVENT_CLICK_DISMISS$1, SELECTOR_DATA_DISMISS$1, function () { return _this4.hide(); }); EventHandler.on(document, 'keydown', function (event) { if (event.key === ESCAPE_KEY) { _this4.hide(); } }); EventHandler.on(document, EVENT_CLICK_DATA_API$1, function (event) { var target = SelectorEngine.findOne(getSelectorFromElement(event.target)); if (!_this4._element.contains(event.target) && target !== _this4._element) { _this4.hide(); } }); } // Static ; OffCanvas.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.get(this, DATA_KEY$5) || new OffCanvas(this); if (typeof config === 'string') { if (typeof data[config] === 'undefined') { throw new TypeError("No method named \"" + config + "\""); } data[config](this); } }); }; return OffCanvas; }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ EventHandler.on(document, EVENT_CLICK_DATA_API$1, SELECTOR_DATA_TOGGLE$1, function (event) { var _this5 = this; var target = getElementFromSelector(this); if (['A', 'AREA'].includes(this.tagName)) { event.preventDefault(); } if (this.disabled || this.classList.contains(CLASS_NAME_DISABLED$1)) { return; } EventHandler.one(target, EVENT_HIDDEN$2, function () { // focus on trigger when it is closed if (isVisible(_this5)) { _this5.focus(); } }); // avoid conflict when clicking a toggler of an offcanvas, while another is open var allReadyOpen = SelectorEngine.findOne(ACTIVE_SELECTOR); if (allReadyOpen && allReadyOpen !== target) { return; } var data = Data.get(target, DATA_KEY$5) || new OffCanvas(target); data.toggle(this); }); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ */ defineJQueryPlugin(NAME$5, OffCanvas); /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-beta2): util/sanitizer.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ var uriAttrs = new Set(['background', 'cite', 'href', 'itemtype', 'longdesc', 'poster', 'src', 'xlink:href']); var ARIA_ATTRIBUTE_PATTERN = /^aria-[\w-]*$/i; /** * A pattern that recognizes a commonly useful subset of URLs that are safe. * * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts */ var SAFE_URL_PATTERN = /^(?:(?:https?|mailto|ftp|tel|file):|[^#&/:?]*(?:[#/?]|$))/i; /** * A pattern that matches safe data URLs. Only matches image, video and audio types. * * Shoutout to Angular 7 https://github.com/angular/angular/blob/7.2.4/packages/core/src/sanitization/url_sanitizer.ts */ var DATA_URL_PATTERN = /^data:(?:image\/(?:bmp|gif|jpeg|jpg|png|tiff|webp)|video\/(?:mpeg|mp4|ogg|webm)|audio\/(?:mp3|oga|ogg|opus));base64,[\d+/a-z]+=*$/i; var allowedAttribute = function allowedAttribute(attr, allowedAttributeList) { var attrName = attr.nodeName.toLowerCase(); if (allowedAttributeList.includes(attrName)) { if (uriAttrs.has(attrName)) { return Boolean(SAFE_URL_PATTERN.test(attr.nodeValue) || DATA_URL_PATTERN.test(attr.nodeValue)); } return true; } var regExp = allowedAttributeList.filter(function (attrRegex) { return attrRegex instanceof RegExp; }); // Check if a regular expression validates the attribute. for (var i = 0, len = regExp.length; i < len; i++) { if (regExp[i].test(attrName)) { return true; } } return false; }; var DefaultAllowlist = { // Global attributes allowed on any supplied element below. '*': ['class', 'dir', 'id', 'lang', 'role', ARIA_ATTRIBUTE_PATTERN], a: ['target', 'href', 'title', 'rel'], area: [], b: [], br: [], col: [], code: [], div: [], em: [], hr: [], h1: [], h2: [], h3: [], h4: [], h5: [], h6: [], i: [], img: ['src', 'srcset', 'alt', 'title', 'width', 'height'], li: [], ol: [], p: [], pre: [], s: [], small: [], span: [], sub: [], sup: [], strong: [], u: [], ul: [] }; function sanitizeHtml(unsafeHtml, allowList, sanitizeFn) { var _ref; if (!unsafeHtml.length) { return unsafeHtml; } if (sanitizeFn && typeof sanitizeFn === 'function') { return sanitizeFn(unsafeHtml); } var domParser = new window.DOMParser(); var createdDocument = domParser.parseFromString(unsafeHtml, 'text/html'); var allowlistKeys = Object.keys(allowList); var elements = (_ref = []).concat.apply(_ref, createdDocument.body.querySelectorAll('*')); var _loop = function _loop(i, len) { var _ref2; var el = elements[i]; var elName = el.nodeName.toLowerCase(); if (!allowlistKeys.includes(elName)) { el.parentNode.removeChild(el); return "continue"; } var attributeList = (_ref2 = []).concat.apply(_ref2, el.attributes); var allowedAttributes = [].concat(allowList['*'] || [], allowList[elName] || []); attributeList.forEach(function (attr) { if (!allowedAttribute(attr, allowedAttributes)) { el.removeAttribute(attr.nodeName); } }); }; for (var i = 0, len = elements.length; i < len; i++) { var _ret = _loop(i); if (_ret === "continue") continue; } return createdDocument.body.innerHTML; } /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME$4 = 'tooltip'; var DATA_KEY$4 = 'bs.tooltip'; var EVENT_KEY$4 = "." + DATA_KEY$4; var CLASS_PREFIX$1 = 'bs-tooltip'; var BSCLS_PREFIX_REGEX$1 = new RegExp("(^|\\s)" + CLASS_PREFIX$1 + "\\S+", 'g'); var DISALLOWED_ATTRIBUTES = new Set(['sanitize', 'allowList', 'sanitizeFn']); var DefaultType$3 = { animation: 'boolean', template: 'string', title: '(string|element|function)', trigger: 'string', delay: '(number|object)', html: 'boolean', selector: '(string|boolean)', placement: '(string|function)', offset: '(array|string|function)', container: '(string|element|boolean)', fallbackPlacements: 'array', boundary: '(string|element)', customClass: '(string|function)', sanitize: 'boolean', sanitizeFn: '(null|function)', allowList: 'object', popperConfig: '(null|object|function)' }; var AttachmentMap = { AUTO: 'auto', TOP: 'top', RIGHT: isRTL() ? 'left' : 'right', BOTTOM: 'bottom', LEFT: isRTL() ? 'right' : 'left' }; var Default$3 = { animation: true, template: '<div class="tooltip" role="tooltip">' + '<div class="tooltip-arrow"></div>' + '<div class="tooltip-inner"></div>' + '</div>', trigger: 'hover focus', title: '', delay: 0, html: false, selector: false, placement: 'top', offset: [0, 0], container: false, fallbackPlacements: ['top', 'right', 'bottom', 'left'], boundary: 'clippingParents', customClass: '', sanitize: true, sanitizeFn: null, allowList: DefaultAllowlist, popperConfig: null }; var Event$2 = { HIDE: "hide" + EVENT_KEY$4, HIDDEN: "hidden" + EVENT_KEY$4, SHOW: "show" + EVENT_KEY$4, SHOWN: "shown" + EVENT_KEY$4, INSERTED: "inserted" + EVENT_KEY$4, CLICK: "click" + EVENT_KEY$4, FOCUSIN: "focusin" + EVENT_KEY$4, FOCUSOUT: "focusout" + EVENT_KEY$4, MOUSEENTER: "mouseenter" + EVENT_KEY$4, MOUSELEAVE: "mouseleave" + EVENT_KEY$4 }; var CLASS_NAME_FADE$3 = 'fade'; var CLASS_NAME_MODAL = 'modal'; var CLASS_NAME_SHOW$3 = 'show'; var HOVER_STATE_SHOW = 'show'; var HOVER_STATE_OUT = 'out'; var SELECTOR_TOOLTIP_INNER = '.tooltip-inner'; var TRIGGER_HOVER = 'hover'; var TRIGGER_FOCUS = 'focus'; var TRIGGER_CLICK = 'click'; var TRIGGER_MANUAL = 'manual'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var Tooltip = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(Tooltip, _BaseComponent); function Tooltip(element, config) { var _this; if (typeof Popper__namespace === 'undefined') { throw new TypeError('Bootstrap\'s tooltips require Popper (https://popper.js.org)'); } _this = _BaseComponent.call(this, element) || this; // private _this._isEnabled = true; _this._timeout = 0; _this._hoverState = ''; _this._activeTrigger = {}; _this._popper = null; // Protected _this.config = _this._getConfig(config); _this.tip = null; _this._setListeners(); return _this; } // Getters var _proto = Tooltip.prototype; // Public _proto.enable = function enable() { this._isEnabled = true; }; _proto.disable = function disable() { this._isEnabled = false; }; _proto.toggleEnabled = function toggleEnabled() { this._isEnabled = !this._isEnabled; }; _proto.toggle = function toggle(event) { if (!this._isEnabled) { return; } if (event) { var context = this._initializeOnDelegatedTarget(event); context._activeTrigger.click = !context._activeTrigger.click; if (context._isWithActiveTrigger()) { context._enter(null, context); } else { context._leave(null, context); } } else { if (this.getTipElement().classList.contains(CLASS_NAME_SHOW$3)) { this._leave(null, this); return; } this._enter(null, this); } }; _proto.dispose = function dispose() { clearTimeout(this._timeout); EventHandler.off(this._element, this.constructor.EVENT_KEY); EventHandler.off(this._element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler); if (this.tip && this.tip.parentNode) { this.tip.parentNode.removeChild(this.tip); } this._isEnabled = null; this._timeout = null; this._hoverState = null; this._activeTrigger = null; if (this._popper) { this._popper.destroy(); } this._popper = null; this.config = null; this.tip = null; _BaseComponent.prototype.dispose.call(this); }; _proto.show = function show() { var _this2 = this; if (this._element.style.display === 'none') { throw new Error('Please use show on visible elements'); } if (!(this.isWithContent() && this._isEnabled)) { return; } var showEvent = EventHandler.trigger(this._element, this.constructor.Event.SHOW); var shadowRoot = findShadowRoot(this._element); var isInTheDom = shadowRoot === null ? this._element.ownerDocument.documentElement.contains(this._element) : shadowRoot.contains(this._element); if (showEvent.defaultPrevented || !isInTheDom) { return; } var tip = this.getTipElement(); var tipId = getUID(this.constructor.NAME); tip.setAttribute('id', tipId); this._element.setAttribute('aria-describedby', tipId); this.setContent(); if (this.config.animation) { tip.classList.add(CLASS_NAME_FADE$3); } var placement = typeof this.config.placement === 'function' ? this.config.placement.call(this, tip, this._element) : this.config.placement; var attachment = this._getAttachment(placement); this._addAttachmentClass(attachment); var container = this._getContainer(); Data.set(tip, this.constructor.DATA_KEY, this); if (!this._element.ownerDocument.documentElement.contains(this.tip)) { container.appendChild(tip); } EventHandler.trigger(this._element, this.constructor.Event.INSERTED); this._popper = Popper.createPopper(this._element, tip, this._getPopperConfig(attachment)); tip.classList.add(CLASS_NAME_SHOW$3); var customClass = typeof this.config.customClass === 'function' ? this.config.customClass() : this.config.customClass; if (customClass) { var _tip$classList; (_tip$classList = tip.classList).add.apply(_tip$classList, customClass.split(' ')); } // If this is a touch-enabled device we add extra // empty mouseover listeners to the body's immediate children; // only needed because of broken event delegation on iOS // https://www.quirksmode.org/blog/archives/2014/02/mouse_event_bub.html if ('ontouchstart' in document.documentElement) { var _ref; (_ref = []).concat.apply(_ref, document.body.children).forEach(function (element) { EventHandler.on(element, 'mouseover', noop()); }); } var complete = function complete() { var prevHoverState = _this2._hoverState; _this2._hoverState = null; EventHandler.trigger(_this2._element, _this2.constructor.Event.SHOWN); if (prevHoverState === HOVER_STATE_OUT) { _this2._leave(null, _this2); } }; if (this.tip.classList.contains(CLASS_NAME_FADE$3)) { var transitionDuration = getTransitionDurationFromElement(this.tip); EventHandler.one(this.tip, 'transitionend', complete); emulateTransitionEnd(this.tip, transitionDuration); } else { complete(); } }; _proto.hide = function hide() { var _this3 = this; if (!this._popper) { return; } var tip = this.getTipElement(); var complete = function complete() { if (_this3._hoverState !== HOVER_STATE_SHOW && tip.parentNode) { tip.parentNode.removeChild(tip); } _this3._cleanTipClass(); _this3._element.removeAttribute('aria-describedby'); EventHandler.trigger(_this3._element, _this3.constructor.Event.HIDDEN); if (_this3._popper) { _this3._popper.destroy(); _this3._popper = null; } }; var hideEvent = EventHandler.trigger(this._element, this.constructor.Event.HIDE); if (hideEvent.defaultPrevented) { return; } tip.classList.remove(CLASS_NAME_SHOW$3); // If this is a touch-enabled device we remove the extra // empty mouseover listeners we added for iOS support if ('ontouchstart' in document.documentElement) { var _ref2; (_ref2 = []).concat.apply(_ref2, document.body.children).forEach(function (element) { return EventHandler.off(element, 'mouseover', noop); }); } this._activeTrigger[TRIGGER_CLICK] = false; this._activeTrigger[TRIGGER_FOCUS] = false; this._activeTrigger[TRIGGER_HOVER] = false; if (this.tip.classList.contains(CLASS_NAME_FADE$3)) { var transitionDuration = getTransitionDurationFromElement(tip); EventHandler.one(tip, 'transitionend', complete); emulateTransitionEnd(tip, transitionDuration); } else { complete(); } this._hoverState = ''; }; _proto.update = function update() { if (this._popper !== null) { this._popper.update(); } } // Protected ; _proto.isWithContent = function isWithContent() { return Boolean(this.getTitle()); }; _proto.getTipElement = function getTipElement() { if (this.tip) { return this.tip; } var element = document.createElement('div'); element.innerHTML = this.config.template; this.tip = element.children[0]; return this.tip; }; _proto.setContent = function setContent() { var tip = this.getTipElement(); this.setElementContent(SelectorEngine.findOne(SELECTOR_TOOLTIP_INNER, tip), this.getTitle()); tip.classList.remove(CLASS_NAME_FADE$3, CLASS_NAME_SHOW$3); }; _proto.setElementContent = function setElementContent(element, content) { if (element === null) { return; } if (typeof content === 'object' && isElement(content)) { if (content.jquery) { content = content[0]; } // content is a DOM node or a jQuery if (this.config.html) { if (content.parentNode !== element) { element.innerHTML = ''; element.appendChild(content); } } else { element.textContent = content.textContent; } return; } if (this.config.html) { if (this.config.sanitize) { content = sanitizeHtml(content, this.config.allowList, this.config.sanitizeFn); } element.innerHTML = content; } else { element.textContent = content; } }; _proto.getTitle = function getTitle() { var title = this._element.getAttribute('data-bs-original-title'); if (!title) { title = typeof this.config.title === 'function' ? this.config.title.call(this._element) : this.config.title; } return title; }; _proto.updateAttachment = function updateAttachment(attachment) { if (attachment === 'right') { return 'end'; } if (attachment === 'left') { return 'start'; } return attachment; } // Private ; _proto._initializeOnDelegatedTarget = function _initializeOnDelegatedTarget(event, context) { var dataKey = this.constructor.DATA_KEY; context = context || Data.get(event.delegateTarget, dataKey); if (!context) { context = new this.constructor(event.delegateTarget, this._getDelegateConfig()); Data.set(event.delegateTarget, dataKey, context); } return context; }; _proto._getOffset = function _getOffset() { var _this4 = this; var offset = this.config.offset; if (typeof offset === 'string') { return offset.split(',').map(function (val) { return Number.parseInt(val, 10); }); } if (typeof offset === 'function') { return function (popperData) { return offset(popperData, _this4._element); }; } return offset; }; _proto._getPopperConfig = function _getPopperConfig(attachment) { var _this5 = this; var defaultBsPopperConfig = { placement: attachment, modifiers: [{ name: 'flip', options: { altBoundary: true, fallbackPlacements: this.config.fallbackPlacements } }, { name: 'offset', options: { offset: this._getOffset() } }, { name: 'preventOverflow', options: { boundary: this.config.boundary } }, { name: 'arrow', options: { element: "." + this.constructor.NAME + "-arrow" } }, { name: 'onChange', enabled: true, phase: 'afterWrite', fn: function fn(data) { return _this5._handlePopperPlacementChange(data); } }], onFirstUpdate: function onFirstUpdate(data) { if (data.options.placement !== data.placement) { _this5._handlePopperPlacementChange(data); } } }; return _extends({}, defaultBsPopperConfig, typeof this.config.popperConfig === 'function' ? this.config.popperConfig(defaultBsPopperConfig) : this.config.popperConfig); }; _proto._addAttachmentClass = function _addAttachmentClass(attachment) { this.getTipElement().classList.add(CLASS_PREFIX$1 + "-" + this.updateAttachment(attachment)); }; _proto._getContainer = function _getContainer() { if (this.config.container === false) { return document.body; } if (isElement(this.config.container)) { return this.config.container; } return SelectorEngine.findOne(this.config.container); }; _proto._getAttachment = function _getAttachment(placement) { return AttachmentMap[placement.toUpperCase()]; }; _proto._setListeners = function _setListeners() { var _this6 = this; var triggers = this.config.trigger.split(' '); triggers.forEach(function (trigger) { if (trigger === 'click') { EventHandler.on(_this6._element, _this6.constructor.Event.CLICK, _this6.config.selector, function (event) { return _this6.toggle(event); }); } else if (trigger !== TRIGGER_MANUAL) { var eventIn = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSEENTER : _this6.constructor.Event.FOCUSIN; var eventOut = trigger === TRIGGER_HOVER ? _this6.constructor.Event.MOUSELEAVE : _this6.constructor.Event.FOCUSOUT; EventHandler.on(_this6._element, eventIn, _this6.config.selector, function (event) { return _this6._enter(event); }); EventHandler.on(_this6._element, eventOut, _this6.config.selector, function (event) { return _this6._leave(event); }); } }); this._hideModalHandler = function () { if (_this6._element) { _this6.hide(); } }; EventHandler.on(this._element.closest("." + CLASS_NAME_MODAL), 'hide.bs.modal', this._hideModalHandler); if (this.config.selector) { this.config = _extends({}, this.config, { trigger: 'manual', selector: '' }); } else { this._fixTitle(); } }; _proto._fixTitle = function _fixTitle() { var title = this._element.getAttribute('title'); var originalTitleType = typeof this._element.getAttribute('data-bs-original-title'); if (title || originalTitleType !== 'string') { this._element.setAttribute('data-bs-original-title', title || ''); if (title && !this._element.getAttribute('aria-label') && !this._element.textContent) { this._element.setAttribute('aria-label', title); } this._element.setAttribute('title', ''); } }; _proto._enter = function _enter(event, context) { context = this._initializeOnDelegatedTarget(event, context); if (event) { context._activeTrigger[event.type === 'focusin' ? TRIGGER_FOCUS : TRIGGER_HOVER] = true; } if (context.getTipElement().classList.contains(CLASS_NAME_SHOW$3) || context._hoverState === HOVER_STATE_SHOW) { context._hoverState = HOVER_STATE_SHOW; return; } clearTimeout(context._timeout); context._hoverState = HOVER_STATE_SHOW; if (!context.config.delay || !context.config.delay.show) { context.show(); return; } context._timeout = setTimeout(function () { if (context._hoverState === HOVER_STATE_SHOW) { context.show(); } }, context.config.delay.show); }; _proto._leave = function _leave(event, context) { context = this._initializeOnDelegatedTarget(event, context); if (event) { context._activeTrigger[event.type === 'focusout' ? TRIGGER_FOCUS : TRIGGER_HOVER] = false; } if (context._isWithActiveTrigger()) { return; } clearTimeout(context._timeout); context._hoverState = HOVER_STATE_OUT; if (!context.config.delay || !context.config.delay.hide) { context.hide(); return; } context._timeout = setTimeout(function () { if (context._hoverState === HOVER_STATE_OUT) { context.hide(); } }, context.config.delay.hide); }; _proto._isWithActiveTrigger = function _isWithActiveTrigger() { for (var trigger in this._activeTrigger) { if (this._activeTrigger[trigger]) { return true; } } return false; }; _proto._getConfig = function _getConfig(config) { var dataAttributes = Manipulator.getDataAttributes(this._element); Object.keys(dataAttributes).forEach(function (dataAttr) { if (DISALLOWED_ATTRIBUTES.has(dataAttr)) { delete dataAttributes[dataAttr]; } }); if (config && typeof config.container === 'object' && config.container.jquery) { config.container = config.container[0]; } config = _extends({}, this.constructor.Default, dataAttributes, typeof config === 'object' && config ? config : {}); if (typeof config.delay === 'number') { config.delay = { show: config.delay, hide: config.delay }; } if (typeof config.title === 'number') { config.title = config.title.toString(); } if (typeof config.content === 'number') { config.content = config.content.toString(); } typeCheckConfig(NAME$4, config, this.constructor.DefaultType); if (config.sanitize) { config.template = sanitizeHtml(config.template, config.allowList, config.sanitizeFn); } return config; }; _proto._getDelegateConfig = function _getDelegateConfig() { var config = {}; if (this.config) { for (var key in this.config) { if (this.constructor.Default[key] !== this.config[key]) { config[key] = this.config[key]; } } } return config; }; _proto._cleanTipClass = function _cleanTipClass() { var tip = this.getTipElement(); var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX$1); if (tabClass !== null && tabClass.length > 0) { tabClass.map(function (token) { return token.trim(); }).forEach(function (tClass) { return tip.classList.remove(tClass); }); } }; _proto._handlePopperPlacementChange = function _handlePopperPlacementChange(popperData) { var state = popperData.state; if (!state) { return; } this.tip = state.elements.popper; this._cleanTipClass(); this._addAttachmentClass(this._getAttachment(state.placement)); } // Static ; Tooltip.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.get(this, DATA_KEY$4); var _config = typeof config === 'object' && config; if (!data && /dispose|hide/.test(config)) { return; } if (!data) { data = new Tooltip(this, _config); } if (typeof config === 'string') { if (typeof data[config] === 'undefined') { throw new TypeError("No method named \"" + config + "\""); } data[config](); } }); }; _createClass(Tooltip, null, [{ key: "Default", get: function get() { return Default$3; } }, { key: "NAME", get: function get() { return NAME$4; } }, { key: "DATA_KEY", get: function get() { return DATA_KEY$4; } }, { key: "Event", get: function get() { return Event$2; } }, { key: "EVENT_KEY", get: function get() { return EVENT_KEY$4; } }, { key: "DefaultType", get: function get() { return DefaultType$3; } }]); return Tooltip; }(BaseComponent); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .Tooltip to jQuery only if jQuery is present */ defineJQueryPlugin(NAME$4, Tooltip); /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME$3 = 'popover'; var DATA_KEY$3 = 'bs.popover'; var EVENT_KEY$3 = "." + DATA_KEY$3; var CLASS_PREFIX = 'bs-popover'; var BSCLS_PREFIX_REGEX = new RegExp("(^|\\s)" + CLASS_PREFIX + "\\S+", 'g'); var Default$2 = _extends({}, Tooltip.Default, { placement: 'right', offset: [0, 8], trigger: 'click', content: '', template: '<div class="popover" role="tooltip">' + '<div class="popover-arrow"></div>' + '<h3 class="popover-header"></h3>' + '<div class="popover-body"></div>' + '</div>' }); var DefaultType$2 = _extends({}, Tooltip.DefaultType, { content: '(string|element|function)' }); var Event$1 = { HIDE: "hide" + EVENT_KEY$3, HIDDEN: "hidden" + EVENT_KEY$3, SHOW: "show" + EVENT_KEY$3, SHOWN: "shown" + EVENT_KEY$3, INSERTED: "inserted" + EVENT_KEY$3, CLICK: "click" + EVENT_KEY$3, FOCUSIN: "focusin" + EVENT_KEY$3, FOCUSOUT: "focusout" + EVENT_KEY$3, MOUSEENTER: "mouseenter" + EVENT_KEY$3, MOUSELEAVE: "mouseleave" + EVENT_KEY$3 }; var CLASS_NAME_FADE$2 = 'fade'; var CLASS_NAME_SHOW$2 = 'show'; var SELECTOR_TITLE = '.popover-header'; var SELECTOR_CONTENT = '.popover-body'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var Popover = /*#__PURE__*/function (_Tooltip) { _inheritsLoose(Popover, _Tooltip); function Popover() { return _Tooltip.apply(this, arguments) || this; } var _proto = Popover.prototype; // Overrides _proto.isWithContent = function isWithContent() { return this.getTitle() || this._getContent(); }; _proto.setContent = function setContent() { var tip = this.getTipElement(); // we use append for html objects to maintain js events this.setElementContent(SelectorEngine.findOne(SELECTOR_TITLE, tip), this.getTitle()); var content = this._getContent(); if (typeof content === 'function') { content = content.call(this._element); } this.setElementContent(SelectorEngine.findOne(SELECTOR_CONTENT, tip), content); tip.classList.remove(CLASS_NAME_FADE$2, CLASS_NAME_SHOW$2); } // Private ; _proto._addAttachmentClass = function _addAttachmentClass(attachment) { this.getTipElement().classList.add(CLASS_PREFIX + "-" + this.updateAttachment(attachment)); }; _proto._getContent = function _getContent() { return this._element.getAttribute('data-bs-content') || this.config.content; }; _proto._cleanTipClass = function _cleanTipClass() { var tip = this.getTipElement(); var tabClass = tip.getAttribute('class').match(BSCLS_PREFIX_REGEX); if (tabClass !== null && tabClass.length > 0) { tabClass.map(function (token) { return token.trim(); }).forEach(function (tClass) { return tip.classList.remove(tClass); }); } } // Static ; Popover.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.get(this, DATA_KEY$3); var _config = typeof config === 'object' ? config : null; if (!data && /dispose|hide/.test(config)) { return; } if (!data) { data = new Popover(this, _config); Data.set(this, DATA_KEY$3, data); } if (typeof config === 'string') { if (typeof data[config] === 'undefined') { throw new TypeError("No method named \"" + config + "\""); } data[config](); } }); }; _createClass(Popover, null, [{ key: "Default", get: // Getters function get() { return Default$2; } }, { key: "NAME", get: function get() { return NAME$3; } }, { key: "DATA_KEY", get: function get() { return DATA_KEY$3; } }, { key: "Event", get: function get() { return Event$1; } }, { key: "EVENT_KEY", get: function get() { return EVENT_KEY$3; } }, { key: "DefaultType", get: function get() { return DefaultType$2; } }]); return Popover; }(Tooltip); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .Popover to jQuery only if jQuery is present */ defineJQueryPlugin(NAME$3, Popover); /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME$2 = 'scrollspy'; var DATA_KEY$2 = 'bs.scrollspy'; var EVENT_KEY$2 = "." + DATA_KEY$2; var DATA_API_KEY$1 = '.data-api'; var Default$1 = { offset: 10, method: 'auto', target: '' }; var DefaultType$1 = { offset: 'number', method: 'string', target: '(string|element)' }; var EVENT_ACTIVATE = "activate" + EVENT_KEY$2; var EVENT_SCROLL = "scroll" + EVENT_KEY$2; var EVENT_LOAD_DATA_API = "load" + EVENT_KEY$2 + DATA_API_KEY$1; var CLASS_NAME_DROPDOWN_ITEM = 'dropdown-item'; var CLASS_NAME_ACTIVE$1 = 'active'; var SELECTOR_DATA_SPY = '[data-bs-spy="scroll"]'; var SELECTOR_NAV_LIST_GROUP$1 = '.nav, .list-group'; var SELECTOR_NAV_LINKS = '.nav-link'; var SELECTOR_NAV_ITEMS = '.nav-item'; var SELECTOR_LIST_ITEMS = '.list-group-item'; var SELECTOR_DROPDOWN$1 = '.dropdown'; var SELECTOR_DROPDOWN_TOGGLE$1 = '.dropdown-toggle'; var METHOD_OFFSET = 'offset'; var METHOD_POSITION = 'position'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var ScrollSpy = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(ScrollSpy, _BaseComponent); function ScrollSpy(element, config) { var _this; _this = _BaseComponent.call(this, element) || this; _this._scrollElement = _this._element.tagName === 'BODY' ? window : _this._element; _this._config = _this._getConfig(config); _this._selector = _this._config.target + " " + SELECTOR_NAV_LINKS + ", " + _this._config.target + " " + SELECTOR_LIST_ITEMS + ", " + _this._config.target + " ." + CLASS_NAME_DROPDOWN_ITEM; _this._offsets = []; _this._targets = []; _this._activeTarget = null; _this._scrollHeight = 0; EventHandler.on(_this._scrollElement, EVENT_SCROLL, function () { return _this._process(); }); _this.refresh(); _this._process(); return _this; } // Getters var _proto = ScrollSpy.prototype; // Public _proto.refresh = function refresh() { var _this2 = this; var autoMethod = this._scrollElement === this._scrollElement.window ? METHOD_OFFSET : METHOD_POSITION; var offsetMethod = this._config.method === 'auto' ? autoMethod : this._config.method; var offsetBase = offsetMethod === METHOD_POSITION ? this._getScrollTop() : 0; this._offsets = []; this._targets = []; this._scrollHeight = this._getScrollHeight(); var targets = SelectorEngine.find(this._selector); targets.map(function (element) { var targetSelector = getSelectorFromElement(element); var target = targetSelector ? SelectorEngine.findOne(targetSelector) : null; if (target) { var targetBCR = target.getBoundingClientRect(); if (targetBCR.width || targetBCR.height) { return [Manipulator[offsetMethod](target).top + offsetBase, targetSelector]; } } return null; }).filter(function (item) { return item; }).sort(function (a, b) { return a[0] - b[0]; }).forEach(function (item) { _this2._offsets.push(item[0]); _this2._targets.push(item[1]); }); }; _proto.dispose = function dispose() { _BaseComponent.prototype.dispose.call(this); EventHandler.off(this._scrollElement, EVENT_KEY$2); this._scrollElement = null; this._config = null; this._selector = null; this._offsets = null; this._targets = null; this._activeTarget = null; this._scrollHeight = null; } // Private ; _proto._getConfig = function _getConfig(config) { config = _extends({}, Default$1, typeof config === 'object' && config ? config : {}); if (typeof config.target !== 'string' && isElement(config.target)) { var id = config.target.id; if (!id) { id = getUID(NAME$2); config.target.id = id; } config.target = "#" + id; } typeCheckConfig(NAME$2, config, DefaultType$1); return config; }; _proto._getScrollTop = function _getScrollTop() { return this._scrollElement === window ? this._scrollElement.pageYOffset : this._scrollElement.scrollTop; }; _proto._getScrollHeight = function _getScrollHeight() { return this._scrollElement.scrollHeight || Math.max(document.body.scrollHeight, document.documentElement.scrollHeight); }; _proto._getOffsetHeight = function _getOffsetHeight() { return this._scrollElement === window ? window.innerHeight : this._scrollElement.getBoundingClientRect().height; }; _proto._process = function _process() { var scrollTop = this._getScrollTop() + this._config.offset; var scrollHeight = this._getScrollHeight(); var maxScroll = this._config.offset + scrollHeight - this._getOffsetHeight(); if (this._scrollHeight !== scrollHeight) { this.refresh(); } if (scrollTop >= maxScroll) { var target = this._targets[this._targets.length - 1]; if (this._activeTarget !== target) { this._activate(target); } return; } if (this._activeTarget && scrollTop < this._offsets[0] && this._offsets[0] > 0) { this._activeTarget = null; this._clear(); return; } for (var i = this._offsets.length; i--;) { var isActiveTarget = this._activeTarget !== this._targets[i] && scrollTop >= this._offsets[i] && (typeof this._offsets[i + 1] === 'undefined' || scrollTop < this._offsets[i + 1]); if (isActiveTarget) { this._activate(this._targets[i]); } } }; _proto._activate = function _activate(target) { this._activeTarget = target; this._clear(); var queries = this._selector.split(',').map(function (selector) { return selector + "[data-bs-target=\"" + target + "\"]," + selector + "[href=\"" + target + "\"]"; }); var link = SelectorEngine.findOne(queries.join(',')); if (link.classList.contains(CLASS_NAME_DROPDOWN_ITEM)) { SelectorEngine.findOne(SELECTOR_DROPDOWN_TOGGLE$1, link.closest(SELECTOR_DROPDOWN$1)).classList.add(CLASS_NAME_ACTIVE$1); link.classList.add(CLASS_NAME_ACTIVE$1); } else { // Set triggered link as active link.classList.add(CLASS_NAME_ACTIVE$1); SelectorEngine.parents(link, SELECTOR_NAV_LIST_GROUP$1).forEach(function (listGroup) { // Set triggered links parents as active // With both <ul> and <nav> markup a parent is the previous sibling of any nav ancestor SelectorEngine.prev(listGroup, SELECTOR_NAV_LINKS + ", " + SELECTOR_LIST_ITEMS).forEach(function (item) { return item.classList.add(CLASS_NAME_ACTIVE$1); }); // Handle special case when .nav-link is inside .nav-item SelectorEngine.prev(listGroup, SELECTOR_NAV_ITEMS).forEach(function (navItem) { SelectorEngine.children(navItem, SELECTOR_NAV_LINKS).forEach(function (item) { return item.classList.add(CLASS_NAME_ACTIVE$1); }); }); }); } EventHandler.trigger(this._scrollElement, EVENT_ACTIVATE, { relatedTarget: target }); }; _proto._clear = function _clear() { SelectorEngine.find(this._selector).filter(function (node) { return node.classList.contains(CLASS_NAME_ACTIVE$1); }).forEach(function (node) { return node.classList.remove(CLASS_NAME_ACTIVE$1); }); } // Static ; ScrollSpy.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.get(this, DATA_KEY$2); var _config = typeof config === 'object' && config; if (!data) { data = new ScrollSpy(this, _config); } if (typeof config === 'string') { if (typeof data[config] === 'undefined') { throw new TypeError("No method named \"" + config + "\""); } data[config](); } }); }; _createClass(ScrollSpy, null, [{ key: "Default", get: function get() { return Default$1; } }, { key: "DATA_KEY", get: function get() { return DATA_KEY$2; } }]); return ScrollSpy; }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ EventHandler.on(window, EVENT_LOAD_DATA_API, function () { SelectorEngine.find(SELECTOR_DATA_SPY).forEach(function (spy) { return new ScrollSpy(spy, Manipulator.getDataAttributes(spy)); }); }); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .ScrollSpy to jQuery only if jQuery is present */ defineJQueryPlugin(NAME$2, ScrollSpy); /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME$1 = 'tab'; var DATA_KEY$1 = 'bs.tab'; var EVENT_KEY$1 = "." + DATA_KEY$1; var DATA_API_KEY = '.data-api'; var EVENT_HIDE$1 = "hide" + EVENT_KEY$1; var EVENT_HIDDEN$1 = "hidden" + EVENT_KEY$1; var EVENT_SHOW$1 = "show" + EVENT_KEY$1; var EVENT_SHOWN$1 = "shown" + EVENT_KEY$1; var EVENT_CLICK_DATA_API = "click" + EVENT_KEY$1 + DATA_API_KEY; var CLASS_NAME_DROPDOWN_MENU = 'dropdown-menu'; var CLASS_NAME_ACTIVE = 'active'; var CLASS_NAME_DISABLED = 'disabled'; var CLASS_NAME_FADE$1 = 'fade'; var CLASS_NAME_SHOW$1 = 'show'; var SELECTOR_DROPDOWN = '.dropdown'; var SELECTOR_NAV_LIST_GROUP = '.nav, .list-group'; var SELECTOR_ACTIVE = '.active'; var SELECTOR_ACTIVE_UL = ':scope > li > .active'; var SELECTOR_DATA_TOGGLE = '[data-bs-toggle="tab"], [data-bs-toggle="pill"], [data-bs-toggle="list"]'; var SELECTOR_DROPDOWN_TOGGLE = '.dropdown-toggle'; var SELECTOR_DROPDOWN_ACTIVE_CHILD = ':scope > .dropdown-menu .active'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var Tab = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(Tab, _BaseComponent); function Tab() { return _BaseComponent.apply(this, arguments) || this; } var _proto = Tab.prototype; // Public _proto.show = function show() { var _this = this; if (this._element.parentNode && this._element.parentNode.nodeType === Node.ELEMENT_NODE && this._element.classList.contains(CLASS_NAME_ACTIVE) || this._element.classList.contains(CLASS_NAME_DISABLED) || this._element.hasAttribute('disabled')) { return; } var previous; var target = getElementFromSelector(this._element); var listElement = this._element.closest(SELECTOR_NAV_LIST_GROUP); if (listElement) { var itemSelector = listElement.nodeName === 'UL' || listElement.nodeName === 'OL' ? SELECTOR_ACTIVE_UL : SELECTOR_ACTIVE; previous = SelectorEngine.find(itemSelector, listElement); previous = previous[previous.length - 1]; } var hideEvent = previous ? EventHandler.trigger(previous, EVENT_HIDE$1, { relatedTarget: this._element }) : null; var showEvent = EventHandler.trigger(this._element, EVENT_SHOW$1, { relatedTarget: previous }); if (showEvent.defaultPrevented || hideEvent !== null && hideEvent.defaultPrevented) { return; } this._activate(this._element, listElement); var complete = function complete() { EventHandler.trigger(previous, EVENT_HIDDEN$1, { relatedTarget: _this._element }); EventHandler.trigger(_this._element, EVENT_SHOWN$1, { relatedTarget: previous }); }; if (target) { this._activate(target, target.parentNode, complete); } else { complete(); } } // Private ; _proto._activate = function _activate(element, container, callback) { var _this2 = this; var activeElements = container && (container.nodeName === 'UL' || container.nodeName === 'OL') ? SelectorEngine.find(SELECTOR_ACTIVE_UL, container) : SelectorEngine.children(container, SELECTOR_ACTIVE); var active = activeElements[0]; var isTransitioning = callback && active && active.classList.contains(CLASS_NAME_FADE$1); var complete = function complete() { return _this2._transitionComplete(element, active, callback); }; if (active && isTransitioning) { var transitionDuration = getTransitionDurationFromElement(active); active.classList.remove(CLASS_NAME_SHOW$1); EventHandler.one(active, 'transitionend', complete); emulateTransitionEnd(active, transitionDuration); } else { complete(); } }; _proto._transitionComplete = function _transitionComplete(element, active, callback) { if (active) { active.classList.remove(CLASS_NAME_ACTIVE); var dropdownChild = SelectorEngine.findOne(SELECTOR_DROPDOWN_ACTIVE_CHILD, active.parentNode); if (dropdownChild) { dropdownChild.classList.remove(CLASS_NAME_ACTIVE); } if (active.getAttribute('role') === 'tab') { active.setAttribute('aria-selected', false); } } element.classList.add(CLASS_NAME_ACTIVE); if (element.getAttribute('role') === 'tab') { element.setAttribute('aria-selected', true); } reflow(element); if (element.classList.contains(CLASS_NAME_FADE$1)) { element.classList.add(CLASS_NAME_SHOW$1); } if (element.parentNode && element.parentNode.classList.contains(CLASS_NAME_DROPDOWN_MENU)) { var dropdownElement = element.closest(SELECTOR_DROPDOWN); if (dropdownElement) { SelectorEngine.find(SELECTOR_DROPDOWN_TOGGLE).forEach(function (dropdown) { return dropdown.classList.add(CLASS_NAME_ACTIVE); }); } element.setAttribute('aria-expanded', true); } if (callback) { callback(); } } // Static ; Tab.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.get(this, DATA_KEY$1) || new Tab(this); if (typeof config === 'string') { if (typeof data[config] === 'undefined') { throw new TypeError("No method named \"" + config + "\""); } data[config](); } }); }; _createClass(Tab, null, [{ key: "DATA_KEY", get: // Getters function get() { return DATA_KEY$1; } }]); return Tab; }(BaseComponent); /** * ------------------------------------------------------------------------ * Data Api implementation * ------------------------------------------------------------------------ */ EventHandler.on(document, EVENT_CLICK_DATA_API, SELECTOR_DATA_TOGGLE, function (event) { event.preventDefault(); var data = Data.get(this, DATA_KEY$1) || new Tab(this); data.show(); }); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .Tab to jQuery only if jQuery is present */ defineJQueryPlugin(NAME$1, Tab); /** * ------------------------------------------------------------------------ * Constants * ------------------------------------------------------------------------ */ var NAME = 'toast'; var DATA_KEY = 'bs.toast'; var EVENT_KEY = "." + DATA_KEY; var EVENT_CLICK_DISMISS = "click.dismiss" + EVENT_KEY; var EVENT_HIDE = "hide" + EVENT_KEY; var EVENT_HIDDEN = "hidden" + EVENT_KEY; var EVENT_SHOW = "show" + EVENT_KEY; var EVENT_SHOWN = "shown" + EVENT_KEY; var CLASS_NAME_FADE = 'fade'; var CLASS_NAME_HIDE = 'hide'; var CLASS_NAME_SHOW = 'show'; var CLASS_NAME_SHOWING = 'showing'; var DefaultType = { animation: 'boolean', autohide: 'boolean', delay: 'number' }; var Default = { animation: true, autohide: true, delay: 5000 }; var SELECTOR_DATA_DISMISS = '[data-bs-dismiss="toast"]'; /** * ------------------------------------------------------------------------ * Class Definition * ------------------------------------------------------------------------ */ var Toast = /*#__PURE__*/function (_BaseComponent) { _inheritsLoose(Toast, _BaseComponent); function Toast(element, config) { var _this; _this = _BaseComponent.call(this, element) || this; _this._config = _this._getConfig(config); _this._timeout = null; _this._setListeners(); return _this; } // Getters var _proto = Toast.prototype; // Public _proto.show = function show() { var _this2 = this; var showEvent = EventHandler.trigger(this._element, EVENT_SHOW); if (showEvent.defaultPrevented) { return; } this._clearTimeout(); if (this._config.animation) { this._element.classList.add(CLASS_NAME_FADE); } var complete = function complete() { _this2._element.classList.remove(CLASS_NAME_SHOWING); _this2._element.classList.add(CLASS_NAME_SHOW); EventHandler.trigger(_this2._element, EVENT_SHOWN); if (_this2._config.autohide) { _this2._timeout = setTimeout(function () { _this2.hide(); }, _this2._config.delay); } }; this._element.classList.remove(CLASS_NAME_HIDE); reflow(this._element); this._element.classList.add(CLASS_NAME_SHOWING); if (this._config.animation) { var transitionDuration = getTransitionDurationFromElement(this._element); EventHandler.one(this._element, 'transitionend', complete); emulateTransitionEnd(this._element, transitionDuration); } else { complete(); } }; _proto.hide = function hide() { var _this3 = this; if (!this._element.classList.contains(CLASS_NAME_SHOW)) { return; } var hideEvent = EventHandler.trigger(this._element, EVENT_HIDE); if (hideEvent.defaultPrevented) { return; } var complete = function complete() { _this3._element.classList.add(CLASS_NAME_HIDE); EventHandler.trigger(_this3._element, EVENT_HIDDEN); }; this._element.classList.remove(CLASS_NAME_SHOW); if (this._config.animation) { var transitionDuration = getTransitionDurationFromElement(this._element); EventHandler.one(this._element, 'transitionend', complete); emulateTransitionEnd(this._element, transitionDuration); } else { complete(); } }; _proto.dispose = function dispose() { this._clearTimeout(); if (this._element.classList.contains(CLASS_NAME_SHOW)) { this._element.classList.remove(CLASS_NAME_SHOW); } EventHandler.off(this._element, EVENT_CLICK_DISMISS); _BaseComponent.prototype.dispose.call(this); this._config = null; } // Private ; _proto._getConfig = function _getConfig(config) { config = _extends({}, Default, Manipulator.getDataAttributes(this._element), typeof config === 'object' && config ? config : {}); typeCheckConfig(NAME, config, this.constructor.DefaultType); return config; }; _proto._setListeners = function _setListeners() { var _this4 = this; EventHandler.on(this._element, EVENT_CLICK_DISMISS, SELECTOR_DATA_DISMISS, function () { return _this4.hide(); }); }; _proto._clearTimeout = function _clearTimeout() { clearTimeout(this._timeout); this._timeout = null; } // Static ; Toast.jQueryInterface = function jQueryInterface(config) { return this.each(function () { var data = Data.get(this, DATA_KEY); var _config = typeof config === 'object' && config; if (!data) { data = new Toast(this, _config); } if (typeof config === 'string') { if (typeof data[config] === 'undefined') { throw new TypeError("No method named \"" + config + "\""); } data[config](this); } }); }; _createClass(Toast, null, [{ key: "DefaultType", get: function get() { return DefaultType; } }, { key: "Default", get: function get() { return Default; } }, { key: "DATA_KEY", get: function get() { return DATA_KEY; } }]); return Toast; }(BaseComponent); /** * ------------------------------------------------------------------------ * jQuery * ------------------------------------------------------------------------ * add .Toast to jQuery only if jQuery is present */ defineJQueryPlugin(NAME, Toast); /** * -------------------------------------------------------------------------- * Bootstrap (v5.0.0-beta2): index.umd.js * Licensed under MIT (https://github.com/twbs/bootstrap/blob/main/LICENSE) * -------------------------------------------------------------------------- */ var index_umd = { Alert: Alert, Button: Button, Carousel: Carousel, Collapse: Collapse, Dropdown: Dropdown, Modal: Modal, OffCanvas: OffCanvas, Popover: Popover, ScrollSpy: ScrollSpy, Tab: Tab, Toast: Toast, Tooltip: Tooltip }; return index_umd; }))); //# sourceMappingURL=bootstrap.js.map