-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathgo-debug.js
executable file
·2294 lines (2294 loc) · 950 KB
/
go-debug.js
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
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
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/*
* GoJS v2.1.24 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.24/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.oB=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 x(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.eB;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="28e647fdb162";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.kx=[]}ib.prototype.toString=function(){return this.kx.join("")};ib.prototype.add=function(a){""!==a&&this.kx.push(a)};ib.className="StringBuilder";function jb(){}jb.className="PropertyCollection";
var F={rm:!1,by:!1,Gz:!1,hB:!1,lB:!1,py:!1,fB:null,trace:function(a){qa.console&&qa.console.log(a)},gB: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)},lz: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.Mm=Object.getOwnPropertyNames(d.prototype);for(var e={xk:0};e.xk<b.Mm.length;e={xk:e.xk},e.xk++){var f=Object.getOwnPropertyDescriptor(d.prototype,b.Mm[e.xk]);void 0!==f.get&&void 0===f.set&&Object.defineProperty(d.prototype,
b.Mm[e.xk],{set:function(a,b){return function(){throw Error("Property "+a.Mm[b.xk]+" of "+a.x+" is read-only.");}}(b,e)})}}}b={Mm:b.Mm,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.La=null;this.oa=a.v;this.Ua=-1}nb.prototype.reset=function(){var a=this.ub;a.La=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.La=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.La=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.La=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.La=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.La=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.La=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.La=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()#"+sb(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.Hw=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.tj=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.La;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.tj;H.prototype.sort=H.prototype.sort;H.prototype.toSet=H.prototype.Hw;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.zg=a;a.La=null;this.oa=a.v;this.ra=null}tb.prototype.reset=function(){var a=this.zg;a.La=null;this.oa=a.v;this.ra=null};tb.prototype.next=function(){var a=this.zg;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.zg;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.zg;b.La=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.zg;b.La=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.zg;b.La=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.zg;b.La=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.zg;b.La=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.zg.La=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.zg.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.La=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()#"+sb(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.Sl=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=sb(a),void 0===b)?!1:void 0!==this.Lb[b]};t.has=function(a){return this.contains(a)};t.rz=function(a){if(null===a)return!0;for(a=a.iterator;a.next();)if(!this.contains(a.value))return!1;return!0};t.sz=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=sb(a),void 0===b))return!1;a=this.Lb[b];if(void 0===a)return!1;var c=a.va,d=a.Sl;null!==c&&(c.Sl=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.Yq=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.QA=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.Yq(a);return this};t.clear=function(){this.s&&va(this);this.Lb={};this.Jb=0;null!==this.La&&this.La.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.Gw=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 sb(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.La;return null!==a?(a.reset(),a):new tb(this)}}});I.prototype.toList=I.prototype.Gw;I.prototype.toArray=I.prototype.ua;I.prototype.clear=I.prototype.clear;I.prototype.retainAll=I.prototype.QA;I.prototype.removeAll=I.prototype.Yq;
I.prototype["delete"]=I.prototype.delete;I.prototype.remove=I.prototype.remove;I.prototype.first=I.prototype.first;I.prototype.containsAny=I.prototype.sz;I.prototype.containsAll=I.prototype.rz;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=sb;
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.Hw=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.Gw=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.Gw;Ab.prototype.toArray=Ab.prototype.ua;Ab.prototype.toSet=Ab.prototype.Hw;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.Sl=this.va=null}vb.prototype.toString=function(){return"{"+this.key+":"+this.value+"}"};vb.className="KeyValuePair";function Cb(a){this.la=a;a.La=null;this.oa=a.v;this.ra=null}Cb.prototype.reset=function(){var a=this.la;a.La=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.La=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.La=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.La=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.La=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.La=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.La=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.La=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()#"+sb(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.Sl=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=sb(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=sb(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=sb(a),void 0===b))return!1;a=this.Lb[b];if(void 0===a)return!1;var c=a.va,d=a.Sl;null!==c&&(c.Sl=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.La&&this.La.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.La;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.Ng=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&&(x(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&&x(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.dj=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&&(x(a,J,J,"add:p"),this.ha());this.G+=a.x;this.H+=a.y;return this};t.ie=function(a){F&&(x(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&&x(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&&x(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.JA=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.KA=function(a,b){F&&(x(a,J,J,"projectOntoLineSegmentPoint:p"),x(b,J,J,"projectOntoLineSegmentPoint:q"));K.Th(a.x,a.y,b.x,b.y,this.G,this.H,this);return this};
t.WA=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.Eq(this.G,this.H,a,b,c,d,this);return this};t.XA=function(a,b){F&&(x(a,J,J,"snapToGridPoint:p"),x(b,Hb,J,"snapToGridPoint:q"));K.Eq(this.G,this.H,a.x,a.y,b.width,b.height,this);return this};t.sj=function(a,b){F&&(x(a,L,J,"setRectSpot:r"),x(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.Lk=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"),x(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&&x(a,Ib,J,"transform:t");a.xa(this);return this};function Jb(a,b){F&&x(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.Lk;J.prototype.setRectSpot=J.prototype.sj;J.prototype.snapToGridPoint=J.prototype.XA;J.prototype.snapToGrid=J.prototype.WA;
J.prototype.projectOntoLineSegmentPoint=J.prototype.KA;J.prototype.projectOntoLineSegment=J.prototype.JA;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.Kq(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.dj;J.prototype.equals=J.prototype.A;
J.prototype.set=J.prototype.set;J.prototype.setTo=J.prototype.Ng;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.Ng=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&&(x(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&&x(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.dj=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.dj;
Hb.prototype.equals=Hb.prototype.A;Hb.prototype.set=Hb.prototype.set;Hb.prototype.setTo=Hb.prototype.Ng;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.Ng=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&&(x(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&&(x(a,J,L,"setPoint:p"),this.ha());this.G=a.x;this.H=a.y;return this};t.UA=function(a){F&&(x(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&&x(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.dj=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&&x(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&&x(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.bd=function(a,b){F&&(C(a,L,"inflate:w"),C(b,L,"inflate:h"));return kc(this,b,a,b,a)};t.uq=function(a){F&&x(a,lc,L,"addMargin:m");return kc(this,a.top,a.right,a.bottom,a.left)};t.Fw=function(a){F&&x(a,lc,L,"subtractMargin:m");return kc(this,-a.top,-a.right,-a.bottom,-a.left)};t.mA=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.qA=function(a){F&&x(a,L,L,"intersectRect:r");return mc(this,a.x,a.y,a.width,a.height)};t.$v=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.Nc=function(a){F&&x(a,L,L,"intersectsRect:r");return this.aw(a.x,a.y,a.width,a.height)};
t.aw=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&&x(a,J,L,"unionPoint:p");return qc(this,a.x,a.y,0,0)};t.Oc=function(a){F&&x(a,L,L,"unionRect:r");return qc(this,a.G,a.H,a.ea,a.da)};
t.Mw=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.Lk=function(a,b,c){F&&(C(a,L,"setSpot:x"),C(b,L,"setSpot:y"),x(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.sA=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&&(x(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&&(x(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&&(x(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.sA;
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.qy(a,b,c,d,e,f,g,h)};L.prototype.setSpot=L.prototype.Lk;
L.prototype.union=L.prototype.Mw;L.prototype.unionRect=L.prototype.Oc;L.prototype.unionPoint=L.prototype.Ve;L.prototype.intersects=L.prototype.aw;L.prototype.intersectsRect=L.prototype.Nc;L.prototype.intersect=L.prototype.$v;L.prototype.intersectRect=L.prototype.qA;L.prototype.grow=L.prototype.mA;L.prototype.subtractMargin=L.prototype.Fw;L.prototype.addMargin=L.prototype.uq;L.prototype.inflate=L.prototype.bd;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.dj;L.prototype.equals=L.prototype.A;L.prototype.setSize=L.prototype.UA;L.prototype.setPoint=L.prototype.pd;L.prototype.set=L.prototype.set;L.prototype.setTo=L.prototype.Ng;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.Ng=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&&(x(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&&x(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.dj=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=zc.pop();return void 0===a?new lc:a};lc.free=function(a){zc.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.dj;lc.prototype.equals=lc.prototype.A;lc.prototype.set=lc.prototype.set;lc.prototype.setTo=lc.prototype.Ng;var Ec=null,Fc=null,zc=[];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.Ng=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&&(x(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&&x(a,M);return a.bb()?a.x.toString()+" "+a.y.toString()+" "+a.offsetX.toString()+" "+a.offsetY.toString():a.toString()}
t.toString=function(){return this.bb()?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.kw=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.bb=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.Mq=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.Mq;M.prototype.isSide=M.prototype.nd;M.prototype.isNoSpot=M.prototype.Sb;M.prototype.isSpot=M.prototype.bb;M.prototype.includesSide=M.prototype.If;M.prototype.opposite=M.prototype.kw;M.prototype.equals=M.prototype.A;M.prototype.set=M.prototype.set;M.prototype.setTo=M.prototype.Ng;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.Pt=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.gw=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.Nt=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.Lw=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.Lw;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.Nt;Ib.prototype.multiplyInverted=Ib.prototype.gw;Ib.prototype.multiply=Ib.prototype.multiply;Ib.prototype.reset=Ib.prototype.reset;Ib.prototype.isIdentity=Ib.prototype.Pt;
Ib.prototype.equals=Ib.prototype.A;Ib.prototype.set=Ib.prototype.set;var Ed=[];Ib.className="Transform";Ib.xF="54a702f3e53909c447824c6706603faf4c";
var K={cB:"7da71ca0ad381e90",Qg:(Math.sqrt(2)-1)/3*4,ax:null,sqrt:function(a){if(0>=a)return 0;var b=K.ax;if(null===b){b=[];for(var c=0;2E3>=c;c++)b[c]=Math.sqrt(c);K.ax=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},ut: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 w=(d+q)/2,y=(c+u)/2;return K.ut(a,
b,p,r,d,c,w,y,k,l,m,n)||K.ut(w,y,q,u,e,f,g,h,k,l,m,n)},nz: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},mz: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)},qm: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.qm(a,b,m,n,d,c,q,u,k,l);K.qm(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},nw: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.nw(a,b,m,n,p,r,g,h,k,l)||K.nw(p,r,c,d,e,f,g,h,k,l)},mB: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},mw: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.mw(a,b,k,l,m,n,g,h);K.mw(m,n,c,d,e,f,g,h)}return h},Vq: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.Vq(a,b,k,l,m,n,g,h);K.Vq(m,n,c,d,e,f,g,h)}return h},wq: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 w=(q+c)/2,y=(u+d)/2;c=(c+e)/2;d=(d+f)/2;var z=(w+c)/2,B=(y+d)/2,D=(m-k)*(m-k)+(n-l)*(n-l),G=!1;K.wq(a,b,q,u,w,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.wq(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},xq: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 w=(c+e)/2,y=(d+f)/2;e=(e+g)/2;f=(f+h)/2;d=(q+w)/2;c=(u+y)/2;w=(w+e)/2;y=(y+f)/2;var z=(d+w)/2,B=(c+y)/2;r+=K.xq(a,b,q,u,d,c,z,B,k,l,m,n,p);r+=K.xq(z,B,w,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)},kB: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)},jB: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},
ad: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},iB: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},Lt:function(a,b,c){return K.qy(a.x,a.y,a.width,a.height,b.x,b.y,c.x,c.y)},qy: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.Kq(a,b,k,b,e,f,g,h)||K.Kq(k,b,k,l,e,f,g,h)||K.Kq(k,l,a,l,e,f,g,h)||K.Kq(a,l,a,b,e,f,g,h)?!0:!1},Kq:function(a,b,c,d,e,f,g,h){return 0>=
K.xt(a,b,c,d,e,f)*K.xt(a,b,c,d,g,h)&&0>=K.xt(e,f,g,h,a,b)*K.xt(e,f,g,h,c,d)},xt: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},Sq:function(a){0>a&&(a+=360);360<=a&&(a-=360);return a},Yx: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.vz(c,l,e,a,b)),d-=Math.abs(e-l),l=e;return f},vz: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)]},Eq: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},ly: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},Az: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.Bz(k,0===g?a:b,l,c,0,0)},Bz: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,bn:new jb,Wh:new jb,Xh:0};K.za=K.cB;
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.sc=this.kc=this.Zc=this.Yc=0;this.Gj=new H;this.Wr=this.Gj.v;this.Er=(new L).freeze();this.wa=!0;this.jn=this.Vk=null;this.kn=NaN;this.vf=Hc;this.wf=Sc;this.yl=this.zl=NaN;this.Yf=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.sc=this.sc;for(var b=this.Gj.j,c=b.length,d=a.Gj,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.Wr=this.Wr;a.Er.assign(this.Er);a.wa=this.wa;a.Vk=this.Vk;a.jn=this.jn;a.kn=this.kn;a.vf=this.vf.J();a.wf=this.wf.J();a.zl=this.zl;a.yl=this.yl;a.Yf=this.Yf;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.Mw(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.Mw(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()));w===w.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,w="",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=w,w=d(),""!==w)switch(w.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((w===w.toLowerCase()?B.x:0)+parseFloat(d()),B.y),a.lineTo(B.x,B.y);break;case "V":for(;!c();)B=new J(B.x,(w===w.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()),P=X,ca=!1;c()||(P=parseFloat(d()),c()||(ca=0!==parseFloat(d())));w===w.toLowerCase()&&(G+=B.x,O+=B.y);a.arcTo(r,q,G,O,X,P,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()),P=f(),de(a,r,q,G,O,X,P.x,P.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.dr(!1)}m=a.Gt;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.dw=function(){if(this.wa||this.Wr!==this.figures.v)return!0;for(var a=this.figures.j,b=a.length,c=0;c<b;c++)if(a[c].dw())return!0;return!1};
Fd.prototype.computeBounds=function(){this.wa=!1;this.jn=this.Vk=null;this.kn=NaN;this.Wr=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.bt=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.Er;a.ka();isNaN(this.zl)||isNaN(this.yl)?a.h(0,0,0,0):a.h(0,0,this.zl,this.yl);he(this,a,!1);qc(a,0,0,0,0);a.freeze()};Fd.prototype.Xx=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.sc,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.qm(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.mw(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.qm(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.Xx();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.sc;this.kc=g*a+h*c+e;this.sc=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.sc;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 w=u.segments;k=u.startX;l=u.startY;for(var y=k,z=l,B=w.j,D=0;D<=w.length;D++){var G=void 0;if(D!==w.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.xq(k,l,G.point1X,
G.point1Y,G.point2X,G.point2Y,a,n,g,b,f,b,.5);h+=m;break;case ke:m=K.xq(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 P=0;P<X;P++){G=O[P];if(0===P){m=qe(f,b,g,b,k,l,G[0],G[1]);if(isNaN(m))return!0;h+=m}m=K.xq(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.Vv=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.my=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.Wv=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.ny=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 w=
p[u],y=p[u+1];if(0!==u){K.Th(l,m,w,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=w;m=y}J.free(d);a=g/f;return 0>a?0:1<a?1:a}return 0};
function se(a){if(null===a.Vk){var b=a.Vk=[],c=a.jn=[],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.Vq(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 w=r[u];K.Ne(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d);g=w[6];f=w[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++)w=r[u],K.Ne(g,f,w[2],w[3],w[4],w[5],w[6],w[7],.5,d),g=w[6],
f=w[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.Gj.add(a);return this};t.Zm=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.Vk}},flattenedLengths:{configurable:!0,get:function(){se(this);return this.jn}},flattenedTotalLength:{configurable:!0,get:function(){var a=this.kn;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.kn=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.sc},set:function(a){this.sc!==a&&(F&&C(a,Fd,"endY"),this.s&&va(this,a),this.sc=a,this.wa=!0)}},figures:{configurable:!0,get:function(){return this.Gj},
set:function(a){this.Gj!==a&&(F&&x(a,H,Fd,"figures"),this.s&&va(this,a),this.Gj=a,this.wa=!0)}},spot1:{configurable:!0,get:function(){return this.vf},set:function(a){F&&x(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&&x(a,M,Fd,"spot2");this.s&&va(this,a);this.wf=a.J()}},defaultStretch:{configurable:!0,get:function(){return this.Yf},set:function(a){F&&hb(a,N,Fd,"stretch");this.s&&
va(this,a);this.Yf=a}},bounds:{configurable:!0,get:function(){this.dw()&&this.computeBounds();return this.Er}}});Fd.prototype.setSpots=Fd.prototype.Zm;Fd.prototype.add=Fd.prototype.add;Fd.prototype.getFractionForPoint=Fd.prototype.ny;Fd.prototype.getPointAndAngleAlongPath=Fd.prototype.Wv;Fd.prototype.getAngleAlongPath=Fd.prototype.my;Fd.prototype.getPointAlongPath=Fd.prototype.Vv;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.Xx;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.gs=c;void 0===d&&(d=!0);this.ms=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.Zl=new H;this.bt=this.Zl.v;this.wa=!0}te.prototype.copy=function(){var a=new te;a.gs=this.gs;a.ms=this.ms;a.Yc=this.Yc;a.Zc=this.Zc;for(var b=this.Zl.j,c=b.length,d=a.Zl,e=0;e<c;e++){var f=b[e].copy();d.add(f)}a.bt=this.bt;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.dw=function(){if(this.wa)return!0;var a=this.segments;if(this.bt!==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.Zl.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.ut(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.nw(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.ut(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.gs},set:function(a){F&&A(a,"boolean",te,"isFilled");this.s&&va(this,a);this.gs=a}},isShadowed:{configurable:!0,get:function(){return this.ms},set:function(a){F&&A(a,"boolean",te,"isShadowed");this.s&&va(this,a);this.ms=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.Zl},set:function(a){F&&x(a,H,te,"segments");this.s&&va(this,a);this.Zl=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.sc=c):this.sc=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.Qi=0,F&&C(d,ue,"x1"),this.Ri=Math.max(d,0),F&&C(e,ue,"y1"),this.sh=Math.max(e,0),this.Hl="boolean"===typeof g?g:"number"===typeof g?!!g:!1,this.Zk=!!h):(F&&C(d,ue,"x1"),this.He=d,
F&&C(e,ue,"y1"),this.Qi=e,F&&C(f,ue,"x2"),a===le&&(f=Math.max(f,0)),this.Ri=f,"number"===typeof g?(a===le&&(g=Math.max(g,0)),this.sh=g):this.sh=0,this.Zk=this.Hl=!1);this.Lj=!1;this.wa=!0;this.Xe=null}ue.prototype.copy=function(){var a=new ue;a.ta=this.ta;a.kc=this.kc;a.sc=this.sc;a.He=this.He;a.Qi=this.Qi;a.Ri=this.Ri;a.sh=this.sh;a.Hl=this.Hl;a.Zk=this.Zk;a.Lj=this.Lj;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.Lj?"z":"")};t.freeze=function(){this.s=!0;return this};t.ka=function(){this.s=!1;return this};t.close=function(){this.Lj=!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.Qi,f=K.Yx(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.Ri;var f=a.sh;0===b&&(b=1E-4);0===f&&(f=1E-4);var g=Math.PI/180*a.He,h=a.Hl,k=a.Zk,l=a.kc,m=a.sc,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.Yx(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.Lj},set:function(a){this.Lj!==a&&(this.Lj=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.sc},
set:function(a){F&&C(a,ue,"endY");this.s&&va(this,a);this.sc=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.Qi},set:function(a){F&&C(a,ue,"point1Y");this.s&&va(this,a);this.Qi=a;this.wa=!0}},point2X:{configurable:!0,get:function(){return this.Ri},set:function(a){F&&C(a,ue,"point2X");this.s&&va(this,a);this.Ri=
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.Qi},set:function(a){F&&C(a,ue,"centerY");this.s&&va(this,a);this.Qi=a;this.wa=!0}},radiusX:{configurable:!0,
get:function(){return this.Ri},set:function(a){F&&C(a,ue,"radiusX");0>a&&ya(a,">= zero",ue,"radiusX");this.s&&va(this,a);this.Ri=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.sc},set:function(a){F&&C(a,ue,"sweepAngle");this.s&&va(this,a);360<a&&(a=360);-360>a&&(a=-360);this.sc=a;this.wa=!0}},isClockwiseArc:{configurable:!0,get:function(){return this.Zk},set:function(a){this.s&&va(this,a);this.Zk=a;this.wa=!0}},isLargeArc:{configurable:!0,get:function(){return this.Hl},set:function(a){this.s&&va(this,a);this.Hl=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.tv=(new J(0,0)).freeze();this.Du=(new J(0,0)).freeze();this.wr=this.zs=0;this.xr=1;this.qs="";this.pt=this.Qr=!1;this.Nr=this.zr=0;this.Vg=this.Zr=this.ks=!1;this.Vr=null;this.kt=0;this.jd=this.jt=null}we.prototype.copy=function(){var a=new we;return this.clone(a)};
we.prototype.clone=function(a){a.B=this.B;a.tv.assign(this.viewPoint);a.Du.assign(this.documentPoint);a.zs=this.zs;a.wr=this.wr;a.xr=this.xr;a.qs=this.qs;a.Qr=this.Qr;a.pt=this.pt;a.zr=this.zr;a.Nr=this.Nr;a.ks=this.ks;a.Zr=this.Zr;a.Vg=this.Vg;a.Vr=this.Vr;a.kt=this.kt;a.jt=this.jt;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.Gq=function(a,b){var c=this.diagram;if(null===c)return b;Ee(c,this.event,a,b);return b};
we.prototype.eA=function(a,b){var c=this.diagram;if(null===c)return b;Ee(c,this.event,a,b);b.assign(c.ju(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.tv},set:function(a){x(a,J,we,"viewPoint");this.tv.assign(a)}},documentPoint:{configurable:!0,get:function(){return this.Du},set:function(a){x(a,J,we,"documentPoint");this.Du.assign(a)}},modifiers:{configurable:!0,get:function(){return this.zs},set:function(a){this.zs=
a}},button:{configurable:!0,get:function(){return this.wr},set:function(a){this.wr=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.xr},set:function(a){this.xr=a}},key:{configurable:!0,get:function(){return this.qs},set:function(a){this.qs=a}},down:{configurable:!0,get:function(){return this.Qr},set:function(a){this.Qr=a}},up:{configurable:!0,
enumerable:!0,get:function(){return this.pt},set:function(a){this.pt=a}},clickCount:{configurable:!0,get:function(){return this.zr},set:function(a){this.zr=a}},delta:{configurable:!0,get:function(){return this.Nr},set:function(a){this.Nr=a}},isMultiTouch:{configurable:!0,get:function(){return this.ks},set:function(a){this.ks=a}},handled:{configurable:!0,get:function(){return this.Zr},set:function(a){this.Zr=a}},bubbles:{configurable:!0,
get:function(){return this.Vg},set:function(a){this.Vg=a}},event:{configurable:!0,get:function(){return this.Vr},set:function(a){this.Vr=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.kt},set:function(a){this.kt=a}},targetDiagram:{configurable:!0,
get:function(){return this.jt},set:function(a){this.jt=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.eA;we.prototype.getMultiTouchViewPoint=we.prototype.Gq;we.className="InputEvent";function Fe(){this.B=null;this.Wa="";this.Js=this.it=null}Fe.prototype.copy=function(){var a=new Fe;a.B=this.B;a.Wa=this.Wa;a.it=this.it;a.Js=this.Js;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.it},set:function(a){this.it=a}},parameter:{configurable:!0,get:function(){return this.Js},set:function(a){this.Js=a}}});Fe.className="DiagramEvent";
function Ge(){this.un=He;this.nf=this.ys="";this.fp=this.gp=this.mp=this.np=this.lp=this.B=this.gc=null}Ge.prototype.clear=function(){this.fp=this.gp=this.mp=this.np=this.lp=this.B=this.gc=null};
Ge.prototype.copy=function(){var a=new Ge;a.un=this.un;a.ys=this.ys;a.nf=this.nf;a.gc=this.gc;a.B=this.B;a.lp=this.lp;var b=this.np;a.np=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.mp;a.mp=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.gp;a.gp=Fa(b)&&"function"===typeof b.J?b.J():b;b=this.fp;a.fp=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.gA=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.un},set:function(a){F&&hb(a,Ge,Ge,"change");this.un=a}},modelChange:{configurable:!0,get:function(){return this.ys},set:function(a){F&&A(a,"string",Ge,"modelChange");this.ys=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.un===Ie&&("CommittedTransaction"===this.nf||"FinishedUndo"===this.nf||"FinishedRedo"===this.nf)}},object:{configurable:!0,get:function(){return this.lp},set:function(a){this.lp=a}},oldValue:{configurable:!0,get:function(){return this.np},set:function(a){this.np=
a}},oldParam:{configurable:!0,get:function(){return this.mp},set:function(a){this.mp=a}},newValue:{configurable:!0,get:function(){return this.gp},set:function(a){this.gp=a}},newParam:{configurable:!0,get:function(){return this.fp},set:function(a){this.fp=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.gA;
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.bv=new I;this.gd=!1;this.L=(new H).freeze();this.Pd=-1;this.w=999;this.we=!1;this.Kr=null;this.Yi=0;this.l=!1;F&&(this.l=!0);this.De=(new H).freeze();this.Pl=new H;this.Ku=!0;this.Ru=this.hs=this.Vu=this.Uu=!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.Kr=null;this.Yi=0;this.De.ka();this.De.clear();this.De.freeze();this.Pl.clear();this.Ru=this.hs=this.Vu=this.Uu=!1};Me.prototype.copyProperties=function(a){this.isEnabled=a.isEnabled;this.maxHistoryLength=a.maxHistoryLength;this.checksTransactionLevel=a.checksTransactionLevel};t=Me.prototype;t.Qx=function(a){this.bv.add(a)};t.Cy=function(a){this.bv.remove(a)};
t.Ba=function(a){void 0===a&&(a="");null===a&&(a="");if(this.isUndoingRedoing)return!1;!0===this.Ku&&(this.Ku=!1,this.Yi++,this.isInternalTransaction||this.Db("StartingFirstTransaction",a,this.currentTransaction),0<this.Yi&&this.Yi--);this.isEnabled&&(this.De.ka(),this.De.add(a),this.De.freeze(),null===this.currentTransaction?this.Pl.add(0):this.Pl.add(this.currentTransaction.changes.count));this.Yi++;var b=1===this.transactionLevel;b&&(this.isInternalTransaction||this.Db("StartedTransaction",a,this.currentTransaction));
return b};t.ab=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.isInternalTransaction||a.Db("CommittingTransaction",c,e));var f=0;if(0<a.transactionLevel&&(a.Yi--,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.Pl.count;0<g&&(f=a.Pl.O(g-1),a.Pl.hb(g-1))}if(d){if(b){a.hs=!1;null===e&&""!==
c&&(e=a.currentTransaction);if(a.isEnabled&&null!==e){e.isComplete||(e.isComplete=!0,e.name=c);b=a.history;b.ka();for(d=b.count-1;d>a.historyIndex;d--)f=b.O(d),null!==f&&f.clear(),b.hb(d),a.hs=!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||0!==b.count&&b.get(b.count-1)===e||(b.add(e),a.Pd++);b.freeze()}a.isInternalTransaction||a.Db("CommittedTransaction",c,e)}else{a.we=!0;try{a.isEnabled&&null!==e&&(e.isComplete=!0,e.undo())}finally{a.isInternalTransaction||
a.Db("RolledBackTransaction",c,e),a.we=!1}null!==e&&e.clear()}a.Kr=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.vt(d)};
Me.prototype.Zv=function(a){if(this.isEnabled&&!this.isUndoingRedoing&&!this.skipsEvent(a)){var b=this.currentTransaction;null===b&&(this.Kr=b=new Le);var c=a.copy();b=b.changes;b.ka();b.add(c);b.freeze();this.checksTransactionLevel&&0>=this.transactionLevel&&!this.Ku&&(a=a.diagram,null!==a&&!1===a.zk||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.bv.iterator}},isEnabled:{configurable:!0,get:function(){return this.gd},set:function(a){this.gd=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.Kr}},transactionLevel:{configurable:!0,
get:function(){return this.Yi}},isInTransaction:{configurable:!0,get:function(){return 0<this.Yi}},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.Uu},set:function(a){this.Uu=a}},isPendingUnmodified:{configurable:!0,get:function(){return this.Vu},set:function(a){this.Vu=
a}},isInternalTransaction:{configurable:!0,get:function(){return this.Ru},set:function(a){this.Ru=a}},isJustDiscarded:{configurable:!0,get:function(){return this.hs}}});Me.prototype.handleChanged=Me.prototype.Zv;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.ab;Me.prototype.startTransaction=Me.prototype.Ba;
Me.prototype.removeModel=Me.prototype.Cy;Me.prototype.addModel=Me.prototype.Qx;Me.prototype.clear=Me.prototype.clear;Me.className="UndoManager";function Oe(){0<arguments.length&&za(Oe);fb(this);this.B=Pe;this.Wa="";this.gd=!0;this.qd=!1;this.$w=null;this.az=new we;this.st=-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.Gq(0,J.allocAt(NaN,NaN)),d=b.Gq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.Cm("hasGestureZoom"))){a.Rl=a.scale;var e=d.x-c.x,f=d.y-c.y;a.nv=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.Gq(0,J.allocAt(NaN,NaN)),d=b.Gq(1,J.allocAt(NaN,NaN));if(c.o()&&d.o()&&(this.doCancel(),a.Cm("hasGestureZoom"))){var e=d.x-c.x,f=d.y-c.y;f=Math.sqrt(e*e+f*f)/a.nv;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.Rl;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.Pg=function(){var a=this.diagram;return null===this.transactionResult?a.Mf():a.ab(this.transactionResult)};
Oe.prototype.standardMouseSelect=function(){var a=this.diagram;if(a.allowSelect){var b=a.lastInput,c=a.zm(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.Mg()){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.Bj){var f=a.Bj,g=f;a.Bj=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.Lg(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.Lg(d))break;g(b,d,f);e=!0;if(b.handled)break}d=d.panel}d=a.Bj}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.az);this.st=ta(function(){c.doWaitAfter(d)},a)};
Oe.prototype.cancelWaitAfter=function(){-1!==this.st&&qa.clearTimeout(this.st);this.st=-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 Q&&(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.gd},set:function(a){A(a,"boolean",Oe,"isEnabled");this.gd=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.$w},set:function(a){null!==a&&A(a,"string",Oe,"transactionResult");this.$w=a}}});Oe.prototype.stopTransaction=Oe.prototype.Pg;Oe.prototype.startTransaction=Oe.prototype.Ba;Oe.className="Tool";function Ua(){Oe.call(this);this.name="ToolManager";this.Pc=new H;this.Qc=new H;this.Pf=new H;this.$=this.Na=850;this.w=(new Hb(2,2)).ia();this.ib=5E3;this.Oa=Se;this.L=Ue;this.Jr=this.l=null;this.ek=-1}
la(Ua,Oe);Ua.prototype.initializeStandardTools=function(){};Ua.prototype.updateAdornments=function(a){var b=this.currentToolTip;if(b instanceof Te&&this.Jr===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.Lg(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.dk=!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.Lg(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&&x(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.ek&&(qa.clearTimeout(this.ek),this.ek=-1);a=this.toolTipDuration;if(0<a&&Infinity!==a){var e=this;this.ek=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.ek&&(qa.clearTimeout(this.ek),this.ek=-1);var a=this.diagram,b=this.currentToolTip;null!==b&&(b instanceof Te?(a.remove(b),null!==this.Jr&&this.Jr.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&&(x(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.cb=function(a,b,c){A(a,"string",Ua,"replaceStandardTool:name");x(c,H,Ua,"replaceStandardTool:list");null!==b&&(x(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.Oa},set:function(a){hb(a,Ua,Ua,"mouseWheelBehavior");this.Oa=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.Jr=null!==a&&a instanceof Te?a.adornedPart:null}},mouseDownTools:{configurable:!0,get:function(){return this.Pc}},mouseMoveTools:{configurable:!0,get:function(){return this.Qc}},mouseUpTools:{configurable:!0,get:function(){return this.Pf}},hoverDelay:{configurable:!0,get:function(){return this.Na},set:function(a){A(a,"number",Ua,"hoverDelay");this.Na=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){x(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.cb;
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.Qc=!0;this.w=this.ib=this.Na=this.wg=null;this.Rn=this.Pf=!1;this.em=new J(NaN,NaN);this.gt=new J;this.Pc=!0;this.jl=100;this.bh=[];this.kr=(new I).freeze();this.Oa=new ef;this.Bo=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.jl)?!1:null!==this.findDraggablePart()};
df.prototype.findDraggablePart=function(){var a=this.diagram;a=a.zm(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.zm(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.Bo=null;null===this.currentPart&&this.standardMouseSelect();var b=this.currentPart;null!==b&&(b.canMove()||b.canCopy())&&(ff=null,this.isActive=!0,this.em.set(a.position),gf(this,a.selection),this.bh.length=0,this.draggedParts=this.computeEffectiveCollection(a.selection,this.dragOptions),a.iu=!0,!0===a.Qe("temporaryPixelRatio")&&30<a.Tx&&hf(a),jf(a,this.draggedParts),this.Ba("Drag"),this.startPoint=a.firstInput.documentPoint,a.isMouseCaptured=
!0,a.allowDragOut&&(this.isDragOutStarted=!0,this.Rn=!1,ff=this,kf=this.diagram,this.doSimulatedDragOut()))};function gf(a,b){if(a.dragsLink){var c=a.diagram;c.allowRelink&&(c.model.yk()&&1===b.count&&b.first()instanceof R?(a.draggedLink=b.first(),a.draggedLink.canRelinkFrom()&&a.draggedLink.canRelinkTo()&&a.draggedLink.lk(),a.wg=c.toolManager.findTool("Relinking"),null===a.wg&&(a.wg=new lf,a.wg.diagram=c)):(a.draggedLink=null,a.wg=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.Bo=null;this.Rn=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.em.h(NaN,NaN);ff=kf=null;vf(this);a.isMouseCaptured=!1;a.currentCursor="";a.iu=!1;this.Pg();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.em.o()&&(b.position=a.em);b.Nf()}df.prototype.doCancel=function(){vf(this);zf(this);var a=this.diagram;this.em.o()&&(a.position=this.em);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.rk(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.cu(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.wg){var b=a.wg;b.diagram.remove(b.temporaryFromNode);b.diagram.remove(b.temporaryToNode)}a.draggedLink=null;a.wg=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.Tx&&(hf(d),d.au())}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.cd()}}
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.cd()}a.Bo=d;c.isReadOnly||!c.allowMove&&!c.allowCopy||!c.allowHorizontalScroll&&!c.allowVerticalScroll||c.At(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.Bo!==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.wg;if(null===d)return null;var e=a.diagram.Ig(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.wg;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.xy&&d.U("LinkRelinked",c,d.xy),c.toPort!==d.yy&&d.U("LinkRelinked",c,d.yy)):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.Rv(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.Za()}
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.Rn=!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 Q||(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.fr(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.fr(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.Rn||null===this.draggedParts||this.draggedParts.contains(a)?null:c.assign(b)};df.prototype.bA=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.dd();Vf(a);a.animationManager.dd();var b=ff;null!==b&&(b.diagram.iu=!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.sn=!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.sn=!1};
df.prototype.doSimulatedDrop=function(){var a=this.diagram,b=ff;if(null!==b){var c=b.diagram;b.Rn=!0;vf(this);if(!this.mayDragIn())return;a.animationManager.sn=!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.Pg();a.U("ChangedSelection",a.selection)}a.animationManager.sn=!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.rk(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.gt;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.iu=!1;this.mayCopy()||this.mayMove()?a.currentCursor="":a.currentCursor=this.nodropCursor;this.Bo=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.Qc},set:function(a){A(a,"boolean",df,"isCopyEnabled");this.Qc=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.Oa},set:function(a){x(a,ef,df,"dragOptions");this.Oa=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.Pc},set:function(a){A(a,"boolean",df,"isComplexRoutingRealtime");this.Pc=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){x(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){x(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){x(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.Na},set:function(a){null!==a&&x(a,S,df,"currentPart");this.Na=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.kr}},draggedLink:{configurable:!0,get:function(){return this.diagram.draggedLink},set:function(a){null!==a&&x(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.gt},set:function(a){x(a,J,df,"startPoint");this.gt.A(a)||this.gt.assign(a)}},delay:{configurable:!0,get:function(){return this.jl},set:function(a){A(a,"number",df,"delay");this.jl=a}}});df.prototype.getDraggingSource=df.prototype.bA;var tf=null,ff=null,kf=null;df.className="DraggingTool";tf=new H;
Sa("draggingTool",function(){return this.findTool("Dragging")},function(a){this.cb("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.Oa=!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.Yw=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.Xw=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.Zw=a;this.w=b;this.Yh=this.Pf=this.Pc=this.ib=this.Qc=null;this.Na=!0;this.Sy=new Db;this.kr=this.Ii=this.Ww=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.jj();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.At(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.Ig(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.Dq(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.Oa},set:function(a){A(a,"boolean",Xf,"isUnconnectedLinkValid");this.Oa=a}},linkingCursor:{configurable:!0,get:function(){return this.ri},set:function(a){this.ri=a}},temporaryLink:{configurable:!0,get:function(){return this.Yw},
set:function(a){x(a,R,Xf,"temporaryLink");this.Yw=a}},temporaryFromNode:{configurable:!0,get:function(){return this.Xw},set:function(a){x(a,T,Xf,"temporaryFromNode");if(this.Xw=a)this.l=a.port}},temporaryFromPort:{configurable:!0,get:function(){return this.l},set:function(a){x(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.Zw},
set:function(a){x(a,T,Xf,"temporaryToNode");if(this.Zw=a)this.w=a.port}},temporaryToPort:{configurable:!0,get:function(){return this.w},set:function(a){x(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.Qc},set:function(a){null!==a&&x(a,R,Xf,"originalLink");this.Qc=a}},originalFromNode:{configurable:!0,get:function(){return this.ib},
set:function(a){null!==a&&x(a,T,Xf,"originalFromNode");this.ib=a}},originalFromPort:{configurable:!0,get:function(){return this.Pc},set:function(a){null!==a&&x(a,N,Xf,"originalFromPort");this.Pc=a}},originalToNode:{configurable:!0,get:function(){return this.Pf},set:function(a){null!==a&&x(a,T,Xf,"originalToNode");this.Pf=a}},originalToPort:{configurable:!0,get:function(){return this.Yh},set:function(a){null!==a&&x(a,N,Xf,"originalToPort");this.Yh=a}},isForwards:{configurable:!0,
enumerable:!0,get:function(){return this.Na},set:function(a){A(a,"boolean",Xf,"isForwards");this.Na=a}},validPortsCache:{configurable:!0,get:function(){return this.Sy}},targetPort:{configurable:!0,get:function(){return this.Ww},set:function(a){null!==a&&x(a,N,Xf,"targetPort");this.Ww=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.kr},set:function(a){null!==a&&A(a,"function",Xf,"portTargeted");this.kr=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.cn=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.Qt()||!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.Za(),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.Pg()};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.yq(),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&&x(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&&x(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.cn},set:function(a){null!==a&&x(a,N,ig,"startObject");this.cn=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.cn=a;this.L=null;this.Bx=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.uk(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.uk(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.Qt()||!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.Bx.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.Za(),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.Pg()};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.Za()),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.Lq(this.Bx)}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&&x(a,N,lf,"fromHandleArchetype");this.$=a}},toHandleArchetype:{configurable:!0,get:function(){return this.cn},set:function(a){null!==a&&x(a,N,lf,"toHandleArchetype");this.cn=a}},handle:{configurable:!0,get:function(){return this.L},set:function(a){if(null!==a&&(x(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.cb("Linking",a,this.mouseMoveTools)});Sa("relinkingTool",function(){return this.findTool("Relinking")},function(a){this.cb("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.ru=this.l=null;this.Cx=new J;this.Is=new H}la(pg,Oe);pg.prototype.Xv=function(a){return a&&a.Ps&&0!==a.Ps.value?a.Ps:qg};
pg.prototype.Ym=function(a,b){x(a,N,pg,"setReshapingBehavior:obj");hb(b,pg,pg,"setReshapingBehavior:behavior");a.Ps=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.uk(this.name),null===b||b.yx!==a.pointsCount||b.Nx!==a.resegmentable)&&(b=this.makeAdornment(c),null!==b&&(b.yx=a.pointsCount,b.Nx=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.Ym(h,sg),h.cursor="n-resize"):K.C(k.y,l.y)&&(this.Ym(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.Ym(h,sg),h.cursor="n-resize"):K.C(k.y,l.y)&&(this.Ym(h,tg),h.cursor="w-resize")):g!==f&&(this.Ym(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.ru=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.Cx=b.i(this.handle.segmentIndex);this.Is=b.points.copy();this.isActive=!0}}};pg.prototype.doDeactivate=function(){this.Pg();this.ru=this.handle=null;this.isActive=this.diagram.isMouseCaptured=!1};pg.prototype.doCancel=function(){var a=this.adornedLink;null!==a&&(a.points=this.Is);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.Is)}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.Xv(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.Xv(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&&x(a,N,pg,"handleArchetype");this.w=a}},midHandleArchetype:{configurable:!0,get:function(){return this.L},set:function(a){null!==a&&x(a,N,pg,"midHandleArchetype");this.L=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(x(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.ru}},resegmentingDistance:{configurable:!0,get:function(){return this.$},set:function(a){A(a,"number",pg,"resegmentingDistance");this.$=a}},originalPoint:{configurable:!0,get:function(){return this.Cx}},originalPoints:{configurable:!0,get:function(){return this.Is}}});pg.prototype.setReshapingBehavior=pg.prototype.Ym;pg.prototype.getReshapingBehavior=pg.prototype.Xv;
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.cb("LinkReshaping",a,this.mouseDownTools)});
function Ig(){0<arguments.length&&za(Ig);Oe.call(this);this.name="Resizing";this.mg=(new Hb(1,1)).freeze();this.lg=(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.Hs=new J;this.Ax=new Hb;this.op=new J;this.Iu=new Hb(0,0);this.Hu=new Hb(Infinity,Infinity);this.Gu=new Hb(1,1);this.xx=!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.uk(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.jj();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.Hs.set(this.adornedObject.ma(this.handle.alignment.kw())),this.op.set(this.adornedObject.part.location),this.Ax.set(this.adornedObject.desiredSize),this.Gu=this.computeCellSize(),this.Iu=this.computeMinSize(),this.Hu=this.computeMaxSize(),a.isMouseCaptured=
!0,this.xx=a.animationManager.isEnabled,a.animationManager.isEnabled=!1,this.Ba(this.name),this.isActive=!0))};Ig.prototype.doDeactivate=function(){var a=this.diagram;this.Pg();this.le=this.handle=null;this.isActive=a.isMouseCaptured=!1;a.animationManager.isEnabled=this.xx};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.Iu,c=this.Hu,d=this.Gu,e=this.adornedObject.It(a.lastInput.documentPoint,J.alloc()),f=this.computeReshape();b=this.computeResize(e,this.handle.alignment,b,c,d,f);this.resize(b);a.cd();J.free(e)}};
Ig.prototype.doMouseUp=function(){var a=this.diagram;if(this.isActive){var b=this.Iu,c=this.Hu,d=this.Gu,e=this.adornedObject.It(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.kw());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.cd()}};
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.Eq(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&&x(a,N,Ig,"handleArchetype");this.w=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(x(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&&(x(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.mg},set:function(a){x(a,Hb,Ig,"minSize");if(!this.mg.A(a)){var b=a.width;isNaN(b)&&(b=0);a=a.height;isNaN(a)&&(a=0);this.mg.h(b,a)}}},maxSize:{configurable:!0,get:function(){return this.lg},set:function(a){x(a,Hb,Ig,"maxSize");if(!this.lg.A(a)){var b=a.width;isNaN(b)&&(b=Infinity);a=a.height;isNaN(a)&&(a=Infinity);
this.lg.h(b,a)}}},cellSize:{configurable:!0,get:function(){return this.Wg},set:function(a){x(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.Hs},set:function(a){x(a,J,Ig,"oppositePoint");this.Hs.A(a)||this.Hs.assign(a)}},originalDesiredSize:{configurable:!0,
get:function(){return this.Ax}},originalLocation:{configurable:!0,get:function(){return this.op}}});Ig.className="ResizingTool";Sa("resizingTool",function(){return this.findTool("Resizing")},function(a){this.cb("Resizing",a,this.mouseDownTools)});
function Pg(){0<arguments.length&&za(Pg);Oe.call(this);this.name="Rotating";this.Oa=45;this.Na=2;this.op=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.zx=0;this.hv=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.uk(this.name);if(null===c||c.adornedObject!==b)c=this.makeAdornment(b);if(null!==c){c.angle=b.jj();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.zx=this.adornedObject.angle,this.hv=this.computeRotationPoint(this.adornedObject),this.op=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.bb()?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.It(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.Pg();this.le=this.handle=null;this.hv=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.Lg(d))c=this.op.copy(),b.location=c.ie(this.rotationPoint).rotate(a-this.originalAngle).add(this.rotationPoint);this.diagram.cd()}};
Pg.prototype.computeRotate=function(a){a=this.rotationPoint.Xa(a)-this.handleAngle;var b=this.adornedObject.panel;null!==b&&(a-=b.jj());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&&x(a,N,Pg,"handleArchetype");this.w=a}},handle:{configurable:!0,get:function(){return this.l},set:function(a){if(null!==a&&(x(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&&(x(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.Oa},set:function(a){A(a,"number",Pg,"snapAngleMultiple");this.Oa=a}},snapAngleEpsilon:{configurable:!0,get:function(){return this.Na},set:function(a){A(a,"number",Pg,"snapAngleEpsilon");this.Na=a}},originalAngle:{configurable:!0,get:function(){return this.zx}},rotationPoint:{configurable:!0,
enumerable:!0,get:function(){return this.hv}},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.cb("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.Qk=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.Qk=c;a.Bj=a.$b(b.documentPoint,null,null);return!0}return!1};Rg.prototype.doMouseDown=function(){if(this.isActive){var a=this.diagram.lastInput,b=this.Qk;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.Qk;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.Qk;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.Qk;null!==b&&(a.targetObject=b,null!==b.actionCancel&&b.actionCancel(a,b),this.stopTool())};Rg.prototype.doStop=function(){this.Qk=null};Rg.className="ActionTool";function Sg(){Oe.call(this);0<arguments.length&&za(Sg);this.name="ClickCreating";this.xj=null;this.w=!0;this.l=!1;this.qx=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.qx=a.lastInput.viewPoint.copy()),2!==a.lastInput.clickCount||this.isBeyondDragSize(this.qx))return!1}else if(1!==a.lastInput.clickCount)return!1;return a.currentTool!==this&&null!==a.zm(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.Dc(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.Pg(),b.U("ChangedSelection",b.selection)}return d};
ma.Object.defineProperties(Sg.prototype,{archetypeNodeData:{configurable:!0,get:function(){return this.xj},set:function(a){null!==a&&A(a,"object",Sg,"archetypeNodeData");this.xj=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.jl=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.zm(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.At(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.ky(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.jl},set:function(a){A(a,"number",Ug,"delay");this.jl=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&&x(a,S,Ug,"box");this.l=a}}});
Ug.className="DragSelectingTool";function Vg(){Oe.call(this);0<arguments.length&&za(Vg);this.name="Panning";this.ev=new J;this.$y=new J;this.Vg=!1;var a=this;this.Gx=function(){var b=a.diagram;null!==b&&b.removeEventListener(qa.document,"scroll",a.Gx,!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.Gx,!1)):(a.currentCursor="move",a.isMouseCaptured=!0,this.ev.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.ev;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.$y.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.ev}}});Vg.className="PanningTool";Sa("clickCreatingTool",function(){return this.findTool("ClickCreating")},function(a){this.cb("ClickCreating",a,this.mouseUpTools)});
Sa("clickSelectingTool",function(){return this.findTool("ClickSelecting")},function(a){this.cb("ClickSelecting",a,this.mouseUpTools)});Sa("panningTool",function(){return this.findTool("Panning")},function(a){this.cb("Panning",a,this.mouseMoveTools)});Sa("dragSelectingTool",function(){return this.findTool("DragSelecting")},function(a){this.cb("DragSelecting",a,this.mouseMoveTools)});Sa("actionTool",function(){return this.findTool("Action")},function(a){this.cb("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&&x(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.Wx=b;this.visible=c}Wg.className="ContextMenuButtonInfo";function Xg(){Oe.call(this);0<arguments.length&&za(Xg);this.name="ContextMenu";this.w=this.xu=this.l=null;this.wx=new J;this.yu=null;this.Tu=!1;var a=this;this.rv=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.rv=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.wx.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 Q||(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.Lg(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.Tu&&(a.Tu=!0,b&&a.standardMouseSelect(),b=a.standardMouseClick(),a.Tu=!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&&x(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.xu&&this.xu.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.yu&&(this.yu=fh(this));ah.innerHTML="";bh.addEventListener("click",this.rv,!1);var b=this,c=ua("ul");c.className="goCXul";ah.appendChild(c);c.innerHTML="";for(var d=this.yu.iterator;d.next();){var e=d.value,f=e.visible;if("function"===typeof e.Wx&&("function"!==typeof f||f(a))){f=ua("li");f.className="goCXli";var g=ua("a");g.className="goCXa";g.href="#";g.Uy=e.Wx;g.addEventListener("click",function(c){this.Uy(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.rv,!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.xu=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&&x(a,N,Xg,"currentObject");this.w=a}},mouseDownPoint:{configurable:!0,get:function(){return this.wx}}});var Zg=null,ch=!1,bh=null,ah=null;Xg.className="ContextMenuTool";Sa("contextMenuTool",function(){return this.findTool("ContextMenu")},function(a){this.cb("ContextMenu",a,this.mouseUpTools)});
function hh(){0<arguments.length&&za(hh);Oe.call(this);this.name="TextEditing";this.Dh=new ih;this.Oa=null;this.Na=jh;this.Wi=null;this.oa=kh;this.L=1;this.$=!0;this.w=null;this.l=new bf;this.Cu=null;lh(this,this.l)}la(hh,Oe);
function lh(a,b){if(gh){var c=ua("textarea");a.Cu=c;c.addEventListener("input",function(){if(null!==a.textBlock){var b=a.wy(this.value);this.style.width=20+b.measuredBounds.width*this.YA+"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.Cu;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.Cu;"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.YA=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.yw(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.Pg(),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){x(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.wy=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.Oa},set:function(a){null!==a&&x(a,ih,hh,"textBlock");this.Oa=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.Na},set:function(a){hb(a,hh,hh,"starting");this.Na=a}},textValidation:{configurable:!0,get:function(){return this.Wi},set:function(a){null!==a&&A(a,"function",hh,"textValidation");this.Wi=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.wy;
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.cb("TextEditing",a,this.mouseUpTools)});
function zh(){Ah||(Bh(),Ah=!0);this.B=Pe;this.vl=this.lf=this.wc=this.ns=this.nc=!1;this.Lx=!0;this.wl=Ch;this.sn=!1;this.Ai=this.gd=!0;this.dh=600;this.ix=this.Kx=!1;this.We=new I;this.Jd=new Dh;this.Jd.Rc=this;this.Rk=new I;this.ov=new I;this.lt=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.gd||!a.canStart(b))return!1;a.We.add(b);a.defaultAnimation.isAnimating&&a.dd();return a.wc=!0}
function Gh(a){if(a.gd&&a.wc){var b=a.Jd,c=a.B,d=a.We.contains("Model");d&&(a.vl=!0,a.wl===Ch?(b.isViewportUnconstrained=!0,b.pc.clear(),b.add(c,"position",c.position.copy().offset(0,-200),c.position),b.add(c,"opacity",0,1)):a.wl===Hh&&b.pc.clear(),a.Lx=a.wl===Uh&&c.Ts.A(c.sa)?!0:!1,c.U("InitialAnimationStarting",a));d&&!a.Ai||0===b.pc.count?(a.We.clear(),a.wc=!1,a.lf=!1,b.pc.clear(),Vh(b),a.vl=!1,c.P()):(a.We.clear(),c.Le=!1,d=b.pc.get(c),c.autoScale!==Wh&&null!==d&&(delete d.start.scale,delete d.end.scale),
qa.requestAnimationFrame(function(){!1===a.wc||b.nc||(c.Qe("temporaryPixelRatio")&&hf(c),Xh(c),a.wc=!1,a.lf=!1,b.start(),Yh(a),c.Ta(),Zh(b,0),Vf(c,!0),$h(a),c.U("AnimationStarting",a))}))}}function ai(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.Xt=function(a){return this.Jd.Xt(a)};t.cw=function(a){return this.Jd.cw(a)};
function bi(a,b){function c(){0<e.lt.count&&(d.addAll(e.lt),e.lt.clear(),e.nc=!0);if(!1!==e.nc&&0!==d.count){e.ov.addAll(d);for(var a=e.ov.iterator;a.next();){var b=a.value;if(!1!==b.nc){a:if(0<b.lm.count)var h=!0;else{for(h=b.pc.iterator;h.next();){var k=h.key;if(k instanceof N&&null!==k.diagram||k instanceof Q){h=!0;break a}}h=!1}h?ci(b,!1):b.El=!0}}e.ov.clear();Yh(e);Vf(e.B);$h(e);qa.requestAnimationFrame(c)}}var d=a.Rk,e=a;a.nc?a.lt.add(b):(a.nc=!0,d.add(b),qa.requestAnimationFrame(function(){c()}))}
function di(a){for(a=a.Rk.iterator;a.next();)a.value.El=!1}function Yh(a){if(!a.ns){var b=a.B;a.Kx=b.skipsUndoManager;a.ix=b.skipsModelSourceBindings;b.skipsUndoManager=!0;b.skipsModelSourceBindings=!0;a.ns=!0}}function $h(a){var b=a.B;b.skipsUndoManager=a.Kx;b.skipsModelSourceBindings=a.ix;a.ns=!1}
t.dd=function(a){var b=this.Jd;!0===this.wc&&(this.vl=this.lf=this.wc=!1,this.We.clear(),0<b.pc.count&&this.B.Vb());if(this.nc){if(b.wm(!0),b.pc.clear(),Vh(b),!0===a)for(a=this.Rk.ua(),b=0;b<a.length;b++)a[b].wm(!0)}else b.pc.clear(),Vh(b)};t.wm=function(a){a===this.defaultAnimation&&this.defaultAnimation.pc.clear();this.Rk.remove(a);0===this.Rk.count&&(this.nc=!1,this.B.Vb());a===this.defaultAnimation&&(this.defaultAnimation.pc.clear(),this.B.U("AnimationFinished",this))};
t.jk=function(a,b){this.lf&&(this.We.contains("Expand Tree")||this.We.contains("Expand SubGraph"))&&this.Jd.jk(a,b)};t.hk=function(a,b){this.lf&&(this.We.contains("Collapse Tree")||this.We.contains("Collapse SubGraph"))&&(this.Jd.hk(a,b),ei(this.Jd,b,"position",b.position,b.position))};function fi(a,b,c){a.lf&&!b.A(c)&&(a.B.zk||(b=c.copy()),ei(a.Jd,a.B,"position",b,c))}
function gi(a,b,c,d,e){null===a&&(a="rgba(0,0,0,0)");null===b&&(b="rgba(0,0,0,0)");hi(a);ii();var f=ji.l,g=ji.L,h=ji.w;a=ji.$;hi(b);ii();var k=ji.L,l=ji.w;b=ji.$;f=e(c,f,ji.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.cr(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.cr(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.cr(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.cr(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=gi(c,d,f,g,e)});a.add("stroke",function(a,c,d,e,f,g){a.stroke=gi(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=gi(c,d,f,g,e)});a.add("areaBackground",function(a,c,d,e,f,g){a.areaBackground=gi(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)});ki=a}
ma.Object.defineProperties(zh.prototype,{animationReasons:{configurable:!0,get:function(){return this.We}},isEnabled:{configurable:!0,get:function(){return this.gd},set:function(a){A(a,"boolean",zh,"isEnabled");this.gd=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.ns}},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.Rk}},initialAnimationStyle:{configurable:!0,get:function(){return this.wl},set:function(a){F&&hb(a,zh,zh,"initialAnimationStyle");this.wl=a}}});
zh.prototype.stopAnimation=zh.prototype.dd;var ki=null,Ah=!1,Ch=new E(zh,"Default",1),Uh=new E(zh,"AnimateLocations",2),Hh=new E(zh,"None",3);zh.className="AnimationManager";zh.defineAnimationEffect=function(a,b){Ah||(Bh(),Ah=!0);ki.add(a,b)};zh.Default=Ch;zh.AnimateLocations=Uh;zh.None=Hh;
function Dh(){this.sv=this.Jx=this.Rc=this.B=null;this.El=this.nc=this.l=!1;this.Xn=this.Ad=0;this.Hr=this.Fu=li;this.Dl=this.Dp=!1;this.iv=1;this.gv=0;this.td=this.dh=NaN;this.lx=0;this.Yn=null;this.w=Rb;this.pc=new Db;this.cv=new Db;this.lm=new I;this.dv=new I;this.jx=mi}Dh.prototype.suspend=function(){this.El=!0};Dh.prototype.advanceTo=function(a,b){b&&(this.El=!1);this.Dp&&a>=this.td&&(this.Dl=!0,a-=this.td);this.lx=a;ci(this,!0);Yh(this.Rc);Vf(this.B);$h(this.Rc);this.B.ge()};
function Vh(a){a.cv.clear();a.Dl=!1;a.gv=0;a.td=NaN;0<a.lm.count&&a.lm.clear();0<a.dv.count&&a.dv.clear()}t=Dh.prototype;
t.start=function(){if(0!==this.pc.count&&!this.nc){for(var a=this.B,b=this.pc.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 Q?a=d:d instanceof N&&(a=d.diagram))}null!==a&&(this.B=a,b=this.Rc=a.animationManager,!1!==b.isEnabled&&(this.td=isNaN(this.dh)?b.duration:this.dh,this.Hr=this.Fu,
b.vl&&b.wl===Ch&&this===b.defaultAnimation&&(this.Hr=ni,this.td=isNaN(this.dh)?600===b.duration?900:b.duration:this.dh),this.jx=a.scrollMode,this.isViewportUnconstrained&&(a.Ti=oi),Yh(b),this.lm.each(function(b){b.data=null;a.add(b)}),$h(b),this.nc=!0,this.Ad=+new Date,this.Xn=this.Ad+this.td,bi(b,this)))}};
t.hz=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.lm.add(a),this.B=b)};
t.add=function(a,b,c,d,e){"position"===b&&c.A(d)||(null===this.B&&(a instanceof Q?this.B=a:a instanceof N&&null!==a.diagram&&(this.B=a.diagram)),a instanceof S&&!a.isAnimated||ei(this,a,b,c,d,e))};
function ei(a,b,c,d,e,f){var g=a.pc;b instanceof Q&&"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]=pi(d));l[c]=pi(e)}else k={},l={},k[c]=pi(d),l[c]=pi(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 qi(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.Mv.location=pi(b.location):
f&&(h.Mv[c]=pi(d))}function pi(a){return a instanceof J?a.copy():a instanceof Hb?a.copy():a}t.Xt=function(a){if(!this.nc)return!1;a=this.pc.K(a);return null!==a&&a.pw};t.cw=function(a){if(!this.nc)return!1;a=this.pc.K(a);return null!==a&&(a.start.position||a.start.location)};
function ci(a,b){if(!a.El||b){var c=a.Rc;if(!1!==a.nc){var d=+new Date,e=d>a.Xn?a.td:d-a.Ad;b&&(e=a.lx,e<a.td?(a.Ad=+new Date-e,a.Xn=a.Ad+a.td):e=a.td);Yh(c);Zh(a,e);Vf(a.B,!0);$h(c);d>a.Xn&&(a.Dp&&!a.Dl?(a.Ad=+new Date,a.Xn=a.Ad+a.td,a.Dl=!0):a.wm(!1))}}}
function Zh(a,b){for(var c=a.td,d=a.pc.iterator,e=a.Dl;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=ki,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.Hr,b,c,a)}}}t.stop=function(){this.nc&&this.wm(!0)};
t.wm=function(a){null!==this.sv&&this.sv.Kp.remove(this.Jx);if(this.nc){var b=this.B,c=this.Rc;this.El=this.nc=c.vl=!1;Yh(c);for(var d=this.pc,e=this.lm.iterator;e.next();)b.remove(e.value);for(e=this.dv.iterator;e.next();)e.value.u();e=this.Dp;d=d.iterator;for(var f=ki;d.next();){var g=d.key,h=d.value,k=e?h.end:h.start,l=e?h.start:h.end,m=h.Mv,n;for(n in l)if(null!==f.get(n)){var p=n;!h.Fv||"position:node"!==p&&"position:placeholder"!==p||(p="position");f.get(p)(g,k[n],void 0!==m[n]?m[n]:h.Fv?k[n]:
l[n],this.Hr,this.td,this.td,this)}h.Fv&&void 0!==m.location&&g instanceof S&&(g.location=m.location);h.pw&&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.St.clear();wf(b,!1);b.Ta();b.P();Vf(b,!0);this.isViewportUnconstrained&&(b.scrollMode=this.jx);$h(c);this.gv++;!a&&this.iv>this.gv?(this.Dl=!1,this.start()):(this.Yn&&this.Yn(this),Vh(this),c.wm(this),b.Vb())}};
t.jk=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.jk(d,b)};
t.hk=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.pc;c.contains(a)&&(c.K(a).pw=!0);if(a instanceof Hf)for(a=a.memberParts;a.next();)c=a.value,c instanceof T&&this.hk(c,b)}};t.hA=function(a){var b=this.cv.get(a);null===b&&(b={},this.cv.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.Dp},set:function(a){this.Dp=a}},runCount:{configurable:!0,get:function(){return this.iv},set:function(a){0<a?this.iv=a:v("Animation.runCount value must be a positive integer.")}},finished:{configurable:!0,
get:function(){return this.Yn},set:function(a){this.Yn!==a&&(null!==a&&A(a,"function",Q,"click"),this.Yn=a)}},easing:{configurable:!0,get:function(){return this.Fu},set:function(a){this.Fu=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.hA;Dh.prototype.stop=Dh.prototype.stop;Dh.prototype.add=Dh.prototype.add;
Dh.prototype.addTemporaryPart=Dh.prototype.hz;function li(a,b,c,d){a/=d/2;return 1>a?c/2*a*a+b:-c/2*(--a*(a-2)-1)+b}function ni(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=li;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=ni;
function qi(a,b,c){this.start=a;this.end=b;this.Mv={};this.Fv=c;this.pw=!1}qi.className="AnimationState";function ri(a,b,c){this.jd=null;this.nf=a;this.cq=c||si;this.Wk=null;void 0!==b&&(this.Wk=b,void 0===c&&(this.cq=ti))}ri.prototype.copy=function(){var a=new ri(this.nf);a.cq=this.cq;var b=this.Wk;if(null!==b){var c={};void 0!==b.duration&&(c.ey=b.duration);void 0!==b.finished&&(c.ey=b.finished);void 0!==b.easing&&(c.ey=b.easing);a.Wk=c}return a};
function ui(a,b){a=a.Wk;null!==a&&(a.duration&&(b.duration=a.duration),a.finished&&(b.finished=a.finished),a.easing&&(b.easing=a.easing))}
ma.Object.defineProperties(ri.prototype,{propertyName:{configurable:!0,get:function(){return this.nf},set:function(a){this.nf=a}},animationSettings:{configurable:!0,get:function(){return this.Wk},set:function(a){this.Wk=a}},startCondition:{configurable:!0,get:function(){return this.cq},set:function(a){F&&hb(a,ri,ri,"startCondition");this.cq=a}}});var si=new E(ri,"Default",1),ti=new E(ri,"Immediate",2),vi=new E(ri,"Bundled",3);ri.className="AnimationTrigger";
ri.Default=si;ri.Immediate=ti;ri.Bundled=vi;function wi(){0<arguments.length&&za(wi);fb(this);this.B=null;this.Ha=new H;this.Wa="";this.wb=1;this.w=!1;this.Oi=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.pp=[]}t=wi.prototype;t.clear=function(){this.Ha.clear();this.pp.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&&sb(d)&&(h+=" #"+sb(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.Oi)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.fj=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.Oi)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.fj(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.Oi)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.Rv=function(a,b,c,d,e,f,g){if(!1===this.Oi)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.Ig=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.Oi)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.Ig(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.ux=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],xi(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(),
yi(d,!0);Oa(a);Oa(b)}};function zi(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=zi(this,a),f=this.pp;f.length=0;for(var g=b.scale,h=L.alloc(),k=0;k<d;k++)this.bj(a,c[k],b,f,g,h);L.free(h);a.globalAlpha=e}}};
t.bj=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.Bm(f);if(!f.Nc(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.So||g.height*e>c.So?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&&
(Ai(b,a,b.areaBackground,!0,!0,f,e),a.fillRect(e.x,e.y,e.width,e.height)),null===b.areaBackground&&null===b.background&&(Ai(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),Ai(b,a,b.background,!0,!1,f,e),a.fillRect(0,0,f.width/2,f.height/2),c.Pt()||(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.nj=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.Iq(c);d=this.diagram;null!==d&&(c?d.P():d.nj(b));Bi(this,a,b);return a};
t.Mc=function(a,b,c){if(!c&&b.layer!==this&&null!==b.layer)return b.layer.Mc(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.Jq(c);d.hb(a);d=this.diagram;null!==d&&(c?d.P():d.Mc(b));b.Fi=null;return a};
function Bi(a,b,c){b=Ci(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&&Bi(a,-1,c)}}
function Ci(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(wi.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",wi,"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",wi,"opacity"),(0>a||1<a)&&ya(a,"0 <= value <= 1",wi,"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",wi,"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",wi,"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.Oi},set:function(a){var b=this.Oi;b!==a&&(A(a,"boolean",wi,"pickable"),this.Oi=
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",wi,"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",wi,"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",wi,"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",wi,"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",wi,"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",wi,"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",wi,"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",wi,"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",wi,"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",wi,"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",wi,"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",wi,"allowSelect"),this.ki=a,this.g("allowSelect",b,a))}}});wi.prototype.findObjectsNear=wi.prototype.Ig;wi.prototype.findObjectsIn=wi.prototype.Ff;wi.prototype.findObjectsAt=wi.prototype.fj;wi.prototype.findObjectAt=wi.prototype.$b;
wi.className="Layer";
function Q(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.");Di||(Ei(),Di=!0);fb(this);Pe=this;Xa=[];this.Xb=!0;this.Rc=new zh;this.Rc.he(this);this.rb=17;this.Cl=this.kv=!1;this.Ss="default";this.Ka=null;var c=this;gh&&(null!==qa.document.body?this.setRTL():c.addEventListener(qa.document,"DOMContentLoaded",b,!1));this.Pa=new H;this.Ca=this.Da=0;this.ya=
null;this.Fx=new Db;this.pf=this.Kb=null;this.ww();this.Kj=null;this.vw();this.wb=1;this.sa=(new J(NaN,NaN)).freeze();this.Ts=new J(NaN,NaN);this.On=this.Fa=1;this.cs=(new J(NaN,NaN)).freeze();this.ds=NaN;this.xs=1E-4;this.vs=100;this.sb=new Ib;this.tt=(new J(NaN,NaN)).freeze();this.Xr=(new L(NaN,NaN,NaN,NaN)).freeze();this.Si=(new lc(0,0,0,0)).freeze();this.Ti=mi;this.at=!1;this.Us=this.Os=null;this.Ug=Wh;this.Aj=ld;this.eg=Wh;this.po=ld;this.es=this.bs=Hc;this.Hc=!0;this.Al=!1;this.ud=new I;this.ah=
new Db;this.ll=!0;this.pn=250;this.yj=-1;this.rn=(new lc(16,16,16,16)).freeze();this.Ej=this.Le=!1;this.Hj=!0;this.bg=new we;this.bg.diagram=this;this.Zd=new we;this.Zd.diagram=this;this.mh=new we;this.mh.diagram=this;this.Be=this.Uf=null;this.dk=!1;this.Or=this.Pr=null;this.ln=qa.PointerEvent&&($a||bb||cb)&&qa.navigator&&!1!==qa.navigator.msPointerEnabled;Fi(this);this.Hh=new I;this.os=!0;this.ot=Gi;this.Pu=!1;this.qt=$f;this.Oa=null;Hi.add("Model",Ii);this.Ir=this.Lr=this.mt=null;this.Nn=this.Gr=
"auto";this.ng=this.As=this.pg=this.qg=this.sg=this.Wf=this.$f=this.Vf=null;this.$r=!1;this.Xf=this.Cg=this.rg=this.og=null;this.Bs=!1;this.Ms={};this.Zj=[null,null];this.Ar=null;this.Mr=this.et=this.mv=this.Ag=!1;this.Wu=!0;this.zi=this.Ic=!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.Pc=function(a){d.partManager.doModelChanged(a)};
this.uv=!0;this.Pd=-2;this.Pi=new Db;this.Ls=new H;this.gg=!1;this.ci=this.bi=this.mr=this.gd=!0;this.nr=!1;this.ur=this.sr=this.ki=this.ji=this.ii=this.hi=this.fi=this.gi=this.ei=this.rr=this.mi=this.di=this.li=this.pr=!0;this.fg=this.Su=!1;this.tr=this.qr=this.sl=this.rl=!0;this.$s=this.Ws=16;this.Vs=this.Mp=!1;this.Np=this.Ys=null;this.Xs=this.Zs=0;this.lb=(new lc(5)).freeze();this.lv=(new I).freeze();this.ws=999999999;this.Mu=(new I).freeze();this.yi=this.xi=this.wi=!0;this.df=this.te=!1;this.oc=
null;this.Tg=!0;this.ue=!1;this.vx=new I;this.Nu=new I;this.Nb=null;this.Rl=1;this.nv=0;this.$d={scale:1,position:new J,bounds:new L,ew:!1};this.Mx=(new L(NaN,NaN,NaN,NaN)).freeze();this.nm=(new Hb(NaN,NaN)).freeze();this.Pn=(new L(NaN,NaN,NaN,NaN)).freeze();this.ps=!1;this.Ho=this.no=this.ip=this.Au=this.zu=this.Bu=this.ig=this.kh=this.kf=this.Sr=null;Ji(this);this.Mb=null;this.mo=!1;this.Bj=null;this.partManager=new Ii;this.toolManager=new Ua;this.toolManager.initializeStandardTools();this.currentTool=
this.defaultTool=this.toolManager;this.Rr=null;this.el=new ef;this.Gs=this.Fs=null;this.fq=!1;this.commandHandler=Ki();this.model=Li();this.Ag=!0;Mi(this);this.layout=new Ni;this.Ag=!1;this.nx=this.Eu=null;this.Yb=1;this.Ch=null;this.So=1;this.Zo=0;this.$o=[0,0,0,0,0];this.ap=0;this.vd=1;this.Pj=0;this.Co=new J;this.nt=500;this.qn=new J;this.ve=!1;this.preventDefault=this.au=this.Km=this.Lm=this.Jm=this.Im=this.Fk=this.Hk=this.Gk=this.Dk=this.Ek=this.Qw=this.Iw=this.Jw=this.Kw=this.vh=this.Vl=this.uh=
this.Ul=null;this.so=!1;this.vi=new Oi;this.gq=!1;void 0!==a&&Pi(this,a);this.Zn=null;this.$n=Vb;this.Xb=!1}Q.prototype.clear=function(){this.animationManager.dd();this.model.clear();Qi=null;Ri="";Yi(this,!1);this.Ta();Zi(this);this.P()};
function Yi(a,b){a.animationManager.dd(!0);a.lv=(new I).freeze();a.Mu=(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.Pa.length;if(b){for(b=0;b<f;b++)for(var g=a.Pa.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.Pa.j[b].clear();a.partManager.clear();a.ud.clear();a.ah.clear();a.Hh.clear();a.Bj=null;Na=[];null!==d&&(a.add(d),
a.partManager.parts.remove(d));null!==a.model&&(a.skipsUndoManager=c);return e}function Ki(){return null}
Q.prototype.reset=function(){this.clear();this.Xb=!0;this.Rc=new zh;this.Rc.he(this);this.rb=17;this.Cl=this.kv=!1;this.Ss="default";this.Pa=new H;this.Fx=new Db;this.pf=null;this.ww();this.Kj=null;this.vw();this.wb=1;this.sa=(new J(NaN,NaN)).freeze();this.Ts=new J(NaN,NaN);this.On=this.Fa=1;this.cs=(new J(NaN,NaN)).freeze();this.ds=NaN;this.xs=1E-4;this.vs=100;this.sb=new Ib;this.tt=(new J(NaN,NaN)).freeze();this.Xr=(new L(NaN,NaN,NaN,NaN)).freeze();this.Si=(new lc(0,0,0,0)).freeze();this.Ti=mi;
this.at=!1;this.Us=this.Os=null;this.Ug=Wh;this.Aj=ld;this.eg=Wh;this.po=ld;this.es=this.bs=Hc;this.Hc=!0;this.Al=!1;this.ud=new I;this.ah=new Db;this.ll=!0;this.pn=250;this.yj=-1;this.rn=(new lc(16,16,16,16)).freeze();this.Ej=this.Le=!1;this.Hj=!0;this.bg=new we;this.bg.diagram=this;this.Zd=new we;this.Zd.diagram=this;this.mh=new we;this.mh.diagram=this;this.Be=this.Uf=null;this.dk=!1;this.Or=this.Pr=null;this.ln=qa.PointerEvent&&($a||bb||cb)&&qa.navigator&&!1!==qa.navigator.msPointerEnabled;Fi(this);
this.Hh=new I;this.os=!0;this.ot=Gi;this.Pu=!1;this.qt=$f;this.Ir=this.Lr=this.mt=null;this.Nn=this.Gr="auto";this.ng=this.As=this.pg=this.qg=this.sg=this.Wf=this.$f=this.Vf=null;this.$r=!1;this.Xf=this.Cg=this.rg=this.og=null;this.Bs=!1;this.Ms={};this.Zj=[null,null];this.Ar=null;this.Mr=this.et=this.mv=this.Ag=!1;this.Wu=!0;this.zi=this.Ic=!1;this.uv=!0;this.Pd=-2;this.Pi=new Db;this.Ls=new H;this.gg=!1;this.ci=this.bi=this.mr=this.gd=!0;this.nr=!1;this.ur=this.sr=this.ki=this.ji=this.ii=this.hi=
this.fi=this.gi=this.ei=this.rr=this.mi=this.di=this.li=this.pr=!0;this.fg=this.Su=!1;this.tr=this.qr=this.sl=this.rl=!0;this.$s=this.Ws=16;this.Vs=this.Mp=!1;this.Xs=this.Zs=0;this.lb=(new lc(5)).freeze();this.lv=(new I).freeze();this.ws=999999999;this.Mu=(new I).freeze();this.yi=this.xi=this.wi=!0;this.df=this.te=!1;this.oc=null;this.Tg=!0;this.ue=!1;this.vx=new I;this.Nu=new I;this.Nb=null;this.Rl=1;this.nv=0;this.$d={scale:1,position:new J,bounds:new L,ew:!1};this.Mx=(new L(NaN,NaN,NaN,NaN)).freeze();
this.nm=(new Hb(NaN,NaN)).freeze();this.Pn=(new L(NaN,NaN,NaN,NaN)).freeze();this.ps=!1;this.Ho=this.no=this.ip=this.Au=this.zu=this.Bu=this.ig=this.kh=this.kf=null;Ji(this);this.Mb=null;this.mo=!1;this.Bj=null;this.partManager=new Ii;this.toolManager=new Ua;this.toolManager.initializeStandardTools();this.currentTool=this.defaultTool=this.toolManager;this.Rr=null;this.el=new ef;this.Gs=this.Fs=null;this.fq=!1;this.commandHandler=Ki();this.Ag=!0;Mi(this);this.layout=new Ni;this.Ag=!1;this.model=Li();
this.model.undoManager=new Me;this.ue=!1;this.Hj=!0;this.Le=!1;this.Yb=1;this.Ch=null;this.So=1;this.Zo=0;this.$o=[0,0,0,0,0];this.ap=0;this.vd=1;this.Pj=0;this.Co=new J;this.nt=500;this.qn=new J;this.ve=!1;this.vh=this.Vl=this.uh=this.Ul=null;this.gq=this.so=!1;this.Zn=null;this.$n=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.Bu=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.zu=b;a.kh.add("",b);a.ig=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.Au=b;a.ig.add("",b);b=new R;c=new Yf;c.isPanelMain=!0;c.stroke="brown";b.add(c);a.ig.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.ip=b;a.no=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.Ho=b}
Q.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.Ss=c};
Q.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.kv=!0};Q.prototype.mb=function(a){a.classType===Q?this.autoScale=a:Ba(this,a)};Q.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.Pa.iterator;c.next();)b+="\n "+c.value.toString(a-1);return b};Q.prototype.addEventListener=function(a,b,c,d){a.addEventListener(b,c,{capture:d,passive:!1})};
Q.prototype.removeEventListener=function(a,b,c,d){a.removeEventListener(b,c,{capture:d})};
function cj(a){var b=a.ya.Ja;b instanceof HTMLCanvasElement&&(a.ln?(a.addEventListener(b,"pointerdown",a.Im,!1),a.addEventListener(b,"pointermove",a.Jm,!1),a.addEventListener(b,"pointerup",a.Lm,!1),a.addEventListener(b,"pointerout",a.Km,!1)):(a.addEventListener(b,"touchstart",a.Kw,!1),a.addEventListener(b,"touchmove",a.Jw,!1),a.addEventListener(b,"touchend",a.Iw,!1),a.addEventListener(b,"mousemove",a.Ek,!1),a.addEventListener(b,"mousedown",a.Dk,!1),a.addEventListener(b,"mouseup",a.Gk,!1),a.addEventListener(b,
"mouseout",a.Fk,!1)),a.addEventListener(b,"mouseenter",a.Cz,!1),a.addEventListener(b,"mouseleave",a.Dz,!1),a.addEventListener(b,"wheel",a.Hk,!1),a.addEventListener(b,"keydown",a.vA,!1),a.addEventListener(b,"keyup",a.wA,!1),a.addEventListener(b,"blur",a.oz,!1),a.addEventListener(b,"focus",a.pz,!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.Rl=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.Rl){var e=a.ya.getBoundingClientRect();b=new J(b.pageX-qa.scrollX-a.Da/e.width*e.left,b.pageY-qa.scrollY-a.Ca/e.height*e.top);
c=a.Rl*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.Qw,!1))}function hf(a){30<a.Zo&&(a.Ch=1)}function wf(a,b){null!==a.Ch&&(a.Ch=null,b&&a.au(),a.Zo=0,a.$o=[0,0,0,0,0],a.ap=0)}Q.prototype.computePixelRatio=function(){return null!==this.Ch?this.Ch:qa.devicePixelRatio||1};Q.prototype.doMouseMove=function(){this.currentTool.doMouseMove()};Q.prototype.doMouseDown=function(){this.currentTool.doMouseDown()};
Q.prototype.doMouseUp=function(){this.currentTool.doMouseUp()};Q.prototype.doMouseWheel=function(){this.currentTool.doMouseWheel()};Q.prototype.doKeyDown=function(){this.currentTool.doKeyDown()};Q.prototype.doKeyUp=function(){this.currentTool.doKeyUp()};Q.prototype.doFocus=function(){this.focus()};Q.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)}};Q.prototype.pz=function(){this.B.U("GainedFocus")};
Q.prototype.oz=function(){this.B.U("LostFocus")};function Xh(a){if(null!==a.ya){var b=a.Ka;if(0!==b.clientWidth&&0!==b.clientHeight){a.kv||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.Al=!0,a.Vb());if(b.clientWidth!==a.Da+c||b.clientHeight!==a.Ca+d)a.xi=!0,a.Hc=!0,b=a.layout,null!==b&&b.isViewportSized&&a.autoScale===Wh&&(a.Ej=!0,b.D()),a.Ic||a.Vb()}}}
function Mi(a){var b=new wi;b.name="Background";a.om(b);b=new wi;b.name="";a.om(b);b=new wi;b.name="Foreground";a.om(b);b=new wi;b.name="Adornment";b.isTemporary=!0;a.om(b);b=new wi;b.name="Tool";b.isTemporary=!0;b.isBoundsIncluded=!0;a.om(b);b=new wi;b.name="Grid";b.allowSelect=!1;b.pickable=!1;b.isTemporary=!0;a.Px(b,a.ym("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.Vs?this.B.Vs=!1:this.B.isEnabled?this.B.Zx(this):fj(this.B)}function gj(a){this.B.isEnabled?(this.B.Zs=a.target.scrollTop,this.B.Xs=a.target.scrollLeft):fj(this.B)}
Q.prototype.Zx=function(a){if(null!==this.ya){this.Mp=!0;var b=this.documentBounds,c=this.viewportBounds,d=this.Si,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.Cl)switch(this.Ss){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.Xs!==u&&(q.x=u/c+e,this.Xs=u),this.allowVerticalScroll&&this.Zs!==a.scrollTop&&(q.y=a.scrollTop/c+f,this.Zs=a.scrollTop),this.position=q,J.free(q),this.xi=this.Mp=!1):(q=J.alloc(),a.Xy&&this.allowHorizontalScroll&&(e<l&&(this.position=q.h(u+e,this.position.y)),k>p&&(this.position=q.h(-(this.Ys.scrollWidth-this.Da)+u-this.Da/c+k,this.position.y))),a.Yy&&this.allowVerticalScroll&&(f<b&&(this.position=q.h(this.position.x,a.scrollTop+f)),d>r&&(this.position=q.h(this.position.x,
-(this.Ys.scrollHeight-this.Ca)+a.scrollTop-this.Ca/c+d))),J.free(q),hj(this),this.xi=this.Mp=!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.Np.style.width="1px"),n>=h&&f>=b&&d<=r&&(this.Np.style.height="1px"))}};Q.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.uq(a.lb);return b}for(var c=!0,d=a.Pa.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.Oc(l)))}}}c&&(b=new L(0,0,0,0));b.uq(a.lb);return b}
Q.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.Oc(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.Oc(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.sj(a.documentBounds,a.initialDocumentSpot);var d=a.viewportBounds;d=L.allocAt(0,0,d.width,d.height);var e=J.alloc();e.sj(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.eg!==Wh&&(c=a.eg);d=c!==Wh?lj(a,c):a.scale;c=a.viewportBounds.copy();e=a.Da/d;var f=a.Ca/d,g=a.Aj,h=a.po;b&&!g.bb()&&(h.bb()||
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.Uq(c,d,b,!1);nj(a);oj(a,!0,!1)}}
function lj(a,b){var c=a.On;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}
Q.prototype.zoomToFit=function(){var a=this.Ti;this.Ti=mi;this.scale=lj(this,pj);a!==mi&&(kj(this,!1),mj(this,this.documentBounds,this.Da/this.Fa,this.Ca/this.Fa,this.Aj,!1));this.Ti=a};t=Q.prototype;
t.dB=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.iz=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.aA=function(a){if(a instanceof N){this.Zn=a;var b=J.alloc();this.$n=this.fr(a.ma(Hc,b));J.free(b)}else this.Zn=null,this.$n=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.Zn){var l=J.alloc();l=a.Zn.ma(Hc,l);h=l.x-a.$n.x/a.scale;k=l.y-a.$n.y/a.scale;e=Gc;J.free(l)}if(f||a.scrollMode===mi)e.bb()&&(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.Si,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.Rc.wc&&fi(a.Rc,a.sa,g);a.sa.h(g.x,g.y);J.free(g)}
t.zm=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.Pa.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.Pa.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.Pz=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.Pa.iteratorBackwards;a.next();){var f=a.value;f.visible&&!f.isTemporary&&f.fj(b,c,d,e)}return e}t.fj=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.Pa.iteratorBackwards;e.next();){var f=e.value;f.visible&&f.fj(a,b,c,d)}return d};
t.ky=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.Pa.iteratorBackwards;f.next();){var g=f.value;g.visible&&g.Ff(a,b,c,d,e)}return e};
t.Rv=function(a,b,c,d,e,f){var g=new I;ij(this);for(var h=this.Pa.iteratorBackwards;h.next();){var k=h.value;k.visible&&k.Rv(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.Pa.iteratorBackwards;a.next();){var g=a.value;g.visible&&!g.isTemporary&&g.Ff(b,f,c,d,e)}return e}
t.Qz=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.Ig=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.Pa.iteratorBackwards;g.next();){var h=g.value;h.visible&&h.Ig(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.Pa.iteratorBackwards;a.next();){var h=a.value;h.visible&&!h.isTemporary&&h.Ig(b,c,g,d,e,f)}return f}Q.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.bg);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.bg&&(d.documentPoint=a.bg.documentPoint,d.viewPoint=a.bg.viewPoint,d.targetDiagram=a.bg.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.ln&&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.py&&Ca("NOT handled "+c.type+" "+b.toString()),!0;F&&F.py&&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}
Q.prototype.vA=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)};
Q.prototype.wA=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)};
Q.prototype.Cz=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)};Q.prototype.Dz=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)};
Q.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.Zj[0])b=a.Zj[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=Q.prototype;t.Ta=function(){this.wi||(this.wi=!0,this.Vb(!0))};function Bj(a){a.Ic||ij(a);Zi(a)}t.ge=function(){this.Xb||this.Ic||(this.P(),nj(this),hj(this),this.Ta(),this.cd())};t.uA=function(){return this.Le};
t.xz=function(a){void 0===a&&(a=null);var b=this.animationManager,c=b.isEnabled;b.dd();b.isEnabled=!1;Vf(this);this.ue=!1;this.Ts=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.Ic)){this.Le=!0;var b=this;qa.requestAnimationFrame(function(){b.Le&&b.cd()})}};t.cd=function(){if(!this.Hj||this.Le)this.Hj&&(this.Hj=!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.Ic&&(a.Le=!1,null!==a.Ka||a.nm.o())){a.Ic=!0;var c=a.animationManager,d=a.Ls;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.Nu;0<d.count&&(d.each(function(a){a.Pw()}),d.clear());e=d=!1;c.isAnimating&&(e=!0,d=a.skipsUndoManager,a.skipsUndoManager=!0);c.wc||Xh(a);oj(a,!1,!1);null!==a.Mb&&(a.Mb.visible&&!a.mo&&(Dj(a),a.mo=!0),!a.Mb.visible&&a.mo&&(a.mo=!1));ij(a);f=!1;if(!a.ue||a.Tg)a.ue?Ej(a,!a.Ej):(a.Ba("Initial Layout"),
!1===c.isEnabled&&c.dd(),Ej(a,!1)),f=!0;a.Ej=!1;ij(a);a.et||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.vl&&c.Lx&&(a.eg!==Wh?a.scale=lj(a,a.eg):a.Ug!==Wh?a.scale=lj(a,a.Ug):(c=a.initialScale,isFinite(c)&&0<c&&(a.scale=c)),kj(a,!0));ij(a);f&&g&&a.ab("Initial Layout");a.Bv();b||a.hc(a.Kb);e&&(a.skipsUndoManager=
d);a.Ic=!1}}function Fj(a){var b=a.Fa;if(a.eg!==Wh)a.scale=lj(a,a.eg);else if(a.Ug!==Wh)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.Pa.j;a.Gd(b,b.length,a);a.U("InitialLayoutCompleted");a.Ts.assign(a.sa);Dj(a)}
function ij(a){if((a.Ic||!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.Pw(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.Pw=function(a,b){for(a.reset();a.next();){var c=a.value;!c.bc()||c instanceof Hf||(c.qj()?(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.qj()?(c.measure(Infinity,Infinity),c.arrange()):b.add(c));for(a.reset();a.next();)c=a.value,c instanceof Te&&c.isVisible()&&(c.qj()?(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.Ka){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.Ka.style.opacity){var e=a!==this.Kb,f=this.Pa.j,g=f.length,h=this;this.Gd(f,g,h);if(e)a.yc(!0),hj(this);else if(!this.Hc&&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.rm&&F.Jv&&F.Jv(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=zi(c,a),k=c.pp;k.length=0;for(var l=h.scale,m=L.alloc(),n=0;n<f;n++){var D=e[n];d.contains(D)||c.bj(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.Sr();F&&(F.by||F.rm)&&F.Kv&&F.Kv(a,this,c);e?(this.Kb.yc(!0),hj(this)):this.Hc=this.yi=!1;e=+new Date-+d;if(null===this.Ch){d=this.$o;d[this.ap]=e;this.ap=(this.ap+1)%d.length;for(f=e=0;f<this.$o.length;f++)e+=this.$o[f];this.Zo=e/d.length}}}}};
function Nj(a,b,c,d,e,f,g,h,k,l){if(null!==a.Ka){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.Pa.j,p=n.length;try{var r=new L(f.x,f.y,d.width/e,d.height/e),q=r.copy();q.uq(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 w=Ib.alloc();
w.reset();w.translate(c.left,c.top);w.scale(e);0===f.x&&0===f.y||w.translate(-f.x,-f.y);b.setTransform(w.m11,w.m12,w.m21,w.m22,w.dx,w.dy);Ib.free(w);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=zi(c,b),g=c.pp;g.length=0;for(var h=a.scale,l=L.alloc(),m=0;m<e;m++){var n=d[m];y.contains(n)&&
c.bj(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.Sr()}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.Jy=function(a,b){"minDrawingLength"===a&&(this.So=b);this.pf[a]=b;this.ge()};
t.ww=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.So=this.pf.minDrawingLength=1};function Lj(a,b){a=a.pf;null!==a&&(void 0!==a.imageSmoothingEnabled&&b.Iy(!!a.imageSmoothingEnabled),a=a.defaultFont,void 0!==a&&null!==a&&(b.font=a))}t.Cm=function(a){return this.Kj[a]};t.TA=function(a,b){this.Kj[a]=b};
t.vw=function(){this.Kj=new jb;this.Kj.extraTouchArea=10;this.Kj.extraTouchThreshold=10;this.Kj.hasGestureZoom=!0};t.Dw=function(a){Oj(this,a)};
function Oj(a,b){var c=a instanceof U,d=a instanceof Q,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.Rx(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.ik(g,b[g]);continue}else if(a instanceof V&&"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.Ox(g)}}t.Bv=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.Lq(a.value);b.ic()}}this.P()}};
t.P=function(a){void 0===a&&(a=null);if(null===a)this.Hc=!0,this.Vb();else{var b=this.viewportBounds;null!==a&&a.o()&&b.Nc(a)&&(this.Hc=!0,this.Vb())}this.U("InvalidateDraw")};
t.sy=function(a,b){if(!0!==this.Hc){this.Hc=!0;var c=!0===this.Qe("temporaryPixelRatio");if(!0===this.Qe("viewportOptimizations")&&this.scrollMode!==oi&&this.Si.dj(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.gq&&0<d.width&&0<d.height){if(!(this.Ic||(this.Le=!1,null===this.Ka||(this.Ic=!0,this.Bv(),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.Eu;a=this.nx;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 w=this.sb;w.reset();w.scale(g,g);1!==this.Fa&&w.scale(this.Fa);g=this.sa;(0!==g.x||0!==g.y)&&isFinite(g.x)&&isFinite(g.y)&&w.translate(-g.x,-g.y);Jb(n,w);Jb(q,w);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,w);Jb(q,w);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,w),Jb(q,w),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.Ka&&v("No div specified");null===this.ya&&v("No canvas specified");if(!this.animationManager.wc&&
(f=this.Kb,this.Hc)){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.Eu.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.rm&&F.Jv&&F.Jv(this,f);h=this.Pa.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=zi(k,f);n=k.pp;n.length=0;r=this.scale;q=L.alloc();w=k.Ha.j;u=w.length;for(var y=m.length,z=0;z<u;z++){var B=w[z];a:{var D=Sj(B,B.actualBounds);for(var G=m,O=y,X=2/r,P=4/r,ca=0;ca<O;ca++){var Y=G[ca];if(0!==Y.width&&0!==Y.height&&D.aw(Y.x-X,Y.y-X,Y.width+P,Y.height+P)){D=!0;break a}}D=
!1}D&&k.bj(f,B,this,n,r,q)}L.free(q);f.globalAlpha=p}f.restore();f.yc(!0);F&&(F.by||F.rm)&&F.Kv&&F.Kv(f,this,l);this.vi&&Mj(this.vi,this)&&this.Sr();this.Hc=this.yi=!1;this.au()}Oa(e);Oa(a);this.Ic=!1}}else this.cd();L.free(d);c&&(hf(this),this.cd(),wf(this,!0))}else c?(hf(this),this.cd(),wf(this,!0)):this.cd()}};function nj(a){!1===a.xi&&(a.xi=!0)}function hj(a){!1===a.yi&&(a.yi=!0)}function Kj(a){!1!==a.Al&&(a.Al=!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.Hc=!0,a.Kb.yc(!0))}
function fj(a){var b=a.ya;if(null===b)return!0;var c=a.Ka,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.Al=!0;if(!(g||a.df||a.te||a.rl||a.sl))return!0;a.xi=!1;var n=a.viewportBounds,p=a.documentBounds,r=0,q=0,u=0,w=0;c=n.width;var y=n.height,z=a.Si;a.contentAlignment.bb()?(p.width>c&&(r=z.left,q=z.right),p.height>y&&(u=z.top,w=z.bottom)):(r=z.left,
q=z.right,u=z.top,w=z.bottom);z=p.width+r+q;var B=p.height+u+w;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+w;n=n.bottom+k;var X="1px",P="1px";w=a.scale;l=z>l/w;m=B>m/w;a.scrollMode===mi&&(l||m)&&(l&&a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(l=1,r+1<D&&(l=Math.max((D-r)*w+a.Da,l)),q>G+1&&(l=Math.max((q-G)*w+a.Da,l)),c+h+1<z&&(l=Math.max((z-c)*w+a.Da,l)),X=l.toString()+"px"),m&&a.hasVerticalScrollbar&&a.allowVerticalScroll&&(l=1,u+1<O&&(l=Math.max((O-u)*w+a.Ca,
l)),p>n+1&&(l=Math.max((p-n)*w+a.Ca,l)),y+k+1<B&&(l=Math.max((B-y)*w+a.Ca,l)),P=l.toString()+"px"));l="1px"!==X;m="1px"!==P;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)*w+a.Da,h)),q>G+1&&(h=Math.max((q-G)*w+a.Da,h)),c+1<z&&(h=Math.max((z-c)*w+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)*w+
h,k)),p>n+1&&(k=Math.max((p-n)*w+h,k)),y+1<B&&(k=Math.max((B-y)*w+h,k)),P=k.toString()+"px"),m="1px"!==P);if(a.Mp&&l===a.te&&m===a.df)return d===a.Da&&e===a.Ca||a.cd(),!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.Np.style.width=X;m!==a.df&&("1px"===P?a.Da=a.Da+a.rb:a.Da=Math.max(a.Da-a.rb,1),g=!0,a.Cl&&(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.Np.style.height=P;a.Vs=!0;g&&(a.Al=!0);b=a.Ys;k=b.scrollLeft;a.hasHorizontalScrollbar&&a.allowHorizontalScroll&&(c+1<z?k=(a.position.x-r)*w:r+1<D?k=b.scrollWidth-b.clientWidth:q>G+1&&(k=a.position.x*w));if(a.Cl)switch(a.Ss){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)*w:u+1<O?b.scrollTop=b.scrollHeight-b.clientHeight:p>n+1&&(b.scrollTop=a.position.y*
w));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.Uq(f,a.viewportBounds,w,g),!1):!0}
t.add=function(a){x(a,S,Q,"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.ym(a.layerName),null===b&&(b=this.ym("")),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.nj(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.nj=function(a){this.partManager.nj(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.Mc=function(a){a.lk();this.partManager.Mc(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){x(a,S,Q,"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.sk(),c=d.Mc(-1,b,!1),0<=c&&a.gb(Ke,"parts",d,b,null,c,null),a=b.layerChanged,null!==a&&a(b,d,null))}t.cu=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.rk=function(a,b,c){return this.partManager.rk(a,b,c)};
Q.prototype.moveParts=function(a,b,c,d){void 0===d&&(d=bk(this));x(b,J,Q,"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.Sv();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&&(x(b,Db,Q,"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.fq)||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.Yv.shifted&&(n.Yv.shifted=new J),n.node.location=f.add(n.Yv.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 w=m=J.alloc().assign(q).add(g);d.isGridSnapEnabled&&
(d.isGridSnapRealtime||a.lastInput.up)&&(w=J.alloc(),Tg(a,r,m,w,d));m.assign(r.dragComputation(r,m,w)).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);w!==m&&J.free(w)}else null!==m&&(e.assign(m.location),w=b.K(m),null!==w&&e.ie(w.point)),null!==u&&(l.assign(u.location),w=b.K(u),null!==w&&l.ie(w.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.Za()):(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))}}
Q.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.el}
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.Lk(0,0,a,b,e);K.Eq(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.fq=!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.Za())}a.fq=!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=Q.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){x(b,wi,Q,"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):(x(c,wi,Q,"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.Pa;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.om=function(a){gk(this,a,null);a.he(this);var b=this.Pa,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.Px=function(a,b){gk(this,a,b);a.he(this);var c=this.Pa,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.cz=function(a,b){gk(this,a,b);a.he(this);var c=this.Pa,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.MA=function(a){x(a,wi,Q,"removeLayer:layer");a.diagram!==this&&v("Cannot remove a Layer from another Diagram: "+a+" of "+a.diagram);if(""!==a.name){var b=this.Pa,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.ym=function(a){for(var b=this.layers;b.next();){var c=b.value;if(c.name===a)return c}return null};
t.Rx=function(a){A(a,"function",Q,"addModelChangedListener:listener");null===this.Be&&(this.Be=new H);this.Be.add(a);this.model.Lh(a)};t.OA=function(a){A(a,"function",Q,"removeModelChangedListener:listener");null!==this.Be&&(this.Be.remove(a),0===this.Be.count&&(this.Be=null));this.model.Kk(a)};t.Lh=function(a){A(a,"function",Q,"addChangedListener:listener");null===this.Uf&&(this.Uf=new H);this.Uf.add(a)};
t.Kk=function(a){A(a,"function",Q,"removeChangedListener:listener");null!==this.Uf&&(this.Uf.remove(a),0===this.Uf.count&&(this.Uf=null))};t.vt=function(a){this.skipsUndoManager||this.model.skipsUndoManager||this.model.undoManager.Zv(a);a.change!==Ie&&(this.isModified=!0);if(null!==this.Uf)for(var b=this.Uf,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.vt(h)};t.g=function(a,b,c,d,e){this.gb(He,a,this,b,c,d,e)};
Q.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.Mc(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.tw(h):g.rw(h);else{var m=k.isRow?g.getRowDefinition(k.index):g.getColumnDefinition(k.index);m.yt(k)}}else if(g instanceof wi){var n=!0===a.oldParam;"number"===typeof h&&k instanceof S&&(b?(k.isSelected=!1,k.isHighlighted=!1,k.Rb(),g.Mc(n?h:-1,k,n)):g.nj(h,k,n))}else g instanceof Q?"number"===typeof h&&k instanceof wi&&(b?this.Pa.hb(h):(k.he(this),this.Pa.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.Mc(r):"number"===typeof r&&q instanceof ik&&(b?(m=q.isRow?p.getRowDefinition(q.index):p.getColumnDefinition(q.index),m.yt(q)):q.isRow?p.tw(r):p.rw(r));else if(p instanceof wi){var u=!0===a.newParam;"number"===typeof r&&q instanceof S&&(b?0>p.Ha.indexOf(q)&&p.nj(r,q,u):(q.isSelected=!1,q.isHighlighted=!1,q.Rb(),p.Mc(u?r:-1,q,u)))}else p instanceof Q?"number"===typeof r&&q instanceof wi&&(b?(q.he(this),this.Pa.yb(r,q)):this.Pa.hb(r)):v("unknown ChangedEvent.Remove object: "+
a.toString());this.isModified=!0}else d!==Ie&&v("unknown ChangedEvent: "+a.toString())}finally{this.skipsModelSourceBindings=c}}};Q.prototype.Ba=function(a){return this.undoManager.Ba(a)};Q.prototype.ab=function(a){return this.undoManager.ab(a)};Q.prototype.Mf=function(){return this.undoManager.Mf()};
Q.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.ab(b):this.undoManager.Mf(),this.skipsUndoManager=c}};Q.prototype.updateAllTargetBindings=function(a){this.partManager.updateAllTargetBindings(a)};Q.prototype.hr=function(){this.partManager.hr()};
function jk(a,b,c){var d=a.animationManager;if(a.Xb||a.Ic)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.bb()?l.x*(f-1):f/2);isNaN(k)&&(l.nd()?l.If(Tc)?k=0:l.If(Wc)&&(k=g-1):k=l.bb()?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.Uq(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)}}
Q.prototype.Uq=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!==Wh||d||a.width===b.width&&a.height===b.height||e.D();e=this.currentTool;!0===this.fg&&e instanceof Ua&&(this.lastInput.documentPoint=this.ju(this.lastInput.viewPoint),af(e,this));this.Xb||this.sy(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.ew=d;this.U("ViewportBoundsChanged",this.$d,a);
this.isVirtualized&&this.links.each(function(a){a.isAvoiding&&a.actualBounds.Nc(b)&&a.Za()})}};
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.ly(f,m):e=e*m/K.ly(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.Eq(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)}}Q.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)}};
Q.prototype.select=function(a){null!==a&&(x(a,S,Q,"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)))};
Q.prototype.SA=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)};
Q.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=Q.prototype;t.nA=function(a){null!==a&&a.layer.diagram===this&&(x(a,S,Q,"highlight:part"),!a.isHighlighted||1<this.highlighteds.count)&&(this.clearHighlighteds(),a.isHighlighted=!0)};
t.oA=function(a){a=(new I).addAll(a);for(var b=this.highlighteds.copy().Yq(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.yw=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.wt=function(a){var b=this.viewportBounds;a=a.center;a.x-=b.width/2;a.y-=b.height/2;this.position=a};t.fr=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.aB=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.ju=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.uv!==b&&(a.uv=b,a.U("Modified"))}function mk(a){a=Hi.get(a);return null!==a?new a:new Ii}
Q.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.Ic||this.ue||(this.Ej=!0,this.Hj&&(this.Le=!0))}else"StartingUndo"===d||"StartingRedo"===d?(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&
a.dd(),this.U("ChangingSelection",this.selection)):"StartedTransaction"===d&&(a=this.animationManager,a.defaultAnimation.isAnimating&&!this.skipsUndoManager&&a.dd());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.dd();this.Ej=!0;this.cd();0!==this.undoManager.transactionLevel&&1!==this.undoManager.transactionLevel||Gh(f);"CommittedTransaction"===
d&&this.undoManager.isJustDiscarded&&(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.St.clear(),di(this.animationManager));if(!this.Bs&&g){this.Bs=!0;var h=this;ta(function(){h.currentTool.standardMouseOver();h.Bs=!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.ql instanceof Event&&null!==b.Gc&&b.Gc(b,d.ql),!0===d.js&&(null!==b.xf&&b.xf(b,d.jv),null!==b.diagram&&b.diagram.Ls.add(b)));c=c.getAttribute("src");d=a.Pi.K(c);if(null===d)d=[],d.push(b),a.Pi.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.Pi.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.Pi.remove(c),Ck(c));break}}}}Q.prototype.Fd=function(){this.partManager.Fd()};Q.prototype.hk=function(a,b){this.Rc.hk(a,b)};Q.prototype.jk=function(a,b){this.Rc.jk(a,b)};Q.prototype.findPartForKey=function(a){return this.partManager.findPartForKey(a)};Q.prototype.Qb=function(a){return this.partManager.Qb(a)};
Q.prototype.findLinkForKey=function(a){return this.partManager.findLinkForKey(a)};t=Q.prototype;t.Dc=function(a){return this.partManager.Dc(a)};t.ej=function(a){return this.partManager.ej(a)};t.Cc=function(a){return this.partManager.Cc(a)};t.Et=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Et.apply(this.partManager,b instanceof Array?b:da(ba(b)))};
t.Dt=function(a){for(var b=[],c=0;c<arguments.length;++c)b[c]=arguments[c];return this.partManager.Dt.apply(this.partManager,b instanceof Array?b:da(ba(b)))};function Qj(a,b){a.wi=!1;var c=a.Pn;c.A(b)||(b=b.J(),a.Pn=b,kj(a,!1),a.U("DocumentBoundsChanged",null,c.copy()),nj(a))}function Zi(a){a.wi&&Qj(a,a.computeBounds())}t.Uz=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.Tz=function(){return this.Hh.iterator};
t.zA=function(a){ij(this);a&&Dk(this,!0);this.Ej=!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.Ol.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.Tg&&!a.Mr){var c=a.ba;a.ba=!0;var d=a.undoManager.transactionLevel,e=a.layout;try{0===d&&(a.undoManager.isInternalTransaction=!0,a.Ba("Layout"));var f=a.animationManager;1>=d&&!f.isAnimating&&!f.wc&&(b||Eh(f,"Layout"));a.Tg=!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.Tg=!0)}finally{0===d&&(a.ab("Layout"),a.undoManager.isInternalTransaction=!1),a.ba=c}}}
function Fk(a,b,c,d){if(null!==b){for(var e=b.Ol.iterator;e.next();)Fk(a,e.value,c,d);e=b.layout;null===e||e.isValidLayout||(!c||e.isRealtime||0===d?(b.Ik=!b.location.o(),e.doLayout(b),b.D(32),Gj(a,b),e.isValidLayout=!0):a.Tg=!0)}}t.$z=function(){for(var a=new H,b=this.nodes;b.next();){var c=b.value;c.isTopLevel&&null===c.hj()&&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.Pr=c;a.Or=d}
function Pj(a,b){var c=a.Or.K(b);return null!==c?c:a.Or.K(b.toLowerCase())}function Gk(a,b){var c=a.Pr.K(b);if(null!==c)return c;c=a.Pr.K(b.toLowerCase());if(null!==c)return c;v("Unknown DiagramEvent name: "+b)}t.ik=function(a,b){A(a,"string",Q,"addDiagramListener:name");A(b,"function",Q,"addDiagramListener:listener");a=Gk(this,a);null!==a&&a.add(b)};t.Om=function(a,b){A(a,"string",Q,"removeDiagramListener:name");A(b,"function",Q,"addDiagramListener:listener");a=Gk(this,a);null!==a&&a.remove(b)};
t.U=function(a,b,c){F&&A(a,"string",Q,"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.isTicking)return!1;var b=a.currentTool;return b===a.toolManager.findTool("Dragging")?!a.fq||b.isComplexRoutingRealtime:!0}
t.Ak=function(a,b){void 0===b&&(b=null);return Ik(this,!1,null,b).Ak(a.x,a.y,a.width,a.height)};Q.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.Mt||a.Nb.group!==c||a.Nb.My!==d){if(null===c){b=a.computeOccupiedArea();b.bd(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.bd(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.My=d;a.Nb.Mt=
!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.tm;c=a.Nb.sm;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.Mt&&(void 0===b&&(b=null),null===b||b.avoidable&&!b.isLinkLabel)&&(a.Nb.Mt=!0)}Q.prototype.At=function(a){this.qn.assign(a);this.computeAutoScrollPosition(this.qn).Sa(this.position)?this.Nf():Ok(this)};
function Ok(a){-1===a.yj&&(a.yj=ta(function(){if(-1!==a.yj&&(a.Nf(),null!==a.lastInput.event)){var b=a.computeAutoScrollPosition(a.qn);b.Sa(a.position)||(a.position=b,a.lastInput.documentPoint=a.ju(a.qn),a.doMouseMove(),a.wi=!0,Qj(a,a.documentBounds.copy().Oc(a.computeBounds())),a.Hc=!0,a.cd(),Ok(a))}},a.pn))}Q.prototype.Nf=function(){-1!==this.yj&&(qa.clearTimeout(this.yj),this.yj=-1)};
Q.prototype.computeAutoScrollPosition=function(a){var b=this.position,c=this.rn;if(0>=c.top&&0>=c.left&&0>=c.right&&0>=c.bottom)return b;var d=this.viewportBounds,e=this.scale;d=L.allocAt(0,0,d.width*e,d.height*e);var f=J.allocAt(0,0);if(a.x>=d.x&&a.x<d.x+c.left){var g=Math.max(this.scrollHorizontalLineChange,1);g|=0;f.x-=g;a.x<d.x+c.left/2&&(f.x-=g);a.x<d.x+c.left/4&&(f.x-=4*g)}else a.x<=d.x+d.width&&a.x>d.x+d.width-c.right&&(g=Math.max(this.scrollHorizontalLineChange,1),g|=0,f.x+=g,a.x>d.x+d.width-
c.right/2&&(f.x+=g),a.x>d.x+d.width-c.right/4&&(f.x+=4*g));a.y>=d.y&&a.y<d.y+c.top?(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y-=g,a.y<d.y+c.top/2&&(f.y-=g),a.y<d.y+c.top/4&&(f.y-=4*g)):a.y<=d.y+d.height&&a.y>d.y+d.height-c.bottom&&(g=Math.max(this.scrollVerticalLineChange,1),g|=0,f.y+=g,a.y>d.y+d.height-c.bottom/2&&(f.y+=g),a.y>d.y+d.height-c.bottom/4&&(f.y+=4*g));f.Sa(Rb)||(b=new J(b.x+f.x/e,b.y+f.y/e));L.free(d);J.free(f);return b};t=Q.prototype;t.Ut=function(){return null};t.fw=function(){return null};
t.gz=function(a,b){this.Fx.add(a,b)};function Pk(a,b,c){function d(){var a=+new Date;f=!0;for(g.reset();g.next();)if(!g.value[0].Kl){f=!1;break}f||a-l>k?b(c,e,h):qa.requestAnimationFrame(d)}for(var e=c.callback,f=!0,g=a.Pi.iterator;g.next();)if(!g.value[0].Kl){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.BA=function(a){if(!gh)return null;void 0===a&&(a=new jb);a.returnType="Image";return this.uy(a)};
t.uy=function(a){void 0===a&&(a=new jb);return Pk(this,this.CA,a)};
t.CA=function(a,b,c){var d=Qk(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 Qk(a,b,c,d){a.animationManager.dd();a.cd();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 Rk(null,r);var w=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.Bq=q;Nj(a,d.context,m,new Hb(p.width,p.height),a.Fa,a.sa,l,n,u,b);return d.context}a.ll=!1;Nj(a,w,m,new Hb(p.width,p.height),a.Fa,a.sa,l,n,u,b);a.ll=!0;return p.context}var y=a.On,z=a.documentBounds.copy();z.Fw(a.lb);if(u)for(var B=a.Pa.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,P=0;P<X;P++){var ca=O[P];ca.isInDocumentBounds&&ca.isVisible()&&(ca=ca.actualBounds,ca.o()&&
z.Oc(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.Oc(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&&!Sk&&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."),Sk=!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.Bq=q;Nj(a,d.context,m,new Hb(Math.ceil(f),
Math.ceil(z)),g,B,l,n,u,b);return d.context}a.ll=!1;Nj(a,w,m,new Hb(Math.ceil(f),Math.ceil(z)),g,B,l,n,u,b);a.ll=!0;return p.context}
ma.Object.defineProperties(Q.prototype,{div:{configurable:!0,get:function(){return this.Ka},set:function(a){null!==a&&x(a,HTMLDivElement,Q,"div");if(this.Ka!==a){Xa=[];var b=this.Ka;null!==b?(b.B=void 0,b.goDiagram=void 0,b.innerHTML="",null!==this.ya&&(b=this.ya.Ja,this.removeEventListener(b,"touchstart",this.Kw,!1),this.removeEventListener(b,"touchmove",this.Jw,!1),this.removeEventListener(b,"touchend",this.Iw,!1),this.ya.$x()),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.Qw,!1),this.removeEventListener(qa,"mousemove",this.Ek,!0),this.removeEventListener(qa,"mousedown",this.Dk,!0),this.removeEventListener(qa,"mouseup",this.Gk,!0),this.removeEventListener(qa,"wheel",this.Hk,!0),this.removeEventListener(qa,"mouseout",this.Fk,!0),Pe===this&&(Pe=null)):
this.ue=!1;this.Ka=null;if(null!==a){if(b=a.B)b.div=null;Pi(this,a);this.ge()}}}},Tx:{configurable:!0,get:function(){return this.Zo}},zk:{configurable:!0,get:function(){return this.ue}},draggedLink:{configurable:!0,get:function(){return this.Rr},set:function(a){this.Rr!==a&&(this.Rr=a,null!==a&&(this.Fs=a.fromPort,this.Gs=a.toPort))}},xy:{configurable:!0,get:function(){return this.Fs},set:function(a){this.Fs=a}},yy:{configurable:!0,
get:function(){return this.Gs},set:function(a){this.Gs=a}},animationManager:{configurable:!0,get:function(){return this.Rc}},undoManager:{configurable:!0,get:function(){return this.gc.undoManager}},skipsUndoManager:{configurable:!0,get:function(){return this.Ag},set:function(a){A(a,"boolean",Q,"skipsUndoManager");this.Ag=a;this.gc.skipsUndoManager=a}},delaysLayout:{configurable:!0,get:function(){return this.Mr},set:function(a){this.Mr=a}},opacity:{configurable:!0,
enumerable:!0,get:function(){return this.wb},set:function(a){var b=this.wb;b!==a&&(A(a,"number",Q,"opacity"),(0>a||1<a)&&ya(a,"0 <= value <= 1",Q,"opacity"),this.wb=a,this.g("opacity",b,a),this.P())}},validCycle:{configurable:!0,get:function(){return this.qt},set:function(a){var b=this.qt;b!==a&&(hb(a,Q,Q,"validCycle"),this.qt=a,this.g("validCycle",b,a))}},layers:{configurable:!0,get:function(){return this.Pa.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.gg},set:function(a){var b=this.gg;b!==a&&(A(a,"boolean",Q,"isReadOnly"),this.gg=a,this.g("isReadOnly",b,a))}},isEnabled:{configurable:!0,get:function(){return this.gd},set:function(a){var b=this.gd;b!==a&&(A(a,"boolean",Q,"isEnabled"),this.gd=a,this.g("isEnabled",b,a))}},allowClipboard:{configurable:!0,
get:function(){return this.mr},set:function(a){var b=this.mr;b!==a&&(A(a,"boolean",Q,"allowClipboard"),this.mr=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",Q,"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",Q,"allowDelete"),this.ci=a,this.g("allowDelete",b,a))}},
allowDragOut:{configurable:!0,get:function(){return this.nr},set:function(a){var b=this.nr;b!==a&&(A(a,"boolean",Q,"allowDragOut"),this.nr=a,this.g("allowDragOut",b,a))}},allowDrop:{configurable:!0,get:function(){return this.pr},set:function(a){var b=this.pr;b!==a&&(A(a,"boolean",Q,"allowDrop"),this.pr=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",Q,"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",Q,"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",Q,"allowUngroup"),this.mi=a,this.g("allowUngroup",b,a))}},allowInsert:{configurable:!0,get:function(){return this.rr},set:function(a){var b=
this.rr;b!==a&&(A(a,"boolean",Q,"allowInsert"),this.rr=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",Q,"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",Q,"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",Q,"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",Q,"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",Q,"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",Q,"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",Q,"allowSelect"),this.ki=a,this.g("allowSelect",b,a))}},allowUndo:{configurable:!0,get:function(){return this.sr},set:function(a){var b=this.sr;b!==a&&(A(a,"boolean",Q,"allowUndo"),this.sr=a,this.g("allowUndo",b,a))}},allowZoom:{configurable:!0,
enumerable:!0,get:function(){return this.ur},set:function(a){var b=this.ur;b!==a&&(A(a,"boolean",Q,"allowZoom"),this.ur=a,this.g("allowZoom",b,a))}},hasVerticalScrollbar:{configurable:!0,get:function(){return this.sl},set:function(a){var b=this.sl;b!==a&&(A(a,"boolean",Q,"hasVerticalScrollbar"),this.sl=a,nj(this),this.P(),this.g("hasVerticalScrollbar",b,a),kj(this,!1))}},hasHorizontalScrollbar:{configurable:!0,get:function(){return this.rl},set:function(a){var b=this.rl;
b!==a&&(A(a,"boolean",Q,"hasHorizontalScrollbar"),this.rl=a,nj(this),this.P(),this.g("hasHorizontalScrollbar",b,a),kj(this,!1))}},allowHorizontalScroll:{configurable:!0,get:function(){return this.qr},set:function(a){var b=this.qr;b!==a&&(A(a,"boolean",Q,"allowHorizontalScroll"),this.qr=a,this.g("allowHorizontalScroll",b,a),kj(this,!1))}},allowVerticalScroll:{configurable:!0,get:function(){return this.tr},set:function(a){var b=this.tr;b!==a&&(A(a,"boolean",Q,"allowVerticalScroll"),
this.tr=a,this.g("allowVerticalScroll",b,a),kj(this,!1))}},scrollHorizontalLineChange:{configurable:!0,get:function(){return this.Ws},set:function(a){var b=this.Ws;b!==a&&(A(a,"number",Q,"scrollHorizontalLineChange"),0>a&&ya(a,">= 0",Q,"scrollHorizontalLineChange"),this.Ws=a,this.g("scrollHorizontalLineChange",b,a))}},scrollVerticalLineChange:{configurable:!0,get:function(){return this.$s},set:function(a){var b=this.$s;b!==a&&(A(a,"number",Q,"scrollVerticalLineChange"),
0>a&&ya(a,">= 0",Q,"scrollVerticalLineChange"),this.$s=a,this.g("scrollVerticalLineChange",b,a))}},lastInput:{configurable:!0,get:function(){return this.mh},set:function(a){F&&x(a,we,Q,"lastInput");this.mh=a}},firstInput:{configurable:!0,get:function(){return this.bg},set:function(a){F&&x(a,we,Q,"firstInput");this.bg=a}},currentCursor:{configurable:!0,get:function(){return this.Gr},set:function(a){""===a&&(a=this.Nn);if(this.Gr!==a){A(a,"string",Q,"currentCursor");
var b=this.ya,c=this.Ka;if(null!==b){this.Gr=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.Nn},set:function(a){""===a&&(a="auto");var b=this.Nn;b!==a&&(A(a,"string",Q,"defaultCursor"),this.Nn=a,this.g("defaultCursor",
b,a))}},click:{configurable:!0,get:function(){return this.Vf},set:function(a){var b=this.Vf;b!==a&&(null!==a&&A(a,"function",Q,"click"),this.Vf=a,this.g("click",b,a))}},doubleClick:{configurable:!0,get:function(){return this.$f},set:function(a){var b=this.$f;b!==a&&(null!==a&&A(a,"function",Q,"doubleClick"),this.$f=a,this.g("doubleClick",b,a))}},contextClick:{configurable:!0,get:function(){return this.Wf},set:function(a){var b=this.Wf;b!==a&&(null!==a&&A(a,
"function",Q,"contextClick"),this.Wf=a,this.g("contextClick",b,a))}},mouseOver:{configurable:!0,get:function(){return this.sg},set:function(a){var b=this.sg;b!==a&&(null!==a&&A(a,"function",Q,"mouseOver"),this.sg=a,this.g("mouseOver",b,a))}},mouseHover:{configurable:!0,get:function(){return this.qg},set:function(a){var b=this.qg;b!==a&&(null!==a&&A(a,"function",Q,"mouseHover"),this.qg=a,this.g("mouseHover",b,a))}},mouseHold:{configurable:!0,get:function(){return this.pg},
set:function(a){var b=this.pg;b!==a&&(null!==a&&A(a,"function",Q,"mouseHold"),this.pg=a,this.g("mouseHold",b,a))}},mouseDragOver:{configurable:!0,get:function(){return this.As},set:function(a){var b=this.As;b!==a&&(null!==a&&A(a,"function",Q,"mouseDragOver"),this.As=a,this.g("mouseDragOver",b,a))}},mouseDrop:{configurable:!0,get:function(){return this.ng},set:function(a){var b=this.ng;b!==a&&(F&&null!==a&&A(a,"function",Q,"mouseDrop"),this.ng=a,this.g("mouseDrop",b,a))}},
handlesDragDropForTopLevelParts:{configurable:!0,get:function(){return this.$r},set:function(a){var b=this.$r;b!==a&&(A(a,"boolean",Q,"handlesDragDropForTopLevelParts"),this.$r=a,this.g("handlesDragDropForTopLevelParts",b,a))}},mouseEnter:{configurable:!0,get:function(){return this.og},set:function(a){var b=this.og;b!==a&&(null!==a&&A(a,"function",Q,"mouseEnter"),this.og=a,this.g("mouseEnter",b,a))}},mouseLeave:{configurable:!0,get:function(){return this.rg},
set:function(a){var b=this.rg;b!==a&&(null!==a&&A(a,"function",Q,"mouseLeave"),this.rg=a,this.g("mouseLeave",b,a))}},toolTip:{configurable:!0,get:function(){return this.Cg},set:function(a){var b=this.Cg;b!==a&&(!F||null===a||a instanceof Te||a instanceof bf||v("Diagram.toolTip must be an Adornment or HTMLInfo."),this.Cg=a,this.g("toolTip",b,a))}},contextMenu:{configurable:!0,get:function(){return this.Xf},set:function(a){var b=this.Xf;b!==a&&(!F||a instanceof Te||a instanceof
bf||v("Diagram.contextMenu must be an Adornment or HTMLInfo."),this.Xf=a,this.g("contextMenu",b,a))}},commandHandler:{configurable:!0,get:function(){return this.Ar},set:function(a){this.Ar!==a&&(this.Ar=a,a.he(this))}},toolManager:{configurable:!0,get:function(){return this.mt},set:function(a){this.mt!==a&&(x(a,Ua,Q,"toolManager"),this.mt=a,a.diagram=this)}},defaultTool:{configurable:!0,get:function(){return this.Lr},set:function(a){var b=this.Lr;b!==a&&(x(a,
Oe,Q,"defaultTool"),this.Lr=a,a.diagram=this,this.currentTool===b&&(this.currentTool=a))}},currentTool:{configurable:!0,get:function(){return this.Ir},set:function(a){var b=this.Ir;null!==b&&(b.isActive&&b.doDeactivate(),b.cancelWaitAfter(),b.doStop());null===a&&(a=this.defaultTool);null!==a&&(x(a,Oe,Q,"currentTool"),this.Ir=a,a.diagram=this,a.doStart())}},selection:{configurable:!0,get:function(){return this.lv}},maxSelectionCount:{configurable:!0,get:function(){return this.ws},
set:function(a){var b=this.ws;if(b!==a)if(A(a,"number",Q,"maxSelectionCount"),0<=a&&!isNaN(a)){if(this.ws=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",Q,"maxSelectionCount")}},nodeSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.ip},set:function(a){var b=
this.ip;b!==a&&(x(a,Te,Q,"nodeSelectionAdornmentTemplate"),this.ip=a,this.g("nodeSelectionAdornmentTemplate",b,a))}},groupSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.no},set:function(a){var b=this.no;b!==a&&(x(a,Te,Q,"groupSelectionAdornmentTemplate"),this.no=a,this.g("groupSelectionAdornmentTemplate",b,a))}},linkSelectionAdornmentTemplate:{configurable:!0,get:function(){return this.Ho},set:function(a){var b=this.Ho;b!==a&&(x(a,Te,Q,"linkSelectionAdornmentTemplate"),
this.Ho=a,this.g("linkSelectionAdornmentTemplate",b,a))}},highlighteds:{configurable:!0,get:function(){return this.Mu}},isModified:{configurable:!0,get:function(){var a=this.undoManager;return a.isEnabled?null!==a.currentTransaction?!0:this.so&&this.Pd!==a.historyIndex:this.so},set:function(a){if(this.so!==a){A(a,"boolean",Q,"isModified");this.so=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){x(a,V,Q,"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.dd(!0);var c=Yi(this,!0);this.ue=!1;this.Hj=!0;this.Pd=-2;this.Le=!1;var d=this.Ic;this.Ic=!0;Eh(this.animationManager,"Model");null!==b&&(null!==this.Be&&this.Be.each(function(a){b.Kk(a)}),b.Kk(this.Pc));this.gc=a;this.partManager=mk(this.gc.type);for(var e=
0;e<c.length;e++)this.add(c[e]);a.Lh(this.qd);this.partManager.addAllModeledParts();a.Kk(this.qd);a.Lh(this.Pc);null!==this.Be&&this.Be.each(function(b){a.Lh(b)});this.Ic=d;this.Xb||this.P();null!==b&&a.undoManager.copyProperties(b.undoManager)}}},ba:{configurable:!0,get:function(){return this.Wu},set:function(a){this.Wu=a}},St:{configurable:!0,get:function(){return this.vx}},skipsModelSourceBindings:{configurable:!0,get:function(){return this.mv},set:function(a){this.mv=
a}},iu:{configurable:!0,get:function(){return this.et},set:function(a){this.et=a}},nodeTemplate:{configurable:!0,get:function(){return this.kf.K("")},set:function(a){var b=this.kf.K("");b!==a&&(x(a,S,Q,"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&&(x(a,Db,Q,"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&&(x(a,Hf,Q,"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&&(x(a,Db,Q,"groupTemplateMap"),this.kh=a,this.g("groupTemplateMap",b,a),this.undoManager.isUndoingRedoing||
this.Fd())}},linkTemplate:{configurable:!0,get:function(){return this.ig.K("")},set:function(a){var b=this.ig.K("");b!==a&&(x(a,R,Q,"linkTemplate"),this.ig.add("",a),this.g("linkTemplate",b,a),this.undoManager.isUndoingRedoing||this.Fd())}},linkTemplateMap:{configurable:!0,get:function(){return this.ig},set:function(a){var b=this.ig;b!==a&&(x(a,Db,Q,"linkTemplateMap"),this.ig=a,this.g("linkTemplateMap",b,a),this.undoManager.isUndoingRedoing||this.Fd())}},isMouseCaptured:{configurable:!0,
enumerable:!0,get:function(){return this.Su},set:function(a){var b=this.ya;null!==b&&(b=b.Ja,b instanceof SVGElement||(a?(this.lastInput.bubbles=!1,this.ln?(this.removeEventListener(b,"pointermove",this.Jm,!1),this.removeEventListener(b,"pointerdown",this.Im,!1),this.removeEventListener(b,"pointerup",this.Lm,!1),this.removeEventListener(b,"pointerout",this.Km,!1),this.addEventListener(qa,"pointermove",this.Jm,!0),this.addEventListener(qa,"pointerdown",this.Im,!0),this.addEventListener(qa,"pointerup",
this.Lm,!0),this.addEventListener(qa,"pointerout",this.Km,!0)):(this.removeEventListener(b,"mousemove",this.Ek,!1),this.removeEventListener(b,"mousedown",this.Dk,!1),this.removeEventListener(b,"mouseup",this.Gk,!1),this.removeEventListener(b,"mouseout",this.Fk,!1),this.addEventListener(qa,"mousemove",this.Ek,!0),this.addEventListener(qa,"mousedown",this.Dk,!0),this.addEventListener(qa,"mouseup",this.Gk,!0),this.addEventListener(qa,"mouseout",this.Fk,!0)),this.removeEventListener(b,"wheel",this.Hk,
!1),this.addEventListener(qa,"wheel",this.Hk,!0),this.addEventListener(qa,"selectstart",this.preventDefault,!1)):(this.ln?(this.removeEventListener(qa,"pointermove",this.Jm,!0),this.removeEventListener(qa,"pointerdown",this.Im,!0),this.removeEventListener(qa,"pointerup",this.Lm,!0),this.removeEventListener(qa,"pointerout",this.Km,!0),this.addEventListener(b,"pointermove",this.Jm,!1),this.addEventListener(b,"pointerdown",this.Im,!1),this.addEventListener(b,"pointerup",this.Lm,!1),this.addEventListener(b,
"pointerout",this.Km,!1)):(this.removeEventListener(qa,"mousemove",this.Ek,!0),this.removeEventListener(qa,"mousedown",this.Dk,!0),this.removeEventListener(qa,"mouseup",this.Gk,!0),this.removeEventListener(qa,"mouseout",this.Fk,!0),this.addEventListener(b,"mousemove",this.Ek,!1),this.addEventListener(b,"mousedown",this.Dk,!1),this.addEventListener(b,"mouseup",this.Gk,!1),this.addEventListener(b,"mouseout",this.Fk,!1)),this.removeEventListener(qa,"wheel",this.Hk,!0),this.removeEventListener(qa,"selectstart",
this.preventDefault,!1),this.addEventListener(b,"wheel",this.Hk,!1)),this.Su=a))}},position:{configurable:!0,get:function(){return this.sa},set:function(a){var b=J.alloc().assign(this.sa);if(!b.A(a)){x(a,J,Q,"position");var c=this.viewportBounds.copy();this.sa.assign(a);fi(this.animationManager,b,this.sa);this.Xb||null===this.ya&&!this.nm.o()||(this.Xb=!0,a=this.scale,mj(this,this.Pn,this.Da/a,this.Ca/a,this.Aj,!1),this.Xb=!1);this.Xb||this.Uq(c,this.viewportBounds,this.Fa,!1)}J.free(b)}},
initialPosition:{configurable:!0,get:function(){return this.cs},set:function(a){this.cs.A(a)||(x(a,J,Q,"initialPosition"),this.cs=a.J())}},initialScale:{configurable:!0,get:function(){return this.ds},set:function(a){this.ds!==a&&(A(a,"number",Q,"initialScale"),this.ds=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);x(a,U,Q,"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.Mx,b=this.sa,c=this.Fa;if(null===this.ya)return this.nm.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.nm},set:function(a){var b=this.viewSize;b.A(a)||(x(a,Hb,Q,"viewSize"),this.nm=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.Xr},set:function(a){var b=this.Xr;b.A(a)||(x(a,L,Q,"fixedBounds"),(F&&Infinity===a.width||-Infinity===a.width||Infinity===a.height||-Infinity===a.height)&&v("fixedBounds width/height must not be Infinity"),this.Xr=a=a.J(),this.Ta(),this.g("fixedBounds",b,a))}},scrollMargin:{configurable:!0,get:function(){return this.Si},set:function(a){"number"===
typeof a?a=new lc(a):x(a,lc,Q,"scrollMargin");var b=this.Si;b.A(a)||(this.Si=a=a.J(),this.g("scrollMargin",b,a),this.ge())}},scrollMode:{configurable:!0,get:function(){return this.Ti},set:function(a){var b=this.Ti;b!==a&&(hb(a,Q,Q,"scrollMode"),this.Ti=a,a===mi&&kj(this,!1),this.g("scrollMode",b,a),this.P())}},scrollsPageOnFocus:{configurable:!0,get:function(){return this.at},set:function(a){var b=this.at;b!==a&&(A(a,"boolean",Q,"scrollsPageOnFocus"),this.at=a,this.g("scrollsPageOnFocus",
b,a))}},positionComputation:{configurable:!0,get:function(){return this.Os},set:function(a){var b=this.Os;b!==a&&(null!==a&&A(a,"function",Q,"positionComputation"),this.Os=a,kj(this,!1),this.g("positionComputation",b,a))}},scaleComputation:{configurable:!0,get:function(){return this.Us},set:function(a){var b=this.Us;b!==a&&(null!==a&&A(a,"function",Q,"scaleComputation"),this.Us=a,jk(this,this.scale,this.scale),this.g("scaleComputation",b,a))}},documentBounds:{configurable:!0,
enumerable:!0,get:function(){return this.Pn}},isVirtualized:{configurable:!0,get:function(){return this.ps},set:function(a){var b=this.ps;b!==a&&(A(a,"boolean",Q,"isVirtualized"),this.ps=a,this.g("isVirtualized",b,a))}},scale:{configurable:!0,get:function(){return this.Fa},set:function(a){var b=this.Fa;C(a,Q,"scale");b!==a&&jk(this,b,a)}},defaultScale:{configurable:!0,get:function(){return this.On},set:function(a){F&&C(a,Q,"defaultScale");!F||0<a||v("defaultScale must be larger than zero, not: "+
a);this.On=a}},autoScale:{configurable:!0,get:function(){return this.Ug},set:function(a){var b=this.Ug;b!==a&&(hb(a,Q,Q,"autoScale"),this.Ug=a,this.g("autoScale",b,a),a!==Wh&&kj(this,!1))}},initialAutoScale:{configurable:!0,get:function(){return this.eg},set:function(a){var b=this.eg;b!==a&&(hb(a,Q,Q,"initialAutoScale"),this.eg=a,this.g("initialAutoScale",b,a))}},initialViewportSpot:{configurable:!0,get:function(){return this.es},set:function(a){var b=this.es;
b!==a&&(x(a,M,Q,"initialViewportSpot"),a.bb()||v("initialViewportSpot must be a specific Spot: "+a),this.es=a,this.g("initialViewportSpot",b,a))}},initialDocumentSpot:{configurable:!0,get:function(){return this.bs},set:function(a){var b=this.bs;b!==a&&(x(a,M,Q,"initialDocumentSpot"),a.bb()||v("initialViewportSpot must be a specific Spot: "+a),this.bs=a,this.g("initialDocumentSpot",b,a))}},minScale:{configurable:!0,get:function(){return this.xs},set:function(a){C(a,Q,"minScale");
var b=this.xs;b!==a&&(0<a?(this.xs=a,this.g("minScale",b,a),a>this.scale&&(this.scale=a)):ya(a,"> 0",Q,"minScale"))}},maxScale:{configurable:!0,get:function(){return this.vs},set:function(a){C(a,Q,"maxScale");var b=this.vs;b!==a&&(0<a?(this.vs=a,this.g("maxScale",b,a),a<this.scale&&(this.scale=a)):ya(a,"> 0",Q,"maxScale"))}},zoomPoint:{configurable:!0,get:function(){return this.tt},set:function(a){this.tt.A(a)||(x(a,J,Q,"zoomPoint"),this.tt=a=a.J())}},contentAlignment:{configurable:!0,
enumerable:!0,get:function(){return this.Aj},set:function(a){var b=this.Aj;b.A(a)||(x(a,M,Q,"contentAlignment"),this.Aj=a=a.J(),this.g("contentAlignment",b,a),kj(this,!1))}},initialContentAlignment:{configurable:!0,get:function(){return this.po},set:function(a){var b=this.po;b.A(a)||(x(a,M,Q,"initialContentAlignment"),this.po=a=a.J(),this.g("initialContentAlignment",b,a))}},padding:{configurable:!0,get:function(){return this.lb},set:function(a){"number"===typeof a?a=new lc(a):
x(a,lc,Q,"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.Oa},set:function(a){var b=this.Oa;b!==a&&(x(a,Ii,Q,"partManager"),null!==a.diagram&&v("Cannot share PartManagers between Diagrams: "+a.toString()),null!==b&&b.he(null),this.Oa=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&&(x(a,Ni,Q,"layout"),this.oc=a,a.diagram=this,a.group=null,this.Tg=!0,this.g("layout",b,a),this.Vb())}},isTreePathToChildren:{configurable:!0,get:function(){return this.os},set:function(a){var b=this.os;if(b!==a&&(A(a,"boolean",Q,"isTreePathToChildren"),this.os=a,this.g("isTreePathToChildren",
b,a),!this.undoManager.isUndoingRedoing))for(a=this.nodes;a.next();)Tk(a.value)}},treeCollapsePolicy:{configurable:!0,get:function(){return this.ot},set:function(a){var b=this.ot;b!==a&&(a!==Gi&&a!==Uk&&a!==Vk&&v("Unknown Diagram.treeCollapsePolicy: "+a),this.ot=a,this.g("treeCollapsePolicy",b,a))}},Re:{configurable:!0,get:function(){return this.Pu},set:function(a){this.Pu=a}},autoScrollInterval:{configurable:!0,get:function(){return this.pn},set:function(a){var b=
this.pn;C(a,Q,"scale");b!==a&&(this.pn=a,this.g("autoScrollInterval",b,a))}},autoScrollRegion:{configurable:!0,get:function(){return this.rn},set:function(a){"number"===typeof a?a=new lc(a):x(a,lc,Q,"autoScrollRegion");var b=this.rn;b.A(a)||(this.rn=a=a.J(),this.Ta(),this.g("autoScrollRegion",b,a))}}});ma.Object.defineProperties(Q,{licenseKey:{configurable:!0,get:function(){return Wk.cc()},set:function(a){Wk.add(a)}},version:{configurable:!0,get:function(){return Xk}}});
Q.prototype.makeImageData=Q.prototype.uy;Q.prototype.makeImage=Q.prototype.BA;Q.prototype.addRenderer=Q.prototype.gz;Q.prototype.makeSVG=Q.prototype.fw;Q.prototype.makeSvg=Q.prototype.Ut;Q.prototype.stopAutoScroll=Q.prototype.Nf;Q.prototype.doAutoScroll=Q.prototype.At;Q.prototype.isUnoccupied=Q.prototype.Ak;Q.prototype.raiseDiagramEvent=Q.prototype.U;Q.prototype.removeDiagramListener=Q.prototype.Om;Q.prototype.addDiagramListener=Q.prototype.ik;Q.prototype.findTreeRoots=Q.prototype.$z;
Q.prototype.layoutDiagram=Q.prototype.zA;Q.prototype.findTopLevelGroups=Q.prototype.Tz;Q.prototype.findTopLevelNodesAndLinks=Q.prototype.Uz;Q.prototype.findLinksByExample=Q.prototype.Dt;Q.prototype.findNodesByExample=Q.prototype.Et;Q.prototype.findLinkForData=Q.prototype.Cc;Q.prototype.findNodeForData=Q.prototype.ej;Q.prototype.findPartForData=Q.prototype.Dc;Q.prototype.findLinkForKey=Q.prototype.findLinkForKey;Q.prototype.findNodeForKey=Q.prototype.Qb;Q.prototype.findPartForKey=Q.prototype.findPartForKey;
Q.prototype.rebuildParts=Q.prototype.Fd;Q.prototype.transformViewToDoc=Q.prototype.ju;Q.prototype.transformRectDocToView=Q.prototype.aB;Q.prototype.transformDocToView=Q.prototype.fr;Q.prototype.centerRect=Q.prototype.wt;Q.prototype.scrollToRect=Q.prototype.yw;Q.prototype.scroll=Q.prototype.scroll;Q.prototype.highlightCollection=Q.prototype.oA;Q.prototype.highlight=Q.prototype.nA;Q.prototype.selectCollection=Q.prototype.SA;Q.prototype.select=Q.prototype.select;
Q.prototype.updateAllRelationshipsFromData=Q.prototype.hr;Q.prototype.updateAllTargetBindings=Q.prototype.updateAllTargetBindings;Q.prototype.commit=Q.prototype.commit;Q.prototype.rollbackTransaction=Q.prototype.Mf;Q.prototype.commitTransaction=Q.prototype.ab;Q.prototype.startTransaction=Q.prototype.Ba;Q.prototype.raiseChanged=Q.prototype.g;Q.prototype.raiseChangedEvent=Q.prototype.gb;Q.prototype.removeChangedListener=Q.prototype.Kk;Q.prototype.addChangedListener=Q.prototype.Lh;
Q.prototype.removeModelChangedListener=Q.prototype.OA;Q.prototype.addModelChangedListener=Q.prototype.Rx;Q.prototype.findLayer=Q.prototype.ym;Q.prototype.removeLayer=Q.prototype.MA;Q.prototype.addLayerAfter=Q.prototype.cz;Q.prototype.addLayerBefore=Q.prototype.Px;Q.prototype.addLayer=Q.prototype.om;Q.prototype.moveParts=Q.prototype.moveParts;Q.prototype.copyParts=Q.prototype.rk;Q.prototype.removeParts=Q.prototype.cu;Q.prototype.remove=Q.prototype.remove;Q.prototype.add=Q.prototype.add;
Q.prototype.clearDelayedGeometries=Q.prototype.Bv;Q.prototype.setProperties=Q.prototype.Dw;Q.prototype.resetInputOptions=Q.prototype.vw;Q.prototype.setInputOption=Q.prototype.TA;Q.prototype.getInputOption=Q.prototype.Cm;Q.prototype.resetRenderingHints=Q.prototype.ww;Q.prototype.setRenderingHint=Q.prototype.Jy;Q.prototype.getRenderingHint=Q.prototype.Qe;Q.prototype.maybeUpdate=Q.prototype.cd;Q.prototype.requestUpdate=Q.prototype.Vb;Q.prototype.delayInitialization=Q.prototype.xz;
Q.prototype.isUpdateRequested=Q.prototype.uA;Q.prototype.redraw=Q.prototype.ge;Q.prototype.invalidateDocumentBounds=Q.prototype.Ta;Q.prototype.findObjectsNear=Q.prototype.Ig;Q.prototype.findPartsNear=Q.prototype.Qz;Q.prototype.findObjectsIn=Q.prototype.Ff;Q.prototype.findPartsIn=Q.prototype.ky;Q.prototype.findObjectsAt=Q.prototype.fj;Q.prototype.findPartsAt=Q.prototype.Pz;Q.prototype.findObjectAt=Q.prototype.$b;Q.prototype.findPartAt=Q.prototype.zm;Q.prototype.focusObject=Q.prototype.aA;
Q.prototype.alignDocument=Q.prototype.iz;Q.prototype.zoomToRect=Q.prototype.dB;Q.prototype.zoomToFit=Q.prototype.zoomToFit;Q.prototype.diagramScroll=Q.prototype.Zx;Q.prototype.focus=Q.prototype.focus;Q.prototype.reset=Q.prototype.reset;Q.useDOM=function(a){gh=a?void 0!==qa.document:!1};Q.isUsingDOM=function(){return gh};
var Pe=null,Hi=new Db,bj=null,aj=null,gh=void 0!==qa.document,Qi=null,Ri="",Wh=new E(Q,"None",0),pj=new E(Q,"Uniform",1),qj=new E(Q,"UniformToFill",2),$f=new E(Q,"CycleAll",10),dg=new E(Q,"CycleNotDirected",11),fg=new E(Q,"CycleNotDirectedFast",12),gg=new E(Q,"CycleNotUndirected",13),ag=new E(Q,"CycleDestinationTree",14),cg=new E(Q,"CycleSourceTree",15),mi=new E(Q,"DocumentScroll",1),oi=new E(Q,"InfiniteScroll",2),Gi=new E(Q,"TreeParentCollapsed",21),Uk=new E(Q,"AllParentsCollapsed",22),Vk=new E(Q,
"AnyParentsCollapsed",23),Wk=new H,Xk="2.1.24",Sk=!1,Yk=null,Di=!1;
function Ei(){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);Yk=a}}Q.className="Diagram";
Q.fromDiv=function(a){var b=a;"string"===typeof a&&(b=qa.document.getElementById(a));return b instanceof HTMLDivElement&&b.B instanceof Q?b.B:null};Q.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",Q,"inherit");A(b,"function",Q,"inherit");c.prototype=b.prototype;a.prototype=new c;a.prototype.constructor=a};Q.None=Wh;Q.Uniform=pj;Q.UniformToFill=qj;Q.CycleAll=$f;Q.CycleNotDirected=dg;
Q.CycleNotDirectedFast=fg;Q.CycleNotUndirected=gg;Q.CycleDestinationTree=ag;Q.CycleSourceTree=cg;Q.DocumentScroll=mi;Q.InfiniteScroll=oi;Q.TreeParentCollapsed=Gi;Q.AllParentsCollapsed=Uk;Q.AnyParentsCollapsed=Vk;function Oi(){this.Zy=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=Q[Ya("76a115b6ed251eaf4692")];if(d)for(var e=Wk.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.Zy?!0:!1}
function Pi(a,b){if(gh){void 0!==b&&null!==b||v("Diagram setup requires an argument DIV.");null!==a.Ka&&v("Diagram has already completed setup.");"string"===typeof b?a.Ka=qa.document.getElementById(b):b instanceof HTMLDivElement?a.Ka=b:v("No DIV or DIV id supplied: "+b);null===a.Ka&&v("Invalid DIV id; could not get element with id: "+b);void 0!==a.Ka.B&&v("Invalid div id; div already has a Diagram associated with it.");"static"===qa.getComputedStyle(a.Ka,null).position&&(a.Ka.style.position="relative");
a.Ka.style["-webkit-tap-highlight-color"]="rgba(255, 255, 255, 0)";a.Ka.style["-ms-touch-action"]="none";a.Ka.innerHTML="";a.Ka.B=a;a.Ka.goDiagram=a;a.Ka.go=qa.go;var c=a.gq?new Rj(a):new Rk(a);void 0!==c.style&&(c.style.position="absolute",c.style.top="0px",c.style.left="0px","rtl"===qa.getComputedStyle(a.Ka,null).getPropertyValue("direction")&&(a.Cl=!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.Ka.clientWidth||1;a.Ca=a.Ka.clientHeight||1;Tj(a,a.Da,a.Ca);a.Sr=b.aa[Ya("7eba17a4ca3b1a8346")][Ya("78a118b7")](b.aa,Yk,4,4);a.Ka.insertBefore(c.Ja,a.Ka.firstChild);c=new Rk(null);c.width=1;c.height=1;a.Eu=c;a.nx=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.Ka.appendChild(c);c.appendChild(d);c.onscroll=
ej;c.addEventListener("mousedown",gj);c.addEventListener("touchstart",gj,{passive:!0});c.B=a;c.Xy=!0;c.Yy=!0;a.Ys=c;a.Np=d}a.au=sa(function(){a.Ch=null;a.P()},300);a.Qw=sa(function(){Xh(a)},250);a.preventDefault=function(a){a.preventDefault();return!1};a.Ek=function(b){if(a.isEnabled){a.fg=!0;var c=uj(a,b,!0);a.doMouseMove();a.currentTool.isBeyondDragSize()&&(a.vd=0);Aj(a,c,b)}};a.Dk=function(b){if(a.isEnabled)if(a.fg=!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.Pj<a.nt&&!a.currentTool.isBeyondDragSize()?a.vd++:a.vd=1,a.Pj=b.timeStamp,c.clickCount=a.vd;c.clone(a.firstInput);a.doMouseDown();1===b.button?b.preventDefault():Aj(a,c,b)}};a.Gk=function(b){if(a.isEnabled)if(a.ve&&2===b.button)b.preventDefault();else if(a.ve&&0===b.button&&(a.ve=!1),a.dk)b.preventDefault();else{a.fg=!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.Hk=
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.Fk=function(b){a.isEnabled&&
(a.fg=!1,uj(a,b,!0),b=a.currentTool,b.cancelWaitAfter(),b.standardMouseOver())};a.Kw=function(b){if(a.isEnabled){a.dk=!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.Co;b.timeStamp-a.Pj<a.nt&&!(25<Math.abs(k.x-e)||25<Math.abs(k.y-d))?a.vd++:a.vd=1;c.clickCount=a.vd;a.Pj=b.timeStamp;a.Co.h(e,d)}a.doMouseDown();Aj(a,c,b)}};a.Jw=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.Iw=function(b){if(a.isEnabled)if(a.dk)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 Q&&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.Im=function(b){if(a.isEnabled){a.fg=!0;var c=a.Ms;void 0===c[b.pointerId]&&(c[b.pointerId]=b);c=a.Zj;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.dk=!1,a.ve=!0;c=xj(a,b,b,d);d=a.Co;var e="touch"===b.pointerType||"pen"===b.pointerType?25:10;b.timeStamp-a.Pj<a.nt&&!(Math.abs(d.x-b.screenX)>e||Math.abs(d.y-b.screenY)>e)?a.vd++:a.vd=1;c.clickCount=a.vd;a.Pj=b.timeStamp;a.Co.Ng(b.screenX,b.screenY);a.doMouseDown();1===b.button?b.preventDefault():Aj(a,c,b)}};a.Jm=function(b){if(a.isEnabled){a.fg=!0;var c=a.Zj;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.Lm=function(b){if(a.isEnabled){a.fg=!0;var c="touch"===b.pointerType||"pen"===b.pointerType,d=a.Ms;if(c&&a.dk)delete d[b.pointerId],b.preventDefault();else if(d=a.Zj,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 Q&&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.Km=function(b){if(a.isEnabled){a.fg=!1;var c=a.Ms;c[b.pointerId]&&delete c[b.pointerId];c=a.Zj;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.Yv=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 Zk(a){1<arguments.length&&v("Palette constructor can only take one optional argument, the DIV HTML element or its id.");Q.call(this,a);$k(this)}la(Zk,Q);
function $k(a){a.allowDragOut=!0;a.allowMove=!1;a.isReadOnly=!0;a.contentAlignment=Ic;a.layout=new al}Zk.prototype.reset=function(){Q.prototype.reset.call(this);$k(this)};Zk.className="Palette";
function bl(a){1<arguments.length&&v("Overview constructor can only take one optional argument, the DIV HTML element or its id.");Q.call(this,a);var b=this;this.animationManager.isEnabled=!1;this.Xb=!0;this.Na=null;this.sl=this.rl=!1;this.w=this.L=!0;this.ib=0;this.$=!1;this.am=null;this.Jy("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.cb("Dragging",new cl,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();dl(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;el(b);b.P()},b.updateDelay))};this.Qc=function(){null!==b.observed&&dl(b)};this.autoScale=pj;this.Xb=!1}la(bl,Q);bl.prototype.computePixelRatio=function(){return 1};
bl.prototype.hc=function(){null===this.Ka&&v("No div specified");null===this.ya&&v("No canvas specified");if(!(this.ya instanceof Rj)&&(xi(this.box),this.Hc)){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?fl(this):null!==this.am&&(a.drawImage(this.am.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.Pa.j;for(var c=b.length,d=0;d<c;d++)b[d].hc(a,this);this.Hc=this.yi=!1}}};function el(a){var b=a.ya,c=a.Kb;if(null!==b&&null!==c){Kj(a);if(null===a.am){var d=new Rk(null);d.width=b.width;d.height=b.height;a.am=d}try{a.ya=a.am,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),fl(a)}finally{a.ya=b,a.Kb=c}}}
function fl(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).Oc(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.Pa.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=zi(h,e),l.hc(e,k),e.globalAlpha=h);else{for(var m=zi(h,e),n=k.scale,p=L.alloc(),r=h.Ha.j,q=r.length,u=0;u<q;u++){var w=r[u];(d||w!==l)&&h.bj(e,w,k,null,n,p)}L.free(p);e.globalAlpha=m}}}}}
function dl(a){var b=a.box;if(null!==b){var c=a.observed;if(null!==c){a.Hc=!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}}}bl.prototype.computeBounds=function(){var a=this.observed;if(null===a)return vc;var b=a.documentBounds.copy();b.Oc(a.viewportBounds);return b};bl.prototype.sy=function(){!0!==this.Hc&&(this.Hc=!0,this.Vb())};
bl.prototype.Uq=function(a,b,c,d){this.Xb||(hj(this),this.P(),nj(this),this.Ta(),dl(this),this.$d.scale=c,this.$d.position.x=a.x,this.$d.position.y=a.y,this.$d.bounds.assign(a),this.$d.ew=d,this.U("ViewportBoundsChanged",this.$d,a))};
ma.Object.defineProperties(bl.prototype,{observed:{configurable:!0,get:function(){return this.Na},set:function(a){var b=this.Na;null!==a&&x(a,Q,bl,"observed");a instanceof bl&&v("Overview.observed Diagram may not be an Overview itself: "+a);if(b!==a){null!==b&&(this.remove(this.box),b.Om("ViewportBoundsChanged",this.Zh),b.Om("DocumentBoundsChanged",this.Pf),b.Om("InvalidateDraw",this.Yh),b.Om("AnimationFinished",this.Qc));this.Na=a;null!==a&&(a.ik("ViewportBoundsChanged",this.Zh),a.ik("DocumentBoundsChanged",
this.Pf),a.ik("InvalidateDraw",this.Yh),a.ik("AnimationFinished",this.Qc),this.add(this.box),dl(this));this.Ta();if(null===a){this.am=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 el(this),dl(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),dl(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)}}});bl.className="Overview";function cl(){df.call(this);this.l=null}la(cl,df);
cl.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};
cl.prototype.doActivate=function(){this.l=null;df.prototype.doActivate.call(this)};cl.prototype.doUpdateCursor=function(){var a=this.diagram,b=a.box;null!==b&&b.cursor&&(a.currentCursor=b.cursor)};cl.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)}}};cl.className="OverviewDraggingTool";
function gl(){0<arguments.length&&za(gl);fb(this);this.B=Pe;this.ib=this.L=this.w=!0;this.$=this.Na=this.qd=this.Oa=!1;this.Ji=this.l=null;this.Qc=1.05;this.Xu=NaN;this.tx=null;this.wv=NaN;this.vv=vc;this.xg=null;this.Pc=200}gl.prototype.toString=function(){return"CommandHandler"};gl.prototype.he=function(a){this.B=a};
gl.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()};
gl.prototype.doKeyUp=function(){this.diagram.lastInput.bubbles=!0};gl.prototype.stopCommand=function(){var a=this.diagram,b=a.currentTool;b instanceof Ua&&a.allowSelect&&a.clearSelection();null!==b&&b.doCancel()};gl.prototype.canStopCommand=function(){return!0};
gl.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=""}};gl.prototype.canSelectAll=function(){return this.diagram.allowSelect};
gl.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();)hl(b,c.value,!0,this.deletesTree?Infinity:0,this.deletesConnectedLinks?null:!1,function(a){return a.canDelete()});a.cu(b,!0);a.U("SelectionDeleted",b)}finally{a.ab("Delete"),a.U("ChangedSelection",a.selection),a.currentCursor=""}};
gl.prototype.canDeleteSelection=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly||!a.allowDelete||0===a.selection.count?!1:!0};gl.prototype.copySelection=function(){var a=this.diagram,b=new I;for(a=a.selection.iterator;a.next();)hl(b,a.value,!0,this.copiesTree?Infinity:0,this.copiesConnectedLinks,function(a){return a.canCopy()});this.copyToClipboard(b)};gl.prototype.canCopySelection=function(){var a=this.diagram;return a.allowCopy&&a.allowClipboard&&0!==a.selection.count?!0:!1};
gl.prototype.cutSelection=function(){this.copySelection();this.deleteSelection()};gl.prototype.canCutSelection=function(){var a=this.diagram;return!a.isReadOnly&&!a.isModelReadOnly&&a.allowCopy&&a.allowDelete&&a.allowClipboard&&0!==a.selection.count?!0:!1};
gl.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.Fm()&&(d=c.qk,c.qk=this.copiesParentKey),c.yk()&&(e=c.pk,c.pk=this.copiesGroupKey),f=b.rk(a,null,!0)}finally{c.Fm()&&(c.qk=d),c.yk()&&(c.pk=e),c=new H,c.addAll(f),Qi=c,Ri=b.model.dataFormat}}b.U("ClipboardChanged",c)};
gl.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.Fm()&&(e=d.qk,d.qk=this.copiesParentKey),d.yk()&&(f=d.pk,d.pk=this.copiesGroupKey),g=c.rk(b,c,!1)}finally{for(d.Fm()&&(d.qk=e),d.yk()&&(d.pk=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};
gl.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.el);Ef(b,f,new J(a.x-e.centerX,a.y-e.centerY),b.el,!1)}}b.U("ClipboardPasted",c)}finally{b.ab("Paste"),b.U("ChangedSelection",
b.selection),b.currentCursor=""}};gl.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};gl.prototype.undo=function(){this.diagram.undoManager.undo()};gl.prototype.canUndo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canUndo()};gl.prototype.redo=function(){this.diagram.undoManager.redo()};
gl.prototype.canRedo=function(){var a=this.diagram;return a.isReadOnly||a.isModelReadOnly?!1:a.allowUndo&&a.undoManager.canRedo()};gl.prototype.decreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);C(a,gl,"decreaseZoom:factor");var b=this.diagram;b.autoScale===Wh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};
gl.prototype.canDecreaseZoom=function(a){void 0===a&&(a=1/this.zoomFactor);C(a,gl,"canDecreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Wh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};gl.prototype.increaseZoom=function(a){void 0===a&&(a=this.zoomFactor);C(a,gl,"increaseZoom:factor");var b=this.diagram;b.autoScale===Wh&&(a=b.scale*a,a<b.minScale||a>b.maxScale||(b.scale=a))};
gl.prototype.canIncreaseZoom=function(a){void 0===a&&(a=this.zoomFactor);C(a,gl,"canIncreaseZoom:factor");var b=this.diagram;if(b.autoScale!==Wh)return!1;a=b.scale*a;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};gl.prototype.resetZoom=function(a){void 0===a&&(a=this.defaultScale);C(a,gl,"resetZoom:newscale");var b=this.diagram;a<b.minScale||a>b.maxScale||(b.scale=a)};
gl.prototype.canResetZoom=function(a){void 0===a&&(a=this.defaultScale);C(a,gl,"canResetZoom:newscale");var b=this.diagram;return a<b.minScale||a>b.maxScale?!1:b.allowZoom};
gl.prototype.zoomToFit=function(){var a=this.diagram,b=a.animationManager;b.dd();a.ge();var c=a.position,d=a.scale;Eh(b,"Zoom To Fit");d===this.wv&&!isNaN(this.Xu)&&a.documentBounds.A(this.vv)?(a.scale=this.Xu,a.position=this.tx,this.wv=NaN,this.vv=vc):(this.Xu=d,this.tx=c.copy(),a.zoomToFit(),this.wv=a.scale,this.vv=a.documentBounds.copy());Gh(b)};gl.prototype.canZoomToFit=function(){return this.diagram.allowZoom};
gl.prototype.scrollToPart=function(a){void 0===a&&(a=null);null!==a&&x(a,S,gl,"part");var b=this.diagram;Zi(b);if(null===a){try{null!==this.xg&&(this.xg.next()?a=this.xg.value:this.xg=null)}catch(k){this.xg=null}null===a&&(0<b.highlighteds.count?this.xg=b.highlighteds.iterator:0<b.selection.count&&(this.xg=b.selection.iterator),null!==this.xg&&this.xg.next()&&(a=this.xg.value))}if(null!==a){var c=b.animationManager;Eh(c,"Scroll To Part");var d=this.scrollToPartPause;if(0<d){var e=il(this,a,[a]);if(1===
e.length)b.Ba(),b.wt(a.actualBounds),b.ab("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.yw(a.actualBounds),a instanceof T&&!a.isTreeExpanded&&(a.isTreeExpanded=!0),a instanceof Hf&&!a.isSubGraphExpanded&&(a.isSubGraphExpanded=!0)):(a instanceof S&&b.wt(a.actualBounds),b.Om("LayoutCompleted",g));b.ab("Scroll To Part")},g=function(){ta(f,(c.isEnabled?c.duration:
0)+d)};b.ik("LayoutCompleted",g);f()}}else{var h=b.position.copy();b.wt(a.actualBounds);h.Sa(b.position)&&c.dd()}}};
function il(a,b,c){if(b.isVisible())return c;if(b instanceof Te)il(a,b.adornedPart,c);else if(b instanceof R){var d=b.fromNode;null!==d&&il(a,d,c);b=b.toNode;null!==b&&il(a,b,c)}else b instanceof T&&(d=b.labeledLink,null!==d&&il(a,d,c),d=b.Jg(),null!==d&&(d.isTreeExpanded||d.wasTreeExpanded||c.push(d),il(a,d,c))),b=b.containingGroup,null!==b&&(b.isSubGraphExpanded||b.wasSubGraphExpanded||c.push(b),il(a,b,c));return c}
gl.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};
gl.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.ab("Collapse Tree")}};
gl.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.Fq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&b.isTreeExpanded&&0<b.Fq().count)return!0;return!1};
gl.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.ab("Expand Tree")}};
gl.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.Fq().count)return!0}else for(a=b.selection.iterator;a.next();)if(b=a.value,b instanceof T&&!b.isTreeExpanded&&0<b.Fq().count)return!0;return!1};
gl.prototype.groupSelection=function(){var a=this.diagram,b=a.model;if(b.oj()){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.Ot(c)){var r=b.copyNodeData(c);Fa(r)&&(b.Bf(r),d=a.ej(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.ab("Group"),a.U("ChangedSelection",
a.selection),a.currentCursor=""}}}};gl.prototype.canGroupSelection=function(){var a=this.diagram;if(a.isReadOnly||a.isModelReadOnly||!a.allowInsert||!a.allowGroup||!a.model.oj()||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 jl(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}
gl.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};
gl.prototype.ungroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram,c=b.model;if(c.oj())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.fu(r,m):p.containingGroup=l}}b.remove(k)}}b.U("SelectionUngrouped",d,g)}finally{b.ab("Ungroup"),b.U("ChangedSelection",b.selection),b.currentCursor=""}};
gl.prototype.canUngroupSelection=function(a){void 0===a&&(a=null);var b=this.diagram;if(b.isReadOnly||b.isModelReadOnly||!b.allowDelete||!b.allowUngroup||!b.model.oj())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};
gl.prototype.addTopLevelParts=function(a,b){var c=!0;for(a=jl(a).iterator;a.next();){var d=a.value;null!==d.containingGroup&&(!b||this.isValidMember(null,d)?d.containingGroup=null:c=!1)}return c};
gl.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.ab("Collapse SubGraph")}};
gl.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};
gl.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.ab("Expand SubGraph")}};
gl.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};
gl.prototype.editTextBlock=function(a){void 0===a&&(a=null);null!==a&&x(a,ih,gl,"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.xm(function(a){return a instanceof ih&&a.editable})}null!==a&&(b.currentTool=null,c.textBlock=a,b.currentTool=c)}};
gl.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.xm(function(a){return a instanceof ih&&a.editable}),null!==a))return!0;return!1};
gl.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.fr(e),d.documentPoint=e,d.left=!1,d.right=!0,d.up=!0);b.currentTool=c;eh(c,!1,a)}};
gl.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};
gl.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.el);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(gl.prototype,{diagram:{configurable:!0,get:function(){return this.B}},copiesClipboardData:{configurable:!0,get:function(){return this.w},set:function(a){A(a,"boolean",gl,"copiesClipboardData");this.w=a}},copiesConnectedLinks:{configurable:!0,get:function(){return this.L},set:function(a){A(a,"boolean",gl,"copiesConnectedLinks");this.L=a}},deletesConnectedLinks:{configurable:!0,get:function(){return this.ib},set:function(a){A(a,
"boolean",gl,"deletesConnectedLinks");this.ib=a}},copiesTree:{configurable:!0,get:function(){return this.Oa},set:function(a){A(a,"boolean",gl,"copiesTree");this.Oa=a}},deletesTree:{configurable:!0,get:function(){return this.qd},set:function(a){A(a,"boolean",gl,"deletesTree");this.qd=a}},copiesParentKey:{configurable:!0,get:function(){return this.Na},set:function(a){A(a,"boolean",gl,"copiesParentKey");this.Na=a}},copiesGroupKey:{configurable:!0,
get:function(){return this.$},set:function(a){A(a,"boolean",gl,"copiesGroupKey");this.$=a}},archetypeGroupData:{configurable:!0,get:function(){return this.l},set:function(a){null!==a&&A(a,"object",gl,"archetypeGroupData");var b=this.diagram;F&&(b=b.model,!b.oj()||a instanceof Hf||b.Ot(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",gl,"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.Qc},set:function(a){C(a,gl,"zoomFactor");1<a||v("zoomFactor must be larger than 1.0, not: "+a);this.Qc=a}},scrollToPartPause:{configurable:!0,get:function(){return this.Pc},set:function(a){C(a,gl,"scrollToPartPause");
this.Pc=a}}});gl.className="CommandHandler";Ki=function(){return new gl};
function N(){fb(this);this.I=4225027;this.wb=1;this.vg=null;this.Wa="";this.jc=this.ob=null;this.sa=(new J(NaN,NaN)).freeze();this.Tc=cc;this.mg=Wb;this.lg=bc;this.sb=new Ib;this.ai=new Ib;this.jg=new Ib;this.Fa=this.kl=1;this.dc=0;this.Je=kl;this.oh=Ec;this.tc=(new L(NaN,NaN,NaN,NaN)).freeze();this.Ab=(new L(NaN,NaN,NaN,NaN)).freeze();this.uc=(new L(0,0,NaN,NaN)).freeze();this.S=this.vp=this.wp=null;this.Uk=this.Bb=ld;this.Hp=0;this.Ip=1;this.Xg=0;this.xn=1;this.aq=null;this.Op=-Infinity;this.Wl=
0;this.Xl=Rb;this.Yl=og;this.ri="";this.jb=this.R=null;this.Yk=-1;this.$l=this.sd=this.pi=this.dm=null;this.Ps=Mg;this.Kp=this.Sg=this.Yj=null}var Hd,Mg,Og,kl,ll,ml,nl,ol,pl,ql;
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.Sg=this.Sg;a.sa.assign(this.sa);a.Tc=this.Tc.J();a.mg=this.mg.J();a.lg=this.lg.J();a.jg=this.jg.copy();a.Fa=this.Fa;a.dc=this.dc;a.Je=this.Je;a.oh=this.oh.J();a.tc.assign(this.tc);a.Ab.assign(this.Ab);a.uc.assign(this.uc);a.vp=this.vp;null!==this.S&&(a.S=this.S.copy());a.Bb=this.Bb.J();a.Uk=this.Uk.J();a.Hp=this.Hp;a.Ip=this.Ip;a.Xg=this.Xg;a.xn=this.xn;a.aq=this.aq;a.Op=this.Op;a.Wl=this.Wl;
a.Xl=this.Xl.J();a.Yl=this.Yl;a.ri=this.ri;null!==this.R&&(a.R=this.R.copy());a.jb=this.jb;a.Yk=this.Yk;null!==this.pi&&(a.pi=Ia(this.pi));null!==this.sd&&(a.sd=this.sd.copy());a.$l=this.$l};N.prototype.Ox=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.wp=null;a.Yj=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)+"#"+sb(this)};
function rl(a){null===a.R&&(a.R=new sl)}t.Lc=function(){if(null===this.S){var a=new tl;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.Jk(a,b,c,d,e,f,g),c===this&&a===He&&ul(this)&&vl(this,h,b),f=this.diagram,null===this.Sg||null===f||!f.zk||f.undoManager.isUndoingRedoing||f.currentTool!==f.toolManager||f.animationManager.sn||(a=this.Sg.get(b),null!==a&&f.animationManager.isEnabled&&!f.animationManager.isTicking&&(null===this.Kp&&(this.Kp=new Db),g=0===f.undoManager.transactionLevel,a.startCondition===ti?g=!0:a.startCondition===vi&&(g=!1),g?(f=new Dh,ui(a,f),g=this.Kp.get(a),
null!==g&&g.stop(),this.Kp.add(a,f),f.sv=this,f.Jx=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 vl(a,b,c){var d=a.gj();if(null!==d)for(var e=a.jb.iterator;e.next();){var f=e.value,g=null;if(null!==f.sourceName){g=wl(f,d,a);if(null===g)continue;f.ir(a,g,c,null)}else if(f.isToModel){var h=b.diagram;null===h||h.skipsModelSourceBindings||f.ir(a,h.model.modelData,c,d)}else{h=d.data;if(null===h)continue;var k=b.diagram;null===k||k.skipsModelSourceBindings||f.ir(a,h,c,d)}g===a&&(h=d.Ct(f.vj),null!==h&&f.Ow(h,g,c))}}t.Ct=function(a){return this.Yk===a?this:null};
t.g=function(a,b,c){this.gb(He,a,this,b,c)};function xl(a,b,c,d,e){var f=a.tc,g=a.jg;g.reset();yl(a,g,b,c,d,e);a.jg=g;f.h(b,c,d,e);g.Pt()||g.Lw(f)}function zl(a,b,c,d){if(!1===a.pickable)return!1;d.multiply(a.transform);return c?a.Nc(b,d):a.Oh(b,d)}
t.jy=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&&x(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.Cm("extraTouchThreshold"),f=d.Cm("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.uc.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&&x(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&&x(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.Nc=function(a,b){F&&x(a,L,N,"intersectsRect:r");if(void 0===b&&(b=this.transform,0===this.angle))return a.Nc(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.Lt(a,d,e)||K.Lt(a,e,f)||K.Lt(a,f,g)||K.Lt(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.Bm=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.jj=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.kl;var a=this.Fa;return null!==this.panel?a*this.panel.Gf():a};t.It=function(a,b){void 0===b&&(b=new J);b.assign(a);this.Cd.de(b);return b};t.ad=function(a,b,c){return this.wk(a.x,a.y,b.x,b.y,c)};
t.wk=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.ad(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.ad(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(Al(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 ll:isFinite(a)&&a>c&&(e=a);g=0;h&&(b=Infinity);break;case ml: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.tc.ka();this.Hm(a,b,c,d);this.tc.freeze();this.tc.o()||v("Non-real measuredBounds has been set. Object "+this+", measuredBounds: "+this.tc.toString());Cj(this,!1)}};N.prototype.Hm=function(){};N.prototype.Jf=function(){return!1};
N.prototype.arrange=function(a,b,c,d,e){this.Bl();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.uc,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.us>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.Yt(f,this.Ab);Bl(this,!1);L.free(f)};t=N.prototype;t.Nh=function(){};
function Cl(a,b,c,d,e){a.Ab.h(b,c,d,e);if(!a.desiredSize.o()){var f=a.tc;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=Al(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 ll:Cj(a,!0);a.measure(d,f,0,0);break;case ml:Cj(a,!0),a.measure(c,e,0,0)}}}
t.Yt=function(a,b){var c=this.part;null!==c&&null!==c.diagram&&(c.selectionObject!==this&&c.resizeObject!==this&&c.rotateObject!==this||Dl(c,!0),this.P(),jc(a,b)||(c.Rh(),this.kp(c)))};t.kp=function(a){null!==this.portId&&(Dl(a,!0),a instanceof T&&El(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.ay(a,b))if(c)Fl(this,a,b);else{this instanceof R&&this.Ck(!1);F&&F.rm&&F.Ez&&F.Ez(a,this);c=this.transform;var g=this.panel;0!==(this.I&4096)===!0&&Gl(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,w=m.m22,y=m.dy,z,B=z=0;m=z*p+B*r+q;var D=z*u+B*w+y;z=n.width+l;B=0;var G=z*p+B*r+q;z=z*u+B*w+y;B=Math.min(m,G);var O=Math.min(D,z);var X=Math.max(m+0,G)-B;var P=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*w+y;B=Math.min(m,G);O=Math.min(D,z);X=Math.max(m+X,G)-B;P=Math.max(D+P,z)-O;m=B;D=O;z=0;B=n.height+l;G=z*p+B*r+q;z=z*u+B*w+y;
B=Math.min(m,G);O=Math.min(D,z);X=Math.max(m+X,G)-B;P=Math.max(D+P,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>P+D)}if(m){m=0!==(this.I&256);a.clipInsteadOfFill&&(m=!1);this instanceof ih&&(a.font=this.font);if(m){F&&F.Gz&&Ca("clip"+this.toString());D=g.je()?g.naturalBounds:g.actualBounds;null!==this.sd?(n=this.sd,X=n.x,P=n.y,l=n.width,n=n.height):(X=Math.max(d.x,D.x),P=Math.max(d.y,D.y),l=Math.min(d.right,D.right)-X,n=Math.min(d.bottom,D.bottom)-P);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,P,l,n);a.clip()}if(this.Jf()){if(!h.isVisible()){1!==e&&(a.globalAlpha=f);return}k&&(D=h.shadowOffset,a.Ew(D.x*b.scale*b.Yb,D.y*b.scale*b.Yb,h.shadowBlur),Hl(a),a.shadowColor=h.shadowColor)}!0===this.shadowVisible?Hl(a):!1===this.shadowVisible&&Il(a);h=this.naturalBounds;null!==this.jc&&(Ai(this,a,this.jc,!0,!0,h,d),this.jc instanceof Jl&&this.jc.type===Kl?(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&&Il(a);null!==this.ob&&(l=this.naturalBounds,X=D=0,P=l.width,l=l.height,n=0,this instanceof Yf&&(l=this.qa.bounds,D=l.x,X=l.y,P=l.width,l=l.height,n=this.strokeWidth),Ai(this,a,this.ob,!0,!1,h,d),this.ob instanceof Jl&&this.ob.type===Kl?(a.beginPath(),a.rect(D-n/2,X-n/2,P+n,l+n),a.ce(this.ob)):a.fillRect(D-
n/2,X-n/2,P+n,l+n));F&&F.rm&&F.Fz&&F.Fz(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)?(Ll(this,!0),null===this.shadowVisible&&Il(a)):Ll(this,!1);this.cj(a,b);k&&0!==(this.I&512)===!0&&Hl(a);this.Jf()&&k&&Il(a);m?(a.restore(),this instanceof U?a.yc(!0):a.yc(!1)):c.Pt()||(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.ay=function(){return!1};function Fl(a,b,c){var d=a.Ab,e=a.uc;null!==a.jc&&(Ai(a,b,a.jc,!0,!0,e,d),a.jc instanceof Jl&&a.jc.type===Kl?(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&&(Ai(a,b,a.ob,!0,!1,e,d),a.ob instanceof Jl&&a.ob.type===Kl?(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.cj(b,c)}t.cj=function(){};
function Ai(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===Ml)d?b.fillStyle=c.color:b.strokeStyle=c.color;else{var l=0;a instanceof Yf&&(l=a.strokeWidth);h=f.width;k=f.height;e?(h=g.width,k=g.height):d||(h+=l,k+=l);if((f=b instanceof Nl)&&c.oe&&(c.type===Ol||c.al===h&&c.vu===k))var m=c.oe;else{var n=0,p=0,r=0,q=0,u=0,w=0;w=u=0;e?(u=g.x,w=g.y):d||(u-=l/2,w-=l/2);n=c.start.x*h+c.start.offsetX;p=c.start.y*k+c.start.offsetY;r=c.end.x*h+
c.end.offsetX;q=c.end.y*k+c.end.offsetY;n+=u;r+=u;p+=w;q+=w;if(c.type===Pl)m=b.createLinearGradient(n,p,r,q);else if(c.type===Kl)w=isNaN(c.endRadius)?Math.max(h,k)/2:c.endRadius,isNaN(c.startRadius)?(u=0,w=Math.max(h,k)/2):u=c.startRadius,m=b.createRadialGradient(n,p,u,r,q,w);else if(c.type===Ol)try{m=b.createPattern(c.pattern,"repeat")}catch(z){m=null}else xa(c.type,"Brush type");if(c.type!==Ol&&(e=c.colorStops,null!==e))for(e=e.iterator;e.next();)m.addColorStop(e.key,e.value);if(f&&(c.oe=m,null!==
m&&(c.al=h,c.vu=k),null===m&&c.type===Ol&&-1!==c.al)){c.al=-1;var y=a.diagram;null!==y&&-1===c.al&&ta(function(){y.ge()},600)}}d?b.fillStyle=m:b.strokeStyle=m}}}t.Lg=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.Mg=function(){for(var a=this instanceof U?this:this.panel;null!==a&&a.isEnabled;)a=a.panel;return null===a};
function Gl(a){if(0!==(a.I&2048)===!0){var b=a.sb;b.reset();if(!a.Ab.o()||!a.tc.o()){Ql(a,!1);return}b.translate(a.Ab.x-a.tc.x,a.Ab.y-a.tc.y);if(1!==a.scale||0!==a.angle){var c=a.naturalBounds;yl(a,b,c.x,c.y,c.width,c.height)}Ql(a,!1);Rl(a,!0)}0!==(a.I&4096)===!0&&(b=a.panel,null===b?(a.ai.set(a.sb),a.kl=a.scale,Rl(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.kl=a.scale*b.kl,Rl(a,!1)))}
function yl(a,b,c,d,e,f){1!==a.scale&&b.scale(a.scale);if(0!==a.dc){var g=Mc;a.Jf()&&a.locationSpot.bb()&&(g=a.locationSpot);var h=J.alloc();if(a instanceof S&&a.locationObject!==a)for(c=a.locationObject,d=c.naturalBounds,h.Lk(d.x,d.y,d.width,d.height,g),c.jg.xa(h),h.offset(-c.measuredBounds.x,-c.measuredBounds.y),g=c.panel;null!==g&&g!==a;)g.jg.xa(h),h.offset(-g.measuredBounds.x,-g.measuredBounds.y),g=g.panel;else h.Lk(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);Bl(this,!0);var b=this.panel;null===b||a||b.u()}};t.Em=function(){!0!==Hj(this)&&(Cj(this,!0),Bl(this,!0))};function Sl(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()));Bl(a,!0)}}t.Bl=function(){0!==(this.I&2048)===!1&&(Ql(this,!0),Rl(this,!0))};t.bw=function(){Rl(this,!0)};t.P=function(){var a=this.part;null!==a&&a.P()};
function Al(a,b){var c=a.stretch,d=a.panel;if(null!==d&&d.type===U.Table)return Tl(a,d.getRowDefinition(a.row),d.getColumnDefinition(a.column),b);if(null!==d&&d.type===U.Auto&&d.Fb()===a)return Ul(a,Hd,b);if(c===kl){if(null!==d){if(d.type===U.Spot&&d.Fb()===a)return Ul(a,Hd,b);c=d.defaultStretch;return c===kl?Ul(a,Mg,b):Ul(a,c,b)}return Ul(a,Mg,b)}return Ul(a,c,b)}
function Tl(a,b,c,d){var e=a.stretch;if(e!==kl)return Ul(a,e,d);var f=e=null;switch(b.stretch){case ml:f=!0;break;case Hd:f=!0}switch(c.stretch){case ll:e=!0;break;case Hd:e=!0}b=a.panel.defaultStretch;null===e&&(e=b===ll||b===Hd);null===f&&(f=b===ml||b===Hd);return!0===e&&!0===f?Ul(a,Hd,d):!0===e?Ul(a,ll,d):!0===f?Ul(a,ml,d):Ul(a,Mg,d)}
function Ul(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===ll)return Mg;if(b===Hd)return ml}else{if(b===ml)return Mg;if(b===Hd)return ll}if(!isNaN(c.height))if(90!==a&&270!==a){if(b===ml)return Mg;if(b===Hd)return ll}else{if(b===ll)return Mg;if(b===Hd)return ml}return b}function Ll(a,b){a.I=b?a.I|512:a.I&-513}function ul(a){return 0!==(a.I&1024)}function Vl(a,b){a.I=b?a.I|1024:a.I&-1025}
function Ql(a,b){a.I=b?a.I|2048:a.I&-2049}function Rl(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 Bl(a,b){a.I=b?a.I|16384:a.I&-16385}t.rj=function(a){this.vg=a};t.hu=function(){};t.Cw=function(a){this.sa.assign(a);Sl(this);return!0};t.cr=function(a,b){if(this.sa.x!==a||this.sa.y!==b)this.sa.h(a,b),this.Bl()};
function Wl(a){var b=a.part;if(b instanceof T&&(null!==a.portId||a===b.port)){var c=b.diagram;null===c||c.undoManager.isUndoingRedoing||El(b,a)}}function Xl(a){var b=a.diagram;null===b||b.undoManager.isUndoingRedoing||(a instanceof U?a instanceof T?a.md():a.Nk(a,function(a){Wl(a)}):Wl(a))}t.bind=function(a){a.jd=this;var b=this.gj();null!==b&&Yl(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.gj=function(){for(var a=this instanceof U?this:this.panel;null!==a;){if(null!==a.ni)return a;a=a.panel}return null};t.Dw=function(a){Oj(this,a)};function Zl(a,b){b.jd=a;null===a.Sg&&(a.Sg=new Db);a.Sg.add(b.propertyName,b)}
function $l(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=am.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 Q&&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):bm(d,f);return d}
function bm(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=cm.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 Jl?(c=gb(Jl,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.yt(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 dm)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 ri)a instanceof N?Zl(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 Q?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++)bm(a,b[c]);else if("object"===typeof b&&null!==b)if(a instanceof
Jl){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 em(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);am.add(a,b)}
function fm(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.$l},set:function(a){var b=this.$l;b!==a&&(F&&null!==a&&A(a,"boolean",N,"shadowVisible"),this.$l=a,this.P(),this.g("shadowVisible",b,a))}},enabledChanged:{configurable:!0,get:function(){return null!==this.R?this.R.Un:null},set:function(a){rl(this);var b=this.R.Un;b!==a&&(null!==a&&A(a,"function",N,"enabledChanged"),this.R.Un=a,this.g("enabledChanged",b,a))}},segmentOrientation:{configurable:!0,
enumerable:!0,get:function(){return this.Yl},set:function(a){var b=this.Yl;b!==a&&(F&&hb(a,R,N,"segmentOrientation"),this.Yl=a,this.u(),this.g("segmentOrientation",b,a),a===og&&(this.angle=0))}},segmentIndex:{configurable:!0,get:function(){return this.Op},set:function(a){F&&A(a,"number",N,"segmentIndex");a=Math.round(a);var b=this.Op;b!==a&&(this.Op=a,this.u(),this.g("segmentIndex",b,a))}},segmentFraction:{configurable:!0,get:function(){return this.Wl},set:function(a){F&&
A(a,"number",N,"segmentFraction");isNaN(a)?a=0:0>a?a=0:1<a&&(a=1);var b=this.Wl;b!==a&&(this.Wl=a,this.u(),this.g("segmentFraction",b,a))}},segmentOffset:{configurable:!0,get:function(){return this.Xl},set:function(a){var b=this.Xl;b.A(a)||(F&&x(a,J,N,"segmentOffset"),this.Xl=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",