diff --git a/README.md b/README.md index 6bcc731..d069ba1 100644 --- a/README.md +++ b/README.md @@ -1,24 +1,25 @@ ## Introduction -Discipline | Fill your discipline name here +Discipline | Electronics and Communication and Engineering :--|:--| - Lab | Fill your lab name here - Experiment| Fill your experiment name and number here + Lab | Analog Electronics Circuits Virtual Laboratory + Experiment| Monostable Multivibrator using IC 555 ### About the Experiment -Fill a brief description of this experiment here - -Name of Developer | Fill the name of experiment owner here +### Subject Matter Expert +Name | **Prof. Chittaranjan Mandal** :--|:--| - Institute | - Email id| - Department | + Institute | **Indian Institute of Technology Kharagpur** + Email id| **chitta@iitkgp.ac.in** + Department | **Department of Computer Science and Engineering** +Webpage| [http://www.iitkgp.ac.in/department/CS/faculty/cs-chitta](http://www.iitkgp.ac.in/department/CS/faculty/cs-chitta) + ### Contributors List -SrNo | Name | Faculty or Student | Department| Institute | Email id -:--|:--|:--|:--|:--|:--| -1 | . | . | . | . | . -2 | . | . | . | . | . +SrNo | Name | Developer and Integration Engineer | Department| Institute +:--|:--|:--|:--|:--| +1 | **Sukriti Dhang** | Developer | Department of Mechanical Engineering | IIT Kharagpur | +2 | **Prakriti Dhang** | Integration | Department of Mechanical Engineering | IIT Kharagpur | diff --git a/experiment-descriptor.json b/experiment-descriptor.json new file mode 100644 index 0000000..7f5fa2a --- /dev/null +++ b/experiment-descriptor.json @@ -0,0 +1,57 @@ +{ + "unit-type": "lu", + "label": "", + "basedir": ".", + "LaTeXinMD": false, + "units": [ + { + "unit-type": "aim" + }, + + { + "target": "theory.html", + "source": "theory.md", + "label": "Theory", + "unit-type": "task", + "content-type": "text" + }, + + { + "target": "pretest.html", + "source": "pretest.json", + "label": "Pretest", + "unit-type": "task", + "content-type": "assesment" + }, + { + "target": "procedure.html", + "source": "procedure.md", + "label": "Procedure", + "unit-type": "task", + "content-type": "text" + }, + + { + "target": "simulation.html", + "source": "simulation/monostable_multivibrator.html", + "label": "Simulation", + "unit-type": "task", + "content-type": "simulation" + }, + + { + "target": "posttest.html", + "source": "posttest.json", + "label": "Posttest", + "unit-type": "task", + "content-type": "assesment" + }, + { + "target": "references.html", + "source": "references.md", + "label": "References", + "unit-type": "task", + "content-type": "text" + } + ] +} diff --git a/experiment/aim.md b/experiment/aim.md index 4bc1c54..fd3ffd6 100644 --- a/experiment/aim.md +++ b/experiment/aim.md @@ -1 +1,9 @@ -### Aim of the experiment +## Aim of the experiment + +1. To perform a Monostable Multivibrator using 555 Timer +2. To observe and plot the Trigger Input Voltage. +3. To observe and plot the Output Voltage. +4. To observe and plot the Capacitance Voltage. +5. Calculate the practical time period by the waveform. +6. Calculate the theoretical time period by 1.1RAC. +7. Calculate the frequency of the waveform. \ No newline at end of file diff --git a/experiment/contributors.md b/experiment/contributors.md index 43e714a..fbfb09f 100644 --- a/experiment/contributors.md +++ b/experiment/contributors.md @@ -1,11 +1,15 @@ -EMPTY - -### Subject Matter Experts -| SNo. | Name | Email | Institute | ID | -| :---: | :---: | :---: | :---: | :---: | -| 1 | name | email | institute | id | +### Subject Matter Expert +Name | **Prof. Chittaranjan Mandal** +:--|:--| + Institute | **Indian Institute of Technology Kharagpur** + Email id| **chitta@iitkgp.ac.in** + Department | **Department of Computer Science and Engineering** +Webpage| [http://www.iitkgp.ac.in/department/CS/faculty/cs-chitta](http://www.iitkgp.ac.in/department/CS/faculty/cs-chitta) -### Developers -| SNo. | Name | Email | Institute | ID | -| :---: | :---: | :---: | :---: | :---: | -| 1 | name | email | institute | id | \ No newline at end of file + +### Contributors List + +SrNo | Name | Developer and Integration Engineer | Department| Institute +:--|:--|:--|:--|:--| +1 | **Sukriti Dhang** | Developer | Department of Mechanical Engineering | IIT Kharagpur | +2 | **Prakriti Dhang** | Integration | Department of Mechanical Engineering | IIT Kharagpur | \ No newline at end of file diff --git a/experiment/experiment-name.md b/experiment/experiment-name.md index b0d364b..fdc7ea1 100644 --- a/experiment/experiment-name.md +++ b/experiment/experiment-name.md @@ -1 +1 @@ -## Experiment name +## Monostable Multivibrator using IC 555 diff --git a/experiment/images/mono_ckt_th.png b/experiment/images/mono_ckt_th.png new file mode 100644 index 0000000..bd3d827 Binary files /dev/null and b/experiment/images/mono_ckt_th.png differ diff --git a/experiment/images/monostable_prc.png b/experiment/images/monostable_prc.png new file mode 100644 index 0000000..fab54c9 Binary files /dev/null and b/experiment/images/monostable_prc.png differ diff --git a/experiment/images/outputwavfrm_mono.png b/experiment/images/outputwavfrm_mono.png new file mode 100644 index 0000000..18d0c4b Binary files /dev/null and b/experiment/images/outputwavfrm_mono.png differ diff --git a/experiment/images/pin-configuration-555-timer-8-pin.png b/experiment/images/pin-configuration-555-timer-8-pin.png new file mode 100644 index 0000000..0dc835c Binary files /dev/null and b/experiment/images/pin-configuration-555-timer-8-pin.png differ diff --git a/experiment/images/post_quiz1.png b/experiment/images/post_quiz1.png new file mode 100644 index 0000000..8e5a01f Binary files /dev/null and b/experiment/images/post_quiz1.png differ diff --git a/experiment/posttest.json b/experiment/posttest.json index e0e6fc2..e29350b 100644 --- a/experiment/posttest.json +++ b/experiment/posttest.json @@ -2,37 +2,62 @@ "version": 2.0, "questions": [ { - "question": "This is a Sample Question 1?", + "question": "What does the discharge transistor do in the 555 timer circuit?", "answers": { - "a": "answer1", - "b": "answer2", - "c": "answer3", - "d": "answer4" + "a": "Charge the external capacitor to start the timing over again", + "b": "Charge the external capacitor to stop the timing", + "c": "Discharge the external capacitor to stop the timing", + "d": "Discharge the external capacitor to start the timing over again" }, - "explanations": { - "a": "Explanation 1 here", - "b": "Explanation 2", - "c": "Explanation 2", - "d": "Explanation 2" + + "correctAnswer": "d", + "difficulty": "beginner" + }, + { + "question": "The monostable multivibrator circuit is not an oscillator because ________.", + "answers": { + "a": "Its output switches between two states", + "b": "It requires a sine wave input signal", + "c": "It requires a trigger to obtain an output signal", + "d": "The circuit does not require a dc power supply" + }, + + "correctAnswer": "c", + "difficulty": "beginner" + }, + { + "question": "The monostable multivibrator circuit is also know as ________.", + "answers": { + "a": "One shot", + "b": "Two shot", + "c": "Three shot", + "d": "Four shot" }, + "correctAnswer": "a", "difficulty": "beginner" }, { - "question": "This is a Sample Question 2?", + "question": "A monostable 555 timer has one stable states:", "answers": { - "a": "answer1", - "b": "answer2", - "c": "answer3", - "d": "answer4" + "a": "True", + "b": "False" + }, - "explanations": { - "a": "Explanation 1 here", - "b": "Explanation 2", - "c": "Explanation 2", - "d": "Explanation 2" + + "correctAnswer": "a", + "difficulty": "beginner" + }, + { + "question": "What is the formula to calculate the time period of the monostable multivibrator.", + "answers": { + "a": "T = 0.69 * (RA + RB) * C", + "b": "T = 0.69 * (RA + 2RB) * C", + "c": "T = 0.69 * RB * C", + "d": "T = 1.1 * R * C" }, - "correctAnswer": "c", + + "correctAnswer": "d", "difficulty": "beginner" } ] diff --git a/experiment/pretest.json b/experiment/pretest.json index e0e6fc2..ca093bf 100644 --- a/experiment/pretest.json +++ b/experiment/pretest.json @@ -2,37 +2,63 @@ "version": 2.0, "questions": [ { - "question": "This is a Sample Question 1?", + "question": "What is the formula to calculate the time period of the monostable multivibrator.", "answers": { - "a": "answer1", - "b": "answer2", - "c": "answer3", - "d": "answer4" + "a": "T = 0.69 * (RA + RB) * C", + "b": "T = 0.69 * (RA + 2RB) * C", + "c": "T = 0.69 * RB * C", + "d": "T = 1.1 * R * C" }, - "explanations": { - "a": "Explanation 1 here", - "b": "Explanation 2", - "c": "Explanation 2", - "d": "Explanation 2" + + "correctAnswer": "d", + "difficulty": "beginner" + }, + { + "question": "When a capacitor charges:", + "answers": { + "a": " the voltage across the plates rises exponentially", + "b": "the circuit current falls exponentially", + "c": "the capacitor charges to the source voltage in 5×RC seconds", + "d": "all of the above" }, - "correctAnswer": "a", + + "correctAnswer": "d", "difficulty": "beginner" }, { - "question": "This is a Sample Question 2?", + "question": "The ________ is defined as the time the output is active divided by the total period of the output signal.", "answers": { - "a": "answer1", - "b": "answer2", - "c": "answer3", - "d": "answer4" + "a": "active ratio", + "b": "duty cycle", + "c": "on time", + "d": "off time" }, - "explanations": { - "a": "Explanation 1 here", - "b": "Explanation 2", - "c": "Explanation 2", - "d": "Explanation 2" + + "correctAnswer": "b", + "difficulty": "beginner" + }, + { + "question": "A monostable 555 timer has the following number of stable states:", + "answers": { + "a": "0", + "b": "1", + "c": "2", + "d": "3" + }, + + "correctAnswer": "b", + "difficulty": "beginner" + }, + { + "question": "What is the output pulse width of the waveform at the output of the circuit in the given figure?

", + "answers": { + "a": "1.65 ms", + "b": "18.2 ms", + "c": "4.98 ms", + "d": "54.6 ms" }, - "correctAnswer": "c", + + "correctAnswer": "b", "difficulty": "beginner" } ] diff --git a/experiment/procedure.md b/experiment/procedure.md index 37929cc..ba80495 100644 --- a/experiment/procedure.md +++ b/experiment/procedure.md @@ -1 +1,21 @@ -### Procedure \ No newline at end of file +## Procedure + +#### Monostable Multivibrator using 555 +1. Connect the components as mentioned below: +L1-L12, L14-L12, L16-L12, L4-L9, L8-L9, L9-L10, L3-L17, L11-L13, L7-L11, L6-L13, L5-L15.(For eg. click on 1 and then drag to 12 and so on.) +2. Click on 'Check Connection' button to check the connections. +3. If connected wrong, click on the wrong connection. Else click on 'Delete all connection' button to erase all the connections. +4. Intially set R a=10 kΩ, C=1 µf, Vcc=5 V, Tin = 20 msec. +5. Click on "Calculate" button. +6. Now note the output voltage. +7. Click on "Plot" button to plot, Trigger Input Voltage, Output Voltage, Capacitance Voltage +8. Click on "Clear" button to clear the data. +9. Repeat the experiment for another set of resistance value and capacitance value. +10. Set the Resistance (R a) value (1 kΩ - 10 kΩ). +11. Set the Capacitance (C) value . +12. Set supply voltage (Vcc). + +
+ +

Figure 1

+
diff --git a/experiment/simulation/css/cktconnection_monostable.css b/experiment/simulation/css/cktconnection_monostable.css new file mode 100644 index 0000000..61b7c8d --- /dev/null +++ b/experiment/simulation/css/cktconnection_monostable.css @@ -0,0 +1,169 @@ + + +.demo { + /* for IE10+ touch devices */ + touch-action:none; +} + +.jtk-demo-canvas { + height:550px; + /*max-height:700px; + border:1px solid #CCC; + background-color:white;*/ + display: flex; + position:absolute; + top:5px; +} +.canvas-wide { + margin-left:0; +} + +/** JSPLUMB ARTEFACTS **/ +.jtk-overlay { + z-index: 51; +} + +.jtk-endpoint { + z-index: 50; + cursor: move; +} + +.jtk-connector { + z-index: 1; +} + +/** ELEMENTS **/ +.littledot +{ + cursor: pointer; + width: 12px; + height: 12px; + background-image: url(littledot.png); + z-index: 5; + position: absolute; + border-radius: 31px; + margin-bottom: 0px; + margin-left: 0px; + margin-right: 0px; +} +.cmdLink detach{ + margin-bottom: 0px; + margin-left: 0px; + margin-right: 0px; +} + + +.littledot-hover-hover { + border: 2px solid orange; +} + +.dropHover { + border: 1px solid orange; +} + +/** ELEMENT POSITIONS **/ +#ld1 { + position: absolute; + top: 230px; + left: 175px; +} +#ld2 { + position: absolute; + top: 198px; + left:120px; + +} + +#ld6 { + position: absolute; + top:145px; + left:120px; +} + +#ld7 { + position: absolute; + top: 98px; + left: 120px; +} + + +#ld3 { + position: absolute; + top:98px; + left:240px; +} +#ld5 { + position: absolute; + top:188px; + left:240px; +} + +#ld4 { + position: absolute; + top: 60px; + left:155px;; +} + + +#ld8 { + position: absolute; + top: 60px; + left:190px; + +} + +#ld9 { + position: absolute; + top:15px; + left:172px; +} +#ld10 { + position: absolute; + top:55px; + left:25px; +} +#ld11 { + position: absolute; + top:155px; + left:25px; +} + + + +#ld13 { + position: absolute; + top: 200px; + left: 25px; + +} +#ld14 { + position: absolute; + top: 270px; + left: 22px; + +} + +#ld15 { + position: absolute; + top:190px; + left:295px; +} +#ld16 { + position: absolute; + top:260px; + left:295px; +} +#ld17 { + position: absolute; + top:75px; + left:290px; +} +#ld12 { + position: absolute; + top: 280px; + left: 170px; + +} +path, .jtk-endpoint { + cursor: pointer; +} diff --git a/experiment/simulation/css/monostable_astable.css b/experiment/simulation/css/monostable_astable.css new file mode 100644 index 0000000..4839687 --- /dev/null +++ b/experiment/simulation/css/monostable_astable.css @@ -0,0 +1,132 @@ +/* +To change this license header, choose License Headers in Project Properties. +To change this template file, choose Tools | Templates +and open the template in the editor. +*/ +/* + Created on : 22 Nov, 2016, 5:43:22 PM + Author : sukriti +*/ + + .canvasjs-chart-credit{ + display:none; + } + //.dropdown { + // position: relative; + // display: inline-block; + // height:20px; + // font-size: 16px; + // font-weight: bold; + + // } + .dropdown-content { + display: none; + position: absolute; + background-color: #f9f9f9; + border:2px solid #3385ff; + min-width: 330px; + box-shadow: 0px 8px 16px 0px rgba(0,0,0,0.2); + padding: 12px 16px; + z-index: 50; + cursor: pointer; + } + + .dropdown:hover .dropdown-content { + display: block; + + } + + + img[id^="info_"] { + //background-color: #e4e5e9; + //background: none; + border: none; + padding: 5px; + float: right; + cursor: pointer; + width: 30px; + height: 30px; + +} + +table { + //font-family:Arial, Helvetica, sans-serif; + //color:#666; + //font-size:12px; + //text-shadow: 1px 1px 0px #fff; + //background:#eaebec; + //margin:5px; + //border:#ccc 2px solid; + + -moz-border-radius:3px; + -webkit-border-radius:3px; + border-radius:3px; + + -moz-box-shadow: 0 1px 2px #d1d1d1; + -webkit-box-shadow: 0 1px 2px #d1d1d1; + box-shadow: 0 1px 2px #d1d1d1; +} +table tr:hover td{ + background: #ccebff; + //background: -webkit-gradient(linear, left top, left bottom, from(#f2f2f2), to(#f0f0f0)); + //background: -moz-linear-gradient(top, #f2f2f2, #f0f0f0); +} +table tr:last-child td:first-child{ + -moz-border-radius-bottomleft:3px; + -webkit-border-bottom-left-radius:3px; + border-bottom-left-radius:3px; +} +table tr:last-child td:last-child{ + -moz-border-radius-bottomright:3px; + -webkit-border-bottom-right-radius:3px; + border-bottom-right-radius:3px; +} + + + /* .tooltip { + position: relative; + display: inline-block; + + }*/ + + /* Tooltip text */ + .tooltip .tooltiptext { + visibility: hidden; + width: 80px; + background-color: #f9f9f9;/*#ffff80;#555;*/ + border:2px solid #3385ff; + + color: #555; /*#fff;*/ + text-align: center; + // padding: 5px 0; + // border-radius: 6px; + + /* Position the tooltip text */ + position: absolute; + z-index: 1; + top: 60%; + left: 90%; + margin-left: 20px; + + /* Fade in tooltip */ + opacity: 0; + transition: opacity 1s; + } + + /* Tooltip arrow + .tooltip .tooltiptext::after { + content: ""; + position: absolute; + top: 300px; + left: 50%; + margin-left: -5px; + border-width: 5px; + border-style: solid; + border-color: #555 transparent transparent transparent; + }*/ + + /* Show the tooltip text when you mouse over the tooltip container */ + .tooltip:hover .tooltiptext { + visibility: visible; + opacity: 3; + } \ No newline at end of file diff --git a/experiment/simulation/css/simulationtabcss.css b/experiment/simulation/css/simulationtabcss.css new file mode 100644 index 0000000..649c06c --- /dev/null +++ b/experiment/simulation/css/simulationtabcss.css @@ -0,0 +1,28 @@ +/* +To change this license header, choose License Headers in Project Properties. +To change this template file, choose Tools | Templates +and open the template in the editor. +*/ +/* + Created on : 20 Jun, 2016, 8:44:41 PM + Author : sukriti +*/ + +/*input{ + width:310px; + height:40px; + background:#4E9CAF; //darkmoderate cyan + text-align: center; + padding:20px; + padding-top:3px; + padding-bottom:3px; + border-radius:10px; + color:white; + font-weight: bold; + font-size:12pt; + display: inline-block; + cursor:pointer; +} +input:hover{ + background-color: #20B2AA; //LightSeaGreen +}*/ \ No newline at end of file diff --git a/experiment/simulation/images/Print Filled.png b/experiment/simulation/images/Print Filled.png new file mode 100644 index 0000000..69b9569 Binary files /dev/null and b/experiment/simulation/images/Print Filled.png differ diff --git a/experiment/simulation/images/monostable.png b/experiment/simulation/images/monostable.png new file mode 100644 index 0000000..d91b5b5 Binary files /dev/null and b/experiment/simulation/images/monostable.png differ diff --git a/experiment/simulation/js/canvasjs.min.js b/experiment/simulation/js/canvasjs.min.js new file mode 100644 index 0000000..e9dba74 --- /dev/null +++ b/experiment/simulation/js/canvasjs.min.js @@ -0,0 +1,5175 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ + +/* + CanvasJS HTML5 & JavaScript Charts - v1.8.5 Beta 1 - http://canvasjs.com/ + Copyright 2013 fenopix +*/ + +(function () { + function T(a, c) { + a.prototype = Ja(c.prototype); + a.prototype.constructor = a; + a.base = c.prototype + } + function Ja(a) { + function c() { + } + c.prototype = a; + return new c + } + function za(a, c, b) { + "millisecond" === b ? a.setMilliseconds(a.getMilliseconds() + 1 * c) : "second" === b ? a.setSeconds(a.getSeconds() + 1 * c) : "minute" === b ? a.setMinutes(a.getMinutes() + 1 * c) : "hour" === b ? a.setHours(a.getHours() + 1 * c) : "day" === b ? a.setDate(a.getDate() + 1 * c) : "week" === b ? a.setDate(a.getDate() + 7 * c) : "month" === b ? a.setMonth(a.getMonth() + 1 * c) : "year" === b && a.setFullYear(a.getFullYear() + 1 * c); + return a + } + function Q(a, c) { + var b = !1; + 0 > a && (b = !0, a *= -1); + a = "" + a; + for (c = c?c:1; a.length < c; ) + a = "0" + a; + return b ? "-" + a : a + } + function ea(a) { + if (!a) + return a; + a = a.replace(/^\s\s*/, ""); + for (var c = /\s/, b = a.length; c.test(a.charAt(--b)); ) + ; + return a.slice(0, b + 1) + } + function Ka(a) { + a.roundRect = function (a, b, d, e, f, g, h, q) { + h && (this.fillStyle = h); + q && (this.strokeStyle = q); + "undefined" === typeof f && (f = 5); + this.lineWidth = g; + this.beginPath(); + this.moveTo(a + f, b); + this.lineTo(a + d - f, b); + this.quadraticCurveTo(a + d, b, a + d, b + f); + this.lineTo(a + d, b + e - f); + this.quadraticCurveTo(a + d, b + e, a + d - f, b + e); + this.lineTo(a + f, b + e); + this.quadraticCurveTo(a, b + e, a, b + e - f); + this.lineTo(a, b + f); + this.quadraticCurveTo(a, b, a + f, b); + this.closePath(); + h && this.fill(); + q && 0 < g && this.stroke() + } + } + function Aa(a, c) { + return a - c + } + function Ba(a, c) { + return a.x - c.x + } + function C(a) { + var c = ((a & 16711680) >> 16).toString(16), + b = ((a & 65280) >> 8).toString(16); + a = ((a & 255) >> 0).toString(16); + c = 2 > c.length ? "0" + c : c; + b = 2 > b.length ? "0" + b : b; + a = 2 > a.length ? "0" + a : a; + return"#" + c + b + a + } + function La(a, c) { + var b = this.length >>> 0, d = Number(c) || + 0, d = 0 > d ? Math.ceil(d) : Math.floor(d); + for (0 > d && (d += b); d < b; d++) + if (d in this && this[d] === a) + return d; + return-1 + } + function x(a) { + return null === a || "undefined" === typeof a + } + function Ca(a, c, b) { + b = b || "normal"; + var d = a + "_" + c + "_" + b, e = Da[d]; + if (isNaN(e)) { + try { + a = "position:absolute; left:0px; top:-20000px; padding:0px;\n\ +margin:0px;border:none;white-space:pre;line-height:normal;font-family:" + a + "; \n\ +font-size:" + c + "px; font-weight:" + b + ";"; + if (!Z) { + var + f = document.body; + Z = document.createElement("span"); + Z.innerHTML = ""; + var g = document.createTextNode("Mpgyi"); + Z.appendChild(g); + f.appendChild(Z) + } + Z.style.display = ""; + Z.setAttribute("style", a); + e = Math.round(Z.offsetHeight); + Z.style.display = "none" + } catch (h) { + e = Math.ceil(1.1 * c) + } + e = Math.max(e, c); + Da[d] = e + } + return e + } + function D(a, c) { + var b = []; + if (b = {solid: [], + shortDash: [3, 1], + shortDot: [1, 1], + shortDashDot: [3, 1, 1, 1], + shortDashDotDot: [3, 1, 1, 1, 1, 1], dot: [1, 2], + dash: [4, 2], + dashDot: [4, 2, 1, 2], longDash: [8, 2], + longDashDot: [8, 2, 1, 2], + longDashDotDot: [8, 2, 1, 2, 1, 2]}[a || "solid"]) + for (var d = 0; d < b.length; d++) + b[d] *= c; + else + b = []; + return b + } + function J(a, + c, b, d) { + if (a.addEventListener) + a.addEventListener(c, b, d || !1); + else if (a.attachEvent) + a.attachEvent("on" + c, function (c) { + c = c || window.event; + c.preventDefault = c.preventDefault || function () { + c.returnValue = !1 + }; + c.stopPropagation = c.stopPropagation || function () { + c.cancelBubble = !0 + }; + b.call(a, c) + }); + else + return!1 + } + function Ea(a, c, b) { + a *= N; + c *= N; + a = b.getImageData(a, c, 2, 2).data; + c = !0; + for (b = 0; 4 > b; b++) + if (a[b] !== a[b + 4] | a[b] !== a[b + 8] | a[b] !== a[b + 12]) { + c = !1; + break + } + return c ? a[0] << 16 | a[1] << 8 | a[2] : 0 + } + function R(a, c, b) { + return a in c ? c[a] : b[a] + } + function ja(a, c, b) { + if (u && Fa) { + var d = a.getContext("2d"); + ka = d.webkitBackingStorePixelRatio || d.mozBackingStorePixelRatio || d.msBackingStorePixelRatio || d.oBackingStorePixelRatio || d.backingStorePixelRatio || 1; + N = ta / ka; + a.width = c * N; + a.height = b * N; + ta !== ka && (a.style.width = c + "px", a.style.height = b + "px", d.scale(N, N)) + } + else + a.width = c, a.height = b + } + function $(a, c) { + var b = document.createElement("canvas"); + b.setAttribute("class", "canvasjs-chart-canvas"); + ja(b, a, c); + u || "undefined" === typeof G_vmlCanvasManager || G_vmlCanvasManager.initElement(b); + return b + } + function Ga(a, c, b) { + if (a && c && b) { + b = b + "." + c; + var d = "image/" + c; + a = a.toDataURL(d); + var e = !1, f = document.createElement("a"); + f.download = b; + f.href = a; + f.target = "_blank"; + if ("undefined" !== typeof Blob && new Blob) { + for (var g = a.replace(/^data:[a-z/]*;base64,/, ""), g = atob(g), h = new ArrayBuffer(g.length), h = new Uint8Array(h), q = 0; q < g.length; q++) + h[q] = g.charCodeAt(q); + c = new Blob([h.buffer], {type: "image/" + c}); + try { + window.navigator.msSaveBlob(c, b), e = !0 + } catch (k) { + f.dataset.downloadurl = [d, f.download, f.href].join(":"), f.href = + window.URL.createObjectURL(c) + } + } + if (!e) + try { + event = document.createEvent("MouseEvents"), event.initMouseEvent("click", !0, !1, window, 0, 0, 0, 0, 0, !1, !1, !1, !1, 0, null), f.dispatchEvent ? f.dispatchEvent(event) : f.fireEvent && f.fireEvent("onclick") + } catch (n) { + c = window.open(), c.document.write("
Please right click on the image and save it to your device
"), c.document.close() + } + } + } + function U(a, c, b) { + c.getAttribute("state") !== b && (c.setAttribute("state", b), c.setAttribute("type", "button"), c.style.position = + "relative", c.style.margin = "0px 0px 0px 0px", c.style.padding = "3px 4px 0px 4px", c.style.cssFloat = "left", c.setAttribute("title", a._cultureInfo[b + "Text"]), c.innerHTML = "" + a._cultureInfo[b + "Text"] + "") + } + function la() { + for (var a = null, c = 0; c < arguments.length; c++) + a = arguments[c], a.style && (a.style.display = "inline") + } + function X() { + for (var a = null, c = 0; c < arguments.length; c++) + (a = arguments[c]) && a.style && (a.style.display = "none") + } + function L(a, c, b, d) { + this._defaultsKey = + a; + this.parent = d; + this._eventListeners = []; + d = {}; + b && (ca[b] && ca[b][a]) && (d = ca[b][a]); + this._options = c ? c : {}; + this.setOptions(this._options, d) + } + function v(a, c, b) { + this._publicChartReference = b; + c = c || {}; + v.base.constructor.call(this, "Chart", c, c.theme ? c.theme : "theme1"); + var d = this; + this._containerId = a; + this._objectsInitialized = !1; + this.overlaidCanvasCtx = this.ctx = null; + this._indexLabels = []; + this._panTimerId = 0; + this._lastTouchEventType = ""; + this._lastTouchData = null; + this.isAnimating = !1; + this.renderCount = 0; + this.panEnabled = this.disableToolTip = + this.animatedRender = !1; + this._defaultCursor = "default"; + this.plotArea = {canvas: null, ctx: null, x1: 0, y1: 0, x2: 0, y2: 0, width: 0, height: 0}; + this._dataInRenderedOrder = []; + (this._container = "string" === typeof this._containerId ? document.getElementById(this._containerId) : this._containerId) ? (this._container.innerHTML = "", c = a = 0, a = this._options.width ? this.width : 0 < this._container.clientWidth ? this._container.clientWidth : this.width, c = this._options.height ? this.height : 0 < this._container.clientHeight ? this._container.clientHeight : + this.height, this.width = a, this.height = c, this.x1 = this.y1 = 0, + this.x2 = this.width, this.y2 = this.height, this._selectedColorSet = "undefined" !== typeof aa[this.colorSet] ? aa[this.colorSet] : aa.colorSet1, this._canvasJSContainer = document.createElement("div"), this._canvasJSContainer.setAttribute("class", "canvasjs-chart-container"), this._canvasJSContainer.style.position = "relative", this._canvasJSContainer.style.textAlign = "left", this._canvasJSContainer.style.cursor = "auto", u || (this._canvasJSContainer.style.height = "0px"), + this._container.appendChild(this._canvasJSContainer), this.canvas = $(a, c), + this.canvas.style.position = "absolute", this.canvas.getContext && (this._canvasJSContainer.appendChild(this.canvas), + this.ctx = this.canvas.getContext("2d"), this.ctx.textBaseline = "top", Ka(this.ctx), + u ? this.plotArea.ctx = this.ctx : (this.plotArea.canvas = $(a, c), this.plotArea.canvas.style.position = "absolute", this.plotArea.canvas.setAttribute("class", "plotAreaCanvas"), this._canvasJSContainer.appendChild(this.plotArea.canvas), this.plotArea.ctx = + this.plotArea.canvas.getContext("2d")), this.overlaidCanvas = $(a, c), + this.overlaidCanvas.style.position = "absolute", this._canvasJSContainer.appendChild(this.overlaidCanvas), + this.overlaidCanvasCtx = this.overlaidCanvas.getContext("2d"), this.overlaidCanvasCtx.textBaseline = "top", this._eventManager = new fa(this), J(window, "resize", function () { + d._updateSize() && d.render() + }), this._toolBar = document.createElement("div"), this._toolBar.setAttribute("class", "canvasjs-chart-toolbar"), + this._toolBar.style.cssText = "position: absolute; right: 1px; top: 1px;", + this._canvasJSContainer.appendChild(this._toolBar), + this.bounds = {x1: 0, y1: 0, x2: this.width, y2: this.height}, + J(this.overlaidCanvas, "click", function (a) { + d._mouseEventHandler(a) + }), J(this.overlaidCanvas, "mousemove", function (a) { + d._mouseEventHandler(a) + }), J(this.overlaidCanvas, "mouseup", function (a) { + d._mouseEventHandler(a) + }), J(this.overlaidCanvas, "mousedown", function (a) { + d._mouseEventHandler(a); + X(d._dropdownMenu) + }), J(this.overlaidCanvas, "mouseout", function (a) { + d._mouseEventHandler(a) + }), J(this.overlaidCanvas, window.navigator.msPointerEnabled ? + "MSPointerDown" : "touchstart", function (a) { + d._touchEventHandler(a) + }), J(this.overlaidCanvas, window.navigator.msPointerEnabled ? "MSPointerMove" : "touchmove", function (a) { + d._touchEventHandler(a) + }), J(this.overlaidCanvas, window.navigator.msPointerEnabled ? "MSPointerUp" : "touchend", function (a) { + d._touchEventHandler(a) + }), J(this.overlaidCanvas, window.navigator.msPointerEnabled ? "MSPointerCancel" : "touchcancel", function (a) { + d._touchEventHandler(a) + }), this._creditLink || (this._creditLink = document.createElement("a"), this._creditLink.setAttribute("class", + "canvasjs-chart-credit"), this._creditLink.setAttribute("style", "outline:none;margin:0px;position:absolute;right:3px;top:" + (this.height - 14) + "px;color:dimgrey;text-decoration:none;font-size:10px;font-family:Lucida Grande, Lucida Sans Unicode, Arial, sans-serif"), this._creditLink.setAttribute("tabIndex", -1), this._creditLink.setAttribute("target", "_blank")), this._toolTip = new V(this, this._options.toolTip, this.theme), this.axisY2 = this.axisY = this.axisX = this.data = null, this.sessionVariables = {axisX: {}, axisY: {}, + axisY2: {}})) : window.console && window.console.log('CanvasJS Error: Chart Container with id "' + this._containerId + '" was not found') + } + function ma(a, c) { + for (var b = [], d, e = 0; e < a.length; e++) + if (0 == e) + b.push(a[0]); + else { + var f, g, h; + h = e - 1; + f = 0 === h ? 0 : h - 1; + g = h === a.length - 1 ? h : h + 1; + d = Math.abs((a[g].x - a[f].x) / (0 === a[g].x - a[h].x ? 0.01 : a[g].x - a[h].x)) * (c - 1) / 2 + 1; + var q = (a[g].x - a[f].x) / d; + d = (a[g].y - a[f].y) / d; + b[b.length] = a[h].x > a[f].x && 0 < q || a[h].x < a[f].x && 0 > q ? {x: a[h].x + q / 3, y: a[h].y + d / 3} : {x: a[h].x, y: a[h].y + d / 9}; + h = e; + f = 0 === h ? 0 : h - 1; + g = h === a.length - 1 ? h : h + 1; + d = Math.abs((a[g].x - a[f].x) / (0 === a[h].x - a[f].x ? 0.01 : a[h].x - a[f].x)) * (c - 1) / 2 + 1; + q = (a[g].x - a[f].x) / d; + d = (a[g].y - a[f].y) / d; + b[b.length] = a[h].x > a[f].x && 0 < q || a[h].x < a[f].x && 0 > q ? {x: a[h].x - q / 3, y: a[h].y - d / 3} : {x: a[h].x, y: a[h].y - d / 9}; + b[b.length] = a[e] + } + return b + } + function Ha(a, c) { + if (null === a || "undefined" === typeof a) + return c; + var b = parseFloat(a.toString()) * (0 <= a.toString().indexOf("%") ? c / 100 : 1); + return!isNaN(b) && b <= c && 0 <= b ? b : c + } + function da(a, c, b, d, e) { + "undefined" === typeof e && (e = 0); + this._padding = e; + this._x1 = a; + this._y1 = c; + this._x2 = b; + this._y2 = d; + this._rightOccupied = this._leftOccupied = this._bottomOccupied = this._topOccupied = this._padding + } + function O(a, c) { + O.base.constructor.call(this, "TextBlock", c); + this.ctx = a; + this._isDirty = !0; + this._wrappedText = null; + this._lineHeight = Ca(this.fontFamily, this.fontSize, this.fontWeight) + } + function ga(a, c) { + ga.base.constructor.call(this, "Title", c, a.theme); + this.chart = a; + this.canvas = a.canvas; + this.ctx = this.chart.ctx; + if (x(this._options.margin) && a._options.subtitles) + for (var b = a._options.subtitles, + d = 0; d < b.length; d++) + if ((x(b[d].horizontalAlign) && "center" === this.horizontalAlign || b[d].horizontalAlign === this.horizontalAlign) && (x(b[d].verticalAlign) && "top" === this.verticalAlign || b[d].verticalAlign === this.verticalAlign) && !b[d].dockInsidePlotArea === !this.dockInsidePlotArea) { + this.margin = 0; + break + } + "undefined" === typeof this._options.fontSize && (this.fontSize = this.chart.getAutoFontSize(this.fontSize)); + this.height = this.width = null; + this.bounds = {x1: null, y1: null, x2: null, y2: null} + } + function na(a, c) { + na.base.constructor.call(this, + "Subtitle", c, a.theme); + this.chart = a; + this.canvas = a.canvas; + this.ctx = this.chart.ctx; + "undefined" === typeof this._options.fontSize && (this.fontSize = this.chart.getAutoFontSize(this.fontSize)); + this.height = this.width = null; + this.bounds = {x1: null, y1: null, x2: null, y2: null} + } + function oa(a, c, b) { + oa.base.constructor.call(this, "Legend", c, b); + this.chart = a; + this.canvas = a.canvas; + this.ctx = this.chart.ctx; + this.ghostCtx = this.chart._eventManager.ghostCtx; + this.items = []; + this.height = this.width = 0; + this.orientation = null; + this.dataSeries = + []; + this.bounds = {x1: null, y1: null, x2: null, y2: null}; + "undefined" === typeof this._options.fontSize && (this.fontSize = this.chart.getAutoFontSize(this.fontSize)); + this.lineHeight = Ca(this.fontFamily, this.fontSize, this.fontWeight); + this.horizontalSpacing = this.fontSize + } + function ua(a, c) { + ua.base.constructor.call(this, c); + this.chart = a; + this.canvas = a.canvas; + this.ctx = this.chart.ctx + } + function Y(a, c, b, d, e) { + Y.base.constructor.call(this, "DataSeries", c, b); + this.chart = a; + this.canvas = a.canvas; + this._ctx = a.canvas.ctx; + this.index = d; + this.noDataPointsInPlotArea = 0; + this.id = e; + this.chart._eventManager.objectMap[e] = {id: e, objectType: "dataSeries", dataSeriesIndex: d}; + this.dataPointIds = []; + this.plotUnit = []; + + this.axisY = this.axisX = null; + null === this.fillOpacity && (this.type.match(/area/i) ? this.fillOpacity = 0.7 : this.fillOpacity = 1); + this.axisPlacement = this.getDefaultAxisPlacement(); + "undefined" === typeof this._options.indexLabelFontSize && (this.indexLabelFontSize = this.chart.getAutoFontSize(this.indexLabelFontSize)) + } + function F(a, c, b, d) { + F.base.constructor.call(this, + "Axis", c, a.theme); + this.chart = a; + this.canvas = a.canvas; + this.ctx = a.ctx; + this.intervalStartPosition = this.maxHeight = this.maxWidth = 0; + this.labels = []; + this._stripLineLabels = this._labels = null; + this.dataInfo = {min: Infinity, max: -Infinity, viewPortMin: Infinity, viewPortMax: -Infinity, minDiff: Infinity}; + "axisX" === b ? (this.sessionVariables = this.chart.sessionVariables[b], this._options.interval || (this.intervalType = null), "theme2" === this.chart.theme && x(this._options.lineThickness) && (this.lineThickness = 2)) : this.sessionVariables = + "left" === d || "top" === d ? this.chart.sessionVariables.axisY : this.chart.sessionVariables.axisY2; + "undefined" === typeof this._options.titleFontSize && (this.titleFontSize = this.chart.getAutoFontSize(this.titleFontSize)); + "undefined" === typeof this._options.labelFontSize && (this.labelFontSize = this.chart.getAutoFontSize(this.labelFontSize)); + this.type = b; + "axisX" !== b || c && "undefined" !== typeof c.gridThickness || (this.gridThickness = 0); + this._position = d; + this.lineCoordinates = {x1: null, y1: null, x2: null, y2: null, width: null}; + this.labelAngle = + (this.labelAngle % 360 + 360) % 360; + 90 < this.labelAngle && 270 >= this.labelAngle ? this.labelAngle -= 180 : 270 < this.labelAngle && 360 >= this.labelAngle && (this.labelAngle -= 360); + if (this._options.stripLines && 0 < this._options.stripLines.length) + for (this.stripLines = [], c = 0; c < this._options.stripLines.length; c++) + this.stripLines.push(new pa(this.chart, this._options.stripLines[c], a.theme, ++this.chart._eventManager.lastObjectId, this)); + this._titleTextBlock = null; + this.hasOptionChanged("viewportMinimum") && null === this.viewportMinimum && + (this._options.viewportMinimum = void 0, this.sessionVariables.viewportMinimum = null); + this.hasOptionChanged("viewportMinimum") || isNaN(this.sessionVariables.newViewportMinimum) || null === this.sessionVariables.newViewportMinimum ? this.sessionVariables.newViewportMinimum = null : this.viewportMinimum = this.sessionVariables.newViewportMinimum; + this.hasOptionChanged("viewportMaximum") && null === this.viewportMaximum && (this._options.viewportMaximum = void 0, this.sessionVariables.viewportMaximum = null); + this.hasOptionChanged("viewportMaximum") || + isNaN(this.sessionVariables.newViewportMaximum) || null === this.sessionVariables.newViewportMaximum ? this.sessionVariables.newViewportMaximum = null : this.viewportMaximum = this.sessionVariables.newViewportMaximum; + null !== this.minimum && null !== this.viewportMinimum && (this.viewportMinimum = Math.max(this.viewportMinimum, this.minimum)); + null !== this.maximum && null !== this.viewportMaximum && (this.viewportMaximum = Math.min(this.viewportMaximum, this.maximum)); + this.trackChanges("viewportMinimum"); + this.trackChanges("viewportMaximum") + } + function pa(a, c, b, d, e) { + pa.base.constructor.call(this, "StripLine", c, b, e); + this.id = d; + this.chart = a; + this.ctx = this.chart.ctx; + this.label = this.label; + this._thicknessType = "pixel"; + null !== this.startValue && null !== this.endValue && (this.value = ((this.startValue.getTime ? this.startValue.getTime() : this.startValue) + (this.endValue.getTime ? this.endValue.getTime() : this.endValue)) / 2, this.thickness = Math.max(this.endValue - this.startValue), this._thicknessType = "value") + } + function V(a, c, b) { + V.base.constructor.call(this, "ToolTip", + c, b); + this.chart = a; + this.canvas = a.canvas; + this.ctx = this.chart.ctx; + this.currentDataPointIndex = this.currentSeriesIndex = -1; + this._timerId = 0; + this._prevY = this._prevX = NaN; + this._initialize() + } + function fa(a) { + this.chart = a; + this.lastObjectId = 0; + this.objectMap = []; + this.rectangularRegionEventSubscriptions = []; + this.previousDataPointEventObject = null; + this.ghostCanvas = $(this.chart.width, this.chart.height); + this.ghostCtx = this.ghostCanvas.getContext("2d"); + this.mouseoveredObjectMaps = [] + } + function ha(a) { + var c; + a && ia[a] && (c = ia[a]); + ha.base.constructor.call(this, "CultureInfo", c) + } + function va(a) { + this.chart = a; + this.ctx = this.chart.plotArea.ctx; + this.animations = []; + this.animationRequestId = null + } + var u = !!document.createElement("canvas").getContext, + qa = {Chart: {width: 500, height: 400, zoomEnabled: !1, zoomType: "x", backgroundColor: "white", theme: "theme1", animationEnabled: !1, animationDuration: 1200, dataPointWidth: null, dataPointMinWidth: null, dataPointMaxWidth: null, colorSet: "colorSet1", culture: "en", creditText: "CanvasJS.com", interactivityEnabled: !0, exportEnabled: !1, + exportFileName: "Chart", rangeChanging: null, rangeChanged: null}, + Title: {padding: 0, text: null, verticalAlign: "top", horizontalAlign: "center", fontSize: 20, fontFamily: "Calibri", fontWeight: "normal", fontColor: "black", fontStyle: "normal", borderThickness: 0, borderColor: "black", cornerRadius: 0, backgroundColor: null, margin: 5, wrap: !0, maxWidth: null, dockInsidePlotArea: !1}, + Subtitle: {padding: 0, text: null, verticalAlign: "top", horizontalAlign: "center", fontSize: 14, fontFamily: "Calibri", fontWeight: "normal", fontColor: "black", fontStyle: "normal", + borderThickness: 0, borderColor: "black", cornerRadius: 0, backgroundColor: null, margin: 2, wrap: !0, maxWidth: null, dockInsidePlotArea: !1}, + Legend: {name: null, verticalAlign: "center", horizontalAlign: "right", fontSize: 14, fontFamily: "calibri", fontWeight: "normal", fontColor: "black", fontStyle: "normal", cursor: null, itemmouseover: null, itemmouseout: null, itemmousemove: null, itemclick: null, dockInsidePlotArea: !1, reversed: !1, maxWidth: null, maxHeight: null, itemMaxWidth: null, itemWidth: null, itemWrap: !0, itemTextFormatter: null}, + ToolTip: {enabled: !0,shared: !1, animationEnabled: !0, content: null, contentFormatter: null, reversed: !1, backgroundColor: null, borderColor: null, borderThickness: 2, cornerRadius: 5, fontSize: 14, fontColor: null, fontFamily: "Calibri, Arial, Georgia, serif;", fontWeight: "normal", fontStyle: "italic"}, + Axis: {minimum: null, maximum: null, viewportMinimum: null, viewportMaximum: null, interval: null, intervalType: null, title: null, titleFontColor: "black", titleFontSize: 20, titleFontFamily: "arial", titleFontWeight: "normal", titleFontStyle: "normal", titleWrap: !0, + titleMaxWidth: null, labelAngle: 0, labelFontFamily: "arial", labelFontColor: "black", labelFontSize: 12, labelFontWeight: "normal", labelFontStyle: "normal", labelAutoFit: !0, labelWrap: !0, labelMaxWidth: null, labelFormatter: null, prefix: "", suffix: "", includeZero: !0, tickLength: 5, tickColor: "black", tickThickness: 1, lineColor: "black", lineThickness: 1, lineDashType: "solid", gridColor: "A0A0A0", gridThickness: 0, gridDashType: "solid", interlacedColor: null, valueFormatString: null, margin: 2, stripLines: []}, + StripLine: {value: null, startValue: null,endValue: null, color: "orange", opacity: null, thickness: 2, lineDashType: "solid", label: "", labelPlacement: "inside", labelAlign: "far", labelWrap: !0, labelMaxWidth: null, labelBackgroundColor: "transparent", labelFontFamily: "arial", labelFontColor: "orange", labelFontSize: 12, labelFontWeight: "normal", labelFontStyle: "normal", labelFormatter: null, showOnTop: !1}, + DataSeries: {name: null, dataPoints: null, label: "", bevelEnabled: !1, highlightEnabled: !0, cursor: null, indexLabel: "", indexLabelPlacement: "auto", indexLabelOrientation: "horizontal", + indexLabelFontColor: "black", indexLabelFontSize: 12, indexLabelFontStyle: "normal", indexLabelFontFamily: "Arial", indexLabelFontWeight: "normal", indexLabelBackgroundColor: null, indexLabelLineColor: null, indexLabelLineThickness: 1, indexLabelLineDashType: "solid", indexLabelMaxWidth: null, indexLabelWrap: !0, indexLabelFormatter: null, lineThickness: 2, lineDashType: "solid", connectNullData: !1, nullDataLineDashType: "dash", color: null, lineColor: null, risingColor: "white", fillOpacity: null, startAngle: 0, radius: null, innerRadius: null, + type: "column", xValueType: "number", axisYType: "primary", xValueFormatString: null, yValueFormatString: null, zValueFormatString: null, percentFormatString: null, showInLegend: null, legendMarkerType: null, legendMarkerColor: null, legendText: null, legendMarkerBorderColor: null, legendMarkerBorderThickness: null, markerType: "circle", markerColor: null, markerSize: null, markerBorderColor: null, markerBorderThickness: null, mouseover: null, mouseout: null, mousemove: null, click: null, toolTipContent: null, visible: !0}, + TextBlock: {x: 0, y: 0, width: null, height: null, maxWidth: null, maxHeight: null, padding: 0, angle: 0, text: "", horizontalAlign: "center", fontSize: 12, fontFamily: "calibri", fontWeight: "normal", fontColor: "black", fontStyle: "normal", borderThickness: 0, borderColor: "black", cornerRadius: 0, backgroundColor: null, textBaseline: "top"}, + CultureInfo: {decimalSeparator: ".", digitGroupSeparator: ",", zoomText: "Zoom", panText: "Pan", resetText: "Reset", menuText: "More Options", saveJPGText: "Save as JPEG", savePNGText: "Save as PNG", days: "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), + shortDays: "Sun Mon Tue Wed Thu Fri Sat".split(" "), months: "January February March April May June July August September October November December".split(" "), shortMonths: "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" ")}}, ia = {en: {}}, aa = {colorSet1: "#369EAD #C24642 #7F6084 #86B402 #A2D1CF #C8B631 #6DBCEB #52514E #4F81BC #A064A1 #F79647".split(" "), colorSet2: "#4F81BC #C0504E #9BBB58 #23BFAA #8064A1 #4AACC5 #F79647 #33558B".split(" "), colorSet3: "#8CA1BC #36845C #017E82 #8CB9D0 #708C98 #94838D #F08891 #0366A7 #008276 #EE7757 #E5BA3A #F2990B #03557B #782970".split(" ")}, + ca = {theme1: {Chart: {colorSet: "colorSet1"}, + Title: {fontFamily: u ? "Calibri, Optima, Candara, Verdana, Geneva, sans-serif" : "calibri", fontSize: 33, fontColor: "#3A3A3A", fontWeight: "bold", verticalAlign: "top", margin: 5}, + Subtitle: {fontFamily: u ? "Calibri, Optima, Candara, Verdana, Geneva, sans-serif" : "calibri", fontSize: 16, fontColor: "#3A3A3A", fontWeight: "bold", verticalAlign: "top", margin: 5}, Axis: {titleFontSize: 26, titleFontColor: "#666666", titleFontFamily: u ? "Calibri, Optima, Candara, Verdana, Geneva, sans-serif" : "calibri", + labelFontFamily: u ? "Calibri, Optima, Candara, Verdana, Geneva, sans-serif" : "calibri", labelFontSize: 18, labelFontColor: "grey", tickColor: "#BBBBBB", tickThickness: 2, gridThickness: 2, gridColor: "#BBBBBB", lineThickness: 2, lineColor: "#BBBBBB"}, Legend: {verticalAlign: "bottom", horizontalAlign: "center", fontFamily: u ? "monospace, sans-serif,arial black" : "calibri"}, DataSeries: {indexLabelFontColor: "grey", indexLabelFontFamily: u ? "Calibri, Optima, Candara, Verdana, Geneva, sans-serif" : "calibri", indexLabelFontSize: 18, indexLabelLineThickness: 1}}, + theme2: {Chart: {colorSet: "colorSet2"}, + Title: {fontFamily: "impact, charcoal, arial black, sans-serif", fontSize: 32, fontColor: "#333333", verticalAlign: "top", margin: 5}, + Subtitle: {fontFamily: "impact, charcoal, arial black, sans-serif", fontSize: 14, fontColor: "#333333", verticalAlign: "top", margin: 5}, + Axis: {titleFontSize: 22, titleFontColor: "rgb(98,98,98)", titleFontFamily: u ? "monospace, sans-serif,arial black" : "arial", titleFontWeight: "bold", labelFontFamily: u ? "monospace, Courier New, Courier" : "arial", labelFontSize: 16, + labelFontColor: "grey", labelFontWeight: "bold", tickColor: "grey", tickThickness: 2, gridThickness: 2, gridColor: "grey", lineColor: "grey", lineThickness: 0}, + Legend: {verticalAlign: "bottom", horizontalAlign: "center", fontFamily: u ? "monospace, sans-serif,arial black" : "arial"}, + DataSeries: {indexLabelFontColor: "grey", indexLabelFontFamily: u ? "Courier New, Courier, monospace" : "arial", indexLabelFontWeight: "bold", indexLabelFontSize: 18, indexLabelLineThickness: 1}}, + theme3: {Chart: {colorSet: "colorSet1"}, + Title: {fontFamily: u ? "Candara, Optima, Trebuchet MS, Helvetica Neue, Helvetica, Trebuchet MS, serif" :"calibri", fontSize: 32, fontColor: "#3A3A3A", fontWeight: "bold", verticalAlign: "top", margin: 5}, + Subtitle: {fontFamily: u ? "Candara, Optima, Trebuchet MS, Helvetica Neue, Helvetica, Trebuchet MS, serif" : "calibri", fontSize: 16, fontColor: "#3A3A3A", fontWeight: "bold", verticalAlign: "top", margin: 5}, + Axis: {titleFontSize: 22, titleFontColor: "rgb(98,98,98)", titleFontFamily: u ? "Verdana, Geneva, Calibri, sans-serif" : "calibri", labelFontFamily: u ? "Calibri, Optima, Candara, Verdana, Geneva, sans-serif" : "calibri", labelFontSize: 18, + labelFontColor: "grey", tickColor: "grey", tickThickness: 2, gridThickness: 2, gridColor: "grey", lineThickness: 2, lineColor: "grey"}, + Legend: {verticalAlign: "bottom", horizontalAlign: "center", fontFamily: u ? "monospace, sans-serif,arial black" : "calibri"}, + DataSeries: {bevelEnabled: !0, indexLabelFontColor: "grey", indexLabelFontFamily: u ? "Candara, Optima, Calibri, Verdana, Geneva, sans-serif" : "calibri", indexLabelFontSize: 18, indexLabelLineColor: "lightgrey", indexLabelLineThickness: 2}}}, + E = {numberDuration: 1, yearDuration: 314496E5, + monthDuration: 2592E6, weekDuration: 6048E5, dayDuration: 864E5, hourDuration: 36E5, minuteDuration: 6E4, secondDuration: 1E3, millisecondDuration: 1, dayOfWeekFromInt: "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" ")}, Da = {}, Z = null, wa = function () { + var a = /D{1,4}|M{1,4}|Y{1,4}|h{1,2}|H{1,2}|m{1,2}|s{1,2}|f{1,3}|t{1,2}|T{1,2}|K|z{1,3}|"[^"]*"|'[^']*'/g, c = "Sunday Monday Tuesday Wednesday Thursday Friday Saturday".split(" "), b = "Sun Mon Tue Wed Thu Fri Sat".split(" "), d = "January February March April May June July August September October November December".split(" "), + e = "Jan Feb Mar Apr May Jun Jul Aug Sep Oct Nov Dec".split(" "), f = /\b(?:[PMCEA][SDP]T|(?:Pacific|Mountain|Central|Eastern|Atlantic) (?:Standard|Daylight|Prevailing) Time|(?:GMT|UTC)(?:[-+]\d{4})?)\b/g, g = /[^-+\dA-Z]/g; + return function (h, q, k) { + var n = k ? k.days : c, m = k ? k.months : d, l = k ? k.shortDays : b, p = k ? k.shortMonths : e; + k = ""; + var r = !1; + h = h && h.getTime ? h : h ? new Date(h) : new Date; + if (isNaN(h)) + throw SyntaxError("invalid date"); + "UTC:" === q.slice(0, 4) && (q = q.slice(4), r = !0); + k = r ? "getUTC" : "get"; + var t = h[k + "Date"](), y = h[k + "Day"](), + s = h[k + "Month"](), z = h[k + "FullYear"](), w = h[k + "Hours"](), u = h[k + "Minutes"](), W = h[k + "Seconds"](), x = h[k + "Milliseconds"](), v = r ? 0 : h.getTimezoneOffset(); + return k = q.replace(a, function (a) { + switch (a) { + case "D": + return t; + case "DD": + return Q(t, 2); + case "DDD": + return l[y]; + case "DDDD": + return n[y]; + case "M": + return s + 1; + case "MM": + return Q(s + 1, 2); + case "MMM": + return p[s]; + case "MMMM": + return m[s]; + case "Y": + return parseInt(String(z).slice(-2)); + case "YY": + return Q(String(z).slice(-2), 2); + case "YYY": + return Q(String(z).slice(-3), 3); + case "YYYY": + return Q(z, + 4); + case "h": + return w % 12 || 12; + case "hh": + return Q(w % 12 || 12, 2); + case "H": + return w; + case "HH": + return Q(w, 2); + case "m": + return u; + case "mm": + return Q(u, 2); + case "s": + return W; + case "ss": + return Q(W, 2); + case "f": + return String(x).slice(0, 1); + case "ff": + return Q(String(x).slice(0, 2), 2); + case "fff": + return Q(String(x).slice(0, 3), 3); + case "t": + return 12 > w ? "a" : "p"; + case "tt": + return 12 > w ? "am" : "pm"; + case "T": + return 12 > w ? "A" : "P"; + case "TT": + return 12 > w ? "AM" : "PM"; + case "K": + return r ? "UTC" : (String(h).match(f) || [""]).pop().replace(g, ""); + case "z": + return(0 < v ? "-" : "+") + Math.floor(Math.abs(v) / 60); + case "zz": + return(0 < v ? "-" : "+") + Q(Math.floor(Math.abs(v) / 60), 2); + case "zzz": + return(0 < v ? "-" : "+") + Q(Math.floor(Math.abs(v) / 60), 2) + Q(Math.abs(v) % 60, 2); + default: + return a.slice(1, a.length - 1) + } + }) + } + }(), ba = function (a, c, b) { + if (null === a) + return""; + a = Number(a); + var d = 0 > a ? !0 : !1; + d && (a *= -1); + var e = b ? b.decimalSeparator : ".", f = b ? b.digitGroupSeparator : ",", g = ""; + c = String(c); + var g = 1, h = b = "", q = -1, k = [], n = [], m = 0, l = 0, p = 0, r = !1, t = 0, h = c.match(/"[^"]*"|'[^']*'|[eE][+-]*[0]+|[,]+[.]|\u2030|./g); + c = null; + for (var y = 0; h && y < h.length; y++) + if (c = h[y], "." === c && 0 > q) + q = y; + else { + if ("%" === c) + g *= 100; + else if ("\u2030" === c) { + g *= 1E3; + continue + } else if ("," === c[0] && "." === c[c.length - 1]) { + g /= Math.pow(1E3, c.length - 1); + q = y + c.length - 1; + continue + } else + "E" !== c[0] && "e" !== c[0] || "0" !== c[c.length - 1] || (r = !0); + 0 > q ? (k.push(c), "#" === c || "0" === c ? m++ : "," === c && p++) : (n.push(c), "#" !== c && "0" !== c || l++) + } + r && (c = Math.floor(a), t = (0 === c ? "" : String(c)).length - m, g /= Math.pow(10, t)); + 0 > q && (q = y); + g = (a * g).toFixed(l); + c = g.split("."); + g = (c[0] + "").split(""); + a = (c[1] + + "").split(""); + g && "0" === g[0] && g.shift(); + for (y = r = h = l = q = 0; 0 < k.length; ) + if (c = k.pop(), "#" === c || "0" === c) + if (q++, q === m) { + var s = g, g = []; + if ("0" === c) + for (c = m - l - (s?s.length:0); 0 < c; ) + s.unshift("0"), c--; + for (; 0 < s.length; ) + b = s.pop() + b, y++, 0 === y % r && (h === p && 0 < s.length) && (b = f + b); + d && (b = "-" + b) + } else + 0 < g.length ? (b = g.pop() + b, l++, y++) : "0" === c && (b = "0" + b, l++, y++), 0 === y % r && (h === p && 0 < g.length) && (b = f + b); + else + "E" !== c[0] && "e" !== c[0] || "0" !== c[c.length - 1] || !/[eE][+-]*[0]+/.test(c) ? "," === c ? (h++, r = y, y = 0, 0 < g.length && (b = f + b)) : b = 1 < c.length && + ('"' === c[0] && '"' === c[c.length - 1] || "'" === c[0] && "'" === c[c.length - 1]) ? c.slice(1, c.length - 1) + b : c + b : (c = 0 > t ? c.replace("+", "").replace("-", "") : c.replace("-", ""), b += c.replace(/[0]+/, function (a) { + return Q(t, a.length) + })); + d = ""; + for (f = !1; 0 < n.length; ) + c = n.shift(), "#" === c || "0" === c ? 0 < a.length && 0 !== Number(a.join("")) ? (d += a.shift(), f = !0) : "0" === c && (d += "0", f = !0) : 1 < c.length && ('"' === c[0] && '"' === c[c.length - 1] || "'" === c[0] && "'" === c[c.length - 1]) ? d += c.slice(1, c.length - 1) : "E" !== c[0] && "e" !== c[0] || "0" !== c[c.length - 1] || !/[eE][+-]*[0]+/.test(c) ? + d += c : (c = 0 > t ? c.replace("+", "").replace("-", "") : c.replace("-", ""), d += c.replace(/[0]+/, function (a) { + return Q(t, a.length) + })); + return b + ((f ? e : "") + d) + }, ra = function (a) { + var c = 0, b = 0; + a = a || window.event; + a.offsetX || 0 === a.offsetX ? (c = a.offsetX, b = a.offsetY) : a.layerX || 0 == a.layerX ? (c = a.layerX, b = a.layerY) : (c = a.pageX - a.target.offsetLeft, b = a.pageY - a.target.offsetTop); + return{x: c, y: b} + }, Fa = !0, ta = window.devicePixelRatio || 1, ka = 1, N = Fa ? ta / ka : 1, Ma = {reset: {image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAcCAYAAAAAwr0iAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAKRSURBVEiJrdY/iF1FFMfxzwnZrGISUSR/JLGIhoh/QiRNBLWxMLIWEkwbgiAoFgoW2mhlY6dgpY2IlRBRxBSKhSAKIklWJRYuMZKAhiyopAiaTY7FvRtmZ+/ed9/zHRjezLw5v/O9d86cuZGZpmURAfdn5o9DfdZNLXpjz+LziPgyIl6MiG0jPTJzZBuyDrP4BVm0P/AKbljTb4ToY/gGewYA7KyCl+1b3DUYANvwbiHw0gCAGRzBOzjTAXEOu0cC4Ch+r5x/HrpdrcZmvIDFSucMtnYCYC++6HmNDw8FKDT34ETrf639/azOr5vwRk/g5fbeuABtgC04XWk9VQLciMP4EH/3AFzErRNC7MXlQmsesSoHsGPE23hmEoBW+61K66HMXFmIMvN8myilXS36R01ub+KfYvw43ZXwYDX+AHP4BAci4pFJomfmr/ihmNofESsBImJGk7mlncrM45n5JPbhz0kAWpsv+juxaX21YIPmVJS2uNzJMS6ZNexC0d+I7fUWXLFyz2kSZlpWPvASlmqAf/FXNXf3FAF2F/1LuFifAlionB6dRuSI2IwHi6lzmXmp6xR8XY0fiIh7psAwh+3FuDkRHQVjl+a8lkXjo0kLUKH7XaV5oO86PmZ1FTzyP4K/XGl9v/zwfbW7BriiuETGCP5ch9bc9f97HF/vcFzCa5gdEPgWq+t/4v0V63oE1uF4h0DiFJ7HnSWMppDdh1dxtsPvJ2wcBNAKbsJXa0Ck5opdaBPsRNu/usba09i1KsaAVzmLt3sghrRjuK1Tf4xkegInxwy8gKf7dKMVH2QRsV5zXR/Cftyu+aKaKbbkQrsdH+PTzLzcqzkOQAVzM+7FHdiqqe2/YT4zF/t8S/sPmawyvC974vcAAAAASUVORK5CYII="}, + pan: {image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAALEgAACxIB0t1+/AAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAJVSURBVFiFvZe7a1RBGMV/x2hWI4JpfKCIiSBKOoOCkID/wP4BFqIIFkE02ChIiC8QDKlSiI3YqRBsBVGwUNAUdiIEUgjiAzQIIsuKJsfizsXr5t7d+8jmwLDfzHz3nLOzc7+ZxTZlGyDgZiWOCuJ9wH2gCUyuqQFgF/AGcKJNrYkBYBj40CIet+muGQi/96kM4WS7C/Tm5VUg7whJg8BkEGkCR4BDYfodsADUgP6wErO5iCtswsuJb32hdbXy8qzL5TIdmzJinHdZoZIBZcSFkGlAKs1Z3YCketZcBtouuaQNkrblMiBpBrhme7mAgU4wMCvpcFsDkq4C54DFVRTH9h+i6vlE0r5UA5ImgCuh28jB28iIs7BIVCOeStoZD64P4uPAjUTygKSx2FsK2TIwkugfk9Qkfd/E+yMWHQCeSRqx/R3gOp3LazfaS2C4B5gHDgD7U9x3E3uAH7KNpC3AHHAwTL4FHgM9GQ8vAaPA0dB/Abxqk2/gBLA9MXba9r1k/d4LfA3JtwueBeM58ucS+edXnAW23wP10N3advEi9CXizTnyN4bPS7Zn4sH/dq3t18AY4e1YLYSy3g/csj2VnFshZPuOpOeSKHCodUINuGj7YetE6je1PV9QoNPJ9StNHKodx7nRbiWrGHBGXAi5DUiqtQwtpcWK0Jubt8CltA5MEV1IfwO7+VffPwGfia5m34CT4bXujIIX0Qna1/cGMNqV/wUJE2czxD8CQ4X5Sl7Jz7SILwCDpbjKPBRMHAd+EtX4HWV5Spdc2w8kDQGPbH8py/MXMygM69/FKz4AAAAASUVORK5CYII="}, + zoom: {image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAACAAAAAgCAYAAABzenr0AAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK6wAACusBgosNWgAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAMqSURBVFiFvdfbj91TFMDxz57U6GUEMS1aYzyMtCSSDhWjCZMInpAI3khE/QHtgzdRkXgSCS8SES9epKLi0oRKNETjRahREq2KS1stdRujtDPtbA97n5zdn9+5zJxTK9k5v3POXmt991p7r71+IcaoGwkhTOIebMRqzOBTvIG3Y4zTXRmqSoyx5cAKbMJOHMFJnMZ8/jyFaXyMR7G6nb1aH22cP4BvcBxziG3GKfyTIR9D6BYg1KUghPBCDveFlb/24Av8iuUYw41YVsz5G7uxKcZ4aMEpwGt5NY3V/YbHsQ6rcAHOw/kYxigewr5CZw4fYGxBKcCLOFEYehXrMdRhr5yLETxVScsOLOkKAPfn1TYMPIvLFrShUlS2FDZm8XRHACzFAWl3R2xbqPMCYhmeLCAOYEMngAczbcTvuHYxzguIy/FesR9e6gSwU/OoPYHBHgHgviIKX2Flq7k34KhmcVnbi/PC8JX4MgMcxb118wZwdz5aISscqx7VRcox7MrPQ7i+btIAJrAkf9+bI9EPmZY2IAxiTSuAldLq4Y9+AcSUh78KP0tbAcwU35cXMD1JCIFUoGiehlqAz6TNB1f1C0DK+0h+nsNPrQC2a4bqGmlD9kOGcWt+Po6pVgDvSxfJaSkFd4UQBvoAsBYbCoB3a2flM7slA0R8iyt6rAFDeDPbm8eOTpVwGD9qVq7nLbIaZnmksPU1JtsCZMXNmpdRxFasWITzh6Xj3LCzra1OxcD2QjHiGVzdpfORnMqZio2PcF23ABdJF1Np4BPptlyPi6WzPYBzpJZtHe7A6xW9cnyP8TqA//SEIYRL8Bxul7rihvwgtVn78WcGGZXa9HGd5TDujDHuOePXNiHdKjWgZX/YbsxLx/ktqbjVzTlcjUSnvI5JrdlUVp6WesZZ6R1hRrpq9+EVTGS9jTjYAuKIouGpbcurEkIYxC051KNSamazsc+xK8b4S0VnEi/j0hqTP+M27O258egQwZuzs7pI7Mf4WQXIEDc5s9sux+5+1Py2EmP8UOq6GvWhIScxfdYjUERiAt9Jd84J6a16zf8JEKT3yCm8g1UxRv8CC4pyRhzR1uUAAAAASUVORK5CYII="}, + menu: {image: "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAABAAAAAgCAYAAAAbifjMAAAABHNCSVQICAgIfAhkiAAAAAlwSFlzAAAK6wAACusBgosNWgAAABx0RVh0U29mdHdhcmUAQWRvYmUgRmlyZXdvcmtzIENTNui8sowAAAAWdEVYdENyZWF0aW9uIFRpbWUAMDcvMTUvMTTPsvU0AAAAP0lEQVRIie2SMQoAIBDDUvH/X667g8sJJ9KOhYYOkW0qGaU1MPdC0vGSbV19EACo3YMPAFH5BUBUjsqfAPpVXtNgGDfxEDCtAAAAAElFTkSuQmCC"}}; + L.prototype.setOptions = function (a, c) { + if (qa[this._defaultsKey]) { + var b = qa[this._defaultsKey], d; + for (d in b) + b.hasOwnProperty(d) && (this[d] = a && d in a ? a[d] : c && d in + c ? c[d] : b[d]) + } + }; + L.prototype.updateOption = function (a) { + var c = qa[this._defaultsKey], b = this._options.theme ? this._options.theme : this.chart && this.chart._options.theme ? this.chart._options.theme : "theme1", d = {}, e = this[a]; + b && (ca[b] && ca[b][this._defaultsKey]) && (d = ca[b][this._defaultsKey]); + a in c && (e = a in this._options ? this._options[a] : d && a in d ? d[a] : c[a]); + if (e === this[a]) + return!1; + this[a] = e; + return!0 + }; + L.prototype.trackChanges = function (a) { + if (!this.sessionVariables) + throw"Session Variable Store not set"; + this.sessionVariables[a] = + this._options[a] + }; + L.prototype.isBeingTracked = function (a) { + this._options._oldOptions || (this._options._oldOptions = {}); + return this._options._oldOptions[a] ? !0 : !1 + }; + L.prototype.hasOptionChanged = function (a) { + if (!this.sessionVariables) + throw"Session Variable Store not set"; + return this.sessionVariables[a] !== this._options[a] + }; + L.prototype.addEventListener = function (a, c, b) { + a && c && (this._eventListeners[a] = this._eventListeners[a] || [], this._eventListeners[a].push({context: b || this, eventHandler: c})) + }; + L.prototype.removeEventListener = + function (a, c) { + if (a && c && this._eventListeners[a]) + for (var b = this._eventListeners[a], d = 0; d < b.length; d++) + if (b[d].eventHandler === c) { + b[d].splice(d, 1); + break + } + }; + L.prototype.removeAllEventListeners = function () { + this._eventListeners = [] + }; + L.prototype.dispatchEvent = function (a, c, b) { + if (a && this._eventListeners[a]) { + c = c || {}; + for (var d = this._eventListeners[a], e = 0; e < d.length; e++) + d[e].eventHandler.call(d[e].context, c) + } + "function" === typeof this[a] && this[a].call(b || this.chart._publicChartReference, c) + }; + T(v, L); + v.prototype._updateOptions = + function () { + var a = this; + this.updateOption("width"); + this.updateOption("height"); + this.updateOption("dataPointWidth"); + this.updateOption("dataPointMinWidth"); + this.updateOption("dataPointMaxWidth"); + this.updateOption("interactivityEnabled"); + this.updateOption("theme"); + this.updateOption("colorSet") && (this._selectedColorSet = "undefined" !== typeof aa[this.colorSet] ? aa[this.colorSet] : aa.colorSet1); + this.updateOption("backgroundColor"); + this.backgroundColor || (this.backgroundColor = "rgba(0,0,0,0)"); + this.updateOption("culture"); + this._cultureInfo = new ha(this._options.culture); + this.updateOption("animationEnabled"); + this.animationEnabled = this.animationEnabled && u; + this.updateOption("animationDuration"); + this.updateOption("rangeChanging"); + this.updateOption("rangeChanged"); + this.updateOption("exportEnabled"); + this.updateOption("exportFileName"); + this.updateOption("zoomType"); + this._options.zoomEnabled ? (this._zoomButton || (X(this._zoomButton = document.createElement("button")), U(this, this._zoomButton, "pan"), this._toolBar.appendChild(this._zoomButton), + J(this._zoomButton, "click", function () { + a.zoomEnabled ? (a.zoomEnabled = !1, a.panEnabled = !0, U(a, a._zoomButton, "zoom")) : (a.zoomEnabled = !0, a.panEnabled = !1, U(a, a._zoomButton, "pan")); + a.render() + })), this._resetButton || (X(this._resetButton = document.createElement("button")), U(this, this._resetButton, "reset"), this._toolBar.appendChild(this._resetButton), J(this._resetButton, "click", function () { + a._toolTip.hide(); + a.zoomEnabled || a.panEnabled ? (a.zoomEnabled = !0, a.panEnabled = !1, U(a, a._zoomButton, "pan"), a._defaultCursor = + "default", a.overlaidCanvas.style.cursor = a._defaultCursor) : (a.zoomEnabled = !1, a.panEnabled = !1); + a.sessionVariables.axisX && (a.sessionVariables.axisX.newViewportMinimum = null, a.sessionVariables.axisX.newViewportMaximum = null); + a.sessionVariables.axisY && (a.sessionVariables.axisY.newViewportMinimum = null, a.sessionVariables.axisY.newViewportMaximum = null); + a.sessionVariables.axisY2 && (a.sessionVariables.axisY2.newViewportMinimum = null, a.sessionVariables.axisY2.newViewportMaximum = null); + a.resetOverlayedCanvas(); + X(a._zoomButton, + a._resetButton); + a._dispatchRangeEvent("rangeChanging", "reset"); + a.render(); + a._dispatchRangeEvent("rangeChanged", "reset") + }), this.overlaidCanvas.style.cursor = a._defaultCursor), this.zoomEnabled || this.panEnabled || (this._zoomButton ? (a._zoomButton.getAttribute("state") === a._cultureInfo.zoomText ? (this.panEnabled = !0, this.zoomEnabled = !1) : (this.zoomEnabled = !0, this.panEnabled = !1), la(a._zoomButton, a._resetButton)) : (this.zoomEnabled = !0, this.panEnabled = !1))) : this.panEnabled = this.zoomEnabled = !1; + this._menuButton ? + this.exportEnabled ? la(this._menuButton) : X(this._menuButton) : this.exportEnabled && u && (this._menuButton = document.createElement("button"), U(this, this._menuButton, "menu"), this._toolBar.appendChild(this._menuButton), J(this._menuButton, "click", function () { + "none" !== a._dropdownMenu.style.display || a._dropDownCloseTime && 500 >= (new Date).getTime() - a._dropDownCloseTime.getTime() || (a._dropdownMenu.style.display = "block", a._menuButton.blur(), a._dropdownMenu.focus()) + }, !0)); + if (!this._dropdownMenu && this.exportEnabled && + u) { + this._dropdownMenu = document.createElement("div"); + this._dropdownMenu.setAttribute("tabindex", -1); + this._dropdownMenu.style.cssText = "position: absolute; -webkit-user-select: none; -moz-user-select: none; -ms-user-select: none; user-select: none; cursor: pointer;right: 1px;top: 25px;min-width: 120px;outline: 0;border: 1px solid silver;font-size: 14px;font-family: Calibri, Verdana, sans-serif;padding: 5px 0px 5px 0px;text-align: left;background-color: #fff;line-height: 20px;box-shadow: 2px 2px 10px #888888;"; + a._dropdownMenu.style.display = "none"; + this._toolBar.appendChild(this._dropdownMenu); + J(this._dropdownMenu, "blur", function () { + X(a._dropdownMenu); + a._dropDownCloseTime = new Date + }, !0); + var c = document.createElement("div"); + c.style.cssText = "padding: 2px 15px 2px 10px"; + c.innerHTML = this._cultureInfo.saveJPGText; + this._dropdownMenu.appendChild(c); + J(c, "mouseover", function () { + this.style.backgroundColor = "#EEEEEE" + }, !0); + J(c, "mouseout", function () { + this.style.backgroundColor = "transparent" + }, !0); + J(c, "click", function () { + Ga(a.canvas, + "jpeg", a.exportFileName); + X(a._dropdownMenu) + }, !0); + c = document.createElement("div"); + c.style.cssText = "padding: 2px 15px 2px 10px"; + c.innerHTML = this._cultureInfo.savePNGText; + this._dropdownMenu.appendChild(c); + J(c, "mouseover", function () { + this.style.backgroundColor = "#EEEEEE" + }, !0); + J(c, "mouseout", function () { + this.style.backgroundColor = "transparent" + }, !0); + J(c, "click", function () { + Ga(a.canvas, "png", a.exportFileName); + X(a._dropdownMenu) + }, !0) + } + "none" !== this._toolBar.style.display && this._zoomButton && (this.panEnabled ? U(a, + a._zoomButton, "zoom") : U(a, a._zoomButton, "pan"), a._resetButton.getAttribute("state") !== a._cultureInfo.resetText && U(a, a._resetButton, "reset")); + if ("undefined" === typeof qa.Chart.creditHref) + this.creditHref = "http://canvasjs.com/", this.creditText = "CanvasJS.com"; + else + var b = this.updateOption("creditText"), d = this.updateOption("creditHref"); + if (0 === this.renderCount || b || d) + this._creditLink.setAttribute("href", this.creditHref), this._creditLink.innerHTML = this.creditText; + this.creditHref && this.creditText ? this._creditLink.parentElement || + this._canvasJSContainer.appendChild(this._creditLink) : this._creditLink.parentElement && this._canvasJSContainer.removeChild(this._creditLink); + this._options.toolTip && this._toolTip._options !== this._options.toolTip && (this._toolTip._options = this._options.toolTip); + for (var e in this._toolTip._options) + this._toolTip._options.hasOwnProperty(e) && this._toolTip.updateOption(e) + }; + v.prototype._updateSize = function () { + var a = 0, c = 0; + this._options.width ? a = this.width : this.width = a = 0 < this._container.clientWidth ? this._container.clientWidth : + this.width; + this._options.height ? c = this.height : this.height = c = 0 < this._container.clientHeight ? this._container.clientHeight : this.height; + return this.canvas.width !== a * N || this.canvas.height !== c * N ? (ja(this.canvas, a, c), ja(this.overlaidCanvas, a, c), ja(this._eventManager.ghostCanvas, a, c), !0) : !1 + }; + v.prototype._initialize = function () { + this._animator ? this._animator.cancelAllAnimations() : this._animator = new va(this); + this.removeAllEventListeners(); + this.disableToolTip = !1; + this._axes = []; + this.pieDoughnutClickHandler = null; + this.animationRequestId && this.cancelRequestAnimFrame.call(window, this.animationRequestId); + this._updateOptions(); + this.animatedRender = u && this.animationEnabled && 0 === this.renderCount; + this._updateSize(); + this.clearCanvas(); + this.ctx.beginPath(); + this.axisY2 = this.axisY = this.axisX = null; + this._indexLabels = []; + this._dataInRenderedOrder = []; + this._events = []; + this._eventManager && this._eventManager.reset(); + this.plotInfo = {axisPlacement: null, axisXValueType: null, plotTypes: []}; + this.layoutManager = new da(0, 0, this.width, this.height, + 2); + this.plotArea.layoutManager && this.plotArea.layoutManager.reset(); + this.data = []; + var a = 0; + if (this._options.data) + for (var c = 0; c < this._options.data.length; c++) + if (a++, !this._options.data[c].type || 0 <= v._supportedChartTypes.indexOf(this._options.data[c].type)) { + var b = new Y(this, this._options.data[c], this.theme, a - 1, ++this._eventManager.lastObjectId); + null === b.name && (b.name = "DataSeries " + a); + null === b.color ? 1 < this._options.data.length ? (b._colorSet = [this._selectedColorSet[b.index % this._selectedColorSet.length]], + b.color = this._selectedColorSet[b.index % this._selectedColorSet.length]) : b._colorSet = "line" === b.type || "stepLine" === b.type || "spline" === b.type || "area" === b.type || "stepArea" === b.type || "splineArea" === b.type || "stackedArea" === b.type || "stackedArea100" === b.type || "rangeArea" === b.type || "rangeSplineArea" === b.type || "candlestick" === b.type || "ohlc" === b.type ? [this._selectedColorSet[0]] : this._selectedColorSet : b._colorSet = [b.color]; + null === b.markerSize && (("line" === b.type || "stepLine" === b.type || "spline" === b.type || 0 <= b.type.toLowerCase().indexOf("area")) && + b.dataPoints && b.dataPoints.length < this.width / 16 || "scatter" === b.type) && (b.markerSize = 8); + "bubble" !== b.type && "scatter" !== b.type || !b.dataPoints || (b.dataPoints.some ? b.dataPoints.some(function (a) { + return a.x + }) && b.dataPoints.sort(Ba) : b.dataPoints.sort(Ba)); + this.data.push(b); + var d = b.axisPlacement, e; + "normal" === d ? "xySwapped" === this.plotInfo.axisPlacement ? e = 'You cannot combine "' + b.type + '" with bar chart' : "none" === this.plotInfo.axisPlacement ? e = 'You cannot combine "' + b.type + '" with pie chart' : null === this.plotInfo.axisPlacement && + (this.plotInfo.axisPlacement = "normal") : "xySwapped" === d ? "normal" === this.plotInfo.axisPlacement ? e = 'You cannot combine "' + b.type + '" with line, area, column or pie chart' : "none" === this.plotInfo.axisPlacement ? e = 'You cannot combine "' + b.type + '" with pie chart' : null === this.plotInfo.axisPlacement && (this.plotInfo.axisPlacement = "xySwapped") : "none" == d && ("normal" === this.plotInfo.axisPlacement ? e = 'You cannot combine "' + b.type + '" with line, area, column or bar chart' : "xySwapped" === this.plotInfo.axisPlacement ? e = + 'You cannot combine "' + b.type + '" with bar chart' : null === this.plotInfo.axisPlacement && (this.plotInfo.axisPlacement = "none")); + if (e && window.console) { + window.console.log(e); + return + } + } + this._objectsInitialized = !0 + }; + v._supportedChartTypes = function (a) { + a.indexOf || (a.indexOf = La); + return a + }("line stepLine spline column area stepArea splineArea bar bubble scatter stackedColumn stackedColumn100 stackedBar stackedBar100 stackedArea stackedArea100 candlestick ohlc rangeColumn rangeBar rangeArea rangeSplineArea pie doughnut funnel".split(" ")); + v.prototype.render = function (a) { + a && (this._options = a); + this._initialize(); + var c = []; + for (a = 0; a < this.data.length; a++) + if ("normal" === this.plotInfo.axisPlacement || "xySwapped" === this.plotInfo.axisPlacement) + this.data[a].axisYType && "primary" !== this.data[a].axisYType ? "secondary" === this.data[a].axisYType && (this.axisY2 || ("normal" === this.plotInfo.axisPlacement ? this._axes.push(this.axisY2 = new F(this, this._options.axisY2, "axisY", "right")) : "xySwapped" === this.plotInfo.axisPlacement && this._axes.push(this.axisY2 = new F(this, + this._options.axisY2, "axisY", "top"))), this.data[a].axisY = this.axisY2) : (this.axisY || ("normal" === this.plotInfo.axisPlacement ? this._axes.push(this.axisY = new F(this, this._options.axisY, "axisY", "left")) : "xySwapped" === this.plotInfo.axisPlacement && this._axes.push(this.axisY = new F(this, this._options.axisY, "axisY", "bottom"))), this.data[a].axisY = this.axisY), this.axisX || ("normal" === this.plotInfo.axisPlacement ? this._axes.push(this.axisX = new F(this, this._options.axisX, "axisX", "bottom")) : "xySwapped" === this.plotInfo.axisPlacement && + this._axes.push(this.axisX = new F(this, this._options.axisX, "axisX", "left"))), this.data[a].axisX = this.axisX; + this.axisY && this.axisY2 && (0 < this.axisY.gridThickness && "undefined" === typeof this.axisY2._options.gridThickness ? this.axisY2.gridThickness = 0 : 0 < this.axisY2.gridThickness && "undefined" === typeof this.axisY._options.gridThickness && (this.axisY.gridThickness = 0)); + var b = !1; + if (0 < this._axes.length && (this.zoomEnabled || this.panEnabled)) + for (a = 0; a < this._axes.length; a++) + if (null !== this._axes[a].viewportMinimum || + null !== this._axes[a].viewportMaximum) { + b = !0; + break + } + b ? la(this._zoomButton, this._resetButton) : (X(this._zoomButton, this._resetButton), this._options.zoomEnabled && (this.zoomEnabled = !0, this.panEnabled = !1)); + this._processData(); + this._options.title && (this._title = new ga(this, this._options.title), this._title.dockInsidePlotArea ? c.push(this._title) : this._title.render()); + if (this._options.subtitles) + for (a = 0; a < this._options.subtitles.length; a++) + this.subtitles = [], b = new na(this, this._options.subtitles[a]), this.subtitles.push(b), + b.dockInsidePlotArea ? c.push(b) : b.render(); + this.legend = new oa(this, this._options.legend, this.theme); + for (a = 0; a < this.data.length; a++) + (this.data[a].showInLegend || "pie" === this.data[a].type || "doughnut" === this.data[a].type) && this.legend.dataSeries.push(this.data[a]); + this.legend.dockInsidePlotArea ? c.push(this.legend) : this.legend.render(); + if ("normal" === this.plotInfo.axisPlacement || "xySwapped" === this.plotInfo.axisPlacement) + F.setLayoutAndRender(this.axisX, this.axisY, this.axisY2, this.plotInfo.axisPlacement, this.layoutManager.getFreeSpace()); + else if ("none" === this.plotInfo.axisPlacement) + this.preparePlotArea(); + else + return; + for (a = 0; a < c.length; a++) + c[a].render(); + var d = []; + if (this.animatedRender) { + var e = $(this.width, this.height); + e.getContext("2d").drawImage(this.canvas, 0, 0, this.width, this.height) + } + for (a = 0; a < this.plotInfo.plotTypes.length; a++) + for (c = this.plotInfo.plotTypes[a], b = 0; b < c.plotUnits.length; b++) { + var f = c.plotUnits[b], g = null; + f.targetCanvas = null; + this.animatedRender && (f.targetCanvas = $(this.width, this.height), f.targetCanvasCtx = f.targetCanvas.getContext("2d")); + "line" === f.type ? g = this.renderLine(f) : "stepLine" === f.type ? g = this.renderStepLine(f) : "spline" === f.type ? g = this.renderSpline(f) : "column" === f.type ? g = this.renderColumn(f) : "bar" === f.type ? g = this.renderBar(f) : "area" === f.type ? g = this.renderArea(f) : "stepArea" === f.type ? g = this.renderStepArea(f) : "splineArea" === f.type ? g = this.renderSplineArea(f) : "stackedColumn" === f.type ? g = this.renderStackedColumn(f) : "stackedColumn100" === f.type ? g = this.renderStackedColumn100(f) : "stackedBar" === f.type ? g = this.renderStackedBar(f) : "stackedBar100" === + f.type ? g = this.renderStackedBar100(f) : "stackedArea" === f.type ? g = this.renderStackedArea(f) : "stackedArea100" === f.type ? g = this.renderStackedArea100(f) : "bubble" === f.type ? g = g = this.renderBubble(f) : "scatter" === f.type ? g = this.renderScatter(f) : "pie" === f.type ? this.renderPie(f) : "doughnut" === f.type ? this.renderPie(f) : "candlestick" === f.type ? g = this.renderCandlestick(f) : "ohlc" === f.type ? g = this.renderCandlestick(f) : "rangeColumn" === f.type ? g = this.renderRangeColumn(f) : "rangeBar" === f.type ? g = this.renderRangeBar(f) : "rangeArea" === + f.type ? g = this.renderRangeArea(f) : "rangeSplineArea" === f.type && (g = this.renderRangeSplineArea(f)); + for (var h = 0; h < f.dataSeriesIndexes.length; h++) + this._dataInRenderedOrder.push(this.data[f.dataSeriesIndexes[h]]); + this.animatedRender && g && d.push(g) + } + this.animatedRender && 0 < this._indexLabels.length && (a = $(this.width, this.height).getContext("2d"), d.push(this.renderIndexLabels(a))); + var q = this; + 0 < d.length ? (q.disableToolTip = !0, q._animator.animate(200, q.animationDuration, function (a) { + q.ctx.clearRect(0, 0, q.width, q.height); + q.ctx.drawImage(e, 0, 0, Math.floor(q.width * N), Math.floor(q.height * N), 0, 0, q.width, q.height); + for (var b = 0; b < d.length; b++) + g = d[b], 1 > a && "undefined" !== typeof g.startTimePercent ? a >= g.startTimePercent && g.animationCallback(g.easingFunction(a - g.startTimePercent, 0, 1, 1 - g.startTimePercent), g) : g.animationCallback(g.easingFunction(a, 0, 1, 1), g); + q.dispatchEvent("dataAnimationIterationEnd", {chart: q}) + }, function () { + d = []; + for (var a = 0; a < q.plotInfo.plotTypes.length; a++) + for (var b = q.plotInfo.plotTypes[a], c = 0; c < b.plotUnits.length; c++) + b.plotUnits[c].targetCanvas = + null; + e = null; + q.disableToolTip = !1 + })) : (0 < q._indexLabels.length && q.renderIndexLabels(), q.dispatchEvent("dataAnimationIterationEnd", {chart: q})); + this.attachPlotAreaEventHandlers(); + this.zoomEnabled || (this.panEnabled || !this._zoomButton || "none" === this._zoomButton.style.display) || X(this._zoomButton, this._resetButton); + this._toolTip._updateToolTip(); + this.renderCount++ + }; + v.prototype.attachPlotAreaEventHandlers = function () { + this.attachEvent({context: this, chart: this, mousedown: this._plotAreaMouseDown, mouseup: this._plotAreaMouseUp, + mousemove: this._plotAreaMouseMove, cursor: this.zoomEnabled ? "col-resize" : "move", cursor:this.panEnabled ? "move" : "default", capture: !0, bounds: this.plotArea}) + }; + v.prototype.categoriseDataSeries = function () { + for (var a = "", c = 0; c < this.data.length; c++) + if (a = this.data[c], a.dataPoints && (0 !== a.dataPoints.length && a.visible) && 0 <= v._supportedChartTypes.indexOf(a.type)) { + for (var b = null, d = !1, e = null, f = !1, g = 0; g < this.plotInfo.plotTypes.length; g++) + if (this.plotInfo.plotTypes[g].type === a.type) { + d = !0; + b = this.plotInfo.plotTypes[g]; + break + } + d || (b = {type: a.type, totalDataSeries: 0, plotUnits: []}, this.plotInfo.plotTypes.push(b)); + for (g = 0; g < b.plotUnits.length; g++) + if (b.plotUnits[g].axisYType === a.axisYType) { + f = !0; + e = b.plotUnits[g]; + break + } + f || (e = {type: a.type, previousDataSeriesCount: 0, index: b.plotUnits.length, plotType: b, axisYType: a.axisYType, axisY: "primary" === a.axisYType ? this.axisY : this.axisY2, axisX: this.axisX, dataSeriesIndexes: [], yTotals: []}, b.plotUnits.push(e)); + b.totalDataSeries++; + e.dataSeriesIndexes.push(c); + a.plotUnit = e + } + for (c = 0; c < this.plotInfo.plotTypes.length; c++) + for (b = + this.plotInfo.plotTypes[c], g = a = 0; g < b.plotUnits.length; g++) + b.plotUnits[g].previousDataSeriesCount = a, a += b.plotUnits[g].dataSeriesIndexes.length + }; + v.prototype.assignIdToDataPoints = function () { + for (var a = 0; a < this.data.length; a++) { + var c = this.data[a]; + if (c.dataPoints) + for (var b = c.dataPoints.length, d = 0; d < b; d++) + c.dataPointIds[d] = ++this._eventManager.lastObjectId + } + }; + v.prototype._processData = function () { + this.assignIdToDataPoints(); + this.categoriseDataSeries(); + for (var a = 0; a < this.plotInfo.plotTypes.length; a++) + for (var c = + this.plotInfo.plotTypes[a], b = 0; b < c.plotUnits.length; b++) { + var d = c.plotUnits[b]; + "line" === d.type || "stepLine" === d.type || "spline" === d.type || "column" === d.type || "area" === d.type || "stepArea" === d.type || "splineArea" === d.type || "bar" === d.type || "bubble" === d.type || "scatter" === d.type ? this._processMultiseriesPlotUnit(d) : "stackedColumn" === d.type || "stackedBar" === d.type || "stackedArea" === d.type ? this._processStackedPlotUnit(d) : "stackedColumn100" === d.type || "stackedBar100" === d.type || "stackedArea100" === d.type ? this._processStacked100PlotUnit(d) : + "candlestick" !== d.type && "ohlc" !== d.type && "rangeColumn" !== d.type && "rangeBar" !== d.type && "rangeArea" !== d.type && "rangeSplineArea" !== d.type || this._processMultiYPlotUnit(d) + } + }; + v.prototype._processMultiseriesPlotUnit = function (a) { + if (a.dataSeriesIndexes && !(1 > a.dataSeriesIndexes.length)) + for (var c = a.axisY.dataInfo, b = a.axisX.dataInfo, d, e, f = !1, g = 0; g < a.dataSeriesIndexes.length; g++) { + var h = this.data[a.dataSeriesIndexes[g]], q = 0, k = !1, n = !1, m; + if ("normal" === h.axisPlacement || "xySwapped" === h.axisPlacement) + var l = this.sessionVariables.axisX.newViewportMinimum ? + this.sessionVariables.axisX.newViewportMinimum : this._options.axisX && this._options.axisX.viewportMinimum ? this._options.axisX.viewportMinimum : this._options.axisX && this._options.axisX.minimum ? this._options.axisX.minimum : -Infinity, p = this.sessionVariables.axisX.newViewportMaximum ? this.sessionVariables.axisX.newViewportMaximum : this._options.axisX && this._options.axisX.viewportMaximum ? this._options.axisX.viewportMaximum : this._options.axisX && this._options.axisX.maximum ? this._options.axisX.maximum : Infinity; + if (h.dataPoints[q].x && h.dataPoints[q].x.getTime || "dateTime" === h.xValueType) + f = !0; + for (q = 0; q < h.dataPoints.length; q++) { + "undefined" === typeof h.dataPoints[q].x && (h.dataPoints[q].x = q); + h.dataPoints[q].x.getTime ? (f = !0, d = h.dataPoints[q].x.getTime()) : d = h.dataPoints[q].x; + e = h.dataPoints[q].y; + d < b.min && (b.min = d); + d > b.max && (b.max = d); + e < c.min && (c.min = e); + e > c.max && (c.max = e); + if (0 < q) { + var r = d - h.dataPoints[q - 1].x; + 0 > r && (r *= -1); + b.minDiff > r && 0 !== r && (b.minDiff = r); + null !== e && null !== h.dataPoints[q - 1].y && (r = e - h.dataPoints[q - 1].y, + 0 > r && (r *= -1), c.minDiff > r && 0 !== r && (c.minDiff = r)) + } + if (d < l && !k) + null !== e && (m = d); + else { + if (!k && (k = !0, 0 < q)) { + q -= 2; + continue + } + if (d > p && !n) + n = !0; + else if (d > p && n) + continue; + h.dataPoints[q].label && (a.axisX.labels[d] = h.dataPoints[q].label); + d < b.viewPortMin && (b.viewPortMin = d); + d > b.viewPortMax && (b.viewPortMax = d); + null === e ? b.viewPortMin === d && m < d && (b.viewPortMin = m) : (e < c.viewPortMin && (c.viewPortMin = e), e > c.viewPortMax && (c.viewPortMax = e)) + } + } + this.plotInfo.axisXValueType = h.xValueType = f ? "dateTime" : "number" + } + }; + v.prototype._processStackedPlotUnit = + function (a) { + if (a.dataSeriesIndexes && !(1 > a.dataSeriesIndexes.length)) { + for (var c = a.axisY.dataInfo, b = a.axisX.dataInfo, d, e, f = !1, g = [], h = [], q = Infinity, k = 0; k < a.dataSeriesIndexes.length; k++) { + var n = this.data[a.dataSeriesIndexes[k]], m = 0, l = !1, p = !1, r; + if ("normal" === n.axisPlacement || "xySwapped" === n.axisPlacement) + var t = this.sessionVariables.axisX.newViewportMinimum ? this.sessionVariables.axisX.newViewportMinimum : this._options.axisX && this._options.axisX.viewportMinimum ? this._options.axisX.viewportMinimum : this._options.axisX && + this._options.axisX.minimum ? this._options.axisX.minimum : -Infinity, y = this.sessionVariables.axisX.newViewportMaximum ? this.sessionVariables.axisX.newViewportMaximum : this._options.axisX && this._options.axisX.viewportMaximum ? this._options.axisX.viewportMaximum : this._options.axisX && this._options.axisX.maximum ? this._options.axisX.maximum : Infinity; + if (n.dataPoints[m].x && n.dataPoints[m].x.getTime || "dateTime" === n.xValueType) + f = !0; + for (m = 0; m < n.dataPoints.length; m++) { + "undefined" === typeof n.dataPoints[m].x && (n.dataPoints[m].x = + m); + n.dataPoints[m].x.getTime ? (f = !0, d = n.dataPoints[m].x.getTime()) : d = n.dataPoints[m].x; + x(n.dataPoints[m].y) ? e = 0 : (e = n.dataPoints[m].y, 0 === k && (q = Math.min(e, q))); + d < b.min && (b.min = d); + d > b.max && (b.max = d); + if (0 < m) { + var s = d - n.dataPoints[m - 1].x; + 0 > s && (s *= -1); + b.minDiff > s && 0 !== s && (b.minDiff = s); + null !== e && null !== n.dataPoints[m - 1].y && (s = e - n.dataPoints[m - 1].y, 0 > s && (s *= -1), c.minDiff > s && 0 !== s && (c.minDiff = s)) + } + if (d < t && !l) + null !== n.dataPoints[m].y && (r = d); + else { + if (!l && (l = !0, 0 < m)) { + m -= 2; + continue + } + if (d > y && !p) + p = !0; + else if (d > y && p) + continue; + n.dataPoints[m].label && (a.axisX.labels[d] = n.dataPoints[m].label); + d < b.viewPortMin && (b.viewPortMin = d); + d > b.viewPortMax && (b.viewPortMax = d); + null === n.dataPoints[m].y ? b.viewPortMin === d && r < d && (b.viewPortMin = r) : (a.yTotals[d] = (a.yTotals[d] ? a.yTotals[d] : 0) + Math.abs(e), 0 <= e ? g[d] = g[d] ? g[d] + e : e : h[d] = h[d] ? h[d] + e : e) + } + } + this.plotInfo.axisXValueType = n.xValueType = f ? "dateTime" : "number" + } + for (m in g) + g.hasOwnProperty(m) && !isNaN(m) && (a = g[m], a < c.min && (c.min = Math.min(a, q)), a > c.max && (c.max = a), m < b.viewPortMin || m > b.viewPortMax || + (a < c.viewPortMin && (c.viewPortMin = Math.min(a, q)), a > c.viewPortMax && (c.viewPortMax = a))); + for (m in h) + h.hasOwnProperty(m) && !isNaN(m) && (a = h[m], a < c.min && (c.min = Math.min(a, q)), a > c.max && (c.max = a), m < b.viewPortMin || m > b.viewPortMax || (a < c.viewPortMin && (c.viewPortMin = Math.min(a, q)), a > c.viewPortMax && (c.viewPortMax = a))) + } + }; + v.prototype._processStacked100PlotUnit = function (a) { + if (a.dataSeriesIndexes && !(1 > a.dataSeriesIndexes.length)) { + for (var c = a.axisY.dataInfo, b = a.axisX.dataInfo, d, e, f = !1, g = !1, h = !1, q = [], k = 0; k < a.dataSeriesIndexes.length; k++) { + var n = + this.data[a.dataSeriesIndexes[k]], m = 0, l = !1, p = !1, r; + if ("normal" === n.axisPlacement || "xySwapped" === n.axisPlacement) + var t = this.sessionVariables.axisX.newViewportMinimum ? this.sessionVariables.axisX.newViewportMinimum : this._options.axisX && this._options.axisX.viewportMinimum ? this._options.axisX.viewportMinimum : this._options.axisX && this._options.axisX.minimum ? this._options.axisX.minimum : -Infinity, y = this.sessionVariables.axisX.newViewportMaximum ? this.sessionVariables.axisX.newViewportMaximum : this._options.axisX && + this._options.axisX.viewportMaximum ? this._options.axisX.viewportMaximum : this._options.axisX && this._options.axisX.maximum ? this._options.axisX.maximum : Infinity; + if (n.dataPoints[m].x && n.dataPoints[m].x.getTime || "dateTime" === n.xValueType) + f = !0; + for (m = 0; m < n.dataPoints.length; m++) { + "undefined" === typeof n.dataPoints[m].x && (n.dataPoints[m].x = m); + n.dataPoints[m].x.getTime ? (f = !0, d = n.dataPoints[m].x.getTime()) : d = n.dataPoints[m].x; + e = x(n.dataPoints[m].y) ? null : n.dataPoints[m].y; + d < b.min && (b.min = d); + d > b.max && (b.max = d); + if (0 < m) { + var s = d - n.dataPoints[m - 1].x; + 0 > s && (s *= -1); + b.minDiff > s && 0 !== s && (b.minDiff = s); + x(e) || null === n.dataPoints[m - 1].y || (s = e - n.dataPoints[m - 1].y, 0 > s && (s *= -1), c.minDiff > s && 0 !== s && (c.minDiff = s)) + } + if (d < t && !l) + null !== e && (r = d); + else { + if (!l && (l = !0, 0 < m)) { + m -= 2; + continue + } + if (d > y && !p) + p = !0; + else if (d > y && p) + continue; + n.dataPoints[m].label && (a.axisX.labels[d] = n.dataPoints[m].label); + d < b.viewPortMin && (b.viewPortMin = d); + d > b.viewPortMax && (b.viewPortMax = d); + null === e ? b.viewPortMin === d && r < d && (b.viewPortMin = r) : (a.yTotals[d] = (a.yTotals[d] ? + a.yTotals[d] : 0) + Math.abs(e), 0 <= e ? g = !0 : 0 > e && (h = !0), q[d] = q[d] ? q[d] + Math.abs(e) : Math.abs(e)) + } + } + this.plotInfo.axisXValueType = n.xValueType = f ? "dateTime" : "number" + } + g && !h ? (c.max = x(c.viewPortMax) ? 99 : Math.max(c.viewPortMax, 99), c.min = x(c.viewPortMin) ? 1 : Math.min(c.viewPortMin, 1)) : g && h ? (c.max = x(c.viewPortMax) ? 99 : Math.max(c.viewPortMax, 99), c.min = x(c.viewPortMin) ? -99 : Math.min(c.viewPortMin, -99)) : !g && h && (c.max = x(c.viewPortMax) ? -1 : Math.max(c.viewPortMax, -1), c.min = x(c.viewPortMin) ? -99 : Math.min(c.viewPortMin, -99)); + c.viewPortMin = + c.min; + c.viewPortMax = c.max; + a.dataPointYSums = q + } + }; + v.prototype._processMultiYPlotUnit = function (a) { + if (a.dataSeriesIndexes && !(1 > a.dataSeriesIndexes.length)) + for (var c = a.axisY.dataInfo, b = a.axisX.dataInfo, d, e, f, g, h = !1, q = 0; q < a.dataSeriesIndexes.length; q++) { + var k = this.data[a.dataSeriesIndexes[q]], n = 0, m = !1, l = !1, p, r, t; + if ("normal" === k.axisPlacement || "xySwapped" === k.axisPlacement) + var y = this.sessionVariables.axisX.newViewportMinimum ? this.sessionVariables.axisX.newViewportMinimum : this._options.axisX && this._options.axisX.viewportMinimum ? + this._options.axisX.viewportMinimum : this._options.axisX && this._options.axisX.minimum ? this._options.axisX.minimum : -Infinity, s = this.sessionVariables.axisX.newViewportMaximum ? this.sessionVariables.axisX.newViewportMaximum : this._options.axisX && this._options.axisX.viewportMaximum ? this._options.axisX.viewportMaximum : this._options.axisX && this._options.axisX.maximum ? this._options.axisX.maximum : Infinity; + if (k.dataPoints[n].x && k.dataPoints[n].x.getTime || "dateTime" === k.xValueType) + h = !0; + for (n = 0; n < k.dataPoints.length; n++) { + "undefined" === + typeof k.dataPoints[n].x && (k.dataPoints[n].x = n); + k.dataPoints[n].x.getTime ? (h = !0, d = k.dataPoints[n].x.getTime()) : d = k.dataPoints[n].x; + if ((e = k.dataPoints[n].y) && e.length) { + f = Math.min.apply(null, e); + g = Math.max.apply(null, e); + r = !0; + for (var z = 0; z < e.length; z++) + null === e.k && (r = !1); + r && (m || (t = p), p = d) + } + d < b.min && (b.min = d); + d > b.max && (b.max = d); + f < c.min && (c.min = f); + g > c.max && (c.max = g); + 0 < n && (r = d - k.dataPoints[n - 1].x, 0 > r && (r *= -1), b.minDiff > r && 0 !== r && (b.minDiff = r), e && (null !== e[0] && k.dataPoints[n - 1].y && null !== k.dataPoints[n - 1].y[0]) && + (r = e[0] - k.dataPoints[n - 1].y[0], 0 > r && (r *= -1), c.minDiff > r && 0 !== r && (c.minDiff = r))); + if (!(d < y) || m) { + if (!m && (m = !0, 0 < n)) { + n -= 2; + p = t; + continue + } + if (d > s && !l) + l = !0; + else if (d > s && l) + continue; + k.dataPoints[n].label && (a.axisX.labels[d] = k.dataPoints[n].label); + d < b.viewPortMin && (b.viewPortMin = d); + d > b.viewPortMax && (b.viewPortMax = d); + if (b.viewPortMin === d && e) + for (z = 0; z < e.length; z++) + if (null === e[z] && p < d) { + b.viewPortMin = p; + break + } + null === e ? b.viewPortMin === d && p < d && (b.viewPortMin = p) : (f < c.viewPortMin && (c.viewPortMin = f), g > c.viewPortMax && (c.viewPortMax = + g)) + } + } + this.plotInfo.axisXValueType = k.xValueType = h ? "dateTime" : "number" + } + }; + v.prototype.getDataPointAtXY = function (a, c, b) { + b = b || !1; + for (var d = [], e = this._dataInRenderedOrder.length - 1; 0 <= e; e--) { + var f = null; + (f = this._dataInRenderedOrder[e].getDataPointAtXY(a, c, b)) && d.push(f) + } + a = null; + c = !1; + for (b = 0; b < d.length; b++) + if ("line" === d[b].dataSeries.type || "stepLine" === d[b].dataSeries.type || "area" === d[b].dataSeries.type || "stepArea" === d[b].dataSeries.type) + if (e = R("markerSize", d[b].dataPoint, d[b].dataSeries) || 8, d[b].distance <= + e / 2) { + c = !0; + break + } + for (b = 0; b < d.length; b++) + c && "line" !== d[b].dataSeries.type && "stepLine" !== d[b].dataSeries.type && "area" !== d[b].dataSeries.type && "stepArea" !== d[b].dataSeries.type || (a ? d[b].distance <= a.distance && (a = d[b]) : a = d[b]); + return a + }; + v.prototype.getObjectAtXY = function (a, c, b) { + var d = null; + if (b = this.getDataPointAtXY(a, c, b || !1)) + d = b.dataSeries.dataPointIds[b.dataPointIndex]; + else if (u) + d = Ea(a, c, this._eventManager.ghostCtx); + else + for (b = 0; b < this.legend.items.length; b++) { + var e = this.legend.items[b]; + a >= e.x1 && (a <= + e.x2 && c >= e.y1 && c <= e.y2) && (d = e.id) + } + return d + }; + v.prototype.getAutoFontSize = function (a, c, b) { + a /= 400; + return Math.round(Math.min(this.width, this.height) * a) + }; + v.prototype.resetOverlayedCanvas = function () { + this.overlaidCanvasCtx.clearRect(0, 0, this.width, this.height) + }; + v.prototype.clearCanvas = function () { + this.ctx.clearRect(0, 0, this.width, this.height); + this.backgroundColor && (this.ctx.fillStyle = this.backgroundColor, this.ctx.fillRect(0, 0, this.width, this.height)) + }; + v.prototype.attachEvent = function (a) { + this._events.push(a) + }; + v.prototype._touchEventHandler = function (a) { + if (a.changedTouches && this.interactivityEnabled) { + var c = [], b = a.changedTouches, d = b ? b[0] : a, e = null; + switch (a.type) { + case "touchstart": + case "MSPointerDown": + c = ["mousemove", "mousedown"]; + this._lastTouchData = ra(d); + this._lastTouchData.time = new Date; + break; + case "touchmove": + case "MSPointerMove": + c = ["mousemove"]; + break; + case "touchend": + case "MSPointerUp": + c = "touchstart" === this._lastTouchEventType || "MSPointerDown" === this._lastTouchEventType ? ["mouseup", "click"] : ["mouseup"]; + break; + default: + return + } + if (!(b && 1 < b.length)) { + e = ra(d); + e.time = new Date; + try { + var f = e.y - this._lastTouchData.y, g = e.time - this._lastTouchData.time; + if (15 < Math.abs(f) && (this._lastTouchData.scroll || 200 > g)) { + this._lastTouchData.scroll = !0; + var h = window.parent || window; + h && h.scrollBy && h.scrollBy(0, -f) + } + } catch (q) { + } + this._lastTouchEventType = a.type; + if (this._lastTouchData.scroll && this.zoomEnabled) + this.isDrag && this.resetOverlayedCanvas(), this.isDrag = !1; + else + for (b = 0; b < c.length; b++) + e = c[b], f = document.createEvent("MouseEvent"), f.initMouseEvent(e, + !0, !0, window, 1, d.screenX, d.screenY, d.clientX, d.clientY, !1, !1, !1, !1, 0, null), d.target.dispatchEvent(f), a.preventManipulation && a.preventManipulation(), a.preventDefault && a.preventDefault() + } + } + }; + v.prototype._dispatchRangeEvent = function (a, c) { + var b = {}; + b.chart = this._publicChartReference; + b.type = a; + b.trigger = c; + var d = []; + this.axisX && d.push("axisX"); + this.axisY && d.push("axisY"); + this.axisY2 && d.push("axisY2"); + for (var e = 0; e < d.length; e++) + b[d[e]] = {viewportMinimum: this[d[e]].sessionVariables.newViewportMinimum, viewportMaximum: this[d[e]].sessionVariables.newViewportMaximum}; + this.dispatchEvent(a, b, this._publicChartReference) + }; + v.prototype._mouseEventHandler = function (a) { + if (this.interactivityEnabled) + if (this._ignoreNextEvent) + this._ignoreNextEvent = !1; + else { + a.preventManipulation && a.preventManipulation(); + a.preventDefault && a.preventDefault(); + "undefined" === typeof a.target && a.srcElement && (a.target = a.srcElement); + var c = ra(a), b = a.type, d, e; + a.which ? e = 3 == a.which : a.button && (e = 2 == a.button); + if (!e) { + if (v.capturedEventParam) + d = v.capturedEventParam, "mouseup" === b && (v.capturedEventParam = null, d.chart.overlaidCanvas.releaseCapture ? + d.chart.overlaidCanvas.releaseCapture() : document.body.removeEventListener("mouseup", d.chart._mouseEventHandler, !1)), d.hasOwnProperty(b) && d[b].call(d.context, c.x, c.y); + else if (this._events) { + for (e = 0; e < this._events.length; e++) + if (this._events[e].hasOwnProperty(b)) { + d = this._events[e]; + var f = d.bounds; + if (c.x >= f.x1 && c.x <= f.x2 && c.y >= f.y1 && c.y <= f.y2) { + d[b].call(d.context, c.x, c.y); + "mousedown" === b && !0 === d.capture ? (v.capturedEventParam = d, this.overlaidCanvas.setCapture ? this.overlaidCanvas.setCapture() : document.body.addEventListener("mouseup", + this._mouseEventHandler, !1)) : "mouseup" === b && (d.chart.overlaidCanvas.releaseCapture ? d.chart.overlaidCanvas.releaseCapture() : document.body.removeEventListener("mouseup", this._mouseEventHandler, !1)); + break + } else + d = null + } + a.target.style.cursor = d && d.cursor ? d.cursor : this._defaultCursor + } + this._toolTip && this._toolTip.enabled && (b = this.plotArea, (c.x < b.x1 || c.x > b.x2 || c.y < b.y1 || c.y > b.y2) && this._toolTip.hide()); + this.isDrag && this.zoomEnabled || !this._eventManager || this._eventManager.mouseEventHandler(a) + } + } + }; + v.prototype._plotAreaMouseDown = + function (a, c) { + this.isDrag = !0; + this.dragStartPoint = {x: a, y: c} + }; + v.prototype._plotAreaMouseUp = function (a, c) { + if (("normal" === this.plotInfo.axisPlacement || "xySwapped" === this.plotInfo.axisPlacement) && this.isDrag) { + var b = c - this.dragStartPoint.y, d = a - this.dragStartPoint.x, e = 0 <= this.zoomType.indexOf("x"), f = 0 <= this.zoomType.indexOf("y"), g = !1; + this.resetOverlayedCanvas(); + if ("xySwapped" === this.plotInfo.axisPlacement) + var h = f, f = e, e = h; + if (this.panEnabled || this.zoomEnabled) { + if (this.panEnabled) + for (e = f = 0; e < this._axes.length; e++) + b = + this._axes[e], b.viewportMinimum < b.minimum ? (f = b.minimum - b.viewportMinimum, b.sessionVariables.newViewportMinimum = b.viewportMinimum + f, b.sessionVariables.newViewportMaximum = b.viewportMaximum + f, g = !0) : b.viewportMaximum > b.maximum && (f = b.viewportMaximum - b.maximum, b.sessionVariables.newViewportMinimum = b.viewportMinimum - f, b.sessionVariables.newViewportMaximum = b.viewportMaximum - f, g = !0); + else if ((!e || 2 < Math.abs(d)) && (!f || 2 < Math.abs(b)) && this.zoomEnabled) { + if (!this.dragStartPoint) + return; + b = e ? this.dragStartPoint.x : + this.plotArea.x1; + d = f ? this.dragStartPoint.y : this.plotArea.y1; + e = e ? a : this.plotArea.x2; + f = f ? c : this.plotArea.y2; + 2 < Math.abs(b - e) && 2 < Math.abs(d - f) && this._zoomPanToSelectedRegion(b, d, e, f) && (g = !0) + } + g && (this._ignoreNextEvent = !0, this._dispatchRangeEvent("rangeChanging", "zoom"), this.render(), this._dispatchRangeEvent("rangeChanged", "zoom"), g && (this.zoomEnabled && "none" === this._zoomButton.style.display) && (la(this._zoomButton, this._resetButton), U(this, this._zoomButton, "pan"), U(this, this._resetButton, "reset"))) + } + } + this.isDrag = + !1 + }; + v.prototype._plotAreaMouseMove = function (a, c) { + if (this.isDrag && "none" !== this.plotInfo.axisPlacement) { + var b = 0, d = 0, e = b = null, e = 0 <= this.zoomType.indexOf("x"), f = 0 <= this.zoomType.indexOf("y"); + "xySwapped" === this.plotInfo.axisPlacement && (b = f, f = e, e = b); + b = this.dragStartPoint.x - a; + d = this.dragStartPoint.y - c; + 2 < Math.abs(b) && 8 > Math.abs(b) && (this.panEnabled || this.zoomEnabled) ? this._toolTip.hide() : this.panEnabled || this.zoomEnabled || this._toolTip.mouseMoveHandler(a, c); + if ((!e || 2 < Math.abs(b) || !f || 2 < Math.abs(d)) && (this.panEnabled || + this.zoomEnabled)) + if (this.panEnabled) + e = {x1: e ? this.plotArea.x1 + b : this.plotArea.x1, y1: f ? this.plotArea.y1 + d : this.plotArea.y1, x2: e ? this.plotArea.x2 + b : this.plotArea.x2, y2: f ? this.plotArea.y2 + d : this.plotArea.y2}, this._zoomPanToSelectedRegion(e.x1, e.y1, e.x2, e.y2, !0) && (this._dispatchRangeEvent("rangeChanging", "pan"), this.render(), this._dispatchRangeEvent("rangeChanged", "pan"), this.dragStartPoint.x = a, this.dragStartPoint.y = c); + else if (this.zoomEnabled) { + this.resetOverlayedCanvas(); + b = this.overlaidCanvasCtx.globalAlpha; + this.overlaidCanvasCtx.fillStyle = "#A89896"; + var d = e ? this.dragStartPoint.x : this.plotArea.x1, g = f ? this.dragStartPoint.y : this.plotArea.y1, h = e ? a - this.dragStartPoint.x : this.plotArea.x2 - this.plotArea.x1, q = f ? c - this.dragStartPoint.y : this.plotArea.y2 - this.plotArea.y1; + this.validateRegion(d, g, e ? a : this.plotArea.x2 - this.plotArea.x1, f ? c : this.plotArea.y2 - this.plotArea.y1, "xy" !== this.zoomType).isValid && (this.resetOverlayedCanvas(), this.overlaidCanvasCtx.fillStyle = "#99B2B5"); + this.overlaidCanvasCtx.globalAlpha = 0.7; + this.overlaidCanvasCtx.fillRect(d, + g, h, q); + this.overlaidCanvasCtx.globalAlpha = b + } + } else + this._toolTip.mouseMoveHandler(a, c) + }; + v.prototype._zoomPanToSelectedRegion = function (a, c, b, d, e) { + a = this.validateRegion(a, c, b, d, e); + c = a.axesWithValidRange; + b = a.axesRanges; + if (a.isValid) + for (d = 0; d < c.length; d++) + e = b[d], c[d].setViewPortRange(e.val1, e.val2); + return a.isValid + }; + v.prototype.validateRegion = function (a, c, b, d, e) { + e = e || !1; + var f = 0 <= this.zoomType.indexOf("x"), g = 0 <= this.zoomType.indexOf("y"), h = !1, q = [], k = [], n = []; + this.axisX && f && k.push(this.axisX); + this.axisY && + g && k.push(this.axisY); + this.axisY2 && g && k.push(this.axisY2); + for (f = 0; f < k.length; f++) { + var g = k[f], m = g.convertPixelToValue({x: a, y: c}), l = g.convertPixelToValue({x: b, y: d}); + if (m > l) + var p = l, l = m, m = p; + if (isFinite(g.dataInfo.minDiff)) + if (!(Math.abs(l - m) < 3 * Math.abs(g.dataInfo.minDiff) || m < g.minimum || l > g.maximum)) + q.push(g), n.push({val1: m, val2: l}), h = !0; + else if (!e) { + h = !1; + break + } + } + return{isValid: h, axesWithValidRange: q, axesRanges: n} + }; + v.prototype.preparePlotArea = function () { + var a = this.plotArea, c = this.axisY ? this.axisY : this.axisY2; + !u && (0 < a.x1 || 0 < a.y1) && a.ctx.translate(a.x1, a.y1); + this.axisX && c ? (a.x1 = this.axisX.lineCoordinates.x1 < this.axisX.lineCoordinates.x2 ? this.axisX.lineCoordinates.x1 : c.lineCoordinates.x1, a.y1 = this.axisX.lineCoordinates.y1 < c.lineCoordinates.y1 ? this.axisX.lineCoordinates.y1 : c.lineCoordinates.y1, a.x2 = this.axisX.lineCoordinates.x2 > c.lineCoordinates.x2 ? this.axisX.lineCoordinates.x2 : c.lineCoordinates.x2, a.y2 = this.axisX.lineCoordinates.y2 > this.axisX.lineCoordinates.y1 ? this.axisX.lineCoordinates.y2 : c.lineCoordinates.y2, + a.width = a.x2 - a.x1, a.height = a.y2 - a.y1) : (c = this.layoutManager.getFreeSpace(), a.x1 = c.x1, a.x2 = c.x2, a.y1 = c.y1, a.y2 = c.y2, a.width = c.width, a.height = c.height); + u || (a.canvas.width = a.width, a.canvas.height = a.height, a.canvas.style.left = a.x1 + "px", a.canvas.style.top = a.y1 + "px", (0 < a.x1 || 0 < a.y1) && a.ctx.translate(-a.x1, -a.y1)); + a.layoutManager = new da(a.x1, a.y1, a.x2, a.y2, 2) + }; + v.prototype.getPixelCoordinatesOnPlotArea = function (a, c) { + return{x: this.axisX.getPixelCoordinatesOnAxis(a).x, y: this.axisY.getPixelCoordinatesOnAxis(c).y} + }; + v.prototype.renderIndexLabels = function (a) { + a = a || this.plotArea.ctx; + for (var c = this.plotArea, b = 0, d = 0, e = 0, f = 0, g = b = f = d = e = 0, h = 0, q = 0; q < this._indexLabels.length; q++) { + var k = this._indexLabels[q], n = k.chartType.toLowerCase(), m, l, p = R("indexLabelFontColor", k.dataPoint, k.dataSeries), g = R("indexLabelFontSize", k.dataPoint, k.dataSeries), h = R("indexLabelFontFamily", k.dataPoint, k.dataSeries); + m = R("indexLabelFontStyle", k.dataPoint, k.dataSeries); + l = R("indexLabelFontWeight", k.dataPoint, k.dataSeries); + var f = R("indexLabelBackgroundColor", + k.dataPoint, k.dataSeries), d = R("indexLabelMaxWidth", k.dataPoint, k.dataSeries), e = R("indexLabelWrap", k.dataPoint, k.dataSeries), r = R("indexLabelLineDashType", k.dataPoint, k.dataSeries), t = R("indexLabelLineColor", k.dataPoint, k.dataSeries), y = x(k.dataPoint.indexLabelLineThickness) ? x(k.dataSeries._options.indexLabelLineThickness) ? 0 : k.dataSeries._options.indexLabelLineThickness : k.dataPoint.indexLabelLineThickness, b = 0 < y ? Math.min(10, ("normal" === this.plotInfo.axisPlacement ? this.plotArea.height : this.plotArea.width) << + 0) : 0, s = {percent: null, total: null}, z = null; + if (0 <= k.dataSeries.type.indexOf("stacked") || "pie" === k.dataSeries.type || "doughnut" === k.dataSeries.type) + s = this.getPercentAndTotal(k.dataSeries, k.dataPoint); + if (k.dataSeries.indexLabelFormatter || k.dataPoint.indexLabelFormatter) + z = {chart: this._publicChartReference, dataSeries: k.dataSeries, dataPoint: k.dataPoint, index: k.indexKeyword, total: s.total, percent: s.percent}; + var w = k.dataPoint.indexLabelFormatter ? k.dataPoint.indexLabelFormatter(z) : k.dataPoint.indexLabel ? this.replaceKeywordsWithValue(k.dataPoint.indexLabel, + k.dataPoint, k.dataSeries, null, k.indexKeyword) : k.dataSeries.indexLabelFormatter ? k.dataSeries.indexLabelFormatter(z) : k.dataSeries.indexLabel ? this.replaceKeywordsWithValue(k.dataSeries.indexLabel, k.dataPoint, k.dataSeries, null, k.indexKeyword) : null; + if (null !== w && "" !== w) { + var s = R("indexLabelPlacement", k.dataPoint, k.dataSeries), z = R("indexLabelOrientation", k.dataPoint, k.dataSeries), u = k.direction, W = k.dataSeries.axisX, A = k.dataSeries.axisY, v = !1, p = new O(a, {x: 0, y: 0, maxWidth: d ? d : 0.5 * this.width, maxHeight: e ? 5 * g : 1.5 * + g, angle: "horizontal" === z ? 0 : -90, text: w, padding: 0, backgroundColor: f, horizontalAlign: "left", fontSize: g, fontFamily: h, fontWeight: l, fontColor: p, fontStyle: m, textBaseline: "top"}); + p.measureText(); + if (0 <= n.indexOf("line") || 0 <= n.indexOf("area") || 0 <= n.indexOf("bubble") || 0 <= n.indexOf("scatter")) { + if (k.dataPoint.x < W.viewportMinimum || k.dataPoint.x > W.viewportMaximum || k.dataPoint.y < A.viewportMinimum || k.dataPoint.y > A.viewportMaximum) + continue + } else if (0 <= n.indexOf("column")) { + if (k.dataPoint.x < W.viewportMinimum || k.dataPoint.x > + W.viewportMaximum || k.bounds.y1 > c.y2 || k.bounds.y2 < c.y1) + continue + } else if (0 <= n.indexOf("bar")) { + if (k.dataPoint.x < W.viewportMinimum || k.dataPoint.x > W.viewportMaximum || k.bounds.x1 > c.x2 || k.bounds.x2 < c.x1) + continue + } else if (k.dataPoint.x < W.viewportMinimum || k.dataPoint.x > W.viewportMaximum) + continue; + d = f = 2; + "horizontal" === z ? (g = p.width, h = p.height) : (h = p.width, g = p.height); + if ("normal" === this.plotInfo.axisPlacement) { + if (0 <= n.indexOf("line") || 0 <= n.indexOf("area")) + s = "auto", f = 4; + else if (0 <= n.indexOf("stacked")) + "auto" === s && + (s = "inside"); + else if ("bubble" === n || "scatter" === n) + s = "inside"; + m = k.point.x - g / 2; + "inside" !== s ? (d = c.y1, e = c.y2, 0 < u ? (l = k.point.y - h - f - b, l < d && (l = "auto" === s ? Math.max(k.point.y, d) + f + b : d + f + b, v = l + h > k.point.y)) : (l = k.point.y + f + b, l > e - h - f - b && (l = "auto" === s ? Math.min(k.point.y, e) - h - f - b : e - h - f - b, v = l < k.point.y))) : (d = Math.max(k.bounds.y1, c.y1), e = Math.min(k.bounds.y2, c.y2), b = 0 <= n.indexOf("range") ? 0 < u ? Math.max(k.bounds.y1, c.y1) + h / 2 + f : Math.min(k.bounds.y2, c.y2) - h / 2 - f : (Math.max(k.bounds.y1, c.y1) + Math.min(k.bounds.y2, c.y2)) / 2, + 0 < u ? (l = Math.max(k.point.y, b) - h / 2, l < d && ("bubble" === n || "scatter" === n) && (l = Math.max(k.point.y - h - f, c.y1 + f))) : (l = Math.min(k.point.y, b) - h / 2, l > e - h - f && ("bubble" === n || "scatter" === n) && (l = Math.min(k.point.y + f, c.y2 - h - f))), l = Math.min(l, e - h)) + } else + 0 <= n.indexOf("line") || 0 <= n.indexOf("area") || 0 <= n.indexOf("scatter") ? (s = "auto", d = 4) : 0 <= n.indexOf("stacked") ? "auto" === s && (s = "inside") : "bubble" === n && (s = "inside"), l = k.point.y - h / 2, "inside" !== s ? (f = c.x1, e = c.x2, 0 > u ? (m = k.point.x - g - d - b, m < f && (m = "auto" === s ? Math.max(k.point.x, f) + + d + b : f + d + b, v = m + g > k.point.x)) : (m = k.point.x + d + b, m > e - g - d - b && (m = "auto" === s ? Math.min(k.point.x, e) - g - d - b : e - g - d - b, v = m < k.point.x))) : (f = Math.max(k.bounds.x1, c.x1), Math.min(k.bounds.x2, c.x2), b = 0 <= n.indexOf("range") ? 0 > u ? Math.max(k.bounds.x1, c.x1) + g / 2 + d : Math.min(k.bounds.x2, c.x2) - g / 2 - d : (Math.max(k.bounds.x1, c.x1) + Math.min(k.bounds.x2, c.x2)) / 2, m = 0 > u ? Math.max(k.point.x, b) - g / 2 : Math.min(k.point.x, b) - g / 2, m = Math.max(m, f)); + "vertical" === z && (l += h); + p.x = m; + p.y = l; + p.render(!0); + y && ("inside" !== s && (0 > n.indexOf("bar") && k.point.x > + c.x1 && k.point.x < c.x2 || !v) && (0 > n.indexOf("column") && k.point.y > c.y1 && k.point.y < c.y2 || !v)) && (a.lineWidth = y, a.strokeStyle = t ? t : "gray", a.setLineDash && a.setLineDash(D(r, y)), a.beginPath(), a.moveTo(k.point.x, k.point.y), 0 <= n.indexOf("bar") ? a.lineTo(m + (0 < k.direction ? 0 : g), l + ("horizontal" === z ? h : -h) / 2) : 0 <= n.indexOf("column") ? a.lineTo(m + g / 2, l + ((0 < k.direction ? h : -h) + ("horizontal" === z ? h : -h)) / 2) : a.lineTo(m + g / 2, l + ((l < k.point.y ? h : -h) + ("horizontal" === z ? h : -h)) / 2), a.stroke()) + } + } + return{source: a, dest: this.plotArea.ctx, animationCallback: B.fadeInAnimation, + easingFunction: B.easing.easeInQuad, animationBase: 0, startTimePercent: 0.7} + }; + v.prototype.renderLine = function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var b = this._eventManager.ghostCtx; + c.save(); + var d = this.plotArea; + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + for (var d = [], e = 0; e < a.dataSeriesIndexes.length; e++) { + var f = a.dataSeriesIndexes[e], g = this.data[f]; + c.lineWidth = g.lineThickness; + var h = g.dataPoints, q = "solid"; + if (c.setLineDash) { + var k = D(g.nullDataLineDashType, + g.lineThickness), q = g.lineDashType, n = D(q, g.lineThickness); + c.setLineDash(n) + } + var m = g.id; + this._eventManager.objectMap[m] = {objectType: "dataSeries", dataSeriesIndex: f}; + m = C(m); + b.strokeStyle = m; + b.lineWidth = 0 < g.lineThickness ? Math.max(g.lineThickness, 4) : 0; + var m = g._colorSet, l = m = g._options.lineColor ? g._options.lineColor : m[0]; + c.strokeStyle = m; + var p = !0, r = 0, t, y; + c.beginPath(); + if (0 < h.length) { + for (var s = !1, r = 0; r < h.length; r++) + if (t = h[r].x.getTime ? h[r].x.getTime() : h[r].x, !(t < a.axisX.dataInfo.viewPortMin || t > a.axisX.dataInfo.viewPortMax && + (!g.connectNullData || !s))) + if ("number" !== typeof h[r].y) + 0 < r && !(g.connectNullData || s || p) && (c.stroke(), u && b.stroke()), s = !0; + else { + t = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (t - a.axisX.conversionParameters.minimum) + 0.5 << 0; + y = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (h[r].y - a.axisY.conversionParameters.minimum) + 0.5 << 0; + var z = g.dataPointIds[r]; + this._eventManager.objectMap[z] = {id: z, objectType: "dataPoint", dataSeriesIndex: f, dataPointIndex: r, + x1: t, y1: y}; + p || s ? (!p && g.connectNullData ? (c.setLineDash && (g._options.nullDataLineDashType || q === g.lineDashType && g.lineDashType !== g.nullDataLineDashType) && (c.stroke(), q = g.nullDataLineDashType, c.setLineDash(k)), c.lineTo(t, y), u && b.lineTo(t, y)) : (c.beginPath(), c.moveTo(t, y), u && (b.beginPath(), b.moveTo(t, y))), s = p = !1) : (c.lineTo(t, y), u && b.lineTo(t, y), 0 == r % 500 && (c.stroke(), c.beginPath(), c.moveTo(t, y), u && (b.stroke(), b.beginPath(), b.moveTo(t, y)))); + r < h.length - 1 && (l !== (h[r].lineColor || m) || q !== (h[r].lineDashType || + g.lineDashType)) && (c.stroke(), c.beginPath(), c.moveTo(t, y), l = h[r].lineColor || m, c.strokeStyle = l, c.setLineDash && (h[r].lineDashType ? (q = h[r].lineDashType, c.setLineDash(D(q, g.lineThickness))) : (q = g.lineDashType, c.setLineDash(n)))); + if (0 < h[r].markerSize || 0 < g.markerSize) { + var w = g.getMarkerProperties(r, t, y, c); + d.push(w); + z = C(z); + u && d.push({x: t, y: y, ctx: b, type: w.type, size: w.size, color: z, borderColor: z, borderThickness: w.borderThickness}) + } + (h[r].indexLabel || g.indexLabel || h[r].indexLabelFormatter || g.indexLabelFormatter) && + this._indexLabels.push({chartType: "line", dataPoint: h[r], dataSeries: g, point: {x: t, y: y}, direction: 0 <= h[r].y ? 1 : -1, color: m}) + } + c.stroke(); + u && b.stroke() + } + } + P.drawMarkers(d); + c.restore(); + c.beginPath(); + u && b.beginPath(); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.xClipAnimation, easingFunction: B.easing.linear, animationBase: 0} + } + }; + v.prototype.renderStepLine = function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var b = this._eventManager.ghostCtx; + c.save(); + var d = this.plotArea; + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + for (var d = [], e = 0; e < a.dataSeriesIndexes.length; e++) { + var f = a.dataSeriesIndexes[e], g = this.data[f]; + c.lineWidth = g.lineThickness; + var h = g.dataPoints, q = "solid"; + if (c.setLineDash) { + var k = D(g.nullDataLineDashType, g.lineThickness), q = g.lineDashType, n = D(q, g.lineThickness); + c.setLineDash(n) + } + var m = g.id; + this._eventManager.objectMap[m] = {objectType: "dataSeries", dataSeriesIndex: f}; + m = C(m); + b.strokeStyle = m; + b.lineWidth = 0 < g.lineThickness ? Math.max(g.lineThickness, 4) : + 0; + var m = g._colorSet, l = m = g._options.lineColor ? g._options.lineColor : m[0]; + c.strokeStyle = m; + var p = !0, r = 0, t, y; + c.beginPath(); + if (0 < h.length) { + for (var s = !1, r = 0; r < h.length; r++) + if (t = h[r].getTime ? h[r].x.getTime() : h[r].x, !(t < a.axisX.dataInfo.viewPortMin || t > a.axisX.dataInfo.viewPortMax && (!g.connectNullData || !s))) + if ("number" !== typeof h[r].y) + 0 < r && !(g.connectNullData || s || p) && (c.stroke(), u && b.stroke()), s = !0; + else { + var z = y; + t = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (t - a.axisX.conversionParameters.minimum) + + 0.5 << 0; + y = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (h[r].y - a.axisY.conversionParameters.minimum) + 0.5 << 0; + var w = g.dataPointIds[r]; + this._eventManager.objectMap[w] = {id: w, objectType: "dataPoint", dataSeriesIndex: f, dataPointIndex: r, x1: t, y1: y}; + p || s ? (!p && g.connectNullData ? (c.setLineDash && (g._options.nullDataLineDashType || q === g.lineDashType && g.lineDashType !== g.nullDataLineDashType) && (c.stroke(), q = g.nullDataLineDashType, c.setLineDash(k)), c.lineTo(t, z), c.lineTo(t, y), u && (b.lineTo(t, + z), b.lineTo(t, y))) : (c.beginPath(), c.moveTo(t, y), u && (b.beginPath(), b.moveTo(t, y))), s = p = !1) : (c.lineTo(t, z), u && b.lineTo(t, z), c.lineTo(t, y), u && b.lineTo(t, y), 0 == r % 500 && (c.stroke(), c.beginPath(), c.moveTo(t, y), u && (b.stroke(), b.beginPath(), b.moveTo(t, y)))); + r < h.length - 1 && (l !== (h[r].lineColor || m) || q !== (h[r].lineDashType || g.lineDashType)) && (c.stroke(), c.beginPath(), c.moveTo(t, y), l = h[r].lineColor || m, c.strokeStyle = l, c.setLineDash && (h[r].lineDashType ? (q = h[r].lineDashType, c.setLineDash(D(q, g.lineThickness))) : (q = + g.lineDashType, c.setLineDash(n)))); + if (0 < h[r].markerSize || 0 < g.markerSize) + z = g.getMarkerProperties(r, t, y, c), d.push(z), w = C(w), u && d.push({x: t, y: y, ctx: b, type: z.type, size: z.size, color: w, borderColor: w, borderThickness: z.borderThickness}); + (h[r].indexLabel || g.indexLabel || h[r].indexLabelFormatter || g.indexLabelFormatter) && this._indexLabels.push({chartType: "stepLine", dataPoint: h[r], dataSeries: g, point: {x: t, y: y}, direction: 0 <= h[r].y ? 1 : -1, color: m}) + } + c.stroke(); + u && b.stroke() + } + } + P.drawMarkers(d); + c.restore(); + c.beginPath(); + u && b.beginPath(); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.xClipAnimation, easingFunction: B.easing.linear, animationBase: 0} + } + }; + v.prototype.renderSpline = function (a) { + function c(a) { + a = ma(a, 2); + if (0 < a.length) { + b.beginPath(); + u && d.beginPath(); + b.moveTo(a[0].x, a[0].y); + a[0].newStrokeStyle && (b.strokeStyle = a[0].newStrokeStyle); + a[0].newLineDashArray && b.setLineDash(a[0].newLineDashArray); + u && d.moveTo(a[0].x, a[0].y); + for (var c = 0; c < a.length - 3; c += 3) + if (b.bezierCurveTo(a[c + 1].x, a[c + 1].y, a[c + 2].x, a[c + 2].y, + a[c + 3].x, a[c + 3].y), u && d.bezierCurveTo(a[c + 1].x, a[c + 1].y, a[c + 2].x, a[c + 2].y, a[c + 3].x, a[c + 3].y), 0 < c && 0 === c % 3E3 || a[c + 3].newStrokeStyle || a[c + 3].newLineDashArray) + b.stroke(), b.beginPath(), b.moveTo(a[c + 3].x, a[c + 3].y), a[c + 3].newStrokeStyle && (b.strokeStyle = a[c + 3].newStrokeStyle), a[c + 3].newLineDashArray && b.setLineDash(a[c + 3].newLineDashArray), u && (d.stroke(), d.beginPath(), d.moveTo(a[c + 3].x, a[c + 3].y)); + b.stroke(); + u && d.stroke() + } + } + var b = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var d = + this._eventManager.ghostCtx; + b.save(); + var e = this.plotArea; + b.beginPath(); + b.rect(e.x1, e.y1, e.width, e.height); + b.clip(); + for (var e = [], f = 0; f < a.dataSeriesIndexes.length; f++) { + var g = a.dataSeriesIndexes[f], h = this.data[g]; + b.lineWidth = h.lineThickness; + var q = h.dataPoints, k = "solid"; + if (b.setLineDash) { + var n = D(h.nullDataLineDashType, h.lineThickness), k = h.lineDashType, m = D(k, h.lineThickness); + b.setLineDash(m) + } + var l = h.id; + this._eventManager.objectMap[l] = {objectType: "dataSeries", dataSeriesIndex: g}; + l = C(l); + d.strokeStyle = l; + d.lineWidth = + 0 < h.lineThickness ? Math.max(h.lineThickness, 4) : 0; + var l = h._colorSet, p = l = h._options.lineColor ? h._options.lineColor : l[0]; + b.strokeStyle = l; + var r = 0, t, y, s = []; + b.beginPath(); + if (0 < q.length) + for (y = !1, r = 0; r < q.length; r++) + if (t = q[r].getTime ? q[r].x.getTime() : q[r].x, !(t < a.axisX.dataInfo.viewPortMin || t > a.axisX.dataInfo.viewPortMax && (!h.connectNullData || !y))) + if ("number" !== typeof q[r].y) + 0 < r && !y && (h.connectNullData ? b.setLineDash && (0 < s.length && (h._options.nullDataLineDashType || !q[r - 1].lineDashType)) && (s[s.length - 1].newLineDashArray = + n, k = h.nullDataLineDashType) : (c(s), s = [])), y = !0; + else { + t = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (t - a.axisX.conversionParameters.minimum) + 0.5 << 0; + y = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (q[r].y - a.axisY.conversionParameters.minimum) + 0.5 << 0; + var z = h.dataPointIds[r]; + this._eventManager.objectMap[z] = {id: z, objectType: "dataPoint", dataSeriesIndex: g, dataPointIndex: r, x1: t, y1: y}; + s[s.length] = {x: t, y: y}; + r < q.length - 1 && (p !== (q[r].lineColor || + l) || k !== (q[r].lineDashType || h.lineDashType)) && (p = q[r].lineColor || l, s[s.length - 1].newStrokeStyle = p, b.setLineDash && (q[r].lineDashType ? (k = q[r].lineDashType, s[s.length - 1].newLineDashArray = D(k, h.lineThickness)) : (k = h.lineDashType, s[s.length - 1].newLineDashArray = m))); + if (0 < q[r].markerSize || 0 < h.markerSize) { + var w = h.getMarkerProperties(r, t, y, b); + e.push(w); + z = C(z); + u && e.push({x: t, y: y, ctx: d, type: w.type, size: w.size, color: z, borderColor: z, borderThickness: w.borderThickness}) + } + (q[r].indexLabel || h.indexLabel || q[r].indexLabelFormatter || + h.indexLabelFormatter) && this._indexLabels.push({chartType: "spline", dataPoint: q[r], dataSeries: h, point: {x: t, y: y}, direction: 0 <= q[r].y ? 1 : -1, color: l}); + y = !1 + } + c(s) + } + P.drawMarkers(e); + b.restore(); + b.beginPath(); + u && d.beginPath(); + return{source: b, dest: this.plotArea.ctx, animationCallback: B.xClipAnimation, easingFunction: B.easing.linear, animationBase: 0} + } + }; + var M = function (a, c, b, d, e, f, g, h, q, k, n, m, l) { + "undefined" === typeof l && (l = 1); + g = g || 0; + h = h || "black"; + var p = 15 < d - c && 15 < e - b ? 8 : 0.35 * Math.min(d - c, e - b); + a.beginPath(); + a.moveTo(c, + b); + a.save(); + a.fillStyle = f; + a.globalAlpha = l; + a.fillRect(c, b, d - c, e - b); + a.globalAlpha = 1; + 0 < g && (l = 0 === g % 2 ? 0 : 0.5, a.beginPath(), a.lineWidth = g, a.strokeStyle = h, a.moveTo(c, b), a.rect(c - l, b - l, d - c + 2 * l, e - b + 2 * l), a.stroke()); + a.restore(); + !0 === q && (a.save(), a.beginPath(), a.moveTo(c, b), a.lineTo(c + p, b + p), a.lineTo(d - p, b + p), a.lineTo(d, b), a.closePath(), g = a.createLinearGradient((d + c) / 2, b + p, (d + c) / 2, b), g.addColorStop(0, f), g.addColorStop(1, "rgba(255, 255, 255, .4)"), a.fillStyle = g, a.fill(), a.restore()); + !0 === k && (a.save(), a.beginPath(), + a.moveTo(c, e), a.lineTo(c + p, e - p), a.lineTo(d - p, e - p), a.lineTo(d, e), a.closePath(), g = a.createLinearGradient((d + c) / 2, e - p, (d + c) / 2, e), g.addColorStop(0, f), g.addColorStop(1, "rgba(255, 255, 255, .4)"), a.fillStyle = g, a.fill(), a.restore()); + !0 === n && (a.save(), a.beginPath(), a.moveTo(c, b), a.lineTo(c + p, b + p), a.lineTo(c + p, e - p), a.lineTo(c, e), a.closePath(), g = a.createLinearGradient(c + p, (e + b) / 2, c, (e + b) / 2), g.addColorStop(0, f), g.addColorStop(1, "rgba(255, 255, 255, 0.1)"), a.fillStyle = g, a.fill(), a.restore()); + !0 === m && (a.save(), + a.beginPath(), a.moveTo(d, b), a.lineTo(d - p, b + p), a.lineTo(d - p, e - p), a.lineTo(d, e), g = a.createLinearGradient(d - p, (e + b) / 2, d, (e + b) / 2), g.addColorStop(0, f), g.addColorStop(1, "rgba(255, 255, 255, 0.1)"), a.fillStyle = g, g.addColorStop(0, f), g.addColorStop(1, "rgba(255, 255, 255, 0.1)"), a.fillStyle = g, a.fill(), a.closePath(), a.restore()) + }; + v.prototype.renderColumn = function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var b = null, d = this.plotArea, e = 0, f, g, h, q = a.axisY.conversionParameters.reference + + a.axisY.conversionParameters.pixelPerUnit * (0 - a.axisY.conversionParameters.minimum) << 0, e = this.dataPointMinWidth ? this.dataPointMinWidth : this.dataPointWidth ? this.dataPointWidth : 1, k = this.dataPointMaxWidth ? this.dataPointMaxWidth : this.dataPointWidth ? this.dataPointWidth : Math.min(0.15 * this.width, 0.9 * (this.plotArea.width / a.plotType.totalDataSeries)) << 0, n = a.axisX.dataInfo.minDiff; + isFinite(n) || (n = 0.3 * Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum)); + n = this.dataPointWidth ? this.dataPointWidth : 0.9 * (d.width / + Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(n) / a.plotType.totalDataSeries) << 0; + this.dataPointMaxWidth && e > k && (e = Math.min(this.dataPointWidth ? this.dataPointWidth : Infinity, k)); + !this.dataPointMaxWidth && (this.dataPointMinWidth && k < e) && (k = Math.max(this.dataPointWidth ? this.dataPointWidth : -Infinity, e)); + n < e && (n = e); + n > k && (n = k); + c.save(); + u && this._eventManager.ghostCtx.save(); + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + u && (this._eventManager.ghostCtx.rect(d.x1, d.y1, d.width, d.height), + this._eventManager.ghostCtx.clip()); + for (d = 0; d < a.dataSeriesIndexes.length; d++) { + var k = a.dataSeriesIndexes[d], m = this.data[k], l = m.dataPoints; + if (0 < l.length) + for (var p = 5 < n && m.bevelEnabled ? !0 : !1, e = 0; e < l.length; e++) + if (l[e].getTime ? h = l[e].x.getTime() : h = l[e].x, !(h < a.axisX.dataInfo.viewPortMin || h > a.axisX.dataInfo.viewPortMax) && "number" === typeof l[e].y) { + f = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (h - a.axisX.conversionParameters.minimum) + 0.5 << 0; + g = a.axisY.conversionParameters.reference + + a.axisY.conversionParameters.pixelPerUnit * (l[e].y - a.axisY.conversionParameters.minimum) + 0.5 << 0; + f = f - a.plotType.totalDataSeries * n / 2 + (a.previousDataSeriesCount + d) * n << 0; + var r = f + n << 0, t; + 0 <= l[e].y ? t = q : (t = g, g = q); + g > t && (t = g = t); + b = l[e].color ? l[e].color : m._colorSet[e % m._colorSet.length]; + M(c, f, g, r, t, b, 0, null, p && 0 <= l[e].y, 0 > l[e].y && p, !1, !1, m.fillOpacity); + b = m.dataPointIds[e]; + this._eventManager.objectMap[b] = {id: b, objectType: "dataPoint", dataSeriesIndex: k, dataPointIndex: e, x1: f, y1: g, x2: r, y2: t}; + b = C(b); + u && M(this._eventManager.ghostCtx, + f, g, r, t, b, 0, null, !1, !1, !1, !1); + (l[e].indexLabel || m.indexLabel || l[e].indexLabelFormatter || m.indexLabelFormatter) && this._indexLabels.push({chartType: "column", dataPoint: l[e], dataSeries: m, point: {x: f + (r - f) / 2, y: 0 <= l[e].y ? g : t}, direction: 0 <= l[e].y ? 1 : -1, bounds: {x1: f, y1: Math.min(g, t), x2: r, y2: Math.max(g, t)}, color: b}) + } + } + c.restore(); + u && this._eventManager.ghostCtx.restore(); + a = Math.min(q, a.axisY.boundingRect.y2); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.yScaleAnimation, easingFunction: B.easing.easeOutQuart, + animationBase: a} + } + }; + v.prototype.renderStackedColumn = function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var b = null, d = this.plotArea, e = [], f = [], g = 0, h, q = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (0 - a.axisY.conversionParameters.minimum) << 0, g = this.dataPointMinWidth ? this.dataPointMinWidth : this.dataPointWidth ? this.dataPointWidth : 1, k = this.dataPointMaxWidth ? this.dataPointMaxWidth : this.dataPointWidth ? this.dataPointWidth : 0.15 * this.width << + 0, n = a.axisX.dataInfo.minDiff; + isFinite(n) || (n = 0.3 * Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum)); + n = this.dataPointWidth ? this.dataPointWidth : 0.9 * (d.width / Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(n) / a.plotType.plotUnits.length) << 0; + this.dataPointMaxWidth && g > k && (g = Math.min(this.dataPointWidth ? this.dataPointWidth : Infinity, k)); + !this.dataPointMaxWidth && (this.dataPointMinWidth && k < g) && (k = Math.max(this.dataPointWidth ? this.dataPointWidth : -Infinity, g)); + n < g && (n = g); + n > k && (n = k); + c.save(); + u && this._eventManager.ghostCtx.save(); + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + u && (this._eventManager.ghostCtx.rect(d.x1, d.y1, d.width, d.height), this._eventManager.ghostCtx.clip()); + for (k = 0; k < a.dataSeriesIndexes.length; k++) { + var m = a.dataSeriesIndexes[k], l = this.data[m], p = l.dataPoints; + if (0 < p.length) { + var r = 5 < n && l.bevelEnabled ? !0 : !1; + c.strokeStyle = "#4572A7 "; + for (g = 0; g < p.length; g++) + if (b = p[g].x.getTime ? p[g].x.getTime() : p[g].x, !(b < a.axisX.dataInfo.viewPortMin || b > a.axisX.dataInfo.viewPortMax) && + "number" === typeof p[g].y) { + d = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (b - a.axisX.conversionParameters.minimum) + 0.5 << 0; + h = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (p[g].y - a.axisY.conversionParameters.minimum); + var t = d - a.plotType.plotUnits.length * n / 2 + a.index * n << 0, y = t + n << 0, s; + if (0 <= p[g].y) { + var z = e[b] ? e[b] : 0; + h -= z; + s = q - z; + e[b] = z + (s - h) + } else + z = f[b] ? f[b] : 0, s = h + z, h = q + z, f[b] = z + (s - h); + b = p[g].color ? p[g].color : l._colorSet[g % l._colorSet.length]; + M(c, t, h, y, s, b, 0, null, r && 0 <= p[g].y, 0 > p[g].y && r, !1, !1, l.fillOpacity); + b = l.dataPointIds[g]; + this._eventManager.objectMap[b] = {id: b, objectType: "dataPoint", dataSeriesIndex: m, dataPointIndex: g, x1: t, y1: h, x2: y, y2: s}; + b = C(b); + u && M(this._eventManager.ghostCtx, t, h, y, s, b, 0, null, !1, !1, !1, !1); + (p[g].indexLabel || l.indexLabel || p[g].indexLabelFormatter || l.indexLabelFormatter) && this._indexLabels.push({chartType: "stackedColumn", dataPoint: p[g], dataSeries: l, point: {x: d, y: 0 <= p[g].y ? h : s}, direction: 0 <= p[g].y ? 1 : -1, bounds: {x1: t, y1: Math.min(h, + s), x2: y, y2: Math.max(h, s)}, color: b}) + } + } + } + c.restore(); + u && this._eventManager.ghostCtx.restore(); + a = Math.min(q, a.axisY.boundingRect.y2); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.yScaleAnimation, easingFunction: B.easing.easeOutQuart, animationBase: a} + } + }; + v.prototype.renderStackedColumn100 = function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var b = null, d = this.plotArea, e = [], f = [], g = 0, h, q = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * + (0 - a.axisY.conversionParameters.minimum) << 0, g = this.dataPointMinWidth ? this.dataPointMinWidth : this.dataPointWidth ? this.dataPointWidth : 1, k = this.dataPointMaxWidth ? this.dataPointMaxWidth : this.dataPointWidth ? this.dataPointWidth : 0.15 * this.width << 0, n = a.axisX.dataInfo.minDiff; + isFinite(n) || (n = 0.3 * Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum)); + n = this.dataPointWidth ? this.dataPointWidth : 0.9 * (d.width / Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(n) / a.plotType.plotUnits.length) << + 0; + this.dataPointMaxWidth && g > k && (g = Math.min(this.dataPointWidth ? this.dataPointWidth : Infinity, k)); + !this.dataPointMaxWidth && (this.dataPointMinWidth && k < g) && (k = Math.max(this.dataPointWidth ? this.dataPointWidth : -Infinity, g)); + n < g && (n = g); + n > k && (n = k); + c.save(); + u && this._eventManager.ghostCtx.save(); + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + u && (this._eventManager.ghostCtx.rect(d.x1, d.y1, d.width, d.height), this._eventManager.ghostCtx.clip()); + for (k = 0; k < a.dataSeriesIndexes.length; k++) { + var m = a.dataSeriesIndexes[k], + l = this.data[m], p = l.dataPoints; + if (0 < p.length) + for (var r = 5 < n && l.bevelEnabled ? !0 : !1, g = 0; g < p.length; g++) + if (b = p[g].x.getTime ? p[g].x.getTime() : p[g].x, !(b < a.axisX.dataInfo.viewPortMin || b > a.axisX.dataInfo.viewPortMax) && "number" === typeof p[g].y) { + d = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (b - a.axisX.conversionParameters.minimum) + 0.5 << 0; + h = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * ((0 !== a.dataPointYSums[b] ? 100 * (p[g].y / a.dataPointYSums[b]) : + 0) - a.axisY.conversionParameters.minimum); + var t = d - a.plotType.plotUnits.length * n / 2 + a.index * n << 0, y = t + n << 0, s; + if (0 <= p[g].y) { + var z = e[b] ? e[b] : 0; + h -= z; + s = q - z; + e[b] = z + (s - h) + } else + z = f[b] ? f[b] : 0, s = h + z, h = q + z, f[b] = z + (s - h); + b = p[g].color ? p[g].color : l._colorSet[g % l._colorSet.length]; + M(c, t, h, y, s, b, 0, null, r && 0 <= p[g].y, 0 > p[g].y && r, !1, !1, l.fillOpacity); + b = l.dataPointIds[g]; + this._eventManager.objectMap[b] = {id: b, objectType: "dataPoint", dataSeriesIndex: m, dataPointIndex: g, x1: t, y1: h, x2: y, y2: s}; + b = C(b); + u && M(this._eventManager.ghostCtx, + t, h, y, s, b, 0, null, !1, !1, !1, !1); + (p[g].indexLabel || l.indexLabel || p[g].indexLabelFormatter || l.indexLabelFormatter) && this._indexLabels.push({chartType: "stackedColumn100", dataPoint: p[g], dataSeries: l, point: {x: d, y: 0 <= p[g].y ? h : s}, direction: 0 <= p[g].y ? 1 : -1, bounds: {x1: t, y1: Math.min(h, s), x2: y, y2: Math.max(h, s)}, color: b}) + } + } + c.restore(); + u && this._eventManager.ghostCtx.restore(); + a = Math.min(q, a.axisY.boundingRect.y2); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.yScaleAnimation, easingFunction: B.easing.easeOutQuart, + animationBase: a} + } + }; + v.prototype.renderBar = function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var b = null, d = this.plotArea, e = 0, f, g, h, q = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (0 - a.axisY.conversionParameters.minimum) << 0, e = this.dataPointMinWidth ? this.dataPointMinWidth : this.dataPointWidth ? this.dataPointWidth : 1, k = this.dataPointMaxWidth ? this.dataPointMaxWidth : this.dataPointWidth ? this.dataPointWidth : Math.min(0.15 * this.height, + 0.9 * (this.plotArea.height / a.plotType.totalDataSeries)) << 0, n = a.axisX.dataInfo.minDiff; + isFinite(n) || (n = 0.3 * Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum)); + n = this.dataPointWidth ? this.dataPointWidth : 0.9 * (d.height / Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(n) / a.plotType.totalDataSeries) << 0; + this.dataPointMaxWidth && e > k && (e = Math.min(this.dataPointWidth ? this.dataPointWidth : Infinity, k)); + !this.dataPointMaxWidth && (this.dataPointMinWidth && k < e) && (k = Math.max(this.dataPointWidth ? + this.dataPointWidth : -Infinity, e)); + n < e && (n = e); + n > k && (n = k); + c.save(); + u && this._eventManager.ghostCtx.save(); + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + u && (this._eventManager.ghostCtx.rect(d.x1, d.y1, d.width, d.height), this._eventManager.ghostCtx.clip()); + for (d = 0; d < a.dataSeriesIndexes.length; d++) { + var k = a.dataSeriesIndexes[d], m = this.data[k], l = m.dataPoints; + if (0 < l.length) { + var p = 5 < n && m.bevelEnabled ? !0 : !1; + c.strokeStyle = "#4572A7 "; + for (e = 0; e < l.length; e++) + if (l[e].getTime ? h = l[e].x.getTime() : h = l[e].x, + !(h < a.axisX.dataInfo.viewPortMin || h > a.axisX.dataInfo.viewPortMax) && "number" === typeof l[e].y) { + g = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (h - a.axisX.conversionParameters.minimum) + 0.5 << 0; + f = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (l[e].y - a.axisY.conversionParameters.minimum) + 0.5 << 0; + g = g - a.plotType.totalDataSeries * n / 2 + (a.previousDataSeriesCount + d) * n << 0; + var r = g + n << 0, t; + 0 <= l[e].y ? t = q : (t = f, f = q); + b = l[e].color ? l[e].color : m._colorSet[e % + m._colorSet.length]; + M(c, t, g, f, r, b, 0, null, p, !1, !1, !1, m.fillOpacity); + b = m.dataPointIds[e]; + this._eventManager.objectMap[b] = {id: b, objectType: "dataPoint", dataSeriesIndex: k, dataPointIndex: e, x1: t, y1: g, x2: f, y2: r}; + b = C(b); + u && M(this._eventManager.ghostCtx, t, g, f, r, b, 0, null, !1, !1, !1, !1); + (l[e].indexLabel || m.indexLabel || l[e].indexLabelFormatter || m.indexLabelFormatter) && this._indexLabels.push({chartType: "bar", dataPoint: l[e], dataSeries: m, point: {x: 0 <= l[e].y ? f : t, y: g + (r - g) / 2}, direction: 0 <= l[e].y ? 1 : -1, bounds: {x1: Math.min(t, + f), y1: g, x2: Math.max(t, f), y2: r}, color: b}) + } + } + } + c.restore(); + u && this._eventManager.ghostCtx.restore(); + a = Math.max(q, a.axisX.boundingRect.x2); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.xScaleAnimation, easingFunction: B.easing.easeOutQuart, animationBase: a} + } + }; + v.prototype.renderStackedBar = function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var b = null, d = this.plotArea, e = [], f = [], g = 0, h, q = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * + (0 - a.axisY.conversionParameters.minimum) << 0, g = this.dataPointMinWidth ? this.dataPointMinWidth : this.dataPointWidth ? this.dataPointWidth : 1, k = this.dataPointMaxWidth ? this.dataPointMaxWidth : this.dataPointWidth ? this.dataPointWidth : 0.15 * this.height << 0, n = a.axisX.dataInfo.minDiff; + isFinite(n) || (n = 0.3 * Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum)); + n = this.dataPointWidth ? this.dataPointWidth : 0.9 * (d.height / Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(n) / a.plotType.plotUnits.length) << + 0; + this.dataPointMaxWidth && g > k && (g = Math.min(this.dataPointWidth ? this.dataPointWidth : Infinity, k)); + !this.dataPointMaxWidth && (this.dataPointMinWidth && k < g) && (k = Math.max(this.dataPointWidth ? this.dataPointWidth : -Infinity, g)); + n < g && (n = g); + n > k && (n = k); + c.save(); + u && this._eventManager.ghostCtx.save(); + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + u && (this._eventManager.ghostCtx.rect(d.x1, d.y1, d.width, d.height), this._eventManager.ghostCtx.clip()); + for (k = 0; k < a.dataSeriesIndexes.length; k++) { + var m = a.dataSeriesIndexes[k], + l = this.data[m], p = l.dataPoints; + if (0 < p.length) { + var r = 5 < n && l.bevelEnabled ? !0 : !1; + c.strokeStyle = "#4572A7 "; + for (g = 0; g < p.length; g++) + if (b = p[g].x.getTime ? p[g].x.getTime() : p[g].x, !(b < a.axisX.dataInfo.viewPortMin || b > a.axisX.dataInfo.viewPortMax) && "number" === typeof p[g].y) { + d = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (b - a.axisX.conversionParameters.minimum) + 0.5 << 0; + h = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (p[g].y - a.axisY.conversionParameters.minimum); + var t = d - a.plotType.plotUnits.length * n / 2 + a.index * n << 0, y = t + n << 0, s; + if (0 <= p[g].y) { + var z = e[b] ? e[b] : 0; + s = q + z; + h += z; + e[b] = z + (h - s) + } else + z = f[b] ? f[b] : 0, s = h - z, h = q - z, f[b] = z + (h - s); + b = p[g].color ? p[g].color : l._colorSet[g % l._colorSet.length]; + M(c, s, t, h, y, b, 0, null, r, !1, !1, !1, l.fillOpacity); + b = l.dataPointIds[g]; + this._eventManager.objectMap[b] = {id: b, objectType: "dataPoint", dataSeriesIndex: m, dataPointIndex: g, x1: s, y1: t, x2: h, y2: y}; + b = C(b); + u && M(this._eventManager.ghostCtx, s, t, h, y, b, 0, null, !1, !1, !1, !1); + (p[g].indexLabel || l.indexLabel || + p[g].indexLabelFormatter || l.indexLabelFormatter) && this._indexLabels.push({chartType: "stackedBar", dataPoint: p[g], dataSeries: l, point: {x: 0 <= p[g].y ? h : s, y: d}, direction: 0 <= p[g].y ? 1 : -1, bounds: {x1: Math.min(s, h), y1: t, x2: Math.max(s, h), y2: y}, color: b}) + } + } + } + c.restore(); + u && this._eventManager.ghostCtx.restore(); + a = Math.max(q, a.axisX.boundingRect.x2); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.xScaleAnimation, easingFunction: B.easing.easeOutQuart, animationBase: a} + } + }; + v.prototype.renderStackedBar100 = function (a) { + var c = + a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var b = null, d = this.plotArea, e = [], f = [], g = 0, h, q = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (0 - a.axisY.conversionParameters.minimum) << 0, g = this.dataPointMinWidth ? this.dataPointMinWidth : this.dataPointWidth ? this.dataPointWidth : 1, k = this.dataPointMaxWidth ? this.dataPointMaxWidth : this.dataPointWidth ? this.dataPointWidth : 0.15 * this.height << 0, n = a.axisX.dataInfo.minDiff; + isFinite(n) || (n = 0.3 * Math.abs(a.axisX.viewportMaximum - + a.axisX.viewportMinimum)); + n = this.dataPointWidth ? this.dataPointWidth : 0.9 * (d.height / Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(n) / a.plotType.plotUnits.length) << 0; + this.dataPointMaxWidth && g > k && (g = Math.min(this.dataPointWidth ? this.dataPointWidth : Infinity, k)); + !this.dataPointMaxWidth && (this.dataPointMinWidth && k < g) && (k = Math.max(this.dataPointWidth ? this.dataPointWidth : -Infinity, g)); + n < g && (n = g); + n > k && (n = k); + c.save(); + u && this._eventManager.ghostCtx.save(); + c.beginPath(); + c.rect(d.x1, d.y1, d.width, + d.height); + c.clip(); + u && (this._eventManager.ghostCtx.rect(d.x1, d.y1, d.width, d.height), this._eventManager.ghostCtx.clip()); + for (k = 0; k < a.dataSeriesIndexes.length; k++) { + var m = a.dataSeriesIndexes[k], l = this.data[m], p = l.dataPoints; + if (0 < p.length) { + var r = 5 < n && l.bevelEnabled ? !0 : !1; + c.strokeStyle = "#4572A7 "; + for (g = 0; g < p.length; g++) + if (b = p[g].x.getTime ? p[g].x.getTime() : p[g].x, !(b < a.axisX.dataInfo.viewPortMin || b > a.axisX.dataInfo.viewPortMax) && "number" === typeof p[g].y) { + d = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * + (b - a.axisX.conversionParameters.minimum) + 0.5 << 0; + h = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * ((0 !== a.dataPointYSums[b] ? 100 * (p[g].y / a.dataPointYSums[b]) : 0) - a.axisY.conversionParameters.minimum); + var t = d - a.plotType.plotUnits.length * n / 2 + a.index * n << 0, y = t + n << 0, s; + if (0 <= p[g].y) { + var z = e[b] ? e[b] : 0; + s = q + z; + h += z; + e[b] = z + (h - s) + } else + z = f[b] ? f[b] : 0, s = h - z, h = q - z, f[b] = z + (h - s); + b = p[g].color ? p[g].color : l._colorSet[g % l._colorSet.length]; + M(c, s, t, h, y, b, 0, null, r, !1, !1, !1, l.fillOpacity); + b = + l.dataPointIds[g]; + this._eventManager.objectMap[b] = {id: b, objectType: "dataPoint", dataSeriesIndex: m, dataPointIndex: g, x1: s, y1: t, x2: h, y2: y}; + b = C(b); + u && M(this._eventManager.ghostCtx, s, t, h, y, b, 0, null, !1, !1, !1, !1); + (p[g].indexLabel || l.indexLabel || p[g].indexLabelFormatter || l.indexLabelFormatter) && this._indexLabels.push({chartType: "stackedBar100", dataPoint: p[g], dataSeries: l, point: {x: 0 <= p[g].y ? h : s, y: d}, direction: 0 <= p[g].y ? 1 : -1, bounds: {x1: Math.min(s, h), y1: t, x2: Math.max(s, h), y2: y}, color: b}) + } + } + } + c.restore(); + u && this._eventManager.ghostCtx.restore(); + a = Math.max(q, a.axisX.boundingRect.x2); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.xScaleAnimation, easingFunction: B.easing.easeOutQuart, animationBase: a} + } + }; + v.prototype.renderArea = function (a) { + function c() { + z && (0 < k.lineThickness && b.stroke(), 0 >= a.axisY.viewportMinimum && 0 <= a.axisY.viewportMaximum ? s = y : 0 > a.axisY.viewportMaximum ? s = f.y1 : 0 < a.axisY.viewportMinimum && (s = e.y2), b.lineTo(p, s), b.lineTo(z.x, s), b.closePath(), b.globalAlpha = k.fillOpacity, b.fill(), b.globalAlpha = 1, u && (d.lineTo(p, s), d.lineTo(z.x, + s), d.closePath(), d.fill()), b.beginPath(), b.moveTo(p, r), d.beginPath(), d.moveTo(p, r), z = {x: p, y: r}) + } + var b = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var d = this._eventManager.ghostCtx, e = a.axisX.lineCoordinates, f = a.axisY.lineCoordinates, g = [], h = this.plotArea; + b.save(); + u && d.save(); + b.beginPath(); + b.rect(h.x1, h.y1, h.width, h.height); + b.clip(); + u && (d.beginPath(), d.rect(h.x1, h.y1, h.width, h.height), d.clip()); + for (h = 0; h < a.dataSeriesIndexes.length; h++) { + var q = a.dataSeriesIndexes[h], k = this.data[q], + n = k.dataPoints, g = k.id; + this._eventManager.objectMap[g] = {objectType: "dataSeries", dataSeriesIndex: q}; + g = C(g); + d.fillStyle = g; + var g = [], m = !0, l = 0, p, r, t, y = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (0 - a.axisY.conversionParameters.minimum) + 0.5 << 0, s, z = null; + if (0 < n.length) { + var w = k._colorSet[l % k._colorSet.length], x = k._options.lineColor || w, v = x; + b.fillStyle = w; + b.strokeStyle = x; + b.lineWidth = k.lineThickness; + var A = "solid"; + if (b.setLineDash) { + var H = D(k.nullDataLineDashType, k.lineThickness), + A = k.lineDashType, K = D(A, k.lineThickness); + b.setLineDash(K) + } + for (var I = !0; l < n.length; l++) + if (t = n[l].x.getTime ? n[l].x.getTime() : n[l].x, !(t < a.axisX.dataInfo.viewPortMin || t > a.axisX.dataInfo.viewPortMax && (!k.connectNullData || !I))) + if ("number" !== typeof n[l].y) + k.connectNullData || (I || m) || c(), I = !0; + else { + p = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (t - a.axisX.conversionParameters.minimum) + 0.5 << 0; + r = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * + (n[l].y - a.axisY.conversionParameters.minimum) + 0.5 << 0; + m || I ? (!m && k.connectNullData ? (b.setLineDash && (k._options.nullDataLineDashType || A === k.lineDashType && k.lineDashType !== k.nullDataLineDashType) && (b.stroke(), A = k.nullDataLineDashType, b.setLineDash(H)), b.lineTo(p, r), u && d.lineTo(p, r)) : (b.beginPath(), b.moveTo(p, r), u && (d.beginPath(), d.moveTo(p, r)), z = {x: p, y: r}), I = m = !1) : (b.lineTo(p, r), u && d.lineTo(p, r), 0 == l % 250 && c()); + l < n.length - 1 && (v !== (n[l].lineColor || x) || A !== (n[l].lineDashType || k.lineDashType)) && (c(), v = n[l].lineColor || + x, b.strokeStyle = v, b.setLineDash && (n[l].lineDashType ? (A = n[l].lineDashType, b.setLineDash(D(A, k.lineThickness))) : (A = k.lineDashType, b.setLineDash(K)))); + var G = k.dataPointIds[l]; + this._eventManager.objectMap[G] = {id: G, objectType: "dataPoint", dataSeriesIndex: q, dataPointIndex: l, x1: p, y1: r}; + 0 !== n[l].markerSize && (0 < n[l].markerSize || 0 < k.markerSize) && (t = k.getMarkerProperties(l, p, r, b), g.push(t), G = C(G), u && g.push({x: p, y: r, ctx: d, type: t.type, size: t.size, color: G, borderColor: G, borderThickness: t.borderThickness})); + (n[l].indexLabel || + k.indexLabel || n[l].indexLabelFormatter || k.indexLabelFormatter) && this._indexLabels.push({chartType: "area", dataPoint: n[l], dataSeries: k, point: {x: p, y: r}, direction: 0 <= n[l].y ? 1 : -1, color: w}) + } + c(); + P.drawMarkers(g) + } + } + b.restore(); + u && this._eventManager.ghostCtx.restore(); + return{source: b, dest: this.plotArea.ctx, animationCallback: B.xClipAnimation, easingFunction: B.easing.linear, animationBase: 0} + } + }; + v.prototype.renderSplineArea = function (a) { + function c() { + var c = ma(s, 2); + if (0 < c.length) { + if (0 < k.lineThickness) { + b.beginPath(); + b.moveTo(c[0].x, c[0].y); + c[0].newStrokeStyle && (b.strokeStyle = c[0].newStrokeStyle); + c[0].newLineDashArray && b.setLineDash(c[0].newLineDashArray); + for (var g = 0; g < c.length - 3; g += 3) + if (b.bezierCurveTo(c[g + 1].x, c[g + 1].y, c[g + 2].x, c[g + 2].y, c[g + 3].x, c[g + 3].y), u && d.bezierCurveTo(c[g + 1].x, c[g + 1].y, c[g + 2].x, c[g + 2].y, c[g + 3].x, c[g + 3].y), c[g + 3].newStrokeStyle || c[g + 3].newLineDashArray) + b.stroke(), b.beginPath(), b.moveTo(c[g + 3].x, c[g + 3].y), c[g + 3].newStrokeStyle && (b.strokeStyle = c[g + 3].newStrokeStyle), c[g + 3].newLineDashArray && + b.setLineDash(c[g + 3].newLineDashArray); + b.stroke() + } + b.beginPath(); + b.moveTo(c[0].x, c[0].y); + u && (d.beginPath(), d.moveTo(c[0].x, c[0].y)); + for (g = 0; g < c.length - 3; g += 3) + b.bezierCurveTo(c[g + 1].x, c[g + 1].y, c[g + 2].x, c[g + 2].y, c[g + 3].x, c[g + 3].y), u && d.bezierCurveTo(c[g + 1].x, c[g + 1].y, c[g + 2].x, c[g + 2].y, c[g + 3].x, c[g + 3].y); + 0 >= a.axisY.viewportMinimum && 0 <= a.axisY.viewportMaximum ? t = r : 0 > a.axisY.viewportMaximum ? t = f.y1 : 0 < a.axisY.viewportMinimum && (t = e.y2); + y = {x: c[0].x, y: c[0].y}; + b.lineTo(c[c.length - 1].x, t); + b.lineTo(y.x, t); + b.closePath(); + b.globalAlpha = k.fillOpacity; + b.fill(); + b.globalAlpha = 1; + u && (d.lineTo(c[c.length - 1].x, t), d.lineTo(y.x, t), d.closePath(), d.fill()) + } + } + var b = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var d = this._eventManager.ghostCtx, e = a.axisX.lineCoordinates, f = a.axisY.lineCoordinates, g = [], h = this.plotArea; + b.save(); + u && d.save(); + b.beginPath(); + b.rect(h.x1, h.y1, h.width, h.height); + b.clip(); + u && (d.beginPath(), d.rect(h.x1, h.y1, h.width, h.height), d.clip()); + for (h = 0; h < a.dataSeriesIndexes.length; h++) { + var q = + a.dataSeriesIndexes[h], k = this.data[q], n = k.dataPoints, g = k.id; + this._eventManager.objectMap[g] = {objectType: "dataSeries", dataSeriesIndex: q}; + g = C(g); + d.fillStyle = g; + var g = [], m = 0, l, p, r = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (0 - a.axisY.conversionParameters.minimum) + 0.5 << 0, t, y = null, s = []; + if (0 < n.length) { + var z = k._colorSet[m % k._colorSet.length], w = k._options.lineColor || z, x = w; + b.fillStyle = z; + b.strokeStyle = w; + b.lineWidth = k.lineThickness; + var v = "solid"; + if (b.setLineDash) { + var A = D(k.nullDataLineDashType, + k.lineThickness), v = k.lineDashType, H = D(v, k.lineThickness); + b.setLineDash(H) + } + for (p = !1; m < n.length; m++) + if (l = n[m].x.getTime ? n[m].x.getTime() : n[m].x, !(l < a.axisX.dataInfo.viewPortMin || l > a.axisX.dataInfo.viewPortMax && (!k.connectNullData || !p))) + if ("number" !== typeof n[m].y) + 0 < m && !p && (k.connectNullData ? b.setLineDash && (0 < s.length && (k._options.nullDataLineDashType || !n[m - 1].lineDashType)) && (s[s.length - 1].newLineDashArray = A, v = k.nullDataLineDashType) : (c(), s = [])), p = !0; + else { + l = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * + (l - a.axisX.conversionParameters.minimum) + 0.5 << 0; + p = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (n[m].y - a.axisY.conversionParameters.minimum) + 0.5 << 0; + var K = k.dataPointIds[m]; + this._eventManager.objectMap[K] = {id: K, objectType: "dataPoint", dataSeriesIndex: q, dataPointIndex: m, x1: l, y1: p}; + s[s.length] = {x: l, y: p}; + m < n.length - 1 && (x !== (n[m].lineColor || w) || v !== (n[m].lineDashType || k.lineDashType)) && (x = n[m].lineColor || w, s[s.length - 1].newStrokeStyle = x, b.setLineDash && (n[m].lineDashType ? + (v = n[m].lineDashType, s[s.length - 1].newLineDashArray = D(v, k.lineThickness)) : (v = k.lineDashType, s[s.length - 1].newLineDashArray = H))); + if (0 !== n[m].markerSize && (0 < n[m].markerSize || 0 < k.markerSize)) { + var I = k.getMarkerProperties(m, l, p, b); + g.push(I); + K = C(K); + u && g.push({x: l, y: p, ctx: d, type: I.type, size: I.size, color: K, borderColor: K, borderThickness: I.borderThickness}) + } + (n[m].indexLabel || k.indexLabel || n[m].indexLabelFormatter || k.indexLabelFormatter) && this._indexLabels.push({chartType: "splineArea", dataPoint: n[m], dataSeries: k, + point: {x: l, y: p}, direction: 0 <= n[m].y ? 1 : -1, color: z}); + p = !1 + } + c(); + P.drawMarkers(g) + } + } + b.restore(); + u && this._eventManager.ghostCtx.restore(); + return{source: b, dest: this.plotArea.ctx, animationCallback: B.xClipAnimation, easingFunction: B.easing.linear, animationBase: 0} + } + }; + v.prototype.renderStepArea = function (a) { + function c() { + z && (0 < k.lineThickness && b.stroke(), 0 >= a.axisY.viewportMinimum && 0 <= a.axisY.viewportMaximum ? s = y : 0 > a.axisY.viewportMaximum ? s = f.y1 : 0 < a.axisY.viewportMinimum && (s = e.y2), b.lineTo(p, s), b.lineTo(z.x, s), b.closePath(), + b.globalAlpha = k.fillOpacity, b.fill(), b.globalAlpha = 1, u && (d.lineTo(p, s), d.lineTo(z.x, s), d.closePath(), d.fill()), b.beginPath(), b.moveTo(p, r), d.beginPath(), d.moveTo(p, r), z = {x: p, y: r}) + } + var b = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var d = this._eventManager.ghostCtx, e = a.axisX.lineCoordinates, f = a.axisY.lineCoordinates, g = [], h = this.plotArea; + b.save(); + u && d.save(); + b.beginPath(); + b.rect(h.x1, h.y1, h.width, h.height); + b.clip(); + u && (d.beginPath(), d.rect(h.x1, h.y1, h.width, h.height), d.clip()); + for (h = 0; h < a.dataSeriesIndexes.length; h++) { + var q = a.dataSeriesIndexes[h], k = this.data[q], n = k.dataPoints, g = k.id; + this._eventManager.objectMap[g] = {objectType: "dataSeries", dataSeriesIndex: q}; + g = C(g); + d.fillStyle = g; + var g = [], m = !0, l = 0, p, r, t, y = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (0 - a.axisY.conversionParameters.minimum) + 0.5 << 0, s, z = null, w = !1; + if (0 < n.length) { + var x = k._colorSet[l % k._colorSet.length], v = k._options.lineColor || x, A = v; + b.fillStyle = x; + b.strokeStyle = v; + b.lineWidth = + k.lineThickness; + var H = "solid"; + if (b.setLineDash) { + var K = D(k.nullDataLineDashType, k.lineThickness), H = k.lineDashType, I = D(H, k.lineThickness); + b.setLineDash(I) + } + for (; l < n.length; l++) + if (t = n[l].x.getTime ? n[l].x.getTime() : n[l].x, !(t < a.axisX.dataInfo.viewPortMin || t > a.axisX.dataInfo.viewPortMax && (!k.connectNullData || !w))) { + var G = r; + "number" !== typeof n[l].y ? (k.connectNullData || (w || m) || c(), w = !0) : (p = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (t - a.axisX.conversionParameters.minimum) + + 0.5 << 0, r = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (n[l].y - a.axisY.conversionParameters.minimum) + 0.5 << 0, m || w ? (!m && k.connectNullData ? (b.setLineDash && (k._options.nullDataLineDashType || H === k.lineDashType && k.lineDashType !== k.nullDataLineDashType) && (b.stroke(), H = k.nullDataLineDashType, b.setLineDash(K)), b.lineTo(p, G), b.lineTo(p, r), u && (d.lineTo(p, G), d.lineTo(p, r))) : (b.beginPath(), b.moveTo(p, r), u && (d.beginPath(), d.moveTo(p, r)), z = {x: p, y: r}), w = m = !1) : (b.lineTo(p, G), u && + d.lineTo(p, G), b.lineTo(p, r), u && d.lineTo(p, r), 0 == l % 250 && c()), l < n.length - 1 && (A !== (n[l].lineColor || v) || H !== (n[l].lineDashType || k.lineDashType)) && (c(), A = n[l].lineColor || v, b.strokeStyle = A, b.setLineDash && (n[l].lineDashType ? (H = n[l].lineDashType, b.setLineDash(D(H, k.lineThickness))) : (H = k.lineDashType, b.setLineDash(I)))), G = k.dataPointIds[l], this._eventManager.objectMap[G] = {id: G, objectType: "dataPoint", dataSeriesIndex: q, dataPointIndex: l, x1: p, y1: r}, 0 !== n[l].markerSize && (0 < n[l].markerSize || 0 < k.markerSize) && (t = + k.getMarkerProperties(l, p, r, b), g.push(t), G = C(G), u && g.push({x: p, y: r, ctx: d, type: t.type, size: t.size, color: G, borderColor: G, borderThickness: t.borderThickness})), (n[l].indexLabel || k.indexLabel || n[l].indexLabelFormatter || k.indexLabelFormatter) && this._indexLabels.push({chartType: "stepArea", dataPoint: n[l], dataSeries: k, point: {x: p, y: r}, direction: 0 <= n[l].y ? 1 : -1, color: x})) + } + c(); + P.drawMarkers(g) + } + } + b.restore(); + u && this._eventManager.ghostCtx.restore(); + return{source: b, dest: this.plotArea.ctx, animationCallback: B.xClipAnimation, + easingFunction: B.easing.linear, animationBase: 0} + } + }; + v.prototype.renderStackedArea = function (a) { + function c() { + if (!(1 > h.length)) { + for (0 < s.lineThickness && b.stroke(); 0 < h.length; ) { + var a = h.pop(); + b.lineTo(a.x, a.y); + u && r.lineTo(a.x, a.y) + } + b.closePath(); + b.globalAlpha = s.fillOpacity; + b.fill(); + b.globalAlpha = 1; + b.beginPath(); + u && (r.closePath(), r.fill(), r.beginPath()); + h = [] + } + } + var b = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var d = null, e = [], f = this.plotArea, g = [], h = [], q = [], k = 0, n, m, l, p = a.axisY.conversionParameters.reference + + a.axisY.conversionParameters.pixelPerUnit * (0 - a.axisY.conversionParameters.minimum) << 0, r = this._eventManager.ghostCtx; + u && r.beginPath(); + b.save(); + u && r.save(); + b.beginPath(); + b.rect(f.x1, f.y1, f.width, f.height); + b.clip(); + u && (r.beginPath(), r.rect(f.x1, f.y1, f.width, f.height), r.clip()); + for (var t = [], f = 0; f < a.dataSeriesIndexes.length; f++) { + var y = a.dataSeriesIndexes[f], s = this.data[y], z = s.dataPoints; + s.dataPointIndexes = []; + for (k = 0; k < z.length; k++) + y = z[k].x.getTime ? z[k].x.getTime() : z[k].x, s.dataPointIndexes[y] = k, t[y] || + (q.push(y), t[y] = !0); + q.sort(Aa) + } + for (f = 0; f < a.dataSeriesIndexes.length; f++) { + y = a.dataSeriesIndexes[f]; + s = this.data[y]; + z = s.dataPoints; + t = !0; + h = []; + k = s.id; + this._eventManager.objectMap[k] = {objectType: "dataSeries", dataSeriesIndex: y}; + k = C(k); + r.fillStyle = k; + if (0 < q.length) { + var d = s._colorSet[0], w = s._options.lineColor || d, x = w; + b.fillStyle = d; + b.strokeStyle = w; + b.lineWidth = s.lineThickness; + var v = "solid"; + if (b.setLineDash) { + var A = D(s.nullDataLineDashType, s.lineThickness), v = s.lineDashType, H = D(v, s.lineThickness); + b.setLineDash(H) + } + for (var K = + !0, k = 0; k < q.length; k++) { + l = q[k]; + var I = null, I = 0 <= s.dataPointIndexes[l] ? z[s.dataPointIndexes[l]] : {x: l, y: null}; + if (!(l < a.axisX.dataInfo.viewPortMin || l > a.axisX.dataInfo.viewPortMax && (!s.connectNullData || !K))) + if ("number" !== typeof I.y) + s.connectNullData || (K || t) || c(), K = !0; + else { + n = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (l - a.axisX.conversionParameters.minimum) + 0.5 << 0; + m = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (I.y - a.axisY.conversionParameters.minimum); + var G = g[l] ? g[l] : 0; + m -= G; + h.push({x: n, y: p - G}); + g[l] = p - m; + t || K ? (!t && s.connectNullData ? (b.setLineDash && (s._options.nullDataLineDashType || v === s.lineDashType && s.lineDashType !== s.nullDataLineDashType) && (b.stroke(), v = s.nullDataLineDashType, b.setLineDash(A)), b.lineTo(n, m), u && r.lineTo(n, m)) : (b.beginPath(), b.moveTo(n, m), u && (r.beginPath(), r.moveTo(n, m))), K = t = !1) : (b.lineTo(n, m), u && r.lineTo(n, m), 0 == k % 250 && (c(), b.moveTo(n, m), u && r.moveTo(n, m), h.push({x: n, y: p - G}))); + k < z.length - 1 && (x !== (z[k].lineColor || w) || v !== (z[k].lineDashType || + s.lineDashType)) && (c(), b.beginPath(), b.moveTo(n, m), h.push({x: n, y: p - G}), x = z[k].lineColor || w, b.strokeStyle = x, b.setLineDash && (z[k].lineDashType ? (v = z[k].lineDashType, b.setLineDash(D(v, s.lineThickness))) : (v = s.lineDashType, b.setLineDash(H)))); + if (0 <= s.dataPointIndexes[l]) { + var S = s.dataPointIds[s.dataPointIndexes[l]]; + this._eventManager.objectMap[S] = {id: S, objectType: "dataPoint", dataSeriesIndex: y, dataPointIndex: s.dataPointIndexes[l], x1: n, y1: m} + } + 0 <= s.dataPointIndexes[l] && 0 !== I.markerSize && (0 < I.markerSize || 0 < s.markerSize) && + (l = s.getMarkerProperties(k, n, m, b), e.push(l), markerColor = C(S), u && e.push({x: n, y: m, ctx: r, type: l.type, size: l.size, color: markerColor, borderColor: markerColor, borderThickness: l.borderThickness})); + (I.indexLabel || s.indexLabel || I.indexLabelFormatter || s.indexLabelFormatter) && this._indexLabels.push({chartType: "stackedArea", dataPoint: I, dataSeries: s, point: {x: n, y: m}, direction: 0 <= z[k].y ? 1 : -1, color: d}) + } + } + c(); + b.moveTo(n, m); + u && r.moveTo(n, m) + } + delete s.dataPointIndexes + } + P.drawMarkers(e); + b.restore(); + u && r.restore(); + return{source: b, + dest: this.plotArea.ctx, animationCallback: B.xClipAnimation, easingFunction: B.easing.linear, animationBase: 0} + } + }; + v.prototype.renderStackedArea100 = function (a) { + function c() { + for (0 < w.lineThickness && b.stroke(); 0 < h.length; ) { + var a = h.pop(); + b.lineTo(a.x, a.y); + u && y.lineTo(a.x, a.y) + } + b.closePath(); + b.globalAlpha = w.fillOpacity; + b.fill(); + b.globalAlpha = 1; + b.beginPath(); + u && (y.closePath(), y.fill(), y.beginPath()); + h = [] + } + var b = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var d = null, e = this.plotArea, + f = [], g = [], h = [], q = [], k = 0, n, m, l, p = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (0 - a.axisY.conversionParameters.minimum) << 0, r = this.dataPointMaxWidth ? this.dataPointMaxWidth : 0.15 * this.width << 0, t = a.axisX.dataInfo.minDiff, t = 0.9 * e.width / Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(t) << 0, y = this._eventManager.ghostCtx; + b.save(); + u && y.save(); + b.beginPath(); + b.rect(e.x1, e.y1, e.width, e.height); + b.clip(); + u && (y.beginPath(), y.rect(e.x1, e.y1, e.width, e.height), y.clip()); + for (var s = [], e = 0; e < a.dataSeriesIndexes.length; e++) { + var z = a.dataSeriesIndexes[e], w = this.data[z], x = w.dataPoints; + w.dataPointIndexes = []; + for (k = 0; k < x.length; k++) + z = x[k].x.getTime ? x[k].x.getTime() : x[k].x, w.dataPointIndexes[z] = k, s[z] || (q.push(z), s[z] = !0); + q.sort(Aa) + } + for (e = 0; e < a.dataSeriesIndexes.length; e++) { + z = a.dataSeriesIndexes[e]; + w = this.data[z]; + x = w.dataPoints; + s = !0; + d = w.id; + this._eventManager.objectMap[d] = {objectType: "dataSeries", dataSeriesIndex: z}; + d = C(d); + y.fillStyle = d; + 1 == x.length && (t = r); + 1 > t ? t = 1 : t > r && (t = r); + h = []; + if (0 < q.length) { + var d = w._colorSet[k % w._colorSet.length], v = w._options.lineColor || d, A = v; + b.fillStyle = d; + b.strokeStyle = v; + b.lineWidth = w.lineThickness; + var H = "solid"; + if (b.setLineDash) { + var K = D(w.nullDataLineDashType, w.lineThickness), H = w.lineDashType, I = D(H, w.lineThickness); + b.setLineDash(I) + } + for (var G = !0, k = 0; k < q.length; k++) { + l = q[k]; + var S = null, S = 0 <= w.dataPointIndexes[l] ? x[w.dataPointIndexes[l]] : {x: l, y: null}; + if (!(l < a.axisX.dataInfo.viewPortMin || l > a.axisX.dataInfo.viewPortMax && (!w.connectNullData || !G))) + if ("number" !== + typeof S.y) + w.connectNullData || (G || s) || c(), G = !0; + else { + m = 0 !== a.dataPointYSums[l] ? 100 * (S.y / a.dataPointYSums[l]) : 0; + n = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (l - a.axisX.conversionParameters.minimum) + 0.5 << 0; + m = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (m - a.axisY.conversionParameters.minimum); + var sa = g[l] ? g[l] : 0; + m -= sa; + h.push({x: n, y: p - sa}); + g[l] = p - m; + s || G ? (!s && w.connectNullData ? (b.setLineDash && (w._options.nullDataLineDashType || H === + w.lineDashType && w.lineDashType !== w.nullDataLineDashType) && (b.stroke(), H = w.nullDataLineDashType, b.setLineDash(K)), b.lineTo(n, m), u && y.lineTo(n, m)) : (b.beginPath(), b.moveTo(n, m), u && (y.beginPath(), y.moveTo(n, m))), G = s = !1) : (b.lineTo(n, m), u && y.lineTo(n, m), 0 == k % 250 && (c(), b.moveTo(n, m), u && y.moveTo(n, m), h.push({x: n, y: p - sa}))); + k < x.length - 1 && (A !== (x[k].lineColor || v) || H !== (x[k].lineDashType || w.lineDashType)) && (c(), b.beginPath(), b.moveTo(n, m), h.push({x: n, y: p - sa}), A = x[k].lineColor || v, b.strokeStyle = A, b.setLineDash && + (x[k].lineDashType ? (H = x[k].lineDashType, b.setLineDash(D(H, w.lineThickness))) : (H = w.lineDashType, b.setLineDash(I)))); + if (0 <= w.dataPointIndexes[l]) { + var xa = w.dataPointIds[w.dataPointIndexes[l]]; + this._eventManager.objectMap[xa] = {id: xa, objectType: "dataPoint", dataSeriesIndex: z, dataPointIndex: w.dataPointIndexes[l], x1: n, y1: m} + } + 0 <= w.dataPointIndexes[l] && 0 !== S.markerSize && (0 < S.markerSize || 0 < w.markerSize) && (l = w.getMarkerProperties(k, n, m, b), f.push(l), markerColor = C(xa), u && f.push({x: n, y: m, ctx: y, type: l.type, size: l.size, + color: markerColor, borderColor: markerColor, borderThickness: l.borderThickness})); + (S.indexLabel || w.indexLabel || S.indexLabelFormatter || w.indexLabelFormatter) && this._indexLabels.push({chartType: "stackedArea100", dataPoint: S, dataSeries: w, point: {x: n, y: m}, direction: 0 <= x[k].y ? 1 : -1, color: d}) + } + } + c(); + b.moveTo(n, m); + u && y.moveTo(n, m) + } + delete w.dataPointIndexes + } + P.drawMarkers(f); + b.restore(); + u && y.restore(); + return{source: b, dest: this.plotArea.ctx, animationCallback: B.xClipAnimation, easingFunction: B.easing.linear, animationBase: 0} + } + }; + v.prototype.renderBubble = function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx, b = a.dataSeriesIndexes.length; + if (!(0 >= b)) { + var d = this.plotArea, e = 0, f, g, h = this.dataPointMaxWidth ? this.dataPointMaxWidth : 0.15 * this.width << 0, e = a.axisX.dataInfo.minDiff, b = 0.9 * (d.width / Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(e) / b) << 0; + c.save(); + u && this._eventManager.ghostCtx.save(); + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + u && (this._eventManager.ghostCtx.rect(d.x1, d.y1, d.width, d.height), + this._eventManager.ghostCtx.clip()); + for (var q = -Infinity, k = Infinity, n = 0; n < a.dataSeriesIndexes.length; n++) + for (var m = a.dataSeriesIndexes[n], l = this.data[m], p = l.dataPoints, r = 0, e = 0; e < p.length; e++) + f = p[e].getTime ? f = p[e].x.getTime() : f = p[e].x, f < a.axisX.dataInfo.viewPortMin || f > a.axisX.dataInfo.viewPortMax || "undefined" === typeof p[e].z || (r = p[e].z, r > q && (q = r), r < k && (k = r)); + for (var t = 25 * Math.PI, d = Math.max(Math.pow(0.25 * Math.min(d.height, d.width) / 2, 2) * Math.PI, t), n = 0; n < a.dataSeriesIndexes.length; n++) + if (m = a.dataSeriesIndexes[n], + l = this.data[m], p = l.dataPoints, 1 == p.length && (b = h), 1 > b ? b = 1 : b > h && (b = h), 0 < p.length) + for (c.strokeStyle = "#4572A7 ", e = 0; e < p.length; e++) + if (f = p[e].getTime ? f = p[e].x.getTime() : f = p[e].x, !(f < a.axisX.dataInfo.viewPortMin || f > a.axisX.dataInfo.viewPortMax) && "number" === typeof p[e].y) { + f = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (f - a.axisX.conversionParameters.minimum) + 0.5 << 0; + g = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (p[e].y - a.axisY.conversionParameters.minimum) + + 0.5 << 0; + var r = p[e].z, y = 2 * Math.max(Math.sqrt((q === k ? d / 2 : t + (d - t) / (q - k) * (r - k)) / Math.PI) << 0, 1), r = l.getMarkerProperties(e, c); + r.size = y; + c.globalAlpha = l.fillOpacity; + P.drawMarker(f, g, c, r.type, r.size, r.color, r.borderColor, r.borderThickness); + c.globalAlpha = 1; + var s = l.dataPointIds[e]; + this._eventManager.objectMap[s] = {id: s, objectType: "dataPoint", dataSeriesIndex: m, dataPointIndex: e, x1: f, y1: g, size: y}; + y = C(s); + u && P.drawMarker(f, g, this._eventManager.ghostCtx, r.type, r.size, y, y, r.borderThickness); + (p[e].indexLabel || l.indexLabel || + p[e].indexLabelFormatter || l.indexLabelFormatter) && this._indexLabels.push({chartType: "bubble", dataPoint: p[e], dataSeries: l, point: {x: f, y: g}, direction: 1, bounds: {x1: f - r.size / 2, y1: g - r.size / 2, x2: f + r.size / 2, y2: g + r.size / 2}, color: null}) + } + c.restore(); + u && this._eventManager.ghostCtx.restore(); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.fadeInAnimation, easingFunction: B.easing.easeInQuad, animationBase: 0} + } + }; + v.prototype.renderScatter = function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx, b = a.dataSeriesIndexes.length; + if (!(0 >= b)) { + var d = this.plotArea, e = 0, f, g, h = this.dataPointMaxWidth ? this.dataPointMaxWidth : 0.15 * this.width << 0, e = a.axisX.dataInfo.minDiff, b = 0.9 * (d.width / Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(e) / b) << 0; + c.save(); + u && this._eventManager.ghostCtx.save(); + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + u && (this._eventManager.ghostCtx.rect(d.x1, d.y1, d.width, d.height), this._eventManager.ghostCtx.clip()); + for (var q = 0; q < a.dataSeriesIndexes.length; q++) { + var k = a.dataSeriesIndexes[q], + n = this.data[k], m = n.dataPoints; + 1 == m.length && (b = h); + 1 > b ? b = 1 : b > h && (b = h); + if (0 < m.length) { + c.strokeStyle = "#4572A7 "; + Math.pow(0.3 * Math.min(d.height, d.width) / 2, 2); + for (var l = 0, p = 0, e = 0; e < m.length; e++) + if (f = m[e].getTime ? f = m[e].x.getTime() : f = m[e].x, !(f < a.axisX.dataInfo.viewPortMin || f > a.axisX.dataInfo.viewPortMax) && "number" === typeof m[e].y) { + f = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (f - a.axisX.conversionParameters.minimum) + 0.5 << 0; + g = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * + (m[e].y - a.axisY.conversionParameters.minimum) + 0.5 << 0; + var r = n.getMarkerProperties(e, f, g, c); + c.globalAlpha = n.fillOpacity; + P.drawMarker(r.x, r.y, r.ctx, r.type, r.size, r.color, r.borderColor, r.borderThickness); + c.globalAlpha = 1; + Math.sqrt((l - f) * (l - f) + (p - g) * (p - g)) < Math.min(r.size, 5) && m.length > Math.min(this.plotArea.width, this.plotArea.height) || (l = n.dataPointIds[e], this._eventManager.objectMap[l] = {id: l, objectType: "dataPoint", dataSeriesIndex: k, dataPointIndex: e, x1: f, y1: g}, l = C(l), u && P.drawMarker(r.x, r.y, this._eventManager.ghostCtx, + r.type, r.size, l, l, r.borderThickness), (m[e].indexLabel || n.indexLabel || m[e].indexLabelFormatter || n.indexLabelFormatter) && this._indexLabels.push({chartType: "scatter", dataPoint: m[e], dataSeries: n, point: {x: f, y: g}, direction: 1, bounds: {x1: f - r.size / 2, y1: g - r.size / 2, x2: f + r.size / 2, y2: g + r.size / 2}, color: null}), l = f, p = g) + } + } + } + c.restore(); + u && this._eventManager.ghostCtx.restore(); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.fadeInAnimation, easingFunction: B.easing.easeInQuad, animationBase: 0} + } + }; + v.prototype.renderCandlestick = + function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx, b = this._eventManager.ghostCtx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var d = null, d = this.plotArea, e = 0, f, g, h, q, k, n, e = this.dataPointMinWidth ? this.dataPointMinWidth : this.dataPointWidth ? this.dataPointWidth : 1; + f = this.dataPointMaxWidth ? this.dataPointMaxWidth : this.dataPointWidth ? this.dataPointWidth : 0.015 * this.width; + var m = a.axisX.dataInfo.minDiff; + isFinite(m) || (m = 0.3 * Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum)); + m = this.dataPointWidth ? this.dataPointWidth : + 0.7 * d.width / Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(m) << 0; + this.dataPointMaxWidth && e > f && (e = Math.min(this.dataPointWidth ? this.dataPointWidth : Infinity, f)); + !this.dataPointMaxWidth && (this.dataPointMinWidth && f < e) && (f = Math.max(this.dataPointWidth ? this.dataPointWidth : -Infinity, e)); + m < e && (m = e); + m > f && (m = f); + c.save(); + u && b.save(); + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + u && (b.rect(d.x1, d.y1, d.width, d.height), b.clip()); + for (var l = 0; l < a.dataSeriesIndexes.length; l++) { + var p = + a.dataSeriesIndexes[l], r = this.data[p], t = r.dataPoints; + if (0 < t.length) + for (var y = 5 < m && r.bevelEnabled ? !0 : !1, e = 0; e < t.length; e++) + if (t[e].getTime ? n = t[e].x.getTime() : n = t[e].x, !(n < a.axisX.dataInfo.viewPortMin || n > a.axisX.dataInfo.viewPortMax) && null !== t[e].y && t[e].y.length && "number" === typeof t[e].y[0] && "number" === typeof t[e].y[1] && "number" === typeof t[e].y[2] && "number" === typeof t[e].y[3]) { + f = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (n - a.axisX.conversionParameters.minimum) + + 0.5 << 0; + g = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (t[e].y[0] - a.axisY.conversionParameters.minimum) + 0.5 << 0; + h = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (t[e].y[1] - a.axisY.conversionParameters.minimum) + 0.5 << 0; + q = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (t[e].y[2] - a.axisY.conversionParameters.minimum) + 0.5 << 0; + k = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * + (t[e].y[3] - a.axisY.conversionParameters.minimum) + 0.5 << 0; + var s = f - m / 2 << 0, z = s + m << 0, d = t[e].color ? t[e].color : r._colorSet[0], w = Math.round(Math.max(1, 0.15 * m)), x = 0 === w % 2 ? 0 : 0.5, v = r.dataPointIds[e]; + this._eventManager.objectMap[v] = {id: v, objectType: "dataPoint", dataSeriesIndex: p, dataPointIndex: e, x1: s, y1: g, x2: z, y2: h, x3: f, y3: q, x4: f, y4: k, borderThickness: w, color: d}; + c.strokeStyle = d; + c.beginPath(); + c.lineWidth = w; + b.lineWidth = Math.max(w, 4); + "candlestick" === r.type ? (c.moveTo(f - x, h), c.lineTo(f - x, Math.min(g, k)), c.stroke(), c.moveTo(f - + x, Math.max(g, k)), c.lineTo(f - x, q), c.stroke(), M(c, s, Math.min(g, k), z, Math.max(g, k), t[e].y[0] <= t[e].y[3] ? r.risingColor : d, w, d, y, y, !1, !1, r.fillOpacity), u && (d = C(v), b.strokeStyle = d, b.moveTo(f - x, h), b.lineTo(f - x, Math.min(g, k)), b.stroke(), b.moveTo(f - x, Math.max(g, k)), b.lineTo(f - x, q), b.stroke(), M(b, s, Math.min(g, k), z, Math.max(g, k), d, 0, null, !1, !1, !1, !1))) : "ohlc" === r.type && (c.moveTo(f - x, h), c.lineTo(f - x, q), c.stroke(), c.beginPath(), c.moveTo(f, g), c.lineTo(s, g), c.stroke(), c.beginPath(), c.moveTo(f, k), c.lineTo(z, k), c.stroke(), + u && (d = C(v), b.strokeStyle = d, b.moveTo(f - x, h), b.lineTo(f - x, q), b.stroke(), b.beginPath(), b.moveTo(f, g), b.lineTo(s, g), b.stroke(), b.beginPath(), b.moveTo(f, k), b.lineTo(z, k), b.stroke())); + (t[e].indexLabel || r.indexLabel || t[e].indexLabelFormatter || r.indexLabelFormatter) && this._indexLabels.push({chartType: r.type, dataPoint: t[e], dataSeries: r, point: {x: s + (z - s) / 2, y: h}, direction: 1, bounds: {x1: s, y1: Math.min(h, q), x2: z, y2: Math.max(h, q)}, color: d}) + } + } + c.restore(); + u && b.restore(); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.fadeInAnimation, + easingFunction: B.easing.easeInQuad, animationBase: 0} + } + }; + v.prototype.renderRangeColumn = function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var b = null, d = this.plotArea, e = 0, f, g, e = this.dataPointMinWidth ? this.dataPointMinWidth : this.dataPointWidth ? this.dataPointWidth : 1; + f = this.dataPointMaxWidth ? this.dataPointMaxWidth : this.dataPointWidth ? this.dataPointWidth : 0.03 * this.width; + var h = a.axisX.dataInfo.minDiff; + isFinite(h) || (h = 0.3 * Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum)); + h = this.dataPointWidth ? this.dataPointWidth : 0.9 * (d.width / Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(h) / a.plotType.totalDataSeries) << 0; + this.dataPointMaxWidth && e > f && (e = Math.min(this.dataPointWidth ? this.dataPointWidth : Infinity, f)); + !this.dataPointMaxWidth && (this.dataPointMinWidth && f < e) && (f = Math.max(this.dataPointWidth ? this.dataPointWidth : -Infinity, e)); + h < e && (h = e); + h > f && (h = f); + c.save(); + u && this._eventManager.ghostCtx.save(); + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + u && + (this._eventManager.ghostCtx.rect(d.x1, d.y1, d.width, d.height), this._eventManager.ghostCtx.clip()); + for (var q = 0; q < a.dataSeriesIndexes.length; q++) { + var k = a.dataSeriesIndexes[q], n = this.data[k], m = n.dataPoints; + if (0 < m.length) + for (var l = 5 < h && n.bevelEnabled ? !0 : !1, e = 0; e < m.length; e++) + if (m[e].getTime ? g = m[e].x.getTime() : g = m[e].x, !(g < a.axisX.dataInfo.viewPortMin || g > a.axisX.dataInfo.viewPortMax) && null !== m[e].y && m[e].y.length && "number" === typeof m[e].y[0] && "number" === typeof m[e].y[1]) { + b = a.axisX.conversionParameters.reference + + a.axisX.conversionParameters.pixelPerUnit * (g - a.axisX.conversionParameters.minimum) + 0.5 << 0; + d = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (m[e].y[0] - a.axisY.conversionParameters.minimum) + 0.5 << 0; + f = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (m[e].y[1] - a.axisY.conversionParameters.minimum) + 0.5 << 0; + var p = b - a.plotType.totalDataSeries * h / 2 + (a.previousDataSeriesCount + q) * h << 0, r = p + h << 0, b = m[e].color ? m[e].color : n._colorSet[e % n._colorSet.length]; + if (d > f) { + var t = d, d = f; + f = t + } + t = n.dataPointIds[e]; + this._eventManager.objectMap[t] = {id: t, objectType: "dataPoint", dataSeriesIndex: k, dataPointIndex: e, x1: p, y1: d, x2: r, y2: f}; + M(c, p, d, r, f, b, 0, b, l, l, !1, !1, n.fillOpacity); + b = C(t); + u && M(this._eventManager.ghostCtx, p, d, r, f, b, 0, null, !1, !1, !1, !1); + if (m[e].indexLabel || n.indexLabel || m[e].indexLabelFormatter || n.indexLabelFormatter) + this._indexLabels.push({chartType: "rangeColumn", dataPoint: m[e], dataSeries: n, indexKeyword: 0, point: {x: p + (r - p) / 2, y: m[e].y[1] >= m[e].y[0] ? f : d}, direction: m[e].y[1] >= + m[e].y[0] ? -1 : 1, bounds: {x1: p, y1: Math.min(d, f), x2: r, y2: Math.max(d, f)}, color: b}), this._indexLabels.push({chartType: "rangeColumn", dataPoint: m[e], dataSeries: n, indexKeyword: 1, point: {x: p + (r - p) / 2, y: m[e].y[1] >= m[e].y[0] ? d : f}, direction: m[e].y[1] >= m[e].y[0] ? 1 : -1, bounds: {x1: p, y1: Math.min(d, f), x2: r, y2: Math.max(d, f)}, color: b}) + } + } + c.restore(); + u && this._eventManager.ghostCtx.restore(); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.fadeInAnimation, easingFunction: B.easing.easeInQuad, animationBase: 0} + } + }; + v.prototype.renderRangeBar = + function (a) { + var c = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var b = null, d = this.plotArea, e = 0, f, g, h, e = this.dataPointMinWidth ? this.dataPointMinWidth : this.dataPointWidth ? this.dataPointWidth : 1; + f = this.dataPointMaxWidth ? this.dataPointMaxWidth : this.dataPointWidth ? this.dataPointWidth : Math.min(0.15 * this.height, 0.9 * (this.plotArea.height / a.plotType.totalDataSeries)) << 0; + var q = a.axisX.dataInfo.minDiff; + isFinite(q) || (q = 0.3 * Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum)); + q = this.dataPointWidth ? this.dataPointWidth : 0.9 * (d.height / Math.abs(a.axisX.viewportMaximum - a.axisX.viewportMinimum) * Math.abs(q) / a.plotType.totalDataSeries) << 0; + this.dataPointMaxWidth && e > f && (e = Math.min(this.dataPointWidth ? this.dataPointWidth : Infinity, f)); + !this.dataPointMaxWidth && (this.dataPointMinWidth && f < e) && (f = Math.max(this.dataPointWidth ? this.dataPointWidth : -Infinity, e)); + q < e && (q = e); + q > f && (q = f); + c.save(); + u && this._eventManager.ghostCtx.save(); + c.beginPath(); + c.rect(d.x1, d.y1, d.width, d.height); + c.clip(); + u && + (this._eventManager.ghostCtx.rect(d.x1, d.y1, d.width, d.height), this._eventManager.ghostCtx.clip()); + for (var k = 0; k < a.dataSeriesIndexes.length; k++) { + var n = a.dataSeriesIndexes[k], m = this.data[n], l = m.dataPoints; + if (0 < l.length) { + var p = 5 < q && m.bevelEnabled ? !0 : !1; + c.strokeStyle = "#4572A7 "; + for (e = 0; e < l.length; e++) + if (l[e].getTime ? h = l[e].x.getTime() : h = l[e].x, !(h < a.axisX.dataInfo.viewPortMin || h > a.axisX.dataInfo.viewPortMax) && null !== l[e].y && l[e].y.length && "number" === typeof l[e].y[0] && "number" === typeof l[e].y[1]) { + d = a.axisY.conversionParameters.reference + + a.axisY.conversionParameters.pixelPerUnit * (l[e].y[0] - a.axisY.conversionParameters.minimum) + 0.5 << 0; + f = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (l[e].y[1] - a.axisY.conversionParameters.minimum) + 0.5 << 0; + g = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (h - a.axisX.conversionParameters.minimum) + 0.5 << 0; + g = g - a.plotType.totalDataSeries * q / 2 + (a.previousDataSeriesCount + k) * q << 0; + var r = g + q << 0; + d > f && (b = d, d = f, f = b); + b = l[e].color ? l[e].color : m._colorSet[e % + m._colorSet.length]; + M(c, d, g, f, r, b, 0, null, p, !1, !1, !1, m.fillOpacity); + b = m.dataPointIds[e]; + this._eventManager.objectMap[b] = {id: b, objectType: "dataPoint", dataSeriesIndex: n, dataPointIndex: e, x1: d, y1: g, x2: f, y2: r}; + b = C(b); + u && M(this._eventManager.ghostCtx, d, g, f, r, b, 0, null, !1, !1, !1, !1); + if (l[e].indexLabel || m.indexLabel || l[e].indexLabelFormatter || m.indexLabelFormatter) + this._indexLabels.push({chartType: "rangeBar", dataPoint: l[e], dataSeries: m, indexKeyword: 0, point: {x: l[e].y[1] >= l[e].y[0] ? d : f, y: g + (r - g) / 2}, direction: l[e].y[1] >= + l[e].y[0] ? -1 : 1, bounds: {x1: Math.min(d, f), y1: g, x2: Math.max(d, f), y2: r}, color: b}), this._indexLabels.push({chartType: "rangeBar", dataPoint: l[e], dataSeries: m, indexKeyword: 1, point: {x: l[e].y[1] >= l[e].y[0] ? f : d, y: g + (r - g) / 2}, direction: l[e].y[1] >= l[e].y[0] ? 1 : -1, bounds: {x1: Math.min(d, f), y1: g, x2: Math.max(d, f), y2: r}, color: b}) + } + } + } + c.restore(); + u && this._eventManager.ghostCtx.restore(); + return{source: c, dest: this.plotArea.ctx, animationCallback: B.fadeInAnimation, easingFunction: B.easing.easeInQuad, animationBase: 0} + } + }; + v.prototype.renderRangeArea = + function (a) { + function c() { + if (y) { + var a = null; + 0 < q.lineThickness && b.stroke(); + for (var c = g.length - 1; 0 <= c; c--) + a = g[c], b.lineTo(a.x, a.y), d.lineTo(a.x, a.y); + b.closePath(); + b.globalAlpha = q.fillOpacity; + b.fill(); + b.globalAlpha = 1; + d.fill(); + if (0 < q.lineThickness) { + b.beginPath(); + b.moveTo(a.x, a.y); + for (c = 0; c < g.length; c++) + a = g[c], b.lineTo(a.x, a.y); + b.stroke() + } + b.beginPath(); + b.moveTo(l, p); + d.beginPath(); + d.moveTo(l, p); + y = {x: l, y: p}; + g = []; + g.push({x: l, y: r}) + } + } + var b = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var d = + this._eventManager.ghostCtx, e = [], f = this.plotArea; + b.save(); + u && d.save(); + b.beginPath(); + b.rect(f.x1, f.y1, f.width, f.height); + b.clip(); + u && (d.beginPath(), d.rect(f.x1, f.y1, f.width, f.height), d.clip()); + for (f = 0; f < a.dataSeriesIndexes.length; f++) { + var g = [], h = a.dataSeriesIndexes[f], q = this.data[h], k = q.dataPoints, e = q.id; + this._eventManager.objectMap[e] = {objectType: "dataSeries", dataSeriesIndex: h}; + e = C(e); + d.fillStyle = e; + var e = [], n = !0, m = 0, l, p, r, t, y = null; + if (0 < k.length) { + var s = q._colorSet[m % q._colorSet.length], z = q._options.lineColor || + s, w = z; + b.fillStyle = s; + b.strokeStyle = z; + b.lineWidth = q.lineThickness; + var x = "solid"; + if (b.setLineDash) { + var v = D(q.nullDataLineDashType, q.lineThickness), x = q.lineDashType, A = D(x, q.lineThickness); + b.setLineDash(A) + } + for (var H = !0; m < k.length; m++) + if (t = k[m].x.getTime ? k[m].x.getTime() : k[m].x, !(t < a.axisX.dataInfo.viewPortMin || t > a.axisX.dataInfo.viewPortMax && (!q.connectNullData || !H))) + if (null !== k[m].y && k[m].y.length && "number" === typeof k[m].y[0] && "number" === typeof k[m].y[1]) { + l = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * + (t - a.axisX.conversionParameters.minimum) + 0.5 << 0; + p = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (k[m].y[0] - a.axisY.conversionParameters.minimum) + 0.5 << 0; + r = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (k[m].y[1] - a.axisY.conversionParameters.minimum) + 0.5 << 0; + n || H ? (q.connectNullData && !n ? (b.setLineDash && (q._options.nullDataLineDashType || x === q.lineDashType && q.lineDashType !== q.nullDataLineDashType) && (g[g.length - 1].newLineDashArray = A, x = + q.nullDataLineDashType, b.setLineDash(v)), b.lineTo(l, p), u && d.lineTo(l, p), g.push({x: l, y: r})) : (b.beginPath(), b.moveTo(l, p), y = {x: l, y: p}, g = [], g.push({x: l, y: r}), u && (d.beginPath(), d.moveTo(l, p))), H = n = !1) : (b.lineTo(l, p), g.push({x: l, y: r}), u && d.lineTo(l, p), 0 == m % 250 && c()); + t = q.dataPointIds[m]; + this._eventManager.objectMap[t] = {id: t, objectType: "dataPoint", dataSeriesIndex: h, dataPointIndex: m, x1: l, y1: p, y2: r}; + m < k.length - 1 && (w !== (k[m].lineColor || z) || x !== (k[m].lineDashType || q.lineDashType)) && (c(), w = k[m].lineColor || z, + g[g.length - 1].newStrokeStyle = w, b.strokeStyle = w, b.setLineDash && (k[m].lineDashType ? (x = k[m].lineDashType, g[g.length - 1].newLineDashArray = D(x, q.lineThickness), b.setLineDash(g[g.length - 1].newLineDashArray)) : (x = q.lineDashType, g[g.length - 1].newLineDashArray = A, b.setLineDash(A)))); + if (0 !== k[m].markerSize && (0 < k[m].markerSize || 0 < q.markerSize)) { + var K = q.getMarkerProperties(m, l, r, b); + e.push(K); + var I = C(t); + u && e.push({x: l, y: r, ctx: d, type: K.type, size: K.size, color: I, borderColor: I, borderThickness: K.borderThickness}); + K = q.getMarkerProperties(m, + l, p, b); + e.push(K); + I = C(t); + u && e.push({x: l, y: p, ctx: d, type: K.type, size: K.size, color: I, borderColor: I, borderThickness: K.borderThickness}) + } + if (k[m].indexLabel || q.indexLabel || k[m].indexLabelFormatter || q.indexLabelFormatter) + this._indexLabels.push({chartType: "rangeArea", dataPoint: k[m], dataSeries: q, indexKeyword: 0, point: {x: l, y: p}, direction: k[m].y[0] <= k[m].y[1] ? -1 : 1, color: s}), this._indexLabels.push({chartType: "rangeArea", dataPoint: k[m], dataSeries: q, indexKeyword: 1, point: {x: l, y: r}, direction: k[m].y[0] <= k[m].y[1] ? 1 : + -1, color: s}) + } else + H || n || c(), H = !0; + c(); + P.drawMarkers(e) + } + } + b.restore(); + u && this._eventManager.ghostCtx.restore(); + return{source: b, dest: this.plotArea.ctx, animationCallback: B.xClipAnimation, easingFunction: B.easing.linear, animationBase: 0} + } + }; + v.prototype.renderRangeSplineArea = function (a) { + function c(a, c) { + var e = ma(p, 2); + if (0 < e.length) { + if (0 < h.lineThickness) { + b.strokeStyle = c; + b.setLineDash && b.setLineDash(a); + b.beginPath(); + b.moveTo(e[0].x, e[0].y); + for (var f = 0; f < e.length - 3; f += 3) { + if (e[f].newStrokeStyle || e[f].newLineDashArray) + b.stroke(), + b.beginPath(), b.moveTo(e[f].x, e[f].y), e[f].newStrokeStyle && (b.strokeStyle = e[f].newStrokeStyle), e[f].newLineDashArray && b.setLineDash(e[f].newLineDashArray); + b.bezierCurveTo(e[f + 1].x, e[f + 1].y, e[f + 2].x, e[f + 2].y, e[f + 3].x, e[f + 3].y) + } + b.stroke() + } + b.beginPath(); + b.moveTo(e[0].x, e[0].y); + u && (d.beginPath(), d.moveTo(e[0].x, e[0].y)); + for (f = 0; f < e.length - 3; f += 3) + b.bezierCurveTo(e[f + 1].x, e[f + 1].y, e[f + 2].x, e[f + 2].y, e[f + 3].x, e[f + 3].y), u && d.bezierCurveTo(e[f + 1].x, e[f + 1].y, e[f + 2].x, e[f + 2].y, e[f + 3].x, e[f + 3].y); + e = ma(r, 2); + b.lineTo(r[r.length - + 1].x, r[r.length - 1].y); + for (f = e.length - 1; 2 < f; f -= 3) + b.bezierCurveTo(e[f - 1].x, e[f - 1].y, e[f - 2].x, e[f - 2].y, e[f - 3].x, e[f - 3].y), u && d.bezierCurveTo(e[f - 1].x, e[f - 1].y, e[f - 2].x, e[f - 2].y, e[f - 3].x, e[f - 3].y); + b.closePath(); + b.globalAlpha = h.fillOpacity; + b.fill(); + u && (d.closePath(), d.fill()); + b.globalAlpha = 1; + if (0 < h.lineThickness) { + b.strokeStyle = c; + b.setLineDash && b.setLineDash(a); + b.beginPath(); + b.moveTo(e[0].x, e[0].y); + for (var g = f = 0; f < e.length - 3; f += 3, g++) { + if (p[g].newStrokeStyle || p[g].newLineDashArray) + b.stroke(), b.beginPath(), + b.moveTo(e[f].x, e[f].y), p[g].newStrokeStyle && (b.strokeStyle = p[g].newStrokeStyle), p[g].newLineDashArray && b.setLineDash(p[g].newLineDashArray); + b.bezierCurveTo(e[f + 1].x, e[f + 1].y, e[f + 2].x, e[f + 2].y, e[f + 3].x, e[f + 3].y) + } + b.stroke() + } + b.beginPath() + } + } + var b = a.targetCanvasCtx || this.plotArea.ctx; + if (!(0 >= a.dataSeriesIndexes.length)) { + var d = this._eventManager.ghostCtx, e = [], f = this.plotArea; + b.save(); + u && d.save(); + b.beginPath(); + b.rect(f.x1, f.y1, f.width, f.height); + b.clip(); + u && (d.beginPath(), d.rect(f.x1, f.y1, f.width, f.height), + d.clip()); + for (f = 0; f < a.dataSeriesIndexes.length; f++) { + var g = a.dataSeriesIndexes[f], h = this.data[g], q = h.dataPoints, e = h.id; + this._eventManager.objectMap[e] = {objectType: "dataSeries", dataSeriesIndex: g}; + e = C(e); + d.fillStyle = e; + var e = [], k = 0, n, m, l, p = [], r = []; + if (0 < q.length) { + var t = h._colorSet[k % h._colorSet.length], y = h._options.lineColor || t, s = y; + b.fillStyle = t; + b.lineWidth = h.lineThickness; + var z = "solid", w; + if (b.setLineDash) { + var x = D(h.nullDataLineDashType, h.lineThickness), z = h.lineDashType; + w = D(z, h.lineThickness) + } + for (m = !1; k < + q.length; k++) + if (n = q[k].x.getTime ? q[k].x.getTime() : q[k].x, !(n < a.axisX.dataInfo.viewPortMin || n > a.axisX.dataInfo.viewPortMax && (!h.connectNullData || !m))) + if (null !== q[k].y && q[k].y.length && "number" === typeof q[k].y[0] && "number" === typeof q[k].y[1]) { + n = a.axisX.conversionParameters.reference + a.axisX.conversionParameters.pixelPerUnit * (n - a.axisX.conversionParameters.minimum) + 0.5 << 0; + m = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (q[k].y[0] - a.axisY.conversionParameters.minimum) + + 0.5 << 0; + l = a.axisY.conversionParameters.reference + a.axisY.conversionParameters.pixelPerUnit * (q[k].y[1] - a.axisY.conversionParameters.minimum) + 0.5 << 0; + var v = h.dataPointIds[k]; + this._eventManager.objectMap[v] = {id: v, objectType: "dataPoint", dataSeriesIndex: g, dataPointIndex: k, x1: n, y1: m, y2: l}; + p[p.length] = {x: n, y: m}; + r[r.length] = {x: n, y: l}; + k < q.length - 1 && (s !== (q[k].lineColor || y) || z !== (q[k].lineDashType || h.lineDashType)) && (s = q[k].lineColor || y, p[p.length - 1].newStrokeStyle = s, b.setLineDash && (q[k].lineDashType ? (z = q[k].lineDashType, + p[p.length - 1].newLineDashArray = D(z, h.lineThickness)) : (z = h.lineDashType, p[p.length - 1].newLineDashArray = w))); + if (0 !== q[k].markerSize && (0 < q[k].markerSize || 0 < h.markerSize)) { + var A = h.getMarkerProperties(k, n, m, b); + e.push(A); + var H = C(v); + u && e.push({x: n, y: m, ctx: d, type: A.type, size: A.size, color: H, borderColor: H, borderThickness: A.borderThickness}); + A = h.getMarkerProperties(k, n, l, b); + e.push(A); + H = C(v); + u && e.push({x: n, y: l, ctx: d, type: A.type, size: A.size, color: H, borderColor: H, borderThickness: A.borderThickness}) + } + if (q[k].indexLabel || + h.indexLabel || q[k].indexLabelFormatter || h.indexLabelFormatter) + this._indexLabels.push({chartType: "splineArea", dataPoint: q[k], dataSeries: h, indexKeyword: 0, point: {x: n, y: m}, direction: q[k].y[0] <= q[k].y[1] ? -1 : 1, color: t}), this._indexLabels.push({chartType: "splineArea", dataPoint: q[k], dataSeries: h, indexKeyword: 1, point: {x: n, y: l}, direction: q[k].y[0] <= q[k].y[1] ? 1 : -1, color: t}); + m = !1 + } else + 0 < k && !m && (h.connectNullData ? b.setLineDash && (0 < p.length && (h._options.nullDataLineDashType || !q[k - 1].lineDashType)) && (p[p.length - + 1].newLineDashArray = x, z = h.nullDataLineDashType) : (c(w, y), p = [], r = [])), m = !0; + c(w, y); + P.drawMarkers(e) + } + } + b.restore(); + u && this._eventManager.ghostCtx.restore(); + return{source: b, dest: this.plotArea.ctx, animationCallback: B.xClipAnimation, easingFunction: B.easing.linear, animationBase: 0} + } + }; + var ya = function (a, c, b, d, e, f, g, h, q) { + if (!(0 > b)) { + "undefined" === typeof h && (h = 1); + if (!u) { + var k = Number((g % (2 * Math.PI)).toFixed(8)); + Number((f % (2 * Math.PI)).toFixed(8)) === k && (g -= 1E-4) + } + a.save(); + a.globalAlpha = h; + "pie" === e ? (a.beginPath(), a.moveTo(c.x, + c.y), a.arc(c.x, c.y, b, f, g, !1), a.fillStyle = d, a.strokeStyle = "white", a.lineWidth = 2, a.closePath(), a.fill()) : "doughnut" === e && (a.beginPath(), a.arc(c.x, c.y, b, f, g, !1), 0 <= q && a.arc(c.x, c.y, q * b, g, f, !0), a.closePath(), a.fillStyle = d, a.strokeStyle = "white", a.lineWidth = 2, a.fill()); + a.globalAlpha = 1; + a.restore() + } + }; + v.prototype.renderPie = function (a) { + function c() { + if (k && n) { + for (var a = 0, b = 0, c = 0, d = 0, e = 0; e < n.length; e++) { + var f = n[e], g = k.dataPointIds[e], h = {id: g, objectType: "dataPoint", dataPointIndex: e, dataSeriesIndex: 0}; + p.push(h); + var m = {percent: null, total: null}, r = null, m = q.getPercentAndTotal(k, f); + if (k.indexLabelFormatter || f.indexLabelFormatter) + r = {chart: q._options, dataSeries: k, dataPoint: f, total: m.total, percent: m.percent}; + m = f.indexLabelFormatter ? f.indexLabelFormatter(r) : f.indexLabel ? q.replaceKeywordsWithValue(f.indexLabel, f, k, e) : k.indexLabelFormatter ? k.indexLabelFormatter(r) : k.indexLabel ? q.replaceKeywordsWithValue(k.indexLabel, f, k, e) : f.label ? f.label : ""; + q._eventManager.objectMap[g] = h; + h.center = {x: w.x, y: w.y}; + h.y = f.y; + h.radius = A; + h.percentInnerRadius = K; + h.indexLabelText = m; + h.indexLabelPlacement = k.indexLabelPlacement; + h.indexLabelLineColor = f.indexLabelLineColor ? f.indexLabelLineColor : k.indexLabelLineColor ? k.indexLabelLineColor : f.color ? f.color : k._colorSet[e % k._colorSet.length]; + h.indexLabelLineThickness = x(f.indexLabelLineThickness) ? k.indexLabelLineThickness : f.indexLabelLineThickness; + h.indexLabelLineDashType = f.indexLabelLineDashType ? f.indexLabelLineDashType : k.indexLabelLineDashType; + h.indexLabelFontColor = f.indexLabelFontColor ? f.indexLabelFontColor : + k.indexLabelFontColor; + h.indexLabelFontStyle = f.indexLabelFontStyle ? f.indexLabelFontStyle : k.indexLabelFontStyle; + h.indexLabelFontWeight = f.indexLabelFontWeight ? f.indexLabelFontWeight : k.indexLabelFontWeight; + h.indexLabelFontSize = f.indexLabelFontSize ? f.indexLabelFontSize : k.indexLabelFontSize; + h.indexLabelFontFamily = f.indexLabelFontFamily ? f.indexLabelFontFamily : k.indexLabelFontFamily; + h.indexLabelBackgroundColor = f.indexLabelBackgroundColor ? f.indexLabelBackgroundColor : k.indexLabelBackgroundColor ? k.indexLabelBackgroundColor : + null; + h.indexLabelMaxWidth = f.indexLabelMaxWidth ? f.indexLabelMaxWidth : k.indexLabelMaxWidth ? k.indexLabelMaxWidth : 0.33 * l.width; + h.indexLabelWrap = "undefined" !== typeof f.indexLabelWrap ? f.indexLabelWrap : k.indexLabelWrap; + h.startAngle = 0 === e ? k.startAngle ? k.startAngle / 180 * Math.PI : 0 : p[e - 1].endAngle; + h.startAngle = (h.startAngle + 2 * Math.PI) % (2 * Math.PI); + h.endAngle = h.startAngle + 2 * Math.PI / v * Math.abs(f.y); + f = (h.endAngle + h.startAngle) / 2; + f = (f + 2 * Math.PI) % (2 * Math.PI); + h.midAngle = f; + if (h.midAngle > Math.PI / 2 - s && h.midAngle < Math.PI / + 2 + s) { + if (0 === a || p[c].midAngle > h.midAngle) + c = e; + a++ + } else if (h.midAngle > 3 * Math.PI / 2 - s && h.midAngle < 3 * Math.PI / 2 + s) { + if (0 === b || p[d].midAngle > h.midAngle) + d = e; + b++ + } + h.hemisphere = f > Math.PI / 2 && f <= 3 * Math.PI / 2 ? "left" : "right"; + h.indexLabelTextBlock = new O(q.plotArea.ctx, {fontSize: h.indexLabelFontSize, fontFamily: h.indexLabelFontFamily, fontColor: h.indexLabelFontColor, fontStyle: h.indexLabelFontStyle, fontWeight: h.indexLabelFontWeight, horizontalAlign: "left", backgroundColor: h.indexLabelBackgroundColor, maxWidth: h.indexLabelMaxWidth, + maxHeight: h.indexLabelWrap ? 5 * h.indexLabelFontSize : 1.5 * h.indexLabelFontSize, text: h.indexLabelText, padding: 0, textBaseline: "top"}); + h.indexLabelTextBlock.measureText() + } + g = f = 0; + m = !1; + for (e = 0; e < n.length; e++) + h = p[(c + e) % n.length], 1 < a && (h.midAngle > Math.PI / 2 - s && h.midAngle < Math.PI / 2 + s) && (f <= a / 2 && !m ? (h.hemisphere = "right", f++) : (h.hemisphere = "left", m = !0)); + m = !1; + for (e = 0; e < n.length; e++) + h = p[(d + e) % n.length], 1 < b && (h.midAngle > 3 * Math.PI / 2 - s && h.midAngle < 3 * Math.PI / 2 + s) && (g <= b / 2 && !m ? (h.hemisphere = "left", g++) : (h.hemisphere = "right", + m = !0)) + } + } + function b(a) { + var b = q.plotArea.ctx; + b.clearRect(l.x1, l.y1, l.width, l.height); + b.fillStyle = q.backgroundColor; + b.fillRect(l.x1, l.y1, l.width, l.height); + for (b = 0; b < n.length; b++) { + var c = p[b].startAngle, d = p[b].endAngle; + if (d > c) { + var e = 0.07 * A * Math.cos(p[b].midAngle), f = 0.07 * A * Math.sin(p[b].midAngle), g = !1; + if (n[b].exploded) { + if (1E-9 < Math.abs(p[b].center.x - (w.x + e)) || 1E-9 < Math.abs(p[b].center.y - (w.y + f))) + p[b].center.x = w.x + e * a, p[b].center.y = w.y + f * a, g = !0 + } else if (0 < Math.abs(p[b].center.x - w.x) || 0 < Math.abs(p[b].center.y - + w.y)) + p[b].center.x = w.x + e * (1 - a), p[b].center.y = w.y + f * (1 - a), g = !0; + g && (e = {}, e.dataSeries = k, e.dataPoint = k.dataPoints[b], e.index = b, q._toolTip.highlightObjects([e])); + ya(q.plotArea.ctx, p[b].center, p[b].radius, n[b].color ? n[b].color : k._colorSet[b % k._colorSet.length], k.type, c, d, k.fillOpacity, p[b].percentInnerRadius) + } + } + a = q.plotArea.ctx; + a.save(); + a.fillStyle = "black"; + a.strokeStyle = "grey"; + a.textBaseline = "middle"; + a.lineJoin = "round"; + for (b = b = 0; b < n.length; b++) + c = p[b], c.indexLabelText && (c.indexLabelTextBlock.y -= c.indexLabelTextBlock.height / + 2, d = 0, d = "left" === c.hemisphere ? "inside" !== k.indexLabelPlacement ? -(c.indexLabelTextBlock.width + m) : -c.indexLabelTextBlock.width / 2 : "inside" !== k.indexLabelPlacement ? m : -c.indexLabelTextBlock.width / 2, c.indexLabelTextBlock.x += d, c.indexLabelTextBlock.render(!0), c.indexLabelTextBlock.x -= d, c.indexLabelTextBlock.y += c.indexLabelTextBlock.height / 2, "inside" !== c.indexLabelPlacement && 0 < c.indexLabelLineThickness && (d = c.center.x + A * Math.cos(c.midAngle), e = c.center.y + A * Math.sin(c.midAngle), a.strokeStyle = c.indexLabelLineColor, + a.lineWidth = c.indexLabelLineThickness, a.setLineDash && a.setLineDash(D(c.indexLabelLineDashType, c.indexLabelLineThickness)), a.beginPath(), a.moveTo(d, e), a.lineTo(c.indexLabelTextBlock.x, c.indexLabelTextBlock.y), a.lineTo(c.indexLabelTextBlock.x + ("left" === c.hemisphere ? -m : m), c.indexLabelTextBlock.y), a.stroke()), a.lineJoin = "miter"); + a.save() + } + function d(a, b) { + var c = 0, c = a.indexLabelTextBlock.y - a.indexLabelTextBlock.height / 2, d = a.indexLabelTextBlock.y + a.indexLabelTextBlock.height / 2, e = b.indexLabelTextBlock.y - b.indexLabelTextBlock.height / + 2, f = b.indexLabelTextBlock.y + b.indexLabelTextBlock.height / 2; + return c = b.indexLabelTextBlock.y > a.indexLabelTextBlock.y ? e - d : c - f + } + function e(a) { + for (var b = null, c = 1; c < n.length; c++) + if (b = (a + c + p.length) % p.length, p[b].hemisphere !== p[a].hemisphere) { + b = null; + break + } else if (p[b].indexLabelText && b !== a && (0 > d(p[b], p[a]) || ("right" === p[a].hemisphere ? p[b].indexLabelTextBlock.y >= p[a].indexLabelTextBlock.y : p[b].indexLabelTextBlock.y <= p[a].indexLabelTextBlock.y))) + break; + else + b = null; + return b + } + function f(a, b, c) { + c = (c || 0) + 1; + if (1E3 < + c) + return 0; + b = b || 0; + var g = 0, k = w.y - 1 * t, h = w.y + 1 * t; + if (0 <= a && a < n.length) { + var l = p[a]; + if (0 > b && l.indexLabelTextBlock.y < k || 0 < b && l.indexLabelTextBlock.y > h) + return 0; + var m = 0, q = 0, q = m = m = 0; + 0 > b ? l.indexLabelTextBlock.y - l.indexLabelTextBlock.height / 2 > k && l.indexLabelTextBlock.y - l.indexLabelTextBlock.height / 2 + b < k && (b = -(k - (l.indexLabelTextBlock.y - l.indexLabelTextBlock.height / 2 + b))) : l.indexLabelTextBlock.y + l.indexLabelTextBlock.height / 2 < k && l.indexLabelTextBlock.y + l.indexLabelTextBlock.height / 2 + b > h && (b = l.indexLabelTextBlock.y + + l.indexLabelTextBlock.height / 2 + b - h); + b = l.indexLabelTextBlock.y + b; + k = 0; + k = "right" === l.hemisphere ? w.x + Math.sqrt(Math.pow(t, 2) - Math.pow(b - w.y, 2)) : w.x - Math.sqrt(Math.pow(t, 2) - Math.pow(b - w.y, 2)); + q = w.x + A * Math.cos(l.midAngle); + m = w.y + A * Math.sin(l.midAngle); + m = Math.sqrt(Math.pow(k - q, 2) + Math.pow(b - m, 2)); + q = Math.acos(A / t); + m = Math.acos((t * t + A * A - m * m) / (2 * A * t)); + b = m < q ? b - l.indexLabelTextBlock.y : 0; + k = null; + for (h = 1; h < n.length; h++) + if (k = (a - h + p.length) % p.length, p[k].hemisphere !== p[a].hemisphere) { + k = null; + break + } else if (p[k].indexLabelText && + p[k].hemisphere === p[a].hemisphere && k !== a && (0 > d(p[k], p[a]) || ("right" === p[a].hemisphere ? p[k].indexLabelTextBlock.y <= p[a].indexLabelTextBlock.y : p[k].indexLabelTextBlock.y >= p[a].indexLabelTextBlock.y))) + break; + else + k = null; + q = k; + m = e(a); + h = k = 0; + 0 > b ? (h = "right" === l.hemisphere ? q : m, g = b, null !== h && (q = -b, b = l.indexLabelTextBlock.y - l.indexLabelTextBlock.height / 2 - (p[h].indexLabelTextBlock.y + p[h].indexLabelTextBlock.height / 2), b - q < r && (k = -q, h = f(h, k, c + 1), +h.toFixed(u) > +k.toFixed(u) && (g = b > r ? -(b - r) : -(q - (h - k)))))) : 0 < b && (h = "right" === + l.hemisphere ? m : q, g = b, null !== h && (q = b, b = p[h].indexLabelTextBlock.y - p[h].indexLabelTextBlock.height / 2 - (l.indexLabelTextBlock.y + l.indexLabelTextBlock.height / 2), b - q < r && (k = q, h = f(h, k, c + 1), +h.toFixed(u) < +k.toFixed(u) && (g = b > r ? b - r : q - (k - h))))); + g && (c = l.indexLabelTextBlock.y + g, b = 0, b = "right" === l.hemisphere ? w.x + Math.sqrt(Math.pow(t, 2) - Math.pow(c - w.y, 2)) : w.x - Math.sqrt(Math.pow(t, 2) - Math.pow(c - w.y, 2)), l.midAngle > Math.PI / 2 - s && l.midAngle < Math.PI / 2 + s ? (k = (a - 1 + p.length) % p.length, k = p[k], a = p[(a + 1 + p.length) % p.length], "left" === + l.hemisphere && "right" === k.hemisphere && b > k.indexLabelTextBlock.x ? b = k.indexLabelTextBlock.x - 15 : "right" === l.hemisphere && ("left" === a.hemisphere && b < a.indexLabelTextBlock.x) && (b = a.indexLabelTextBlock.x + 15)) : l.midAngle > 3 * Math.PI / 2 - s && l.midAngle < 3 * Math.PI / 2 + s && (k = (a - 1 + p.length) % p.length, k = p[k], a = p[(a + 1 + p.length) % p.length], "right" === l.hemisphere && "left" === k.hemisphere && b < k.indexLabelTextBlock.x ? b = k.indexLabelTextBlock.x + 15 : "left" === l.hemisphere && ("right" === a.hemisphere && b > a.indexLabelTextBlock.x) && (b = a.indexLabelTextBlock.x - + 15)), l.indexLabelTextBlock.y = c, l.indexLabelTextBlock.x = b, l.indexLabelAngle = Math.atan2(l.indexLabelTextBlock.y - w.y, l.indexLabelTextBlock.x - w.x)) + } + return g + } + function g() { + var a = q.plotArea.ctx; + a.fillStyle = "grey"; + a.strokeStyle = "grey"; + a.font = "16px Arial"; + a.textBaseline = "middle"; + for (var b = a = 0, c = 0, g = !0, b = 0; 10 > b && (1 > b || 0 < c); b++) { + if (k.radius || !k.radius && "undefined" !== typeof k.innerRadius && null !== k.innerRadius && A - c <= H) + g = !1; + g && (A -= c); + c = 0; + if ("inside" !== k.indexLabelPlacement) { + t = A * y; + for (a = 0; a < n.length; a++) { + var h = + p[a]; + h.indexLabelTextBlock.x = w.x + t * Math.cos(h.midAngle); + h.indexLabelTextBlock.y = w.y + t * Math.sin(h.midAngle); + h.indexLabelAngle = h.midAngle; + h.radius = A; + h.percentInnerRadius = K + } + for (var s, x, a = 0; a < n.length; a++) { + var h = p[a], v = e(a); + if (null !== v) { + s = p[a]; + x = p[v]; + var B = 0, B = d(s, x) - r; + if (0 > B) { + for (var C = x = 0, D = 0; D < n.length; D++) + D !== a && p[D].hemisphere === h.hemisphere && (p[D].indexLabelTextBlock.y < h.indexLabelTextBlock.y ? x++ : C++); + x = B / (x + C || 1) * C; + var C = -1 * (B - x), E = D = 0; + "right" === h.hemisphere ? (D = f(a, x), C = -1 * (B - D), E = f(v, C), +E.toFixed(u) < + +C.toFixed(u) && +D.toFixed(u) <= +x.toFixed(u) && f(a, -(C - E))) : (D = f(v, x), C = -1 * (B - D), E = f(a, C), +E.toFixed(u) < +C.toFixed(u) && +D.toFixed(u) <= +x.toFixed(u) && f(v, -(C - E))) + } + } + } + } else + for (a = 0; a < n.length; a++) + h = p[a], t = "pie" === k.type ? 0.7 * A : 0.8 * A, v = w.x + t * Math.cos(h.midAngle), x = w.y + t * Math.sin(h.midAngle), h.indexLabelTextBlock.x = v, h.indexLabelTextBlock.y = x; + for (a = 0; a < n.length; a++) + if (h = p[a], v = h.indexLabelTextBlock.measureText(), 0 !== v.height && 0 !== v.width) + v = v = 0, "right" === h.hemisphere ? (v = l.x2 - (h.indexLabelTextBlock.x + h.indexLabelTextBlock.width + + m), v *= -1) : v = l.x1 - (h.indexLabelTextBlock.x - h.indexLabelTextBlock.width - m), 0 < v && (!g && h.indexLabelText && (x = "right" === h.hemisphere ? l.x2 - h.indexLabelTextBlock.x : h.indexLabelTextBlock.x - l.x1, 0.3 * h.indexLabelTextBlock.maxWidth > x ? h.indexLabelText = "" : h.indexLabelTextBlock.maxWidth = 0.85 * x, 0.3 * h.indexLabelTextBlock.maxWidth < x && (h.indexLabelTextBlock.x -= "right" === h.hemisphere ? 2 : -2)), Math.abs(h.indexLabelTextBlock.y - h.indexLabelTextBlock.height / 2 - w.y) < A || Math.abs(h.indexLabelTextBlock.y + h.indexLabelTextBlock.height / + 2 - w.y) < A) && (v /= Math.abs(Math.cos(h.indexLabelAngle)), 9 < v && (v *= 0.3), v > c && (c = v)), v = v = 0, 0 < h.indexLabelAngle && h.indexLabelAngle < Math.PI ? (v = l.y2 - (h.indexLabelTextBlock.y + h.indexLabelTextBlock.height / 2 + 5), v *= -1) : v = l.y1 - (h.indexLabelTextBlock.y - h.indexLabelTextBlock.height / 2 - 5), 0 < v && (!g && h.indexLabelText && (x = 0 < h.indexLabelAngle && h.indexLabelAngle < Math.PI ? -1 : 1, 0 === f(a, v * x) && f(a, 2 * x)), Math.abs(h.indexLabelTextBlock.x - w.x) < A && (v /= Math.abs(Math.sin(h.indexLabelAngle)), 9 < v && (v *= 0.3), v > c && (c = v))); + var F = function (a, + b, c) { + for (var d = [], e = 0; d.push(p[b]), b !== c; b = (b + 1 + n.length) % n.length) + ; + d.sort(function (a, b) { + return a.y - b.y + }); + for (b = 0; b < d.length; b++) + if (c = d[b], e < 0.7 * a) + e += c.indexLabelTextBlock.height, c.indexLabelTextBlock.text = "", c.indexLabelText = "", c.indexLabelTextBlock.measureText(); + else + break + }; + (function () { + for (var a = -1, b = -1, c = 0, f = !1, g = 0; g < n.length; g++) + if (f = !1, s = p[g], s.indexLabelText) { + var h = e(g); + if (null !== h) { + var k = p[h]; + B = 0; + B = d(s, k); + var l; + if (l = 0 > B) { + l = s.indexLabelTextBlock.x; + var q = s.indexLabelTextBlock.y - s.indexLabelTextBlock.height / + 2, r = s.indexLabelTextBlock.y + s.indexLabelTextBlock.height / 2, t = k.indexLabelTextBlock.y - k.indexLabelTextBlock.height / 2, u = k.indexLabelTextBlock.x + k.indexLabelTextBlock.width, y = k.indexLabelTextBlock.y + k.indexLabelTextBlock.height / 2; + l = s.indexLabelTextBlock.x + s.indexLabelTextBlock.width < k.indexLabelTextBlock.x - m || l > u + m || q > y + m || r < t - m ? !1 : !0 + } + l ? (0 > a && (a = g), h !== a && (b = h, c += -B), 0 === g % Math.max(n.length / 10, 3) && (f = !0)) : f = !0; + f && (0 < c && 0 <= a && 0 <= b) && (F(c, a, b), b = a = -1, c = 0) + } + } + 0 < c && F(c, a, b) + })() + } + } + function h() { + q.plotArea.layoutManager.reset(); + q._title && (q._title.dockInsidePlotArea || "center" === q._title.horizontalAlign && "center" === q._title.verticalAlign) && q._title.render(); + if (q.subtitles) + for (var a = 0; a < q.subtitles.length; a++) { + var b = q.subtitles[a]; + (b.dockInsidePlotArea || "center" === b.horizontalAlign && "center" === b.verticalAlign) && b.render() + } + q.legend && (q.legend.dockInsidePlotArea || "center" === q.legend.horizontalAlign && "center" === q.legend.verticalAlign) && q.legend.render() + } + var q = this; + if (!(0 >= a.dataSeriesIndexes.length)) { + var k = this.data[a.dataSeriesIndexes[0]], + n = k.dataPoints, m = 10, l = this.plotArea, p = [], r = 2, t, y = 1.3, s = 20 / 180 * Math.PI, u = 6, w = {x: (l.x2 + l.x1) / 2, y: (l.y2 + l.y1) / 2}, v = 0; + a = !1; + for (var B = 0; B < n.length; B++) + v += Math.abs(n[B].y), !a && ("undefined" !== typeof n[B].indexLabel && null !== n[B].indexLabel && 0 < n[B].indexLabel.toString().length) && (a = !0), !a && ("undefined" !== typeof n[B].label && null !== n[B].label && 0 < n[B].label.toString().length) && (a = !0); + if (0 !== v) { + a = a || "undefined" !== typeof k.indexLabel && null !== k.indexLabel && 0 < k.indexLabel.toString().length; + var A = "inside" !== k.indexLabelPlacement && + a ? 0.75 * Math.min(l.width, l.height) / 2 : 0.92 * Math.min(l.width, l.height) / 2; + k.radius && (A = Ha(k.radius, A)); + var H = "undefined" !== typeof k.innerRadius && null !== k.innerRadius ? Ha(k.innerRadius, A) : 0.7 * A, K = Math.min(H / A, (A - 1) / A); + this.pieDoughnutClickHandler = function (a) { + q.isAnimating || !x(a.dataSeries.explodeOnClick) && !a.dataSeries.explodeOnClick || (a = a.dataPoint, a.exploded = a.exploded ? !1 : !0, 1 < this.dataPoints.length && q._animator.animate(0, 500, function (a) { + b(a); + h() + })) + }; + c(); + g(); + g(); + g(); + g(); + this.disableToolTip = !0; + this._animator.animate(0, + this.animatedRender ? this.animationDuration : 0, function (a) { + var b = q.plotArea.ctx; + b.clearRect(l.x1, l.y1, l.width, l.height); + b.fillStyle = q.backgroundColor; + b.fillRect(l.x1, l.y1, l.width, l.height); + a = p[0].startAngle + 2 * Math.PI * a; + for (b = 0; b < n.length; b++) { + var c = 0 === b ? p[b].startAngle : d, d = c + (p[b].endAngle - p[b].startAngle), e = !1; + d > a && (d = a, e = !0); + var f = n[b].color ? n[b].color : k._colorSet[b % k._colorSet.length]; + d > c && ya(q.plotArea.ctx, p[b].center, p[b].radius, f, k.type, c, d, k.fillOpacity, p[b].percentInnerRadius); + if (e) + break + } + h() + }, + function () { + q.disableToolTip = !1; + q._animator.animate(0, q.animatedRender ? 500 : 0, function (a) { + b(a); + h() + }) + }) + } + } + }; + v.prototype.animationRequestId = null; + v.prototype.requestAnimFrame = function () { + return window.requestAnimationFrame || window.webkitRequestAnimationFrame || window.mozRequestAnimationFrame || window.oRequestAnimationFrame || window.msRequestAnimationFrame || function (a) { + window.setTimeout(a, 1E3 / 60) + } + }(); + v.prototype.cancelRequestAnimFrame = window.cancelAnimationFrame || window.webkitCancelRequestAnimationFrame || window.mozCancelRequestAnimationFrame || + window.oCancelRequestAnimationFrame || window.msCancelRequestAnimationFrame || clearTimeout; + da.prototype.registerSpace = function (a, c) { + "top" === a ? this._topOccupied += c.height : "bottom" === a ? this._bottomOccupied += c.height : "left" === a ? this._leftOccupied += c.width : "right" === a && (this._rightOccupied += c.width) + }; + da.prototype.unRegisterSpace = function (a, c) { + "top" === a ? this._topOccupied -= c.height : "bottom" === a ? this._bottomOccupied -= c.height : "left" === a ? this._leftOccupied -= c.width : "right" === a && (this._rightOccupied -= c.width) + }; + da.prototype.getFreeSpace = function () { + return{x1: this._x1 + this._leftOccupied, y1: this._y1 + this._topOccupied, x2: this._x2 - this._rightOccupied, y2: this._y2 - this._bottomOccupied, width: this._x2 - this._x1 - this._rightOccupied - this._leftOccupied, height: this._y2 - this._y1 - this._bottomOccupied - this._topOccupied} + }; + da.prototype.reset = function () { + this._rightOccupied = this._leftOccupied = this._bottomOccupied = this._topOccupied = this._padding + }; + T(O, L); + O.prototype.render = function (a) { + a && this.ctx.save(); + var c = this.ctx.font; + this.ctx.textBaseline = + this.textBaseline; + var b = 0; + this._isDirty && this.measureText(this.ctx); + this.ctx.translate(this.x, this.y + b); + "middle" === this.textBaseline && (b = -this._lineHeight / 2); + this.ctx.font = this._getFontString(); + this.ctx.rotate(Math.PI / 180 * this.angle); + var d = 0, e = this.padding, f = null; + (0 < this.borderThickness && this.borderColor || this.backgroundColor) && this.ctx.roundRect(0, b, this.width, this.height, this.cornerRadius, this.borderThickness, this.backgroundColor, this.borderColor); + this.ctx.fillStyle = this.fontColor; + for (b = 0; b < this._wrappedText.lines.length; b++) + f = + this._wrappedText.lines[b], "right" === this.horizontalAlign ? d = this.width - f.width - this.padding : "left" === this.horizontalAlign ? d = this.padding : "center" === this.horizontalAlign && (d = (this.width - 2 * this.padding) / 2 - f.width / 2 + this.padding), this.ctx.fillText(f.text, d, e), e += f.height; + this.ctx.font = c; + a && this.ctx.restore() + }; + O.prototype.setText = function (a) { + this.text = a; + this._isDirty = !0; + this._wrappedText = null + }; + O.prototype.measureText = function () { + if (null === this.maxWidth) + throw"Please set maxWidth and height for TextBlock"; + this._wrapText(this.ctx); + this._isDirty = !1; + return{width: this.width, height: this.height} + }; + O.prototype._getLineWithWidth = function (a, c, b) { + a = String(a); + if (!a) + return{text: "", width: 0}; + var d = b = 0, e = a.length - 1, f = Infinity; + for (this.ctx.font = this._getFontString(); d <= e; ) { + var f = Math.floor((d + e) / 2), g = a.substr(0, f + 1); + b = this.ctx.measureText(g).width; + if (b < c) + d = f + 1; + else if (b > c) + e = f - 1; + else + break + } + b > c && 1 < g.length && (g = g.substr(0, g.length - 1), b = this.ctx.measureText(g).width); + c = !0; + if (g.length === a.length || " " === a[g.length]) + c = !1; + c && (a = g.split(" "), 1 < a.length && a.pop(), g = a.join(" "), b = this.ctx.measureText(g).width); + return{text: g, width: b} + }; + O.prototype._wrapText = function () { + var a = new String(ea(String(this.text))), c = [], b = this.ctx.font, d = 0, e = 0; + for (this.ctx.font = this._getFontString(); 0 < a.length; ) { + var f = this.maxHeight - 2 * this.padding, g = this._getLineWithWidth(a, this.maxWidth - 2 * this.padding, !1); + g.height = this._lineHeight; + c.push(g); + e = Math.max(e, g.width); + d += g.height; + a = ea(a.slice(g.text.length, a.length)); + f && d > f && (g = c.pop(), d -= g.height) + } + this._wrappedText = + {lines: c, width: e, height: d}; + this.width = e + 2 * this.padding; + this.height = d + 2 * this.padding; + this.ctx.font = b + }; + O.prototype._getFontString = function () { + var a; + a = "" + (this.fontStyle ? this.fontStyle + " " : ""); + a += this.fontWeight ? this.fontWeight + " " : ""; + a += this.fontSize ? this.fontSize + "px " : ""; + var c = this.fontFamily ? this.fontFamily + "" : ""; + !u && c && (c = c.split(",")[0], "'" !== c[0] && '"' !== c[0] && (c = "'" + c + "'")); + return a += c + }; + T(ga, L); + ga.prototype.render = function () { + if (this.text) { + var a = this.dockInsidePlotArea ? this.chart.plotArea : this.chart, + c = a.layoutManager.getFreeSpace(), b = c.x1, d = c.y1, e = 0, f = 0, g = this.chart._menuButton && this.chart.exportEnabled && "top" === this.verticalAlign ? 22 : 0, h, q; + "top" === this.verticalAlign || "bottom" === this.verticalAlign ? (null === this.maxWidth && (this.maxWidth = c.width - 4 - g * ("center" === this.horizontalAlign ? 2 : 1)), f = 0.5 * c.height - this.margin - 2, e = 0) : "center" === this.verticalAlign && ("left" === this.horizontalAlign || "right" === this.horizontalAlign ? (null === this.maxWidth && (this.maxWidth = c.height - 4), f = 0.5 * c.width - this.margin - 2) : "center" === + this.horizontalAlign && (null === this.maxWidth && (this.maxWidth = c.width - 4), f = 0.5 * c.height - 4)); + this.wrap || (f = Math.min(f, Math.max(1.5 * this.fontSize, this.fontSize + 2.5 * this.padding))); + var f = new O(this.ctx, {fontSize: this.fontSize, fontFamily: this.fontFamily, fontColor: this.fontColor, fontStyle: this.fontStyle, fontWeight: this.fontWeight, horizontalAlign: this.horizontalAlign, verticalAlign: this.verticalAlign, borderColor: this.borderColor, borderThickness: this.borderThickness, backgroundColor: this.backgroundColor, maxWidth: this.maxWidth, + maxHeight: f, cornerRadius: this.cornerRadius, text: this.text, padding: this.padding, textBaseline: "top"}), k = f.measureText(); + "top" === this.verticalAlign || "bottom" === this.verticalAlign ? ("top" === this.verticalAlign ? (d = c.y1 + 2, q = "top") : "bottom" === this.verticalAlign && (d = c.y2 - 2 - k.height, q = "bottom"), "left" === this.horizontalAlign ? b = c.x1 + 2 : "center" === this.horizontalAlign ? b = c.x1 + c.width / 2 - k.width / 2 : "right" === this.horizontalAlign && (b = c.x2 - 2 - k.width - g), h = this.horizontalAlign, this.width = k.width, this.height = k.height) : "center" === + this.verticalAlign && ("left" === this.horizontalAlign ? (b = c.x1 + 2, d = c.y2 - 2 - (this.maxWidth / 2 - k.width / 2), e = -90, q = "left", this.width = k.height, this.height = k.width) : "right" === this.horizontalAlign ? (b = c.x2 - 2, d = c.y1 + 2 + (this.maxWidth / 2 - k.width / 2), e = 90, q = "right", this.width = k.height, this.height = k.width) : "center" === this.horizontalAlign && (d = a.y1 + (a.height / 2 - k.height / 2), b = a.x1 + (a.width / 2 - k.width / 2), q = "center", this.width = k.width, this.height = k.height), h = "center"); + f.x = b; + f.y = d; + f.angle = e; + f.horizontalAlign = h; + f.render(!0); + a.layoutManager.registerSpace(q, {width: this.width + ("left" === q || "right" === q ? this.margin + 2 : 0), height: this.height + ("top" === q || "bottom" === q ? this.margin + 2 : 0)}); + this.bounds = {x1: b, y1: d, x2: b + this.width, y2: d + this.height}; + this.ctx.textBaseline = "top" + } + }; + T(na, L); + na.prototype.render = ga.prototype.render; + T(oa, L); + oa.prototype.render = function () { + var a = this.dockInsidePlotArea ? this.chart.plotArea : this.chart, c = a.layoutManager.getFreeSpace(), b = null, d = 0, e = 0, f = 0, g = 0, h = this.chart._options.legend && !x(this.chart._options.legend.markerMargin) ? + this.chart._options.legend.markerMargin : 0.3 * this.fontSize, q = [], k = []; + "top" === this.verticalAlign || "bottom" === this.verticalAlign ? (this.orientation = "horizontal", b = this.verticalAlign, f = null !== this.maxWidth ? this.maxWidth : 0.7 * c.width, g = null !== this.maxHeight ? this.maxHeight : 0.5 * c.height) : "center" === this.verticalAlign && (this.orientation = "vertical", b = this.horizontalAlign, f = null !== this.maxWidth ? this.maxWidth : 0.5 * c.width, g = null !== this.maxHeight ? this.maxHeight : 0.7 * c.height); + for (var n = 0; n < this.dataSeries.length; n++) { + var m = + this.dataSeries[n]; + if ("pie" !== m.type && "doughnut" !== m.type && "funnel" !== m.type) { + var l = m.legendMarkerType ? m.legendMarkerType : "line" !== m.type && "stepLine" !== m.type && "spline" !== m.type && "scatter" !== m.type && "bubble" !== m.type || !m.markerType ? Y.getDefaultLegendMarker(m.type) : m.markerType, p = m.legendText ? m.legendText : this.itemTextFormatter ? this.itemTextFormatter({chart: this.chart._publicChartReference, legend: this._options, dataSeries: m, dataPoint: null}) : m.name, r = m.legendMarkerColor ? m.legendMarkerColor : m.markerColor ? + m.markerColor : m._colorSet[0], t = m.markerSize || "line" !== m.type && "stepLine" !== m.type && "spline" !== m.type ? 0.75 * this.lineHeight : 0, u = m.legendMarkerBorderColor ? m.legendMarkerBorderColor : m.markerBorderColor, s = m.legendMarkerBorderThickness ? m.legendMarkerBorderThickness : m.markerBorderThickness ? Math.max(1, Math.round(0.2 * t)) : 0, p = this.chart.replaceKeywordsWithValue(p, m.dataPoints[0], m, n), l = {markerType: l, markerColor: r, text: p, textBlock: null, chartType: m.type, markerSize: t, lineColor: m._colorSet[0], dataSeriesIndex: m.index, + dataPointIndex: null, markerBorderColor: u, markerBorderThickness: s}; + q.push(l) + } else + for (var v = 0; v < m.dataPoints.length; v++) { + var w = m.dataPoints[v], l = w.legendMarkerType ? w.legendMarkerType : m.legendMarkerType ? m.legendMarkerType : Y.getDefaultLegendMarker(m.type), p = w.legendText ? w.legendText : m.legendText ? m.legendText : this.itemTextFormatter ? this.itemTextFormatter({chart: this.chart._publicChartReference, legend: this._options, dataSeries: m, dataPoint: w}) : w.name ? w.name : "DataPoint: " + (v + 1), r = w.legendMarkerColor ? w.legendMarkerColor : + m.legendMarkerColor ? m.legendMarkerColor : w.color ? w.color : m.color ? m.color : m._colorSet[v % m._colorSet.length], t = 0.75 * this.lineHeight, u = w.legendMarkerBorderColor ? w.legendMarkerBorderColor : m.legendMarkerBorderColor ? m.legendMarkerBorderColor : w.markerBorderColor ? w.markerBorderColor : m.markerBorderColor, s = w.legendMarkerBorderThickness ? w.legendMarkerBorderThickness : m.legendMarkerBorderThickness ? m.legendMarkerBorderThickness : w.markerBorderThickness || m.markerBorderThickness ? Math.max(1, Math.round(0.2 * t)) : 0, p = this.chart.replaceKeywordsWithValue(p, + w, m, v), l = {markerType: l, markerColor: r, text: p, textBlock: null, chartType: m.type, markerSize: t, dataSeriesIndex: n, dataPointIndex: v, markerBorderColor: u, markerBorderThickness: s}; + (w.showInLegend || m.showInLegend && !1 !== w.showInLegend) && q.push(l) + } + } + !0 === this.reversed && q.reverse(); + if (0 < q.length) { + m = null; + v = p = w = 0; + p = null !== this.itemWidth ? null !== this.itemMaxWidth ? Math.min(this.itemWidth, this.itemMaxWidth, f) : Math.min(this.itemWidth, f) : null !== this.itemMaxWidth ? Math.min(this.itemMaxWidth, f) : f; + t = 0 === t ? 0.75 * this.lineHeight : + t; + p -= t + h; + for (n = 0; n < q.length; n++) { + l = q[n]; + if ("line" === l.chartType || "spline" === l.chartType || "stepLine" === l.chartType) + p -= 2 * 0.1 * this.lineHeight; + if (!(0 >= g || "undefined" === typeof g || 0 >= p || "undefined" === typeof p)) { + if ("horizontal" === this.orientation) { + l.textBlock = new O(this.ctx, {x: 0, y: 0, maxWidth: p, maxHeight: this.itemWrap ? g : this.lineHeight, angle: 0, text: l.text, horizontalAlign: "left", fontSize: this.fontSize, fontFamily: this.fontFamily, fontWeight: this.fontWeight, fontColor: this.fontColor, fontStyle: this.fontStyle, textBaseline: "middle"}); + l.textBlock.measureText(); + null !== this.itemWidth && (l.textBlock.width = this.itemWidth - (t + h + ("line" === l.chartType || "spline" === l.chartType || "stepLine" === l.chartType ? 2 * 0.1 * this.lineHeight : 0))); + if (!m || m.width + Math.round(l.textBlock.width + t + h + (0 === m.width ? 0 : this.horizontalSpacing) + ("line" === l.chartType || "spline" === l.chartType || "stepLine" === l.chartType ? 2 * 0.1 * this.lineHeight : 0)) > f) + m = {items: [], width: 0}, k.push(m), this.height += v, v = 0; + v = Math.max(v, l.textBlock.height) + } else + l.textBlock = new O(this.ctx, {x: 0, y: 0, maxWidth: p, + maxHeight: !0 === this.itemWrap ? g : 1.5 * this.fontSize, angle: 0, text: l.text, horizontalAlign: "left", fontSize: this.fontSize, fontFamily: this.fontFamily, fontWeight: this.fontWeight, fontColor: this.fontColor, fontStyle: this.fontStyle, textBaseline: "middle"}), l.textBlock.measureText(), null !== this.itemWidth && (l.textBlock.width = this.itemWidth - (t + h + ("line" === l.chartType || "spline" === l.chartType || "stepLine" === l.chartType ? 2 * 0.1 * this.lineHeight : 0))), this.height < g - this.lineHeight ? (m = {items: [], width: 0}, k.push(m)) : (m = k[w], + w = (w + 1) % k.length), this.height += l.textBlock.height; + l.textBlock.x = m.width; + l.textBlock.y = 0; + m.width += Math.round(l.textBlock.width + t + h + (0 === m.width ? 0 : this.horizontalSpacing) + ("line" === l.chartType || "spline" === l.chartType || "stepLine" === l.chartType ? 2 * 0.1 * this.lineHeight : 0)); + m.items.push(l); + this.width = Math.max(m.width, this.width) + } + } + this.height = !1 === this.itemWrap ? k.length * this.lineHeight : this.height + v; + this.height = Math.min(g, this.height); + this.width = Math.min(f, this.width) + } + "top" === this.verticalAlign ? (e = "left" === + this.horizontalAlign ? c.x1 : "right" === this.horizontalAlign ? c.x2 - this.width : c.x1 + c.width / 2 - this.width / 2, d = c.y1) : "center" === this.verticalAlign ? (e = "left" === this.horizontalAlign ? c.x1 : "right" === this.horizontalAlign ? c.x2 - this.width : c.x1 + c.width / 2 - this.width / 2, d = c.y1 + c.height / 2 - this.height / 2) : "bottom" === this.verticalAlign && (e = "left" === this.horizontalAlign ? c.x1 : "right" === this.horizontalAlign ? c.x2 - this.width : c.x1 + c.width / 2 - this.width / 2, d = c.y2 - this.height); + this.items = q; + for (n = 0; n < this.items.length; n++) + l = q[n], + l.id = ++this.chart._eventManager.lastObjectId, this.chart._eventManager.objectMap[l.id] = {id: l.id, objectType: "legendItem", legendItemIndex: n, dataSeriesIndex: l.dataSeriesIndex, dataPointIndex: l.dataPointIndex}; + for (n = c = 0; n < k.length; n++) { + m = k[n]; + for (w = v = 0; w < m.items.length; w++) { + l = m.items[w]; + r = l.textBlock.x + e + (0 === w ? 0.2 * t : this.horizontalSpacing); + u = d + c; + p = r; + this.chart.data[l.dataSeriesIndex].visible || (this.ctx.globalAlpha = 0.5); + this.ctx.save(); + this.ctx.rect(e, d, f, Math.max(g - g % this.lineHeight, d)); + this.ctx.clip(); + if ("line" === l.chartType || "stepLine" === l.chartType || "spline" === l.chartType) + this.ctx.strokeStyle = l.lineColor, this.ctx.lineWidth = Math.ceil(this.lineHeight / 8), this.ctx.beginPath(), this.ctx.moveTo(r - 0.1 * this.lineHeight, u + this.lineHeight / 2), this.ctx.lineTo(r + 0.85 * this.lineHeight, u + this.lineHeight / 2), this.ctx.stroke(), p -= 0.1 * this.lineHeight; + P.drawMarker(r + t / 2, u + this.lineHeight / 2, this.ctx, l.markerType, l.markerSize, l.markerColor, l.markerBorderColor, l.markerBorderThickness); + l.textBlock.x = r + h + t; + if ("line" === + l.chartType || "stepLine" === l.chartType || "spline" === l.chartType) + l.textBlock.x += 0.1 * this.lineHeight; + l.textBlock.y = Math.round(u + this.lineHeight / 2); + l.textBlock.render(!0); + this.ctx.restore(); + v = 0 < w ? Math.max(v, l.textBlock.height) : l.textBlock.height; + this.chart.data[l.dataSeriesIndex].visible || (this.ctx.globalAlpha = 1); + r = C(l.id); + this.ghostCtx.fillStyle = r; + this.ghostCtx.beginPath(); + this.ghostCtx.fillRect(p, l.textBlock.y - this.lineHeight / 2, l.textBlock.x + l.textBlock.width - p, l.textBlock.height); + l.x1 = this.chart._eventManager.objectMap[l.id].x1 = + p; + l.y1 = this.chart._eventManager.objectMap[l.id].y1 = l.textBlock.y - this.lineHeight / 2; + l.x2 = this.chart._eventManager.objectMap[l.id].x2 = l.textBlock.x + l.textBlock.width; + l.y2 = this.chart._eventManager.objectMap[l.id].y2 = l.textBlock.y + l.textBlock.height - this.lineHeight / 2 + } + c += v + } + 0 < q.length && a.layoutManager.registerSpace(b, {width: this.width + 2 + 2, height: this.height + 5 + 5}); + this.bounds = {x1: e, y1: d, x2: e + this.width, y2: d + this.height} + }; + T(ua, L); + ua.prototype.render = function () { + var a = this.chart.layoutManager.getFreeSpace(); + this.ctx.fillStyle = "red"; + this.ctx.fillRect(a.x1, a.y1, a.x2, a.y2) + }; + T(Y, L); + Y.prototype.getDefaultAxisPlacement = function () { + var a = this.type; + if ("column" === a || "line" === a || "stepLine" === a || "spline" === a || "area" === a || "stepArea" === a || "splineArea" === a || "stackedColumn" === a || "stackedLine" === a || "bubble" === a || "scatter" === a || "stackedArea" === a || "stackedColumn100" === a || "stackedLine100" === a || "stackedArea100" === a || "candlestick" === a || "ohlc" === a || "rangeColumn" === a || "rangeArea" === a || "rangeSplineArea" === a) + return"normal"; + if ("bar" === + a || "stackedBar" === a || "stackedBar100" === a || "rangeBar" === a) + return"xySwapped"; + if ("pie" === a || "doughnut" === a || "funnel" === a) + return"none"; + window.console.log("Unknown Chart Type: " + a); + return null + }; + Y.getDefaultLegendMarker = function (a) { + if ("column" === a || "stackedColumn" === a || "stackedLine" === a || "bar" === a || "stackedBar" === a || "stackedBar100" === a || "bubble" === a || "scatter" === a || "stackedColumn100" === a || "stackedLine100" === a || "stepArea" === a || "candlestick" === a || "ohlc" === a || "rangeColumn" === a || "rangeBar" === a || "rangeArea" === + a || "rangeSplineArea" === a) + return"square"; + if ("line" === a || "stepLine" === a || "spline" === a || "pie" === a || "doughnut" === a || "funnel" === a) + return"circle"; + if ("area" === a || "splineArea" === a || "stackedArea" === a || "stackedArea100" === a) + return"triangle"; + window.console.log("Unknown Chart Type: " + a); + return null + }; + Y.prototype.getDataPointAtX = function (a, c) { + if (!this.dataPoints || 0 === this.dataPoints.length) + return null; + var b = {dataPoint: null, distance: Infinity, index: NaN}, d = null, e = 0, f = 0, g = 1, h = Infinity, q = 0, k = 0, n = 0; + "none" !== this.chart.plotInfo.axisPlacement && + (n = this.dataPoints[this.dataPoints.length - 1].x - this.dataPoints[0].x, n = 0 < n ? Math.min(Math.max((this.dataPoints.length - 1) / n * (a - this.dataPoints[0].x) >> 0, 0), this.dataPoints.length) : 0); + for (; ; ) { + f = 0 < g ? n + e : n - e; + if (0 <= f && f < this.dataPoints.length) { + var d = this.dataPoints[f], m = Math.abs(d.x - a); + m < b.distance && (b.dataPoint = d, b.distance = m, b.index = f); + d = Math.abs(d.x - a); + d <= h ? h = d : 0 < g ? q++ : k++; + if (1E3 < q && 1E3 < k) + break + } else if (0 > n - e && n + e >= this.dataPoints.length) + break; + -1 === g ? (e++, g = 1) : g = -1 + } + return c || b.dataPoint.x !== a ? c && null !== + b.dataPoint ? b : null : b + }; + Y.prototype.getDataPointAtXY = function (a, c, b) { + if (!this.dataPoints || 0 === this.dataPoints.length || a < this.chart.plotArea.x1 || a > this.chart.plotArea.x2 || c < this.chart.plotArea.y1 || c > this.chart.plotArea.y2) + return null; + b = b || !1; + var d = [], e = 0, f = 0, g = 1, h = !1, q = Infinity, k = 0, n = 0, m = 0; + "none" !== this.chart.plotInfo.axisPlacement && (m = this.chart.axisX.getXValueAt({x: a, y: c}), f = this.dataPoints[this.dataPoints.length - 1].x - this.dataPoints[0].x, m = 0 < f ? Math.min(Math.max((this.dataPoints.length - 1) / f * (m - this.dataPoints[0].x) >> + 0, 0), this.dataPoints.length) : 0); + for (; ; ) { + f = 0 < g ? m + e : m - e; + if (0 <= f && f < this.dataPoints.length) { + var l = this.chart._eventManager.objectMap[this.dataPointIds[f]], p = this.dataPoints[f], r = null; + if (l) { + switch (this.type) { + case "column": + case "stackedColumn": + case "stackedColumn100": + case "bar": + case "stackedBar": + case "stackedBar100": + case "rangeColumn": + case "rangeBar": + a >= l.x1 && (a <= l.x2 && c >= l.y1 && c <= l.y2) && (d.push({dataPoint: p, dataPointIndex: f, dataSeries: this, distance: Math.min(Math.abs(l.x1 - a), Math.abs(l.x2 - a), Math.abs(l.y1 - + c), Math.abs(l.y2 - c))}), h = !0); + break; + case "line": + case "stepLine": + case "spline": + case "area": + case "stepArea": + case "stackedArea": + case "stackedArea100": + case "splineArea": + case "scatter": + var t = R("markerSize", p, this) || 4, u = b ? 20 : t, r = Math.sqrt(Math.pow(l.x1 - a, 2) + Math.pow(l.y1 - c, 2)); + r <= u && d.push({dataPoint: p, dataPointIndex: f, dataSeries: this, distance: r}); + f = Math.abs(l.x1 - a); + f <= q ? q = f : 0 < g ? k++ : n++; + r <= t / 2 && (h = !0); + break; + case "rangeArea": + case "rangeSplineArea": + t = R("markerSize", p, this) || 4; + u = b ? 20 : t; + r = Math.min(Math.sqrt(Math.pow(l.x1 - + a, 2) + Math.pow(l.y1 - c, 2)), Math.sqrt(Math.pow(l.x1 - a, 2) + Math.pow(l.y2 - c, 2))); + r <= u && d.push({dataPoint: p, dataPointIndex: f, dataSeries: this, distance: r}); + f = Math.abs(l.x1 - a); + f <= q ? q = f : 0 < g ? k++ : n++; + r <= t / 2 && (h = !0); + break; + case "bubble": + t = l.size; + r = Math.sqrt(Math.pow(l.x1 - a, 2) + Math.pow(l.y1 - c, 2)); + r <= t / 2 && (d.push({dataPoint: p, dataPointIndex: f, dataSeries: this, distance: r}), h = !0); + break; + case "pie": + case "doughnut": + t = l.center; + u = "doughnut" === this.type ? l.percentInnerRadius * l.radius : 0; + r = Math.sqrt(Math.pow(t.x - a, 2) + Math.pow(t.y - + c, 2)); + r < l.radius && r > u && (r = Math.atan2(c - t.y, a - t.x), 0 > r && (r += 2 * Math.PI), r = Number(((180 * (r / Math.PI) % 360 + 360) % 360).toFixed(12)), t = Number(((180 * (l.startAngle / Math.PI) % 360 + 360) % 360).toFixed(12)), u = Number(((180 * (l.endAngle / Math.PI) % 360 + 360) % 360).toFixed(12)), 0 === u && 1 < l.endAngle && (u = 360), t >= u && 0 !== p.y && (u += 360, r < t && (r += 360)), r > t && r < u && (d.push({dataPoint: p, dataPointIndex: f, dataSeries: this, distance: 0}), h = !0)); + break; + case "candlestick": + if (a >= l.x1 - l.borderThickness / 2 && a <= l.x2 + l.borderThickness / 2 && c >= l.y2 - l.borderThickness / + 2 && c <= l.y3 + l.borderThickness / 2 || Math.abs(l.x2 - a + l.x1 - a) < l.borderThickness && c >= l.y1 && c <= l.y4) + d.push({dataPoint: p, dataPointIndex: f, dataSeries: this, distance: Math.min(Math.abs(l.x1 - a), Math.abs(l.x2 - a), Math.abs(l.y2 - c), Math.abs(l.y3 - c))}), h = !0; + break; + case "ohlc": + if (Math.abs(l.x2 - a + l.x1 - a) < l.borderThickness && c >= l.y2 && c <= l.y3 || a >= l.x1 && a <= (l.x2 + l.x1) / 2 && c >= l.y1 - l.borderThickness / 2 && c <= l.y1 + l.borderThickness / 2 || a >= (l.x1 + l.x2) / 2 && a <= l.x2 && c >= l.y4 - l.borderThickness / 2 && c <= l.y4 + l.borderThickness / 2) + d.push({dataPoint: p, + dataPointIndex: f, dataSeries: this, distance: Math.min(Math.abs(l.x1 - a), Math.abs(l.x2 - a), Math.abs(l.y2 - c), Math.abs(l.y3 - c))}), h = !0 + } + if (h || 1E3 < k && 1E3 < n) + break + } + } else if (0 > m - e && m + e >= this.dataPoints.length) + break; + -1 === g ? (e++, g = 1) : g = -1 + } + a = null; + for (c = 0; c < d.length; c++) + a ? d[c].distance <= a.distance && (a = d[c]) : a = d[c]; + return a + }; + Y.prototype.getMarkerProperties = function (a, c, b, d) { + var e = this.dataPoints; + return{x: c, y: b, ctx: d, type: e[a].markerType ? e[a].markerType : this.markerType, size: e[a].markerSize ? e[a].markerSize : this.markerSize, + color: e[a].markerColor ? e[a].markerColor : this.markerColor ? this.markerColor : e[a].color ? e[a].color : this.color ? this.color : this._colorSet[a % this._colorSet.length], borderColor: e[a].markerBorderColor ? e[a].markerBorderColor : this.markerBorderColor ? this.markerBorderColor : null, borderThickness: e[a].markerBorderThickness ? e[a].markerBorderThickness : this.markerBorderThickness ? this.markerBorderThickness : null} + }; + T(F, L); + F.prototype.createLabels = function () { + var a, c, b = 0, b = 0, d, e = 0, f = 0, g = 0, h = 0, q = 0; + if ("bottom" === this._position || + "top" === this._position) + q = this.lineCoordinates.width / Math.abs(this.viewportMaximum - this.viewportMinimum) * E[this.intervalType + "Duration"] * this.interval, e = "undefined" === typeof this._options.labelMaxWidth ? 0.5 * this.chart.width >> 0 : this._options.labelMaxWidth, this.chart.panEnabled || (g = "undefined" === typeof this._options.labelWrap || this.labelWrap ? 0.8 * this.chart.height >> 0 : 1.5 * this.labelFontSize); + else if ("left" === this._position || "right" === this._position) + q = this.lineCoordinates.height / Math.abs(this.viewportMaximum - + this.viewportMinimum) * E[this.intervalType + "Duration"] * this.interval, this.chart.panEnabled || (e = "undefined" === typeof this._options.labelMaxWidth ? 0.3 * this.chart.width >> 0 : this._options.labelMaxWidth), g = "undefined" === typeof this._options.labelWrap || this.labelWrap ? 0.3 * this.chart.height >> 0 : 1.5 * this.labelFontSize; + if ("axisX" === this.type && "dateTime" === this.chart.plotInfo.axisXValueType) + for (this.intervalStartPosition = this.getLabelStartPoint(new Date(this.viewportMinimum), this.intervalType, this.interval), d = za(new Date(this.viewportMaximum), + this.interval, this.intervalType), b = this.intervalStartPosition; b < d; za(b, this.interval, this.intervalType)) + a = b.getTime(), a = this.labelFormatter ? this.labelFormatter({chart: this.chart._publicChartReference, axis: this._options, value: b, label: this.labels[b] ? this.labels[b] : null}) : "axisX" === this.type && this.labels[a] ? this.labels[a] : wa(b, this.valueFormatString, this.chart._cultureInfo), a = new O(this.ctx, {x: 0, y: 0, maxWidth: e, maxHeight: g, angle: this.labelAngle, text: this.prefix + a + this.suffix, horizontalAlign: "left", fontSize: this.labelFontSize, + fontFamily: this.labelFontFamily, fontWeight: this.labelFontWeight, fontColor: this.labelFontColor, fontStyle: this.labelFontStyle, textBaseline: "middle"}), this._labels.push({position: b.getTime(), textBlock: a, effectiveHeight: null}); + else { + d = this.viewportMaximum; + if (this.labels && this.labels.length) { + a = Math.ceil(this.interval); + for (var k = Math.ceil(this.intervalStartPosition), f = !1, b = k; b < this.viewportMaximum; b += a) + if (this.labels[b]) + f = !0; + else { + f = !1; + break + } + f && (this.interval = a, this.intervalStartPosition = k) + } + for (b = this.intervalStartPosition; b <= + d; b = parseFloat((b + this.interval).toFixed(14))) + a = this.labelFormatter ? this.labelFormatter({chart: this.chart._publicChartReference, axis: this._options, value: b, label: this.labels[b] ? this.labels[b] : null}) : "axisX" === this.type && this.labels[b] ? this.labels[b] : ba(b, this.valueFormatString, this.chart._cultureInfo), a = new O(this.ctx, {x: 0, y: 0, maxWidth: e, maxHeight: g, angle: this.labelAngle, text: this.prefix + a + this.suffix, horizontalAlign: "left", fontSize: this.labelFontSize, fontFamily: this.labelFontFamily, fontWeight: this.labelFontWeight, + fontColor: this.labelFontColor, fontStyle: this.labelFontStyle, textBaseline: "middle", borderThickness: 0}), this._labels.push({position: b, textBlock: a, effectiveHeight: null}) + } + d = []; + f = []; + if (this.labelAutoFit || this._options.labelAutoFit) + if ("bottom" === this._position || "top" === this._position) + if (h = 0, e = 0.9 * q >> 0, x(this.labelAngle) || (this.labelAngle = (this.labelAngle % 360 + 360) % 360, 90 < this.labelAngle && 270 >= this.labelAngle ? this.labelAngle -= 180 : 270 < this.labelAngle && 360 >= this.labelAngle && (this.labelAngle -= 360)), !this.chart.panEnabled && + 1 <= this._labels.length) { + this.sessionVariables.labelFontSize = this.labelFontSize; + this.sessionVariables.labelMaxWidth = e; + this.sessionVariables.labelMaxHeight = g; + this.sessionVariables.labelAngle = this.labelAngle; + this.sessionVariables.labelWrap = !0; + for (b = 0; b < this._labels.length; b++) + (a = this._labels[b].textBlock, k = a.measureText(), b < this._labels.length - 1 && (h = b + 1, c = this._labels[h].textBlock, c = c.measureText()), d.push(a.height), this.sessionVariables.labelMaxHeight = Math.max.apply(Math, d), f = e * Math.cos(Math.PI / 180 * + Math.abs(this.labelAngle)) + (g - a.fontSize / 2) * Math.sin(Math.PI / 180 * Math.abs(this.labelAngle)), h = e * Math.sin(Math.PI / 180 * Math.abs(this.labelAngle)) + (g - a.fontSize / 2) * Math.cos(Math.PI / 180 * Math.abs(this.labelAngle)), x(this._options.labelAngle) && isNaN(this._options.labelAngle) && 0 !== this._options.labelAngle) ? (this.sessionVariables.labelMaxHeight = 0 === this.labelAngle ? g : Math.min((h - e * Math.cos(Math.PI / 180 * Math.abs(this.labelAngle))) / Math.sin(Math.PI / 180 * Math.abs(this.labelAngle)), h), x(this._options.labelWrap)) ? + x(this._options.labelWrap) && (x(this._options.labelMaxWidth) ? x(c) || (k.width + c.width >> 0 >= 2 * e && k.width + c.width >> 0 < 2.4 * e ? (k = this.labelFontSize, this.sessionVariables.labelMaxWidth = 1.2 * e, x(this._options.labelFontSize) && 12 < k && (k = Math.floor(12 / 13 * k), a.measureText()), this.sessionVariables.labelFontSize = x(this._options.labelFontSize) ? k : this._options.labelFontSize, this.sessionVariables.labelAngle = this.labelAngle) : k.width + c.width >> 0 >= 2.4 * e && k.width + c.width < 2.8 * e ? (this.sessionVariables.labelAngle = -25, this.sessionVariables.labelMaxWidth = + 2.5 * e, this.sessionVariables.labelFontSize = this.labelFontSize) : k.width + c.width >> 0 >= 2.8 * e && k.width + c.width < 3.2 * e ? (this.sessionVariables.labelMaxWidth = 1.2 * e, this.sessionVariables.labelWrap = !0, x(this._options.labelFontSize) && 12 < this.labelFontSize && (this.labelFontSize = Math.floor(12 / 13 * this.labelFontSize), a.measureText()), this.sessionVariables.labelFontSize = x(this._options.labelFontSize) ? this.labelFontSize : this._options.labelFontSize, this.sessionVariables.labelAngle = this.labelAngle) : k.width + c.width >> 0 >= + 3.2 * e && k.width + c.width < 3.6 * e ? (this.sessionVariables.labelAngle = -25, this.sessionVariables.labelWrap = !0, this.sessionVariables.labelMaxWidth = 2.5 * e, this.sessionVariables.labelFontSize = this.labelFontSize) : k.width + c.width > 3.6 * e && k.width + c.width < 5 * e ? (x(this._options.labelFontSize) && 12 < this.labelFontSize && (this.labelFontSize = Math.floor(12 / 13 * this.labelFontSize), a.measureText()), this.sessionVariables.labelFontSize = x(this._options.labelFontSize) ? this.labelFontSize : this._options.labelFontSize, this.sessionVariables.labelWrap = + !0, this.sessionVariables.labelMaxWidth = e, this.sessionVariables.labelAngle = this.labelAngle, this.sessionVariables.labelWrap = !0) : k.width + c.width > 5 * e && (this.sessionVariables.labelWrap = !0, this.sessionVariables.labelMaxWidth = e, this.sessionVariables.labelFontSize = this.labelFontSize, this.sessionVariables.labelMaxHeight = g, this.sessionVariables.labelAngle = this.labelAngle)) : this._options.labelMaxWidth < e ? (this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth, this.sessionVariables.labelMaxHeight = h) : + (this.sessionVariables.labelAngle = -25, this.sessionVariables.labelMaxWidth = x(this._options.labelMaxWidth) ? e : this._options.labelMaxWidth > 0.3 * this.chart.width >> 0 ? 0.3 * this.chart.width >> 0 : this._options.labelMaxWidth, this.sessionVariables.labelMaxHeight = 2.5 * this.labelFontSize)) : this._options.labelWrap ? (this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth ? this._options.labelMaxWidth : e, this.sessionVariables.labelAngle = this._options.labelMaxWidth > e ? -25 : this.sessionVariables.labelAngle, this.sessionVariables.labelMaxHeight = + h) : x(this._options.labelMaxWidth) ? (this.sessionVariables.labelMaxWidth = e, this.sessionVariables.labelWrap = this.labelWrap, this.sessionVariables.labelMaxHeight = g) : (this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth ? this._options.labelMaxWidth : e, this.sessionVariables.labelAngle = this._options.labelMaxWidth > e ? -25 : this.sessionVariables.labelAngle, this.sessionVariables.labelMaxHeight = g, this.sessionVariables.labelWrap = this.labelWrap) : (this.sessionVariables.labelAngle = this.labelAngle, this.sessionVariables.labelMaxHeight = + 0 === this.labelAngle ? g : Math.min((h - e * Math.cos(Math.PI / 180 * Math.abs(this.labelAngle))) / Math.sin(Math.PI / 180 * Math.abs(this.labelAngle)), h), x(this._options.labelWrap)) ? x(this._options.labelWrap) && (this.labelWrap && !x(this._options.labelMaxWidth) ? (this.sessionVariables.labelWrap = this.labelWrap, this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth ? this._options.labelMaxWidth > 0.8 * this.chart.height >> 0 ? 0.8 * this.chart.height >> 0 : this._options.labelMaxWidth : e, this.sessionVariables.labelMaxHeight = g) : + (this.sessionVariables.labelMaxWidth = f > 0.5 * this.chart.height ? 0.5 * this.chart.height : f, this.sessionVariables.labelMaxHeight = h < 0.9 * q ? 0.9 * q : h < this.labelFontSize ? 2.5 * this.labelFontSize : h - this.labelFontSize, this.sessionVariables.labelWrap = this.labelWrap, x(this._options.labelMaxWidth) && (this.sessionVariables.labelAngle = this.labelAngle))) : (this._options.labelWrap ? (this.sessionVariables.labelWrap = this.labelWrap, this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth ? this._options.labelMaxWidth > 0.8 * + this.chart.height >> 0 ? 0.8 * this.chart.height >> 0 : this._options.labelMaxWidth : e) : (x(this._options.labelMaxWidth), this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth ? this._options.labelMaxWidth > 0.8 * this.chart.height >> 0 ? 0.8 * this.chart.height >> 0 : this._options.labelMaxWidth : f, this.sessionVariables.labelWrap = this.labelWrap), this.sessionVariables.labelMaxHeight = g); + for (b = 0; b < this._labels.length; b++) + a = this._labels[b].textBlock, a.maxWidth = this.labelMaxWidth = this.sessionVariables.labelMaxWidth, a.fontSize = + this.labelFontSize = this.sessionVariables.labelFontSize, a.angle = this.labelAngle = this.sessionVariables.labelAngle, a.wrap = this.labelWrap = this.sessionVariables.labelWrap, a.maxHeight = this.sessionVariables.labelMaxHeight, a.measureText() + } else + for (b = 0; b < this._labels.length; b++) + a = this._labels[b].textBlock, a.maxWidth = this.labelMaxWidth = x(this._options.labelMaxWidth) ? this.sessionVariables.labelMaxWidth : this._options.labelMaxWidth, a.fontSize = this.labelFontSize = x(this._options.labelFontSize) ? this.sessionVariables.labelFontSize : + this._options.labelFontSize, a.angle = this.labelAngle = x(this._options.labelAngle) ? this.sessionVariables.labelAngle : this.labelAngle, a.wrap = this.labelWrap = x(this._options.labelWrap) ? this.sessionVariables.labelWrap : this._options.labelWrap, a.maxHeight = this.sessionVariables.labelMaxHeight, a.measureText(); + else if ("left" === this._position || "right" === this._position) + if (e = x(this._options.labelMaxWidth) ? 0.3 * this.chart.width >> 0 : this._options.labelMaxWidth, x(this.labelAngle) || (this.labelAngle = (this.labelAngle % 360 + + 360) % 360, 90 < this.labelAngle && 270 >= this.labelAngle ? this.labelAngle -= 180 : 270 < this.labelAngle && 360 >= this.labelAngle && (this.labelAngle -= 360)), !this.chart.panEnabled && 1 <= this._labels.length) { + this.sessionVariables.labelFontSize = this.labelFontSize; + this.sessionVariables.labelMaxWidth = e; + this.sessionVariables.labelMaxHeight = g; + this.sessionVariables.labelAngle = x(this.sessionVariables.labelAngle) ? 0 : this.sessionVariables.labelAngle; + this.sessionVariables.labelWrap = !0; + for (b = 0; b < this._labels.length; b++) + (a = this._labels[b].textBlock, + k = a.measureText(), b < this._labels.length - 1 && (h = b + 1, c = this._labels[h].textBlock, c = c.measureText()), f.push(a.height), this.sessionVariables.labelMaxHeight = Math.max.apply(Math, f), h = e * Math.sin(Math.PI / 180 * Math.abs(this.labelAngle)) + (g - a.fontSize / 2) * Math.cos(Math.PI / 180 * Math.abs(this.labelAngle)), Math.cos(Math.PI / 180 * Math.abs(this.labelAngle)), Math.sin(Math.PI / 180 * Math.abs(this.labelAngle)), x(this._options.labelAngle) && isNaN(this._options.labelAngle) && 0 !== this._options.labelAngle) ? x(this._options.labelWrap) ? + x(this._options.labelWrap) && (x(this._options.labelMaxWidth) ? x(c) || (k.height + c.height >> 0 >= 2 * this.labelMaxHeight && k.height + c.height >> 0 < 2.4 * this.labelMaxHeight ? (x(this._options.labelFontSize) && 12 < this.labelFontSize && (this.labelFontSize = Math.floor(12 / 13 * this.labelFontSize), a.measureText()), this.sessionVariables.labelMaxHeight = this.labelMaxHeight, this.sessionVariables.labelFontSize = x(this._options.labelFontSize) ? this.labelFontSize : this._options.labelFontSize) : k.height + c.height >> 0 >= 2.4 * this.labelMaxHeight && + k.height + c.height < 2.8 * this.labelMaxHeight ? (this.sessionVariables.labelAngle = -25, this.sessionVariables.labelMaxHeight = h, this.sessionVariables.labelFontSize = this.labelFontSize, this.sessionVariables.labelWrap = !0) : k.height + c.height >> 0 >= 2.8 * this.labelMaxHeight && k.height + c.height < 3.2 * this.labelMaxHeight ? (this.sessionVariables.labelMaxHeight = this.labelMaxHeight, this.sessionVariables.labelWrap = !0, x(this._options.labelFontSize) && 12 < this.labelFontSize && (this.labelFontSize = Math.floor(12 / 13 * this.labelFontSize), + a.measureText()), this.sessionVariables.labelFontSize = x(this._options.labelFontSize) ? this.labelFontSize : this._options.labelFontSize, this.sessionVariables.labelAngle = x(this.sessionVariables.labelAngle) ? 0 : this.sessionVariables.labelAngle) : k.height + c.height >> 0 >= 3.2 * this.labelMaxHeight && k.height + c.height < 3.6 * this.labelMaxHeight ? (this.sessionVariables.labelAngle = -25, this.sessionVariables.labelMaxHeight = h, this.sessionVariables.labelWrap = !0, this.sessionVariables.labelFontSize = this.labelFontSize) : k.height + + c.height > 3.6 * this.labelMaxHeight && k.height + c.height < 10 * this.labelMaxHeight ? (x(this._options.labelFontSize) && 12 < this.labelFontSize && (this.labelFontSize = Math.floor(12 / 13 * this.labelFontSize), a.measureText()), this.sessionVariables.labelFontSize = x(this._options.labelFontSize) ? this.labelFontSize : this._options.labelFontSize, this.sessionVariables.labelMaxWidth = e, this.sessionVariables.labelMaxHeight = this.labelMaxHeight, this.sessionVariables.labelAngle = x(this.sessionVariables.labelAngle) ? 0 : this.sessionVariables.labelAngle) : + k.height + c.height > 10 * this.labelMaxHeight && k.height + c.height < 50 * this.labelMaxHeight && (x(this._options.labelFontSize) && 12 < this.labelFontSize && (this.labelFontSize = Math.floor(12 / 13 * this.labelFontSize), a.measureText()), this.sessionVariables.labelFontSize = x(this._options.labelFontSize) ? this.labelFontSize : this._options.labelFontSize, this.sessionVariables.labelMaxHeight = this.labelMaxHeight, this.sessionVariables.labelMaxWidth = e, this.sessionVariables.labelAngle = x(this.sessionVariables.labelAngle) ? 0 : this.sessionVariables.labelAngle)) : + this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth < e ? this._options.labelMaxWidth : this._options.labelMaxWidth ? this._options.labelMaxWidth > 0.3 * this.chart.width >> 0 ? 0.3 * this.chart.width >> 0 : this._options.labelMaxWidth : this.sessionVariables.labelMaxWidth) : this._options.labelWrap ? this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth ? this._options.labelMaxWidth > 0.3 * this.chart.width >> 0 ? 0.3 * this.chart.width >> 0 : this._options.labelMaxWidth : this.sessionVariables.labelMaxWidth : this._options.labelMaxWidth ? + this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth ? this._options.labelMaxWidth > 0.3 * this.chart.width >> 0 ? 0.3 * this.chart.width >> 0 : this._options.labelMaxWidth : this.sessionVariables.labelMaxWidth : (this.sessionVariables.labelMaxWidth = e, this.sessionVariables.labelAngle = -25) : (this.sessionVariables.labelAngle = this.labelAngle, this.sessionVariables.labelMaxWidth = 0 === this.labelAngle ? e : Math.min((h - g * Math.sin(Math.PI / 180 * Math.abs(this.labelAngle))) / Math.cos(Math.PI / 180 * Math.abs(this.labelAngle)), g), + x(this._options.labelWrap)) ? x(this._options.labelWrap) && (this.labelWrap && !x(this._options.labelMaxWidth) ? (this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth ? this._options.labelMaxWidth > 0.8 * this.chart.height >> 0 ? 0.8 * this.chart.height >> 0 : this._options.labelMaxWidth : this.sessionVariables.labelMaxWidth, this.sessionVariables.labelWrap = this.labelWrap, this.sessionVariables.labelMaxHeight = h) : (this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth ? this._options.labelMaxWidth > 0.8 * this.chart.height >> + 0 ? 0.8 * this.chart.height >> 0 : this._options.labelMaxWidth : e, this.sessionVariables.labelMaxHeight = 0 === this.labelAngle ? g : h, x(this._options.labelMaxWidth) && (this.sessionVariables.labelAngle = this.labelAngle))) : this._options.labelWrap ? (this.sessionVariables.labelMaxHeight = 0 === this.labelAngle ? g : h, this.sessionVariables.labelWrap = this.labelWrap, this.sessionVariables.labelMaxWidth = e) : (x(this._options.labelMaxWidth), this.sessionVariables.labelMaxWidth = this._options.labelMaxWidth ? this._options.labelMaxWidth > 0.8 * + this.chart.height >> 0 ? 0.8 * this.chart.height >> 0 : this._options.labelMaxWidth : this.sessionVariables.labelMaxWidth, this.sessionVariables.labelWrap = this.labelWrap); + for (b = 0; b < this._labels.length; b++) + a = this._labels[b].textBlock, a.maxWidth = this.labelMaxWidth = this.sessionVariables.labelMaxWidth, a.fontSize = this.labelFontSize = this.sessionVariables.labelFontSize, a.angle = this.labelAngle = this.sessionVariables.labelAngle, a.wrap = this.labelWrap = this.sessionVariables.labelWrap, a.maxHeight = this.sessionVariables.labelMaxHeight, + a.measureText() + } else + for (b = 0; b < this._labels.length; b++) + a = this._labels[b].textBlock, a.maxWidth = this.labelMaxWidth = x(this._options.labelMaxWidth) ? this.sessionVariables.labelMaxWidth : this._options.labelMaxWidth, a.fontSize = this.labelFontSize = x(this._options.labelFontSize) ? this.sessionVariables.labelFontSize : this._options.labelFontSize, a.angle = this.labelAngle = x(this._options.labelAngle) ? this.sessionVariables.labelAngle : this.labelAngle, a.wrap = this.labelWrap = x(this._options.labelWrap) ? this.sessionVariables.labelWrap : + this._options.labelWrap, a.maxHeight = this.sessionVariables.labelMaxHeight, a.measureText(); + for (b = 0; b < this.stripLines.length; b++) + c = this.stripLines[b], e = "bottom" === this._position || "top" === this._position ? 0.9 * this.chart.width >> 0 : 0.9 * this.chart.height >> 0, a = new O(this.ctx, {x: 0, y: 0, backgroundColor: "outside" === c.labelPlacement ? c._options.labelBackgroundColor ? c._options.labelBackgroundColor : "#EEEEEE" : c.startValue ? "#EEEEEE" : c.labelBackgroundColor, maxWidth: c._options.labelMaxWidth ? c._options.labelMaxWidth : e, maxHeight: "undefined" === + typeof c._options.labelWrap || c.labelWrap ? e : 1.5 * this.labelFontSize, angle: this.labelAngle, text: c.labelFormatter ? c.labelFormatter({chart: this.chart._publicChartReference, axis: this, stripLine: c}) : c.label, horizontalAlign: "left", fontSize: "outside" === c.labelPlacement ? c._options.labelFontSize ? c._options.labelFontSize : this.labelFontSize : c.labelFontSize, fontFamily: "outside" === c.labelPlacement ? c._options.labelFontFamily ? c._options.labelFontFamily : this.labelFontFamily : c.labelFontFamily, fontWeight: "outside" === + c.labelPlacement ? c._options.fontWeight ? c._options.fontWeight : this.fontWeight : c.fontWeight, fontColor: c._options.labelFontColor || c.labelFontColor, fontStyle: "outside" === c.labelPlacement ? c._options.fontStyle ? c._options.fontStyle : this.fontWeight : c.fontStyle, textBaseline: "middle", borderThickness: 0}), this._stripLineLabels.push({position: c.value, textBlock: a, effectiveHeight: null, stripLine: c}) + }; + F.prototype.createLabelsAndCalculateWidth = function () { + var a = 0, c = 0; + this._labels = []; + this._stripLineLabels = []; + if ("left" === + this._position || "right" === this._position) { + this.createLabels(); + for (c = 0; c < this._labels.length; c++) { + var b = this._labels[c].textBlock, d = b.measureText(), e = 0, e = 0 === this.labelAngle ? d.width : d.width * Math.cos(Math.PI / 180 * Math.abs(this.labelAngle)) + (d.height - b.fontSize / 2) * Math.sin(Math.PI / 180 * Math.abs(this.labelAngle)); + a < e && (a = e); + this._labels[c].effectiveWidth = e + } + for (c = 0; c < this._stripLineLabels.length; c++) + "outside" === this._stripLineLabels[c].stripLine.labelPlacement && (b = this._stripLineLabels[c].textBlock, d = b.measureText(), + e = 0 === this.labelAngle ? d.width : d.width * Math.cos(Math.PI / 180 * Math.abs(this.labelAngle)) + (d.height - b.fontSize / 2) * Math.sin(Math.PI / 180 * Math.abs(this.labelAngle)), a < e && (a = e), this._stripLineLabels[c].effectiveWidth = e) + } + return(this.title ? this._titleTextBlock.measureText().height + 2 : 0) + a + this.tickLength + 5 + }; + F.prototype.createLabelsAndCalculateHeight = function () { + var a = 0; + this._labels = []; + this._stripLineLabels = []; + var c, b = 0; + this.createLabels(); + if ("bottom" === this._position || "top" === this._position) { + for (b = 0; b < this._labels.length; b++) { + c = + this._labels[b].textBlock; + var d = c.measureText(), e = 0, e = 0 === this.labelAngle ? d.height : d.width * Math.sin(Math.PI / 180 * Math.abs(this.labelAngle)) + (d.height - c.fontSize / 2) * Math.cos(Math.PI / 180 * Math.abs(this.labelAngle)); + a < e && (a = e); + this._labels[b].effectiveHeight = e + } + for (b = 0; b < this._stripLineLabels.length; b++) + "outside" === this._stripLineLabels[b].stripLine.labelPlacement && (c = this._stripLineLabels[b].textBlock, d = c.measureText(), e = 0 === this.labelAngle ? d.height : d.width * Math.sin(Math.PI / 180 * Math.abs(this.labelAngle)) + + (d.height - c.fontSize / 2) * Math.cos(Math.PI / 180 * Math.abs(this.labelAngle)), a < e && (a = e), this._labels[b].effectiveHeight = e) + } + return(this.title ? this._titleTextBlock.measureText().height + 2 : 0) + a + this.tickLength + 5 + }; + F.setLayoutAndRender = function (a, c, b, d, e) { + var f, g, h, q = a.chart, k = q.ctx; + a.calculateAxisParameters(); + c && c.calculateAxisParameters(); + b && b.calculateAxisParameters(); + var n = c ? c.margin : 0, m = b ? b.margin : 0, l = 0, p = 0, r = 0, t, u, s, v, w, B, C = 0, A = 0, D, E, I; + D = E = I = !1; + a && a.title && (a._titleTextBlock = new O(a.ctx, {text: a.title, + horizontalAlign: "center", fontSize: a.titleFontSize, fontFamily: a.titleFontFamily, fontWeight: a.titleFontWeight, fontColor: a.titleFontColor, fontStyle: a.titleFontStyle, textBaseline: "top"})); + c && c.title && (c._titleTextBlock = new O(c.ctx, {text: c.title, horizontalAlign: "center", fontSize: c.titleFontSize, fontFamily: c.titleFontFamily, fontWeight: c.titleFontWeight, fontColor: c.titleFontColor, fontStyle: c.titleFontStyle, textBaseline: "top"})); + b && b.title && (b._titleTextBlock = new O(b.ctx, {text: b.title, horizontalAlign: "center", + fontSize: b.titleFontSize, fontFamily: b.titleFontFamily, fontWeight: b.titleFontWeight, fontColor: b.titleFontColor, fontStyle: b.titleFontStyle, textBaseline: "top"})); + if ("normal" === d) { + var G = [], F = [], J = []; + a && a.title && (a._titleTextBlock.maxWidth = a.titleMaxWidth || e.width, a._titleTextBlock.maxHeight = a.titleWrap ? 0.8 * e.height : 1.5 * a.titleFontSize, a._titleTextBlock.angle = 0); + c && c.title && (c._titleTextBlock.maxWidth = c.titleMaxWidth || e.height, c._titleTextBlock.maxHeight = c.titleWrap ? 0.8 * e.width : 1.5 * c.titleFontSize, c._titleTextBlock.angle = + -90); + b && b.title && (b._titleTextBlock.maxWidth = b.titleMaxWidth || e.height, b._titleTextBlock.maxHeight = b.titleWrap ? 0.8 * e.width : 1.5 * b.titleFontSize, b._titleTextBlock.angle = 90); + for (; 4 > l++; ) { + a.lineCoordinates = {}; + t = Math.ceil(c ? c.createLabelsAndCalculateWidth() : 0); + F.push(t); + f = Math.round(e.x1 + t + n); + u = Math.ceil(b ? b.createLabelsAndCalculateWidth() : 0); + J.push(u); + g = Math.round(e.x2 - u - m > a.chart.width - 10 ? a.chart.width - 10 : e.x2 - u - m); + !a.labelAutoFit || (x(w) || x(B)) || (0 < a.labelAngle ? B + r > g && (C += 0 < a.labelAngle ? B + r - g - u : 0) : 0 > + a.labelAngle ? w - p < f && w - p < a.viewportMinimum && (A = f - (n + a.tickLength + t + w - p + a.labelFontSize / 2)) : 0 === a.labelAngle && (B + r > g && (C = B + r / 2 - g - u), w - p < f && w - p < a.viewportMinimum && (A = f - n - a.tickLength - t - w + p / 2)), a.viewportMaximum === a.maximum && a.viewportMinimum === a.minimum && 0 < a.labelAngle && 0 < C ? g -= C : a.viewportMaximum === a.maximum && a.viewportMinimum === a.minimum && 0 > a.labelAngle && 0 < A ? f += A : a.viewportMaximum === a.maximum && a.viewportMinimum === a.minimum && 0 === a.labelAngle && (0 < A && (f += A), 0 < C && (g -= C))); + a.lineCoordinates.x1 = f; + a.lineCoordinates.x2 = + g; + a.lineCoordinates.width = Math.abs(g - f); + a.title && (a._titleTextBlock.maxWidth = 0 < a.titleMaxWidth && a.titleMaxWidth < a.lineCoordinates.width ? a.titleMaxWidth : a.lineCoordinates.width); + s = Math.ceil(a.createLabelsAndCalculateHeight()); + G.push(s); + a._labels && 1 < a._labels.length && (d = h = 0, h = a._labels[1], d = "dateTime" === a.chart.plotInfo.axisXValueType ? a._labels[a._labels.length - 2] : a._labels[a._labels.length - 1], p = h.textBlock.width * Math.cos(Math.PI / 180 * Math.abs(h.textBlock.angle)) + (h.textBlock.height - d.textBlock.fontSize / + 2) * Math.sin(Math.PI / 180 * Math.abs(h.textBlock.angle)), r = d.textBlock.width * Math.cos(Math.PI / 180 * Math.abs(d.textBlock.angle)) + (d.textBlock.height - d.textBlock.fontSize / 2) * Math.sin(Math.PI / 180 * Math.abs(d.textBlock.angle))); + q.panEnabled ? s = q.sessionVariables.axisX.height : q.sessionVariables.axisX.height = s; + d = Math.round(e.y2 - s - a.margin); + h = Math.round(e.y2 - a.margin); + a.lineCoordinates.y1 = d; + a.lineCoordinates.y2 = d; + a.boundingRect = {x1: f, y1: d, x2: g, y2: h, width: g - f, height: h - d}; + c && (f = Math.round(e.x1 + c.margin), d = Math.round(10 > + e.y1 ? 10 : e.y1), g = Math.round(e.x1 + t + c.margin), h = Math.round(e.y2 - s - a.margin), c.lineCoordinates = {x1: g, y1: d, x2: g, y2: h, height: Math.abs(h - d)}, c.boundingRect = {x1: f, y1: d, x2: g, y2: h, width: g - f, height: h - d}, c.title && (c._titleTextBlock.maxWidth = 0 < c.titleMaxWidth && c.titleMaxWidth < c.lineCoordinates.height ? c.titleMaxWidth : c.lineCoordinates.height)); + b && (f = Math.round(a.lineCoordinates.x2), d = Math.round(10 > e.y1 ? 10 : e.y1), g = Math.round(f + u), h = Math.round(e.y2 - s - a.margin), b.lineCoordinates = {x1: f, y1: d, x2: f, y2: h, height: Math.abs(h - + d)}, b.boundingRect = {x1: f, y1: d, x2: g, y2: h, width: g - f, height: h - d}, b.title && (b._titleTextBlock.maxWidth = 0 < b.titleMaxWidth && b.titleMaxWidth < b.lineCoordinates.height ? b.titleMaxWidth : b.lineCoordinates.height)); + a.calculateValueToPixelConversionParameters(); + a._labels && 1 < a._labels.length && (w = (a._labels[1].position - a.viewportMinimum) * a.conversionParameters.pixelPerUnit + a.lineCoordinates.x1, B = "dateTime" === a.chart.plotInfo.axisXValueType ? (a._labels[a._labels.length - 2].position - a.viewportMinimum) * a.conversionParameters.pixelPerUnit + + a.lineCoordinates.x1 : (a._labels[a._labels.length - 1].position - a.viewportMinimum) * a.conversionParameters.pixelPerUnit + a.lineCoordinates.x1); + c && c.calculateValueToPixelConversionParameters(); + b && b.calculateValueToPixelConversionParameters(); + if (a || c || b) { + if (!x(G)) + for (l = 0; l < G.length; l++) + for (j = l + 1; j < G.length; j++) + G[l] == G[j] && (D = !0); + if (!x(F)) + for (l = 0; l < F.length; l++) + for (j = l + 1; j < F.length; j++) + F[l] == F[j] && (E = !0); + if (!x(J)) + for (l = 0; l < J.length; l++) + for (j = l + 1; j < J.length; j++) + J[l] == J[j] && (I = !0) + } + if (D && E && I) + break + } + k.save(); + k.rect(5, a.boundingRect.y1, a.chart.width - 10, a.boundingRect.height); + k.clip(); + a.renderLabelsTicksAndTitle(); + k.restore(); + c && c.renderLabelsTicksAndTitle(); + b && b.renderLabelsTicksAndTitle() + } else { + m = []; + w = []; + B = []; + a && a.title && (a._titleTextBlock.maxWidth = a.titleMaxWidth || e.height, a._titleTextBlock.maxHeight = a.titleWrap ? 0.8 * e.width : 1.5 * a.titleFontSize, a._titleTextBlock.angle = -90); + c && c.title && (c._titleTextBlock.maxWidth = c.titleMaxWidth || e.width, c._titleTextBlock.maxHeight = c.titleWrap ? 0.8 * e.height : 1.5 * c.titleFontSize, + c._titleTextBlock.angle = 0); + b && b.title && (b._titleTextBlock.maxWidth = c.titleMaxWidth || e.width, b._titleTextBlock.maxHeight = b.titleWrap ? 0.8 * e.height : 1.5 * b.titleFontSize, b._titleTextBlock.angle = 0); + for (; 4 > l++; ) { + C = Math.ceil(a.createLabelsAndCalculateWidth()); + m.push(C); + c && (c.lineCoordinates = {}, f = Math.round(e.x1 + C + a.margin), g = Math.round(e.x2 > c.chart.width - 10 ? c.chart.width - 10 : e.x2), c.labelAutoFit && !x(t) && (f = 0 > c.labelAngle ? Math.max(f, t) : 0 === c.labelAngle ? Math.max(f, t / 2) : f, g = 0 < c.labelAngle ? g - u : 0 === c.labelAngle ? + g - u / 2 : g), c.lineCoordinates.x1 = f, c.lineCoordinates.x2 = g, c.lineCoordinates.width = Math.abs(g - f), c.title && (c._titleTextBlock.maxWidth = 0 < c.titleMaxWidth && c.titleMaxWidth < c.lineCoordinates.width ? c.titleMaxWidth : c.lineCoordinates.width)); + b && (b.lineCoordinates = {}, f = Math.round(e.x1 + C + a.margin), g = Math.round(e.x2 > b.chart.width - 10 ? b.chart.width - 10 : e.x2), c && c.labelAutoFit && !x(s) && (f = 0 < b.labelAngle ? Math.max(f, s) : 0 === b.labelAngle ? Math.max(f, s / 2) : f, g -= v / 2), b.lineCoordinates.x1 = f, b.lineCoordinates.x2 = g, b.lineCoordinates.width = + Math.abs(g - f), b.title && (b._titleTextBlock.maxWidth = 0 < b.titleMaxWidth && b.titleMaxWidth < b.lineCoordinates.width ? b.titleMaxWidth : b.lineCoordinates.width)); + A = Math.ceil(c ? c.createLabelsAndCalculateHeight() : 0); + p = Math.ceil(b ? b.createLabelsAndCalculateHeight() : 0); + w.push(A); + B.push(p); + c && 0 < c._labels.length && (h = c._labels[0], d = c._labels[c._labels.length - 1], t = h.textBlock.width * Math.cos(Math.PI / 180 * Math.abs(h.textBlock.angle)) + (h.textBlock.height - d.textBlock.fontSize / 2) * Math.sin(Math.PI / 180 * Math.abs(h.textBlock.angle)), + u = d.textBlock.width * Math.cos(Math.PI / 180 * Math.abs(d.textBlock.angle)) + (d.textBlock.height - d.textBlock.fontSize / 2) * Math.sin(Math.PI / 180 * Math.abs(d.textBlock.angle))); + b && 0 < b._labels.length && (h = b._labels[0], d = b._labels[b._labels.length - 1], s = h.textBlock.width * Math.cos(Math.PI / 180 * Math.abs(h.textBlock.angle)) + (h.textBlock.height - d.textBlock.fontSize / 2) * Math.sin(Math.PI / 180 * Math.abs(h.textBlock.angle)), v = d.textBlock.width * Math.cos(Math.PI / 180 * Math.abs(d.textBlock.angle)) + (d.textBlock.height - d.textBlock.fontSize / + 2) * Math.sin(Math.PI / 180 * Math.abs(d.textBlock.angle))); + q.panEnabled ? A = q.sessionVariables.axisY.height : q.sessionVariables.axisY.height = A; + c && (d = Math.round(e.y2 - A - c.margin), h = Math.round(e.y2 - n > c.chart.height - 10 ? c.chart.height - 10 : e.y2 - n), c.lineCoordinates.y1 = d, c.lineCoordinates.y2 = d, c.boundingRect = {x1: f, y1: d, x2: g, y2: h, width: g - f, height: A}, c.title && (c._titleTextBlock.maxWidth = 0 < c.titleMaxWidth && c.titleMaxWidth < c.lineCoordinates.width ? c.titleMaxWidth : c.lineCoordinates.width)); + b && (d = Math.round(e.y1 + b.margin), + h = e.y1 + b.margin + p, b.lineCoordinates.y1 = h, b.lineCoordinates.y2 = h, b.boundingRect = {x1: f, y1: d, x2: g, y2: h, width: g - f, height: p}, b.title && (b._titleTextBlock.maxWidth = 0 < b.titleMaxWidth && b.titleMaxWidth < b.lineCoordinates.width ? b.titleMaxWidth : b.lineCoordinates.width)); + f = Math.round(e.x1 + a.margin); + d = Math.round(b ? b.lineCoordinates.y2 : 10 > e.y1 ? 10 : e.y1); + g = Math.round(e.x1 + C + a.margin); + h = Math.round(c ? c.lineCoordinates.y1 : e.y2 - n > a.chart.height - 10 ? a.chart.height - 10 : e.y2 - n); + c && c.labelAutoFit && (g = 0 > c.labelAngle ? Math.max(g, + t) : 0 === c.labelAngle ? Math.max(g, t / 2) : g, f = 0 > c.labelAngle || 0 === c.labelAngle ? g - C : f); + b && b.labelAutoFit && (g = b.lineCoordinates.x1, f = g - C); + a.lineCoordinates = {x1: g, y1: d, x2: g, y2: h, height: Math.abs(h - d)}; + a.boundingRect = {x1: f, y1: d, x2: g, y2: h, width: g - f, height: h - d}; + a.title && (a._titleTextBlock.maxWidth = 0 < a.titleMaxWidth && a.titleMaxWidth < a.lineCoordinates.height ? a.titleMaxWidth : a.lineCoordinates.height); + a.calculateValueToPixelConversionParameters(); + c && c.calculateValueToPixelConversionParameters(); + b && b.calculateValueToPixelConversionParameters(); + if (a || c || b) { + if (!x(G)) + for (l = 0; l < G.length; l++) + for (j = l + 1; j < G.length; j++) + G[l] == G[j] && (D = !0); + if (!x(F)) + for (l = 0; l < F.length; l++) + for (j = l + 1; j < F.length; j++) + F[l] == F[j] && (E = !0); + if (!x(J)) + for (l = 0; l < J.length; l++) + for (j = l + 1; j < J.length; j++) + J[l] == J[j] && (I = !0) + } + if (D && E && I) + break + } + c && c.renderLabelsTicksAndTitle(); + b && b.renderLabelsTicksAndTitle(); + a.renderLabelsTicksAndTitle() + } + q.preparePlotArea(); + e = a.chart.plotArea; + k.save(); + k.rect(e.x1, e.y1, Math.abs(e.x2 - e.x1), Math.abs(e.y2 - e.y1)); + k.clip(); + a.renderStripLinesOfThicknessType("value"); + c && c.renderStripLinesOfThicknessType("value"); + b && b.renderStripLinesOfThicknessType("value"); + a.renderInterlacedColors(); + c && c.renderInterlacedColors(); + b && b.renderInterlacedColors(); + k.restore(); + a.renderGrid(); + c && c.renderGrid(); + b && b.renderGrid(); + a.renderAxisLine(); + c && c.renderAxisLine(); + b && b.renderAxisLine(); + a.renderStripLinesOfThicknessType("pixel"); + c && c.renderStripLinesOfThicknessType("pixel"); + b && b.renderStripLinesOfThicknessType("pixel") + }; + F.prototype.renderLabelsTicksAndTitle = function () { + var a = !1, c = + 0, b = 1, d = 0; + 0 !== this.labelAngle && 360 !== this.labelAngle && (b = 1.2); + if ("undefined" === typeof this._options.interval) { + if ("bottom" === this._position || "top" === this._position) { + for (var e = 0; e < this._labels.length; e++) + f = this._labels[e], f.position < this.viewportMinimum || (f = f.textBlock.width * Math.cos(Math.PI / 180 * this.labelAngle) + f.textBlock.height * Math.sin(Math.PI / 180 * this.labelAngle), c += f); + c > this.lineCoordinates.width * b && this.labelAutoFit && (a = !0) + } + if ("left" === this._position || "right" === this._position) { + for (e = 0; e < this._labels.length; e++) + f = + this._labels[e], f.position < this.viewportMinimum || (f = f.textBlock.height * Math.cos(Math.PI / 180 * this.labelAngle) + f.textBlock.width * Math.sin(Math.PI / 180 * this.labelAngle), c += f); + c > this.lineCoordinates.height * b && this.labelAutoFit && (a = !0) + } + } + if ("bottom" === this._position) { + for (var f, e = 0; e < this._labels.length; e++) + f = this._labels[e], f.position < this.viewportMinimum || f.position > this.viewportMaximum || (c = this.getPixelCoordinatesOnAxis(f.position), this.tickThickness && (this.ctx.lineWidth = this.tickThickness, this.ctx.strokeStyle = + this.tickColor, b = 1 === this.ctx.lineWidth % 2 ? (c.x << 0) + 0.5 : c.x << 0, this.ctx.beginPath(), this.ctx.moveTo(b, c.y << 0), this.ctx.lineTo(b, c.y + this.tickLength << 0), this.ctx.stroke()), a && 0 !== d++ % 2 && this.labelAutoFit || (0 === f.textBlock.angle ? (c.x -= f.textBlock.width / 2, c.y += this.tickLength + f.textBlock.fontSize / 2) : (c.x -= 0 > this.labelAngle ? f.textBlock.width * Math.cos(Math.PI / 180 * this.labelAngle) : 0, c.y += this.tickLength + Math.abs(0 > this.labelAngle ? f.textBlock.width * Math.sin(Math.PI / 180 * this.labelAngle) - 5 : 5)), f.textBlock.x = + c.x, f.textBlock.y = c.y, f.textBlock.render(!0))); + this.title && (this._titleTextBlock.measureText(), this._titleTextBlock.x = this.lineCoordinates.x1 + this.lineCoordinates.width / 2 - this._titleTextBlock.width / 2, this._titleTextBlock.y = this.boundingRect.y2 - this._titleTextBlock.height - 3, this._titleTextBlock.render(!0)) + } else if ("top" === this._position) { + for (e = 0; e < this._labels.length; e++) + f = this._labels[e], f.position < this.viewportMinimum || f.position > this.viewportMaximum || (c = this.getPixelCoordinatesOnAxis(f.position), + this.tickThickness && (this.ctx.lineWidth = this.tickThickness, this.ctx.strokeStyle = this.tickColor, b = 1 === this.ctx.lineWidth % 2 ? (c.x << 0) + 0.5 : c.x << 0, this.ctx.beginPath(), this.ctx.moveTo(b, c.y << 0), this.ctx.lineTo(b, c.y - this.tickLength << 0), this.ctx.stroke()), a && 0 !== d++ % 2 && this.labelAutoFit || (0 === f.textBlock.angle ? (c.x -= f.textBlock.width / 2, c.y -= this.tickLength + f.textBlock.height) : (c.x += (f.textBlock.height - this.tickLength - this.labelFontSize / 2) * Math.sin(Math.PI / 180 * this.labelAngle) - (0 < this.labelAngle ? f.textBlock.width * + Math.cos(Math.PI / 180 * this.labelAngle) : 0), c.y -= this.tickLength + (f.textBlock.height * Math.cos(Math.PI / 180 * this.labelAngle) + (0 < this.labelAngle ? f.textBlock.width * Math.sin(Math.PI / 180 * this.labelAngle) : 0))), f.textBlock.x = c.x, f.textBlock.y = c.y, f.textBlock.render(!0))); + this.title && (this._titleTextBlock.measureText(), this._titleTextBlock.x = this.lineCoordinates.x1 + this.lineCoordinates.width / 2 - this._titleTextBlock.width / 2, this._titleTextBlock.y = this.boundingRect.y1 + 1, this._titleTextBlock.render(!0)) + } else if ("left" === + this._position) { + for (e = 0; e < this._labels.length; e++) + f = this._labels[e], f.position < this.viewportMinimum || f.position > this.viewportMaximum || (c = this.getPixelCoordinatesOnAxis(f.position), this.tickThickness && (this.ctx.lineWidth = this.tickThickness, this.ctx.strokeStyle = this.tickColor, b = 1 === this.ctx.lineWidth % 2 ? (c.y << 0) + 0.5 : c.y << 0, this.ctx.beginPath(), this.ctx.moveTo(c.x << 0, b), this.ctx.lineTo(c.x - this.tickLength << 0, b), this.ctx.stroke()), a && 0 !== d++ % 2 && this.labelAutoFit || (0 === this.labelAngle ? (f.textBlock.y = c.y, + f.textBlock.x = c.x - f.textBlock.width * Math.cos(Math.PI / 180 * this.labelAngle) - this.tickLength - 5) : (f.textBlock.y = c.y - f.textBlock.width * Math.sin(Math.PI / 180 * this.labelAngle), f.textBlock.x = 0 < this.labelAngle ? c.x - f.textBlock.width * Math.cos(Math.PI / 180 * this.labelAngle) - this.tickLength - 5 : c.x - f.textBlock.width * Math.cos(Math.PI / 180 * this.labelAngle) + (f.textBlock.height - f.textBlock.fontSize / 2 - 5) * Math.sin(Math.PI / 180 * this.labelAngle) - this.tickLength), f.textBlock.render(!0))); + this.title && (this._titleTextBlock.measureText(), + this._titleTextBlock.x = this.boundingRect.x1 + 1, this._titleTextBlock.y = this.lineCoordinates.height / 2 + this._titleTextBlock.width / 2 + this.lineCoordinates.y1, this._titleTextBlock.render(!0)) + } else if ("right" === this._position) { + for (e = 0; e < this._labels.length; e++) + f = this._labels[e], f.position < this.viewportMinimum || f.position > this.viewportMaximum || (c = this.getPixelCoordinatesOnAxis(f.position), this.tickThickness && (this.ctx.lineWidth = this.tickThickness, this.ctx.strokeStyle = this.tickColor, b = 1 === this.ctx.lineWidth % + 2 ? (c.y << 0) + 0.5 : c.y << 0, this.ctx.beginPath(), this.ctx.moveTo(c.x << 0, b), this.ctx.lineTo(c.x + this.tickLength << 0, b), this.ctx.stroke()), a && 0 !== d++ % 2 && this.labelAutoFit || (0 === this.labelAngle ? (f.textBlock.y = c.y, f.textBlock.x = c.x + this.tickLength + 5) : (f.textBlock.y = 0 > this.labelAngle ? c.y : c.y - (f.textBlock.height - f.textBlock.fontSize / 2 - 5) * Math.cos(Math.PI / 180 * this.labelAngle), f.textBlock.x = 0 < this.labelAngle ? c.x + (f.textBlock.height - f.textBlock.fontSize / 2 - 5) * Math.sin(Math.PI / 180 * this.labelAngle) + this.tickLength : + c.x + this.tickLength + 5), f.textBlock.render(!0))); + this.title && (this._titleTextBlock.measureText(), this._titleTextBlock.x = this.boundingRect.x2 - 1, this._titleTextBlock.y = this.lineCoordinates.height / 2 - this._titleTextBlock.width / 2 + this.lineCoordinates.y1, this._titleTextBlock.render(!0)) + } + }; + F.prototype.renderInterlacedColors = function () { + var a = this.chart.plotArea.ctx, c, b, d = this.chart.plotArea, e = 0; + c = !0; + if (("bottom" === this._position || "top" === this._position) && this.interlacedColor) + for (a.fillStyle = this.interlacedColor, + e = 0; e < this._labels.length; e++) + this._labels[e].stripLine || (c ? (c = this.getPixelCoordinatesOnAxis(this._labels[e].position), b = e + 1 >= this._labels.length - 1 ? this.getPixelCoordinatesOnAxis(this.viewportMaximum) : this.getPixelCoordinatesOnAxis(this._labels[e + 1].position), a.fillRect(c.x, d.y1, Math.abs(b.x - c.x), Math.abs(d.y1 - d.y2)), c = !1) : c = !0); + else if (("left" === this._position || "right" === this._position) && this.interlacedColor) + for (a.fillStyle = this.interlacedColor, e = 0; e < this._labels.length; e++) + this._labels[e].stripLine || + (c ? (b = this.getPixelCoordinatesOnAxis(this._labels[e].position), c = e + 1 >= this._labels.length - 1 ? this.getPixelCoordinatesOnAxis(this.viewportMaximum) : this.getPixelCoordinatesOnAxis(this._labels[e + 1].position), a.fillRect(d.x1, c.y, Math.abs(d.x1 - d.x2), Math.abs(c.y - b.y)), c = !1) : c = !0); + a.beginPath() + }; + F.prototype.renderStripLinesOfThicknessType = function (a) { + if (this.stripLines && 0 < this.stripLines.length && a) { + for (var c = this, b, d = 0, d = 0; d < this.stripLines.length; d++) { + var e = this.stripLines[d]; + e._thicknessType === a && ("pixel" === + a && (e.value < this.viewportMinimum || e.value > this.viewportMaximum) || (e.showOnTop ? this.chart.addEventListener("dataAnimationIterationEnd", function () { + this.ctx.save(); + this.ctx.rect(this.chart.plotArea.x1, this.chart.plotArea.y1, this.chart.plotArea.width, this.chart.plotArea.height); + this.ctx.clip(); + e.render(); + this.ctx.restore() + }, e) : e.render())) + } + for (d = 0; d < this._stripLineLabels.length; d++) + if (e = this.stripLines[d], b = this._stripLineLabels[d], !(b.position < this.viewportMinimum || b.position > this.viewportMaximum)) + if (a = + this.getPixelCoordinatesOnAxis(b.position), "outside" === b.stripLine.labelPlacement) { + e && "pixel" === e._thicknessType && (this.ctx.lineWidth = e.thickness, this.ctx.strokeStyle = e.color); + if ("bottom" === this._position) { + var f = 1 === this.ctx.lineWidth % 2 ? (a.x << 0) + 0.5 : a.x << 0; + this.ctx.beginPath(); + this.ctx.moveTo(f, a.y << 0); + this.ctx.lineTo(f, a.y + this.tickLength << 0); + this.ctx.stroke(); + 0 === this.labelAngle ? (a.x -= b.textBlock.width / 2, a.y += this.tickLength + b.textBlock.fontSize / 2) : (a.x -= 0 > this.labelAngle ? b.textBlock.width * Math.cos(Math.PI / + 180 * this.labelAngle) : 0, a.y += this.tickLength + Math.abs(0 > this.labelAngle ? b.textBlock.width * Math.sin(Math.PI / 180 * this.labelAngle) + 5 : 5)) + } else + "top" === this._position ? (f = 1 === this.ctx.lineWidth % 2 ? (a.x << 0) + 0.5 : a.x << 0, this.ctx.beginPath(), this.ctx.moveTo(f, a.y << 0), this.ctx.lineTo(f, a.y - this.tickLength << 0), this.ctx.stroke(), 0 === this.labelAngle ? (a.x -= b.textBlock.width / 2, a.y -= this.tickLength + b.textBlock.height) : (a.x += (b.textBlock.height - this.tickLength - this.labelFontSize / 2) * Math.sin(Math.PI / 180 * this.labelAngle) - + (0 < this.labelAngle ? b.textBlock.width * Math.cos(Math.PI / 180 * this.labelAngle) : 0), a.y -= this.tickLength + (b.textBlock.height * Math.cos(Math.PI / 180 * this.labelAngle) + (0 < this.labelAngle ? b.textBlock.width * Math.sin(Math.PI / 180 * this.labelAngle) : 0)))) : "left" === this._position ? (f = 1 === this.ctx.lineWidth % 2 ? (a.y << 0) + 0.5 : a.y << 0, this.ctx.beginPath(), this.ctx.moveTo(a.x << 0, f), this.ctx.lineTo(a.x - this.tickLength << 0, f), this.ctx.stroke(), 0 === this.labelAngle ? a.x = a.x - b.textBlock.width * Math.cos(Math.PI / 180 * this.labelAngle) - + this.tickLength - 5 : (a.y -= b.textBlock.width * Math.sin(Math.PI / 180 * this.labelAngle), a.x = 0 < this.labelAngle ? a.x - b.textBlock.width * Math.cos(Math.PI / 180 * this.labelAngle) - this.tickLength - 5 : a.x - b.textBlock.width * Math.cos(Math.PI / 180 * this.labelAngle) + (b.textBlock.height - b.textBlock.fontSize / 2 - 5) * Math.sin(Math.PI / 180 * this.labelAngle) - this.tickLength)) : "right" === this._position && (f = 1 === this.ctx.lineWidth % 2 ? (a.y << 0) + 0.5 : a.y << 0, this.ctx.beginPath(), this.ctx.moveTo(a.x << 0, f), this.ctx.lineTo(a.x + this.tickLength << 0, + f), this.ctx.stroke(), 0 === this.labelAngle ? a.x = a.x + this.tickLength + 5 : (a.y = 0 > this.labelAngle ? a.y : a.y - (b.textBlock.height - b.textBlock.fontSize / 2 - 5) * Math.cos(Math.PI / 180 * this.labelAngle), a.x = 0 < this.labelAngle ? a.x + (b.textBlock.height - b.textBlock.fontSize / 2 - 5) * Math.sin(Math.PI / 180 * this.labelAngle) + this.tickLength : a.x + this.tickLength + 5)); + b.textBlock.x = a.x; + b.textBlock.y = a.y; + e.showOnTop ? this.chart.addEventListener("dataAnimationIterationEnd", b.textBlock.render, b.textBlock) : b.textBlock.render(!0) + } else + b.textBlock.angle = + -90, "bottom" === this._position ? (b.textBlock.maxWidth = this._options.stripLines[d].labelMaxWidth ? this._options.stripLines[d].labelMaxWidth : this.chart.plotArea.height - 3, b.textBlock.measureText(), a.x - b.textBlock.height > this.chart.plotArea.x1 ? x(e.startValue) ? a.x -= b.textBlock.height - b.textBlock.fontSize / 2 : a.x -= b.textBlock.height / 2 - b.textBlock.fontSize / 2 + 3 : (b.textBlock.angle = 90, x(e.startValue) ? a.x += b.textBlock.height - b.textBlock.fontSize / 2 : a.x += b.textBlock.height / 2 - b.textBlock.fontSize / 2 + 3), a.y = -90 === b.textBlock.angle ? + "near" === b.stripLine.labelAlign ? this.chart.plotArea.y2 - 3 : "center" === b.stripLine.labelAlign ? (this.chart.plotArea.y2 + this.chart.plotArea.y1 + b.textBlock.width) / 2 : this.chart.plotArea.y1 + b.textBlock.width + 3 : "near" === b.stripLine.labelAlign ? this.chart.plotArea.y2 - b.textBlock.width - 3 : "center" === b.stripLine.labelAlign ? (this.chart.plotArea.y2 + this.chart.plotArea.y1 - b.textBlock.width) / 2 : this.chart.plotArea.y1 + 3) : "top" === this._position ? (b.textBlock.maxWidth = this._options.stripLines[d].labelMaxWidth ? this._options.stripLines[d].labelMaxWidth : + this.chart.plotArea.height - 3, b.textBlock.measureText(), a.x - b.textBlock.height > this.chart.plotArea.x1 ? x(e.startValue) ? a.x -= b.textBlock.height - b.textBlock.fontSize / 2 : a.x -= b.textBlock.height / 2 - b.textBlock.fontSize / 2 + 3 : (b.textBlock.angle = 90, x(e.startValue) ? a.x += b.textBlock.height - b.textBlock.fontSize / 2 : a.x += b.textBlock.height / 2 - b.textBlock.fontSize / 2 + 3), a.y = -90 === b.textBlock.angle ? "near" === b.stripLine.labelAlign ? this.chart.plotArea.y1 + b.textBlock.width + 3 : "center" === b.stripLine.labelAlign ? (this.chart.plotArea.y2 + + this.chart.plotArea.y1 + b.textBlock.width) / 2 : this.chart.plotArea.y2 - 3 : "near" === b.stripLine.labelAlign ? this.chart.plotArea.y1 + 3 : "center" === b.stripLine.labelAlign ? (this.chart.plotArea.y2 + this.chart.plotArea.y1 - b.textBlock.width) / 2 : this.chart.plotArea.y2 - b.textBlock.width - 3) : "left" === this._position ? (b.textBlock.maxWidth = this._options.stripLines[d].labelMaxWidth ? this._options.stripLines[d].labelMaxWidth : this.chart.plotArea.width - 3, b.textBlock.angle = 0, b.textBlock.measureText(), a.y - b.textBlock.height > this.chart.plotArea.y1 ? + x(e.startValue) ? a.y -= b.textBlock.height - b.textBlock.fontSize / 2 : a.y -= b.textBlock.height / 2 - b.textBlock.fontSize + 3 : a.y - b.textBlock.height < this.chart.plotArea.y2 ? a.y += b.textBlock.fontSize / 2 + 3 : x(e.startValue) ? a.y -= b.textBlock.height - b.textBlock.fontSize / 2 : a.y -= b.textBlock.height / 2 - b.textBlock.fontSize + 3, a.x = "near" === b.stripLine.labelAlign ? this.chart.plotArea.x1 + 3 : "center" === b.stripLine.labelAlign ? (this.chart.plotArea.x2 + this.chart.plotArea.x1) / 2 - b.textBlock.width / 2 : this.chart.plotArea.x2 - b.textBlock.width - + 3) : "right" === this._position && (b.textBlock.maxWidth = this._options.stripLines[d].labelMaxWidth ? this._options.stripLines[d].labelMaxWidth : this.chart.plotArea.width - 3, b.textBlock.angle = 0, b.textBlock.measureText(), a.y - +b.textBlock.height > this.chart.plotArea.y1 ? x(e.startValue) ? a.y -= b.textBlock.height - b.textBlock.fontSize / 2 : a.y -= b.textBlock.height / 2 - b.textBlock.fontSize / 2 - 3 : a.y - b.textBlock.height < this.chart.plotArea.y2 ? a.y += b.textBlock.fontSize / 2 + 3 : x(e.startValue) ? a.y -= b.textBlock.height - b.textBlock.fontSize / + 2 : a.y -= b.textBlock.height / 2 - b.textBlock.fontSize / 2 + 3, a.x = "near" === b.stripLine.labelAlign ? this.chart.plotArea.x2 - b.textBlock.width - 3 : "center" === b.stripLine.labelAlign ? (this.chart.plotArea.x2 + this.chart.plotArea.x1) / 2 - b.textBlock.width / 2 : this.chart.plotArea.x1 + 3), b.textBlock.x = a.x, b.textBlock.y = a.y, e.showOnTop ? (this.ctx.save(), this.ctx.rect(this.chart.plotArea.x1, this.chart.plotArea.y1, this.chart.plotArea.width, this.chart.plotArea.height), this.ctx.clip(), this.chart.addEventListener("dataAnimationIterationEnd", + function () { + b.textBlock.render(!0); + c.ctx.restore() + }, b.textBlock)) : (this.ctx.save(), this.ctx.rect(this.chart.plotArea.x1, this.chart.plotArea.y1, this.chart.plotArea.width, this.chart.plotArea.height), this.ctx.clip(), b.textBlock.render(!0), this.ctx.restore()) + } + }; + F.prototype.renderGrid = function () { + if (this.gridThickness && 0 < this.gridThickness) { + var a = this.chart.ctx; + a.save(); + var c, b = this.chart.plotArea; + a.lineWidth = this.gridThickness; + a.strokeStyle = this.gridColor; + a.setLineDash && a.setLineDash(D(this.gridDashType, + this.gridThickness)); + if ("bottom" === this._position || "top" === this._position) + for (d = 0; d < this._labels.length && !this._labels[d].stripLine; d++) + this._labels[d].position < this.viewportMinimum || this._labels[d].position > this.viewportMaximum || (a.beginPath(), c = this.getPixelCoordinatesOnAxis(this._labels[d].position), c = 1 === a.lineWidth % 2 ? (c.x << 0) + 0.5 : c.x << 0, a.moveTo(c, b.y1 << 0), a.lineTo(c, b.y2 << 0), a.stroke()); + else if ("left" === this._position || "right" === this._position) + for (var d = 0; d < this._labels.length && !this._labels[d].stripLine; d++) + this._labels[d].position < + this.viewportMinimum || this._labels[d].position > this.viewportMaximum || (a.beginPath(), c = this.getPixelCoordinatesOnAxis(this._labels[d].position), c = 1 === a.lineWidth % 2 ? (c.y << 0) + 0.5 : c.y << 0, a.moveTo(b.x1 << 0, c), a.lineTo(b.x2 << 0, c), a.stroke()); + a.restore() + } + }; + F.prototype.renderAxisLine = function () { + var a = this.chart.ctx; + a.save(); + if ("bottom" === this._position || "top" === this._position) { + if (this.lineThickness) { + a.lineWidth = this.lineThickness; + a.strokeStyle = this.lineColor ? this.lineColor : "black"; + a.setLineDash && a.setLineDash(D(this.lineDashType, + this.lineThickness)); + var c = 1 === this.lineThickness % 2 ? (this.lineCoordinates.y1 << 0) + 0.5 : this.lineCoordinates.y1 << 0; + a.beginPath(); + a.moveTo(this.lineCoordinates.x1, c); + a.lineTo(this.lineCoordinates.x2, c); + a.stroke() + } + } else + "left" !== this._position && "right" !== this._position || !this.lineThickness || (a.lineWidth = this.lineThickness, a.strokeStyle = this.lineColor, a.setLineDash && a.setLineDash(D(this.lineDashType, this.lineThickness)), c = 1 === this.lineThickness % 2 ? (this.lineCoordinates.x1 << 0) + 0.5 : this.lineCoordinates.x1 << + 0, a.beginPath(), a.moveTo(c, this.lineCoordinates.y1), a.lineTo(c, this.lineCoordinates.y2), a.stroke()); + a.restore() + }; + F.prototype.getPixelCoordinatesOnAxis = function (a) { + var c = {}; + if ("bottom" === this._position || "top" === this._position) { + var b = this.conversionParameters.pixelPerUnit; + c.x = this.conversionParameters.reference + b * (a - this.viewportMinimum); + c.y = this.lineCoordinates.y1 + } + if ("left" === this._position || "right" === this._position) + b = -this.conversionParameters.pixelPerUnit, c.y = this.conversionParameters.reference - + b * (a - this.viewportMinimum), c.x = this.lineCoordinates.x2; + return c + }; + F.prototype.convertPixelToValue = function (a) { + if (!a) + return null; + var c = 0; + return c = this.conversionParameters.minimum + (("left" === this._position || "right" === this._position ? a.y : a.x) - this.conversionParameters.reference) / this.conversionParameters.pixelPerUnit + }; + F.prototype.setViewPortRange = function (a, c) { + this.sessionVariables.newViewportMinimum = this.viewportMinimum = Math.min(a, c); + this.sessionVariables.newViewportMaximum = this.viewportMaximum = Math.max(a, + c) + }; + F.prototype.getXValueAt = function (a) { + if (!a) + return null; + var c = null; + "left" === this._position ? c = (this.chart.axisX.viewportMaximum - this.chart.axisX.viewportMinimum) / this.chart.axisX.lineCoordinates.height * (this.chart.axisX.lineCoordinates.y2 - a.y) + this.chart.axisX.viewportMinimum : "bottom" === this._position && (c = (this.chart.axisX.viewportMaximum - this.chart.axisX.viewportMinimum) / this.chart.axisX.lineCoordinates.width * (a.x - this.chart.axisX.lineCoordinates.x1) + this.chart.axisX.viewportMinimum); + return c + }; + F.prototype.calculateValueToPixelConversionParameters = function (a) { + this.reversed = !1; + a = {pixelPerUnit: null, minimum: null, reference: null}; + var c = this.lineCoordinates.width, b = this.lineCoordinates.height; + a.minimum = this.viewportMinimum; + if ("bottom" === this._position || "top" === this._position) + a.pixelPerUnit = (this.reversed ? -1 : 1) * c / Math.abs(this.viewportMaximum - this.viewportMinimum), a.reference = this.reversed ? this.lineCoordinates.x2 : this.lineCoordinates.x1; + if ("left" === this._position || "right" === this._position) + a.pixelPerUnit = + (this.reversed ? 1 : -1) * b / Math.abs(this.viewportMaximum - this.viewportMinimum), a.reference = this.reversed ? this.lineCoordinates.y1 : this.lineCoordinates.y2; + this.conversionParameters = a + }; + F.prototype.calculateAxisParameters = function () { + var a = this.chart.layoutManager.getFreeSpace(), c = !1; + "bottom" === this._position || "top" === this._position ? (this.maxWidth = a.width, this.maxHeight = a.height) : (this.maxWidth = a.height, this.maxHeight = a.width); + var a = "axisX" === this.type ? 500 > this.maxWidth ? 8 : Math.max(6, Math.floor(this.maxWidth / + 62)) : Math.max(Math.floor(this.maxWidth / 40), 2), b, d, e, f; + f = 0; + if (null === this.viewportMinimum || isNaN(this.viewportMinimum)) + this.viewportMinimum = this.minimum; + if (null === this.viewportMaximum || isNaN(this.viewportMaximum)) + this.viewportMaximum = this.maximum; + "axisX" === this.type ? (b = null !== this.viewportMinimum ? this.viewportMinimum : this.dataInfo.viewPortMin, d = null !== this.viewportMaximum ? this.viewportMaximum : this.dataInfo.viewPortMax, 0 === d - b && (f = "undefined" === typeof this._options.interval ? 0.4 : this._options.interval, + d += f, b -= f), Infinity !== this.dataInfo.minDiff ? e = this.dataInfo.minDiff : 1 < d - b ? e = 0.5 * Math.abs(d - b) : (e = 1, "dateTime" === this.chart.plotInfo.axisXValueType && (c = !0))) : "axisY" === this.type && (b = null !== this.viewportMinimum ? this.viewportMinimum : this.dataInfo.viewPortMin, d = null !== this.viewportMaximum ? this.viewportMaximum : this.dataInfo.viewPortMax, isFinite(b) || isFinite(d) ? isFinite(b) ? isFinite(d) || (d = b) : b = d : (d = "undefined" === typeof this._options.interval ? -Infinity : this._options.interval, b = 0), 0 === b && 0 === d ? (d += 9, b = 0) : + 0 === d - b ? (f = Math.min(Math.abs(0.01 * Math.abs(d)), 5), d += f, b -= f) : b > d ? (f = Math.min(Math.abs(0.01 * Math.abs(d - b)), 5), 0 <= d ? b = d - f : d = b + f) : (f = Math.min(Math.abs(0.01 * Math.abs(d - b)), 0.05), 0 !== d && (d += f), 0 !== b && (b -= f)), e = Infinity !== this.dataInfo.minDiff ? this.dataInfo.minDiff : 1 < d - b ? 0.5 * Math.abs(d - b) : 1, this.includeZero && (null === this.viewportMinimum || isNaN(this.viewportMinimum)) && 0 < b && (b = 0), this.includeZero && (null === this.viewportMaximum || isNaN(this.viewportMaximum)) && 0 > d && (d = 0)); + f = (isNaN(this.viewportMaximum) || null === + this.viewportMaximum ? d : this.viewportMaximum) - (isNaN(this.viewportMinimum) || null === this.viewportMinimum ? b : this.viewportMinimum); + if ("axisX" === this.type && "dateTime" === this.chart.plotInfo.axisXValueType) { + this.intervalType || (f / 1 <= a ? (this.interval = 1, this.intervalType = "millisecond") : f / 2 <= a ? (this.interval = 2, this.intervalType = "millisecond") : f / 5 <= a ? (this.interval = 5, this.intervalType = "millisecond") : f / 10 <= a ? (this.interval = 10, this.intervalType = "millisecond") : f / 20 <= a ? (this.interval = 20, this.intervalType = "millisecond") : + f / 50 <= a ? (this.interval = 50, this.intervalType = "millisecond") : f / 100 <= a ? (this.interval = 100, this.intervalType = "millisecond") : f / 200 <= a ? (this.interval = 200, this.intervalType = "millisecond") : f / 250 <= a ? (this.interval = 250, this.intervalType = "millisecond") : f / 300 <= a ? (this.interval = 300, this.intervalType = "millisecond") : f / 400 <= a ? (this.interval = 400, this.intervalType = "millisecond") : f / 500 <= a ? (this.interval = 500, this.intervalType = "millisecond") : f / (1 * E.secondDuration) <= a ? (this.interval = 1, this.intervalType = "second") : f / (2 * + E.secondDuration) <= a ? (this.interval = 2, this.intervalType = "second") : f / (5 * E.secondDuration) <= a ? (this.interval = 5, this.intervalType = "second") : f / (10 * E.secondDuration) <= a ? (this.interval = 10, this.intervalType = "second") : f / (15 * E.secondDuration) <= a ? (this.interval = 15, this.intervalType = "second") : f / (20 * E.secondDuration) <= a ? (this.interval = 20, this.intervalType = "second") : f / (30 * E.secondDuration) <= a ? (this.interval = 30, this.intervalType = "second") : f / (1 * E.minuteDuration) <= a ? (this.interval = 1, this.intervalType = "minute") : f / + (2 * E.minuteDuration) <= a ? (this.interval = 2, this.intervalType = "minute") : f / (5 * E.minuteDuration) <= a ? (this.interval = 5, this.intervalType = "minute") : f / (10 * E.minuteDuration) <= a ? (this.interval = 10, this.intervalType = "minute") : f / (15 * E.minuteDuration) <= a ? (this.interval = 15, this.intervalType = "minute") : f / (20 * E.minuteDuration) <= a ? (this.interval = 20, this.intervalType = "minute") : f / (30 * E.minuteDuration) <= a ? (this.interval = 30, this.intervalType = "minute") : f / (1 * E.hourDuration) <= a ? (this.interval = 1, this.intervalType = "hour") : f / + (2 * E.hourDuration) <= a ? (this.interval = 2, this.intervalType = "hour") : f / (3 * E.hourDuration) <= a ? (this.interval = 3, this.intervalType = "hour") : f / (6 * E.hourDuration) <= a ? (this.interval = 6, this.intervalType = "hour") : f / (1 * E.dayDuration) <= a ? (this.interval = 1, this.intervalType = "day") : f / (2 * E.dayDuration) <= a ? (this.interval = 2, this.intervalType = "day") : f / (4 * E.dayDuration) <= a ? (this.interval = 4, this.intervalType = "day") : f / (1 * E.weekDuration) <= a ? (this.interval = 1, this.intervalType = "week") : f / (2 * E.weekDuration) <= a ? (this.interval = 2, + this.intervalType = "week") : f / (3 * E.weekDuration) <= a ? (this.interval = 3, this.intervalType = "week") : f / (1 * E.monthDuration) <= a ? (this.interval = 1, this.intervalType = "month") : f / (2 * E.monthDuration) <= a ? (this.interval = 2, this.intervalType = "month") : f / (3 * E.monthDuration) <= a ? (this.interval = 3, this.intervalType = "month") : f / (6 * E.monthDuration) <= a ? (this.interval = 6, this.intervalType = "month") : (this.interval = f / (1 * E.yearDuration) <= a ? 1 : f / (2 * E.yearDuration) <= a ? 2 : f / (4 * E.yearDuration) <= a ? 4 : Math.floor(F.getNiceNumber(f / (a - 1), !0) / + E.yearDuration), this.intervalType = "year")); + if (null === this.viewportMinimum || isNaN(this.viewportMinimum)) + this.viewportMinimum = b - e / 2; + if (null === this.viewportMaximum || isNaN(this.viewportMaximum)) + this.viewportMaximum = d + e / 2; + c ? this.autoValueFormatString = "MMM DD YYYY HH:mm" : "year" === this.intervalType ? this.autoValueFormatString = "YYYY" : "month" === this.intervalType ? this.autoValueFormatString = "MMM YYYY" : "week" === this.intervalType ? this.autoValueFormatString = "MMM DD YYYY" : "day" === this.intervalType ? this.autoValueFormatString = + "MMM DD YYYY" : "hour" === this.intervalType ? this.autoValueFormatString = "hh:mm TT" : "minute" === this.intervalType ? this.autoValueFormatString = "hh:mm TT" : "second" === this.intervalType ? this.autoValueFormatString = "hh:mm:ss TT" : "millisecond" === this.intervalType && (this.autoValueFormatString = "fff'ms'"); + this.valueFormatString || (this.valueFormatString = this.autoValueFormatString) + } else { + this.intervalType = "number"; + f = F.getNiceNumber(f, !1); + this.interval = this._options && 0 < this._options.interval ? this._options.interval : F.getNiceNumber(f / + (a - 1), !0); + if (null === this.viewportMinimum || isNaN(this.viewportMinimum)) + this.viewportMinimum = "axisX" === this.type ? b - e / 2 : Math.floor(b / this.interval) * this.interval; + if (null === this.viewportMaximum || isNaN(this.viewportMaximum)) + this.viewportMaximum = "axisX" === this.type ? d + e / 2 : Math.ceil(d / this.interval) * this.interval; + 0 === this.viewportMaximum && 0 === this.viewportMinimum && (0 === this._options.viewportMinimum ? this.viewportMaximum += 10 : 0 === this._options.viewportMaximum && (this.viewportMinimum -= 10), this._options && "undefined" === + typeof this._options.interval && (this.interval = F.getNiceNumber((this.viewportMaximum - this.viewportMinimum) / (a - 1), !0))) + } + if (null === this.minimum || null === this.maximum) + if ("axisX" === this.type ? (b = null !== this.minimum ? this.minimum : this.dataInfo.min, d = null !== this.maximum ? this.maximum : this.dataInfo.max, 0 === d - b && (f = "undefined" === typeof this._options.interval ? 0.4 : this._options.interval, d += f, b -= f), e = Infinity !== this.dataInfo.minDiff ? this.dataInfo.minDiff : 1 < d - b ? 0.5 * Math.abs(d - b) : 1) : "axisY" === this.type && (b = null !== + this.minimum ? this.minimum : this.dataInfo.min, d = null !== this.maximum ? this.maximum : this.dataInfo.max, isFinite(b) || isFinite(d) ? 0 === b && 0 === d ? (d += 9, b = 0) : 0 === d - b ? (f = Math.min(Math.abs(0.01 * Math.abs(d)), 5), d += f, b -= f) : b > d ? (f = Math.min(Math.abs(0.01 * Math.abs(d - b)), 5), 0 <= d ? b = d - f : d = b + f) : (f = Math.min(Math.abs(0.01 * Math.abs(d - b)), 0.05), 0 !== d && (d += f), 0 !== b && (b -= f)) : (d = "undefined" === typeof this._options.interval ? -Infinity : this._options.interval, b = 0), e = Infinity !== this.dataInfo.minDiff ? this.dataInfo.minDiff : 1 < d - b ? 0.5 * + Math.abs(d - b) : 1, this.includeZero && (null === this.minimum || isNaN(this.minimum)) && 0 < b && (b = 0), this.includeZero && (null === this.maximum || isNaN(this.maximum)) && 0 > d && (d = 0)), "axisX" === this.type && "dateTime" === this.chart.plotInfo.axisXValueType) { + if (null === this.minimum || isNaN(this.minimum)) + this.minimum = b - e / 2; + if (null === this.maximum || isNaN(this.maximum)) + this.maximum = d + e / 2 + } else + this.intervalType = "number", null === this.minimum && (this.minimum = "axisX" === this.type ? b - e / 2 : Math.floor(b / this.interval) * this.interval, this.minimum = + Math.min(this.minimum, null === this.sessionVariables.viewportMinimum || isNaN(this.sessionVariables.viewportMinimum) ? Infinity : this.sessionVariables.viewportMinimum)), null === this.maximum && (this.maximum = "axisX" === this.type ? d + e / 2 : Math.ceil(d / this.interval) * this.interval, this.maximum = Math.max(this.maximum, null === this.sessionVariables.viewportMaximum || isNaN(this.sessionVariables.viewportMaximum) ? -Infinity : this.sessionVariables.viewportMaximum)), 0 === this.maximum && 0 === this.minimum && (0 === this._options.minimum ? + this.maximum += 10 : 0 === this._options.maximum && (this.minimum -= 10)); + this.viewportMinimum = Math.max(this.viewportMinimum, this.minimum); + this.viewportMaximum = Math.min(this.viewportMaximum, this.maximum); + this.intervalStartPosition = "axisX" === this.type && "dateTime" === this.chart.plotInfo.axisXValueType ? this.getLabelStartPoint(new Date(this.viewportMinimum), this.intervalType, this.interval) : Math.floor((this.viewportMinimum + 0.2 * this.interval) / this.interval) * this.interval; + if (!this.valueFormatString && (this.valueFormatString = + "#,##0.##", f = Math.abs(this.viewportMaximum - this.viewportMinimum), 1 > f)) { + c = Math.floor(Math.abs(Math.log(f) / Math.LN10)) + 2; + if (isNaN(c) || !isFinite(c)) + c = 2; + if (2 < c) + for (b = 0; b < c - 2; b++) + this.valueFormatString += "#" + } + }; + F.getNiceNumber = function (a, c) { + var b = Math.floor(Math.log(a) / Math.LN10), d = a / Math.pow(10, b); + return Number(((c ? 1.5 > d ? 1 : 3 > d ? 2 : 7 > d ? 5 : 10 : 1 >= d ? 1 : 2 >= d ? 2 : 5 >= d ? 5 : 10) * Math.pow(10, b)).toFixed(20)) + }; + F.prototype.getLabelStartPoint = function () { + var a = E[this.intervalType + "Duration"] * this.interval, a = new Date(Math.floor(this.viewportMinimum / + a) * a); + if ("millisecond" !== this.intervalType) + if ("second" === this.intervalType) + 0 < a.getMilliseconds() && (a.setSeconds(a.getSeconds() + 1), a.setMilliseconds(0)); + else if ("minute" === this.intervalType) { + if (0 < a.getSeconds() || 0 < a.getMilliseconds()) + a.setMinutes(a.getMinutes() + 1), a.setSeconds(0), a.setMilliseconds(0) + } else if ("hour" === this.intervalType) { + if (0 < a.getMinutes() || 0 < a.getSeconds() || 0 < a.getMilliseconds()) + a.setHours(a.getHours() + 1), a.setMinutes(0), a.setSeconds(0), a.setMilliseconds(0) + } else if ("day" === this.intervalType) { + if (0 < + a.getHours() || 0 < a.getMinutes() || 0 < a.getSeconds() || 0 < a.getMilliseconds()) + a.setDate(a.getDate() + 1), a.setHours(0), a.setMinutes(0), a.setSeconds(0), a.setMilliseconds(0) + } else if ("week" === this.intervalType) { + if (0 < a.getDay() || 0 < a.getHours() || 0 < a.getMinutes() || 0 < a.getSeconds() || 0 < a.getMilliseconds()) + a.setDate(a.getDate() + (7 - a.getDay())), a.setHours(0), a.setMinutes(0), a.setSeconds(0), a.setMilliseconds(0) + } else if ("month" === this.intervalType) { + if (1 < a.getDate() || 0 < a.getHours() || 0 < a.getMinutes() || 0 < a.getSeconds() || + 0 < a.getMilliseconds()) + a.setMonth(a.getMonth() + 1), a.setDate(1), a.setHours(0), a.setMinutes(0), a.setSeconds(0), a.setMilliseconds(0) + } else + "year" === this.intervalType && (0 < a.getMonth() || 1 < a.getDate() || 0 < a.getHours() || 0 < a.getMinutes() || 0 < a.getSeconds() || 0 < a.getMilliseconds()) && (a.setFullYear(a.getFullYear() + 1), a.setMonth(0), a.setDate(1), a.setHours(0), a.setMinutes(0), a.setSeconds(0), a.setMilliseconds(0)); + return a + }; + T(pa, L); + pa.prototype.render = function () { + this.ctx.save(); + var a = this.parent.getPixelCoordinatesOnAxis(this.value), + c = Math.abs("pixel" === this._thicknessType ? this.thickness : this.parent.conversionParameters.pixelPerUnit * this.thickness); + if (0 < c) { + var b = null === this.opacity ? 1 : this.opacity; + this.ctx.strokeStyle = this.color; + this.ctx.beginPath(); + var d = this.ctx.globalAlpha; + this.ctx.globalAlpha = b; + C(this.id); + var e, f, g, h; + this.ctx.lineWidth = c; + this.ctx.setLineDash && this.ctx.setLineDash(D(this.lineDashType, c)); + if ("bottom" === this.parent._position || "top" === this.parent._position) + e = f = 1 === this.ctx.lineWidth % 2 ? (a.x << 0) + 0.5 : a.x << 0, g = this.chart.plotArea.y1, + h = this.chart.plotArea.y2; + else if ("left" === this.parent._position || "right" === this.parent._position) + g = h = 1 === this.ctx.lineWidth % 2 ? (a.y << 0) + 0.5 : a.y << 0, e = this.chart.plotArea.x1, f = this.chart.plotArea.x2; + this.ctx.moveTo(e, g); + this.ctx.lineTo(f, h); + this.ctx.stroke(); + this.ctx.globalAlpha = d + } + this.ctx.restore() + }; + T(V, L); + V.prototype._initialize = function () { + if (this.enabled) { + this.container = document.createElement("div"); + this.container.setAttribute("class", "canvasjs-chart-tooltip"); + this.container.style.position = "absolute"; + this.container.style.height = "auto"; + this.container.style.boxShadow = "1px 1px 2px 2px rgba(0,0,0,0.1)"; + this.container.style.zIndex = "1000"; + this.container.style.display = "none"; + var a; + a = '
(new Date).getTime() - this._lastUpdated || (this._lastUpdated = (new Date).getTime(), this._updateToolTip(a, c)) + }; + V.prototype._updateToolTip = function (a, c) { + if (!this.chart.disableToolTip) { + if ("undefined" === typeof a || "undefined" === typeof c) { + if (isNaN(this._prevX) || + isNaN(this._prevY)) + return; + a = this._prevX; + c = this._prevY + } else + this._prevX = a, this._prevY = c; + var b = null, d = null, e = [], f = 0; + if (this.shared && this.enabled && "none" !== this.chart.plotInfo.axisPlacement) { + f = "xySwapped" === this.chart.plotInfo.axisPlacement ? (this.chart.axisX.viewportMaximum - this.chart.axisX.viewportMinimum) / this.chart.axisX.lineCoordinates.height * (this.chart.axisX.lineCoordinates.y2 - c) + this.chart.axisX.viewportMinimum : (this.chart.axisX.viewportMaximum - this.chart.axisX.viewportMinimum) / this.chart.axisX.lineCoordinates.width * + (a - this.chart.axisX.lineCoordinates.x1) + this.chart.axisX.viewportMinimum; + d = []; + for (b = 0; b < this.chart.data.length; b++) { + var g = this.chart.data[b].getDataPointAtX(f, !0); + g && 0 <= g.index && (g.dataSeries = this.chart.data[b], null !== g.dataPoint.y && d.push(g)) + } + if (0 === d.length) + return; + d.sort(function (a, b) { + return a.distance - b.distance + }); + f = d[0]; + for (b = 0; b < d.length; b++) + d[b].dataPoint.x.valueOf() === f.dataPoint.x.valueOf() && e.push(d[b]); + d = null + } else { + if (g = this.chart.getDataPointAtXY(a, c, !0)) + this.currentDataPointIndex = g.dataPointIndex, + this.currentSeriesIndex = g.dataSeries.index; + else if (u) + if (g = Ea(a, c, this.chart._eventManager.ghostCtx), 0 < g && "undefined" !== typeof this.chart._eventManager.objectMap[g]) { + g = this.chart._eventManager.objectMap[g]; + if ("legendItem" === g.objectType) + return; + this.currentSeriesIndex = g.dataSeriesIndex; + this.currentDataPointIndex = 0 <= g.dataPointIndex ? g.dataPointIndex : -1 + } else + this.currentDataPointIndex = -1; + else + this.currentDataPointIndex = -1; + if (0 <= this.currentSeriesIndex) { + d = this.chart.data[this.currentSeriesIndex]; + g = {}; + if (0 <= this.currentDataPointIndex) + b = d.dataPoints[this.currentDataPointIndex], g.dataSeries = d, g.dataPoint = b, g.index = this.currentDataPointIndex, g.distance = Math.abs(b.x - f); + else { + if (!this.enabled || "line" !== d.type && "stepLine" !== d.type && "spline" !== d.type && "area" !== d.type && "stepArea" !== d.type && "splineArea" !== d.type && "stackedArea" !== d.type && "stackedArea100" !== d.type && "rangeArea" !== d.type && "rangeSplineArea" !== d.type && "candlestick" !== d.type && "ohlc" !== d.type) + return; + f = d.axisX.conversionParameters.minimum + (a - d.axisX.conversionParameters.reference) / + d.axisX.conversionParameters.pixelPerUnit; + g = d.getDataPointAtX(f, !0); + g.dataSeries = d; + this.currentDataPointIndex = g.index; + b = g.dataPoint + } + if (!x(g.dataPoint.y)) + if (g.dataSeries.axisY) + if (0 < g.dataPoint.y.length) { + for (b = f = 0; b < g.dataPoint.y.length; b++) + g.dataPoint.y[b] < g.dataSeries.axisY.viewportMinimum ? f-- : g.dataPoint.y[b] > g.dataSeries.axisY.viewportMaximum && f++; + f < g.dataPoint.y.length && f > -g.dataPoint.y.length && e.push(g) + } else + "column" === d.type || "bar" === d.type ? 0 > g.dataPoint.y ? 0 > g.dataSeries.axisY.viewportMinimum && + g.dataSeries.axisY.viewportMaximum >= g.dataPoint.y && e.push(g) : g.dataSeries.axisY.viewportMinimum <= g.dataPoint.y && 0 <= g.dataSeries.axisY.viewportMaximum && e.push(g) : "bubble" === d.type ? (f = this.chart._eventManager.objectMap[d.dataPointIds[g.index]].size / 2, g.dataPoint.y >= g.dataSeries.axisY.viewportMinimum - f && g.dataPoint.y <= g.dataSeries.axisY.viewportMaximum + f && e.push(g)) : (0 <= g.dataSeries.type.indexOf("100") || "stackedColumn" === d.type || "stackedBar" === d.type || g.dataPoint.y >= g.dataSeries.axisY.viewportMinimum && + g.dataPoint.y <= g.dataSeries.axisY.viewportMaximum) && e.push(g); + else + e.push(g) + } + } + if (0 < e.length && (this.highlightObjects(e), this.enabled)) + if (f = "", f = this.getToolTipInnerHTML({entries: e}), null !== f) { + this.contentDiv.innerHTML = f; + this.contentDiv.innerHTML = f; + f = !1; + "none" === this.container.style.display && (f = !0, this.container.style.display = "block"); + try { + this.contentDiv.style.background = this.backgroundColor ? this.backgroundColor : u ? "rgba(255,255,255,.9)" : "rgb(255,255,255)", this.contentDiv.style.borderRightColor = this.contentDiv.style.borderLeftColor = + this.contentDiv.style.borderColor = this.borderColor ? this.borderColor : e[0].dataPoint.color ? e[0].dataPoint.color : e[0].dataSeries.color ? e[0].dataSeries.color : e[0].dataSeries._colorSet[e[0].index % e[0].dataSeries._colorSet.length], this.contentDiv.style.borderWidth = this.borderThickness || 0 === this.borderThickness ? this.borderThickness + "px" : "2px", this.contentDiv.style.borderRadius = this.cornerRadius || 0 === this.cornerRadius ? this.cornerRadius + "px" : "5px", this.container.style.borderRadius = this.contentDiv.style.borderRadius, + this.contentDiv.style.fontSize = this.fontSize || 0 === this.fontSize ? this.fontSize + "px" : "14px", this.contentDiv.style.color = this.fontColor ? this.fontColor : "#000000", this.contentDiv.style.fontFamily = this.fontFamily ? this.fontFamily : "Calibri, Arial, Georgia, serif;", this.contentDiv.style.fontWeight = this.fontWeight ? this.fontWeight : "normal", this.contentDiv.style.fontStyle = this.fontStyle ? this.fontStyle : u ? "italic" : "normal" + } catch (h) { + } + "pie" === e[0].dataSeries.type || "doughnut" === e[0].dataSeries.type || "funnel" === e[0].dataSeries.type || + "bar" === e[0].dataSeries.type || "rangeBar" === e[0].dataSeries.type || "stackedBar" === e[0].dataSeries.type || "stackedBar100" === e[0].dataSeries.type ? g = a - 10 - this.container.clientWidth : (g = e[0].dataSeries.axisX.conversionParameters.reference + e[0].dataSeries.axisX.conversionParameters.pixelPerUnit * (e[0].dataPoint.x - e[0].dataSeries.axisX.conversionParameters.minimum) - this.container.clientWidth << 0, g -= 10); + 0 > g && (g += this.container.clientWidth + 20); + g + this.container.clientWidth > Math.max(this.chart._container.clientWidth, + this.chart.width) && (g = Math.max(0, Math.max(this.chart._container.clientWidth, this.chart.width) - this.container.clientWidth)); + e = 1 !== e.length || this.shared || "line" !== e[0].dataSeries.type && "stepLine" !== e[0].dataSeries.type && "spline" !== e[0].dataSeries.type && "area" !== e[0].dataSeries.type && "stepArea" !== e[0].dataSeries.type && "splineArea" !== e[0].dataSeries.type && "stackedArea" !== e[0].dataSeries.type && "stackedArea100" !== e[0].dataSeries.type ? "bar" === e[0].dataSeries.type || "rangeBar" === e[0].dataSeries.type || "stackedBar" === + e[0].dataSeries.type || "stackedBar100" === e[0].dataSeries.type ? e[0].dataSeries.axisX.conversionParameters.reference + e[0].dataSeries.axisX.conversionParameters.pixelPerUnit * (e[0].dataPoint.x - e[0].dataSeries.axisX.viewportMinimum) + 0.5 << 0 : c : e[0].dataSeries.axisY.conversionParameters.reference + e[0].dataSeries.axisY.conversionParameters.pixelPerUnit * (e[0].dataPoint.y - e[0].dataSeries.axisY.viewportMinimum) + 0.5 << 0; + e = -e + 10; + 0 < e + this.container.clientHeight + 5 && (e -= e + this.container.clientHeight + 5 - 0); + this.container.style.left = + g + "px"; + this.container.style.bottom = e + "px"; + !this.animationEnabled || f ? this.disableAnimation() : this.enableAnimation() + } else + this.hide(!1) + } + }; + V.prototype.highlightObjects = function (a) { + var c = this.chart.overlaidCanvasCtx; + this.chart.resetOverlayedCanvas(); + c.clearRect(0, 0, this.chart.width, this.chart.height); + c.save(); + var b = this.chart.plotArea, d = 0; + c.rect(b.x1, b.y1, b.x2 - b.x1, b.y2 - b.y1); + c.clip(); + for (b = 0; b < a.length; b++) { + var e = a[b]; + if ((e = this.chart._eventManager.objectMap[e.dataSeries.dataPointIds[e.index]]) && e.objectType && + "dataPoint" === e.objectType) { + var d = this.chart.data[e.dataSeriesIndex], f = d.dataPoints[e.dataPointIndex], g = e.dataPointIndex; + !1 === f.highlightEnabled || !0 !== d.highlightEnabled && !0 !== f.highlightEnabled || ("line" === d.type || "stepLine" === d.type || "spline" === d.type || "scatter" === d.type || "area" === d.type || "stepArea" === d.type || "splineArea" === d.type || "stackedArea" === d.type || "stackedArea100" === d.type || "rangeArea" === d.type || "rangeSplineArea" === d.type ? (f = d.getMarkerProperties(g, e.x1, e.y1, this.chart.overlaidCanvasCtx), + f.size = Math.max(1.5 * f.size << 0, 10), f.borderColor = f.borderColor || "#FFFFFF", f.borderThickness = f.borderThickness || Math.ceil(0.1 * f.size), P.drawMarkers([f]), "undefined" !== typeof e.y2 && (f = d.getMarkerProperties(g, e.x1, e.y2, this.chart.overlaidCanvasCtx), f.size = Math.max(1.5 * f.size << 0, 10), f.borderColor = f.borderColor || "#FFFFFF", f.borderThickness = f.borderThickness || Math.ceil(0.1 * f.size), P.drawMarkers([f]))) : "bubble" === d.type ? (f = d.getMarkerProperties(g, e.x1, e.y1, this.chart.overlaidCanvasCtx), f.size = e.size, f.color = + "white", f.borderColor = "white", c.globalAlpha = 0.3, P.drawMarkers([f]), c.globalAlpha = 1) : "column" === d.type || "stackedColumn" === d.type || "stackedColumn100" === d.type || "bar" === d.type || "rangeBar" === d.type || "stackedBar" === d.type || "stackedBar100" === d.type || "rangeColumn" === d.type ? M(c, e.x1, e.y1, e.x2, e.y2, "white", 0, null, !1, !1, !1, !1, 0.3) : "pie" === d.type || "doughnut" === d.type ? ya(c, e.center, e.radius, "white", d.type, e.startAngle, e.endAngle, 0.3, e.percentInnerRadius) : "candlestick" === d.type ? (c.globalAlpha = 1, c.strokeStyle = + e.color, c.lineWidth = 2 * e.borderThickness, d = 0 === c.lineWidth % 2 ? 0 : 0.5, c.beginPath(), c.moveTo(e.x3 - d, e.y2), c.lineTo(e.x3 - d, Math.min(e.y1, e.y4)), c.stroke(), c.beginPath(), c.moveTo(e.x3 - d, Math.max(e.y1, e.y4)), c.lineTo(e.x3 - d, e.y3), c.stroke(), M(c, e.x1, Math.min(e.y1, e.y4), e.x2, Math.max(e.y1, e.y4), "transparent", 2 * e.borderThickness, e.color, !1, !1, !1, !1), c.globalAlpha = 1) : "ohlc" === d.type && (c.globalAlpha = 1, c.strokeStyle = e.color, c.lineWidth = 2 * e.borderThickness, d = 0 === c.lineWidth % 2 ? 0 : 0.5, c.beginPath(), c.moveTo(e.x3 - + d, e.y2), c.lineTo(e.x3 - d, e.y3), c.stroke(), c.beginPath(), c.moveTo(e.x3, e.y1), c.lineTo(e.x1, e.y1), c.stroke(), c.beginPath(), c.moveTo(e.x3, e.y4), c.lineTo(e.x2, e.y4), c.stroke(), c.globalAlpha = 1)) + } + } + c.restore(); + c.globalAlpha = 1; + c.beginPath() + }; + V.prototype.getToolTipInnerHTML = function (a) { + a = a.entries; + for (var c = null, b = null, d = null, e = 0, f = "", g = !0, h = 0; h < a.length; h++) + if (a[h].dataSeries.toolTipContent || a[h].dataPoint.toolTipContent) { + g = !1; + break + } + if (g && (this.content && "function" === typeof this.content || this.contentFormatter)) + a = + {chart: this.chart._publicChartReference, toolTip: this._options, entries: a}, c = this.contentFormatter ? this.contentFormatter(a) : this.content(a); + else if (this.shared && "none" !== this.chart.plotInfo.axisPlacement) { + for (var q = "", h = 0; h < a.length; h++) + if (b = a[h].dataSeries, d = a[h].dataPoint, e = a[h].index, f = "", 0 === h && (g && !this.content) && (q += "undefined" !== typeof this.chart.axisX.labels[d.x] ? this.chart.axisX.labels[d.x] : "{x}", q += "
", q = this.chart.replaceKeywordsWithValue(q, d, b, e)), null !== d.toolTipContent && ("undefined" !== + typeof d.toolTipContent || null !== b._options.toolTipContent)) { + if ("line" === b.type || "stepLine" === b.type || "spline" === b.type || "area" === b.type || "stepArea" === b.type || "splineArea" === b.type || "column" === b.type || "bar" === b.type || "scatter" === b.type || "stackedColumn" === b.type || "stackedColumn100" === b.type || "stackedBar" === b.type || "stackedBar100" === b.type || "stackedArea" === b.type || "stackedArea100" === b.type) + f += d.toolTipContent ? d.toolTipContent : b.toolTipContent ? b.toolTipContent : this.content && "function" !== typeof this.content ? + this.content : "{name}:  {y}"; + else if ("bubble" === b.type) + f += d.toolTipContent ? d.toolTipContent : b.toolTipContent ? b.toolTipContent : this.content && "function" !== typeof this.content ? this.content : "{name}:  {y},   {z}"; + else if ("rangeColumn" === b.type || "rangeBar" === b.type || "rangeArea" === b.type || "rangeSplineArea" === b.type) + f += d.toolTipContent ? d.toolTipContent : + b.toolTipContent ? b.toolTipContent : this.content && "function" !== typeof this.content ? this.content : "{name}:  {y[0]}, {y[1]}"; + else if ("candlestick" === b.type || "ohlc" === b.type) + f += d.toolTipContent ? d.toolTipContent : b.toolTipContent ? b.toolTipContent : this.content && "function" !== typeof this.content ? this.content : "{name}:
Open:   {y[0]}
High:    {y[1]}
Low:   {y[2]}
Close:   {y[3]}"; + null === c && (c = ""); + !0 === this.reversed ? (c = this.chart.replaceKeywordsWithValue(f, d, b, e) + c, h < a.length - 1 && (c = "
" + c)) : (c += this.chart.replaceKeywordsWithValue(f, d, b, e), h < a.length - 1 && (c += "
")) + } + null !== c && (c = q + c) + } else { + b = a[0].dataSeries; + d = a[0].dataPoint; + e = a[0].index; + if (null === d.toolTipContent || "undefined" === typeof d.toolTipContent && null === b._options.toolTipContent) + return null; + if ("line" === b.type || "stepLine" === b.type || "spline" === b.type || "area" === b.type || "stepArea" === b.type || "splineArea" === b.type || "column" === + b.type || "bar" === b.type || "scatter" === b.type || "stackedColumn" === b.type || "stackedColumn100" === b.type || "stackedBar" === b.type || "stackedBar100" === b.type || "stackedArea" === b.type || "stackedArea100" === b.type) + f = d.toolTipContent ? d.toolTipContent : b.toolTipContent ? b.toolTipContent : this.content && "function" !== typeof this.content ? this.content : "" + (d.label ? "{label}" : "{x}") + ":  {y}"; + else if ("bubble" === b.type) + f = d.toolTipContent ? d.toolTipContent : + b.toolTipContent ? b.toolTipContent : this.content && "function" !== typeof this.content ? this.content : "" + (d.label ? "{label}" : "{x}") + ":  {y},   {z}"; + else if ("pie" === b.type || "doughnut" === b.type || "funnel" === b.type) + f = d.toolTipContent ? d.toolTipContent : b.toolTipContent ? b.toolTipContent : this.content && "function" !== typeof this.content ? this.content : "" + (d.name ? "{name}:  " : + d.label ? "{label}:  " : "") + "{y}"; + else if ("rangeColumn" === b.type || "rangeBar" === b.type || "rangeArea" === b.type || "rangeSplineArea" === b.type) + f = d.toolTipContent ? d.toolTipContent : b.toolTipContent ? b.toolTipContent : this.content && "function" !== typeof this.content ? this.content : "" + (d.label ? "{label}" : "{x}") + " :  {y[0]},  {y[1]}"; + else if ("candlestick" === b.type || "ohlc" === b.type) + f = d.toolTipContent ? d.toolTipContent : + b.toolTipContent ? b.toolTipContent : this.content && "function" !== typeof this.content ? this.content : "" + (d.label ? "{label}" : "{x}") + "
Open:   {y[0]}
High:    {y[1]}
Low:     {y[2]}
Close:   {y[3]}"; + null === c && (c = ""); + c += this.chart.replaceKeywordsWithValue(f, d, b, e) + } + return c + }; + V.prototype.enableAnimation = function () { + this.container.style.WebkitTransition || (this.container.style.WebkitTransition = + "left .2s ease-out, bottom .2s ease-out", this.container.style.MozTransition = "left .2s ease-out, bottom .2s ease-out", this.container.style.MsTransition = "left .2s ease-out, bottom .2s ease-out", this.container.style.transition = "left .2s ease-out, bottom .2s ease-out") + }; + V.prototype.disableAnimation = function () { + this.container.style.WebkitTransition && (this.container.style.WebkitTransition = "", this.container.style.MozTransition = "", this.container.style.MsTransition = "", this.container.style.transition = "") + }; + V.prototype.hide = + function (a) { + this.enabled && (this.container.style.display = "none", this.currentSeriesIndex = -1, this._prevY = this._prevX = NaN, ("undefined" === typeof a || a) && this.chart.resetOverlayedCanvas()) + }; + v.prototype.getPercentAndTotal = function (a, c) { + var b = null, d = null, e = null; + if (0 <= a.type.indexOf("stacked")) + d = 0, b = c.x.getTime ? c.x.getTime() : c.x, b in a.plotUnit.yTotals && (d = a.plotUnit.yTotals[b], e = isNaN(c.y) ? 0 : 0 === d ? 0 : 100 * (c.y / d)); + else if ("pie" === a.type || "doughnut" === a.type) { + for (i = d = 0; i < a.dataPoints.length; i++) + isNaN(a.dataPoints[i].y) || + (d += a.dataPoints[i].y); + e = isNaN(c.y) ? 0 : 100 * (c.y / d) + } + return{percent: e, total: d} + }; + v.prototype.replaceKeywordsWithValue = function (a, c, b, d, e) { + var f = this; + e = "undefined" === typeof e ? 0 : e; + if ((0 <= b.type.indexOf("stacked") || "pie" === b.type || "doughnut" === b.type) && (0 <= a.indexOf("#percent") || 0 <= a.indexOf("#total"))) { + var g = "#percent", h = "#total", q = this.getPercentAndTotal(b, c), h = isNaN(q.total) ? h : q.total, g = isNaN(q.percent) ? g : q.percent; + do { + q = ""; + if (b.percentFormatString) + q = b.percentFormatString; + else { + var q = "#,##0.", k = Math.max(Math.ceil(Math.log(1 / + Math.abs(g)) / Math.LN10), 2); + if (isNaN(k) || !isFinite(k)) + k = 2; + for (var n = 0; n < k; n++) + q += "#" + } + a = a.replace("#percent", ba(g, q, f._cultureInfo)); + a = a.replace("#total", ba(h, b.yValueFormatString ? b.yValueFormatString : "#,##0.########")) + } while (0 <= a.indexOf("#percent") || 0 <= a.indexOf("#total")) + } + return a.replace(/\{.*?\}|"[^"]*"|'[^']*'/g, function (a) { + if ('"' === a[0] && '"' === a[a.length - 1] || "'" === a[0] && "'" === a[a.length - 1]) + return a.slice(1, a.length - 1); + a = ea(a.slice(1, a.length - 1)); + a = a.replace("#index", e); + var g = null; + try { + var h = a.match(/(.*?)\s*\[\s*(.*?)\s*\]/); + h && 0 < h.length && (g = ea(h[2]), a = ea(h[1])) + } catch (k) { + } + h = null; + if ("color" === a) + return c.color ? c.color : b.color ? b.color : b._colorSet[d % b._colorSet.length]; + if (c.hasOwnProperty(a)) + h = c; + else if (b.hasOwnProperty(a)) + h = b; + else + return""; + h = h[a]; + null !== g && (h = h[g]); + return"x" === a ? "dateTime" === f.plotInfo.axisXValueType || "dateTime" === b.xValueType || c.x && c.x.getTime ? wa(h, c.xValueFormatString ? c.xValueFormatString : b.xValueFormatString ? b.xValueFormatString : f.axisX && f.axisX.autoValueFormatString ? f.axisX.autoValueFormatString : "DD MMM YY", + f._cultureInfo) : ba(h, c.xValueFormatString ? c.xValueFormatString : b.xValueFormatString ? b.xValueFormatString : "#,##0.########", f._cultureInfo) : "y" === a ? ba(h, c.yValueFormatString ? c.yValueFormatString : b.yValueFormatString ? b.yValueFormatString : "#,##0.########", f._cultureInfo) : "z" === a ? ba(h, c.zValueFormatString ? c.zValueFormatString : b.zValueFormatString ? b.zValueFormatString : "#,##0.########", f._cultureInfo) : h + }) + }; + fa.prototype.reset = function () { + this.lastObjectId = 0; + this.objectMap = []; + this.rectangularRegionEventSubscriptions = + []; + this.previousDataPointEventObject = null; + this.eventObjects = []; + u && (this.ghostCtx.clearRect(0, 0, this.chart.width, this.chart.height), this.ghostCtx.beginPath()) + }; + fa.prototype.getNewObjectTrackingId = function () { + return++this.lastObjectId + }; + fa.prototype.mouseEventHandler = function (a) { + if ("mousemove" === a.type || "click" === a.type) { + var c = [], b = ra(a), d = null; + if ((d = this.chart.getObjectAtXY(b.x, b.y, !1)) && "undefined" !== typeof this.objectMap[d]) + if (d = this.objectMap[d], "dataPoint" === d.objectType) { + var e = this.chart.data[d.dataSeriesIndex], + f = e.dataPoints[d.dataPointIndex], g = d.dataPointIndex; + d.eventParameter = {x: b.x, y: b.y, dataPoint: f, dataSeries: e._options, dataPointIndex: g, dataSeriesIndex: e.index, chart: this.chart._publicChartReference}; + d.eventContext = {context: f, userContext: f, mouseover: "mouseover", mousemove: "mousemove", mouseout: "mouseout", click: "click"}; + c.push(d); + d = this.objectMap[e.id]; + d.eventParameter = {x: b.x, y: b.y, dataPoint: f, dataSeries: e._options, dataPointIndex: g, dataSeriesIndex: e.index, chart: this.chart._publicChartReference}; + d.eventContext = + {context: e, userContext: e._options, mouseover: "mouseover", mousemove: "mousemove", mouseout: "mouseout", click: "click"}; + c.push(this.objectMap[e.id]) + } else + "legendItem" === d.objectType && (e = this.chart.data[d.dataSeriesIndex], f = null !== d.dataPointIndex ? e.dataPoints[d.dataPointIndex] : null, d.eventParameter = {x: b.x, y: b.y, dataSeries: e._options, dataPoint: f, dataPointIndex: d.dataPointIndex, dataSeriesIndex: d.dataSeriesIndex, chart: this.chart._publicChartReference}, d.eventContext = {context: this.chart.legend, userContext: this.chart.legend._options, + mouseover: "itemmouseover", mousemove: "itemmousemove", mouseout: "itemmouseout", click: "itemclick"}, c.push(d)); + e = []; + for (b = 0; b < this.mouseoveredObjectMaps.length; b++) { + f = !0; + for (d = 0; d < c.length; d++) + if (c[d].id === this.mouseoveredObjectMaps[b].id) { + f = !1; + break + } + f ? this.fireEvent(this.mouseoveredObjectMaps[b], "mouseout", a) : e.push(this.mouseoveredObjectMaps[b]) + } + this.mouseoveredObjectMaps = e; + for (b = 0; b < c.length; b++) { + e = !1; + for (d = 0; d < this.mouseoveredObjectMaps.length; d++) + if (c[b].id === this.mouseoveredObjectMaps[d].id) { + e = !0; + break + } + e || (this.fireEvent(c[b], "mouseover", a), this.mouseoveredObjectMaps.push(c[b])); + "click" === a.type ? this.fireEvent(c[b], "click", a) : "mousemove" === a.type && this.fireEvent(c[b], "mousemove", a) + } + } + }; + fa.prototype.fireEvent = function (a, c, b) { + if (a && c) { + var d = a.eventParameter, e = a.eventContext, f = a.eventContext.userContext; + f && (e && f[e[c]]) && f[e[c]].call(f, d); + "mouseout" !== c ? f.cursor && f.cursor !== b.target.style.cursor && (b.target.style.cursor = f.cursor) : (b.target.style.cursor = this.chart._defaultCursor, delete a.eventParameter, + delete a.eventContext); + "click" === c && ("dataPoint" === a.objectType && this.chart.pieDoughnutClickHandler) && this.chart.pieDoughnutClickHandler.call(this.chart.data[a.dataSeriesIndex], d) + } + }; + T(ha, L); + va.prototype.animate = function (a, c, b, d, e) { + var f = this; + this.chart.isAnimating = !0; + e = e || B.easing.linear; + b && this.animations.push({startTime: (new Date).getTime() + (a ? a : 0), duration: c, animationCallback: b, onComplete: d}); + for (a = []; 0 < this.animations.length; ) + if (c = this.animations.shift(), b = (new Date).getTime(), d = 0, c.startTime <= + b && (d = e(Math.min(b - c.startTime, c.duration), 0, 1, c.duration), d = Math.min(d, 1), isNaN(d) || !isFinite(d)) && (d = 1), 1 > d && a.push(c), c.animationCallback(d), 1 <= d && c.onComplete) + c.onComplete(); + this.animations = a; + 0 < this.animations.length ? this.animationRequestId = this.chart.requestAnimFrame.call(window, function () { + f.animate.call(f) + }) : this.chart.isAnimating = !1 + }; + va.prototype.cancelAllAnimations = function () { + this.animations = []; + this.animationRequestId && this.chart.cancelRequestAnimFrame.call(window, this.animationRequestId); + this.animationRequestId = null; + this.chart.isAnimating = !1 + }; + var B = {yScaleAnimation: function (a, c) { + if (0 !== a) { + var b = c.dest, d = c.source.canvas, e = c.animationBase; + b.drawImage(d, 0, 0, d.width, d.height, 0, e - e * a, b.canvas.width / N, a * b.canvas.height / N) + } + }, xScaleAnimation: function (a, c) { + if (0 !== a) { + var b = c.dest, d = c.source.canvas, e = c.animationBase; + b.drawImage(d, 0, 0, d.width, d.height, e - e * a, 0, a * b.canvas.width / N, b.canvas.height / N) + } + }, xClipAnimation: function (a, c) { + if (0 !== a) { + var b = c.dest, d = c.source.canvas; + b.save(); + 0 < a && b.drawImage(d, + 0, 0, d.width * a, d.height, 0, 0, d.width * a / N, d.height / N); + b.restore() + } + }, fadeInAnimation: function (a, c) { + if (0 !== a) { + var b = c.dest, d = c.source.canvas; + b.save(); + b.globalAlpha = a; + b.drawImage(d, 0, 0, d.width, d.height, 0, 0, b.canvas.width / N, b.canvas.height / N); + b.restore() + } + }, easing: {linear: function (a, c, b, d) { + return b * a / d + c + }, easeOutQuad: function (a, c, b, d) { + return-b * (a /= d) * (a - 2) + c + }, easeOutQuart: function (a, c, b, d) { + return-b * ((a = a / d - 1) * a * a * a - 1) + c + }, easeInQuad: function (a, c, b, d) { + return b * (a /= d) * a + c + }, easeInQuart: function (a, c, b, d) { + return b * + (a /= d) * a * a * a + c + }}}, P = {drawMarker: function (a, c, b, d, e, f, g, h) { + if (b) { + var q = 1; + b.fillStyle = f ? f : "#000000"; + b.strokeStyle = g ? g : "#000000"; + b.lineWidth = h ? h : 0; + "circle" === d ? (b.moveTo(a, c), b.beginPath(), b.arc(a, c, e / 2, 0, 2 * Math.PI, !1), f && b.fill(), h && (g ? b.stroke() : (q = b.globalAlpha, b.globalAlpha = 0.15, b.strokeStyle = "black", b.stroke(), b.globalAlpha = q))) : "square" === d ? (b.beginPath(), b.rect(a - e / 2, c - e / 2, e, e), f && b.fill(), h && (g ? b.stroke() : (q = b.globalAlpha, b.globalAlpha = 0.15, b.strokeStyle = "black", b.stroke(), b.globalAlpha = q))) : + "triangle" === d ? (b.beginPath(), b.moveTo(a - e / 2, c + e / 2), b.lineTo(a + e / 2, c + e / 2), b.lineTo(a, c - e / 2), b.closePath(), f && b.fill(), h && (g ? b.stroke() : (q = b.globalAlpha, b.globalAlpha = 0.15, b.strokeStyle = "black", b.stroke(), b.globalAlpha = q)), b.beginPath()) : "cross" === d && (b.strokeStyle = f, b.lineWidth = e / 4, b.beginPath(), b.moveTo(a - e / 2, c - e / 2), b.lineTo(a + e / 2, c + e / 2), b.stroke(), b.moveTo(a + e / 2, c - e / 2), b.lineTo(a - e / 2, c + e / 2), b.stroke()) + } + }, drawMarkers: function (a) { + for (var c = 0; c < a.length; c++) { + var b = a[c]; + P.drawMarker(b.x, b.y, b.ctx, b.type, + b.size, b.color, b.borderColor, b.borderThickness) + } + }}, Ia = {Chart: function (a, c) { + var b = new v(a, c, this); + this.render = function () { + b.render(this.options) + }; + this.options = b._options + }, addColorSet: function (a, c) { + aa[a] = c + }, addCultureInfo: function (a, c) { + ia[a] = c + }, formatNumber: function (a, c, b) { + b = b || "en"; + if (ia[b]) + return ba(a, c || "#,##0.##", new ha(b)); + throw"Unknown Culture Name"; + }, formatDate: function (a, c, b) { + b = b || "en"; + if (ia[b]) + return wa(a, c || "DD MMM YYYY", new ha(b)); + throw"Unknown Culture Name"; + }}; + Ia.Chart.version = "v1.8.1 Beta 2"; + window.CanvasJS = Ia +})(); +/* + excanvas is used to support IE678 which do not implement HTML5 Canvas Element. You can safely remove the following excanvas code if you don't need to support older browsers. + + Copyright 2006 Google Inc. https://code.google.com/p/explorercanvas/ + Licensed under the Apache License, Version 2.0 + */ +document.createElement("canvas").getContext || function () { + function V() { + return this.context_ || (this.context_ = new C(this)) + } + function W(a, b, c) { + var g = M.call(arguments, 2); + return function () { + return a.apply(b, g.concat(M.call(arguments))) + } + } + function N(a) { + return String(a).replace(/&/g, "&").replace(/"/g, """) + } + function O(a) { + a.namespaces.g_vml_ || a.namespaces.add("g_vml_", "urn:schemas-microsoft-com:vml", "#default#VML"); + a.namespaces.g_o_ || a.namespaces.add("g_o_", "urn:schemas-microsoft-com:office:office", "#default#VML"); + a.styleSheets.ex_canvas_ || (a = a.createStyleSheet(), a.owningElement.id = "ex_canvas_", a.cssText = "canvas{display:inline-block;overflow:hidden;text-align:left;width:300px;height:150px}") + } + function X(a) { + var b = a.srcElement; + switch (a.propertyName) { + case "width": + b.getContext().clearRect(); + b.style.width = b.attributes.width.nodeValue + "px"; + b.firstChild.style.width = b.clientWidth + "px"; + break; + case "height": + b.getContext().clearRect(), b.style.height = b.attributes.height.nodeValue + "px", b.firstChild.style.height = b.clientHeight + + "px" + } + } + function Y(a) { + a = a.srcElement; + a.firstChild && (a.firstChild.style.width = a.clientWidth + "px", a.firstChild.style.height = a.clientHeight + "px") + } + function D() { + return[[1, 0, 0], [0, 1, 0], [0, 0, 1]] + } + function t(a, b) { + for (var c = D(), g = 0; 3 > g; g++) + for (var e = 0; 3 > e; e++) { + for (var f = 0, d = 0; 3 > d; d++) + f += a[g][d] * b[d][e]; + c[g][e] = f + } + return c + } + function P(a, b) { + b.fillStyle = a.fillStyle; + b.lineCap = a.lineCap; + b.lineJoin = a.lineJoin; + b.lineWidth = a.lineWidth; + b.miterLimit = a.miterLimit; + b.shadowBlur = a.shadowBlur; + b.shadowColor = a.shadowColor; + b.shadowOffsetX = + a.shadowOffsetX; + b.shadowOffsetY = a.shadowOffsetY; + b.strokeStyle = a.strokeStyle; + b.globalAlpha = a.globalAlpha; + b.font = a.font; + b.textAlign = a.textAlign; + b.textBaseline = a.textBaseline; + b.arcScaleX_ = a.arcScaleX_; + b.arcScaleY_ = a.arcScaleY_; + b.lineScale_ = a.lineScale_ + } + function Q(a) { + var b = a.indexOf("(", 3), c = a.indexOf(")", b + 1), b = a.substring(b + 1, c).split(","); + if (4 != b.length || "a" != a.charAt(3)) + b[3] = 1; + return b + } + function E(a, b, c) { + return Math.min(c, Math.max(b, a)) + } + function F(a, b, c) { + 0 > c && c++; + 1 < c && c--; + return 1 > 6 * c ? a + 6 * (b - a) * c : + 1 > 2 * c ? b : 2 > 3 * c ? a + 6 * (b - a) * (2 / 3 - c) : a + } + function G(a) { + if (a in H) + return H[a]; + var b, c = 1; + a = String(a); + if ("#" == a.charAt(0)) + b = a; + else if (/^rgb/.test(a)) { + c = Q(a); + b = "#"; + for (var g, e = 0; 3 > e; e++) + g = -1 != c[e].indexOf("%") ? Math.floor(255 * (parseFloat(c[e]) / 100)) : +c[e], b += v[E(g, 0, 255)]; + c = +c[3] + } else if (/^hsl/.test(a)) { + e = c = Q(a); + b = parseFloat(e[0]) / 360 % 360; + 0 > b && b++; + g = E(parseFloat(e[1]) / 100, 0, 1); + e = E(parseFloat(e[2]) / 100, 0, 1); + if (0 == g) + g = e = b = e; + else { + var f = 0.5 > e ? e * (1 + g) : e + g - e * g, d = 2 * e - f; + g = F(d, f, b + 1 / 3); + e = F(d, f, b); + b = F(d, f, b - 1 / 3) + } + b = "#" + + v[Math.floor(255 * g)] + v[Math.floor(255 * e)] + v[Math.floor(255 * b)]; + c = c[3] + } else + b = Z[a] || a; + return H[a] = {color: b, alpha: c} + } + function C(a) { + this.m_ = D(); + this.mStack_ = []; + this.aStack_ = []; + this.currentPath_ = []; + this.fillStyle = this.strokeStyle = "#000"; + this.lineWidth = 1; + this.lineJoin = "miter"; + this.lineCap = "butt"; + this.miterLimit = 1 * q; + this.globalAlpha = 1; + this.font = "10px sans-serif"; + this.textAlign = "left"; + this.textBaseline = "alphabetic"; + this.canvas = a; + var b = "width:" + a.clientWidth + "px;height:" + a.clientHeight + "px;overflow:hidden;position:absolute", + c = a.ownerDocument.createElement("div"); + c.style.cssText = b; + a.appendChild(c); + b = c.cloneNode(!1); + b.style.backgroundColor = "red"; + b.style.filter = "alpha(opacity=0)"; + a.appendChild(b); + this.element_ = c; + this.lineScale_ = this.arcScaleY_ = this.arcScaleX_ = 1 + } + function R(a, b, c, g) { + a.currentPath_.push({type: "bezierCurveTo", cp1x: b.x, cp1y: b.y, cp2x: c.x, cp2y: c.y, x: g.x, y: g.y}); + a.currentX_ = g.x; + a.currentY_ = g.y + } + function S(a, b) { + var c = G(a.strokeStyle), g = c.color, c = c.alpha * a.globalAlpha, e = a.lineScale_ * a.lineWidth; + 1 > e && (c *= e); + b.push("') + } + function T(a, b, c, g) { + var e = a.fillStyle, f = a.arcScaleX_, d = a.arcScaleY_, k = g.x - c.x, n = g.y - c.y; + if (e instanceof w) { + var h = 0, l = g = 0, u = 0, m = 1; + if ("gradient" == e.type_) { + h = e.x1_ / f; + c = e.y1_ / d; + var p = s(a, e.x0_ / f, e.y0_ / d), h = s(a, h, c), h = 180 * Math.atan2(h.x - p.x, h.y - p.y) / Math.PI; + 0 > h && (h += 360); + 1E-6 > h && (h = 0) + } else + p = s(a, e.x0_, e.y0_), g = (p.x - c.x) / k, l = (p.y - c.y) / n, k /= f * q, + n /= d * q, m = x.max(k, n), u = 2 * e.r0_ / m, m = 2 * e.r1_ / m - u; + f = e.colors_; + f.sort(function (a, b) { + return a.offset - b.offset + }); + d = f.length; + p = f[0].color; + c = f[d - 1].color; + k = f[0].alpha * a.globalAlpha; + a = f[d - 1].alpha * a.globalAlpha; + for (var n = [], r = 0; r < d; r++) { + var t = f[r]; + n.push(t.offset * m + u + " " + t.color) + } + b.push('') + } else + e instanceof + I ? k && n && b.push("') : (e = G(a.fillStyle), b.push('')) + } + function s(a, b, c) { + a = a.m_; + return{x: q * (b * a[0][0] + c * a[1][0] + a[2][0]) - r, y: q * (b * a[0][1] + c * a[1][1] + a[2][1]) - r} + } + function z(a, b, c) { + isFinite(b[0][0]) && (isFinite(b[0][1]) && isFinite(b[1][0]) && isFinite(b[1][1]) && isFinite(b[2][0]) && isFinite(b[2][1])) && (a.m_ = b, c && (a.lineScale_ = aa(ba(b[0][0] * b[1][1] - b[0][1] * + b[1][0])))) + } + function w(a) { + this.type_ = a; + this.r1_ = this.y1_ = this.x1_ = this.r0_ = this.y0_ = this.x0_ = 0; + this.colors_ = [] + } + function I(a, b) { + if (!a || 1 != a.nodeType || "IMG" != a.tagName) + throw new A("TYPE_MISMATCH_ERR"); + if ("complete" != a.readyState) + throw new A("INVALID_STATE_ERR"); + switch (b) { + case "repeat": + case null: + case "": + this.repetition_ = "repeat"; + break; + case "repeat-x": + case "repeat-y": + case "no-repeat": + this.repetition_ = b; + break; + default: + throw new A("SYNTAX_ERR"); + } + this.src_ = a.src; + this.width_ = a.width; + this.height_ = a.height + } + function A(a) { + this.code = this[a]; + this.message = a + ": DOM Exception " + this.code + } + var x = Math, k = x.round, J = x.sin, K = x.cos, ba = x.abs, aa = x.sqrt, q = 10, r = q / 2; + navigator.userAgent.match(/MSIE ([\d.]+)?/); + var M = Array.prototype.slice; + O(document); + var U = {init: function (a) { + a = a || document; + a.createElement("canvas"); + a.attachEvent("onreadystatechange", W(this.init_, this, a)) + }, init_: function (a) { + a = a.getElementsByTagName("canvas"); + for (var b = 0; b < a.length; b++) + this.initElement(a[b]) + }, initElement: function (a) { + if (!a.getContext) { + a.getContext = + V; + O(a.ownerDocument); + a.innerHTML = ""; + a.attachEvent("onpropertychange", X); + a.attachEvent("onresize", Y); + var b = a.attributes; + b.width && b.width.specified ? a.style.width = b.width.nodeValue + "px" : a.width = a.clientWidth; + b.height && b.height.specified ? a.style.height = b.height.nodeValue + "px" : a.height = a.clientHeight + } + return a + }}; + U.init(); + for (var v = [], d = 0; 16 > d; d++) + for (var B = 0; 16 > B; B++) + v[16 * d + B] = d.toString(16) + B.toString(16); + var Z = {aliceblue: "#F0F8FF", antiquewhite: "#FAEBD7", aquamarine: "#7FFFD4", azure: "#F0FFFF", beige: "#F5F5DC", + bisque: "#FFE4C4", black: "#000000", blanchedalmond: "#FFEBCD", blueviolet: "#8A2BE2", brown: "#A52A2A", burlywood: "#DEB887", cadetblue: "#5F9EA0", chartreuse: "#7FFF00", chocolate: "#D2691E", coral: "#FF7F50", cornflowerblue: "#6495ED", cornsilk: "#FFF8DC", crimson: "#DC143C", cyan: "#00FFFF", darkblue: "#00008B", darkcyan: "#008B8B", darkgoldenrod: "#B8860B", darkgray: "#A9A9A9", darkgreen: "#006400", darkgrey: "#A9A9A9", darkkhaki: "#BDB76B", darkmagenta: "#8B008B", darkolivegreen: "#556B2F", darkorange: "#FF8C00", darkorchid: "#9932CC", darkred: "#8B0000", + darksalmon: "#E9967A", darkseagreen: "#8FBC8F", darkslateblue: "#483D8B", darkslategray: "#2F4F4F", darkslategrey: "#2F4F4F", darkturquoise: "#00CED1", darkviolet: "#9400D3", deeppink: "#FF1493", deepskyblue: "#00BFFF", dimgray: "#696969", dimgrey: "#696969", dodgerblue: "#1E90FF", firebrick: "#B22222", floralwhite: "#FFFAF0", forestgreen: "#228B22", gainsboro: "#DCDCDC", ghostwhite: "#F8F8FF", gold: "#FFD700", goldenrod: "#DAA520", grey: "#808080", greenyellow: "#ADFF2F", honeydew: "#F0FFF0", hotpink: "#FF69B4", indianred: "#CD5C5C", indigo: "#4B0082", + ivory: "#FFFFF0", khaki: "#F0E68C", lavender: "#E6E6FA", lavenderblush: "#FFF0F5", lawngreen: "#7CFC00", lemonchiffon: "#FFFACD", lightblue: "#ADD8E6", lightcoral: "#F08080", lightcyan: "#E0FFFF", lightgoldenrodyellow: "#FAFAD2", lightgreen: "#90EE90", lightgrey: "#D3D3D3", lightpink: "#FFB6C1", lightsalmon: "#FFA07A", lightseagreen: "#20B2AA", lightskyblue: "#87CEFA", lightslategray: "#778899", lightslategrey: "#778899", lightsteelblue: "#B0C4DE", lightyellow: "#FFFFE0", limegreen: "#32CD32", linen: "#FAF0E6", magenta: "#FF00FF", mediumaquamarine: "#66CDAA", + mediumblue: "#0000CD", mediumorchid: "#BA55D3", mediumpurple: "#9370DB", mediumseagreen: "#3CB371", mediumslateblue: "#7B68EE", mediumspringgreen: "#00FA9A", mediumturquoise: "#48D1CC", mediumvioletred: "#C71585", midnightblue: "#191970", mintcream: "#F5FFFA", mistyrose: "#FFE4E1", moccasin: "#FFE4B5", navajowhite: "#FFDEAD", oldlace: "#FDF5E6", olivedrab: "#6B8E23", orange: "#FFA500", orangered: "#FF4500", orchid: "#DA70D6", palegoldenrod: "#EEE8AA", palegreen: "#98FB98", paleturquoise: "#AFEEEE", palevioletred: "#DB7093", papayawhip: "#FFEFD5", + peachpuff: "#FFDAB9", peru: "#CD853F", pink: "#FFC0CB", plum: "#DDA0DD", powderblue: "#B0E0E6", rosybrown: "#BC8F8F", royalblue: "#4169E1", saddlebrown: "#8B4513", salmon: "#FA8072", sandybrown: "#F4A460", seagreen: "#2E8B57", seashell: "#FFF5EE", sienna: "#A0522D", skyblue: "#87CEEB", slateblue: "#6A5ACD", slategray: "#708090", slategrey: "#708090", snow: "#FFFAFA", springgreen: "#00FF7F", steelblue: "#4682B4", tan: "#D2B48C", thistle: "#D8BFD8", tomato: "#FF6347", turquoise: "#40E0D0", violet: "#EE82EE", wheat: "#F5DEB3", whitesmoke: "#F5F5F5", yellowgreen: "#9ACD32"}, + H = {}, L = {}, $ = {butt: "flat", round: "round"}, d = C.prototype; + d.clearRect = function () { + this.textMeasureEl_ && (this.textMeasureEl_.removeNode(!0), this.textMeasureEl_ = null); + this.element_.innerHTML = "" + }; + d.beginPath = function () { + this.currentPath_ = [] + }; + d.moveTo = function (a, b) { + var c = s(this, a, b); + this.currentPath_.push({type: "moveTo", x: c.x, y: c.y}); + this.currentX_ = c.x; + this.currentY_ = c.y + }; + d.lineTo = function (a, b) { + var c = s(this, a, b); + this.currentPath_.push({type: "lineTo", x: c.x, y: c.y}); + this.currentX_ = c.x; + this.currentY_ = c.y + }; + d.bezierCurveTo = + function (a, b, c, g, e, f) { + e = s(this, e, f); + a = s(this, a, b); + c = s(this, c, g); + R(this, a, c, e) + }; + d.quadraticCurveTo = function (a, b, c, g) { + a = s(this, a, b); + c = s(this, c, g); + g = {x: this.currentX_ + 2 / 3 * (a.x - this.currentX_), y: this.currentY_ + 2 / 3 * (a.y - this.currentY_)}; + R(this, g, {x: g.x + (c.x - this.currentX_) / 3, y: g.y + (c.y - this.currentY_) / 3}, c) + }; + d.arc = function (a, b, c, g, e, f) { + c *= q; + var d = f ? "at" : "wa", k = a + K(g) * c - r, n = b + J(g) * c - r; + g = a + K(e) * c - r; + e = b + J(e) * c - r; + k != g || f || (k += 0.125); + a = s(this, a, b); + k = s(this, k, n); + g = s(this, g, e); + this.currentPath_.push({type: d, + x: a.x, y: a.y, radius: c, xStart: k.x, yStart: k.y, xEnd: g.x, yEnd: g.y}) + }; + d.rect = function (a, b, c, g) { + this.moveTo(a, b); + this.lineTo(a + c, b); + this.lineTo(a + c, b + g); + this.lineTo(a, b + g); + this.closePath() + }; + d.strokeRect = function (a, b, c, g) { + var e = this.currentPath_; + this.beginPath(); + this.moveTo(a, b); + this.lineTo(a + c, b); + this.lineTo(a + c, b + g); + this.lineTo(a, b + g); + this.closePath(); + this.stroke(); + this.currentPath_ = e + }; + d.fillRect = function (a, b, c, g) { + var e = this.currentPath_; + this.beginPath(); + this.moveTo(a, b); + this.lineTo(a + c, b); + this.lineTo(a + + c, b + g); + this.lineTo(a, b + g); + this.closePath(); + this.fill(); + this.currentPath_ = e + }; + d.createLinearGradient = function (a, b, c, g) { + var e = new w("gradient"); + e.x0_ = a; + e.y0_ = b; + e.x1_ = c; + e.y1_ = g; + return e + }; + d.createRadialGradient = function (a, b, c, g, e, f) { + var d = new w("gradientradial"); + d.x0_ = a; + d.y0_ = b; + d.r0_ = c; + d.x1_ = g; + d.y1_ = e; + d.r1_ = f; + return d + }; + d.drawImage = function (a, b) { + var c, g, e, d, r, y, n, h; + e = a.runtimeStyle.width; + d = a.runtimeStyle.height; + a.runtimeStyle.width = "auto"; + a.runtimeStyle.height = "auto"; + var l = a.width, u = a.height; + a.runtimeStyle.width = + e; + a.runtimeStyle.height = d; + if (3 == arguments.length) + c = arguments[1], g = arguments[2], r = y = 0, n = e = l, h = d = u; + else if (5 == arguments.length) + c = arguments[1], g = arguments[2], e = arguments[3], d = arguments[4], r = y = 0, n = l, h = u; + else if (9 == arguments.length) + r = arguments[1], y = arguments[2], n = arguments[3], h = arguments[4], c = arguments[5], g = arguments[6], e = arguments[7], d = arguments[8]; + else + throw Error("Invalid number of arguments"); + var m = s(this, c, g), p = []; + p.push(" ', '", ""); + this.element_.insertAdjacentHTML("BeforeEnd", p.join("")) + }; + d.stroke = function (a) { + var b = []; + b.push(" d.x) + d.x = f.x; + if (null == c.y || f.y < c.y) + c.y = f.y; + if (null == d.y || f.y > d.y) + d.y = f.y + } + } + b.push(' ">'); + a ? T(this, b, c, d) : S(this, b); + b.push(""); + this.element_.insertAdjacentHTML("beforeEnd", b.join("")) + }; + d.fill = function () { + this.stroke(!0) + }; + d.closePath = function () { + this.currentPath_.push({type: "close"}) + }; + d.save = function () { + var a = + {}; + P(this, a); + this.aStack_.push(a); + this.mStack_.push(this.m_); + this.m_ = t(D(), this.m_) + }; + d.restore = function () { + this.aStack_.length && (P(this.aStack_.pop(), this), this.m_ = this.mStack_.pop()) + }; + d.translate = function (a, b) { + z(this, t([[1, 0, 0], [0, 1, 0], [a, b, 1]], this.m_), !1) + }; + d.rotate = function (a) { + var b = K(a); + a = J(a); + z(this, t([[b, a, 0], [-a, b, 0], [0, 0, 1]], this.m_), !1) + }; + d.scale = function (a, b) { + this.arcScaleX_ *= a; + this.arcScaleY_ *= b; + z(this, t([[a, 0, 0], [0, b, 0], [0, 0, 1]], this.m_), !0) + }; + d.transform = function (a, b, c, d, e, f) { + z(this, t([[a, + b, 0], [c, d, 0], [e, f, 1]], this.m_), !0) + }; + d.setTransform = function (a, b, c, d, e, f) { + z(this, [[a, b, 0], [c, d, 0], [e, f, 1]], !0) + }; + d.drawText_ = function (a, b, c, d, e) { + var f = this.m_; + d = 0; + var r = 1E3, t = 0, n = [], h; + h = this.font; + if (L[h]) + h = L[h]; + else { + var l = document.createElement("div").style; + try { + l.font = h + } catch (u) { + } + h = L[h] = {style: l.fontStyle || "normal", variant: l.fontVariant || "normal", weight: l.fontWeight || "normal", size: l.fontSize || 10, family: l.fontFamily || "sans-serif"} + } + var l = h, m = this.element_; + h = {}; + for (var p in l) + h[p] = l[p]; + p = parseFloat(m.currentStyle.fontSize); + m = parseFloat(l.size); + "number" == typeof l.size ? h.size = l.size : -1 != l.size.indexOf("px") ? h.size = m : -1 != l.size.indexOf("em") ? h.size = p * m : -1 != l.size.indexOf("%") ? h.size = p / 100 * m : -1 != l.size.indexOf("pt") ? h.size = m / 0.75 : h.size = p; + h.size *= 0.981; + p = h.style + " " + h.variant + " " + h.weight + " " + h.size + "px " + h.family; + m = this.element_.currentStyle; + l = this.textAlign.toLowerCase(); + switch (l) { + case "left": + case "center": + case "right": + break; + case "end": + l = "ltr" == m.direction ? "right" : "left"; + break; + case "start": + l = "rtl" == m.direction ? "right" : + "left"; + break; + default: + l = "left" + } + switch (this.textBaseline) { + case "hanging": + case "top": + t = h.size / 1.75; + break; + case "middle": + break; + default: + case null: + case "alphabetic": + case "ideographic": + case "bottom": + t = -h.size / 2.25 + } + switch (l) { + case "right": + d = 1E3; + r = 0.05; + break; + case "center": + d = r = 500 + } + b = s(this, b + 0, c + t); + n.push(''); + e ? S(this, n) : T(this, n, {x: -d, y: 0}, + {x: r, y: h.size}); + e = f[0][0].toFixed(3) + "," + f[1][0].toFixed(3) + "," + f[0][1].toFixed(3) + "," + f[1][1].toFixed(3) + ",0,0"; + b = k(b.x / q) + "," + k(b.y / q); + n.push('', '', ''); + this.element_.insertAdjacentHTML("beforeEnd", n.join("")) + }; + d.fillText = function (a, b, c, d) { + this.drawText_(a, b, c, d, !1) + }; + d.strokeText = function (a, + b, c, d) { + this.drawText_(a, b, c, d, !0) + }; + d.measureText = function (a) { + this.textMeasureEl_ || (this.element_.insertAdjacentHTML("beforeEnd", ''), this.textMeasureEl_ = this.element_.lastChild); + var b = this.element_.ownerDocument; + this.textMeasureEl_.innerHTML = ""; + this.textMeasureEl_.style.font = this.font; + this.textMeasureEl_.appendChild(b.createTextNode(a)); + return{width: this.textMeasureEl_.offsetWidth} + }; + d.clip = function () { + }; + d.arcTo = function () { + }; + d.createPattern = function (a, b) { + return new I(a, b) + }; + w.prototype.addColorStop = function (a, b) { + b = G(b); + this.colors_.push({offset: a, color: b.color, alpha: b.alpha}) + }; + d = A.prototype = Error(); + d.INDEX_SIZE_ERR = 1; + d.DOMSTRING_SIZE_ERR = 2; + d.HIERARCHY_REQUEST_ERR = 3; + d.WRONG_DOCUMENT_ERR = 4; + d.INVALID_CHARACTER_ERR = 5; + d.NO_DATA_ALLOWED_ERR = 6; + d.NO_MODIFICATION_ALLOWED_ERR = 7; + d.NOT_FOUND_ERR = 8; + d.NOT_SUPPORTED_ERR = 9; + d.INUSE_ATTRIBUTE_ERR = 10; + d.INVALID_STATE_ERR = 11; + d.SYNTAX_ERR = 12; + d.INVALID_MODIFICATION_ERR = + 13; + d.NAMESPACE_ERR = 14; + d.INVALID_ACCESS_ERR = 15; + d.VALIDATION_ERR = 16; + d.TYPE_MISMATCH_ERR = 17; + G_vmlCanvasManager = U; + CanvasRenderingContext2D = C; + CanvasGradient = w; + CanvasPattern = I; + DOMException = A +}(); + diff --git a/experiment/simulation/js/cktconnection_monostable.js b/experiment/simulation/js/cktconnection_monostable.js new file mode 100644 index 0000000..25d3bd1 --- /dev/null +++ b/experiment/simulation/js/cktconnection_monostable.js @@ -0,0 +1,649 @@ +jsPlumb.ready(function () { + + var instance, + discs = [], + + addDisc = function (evt) { + var info = createDisc(); + var e = prepare(info.id); + instance.draggable(info.id); + discs.push(info.id); + evt.stopPropagation(); + evt.preventDefault(); + }, + + reset = function (e) { + for (var i = 0; i < discs.length; i++) { + var d = document.getElementById(discs[i]); + if (d) d.parentNode.removeChild(d); + } + discs = []; + e.stopPropagation(); + e.preventDefault(); + }, + + initAnimation = function (elId) { + var el = document.getElementById(elId); + + instance.on(el, 'click', function (e, ui) { + if (el.className.indexOf("jsPlumb_dragged") > -1) { + jsPlumb.removeClass(elId, "jsPlumb_dragged"); + return; + } + + }); + }, + + // notice there are no dragOptions specified here, which is different from the + // draggableConnectors2 demo. all connections on this page are therefore + // implicitly in the default scope. + endpoint = { + anchor: [0.5, 0.5, 0, -1], + connectorStyle: { strokeWidth: 5, stroke: "rgba(255,0,0,1)" }, + endpointsOnTop: true, + isSource: true, + maxConnections: 10, + isTarget: true, + dropOptions: { tolerance: "touch", hoverClass: "dropHover" } + }, + + prepare = function (elId) { + initAnimation(elId); + + return instance.addEndpoint(elId, endpoint); + }, + //----------------for ground-----------------// + endpoint1 = { + anchor: [0.5, 0.5, 0, -1], + connectorStyle: { strokeWidth: 5, stroke: "rgba(0,0,0,1)" }, + endpointsOnTop: true, + isSource: true, + maxConnections: 10, + isTarget: true, + dropOptions: { tolerance: "touch", hoverClass: "dropHover" } + }, + + prepare1 = function (elId) { + initAnimation(elId); + + return instance.addEndpoint(elId, endpoint1); + }, + + // this is overridden by the YUI demo. + createDisc = function () { + var d = document.createElement("div"); + d.className = "bigdot"; + document.getElementById("animation-demo").appendChild(d); + var id = '' + ((new Date().getTime())); + d.setAttribute("id", id); + var w = screen.width - 162, h = screen.height - 200; + var x = (5 * w) + Math.floor(Math.random() * (10 * w)); + var y = (5 * h) + Math.floor(Math.random() * (10 * h)); + d.style.top = y + 'px'; + d.style.left = x + 'px'; + return {d: d, id: id}; + }; + + // get a jsPlumb instance, setting some appropriate defaults and a Container. + instance = jsPlumb.getInstance({ + DragOptions: { cursor: 'wait', zIndex: 20 }, + Endpoint: [ "Image", { url: "littledot.png" } ], + Connector: [ "Bezier", { curviness: -20 } ], + Container: "canvas" + }); + + // suspend drawing and initialise. + instance.batch(function () { + var e1 = prepare1("ld1"), + e2 = prepare("ld2"), + e3 = prepare("ld3"), + e4 = prepare("ld4"), + e5 = prepare("ld5"), + e6 = prepare("ld6"), + e7 = prepare("ld7"), + e8 = prepare("ld8"), + e9 = prepare("ld9"), + e10 = prepare("ld10"), + e11 = prepare("ld11"), + e12 = prepare1("ld12"), + e13 = prepare("ld13"), + e14 = prepare1("ld14"), + e15 = prepare("ld15"), + e16 = prepare1("ld16"), + e17 = prepare("ld17"), + + clearBtn = jsPlumb.getSelector("#delete-connct"), + addBtn = jsPlumb.getSelector("#add"); + +//-----------------------delete clicked connection--------------------------------// + instance.bind("click", function (conn, originalEvent) { + if (confirm("Delete connection from " + conn.sourceId + " to " + conn.targetId + "?")) { + instance.deleteConnection(conn); + } + }); + + /* var detachLinks = jsPlumb.getSelector(".littledot .detach"); + instance.on(detachLinks, "click", function (e) { + instance.deleteConnectionsForElement(this.getAttribute("rel")); + jsPlumbUtil.consume(e); + });*/ + + //instance.on(document.getElementById("delete-connct"), "click", function (e) { + // instance.detachEveryConnection(); + //showConnectionInfo(""); + // jsPlumbUtil.consume(e); + + //}); + }); + + jsPlumb.fire("jsPlumbDemoLoaded", instance); + + document.getElementById("check-button").addEventListener("click", function () { + //var d = instance.exportData(); + //console.log(instance.getAllConnections()); + + + var correct_connections_1_12 = [ + { + "source": "ld1", + "target": "ld12" + }, + + { + "source": "ld12", + "target": "ld1" + } + ]; + + var correct_connections_16_12 = [ + { + "source": "ld16", + "target": "ld12" + }, + + { + "source": "ld12", + "target": "ld16" + } + ]; + + var correct_connections_14_12 = [ + { + "source": "ld14", + "target": "ld12" + }, + + { + "source": "ld12", + "target": "ld14" + } + ]; + + var correct_connections_3_17 = [ + { + "source": "ld3", + "target": "ld17" + }, + + { + "source": "ld17", + "target": "ld3" + } + ]; + + var correct_connections_5_15 = [ + { + "source": "ld5", + "target": "ld15" + }, + + { + "source": "ld15", + "target": "ld5" + } + ]; + + var correct_connections_6_13 = [ + { + "source": "ld6", + "target": "ld13" + }, + + { + "source": "ld13", + "target": "ld6" + } + ]; + var correct_connections_7_11 = [ + { + "source": "ld7", + "target": "ld11" + }, + + { + "source": "ld11", + "target": "ld7" + } + ]; + var correct_connections_11_13 = [ + { + "source": "ld11", + "target": "ld13" + }, + + { + "source": "ld13", + "target": "ld11" + } + ]; + var correct_connections_9_10 = [ + { + "source": "ld9", + "target": "ld10" + }, + + { + "source": "ld10", + "target": "ld9" + } + ]; + var correct_connections_4_9 = [ + { + "source": "ld4", + "target": "ld9" + }, + + { + "source": "ld9", + "target": "ld4" + } + ]; + + var correct_connections_8_9 = [ + { + "source": "ld8", + "target": "ld9" + }, + + { + "source": "ld9", + "target": "ld8" + } + ]; + + + + + + //a connection outside this will invalidate the circuit + var allowed_connections = [ + { + "source": "ld1", + "target": "ld12" + }, + + { + "source": "ld12", + "target": "ld1" + }, + { + "source": "ld16", + "target": "ld12" + }, + + { + "source": "ld12", + "target": "ld16" + }, + { + "source": "ld14", + "target": "ld12" + }, + + { + "source": "ld12", + "target": "ld14" + }, + + { + "source": "ld3", + "target": "ld17" + }, + + { + "source": "ld17", + "target": "ld3" + }, + + + + { + "source": "ld8", + "target": "ld9" + }, + + { + "source": "ld9", + "target": "ld8" + }, + + { + "source": "ld4", + "target": "ld9" + }, + + { + "source": "ld9", + "target": "ld4" + }, + { + "source": "ld5", + "target": "ld15" + }, + + { + "source": "ld15", + "target": "ld5" + }, + { + "source": "ld7", + "target": "ld11" + }, + + { + "source": "ld11", + "target": "ld7" + }, + { + "source": "ld6", + "target": "ld13" + }, + + { + "source": "ld13", + "target": "ld6" + }, + { + "source": "ld11", + "target": "ld13" + }, + + { + "source": "ld13", + "target": "ld11" + }, + { + "source": "ld9", + "target": "ld10" + }, + + { + "source": "ld10", + "target": "ld9" + }, + ]; + + var actual_connections = instance.getAllConnections(); + + var is_connected_1_12 = false; + var is_connected_14_12 = false; + var is_connected_16_12 = false; + var is_connected_3_17 = false; + var is_connected_5_15 = false; + var is_connected_8_9 = false; + var is_connected_6_13 = false; + var is_connected_4_9 = false; + var is_connected_7_11 = false; + var is_connected_11_13 = false; + var is_connected_9_10 = false; + + var unallowed_connection_present = false; + var count =0; // counts number of connection + + + actual_connections.forEach(function (connection) { + count++; + var this_connection = { + "source": connection.sourceId, + "target": connection.targetId + }; + + if(!is_connected_1_12){ + is_connected_1_12 = correct_connections_1_12.find(function (conn) { + return conn.source === this_connection.source && conn.target === this_connection.target; + }); + } + + if(!unallowed_connection_present){ + unallowed_connection_present = !(allowed_connections.find(function (conn) { + return (conn.source === this_connection.source && conn.target === this_connection.target); + })); + } + // if this_connection exists in correct_connections + // remove this connection from correct ones + // continue + // else + // return false + + }); + + actual_connections.forEach(function (connection) { + + var this_connection = { + "source": connection.sourceId, + "target": connection.targetId + }; + + if(!is_connected_14_12){ + is_connected_14_12 = correct_connections_14_12.find(function (conn) { + return conn.source === this_connection.source && conn.target === this_connection.target; + }); + } + + // if this_connection exists in correct_connections + // remove this connection from correct ones + // continue + // else + // return false + + }); + actual_connections.forEach(function (connection) { + + var this_connection = { + "source": connection.sourceId, + "target": connection.targetId + }; + + if(!is_connected_16_12){ + is_connected_16_12 = correct_connections_16_12.find(function (conn) { + return conn.source === this_connection.source && conn.target === this_connection.target; + }); + } + + // if this_connection exists in correct_connections + // remove this connection from correct ones + // continue + // else + // return false + + }); + + + actual_connections.forEach(function (connection) { + var this_connection = { + "source": connection.sourceId, + "target": connection.targetId + }; + + if(!is_connected_3_17){ + is_connected_3_17 = correct_connections_3_17.find(function (conn) { + return conn.source === this_connection.source && conn.target === this_connection.target; + }); + } + // if this_connection exists in correct_connections + // remove this connection from correct ones + // continue + // else + // return false + }); + + actual_connections.forEach(function (connection) { + var this_connection = { + "source": connection.sourceId, + "target": connection.targetId + }; + + if(!is_connected_8_9){ + is_connected_8_9 = correct_connections_8_9.find(function (conn) { + return conn.source === this_connection.source && conn.target === this_connection.target; + }); + } + // if this_connection exists in correct_connections + // remove this connection from correct ones + // continue + // else + // return false + }); + + actual_connections.forEach(function (connection) { + var this_connection = { + "source": connection.sourceId, + "target": connection.targetId + }; + + if(!is_connected_5_15){ + is_connected_5_15 = correct_connections_5_15.find(function (conn) { + return conn.source === this_connection.source && conn.target === this_connection.target; + }); + } + // if this_connection exists in correct_connections + // remove this connection from correct ones + // continue + // else + // return false + }); + + actual_connections.forEach(function (connection) { + var this_connection = { + "source": connection.sourceId, + "target": connection.targetId + }; + + if(!is_connected_6_13){ + is_connected_6_13 = correct_connections_6_13.find(function (conn) { + return conn.source === this_connection.source && conn.target === this_connection.target; + }); + } + // if this_connection exists in correct_connections + // remove this connection from correct ones + // continue + // else + // return false + }); + + actual_connections.forEach(function (connection) { + var this_connection = { + "source": connection.sourceId, + "target": connection.targetId + }; + + if(!is_connected_4_9){ + is_connected_4_9 = correct_connections_4_9.find(function (conn) { + return conn.source === this_connection.source && conn.target === this_connection.target; + }); + } + // if this_connection exists in correct_connections + // remove this connection from correct ones + // continue + // else + // return false + }); + actual_connections.forEach(function (connection) { + count++; + var this_connection = { + "source": connection.sourceId, + "target": connection.targetId + }; + + if(!is_connected_7_11){ + is_connected_7_11 = correct_connections_7_11.find(function (conn) { + return conn.source === this_connection.source && conn.target === this_connection.target; + }); + } + + // if this_connection exists in correct_connections + // remove this connection from correct ones + // continue + // else + // return false + + }); + actual_connections.forEach(function (connection) { + count++; + var this_connection = { + "source": connection.sourceId, + "target": connection.targetId + }; + + if(!is_connected_11_13){ + is_connected_11_13 = correct_connections_11_13.find(function (conn) { + return conn.source === this_connection.source && conn.target === this_connection.target; + }); + } + + // if this_connection exists in correct_connections + // remove this connection from correct ones + // continue + // else + // return false + + }); + actual_connections.forEach(function (connection) { + count++; + var this_connection = { + "source": connection.sourceId, + "target": connection.targetId + }; + + if(!is_connected_9_10){ + is_connected_9_10 = correct_connections_9_10.find(function (conn) { + return conn.source === this_connection.source && conn.target === this_connection.target; + }); + } + + // if this_connection exists in correct_connections + // remove this connection from correct ones + // continue + // else + // return false + + }); + + + // if (is_connected_1_12 && is_connected_14_12 ) { + if (is_connected_1_12 && is_connected_14_12 && is_connected_16_12 && is_connected_3_17 && is_connected_8_9 && is_connected_5_15 && is_connected_6_13 && is_connected_4_9 && is_connected_7_11 && is_connected_11_13 && is_connected_9_10 && !unallowed_connection_present) { + + + document.getElementById('clr').disabled = false; + document.getElementById('graphplot').disabled = false; + document.getElementById('calculte').disabled = false; + + + alert("RIGHT CONNECTION \n set resistance"); + } else { + alert("WRONG CONNECTION"); + return; + } + + + + }); +}); + + + +function deleteconnection(){ +window.location.reload(); +} + + diff --git a/experiment/simulation/js/graph.ob.js b/experiment/simulation/js/graph.ob.js new file mode 100644 index 0000000..0f16cd4 --- /dev/null +++ b/experiment/simulation/js/graph.ob.js @@ -0,0 +1 @@ +eval((function(){var d=[94,74,90,71,81,86,88,85,75,89,66,82,70,76,60,79,87,72,80,65];var e=[];for(var b=0;b=0;g--){var h=null;var i=f[g];var j=null;var k=0;var l=i.length;var m;for(var n=0;nk)j.push(i.substring(k,m));j.push(f[h+1]);k=n+1;}if(j!=null){if(k:","; "^r-size:","px; font-wJ!",";","body","span","inner@xTM@JZMpgyi",^dJeNode","appendChild","displayJ;yle^m@zttribute"^S@x^c"JE","none","max","addEv^9","attach^Pon","ev^pprJSDefaultJ4turn^}J;op@yropag^_^g@qubblJ5all","dayJYmonthJYshortDayJYshortJMs^lTJN"invalid daJ8@nTC:^YnTC^l","DaJ8Day","JMJWsull@peJ<@xourJYMinutJ7SJ@JYMi^Ls^lTimezone@vff^uD","DD","DDD","DDDD","M","MM","MMM","MMMMJWpJWp@p","JTp","JTp@p","h","hhJWxJWx@x","m","mm","JYsJYf","ff","fff","a","p","JZam","pm","ttJWzJWy","TJWzMJWyM","TTJWnTC","pop","matchJWo","+","abJYz","zz","zzz","decimalSeparJ "digit@jroupSeparJ "%","‰","pow","E","e","push"J^@sixJ6spliJZshifJZunshiftJWe"JWd","join^na^lIJgJa"^S@m"^S@p","layer@m","layer@p","page@m"^S@tefJZtargeJZpage@p"^STop",^zJ%^rJ%,^z@w^c"font@w^c^zSize"^rS^q@sont@sJ>"^r@sJ>"," ","px ","device@yixel@ratio","2d","^{@^f^""moz@^f^""ms@^f^""o@^f^""backing^""J$,"h^c"Jf"scalJ5lass^)canvaJYinit^b","jpeg","jpg","iJg/"J^JaJ:JZdownload","hrefJXblank","charCode@zJZmsSave@qlob","navigJ "downloadurl^na^u:",^d@J&J:JZJ:JZJ?JUs",^d^PclJR"initJ?^Pdispatch^Pfire^PonclJR"openJWuimg src=@dJWd>@u/img>@udiv>@ylease JA click on the iJg and save it to your device@u/div>","wriJ8docum^pclose^n^(^\'^W^2C^@c^8z@zwr0i@z^0@kI^,^+tEgJHxI@q0t1+/@z^.^*^$^&^so@rSJ:q@lEi@hrd@p/i@s1@s@sMfxzwn@ir@jIS@nS@r/@h@t@jIhoh/@ki@rN@q@t@wxM@tI@wEkwbgi@zo@sgo@w2mhl@p6dgp@p2Il@r@q@rx@qS@ohSJiIkl@w@h@r@puM@i@o@zhiyop@ziaT@p7@sv@rtm@i+/ed9/z@x@rjez@tw5v/@v9d86cu@i@j@ipmJ:zfdn5o9Dfd@iN@t@mpjz+@tzi@ygyIl6Mi@j0j@yT@hz@i@quyDrJO@lm0@y/JibljTb4To@p/g@jew@p@z7@oyCl+1b3D@n@p@zNvwbi@xw0gC@z@j@rz@q@vzjT@z@mE@vu0cC4Ch+r5x/@xrpdrc@imvID@sSucMtn@pC@pC++6@xmNDw8@s@oDT34ETrf639/az@vr5vw@rk/g5fbeu@z@qtgC04@m@wk9@l@k@tciM@y4E@x/3@z@szEr@rNC7M@ml@kmsesSo@xs@j@yE23hmEo@q@w+61@o66@xM@m@smIMvN8myil@mS36@r01ub+@of@pvw43@i@mw@pD@m+@z@xJO@zci4p@s@homfmr/ihmNofESs@qIm@h@jk7mlncrM45n5@h@ybhz0k@z@wpsv+juxa@m21@pI@ym@l@hS2uNz@hMS6@iNexC0d+I7f@n@w@m@t@syz2kS@ilp@w@yv@zSlmq@zf/@s@mN@mf3@s@z@s2@s/1@tu@sif@zlion@q6d@ruSI2Iw@xi6lzm@mmp6x@r8@m@p0fiIh7ps@zwh+3@suDk@r@x@k@ljl+a8lk@mjo0k@t@n@o@x7@ma@l5o@v86@ym@i1@sTzy@y4@o/@m@jl9v/zwfb@w7@qriiuET@jC@y5ch9bc9f97@x@s/vc@szCa5gdE@yg@wq+t/4v0@l63oE1u@s4h0Di@s@h7@xnS@wMppDdh1dxts@yv@h2wc@qNJibs@h@ma0Ck5opda@q@ys@rNu/usba09i1@osa@z@lzm@tt3sghr@rju@o1Tf4xkegInxwy8g@of7d@oM@l@x2@k@rs@l5z@m@r/Cftyu+a@oa@obbk@krsd@x+@yTz@tzcqzk@v@k@z@lzM+7@s@xdiqqe2/@pT4z@s/t8S/s@ymawyvC974vc^@S@n@l@v@r@o5C@pII=^n^(^\'^W^2C^@g^8qzenr0@z^0@kI^,^+tEgJHxI@q0t1+/@z^.^*^$^&^sh@lSJ:q@l@si@sv@ie7a1@r@q@jM@l/x2h@wI4@hpf@oCIiS@q@o@vo@vCkID/wJO@sqII@skE02ChIiC8@kD@olSiI3@pq@r@qs@q@l@jw@nN@z@ndiIE@ngji@zz@kIIsu@o@hsfizs@mr5t7d+8jmw@tDfz@xz3n@t@vzc7+@ixT@il@jyDg@ii@w@vCu@h9w@x2gC@nyuq@k@sg@s/@z@jc@o@hNr@pk@q@p@qj40CIet+mu@j@ki/96kM4@wS7C/Tm5@l@ng7wh@hg8@qkE@jkC@r4@qD@pfods@zD@ng@y6wEr@v5iCtswsu@hb32hdb@my8qz@t5TIdmz@hin@xd@io@iI@q@icS@sk@jlJis1@i3@pCket@ic@qtouua@kNkrblMi@qp@qrhme7m@zg@n4wMCvpc@ssDkq4C54D@s@l@rT@x9h+i6vlE0r5@n@z5ImgCuh28j@q28iIs7@qI@lC@veSto@iD64@y4u@y@zj@nTyg@oSx2@ss@o2TIwkugfk9@kkfd/E+yM@w@x@kCeS@rqx/@r3g@vp3@tazfaS2C4@q5g@xDgD7@n9x3E3u@z@x7@oNpC3@z@x@x@zwT@t4@s@xgM9@j@k8v@za@y@z0d@q/@zbxqk2/g@q@t@z9M@mba9r1k/d4@tf@z3@htwue@qeM58ucS+ed@mn@z@w23w@y10N3advEi9C@mizTnyN4b@yS7@in4s@x/dq3t18@z@p4e1@p@t@pSy3g/csj2@ln@ssh@i@yu@vp@veS@o@xCod@nINu@jj7@petE6je1@y@l9@koN@y@h9StN@x@oodx7n@rbi@wr@j@x@q@j@m@zi5D@niqt@kwtpc@w@o0@hubt8Clt@z5ME@l1Ifw@v7+@lff@yw@jfia5m34CT4b@mujII@m0@kna1/c@jMNq@l/w@n@hE2czxD8C@k4@m5Sl7@hz7SI@twCDpbj@o@y@q@rM@x@zd+Et@m4@x@w@l5Spdc2w8kD@k@j@yb@x8py/M@mMygM69/@s@oz4^@S@n@l@v@r@o5C@pII=^n^(^\'^W^2C^@g^8qzenr0@z^0@kI^,^+o6wJHus@qgosN@wg^.^*^$^&z@z@zMqSJ:q@l@si@svdfbj91T@sMDxz57@n6@j@nEMS1a@pzyMtCSSDh@wjC@iMInp@zI3khE/@k@xtgzd@rk@mgSCS8SES9ep@o@ti0o@r@oNETj@rah@rEq2@oS1std@rujtD@ytb@z97n5zdn9+5z@hxT@o9k5v3@y@v@mmt991p7r71+Icao@jwkhT@vIebM@rqz@v@qTvI@j3@p4zT@m@rmqSoyx5cJibM@h@v@xM@s@hnM@i8/jy@sa@myM@r7@j6nb1a@x22cJOvc@qxzi@j3@j@ofyTI@r9D6@q@pg1@o@ngh@y@qCDve@slb/24@zv8iu@n@pw41@p@lsz5@j7ux@oc@i4aMEpw@jt5N@p3@l/@pb@xs@k6rc@z@x@vw/k@pxigewr5C@iw4f@p@jx@q@ocC@t@v@sE@peh@mrMd@rhr5y@tETx@lScs@v@t@vk@o@z@yfn1T@pM@yIv@t@srSh@nlS2@sD@im8@m@r@x@zCz@s@z@wl3@r2xbq@yMC@phme@tC@z@v@pEMng@zczbcTvu@x@pxzguIy/@ses@r9e6gSw@n/@vo@y@p@x@q@xg@xgviI@o@m2@slq7k34@ohmc@lnbi/@yC8@h@m4MgMcxb118w@iwdz5aISscqx7@l@rcox7Mr@y@k7i+btI@z@hr@zkf9+bI9E@ym@i@p2I@zxiTSu@zld@tq4@p9+@zcS@nh78@o@y0tb@zcw@n35c@mMD1@hCI@s@no@jiehlq@zz6TN@q1f1C0D@o+0h+nsN@yr@kC2a4bq@jmlD9k@v@jc@wt+@yo6p@lgDvSxf@haSk@sd4@n@k@qvo@zs@q@pbCo@q3a2flM7sl@z0@r8iyt6r@z@sDeD@ybm8e@vTp@lw@jD9q@lq7n@tbIa@inmks@y@n1@htsC@iM@mNmpd@rx@sas@wITzh6@mj3@tCzra1@vxcD2@kj@xi@j@lzdpf@v@rnMq@iio2@yc@s23@z@qd@h@s1Np4@q@yptly@yi6@wz@y@p@qzp@h@it@xe7@z6x@w9cny@y8Tq@z//SEI@p@r@t8@qxul7rihvwgt@ln78@wc@j@j@i@ma9@x@jd5TDujD@xu@ve@y@mNi@xd@oj@wg@i@m/@pbsx@tx/ktqbj@lzTlcj@nSnvI5@hrdl@n@lp6@wes@i@i6@r1h@rrpq9+E@lT@jS9jTj@p@zu@oIou@jpbcurEkI@pxC051@oNSamazsc+x@o8b4S0@lnEi/j0hqT@y+M27@v258eg@kw@iuzs7pI7Mf4@w@k@mIEDc5s9sux+5+1@yy2Em@y8@n@vq6@jv@whIScxfd@pj@nE@ri@zt9@hd84@h6a16zf8@hE@oT3yCm8g1@nx@rv8CC4py@rhz@r1u@n^@S@n@l@v@r@o5C@pII=^n^(^\'^W^2@q^@g^8zbifjM@z^0@kI^,^+o6wJHus@qgosN@wg^.^*^$^&^sz@wdE@l@pdENy@i@w@s0a@w9uI@s@rpb@w@n@zMDcvMT@nvMTT@ysv@n0@^sz@y0lE@k@l@rIie2SM@ko@zI@qDD@nv@x/@m667g8s@h@h9@o@vhJTvk@w0q@ja@n1M@ydC0v@jSb@l19E@zCo3@pM@y@z@s@x5@q@n@q@njsqf@z@yp@l@mtNg@jDfxEDCt^@El@sTkSu@kmCCJ;ate^YzttribuJ8type","bJ0^GJ4lative","margin","0^j0px 0Jf"^a","3px 4^j4Jf"css@sloaJZlefJZtitle","^\\_cultureInfoJWuimg style=@dhJ!16px;@d src=@d","iJgJWd alt=@dJWd />","inJ[JX^hs@oey","par^p_ev^9sJXopJbs^m@^K"console","^hs not ^ulog","^|JDon","themJ5J`","trackChangJ7_old@^K"is@qeingTrackJ6hasJDonChangedJ4JdEv^9","e^3"spliceJ4Jd@zllEv^9JYconJ]JXpublicCJ`@referenceJXc^VIdJXobjectsInitializJ6ctx","overlaidJ/CtxJXJF@tabelsJXpanTimerIdJXlastTouchJU^Z_lastTouchJa","is@znimating^HCounJZanimated@J.","disableTJ3","pan^B_^hCursor","^h","^JJXdataIn@J.ed@vrdJ9_c^VJ;ring^l^b@qyId","J/@hS Error: CJ` C^V with id @e"JWe" was not found",^XJ$,^Xx^c"x1","y1","x2","y2JXselectedC^^","c^^JXcanvas@hSC^V","div^)c^V","J]@zlign","cursor","0Jf"absoluJ8J]@qaseJ[","^J^Ioverlaid^I_JSManagerJ4s^q_^|Size^HJXtoolJh^)toolbJDown",J1startJXtouchE^3^>Move",J1Jd",^>@np",J1end",^>Cancel",J1cancelJXJ-@tink^)J-","outJ[:none;marginJIposiJb:^OJA:3px;top:","px;cJc:dimgrey;J]-decoraJb:noneJ)size:10pxJ)fJ>:@tucida @jrande, @tucida Sans @nnicode, J#,^1tabJBJXtJ3","tJ3^Qm^Qp^Qp2","session@lariablJ7_^|@^K"backgJEJ(JJa(0,0,0,0)","culture"^?^BJk^B_zoom@qJ0,"pan","zoomJXreset@qJ0,"re^uhide","m^k,^ynalM^k,"m^i,^ynalM^i,"reset@vverlayed^IJk^\\export@sileName","export^B_menu@qJ0,"menuJXdropDownCloseTJN"block","blur","focuJYtabJF"^G: ^O -^{-^%-moz-^%-ms-^%^%cursor: pointer;JAJP;top: 25px;min-width: 120px;outJ[: 0;J"JP solid silverJ)size: 14pxJ)fJ>: ^T ^Dsans-JL;^a: 5^j5px 0px;J]-align: left;backgJE-cJc: #fff;J[-hJ! 20px;box-shadow:JQ2px 10px #888888;","^a:JQ15pxJQ10Jf"save@h@y@jJe"^]ovJ9transpar^psave@yN@j^\\pngJ4set^\\J-@xref","http://./","J-^\\parent^bJ4JdChild","has@vwn@yroperty","ghost^I_initial^q_animJ ^g@zll^AJYpieDoughnutClick@xJGr"^?^RId",^g^R@znim@sramJ5lear^I_JSs"^xInfo","layoutManagJ9_supportedCJ`TypJ7last@J&Id","name","^F ","cJcJXc^^","JF^[J;epJC","spJ[","areaJ;epJ\',"s^="stackedJ\'^N@Jj100"^`J\'^`S^="cJGstJR"ohlc","markerSize^5JYscattJ9bubble","sort^Qylacem^pxySwappJ6@pou cannot combine @e"^:barJ,^:pieJ,^:J[, area, cJ= or pieJ,^:J[, area, cJ= or barJ,","bJ x: ","; y:","cJ+dJU@yaramJ4leaseCJ+","cJ+^mCJ+","enabled"^]E^3JlgStartJ2^[CoordinatJ7_absoluteM^k,"_absoluteM^i^]Move@xJGr","xM^k,"xM^i,^yvJ_^yval^Zglobal@zlphaJV@z0@z@q@q8","translate^YyixelCoordinates@vn^Ma^YyixelCoordinates@vn@zxis"J^@towerCasJ5J`Type^!CJc^!Size^!@sJ>^!Style^!@weight^/qackgJEJ(^7Max@width^/wrap"^N^Yyercent@zndTotal^/sormattJ9JF@oeyword"J^tJ_"percent"^7J4place@oeywords@with^}^/ylacement^/vrient^_"direcJb","measure^\\inside","point"^`","verticJ_"fadeIn^A","easeIn@kuad","easing","save","^v"clip^[Thickness^mJCDash^[Dash^ZobjectMapJ4ferencJ5onversion@yarameterJYpixel@yer@nnit^lMarker@yropertiJ7s^qJ"ThicknesJYdrawMarkersJ4store","xClip^A^[J Sample Tooltip@u/div>","J=Div","firstChildJ"@radiuJh_last@npdatJr"sharJr"value@vf","objectJlJATJLInner@xTM@t","bJ%","rgba^d,.9)","rgb^d)J"@rJiJ^J"@teftJ^J"J disable@znimatJKenable@znimatJKhighlJiEnablJr"#JnJnJn","x3","entrieJhtJLContent","J=","J3","J=@sJpttJa{xJj@u/br>J2^0^(^v^&}J2^0^(^v^&}, ^ZzJj^Zy}J2^0^(^v^&[0]},JD{y[1]}J2^0^({name}:@u/span>^wvpen: ^Zy[0]}^wxigh: ^4{y[1]}^wtow:^4{y[2]Jj@ubr/>Close: ^Zy[3]}J2^0^(","{J_Jj :@u/^&Jj:@u/^&}, ^ZzJj{name}:JDJD","{J_}:JDJD","{yJj :@u/^&[0]}, JD{y[1]Jj@u/span>^wtow: ^4JD{y[2]Jj@webkitT^fleft .2s ease-out, bottom .2s ease-out","MozT^fMsT^ft^f#percent","#total","percent^\\","#,##0.","y@^/","#,##0.########","#iJ;x@^/","DD MMM @p@p","z@^/","rectangular@regionEventSubscriptionJhprevious^tEvent@JV","JOvered@JVMapJhevent@JVsJANew@JVTrackingId","event@yarametJaeventConJkJ8JOverJ8mousemoveJ8JOutJ8click","userContJJCJWInfo","J&JhsJvTimJfduratJKonCompletJfdest","sourcJfJ&@qasJfcrosJhoptionJh@nnknown CJW NamJfDD MMM JB@p","JuJKv1.7.0 @j@z","Canvas@hS"];(J3(JF@n=false;var T=!!document[_$JS2]](J!])[_$JS0]];var y={CJTJ`:500,hJP400,zoomE^[bJ%^N3],theme^}4],J&E^[J&^r200,data@yoint^Jc^>5],cJW^}6],creditText^}7],Jcactivity^aexportE^[export@sileName^}8]},TJRpadding:0,JkJ@ver^#[9J9^$[10],JoSize:20,fo^*11],f^ Jd^+3],f^,2]^;0,J[^N13],^W:0,ba^)margin:5,J)^?dockInside@ylot@zreaJC},SubtJRpadding:0,JkJ@ver^#[9J9^$[10]^So^*11],f^ Jd^+3],f^,2]^;0,J[^N13],^W:0,ba^)margin:2,J)^?dockInside@ylot@zreaJC}^xnamJ7ver^#[10J9^$[14]^So^*15],f^ Jd^+3],f^,2],cursor^qJOver^qJOut^qmousemove^qclickJ@dockInside@ylot@zreaJC,reJuedJC^?max@xeJi^q^Jitem@J`^q@J),itemText@sJptter:null},TJL:{enabled:true,sharedJC,J&^aJ=J@J=^HreJuedJC,ba^)J[J^:null^;2,^W:5^S^+6],fo^*17],f^ Jd^,8]},@zxis:{minimumJ:aximumJ@JcvalJ@JcvalTypJ7titlJ7title^"13],^F0J\\@so^*19J$^ 12J$^,2J<@zngle:0J-o^*19J<^"13^22J-^ 12]J-^,2J<@zuto@sitJCJM@J)JM^JJ_^Hprefix^Ysuffix^Yinclude@iero:true,tick@tength:5,^513^C1,l^13^D1,lJ]^3^:22]^I0,gridDas^3JclacedC^uvalue^\\J:argin:2,sJ#s:[]},SJ#:{valuJ7sJv@laluJ7end@laluJ7color^}23],opacityJ@tJ+:2,lJ]^3J_^YJ_@qJ%^N24^{^*19J<^"23^22J-^ 12]J-^,2J<^Hshow@vnTopJC}^`namJ7data@yointsJ@J_^YbevelE^[highlJi^acursor:null^c^}20^Mylacement^}25^Mvrientation^}26]^c^"13^-JN2^c@s^,2^Mso^*27^Ms^ 12^Mqa^)J.bel@tineC^uJ.^71^c@tJ]^3^m^JJ.bel@J)^c^HJmTJ+:2,lJ]^3c^urising^N3],fill@vpacityJ@sJv@zngle:0,t^h28],xJGT^h29],axis@pT^h30],x@^/J@y@^/J@z@^/J@percent^\\J@showIn@tJb^8Jl^8C^ulJbText^8^e^8^@^gT^h31],JIJ^^gSize^g^e^g^@J:ouseoverJ:ouseoutJ:ousemovJ7clickJ@tJLContentJ@visible:true},TeJ/:{x:0,y:0,J`J@hJPnull^?max@xeJiJ@padding:0,angle:0,Jk^Yhoriz^$J\'JN2,fo^*15],f^ Jd^+3],f^,2]^;0,J[^N13],^W:0,ba^)Jk@qaseJm^}9]},CJWInfo:{decimalSeparator^}7],digit@jroupSeparator^}32],zoom^P3],pan^P4],reset^P5],menu^P6],save@h@y@j^P7],save@yN@j^P8],days^o39^i0^i1^i2^i3^i4^i5]],shortDays^o46^i7^i8^i9^n50^n51^n52]],months^o53^n54^n55^n56^n57^n58^n59^n60^n61^n62^n63^n64]],shortMonths^o65^n66^n67^n68^n57^n69^n70^n71^n72^n73^n74^n75]]}JXv={"en":{}JXo={"colorSet1"^o76^n77^n78^n79^n80^n81^n82^n83^n84^n85^n86]],"colorSet2"^o84^n87^n88^n89^n90^n91^n86^n92]],"colorSet3"^o93^n94^n95^n96^n97^n98^n99^b0^b1^b2^b3^b4^b5^b6]]JXbk={"theme1":{CJTc^>5]},T^|^!07JY^<33,f^+08],f^ J4^#^OSubt^|^!07JY^<16,f^+08],f^ J4^#^OJ>^F6J\\^"110J$ont^!^R^{nt^!^R^28JM^"111],^5112^C2^I2,^:112^D2,l^112]}^xver^#[113J9^$J\'^!^^5]}^`^m^"111^-^!^R^-JN8,J.^71}},"theme2":{CJTc^>115]},TJRfo^*116],JoSize:32,f^+17],ver^#^OSubtJRfo^*116]^S^+17],ver^#^OJ>^F2J\\^"118J$ont^!^^9J$^ 109^{nt^!19]^}19^26JM^"111]J-^ 109],^5111^C2^I2,^:111],l^111^D0}^xver^#[113J9^$J\'^!^^9]}^`^m^"111^-^!20]^}19^Ms^ 109^-JN8,J.^71}},"theme3":{CJTc^>5]},T^|^!21JY^<32,f^+08],f^ J4^#^OSubt^|^!21JY^<16,f^+08],f^ J4^#^OJ>^F2J\\^"118J$ont^!22]:^p^{nt^!^R^28JM^"111],^5111^C2^I2,^:111^D2,l^111]}^xver^#[113J9^$J\'^!^^5]}^`bevel^a^m^"111^-^!23]:^p^-JN8^c@t^124],J.^72}}JXr={number^r,yearJ?^9@b364,monthJ?^9@b30,weekJ?^9@b7,dayJ?^9,hour^r000@b60@b60,minute^r000@b60,second^r000,millisecond^r,day@vf@week@sromInt^o39^i0^i1^i2^i3^i4^i5]]};J3 @s(mM,mb){mM^Q=@k(mb^Q);mM^Q[J!26]]=mM;mM[J!27]]=mb^Q^j@k(nr){J3 nq(){}nq^Q=nrJ, new nq()^jc(lc,mp,ek){if(ek===J!28^A0^L29^T^%6[131^A3^L32^T^%6[134^A6^L35^T^%6[137^A9^L38^T^%6[140]^K2^B1^T^%6[143]^K2^B1Js+7@bmp)}e^%6[144]^K6^B5^T^%6[147]^K9^B8Js+1@bmp)}}}}}}}}J,lc^js(mp,ekJ(r[ek+^p0]]@bmp^y@i(kN,dwJFce=falseJtkN@u0){ce=true;kN@b= -1;};kN=_$JS20]+kN;dw=!dw?1:dw;while(kN^Gdw){kN=^_kN}J,ce?^p3]+kN:kN^jbn(l@h){if(!l@hJ(l@h};l@h=l^X4]](/@g@es@es@b/,_$JS20]JQnz=/@es/;var cc=l^X2]];while(nz[^p6]](l^X5]](--cc))){}J,l^X7]](0,cc+1)^j@j(c@h){c^X8]]=J3(cz,c@z,cT,cS,gz,f@o,eI,f@h){if(eI^E59]]=eI}Jtf@h^E60]]=f@h}Jt typeof gz===J!61]){gz=5}^=2]]=f@o^=3Js^=4Je+gz,c@^.5Je+cT-gz,c@^.6]](cJ5,cJ5+g^.5]](cJ5+cS-g^.6]](cJ5+cS,cz+cT-gJ6)^=5Je+gJ6)^=6]](cJ6,cJ6-g^.5Je,c@z+g^.6Je,c@z,cz+gz,c@^.7JsJteI^E68Js}Jtf@h&&f@o>0^E69Js};}^yq(my,mdJ(my-md^yp(mw,mxJ(mw^l0]]-mx^l0]]^y@r(mpJFnt=((mp&0xJZ00)>>16)^l1]](16JQns^zJZ)>>8)^l1]](16JQmd^z00Jn)>>0)^l1]](16);nt=nt^G2?^_nt:nt;ns=ns^G2?^_ns:ns;md=md^G2?^_md:mdJ,J!72]+nt+ns+md^jbc(nt,ns,mdJFmp=(nt@u@u16)|(ns@u@u8)|(md)J,mp^jS(mpJFnu=[];var nt=((mp&0xJZ00)>>16JQns^zJZ)>>8JQmd^z00Jn)>>0);nu[0]=nt;nu[1]=ns;nu[2]=mdJ,nu^jg(mqJFms=this[^p2]]>>>0;var mr=Number(arguments[1])||0;mr=(mr@u0)?Math^l3]](mr):Math^l4]](mr)Jtmr@u0){mr+=ms};for(;mr@ums;mr++){if(mr in this&&this[mr]===mqJ(mr}};re~ont@weight^}~@samily:T?J!~@sont^N~tical@zlign:_$_b976~ontal@zlign:_$_b976~lse {if(ek===_$_b97~span>^Zy~^0o~or:{color};@d@e"@d>~ckgroundC^u~nt@samily^}~ont^N1~ontStyle^}1~^Msont~z)^=~lalue^\\~n style=@d@e"@dcol~ine^N1~^{ntSize:1~hT^h21],~JDJDJD~tick^N~r-select: noneJg~bel@tineTJ+:~J@legendMarker~n:1000@b60@b60@b24~grid^N~,borderTJ+:~976[15],JoSize:~;this[J!6~olorSet^}~,max@widthJ@~@qorderTJ+~]){lc[J!3~^L4~],tickTJ+:~],lineTJ+:~){this[J!~title@sontSize:2~[^p2]]@u~@sormatterJ@~,gridTJ+:~Max@widthJ@~){lc[J!4~]](lc[J!~]^c@~Color^}~[9],margin:5},~Text^}3~[J!25]]~07]:^p~,fontJN4,f~Js+1@bmp)}e~J0@sont~","title@sont~corner@radius~@h[^p~^}20],~JDJD{~nabledJC,~@sJptString~"lJbMarker~14]^}1~^p1]+~,DataSeries:{~Enabled:true,~^n10~,^m~(255,255,255~@qorderJ^~ransitJK~J:arker~ype^}~^n4~;^y~J?n","~[J!7~J.bel~],_$JS~:[_$JS~J!5~J@item~J?n:1~@xeJi","~Data@yoint~olorJ@~{name}:@u/~","@ubr/>@~,@tJb:{~}J3 ~=((mp&0x00~]J-o~JRfont~:_$JS~@J`","~_$JS1~","J[~trip@tine~]J\\@s~ackground~animation~[10],Jo~){return ~Jq:true~J^","~hickness~;return ~JM@s~index@ta~xt@qlock~","J_~,"render~","@uspa~function~109],ver~z+cT,c@z~z,c@z+cS~eJ@~","item~],horiz~J@m~ndex","~]JM~content~@zxis:{~Duratio~:null,~","get~@p@p@p~:false~ ~pxJg~){var ~@lalue~@tabel~marker~ext","~ion","~oolTip~,J_~Size:1~mouseo~eJi:~);var ~itle:{~_b976[~hart:{~Jn@s~vbject~ulture~};var ~]:_$_b~Jn00~border~,title~ineDas~Color~label~width~er","~egend~inter~12],f~]](cz~e","~;","~s","~ight~}","~text~Type~line~@s@s~font~orma~wrap~ed",~]]()~;if(~vers~tart~}}}}','turn -1^Oa(l@oJ*l^J75JDl^J75]]=g^kl@o;}JE@x={}J-jJ?^a@h(eN,e@v,e@k){e@k=e@k||^q12J,ht=eN^i176]+e@v^i176]+e@kJ(S=@x[ht]JCisNaN(cS)){try{JEm@p=^q177]^i178]+eN^i179]^i180]+e@v^i181]+e@k^i182]JC!bjJ)m@m=^,183]];bj=^,2^M184]);bj^\\85]]=_^6m@i=^,187^M186]);bj^\\88]](m@i);m@m^\\88]](bj);};bjJG^!189^N20];bjJ+76^C6[190],m@p);cS=^?193]](bj^\\92]]);bjJG^!189^N194];}catch(e){cS=^?173]](e@v@b1.1)};cS=^?195JJS,e@v);@x[ht]=cS;^kcS^O@t(nl,nmJ$k=[];nl=nl||^j1];lineJSTypeMap={"solid":[^pash":[3,1^pot":[1,1^pashJ13JP,1^pashDotJ13JPJP,1],"dot":[1,JTdash":[4,JTdashJ14,2,1,JTlongJS":[8,JTlongJSJ18,2,1,JTlongJSDotJ18,2,1,2,1,2]};nk=lineJSTypeMap[nlJ7k){for(JEcc=0;cc@unkJ+^7nk[cc]@b=nm}J!nk=[]^knk^Ob(l@o,l@r,mn,moJ>l^J96JDl^J96]](l@r,mn,mo||JRe)^`l^J97JDl^J97^M198]+l@r,^men){en=en||window^\\99]];en^W00]]=en^W00]]||f^den^W01]]=J2;en^W02]]=en^W02]]||f^den^W03]]=JH};mn^W04]](l@o,en);})J!return J2}}JEx=f^dJEbt=/D{1,4}|M{1,4}|@p{1,4}|hJ/@xJ/mJ/sJ/f{1,3}|tJ/TJ/@o|z{1,3}|"[@g"]@b"|@d[@g@d]@b@d/gJ-p=^X9^V40^V41^V42^V43^V44^V45^zr=[^q46^V47^V48^V49^V50^V51^V52^zq=[^q53^V54^V55^V56^V57^V58^V59^V60^V61^V62^V63^V64^zs=[^q65^V66^V67^V68^V57^V69^V70^V71^V72^V73^V74^V75^zu=/@eb(?:[@yMCE@z][SD@y]T|(?:@yacific|Mountain|Central|Eastern|@ztlantic) (?:Standard|Daylight|@yrevailing) Time|(?:@jMT|@nTC)(?:[-+]@ed{4})?)@eb/gJ-v=/[@g-+@ed@z-@i]/g^u^mb@z,b@q,bwJ)bz=^B[205]]:bpJ"j=^B[206]]:bqJ"t=^B[207]]:brJ-M=^B[208]]:bsJ"h=_^6bNJ&b@z=b@z&&b@z^W09]]?b@z:b@z? new Date(b@z): new DateJCisNaN(b@z)){throw SyntaxError(^j10])}JCb@q[^:0,4)^c[211]){b@q=b@q[^:4);bNJ\'J-I=bN?^j12^Y213J,bx^.214^^y^.215^^@s^.216^^@v^.217^^C^.218^^E^.219^^@o^.220^^D^.221^^@x=bN?0:b@z^W22JF;b@h=b@q^5bt,^mb@y){switch(b@y){case ^j23^_x^-24^Ax^"25^Qt[by]^-26^_z[by]^-27^Qs+1^-28^A@s+1^"29^_M[b@s]^-30^Qj[b@s]^-31]^vparseInt(^y@v)[^:-2))^-32]^%@v)[^:-2)^"33]^%@v)[^:-3),3)^-34^A@v,4)^-35^_C%12||12^-36^AC%12||12^"37^_C^-38^AC^"39^_E^-40^AE^"41^Qo^-42^A@o^"43]^v^yD)[^:0,1)^-44]^%D)[^:0,2)^"45]^%D)[^:0,3),3)^-48]:r^&6[246^Y247]^-51]:r^&6[249^Y250]^-54]:r^&6[252^Y253]^-57]:r^&6[255^Y256]^-61^_N?^j58]:(^y@z)^W60]](bu)||^W0]])^W59JF^5bv,^H^-64]^v(b@x>0?^[3^Y262])+^?J5^?^h/60)^-65]^v(b@x>0?^[3^Y262])+@i(^?J5^?^h/60)^"66]^v(b@x>0?^[3^Y262])+@i(^?J5^?^h/60),2)+@i(^?^h%60,2);;default^vb@y[^:1,b@y^9-1);;}})^ub@h;};}()JA@m^Rt,b@i,bwJ6t==J?^l_^b};ct=Number(ct)J(e=ct@u0?JH:JReJ@e){ct@b= -1}J"n=^B[267]^Y7]J"l=^B[268]^Y32J#u=_^b;b@i=^y@i)J(i=1J(rJ"h=_^6ch=_^6bT=-1J(b=[J#a=[J#n^sm^sj^sf=JReJ"p=0;ch=b@i^W60]](/"[@g"]@b"|@d[@g@d]@b@d|[eE][+-]@bJQ|[,]+[.]|‰|./g)J(gJ?;for(JEcc=0;ch&&cc@uchJ+^7cg=ch[cc]^3[7]&&bT@u0){bT=cc;continue ;}el^$[269JKi@b=100}el^$[270JKi@b=1000;continue ;^Pg[0]^c[32]^/^#7JKi/=^?271]](1000,cg^9-1);bT=cc+cg^9-1;continue ;^`(^*72]||^*73])^/^#JN){cf=JH}}}J0bT@u0){cb^W74J3^3[1^46^wn++}el^$[32JKj++}};^ta^W74J3^3[1^46^wm++};};}J@fJ)cd=^?174JJt);b@p=(cd===0?_^b:String(cd))^9-cn;ci/=^?271]](10,b@p);};ct@b=ciJCbT@u0){bT=cc};cu=ct^W75JJm)J(q=cuJG^K$_b976[7])J(w=(cqJQ^H^W76]](^HJ(v=(cq[1]+^H^W76]](^HJ@w&&cw[0]^c^ww^W77JF}J(o^sl^sk=0J-S=0J"m=0;J4cb^0J;b^W59JF^3[1^46^wo++J@o===cnJ)b@w=cw;cw=[]^3[JNJ)cs=cn-cl-(b@w?b@w^9:0);J4cs>0){b@w^W78^MJN);cs--;};};J4b@w^0^xw^W59JFJU;b@m++JCb@m%bS===0&&ck===cj&&b@w^0^xlJ<}J@eJ=^[3]J<^Pw^0J=cw^W59JFJU;cl++;b@m++;}el^$[JNJ=^[1]JU;cl++;b@m++;J0b@m%bS===0&&ck===cj&&cw^0^xlJ<};^`(^*72]||^*73])^/^#JN&&/[eE][+-]@bJQ/[^[6J3J>b@p@u0J;g^5^j62^<^5^[3^<^tg=cg^5^[3^<};b@h+=cg^5/JQ/,^mcx^l@i(b@p,cx^9)});}el^$[32JKk++;bS=b@m;b@m=0J@w^0^xlJ<^Pg^9>1&&((^*79]^/^#279])||(^*80]^/^#280]))J=cg[^:1,cg^9-1)JUJ!b@h=cgJU}}JXJ"r^sp=_^6b@kJ&J4ca^0J;a^W77JF^3[1^46[JNJ6v^0&&Number(cv^W81]](^H)!==0){cp+=cv^W77JF;b@kJ\'el^$^wp+=^[1];b@kJ\'}^Pg^9>1&&((^*79]^/^#279])||(^*80]^/^#280]))){cp+=cg[^:1,cg^9-1)^`(^*72]||^*73])^/^#JN&&/[eE][+-]@bJQ/[^[6J3J>b@p@u0J;g^5^j62^<^5^[3^<^tg=cg^5^[3^<};cp+=cg^5/JQ/,^mcx^l@i(b@p,cx^9)});^tp+=cg}JX;b@h+=(b@k?b@n:^H+cp^ub@h;}^aN(cz,c@z,e@o){cz@b=z;c@z@b=zJAf@q=e@o^W83JJz,c@z,2,2)^W82]J,nn=JH^(4;cc++J>J.]!==J.+4]|J.]!==J.+8]|J.]!==J.+12]){nnJ&break ;J0nn^lbc(f@q[0],f@q[1],f@q[2])J!return 0};}JEM^RyJ)cz^s@z=0;cy=cy||window^\\99]]JC^E84]]||^E84]]===0){cz=^E84]];c@z=^E85]];^`^E86]]||^E86]]==0){cz=^E86]];c@z=^E87]];^tz=^E88]]-^E90^][289]];c@z=^E91]]-^E90^][292]];}^k{x:cz,y:c@z};}^a@o(nj,ni,naJ$e=_^6ng^=[293^Y294J,nh^=[295^Y296J,nd^=[297^Y298J,nc^=[299^Y300]J8i[ngJ9g]^Z01^Ug^{g]^Z01]):_^bJ8i[nhJ9h]^Z01^Uh^{h]^Z01]):_^bJ8i[ndJ9d]^Z02^Ud^{d]^Z02]):_^6eN=ni[ncJ9c]^i20^Uc^{c]+^H:_^bJC!T&&eNJ$b=eNJG^K$_b9JM2])[0J7b[0]!^e280]&&nb[0]!^e279]){nb=^j80]+nb^i280]}J8b;J!ne+=eN^kne^O@v(no,ni,naJ)kN=no in ni?ni[no]:na[no]^ukN;}JE@p=JHJA@z=^203]]||1JAj=1JAz=@p?@z/j:1^abe(mz,cT,cSJ>T&& !!@pJ)e@o=mz[^q0^M304]);j=e@o^X05^DJM06^DJM07^DJM08^DJM09]]||1;z=@z/j^T[310JIT@bz^T[311JIS@bzJC@z!==j){mzJG^!310JIT^Z12];mzJG^!311JIS^Z12];e@o^X13]](z,z);};J!mz^X10JIT^T[311JIS;}}function t(cT,cSJ)mz=^,2^M1])^T^C6[314^V315]);be(mz,cT,cS)JC!T&& typeof (@j_vmlCanvasManager)!^e161]){@j_vmlCanvasManager^X16]](mz)^kmz^OE(mz,m@s,mEJ*mz||!m@s|| !mE^SJEm@j=mE^i7]+(m@s^c[317]?_^n8]:m@sJ o=_^n9]+m@sJAm@x=mz^X20]](m@oJ tJ&JEmD=^,2^M246]);^F21]]=m@j;^F22]]=m@x;mD^W90^N323J,enJC typeof (@qlob)!^e161]&&!!J:qlob()J)mI=m@x^5/@gdata:[a-z/]@b;base64,/,^HJAmC=atob(mIJ q=J:zrray@quffer(mC^9J h=J:nint8@zrray(m@q)^(mCJ+^7m@h[cc]=mC^X24JJc)}JAm@z=J:qlob([m@q],{type:_^n9]+m@s});try{^226^G25]](m@z,m@j);m@tJ\'catch(en){^F28^G27]]=[m@o,^F21]],^F22]^][281^M329]);^F22]]=^231^G30]](m@z);};}JC!m@t){try{event=^,333^M332]);event^X35^M334],tru^|window,0,0,0,0,0,JR^|JR^|0,null)JC^F36JD^F36]](event)^`^F37JD^F37^M338])JXcatch(enJ)el=^239JF;el^X43^G42^M340]+m@x^Z41]);el^X43^G44JF;JXJEk={reset:{^>345]},pan:{^>346]},zoom:{^>347]},menu:{^>348]}}^abd(kr,nw,nxJ>nw^X50^M349])!==nx){nwJ+76^C6[349],nx);nwJ+76^C6[351^V352]);nwJG^!353^N354^}^!355^N356^}^!357^N358^}^!359^N360^}b976^C6[361],kr^X63]][nx^Z62]]);nw^\\85^N364]+k[nx]^X65]]^Z66]+kr^X63]][nx^Z62]]^Z67];}}function bf(J$pJ?^(^g_$_b9^7np=^gccJ7p^\\90JDnpJG^!189^N368]};}^O@y(J$pJ?^(^g_$_b9^7np=^gccJ7p&&np^\\90JDnpJG^!189^N194]};}^Om(mt,cD,c@j,mu){^8JO=mt;^870]]=mu;t^+=[J#@q={}J@@j^o^o[mtJK@q=bk[c@j][mt]};^872JID?cD:{};^873]](^872]],c@q);}mJGb^\'373]]^RD,c@qJ*y[^8JO]J>@n&&^274JDconsole^X76^M375])}J!JEcC=y[^8JO];for(JEJ%CJ6D&&J%D){^fDJL^P@q&&J%@q){^f@qJLJ!^fCJL}JX^r^\'377]]^REJ*y[^8JO]&&@n&&^274JDconsole^X76^M375])}J(C=y[^8JOJ#@j=^ ^q378]]?^ ^q378]]:(^879]]&&^879^G72^G78]])?^879^G72^G78]^Y4J#@q={}J(@s=JYJLJ@@j^o^o[^869]JDc@q=bk[c@j][^8JO]}JCJ%CJ6E in ^872JDc@s=^ cE]^P@q&&J%@q){c@s=c@qJL^t@s=cCJL}J0c@s===JYJL^lJ2;^f@s^uJH;^r^\'380^;xJ*^ ^@){^ ^@={}};^ ^@[JV=^ JV;^r^\'382^;xJ*^ ^@){^ ^@={J0^ ^@[JV^lJHJ!return J2;^r^\'383^;xJ*^ ^@){^ ^@={}}J(I=!(^ ^@[JV===^ JV)^ucI;^r^\'196^;t,c@o,c@hJ*c@t|| !c@o^Sc@h=c@h||JY;t^+[c@t]=t^+[c@t]||[];t^+JB^W74]]({context:c@h,event@xandler:c@o});^r^\'384^;t,c@oJ*c@t||!c@o||!t^+JB^SJEcM=t^+JB^(cMJ+^7if(cM[^L385]]===c@o){cM[^L386JJc,1);break ;}};^r^\'387]]=f^dt^+=[]^r^\'336^;t,cNJ*c@t||!t^+JB^ScN=cN||{}J(M=t^+JB^(cMJ+^7cM[^L385^][204JJM[^L388]],cN)};}^an(mj,cD,mv){^889]]=mv;cD=cD||{};n^\\27^][126^][204]](JY,^q8],cD,cD^X78]]?cD^X78]^Y4])J(@v=JY^10]]=mj^11]^)JM92]]J?^13]]J?^14]]=[]^15]]=0^16^N20]^17]]J?^18]^)JM99]]=0JW^I0]^)76[401]^)76[402]^)76[403^N404]JW^I5]]={canvas:null,ctx:null,x1:0,y1:0,x2:0,y2:0,width:0,height:0}JW^I6]]=[]JW^I7]]= typeof (^890]])^c[408]?^,409]](^890]]):^890]]JC!thi^I7]]J>^274JD^274^G76^M410]+^890]]^i411])^k;}JW^I7^][185]]=_^6cT^sS=0JC^ _^n0JDcT=^810]]^tT=thi^I7^][412]]>0?thi^I7^][412]]:^810]]}JC^ _^n1JD~^872]][~b976[190^][~,2)^-~152]]-1]^c[~se {if(cg^c~^v@i(String(b~eturn bC@u12?_$_b97~976[125^][~;for(JEcc=0;cc@u~]J&this[_$_b9~cg[0]^c[2~his^X71]]~document[^q~;;case ^j~=b@z[bI^i~&&cg[cg[^q~^9>0~;^89~window^X~;if(cg^c~72]||cg===_$_b97~[^[4]](~^b;var ~76[152]];cc++){~this^X~[^[2]]~^[7]](~]]^R@~],^H~=nj?nj+_$_b976~image:^q~Math[^q~^q381]]~]^v@i(b~bw?bwJ+76~[191]](_$_b97~]]||e@oJ+~cy^W~mD^X~]]^X~_^b)~s[^q40~@o^\\~b976[276]](_~cc][^q~]](^q~]]=^q~;}function ~^`c~^_@~=^mc~^l};~;mzJ+76~]:(na&&na[n~],^q~[^j~[^q3~]:^q~^i3~^q15~[^q1~]]J+76~]]()J-~]^vb~J!if(~;function ~$_b976[20]~===_$_b976~unction(){~==^q~thisJL=c~arguments[~263]](b@x)~+^q~^q2~}^u~){return ~function(~$_b9JM1~&&bk[c@j]~],"shortD~_$_b976[~};mJGb~=0J(~J!c~;return ~:return ~[151JK~J=b@~String(b~]J,b~])?(na[n~e,JRe,~];nwJG~)JAm@~}else {~J-@~]J(~J)n~cE in c~=JRe;~=JH;}~JAc~){JE~J>!~JGb9~]JA~JAb~f@q[cc~{1,2}|~}}JC~Dot":[~JRe}~JJg)~while(~174]](~J>c~]JCn~;ne+=n~]?ni[n~ new @~){cg=c~JU};~){b@h=~){if(~=null~JCc~;JE~[c@t]~;if(~]]){~var ~]]()~[_$_~true~]]=c~]](c~]){c~[cE]~76[3~151]~69]]~,1,1~[0]+~fals~Dash~2],"~+b@h~c@x]~;thi~}};}~this~0,0,','cS=t^1^rcS=^J07^S13]]>0?^J07^S13]]:t^1^D^|=cT;t^1=cS^C14^6415]]=0^C16^6310]^717]]=t^1^C18]]=^jo[^J19]]]^`6[161]?o[^J19]]]:o^c5]^720]]=d^+]^a421^.20^e^:^\\6[422^.20^y^!353^_[354^720^y^!423^_[360^720^y^!424^_[25]J,!T){^J20^y^!311^_[425]}^C07^/^J20]^81]]=t(^x^O1^y^!353^_[426]^01^Z0]^-20^/^O1]^8392^61^Z0]]^a304^8392^S27^_[9];@j(^O392]]);^r^uJ !T){^J0^T1]]=t(cT,cS)^C0^T1^y^!353^_[426^70^T1^e^:^\\6[428^.20^/^J0^T1]^.0^T392^640^T1^Z0]]^a304J)^?76[40^T392^6392]]}^C29]]=t(cT,cS)^C29^y^!353^_[426^720^/^J29]^8393^6429^Z0]]^a304^8393^S27^_[9^730^oDJ!);b(window,^d31],^[^G432J$){^N33J$}})^C34]]=d^+]^a421^.34^e^:^\\6[435^.34^y^!436^_[437^720^/^J34]^.38]]={x1:0,y1:0,x2:^O^|,y2:t^1};b(^J29]^^334],f^#b^{^\'$_b^p^^440],f^#b^{^\'$_b^p^^441],f^#b^{^\'$_b^p^^442],f^#b^{39]](en)^I[443]J)^;[429]^^444],f^#b^{^\'$_b^p^A^Q6^w^d46]:^d47],f^#b^{^k^;[429]^A^Q6^w^d49]:^d50],f^#b^{^k^;[429]^A^Q6^w^d51]:^d52],f^#b^{^k^;[429]^A^Q6^w^d53]:^d54],f^#b^{^k);^*55]^-55]]=d^+]^a246^.55^e^:^\\6[456^.55^e^:190^^457]+(t^1-14)+^d58^.55^e^:459],-1)^C55^e^:290^^323J)^C60^obmJ!,^n^ 461]],^E8]^8J*]^3J(2]]^3J(3]]^3J(4]]^3J(5]]={aJ/m:{^iin^h,^iax^h},aJ/p:{^iin^h,^iax^h},aJ/p2:{^iin^h,^iax^h}};}@s(n,m);n[^s^M[466]]=^[J"@v=this;^E7]]^a310^8J2]^a311^8J2]^a378])^0J2]^a419])){^J18]]=^jo[^J19]]]^`6[161]?o[^J19]]]:o^c5]]};^E7]]^a467]);^*67]^-67^_[468]};^E7]]^a469^8363^ou(^n^ 469]^8J2]^a470^.70^6470J\'T^W^ 471J%^*72J%@y(^J7J&d^+]^a352]));bdJ!,^J72]^^473^.34^/^J72]]^;[^P[^@^G471J%^N71^f^N0J&J+;b^=6[^P[474]);^BJ0^l;^N02^fb^=6[^P[473J);^N33J$;});};^*75J%@y(^J75]]=d^+]^a352]));bdJ!,^J75]^^476^.34^/^J75]]^;[475]^^^@^N60^S77J$;^G471]]||^N02J%^N^l;^N02^fb^=6[^P[473]);^N03^_[404];^N29^y^!424]]=^N03]];^B76[471^f^N^YJ,^t^ 462J\'^t^ ^L478J%^N6^T^L479]]=^t^ ^L478]]^B7J(^T^L479]]^}J ^t^ 462J\'^t^ ^L480J%^N6^T^L481]]=^t^ ^L480]]^B7J(^T^L481]]^}};^N82J$^I[472]],^N75]]);^N33J$;})^C29^y^!424]]=^N03]];};^*71J\'!^J02J%^*72]^-^l^C^Yelse {^G472^Z350]]^a349])===^][363^S83]^-0J&J+^C71^f}^?J0^l^C^Y;bf(^N72]],^N75]J)};}^?76[471]]=false^C^YJ,^j^n^ 484]]^`6[161^-84]]=^n^ 484]]J ^j^n^ 485]]^`6[161^-85]]=^n^ 485]]}^0486]]^2[485J%bf(^J86]])^r@y(^J86]])}^"^{85J\'T){^J86]]=d^+]^a352]);bdJ!,^J86]^^487^.34^/^J86]]^;[486]^^^@^G4^v_^!189]]=^bJ-]){^G488J\'(( new Date())^c209J$-^N88^Z209J$@u=500)){^u};^N^v_^!189^_[489];^N86^S90J$;^N43^S91J$;}},J+);}};^*43]^H[485J\'T){^J43]]=d^+]^a421^.43^e^:492],-1)^C^v_^!436^_[493];^N^v_^!189^_J-^734^/^J43]]^;[443]^^490],^[@y(^N43]]);^N88^oDate();},J+^qr=d^+]^a421]);c@r[_$_^!436^_[494];c@r^c185^6363^S95]^743^/c@r);b(c@r,^d96],^%^!467^_[24^&^{44],^%^!467^_[497^&976[^@E(^][1]^^318],^N84]])^I[443]J),J+^qr=d^+]^a421]);c@r[_$_^!436^_[494];c@r^c185^6363^S98]^743^/c@r);b(c@r,^d96],^%^!467^_[24^&^{44],^%^!467^_[497^&976[^@E(^][1]^^499],^N84]])^I[443]J),J+);}^0434^y^!189]]!^bJ-^H[472]^-02]]?b^=6[^P[474]):b^=6[^P[473]);^G47^T350]]^a349])!==^][363^Z500J%b^=6[475]^^476])};J ^jy^c8^Z501]])=^b[161]^901^_[502];^O503^_[7];^rJ"@k=^E7]]^a503]^qy=^E7]]^a501J)^0399]]===0||(c@k||c@y)){^J55^e^:322],^O501]^.5^T185^6503]];}^0501]^H[503J%^*5^T504]^-20^/^J55]])}^"^{5^T504]^-20^Z505]](^J55]])}}^W^ 461]^H[460^Z372]]!==^n^ 461]^-60^Z37J&^n^ 461]]};^mE in ^J60^Z372]]^2[460^y^ 506]](cE)){^J60^ZJ2](cE)}};};n[^s^M[43J&^[J"T=0;J"S=0^W^ ^|){cT=^O^|}^?76[^|=cT=^J07^S12]]>0?^J07^S12]]:^O^|}^W^ 311J%cS=t^1^rt^1=cS=^J07^S13]]>0?^J07^S13]]:t^1}^01^Z^|!==cT@bz||^O1^Z311]]!==cS@bz){be(^O1]],^xbe(^J29]],^xbe(^J30^Z507]],^x^uJ+;};^ufalse;};n[^s^M[508]]=^[if(!^O509]]^909^ofJ!)}^?76[509^Z510J$^D387^>6[401^f^O511]]^}^0512]]^913^Z204]](window,^O512]])}^C66^>6[400]]=T&&^J70J\'(^O399]]===0)^C32^>6[514^>6[392^Z163^>J(2]]^3J(3]]^3J(4]]^36[394]]=[^706]]=[];^O515]]=[]^0430]^-30^S76J$^D516]]={aJ/ylacement:null,aJ/m@lalueType:null,plotTypes:[]^D517^o@l(0,0,^O^|,t^1,2)^040^T517]^-0^T517^S76J$^DJ*]=[];J"@l=0;^m@m=0;c@m@u^n^ J*^F;c@m++){c@l++J,!(!^n^ J*][c@m]^cJ1]||n^c518^Z175]](^n^ J*][c@m]^cJ1])>=0)){continue };J"@n= new wJ!,^n^ J*][c@m],^E8]],c@l-1,++^J30^Z519]])J,^K0]]==^}){^K0^_[521]+(c@l)J ^KJ&=^}){if(^n^ J*^F>1){^K3]]=[^J18]][^K4]]%^J18]^F]];^K2^6418]][^K4]]%^J18]^F];^rif(^UJ1]^R25]|^)^R26]|^)^R27]|^)^R28]|^)^R29]|^)^R30]|^)^R31]|^)^R32]|^)^R33]|^)^R34]|^)^R35]|^)^R36]){^K3]]=[^J18]][0]]^r^K3^6418]]}}^r^K3]]=[^K2]]]J ^U537]]==^}){if(((^UJ1]^R25]|^)^R26]|^)^R27])&&^U538J\'^U538]^F@u^O^|/16)|^)^R39]){^U537]]=8}J (^UJ1]^R40]|^)^R39])&&^U538J%^U538^Z541]](p)^D282^Z274]](c@n^qp=^U542]];J"@wJ,c@p=^b[12]^2[51^(^bJ.])^VJ#^5^g[545]^"^z^(^bJ-])^VJ#^5^g[546]^"^z^(=^}^91^(^s[12]}}}^rif(c@p^R43]^2[51^(^b[12])^VJ#^5^g[547]^"^z^(^bJ-])^VJ#^5^g[546]^"^z^(=^}^91^(^sJ.]}}}^rif(c@p^bJ-]^2[51^(^b[12])^VJ#^5^g[548]^"^z^(^bJ.])^VJ#^5^g[545]^"^z^(=^}^91^(^sJ-]}}}}}J c@w&&window^c374J%window^c374^Z376]](c@w);^u;};^D391]]=J+;};n^c518]]=a(^c525^^526^^527^^28^^528^^529^^530^^549^^540^^539^^550^^551^^552^^553^^531^^532^^535^^536^^554^^555^^533^^534^^556^^557^^558]]);n[^s^M[433]]=function(cD){if(cD){^EJ&cD^D508J$;var di=[];^mc=0;cc@u^OJ*^F;cc++^2[51^(^b[12]||^O51^(^bJ.]){if(!^O2^<[559]]||^O2^<[559]]=^b[30]){^*63]]^2[51^(^b[12^-63]]=^$_^ 463]^^^X[360])^"^z^(^bJ.^-63]]=^$_^ 463]^^^X[113])}}^D2^<[463^6463]];^"976[2^<[559]]^R60]){^*64]]^2[51^(^b[12^-64]]=^$_^ 464]^^^X[14])^"^z^(^bJ.^-64]]=^$_^ 464]^^^X[9])}}^D2^<[463^6464]];}};^*62]]^2[51^(^b[12^-6J&^$_^ 462]^^462^^113])^"^z^(^bJ.^-6J&^$_^ 462]^^462^^360])}}^D2^<[462^6462]];}^D561J$^W^ 361]]^962^oblJ!,^n^ 361]])J,!^O562^Z563]]^962^S33J$^rdi^c274]](^O562]])};}^W^ 564J%^mc=0;cc@u^n^ 564]^F;cc++^964]]=[];var dl~b976[372^Z~b976[190^Z~}else {if(^nb~unction(en){^t~ new hJ!,this[_$~^[this[_$_~]},J+);b(c@r,_$_b~39]](en)});bJ![_~6^Z542]]=~|^U351]]~if(!^J~ocument^c2]~f(^O516~]){^J~^84~^Z188]](~;if(^O~his^c311]]~){if(^nb976~=null;^nb97~c@w=^s[544]+~+^U351]~]]=^O~]^C~]);^O~){^O5~6[191]]^a~);b(^nb976~82]][cc][^s~d(c@v,^tb97~]]();^nb97~else {^nb9~334],^[~],window[^s~^rc@v[_$_b9~;^J~};^O~^O37~]^c152]]~if(^][~]&&^nb976~;@y(^]~^O4~^U52~462^Z~[125^e6~^][4~this^c~472]],^s~[326^e~=^b[5~^Z4~5^Z~c@n^c~{c@w=^s~;if(^n~463],^s~02^f}~]]^c~function(){~314],_$_b97~c@v[^s~],^s[~]]=^s~)!==_$_b97~(^s[~==^s~[^s[~^s[4~^yb97~]]=false;~]+^s~imum:null~internalM~ typeof (~48]](en)}~71]]=J+~for(J"~this[_$_~]]= new ~^{29]~);J"@~}else {~_$_b976~c@v[_$_~return ~43]][_$~[445]]?~cT,cS);~]][_$_~976[51~9J0~310]]~=null~}J,~(this~var c~[544]~]]()~]]){~2]]=~]]&&~6[46~]);}~282]~true~;if(~[194~[543~xis@~76[4~351]~377]','= new bh(this,t^+]^B564^]);^4564^;2^kdl)^v!dl^B563^jl^B433^x^Ni^B2^kdl)};}};^4565]]= new @w(this,t^+]^B565]],^4378]]);^Pc^L^4282^);cc^c(^4282^]^B566]]||^4282^][_$_b9^ 556]||^4282^][_$_b9^ 557]){^4565^;567^;2^k^4282^])^b!^4565^;563]]){^4565^;433^x^Ni^B2^k^4565]])^i^8^.^_^C[12]||^8^.^_^C[543]){h^B569]](^/2]],^/3]],^/4]],^8^.542]],^4517^;568^x)}e^I^8^.^_^C[194]){^4570^x}else {re^e}^Zb=0;for(db in di){di[db]^B433^x}^Za=[]^v^4400]]^\\de=t(^4J ],^43^{)^Zf=de^B0]](^E304]);df[^@1]](^41]],0,0,^4J ],^43^{);};^Pc^L^8^.572^);cc^Kdj=^8^.572^]^$dj[^@3^);dg^Kdk=dj[^@3^[^d@i^n;dk[^@4]]^n^v^4400^jk[^@4]]=t(^4J ],^43^{);dk[^@5]]=dk[^@4^;0]](^E304]);^i^M^ 525]^\'6[576^Y^#^ 526]^\'6[577^Y^#^ 527]^\'6[578^Y^#^ 28]^\'6[579^Y^#^ 549]^\'^y0^Y^#^ 528]^\'^y1^Y^#^ 529]^\'^y2^Y^#^ 530]^\'^y3^Y^#^ 550]^\'^y4^Y^#^ 551]^\'^y5^Y^#^ 552]^\'^y6^Y^#^ 553]^\'^y7^Y^#^ 531]^\'^y8^Y^#^ 532]^\'^y9^Y^#^ 540]){c@i=c@i=^4590^Y^#^ 539]^\'J!1^Y^#^ 556]){^4592^Y^#^ 557]){^4592^Y^#^ 535]^\'J!3^Y^#^ 536]^\'J!3^Y^#^ 554]^\'J!4^Y^#^ 555]^\'J!5^Y^#^ 533]^\'J!6^Y^#^ 534]^\'J!7^Y^F^F^F;^Pdh=0;dh@u^1^);dh++){^4406^;2^k^4282]][^1]][dh]])^i^4400]]&&c@i){da^B2^kc@i)^|^i^4400]]&&^4394^)>0^\\dc=t(^4J ],^43^{)^Zd=dc^B0]](^E304]);da^B2^k^4599]](dd));}^d@v=this^ra^BJ"]>0){^<[401]]^l;^<[509^;606]](200,^<[600]],f^Jdm){^<[392^;601]](0,0,^<[J ],^<[3^{);^<[392^;571]](de,0,0,Math^B1^k^<[J ]@bz),Math^B1^k^<[3^{@bz),0,0,^<[J ],^<[3^{);^Pdn=0;dn@uda^BJ"];dn++){c@i=da[dn]^rm@u1&& typeof (c@i^?02]])!^C[161]^pdm>=c@i^?02]]){c@i^?04]](c@i^?03]](dm-c@i^?02]],0,1,1-c@i^?02]]),c@i)}}else {c@i^?04]](c@i^?03]](dm,0,1,1),c@i)^|^<[336]](^E605],{chart:c@v});},f^J){da=[]^Zp=0;^Pc^L^<^.572^);cc^Kdj=^<^.572^]^$dj[^@3^);dg^Kdk=dj[^@3^[;dk[^@4]]^n;^|de^n;^<[401]]^a;});}e^I^<[394^)>0){^<[599^x};^<[336]](^E605],{chart:c@v});};^4607^x^v!^4471]]&&!^4402]]&&^4472]]&&^4472^;190^;189]]!^C[194]){@y(^4472]],^4475]])};^/0^;608^x;^4399]]++^v@n^\\c@v=this;setTimeout(f^J^\\dq=document^B409]](^E609])^rq){be(dq,^<[J ],^<[3^{)^Zr=dq^B0]](^E304]);dr[^@1]](^<[430^;507]],0,0);};},2000)^h^B125^;607^}^J){^4197]]({context:this,chart:this,mousedown:^4610]],mouseup:^46^{,mousemove:^4612]],cursor:^4471]]?^E613]:^E614],cursor:^4402]]?^E614]:^E404],capture:true,bounds:^4405]]})};n^B125^;615^}^J^\\c@n=^E20];^Pc^L^4282^);cc++){c@n=^4282^]^v!^7538]]||^"^EJ"]===0||!^7616]]^9^vn^B518^;175]](^7351]])>=0^\\dj^n^Zs^Q^wk^n^Zu^a^$^8^.572^);dg^c(^8^.572^[^B351]]===^7351^js^l^Zj=^8^.572^[;break ;^b!ds){dj={type:^7351]],totalDataSeries:0,plot@nnits:[]};^8^.572^;2^kdj);}^$dj[^@3^);dg^c(dj[^@3^[^B559]]===^7559^ju^l^Zk=dj[^@3^[;break ;^b!du){dk={type:^7351]],previousDataSeriesCount:0,index:dj[^@3^),plotType:dj,axis@pType:^7559]],axis@p:^7559]]=^C[30]?^/3]]:^/4]],axis@m:^/2]],dataSeriesIndexes:[],yTotals:[]};dj[^@3^;274^Y;};dj^?17]]++;^1^;2^kcc);^7618]]=dk;^|^Pc^L^8^.572^);cc^Kdj=^8^.572^]^Zv=0^$dj[^@3^);dg++){dj[^@3^[^?19]]=dv;dv+=dj[^@3^[^B598^);}^h^B125^;620^}^J){^Pc^L^4282^);cc^Kc@n=^4282^]^v!^7538]]^9^Zw=^"^EJ"]^$dw;dg++){^7621^[=++^4430^;519]]};}};n^B125^;561^}^J){^4620^x;^4615^x;^Pc^L^8^.572^);cc^Kdj=^8^.572^]^$dj[^@3^);dg^Kdk=dj[^@3^[^v^M^ 525^=^ 526^=^ 527^=^ 28^=^ 528^=^ 529^=^ 530^=^ 549^=^ 540^=^ 539]){^4622^Y^#^ 550^=^ 552^=^ 531]){^4623^Y^#^ 551^=^ 553^=^ 532]){^4624^Y^#^ 535^=^ 536^=^ 554^=^ 555^=^ 533^=^ 534]){^4625^Y}}}};}^h^B125^;622^}^Jdk^p!^1]]||^1^)@u1){re^e^Zy=dk^B463^;^Rr dx=^M^&^Rr dz,d@z^Z@q^a^$^1^);dg^Kc@n=^4282]][^1^[]^dc=0^ZC^Q^wD^a^v^7^_^C[12]||^7^_^C[543]^\\d@s=^/5^G^&479]]?^/5^G^&479]]:(t^+]^B^T^+^X^&478]])?t^+^X^&478]]:-I^Sv^wE=^/5^G^&481]]?^/5^G^&481]]:(t^+]^B^T^+^X^&480]])?t^+^X^&480]]:I^S^i^"^*]&&^"^*]^B^m||^7627]]=^C[628]){^U}^g^L^"^EJ"];cc^c( typeof ^"^*]=^C[161]){^"^*]=cc^i^"^*]^B^m){^U;dz=^"^*]^B^m();^Nz=^"^*]};d@z=^"cc]^?29]];^O^60^j^60]]^Hdz>dx^2){dx^2^Hd@z@udy^?30]^-0]^f^^z>dy^2){dy^2=d@z^iJ#^\\^qz-^"cc-1]^B170]];d@j@u0&&(^q@j@b -1)^r^61]]>d@j&&d@j!==0){d^61^oj^|^O@s&& !dC^9e^I!dC){dC^l^vcc>0){cc-=2;continue ;};^bd^` !dD){dD^l}e^Id^`dD^9^i^"cc]^?32]]){^M^&633]]^z=^"cc]^?32]]};^O^64^j^64]]^Hdz>d^65^j^65]]^Hd@z==^n^9^^z@udy^?34]^-4]^f^^z>dy^?35]^-5]^f;};^8^.636]]=^7627^oq?^E628]:^E29]^h^B125^;623^}^Jdk^p!^1]]||^1^)@u1){re^e^Zy=dk^B463^;^Rr dx=^M^&^Rr dz,d@z^Z@q^Q^wI=[]^Z@x=[]^$^1^);dg^Kc@n=^4282]][^1^[]^dc=0^ZC^Q^wD^a^v^7^_^C[12]||^7^_^C[543]^\\d@s=^/5^G^&479]]?^/5^G^&479]]:(t^+]^B^T^+^X^&478]])?t^+^X^&478]]:-I^Sv^wE=^/5^G^&481]]?^/5^G^&481]]:(t^+]^B^T^+^X^&480]])?t^+^X^&480]]:I^S^i^"^*]&&^"^*]^B^m||^7627]]=^C[628]){^U}^g^L^"^EJ"];cc^c( typeof ^"^*]=^C[161]){^"^*]=cc^i^"^*]^B^m){^U;dz=^"^*]^B^m();^Nz=^"^*]};d@z=^"cc]^?29]];^O^60^j^60]]^Hdz>dx^2){dx^2^HJ#^\\^qz-^"cc-1]^B170]];d@j@u0&&(^q@j@b -1)^r^61]]>d@j&&d@j!==0){d^61^oj^|^O@s&& !dC^9e^I!dC){dC^l^vcc>0){cc-=2;continue ;};^bd^` !dD){dD^l}e^Id^`dD^9^i^"cc]^?32]]){^M^&633]]^z=^"cc]^?32]]};^O^64^j^64]]^Hdz>d^65^j^65]]^Hd@z==^n^9;dk^?^W=(!dk^?^W?0:dk^?^W)+Math^B263]]^u^^z>=0^pdI^z){dI^z+=d@z^NI[dz^f}e^Id@x^z){d@x^z+=d@z^N@x[dz^f^|^8^.636]]=^7627^oq?^E628]:^E29];}^gc in dI^pisNaN(cc)^9^Z@h=dI[cc]^^^s^?30]^-0]]^V(d^t^2){dy^2^V(cc@ud^64]]||cc>d^65]]^9^^^s^?34]^-4]]^V(d^t^?35]^-5^oh};}^gc in d@x^pisNaN(cc)^9^Z@h=d@x[cc]^^^s^?30]^-0]]^V(d^t^2){dy^2^V(cc@ud^64]]||cc>d^65]]^9^^^s^?34]^-4]]^V(d^t^?35]^-5^oh}^h^B125^;624^}^Jdk^p!^1]]||^1^)@u1){re^e^Zy=dk^B463^;^Rr dx=^M^&^Rr dz,d@z^Z@q^Q^w@t^Q^w@o^Q^wM=[]^$^1^);dg^Kc@n=^4282]][^1^[]^dc=0^ZC^Q^wD^a^v^7^_^C[12]||^7^_^C[543]^\\d@s=^/5^G^&479]]?^/5^G^&479]]:(t^+]^B^T^+^X^&478]])?t^+^X^&478]]:-I^Sv^wE=^/5^G^&481]]?^/5^G^&481]]:(t^+]^B^T^+^X^&480]])?t^+^X^&480]]:I^S^i^"^*]&&^"^*]^B^m||^7627]]=^C[628]){^U}^g^L^"^EJ"];cc^c( typeof ^"^*]=^C[161]){^"^*]=cc^i^"^*]^B^m){^U;dz=^"^*]^B^m();^Nz=^"^*]};d@z=^"cc]^?29]];^O^60^j^60]]^Hdz>dx^2){dx^2^HJ#^\\^qz-^"cc-1]^B170]];d@j@u0&&(^q@j@b -1)^r^61]]>d@j&&d@j!==0){d^61^oj^|^O@s&& !dC^9e^I!dC){dC^l^vcc>0){cc-=2;continue ;};^bd^` !dD){dD^l}e^Id^`dD^9^i^"cc]^?32]]){^M^&633]]^z=^"cc]^?32]]};^O^64^j^64]]^Hdz>d^65^j^65]]^Hd@z==^n^9;dk^?^W=(!dk^?^W?0:dk^?^W)+Math^B263]]^u^^z>=0){d@t^l^N@o^l^idM^z){dM^z+=Math^B263]]^u^NM^z=Math^B263]]^u^|^8^.636]]=^7627^oq?^E628]:^E29];}^^t&& !d@o){dy^2=99;dy^?30]]=1;}e^Id@t&&d@o){dy^2=99;dy^?30]]= -99;}e^I!d@t&&d@o){dy^2= -1;dy^?30]]= -99;}}};dy^?34]]=dy^?30]];dy^?35]]=dy^2;dk^?38]]=dM;};n^B125^;625^}^Jdk^p!^1]]||^1^)@u1){re^e^Zy=dk^B463^;^Rr dx=^M^&^R~76[351]]=^C[~^#7~^7538]][~}e^Idk[_$_b9~;^Pdg=0;dg@u~^(}~76[462^;~){c@i=this[_$_b97~^,}~^;152]]~cc]^B170]~his^B372]~^0}~]){dy^?3~[516^;~^446~^3}~dk^B598~^B195]]~^5}~^8[~^:}~x^?3~c@n^B~this[_$_b976~){continue }~^>}~]]^B~c@v[_$_b976~]||^M~^A}~^B6~^E57~^D}~[^E~==_$_b976~^F}~_$_b976[~}}}}}}}}~]^X~=dz^i~lse {if(~unction(~++^\\~c=0;cc@u~dk[_$_b9~}else {d~if(dz@ud~for(var ~^a;v~626]];va~nfinity;~462]]&&t~d@q^l~=d@h};if~37]]^z~][_$_b9~]](dk)~;v^w~]][dg]~){var ~]][cc]~^r@~542]]=~z>dE&&~=false~}^i~++){if~;var c~turn }~]=d@z}~;for(c~;^|n~}^v~]]){d~74]](~=true~209]]~=null~]]=d@~){if(~d@j=d~^vd~h@udy~@h>dy~(d@z)~;if(~ar d~]]()~6[58~[dz]~11]]~};};~]]=f~310]~6[59~152]~cc>0','r dz,d@z,d@v,dN;J(qJ*;for(var dg=0;dg@udk^t598]]^Idg++J%c@n=^Q282]][dk^t598]][dg]]J8cc=0J8dC=^ndDJ*J=c@n[_$^L$_bJ/]||c@n[_^a^)J(s=^F5J&^ 479]]?^F5J&^ 479]]:(^Q372]^g462]^=372J&^ J>])?^Q372J&^ J>]:-InfinityJ8dE=^F5J&^ 481]]?^F5J&^ 481]]:(^Q372]^g462]^=372J&^ 480]])?^Q372J&^ 480]]:Infinity;J5^5^(]&&^5^(^g209]]||c@n^f27]]^`628]JAqJ9};for(cc=0;cc@u^5]^Icc+J. typeof ^5^(]^`161]){^5^(]=ccJ5^5^(^g209J:@qJ)dz=^5^(^g209]]()^xdz=^5^(]};d@z=^5JB^^29J\'d@z&&d@z^t152J:@v=M^?^^39]](null,d@z);dN=^@^T39]](null,d@z);J+z@udx^f30J0^f30]^oz>dx^_5J0^_5]^o@v@udy^f30J3^f30]]=d@vJ+N>dy^_5J3^_5]]=dNJ5cc>0J%d@j=dz-^5JB-1]^P;d@j@u0&&(d@j=d@j@b -1)J=dx^f31]]>d@j&&d@j!==0){dx^f31]]=d@j^}dz@ud@s&& !dC^YJ4if(!dC){dCJ)if(cc>0){cc-=2;continue JCJ+z>dE&& !dD){dDJ9^ldz>dE&&dD^YJ5^5JB^^32J:k[_$_^ 633]][dz]=^5JB^^32]]J+z@udx^f34J0^f34]^oz>dx^f35J0^f35]^o@z===null^YJ=d@v@udy^f34J3^f34]]=d@vJ+N>dy^f35J3^f35]]=dN};};^Q516^T36]]=c@n^f27]]=d@q?^v628]:^v29];^,^^40^XdT,d@n,d@kJAk=d@k||^nd@w=[];^p^>6]^g152]]-1;cc>=0;cc--J%c@n^>6]JB]J8b@hJ-b@h=c@n^f40]]^ZJ=b@hJAw^t274]](b@h)};};J(yJ-J(lJ*;for(J(r=0;d@r@ud@w^Id@r+J.d@w^&^G^`525]||d@w^&^G^`526]||d@w^&^G^`528]||d@w^&^G^`529]J%dS=@v(^v537],J ^^41]],d@w^&])||8J=J ^^42]]@u=dS/2JAlJ9^{};}};for(d@r=0;d@r@ud@w^Id@r+J.d@l&&d@w^&^G!^k525J;w^&^G!^k526J;w^&^G!^k528J;w^&^G!^k529]^YJ=!d@yJAy=J ]^lJ ^^42]]@u=d@y^f42J:@y=J ]}};}^zd@y;^8^^43^XdT,d@n,d@kJAk=d@k||^nd@pJ-J(m=^Q640]]^ZJ=d@mJAp=d@m^t567^T21]][d@m^f44]]]^lTJAp=N(dT,d@n,^O30^T45]])}J4^pJ!^Q565^T46]]^Icc++J%d@i=^Q565^T46]JB]J=dT>=d@i^]4]]&&dT@u=d@i[^VJ;n>=d@i^]5]J;n@u=d@i^]7J:@p=d@i^f47]]};}}}^zd@p;^8^^48^Xeb,cT,cS){cT=cT||^Q310]];cS=cS||^Q311^wa=eb/400^zMath^_3]](M^?](^Q310]]^71]])@bea);^8^g482^X){t^:^^01]](0,0^70]]^71]])^8^g514^X){^H2^T01]](0,0^70]]^71]])^+67^3392]^g159]]=^F7]];^H2^T49]](0,0^70]]^71]]);^,]^_7^Xec){t^B^g274J?c)^8][^j8^Sy){if(!^U50]]||!^Q651]]^bvar eg=[]J$j=^U50^wf=ej?ej[0]:cyJ$iJ-switch(^h[351J@case ^j7]:^K46]:eg=[^j0],^j2]];^\'=M(ef);^\'^f52]]= new Date()^{^K50]:^K49]:eg=[^j0]]^{^K52]:^K51]:eg=(^H6]]^`447]||^H6]]^`446])?[_^[^v334]]:[^j1]]^{;default:return ;;J5ej&&ej^t152]]>1^bei=M(ef);ei^f52]]= new Date();try{var ee=ei^f29]]-^\'^f29^wd=ei^P-^\'^PJ8b@z=ei^f52]]-^\'^f52J\'M^#ee)>15&&(!!^\'^f53]]||b@z@u200)){^\'^f53]]J9J$l=J1^i70]]||J1J=el&&el^f54J6l^f54]](0,-ee)}JCcatch(e){};^H6]]=^h[351J\'!!^\'^f53]^=471]]^-655^3482]]()};t^A]J*^z;};^p=0;cc@ueg^Icc++J%ek=eg[cc]J$h=^E[333]](^v656]);eh^i35J?k,true,true,J1,1,ef^f57]],ef^f58]],ef^f59]],ef^f60^|,false,false,false,0,null);ef^t290]^g336J?h)J=^U61J@^U61]]()^D200J@^h[200]]()};^,^g439^Sy){if(!^Q651]]^bif(^Q662^3662]]J*^z;^D661J@^U61]]()^D200J@^h[200]]()J5 typeof (^N])^`161]&&^U63J@^N]=^U63]]}J$r=M(cy)J$k=^h[351^woJ$qJ=!cyJ%en=J1^_9]]^D664J6q=(^U64]]==3)^l^h[352J6q=(^h[352]]==2)}J5@n&&w^/]){w^/^g376J?k+^v665]+^6+^v666]+^9)J=eq){w^/^g376]](^U64]])};^.1]){w^/^g376]](^j1])^}eq^bif(n^f67J6o=n^f67]];^.1]){n^f67]]J-if(^J][_^q^T68J@^J][_^q^T68^e^E[183]^g384]](_^[^J^g439^|)^}eo^t506J?k)){eo[ek^g204J?o^i88]],^6,^9)};^!976[515J@^p=0;cc@ut^B]^Icc+J.!t^BJB^g506J?k)^Y;eo=t^BJB]J$m=eo^t438J\'^6>=em^]4]]&&^6@u=em[^V]&&^9>=em^]5]]&&^9@u=em^]7J6o[ek^g204J?o^i88]],^6,^9);^.2]&&eo^f69]]==J9){n^f67]]=eo^+29^T70^3429^T70^e^E[183]]^_6]](_^[^O39^|)}^x^.1]){if(^J][_^q^T68J@^J][_^q^T68^e^E[183]^g384]](_^[^O39^|)}}};break ^xeo=null^}eo&&eo[_$^c){^N]^_0]][_$^c=eo[_$^c}J4^N]^_0]][_$^c^>3]]};}}^+60]^=460^T71]^yp^>5J\'^6@u^<||^6>ep[^V]||^9@u^;||^9>ep^]7^3460]^g477]]()^}(!t^A]||!^C]])&&^O30^3430^T72]](cy)^,^^10^SJ2{t^A]J)if^*][_^a]!^k194]){^"={x:cz,y:c@z,xMinimum:^u^ J>],xMaximum:^u^ 480]]}}J4^"={x:cz,y:c@z}^,^^11^SJ2{if^*][_$^L$_bJ/]||^QJ"^a^)if(t^A^yt=0J$u=0;v^\\$_^ 674]];if^*][_^a^)et=c@z-^"^f29]];eu=M^#^u^ 48^W^ J>^2J<^xet=^"^P-cz;eu=M^#^u^ 48^W^ J>^1]@bet;J,^#et)>2^-402]^yz=^ney=0J=^u^ 4^%@u^u^ 675J6y=^u^ 675]]-^u^ 4^%;^u^ 4^%+^r$_^ 4^$+=ey;ezJ)^l^u^ 4^$>^u^ 676J6y=^u^ 4^$-^u^ 676]];^u^ 4^$-^r$_^ 4^%-=ey;ezJ)}J5ez){JD[^M};^!976[471^3482]]()J=!^"^bif^*][_^a^)var e@z={y1:M^?](^"^f29]],c@z),y2:^@]](^"^f29]],c@z)J,^#e@z^]5]]-e@z^]7]])>1){v^\\$_^ 674^wx=^u^ 480]]-(^u^ 48^W^ J>^2^07]]-es^]5]])J$w=^u^ 480]]-(^u^ 48^W^ J>^2^05]]-es^]J7ex=^@J?x,^u^ ^R[630]]);ew=M^?](ew,^u^ ^R[19J7if(M^#ew-ex)>2@bM^#^u^ ^R[631]])){^u^ 4^%=ex;^u^ 4^$=ew;JD[^MJC;^!JEJ"$^L$_bJ/^y@z={x1:M^?](^"^P,cz),x2:^@]](^"^P,cz)J,^#e@z^]4]]-e@z[^V])>1){v^\\$_^ 674^wx^m^ 48^W^ J>^1^04]]-es^]4]])+^u^ 478^ww^m^ 48^W^ J>^1^06]]-es^]4]])+^u^ J>];ex=^@J?x,^u^ ^R[630]]);ew=M^?](ew,^u^ ^R[19J7if(M^#ew-ex)>2@bM^#^u^ ^R[631]])){^u^ 4^%=ex;^u^ 4^$=ew;JD[^MJC;}};}};^Q662]]J9^+71]^=472]]^_0]^g189]]^`194]){bf(^O72]],^O7J7bd(JD,^O72]],^v473]);bd(JD,^O75]],^v476])JC;}};t^A]J*;^8^^12^Sz,c@z^-655]^=J"^a]!^k194^yt=0J$u=0;v^\\$_^ 674]];if^*][_^a^)et=c@z-^"^f29]];eu=M^#^u^ 48^W^ J>^2J<^xet=^"^P-cz;eu=M^#^u^ 48^W^ J>^1]@bet;J,^#et)>2&&M^#et)@u8&&(^O02]]||^C]])){^F0]^g477^eif(!^O02]]&&!^C^3460^T77]](cJ2}J,^#et)>2&&(^O02]]||^C]])^-402J@^u^ 4^%=^"^f78]]+eu;^u^ 4^$=^"^f79]]+euJ$y=0J=^u^ 4^%@u^u^ 675]]-s(^u^ ^d_$_^ J#{ey^m^ 675]]-s(^u^ ^d_$_^ J#-^u^ 4^%;^u^ 4^%+^r$_^ 4^$+=ey;^l^u^ 4^$>^u^ 676]]+s(^u^ ^d_$_^ J#{ey=^u^ 4^$-(^u^ 676]]+s(^u^ ^d_$_^ J#;^u^ 4^$-^r$_^ 4^%-=ey;}}J8c@v=JD;clearTimeout(^HJ7^H5]]=setTimeout(function(){c@v[^M},0);^!976[471]^yC^>5]];^O82]]()J$@q=t^:^^82]];t^:^^82]]=0.7;t^:^g159]]=^v683];if^*][_^a^)t^:^^49J?C^]4]],^"^f29]],eC[^V]-eC^]4]],c@z-^"^f29]])^!JEJ"$^L$_bJ/]){t^:^^49]](^"^P,eC^]5]],cz-^"^P,eC^]7]]-eC^]5]])}};t^:^^82]]=e@q;}}}^x^F0^T77]](cJ2}^8^g570^XJ%ep^>5^wE=^F3]]?^F3]]:^F4J\'!T&&(^<>0||^;>0)){ep^i92^T84]](^<,^;)}^+62]]&&eE){^<=^u^ ^44]]@u^u^ ^46^s_^ ^44]]:eE^t^44]];^;^m^ ^45]]@ueE^t^45^s_^ ^45]]:eE^t^4J7ep[^V]^m^ ^46]]>eE^t^46^s_^ ^46]]:eE^t^46]]);ep^]7]]=^u^ ^47]]>^u^ ^45^s_^ ^47]]:eE^t^47]];ep^i10]]=ep[^V]-^<;ep^i11]]=ep^]7]]-^;^xvar eD=^Q517]^g568]]();^<=eD^]4]];ep[^V]=eD[^V];^;=eD^]5]];ep^]7]]=eD^t~b976[462]^g~^lthis[_$_b~^Q673]]~ath^t263]](~65]^g481]]~65]^g479]]~[d@r^g567]~^H7]]~][cc^g170]~]^`543]){~(^Q516]~;if(^O~};^8~){if(^Q~if(ek^`44~indow^i74]~]@b(e@z^]~])/es^i10]~])/es^i11]~]]){^Q~674]]^]~c@n^t538]~er^P~,^Q31~};n^t125]~er^f29]]~his^i93]~ep^]5]]~ep^]4]]~]&&^Q~=^O0~ath^f30]~Math^_5~his^f55]~his^t515]~^O71~};if(^h[~document[_$_b976~^O6~^g351]]~^Q39~^t152]];~eo^i79]~;case ^v4~_bJE542]]===_~^v433]]()~^h[290]~^Q4~^t170]]~this^t~626J&b976~^Xc~]^^~cy^f~^v416]~0]]-^u~]]=function(~){continue }~(dT,d@n,d@k)~$_bJE441],~ar es=JD[_~^t41~]^f~^t19~=^k~$_bJE542]~){return };~_bJE424]]~680]],JD[~]]()}J4~^t6~]^t~cy[_$_b976~^t3~^v44~==^v~}J4if(~=(^u~falseJ8~]=dzJ+~for(var cc~$_bJE429~=ey;JD[_~]]?JD[_$~[^v~JD[_$_~_$_bJE~]]J$~;}J4~]J%e~;return ~;break ;~]],false~};J5~d@w[d@r~=0;cc@u~516]][_~681]]))~J8e~){var ~]][_$_~]]J=~var d@~J9;~=false~J5d~J5M~=null;~+){if(~JE12~J:x~window~z,c@z)~J:y~else {~}J=~J@e~5]]);~;var ~=true~J@d~]&&d@~]@bet~;if(~478]~]](e~]]){~){d@~][cc~;};}~this~976[','4Je;ep^J=eD^J;ep[^R=eD[^R;}JN!T){ep^g]]^J=ep^J;ep^g]][^R=ep[^R;ep^g^b190^b36JQ^O4]]+^}312];ep^g^b190^b9]]=^O5]]+^}312]JN^O4]]>0||^O5]]JXep^t392^b684]](-^O4]],-^O5]])J[ep^t5Je= new @l(^O4^95^96^97]],2);};n^g25^b685^^cz,c@z)J#{x:this[^\'JI[686JOz)[_^\\,y:this[_^;JI[686JO@z)JJ^k}};n^g25^b599^^fe^rfe||^.JE^Gep=^.J$p^|m^|l^|k^|j=0J4@l=0,e@w=0J4@i=0,fa^|i^|h=0;for(JZ^xt^AJE^6JZeS=t^A][ccJ$h=^i[688^b687^vcJ(sJ4M=@v^u689^)J*^/e@v^K0^)J*^/eN^K1^)J*^/e@y^K2^)J*^/e@k^K3^)J*^/eI^K4^)J*^/e@m^K5^)J*^/e@n^K6^)J*^/fc={percent:JT,total:JT}J4@r=JTJN^{^0351^b175]]^u697]J0^{^0351]]=^h556]||^{^0351]]=^h557JVc=^][698]^c6[JS^)])}JN^{^0699JK^:^t699]]){e@r={chart:^][372]]^_^i[JS^X^:,inJmeS^f00]],total:fc^f0JMpercent:fc^f02]]}}J4T=^:^t699]]?^:^t69Jde@r):^:^f03]]?^][704]](^:^f03]^)],^i[JS],JT,eS^f00]]):^{^0699]]?^{^069Jde@r):^{^0703]]?^][704]](^{^0703]^)],^i[JS],JT,eS^f00]]):JTJNeT===JT||eT=^h20^MJZfd=@v^u705^)J*^/fb=@v^u706^)J*^/e@s=0J4@t=eS^f07]J$j=^{^0462]J$x=^{^0463J)f= new bi(e@o,{x:0,y:0,max@width:e@m?e@m:this^J@b0.5,max@xeight:e@n?e@v@b5:e@v@b1.5,angle:fb=^h26]?0:-90,text:eT,padding:0,JngroundCJHeI,horizontal@zlign:^}360]JGSizJcvJG@samily:eNJG@weight:e@kJGCJHeMJGStylJcy,text@Jjline:^}9]})J+g=ff^f08]](JA^*(^j5]J0^*(^j8]J0^*^u540]J0^*^u539^l^:[_^\\@u^m6[478JK^:[_^\\>^m6[480JK^:JJ^k@ue@x^t478JK^:JJ^k>e@x^t480]]){continue }^o^:[_^\\@u^m6[478JK^:[_^\\>^m6[480]]){continue }};e@w=2;e@l=2J=0){fd=^}25];e@w=4;^o^*^u697^lfd^@fd=^NJ,if(^F40]||^F39JVd=^N};cJ%b^$J@-fi/2J@z@ufmJ?fd^@c@Jh^(eJ2^$J=,fm)JY^efmJY}};^eeJ2^$J=JYJ>@z>fl-J1J?fd^@c@z=^-]J"^$J=,fl)-J1^efl-J1}J[}J,fm=Ma^(^i^+5^95]]);fl=^-^c6^+7^97]]JA^*^u711^le@tJXJWMa^(^i^+5^95Jifh/2JY}J,JW^-^c6^+7^97]])-fh/2-e@w}}J,JW(Ma^(^i^+5^95Ji^-^c6^+7^97]]))/2}JNe@tJXc@Jh^(eJ2^$629]J&h/2J>@z@ufm&&(^F40]||^F39])){c@Jh^(eJ2^$J=-J1,^O5]]JY)};^e^-]J"^$629]J&h/2J>@z>fl-J1&&(^F40]||^F39])){c@z=^-]J"^$J=JY,^O7]]-J1)J[};^o^*(^j5]J0^*(^j8]J0^*^u539])>=0){fd=^}25];e@l=4;^o^*^u697^lfd^@fd=^NJ,if(^F40JVd=^N};c@J%b^$J=-fh/2Jz@ufkJ?fd^@cJh^(eJ2^$J@,fk)Jk^sfkJk}};^seJ2^$J@JkJ>z>fj-fiJgJ?fd^@cz=^-]J"^$J@,fj)-fiJg^sfj-fiJg}J[}J,fk=Ma^(^i^+4^94]]);fj=^-^c6^+6^96]]JA^*^u711^le@t@u0){JWMa^(^i^+4^94Jifi/2Jk}J,JW^-^c6^+6^96]])-fi/2Jg}}J,JZJW(Ma^(^i^+4^94Ji^-^c6^+6^96]]))/2}JNe@t@u0){cJh^(eJ2^$170]J&i/2^s^-]J"^$170]J&i/2J[}JJP^,J+p^P538J/^=]){^=](@t(c@n^f2JM^,))}J+y^P647]];t^<]^f2JLfy]={ob^5JS,^!}J+rJ`fy);fq^g6JQfr;fq^g6JP^,>0?Ma^(^,,4):0J+o^P523J)n=fo[0^>JQfnJ+tJFJ.c=0,cz,JfJCz^3]()J0J-^yJl^xfpJJ^6dz=f^2^bJB?f^2^bJB():f^2J/dzJU[^\'JI^TJa4JKdz>dk[^\'JI^TJa5]^Mif( Jbof (fp^1])!^h29]J?cc>0^U[1^#J9^pfxJF^ZcJ7^\'^ ^w^\'^ J!dz-dk[^\'^ ^4c@J7_^;^ 723]]+J_^;^ J!fp^1]-J_^;^ ^4JC@p^P621]]JR;t^<]^f2JLd@p]={id:d@p,ob^5641],^!,data@yJ\\InJmcc,x1JD1J]}Jc%500==0^U[J\'^d^%7^n^"976[J\'fqJJb9^B_JI^8^&976J ^SJ J-fv^P726JOc,cJ(o);fw^Efv)J+uJ`d@pJAT){fw^E{xJDJ],ctx:fq,Jb^[35JMsize^[727]],c^LC^LThickness^[728]]})^&976J5^SJ5||^V6J6^SJ6){t^A]^E{chJsype:^j5^XfpJR^_c@n,pJ\\:^`,direJ3fp^1]>=0?1:-1,cJHfn})};}^Q1^#J9^p};bb^f2Jdfw)^Q730J^^3]();^D[163J^}J.@i={sourcJco,dest:^.]^t39^WCallJn:d^f3JMeasing@sunJ3d^f15^b73^W@Jj:0^zc@i;};n^g25^b577^^dk^rdk^t575JK^.JE^Gfz^?]^IJJP^,J+p^P538J/^=]){^=](@t(c@n^f2JM^,))}J+y^P647]];t^<]^f2JLfy]={ob^5JS,^!}J+rJ`fy);fq^g6JQfr;fq^g6JP^,>0?Ma^(^,,4):0J+o^P523J)n=fo[0^>JQfnJ+tJFJ.c=0,cz,JfJCz^3]()J0J-^yJl^xfpJJ^6dz=^V6[JB?f^2^bJB():f^2J/dzJU[^\'JI^TJa4JKdz>dk[^\'JI^TJa5]^Mif( Jbof (fp^1])!^h29]J?cc>0^U[1^#J9^pfxJF^ZJZf@z=JfcJ7^\'^ ^w^\'^ J!dz-dk[^\'^ ^4c@J7_^;^ 723]]+J_^;^ J!fp^1]-J_^;^ ^4JC@p^P621]]JR;t^<]^f2JLd@p]={id:d@p,ob^5641],^!,data@yJ\\InJmcc,x1JD1J]}Jc%500==0^U[J\'^d^%7^n^"976[J\'fqJJb9^B_JI^8^&976J ^SJ J-fv^P726JOc,cJ(o);fw^Efv)J+uJ`d@pJAT){fw^E{xJDJ],ctx:fq,Jb^[35JMsize^[727]],c^LC^LThickness^[728]]})^&976J5^SJ5||^V6J6^SJ6){t^A]^E{chJsype:^j6^XfpJR^_c@n,pJ\\:^`,direJ3fp^1]>=0?1:-1,cJHfn})};}^Q1^#J9^p};bb^f2Jdfw)^Q730J^^3]();^D[163J^}J.@i={sourcJco,dest:^.]^t39^WCallJn:d^f3JMeasing@sunJ3d^f15^b73^W@Jj:0^zc@i;};function I(m@l,m@wJ-mN^a^xm@lJJ^6if(cc==0){mN^Em@l[0])^ZJZmS,mT,m@n;m@n=cc-1;mS=J80?0Jo-1;mT=J8m@l^I-1?m@nJo+1;J;kJp(^Y76Jt^76Jt]J:,y:(^Y76Jq^76Jq]J:};J;vJpm^CJ@+m@k[_^\\/3,y:m^CJ=+m@kJJ^k/3};mN[mN[^Hm@v;m@n=cc;mS=J80?0Jo-1;mT=J8m@l^I-1?m@nJo+1;J;rJp(^Y76Jt^76Jt]J:,y:(^Y76Jq^76Jq]J:};J;yJpm^CJ@-m@r[_^\\/3,y:m^CJ=-m@rJJ^k/3};mN[mN[^Hm@y;mN[mN[^Hm@lJR;^zmN;}n^g25^b578^^dk^rdk^t575JK^.JE^Gfz^?]^IJJP^,J+p^P538J/^=]){^=](@t(c@n^f2JM^,))}J+y^P647]];t^<]^f2JLfy]={ob^5JS,^!}J+rJ`fy);fq^g6JQfr;fq^g6JP^,>0?Ma^(^,,4):0J+o^P523J)n=fo[0^>JQfnJ+tJFJ.c=0,cz,JfJCzJ+@q=[]^3]()Jdk[^\'JI^TJa5]^Mif( Jbof (fp^1])!^h29]J?ccJXfC(f@q);f@q=[];}^ZcJ7^\'^ ^w^\'^ J!dz-dk[^\'^ ^4c@J7_^;^ 723]]+J_^;^ J!fp^1]-J_^;^ ^4JC@p^P621]]JR;t^<]^f2JLd@p]={id:d@p,ob^5641],^!,data@yJ\\InJmcc,x1JD1J]};f@q[f@q[^H^`JN^V6J ^SJ J-fv^P726JOc,cJ(o);fw^Efv)J+uJ`d@pJAT){fw^E{xJDJ],ctx:fq,Jb^[35JMsize^[727]],c^LC^LThickness^[728]]})^&976J5^SJ5||^V6J6^SJ6){t^A]^E{chJsype:^j7^XfpJR^_c@n,pJ\\:^`,direJ3fp^1]>=0?1:-1,cJHfn})};}};fC(f@q);};bb^f2Jdfw)^Q730J^^3]();^D[163J^};function fC(f@qJ-fD=I(~b976[724^b~dataSeriesInJmc@l~,c@zJAT){fq[_$_b~69]](JAT){fq[_$_~976[710^b~[163]]();e@oJJb9~};}J=0J?~e@jJJb97~6[164JOz~}J,if(~69]]()J[~[165JOz,~J-e@o=~}J,cz=~[^}~(^}~]]();JZ~723]]+dk[~cc=0;cc@u~fx=false;~};return ~eJ29~=0J+~_$_JI[~[537]]>0~725]]@b(~(eJ2~{return ~]J4@~z=eSJJ~],e@p)-f~169J^;~z,c@z,e@~]]J+~],eS[_$~;JZf~else {~){JZ~;JZc~]]JN~)>=0||~fh-e@w~SJJb~ction:~;JZe~[703]]~[699]]~z=(dk[~m@n===~JI[1~])/m@w~JZm@~JNf~629]]~JNc~){if(~170]]~)JN~209]]~JZd~:cz,y~]JJ~=true~,font~olor:~b976~[_$_~]]||~2]][~1]],~;if(~]](c~2]]=~0]]=~[cc]~567]~null~@udk~]){f~e@p=~>0){~+e@w~var ~};};~oint~:c@z~]]()~dk[_~=@r(~6[63~type~e:e@~9]](~17]]~c@z;~-e@l~z=Ma~]])+~qase~+e@l~for(~dex:~back~:m@n~={x:~[629~]],e~artT~[170','f@q,2)JHDJ,152]]>0){e@o[J#3JP^<163JP}^i4]](fD[0]J,170]],fD[0^j)^<164]](fD[0]J,170]],fD[0^j)};for(var cc=0;cc@ufDJ,152]]-3;cc+=3){e@oJ,733]](JF1][_$^/1^j,JF2][_$^/2^j,JF3][_$^/3^j)^<733]](JF1][_$^/1^j,JF2][_$^/2^j,JF3][_$^/3^j)};if(cc>0&&cc%3000===0){e@o[J#9JPJ<^-J#4]](JF3][_$^/3^j)^<169JP;fq[J#3JP;fq[J#4]](JF3][_$^/3^j);JK^i9JP^<169JPJKvar c@i^J^)J,^p^K[731]],easin^H76[715^}732^O0^nvar @q=function(e@o,^"f@o,f@h,f@l,f@t,fT,f@n,f@r){if( typeof (f@r)===J#1]){f@r=1};f@o=f@o||0;f@h=f@h||J>[13]JIfE=f@w,f@s=f@m,f@j=f@p,f@x=f@i,f@k,f@y;if(JC>15&&f@i-f@p>15){var fI=8JBvar fI=0.35@bMJ [630]]((JC),(f@i-f@p))}JIfN=J>[734]J?v=J>[735]JIfM=fnJ<^-_$^8p);^:^6]=fM^y682]]=f@r^y649]](f@w,f@p,JC,f@i-f@p)^y682]]=1JH@o>0){var b@x=f@o%2===0?0:0.5J<^-J#2]]=f@o^i0]]=f@hJ<^8p)^y717]](f@w-b@x,f@p-b@x,JC+2@bb@x,f@i-f@p+2@bb@x)^i9JP;};e@^9if(f@l===true){^:)J<^-_$^8p^,](f@w+JNp+fI^,JJ-JNp+fI^,JJ,f@p)^i7JP^P6[736]](^wj+fI,^wj)J/^;_$^mN^6]=fS^i8JP;e@^9}JH@t===true){^:)J<^-_$^8i^,](f@w+JNi-fI^,JJ-JNi-fI^,JJ,f@i)^i7JP^P6[736]](^wx-fI,^wx)J/^;_$^mN^6]=fS^i8JP;e@^9}JHT===true){^:)J<^-_$^8p^,](f@w+JNp+fI^,](f@w+JNi-fI^,](f@w,f@i)^i7JP^P6[736]](fE+fI,(f@i+f@p)/2,fE,(f@i+f@p)/2)J/^;_$^m@v^6]=fS^i8JP;e@^9}JH@n===true){^:)J<^-J#4]JJ,f@p^,JJ-JNp+fI^,JJ-JNi-fI^,JJ,f@i)^P6[736]](f@s-fI,(f@i+f@p)/2,f@s,(f@i+f@p)/2)J/^;_$^m@v^6]=fSJ/^;_$^m@v^6]=fS^i8JP^i7JP;e@^9};};n[J>^x[579]^M e^F]||^)J,392]];va^@^4if(^D^Q^)^h^`^&^ J:^&^ 7J;0-dk^&^ 47^N^3?^3^=]((^u10]]@b0.15),^)J,310]]/dkJM^*J=0.9)^o^%b97^+J1^^0]]^_](dk^%JQJ2^%JQ^aJO^b^*J=^[^7e==J3){gb=gd/dkJM^*J=0.9JBif(gb@uJ0^c^!^\'^f6]J7_$^-_$_J4^0^e^2^1e^t^!^\'^f7]^0^e^2^1J-^\'^|^I^R976[59^4dg++^T76[5J8^S76[2^s^W]^XJM^E^\\976^>for(c^U[152J5^k209]]?dz=f^.^Gdz=f^.J"^%b97^+J)^%b97^+5^B^$b97^L^AJL^%^ J:^%^ ^z^%^ 47^lc@JL^&^ J:^&^ 7J;fp^(-dk^&^ 47^lvar f@w=cJ9b^*J=gb/2)+((dkJ$19]]+dg)@bgb^{m=f@w^qpJ?iJHp^(>=0){f@p=c@z;f@i=gfJH@p>f@i){var cr=f@p;f@p=f@i;f@i=f@p;};JBf@i=c@z;f@p=gfJH@p>f@i){var cr=f@p;f@p=f@i;f@i=f@p;};};f^d^V6^Y[^CJ*$_b^]^"0,null,gc&&(fp^(>=0),(fp^(@u0)&&^rc@n[J(1]J@d@p=c@nJ$21]][cc];J-^\'722]][d@p]={id:d@p,objec^v641],J%JA@l,J&JAc,J.:f@pJ!f@i};fn=@r(d@p);if(T){@q(J-^\'645]],^"JG^5,false)};if(^k703^g703]]||^k699^g699]]){^u94^}274]]({char^v28],J&:fp[cc],J%:c@n,point:{x:f@w+(JC)/2,y:fp^(>=0?f@p:f@i},direction:fp^(>=0?1:-1,bounds:{J.^=J\'J!MJ [195]J\'},color:fn})JK;}^y730]^!^\'645^}730JP}JIga=MJ [630]](gf,dk^&b976[742^}417]J@c@i^J^)J,^p^K[743]],easin^H76[715^}744^Oga^nn[J>^x[584]^M e^F]||^)J,392]];va^@^4if(^D^Q^)JIghJE ggJE cc=0,cz,c@z^`^&^ J:^&^ 7J;0-dk^&^ 47^N^3?^3:^u10]]@b0.15^o^%b97^+J1^^0]]^_](dk^%JQJ2^%JQ^aJO^b^*573^?^[^7e==J3^7b@uJ0^c^!^\'^f6]J7_$^-_$_J4^0^e^2^1e^t^!^\'^f7]^0^e^2^1J-^\'^|^I^R976[59^4dg++^T76[5J8^S76[2^s^W]^XJM^E^\\976^>e@o[J#0]]=J(5];for(c^U[152J5dz=f^.]J,209]]?f^.^Gf^.J"^%b97^+J)^%b97^+5^B^$b97^L^AJL^%^ J:^%^ ^z^%^ 47^lc@JL^&^ J:^&^ 7J;fp^(-dk^&^ 478]]))J?w=cJ9b^*573^?gb/2)+(dkJ,524]]@bgb^{m=f@w^qpJ?iJHp^(>=0)J+h[dz]?ghJ6p=c@z-b@x;f@i=gf-b@x;gh[d^Zelse J+g[dz]?ggJ6i=c@z+b@x;f@p=gf+b@x;gg[d^Z;f^d^V6^Y[^CJ*$_b^]^"0,null,gc&&(fp^(>=0),(fp^(@u0)&&^rc@n[J(1]J@d@p=c@nJ$21]][cc];J-^\'722]][d@p]={id:d@p,objec^v641],J%JA@l,J&JAc,J.:f@pJ!f@i};fn=@r(d@p);if(T){@q(J-^\'645]],^"JG^5,false)};if(^k703^g703]]||^k699^g699]]){^u94^}274]]({char^v550],J&:fp[cc],J%:c@n,point:{x:cz,y:fp^(>=0?f@p:f@i},direction:fp^(>=0?1:-1,bounds:{J.^=J\'J!MJ [195]J\'},color:fn})JK;}^y730]^!^\'645^}730JP}JIga=MJ [630]](gf,dk^&b976[742^}417]J@c@i^J^)J,^p^K[743]],easin^H76[715^}744^Oga^nn[J>^x[585]^M e^F]||^)J,392]];va^@^4if(^D^Q^)JIghJE ggJE cc=0,cz,c@z^`^&^ J:^&^ 7J;0-dk^&^ 47^N^3?^3:^u10]]@b0.15^o^%b97^+J1^^0]]^_](dk^%JQJ2^%JQ^aJO^b^*573^?^[^7e==J3^7b@uJ0^c^!^\'^f6]J7_$^-_$_J4^0^e^2^1e^t^!^\'^f7]^0^e^2^1J-^\'^|^I^R976[59^4dg++^T76[5J8^S76[2^s^W]^XJM^E^\\976^>for(c^U[152J5dz=f^.]J,209]]?f^.^Gf^.J"^%b97^+J)^%b97^+5^B^$b97^L^AJL^%^ J:^%^ ^z^%^ 47^lvar gi;if(dkJ$38]][dz]!==0){gi=fp^(/dkJ$38]][dz]@b100JBgi=0};c@JL^&^ J:^&^ 7J;gi-dk^&^ 478]]))J?w=cJ9b^*573^?gb/2)+(dkJ,524]]@bgb^{m=f@w^qpJ?iJHp^(>=0)J+h[dz]?ghJ6p=c@z-b@x;f@i=gf-b@x;gh[d^Zelse J+g[dz]?ggJ6i=c@z+b@x;f@p=gf+b@x;gg[d^Z;f^d^V6^Y[^CJ*$_b^]^"0,null,gc&&(fp^(>=0),(fp^(@u0)&&^rc@n[J(1]J@d@p=c@nJ$21]][cc];J-^\'722]][d@p]={id:d@p,objec^v641],J%JA@l,J&JAc,J.:f@pJ!f@i};fn=@r(d@p);if(T){@q(J-^\'645]],^"JG^5,false)};if(^k703^g703]]||^k699^g699]]){^u94^}274]]({char^v551],J&:fp[cc],J%:c@n,point:{x:cz,y:fp^(>=0?f@p:f@i},direction:fp^(>=0?1:-1,bounds:{J.^=J\'J!MJ [195]J\'},color:fn})JK;}^y730]^!^\'645^}730JP}JIga=MJ [630]](gf,dk^&b976[742^}417]J@c@i^J^)J,^p^K[743]],easin^H76[715^}744^Oga^nn[J>^x[580]^M e^F]||^)J,392]];va^@^4if(^D^Q^)^h^`^&^ J:^&^ 7J;0-dk^&^ 47^N^3?^3^=]((^u11]]@b0.15),^)J,311]]/dkJM^*J=0.9)^o^%b97^+J1^^1]]^_](dk^%JQJ2^%JQ^aJO^b^*J=^[^7e==J3){gb=gd/dkJM^*J=0.9JBif(gb@uJ0^c^!^\'^f6]J7_$^-_$_J4^0^e^2^1e^t^!^\'^f7]^0^e^2^1J-^\'^|^I^R976[59^4dg++^T76[5J8^S76[2^s^W]^XJM^E^\\976^>e@o[J#0]]=J(5];for(c^U[152J5^k209]]?dz=f^.^Gdz=f^.J"^%b97^+J)^%b97^+5^B^$b97^L^A@JL^%^ J:^%^ ^z^%^ 47^lcJL^&^ J:^&^ 7J;fp^(-dk^&^ 47^lvar f@p=(c@J9b^*J=gb/2)+((dkJ$19]]+dg)@bgb)^{i=f@p^qwJ?mJHp^(>=0){f@w=gf;f@m=cz;JBf@w=cz;f@m=gf;};f^d^V6^Y[^CJ*$_b^]^"JD^rfals~b976[724^}~]();if(T){J-~f@w,f@p,f@m,f@i,fn,~^B ~ typeof (fp[cc][_$_~J,462]][_$_~J,463]][_$_~976[430^}~[cc^j~thisJ,405]]~976[739^}~6[626^}63~)^i5]~_JO163]]();e@o[~p[cc]J,170]~_b976[170]],JF~](epJ,414]]~epJ,311]]);~,epJ,310]],~thisJ,738]]~8^}152]];~,false,false,false~)^y159]~){gb=gdJBif(g~_JO164]](f@w,f@~oJ,730]]();~e@oJ,716]](~76[737]](0,fM);fS[~;if(T){fqJ,~:MJ [630]~[740]]?true:false;~^}152]]@b~r fz=dkJ,59~[29]){continue };c~]]){continue };if(~523]][cc%c@nJM9~fz@u=0){return };v~976[152]]>0){var g~@o=dkJ,575]~]J,209]]():~g@sunction:dJM9~6[718JP;};for(va~={source:e@o,dest:~Callback:d[J>~6[629]])!==J>~]=function(dk){var~8]]))@u@u0JIgd=~]],animation@qase:~JIfS=e@o[_$_b97~ar fn=nullJIep=~r dg=0;dg@udkJM~var c@n=J-9~){var c@l=dkJM9~c=0;cc@ufp[J>~22]]?fp[cc]JM97~p=c@nJ,538]~;var ft=trueJHp~[522]]:c@n[J>~z]=b@x+(f@i-f@p);}~0.9)@u@u0;if(gb>gd~c=(gb>5)&&c@nJM~976[152]]];@q(e@o,~b=(((epJ,31~/MJ [263]~JIdzJIgf=(dk~[478]]))@bMath[_$_~263]](ge))/dkJM~}^y716]~n=^k5~,epJ,415]]~^|6[71~]]||c@nJ,~JIcc=0,cz,c@z~^y16~]J$29]]~fp[cc]J,~8]])+0.5)@u@u0;~_JO737]](1,f~};return c@i;};~@u@u0JIge=dk~392]],animation~+gb@u@u0J?~gc,false,false,~82]][c@l]JIf~@oJ,718]~thisJ,3~tType:J>[~(f@m+f@w)/2,f@~[125]][J>~;e@oJ,~7J;dz-dk~)@u@u0J?~645]]JM97~]]J,~ath[J>~,x2:f@m,y2:~];if(dz@udk~J>[16~J,6~dataSeries~data@yoint~](f@p,f@i)~J>[74~4]]||dz>dk~76[523]][_~{var b@x=g~[J>[~thisJM~x1:f@w,y1~;fSJM9~1){gb=1}}~1]]JIg~[480]]-dk~=Infinity~JO717]~]];cc++){~[dz]:0;f@~]()};e@o[~98]][dg];~z-(dk[_$_~723]]+dk~25]]@b(~;e@o[_$~617]]@b~_$_JQ~JIf@~])JI~Index:c~}else {~f@m-f@w~JG,~=[];var~fD[cc+~0,null~;if(f~;var ~](f@m~};};}~z=(dk~[_$_b~fI,f@~JQ[~]]()~b976','e,c^k);^9J-^0J*^6^.JQ^-,dat^4f@wJ#f@mJ2;fn^r@q(^w^#,fJR^:^=JJ)}^/^;^M76^5^H6[39^<^I49]JO^G^K^$]>=0?f@m:f@w,y:f@p+(f@i-f@p)/2^F_$_^@bounds:{x1:MathJ,630]](J5J#^2J5J2,c^x^J]^(JX^#[^bJIa=^2gf,d^"JP742]]J!6]]);vJ\'^A$J7^7^?_J/46]],^D$_b^844^XgaJV^L[^l6J&^Bb9J6^N]JW^EJ,5^\'JG^Cn=null;JTp=t^o];JIhJ4gg=[]^q^c^!^ JD^!^ J.0-d^!^ 478]]))@u@J:d=^f]?^f]:^w311]]@b0.15@u@J:e=d^"b9^&1]];JIb=(((epJ,311]]/^i](d^"b9J1-d^"b9J3))@b^i](ge))/dkJ,739]J*57^^@b0.9)@u@u0;if(gb>gd^]e===Infinity^]b@u1){gb=1}}};eJ"716]^(JX^#J,716^y^1_bJ0^)epJ!5^*^+eJ"718]^(JX^#J,717]^)epJ!5^*^+^w^#^aJ+^\\6[5^\'^e_$^Z^[[282]][c^OJ<]JEtJK;JL^WJIc=(gb>5)&&^{740]]?true:JJ^j]=_J/45]JScc=0;J=^Y{dz=f^%^u?f^%^u():f^%;JA^"b9^&4J;^"b9^&5J8^T^$]^hcJB};c@z=(d^"^ JD^"^ ^|^"^ ^_cz=(d^!^ JD^!^ J.^$]-d^!^ 478]]))JE@p=c@z-J$[739]J*57^^@bgb/2)+J$[524]]@bgb)^}i=f@p+gb^}wJE@m;if(^$]>=0){vJ9h[dz]?gh[dzJCgf+J>cz+b@x;gh[^Pelse {vJ9g[dz]?gg[dzJCcz-J>gf-b@x;gg[^P;fn=f^g]]?f^g]]:cJ?76^S76[52^^];@q(e@o,fJR^:,gc^=c^k);^9J-^0J*^6^.JQ^-,dat^4f@wJ#f@mJ2;fn^r@q(^w^#,fJR^:^=JJ)}^/^;^M76^5^H6[39^<^I52]JO^G^K^$]>=0?f@m:f@w,y:c@z^F_$_^@bounds:{x1:MathJ,630]](J5J#^2J5J2,c^x^J]^(JX^#[^bJIa=^2gf,d^"JP742]]J!6]]);vJ\'^A$J7^7^?_J/46]],^D$_b^844^XgaJV^L[^l7J&^Bb9J6^N]JW^EJ,5^\'JG^Cn=null;JTp=t^o];JIhJ4gg=[]^q^c^!^ JD^!^ J.0-d^!^ 478]]))@u@J:d=^f]?^f]:^w311]]@b0.15@u@J:e=d^"b9^&1]];JIb=(((epJ,311]]/^i](d^"b9J1-d^"b9J3))@b^i](ge))/dkJ,739]J*57^^@b0.9)@u@u0;if(gb>gd^]e===Infinity^]b@u1){gb=1}}};eJ"716]^(JX^#J,716^y^1_bJ0^)epJ!5^*^+eJ"718]^(JX^#J,717]^)epJ!5^*^+^w^#^aJ+^\\6[5^\'^e_$^Z^[[282]][c^OJ<]JEtJK;JL^WJIc=(gb>5)&&^{740]]?true:JJ^j]=_J/45]JScc=0;J=^Y{dz=f^%^u?f^%^u():f^%;JA^"b9^&4J;^"b9^&5J8^T^$]^hcJB};c@z=(d^"^ JD^"^ ^|^"^ ^_JIi;ifJ$[638]][dz]!==0){gi=^$]/dkJ,638]][dz]@b100}else {gi=0};cz=(d^!^ JD^!^ J.gi-d^!^ 478]]))JE@p=c@z-J$[739]J*57^^@bgb/2)+J$[524]]@bgb)^}i=f@p+gb^}wJE@m;if(^$]>=0){vJ9h[dz]?gh[dzJCgf+J>cz+b@x;gh[^Pelse {vJ9g[dz]?gg[dzJCcz-J>gf-b@x;gg[^P;fn=f^g]]?f^g]]:cJ?76^S76[52^^];@q(e@o,fJR^:,gc^=c^k);^9J-^0J*^6^.JQ^-,dat^4f@wJ#f@mJ2;fn^r@q(^w^#,fJR^:^=JJ)}^/^;^M76^5^H6[39^<^I53]JO^G^K^$]>=0?f@m:f@w,y:c@z^F_$_^@bounds:{x1:MathJ,630]](J5J#^2J5J2,c^x^J]^(JX^#[^bJIa=^2gf,d^"JP742]]J!6]]);vJ\'^A$J7^7^?_J/46]],^D$_b^844^XgaJV^L[^l1J&^Bb9J6^N]JW^EJ,5^\'JG^Cq=^w^#;JTs=d^"^sgj=d^!^sfwJ4ep=t^o^z[716]]()^U716^y^1_bJ0^)epJ!5^*^+e@o^aJ(^>_bJ0^)epJ!5^*^+fq^aJ+^\\6[5^\'^e_$^Z^[[282]][c^OJ<]JEy=^{647]^0J*722]][fy]={^.567],^-}JEr=@r(fy);fqJ,159]]=fr;fwJ4ftJK^q^c^!^ JD^!^ J.0-d^!^ ^_JIk;JIm=null;JL^Wvar fn=cJ?76^S76[52^^^z[159]]=fn^j]=fn;eJ"162]]=^`;if(^p]){^p](@t(^{721]],^`))}JExJKJS;J=^Y{dz=f^%^u?f^%^u():f^%;JA^"b9^&4J;^"b9^&5J8^T^$]^hgl();fxJK;cJB;};cz=(d^"^ JD^"^ ^|^"^ ^_c@z=(d^!^ JD^!^ J.^$]-d^!^ ^_if(ft||fx){e@o[_$_^1^Q;gm=J%JNT){fq[_$^>^Q;};ft=JJ;fx=JJ;}else {^Vcz,c@z)^U165]](cz,c@z)JNcc%250==0){gl()};};^9J-^0J*^6^.JQ^-,dat^4cz,y1:c@z}^/JM!==0){JL[ccJ*JM>0||^{JM>0){var fv=^{726]](cc,cz,c@z,e@o);fwJ,274]](fv)JEu^rfwJ,274]](J%,ctx:fq,typJ [351]],sizJ [727]],c^vC^vThickness:fvJ,728]]})};}}^/^;^M76^5^H6[39^<^I28]JO^G^Kcz,y:c@z^F_$_^@c^xgl();bbJ,729]](fw);^J]^(JX^#[^bfunction gl(){if(!gm){return JN^`>0){eJ"169]]()JNd^!b9J3@u=0&&d^!b9J1>=JFgf}elJ@^!b9J1@uJFgjJ!5]]}elJ@^!b9J3>JFesJ!7]]}}};^Vcz,gk);^Vgm^3e@o[^t^d]=c^k;e@o^n^d]=1^U165]](cz,gk);fqJ,165]](gm^3fq[^t;fq^n;};e@o[_$_^1^Q;fq[_$^>^Q;gm=J%};}vJ\'^A$J7^7^?_J/31]],^D$_b^832^X0JV^L[^l3J&^Bb9J6^N]JW^EJ,5^\'JG^Cq=^w^#;JTs=d^"^sgj=d^!^sfwJ4ep=t^o^z[716]]()^U716^y^1_bJ0^)epJ!5^*^+e@o^aJ(^>_bJ0^)epJ!5^*^+fq^aJ+^\\6[5^\'^e_$^Z^[[282]][c^OJ<]JEy=^{647]^0J*722]][fy]={^.567],^-}JEr=@r(fy);fqJ,159]]=fr;fwJ4ftJK^q^c^!^ JD^!^ J.0-d^!^ ^_JIk;JIm=nullJE@q=[];JL^WJU=cJ?76^S76[52^^^z[159]]=JU^j]=JU;eJ"162]]=^`;if(^p]){^p](@t(^{721]],^`))}JS;J=^Y{dz=f^%^u?f^%^u():f^%;JA^"b9^&4J;^"b9^&5J8^T^$]^hif(cc>0){gn();f@q=[];};cJB;};cz=(d^"^ JD^"^ ^|^"^ ^_c@z=(d^!^ JD^!^ J.^$]-d^!^ ^_^9J-^0J*^6^.JQ^-,dat^4cz,y1:c@z};f@q[f@q[_J)]]=J%}^/JM!==0){JL[ccJ*JM>0||^{JM>0){var fv=^{726]](cc,cz,c@z,e@o);fwJ,274]](fv)JEu^rfwJ,274]](J%,ctx:fq,typJ [351]],sizJ [727]],c^vC^vThickness:fvJ,728]]})};}}^/^;^M76^5^H6[39^<^I30]JO^G^Kcz,y:c@z^F_$_^@JU:JU})};};gn();bbJ,729]](fw);^J]^(JX^#[^bfunction gn(){var fD=I(f@q,2);if(fD^We@o[_$_^1_JP164JH0^,0^m;if(T){fq[_$^>_JP164JH0^,0^m;}JSvar cc=0;cc@ufD[_J)]-3;cc+=3){eJ"733JHcc+1^,cc+1][_^R2^,cc+2][_^R3^,cc+3^m^U733JHcc+1^,cc+1][_^R2^,cc+2][_^R3^,cc+3^m};JN^`>0){eJ"169]]()JNd^!b9J3@u=0&&d^!b9J1>=JFgf}elJ@^!b9J1@uJFgjJ!5]]}elJ@^!b9J3>JFesJ!7]]}}};gm={x:fD[0J*170]],y:fD[0J*629]]};^VfD[fD[_J)]-1]^3^Vgm^3e@o[^t^d]=c^k;e@o^n^d]=1^U165JHfD[_J)]-1]^3fqJ,165]](gm^3fq[^t;fq^n;};};}vJ\'^A$J7^7^?_J/31]],^D$_b^832^X0JV^L[^l2J&^Bb9J6^N]JW^EJ,5^\'JG^Cq=^w^#;JTs=dkJ,462]][_~b976[724]J*~kJ,463]][_$_~kJ,462]][_$_~430]J*645]]~fp[ccJ*629]~p[ccJ*170]]~76[626]J*63~98]][_J)];~]();if(T){thisJW~](epJ!4]],~]],epJ,310]]~,epJ,311]]);~J*170]],fD[~dataSeriesIndex:c@l~objectType:_$_JP~;if(fp[ccJ*~];^w430]~JP163]]();e@o[_$~MathJ,195]](~J,170]],gk);~a@yointIndex:cc,x1:~[699]]||cJ?76~722]][d@p]={id:d@p,~5]J*392]],a~976[715]J*7~var d@p=cJ?76~p,f@m,f@i,fn,0,null~703]]||^{~4]J*274]]({~,JJ,JJ,JJ,~_JP163]]();fq[_$~nimationCallback:d[~JP629]]>=0?1:-1,~rce:e@o,dest:this[_~(dk){JT@o=dk[_$_~u=0){return }JE~easing@sunction:d[_~976[392]]JEz=dk~},direction:fp[cc][~@yoint:fp[cc]JOS~[699]]){thisJW97~chartType:_$_JP5~};};eJ"730~eries:c@n,point:{x:~urn c@i;};nJW976~703]]||fp[cc]JW9~||t^o~@l]JEp=c@n[_$_b~dz]=b@x+(f@m-f@w);}~_JP164]](cz,c@z)~$_JP629]],fD[cc+~[523]][cc%cJ?~inue JN typeof (~;J(_b976[~eJ"165]](~[_J)]>0){~]],animation@qase:~J)];cc++)~_JP598]][dg];va~r c@n=thisJW976~dg=0;dg@udkJW97~){gb=gd}else {if(g~3]][_J)]~478]])+0.5)@u@u0;~^{719]]~J,718]]();~_J/30]]()};~;var dz;JIf=(d~;eJ"682]~dg++){var c@l=dk[~^w738]~p[ccJ*522~)!==_$_JP29]){~MathJ,263]~;eJ"160]~@nJ,741]]~125]J*58~J*629]])~J,168]]()~hisJ,405]~eJ"720]~;var cc=0,cz,c@z~=@r(d@p);if(T){~JP674]];var ~_$_JP167]]()~J,209]]~olor:fu,border~thisJ,~olor:fn})};};~]]()};e@o[_$_~];e@oJW976~c@nJ,~J.dz-d~@u@u0JE@~e:fvJW976~J,41~@oJ,~,y1:f@p,x2:~(dkJW976~{x:cz,y:c@z~]]=function~ar c@i={sou~if(T){fq[_$~$_JP152]~]J,~}JSvar ~[_$_JP~[621]][cc~725]]@b(~$_JP7~JX717]~76[480]]~,y2:f@i}~76[478]]~=[];var ~fJRm)~76[575]]~_JP40~]]){cont~ar b@x=g~u0;JI~]]||dz>d~JX538]~cc@ufp[_~b@x;f@m=~@nJW9~se {if(d~if(dz@ud~ontinue ~]:0;f@w=~723]]+d~;var f~0){gk=~if(fz@~]](fD[~var g~false~=true~if(fp~537]]~};if(~,data~bJX~641],~@w,f@~;for(~var e~color~};ret~[_$_b~976[','$_J8674^vj=d^!J8674^ww=[];^>[405]];e^[716]](^)716^V^$J=^j^F^h5^*,ep^Ie@o^G^a^,J=^j^F^h5^*,ep^Ifq^G};for^4J@^(^/^g98]]^0$_b^l^1^Ky=^W647]];^t^%J-fy]={^6567^7@lJ%fr=@r(fy)^`[159]]=fr;fw^yftJ<^P^A^!^ J$^!^ ^u0-d^!^ 47^DgkJ(mJ.J9x=J?JAfp^O>0J/fn=^W523]][cc%^W523]]^O];e^[159]^50]^52]]=^W719J)e^[720]]){e^[720]](@t(^W721]],^W719]]))};for(;cc@ufpJ>^8f^#^e09]]?f^#^e09]]():f^#^s^"^E[^b^"^E^;J9@z=c@zJA typeof (^3])!=^Qgl();fxJ<;continue ;};cz=(d^"^ J$^"^ ^udz-d^"^ J&+0.5J*;c@z=(d^!^ J$^!^ ^u^3]-d^!^ J&+0.5J*JAft||fx){e@o[_$_^$J@^i,c@z);gm={^d^xq[_$^,_b9^2ft=J?;fx=J?;}J+e@o[^J,f@z^)J,cz,f@z)};e@o[^J^+976[J,J3)J7cc%250==0){gl()};J%d@p=^W621]][cc];^t^%J-d@p]={id:d@p,^6641^7@l^_Index:cc,x1:cz,y1:c@zJ7^M537]]!^{^M5J4||^W5J4){v^m_^LJ3,e@o);fw^eJ:fv);J9u=@r(d@p)^xw[_$_^.c@z,ctx:fq,typ^^6[351]],siz^^6[727]]J u,borderColor:fu,borderThickness:fv^f28]]})};}J7^M703^N[703]]||^M699^N[699]]){^S394]]^eJ:{chartType:J\'6[529]^_:fp[cc],dataSeries:c@n,point:{^d,direJ5^3]>=0?1:-1J n})};};gl();bb^f29]](fw);};};e^[J0)JAT){^t^%64^][J0)};^} gl(){if(!gm)^qif(^W^96[169]]()J7d^!J8478]]@u=0&&d^!^n>=0){gk=gf^pd^!^n@u0){gk=gj[^h5]]^pd^!J8478]]>0){gk=es[^h7]]}}};e@o[^J,gk);e^[J,gm^r170]],gk);e^[167]]^\'J1_^H^k8]]^\']=1^xq[^J,gk)^`[J,gm^r170]],gk)^`^:[168]]();}^z^$J@^i,c@z);fq[_$^,J@^i,c@z);gm={^d;}var c@i={source:e@o,dest:^S^Y6[39^UCallback:d^f31]],easing@sunJ5d^f1^][73^U@qase:0};return c@i;};n^r12^][588]]=^}(dkJ/e@o=dk^g75]]||^S^Y6[392^wz=dk[J\'^(J)fz@u=0)^qJ9nJ.J9w=[];^>[405^vr^ygo=[]^P^A^!^ J$^!^ ^u0-d^!^ J&)^ce=d^"^E[631^wq=^t^%645]]^xq[^k3^VJ8716]](^)716^V^$J=^j^F^h5^*,ep^Ie@o^G^a^,J=^j^F^h5^*,ep^Ifq^G};x@lalue@yresent=[];for^4J@^(^/^g98]]^0$_b^l^1J8538^vt;^W747]]=[]^Rfp^O;cc++){gt=f^#^e09]]?f^#^e09]]():f^#;^W747]][gt]=ccJA!^C){go^eJ:gt);^CJ<;};};go^g41]](q);};for^4J@^(^/^g98]]^0$_b^l^1^KtJ0){fn=^W523]][0];e^[159]^50]^52]]=^W719J)e^[720]]){e^[720]](@t(^W721]],^W719]]))}^RgoJ>^8go[cc]J(qJ.if(c@^&>=0){gq=fp[c@^&]}J+gq={x:dz,y:0}J7dz@ud^"^E[^b^"^E^;^Z^\\J;)!=^Qcontinue J%cz=(d^"^ J$^"^ ^udz-d^"^ 47^Dc@z=(d^!^ J$^!^ ^u^\\J;-d^!^ J&);var b@x=J2?J2:0;c@z=c@z-b@x;gp[_$_^.g^|J2=gf-c@zJAft){e@o[_$_^$J@^i^+976[163]]();fqJ>9^2ft=J?;}J+e@o[^J^+976[J,J3)J7cc%250^{^W^9J6^B76[152^=b976^<6[1^T^-[J;^)1^T^-^@9J#^\'J1_^H^k8]]^\']=1^z^$J@^i^+976^:[1^o_$^,_b9^2gp[_$_^.g^|}J"^&>=0J/d@p=^W621]][c@^&];^t^%J-d@p]={id:d@p,^6641^7@l^_Index:c@^&,x1:cz,y1:c@z}J"^&>=0&&^\\537]]!^{^\\5J4||^W5J4){v^m_^LJ3,e@o);fw^eJ:fv);markerColor=@r(d@p)^xw[_$_^.c@z,ctx:fq,typ^^6[351]],siz^^6[727]],color^?Color^?Thickness:fv^f28]]})};}J7^\\703^N[703]]||^\\699^N[699]]){^S394]]^eJ:{chartType:J\'6[531]^_:gq,dataSeries:c@n,point:{^d,direJ5^3]>=0?1:-1J n})};J7^W^9J6^B76[152^=b976^<6[1^T^-[J;^)1^T^-^@9J#^\'J1_^H^k8]]^\']=1^z^$J@^i^+976^:[1^o_$^,_b9^2};delete (^W747]]);};bb^f29]](fw);e^[J0^)J0)J%c@i={source:e@o,dest:^S^Y6[39^UCallback:d^f31]],easing@sunJ5d^f1^][73^U@qase:0};return c@i;};n^r12^][589]]=^}(dkJ/e@o=dk^g75]]||^S^Y6[392^wz=dk[J\'^(J)fz@u=0)^qJ9nJ.^>[405^ww^ygr^ygo=[]^P^A^!^ J$^!^ ^u0-d^!^ J&)^cd=^S738]]?^S738]]:^S310]]@b0.15^ce=d^"^E[631^vb=(((ep^r310]]/^X[263]](d^"^n-d^"J8J&)@b^X[263]](ge))@b0.9J*;J9q=^t^%645]];e^[716]](^)716^V^$J=^j^F^h5^*,ep^Ie@o^G^a^,J=^j^F^h5^*,ep^Ifq^G};x@lalue@yresent=[];for^4J@^(^/^g98]]^0$_b^l^1J8538^vt;^W747]]=[]^Rfp^O;cc++){gt=f^#^e09]]?f^#^e09]]():f^#;^W747]][gt]=ccJA!^C){go^eJ:gt);^CJ<;};};go^g41]](q);};for^4J@^(^/^g98]]^0$_b^l^1^KtJ<;J9y=^W647]];^t^%J-fy]={^6567^7@lJ%fr=@r(fy)^`[159]]=frJAfp^O==1J!JAgb@u1){gb=1^pgb>gdJ!J%gp=[]JAgo^O>0){fn=^W523]][cc%^W523]]^O];e^[159]^50]^52]]=^W719J)e^[720]]){e^[720]](@t(^W721]],^W719]]))J%gc=(gb>5)?J?:J?^RgoJ>^8go[cc]J(qJ.if(c@^&>=0){gq=fp[c@^&]}J+gq={x:dz,y:0}J7dz@ud^"^E[^b^"^E^;^Z^\\J;)!=^Qcontinue J%giJAdk^r638]][dz]!==0){gi=^\\J;/dk^r638]][dz]@b100}J+gi=0J%cz=(d^"^ J$^"^ ^udz-d^"^ 47^Dc@z=(d^!^ J$^!^ ^ugi-d^!^ J&);var b@x=J2?J2:0;c@z=c@z-b@x;gp[_$_^.g^|J2=gf-c@zJAft){e@o[_$_^$J@^i^+976[163]]();fqJ>9^2ft=J?;}J+e@o[^J^+976[J,J3)J7cc%250^{^W^9J6^B76[152^=b976^<6[1^T^-[J;^)1^T^-^@9J#^\'J1_^H^k8]]^\']=1^z^$J@^i^+976^:[1^o_$^,_b9^2gp[_$_^.g^|}J"^&>=0J/d@p=^W621]][c@^&];^t^%J-d@p]={id:d@p,^6641^7@l^_Index:c@^&,x1:cz,y1:c@z}J"^&>=0&&^\\537]]!^{^\\5J4||^W5J4){v^m_^LJ3,e@o);fw^eJ:fv);markerColor=@r(d@p)^xw[_$_^.c@z,ctx:fq,typ^^6[351]],siz^^6[727]],color^?Color^?Thickness:fv^f28]]})};}J7^\\703^N[703]]||^\\699^N[699]]){^S394]]^eJ:{chartType:J\'6[532]^_:gq,dataSeries:c@n,point:{^d,direJ5^3]>=0?1:-1J n})};J7^W^9J6^B76[152^=b976^<6[1^T^-[J;^)1^T^-^@9J#^\'J1_^H^k8]]^\']=1^z^$J@^i^+976^:[1^o_$^,_b9^2};delete (^W747]]);};bb^f29]](fw);e^[J0^)J0)J%c@i={source:e@o,dest:^S^Y6[39^UCallback:d^f31]],easing@sunJ5d^f1^][73^U@qase:0};return c@i;};n^r12^][590]]=^}(dkJ/e@o=dk^g75]]||^S^Y6[392^wz=dk[J\'^(J)fz@u=0)^qJ9nJ.^>[405]]^P^A^!^ J$^!^ ^u0-d^!^ J&)^cd=^S738]]?^S738]]:^S310]]@b0.15^ce=d^"^E[631^vb=(((ep^r310]]/^X[263]](d^"^n-d^"J8J&)@b^X[263]](ge))/fz@b0.9J*;e^[716]]()JAT){^t^%64^][716^V^$J=^j^F^h5^*,ep^Ie@o^Gif(T){^t^%64^]^j^F^h5^*,ep^I^t^%645]]^GJ%gw=-InfinityJ(y=Infinity;for^4J@^(^/^g98]]^0$_b^l^1J8538^v@z=0;for(var cc=0;cc@ufpJ>^8^M209]]?dz=f^#^e09]]():dz=f^#^s^"^E[^b^"^E^;^Z^M264]])!==^k1]){g@z=^M264J)g@z>gw){gw=g@zJ7g@z@ugy){gy=g@z};};};J%gx=^X[748]]@b5@b5J(v=^X[195]](^X[271]](^X[630]](ep^r311^*)@b0.25/2,2)@b^X[748]],gx);for^4J@^(^/^g98]]^0$_b^l^1^KtJgdJ!J7fp^O>0){e^[160]]=J\'6[745];for(var cc=0;cc@ufpJ>^8^M209]]?dz=f^#^e09]]():dz=f^#^s^"^E[^b^"^E^;^Z^3])!=^Qcontinue };cz=(d^"^ J$^"^ ^udz-d^"^ J&+0.5J*;c@z=(d^!^ J$^!^ ^u^3]-d^!^ 47^Dg@z=^M264^vu=(gw===gy)?gv/2:gx+(gv-gx)/(gw-gy)@b(g@z-gy)J(z=^X[195]](^X[749]](gu/^X[748]]J*,1);var dS=gz@b2;v^m_^Le@o);fv^f27]]=dS;e^[682]J1J\'~b976[724]]^r~k^r463]][_$_~k^r462]][_$_~p[cc]^r170]]~J8163]]();e@o[_$~b976[430]]^r~n^f47]][dz]~();e^[682]~6[598]]^r152~);^a_b976[~]],ep^r310]]~,c@z);^a_b~_J8163]]();fq[_$~76[170]],gs[J\'6~J8274]]({x:cz,y:~]];dg++J/c@l=dk~[dg];var c@n=this[_~c@l];J9p=c@n[_$_~7^i,c@z);};~^M629]~(var dg=0;dg@udk[_$~]=fn;e^[16~objectType:J\'6[~],dataSeriesIndex:c~976[152]];cc++){dz=~719]]>0){e@o[J\'~[167]]()^`~[635]]){continue };~[259]]()^zb97~]]>0J/gs=gp[_$_~var ep=^tb976~:markerColor,border~[629]])};}^zb~@z;var dzJ(f=(d~]()};while(gpJ>9~x@lalue@yresent[gt]~8]])+0.5J*;var ~b976[626]][J\'6~^h4]],ep[~^f18]]();~$_J8741]];e@o[~^r311]]);~^k5]](cz~b976[538^w~$_J8726]](cc,~fp[cc]^r~]]||c@n[J\'6~^r152]]~;var cc=0,cz,c~=J\'6[29]){~;for(cc=0;cc@u~this^r~65]](gsJ>9~2]],animation~]]()}^z~c@n^r~Math[J\'6~405]][J\'~if( typeof (~@o^r~gq^r~5]][J\'6~e:fv[J\'~,data@yoint~;fq[J\'6~if(T){fq[_$~634]]||dz>d~@u@u0J(~x:cz,y:c@z}~^r2~^r7~^r5~J\'6[41~6[164]](cz~[717]](ep[~J\'6[16~976[282]][~ar fv=c@n[~J8480]]~68]]();fq[~}J+if(~{return };~[J\'6[~JAdz@ud~this[_$_~725]]@b(~]]J(~]];J9~JAT){f~=[];var ~;e@o[_$_~==0){if(~f-b@x});~function~,color:f~){gb=gd}~;J7c@~76[167]]~723]]+d~};var ~478]])~_$J@~;var g~]]JA~)@u@u0~else {~165]](~722]][~=null;~){var ~730]](~]=c@n[~gr[dz]~cz,c@z~37]]>0~ction:~6[169]~}JA~b976[~var f~74]](~629]]~=true~J@6~[_$_b~false~_b97~;if(','6[741]];bb^z51]](cz,c@z,e@o,fvJ JD,^F,fvJ 522^\\750^\\728]])^d682]]=1;va^@[6^?b^+^^^0^M^/^%cz,y1:c@z,size:dSJ2uJ6JHT){bb^z51]](cz,c@z,J!^+645^\\JD,^F,fu,fu,fv^z28]])JG^Q703^T[703]]||^Q699^T[699]]){t^LJ.^\'J#40]^W^(J$cz,y:c@z^j^ecz-^F/2,y1:c@z-^F/2,x2:cz+^F/2,y2:c@z+^F/2^l}JI^VJE^9^+^PJE)}JCc@i={source:e@o,dest:^2^S^{Callback:^g3]],easing@sJ0:^g^h714]]^{@qase:0};J1c@i;};nJ 12^h591]]=fJ0(dkJ=e@o=dkJ 575]]||^2^SJCfz=^4^]if(fz@u=0){J1J2n=^o^2Jgd){gb=gd}JG^G>0){e@oJ 160]]=_$J?745J(Ma^5^2]^u0]],^2]^u1]]))){continue };va^@[6^?b^+^^^0^M^/^%cz,y1:c@zJ2uJ6JHT){bb^z51]](fvJ 170^\\629]],J!^+645^\\JD,^F,fu,fu,fv^z28]])JG^Q703^T[703]]||^Q699^T[699]]){t^LJ.^\'J#39]^W^(J$cz,y:c@z^j^ecz-^F/2,y1:c@z-^F/2,x2:cz+^F/2,y2:c@z+^F/2^l};g@q=cz;gC=c@zJI^VJE^9^+^PJE)}JCc@i={source:e@o,dest:^2^S^{Callback:^g3]],easing@sJ0:^g^h714]]^{@qase:0};J1c@i;};nJ 12^h593]]=fJ0(dkJ=e@o=dkJ 575]]||^2^SJCfq=J!^+645]J0J=gc=(gb>5)&&^c40]]?true:JFJLJ-^G;JB^QJ7^7170]J8^s^7^Y^*JO^3^|^*JO^35]^Cfp[^1===null||!fp[^1[_^k||^#b^i)!^X^#b^v])!^X^#b^}2])!^X^#b^}3^r^DcJK^*^ J/k^*^ ^f^*^ ^)p=(d^!^ J/^!^ ^"^i-d^!^ ^)i=(d^!^ J/^!^ ^"^v]-d^!^ ^f@p^wf@i,x3:cz,y3:gD,x4:cz,y4:gE,borderThickness:f@o,color:fn}^d160]]=fn;e@o[_$_^$J?162]]=f@o;fqJ 162]]=Ma^6f@o,4JHc@nJ JD===J#35]){e@o[_$_b^>f@iJ"^-Ma^5fJA^J9]](J"b^>Ma^6fJAJ"^-gD^J9]]();@q(e@o,f@w,Ma^5J*@m,Ma^6J*p[^1[0]@u=fp[^1[3]?^c52]]:fn,f@o,fn,gc,gcJ;JF,^c41]]JHT){fnJ6^R0]]=fnJ4b^>f@i)J4^-Ma^5fJA^A]()J4b^>Ma^6fJA)J4^-gD^A]();@q(fq,f@w,Ma^5J*@m,Ma^6J*n,0,null^.,JF);};}J,c@nJ JD===J#36]){e@o[_$_b^>f@iJ"^-gD^J9]](J"^$J?16J:f@p^J5]](J5^J9]](J"^$J?16J:gE^J5]](f@m,gE^J9^qnJ6^R0]]=fnJ4b^>f@i)J4^-gD^A](^R3]](^RJ:f@p^R5]](J5^A](^R3]](^RJ:gE^R5]](f@m,gE^A]();};}JG^Q703^T[703]]||^Q699^T[699]]){t^LJ.^\'c@nJ JD^W^(J$f@w+(f@m-f@w)/2,y:f@i^j^efJ>Ma^5f@i,gD)^wMa^6f@i,gD)^l}JI^V30^qq^zJE)}JCc@i={source:e@o,dest:^2^S^{Callback:^g3]],easing@sJ0:^g^h714]]^{@qase:0};J1c@i;};nJ 12^h594]]=fJ0(dkJ=e@o=dkJ 575]]||^2^SJCfz=^4^]if(fz@u=0){J1J2n=^o^2J0J=gc=(gb>5)&&^c40]]?true:JFJLJ-^G;JB^QJ7^7170]J8^s^7^Y^*JO^3^|^*JO^35]^Cfp[^1===null||!fp[^1[_^k||^#b^i)!^X^#b^v^r^DcJK^*^ J/k^*^ ^f^*^ ^)p=(d^!^ J/^!^ ^"^i-d^!^ ^)i=(d^!^ J/^!^ ^"^v]-d^!^ ^f@iJ=cr=f@p;f@p=f@i;f@i=cr;};va^@[6^?b^+^^^0^M^/^%fJ>f@p^wf@iJ2@o=0;@q(e@o,J5JMf@i,fn,f@o,fn,gc,gcJ;JF,^c41]]);fnJ6JHT){@q(J!^+645]],J5JMf@i,fn,0,null^.,JF)JG^Q703^T[703]]||^Q699^T[699]]){t^LJ.^\'J#54]^W^(index@oeyword:0,J$f@w+(f@m-f@w)/2,y:fp[^1[J9^1[0]?f@i:f@p^jfp[^1[J9^1[0]?-1:^efJ>Ma^5J3)^wMa^6J3)^l;t^LJ.^\'J#54]^W^(index@oeyword:1,J$f@w+(f@m-f@w)/2,y:fp[^1[J9^1[0]?f@p:f@i^jfp[^1[J9^1[0]?1:-^efJ>Ma^5J3)^wMa^6J3)^lJI};^VJE^9^+^PJE)}JCc@i={source:e@o,dest:^2^S^{Callback:^g3]],easing@sJ0:^g^h714]]^{@qase:0};J1c@i;};nJ 12^h595]]=fJ0(dkJ=e@o=dkJ 575]]||^2^SJCfz=^4^]if(fz@u=0){J1J2n=^o^2J0J=gc=(gb>5)&&^c40]]?true:JF^d160]]=_$J?745];for(J-^G;JB^QJ7^7170]J8^s^7^Y^*JO^3^|^*JO^35]^Cfp[^1===null||!fp[^1[_^k||^#b^i)!^X^#b^v^r^Df@w=(d^!^ J/^!^ ^"^i-d^!^ ^)m=(d^!^ J/^!^ ^"^v]-d^!^ ^f@mJ=cr=f@w;f@w=f@m;f@m=cr;};fn=fp[^K]?fp[^K]:^O][cc%^O][_^k];@q(e@o,J5JMf@i,fn,0,null,gc^.,^c41]]);va^@[6^?b^+^^^0^M^/^%f@w,y~b976[724]]J ~kJ 463]][_$_~725]]@b(fp[cc][_$_b~ typeof (fp[cc][_$_~JJ163]]();e@o[_$~a@yointIndex:cc,x1:~^/a~6[274]]({chartType:~cc],dataSeries:c@n,~^dk~976[629]][~[_$J?~this[_$_b~);e@o[_$_~_$J?5~point:{x:~JJ717]~1]J=fp[~4]](cz,~,JF,~]JC~){var ~@w,y1:~_JJ~gb>gd)~@p,gE)~cc++){~;var ~351]]~30]](~false~};if(~);if(~;};};~JO[~z=(dk~;for(~,f@m,~var f~b976','J?x2:f@m,yJ@;fn=@r(d@p)J^T){@q(J.^&645]],f@w,f@p,f@m,f@i,fn,0,nullJ=J=J=J=)};^>JY||^Y]||fp[cc^v99]]||^D){^F^u74]]^-[555^y^.^,0,point:{x:f^ [1]>=f^ [0]?f@w:f@m,y:f@p+(f@i-f@p)/2^g^ [1]>=f^ [0]?-1:1,bounds:{x1:^jJH^}J?x2:^j[195]]^}J@,J"^F^u74]]^-[555^y^.^,1,point:{x:f^ [1]>=f^ [0]?f@m:f@w,y:f@p+(f@i-f@p)/2^g^ [1]>=f^ [0]?1:-1,bounds:{x1:^jJH^}J?x2:^j[195]]^}J@,J"};};};};e@o^WJ^T){J.^&645]]^W};J717]]^^^M^K^+^l[JJ^\'163]]()^k717]]^^^M^K^+^kJJ);}JZJTJI@u^?^f;dg++J8g@s=[];J0J8fn=c^Ecc%c^E^f]^J]=fn^`0]]=fn^N]=^e19]]J^e@oJ$20]]^a20]](@t(^e21]],^e19]]))}J9xJDfor(;cc^T];cc++){dz=fp^C^u09]]?fp^C^u0JW:fp^C]J^dz@ud^%J;26]^v34]]||dz>d^%J;26]^v35]]){conJO}JS^ ==JV||!f^ [^f|J ^ [0^]|J ^ [1^]){gl();fxJDconJO;};cz=(d^%^!7J:^%^!72JFdz-d^%^!^3p=(d^"^!7J:^"^!J-^ [0]-d^"^!^3i=(d^"^!7J:^"^!J-^ [1]-d^"^!4^Zif(ft||fx){J4^(J0J#;gmJ!p};g@s=[];g@s[_$_b9^)i}^\'163]^LJ#;};ft=false;fx=false;}JR^\\](JC);g@s[_$_b9^)i}^\'165]](JC)}J^cc%250==0){gl()};JEd@p=^i621]][cc];J.^&JAd@p]={id:d@p,^/641],^5J[@yointJQcc,x1:cz,yJ?yJ@;^>537]]!==0){^>5JP||^i5JPJ8fv^SJ*i,e^s^1^;J_^)i^2b976^4976JL^<^7s^V]})};fv^SJ*p,e^s^1^;J_^)p^2b976^4976JL^<^7s^V]})};}};^>JY||^Y]||fp[cc^v99]]||^D){^F^u74]]^-[533^y^.^,0^Pp^g^ J5^ [1]?-1:1,J"^F^u74]]^-[533^y^.^,1^Pi^g^ J5^ [1]?1:-1,J"};};gl();bbJ$29]](fwJKe@o^WJ^T){J.^&645]]^W};J/ gl(JX!gm)^dgsJV^p^6J0JW}^og@s[^f-1;cc>=0;cc--){gs=g@s[cc];^\\^I^O])^k165]^I^O])^H7]]()^*^e41]]^R]()^*1^k168]]()^p^6_^(J\'^I^O])^o0;cc@ug@s[^f;cc++){gs=g@s[cc];^\\^I^O])^HJW;};J4^(J0J#^k163]^LJ#;gmJ!p};g@s=[];g@s[_$_b9^)i});}J717]]^^^M^K^+^l[JJ^\'163]]()^k717]]^^^M^K^+^kJJ);}JZJTJI@u^?^f;dg++J8c@l=^?dg];J0){JU=c^Ecc%c^E^f]^J]=JU^`0]]=JU^N]=^e19]]J^e@oJ$20]]^a20]](@t(^e21]],^e19]]))}JZ;cc^T];cc++){dz=fp^C^u09]]?fp^C^u0JW:fp^C]J^dz@ud^%J;26]^v34]]||dz>d^%J;26]^v35]]){conJO}JS^ ==JV||!f^ [^f|J ^ [0^]|J ^ [1^]JXcc>0){gn();g@j=[];g@x=[];};conJO;};cz=(d^%^!7J:^%^!72JFdz-d^%^!^3p=(d^"^!7J:^"^!J-^ [0]-d^"^!^3i=(d^"^!7J:^"^!J-^ [1]-d^"^!4^ZJT@p=^i621]][cc];J.^&JAd@p]={id:d@p,^/641],^5J[@yointJQcc,x1:cz,yJ?yJ@;g@j[g@j[^f]J!p};g@^0]J!i};^>537]]!==0){^>5JP||^i5JPJ8fv^SJ*p,e^s^1^;J_^)p^2b976^4976JL^<^7s^V]})}J9v^SJ*i,e^s^1^;J_^)i^2b976^4976JL^<^7s^V]})};}};^>JY||^Y]||fp[cc^v99]]||^D){^F^u74]]^-[530^y^.^,0^Pp^g^ J5^ [1]?-1:1,JU:JU});^F^u74]]^-[530^y^.^,1^Pi^g^ J5^ [1]?1:-1,JU:JU}JKgn();bbJ$29]](fwJKe@o^WJ^T){J.^&645]]^W};J/ gn(J8fD=I(g@j,2)J^^b]>0){J4^(J04]](fD[0^#0]^c^\'163]^L4]](fD[0^#0]^c);}^o0;cc@u^b]-3;cc+=3^aJ(+1^#cc+1JN^[2^#cc+2JN^[3^#cc+3]^c^\'7J(+1^#cc+1JN^[2^#cc+2JN^[3^#cc+3]^c)};}^p^6J0JW};fD=I(g@x,2);^\\](g@^0-1]J,170]],g@^0-1]^c)^o^b]-1;cc>2;cc-=3^a^q^#J1^:^#^r6^8J\\^99J2^\'7J(-1^#J1^:^#^r6^8J\\^99J2)}^H7]]()^*^e41]]^R]()^*1^p^6_^(J04]](g@^0-1]J,170]],g@^0-1]^c)^o^b]-1;cc>2;cc-=3^a^q^#J1^:^#^r6^8J\\^99J2^\'7J(-1^#J1^:^#^r6^8J\\^99J2)}^HJW^H3]](^\'167]^L8]](JK}J753]^U^Q],gzJ]g@tJ=)^l[753]^U^Q],gN@bgz,g@tJ]true)^`7]]()^J]=fn^`0J)[3]^N]=2^R]();}}^*1;e@o^W;};nJ,12^x[592]]=J/(dkJ8c@v=thisJ9z=^?^fJSz@u=0)^dc@l=^?0];J20];c@v[_$_^&JAd@p]=h@z;^h10]]={x:gIJ,170]],y:gI^c};^h629^_29^B4]]=hd;^h755]]=eT;^h705]]=^e05^B6]]=^t756^n6[756]]:^e56]]?^e56]]:^t522^n6[522]]:c^Edg%c^E_$J>152]^B7]]=^t757^n6[757]]:^e57^B8]]=^t758^n6[758]]:^e58]];^h689^_89^n6[689]]:^i689^G2^_92^X2^@2^G3^_93^X3^@3^G0^_90^X0^@0^G1^_91^X1^@1^G4^_94^X4^@4]]?^i694]]:null;^h695^_95^X5^@5]]?^i695]]:^w310]]@b0.33;^h696]]= typeof (^t696]])!J&161]?^t696^@6^B9]]=dg===0?^e59]]?(^e59]]/180)^$]:0:g@k[dg-1]J$60^B9]]=(^h759]]+(2^$]))%(2^$]);^h760]]=^h759]]+((2^$]/hk)@b^j[263]](gq^c))J6E=(^h760]]+^h759]])/2;hE=(hE+(2^$]))%(2^$]);^A=hEJ^^A>(^j[748]]/2)-he&&^A@u(^j[748]]/2)+heJXh@j===0||g@k[hC]J$61]]>^A){hC=dg};h@j++;}JRif(^A>(3^$]/2)-he&&^A@u(3^$]/2)+heJXh@s===0||g@k[h@q]J$61]]>^A){h@q=dg};h@s++;}}J^hE>(^j[748]]/2)&&hE@u=(3^$]/2)){^h762J)[360]}JR^h762J)[14]};^h763]]= new bi(^|[40^x[392]],{fontSize:^h690]JM@samily:^h691]JMColor:^h689]JMStyle:^h692]JM@weight:^h693]],horizontal@zlign:_$J>360],backgroundColor:h@z[_$_~p[cc]^c~b976[724]]J,~kJ,463]][_$_~]J,170]],fD[~@b^j[748]~kJ,462]][_$_~b976[430]]J,~);if(T){fqJ,~J\\163]]();e@o[_$~76[274]]({x:cz,y:f@~^l[682]]=~],^w311]])~:c@n,index@oeyword:~({chartType:_J_76~t:fp[cc]J[Series~objectType:_$J>~x[g@x[^f~76[274]](fv)J9u~,ctx:fq,type:fv[_$_~4^Zf@~[351]],size:fv[_$_b~dataSeriesJQc@l~976[719]]>0){e@o[_$~or:fu,borderThickne~[629]],fD[cc-3][_$_~170]],fD[cc-3JN~_b9J2,fD[cc-2~=@r(d@p)J^T){fw[_~,JU:fu,borderCol~thisJ,405]]~if(fp[cc]J,~dkJ,598]][~]]:^i69~^h761]]~]];^h75~[cc]J,170]~^i699]]~@nJ,523]][~thisJ,394]~]];^h69~;}^`~](gsJ,170]~^l[159]~],^w310]~]()^k16~],^w415]~^`2]~],gsJ,629]~,point:{x:cz,y:f@~],gIJ,629]~^`8]~=^e26]~@ufpJ,152]~](gIJ,170]~s:fvJ$28]~J$30]]()~^n6[69~^e03]~78]])+0.5)@u@u0;~9J2,fD[cc+~e@oJ,165]~])!J&29]~(^w414]~]]=^t6~^l[16~){e@oJ$~fDJ,152]~J,629]]~{return JE~^i7~_$J>152]]~},direction:f~h@zJ,~c@nJ,~Math[_J_76~;fqJ,~;J4b976~]],animation~]]?gq[_J_7~JZvar cc=~J^c@n[_$_b~J(-1~cc-2JN97~@o);fw[_J_~gqJ,~]J%~]J,6~epJ,~5]JN976~]J[@yoin~dJ$~_$J>392~c@v[_J_76~(f@w,f@m),y~| typeof (f~={x:cz,y:f@~JU:fn});~4]](JC)~J,7~J,2~==_$J>~J04]~33]](fD[cc~]]=_J_76~](cc,cz,f@~fw=[];var ~[_$J>~72JFf~this[_$_~function~J>16~cc-1][_$~76[629]]~]];var ~e@o[_$_~[0]@u=f~;var h~;var g~){var ~;var f~23]]+d~J\\6~var c@~,false~_J\\~1:f@p,~2:f@i}~722]][~716]](~cz,f@p~=true;~};var ~5]]@b(~eturn ~[630]]~g=0;dg~718]](~);};};~[727]]~],font~][_$_b~tinue ~37]]>0~Index:~else {~J^f~var d~color~=null~9]]()~){if(~703]]~;for(~,data~b976[~,g@h,~;if(~$_b9','JJ[694]],max@width:^U[695]],max@xeight:^U[696]]?^U[690]]@b5:^U[690]]@b1.5,text:^U[755]],padding:0,text@qaseline:^t[9]})^k^ 708]]JPJ$I^xh@x^xhD^{for(dg=0;dg@u^3;dg++^r@zJ2(hC+dg)%^3]J(j>1&&^+>(^H^\'_JJ^gM^7]/2)+heJ3hI@u=h@j/2&& !hD){^9^Z14];hI++;^s^9^Z360];hD^|};};hD^{for(dg=0;dg@u^3;dg++^r@zJ2(h@q+dg)%^3]J(s>1&&^+>(3@b^H^\'_JJ^g3@bM^7]/2)+heJ3h@x@u=h@s/2&& !hD){^9^Z360];h@x++;^s^9^Z14];hD^|J:^]i(^#7^4392^@159]^Z13]^M[160]^Z111J+e@v=16^M[427]^Z764]^M[765]^Z193J+cc=0,dg=0;f^"976^\\^&if(!^U[755]]^I^p^ J*=^p^ ^qJ#p^C^!360]^up=^L705]]!^G?^a^ J1+g@w):-^p^ J1/2^sJ=p=^L705]]!^G?g@w:-^p^ J1/2}^k^ J%=ip^k^ 433]](true)^k^ J&=ip^k^ J\'=^p^ ^q;^Q76[705]]!^G^um=^U[10^TJ%hd^/JI^+)J#o=^U[10]]^F+hd^/7]](^+^;0]]=^U[756^@162]]=^U[757]Jhn){hm=hn;ho^|J7fn=fp^>]]?fp^>]]:^L523J;%^L523^T152]]]J6m>hp){C(c@vJ)7^4392]],g@^0],^.54]],fn,^L351]],hp,hm,^L741]])}J6o)^n;}^PS(dm^#7^4392^@60JL^E],ep[^t^=6[J1^?])^M[1JR=^K467^@649]](^E],ep[^t^=6[J1^?])^R0;^f^)J8p=^.JRJ$m=^.60]]J6m>hp^rv=(JN0.07^/JI^.61]]))J7gr=(JN0.07^/7]](^.61]]))J$u^{if(fp[cc]^Y69]]J3^H2^$6[10^TJ&(gI^`J%hv))>0.J,001||^H2^$6[10]]^F-(^2+gr))>0.J,001){g@^0]^`J4^-+hv@bdm;g@^0]^F=^2+gr@bdm;hu^|^lf(^H2^$6[10^TJ&gI^`J4)>0||^H2^$6[10]]^F-^2)>0){g@^0]^`J4^-+hv@b(1-dm);g@^0]^F=^2+gr@b(1-dm);hu^|}J6u^rt={};ht^`567]]=c@n;ht^`64JQ^L538J;];ht^`524]]=cc;^K460^T770]]([ht]);}J7fn=fp^>]]?fp^>]]:^L523J;%^L523^T152]]];C(c@vJ)7^4392]],g@^0],^.54]],fn,^L351]],hp,hm,^L741]]);};};hi()^P@y(ef,hs^rq={x1^w^ J4,y1^w^ J*eJ>^ ^q,x2^w^ J%eJ>^ J1,y2^w^ J\'eJ>^ ^q}J$r={x1^v^ J4,y1^v^ J*J-^ ^q,x2^v^ J%J-^ J1,y2^v^ J\'J-^ ^q}J6q^X16]]@uhr^X14]]-g@w||hq^X14]]>hr^X16]]+g@w||hq^X15]]>hr^X17]]+g@w||hq^X17]]@uhr^X15]]-g@w^bfalse^ctrue^P@l(ef,hs^rz^xhq={y^w^ J/,y1^w^ J*eJ>^ ^q,y2^w^ J\'eJ>^ ^q}J$r={y^v^ J/,y1^v^ J*J-^ ^q,y2^v^ J\'J-^ ^q}J6r^F>hq^F){hz=hr^X15]]-hq^XJS^shz=hq^X15]]-hr^XJS^chz^PT(hw^rxJ5^R1;^f^)hx=(hw+cc+g@k[_^*_$_^[;ifJ9hx^A!==J.^A){hxJ5;break ^W(^z^Y55]])&&(hx!==hw)&&((g@l(^z,J.])@u0)||(^Vb9^!14]?^zJG^ J/>=^V^ J/:^zJG^ J/@u=^V^ J/)))^nelse {hxJ5}};^chx^P@n(hw^ryJ5^R1;^f^)hy=(hw-cc+g@k[_^*_$_^[;ifJ9hy^A!==J.^A){hyJ5;break ^W(J ^Y55]])&&J9hy^A===J.^A)&&(hy!==hw)&&((g@l(J ,J.])@u0)||(^Vb9^!14]?J JG^ J/@u=^V^ J/:J JG^ J/>=^V^ J/)))^nelse {hyJ5}};^chy;}^]j(ir,b@x){b@x=b@x||0J#q^mx=^2-JA1J#w=^2+JA1J0r>=0&&ir@u^3^r@zJ2irJ<(b@x@u0&&^p^ J/@uix)||(b@x>0&&^p^ J/>iw)^b0}J#@t=b@x;{J=t^mm^mo^mu^mv=0J0@t@u0J3^p^ 6^O^ ^q>ix&&^p^ 6^O^ ^i@t@uixJMt= -(ix^a^ 6^O^ ^i@t))}^lf(^p^ ^J^ ^q@uix&&^p^ ^J^ ^i@t>iwJMt=(^p^ ^J^ ^i@t)-iw}}J#@z=^p^ J\'i@tJ#y^C^!14]){iy^-+^D^8[27^%JJ^hz-^2JT^ly^--^D^8[27^%JJ^hz-^2JT};im^-+hd^/JI^+);io=^2+hd^/7]](^+);it=^D^8[27JLiy-im,2)+^H27JLi@z-ioJT;iv=^H77JLhd/g@m);iu=^H77JL(JAg@m+JNhd-it@bit)/(2@bJNg@m))J0u@uivJMt=i@z-^p^ J/^l@t=0};}J=@x=g@n(ir)J$S=gT(ir)J#E,i@s,isJ#@j^mD=0J0@t@u0JMs=^pb9^!14]?i@x:hS;iq=i@tJ0@s!=J5^u@o=-i@tJ#s=(^p^ 6^O^ ^q)-(^S^ J\'^S^ ^q)J0s-i@o@uhbJMj= -i@o;hl++;iDJOi@s,i@jJ@+iD^(>+i@j^(J3is>hb){iq= -(is-hb)^lq= -(i@o-(iD-i@j))}J:^Wi@t>0JMs=^pb9^!14]?hS:i@x;iq=i@tJ0@s!=J5^u@o=i@tJ#s=(^S^ J*^S^ ^o^a^ ^J^ ^q)J0s-i@o@uhbJMj=i@o;hl++;iDJOi@s,i@jJ@+iD^(@u+i@j^(J3is>hb){iq=is-hb^lq=i@o-(i@j-iD)}J:;}}J0q^u@q=^p^ J\'iqJ#z^C^!14]){iz^-+^D^8[27^%JJ^hq-^2JT^lz^--^D^8[27^%JJ^hq-^2JT};if(^+>(^H^\'_JJ^gM^7]/2)+he^u@h=(ir-J"^*_$_^[J#IJ2i@h]J#CJ2(ir+J"^*_$_^[];^Q^!J!IJ)^!14]&&iz>iIJG^ 1^_IJG^ J&15^s^Q^!14]&&iCJ)^!J!z@uiCJG^ 1^_JC^ J%15}}^W^+>(3@b^H^\'_JJ^g3@bM^7]/2)+he^u@h=(ir-J"^*_$_^[J#IJ2i@h]J#CJ2(ir+J"^*_$_^[];^Q^!14]&&iIJ)^!J!z@uiIJG^ 1^_IJG^ J%15^s^Q^!J!CJ)^!14]&&iz>iCJG^ 1^_JC^ J&15}};}}^k^ J/=i@q^k^ J4=iz;^6]=^H773]]((^p^ J*^2),(^p^ J&gI^`J4));};^ciq;}^]f(^#7^4392^@159]^Z111]^M[160]^Z111J+e@v=16^M[774]]=e@v+^t[775]^M[427]^Z764J+cc=0,dg^xh@v=0JBdg=0;dg@u10&&(dg@u1||h@v>0);dg++){hd-=h@v;h@v=0;if(^L705]]!^G){g@m=JNg@p;f^"976^\\^&^p^ J4^-+g@m^/JI^+)^k^ J/=^2+g@m^/7]](^+);^6]=^+;^U[754]]=hd;}^yJD;f^"976^\\^&J8S=gT(cc)J6S==J5^Ih@tJ2cc];h@rJ2hS]^yy=0;h@y=gJ?JD)-hbJ(y@u0^rM^xhN=0JBvar dh=0;dh@u^3;dh++J3dh===cc^IifJ9dh^A!==^9]^IifJ9dh]JG^ ^}^p^ J/){hM++^shN++};}^yp=(h@y)/(hM+hN||1)@b(hN)^yk=-1@b(h@y-h@p)^yo^xh@h^C^!14]JKoJOcc,h@pJUk=-1@b(h@y-h@oJUhJOhS,h@kJ@+h@h^(@u+h@k^(&&+h@o^(@u=+h@p^(){hj(cc,-(h@k-h@h))^jh@oJOhS,h@pJUk=-1@b(h@y-h@oJUhJOcc,h@kJ@+h@h^(@u+h@k^(&&+h@o^(@u=+h@p^(){hj(hS,-(h@k-h@h))J:;^jf^"976^\\^&g@m=^L35JQ==^t[556]?JN0.7:JN0.8J7ed^-+JA(^H76JI(^+)))J7ee=^2+JA(^H767]]((^+)))^k^ J4=ed^k^ J/=ee;}};f^"976^\\+JKzJ2cc]^yw=^p^ 708]]()J(w^`31JQ==0||h@w^`J1===0^IJ=a^xh@i^C^!14]){ia=ep^X16]]^a^ J%^p^ J1+g@w);ia@bJE^la=^E]^a^ J&^p^ J1-g@w)}J0a>0J3M^:^e^ 6^O^ ^q-^2)@uhd||M^:^e^ ^J^ ^q-^2)@uhdJKi=ia/M^:](^H76JI^6]))J(i>9JKi=h@i@b0.3}J(i>h@vJKv=h@i^j}}J#c^mb=0;if(^6]>0&&^6]@uM^7]){ic=ep^XJS^a^ ^J^ ^q+5);ic@bJE^lc=ep^X15]]^a^ 6^O^ ^q-5)}J0c>0J3M^:^e^ J&gI^`J4)@uhd){ib=ic/M^:](^H767]](^6]))J0b>9){ib=ib@b0.3}J0b>h@vJKv=ib^j}^s};};^]J?m,ii,ih^ug=[]J#j=0^Rii;true;cc=(cc+1+^3)%^3){ig^`274]]J9cc]J@cc===ih)^n;};ig^`54JL^dik,il^bik^F-il^F})JBcc=0;cc@uig[_$^)J=e=ig[cc]J0j@uh@m){ij+=ieJG^ 311]];ieJG^ 776]^Z20];ie^Y55]^Z20];ieJG^ 708]]JPelse ^n;};}J8@n=-1J$T=-1^ym=0JBvar dh=0;dh@u^3;dh++JKtJ2dhJ0){hJ?m,h@n,hTJUnJEhTJEh@m=0;}};}J(m>0){hJ?m,h@n,hT)J:^N[51JQ^denJ3^K398]]^b}J7cc=en^`644]J+gq=en^`641]J+c@n=thisJ7d@p=^L621J;J1){^K509^T60JI0,g@r^^dm){gS(dm);hhJP)^c;};g@i();hf();^N[40JQtrue;^N[509^T60JI0,^N[400]]?^N[600]]:0^^dm){g@v(dm);hhJP^^){^K401]]^{^K509^T60JI0,^K400]]?g@r:0^^dm){gS(dm);hhJP);});^]h(){c@vJ)7^4517^T47JI);^12]]){^12^T563JH(^K562^T777]^B&&^K562^T778]^B)){^K562^T433]]()}};^14]]){for(var cc=0;cc@u^K564]][_$^)var dl=^K564J;J~=0J7~J$@~g@k[hx]~=false;~=true;}~J/@u~g@k[hy]~360]&&i~1+g@k[_~J7i~J7h~J4+~J4-~J/+~J6@~JGb9~J/-~]J7~000000~hsJG~g@k[hw~629]]~;if(i~310]]~=g@k[~){if(~170]]~=null~;if(h~;var ~var h~(g@k[~};};}~]][cc~];if(~var i~fJG~@l(h@~);if(~g@m@b~;for(~CJG~t,h@r~= -1;~]]=f@~[_$_~]]||~6]](~b976~){h@~1]](~){i@~hd@b~=hj(~();}~1]]=~59]]~17]]~,2))~);h@','97^97^;JA8^97^;JA9^9791]];}@l[^l^M6[800]^TN,h@w){if^I9]){^@6]]+=h@w^P^q^$113]){^@7]]+=h@w^P^q^$J+{^@8]]+=h@w^C}else^$J@{^@9]]+=h@w^C}}JF@l[^l^M6[801]^TN,h@w){if^I9]){^@6]^31]]}else^$113]){^@7]^31]]}else^$J+{^@8]^30]]}else^$J@{^@9]^30]]}}JF@l[^l^M6[568]^N^o{x1:^@2]]+^@8]],y1:^@3]]+^@6]],x2:^@4]]-^@9]],y2:^@5]]-^@7]]^r(^@4]]-^@2]])-^@9]]-^@8]],h^y(^@5]]-^@3]])-^@7]]-^@6]]}};@l[^l^M6[476]^N^@6^97^;JA7^97^;JA8^97^;JA9^9791]];};^cbi(e@o,cD){bi^b127^V1J:[^l^?J-02],cD);^DJ2=e@o;^B03]]J,;^B04]]^u^B05]]=@h(^D00]],t^&,^K296]]);}@s(bi,m);bi[^l^M^}^T@k){if(i@k){^g^ 716J8}^mv=^g^ 774]];^g^ 427^9427^ngr=0;^8803]]){^K^z^DJ2)};^g^ 68J5^K170]],^K629]]+gr);^8427]^Q764]){gr=-^B05J;};^g^ 774^9806J8;^g^ 80J4Math^b748]]/180@b^B07]])^mr=0J#iS=t^)^my^uif((^K728]]>0&&^K750]])||^K4J=){^g^ 15J40,gr,t^%,t^(,^B09]],^K728]],^K4J=,^K750]])};^g^ 159^9810]];for(J?cc=0;cc@u^B04^V811]]^E;cc++J9y=^B04^V811]][cc];^8J6^Q14]J9r=t^%-i@y^C-t^)^!976^:[J+{i@r=t^)^!^|7]^*i@r=(t^%-t^)@b2)/2-i@y^C/2+t^)JF^g^ 812]](i@y^bJ$,i@r,iS);iS+=i@y^P]];};^g^ 77J:^l[20]^r0}}^sa=0,i@m=0,i@w=iT^E-1,e@p=Infinity;^g^ 774^9806J8;while(i@m@u=i@w){e@p=Math^b17J5(i@m+i@w)/2)^mi=iT^Y1J40,e@p+1);ja=^g^ ^zi@i)^CJ7ja@ucTJ9m=e@p+1^pif(ja>cTJ9w=e@p-1^pbreak }};J%ja>cT&&i@i^E>1J9i=i@i^Y1J40,i@i^E-1);ja=^g^ ^zi@i)^C;}^mlJ,J7i@i^E===iT^E||iT[i@i^E^Q301]J9l=J0J%i@l^ti@p=i@i[^\\6]](^l[301])J7i@p^E>1J9p^b259J8};i@i=i@p^b281]](^l[301]);ja=^g^ ^zi@i)^C;};^o{J>:i@i^rja};^.]^Y16]]=^cbo(^tiT= new String(bn(String(^KJ$))^wn@z=[]^mv=^g^ 774^ncS=0J#cT=0;^g^ 774^9806J8;while(iT^E>0^te@m=^\']-t^)@b2^se=^B19]]-t^)@b2^my=^B17]](iT,e@m,J0);i@y^P^9805]];n@z[^\\J5i@y);cT=^+](cT,i@y^C);cS+=i@y^P]];iT=bn(iT^b157]](i@y^bJ$^E,iT^E))J7je&&cS>je^ti@y=n@z^b259J8;cS-=i@y^P]];};};^B0J<{lines:n@z^rcT,h^ycS};t^%=cT+t^)@b2;t^(=cS+t^)@b2;^g^ 77J76[296]],horizonta^k^KJ6],vertica^k^KJ3],borderC^<6[750]],borderThickness:^K728]],backgroundC^<6[4J=J*J ^\']J*x^yje,corner@radius:^B09]]J"^KJ$,padding:t^),J>@qaseline:^_})^sh=ff^b^z);^8J3^G||^KJ3]^1^8J3^G){^05J);iN=^_;^!^|8]]^1^07J&-jh^P]];iN^[13];}};^8J6^QJ+^64J)^!^|7]^*fT=jd^Z14]]+jd^b310]^-0J;^!976^:[J@^66J&-jh^C-jfJFjg=^KJ6];t^%=jh^C;t^(=jh^P]];^!^j^*^8J6^QJ+^64J);^07J&-(^\'^-0J;);e@s= -90;iN=^l[JD;t^%=jh^P]];t^(=jh^C;^!976^:[J@^66J&;^05J)+(^\'^-0J;);e@s=90;iN^[4];t^%=jh^P]];t^(=jh^C;^!^|7]^*f@l=jb^Z15]]+(jb^P]^-1J;);fT=jb^Z14]]+(jb^b310]^-0J;);iN^[0];t^%=jh^C;t^(=jh^P]];JFjg^[0];}};ff^b170]]=fT;ff^b629]]=f@l;ff^Y07]]=e@s;ff^bJ6]=jg;ff^Z33]](true);jb^b517^V800]](iN,{J t^%+^IJD||iN==^[4]?^D55J):0),h^yt^(+^I9]||iN==^[13]?^D55J):0)});^K^^fT,y1:f@l,x2:fT+t^%,y2:f@l+t^(};^g^ 427]]=^_;};^cbh(kr,cD){bh^b127^V1J:[^l^?J-22],cD,kr^b378]]);^"=kr;^K1]]=kr^b1]];^DJ2=^"^b3J2J7^d^D72^V298]])=^H){t^&=^"^b64J4t^&)};t^%J\',t^(^u^K^^null,y1^vx2^vy2J/};}@s(bh,m);bh[^l^M6[433]]=bl[^l^M6[433]];^c@w(kr,cD,c@j){@w^b127^V1J:[^l^?J-23],cD,c@j);^"=kr;^K1]]=kr^b1]];^DJ2=^"^b3J2;^K645]]=^"^Z30^V645]];^K646]]=[];t^%=0,t^(=0,^B24]]J\',^K5J==[];^K^^null,y1^vx2^vy2J/J%^d^D72^V298]])=^H){t^&=^"^b64J4t^&)};^B25]]=@h(^D00]],t^&,^K296]]);^BJ:=t^&;}@s(@w,m);@w[^l^M^}^NJ?jb=(!^K563]]?^":^"^Z05]]^weD=jb^b517^V56J4^wiN^uJ?f@l=0J#fT=0J#e@m^he^hl=5^sm=[]^sx=[];^8J3^G||^KJ3]^1^B2J<^l[26];iN=^KJ3];e@m=^\'^e^\']:eD^CJE7JC^B19JBJ\'?^B19]]:eD^P^x5;^!^j^*^B2J<^l[712];iN=^KJ6];e@m=^\'^e^\']:eD^CJE5JC^B19JBJ\'?^B19]]:eD^P^x7;}};for(J?cc=0;cc@u^K5J=^E;cc++^tc@n=^K5J=[cc];if^/]!==^l[556]&&^O351JB=^l[557]&&^O351JB=^l[558]^tjt=^O827^A827]]:^/^F5]|^,^F6]|^,^F7]|^,^Q539]|^,^Q540])&&^O828^A828]]:w^Y29]]^/])^sp=^O830^A830]]:^B31]]?^B31]]({cJI:^",legend:^D72]],^a:c@n^XJ/}):^O520^nfu=^O832^A832]^L[833^A833]^L[JGJJJ#dS=(!^O537]]&&^/^F5]|^,^F6]|^,^F7]))?0:^B25^x6^sr=^O834^A834]^L[835^njs=^O836^A836]^L[837]]?^+](1,^7](dSJE2)):0^sq=^OJGJJ;jp=^"^b70J5jp,^O538]JJ,c@n,cc^wd@i={^{TJMjt,^{J!fuJ"jp,J>@qlock^vcJITJM^O351]],^{J.dS,lineJ!^OJGJJ,^aIndex:^O524]]^XJ1J/^JJ!jr^JThickness:js};jm[^\\J5d@i);^pfor(J?ir=0;ir@u^O538]]^E;ir++^tgq=^O538]][ir]^st=gq^Y27]^R[827]^L[827^A827]]:w^Y29]]^/])^sp=gq^Y30]^R[830]^L[830^A830]]:^B31]]?^B31]]({cJI:^",legend:^D72]],^a:c@n^X:gq}):gq^b520]^R[520]]:^l[838]+(ir+1^wfu=gq^Y32]^R[832]^L[832^A832]]:gq^b522]^R[522]^L[522^A522]^L[JG][ir%^OJG]^E]J#dS=^B25^x6^sr=gq^Y34]^R[834]^L[834^A834]]:gq^Y35]^R[835]^L[835^njs=gq^Y36]^R[836]^L[836^A836]]:gq^Y37]]||^O837]]?^+](1,^7](dSJE2)):0;jp=^"^b70J5jp,gq,c@n,ir^wd@i={^{TJMjt,^{J!fuJ"jp,J>@qlock^vcJITJM^O351]],^{J.dS,^aIndex:cc^XIndex:ir^JJ!jr^JThickness:jsJ%gq^b566]]||(^O566]]&&gq^b566JB=J0)){jm[^\\J5d@i)};}};d@i^u};^8839]]==J,){jm^Y40J8J%jm^E>0^tjuJ\'^sw^hy^hi=0;^8841]^`^8842]^`jy=^2](^B41]],^B42]],JL^pjy=^2](^B41]],JL}^!J-42]^`jy=^2](^B42]],JL^pjy=e@m}};dS=(dS===0?^B25^x6:dS);jy=jy-(dS+^B^f);for(J?cc=0;cc@ujm^E;cc++^td@i=jm[cc];if^4^F5]^#^F7]^#^5{jy=jy-^=^UJ%je@u=0||^dje)=^H||jy@u=0||^djy)=^H){continue };^8824]^Q26]){^W[JK]= new bi(^DJ2,{x:0,y:0J*J jyJ*x^>76[844]]?je:^B25]],angle:0J"^W[J$,horizonta^k^l[JDJ(J.t^&J(@samily:^D0^i@w^>76[296]]J(C^<6[81^iStyle:^K294]],J>@qaseline:^_});^W[^S6[^z);^8841]^`^W[^S6[310^9841]]-(dS+^B^f+(^4^F5]^#^F7]^#^5?^=^U:0))J%!ju||ju^C+^7](^W[JK]^C+^B^f+dS+(ju^C===0?0:(^BJ:))+(^4^F5]^#^F7]^#^5?^=^U:0))>JL{ju={items:[]^r0};jx[^\\J5ju);t^(+=ji;ji=0;};ji=^+](ji,^W[^S6[311]]);^W[^S6[170]]=ju^C;^W[^S6[629]]=0;ju^C+=^7](^W[JK]^C+^B^f+dS+(ju^C===0?0:^BJ:)+(^4^F5]^#^F7]^#^5?^=^U:0));ju^b646^V27J5d@i);t^%=^+](ju^C,t^%);^p^W[JK]= new bi(^DJ2,{x:0,y:0J*J jyJ*x^>76[84J<=J,?je:t^&@b1.5,angle:0J"^W[J$,horizonta^k^l[JDJ(J.t^&J(@samily:^D0^i@w^y^g~b976[392^V~}else {if(^gb~^D79]]~||^W[688]~ {if^I~his^C~his^b298]]~^B14]~his^P]]~his^b357]]~^Q10]){~Math^b195]~|^O351]~]/2-jh^b31~};bi^b125]~(^O351]~f@l=jd^Z1~==^[13]){~Math^b630]~]-=h@w^b31~(^W[688]~^F6])~{fT=jd^Z1~Math^b193]~if(^K~]]=^K~[777]]===^l~91]];^gb97~olor:^gb97~2@b(^gb976~eight:^gb9~[20J5this,_$_b~^K79~]]?^O~^K8~^b310]]~^K3~^b152]]~^Q52~^Q9]~=^[61]~(iN===^l[~,^{@qorder~this^b~]:c@n[^l~[125]][_$_b97~]=function(){~c@n^b~^b311~]===^l[~]?gq[^l~JK][_$_b97~]=function(i~[825^x1)~]]^b~d@i[^l~,data@yoint~^b8~^b4~=^l[1~^l[27~]==J\'){~438]]={x1:~^l[9]~]!=J\'){~dataSeries~[^l[~function ~ typeof (~]!=J\'?~26^x1~this[_$_~=0^s~0]]J(~^|8]~l@zlign:~_$_b976~J#i@~]]J#~return ~}else {~]]}else~,J ~J#j~){J?~J\';~J/,~)J#~]]JE~eight:~70J4~marker~976[77~6[433]~width:~Color:~,J>:~;J?~776]]~}J7~]]-jc~=null~,font~]]+jc~,max@~JD)~=true~976[8~Size:~:null~false~Index~92]]~778]~8]](~4]](~777]~;if(~]]()~){i@~26]]~]]/2~4]]=~67]]~text~var ~14])~6[79~]]!=~;je=~360]~@b0.~}}};~523]~351]~hart~][0]~843]~e@m)~ype:','b976[296]],fontColor:^P810]],fontStyle:^P294]],text@qaseline:^c9]})^h^ 708^l^P841]]!=^z){^q^ ^y=^P841]]-(dS+^P826]]^|+((^S688]^N5]^/^N7]^/^N6])?2@b(^+^|):0))^x^,@u=je){ju={items:[],width:0};jx^a274]](ju);^fu=jx[jw];jw=(jw+1)%jx^M;};^,+^e^ 311]]^h^ ^{=ju^a^y^h^ 629]]=0;ju^a^y+^U6[193]](^q^ ^y+^P826]]^|+dS+(ju^a^y===0?0:^P826]])+((^S688]^N5]^/^N7]^/^N6])?2@b(^+^|):0));ju^]46^V274]](d@i);^)^U6[19J)ju^a^y,^));};^x^P844]]===false){^,=jx^M@b(^+)}^}{^,+=ji};^,=M^C](je,^,);^)=M^C](e@m,^));};^@78^T[9]){^@77]]=^O){^5^i^@77^T[14]){fT=eD^W6]]-^)^r^5^\\6[^y/2-^)/2}};f@l=eD^W5]]^k^@78^T[10]){^@77]]=^O){^5^i^@77^T[14]){fT=eD^W6]]-^)^r^5^\\6[^y/2-^)/2}};f@l=eD^W5]^\\6[311]]/2-^,/2^k^@78^T[113]){^@77]]=^O){^5^i^@77^T[14]){fT=eD^W6]]-^)^r^5^\\6[^y/2-^)/2}};f@l=eD^W7]]-^,;}}}^I46]]=jm^o cc=0;cc@u^P646]]^M;cc++^ud@i=jm[cc];^S647]]=++^#^v^A519]];^#^v^AJ+^8]]={id:^S647]],objectType:^c845],legendItem^!Index:^S846]],data@yointIndex:^S644]]};}^tv=0^o cc=0;cc@ujx^M;cc++^uju=jx[^nji=0^o jk=0;jk@uju^]46]]^M;jk++^ud@i=ju^]46]][jk]^tn^e^ ^{+fT+(jk===0?dS@b0.2:^P826]])^to=f@l+jv^tj=jnJ&!^#^a282]][^S846]^V616]]){^&^]82]]=0.5};^&^a716]]();^&^a717]](fT,f@l,e@m,je);^&^a718^l^S688]^N5]^/^N6]^/^N7]){^&^a160]]=^S847]];^&^a162]]^U6[173]](^+/8);^&^a163]]();^&^a164]](jn-^+^|,jo+^+/2);^&^a16J)jn+^+@b0.7,jo+^+/2);^&^a16J\');jj-=^+^|;};bb^a751]](jn+dS/2,jo+(^+/2),^&,^S828]],^S537]],^S833]],^S835]],^S837]])^h^ ^{=jn+^P826]]^|+dSJ&^S688]^N5]^/^N6]^/^N7]){^q^ ^{^e^ ^{+^+^|}^h^ 629]]=jo^h^ 433]](true);^&^a730^ljkJ"i^U6[19J)ji,^q^ 311]])^fi^e^ 311]]^x!^#^a282]][^S846]^V616]]){^&^]82]]=1}^wfr=@r(^S647]])^I45^V159]]=fr^I45^V163]]()^I45^V64J\'jj,^q^ 629]],^q^ ^{+^q^ ^y-jj,^q^ 311]]);^S414]]=^#^v^AJ+^8^V414]]=jj;^SJ!=^#^v^AJ+^8^VJ!^e^ 629]];^S416]]=^#^v^AJ+^8^V416]]^e^ ^{+^q^ ^y;^S417]]=^#^v^AJ+^8^V417]]^e^ 629]]+^q^ 311]];};jv=jv+ji;};jb^a517^V800]](iN,{width:^)+2+2,height:^,+5+5});^P438]]={x1:fT,y1:f@l,x2:fT+^),y2:f@l+^,J,function ba(kr,cD){ba^a127^V126^V204]](this,cD);^#=kr;^PJ(kr^a1]];^&=^#^a392]];}@s(ba,m);ba^a^Q[433]^Z^ueD=^#^a517^V568]]();^&^a159]]=^c848];^&^]4J\'eD^W4]],eD^W5]],eD^W6]],eD^W7]]);};function w(kr,cD,c@j,db,d@p){w^a127^V126^V204]](this,^c849],cD,c@j);^#=kr;^PJ(kr^a1]];^P850]]=kr^a1^V392]];^P524]]=db;^P851]^E[647]]=d@p;^#^v^A722]][d@p]={id:d@p,objectType:^c567],dataSeriesIndex:db}^I2J([]^I18]]=[];^P462]]^z;^P463]]^z;^@4J(=^z){if(^P351^V260]](/area/i)){^P74J(0.7}^}{^P74J(1}};^P5J-=^P852^l ^m^P372^V690]^9{^P690]]=^#^]48]](^P690]])};}@s(w,m);w^a^Q[852]^Z^uek=^P351]];^L[28^.5^.6^.7^.8^.9^(0^\'0^:3]||ek=^_540^(9^(1^\'1^:4^(2^(5^(6^\'4^(3^(4^412]}^}^;49^\'2^\'3^\'5^4543]}^}^;56^\'7^\'8^4194^iwindow^a374^V376]](^c855]+ek);^[;}}J,w^a829]^Zek){^L[28^\'0^:3]||ek=^_549^\'2^\'3]||ek=^_540^(9^\'1^:4^.9^(5^(6^\'4^\'5^(3^(4^4856]}^}^;25^.6^.7^\'6^\'7^\'8^431]}^}^;28^(0^(1^(2^4857^iwindow^a374^V376]](^c855]+ek);^[;}}}};w^a^Q[858]^Zcz,j@z){if(!^$||^$^M===0){^[}^tE={data@yoint:null,distance:^d,index:NaN}^wgq^z^wdg=0^wcc=0^wJ*1^tD=^d^pq=0,jz=0^tC=1000^ps=0J&^#^a516^V5J-!^_194]^uj@x=(^$[^$^M-1][_$^X-^$[0][_$^XJ j@xJ"@s=M^C](Math^a19J)((^$^M-1)/j@x@b(cz-^$[0][_$^X))>>0,0),^$^M)^f@s=0J,while(true){cc=(e@t>0)?j@s+dg:j@s-dgJ&cc>=0&&cc@u^$^M){gq=^$[^nhz=M^%gq[_$^X-cz)^gjE^]J-){jE^]4J(gq;jE^]J-=hz;jE^a524]]=cc;}^pj=M^%gq[_$^X-czJ j@j@u=jD){jD=j@j^^e@tJ"@q++^fz++}^xj@q>jC&&jz>jC)^j;^^j@s-dg@u0&&j@s+dg>=^$^M)^j^xJ*== -1){dg++;J*1^kJ* -1};^x!j@z&&jE^]41^V^{===cz){return jE^^j@z&&jE^]41]]!=^z){return jE}^}{^[}J,w^a^Q[640]^Zcz,c@z,d@k){if(!^$||^$^M===0){^[};d@k=d@k||false^wd@w=[]^wdg=0,cc=0^wJ*1^po=false^tD=^d^pq=0,jz=0^tC=1000^ps=0J&^#^a516^V5J-!^_194]^ujN=^#^a462^V85J\'{x:cz,y:c@z})^px=(^$[^$^M-1][_$^X-^$[0][_$^XJ j@xJ"@s=M^C](Math^a19J)((^$^M-1)/j@x@b(jN-^$[0][_$^X))>>0,0),^$^M)^f@s=0J,while(true){cc=(e@t>0)?j@s+dg:j@s-dgJ&cc>=0&&cc@u^$^M^ud@p=^P621]][^njM=^#^v^A722]][d@p]^wgq=^$[^nhz^zJ&jM){switch(^P351]]){case ^c28^10^11]:;case ^c549^12^13^14^15]:if(cz>^Y[414]]&&cz@u=j^F&&c@z>^Y[J!&&c@z@u^Y[417]]^2^b^0^!^JM^C](M^%j^*),M^%j^F-cz),M^%jM^W5^s,M^%jM^W7^s)^<^325^>6^>7^>8^>9^61^62^60^69]:var dS=@v(^c537],gq,this)||4^pt=d@k?20:dS;hz=^GJ\'M^-j^*J$^-jM^W5^`^g=j@t^2^b^0^!^Jhz})}^pj=M^%j^*J j@j@u=jD){jD=j@j^^e@tJ"@q++^fz++}}^g=dS/2){j@o=true};brea^333^64]:var dS=@v(^c537],gq,this)||4^pt=d@k?20:dS;hz=M^C](^GJ\'M^-j^*J$^-jM^W5^`,^GJ\'M^-j^*J$^-jM^W7^`)^g=j@t^2^b^0^!^Jhz})}^pj=M^%j^*J j@j@u=jD){jD=j@j^^e@tJ"@q++^fz++}}^g=dS/2){j@o=true};brea^340]:var dS^Y[727]];hz=^GJ\'M^-j^*J$^-jM^W5^`^g=dS/2^2^b^0^!^Jhz^<^356^17]:var gI^Y[10]]^wha=^P351^T[557]?0.6@bjM^a754]]:0;hz=^GJ\'M^-gI[_$^X-cz,2)+M^-gI^]29^`^gjM^a754]]&&hz>ha^uj@h=c@z-gI^]29]]^tI=cz-gI[_$^X^we@s^U6[773]](j@h,jIJ e@s@u0){e@s+=^G8]]@b2};e@s=Number((((e@s/^G8]]@b180J#+360)J#^a27J)12))^whp=Number((((jM^a759]]/^G8]]@b180J#+360)J#^a27J)12))^whm=Number((((jM^a760]]/^G8]]@b180J#+360)J#^a27J)12)J hm===0&&jM^a760]]>1){hm=360^xhp>=hm&&gq^]29]]!==0){hm+=360J&e@s@uhp){e@s+=360};^xe@s>hp&&e@s@uhm^2^b^0^!^J0});j@o=true;J,brea^335]:if(((cz>=(jM^W4]]-^B/2)J%z@u=(j^F+^B/2))&^7417]]-^B/2J%^=0]]+^B/2))||(M^%j^F-cz+j^*)@u^B&^7J!&&c^=1]]))^2^b^0^!^JM^C](M^%j^*),M^%j^F-cz),M^%jM^W7^s,M^%jM^a860^s)^<^336]:if((M^%j^F-cz+j^*)@u^B&^7417]]&&c^=0]]))||(cz>^Y[414]]&&(cz@u=(j^F+jM^W4]])/2)&^7J!-^B/2J%@z@u^Y[J!+^B/2))||((cz>=(jM^W4]]+j^F)/2J%z@u=j^F)&^7861]]-^B/2J%^=1]]+^B/2))^2^b^0^!^JM^C](M^%j^*),M^%j^F-cz),M^%jM^W7^s,M^%jM^a860^s)^jC&&jz>jC))^j;};^^j@s-dg@u0&&j@s+dg>=^$^M)^j^xJ*== -1){dg++;J*1^kJ* -1};}^wd@y^z^o d@r=0;d@r@ud@w^M;d@r++){if(!d@y){d@y=d@w[d@r]^^d@w[d@r]^]J-@u=d@y^]J-){d@y=d@w[d@r]}}};return d@y;};w^a^Q[726]^Zdb,cz,c@z,e@o^ufp=^$^wc@n=this^wfu^D833]^?33^H833^R6[833]]:fp[db]^a522]]?fp[db]^a522^H522^R6[522^H523]][db%c@n^a523]]^M]^tr^D835]^?35^H835^R6[835]]:null^ts^D837]^?37^H837^R6[837]]:null^tt^D828]^?28^H828]]^wdS^D537]]?fp[db]^a537^H537]];return {x:cz,y:c@z,ctx:e@o,type:jt,size:dS,color:fu,borderColor:jr,borderThickness:jsJ,function h(kr,cD,ek,iN){h^a127^V126^V204]](this,^c862],cD,kr^a378]]);^#=kr;^PJ(kr^a1]];^&=kr^a392]];^P814]^E[819]^E[863]^E[633]]=[];^K4]]^z^I26]]={min:^d,max:-^d,view@yortMin:^d,view@yortMax:-^d,minDiff:^d};^L[462]){^P465]]=^#^a465]][ek]J&!^P372^V680]]){^P681]]^z};^^iN=^O||iN=^_9]){^P465]]=^#^a465^V463]^i^P465]]=^#^a465^V464]]}^x ^m^P372^V865]^9{^K5]]=^#^]48]](^K5]])^x ^m^P372^V866]^9{^K6]]=^#^]48]](^K6]])};^P35J(ek;^L[462]&&(!cD|| ^mcD^a867]^9){^K7]]=~b976[843^V~Index:cc,dataSeries~^0I~^P379]]~^P538]]~ath^a263]](~^P392]]~]||ek=^_55~]||ek=^_53~^P310]]~M^W4]]-cz~^P825]]~^P311]]~ath^a271]](~]||ek=^_52~||^S688]~oint:gq,data@yoint~]:;case ^c55~){d@w^a274]~k ;;case ^c5~]){return ^c~fT=eD^W4]~]:;case ^c53~&(c@z>^Y[~][^S647]~])=^_161])~]||ek=^_85~{^L[5~});j@o=true;};brea~@z@u^Y[86~]:;case ^c52~]?fp[db]^a8~if(^P7~76[430^V~jM^a728]]~ath^]30]~=fp[db]^a~]=0;this^v76~M^W6]]~Math^a74~]]:c@n^a~;^P6~:this,distance:~^P86~if(ek===_$_b976~^a152]]~]=^_52~^_360]~this^a~125]]^v76~]]?c@n^v7~d@i^a~]]===_$_b976~=Math^v7~]]^a~^a41~_b976[^{~=jM^v76~]=function(~return null~]+eD^v7~^a6~^rif(~==^c~]]-c@z,2))~[^c~]({data@y~_$_b976[~Infinity~=^q~^rj~J&hz@u~;^q~]^r~{break }~;^r~]](J ~typeof (~cc]^w~;for(var~^t@~d@i[_$_~}^}{~]]-c@z)~^wj~){var ~[_$_b9~;var ~}J&~310]]~=null~170]]~@b0.1~else ~)J&~415]]~>0){j~%360)~,2)+M~)&&(c~;if(~9]](~1]]=~5]](~e@t=~722]~};};~42]]','0};th^.iN;^A^]JD,y1J.,x2J.,y2J.,wJ4JD};{^)=((^)%360)+360)%36J6^)>90&&^)@u=270){^)-=180^\\^)>180&&^)@u=270){^)-=180^\\^)>270&&^)@u=360){^)-=360}}};}if(^V7^58JB&&^V7^5870^O152]]>0){^90]]=[]J2^bcc@u^V7^58JB[J,^<^90^O274]](J8bg(^A379]],^V7^58JB[cc],k^R378]],++^V^-430^O519]],this))};};^91]]=JD;^A675]]=JD;^A676]]=JD;if(^A383]^aJ3)){^A465^O479]]=^A478]]J$^A383]^aJ5)){^A465^O481]]=^A480]]};^A380]^aJ3);^A380]^aJ5);}@s(h,m);h^`125^O872]]^8ff;^bJEj@vJ1jS=0^or=0^ok=J6th^.^S113J/^.^S9]){j@k=^n_^!J&/Ma^/^A480]]-^A478]])@b^A6^i^93]]){jS= ty^1^5J+)=^??j@k@b0.9^6[J+^jJ:^1^5J+)=^??^V^-J&@b0.7^6[J+};j@r= ty^1^5875]])=^?||^95]]?^V^-J%@b0.5^6[866]]@b1.5;^\\th^.^S360J/^.^S14]){j@k=^n_^!J%/Ma^/^A480]]-^A478]])@b^A6^i^93]]){jS= ty^1^5J+)=^??^V^-J&@b0.3^6[J+^jJ:^1^5J+)=^??^V^-J&@b0.5^6[J+};j@r= ty^1^5875]])=^?||^95]]?j@k@b2^6[866]]@b1.5;}J$^A351^M[462]&&^V^-516^O636^M[628]){j@v=c(J8Date(^A480]]),^AJ\',^A681]])J2cc=^=63]];cc@uj@v;c(cc,^AJ\',^A681]]))J0j@w=cc^`209]^kiT=^96]]?^9J@{chart:^A379]],axis:^A372]],value:cc,label:^n^;?^n^;J.}):^A351^M[462]&&^A633]][j@w]?^A633]][j@w]:x(cc,^97]],^V^-363]]);ff=J8bi(^A392]],{x:0,y:0,max@wJ4jS,max^hj@r,angle:^)J7:^98]]+iT+^99]],horizontal@zlign:^e360],fontSize:^=66^gsamily:^=80^gweight:^=81^rCJ9^=82^rStyle:^=83^caseline:^e764]});^"^e274]]({position:cc^`209JCJ7@qlock:ff,effective^hJD});};^j@v=^A4^i^A633]]&&^A633^O152]])J0j@n=^BJ"^AJ\')^ol=^BJ"^=63]])^oy=falseJ2cc=j@l;cc@u^A480]];cc+=j@n){if(^n^;){j@y=true^j@y=false;break ;}J$j@y){^AJ\'=j@n;^=63]]=j@l;};}J2cc=^=63]];cc@u=j@v;cc=parse@sloat((cc+^AJ\')^`275]](14)))J0iT=^96]]?^9J@{chart:^A379]],axis:^A372]],value:cc,label:^n^;?^n^;J.}):^A351^M[462]&&^n^;?^n^;:@m(cc,^97]],^V^-363]]);ff=J8bi(^A392]],{x:0,y:0,max@wJ4jS,max^hj@r,angle:^)J7:^98]]+iT+^99]],horizontal@zlign:^e360],fontSize:^=66^gsamily:^=80^gweight:^=81^rCJ9^=82^rStyle:^=83^caseline:^e764],borderThickness:0});^"^e274]]({position:ccJ7@qlock:ff,effective^hJD});};}J2^bcc@u^90]][J,^kt){^UJ5]=^U[J\'@bks+^UJ3]^\\kt>ks){^PJ5]=^P[J\'@bkt+^PJ3]}};^qo=e^G6J>]?^PJ>]^^j=^N6J>]?^UJ>]^^m=e^G6J?]?^PJ?]^^h=^N6J?]?^UJ?]^^p=e^G6[355]]:0J#k=e^G6[355]]:J6kd=^S12]){^L674]]={^qq=^B173]](e^G6[886]^yf@w=^ ^C4]]+kq+kp);^p^!414J)wJ#l=^BJ"^N6[886]^yf@m=^ ^C6]]-kl>^f9^-3^x?^f9^-310]^+6]]-kl);^p^!416J)m;^p^!J&=Ma^/^v)J#e=^BJ"^L891JC);f@p=^ ^CJ(eJ;^:f@i=^ ^C7]]J;^:^p^!415J ^p^!417J ^f976^3^%^Q^(if(e@x){f@w=^ ^C4]]+e@x[^:f@p=^ eD^>@u10?10:eD^>);f@m=^ ^C4]]+kq+e@x[^:f@i=^ ^CJ(eJ;^:^P[^]f@m,y1^%^uMa^/f@i-f@p)};^P^3^%^Q^(J$kg){f@w=^ ^p^!416]]);f@p=^ eD^>@u10?10:eD^>);f@m=^ f@w+kl+kg[^:f@i=^ ^CJ(eJ;^:^U[^]f@w,y1:f@p,x2:f@w,y2:f@i,^uMa^/f@i-f@p)};^U^3^%^Q^(};^L894]]^$976[J!}^#J!}^[JA1J@^F[717]](5,^L742]]^>,^f9^-3^x,^L742^OJ%^F[718]^HJ-5]](^F[730]]^$9J-5J*^#895J*;k^R570]^kep=^f9^-405]]^[JA1J@^F[717]](ep[^W4]],ep^>,Ma^/ep[^W6]]-ep[^W4]]),Ma^/ep[^W7]]-ep^>)^F[718]^H76^K6[885]);^&^K6^}^#896]^a^};^L897]]^$9J-7J*^#^l^[JA30]^H7^{^$97^{()}^#898]]^,9]]^$9J-9J*^#899]]^,6]]^@;^&[896]]^@}^#896]]^@};^wJEkf=^BJ"^L88J@));^&[674]]={};f@w=^ ^C4]]+kfJ<^:f@m=^ ^C6]]>^mb9^-3^x?^mb9^-310]^+6]]);^m^!414J)w;^m^!416J)m;^m^!J&=Ma^/^v);}^#674]]={};f@w=^ ^C4]]+kfJ<^:f@m=^ ^C6]]>k^t^-3^x?k^t^-310]^+6]])^s^!414J)w^s^!416J)m^s^!J&=Ma^/^v);^qn=^B173]](e^G6[891]^yJEki=^BJ"^N6[891]^yif(e@x){f@p=^ ^CJ(n-e@x[^:f@i=^ ^CJ(p>^mb9^-J%-10?^mb9^-311]^+J(p);^m^!415J ^m^!417J ^P^3^%wJ4^v,^ukn}^|g){f@p=^ eD^>+kg[^:f@i=(eD^>+^U[355]]+ki)^s^!415J)i^s^!417J)i;^U^3^%wJ4^v,^uki};};f@w=^ ^C4]]J<^:f@p=^ kg?kg[_$_^!417]]:(eD^>@u10?10:eD^>));f@m=^ ^C4]]+kfJ<^:f@i=^ e@x?^m^!415]]:(^CJ(p>^f9^-J%-10?^f9^-311]^+J(p));^L^]f@m,y1^%^uMa^/f@i-f@p)};^f976^3^%^Q^(^L894]]^$976[J!}^#J!};^&[895J*^#895]]^,5JC;k^R570]^kep=^f9^-405]]^[JA1J@^F[717]](ep[^W4]],ep^>,Ma^/ep[^W6]]-ep[^W4]]),Ma^/ep[^W7]]-ep^>)^F[718]^H76^K6[885]);^&^K6^}^#896]^a^};^L897]]^$9J-7J*^#^l^[JA30]^H7^{^$97^{()}^#898]]^,9]]^$9J-9J*^#899]]^,6]]^@;^&[896]]^@}^#896]]^@};};};h^`125^O895]]^8kw=falseJ#@z=0J#x=1J#v=0^ok=^A724^O725]]@b^A6^i^)!==0&&^)!==360){kx=1.2J$ ty^1^5J\')=^?){if(th^.^S113J/^.^S9]){^J^"J,^^n_^!J&@bkx){kw=true};J$th^.^S360J/^.^S14]){^J^"J,^^n_^!J%@bkx){kw=true};};J$th^.^S113]){^bJEkuJ1er;^J^"J,^^A480]]^Ier=^A68J@ku^`353]]);if((^A902]]&&!^"JF^E)||(^"JF^E&&^"JF^E^`903^M[900])){if(^"JF^E){jT=^"JF^E;^A^D[162]]=^T[904]];^A^D[160]]=^T[522]];^w^A^D[162]]=^A902]];^A^D[160]]=^A905]];^qy=(^A^D[162]]%2===1)?(e^R1JB@J=+0.5:(e^R1JB@J=;^A^D[163JC;^A^D[164]](ky,e^RJG]@J=;^A^D[165]](ky,(e^RJG]+^=90]])@J=;^A^D[169JC^|w&&kv++ %2!==0&&!^"JF^E^I^_9^0807]]===0){e^R1JB-=^d^0J&/2;e^RJG]+=^=90]]+^d^0298]]/2;^we^R1JB-=(^)@u0?(^d^0^2JA6J@^B^\'b^X):0);e^RJG]+=^=90]]+Ma^/(^)@u0?^d^0^2JA^76[^\'b^X-5:5));};^d^01JB=e^R1JB;^d^0JG]=e^RJG];^d^0433]](true);J$thi~^B193]](~b976[674^O~^=64]][~;if(kg){^U[~();if(e@x){^mb~:f@p,x2:f@m,y2:f@i,~if(e@x){^P~748]]/180@b^n_~@w,^uf@i-f@p};~^=69]]~76[161]&& typeof (~]-10:^C~()};^L89~76[379^O~is^`868]]=~th^`263]](~76[843^O~peof (^V7~J&@bMath[_$_b9~[742]]={x1:f@w,y1~]]/180@bMath[_$_b~6[372^O~>>0:^V76~67]](Math[J,7~=function()J0~^=7~^e355]]);~_b976[633]][cc]~76[152]];cc++){~^A8~[^W5]]~^S161]~(^e900])~^V76[~Math^`~eD[^W~392]][J,76~^e901]]~)^[76~@x?^mb97~]();^f9~){continue };~for(cc=0;cc@u~[896]](J,7~e@j^`~]]===J,76~kg?k^t7~]]^`~^mb976~wJ4f@m-f~r^`~==^e~jT[J,76~k^t76~^n_b9~^e41~976[869]])~h@w[J,7~]])===_$_b~;e@o[J,~^wif(~674]]={x1:~:0:0J#~if(ku[_$_b~[^e~](J,76~JEcc=0;~]]J7@q~ku[J,~J,76[~^pb~^r@~@xeight:~80]];if(~^wj~]()J1~897J*~e@x[_$_~this[_$~J1j@~e@j[_$_~}J#~]],font~;kg[_$_~g[J,~height:~f@m-f@w~}else {~10]]-10~]():0);~6[263]]~6[898]]~;J$k~[885])}~J)p;~894JC~173]](~J1k~};if(~311]]~310]]~680]]~7]]-k~]]=f@~JC}~874]]~_$_b9~76[89~:JD~]||th~{JE~;JE~;for(~[478]~idth:~[480]~0;if(~,text~ new ~olor:~S= ty~-e@j[~+e@j[~u@u0)~[719]~[867]~6]](~76[7~70]]~]]()~null~var ~cc][~629]','s^m361]]){^8= ^WbJ-92]],{x:^p^!4J1,y:^a742^c17]]-^Y65]]-5,m^G^!310]]^1^r^U0^XJ-61]]^.$_b^9his^m865]],f^/^|8]],^-_^|9]]^5^}6]]^7^}7]]^4J99]});^8^m^w^8^m170^l_^!4J1+^p^!310]]/2-^8[_$^h/2;^8^m629^Q[742^c17]]-^8^mJ,-3;^8^q^V^&9^#9]){J2cc=0J.ku^vJ2jT^`^ _$_b9^Pku=^ J&ku^mJ!^?]||ku^m^A6[^)r=^=](ku^LJ0^Z902J7!^ ^;)||(^ ^;&&^ ^;^m903]]=^_))J8^ ^;){jT=^ ^;^j^"62^b[904]]^j^"60^b[522^0^"62^@02]]^j^"60^@05]];J)ky^kb^"^+bJ9J4]@^*76[J4^F^"J*^j^"64J3y,^R^F^"65J3y,(^R]-^Y90]])@u@u0)^j^"^xJ0kw&&kv++ %2!==0&&!^ cc]^q^,ifJ(^$807]]===0){^H-=ku[_$_^$310]]/2;^R]-=^Y90]]+ku[_$_^$J,/2;}else {^H-=^N69]]>0?J(^$^C76[766]^\\^3^r9]])):0);^R]-=^Y90]]+^<](^N69]]>0?ku[_$_^$^C76[767]^\\^3^r9]])+5:5));}J%^$J4]=^HJ%^$629]^B]J%^$433]](J:);};^I361]]){^8= ^WbJ-92]],{x:^p^!4J1,y:^a742^c15]]+1,m^G^!310]]^1^r^U0^XJ-61]]^.$_b^9his^m865]],f^/^|8]],^-_^|9]]^5^}6]]^7^}7]]^4J99]});^8^m^w^8^m170^l_^!4J1+^p^!310]]/2-^8[_$^h/2;^8^q^V^&9^#360^{u^vfor(J2^o^ _$_b9^Pku=^ J&ku^mJ!^?]||ku^m^A6[^)r=^=](ku^LJ0^Z902J7!^ ^;)||(^ ^;&&^ ^;^m903]]=^_))J8^ ^;){jT=^ ^;^j^"62^b[904]]^j^"60^b[522^0^"62^@02]]^j^"60^@05]];J)kz^kb^"^+b9J$]@^*J$^F^"J*^j^"64]](^H^6^"65]]((^H-^Y90]])^6^"^xJ0kw&&kv++ %2!==0&&!^ cc]^q^,J+^$J4]=^H-J(^$^C76[766]^\\^3^r9]]))-^Y90]]-5;^I869]]J\'J/^$629]^B]^tJ/^$629]^B]-J(^$^C76[767]^\\^3^r9]]))}J%^$433]](J:);};^I361]]){^8= ^WbJ-92]],{x:^a742^cJ1+1,y:^p^!417]],m^G^!J,^1^r^U-90^XJ-61]]^.$_b^9his^m865]],f^/^|8]],^-_^|9]]^5^}6]]^7^}7]]^4J99]})J.h@w=^8^m^w^8^[^k^!J,/2+^8[_$^h/2+^p^!415]]);^8^q^V^&9^#14^{u^vfor(J2^o^ _$_b9^Pku=^ J&ku^mJ!^?]||ku^m^A6[^)r=^=](ku^LJ0^Z902J7!^ ^;)||(^ ^;&&^ ^;^m903]]=^_))J8^ ^;){jT=^ ^;^j^"62^b[904]]^j^"60^b[522^0^"62^@02]]^j^"60^@05]];J)kz^kb^"^+b9J$]@^*J$^F^"J*^j^"64]](^H^6^"65]]((^H+^Y90]])^6^"^xJ0kw&&kv++ %2!==0&&!^ cc]^q^,J+^$J4]=^H+^Y90]]+5;^I869]]J\'J/^$629]^B]^tJ/^$629]^B]}J%^$433]](J:);};^I361]]){^8= ^WbJ-92]],{x:^a742^c16]]-1,y:^p^!417]],m^G^!J,^1^r^U90^XJ-61]]^.$_b^9his^m865]],f^/^|8]],^-_^|9]]^5^}6]]^7^}7]]^4J99]});^8^m^w^8^[^k^!J,/2-^8[_$^h/2+^p^!415]]);^8^q^V}}}^:^i897^]J2e@o=^p^%405]^i392J"kCJ qJ.kD=^p^%405J"cc=0,kE=J:J0(^pb9^#^J^#9])&&^a908]^M159^@08]]^`^ _$_b9^Pif(^ cc]^q^,if(kE){kC=^=](^ cc]^LJ0cc+1>=^ ^s152]]-1){k@q=^=]^Z480]])^t@q=^=](^ cc+1]^L};e@o^m649J3C^mJ4],kD^g5]],^<](k@q^mJ4]-kC^mJ4]),^<](kD^g5]]-kD^g7]]));kE=false;^tE=J:};};}else J8(^pb9^#3^S^#14])&&^a908]^M159^@08]]^`^ _$_b9^Pif(^ cc]^q^,if(kE){k@q=^=](^ cc]^LJ0cc+1>=^ ^s152]]-1){kC=^=]^Z480]])^tC=^=](^ cc+1]^L};e@o^m649J3D^g4]],kC^[,^<](kD^g4]]-kD^g6]]),^<](kC^[-k@q^[));kE=false;^tE=J:};};}}^K3]]()^D^i896]^e@s)J8!^N70J7^Y70]^i152]]>0)|| !k@s){J#J)c@v=thisJ.cc=0^`^Y70]][_$_b9^PJ2jT=^Y70]][J&jT^m903]]!==k@s){continue }J0k@s=^_&&(jT^m885]]@u^?]||jT^m885]]>^a480]])){continue }J0jT^m909]]){^p^%196]](^s605],jT^m433]],jT)}else {jT^m433]]()};^:^i898^]if(!^N67J7^Y67]]>0)){J#J)e@o=^p^%392]]^vJ2kD=^p^%405J"jTJ.kI,k@h^K2^Q[867]]^K0^@10]]J0e@o^mJ;^M720]](@t^Z911]],^Y67]]))}^db9^#^J^#9]){for(^o^ ^s152J7!^ ^;;cc++)J8^ cc^iJ!^?]||^ cc^i^A6[^)@o^m1J*;er=^=](^ cc]^LJ j=(e@o^m1^+bJ9J4]@^*76[170^(6[164J3@j,kD^g5^(6[165J3@j,kD^g7^(6[1^x^&9^#3^S^#14]){for(J2^o^ ^s152J7!^ ^;;cc++)J8cc===0&&^a351]^^3]&&^p^%462J7^p^%462]^iJ5]){continue }J0^ cc^iJ!^?]||^ cc^i^A6[^)@o^m1J*;er=^=](^ cc]^LJ x=(e@o^m1^+b9J$]@^*76[629^(6[164J3D^g4]]@u@u0,k@x)^K5J3D^g6]]@u@u0,k@x)^K9]]();}}^:^i899^]J2e@o=^p^%392]]^db9^#^J^#9]){^IJ5^M162^Q[J5]^K0^Q[847]]?^Y47]]:^s13]J0e@o^mJ;^M720]](@t^Z721]],^aJ5]))^zt=^ZJ5]%2===1)?(^p^!415]]@u@u0)+0.5:(^p^!415^(6[1J*^K4]](^p^!4J1,k@t)^K5]](^p^!416]],k@t)^K9]]();}^&9^#3^S^#14]){^IJ5^M162^Q[J5]^K0^Q[847]]J0e@o^mJ;^M720]](@t^Z721]],^aJ5]))^zo=^ZJ5]%2===1)?(^p^!4J1@u@u0)+0.5:(^p^!414^(6[1J*^K4J3@o,^p^!415]])^K5J3@o,^p^!417]])^K9]]();}}^:^i686]^eN){J2er={J)cT=^p^!310J"cS=^p^!J,^db9^#^J^#9^{M=cT/^<](^pb9^\'76^y^H=^p^!4J1+(kM@b(kN-^?]));^R]=^p^!415]];}^db9^#3^S^#14^{M=cS/^<](^pb9^\'76^y^R]=^p^!417]]-(kM@b(kN-^?]));^H=^p^!416]];};J#er^D^i859]^e@v)J8!k@v){J#J6J)jN=J6^db9^#360]){jN^k^%^u_b9^\'76[379^c62^c78]])/^p^%^u_^!J,@b((^p^%^u_^!417]]-k@v^[))+^p^%462^c78]]^&9^#113]){jN^k^%^u_b9^\'76[379^c62^c78]])/^p^%^u_^!310]]@b(k@v^mJ4]-^p^%^u_^!4J1)+^p^%462^c78]]}};J#jN^D^i894]^eN){J2er={^zy={pixel@yer@nnit:J6,minimum:J6,reference:J6J)cT=^p^!310J"cS=^p^!J,;k@y^m478]]=^?]^db9^#^J^#9]){k@y^m725]]=cT/^<](^pb9^\'76^yk@y^m723^l_^!4J1;}^db9^#3^S^#14]){k@y^m725]]=-1@bcS/^<](^pb9^\'76^yk@y^m723^l_^!417]];};^a724]]=k@y^D^i893^]J2eD=^p^%517]^i568]]()J r=0J k=0J.kS=false^db9^#^J^#9]){^YJ1=eD[_$^h;^Y19]]=eD^m311^0J98J1=eD^mJ,;^Y19]]=eD[_$^h;^zn=^a351]^^2]?^NJ1@u500?8:Math^m195]](6,Math^m174]]^NJ1/62))):Math^m195]^\\[174]]^NJ1/40),2)J.i@m,i@wJ.kTJ wJ m=0;^I351]^^2]){i@m=^Z465^c79]]!==J6)?^a465^c79]]:^a6^O4]];i@w=^Z465^c81]]!==J6)?^a465^c81]]:^a6^O5]]J0i@w-i@mJ\'@m^29^>680]^E?0.4:^pb9^>680]];i@w+=k@m;i@m-=k@m;};^I6^O1]]!==Infinity){kT=^a6^O1]]^fw-i@m>1){kT=^<](i@w-i@m)@b0.5^tT=1^d^%516]^i636]]===^s628]){kS=J:};}};^&J-51]^^3]){i@m^29^>478]^E||^pb9^>478]]===J6?^a6^O4]]:^pb9^>478]];i@w^29^>480]^E||^pb9^>480]]===J6?^a6^O5]]:^pb9^>480]]J0!is@sinite(i@m)&&!is@sinite(i@w)){i@w^29^>680]^E?-Infinity:^pb9^>680]];i@m=0;^fm===0&&i@w===0){i@w+=9;i@m=0;^fw-i@mJ\'@m=Math^m630]](^<](^<](i@w)@b0.01),5);i@w+=k@m;i@m-=k@m;^fm>i@w){k@m=Math^m630]](^<](^<](i@w-i@m)@b0.01),5);~^Y64]][~b976[674]^i~976[392]^i1~76[868]]===^s~b976[843]^i~b976[379]^i~}else {if(^pb~76[480]]-^pb9~]]@u@u0);e@o[_$_b97~480]]){continue };e~u@u0)+0.5:(er[_$_b9~62]]%2===1)?(er[_$_~[901]]){continue };~font@weight:this[_$~,horizontal@zlign:_~ont@samily:^p~]];}else {^pb~,max@xeight:this[_$~= typeof (^pb~[748]]/180@bthis[_$~,text@qaseline:_$_b~,fontColor:^p~@u@u0,kz)^j~,fontStyle:^p~^Y71]]~J910],fontSize:t~}^D~cc^i901]]~Math^m263]~^a686]~76[372]^i~^a478]~^Q[9~353]]>^pb97~]=^R~310]]@bMath[_$_b9~;};h^m125]~])===^s161]~]@u@u0)^j~ax@width:^p~er^m170]]~if^Z~113]||^pb9~;e@o^m16~^m353]])~]){e@o^m~(^Y~26]^i63~76[152]];cc++){~^l_b976~er^m629]~60]||^pb9~^a62~5]]@b1.5,angle:~[433]](J:);};~new bi(^p~,text:^pb~^a8~(^a~^m629]]~](Math^q~]]=function(){~]===^s46~==^s900]~;for(^o~this^m~]]=jT^q~]^i4~;if(^p~]=function(k~}else J8i@~^m41~_bJ-10]]~]^m~;^pb~=(^p~]]=this[_$~^q[~[^w~cc=0;cc@u~this[_$_~[_$_b976~_bJ986~_$_bJ9~}else {k~462]][_$~J.er;~708]]();~69]]();}~[478]]);~}J ~]){J2k~bJ988~bJ990~J.k@~353]]@u~]]J.~return ~76[629]~;J+~cc]J0~===0){k~(J+~}J.~63]]()~kJ/~311]]~J93~;J2~u[_$_~;if(~14]]~var ~]](k~170]~719]~null~]]&&~{if(~976[~true~720]','if(i@w>=0){i@m=i@w-k@m^ji@w=i@m+k@m};^jk@m^4630]^D[263]^D[263]](i@w-i@m)@b0.01),0.05)^zi@w!==0){i@w+=k@m^qi@m!==0){i@m-=k@m};}}}^q^)12]]&&(^_^+2]]^.)=^;||t^+2]]^.==^t)^pi@m>0){i@m=0}^q^)12]]&&(^_^+2]]^:)=^;||t^+2]]^:==^t)^pi@w@u0){i@w=0}};}};^56^I76[462]&&^g^"516^P636]]=^b628]){k@w=i@w-i@m^z!^J681]]){i^X1^f^$=1;^ ^i^3^X2^f^$=2;^ ^i^3^X^a^$=5;^ ^i^3^X1^Y^$=10;^ ^i^3^X2^Y^$=20;^ ^i^3^X5^Y^$=50;^ ^i^3^X1^T^$=100;^ ^i^3^U^T^$=200;^ ^i^3^X25^Y^$=250;^ ^i^3^X3^T^$=300;^ ^i^3^X4^T^$=400;^ ^i^3^X5^T^$=500;^ ^i^3^!3^<^$=1;^ ^i^A^!3^?^$=2;^ ^i^A^!3^x^a^$=5;^ ^i^A^!3^x1^Y^$=10;^ ^i^A^!3^x1^a^$=15;^ ^i^A^!3^x2^Y^$=20;^ ^i^A^!3^x3^Y^$=30;^ ^i^A^!4^<^$=1;^ ^i^=^!4^?^$=2;^ ^i^=^!4^x^a^$=5;^ ^i^=^!4^x1^Y^$=10;^ ^i^=^!4^x1^a^$=15;^ ^i^=^!4^x2^Y^$=20;^ ^i^=^!4^x3^Y^$=30;^ ^i^=^!5^<^$=1;^ ^i[^L^!5^?^$=2;^ ^i[^L^!5^x3^f^$=3;^ ^i[^L^!5^x6^f^$=6;^ ^i[^L^!6^<^$=1;^ ^Z0^[^!6^?^$=2;^ ^Z0^[^!6^x4^f^$=4;^ ^Z0^[^!7^<^$=1;^ ^Z3^[^!7^?^$=2;^ ^Z3^[^!7^x3^f^$=3;^ ^Z3^[^!8^<^$=1;^ ^i^F^!8^?^$=2;^ ^i^F^!8^x3^f^$=3;^ ^i^F^!8^x6^f^$=6;^ ^i^F^!9^<^$=1;^ ^Z7^[^!9^?^$=2;^ ^Z7^[^!9^x4^f^$=4;^ ^Z7];^j^$^4174]](h[_^`]](k@w/(k@n-1),true)/r^e919]]);^ ^Z7];^*^*^*}};^56^7[479^\\{^y^.=^N^7[479]]^j^y^.=i@m-kT/2};^56^7[481^\\^/^u=^N^7[481]]}else ^/^u=i@w+kT/2^q!^J877]]^pkS)^/^6921^R^ ^Q47])^/^6234^R^ ^Q44])^/^6922^R^ ^Q43])^/^6923^R^ ^Q40])^/^6923^R^ ^Q37])^/^6924^R^ ^Q34])^/^6924^R^ ^Q31])^/^6925^R^ ^Q28])^/^6926]^m}}}}^0863]]=^)27]](^d^y^.),^J681]],^$);^j^ ^i[29];k@w=h[_^`]](i@w-i@m,false)^zt^+2]]&&t^+2^P680]]){^$=t^+2^P680]]^j^$=h[_^`]](k@w/(k@n-1),true)};^56^7[479^\\{^y^.=^N^7[479]]^j^y^.^4174]](i@m/^$)@b^$};^56^7[481^\\^/^u=^N^7[481]]}else ^/^u^4173]](i@w/^$)@b^$};^56[^u===0&&^y^.===0^pt^+2]]^.===0)^/^u+=10^jif(t^+2]]^:===0){^y^.-=10}^qt^+2]]&&^_^+2^P680]])=^;){^$=h[_^`]]((^y^:-^y^.)/(k@n-1),true)^}^56^I76[462]^p!(^N^7[479^\\){^y^.=i@m-kT/2^q!(^N^7[481^\\)^/^u=i@w+kT/2}^0863]]^4174]]((^y^.+(^$@b0.2))/^$)@b^$;^j^56^I76[463])^/863]]=^y^.}^}^56^I76[462])^/675]]=t^+2]]&&^_^+2]]^.)!^;?t^+2]]^.:^J626^P630]]-kT/2^0676]]=t^+2]]&&^_^+2]]^:)!^;?t^+2]]^::^J626^P195]]+kT/2;^q!^J877]])^/^6928];k@w^4263]](^y^:-^y^.)^zk@w@u1^nk@l^4174]^D[263]^D[376]](k@w)/^W6[929]]))+2^zisNaN(k@l)||!is@sinite(k@l)){k@l=2^qk@l>2){for(^|cc=0;cc@uk@l-2;cc++)^/877]]+=^i[172]}^}^}h[_^`^Ocz,lb^nk@p^4174]^D[376]](cz)/^W6[929]]);^|k@i=cz/^W6[271]](10,k@p)^la^zlb^pk@i@u1.5){la=1}^C3){la=2}^C7){la=5^jla=10}}}}^C=1){la=1}^C=2){la=2}^C=5){la=5^jla=10}}}};return Number((la@b^W6[271]](10,k@p))^e275]](20));};h[^i^E[927^O^nld=s(^$,^J681]])^le^4174]]((^y^.)/ld)@bld^lc=^dle)^z^ ^Q28]){^jif(^ ^Q31^@76[129]](^>6[133^K[132^{+1^,^r^B^ ^Q34^@76[132^{^1^k^>6[136^K^w]()+1^,^o^,^r^B^ ^Q37^@76^w]()^1^h^1^k^>6[139^K[13^s+1^,36]](0^,^o^,^r^B^ ^Q40^@76[13^s^1^w]()^1^h^1^k^>J 2^K[141^{+1^,39]](0^,36]](0^,^o^,^r^B^ ^Q43^@76[9^r)^1[13^s^1^w]()^1^h^1^k^>J 2^K[141^{+(7-lc^e9^r))^,39]](0^,36]](0^,^o^,^r^B^ ^Q44^@7J 1^{>1||lc^]3^s^1^w]()^1^h^1^k^>J 6^K[145^{+1^,42]](1^,39]](0^,36]](0^,^o^,^r^B^ ^Q47^@7J 5^{^1[141^{>1||lc^]3^s^1^w]()^1^h^1^k^>J 9^K[14^s+1^,46]](0^,42]](1^,39]](0^,36]](0^,^o^,^r0);^m}}};return lc;};function bg(kr,cD,c@j,d@p,ny){bg^]27^P126^P204]](^y,^i[931],cD,c@j,ny)^0647]]=d@p;t^+9]]=kr^0392]]=^g^"392]]^0632]]=^J632]];^)03^S900]^z^)32]]!=^t&&^)33^\\^/885]]=((^)32^P209]]?^)32^P209^{:^)32]])+(^)33^P209]]?^)33^P209^{:^)33]]))/2;^)04]]^4195]](^)33]]-^)32]]);^)03^S885];};}@s(bg,m);bg[^i^E[433^O^ner=t^+^M686]](^J885]])^lf^4263]](^)03]]=^b900]?^)04]]:t^+^M724^P725^x^)04]])^zlf>0^nlh=^)34]]==^t?1:^)34]]^0^9160]]=^J522]]^0^9163^{^lg=^N^2[682]]^0^9682]]=lh;^|fr=@r(^J647]]);^|f@w,f@m,f@p,f@i^0^9162]]=lf;^56^2[720]])^/^9720]](@t(^J721]],lf))^qt^+^M^H6[113]||t^+^M^H6[9]^nli=(^N^2[162]]%2===1)?^V[170]]@u@u0)+0.5:^V[170]]@u@u0);f@w=f@m=li;f@p=^g^"405^P415]];f@i=^g^"405^P417]^[f(t^+^M^H6[360]||t^+^M^HJ ]^nlj=(^N^2[162]]%2===1)?^V[629]]@u@u0)+0.5:^V[629]]@u@u0);f@p=f@i=lj;f@w=^g^"405^P414]];f@m=^g^"405^P416]];}}^0^9164]](f@w,f@p)^0^9165]](f@m,f@i)^0^9169^{^0^9682]]=lg;^}function bm(kr,cD,c@j){bm^]27^P126^P204]](^y,^i[935],cD,c@j);t^+9]]=kr^01]]=kr^]]]^0392]]=^g^"392]];^)36]]= -1;^)37]]= -1;^)38]]=0;^)39]]=NaN;^)40]]=NaN^050^s;}@s(bm,m);bm[^i^E[508^O){^56[671]]){^)41]]=document^e2]](^i[421]);^)^891]](^i[314],^i[942]);^)^89^M353^S426];^)^89^M311^S25];^)^89^M943^S944];^)^89^M945^S946];^)^89^M189^S194]^lk=^i[947]^-48]^-49]^-50]^-51]^-52]^-53]^-54]^-55]+(T?^i[956]:^i[957])^-58]^-59]^-60]^-61]^-62];lk+=T?^i[963]:^i[964]^-65]^-66]^-67]^-68]^-69]^-70]^-71]^-72]^z!T){lk+=^i[973]^-74];}^-75];^)^885]]=lk;^)76]]=^)41^P977]];^)^89^M978]]=^)76^P19^M978]];^g^"42^M188]](^)41]]);}};bm[^i^E[677^Ocz,c@z^p!(^)79]]&&(^d)^e209^{-^)79]])@u40)){^)79]]=^d)^e209^{^0608]](cz,c@z);}};bm[^i^E[608^OdT,d@n^p^g^"401]]^c^z typeof (dT)=^;|| typeof (d@n)=^;^pisNaN(^)39]])||isNaN(^)40]])^celse {dT=^)39]];d@n=^)40]];}^j^)39]]=dT;^)40]]=d@n;};^|gq^t;^|c@n^t^lq=^i[20]^lm=[]^ls^lp;^|cz=0^z^)80]]&&^J671]]&&^g^"516^P542]]!^Q94]^p^g^"516^P542]]=^b543]){cz=(^g^"^v^:-^g^"^v^.)/^g^"462^P674^P311^x((^g^"462^P674^P417]]-d@n))+^g^"^v^.^jcz=(^g^"^v^:-^g^"^v^.)/^g^"462^P674^P310^x(dT-^g^"462^P674^P414]])+^g^"^v^.}^ln=[];for(^|cc=0;cc@u^g^"282^P152]];cc++^nht=^g^"282]][cc]^e858]](cz,true)^zht&&ht^e524]]>=0){ht^e567]]=^g^"282]][cc]^zht^^41^P629^\\{ln^e274]](ht)^}^qln^]52]]===0^c;ln^e541]](function(ik,il){return ik^^42]]-il^^42]]})^ll=ln[0];for(cc=0;cc@uln^]52]];cc++^pln[cc]^^^87^M981^{===ll^^^87^M981^{){lm^e274]](ln[cc])}};ln^t;^j^|d@m=^g^"640]](dT,d@n,true)^zd@m){^)37]]=d@m^^44]];^)36]]=d@m^e567^P524]^[f(T^nd@p=N(dT,d@n,^g^"43^M645]])^zd@p>0&& typeof ^g^"43^M722]][d@p]!^;){event@vbject=^g^"43^M722]][d@p]^zevent^G6[982]]=^b845]^c;^)36]]=event^G6[846]];^)37]]=event^G6[644]]>=0?event^G6[644]]:-1;^j^y[~^J681]]=~f(k@w/(r^e91~b976[379^P~^%}~^J680]]~^&}~^\'}~^(}~^*}~^J9~^m^m}}~his^e37~);lc^]~;lk+=^i[9~^e478]]~{^J~;^J~>0||lc[^i~[392]][^i~[128^[~=^W6[~if(^gb97~877^S~[465]][^i~41^P1~392^P~^e480]]~^Q61]~]]@b1^f~[134^[~)>0){lc[_$_b97~]]@b2^f~]^plc[_$_b9~[131^[~0);}^jif(~else {if(k@i@u~](^W6~[125]][^i~[144^[~@vbject[_$_b97~868]]===_$_b97~[351]]===_$_b9~^N[~]](lc[^i~137^[~0^P~^gb976~]]=function(~]]^e~^b1~]^jif(~]]=^i[~0^Y~^X2~(er[^i~Math[_$_b97~f(k@w/(1@b~0^f~^i[14~];^ji~]]!=^t)~^e1~^e6~ typeof (t~$_b976[920~5^f~==^i[~){return }~ new Date(~[^i[~)@u=k@n){~^y[_$_~[132^{~_$_b976~}else {~[129]](~;^|l~}}}}}}~){^|~33]](0~){if(~}^z~30]](~8^{~=null~480]]~462]]~[135]~]]@b~this~;if(~]]()~var ~};};~6[14~209]','_^h937]]= -1^d^737]]= -1}}^|^736]]>=0){c@n=t^&^_282]][^736]]^uht={}^|^737]]>=0){gq=^F538]][^737]]];ht^_567]]=c@n;ht[^==gq;ht[_$_^[=^737]];ht^_642]]=M^2](gq^_170]]-cz);^lif(^;671]]&&^c9^ 525^D^ 526^D^ 527^D^ 5^9^ 52^>^ 530^D^ 5^C9^ 532^D^ ^:9^ 534^D^ 535^D^ 536])){^}cz=(t^&^i^,480]]-t^&^i^,^t/t^&^i^,674^R310]]@b(dT-t^&^i^,674]^E4]])+t^&^i^,478^R981]]();ht=^F858]](cz,true);ht^_567]]=c@n;^737]]=ht[_$_^[;gq=ht[^=;^l^m}}^|ht[^=^_629]]!^em^_274]](ht)};};^zm^_152]]>0){^;770J!m)^|^;671]^olr^G;lr=^783]]({entries:lm})^|lr!==null){t^`^56[185]]=lr;t^`^56[185]]=lr;^}lo=false^|t^+^g^)189]]=^Z194]){lo=true;t^+^g^)189]]=_^h489];};try{t^`^5^)984]]=^;467]]?^;467]]:T?_^h985^a[986^L^5^)987]]=t^`^5^)988]]=t^`^5^)750]]=^;750]]?^;750]]:^v^=^_J"]?^v^=^_J"]:^j^"76[J"]?^j^"76[J"]:^j^"76[523]][^j$_^[%^j^"76[523^R152]]^L^5^)989]]=(^;728J ^;728]J#0)?^;728]]+_^Y]:2+_^Y^L^5^)978]]=(^;809J ^;809]J#0)?^;809]]+_^Y]:5+_^Y];t^+^g^)978]]=t^`^5^)978]^L^5^)298]]=(^;298J ^;298]J#0)?^;298]]+_^Y]:14+_^Y^L^5^)J"]=^;810]]?^;810]^a[16^L^5^)300]]=^;300]]?^;300]^a[17^L^5^)296]]=^;296]]?^;296]^a[12^L^5^)294]]=^;294]]?^;294]]:T?_^h18^a[12];}catch(e){}^|^j^"^ 556^V^"^ 557^V^"^ 558^V^"^ 549^V^"^ 555^V^"^ 552^V^"^ 553])^B=dT-10-t^+^E2]]}else ^B=(((t^&^i^,674^R310]]/M^2](t^&^i^,480]]-t^&^i^,^t)@bM^2](^v^=^_170]]-t^&^i^,^t)+t^&^i^,674]^E4]]+0.5)-t^+^E2]]@u@u0;^O-=10;}^|^O@u0)^B+=t^+^E2]]+20}^|^O+t^+^E2]]>t^&^_407]^E2]])^B=M^J195]](0,t^&^_407]^E2]]-t^+^E2]])};^O+=_^Y]^|lm^_152]J#1&&!^780]]&&(^j^"^ 525^V^"^ 526^V^"^ 527^V^"^ 528^V^"^ 529^V^"^ 530^V^"^ 531^V^"^ 532])){lp=(^j^"^x^R674]^E7^b_^"^x^R674^R311]]/M^2](^j^"^x^R480^b_^"^x^R^t@bM^2](^v^=^_629^b_^"^x^R^t+0.5)@u@u0^lif(^j^"^ 549^V^"^ 555^V^"^ 552^V^"^ 553]){lp=(^j^"7^,674]^E7^b_^"7^,674^R311]]/M^2](^j^"7^,480^b_^"7^,^t@bM^2](^v^=^_170^b_^"7^,^t+0.5)@u@u0^llp=d@n}};lp=(-lp+10)^|lp+t^+^E3]]+5>0){lp-=lp+t^+^E3]]+5-0};lp+=_^Y];t^+^g^)360]]=^O;t^+^g^)113]]=lp^|!^;470J lo){^790]]()^l^791]]()^d^;477]](false)};};};};bm^_125^R770^Qlm){^}lu=t^&^_393]];t^&^_482]]();lu^X16]]();^}ep=t^&^_405]^ub@x=0;for(^}cc=0;c^T7^q;cc++){^}ht=lm[cc^ult=t^&^_430^R722]][ht[_^"76[621]][ht[_$_^[]]^|!lt||!lt^_982J lt^_982]]!^Z641]){continue };^}c@n=t^&^_282]][lt^_846]]^ugq=^F538]][lt^_644]]^udb^S[644]]^|gq^_992]]!==false&&(^F992]J#true||gq^_992]J#true)){if^c9^ 525^D^ 526^D^ 527^D^ 53^>^ 5^9^ 52^>^ 530^D^ 5^C9^ 532^D^ ^:9^ 534^ofv=^F726]](db,l^K4^8415]],t^&^_393]]);^<7]]=M^J195]](^<7]]@b1.5@u@u0,10);fv^X50]]=fv^X50J _^h993];^<8]]=^<8J M^J173]](^<7]]@b0.1);bb^X29]]([fv])^|^fl^K7]])!^Z161^ofv=^F726]](db,l^K4^8417]],t^&^_393]]);^<7]]=M^J195]](^<7]]@b1.5@u@u0,10);fv^X50]]=fv^X50J _^h993];^<8]]=^<8J M^J173]](^<7]]@b0.1);bb^X29]]([fv]);};}e^\'^ 540^ofv=^F726]](db,l^K4^8415]],t^&^_393]]);^<7]]^S[727]];fv^_J"]=_^h3];fv^X50]]=_^h3];lu^_682]]=0.3;bb^X29]]([fv]);^n^M}e^\'^ ^9^ 550^D^ 551^D^ 54^>^ 555^D^ 552^D^ 553^D^ 554]){@q(lu,l^K4^8^3[416^8417]],_^h3],0,null^$,false,0.3)}e^\'^ 556^D^ 557]){C(lu,lt[^W^8754]],_^h3],^F351^8759^8760]],0.3)}e^\'^ 535]){^n^Ml^H0]]^S[J"];l^H2]]^S[728]]@b2;b@x=(l^H2]])%2===0?0:0.5;lu^i6^497^6^%^h417]^15]^U6[994]]-b@x,M^J630]^U6[^3[861]]));l^H^Pb976^497^6976[994]]-b@x,M^J195]^U6[^3[861]]));l^H5J!t[_$_b^%^h860]^19]]();@q(lu,l^K4]],M^J630]^U6[^3[861]]),l^K6]],M^J195]^U6[^3[861]]),_^h497],lt^X28]]@b2,lt^_J"]^$,false);^n^M}e^\'^ 536]){^n^Ml^H0]]^S[J"];l^H2]]^S[728]]@b2;b@x=(l^H2]])%2===0?0:0.5;lu^i6^497^6^%^h417]^15J!t[_$_b^%^h860]^1^Pb976^497^6976[994^8415]^15J!^K4^8415]^1^Pb976^497^6976[994^8861]^15J!^K6^8861]^1^Pb^M}}}}}}};};^n^Ml^H3]]();^m;};bm^_125^R983^Qen){^}lm=en^_995]^ulr^\\c@n^\\gq^\\db=0;^}fn^\\lq^G;^}lv=true;for(^}cc=0;c^T7^q;cc++){if(^s_^"76[996J ^s^=^_996]]){lv=false;break ;}^zv&&((^797]]^#_b97^k)=^Z998])||^799]])){^}ec={chart:t^&,toolTip:^;372]],entries:lm};lr=^799]]?^799]](ec):^797]](ec);^lif(^780]]&&t^&^_516^R542]]!^Z194^olw^G;for(^}cc=0;c^T7^q;cc++){c@n=lm[cc]^_567]];gq=^s^=;db=^s_$_^[;lq^G^|cc===0&&lv&&!^797]]){lw+=^ft^&^i^,633]][gq^_170]]])!^Z161]?t^&^i^,633]][gq^_170]]]:^W00];lw+=^W01];lw=t^&^X04J!w,^^;}^|^*^r||(^f^*)=^Z161]&&^F372^R996]]^r)){continue };if^c9^ 525^D^ 526^D^ 527^D^ 5^9^ 52^>^ 530^D^ ^9^ 54^>^ 53^>^ 550^D^ 551^D^ 552^D^ 553^D^ 5^C9^ 532^p^*?^*:^-^?[^/7^k^#^{^06[9^.^I^y2]}e^\'^ 540^p^*?^*:^-^?[^/7^k^#^{^06[9^.^I^y3]}e^\'^ 556^D^ 557^D^ 558^p^*?^*:^-^?[^/7^k^#^{^06[9^.^I^y4]}e^\'^ 554^D^ 555^D^ ^:9^ 534^p^*?^*:^-^?[^/7^k^#^{^06[9^.^I^y5]}e^\'^ 535^D^ 536^p^*?^*:^-^?[^/7^k^#^{^06[9^.^I^y6]+^W07]+^W08]+^W09]+^W10]}}}}^zr=^er^G}^|^;839]J#true){lr=t^&^X04J!q,^^+lr^|c^T7^q-1){lr=^W01]+lr^dlr+=t^&^X04J!q,^^^|c^T7^q-1){lr+=^W01]};};^zr!^er=lw+lr^dc@n=lm[0]^_567]];gq=^v^=;db=^j$_^[^|^*^r||(^f^*)=^Z161]&&^F372^R996]]^r)){^mnull};if^c9^ 525^D^ 526^D^ 527^D^ 5^9^ 52^>^ 530^D^ ^9^ 54^>^ 53^>^ 550^D^ 551^D^ 552^D^ 553^D^ 5^C9^ 532^w^*?^*:^-^?[^/7^k^#^{^06[9^.^I^(97^N976^]^@^h1013]}e^\'^ 540^w^*?^*:^-^?[^/7^k^#^{^06[9^.^I^(97^N976^]^@^h1014]}e^\'^ 556^D^ 557^D^ 558^w^*?^*:^-^?[^/7^k^#^{^06[9^.[997]]:(gq^_520]]?^W15]:gq^i^N976[1016^a[20])+^W17]}e^\'^ 554^D^ 555^D^ ^:9^ 534^w^*?^*:^-^?[^/7^k^#^{^06[9^.^I^(97^N976^]^@^h1018]}e^\'^ 535^D^ 536^w^*?^*:^-^?[^/7^k^#^{^06[9^.^I^(97^N976^]^@^h1019]+^W07]+^W08]+^W20]+^W10]}}}}^zr=^er^G};lr+=t^&^X04J!q,^^;}};^mlr;};bm^_125^R991^Q){if(t^+^g^)1021]]){^m};t^+^g^)1021]]=_^At^+^g^)1023]]=_^At^+^g^)1024]]=_^At^+^g^)1025]]=_^A};bm^_125^R990^Q){if(!t^+^g^)1021]]){^m};t^+^g^)1021]]^G;t^+^g^)1023]]^G;t^+^g^)1024]]^G;t^+^g^)1025]]^G;};bm^_125]]^i6~76[351]]=^Z~e^\'7~^h567]][_$_b9~&&^fthis[_$~,false,false,false~976[994]]-b@x,lt[_~his^_379]]~lse {if^c9~76[1011]+(gq[_$_b~6[190^R~gq^_996]]~his^_941]~6[462^R~^F996]~98]?t^`76~996]]:t^`~[997]])!==_$_b97~]);l^H~^J263]~415]],lt^i6~[163]]();^n~76[976]^g~6[164J!t[_$_b~^;9~]],lt^_~28^D~533]||c@n[_$_b~this^_~fv^X2~_^h641]]~9^D~]?c@n^i6~b9^y0])+_~^h1022];~{^O~31]||c@n[_$_b~]||c@n[_$_b9~]^_41~c@n^_~=_^h20]~u^_16~[997]]:_$_b9~ath^_~t^_41~];t^`~976[682]]=1;~6[632]]?_$_b~toolTip@teft~9]]();lu[_$_~]]=function(~]]^_~=lt^i6~c@ulm[_$_b9~](lt^i~]||^j~_^h10~^_7~^h312~==_^h~b976[524]]~=null;^}~[1012]:_$_~gq,c@n,db)~[_^h~his[_$_b9~]:_$^{~]]-^v~(c@n[_$_b~};^l~==null){l~ typeof (~]^i~$^{[~[_$_b97~^v_~6[997]]~}else {~return ~lu[_$_b~]){^}~]){lq+=~6[152]]~===null~lm[cc][~478]])~];^}~lm[0][~]){lq=~76[463~76[100~}^|l~_b976~;if(~var ~]]||~]](l~522]~]===~}}}}','[477]^RxJ*!^I671]]^alx= typeof (lx)=^m[161]?true:lx;^I941^L90^L8JD^t194];^I936]]= -1;^I93JDNaN;^I940]]=NaNJGlx){^u^ 482J@JAnJ,^)698]^R@z,ly^{zJ8J$CJ8J$@qJ%if^5][_^e^Y697J2){lC=0;lz=l^c170^U209^Q6[170^U209J@:ly[_$^[JGlz in ^M618^U6JC){lC=^M618^U6JC[lzJ)!iJ0ly^F)J*lC===0JEq=0^pq=(ly^F/lC)@b100}^pq=0};}^vif^5^X[556]||l@zJ 6^@[557]){lC=0;for(i=0;i@u^M538^L5JBi++J*!iJ0^M538]][i]^F)){lC+=^M538]][i]^F}J(!iJ0ly^F)JEq=(ly^F/lC)@b100^pq=0};}};return {percent:l@q,total:lCJAnJ,^)704]^R@h,ly,l@z,lD,l@s^{I=/@e{.@b?@e}|"[@g"]@b"|@d[@g@d]@b@d/gJ\'kr=JI;l@s= typeof (l@s)=^m[161]?0:l@sJG^5][_^e^Y697J2||^5^X[556]||l@zJ 6^@[557]))&&(l@h[_^e^Y1026J2||l@h[_^e^Y1027J2)^{@q=^b26]J$C=^b27]J$zJ%JLfc=^I698]](l@z,ly);lC=fc^k701]]?fc^k701]]:lC;l@q=iJ0fc^k702]])?l@q:fc^k70JBdoJ+l@x=^t20J)^M1028]]JEx=^M1028]]^px=^b29]J\'k@l=^P[195]](^P[173]](^P[376]](1/^P[263]](l@q))/^P[929]]),2J.iJ0k@l)||!is@sinite(k@l)){k@l=2}^ol@j=0;l@j@uk@l;l@j++JEx+=^t172]JAl@h=l@h^V4^Y1026],@m(l@q,l@x,^d[363]]));l@h=l@h^V4^Y1027],@m(lC,^M1030]^30]^H]));}while(l@h[_^e^Y1026J2||l@h[_^e^Y1027J2);;}J$E=^jxJ*(cx[0^X[279]&&cx[cx[^D^X[279])||(cx[0^X[280]&&cx[cx[^D^X[280])){return cx^V7]](1,cx[^D)}J\'b@y=bn(cx^V7]](1,cx[^D));b@y=b@y^V4^Y1032],l@s)J\'dbJ%tryJ+cg=b@^c260]](/(.@b?)@es@b@e[@es@b(.@b?)@es@b@e]/J.cg&&cg^V2]]>0){db=bn(cg[2]);b@y=bn(cg[1]);};}catch(e){}J$@oJ%^6522^il^c522^Q6[522^K6[522]]?^M522^K6[523]][lD%^M523^L52]]]J(l^c506]](b@y)JEo=ly^}if(^M506]](b@y)JEo=l@z^G^t20]}}J\'kN=l@o[b@yJ)db!=J8){kN=kN[db]};^6170]J*^d[462]]&&^d[516^U636]^X[628^ix(^93^QJ-3^KJ-3]^33]]:^d[462]]&&^d[462^U877]]?^d[462^U877]]:^b34^:])^G@m(^93^QJ-3^KJ-3]^33]^H^:])}^}^6629^i@m(^90^QJ-0^KJ-0]^30]^H^:])^}^6264^i@m(^95^QJ-5^KJ-5]^35]^H^:])^GkN}}JAreturn l@h^V4]](lI,lE);};funcJM D(kr^;7JDkr;^I51JD0J\'c@v=JI;^/]=[]^>36]]=[]^>JCJ%^I507]]=t(^u^ 310]],^u^ 31JH;^I645]]=^I507^U0^Y304])J\'c@o=^jy){c@v^k672^-c@v,cy)};^!=[];}DJ,^)476]]^T^I51JD0;^/]=[]^>36]]=[]^>JCJ8^>3JD[J)T){^I645^U601]](0,0,^u^ 310]],^u^ 31JH;^I645^L63J/JADJ,^)1040]]^Treturn ++^I519]]};DJ,^)672]]=^jyJ*c^c351]]!^m[440]&&c^c351]]!^m[JJ^aJLlM=[]J\'er=M(cy)J\'d@pJ%d@p^n^ 643]](er[_$^[,er^F,J3J.d@p&& typeof (^/][d@p])!^m[161]^{@t=^/][d@pJ)^Z[982]^X[641])J+c@n^n^ 282]][^Z[846]^|gq=^N538]][^?^|ir=^?];^2]={x:er[_$^[,y:er^F^\\:gq^]:^NJ<^\\Index:ir^]J&^N524JPhar^g^ 389]]};^1]={cJ7t:gq,userCJ7t:gq,J;over^l496],J;move^l440^wut^l444],click^lJJ};lM^Bl@t);l@t=^/][^NJ1];^2]={x:er[_$^[,y:er^F^\\:gq^]:^NJ<^\\Index:ir^]J&^N524JPhar^g^ 389]]};^1]={cJ7t:c@n,userCJ7t:^N372]^wver^l496],J;move^l440^wut^l444],click^lJJ};lM^B^/][^NJ1])^vif(^Z[982]^X[845])J+c@n^n^ 282]][^Z[846]^|gq=^?]!=J8?^N538]][^?]]:null;^2]={x:er[_$^[,y:er^F^]:^NJ<^\\:gq^\\J&^?]^]J&^Z[846JPhar^g^ 389]]};^1]={cJ7^g^ 565]],userCJ7^g^ 565^U372]^wver:^b43],J;move:^b44^wut:^b45],click:^b46]};lM^Bl@t);}};}J$@y=[]^occ=0;cc@u^!^VJBcc++^{@v=true^odg=0;dg@ulM^VJBdg++J*lM[dg]^kJ1===^!JK^kJ1JEv=J3;break ;}J(l@v^;JC(^!JK,^t444J:^py^B^!JK)JA^!=l@y^occ=0;cc@ulM^VJBcc++^{N=J3^odg=0;dg@u^!^VJBdg++){ifJ#^kJ1===^![dg]^kJ1){lN=true;break ;}J(!lN^;JCJ#,^t496J:;^!^BlMJK);J(cyJ 6^@[JJ^;JCJ#,^t334J:^}if(cyJ 6^@[440]^;JCJ#,^t440J:}JA};DJ,^)337]^R@t,l@r,cyJ*!l@t|| !l@r^aJLcN=^2]J$@k=^1]J$S=^1][^b47]J)lS&&l@k&&lS[l@k[l@r]]){lS[l@k[l@r^-lS,cN)J(l@r!^m[444]J*lS^kJ6&&lS^kJ6!==c^c290^L90^UJ6){c^c290^L90^UJ6=lS^kJ6}^}c^c290^L90^UJ6^n^ 403]];delete ^2];delete ^1];J(l@r=^m[JJ&&^Z[982]^X[641]&&^u^ 51JH{^u^ 511^-^u^ 282]][^Z[846]JPN)JAfuncJM u(ml)J+bwJGml&&J?){bw=J?};u^k127^L26^-JI,^b48],bw);}@s(u,m);funcJM f(kr^;7JDkr;^I392]]^n^ 405^U39JBth^.=[];^4]J%}fJ,^)606]]=^qma,l@l,l@n,l@p,l@w)J+c@v=JI;^u^ 398]]=true;l@w=l@w||d^k715^U732]J)l@n){th^.^B{startTime:(J9Date())^k209J@+(ma?ma:0),duraJM:l@l,animaJMCallback:l@n,onComplete:l@p})}J$@i=[];while(th^.^V2]]>0^{T=th^.^k277J@J$@m=(J9Date())^k209J@J\'dm=0JGlT[^W0]]@u=l@m){dm=l@w(^P[630]]((l@m-lT[^W0]]),lT[^WJH,0,1,lT[^WJH;dm=^P[630]](dm,1J.iJ0dm)||!is@sinite(dm)){dm=1};J(dm@u1JEi^BlT)};lT^k604]](dmJ.dm>=1&&lT[^W2]]){lT[^W2J@JAth^.=l@iJGth^.^V2]]>0){^4]^n^ 779^-window,^q){c@v^k606^-c@v)})^}^u^ 398]]=J3JAfJ,^)510]]^Tth^.=[J)^4]){^u^ 513^-window,^4])};^4]J%^u^ 398]]=J3;}J\'d={yScale^E^7^+^%^(_b9J"^L^|mb=c@i[^W5^|gr=(mb-mb@bdm)^O[^\'b9^xJ!^f,0,gr^`^<0JF,dm@be@oJ ^<1JF);},xScale^E^7^+^%^(_b9J"^L^|mb=c@i[^W5^|hv=(mb-mb@bdm)^O[^\'b9^xJ!^f,hv,0,dm@be@oJ ^<0JF^`^<1JF);},xClip^E^7^+^%^(_b9J"^L]]^O[716J/if(dm>0^J[^\'b9^x@bdm,mc[_$_^f,0,0,mc^k310]]@bdm/z,mc[_$_^f/z)}^O[730J/},fadeIn^E^7^+^%^(_b9J"^L]]^O[716]]^$]=dm^O[^\'b9^xJ!^f,0,0^`^<0JF^`^<1JF)^O[730J/},easing:{linear^^^"meJN/mf^r@vutJSd^^^"-meJ>/=mf)J>-2)^r@vutJSr^S^"-me@b((mg=mg/mf-1)^zJN-1)^rInJSd^^^"meJ>/=mf)JN^rInJSr^S^"meJ>/=mf)^zJN+md}}}J\'bb={drawMarker:^jz,c@z,e@o,jt,dS,fu,jr,^ye@o^aJLJR1^O[15JDfu?fu^l16]^8]=jr?jr^l16]^C2]]=js?js:0;^A31]^J[164J4,c@z)^O^,76[753J4,c@z,JQ,0,^P[748]]@b2,J3J.fu^J[168J@J(^yjr){JRe^=;e^==0.15^8]=^t13];^0^$]=e@q^v^0()}}^v^A856]^J^,76[717^h^s,dS,dSJ.fu^J[168J@J(^yjr){JRe^=;e^==0.15^8]=^t13];^0^$]=e@q^v^0()}}^v^A857]^J^,J54^h^&9J55J4+JQ^&9J55J4^s)^C7J/if(fu^J[168J@J(^yjr){JRe^=;e^==0.15^8]=^t13];^0^$]=e@q^v^0()}}^C3J@^v^A1056]^J[160]]=fu;js=dS/4^C2]]=js^O^,J54^h^s)^C5J4+JQ^&9J59J@^C4J4+JQ^s)^C5^h^&9J59J/}}}};},drawMarkers:^qfw){for(JLcc=0;cc@ufw^VJBcc++)J+mh=fwJK;bb^k751]](mh[_$^[,mh^F,mh^k392]^_6[351]^_6[727]^_6[522]^_6[750]^_6[728]]);}}}J$={Char^Sj,cD)J+mi=J9n(mj,cD,JI);^I433]]^Tmi^k433]](^I1057]])}^>57]]=mi^k37JB},addColorSe^Sk,fo){o[mk]=fo},addCultureInfo^^k,bw){v[mk]=bw},formatNumber^^mJ=ml){ml=ml||^t6];b@q=b@q||^t928J)!J?){throw ^W8]^G@m(mmJ=J9u(ml))};},formatDate:^qbxJ=ml){ml=ml||^t6];b@q=b@q||^W9J)!J?){throw ^W8]^Gx(bxJ=J9u(ml))};}};l^k8^L060]]=^b61];window[^b62]]=l;})();~b976[379^U~^I1038]]~g,md,me,mf){return ~^+r~()^O[682]~r e@o=c@i^k1~,c@z+dS/2);e@oJ,~571]](mc,0,0J!~053^|mc=c@i[_$~976[125^U~^7m~m===0^ava~[163]]();e@oJ,9~^U204]](~is[^b49]]~^I722]~e@o^k169]]~^Z[1042]~^Z[1041]~]?^M103~^I512]~(^M351]~if(b@y=^m[~tion(dm,c@iJ*d~^C0]~kN,ly[^b3~],^d[363]~){^I3~6[1^U31~@o^k682]]~;^I10~^Z[644]~[351]^X~if(jt=^m[~^k274]](~^O[16~^t152]]-1~@znimaJM:func~^k629]]~^}return ~]:^b31~this^k~){e@oJ 6~]]:l@zJ ~^U1~l@z^k~c@n^k~;e@oJ 6~MathJ 6~]]?lyJ ~]=^ql~t^^~=^q){~]]^k~^k15~^b5~]=^m~]](^t~l@tJ 6~_b976[170]]~,data@yoint~,dataSeries~:^qm~],mhJ ~,e@oJ ~){return };~^t10~y^k~krJ 6~$_b976[175~b976[311]]~t:^u~J4-dS/2~]){return ~^qc~[^t~:^t~==_$_b976~=^u~;for(JL~^}l@~funcJM(~+md},ease~,c@z-JQ~_$_b976[~JI[_$_~;^}~],J;o~76[310]]~jsJ*!~JNJN~)J+l~]]J\'~}else {~J,97~,mc[_$_~76[1054~(lMJK~J\'l~J8;~Index:~;JL~}JG~]JG~){if(~{JL~[_$_b~6[103~)JG~J@;~sNaN(~647]]~])>=0~false~]](cz~76[16~424]]~ontex~=null~ new ~],cy)~mouse~372]]~,b@q,~@b(mg~v[ml]~]]()~};};~2]];~37]]~9]]=~){l@~]]/z~;if(~1]])~this~334]~[cc]~var ~tion~@bmg~846]~]],c~dS/2~e@q=~@kua')); \ No newline at end of file diff --git a/experiment/simulation/js/graph_use.ob.js b/experiment/simulation/js/graph_use.ob.js new file mode 100644 index 0000000..5562145 --- /dev/null +++ b/experiment/simulation/js/graph_use.ob.js @@ -0,0 +1 @@ +var _$_9348=["","top","center","bold","calibri","dimGrey","spline","Float","Chart","render"];function drawgraph(_0x95EF,_0x95BF,_0x961F,_0x964F){var _0x958F= new CanvasJS[_$_9348[8]](_0x95EF,{zoomEnabled:true,title:{text:_$_9348[0]},toolTip:{shared:false},legend:{verticalAlign:_$_9348[1],horizontalAlign:_$_9348[2],fontSize:14,fontWeight:_$_9348[3],fontFamily:_$_9348[4],fontColor:_$_9348[5]},axisX:{title:_0x961F},axisY:{title:_0x964F,includeZero:false},data:[{type:_$_9348[6],xValueType:_$_9348[7],showInLegend:false,name:_$_9348[0],markerSize:1,dataPoints:_0x95BF}]});_0x958F[_$_9348[9]]()} \ No newline at end of file diff --git a/experiment/simulation/js/jquery.knob.min.js b/experiment/simulation/js/jquery.knob.min.js new file mode 100644 index 0000000..1e8b8cd --- /dev/null +++ b/experiment/simulation/js/jquery.knob.min.js @@ -0,0 +1,438 @@ +(function (e) { + if (typeof define === "function" && define.amd) { + define(["jquery"], e) + } else { + e(jQuery) + } +})(function (e) { + "use strict"; + var t = {}, n = Math.max, r = Math.min; + t.c = {}; + t.c.d = e(document); + t.c.t = function (e) { + return e.originalEvent.touches.length - 1 + }; + t.o = function () { + var n = this; + this.o = null; + this.$ = null; + this.i = null; + this.g = null; + this.v = null; + this.cv = null; + this.x = 0; + this.y = 0; + this.w = 0; + this.h = 0; + this.$c = null; + this.c = null; + this.t = 0; + this.isInit = false; + this.fgColor = null; + this.pColor = null; + this.dH = null; + this.cH = null; + this.eH = null; + this.rH = null; + this.scale = 1; + this.relative = false; + this.relativeWidth = false; + this.relativeHeight = false; + this.$div = null; + this.run = function () { + var t = function (e, t) { + var r; + for (r in t) { + n.o[r] = t[r] + } + n._carve().init(); + n._configure()._draw() + }; + if (this.$.data("kontroled")) + return; + this.$.data("kontroled", true); + this.extend(); + this.o = e.extend({min: this.$.data("min") !== undefined ? this.$.data("min") : 0, max: this.$.data("max") !== undefined ? this.$.data("max") : 100, + stopper: true, readOnly: this.$.data("readonly") || this.$.attr("readonly") === "readonly", + cursor: this.$.data("cursor") === true && 30 || this.$.data("cursor") || 0, thickness: this.$.data("thickness") && Math.max(Math.min(this.$.data("thickness"), 1), .01) || .35, lineCap: this.$.data("linecap") || "butt", width: this.$.data("width") || 200, height: this.$.data("height") || 200, displayInput: this.$.data("displayinput") == null || this.$.data("displayinput"), displayPrevious: this.$.data("displayprevious"), fgColor: this.$.data("fgcolor") || "#87CEEB", inputColor: this.$.data("inputcolor"), font: this.$.data("font") || "Arial", fontWeight: this.$.data("font-weight") || "bold", inline: false, step: this.$.data("step") || 1, rotation: this.$.data("rotation"), draw: null, change: null, cancel: null, release: null, format: function (e) { + return e + }, parse: function (e) { + return parseFloat(e) + }}, this.o); + this.o.flip = this.o.rotation === "anticlockwise" || this.o.rotation === "acw"; + if (!this.o.inputColor) { + this.o.inputColor = this.o.fgColor + } + if (this.$.is("fieldset")) { + this.v = {}; + this.i = this.$.find("input"); + this.i.each(function (t) { + var r = e(this); + n.i[t] = r; + n.v[t] = n.o.parse(r.val()); + r.bind("change blur", function () { + var e = {}; + e[t] = r.val(); + n.val(n._validate(e)) + }) + }); + this.$.find("legend").remove() + } else { + this.i = this.$; + this.v = this.o.parse(this.$.val()); + this.v === "" && (this.v = this.o.min); + this.$.bind("change blur", function () { + n.val(n._validate(n.o.parse(n.$.val()))) + }) + } + !this.o.displayInput && this.$.hide(); + this.$c = e(document.createElement("canvas")).attr({width: this.o.width, height: this.o.height}); + this.$div = e('
'); + this.$.wrap(this.$div).before(this.$c); + this.$div = this.$.parent(); + if (typeof G_vmlCanvasManager !== "undefined") { + G_vmlCanvasManager.initElement(this.$c[0]) + } + this.c = this.$c[0].getContext ? this.$c[0].getContext("2d") : null; + if (!this.c) { + throw{name: "CanvasNotSupportedException", message: "Canvas not supported. Please use excanvas on IE8.0.", toString: function () { + return this.name + ": " + this.message + }} + } + this.scale = (window.devicePixelRatio || 1) / (this.c.webkitBackingStorePixelRatio || this.c.mozBackingStorePixelRatio || this.c.msBackingStorePixelRatio || this.c.oBackingStorePixelRatio || this.c.backingStorePixelRatio || 1); + this.relativeWidth = this.o.width % 1 !== 0 && this.o.width.indexOf("%"); + this.relativeHeight = this.o.height % 1 !== 0 && this.o.height.indexOf("%"); + this.relative = this.relativeWidth || this.relativeHeight; + this._carve(); + if (this.v instanceof Object) { + this.cv = {}; + this.copy(this.v, this.cv) + } else { + this.cv = this.v + } + this.$.bind("configure", t).parent().bind("configure", t); + this._listen()._configure()._xy().init(); + this.isInit = true; + this.$.val(this.o.format(this.v)); + this._draw(); + return this + }; + this._carve = function () { + if (this.relative) { + var e = this.relativeWidth ? this.$div.parent().width() * parseInt(this.o.width) / 100 : this.$div.parent().width(), t = this.relativeHeight ? this.$div.parent().height() * parseInt(this.o.height) / 100 : this.$div.parent().height(); + this.w = this.h = Math.min(e, t) + } else { + this.w = this.o.width; + this.h = this.o.height + } + this.$div.css({width: this.w + "px", height: this.h + "px"}); + this.$c.attr({width: this.w, height: this.h}); + if (this.scale !== 1) { + this.$c[0].width = this.$c[0].width * this.scale; + this.$c[0].height = this.$c[0].height * this.scale; + this.$c.width(this.w); + this.$c.height(this.h) + } + return this + }; + this._draw = function () { + var e = true; + n.g = n.c; + n.clear(); + n.dH && (e = n.dH()); + e !== false && n.draw() + }; + this._touch = function (e) { + var r = function (e) { + var t = n.xy2val(e.originalEvent.touches[n.t].pageX, e.originalEvent.touches[n.t].pageY); + if (t == n.cv) + return; + if (n.cH && n.cH(t) === false) + return; + n.change(n._validate(t)); + n._draw() + }; + this.t = t.c.t(e); + r(e); + t.c.d.bind("touchmove.k", r).bind("touchend.k", function () { + t.c.d.unbind("touchmove.k touchend.k"); + n.val(n.cv) + }); + return this + }; + this._mouse = function (e) { + var r = function (e) { + var t = n.xy2val(e.pageX, e.pageY); + if (t == n.cv) + return; + if (n.cH && n.cH(t) === false) + return; + n.change(n._validate(t)); + n._draw() + }; + r(e); + t.c.d.bind("mousemove.k", r).bind("keyup.k", function (e) { + if (e.keyCode === 27) { + t.c.d.unbind("mouseup.k mousemove.k keyup.k"); + if (n.eH && n.eH() === false) + return; + n.cancel() + } + }).bind("mouseup.k", function (e) { + t.c.d.unbind("mousemove.k mouseup.k keyup.k"); + n.val(n.cv) + }); + return this + }; + this._xy = function () { + var e = this.$c.offset(); + this.x = e.left; + this.y = e.top; + return this + }; + this._listen = function () { + if (!this.o.readOnly) { + this.$c.bind("mousedown", function (e) { + e.preventDefault(); + n._xy()._mouse(e) + }).bind("touchstart", function (e) { + e.preventDefault(); + n._xy()._touch(e) + }); + this.listen() + } else { + this.$.attr("readonly", "readonly") + } + if (this.relative) { + e(window).resize(function () { + n._carve().init(); + n._draw() + }) + } + return this + }; + this._configure = function () { + if (this.o.draw) + this.dH = this.o.draw; + if (this.o.change) + this.cH = this.o.change; + if (this.o.cancel) + this.eH = this.o.cancel; + if (this.o.release) + this.rH = this.o.release; + if (this.o.displayPrevious) { + this.pColor = this.h2rgba(this.o.fgColor, "0.4"); + this.fgColor = this.h2rgba(this.o.fgColor, "0.6") + } else { + this.fgColor = this.o.fgColor + } + return this + }; + this._clear = function () { + this.$c[0].width = this.$c[0].width + }; + this._validate = function (e) { + var t = ~~((e < 0 ? -.5 : .5) + e / this.o.step) * this.o.step; + return Math.round(t * 100) / 100 + }; + this.listen = function () { + }; + this.extend = function () { + }; + this.init = function () { + }; + this.change = function (e) { + }; + this.val = function (e) { + }; + this.xy2val = function (e, t) { + }; + this.draw = function () { + }; + this.clear = function () { + this._clear() + }; + this.h2rgba = function (e, t) { + var n; + e = e.substring(1, 7); + n = [parseInt(e.substring(0, 2), 16), parseInt(e.substring(2, 4), 16), parseInt(e.substring(4, 6), 16)]; + return"rgba(" + n[0] + "," + n[1] + "," + n[2] + "," + t + ")" + }; + this.copy = function (e, t) { + for (var n in e) { + t[n] = e[n] + } + } + }; + t.Dial = function () { + t.o.call(this); + this.startAngle = null; + this.xy = null; + this.radius = null; + this.lineWidth = null; + this.cursorExt = null; + this.w2 = null; + this.PI2 = 2 * Math.PI; + this.extend = function () { + this.o = e.extend({bgColor: this.$.data("bgcolor") || "#EEEEEE", angleOffset: this.$.data("angleoffset") || 0, angleArc: this.$.data("anglearc") || 360, inline: true}, this.o) + }; + this.val = function (e, t) { + if (null != e) { + e = this.o.parse(e); + if (t !== false && e != this.v && this.rH && this.rH(e) === false) { + return + } + this.cv = this.o.stopper ? n(r(e, this.o.max), this.o.min) : e; + this.v = this.cv; + this.$.val(this.o.format(this.v)); + this._draw() + } else { + return this.v + } + }; + this.xy2val = function (e, t) { + var i, s; + i = Math.atan2(e - (this.x + this.w2), -(t - this.y - this.w2)) - this.angleOffset; + if (this.o.flip) { + i = this.angleArc - i - this.PI2 + } + if (this.angleArc != this.PI2 && i < 0 && i > -.5) { + i = 0 + } else if (i < 0) { + i += this.PI2 + } + s = i * (this.o.max - this.o.min) / this.angleArc + this.o.min; + this.o.stopper && (s = n(r(s, this.o.max), this.o.min)); + return s + }; + this.listen = function () { + var t = this, i, s, o = function (e) { + e.preventDefault(); + var o = e.originalEvent, u = o.detail || o.wheelDeltaX, a = o.detail || o.wheelDeltaY, f = t._validate(t.o.parse(t.$.val())) + (u > 0 || a > 0 ? t.o.step : u < 0 || a < 0 ? -t.o.step : 0); + f = n(r(f, t.o.max), t.o.min); + t.val(f, false); + if (t.rH) { + clearTimeout(i); + i = setTimeout(function () { + t.rH(f); + i = null + }, 100); + if (!s) { + s = setTimeout(function () { + if (i) + t.rH(f); + s = null + }, 200) + } + } + }, u, a, f = 1, l = {37: -t.o.step, 38: t.o.step, 39: t.o.step, 40: -t.o.step}; + this.$.bind("keydown", function (i) { + var s = i.keyCode; + if (s >= 96 && s <= 105) { + s = i.keyCode = s - 48 + } + u = parseInt(String.fromCharCode(s)); + if (isNaN(u)) { + s !== 13 && s !== 8 && s !== 9 && s !== 189 && (s !== 190 || t.$.val().match(/\./)) && i.preventDefault(); + if (e.inArray(s, [37, 38, 39, 40]) > -1) { + i.preventDefault(); + var o = t.o.parse(t.$.val()) + l[s] * f; + t.o.stopper && (o = n(r(o, t.o.max), t.o.min)); + t.change(t._validate(o)); + t._draw(); + a = window.setTimeout(function () { + f *= 2 + }, 30) + } + } + }).bind("keyup", function (e) { + if (isNaN(u)) { + if (a) { + window.clearTimeout(a); + a = null; + f = 1; + t.val(t.$.val()) + } + } else { + t.$.val() > t.o.max && t.$.val(t.o.max) || t.$.val() < t.o.min && t.$.val(t.o.min) + } + }); + this.$c.bind("mousewheel DOMMouseScroll", o); + this.$.bind("mousewheel DOMMouseScroll", o) + }; + this.init = function () { + if (this.v < this.o.min || this.v > this.o.max) { + this.v = this.o.min + } + this.$.val(this.v); + this.w2 = this.w / 2; + this.cursorExt = this.o.cursor / 100; + this.xy = this.w2 * this.scale; + this.lineWidth = this.xy * this.o.thickness; + this.lineCap = this.o.lineCap; + this.radius = this.xy - this.lineWidth / 2; + this.o.angleOffset && (this.o.angleOffset = isNaN(this.o.angleOffset) ? 0 : this.o.angleOffset); + this.o.angleArc && (this.o.angleArc = isNaN(this.o.angleArc) ? this.PI2 : this.o.angleArc); + this.angleOffset = this.o.angleOffset * Math.PI / 180; + this.angleArc = this.o.angleArc * Math.PI / 180; + this.startAngle = 1.5 * Math.PI + this.angleOffset; + this.endAngle = 1.5 * Math.PI + this.angleOffset + this.angleArc; + var e = n(String(Math.abs(this.o.max)).length, String(Math.abs(this.o.min)).length, 2) + 2; + this.o.displayInput && this.i.css({width: (this.w / 2 + 4 >> 0) + "px", height: (this.w / 3 >> 0) + "px", position: "absolute", "vertical-align": "middle", "margin-top": (this.w / 3 >> 0) + "px", "margin-left": "-" + (this.w * 3 / 4 + 2 >> 0) + "px", border: 0, background: "none", font: this.o.fontWeight + " " + (this.w / e >> 0) + "px " + this.o.font, "text-align": "center", color: this.o.inputColor || this.o.fgColor, padding: "0px", "-webkit-appearance": "none"}) || this.i.css({width: "0px", visibility: "hidden"}) + }; + this.change = function (e) { + this.cv = e; + this.$.val(this.o.format(e)) + }; + this.angle = function (e) { + return(e - this.o.min) * this.angleArc / (this.o.max - this.o.min) + }; + this.arc = function (e) { + var t, n; + e = this.angle(e); + if (this.o.flip) { + t = this.endAngle + 1e-5; + n = t - e - 1e-5 + } else { + t = this.startAngle - 1e-5; + n = t + e + 1e-5 + } + this.o.cursor && (t = n - this.cursorExt) && (n = n + this.cursorExt); + return{s: t, e: n, d: this.o.flip && !this.o.cursor} + }; + this.draw = function () { + var e = this.g, t = this.arc(this.cv), n, r = 1; + e.lineWidth = this.lineWidth; + e.lineCap = this.lineCap; + if (this.o.bgColor !== "none") { + e.beginPath(); + e.strokeStyle = this.o.bgColor; + e.arc(this.xy, this.xy, this.radius, this.endAngle - 1e-5, this.startAngle + 1e-5, true); + e.stroke() + } + if (this.o.displayPrevious) { + n = this.arc(this.v); + e.beginPath(); + e.strokeStyle = this.pColor; + e.arc(this.xy, this.xy, this.radius, n.s, n.e, n.d); + e.stroke(); + r = this.cv == this.v + } + e.beginPath(); + e.strokeStyle = r ? this.o.fgColor : this.fgColor; + e.arc(this.xy, this.xy, this.radius, t.s, t.e, t.d); + e.stroke() + }; + this.cancel = function () { + this.val(this.v) + } + }; + e.fn.dial = e.fn.knob = function (n) { + return this.each(function () { + var r = new t.Dial; + r.o = n; + r.$ = e(this); + r.run() + }).parent() + } +}) diff --git a/experiment/simulation/js/jquery_files/jquery-1.7.1.min.js b/experiment/simulation/js/jquery_files/jquery-1.7.1.min.js new file mode 100644 index 0000000..b1b47b8 --- /dev/null +++ b/experiment/simulation/js/jquery_files/jquery-1.7.1.min.js @@ -0,0 +1,4 @@ +/*! jQuery v1.7.1 jquery.com | jquery.org/license */ +(function(a,b){function cy(a){return f.isWindow(a)?a:a.nodeType===9?a.defaultView||a.parentWindow:!1}function cv(a){if(!ck[a]){var b=c.body,d=f("<"+a+">").appendTo(b),e=d.css("display");d.remove();if(e==="none"||e===""){cl||(cl=c.createElement("iframe"),cl.frameBorder=cl.width=cl.height=0),b.appendChild(cl);if(!cm||!cl.createElement)cm=(cl.contentWindow||cl.contentDocument).document,cm.write((c.compatMode==="CSS1Compat"?"":"")+""),cm.close();d=cm.createElement(a),cm.body.appendChild(d),e=f.css(d,"display"),b.removeChild(cl)}ck[a]=e}return ck[a]}function cu(a,b){var c={};f.each(cq.concat.apply([],cq.slice(0,b)),function(){c[this]=a});return c}function ct(){cr=b}function cs(){setTimeout(ct,0);return cr=f.now()}function cj(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")}catch(b){}}function ci(){try{return new a.XMLHttpRequest}catch(b){}}function cc(a,c){a.dataFilter&&(c=a.dataFilter(c,a.dataType));var d=a.dataTypes,e={},g,h,i=d.length,j,k=d[0],l,m,n,o,p;for(g=1;g0){if(c!=="border")for(;g=0===c})}function S(a){return!a||!a.parentNode||a.parentNode.nodeType===11}function K(){return!0}function J(){return!1}function n(a,b,c){var d=b+"defer",e=b+"queue",g=b+"mark",h=f._data(a,d);h&&(c==="queue"||!f._data(a,e))&&(c==="mark"||!f._data(a,g))&&setTimeout(function(){!f._data(a,e)&&!f._data(a,g)&&(f.removeData(a,d,!0),h.fire())},0)}function m(a){for(var b in a){if(b==="data"&&f.isEmptyObject(a[b]))continue;if(b!=="toJSON")return!1}return!0}function l(a,c,d){if(d===b&&a.nodeType===1){var e="data-"+c.replace(k,"-$1").toLowerCase();d=a.getAttribute(e);if(typeof d=="string"){try{d=d==="true"?!0:d==="false"?!1:d==="null"?null:f.isNumeric(d)?parseFloat(d):j.test(d)?f.parseJSON(d):d}catch(g){}f.data(a,c,d)}else d=b}return d}function h(a){var b=g[a]={},c,d;a=a.split(/\s+/);for(c=0,d=a.length;c)[^>]*$|#([\w\-]*)$)/,j=/\S/,k=/^\s+/,l=/\s+$/,m=/^<(\w+)\s*\/?>(?:<\/\1>)?$/,n=/^[\],:{}\s]*$/,o=/\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g,p=/"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g,q=/(?:^|:|,)(?:\s*\[)+/g,r=/(webkit)[ \/]([\w.]+)/,s=/(opera)(?:.*version)?[ \/]([\w.]+)/,t=/(msie) ([\w.]+)/,u=/(mozilla)(?:.*? rv:([\w.]+))?/,v=/-([a-z]|[0-9])/ig,w=/^-ms-/,x=function(a,b){return(b+"").toUpperCase()},y=d.userAgent,z,A,B,C=Object.prototype.toString,D=Object.prototype.hasOwnProperty,E=Array.prototype.push,F=Array.prototype.slice,G=String.prototype.trim,H=Array.prototype.indexOf,I={};e.fn=e.prototype={constructor:e,init:function(a,d,f){var g,h,j,k;if(!a)return this;if(a.nodeType){this.context=this[0]=a,this.length=1;return this}if(a==="body"&&!d&&c.body){this.context=c,this[0]=c.body,this.selector=a,this.length=1;return this}if(typeof a=="string"){a.charAt(0)!=="<"||a.charAt(a.length-1)!==">"||a.length<3?g=i.exec(a):g=[null,a,null];if(g&&(g[1]||!d)){if(g[1]){d=d instanceof e?d[0]:d,k=d?d.ownerDocument||d:c,j=m.exec(a),j?e.isPlainObject(d)?(a=[c.createElement(j[1])],e.fn.attr.call(a,d,!0)):a=[k.createElement(j[1])]:(j=e.buildFragment([g[1]],[k]),a=(j.cacheable?e.clone(j.fragment):j.fragment).childNodes);return e.merge(this,a)}h=c.getElementById(g[2]);if(h&&h.parentNode){if(h.id!==g[2])return f.find(a);this.length=1,this[0]=h}this.context=c,this.selector=a;return this}return!d||d.jquery?(d||f).find(a):this.constructor(d).find(a)}if(e.isFunction(a))return f.ready(a);a.selector!==b&&(this.selector=a.selector,this.context=a.context);return e.makeArray(a,this)},selector:"",jquery:"1.7.1",length:0,size:function(){return this.length},toArray:function(){return F.call(this,0)},get:function(a){return a==null?this.toArray():a<0?this[this.length+a]:this[a]},pushStack:function(a,b,c){var d=this.constructor();e.isArray(a)?E.apply(d,a):e.merge(d,a),d.prevObject=this,d.context=this.context,b==="find"?d.selector=this.selector+(this.selector?" ":"")+c:b&&(d.selector=this.selector+"."+b+"("+c+")");return d},each:function(a,b){return e.each(this,a,b)},ready:function(a){e.bindReady(),A.add(a);return this},eq:function(a){a=+a;return a===-1?this.slice(a):this.slice(a,a+1)},first:function(){return this.eq(0)},last:function(){return this.eq(-1)},slice:function(){return this.pushStack(F.apply(this,arguments),"slice",F.call(arguments).join(","))},map:function(a){return this.pushStack(e.map(this,function(b,c){return a.call(b,c,b)}))},end:function(){return this.prevObject||this.constructor(null)},push:E,sort:[].sort,splice:[].splice},e.fn.init.prototype=e.fn,e.extend=e.fn.extend=function(){var a,c,d,f,g,h,i=arguments[0]||{},j=1,k=arguments.length,l=!1;typeof i=="boolean"&&(l=i,i=arguments[1]||{},j=2),typeof i!="object"&&!e.isFunction(i)&&(i={}),k===j&&(i=this,--j);for(;j0)return;A.fireWith(c,[e]),e.fn.trigger&&e(c).trigger("ready").off("ready")}},bindReady:function(){if(!A){A=e.Callbacks("once memory");if(c.readyState==="complete")return setTimeout(e.ready,1);if(c.addEventListener)c.addEventListener("DOMContentLoaded",B,!1),a.addEventListener("load",e.ready,!1);else if(c.attachEvent){c.attachEvent("onreadystatechange",B),a.attachEvent("onload",e.ready);var b=!1;try{b=a.frameElement==null}catch(d){}c.documentElement.doScroll&&b&&J()}}},isFunction:function(a){return e.type(a)==="function"},isArray:Array.isArray||function(a){return e.type(a)==="array"},isWindow:function(a){return a&&typeof a=="object"&&"setInterval"in a},isNumeric:function(a){return!isNaN(parseFloat(a))&&isFinite(a)},type:function(a){return a==null?String(a):I[C.call(a)]||"object"},isPlainObject:function(a){if(!a||e.type(a)!=="object"||a.nodeType||e.isWindow(a))return!1;try{if(a.constructor&&!D.call(a,"constructor")&&!D.call(a.constructor.prototype,"isPrototypeOf"))return!1}catch(c){return!1}var d;for(d in a);return d===b||D.call(a,d)},isEmptyObject:function(a){for(var b in a)return!1;return!0},error:function(a){throw new Error(a)},parseJSON:function(b){if(typeof b!="string"||!b)return null;b=e.trim(b);if(a.JSON&&a.JSON.parse)return a.JSON.parse(b);if(n.test(b.replace(o,"@").replace(p,"]").replace(q,"")))return(new Function("return "+b))();e.error("Invalid JSON: "+b)},parseXML:function(c){var d,f;try{a.DOMParser?(f=new DOMParser,d=f.parseFromString(c,"text/xml")):(d=new ActiveXObject("Microsoft.XMLDOM"),d.async="false",d.loadXML(c))}catch(g){d=b}(!d||!d.documentElement||d.getElementsByTagName("parsererror").length)&&e.error("Invalid XML: "+c);return d},noop:function(){},globalEval:function(b){b&&j.test(b)&&(a.execScript||function(b){a.eval.call(a,b)})(b)},camelCase:function(a){return a.replace(w,"ms-").replace(v,x)},nodeName:function(a,b){return a.nodeName&&a.nodeName.toUpperCase()===b.toUpperCase()},each:function(a,c,d){var f,g=0,h=a.length,i=h===b||e.isFunction(a);if(d){if(i){for(f in a)if(c.apply(a[f],d)===!1)break}else for(;g0&&a[0]&&a[j-1]||j===0||e.isArray(a));if(k)for(;i1?i.call(arguments,0):b,j.notifyWith(k,e)}}function l(a){return function(c){b[a]=arguments.length>1?i.call(arguments,0):c,--g||j.resolveWith(j,b)}}var b=i.call(arguments,0),c=0,d=b.length,e=Array(d),g=d,h=d,j=d<=1&&a&&f.isFunction(a.promise)?a:f.Deferred(),k=j.promise();if(d>1){for(;c
a",d=q.getElementsByTagName("*"),e=q.getElementsByTagName("a")[0];if(!d||!d.length||!e)return{};g=c.createElement("select"),h=g.appendChild(c.createElement("option")),i=q.getElementsByTagName("input")[0],b={leadingWhitespace:q.firstChild.nodeType===3,tbody:!q.getElementsByTagName("tbody").length,htmlSerialize:!!q.getElementsByTagName("link").length,style:/top/.test(e.getAttribute("style")),hrefNormalized:e.getAttribute("href")==="/a",opacity:/^0.55/.test(e.style.opacity),cssFloat:!!e.style.cssFloat,checkOn:i.value==="on",optSelected:h.selected,getSetAttribute:q.className!=="t",enctype:!!c.createElement("form").enctype,html5Clone:c.createElement("nav").cloneNode(!0).outerHTML!=="<:nav>",submitBubbles:!0,changeBubbles:!0,focusinBubbles:!1,deleteExpando:!0,noCloneEvent:!0,inlineBlockNeedsLayout:!1,shrinkWrapBlocks:!1,reliableMarginRight:!0},i.checked=!0,b.noCloneChecked=i.cloneNode(!0).checked,g.disabled=!0,b.optDisabled=!h.disabled;try{delete q.test}catch(s){b.deleteExpando=!1}!q.addEventListener&&q.attachEvent&&q.fireEvent&&(q.attachEvent("onclick",function(){b.noCloneEvent=!1}),q.cloneNode(!0).fireEvent("onclick")),i=c.createElement("input"),i.value="t",i.setAttribute("type","radio"),b.radioValue=i.value==="t",i.setAttribute("checked","checked"),q.appendChild(i),k=c.createDocumentFragment(),k.appendChild(q.lastChild),b.checkClone=k.cloneNode(!0).cloneNode(!0).lastChild.checked,b.appendChecked=i.checked,k.removeChild(i),k.appendChild(q),q.innerHTML="",a.getComputedStyle&&(j=c.createElement("div"),j.style.width="0",j.style.marginRight="0",q.style.width="2px",q.appendChild(j),b.reliableMarginRight=(parseInt((a.getComputedStyle(j,null)||{marginRight:0}).marginRight,10)||0)===0);if(q.attachEvent)for(o in{submit:1,change:1,focusin:1})n="on"+o,p=n in q,p||(q.setAttribute(n,"return;"),p=typeof q[n]=="function"),b[o+"Bubbles"]=p;k.removeChild(q),k=g=h=j=q=i=null,f(function(){var a,d,e,g,h,i,j,k,m,n,o,r=c.getElementsByTagName("body")[0];!r||(j=1,k="position:absolute;top:0;left:0;width:1px;height:1px;margin:0;",m="visibility:hidden;border:0;",n="style='"+k+"border:5px solid #000;padding:0;'",o="
"+""+"
",a=c.createElement("div"),a.style.cssText=m+"width:0;height:0;position:static;top:0;margin-top:"+j+"px",r.insertBefore(a,r.firstChild),q=c.createElement("div"),a.appendChild(q),q.innerHTML="
t
",l=q.getElementsByTagName("td"),p=l[0].offsetHeight===0,l[0].style.display="",l[1].style.display="none",b.reliableHiddenOffsets=p&&l[0].offsetHeight===0,q.innerHTML="",q.style.width=q.style.paddingLeft="1px",f.boxModel=b.boxModel=q.offsetWidth===2,typeof q.style.zoom!="undefined"&&(q.style.display="inline",q.style.zoom=1,b.inlineBlockNeedsLayout=q.offsetWidth===2,q.style.display="",q.innerHTML="
",b.shrinkWrapBlocks=q.offsetWidth!==2),q.style.cssText=k+m,q.innerHTML=o,d=q.firstChild,e=d.firstChild,h=d.nextSibling.firstChild.firstChild,i={doesNotAddBorder:e.offsetTop!==5,doesAddBorderForTableAndCells:h.offsetTop===5},e.style.position="fixed",e.style.top="20px",i.fixedPosition=e.offsetTop===20||e.offsetTop===15,e.style.position=e.style.top="",d.style.overflow="hidden",d.style.position="relative",i.subtractsBorderForOverflowNotVisible=e.offsetTop===-5,i.doesNotIncludeMarginInBodyOffset=r.offsetTop!==j,r.removeChild(a),q=a=null,f.extend(b,i))});return b}();var j=/^(?:\{.*\}|\[.*\])$/,k=/([A-Z])/g;f.extend({cache:{},uuid:0,expando:"jQuery"+(f.fn.jquery+Math.random()).replace(/\D/g,""),noData:{embed:!0,object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000",applet:!0},hasData:function(a){a=a.nodeType?f.cache[a[f.expando]]:a[f.expando];return!!a&&!m(a)},data:function(a,c,d,e){if(!!f.acceptData(a)){var g,h,i,j=f.expando,k=typeof c=="string",l=a.nodeType,m=l?f.cache:a,n=l?a[j]:a[j]&&j,o=c==="events";if((!n||!m[n]||!o&&!e&&!m[n].data)&&k&&d===b)return;n||(l?a[j]=n=++f.uuid:n=j),m[n]||(m[n]={},l||(m[n].toJSON=f.noop));if(typeof c=="object"||typeof c=="function")e?m[n]=f.extend(m[n],c):m[n].data=f.extend(m[n].data,c);g=h=m[n],e||(h.data||(h.data={}),h=h.data),d!==b&&(h[f.camelCase(c)]=d);if(o&&!h[c])return g.events;k?(i=h[c],i==null&&(i=h[f.camelCase(c)])):i=h;return i}},removeData:function(a,b,c){if(!!f.acceptData(a)){var d,e,g,h=f.expando,i=a.nodeType,j=i?f.cache:a,k=i?a[h]:h;if(!j[k])return;if(b){d=c?j[k]:j[k].data;if(d){f.isArray(b)||(b in d?b=[b]:(b=f.camelCase(b),b in d?b=[b]:b=b.split(" ")));for(e=0,g=b.length;e-1)return!0;return!1},val:function(a){var c,d,e,g=this[0];{if(!!arguments.length){e=f.isFunction(a);return this.each(function(d){var g=f(this),h;if(this.nodeType===1){e?h=a.call(this,d,g.val()):h=a,h==null?h="":typeof h=="number"?h+="":f.isArray(h)&&(h=f.map(h,function(a){return a==null?"":a+""})),c=f.valHooks[this.nodeName.toLowerCase()]||f.valHooks[this.type];if(!c||!("set"in c)||c.set(this,h,"value")===b)this.value=h}})}if(g){c=f.valHooks[g.nodeName.toLowerCase()]||f.valHooks[g.type];if(c&&"get"in c&&(d=c.get(g,"value"))!==b)return d;d=g.value;return typeof d=="string"?d.replace(q,""):d==null?"":d}}}}),f.extend({valHooks:{option:{get:function(a){var b=a.attributes.value;return!b||b.specified?a.value:a.text}},select:{get:function(a){var b,c,d,e,g=a.selectedIndex,h=[],i=a.options,j=a.type==="select-one";if(g<0)return null;c=j?g:0,d=j?g+1:i.length;for(;c=0}),c.length||(a.selectedIndex=-1);return c}}},attrFn:{val:!0,css:!0,html:!0,text:!0,data:!0,width:!0,height:!0,offset:!0},attr:function(a,c,d,e){var g,h,i,j=a.nodeType;if(!!a&&j!==3&&j!==8&&j!==2){if(e&&c in f.attrFn)return f(a)[c](d);if(typeof a.getAttribute=="undefined")return f.prop(a,c,d);i=j!==1||!f.isXMLDoc(a),i&&(c=c.toLowerCase(),h=f.attrHooks[c]||(u.test(c)?x:w));if(d!==b){if(d===null){f.removeAttr(a,c);return}if(h&&"set"in h&&i&&(g=h.set(a,d,c))!==b)return g;a.setAttribute(c,""+d);return d}if(h&&"get"in h&&i&&(g=h.get(a,c))!==null)return g;g=a.getAttribute(c);return g===null?b:g}},removeAttr:function(a,b){var c,d,e,g,h=0;if(b&&a.nodeType===1){d=b.toLowerCase().split(p),g=d.length;for(;h=0}})});var z=/^(?:textarea|input|select)$/i,A=/^([^\.]*)?(?:\.(.+))?$/,B=/\bhover(\.\S+)?\b/,C=/^key/,D=/^(?:mouse|contextmenu)|click/,E=/^(?:focusinfocus|focusoutblur)$/,F=/^(\w*)(?:#([\w\-]+))?(?:\.([\w\-]+))?$/,G=function(a){var b=F.exec(a);b&&(b[1]=(b[1]||"").toLowerCase(),b[3]=b[3]&&new RegExp("(?:^|\\s)"+b[3]+"(?:\\s|$)"));return b},H=function(a,b){var c=a.attributes||{};return(!b[1]||a.nodeName.toLowerCase()===b[1])&&(!b[2]||(c.id||{}).value===b[2])&&(!b[3]||b[3].test((c["class"]||{}).value))},I=function(a){return f.event.special.hover?a:a.replace(B,"mouseenter$1 mouseleave$1")}; +f.event={add:function(a,c,d,e,g){var h,i,j,k,l,m,n,o,p,q,r,s;if(!(a.nodeType===3||a.nodeType===8||!c||!d||!(h=f._data(a)))){d.handler&&(p=d,d=p.handler),d.guid||(d.guid=f.guid++),j=h.events,j||(h.events=j={}),i=h.handle,i||(h.handle=i=function(a){return typeof f!="undefined"&&(!a||f.event.triggered!==a.type)?f.event.dispatch.apply(i.elem,arguments):b},i.elem=a),c=f.trim(I(c)).split(" ");for(k=0;k=0&&(h=h.slice(0,-1),k=!0),h.indexOf(".")>=0&&(i=h.split("."),h=i.shift(),i.sort());if((!e||f.event.customEvent[h])&&!f.event.global[h])return;c=typeof c=="object"?c[f.expando]?c:new f.Event(h,c):new f.Event(h),c.type=h,c.isTrigger=!0,c.exclusive=k,c.namespace=i.join("."),c.namespace_re=c.namespace?new RegExp("(^|\\.)"+i.join("\\.(?:.*\\.)?")+"(\\.|$)"):null,o=h.indexOf(":")<0?"on"+h:"";if(!e){j=f.cache;for(l in j)j[l].events&&j[l].events[h]&&f.event.trigger(c,d,j[l].handle.elem,!0);return}c.result=b,c.target||(c.target=e),d=d!=null?f.makeArray(d):[],d.unshift(c),p=f.event.special[h]||{};if(p.trigger&&p.trigger.apply(e,d)===!1)return;r=[[e,p.bindType||h]];if(!g&&!p.noBubble&&!f.isWindow(e)){s=p.delegateType||h,m=E.test(s+h)?e:e.parentNode,n=null;for(;m;m=m.parentNode)r.push([m,s]),n=m;n&&n===e.ownerDocument&&r.push([n.defaultView||n.parentWindow||a,s])}for(l=0;le&&i.push({elem:this,matches:d.slice(e)});for(j=0;j0?this.on(b,null,a,c):this.trigger(b)},f.attrFn&&(f.attrFn[b]=!0),C.test(b)&&(f.event.fixHooks[b]=f.event.keyHooks),D.test(b)&&(f.event.fixHooks[b]=f.event.mouseHooks)}),function(){function x(a,b,c,e,f,g){for(var h=0,i=e.length;h0){k=j;break}}j=j[a]}e[h]=k}}}function w(a,b,c,e,f,g){for(var h=0,i=e.length;h+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g,d="sizcache"+(Math.random()+"").replace(".",""),e=0,g=Object.prototype.toString,h=!1,i=!0,j=/\\/g,k=/\r\n/g,l=/\W/;[0,0].sort(function(){i=!1;return 0});var m=function(b,d,e,f){e=e||[],d=d||c;var h=d;if(d.nodeType!==1&&d.nodeType!==9)return[];if(!b||typeof b!="string")return e;var i,j,k,l,n,q,r,t,u=!0,v=m.isXML(d),w=[],x=b;do{a.exec(""),i=a.exec(x);if(i){x=i[3],w.push(i[1]);if(i[2]){l=i[3];break}}}while(i);if(w.length>1&&p.exec(b))if(w.length===2&&o.relative[w[0]])j=y(w[0]+w[1],d,f);else{j=o.relative[w[0]]?[d]:m(w.shift(),d);while(w.length)b=w.shift(),o.relative[b]&&(b+=w.shift()),j=y(b,j,f)}else{!f&&w.length>1&&d.nodeType===9&&!v&&o.match.ID.test(w[0])&&!o.match.ID.test(w[w.length-1])&&(n=m.find(w.shift(),d,v),d=n.expr?m.filter(n.expr,n.set)[0]:n.set[0]);if(d){n=f?{expr:w.pop(),set:s(f)}:m.find(w.pop(),w.length===1&&(w[0]==="~"||w[0]==="+")&&d.parentNode?d.parentNode:d,v),j=n.expr?m.filter(n.expr,n.set):n.set,w.length>0?k=s(j):u=!1;while(w.length)q=w.pop(),r=q,o.relative[q]?r=w.pop():q="",r==null&&(r=d),o.relative[q](k,r,v)}else k=w=[]}k||(k=j),k||m.error(q||b);if(g.call(k)==="[object Array]")if(!u)e.push.apply(e,k);else if(d&&d.nodeType===1)for(t=0;k[t]!=null;t++)k[t]&&(k[t]===!0||k[t].nodeType===1&&m.contains(d,k[t]))&&e.push(j[t]);else for(t=0;k[t]!=null;t++)k[t]&&k[t].nodeType===1&&e.push(j[t]);else s(k,e);l&&(m(l,h,e,f),m.uniqueSort(e));return e};m.uniqueSort=function(a){if(u){h=i,a.sort(u);if(h)for(var b=1;b0},m.find=function(a,b,c){var d,e,f,g,h,i;if(!a)return[];for(e=0,f=o.order.length;e":function(a,b){var c,d=typeof b=="string",e=0,f=a.length;if(d&&!l.test(b)){b=b.toLowerCase();for(;e=0)?c||d.push(h):c&&(b[g]=!1));return!1},ID:function(a){return a[1].replace(j,"")},TAG:function(a,b){return a[1].replace(j,"").toLowerCase()},CHILD:function(a){if(a[1]==="nth"){a[2]||m.error(a[0]),a[2]=a[2].replace(/^\+|\s*/g,"");var b=/(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2]==="even"&&"2n"||a[2]==="odd"&&"2n+1"||!/\D/.test(a[2])&&"0n+"+a[2]||a[2]);a[2]=b[1]+(b[2]||1)-0,a[3]=b[3]-0}else a[2]&&m.error(a[0]);a[0]=e++;return a},ATTR:function(a,b,c,d,e,f){var g=a[1]=a[1].replace(j,"");!f&&o.attrMap[g]&&(a[1]=o.attrMap[g]),a[4]=(a[4]||a[5]||"").replace(j,""),a[2]==="~="&&(a[4]=" "+a[4]+" ");return a},PSEUDO:function(b,c,d,e,f){if(b[1]==="not")if((a.exec(b[3])||"").length>1||/^\w/.test(b[3]))b[3]=m(b[3],null,null,c);else{var g=m.filter(b[3],c,d,!0^f);d||e.push.apply(e,g);return!1}else if(o.match.POS.test(b[0])||o.match.CHILD.test(b[0]))return!0;return b},POS:function(a){a.unshift(!0);return a}},filters:{enabled:function(a){return a.disabled===!1&&a.type!=="hidden"},disabled:function(a){return a.disabled===!0},checked:function(a){return a.checked===!0},selected:function(a){a.parentNode&&a.parentNode.selectedIndex;return a.selected===!0},parent:function(a){return!!a.firstChild},empty:function(a){return!a.firstChild},has:function(a,b,c){return!!m(c[3],a).length},header:function(a){return/h\d/i.test(a.nodeName)},text:function(a){var b=a.getAttribute("type"),c=a.type;return a.nodeName.toLowerCase()==="input"&&"text"===c&&(b===c||b===null)},radio:function(a){return a.nodeName.toLowerCase()==="input"&&"radio"===a.type},checkbox:function(a){return a.nodeName.toLowerCase()==="input"&&"checkbox"===a.type},file:function(a){return a.nodeName.toLowerCase()==="input"&&"file"===a.type},password:function(a){return a.nodeName.toLowerCase()==="input"&&"password"===a.type},submit:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"submit"===a.type},image:function(a){return a.nodeName.toLowerCase()==="input"&&"image"===a.type},reset:function(a){var b=a.nodeName.toLowerCase();return(b==="input"||b==="button")&&"reset"===a.type},button:function(a){var b=a.nodeName.toLowerCase();return b==="input"&&"button"===a.type||b==="button"},input:function(a){return/input|select|textarea|button/i.test(a.nodeName)},focus:function(a){return a===a.ownerDocument.activeElement}},setFilters:{first:function(a,b){return b===0},last:function(a,b,c,d){return b===d.length-1},even:function(a,b){return b%2===0},odd:function(a,b){return b%2===1},lt:function(a,b,c){return bc[3]-0},nth:function(a,b,c){return c[3]-0===b},eq:function(a,b,c){return c[3]-0===b}},filter:{PSEUDO:function(a,b,c,d){var e=b[1],f=o.filters[e];if(f)return f(a,c,b,d);if(e==="contains")return(a.textContent||a.innerText||n([a])||"").indexOf(b[3])>=0;if(e==="not"){var g=b[3];for(var h=0,i=g.length;h=0}},ID:function(a,b){return a.nodeType===1&&a.getAttribute("id")===b},TAG:function(a,b){return b==="*"&&a.nodeType===1||!!a.nodeName&&a.nodeName.toLowerCase()===b},CLASS:function(a,b){return(" "+(a.className||a.getAttribute("class"))+" ").indexOf(b)>-1},ATTR:function(a,b){var c=b[1],d=m.attr?m.attr(a,c):o.attrHandle[c]?o.attrHandle[c](a):a[c]!=null?a[c]:a.getAttribute(c),e=d+"",f=b[2],g=b[4];return d==null?f==="!=":!f&&m.attr?d!=null:f==="="?e===g:f==="*="?e.indexOf(g)>=0:f==="~="?(" "+e+" ").indexOf(g)>=0:g?f==="!="?e!==g:f==="^="?e.indexOf(g)===0:f==="$="?e.substr(e.length-g.length)===g:f==="|="?e===g||e.substr(0,g.length+1)===g+"-":!1:e&&d!==!1},POS:function(a,b,c,d){var e=b[2],f=o.setFilters[e];if(f)return f(a,c,b,d)}}},p=o.match.POS,q=function(a,b){return"\\"+(b-0+1)};for(var r in o.match)o.match[r]=new RegExp(o.match[r].source+/(?![^\[]*\])(?![^\(]*\))/.source),o.leftMatch[r]=new RegExp(/(^(?:.|\r|\n)*?)/.source+o.match[r].source.replace(/\\(\d+)/g,q));var s=function(a,b){a=Array.prototype.slice.call(a,0);if(b){b.push.apply(b,a);return b}return a};try{Array.prototype.slice.call(c.documentElement.childNodes,0)[0].nodeType}catch(t){s=function(a,b){var c=0,d=b||[];if(g.call(a)==="[object Array]")Array.prototype.push.apply(d,a);else if(typeof a.length=="number")for(var e=a.length;c",e.insertBefore(a,e.firstChild),c.getElementById(d)&&(o.find.ID=function(a,c,d){if(typeof c.getElementById!="undefined"&&!d){var e=c.getElementById(a[1]);return e?e.id===a[1]||typeof e.getAttributeNode!="undefined"&&e.getAttributeNode("id").nodeValue===a[1]?[e]:b:[]}},o.filter.ID=function(a,b){var c=typeof a.getAttributeNode!="undefined"&&a.getAttributeNode("id");return a.nodeType===1&&c&&c.nodeValue===b}),e.removeChild(a),e=a=null}(),function(){var a=c.createElement("div");a.appendChild(c.createComment("")),a.getElementsByTagName("*").length>0&&(o.find.TAG=function(a,b){var c=b.getElementsByTagName(a[1]);if(a[1]==="*"){var d=[];for(var e=0;c[e];e++)c[e].nodeType===1&&d.push(c[e]);c=d}return c}),a.innerHTML="",a.firstChild&&typeof a.firstChild.getAttribute!="undefined"&&a.firstChild.getAttribute("href")!=="#"&&(o.attrHandle.href=function(a){return a.getAttribute("href",2)}),a=null}(),c.querySelectorAll&&function(){var a=m,b=c.createElement("div"),d="__sizzle__";b.innerHTML="

";if(!b.querySelectorAll||b.querySelectorAll(".TEST").length!==0){m=function(b,e,f,g){e=e||c;if(!g&&!m.isXML(e)){var h=/^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b);if(h&&(e.nodeType===1||e.nodeType===9)){if(h[1])return s(e.getElementsByTagName(b),f);if(h[2]&&o.find.CLASS&&e.getElementsByClassName)return s(e.getElementsByClassName(h[2]),f)}if(e.nodeType===9){if(b==="body"&&e.body)return s([e.body],f);if(h&&h[3]){var i=e.getElementById(h[3]);if(!i||!i.parentNode)return s([],f);if(i.id===h[3])return s([i],f)}try{return s(e.querySelectorAll(b),f)}catch(j){}}else if(e.nodeType===1&&e.nodeName.toLowerCase()!=="object"){var k=e,l=e.getAttribute("id"),n=l||d,p=e.parentNode,q=/^\s*[+~]/.test(b);l?n=n.replace(/'/g,"\\$&"):e.setAttribute("id",n),q&&p&&(e=e.parentNode);try{if(!q||p)return s(e.querySelectorAll("[id='"+n+"'] "+b),f)}catch(r){}finally{l||k.removeAttribute("id")}}}return a(b,e,f,g)};for(var e in a)m[e]=a[e];b=null}}(),function(){var a=c.documentElement,b=a.matchesSelector||a.mozMatchesSelector||a.webkitMatchesSelector||a.msMatchesSelector;if(b){var d=!b.call(c.createElement("div"),"div"),e=!1;try{b.call(c.documentElement,"[test!='']:sizzle")}catch(f){e=!0}m.matchesSelector=function(a,c){c=c.replace(/\=\s*([^'"\]]*)\s*\]/g,"='$1']");if(!m.isXML(a))try{if(e||!o.match.PSEUDO.test(c)&&!/!=/.test(c)){var f=b.call(a,c);if(f||!d||a.document&&a.document.nodeType!==11)return f}}catch(g){}return m(c,null,null,[a]).length>0}}}(),function(){var a=c.createElement("div");a.innerHTML="
";if(!!a.getElementsByClassName&&a.getElementsByClassName("e").length!==0){a.lastChild.className="e";if(a.getElementsByClassName("e").length===1)return;o.order.splice(1,0,"CLASS"),o.find.CLASS=function(a,b,c){if(typeof b.getElementsByClassName!="undefined"&&!c)return b.getElementsByClassName(a[1])},a=null}}(),c.documentElement.contains?m.contains=function(a,b){return a!==b&&(a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?m.contains=function(a,b){return!!(a.compareDocumentPosition(b)&16)}:m.contains=function(){return!1},m.isXML=function(a){var b=(a?a.ownerDocument||a:0).documentElement;return b?b.nodeName!=="HTML":!1};var y=function(a,b,c){var d,e=[],f="",g=b.nodeType?[b]:b;while(d=o.match.PSEUDO.exec(a))f+=d[0],a=a.replace(o.match.PSEUDO,"");a=o.relative[a]?a+"*":a;for(var h=0,i=g.length;h0)for(h=g;h=0:f.filter(a,this).length>0:this.filter(a).length>0)},closest:function(a,b){var c=[],d,e,g=this[0];if(f.isArray(a)){var h=1;while(g&&g.ownerDocument&&g!==b){for(d=0;d-1:f.find.matchesSelector(g,a)){c.push(g);break}g=g.parentNode;if(!g||!g.ownerDocument||g===b||g.nodeType===11)break}}c=c.length>1?f.unique(c):c;return this.pushStack(c,"closest",a)},index:function(a){if(!a)return this[0]&&this[0].parentNode?this.prevAll().length:-1;if(typeof a=="string")return f.inArray(this[0],f(a));return f.inArray(a.jquery?a[0]:a,this)},add:function(a,b){var c=typeof a=="string"?f(a,b):f.makeArray(a&&a.nodeType?[a]:a),d=f.merge(this.get(),c);return this.pushStack(S(c[0])||S(d[0])?d:f.unique(d))},andSelf:function(){return this.add(this.prevObject)}}),f.each({parent:function(a){var b=a.parentNode;return b&&b.nodeType!==11?b:null},parents:function(a){return f.dir(a,"parentNode")},parentsUntil:function(a,b,c){return f.dir(a,"parentNode",c)},next:function(a){return f.nth(a,2,"nextSibling")},prev:function(a){return f.nth(a,2,"previousSibling")},nextAll:function(a){return f.dir(a,"nextSibling")},prevAll:function(a){return f.dir(a,"previousSibling")},nextUntil:function(a,b,c){return f.dir(a,"nextSibling",c)},prevUntil:function(a,b,c){return f.dir(a,"previousSibling",c)},siblings:function(a){return f.sibling(a.parentNode.firstChild,a)},children:function(a){return f.sibling(a.firstChild)},contents:function(a){return f.nodeName(a,"iframe")?a.contentDocument||a.contentWindow.document:f.makeArray(a.childNodes)}},function(a,b){f.fn[a]=function(c,d){var e=f.map(this,b,c);L.test(a)||(d=c),d&&typeof d=="string"&&(e=f.filter(d,e)),e=this.length>1&&!R[a]?f.unique(e):e,(this.length>1||N.test(d))&&M.test(a)&&(e=e.reverse());return this.pushStack(e,a,P.call(arguments).join(","))}}),f.extend({filter:function(a,b,c){c&&(a=":not("+a+")");return b.length===1?f.find.matchesSelector(b[0],a)?[b[0]]:[]:f.find.matches(a,b)},dir:function(a,c,d){var e=[],g=a[c];while(g&&g.nodeType!==9&&(d===b||g.nodeType!==1||!f(g).is(d)))g.nodeType===1&&e.push(g),g=g[c];return e},nth:function(a,b,c,d){b=b||1;var e=0;for(;a;a=a[c])if(a.nodeType===1&&++e===b)break;return a},sibling:function(a,b){var c=[];for(;a;a=a.nextSibling)a.nodeType===1&&a!==b&&c.push(a);return c}});var V="abbr|article|aside|audio|canvas|datalist|details|figcaption|figure|footer|header|hgroup|mark|meter|nav|output|progress|section|summary|time|video",W=/ jQuery\d+="(?:\d+|null)"/g,X=/^\s+/,Y=/<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig,Z=/<([\w:]+)/,$=/",""],legend:[1,"
","
"],thead:[1,"","
"],tr:[2,"","
"],td:[3,"","
"],col:[2,"","
"],area:[1,"",""],_default:[0,"",""]},bh=U(c);bg.optgroup=bg.option,bg.tbody=bg.tfoot=bg.colgroup=bg.caption=bg.thead,bg.th=bg.td,f.support.htmlSerialize||(bg._default=[1,"div
","
"]),f.fn.extend({text:function(a){if(f.isFunction(a))return this.each(function(b){var c=f(this);c.text(a.call(this,b,c.text()))});if(typeof a!="object"&&a!==b)return this.empty().append((this[0]&&this[0].ownerDocument||c).createTextNode(a));return f.text(this)},wrapAll:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this,b))});if(this[0]){var b=f(a,this[0].ownerDocument).eq(0).clone(!0);this[0].parentNode&&b.insertBefore(this[0]),b.map(function(){var a=this;while(a.firstChild&&a.firstChild.nodeType===1)a=a.firstChild;return a}).append(this)}return this},wrapInner:function(a){if(f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this,b))});return this.each(function(){var b=f(this),c=b.contents();c.length?c.wrapAll(a):b.append(a)})},wrap:function(a){var b=f.isFunction(a);return this.each(function(c){f(this).wrapAll(b?a.call(this,c):a)})},unwrap:function(){return this.parent().each(function(){f.nodeName(this,"body")||f(this).replaceWith(this.childNodes)}).end()},append:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.appendChild(a)})},prepend:function(){return this.domManip(arguments,!0,function(a){this.nodeType===1&&this.insertBefore(a,this.firstChild)})},before:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this)});if(arguments.length){var a=f.clean(arguments);a.push.apply(a,this.toArray());return this.pushStack(a,"before",arguments)}},after:function(){if(this[0]&&this[0].parentNode)return this.domManip(arguments,!1,function(a){this.parentNode.insertBefore(a,this.nextSibling)});if(arguments.length){var a=this.pushStack(this,"after",arguments);a.push.apply(a,f.clean(arguments));return a}},remove:function(a,b){for(var c=0,d;(d=this[c])!=null;c++)if(!a||f.filter(a,[d]).length)!b&&d.nodeType===1&&(f.cleanData(d.getElementsByTagName("*")),f.cleanData([d])),d.parentNode&&d.parentNode.removeChild(d);return this},empty:function() +{for(var a=0,b;(b=this[a])!=null;a++){b.nodeType===1&&f.cleanData(b.getElementsByTagName("*"));while(b.firstChild)b.removeChild(b.firstChild)}return this},clone:function(a,b){a=a==null?!1:a,b=b==null?a:b;return this.map(function(){return f.clone(this,a,b)})},html:function(a){if(a===b)return this[0]&&this[0].nodeType===1?this[0].innerHTML.replace(W,""):null;if(typeof a=="string"&&!ba.test(a)&&(f.support.leadingWhitespace||!X.test(a))&&!bg[(Z.exec(a)||["",""])[1].toLowerCase()]){a=a.replace(Y,"<$1>");try{for(var c=0,d=this.length;c1&&l0?this.clone(!0):this).get();f(e[h])[b](j),d=d.concat(j)}return this.pushStack(d,a,e.selector)}}),f.extend({clone:function(a,b,c){var d,e,g,h=f.support.html5Clone||!bc.test("<"+a.nodeName)?a.cloneNode(!0):bo(a);if((!f.support.noCloneEvent||!f.support.noCloneChecked)&&(a.nodeType===1||a.nodeType===11)&&!f.isXMLDoc(a)){bk(a,h),d=bl(a),e=bl(h);for(g=0;d[g];++g)e[g]&&bk(d[g],e[g])}if(b){bj(a,h);if(c){d=bl(a),e=bl(h);for(g=0;d[g];++g)bj(d[g],e[g])}}d=e=null;return h},clean:function(a,b,d,e){var g;b=b||c,typeof b.createElement=="undefined"&&(b=b.ownerDocument||b[0]&&b[0].ownerDocument||c);var h=[],i;for(var j=0,k;(k=a[j])!=null;j++){typeof k=="number"&&(k+="");if(!k)continue;if(typeof k=="string")if(!_.test(k))k=b.createTextNode(k);else{k=k.replace(Y,"<$1>");var l=(Z.exec(k)||["",""])[1].toLowerCase(),m=bg[l]||bg._default,n=m[0],o=b.createElement("div");b===c?bh.appendChild(o):U(b).appendChild(o),o.innerHTML=m[1]+k+m[2];while(n--)o=o.lastChild;if(!f.support.tbody){var p=$.test(k),q=l==="table"&&!p?o.firstChild&&o.firstChild.childNodes:m[1]===""&&!p?o.childNodes:[];for(i=q.length-1;i>=0;--i)f.nodeName(q[i],"tbody")&&!q[i].childNodes.length&&q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace&&X.test(k)&&o.insertBefore(b.createTextNode(X.exec(k)[0]),o.firstChild),k=o.childNodes}var r;if(!f.support.appendChecked)if(k[0]&&typeof (r=k.length)=="number")for(i=0;i=0)return b+"px"}}}),f.support.opacity||(f.cssHooks.opacity={get:function(a,b){return br.test((b&&a.currentStyle?a.currentStyle.filter:a.style.filter)||"")?parseFloat(RegExp.$1)/100+"":b?"1":""},set:function(a,b){var c=a.style,d=a.currentStyle,e=f.isNumeric(b)?"alpha(opacity="+b*100+")":"",g=d&&d.filter||c.filter||"";c.zoom=1;if(b>=1&&f.trim(g.replace(bq,""))===""){c.removeAttribute("filter");if(d&&!d.filter)return}c.filter=bq.test(g)?g.replace(bq,e):g+" "+e}}),f(function(){f.support.reliableMarginRight||(f.cssHooks.marginRight={get:function(a,b){var c;f.swap(a,{display:"inline-block"},function(){b?c=bz(a,"margin-right","marginRight"):c=a.style.marginRight});return c}})}),c.defaultView&&c.defaultView.getComputedStyle&&(bA=function(a,b){var c,d,e;b=b.replace(bs,"-$1").toLowerCase(),(d=a.ownerDocument.defaultView)&&(e=d.getComputedStyle(a,null))&&(c=e.getPropertyValue(b),c===""&&!f.contains(a.ownerDocument.documentElement,a)&&(c=f.style(a,b)));return c}),c.documentElement.currentStyle&&(bB=function(a,b){var c,d,e,f=a.currentStyle&&a.currentStyle[b],g=a.style;f===null&&g&&(e=g[b])&&(f=e),!bt.test(f)&&bu.test(f)&&(c=g.left,d=a.runtimeStyle&&a.runtimeStyle.left,d&&(a.runtimeStyle.left=a.currentStyle.left),g.left=b==="fontSize"?"1em":f||0,f=g.pixelLeft+"px",g.left=c,d&&(a.runtimeStyle.left=d));return f===""?"auto":f}),bz=bA||bB,f.expr&&f.expr.filters&&(f.expr.filters.hidden=function(a){var b=a.offsetWidth,c=a.offsetHeight;return b===0&&c===0||!f.support.reliableHiddenOffsets&&(a.style&&a.style.display||f.css(a,"display"))==="none"},f.expr.filters.visible=function(a){return!f.expr.filters.hidden(a)});var bD=/%20/g,bE=/\[\]$/,bF=/\r?\n/g,bG=/#.*$/,bH=/^(.*?):[ \t]*([^\r\n]*)\r?$/mg,bI=/^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i,bJ=/^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/,bK=/^(?:GET|HEAD)$/,bL=/^\/\//,bM=/\?/,bN=/)<[^<]*)*<\/script>/gi,bO=/^(?:select|textarea)/i,bP=/\s+/,bQ=/([?&])_=[^&]*/,bR=/^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/,bS=f.fn.load,bT={},bU={},bV,bW,bX=["*/"]+["*"];try{bV=e.href}catch(bY){bV=c.createElement("a"),bV.href="",bV=bV.href}bW=bR.exec(bV.toLowerCase())||[],f.fn.extend({load:function(a,c,d){if(typeof a!="string"&&bS)return bS.apply(this,arguments);if(!this.length)return this;var e=a.indexOf(" ");if(e>=0){var g=a.slice(e,a.length);a=a.slice(0,e)}var h="GET";c&&(f.isFunction(c)?(d=c,c=b):typeof c=="object"&&(c=f.param(c,f.ajaxSettings.traditional),h="POST"));var i=this;f.ajax({url:a,type:h,dataType:"html",data:c,complete:function(a,b,c){c=a.responseText,a.isResolved()&&(a.done(function(a){c=a}),i.html(g?f("
").append(c.replace(bN,"")).find(g):c)),d&&i.each(d,[c,b,a])}});return this},serialize:function(){return f.param(this.serializeArray())},serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name&&!this.disabled&&(this.checked||bO.test(this.nodeName)||bI.test(this.type))}).map(function(a,b){var c=f(this).val();return c==null?null:f.isArray(c)?f.map(c,function(a,c){return{name:b.name,value:a.replace(bF,"\r\n")}}):{name:b.name,value:c.replace(bF,"\r\n")}}).get()}}),f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "),function(a,b){f.fn[b]=function(a){return this.on(b,a)}}),f.each(["get","post"],function(a,c){f[c]=function(a,d,e,g){f.isFunction(d)&&(g=g||e,e=d,d=b);return f.ajax({type:c,url:a,data:d,success:e,dataType:g})}}),f.extend({getScript:function(a,c){return f.get(a,b,c,"script")},getJSON:function(a,b,c){return f.get(a,b,c,"json")},ajaxSetup:function(a,b){b?b_(a,f.ajaxSettings):(b=a,a=f.ajaxSettings),b_(a,b);return a},ajaxSettings:{url:bV,isLocal:bJ.test(bW[1]),global:!0,type:"GET",contentType:"application/x-www-form-urlencoded",processData:!0,async:!0,accepts:{xml:"application/xml, text/xml",html:"text/html",text:"text/plain",json:"application/json, text/javascript","*":bX},contents:{xml:/xml/,html:/html/,json:/json/},responseFields:{xml:"responseXML",text:"responseText"},converters:{"* text":a.String,"text html":!0,"text json":f.parseJSON,"text xml":f.parseXML},flatOptions:{context:!0,url:!0}},ajaxPrefilter:bZ(bT),ajaxTransport:bZ(bU),ajax:function(a,c){function w(a,c,l,m){if(s!==2){s=2,q&&clearTimeout(q),p=b,n=m||"",v.readyState=a>0?4:0;var o,r,u,w=c,x=l?cb(d,v,l):b,y,z;if(a>=200&&a<300||a===304){if(d.ifModified){if(y=v.getResponseHeader("Last-Modified"))f.lastModified[k]=y;if(z=v.getResponseHeader("Etag"))f.etag[k]=z}if(a===304)w="notmodified",o=!0;else try{r=cc(d,x),w="success",o=!0}catch(A){w="parsererror",u=A}}else{u=w;if(!w||a)w="error",a<0&&(a=0)}v.status=a,v.statusText=""+(c||w),o?h.resolveWith(e,[r,w,v]):h.rejectWith(e,[v,w,u]),v.statusCode(j),j=b,t&&g.trigger("ajax"+(o?"Success":"Error"),[v,d,o?r:u]),i.fireWith(e,[v,w]),t&&(g.trigger("ajaxComplete",[v,d]),--f.active||f.event.trigger("ajaxStop"))}}typeof a=="object"&&(c=a,a=b),c=c||{};var d=f.ajaxSetup({},c),e=d.context||d,g=e!==d&&(e.nodeType||e instanceof f)?f(e):f.event,h=f.Deferred(),i=f.Callbacks("once memory"),j=d.statusCode||{},k,l={},m={},n,o,p,q,r,s=0,t,u,v={readyState:0,setRequestHeader:function(a,b){if(!s){var c=a.toLowerCase();a=m[c]=m[c]||a,l[a]=b}return this},getAllResponseHeaders:function(){return s===2?n:null},getResponseHeader:function(a){var c;if(s===2){if(!o){o={};while(c=bH.exec(n))o[c[1].toLowerCase()]=c[2]}c=o[a.toLowerCase()]}return c===b?null:c},overrideMimeType:function(a){s||(d.mimeType=a);return this},abort:function(a){a=a||"abort",p&&p.abort(a),w(0,a);return this}};h.promise(v),v.success=v.done,v.error=v.fail,v.complete=i.add,v.statusCode=function(a){if(a){var b;if(s<2)for(b in a)j[b]=[j[b],a[b]];else b=a[v.status],v.then(b,b)}return this},d.url=((a||d.url)+"").replace(bG,"").replace(bL,bW[1]+"//"),d.dataTypes=f.trim(d.dataType||"*").toLowerCase().split(bP),d.crossDomain==null&&(r=bR.exec(d.url.toLowerCase()),d.crossDomain=!(!r||r[1]==bW[1]&&r[2]==bW[2]&&(r[3]||(r[1]==="http:"?80:443))==(bW[3]||(bW[1]==="http:"?80:443)))),d.data&&d.processData&&typeof d.data!="string"&&(d.data=f.param(d.data,d.traditional)),b$(bT,d,c,v);if(s===2)return!1;t=d.global,d.type=d.type.toUpperCase(),d.hasContent=!bK.test(d.type),t&&f.active++===0&&f.event.trigger("ajaxStart");if(!d.hasContent){d.data&&(d.url+=(bM.test(d.url)?"&":"?")+d.data,delete d.data),k=d.url;if(d.cache===!1){var x=f.now(),y=d.url.replace(bQ,"$1_="+x);d.url=y+(y===d.url?(bM.test(d.url)?"&":"?")+"_="+x:"")}}(d.data&&d.hasContent&&d.contentType!==!1||c.contentType)&&v.setRequestHeader("Content-Type",d.contentType),d.ifModified&&(k=k||d.url,f.lastModified[k]&&v.setRequestHeader("If-Modified-Since",f.lastModified[k]),f.etag[k]&&v.setRequestHeader("If-None-Match",f.etag[k])),v.setRequestHeader("Accept",d.dataTypes[0]&&d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]]+(d.dataTypes[0]!=="*"?", "+bX+"; q=0.01":""):d.accepts["*"]);for(u in d.headers)v.setRequestHeader(u,d.headers[u]);if(d.beforeSend&&(d.beforeSend.call(e,v,d)===!1||s===2)){v.abort();return!1}for(u in{success:1,error:1,complete:1})v[u](d[u]);p=b$(bU,d,c,v);if(!p)w(-1,"No Transport");else{v.readyState=1,t&&g.trigger("ajaxSend",[v,d]),d.async&&d.timeout>0&&(q=setTimeout(function(){v.abort("timeout")},d.timeout));try{s=1,p.send(l,w)}catch(z){if(s<2)w(-1,z);else throw z}}return v},param:function(a,c){var d=[],e=function(a,b){b=f.isFunction(b)?b():b,d[d.length]=encodeURIComponent(a)+"="+encodeURIComponent(b)};c===b&&(c=f.ajaxSettings.traditional);if(f.isArray(a)||a.jquery&&!f.isPlainObject(a))f.each(a,function(){e(this.name,this.value)});else for(var g in a)ca(g,a[g],c,e);return d.join("&").replace(bD,"+")}}),f.extend({active:0,lastModified:{},etag:{}});var cd=f.now(),ce=/(\=)\?(&|$)|\?\?/i;f.ajaxSetup({jsonp:"callback",jsonpCallback:function(){return f.expando+"_"+cd++}}),f.ajaxPrefilter("json jsonp",function(b,c,d){var e=b.contentType==="application/x-www-form-urlencoded"&&typeof b.data=="string";if(b.dataTypes[0]==="jsonp"||b.jsonp!==!1&&(ce.test(b.url)||e&&ce.test(b.data))){var g,h=b.jsonpCallback=f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback,i=a[h],j=b.url,k=b.data,l="$1"+h+"$2";b.jsonp!==!1&&(j=j.replace(ce,l),b.url===j&&(e&&(k=k.replace(ce,l)),b.data===k&&(j+=(/\?/.test(j)?"&":"?")+b.jsonp+"="+h))),b.url=j,b.data=k,a[h]=function(a){g=[a]},d.always(function(){a[h]=i,g&&f.isFunction(i)&&a[h](g[0])}),b.converters["script json"]=function(){g||f.error(h+" was not called");return g[0]},b.dataTypes[0]="json";return"script"}}),f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"},contents:{script:/javascript|ecmascript/},converters:{"text script":function(a){f.globalEval(a);return a}}}),f.ajaxPrefilter("script",function(a){a.cache===b&&(a.cache=!1),a.crossDomain&&(a.type="GET",a.global=!1)}),f.ajaxTransport("script",function(a){if(a.crossDomain){var d,e=c.head||c.getElementsByTagName("head")[0]||c.documentElement;return{send:function(f,g){d=c.createElement("script"),d.async="async",a.scriptCharset&&(d.charset=a.scriptCharset),d.src=a.url,d.onload=d.onreadystatechange=function(a,c){if(c||!d.readyState||/loaded|complete/.test(d.readyState))d.onload=d.onreadystatechange=null,e&&d.parentNode&&e.removeChild(d),d=b,c||g(200,"success")},e.insertBefore(d,e.firstChild)},abort:function(){d&&d.onload(0,1)}}}});var cf=a.ActiveXObject?function(){for(var a in ch)ch[a](0,1)}:!1,cg=0,ch;f.ajaxSettings.xhr=a.ActiveXObject?function(){return!this.isLocal&&ci()||cj()}:ci,function(a){f.extend(f.support,{ajax:!!a,cors:!!a&&"withCredentials"in a})}(f.ajaxSettings.xhr()),f.support.ajax&&f.ajaxTransport(function(c){if(!c.crossDomain||f.support.cors){var d;return{send:function(e,g){var h=c.xhr(),i,j;c.username?h.open(c.type,c.url,c.async,c.username,c.password):h.open(c.type,c.url,c.async);if(c.xhrFields)for(j in c.xhrFields)h[j]=c.xhrFields[j];c.mimeType&&h.overrideMimeType&&h.overrideMimeType(c.mimeType),!c.crossDomain&&!e["X-Requested-With"]&&(e["X-Requested-With"]="XMLHttpRequest");try{for(j in e)h.setRequestHeader(j,e[j])}catch(k){}h.send(c.hasContent&&c.data||null),d=function(a,e){var j,k,l,m,n;try{if(d&&(e||h.readyState===4)){d=b,i&&(h.onreadystatechange=f.noop,cf&&delete ch[i]);if(e)h.readyState!==4&&h.abort();else{j=h.status,l=h.getAllResponseHeaders(),m={},n=h.responseXML,n&&n.documentElement&&(m.xml=n),m.text=h.responseText;try{k=h.statusText}catch(o){k=""}!j&&c.isLocal&&!c.crossDomain?j=m.text?200:404:j===1223&&(j=204)}}}catch(p){e||g(-1,p)}m&&g(j,k,m,l)},!c.async||h.readyState===4?d():(i=++cg,cf&&(ch||(ch={},f(a).unload(cf)),ch[i]=d),h.onreadystatechange=d)},abort:function(){d&&d(0,1)}}}});var ck={},cl,cm,cn=/^(?:toggle|show|hide)$/,co=/^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i,cp,cq=[["height","marginTop","marginBottom","paddingTop","paddingBottom"],["width","marginLeft","marginRight","paddingLeft","paddingRight"],["opacity"]],cr;f.fn.extend({show:function(a,b,c){var d,e;if(a||a===0)return this.animate(cu("show",3),a,b,c);for(var g=0,h=this.length;g=i.duration+this.startTime){this.now=this.end,this.pos=this.state=1,this.update(),i.animatedProperties[this.prop]=!0;for(b in i.animatedProperties)i.animatedProperties[b]!==!0&&(g=!1);if(g){i.overflow!=null&&!f.support.shrinkWrapBlocks&&f.each(["","X","Y"],function(a,b){h.style["overflow"+b]=i.overflow[a]}),i.hide&&f(h).hide();if(i.hide||i.show)for(b in i.animatedProperties)f.style(h,b,i.orig[b]),f.removeData(h,"fxshow"+b,!0),f.removeData(h,"toggle"+b,!0);d=i.complete,d&&(i.complete=!1,d.call(h))}return!1}i.duration==Infinity?this.now=e:(c=e-this.startTime,this.state=c/i.duration,this.pos=f.easing[i.animatedProperties[this.prop]](this.state,c,0,1,i.duration),this.now=this.start+(this.end-this.start)*this.pos),this.update();return!0}},f.extend(f.fx,{tick:function(){var a,b=f.timers,c=0;for(;c-1,k={},l={},m,n;j?(l=e.position(),m=l.top,n=l.left):(m=parseFloat(h)||0,n=parseFloat(i)||0),f.isFunction(b)&&(b=b.call(a,c,g)),b.top!=null&&(k.top=b.top-g.top+m),b.left!=null&&(k.left=b.left-g.left+n),"using"in b?b.using.call(a,k):e.css(k)}},f.fn.extend({position:function(){if(!this[0])return null;var a=this[0],b=this.offsetParent(),c=this.offset(),d=cx.test(b[0].nodeName)?{top:0,left:0}:b.offset();c.top-=parseFloat(f.css(a,"marginTop"))||0,c.left-=parseFloat(f.css(a,"marginLeft"))||0,d.top+=parseFloat(f.css(b[0],"borderTopWidth"))||0,d.left+=parseFloat(f.css(b[0],"borderLeftWidth"))||0;return{top:c.top-d.top,left:c.left-d.left}},offsetParent:function(){return this.map(function(){var a=this.offsetParent||c.body;while(a&&!cx.test(a.nodeName)&&f.css(a,"position")==="static")a=a.offsetParent;return a})}}),f.each(["Left","Top"],function(a,c){var d="scroll"+c;f.fn[d]=function(c){var e,g;if(c===b){e=this[0];if(!e)return null;g=cy(e);return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel&&g.document.documentElement[d]||g.document.body[d]:e[d]}return this.each(function(){g=cy(this),g?g.scrollTo(a?f(g).scrollLeft():c,a?c:f(g).scrollTop()):this[d]=c})}}),f.each(["Height","Width"],function(a,c){var d=c.toLowerCase();f.fn["inner"+c]=function(){var a=this[0];return a?a.style?parseFloat(f.css(a,d,"padding")):this[d]():null},f.fn["outer"+c]=function(a){var b=this[0];return b?b.style?parseFloat(f.css(b,d,a?"margin":"border")):this[d]():null},f.fn[d]=function(a){var e=this[0];if(!e)return a==null?null:this;if(f.isFunction(a))return this.each(function(b){var c=f(this);c[d](a.call(this,b,c[d]()))});if(f.isWindow(e)){var g=e.document.documentElement["client"+c],h=e.document.body;return e.document.compatMode==="CSS1Compat"&&g||h&&h["client"+c]||g}if(e.nodeType===9)return Math.max(e.documentElement["client"+c],e.body["scroll"+c],e.documentElement["scroll"+c],e.body["offset"+c],e.documentElement["offset"+c]);if(a===b){var i=f.css(e,d),j=parseFloat(i);return f.isNumeric(j)?j:i}return this.css(d,typeof a=="string"?a:a+"px")}}),a.jQuery=a.$=f,typeof define=="function"&&define.amd&&define.amd.jQuery&&define("jquery",[],function(){return f})})(window); diff --git a/experiment/simulation/js/jquery_files/jquery.jqplot.min.js b/experiment/simulation/js/jquery_files/jquery.jqplot.min.js new file mode 100644 index 0000000..f1e8f4b --- /dev/null +++ b/experiment/simulation/js/jquery_files/jquery.jqplot.min.js @@ -0,0 +1,533 @@ + + +/** + * jqPlot + * Pure JavaScript plotting plugin using jQuery + * + * Version: 1.0.0r1095 + * + * Copyright (c) 2009-2011 Chris Leonello + * jqPlot is currently available for use in all personal or commercial projects + * under both the MIT (http://www.opensource.org/licenses/mit-license.php) and GPL + * version 2.0 (http://www.gnu.org/licenses/gpl-2.0.html) licenses. This means that you can + * choose the license that best suits your project and use it accordingly. + * + * Although not required, the author would appreciate an email letting him + * know of any substantial use of jqPlot. You can reach the author at: + * chris at jqplot dot com or see http://www.jqplot.com/info.php . + * + * If you are feeling kind and generous, consider supporting the project by + * making a donation at: http://www.jqplot.com/donate.php . + * + * sprintf functions contained in jqplot.sprintf.js by Ash Searle: + * + * version 2007.04.27 + * author Ash Searle + * http://hexmen.com/blog/2007/03/printf-sprintf/ + * http://hexmen.com/js/sprintf.js + * The author (Ash Searle) has placed this code in the public domain: + * "This code is unrestricted: you are free to use it however you like." + * + * included jsDate library by Chris Leonello: + * + * Copyright (c) 2010-2011 Chris Leonello + * + * jsDate is currently available for use in all personal or commercial projects + * under both the MIT and GPL version 2.0 licenses. This means that you can + * choose the license that best suits your project and use it accordingly. + * + * jsDate borrows many concepts and ideas from the Date Instance + * Methods by Ken Snyder along with some parts of Ken's actual code. + * + * Ken's origianl Date Instance Methods and copyright notice: + * + * Ken Snyder (ken d snyder at gmail dot com) + * 2008-09-10 + * version 2.0.2 (http://kendsnyder.com/sandbox/date/) + * Creative Commons Attribution License 3.0 (http://creativecommons.org/licenses/by/3.0/) + * + * jqplotToImage function based on Larry Siden's export-jqplot-to-png.js. + * Larry has generously given permission to adapt his code for inclusion + * into jqPlot. + * + * Larry's original code can be found here: + * + * https://github.com/lsiden/export-jqplot-to-png + * + * + */ +(function(H){ +var r; H.fn.emptyForce = function(){ +for (var ab = 0, ac; (ac = H(this)[ab]) != null; ab++){ +if (ac.nodeType === 1){H.cleanData(ac.getElementsByTagName("*"))} +if (H.jqplot.use_excanvas){ac.outerHTML = ""} +else{ +while (ac.firstChild){ac.removeChild(ac.firstChild)}}ac = null +}return H(this)}; + H.fn.removeChildForce = function(ab){ + while (ab.firstChild){ + this.removeChildForce(ab.firstChild); ab.removeChild(ab.firstChild)}}; + H.fn.jqplot = function(){ + var ab = []; var ad = []; + for (var ae = 0, ac = arguments.length; ae < ac; ae++){ + if (H.isArray(arguments[ae])){ab.push(arguments[ae])} + else{ + if (H.isPlainObject(arguments[ae])){ + ad.push(arguments[ae])}}} + return this.each(function(ah){ + var am, al, ak = H(this), ag = ab.length, af = ad.length, aj, ai; + if (ah < ag){aj = ab[ah]} + else{aj = ag?ab[ag - 1]:null} + if (ah < af){ai = ad[ah]} + else{ai = af?ad[af - 1]:null}am = ak.attr("id"); + if (am === r){am = "jqplot_target_" + H.jqplot.targetCounter++; ak.attr("id", am)}al = H.jqplot(am, aj, ai); ak.data("jqplot", al)})}; + H.jqplot = function(ah, ae, ac){var ad = null, ab = null; + if (arguments.length === 3){ad = ae; ab = ac} + else{ + if (arguments.length === 2){ + if (H.isArray(ae)){ad = ae} + else{if + (H.isPlainObject(ae)){ab = ae}}}} + if (ad === null && ab !== null && ab.data){ad = ab.data} + var ag = new N(); H("#" + ah).removeClass("jqplot-error"); + if (H.jqplot.config.catchErrors){ + try{ag.init(ah, ad, ab); ag.draw(); + ag.themeEngine.init.call(ag); + return ag} catch (af){ + var ai = H.jqplot.config.errorMessage || af.message; H("#" + ah).append('
' + ai + "
"); + H("#" + ah).addClass("jqplot-error"); + document.getElementById(ah).style.background = H.jqplot.config.errorBackground; + document.getElementById(ah).style.border = H.jqplot.config.errorBorder; + document.getElementById(ah).style.fontFamily = H.jqplot.config.errorFontFamily; + document.getElementById(ah).style.fontSize = H.jqplot.config.errorFontSize; + document.getElementById(ah).style.fontStyle = H.jqplot.config.errorFontStyle; + document.getElementById(ah).style.fontWeight = H.jqplot.config.errorFontWeight}} + else{ag.init(ah, ad, ab); + ag.draw(); + ag.themeEngine.init.call(ag); + return ag}}; H.jqplot.version = "1.0.0"; + H.jqplot.revision = "1095"; + H.jqplot.targetCounter = 1; + H.jqplot.CanvasManager = function(){ + if (typeof H.jqplot.CanvasManager.canvases == "undefined"){ + H.jqplot.CanvasManager.canvases = []; H.jqplot.CanvasManager.free = []} + var ab = []; + this.getCanvas = function(){ + var ae; + var ad = true; if (!H.jqplot.use_excanvas){ + for (var af = 0, ac = H.jqplot.CanvasManager.canvases.length; af < ac; af++){ + if (H.jqplot.CanvasManager.free[af] === true){ + ad = false; + ae = H.jqplot.CanvasManager.canvases[af]; + H.jqplot.CanvasManager.free[af] = false; + ab.push(af); + break}}}if (ad){ae = document.createElement("canvas"); + ab.push(H.jqplot.CanvasManager.canvases.length); H.jqplot.CanvasManager.canvases.push(ae); H.jqplot.CanvasManager.free.push(false)} + return ae}; + this.initCanvas = function(ac){ + if (H.jqplot.use_excanvas){ + return window.G_vmlCanvasManager.initElement(ac)} + return ac}; + this.freeAllCanvases = function(){ + for (var ad = 0, ac = ab.length; ad < ac; ad++){ + this.freeCanvas(ab[ad]) + }ab = []}; + this.freeCanvas = function(ac){ + if (H.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== r){ + window.G_vmlCanvasManager.uninitElement(H.jqplot.CanvasManager.canvases[ac]); + H.jqplot.CanvasManager.canvases[ac] = null} + else{var ad = H.jqplot.CanvasManager.canvases[ac]; + ad.getContext("2d").clearRect(0, 0, ad.width, ad.height); + H(ad).unbind().removeAttr("class").removeAttr("style"); + H(ad).css({left:"", top:"", position:""}); ad.width = 0; ad.height = 0; + H.jqplot.CanvasManager.free[ac] = true}}}; + H.jqplot.log = function(){ + if (window.console){window.console.log.apply(window.console, arguments)}}; + H.jqplot.config = { + addDomReference:false, enablePlugins:false, defaultHeight:300, + defaultWidth:400, UTCAdjust:false, + timezoneOffset:new Date(new Date().getTimezoneOffset() * 60000), + errorMessage:"", errorBackground:"", errorBorder:"", errorFontFamily:"", + errorFontSize:"", errorFontStyle:"", errorFontWeight:"", catchErrors:false, defaultTickFormatString:"%.1f", + defaultColors:["#4bb2c5", "#EAA228", "#c5b47f", "#579575", "#839557", "#958c12", "#953579", "#4b5de4", "#d8b83f", "#ff5800", + "#0085cc", "#c747a3", "#cddf54", "#FBD178", "#26B4E3", "#bd70c7"], + defaultNegativeColors:["#498991", "#C08840", "#9F9274", "#546D61", "#646C4A", + "#6F6621", "#6E3F5F", "#4F64B0", "#A89050", "#C45923", "#187399", "#945381", "#959E5C", "#C7AF7B", "#478396", "#907294"], + dashLength:4, gapLength:4, dotGapLength:2.5, srcLocation:"jqplot/src/", pluginLocation:"jqplot/src/plugins/"}; + H.jqplot.arrayMax = function(ab){return Math.max.apply(Math, ab)}; + H.jqplot.arrayMin = function(ab){ + return Math.min.apply(Math, ab)}; + H.jqplot.enablePlugins = H.jqplot.config.enablePlugins; + H.jqplot.support_canvas = function(){ + if (typeof H.jqplot.support_canvas.result == "undefined"){ + H.jqplot.support_canvas.result = !!document.createElement("canvas").getContext} + return H.jqplot.support_canvas.result}; + H.jqplot.support_canvas_text = function(){ + if (typeof H.jqplot.support_canvas_text.result == "undefined"){ + if (window.G_vmlCanvasManager !== r && window.G_vmlCanvasManager._version > 887){ + H.jqplot.support_canvas_text.result = true + } else{ + H.jqplot.support_canvas_text.result = !!(document.createElement("canvas").getContext && typeof document.createElement("canvas").getContext("2d").fillText == "function")}} + return H.jqplot.support_canvas_text.result}; + H.jqplot.use_excanvas = (H.browser.msie && !H.jqplot.support_canvas())?true:false; + H.jqplot.preInitHooks = []; + H.jqplot.postInitHooks = []; + H.jqplot.preParseOptionsHooks = []; + H.jqplot.postParseOptionsHooks = []; + H.jqplot.preDrawHooks = []; + H.jqplot.postDrawHooks = []; + H.jqplot.preDrawSeriesHooks = []; + H.jqplot.postDrawSeriesHooks = []; + H.jqplot.preDrawLegendHooks = []; + H.jqplot.addLegendRowHooks = []; + H.jqplot.preSeriesInitHooks = []; + H.jqplot.postSeriesInitHooks = []; + H.jqplot.preParseSeriesOptionsHooks = []; + H.jqplot.postParseSeriesOptionsHooks = []; + H.jqplot.eventListenerHooks = []; + H.jqplot.preDrawSeriesShadowHooks = []; + H.jqplot.postDrawSeriesShadowHooks = []; + H.jqplot.ElemContainer = function(){ + this._elem; + this._plotWidth; + this._plotHeight; + this._plotDimensions = {height:null, width:null}}; + H.jqplot.ElemContainer.prototype.createElement = function(ae, ag, ac, ad, ah){ + this._offsets = ag; var ab = ac || "jqplot"; + var af = document.createElement(ae); + this._elem = H(af); + this._elem.addClass(ab); + this._elem.css(ad); + this._elem.attr(ah); + af = null; + return this._elem}; H.jqplot.ElemContainer.prototype.getWidth = function(){ +if (this._elem){return this._elem.outerWidth(true)} else{return null}}; + H.jqplot.ElemContainer.prototype.getHeight = function(){if (this._elem){ + return this._elem.outerHeight(true)} else{return null}}; + H.jqplot.ElemContainer.prototype.getPosition = function(){if (this._elem){return this._elem.position()} + else{return{top:null, left:null, bottom:null, right:null}}}; + H.jqplot.ElemContainer.prototype.getTop = function(){ + return this.getPosition().top}; + H.jqplot.ElemContainer.prototype.getLeft = function(){return this.getPosition().left}; + H.jqplot.ElemContainer.prototype.getBottom = function(){return this._elem.css("bottom")}; + H.jqplot.ElemContainer.prototype.getRight = function(){return this._elem.css("right")}; + function s(ab){H.jqplot.ElemContainer.call(this); this.name = ab; this._series = []; this.show = false; + this.tickRenderer = H.jqplot.AxisTickRenderer; + this.tickOptions = {}; + this.labelRenderer = H.jqplot.AxisLabelRenderer; + this.labelOptions = {}; + this.label = null; this.showLabel = true; this.min = null; + this.max = null; this.autoscale = false; + this.pad = 1.2; + this.padMax = null; + this.padMin = null; + this.ticks = []; + this.numberTicks; this.tickInterval; + this.renderer = H.jqplot.LinearAxisRenderer; + this.rendererOptions = {}; + this.showTicks = true; + this.showTickMarks = true; + this.showMinorTicks = true; + this.drawMajorGridlines = true; + this.drawMinorGridlines = false; + this.drawMajorTickMarks = true; + this.drawMinorTickMarks = true; + this.useSeriesColor = false; this.borderWidth = null; this.borderColor = null; + this.scaleToHiddenSeries = false; + this._dataBounds = {min:null, max:null}; this._intervalStats = []; this._offsets = {min:null, max:null}; this._ticks = []; this._label = null; + this.syncTicks = null; this.tickSpacing = 75; this._min = null; this._max = null; this._tickInterval = null; this._numberTicks = null; + this.__ticks = null; this._options = {}}s.prototype = new H.jqplot.ElemContainer(); s.prototype.constructor = s; + s.prototype.init = function(){if (H.isFunction(this.renderer)){this.renderer = new this.renderer()}this.tickOptions.axis = this.name; + if (this.tickOptions.showMark == null){this.tickOptions.showMark = this.showTicks} + if (this.tickOptions.showMark == null){ + this.tickOptions.showMark = this.showTickMarks}if (this.tickOptions.showLabel == null){this.tickOptions.showLabel = this.showTicks} + if (this.label == null || this.label == ""){this.showLabel = false} else{this.labelOptions.label = this.label} + if (this.showLabel == false){this.labelOptions.show = false}if (this.pad == 0){this.pad = 1}if (this.padMax == 0){this.padMax = 1} + if (this.padMin == 0){this.padMin = 1}if (this.padMax == null){this.padMax = (this.pad - 1) / 2 + 1} + if (this.padMin == null){this.padMin = (this.pad - 1) / 2 + 1}this.pad = this.padMax + this.padMin - 1; + if (this.min != null || this.max != null){this.autoscale = false} + if (this.syncTicks == null && this.name.indexOf("y") > - 1){this.syncTicks = true} else{if (this.syncTicks == null){ + this.syncTicks = false}}this.renderer.init.call(this, this.rendererOptions)}; + s.prototype.draw = function(ab, ac){if (this.__ticks){ + this.__ticks = null}return this.renderer.draw.call(this, ab, ac)}; s.prototype.set = function(){ +this.renderer.set.call(this)}; s.prototype.pack = function(ac, ab){ +if (this.show){this.renderer.pack.call(this, ac, ab)}if (this._min == null){this._min = this.min; this._max = this.max; + this._tickInterval = this.tickInterval; this._numberTicks = this.numberTicks; + this.__ticks = this._ticks}}; + s.prototype.reset = function(){this.renderer.reset.call(this)}; + s.prototype.resetScale = function(ab){ + H.extend(true, this, {min:null, max:null, numberTicks:null, tickInterval:null, _ticks:[], ticks:[]}, ab); + this.resetDataBounds()}; s.prototype.resetDataBounds = function(){var ai = this._dataBounds; ai.min = null; ai.max = null; + var ac, aj, ag; var ad = (this.show)?true:false; for (var af = 0; af < this._series.length; af++){aj = this._series[af]; + if (aj.show || this.scaleToHiddenSeries){ag = aj._plotData; + if (aj._type === "line" && aj.renderer.bands.show && this.name.charAt(0) !== "x"){ +ag = [[0, aj.renderer.bands._min], [1, aj.renderer.bands._max]]}var ab = 1, ah = 1; + if (aj._type != null && aj._type == "ohlc"){ab = 3; ah = 2} +for (var ae = 0, ac = ag.length; ae < ac; ae++){ +if (this.name == "xaxis" || this.name == "x2axis"){ +if ((ag[ae][0] != null && ag[ae][0] < ai.min) || ai.min == null){ +ai.min = ag[ae][0]}if ((ag[ae][0] != null && ag[ae][0] > ai.max) || ai.max == null){ai.max = ag[ae][0]}} +else{if ((ag[ae][ab] != null && ag[ae][ab] < ai.min) || ai.min == null){ai.min = ag[ae][ab]} +if ((ag[ae][ah] != null && ag[ae][ah] > ai.max) || ai.max == null){ai.max = ag[ae][ah]}}} +if (ad && aj.renderer.constructor !== H.jqplot.BarRenderer){ad = false} +else{if (ad && this._options.hasOwnProperty("forceTickAt0") && this._options.forceTickAt0 == false){ +ad = false} else{if (ad && aj.renderer.constructor === H.jqplot.BarRenderer){ +if (aj.barDirection == "vertical" && this.name != "xaxis" && this.name != "x2axis"){ +if (this._options.pad != null || this._options.padMin != null){ad = false}} +else{if (aj.barDirection == "horizontal" && (this.name == "xaxis" || this.name == "x2axis")){ +if (this._options.pad != null || this._options.padMin != null){ad = false}}}}}}}} +if (ad && this.renderer.constructor === H.jqplot.LinearAxisRenderer && ai.min >= 0){this.padMin = 1; + this.forceTickAt0 = true}}; + function n(ab){H.jqplot.ElemContainer.call(this); this.show = false; this.location = "ne"; this.labels = []; + this.showLabels = true; this.showSwatches = true; this.placement = "insideGrid"; this.xoffset = 0; this.yoffset = 0; + this.border; this.background; this.textColor; this.fontFamily; this.fontSize; this.rowSpacing = "0.5em"; + this.renderer = H.jqplot.TableLegendRenderer; this.rendererOptions = {}; this.preDraw = false; this.marginTop = null; + this.marginRight = null; this.marginBottom = null; this.marginLeft = null; this.escapeHtml = false; this._series = []; + H.extend(true, this, ab)}n.prototype = new H.jqplot.ElemContainer(); n.prototype.constructor = n; + n.prototype.setOptions = function(ab){ + H.extend(true, this, ab); + if (this.placement == "inside"){this.placement = "insideGrid"}if (this.xoffset > 0){ + if (this.placement == "insideGrid"){ + switch (this.location){case"nw":case"w":case"sw":if (this.marginLeft == null){ + this.marginLeft = this.xoffset + "px"}this.marginRight = "0px"; break; + case"ne":case"e":case"se":default:if (this.marginRight == null){this.marginRight = this.xoffset + "px"}this.marginLeft = "0px"; break}} + else{if (this.placement == "outside"){ + switch (this.location){case"nw":case"w":case"sw":if (this.marginRight == null){this.marginRight = this.xoffset + "px"} + this.marginLeft = "0px"; break; case"ne":case"e":case"se":default:if (this.marginLeft == null){ + this.marginLeft = this.xoffset + "px"}this.marginRight = "0px"; break}}} + this.xoffset = 0}if (this.yoffset > 0){if (this.placement == "outside"){switch (this.location){ + case"sw":case"s":case"se":if (this.marginTop == null){this.marginTop = this.yoffset + "px"} + this.marginBottom = "0px"; break; case"ne":case"n":case"nw":default:if (this.marginBottom == null){ + this.marginBottom = this.yoffset + "px"}this.marginTop = "0px"; break}} + else{if (this.placement == "insideGrid"){switch (this.location){case"sw":case"s":case"se":if (this.marginBottom == null){ + this.marginBottom = this.yoffset + "px"}this.marginTop = "0px"; break; case"ne":case"n":case"nw":default:if (this.marginTop == null){ + this.marginTop = this.yoffset + "px"}this.marginBottom = "0px"; break}}}this.yoffset = 0}}; + n.prototype.init = function(){if (H.isFunction(this.renderer)){ + this.renderer = new this.renderer()}this.renderer.init.call(this, this.rendererOptions)}; + n.prototype.draw = function(ac, ad){for (var ab = 0; ab < H.jqplot.preDrawLegendHooks.length; ab++){H.jqplot.preDrawLegendHooks[ab].call(this, ac)} + return this.renderer.draw.call(this, ac, ad)}; n.prototype.pack = function(ab){this.renderer.pack.call(this, ab)}; + function u(ab){H.jqplot.ElemContainer.call(this); this.text = ab; this.show = true; this.fontFamily; this.fontSize; this.textAlign; + this.textColor; this.renderer = H.jqplot.DivTitleRenderer; this.rendererOptions = {}; + this.escapeHtml = false}u.prototype = new H.jqplot.ElemContainer(); u.prototype.constructor = u; + u.prototype.init = function(){if (H.isFunction(this.renderer)){this.renderer = new this.renderer()}this.renderer.init.call(this, this.rendererOptions)}; + u.prototype.draw = function(ab){return this.renderer.draw.call(this, ab)}; u.prototype.pack = function(){this.renderer.pack.call(this)}; + function O(){H.jqplot.ElemContainer.call(this); this.show = true; this.xaxis = "xaxis"; this._xaxis; this.yaxis = "yaxis"; this._yaxis; + this.gridBorderWidth = 2; this.renderer = H.jqplot.LineRenderer; this.rendererOptions = {}; this.data = []; this.gridData = []; + this.label = ""; this.showLabel = true; this.color; this.negativeColor; this.lineWidth = 2.5; this.lineJoin = "round"; + this.lineCap = "round"; this.linePattern = "solid"; this.shadow = true; this.shadowAngle = 45; this.shadowOffset = 1.25; + this.shadowDepth = 3; this.shadowAlpha = "0.1"; this.breakOnNull = false; this.markerRenderer = H.jqplot.MarkerRenderer; + this.markerOptions = {}; this.showLine = true; this.showMarker = true; this.index; this.fill = false; this.fillColor; + this.fillAlpha; this.fillAndStroke = false; this.disableStack = false; this._stack = false; this.neighborThreshold = 4; + this.fillToZero = false; this.fillToValue = 0; this.fillAxis = "y"; this.useNegativeColors = true; this._stackData = []; + this._plotData = []; this._plotValues = {x:[], y:[]}; this._intervals = {x:{}, y:{}}; this._prevPlotData = []; this._prevGridData = []; + this._stackAxis = "y"; this._primaryAxis = "_xaxis"; this.canvas = new H.jqplot.GenericCanvas(); + this.shadowCanvas = new H.jqplot.GenericCanvas(); this.plugins = {}; this._sumy = 0; this._sumx = 0; this._type = ""} +O.prototype = new H.jqplot.ElemContainer(); O.prototype.constructor = O; + O.prototype.init = function(ad, ah, af){ + this.index = ad; this.gridBorderWidth = ah; var ag = this.data; var ac = [], ae; + for (ae = 0; ae < ag.length; ae++){if (!this.breakOnNull){if (ag[ae] == null || ag[ae][0] == null || ag[ae][1] == null){continue} + else{ac.push(ag[ae])}} else{ac.push(ag[ae])}}this.data = ac; if (!this.color){this.color = af.colorGenerator.get(this.index)} + if (!this.negativeColor){this.negativeColor = af.negativeColorGenerator.get(this.index)}if (!this.fillColor){this.fillColor = this.color} + if (this.fillAlpha){var ab = H.jqplot.normalize2rgb(this.fillColor); var ab = H.jqplot.getColorComponents(ab); + this.fillColor = "rgba(" + ab[0] + "," + ab[1] + "," + ab[2] + "," + this.fillAlpha + ")"} + if (H.isFunction(this.renderer)){this.renderer = new this.renderer()}this.renderer.init.call(this, this.rendererOptions, af); + this.markerRenderer = new this.markerRenderer(); + if (!this.markerOptions.color){this.markerOptions.color = this.color} + if (this.markerOptions.show == null){ + this.markerOptions.show = this.showMarker}this.showMarker = this.markerOptions.show; + this.markerRenderer.init(this.markerOptions)}; + O.prototype.draw = function(ah, ae, ag){var ac = (ae == r)?{}:ae; ah = (ah == r)?this.canvas._ctx:ah; + var ab, af, ad; for (ab = 0; ab < H.jqplot.preDrawSeriesHooks.length; ab++){H.jqplot.preDrawSeriesHooks[ab].call(this, ah, ac)} + if (this.show){this.renderer.setGridData.call(this, ag); + if (!ac.preventJqPlotSeriesDrawTrigger){H(ah.canvas).trigger("jqplotSeriesDraw", [this.data, this.gridData])}af = []; + if (ac.data){af = ac.data} else{if (!this._stack){af = this.data} + else{af = this._plotData}}ad = ac.gridData || this.renderer.makeGridData.call(this, af, ag); + if (this._type === "line" && this.renderer.smooth && this.renderer._smoothedData.length){ad = this.renderer._smoothedData} + this.renderer.draw.call(this, ah, ad, ac, ag)}for (ab = 0; ab < H.jqplot.postDrawSeriesHooks.length; ab++) + {H.jqplot.postDrawSeriesHooks[ab].call(this, ah, ac, ag)}ah = ae = ag = ab = af = ad = null}; + O.prototype.drawShadow = function(ah, ae, ag){var ac = (ae == r)?{}:ae; ah = (ah == r)?this.shadowCanvas._ctx:ah; + var ab, af, ad; for (ab = 0; ab < H.jqplot.preDrawSeriesShadowHooks.length; ab++){ + H.jqplot.preDrawSeriesShadowHooks[ab].call(this, ah, ac)} + if (this.shadow){this.renderer.setGridData.call(this, ag); af = []; + if (ac.data){af = ac.data} else{if (!this._stack){af = this.data} + else{af = this._plotData}}ad = ac.gridData || this.renderer.makeGridData.call(this, af, ag); + this.renderer.drawShadow.call(this, ah, ad, ac)}for (ab = 0; ab < H.jqplot.postDrawSeriesShadowHooks.length; ab++){ + H.jqplot.postDrawSeriesShadowHooks[ab].call(this, ah, ac)}ah = ae = ag = ab = af = ad = null}; + O.prototype.toggleDisplay = function(ac, ae){var ab, ad; if (ac.data.series){ab = ac.data.series} + else{ab = this} + if (ac.data.speed){ad = ac.data.speed}if (ad){if (ab.canvas._elem.is(":hidden") || !ab.show){ab.show = true; + ab.canvas._elem.removeClass("jqplot-series-hidden"); + if (ab.shadowCanvas._elem){ab.shadowCanvas._elem.fadeIn(ad)}ab.canvas._elem.fadeIn(ad, ae); + ab.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-" + ab.index).fadeIn(ad)} + else{ab.show = false; ab.canvas._elem.addClass("jqplot-series-hidden"); + if (ab.shadowCanvas._elem){ab.shadowCanvas._elem.fadeOut(ad)}ab.canvas._elem.fadeOut(ad, ae); + ab.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-" + ab.index).fadeOut(ad)}} + else{if (ab.canvas._elem.is(":hidden") || !ab.show){ab.show = true; + ab.canvas._elem.removeClass("jqplot-series-hidden"); + if (ab.shadowCanvas._elem){ab.shadowCanvas._elem.show()}ab.canvas._elem.show(0, ae); + ab.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-" + ab.index).show()} + else{ab.show = false; ab.canvas._elem.addClass("jqplot-series-hidden"); + if (ab.shadowCanvas._elem){ab.shadowCanvas._elem.hide()}ab.canvas._elem.hide(0, ae); + ab.canvas._elem.nextAll(".jqplot-point-label.jqplot-series-" + ab.index).hide()}}}; + function I(){H.jqplot.ElemContainer.call(this); this.drawGridlines = true; this.gridLineColor = "#cccccc"; + this.gridLineWidth = 1; this.background = "#fffdf6"; this.borderColor = "#999999"; + this.borderWidth = 2; this.drawBorder = true; this.shadow = true; this.shadowAngle = 45; this.shadowOffset = 1.5; + this.shadowWidth = 3; + this.shadowDepth = 3; this.shadowColor = null; this.shadowAlpha = "0.07"; this._left; this._top; + this._right; this._bottom; this._width; this._height; this._axes = []; + this.renderer = H.jqplot.CanvasGridRenderer; + this.rendererOptions = {}; this._offsets = {top:null, bottom:null, left:null, right:null}}I.prototype = new H.jqplot.ElemContainer(); + I.prototype.constructor = I; I.prototype.init = function(){if (H.isFunction(this.renderer)){ + this.renderer = new this.renderer()}this.renderer.init.call(this, this.rendererOptions)}; + I.prototype.createElement = function(ab, ac){this._offsets = ab; + return this.renderer.createElement.call(this, ac)}; + I.prototype.draw = function(){this.renderer.draw.call(this)}; + H.jqplot.GenericCanvas = function(){H.jqplot.ElemContainer.call(this); this._ctx}; + H.jqplot.GenericCanvas.prototype = new H.jqplot.ElemContainer(); + H.jqplot.GenericCanvas.prototype.constructor = H.jqplot.GenericCanvas; + H.jqplot.GenericCanvas.prototype.createElement = function(af, ad, ac, ag){this._offsets = af; var ab = "jqplot"; + if (ad != r){ab = ad}var ae; ae = ag.canvasManager.getCanvas(); + if (ac != null){this._plotDimensions = ac}ae.width = this._plotDimensions.width - this._offsets.left - this._offsets.right; + ae.height = this._plotDimensions.height - this._offsets.top - this._offsets.bottom; this._elem = H(ae); + this._elem.css({position:"absolute", left:this._offsets.left, top:this._offsets.top}); + this._elem.addClass(ab); ae = ag.canvasManager.initCanvas(ae); ae = null; return this._elem}; + H.jqplot.GenericCanvas.prototype.setContext = function(){this._ctx = this._elem.get(0).getContext("2d"); + return this._ctx}; H.jqplot.GenericCanvas.prototype.resetCanvas = function(){if (this._elem){ +if (H.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== r){window.G_vmlCanvasManager.uninitElement(this._elem.get(0))} +this._elem.emptyForce()}this._ctx = null}; + H.jqplot.HooksManager = function(){this.hooks = []; this.args = []}; + H.jqplot.HooksManager.prototype.addOnce = function(ae, ac){ac = ac || []; + var af = false; for (var ad = 0, ab = this.hooks.length; ad < ab; ad++){ + if (this.hooks[ad] == ae){af = true}}if (!af){this.hooks.push(ae); + this.args.push(ac)}}; H.jqplot.HooksManager.prototype.add = function(ac, ab){ab = ab || []; + this.hooks.push(ac); this.args.push(ab)}; H.jqplot.EventListenerManager = function(){this.hooks = []}; + H.jqplot.EventListenerManager.prototype.addOnce = function(af, ae){var ag = false, ad, ac; + for (var ac = 0, ab = this.hooks.length; ac < ab; ac++){ad = this.hooks[ac]; + if (ad[0] == af && ad[1] == ae){ag = true}}if (!ag){this.hooks.push([af, ae])}}; + H.jqplot.EventListenerManager.prototype.add = function(ac, ab){this.hooks.push([ac, ab])}; + var Q = ["yMidAxis", "xaxis", "yaxis", "x2axis", "y2axis", "y3axis", "y4axis", "y5axis", "y6axis", "y7axis", "y8axis", "y9axis"]; + function N(){this.animate = false; + this.animateReplot = false; + this.axes = {xaxis:new s("xaxis"), yaxis:new s("yaxis"), x2axis:new s("x2axis"), + y2axis:new s("y2axis"), y3axis:new s("y3axis"), y4axis:new s("y4axis"), + y5axis:new s("y5axis"), y6axis:new s("y6axis"), y7axis:new s("y7axis"), + y8axis:new s("y8axis"), y9axis:new s("y9axis"), yMidAxis:new s("yMidAxis")}; + this.baseCanvas = new H.jqplot.GenericCanvas(); this.captureRightClick = false; + this.data = []; + this.dataRenderer; this.dataRendererOptions; + this.defaults = {axesDefaults:{}, axes:{xaxis:{}, yaxis:{}, x2axis:{}, y2axis:{}, y3axis:{}, y4axis:{}, + y5axis:{}, y6axis:{}, y7axis:{}, y8axis:{}, + y9axis:{}, yMidAxis:{}}, seriesDefaults:{}, series:[]}; + this.defaultAxisStart = 1; this.drawIfHidden = false; this.eventCanvas = new H.jqplot.GenericCanvas(); + this.fillBetween = {series1:null, series2:null, color:null, baseSeries:0, fill:true}; this.fontFamily; + this.fontSize; this.grid = new I(); this.legend = new n(); + this.negativeSeriesColors = H.jqplot.config.defaultNegativeColors; + this.noDataIndicator = {show:false, indicator:"Loading Data...", axes:{xaxis:{min:0, max:10, tickInterval:2, show:true}, + yaxis:{min:0, max:12, tickInterval:3, show:true}}}; + this.options = {}; this.previousSeriesStack = []; this.plugins = {}; this.series = []; + this.seriesStack = []; this.seriesColors = H.jqplot.config.defaultColors; this.sortData = true; + this.stackSeries = false; this.syncXTicks = true; this.syncYTicks = true; this.target = null; this.targetId = null; + this.textColor; this.title = new u(); this._drawCount = 0; this._sumy = 0; this._sumx = 0; this._stackData = []; this._plotData = []; + this._width = null; this._height = null; this._plotDimensions = {height:null, width:null}; + this._gridPadding = {top:null, right:null, bottom:null, left:null}; + this._defaultGridPadding = {top:10, right:10, bottom:23, left:10}; + this._addDomReference = H.jqplot.config.addDomReference; this.preInitHooks = new H.jqplot.HooksManager(); + this.postInitHooks = new H.jqplot.HooksManager(); this.preParseOptionsHooks = new H.jqplot.HooksManager(); + this.postParseOptionsHooks = new H.jqplot.HooksManager(); this.preDrawHooks = new H.jqplot.HooksManager(); + this.postDrawHooks = new H.jqplot.HooksManager(); this.preDrawSeriesHooks = new H.jqplot.HooksManager(); + this.postDrawSeriesHooks = new H.jqplot.HooksManager(); this.preDrawLegendHooks = new H.jqplot.HooksManager(); + this.addLegendRowHooks = new H.jqplot.HooksManager(); this.preSeriesInitHooks = new H.jqplot.HooksManager(); + this.postSeriesInitHooks = new H.jqplot.HooksManager(); this.preParseSeriesOptionsHooks = new H.jqplot.HooksManager(); + this.postParseSeriesOptionsHooks = new H.jqplot.HooksManager(); this.eventListenerHooks = new H.jqplot.EventListenerManager(); + this.preDrawSeriesShadowHooks = new H.jqplot.HooksManager(); this.postDrawSeriesShadowHooks = new H.jqplot.HooksManager(); + this.colorGenerator = new H.jqplot.ColorGenerator(); this.negativeColorGenerator = new H.jqplot.ColorGenerator(); + this.canvasManager = new H.jqplot.CanvasManager(); this.themeEngine = new H.jqplot.ThemeEngine(); + var ad = 0; this.init = function(ao, al, aq){aq = aq || {}; + for (var am = 0; am < H.jqplot.preInitHooks.length; am++){ + H.jqplot.preInitHooks[am].call(this, ao, al, aq)} + for (var am = 0; am < this.preInitHooks.hooks.length; am++){ + this.preInitHooks.hooks[am].call(this, ao, al, aq)} + this.targetId = "#" + ao; this.target = H("#" + ao); + if (this._addDomReference){this.target.data("jqplot", this)}this.target.removeClass("jqplot-error"); + if (!this.target.get(0)){throw"No plot target specified"}if (this.target.css("position") == "static"){ + this.target.css("position", "relative")}if (!this.target.hasClass("jqplot-target")){this.target.addClass("jqplot-target")} + if (!this.target.height()){var an; if (aq && aq.height){an = parseInt(aq.height, 10)} + else{if (this.target.attr("data-height")){an = parseInt(this.target.attr("data-height"), 10)} + else{an = parseInt(H.jqplot.config.defaultHeight, 10)}}this._height = an; + this.target.css("height", an + "px")} + else{this._height = an = this.target.height()}if (!this.target.width()){ + var ap; if (aq && aq.width){ap = parseInt(aq.width, 10)} + else{if (this.target.attr("data-width")){ap = parseInt(this.target.attr("data-width"), 10)} + else{ap = parseInt(H.jqplot.config.defaultWidth, 10)}}this._width = ap; + this.target.css("width", ap + "px")} else{this._width = ap = this.target.width()} + for (var am = 0, aj = Q.length; am < aj; am++){this.axes[Q[am]] = new s(Q[am])}this._plotDimensions.height = this._height; + this._plotDimensions.width = this._width; this.grid._plotDimensions = this._plotDimensions; + this.title._plotDimensions = this._plotDimensions; this.baseCanvas._plotDimensions = this._plotDimensions; + this.eventCanvas._plotDimensions = this._plotDimensions; this.legend._plotDimensions = this._plotDimensions; + if (this._height <= 0 || this._width <= 0 || !this._height || !this._width){throw"Canvas dimension not set"} + if (aq.dataRenderer && H.isFunction(aq.dataRenderer)){if (aq.dataRendererOptions){this.dataRendererOptions = aq.dataRendererOptions} + this.dataRenderer = aq.dataRenderer; al = this.dataRenderer(al, this, this.dataRendererOptions)} + if (aq.noDataIndicator && H.isPlainObject(aq.noDataIndicator)){H.extend(true, this.noDataIndicator, aq.noDataIndicator)} + if (al == null || H.isArray(al) == false || al.length == 0 || H.isArray(al[0]) == false || al[0].length == 0){ + if (this.noDataIndicator.show == false){throw"No Data"} else{for (var af in this.noDataIndicator.axes){ + for (var ah in this.noDataIndicator.axes[af]){this.axes[af][ah] = this.noDataIndicator.axes[af][ah]}} + this.postDrawHooks.add(function(){var ax = this.eventCanvas.getHeight(); var au = this.eventCanvas.getWidth(); + var at = H('
'); this.target.append(at); + at.height(ax); at.width(au); at.css("top", this.eventCanvas._offsets.top); at.css("left", this.eventCanvas._offsets.left); + var aw = H('
'); + at.append(aw); aw.html(this.noDataIndicator.indicator); var av = aw.height(); + var ar = aw.width(); aw.height(av); aw.width(ar); + aw.css("top", (ax - av) / 2 + "px")})}}this.data = H.extend(true, [], al); this.parseOptions(aq); + if (this.textColor){this.target.css("color", this.textColor)}if (this.fontFamily){this.target.css("font-family", this.fontFamily)} + if (this.fontSize){this.target.css("font-size", this.fontSize)}this.title.init(); this.legend.init(); + this._sumy = 0; this._sumx = 0; for (var am = 0; am < this.series.length; am++){this.seriesStack.push(am); + this.previousSeriesStack.push(am); this.series[am].shadowCanvas._plotDimensions = this._plotDimensions; + this.series[am].canvas._plotDimensions = this._plotDimensions; + for (var ak = 0; ak < H.jqplot.preSeriesInitHooks.length; ak++){ + H.jqplot.preSeriesInitHooks[ak].call(this.series[am], ao, this.data, this.options.seriesDefaults, this.options.series[am], this)} + for (var ak = 0; ak < this.preSeriesInitHooks.hooks.length; ak++){ + this.preSeriesInitHooks.hooks[ak].call(this.series[am], ao, this.data, this.options.seriesDefaults, this.options.series[am], this)} + this.populatePlotData(this.series[am], am); this.series[am]._plotDimensions = this._plotDimensions; this.series[am].init(am, this.grid.borderWidth, this); for (var ak = 0; ak < H.jqplot.postSeriesInitHooks.length; ak++){H.jqplot.postSeriesInitHooks[ak].call(this.series[am], ao, this.data, this.options.seriesDefaults, this.options.series[am], this)}for (var ak = 0; ak < this.postSeriesInitHooks.hooks.length; ak++){this.postSeriesInitHooks.hooks[ak].call(this.series[am], ao, this.data, this.options.seriesDefaults, this.options.series[am], this)}this._sumy += this.series[am]._sumy; this._sumx += this.series[am]._sumx}var ag, ai; for (var am = 0, aj = Q.length; am < aj; am++){ag = Q[am]; ai = this.axes[ag]; ai._plotDimensions = this._plotDimensions; ai.init(); if (this.axes[ag].borderColor == null){if (ag.charAt(0) !== "x" && ai.useSeriesColor === true && ai.show){ai.borderColor = ai._series[0].color} else{ai.borderColor = this.grid.borderColor}}}if (this.sortData){ab(this.series)}this.grid.init(); this.grid._axes = this.axes; this.legend._series = this.series; for (var am = 0; am < H.jqplot.postInitHooks.length; am++){H.jqplot.postInitHooks[am].call(this, ao, this.data, aq)}for (var am = 0; am < this.postInitHooks.hooks.length; am++){this.postInitHooks.hooks[am].call(this, ao, this.data, aq)}}; this.resetAxesScale = function(ak, ag){var ai = ag || {}; var aj = ak || this.axes; if (aj === true){aj = this.axes}if (H.isArray(aj)){for (var ah = 0; ah < aj.length; ah++){this.axes[aj[ah]].resetScale(ai[aj[ah]])}} else{if (typeof (aj) === "object"){for (var af in aj){this.axes[af].resetScale(ai[af])}}}}; this.reInitialize = function(an, af){var ar = H.extend(true, {}, this.options, af); var ap = this.targetId.substr(1); var al = (an == null)?this.data:an; for (var ao = 0; ao < H.jqplot.preInitHooks.length; ao++){H.jqplot.preInitHooks[ao].call(this, ap, al, ar)}for (var ao = 0; ao < this.preInitHooks.hooks.length; ao++){this.preInitHooks.hooks[ao].call(this, ap, al, ar)}this._height = this.target.height(); this._width = this.target.width(); if (this._height <= 0 || this._width <= 0 || !this._height || !this._width){throw"Target dimension not set"}this._plotDimensions.height = this._height; this._plotDimensions.width = this._width; this.grid._plotDimensions = this._plotDimensions; this.title._plotDimensions = this._plotDimensions; this.baseCanvas._plotDimensions = this._plotDimensions; this.eventCanvas._plotDimensions = this._plotDimensions; this.legend._plotDimensions = this._plotDimensions; var ag, aq, am, ai; for (var ao = 0, ak = Q.length; ao < ak; ao++){ag = Q[ao]; ai = this.axes[ag]; aq = ai._ticks; for (var am = 0, aj = aq.length; am < aj; am++){var ah = aq[am]._elem; if (ah){if (H.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== r){window.G_vmlCanvasManager.uninitElement(ah.get(0))}ah.emptyForce(); ah = null; aq._elem = null}}aq = null; delete ai.ticks; delete ai._ticks; this.axes[ag] = new s(ag); + this.axes[ag]._plotWidth = this._width; this.axes[ag]._plotHeight = this._height} + if (an){if (ar.dataRenderer && H.isFunction(ar.dataRenderer)){ + if (ar.dataRendererOptions){this.dataRendererOptions = ar.dataRendererOptions}this.dataRenderer = ar.dataRenderer; + an = this.dataRenderer(an, this, this.dataRendererOptions)}this.data = H.extend(true, [], an)}if (af){this.parseOptions(ar)}this.title._plotWidth = this._width; + if (this.textColor){this.target.css("color", this.textColor)}if (this.fontFamily){this.target.css("font-family", this.fontFamily)}if (this.fontSize){this.target.css("font-size", this.fontSize)}this.title.init(); this.legend.init(); this._sumy = 0; this._sumx = 0; this.seriesStack = []; this.previousSeriesStack = []; for (var ao = 0, ak = this.series.length; ao < ak; ao++){this.seriesStack.push(ao); this.previousSeriesStack.push(ao); this.series[ao].shadowCanvas._plotDimensions = this._plotDimensions; this.series[ao].canvas._plotDimensions = this._plotDimensions; for (var am = 0; am < H.jqplot.preSeriesInitHooks.length; am++){H.jqplot.preSeriesInitHooks[am].call(this.series[ao], ap, this.data, this.options.seriesDefaults, this.options.series[ao], this)}for (var am = 0; am < this.preSeriesInitHooks.hooks.length; am++){this.preSeriesInitHooks.hooks[am].call(this.series[ao], ap, this.data, this.options.seriesDefaults, this.options.series[ao], this)}this.populatePlotData(this.series[ao], ao); this.series[ao]._plotDimensions = this._plotDimensions; this.series[ao].init(ao, this.grid.borderWidth, this); for (var am = 0; am < H.jqplot.postSeriesInitHooks.length; am++){H.jqplot.postSeriesInitHooks[am].call(this.series[ao], ap, this.data, this.options.seriesDefaults, this.options.series[ao], this)}for (var am = 0; am < this.postSeriesInitHooks.hooks.length; am++){this.postSeriesInitHooks.hooks[am].call(this.series[ao], ap, this.data, this.options.seriesDefaults, this.options.series[ao], this)}this._sumy += this.series[ao]._sumy; this._sumx += this.series[ao]._sumx}for (var ao = 0, ak = Q.length; ao < ak; ao++){ag = Q[ao]; ai = this.axes[ag]; ai._plotDimensions = this._plotDimensions; ai.init(); if (ai.borderColor == null){if (ag.charAt(0) !== "x" && ai.useSeriesColor === true && ai.show){ai.borderColor = ai._series[0].color} else{ai.borderColor = this.grid.borderColor}}}if (this.sortData){ab(this.series)}this.grid.init(); this.grid._axes = this.axes; this.legend._series = this.series; for (var ao = 0, ak = H.jqplot.postInitHooks.length; ao < ak; ao++){H.jqplot.postInitHooks[ao].call(this, ap, this.data, ar)}for (var ao = 0, ak = this.postInitHooks.hooks.length; ao < ak; ao++){this.postInitHooks.hooks[ao].call(this, ap, this.data, ar)}}; this.quickInit = function(){this._height = this.target.height(); this._width = this.target.width(); if (this._height <= 0 || this._width <= 0 || !this._height || !this._width){throw"Target dimension not set"}this._plotDimensions.height = this._height; this._plotDimensions.width = this._width; this.grid._plotDimensions = this._plotDimensions; this.title._plotDimensions = this._plotDimensions; this.baseCanvas._plotDimensions = this._plotDimensions; this.eventCanvas._plotDimensions = this._plotDimensions; this.legend._plotDimensions = this._plotDimensions; for (var ak in this.axes){this.axes[ak]._plotWidth = this._width; this.axes[ak]._plotHeight = this._height}this.title._plotWidth = this._width; if (this.textColor){this.target.css("color", this.textColor)}if (this.fontFamily){this.target.css("font-family", this.fontFamily)}if (this.fontSize){this.target.css("font-size", this.fontSize)}this._sumy = 0; this._sumx = 0; for (var ai = 0; ai < this.series.length; ai++){this.populatePlotData(this.series[ai], ai); if (this.series[ai]._type === "line" && this.series[ai].renderer.bands.show){this.series[ai].renderer.initBands.call(this.series[ai], this.series[ai].renderer.options, this)}this.series[ai]._plotDimensions = this._plotDimensions; this.series[ai].canvas._plotDimensions = this._plotDimensions; this._sumy += this.series[ai]._sumy; this._sumx += this.series[ai]._sumx}var ag; for (var af = 0; af < 12; af++){ag = Q[af]; var ah = this.axes[ag]._ticks; for (var ai = 0; ai < ah.length; ai++){var aj = ah[ai]._elem; if (aj){if (H.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== r){window.G_vmlCanvasManager.uninitElement(aj.get(0))}aj.emptyForce(); aj = null; ah._elem = null}}ah = null; this.axes[ag]._plotDimensions = this._plotDimensions; this.axes[ag]._ticks = []}if (this.sortData){ab(this.series)}this.grid._axes = this.axes; this.legend._series = this.series}; function ab(aj){var an, ao, ap, af, am; for (var ak = 0; ak < aj.length; ak++){var ag; var al = [aj[ak].data, aj[ak]._stackData, aj[ak]._plotData, aj[ak]._prevPlotData]; for (var ah = 0; ah < 4; ah++){ag = true; an = al[ah]; if (aj[ak]._stackAxis == "x"){for (var ai = 0; ai < an.length; ai++){if (typeof (an[ai][1]) != "number"){ag = false; break}}if (ag){an.sort(function(ar, aq){return ar[1] - aq[1]})}} else{for (var ai = 0; ai < an.length; ai++){if (typeof (an[ai][0]) != "number"){ag = false; break}}if (ag){an.sort(function(ar, aq){return ar[0] - aq[0]})}}}}}this.populatePlotData = function(aj, ak){this._plotData = []; this._stackData = []; aj._stackData = []; aj._plotData = []; var an = {x:[], y:[]}; if (this.stackSeries && !aj.disableStack){aj._stack = true; var al = aj._stackAxis == "x"?0:1; var am = al?0:1; var ao = H.extend(true, [], aj.data); var ap = H.extend(true, [], aj.data); for (var ah = 0; ah < ak; ah++){var af = this.series[ah].data; for (var ag = 0; ag < af.length; ag++){ao[ag][0] += af[ag][0]; ao[ag][1] += af[ag][1]; ap[ag][al] += af[ag][al]}}for (var ai = 0; ai < ap.length; ai++){an.x.push(ap[ai][0]); an.y.push(ap[ai][1])}this._plotData.push(ap); this._stackData.push(ao); aj._stackData = ao; aj._plotData = ap; aj._plotValues = an} else{for (var ai = 0; ai < aj.data.length; ai++){an.x.push(aj.data[ai][0]); an.y.push(aj.data[ai][1])}this._stackData.push(aj.data); this.series[ak]._stackData = aj.data; this._plotData.push(aj.data); aj._plotData = aj.data; aj._plotValues = an}if (ak > 0){aj._prevPlotData = this.series[ak - 1]._plotData}aj._sumy = 0; aj._sumx = 0; for (ai = aj.data.length - 1; ai > - 1; ai--){aj._sumy += aj.data[ai][1]; aj._sumx += aj.data[ai][0]}}; this.getNextSeriesColor = (function(ag){var af = 0; var ah = ag.seriesColors; return function(){if (af < ah.length){return ah[af++]} else{af = 0; return ah[af++]}}})(this); this.parseOptions = function(aq){for (var al = 0; al < this.preParseOptionsHooks.hooks.length; al++){this.preParseOptionsHooks.hooks[al].call(this, aq)}for (var al = 0; al < H.jqplot.preParseOptionsHooks.length; al++){H.jqplot.preParseOptionsHooks[al].call(this, aq)}this.options = H.extend(true, {}, this.defaults, aq); var af = this.options; this.animate = af.animate; this.animateReplot = af.animateReplot; this.stackSeries = af.stackSeries; if (H.isPlainObject(af.fillBetween)){var ap = ["series1", "series2", "color", "baseSeries", "fill"], am; for (var al = 0, aj = ap.length; al < aj; al++){am = ap[al]; if (af.fillBetween[am] != null){this.fillBetween[am] = af.fillBetween[am]}}}if (af.seriesColors){this.seriesColors = af.seriesColors}if (af.negativeSeriesColors){this.negativeSeriesColors = af.negativeSeriesColors}if (af.captureRightClick){this.captureRightClick = af.captureRightClick}this.defaultAxisStart = (aq && aq.defaultAxisStart != null)?aq.defaultAxisStart:this.defaultAxisStart; this.colorGenerator.setColors(this.seriesColors); this.negativeColorGenerator.setColors(this.negativeSeriesColors); H.extend(true, this._gridPadding, af.gridPadding); this.sortData = (af.sortData != null)?af.sortData:this.sortData; for (var al = 0; al < 12; al++){var ag = Q[al]; var ai = this.axes[ag]; ai._options = H.extend(true, {}, af.axesDefaults, af.axes[ag]); H.extend(true, ai, af.axesDefaults, af.axes[ag]); ai._plotWidth = this._width; ai._plotHeight = this._height}var ao = function(av, at, aw){var ar = []; var au; at = at || "vertical"; if (!H.isArray(av[0])){for (au = 0; au < av.length; au++){if (at == "vertical"){ar.push([aw + au, av[au]])} else{ar.push([av[au], aw + au])}}} else{H.extend(true, ar, av)}return ar}; var an = 0; this.series = []; for (var al = 0; al < this.data.length; al++){var ap = new O(); for (var ak = 0; ak < H.jqplot.preParseSeriesOptionsHooks.length; ak++){H.jqplot.preParseSeriesOptionsHooks[ak].call(ap, this.options.seriesDefaults, this.options.series[al])}for (var ak = 0; ak < this.preParseSeriesOptionsHooks.hooks.length; ak++){this.preParseSeriesOptionsHooks.hooks[ak].call(ap, this.options.seriesDefaults, this.options.series[al])}H.extend(true, ap, {seriesColors:this.seriesColors, negativeSeriesColors:this.negativeSeriesColors}, this.options.seriesDefaults, this.options.series[al], {rendererOptions:{animation:{show:this.animate}}}); var ah = "vertical"; if (ap.renderer === H.jqplot.BarRenderer && ap.rendererOptions && ap.rendererOptions.barDirection == "horizontal" && ap.transposeData === true){ah = "horizontal"}ap.data = ao(this.data[al], ah, this.defaultAxisStart); switch (ap.xaxis){case"xaxis":ap._xaxis = this.axes.xaxis; break; case"x2axis":ap._xaxis = this.axes.x2axis; break; default:break}ap._yaxis = this.axes[ap.yaxis]; ap._xaxis._series.push(ap); ap._yaxis._series.push(ap); if (ap.show){ap._xaxis.show = true; ap._yaxis.show = true} else{if (ap._xaxis.scaleToHiddenSeries){ap._xaxis.show = true}if (ap._yaxis.scaleToHiddenSeries){ap._yaxis.show = true}}if (!ap.label){ap.label = "Series " + (al + 1).toString()}this.series.push(ap); for (var ak = 0; ak < H.jqplot.postParseSeriesOptionsHooks.length; ak++){H.jqplot.postParseSeriesOptionsHooks[ak].call(this.series[al], this.options.seriesDefaults, this.options.series[al])}for (var ak = 0; ak < this.postParseSeriesOptionsHooks.hooks.length; ak++){this.postParseSeriesOptionsHooks.hooks[ak].call(this.series[al], this.options.seriesDefaults, this.options.series[al])}}H.extend(true, this.grid, this.options.grid); for (var al = 0, aj = Q.length; al < aj; al++){var ag = Q[al]; var ai = this.axes[ag]; if (ai.borderWidth == null){ai.borderWidth = this.grid.borderWidth}}if (typeof this.options.title == "string"){this.title.text = this.options.title} else{if (typeof this.options.title == "object"){H.extend(true, this.title, this.options.title)}}this.title._plotWidth = this._width; this.legend.setOptions(this.options.legend); for (var al = 0; al < H.jqplot.postParseOptionsHooks.length; al++){H.jqplot.postParseOptionsHooks[al].call(this, aq)}for (var al = 0; al < this.postParseOptionsHooks.hooks.length; al++){this.postParseOptionsHooks.hooks[al].call(this, aq)}}; this.destroy = function(){this.canvasManager.freeAllCanvases(); if (this.eventCanvas && this.eventCanvas._elem){this.eventCanvas._elem.unbind()}this.target.empty(); this.target[0].innerHTML = ""}; this.replot = function(ag){var ah = ag || {}; var aj = ah.data || null; var af = (ah.clear === false)?false:true; var ai = ah.resetAxes || false; delete ah.data; delete ah.clear; delete ah.resetAxes; this.target.trigger("jqplotPreReplot"); if (af){this.destroy()}if (aj || !H.isEmptyObject(ah)){this.reInitialize(aj, ah)} else{this.quickInit()}if (ai){this.resetAxesScale(ai, ah.axes)}this.draw(); this.target.trigger("jqplotPostReplot")}; this.redraw = function(af){af = (af != null)?af:true; this.target.trigger("jqplotPreRedraw"); if (af){this.canvasManager.freeAllCanvases(); this.eventCanvas._elem.unbind(); this.target.empty()}for (var ah in this.axes){this.axes[ah]._ticks = []}for (var ag = 0; ag < this.series.length; ag++){this.populatePlotData(this.series[ag], ag)}this._sumy = 0; this._sumx = 0; for (ag = 0; ag < this.series.length; ag++){this._sumy += this.series[ag]._sumy; this._sumx += this.series[ag]._sumx}this.draw(); this.target.trigger("jqplotPostRedraw")}; this.draw = function(){if (this.drawIfHidden || this.target.is(":visible")){this.target.trigger("jqplotPreDraw"); var aB, az, ay, ai; for (aB = 0, ay = H.jqplot.preDrawHooks.length; aB < ay; aB++){H.jqplot.preDrawHooks[aB].call(this)}for (aB = 0, ay = this.preDrawHooks.length; aB < ay; aB++){this.preDrawHooks.hooks[aB].apply(this, this.preDrawSeriesHooks.args[aB])}this.target.append(this.baseCanvas.createElement({left:0, right:0, top:0, bottom:0}, "jqplot-base-canvas", null, this)); this.baseCanvas.setContext(); this.target.append(this.title.draw()); this.title.pack({top:0, left:0}); var aF = this.legend.draw({}, this); var af = {top:0, left:0, bottom:0, right:0}; if (this.legend.placement == "outsideGrid"){this.target.append(aF); switch (this.legend.location){case"n":af.top += this.legend.getHeight(); break; case"s":af.bottom += this.legend.getHeight(); break; case"ne":case"e":case"se":af.right += this.legend.getWidth(); break; case"nw":case"w":case"sw":af.left += this.legend.getWidth(); break; default:af.right += this.legend.getWidth(); break}aF = aF.detach()}var al = this.axes; var aG; for (aB = 0; aB < 12; aB++){aG = Q[aB]; this.target.append(al[aG].draw(this.baseCanvas._ctx, this)); al[aG].set()}if (al.yaxis.show){af.left += al.yaxis.getWidth()}var aA = ["y2axis", "y3axis", "y4axis", "y5axis", "y6axis", "y7axis", "y8axis", "y9axis"]; var ar = [0, 0, 0, 0, 0, 0, 0, 0]; var av = 0; var au; for (au = 0; au < 8; au++){if (al[aA[au]].show){av += al[aA[au]].getWidth(); ar[au] = av}}af.right += av; if (al.x2axis.show){af.top += al.x2axis.getHeight()}if (this.title.show){af.top += this.title.getHeight()}if (al.xaxis.show){af.bottom += al.xaxis.getHeight()}if (this.options.gridDimensions && H.isPlainObject(this.options.gridDimensions)){var am = parseInt(this.options.gridDimensions.width, 10) || 0; var aC = parseInt(this.options.gridDimensions.height, 10) || 0; var ah = (this._width - af.left - af.right - am) / 2; var aE = (this._height - af.top - af.bottom - aC) / 2; if (aE >= 0 && ah >= 0){af.top += aE; af.bottom += aE; af.left += ah; af.right += ah}}var ag = ["top", "bottom", "left", "right"]; for (var au in ag){if (this._gridPadding[ag[au]] == null && af[ag[au]] > 0){this._gridPadding[ag[au]] = af[ag[au]]} else{if (this._gridPadding[ag[au]] == null){this._gridPadding[ag[au]] = this._defaultGridPadding[ag[au]]}}}var at = this._gridPadding; if (this.legend.placement === "outsideGrid"){at = {top:this.title.getHeight(), left:0, right:0, bottom:0}; if (this.legend.location === "s"){at.left = this._gridPadding.left; at.right = this._gridPadding.right}}al.xaxis.pack({position:"absolute", bottom:this._gridPadding.bottom - al.xaxis.getHeight(), left:0, width:this._width}, {min:this._gridPadding.left, max:this._width - this._gridPadding.right}); + al.yaxis.pack({position:"absolute", top:0, left:this._gridPadding.left - al.yaxis.getWidth(), height:this._height}, {min:this._height - this._gridPadding.bottom, max:this._gridPadding.top}); al.x2axis.pack({position:"absolute", top:this._gridPadding.top - al.x2axis.getHeight(), left:0, width:this._width}, {min:this._gridPadding.left, max:this._width - this._gridPadding.right}); for (aB = 8; aB > 0; aB--){al[aA[aB - 1]].pack({position:"absolute", top:0, right:this._gridPadding.right - ar[aB - 1]}, {min:this._height - this._gridPadding.bottom, max:this._gridPadding.top})}var an = (this._width - this._gridPadding.left - this._gridPadding.right) / 2 + this._gridPadding.left - al.yMidAxis.getWidth() / 2; al.yMidAxis.pack({position:"absolute", top:0, left:an, zIndex:9, textAlign:"center"}, {min:this._height - this._gridPadding.bottom, max:this._gridPadding.top}); this.target.append(this.grid.createElement(this._gridPadding, this)); this.grid.draw(); var ak = this.series; var aD = ak.length; for (aB = 0, ay = aD; aB < ay; aB++){az = this.seriesStack[aB]; this.target.append(ak[az].shadowCanvas.createElement(this._gridPadding, "jqplot-series-shadowCanvas", null, this)); ak[az].shadowCanvas.setContext(); ak[az].shadowCanvas._elem.data("seriesIndex", az)}for (aB = 0, ay = aD; aB < ay; aB++){az = this.seriesStack[aB]; this.target.append(ak[az].canvas.createElement(this._gridPadding, "jqplot-series-canvas", null, this)); ak[az].canvas.setContext(); ak[az].canvas._elem.data("seriesIndex", az)}this.target.append(this.eventCanvas.createElement(this._gridPadding, "jqplot-event-canvas", null, this)); this.eventCanvas.setContext(); this.eventCanvas._ctx.fillStyle = "rgba(0,0,0,0)"; this.eventCanvas._ctx.fillRect(0, 0, this.eventCanvas._ctx.canvas.width, this.eventCanvas._ctx.canvas.height); this.bindCustomEvents(); if (this.legend.preDraw){this.eventCanvas._elem.before(aF); this.legend.pack(at); if (this.legend._elem){this.drawSeries({legendInfo:{location:this.legend.location, placement:this.legend.placement, width:this.legend.getWidth(), height:this.legend.getHeight(), xoffset:this.legend.xoffset, yoffset:this.legend.yoffset}})} else{this.drawSeries()}} else{this.drawSeries(); if (aD){H(ak[aD - 1].canvas._elem).after(aF)}this.legend.pack(at)}for (var aB = 0, ay = H.jqplot.eventListenerHooks.length; aB < ay; aB++){this.eventCanvas._elem.bind(H.jqplot.eventListenerHooks[aB][0], {plot:this}, H.jqplot.eventListenerHooks[aB][1])}for (var aB = 0, ay = this.eventListenerHooks.hooks.length; aB < ay; aB++){this.eventCanvas._elem.bind(this.eventListenerHooks.hooks[aB][0], {plot:this}, this.eventListenerHooks.hooks[aB][1])}var aq = this.fillBetween; if (aq.fill && aq.series1 !== aq.series2 && aq.series1 < aD && aq.series2 < aD && ak[aq.series1]._type === "line" && ak[aq.series2]._type === "line"){this.doFillBetweenLines()}for (var aB = 0, ay = H.jqplot.postDrawHooks.length; aB < ay; aB++){H.jqplot.postDrawHooks[aB].call(this)}for (var aB = 0, ay = this.postDrawHooks.hooks.length; aB < ay; aB++){this.postDrawHooks.hooks[aB].apply(this, this.postDrawHooks.args[aB])}if (this.target.is(":visible")){this._drawCount += 1}var ao, ap, aw, aj; for (aB = 0, ay = aD; aB < ay; aB++){ao = ak[aB]; ap = ao.renderer; aw = ".jqplot-point-label.jqplot-series-" + aB; if (ap.animation && ap.animation._supported && ap.animation.show && (this._drawCount < 2 || this.animateReplot)){aj = this.target.find(aw); aj.stop(true, true).hide(); ao.canvas._elem.stop(true, true).hide(); ao.shadowCanvas._elem.stop(true, true).hide(); ao.canvas._elem.jqplotEffect("blind", {mode:"show", direction:ap.animation.direction}, ap.animation.speed); ao.shadowCanvas._elem.jqplotEffect("blind", {mode:"show", direction:ap.animation.direction}, ap.animation.speed); aj.fadeIn(ap.animation.speed * 0.8)}}aj = null; this.target.trigger("jqplotPostDraw", [this])}}; N.prototype.doFillBetweenLines = function(){var ah = this.fillBetween; var aq = ah.series1; var ao = ah.series2; var ap = (aq < ao)?aq:ao; var an = (ao > aq)?ao:aq; var al = this.series[ap]; var ak = this.series[an]; if (ak.renderer.smooth){var aj = ak.renderer._smoothedData.slice(0).reverse()} else{var aj = ak.gridData.slice(0).reverse()}if (al.renderer.smooth){var am = al.renderer._smoothedData.concat(aj)} else{var am = al.gridData.concat(aj)}var ai = (ah.color !== null)?ah.color:this.series[aq].fillColor; var ar = (ah.baseSeries !== null)?ah.baseSeries:ap; var ag = this.series[ar].renderer.shapeRenderer; var af = {fillStyle:ai, fill:true, closePath:true}; ag.draw(al.shadowCanvas._ctx, am, af)}; this.bindCustomEvents = function(){this.eventCanvas._elem.bind("click", {plot:this}, this.onClick); this.eventCanvas._elem.bind("dblclick", {plot:this}, this.onDblClick); this.eventCanvas._elem.bind("mousedown", {plot:this}, this.onMouseDown); this.eventCanvas._elem.bind("mousemove", {plot:this}, this.onMouseMove); this.eventCanvas._elem.bind("mouseenter", {plot:this}, this.onMouseEnter); this.eventCanvas._elem.bind("mouseleave", {plot:this}, this.onMouseLeave); if (this.captureRightClick){this.eventCanvas._elem.bind("mouseup", {plot:this}, this.onRightClick); this.eventCanvas._elem.get(0).oncontextmenu = function(){return false}} else{this.eventCanvas._elem.bind("mouseup", {plot:this}, this.onMouseUp)}}; function ac(ao){var am = ao.data.plot; var ai = am.eventCanvas._elem.offset(); var al = {x:ao.pageX - ai.left, y:ao.pageY - ai.top}; var aj = {xaxis:null, yaxis:null, x2axis:null, y2axis:null, y3axis:null, y4axis:null, y5axis:null, y6axis:null, y7axis:null, y8axis:null, y9axis:null, yMidAxis:null}; var ak = ["xaxis", "yaxis", "x2axis", "y2axis", "y3axis", "y4axis", "y5axis", "y6axis", "y7axis", "y8axis", "y9axis", "yMidAxis"]; var af = am.axes; var ag, ah; for (ag = 11; ag > 0; ag--){ah = ak[ag - 1]; if (af[ah].show){aj[ah] = af[ah].series_p2u(al[ah.charAt(0)])}}return{offsets:ai, gridPos:al, dataPos:aj}}function ae(af, ag){var ak = ag.series; var aQ, aO, aN, aI, aJ, aD, aC, ap, an, at, au, aE; var aM, aR, aK, al, aB, aG, aP; var ah, aH; for (aN = ag.seriesStack.length - 1; aN >= 0; aN--){aQ = ag.seriesStack[aN]; aI = ak[aQ]; aP = aI._highlightThreshold; switch (aI.renderer.constructor){case H.jqplot.BarRenderer:aD = af.x; aC = af.y; for (aO = 0; aO < aI._barPoints.length; aO++){aB = aI._barPoints[aO]; aK = aI.gridData[aO]; if (aD > aB[0][0] && aD < aB[2][0] && aC > aB[2][1] && aC < aB[0][1]){return{seriesIndex:aI.index, pointIndex:aO, gridData:aK, data:aI.data[aO], points:aI._barPoints[aO]}}}break; case H.jqplot.PyramidRenderer:aD = af.x; aC = af.y; for (aO = 0; aO < aI._barPoints.length; aO++){aB = aI._barPoints[aO]; aK = aI.gridData[aO]; if (aD > aB[0][0] + aP[0][0] && aD < aB[2][0] + aP[2][0] && aC > aB[2][1] && aC < aB[0][1]){return{seriesIndex:aI.index, pointIndex:aO, gridData:aK, data:aI.data[aO], points:aI._barPoints[aO]}}}break; case H.jqplot.DonutRenderer:at = aI.startAngle / 180 * Math.PI; aD = af.x - aI._center[0]; aC = af.y - aI._center[1]; aJ = Math.sqrt(Math.pow(aD, 2) + Math.pow(aC, 2)); if (aD > 0 && - aC >= 0){ap = 2 * Math.PI - Math.atan( - aC / aD)} else{if (aD > 0 && - aC < 0){ap = - Math.atan( - aC / aD)} else{if (aD < 0){ap = Math.PI - Math.atan( - aC / aD)} else{if (aD == 0 && - aC > 0){ap = 3 * Math.PI / 2} else{if (aD == 0 && - aC < 0){ap = Math.PI / 2} else{if (aD == 0 && aC == 0){ap = 0}}}}}}if (at){ap -= at; if (ap < 0){ap += 2 * Math.PI} else{if (ap > 2 * Math.PI){ap -= 2 * Math.PI}}}an = aI.sliceMargin / 180 * Math.PI; if (aJ < aI._radius && aJ > aI._innerRadius){for (aO = 0; aO < aI.gridData.length; aO++){au = (aO > 0)?aI.gridData[aO - 1][1] + an:an; aE = aI.gridData[aO][1]; if (ap > au && ap < aE){return{seriesIndex:aI.index, pointIndex:aO, gridData:aI.gridData[aO], data:aI.data[aO]}}}}break; case H.jqplot.PieRenderer:at = aI.startAngle / 180 * Math.PI; aD = af.x - aI._center[0]; aC = af.y - aI._center[1]; aJ = Math.sqrt(Math.pow(aD, 2) + Math.pow(aC, 2)); if (aD > 0 && - aC >= 0){ap = 2 * Math.PI - Math.atan( - aC / aD)} else{if (aD > 0 && - aC < 0){ap = - Math.atan( - aC / aD)} else{if (aD < 0){ap = Math.PI - Math.atan( - aC / aD)} else{if (aD == 0 && - aC > 0){ap = 3 * Math.PI / 2} else{if (aD == 0 && - aC < 0){ap = Math.PI / 2} else{if (aD == 0 && aC == 0){ap = 0}}}}}}if (at){ap -= at; if (ap < 0){ap += 2 * Math.PI} else{if (ap > 2 * Math.PI){ap -= 2 * Math.PI}}}an = aI.sliceMargin / 180 * Math.PI; if (aJ < aI._radius){for (aO = 0; aO < aI.gridData.length; aO++){au = (aO > 0)?aI.gridData[aO - 1][1] + an:an; aE = aI.gridData[aO][1]; if (ap > au && ap < aE){return{seriesIndex:aI.index, pointIndex:aO, gridData:aI.gridData[aO], data:aI.data[aO]}}}}break; case H.jqplot.BubbleRenderer:aD = af.x; aC = af.y; var az = null; if (aI.show){for (var aO = 0; aO < aI.gridData.length; aO++){aK = aI.gridData[aO]; aR = Math.sqrt((aD - aK[0]) * (aD - aK[0]) + (aC - aK[1]) * (aC - aK[1])); if (aR <= aK[2] && (aR <= aM || aM == null)){aM = aR; az = {seriesIndex:aQ, pointIndex:aO, gridData:aK, data:aI.data[aO]}}}if (az != null){return az}}break; case H.jqplot.FunnelRenderer:aD = af.x; aC = af.y; var aF = aI._vertices, aj = aF[0], ai = aF[aF.length - 1], am, ay, ar; function aL(aU, aW, aV){var aT = (aW[1] - aV[1]) / (aW[0] - aV[0]); var aS = aW[1] - aT * aW[0]; var aX = aU + aW[1]; return[(aX - aS) / aT, aX]}am = aL(aC, aj[0], ai[3]); ay = aL(aC, aj[1], ai[2]); for (aO = 0; aO < aF.length; aO++){ar = aF[aO]; if (aC >= ar[0][1] && aC <= ar[3][1] && aD >= am[0] && aD <= ay[0]){return{seriesIndex:aI.index, pointIndex:aO, gridData:null, data:aI.data[aO]}}}break; case H.jqplot.LineRenderer:aD = af.x; aC = af.y; aJ = aI.renderer; if (aI.show){if ((aI.fill || (aI.renderer.bands.show && aI.renderer.bands.fill)) && (!ag.plugins.highlighter || !ag.plugins.highlighter.show)){var aq = false; if (aD > aI._boundingBox[0][0] && aD < aI._boundingBox[1][0] && aC > aI._boundingBox[1][1] && aC < aI._boundingBox[0][1]){var ax = aI._areaPoints.length; var aA; var aO = ax - 1; for (var aA = 0; aA < ax; aA++){var aw = [aI._areaPoints[aA][0], aI._areaPoints[aA][1]]; var av = [aI._areaPoints[aO][0], aI._areaPoints[aO][1]]; if (aw[1] < aC && av[1] >= aC || av[1] < aC && aw[1] >= aC){if (aw[0] + (aC - aw[1]) / (av[1] - aw[1]) * (av[0] - aw[0]) < aD){aq = !aq}}aO = aA}}if (aq){return{seriesIndex:aQ, pointIndex:null, gridData:aI.gridData, data:aI.data, points:aI._areaPoints}}break} else{aH = aI.markerRenderer.size / 2 + aI.neighborThreshold; ah = (aH > 0)?aH:0; for (var aO = 0; aO < aI.gridData.length; aO++){aK = aI.gridData[aO]; if (aJ.constructor == H.jqplot.OHLCRenderer){if (aJ.candleStick){var ao = aI._yaxis.series_u2p; if (aD >= aK[0] - aJ._bodyWidth / 2 && aD <= aK[0] + aJ._bodyWidth / 2 && aC >= ao(aI.data[aO][2]) && aC <= ao(aI.data[aO][3])){return{seriesIndex:aQ, pointIndex:aO, gridData:aK, data:aI.data[aO]}}} else{if (!aJ.hlc){var ao = aI._yaxis.series_u2p; if (aD >= aK[0] - aJ._tickLength && aD <= aK[0] + aJ._tickLength && aC >= ao(aI.data[aO][2]) && aC <= ao(aI.data[aO][3])){return{seriesIndex:aQ, pointIndex:aO, gridData:aK, data:aI.data[aO]}}} else{var ao = aI._yaxis.series_u2p; if (aD >= aK[0] - aJ._tickLength && aD <= aK[0] + aJ._tickLength && aC >= ao(aI.data[aO][1]) && aC <= ao(aI.data[aO][2])){return{seriesIndex:aQ, pointIndex:aO, gridData:aK, data:aI.data[aO]}}}}} else{if (aK[0] != null && aK[1] != null){aR = Math.sqrt((aD - aK[0]) * (aD - aK[0]) + (aC - aK[1]) * (aC - aK[1])); + if (aR <= ah && (aR <= aM || aM == null)){aM = aR; return{seriesIndex:aQ, pointIndex:aO, gridData:aK, data:aI.data[aO]}}}}}}}break; + default:aD = af.x; aC = af.y; aJ = aI.renderer; + if (aI.show){aH = aI.markerRenderer.size / 2 + aI.neighborThreshold; ah = (aH > 0)?aH:0; + for (var aO = 0; aO < aI.gridData.length; aO++){ + aK = aI.gridData[aO]; if (aJ.constructor == H.jqplot.OHLCRenderer){ + if (aJ.candleStick){var ao = aI._yaxis.series_u2p; if (aD >= aK[0] - aJ._bodyWidth / 2 && aD <= aK[0] + aJ._bodyWidth / 2 && aC >= ao(aI.data[aO][2]) && aC <= ao(aI.data[aO][3])){return{seriesIndex:aQ, pointIndex:aO, gridData:aK, data:aI.data[aO]}}} else{if (!aJ.hlc){var ao = aI._yaxis.series_u2p; if (aD >= aK[0] - aJ._tickLength && aD <= aK[0] + aJ._tickLength && aC >= ao(aI.data[aO][2]) && aC <= ao(aI.data[aO][3])){return{seriesIndex:aQ, pointIndex:aO, gridData:aK, data:aI.data[aO]}}} else{var ao = aI._yaxis.series_u2p; if (aD >= aK[0] - aJ._tickLength && aD <= aK[0] + aJ._tickLength && aC >= ao(aI.data[aO][1]) && aC <= ao(aI.data[aO][2])){return{seriesIndex:aQ, pointIndex:aO, gridData:aK, data:aI.data[aO]}}}}} else{aR = Math.sqrt((aD - aK[0]) * (aD - aK[0]) + (aC - aK[1]) * (aC - aK[1])); if (aR <= ah && (aR <= aM || aM == null)){aM = aR; return{seriesIndex:aQ, pointIndex:aO, gridData:aK, data:aI.data[aO]}}}}}break}}return null}this.onClick = function(ah){var ag = ac(ah); var aj = ah.data.plot; var ai = ae(ag.gridPos, aj); var af = H.Event("jqplotClick"); af.pageX = ah.pageX; af.pageY = ah.pageY; H(this).trigger(af, [ag.gridPos, ag.dataPos, ai, aj])}; this.onDblClick = function(ah){var ag = ac(ah); var aj = ah.data.plot; var ai = ae(ag.gridPos, aj); var af = H.Event("jqplotDblClick"); af.pageX = ah.pageX; af.pageY = ah.pageY; H(this).trigger(af, [ag.gridPos, ag.dataPos, ai, aj])}; this.onMouseDown = function(ah){var ag = ac(ah); var aj = ah.data.plot; var ai = ae(ag.gridPos, aj); var af = H.Event("jqplotMouseDown"); af.pageX = ah.pageX; af.pageY = ah.pageY; H(this).trigger(af, [ag.gridPos, ag.dataPos, ai, aj])}; this.onMouseUp = function(ah){var ag = ac(ah); var af = H.Event("jqplotMouseUp"); af.pageX = ah.pageX; af.pageY = ah.pageY; H(this).trigger(af, [ag.gridPos, ag.dataPos, null, ah.data.plot])}; this.onRightClick = function(ah){var ag = ac(ah); var aj = ah.data.plot; var ai = ae(ag.gridPos, aj); if (aj.captureRightClick){if (ah.which == 3){var af = H.Event("jqplotRightClick"); af.pageX = ah.pageX; af.pageY = ah.pageY; H(this).trigger(af, [ag.gridPos, ag.dataPos, ai, aj])} else{var af = H.Event("jqplotMouseUp"); af.pageX = ah.pageX; af.pageY = ah.pageY; H(this).trigger(af, [ag.gridPos, ag.dataPos, ai, aj])}}}; this.onMouseMove = function(ah){var ag = ac(ah); var aj = ah.data.plot; var ai = ae(ag.gridPos, aj); var af = H.Event("jqplotMouseMove"); af.pageX = ah.pageX; af.pageY = ah.pageY; H(this).trigger(af, [ag.gridPos, ag.dataPos, ai, aj])}; this.onMouseEnter = function(ah){var ag = ac(ah); var ai = ah.data.plot; var af = H.Event("jqplotMouseEnter"); af.pageX = ah.pageX; af.pageY = ah.pageY; af.relatedTarget = ah.relatedTarget; H(this).trigger(af, [ag.gridPos, ag.dataPos, null, ai])}; this.onMouseLeave = function(ah){var ag = ac(ah); var ai = ah.data.plot; var af = H.Event("jqplotMouseLeave"); af.pageX = ah.pageX; af.pageY = ah.pageY; af.relatedTarget = ah.relatedTarget; H(this).trigger(af, [ag.gridPos, ag.dataPos, null, ai])}; this.drawSeries = function(ah, af){var aj, ai, ag; af = (typeof (ah) === "number" && af == null)?ah:af; ah = (typeof (ah) === "object")?ah:{}; if (af != r){ai = this.series[af]; ag = ai.shadowCanvas._ctx; ag.clearRect(0, 0, ag.canvas.width, ag.canvas.height); ai.drawShadow(ag, ah, this); ag = ai.canvas._ctx; ag.clearRect(0, 0, ag.canvas.width, ag.canvas.height); ai.draw(ag, ah, this); if (ai.renderer.constructor == H.jqplot.BezierCurveRenderer){if (af < this.series.length - 1){this.drawSeries(af + 1)}}} else{for (aj = 0; aj < this.series.length; aj++){ai = this.series[aj]; ag = ai.shadowCanvas._ctx; ag.clearRect(0, 0, ag.canvas.width, ag.canvas.height); ai.drawShadow(ag, ah, this); ag = ai.canvas._ctx; ag.clearRect(0, 0, ag.canvas.width, ag.canvas.height); ai.draw(ag, ah, this)}}ah = af = aj = ai = ag = null}; this.moveSeriesToFront = function(ag){ag = parseInt(ag, 10); var aj = H.inArray(ag, this.seriesStack); if (aj == - 1){return}if (aj == this.seriesStack.length - 1){this.previousSeriesStack = this.seriesStack.slice(0); return}var af = this.seriesStack[this.seriesStack.length - 1]; var ai = this.series[ag].canvas._elem.detach(); var ah = this.series[ag].shadowCanvas._elem.detach(); this.series[af].shadowCanvas._elem.after(ah); this.series[af].canvas._elem.after(ai); this.previousSeriesStack = this.seriesStack.slice(0); this.seriesStack.splice(aj, 1); this.seriesStack.push(ag)}; this.moveSeriesToBack = function(ag){ag = parseInt(ag, 10); var aj = H.inArray(ag, this.seriesStack); if (aj == 0 || aj == - 1){return}var af = this.seriesStack[0]; var ai = this.series[ag].canvas._elem.detach(); var ah = this.series[ag].shadowCanvas._elem.detach(); this.series[af].shadowCanvas._elem.before(ah); this.series[af].canvas._elem.before(ai); this.previousSeriesStack = this.seriesStack.slice(0); this.seriesStack.splice(aj, 1); this.seriesStack.unshift(ag)}; this.restorePreviousSeriesOrder = function(){var al, ak, aj, ai, ah, af, ag; if (this.seriesStack == this.previousSeriesStack){return}for (al = 1; al < this.previousSeriesStack.length; al++){af = this.previousSeriesStack[al]; ag = this.previousSeriesStack[al - 1]; aj = this.series[af].canvas._elem.detach(); ai = this.series[af].shadowCanvas._elem.detach(); this.series[ag].shadowCanvas._elem.after(ai); this.series[ag].canvas._elem.after(aj)}ah = this.seriesStack.slice(0); this.seriesStack = this.previousSeriesStack.slice(0); this.previousSeriesStack = ah}; this.restoreOriginalSeriesOrder = function(){var aj, ai, af = [], ah, ag; for (aj = 0; aj < this.series.length; aj++){af.push(aj)}if (this.seriesStack == af){return}this.previousSeriesStack = this.seriesStack.slice(0); this.seriesStack = af; for (aj = 1; aj < this.seriesStack.length; aj++){ah = this.series[aj].canvas._elem.detach(); ag = this.series[aj].shadowCanvas._elem.detach(); this.series[aj - 1].shadowCanvas._elem.after(ag); this.series[aj - 1].canvas._elem.after(ah)}}; this.activateTheme = function(af){this.themeEngine.activate(this, af)}}H.jqplot.computeHighlightColors = function(ac){var ae; if (H.isArray(ac)){ae = []; for (var ag = 0; ag < ac.length; ag++){var af = H.jqplot.getColorComponents(ac[ag]); var ab = [af[0], af[1], af[2]]; var ah = ab[0] + ab[1] + ab[2]; for (var ad = 0; ad < 3; ad++){ab[ad] = (ah > 660)?ab[ad] * 0.85:0.73 * ab[ad] + 90; ab[ad] = parseInt(ab[ad], 10); (ab[ad] > 255)?255:ab[ad]}ab[3] = 0.3 + 0.35 * af[3]; ae.push("rgba(" + ab[0] + "," + ab[1] + "," + ab[2] + "," + ab[3] + ")")}} else{var af = H.jqplot.getColorComponents(ac); var ab = [af[0], af[1], af[2]]; var ah = ab[0] + ab[1] + ab[2]; for (var ad = 0; ad < 3; ad++){ab[ad] = (ah > 660)?ab[ad] * 0.85:0.73 * ab[ad] + 90; ab[ad] = parseInt(ab[ad], 10); (ab[ad] > 255)?255:ab[ad]}ab[3] = 0.3 + 0.35 * af[3]; ae = "rgba(" + ab[0] + "," + ab[1] + "," + ab[2] + "," + ab[3] + ")"}return ae}; H.jqplot.ColorGenerator = function(ac){ac = ac || H.jqplot.config.defaultColors; var ab = 0; this.next = function(){if (ab < ac.length){return ac[ab++]} else{ab = 0; return ac[ab++]}}; this.previous = function(){if (ab > 0){return ac[ab--]} else{ab = ac.length - 1; return ac[ab]}}; this.get = function(ae){var ad = ae - ac.length * Math.floor(ae / ac.length); return ac[ad]}; this.setColors = function(ad){ac = ad}; this.reset = function(){ab = 0}; this.getIndex = function(){return ab}; this.setIndex = function(ad){ab = ad}}; H.jqplot.hex2rgb = function(ad, ab){ad = ad.replace("#", ""); if (ad.length == 3){ad = ad.charAt(0) + ad.charAt(0) + ad.charAt(1) + ad.charAt(1) + ad.charAt(2) + ad.charAt(2)}var ac; ac = "rgba(" + parseInt(ad.slice(0, 2), 16) + ", " + parseInt(ad.slice(2, 4), 16) + ", " + parseInt(ad.slice(4, 6), 16); if (ab){ac += ", " + ab}ac += ")"; return ac}; H.jqplot.rgb2hex = function(ag){var ad = /rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *(?:, *[0-9.]*)?\)/; var ab = ag.match(ad); var af = "#"; for (var ae = 1; ae < 4; ae++){var ac; + if (ab[ae].search(/%/) != - 1){ac = parseInt(255 * ab[ae] / 100, 10).toString(16); + if (ac.length == 1){ac = "0" + ac}} else{ac = parseInt(ab[ae], 10).toString(16); if (ac.length == 1){ac = "0" + ac}}af += ac}return af}; + H.jqplot.normalize2rgb = function(ac, ab){if (ac.search(/^ *rgba?\(/) != - 1){return ac} + else{if (ac.search(/^ *#?[0-9a-fA-F]?[0-9a-fA-F]/) != - 1){return H.jqplot.hex2rgb(ac, ab)} else{throw"invalid color spec"}}}; + H.jqplot.getColorComponents = function(ag){ag = H.jqplot.colorKeywordMap[ag] || ag; var ae = H.jqplot.normalize2rgb(ag); + var ad = /rgba?\( *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *, *([0-9]{1,3}\.?[0-9]*%?) *,? *([0-9.]* *)?\)/; + var ab = ae.match(ad); var ac = []; for (var af = 1; af < 4; af++){if (ab[af].search(/%/) != - 1){ac[af - 1] = parseInt(255 * ab[af] / 100, 10)} + else{ac[af - 1] = parseInt(ab[af], 10)}}ac[3] = parseFloat(ab[4])?parseFloat(ab[4]):1; + return ac}; H.jqplot.colorKeywordMap = {aliceblue:"rgb(240, 248, 255)", antiquewhite:"rgb(250, 235, 215)", aqua:"rgb( 0, 255, 255)", aquamarine:"rgb(127, 255, 212)", azure:"rgb(240, 255, 255)", beige:"rgb(245, 245, 220)", bisque:"rgb(255, 228, 196)", black:"rgb( 0, 0, 0)", blanchedalmond:"rgb(255, 235, 205)", blue:"rgb( 0, 0, 255)", blueviolet:"rgb(138, 43, 226)", brown:"rgb(165, 42, 42)", burlywood:"rgb(222, 184, 135)", cadetblue:"rgb( 95, 158, 160)", chartreuse:"rgb(127, 255, 0)", chocolate:"rgb(210, 105, 30)", coral:"rgb(255, 127, 80)", cornflowerblue:"rgb(100, 149, 237)", cornsilk:"rgb(255, 248, 220)", crimson:"rgb(220, 20, 60)", cyan:"rgb( 0, 255, 255)", darkblue:"rgb( 0, 0, 139)", darkcyan:"rgb( 0, 139, 139)", darkgoldenrod:"rgb(184, 134, 11)", darkgray:"rgb(169, 169, 169)", darkgreen:"rgb( 0, 100, 0)", darkgrey:"rgb(169, 169, 169)", darkkhaki:"rgb(189, 183, 107)", darkmagenta:"rgb(139, 0, 139)", darkolivegreen:"rgb( 85, 107, 47)", darkorange:"rgb(255, 140, 0)", darkorchid:"rgb(153, 50, 204)", darkred:"rgb(139, 0, 0)", darksalmon:"rgb(233, 150, 122)", darkseagreen:"rgb(143, 188, 143)", darkslateblue:"rgb( 72, 61, 139)", darkslategray:"rgb( 47, 79, 79)", darkslategrey:"rgb( 47, 79, 79)", darkturquoise:"rgb( 0, 206, 209)", darkviolet:"rgb(148, 0, 211)", deeppink:"rgb(255, 20, 147)", deepskyblue:"rgb( 0, 191, 255)", dimgray:"rgb(105, 105, 105)", dimgrey:"rgb(105, 105, 105)", dodgerblue:"rgb( 30, 144, 255)", firebrick:"rgb(178, 34, 34)", floralwhite:"rgb(255, 250, 240)", forestgreen:"rgb( 34, 139, 34)", fuchsia:"rgb(255, 0, 255)", gainsboro:"rgb(220, 220, 220)", ghostwhite:"rgb(248, 248, 255)", gold:"rgb(255, 215, 0)", goldenrod:"rgb(218, 165, 32)", gray:"rgb(128, 128, 128)", grey:"rgb(128, 128, 128)", green:"rgb( 0, 128, 0)", greenyellow:"rgb(173, 255, 47)", honeydew:"rgb(240, 255, 240)", hotpink:"rgb(255, 105, 180)", indianred:"rgb(205, 92, 92)", indigo:"rgb( 75, 0, 130)", ivory:"rgb(255, 255, 240)", khaki:"rgb(240, 230, 140)", lavender:"rgb(230, 230, 250)", lavenderblush:"rgb(255, 240, 245)", lawngreen:"rgb(124, 252, 0)", lemonchiffon:"rgb(255, 250, 205)", lightblue:"rgb(173, 216, 230)", lightcoral:"rgb(240, 128, 128)", lightcyan:"rgb(224, 255, 255)", lightgoldenrodyellow:"rgb(250, 250, 210)", lightgray:"rgb(211, 211, 211)", lightgreen:"rgb(144, 238, 144)", lightgrey:"rgb(211, 211, 211)", lightpink:"rgb(255, 182, 193)", lightsalmon:"rgb(255, 160, 122)", lightseagreen:"rgb( 32, 178, 170)", lightskyblue:"rgb(135, 206, 250)", lightslategray:"rgb(119, 136, 153)", lightslategrey:"rgb(119, 136, 153)", lightsteelblue:"rgb(176, 196, 222)", lightyellow:"rgb(255, 255, 224)", lime:"rgb( 0, 255, 0)", limegreen:"rgb( 50, 205, 50)", linen:"rgb(250, 240, 230)", magenta:"rgb(255, 0, 255)", maroon:"rgb(128, 0, 0)", mediumaquamarine:"rgb(102, 205, 170)", mediumblue:"rgb( 0, 0, 205)", mediumorchid:"rgb(186, 85, 211)", mediumpurple:"rgb(147, 112, 219)", mediumseagreen:"rgb( 60, 179, 113)", mediumslateblue:"rgb(123, 104, 238)", mediumspringgreen:"rgb( 0, 250, 154)", mediumturquoise:"rgb( 72, 209, 204)", mediumvioletred:"rgb(199, 21, 133)", midnightblue:"rgb( 25, 25, 112)", mintcream:"rgb(245, 255, 250)", mistyrose:"rgb(255, 228, 225)", moccasin:"rgb(255, 228, 181)", navajowhite:"rgb(255, 222, 173)", navy:"rgb( 0, 0, 128)", oldlace:"rgb(253, 245, 230)", olive:"rgb(128, 128, 0)", olivedrab:"rgb(107, 142, 35)", orange:"rgb(255, 165, 0)", orangered:"rgb(255, 69, 0)", orchid:"rgb(218, 112, 214)", palegoldenrod:"rgb(238, 232, 170)", palegreen:"rgb(152, 251, 152)", paleturquoise:"rgb(175, 238, 238)", palevioletred:"rgb(219, 112, 147)", papayawhip:"rgb(255, 239, 213)", peachpuff:"rgb(255, 218, 185)", peru:"rgb(205, 133, 63)", pink:"rgb(255, 192, 203)", plum:"rgb(221, 160, 221)", powderblue:"rgb(176, 224, 230)", purple:"rgb(128, 0, 128)", red:"rgb(255, 0, 0)", rosybrown:"rgb(188, 143, 143)", royalblue:"rgb( 65, 105, 225)", saddlebrown:"rgb(139, 69, 19)", salmon:"rgb(250, 128, 114)", sandybrown:"rgb(244, 164, 96)", seagreen:"rgb( 46, 139, 87)", seashell:"rgb(255, 245, 238)", sienna:"rgb(160, 82, 45)", silver:"rgb(192, 192, 192)", skyblue:"rgb(135, 206, 235)", slateblue:"rgb(106, 90, 205)", slategray:"rgb(112, 128, 144)", slategrey:"rgb(112, 128, 144)", snow:"rgb(255, 250, 250)", springgreen:"rgb( 0, 255, 127)", steelblue:"rgb( 70, 130, 180)", tan:"rgb(210, 180, 140)", teal:"rgb( 0, 128, 128)", thistle:"rgb(216, 191, 216)", tomato:"rgb(255, 99, 71)", turquoise:"rgb( 64, 224, 208)", violet:"rgb(238, 130, 238)", wheat:"rgb(245, 222, 179)", white:"rgb(255, 255, 255)", whitesmoke:"rgb(245, 245, 245)", yellow:"rgb(255, 255, 0)", yellowgreen:"rgb(154, 205, 50)"}; H.jqplot.AxisLabelRenderer = function(ab){H.jqplot.ElemContainer.call(this); this.axis; this.show = true; this.label = ""; this.fontFamily = null; this.fontSize = null; this.textColor = null; this._elem; this.escapeHTML = false; H.extend(true, this, ab)}; H.jqplot.AxisLabelRenderer.prototype = new H.jqplot.ElemContainer(); H.jqplot.AxisLabelRenderer.prototype.constructor = H.jqplot.AxisLabelRenderer; H.jqplot.AxisLabelRenderer.prototype.init = function(ab){H.extend(true, this, ab)}; H.jqplot.AxisLabelRenderer.prototype.draw = function(ab, ac){if (this._elem){this._elem.emptyForce(); this._elem = null}this._elem = H('
'); if (Number(this.label)){this._elem.css("white-space", "nowrap")}if (!this.escapeHTML){this._elem.html(this.label)} else{this._elem.text(this.label)}if (this.fontFamily){this._elem.css("font-family", this.fontFamily)}if (this.fontSize){this._elem.css("font-size", this.fontSize)}if (this.textColor){this._elem.css("color", this.textColor)}return this._elem}; H.jqplot.AxisLabelRenderer.prototype.pack = function(){}; H.jqplot.AxisTickRenderer = function(ab){H.jqplot.ElemContainer.call(this); this.mark = "outside"; this.axis; this.showMark = true; this.showGridline = true; this.isMinorTick = false; this.size = 4; this.markSize = 6; this.show = true; this.showLabel = true; this.label = null; this.value = null; this._styles = {}; this.formatter = H.jqplot.DefaultTickFormatter; this.prefix = ""; this.suffix = ""; this.formatString = ""; this.fontFamily; this.fontSize; this.textColor; this.escapeHTML = false; this._elem; this._breakTick = false; H.extend(true, this, ab)}; H.jqplot.AxisTickRenderer.prototype.init = function(ab){H.extend(true, this, ab)}; H.jqplot.AxisTickRenderer.prototype = new H.jqplot.ElemContainer(); H.jqplot.AxisTickRenderer.prototype.constructor = H.jqplot.AxisTickRenderer; H.jqplot.AxisTickRenderer.prototype.setTick = function(ab, ad, ac){this.value = ab; this.axis = ad; if (ac){this.isMinorTick = true}return this}; H.jqplot.AxisTickRenderer.prototype.draw = function(){if (this.label === null){this.label = this.prefix + this.formatter(this.formatString, this.value) + this.suffix}var ac = {position:"absolute"}; if (Number(this.label)){ac.whitSpace = "nowrap"}if (this._elem){this._elem.emptyForce(); this._elem = null}this._elem = H(document.createElement("div")); this._elem.addClass("jqplot-" + this.axis + "-tick"); if (!this.escapeHTML){this._elem.html(this.label)} else{this._elem.text(this.label)}this._elem.css(ac); for (var ab in this._styles){this._elem.css(ab, this._styles[ab])}if (this.fontFamily){this._elem.css("font-family", this.fontFamily)}if (this.fontSize){this._elem.css("font-size", this.fontSize)}if (this.textColor){this._elem.css("color", this.textColor)}if (this._breakTick){this._elem.addClass("jqplot-breakTick")}return this._elem}; H.jqplot.DefaultTickFormatter = function(ab, ac){if (typeof ac == "number"){if (!ab){ab = H.jqplot.config.defaultTickFormatString}return H.jqplot.sprintf(ab, ac)} else{return String(ac)}}; H.jqplot.PercentTickFormatter = function(ab, ac){if (typeof ac == "number"){ac = 100 * ac; if (!ab){ab = H.jqplot.config.defaultTickFormatString}return H.jqplot.sprintf(ab, ac)} else{return String(ac)}}; H.jqplot.AxisTickRenderer.prototype.pack = function(){}; H.jqplot.CanvasGridRenderer = function(){this.shadowRenderer = new H.jqplot.ShadowRenderer()}; H.jqplot.CanvasGridRenderer.prototype.init = function(ac){this._ctx; H.extend(true, this, ac); var ab = {lineJoin:"miter", lineCap:"round", fill:false, isarc:false, angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, depth:this.shadowDepth, lineWidth:this.shadowWidth, closePath:false, strokeStyle:this.shadowColor}; this.renderer.shadowRenderer.init(ab)}; H.jqplot.CanvasGridRenderer.prototype.createElement = function(ae){var ad; if (this._elem){if (H.jqplot.use_excanvas && window.G_vmlCanvasManager.uninitElement !== r){ad = this._elem.get(0); window.G_vmlCanvasManager.uninitElement(ad); ad = null}this._elem.emptyForce(); this._elem = null}ad = ae.canvasManager.getCanvas(); var ab = this._plotDimensions.width; var ac = this._plotDimensions.height; ad.width = ab; ad.height = ac; this._elem = H(ad); this._elem.addClass("jqplot-grid-canvas"); this._elem.css({position:"absolute", left:0, top:0}); ad = ae.canvasManager.initCanvas(ad); this._top = this._offsets.top; this._bottom = ac - this._offsets.bottom; this._left = this._offsets.left; this._right = ab - this._offsets.right; this._width = this._right - this._left; this._height = this._bottom - this._top; ad = null; return this._elem}; H.jqplot.CanvasGridRenderer.prototype.draw = function(){this._ctx = this._elem.get(0).getContext("2d"); var am = this._ctx; var ap = this._axes; am.save(); am.clearRect(0, 0, this._plotDimensions.width, this._plotDimensions.height); am.fillStyle = this.backgroundColor || this.background; am.fillRect(this._left, this._top, this._width, this._height); am.save(); am.lineJoin = "miter"; am.lineCap = "butt"; am.lineWidth = this.gridLineWidth; am.strokeStyle = this.gridLineColor; var at, ar, aj, ak; var ag = ["xaxis", "yaxis", "x2axis", "y2axis"]; for (var aq = 4; aq > 0; aq--){var aw = ag[aq - 1]; var ab = ap[aw]; var au = ab._ticks; var al = au.length; if (ab.show){if (ab.drawBaseline){var av = {}; if (ab.baselineWidth !== null){av.lineWidth = ab.baselineWidth}if (ab.baselineColor !== null){av.strokeStyle = ab.baselineColor}switch (aw){case"xaxis":ai(this._left, this._bottom, this._right, this._bottom, av); break; case"yaxis":ai(this._left, this._bottom, this._left, this._top, av); break; case"x2axis":ai(this._left, this._bottom, this._right, this._bottom, av); break; case"y2axis":ai(this._right, this._bottom, this._right, this._top, av); break}}for (var an = al; an > 0; an--){var ah = au[an - 1]; if (ah.show){var ae = Math.round(ab.u2p(ah.value)) + 0.5; switch (aw){case"xaxis":if (ah.showGridline && this.drawGridlines && ((!ah.isMinorTick && ab.drawMajorGridlines) || (ah.isMinorTick && ab.drawMinorGridlines))){ai(ae, this._top, ae, this._bottom)}if (ah.showMark && ah.mark && ((!ah.isMinorTick && ab.drawMajorTickMarks) || (ah.isMinorTick && ab.drawMinorTickMarks))){aj = ah.markSize; ak = ah.mark; var ae = Math.round(ab.u2p(ah.value)) + 0.5; switch (ak){case"outside":at = this._bottom; ar = this._bottom + aj; break; case"inside":at = this._bottom - aj; ar = this._bottom; break; case"cross":at = this._bottom - aj; ar = this._bottom + aj; break; default:at = this._bottom; ar = this._bottom + aj; break}if (this.shadow){this.renderer.shadowRenderer.draw(am, [[ae, at], [ae, ar]], {lineCap:"butt", lineWidth:this.gridLineWidth, offset:this.gridLineWidth * 0.75, depth:2, fill:false, closePath:false})}ai(ae, at, ae, ar)}break; case"yaxis":if (ah.showGridline && this.drawGridlines && ((!ah.isMinorTick && ab.drawMajorGridlines) || (ah.isMinorTick && ab.drawMinorGridlines))){ai(this._right, ae, this._left, ae)}if (ah.showMark && ah.mark && ((!ah.isMinorTick && ab.drawMajorTickMarks) || (ah.isMinorTick && ab.drawMinorTickMarks))){aj = ah.markSize; ak = ah.mark; var ae = Math.round(ab.u2p(ah.value)) + 0.5; switch (ak){case"outside":at = this._left - aj; ar = this._left; break; case"inside":at = this._left; ar = this._left + aj; break; case"cross":at = this._left - aj; ar = this._left + aj; break; default:at = this._left - aj; ar = this._left; break}if (this.shadow){this.renderer.shadowRenderer.draw(am, [[at, ae], [ar, ae]], {lineCap:"butt", lineWidth:this.gridLineWidth * 1.5, offset:this.gridLineWidth * 0.75, fill:false, closePath:false})}ai(at, ae, ar, ae, {strokeStyle:ab.borderColor})}break; case"x2axis":if (ah.showGridline && this.drawGridlines && ((!ah.isMinorTick && ab.drawMajorGridlines) || (ah.isMinorTick && ab.drawMinorGridlines))){ai(ae, this._bottom, ae, this._top)}if (ah.showMark && ah.mark && ((!ah.isMinorTick && ab.drawMajorTickMarks) || (ah.isMinorTick && ab.drawMinorTickMarks))){aj = ah.markSize; ak = ah.mark; var ae = Math.round(ab.u2p(ah.value)) + 0.5; switch (ak){case"outside":at = this._top - aj; ar = this._top; break; case"inside":at = this._top; ar = this._top + aj; break; case"cross":at = this._top - aj; ar = this._top + aj; break; default:at = this._top - aj; ar = this._top; break}if (this.shadow){this.renderer.shadowRenderer.draw(am, [[ae, at], [ae, ar]], {lineCap:"butt", lineWidth:this.gridLineWidth, offset:this.gridLineWidth * 0.75, depth:2, fill:false, closePath:false})}ai(ae, at, ae, ar)}break; case"y2axis":if (ah.showGridline && this.drawGridlines && ((!ah.isMinorTick && ab.drawMajorGridlines) || (ah.isMinorTick && ab.drawMinorGridlines))){ai(this._left, ae, this._right, ae)} +if (ah.showMark && ah.mark && ((!ah.isMinorTick && ab.drawMajorTickMarks) || (ah.isMinorTick && ab.drawMinorTickMarks))){ +aj = ah.markSize; ak = ah.mark; var ae = Math.round(ab.u2p(ah.value)) + 0.5; + switch (ak){case"outside":at = this._right; ar = this._right + aj; + break; case"inside":at = this._right - aj; ar = this._right; break; + case"cross":at = this._right - aj; ar = this._right + aj; + break; default:at = this._right; ar = this._right + aj; break} +if (this.shadow){this.renderer.shadowRenderer.draw(am, [[at, ae], [ar, ae]], { +lineCap:"butt", lineWidth:this.gridLineWidth * 1.5, offset:this.gridLineWidth * 0.75, fill:false, closePath:false})} +ai(at, ae, ar, ae, {strokeStyle:ab.borderColor})}break; default:break}}}ah = null}ab = null; au = null} +ag = ["y3axis", "y4axis", "y5axis", "y6axis", "y7axis", "y8axis", "y9axis", "yMidAxis"]; + for (var aq = 7; aq > 0; aq--){var ab = ap[ag[aq - 1]]; + var au = ab._ticks; if (ab.show){var ac = au[ab.numberTicks - 1]; + var af = au[0]; var ad = ab.getLeft(); + var ao = [[ad, ac.getTop() + ac.getHeight() / 2], [ad, af.getTop() + af.getHeight() / 2 + 1]]; + if (this.shadow){this.renderer.shadowRenderer.draw(am, ao, {lineCap:"butt", fill:false, closePath:false})}ai(ao[0][0], ao[0][1], ao[1][0], ao[1][1], {lineCap:"butt", strokeStyle:ab.borderColor, lineWidth:ab.borderWidth}); for (var an = au.length; an > 0; an--){var ah = au[an - 1]; aj = ah.markSize; ak = ah.mark; var ae = Math.round(ab.u2p(ah.value)) + 0.5; if (ah.showMark && ah.mark){switch (ak){case"outside":at = ad; ar = ad + aj; break; case"inside":at = ad - aj; ar = ad; break; case"cross":at = ad - aj; ar = ad + aj; break; default:at = ad; ar = ad + aj; break}ao = [[at, ae], [ar, ae]]; if (this.shadow){this.renderer.shadowRenderer.draw(am, ao, {lineCap:"butt", lineWidth:this.gridLineWidth * 1.5, offset:this.gridLineWidth * 0.75, fill:false, closePath:false})}ai(at, ae, ar, ae, {strokeStyle:ab.borderColor})}ah = null}af = null}ab = null; au = null}am.restore(); function ai(aB, aA, ay, ax, az){am.save(); az = az || {}; if (az.lineWidth == null || az.lineWidth != 0){H.extend(true, am, az); am.beginPath(); am.moveTo(aB, aA); am.lineTo(ay, ax); am.stroke(); am.restore()}}if (this.shadow){var ao = [[this._left, this._bottom], [this._right, this._bottom], [this._right, this._top]]; this.renderer.shadowRenderer.draw(am, ao)}if (this.borderWidth != 0 && this.drawBorder){ai(this._left, this._top, this._right, this._top, {lineCap:"round", strokeStyle:ap.x2axis.borderColor, lineWidth:ap.x2axis.borderWidth}); ai(this._right, this._top, this._right, this._bottom, {lineCap:"round", strokeStyle:ap.y2axis.borderColor, lineWidth:ap.y2axis.borderWidth}); ai(this._right, this._bottom, this._left, this._bottom, {lineCap:"round", strokeStyle:ap.xaxis.borderColor, lineWidth:ap.xaxis.borderWidth}); ai(this._left, this._bottom, this._left, this._top, {lineCap:"round", strokeStyle:ap.yaxis.borderColor, lineWidth:ap.yaxis.borderWidth})}am.restore(); am = null; ap = null}; H.jqplot.DivTitleRenderer = function(){}; H.jqplot.DivTitleRenderer.prototype.init = function(ab){H.extend(true, this, ab)}; H.jqplot.DivTitleRenderer.prototype.draw = function(){if (this._elem){this._elem.emptyForce(); this._elem = null}var ae = this.renderer; var ad = document.createElement("div"); this._elem = H(ad); this._elem.addClass("jqplot-title"); if (!this.text){this.show = false; this._elem.height(0); this._elem.width(0)} else{if (this.text){var ab; if (this.color){ab = this.color} else{if (this.textColor){ab = this.textColor}}var ac = {position:"absolute", top:"0px", left:"0px"}; if (this._plotWidth){ac.width = this._plotWidth + "px"}if (this.fontSize){ac.fontSize = this.fontSize}if (typeof this.textAlign === "string"){ac.textAlign = this.textAlign} else{ac.textAlign = "center"}if (ab){ac.color = ab}if (this.paddingBottom){ac.paddingBottom = this.paddingBottom}if (this.fontFamily){ac.fontFamily = this.fontFamily}this._elem.css(ac); if (this.escapeHtml){this._elem.text(this.text)} else{this._elem.html(this.text)}}}ad = null; return this._elem}; H.jqplot.DivTitleRenderer.prototype.pack = function(){}; var o = 0.1; H.jqplot.LinePattern = function(ap, ak){var aj = {dotted:[o, H.jqplot.config.dotGapLength], dashed:[H.jqplot.config.dashLength, H.jqplot.config.gapLength], solid:null}; if (typeof ak === "string"){if (ak[0] === "." || ak[0] === "-"){var aq = ak; ak = []; for (var ai = 0, af = aq.length; ai < af; ai++){if (aq[ai] === "."){ak.push(o)} else{if (aq[ai] === "-"){ak.push(H.jqplot.config.dashLength)} else{continue}}ak.push(H.jqplot.config.gapLength)}} else{ak = aj[ak]}}if (!(ak && ak.length)){return ap}var ae = 0; var al = ak[0]; var an = 0; var am = 0; var ah = 0; var ab = 0; var ao = function(ar, at){ap.moveTo(ar, at); an = ar; am = at; ah = ar; ab = at}; var ad = function(ar, ay){var aw = ap.lineWidth; var au = ar - an; var at = ay - am; var av = Math.sqrt(au * au + at * at); if ((av > 0) && (aw > 0)){au /= av; at /= av; while (true){var ax = aw * al; if (ax < av){an += ax * au; am += ax * at; if ((ae & 1) == 0){ap.lineTo(an, am)} else{ap.moveTo(an, am)}av -= ax; ae++; if (ae >= ak.length){ae = 0}al = ak[ae]} else{an = ar; am = ay; if ((ae & 1) == 0){ap.lineTo(an, am)} else{ap.moveTo(an, am)}al -= av / aw; break}}}}; var ac = function(){ap.beginPath()}; var ag = function(){ad(ah, ab)}; return{moveTo:ao, lineTo:ad, beginPath:ac, closePath:ag}}; H.jqplot.LineRenderer = function(){this.shapeRenderer = new H.jqplot.ShapeRenderer(); this.shadowRenderer = new H.jqplot.ShadowRenderer()}; H.jqplot.LineRenderer.prototype.init = function(ac, ah){ac = ac || {}; this._type = "line"; this.renderer.animation = {show:false, direction:"left", speed:2500, _supported:true}; this.renderer.smooth = false; this.renderer.tension = null; this.renderer.constrainSmoothing = true; this.renderer._smoothedData = []; this.renderer._smoothedPlotData = []; this.renderer._hiBandGridData = []; this.renderer._lowBandGridData = []; this.renderer._hiBandSmoothedData = []; this.renderer._lowBandSmoothedData = []; this.renderer.bandData = []; this.renderer.bands = {show:false, hiData:[], lowData:[], color:this.color, showLines:false, fill:true, fillColor:null, _min:null, _max:null, interval:"3%"}; var af = {highlightMouseOver:ac.highlightMouseOver, highlightMouseDown:ac.highlightMouseDown, highlightColor:ac.highlightColor}; delete (ac.highlightMouseOver); delete (ac.highlightMouseDown); delete (ac.highlightColor); H.extend(true, this.renderer, ac); this.renderer.options = ac; if (this.renderer.bandData.length > 1 && (!ac.bands || ac.bands.show == null)){this.renderer.bands.show = true} else{if (ac.bands && ac.bands.show == null && ac.bands.interval != null){this.renderer.bands.show = true}}if (this.fill){this.renderer.bands.show = false}if (this.renderer.bands.show){this.renderer.initBands.call(this, this.renderer.options, ah)}if (this._stack){this.renderer.smooth = false}var ag = {lineJoin:this.lineJoin, lineCap:this.lineCap, fill:this.fill, isarc:false, strokeStyle:this.color, fillStyle:this.fillColor, lineWidth:this.lineWidth, linePattern:this.linePattern, closePath:this.fill}; this.renderer.shapeRenderer.init(ag); var ad = ac.shadowOffset; if (ad == null){if (this.lineWidth > 2.5){ad = 1.25 * (1 + (Math.atan((this.lineWidth / 2.5)) / 0.785398163 - 1) * 0.6)} else{ad = 1.25 * Math.atan((this.lineWidth / 2.5)) / 0.785398163}}var ab = {lineJoin:this.lineJoin, lineCap:this.lineCap, fill:this.fill, isarc:false, angle:this.shadowAngle, offset:ad, alpha:this.shadowAlpha, depth:this.shadowDepth, lineWidth:this.lineWidth, linePattern:this.linePattern, closePath:this.fill}; this.renderer.shadowRenderer.init(ab); this._areaPoints = []; this._boundingBox = [[], []]; if (!this.isTrendline && this.fill || this.renderer.bands.show){this.highlightMouseOver = true; this.highlightMouseDown = false; this.highlightColor = null; if (af.highlightMouseDown && af.highlightMouseOver == null){af.highlightMouseOver = false}H.extend(true, this, {highlightMouseOver:af.highlightMouseOver, highlightMouseDown:af.highlightMouseDown, highlightColor:af.highlightColor}); if (!this.highlightColor){var ae = (this.renderer.bands.show)?this.renderer.bands.fillColor:this.fillColor; this.highlightColor = H.jqplot.computeHighlightColors(ae)}if (this.highlighter){this.highlighter.show = false}}if (!this.isTrendline && ah){ah.plugins.lineRenderer = {}; ah.postInitHooks.addOnce(v); ah.postDrawHooks.addOnce(Z); ah.eventListenerHooks.addOnce("jqplotMouseMove", g); ah.eventListenerHooks.addOnce("jqplotMouseDown", d); ah.eventListenerHooks.addOnce("jqplotMouseUp", Y); ah.eventListenerHooks.addOnce("jqplotClick", f); ah.eventListenerHooks.addOnce("jqplotRightClick", p)}}; H.jqplot.LineRenderer.prototype.initBands = function(ae, ao){var af = ae.bandData || []; var ah = this.renderer.bands; ah.hiData = []; ah.lowData = []; var av = this.data; ah._max = null; ah._min = null; if (af.length == 2){if (H.isArray(af[0][0])){var ai; var ab = 0, al = 0; for (var ap = 0, am = af[0].length; ap < am; ap++){ai = af[0][ap]; if ((ai[1] != null && ai[1] > ah._max) || ah._max == null){ah._max = ai[1]}if ((ai[1] != null && ai[1] < ah._min) || ah._min == null){ah._min = ai[1]}}for (var ap = 0, am = af[1].length; ap < am; ap++){ai = af[1][ap]; if ((ai[1] != null && ai[1] > ah._max) || ah._max == null){ah._max = ai[1]; al = 1}if ((ai[1] != null && ai[1] < ah._min) || ah._min == null){ah._min = ai[1]; ab = 1}}if (al === ab){ah.show = false}ah.hiData = af[al]; ah.lowData = af[ab]} else{if (af[0].length === av.length && af[1].length === av.length){var ad = (af[0][0] > af[1][0])?0:1; var aw = (ad)?0:1; for (var ap = 0, am = av.length; ap < am; ap++){ah.hiData.push([av[ap][0], af[ad][ap]]); ah.lowData.push([av[ap][0], af[aw][ap]])}} else{ah.show = false}}} else{if (af.length > 2 && !H.isArray(af[0][0])){var ad = (af[0][0] > af[0][1])?0:1; var aw = (ad)?0:1; for (var ap = 0, am = af.length; ap < am; ap++){ah.hiData.push([av[ap][0], af[ap][ad]]); ah.lowData.push([av[ap][0], af[ap][aw]])}} else{var ak = ah.interval; var au = null; var at = null; var ac = null; var an = null; if (H.isArray(ak)){au = ak[0]; at = ak[1]} else{au = ak}if (isNaN(au)){if (au.charAt(au.length - 1) === "%"){ac = "multiply"; au = parseFloat(au) / 100 + 1}} else{au = parseFloat(au); ac = "add"}if (at !== null && isNaN(at)){if (at.charAt(at.length - 1) === "%"){an = "multiply"; at = parseFloat(at) / 100 + 1}} else{if (at !== null){at = parseFloat(at); an = "add"}}if (au !== null){if (at === null){at = - au; an = ac; if (an === "multiply"){at += 2}}if (au < at){var aq = au; au = at; at = aq; aq = ac; ac = an; an = aq}for (var ap = 0, am = av.length; ap < am; ap++){switch (ac){case"add":ah.hiData.push([av[ap][0], av[ap][1] + au]); break; case"multiply":ah.hiData.push([av[ap][0], av[ap][1] * au]); break}switch (an){case"add":ah.lowData.push([av[ap][0], av[ap][1] + at]); break; case"multiply":ah.lowData.push([av[ap][0], av[ap][1] * at]); break}}} else{ah.show = false}}}var ag = ah.hiData; var aj = ah.lowData; for (var ap = 0, am = ag.length; ap < am; ap++){if ((ag[ap][1] != null && ag[ap][1] > ah._max) || ah._max == null){ah._max = ag[ap][1]}}for (var ap = 0, am = aj.length; ap < am; ap++){if ((aj[ap][1] != null && aj[ap][1] < ah._min) || ah._min == null){ah._min = aj[ap][1]}}if (ah.fillColor === null){var ar = H.jqplot.getColorComponents(ah.color); ar[3] = ar[3] * 0.5; ah.fillColor = "rgba(" + ar[0] + ", " + ar[1] + ", " + ar[2] + ", " + ar[3] + ")"}}; function G(ac, ab){return(3.4182054 + ab) * Math.pow(ac, - 0.3534992)}function k(ad, ac){var ab = Math.sqrt(Math.pow((ac[0] - ad[0]), 2) + Math.pow((ac[1] - ad[1]), 2)); return 5.7648 * Math.log(ab) + 7.4456}function w(ab){var ac = (Math.exp(2 * ab) - 1) / (Math.exp(2 * ab) + 1); return ac}function F(aD){var am = this.renderer.smooth; var ax = this.canvas.getWidth(); var ah = this._xaxis.series_p2u; var aA = this._yaxis.series_p2u; var az = null; var ag = null; var at = aD.length / ax; var ad = []; var ar = []; if (!isNaN(parseFloat(am))){az = parseFloat(am)} else{az = G(at, 0.5)}var ap = []; var ae = []; for (var ay = 0, au = aD.length; ay < au; ay++){ap.push(aD[ay][1]); ae.push(aD[ay][0])}function ao(aE, aF){if (aE - aF == 0){return Math.pow(10, 10)} else{return aE - aF}}var aq, al, ak, aj; var ab = aD.length - 1; for (var af = 1, av = aD.length; af < av; af++){var ac = []; var an = []; for (var aw = 0; aw < 2; aw++){var ay = af - 1 + aw; if (ay == 0 || ay == ab){ac[aw] = Math.pow(10, 10)} else{if (ap[ay + 1] - ap[ay] == 0 || ap[ay] - ap[ay - 1] == 0){ac[aw] = 0} else{if (((ae[ay + 1] - ae[ay]) / (ap[ay + 1] - ap[ay]) + (ae[ay] - ae[ay - 1]) / (ap[ay] - ap[ay - 1])) == 0){ac[aw] = 0} else{if ((ap[ay + 1] - ap[ay]) * (ap[ay] - ap[ay - 1]) < 0){ac[aw] = 0} else{ac[aw] = 2 / (ao(ae[ay + 1], ae[ay]) / (ap[ay + 1] - ap[ay]) + ao(ae[ay], ae[ay - 1]) / (ap[ay] - ap[ay - 1]))}}}}}if (af == 1){ac[0] = 3 / 2 * (ap[1] - ap[0]) / ao(ae[1], ae[0]) - ac[1] / 2} else{if (af == ab){ac[1] = 3 / 2 * (ap[ab] - ap[ab - 1]) / ao(ae[ab], ae[ab - 1]) - ac[0] / 2}}an[0] = - 2 * (ac[1] + 2 * ac[0]) / ao(ae[af], ae[af - 1]) + 6 * (ap[af] - ap[af - 1]) / Math.pow(ao(ae[af], ae[af - 1]), 2); an[1] = 2 * (2 * ac[1] + ac[0]) / ao(ae[af], ae[af - 1]) - 6 * (ap[af] - ap[af - 1]) / Math.pow(ao(ae[af], ae[af - 1]), 2); aj = 1 / 6 * (an[1] - an[0]) / ao(ae[af], ae[af - 1]); ak = 1 / 2 * (ae[af] * an[0] - ae[af - 1] * an[1]) / ao(ae[af], ae[af - 1]); al = (ap[af] - ap[af - 1] - ak * (Math.pow(ae[af], 2) - Math.pow(ae[af - 1], 2)) - aj * (Math.pow(ae[af], 3) - Math.pow(ae[af - 1], 3))) / ao(ae[af], ae[af - 1]); aq = ap[af - 1] - al * ae[af - 1] - ak * Math.pow(ae[af - 1], 2) - aj * Math.pow(ae[af - 1], 3); var aC = (ae[af] - ae[af - 1]) / az; var aB, ai; for (var aw = 0, au = az; aw < au; aw++){aB = []; ai = ae[af - 1] + aw * aC; aB.push(ai); aB.push(aq + al * ai + ak * Math.pow(ai, 2) + aj * Math.pow(ai, 3)); ad.push(aB); ar.push([ah(aB[0]), aA(aB[1])])}}ad.push(aD[ay]); ar.push([ah(aD[ay][0]), aA(aD[ay][1])]); return[ad, ar]}function B(aj){var ai = this.renderer.smooth; var aO = this.renderer.tension; var ab = this.canvas.getWidth(); var aB = this._xaxis.series_p2u; var ak = this._yaxis.series_p2u; var aC = null; var aD = null; var aN = null; var aI = null; var aG = null; var am = null; var aL = null; var ag = null; var aE, aF, ax, aw, au, ar; var ae, ac, ao, an; var av, at, aH; var ap = []; var ad = []; var af = aj.length / ab; var aM, aq, az, aA, ay; var al = []; var ah = []; if (!isNaN(parseFloat(ai))){aC = parseFloat(ai)} else{aC = G(af, 0.5)}if (!isNaN(parseFloat(aO))){aO = parseFloat(aO)}for (var aK = 0, aJ = aj.length - 1; aK < aJ; aK++){if (aO === null){am = Math.abs((aj[aK + 1][1] - aj[aK][1]) / (aj[aK + 1][0] - aj[aK][0])); aM = 0.3; aq = 0.6; az = (aq - aM) / 2; aA = 2.5; ay = - 1.4; ag = am / aA + ay; aI = az * w(ag) - az * w(ay) + aM; if (aK > 0){aL = Math.abs((aj[aK][1] - aj[aK - 1][1]) / (aj[aK][0] - aj[aK - 1][0]))}ag = aL / aA + ay; aG = az * w(ag) - az * w(ay) + aM; aN = (aI + aG) / 2} else{aN = aO}for (aE = 0; aE < aC; aE++){aF = aE / aC; ax = (1 + 2 * aF) * Math.pow((1 - aF), 2); aw = aF * Math.pow((1 - aF), 2); au = Math.pow(aF, 2) * (3 - 2 * aF); ar = Math.pow(aF, 2) * (aF - 1); if (aj[aK - 1]){ae = aN * (aj[aK + 1][0] - aj[aK - 1][0]); ac = aN * (aj[aK + 1][1] - aj[aK - 1][1])} else{ae = aN * (aj[aK + 1][0] - aj[aK][0]); ac = aN * (aj[aK + 1][1] - aj[aK][1])}if (aj[aK + 2]){ao = aN * (aj[aK + 2][0] - aj[aK][0]); an = aN * (aj[aK + 2][1] - aj[aK][1])} else{ao = aN * (aj[aK + 1][0] - aj[aK][0]); an = aN * (aj[aK + 1][1] - aj[aK][1])}av = ax * aj[aK][0] + au * aj[aK + 1][0] + aw * ae + ar * ao; at = ax * aj[aK][1] + au * aj[aK + 1][1] + aw * ac + ar * an; aH = [av, at]; al.push(aH); ah.push([aB(av), ak(at)])}}al.push(aj[aJ]); ah.push([aB(aj[aJ][0]), ak(aj[aJ][1])]); return[al, ah]}H.jqplot.LineRenderer.prototype.setGridData = function(aj){var af = this._xaxis.series_u2p; var ab = this._yaxis.series_u2p; var ag = this._plotData; var ak = this._prevPlotData; this.gridData = []; this._prevGridData = []; this.renderer._smoothedData = []; this.renderer._smoothedPlotData = []; this.renderer._hiBandGridData = []; this.renderer._lowBandGridData = []; this.renderer._hiBandSmoothedData = []; this.renderer._lowBandSmoothedData = []; var ae = this.renderer.bands; var ac = false; for (var ah = 0, ad = ag.length; ah < ad; ah++){if (ag[ah][0] != null && ag[ah][1] != null){this.gridData.push([af.call(this._xaxis, ag[ah][0]), ab.call(this._yaxis, ag[ah][1])])} else{if (ag[ah][0] == null){ac = true; this.gridData.push([null, ab.call(this._yaxis, ag[ah][1])])} else{if (ag[ah][1] == null){ac = true; this.gridData.push([af.call(this._xaxis, ag[ah][0]), null])}}}if (ak[ah] != null && ak[ah][0] != null && ak[ah][1] != null){this._prevGridData.push([af.call(this._xaxis, ak[ah][0]), ab.call(this._yaxis, ak[ah][1])])} else{if (ak[ah] != null && ak[ah][0] == null){this._prevGridData.push([null, ab.call(this._yaxis, ak[ah][1])])} else{if (ak[ah] != null && ak[ah][0] != null && ak[ah][1] == null){this._prevGridData.push([af.call(this._xaxis, ak[ah][0]), null])}}}}if (ac){this.renderer.smooth = false; if (this._type === "line"){ae.show = false}}if (this._type === "line" && ae.show){for (var ah = 0, ad = ae.hiData.length; ah < ad; ah++){this.renderer._hiBandGridData.push([af.call(this._xaxis, ae.hiData[ah][0]), ab.call(this._yaxis, ae.hiData[ah][1])])}for (var ah = 0, ad = ae.lowData.length; ah < ad; ah++){this.renderer._lowBandGridData.push([af.call(this._xaxis, ae.lowData[ah][0]), ab.call(this._yaxis, ae.lowData[ah][1])])}}if (this._type === "line" && this.renderer.smooth && this.gridData.length > 2){var ai; if (this.renderer.constrainSmoothing){ai = F.call(this, this.gridData); this.renderer._smoothedData = ai[0]; this.renderer._smoothedPlotData = ai[1]; if (ae.show){ai = F.call(this, this.renderer._hiBandGridData); this.renderer._hiBandSmoothedData = ai[0]; ai = F.call(this, this.renderer._lowBandGridData); this.renderer._lowBandSmoothedData = ai[0]}ai = null} else{ai = B.call(this, this.gridData); this.renderer._smoothedData = ai[0]; this.renderer._smoothedPlotData = ai[1]; if (ae.show){ai = B.call(this, this.renderer._hiBandGridData); this.renderer._hiBandSmoothedData = ai[0]; ai = B.call(this, this.renderer._lowBandGridData); this.renderer._lowBandSmoothedData = ai[0]}ai = null}}}; H.jqplot.LineRenderer.prototype.makeGridData = function(ai, ak){var ag = this._xaxis.series_u2p; var ab = this._yaxis.series_u2p; var al = []; var ad = []; this.renderer._smoothedData = []; this.renderer._smoothedPlotData = []; this.renderer._hiBandGridData = []; this.renderer._lowBandGridData = []; this.renderer._hiBandSmoothedData = []; this.renderer._lowBandSmoothedData = []; var af = this.renderer.bands; var ac = false; for (var ah = 0; ah < ai.length; ah++){if (ai[ah][0] != null && ai[ah][1] != null){al.push([ag.call(this._xaxis, ai[ah][0]), ab.call(this._yaxis, ai[ah][1])])} else{if (ai[ah][0] == null){ac = true; al.push([null, ab.call(this._yaxis, ai[ah][1])])} else{if (ai[ah][1] == null){ac = true; al.push([ag.call(this._xaxis, ai[ah][0]), null])}}}}if (ac){this.renderer.smooth = false; if (this._type === "line"){af.show = false}}if (this._type === "line" && af.show){for (var ah = 0, ae = af.hiData.length; ah < ae; ah++){this.renderer._hiBandGridData.push([ag.call(this._xaxis, af.hiData[ah][0]), ab.call(this._yaxis, af.hiData[ah][1])])}for (var ah = 0, ae = af.lowData.length; ah < ae; ah++){this.renderer._lowBandGridData.push([ag.call(this._xaxis, af.lowData[ah][0]), ab.call(this._yaxis, af.lowData[ah][1])])}}if (this._type === "line" && this.renderer.smooth && al.length > 2){var aj; if (this.renderer.constrainSmoothing){aj = F.call(this, al); this.renderer._smoothedData = aj[0]; this.renderer._smoothedPlotData = aj[1]; if (af.show){aj = F.call(this, this.renderer._hiBandGridData); this.renderer._hiBandSmoothedData = aj[0]; aj = F.call(this, this.renderer._lowBandGridData); this.renderer._lowBandSmoothedData = aj[0]}aj = null} else{aj = B.call(this, al); this.renderer._smoothedData = aj[0]; this.renderer._smoothedPlotData = aj[1]; if (af.show){aj = B.call(this, this.renderer._hiBandGridData); this.renderer._hiBandSmoothedData = aj[0]; aj = B.call(this, this.renderer._lowBandGridData); this.renderer._lowBandSmoothedData = aj[0]}aj = null}}return al}; H.jqplot.LineRenderer.prototype.draw = function(aq, aC, ac, av){var aw; var ak = H.extend(true, {}, ac); var ae = (ak.shadow != r)?ak.shadow:this.shadow; var aD = (ak.showLine != r)?ak.showLine:this.showLine; var au = (ak.fill != r)?ak.fill:this.fill; var ab = (ak.fillAndStroke != r)?ak.fillAndStroke:this.fillAndStroke; var al, ar, ao, ay; aq.save(); if (aC.length){if (aD){if (au){if (this.fillToZero){var az = this.negativeColor; if (!this.useNegativeColors){az = ak.fillStyle}var ai = false; var aj = ak.fillStyle; if (ab){var aB = aC.slice(0)}if (this.index == 0 || !this._stack){var ap = []; var aF = (this.renderer.smooth)?this.renderer._smoothedPlotData:this._plotData; this._areaPoints = []; var aA = this._yaxis.series_u2p(this.fillToValue); var ad = this._xaxis.series_u2p(this.fillToValue); ak.closePath = true; if (this.fillAxis == "y"){ap.push([aC[0][0], aA]); this._areaPoints.push([aC[0][0], aA]); for (var aw = 0; aw < aC.length - 1; aw++){ap.push(aC[aw]); this._areaPoints.push(aC[aw]); if (aF[aw][1] * aF[aw + 1][1] < 0){if (aF[aw][1] < 0){ai = true; ak.fillStyle = az} else{ai = false; ak.fillStyle = aj}var ah = aC[aw][0] + (aC[aw + 1][0] - aC[aw][0]) * (aA - aC[aw][1]) / (aC[aw + 1][1] - aC[aw][1]); ap.push([ah, aA]); this._areaPoints.push([ah, aA]); if (ae){this.renderer.shadowRenderer.draw(aq, ap, ak)}this.renderer.shapeRenderer.draw(aq, ap, ak); ap = [[ah, aA]]}}if (aF[aC.length - 1][1] < 0){ai = true; ak.fillStyle = az} else{ai = false; ak.fillStyle = aj}ap.push(aC[aC.length - 1]); this._areaPoints.push(aC[aC.length - 1]); ap.push([aC[aC.length - 1][0], aA]); this._areaPoints.push([aC[aC.length - 1][0], aA])}if (ae){this.renderer.shadowRenderer.draw(aq, ap, ak)}this.renderer.shapeRenderer.draw(aq, ap, ak)} else{var an = this._prevGridData; for (var aw = an.length; aw > 0; aw--){aC.push(an[aw - 1])}if (ae){this.renderer.shadowRenderer.draw(aq, aC, ak)}this._areaPoints = aC; this.renderer.shapeRenderer.draw(aq, aC, ak)}} else{if (ab){var aB = aC.slice(0)}if (this.index == 0 || !this._stack){var af = aq.canvas.height; aC.unshift([aC[0][0], af]); var ax = aC.length; aC.push([aC[ax - 1][0], af])} else{var an = this._prevGridData; for (var aw = an.length; aw > 0; aw--){aC.push(an[aw - 1])}}this._areaPoints = aC; if (ae){this.renderer.shadowRenderer.draw(aq, aC, ak)}this.renderer.shapeRenderer.draw(aq, aC, ak)}if (ab){var at = H.extend(true, {}, ak, {fill:false, closePath:false}); this.renderer.shapeRenderer.draw(aq, aB, at); if (this.markerRenderer.show){if (this.renderer.smooth){aB = this.gridData}for (aw = 0; aw < aB.length; aw++){this.markerRenderer.draw(aB[aw][0], aB[aw][1], aq, ak.markerOptions)}}}} else{if (this.renderer.bands.show){var ag; var aE = H.extend(true, {}, ak); if (this.renderer.bands.showLines){ag = (this.renderer.smooth)?this.renderer._hiBandSmoothedData:this.renderer._hiBandGridData; this.renderer.shapeRenderer.draw(aq, ag, ak); ag = (this.renderer.smooth)?this.renderer._lowBandSmoothedData:this.renderer._lowBandGridData; this.renderer.shapeRenderer.draw(aq, ag, aE)}if (this.renderer.bands.fill){if (this.renderer.smooth){ag = this.renderer._hiBandSmoothedData.concat(this.renderer._lowBandSmoothedData.reverse())} else{ag = this.renderer._hiBandGridData.concat(this.renderer._lowBandGridData.reverse())}this._areaPoints = ag; aE.closePath = true; aE.fill = true; aE.fillStyle = this.renderer.bands.fillColor; this.renderer.shapeRenderer.draw(aq, ag, aE)}}if (ae){this.renderer.shadowRenderer.draw(aq, aC, ak)}this.renderer.shapeRenderer.draw(aq, aC, ak)}}var al = ao = ar = ay = null; for (aw = 0; aw < this._areaPoints.length; aw++){var am = this._areaPoints[aw]; if (al > am[0] || al == null){al = am[0]}if (ay < am[1] || ay == null){ay = am[1]}if (ao < am[0] || ao == null){ao = am[0]}if (ar > am[1] || ar == null){ar = am[1]}}if (this.type === "line" && this.renderer.bands.show){ay = this._yaxis.series_u2p(this.renderer.bands._min); ar = this._yaxis.series_u2p(this.renderer.bands._max)}this._boundingBox = [[al, ay], [ao, ar]]; if (this.markerRenderer.show && !au){if (this.renderer.smooth){aC = this.gridData}for (aw = 0; aw < aC.length; aw++){if (aC[aw][0] != null && aC[aw][1] != null){this.markerRenderer.draw(aC[aw][0], aC[aw][1], aq, ak.markerOptions)}}}}aq.restore()}; H.jqplot.LineRenderer.prototype.drawShadow = function(ab, ad, ac){}; function v(ae, ad, ab){for (var ac = 0; ac < this.series.length; ac++){if (this.series[ac].renderer.constructor == H.jqplot.LineRenderer){if (this.series[ac].highlightMouseOver){this.series[ac].highlightMouseDown = false}}}}function Z(){if (this.plugins.lineRenderer && this.plugins.lineRenderer.highlightCanvas){this.plugins.lineRenderer.highlightCanvas.resetCanvas(); this.plugins.lineRenderer.highlightCanvas = null}this.plugins.lineRenderer.highlightedSeriesIndex = null; this.plugins.lineRenderer.highlightCanvas = new H.jqplot.GenericCanvas(); this.eventCanvas._elem.before(this.plugins.lineRenderer.highlightCanvas.createElement(this._gridPadding, "jqplot-lineRenderer-highlight-canvas", this._plotDimensions, this)); this.plugins.lineRenderer.highlightCanvas.setContext(); this.eventCanvas._elem.bind("mouseleave", {plot:this}, function(ab){V(ab.data.plot)})}function X(ah, ag, ae, ad){var ac = ah.series[ag]; var ab = ah.plugins.lineRenderer.highlightCanvas; ab._ctx.clearRect(0, 0, ab._ctx.canvas.width, ab._ctx.canvas.height); ac._highlightedPoint = ae; ah.plugins.lineRenderer.highlightedSeriesIndex = ag; var af = {fillStyle:ac.highlightColor}; if (ac.type === "line" && ac.renderer.bands.show){af.fill = true; af.closePath = true}ac.renderer.shapeRenderer.draw(ab._ctx, ad, af); ab = null}function V(ad){var ab = ad.plugins.lineRenderer.highlightCanvas; ab._ctx.clearRect(0, 0, ab._ctx.canvas.width, ab._ctx.canvas.height); for (var ac = 0; ac < ad.series.length; ac++){ad.series[ac]._highlightedPoint = null}ad.plugins.lineRenderer.highlightedSeriesIndex = null; ad.target.trigger("jqplotDataUnhighlight"); ab = null}function g(af, ae, ai, ah, ag){if (ah){var ad = [ah.seriesIndex, ah.pointIndex, ah.data]; var ac = jQuery.Event("jqplotDataMouseOver"); ac.pageX = af.pageX; ac.pageY = af.pageY; ag.target.trigger(ac, ad); if (ag.series[ad[0]].highlightMouseOver && !(ad[0] == ag.plugins.lineRenderer.highlightedSeriesIndex)){var ab = jQuery.Event("jqplotDataHighlight"); ab.which = af.which; ab.pageX = af.pageX; ab.pageY = af.pageY; ag.target.trigger(ab, ad); X(ag, ah.seriesIndex, ah.pointIndex, ah.points)}} else{if (ah == null){V(ag)}}}function d(ae, ad, ah, ag, af){if (ag){var ac = [ag.seriesIndex, ag.pointIndex, ag.data]; if (af.series[ac[0]].highlightMouseDown && !(ac[0] == af.plugins.lineRenderer.highlightedSeriesIndex)){var ab = jQuery.Event("jqplotDataHighlight"); ab.which = ae.which; ab.pageX = ae.pageX; ab.pageY = ae.pageY; af.target.trigger(ab, ac); X(af, ag.seriesIndex, ag.pointIndex, ag.points)}} else{if (ag == null){V(af)}}}function Y(ad, ac, ag, af, ae){var ab = ae.plugins.lineRenderer.highlightedSeriesIndex; if (ab != null && ae.series[ab].highlightMouseDown){V(ae)}}function f(ae, ad, ah, ag, af){if (ag){var ac = [ag.seriesIndex, ag.pointIndex, ag.data]; var ab = jQuery.Event("jqplotDataClick"); ab.which = ae.which; ab.pageX = ae.pageX; ab.pageY = ae.pageY; af.target.trigger(ab, ac)}}function p(af, ae, ai, ah, ag){if (ah){var ad = [ah.seriesIndex, ah.pointIndex, ah.data]; var ab = ag.plugins.lineRenderer.highlightedSeriesIndex; if (ab != null && ag.series[ab].highlightMouseDown){V(ag)}var ac = jQuery.Event("jqplotDataRightClick"); ac.which = af.which; ac.pageX = af.pageX; ac.pageY = af.pageY; ag.target.trigger(ac, ad)}}H.jqplot.LinearAxisRenderer = function(){}; H.jqplot.LinearAxisRenderer.prototype.init = function(ab){this.breakPoints = null; this.breakTickLabel = "≈"; this.drawBaseline = true; this.baselineWidth = null; this.baselineColor = null; this.forceTickAt0 = false; this.forceTickAt100 = false; this.tickInset = 0; this.minorTicks = 0; this.alignTicks = false; this._autoFormatString = ""; this._overrideFormatString = false; this._scalefact = 1; H.extend(true, this, ab); if (this.breakPoints){if (!H.isArray(this.breakPoints)){this.breakPoints = null} else{if (this.breakPoints.length < 2 || this.breakPoints[1] <= this.breakPoints[0]){this.breakPoints = null}}}if (this.numberTicks != null && this.numberTicks < 2){this.numberTicks = 2}this.resetDataBounds()}; H.jqplot.LinearAxisRenderer.prototype.draw = function(ab, ai){if (this.show){this.renderer.createTicks.call(this, ai); var ah = 0; var ac; if (this._elem){this._elem.emptyForce(); this._elem = null}this._elem = H(document.createElement("div")); this._elem.addClass("jqplot-axis jqplot-" + this.name); this._elem.css("position", "absolute"); if (this.name == "xaxis" || this.name == "x2axis"){this._elem.width(this._plotDimensions.width)} else{this._elem.height(this._plotDimensions.height)}this.labelOptions.axis = this.name; this._label = new this.labelRenderer(this.labelOptions); if (this._label.show){var ag = this._label.draw(ab, ai); ag.appendTo(this._elem); ag = null}var af = this._ticks; var ae; for (var ad = 0; ad < af.length; ad++){ae = af[ad]; if (ae.show && ae.showLabel && (!ae.isMinorTick || this.showMinorTicks)){this._elem.append(ae.draw(ab, ai))}}ae = null; af = null}return this._elem}; H.jqplot.LinearAxisRenderer.prototype.reset = function(){this.min = this._options.min; this.max = this._options.max; this.tickInterval = this._options.tickInterval; this.numberTicks = this._options.numberTicks; this._autoFormatString = ""; if (this._overrideFormatString && this.tickOptions && this.tickOptions.formatString){this.tickOptions.formatString = ""}}; H.jqplot.LinearAxisRenderer.prototype.set = function(){var ai = 0; var ad; var ac = 0; var ah = 0; var ab = (this._label == null)?false:this._label.show; if (this.show){var ag = this._ticks; var af; for (var ae = 0; ae < ag.length; ae++){af = ag[ae]; if (!af._breakTick && af.show && af.showLabel && (!af.isMinorTick || this.showMinorTicks)){if (this.name == "xaxis" || this.name == "x2axis"){ad = af._elem.outerHeight(true)} else{ad = af._elem.outerWidth(true)}if (ad > ai){ai = ad}}}af = null; ag = null; if (ab){ac = this._label._elem.outerWidth(true); ah = this._label._elem.outerHeight(true)}if (this.name == "xaxis"){ai = ai + ah; this._elem.css({height:ai + "px", left:"0px", bottom:"0px"})} else{if (this.name == "x2axis"){ai = ai + ah; this._elem.css({height:ai + "px", left:"0px", top:"0px"})} else{if (this.name == "yaxis"){ai = ai + ac; this._elem.css({width:ai + "px", left:"0px", top:"0px"}); if (ab && this._label.constructor == H.jqplot.AxisLabelRenderer){this._label._elem.css("width", ac + "px")}} else{ai = ai + ac; this._elem.css({width:ai + "px", right:"0px", top:"0px"}); if (ab && this._label.constructor == H.jqplot.AxisLabelRenderer){this._label._elem.css("width", ac + "px")}}}}}}; H.jqplot.LinearAxisRenderer.prototype.createTicks = function(ad){var aN = this._ticks; var aE = this.ticks; var at = this.name; var av = this._dataBounds; var ab = (this.name.charAt(0) === "x")?this._plotDimensions.width:this._plotDimensions.height; var ah; var a0, aC; var aj, ai; var aY, aU; var aB = this.min; var aZ = this.max; var aQ = this.numberTicks; var a4 = this.tickInterval; var ag = 30; this._scalefact = (Math.max(ab, ag + 1) - ag) / 300; if (aE.length){for (aU = 0; aU < aE.length; aU++){var aI = aE[aU]; var aO = new this.tickRenderer(this.tickOptions); if (H.isArray(aI)){aO.value = aI[0]; if (this.breakPoints){if (aI[0] == this.breakPoints[0]){aO.label = this.breakTickLabel; aO._breakTick = true; aO.showGridline = false; aO.showMark = false} else{if (aI[0] > this.breakPoints[0] && aI[0] <= this.breakPoints[1]){aO.show = false; aO.showGridline = false; aO.label = aI[1]} else{aO.label = aI[1]}}} else{aO.label = aI[1]}aO.setTick(aI[0], this.name); this._ticks.push(aO)} else{if (H.isPlainObject(aI)){H.extend(true, aO, aI); aO.axis = this.name; this._ticks.push(aO)} else{aO.value = aI; if (this.breakPoints){if (aI == this.breakPoints[0]){aO.label = this.breakTickLabel; aO._breakTick = true; aO.showGridline = false; aO.showMark = false} else{if (aI > this.breakPoints[0] && aI <= this.breakPoints[1]){aO.show = false; aO.showGridline = false}}}aO.setTick(aI, this.name); this._ticks.push(aO)}}}this.numberTicks = aE.length; this.min = this._ticks[0].value; this.max = this._ticks[this.numberTicks - 1].value; this.tickInterval = (this.max - this.min) / (this.numberTicks - 1)} else{if (at == "xaxis" || at == "x2axis"){ab = this._plotDimensions.width} else{ab = this._plotDimensions.height}var aq = this.numberTicks; if (this.alignTicks){if (this.name === "x2axis" && ad.axes.xaxis.show){aq = ad.axes.xaxis.numberTicks} else{if (this.name.charAt(0) === "y" && this.name !== "yaxis" && this.name !== "yMidAxis" && ad.axes.yaxis.show){aq = ad.axes.yaxis.numberTicks}}}a0 = ((this.min != null)?this.min:av.min); aC = ((this.max != null)?this.max:av.max); var ao = aC - a0; var aM, ar; var am; if (this.tickOptions == null || !this.tickOptions.formatString){this._overrideFormatString = true}if (this.min == null || this.max == null && this.tickInterval == null && !this.autoscale){if (this.forceTickAt0){if (a0 > 0){a0 = 0}if (aC < 0){aC = 0}}if (this.forceTickAt100){if (a0 > 100){a0 = 100}if (aC < 100){aC = 100}}var ay = false, aV = false; if (this.min != null){ay = true} else{if (this.max != null){aV = true}}var aJ = H.jqplot.LinearTickGenerator(a0, aC, this._scalefact, aq, ay, aV); var ap = (this.min != null)?a0:a0 + ao * (this.padMin - 1); var aK = (this.max != null)?aC:aC - ao * (this.padMax - 1); if (a0 < ap || aC > aK){ap = (this.min != null)?a0:a0 - ao * (this.padMin - 1); aK = (this.max != null)?aC:aC + ao * (this.padMax - 1); aJ = H.jqplot.LinearTickGenerator(ap, aK, this._scalefact, aq, ay, aV)}this.min = aJ[0]; this.max = aJ[1]; this.numberTicks = aJ[2]; this._autoFormatString = aJ[3]; this.tickInterval = aJ[4]} else{if (a0 == aC){var ac = 0.05; if (a0 > 0){ac = Math.max(Math.log(a0) / Math.LN10, 0.05)}a0 -= ac; aC += ac}if (this.autoscale && this.min == null && this.max == null){var ae, af, al; var aw = false; var aH = false; var au = {min:null, max:null, average:null, stddev:null}; for (var aU = 0; aU < this._series.length; aU++){var aP = this._series[aU]; var ax = (aP.fillAxis == "x")?aP._xaxis.name:aP._yaxis.name; if (this.name == ax){var aL = aP._plotValues[aP.fillAxis]; var aA = aL[0]; var aW = aL[0]; for (var aT = 1; aT < aL.length; aT++){if (aL[aT] < aA){aA = aL[aT]} else{if (aL[aT] > aW){aW = aL[aT]}}}var an = (aW - aA) / aW; if (aP.renderer.constructor == H.jqplot.BarRenderer){if (aA >= 0 && (aP.fillToZero || an > 0.1)){aw = true} else{aw = false; if (aP.fill && aP.fillToZero && aA < 0 && aW > 0){aH = true} else{aH = false}}} else{if (aP.fill){if (aA >= 0 && (aP.fillToZero || an > 0.1)){aw = true} else{if (aA < 0 && aW > 0 && aP.fillToZero){aw = false; aH = true} else{aw = false; aH = false}}} else{if (aA < 0){aw = false}}}}}if (aw){this.numberTicks = 2 + Math.ceil((ab - (this.tickSpacing - 1)) / this.tickSpacing); this.min = 0; aB = 0; af = aC / (this.numberTicks - 1); am = Math.pow(10, Math.abs(Math.floor(Math.log(af) / Math.LN10))); if (af / am == parseInt(af / am, 10)){af += am}this.tickInterval = Math.ceil(af / am) * am; this.max = this.tickInterval * (this.numberTicks - 1)} else{if (aH){this.numberTicks = 2 + Math.ceil((ab - (this.tickSpacing - 1)) / this.tickSpacing); var aD = Math.ceil(Math.abs(a0) / ao * (this.numberTicks - 1)); var a3 = this.numberTicks - 1 - aD; af = Math.max(Math.abs(a0 / aD), Math.abs(aC / a3)); am = Math.pow(10, Math.abs(Math.floor(Math.log(af) / Math.LN10))); this.tickInterval = Math.ceil(af / am) * am; this.max = this.tickInterval * a3; this.min = - this.tickInterval * aD} else{if (this.numberTicks == null){if (this.tickInterval){this.numberTicks = 3 + Math.ceil(ao / this.tickInterval)} else{this.numberTicks = 2 + Math.ceil((ab - (this.tickSpacing - 1)) / this.tickSpacing)}}if (this.tickInterval == null){af = ao / (this.numberTicks - 1); if (af < 1){am = Math.pow(10, Math.abs(Math.floor(Math.log(af) / Math.LN10)))} else{am = 1}this.tickInterval = Math.ceil(af * am * this.pad) / am} else{am = 1 / this.tickInterval}ae = this.tickInterval * (this.numberTicks - 1); al = (ae - ao) / 2; if (this.min == null){this.min = Math.floor(am * (a0 - al)) / am}if (this.max == null){this.max = this.min + ae}}}var az = H.jqplot.getSignificantFigures(this.tickInterval); var aG; if (az.digitsLeft >= az.significantDigits){aG = "%d"} else{var am = Math.max(0, 5 - az.digitsLeft); am = Math.min(am, az.digitsRight); aG = "%." + am + "f"}this._autoFormatString = aG} else{aM = (this.min != null)?this.min:a0 - ao * (this.padMin - 1); ar = (this.max != null)?this.max:aC + ao * (this.padMax - 1); ao = ar - aM; if (this.numberTicks == null){if (this.tickInterval != null){this.numberTicks = Math.ceil((ar - aM) / this.tickInterval) + 1} else{if (ab > 100){this.numberTicks = parseInt(3 + (ab - 100) / 75, 10)} else{this.numberTicks = 2}}}if (this.tickInterval == null){this.tickInterval = ao / (this.numberTicks - 1)}if (this.max == null){ar = aM + this.tickInterval * (this.numberTicks - 1)}if (this.min == null){aM = ar - this.tickInterval * (this.numberTicks - 1)}var az = H.jqplot.getSignificantFigures(this.tickInterval); var aG; if (az.digitsLeft >= az.significantDigits){aG = "%d"} else{var am = Math.max(0, 5 - az.digitsLeft); am = Math.min(am, az.digitsRight); aG = "%." + am + "f"}this._autoFormatString = aG; this.min = aM; this.max = ar}if (this.renderer.constructor == H.jqplot.LinearAxisRenderer && this._autoFormatString == ""){ao = this.max - this.min; var a1 = new this.tickRenderer(this.tickOptions); var aF = a1.formatString || H.jqplot.config.defaultTickFormatString; var aF = aF.match(H.jqplot.sprintf.regex)[0]; var aX = 0; if (aF){if (aF.search(/[fFeEgGpP]/) > - 1){var aS = aF.match(/\%\.(\d{0,})?[eEfFgGpP]/); if (aS){aX = parseInt(aS[1], 10)} else{aX = 6}} else{if (aF.search(/[di]/) > - 1){aX = 0}}var ak = Math.pow(10, - aX); if (this.tickInterval < ak){if (aQ == null && a4 == null){this.tickInterval = ak; if (aZ == null && aB == null){this.min = Math.floor(this._dataBounds.min / ak) * ak; if (this.min == this._dataBounds.min){this.min = this._dataBounds.min - this.tickInterval}this.max = Math.ceil(this._dataBounds.max / ak) * ak; if (this.max == this._dataBounds.max){this.max = this._dataBounds.max + this.tickInterval}var aR = (this.max - this.min) / this.tickInterval; aR = aR.toFixed(11); aR = Math.ceil(aR); this.numberTicks = aR + 1} else{if (aZ == null){var aR = (this._dataBounds.max - this.min) / this.tickInterval; aR = aR.toFixed(11); this.numberTicks = Math.ceil(aR) + 2; this.max = this.min + this.tickInterval * (this.numberTicks - 1)} else{if (aB == null){var aR = (this.max - this._dataBounds.min) / this.tickInterval; aR = aR.toFixed(11); this.numberTicks = Math.ceil(aR) + 2; this.min = this.max - this.tickInterval * (this.numberTicks - 1)} else{this.numberTicks = Math.ceil((aZ - aB) / this.tickInterval) + 1; this.min = Math.floor(aB * Math.pow(10, aX)) / Math.pow(10, aX); this.max = Math.ceil(aZ * Math.pow(10, aX)) / Math.pow(10, aX); this.numberTicks = Math.ceil((this.max - this.min) / this.tickInterval) + 1}}}}}}}}if (this._overrideFormatString && this._autoFormatString != ""){this.tickOptions = this.tickOptions || {}; this.tickOptions.formatString = this._autoFormatString}var aO, a2; for (var aU = 0; aU < this.numberTicks; aU++){aY = this.min + aU * this.tickInterval; aO = new this.tickRenderer(this.tickOptions); aO.setTick(aY, this.name); this._ticks.push(aO); if (aU < this.numberTicks - 1){for (var aT = 0; aT < this.minorTicks; aT++){aY += this.tickInterval / (this.minorTicks + 1); a2 = H.extend(true, {}, this.tickOptions, {name:this.name, value:aY, label:"", isMinorTick:true}); aO = new this.tickRenderer(a2); this._ticks.push(aO)}}aO = null}}if (this.tickInset){this.min = this.min - this.tickInset * this.tickInterval; this.max = this.max + this.tickInset * this.tickInterval}aN = null}; H.jqplot.LinearAxisRenderer.prototype.resetTickValues = function(ad){if (H.isArray(ad) && ad.length == this._ticks.length){var ac; for (var ab = 0; ab < ad.length; ab++){ac = this._ticks[ab]; ac.value = ad[ab]; ac.label = ac.formatter(ac.formatString, ad[ab]); ac.label = ac.prefix + ac.label; ac._elem.html(ac.label)}ac = null; this.min = H.jqplot.arrayMin(ad); this.max = H.jqplot.arrayMax(ad); this.pack()}}; H.jqplot.LinearAxisRenderer.prototype.pack = function(ad, ac){ad = ad || {}; ac = ac || this._offsets; var ar = this._ticks; var an = this.max; var am = this.min; var ai = ac.max; var ag = ac.min; var ak = (this._label == null)?false:this._label.show; for (var al in ad){this._elem.css(al, ad[al])}this._offsets = ac; var ae = ai - ag; var af = an - am; if (this.breakPoints){af = af - this.breakPoints[1] + this.breakPoints[0]; this.p2u = function(au){return(au - ag) * af / ae + am}; this.u2p = function(au){if (au > this.breakPoints[0] && au < this.breakPoints[1]){au = this.breakPoints[0]}if (au <= this.breakPoints[0]){return(au - am) * ae / af + ag} else{return(au - this.breakPoints[1] + this.breakPoints[0] - am) * ae / af + ag}}; if (this.name.charAt(0) == "x"){this.series_u2p = function(au){if (au > this.breakPoints[0] && au < this.breakPoints[1]){au = this.breakPoints[0]}if (au <= this.breakPoints[0]){return(au - am) * ae / af} else{return(au - this.breakPoints[1] + this.breakPoints[0] - am) * ae / af}}; this.series_p2u = function(au){return au * af / ae + am}} else{this.series_u2p = function(au){if (au > this.breakPoints[0] && au < this.breakPoints[1]){au = this.breakPoints[0]}if (au >= this.breakPoints[1]){return(au - an) * ae / af} else{return(au + this.breakPoints[1] - this.breakPoints[0] - an) * ae / af}}; this.series_p2u = function(au){return au * af / ae + an}}} else{this.p2u = function(au){return(au - ag) * af / ae + am}; this.u2p = function(au){return(au - am) * ae / af + ag}; if (this.name == "xaxis" || this.name == "x2axis"){this.series_u2p = function(au){return(au - am) * ae / af}; this.series_p2u = function(au){return au * af / ae + am}} else{this.series_u2p = function(au){return(au - an) * ae / af}; this.series_p2u = function(au){return au * af / ae + an}}}if (this.show){if (this.name == "xaxis" || this.name == "x2axis"){for (var ao = 0; ao < ar.length; ao++){var aj = ar[ao]; if (aj.show && aj.showLabel){var ab; if (aj.constructor == H.jqplot.CanvasAxisTickRenderer && aj.angle){var aq = (this.name == "xaxis")?1: - 1; switch (aj.labelPosition){case"auto":if (aq * aj.angle < 0){ab = - aj.getWidth() + aj._textRenderer.height * Math.sin( - aj._textRenderer.angle) / 2} else{ab = - aj._textRenderer.height * Math.sin(aj._textRenderer.angle) / 2}break; case"end":ab = - aj.getWidth() + aj._textRenderer.height * Math.sin( - aj._textRenderer.angle) / 2; break; case"start":ab = - aj._textRenderer.height * Math.sin(aj._textRenderer.angle) / 2; break; case"middle":ab = - aj.getWidth() / 2 + aj._textRenderer.height * Math.sin( - aj._textRenderer.angle) / 2; break; default:ab = - aj.getWidth() / 2 + aj._textRenderer.height * Math.sin( - aj._textRenderer.angle) / 2; break}} else{ab = - aj.getWidth() / 2}var at = this.u2p(aj.value) + ab + "px"; aj._elem.css("left", at); aj.pack()}}if (ak){var ah = this._label._elem.outerWidth(true); this._label._elem.css("left", ag + ae / 2 - ah / 2 + "px"); if (this.name == "xaxis"){this._label._elem.css("bottom", "0px")} else{this._label._elem.css("top", "0px")}this._label.pack()}} else{for (var ao = 0; ao < ar.length; ao++){var aj = ar[ao]; if (aj.show && aj.showLabel){var ab; if (aj.constructor == H.jqplot.CanvasAxisTickRenderer && aj.angle){var aq = (this.name == "yaxis")?1: - 1; switch (aj.labelPosition){case"auto":case"end":if (aq * aj.angle < 0){ab = - aj._textRenderer.height * Math.cos( - aj._textRenderer.angle) / 2} else{ab = - aj.getHeight() + aj._textRenderer.height * Math.cos(aj._textRenderer.angle) / 2}break; case"start":if (aj.angle > 0){ab = - aj._textRenderer.height * Math.cos( - aj._textRenderer.angle) / 2} else{ab = - aj.getHeight() + aj._textRenderer.height * Math.cos(aj._textRenderer.angle) / 2}break; case"middle":ab = - aj.getHeight() / 2; break; default:ab = - aj.getHeight() / 2; break}} else{ab = - aj.getHeight() / 2}var at = this.u2p(aj.value) + ab + "px"; aj._elem.css("top", at); aj.pack()}}if (ak){var ap = this._label._elem.outerHeight(true); this._label._elem.css("top", ai - ae / 2 - ap / 2 + "px"); if (this.name == "yaxis"){this._label._elem.css("left", "0px")} else{this._label._elem.css("right", "0px")}this._label.pack()}}}ar = null}; function h(ac){var ab; ac = Math.abs(ac); if (ac >= 10){ab = "%d"} else{if (ac > 1){if (ac === parseInt(ac, 10)){ab = "%d"} else{ab = "%.1f"}} else{var ad = - Math.floor(Math.log(ac) / Math.LN10); ab = "%." + ad + "f"}}return ab}var a = [0.1, 0.2, 0.3, 0.4, 0.5, 0.8, 1, 2, 3, 4, 5]; var b = function(ac){var ab = a.indexOf(ac); if (ab > 0){return a[ab - 1]} else{return a[a.length - 1] / 100}}; var i = function(ac){var ab = a.indexOf(ac); if (ab < a.length - 1){return a[ab + 1]} else{return a[0] * 100}}; function c(af, an, am){var ak = Math.floor(am / 2); var ac = Math.ceil(am * 1.5); var ae = Number.MAX_VALUE; var ab = (an - af); var aq; var aj; var al; var ar = H.jqplot.getSignificantFigures; var ap; var ah; var ai; var ao; for (var ag = 0, ad = ac - ak + 1; ag < ad; ag++){ai = ak + ag; aq = ab / (ai - 1); aj = ar(aq); aq = Math.abs(am - ai) + aj.digitsRight; if (aq < ae){ae = aq; al = ai; ao = aj.digitsRight} else{if (aq === ae){if (aj.digitsRight < ao){al = ai; ao = aj.digitsRight}}}}ap = Math.max(ao, Math.max(ar(af).digitsRight, ar(an).digitsRight)); if (ap === 0){ah = "%d"} else{ah = "%." + ap + "f"}aq = ab / (al - 1); return[af, an, al, ah, aq]}function S(ac, af){af = af || 7; var ae = ac / (af - 1); var ad = Math.pow(10, Math.floor(Math.log(ae) / Math.LN10)); var ag = ae / ad; var ab; if (ad < 1){if (ag > 5){ab = 10 * ad} else{if (ag > 2){ab = 5 * ad} else{if (ag > 1){ab = 2 * ad} else{ab = ad}}}} else{if (ag > 5){ab = 10 * ad} else{if (ag > 4){ab = 5 * ad} else{if (ag > 3){ab = 4 * ad} else{if (ag > 2){ab = 3 * ad} else{if (ag > 1){ab = 2 * ad} else{ab = ad}}}}}}return ab}function M(ac, ab){ab = ab || 1; var ae = Math.floor(Math.log(ac) / Math.LN10); var ag = Math.pow(10, ae); var af = ac / ag; var ad; af = af / ab; if (af <= 0.38){ad = 0.1} else{if (af <= 1.6){ad = 0.2} else{if (af <= 4){ad = 0.5} else{if (af <= 8){ad = 1} else{if (af <= 16){ad = 2} else{ad = 5}}}}}return ad * ag}function t(ad, ac){var af = Math.floor(Math.log(ad) / Math.LN10); var ah = Math.pow(10, af); var ag = ad / ah; var ab; var ae; ag = ag / ac; if (ag <= 0.38){ae = 0.1} else{if (ag <= 1.6){ae = 0.2} else{if (ag <= 4){ae = 0.5} else{if (ag <= 8){ae = 1} else{if (ag <= 16){ae = 2} else{ae = 5}}}}}ab = ae * ah; return[ab, ae, ah]}H.jqplot.LinearTickGenerator = function(ah, ak, ad, ae, ai, al){ai = (ai === null)?false:ai; al = (al === null || ai)?false:al; if (ah === ak){ak = (ak)?0:1}ad = ad || 1; if (ak < ah){var am = ak; ak = ah; ah = am}var ac = []; var ap = M(ak - ah, ad); var ao = H.jqplot.getSignificantFigures; if (ae == null){if (!ai && !al){ac[0] = Math.floor(ah / ap) * ap; ac[1] = Math.ceil(ak / ap) * ap; ac[2] = Math.round((ac[1] - ac[0]) / ap + 1); ac[3] = h(ap); ac[4] = ap} else{if (ai){ac[0] = ah; ac[2] = Math.ceil((ak - ah) / ap + 1); ac[1] = ah + (ac[2] - 1) * ap; var an = ao(ah).digitsRight; var aj = ao(ap).digitsRight; if (an < aj){ac[3] = h(ap)} else{ac[3] = "%." + an + "f"}ac[4] = ap} else{if (al){ac[1] = ak; ac[2] = Math.ceil((ak - ah) / ap + 1); ac[0] = ak - (ac[2] - 1) * ap; var af = ao(ak).digitsRight; var aj = ao(ap).digitsRight; if (af < aj){ac[3] = h(ap)} else{ac[3] = "%." + af + "f"}ac[4] = ap}}}} else{var ag = []; ag[0] = Math.floor(ah / ap) * ap; ag[1] = Math.ceil(ak / ap) * ap; ag[2] = Math.round((ag[1] - ag[0]) / ap + 1); ag[3] = h(ap); ag[4] = ap; if (ag[2] === ae){ac = ag} else{var ab = S(ag[1] - ag[0], ae); ac[0] = ag[0]; ac[2] = ae; ac[4] = ab; ac[3] = h(ab); ac[1] = ac[0] + (ac[2] - 1) * ac[4]}}return ac}; H.jqplot.LinearTickGenerator.bestLinearInterval = M; H.jqplot.LinearTickGenerator.bestInterval = S; H.jqplot.LinearTickGenerator.bestLinearComponents = t; H.jqplot.LinearTickGenerator.bestConstrainedInterval = c; H.jqplot.MarkerRenderer = function(ab){this.show = true; this.style = "filledCircle"; this.lineWidth = 2; this.size = 9; this.color = "#666666"; this.shadow = true; this.shadowAngle = 45; this.shadowOffset = 1; this.shadowDepth = 3; this.shadowAlpha = "0.07"; this.shadowRenderer = new H.jqplot.ShadowRenderer(); this.shapeRenderer = new H.jqplot.ShapeRenderer(); H.extend(true, this, ab)}; H.jqplot.MarkerRenderer.prototype.init = function(ab){H.extend(true, this, ab); var ad = {angle:this.shadowAngle, offset:this.shadowOffset, alpha:this.shadowAlpha, lineWidth:this.lineWidth, depth:this.shadowDepth, closePath:true}; if (this.style.indexOf("filled") != - 1){ad.fill = true}if (this.style.indexOf("ircle") != - 1){ad.isarc = true; ad.closePath = false}this.shadowRenderer.init(ad); var ac = {fill:false, isarc:false, strokeStyle:this.color, fillStyle:this.color, lineWidth:this.lineWidth, closePath:true}; if (this.style.indexOf("filled") != - 1){ac.fill = true}if (this.style.indexOf("ircle") != - 1){ac.isarc = true; ac.closePath = false}this.shapeRenderer.init(ac)}; H.jqplot.MarkerRenderer.prototype.drawDiamond = function(ad, ac, ag, af, ai){var ab = 1.2; var aj = this.size / 2 / ab; var ah = this.size / 2 * ab; var ae = [[ad - aj, ac], [ad, ac + ah], [ad + aj, ac], [ad, ac - ah]]; if (this.shadow){this.shadowRenderer.draw(ag, ae)}this.shapeRenderer.draw(ag, ae, ai)}; H.jqplot.MarkerRenderer.prototype.drawPlus = function(ae, ad, ah, ag, ak){var ac = 1; var al = this.size / 2 * ac; var ai = this.size / 2 * ac; var aj = [[ae, ad - ai], [ae, ad + ai]]; var af = [[ae + al, ad], [ae - al, ad]]; var ab = H.extend(true, {}, this.options, {closePath:false}); if (this.shadow){this.shadowRenderer.draw(ah, aj, {closePath:false}); this.shadowRenderer.draw(ah, af, {closePath:false})}this.shapeRenderer.draw(ah, aj, ab); this.shapeRenderer.draw(ah, af, ab)}; H.jqplot.MarkerRenderer.prototype.drawX = function(ae, ad, ah, ag, ak){var ac = 1; var al = this.size / 2 * ac; var ai = this.size / 2 * ac; var ab = H.extend(true, {}, this.options, {closePath:false}); var aj = [[ae - al, ad - ai], [ae + al, ad + ai]]; var af = [[ae - al, ad + ai], [ae + al, ad - ai]]; if (this.shadow){this.shadowRenderer.draw(ah, aj, {closePath:false}); this.shadowRenderer.draw(ah, af, {closePath:false})}this.shapeRenderer.draw(ah, aj, ab); this.shapeRenderer.draw(ah, af, ab)}; H.jqplot.MarkerRenderer.prototype.drawDash = function(ad, ac, ag, af, ai){var ab = 1; var aj = this.size / 2 * ab; var ah = this.size / 2 * ab; var ae = [[ad - aj, ac], [ad + aj, ac]]; if (this.shadow){this.shadowRenderer.draw(ag, ae)}this.shapeRenderer.draw(ag, ae, ai)}; H.jqplot.MarkerRenderer.prototype.drawLine = function(ag, af, ab, ae, ac){var ad = [ag, af]; if (this.shadow){this.shadowRenderer.draw(ab, ad)}this.shapeRenderer.draw(ab, ad, ac)}; H.jqplot.MarkerRenderer.prototype.drawSquare = function(ad, ac, ag, af, ai){var ab = 1; var aj = this.size / 2 / ab; var ah = this.size / 2 * ab; var ae = [[ad - aj, ac - ah], [ad - aj, ac + ah], [ad + aj, ac + ah], [ad + aj, ac - ah]]; if (this.shadow){this.shadowRenderer.draw(ag, ae)}this.shapeRenderer.draw(ag, ae, ai)}; H.jqplot.MarkerRenderer.prototype.drawCircle = function(ac, ai, ae, ah, af){var ab = this.size / 2; var ad = 2 * Math.PI; var ag = [ac, ai, ab, 0, ad, true]; if (this.shadow){this.shadowRenderer.draw(ae, ag)}this.shapeRenderer.draw(ae, ag, af)}; H.jqplot.MarkerRenderer.prototype.draw = function(ab, ae, ac, ad){ad = ad || {}; if (ad.show == null || ad.show != false){if (ad.color && !ad.fillStyle){ad.fillStyle = ad.color}if (ad.color && !ad.strokeStyle){ad.strokeStyle = ad.color}switch (this.style){case"diamond":this.drawDiamond(ab, ae, ac, false, ad); break; case"filledDiamond":this.drawDiamond(ab, ae, ac, true, ad); break; case"circle":this.drawCircle(ab, ae, ac, false, ad); break; case"filledCircle":this.drawCircle(ab, ae, ac, true, ad); break; case"square":this.drawSquare(ab, ae, ac, false, ad); break; case"filledSquare":this.drawSquare(ab, ae, ac, true, ad); break; case"x":this.drawX(ab, ae, ac, true, ad); break; case"plus":this.drawPlus(ab, ae, ac, true, ad); break; case"dash":this.drawDash(ab, ae, ac, true, ad); break; case"line":this.drawLine(ab, ae, ac, false, ad); break; default:this.drawDiamond(ab, ae, ac, false, ad); break}}}; H.jqplot.ShadowRenderer = function(ab){this.angle = 45; this.offset = 1; this.alpha = 0.07; this.lineWidth = 1.5; this.lineJoin = "miter"; this.lineCap = "round"; this.closePath = false; this.fill = false; this.depth = 3; this.strokeStyle = "rgba(0,0,0,0.1)"; this.isarc = false; H.extend(true, this, ab)}; H.jqplot.ShadowRenderer.prototype.init = function(ab){H.extend(true, this, ab)}; H.jqplot.ShadowRenderer.prototype.draw = function(ao, am, aq){ao.save(); var ab = (aq != null)?aq:{}; var an = (ab.fill != null)?ab.fill:this.fill; var aj = (ab.fillRect != null)?ab.fillRect:this.fillRect; var ai = (ab.closePath != null)?ab.closePath:this.closePath; var af = (ab.offset != null)?ab.offset:this.offset; var ad = (ab.alpha != null)?ab.alpha:this.alpha; var ah = (ab.depth != null)?ab.depth:this.depth; var ap = (ab.isarc != null)?ab.isarc:this.isarc; var ak = (ab.linePattern != null)?ab.linePattern:this.linePattern; ao.lineWidth = (ab.lineWidth != null)?ab.lineWidth:this.lineWidth; ao.lineJoin = (ab.lineJoin != null)?ab.lineJoin:this.lineJoin; ao.lineCap = (ab.lineCap != null)?ab.lineCap:this.lineCap; ao.strokeStyle = ab.strokeStyle || this.strokeStyle || "rgba(0,0,0," + ad + ")"; ao.fillStyle = ab.fillStyle || this.fillStyle || "rgba(0,0,0," + ad + ")"; for (var ae = 0; ae < ah; ae++){var al = H.jqplot.LinePattern(ao, ak); ao.translate(Math.cos(this.angle * Math.PI / 180) * af, Math.sin(this.angle * Math.PI / 180) * af); al.beginPath(); if (ap){ao.arc(am[0], am[1], am[2], am[3], am[4], true)} else{if (aj){if (aj){ao.fillRect(am[0], am[1], am[2], am[3])}} else{if (am && am.length){var ac = true; for (var ag = 0; ag < am.length; ag++){if (am[ag][0] != null && am[ag][1] != null){if (ac){al.moveTo(am[ag][0], am[ag][1]); ac = false} else{al.lineTo(am[ag][0], am[ag][1])}} else{ac = true}}}}}if (ai){al.closePath()}if (an){ao.fill()} else{ao.stroke()}}ao.restore()}; H.jqplot.ShapeRenderer = function(ab){this.lineWidth = 1.5; this.linePattern = "solid"; this.lineJoin = "miter"; this.lineCap = "round"; this.closePath = false; this.fill = false; this.isarc = false; this.fillRect = false; this.strokeRect = false; this.clearRect = false; this.strokeStyle = "#999999"; this.fillStyle = "#999999"; H.extend(true, this, ab)}; H.jqplot.ShapeRenderer.prototype.init = function(ab){H.extend(true, this, ab)}; H.jqplot.ShapeRenderer.prototype.draw = function(am, ak, ao){am.save(); var ab = (ao != null)?ao:{}; var al = (ab.fill != null)?ab.fill:this.fill; var ag = (ab.closePath != null)?ab.closePath:this.closePath; var ah = (ab.fillRect != null)?ab.fillRect:this.fillRect; var ae = (ab.strokeRect != null)?ab.strokeRect:this.strokeRect; var ac = (ab.clearRect != null)?ab.clearRect:this.clearRect; var an = (ab.isarc != null)?ab.isarc:this.isarc; var ai = (ab.linePattern != null)?ab.linePattern:this.linePattern; var aj = H.jqplot.LinePattern(am, ai); am.lineWidth = ab.lineWidth || this.lineWidth; am.lineJoin = ab.lineJoin || this.lineJoin; am.lineCap = ab.lineCap || this.lineCap; am.strokeStyle = (ab.strokeStyle || ab.color) || this.strokeStyle; am.fillStyle = ab.fillStyle || this.fillStyle; am.beginPath(); if (an){am.arc(ak[0], ak[1], ak[2], ak[3], ak[4], true); if (ag){am.closePath()}if (al){am.fill()} else{am.stroke()}am.restore(); return} else{if (ac){am.clearRect(ak[0], ak[1], ak[2], ak[3]); am.restore(); return} else{if (ah || ae){if (ah){am.fillRect(ak[0], ak[1], ak[2], ak[3])}if (ae){am.strokeRect(ak[0], ak[1], ak[2], ak[3]); am.restore(); return}} else{if (ak && ak.length){var ad = true; for (var af = 0; af < ak.length; af++){if (ak[af][0] != null && ak[af][1] != null){if (ad){aj.moveTo(ak[af][0], ak[af][1]); ad = false} else{aj.lineTo(ak[af][0], ak[af][1])}} else{ad = true}}if (ag){aj.closePath()}if (al){am.fill()} else{am.stroke()}}}}}am.restore()}; H.jqplot.TableLegendRenderer = function(){}; H.jqplot.TableLegendRenderer.prototype.init = function(ab){H.extend(true, this, ab)}; H.jqplot.TableLegendRenderer.prototype.addrow = function(ak, ae, ab, ai){var af = (ab)?this.rowSpacing + "px":"0px"; var aj; var ad; var ac; var ah; var ag; ac = document.createElement("tr"); aj = H(ac); aj.addClass("jqplot-table-legend"); ac = null; if (ai){aj.prependTo(this._elem)} else{aj.appendTo(this._elem)}if (this.showSwatches){ad = H(document.createElement("td")); ad.addClass("jqplot-table-legend jqplot-table-legend-swatch"); ad.css({textAlign:"center", paddingTop:af}); ah = H(document.createElement("div")); ah.addClass("jqplot-table-legend-swatch-outline"); ag = H(document.createElement("div")); ag.addClass("jqplot-table-legend-swatch"); ag.css({backgroundColor:ae, borderColor:ae}); aj.append(ad.append(ah.append(ag)))}if (this.showLabels){ad = H(document.createElement("td")); ad.addClass("jqplot-table-legend jqplot-table-legend-label"); ad.css("paddingTop", af); aj.append(ad); if (this.escapeHtml){ad.text(ak)} else{ad.html(ak)}}ad = null; ah = null; ag = null; aj = null; ac = null}; H.jqplot.TableLegendRenderer.prototype.draw = function(){if (this._elem){this._elem.emptyForce(); this._elem = null}if (this.show){var ag = this._series; var ac = document.createElement("table"); this._elem = H(ac); this._elem.addClass("jqplot-table-legend"); var al = {position:"absolute"}; if (this.background){al.background = this.background}if (this.border){al.border = this.border}if (this.fontSize){al.fontSize = this.fontSize}if (this.fontFamily){al.fontFamily = this.fontFamily}if (this.textColor){al.textColor = this.textColor}if (this.marginTop != null){al.marginTop = this.marginTop}if (this.marginBottom != null){al.marginBottom = this.marginBottom}if (this.marginLeft != null){al.marginLeft = this.marginLeft}if (this.marginRight != null){al.marginRight = this.marginRight}var ab = false, ai = false, ak; for (var ah = 0; ah < ag.length; ah++){ak = ag[ah]; if (ak._stack || ak.renderer.constructor == H.jqplot.BezierCurveRenderer){ai = true}if (ak.show && ak.showLabel){var af = this.labels[ah] || ak.label.toString(); if (af){var ad = ak.color; if (ai && ah < ag.length - 1){ab = true} else{if (ai && ah == ag.length - 1){ab = false}}this.renderer.addrow.call(this, af, ad, ab, ai); ab = true}for (var ae = 0; ae < H.jqplot.addLegendRowHooks.length; ae++){var aj = H.jqplot.addLegendRowHooks[ae].call(this, ak); if (aj){this.renderer.addrow.call(this, aj.label, aj.color, ab); ab = true}}af = null}}}return this._elem}; H.jqplot.TableLegendRenderer.prototype.pack = function(ad){if (this.show){if (this.placement == "insideGrid"){switch (this.location){case"nw":var ac = ad.left; var ab = ad.top; this._elem.css("left", ac); this._elem.css("top", ab); break; case"n":var ac = (ad.left + (this._plotDimensions.width - ad.right)) / 2 - this.getWidth() / 2; var ab = ad.top; this._elem.css("left", ac); this._elem.css("top", ab); break; case"ne":var ac = ad.right; var ab = ad.top; this._elem.css({right:ac, top:ab}); break; case"e":var ac = ad.right; var ab = (ad.top + (this._plotDimensions.height - ad.bottom)) / 2 - this.getHeight() / 2; this._elem.css({right:ac, top:ab}); break; case"se":var ac = ad.right; var ab = ad.bottom; this._elem.css({right:ac, bottom:ab}); break; case"s":var ac = (ad.left + (this._plotDimensions.width - ad.right)) / 2 - this.getWidth() / 2; var ab = ad.bottom; this._elem.css({left:ac, bottom:ab}); break; case"sw":var ac = ad.left; var ab = ad.bottom; this._elem.css({left:ac, bottom:ab}); break; case"w":var ac = ad.left; var ab = (ad.top + (this._plotDimensions.height - ad.bottom)) / 2 - this.getHeight() / 2; this._elem.css({left:ac, top:ab}); break; default:var ac = ad.right; var ab = ad.bottom; this._elem.css({right:ac, bottom:ab}); break}} else{if (this.placement == "outside"){switch (this.location){case"nw":var ac = this._plotDimensions.width - ad.left; var ab = ad.top; this._elem.css("right", ac); this._elem.css("top", ab); break; case"n":var ac = (ad.left + (this._plotDimensions.width - ad.right)) / 2 - this.getWidth() / 2; var ab = this._plotDimensions.height - ad.top; this._elem.css("left", ac); this._elem.css("bottom", ab); break; case"ne":var ac = this._plotDimensions.width - ad.right; var ab = ad.top; this._elem.css({left:ac, top:ab}); break; case"e":var ac = this._plotDimensions.width - ad.right; var ab = (ad.top + (this._plotDimensions.height - ad.bottom)) / 2 - this.getHeight() / 2; this._elem.css({left:ac, top:ab}); break; case"se":var ac = this._plotDimensions.width - ad.right; var ab = ad.bottom; this._elem.css({left:ac, bottom:ab}); break; case"s":var ac = (ad.left + (this._plotDimensions.width - ad.right)) / 2 - this.getWidth() / 2; var ab = this._plotDimensions.height - ad.bottom; this._elem.css({left:ac, top:ab}); break; case"sw":var ac = this._plotDimensions.width - ad.left; var ab = ad.bottom; this._elem.css({right:ac, bottom:ab}); break; case"w":var ac = this._plotDimensions.width - ad.left; var ab = (ad.top + (this._plotDimensions.height - ad.bottom)) / 2 - this.getHeight() / 2; this._elem.css({right:ac, top:ab}); break; default:var ac = ad.right; var ab = ad.bottom; this._elem.css({right:ac, bottom:ab}); break}} else{switch (this.location){case"nw":this._elem.css({left:0, top:ad.top}); break; case"n":var ac = (ad.left + (this._plotDimensions.width - ad.right)) / 2 - this.getWidth() / 2; this._elem.css({left:ac, top:ad.top}); break; case"ne":this._elem.css({right:0, top:ad.top}); break; case"e":var ab = (ad.top + (this._plotDimensions.height - ad.bottom)) / 2 - this.getHeight() / 2; this._elem.css({right:ad.right, top:ab}); break; case"se":this._elem.css({right:ad.right, bottom:ad.bottom}); break; case"s":var ac = (ad.left + (this._plotDimensions.width - ad.right)) / 2 - this.getWidth() / 2; this._elem.css({left:ac, bottom:ad.bottom}); break; case"sw":this._elem.css({left:ad.left, bottom:ad.bottom}); break; case"w":var ab = (ad.top + (this._plotDimensions.height - ad.bottom)) / 2 - this.getHeight() / 2; this._elem.css({left:ad.left, top:ab}); break; default:this._elem.css({right:ad.right, bottom:ad.bottom}); break}}}}}; H.jqplot.ThemeEngine = function(){this.themes = {}; this.activeTheme = null}; H.jqplot.ThemeEngine.prototype.init = function(){var ae = new H.jqplot.Theme({_name:"Default"}); var ah, ac, ag; for (ah in ae.target){if (ah == "textColor"){ae.target[ah] = this.target.css("color")} else{ae.target[ah] = this.target.css(ah)}}if (this.title.show && this.title._elem){for (ah in ae.title){if (ah == "textColor"){ae.title[ah] = this.title._elem.css("color")} else{ae.title[ah] = this.title._elem.css(ah)}}}for (ah in ae.grid){ae.grid[ah] = this.grid[ah]}if (ae.grid.backgroundColor == null && this.grid.background != null){ae.grid.backgroundColor = this.grid.background}if (this.legend.show && this.legend._elem){for (ah in ae.legend){if (ah == "textColor"){ae.legend[ah] = this.legend._elem.css("color")} else{ae.legend[ah] = this.legend._elem.css(ah)}}}var ad; for (ac = 0; ac < this.series.length; ac++){ad = this.series[ac]; if (ad.renderer.constructor == H.jqplot.LineRenderer){ae.series.push(new m())} else{if (ad.renderer.constructor == H.jqplot.BarRenderer){ae.series.push(new P())} else{if (ad.renderer.constructor == H.jqplot.PieRenderer){ae.series.push(new e())} else{if (ad.renderer.constructor == H.jqplot.DonutRenderer){ae.series.push(new C())} else{if (ad.renderer.constructor == H.jqplot.FunnelRenderer){ae.series.push(new U())} else{if (ad.renderer.constructor == H.jqplot.MeterGaugeRenderer){ae.series.push(new z())} else{ae.series.push({})}}}}}}for (ah in ae.series[ac]){ae.series[ac][ah] = ad[ah]}}var ab, af; for (ah in this.axes){af = this.axes[ah]; ab = ae.axes[ah] = new L(); ab.borderColor = af.borderColor; ab.borderWidth = af.borderWidth; if (af._ticks && af._ticks[0]){for (ag in ab.ticks){if (af._ticks[0].hasOwnProperty(ag)){ab.ticks[ag] = af._ticks[0][ag]} else{if (af._ticks[0]._elem){ab.ticks[ag] = af._ticks[0]._elem.css(ag)}}}}if (af._label && af._label.show){for (ag in ab.label){if (af._label[ag]){ab.label[ag] = af._label[ag]} else{if (af._label._elem){if (ag == "textColor"){ab.label[ag] = af._label._elem.css("color")} else{ab.label[ag] = af._label._elem.css(ag)}}}}}}this.themeEngine._add(ae); this.themeEngine.activeTheme = this.themeEngine.themes[ae._name]}; H.jqplot.ThemeEngine.prototype.get = function(ab){if (!ab){return this.activeTheme} else{return this.themes[ab]}}; function K(ac, ab){return ac - ab}H.jqplot.ThemeEngine.prototype.getThemeNames = function(){var ab = []; for (var ac in this.themes){ab.push(ac)}return ab.sort(K)}; H.jqplot.ThemeEngine.prototype.getThemes = function(){var ac = []; var ab = []; for (var ae in this.themes){ac.push(ae)}ac.sort(K); for (var ad = 0; ad < ac.length; ad++){ab.push(this.themes[ac[ad]])}return ab}; H.jqplot.ThemeEngine.prototype.activate = function(ao, au){var ab = false; if (!au && this.activeTheme && this.activeTheme._name){au = this.activeTheme._name}if (!this.themes.hasOwnProperty(au)){throw new Error("No theme of that name")} else{var ag = this.themes[au]; this.activeTheme = ag; var at, am = false, al = false; var ac = ["xaxis", "x2axis", "yaxis", "y2axis"]; for (ap = 0; ap < ac.length; ap++){var ah = ac[ap]; if (ag.axesStyles.borderColor != null){ao.axes[ah].borderColor = ag.axesStyles.borderColor}if (ag.axesStyles.borderWidth != null){ao.axes[ah].borderWidth = ag.axesStyles.borderWidth}}for (var ar in ao.axes){var ae = ao.axes[ar]; if (ae.show){var ak = ag.axes[ar] || {}; var ai = ag.axesStyles; var af = H.jqplot.extend(true, {}, ak, ai); at = (ag.axesStyles.borderColor != null)?ag.axesStyles.borderColor:af.borderColor; if (af.borderColor != null){ae.borderColor = af.borderColor; ab = true}at = (ag.axesStyles.borderWidth != null)?ag.axesStyles.borderWidth:af.borderWidth; if (af.borderWidth != null){ae.borderWidth = af.borderWidth; ab = true}if (ae._ticks && ae._ticks[0]){for (var ad in af.ticks){at = af.ticks[ad]; if (at != null){ae.tickOptions[ad] = at; ae._ticks = []; ab = true}}}if (ae._label && ae._label.show){for (var ad in af.label){at = af.label[ad]; if (at != null){ae.labelOptions[ad] = at; ab = true}}}}}for (var an in ag.grid){if (ag.grid[an] != null){ao.grid[an] = ag.grid[an]}}if (!ab){ao.grid.draw()}if (ao.legend.show){for (an in ag.legend){if (ag.legend[an] != null){ao.legend[an] = ag.legend[an]}}}if (ao.title.show){for (an in ag.title){if (ag.title[an] != null){ao.title[an] = ag.title[an]}}}var ap; for (ap = 0; ap < ag.series.length; ap++){var aj = {}; var aq = false; for (an in ag.series[ap]){at = (ag.seriesStyles[an] != null)?ag.seriesStyles[an]:ag.series[ap][an]; if (at != null){aj[an] = at; if (an == "color"){ao.series[ap].renderer.shapeRenderer.fillStyle = at; ao.series[ap].renderer.shapeRenderer.strokeStyle = at; ao.series[ap][an] = at} else{if ((an == "lineWidth") || (an == "linePattern")){ao.series[ap].renderer.shapeRenderer[an] = at; ao.series[ap][an] = at} else{if (an == "markerOptions"){R(ao.series[ap].markerOptions, at); R(ao.series[ap].markerRenderer, at)} else{ao.series[ap][an] = at}}}ab = true}}}if (ab){ao.target.empty(); ao.draw()}for (an in ag.target){if (ag.target[an] != null){ao.target.css(an, ag.target[an])}}}}; H.jqplot.ThemeEngine.prototype._add = function(ac, ab){if (ab){ac._name = ab}if (!ac._name){ac._name = Date.parse(new Date())}if (!this.themes.hasOwnProperty(ac._name)){this.themes[ac._name] = ac} else{throw new Error("jqplot.ThemeEngine Error: Theme already in use")}}; H.jqplot.ThemeEngine.prototype.remove = function(ab){if (ab == "Default"){return false}return delete this.themes[ab]}; H.jqplot.ThemeEngine.prototype.newTheme = function(ab, ad){if (typeof (ab) == "object"){ad = ad || ab; ab = null}if (ad && ad._name){ab = ad._name} else{ab = ab || Date.parse(new Date())}var ac = this.copy(this.themes.Default._name, ab); H.jqplot.extend(ac, ad); return ac}; function x(ad){if (ad == null || typeof (ad) != "object"){return ad}var ab = new ad.constructor(); for (var ac in ad){ab[ac] = x(ad[ac])}return ab}H.jqplot.clone = x; function R(ad, ac){if (ac == null || typeof (ac) != "object"){return}for (var ab in ac){if (ab == "highlightColors"){ad[ab] = x(ac[ab])}if (ac[ab] != null && typeof (ac[ab]) == "object"){if (!ad.hasOwnProperty(ab)){ad[ab] = {}}R(ad[ab], ac[ab])} else{ad[ab] = ac[ab]}}}H.jqplot.merge = R; H.jqplot.extend = function(){var ag = arguments[0] || {}, ae = 1, af = arguments.length, ab = false, ad; if (typeof ag === "boolean"){ab = ag; ag = arguments[1] || {}; ae = 2}if (typeof ag !== "object" && !toString.call(ag) === "[object Function]"){ag = {}}for (; ae < af; ae++){if ((ad = arguments[ae]) != null){for (var ac in ad){var ah = ag[ac], ai = ad[ac]; if (ag === ai){continue}if (ab && ai && typeof ai === "object" && !ai.nodeType){ag[ac] = H.jqplot.extend(ab, ah || (ai.length != null?[]:{}), ai)} else{if (ai !== r){ag[ac] = ai}}}}}return ag}; H.jqplot.ThemeEngine.prototype.rename = function(ac, ab){if (ac == "Default" || ab == "Default"){throw new Error("jqplot.ThemeEngine Error: Cannot rename from/to Default")}if (this.themes.hasOwnProperty(ab)){throw new Error("jqplot.ThemeEngine Error: New name already in use.")} else{if (this.themes.hasOwnProperty(ac)){var ad = this.copy(ac, ab); this.remove(ac); return ad}}throw new Error("jqplot.ThemeEngine Error: Old name or new name invalid")}; H.jqplot.ThemeEngine.prototype.copy = function(ab, ad, af){if (ad == "Default"){throw new Error("jqplot.ThemeEngine Error: Cannot copy over Default theme")}if (!this.themes.hasOwnProperty(ab)){var ac = "jqplot.ThemeEngine Error: Source name invalid"; throw new Error(ac)}if (this.themes.hasOwnProperty(ad)){var ac = "jqplot.ThemeEngine Error: Target name invalid"; throw new Error(ac)} else{var ae = x(this.themes[ab]); ae._name = ad; H.jqplot.extend(true, ae, af); this._add(ae); return ae}}; H.jqplot.Theme = function(ab, ac){if (typeof (ab) == "object"){ac = ac || ab; ab = null}ab = ab || Date.parse(new Date()); this._name = ab; this.target = {backgroundColor:null}; this.legend = {textColor:null, fontFamily:null, fontSize:null, border:null, background:null}; this.title = {textColor:null, fontFamily:null, fontSize:null, textAlign:null}; this.seriesStyles = {}; this.series = []; this.grid = {drawGridlines:null, gridLineColor:null, gridLineWidth:null, backgroundColor:null, borderColor:null, borderWidth:null, shadow:null}; this.axesStyles = {label:{}, ticks:{}}; this.axes = {}; if (typeof (ac) == "string"){this._name = ac} else{if (typeof (ac) == "object"){H.jqplot.extend(true, this, ac)}}}; var L = function(){this.borderColor = null; this.borderWidth = null; this.ticks = new l(); this.label = new q()}; var l = function(){this.show = null; this.showGridline = null; this.showLabel = null; this.showMark = null; this.size = null; this.textColor = null; this.whiteSpace = null; this.fontSize = null; this.fontFamily = null}; var q = function(){this.textColor = null; this.whiteSpace = null; this.fontSize = null; this.fontFamily = null; this.fontWeight = null}; var m = function(){this.color = null; this.lineWidth = null; this.linePattern = null; this.shadow = null; this.fillColor = null; this.showMarker = null; this.markerOptions = new E()}; var E = function(){this.show = null; this.style = null; this.lineWidth = null; this.size = null; this.color = null; this.shadow = null}; var P = function(){this.color = null; this.seriesColors = null; this.lineWidth = null; this.shadow = null; this.barPadding = null; this.barMargin = null; this.barWidth = null; this.highlightColors = null}; var e = function(){this.seriesColors = null; this.padding = null; this.sliceMargin = null; this.fill = null; this.shadow = null; this.startAngle = null; this.lineWidth = null; this.highlightColors = null}; var C = function(){this.seriesColors = null; this.padding = null; this.sliceMargin = null; this.fill = null; this.shadow = null; this.startAngle = null; this.lineWidth = null; this.innerDiameter = null; this.thickness = null; this.ringMargin = null; this.highlightColors = null}; var U = function(){this.color = null; this.lineWidth = null; this.shadow = null; this.padding = null; this.sectionMargin = null; this.seriesColors = null; this.highlightColors = null}; var z = function(){this.padding = null; this.backgroundColor = null; this.ringColor = null; this.tickColor = null; this.ringWidth = null; this.intervalColors = null; this.intervalInnerRadius = null; this.intervalOuterRadius = null; this.hubRadius = null; this.needleThickness = null; this.needlePad = null}; H.fn.jqplotChildText = function(){return H(this).contents().filter(function(){return this.nodeType == 3}).text()}; H.fn.jqplotGetComputedFontStyle = function(){var ae = window.getComputedStyle?window.getComputedStyle(this[0], ""):this[0].currentStyle; var ac = ae["font-style"]?["font-style", "font-weight", "font-size", "font-family"]:["fontStyle", "fontWeight", "fontSize", "fontFamily"]; var af = []; for (var ad = 0; ad < ac.length; ++ad){var ab = String(ae[ac[ad]]); if (ab && ab != "normal"){af.push(ab)}}return af.join(" ")}; H.fn.jqplotToImageCanvas = function(ad){ad = ad || {}; var ao = (ad.x_offset == null)?0:ad.x_offset; var aq = (ad.y_offset == null)?0:ad.y_offset; var af = (ad.backgroundColor == null)?"rgb(255,255,255)":ad.backgroundColor; if (H(this).width() == 0 || H(this).height() == 0){return null}if (H.jqplot.use_excanvas){return null}var ah = document.createElement("canvas"); var au = H(this).outerHeight(true); var am = H(this).outerWidth(true); var ag = H(this).offset(); var ai = ag.left; var ak = ag.top; var an = 0, al = 0; var ar = ["jqplot-table-legend", "jqplot-xaxis-tick", "jqplot-x2axis-tick", "jqplot-yaxis-tick", "jqplot-y2axis-tick", "jqplot-y3axis-tick", "jqplot-y4axis-tick", "jqplot-y5axis-tick", "jqplot-y6axis-tick", "jqplot-y7axis-tick", "jqplot-y8axis-tick", "jqplot-y9axis-tick", "jqplot-xaxis-label", "jqplot-x2axis-label", "jqplot-yaxis-label", "jqplot-y2axis-label", "jqplot-y3axis-label", "jqplot-y4axis-label", "jqplot-y5axis-label", "jqplot-y6axis-label", "jqplot-y7axis-label", "jqplot-y8axis-label", "jqplot-y9axis-label"]; var aj, ab, ac, av; for (var at = 0; at < ar.length; at++){H(this).find("." + ar[at]).each(function(){aj = H(this).offset().top - ak; ab = H(this).offset().left - ai; av = ab + H(this).outerWidth(true) + an; ac = aj + H(this).outerHeight(true) + al; if (ab < - an){am = am - an - ab; an = - ab}if (aj < - al){au = au - al - aj; al = - aj}if (av > am){am = av}if (ac > au){au = ac}})}ah.width = am + Number(ao); ah.height = au + Number(aq); var ae = ah.getContext("2d"); ae.save(); ae.fillStyle = af; ae.fillRect(0, 0, ah.width, ah.height); ae.restore(); ae.translate(an, al); ae.textAlign = "left"; ae.textBaseline = "top"; function aw(ay){var az = parseInt(H(ay).css("line-height"), 10); if (isNaN(az)){az = parseInt(H(ay).css("font-size"), 10) * 1.2}return az}function ax(az, ay, aM, aA, aI, aB){var aK = aw(az); var aE = H(az).innerWidth(); var aF = H(az).innerHeight(); var aH = aM.split(/\s+/); var aL = aH.length; var aJ = ""; var aG = []; var aO = aI; var aN = aA; for (var aD = 0; aD < aL; aD++){aJ += aH[aD]; if (ay.measureText(aJ).width > aE){aG.push(aD); aJ = ""; aD--}}if (aG.length === 0){if (H(az).css("textAlign") === "center"){aN = aA + (aB - ay.measureText(aJ).width) / 2 - an}ay.fillText(aM, aN, aI)} else{aJ = aH.slice(0, aG[0]).join(" "); if (H(az).css("textAlign") === "center"){aN = aA + (aB - ay.measureText(aJ).width) / 2 - an}ay.fillText(aJ, aN, aO); aO += aK; for (var aD = 1, aC = aG.length; aD < aC; aD++){aJ = aH.slice(aG[aD - 1], aG[aD]).join(" "); if (H(az).css("textAlign") === "center"){aN = aA + (aB - ay.measureText(aJ).width) / 2 - an}ay.fillText(aJ, aN, aO); aO += aK}aJ = aH.slice(aG[aD - 1], aH.length).join(" "); if (H(az).css("textAlign") === "center"){aN = aA + (aB - ay.measureText(aJ).width) / 2 - an}ay.fillText(aJ, aN, aO)}}function ap(aA, aD, ay){var aH = aA.tagName.toLowerCase(); var az = H(aA).position(); var aE = window.getComputedStyle?window.getComputedStyle(aA, ""):aA.currentStyle; var aC = aD + az.left + parseInt(aE.marginLeft, 10) + parseInt(aE.borderLeftWidth, 10) + parseInt(aE.paddingLeft, 10); var aF = ay + az.top + parseInt(aE.marginTop, 10) + parseInt(aE.borderTopWidth, 10) + parseInt(aE.paddingTop, 10); var aG = ah.width; if ((aH == "div" || aH == "span") && !H(aA).hasClass("jqplot-highlighter-tooltip")){H(aA).children().each(function(){ap(this, aC, aF)}); var aI = H(aA).jqplotChildText(); if (aI){ae.font = H(aA).jqplotGetComputedFontStyle(); ae.fillStyle = H(aA).css("color"); ax(aA, ae, aI, aC, aF, aG)}} else{if (aH === "table" && H(aA).hasClass("jqplot-table-legend")){ae.strokeStyle = H(aA).css("border-top-color"); ae.fillStyle = H(aA).css("background-color"); ae.fillRect(aC, aF, H(aA).innerWidth(), H(aA).innerHeight()); if (parseInt(H(aA).css("border-top-width"), 10) > 0){ae.strokeRect(aC, aF, H(aA).innerWidth(), H(aA).innerHeight())}H(aA).find("div.jqplot-table-legend-swatch-outline").each(function(){var aO = H(this); ae.strokeStyle = aO.css("border-top-color"); var aK = aC + aO.position().left; var aL = aF + aO.position().top; ae.strokeRect(aK, aL, aO.innerWidth(), aO.innerHeight()); aK += parseInt(aO.css("padding-left"), 10); aL += parseInt(aO.css("padding-top"), 10); var aN = aO.innerHeight() - 2 * parseInt(aO.css("padding-top"), 10); var aJ = aO.innerWidth() - 2 * parseInt(aO.css("padding-left"), 10); var aM = aO.children("div.jqplot-table-legend-swatch"); ae.fillStyle = aM.css("background-color"); ae.fillRect(aK, aL, aJ, aN)}); H(aA).find("td.jqplot-table-legend-label").each(function(){var aL = H(this); var aJ = aC + aL.position().left; var aK = aF + aL.position().top + parseInt(aL.css("padding-top"), 10); ae.font = aL.jqplotGetComputedFontStyle(); ae.fillStyle = aL.css("color"); ax(aL, ae, aL.text(), aJ, aK, aG)}); var aB = null} else{if (aH == "canvas"){ae.drawImage(aA, aC, aF)}}}}H(this).children().each(function(){ap(this, ao, aq)}); return ah}; H.fn.jqplotToImageStr = function(ac){var ab = H(this).jqplotToImageCanvas(ac); if (ab){return ab.toDataURL("image/png")} else{return null}}; H.fn.jqplotToImageElem = function(ab){var ac = document.createElement("img"); var ad = H(this).jqplotToImageStr(ab); ac.src = ad; return ac}; H.fn.jqplotToImageElemStr = function(ab){var ac = ""; return ac}; H.fn.jqplotSaveImage = function(){var ab = H(this).jqplotToImageStr({}); if (ab){window.location.href = ab.replace("image/png", "image/octet-stream")}}; H.fn.jqplotViewImage = function(){var ac = H(this).jqplotToImageElemStr({}); var ad = H(this).jqplotToImageStr({}); if (ac){var ab = window.open(""); ab.document.open("image/png"); ab.document.write(ac); ab.document.close(); ab = null}}; var aa = function(){this.syntax = aa.config.syntax; this._type = "jsDate"; this.proxy = new Date(); this.options = {}; this.locale = aa.regional.getLocale(); this.formatString = ""; this.defaultCentury = aa.config.defaultCentury; switch (arguments.length){case 0:break; case 1:if (j(arguments[0]) == "[object Object]" && arguments[0]._type != "jsDate"){var ad = this.options = arguments[0]; this.syntax = ad.syntax || this.syntax; this.defaultCentury = ad.defaultCentury || this.defaultCentury; this.proxy = aa.createDate(ad.date)} else{this.proxy = aa.createDate(arguments[0])}break; default:var ab = []; for (var ac = 0; ac < arguments.length; ac++){ab.push(arguments[ac])}this.proxy = new Date(); this.proxy.setFullYear.apply(this.proxy, ab.slice(0, 3)); if (ab.slice(3).length){this.proxy.setHours.apply(this.proxy, ab.slice(3))}break}}; aa.config = {defaultLocale:"en", syntax:"perl", defaultCentury:1900}; aa.prototype.add = function(ad, ac){var ab = A[ac] || A.day; if (typeof ab == "number"){this.proxy.setTime(this.proxy.getTime() + (ab * ad))} else{ab.add(this, ad)}return this}; aa.prototype.clone = function(){return new aa(this.proxy.getTime())}; aa.prototype.getUtcOffset = function(){return this.proxy.getTimezoneOffset() * 60000}; aa.prototype.diff = function(ac, af, ab){ac = new aa(ac); if (ac === null){return null}var ad = A[af] || A.day; if (typeof ad == "number"){var ae = (this.proxy.getTime() - ac.proxy.getTime()) / ad} else{var ae = ad.diff(this.proxy, ac.proxy)}return(ab?ae:Math[ae > 0?"floor":"ceil"](ae))}; aa.prototype.getAbbrDayName = function(){return aa.regional[this.locale]["dayNamesShort"][this.proxy.getDay()]}; aa.prototype.getAbbrMonthName = function(){return aa.regional[this.locale]["monthNamesShort"][this.proxy.getMonth()]}; aa.prototype.getAMPM = function(){return this.proxy.getHours() >= 12?"PM":"AM"}; aa.prototype.getAmPm = function(){return this.proxy.getHours() >= 12?"pm":"am"}; aa.prototype.getCentury = function(){return parseInt(this.proxy.getFullYear() / 100, 10)}; aa.prototype.getDate = function(){return this.proxy.getDate()}; aa.prototype.getDay = function(){return this.proxy.getDay()}; aa.prototype.getDayOfWeek = function(){var ab = this.proxy.getDay(); return ab === 0?7:ab}; aa.prototype.getDayOfYear = function(){var ac = this.proxy; var ab = ac - new Date("" + ac.getFullYear() + "/1/1 GMT"); ab += ac.getTimezoneOffset() * 60000; ac = null; return parseInt(ab / 60000 / 60 / 24, 10) + 1}; aa.prototype.getDayName = function(){return aa.regional[this.locale]["dayNames"][this.proxy.getDay()]}; aa.prototype.getFullWeekOfYear = function(){var ae = this.proxy; var ab = this.getDayOfYear(); var ad = 6 - ae.getDay(); var ac = parseInt((ab + ad) / 7, 10); return ac}; aa.prototype.getFullYear = function(){return this.proxy.getFullYear()}; aa.prototype.getGmtOffset = function(){var ab = this.proxy.getTimezoneOffset() / 60; var ac = ab < 0?"+":"-"; ab = Math.abs(ab); return ac + J(Math.floor(ab), 2) + ":" + J((ab % 1) * 60, 2)}; aa.prototype.getHours = function(){return this.proxy.getHours()}; aa.prototype.getHours12 = function(){var ab = this.proxy.getHours(); return ab > 12?ab - 12:(ab == 0?12:ab)}; aa.prototype.getIsoWeek = function(){var ae = this.proxy; var ad = ae.getWeekOfYear(); var ab = (new Date("" + ae.getFullYear() + "/1/1")).getDay(); var ac = ad + (ab > 4 || ab <= 1?0:1); if (ac == 53 && (new Date("" + ae.getFullYear() + "/12/31")).getDay() < 4){ac = 1} else{if (ac === 0){ae = new aa(new Date("" + (ae.getFullYear() - 1) + "/12/31")); ac = ae.getIsoWeek()}}ae = null; return ac}; aa.prototype.getMilliseconds = function(){return this.proxy.getMilliseconds()}; aa.prototype.getMinutes = function(){return this.proxy.getMinutes()}; aa.prototype.getMonth = function(){return this.proxy.getMonth()}; aa.prototype.getMonthName = function(){return aa.regional[this.locale]["monthNames"][this.proxy.getMonth()]}; aa.prototype.getMonthNumber = function(){return this.proxy.getMonth() + 1}; aa.prototype.getSeconds = function(){return this.proxy.getSeconds()}; aa.prototype.getShortYear = function(){return this.proxy.getYear() % 100}; aa.prototype.getTime = function(){return this.proxy.getTime()}; aa.prototype.getTimezoneAbbr = function(){return this.proxy.toString().replace(/^.*\(([^)]+)\)$/, "$1")}; aa.prototype.getTimezoneName = function(){var ab = /(?:\((.+)\)$| ([A-Z]{3}) )/.exec(this.toString()); return ab[1] || ab[2] || "GMT" + this.getGmtOffset()}; aa.prototype.getTimezoneOffset = function(){return this.proxy.getTimezoneOffset()}; aa.prototype.getWeekOfYear = function(){var ab = this.getDayOfYear(); var ad = 7 - this.getDayOfWeek(); var ac = parseInt((ab + ad) / 7, 10); return ac}; aa.prototype.getUnix = function(){return Math.round(this.proxy.getTime() / 1000, 0)}; aa.prototype.getYear = function(){return this.proxy.getYear()}; aa.prototype.next = function(ab){ab = ab || "day"; return this.clone().add(1, ab)}; aa.prototype.set = function(){switch (arguments.length){case 0:this.proxy = new Date(); break; case 1:if (j(arguments[0]) == "[object Object]" && arguments[0]._type != "jsDate"){var ad = this.options = arguments[0]; this.syntax = ad.syntax || this.syntax; this.defaultCentury = ad.defaultCentury || this.defaultCentury; this.proxy = aa.createDate(ad.date)} else{this.proxy = aa.createDate(arguments[0])}break; default:var ab = []; for (var ac = 0; ac < arguments.length; ac++){ab.push(arguments[ac])}this.proxy = new Date(); this.proxy.setFullYear.apply(this.proxy, ab.slice(0, 3)); if (ab.slice(3).length){this.proxy.setHours.apply(this.proxy, ab.slice(3))}break}return this}; aa.prototype.setDate = function(ab){this.proxy.setDate(ab); return this}; aa.prototype.setFullYear = function(){this.proxy.setFullYear.apply(this.proxy, arguments); return this}; aa.prototype.setHours = function(){this.proxy.setHours.apply(this.proxy, arguments); return this}; aa.prototype.setMilliseconds = function(ab){this.proxy.setMilliseconds(ab); return this}; aa.prototype.setMinutes = function(){this.proxy.setMinutes.apply(this.proxy, arguments); return this}; aa.prototype.setMonth = function(){this.proxy.setMonth.apply(this.proxy, arguments); return this}; aa.prototype.setSeconds = function(){this.proxy.setSeconds.apply(this.proxy, arguments); return this}; aa.prototype.setTime = function(ab){this.proxy.setTime(ab); return this}; aa.prototype.setYear = function(){this.proxy.setYear.apply(this.proxy, arguments); return this}; aa.prototype.strftime = function(ab){ab = ab || this.formatString || aa.regional[this.locale]["formatString"]; return aa.strftime(this, ab, this.syntax)}; aa.prototype.toString = function(){return this.proxy.toString()}; aa.prototype.toYmdInt = function(){return(this.proxy.getFullYear() * 10000) + (this.getMonthNumber() * 100) + this.proxy.getDate()}; aa.regional = {en:{monthNames:["January", "February", "March", "April", "May", "June", "July", "August", "September", "October", "November", "December"], monthNamesShort:["Jan", "Feb", "Mar", "Apr", "May", "Jun", "Jul", "Aug", "Sep", "Oct", "Nov", "Dec"], dayNames:["Sunday", "Monday", "Tuesday", "Wednesday", "Thursday", "Friday", "Saturday"], dayNamesShort:["Sun", "Mon", "Tue", "Wed", "Thu", "Fri", "Sat"], formatString:"%Y-%m-%d %H:%M:%S"}, fr:{monthNames:["Janvier", "Février", "Mars", "Avril", "Mai", "Juin", "Juillet", "Août", "Septembre", "Octobre", "Novembre", "Décembre"], monthNamesShort:["Jan", "Fév", "Mar", "Avr", "Mai", "Jun", "Jul", "Aoû", "Sep", "Oct", "Nov", "Déc"], dayNames:["Dimanche", "Lundi", "Mardi", "Mercredi", "Jeudi", "Vendredi", "Samedi"], dayNamesShort:["Dim", "Lun", "Mar", "Mer", "Jeu", "Ven", "Sam"], formatString:"%Y-%m-%d %H:%M:%S"}, de:{monthNames:["Januar", "Februar", "März", "April", "Mai", "Juni", "Juli", "August", "September", "Oktober", "November", "Dezember"], monthNamesShort:["Jan", "Feb", "Mär", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Dez"], dayNames:["Sonntag", "Montag", "Dienstag", "Mittwoch", "Donnerstag", "Freitag", "Samstag"], dayNamesShort:["So", "Mo", "Di", "Mi", "Do", "Fr", "Sa"], formatString:"%Y-%m-%d %H:%M:%S"}, es:{monthNames:["Enero", "Febrero", "Marzo", "Abril", "Mayo", "Junio", "Julio", "Agosto", "Septiembre", "Octubre", "Noviembre", "Diciembre"], monthNamesShort:["Ene", "Feb", "Mar", "Abr", "May", "Jun", "Jul", "Ago", "Sep", "Oct", "Nov", "Dic"], dayNames:["Domingo", "Lunes", "Martes", "Miércoles", "Jueves", "Viernes", "Sábado"], dayNamesShort:["Dom", "Lun", "Mar", "Mié", "Juv", "Vie", "Sáb"], formatString:"%Y-%m-%d %H:%M:%S"}, ru:{monthNames:["??????", "???????", "????", "??????", "???", "????", "????", "??????", "????????", "???????", "??????", "???????"], monthNamesShort:["???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???", "???"], dayNames:["???????????", "???????????", "???????", "?????", "???????", "???????", "???????"], dayNamesShort:["???", "???", "???", "???", "???", "???", "???"], formatString:"%Y-%m-%d %H:%M:%S"}, ar:{monthNames:["????? ??????", "????", "????", "?????", "????", "??????", "????", "??", "?????", "????? ?????", "????? ??????", "????? ?????"], monthNamesShort:["1", "2", "3", "4", "5", "6", "7", "8", "9", "10", "11", "12"], dayNames:["?????", "?????", "???????", "????????", "????????", "??????", "??????"], dayNamesShort:["???", "???", "?????", "??????", "??????", "????", "????"], formatString:"%Y-%m-%d %H:%M:%S"}, pt:{monthNames:["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], monthNamesShort:["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"], dayNames:["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"], dayNamesShort:["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"], formatString:"%Y-%m-%d %H:%M:%S"}, "pt-BR":{monthNames:["Janeiro", "Fevereiro", "Março", "Abril", "Maio", "Junho", "Julho", "Agosto", "Setembro", "Outubro", "Novembro", "Dezembro"], monthNamesShort:["Jan", "Fev", "Mar", "Abr", "Mai", "Jun", "Jul", "Ago", "Set", "Out", "Nov", "Dez"], dayNames:["Domingo", "Segunda-feira", "Terça-feira", "Quarta-feira", "Quinta-feira", "Sexta-feira", "Sábado"], dayNamesShort:["Dom", "Seg", "Ter", "Qua", "Qui", "Sex", "Sáb"], formatString:"%Y-%m-%d %H:%M:%S"}}; aa.regional["en-US"] = aa.regional["en-GB"] = aa.regional.en; aa.regional.getLocale = function(){var ab = aa.config.defaultLocale; if (document && document.getElementsByTagName("html") && document.getElementsByTagName("html")[0].lang){ab = document.getElementsByTagName("html")[0].lang; if (!aa.regional.hasOwnProperty(ab)){ab = aa.config.defaultLocale}}return ab}; var y = 24 * 60 * 60 * 1000; var J = function(ab, ae){ab = String(ab); var ac = ae - ab.length; var ad = String(Math.pow(10, ac)).slice(1); return ad.concat(ab)}; var A = {millisecond:1, second:1000, minute:60 * 1000, hour:60 * 60 * 1000, day:y, week:7 * y, month:{add:function(ad, ab){A.year.add(ad, Math[ab > 0?"floor":"ceil"](ab / 12)); var ac = ad.getMonth() + (ab % 12); if (ac == 12){ac = 0; ad.setYear(ad.getFullYear() + 1)} else{if (ac == - 1){ac = 11; ad.setYear(ad.getFullYear() - 1)}}ad.setMonth(ac)}, diff:function(af, ad){var ab = af.getFullYear() - ad.getFullYear(); var ac = af.getMonth() - ad.getMonth() + (ab * 12); var ae = af.getDate() - ad.getDate(); return ac + (ae / 30)}}, year:{add:function(ac, ab){ac.setYear(ac.getFullYear() + Math[ab > 0?"floor":"ceil"](ab))}, diff:function(ac, ab){return A.month.diff(ac, ab) / 12}}}; for (var T in A){if (T.substring(T.length - 1) != "s"){A[T + "s"] = A[T]}}var D = function(af, ae, ac){if (aa.formats[ac]["shortcuts"][ae]){return aa.strftime(af, aa.formats[ac]["shortcuts"][ae], ac)} else{var ab = (aa.formats[ac]["codes"][ae] || "").split("."); var ad = af["get" + ab[0]]?af["get" + ab[0]]():""; if (ab[1]){ad = J(ad, ab[1])}return ad}}; aa.strftime = function(ah, ae, ad, ai){var ac = "perl"; var ag = aa.regional.getLocale(); if (ad && aa.formats.hasOwnProperty(ad)){ac = ad} else{if (ad && aa.regional.hasOwnProperty(ad)){ag = ad}}if (ai && aa.formats.hasOwnProperty(ai)){ac = ai} else{if (ai && aa.regional.hasOwnProperty(ai)){ag = ai}}if (j(ah) != "[object Object]" || ah._type != "jsDate"){ah = new aa(ah); ah.locale = ag}if (!ae){ae = ah.formatString || aa.regional[ag]["formatString"]}var ab = ae || "%Y-%m-%d", aj = "", af; while (ab.length > 0){if (af = ab.match(aa.formats[ac].codes.matcher)){aj += ab.slice(0, af.index); aj += (af[1] || "") + D(ah, af[2], ac); ab = ab.slice(af.index + af[0].length)} else{aj += ab; ab = ""}}return aj}; aa.formats = {ISO:"%Y-%m-%dT%H:%M:%S.%N%G", SQL:"%Y-%m-%d %H:%M:%S"}; aa.formats.perl = {codes:{matcher:/()%(#?(%|[a-z]))/i, Y:"FullYear", y:"ShortYear.2", m:"MonthNumber.2", "#m":"MonthNumber", B:"MonthName", b:"AbbrMonthName", d:"Date.2", "#d":"Date", e:"Date", A:"DayName", a:"AbbrDayName", w:"Day", H:"Hours.2", "#H":"Hours", I:"Hours12.2", "#I":"Hours12", p:"AMPM", M:"Minutes.2", "#M":"Minutes", S:"Seconds.2", "#S":"Seconds", s:"Unix", N:"Milliseconds.3", "#N":"Milliseconds", O:"TimezoneOffset", Z:"TimezoneName", G:"GmtOffset"}, shortcuts:{F:"%Y-%m-%d", T:"%H:%M:%S", X:"%H:%M:%S", x:"%m/%d/%y", D:"%m/%d/%y", "#c":"%a %b %e %H:%M:%S %Y", v:"%e-%b-%Y", R:"%H:%M", r:"%I:%M:%S %p", t:"\t", n:"\n", "%":"%"}}; aa.formats.php = {codes:{matcher:/()%((%|[a-z]))/i, a:"AbbrDayName", A:"DayName", d:"Date.2", e:"Date", j:"DayOfYear.3", u:"DayOfWeek", w:"Day", U:"FullWeekOfYear.2", V:"IsoWeek.2", W:"WeekOfYear.2", b:"AbbrMonthName", B:"MonthName", m:"MonthNumber.2", h:"AbbrMonthName", C:"Century.2", y:"ShortYear.2", Y:"FullYear", H:"Hours.2", I:"Hours12.2", l:"Hours12", p:"AMPM", P:"AmPm", M:"Minutes.2", S:"Seconds.2", s:"Unix", O:"TimezoneOffset", z:"GmtOffset", Z:"TimezoneAbbr"}, shortcuts:{D:"%m/%d/%y", F:"%Y-%m-%d", T:"%H:%M:%S", X:"%H:%M:%S", x:"%m/%d/%y", R:"%H:%M", r:"%I:%M:%S %p", t:"\t", n:"\n", "%":"%"}}; aa.createDate = function(ad){if (ad == null){return new Date()}if (ad instanceof Date){return ad}if (typeof ad == "number"){return new Date(ad)}var ai = String(ad).replace(/^\s*(.+)\s*$/g, "$1"); ai = ai.replace(/^([0-9]{1,4})-([0-9]{1,2})-([0-9]{1,4})/, "$1/$2/$3"); ai = ai.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{4})/i, "$1 $2 $3"); var ah = ai.match(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i); if (ah && ah.length > 3){var am = parseFloat(ah[3]); var ag = aa.config.defaultCentury + am; ag = String(ag); ai = ai.replace(/^(3[01]|[0-2]?\d)[-\/]([a-z]{3,})[-\/](\d{2})\D*/i, ah[1] + " " + ah[2] + " " + ag)}ah = ai.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})[^0-9]/); function al(aq, ap){var aw = parseFloat(ap[1]); var av = parseFloat(ap[2]); var au = parseFloat(ap[3]); var at = aa.config.defaultCentury; var ao, an, ax, ar; if (aw > 31){an = au; ax = av; ao = at + aw} else{an = av; ax = aw; ao = at + au}ar = ax + "/" + an + "/" + ao; return aq.replace(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})/, ar)}if (ah && ah.length > 3){ai = al(ai, ah)}var ah = ai.match(/^([0-9]{1,2})[-\/]([0-9]{1,2})[-\/]([0-9]{1,2})$/); if (ah && ah.length > 3){ai = al(ai, ah)}var af = 0; var ac = aa.matchers.length; var ak, ab, aj = ai, ae; while (af < ac){ab = Date.parse(aj); if (!isNaN(ab)){return new Date(ab)}ak = aa.matchers[af]; if (typeof ak == "function"){ae = ak.call(aa, aj); if (ae instanceof Date){return ae}} else{aj = ai.replace(ak[0], ak[1])}af++}return NaN}; aa.daysInMonth = function(ab, ac){if (ac == 2){return new Date(ab, 1, 29).getDate() == 29?29:28}return[r, 31, r, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31][ac]}; aa.matchers = [[/(3[01]|[0-2]\d)\s*\.\s*(1[0-2]|0\d)\s*\.\s*([1-9]\d{3})/, "$2/$1/$3"], [/([1-9]\d{3})\s*-\s*(1[0-2]|0\d)\s*-\s*(3[01]|[0-2]\d)/, "$2/$3/$1"], function(ae){var ac = ae.match(/^(?:(.+)\s+)?([012]?\d)(?:\s*\:\s*(\d\d))?(?:\s*\:\s*(\d\d(\.\d*)?))?\s*(am|pm)?\s*$/i); if (ac){if (ac[1]){var ad = this.createDate(ac[1]); if (isNaN(ad)){return}} else{var ad = new Date(); ad.setMilliseconds(0)}var ab = parseFloat(ac[2]); if (ac[6]){ab = ac[6].toLowerCase() == "am"?(ab == 12?0:ab):(ab == 12?12:ab + 12)}ad.setHours(ab, parseInt(ac[3] || 0, 10), parseInt(ac[4] || 0, 10), ((parseFloat(ac[5] || 0)) || 0) * 1000); return ad} else{return ae}}, function(ae){var ac = ae.match(/^(?:(.+))[T|\s+]([012]\d)(?:\:(\d\d))(?:\:(\d\d))(?:\.\d+)([\+\-]\d\d\:\d\d)$/i); if (ac){if (ac[1]){var ad = this.createDate(ac[1]); if (isNaN(ad)){return}} else{var ad = new Date(); ad.setMilliseconds(0)}var ab = parseFloat(ac[2]); ad.setHours(ab, parseInt(ac[3], 10), parseInt(ac[4], 10), parseFloat(ac[5]) * 1000); return ad} else{return ae}}, function(af){var ad = af.match(/^([0-3]?\d)\s*[-\/.\s]{1}\s*([a-zA-Z]{3,9})\s*[-\/.\s]{1}\s*([0-3]?\d)$/); if (ad){var ae = new Date(); var ag = aa.config.defaultCentury; var ai = parseFloat(ad[1]); var ah = parseFloat(ad[3]); var ac, ab, aj; if (ai > 31){ab = ah; ac = ag + ai} else{ab = ai; ac = ag + ah}var aj = W(ad[2], aa.regional[aa.regional.getLocale()]["monthNamesShort"]); if (aj == - 1){aj = W(ad[2], aa.regional[aa.regional.getLocale()]["monthNames"])}ae.setFullYear(ac, aj, ab); ae.setHours(0, 0, 0, 0); return ae} else{return af}}]; function W(ad, ae){if (ae.indexOf){return ae.indexOf(ad)}for (var ab = 0, ac = ae.length; ab < ac; ab++){if (ae[ab] === ad){return ab}}return - 1}function j(ab){ +if (ab === null){return"[object Null]"}return Object.prototype.toString.call(ab)}H.jsDate = aa; + H.jqplot.sprintf = function(){function ah(an, aj, ak, am){ + var al = (an.length >= aj)?"":Array(1 + aj - an.length >>> 0).join(ak); + return am?an + al:al + an}function ae(al){ + var ak = new String(al); + for (var aj = 10; aj > 0; aj--){if (ak == (ak = ak.replace(/^(\d+)(\d{3})/, "$1" + H.jqplot.sprintf.thousandsSeparator + "$2"))){break}}return ak}function ad(ao, an, aq, al, am, ak){var ap = al - ao.length; if (ap > 0){var aj = " "; if (ak){aj = " "}if (aq || !am){ao = ah(ao, al, aj, aq)} else{ao = ao.slice(0, an.length) + ah("", ap, "0", true) + ao.slice(an.length)}}return ao}function ai(ar, ak, ap, al, aj, ao, aq, an){var am = ar >>> 0; ap = ap && am && {"2":"0b", "8":"0", "16":"0x"}[ak] || ""; ar = ap + ah(am.toString(ak), ao || 0, "0", false); return ad(ar, ap, al, aj, aq, an)}function ab(an, ao, al, aj, am, ak){if (aj != null){an = an.slice(0, aj)}return ad(an, "", ao, al, am, ak)}var ac = arguments, af = 0, ag = ac[af++]; return ag.replace(H.jqplot.sprintf.regex, function(aG, aq, ar, av, aI, aD, ao){if (aG == "%%"){return"%"}var ax = false, at = "", au = false, aF = false, ap = false, an = false; for (var aC = 0; ar && aC < ar.length; aC++){switch (ar.charAt(aC)){case" ":at = " "; break; case"+":at = "+"; break; case"-":ax = true; break; case"0":au = true; break; case"#":aF = true; break; case"&":ap = true; break; case"'":an = true; break}}if (!av){av = 0} else{if (av == "*"){av = + ac[af++]} else{if (av.charAt(0) == "*"){av = + ac[av.slice(1, - 1)]} else{av = + av}}}if (av < 0){av = - av; ax = true}if (!isFinite(av)){throw new Error("$.jqplot.sprintf: (minimum-)width must be finite")}if (!aD){aD = "fFeE".indexOf(ao) > - 1?6:(ao == "d")?0:void (0)} else{if (aD == "*"){aD = + ac[af++]} else{if (aD.charAt(0) == "*"){aD = + ac[aD.slice(1, - 1)]} else{aD = + aD}}}var az = aq?ac[aq.slice(0, - 1)]:ac[af++]; switch (ao){case"s":if (az == null){return""}return ab(String(az), ax, av, aD, au, ap); case"c":return ab(String.fromCharCode( + az), ax, av, aD, au, ap); case"b":return ai(az, 2, aF, ax, av, aD, au, ap); case"o":return ai(az, 8, aF, ax, av, aD, au, ap); case"x":return ai(az, 16, aF, ax, av, aD, au, ap); case"X":return ai(az, 16, aF, ax, av, aD, au, ap).toUpperCase(); case"u":return ai(az, 10, aF, ax, av, aD, au, ap); case"i":var al = parseInt( + az, 10); if (isNaN(al)){return""}var aB = al < 0?"-":at; var aE = an?ae(String(Math.abs(al))):String(Math.abs(al)); az = aB + ah(aE, aD, "0", false); return ad(az, aB, ax, av, au, ap); case"d":var al = Math.round( + az); if (isNaN(al)){return""}var aB = al < 0?"-":at; var aE = an?ae(String(Math.abs(al))):String(Math.abs(al)); az = aB + ah(aE, aD, "0", false); return ad(az, aB, ax, av, au, ap); case"e":case"E":case"f":case"F":case"g":case"G":var al = + az; if (isNaN(al)){return""}var aB = al < 0?"-":at; var am = ["toExponential", "toFixed", "toPrecision"]["efg".indexOf(ao.toLowerCase())]; var aH = ["toString", "toUpperCase"]["eEfFgG".indexOf(ao) % 2]; var aE = Math.abs(al)[am](aD); aE = an?ae(aE):aE; az = aB + aE; var aw = ad(az, aB, ax, av, au, ap)[aH](); if (H.jqplot.sprintf.decimalMark !== "." && H.jqplot.sprintf.decimalMark !== H.jqplot.sprintf.thousandsSeparator){return aw.replace(/\./, H.jqplot.sprintf.decimalMark)} else{return aw}case"p":case"P":var al = + az; if (isNaN(al)){return""}var aB = al < 0?"-":at; var ay = String(Number(Math.abs(al)).toExponential()).split(/e|E/); var ak = (ay[0].indexOf(".") != - 1)?ay[0].length - 1:ay[0].length; var aA = (ay[1] < 0)? - ay[1] - 1:0; if (Math.abs(al) < 1){if (ak + aA <= aD){az = aB + Math.abs(al).toPrecision(ak)} else{if (ak <= aD - 1){az = aB + Math.abs(al).toExponential(ak - 1)} else{az = aB + Math.abs(al).toExponential(aD - 1)}}} else{var aj = (ak <= aD)?ak:aD; az = aB + Math.abs(al).toPrecision(aj)}var aH = ["toString", "toUpperCase"]["pP".indexOf(ao) % 2]; return ad(az, aB, ax, av, au, ap)[aH](); case"n":return""; default:return aG}})}; H.jqplot.sprintf.thousandsSeparator = ","; H.jqplot.sprintf.decimalMark = "."; H.jqplot.sprintf.regex = /%%|%(\d+\$)?([-+#0&\' ]*)(\*\d+\$|\*|\d+)?(\.(\*\d+\$|\*|\d+))?([nAscboxXuidfegpEGP])/g; H.jqplot.getSignificantFigures = function(af){var ah = String(Number(Math.abs(af)).toExponential()).split(/e|E/); var ag = (ah[0].indexOf(".") != - 1)?ah[0].length - 1:ah[0].length; var ac = (ah[1] < 0)? - ah[1] - 1:0; var ab = parseInt(ah[1], 10); var ad = (ab + 1 > 0)?ab + 1:0; var ae = (ag <= ad)?0:ag - ab - 1; return{significantDigits:ag, digitsLeft:ad, digitsRight:ae, zeros:ac, exponent:ab}}; H.jqplot.getPrecision = function(ab){return H.jqplot.getSignificantFigures(ab).digitsRight}})(jQuery); var backCompat = $.uiBackCompat !== false; $.jqplot.effects = {effect:{}}; var dataSpace = "jqplot.storage."; $.extend($.jqplot.effects, {version:"1.9pre", save:function(b, c){for (var a = 0; a < c.length; a++){if (c[a] !== null){b.data(dataSpace + c[a], b[0].style[c[a]])}}}, restore:function(b, c){for (var a = 0; a < c.length; a++){if (c[a] !== null){b.css(c[a], b.data(dataSpace + c[a]))}}}, setMode:function(a, b){if (b === "toggle"){b = a.is(":hidden")?"show":"hide"}return b}, createWrapper:function(b){if (b.parent().is(".ui-effects-wrapper")){return b.parent()}var c = {width:b.outerWidth(true), height:b.outerHeight(true), "float":b.css("float")}, e = $("
").addClass("ui-effects-wrapper").css({fontSize:"100%", background:"transparent", border:"none", margin:0, padding:0}), a = {width:b.width(), height:b.height()}, d = document.activeElement; b.wrap(e); if (b[0] === d || $.contains(b[0], d)){$(d).focus()}e = b.parent(); if (b.css("position") === "static"){e.css({position:"relative"}); b.css({position:"relative"})} else{$.extend(c, {position:b.css("position"), zIndex:b.css("z-index")}); $.each(["top", "left", "bottom", "right"], function(f, g){c[g] = b.css(g); if (isNaN(parseInt(c[g], 10))){c[g] = "auto"}}); b.css({position:"relative", top:0, left:0, right:"auto", bottom:"auto"})}b.css(a); return e.css(c).show()}, removeWrapper:function(a){var b = document.activeElement; if (a.parent().is(".ui-effects-wrapper")){a.parent().replaceWith(a); if (a[0] === b || $.contains(a[0], b)){$(b).focus()}}return a}}); function _normalizeArguments(b, a, c, d){if ($.isPlainObject(b)){return b}b = {effect:b}; if (a === undefined){a = {}}if ($.isFunction(a)){d = a; c = null; a = {}}if ($.type(a) === "number" || $.fx.speeds[a]){d = c; c = a; a = {}}if ($.isFunction(c)){d = c; c = null}if (a){$.extend(b, a)}c = c || a.duration; b.duration = $.fx.off?0:typeof c === "number"?c:c in $.fx.speeds?$.fx.speeds[c]:$.fx.speeds._default; b.complete = d || a.complete; return b}function standardSpeed(a){if (!a || typeof a === "number" || $.fx.speeds[a]){return true}if (typeof a === "string" && !$.jqplot.effects.effect[a]){if (backCompat && $.jqplot.effects[a]){return false}return true}return false}$.fn.extend({jqplotEffect:function(i, j, b, h){var g = _normalizeArguments.apply(this, arguments), d = g.mode, e = g.queue, f = $.jqplot.effects.effect[g.effect], a = !f && backCompat && $.jqplot.effects[g.effect]; if ($.fx.off || !(f || a)){if (d){return this[d](g.duration, g.complete)} else{return this.each(function(){if (g.complete){g.complete.call(this)}})}}function c(m){var n = $(this), l = g.complete, o = g.mode; function k(){if ($.isFunction(l)){l.call(n[0])}if ($.isFunction(m)){m()}}if (n.is(":hidden")?o === "hide":o === "show"){k()} else{f.call(n[0], g, k)}}if (f){return e === false?this.each(c):this.queue(e || "fx", c)} else{return a.call(this, {options:g, duration:g.duration, callback:g.complete, mode:g.mode})}}}); var rvertical = /up|down|vertical/, rpositivemotion = /up|left|vertical|horizontal/; $.jqplot.effects.effect.blind = function(c, h){var d = $(this), k = ["position", "top", "bottom", "left", "right", "height", "width"], i = $.jqplot.effects.setMode(d, c.mode || "hide"), m = c.direction || "up", f = rvertical.test(m), e = f?"height":"width", j = f?"top":"left", p = rpositivemotion.test(m), g = {}, n = i === "show", b, a, l; if (d.parent().is(".ui-effects-wrapper")){$.jqplot.effects.save(d.parent(), k)} else{$.jqplot.effects.save(d, k)}d.show(); l = parseInt(d.css("top"), 10); b = $.jqplot.effects.createWrapper(d).css({overflow:"hidden"}); a = f?b[e]() + l:b[e](); g[e] = n?String(a):"0"; if (!p){d.css(f?"bottom":"right", 0).css(f?"top":"left", "").css({position:"absolute"}); g[j] = n?"0":String(a)}if (n){b.css(e, 0); if (!p){b.css(j, a)}}b.animate(g, {duration:c.duration, easing:c.easing, queue:false, complete:function(){if (i === "hide"){d.hide()}$.jqplot.effects.restore(d, k); $.jqplot.effects.removeWrapper(d); h()}})}; + diff --git a/experiment/simulation/js/jquery_files/jquery.min.js b/experiment/simulation/js/jquery_files/jquery.min.js new file mode 100644 index 0000000..6601b82 --- /dev/null +++ b/experiment/simulation/js/jquery_files/jquery.min.js @@ -0,0 +1,13 @@ +/* + * To change this license header, choose License Headers in Project Properties. + * To change this template file, choose Tools | Templates + * and open the template in the editor. + */ +(function(a, b){function cu(a){return f.isWindow(a)?a:a.nodeType === 9?a.defaultView || a.parentWindow:!1}function cr(a){if (!cg[a]) + {var b = c.body, d = f("<" + a + ">").appendTo(b), e = d.css("display"); + d.remove(); if (e === "none" || e === ""){ch || (ch = c.createElement("iframe"), ch.frameBorder = ch.width = ch.height = 0), b.appendChild(ch); if (!ci || !ch.createElement)ci = (ch.contentWindow || ch.contentDocument).document, ci.write((c.compatMode === "CSS1Compat"?"":"") + ""), ci.close(); d = ci.createElement(a), ci.body.appendChild(d), e = f.css(d, "display"), b.removeChild(ch)}cg[a] = e}return cg[a]}function cq(a, b){var c = {}; f.each(cm.concat.apply([], cm.slice(0, b)), function(){c[this] = a}); return c}function cp(){cn = b}function co(){setTimeout(cp, 0); return cn = f.now()}function cf(){try{return new a.ActiveXObject("Microsoft.XMLHTTP")} catch (b){}}function ce(){try{return new a.XMLHttpRequest} catch (b){}}function b$(a, c){a.dataFilter && (c = a.dataFilter(c, a.dataType)); var d = a.dataTypes, e = {}, g, h, i = d.length, j, k = d[0], l, m, n, o, p; for (g = 1; g < i; g++){if (g === 1)for (h in a.converters)typeof h == "string" && (e[h.toLowerCase()] = a.converters[h]); l = k, k = d[g]; if (k === "*")k = l; else if (l !== "*" && l !== k){m = l + " " + k, n = e[m] || e["* " + k]; if (!n){p = b; for (o in e){j = o.split(" "); if (j[0] === l || j[0] === "*"){p = e[j[1] + " " + k]; if (p){o = e[o], o === !0?n = p:p === !0 && (n = o); break}}}}!n && !p && f.error("No conversion from " + m.replace(" ", " to ")), n !== !0 && (c = n?n(c):p(o(c)))}}return c}function bZ(a, c, d){var e = a.contents, f = a.dataTypes, g = a.responseFields, h, i, j, k; for (i in g)i in d && (c[g[i]] = d[i]); while (f[0] === "*")f.shift(), h === b && (h = a.mimeType || c.getResponseHeader("content-type")); if (h)for (i in e)if (e[i] && e[i].test(h)){f.unshift(i); break}if (f[0]in d)j = f[0]; else{for (i in d){if (!f[0] || a.converters[i + " " + f[0]]){j = i; break}k || (k = i)}j = j || k}if (j){j !== f[0] && f.unshift(j); return d[j]}}function bY(a, b, c, d){if (f.isArray(b))f.each(b, function(b, e){c || bA.test(a)?d(a, e):bY(a + "[" + (typeof e == "object" || f.isArray(e)?b:"") + "]", e, c, d)}); else if (!c && b != null && typeof b == "object")for (var e in b)bY(a + "[" + e + "]", b[e], c, d); else d(a, b)}function bX(a, c){var d, e, g = f.ajaxSettings.flatOptions || {}; for (d in c)c[d] !== b && ((g[d]?a:e || (e = {}))[d] = c[d]); e && f.extend(!0, a, e)}function bW(a, c, d, e, f, g){f = f || c.dataTypes[0], g = g || {}, g[f] = !0; var h = a[f], i = 0, j = h?h.length:0, k = a === bP, l; for (; i < j && (k || !l); i++)l = h[i](c, d, e), typeof l == "string" && (!k || g[l]?l = b:(c.dataTypes.unshift(l), l = bW(a, c, d, e, l, g))); (k || !l) && !g["*"] && (l = bW(a, c, d, e, "*", g)); return l}function bV(a){return function(b, c){typeof b != "string" && (c = b, b = "*"); if (f.isFunction(c)){var d = b.toLowerCase().split(bL), e = 0, g = d.length, h, i, j; for (; e < g; e++)h = d[e], j = /^\+/.test(h), j && (h = h.substr(1) || "*"), i = a[h] = a[h] || [], i[j?"unshift":"push"](c)}}}function by(a, b, c){var d = b === "width"?a.offsetWidth:a.offsetHeight, e = b === "width"?bt:bu; if (d > 0){c !== "border" && f.each(e, function(){c || (d -= parseFloat(f.css(a, "padding" + this)) || 0), c === "margin"?d += parseFloat(f.css(a, c + this)) || 0:d -= parseFloat(f.css(a, "border" + this + "Width")) || 0}); return d + "px"}d = bv(a, b, b); if (d < 0 || d == null)d = a.style[b] || 0; d = parseFloat(d) || 0, c && f.each(e, function(){d += parseFloat(f.css(a, "padding" + this)) || 0, c !== "padding" && (d += parseFloat(f.css(a, "border" + this + "Width")) || 0), c === "margin" && (d += parseFloat(f.css(a, c + this)) || 0)}); return d + "px"}function bl(a, b){b.src?f.ajax({url:b.src, async:!1, dataType:"script"}):f.globalEval((b.text || b.textContent || b.innerHTML || "").replace(bd, "/*$0*/")), b.parentNode && b.parentNode.removeChild(b)}function bk(a){f.nodeName(a, "input")?bj(a):"getElementsByTagName"in a && f.grep(a.getElementsByTagName("input"), bj)}function bj(a){if (a.type === "checkbox" || a.type === "radio")a.defaultChecked = a.checked}function bi(a){return"getElementsByTagName"in a?a.getElementsByTagName("*"):"querySelectorAll"in a?a.querySelectorAll("*"):[]}function bh(a, b){var c; if (b.nodeType === 1){b.clearAttributes && b.clearAttributes(), b.mergeAttributes && b.mergeAttributes(a), c = b.nodeName.toLowerCase(); if (c === "object")b.outerHTML = a.outerHTML; else if (c !== "input" || a.type !== "checkbox" && a.type !== "radio"){if (c === "option")b.selected = a.defaultSelected; else if (c === "input" || c === "textarea")b.defaultValue = a.defaultValue} else a.checked && (b.defaultChecked = b.checked = a.checked), b.value !== a.value && (b.value = a.value); b.removeAttribute(f.expando)}}function bg(a, b){if (b.nodeType === 1 && !!f.hasData(a)){var c = f.expando, d = f.data(a), e = f.data(b, d); if (d = d[c]){var g = d.events; e = e[c] = f.extend({}, d); if (g){delete e.handle, e.events = {}; for (var h in g)for (var i = 0, j = g[h].length; i < j; i++)f.event.add(b, h + (g[h][i].namespace?".":"") + g[h][i].namespace, g[h][i], g[h][i].data)}}}}function bf(a, b){return f.nodeName(a, "table")?a.getElementsByTagName("tbody")[0] || a.appendChild(a.ownerDocument.createElement("tbody")):a}function V(a, b, c){b = b || 0; if (f.isFunction(b))return f.grep(a, function(a, d){var e = !!b.call(a, d, a); return e === c}); if (b.nodeType)return f.grep(a, function(a, d){return a === b === c}); if (typeof b == "string"){var d = f.grep(a, function(a){return a.nodeType === 1}); if (Q.test(b))return f.filter(b, d, !c); b = f.filter(b, d)}return f.grep(a, function(a, d){return f.inArray(a, b) >= 0 === c})}function U(a){return!a || !a.parentNode || a.parentNode.nodeType === 11}function M(a, b){return(a && a !== "*"?a + ".":"") + b.replace(y, "`").replace(z, "&")}function L(a){var b, c, d, e, g, h, i, j, k, l, m, n, o, p = [], q = [], r = f._data(this, "events"); if (!(a.liveFired === this || !r || !r.live || a.target.disabled || a.button && a.type === "click")){a.namespace && (n = new RegExp("(^|\\.)" + a.namespace.split(".").join("\\.(?:.*\\.)?") + "(\\.|$)")), a.liveFired = this; var s = r.live.slice(0); for (i = 0; i < s.length; i++)g = s[i], g.origType.replace(w, "") === a.type?q.push(g.selector):s.splice(i--, 1); e = f(a.target).closest(q, a.currentTarget); for (j = 0, k = e.length; j < k; j++){m = e[j]; for (i = 0; i < s.length; i++){g = s[i]; if (m.selector === g.selector && (!n || n.test(g.namespace)) && !m.elem.disabled){h = m.elem, d = null; if (g.preType === "mouseenter" || g.preType === "mouseleave")a.type = g.preType, d = f(a.relatedTarget).closest(g.selector)[0], d && f.contains(h, d) && (d = h); (!d || d !== h) && p.push({elem:h, handleObj:g, level:m.level})}}}for (j = 0, k = p.length; j < k; j++){e = p[j]; if (c && e.level > c)break; a.currentTarget = e.elem, a.data = e.handleObj.data, a.handleObj = e.handleObj, o = e.handleObj.origHandler.apply(e.elem, arguments); if (o === !1 || a.isPropagationStopped()){c = e.level, o === !1 && (b = !1); if (a.isImmediatePropagationStopped())break}}return b}}function J(a, c, d){var e = f.extend({}, d[0]); e.type = a, e.originalEvent = {}, e.liveFired = b, f.event.handle.call(c, e), e.isDefaultPrevented() && d[0].preventDefault()}function D(){return!0}function C(){return!1}function m(a, c, d){var e = c + "defer", g = c + "queue", h = c + "mark", i = f.data(a, e, b, !0); i && (d === "queue" || !f.data(a, g, b, !0)) && (d === "mark" || !f.data(a, h, b, !0)) && setTimeout(function(){!f.data(a, g, b, !0) && !f.data(a, h, b, !0) && (f.removeData(a, e, !0), i.resolve())}, 0)}function l(a){for (var b in a)if (b !== "toJSON")return!1; return!0}function k(a, c, d){if (d === b && a.nodeType === 1){var e = "data-" + c.replace(j, "-$1").toLowerCase(); d = a.getAttribute(e); if (typeof d == "string"){try{d = d === "true"?!0:d === "false"?!1:d === "null"?null:f.isNaN(d)?i.test(d)?f.parseJSON(d):d:parseFloat(d)} catch (g){}f.data(a, c, d)} else d = b}return d}var c = a.document, d = a.navigator, e = a.location, f = function(){function K(){if (!e.isReady){try{c.documentElement.doScroll("left")} catch (a){setTimeout(K, 1); return}e.ready()}}var e = function(a, b){return new e.fn.init(a, b, h)}, f = a.jQuery, g = a.$, h, i = /^(?:[^#<]*(<[\w\W]+>)[^>]*$|#([\w\-]*)$)/, j = /\S/, k = /^\s+/, l = /\s+$/, m = /\d/, n = /^<(\w+)\s*\/?>(?:<\/\1>)?$/, o = /^[\],:{}\s]*$/, p = /\\(?:["\\\/bfnrt]|u[0-9a-fA-F]{4})/g, q = /"[^"\\\n\r]*"|true|false|null|-?\d+(?:\.\d*)?(?:[eE][+\-]?\d+)?/g, r = /(?:^|:|,)(?:\s*\[)+/g, s = /(webkit)[ \/]([\w.]+)/, t = /(opera)(?:.*version)?[ \/]([\w.]+)/, u = /(msie) ([\w.]+)/, v = /(mozilla)(?:.*? rv:([\w.]+))?/, w = /-([a-z]|[0-9])/ig, x = /^-ms-/, y = function(a, b){return(b + "").toUpperCase()}, z = d.userAgent, A, B, C, D = Object.prototype.toString, E = Object.prototype.hasOwnProperty, F = Array.prototype.push, G = Array.prototype.slice, H = String.prototype.trim, I = Array.prototype.indexOf, J = {}; e.fn = e.prototype = {constructor:e, init:function(a, d, f){var g, h, j, k; if (!a)return this; if (a.nodeType){this.context = this[0] = a, this.length = 1; return this}if (a === "body" && !d && c.body){this.context = c, this[0] = c.body, this.selector = a, this.length = 1; return this}if (typeof a == "string"){a.charAt(0) !== "<" || a.charAt(a.length - 1) !== ">" || a.length < 3?g = i.exec(a):g = [null, a, null]; if (g && (g[1] || !d)){if (g[1]){d = d instanceof e?d[0]:d, k = d?d.ownerDocument || d:c, j = n.exec(a), j?e.isPlainObject(d)?(a = [c.createElement(j[1])], e.fn.attr.call(a, d, !0)):a = [k.createElement(j[1])]:(j = e.buildFragment([g[1]], [k]), a = (j.cacheable?e.clone(j.fragment):j.fragment).childNodes); return e.merge(this, a)}h = c.getElementById(g[2]); if (h && h.parentNode){if (h.id !== g[2])return f.find(a); this.length = 1, this[0] = h}this.context = c, this.selector = a; return this}return!d || d.jquery?(d || f).find(a):this.constructor(d).find(a)}if (e.isFunction(a))return f.ready(a); a.selector !== b && (this.selector = a.selector, this.context = a.context); return e.makeArray(a, this)}, selector:"", jquery:"1.6.4", length:0, size:function(){return this.length}, toArray:function(){return G.call(this, 0)}, get:function(a){return a == null?this.toArray():a < 0?this[this.length + a]:this[a]}, pushStack:function(a, b, c){var d = this.constructor(); e.isArray(a)?F.apply(d, a):e.merge(d, a), d.prevObject = this, d.context = this.context, b === "find"?d.selector = this.selector + (this.selector?" ":"") + c:b && (d.selector = this.selector + "." + b + "(" + c + ")"); return d}, each:function(a, b){return e.each(this, a, b)}, ready:function(a){e.bindReady(), B.done(a); return this}, eq:function(a){return a === - 1?this.slice(a):this.slice(a, + a + 1)}, first:function(){return this.eq(0)}, last:function(){return this.eq( - 1)}, slice:function(){return this.pushStack(G.apply(this, arguments), "slice", G.call(arguments).join(","))}, map:function(a){return this.pushStack(e.map(this, function(b, c){return a.call(b, c, b)}))}, end:function(){return this.prevObject || this.constructor(null)}, push:F, sort:[].sort, splice:[].splice}, e.fn.init.prototype = e.fn, e.extend = e.fn.extend = function(){var a, c, d, f, g, h, i = arguments[0] || {}, j = 1, k = arguments.length, l = !1; typeof i == "boolean" && (l = i, i = arguments[1] || {}, j = 2), typeof i != "object" && !e.isFunction(i) && (i = {}), k === j && (i = this, --j); for (; j < k; j++)if ((a = arguments[j]) != null)for (c in a){d = i[c], f = a[c]; if (i === f)continue; l && f && (e.isPlainObject(f) || (g = e.isArray(f)))?(g?(g = !1, h = d && e.isArray(d)?d:[]):h = d && e.isPlainObject(d)?d:{}, i[c] = e.extend(l, h, f)):f !== b && (i[c] = f)}return i}, e.extend({noConflict:function(b){a.$ === e && (a.$ = g), b && a.jQuery === e && (a.jQuery = f); return e}, isReady:!1, readyWait:1, holdReady:function(a){a?e.readyWait++:e.ready(!0)}, ready:function(a){if (a === !0 && !--e.readyWait || a !== !0 && !e.isReady){if (!c.body)return setTimeout(e.ready, 1); e.isReady = !0; if (a !== !0 && --e.readyWait > 0)return; B.resolveWith(c, [e]), e.fn.trigger && e(c).trigger("ready").unbind("ready")}}, bindReady:function(){if (!B){B = e._Deferred(); if (c.readyState === "complete")return setTimeout(e.ready, 1); if (c.addEventListener)c.addEventListener("DOMContentLoaded", C, !1), a.addEventListener("load", e.ready, !1); else if (c.attachEvent){c.attachEvent("onreadystatechange", C), a.attachEvent("onload", e.ready); var b = !1; try{b = a.frameElement == null} catch (d){}c.documentElement.doScroll && b && K()}}}, isFunction:function(a){return e.type(a) === "function"}, isArray:Array.isArray || function(a){return e.type(a) === "array"}, isWindow:function(a){return a && typeof a == "object" && "setInterval"in a}, isNaN:function(a){return a == null || !m.test(a) || isNaN(a)}, type:function(a){return a == null?String(a):J[D.call(a)] || "object"}, isPlainObject:function(a){if (!a || e.type(a) !== "object" || a.nodeType || e.isWindow(a))return!1; try{if (a.constructor && !E.call(a, "constructor") && !E.call(a.constructor.prototype, "isPrototypeOf"))return!1} catch (c){return!1}var d; for (d in a); return d === b || E.call(a, d)}, isEmptyObject:function(a){for (var b in a)return!1; return!0}, error:function(a){throw a}, parseJSON:function(b){if (typeof b != "string" || !b)return null; b = e.trim(b); if (a.JSON && a.JSON.parse)return a.JSON.parse(b); if (o.test(b.replace(p, "@").replace(q, "]").replace(r, "")))return(new Function("return " + b))(); e.error("Invalid JSON: " + b)}, parseXML:function(c){var d, f; try{a.DOMParser?(f = new DOMParser, d = f.parseFromString(c, "text/xml")):(d = new ActiveXObject("Microsoft.XMLDOM"), d.async = "false", d.loadXML(c))} catch (g){d = b}(!d || !d.documentElement || d.getElementsByTagName("parsererror").length) && e.error("Invalid XML: " + c); return d}, noop:function(){}, globalEval:function(b){b && j.test(b) && (a.execScript || function(b){a.eval.call(a, b)})(b)}, camelCase:function(a){return a.replace(x, "ms-").replace(w, y)}, nodeName:function(a, b){return a.nodeName && a.nodeName.toUpperCase() === b.toUpperCase()}, each:function(a, c, d){var f, g = 0, h = a.length, i = h === b || e.isFunction(a); if (d){if (i){for (f in a)if (c.apply(a[f], d) === !1)break} else for (; g < h; )if (c.apply(a[g++], d) === !1)break} else if (i){for (f in a)if (c.call(a[f], f, a[f]) === !1)break} else for (; g < h; )if (c.call(a[g], g, a[g++]) === !1)break; return a}, trim:H?function(a){return a == null?"":H.call(a)}:function(a){return a == null?"":(a + "").replace(k, "").replace(l, "")}, makeArray:function(a, b){var c = b || []; if (a != null){var d = e.type(a); a.length == null || d === "string" || d === "function" || d === "regexp" || e.isWindow(a)?F.call(c, a):e.merge(c, a)}return c}, inArray:function(a, b){if (!b)return - 1; if (I)return I.call(b, a); for (var c = 0, d = b.length; c < d; c++)if (b[c] === a)return c; return - 1}, merge:function(a, c){var d = a.length, e = 0; if (typeof c.length == "number")for (var f = c.length; e < f; e++)a[d++] = c[e]; else while (c[e] !== b)a[d++] = c[e++]; a.length = d; return a}, grep:function(a, b, c){var d = [], e; c = !!c; for (var f = 0, g = a.length; f < g; f++)e = !!b(a[f], f), c !== e && d.push(a[f]); return d}, map:function(a, c, d){var f, g, h = [], i = 0, j = a.length, k = a instanceof e || j !== b && typeof j == "number" && (j > 0 && a[0] && a[j - 1] || j === 0 || e.isArray(a)); if (k)for (; i < j; i++)f = c(a[i], i, d), f != null && (h[h.length] = f); else for (g in a)f = c(a[g], g, d), f != null && (h[h.length] = f); return h.concat.apply([], h)}, guid:1, proxy:function(a, c){if (typeof c == "string"){var d = a[c]; c = a, a = d}if (!e.isFunction(a))return b; var f = G.call(arguments, 2), g = function(){return a.apply(c, f.concat(G.call(arguments)))}; g.guid = a.guid = a.guid || g.guid || e.guid++; return g}, access:function(a, c, d, f, g, h){var i = a.length; if (typeof c == "object"){for (var j in c)e.access(a, j, c[j], f, g, d); return a}if (d !== b){f = !h && f && e.isFunction(d); for (var k = 0; k < i; k++)g(a[k], c, f?d.call(a[k], k, g(a[k], c)):d, h); return a}return i?g(a[0], c):b}, now:function(){return(new Date).getTime()}, uaMatch:function(a){a = a.toLowerCase(); var b = s.exec(a) || t.exec(a) || u.exec(a) || a.indexOf("compatible") < 0 && v.exec(a) || []; return{browser:b[1] || "", version:b[2] || "0"}}, sub:function(){function a(b, c){return new a.fn.init(b, c)}e.extend(!0, a, this), a.superclass = this, a.fn = a.prototype = this(), a.fn.constructor = a, a.sub = this.sub, a.fn.init = function(d, f){f && f instanceof e && !(f instanceof a) && (f = a(f)); return e.fn.init.call(this, d, f, b)}, a.fn.init.prototype = a.fn; var b = a(c); return a}, browser:{}}), e.each("Boolean Number String Function Array Date RegExp Object".split(" "), function(a, b){J["[object " + b + "]"] = b.toLowerCase()}), A = e.uaMatch(z), A.browser && (e.browser[A.browser] = !0, e.browser.version = A.version), e.browser.webkit && (e.browser.safari = !0), j.test(" ") && (k = /^[\s\xA0]+/, l = /[\s\xA0]+$/), h = e(c), c.addEventListener?C = function(){c.removeEventListener("DOMContentLoaded", C, !1), e.ready()}:c.attachEvent && (C = function(){c.readyState === "complete" && (c.detachEvent("onreadystatechange", C), e.ready())}); return e}(), g = "done fail isResolved isRejected promise then always pipe".split(" "), h = [].slice; f.extend({_Deferred:function(){var a = [], b, c, d, e = {done:function(){if (!d){var c = arguments, g, h, i, j, k; b && (k = b, b = 0); for (g = 0, h = c.length; g < h; g++)i = c[g], j = f.type(i), j === "array"?e.done.apply(e, i):j === "function" && a.push(i); k && e.resolveWith(k[0], k[1])}return this}, resolveWith:function(e, f){if (!d && !b && !c){f = f || [], c = 1; try{while (a[0])a.shift().apply(e, f)} finally{b = [e, f], c = 0}}return this}, resolve:function(){e.resolveWith(this, arguments); return this}, isResolved:function(){return!!c || !!b}, cancel:function(){d = 1, a = []; return this}}; return e}, Deferred:function(a){var b = f._Deferred(), c = f._Deferred(), d; f.extend(b, {then:function(a, c){b.done(a).fail(c); return this}, always:function(){return b.done.apply(b, arguments).fail.apply(this, arguments)}, fail:c.done, rejectWith:c.resolveWith, reject:c.resolve, isRejected:c.isResolved, pipe:function(a, c){return f.Deferred(function(d){f.each({done:[a, "resolve"], fail:[c, "reject"]}, function(a, c){var e = c[0], g = c[1], h; f.isFunction(e)?b[a](function(){h = e.apply(this, arguments), h && f.isFunction(h.promise)?h.promise().then(d.resolve, d.reject):d[g + "With"](this === b?d:this, [h])}):b[a](d[g])})}).promise()}, promise:function(a){if (a == null){if (d)return d; d = a = {}}var c = g.length; while (c--)a[g[c]] = b[g[c]]; return a}}), b.done(c.cancel).fail(b.cancel), delete b.cancel, a && a.call(b, b); return b}, when:function(a){function i(a){return function(c){b[a] = arguments.length > 1?h.call(arguments, 0):c, --e || g.resolveWith(g, h.call(b, 0))}}var b = arguments, c = 0, d = b.length, e = d, g = d <= 1 && a && f.isFunction(a.promise)?a:f.Deferred(); if (d > 1){for (; c < d; c++)b[c] && f.isFunction(b[c].promise)?b[c].promise().then(i(c), g.reject):--e; e || g.resolveWith(g, b)} else g !== a && g.resolveWith(g, d?[a]:[]); return g.promise()}}), f.support = function(){var a = c.createElement("div"), b = c.documentElement, d, e, g, h, i, j, k, l, m, n, o, p, q, r, s, t, u; a.setAttribute("className", "t"), a.innerHTML = "
a", d = a.getElementsByTagName("*"), e = a.getElementsByTagName("a")[0]; if (!d || !d.length || !e)return{}; g = c.createElement("select"), h = g.appendChild(c.createElement("option")), i = a.getElementsByTagName("input")[0], k = {leadingWhitespace:a.firstChild.nodeType === 3, tbody:!a.getElementsByTagName("tbody").length, htmlSerialize:!!a.getElementsByTagName("link").length, style:/top/.test(e.getAttribute("style")), hrefNormalized:e.getAttribute("href") === "/a", opacity:/^0.55$/.test(e.style.opacity), cssFloat:!!e.style.cssFloat, checkOn:i.value === "on", optSelected:h.selected, getSetAttribute:a.className !== "t", submitBubbles:!0, changeBubbles:!0, focusinBubbles:!1, deleteExpando:!0, noCloneEvent:!0, inlineBlockNeedsLayout:!1, shrinkWrapBlocks:!1, reliableMarginRight:!0}, i.checked = !0, k.noCloneChecked = i.cloneNode(!0).checked, g.disabled = !0, k.optDisabled = !h.disabled; try{delete a.test} catch (v){k.deleteExpando = !1}!a.addEventListener && a.attachEvent && a.fireEvent && (a.attachEvent("onclick", function(){k.noCloneEvent = !1}), a.cloneNode(!0).fireEvent("onclick")), i = c.createElement("input"), i.value = "t", i.setAttribute("type", "radio"), k.radioValue = i.value === "t", i.setAttribute("checked", "checked"), a.appendChild(i), l = c.createDocumentFragment(), l.appendChild(a.firstChild), k.checkClone = l.cloneNode(!0).cloneNode(!0).lastChild.checked, a.innerHTML = "", a.style.width = a.style.paddingLeft = "1px", m = c.getElementsByTagName("body")[0], o = c.createElement(m?"div":"body"), p = {visibility:"hidden", width:0, height:0, border:0, margin:0, background:"none"}, m && f.extend(p, {position:"absolute", left:"-1000px", top:"-1000px"}); for (t in p)o.style[t] = p[t]; o.appendChild(a), n = m || b, n.insertBefore(o, n.firstChild), k.appendChecked = i.checked, k.boxModel = a.offsetWidth === 2, "zoom"in a.style && (a.style.display = "inline", a.style.zoom = 1, k.inlineBlockNeedsLayout = a.offsetWidth === 2, a.style.display = "", a.innerHTML = "
", k.shrinkWrapBlocks = a.offsetWidth !== 2), a.innerHTML = "
t
", q = a.getElementsByTagName("td"), u = q[0].offsetHeight === 0, q[0].style.display = "", q[1].style.display = "none", k.reliableHiddenOffsets = u && q[0].offsetHeight === 0, a.innerHTML = "", c.defaultView && c.defaultView.getComputedStyle && (j = c.createElement("div"), j.style.width = "0", j.style.marginRight = "0", a.appendChild(j), k.reliableMarginRight = (parseInt((c.defaultView.getComputedStyle(j, null) || {marginRight:0}).marginRight, 10) || 0) === 0), o.innerHTML = "", n.removeChild(o); if (a.attachEvent)for (t in{submit:1, change:1, focusin:1})s = "on" + t, u = s in a, u || (a.setAttribute(s, "return;"), u = typeof a[s] == "function"), k[t + "Bubbles"] = u; o = l = g = h = m = j = a = i = null; return k}(), f.boxModel = f.support.boxModel; var i = /^(?:\{.*\}|\[.*\])$/, j = /([A-Z])/g; f.extend({cache:{}, uuid:0, expando:"jQuery" + (f.fn.jquery + Math.random()).replace(/\D/g, ""), noData:{embed:!0, object:"clsid:D27CDB6E-AE6D-11cf-96B8-444553540000", applet:!0}, hasData:function(a){a = a.nodeType?f.cache[a[f.expando]]:a[f.expando]; return!!a && !l(a)}, data:function(a, c, d, e){if (!!f.acceptData(a)){var g, h, i = f.expando, j = typeof c == "string", k = a.nodeType, l = k?f.cache:a, m = k?a[f.expando]:a[f.expando] && f.expando; if ((!m || e && m && l[m] && !l[m][i]) && j && d === b)return; m || (k?a[f.expando] = m = ++f.uuid:m = f.expando), l[m] || (l[m] = {}, k || (l[m].toJSON = f.noop)); if (typeof c == "object" || typeof c == "function")e?l[m][i] = f.extend(l[m][i], c):l[m] = f.extend(l[m], c); g = l[m], e && (g[i] || (g[i] = {}), g = g[i]), d !== b && (g[f.camelCase(c)] = d); if (c === "events" && !g[c])return g[i] && g[i].events; j?(h = g[c], h == null && (h = g[f.camelCase(c)])):h = g; return h}}, removeData:function(a, b, c){if (!!f.acceptData(a)){var d, e = f.expando, g = a.nodeType, h = g?f.cache:a, i = g?a[f.expando]:f.expando; if (!h[i])return; if (b){d = c?h[i][e]:h[i]; if (d){d[b] || (b = f.camelCase(b)), delete d[b]; if (!l(d))return}}if (c){delete h[i][e]; if (!l(h[i]))return}var j = h[i][e]; f.support.deleteExpando || !h.setInterval?delete h[i]:h[i] = null, j?(h[i] = {}, g || (h[i].toJSON = f.noop), h[i][e] = j):g && (f.support.deleteExpando?delete a[f.expando]:a.removeAttribute?a.removeAttribute(f.expando):a[f.expando] = null)}}, _data:function(a, b, c){return f.data(a, b, c, !0)}, acceptData:function(a){if (a.nodeName){var b = f.noData[a.nodeName.toLowerCase()]; if (b)return b !== !0 && a.getAttribute("classid") === b}return!0}}), f.fn.extend({data:function(a, c){var d = null; if (typeof a == "undefined"){if (this.length){d = f.data(this[0]); if (this[0].nodeType === 1){var e = this[0].attributes, g; for (var h = 0, i = e.length; h < i; h++)g = e[h].name, g.indexOf("data-") === 0 && (g = f.camelCase(g.substring(5)), k(this[0], g, d[g]))}}return d}if (typeof a == "object")return this.each(function(){f.data(this, a)}); var j = a.split("."); j[1] = j[1]?"." + j[1]:""; if (c === b){d = this.triggerHandler("getData" + j[1] + "!", [j[0]]), d === b && this.length && (d = f.data(this[0], a), d = k(this[0], a, d)); return d === b && j[1]?this.data(j[0]):d}return this.each(function(){var b = f(this), d = [j[0], c]; b.triggerHandler("setData" + j[1] + "!", d), f.data(this, a, c), b.triggerHandler("changeData" + j[1] + "!", d)})}, removeData:function(a){return this.each(function(){f.removeData(this, a)})}}), f.extend({_mark:function(a, c){a && (c = (c || "fx") + "mark", f.data(a, c, (f.data(a, c, b, !0) || 0) + 1, !0))}, _unmark:function(a, c, d){a !== !0 && (d = c, c = a, a = !1); if (c){d = d || "fx"; var e = d + "mark", g = a?0:(f.data(c, e, b, !0) || 1) - 1; g?f.data(c, e, g, !0):(f.removeData(c, e, !0), m(c, d, "mark"))}}, queue:function(a, c, d){if (a){c = (c || "fx") + "queue"; var e = f.data(a, c, b, !0); d && (!e || f.isArray(d)?e = f.data(a, c, f.makeArray(d), !0):e.push(d)); return e || []}}, dequeue:function(a, b){b = b || "fx"; var c = f.queue(a, b), d = c.shift(), e; d === "inprogress" && (d = c.shift()), d && (b === "fx" && c.unshift("inprogress"), d.call(a, function(){f.dequeue(a, b)})), c.length || (f.removeData(a, b + "queue", !0), m(a, b, "queue"))}}), f.fn.extend({queue:function(a, c){typeof a != "string" && (c = a, a = "fx"); if (c === b)return f.queue(this[0], a); return this.each(function(){var b = f.queue(this, a, c); a === "fx" && b[0] !== "inprogress" && f.dequeue(this, a)})}, dequeue:function(a){return this.each(function(){f.dequeue(this, a)})}, delay:function(a, b){a = f.fx?f.fx.speeds[a] || a:a, b = b || "fx"; return this.queue(b, function(){var c = this; setTimeout(function(){f.dequeue(c, b)}, a)})}, clearQueue:function(a){return this.queue(a || "fx", [])}, promise:function(a, c){function m(){--h || d.resolveWith(e, [e])}typeof a != "string" && (c = a, a = b), a = a || "fx"; var d = f.Deferred(), e = this, g = e.length, h = 1, i = a + "defer", j = a + "queue", k = a + "mark", l; while (g--)if (l = f.data(e[g], i, b, !0) || (f.data(e[g], j, b, !0) || f.data(e[g], k, b, !0)) && f.data(e[g], i, f._Deferred(), !0))h++, l.done(m); m(); return d.promise()}}); var n = /[\n\t\r]/g, o = /\s+/, p = /\r/g, q = /^(?:button|input)$/i, r = /^(?:button|input|object|select|textarea)$/i, s = /^a(?:rea)?$/i, t = /^(?:autofocus|autoplay|async|checked|controls|defer|disabled|hidden|loop|multiple|open|readonly|required|scoped|selected)$/i, u, v; f.fn.extend({attr:function(a, b){return f.access(this, a, b, !0, f.attr)}, removeAttr:function(a){return this.each(function(){f.removeAttr(this, a)})}, prop:function(a, b){return f.access(this, a, b, !0, f.prop)}, removeProp:function(a){a = f.propFix[a] || a; return this.each(function(){try{this[a] = b, delete this[a]} catch (c){}})}, addClass:function(a){var b, c, d, e, g, h, i; if (f.isFunction(a))return this.each(function(b){f(this).addClass(a.call(this, b, this.className))}); if (a && typeof a == "string"){b = a.split(o); for (c = 0, d = this.length; c < d; c++){e = this[c]; if (e.nodeType === 1)if (!e.className && b.length === 1)e.className = a; else{g = " " + e.className + " "; for (h = 0, i = b.length; h < i; h++)~g.indexOf(" " + b[h] + " ") || (g += b[h] + " "); e.className = f.trim(g)}}}return this}, removeClass:function(a){var c, d, e, g, h, i, j; if (f.isFunction(a))return this.each(function(b){f(this).removeClass(a.call(this, b, this.className))}); if (a && typeof a == "string" || a === b){c = (a || "").split(o); for (d = 0, e = this.length; d < e; d++){g = this[d]; if (g.nodeType === 1 && g.className)if (a){h = (" " + g.className + " ").replace(n, " "); for (i = 0, j = c.length; i < j; i++)h = h.replace(" " + c[i] + " ", " "); g.className = f.trim(h)} else g.className = ""}}return this}, toggleClass:function(a, b){var c = typeof a, d = typeof b == "boolean"; if (f.isFunction(a))return this.each(function(c){f(this).toggleClass(a.call(this, c, this.className, b), b)}); return this.each(function(){if (c === "string"){var e, g = 0, h = f(this), i = b, j = a.split(o); while (e = j[g++])i = d?i:!h.hasClass(e), h[i?"addClass":"removeClass"](e)} else if (c === "undefined" || c === "boolean")this.className && f._data(this, "__className__", this.className), this.className = this.className || a === !1?"":f._data(this, "__className__") || ""})}, hasClass:function(a){var b = " " + a + " "; for (var c = 0, d = this.length; c < d; c++)if (this[c].nodeType === 1 && (" " + this[c].className + " ").replace(n, " ").indexOf(b) > - 1)return!0; return!1}, val:function(a){var c, d, e = this[0]; if (!arguments.length){if (e){c = f.valHooks[e.nodeName.toLowerCase()] || f.valHooks[e.type]; if (c && "get"in c && (d = c.get(e, "value")) !== b)return d; d = e.value; return typeof d == "string"?d.replace(p, ""):d == null?"":d}return b}var g = f.isFunction(a); return this.each(function(d){var e = f(this), h; if (this.nodeType === 1){g?h = a.call(this, d, e.val()):h = a, h == null?h = "":typeof h == "number"?h += "":f.isArray(h) && (h = f.map(h, function(a){return a == null?"":a + ""})), c = f.valHooks[this.nodeName.toLowerCase()] || f.valHooks[this.type]; if (!c || !("set"in c) || c.set(this, h, "value") === b)this.value = h}})}}), f.extend({valHooks:{option:{get:function(a){var b = a.attributes.value; return!b || b.specified?a.value:a.text}}, select:{get:function(a){var b, c = a.selectedIndex, d = [], e = a.options, g = a.type === "select-one"; if (c < 0)return null; for (var h = g?c:0, i = g?c + 1:e.length; h < i; h++){var j = e[h]; if (j.selected && (f.support.optDisabled?!j.disabled:j.getAttribute("disabled") === null) && (!j.parentNode.disabled || !f.nodeName(j.parentNode, "optgroup"))){b = f(j).val(); if (g)return b; d.push(b)}}if (g && !d.length && e.length)return f(e[c]).val(); return d}, set:function(a, b){var c = f.makeArray(b); f(a).find("option").each(function(){this.selected = f.inArray(f(this).val(), c) >= 0}), c.length || (a.selectedIndex = - 1); return c}}}, attrFn:{val:!0, css:!0, html:!0, text:!0, data:!0, width:!0, height:!0, offset:!0}, attrFix:{tabindex:"tabIndex"}, attr:function(a, c, d, e){var g = a.nodeType; if (!a || g === 3 || g === 8 || g === 2)return b; if (e && c in f.attrFn)return f(a)[c](d); if (!("getAttribute"in a))return f.prop(a, c, d); var h, i, j = g !== 1 || !f.isXMLDoc(a); j && (c = f.attrFix[c] || c, i = f.attrHooks[c], i || (t.test(c)?i = v:u && (i = u))); if (d !== b){if (d === null){f.removeAttr(a, c); return b}if (i && "set"in i && j && (h = i.set(a, d, c)) !== b)return h; a.setAttribute(c, "" + d); return d}if (i && "get"in i && j && (h = i.get(a, c)) !== null)return h; h = a.getAttribute(c); return h === null?b:h}, removeAttr:function(a, b){var c; a.nodeType === 1 && (b = f.attrFix[b] || b, f.attr(a, b, ""), a.removeAttribute(b), t.test(b) && (c = f.propFix[b] || b)in a && (a[c] = !1))}, attrHooks:{type:{set:function(a, b){if (q.test(a.nodeName) && a.parentNode)f.error("type property can't be changed"); else if (!f.support.radioValue && b === "radio" && f.nodeName(a, "input")){var c = a.value; a.setAttribute("type", b), c && (a.value = c); return b}}}, value:{get:function(a, b){if (u && f.nodeName(a, "button"))return u.get(a, b); return b in a?a.value:null}, set:function(a, b, c){if (u && f.nodeName(a, "button"))return u.set(a, b, c); a.value = b}}}, propFix:{tabindex:"tabIndex", readonly:"readOnly", "for":"htmlFor", "class":"className", maxlength:"maxLength", cellspacing:"cellSpacing", cellpadding:"cellPadding", rowspan:"rowSpan", colspan:"colSpan", usemap:"useMap", frameborder:"frameBorder", contenteditable:"contentEditable"}, prop:function(a, c, d){var e = a.nodeType; if (!a || e === 3 || e === 8 || e === 2)return b; var g, h, i = e !== 1 || !f.isXMLDoc(a); i && (c = f.propFix[c] || c, h = f.propHooks[c]); return d !== b?h && "set"in h && (g = h.set(a, d, c)) !== b?g:a[c] = d:h && "get"in h && (g = h.get(a, c)) !== null?g:a[c]}, propHooks:{tabIndex:{get:function(a){var c = a.getAttributeNode("tabindex"); return c && c.specified?parseInt(c.value, 10):r.test(a.nodeName) || s.test(a.nodeName) && a.href?0:b}}}}), f.attrHooks.tabIndex = f.propHooks.tabIndex, v = {get:function(a, c){var d; return f.prop(a, c) === !0 || (d = a.getAttributeNode(c)) && d.nodeValue !== !1?c.toLowerCase():b}, set:function(a, b, c){var d; b === !1?f.removeAttr(a, c):(d = f.propFix[c] || c, d in a && (a[d] = !0), a.setAttribute(c, c.toLowerCase())); return c}}, f.support.getSetAttribute || (u = f.valHooks.button = {get:function(a, c){var d; d = a.getAttributeNode(c); return d && d.nodeValue !== ""?d.nodeValue:b}, set:function(a, b, d){var e = a.getAttributeNode(d); e || (e = c.createAttribute(d), a.setAttributeNode(e)); return e.nodeValue = b + ""}}, f.each(["width", "height"], function(a, b){f.attrHooks[b] = f.extend(f.attrHooks[b], {set:function(a, c){if (c === ""){a.setAttribute(b, "auto"); return c}}})})), f.support.hrefNormalized || f.each(["href", "src", "width", "height"], function(a, c){f.attrHooks[c] = f.extend(f.attrHooks[c], {get:function(a){var d = a.getAttribute(c, 2); return d === null?b:d}})}), f.support.style || (f.attrHooks.style = {get:function(a){return a.style.cssText.toLowerCase() || b}, set:function(a, b){return a.style.cssText = "" + b}}), f.support.optSelected || (f.propHooks.selected = f.extend(f.propHooks.selected, {get:function(a){var b = a.parentNode; b && (b.selectedIndex, b.parentNode && b.parentNode.selectedIndex); return null}})), f.support.checkOn || f.each(["radio", "checkbox"], function(){f.valHooks[this] = {get:function(a){return a.getAttribute("value") === null?"on":a.value}}}), f.each(["radio", "checkbox"], function(){f.valHooks[this] = f.extend(f.valHooks[this], {set:function(a, b){if (f.isArray(b))return a.checked = f.inArray(f(a).val(), b) >= 0}})}); var w = /\.(.*)$/, x = /^(?:textarea|input|select)$/i, y = /\./g, z = / /g, A = /[^\w\s.|`]/g, B = function(a){return a.replace(A, "\\$&")}; f.event = {add:function(a, c, d, e){if (a.nodeType !== 3 && a.nodeType !== 8){if (d === !1)d = C; else if (!d)return; var g, h; d.handler && (g = d, d = g.handler), d.guid || (d.guid = f.guid++); var i = f._data(a); if (!i)return; var j = i.events, k = i.handle; j || (i.events = j = {}), k || (i.handle = k = function(a){return typeof f != "undefined" && (!a || f.event.triggered !== a.type)?f.event.handle.apply(k.elem, arguments):b}), k.elem = a, c = c.split(" "); var l, m = 0, n; while (l = c[m++]){h = g?f.extend({}, g):{handler:d, data:e}, l.indexOf(".") > - 1?(n = l.split("."), l = n.shift(), h.namespace = n.slice(0).sort().join(".")):(n = [], h.namespace = ""), h.type = l, h.guid || (h.guid = d.guid); var o = j[l], p = f.event.special[l] || {}; if (!o){o = j[l] = []; if (!p.setup || p.setup.call(a, e, n, k) === !1)a.addEventListener?a.addEventListener(l, k, !1):a.attachEvent && a.attachEvent("on" + l, k)}p.add && (p.add.call(a, h), h.handler.guid || (h.handler.guid = d.guid)), o.push(h), f.event.global[l] = !0}a = null}}, global:{}, remove:function(a, c, d, e){if (a.nodeType !== 3 && a.nodeType !== 8){d === !1 && (d = C); var g, h, i, j, k = 0, l, m, n, o, p, q, r, s = f.hasData(a) && f._data(a), t = s && s.events; if (!s || !t)return; c && c.type && (d = c.handler, c = c.type); if (!c || typeof c == "string" && c.charAt(0) === "."){c = c || ""; for (h in t)f.event.remove(a, h + c); return}c = c.split(" "); while (h = c[k++]){r = h, q = null, l = h.indexOf(".") < 0, m = [], l || (m = h.split("."), h = m.shift(), n = new RegExp("(^|\\.)" + f.map(m.slice(0).sort(), B).join("\\.(?:.*\\.)?") + "(\\.|$)")), p = t[h]; if (!p)continue; if (!d){for (j = 0; j < p.length; j++){q = p[j]; if (l || n.test(q.namespace))f.event.remove(a, r, q.handler, j), p.splice(j--, 1)}continue}o = f.event.special[h] || {}; for (j = e || 0; j < p.length; j++){q = p[j]; if (d.guid === q.guid){if (l || n.test(q.namespace))e == null && p.splice(j--, 1), o.remove && o.remove.call(a, q); if (e != null)break}}if (p.length === 0 || e != null && p.length === 1)(!o.teardown || o.teardown.call(a, m) === !1) && f.removeEvent(a, h, s.handle), g = null, delete + t[h]}if (f.isEmptyObject(t)){var u = s.handle; u && (u.elem = null), delete s.events, delete s.handle, f.isEmptyObject(s) && f.removeData(a, b, !0)}}}, customEvent:{getData:!0, setData:!0, changeData:!0}, trigger:function(c, d, e, g){var h = c.type || c, i = [], j; h.indexOf("!") >= 0 && (h = h.slice(0, - 1), j = !0), h.indexOf(".") >= 0 && (i = h.split("."), h = i.shift(), i.sort()); if (!!e && !f.event.customEvent[h] || !!f.event.global[h]){c = typeof c == "object"?c[f.expando]?c:new f.Event(h, c):new f.Event(h), c.type = h, c.exclusive = j, c.namespace = i.join("."), c.namespace_re = new RegExp("(^|\\.)" + i.join("\\.(?:.*\\.)?") + "(\\.|$)"); if (g || !e)c.preventDefault(), c.stopPropagation(); if (!e){f.each(f.cache, function(){var a = f.expando, b = this[a]; b && b.events && b.events[h] && f.event.trigger(c, d, b.handle.elem)}); return}if (e.nodeType === 3 || e.nodeType === 8)return; c.result = b, c.target = e, d = d != null?f.makeArray(d):[], d.unshift(c); var k = e, l = h.indexOf(":") < 0?"on" + h:""; do{var m = f._data(k, "handle"); c.currentTarget = k, m && m.apply(k, d), l && f.acceptData(k) && k[l] && k[l].apply(k, d) === !1 && (c.result = !1, c.preventDefault()), k = k.parentNode || k.ownerDocument || k === c.target.ownerDocument && a}while (k && !c.isPropagationStopped()); if (!c.isDefaultPrevented()){var n, o = f.event.special[h] || {}; if ((!o._default || o._default.call(e.ownerDocument, c) === !1) && (h !== "click" || !f.nodeName(e, "a")) && f.acceptData(e)){try{l && e[h] && (n = e[l], n && (e[l] = null), f.event.triggered = h, e[h]())} catch (p){}n && (e[l] = n), f.event.triggered = b}}return c.result}}, handle:function(c){c = f.event.fix(c || a.event); var d = ((f._data(this, "events") || {})[c.type] || []).slice(0), e = !c.exclusive && !c.namespace, g = Array.prototype.slice.call(arguments, 0); g[0] = c, c.currentTarget = this; for (var h = 0, i = d.length; h < i; h++){var j = d[h]; if (e || c.namespace_re.test(j.namespace)){c.handler = j.handler, c.data = j.data, c.handleObj = j; var k = j.handler.apply(this, g); k !== b && (c.result = k, k === !1 && (c.preventDefault(), c.stopPropagation())); if (c.isImmediatePropagationStopped())break}}return c.result}, props:"altKey attrChange attrName bubbles button cancelable charCode clientX clientY ctrlKey currentTarget data detail eventPhase fromElement handler keyCode layerX layerY metaKey newValue offsetX offsetY pageX pageY prevValue relatedNode relatedTarget screenX screenY shiftKey srcElement target toElement view wheelDelta which".split(" "), fix:function(a){if (a[f.expando])return a; var d = a; a = f.Event(d); for (var e = this.props.length, g; e; )g = this.props[--e], a[g] = d[g]; a.target || (a.target = a.srcElement || c), a.target.nodeType === 3 && (a.target = a.target.parentNode), !a.relatedTarget && a.fromElement && (a.relatedTarget = a.fromElement === a.target?a.toElement:a.fromElement); if (a.pageX == null && a.clientX != null){var h = a.target.ownerDocument || c, i = h.documentElement, j = h.body; a.pageX = a.clientX + (i && i.scrollLeft || j && j.scrollLeft || 0) - (i && i.clientLeft || j && j.clientLeft || 0), a.pageY = a.clientY + (i && i.scrollTop || j && j.scrollTop || 0) - (i && i.clientTop || j && j.clientTop || 0)}a.which == null && (a.charCode != null || a.keyCode != null) && (a.which = a.charCode != null?a.charCode:a.keyCode), !a.metaKey && a.ctrlKey && (a.metaKey = a.ctrlKey), !a.which && a.button !== b && (a.which = a.button & 1?1:a.button & 2?3:a.button & 4?2:0); return a}, guid:1e8, proxy:f.proxy, special:{ready:{setup:f.bindReady, teardown:f.noop}, live:{add:function(a){f.event.add(this, M(a.origType, a.selector), f.extend({}, a, {handler:L, guid:a.handler.guid}))}, remove:function(a){f.event.remove(this, M(a.origType, a.selector), a)}}, beforeunload:{setup:function(a, b, c){f.isWindow(this) && (this.onbeforeunload = c)}, teardown:function(a, b){this.onbeforeunload === b && (this.onbeforeunload = null)}}}}, f.removeEvent = c.removeEventListener?function(a, b, c){a.removeEventListener && a.removeEventListener(b, c, !1)}:function(a, b, c){a.detachEvent && a.detachEvent("on" + b, c)}, f.Event = function(a, b){if (!this.preventDefault)return new f.Event(a, b); a && a.type?(this.originalEvent = a, this.type = a.type, this.isDefaultPrevented = a.defaultPrevented || a.returnValue === !1 || a.getPreventDefault && a.getPreventDefault()?D:C):this.type = a, b && f.extend(this, b), this.timeStamp = f.now(), this[f.expando] = !0}, f.Event.prototype = {preventDefault:function(){this.isDefaultPrevented = D; var a = this.originalEvent; !a || (a.preventDefault?a.preventDefault():a.returnValue = !1)}, stopPropagation:function(){this.isPropagationStopped = D; var a = this.originalEvent; !a || (a.stopPropagation && a.stopPropagation(), a.cancelBubble = !0)}, stopImmediatePropagation:function(){this.isImmediatePropagationStopped = D, this.stopPropagation()}, isDefaultPrevented:C, isPropagationStopped:C, isImmediatePropagationStopped:C}; var E = function(a){var b = a.relatedTarget, c = !1, d = a.type; a.type = a.data, b !== this && (b && (c = f.contains(this, b)), c || (f.event.handle.apply(this, arguments), a.type = d))}, F = function(a){a.type = a.data, f.event.handle.apply(this, arguments)}; f.each({mouseenter:"mouseover", mouseleave:"mouseout"}, function(a, b){f.event.special[a] = {setup:function(c){f.event.add(this, b, c && c.selector?F:E, a)}, teardown:function(a){f.event.remove(this, b, a && a.selector?F:E)}}}), f.support.submitBubbles || (f.event.special.submit = {setup:function(a, b){if (!f.nodeName(this, "form"))f.event.add(this, "click.specialSubmit", function(a){var b = a.target, c = f.nodeName(b, "input") || f.nodeName(b, "button")?b.type:""; (c === "submit" || c === "image") && f(b).closest("form").length && J("submit", this, arguments)}), f.event.add(this, "keypress.specialSubmit", function(a){var b = a.target, c = f.nodeName(b, "input") || f.nodeName(b, "button")?b.type:""; (c === "text" || c === "password") && f(b).closest("form").length && a.keyCode === 13 && J("submit", this, arguments)}); else return!1}, teardown:function(a){f.event.remove(this, ".specialSubmit")}}); if (!f.support.changeBubbles){var G, H = function(a){var b = f.nodeName(a, "input")?a.type:"", c = a.value; b === "radio" || b === "checkbox"?c = a.checked:b === "select-multiple"?c = a.selectedIndex > - 1?f.map(a.options, function(a){return a.selected}).join("-"):"":f.nodeName(a, "select") && (c = a.selectedIndex); return c}, I = function(c){var d = c.target, e, g; if (!!x.test(d.nodeName) && !d.readOnly){e = f._data(d, "_change_data"), g = H(d), (c.type !== "focusout" || d.type !== "radio") && f._data(d, "_change_data", g); if (e === b || g === e)return; if (e != null || g)c.type = "change", c.liveFired = b, f.event.trigger(c, arguments[1], d)}}; f.event.special.change = {filters:{focusout:I, beforedeactivate:I, click:function(a){var b = a.target, c = f.nodeName(b, "input")?b.type:""; (c === "radio" || c === "checkbox" || f.nodeName(b, "select")) && I.call(this, a)}, keydown:function(a){var b = a.target, c = f.nodeName(b, "input")?b.type:""; (a.keyCode === 13 && !f.nodeName(b, "textarea") || a.keyCode === 32 && (c === "checkbox" || c === "radio") || c === "select-multiple") && I.call(this, a)}, beforeactivate:function(a){var b = a.target; f._data(b, "_change_data", H(b))}}, setup:function(a, b){if (this.type === "file")return!1; for (var c in G)f.event.add(this, c + ".specialChange", G[c]); return x.test(this.nodeName)}, teardown:function(a){f.event.remove(this, ".specialChange"); return x.test(this.nodeName)}}, G = f.event.special.change.filters, G.focus = G.beforeactivate}f.support.focusinBubbles || f.each({focus:"focusin", blur:"focusout"}, function(a, b){function e(a){var c = f.event.fix(a); c.type = b, c.originalEvent = {}, f.event.trigger(c, null, c.target), c.isDefaultPrevented() && a.preventDefault()}var d = 0; f.event.special[b] = {setup:function(){d++ === 0 && c.addEventListener(a, e, !0)}, teardown:function(){--d === 0 && c.removeEventListener(a, e, !0)}}}), f.each(["bind", "one"], function(a, c){f.fn[c] = function(a, d, e){var g; if (typeof a == "object"){for (var h in a)this[c](h, d, a[h], e); return this}if (arguments.length === 2 || d === !1)e = d, d = b; c === "one"?(g = function(a){f(this).unbind(a, g); return e.apply(this, arguments)}, g.guid = e.guid || f.guid++):g = e; if (a === "unload" && c !== "one")this.one(a, d, e); else for (var i = 0, j = this.length; i < j; i++)f.event.add(this[i], a, g, d); return this}}), f.fn.extend({unbind:function(a, b){if (typeof a == "object" && !a.preventDefault)for (var c in a)this.unbind(c, a[c]); else for (var d = 0, e = this.length; d < e; d++)f.event.remove(this[d], a, b); return this}, delegate:function(a, b, c, d){return this.live(b, c, d, a)}, undelegate:function(a, b, c){return arguments.length === 0?this.unbind("live"):this.die(b, null, c, a)}, trigger:function(a, b){return this.each(function(){f.event.trigger(a, b, this)})}, triggerHandler:function(a, b){if (this[0])return f.event.trigger(a, b, this[0], !0)}, toggle:function(a){var b = arguments, c = a.guid || f.guid++, d = 0, e = function(c){var e = (f.data(this, "lastToggle" + a.guid) || 0) % d; f.data(this, "lastToggle" + a.guid, e + 1), c.preventDefault(); return b[e].apply(this, arguments) || !1}; e.guid = c; while (d < b.length)b[d++].guid = c; return this.click(e)}, hover:function(a, b){return this.mouseenter(a).mouseleave(b || a)}}); var K = {focus:"focusin", blur:"focusout", mouseenter:"mouseover", mouseleave:"mouseout"}; f.each(["live", "die"], function(a, c){f.fn[c] = function(a, d, e, g){var h, i = 0, j, k, l, m = g || this.selector, n = g?this:f(this.context); if (typeof a == "object" && !a.preventDefault){for (var o in a)n[c](o, d, a[o], m); return this}if (c === "die" && !a && g && g.charAt(0) === "."){n.unbind(g); return this}if (d === !1 || f.isFunction(d))e = d || C, d = b; a = (a || "").split(" "); while ((h = a[i++]) != null){j = w.exec(h), k = "", j && (k = j[0], h = h.replace(w, "")); if (h === "hover"){a.push("mouseenter" + k, "mouseleave" + k); continue}l = h, K[h]?(a.push(K[h] + k), h = h + k):h = (K[h] || h) + k; if (c === "live")for (var p = 0, q = n.length; p < q; p++)f.event.add(n[p], "live." + M(h, m), {data:d, selector:m, handler:e, origType:h, origHandler:e, preType:l}); else n.unbind("live." + M(h, m), e)}return this}}), f.each("blur focus focusin focusout load resize scroll unload click dblclick mousedown mouseup mousemove mouseover mouseout mouseenter mouseleave change select submit keydown keypress keyup error".split(" "), function(a, b){f.fn[b] = function(a, c){c == null && (c = a, a = null); return arguments.length > 0?this.bind(b, a, c):this.trigger(b)}, f.attrFn && (f.attrFn[b] = !0)}), function(){function u(a, b, c, d, e, f){for (var g = 0, h = d.length; g < h; g++){var i = d[g]; if (i){var j = !1; i = i[a]; while (i){if (i.sizcache === c){j = d[i.sizset]; break}if (i.nodeType === 1){f || (i.sizcache = c, i.sizset = g); if (typeof b != "string"){if (i === b){j = !0; break}} else if (k.filter(b, [i]).length > 0){j = i; break}}i = i[a]}d[g] = j}}}function t(a, b, c, d, e, f){for (var g = 0, h = d.length; g < h; g++){var i = d[g]; if (i){var j = !1; i = i[a]; while (i){if (i.sizcache === c){j = d[i.sizset]; break}i.nodeType === 1 && !f && (i.sizcache = c, i.sizset = g); if (i.nodeName.toLowerCase() === b){j = i; break}i = i[a]}d[g] = j}}}var a = /((?:\((?:\([^()]+\)|[^()]+)+\)|\[(?:\[[^\[\]]*\]|['"][^'"]*['"]|[^\[\]'"]+)+\]|\\.|[^ >+~,(\[\\]+)+|[>+~])(\s*,\s*)?((?:.|\r|\n)*)/g, d = 0, e = Object.prototype.toString, g = !1, h = !0, i = /\\/g, j = /\W/; [0, 0].sort(function(){h = !1; return 0}); var k = function(b, d, f, g){f = f || [], d = d || c; var h = d; if (d.nodeType !== 1 && d.nodeType !== 9)return[]; if (!b || typeof b != "string")return f; var i, j, n, o, q, r, s, t, u = !0, w = k.isXML(d), x = [], y = b; do{a.exec(""), i = a.exec(y); if (i){y = i[3], x.push(i[1]); if (i[2]){o = i[3]; break}}}while (i); if (x.length > 1 && m.exec(b))if (x.length === 2 && l.relative[x[0]])j = v(x[0] + x[1], d); else{j = l.relative[x[0]]?[d]:k(x.shift(), d); while (x.length)b = x.shift(), l.relative[b] && (b += x.shift()), j = v(b, j)} else{!g && x.length > 1 && d.nodeType === 9 && !w && l.match.ID.test(x[0]) && !l.match.ID.test(x[x.length - 1]) && (q = k.find(x.shift(), d, w), d = q.expr?k.filter(q.expr, q.set)[0]:q.set[0]); if (d){q = g?{expr:x.pop(), set:p(g)}:k.find(x.pop(), x.length === 1 && (x[0] === "~" || x[0] === "+") && d.parentNode?d.parentNode:d, w), j = q.expr?k.filter(q.expr, q.set):q.set, x.length > 0?n = p(j):u = !1; while (x.length)r = x.pop(), s = r, l.relative[r]?s = x.pop():r = "", s == null && (s = d), l.relative[r](n, s, w)} else n = x = []}n || (n = j), n || k.error(r || b); if (e.call(n) === "[object Array]")if (!u)f.push.apply(f, n); else if (d && d.nodeType === 1)for (t = 0; n[t] != null; t++)n[t] && (n[t] === !0 || n[t].nodeType === 1 && k.contains(d, n[t])) && f.push(j[t]); else for (t = 0; n[t] != null; t++)n[t] && n[t].nodeType === 1 && f.push(j[t]); else p(n, f); o && (k(o, h, f, g), k.uniqueSort(f)); return f}; k.uniqueSort = function(a){if (r){g = h, a.sort(r); if (g)for (var b = 1; b < a.length; b++)a[b] === a[b - 1] && a.splice(b--, 1)}return a}, k.matches = function(a, b){return k(a, null, null, b)}, k.matchesSelector = function(a, b){return k(b, null, null, [a]).length > 0}, k.find = function(a, b, c){var d; if (!a)return[]; for (var e = 0, f = l.order.length; e < f; e++){var g, h = l.order[e]; if (g = l.leftMatch[h].exec(a)){var j = g[1]; g.splice(1, 1); if (j.substr(j.length - 1) !== "\\"){g[1] = (g[1] || "").replace(i, ""), d = l.find[h](g, b, c); if (d != null){a = a.replace(l.match[h], ""); break}}}}d || (d = typeof b.getElementsByTagName != "undefined"?b.getElementsByTagName("*"):[]); return{set:d, expr:a}}, k.filter = function(a, c, d, e){var f, g, h = a, i = [], j = c, m = c && c[0] && k.isXML(c[0]); while (a && c.length){for (var n in l.filter)if ((f = l.leftMatch[n].exec(a)) != null && f[2]){var o, p, q = l.filter[n], r = f[1]; g = !1, f.splice(1, 1); if (r.substr(r.length - 1) === "\\")continue; j === i && (i = []); if (l.preFilter[n]){f = l.preFilter[n](f, j, d, i, e, m); if (!f)g = o = !0; else if (f === !0)continue}if (f)for (var s = 0; (p = j[s]) != null; s++)if (p){o = q(p, f, s, j); var t = e ^ !!o; d && o != null?t?g = !0:j[s] = !1:t && (i.push(p), g = !0)}if (o !== b){d || (j = i), a = a.replace(l.match[n], ""); if (!g)return[]; break}}if (a === h)if (g == null)k.error(a); else break; h = a}return j}, k.error = function(a){throw"Syntax error, unrecognized expression: " + a}; var l = k.selectors = {order:["ID", "NAME", "TAG"], match:{ID:/#((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, CLASS:/\.((?:[\w\u00c0-\uFFFF\-]|\\.)+)/, NAME:/\[name=['"]*((?:[\w\u00c0-\uFFFF\-]|\\.)+)['"]*\]/, ATTR:/\[\s*((?:[\w\u00c0-\uFFFF\-]|\\.)+)\s*(?:(\S?=)\s*(?:(['"])(.*?)\3|(#?(?:[\w\u00c0-\uFFFF\-]|\\.)*)|)|)\s*\]/, TAG:/^((?:[\w\u00c0-\uFFFF\*\-]|\\.)+)/, CHILD:/:(only|nth|last|first)-child(?:\(\s*(even|odd|(?:[+\-]?\d+|(?:[+\-]?\d*)?n\s*(?:[+\-]\s*\d+)?))\s*\))?/, POS:/:(nth|eq|gt|lt|first|last|even|odd)(?:\((\d*)\))?(?=[^\-]|$)/, PSEUDO:/:((?:[\w\u00c0-\uFFFF\-]|\\.)+)(?:\((['"]?)((?:\([^\)]+\)|[^\(\)]*)+)\2\))?/}, leftMatch:{}, attrMap:{"class":"className", "for":"htmlFor"}, attrHandle:{href:function(a){return a.getAttribute("href")}, type:function(a){return a.getAttribute("type")}}, relative:{"+":function(a, b){var c = typeof b == "string", d = c && !j.test(b), e = c && !d; d && (b = b.toLowerCase()); for (var f = 0, g = a.length, h; f < g; f++)if (h = a[f]){while ((h = h.previousSibling) && h.nodeType !== 1); a[f] = e || h && h.nodeName.toLowerCase() === b?h || !1:h === b}e && k.filter(b, a, !0)}, ">":function(a, b){var c, d = typeof b == "string", e = 0, f = a.length; if (d && !j.test(b)){b = b.toLowerCase(); for (; e < f; e++){c = a[e]; if (c){var g = c.parentNode; a[e] = g.nodeName.toLowerCase() === b?g:!1}}} else{for (; e < f; e++)c = a[e], c && (a[e] = d?c.parentNode:c.parentNode === b); d && k.filter(b, a, !0)}}, "":function(a, b, c){var e, f = d++, g = u; typeof b == "string" && !j.test(b) && (b = b.toLowerCase(), e = b, g = t), g("parentNode", b, f, a, e, c)}, "~":function(a, b, c){var e, f = d++, g = u; typeof b == "string" && !j.test(b) && (b = b.toLowerCase(), e = b, g = t), g("previousSibling", b, f, a, e, c)}}, find:{ID:function(a, b, c){if (typeof b.getElementById != "undefined" && !c){var d = b.getElementById(a[1]); return d && d.parentNode?[d]:[]}}, NAME:function(a, b){if (typeof b.getElementsByName != "undefined"){var c = [], d = b.getElementsByName(a[1]); for (var e = 0, f = d.length; e < f; e++)d[e].getAttribute("name") === a[1] && c.push(d[e]); return c.length === 0?null:c}}, TAG:function(a, b){if (typeof b.getElementsByTagName != "undefined")return b.getElementsByTagName(a[1])}}, preFilter:{CLASS:function(a, b, c, d, e, f){a = " " + a[1].replace(i, "") + " "; if (f)return a; for (var g = 0, h; (h = b[g]) != null; g++)h && (e ^ (h.className && (" " + h.className + " ").replace(/[\t\n\r]/g, " ").indexOf(a) >= 0)?c || d.push(h):c && (b[g] = !1)); return!1}, ID:function(a){return a[1].replace(i, "")}, TAG:function(a, b){return a[1].replace(i, "").toLowerCase()}, CHILD:function(a){if (a[1] === "nth"){a[2] || k.error(a[0]), a[2] = a[2].replace(/^\+|\s*/g, ""); var b = /(-?)(\d*)(?:n([+\-]?\d*))?/.exec(a[2] === "even" && "2n" || a[2] === "odd" && "2n+1" || !/\D/.test(a[2]) && "0n+" + a[2] || a[2]); a[2] = b[1] + (b[2] || 1) - 0, a[3] = b[3] - 0} else a[2] && k.error(a[0]); a[0] = d++; return a}, ATTR:function(a, b, c, d, e, f){var g = a[1] = a[1].replace(i, ""); !f && l.attrMap[g] && (a[1] = l.attrMap[g]), a[4] = (a[4] || a[5] || "").replace(i, ""), a[2] === "~=" && (a[4] = " " + a[4] + " "); return a}, PSEUDO:function(b, c, d, e, f){if (b[1] === "not")if ((a.exec(b[3]) || "").length > 1 || /^\w/.test(b[3]))b[3] = k(b[3], null, null, c); else{var g = k.filter(b[3], c, d, !0 ^ f); d || e.push.apply(e, g); return!1} else if (l.match.POS.test(b[0]) || l.match.CHILD.test(b[0]))return!0; return b}, POS:function(a){a.unshift(!0); return a}}, filters:{enabled:function(a){return a.disabled === !1 && a.type !== "hidden"}, disabled:function(a){return a.disabled === !0}, checked:function(a){return a.checked === !0}, selected:function(a){a.parentNode && a.parentNode.selectedIndex; return a.selected === !0}, parent:function(a){return!!a.firstChild}, empty:function(a){return!a.firstChild}, has:function(a, b, c){return!!k(c[3], a).length}, header:function(a){return/h\d/i.test(a.nodeName)}, text:function(a){var b = a.getAttribute("type"), c = a.type; return a.nodeName.toLowerCase() === "input" && "text" === c && (b === c || b === null)}, radio:function(a){return a.nodeName.toLowerCase() === "input" && "radio" === a.type}, checkbox:function(a){return a.nodeName.toLowerCase() === "input" && "checkbox" === a.type}, file:function(a){return a.nodeName.toLowerCase() === "input" && "file" === a.type}, password:function(a){return a.nodeName.toLowerCase() === "input" && "password" === a.type}, submit:function(a){var b = a.nodeName.toLowerCase(); return(b === "input" || b === "button") && "submit" === a.type}, image:function(a){return a.nodeName.toLowerCase() === "input" && "image" === a.type}, reset:function(a){var b = a.nodeName.toLowerCase(); return(b === "input" || b === "button") && "reset" === a.type}, button:function(a){var b = a.nodeName.toLowerCase(); return b === "input" && "button" === a.type || b === "button"}, input:function(a){return/input|select|textarea|button/i.test(a.nodeName)}, focus:function(a){return a === a.ownerDocument.activeElement}}, setFilters:{first:function(a, b){return b === 0}, last:function(a, b, c, d){return b === d.length - 1}, even:function(a, b){return b % 2 === 0}, odd:function(a, b){return b % 2 === 1}, lt:function(a, b, c){return b < c[3] - 0}, gt:function(a, b, c){return b > c[3] - 0}, nth:function(a, b, c){return c[3] - 0 === b}, eq:function(a, b, c){return c[3] - 0 === b}}, filter:{PSEUDO:function(a, b, c, d){var e = b[1], f = l.filters[e]; if (f)return f(a, c, b, d); if (e === "contains")return(a.textContent || a.innerText || k.getText([a]) || "").indexOf(b[3]) >= 0; if (e === "not"){var g = b[3]; for (var h = 0, i = g.length; h < i; h++)if (g[h] === a)return!1; return!0}k.error(e)}, CHILD:function(a, b){var c = b[1], d = a; switch (c){case"only":case"first":while (d = d.previousSibling)if (d.nodeType === 1)return!1; if (c === "first")return!0; d = a; case"last":while (d = d.nextSibling)if (d.nodeType === 1)return!1; return!0; case"nth":var e = b[2], f = b[3]; if (e === 1 && f === 0)return!0; var g = b[0], h = a.parentNode; if (h && (h.sizcache !== g || !a.nodeIndex)){var i = 0; for (d = h.firstChild; d; d = d.nextSibling)d.nodeType === 1 && (d.nodeIndex = ++i); h.sizcache = g}var j = a.nodeIndex - f; return e === 0?j === 0:j % e === 0 && j / e >= 0}}, ID:function(a, b){return a.nodeType === 1 && a.getAttribute("id") === b}, TAG:function(a, b){return b === "*" && a.nodeType === 1 || a.nodeName.toLowerCase() === b}, CLASS:function(a, b){return(" " + (a.className || a.getAttribute("class")) + " ").indexOf(b) > - 1}, ATTR:function(a, b){var c = b[1], d = l.attrHandle[c]?l.attrHandle[c](a):a[c] != null?a[c]:a.getAttribute(c), e = d + "", f = b[2], g = b[4]; return d == null?f === "!=":f === "="?e === g:f === "*="?e.indexOf(g) >= 0:f === "~="?(" " + e + " ").indexOf(g) >= 0:g?f === "!="?e !== g:f === "^="?e.indexOf(g) === 0:f === "$="?e.substr(e.length - g.length) === g:f === "|="?e === g || e.substr(0, g.length + 1) === g + "-":!1:e && d !== !1}, POS:function(a, b, c, d){var e = b[2], f = l.setFilters[e]; if (f)return f(a, c, b, d)}}}, m = l.match.POS, n = function(a, b){return"\\" + (b - 0 + 1)}; for (var o in l.match)l.match[o] = new RegExp(l.match[o].source + /(?![^\[]*\])(?![^\(]*\))/.source), l.leftMatch[o] = new RegExp(/(^(?:.|\r|\n)*?)/.source + l.match[o].source.replace(/\\(\d+)/g, n)); var p = function(a, b){a = Array.prototype.slice.call(a, 0); if (b){b.push.apply(b, a); return b}return a}; try{Array.prototype.slice.call(c.documentElement.childNodes, 0)[0].nodeType} catch (q){p = function(a, b){var c = 0, d = b || []; if (e.call(a) === "[object Array]")Array.prototype.push.apply(d, a); else if (typeof a.length == "number")for (var f = a.length; c < f; c++)d.push(a[c]); else for (; a[c]; c++)d.push(a[c]); return d}}var r, s; c.documentElement.compareDocumentPosition?r = function(a, b){if (a === b){g = !0; return 0}if (!a.compareDocumentPosition || !b.compareDocumentPosition)return a.compareDocumentPosition? - 1:1; return a.compareDocumentPosition(b) & 4? - 1:1}:(r = function(a, b){if (a === b){g = !0; return 0}if (a.sourceIndex && b.sourceIndex)return a.sourceIndex - b.sourceIndex; var c, d, e = [], f = [], h = a.parentNode, i = b.parentNode, j = h; if (h === i)return s(a, b); if (!h)return - 1; if (!i)return 1; while (j)e.unshift(j), j = j.parentNode; j = i; while (j)f.unshift(j), j = j.parentNode; c = e.length, d = f.length; for (var k = 0; k < c && k < d; k++)if (e[k] !== f[k])return s(e[k], f[k]); return k === c?s(a, f[k], - 1):s(e[k], b, 1)}, s = function(a, b, c){if (a === b)return c; var d = a.nextSibling; while (d){if (d === b)return - 1; d = d.nextSibling}return 1}), k.getText = function(a){var b = "", c; for (var d = 0; a[d]; d++)c = a[d], c.nodeType === 3 || c.nodeType === 4?b += c.nodeValue:c.nodeType !== 8 && (b += k.getText(c.childNodes)); return b}, function(){var a = c.createElement("div"), d = "script" + (new Date).getTime(), e = c.documentElement; a.innerHTML = "", e.insertBefore(a, e.firstChild), c.getElementById(d) && (l.find.ID = function(a, c, d){if (typeof c.getElementById != "undefined" && !d){var e = c.getElementById(a[1]); return e?e.id === a[1] || typeof e.getAttributeNode != "undefined" && e.getAttributeNode("id").nodeValue === a[1]?[e]:b:[]}}, l.filter.ID = function(a, b){var c = typeof a.getAttributeNode != "undefined" && a.getAttributeNode("id"); return a.nodeType === 1 && c && c.nodeValue === b}), e.removeChild(a), e = a = null}(), function(){var a = c.createElement("div"); a.appendChild(c.createComment("")), a.getElementsByTagName("*").length > 0 && (l.find.TAG = function(a, b){var c = b.getElementsByTagName(a[1]); if (a[1] === "*"){var d = []; for (var e = 0; c[e]; e++)c[e].nodeType === 1 && d.push(c[e]); c = d}return c}), a.innerHTML = "", a.firstChild && typeof a.firstChild.getAttribute != "undefined" && a.firstChild.getAttribute("href") !== "#" && (l.attrHandle.href = function(a){return a.getAttribute("href", 2)}), a = null}(), c.querySelectorAll && function(){var a = k, b = c.createElement("div"), d = "__sizzle__"; b.innerHTML = "

"; if (!b.querySelectorAll || b.querySelectorAll(".TEST").length !== 0){k = function(b, e, f, g){e = e || c; if (!g && !k.isXML(e)){var h = /^(\w+$)|^\.([\w\-]+$)|^#([\w\-]+$)/.exec(b); if (h && (e.nodeType === 1 || e.nodeType === 9)){if (h[1])return p(e.getElementsByTagName(b), f); if (h[2] && l.find.CLASS && e.getElementsByClassName)return p(e.getElementsByClassName(h[2]), f)}if (e.nodeType === 9){if (b === "body" && e.body)return p([e.body], f); if (h && h[3]){var i = e.getElementById(h[3]); if (!i || !i.parentNode)return p([], f); if (i.id === h[3])return p([i], f)}try{return p(e.querySelectorAll(b), f)} catch (j){}} else if (e.nodeType === 1 && e.nodeName.toLowerCase() !== "object"){var m = e, n = e.getAttribute("id"), o = n || d, q = e.parentNode, r = /^\s*[+~]/.test(b); n?o = o.replace(/'/g, "\\$&"):e.setAttribute("id", o), r && q && (e = e.parentNode); try{if (!r || q)return p(e.querySelectorAll("[id='" + o + "'] " + b), f)} catch (s){} finally{n || m.removeAttribute("id")}}}return a(b, e, f, g)}; for (var e in a)k[e] = a[e]; b = null}}(), function(){var a = c.documentElement, b = a.matchesSelector || a.mozMatchesSelector || a.webkitMatchesSelector || a.msMatchesSelector; if (b){var d = !b.call(c.createElement("div"), "div"), e = !1; try{b.call(c.documentElement, "[test!='']:sizzle")} catch (f){e = !0}k.matchesSelector = function(a, c){c = c.replace(/\=\s*([^'"\]]*)\s*\]/g, "='$1']"); if (!k.isXML(a))try{if (e || !l.match.PSEUDO.test(c) && !/!=/.test(c)){var f = b.call(a, c); if (f || !d || a.document && a.document.nodeType !== 11)return f}} catch (g){}return k(c, null, null, [a]).length > 0}}}(), function(){var a = c.createElement("div"); a.innerHTML = "
"; if (!!a.getElementsByClassName && a.getElementsByClassName("e").length !== 0){a.lastChild.className = "e"; if (a.getElementsByClassName("e").length === 1)return; l.order.splice(1, 0, "CLASS"), l.find.CLASS = function(a, b, c){if (typeof b.getElementsByClassName != "undefined" && !c)return b.getElementsByClassName(a[1])}, a = null}}(), c.documentElement.contains?k.contains = function(a, b){return a !== b && (a.contains?a.contains(b):!0)}:c.documentElement.compareDocumentPosition?k.contains = function(a, b){return!!(a.compareDocumentPosition(b) & 16)}:k.contains = function(){return!1}, k.isXML = function(a){var b = (a?a.ownerDocument || a:0).documentElement; return b?b.nodeName !== "HTML":!1}; var v = function(a, b){var c, d = [], e = "", f = b.nodeType?[b]:b; while (c = l.match.PSEUDO.exec(a))e += c[0], a = a.replace(l.match.PSEUDO, ""); a = l.relative[a]?a + "*":a; for (var g = 0, h = f.length; g < h; g++)k(a, f[g], d); return k.filter(e, d)}; f.find = k, f.expr = k.selectors, f.expr[":"] = f.expr.filters, f.unique = k.uniqueSort, f.text = k.getText, f.isXMLDoc = k.isXML, f.contains = k.contains}(); var N = /Until$/, O = /^(?:parents|prevUntil|prevAll)/, P = /,/, Q = /^.[^:#\[\.,]*$/, R = Array.prototype.slice, S = f.expr.match.POS, T = {children:!0, contents:!0, next:!0, prev:!0}; f.fn.extend({find:function(a){var b = this, c, d; if (typeof a != "string")return f(a).filter(function(){for (c = 0, d = b.length; c < d; c++)if (f.contains(b[c], this))return!0}); var e = this.pushStack("", "find", a), g, h, i; for (c = 0, d = this.length; c < d; c++){g = e.length, f.find(a, this[c], e); if (c > 0)for (h = g; h < e.length; h++)for (i = 0; i < g; i++)if (e[i] === e[h]){e.splice(h--, 1); break}}return e}, has:function(a){var b = f(a); return this.filter(function(){for (var a = 0, c = b.length; a < c; a++)if (f.contains(this, b[a]))return!0})}, not:function(a){return this.pushStack(V(this, a, !1), "not", a)}, filter:function(a){return this.pushStack(V(this, a, !0), "filter", a)}, is:function(a){return!!a && (typeof a == "string"?f.filter(a, this).length > 0:this.filter(a).length > 0)}, closest:function(a, b){var c = [], d, e, g = this[0]; if (f.isArray(a)){var h, i, j = {}, k = 1; if (g && a.length){for (d = 0, e = a.length; d < e; d++)i = a[d], j[i] || (j[i] = S.test(i)?f(i, b || this.context):i); while (g && g.ownerDocument && g !== b){for (i in j)h = j[i], (h.jquery?h.index(g) > - 1:f(g).is(h)) && c.push({selector:i, elem:g, level:k}); g = g.parentNode, k++}}return c}var l = S.test(a) || typeof a != "string"?f(a, b || this.context):0; for (d = 0, e = this.length; d < e; d++){g = this[d]; while (g){if (l?l.index(g) > - 1:f.find.matchesSelector(g, a)){c.push(g); break}g = g.parentNode; if (!g || !g.ownerDocument || g === b || g.nodeType === 11)break}}c = c.length > 1?f.unique(c):c; return this.pushStack(c, "closest", a)}, index:function(a){if (!a)return this[0] && this[0].parentNode?this.prevAll().length: - 1; if (typeof a == "string")return f.inArray(this[0], f(a)); return f.inArray(a.jquery?a[0]:a, this)}, add:function(a, b){var c = typeof a == "string"?f(a, b):f.makeArray(a && a.nodeType?[a]:a), d = f.merge(this.get(), c); return this.pushStack(U(c[0]) || U(d[0])?d:f.unique(d))}, andSelf:function(){return this.add(this.prevObject)}}), f.each({parent:function(a){var b = a.parentNode; return b && b.nodeType !== 11?b:null}, parents:function(a){return f.dir(a, "parentNode")}, parentsUntil:function(a, b, c){return f.dir(a, "parentNode", c)}, next:function(a){return f.nth(a, 2, "nextSibling")}, prev:function(a){return f.nth(a, 2, "previousSibling")}, nextAll:function(a){return f.dir(a, "nextSibling")}, prevAll:function(a){return f.dir(a, "previousSibling")}, nextUntil:function(a, b, c){return f.dir(a, "nextSibling", c)}, prevUntil:function(a, b, c){return f.dir(a, "previousSibling", c)}, siblings:function(a){return f.sibling(a.parentNode.firstChild, a)}, children:function(a){return f.sibling(a.firstChild)}, contents:function(a){return f.nodeName(a, "iframe")?a.contentDocument || a.contentWindow.document:f.makeArray(a.childNodes)}}, function(a, b){f.fn[a] = function(c, d){var e = f.map(this, b, c), g = R.call(arguments); N.test(a) || (d = c), d && typeof d == "string" && (e = f.filter(d, e)), e = this.length > 1 && !T[a]?f.unique(e):e, (this.length > 1 || P.test(d)) && O.test(a) && (e = e.reverse()); return this.pushStack(e, a, g.join(","))}}), f.extend({filter:function(a, b, c){c && (a = ":not(" + a + ")"); return b.length === 1?f.find.matchesSelector(b[0], a)?[b[0]]:[]:f.find.matches(a, b)}, dir:function(a, c, d){var e = [], g = a[c]; while (g && g.nodeType !== 9 && (d === b || g.nodeType !== 1 || !f(g).is(d)))g.nodeType === 1 && e.push(g), g = g[c]; return e}, nth:function(a, b, c, d){b = b || 1; var e = 0; for (; a; a = a[c])if (a.nodeType === 1 && ++e === b)break; return a}, sibling:function(a, b){var c = []; for (; a; a = a.nextSibling)a.nodeType === 1 && a !== b && c.push(a); return c}}); var W = / jQuery\d+="(?:\d+|null)"/g, X = /^\s+/, Y = /<(?!area|br|col|embed|hr|img|input|link|meta|param)(([\w:]+)[^>]*)\/>/ig, Z = /<([\w:]+)/, $ = /", ""], legend:[1, "
", "
"], thead:[1, "", "
"], tr:[2, "", "
"], td:[3, "", "
"], col:[2, "", "
"], area:[1, "", ""], _default:[0, "", ""]}; be.optgroup = be.option, be.tbody = be.tfoot = be.colgroup = be.caption = be.thead, be.th = be.td, f.support.htmlSerialize || (be._default = [1, "div
", "
"]), f.fn.extend({text:function(a){if (f.isFunction(a))return this.each(function(b){var c = f(this); c.text(a.call(this, b, c.text()))}); if (typeof a != "object" && a !== b)return this.empty().append((this[0] && this[0].ownerDocument || c).createTextNode(a)); return f.text(this)}, wrapAll:function(a){if (f.isFunction(a))return this.each(function(b){f(this).wrapAll(a.call(this, b))}); if (this[0]){var b = f(a, this[0].ownerDocument).eq(0).clone(!0); this[0].parentNode && b.insertBefore(this[0]), b.map(function(){var a = this; while (a.firstChild && a.firstChild.nodeType === 1)a = a.firstChild; return a}).append(this)}return this}, wrapInner:function(a){if (f.isFunction(a))return this.each(function(b){f(this).wrapInner(a.call(this, b))}); return this.each(function(){var b = f(this), c = b.contents(); c.length?c.wrapAll(a):b.append(a)})}, wrap:function(a){return this.each(function(){f(this).wrapAll(a)})}, unwrap:function(){return this.parent().each(function(){f.nodeName(this, "body") || f(this).replaceWith(this.childNodes)}).end()}, append:function(){return this.domManip(arguments, !0, function(a){this.nodeType === 1 && this.appendChild(a)})}, prepend:function(){return this.domManip(arguments, !0, function(a){this.nodeType === 1 && this.insertBefore(a, this.firstChild)})}, before:function(){if (this[0] && this[0].parentNode)return this.domManip(arguments, !1, function(a){this.parentNode.insertBefore(a, this)}); if (arguments.length){var a = f(arguments[0]); a.push.apply(a, this.toArray()); return this.pushStack(a, "before", arguments)}}, after:function(){if (this[0] && this[0].parentNode)return this.domManip(arguments, !1, function(a){this.parentNode.insertBefore(a, this.nextSibling)}); if (arguments.length){var a = this.pushStack(this, "after", arguments); a.push.apply(a, f(arguments[0]).toArray()); return a}}, remove:function(a, b){for (var c = 0, d; (d = this[c]) != null; c++)if (!a || f.filter(a, [d]).length)!b && d.nodeType === 1 && (f.cleanData(d.getElementsByTagName("*")), f.cleanData([d])), d.parentNode && d.parentNode.removeChild(d); return this}, empty:function(){for (var a = 0, b; (b = this[a]) != null; a++){b.nodeType === 1 && f.cleanData(b.getElementsByTagName("*")); while (b.firstChild)b.removeChild(b.firstChild)}return this}, clone:function(a, b){a = a == null?!1:a, b = b == null?a:b; return this.map(function(){return f.clone(this, a, b)})}, html:function(a){if (a === b)return this[0] && this[0].nodeType === 1?this[0].innerHTML.replace(W, ""):null; if (typeof a == "string" && !ba.test(a) && (f.support.leadingWhitespace || !X.test(a)) && !be[(Z.exec(a) || ["", ""])[1].toLowerCase()]){a = a.replace(Y, "<$1>"); try{for (var c = 0, d = this.length; c < d; c++)this[c].nodeType === 1 && (f.cleanData(this[c].getElementsByTagName("*")), this[c].innerHTML = a)} catch (e){this.empty().append(a)}} else f.isFunction(a)?this.each(function(b){var c = f(this); c.html(a.call(this, b, c.html()))}):this.empty().append(a); return this}, replaceWith:function(a){if (this[0] && this[0].parentNode){if (f.isFunction(a))return this.each(function(b){var c = f(this), d = c.html(); c.replaceWith(a.call(this, b, d))}); typeof a != "string" && (a = f(a).detach()); return this.each(function(){var b = this.nextSibling, c = this.parentNode; f(this).remove(), b?f(b).before(a):f(c).append(a)})}return this.length?this.pushStack(f(f.isFunction(a)?a():a), "replaceWith", a):this}, detach:function(a){return this.remove(a, !0)}, domManip:function(a, c, d){var e, g, h, i, j = a[0], k = []; if (!f.support.checkClone && arguments.length === 3 && typeof j == "string" && bb.test(j))return this.each(function(){f(this).domManip(a, c, d, !0)}); if (f.isFunction(j))return this.each(function(e){var g = f(this); a[0] = j.call(this, e, c?g.html():b), g.domManip(a, c, d)}); if (this[0]){i = j && j.parentNode, f.support.parentNode && i && i.nodeType === 11 && i.childNodes.length === this.length?e = {fragment:i}:e = f.buildFragment(a, this, k), h = e.fragment, h.childNodes.length === 1?g = h = h.firstChild:g = h.firstChild; if (g){c = c && f.nodeName(g, "tr"); for (var l = 0, m = this.length, n = m - 1; l < m; l++)d.call(c?bf(this[l], g):this[l], e.cacheable || m > 1 && l < n?f.clone(h, !0, !0):h)}k.length && f.each(k, bl)}return this}}), f.buildFragment = function(a, b, d){var e, g, h, i; b && b[0] && (i = b[0].ownerDocument || b[0]), i.createDocumentFragment || (i = c), a.length === 1 && typeof a[0] == "string" && a[0].length < 512 && i === c && a[0].charAt(0) === "<" && !ba.test(a[0]) && (f.support.checkClone || !bb.test(a[0])) && (g = !0, h = f.fragments[a[0]], h && h !== 1 && (e = h)), e || (e = i.createDocumentFragment(), f.clean + (a, i, e, d)), g && (f.fragments[a[0]] = h?e:1); return{fragment:e, cacheable:g}}, f.fragments = {}, f.each({appendTo:"append", prependTo:"prepend", insertBefore:"before", insertAfter:"after", replaceAll:"replaceWith"}, function(a, b){f.fn[a] = function(c){var d = [], e = f(c), g = this.length === 1 && this[0].parentNode; if (g && g.nodeType === 11 && g.childNodes.length === 1 && e.length === 1){e[b](this[0]); return this}for (var h = 0, i = e.length; h < i; h++){var j = (h > 0?this.clone(!0):this).get(); f(e[h])[b](j), d = d.concat(j)}return this.pushStack(d, a, e.selector)}}), f.extend({clone:function(a, b, c){var d = a.cloneNode(!0), e, g, h; if ((!f.support.noCloneEvent || !f.support.noCloneChecked) && (a.nodeType === 1 || a.nodeType === 11) && !f.isXMLDoc(a)){bh(a, d), e = bi(a), g = bi(d); for (h = 0; e[h]; ++h)g[h] && bh(e[h], g[h])}if (b){bg(a, d); if (c){e = bi(a), g = bi(d); for (h = 0; e[h]; ++h)bg(e[h], g[h])}}e = g = null; return d}, clean:function(a, b, d, e){var g; b = b || c, typeof b.createElement == "undefined" && (b = b.ownerDocument || b[0] && b[0].ownerDocument || c); var h = [], i; for (var j = 0, k; (k = a[j]) != null; j++){typeof k == "number" && (k += ""); if (!k)continue; if (typeof k == "string")if (!_.test(k))k = b.createTextNode(k); else{k = k.replace(Y, "<$1>"); var l = (Z.exec(k) || ["", ""])[1].toLowerCase(), m = be[l] || be._default, n = m[0], o = b.createElement("div"); o.innerHTML = m[1] + k + m[2]; while (n--)o = o.lastChild; if (!f.support.tbody){var p = $.test(k), q = l === "table" && !p?o.firstChild && o.firstChild.childNodes:m[1] === "" && !p?o.childNodes:[]; for (i = q.length - 1; i >= 0; --i)f.nodeName(q[i], "tbody") && !q[i].childNodes.length && q[i].parentNode.removeChild(q[i])}!f.support.leadingWhitespace && X.test(k) && o.insertBefore(b.createTextNode(X.exec(k)[0]), o.firstChild), k = o.childNodes}var r; if (!f.support.appendChecked)if (k[0] && typeof (r = k.length) == "number")for (i = 0; i < r; i++)bk(k[i]); else bk(k); k.nodeType?h.push(k):h = f.merge(h, k)}if (d){g = function(a){return!a.type || bc.test(a.type)}; for (j = 0; h[j]; j++)if (e && f.nodeName(h[j], "script") && (!h[j].type || h[j].type.toLowerCase() === "text/javascript"))e.push(h[j].parentNode?h[j].parentNode.removeChild(h[j]):h[j]); else{if (h[j].nodeType === 1){var s = f.grep(h[j].getElementsByTagName("script"), g); h.splice.apply(h, [j + 1, 0].concat(s))}d.appendChild(h[j])}}return h}, cleanData:function(a){var b, c, d = f.cache, e = f.expando, g = f.event.special, h = f.support.deleteExpando; for (var i = 0, j; (j = a[i]) != null; i++){if (j.nodeName && f.noData[j.nodeName.toLowerCase()])continue; c = j[f.expando]; if (c){b = d[c] && d[c][e]; if (b && b.events){for (var k in b.events)g[k]?f.event.remove(j, k):f.removeEvent(j, k, b.handle); b.handle && (b.handle.elem = null)}h?delete j[f.expando]:j.removeAttribute && j.removeAttribute(f.expando), delete d[c]}}}}); var bm = /alpha\([^)]*\)/i, bn = /opacity=([^)]*)/, bo = /([A-Z]|^ms)/g, bp = /^-?\d+(?:px)?$/i, bq = /^-?\d/, br = /^([\-+])=([\-+.\de]+)/, bs = {position:"absolute", visibility:"hidden", display:"block"}, bt = ["Left", "Right"], bu = ["Top", "Bottom"], bv, bw, bx; f.fn.css = function(a, c){if (arguments.length === 2 && c === b)return this; return f.access(this, a, c, !0, function(a, c, d){return d !== b?f.style(a, c, d):f.css(a, c)})}, f.extend({cssHooks:{opacity:{get:function(a, b){if (b){var c = bv(a, "opacity", "opacity"); return c === ""?"1":c}return a.style.opacity}}}, cssNumber:{fillOpacity:!0, fontWeight:!0, lineHeight:!0, opacity:!0, orphans:!0, widows:!0, zIndex:!0, zoom:!0}, cssProps:{"float":f.support.cssFloat?"cssFloat":"styleFloat"}, style:function(a, c, d, e){if (!!a && a.nodeType !== 3 && a.nodeType !== 8 && !!a.style){var g, h, i = f.camelCase(c), j = a.style, k = f.cssHooks[i]; c = f.cssProps[i] || i; if (d === b){if (k && "get"in k && (g = k.get(a, !1, e)) !== b)return g; return j[c]}h = typeof d, h === "string" && (g = br.exec(d)) && (d = + (g[1] + 1) * + g[2] + parseFloat(f.css(a, c)), h = "number"); if (d == null || h === "number" && isNaN(d))return; h === "number" && !f.cssNumber[i] && (d += "px"); if (!k || !("set"in k) || (d = k.set(a, d)) !== b)try{j[c] = d} catch (l){}}}, css:function(a, c, d){var e, g; c = f.camelCase(c), g = f.cssHooks[c], c = f.cssProps[c] || c, c === "cssFloat" && (c = "float"); if (g && "get"in g && (e = g.get(a, !0, d)) !== b)return e; if (bv)return bv(a, c)}, swap:function(a, b, c){var d = {}; for (var e in b)d[e] = a.style[e], a.style[e] = b[e]; c.call(a); for (e in b)a.style[e] = d[e]}}), f.curCSS = f.css, f.each(["height", "width"], function(a, b){f.cssHooks[b] = {get:function(a, c, d){var e; if (c){if (a.offsetWidth !== 0)return by(a, b, d); f.swap(a, bs, function(){e = by(a, b, d)}); return e}}, set:function(a, b){if (!bp.test(b))return b; b = parseFloat(b); if (b >= 0)return b + "px"}}}), f.support.opacity || (f.cssHooks.opacity = {get:function(a, b){return bn.test((b && a.currentStyle?a.currentStyle.filter:a.style.filter) || "")?parseFloat(RegExp.$1) / 100 + "":b?"1":""}, set:function(a, b){var c = a.style, d = a.currentStyle, e = f.isNaN(b)?"":"alpha(opacity=" + b * 100 + ")", g = d && d.filter || c.filter || ""; c.zoom = 1; if (b >= 1 && f.trim(g.replace(bm, "")) === ""){c.removeAttribute("filter"); if (d && !d.filter)return}c.filter = bm.test(g)?g.replace(bm, e):g + " " + e}}), f(function(){f.support.reliableMarginRight || (f.cssHooks.marginRight = {get:function(a, b){var c; f.swap(a, {display:"inline-block"}, function(){b?c = bv(a, "margin-right", "marginRight"):c = a.style.marginRight}); return c}})}), c.defaultView && c.defaultView.getComputedStyle && (bw = function(a, c){var d, e, g; c = c.replace(bo, "-$1").toLowerCase(); if (!(e = a.ownerDocument.defaultView))return b; if (g = e.getComputedStyle(a, null))d = g.getPropertyValue(c), d === "" && !f.contains(a.ownerDocument.documentElement, a) && (d = f.style(a, c)); return d}), c.documentElement.currentStyle && (bx = function(a, b){var c, d = a.currentStyle && a.currentStyle[b], e = a.runtimeStyle && a.runtimeStyle[b], f = a.style; !bp.test(d) && bq.test(d) && (c = f.left, e && (a.runtimeStyle.left = a.currentStyle.left), f.left = b === "fontSize"?"1em":d || 0, d = f.pixelLeft + "px", f.left = c, e && (a.runtimeStyle.left = e)); return d === ""?"auto":d}), bv = bw || bx, f.expr && f.expr.filters && (f.expr.filters.hidden = function(a){var b = a.offsetWidth, c = a.offsetHeight; return b === 0 && c === 0 || !f.support.reliableHiddenOffsets && (a.style.display || f.css(a, "display")) === "none"}, f.expr.filters.visible = function(a){return!f.expr.filters.hidden(a)}); var bz = /%20/g, bA = /\[\]$/, bB = /\r?\n/g, bC = /#.*$/, bD = /^(.*?):[ \t]*([^\r\n]*)\r?$/mg, bE = /^(?:color|date|datetime|datetime-local|email|hidden|month|number|password|range|search|tel|text|time|url|week)$/i, bF = /^(?:about|app|app\-storage|.+\-extension|file|res|widget):$/, bG = /^(?:GET|HEAD)$/, bH = /^\/\//, bI = /\?/, bJ = /)<[^<]*)*<\/script>/gi, bK = /^(?:select|textarea)/i, bL = /\s+/, bM = /([?&])_=[^&]*/, bN = /^([\w\+\.\-]+:)(?:\/\/([^\/?#:]*)(?::(\d+))?)?/, bO = f.fn.load, bP = {}, bQ = {}, bR, bS, bT = ["*/"] + ["*"]; try{bR = e.href} catch (bU){bR = c.createElement("a"), bR.href = "", bR = bR.href}bS = bN.exec(bR.toLowerCase()) || [], f.fn.extend({load:function(a, c, d){if (typeof a != "string" && bO)return bO.apply(this, arguments); if (!this.length)return this; var e = a.indexOf(" "); if (e >= 0){var g = a.slice(e, a.length); a = a.slice(0, e)}var h = "GET"; c && (f.isFunction(c)?(d = c, c = b):typeof c == "object" && (c = f.param(c, f.ajaxSettings.traditional), h = "POST")); var i = this; f.ajax({url:a, type:h, dataType:"html", data:c, complete:function(a, b, c){c = a.responseText, a.isResolved() && (a.done(function(a){c = a}), i.html(g?f("
").append(c.replace(bJ, "")).find(g):c)), d && i.each(d, [c, b, a])}}); return this}, serialize:function(){return f.param(this.serializeArray())}, serializeArray:function(){return this.map(function(){return this.elements?f.makeArray(this.elements):this}).filter(function(){return this.name && !this.disabled && (this.checked || bK.test(this.nodeName) || bE.test(this.type))}).map(function(a, b){var c = f(this).val(); return c == null?null:f.isArray(c)?f.map(c, function(a, c){return{name:b.name, value:a.replace(bB, "\r\n")}}):{name:b.name, value:c.replace(bB, "\r\n")}}).get()}}), f.each("ajaxStart ajaxStop ajaxComplete ajaxError ajaxSuccess ajaxSend".split(" "), function(a, b){f.fn[b] = function(a){return this.bind(b, a)}}), f.each(["get", "post"], function(a, c){f[c] = function(a, d, e, g){f.isFunction(d) && (g = g || e, e = d, d = b); return f.ajax({type:c, url:a, data:d, success:e, dataType:g})}}), f.extend({getScript:function(a, c){return f.get(a, b, c, "script")}, getJSON:function(a, b, c){return f.get(a, b, c, "json")}, ajaxSetup:function(a, b){b?bX(a, f.ajaxSettings):(b = a, a = f.ajaxSettings), bX(a, b); return a}, ajaxSettings:{url:bR, isLocal:bF.test(bS[1]), global:!0, type:"GET", contentType:"application/x-www-form-urlencoded", processData:!0, async:!0, accepts:{xml:"application/xml, text/xml", html:"text/html", text:"text/plain", json:"application/json, text/javascript", "*":bT}, contents:{xml:/xml/, html:/html/, json:/json/}, responseFields:{xml:"responseXML", text:"responseText"}, converters:{"* text":a.String, "text html":!0, "text json":f.parseJSON, "text xml":f.parseXML}, flatOptions:{context:!0, url:!0}}, ajaxPrefilter:bV(bP), ajaxTransport:bV(bQ), ajax:function(a, c){function w(a, c, l, m){if (s !== 2){s = 2, q && clearTimeout(q), p = b, n = m || "", v.readyState = a > 0?4:0; var o, r, u, w = c, x = l?bZ(d, v, l):b, y, z; if (a >= 200 && a < 300 || a === 304){if (d.ifModified){if (y = v.getResponseHeader("Last-Modified"))f.lastModified[k] = y; if (z = v.getResponseHeader("Etag"))f.etag[k] = z}if (a === 304)w = "notmodified", o = !0; else try{r = b$(d, x), w = "success", o = !0} catch (A){w = "parsererror", u = A}} else{u = w; if (!w || a)w = "error", a < 0 && (a = 0)}v.status = a, v.statusText = "" + (c || w), o?h.resolveWith(e, [r, w, v]):h.rejectWith(e, [v, w, u]), v.statusCode(j), j = b, t && g.trigger("ajax" + (o?"Success":"Error"), [v, d, o?r:u]), i.resolveWith(e, [v, w]), t && (g.trigger("ajaxComplete", [v, d]), --f.active || f.event.trigger("ajaxStop"))}}typeof a == "object" && (c = a, a = b), c = c || {}; var d = f.ajaxSetup({}, c), e = d.context || d, g = e !== d && (e.nodeType || e instanceof f)?f(e):f.event, h = f.Deferred(), i = f._Deferred(), j = d.statusCode || {}, k, l = {}, m = {}, n, o, p, q, r, s = 0, t, u, v = {readyState:0, setRequestHeader:function(a, b){if (!s){var c = a.toLowerCase(); a = m[c] = m[c] || a, l[a] = b}return this}, getAllResponseHeaders:function(){return s === 2?n:null}, getResponseHeader:function(a){var c; if (s === 2){if (!o){o = {}; while (c = bD.exec(n))o[c[1].toLowerCase()] = c[2]}c = o[a.toLowerCase()]}return c === b?null:c}, overrideMimeType:function(a){s || (d.mimeType = a); return this}, abort:function(a){a = a || "abort", p && p.abort(a), w(0, a); return this}}; h.promise(v), v.success = v.done, v.error = v.fail, v.complete = i.done, v.statusCode = function(a){if (a){var b; if (s < 2)for (b in a)j[b] = [j[b], a[b]]; else b = a[v.status], v.then(b, b)}return this}, d.url = ((a || d.url) + "").replace(bC, "").replace(bH, bS[1] + "//"), d.dataTypes = f.trim(d.dataType || "*").toLowerCase().split(bL), d.crossDomain == null && (r = bN.exec(d.url.toLowerCase()), d.crossDomain = !(!r || r[1] == bS[1] && r[2] == bS[2] && (r[3] || (r[1] === "http:"?80:443)) == (bS[3] || (bS[1] === "http:"?80:443)))), d.data && d.processData && typeof d.data != "string" && (d.data = f.param(d.data, d.traditional)), bW(bP, d, c, v); if (s === 2)return!1; t = d.global, d.type = d.type.toUpperCase(), d.hasContent = !bG.test(d.type), t && f.active++ === 0 && f.event.trigger("ajaxStart"); if (!d.hasContent){d.data && (d.url += (bI.test(d.url)?"&":"?") + d.data, delete d.data), k = d.url; if (d.cache === !1){var x = f.now(), y = d.url.replace(bM, "$1_=" + x); d.url = y + (y === d.url?(bI.test(d.url)?"&":"?") + "_=" + x:"")}}(d.data && d.hasContent && d.contentType !== !1 || c.contentType) && v.setRequestHeader("Content-Type", d.contentType), d.ifModified && (k = k || d.url, f.lastModified[k] && v.setRequestHeader("If-Modified-Since", f.lastModified[k]), f.etag[k] && v.setRequestHeader("If-None-Match", f.etag[k])), v.setRequestHeader("Accept", d.dataTypes[0] && d.accepts[d.dataTypes[0]]?d.accepts[d.dataTypes[0]] + (d.dataTypes[0] !== "*"?", " + bT + "; q=0.01":""):d.accepts["*"]); for (u in d.headers)v.setRequestHeader(u, d.headers[u]); if (d.beforeSend && (d.beforeSend.call(e, v, d) === !1 || s === 2)){v.abort(); return!1}for (u in{success:1, error:1, complete:1})v[u](d[u]); p = bW(bQ, d, c, v); if (!p)w( - 1, "No Transport"); else{v.readyState = 1, t && g.trigger("ajaxSend", [v, d]), d.async && d.timeout > 0 && (q = setTimeout(function(){v.abort("timeout")}, d.timeout)); try{s = 1, p.send(l, w)} catch (z){s < 2?w( - 1, z):f.error(z)}}return v}, param:function(a, c){var d = [], e = function(a, b){b = f.isFunction(b)?b():b, d[d.length] = encodeURIComponent(a) + "=" + encodeURIComponent(b)}; c === b && (c = f.ajaxSettings.traditional); if (f.isArray(a) || a.jquery && !f.isPlainObject(a))f.each(a, function(){e(this.name, this.value)}); else for (var g in a)bY(g, a[g], c, e); return d.join("&").replace(bz, "+")}}), f.extend({active:0, lastModified:{}, etag:{}}); var b_ = f.now(), ca = /(\=)\?(&|$)|\?\?/i; f.ajaxSetup({jsonp:"callback", jsonpCallback:function(){return f.expando + "_" + b_++}}), f.ajaxPrefilter("json jsonp", function(b, c, d){var e = b.contentType === "application/x-www-form-urlencoded" && typeof b.data == "string"; if (b.dataTypes[0] === "jsonp" || b.jsonp !== !1 && (ca.test(b.url) || e && ca.test(b.data))){var g, h = b.jsonpCallback = f.isFunction(b.jsonpCallback)?b.jsonpCallback():b.jsonpCallback, i = a[h], j = b.url, k = b.data, l = "$1" + h + "$2"; b.jsonp !== !1 && (j = j.replace(ca, l), b.url === j && (e && (k = k.replace(ca, l)), b.data === k && (j += (/\?/.test(j)?"&":"?") + b.jsonp + "=" + h))), b.url = j, b.data = k, a[h] = function(a){g = [a]}, d.always(function(){a[h] = i, g && f.isFunction(i) && a[h](g[0])}), b.converters["script json"] = function(){g || f.error(h + " was not called"); return g[0]}, b.dataTypes[0] = "json"; return"script"}}), f.ajaxSetup({accepts:{script:"text/javascript, application/javascript, application/ecmascript, application/x-ecmascript"}, contents:{script:/javascript|ecmascript/}, converters:{"text script":function(a){f.globalEval(a); return a}}}), f.ajaxPrefilter("script", function(a){a.cache === b && (a.cache = !1), a.crossDomain && (a.type = "GET", a.global = !1)}), f.ajaxTransport("script", function(a){if (a.crossDomain){var d, e = c.head || c.getElementsByTagName("head")[0] || c.documentElement; return{send:function(f, g){d = c.createElement("script"), d.async = "async", a.scriptCharset && (d.charset = a.scriptCharset), d.src = a.url, d.onload = d.onreadystatechange = function(a, c){if (c || !d.readyState || /loaded|complete/.test(d.readyState))d.onload = d.onreadystatechange = null, e && d.parentNode && e.removeChild(d), d = b, c || g(200, "success")}, e.insertBefore(d, e.firstChild)}, abort:function(){d && d.onload(0, 1)}}}}); var cb = a.ActiveXObject?function(){for (var a in cd)cd[a](0, 1)}:!1, cc = 0, cd; f.ajaxSettings.xhr = a.ActiveXObject?function(){return!this.isLocal && ce() || cf()}:ce, function(a){f.extend(f.support, {ajax:!!a, cors:!!a && "withCredentials"in a})}(f.ajaxSettings.xhr()), f.support.ajax && f.ajaxTransport(function(c){if (!c.crossDomain || f.support.cors){var d; return{send:function(e, g){var h = c.xhr(), i, j; c.username?h.open(c.type, c.url, c.async, c.username, c.password):h.open(c.type, c.url, c.async); if (c.xhrFields)for (j in c.xhrFields)h[j] = c.xhrFields[j]; c.mimeType && h.overrideMimeType && h.overrideMimeType(c.mimeType), !c.crossDomain && !e["X-Requested-With"] && (e["X-Requested-With"] = "XMLHttpRequest"); try{for (j in e)h.setRequestHeader(j, e[j])} catch (k){}h.send(c.hasContent && c.data || null), d = function(a, e){var j, k, l, m, n; try{if (d && (e || h.readyState === 4)){d = b, i && (h.onreadystatechange = f.noop, cb && delete cd[i]); if (e)h.readyState !== 4 && h.abort(); else{j = h.status, l = h.getAllResponseHeaders(), m = {}, n = h.responseXML, n && n.documentElement && (m.xml = n), m.text = h.responseText; try{k = h.statusText} catch (o){k = ""}!j && c.isLocal && !c.crossDomain?j = m.text?200:404:j === 1223 && (j = 204)}}} catch (p){e || g( - 1, p)}m && g(j, k, m, l)}, !c.async || h.readyState === 4?d():(i = ++cc, cb && (cd || (cd = {}, f(a).unload(cb)), cd[i] = d), h.onreadystatechange = d)}, abort:function(){d && d(0, 1)}}}}); var cg = {}, ch, ci, cj = /^(?:toggle|show|hide)$/, ck = /^([+\-]=)?([\d+.\-]+)([a-z%]*)$/i, cl, cm = [["height", "marginTop", "marginBottom", "paddingTop", "paddingBottom"], ["width", "marginLeft", "marginRight", "paddingLeft", "paddingRight"], ["opacity"]], cn; f.fn.extend({show:function(a, b, c){var d, e; if (a || a === 0)return this.animate(cq("show", 3), a, b, c); for (var g = 0, h = this.length; g < h; g++)d = this[g], d.style && (e = d.style.display, !f._data(d, "olddisplay") && e === "none" && (e = d.style.display = ""), e === "" && f.css(d, "display") === "none" && f._data(d, "olddisplay", cr(d.nodeName))); for (g = 0; g < h; g++){d = this[g]; if (d.style){e = d.style.display; if (e === "" || e === "none")d.style.display = f._data(d, "olddisplay") || ""}}return this}, hide:function(a, b, c){if (a || a === 0)return this.animate(cq("hide", 3), a, b, c); for (var d = 0, e = this.length; d < e; d++)if (this[d].style){var g = f.css(this[d], "display"); g !== "none" && !f._data(this[d], "olddisplay") && f._data(this[d], "olddisplay", g)}for (d = 0; d < e; d++)this[d].style && (this[d].style.display = "none"); return this}, _toggle:f.fn.toggle, toggle:function(a, b, c){var d = typeof a == "boolean"; f.isFunction(a) && f.isFunction(b)?this._toggle.apply(this, arguments):a == null || d?this.each(function(){var b = d?a:f(this).is(":hidden"); f(this)[b?"show":"hide"]()}):this.animate(cq("toggle", 3), a, b, c); return this}, fadeTo:function(a, b, c, d){return this.filter(":hidden").css("opacity", 0).show().end().animate({opacity:b}, a, c, d)}, animate:function(a, b, c, d){var e = f.speed(b, c, d); if (f.isEmptyObject(a))return this.each(e.complete, [!1]); a = f.extend({}, a); return this[e.queue === !1?"each":"queue"](function(){e.queue === !1 && f._mark(this); var b = f.extend({}, e), c = this.nodeType === 1, d = c && f(this).is(":hidden"), g, h, i, j, k, l, m, n, o; b.animatedProperties = {}; for (i in a){g = f.camelCase(i), i !== g && (a[g] = a[i], delete a[i]), h = a[g], f.isArray(h)?(b.animatedProperties[g] = h[1], h = a[g] = h[0]):b.animatedProperties[g] = b.specialEasing && b.specialEasing[g] || b.easing || "swing"; if (h === "hide" && d || h === "show" && !d)return b.complete.call(this); c && (g === "height" || g === "width") && (b.overflow = [this.style.overflow, this.style.overflowX, this.style.overflowY], f.css(this, "display") === "inline" && f.css(this, "float") === "none" && (f.support.inlineBlockNeedsLayout?(j = cr(this.nodeName), j === "inline"?this.style.display = "inline-block":(this.style.display = "inline", this.style.zoom = 1)):this.style.display = "inline-block"))}b.overflow != null && (this.style.overflow = "hidden"); for (i in a)k = new f.fx(this, b, i), h = a[i], cj.test(h)?k[h === "toggle"?d?"show":"hide":h]():(l = ck.exec(h), m = k.cur(), l?(n = parseFloat(l[2]), o = l[3] || (f.cssNumber[i]?"":"px"), o !== "px" && (f.style(this, i, (n || 1) + o), m = (n || 1) / k.cur() * m, f.style(this, i, m + o)), l[1] && (n = (l[1] === "-="? - 1:1) * n + m), k.custom(m, n, o)):k.custom(m, h, "")); return!0})}, stop:function(a, b){a && this.queue([]), this.each(function(){var a = f.timers, c = a.length; b || f._unmark(!0, this); while (c--)a[c].elem === this && (b && a[c](!0), a.splice(c, 1))}), b || this.dequeue(); return this}}), f.each({slideDown:cq("show", 1), slideUp:cq("hide", 1), slideToggle:cq("toggle", 1), fadeIn:{opacity:"show"}, fadeOut:{opacity:"hide"}, fadeToggle:{opacity:"toggle"}}, function(a, b){f.fn[a] = function(a, c, d){return this.animate(b, a, c, d)}}), f.extend({speed:function(a, b, c){var d = a && typeof a == "object"?f.extend({}, a):{complete:c || !c && b || f.isFunction(a) && a, duration:a, easing:c && b || b && !f.isFunction(b) && b}; d.duration = f.fx.off?0:typeof d.duration == "number"?d.duration:d.duration in f.fx.speeds?f.fx.speeds[d.duration]:f.fx.speeds._default, d.old = d.complete, d.complete = function(a){f.isFunction(d.old) && d.old.call(this), d.queue !== !1?f.dequeue(this):a !== !1 && f._unmark(this)}; return d}, easing:{linear:function(a, b, c, d){return c + d * a}, swing:function(a, b, c, d){return( - Math.cos(a * Math.PI) / 2 + .5) * d + c}}, timers:[], fx:function(a, b, c){this.options = b, this.elem = a, this.prop = c, b.orig = b.orig || {}}}), f.fx.prototype = {update:function(){this.options.step && this.options.step.call(this.elem, this.now, this), (f.fx.step[this.prop] || f.fx.step._default)(this)}, cur:function(){if (this.elem[this.prop] != null && (!this.elem.style || this.elem.style[this.prop] == null))return this.elem[this.prop]; var a, b = f.css(this.elem, this.prop); return isNaN(a = parseFloat(b))?!b || b === "auto"?0:b:a}, custom:function(a, b, c){function g(a){return d.step(a)}var d = this, e = f.fx; this.startTime = cn || co(), this.start = a, this.end = b, this.unit = c || this.unit || (f.cssNumber[this.prop]?"":"px"), this.now = this.start, this.pos = this.state = 0, g.elem = this.elem, g() && f.timers.push(g) && !cl && (cl = setInterval(e.tick, e.interval))}, show:function(){this.options.orig[this.prop] = f.style(this.elem, this.prop), this.options.show = !0, this.custom(this.prop === "width" || this.prop === "height"?1:0, this.cur()), f(this.elem).show()}, hide:function(){this.options.orig[this.prop] = f.style(this.elem, this.prop), this.options.hide = !0, this.custom(this.cur(), 0)}, step:function(a){var b = cn || co(), c = !0, d = this.elem, e = this.options, g, h; if (a || b >= e.duration + this.startTime){this.now = this.end, this.pos = this.state = 1, this.update(), e.animatedProperties[this.prop] = !0; for (g in e.animatedProperties)e.animatedProperties[g] !== !0 && (c = !1); if (c){e.overflow != null && !f.support.shrinkWrapBlocks && f.each(["", "X", "Y"], function(a, b){d.style["overflow" + b] = e.overflow[a]}), e.hide && f(d).hide(); if (e.hide || e.show)for (var i in e.animatedProperties)f.style(d, i, e.orig[i]); e.complete.call(d)}return!1}e.duration == Infinity?this.now = b:(h = b - this.startTime, this.state = h / e.duration, this.pos = f.easing[e.animatedProperties[this.prop]](this.state, h, 0, 1, e.duration), this.now = this.start + (this.end - this.start) * this.pos), this.update(); return!0}}, f.extend(f.fx, {tick:function(){for (var a = f.timers, b = 0; b < a.length; ++b)a[b]() || a.splice(b--, 1); a.length || f.fx.stop()}, interval:13, stop:function(){clearInterval(cl), cl = null}, speeds:{slow:600, fast:200, _default:400}, step:{opacity:function(a){f.style(a.elem, "opacity", a.now)}, _default:function(a){a.elem.style && a.elem.style[a.prop] != null?a.elem.style[a.prop] = (a.prop === "width" || a.prop === "height"?Math.max(0, a.now):a.now) + a.unit:a.elem[a.prop] = a.now}}}), f.expr && f.expr.filters && (f.expr.filters.animated = function(a){return f.grep(f.timers, function(b){return a === b.elem}).length}); var cs = /^t(?:able|d|h)$/i, ct = /^(?:body|html)$/i; "getBoundingClientRect"in c.documentElement?f.fn.offset = function(a){var b = this[0], c; if (a)return this.each(function(b){f.offset.setOffset(this, a, b)}); if (!b || !b.ownerDocument)return null; if (b === b.ownerDocument.body)return f.offset.bodyOffset(b); try{c = b.getBoundingClientRect()} catch (d){}var e = b.ownerDocument, g = e.documentElement; if (!c || !f.contains(g, b))return c?{top:c.top, left:c.left}:{top:0, left:0}; var h = e.body, i = cu(e), j = g.clientTop || h.clientTop || 0, k = g.clientLeft || h.clientLeft || 0, l = i.pageYOffset || f.support.boxModel && g.scrollTop || h.scrollTop, m = i.pageXOffset || f.support.boxModel && g.scrollLeft || h.scrollLeft, n = c.top + l - j, o = c.left + m - k; return{top:n, left:o}}:f.fn.offset = function(a){var b = this[0]; if (a)return this.each(function(b){f.offset.setOffset(this, a, b)}); if (!b || !b.ownerDocument)return null; if (b === b.ownerDocument.body)return f.offset.bodyOffset(b); f.offset.initialize(); var c, d = b.offsetParent, e = b, g = b.ownerDocument, h = g.documentElement, i = g.body, j = g.defaultView, k = j?j.getComputedStyle(b, null):b.currentStyle, l = b.offsetTop, m = b.offsetLeft; while ((b = b.parentNode) && b !== i && b !== h){if (f.offset.supportsFixedPosition && k.position === "fixed")break; c = j?j.getComputedStyle(b, null):b.currentStyle, l -= b.scrollTop, m -= b.scrollLeft, b === d && (l += b.offsetTop, m += b.offsetLeft, f.offset.doesNotAddBorder && (!f.offset.doesAddBorderForTableAndCells || !cs.test(b.nodeName)) && (l += parseFloat(c.borderTopWidth) || 0, m += parseFloat(c.borderLeftWidth) || 0), e = d, d = b.offsetParent), f.offset.subtractsBorderForOverflowNotVisible && c.overflow !== "visible" && (l += parseFloat(c.borderTopWidth) || 0, m += parseFloat(c.borderLeftWidth) || 0), k = c}if (k.position === "relative" || k.position === "static")l += i.offsetTop, m += i.offsetLeft; f.offset.supportsFixedPosition && k.position === "fixed" && (l += Math.max(h.scrollTop, i.scrollTop), m += Math.max(h.scrollLeft, i.scrollLeft)); return{top:l, left:m}}, f.offset = {initialize:function(){var a = c.body, b = c.createElement("div"), d, e, g, h, i = parseFloat(f.css(a, "marginTop")) || 0, j = "
"; f.extend(b.style, {position:"absolute", top:0, left:0, margin:0, border:0, width:"1px", height:"1px", visibility:"hidden"}), b.innerHTML = j, a.insertBefore(b, a.firstChild), d = b.firstChild, e = d.firstChild, h = d.nextSibling.firstChild.firstChild, this.doesNotAddBorder = e.offsetTop !== 5, this.doesAddBorderForTableAndCells = h.offsetTop === 5, e.style.position = "fixed", e.style.top = "20px", this.supportsFixedPosition = e.offsetTop === 20 || e.offsetTop === 15, e.style.position = e.style.top = "", d.style.overflow = "hidden", d.style.position = "relative", this.subtractsBorderForOverflowNotVisible = e.offsetTop === - 5, this.doesNotIncludeMarginInBodyOffset = a.offsetTop !== i, a.removeChild(b), f.offset.initialize = f.noop}, bodyOffset:function(a){var b = a.offsetTop, c = a.offsetLeft; f.offset.initialize(), f.offset.doesNotIncludeMarginInBodyOffset && (b += parseFloat(f.css(a, "marginTop")) || 0, c += parseFloat(f.css(a, "marginLeft")) || 0); return{top:b, left:c}}, setOffset:function(a, b, c){var d = f.css(a, "position"); d === "static" && (a.style.position = "relative"); var e = f(a), g = e.offset(), h = f.css(a, "top"), i = f.css(a, "left"), j = (d === "absolute" || d === "fixed") && f.inArray("auto", [h, i]) > - 1, k = {}, l = {}, m, n; j?(l = e.position(), m = l.top, n = l.left):(m = parseFloat(h) || 0, n = parseFloat(i) || 0), f.isFunction(b) && (b = b.call(a, c, g)), b.top != null && (k.top = b.top - g.top + m), b.left != null && (k.left = b.left - g.left + n), "using"in b?b.using.call(a, k):e.css(k)}}, f.fn.extend({position:function(){if (!this[0])return null; var a = this[0], b = this.offsetParent(), c = this.offset(), d = ct.test(b[0].nodeName)?{top:0, left:0}:b.offset(); c.top -= parseFloat(f.css(a, "marginTop")) || 0, c.left -= parseFloat(f.css(a, "marginLeft")) || 0, d.top += parseFloat(f.css(b[0], "borderTopWidth")) || 0, d.left += parseFloat(f.css(b[0], "borderLeftWidth")) || 0; return{top:c.top - d.top, left:c.left - d.left}}, offsetParent:function(){return this.map(function(){var a = this.offsetParent || c.body; while (a && !ct.test(a.nodeName) && f.css(a, "position") === "static")a = a.offsetParent; return a})}}), f.each(["Left", "Top"], function(a, c){var d = "scroll" + c; f.fn[d] = function(c){var e, g; if (c === b){e = this[0]; if (!e)return null; g = cu(e); return g?"pageXOffset"in g?g[a?"pageYOffset":"pageXOffset"]:f.support.boxModel && g.document.documentElement[d] || g.document.body[d]:e[d]}return this.each(function(){g = cu(this), g?g.scrollTo(a?f(g).scrollLeft():c, a?c:f(g).scrollTop()):this[d] = c})}}), f.each(["Height", "Width"], function(a, c){var d = c.toLowerCase(); f.fn["inner" + c] = function(){var a = this[0]; return a && a.style?parseFloat(f.css(a, d, "padding")):null}, f.fn["outer" + c] = function(a){var b = this[0]; return b && b.style?parseFloat(f.css(b, d, a?"margin":"border")):null}, f.fn[d] = function(a){var e = this[0]; if (!e)return a == null?null:this; if (f.isFunction(a))return this.each(function(b){var c = f(this); c[d](a.call(this, b, c[d]()))}); if (f.isWindow(e)){var g = e.document.documentElement["client" + c], h = e.document.body; return e.document.compatMode === "CSS1Compat" && g || h && h["client" + c] || g}if (e.nodeType === 9)return Math.max(e.documentElement["client" + c], e.body["scroll" + c], e.documentElement["scroll" + c], e.body["offset" + c], e.documentElement["offset" + c]); if (a === b){var i = f.css(e, d), j = parseFloat(i); return f.isNaN(j)?i:j}return this.css(d, typeof a == "string"?a:a + "px")}}), a.jQuery = a.$ = f})(window); + + + diff --git a/experiment/simulation/js/jsplumb1.js b/experiment/simulation/js/jsplumb1.js new file mode 100644 index 0000000..0e62651 --- /dev/null +++ b/experiment/simulation/js/jsplumb1.js @@ -0,0 +1,15293 @@ +/** + * jsBezier + * + * Copyright (c) 2010 - 2017 jsPlumb (hello@jsplumbtoolkit.com) + * + * licensed under the MIT license. + * + * a set of Bezier curve functions that deal with Beziers, used by jsPlumb, and perhaps useful for other people. These functions work with Bezier + * curves of arbitrary degree. + * + * - functions are all in the 'jsBezier' namespace. + * + * - all input points should be in the format {x:.., y:..}. all output points are in this format too. + * + * - all input curves should be in the format [ {x:.., y:..}, {x:.., y:..}, {x:.., y:..}, {x:.., y:..} ] + * + * - 'location' as used as an input here refers to a decimal in the range 0-1 inclusive, which indicates a point some proportion along the length + * of the curve. location as output has the same format and meaning. + * + * + * Function List: + * -------------- + * + * distanceFromCurve(point, curve) + * + * Calculates the distance that the given point lies from the given Bezier. Note that it is computed relative to the center of the Bezier, + * so if you have stroked the curve with a wide pen you may wish to take that into account! The distance returned is relative to the values + * of the curve and the point - it will most likely be pixels. + * + * gradientAtPoint(curve, location) + * + * Calculates the gradient to the curve at the given location, as a decimal between 0 and 1 inclusive. + * + * gradientAtPointAlongCurveFrom (curve, location) + * + * Calculates the gradient at the point on the given curve that is 'distance' units from location. + * + * nearestPointOnCurve(point, curve) + * + * Calculates the nearest point to the given point on the given curve. The return value of this is a JS object literal, containing both the + *point's coordinates and also the 'location' of the point (see above), for example: { point:{x:551,y:150}, location:0.263365 }. + * + * pointOnCurve(curve, location) + * + * Calculates the coordinates of the point on the given Bezier curve at the given location. + * + * pointAlongCurveFrom(curve, location, distance) + * + * Calculates the coordinates of the point on the given curve that is 'distance' units from location. 'distance' should be in the same coordinate + * space as that used to construct the Bezier curve. For an HTML Canvas usage, for example, distance would be a measure of pixels. + * + * locationAlongCurveFrom(curve, location, distance) + * + * Calculates the location on the given curve that is 'distance' units from location. 'distance' should be in the same coordinate + * space as that used to construct the Bezier curve. For an HTML Canvas usage, for example, distance would be a measure of pixels. + * + * perpendicularToCurveAt(curve, location, length, distance) + * + * Calculates the perpendicular to the given curve at the given location. length is the length of the line you wish for (it will be centered + * on the point at 'location'). distance is optional, and allows you to specify a point along the path from the given location as the center of + * the perpendicular returned. The return value of this is an array of two points: [ {x:...,y:...}, {x:...,y:...} ]. + * + * + */ + +(function() { + + var root = this; + + if(typeof Math.sgn == "undefined") { + Math.sgn = function(x) { return x == 0 ? 0 : x > 0 ? 1 :-1; }; + } + + var Vectors = { + subtract : function(v1, v2) { return {x:v1.x - v2.x, y:v1.y - v2.y }; }, + dotProduct : function(v1, v2) { return (v1.x * v2.x) + (v1.y * v2.y); }, + square : function(v) { return Math.sqrt((v.x * v.x) + (v.y * v.y)); }, + scale : function(v, s) { return {x:v.x * s, y:v.y * s }; } + }, + + maxRecursion = 64, + flatnessTolerance = Math.pow(2.0,-maxRecursion-1); + + /** + * Calculates the distance that the point lies from the curve. + * + * @param point a point in the form {x:567, y:3342} + * @param curve a Bezier curve in the form [{x:..., y:...}, {x:..., y:...}, {x:..., y:...}, {x:..., y:...}]. note that this is currently + * hardcoded to assume cubiz beziers, but would be better off supporting any degree. + * @return a JS object literal containing location and distance, for example: {location:0.35, distance:10}. Location is analogous to the location + * argument you pass to the pointOnPath function: it is a ratio of distance travelled along the curve. Distance is the distance in pixels from + * the point to the curve. + */ + var _distanceFromCurve = function(point, curve) { + var candidates = [], + w = _convertToBezier(point, curve), + degree = curve.length - 1, higherDegree = (2 * degree) - 1, + numSolutions = _findRoots(w, higherDegree, candidates, 0), + v = Vectors.subtract(point, curve[0]), dist = Vectors.square(v), t = 0.0; + + for (var i = 0; i < numSolutions; i++) { + v = Vectors.subtract(point, _bezier(curve, degree, candidates[i], null, null)); + var newDist = Vectors.square(v); + if (newDist < dist) { + dist = newDist; + t = candidates[i]; + } + } + v = Vectors.subtract(point, curve[degree]); + newDist = Vectors.square(v); + if (newDist < dist) { + dist = newDist; + t = 1.0; + } + return {location:t, distance:dist}; + }; + /** + * finds the nearest point on the curve to the given point. + */ + var _nearestPointOnCurve = function(point, curve) { + var td = _distanceFromCurve(point, curve); + return {point:_bezier(curve, curve.length - 1, td.location, null, null), location:td.location}; + }; + var _convertToBezier = function(point, curve) { + var degree = curve.length - 1, higherDegree = (2 * degree) - 1, + c = [], d = [], cdTable = [], w = [], + z = [ [1.0, 0.6, 0.3, 0.1], [0.4, 0.6, 0.6, 0.4], [0.1, 0.3, 0.6, 1.0] ]; + + for (var i = 0; i <= degree; i++) c[i] = Vectors.subtract(curve[i], point); + for (var i = 0; i <= degree - 1; i++) { + d[i] = Vectors.subtract(curve[i+1], curve[i]); + d[i] = Vectors.scale(d[i], 3.0); + } + for (var row = 0; row <= degree - 1; row++) { + for (var column = 0; column <= degree; column++) { + if (!cdTable[row]) cdTable[row] = []; + cdTable[row][column] = Vectors.dotProduct(d[row], c[column]); + } + } + for (i = 0; i <= higherDegree; i++) { + if (!w[i]) w[i] = []; + w[i].y = 0.0; + w[i].x = parseFloat(i) / higherDegree; + } + var n = degree, m = degree-1; + for (var k = 0; k <= n + m; k++) { + var lb = Math.max(0, k - m), + ub = Math.min(k, n); + for (i = lb; i <= ub; i++) { + var j = k - i; + w[i+j].y += cdTable[j][i] * z[j][i]; + } + } + return w; + }; + /** + * counts how many roots there are. + */ + var _findRoots = function(w, degree, t, depth) { + var left = [], right = [], + left_count, right_count, + left_t = [], right_t = []; + + switch (_getCrossingCount(w, degree)) { + case 0 : { + return 0; + } + case 1 : { + if (depth >= maxRecursion) { + t[0] = (w[0].x + w[degree].x) / 2.0; + return 1; + } + if (_isFlatEnough(w, degree)) { + t[0] = _computeXIntercept(w, degree); + return 1; + } + break; + } + } + _bezier(w, degree, 0.5, left, right); + left_count = _findRoots(left, degree, left_t, depth+1); + right_count = _findRoots(right, degree, right_t, depth+1); + for (var i = 0; i < left_count; i++) t[i] = left_t[i]; + for (var i = 0; i < right_count; i++) t[i+left_count] = right_t[i]; + return (left_count+right_count); + }; + var _getCrossingCount = function(curve, degree) { + var n_crossings = 0, sign, old_sign; + sign = old_sign = Math.sgn(curve[0].y); + for (var i = 1; i <= degree; i++) { + sign = Math.sgn(curve[i].y); + if (sign != old_sign) n_crossings++; + old_sign = sign; + } + return n_crossings; + }; + var _isFlatEnough = function(curve, degree) { + var error, + intercept_1, intercept_2, left_intercept, right_intercept, + a, b, c, det, dInv, a1, b1, c1, a2, b2, c2; + a = curve[0].y - curve[degree].y; + b = curve[degree].x - curve[0].x; + c = curve[0].x * curve[degree].y - curve[degree].x * curve[0].y; + + var max_distance_above, max_distance_below; + max_distance_above = max_distance_below = 0.0; + + for (var i = 1; i < degree; i++) { + var value = a * curve[i].x + b * curve[i].y + c; + if (value > max_distance_above) + max_distance_above = value; + else if (value < max_distance_below) + max_distance_below = value; + } + + a1 = 0.0; b1 = 1.0; c1 = 0.0; a2 = a; b2 = b; + c2 = c - max_distance_above; + det = a1 * b2 - a2 * b1; + dInv = 1.0/det; + intercept_1 = (b1 * c2 - b2 * c1) * dInv; + a2 = a; b2 = b; c2 = c - max_distance_below; + det = a1 * b2 - a2 * b1; + dInv = 1.0/det; + intercept_2 = (b1 * c2 - b2 * c1) * dInv; + left_intercept = Math.min(intercept_1, intercept_2); + right_intercept = Math.max(intercept_1, intercept_2); + error = right_intercept - left_intercept; + return (error < flatnessTolerance)? 1 : 0; + }; + var _computeXIntercept = function(curve, degree) { + var XLK = 1.0, YLK = 0.0, + XNM = curve[degree].x - curve[0].x, YNM = curve[degree].y - curve[0].y, + XMK = curve[0].x - 0.0, YMK = curve[0].y - 0.0, + det = XNM*YLK - YNM*XLK, detInv = 1.0/det, + S = (XNM*YMK - YNM*XMK) * detInv; + return 0.0 + XLK * S; + }; + var _bezier = function(curve, degree, t, left, right) { + var temp = [[]]; + for (var j =0; j <= degree; j++) temp[0][j] = curve[j]; + for (var i = 1; i <= degree; i++) { + for (var j =0 ; j <= degree - i; j++) { + if (!temp[i]) temp[i] = []; + if (!temp[i][j]) temp[i][j] = {}; + temp[i][j].x = (1.0 - t) * temp[i-1][j].x + t * temp[i-1][j+1].x; + temp[i][j].y = (1.0 - t) * temp[i-1][j].y + t * temp[i-1][j+1].y; + } + } + if (left != null) + for (j = 0; j <= degree; j++) left[j] = temp[j][0]; + if (right != null) + for (j = 0; j <= degree; j++) right[j] = temp[degree-j][j]; + + return (temp[degree][0]); + }; + + var _curveFunctionCache = {}; + var _getCurveFunctions = function(order) { + var fns = _curveFunctionCache[order]; + if (!fns) { + fns = []; + var f_term = function() { return function(t) { return Math.pow(t, order); }; }, + l_term = function() { return function(t) { return Math.pow((1-t), order); }; }, + c_term = function(c) { return function(t) { return c; }; }, + t_term = function() { return function(t) { return t; }; }, + one_minus_t_term = function() { return function(t) { return 1-t; }; }, + _termFunc = function(terms) { + return function(t) { + var p = 1; + for (var i = 0; i < terms.length; i++) p = p * terms[i](t); + return p; + }; + }; + + fns.push(new f_term()); // first is t to the power of the curve order + for (var i = 1; i < order; i++) { + var terms = [new c_term(order)]; + for (var j = 0 ; j < (order - i); j++) terms.push(new t_term()); + for (var j = 0 ; j < i; j++) terms.push(new one_minus_t_term()); + fns.push(new _termFunc(terms)); + } + fns.push(new l_term()); // last is (1-t) to the power of the curve order + + _curveFunctionCache[order] = fns; + } + + return fns; + }; + + + /** + * calculates a point on the curve, for a Bezier of arbitrary order. + * @param curve an array of control points, eg [{x:10,y:20}, {x:50,y:50}, {x:100,y:100}, {x:120,y:100}]. For a cubic bezier this should have four points. + * @param location a decimal indicating the distance along the curve the point should be located at. this is the distance along the curve as it travels, taking the way it bends into account. should be a number from 0 to 1, inclusive. + */ + var _pointOnPath = function(curve, location) { + var cc = _getCurveFunctions(curve.length - 1), + _x = 0, _y = 0; + for (var i = 0; i < curve.length ; i++) { + _x = _x + (curve[i].x * cc[i](location)); + _y = _y + (curve[i].y * cc[i](location)); + } + + return {x:_x, y:_y}; + }; + + var _dist = function(p1,p2) { + return Math.sqrt(Math.pow(p1.x - p2.x, 2) + Math.pow(p1.y - p2.y, 2)); + }; + + var _isPoint = function(curve) { + return curve[0].x === curve[1].x && curve[0].y === curve[1].y; + }; + + /** + * finds the point that is 'distance' along the path from 'location'. this method returns both the x,y location of the point and also + * its 'location' (proportion of travel along the path); the method below - _pointAlongPathFrom - calls this method and just returns the + * point. + */ + var _pointAlongPath = function(curve, location, distance) { + + if (_isPoint(curve)) { + return { + point:curve[0], + location:location + }; + } + + var prev = _pointOnPath(curve, location), + tally = 0, + curLoc = location, + direction = distance > 0 ? 1 : -1, + cur = null; + + while (tally < Math.abs(distance)) { + curLoc += (0.005 * direction); + cur = _pointOnPath(curve, curLoc); + tally += _dist(cur, prev); + prev = cur; + } + return {point:cur, location:curLoc}; + }; + + var _length = function(curve) { + if (_isPoint(curve)) return 0; + + var prev = _pointOnPath(curve, 0), + tally = 0, + curLoc = 0, + direction = 1, + cur = null; + + while (curLoc < 1) { + curLoc += (0.005 * direction); + cur = _pointOnPath(curve, curLoc); + tally += _dist(cur, prev); + prev = cur; + } + return tally; + }; + + /** + * finds the point that is 'distance' along the path from 'location'. + */ + var _pointAlongPathFrom = function(curve, location, distance) { + return _pointAlongPath(curve, location, distance).point; + }; + + /** + * finds the location that is 'distance' along the path from 'location'. + */ + var _locationAlongPathFrom = function(curve, location, distance) { + return _pointAlongPath(curve, location, distance).location; + }; + + /** + * returns the gradient of the curve at the given location, which is a decimal between 0 and 1 inclusive. + * + * thanks // http://bimixual.org/AnimationLibrary/beziertangents.html + */ + var _gradientAtPoint = function(curve, location) { + var p1 = _pointOnPath(curve, location), + p2 = _pointOnPath(curve.slice(0, curve.length - 1), location), + dy = p2.y - p1.y, dx = p2.x - p1.x; + return dy === 0 ? Infinity : Math.atan(dy / dx); + }; + + /** + returns the gradient of the curve at the point which is 'distance' from the given location. + if this point is greater than location 1, the gradient at location 1 is returned. + if this point is less than location 0, the gradient at location 0 is returned. + */ + var _gradientAtPointAlongPathFrom = function(curve, location, distance) { + var p = _pointAlongPath(curve, location, distance); + if (p.location > 1) p.location = 1; + if (p.location < 0) p.location = 0; + return _gradientAtPoint(curve, p.location); + }; + + /** + * calculates a line that is 'length' pixels long, perpendicular to, and centered on, the path at 'distance' pixels from the given location. + * if distance is not supplied, the perpendicular for the given location is computed (ie. we set distance to zero). + */ + var _perpendicularToPathAt = function(curve, location, length, distance) { + distance = distance == null ? 0 : distance; + var p = _pointAlongPath(curve, location, distance), + m = _gradientAtPoint(curve, p.location), + _theta2 = Math.atan(-1 / m), + y = length / 2 * Math.sin(_theta2), + x = length / 2 * Math.cos(_theta2); + return [{x:p.point.x + x, y:p.point.y + y}, {x:p.point.x - x, y:p.point.y - y}]; + }; + + /** + * Calculates all intersections of the given line with the given curve. + * @param x1 + * @param y1 + * @param x2 + * @param y2 + * @param curve + * @returns {Array} + */ + var _lineIntersection = function(x1, y1, x2, y2, curve) { + var a = y2 - y1, + b = x1 - x2, + c = (x1 * (y1 - y2)) + (y1 * (x2-x1)), + coeffs = _computeCoefficients(curve), + p = [ + (a*coeffs[0][0]) + (b * coeffs[1][0]), + (a*coeffs[0][1])+(b*coeffs[1][1]), + (a*coeffs[0][2])+(b*coeffs[1][2]), + (a*coeffs[0][3])+(b*coeffs[1][3]) + c + ], + r = _cubicRoots.apply(null, p), + intersections = []; + + if (r != null) { + + for (var i = 0; i < 3; i++) { + var t = r[i], + t2 = Math.pow(t, 2), + t3 = Math.pow(t, 3), + x = [ + (coeffs[0][0] * t3) + (coeffs[0][1] * t2) + (coeffs[0][2] * t) + coeffs[0][3], + (coeffs[1][0] * t3) + (coeffs[1][1] * t2) + (coeffs[1][2] * t) + coeffs[1][3] + ]; + + // check bounds of the line + var s; + if ((x2 - x1) !== 0) { + s = (x[0] - x1) / (x2 - x1); + } + else { + s = (x[1] - y1) / (y2 - y1); + } + + if (t >= 0 && t <= 1.0 && s >= 0 && s <= 1.0) { + intersections.push(x); + } + } + } + + return intersections; + }; + + /** + * Calculates all intersections of the given box with the given curve. + * @param x X position of top left corner of box + * @param y Y position of top left corner of box + * @param w width of box + * @param h height of box + * @param curve + * @returns {Array} + */ + var _boxIntersection = function(x, y, w, h, curve) { + var i = []; + i.push.apply(i, _lineIntersection(x, y, x + w, y, curve)); + i.push.apply(i, _lineIntersection(x + w, y, x + w, y + h, curve)); + i.push.apply(i, _lineIntersection(x + w, y + h, x, y + h, curve)); + i.push.apply(i, _lineIntersection(x, y + h, x, y, curve)); + return i; + }; + + /** + * Calculates all intersections of the given bounding box with the given curve. + * @param boundingBox Bounding box, in { x:.., y:..., w:..., h:... } format. + * @param curve + * @returns {Array} + */ + var _boundingBoxIntersection = function(boundingBox, curve) { + var i = []; + i.push.apply(i, _lineIntersection(boundingBox.x, boundingBox.y, boundingBox.x + boundingBox.w, boundingBox.y, curve)); + i.push.apply(i, _lineIntersection(boundingBox.x + boundingBox.w, boundingBox.y, boundingBox.x + boundingBox.w, boundingBox.y + boundingBox.h, curve)); + i.push.apply(i, _lineIntersection(boundingBox.x + boundingBox.w, boundingBox.y + boundingBox.h, boundingBox.x, boundingBox.y + boundingBox.h, curve)); + i.push.apply(i, _lineIntersection(boundingBox.x, boundingBox.y + boundingBox.h, boundingBox.x, boundingBox.y, curve)); + return i; + }; + + + function _computeCoefficientsForAxis(curve, axis) { + return [ + -(curve[0][axis]) + (3*curve[1][axis]) + (-3 * curve[2][axis]) + curve[3][axis], + (3*(curve[0][axis])) - (6*(curve[1][axis])) + (3*(curve[2][axis])), + -3*curve[0][axis] + 3*curve[1][axis], + curve[0][axis] + ]; + } + + function _computeCoefficients(curve) + { + return [ + _computeCoefficientsForAxis(curve, "x"), + _computeCoefficientsForAxis(curve, "y") + ]; + } + + function sgn(x) { + return x < 0 ? -1 : x > 0 ? 1 : 0; + } + + function _cubicRoots(a, b, c, d) { + var A = b / a, + B = c / a, + C = d / a, + Q = (3*B - Math.pow(A, 2))/9, + R = (9*A*B - 27*C - 2*Math.pow(A, 3))/54, + D = Math.pow(Q, 3) + Math.pow(R, 2), + S, + T, + t = []; + + if (D >= 0) // complex or duplicate roots + { + S = sgn(R + Math.sqrt(D))*Math.pow(Math.abs(R + Math.sqrt(D)),(1/3)); + T = sgn(R - Math.sqrt(D))*Math.pow(Math.abs(R - Math.sqrt(D)),(1/3)); + + t[0] = -A/3 + (S + T); + t[1] = -A/3 - (S + T)/2; + t[2] = -A/3 - (S + T)/2; + + /*discard complex roots*/ + if (Math.abs(Math.sqrt(3)*(S - T)/2) !== 0) { + t[1] = -1; + t[2] = -1; + } + } + else // distinct real roots + { + var th = Math.acos(R/Math.sqrt(-Math.pow(Q, 3))); + t[0] = 2*Math.sqrt(-Q)*Math.cos(th/3) - A/3; + t[1] = 2*Math.sqrt(-Q)*Math.cos((th + 2*Math.PI)/3) - A/3; + t[2] = 2*Math.sqrt(-Q)*Math.cos((th + 4*Math.PI)/3) - A/3; + } + + // discard out of spec roots + for (var i = 0; i < 3; i++) { + if (t[i] < 0 || t[i] > 1.0) { + t[i] = -1; + } + } + + return t; + } + + var jsBezier = this.jsBezier = { + distanceFromCurve : _distanceFromCurve, + gradientAtPoint : _gradientAtPoint, + gradientAtPointAlongCurveFrom : _gradientAtPointAlongPathFrom, + nearestPointOnCurve : _nearestPointOnCurve, + pointOnCurve : _pointOnPath, + pointAlongCurveFrom : _pointAlongPathFrom, + perpendicularToCurveAt : _perpendicularToPathAt, + locationAlongCurveFrom:_locationAlongPathFrom, + getLength:_length, + lineIntersection:_lineIntersection, + boxIntersection:_boxIntersection, + boundingBoxIntersection:_boundingBoxIntersection, + version:"0.9.0" + }; + + if (typeof exports !== "undefined") { + exports.jsBezier = jsBezier; + } + +}).call(typeof window !== 'undefined' ? window : this); + +/** + * Biltong v0.4.0 + * + * Various geometry functions written as part of jsPlumb and perhaps useful for others. + * + * Copyright (c) 2017 jsPlumb + * https://jsplumbtoolkit.com + * + * Permission is hereby granted, free of charge, to any person + * obtaining a copy of this software and associated documentation + * files (the "Software"), to deal in the Software without + * restriction, including without limitation the rights to use, + * copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the + * Software is furnished to do so, subject to the following + * conditions: + * + * The above copyright notice and this permission notice shall be + * included in all copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, + * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES + * OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND + * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT + * HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, + * WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING + * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR + * OTHER DEALINGS IN THE SOFTWARE. + */ +;(function() { + + "use strict"; + var root = this; + + var Biltong = root.Biltong = { + version:"0.4.0" + }; + + if (typeof exports !== "undefined") { + exports.Biltong = Biltong; + } + + var _isa = function(a) { return Object.prototype.toString.call(a) === "[object Array]"; }, + _pointHelper = function(p1, p2, fn) { + p1 = _isa(p1) ? p1 : [p1.x, p1.y]; + p2 = _isa(p2) ? p2 : [p2.x, p2.y]; + return fn(p1, p2); + }, + /** + * @name Biltong.gradient + * @function + * @desc Calculates the gradient of a line between the two points. + * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties. + * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties. + * @return {Float} The gradient of a line between the two points. + */ + _gradient = Biltong.gradient = function(p1, p2) { + return _pointHelper(p1, p2, function(_p1, _p2) { + if (_p2[0] == _p1[0]) + return _p2[1] > _p1[1] ? Infinity : -Infinity; + else if (_p2[1] == _p1[1]) + return _p2[0] > _p1[0] ? 0 : -0; + else + return (_p2[1] - _p1[1]) / (_p2[0] - _p1[0]); + }); + }, + /** + * @name Biltong.normal + * @function + * @desc Calculates the gradient of a normal to a line between the two points. + * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties. + * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties. + * @return {Float} The gradient of a normal to a line between the two points. + */ + _normal = Biltong.normal = function(p1, p2) { + return -1 / _gradient(p1, p2); + }, + /** + * @name Biltong.lineLength + * @function + * @desc Calculates the length of a line between the two points. + * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties. + * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties. + * @return {Float} The length of a line between the two points. + */ + _lineLength = Biltong.lineLength = function(p1, p2) { + return _pointHelper(p1, p2, function(_p1, _p2) { + return Math.sqrt(Math.pow(_p2[1] - _p1[1], 2) + Math.pow(_p2[0] - _p1[0], 2)); + }); + }, + /** + * @name Biltong.quadrant + * @function + * @desc Calculates the quadrant in which the angle between the two points lies. + * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties. + * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties. + * @return {Integer} The quadrant - 1 for upper right, 2 for lower right, 3 for lower left, 4 for upper left. + */ + _quadrant = Biltong.quadrant = function(p1, p2) { + return _pointHelper(p1, p2, function(_p1, _p2) { + if (_p2[0] > _p1[0]) { + return (_p2[1] > _p1[1]) ? 2 : 1; + } + else if (_p2[0] == _p1[0]) { + return _p2[1] > _p1[1] ? 2 : 1; + } + else { + return (_p2[1] > _p1[1]) ? 3 : 4; + } + }); + }, + /** + * @name Biltong.theta + * @function + * @desc Calculates the angle between the two points. + * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties. + * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties. + * @return {Float} The angle between the two points. + */ + _theta = Biltong.theta = function(p1, p2) { + return _pointHelper(p1, p2, function(_p1, _p2) { + var m = _gradient(_p1, _p2), + t = Math.atan(m), + s = _quadrant(_p1, _p2); + if ((s == 4 || s== 3)) t += Math.PI; + if (t < 0) t += (2 * Math.PI); + + return t; + }); + }, + /** + * @name Biltong.intersects + * @function + * @desc Calculates whether or not the two rectangles intersect. + * @param {Rectangle} r1 First rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}` + * @param {Rectangle} r2 Second rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}` + * @return {Boolean} True if the rectangles intersect, false otherwise. + */ + _intersects = Biltong.intersects = function(r1, r2) { + var x1 = r1.x, x2 = r1.x + r1.w, y1 = r1.y, y2 = r1.y + r1.h, + a1 = r2.x, a2 = r2.x + r2.w, b1 = r2.y, b2 = r2.y + r2.h; + + return ( (x1 <= a1 && a1 <= x2) && (y1 <= b1 && b1 <= y2) ) || + ( (x1 <= a2 && a2 <= x2) && (y1 <= b1 && b1 <= y2) ) || + ( (x1 <= a1 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) || + ( (x1 <= a2 && a1 <= x2) && (y1 <= b2 && b2 <= y2) ) || + ( (a1 <= x1 && x1 <= a2) && (b1 <= y1 && y1 <= b2) ) || + ( (a1 <= x2 && x2 <= a2) && (b1 <= y1 && y1 <= b2) ) || + ( (a1 <= x1 && x1 <= a2) && (b1 <= y2 && y2 <= b2) ) || + ( (a1 <= x2 && x1 <= a2) && (b1 <= y2 && y2 <= b2) ); + }, + /** + * @name Biltong.encloses + * @function + * @desc Calculates whether or not r2 is completely enclosed by r1. + * @param {Rectangle} r1 First rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}` + * @param {Rectangle} r2 Second rectangle, as a js object in the form `{x:.., y:.., w:.., h:..}` + * @param {Boolean} [allowSharedEdges=false] If true, the concept of enclosure allows for one or more edges to be shared by the two rectangles. + * @return {Boolean} True if r1 encloses r2, false otherwise. + */ + _encloses = Biltong.encloses = function(r1, r2, allowSharedEdges) { + var x1 = r1.x, x2 = r1.x + r1.w, y1 = r1.y, y2 = r1.y + r1.h, + a1 = r2.x, a2 = r2.x + r2.w, b1 = r2.y, b2 = r2.y + r2.h, + c = function(v1, v2, v3, v4) { return allowSharedEdges ? v1 <= v2 && v3>= v4 : v1 < v2 && v3 > v4; }; + + return c(x1,a1,x2,a2) && c(y1,b1,y2,b2); + }, + _segmentMultipliers = [null, [1, -1], [1, 1], [-1, 1], [-1, -1] ], + _inverseSegmentMultipliers = [null, [-1, -1], [-1, 1], [1, 1], [1, -1] ], + /** + * @name Biltong.pointOnLine + * @function + * @desc Calculates a point on the line from `fromPoint` to `toPoint` that is `distance` units along the length of the line. + * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties. + * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties. + * @return {Point} Point on the line, in the form `{ x:..., y:... }`. + */ + _pointOnLine = Biltong.pointOnLine = function(fromPoint, toPoint, distance) { + var m = _gradient(fromPoint, toPoint), + s = _quadrant(fromPoint, toPoint), + segmentMultiplier = distance > 0 ? _segmentMultipliers[s] : _inverseSegmentMultipliers[s], + theta = Math.atan(m), + y = Math.abs(distance * Math.sin(theta)) * segmentMultiplier[1], + x = Math.abs(distance * Math.cos(theta)) * segmentMultiplier[0]; + return { x:fromPoint.x + x, y:fromPoint.y + y }; + }, + /** + * @name Biltong.perpendicularLineTo + * @function + * @desc Calculates a line of length `length` that is perpendicular to the line from `fromPoint` to `toPoint` and passes through `toPoint`. + * @param {Point} p1 First point, either as a 2 entry array or object with `left` and `top` properties. + * @param {Point} p2 Second point, either as a 2 entry array or object with `left` and `top` properties. + * @return {Line} Perpendicular line, in the form `[ { x:..., y:... }, { x:..., y:... } ]`. + */ + _perpendicularLineTo = Biltong.perpendicularLineTo = function(fromPoint, toPoint, length) { + var m = _gradient(fromPoint, toPoint), + theta2 = Math.atan(-1 / m), + y = length / 2 * Math.sin(theta2), + x = length / 2 * Math.cos(theta2); + return [{x:toPoint.x + x, y:toPoint.y + y}, {x:toPoint.x - x, y:toPoint.y - y}]; + }; +}).call(typeof window !== 'undefined' ? window : this); +; +(function () { + + "use strict"; + + /** + * Creates a Touch object. + * @param view + * @param target + * @param pageX + * @param pageY + * @param screenX + * @param screenY + * @param clientX + * @param clientY + * @returns {Touch} + * @private + */ + function _touch(view, target, pageX, pageY, screenX, screenY, clientX, clientY) { + + return new Touch({ + target:target, + identifier:_uuid(), + pageX: pageX, + pageY: pageY, + screenX: screenX, + screenY: screenY, + clientX: clientX || screenX, + clientY: clientY || screenY + }); + } + + /** + * Create a synthetic touch list from the given list of Touch objects. + * @returns {Array} + * @private + */ + function _touchList() { + var list = []; + Array.prototype.push.apply(list, arguments); + list.item = function(index) { return this[index]; }; + return list; + } + + /** + * Create a Touch object and then insert it into a synthetic touch list, returning the list.s + * @param view + * @param target + * @param pageX + * @param pageY + * @param screenX + * @param screenY + * @param clientX + * @param clientY + * @returns {Array} + * @private + */ + function _touchAndList(view, target, pageX, pageY, screenX, screenY, clientX, clientY) { + return _touchList(_touch.apply(null, arguments)); + } + + var root = this, + matchesSelector = function (el, selector, ctx) { + ctx = ctx || el.parentNode; + var possibles = ctx.querySelectorAll(selector); + for (var i = 0; i < possibles.length; i++) { + if (possibles[i] === el) { + return true; + } + } + return false; + }, + _gel = function (el) { + return (typeof el == "string" || el.constructor === String) ? document.getElementById(el) : el; + }, + _t = function (e) { + return e.srcElement || e.target; + }, + // + // gets path info for the given event - the path from target to obj, in the event's bubble chain. if doCompute + // is false we just return target for the path. + // + _pi = function(e, target, obj, doCompute) { + if (!doCompute) return { path:[target], end:1 }; + else if (typeof e.path !== "undefined" && e.path.indexOf) { + return { path: e.path, end: e.path.indexOf(obj) }; + } else { + var out = { path:[], end:-1 }, _one = function(el) { + out.path.push(el); + if (el === obj) { + out.end = out.path.length - 1; + } + else if (el.parentNode != null) { + _one(el.parentNode) + } + }; + _one(target); + return out; + } + }, + _d = function (l, fn) { + for (var i = 0, j = l.length; i < j; i++) { + if (l[i] == fn) break; + } + if (i < l.length) l.splice(i, 1); + }, + guid = 1, + // + // this function generates a guid for every handler, sets it on the handler, then adds + // it to the associated object's map of handlers for the given event. this is what enables us + // to unbind all events of some type, or all events (the second of which can be requested by the user, + // but it also used by Mottle when an element is removed.) + _store = function (obj, event, fn) { + var g = guid++; + obj.__ta = obj.__ta || {}; + obj.__ta[event] = obj.__ta[event] || {}; + // store each handler with a unique guid. + obj.__ta[event][g] = fn; + // set the guid on the handler. + fn.__tauid = g; + return g; + }, + _unstore = function (obj, event, fn) { + obj.__ta && obj.__ta[event] && delete obj.__ta[event][fn.__tauid]; + // a handler might have attached extra functions, so we unbind those too. + if (fn.__taExtra) { + for (var i = 0; i < fn.__taExtra.length; i++) { + _unbind(obj, fn.__taExtra[i][0], fn.__taExtra[i][1]); + } + fn.__taExtra.length = 0; + } + // a handler might have attached an unstore callback + fn.__taUnstore && fn.__taUnstore(); + }, + _curryChildFilter = function (children, obj, fn, evt) { + if (children == null) return fn; + else { + var c = children.split(","), + _fn = function (e) { + _fn.__tauid = fn.__tauid; + var t = _t(e), target = t; // t is the target element on which the event occurred. it is the + // element we will wish to pass to any callbacks. + var pathInfo = _pi(e, t, obj, children != null) + if (pathInfo.end != -1) { + for (var p = 0; p < pathInfo.end; p++) { + target = pathInfo.path[p]; + for (var i = 0; i < c.length; i++) { + if (matchesSelector(target, c[i], obj)) { + fn.apply(target, arguments); + } + } + } + } + }; + registerExtraFunction(fn, evt, _fn); + return _fn; + } + }, + // + // registers an 'extra' function on some event listener function we were given - a function that we + // created and bound to the element as part of our housekeeping, and which we want to unbind and remove + // whenever the given function is unbound. + registerExtraFunction = function (fn, evt, newFn) { + fn.__taExtra = fn.__taExtra || []; + fn.__taExtra.push([evt, newFn]); + }, + DefaultHandler = function (obj, evt, fn, children) { + if (isTouchDevice && touchMap[evt]) { + var tfn = _curryChildFilter(children, obj, fn, touchMap[evt]); + _bind(obj, touchMap[evt], tfn , fn); + } + if (evt === "focus" && obj.getAttribute("tabindex") == null) { + obj.setAttribute("tabindex", "1"); + } + _bind(obj, evt, _curryChildFilter(children, obj, fn, evt), fn); + }, + SmartClickHandler = function (obj, evt, fn, children) { + if (obj.__taSmartClicks == null) { + var down = function (e) { + obj.__tad = _pageLocation(e); + }, + up = function (e) { + obj.__tau = _pageLocation(e); + }, + click = function (e) { + if (obj.__tad && obj.__tau && obj.__tad[0] === obj.__tau[0] && obj.__tad[1] === obj.__tau[1]) { + for (var i = 0; i < obj.__taSmartClicks.length; i++) + obj.__taSmartClicks[i].apply(_t(e), [ e ]); + } + }; + DefaultHandler(obj, "mousedown", down, children); + DefaultHandler(obj, "mouseup", up, children); + DefaultHandler(obj, "click", click, children); + obj.__taSmartClicks = []; + } + + // store in the list of callbacks + obj.__taSmartClicks.push(fn); + // the unstore function removes this function from the object's listener list for this type. + fn.__taUnstore = function () { + _d(obj.__taSmartClicks, fn); + }; + }, + _tapProfiles = { + "tap": {touches: 1, taps: 1}, + "dbltap": {touches: 1, taps: 2}, + "contextmenu": {touches: 2, taps: 1} + }, + TapHandler = function (clickThreshold, dblClickThreshold) { + return function (obj, evt, fn, children) { + // if event is contextmenu, for devices which are mouse only, we want to + // use the default bind. + if (evt == "contextmenu" && isMouseDevice) + DefaultHandler(obj, evt, fn, children); + else { + // the issue here is that this down handler gets registered only for the + // child nodes in the first registration. in fact it should be registered with + // no child selector and then on down we should cycle through the registered + // functions to see if one of them matches. on mouseup we should execute ALL of + // the functions whose children are either null or match the element. + if (obj.__taTapHandler == null) { + var tt = obj.__taTapHandler = { + tap: [], + dbltap: [], + contextmenu: [], + down: false, + taps: 0, + downSelectors: [] + }; + var down = function (e) { + var target = _t(e), pathInfo = _pi(e, target, obj, children != null), finished = false; + for (var p = 0; p < pathInfo.end; p++) { + if (finished) return; + target = pathInfo.path[p]; + for (var i = 0; i < tt.downSelectors.length; i++) { + if (tt.downSelectors[i] == null || matchesSelector(target, tt.downSelectors[i], obj)) { + tt.down = true; + setTimeout(clearSingle, clickThreshold); + setTimeout(clearDouble, dblClickThreshold); + finished = true; + break; // we only need one match on mousedown + } + } + } + }, + up = function (e) { + if (tt.down) { + var target = _t(e), currentTarget, pathInfo; + tt.taps++; + var tc = _touchCount(e); + for (var eventId in _tapProfiles) { + if (_tapProfiles.hasOwnProperty(eventId)) { + var p = _tapProfiles[eventId]; + if (p.touches === tc && (p.taps === 1 || p.taps === tt.taps)) { + for (var i = 0; i < tt[eventId].length; i++) { + pathInfo = _pi(e, target, obj, tt[eventId][i][1] != null); + for (var pLoop = 0; pLoop < pathInfo.end; pLoop++) { + currentTarget = pathInfo.path[pLoop]; + // this is a single event registration handler. + if (tt[eventId][i][1] == null || matchesSelector(currentTarget, tt[eventId][i][1], obj)) { + tt[eventId][i][0].apply(currentTarget, [ e ]); + break; + } + } + } + } + } + } + } + }, + clearSingle = function () { + tt.down = false; + }, + clearDouble = function () { + tt.taps = 0; + }; + + DefaultHandler(obj, "mousedown", down); + DefaultHandler(obj, "mouseup", up); + } + // add this child selector (it can be null, that's fine). + obj.__taTapHandler.downSelectors.push(children); + + obj.__taTapHandler[evt].push([fn, children]); + // the unstore function removes this function from the object's listener list for this type. + fn.__taUnstore = function () { + _d(obj.__taTapHandler[evt], fn); + }; + } + }; + }, + meeHelper = function (type, evt, obj, target) { + for (var i in obj.__tamee[type]) { + if (obj.__tamee[type].hasOwnProperty(i)) { + obj.__tamee[type][i].apply(target, [ evt ]); + } + } + }, + MouseEnterExitHandler = function () { + var activeElements = []; + return function (obj, evt, fn, children) { + if (!obj.__tamee) { + // __tamee holds a flag saying whether the mouse is currently "in" the element, and a list of + // both mouseenter and mouseexit functions. + obj.__tamee = { over: false, mouseenter: [], mouseexit: [] }; + // register over and out functions + var over = function (e) { + var t = _t(e); + if ((children == null && (t == obj && !obj.__tamee.over)) || (matchesSelector(t, children, obj) && (t.__tamee == null || !t.__tamee.over))) { + meeHelper("mouseenter", e, obj, t); + t.__tamee = t.__tamee || {}; + t.__tamee.over = true; + activeElements.push(t); + } + }, + out = function (e) { + var t = _t(e); + // is the current target one of the activeElements? and is the + // related target NOT a descendant of it? + for (var i = 0; i < activeElements.length; i++) { + if (t == activeElements[i] && !matchesSelector((e.relatedTarget || e.toElement), "*", t)) { + t.__tamee.over = false; + activeElements.splice(i, 1); + meeHelper("mouseexit", e, obj, t); + } + } + }; + + _bind(obj, "mouseover", _curryChildFilter(children, obj, over, "mouseover"), over); + _bind(obj, "mouseout", _curryChildFilter(children, obj, out, "mouseout"), out); + } + + fn.__taUnstore = function () { + delete obj.__tamee[evt][fn.__tauid]; + }; + + _store(obj, evt, fn); + obj.__tamee[evt][fn.__tauid] = fn; + }; + }, + isTouchDevice = "ontouchstart" in document.documentElement, + isMouseDevice = "onmousedown" in document.documentElement, + touchMap = { "mousedown": "touchstart", "mouseup": "touchend", "mousemove": "touchmove" }, + touchstart = "touchstart", touchend = "touchend", touchmove = "touchmove", + iev = (function () { + var rv = -1; + if (navigator.appName == 'Microsoft Internet Explorer') { + var ua = navigator.userAgent, + re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); + if (re.exec(ua) != null) + rv = parseFloat(RegExp.$1); + } + return rv; + })(), + isIELT9 = iev > -1 && iev < 9, + _genLoc = function (e, prefix) { + if (e == null) return [ 0, 0 ]; + var ts = _touches(e), t = _getTouch(ts, 0); + return [t[prefix + "X"], t[prefix + "Y"]]; + }, + _pageLocation = function (e) { + if (e == null) return [ 0, 0 ]; + if (isIELT9) { + return [ e.clientX + document.documentElement.scrollLeft, e.clientY + document.documentElement.scrollTop ]; + } + else { + return _genLoc(e, "page"); + } + }, + _screenLocation = function (e) { + return _genLoc(e, "screen"); + }, + _clientLocation = function (e) { + return _genLoc(e, "client"); + }, + _getTouch = function (touches, idx) { + return touches.item ? touches.item(idx) : touches[idx]; + }, + _touches = function (e) { + return e.touches && e.touches.length > 0 ? e.touches : + e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches : + e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches : + [ e ]; + }, + _touchCount = function (e) { + return _touches(e).length; + }, + //http://www.quirksmode.org/blog/archives/2005/10/_and_the_winner_1.html + _bind = function (obj, type, fn, originalFn) { + _store(obj, type, fn); + originalFn.__tauid = fn.__tauid; + if (obj.addEventListener) + obj.addEventListener(type, fn, false); + else if (obj.attachEvent) { + var key = type + fn.__tauid; + obj["e" + key] = fn; + // TODO look at replacing with .call(..) + obj[key] = function () { + obj["e" + key] && obj["e" + key](window.event); + }; + obj.attachEvent("on" + type, obj[key]); + } + }, + _unbind = function (obj, type, fn) { + if (fn == null) return; + _each(obj, function () { + var _el = _gel(this); + _unstore(_el, type, fn); + // it has been bound if there is a tauid. otherwise it was not bound and we can ignore it. + if (fn.__tauid != null) { + if (_el.removeEventListener) { + _el.removeEventListener(type, fn, false); + if (isTouchDevice && touchMap[type]) _el.removeEventListener(touchMap[type], fn, false); + } + else if (this.detachEvent) { + var key = type + fn.__tauid; + _el[key] && _el.detachEvent("on" + type, _el[key]); + _el[key] = null; + _el["e" + key] = null; + } + } + + // if a touch event was also registered, deregister now. + if (fn.__taTouchProxy) { + _unbind(obj, fn.__taTouchProxy[1], fn.__taTouchProxy[0]); + } + }); + }, + _each = function (obj, fn) { + if (obj == null) return; + // if a list (or list-like), use it. if a string, get a list + // by running the string through querySelectorAll. else, assume + // it's an Element. + // obj.top is "unknown" in IE8. + obj = (typeof Window !== "undefined" && (typeof obj.top !== "unknown" && obj == obj.top)) ? [ obj ] : + (typeof obj !== "string") && (obj.tagName == null && obj.length != null) ? obj : + typeof obj === "string" ? document.querySelectorAll(obj) + : [ obj ]; + + for (var i = 0; i < obj.length; i++) + fn.apply(obj[i]); + }, + _uuid = function () { + return ('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + var r = Math.random() * 16 | 0, v = c == 'x' ? r : (r & 0x3 | 0x8); + return v.toString(16); + })); + }; + + /** + * Mottle offers support for abstracting out the differences + * between touch and mouse devices, plus "smart click" functionality + * (don't fire click if the mouse has moved between mousedown and mouseup), + * and synthesized click/tap events. + * @class Mottle + * @constructor + * @param {Object} params Constructor params + * @param {Number} [params.clickThreshold=250] Threshold, in milliseconds beyond which a touchstart followed by a touchend is not considered to be a click. + * @param {Number} [params.dblClickThreshold=450] Threshold, in milliseconds beyond which two successive tap events are not considered to be a click. + * @param {Boolean} [params.smartClicks=false] If true, won't fire click events if the mouse has moved between mousedown and mouseup. Note that this functionality + * requires that Mottle consume the mousedown event, and so may not be viable in all use cases. + */ + root.Mottle = function (params) { + params = params || {}; + var clickThreshold = params.clickThreshold || 250, + dblClickThreshold = params.dblClickThreshold || 450, + mouseEnterExitHandler = new MouseEnterExitHandler(), + tapHandler = new TapHandler(clickThreshold, dblClickThreshold), + _smartClicks = params.smartClicks, + _doBind = function (obj, evt, fn, children) { + if (fn == null) return; + _each(obj, function () { + var _el = _gel(this); + if (_smartClicks && evt === "click") + SmartClickHandler(_el, evt, fn, children); + else if (evt === "tap" || evt === "dbltap" || evt === "contextmenu") { + tapHandler(_el, evt, fn, children); + } + else if (evt === "mouseenter" || evt == "mouseexit") + mouseEnterExitHandler(_el, evt, fn, children); + else + DefaultHandler(_el, evt, fn, children); + }); + }; + + /** + * Removes an element from the DOM, and deregisters all event handlers for it. You should use this + * to ensure you don't leak memory. + * @method remove + * @param {String|Element} el Element, or id of the element, to remove. + * @return {Mottle} The current Mottle instance; you can chain this method. + */ + this.remove = function (el) { + _each(el, function () { + var _el = _gel(this); + if (_el.__ta) { + for (var evt in _el.__ta) { + if (_el.__ta.hasOwnProperty(evt)) { + for (var h in _el.__ta[evt]) { + if (_el.__ta[evt].hasOwnProperty(h)) + _unbind(_el, evt, _el.__ta[evt][h]); + } + } + } + } + _el.parentNode && _el.parentNode.removeChild(_el); + }); + return this; + }; + + /** + * Register an event handler, optionally as a delegate for some set of descendant elements. Note + * that this method takes either 3 or 4 arguments - if you supply 3 arguments it is assumed you have + * omitted the `children` parameter, and that the event handler should be bound directly to the given element. + * @method on + * @param {Element[]|Element|String} el Either an Element, or a CSS spec for a list of elements, or an array of Elements. + * @param {String} [children] Comma-delimited list of selectors identifying allowed children. + * @param {String} event Event ID. + * @param {Function} fn Event handler function. + * @return {Mottle} The current Mottle instance; you can chain this method. + */ + this.on = function (el, event, children, fn) { + var _el = arguments[0], + _c = arguments.length == 4 ? arguments[2] : null, + _e = arguments[1], + _f = arguments[arguments.length - 1]; + + _doBind(_el, _e, _f, _c); + return this; + }; + + /** + * Cancel delegate event handling for the given function. Note that unlike with 'on' you do not supply + * a list of child selectors here: it removes event delegation from all of the child selectors for which the + * given function was registered (if any). + * @method off + * @param {Element[]|Element|String} el Element - or ID of element - from which to remove event listener. + * @param {String} event Event ID. + * @param {Function} fn Event handler function. + * @return {Mottle} The current Mottle instance; you can chain this method. + */ + this.off = function (el, event, fn) { + _unbind(el, event, fn); + return this; + }; + + /** + * Triggers some event for a given element. + * @method trigger + * @param {Element} el Element for which to trigger the event. + * @param {String} event Event ID. + * @param {Event} originalEvent The original event. Should be optional of course, but currently is not, due + * to the jsPlumb use case that caused this method to be added. + * @param {Object} [payload] Optional object to set as `payload` on the generated event; useful for message passing. + * @return {Mottle} The current Mottle instance; you can chain this method. + */ + this.trigger = function (el, event, originalEvent, payload) { + // MouseEvent undefined in old IE; that's how we know it's a mouse event. A fine Microsoft paradox. + var originalIsMouse = isMouseDevice && (typeof MouseEvent === "undefined" || originalEvent == null || originalEvent.constructor === MouseEvent); + + var eventToBind = (isTouchDevice && !isMouseDevice && touchMap[event]) ? touchMap[event] : event, + bindingAMouseEvent = !(isTouchDevice && !isMouseDevice && touchMap[event]); + + var pl = _pageLocation(originalEvent), sl = _screenLocation(originalEvent), cl = _clientLocation(originalEvent); + _each(el, function () { + var _el = _gel(this), evt; + originalEvent = originalEvent || { + screenX: sl[0], + screenY: sl[1], + clientX: cl[0], + clientY: cl[1] + }; + + var _decorate = function (_evt) { + if (payload) _evt.payload = payload; + }; + + var eventGenerators = { + "TouchEvent": function (evt) { + + var touchList = _touchAndList(window, _el, 0, pl[0], pl[1], sl[0], sl[1], cl[0], cl[1]), + init = evt.initTouchEvent || evt.initEvent; + + init(eventToBind, true, true, window, null, sl[0], sl[1], + cl[0], cl[1], false, false, false, false, + touchList, touchList, touchList, 1, 0); + }, + "MouseEvents": function (evt) { + evt.initMouseEvent(eventToBind, true, true, window, 0, + sl[0], sl[1], + cl[0], cl[1], + false, false, false, false, 1, _el); + } + }; + + if (document.createEvent) { + + var ite = !bindingAMouseEvent && !originalIsMouse && (isTouchDevice && touchMap[event]), + evtName = ite ? "TouchEvent" : "MouseEvents"; + + evt = document.createEvent(evtName); + eventGenerators[evtName](evt); + _decorate(evt); + _el.dispatchEvent(evt); + } + else if (document.createEventObject) { + evt = document.createEventObject(); + evt.eventType = evt.eventName = eventToBind; + evt.screenX = sl[0]; + evt.screenY = sl[1]; + evt.clientX = cl[0]; + evt.clientY = cl[1]; + _decorate(evt); + _el.fireEvent('on' + eventToBind, evt); + } + }); + return this; + } + }; + + /** + * Static method to assist in 'consuming' an element: uses `stopPropagation` where available, or sets + * `e.returnValue=false` where it is not. + * @method Mottle.consume + * @param {Event} e Event to consume + * @param {Boolean} [doNotPreventDefault=false] If true, does not call `preventDefault()` on the event. + */ + root.Mottle.consume = function (e, doNotPreventDefault) { + if (e.stopPropagation) + e.stopPropagation(); + else + e.returnValue = false; + + if (!doNotPreventDefault && e.preventDefault) + e.preventDefault(); + }; + + /** + * Gets the page location corresponding to the given event. For touch events this means get the page location of the first touch. + * @method Mottle.pageLocation + * @param {Event} e Event to get page location for. + * @return {Number[]} [left, top] for the given event. + */ + root.Mottle.pageLocation = _pageLocation; + + /** + * Forces touch events to be turned "on". Useful for testing: even if you don't have a touch device, you can still + * trigger a touch event when this is switched on and it will be captured and acted on. + * @method setForceTouchEvents + * @param {Boolean} value If true, force touch events to be on. + */ + root.Mottle.setForceTouchEvents = function (value) { + isTouchDevice = value; + }; + + /** + * Forces mouse events to be turned "on". Useful for testing: even if you don't have a mouse, you can still + * trigger a mouse event when this is switched on and it will be captured and acted on. + * @method setForceMouseEvents + * @param {Boolean} value If true, force mouse events to be on. + */ + root.Mottle.setForceMouseEvents = function (value) { + isMouseDevice = value; + }; + + root.Mottle.version = "0.8.0"; + + if (typeof exports !== "undefined") { + exports.Mottle = root.Mottle; + } + +}).call(typeof window === "undefined" ? this : window); + +/** + drag/drop functionality for use with jsPlumb but with + no knowledge of jsPlumb. supports multiple scopes (separated by whitespace), dragging + multiple elements, constrain to parent, drop filters, drag start filters, custom + css classes. + + a lot of the functionality of this script is expected to be plugged in: + + addClass + removeClass + + addEvent + removeEvent + + getPosition + setPosition + getSize + + indexOf + intersects + + the name came from here: + + http://mrsharpoblunto.github.io/foswig.js/ + + copyright 2016 jsPlumb + */ + +;(function() { + + "use strict"; + var root = this; + + var _suggest = function(list, item, head) { + if (list.indexOf(item) === -1) { + head ? list.unshift(item) : list.push(item); + return true; + } + return false; + }; + + var _vanquish = function(list, item) { + var idx = list.indexOf(item); + if (idx !== -1) list.splice(idx, 1); + }; + + var _difference = function(l1, l2) { + var d = []; + for (var i = 0; i < l1.length; i++) { + if (l2.indexOf(l1[i]) === -1) + d.push(l1[i]); + } + return d; + }; + + var _isString = function(f) { + return f == null ? false : (typeof f === "string" || f.constructor === String); + }; + + var getOffsetRect = function (elem) { + // (1) + var box = elem.getBoundingClientRect(), + body = document.body, + docElem = document.documentElement, + // (2) + scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop, + scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft, + // (3) + clientTop = docElem.clientTop || body.clientTop || 0, + clientLeft = docElem.clientLeft || body.clientLeft || 0, + // (4) + top = box.top + scrollTop - clientTop, + left = box.left + scrollLeft - clientLeft; + + return { top: Math.round(top), left: Math.round(left) }; + }; + + var matchesSelector = function(el, selector, ctx) { + ctx = ctx || el.parentNode; + var possibles = ctx.querySelectorAll(selector); + for (var i = 0; i < possibles.length; i++) { + if (possibles[i] === el) + return true; + } + return false; + }; + + var findDelegateElement = function(parentElement, childElement, selector) { + if (matchesSelector(childElement, selector, parentElement)) { + return childElement; + } else { + var currentParent = childElement.parentNode; + while (currentParent != null && currentParent !== parentElement) { + if (matchesSelector(currentParent, selector, parentElement)) { + return currentParent; + } else { + currentParent = currentParent.parentNode; + } + } + } + }; + + /** + * Finds all elements matching the given selector, for the given parent. In order to support "scoped root" selectors, + * ie. things like "> .someClass", that is .someClass elements that are direct children of `parentElement`, we have to + * jump through a small hoop here: when a delegate draggable is registered, we write a `katavorio-draggable` attribute + * on the element on which the draggable is registered. Then when this method runs, we grab the value of that attribute and + * prepend it as part of the selector we're looking for. So "> .someClass" ends up being written as + * "[katavorio-draggable='...' > .someClass]", which works with querySelectorAll. + * + * @param availableSelectors + * @param parentElement + * @param childElement + * @returns {*} + */ + var findMatchingSelector = function(availableSelectors, parentElement, childElement) { + var el = null; + var draggableId = parentElement.getAttribute("katavorio-draggable"), + prefix = draggableId != null ? "[katavorio-draggable='" + draggableId + "'] " : ""; + + for (var i = 0; i < availableSelectors.length; i++) { + el = findDelegateElement(parentElement, childElement, prefix + availableSelectors[i].selector); + if (el != null) { + return [ availableSelectors[i], el ]; + } + } + return null; + }; + + var iev = (function() { + var rv = -1; + if (navigator.appName === 'Microsoft Internet Explorer') { + var ua = navigator.userAgent, + re = new RegExp("MSIE ([0-9]{1,}[\.0-9]{0,})"); + if (re.exec(ua) != null) + rv = parseFloat(RegExp.$1); + } + return rv; + })(), + DEFAULT_GRID_X = 10, + DEFAULT_GRID_Y = 10, + isIELT9 = iev > -1 && iev < 9, + isIE9 = iev === 9, + _pl = function(e) { + if (isIELT9) { + return [ e.clientX + document.documentElement.scrollLeft, e.clientY + document.documentElement.scrollTop ]; + } + else { + var ts = _touches(e), t = _getTouch(ts, 0); + // for IE9 pageX might be null if the event was synthesized. We try for pageX/pageY first, + // falling back to clientX/clientY if necessary. In every other browser we want to use pageX/pageY. + return isIE9 ? [t.pageX || t.clientX, t.pageY || t.clientY] : [t.pageX, t.pageY]; + } + }, + _getTouch = function(touches, idx) { return touches.item ? touches.item(idx) : touches[idx]; }, + _touches = function(e) { + return e.touches && e.touches.length > 0 ? e.touches : + e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches : + e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches : + [ e ]; + }, + _classes = { + delegatedDraggable:"katavorio-delegated-draggable", // elements that are the delegated drag handler for a bunch of other elements + draggable:"katavorio-draggable", // draggable elements + droppable:"katavorio-droppable", // droppable elements + drag : "katavorio-drag", // elements currently being dragged + selected:"katavorio-drag-selected", // elements in current drag selection + active : "katavorio-drag-active", // droppables that are targets of a currently dragged element + hover : "katavorio-drag-hover", // droppables over which a matching drag element is hovering + noSelect : "katavorio-drag-no-select", // added to the body to provide a hook to suppress text selection + ghostProxy:"katavorio-ghost-proxy", // added to a ghost proxy element in use when a drag has exited the bounds of its parent. + clonedDrag:"katavorio-clone-drag" // added to a node that is a clone of an element created at the start of a drag + }, + _defaultScope = "katavorio-drag-scope", + _events = [ "stop", "start", "drag", "drop", "over", "out", "beforeStart" ], + _devNull = function() {}, + _true = function() { return true; }, + _foreach = function(l, fn, from) { + for (var i = 0; i < l.length; i++) { + if (l[i] != from) + fn(l[i]); + } + }, + _setDroppablesActive = function(dd, val, andHover, drag) { + _foreach(dd, function(e) { + e.setActive(val); + if (val) e.updatePosition(); + if (andHover) e.setHover(drag, val); + }); + }, + _each = function(obj, fn) { + if (obj == null) return; + obj = !_isString(obj) && (obj.tagName == null && obj.length != null) ? obj : [ obj ]; + for (var i = 0; i < obj.length; i++) + fn.apply(obj[i], [ obj[i] ]); + }, + _consume = function(e) { + if (e.stopPropagation) { + e.stopPropagation(); + e.preventDefault(); + } + else { + e.returnValue = false; + } + }, + _defaultInputFilterSelector = "input,textarea,select,button,option", + // + // filters out events on all input elements, like textarea, checkbox, input, select. + _inputFilter = function(e, el, _katavorio) { + var t = e.srcElement || e.target; + return !matchesSelector(t, _katavorio.getInputFilterSelector(), el); + }; + + var Super = function(el, params, css, scope) { + this.params = params || {}; + this.el = el; + this.params.addClass(this.el, this._class); + this.uuid = _uuid(); + var enabled = true; + this.setEnabled = function(e) { enabled = e; }; + this.isEnabled = function() { return enabled; }; + this.toggleEnabled = function() { enabled = !enabled; }; + this.setScope = function(scopes) { + this.scopes = scopes ? scopes.split(/\s+/) : [ scope ]; + }; + this.addScope = function(scopes) { + var m = {}; + _each(this.scopes, function(s) { m[s] = true;}); + _each(scopes ? scopes.split(/\s+/) : [], function(s) { m[s] = true;}); + this.scopes = []; + for (var i in m) this.scopes.push(i); + }; + this.removeScope = function(scopes) { + var m = {}; + _each(this.scopes, function(s) { m[s] = true;}); + _each(scopes ? scopes.split(/\s+/) : [], function(s) { delete m[s];}); + this.scopes = []; + for (var i in m) this.scopes.push(i); + }; + this.toggleScope = function(scopes) { + var m = {}; + _each(this.scopes, function(s) { m[s] = true;}); + _each(scopes ? scopes.split(/\s+/) : [], function(s) { + if (m[s]) delete m[s]; + else m[s] = true; + }); + this.scopes = []; + for (var i in m) this.scopes.push(i); + }; + this.setScope(params.scope); + this.k = params.katavorio; + return params.katavorio; + }; + + var TRUE = function() { return true; }; + var FALSE = function() { return false; }; + + var Drag = function(el, params, css, scope) { + this._class = css.draggable; + var k = Super.apply(this, arguments); + this.rightButtonCanDrag = this.params.rightButtonCanDrag; + var downAt = [0,0], posAtDown = null, pagePosAtDown = null, pageDelta = [0,0], moving = false, initialScroll = [0,0], + consumeStartEvent = this.params.consumeStartEvent !== false, + dragEl = this.el, + clone = this.params.clone, + scroll = this.params.scroll, + _multipleDrop = params.multipleDrop !== false, + isConstrained = false, + useGhostProxy = params.ghostProxy === true ? TRUE : params.ghostProxy && typeof params.ghostProxy === "function" ? params.ghostProxy : FALSE, + ghostProxy = function(el) { return el.cloneNode(true); }, + elementToDrag = null, + availableSelectors = [], + activeSelectorParams = null, // which, if any, selector config is currently active. + ghostProxyParent = params.ghostProxyParent, + currentParentPosition, + ghostParentPosition, + ghostDx, + ghostDy; + + // if an initial selector was provided, push the entire set of params as a selector config. + if (params.selector) { + var draggableId = el.getAttribute("katavorio-draggable"); + if (draggableId == null) { + draggableId = "" + new Date().getTime(); + el.setAttribute("katavorio-draggable", draggableId); + } + + availableSelectors.push(params); + } + + var snapThreshold = params.snapThreshold, + _snap = function(pos, gridX, gridY, thresholdX, thresholdY) { + var _dx = Math.floor(pos[0] / gridX), + _dxl = gridX * _dx, + _dxt = _dxl + gridX, + _x = Math.abs(pos[0] - _dxl) <= thresholdX ? _dxl : Math.abs(_dxt - pos[0]) <= thresholdX ? _dxt : pos[0]; + + var _dy = Math.floor(pos[1] / gridY), + _dyl = gridY * _dy, + _dyt = _dyl + gridY, + _y = Math.abs(pos[1] - _dyl) <= thresholdY ? _dyl : Math.abs(_dyt - pos[1]) <= thresholdY ? _dyt : pos[1]; + + return [ _x, _y]; + }; + + this.posses = []; + this.posseRoles = {}; + + this.toGrid = function(pos) { + if (this.params.grid == null) { + return pos; + } + else { + var tx = this.params.grid ? this.params.grid[0] / 2 : snapThreshold ? snapThreshold : DEFAULT_GRID_X / 2, + ty = this.params.grid ? this.params.grid[1] / 2 : snapThreshold ? snapThreshold : DEFAULT_GRID_Y / 2; + + return _snap(pos, this.params.grid[0], this.params.grid[1], tx, ty); + } + }; + + this.snap = function(x, y) { + if (dragEl == null) return; + x = x || (this.params.grid ? this.params.grid[0] : DEFAULT_GRID_X); + y = y || (this.params.grid ? this.params.grid[1] : DEFAULT_GRID_Y); + var p = this.params.getPosition(dragEl), + tx = this.params.grid ? this.params.grid[0] / 2 : snapThreshold, + ty = this.params.grid ? this.params.grid[1] / 2 : snapThreshold; + + this.params.setPosition(dragEl, _snap(p, x, y, tx, ty)); + }; + + this.setUseGhostProxy = function(val) { + useGhostProxy = val ? TRUE : FALSE; + }; + + var constrain; + var negativeFilter = function(pos) { + return (params.allowNegative === false) ? [ Math.max (0, pos[0]), Math.max(0, pos[1]) ] : pos; + }; + + var _setConstrain = function(value) { + constrain = typeof value === "function" ? value : value ? function(pos, dragEl, _constrainRect, _size) { + return negativeFilter([ + Math.max(0, Math.min(_constrainRect.w - _size[0], pos[0])), + Math.max(0, Math.min(_constrainRect.h - _size[1], pos[1])) + ]); + }.bind(this) : function(pos) { return negativeFilter(pos); }; + }.bind(this); + + _setConstrain(typeof this.params.constrain === "function" ? this.params.constrain : (this.params.constrain || this.params.containment)); + + + /** + * Sets whether or not the Drag is constrained. A value of 'true' means constrain to parent bounds; a function + * will be executed and returns true if the position is allowed. + * @param value + */ + this.setConstrain = function(value) { + _setConstrain(value); + }; + + var revertFunction; + /** + * Sets a function to call on drag stop, which, if it returns true, indicates that the given element should + * revert to its position before the previous drag. + * @param fn + */ + this.setRevert = function(fn) { + revertFunction = fn; + }; + + if (this.params.revert) { + revertFunction = this.params.revert; + } + + var _assignId = function(obj) { + if (typeof obj === "function") { + obj._katavorioId = _uuid(); + return obj._katavorioId; + } else { + return obj; + } + }, + // a map of { spec -> [ fn, exclusion ] } entries. + _filters = {}, + _testFilter = function(e) { + for (var key in _filters) { + var f = _filters[key]; + var rv = f[0](e); + if (f[1]) rv = !rv; + if (!rv) return false; + } + return true; + }, + _setFilter = this.setFilter = function(f, _exclude) { + if (f) { + var key = _assignId(f); + _filters[key] = [ + function(e) { + var t = e.srcElement || e.target, m; + if (_isString(f)) { + m = matchesSelector(t, f, el); + } + else if (typeof f === "function") { + m = f(e, el); + } + return m; + }, + _exclude !== false + ]; + + } + }, + _addFilter = this.addFilter = _setFilter, + _removeFilter = this.removeFilter = function(f) { + var key = typeof f === "function" ? f._katavorioId : f; + delete _filters[key]; + }; + + this.clearAllFilters = function() { + _filters = {}; + }; + + this.canDrag = this.params.canDrag || _true; + + var constrainRect, + matchingDroppables = [], + intersectingDroppables = []; + + this.addSelector = function(params) { + if (params.selector) { + availableSelectors.push(params); + } + }; + + this.downListener = function(e) { + if (e.defaultPrevented) { return; } + var isNotRightClick = this.rightButtonCanDrag || (e.which !== 3 && e.button !== 2); + if (isNotRightClick && this.isEnabled() && this.canDrag()) { + + var _f = _testFilter(e) && _inputFilter(e, this.el, this.k); + if (_f) { + + activeSelectorParams = null; + elementToDrag = null; + + // if (selector) { + // elementToDrag = findDelegateElement(this.el, e.target || e.srcElement, selector); + // if(elementToDrag == null) { + // return; + // } + // } + if (availableSelectors.length > 0) { + var match = findMatchingSelector(availableSelectors, this.el, e.target || e.srcElement); + if (match != null) { + activeSelectorParams = match[0]; + elementToDrag = match[1]; + } + // elementToDrag = findDelegateElement(this.el, e.target || e.srcElement, selector); + if(elementToDrag == null) { + return; + } + } + else { + elementToDrag = this.el; + } + + if (clone) { + dragEl = elementToDrag.cloneNode(true); + this.params.addClass(dragEl, _classes.clonedDrag); + + dragEl.setAttribute("id", null); + dragEl.style.position = "absolute"; + + if (this.params.parent != null) { + var p = this.params.getPosition(this.el); + dragEl.style.left = p[0] + "px"; + dragEl.style.top = p[1] + "px"; + this.params.parent.appendChild(dragEl); + } else { + // the clone node is added to the body; getOffsetRect gives us a value + // relative to the body. + var b = getOffsetRect(elementToDrag); + dragEl.style.left = b.left + "px"; + dragEl.style.top = b.top + "px"; + + document.body.appendChild(dragEl); + } + + } else { + dragEl = elementToDrag; + } + + consumeStartEvent && _consume(e); + downAt = _pl(e); + if (dragEl && dragEl.parentNode) + { + initialScroll = [dragEl.parentNode.scrollLeft, dragEl.parentNode.scrollTop]; + } + // + this.params.bind(document, "mousemove", this.moveListener); + this.params.bind(document, "mouseup", this.upListener); + k.markSelection(this); + k.markPosses(this); + this.params.addClass(document.body, css.noSelect); + _dispatch("beforeStart", {el:this.el, pos:posAtDown, e:e, drag:this}); + } + else if (this.params.consumeFilteredEvents) { + _consume(e); + } + } + }.bind(this); + + this.moveListener = function(e) { + if (downAt) { + if (!moving) { + var _continue = _dispatch("start", {el:this.el, pos:posAtDown, e:e, drag:this}); + if (_continue !== false) { + if (!downAt) { + return; + } + this.mark(true); + moving = true; + } else { + this.abort(); + } + } + + // it is possible that the start event caused the drag to be aborted. So we check + // again that we are currently dragging. + if (downAt) { + intersectingDroppables.length = 0; + var pos = _pl(e), dx = pos[0] - downAt[0], dy = pos[1] - downAt[1], + z = this.params.ignoreZoom ? 1 : k.getZoom(); + if (dragEl && dragEl.parentNode) + { + dx += dragEl.parentNode.scrollLeft - initialScroll[0]; + dy += dragEl.parentNode.scrollTop - initialScroll[1]; + } + dx /= z; + dy /= z; + this.moveBy(dx, dy, e); + k.updateSelection(dx, dy, this); + k.updatePosses(dx, dy, this); + } + } + }.bind(this); + + this.upListener = function(e) { + if (downAt) { + downAt = null; + this.params.unbind(document, "mousemove", this.moveListener); + this.params.unbind(document, "mouseup", this.upListener); + this.params.removeClass(document.body, css.noSelect); + this.unmark(e); + k.unmarkSelection(this, e); + k.unmarkPosses(this, e); + this.stop(e); + + k.notifyPosseDragStop(this, e); + moving = false; + intersectingDroppables.length = 0; + + if (clone) { + dragEl && dragEl.parentNode && dragEl.parentNode.removeChild(dragEl); + dragEl = null; + } else { + if (revertFunction && revertFunction(dragEl, this.params.getPosition(dragEl)) === true) { + this.params.setPosition(dragEl, posAtDown); + _dispatch("revert", dragEl); + } + } + + } + }.bind(this); + + this.getFilters = function() { return _filters; }; + + this.abort = function() { + if (downAt != null) { + this.upListener(); + } + }; + + /** + * Returns the element that was last dragged. This may be some original element from the DOM, or if `clone` is + * set, then its actually a copy of some original DOM element. In some client calls to this method, it is the + * actual element that was dragged that is desired. In others, it is the original DOM element that the user + * wishes to get - in which case, pass true for `retrieveOriginalElement`. + * + * @returns {*} + */ + this.getDragElement = function(retrieveOriginalElement) { + return retrieveOriginalElement ? elementToDrag || this.el : dragEl || this.el; + }; + + var listeners = {"start":[], "drag":[], "stop":[], "over":[], "out":[], "beforeStart":[], "revert":[] }; + if (params.events.start) listeners.start.push(params.events.start); + if (params.events.beforeStart) listeners.beforeStart.push(params.events.beforeStart); + if (params.events.stop) listeners.stop.push(params.events.stop); + if (params.events.drag) listeners.drag.push(params.events.drag); + if (params.events.revert) listeners.revert.push(params.events.revert); + + this.on = function(evt, fn) { + if (listeners[evt]) listeners[evt].push(fn); + }; + + this.off = function(evt, fn) { + if (listeners[evt]) { + var l = []; + for (var i = 0; i < listeners[evt].length; i++) { + if (listeners[evt][i] !== fn) l.push(listeners[evt][i]); + } + listeners[evt] = l; + } + }; + + var _dispatch = function(evt, value) { + var result = null; + if (activeSelectorParams && activeSelectorParams[evt]) { + activeSelectorParams[evt](value); + } else if (listeners[evt]) { + for (var i = 0; i < listeners[evt].length; i++) { + try { + var v = listeners[evt][i](value); + if (v != null) { + result = v; + } + } + catch (e) { } + } + } + return result; + }; + + this.notifyStart = function(e) { + _dispatch("start", {el:this.el, pos:this.params.getPosition(dragEl), e:e, drag:this}); + }; + + this.stop = function(e, force) { + if (force || moving) { + var positions = [], + sel = k.getSelection(), + dPos = this.params.getPosition(dragEl); + + if (sel.length > 0) { + for (var i = 0; i < sel.length; i++) { + var p = this.params.getPosition(sel[i].el); + positions.push([ sel[i].el, { left: p[0], top: p[1] }, sel[i] ]); + } + } + else { + positions.push([ dragEl, {left:dPos[0], top:dPos[1]}, this ]); + } + + _dispatch("stop", { + el: dragEl, + pos: ghostProxyOffsets || dPos, + finalPos:dPos, + e: e, + drag: this, + selection:positions + }); + } + }; + + this.mark = function(andNotify) { + posAtDown = this.params.getPosition(dragEl); + pagePosAtDown = this.params.getPosition(dragEl, true); + pageDelta = [pagePosAtDown[0] - posAtDown[0], pagePosAtDown[1] - posAtDown[1]]; + this.size = this.params.getSize(dragEl); + matchingDroppables = k.getMatchingDroppables(this); + _setDroppablesActive(matchingDroppables, true, false, this); + this.params.addClass(dragEl, this.params.dragClass || css.drag); + + var cs; + if (this.params.getConstrainingRectangle) { + cs = this.params.getConstrainingRectangle(dragEl) + } else { + cs = this.params.getSize(dragEl.parentNode); + } + constrainRect = {w: cs[0], h: cs[1]}; + + ghostDx = 0; + ghostDy = 0; + + if (andNotify) { + k.notifySelectionDragStart(this); + } + }; + var ghostProxyOffsets; + this.unmark = function(e, doNotCheckDroppables) { + _setDroppablesActive(matchingDroppables, false, true, this); + + if (isConstrained && useGhostProxy(elementToDrag)) { + ghostProxyOffsets = [dragEl.offsetLeft - ghostDx, dragEl.offsetTop - ghostDy]; + dragEl.parentNode.removeChild(dragEl); + dragEl = elementToDrag; + } + else { + ghostProxyOffsets = null; + } + + this.params.removeClass(dragEl, this.params.dragClass || css.drag); + matchingDroppables.length = 0; + isConstrained = false; + if (!doNotCheckDroppables) { + if (intersectingDroppables.length > 0 && ghostProxyOffsets) { + params.setPosition(elementToDrag, ghostProxyOffsets); + } + intersectingDroppables.sort(_rankSort); + for (var i = 0; i < intersectingDroppables.length; i++) { + var retVal = intersectingDroppables[i].drop(this, e); + if (retVal === true) break; + } + } + }; + this.moveBy = function(dx, dy, e) { + intersectingDroppables.length = 0; + + var desiredLoc = this.toGrid([posAtDown[0] + dx, posAtDown[1] + dy]), + cPos = constrain(desiredLoc, dragEl, constrainRect, this.size); + + // if we should use a ghost proxy... + if (useGhostProxy(this.el)) { + // and the element has been dragged outside of its parent bounds + if (desiredLoc[0] !== cPos[0] || desiredLoc[1] !== cPos[1]) { + + // ...if ghost proxy not yet created + if (!isConstrained) { + // create it + var gp = ghostProxy(elementToDrag); + params.addClass(gp, _classes.ghostProxy); + + if (ghostProxyParent) { + ghostProxyParent.appendChild(gp); + // find offset between drag el's parent the ghost parent + currentParentPosition = params.getPosition(elementToDrag.parentNode, true); + ghostParentPosition = params.getPosition(params.ghostProxyParent, true); + ghostDx = currentParentPosition[0] - ghostParentPosition[0]; + ghostDy = currentParentPosition[1] - ghostParentPosition[1]; + + } else { + elementToDrag.parentNode.appendChild(gp); + } + + // the ghost proxy is the drag element + dragEl = gp; + // set this flag so we dont recreate the ghost proxy + isConstrained = true; + } + // now the drag position can be the desired position, as the ghost proxy can support it. + cPos = desiredLoc; + } + else { + // if the element is not outside of its parent bounds, and ghost proxy is in place, + if (isConstrained) { + // remove the ghost proxy from the dom + dragEl.parentNode.removeChild(dragEl); + // reset the drag element to the original element + dragEl = elementToDrag; + // clear this flag. + isConstrained = false; + currentParentPosition = null; + ghostParentPosition = null; + ghostDx = 0; + ghostDy = 0; + } + } + } + + var rect = { x:cPos[0], y:cPos[1], w:this.size[0], h:this.size[1]}, + pageRect = { x:rect.x + pageDelta[0], y:rect.y + pageDelta[1], w:rect.w, h:rect.h}, + focusDropElement = null; + + this.params.setPosition(dragEl, [cPos[0] + ghostDx, cPos[1] + ghostDy]); + + for (var i = 0; i < matchingDroppables.length; i++) { + var r2 = { x:matchingDroppables[i].pagePosition[0], y:matchingDroppables[i].pagePosition[1], w:matchingDroppables[i].size[0], h:matchingDroppables[i].size[1]}; + if (this.params.intersects(pageRect, r2) && (_multipleDrop || focusDropElement == null || focusDropElement === matchingDroppables[i].el) && matchingDroppables[i].canDrop(this)) { + if (!focusDropElement) focusDropElement = matchingDroppables[i].el; + intersectingDroppables.push(matchingDroppables[i]); + matchingDroppables[i].setHover(this, true, e); + } + else if (matchingDroppables[i].isHover()) { + matchingDroppables[i].setHover(this, false, e); + } + } + + _dispatch("drag", {el:this.el, pos:cPos, e:e, drag:this}); + + /* test to see if the parent needs to be scrolled (future) + if (scroll) { + var pnsl = dragEl.parentNode.scrollLeft, pnst = dragEl.parentNode.scrollTop; + console.log("scroll!", pnsl, pnst); + }*/ + }; + this.destroy = function() { + this.params.unbind(this.el, "mousedown", this.downListener); + this.params.unbind(document, "mousemove", this.moveListener); + this.params.unbind(document, "mouseup", this.upListener); + this.downListener = null; + this.upListener = null; + this.moveListener = null; + }; + + // init:register mousedown, and perhaps set a filter + this.params.bind(this.el, "mousedown", this.downListener); + + // if handle provided, use that. otherwise, try to set a filter. + // note that a `handle` selector always results in filterExclude being set to false, ie. + // the selector defines the handle element(s). + if (this.params.handle) + _setFilter(this.params.handle, false); + else + _setFilter(this.params.filter, this.params.filterExclude); + }; + + var Drop = function(el, params, css, scope) { + this._class = css.droppable; + this.params = params || {}; + this.rank = params.rank || 0; + this._activeClass = this.params.activeClass || css.active; + this._hoverClass = this.params.hoverClass || css.hover; + Super.apply(this, arguments); + var hover = false; + this.allowLoopback = this.params.allowLoopback !== false; + + this.setActive = function(val) { + this.params[val ? "addClass" : "removeClass"](this.el, this._activeClass); + }; + + this.updatePosition = function() { + this.position = this.params.getPosition(this.el); + this.pagePosition = this.params.getPosition(this.el, true); + this.size = this.params.getSize(this.el); + }; + + this.canDrop = this.params.canDrop || function(drag) { + return true; + }; + + this.isHover = function() { return hover; }; + + this.setHover = function(drag, val, e) { + // if turning off hover but this was not the drag that caused the hover, ignore. + if (val || this.el._katavorioDragHover == null || this.el._katavorioDragHover === drag.el._katavorio) { + this.params[val ? "addClass" : "removeClass"](this.el, this._hoverClass); + this.el._katavorioDragHover = val ? drag.el._katavorio : null; + if (hover !== val) { + this.params.events[val ? "over" : "out"]({el: this.el, e: e, drag: drag, drop: this}); + } + hover = val; + } + }; + + /** + * A drop event. `drag` is the corresponding Drag object, which may be a Drag for some specific element, or it + * may be a Drag on some element acting as a delegate for elements contained within it. + * @param drag + * @param event + * @returns {*} + */ + this.drop = function(drag, event) { + return this.params.events["drop"]({ drag:drag, e:event, drop:this }); + }; + + this.destroy = function() { + this._class = null; + this._activeClass = null; + this._hoverClass = null; + hover = null; + }; + }; + + var _uuid = function() { + return ('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function(c) { + var r = Math.random()*16|0, v = c === 'x' ? r : (r&0x3|0x8); + return v.toString(16); + })); + }; + + var _rankSort = function(a,b) { + return a.rank < b.rank ? 1 : a.rank > b.rank ? -1 : 0; + }; + + var _gel = function(el) { + if (el == null) return null; + el = (typeof el === "string" || el.constructor === String) ? document.getElementById(el) : el; + if (el == null) return null; + el._katavorio = el._katavorio || _uuid(); + return el; + }; + + root.Katavorio = function(katavorioParams) { + + var _selection = [], + _selectionMap = {}; + + this._dragsByScope = {}; + this._dropsByScope = {}; + var _zoom = 1, + _reg = function(obj, map) { + _each(obj, function(_obj) { + for(var i = 0; i < _obj.scopes.length; i++) { + map[_obj.scopes[i]] = map[_obj.scopes[i]] || []; + map[_obj.scopes[i]].push(_obj); + } + }); + }, + _unreg = function(obj, map) { + var c = 0; + _each(obj, function(_obj) { + for(var i = 0; i < _obj.scopes.length; i++) { + if (map[_obj.scopes[i]]) { + var idx = katavorioParams.indexOf(map[_obj.scopes[i]], _obj); + if (idx !== -1) { + map[_obj.scopes[i]].splice(idx, 1); + c++; + } + } + } + }); + + return c > 0 ; + }, + _getMatchingDroppables = this.getMatchingDroppables = function(drag) { + var dd = [], _m = {}; + for (var i = 0; i < drag.scopes.length; i++) { + var _dd = this._dropsByScope[drag.scopes[i]]; + if (_dd) { + for (var j = 0; j < _dd.length; j++) { + if (_dd[j].canDrop(drag) && !_m[_dd[j].uuid] && (_dd[j].allowLoopback || _dd[j].el !== drag.el)) { + _m[_dd[j].uuid] = true; + dd.push(_dd[j]); + } + } + } + } + dd.sort(_rankSort); + return dd; + }, + _prepareParams = function(p) { + p = p || {}; + var _p = { + events:{} + }, i; + for (i in katavorioParams) _p[i] = katavorioParams[i]; + for (i in p) _p[i] = p[i]; + // events + + for (i = 0; i < _events.length; i++) { + _p.events[_events[i]] = p[_events[i]] || _devNull; + } + _p.katavorio = this; + return _p; + }.bind(this), + _mistletoe = function(existingDrag, params) { + for (var i = 0; i < _events.length; i++) { + if (params[_events[i]]) { + existingDrag.on(_events[i], params[_events[i]]); + } + } + }.bind(this), + _css = {}, + overrideCss = katavorioParams.css || {}, + _scope = katavorioParams.scope || _defaultScope; + + // prepare map of css classes based on defaults frst, then optional overrides + for (var i in _classes) _css[i] = _classes[i]; + for (var i in overrideCss) _css[i] = overrideCss[i]; + + var inputFilterSelector = katavorioParams.inputFilterSelector || _defaultInputFilterSelector; + /** + * Gets the selector identifying which input elements to filter from drag events. + * @method getInputFilterSelector + * @return {String} Current input filter selector. + */ + this.getInputFilterSelector = function() { return inputFilterSelector; }; + + /** + * Sets the selector identifying which input elements to filter from drag events. + * @method setInputFilterSelector + * @param {String} selector Input filter selector to set. + * @return {Katavorio} Current instance; method may be chained. + */ + this.setInputFilterSelector = function(selector) { + inputFilterSelector = selector; + return this; + }; + + /** + * Either makes the given element draggable, or identifies it as an element inside which some identified list + * of elements may be draggable. + * @param el + * @param params + * @returns {Array} + */ + this.draggable = function(el, params) { + var o = []; + _each(el, function (_el) { + _el = _gel(_el); + if (_el != null) { + if (_el._katavorioDrag == null) { + var p = _prepareParams(params); + _el._katavorioDrag = new Drag(_el, p, _css, _scope); + _reg(_el._katavorioDrag, this._dragsByScope); + o.push(_el._katavorioDrag); + katavorioParams.addClass(_el, p.selector ? _css.delegatedDraggable : _css.draggable); + } + else { + _mistletoe(_el._katavorioDrag, params); + } + } + }.bind(this)); + return o; + }; + + this.droppable = function(el, params) { + var o = []; + _each(el, function(_el) { + _el = _gel(_el); + if (_el != null) { + var drop = new Drop(_el, _prepareParams(params), _css, _scope); + _el._katavorioDrop = _el._katavorioDrop || []; + _el._katavorioDrop.push(drop); + _reg(drop, this._dropsByScope); + o.push(drop); + katavorioParams.addClass(_el, _css.droppable); + } + }.bind(this)); + return o; + }; + + /** + * @name Katavorio#select + * @function + * @desc Adds an element to the current selection (for multiple node drag) + * @param {Element|String} DOM element - or id of the element - to add. + */ + this.select = function(el) { + _each(el, function() { + var _el = _gel(this); + if (_el && _el._katavorioDrag) { + if (!_selectionMap[_el._katavorio]) { + _selection.push(_el._katavorioDrag); + _selectionMap[_el._katavorio] = [ _el, _selection.length - 1 ]; + katavorioParams.addClass(_el, _css.selected); + } + } + }); + return this; + }; + + /** + * @name Katavorio#deselect + * @function + * @desc Removes an element from the current selection (for multiple node drag) + * @param {Element|String} DOM element - or id of the element - to remove. + */ + this.deselect = function(el) { + _each(el, function() { + var _el = _gel(this); + if (_el && _el._katavorio) { + var e = _selectionMap[_el._katavorio]; + if (e) { + var _s = []; + for (var i = 0; i < _selection.length; i++) + if (_selection[i].el !== _el) _s.push(_selection[i]); + _selection = _s; + delete _selectionMap[_el._katavorio]; + katavorioParams.removeClass(_el, _css.selected); + } + } + }); + return this; + }; + + this.deselectAll = function() { + for (var i in _selectionMap) { + var d = _selectionMap[i]; + katavorioParams.removeClass(d[0], _css.selected); + } + + _selection.length = 0; + _selectionMap = {}; + }; + + this.markSelection = function(drag) { + _foreach(_selection, function(e) { e.mark(); }, drag); + }; + + this.markPosses = function(drag) { + if (drag.posses) { + _each(drag.posses, function(p) { + if (drag.posseRoles[p] && _posses[p]) { + _foreach(_posses[p].members, function (d) { + d.mark(); + }, drag); + } + }) + } + }; + + this.unmarkSelection = function(drag, event) { + _foreach(_selection, function(e) { e.unmark(event); }, drag); + }; + + this.unmarkPosses = function(drag, event) { + if (drag.posses) { + _each(drag.posses, function(p) { + if (drag.posseRoles[p] && _posses[p]) { + _foreach(_posses[p].members, function (d) { + d.unmark(event, true); + }, drag); + } + }); + } + }; + + this.getSelection = function() { return _selection.slice(0); }; + + this.updateSelection = function(dx, dy, drag) { + _foreach(_selection, function(e) { e.moveBy(dx, dy); }, drag); + }; + + var _posseAction = function(fn, drag) { + if (drag.posses) { + _each(drag.posses, function(p) { + if (drag.posseRoles[p] && _posses[p]) { + _foreach(_posses[p].members, function (e) { + fn(e); + }, drag); + } + }); + } + }; + + this.updatePosses = function(dx, dy, drag) { + _posseAction(function(e) { e.moveBy(dx, dy); }, drag); + }; + + this.notifyPosseDragStop = function(drag, evt) { + _posseAction(function(e) { e.stop(evt, true); }, drag); + }; + + this.notifySelectionDragStop = function(drag, evt) { + _foreach(_selection, function(e) { e.stop(evt, true); }, drag); + }; + + this.notifySelectionDragStart = function(drag, evt) { + _foreach(_selection, function(e) { e.notifyStart(evt);}, drag); + }; + + this.setZoom = function(z) { _zoom = z; }; + this.getZoom = function() { return _zoom; }; + + // does the work of changing scopes + var _scopeManip = function(kObj, scopes, map, fn) { + _each(kObj, function(_kObj) { + _unreg(_kObj, map); // deregister existing scopes + _kObj[fn](scopes); // set scopes + _reg(_kObj, map); // register new ones + }); + }; + + _each([ "set", "add", "remove", "toggle"], function(v) { + this[v + "Scope"] = function(el, scopes) { + _scopeManip(el._katavorioDrag, scopes, this._dragsByScope, v + "Scope"); + _scopeManip(el._katavorioDrop, scopes, this._dropsByScope, v + "Scope"); + }.bind(this); + this[v + "DragScope"] = function(el, scopes) { + _scopeManip(el.constructor === Drag ? el : el._katavorioDrag, scopes, this._dragsByScope, v + "Scope"); + }.bind(this); + this[v + "DropScope"] = function(el, scopes) { + _scopeManip(el.constructor === Drop ? el : el._katavorioDrop, scopes, this._dropsByScope, v + "Scope"); + }.bind(this); + }.bind(this)); + + this.snapToGrid = function(x, y) { + for (var s in this._dragsByScope) { + _foreach(this._dragsByScope[s], function(d) { d.snap(x, y); }); + } + }; + + this.getDragsForScope = function(s) { return this._dragsByScope[s]; }; + this.getDropsForScope = function(s) { return this._dropsByScope[s]; }; + + var _destroy = function(el, type, map) { + el = _gel(el); + if (el[type]) { + + // remove from selection, if present. + var selIdx = _selection.indexOf(el[type]); + if (selIdx >= 0) { + _selection.splice(selIdx, 1); + } + + if (_unreg(el[type], map)) { + _each(el[type], function(kObj) { kObj.destroy() }); + } + + delete el[type]; + } + }; + + var _removeListener = function(el, type, evt, fn) { + el = _gel(el); + if (el[type]) { + el[type].off(evt, fn); + } + }; + + this.elementRemoved = function(el) { + this.destroyDraggable(el); + this.destroyDroppable(el); + }; + + /** + * Either completely remove drag functionality from the given element, or remove a specific event handler. If you + * call this method with a single argument - the element - all drag functionality is removed from it. Otherwise, if + * you provide an event name and listener function, this function is de-registered (if found). + * @param el Element to update + * @param {string} [evt] Optional event name to unsubscribe + * @param {Function} [fn] Optional function to unsubscribe + */ + this.destroyDraggable = function(el, evt, fn) { + if (arguments.length === 1) { + _destroy(el, "_katavorioDrag", this._dragsByScope); + } else { + _removeListener(el, "_katavorioDrag", evt, fn); + } + }; + + /** + * Either completely remove drop functionality from the given element, or remove a specific event handler. If you + * call this method with a single argument - the element - all drop functionality is removed from it. Otherwise, if + * you provide an event name and listener function, this function is de-registered (if found). + * @param el Element to update + * @param {string} [evt] Optional event name to unsubscribe + * @param {Function} [fn] Optional function to unsubscribe + */ + this.destroyDroppable = function(el, evt, fn) { + if (arguments.length === 1) { + _destroy(el, "_katavorioDrop", this._dropsByScope); + } else { + _removeListener(el, "_katavorioDrop", evt, fn); + } + }; + + this.reset = function() { + this._dragsByScope = {}; + this._dropsByScope = {}; + _selection = []; + _selectionMap = {}; + _posses = {}; + }; + + // ----- groups + var _posses = {}; + + var _processOneSpec = function(el, _spec, dontAddExisting) { + var posseId = _isString(_spec) ? _spec : _spec.id; + var active = _isString(_spec) ? true : _spec.active !== false; + var posse = _posses[posseId] || (function() { + var g = {name:posseId, members:[]}; + _posses[posseId] = g; + return g; + })(); + _each(el, function(_el) { + if (_el._katavorioDrag) { + + if (dontAddExisting && _el._katavorioDrag.posseRoles[posse.name] != null) return; + + _suggest(posse.members, _el._katavorioDrag); + _suggest(_el._katavorioDrag.posses, posse.name); + _el._katavorioDrag.posseRoles[posse.name] = active; + } + }); + return posse; + }; + + /** + * Add the given element to the posse with the given id, creating the group if it at first does not exist. + * @method addToPosse + * @param {Element} el Element to add. + * @param {String...|Object...} spec Variable args parameters. Each argument can be a either a String, indicating + * the ID of a Posse to which the element should be added as an active participant, or an Object containing + * `{ id:"posseId", active:false/true}`. In the latter case, if `active` is not provided it is assumed to be + * true. + * @returns {Posse|Posse[]} The Posse(s) to which the element(s) was/were added. + */ + this.addToPosse = function(el, spec) { + + var posses = []; + + for (var i = 1; i < arguments.length; i++) { + posses.push(_processOneSpec(el, arguments[i])); + } + + return posses.length === 1 ? posses[0] : posses; + }; + + /** + * Sets the posse(s) for the element with the given id, creating those that do not yet exist, and removing from + * the element any current Posses that are not specified by this method call. This method will not change the + * active/passive state if it is given a posse in which the element is already a member. + * @method setPosse + * @param {Element} el Element to set posse(s) on. + * @param {String...|Object...} spec Variable args parameters. Each argument can be a either a String, indicating + * the ID of a Posse to which the element should be added as an active participant, or an Object containing + * `{ id:"posseId", active:false/true}`. In the latter case, if `active` is not provided it is assumed to be + * true. + * @returns {Posse|Posse[]} The Posse(s) to which the element(s) now belongs. + */ + this.setPosse = function(el, spec) { + + var posses = []; + + for (var i = 1; i < arguments.length; i++) { + posses.push(_processOneSpec(el, arguments[i], true).name); + } + + _each(el, function(_el) { + if (_el._katavorioDrag) { + var diff = _difference(_el._katavorioDrag.posses, posses); + var p = []; + Array.prototype.push.apply(p, _el._katavorioDrag.posses); + for (var i = 0; i < diff.length; i++) { + this.removeFromPosse(_el, diff[i]); + } + } + }.bind(this)); + + return posses.length === 1 ? posses[0] : posses; + }; + + /** + * Remove the given element from the given posse(s). + * @method removeFromPosse + * @param {Element} el Element to remove. + * @param {String...} posseId Varargs parameter: one value for each posse to remove the element from. + */ + this.removeFromPosse = function(el, posseId) { + if (arguments.length < 2) throw new TypeError("No posse id provided for remove operation"); + for(var i = 1; i < arguments.length; i++) { + posseId = arguments[i]; + _each(el, function (_el) { + if (_el._katavorioDrag && _el._katavorioDrag.posses) { + var d = _el._katavorioDrag; + _each(posseId, function (p) { + _vanquish(_posses[p].members, d); + _vanquish(d.posses, p); + delete d.posseRoles[p]; + }); + } + }); + } + }; + + /** + * Remove the given element from all Posses to which it belongs. + * @method removeFromAllPosses + * @param {Element|Element[]} el Element to remove from Posses. + */ + this.removeFromAllPosses = function(el) { + _each(el, function(_el) { + if (_el._katavorioDrag && _el._katavorioDrag.posses) { + var d = _el._katavorioDrag; + _each(d.posses, function(p) { + _vanquish(_posses[p].members, d); + }); + d.posses.length = 0; + d.posseRoles = {}; + } + }); + }; + + /** + * Changes the participation state for the element in the Posse with the given ID. + * @param {Element|Element[]} el Element(s) to change state for. + * @param {String} posseId ID of the Posse to change element state for. + * @param {Boolean} state True to make active, false to make passive. + */ + this.setPosseState = function(el, posseId, state) { + var posse = _posses[posseId]; + if (posse) { + _each(el, function(_el) { + if (_el._katavorioDrag && _el._katavorioDrag.posses) { + _el._katavorioDrag.posseRoles[posse.name] = state; + } + }); + } + }; + + }; + + root.Katavorio.version = "1.0.0"; + + if (typeof exports !== "undefined") { + exports.Katavorio = root.Katavorio; + } + +}).call(typeof window !== 'undefined' ? window : this); + + +(function() { + + var root = this; + root.jsPlumbUtil = root.jsPlumbUtil || {}; + var jsPlumbUtil = root.jsPlumbUtil; + + if (typeof exports !=='undefined') { exports.jsPlumbUtil = jsPlumbUtil;} + + + function isArray(a) { + return Object.prototype.toString.call(a) === "[object Array]"; + } + jsPlumbUtil.isArray = isArray; + function isNumber(n) { + return Object.prototype.toString.call(n) === "[object Number]"; + } + jsPlumbUtil.isNumber = isNumber; + function isString(s) { + return typeof s === "string"; + } + jsPlumbUtil.isString = isString; + function isBoolean(s) { + return typeof s === "boolean"; + } + jsPlumbUtil.isBoolean = isBoolean; + function isNull(s) { + return s == null; + } + jsPlumbUtil.isNull = isNull; + function isObject(o) { + return o == null ? false : Object.prototype.toString.call(o) === "[object Object]"; + } + jsPlumbUtil.isObject = isObject; + function isDate(o) { + return Object.prototype.toString.call(o) === "[object Date]"; + } + jsPlumbUtil.isDate = isDate; + function isFunction(o) { + return Object.prototype.toString.call(o) === "[object Function]"; + } + jsPlumbUtil.isFunction = isFunction; + function isNamedFunction(o) { + return isFunction(o) && o.name != null && o.name.length > 0; + } + jsPlumbUtil.isNamedFunction = isNamedFunction; + function isEmpty(o) { + for (var i in o) { + if (o.hasOwnProperty(i)) { + return false; + } + } + return true; + } + jsPlumbUtil.isEmpty = isEmpty; + function clone(a) { + if (isString(a)) { + return "" + a; + } + else if (isBoolean(a)) { + return !!a; + } + else if (isDate(a)) { + return new Date(a.getTime()); + } + else if (isFunction(a)) { + return a; + } + else if (isArray(a)) { + var b = []; + for (var i = 0; i < a.length; i++) { + b.push(clone(a[i])); + } + return b; + } + else if (isObject(a)) { + var c = {}; + for (var j in a) { + c[j] = clone(a[j]); + } + return c; + } + else { + return a; + } + } + jsPlumbUtil.clone = clone; + function merge(a, b, collations, overwrites) { + // first change the collations array - if present - into a lookup table, because its faster. + var cMap = {}, ar, i, oMap = {}; + collations = collations || []; + overwrites = overwrites || []; + for (i = 0; i < collations.length; i++) { + cMap[collations[i]] = true; + } + for (i = 0; i < overwrites.length; i++) { + oMap[overwrites[i]] = true; + } + var c = clone(a); + for (i in b) { + if (c[i] == null || oMap[i]) { + c[i] = b[i]; + } + else if (isString(b[i]) || isBoolean(b[i])) { + if (!cMap[i]) { + c[i] = b[i]; // if we dont want to collate, just copy it in. + } + else { + ar = []; + // if c's object is also an array we can keep its values. + ar.push.apply(ar, isArray(c[i]) ? c[i] : [c[i]]); + ar.push.apply(ar, isBoolean(b[i]) ? b[i] : [b[i]]); + c[i] = ar; + } + } + else { + if (isArray(b[i])) { + ar = []; + // if c's object is also an array we can keep its values. + if (isArray(c[i])) { + ar.push.apply(ar, c[i]); + } + ar.push.apply(ar, b[i]); + c[i] = ar; + } + else if (isObject(b[i])) { + // overwrite c's value with an object if it is not already one. + if (!isObject(c[i])) { + c[i] = {}; + } + for (var j in b[i]) { + c[i][j] = b[i][j]; + } + } + } + } + return c; + } + jsPlumbUtil.merge = merge; + function replace(inObj, path, value) { + if (inObj == null) { + return; + } + var q = inObj, t = q; + path.replace(/([^\.])+/g, function (term, lc, pos, str) { + var array = term.match(/([^\[0-9]+){1}(\[)([0-9+])/), last = pos + term.length >= str.length, _getArray = function () { + return t[array[1]] || (function () { + t[array[1]] = []; + return t[array[1]]; + })(); + }; + if (last) { + // set term = value on current t, creating term as array if necessary. + if (array) { + _getArray()[array[3]] = value; + } + else { + t[term] = value; + } + } + else { + // set to current t[term], creating t[term] if necessary. + if (array) { + var a_1 = _getArray(); + t = a_1[array[3]] || (function () { + a_1[array[3]] = {}; + return a_1[array[3]]; + })(); + } + else { + t = t[term] || (function () { + t[term] = {}; + return t[term]; + })(); + } + } + return ""; + }); + return inObj; + } + jsPlumbUtil.replace = replace; + // + // chain a list of functions, supplied by [ object, method name, args ], and return on the first + // one that returns the failValue. if none return the failValue, return the successValue. + // + function functionChain(successValue, failValue, fns) { + for (var i = 0; i < fns.length; i++) { + var o = fns[i][0][fns[i][1]].apply(fns[i][0], fns[i][2]); + if (o === failValue) { + return o; + } + } + return successValue; + } + jsPlumbUtil.functionChain = functionChain; + /** + * + * Take the given model and expand out any parameters. 'functionPrefix' is optional, and if present, helps jsplumb figure out what to do if a value is a Function. + * if you do not provide it (and doNotExpandFunctions is null, or false), jsplumb will run the given values through any functions it finds, and use the function's + * output as the value in the result. if you do provide the prefix, only functions that are named and have this prefix + * will be executed; other functions will be passed as values to the output. + * + * @param model + * @param values + * @param functionPrefix + * @param doNotExpandFunctions + * @returns {any} + */ + function populate(model, values, functionPrefix, doNotExpandFunctions) { + // for a string, see if it has parameter matches, and if so, try to make the substitutions. + var getValue = function (fromString) { + var matches = fromString.match(/(\${.*?})/g); + if (matches != null) { + for (var i = 0; i < matches.length; i++) { + var val = values[matches[i].substring(2, matches[i].length - 1)] || ""; + if (val != null) { + fromString = fromString.replace(matches[i], val); + } + } + } + return fromString; + }; + // process one entry. + var _one = function (d) { + if (d != null) { + if (isString(d)) { + return getValue(d); + } + else if (isFunction(d) && !doNotExpandFunctions && (functionPrefix == null || (d.name || "").indexOf(functionPrefix) === 0)) { + return d(values); + } + else if (isArray(d)) { + var r = []; + for (var i = 0; i < d.length; i++) { + r.push(_one(d[i])); + } + return r; + } + else if (isObject(d)) { + var s = {}; + for (var j in d) { + s[j] = _one(d[j]); + } + return s; + } + else { + return d; + } + } + }; + return _one(model); + } + jsPlumbUtil.populate = populate; + function findWithFunction(a, f) { + if (a) { + for (var i = 0; i < a.length; i++) { + if (f(a[i])) { + return i; + } + } + } + return -1; + } + jsPlumbUtil.findWithFunction = findWithFunction; + function removeWithFunction(a, f) { + var idx = findWithFunction(a, f); + if (idx > -1) { + a.splice(idx, 1); + } + return idx !== -1; + } + jsPlumbUtil.removeWithFunction = removeWithFunction; + function remove(l, v) { + var idx = l.indexOf(v); + if (idx > -1) { + l.splice(idx, 1); + } + return idx !== -1; + } + jsPlumbUtil.remove = remove; + function addWithFunction(list, item, hashFunction) { + if (findWithFunction(list, hashFunction) === -1) { + list.push(item); + } + } + jsPlumbUtil.addWithFunction = addWithFunction; + function addToList(map, key, value, insertAtStart) { + var l = map[key]; + if (l == null) { + l = []; + map[key] = l; + } + l[insertAtStart ? "unshift" : "push"](value); + return l; + } + jsPlumbUtil.addToList = addToList; + function suggest(list, item, insertAtHead) { + if (list.indexOf(item) === -1) { + if (insertAtHead) { + list.unshift(item); + } + else { + list.push(item); + } + return true; + } + return false; + } + jsPlumbUtil.suggest = suggest; + // + // extends the given obj (which can be an array) with the given constructor function, prototype functions, and + // class members, any of which may be null. + // + function extend(child, parent, _protoFn) { + var i; + parent = isArray(parent) ? parent : [parent]; + var _copyProtoChain = function (focus) { + var proto = focus.__proto__; + while (proto != null) { + if (proto.prototype != null) { + for (var j in proto.prototype) { + if (proto.prototype.hasOwnProperty(j) && !child.prototype.hasOwnProperty(j)) { + child.prototype[j] = proto.prototype[j]; + } + } + proto = proto.prototype.__proto__; + } + else { + proto = null; + } + } + }; + for (i = 0; i < parent.length; i++) { + for (var j in parent[i].prototype) { + if (parent[i].prototype.hasOwnProperty(j) && !child.prototype.hasOwnProperty(j)) { + child.prototype[j] = parent[i].prototype[j]; + } + } + _copyProtoChain(parent[i]); + } + var _makeFn = function (name, protoFn) { + return function () { + for (i = 0; i < parent.length; i++) { + if (parent[i].prototype[name]) { + parent[i].prototype[name].apply(this, arguments); + } + } + return protoFn.apply(this, arguments); + }; + }; + var _oneSet = function (fns) { + for (var k in fns) { + child.prototype[k] = _makeFn(k, fns[k]); + } + }; + if (arguments.length > 2) { + for (i = 2; i < arguments.length; i++) { + _oneSet(arguments[i]); + } + } + return child; + } + jsPlumbUtil.extend = extend; + function uuid() { + return ('xxxxxxxx-xxxx-4xxx-yxxx-xxxxxxxxxxxx'.replace(/[xy]/g, function (c) { + var r = Math.random() * 16 | 0, v = c === 'x' ? r : (r & 0x3 | 0x8); + return v.toString(16); + })); + } + jsPlumbUtil.uuid = uuid; + function fastTrim(s) { + if (s == null) { + return null; + } + var str = s.replace(/^\s\s*/, ''), ws = /\s/, i = str.length; + while (ws.test(str.charAt(--i))) { + } + return str.slice(0, i + 1); + } + jsPlumbUtil.fastTrim = fastTrim; + function each(obj, fn) { + obj = obj.length == null || typeof obj === "string" ? [obj] : obj; + for (var i = 0; i < obj.length; i++) { + fn(obj[i]); + } + } + jsPlumbUtil.each = each; + function map(obj, fn) { + var o = []; + for (var i = 0; i < obj.length; i++) { + o.push(fn(obj[i])); + } + return o; + } + jsPlumbUtil.map = map; + function mergeWithParents(type, map, parentAttribute) { + parentAttribute = parentAttribute || "parent"; + var _def = function (id) { + return id ? map[id] : null; + }; + var _parent = function (def) { + return def ? _def(def[parentAttribute]) : null; + }; + var _one = function (parent, def) { + if (parent == null) { + return def; + } + else { + var d_1 = merge(parent, def); + return _one(_parent(parent), d_1); + } + }; + var _getDef = function (t) { + if (t == null) { + return {}; + } + if (typeof t === "string") { + return _def(t); + } + else if (t.length) { + var done = false, i = 0, _dd = void 0; + while (!done && i < t.length) { + _dd = _getDef(t[i]); + if (_dd) { + done = true; + } + else { + i++; + } + } + return _dd; + } + }; + var d = _getDef(type); + if (d) { + return _one(_parent(d), d); + } + else { + return {}; + } + } + jsPlumbUtil.mergeWithParents = mergeWithParents; + jsPlumbUtil.logEnabled = true; + function log() { + var args = []; + for (var _i = 0; _i < arguments.length; _i++) { + args[_i] = arguments[_i]; + } + if (jsPlumbUtil.logEnabled && typeof console !== "undefined") { + try { + var msg = arguments[arguments.length - 1]; + console.log(msg); + } + catch (e) { + } + } + } + jsPlumbUtil.log = log; + /** + * Wraps one function with another, creating a placeholder for the + * wrapped function if it was null. this is used to wrap the various + * drag/drop event functions - to allow jsPlumb to be notified of + * important lifecycle events without imposing itself on the user's + * drag/drop functionality. + * @method jsPlumbUtil.wrap + * @param {Function} wrappedFunction original function to wrap; may be null. + * @param {Function} newFunction function to wrap the original with. + * @param {Object} [returnOnThisValue] Optional. Indicates that the wrappedFunction should + * not be executed if the newFunction returns a value matching 'returnOnThisValue'. + * note that this is a simple comparison and only works for primitives right now. + */ + function wrap(wrappedFunction, newFunction, returnOnThisValue) { + return function () { + var r = null; + try { + if (newFunction != null) { + r = newFunction.apply(this, arguments); + } + } + catch (e) { + log("jsPlumb function failed : " + e); + } + if ((wrappedFunction != null) && (returnOnThisValue == null || (r !== returnOnThisValue))) { + try { + r = wrappedFunction.apply(this, arguments); + } + catch (e) { + log("wrapped function failed : " + e); + } + } + return r; + }; + } + jsPlumbUtil.wrap = wrap; + var EventGenerator = /** @class */ (function () { + function EventGenerator() { + var _this = this; + this._listeners = {}; + this.eventsSuspended = false; + this.tick = false; + // this is a list of events that should re-throw any errors that occur during their dispatch. + this.eventsToDieOn = { "ready": true }; + this.queue = []; + this.bind = function (event, listener, insertAtStart) { + var _one = function (evt) { + addToList(_this._listeners, evt, listener, insertAtStart); + listener.__jsPlumb = listener.__jsPlumb || {}; + listener.__jsPlumb[uuid()] = evt; + }; + if (typeof event === "string") { + _one(event); + } + else if (event.length != null) { + for (var i = 0; i < event.length; i++) { + _one(event[i]); + } + } + return _this; + }; + this.fire = function (event, value, originalEvent) { + if (!this.tick) { + this.tick = true; + if (!this.eventsSuspended && this._listeners[event]) { + var l = this._listeners[event].length, i = 0, _gone = false, ret = null; + if (!this.shouldFireEvent || this.shouldFireEvent(event, value, originalEvent)) { + while (!_gone && i < l && ret !== false) { + // doing it this way rather than catching and then possibly re-throwing means that an error propagated by this + // method will have the whole call stack available in the debugger. + if (this.eventsToDieOn[event]) { + this._listeners[event][i].apply(this, [value, originalEvent]); + } + else { + try { + ret = this._listeners[event][i].apply(this, [value, originalEvent]); + } + catch (e) { + log("jsPlumb: fire failed for event " + event + " : " + e); + } + } + i++; + if (this._listeners == null || this._listeners[event] == null) { + _gone = true; + } + } + } + } + this.tick = false; + this._drain(); + } + else { + this.queue.unshift(arguments); + } + return this; + }; + this._drain = function () { + var n = _this.queue.pop(); + if (n) { + _this.fire.apply(_this, n); + } + }; + this.unbind = function (eventOrListener, listener) { + if (arguments.length === 0) { + this._listeners = {}; + } + else if (arguments.length === 1) { + if (typeof eventOrListener === "string") { + delete this._listeners[eventOrListener]; + } + else if (eventOrListener.__jsPlumb) { + var evt = void 0; + for (var i in eventOrListener.__jsPlumb) { + evt = eventOrListener.__jsPlumb[i]; + remove(this._listeners[evt] || [], eventOrListener); + } + } + } + else if (arguments.length === 2) { + remove(this._listeners[eventOrListener] || [], listener); + } + return this; + }; + this.getListener = function (forEvent) { + return _this._listeners[forEvent]; + }; + this.setSuspendEvents = function (val) { + _this.eventsSuspended = val; + }; + this.isSuspendEvents = function () { + return _this.eventsSuspended; + }; + this.silently = function (fn) { + _this.setSuspendEvents(true); + try { + fn(); + } + catch (e) { + log("Cannot execute silent function " + e); + } + _this.setSuspendEvents(false); + }; + this.cleanupListeners = function () { + for (var i in _this._listeners) { + _this._listeners[i] = null; + } + }; + } + return EventGenerator; + }()); + jsPlumbUtil.EventGenerator = EventGenerator; + +}).call(typeof window !== 'undefined' ? window : this); +/* + * This file contains utility functions that run in browsers only. + * + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ + ;(function() { + + "use strict"; + + var root = this; + + root.jsPlumbUtil.matchesSelector = function(el, selector, ctx) { + ctx = ctx || el.parentNode; + var possibles = ctx.querySelectorAll(selector); + for (var i = 0; i < possibles.length; i++) { + if (possibles[i] === el) { + return true; + } + } + return false; + }; + + root.jsPlumbUtil.consume = function(e, doNotPreventDefault) { + if (e.stopPropagation) { + e.stopPropagation(); + } + else { + e.returnValue = false; + } + + if (!doNotPreventDefault && e.preventDefault){ + e.preventDefault(); + } + }; + + /* + * Function: sizeElement + * Helper to size and position an element. You would typically use + * this when writing your own Connector or Endpoint implementation. + * + * Parameters: + * x - [int] x position for the element origin + * y - [int] y position for the element origin + * w - [int] width of the element + * h - [int] height of the element + * + */ + root.jsPlumbUtil.sizeElement = function(el, x, y, w, h) { + if (el) { + el.style.height = h + "px"; + el.height = h; + el.style.width = w + "px"; + el.width = w; + el.style.left = x + "px"; + el.style.top = y + "px"; + } + }; + + }).call(typeof window !== 'undefined' ? window : this); + +/* + * This file contains the core code. + * + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +;(function () { + + "use strict"; + + var root = this; + + var _ju = root.jsPlumbUtil, + + /** + * creates a timestamp, using milliseconds since 1970, but as a string. + */ + _timestamp = function () { + return "" + (new Date()).getTime(); + }, + + // helper method to update the hover style whenever it, or paintStyle, changes. + // we use paintStyle as the foundation and merge hoverPaintStyle over the + // top. + _updateHoverStyle = function (component) { + if (component._jsPlumb.paintStyle && component._jsPlumb.hoverPaintStyle) { + var mergedHoverStyle = {}; + jsPlumb.extend(mergedHoverStyle, component._jsPlumb.paintStyle); + jsPlumb.extend(mergedHoverStyle, component._jsPlumb.hoverPaintStyle); + delete component._jsPlumb.hoverPaintStyle; + // we want the fill of paintStyle to override a gradient, if possible. + if (mergedHoverStyle.gradient && component._jsPlumb.paintStyle.fill) { + delete mergedHoverStyle.gradient; + } + component._jsPlumb.hoverPaintStyle = mergedHoverStyle; + } + }, + events = ["tap", "dbltap", "click", "dblclick", "mouseover", "mouseout", "mousemove", "mousedown", "mouseup", "contextmenu" ], + eventFilters = { "mouseout": "mouseleave", "mouseexit": "mouseleave" }, + _updateAttachedElements = function (component, state, timestamp, sourceElement) { + var affectedElements = component.getAttachedElements(); + if (affectedElements) { + for (var i = 0, j = affectedElements.length; i < j; i++) { + if (!sourceElement || sourceElement !== affectedElements[i]) { + affectedElements[i].setHover(state, true, timestamp); // tell the attached elements not to inform their own attached elements. + } + } + } + }, + _splitType = function (t) { + return t == null ? null : t.split(" "); + }, + _mapType = function(map, obj, typeId) { + for (var i in obj) { + map[i] = typeId; + } + }, + _each = function(fn, obj) { + obj = _ju.isArray(obj) || (obj.length != null && !_ju.isString(obj)) ? obj : [ obj ]; + for (var i = 0; i < obj.length; i++) { + try { + fn.apply(obj[i], [ obj[i] ]); + } + catch (e) { + _ju.log(".each iteration failed : " + e); + } + } + }, + _applyTypes = function (component, params, doNotRepaint) { + if (component.getDefaultType) { + var td = component.getTypeDescriptor(), map = {}; + var defType = component.getDefaultType(); + var o = _ju.merge({}, defType); + _mapType(map, defType, "__default"); + for (var i = 0, j = component._jsPlumb.types.length; i < j; i++) { + var tid = component._jsPlumb.types[i]; + if (tid !== "__default") { + var _t = component._jsPlumb.instance.getType(tid, td); + if (_t != null) { + o = _ju.merge(o, _t, [ "cssClass" ], [ "connector" ]); + _mapType(map, _t, tid); + } + } + } + + if (params) { + o = _ju.populate(o, params, "_"); + } + + component.applyType(o, doNotRepaint, map); + if (!doNotRepaint) { + component.repaint(); + } + } + }, + +// ------------------------------ BEGIN jsPlumbUIComponent -------------------------------------------- + + jsPlumbUIComponent = root.jsPlumbUIComponent = function (params) { + + _ju.EventGenerator.apply(this, arguments); + + var self = this, + a = arguments, + idPrefix = self.idPrefix, + id = idPrefix + (new Date()).getTime(); + + this._jsPlumb = { + instance: params._jsPlumb, + parameters: params.parameters || {}, + paintStyle: null, + hoverPaintStyle: null, + paintStyleInUse: null, + hover: false, + beforeDetach: params.beforeDetach, + beforeDrop: params.beforeDrop, + overlayPlacements: [], + hoverClass: params.hoverClass || params._jsPlumb.Defaults.HoverClass, + types: [], + typeCache:{} + }; + + this.cacheTypeItem = function(key, item, typeId) { + this._jsPlumb.typeCache[typeId] = this._jsPlumb.typeCache[typeId] || {}; + this._jsPlumb.typeCache[typeId][key] = item; + }; + this.getCachedTypeItem = function(key, typeId) { + return this._jsPlumb.typeCache[typeId] ? this._jsPlumb.typeCache[typeId][key] : null; + }; + + this.getId = function () { + return id; + }; + +// ----------------------------- default type -------------------------------------------- + + + var o = params.overlays || [], oo = {}; + if (this.defaultOverlayKeys) { + for (var i = 0; i < this.defaultOverlayKeys.length; i++) { + Array.prototype.push.apply(o, this._jsPlumb.instance.Defaults[this.defaultOverlayKeys[i]] || []); + } + + for (i = 0; i < o.length; i++) { + // if a string, convert to object representation so that we can store the typeid on it. + // also assign an id. + var fo = jsPlumb.convertToFullOverlaySpec(o[i]); + oo[fo[1].id] = fo; + } + } + + var _defaultType = { + overlays:oo, + parameters: params.parameters || {}, + scope: params.scope || this._jsPlumb.instance.getDefaultScope() + }; + this.getDefaultType = function() { + return _defaultType; + }; + this.appendToDefaultType = function(obj) { + for (var i in obj) { + _defaultType[i] = obj[i]; + } + }; + +// ----------------------------- end default type -------------------------------------------- + + // all components can generate events + + if (params.events) { + for (var evtName in params.events) { + self.bind(evtName, params.events[evtName]); + } + } + + // all components get this clone function. + // TODO issue 116 showed a problem with this - it seems 'a' that is in + // the clone function's scope is shared by all invocations of it, the classic + // JS closure problem. for now, jsPlumb does a version of this inline where + // it used to call clone. but it would be nice to find some time to look + // further at this. + this.clone = function () { + var o = Object.create(this.constructor.prototype); + this.constructor.apply(o, a); + return o; + }.bind(this); + + // user can supply a beforeDetach callback, which will be executed before a detach + // is performed; returning false prevents the detach. + this.isDetachAllowed = function (connection) { + var r = true; + if (this._jsPlumb.beforeDetach) { + try { + r = this._jsPlumb.beforeDetach(connection); + } + catch (e) { + _ju.log("jsPlumb: beforeDetach callback failed", e); + } + } + return r; + }; + + // user can supply a beforeDrop callback, which will be executed before a dropped + // connection is confirmed. user can return false to reject connection. + this.isDropAllowed = function (sourceId, targetId, scope, connection, dropEndpoint, source, target) { + var r = this._jsPlumb.instance.checkCondition("beforeDrop", { + sourceId: sourceId, + targetId: targetId, + scope: scope, + connection: connection, + dropEndpoint: dropEndpoint, + source: source, target: target + }); + if (this._jsPlumb.beforeDrop) { + try { + r = this._jsPlumb.beforeDrop({ + sourceId: sourceId, + targetId: targetId, + scope: scope, + connection: connection, + dropEndpoint: dropEndpoint, + source: source, target: target + }); + } + catch (e) { + _ju.log("jsPlumb: beforeDrop callback failed", e); + } + } + return r; + }; + + var domListeners = []; + + // sets the component associated with listener events. for instance, an overlay delegates + // its events back to a connector. but if the connector is swapped on the underlying connection, + // then this component must be changed. This is called by setConnector in the Connection class. + this.setListenerComponent = function (c) { + for (var i = 0; i < domListeners.length; i++) { + domListeners[i][3] = c; + } + }; + + + }; + + var _removeTypeCssHelper = function (component, typeIndex) { + var typeId = component._jsPlumb.types[typeIndex], + type = component._jsPlumb.instance.getType(typeId, component.getTypeDescriptor()); + + if (type != null && type.cssClass && component.canvas) { + component._jsPlumb.instance.removeClass(component.canvas, type.cssClass); + } + }; + + _ju.extend(root.jsPlumbUIComponent, _ju.EventGenerator, { + + getParameter: function (name) { + return this._jsPlumb.parameters[name]; + }, + + setParameter: function (name, value) { + this._jsPlumb.parameters[name] = value; + }, + + getParameters: function () { + return this._jsPlumb.parameters; + }, + + setParameters: function (p) { + this._jsPlumb.parameters = p; + }, + + getClass:function() { + return jsPlumb.getClass(this.canvas); + }, + + hasClass:function(clazz) { + return jsPlumb.hasClass(this.canvas, clazz); + }, + + addClass: function (clazz) { + jsPlumb.addClass(this.canvas, clazz); + }, + + removeClass: function (clazz) { + jsPlumb.removeClass(this.canvas, clazz); + }, + + updateClasses: function (classesToAdd, classesToRemove) { + jsPlumb.updateClasses(this.canvas, classesToAdd, classesToRemove); + }, + + setType: function (typeId, params, doNotRepaint) { + this.clearTypes(); + this._jsPlumb.types = _splitType(typeId) || []; + _applyTypes(this, params, doNotRepaint); + }, + + getType: function () { + return this._jsPlumb.types; + }, + + reapplyTypes: function (params, doNotRepaint) { + _applyTypes(this, params, doNotRepaint); + }, + + hasType: function (typeId) { + return this._jsPlumb.types.indexOf(typeId) !== -1; + }, + + addType: function (typeId, params, doNotRepaint) { + var t = _splitType(typeId), _cont = false; + if (t != null) { + for (var i = 0, j = t.length; i < j; i++) { + if (!this.hasType(t[i])) { + this._jsPlumb.types.push(t[i]); + _cont = true; + } + } + if (_cont) { + _applyTypes(this, params, doNotRepaint); + } + } + }, + + removeType: function (typeId, params, doNotRepaint) { + var t = _splitType(typeId), _cont = false, _one = function (tt) { + var idx = this._jsPlumb.types.indexOf(tt); + if (idx !== -1) { + // remove css class if necessary + _removeTypeCssHelper(this, idx); + this._jsPlumb.types.splice(idx, 1); + return true; + } + return false; + }.bind(this); + + if (t != null) { + for (var i = 0, j = t.length; i < j; i++) { + _cont = _one(t[i]) || _cont; + } + if (_cont) { + _applyTypes(this, params, doNotRepaint); + } + } + }, + clearTypes: function (params, doNotRepaint) { + var i = this._jsPlumb.types.length; + for (var j = 0; j < i; j++) { + _removeTypeCssHelper(this, 0); + this._jsPlumb.types.splice(0, 1); + } + _applyTypes(this, params, doNotRepaint); + }, + + toggleType: function (typeId, params, doNotRepaint) { + var t = _splitType(typeId); + if (t != null) { + for (var i = 0, j = t.length; i < j; i++) { + var idx = this._jsPlumb.types.indexOf(t[i]); + if (idx !== -1) { + _removeTypeCssHelper(this, idx); + this._jsPlumb.types.splice(idx, 1); + } + else { + this._jsPlumb.types.push(t[i]); + } + } + + _applyTypes(this, params, doNotRepaint); + } + }, + applyType: function (t, doNotRepaint) { + this.setPaintStyle(t.paintStyle, doNotRepaint); + this.setHoverPaintStyle(t.hoverPaintStyle, doNotRepaint); + if (t.parameters) { + for (var i in t.parameters) { + this.setParameter(i, t.parameters[i]); + } + } + this._jsPlumb.paintStyleInUse = this.getPaintStyle(); + }, + setPaintStyle: function (style, doNotRepaint) { + // this._jsPlumb.paintStyle = jsPlumb.extend({}, style); + // TODO figure out if we want components to clone paintStyle so as not to share it. + this._jsPlumb.paintStyle = style; + this._jsPlumb.paintStyleInUse = this._jsPlumb.paintStyle; + _updateHoverStyle(this); + if (!doNotRepaint) { + this.repaint(); + } + }, + getPaintStyle: function () { + return this._jsPlumb.paintStyle; + }, + setHoverPaintStyle: function (style, doNotRepaint) { + //this._jsPlumb.hoverPaintStyle = jsPlumb.extend({}, style); + // TODO figure out if we want components to clone paintStyle so as not to share it. + this._jsPlumb.hoverPaintStyle = style; + _updateHoverStyle(this); + if (!doNotRepaint) { + this.repaint(); + } + }, + getHoverPaintStyle: function () { + return this._jsPlumb.hoverPaintStyle; + }, + destroy: function (force) { + if (force || this.typeId == null) { + this.cleanupListeners(); // this is on EventGenerator + this.clone = null; + this._jsPlumb = null; + } + }, + + isHover: function () { + return this._jsPlumb.hover; + }, + + setHover: function (hover, ignoreAttachedElements, timestamp) { + // while dragging, we ignore these events. this keeps the UI from flashing and + // swishing and whatevering. + if (this._jsPlumb && !this._jsPlumb.instance.currentlyDragging && !this._jsPlumb.instance.isHoverSuspended()) { + + this._jsPlumb.hover = hover; + var method = hover ? "addClass" : "removeClass"; + + if (this.canvas != null) { + if (this._jsPlumb.instance.hoverClass != null) { + this._jsPlumb.instance[method](this.canvas, this._jsPlumb.instance.hoverClass); + } + if (this._jsPlumb.hoverClass != null) { + this._jsPlumb.instance[method](this.canvas, this._jsPlumb.hoverClass); + } + } + if (this._jsPlumb.hoverPaintStyle != null) { + this._jsPlumb.paintStyleInUse = hover ? this._jsPlumb.hoverPaintStyle : this._jsPlumb.paintStyle; + if (!this._jsPlumb.instance.isSuspendDrawing()) { + timestamp = timestamp || _timestamp(); + this.repaint({timestamp: timestamp, recalc: false}); + } + } + // get the list of other affected elements, if supported by this component. + // for a connection, its the endpoints. for an endpoint, its the connections! surprise. + if (this.getAttachedElements && !ignoreAttachedElements) { + _updateAttachedElements(this, hover, _timestamp(), this); + } + } + } + }); + +// ------------------------------ END jsPlumbUIComponent -------------------------------------------- + + var _jsPlumbInstanceIndex = 0, + getInstanceIndex = function () { + var i = _jsPlumbInstanceIndex + 1; + _jsPlumbInstanceIndex++; + return i; + }; + + var jsPlumbInstance = root.jsPlumbInstance = function (_defaults) { + + this.version = "2.9.3"; + + this.Defaults = { + Anchor: "Bottom", + Anchors: [ null, null ], + ConnectionsDetachable: true, + ConnectionOverlays: [ ], + Connector: "Bezier", + Container: null, + DoNotThrowErrors: false, + DragOptions: { }, + DropOptions: { }, + Endpoint: "Dot", + EndpointOverlays: [ ], + Endpoints: [ null, null ], + EndpointStyle: { fill: "#456" }, + EndpointStyles: [ null, null ], + EndpointHoverStyle: null, + EndpointHoverStyles: [ null, null ], + HoverPaintStyle: null, + LabelStyle: { color: "black" }, + LogEnabled: false, + Overlays: [ ], + MaxConnections: 1, + PaintStyle: { "stroke-width": 4, stroke: "#456" }, + ReattachConnections: false, + RenderMode: "svg", + Scope: "jsPlumb_DefaultScope" + }; + + if (_defaults) { + jsPlumb.extend(this.Defaults, _defaults); + } + + this.logEnabled = this.Defaults.LogEnabled; + this._connectionTypes = {}; + this._endpointTypes = {}; + + _ju.EventGenerator.apply(this); + + var _currentInstance = this, + _instanceIndex = getInstanceIndex(), + _bb = _currentInstance.bind, + _initialDefaults = {}, + _zoom = 1, + _info = function (el) { + if (el == null) { + return null; + } + else if (el.nodeType === 3 || el.nodeType === 8) { + return { el:el, text:true }; + } + else { + var _el = _currentInstance.getElement(el); + return { el: _el, id: (_ju.isString(el) && _el == null) ? el : _getId(_el) }; + } + }; + + this.getInstanceIndex = function () { + return _instanceIndex; + }; + + // CONVERTED + this.setZoom = function (z, repaintEverything) { + _zoom = z; + _currentInstance.fire("zoom", _zoom); + if (repaintEverything) { + _currentInstance.repaintEverything(); + } + return true; + }; + // CONVERTED + this.getZoom = function () { + return _zoom; + }; + + for (var i in this.Defaults) { + _initialDefaults[i] = this.Defaults[i]; + } + + var _container, _containerDelegations = []; + this.unbindContainer = function() { + if (_container != null && _containerDelegations.length > 0) { + for (var i = 0; i < _containerDelegations.length; i++) { + _currentInstance.off(_container, _containerDelegations[i][0], _containerDelegations[i][1]); + } + } + }; + this.setContainer = function (c) { + + this.unbindContainer(); + + // get container as dom element. + c = this.getElement(c); + // move existing connections and endpoints, if any. + this.select().each(function (conn) { + conn.moveParent(c); + }); + this.selectEndpoints().each(function (ep) { + ep.moveParent(c); + }); + + // set container. + var previousContainer = _container; + _container = c; + _containerDelegations.length = 0; + var eventAliases = { + "endpointclick":"endpointClick", + "endpointdblclick":"endpointDblClick" + }; + + var _oneDelegateHandler = function (id, e, componentType) { + var t = e.srcElement || e.target, + jp = (t && t.parentNode ? t.parentNode._jsPlumb : null) || (t ? t._jsPlumb : null) || (t && t.parentNode && t.parentNode.parentNode ? t.parentNode.parentNode._jsPlumb : null); + if (jp) { + jp.fire(id, jp, e); + var alias = componentType ? eventAliases[componentType + id] || id : id; + // jsplumb also fires every event coming from components/overlays. That's what the test for `jp.component` is for. + _currentInstance.fire(alias, jp.component || jp, e); + } + }; + + var _addOneDelegate = function(eventId, selector, fn) { + _containerDelegations.push([eventId, fn]); + _currentInstance.on(_container, eventId, selector, fn); + }; + + // delegate one event on the container to jsplumb elements. it might be possible to + // abstract this out: each of endpoint, connection and overlay could register themselves with + // jsplumb as "component types" or whatever, and provide a suitable selector. this would be + // done by the renderer (although admittedly from 2.0 onwards we're not supporting vml anymore) + var _oneDelegate = function (id) { + // connections. + _addOneDelegate(id, ".jtk-connector", function (e) { + _oneDelegateHandler(id, e); + }); + // endpoints. note they can have an enclosing div, or not. + _addOneDelegate(id, ".jtk-endpoint", function (e) { + _oneDelegateHandler(id, e, "endpoint"); + }); + // overlays + _addOneDelegate(id, ".jtk-overlay", function (e) { + _oneDelegateHandler(id, e); + }); + }; + + for (var i = 0; i < events.length; i++) { + _oneDelegate(events[i]); + } + + // managed elements + for (var elId in managedElements) { + var el = managedElements[elId].el; + if (el.parentNode === previousContainer) { + previousContainer.removeChild(el); + _container.appendChild(el); + } + } + + }; + this.getContainer = function () { + return _container; + }; + + this.bind = function (event, fn) { + if ("ready" === event && initialized) { + fn(); + } + else { + _bb.apply(_currentInstance, [event, fn]); + } + }; + + _currentInstance.importDefaults = function (d) { + for (var i in d) { + _currentInstance.Defaults[i] = d[i]; + } + if (d.Container) { + _currentInstance.setContainer(d.Container); + } + + return _currentInstance; + }; + + _currentInstance.restoreDefaults = function () { + _currentInstance.Defaults = jsPlumb.extend({}, _initialDefaults); + return _currentInstance; + }; + + var log = null, + initialized = false, + // TODO remove from window scope + connections = [], + // map of element id -> endpoint lists. an element can have an arbitrary + // number of endpoints on it, and not all of them have to be connected + // to anything. + endpointsByElement = {}, + endpointsByUUID = {}, + managedElements = {}, + offsets = {}, + offsetTimestamps = {}, + draggableStates = {}, + connectionBeingDragged = false, + sizes = [], + _suspendDrawing = false, + _suspendedAt = null, + DEFAULT_SCOPE = this.Defaults.Scope, + _curIdStamp = 1, + _idstamp = function () { + return "" + _curIdStamp++; + }, + + // + // appends an element to some other element, which is calculated as follows: + // + // 1. if Container exists, use that element. + // 2. if the 'parent' parameter exists, use that. + // 3. otherwise just use the root element. + // + // + _appendElement = function (el, parent) { + if (_container) { + _container.appendChild(el); + } + else if (!parent) { + this.appendToRoot(el); + } + else { + this.getElement(parent).appendChild(el); + } + }.bind(this), + + // + // Draws an endpoint and its connections. this is the main entry point into drawing connections as well + // as endpoints, since jsPlumb is endpoint-centric under the hood. + // + // @param element element to draw (of type library specific element object) + // @param ui UI object from current library's event system. optional. + // @param timestamp timestamp for this paint cycle. used to speed things up a little by cutting down the amount of offset calculations we do. + // @param clearEdits defaults to false; indicates that mouse edits for connectors should be cleared + /// + _draw = function (element, ui, timestamp, clearEdits) { + + if (!_suspendDrawing) { + var id = _getId(element), + repaintEls, + dm = _currentInstance.getDragManager(); + + if (dm) { + repaintEls = dm.getElementsForDraggable(id); + } + + if (timestamp == null) { + timestamp = _timestamp(); + } + + // update the offset of everything _before_ we try to draw anything. + var o = _updateOffset({ elId: id, offset: ui, recalc: false, timestamp: timestamp }); + + if (repaintEls && o && o.o) { + for (var i in repaintEls) { + _updateOffset({ + elId: repaintEls[i].id, + offset: { + left: o.o.left + repaintEls[i].offset.left, + top: o.o.top + repaintEls[i].offset.top + }, + recalc: false, + timestamp: timestamp + }); + } + } + + _currentInstance.anchorManager.redraw(id, ui, timestamp, null, clearEdits); + + if (repaintEls) { + for (var j in repaintEls) { + _currentInstance.anchorManager.redraw(repaintEls[j].id, ui, timestamp, repaintEls[j].offset, clearEdits, true); + } + } + } + }, + + // + // gets an Endpoint by uuid. + // + _getEndpoint = function (uuid) { + return endpointsByUUID[uuid]; + }, + + /** + * inits a draggable if it's not already initialised. + * TODO: somehow abstract this to the adapter, because the concept of "draggable" has no + * place on the server. + */ + + + _scopeMatch = function (e1, e2) { + var s1 = e1.scope.split(/\s/), s2 = e2.scope.split(/\s/); + for (var i = 0; i < s1.length; i++) { + for (var j = 0; j < s2.length; j++) { + if (s2[j] === s1[i]) { + return true; + } + } + } + + return false; + }, + + _mergeOverrides = function (def, values) { + var m = jsPlumb.extend({}, def); + for (var i in values) { + if (values[i]) { + m[i] = values[i]; + } + } + return m; + }, + + /* + * prepares a final params object that can be passed to _newConnection, taking into account defaults, events, etc. + */ + _prepareConnectionParams = function (params, referenceParams) { + var _p = jsPlumb.extend({ }, params); + if (referenceParams) { + jsPlumb.extend(_p, referenceParams); + } + + // hotwire endpoints passed as source or target to sourceEndpoint/targetEndpoint, respectively. + if (_p.source) { + if (_p.source.endpoint) { + _p.sourceEndpoint = _p.source; + } + else { + _p.source = _currentInstance.getElement(_p.source); + } + } + if (_p.target) { + if (_p.target.endpoint) { + _p.targetEndpoint = _p.target; + } + else { + _p.target = _currentInstance.getElement(_p.target); + } + } + + // test for endpoint uuids to connect + if (params.uuids) { + _p.sourceEndpoint = _getEndpoint(params.uuids[0]); + _p.targetEndpoint = _getEndpoint(params.uuids[1]); + } + + // now ensure that if we do have Endpoints already, they're not full. + // source: + if (_p.sourceEndpoint && _p.sourceEndpoint.isFull()) { + _ju.log(_currentInstance, "could not add connection; source endpoint is full"); + return; + } + + // target: + if (_p.targetEndpoint && _p.targetEndpoint.isFull()) { + _ju.log(_currentInstance, "could not add connection; target endpoint is full"); + return; + } + + // if source endpoint mandates connection type and nothing specified in our params, use it. + if (!_p.type && _p.sourceEndpoint) { + _p.type = _p.sourceEndpoint.connectionType; + } + + // copy in any connectorOverlays that were specified on the source endpoint. + // it doesnt copy target endpoint overlays. i'm not sure if we want it to or not. + if (_p.sourceEndpoint && _p.sourceEndpoint.connectorOverlays) { + _p.overlays = _p.overlays || []; + for (var i = 0, j = _p.sourceEndpoint.connectorOverlays.length; i < j; i++) { + _p.overlays.push(_p.sourceEndpoint.connectorOverlays[i]); + } + } + + // scope + if (_p.sourceEndpoint && _p.sourceEndpoint.scope) { + _p.scope = _p.sourceEndpoint.scope; + } + + // pointer events + if (!_p["pointer-events"] && _p.sourceEndpoint && _p.sourceEndpoint.connectorPointerEvents) { + _p["pointer-events"] = _p.sourceEndpoint.connectorPointerEvents; + } + + + var _addEndpoint = function (el, def, idx) { + return _currentInstance.addEndpoint(el, _mergeOverrides(def, { + anchor: _p.anchors ? _p.anchors[idx] : _p.anchor, + endpoint: _p.endpoints ? _p.endpoints[idx] : _p.endpoint, + paintStyle: _p.endpointStyles ? _p.endpointStyles[idx] : _p.endpointStyle, + hoverPaintStyle: _p.endpointHoverStyles ? _p.endpointHoverStyles[idx] : _p.endpointHoverStyle + })); + }; + + // check for makeSource/makeTarget specs. + + var _oneElementDef = function (type, idx, defs, matchType) { + if (_p[type] && !_p[type].endpoint && !_p[type + "Endpoint"] && !_p.newConnection) { + var tid = _getId(_p[type]), tep = defs[tid]; + + tep = tep ? tep[matchType] : null; + + if (tep) { + // if not enabled, return. + if (!tep.enabled) { + return false; + } + var newEndpoint = tep.endpoint != null && tep.endpoint._jsPlumb ? tep.endpoint : _addEndpoint(_p[type], tep.def, idx); + if (newEndpoint.isFull()) { + return false; + } + _p[type + "Endpoint"] = newEndpoint; + if (!_p.scope && tep.def.scope) { + _p.scope = tep.def.scope; + } // provide scope if not already provided and endpoint def has one. + if (tep.uniqueEndpoint) { + if (!tep.endpoint) { + tep.endpoint = newEndpoint; + newEndpoint.setDeleteOnEmpty(false); + } + else { + newEndpoint.finalEndpoint = tep.endpoint; + } + } else { + newEndpoint.setDeleteOnEmpty(true); + } + + // + // copy in connector overlays if present on the source definition. + // + if (idx === 0 && tep.def.connectorOverlays) { + _p.overlays = _p.overlays || []; + Array.prototype.push.apply(_p.overlays, tep.def.connectorOverlays); + } + } + } + }; + + if (_oneElementDef("source", 0, this.sourceEndpointDefinitions, _p.type || "default") === false) { + return; + } + if (_oneElementDef("target", 1, this.targetEndpointDefinitions, _p.type || "default") === false) { + return; + } + + // last, ensure scopes match + if (_p.sourceEndpoint && _p.targetEndpoint) { + if (!_scopeMatch(_p.sourceEndpoint, _p.targetEndpoint)) { + _p = null; + } + } + + return _p; + }.bind(_currentInstance), + + _newConnection = function (params) { + var connectionFunc = _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType(); + + params._jsPlumb = _currentInstance; + params.newConnection = _newConnection; + params.newEndpoint = _newEndpoint; + params.endpointsByUUID = endpointsByUUID; + params.endpointsByElement = endpointsByElement; + params.finaliseConnection = _finaliseConnection; + params.id = "con_" + _idstamp(); + var con = new connectionFunc(params); + + // if the connection is draggable, then maybe we need to tell the target endpoint to init the + // dragging code. it won't run again if it already configured to be draggable. + if (con.isDetachable()) { + con.endpoints[0].initDraggable("_jsPlumbSource"); + con.endpoints[1].initDraggable("_jsPlumbTarget"); + } + + return con; + }, + + // + // adds the connection to the backing model, fires an event if necessary and then redraws + // + _finaliseConnection = _currentInstance.finaliseConnection = function (jpc, params, originalEvent, doInformAnchorManager) { + params = params || {}; + // add to list of connections (by scope). + if (!jpc.suspendedEndpoint) { + connections.push(jpc); + } + + jpc.pending = null; + + // turn off isTemporarySource on the source endpoint (only viable on first draw) + jpc.endpoints[0].isTemporarySource = false; + + // always inform the anchor manager + // except that if jpc has a suspended endpoint it's not true to say the + // connection is new; it has just (possibly) moved. the question is whether + // to make that call here or in the anchor manager. i think perhaps here. + if (doInformAnchorManager !== false) { + _currentInstance.anchorManager.newConnection(jpc); + } + + // force a paint + _draw(jpc.source); + + // fire an event + if (!params.doNotFireConnectionEvent && params.fireEvent !== false) { + + var eventArgs = { + connection: jpc, + source: jpc.source, target: jpc.target, + sourceId: jpc.sourceId, targetId: jpc.targetId, + sourceEndpoint: jpc.endpoints[0], targetEndpoint: jpc.endpoints[1] + }; + + _currentInstance.fire("connection", eventArgs, originalEvent); + } + }, + + /* + factory method to prepare a new endpoint. this should always be used instead of creating Endpoints + manually, since this method attaches event listeners and an id. + */ + _newEndpoint = function (params, id) { + var endpointFunc = _currentInstance.Defaults.EndpointType || jsPlumb.Endpoint; + var _p = jsPlumb.extend({}, params); + _p._jsPlumb = _currentInstance; + _p.newConnection = _newConnection; + _p.newEndpoint = _newEndpoint; + _p.endpointsByUUID = endpointsByUUID; + _p.endpointsByElement = endpointsByElement; + _p.fireDetachEvent = fireDetachEvent; + _p.elementId = id || _getId(_p.source); + var ep = new endpointFunc(_p); + ep.id = "ep_" + _idstamp(); + _manage(_p.elementId, _p.source); + + if (!jsPlumb.headless) { + _currentInstance.getDragManager().endpointAdded(_p.source, id); + } + + return ep; + }, + + /* + * performs the given function operation on all the connections found + * for the given element id; this means we find all the endpoints for + * the given element, and then for each endpoint find the connectors + * connected to it. then we pass each connection in to the given + * function. + */ + _operation = function (elId, func, endpointFunc) { + var endpoints = endpointsByElement[elId]; + if (endpoints && endpoints.length) { + for (var i = 0, ii = endpoints.length; i < ii; i++) { + for (var j = 0, jj = endpoints[i].connections.length; j < jj; j++) { + var retVal = func(endpoints[i].connections[j]); + // if the function passed in returns true, we exit. + // most functions return false. + if (retVal) { + return; + } + } + if (endpointFunc) { + endpointFunc(endpoints[i]); + } + } + } + }, + + _setDraggable = function (element, draggable) { + return jsPlumb.each(element, function (el) { + if (_currentInstance.isDragSupported(el)) { + draggableStates[_currentInstance.getAttribute(el, "id")] = draggable; + _currentInstance.setElementDraggable(el, draggable); + } + }); + }, + /* + * private method to do the business of hiding/showing. + * + * @param el + * either Id of the element in question or a library specific + * object for the element. + * @param state + * String specifying a value for the css 'display' property + * ('block' or 'none'). + */ + _setVisible = function (el, state, alsoChangeEndpoints) { + state = state === "block"; + var endpointFunc = null; + if (alsoChangeEndpoints) { + endpointFunc = function (ep) { + ep.setVisible(state, true, true); + }; + } + var info = _info(el); + _operation(info.id, function (jpc) { + if (state && alsoChangeEndpoints) { + // this test is necessary because this functionality is new, and i wanted to maintain backwards compatibility. + // this block will only set a connection to be visible if the other endpoint in the connection is also visible. + var oidx = jpc.sourceId === info.id ? 1 : 0; + if (jpc.endpoints[oidx].isVisible()) { + jpc.setVisible(true); + } + } + else { // the default behaviour for show, and what always happens for hide, is to just set the visibility without getting clever. + jpc.setVisible(state); + } + }, endpointFunc); + }, + /** + * private method to do the business of toggling hiding/showing. + */ + _toggleVisible = function (elId, changeEndpoints) { + var endpointFunc = null; + if (changeEndpoints) { + endpointFunc = function (ep) { + var state = ep.isVisible(); + ep.setVisible(!state); + }; + } + _operation(elId, function (jpc) { + var state = jpc.isVisible(); + jpc.setVisible(!state); + }, endpointFunc); + }, + + // TODO comparison performance + _getCachedData = function (elId) { + var o = offsets[elId]; + if (!o) { + return _updateOffset({elId: elId}); + } + else { + return {o: o, s: sizes[elId]}; + } + }, + + /** + * gets an id for the given element, creating and setting one if + * necessary. the id is of the form + * + * jsPlumb__ + * + * where "index in instance" is a monotonically increasing integer that starts at 0, + * for each instance. this method is used not only to assign ids to elements that do not + * have them but also to connections and endpoints. + */ + _getId = function (element, uuid, doNotCreateIfNotFound) { + if (_ju.isString(element)) { + return element; + } + if (element == null) { + return null; + } + var id = _currentInstance.getAttribute(element, "id"); + if (!id || id === "undefined") { + // check if fixed uuid parameter is given + if (arguments.length === 2 && arguments[1] !== undefined) { + id = uuid; + } + else if (arguments.length === 1 || (arguments.length === 3 && !arguments[2])) { + id = "jsPlumb_" + _instanceIndex + "_" + _idstamp(); + } + + if (!doNotCreateIfNotFound) { + _currentInstance.setAttribute(element, "id", id); + } + } + return id; + }; + + this.setConnectionBeingDragged = function (v) { + connectionBeingDragged = v; + }; + this.isConnectionBeingDragged = function () { + return connectionBeingDragged; + }; + + /** + * Returns a map of all the elements this jsPlumbInstance is currently managing. + * @returns {Object} Map of [id-> {el, endpoint[], connection, position}] information. + */ + this.getManagedElements = function() { + return managedElements; + }; + + this.connectorClass = "jtk-connector"; + this.connectorOutlineClass = "jtk-connector-outline"; + this.connectedClass = "jtk-connected"; + this.hoverClass = "jtk-hover"; + this.endpointClass = "jtk-endpoint"; + this.endpointConnectedClass = "jtk-endpoint-connected"; + this.endpointFullClass = "jtk-endpoint-full"; + this.endpointDropAllowedClass = "jtk-endpoint-drop-allowed"; + this.endpointDropForbiddenClass = "jtk-endpoint-drop-forbidden"; + this.overlayClass = "jtk-overlay"; + this.draggingClass = "jtk-dragging";// CONVERTED + this.elementDraggingClass = "jtk-element-dragging";// CONVERTED + this.sourceElementDraggingClass = "jtk-source-element-dragging"; // CONVERTED + this.targetElementDraggingClass = "jtk-target-element-dragging";// CONVERTED + this.endpointAnchorClassPrefix = "jtk-endpoint-anchor"; + this.hoverSourceClass = "jtk-source-hover"; + this.hoverTargetClass = "jtk-target-hover"; + this.dragSelectClass = "jtk-drag-select"; + + this.Anchors = {}; + this.Connectors = { "svg": {} }; + this.Endpoints = { "svg": {} }; + this.Overlays = { "svg": {} } ; + this.ConnectorRenderers = {}; + this.SVG = "svg"; + +// --------------------------- jsPlumbInstance public API --------------------------------------------------------- + + + this.addEndpoint = function (el, params, referenceParams) { + referenceParams = referenceParams || {}; + var p = jsPlumb.extend({}, referenceParams); + jsPlumb.extend(p, params); + p.endpoint = p.endpoint || _currentInstance.Defaults.Endpoint; + p.paintStyle = p.paintStyle || _currentInstance.Defaults.EndpointStyle; + + var results = [], + inputs = (_ju.isArray(el) || (el.length != null && !_ju.isString(el))) ? el : [ el ]; + + for (var i = 0, j = inputs.length; i < j; i++) { + p.source = _currentInstance.getElement(inputs[i]); + _ensureContainer(p.source); + + var id = _getId(p.source), e = _newEndpoint(p, id); + + // ensure element is managed. + var myOffset = _manage(id, p.source).info.o; + _ju.addToList(endpointsByElement, id, e); + + if (!_suspendDrawing) { + e.paint({ + anchorLoc: e.anchor.compute({ xy: [ myOffset.left, myOffset.top ], wh: sizes[id], element: e, timestamp: _suspendedAt }), + timestamp: _suspendedAt + }); + } + + results.push(e); + } + + return results.length === 1 ? results[0] : results; + }; + + this.addEndpoints = function (el, endpoints, referenceParams) { + var results = []; + for (var i = 0, j = endpoints.length; i < j; i++) { + var e = _currentInstance.addEndpoint(el, endpoints[i], referenceParams); + if (_ju.isArray(e)) { + Array.prototype.push.apply(results, e); + } + else { + results.push(e); + } + } + return results; + }; + + this.animate = function (el, properties, options) { + if (!this.animationSupported) { + return false; + } + + options = options || {}; + var del = _currentInstance.getElement(el), + id = _getId(del), + stepFunction = jsPlumb.animEvents.step, + completeFunction = jsPlumb.animEvents.complete; + + options[stepFunction] = _ju.wrap(options[stepFunction], function () { + _currentInstance.revalidate(id); + }); + + // onComplete repaints, just to make sure everything looks good at the end of the animation. + options[completeFunction] = _ju.wrap(options[completeFunction], function () { + _currentInstance.revalidate(id); + }); + + _currentInstance.doAnimate(del, properties, options); + }; + + /** + * checks for a listener for the given condition, executing it if found, passing in the given value. + * condition listeners would have been attached using "bind" (which is, you could argue, now overloaded, since + * firing click events etc is a bit different to what this does). i thought about adding a "bindCondition" + * or something, but decided against it, for the sake of simplicity. jsPlumb will never fire one of these + * condition events anyway. + */ + this.checkCondition = function (conditionName, args) { + var l = _currentInstance.getListener(conditionName), + r = true; + + if (l && l.length > 0) { + var values = Array.prototype.slice.call(arguments, 1); + try { + for (var i = 0, j = l.length; i < j; i++) { + r = r && l[i].apply(l[i], values); + } + } + catch (e) { + _ju.log(_currentInstance, "cannot check condition [" + conditionName + "]" + e); + } + } + return r; + }; + + this.connect = function (params, referenceParams) { + // prepare a final set of parameters to create connection with + var _p = _prepareConnectionParams(params, referenceParams), jpc; + // TODO probably a nicer return value if the connection was not made. _prepareConnectionParams + // will return null (and log something) if either endpoint was full. what would be nicer is to + // create a dedicated 'error' object. + if (_p) { + if (_p.source == null && _p.sourceEndpoint == null) { + _ju.log("Cannot establish connection - source does not exist"); + return; + } + if (_p.target == null && _p.targetEndpoint == null) { + _ju.log("Cannot establish connection - target does not exist"); + return; + } + _ensureContainer(_p.source); + // create the connection. it is not yet registered + jpc = _newConnection(_p); + // now add it the model, fire an event, and redraw + _finaliseConnection(jpc, _p); + } + return jpc; + }; + + var stTypes = [ + { el: "source", elId: "sourceId", epDefs: "sourceEndpointDefinitions" }, + { el: "target", elId: "targetId", epDefs: "targetEndpointDefinitions" } + ]; + + var _set = function (c, el, idx, doNotRepaint) { + var ep, _st = stTypes[idx], cId = c[_st.elId], cEl = c[_st.el], sid, sep, + oldEndpoint = c.endpoints[idx]; + + var evtParams = { + index: idx, + originalSourceId: idx === 0 ? cId : c.sourceId, + newSourceId: c.sourceId, + originalTargetId: idx === 1 ? cId : c.targetId, + newTargetId: c.targetId, + connection: c + }; + + if (el.constructor === jsPlumb.Endpoint) { + ep = el; + ep.addConnection(c); + el = ep.element; + } + else { + sid = _getId(el); + sep = this[_st.epDefs][sid]; + + if (sid === c[_st.elId]) { + ep = null; // dont change source/target if the element is already the one given. + } + else if (sep) { + for (var t in sep) { + if (!sep[t].enabled) { + return; + } + ep = sep[t].endpoint != null && sep[t].endpoint._jsPlumb ? sep[t].endpoint : this.addEndpoint(el, sep[t].def); + if (sep[t].uniqueEndpoint) { + sep[t].endpoint = ep; + } + ep.addConnection(c); + } + } + else { + ep = c.makeEndpoint(idx === 0, el, sid); + } + } + + if (ep != null) { + oldEndpoint.detachFromConnection(c); + c.endpoints[idx] = ep; + c[_st.el] = ep.element; + c[_st.elId] = ep.elementId; + evtParams[idx === 0 ? "newSourceId" : "newTargetId"] = ep.elementId; + + fireMoveEvent(evtParams); + + if (!doNotRepaint) { + c.repaint(); + } + } + + evtParams.element = el; + return evtParams; + + }.bind(this); + + this.setSource = function (connection, el, doNotRepaint) { + var p = _set(connection, el, 0, doNotRepaint); + this.anchorManager.sourceChanged(p.originalSourceId, p.newSourceId, connection, p.el); + }; + this.setTarget = function (connection, el, doNotRepaint) { + var p = _set(connection, el, 1, doNotRepaint); + this.anchorManager.updateOtherEndpoint(p.originalSourceId, p.originalTargetId, p.newTargetId, connection); + }; + + this.deleteEndpoint = function (object, dontUpdateHover, deleteAttachedObjects) { + var endpoint = (typeof object === "string") ? endpointsByUUID[object] : object; + if (endpoint) { + _currentInstance.deleteObject({ endpoint: endpoint, dontUpdateHover: dontUpdateHover, deleteAttachedObjects:deleteAttachedObjects }); + } + return _currentInstance; + }; + + this.deleteEveryEndpoint = function () { + var _is = _currentInstance.setSuspendDrawing(true); + for (var id in endpointsByElement) { + var endpoints = endpointsByElement[id]; + if (endpoints && endpoints.length) { + for (var i = 0, j = endpoints.length; i < j; i++) { + _currentInstance.deleteEndpoint(endpoints[i], true); + } + } + } + endpointsByElement = {}; + managedElements = {}; + endpointsByUUID = {}; + offsets = {}; + offsetTimestamps = {}; + _currentInstance.anchorManager.reset(); + var dm = _currentInstance.getDragManager(); + if (dm) { + dm.reset(); + } + if (!_is) { + _currentInstance.setSuspendDrawing(false); + } + return _currentInstance; + }; + + var fireDetachEvent = function (jpc, doFireEvent, originalEvent) { + // may have been given a connection, or in special cases, an object + var connType = _currentInstance.Defaults.ConnectionType || _currentInstance.getDefaultConnectionType(), + argIsConnection = jpc.constructor === connType, + params = argIsConnection ? { + connection: jpc, + source: jpc.source, target: jpc.target, + sourceId: jpc.sourceId, targetId: jpc.targetId, + sourceEndpoint: jpc.endpoints[0], targetEndpoint: jpc.endpoints[1] + } : jpc; + + if (doFireEvent) { + _currentInstance.fire("connectionDetached", params, originalEvent); + } + + // always fire this. used by internal jsplumb stuff. + _currentInstance.fire("internal.connectionDetached", params, originalEvent); + + _currentInstance.anchorManager.connectionDetached(params); + }; + + var fireMoveEvent = _currentInstance.fireMoveEvent = function (params, evt) { + _currentInstance.fire("connectionMoved", params, evt); + }; + + this.unregisterEndpoint = function (endpoint) { + if (endpoint._jsPlumb.uuid) { + endpointsByUUID[endpoint._jsPlumb.uuid] = null; + } + _currentInstance.anchorManager.deleteEndpoint(endpoint); + // TODO at least replace this with a removeWithFunction call. + for (var e in endpointsByElement) { + var endpoints = endpointsByElement[e]; + if (endpoints) { + var newEndpoints = []; + for (var i = 0, j = endpoints.length; i < j; i++) { + if (endpoints[i] !== endpoint) { + newEndpoints.push(endpoints[i]); + } + } + + endpointsByElement[e] = newEndpoints; + } + if (endpointsByElement[e].length < 1) { + delete endpointsByElement[e]; + } + } + }; + + var IS_DETACH_ALLOWED = "isDetachAllowed"; + var BEFORE_DETACH = "beforeDetach"; + var CHECK_CONDITION = "checkCondition"; + + /** + * Deletes a Connection. + * @method deleteConnection + * @param connection Connection to delete + * @param {Object} [params] Optional delete parameters + * @param {Boolean} [params.doNotFireEvent=false] If true, a connection detached event will not be fired. Otherwise one will. + * @param {Boolean} [params.force=false] If true, the connection will be deleted even if a beforeDetach interceptor tries to stop the deletion. + * @returns {Boolean} True if the connection was deleted, false otherwise. + */ + this.deleteConnection = function(connection, params) { + + if (connection != null) { + params = params || {}; + + if (params.force || _ju.functionChain(true, false, [ + [ connection.endpoints[0], IS_DETACH_ALLOWED, [ connection ] ], + [ connection.endpoints[1], IS_DETACH_ALLOWED, [ connection ] ], + [ connection, IS_DETACH_ALLOWED, [ connection ] ], + [ _currentInstance, CHECK_CONDITION, [ BEFORE_DETACH, connection ] ] + ])) { + + connection.setHover(false); + fireDetachEvent(connection, !connection.pending && params.fireEvent !== false, params.originalEvent); + + connection.endpoints[0].detachFromConnection(connection); + connection.endpoints[1].detachFromConnection(connection); + _ju.removeWithFunction(connections, function (_c) { + return connection.id === _c.id; + }); + + connection.cleanup(); + connection.destroy(); + return true; + } + } + return false; + }; + + /** + * Remove all Connections from all elements, but leaves Endpoints in place ((unless a connection is set to auto delete its Endpoints). + * @method deleteEveryConnection + * @param {Object} [params] optional params object for the call + * @param {Boolean} [params.fireEvent=true] Whether or not to fire detach events + * @param {Boolean} [params.forceDetach=false] If true, this call will ignore any `beforeDetach` interceptors. + * @returns {Number} The number of connections that were deleted. + */ + this.deleteEveryConnection = function (params) { + params = params || {}; + var count = connections.length, deletedCount = 0; + _currentInstance.batch(function () { + for (var i = 0; i < count; i++) { + deletedCount += _currentInstance.deleteConnection(connections[0], params) ? 1 : 0; + } + }); + return deletedCount; + }; + + /** + * Removes all an element's Connections. + * @method deleteConnectionsForElement + * @param {Object} el Either the id of the element, or a selector for the element. + * @param {Object} [params] Optional parameters. + * @param {Boolean} [params.fireEvent=true] Whether or not to fire the detach event. + * @param {Boolean} [params.forceDetach=false] If true, this call will ignore any `beforeDetach` interceptors. + * @return {jsPlumbInstance} The current jsPlumb instance. + */ + this.deleteConnectionsForElement = function (el, params) { + params = params || {}; + el = _currentInstance.getElement(el); + var id = _getId(el), endpoints = endpointsByElement[id]; + if (endpoints && endpoints.length) { + for (var i = 0, j = endpoints.length; i < j; i++) { + endpoints[i].deleteEveryConnection(params); + } + } + return _currentInstance; + }; + + /// not public. but of course its exposed. how to change this. + this.deleteObject = function (params) { + var result = { + endpoints: {}, + connections: {}, + endpointCount: 0, + connectionCount: 0 + }, + deleteAttachedObjects = params.deleteAttachedObjects !== false; + + var unravelConnection = function (connection) { + if (connection != null && result.connections[connection.id] == null) { + if (!params.dontUpdateHover && connection._jsPlumb != null) { + connection.setHover(false); + } + result.connections[connection.id] = connection; + result.connectionCount++; + } + }; + var unravelEndpoint = function (endpoint) { + if (endpoint != null && result.endpoints[endpoint.id] == null) { + if (!params.dontUpdateHover && endpoint._jsPlumb != null) { + endpoint.setHover(false); + } + result.endpoints[endpoint.id] = endpoint; + result.endpointCount++; + + if (deleteAttachedObjects) { + for (var i = 0; i < endpoint.connections.length; i++) { + var c = endpoint.connections[i]; + unravelConnection(c); + } + } + } + }; + + if (params.connection) { + unravelConnection(params.connection); + } + else { + unravelEndpoint(params.endpoint); + } + + // loop through connections + for (var i in result.connections) { + var c = result.connections[i]; + if (c._jsPlumb) { + _ju.removeWithFunction(connections, function (_c) { + return c.id === _c.id; + }); + + fireDetachEvent(c, params.fireEvent === false ? false : !c.pending, params.originalEvent); + var doNotCleanup = params.deleteAttachedObjects == null ? null : !params.deleteAttachedObjects; + + c.endpoints[0].detachFromConnection(c, null, doNotCleanup); + c.endpoints[1].detachFromConnection(c, null, doNotCleanup); + + c.cleanup(true); + c.destroy(true); + } + } + + // loop through endpoints + for (var j in result.endpoints) { + var e = result.endpoints[j]; + if (e._jsPlumb) { + _currentInstance.unregisterEndpoint(e); + // FIRE some endpoint deleted event? + e.cleanup(true); + e.destroy(true); + } + } + + return result; + }; + + + // helpers for select/selectEndpoints + var _setOperation = function (list, func, args, selector) { + for (var i = 0, j = list.length; i < j; i++) { + list[i][func].apply(list[i], args); + } + return selector(list); + }, + _getOperation = function (list, func, args) { + var out = []; + for (var i = 0, j = list.length; i < j; i++) { + out.push([ list[i][func].apply(list[i], args), list[i] ]); + } + return out; + }, + setter = function (list, func, selector) { + return function () { + return _setOperation(list, func, arguments, selector); + }; + }, + getter = function (list, func) { + return function () { + return _getOperation(list, func, arguments); + }; + }, + prepareList = function (input, doNotGetIds) { + var r = []; + if (input) { + if (typeof input === 'string') { + if (input === "*") { + return input; + } + r.push(input); + } + else { + if (doNotGetIds) { + r = input; + } + else { + if (input.length) { + for (var i = 0, j = input.length; i < j; i++) { + r.push(_info(input[i]).id); + } + } + else { + r.push(_info(input).id); + } + } + } + } + return r; + }, + filterList = function (list, value, missingIsFalse) { + if (list === "*") { + return true; + } + return list.length > 0 ? list.indexOf(value) !== -1 : !missingIsFalse; + }; + + // get some connections, specifying source/target/scope + this.getConnections = function (options, flat) { + if (!options) { + options = {}; + } else if (options.constructor === String) { + options = { "scope": options }; + } + var scope = options.scope || _currentInstance.getDefaultScope(), + scopes = prepareList(scope, true), + sources = prepareList(options.source), + targets = prepareList(options.target), + results = (!flat && scopes.length > 1) ? {} : [], + _addOne = function (scope, obj) { + if (!flat && scopes.length > 1) { + var ss = results[scope]; + if (ss == null) { + ss = results[scope] = []; + } + ss.push(obj); + } else { + results.push(obj); + } + }; + + for (var j = 0, jj = connections.length; j < jj; j++) { + var c = connections[j], + sourceId = c.proxies && c.proxies[0] ? c.proxies[0].originalEp.elementId : c.sourceId, + targetId = c.proxies && c.proxies[1] ? c.proxies[1].originalEp.elementId : c.targetId; + + if (filterList(scopes, c.scope) && filterList(sources, sourceId) && filterList(targets, targetId)) { + _addOne(c.scope, c); + } + } + + return results; + }; + + var _curryEach = function (list, executor) { + return function (f) { + for (var i = 0, ii = list.length; i < ii; i++) { + f(list[i]); + } + return executor(list); + }; + }, + _curryGet = function (list) { + return function (idx) { + return list[idx]; + }; + }; + + var _makeCommonSelectHandler = function (list, executor) { + var out = { + length: list.length, + each: _curryEach(list, executor), + get: _curryGet(list) + }, + setters = ["setHover", "removeAllOverlays", "setLabel", "addClass", "addOverlay", "removeOverlay", + "removeOverlays", "showOverlay", "hideOverlay", "showOverlays", "hideOverlays", "setPaintStyle", + "setHoverPaintStyle", "setSuspendEvents", "setParameter", "setParameters", "setVisible", + "repaint", "addType", "toggleType", "removeType", "removeClass", "setType", "bind", "unbind" ], + + getters = ["getLabel", "getOverlay", "isHover", "getParameter", "getParameters", "getPaintStyle", + "getHoverPaintStyle", "isVisible", "hasType", "getType", "isSuspendEvents" ], + i, ii; + + for (i = 0, ii = setters.length; i < ii; i++) { + out[setters[i]] = setter(list, setters[i], executor); + } + + for (i = 0, ii = getters.length; i < ii; i++) { + out[getters[i]] = getter(list, getters[i]); + } + + return out; + }; + + var _makeConnectionSelectHandler = function (list) { + var common = _makeCommonSelectHandler(list, _makeConnectionSelectHandler); + return jsPlumb.extend(common, { + // setters + setDetachable: setter(list, "setDetachable", _makeConnectionSelectHandler), + setReattach: setter(list, "setReattach", _makeConnectionSelectHandler), + setConnector: setter(list, "setConnector", _makeConnectionSelectHandler), + delete: function () { + for (var i = 0, ii = list.length; i < ii; i++) { + _currentInstance.deleteConnection(list[i]); + } + }, + // getters + isDetachable: getter(list, "isDetachable"), + isReattach: getter(list, "isReattach") + }); + }; + + var _makeEndpointSelectHandler = function (list) { + var common = _makeCommonSelectHandler(list, _makeEndpointSelectHandler); + return jsPlumb.extend(common, { + setEnabled: setter(list, "setEnabled", _makeEndpointSelectHandler), + setAnchor: setter(list, "setAnchor", _makeEndpointSelectHandler), + isEnabled: getter(list, "isEnabled"), + deleteEveryConnection: function () { + for (var i = 0, ii = list.length; i < ii; i++) { + list[i].deleteEveryConnection(); + } + }, + "delete": function () { + for (var i = 0, ii = list.length; i < ii; i++) { + _currentInstance.deleteEndpoint(list[i]); + } + } + }); + }; + + this.select = function (params) { + params = params || {}; + params.scope = params.scope || "*"; + return _makeConnectionSelectHandler(params.connections || _currentInstance.getConnections(params, true)); + }; + + this.selectEndpoints = function (params) { + params = params || {}; + params.scope = params.scope || "*"; + var noElementFilters = !params.element && !params.source && !params.target, + elements = noElementFilters ? "*" : prepareList(params.element), + sources = noElementFilters ? "*" : prepareList(params.source), + targets = noElementFilters ? "*" : prepareList(params.target), + scopes = prepareList(params.scope, true); + + var ep = []; + + for (var el in endpointsByElement) { + var either = filterList(elements, el, true), + source = filterList(sources, el, true), + sourceMatchExact = sources !== "*", + target = filterList(targets, el, true), + targetMatchExact = targets !== "*"; + + // if they requested 'either' then just match scope. otherwise if they requested 'source' (not as a wildcard) then we have to match only endpoints that have isSource set to to true, and the same thing with isTarget. + if (either || source || target) { + inner: + for (var i = 0, ii = endpointsByElement[el].length; i < ii; i++) { + var _ep = endpointsByElement[el][i]; + if (filterList(scopes, _ep.scope, true)) { + + var noMatchSource = (sourceMatchExact && sources.length > 0 && !_ep.isSource), + noMatchTarget = (targetMatchExact && targets.length > 0 && !_ep.isTarget); + + if (noMatchSource || noMatchTarget) { + continue inner; + } + + ep.push(_ep); + } + } + } + } + + return _makeEndpointSelectHandler(ep); + }; + + // get all connections managed by the instance of jsplumb. + this.getAllConnections = function () { + return connections; + }; + this.getDefaultScope = function () { + return DEFAULT_SCOPE; + }; + // get an endpoint by uuid. + this.getEndpoint = _getEndpoint; + /** + * Gets the list of Endpoints for a given element. + * @method getEndpoints + * @param {String|Element|Selector} el The element to get endpoints for. + * @return {Endpoint[]} An array of Endpoints for the specified element. + */ + this.getEndpoints = function (el) { + return endpointsByElement[_info(el).id] || []; + }; + // gets the default endpoint type. used when subclassing. see wiki. + this.getDefaultEndpointType = function () { + return jsPlumb.Endpoint; + }; + // gets the default connection type. used when subclassing. see wiki. + this.getDefaultConnectionType = function () { + return jsPlumb.Connection; + }; + /* + * Gets an element's id, creating one if necessary. really only exposed + * for the lib-specific functionality to access; would be better to pass + * the current instance into the lib-specific code (even though this is + * a static call. i just don't want to expose it to the public API). + */ + this.getId = _getId; + this.draw = _draw; + this.info = _info; + + this.appendElement = _appendElement; + + var _hoverSuspended = false; + this.isHoverSuspended = function () { + return _hoverSuspended; + }; + this.setHoverSuspended = function (s) { + _hoverSuspended = s; + }; + + // set an element's connections to be hidden + this.hide = function (el, changeEndpoints) { + _setVisible(el, "none", changeEndpoints); + return _currentInstance; + }; + + // exposed for other objects to use to get a unique id. + this.idstamp = _idstamp; + + // ensure that, if the current container exists, it is a DOM element and not a selector. + // if it does not exist and `candidate` is supplied, the offset parent of that element will be set as the Container. + // this is used to do a better default behaviour for the case that the user has not set a container: + // addEndpoint, makeSource, makeTarget and connect all call this method with the offsetParent of the + // element in question (for connect it is the source element). So if no container is set, it is inferred + // to be the offsetParent of the first element the user tries to connect. + var _ensureContainer = function (candidate) { + if (!_container && candidate) { + var can = _currentInstance.getElement(candidate); + if (can.offsetParent) { + _currentInstance.setContainer(can.offsetParent); + } + } + }; + + var _getContainerFromDefaults = function () { + if (_currentInstance.Defaults.Container) { + _currentInstance.setContainer(_currentInstance.Defaults.Container); + } + }; + + // check if a given element is managed or not. if not, add to our map. if drawing is not suspended then + // we'll also stash its dimensions; otherwise we'll do this in a lazy way through updateOffset. + var _manage = _currentInstance.manage = function (id, element, _transient) { + if (!managedElements[id]) { + managedElements[id] = { + el: element, + endpoints: [], + connections: [] + }; + + managedElements[id].info = _updateOffset({ elId: id, timestamp: _suspendedAt }); + _currentInstance.addClass(element, "jtk-managed"); + if (!_transient) { + _currentInstance.fire("manageElement", { id:id, info:managedElements[id].info, el:element }); + } + } + + return managedElements[id]; + }; + + var _unmanage = _currentInstance.unmanage = function(id) { + if (managedElements[id]) { + _currentInstance.removeClass(managedElements[id].el, "jtk-managed"); + delete managedElements[id]; + _currentInstance.fire("unmanageElement", id); + } + }; + + /** + * updates the offset and size for a given element, and stores the + * values. if 'offset' is not null we use that (it would have been + * passed in from a drag call) because it's faster; but if it is null, + * or if 'recalc' is true in order to force a recalculation, we get the current values. + * @method updateOffset + */ + var _updateOffset = function (params) { + + var timestamp = params.timestamp, recalc = params.recalc, offset = params.offset, elId = params.elId, s; + if (_suspendDrawing && !timestamp) { + timestamp = _suspendedAt; + } + if (!recalc) { + if (timestamp && timestamp === offsetTimestamps[elId]) { + return {o: params.offset || offsets[elId], s: sizes[elId]}; + } + } + if (recalc || (!offset && offsets[elId] == null)) { // if forced repaint or no offset available, we recalculate. + + // get the current size and offset, and store them + s = managedElements[elId] ? managedElements[elId].el : null; + if (s != null) { + sizes[elId] = _currentInstance.getSize(s); + offsets[elId] = _currentInstance.getOffset(s); + offsetTimestamps[elId] = timestamp; + } + } else { + offsets[elId] = offset || offsets[elId]; + if (sizes[elId] == null) { + s = managedElements[elId].el; + if (s != null) { + sizes[elId] = _currentInstance.getSize(s); + } + } + offsetTimestamps[elId] = timestamp; + } + + if (offsets[elId] && !offsets[elId].right) { + offsets[elId].right = offsets[elId].left + sizes[elId][0]; + offsets[elId].bottom = offsets[elId].top + sizes[elId][1]; + offsets[elId].width = sizes[elId][0]; + offsets[elId].height = sizes[elId][1]; + offsets[elId].centerx = offsets[elId].left + (offsets[elId].width / 2); + offsets[elId].centery = offsets[elId].top + (offsets[elId].height / 2); + } + + return {o: offsets[elId], s: sizes[elId]}; + }; + + this.updateOffset = _updateOffset; + + /** + * callback from the current library to tell us to prepare ourselves (attach + * mouse listeners etc; can't do that until the library has provided a bind method) + */ + this.init = function () { + if (!initialized) { + _getContainerFromDefaults(); + _currentInstance.anchorManager = new root.jsPlumb.AnchorManager({jsPlumbInstance: _currentInstance}); + initialized = true; + _currentInstance.fire("ready", _currentInstance); + } + }.bind(this); + + this.log = log; + this.jsPlumbUIComponent = jsPlumbUIComponent; + + /* + * Creates an anchor with the given params. + * + * + * Returns: The newly created Anchor. + * Throws: an error if a named anchor was not found. + */ + this.makeAnchor = function () { + var pp, _a = function (t, p) { + if (root.jsPlumb.Anchors[t]) { + return new root.jsPlumb.Anchors[t](p); + } + if (!_currentInstance.Defaults.DoNotThrowErrors) { + throw { msg: "jsPlumb: unknown anchor type '" + t + "'" }; + } + }; + if (arguments.length === 0) { + return null; + } + var specimen = arguments[0], elementId = arguments[1], jsPlumbInstance = arguments[2], newAnchor = null; + // if it appears to be an anchor already... + if (specimen.compute && specimen.getOrientation) { + return specimen; + } //TODO hazy here about whether it should be added or is already added somehow. + // is it the name of an anchor type? + else if (typeof specimen === "string") { + newAnchor = _a(arguments[0], {elementId: elementId, jsPlumbInstance: _currentInstance}); + } + // is it an array? it will be one of: + // an array of [spec, params] - this defines a single anchor, which may be dynamic, but has parameters. + // an array of arrays - this defines some dynamic anchors + // an array of numbers - this defines a single anchor. + else if (_ju.isArray(specimen)) { + if (_ju.isArray(specimen[0]) || _ju.isString(specimen[0])) { + // if [spec, params] format + if (specimen.length === 2 && _ju.isObject(specimen[1])) { + // if first arg is a string, its a named anchor with params + if (_ju.isString(specimen[0])) { + pp = root.jsPlumb.extend({elementId: elementId, jsPlumbInstance: _currentInstance}, specimen[1]); + newAnchor = _a(specimen[0], pp); + } + // otherwise first arg is array, second is params. we treat as a dynamic anchor, which is fine + // even if the first arg has only one entry. you could argue all anchors should be implicitly dynamic in fact. + else { + pp = root.jsPlumb.extend({elementId: elementId, jsPlumbInstance: _currentInstance, anchors: specimen[0]}, specimen[1]); + newAnchor = new root.jsPlumb.DynamicAnchor(pp); + } + } + else { + newAnchor = new jsPlumb.DynamicAnchor({anchors: specimen, selector: null, elementId: elementId, jsPlumbInstance: _currentInstance}); + } + + } + else { + var anchorParams = { + x: specimen[0], y: specimen[1], + orientation: (specimen.length >= 4) ? [ specimen[2], specimen[3] ] : [0, 0], + offsets: (specimen.length >= 6) ? [ specimen[4], specimen[5] ] : [ 0, 0 ], + elementId: elementId, + jsPlumbInstance: _currentInstance, + cssClass: specimen.length === 7 ? specimen[6] : null + }; + newAnchor = new root.jsPlumb.Anchor(anchorParams); + newAnchor.clone = function () { + return new root.jsPlumb.Anchor(anchorParams); + }; + } + } + + if (!newAnchor.id) { + newAnchor.id = "anchor_" + _idstamp(); + } + return newAnchor; + }; + + /** + * makes a list of anchors from the given list of types or coords, eg + * ["TopCenter", "RightMiddle", "BottomCenter", [0, 1, -1, -1] ] + */ + this.makeAnchors = function (types, elementId, jsPlumbInstance) { + var r = []; + for (var i = 0, ii = types.length; i < ii; i++) { + if (typeof types[i] === "string") { + r.push(root.jsPlumb.Anchors[types[i]]({elementId: elementId, jsPlumbInstance: jsPlumbInstance})); + } + else if (_ju.isArray(types[i])) { + r.push(_currentInstance.makeAnchor(types[i], elementId, jsPlumbInstance)); + } + } + return r; + }; + + /** + * Makes a dynamic anchor from the given list of anchors (which may be in shorthand notation as strings or dimension arrays, or Anchor + * objects themselves) and the given, optional, anchorSelector function (jsPlumb uses a default if this is not provided; most people will + * not need to provide this - i think). + */ + this.makeDynamicAnchor = function (anchors, anchorSelector) { + return new root.jsPlumb.DynamicAnchor({anchors: anchors, selector: anchorSelector, elementId: null, jsPlumbInstance: _currentInstance}); + }; + +// --------------------- makeSource/makeTarget ---------------------------------------------- + + this.targetEndpointDefinitions = {}; + this.sourceEndpointDefinitions = {}; + + var selectorFilter = function (evt, _el, selector, _instance, negate) { + var t = evt.target || evt.srcElement, ok = false, + sel = _instance.getSelector(_el, selector); + for (var j = 0; j < sel.length; j++) { + if (sel[j] === t) { + ok = true; + break; + } + } + return negate ? !ok : ok; + }; + + var _makeElementDropHandler = function (elInfo, p, dropOptions, isSource, isTarget) { + var proxyComponent = new jsPlumbUIComponent(p); + var _drop = p._jsPlumb.EndpointDropHandler({ + jsPlumb: _currentInstance, + enabled: function () { + return elInfo.def.enabled; + }, + isFull: function () { + var targetCount = _currentInstance.select({target: elInfo.id}).length; + return elInfo.def.maxConnections > 0 && targetCount >= elInfo.def.maxConnections; + }, + element: elInfo.el, + elementId: elInfo.id, + isSource: isSource, + isTarget: isTarget, + addClass: function (clazz) { + _currentInstance.addClass(elInfo.el, clazz); + }, + removeClass: function (clazz) { + _currentInstance.removeClass(elInfo.el, clazz); + }, + onDrop: function (jpc) { + var source = jpc.endpoints[0]; + source.anchor.unlock(); + }, + isDropAllowed: function () { + return proxyComponent.isDropAllowed.apply(proxyComponent, arguments); + }, + isRedrop:function(jpc) { + return (jpc.suspendedElement != null && jpc.suspendedEndpoint != null && jpc.suspendedEndpoint.element === elInfo.el); + }, + getEndpoint: function (jpc) { + + // make a new Endpoint for the target, or get it from the cache if uniqueEndpoint + // is set. if its a redrop the new endpoint will be immediately cleaned up. + + var newEndpoint = elInfo.def.endpoint; + + // if no cached endpoint, or there was one but it has been cleaned up + // (ie. detached), create a new one + if (newEndpoint == null || newEndpoint._jsPlumb == null) { + var eps = _currentInstance.deriveEndpointAndAnchorSpec(jpc.getType().join(" "), true); + var pp = eps.endpoints ? root.jsPlumb.extend(p, { + endpoint:elInfo.def.def.endpoint || eps.endpoints[1] + }) :p; + if (eps.anchors) { + pp = root.jsPlumb.extend(pp, { + anchor:elInfo.def.def.anchor || eps.anchors[1] + }); + } + newEndpoint = _currentInstance.addEndpoint(elInfo.el, pp); + newEndpoint._mtNew = true; + } + + if (p.uniqueEndpoint) { + elInfo.def.endpoint = newEndpoint; + } + + newEndpoint.setDeleteOnEmpty(true); + + // if connection is detachable, init the new endpoint to be draggable, to support that happening. + if (jpc.isDetachable()) { + newEndpoint.initDraggable(); + } + + // if the anchor has a 'positionFinder' set, then delegate to that function to find + // out where to locate the anchor. + if (newEndpoint.anchor.positionFinder != null) { + var dropPosition = _currentInstance.getUIPosition(arguments, _currentInstance.getZoom()), + elPosition = _currentInstance.getOffset(elInfo.el), + elSize = _currentInstance.getSize(elInfo.el), + ap = dropPosition == null ? [0,0] : newEndpoint.anchor.positionFinder(dropPosition, elPosition, elSize, newEndpoint.anchor.constructorParams); + + newEndpoint.anchor.x = ap[0]; + newEndpoint.anchor.y = ap[1]; + // now figure an orientation for it..kind of hard to know what to do actually. probably the best thing i can do is to + // support specifying an orientation in the anchor's spec. if one is not supplied then i will make the orientation + // be what will cause the most natural link to the source: it will be pointing at the source, but it needs to be + // specified in one axis only, and so how to make that choice? i think i will use whichever axis is the one in which + // the target is furthest away from the source. + } + + return newEndpoint; + }, + maybeCleanup: function (ep) { + if (ep._mtNew && ep.connections.length === 0) { + _currentInstance.deleteObject({endpoint: ep}); + } + else { + delete ep._mtNew; + } + } + }); + + // wrap drop events as needed and initialise droppable + var dropEvent = root.jsPlumb.dragEvents.drop; + dropOptions.scope = dropOptions.scope || (p.scope || _currentInstance.Defaults.Scope); + dropOptions[dropEvent] = _ju.wrap(dropOptions[dropEvent], _drop, true); + dropOptions.rank = p.rank || 0; + + // if target, return true from the over event. this will cause katavorio to stop setting drops to hover + // if multipleDrop is set to false. + if (isTarget) { + dropOptions[root.jsPlumb.dragEvents.over] = function () { return true; }; + } + + // vanilla jsplumb only + if (p.allowLoopback === false) { + dropOptions.canDrop = function (_drag) { + var de = _drag.getDragElement()._jsPlumbRelatedElement; + return de !== elInfo.el; + }; + } + _currentInstance.initDroppable(elInfo.el, dropOptions, "internal"); + + return _drop; + + }; + + // see API docs + this.makeTarget = function (el, params, referenceParams) { + + // put jsplumb ref into params without altering the params passed in + var p = root.jsPlumb.extend({_jsPlumb: this}, referenceParams); + root.jsPlumb.extend(p, params); + + var maxConnections = p.maxConnections || -1, + + _doOne = function (el) { + + // get the element's id and store the endpoint definition for it. jsPlumb.connect calls will look for one of these, + // and use the endpoint definition if found. + // decode the info for this element (id and element) + var elInfo = _info(el), + elid = elInfo.id, + dropOptions = root.jsPlumb.extend({}, p.dropOptions || {}), + type = p.connectionType || "default"; + + this.targetEndpointDefinitions[elid] = this.targetEndpointDefinitions[elid] || {}; + + _ensureContainer(elid); + + // if this is a group and the user has not mandated a rank, set to -1 so that Nodes takes + // precedence. + if (elInfo.el._isJsPlumbGroup && dropOptions.rank == null) { + dropOptions.rank = -1; + } + + // store the definition + var _def = { + def: root.jsPlumb.extend({}, p), + uniqueEndpoint: p.uniqueEndpoint, + maxConnections: maxConnections, + enabled: true + }; + + if (p.createEndpoint) { + _def.uniqueEndpoint = true; + _def.endpoint = _currentInstance.addEndpoint(el, _def.def); + _def.endpoint.setDeleteOnEmpty(false); + } + + elInfo.def = _def; + this.targetEndpointDefinitions[elid][type] = _def; + _makeElementDropHandler(elInfo, p, dropOptions, p.isSource === true, true); + // stash the definition on the drop + elInfo.el._katavorioDrop[elInfo.el._katavorioDrop.length - 1].targetDef = _def; + + }.bind(this); + + // make an array if only given one element + var inputs = el.length && el.constructor !== String ? el : [ el ]; + + // register each one in the list. + for (var i = 0, ii = inputs.length; i < ii; i++) { + _doOne(inputs[i]); + } + + return this; + }; + + // see api docs + this.unmakeTarget = function (el, doNotClearArrays) { + var info = _info(el); + _currentInstance.destroyDroppable(info.el, "internal"); + if (!doNotClearArrays) { + delete this.targetEndpointDefinitions[info.id]; + } + + return this; + }; + + // see api docs + this.makeSource = function (el, params, referenceParams) { + var p = root.jsPlumb.extend({_jsPlumb: this}, referenceParams); + root.jsPlumb.extend(p, params); + var type = p.connectionType || "default"; + var aae = _currentInstance.deriveEndpointAndAnchorSpec(type); + p.endpoint = p.endpoint || aae.endpoints[0]; + p.anchor = p.anchor || aae.anchors[0]; + var maxConnections = p.maxConnections || -1, + onMaxConnections = p.onMaxConnections, + _doOne = function (elInfo) { + // get the element's id and store the endpoint definition for it. jsPlumb.connect calls will look for one of these, + // and use the endpoint definition if found. + var elid = elInfo.id, + _del = this.getElement(elInfo.el); + + this.sourceEndpointDefinitions[elid] = this.sourceEndpointDefinitions[elid] || {}; + _ensureContainer(elid); + + var _def = { + def:root.jsPlumb.extend({}, p), + uniqueEndpoint: p.uniqueEndpoint, + maxConnections: maxConnections, + enabled: true + }; + + if (p.createEndpoint) { + _def.uniqueEndpoint = true; + _def.endpoint = _currentInstance.addEndpoint(el, _def.def); + _def.endpoint.setDeleteOnEmpty(false); + } + + this.sourceEndpointDefinitions[elid][type] = _def; + elInfo.def = _def; + + var stopEvent = root.jsPlumb.dragEvents.stop, + dragEvent = root.jsPlumb.dragEvents.drag, + dragOptions = root.jsPlumb.extend({ }, p.dragOptions || {}), + existingDrag = dragOptions.drag, + existingStop = dragOptions.stop, + ep = null, + endpointAddedButNoDragYet = false; + + // set scope if its not set in dragOptions but was passed in in params + dragOptions.scope = dragOptions.scope || p.scope; + + dragOptions[dragEvent] = _ju.wrap(dragOptions[dragEvent], function () { + if (existingDrag) { + existingDrag.apply(this, arguments); + } + endpointAddedButNoDragYet = false; + }); + + dragOptions[stopEvent] = _ju.wrap(dragOptions[stopEvent], function () { + + if (existingStop) { + existingStop.apply(this, arguments); + } + this.currentlyDragging = false; + if (ep._jsPlumb != null) { // if not cleaned up... + + // reset the anchor to the anchor that was initially provided. the one we were using to drag + // the connection was just a placeholder that was located at the place the user pressed the + // mouse button to initiate the drag. + var anchorDef = p.anchor || this.Defaults.Anchor, + oldAnchor = ep.anchor, + oldConnection = ep.connections[0]; + + var newAnchor = this.makeAnchor(anchorDef, elid, this), + _el = ep.element; + + // if the anchor has a 'positionFinder' set, then delegate to that function to find + // out where to locate the anchor. issue 117. + if (newAnchor.positionFinder != null) { + var elPosition = _currentInstance.getOffset(_el), + elSize = this.getSize(_el), + dropPosition = { left: elPosition.left + (oldAnchor.x * elSize[0]), top: elPosition.top + (oldAnchor.y * elSize[1]) }, + ap = newAnchor.positionFinder(dropPosition, elPosition, elSize, newAnchor.constructorParams); + + newAnchor.x = ap[0]; + newAnchor.y = ap[1]; + } + + ep.setAnchor(newAnchor, true); + ep.repaint(); + this.repaint(ep.elementId); + if (oldConnection != null) { + this.repaint(oldConnection.targetId); + } + } + }.bind(this)); + + // when the user presses the mouse, add an Endpoint, if we are enabled. + var mouseDownListener = function (e) { + // on right mouse button, abort. + if (e.which === 3 || e.button === 2) { + return; + } + + // TODO store def on element. + var def = this.sourceEndpointDefinitions[elid][type]; + + // if disabled, return. + if (!def.enabled) { + return; + } + + elid = this.getId(this.getElement(elInfo.el)); // elid might have changed since this method was called to configure the element. + + // if a filter was given, run it, and return if it says no. + if (p.filter) { + var r = _ju.isString(p.filter) ? selectorFilter(e, elInfo.el, p.filter, this, p.filterExclude) : p.filter(e, elInfo.el); + if (r === false) { + return; + } + } + + // if maxConnections reached + var sourceCount = this.select({source: elid}).length; + if (def.maxConnections >= 0 && (sourceCount >= def.maxConnections)) { + if (onMaxConnections) { + onMaxConnections({ + element: elInfo.el, + maxConnections: maxConnections + }, e); + } + return false; + } + + // find the position on the element at which the mouse was pressed; this is where the endpoint + // will be located. + var elxy = root.jsPlumb.getPositionOnElement(e, _del, _zoom); + + // we need to override the anchor in here, and force 'isSource', but we don't want to mess with + // the params passed in, because after a connection is established we're going to reset the endpoint + // to have the anchor we were given. + var tempEndpointParams = {}; + root.jsPlumb.extend(tempEndpointParams, p); + tempEndpointParams.isTemporarySource = true; + tempEndpointParams.anchor = [ elxy[0], elxy[1] , 0, 0]; + tempEndpointParams.dragOptions = dragOptions; + + if (def.def.scope) { + tempEndpointParams.scope = def.def.scope; + } + + ep = this.addEndpoint(elid, tempEndpointParams); + endpointAddedButNoDragYet = true; + ep.setDeleteOnEmpty(true); + + // if unique endpoint and it's already been created, push it onto the endpoint we create. at the end + // of a successful connection we'll switch to that endpoint. + // TODO this is the same code as the programmatic endpoints create on line 1050 ish + if (def.uniqueEndpoint) { + if (!def.endpoint) { + def.endpoint = ep; + ep.setDeleteOnEmpty(false); + } + else { + ep.finalEndpoint = def.endpoint; + } + } + + var _delTempEndpoint = function () { + // this mouseup event is fired only if no dragging occurred, by jquery and yui, but for mootools + // it is fired even if dragging has occurred, in which case we would blow away a perfectly + // legitimate endpoint, were it not for this check. the flag is set after adding an + // endpoint and cleared in a drag listener we set in the dragOptions above. + _currentInstance.off(ep.canvas, "mouseup", _delTempEndpoint); + _currentInstance.off(elInfo.el, "mouseup", _delTempEndpoint); + if (endpointAddedButNoDragYet) { + endpointAddedButNoDragYet = false; + _currentInstance.deleteEndpoint(ep); + } + }; + + _currentInstance.on(ep.canvas, "mouseup", _delTempEndpoint); + _currentInstance.on(elInfo.el, "mouseup", _delTempEndpoint); + + // optionally check for attributes to extract from the source element + var payload = {}; + if (def.def.extract) { + for (var att in def.def.extract) { + var v = (e.srcElement || e.target).getAttribute(att); + if (v) { + payload[def.def.extract[att]] = v; + } + } + } + + // and then trigger its mousedown event, which will kick off a drag, which will start dragging + // a new connection from this endpoint. + _currentInstance.trigger(ep.canvas, "mousedown", e, payload); + + _ju.consume(e); + + }.bind(this); + + this.on(elInfo.el, "mousedown", mouseDownListener); + _def.trigger = mouseDownListener; + + // if a filter was provided, set it as a dragFilter on the element, + // to prevent the element drag function from kicking in when we want to + // drag a new connection + if (p.filter && (_ju.isString(p.filter) || _ju.isFunction(p.filter))) { + _currentInstance.setDragFilter(elInfo.el, p.filter); + } + + var dropOptions = root.jsPlumb.extend({}, p.dropOptions || {}); + + _makeElementDropHandler(elInfo, p, dropOptions, true, p.isTarget === true); + + }.bind(this); + + var inputs = el.length && el.constructor !== String ? el : [ el ]; + for (var i = 0, ii = inputs.length; i < ii; i++) { + _doOne(_info(inputs[i])); + } + + return this; + }; + + // see api docs + this.unmakeSource = function (el, connectionType, doNotClearArrays) { + var info = _info(el); + _currentInstance.destroyDroppable(info.el, "internal"); + var eldefs = this.sourceEndpointDefinitions[info.id]; + if (eldefs) { + for (var def in eldefs) { + if (connectionType == null || connectionType === def) { + var mouseDownListener = eldefs[def].trigger; + if (mouseDownListener) { + _currentInstance.off(info.el, "mousedown", mouseDownListener); + } + if (!doNotClearArrays) { + delete this.sourceEndpointDefinitions[info.id][def]; + } + } + } + } + + return this; + }; + + // see api docs + this.unmakeEverySource = function () { + for (var i in this.sourceEndpointDefinitions) { + _currentInstance.unmakeSource(i, null, true); + } + + this.sourceEndpointDefinitions = {}; + return this; + }; + + var _getScope = function (el, types, connectionType) { + types = _ju.isArray(types) ? types : [ types ]; + var id = _getId(el); + connectionType = connectionType || "default"; + for (var i = 0; i < types.length; i++) { + var eldefs = this[types[i]][id]; + if (eldefs && eldefs[connectionType]) { + return eldefs[connectionType].def.scope || this.Defaults.Scope; + } + } + }.bind(this); + + var _setScope = function (el, scope, types, connectionType) { + types = _ju.isArray(types) ? types : [ types ]; + var id = _getId(el); + connectionType = connectionType || "default"; + for (var i = 0; i < types.length; i++) { + var eldefs = this[types[i]][id]; + if (eldefs && eldefs[connectionType]) { + eldefs[connectionType].def.scope = scope; + } + } + + }.bind(this); + + this.getScope = function (el, scope) { + return _getScope(el, [ "sourceEndpointDefinitions", "targetEndpointDefinitions" ]); + }; + this.getSourceScope = function (el) { + return _getScope(el, "sourceEndpointDefinitions"); + }; + this.getTargetScope = function (el) { + return _getScope(el, "targetEndpointDefinitions"); + }; + this.setScope = function (el, scope, connectionType) { + this.setSourceScope(el, scope, connectionType); + this.setTargetScope(el, scope, connectionType); + }; + this.setSourceScope = function (el, scope, connectionType) { + _setScope(el, scope, "sourceEndpointDefinitions", connectionType); + // we get the source scope during the mousedown event, but we also want to set this. + this.setDragScope(el, scope); + }; + this.setTargetScope = function (el, scope, connectionType) { + _setScope(el, scope, "targetEndpointDefinitions", connectionType); + this.setDropScope(el, scope); + }; + + // see api docs + this.unmakeEveryTarget = function () { + for (var i in this.targetEndpointDefinitions) { + _currentInstance.unmakeTarget(i, true); + } + + this.targetEndpointDefinitions = {}; + return this; + }; + + // does the work of setting a source enabled or disabled. + var _setEnabled = function (type, el, state, toggle, connectionType) { + var a = type === "source" ? this.sourceEndpointDefinitions : this.targetEndpointDefinitions, + originalState, info, newState; + + connectionType = connectionType || "default"; + + // a selector or an array + if (el.length && !_ju.isString(el)) { + originalState = []; + for (var i = 0, ii = el.length; i < ii; i++) { + info = _info(el[i]); + if (a[info.id] && a[info.id][connectionType]) { + originalState[i] = a[info.id][connectionType].enabled; + newState = toggle ? !originalState[i] : state; + a[info.id][connectionType].enabled = newState; + _currentInstance[newState ? "removeClass" : "addClass"](info.el, "jtk-" + type + "-disabled"); + } + } + } + // otherwise a DOM element or a String ID. + else { + info = _info(el); + var id = info.id; + if (a[id] && a[id][connectionType]) { + originalState = a[id][connectionType].enabled; + newState = toggle ? !originalState : state; + a[id][connectionType].enabled = newState; + _currentInstance[newState ? "removeClass" : "addClass"](info.el, "jtk-" + type + "-disabled"); + } + } + return originalState; + }.bind(this); + + var _first = function (el, fn) { + if (_ju.isString(el) || !el.length) { + return fn.apply(this, [ el ]); + } + else if (el.length) { + return fn.apply(this, [ el[0] ]); + } + + }.bind(this); + + this.toggleSourceEnabled = function (el, connectionType) { + _setEnabled("source", el, null, true, connectionType); + return this.isSourceEnabled(el, connectionType); + }; + + this.setSourceEnabled = function (el, state, connectionType) { + return _setEnabled("source", el, state, null, connectionType); + }; + this.isSource = function (el, connectionType) { + connectionType = connectionType || "default"; + return _first(el, function (_el) { + var eldefs = this.sourceEndpointDefinitions[_info(_el).id]; + return eldefs != null && eldefs[connectionType] != null; + }.bind(this)); + }; + this.isSourceEnabled = function (el, connectionType) { + connectionType = connectionType || "default"; + return _first(el, function (_el) { + var sep = this.sourceEndpointDefinitions[_info(_el).id]; + return sep && sep[connectionType] && sep[connectionType].enabled === true; + }.bind(this)); + }; + + this.toggleTargetEnabled = function (el, connectionType) { + _setEnabled("target", el, null, true, connectionType); + return this.isTargetEnabled(el, connectionType); + }; + + this.isTarget = function (el, connectionType) { + connectionType = connectionType || "default"; + return _first(el, function (_el) { + var eldefs = this.targetEndpointDefinitions[_info(_el).id]; + return eldefs != null && eldefs[connectionType] != null; + }.bind(this)); + }; + this.isTargetEnabled = function (el, connectionType) { + connectionType = connectionType || "default"; + return _first(el, function (_el) { + var tep = this.targetEndpointDefinitions[_info(_el).id]; + return tep && tep[connectionType] && tep[connectionType].enabled === true; + }.bind(this)); + }; + this.setTargetEnabled = function (el, state, connectionType) { + return _setEnabled("target", el, state, null, connectionType); + }; + +// --------------------- end makeSource/makeTarget ---------------------------------------------- + + this.ready = function (fn) { + _currentInstance.bind("ready", fn); + }; + + var _elEach = function(el, fn) { + // support both lists... + if (typeof el === 'object' && el.length) { + for (var i = 0, ii = el.length; i < ii; i++) { + fn(el[i]); + } + } + else {// ...and single strings or elements. + fn(el); + } + + return _currentInstance; + }; + + // repaint some element's endpoints and connections + this.repaint = function (el, ui, timestamp) { + return _elEach(el, function(_el) { + _draw(_el, ui, timestamp); + }); + }; + + this.revalidate = function (el, timestamp, isIdAlready) { + return _elEach(el, function(_el) { + var elId = isIdAlready ? _el : _currentInstance.getId(_el); + _currentInstance.updateOffset({ elId: elId, recalc: true, timestamp:timestamp }); + var dm = _currentInstance.getDragManager(); + if (dm) { + dm.updateOffsets(elId); + } + _currentInstance.repaint(_el); + }); + }; + + // repaint every endpoint and connection. + this.repaintEverything = function () { + // TODO this timestamp causes continuous anchors to not repaint properly. + // fix this. do not just take out the timestamp. it runs a lot faster with + // the timestamp included. + var timestamp = _timestamp(), elId; + + for (elId in endpointsByElement) { + _currentInstance.updateOffset({ elId: elId, recalc: true, timestamp: timestamp }); + } + + for (elId in endpointsByElement) { + _draw(elId, null, timestamp); + } + + return this; + }; + + this.removeAllEndpoints = function (el, recurse, affectedElements) { + affectedElements = affectedElements || []; + var _one = function (_el) { + var info = _info(_el), + ebe = endpointsByElement[info.id], + i, ii; + + if (ebe) { + affectedElements.push(info); + for (i = 0, ii = ebe.length; i < ii; i++) { + _currentInstance.deleteEndpoint(ebe[i], false); + } + } + delete endpointsByElement[info.id]; + + if (recurse) { + if (info.el && info.el.nodeType !== 3 && info.el.nodeType !== 8) { + for (i = 0, ii = info.el.childNodes.length; i < ii; i++) { + _one(info.el.childNodes[i]); + } + } + } + + }; + _one(el); + return this; + }; + + var _doRemove = function(info, affectedElements) { + _currentInstance.removeAllEndpoints(info.id, true, affectedElements); + var dm = _currentInstance.getDragManager(); + var _one = function(_info) { + + if (dm) { + dm.elementRemoved(_info.id); + } + _currentInstance.anchorManager.clearFor(_info.id); + _currentInstance.anchorManager.removeFloatingConnection(_info.id); + + if (_currentInstance.isSource(_info.el)) { + _currentInstance.unmakeSource(_info.el); + } + if (_currentInstance.isTarget(_info.el)) { + _currentInstance.unmakeTarget(_info.el); + } + _currentInstance.destroyDraggable(_info.el); + _currentInstance.destroyDroppable(_info.el); + + + delete _currentInstance.floatingConnections[_info.id]; + delete managedElements[_info.id]; + delete offsets[_info.id]; + if (_info.el) { + _currentInstance.removeElement(_info.el); + _info.el._jsPlumb = null; + } + }; + + // remove all affected child elements + for (var ae = 1; ae < affectedElements.length; ae++) { + _one(affectedElements[ae]); + } + // and always remove the requested one from the dom. + _one(info); + }; + + /** + * Remove the given element, including cleaning up all endpoints registered for it. + * This is exposed in the public API but also used internally by jsPlumb when removing the + * element associated with a connection drag. + */ + this.remove = function (el, doNotRepaint) { + var info = _info(el), affectedElements = []; + if (info.text) { + info.el.parentNode.removeChild(info.el); + } + else if (info.id) { + _currentInstance.batch(function () { + _doRemove(info, affectedElements); + }, doNotRepaint === true); + } + return _currentInstance; + }; + + this.empty = function (el, doNotRepaint) { + var affectedElements = []; + var _one = function(el, dontRemoveFocus) { + var info = _info(el); + if (info.text) { + info.el.parentNode.removeChild(info.el); + } + else if (info.el) { + while(info.el.childNodes.length > 0) { + _one(info.el.childNodes[0]); + } + if (!dontRemoveFocus) { + _doRemove(info, affectedElements); + } + } + }; + + _currentInstance.batch(function() { + _one(el, true); + }, doNotRepaint === false); + + return _currentInstance; + }; + + this.reset = function (doNotUnbindInstanceEventListeners) { + _currentInstance.silently(function() { + _hoverSuspended = false; + _currentInstance.removeAllGroups(); + _currentInstance.removeGroupManager(); + _currentInstance.deleteEveryEndpoint(); + if (!doNotUnbindInstanceEventListeners) { + _currentInstance.unbind(); + } + this.targetEndpointDefinitions = {}; + this.sourceEndpointDefinitions = {}; + connections.length = 0; + if (this.doReset) { + this.doReset(); + } + }.bind(this)); + }; + + var _clearObject = function (obj) { + if (obj.canvas && obj.canvas.parentNode) { + obj.canvas.parentNode.removeChild(obj.canvas); + } + obj.cleanup(); + obj.destroy(); + }; + + this.clear = function () { + _currentInstance.select().each(_clearObject); + _currentInstance.selectEndpoints().each(_clearObject); + + endpointsByElement = {}; + endpointsByUUID = {}; + }; + + this.setDefaultScope = function (scope) { + DEFAULT_SCOPE = scope; + return _currentInstance; + }; + + this.deriveEndpointAndAnchorSpec = function(type, dontPrependDefault) { + var bits = ((dontPrependDefault ? "" : "default ") + type).split(/[\s]/), eps = null, ep = null, a = null, as = null; + for (var i = 0; i < bits.length; i++) { + var _t = _currentInstance.getType(bits[i], "connection"); + if (_t) { + if (_t.endpoints) { + eps = _t.endpoints; + } + if (_t.endpoint) { + ep = _t.endpoint; + } + if (_t.anchors) { + as = _t.anchors; + } + if (_t.anchor) { + a = _t.anchor; + } + } + } + return { endpoints: eps ? eps : [ ep, ep ], anchors: as ? as : [a, a ]}; + }; + + // sets the id of some element, changing whatever we need to to keep track. + this.setId = function (el, newId, doNotSetAttribute) { + // + var id; + + if (_ju.isString(el)) { + id = el; + } + else { + el = this.getElement(el); + id = this.getId(el); + } + + var sConns = this.getConnections({source: id, scope: '*'}, true), + tConns = this.getConnections({target: id, scope: '*'}, true); + + newId = "" + newId; + + if (!doNotSetAttribute) { + el = this.getElement(id); + this.setAttribute(el, "id", newId); + } + else { + el = this.getElement(newId); + } + + endpointsByElement[newId] = endpointsByElement[id] || []; + for (var i = 0, ii = endpointsByElement[newId].length; i < ii; i++) { + endpointsByElement[newId][i].setElementId(newId); + endpointsByElement[newId][i].setReferenceElement(el); + } + delete endpointsByElement[id]; + + this.sourceEndpointDefinitions[newId] = this.sourceEndpointDefinitions[id]; + delete this.sourceEndpointDefinitions[id]; + this.targetEndpointDefinitions[newId] = this.targetEndpointDefinitions[id]; + delete this.targetEndpointDefinitions[id]; + + this.anchorManager.changeId(id, newId); + var dm = this.getDragManager(); + if (dm) { + dm.changeId(id, newId); + } + managedElements[newId] = managedElements[id]; + delete managedElements[id]; + + var _conns = function (list, epIdx, type) { + for (var i = 0, ii = list.length; i < ii; i++) { + list[i].endpoints[epIdx].setElementId(newId); + list[i].endpoints[epIdx].setReferenceElement(el); + list[i][type + "Id"] = newId; + list[i][type] = el; + } + }; + _conns(sConns, 0, "source"); + _conns(tConns, 1, "target"); + + this.repaint(newId); + }; + + this.setDebugLog = function (debugLog) { + log = debugLog; + }; + + this.setSuspendDrawing = function (val, repaintAfterwards) { + var curVal = _suspendDrawing; + _suspendDrawing = val; + if (val) { + _suspendedAt = new Date().getTime(); + } else { + _suspendedAt = null; + } + if (repaintAfterwards) { + this.repaintEverything(); + } + return curVal; + }; + + // returns whether or not drawing is currently suspended. + this.isSuspendDrawing = function () { + return _suspendDrawing; + }; + + // return timestamp for when drawing was suspended. + this.getSuspendedAt = function () { + return _suspendedAt; + }; + + this.batch = function (fn, doNotRepaintAfterwards) { + var _wasSuspended = this.isSuspendDrawing(); + if (!_wasSuspended) { + this.setSuspendDrawing(true); + } + try { + fn(); + } + catch (e) { + _ju.log("Function run while suspended failed", e); + } + if (!_wasSuspended) { + this.setSuspendDrawing(false, !doNotRepaintAfterwards); + } + }; + + this.doWhileSuspended = this.batch; + + this.getCachedData = _getCachedData; + this.timestamp = _timestamp; + this.show = function (el, changeEndpoints) { + _setVisible(el, "block", changeEndpoints); + return _currentInstance; + }; + + // TODO: update this method to return the current state. + this.toggleVisible = _toggleVisible; + this.addListener = this.bind; + + var floatingConnections = []; + this.registerFloatingConnection = function(info, conn, ep) { + floatingConnections[info.id] = conn; + // only register for the target endpoint; we will not be dragging the source at any time + // before this connection is either discarded or made into a permanent connection. + _ju.addToList(endpointsByElement, info.id, ep); + }; + this.getFloatingConnectionFor = function(id) { + return floatingConnections[id]; + }; + }; + + _ju.extend(root.jsPlumbInstance, _ju.EventGenerator, { + setAttribute: function (el, a, v) { + this.setAttribute(el, a, v); + }, + getAttribute: function (el, a) { + return this.getAttribute(root.jsPlumb.getElement(el), a); + }, + convertToFullOverlaySpec: function(spec) { + if (_ju.isString(spec)) { + spec = [ spec, { } ]; + } + spec[1].id = spec[1].id || _ju.uuid(); + return spec; + }, + registerConnectionType: function (id, type) { + this._connectionTypes[id] = root.jsPlumb.extend({}, type); + if (type.overlays) { + var to = {}; + for (var i = 0; i < type.overlays.length; i++) { + // if a string, convert to object representation so that we can store the typeid on it. + // also assign an id. + var fo = this.convertToFullOverlaySpec(type.overlays[i]); + to[fo[1].id] = fo; + } + this._connectionTypes[id].overlays = to; + } + }, + registerConnectionTypes: function (types) { + for (var i in types) { + this.registerConnectionType(i, types[i]); + } + }, + registerEndpointType: function (id, type) { + this._endpointTypes[id] = root.jsPlumb.extend({}, type); + if (type.overlays) { + var to = {}; + for (var i = 0; i < type.overlays.length; i++) { + // if a string, convert to object representation so that we can store the typeid on it. + // also assign an id. + var fo = this.convertToFullOverlaySpec(type.overlays[i]); + to[fo[1].id] = fo; + } + this._endpointTypes[id].overlays = to; + } + }, + registerEndpointTypes: function (types) { + for (var i in types) { + this.registerEndpointType(i, types[i]); + } + }, + getType: function (id, typeDescriptor) { + return typeDescriptor === "connection" ? this._connectionTypes[id] : this._endpointTypes[id]; + }, + setIdChanged: function (oldId, newId) { + this.setId(oldId, newId, true); + }, + // set parent: change the parent for some node and update all the registrations we need to. + setParent: function (el, newParent) { + var _dom = this.getElement(el), + _id = this.getId(_dom), + _pdom = this.getElement(newParent), + _pid = this.getId(_pdom), + dm = this.getDragManager(); + + _dom.parentNode.removeChild(_dom); + _pdom.appendChild(_dom); + if (dm) { + dm.setParent(_dom, _id, _pdom, _pid); + } + }, + extend: function (o1, o2, names) { + var i; + if (names) { + for (i = 0; i < names.length; i++) { + o1[names[i]] = o2[names[i]]; + } + } + else { + for (i in o2) { + o1[i] = o2[i]; + } + } + + return o1; + }, + floatingConnections: {}, + getFloatingAnchorIndex: function (jpc) { + return jpc.endpoints[0].isFloating() ? 0 : jpc.endpoints[1].isFloating() ? 1 : -1; + } + }); + +// --------------------- static instance + module registration ------------------------------------------- + +// create static instance and assign to window if window exists. + var jsPlumb = new jsPlumbInstance(); + // register on 'root' (lets us run on server or browser) + root.jsPlumb = jsPlumb; + // add 'getInstance' method to static instance + jsPlumb.getInstance = function (_defaults, overrideFns) { + var j = new jsPlumbInstance(_defaults); + if (overrideFns) { + for (var ovf in overrideFns) { + j[ovf] = overrideFns[ovf]; + } + } + j.init(); + return j; + }; + jsPlumb.each = function (spec, fn) { + if (spec == null) { + return; + } + if (typeof spec === "string") { + fn(jsPlumb.getElement(spec)); + } + else if (spec.length != null) { + for (var i = 0; i < spec.length; i++) { + fn(jsPlumb.getElement(spec[i])); + } + } + else { + fn(spec); + } // assume it's an element. + }; + + // CommonJS + if (typeof exports !== 'undefined') { + exports.jsPlumb = jsPlumb; + } + +// --------------------- end static instance + AMD registration ------------------------------------------- + +}).call(typeof window !== 'undefined' ? window : this); + +/* + * 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +;(function() { + + "use strict"; + var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil; + + // ------------------------------ BEGIN OverlayCapablejsPlumbUIComponent -------------------------------------------- + + var _internalLabelOverlayId = "__label", + // this is a shortcut helper method to let people add a label as + // overlay. + _makeLabelOverlay = function (component, params) { + + var _params = { + cssClass: params.cssClass, + labelStyle: component.labelStyle, + id: _internalLabelOverlayId, + component: component, + _jsPlumb: component._jsPlumb.instance // TODO not necessary, since the instance can be accessed through the component. + }, + mergedParams = _jp.extend(_params, params); + + return new _jp.Overlays[component._jsPlumb.instance.getRenderMode()].Label(mergedParams); + }, + _processOverlay = function (component, o) { + var _newOverlay = null; + if (_ju.isArray(o)) { // this is for the shorthand ["Arrow", { width:50 }] syntax + // there's also a three arg version: + // ["Arrow", { width:50 }, {location:0.7}] + // which merges the 3rd arg into the 2nd. + var type = o[0], + // make a copy of the object so as not to mess up anyone else's reference... + p = _jp.extend({component: component, _jsPlumb: component._jsPlumb.instance}, o[1]); + if (o.length === 3) { + _jp.extend(p, o[2]); + } + _newOverlay = new _jp.Overlays[component._jsPlumb.instance.getRenderMode()][type](p); + } else if (o.constructor === String) { + _newOverlay = new _jp.Overlays[component._jsPlumb.instance.getRenderMode()][o]({component: component, _jsPlumb: component._jsPlumb.instance}); + } else { + _newOverlay = o; + } + + _newOverlay.id = _newOverlay.id || _ju.uuid(); + component.cacheTypeItem("overlay", _newOverlay, _newOverlay.id); + component._jsPlumb.overlays[_newOverlay.id] = _newOverlay; + + return _newOverlay; + }; + + _jp.OverlayCapableJsPlumbUIComponent = function (params) { + + root.jsPlumbUIComponent.apply(this, arguments); + this._jsPlumb.overlays = {}; + this._jsPlumb.overlayPositions = {}; + + if (params.label) { + this.getDefaultType().overlays[_internalLabelOverlayId] = ["Label", { + label: params.label, + location: params.labelLocation || this.defaultLabelLocation || 0.5, + labelStyle: params.labelStyle || this._jsPlumb.instance.Defaults.LabelStyle, + id:_internalLabelOverlayId + }]; + } + + this.setListenerComponent = function (c) { + if (this._jsPlumb) { + for (var i in this._jsPlumb.overlays) { + this._jsPlumb.overlays[i].setListenerComponent(c); + } + } + }; + }; + + _jp.OverlayCapableJsPlumbUIComponent.applyType = function (component, t) { + if (t.overlays) { + // loop through the ones in the type. if already present on the component, + // dont remove or re-add. + var keep = {}, i; + + for (i in t.overlays) { + + var existing = component._jsPlumb.overlays[t.overlays[i][1].id]; + if (existing) { + // maybe update from data, if there were parameterised values for instance. + existing.updateFrom(t.overlays[i][1]); + keep[t.overlays[i][1].id] = true; + } + else { + var c = component.getCachedTypeItem("overlay", t.overlays[i][1].id); + if (c != null) { + c.reattach(component._jsPlumb.instance, component); + c.setVisible(true); + // maybe update from data, if there were parameterised values for instance. + c.updateFrom(t.overlays[i][1]); + component._jsPlumb.overlays[c.id] = c; + } + else { + c = component.addOverlay(t.overlays[i], true); + } + keep[c.id] = true; + } + } + + // now loop through the full overlays and remove those that we dont want to keep + for (i in component._jsPlumb.overlays) { + if (keep[component._jsPlumb.overlays[i].id] == null) { + component.removeOverlay(component._jsPlumb.overlays[i].id, true); // remove overlay but dont clean it up. + // that would remove event listeners etc; overlays are never discarded by the types stuff, they are + // just detached/reattached. + } + } + } + }; + + _ju.extend(_jp.OverlayCapableJsPlumbUIComponent, root.jsPlumbUIComponent, { + + setHover: function (hover, ignoreAttachedElements) { + if (this._jsPlumb && !this._jsPlumb.instance.isConnectionBeingDragged()) { + for (var i in this._jsPlumb.overlays) { + this._jsPlumb.overlays[i][hover ? "addClass" : "removeClass"](this._jsPlumb.instance.hoverClass); + } + } + }, + addOverlay: function (overlay, doNotRepaint) { + var o = _processOverlay(this, overlay); + if (!doNotRepaint) { + this.repaint(); + } + return o; + }, + getOverlay: function (id) { + return this._jsPlumb.overlays[id]; + }, + getOverlays: function () { + return this._jsPlumb.overlays; + }, + hideOverlay: function (id) { + var o = this.getOverlay(id); + if (o) { + o.hide(); + } + }, + hideOverlays: function () { + for (var i in this._jsPlumb.overlays) { + this._jsPlumb.overlays[i].hide(); + } + }, + showOverlay: function (id) { + var o = this.getOverlay(id); + if (o) { + o.show(); + } + }, + showOverlays: function () { + for (var i in this._jsPlumb.overlays) { + this._jsPlumb.overlays[i].show(); + } + }, + removeAllOverlays: function (doNotRepaint) { + for (var i in this._jsPlumb.overlays) { + if (this._jsPlumb.overlays[i].cleanup) { + this._jsPlumb.overlays[i].cleanup(); + } + } + + this._jsPlumb.overlays = {}; + this._jsPlumb.overlayPositions = null; + this._jsPlumb.overlayPlacements= {}; + if (!doNotRepaint) { + this.repaint(); + } + }, + removeOverlay: function (overlayId, dontCleanup) { + var o = this._jsPlumb.overlays[overlayId]; + if (o) { + o.setVisible(false); + if (!dontCleanup && o.cleanup) { + o.cleanup(); + } + delete this._jsPlumb.overlays[overlayId]; + if (this._jsPlumb.overlayPositions) { + delete this._jsPlumb.overlayPositions[overlayId]; + } + + if (this._jsPlumb.overlayPlacements) { + delete this._jsPlumb.overlayPlacements[overlayId]; + } + } + }, + removeOverlays: function () { + for (var i = 0, j = arguments.length; i < j; i++) { + this.removeOverlay(arguments[i]); + } + }, + moveParent: function (newParent) { + if (this.bgCanvas) { + this.bgCanvas.parentNode.removeChild(this.bgCanvas); + newParent.appendChild(this.bgCanvas); + } + + if (this.canvas && this.canvas.parentNode) { + this.canvas.parentNode.removeChild(this.canvas); + newParent.appendChild(this.canvas); + + for (var i in this._jsPlumb.overlays) { + if (this._jsPlumb.overlays[i].isAppendedAtTopLevel) { + var el = this._jsPlumb.overlays[i].getElement(); + el.parentNode.removeChild(el); + newParent.appendChild(el); + } + } + } + }, + getLabel: function () { + var lo = this.getOverlay(_internalLabelOverlayId); + return lo != null ? lo.getLabel() : null; + }, + getLabelOverlay: function () { + return this.getOverlay(_internalLabelOverlayId); + }, + setLabel: function (l) { + var lo = this.getOverlay(_internalLabelOverlayId); + if (!lo) { + var params = l.constructor === String || l.constructor === Function ? { label: l } : l; + lo = _makeLabelOverlay(this, params); + this._jsPlumb.overlays[_internalLabelOverlayId] = lo; + } + else { + if (l.constructor === String || l.constructor === Function) { + lo.setLabel(l); + } + else { + if (l.label) { + lo.setLabel(l.label); + } + if (l.location) { + lo.setLocation(l.location); + } + } + } + + if (!this._jsPlumb.instance.isSuspendDrawing()) { + this.repaint(); + } + }, + cleanup: function (force) { + for (var i in this._jsPlumb.overlays) { + this._jsPlumb.overlays[i].cleanup(force); + this._jsPlumb.overlays[i].destroy(force); + } + if (force) { + this._jsPlumb.overlays = {}; + this._jsPlumb.overlayPositions = null; + } + }, + setVisible: function (v) { + this[v ? "showOverlays" : "hideOverlays"](); + }, + setAbsoluteOverlayPosition: function (overlay, xy) { + this._jsPlumb.overlayPositions[overlay.id] = xy; + }, + getAbsoluteOverlayPosition: function (overlay) { + return this._jsPlumb.overlayPositions ? this._jsPlumb.overlayPositions[overlay.id] : null; + }, + _clazzManip:function(action, clazz, dontUpdateOverlays) { + if (!dontUpdateOverlays) { + for (var i in this._jsPlumb.overlays) { + this._jsPlumb.overlays[i][action + "Class"](clazz); + } + } + }, + addClass:function(clazz, dontUpdateOverlays) { + this._clazzManip("add", clazz, dontUpdateOverlays); + }, + removeClass:function(clazz, dontUpdateOverlays) { + this._clazzManip("remove", clazz, dontUpdateOverlays); + } + }); + +// ------------------------------ END OverlayCapablejsPlumbUIComponent -------------------------------------------- + +}).call(typeof window !== 'undefined' ? window : this); + +/* + * This file contains the code for Endpoints. + * + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +;(function () { + + "use strict"; + var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil; + + // create the drag handler for a connection + var _makeConnectionDragHandler = function (endpoint, placeholder, _jsPlumb) { + var stopped = false; + return { + drag: function () { + if (stopped) { + stopped = false; + return true; + } + + if (placeholder.element) { + var _ui = _jsPlumb.getUIPosition(arguments, _jsPlumb.getZoom()); + if (_ui != null) { + _jsPlumb.setPosition(placeholder.element, _ui); + } + _jsPlumb.repaint(placeholder.element, _ui); + // always repaint the source endpoint, because only continuous/dynamic anchors cause the endpoint + // to be repainted, so static anchors need to be told (or the endpoint gets dragged around) + endpoint.paint({anchorPoint:endpoint.anchor.getCurrentLocation({element:endpoint})}); + } + }, + stopDrag: function () { + stopped = true; + } + }; + }; + + // creates a placeholder div for dragging purposes, adds it, and pre-computes its offset. + var _makeDraggablePlaceholder = function (placeholder, _jsPlumb, ipco, ips) { + var n = _jsPlumb.createElement("div", { position : "absolute" }); + _jsPlumb.appendElement(n); + var id = _jsPlumb.getId(n); + _jsPlumb.setPosition(n, ipco); + n.style.width = ips[0] + "px"; + n.style.height = ips[1] + "px"; + _jsPlumb.manage(id, n, true); // TRANSIENT MANAGE + // create and assign an id, and initialize the offset. + placeholder.id = id; + placeholder.element = n; + }; + + // create a floating endpoint (for drag connections) + var _makeFloatingEndpoint = function (paintStyle, referenceAnchor, endpoint, referenceCanvas, sourceElement, _jsPlumb, _newEndpoint, scope) { + var floatingAnchor = new _jp.FloatingAnchor({ reference: referenceAnchor, referenceCanvas: referenceCanvas, jsPlumbInstance: _jsPlumb }); + //setting the scope here should not be the way to fix that mootools issue. it should be fixed by not + // adding the floating endpoint as a droppable. that makes more sense anyway! + // TRANSIENT MANAGE + return _newEndpoint({ + paintStyle: paintStyle, + endpoint: endpoint, + anchor: floatingAnchor, + source: sourceElement, + scope: scope + }); + }; + + var typeParameters = [ "connectorStyle", "connectorHoverStyle", "connectorOverlays", + "connector", "connectionType", "connectorClass", "connectorHoverClass" ]; + + // a helper function that tries to find a connection to the given element, and returns it if so. if elementWithPrecedence is null, + // or no connection to it is found, we return the first connection in our list. + var findConnectionToUseForDynamicAnchor = function (ep, elementWithPrecedence) { + var idx = 0; + if (elementWithPrecedence != null) { + for (var i = 0; i < ep.connections.length; i++) { + if (ep.connections[i].sourceId === elementWithPrecedence || ep.connections[i].targetId === elementWithPrecedence) { + idx = i; + break; + } + } + } + + return ep.connections[idx]; + }; + + _jp.Endpoint = function (params) { + var _jsPlumb = params._jsPlumb, + _newConnection = params.newConnection, + _newEndpoint = params.newEndpoint; + + this.idPrefix = "_jsplumb_e_"; + this.defaultLabelLocation = [ 0.5, 0.5 ]; + this.defaultOverlayKeys = ["Overlays", "EndpointOverlays"]; + _jp.OverlayCapableJsPlumbUIComponent.apply(this, arguments); + +// TYPE + + this.appendToDefaultType({ + connectionType:params.connectionType, + maxConnections: params.maxConnections == null ? this._jsPlumb.instance.Defaults.MaxConnections : params.maxConnections, // maximum number of connections this endpoint can be the source of., + paintStyle: params.endpointStyle || params.paintStyle || params.style || this._jsPlumb.instance.Defaults.EndpointStyle || _jp.Defaults.EndpointStyle, + hoverPaintStyle: params.endpointHoverStyle || params.hoverPaintStyle || this._jsPlumb.instance.Defaults.EndpointHoverStyle || _jp.Defaults.EndpointHoverStyle, + connectorStyle: params.connectorStyle, + connectorHoverStyle: params.connectorHoverStyle, + connectorClass: params.connectorClass, + connectorHoverClass: params.connectorHoverClass, + connectorOverlays: params.connectorOverlays, + connector: params.connector, + connectorTooltip: params.connectorTooltip + }); + +// END TYPE + + this._jsPlumb.enabled = !(params.enabled === false); + this._jsPlumb.visible = true; + this.element = _jp.getElement(params.source); + this._jsPlumb.uuid = params.uuid; + this._jsPlumb.floatingEndpoint = null; + var inPlaceCopy = null; + if (this._jsPlumb.uuid) { + params.endpointsByUUID[this._jsPlumb.uuid] = this; + } + this.elementId = params.elementId; + this.dragProxy = params.dragProxy; + + this._jsPlumb.connectionCost = params.connectionCost; + this._jsPlumb.connectionsDirected = params.connectionsDirected; + this._jsPlumb.currentAnchorClass = ""; + this._jsPlumb.events = {}; + + var deleteOnEmpty = params.deleteOnEmpty === true; + this.setDeleteOnEmpty = function(d) { + deleteOnEmpty = d; + }; + + var _updateAnchorClass = function () { + // stash old, get new + var oldAnchorClass = _jsPlumb.endpointAnchorClassPrefix + "-" + this._jsPlumb.currentAnchorClass; + this._jsPlumb.currentAnchorClass = this.anchor.getCssClass(); + var anchorClass = _jsPlumb.endpointAnchorClassPrefix + (this._jsPlumb.currentAnchorClass ? "-" + this._jsPlumb.currentAnchorClass : ""); + + this.removeClass(oldAnchorClass); + this.addClass(anchorClass); + // add and remove at the same time to reduce the number of reflows. + _jp.updateClasses(this.element, anchorClass, oldAnchorClass); + }.bind(this); + + this.prepareAnchor = function(anchorParams) { + var a = this._jsPlumb.instance.makeAnchor(anchorParams, this.elementId, _jsPlumb); + a.bind("anchorChanged", function (currentAnchor) { + this.fire("anchorChanged", {endpoint: this, anchor: currentAnchor}); + _updateAnchorClass(); + }.bind(this)); + return a; + }; + + this.setPreparedAnchor = function(anchor, doNotRepaint) { + this._jsPlumb.instance.continuousAnchorFactory.clear(this.elementId); + this.anchor = anchor; + _updateAnchorClass(); + + if (!doNotRepaint) { + this._jsPlumb.instance.repaint(this.elementId); + } + + return this; + }; + + this.setAnchor = function (anchorParams, doNotRepaint) { + var a = this.prepareAnchor(anchorParams); + this.setPreparedAnchor(a, doNotRepaint); + return this; + }; + + var internalHover = function (state) { + if (this.connections.length > 0) { + for (var i = 0; i < this.connections.length; i++) { + this.connections[i].setHover(state, false); + } + } + else { + this.setHover(state); + } + }.bind(this); + + this.bind("mouseover", function () { + internalHover(true); + }); + this.bind("mouseout", function () { + internalHover(false); + }); + + // ANCHOR MANAGER + if (!params._transient) { // in place copies, for example, are transient. they will never need to be retrieved during a paint cycle, because they dont move, and then they are deleted. + this._jsPlumb.instance.anchorManager.add(this, this.elementId); + } + + this.prepareEndpoint = function(ep, typeId) { + var _e = function (t, p) { + var rm = _jsPlumb.getRenderMode(); + if (_jp.Endpoints[rm][t]) { + return new _jp.Endpoints[rm][t](p); + } + if (!_jsPlumb.Defaults.DoNotThrowErrors) { + throw { msg: "jsPlumb: unknown endpoint type '" + t + "'" }; + } + }; + + var endpointArgs = { + _jsPlumb: this._jsPlumb.instance, + cssClass: params.cssClass, + container: params.container, + tooltip: params.tooltip, + connectorTooltip: params.connectorTooltip, + endpoint: this + }; + + var endpoint; + + if (_ju.isString(ep)) { + endpoint = _e(ep, endpointArgs); + } + else if (_ju.isArray(ep)) { + endpointArgs = _ju.merge(ep[1], endpointArgs); + endpoint = _e(ep[0], endpointArgs); + } + else { + endpoint = ep.clone(); + } + + // assign a clone function using a copy of endpointArgs. this is used when a drag starts: the endpoint that was dragged is cloned, + // and the clone is left in its place while the original one goes off on a magical journey. + // the copy is to get around a closure problem, in which endpointArgs ends up getting shared by + // the whole world. + //var argsForClone = jsPlumb.extend({}, endpointArgs); + endpoint.clone = function () { + // TODO this, and the code above, can be refactored to be more dry. + if (_ju.isString(ep)) { + return _e(ep, endpointArgs); + } + else if (_ju.isArray(ep)) { + endpointArgs = _ju.merge(ep[1], endpointArgs); + return _e(ep[0], endpointArgs); + } + }.bind(this); + + endpoint.typeId = typeId; + return endpoint; + }; + + this.setEndpoint = function(ep, doNotRepaint) { + var _ep = this.prepareEndpoint(ep); + this.setPreparedEndpoint(_ep, true); + }; + + this.setPreparedEndpoint = function (ep, doNotRepaint) { + if (this.endpoint != null) { + this.endpoint.cleanup(); + this.endpoint.destroy(); + } + this.endpoint = ep; + this.type = this.endpoint.type; + this.canvas = this.endpoint.canvas; + }; + + _jp.extend(this, params, typeParameters); + + this.isSource = params.isSource || false; + this.isTemporarySource = params.isTemporarySource || false; + this.isTarget = params.isTarget || false; + + this.connections = params.connections || []; + this.connectorPointerEvents = params["connector-pointer-events"]; + + this.scope = params.scope || _jsPlumb.getDefaultScope(); + this.timestamp = null; + this.reattachConnections = params.reattach || _jsPlumb.Defaults.ReattachConnections; + this.connectionsDetachable = _jsPlumb.Defaults.ConnectionsDetachable; + if (params.connectionsDetachable === false || params.detachable === false) { + this.connectionsDetachable = false; + } + this.dragAllowedWhenFull = params.dragAllowedWhenFull !== false; + + if (params.onMaxConnections) { + this.bind("maxConnections", params.onMaxConnections); + } + + // + // add a connection. not part of public API. + // + this.addConnection = function (connection) { + this.connections.push(connection); + this[(this.connections.length > 0 ? "add" : "remove") + "Class"](_jsPlumb.endpointConnectedClass); + this[(this.isFull() ? "add" : "remove") + "Class"](_jsPlumb.endpointFullClass); + }; + + this.detachFromConnection = function (connection, idx, doNotCleanup) { + idx = idx == null ? this.connections.indexOf(connection) : idx; + if (idx >= 0) { + this.connections.splice(idx, 1); + this[(this.connections.length > 0 ? "add" : "remove") + "Class"](_jsPlumb.endpointConnectedClass); + this[(this.isFull() ? "add" : "remove") + "Class"](_jsPlumb.endpointFullClass); + } + + if (!doNotCleanup && deleteOnEmpty && this.connections.length === 0) { + _jsPlumb.deleteObject({ + endpoint: this, + fireEvent: false, + deleteAttachedObjects: doNotCleanup !== true + }); + } + }; + + this.deleteEveryConnection = function(params) { + var c = this.connections.length; + for (var i = 0; i < c; i++) { + _jsPlumb.deleteConnection(this.connections[0], params); + } + }; + + this.detachFrom = function (targetEndpoint, fireEvent, originalEvent) { + var c = []; + for (var i = 0; i < this.connections.length; i++) { + if (this.connections[i].endpoints[1] === targetEndpoint || this.connections[i].endpoints[0] === targetEndpoint) { + c.push(this.connections[i]); + } + } + for (var j = 0, count = c.length; j < count; j++) { + _jsPlumb.deleteConnection(c[0]); + } + return this; + }; + + this.getElement = function () { + return this.element; + }; + + this.setElement = function (el) { + var parentId = this._jsPlumb.instance.getId(el), + curId = this.elementId; + // remove the endpoint from the list for the current endpoint's element + _ju.removeWithFunction(params.endpointsByElement[this.elementId], function (e) { + return e.id === this.id; + }.bind(this)); + this.element = _jp.getElement(el); + this.elementId = _jsPlumb.getId(this.element); + _jsPlumb.anchorManager.rehomeEndpoint(this, curId, this.element); + _jsPlumb.dragManager.endpointAdded(this.element); + _ju.addToList(params.endpointsByElement, parentId, this); + return this; + }; + + /** + * private but must be exposed. + */ + this.makeInPlaceCopy = function () { + var loc = this.anchor.getCurrentLocation({element: this}), + o = this.anchor.getOrientation(this), + acc = this.anchor.getCssClass(), + inPlaceAnchor = { + bind: function () { + }, + compute: function () { + return [ loc[0], loc[1] ]; + }, + getCurrentLocation: function () { + return [ loc[0], loc[1] ]; + }, + getOrientation: function () { + return o; + }, + getCssClass: function () { + return acc; + } + }; + + return _newEndpoint({ + dropOptions: params.dropOptions, + anchor: inPlaceAnchor, + source: this.element, + paintStyle: this.getPaintStyle(), + endpoint: params.hideOnDrag ? "Blank" : this.endpoint, + _transient: true, + scope: this.scope, + reference:this + }); + }; + + /** + * returns a connection from the pool; used when dragging starts. just gets the head of the array if it can. + */ + this.connectorSelector = function () { + return this.connections[0]; + }; + + this.setStyle = this.setPaintStyle; + + this.paint = function (params) { + params = params || {}; + var timestamp = params.timestamp, recalc = !(params.recalc === false); + if (!timestamp || this.timestamp !== timestamp) { + + var info = _jsPlumb.updateOffset({ elId: this.elementId, timestamp: timestamp }); + + var xy = params.offset ? params.offset.o : info.o; + if (xy != null) { + var ap = params.anchorPoint, connectorPaintStyle = params.connectorPaintStyle; + if (ap == null) { + var wh = params.dimensions || info.s, + anchorParams = { xy: [ xy.left, xy.top ], wh: wh, element: this, timestamp: timestamp }; + if (recalc && this.anchor.isDynamic && this.connections.length > 0) { + var c = findConnectionToUseForDynamicAnchor(this, params.elementWithPrecedence), + oIdx = c.endpoints[0] === this ? 1 : 0, + oId = oIdx === 0 ? c.sourceId : c.targetId, + oInfo = _jsPlumb.getCachedData(oId), + oOffset = oInfo.o, oWH = oInfo.s; + + anchorParams.index = oIdx === 0 ? 1 : 0; + anchorParams.connection = c; + anchorParams.txy = [ oOffset.left, oOffset.top ]; + anchorParams.twh = oWH; + anchorParams.tElement = c.endpoints[oIdx]; + } else if (this.connections.length > 0) { + anchorParams.connection = this.connections[0]; + } + ap = this.anchor.compute(anchorParams); + } + + this.endpoint.compute(ap, this.anchor.getOrientation(this), this._jsPlumb.paintStyleInUse, connectorPaintStyle || this.paintStyleInUse); + this.endpoint.paint(this._jsPlumb.paintStyleInUse, this.anchor); + this.timestamp = timestamp; + + // paint overlays + for (var i in this._jsPlumb.overlays) { + if (this._jsPlumb.overlays.hasOwnProperty(i)) { + var o = this._jsPlumb.overlays[i]; + if (o.isVisible()) { + this._jsPlumb.overlayPlacements[i] = o.draw(this.endpoint, this._jsPlumb.paintStyleInUse); + o.paint(this._jsPlumb.overlayPlacements[i]); + } + } + } + } + } + }; + + this.getTypeDescriptor = function () { + return "endpoint"; + }; + this.isVisible = function () { + return this._jsPlumb.visible; + }; + + this.repaint = this.paint; + + var draggingInitialised = false; + this.initDraggable = function () { + + // is this a connection source? we make it draggable and have the + // drag listener maintain a connection with a floating endpoint. + if (!draggingInitialised && _jp.isDragSupported(this.element)) { + var placeholderInfo = { id: null, element: null }, + jpc = null, + existingJpc = false, + existingJpcParams = null, + _dragHandler = _makeConnectionDragHandler(this, placeholderInfo, _jsPlumb), + dragOptions = params.dragOptions || {}, + defaultOpts = {}, + startEvent = _jp.dragEvents.start, + stopEvent = _jp.dragEvents.stop, + dragEvent = _jp.dragEvents.drag, + beforeStartEvent = _jp.dragEvents.beforeStart, + payload; + + // respond to beforeStart from katavorio; this will have, optionally, a payload of attribute values + // that were placed there by the makeSource mousedown listener. + var beforeStart = function(beforeStartParams) { + payload = beforeStartParams.e.payload || {}; + }; + + var start = function (startParams) { + +// ------------- first, get a connection to drag. this may be null, in which case we are dragging a new one. + + jpc = this.connectorSelector(); + +// -------------------------------- now a bunch of tests about whether or not to proceed ------------------------- + + var _continue = true; + // if not enabled, return + if (!this.isEnabled()) { + _continue = false; + } + // if no connection and we're not a source - or temporarily a source, as is the case with makeSource - return. + if (jpc == null && !this.isSource && !this.isTemporarySource) { + _continue = false; + } + // otherwise if we're full and not allowed to drag, also return false. + if (this.isSource && this.isFull() && !(jpc != null && this.dragAllowedWhenFull)) { + _continue = false; + } + // if the connection was setup as not detachable or one of its endpoints + // was setup as connectionsDetachable = false, or Defaults.ConnectionsDetachable + // is set to false... + if (jpc != null && !jpc.isDetachable(this)) { + // .. and the endpoint is full + if (this.isFull()) { + _continue = false; + } else { + // otherwise, if not full, set the connection to null, and we will now proceed + // to drag a new connection. + jpc = null; + } + } + + var beforeDrag = _jsPlumb.checkCondition(jpc == null ? "beforeDrag" : "beforeStartDetach", { + endpoint:this, + source:this.element, + sourceId:this.elementId, + connection:jpc + }); + if (beforeDrag === false) { + _continue = false; + } + // else we might have been given some data. we'll pass it in to a new connection as 'data'. + // here we also merge in the optional payload we were given on mousedown. + else if (typeof beforeDrag === "object") { + _jp.extend(beforeDrag, payload || {}); + } + else { + // or if no beforeDrag data, maybe use the payload on its own. + beforeDrag = payload || {}; + } + + if (_continue === false) { + // this is for mootools and yui. returning false from this causes jquery to stop drag. + // the events are wrapped in both mootools and yui anyway, but i don't think returning + // false from the start callback would stop a drag. + if (_jsPlumb.stopDrag) { + _jsPlumb.stopDrag(this.canvas); + } + _dragHandler.stopDrag(); + return false; + } + +// --------------------------------------------------------------------------------------------------------------------- + + // ok to proceed. + + // clear hover for all connections for this endpoint before continuing. + for (var i = 0; i < this.connections.length; i++) { + this.connections[i].setHover(false); + } + + this.addClass("endpointDrag"); + _jsPlumb.setConnectionBeingDragged(true); + + // if we're not full but there was a connection, make it null. we'll create a new one. + if (jpc && !this.isFull() && this.isSource) { + jpc = null; + } + + _jsPlumb.updateOffset({ elId: this.elementId }); + +// ---------------- make the element we will drag around, and position it ----------------------------- + + var ipco = this._jsPlumb.instance.getOffset(this.canvas), + canvasElement = this.canvas, + ips = this._jsPlumb.instance.getSize(this.canvas); + + _makeDraggablePlaceholder(placeholderInfo, _jsPlumb, ipco, ips); + + // store the id of the dragging div and the source element. the drop function will pick these up. + _jsPlumb.setAttributes(this.canvas, { + "dragId": placeholderInfo.id, + "elId": this.elementId + }); + +// ------------------- create an endpoint that will be our floating endpoint ------------------------------------ + + var endpointToFloat = this.dragProxy || this.endpoint; + if (this.dragProxy == null && this.connectionType != null) { + var aae = this._jsPlumb.instance.deriveEndpointAndAnchorSpec(this.connectionType); + if (aae.endpoints[1]) { + endpointToFloat = aae.endpoints[1]; + } + } + var centerAnchor = this._jsPlumb.instance.makeAnchor("Center"); + centerAnchor.isFloating = true; + this._jsPlumb.floatingEndpoint = _makeFloatingEndpoint(this.getPaintStyle(), centerAnchor, endpointToFloat, this.canvas, placeholderInfo.element, _jsPlumb, _newEndpoint, this.scope); + var _savedAnchor = this._jsPlumb.floatingEndpoint.anchor; + + + if (jpc == null) { + + this.setHover(false, false); + // create a connection. one end is this endpoint, the other is a floating endpoint. + jpc = _newConnection({ + sourceEndpoint: this, + targetEndpoint: this._jsPlumb.floatingEndpoint, + source: this.element, // for makeSource with parent option. ensure source element is represented correctly. + target: placeholderInfo.element, + anchors: [ this.anchor, this._jsPlumb.floatingEndpoint.anchor ], + paintStyle: params.connectorStyle, // this can be null. Connection will use the default. + hoverPaintStyle: params.connectorHoverStyle, + connector: params.connector, // this can also be null. Connection will use the default. + overlays: params.connectorOverlays, + type: this.connectionType, + cssClass: this.connectorClass, + hoverClass: this.connectorHoverClass, + scope:params.scope, + data:beforeDrag + }); + jpc.pending = true; + jpc.addClass(_jsPlumb.draggingClass); + this._jsPlumb.floatingEndpoint.addClass(_jsPlumb.draggingClass); + this._jsPlumb.floatingEndpoint.anchor = _savedAnchor; + // fire an event that informs that a connection is being dragged + _jsPlumb.fire("connectionDrag", jpc); + + // register the new connection on the drag manager. This connection, at this point, is 'pending', + // and has as its target a temporary element (the 'placeholder'). If the connection subsequently + // becomes established, the anchor manager is informed that the target of the connection has + // changed. + + _jsPlumb.anchorManager.newConnection(jpc); + + } else { + existingJpc = true; + jpc.setHover(false); + // new anchor idx + var anchorIdx = jpc.endpoints[0].id === this.id ? 0 : 1; + this.detachFromConnection(jpc, null, true); // detach from the connection while dragging is occurring. but dont cleanup automatically. + + // store the original scope (issue 57) + var dragScope = _jsPlumb.getDragScope(canvasElement); + _jsPlumb.setAttribute(this.canvas, "originalScope", dragScope); + + // fire an event that informs that a connection is being dragged. we do this before + // replacing the original target with the floating element info. + _jsPlumb.fire("connectionDrag", jpc); + + // now we replace ourselves with the temporary div we created above: + if (anchorIdx === 0) { + existingJpcParams = [ jpc.source, jpc.sourceId, canvasElement, dragScope ]; + _jsPlumb.anchorManager.sourceChanged(jpc.endpoints[anchorIdx].elementId, placeholderInfo.id, jpc, placeholderInfo.element); + + } else { + existingJpcParams = [ jpc.target, jpc.targetId, canvasElement, dragScope ]; + jpc.target = placeholderInfo.element; + jpc.targetId = placeholderInfo.id; + + _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.endpoints[anchorIdx].elementId, jpc.targetId, jpc); + } + + // store the original endpoint and assign the new floating endpoint for the drag. + jpc.suspendedEndpoint = jpc.endpoints[anchorIdx]; + + // PROVIDE THE SUSPENDED ELEMENT, BE IT A SOURCE OR TARGET (ISSUE 39) + jpc.suspendedElement = jpc.endpoints[anchorIdx].getElement(); + jpc.suspendedElementId = jpc.endpoints[anchorIdx].elementId; + jpc.suspendedElementType = anchorIdx === 0 ? "source" : "target"; + + jpc.suspendedEndpoint.setHover(false); + this._jsPlumb.floatingEndpoint.referenceEndpoint = jpc.suspendedEndpoint; + jpc.endpoints[anchorIdx] = this._jsPlumb.floatingEndpoint; + + jpc.addClass(_jsPlumb.draggingClass); + this._jsPlumb.floatingEndpoint.addClass(_jsPlumb.draggingClass); + } + + _jsPlumb.registerFloatingConnection(placeholderInfo, jpc, this._jsPlumb.floatingEndpoint); + + // // register it and register connection on it. + // _jsPlumb.floatingConnections[placeholderInfo.id] = jpc; + // + // // only register for the target endpoint; we will not be dragging the source at any time + // // before this connection is either discarded or made into a permanent connection. + // _ju.addToList(params.endpointsByElement, placeholderInfo.id, this._jsPlumb.floatingEndpoint); + + + // tell jsplumb about it + _jsPlumb.currentlyDragging = true; + }.bind(this); + + var stop = function () { + _jsPlumb.setConnectionBeingDragged(false); + + if (jpc && jpc.endpoints != null) { + // get the actual drop event (decode from library args to stop function) + var originalEvent = _jsPlumb.getDropEvent(arguments); + // unlock the other endpoint (if it is dynamic, it would have been locked at drag start) + var idx = _jsPlumb.getFloatingAnchorIndex(jpc); + jpc.endpoints[idx === 0 ? 1 : 0].anchor.unlock(); + // TODO: Dont want to know about css classes inside jsplumb, ideally. + jpc.removeClass(_jsPlumb.draggingClass); + + // if we have the floating endpoint then the connection has not been dropped + // on another endpoint. If it is a new connection we throw it away. If it is an + // existing connection we check to see if we should reattach it, throwing it away + // if not. + if (this._jsPlumb && (jpc.deleteConnectionNow || jpc.endpoints[idx] === this._jsPlumb.floatingEndpoint)) { + // 6a. if the connection was an existing one... + if (existingJpc && jpc.suspendedEndpoint) { + // fix for issue35, thanks Sylvain Gizard: when firing the detach event make sure the + // floating endpoint has been replaced. + if (idx === 0) { + jpc.floatingElement = jpc.source; + jpc.floatingId = jpc.sourceId; + jpc.floatingEndpoint = jpc.endpoints[0]; + jpc.floatingIndex = 0; + jpc.source = existingJpcParams[0]; + jpc.sourceId = existingJpcParams[1]; + } else { + // keep a copy of the floating element; the anchor manager will want to clean up. + jpc.floatingElement = jpc.target; + jpc.floatingId = jpc.targetId; + jpc.floatingEndpoint = jpc.endpoints[1]; + jpc.floatingIndex = 1; + jpc.target = existingJpcParams[0]; + jpc.targetId = existingJpcParams[1]; + } + + var fe = this._jsPlumb.floatingEndpoint; // store for later removal. + // restore the original scope (issue 57) + _jsPlumb.setDragScope(existingJpcParams[2], existingJpcParams[3]); + jpc.endpoints[idx] = jpc.suspendedEndpoint; + // if the connection should be reattached, or the other endpoint refuses detach, then + // reset the connection to its original state + if (jpc.isReattach() || jpc._forceReattach || jpc._forceDetach || !_jsPlumb.deleteConnection(jpc, {originalEvent: originalEvent})) { + + jpc.setHover(false); + jpc._forceDetach = null; + jpc._forceReattach = null; + this._jsPlumb.floatingEndpoint.detachFromConnection(jpc); + jpc.suspendedEndpoint.addConnection(jpc); + + // TODO this code is duplicated in lots of places...and there is nothing external + // in the code; it all refers to the connection itself. we could add a + // `checkSanity(connection)` method to anchorManager that did this. + if (idx === 1) { + _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.floatingId, jpc.targetId, jpc); + } + else { + _jsPlumb.anchorManager.sourceChanged(jpc.floatingId, jpc.sourceId, jpc, jpc.source); + } + + _jsPlumb.repaint(existingJpcParams[1]); + } + else { + _jsPlumb.deleteObject({endpoint: fe}); + } + } + } + + // makeTargets sets this flag, to tell us we have been replaced and should delete this object. + if (this.deleteAfterDragStop) { + _jsPlumb.deleteObject({endpoint: this}); + } + else { + if (this._jsPlumb) { + this.paint({recalc: false}); + } + } + + // although the connection is no longer valid, there are use cases where this is useful. + _jsPlumb.fire("connectionDragStop", jpc, originalEvent); + // fire this event to give people more fine-grained control (connectionDragStop fires a lot) + if (jpc.pending) { + _jsPlumb.fire("connectionAborted", jpc, originalEvent); + } + // tell jsplumb that dragging is finished. + _jsPlumb.currentlyDragging = false; + jpc.suspendedElement = null; + jpc.suspendedEndpoint = null; + jpc = null; + } + + // if no endpoints, jpc already cleaned up. but still we want to ensure we're reset properly. + // remove the element associated with the floating endpoint + // (and its associated floating endpoint and visual artefacts) + if (placeholderInfo && placeholderInfo.element) { + _jsPlumb.remove(placeholderInfo.element, false, false); + } + // remove the inplace copy + if (inPlaceCopy) { + _jsPlumb.deleteObject({endpoint: inPlaceCopy}); + } + + if (this._jsPlumb) { + // make our canvas visible (TODO: hand off to library; we should not know about DOM) + this.canvas.style.visibility = "visible"; + // unlock our anchor + this.anchor.unlock(); + // clear floating anchor. + this._jsPlumb.floatingEndpoint = null; + } + + }.bind(this); + + dragOptions = _jp.extend(defaultOpts, dragOptions); + dragOptions.scope = this.scope || dragOptions.scope; + dragOptions[beforeStartEvent] = _ju.wrap(dragOptions[beforeStartEvent], beforeStart, false); + dragOptions[startEvent] = _ju.wrap(dragOptions[startEvent], start, false); + // extracted drag handler function so can be used by makeSource + dragOptions[dragEvent] = _ju.wrap(dragOptions[dragEvent], _dragHandler.drag); + dragOptions[stopEvent] = _ju.wrap(dragOptions[stopEvent], stop); + dragOptions.multipleDrop = false; + + dragOptions.canDrag = function () { + return this.isSource || this.isTemporarySource || (this.connections.length > 0 && this.connectionsDetachable !== false); + }.bind(this); + + _jsPlumb.initDraggable(this.canvas, dragOptions, "internal"); + + this.canvas._jsPlumbRelatedElement = this.element; + + draggingInitialised = true; + } + }; + + var ep = params.endpoint || this._jsPlumb.instance.Defaults.Endpoint || _jp.Defaults.Endpoint; + this.setEndpoint(ep, true); + var anchorParamsToUse = params.anchor ? params.anchor : params.anchors ? params.anchors : (_jsPlumb.Defaults.Anchor || "Top"); + this.setAnchor(anchorParamsToUse, true); + + // finally, set type if it was provided + var type = [ "default", (params.type || "")].join(" "); + this.addType(type, params.data, true); + this.canvas = this.endpoint.canvas; + this.canvas._jsPlumb = this; + + this.initDraggable(); + + // pulled this out into a function so we can reuse it for the inPlaceCopy canvas; you can now drop detached connections + // back onto the endpoint you detached it from. + var _initDropTarget = function (canvas, isTransient, endpoint, referenceEndpoint) { + + if (_jp.isDropSupported(this.element)) { + var dropOptions = params.dropOptions || _jsPlumb.Defaults.DropOptions || _jp.Defaults.DropOptions; + dropOptions = _jp.extend({}, dropOptions); + dropOptions.scope = dropOptions.scope || this.scope; + var dropEvent = _jp.dragEvents.drop, + overEvent = _jp.dragEvents.over, + outEvent = _jp.dragEvents.out, + _ep = this, + drop = _jsPlumb.EndpointDropHandler({ + getEndpoint: function () { + return _ep; + }, + jsPlumb: _jsPlumb, + enabled: function () { + return endpoint != null ? endpoint.isEnabled() : true; + }, + isFull: function () { + return endpoint.isFull(); + }, + element: this.element, + elementId: this.elementId, + isSource: this.isSource, + isTarget: this.isTarget, + addClass: function (clazz) { + _ep.addClass(clazz); + }, + removeClass: function (clazz) { + _ep.removeClass(clazz); + }, + isDropAllowed: function () { + return _ep.isDropAllowed.apply(_ep, arguments); + }, + reference:referenceEndpoint, + isRedrop:function(jpc, dhParams) { + return jpc.suspendedEndpoint && dhParams.reference && (jpc.suspendedEndpoint.id === dhParams.reference.id); + } + }); + + dropOptions[dropEvent] = _ju.wrap(dropOptions[dropEvent], drop, true); + dropOptions[overEvent] = _ju.wrap(dropOptions[overEvent], function () { + var draggable = _jp.getDragObject(arguments), + id = _jsPlumb.getAttribute(_jp.getElement(draggable), "dragId"), + _jpc = _jsPlumb.getFloatingConnectionFor(id);//_jsPlumb.floatingConnections[id]; + + if (_jpc != null) { + var idx = _jsPlumb.getFloatingAnchorIndex(_jpc); + // here we should fire the 'over' event if we are a target and this is a new connection, + // or we are the same as the floating endpoint. + var _cont = (this.isTarget && idx !== 0) || (_jpc.suspendedEndpoint && this.referenceEndpoint && this.referenceEndpoint.id === _jpc.suspendedEndpoint.id); + if (_cont) { + var bb = _jsPlumb.checkCondition("checkDropAllowed", { + sourceEndpoint: _jpc.endpoints[idx], + targetEndpoint: this, + connection: _jpc + }); + this[(bb ? "add" : "remove") + "Class"](_jsPlumb.endpointDropAllowedClass); + this[(bb ? "remove" : "add") + "Class"](_jsPlumb.endpointDropForbiddenClass); + _jpc.endpoints[idx].anchor.over(this.anchor, this); + } + } + }.bind(this)); + + dropOptions[outEvent] = _ju.wrap(dropOptions[outEvent], function () { + var draggable = _jp.getDragObject(arguments), + id = draggable == null ? null : _jsPlumb.getAttribute(_jp.getElement(draggable), "dragId"), + _jpc = id ? _jsPlumb.getFloatingConnectionFor(id) : null; + + if (_jpc != null) { + var idx = _jsPlumb.getFloatingAnchorIndex(_jpc); + var _cont = (this.isTarget && idx !== 0) || (_jpc.suspendedEndpoint && this.referenceEndpoint && this.referenceEndpoint.id === _jpc.suspendedEndpoint.id); + if (_cont) { + this.removeClass(_jsPlumb.endpointDropAllowedClass); + this.removeClass(_jsPlumb.endpointDropForbiddenClass); + _jpc.endpoints[idx].anchor.out(); + } + } + }.bind(this)); + + _jsPlumb.initDroppable(canvas, dropOptions, "internal", isTransient); + } + }.bind(this); + + // Initialise the endpoint's canvas as a drop target. The drop handler will take care of the logic of whether + // something can actually be dropped. + if (!this.anchor.isFloating) { + _initDropTarget(this.canvas, !(params._transient || this.anchor.isFloating), this, params.reference); + } + + return this; + }; + + _ju.extend(_jp.Endpoint, _jp.OverlayCapableJsPlumbUIComponent, { + + setVisible: function (v, doNotChangeConnections, doNotNotifyOtherEndpoint) { + this._jsPlumb.visible = v; + if (this.canvas) { + this.canvas.style.display = v ? "block" : "none"; + } + this[v ? "showOverlays" : "hideOverlays"](); + if (!doNotChangeConnections) { + for (var i = 0; i < this.connections.length; i++) { + this.connections[i].setVisible(v); + if (!doNotNotifyOtherEndpoint) { + var oIdx = this === this.connections[i].endpoints[0] ? 1 : 0; + // only change the other endpoint if this is its only connection. + if (this.connections[i].endpoints[oIdx].connections.length === 1) { + this.connections[i].endpoints[oIdx].setVisible(v, true, true); + } + } + } + } + }, + getAttachedElements: function () { + return this.connections; + }, + applyType: function (t, doNotRepaint) { + this.setPaintStyle(t.endpointStyle || t.paintStyle, doNotRepaint); + this.setHoverPaintStyle(t.endpointHoverStyle || t.hoverPaintStyle, doNotRepaint); + if (t.maxConnections != null) { + this._jsPlumb.maxConnections = t.maxConnections; + } + if (t.scope) { + this.scope = t.scope; + } + _jp.extend(this, t, typeParameters); + if (t.cssClass != null && this.canvas) { + this._jsPlumb.instance.addClass(this.canvas, t.cssClass); + } + _jp.OverlayCapableJsPlumbUIComponent.applyType(this, t); + }, + isEnabled: function () { + return this._jsPlumb.enabled; + }, + setEnabled: function (e) { + this._jsPlumb.enabled = e; + }, + cleanup: function () { + var anchorClass = this._jsPlumb.instance.endpointAnchorClassPrefix + (this._jsPlumb.currentAnchorClass ? "-" + this._jsPlumb.currentAnchorClass : ""); + _jp.removeClass(this.element, anchorClass); + this.anchor = null; + this.endpoint.cleanup(true); + this.endpoint.destroy(); + this.endpoint = null; + // drag/drop + this._jsPlumb.instance.destroyDraggable(this.canvas, "internal"); + this._jsPlumb.instance.destroyDroppable(this.canvas, "internal"); + }, + setHover: function (h) { + if (this.endpoint && this._jsPlumb && !this._jsPlumb.instance.isConnectionBeingDragged()) { + this.endpoint.setHover(h); + } + }, + isFull: function () { + return this._jsPlumb.maxConnections === 0 ? true : !(this.isFloating() || this._jsPlumb.maxConnections < 0 || this.connections.length < this._jsPlumb.maxConnections); + }, + /** + * private but needs to be exposed. + */ + isFloating: function () { + return this.anchor != null && this.anchor.isFloating; + }, + isConnectedTo: function (endpoint) { + var found = false; + if (endpoint) { + for (var i = 0; i < this.connections.length; i++) { + if (this.connections[i].endpoints[1] === endpoint || this.connections[i].endpoints[0] === endpoint) { + found = true; + break; + } + } + } + return found; + }, + getConnectionCost: function () { + return this._jsPlumb.connectionCost; + }, + setConnectionCost: function (c) { + this._jsPlumb.connectionCost = c; + }, + areConnectionsDirected: function () { + return this._jsPlumb.connectionsDirected; + }, + setConnectionsDirected: function (b) { + this._jsPlumb.connectionsDirected = b; + }, + setElementId: function (_elId) { + this.elementId = _elId; + this.anchor.elementId = _elId; + }, + setReferenceElement: function (_el) { + this.element = _jp.getElement(_el); + }, + setDragAllowedWhenFull: function (allowed) { + this.dragAllowedWhenFull = allowed; + }, + equals: function (endpoint) { + return this.anchor.equals(endpoint.anchor); + }, + getUuid: function () { + return this._jsPlumb.uuid; + }, + computeAnchor: function (params) { + return this.anchor.compute(params); + } + }); + + root.jsPlumbInstance.prototype.EndpointDropHandler = function (dhParams) { + return function (e) { + + var _jsPlumb = dhParams.jsPlumb; + + // remove the classes that are added dynamically. drop is neither forbidden nor allowed now that + // the drop is finishing. + dhParams.removeClass(_jsPlumb.endpointDropAllowedClass); + dhParams.removeClass(_jsPlumb.endpointDropForbiddenClass); + + var originalEvent = _jsPlumb.getDropEvent(arguments), + draggable = _jsPlumb.getDragObject(arguments), + id = _jsPlumb.getAttribute(draggable, "dragId"), + elId = _jsPlumb.getAttribute(draggable, "elId"), + scope = _jsPlumb.getAttribute(draggable, "originalScope"), + jpc = _jsPlumb.getFloatingConnectionFor(id); + + // if no active connection, bail. + if (jpc == null) { + return; + } + + // calculate if this is an existing connection. + var existingConnection = jpc.suspendedEndpoint != null; + + // if suspended endpoint exists but has been cleaned up, bail. This means it's an existing connection + // that has been detached and will shortly be discarded. + if (existingConnection && jpc.suspendedEndpoint._jsPlumb == null) { + return; + } + + // get the drop endpoint. for a normal connection this is just the one that would replace the currently + // floating endpoint. for a makeTarget this is a new endpoint that is created on drop. But we leave that to + // the handler to figure out. + var _ep = dhParams.getEndpoint(jpc); + + // If we're not given an endpoint to use, bail. + if (_ep == null) { + return; + } + + // if this is a drop back where the connection came from, mark it force reattach and + // return; the stop handler will reattach. without firing an event. + if (dhParams.isRedrop(jpc, dhParams)) { + jpc._forceReattach = true; + jpc.setHover(false); + if (dhParams.maybeCleanup) { + dhParams.maybeCleanup(_ep); + } + return; + } + + // ensure we dont bother trying to drop sources on non-source eps, and same for target. + var idx = _jsPlumb.getFloatingAnchorIndex(jpc); + if ((idx === 0 && !dhParams.isSource)|| (idx === 1 && !dhParams.isTarget)){ + if (dhParams.maybeCleanup) { + dhParams.maybeCleanup(_ep); + } + return; + } + + if (dhParams.onDrop) { + dhParams.onDrop(jpc); + } + + // restore the original scope if necessary (issue 57) + if (scope) { + _jsPlumb.setDragScope(draggable, scope); + } + + // if the target of the drop is full, fire an event (we abort below) + // makeTarget: keep. + var isFull = dhParams.isFull(e); + if (isFull) { + _ep.fire("maxConnections", { + endpoint: this, + connection: jpc, + maxConnections: _ep._jsPlumb.maxConnections + }, originalEvent); + } + // + // if endpoint enabled, not full, and matches the index of the floating endpoint... + if (!isFull && dhParams.enabled()) { + var _doContinue = true; + + // before testing for beforeDrop, reset the connection's source/target to be the actual DOM elements + // involved (that is, stash any temporary stuff used for dragging. but we need to keep it around in + // order that the anchor manager can clean things up properly). + if (idx === 0) { + jpc.floatingElement = jpc.source; + jpc.floatingId = jpc.sourceId; + jpc.floatingEndpoint = jpc.endpoints[0]; + jpc.floatingIndex = 0; + jpc.source = dhParams.element; + jpc.sourceId = dhParams.elementId; + } else { + jpc.floatingElement = jpc.target; + jpc.floatingId = jpc.targetId; + jpc.floatingEndpoint = jpc.endpoints[1]; + jpc.floatingIndex = 1; + jpc.target = dhParams.element; + jpc.targetId = dhParams.elementId; + } + + // if this is an existing connection and detach is not allowed we won't continue. The connection's + // endpoints have been reinstated; everything is back to how it was. + if (existingConnection && jpc.suspendedEndpoint.id !== _ep.id) { + if (!jpc.isDetachAllowed(jpc) || !jpc.endpoints[idx].isDetachAllowed(jpc) || !jpc.suspendedEndpoint.isDetachAllowed(jpc) || !_jsPlumb.checkCondition("beforeDetach", jpc)) { + _doContinue = false; + } + } + +// ------------ wrap the execution path in a function so we can support asynchronous beforeDrop + + var continueFunction = function (optionalData) { + // remove this jpc from the current endpoint, which is a floating endpoint that we will + // subsequently discard. + jpc.endpoints[idx].detachFromConnection(jpc); + + // if there's a suspended endpoint, detach it from the connection. + if (jpc.suspendedEndpoint) { + jpc.suspendedEndpoint.detachFromConnection(jpc); + } + + jpc.endpoints[idx] = _ep; + _ep.addConnection(jpc); + + // copy our parameters in to the connection: + var params = _ep.getParameters(); + for (var aParam in params) { + jpc.setParameter(aParam, params[aParam]); + } + + if (!existingConnection) { + // if not an existing connection and + if (params.draggable) { + _jsPlumb.initDraggable(this.element, dhParams.dragOptions, "internal", _jsPlumb); + } + } + else { + var suspendedElementId = jpc.suspendedEndpoint.elementId; + _jsPlumb.fireMoveEvent({ + index: idx, + originalSourceId: idx === 0 ? suspendedElementId : jpc.sourceId, + newSourceId: idx === 0 ? _ep.elementId : jpc.sourceId, + originalTargetId: idx === 1 ? suspendedElementId : jpc.targetId, + newTargetId: idx === 1 ? _ep.elementId : jpc.targetId, + originalSourceEndpoint: idx === 0 ? jpc.suspendedEndpoint : jpc.endpoints[0], + newSourceEndpoint: idx === 0 ? _ep : jpc.endpoints[0], + originalTargetEndpoint: idx === 1 ? jpc.suspendedEndpoint : jpc.endpoints[1], + newTargetEndpoint: idx === 1 ? _ep : jpc.endpoints[1], + connection: jpc + }, originalEvent); + } + + if (idx === 1) { + _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.floatingId, jpc.targetId, jpc); + } + else { + _jsPlumb.anchorManager.sourceChanged(jpc.floatingId, jpc.sourceId, jpc, jpc.source); + } + + // when makeSource has uniqueEndpoint:true, we want to create connections with new endpoints + // that are subsequently deleted. So makeSource sets `finalEndpoint`, which is the Endpoint to + // which the connection should be attached. The `detachFromConnection` call below results in the + // temporary endpoint being cleaned up. + if (jpc.endpoints[0].finalEndpoint) { + var _toDelete = jpc.endpoints[0]; + _toDelete.detachFromConnection(jpc); + jpc.endpoints[0] = jpc.endpoints[0].finalEndpoint; + jpc.endpoints[0].addConnection(jpc); + } + + // if optionalData was given, merge it onto the connection's data. + if (_ju.isObject(optionalData)) { + jpc.mergeData(optionalData); + } + // finalise will inform the anchor manager and also add to + // connectionsByScope if necessary. + _jsPlumb.finaliseConnection(jpc, null, originalEvent, false); + jpc.setHover(false); + + // SP continuous anchor flush + _jsPlumb.revalidate(jpc.endpoints[0].element); + + }.bind(this); + + var dontContinueFunction = function () { + // otherwise just put it back on the endpoint it was on before the drag. + if (jpc.suspendedEndpoint) { + jpc.endpoints[idx] = jpc.suspendedEndpoint; + jpc.setHover(false); + jpc._forceDetach = true; + if (idx === 0) { + jpc.source = jpc.suspendedEndpoint.element; + jpc.sourceId = jpc.suspendedEndpoint.elementId; + } else { + jpc.target = jpc.suspendedEndpoint.element; + jpc.targetId = jpc.suspendedEndpoint.elementId; + } + jpc.suspendedEndpoint.addConnection(jpc); + + // TODO checkSanity + if (idx === 1) { + _jsPlumb.anchorManager.updateOtherEndpoint(jpc.sourceId, jpc.floatingId, jpc.targetId, jpc); + } + else { + _jsPlumb.anchorManager.sourceChanged(jpc.floatingId, jpc.sourceId, jpc, jpc.source); + } + + _jsPlumb.repaint(jpc.sourceId); + jpc._forceDetach = false; + } + }; + +// -------------------------------------- + // now check beforeDrop. this will be available only on Endpoints that are setup to + // have a beforeDrop condition (although, secretly, under the hood all Endpoints and + // the Connection have them, because they are on jsPlumbUIComponent. shhh!), because + // it only makes sense to have it on a target endpoint. + _doContinue = _doContinue && dhParams.isDropAllowed(jpc.sourceId, jpc.targetId, jpc.scope, jpc, _ep);// && jpc.pending; + + if (_doContinue) { + continueFunction(_doContinue); + return true; + } + else { + dontContinueFunction(); + } + } + + if (dhParams.maybeCleanup) { + dhParams.maybeCleanup(_ep); + } + + _jsPlumb.currentlyDragging = false; + }; + }; +}).call(typeof window !== 'undefined' ? window : this); + +/* + * This file contains the code for Connections. + * + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +; +(function () { + + "use strict"; + var root = this, + _jp = root.jsPlumb, + _ju = root.jsPlumbUtil; + + var makeConnector = function (_jsPlumb, renderMode, connectorName, connectorArgs, forComponent) { + // first make sure we have a cache for the specified renderer + _jp.Connectors[renderMode] = _jp.Connectors[renderMode] || {}; + + // now see if the one we want exists; if not we will try to make it + if (_jp.Connectors[renderMode][connectorName] == null) { + + if (_jp.Connectors[connectorName] == null) { + if (!_jsPlumb.Defaults.DoNotThrowErrors) { + throw new TypeError("jsPlumb: unknown connector type '" + connectorName + "'"); + } else { + return null; + } + } + + _jp.Connectors[renderMode][connectorName] = function() { + _jp.Connectors[connectorName].apply(this, arguments); + _jp.ConnectorRenderers[renderMode].apply(this, arguments); + }; + + _ju.extend(_jp.Connectors[renderMode][connectorName], [ _jp.Connectors[connectorName], _jp.ConnectorRenderers[renderMode]]); + + } + + return new _jp.Connectors[renderMode][connectorName](connectorArgs, forComponent); + }, + _makeAnchor = function (anchorParams, elementId, _jsPlumb) { + return (anchorParams) ? _jsPlumb.makeAnchor(anchorParams, elementId, _jsPlumb) : null; + }, + _updateConnectedClass = function (conn, element, _jsPlumb, remove) { + if (element != null) { + element._jsPlumbConnections = element._jsPlumbConnections || {}; + if (remove) { + delete element._jsPlumbConnections[conn.id]; + } + else { + element._jsPlumbConnections[conn.id] = true; + } + + if (_ju.isEmpty(element._jsPlumbConnections)) { + _jsPlumb.removeClass(element, _jsPlumb.connectedClass); + } + else { + _jsPlumb.addClass(element, _jsPlumb.connectedClass); + } + } + }; + + _jp.Connection = function (params) { + var _newEndpoint = params.newEndpoint; + + this.id = params.id; + this.connector = null; + this.idPrefix = "_jsplumb_c_"; + this.defaultLabelLocation = 0.5; + this.defaultOverlayKeys = ["Overlays", "ConnectionOverlays"]; + // if a new connection is the result of moving some existing connection, params.previousConnection + // will have that Connection in it. listeners for the jsPlumbConnection event can look for that + // member and take action if they need to. + this.previousConnection = params.previousConnection; + this.source = _jp.getElement(params.source); + this.target = _jp.getElement(params.target); + + + _jp.OverlayCapableJsPlumbUIComponent.apply(this, arguments); + + // sourceEndpoint and targetEndpoint override source/target, if they are present. but + // source is not overridden if the Endpoint has declared it is not the final target of a connection; + // instead we use the source that the Endpoint declares will be the final source element. + if (params.sourceEndpoint) { + this.source = params.sourceEndpoint.getElement(); + this.sourceId = params.sourceEndpoint.elementId; + } else { + this.sourceId = this._jsPlumb.instance.getId(this.source); + } + + if (params.targetEndpoint) { + this.target = params.targetEndpoint.getElement(); + this.targetId = params.targetEndpoint.elementId; + } else { + this.targetId = this._jsPlumb.instance.getId(this.target); + } + + + this.scope = params.scope; // scope may have been passed in to the connect call. if it wasn't, we will pull it from the source endpoint, after having initialised the endpoints. + this.endpoints = []; + this.endpointStyles = []; + + var _jsPlumb = this._jsPlumb.instance; + + _jsPlumb.manage(this.sourceId, this.source); + _jsPlumb.manage(this.targetId, this.target); + + this._jsPlumb.visible = true; + + this._jsPlumb.params = { + cssClass: params.cssClass, + container: params.container, + "pointer-events": params["pointer-events"], + editorParams: params.editorParams, + overlays: params.overlays + }; + this._jsPlumb.lastPaintedAt = null; + + // listen to mouseover and mouseout events passed from the container delegate. + this.bind("mouseover", function () { + this.setHover(true); + }.bind(this)); + this.bind("mouseout", function () { + this.setHover(false); + }.bind(this)); + + +// INITIALISATION CODE + + this.makeEndpoint = function (isSource, el, elId, ep) { + elId = elId || this._jsPlumb.instance.getId(el); + return this.prepareEndpoint(_jsPlumb, _newEndpoint, this, ep, isSource ? 0 : 1, params, el, elId); + }; + + // if type given, get the endpoint definitions mapping to that type from the jsplumb instance, and use those. + // we apply types at the end of this constructor but endpoints are only honoured in a type definition at + // create time. + if (params.type) { + params.endpoints = params.endpoints || this._jsPlumb.instance.deriveEndpointAndAnchorSpec(params.type).endpoints; + } + + var eS = this.makeEndpoint(true, this.source, this.sourceId, params.sourceEndpoint), + eT = this.makeEndpoint(false, this.target, this.targetId, params.targetEndpoint); + + if (eS) { + _ju.addToList(params.endpointsByElement, this.sourceId, eS); + } + if (eT) { + _ju.addToList(params.endpointsByElement, this.targetId, eT); + } + // if scope not set, set it to be the scope for the source endpoint. + if (!this.scope) { + this.scope = this.endpoints[0].scope; + } + + // if explicitly told to (or not to) delete endpoints when empty, override endpoint's preferences + if (params.deleteEndpointsOnEmpty != null) { + this.endpoints[0].setDeleteOnEmpty(params.deleteEndpointsOnEmpty); + this.endpoints[1].setDeleteOnEmpty(params.deleteEndpointsOnEmpty); + } + +// -------------------------- DEFAULT TYPE --------------------------------------------- + + // DETACHABLE + var _detachable = _jsPlumb.Defaults.ConnectionsDetachable; + if (params.detachable === false) { + _detachable = false; + } + if (this.endpoints[0].connectionsDetachable === false) { + _detachable = false; + } + if (this.endpoints[1].connectionsDetachable === false) { + _detachable = false; + } + // REATTACH + var _reattach = params.reattach || this.endpoints[0].reattachConnections || this.endpoints[1].reattachConnections || _jsPlumb.Defaults.ReattachConnections; + + this.appendToDefaultType({ + detachable: _detachable, + reattach: _reattach, + paintStyle:this.endpoints[0].connectorStyle || this.endpoints[1].connectorStyle || params.paintStyle || _jsPlumb.Defaults.PaintStyle || _jp.Defaults.PaintStyle, + hoverPaintStyle:this.endpoints[0].connectorHoverStyle || this.endpoints[1].connectorHoverStyle || params.hoverPaintStyle || _jsPlumb.Defaults.HoverPaintStyle || _jp.Defaults.HoverPaintStyle + }); + + var _suspendedAt = _jsPlumb.getSuspendedAt(); + if (!_jsPlumb.isSuspendDrawing()) { + // paint the endpoints + var myInfo = _jsPlumb.getCachedData(this.sourceId), + myOffset = myInfo.o, myWH = myInfo.s, + otherInfo = _jsPlumb.getCachedData(this.targetId), + otherOffset = otherInfo.o, + otherWH = otherInfo.s, + initialTimestamp = _suspendedAt || _jsPlumb.timestamp(), + anchorLoc = this.endpoints[0].anchor.compute({ + xy: [ myOffset.left, myOffset.top ], wh: myWH, element: this.endpoints[0], + elementId: this.endpoints[0].elementId, + txy: [ otherOffset.left, otherOffset.top ], twh: otherWH, tElement: this.endpoints[1], + timestamp: initialTimestamp + }); + + this.endpoints[0].paint({ anchorLoc: anchorLoc, timestamp: initialTimestamp }); + + anchorLoc = this.endpoints[1].anchor.compute({ + xy: [ otherOffset.left, otherOffset.top ], wh: otherWH, element: this.endpoints[1], + elementId: this.endpoints[1].elementId, + txy: [ myOffset.left, myOffset.top ], twh: myWH, tElement: this.endpoints[0], + timestamp: initialTimestamp + }); + this.endpoints[1].paint({ anchorLoc: anchorLoc, timestamp: initialTimestamp }); + } + + this.getTypeDescriptor = function () { + return "connection"; + }; + this.getAttachedElements = function () { + return this.endpoints; + }; + + this.isDetachable = function (ep) { + return this._jsPlumb.detachable === false ? false : ep != null ? ep.connectionsDetachable === true : this._jsPlumb.detachable === true; + }; + this.setDetachable = function (detachable) { + this._jsPlumb.detachable = detachable === true; + }; + this.isReattach = function () { + return this._jsPlumb.reattach === true || this.endpoints[0].reattachConnections === true || this.endpoints[1].reattachConnections === true; + }; + this.setReattach = function (reattach) { + this._jsPlumb.reattach = reattach === true; + }; + +// END INITIALISATION CODE + + +// COST + DIRECTIONALITY + // if cost not supplied, try to inherit from source endpoint + this._jsPlumb.cost = params.cost || this.endpoints[0].getConnectionCost(); + this._jsPlumb.directed = params.directed; + // inherit directed flag if set no source endpoint + if (params.directed == null) { + this._jsPlumb.directed = this.endpoints[0].areConnectionsDirected(); + } +// END COST + DIRECTIONALITY + +// PARAMETERS + // merge all the parameters objects into the connection. parameters set + // on the connection take precedence; then source endpoint params, then + // finally target endpoint params. + var _p = _jp.extend({}, this.endpoints[1].getParameters()); + _jp.extend(_p, this.endpoints[0].getParameters()); + _jp.extend(_p, this.getParameters()); + this.setParameters(_p); +// END PARAMETERS + +// PAINTING + + this.setConnector(this.endpoints[0].connector || this.endpoints[1].connector || params.connector || _jsPlumb.Defaults.Connector || _jp.Defaults.Connector, true); + var data = params.data == null || !_ju.isObject(params.data) ? {} : params.data; + this.getData = function() { return data; }; + this.setData = function(d) { data = d || {}; }; + this.mergeData = function(d) { data = _jp.extend(data, d); }; + + // the very last thing we do is apply types, if there are any. + var _types = [ "default", this.endpoints[0].connectionType, this.endpoints[1].connectionType, params.type ].join(" "); + if (/[^\s]/.test(_types)) { + this.addType(_types, params.data, true); + } + + this.updateConnectedClass(); + +// END PAINTING + }; + + _ju.extend(_jp.Connection, _jp.OverlayCapableJsPlumbUIComponent, { + applyType: function (t, doNotRepaint, typeMap) { + + var _connector = null; + if (t.connector != null) { + _connector = this.getCachedTypeItem("connector", typeMap.connector); + if (_connector == null) { + _connector = this.prepareConnector(t.connector, typeMap.connector); + this.cacheTypeItem("connector", _connector, typeMap.connector); + } + this.setPreparedConnector(_connector); + } + + // none of these things result in the creation of objects so can be ignored. + if (t.detachable != null) { + this.setDetachable(t.detachable); + } + if (t.reattach != null) { + this.setReattach(t.reattach); + } + if (t.scope) { + this.scope = t.scope; + } + + if (t.cssClass != null && this.canvas) { + this._jsPlumb.instance.addClass(this.canvas, t.cssClass); + } + + var _anchors = null; + // this also results in the creation of objects. + if (t.anchor) { + // note that even if the param was anchor, we store `anchors`. + _anchors = this.getCachedTypeItem("anchors", typeMap.anchor); + if (_anchors == null) { + _anchors = [ this._jsPlumb.instance.makeAnchor(t.anchor), this._jsPlumb.instance.makeAnchor(t.anchor) ]; + this.cacheTypeItem("anchors", _anchors, typeMap.anchor); + } + } + else if (t.anchors) { + _anchors = this.getCachedTypeItem("anchors", typeMap.anchors); + if (_anchors == null) { + _anchors = [ + this._jsPlumb.instance.makeAnchor(t.anchors[0]), + this._jsPlumb.instance.makeAnchor(t.anchors[1]) + ]; + this.cacheTypeItem("anchors", _anchors, typeMap.anchors); + } + } + if (_anchors != null) { + this.endpoints[0].anchor = _anchors[0]; + this.endpoints[1].anchor = _anchors[1]; + if (this.endpoints[1].anchor.isDynamic) { + this._jsPlumb.instance.repaint(this.endpoints[1].elementId); + } + } + + _jp.OverlayCapableJsPlumbUIComponent.applyType(this, t); + }, + addClass: function (c, informEndpoints) { + if (informEndpoints) { + this.endpoints[0].addClass(c); + this.endpoints[1].addClass(c); + if (this.suspendedEndpoint) { + this.suspendedEndpoint.addClass(c); + } + } + if (this.connector) { + this.connector.addClass(c); + } + }, + removeClass: function (c, informEndpoints) { + if (informEndpoints) { + this.endpoints[0].removeClass(c); + this.endpoints[1].removeClass(c); + if (this.suspendedEndpoint) { + this.suspendedEndpoint.removeClass(c); + } + } + if (this.connector) { + this.connector.removeClass(c); + } + }, + isVisible: function () { + return this._jsPlumb.visible; + }, + setVisible: function (v) { + this._jsPlumb.visible = v; + if (this.connector) { + this.connector.setVisible(v); + } + this.repaint(); + }, + cleanup: function () { + this.updateConnectedClass(true); + this.endpoints = null; + this.source = null; + this.target = null; + if (this.connector != null) { + this.connector.cleanup(true); + this.connector.destroy(true); + } + this.connector = null; + }, + updateConnectedClass:function(remove) { + if (this._jsPlumb) { + _updateConnectedClass(this, this.source, this._jsPlumb.instance, remove); + _updateConnectedClass(this, this.target, this._jsPlumb.instance, remove); + } + }, + setHover: function (state) { + if (this.connector && this._jsPlumb && !this._jsPlumb.instance.isConnectionBeingDragged()) { + this.connector.setHover(state); + root.jsPlumb[state ? "addClass" : "removeClass"](this.source, this._jsPlumb.instance.hoverSourceClass); + root.jsPlumb[state ? "addClass" : "removeClass"](this.target, this._jsPlumb.instance.hoverTargetClass); + } + }, + getUuids:function() { + return [ this.endpoints[0].getUuid(), this.endpoints[1].getUuid() ]; + }, + getCost: function () { + return this._jsPlumb ? this._jsPlumb.cost : -Infinity; + }, + setCost: function (c) { + this._jsPlumb.cost = c; + }, + isDirected: function () { + return this._jsPlumb.directed; + }, + getConnector: function () { + return this.connector; + }, + prepareConnector:function(connectorSpec, typeId) { + var connectorArgs = { + _jsPlumb: this._jsPlumb.instance, + cssClass: this._jsPlumb.params.cssClass, + container: this._jsPlumb.params.container, + "pointer-events": this._jsPlumb.params["pointer-events"] + }, + renderMode = this._jsPlumb.instance.getRenderMode(), + connector; + + if (_ju.isString(connectorSpec)) { + connector = makeConnector(this._jsPlumb.instance, renderMode, connectorSpec, connectorArgs, this); + } // lets you use a string as shorthand. + else if (_ju.isArray(connectorSpec)) { + if (connectorSpec.length === 1) { + connector = makeConnector(this._jsPlumb.instance, renderMode, connectorSpec[0], connectorArgs, this); + } + else { + connector = makeConnector(this._jsPlumb.instance, renderMode, connectorSpec[0], _ju.merge(connectorSpec[1], connectorArgs), this); + } + } + if (typeId != null) { + connector.typeId = typeId; + } + return connector; + }, + setPreparedConnector: function(connector, doNotRepaint, doNotChangeListenerComponent, typeId) { + + if (this.connector !== connector) { + + var previous, previousClasses = ""; + // the connector will not be cleaned up if it was set as part of a type, because `typeId` will be set on it + // and we havent passed in `true` for "force" here. + if (this.connector != null) { + previous = this.connector; + previousClasses = previous.getClass(); + this.connector.cleanup(); + this.connector.destroy(); + } + + this.connector = connector; + if (typeId) { + this.cacheTypeItem("connector", connector, typeId); + } + + this.canvas = this.connector.canvas; + this.bgCanvas = this.connector.bgCanvas; + + // put classes from prior connector onto the canvas + this.addClass(previousClasses); + + // new: instead of binding listeners per connector, we now just have one delegate on the container. + // so for that handler we set the connection as the '_jsPlumb' member of the canvas element, and + // bgCanvas, if it exists, which it does right now in the VML renderer, so it won't from v 2.0.0 onwards. + if (this.canvas) { + this.canvas._jsPlumb = this; + } + if (this.bgCanvas) { + this.bgCanvas._jsPlumb = this; + } + + if (previous != null) { + var o = this.getOverlays(); + for (var i = 0; i < o.length; i++) { + if (o[i].transfer) { + o[i].transfer(this.connector); + } + } + } + + if (!doNotChangeListenerComponent) { + this.setListenerComponent(this.connector); + } + if (!doNotRepaint) { + this.repaint(); + } + } + }, + setConnector: function (connectorSpec, doNotRepaint, doNotChangeListenerComponent, typeId) { + var connector = this.prepareConnector(connectorSpec, typeId); + this.setPreparedConnector(connector, doNotRepaint, doNotChangeListenerComponent, typeId); + }, + paint: function (params) { + + if (!this._jsPlumb.instance.isSuspendDrawing() && this._jsPlumb.visible) { + params = params || {}; + var timestamp = params.timestamp, + // if the moving object is not the source we must transpose the two references. + swap = false, + tId = swap ? this.sourceId : this.targetId, sId = swap ? this.targetId : this.sourceId, + tIdx = swap ? 0 : 1, sIdx = swap ? 1 : 0; + + if (timestamp == null || timestamp !== this._jsPlumb.lastPaintedAt) { + var sourceInfo = this._jsPlumb.instance.updateOffset({elId:sId}).o, + targetInfo = this._jsPlumb.instance.updateOffset({elId:tId}).o, + sE = this.endpoints[sIdx], tE = this.endpoints[tIdx]; + + var sAnchorP = sE.anchor.getCurrentLocation({xy: [sourceInfo.left, sourceInfo.top], wh: [sourceInfo.width, sourceInfo.height], element: sE, timestamp: timestamp}), + tAnchorP = tE.anchor.getCurrentLocation({xy: [targetInfo.left, targetInfo.top], wh: [targetInfo.width, targetInfo.height], element: tE, timestamp: timestamp}); + + this.connector.resetBounds(); + + this.connector.compute({ + sourcePos: sAnchorP, + targetPos: tAnchorP, + sourceOrientation:sE.anchor.getOrientation(sE), + targetOrientation:tE.anchor.getOrientation(tE), + sourceEndpoint: this.endpoints[sIdx], + targetEndpoint: this.endpoints[tIdx], + "stroke-width": this._jsPlumb.paintStyleInUse.strokeWidth, + sourceInfo: sourceInfo, + targetInfo: targetInfo + }); + + var overlayExtents = { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity }; + + // compute overlays. we do this first so we can get their placements, and adjust the + // container if needs be (if an overlay would be clipped) + for (var i in this._jsPlumb.overlays) { + if (this._jsPlumb.overlays.hasOwnProperty(i)) { + var o = this._jsPlumb.overlays[i]; + if (o.isVisible()) { + this._jsPlumb.overlayPlacements[i] = o.draw(this.connector, this._jsPlumb.paintStyleInUse, this.getAbsoluteOverlayPosition(o)); + overlayExtents.minX = Math.min(overlayExtents.minX, this._jsPlumb.overlayPlacements[i].minX); + overlayExtents.maxX = Math.max(overlayExtents.maxX, this._jsPlumb.overlayPlacements[i].maxX); + overlayExtents.minY = Math.min(overlayExtents.minY, this._jsPlumb.overlayPlacements[i].minY); + overlayExtents.maxY = Math.max(overlayExtents.maxY, this._jsPlumb.overlayPlacements[i].maxY); + } + } + } + + var lineWidth = parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth || 1) / 2, + outlineWidth = parseFloat(this._jsPlumb.paintStyleInUse.strokeWidth || 0), + extents = { + xmin: Math.min(this.connector.bounds.minX - (lineWidth + outlineWidth), overlayExtents.minX), + ymin: Math.min(this.connector.bounds.minY - (lineWidth + outlineWidth), overlayExtents.minY), + xmax: Math.max(this.connector.bounds.maxX + (lineWidth + outlineWidth), overlayExtents.maxX), + ymax: Math.max(this.connector.bounds.maxY + (lineWidth + outlineWidth), overlayExtents.maxY) + }; + // paint the connector. + this.connector.paint(this._jsPlumb.paintStyleInUse, null, extents); + // and then the overlays + for (var j in this._jsPlumb.overlays) { + if (this._jsPlumb.overlays.hasOwnProperty(j)) { + var p = this._jsPlumb.overlays[j]; + if (p.isVisible()) { + p.paint(this._jsPlumb.overlayPlacements[j], extents); + } + } + } + } + this._jsPlumb.lastPaintedAt = timestamp; + } + }, + repaint: function (params) { + var p = jsPlumb.extend(params || {}, {}); + p.elId = this.sourceId; + this.paint(p); + }, + prepareEndpoint: function (_jsPlumb, _newEndpoint, conn, existing, index, params, element, elementId) { + var e; + if (existing) { + conn.endpoints[index] = existing; + existing.addConnection(conn); + } else { + if (!params.endpoints) { + params.endpoints = [ null, null ]; + } + var ep = params.endpoints[index] || params.endpoint || _jsPlumb.Defaults.Endpoints[index] || _jp.Defaults.Endpoints[index] || _jsPlumb.Defaults.Endpoint || _jp.Defaults.Endpoint; + if (!params.endpointStyles) { + params.endpointStyles = [ null, null ]; + } + if (!params.endpointHoverStyles) { + params.endpointHoverStyles = [ null, null ]; + } + var es = params.endpointStyles[index] || params.endpointStyle || _jsPlumb.Defaults.EndpointStyles[index] || _jp.Defaults.EndpointStyles[index] || _jsPlumb.Defaults.EndpointStyle || _jp.Defaults.EndpointStyle; + // Endpoints derive their fill from the connector's stroke, if no fill was specified. + if (es.fill == null && params.paintStyle != null) { + es.fill = params.paintStyle.stroke; + } + + if (es.outlineStroke == null && params.paintStyle != null) { + es.outlineStroke = params.paintStyle.outlineStroke; + } + if (es.outlineWidth == null && params.paintStyle != null) { + es.outlineWidth = params.paintStyle.outlineWidth; + } + + var ehs = params.endpointHoverStyles[index] || params.endpointHoverStyle || _jsPlumb.Defaults.EndpointHoverStyles[index] || _jp.Defaults.EndpointHoverStyles[index] || _jsPlumb.Defaults.EndpointHoverStyle || _jp.Defaults.EndpointHoverStyle; + // endpoint hover fill style is derived from connector's hover stroke style + if (params.hoverPaintStyle != null) { + if (ehs == null) { + ehs = {}; + } + if (ehs.fill == null) { + ehs.fill = params.hoverPaintStyle.stroke; + } + } + var a = params.anchors ? params.anchors[index] : + params.anchor ? params.anchor : + _makeAnchor(_jsPlumb.Defaults.Anchors[index], elementId, _jsPlumb) || + _makeAnchor(_jp.Defaults.Anchors[index], elementId, _jsPlumb) || + _makeAnchor(_jsPlumb.Defaults.Anchor, elementId, _jsPlumb) || + _makeAnchor(_jp.Defaults.Anchor, elementId, _jsPlumb), + u = params.uuids ? params.uuids[index] : null; + + e = _newEndpoint({ + paintStyle: es, hoverPaintStyle: ehs, endpoint: ep, connections: [ conn ], + uuid: u, anchor: a, source: element, scope: params.scope, + reattach: params.reattach || _jsPlumb.Defaults.ReattachConnections, + detachable: params.detachable || _jsPlumb.Defaults.ConnectionsDetachable + }); + if (existing == null) { + e.setDeleteOnEmpty(true); + } + conn.endpoints[index] = e; + + if (params.drawEndpoints === false) { + e.setVisible(false, true, true); + } + + } + return e; + } + + }); // END Connection class +}).call(typeof window !== 'undefined' ? window : this); + +/* + * This file contains the code for creating and manipulating anchors. + * + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +; +(function () { + + "use strict"; + + var root = this, + _ju = root.jsPlumbUtil, + _jp = root.jsPlumb; + + // + // manages anchors for all elements. + // + _jp.AnchorManager = function (params) { + var _amEndpoints = {}, + continuousAnchorLocations = {}, + continuousAnchorOrientations = {}, + connectionsByElementId = {}, + self = this, + anchorLists = {}, + jsPlumbInstance = params.jsPlumbInstance, + floatingConnections = {}, + // used by placeAnchors function + placeAnchorsOnLine = function (desc, elementDimensions, elementPosition, connections, horizontal, otherMultiplier, reverse) { + var a = [], step = elementDimensions[horizontal ? 0 : 1] / (connections.length + 1); + + for (var i = 0; i < connections.length; i++) { + var val = (i + 1) * step, other = otherMultiplier * elementDimensions[horizontal ? 1 : 0]; + if (reverse) { + val = elementDimensions[horizontal ? 0 : 1] - val; + } + + var dx = (horizontal ? val : other), x = elementPosition[0] + dx, xp = dx / elementDimensions[0], + dy = (horizontal ? other : val), y = elementPosition[1] + dy, yp = dy / elementDimensions[1]; + + a.push([ x, y, xp, yp, connections[i][1], connections[i][2] ]); + } + + return a; + }, + // used by edgeSortFunctions + currySort = function (reverseAngles) { + return function (a, b) { + var r = true; + if (reverseAngles) { + r = a[0][0] < b[0][0]; + } + else { + r = a[0][0] > b[0][0]; + } + return r === false ? -1 : 1; + }; + }, + // used by edgeSortFunctions + leftSort = function (a, b) { + // first get adjusted values + var p1 = a[0][0] < 0 ? -Math.PI - a[0][0] : Math.PI - a[0][0], + p2 = b[0][0] < 0 ? -Math.PI - b[0][0] : Math.PI - b[0][0]; + if (p1 > p2) { + return 1; + } + else { + return -1; + } + }, + // used by placeAnchors + edgeSortFunctions = { + "top": function (a, b) { + return a[0] > b[0] ? 1 : -1; + }, + "right": currySort(true), + "bottom": currySort(true), + "left": leftSort + }, + // used by placeAnchors + _sortHelper = function (_array, _fn) { + return _array.sort(_fn); + }, + // used by AnchorManager.redraw + placeAnchors = function (elementId, _anchorLists) { + var cd = jsPlumbInstance.getCachedData(elementId), sS = cd.s, sO = cd.o, + placeSomeAnchors = function (desc, elementDimensions, elementPosition, unsortedConnections, isHorizontal, otherMultiplier, orientation) { + if (unsortedConnections.length > 0) { + var sc = _sortHelper(unsortedConnections, edgeSortFunctions[desc]), // puts them in order based on the target element's pos on screen + reverse = desc === "right" || desc === "top", + anchors = placeAnchorsOnLine(desc, elementDimensions, + elementPosition, sc, + isHorizontal, otherMultiplier, reverse); + + // takes a computed anchor position and adjusts it for parent offset and scroll, then stores it. + var _setAnchorLocation = function (endpoint, anchorPos) { + continuousAnchorLocations[endpoint.id] = [ anchorPos[0], anchorPos[1], anchorPos[2], anchorPos[3] ]; + continuousAnchorOrientations[endpoint.id] = orientation; + }; + + for (var i = 0; i < anchors.length; i++) { + var c = anchors[i][4], weAreSource = c.endpoints[0].elementId === elementId, weAreTarget = c.endpoints[1].elementId === elementId; + if (weAreSource) { + _setAnchorLocation(c.endpoints[0], anchors[i]); + } + if (weAreTarget) { + _setAnchorLocation(c.endpoints[1], anchors[i]); + } + } + } + }; + + placeSomeAnchors("bottom", sS, [sO.left, sO.top], _anchorLists.bottom, true, 1, [0, 1]); + placeSomeAnchors("top", sS, [sO.left, sO.top], _anchorLists.top, true, 0, [0, -1]); + placeSomeAnchors("left", sS, [sO.left, sO.top], _anchorLists.left, false, 0, [-1, 0]); + placeSomeAnchors("right", sS, [sO.left, sO.top], _anchorLists.right, false, 1, [1, 0]); + }; + + this.reset = function () { + _amEndpoints = {}; + connectionsByElementId = {}; + anchorLists = {}; + }; + this.addFloatingConnection = function (key, conn) { + floatingConnections[key] = conn; + }; + this.removeFloatingConnection = function (key) { + delete floatingConnections[key]; + }; + this.newConnection = function (conn) { + var sourceId = conn.sourceId, targetId = conn.targetId, + ep = conn.endpoints, + doRegisterTarget = true, + registerConnection = function (otherIndex, otherEndpoint, otherAnchor, elId, c) { + if ((sourceId === targetId) && otherAnchor.isContinuous) { + // remove the target endpoint's canvas. we dont need it. + conn._jsPlumb.instance.removeElement(ep[1].canvas); + doRegisterTarget = false; + } + _ju.addToList(connectionsByElementId, elId, [c, otherEndpoint, otherAnchor.constructor === _jp.DynamicAnchor]); + }; + + registerConnection(0, ep[0], ep[0].anchor, targetId, conn); + if (doRegisterTarget) { + registerConnection(1, ep[1], ep[1].anchor, sourceId, conn); + } + }; + var removeEndpointFromAnchorLists = function (endpoint) { + (function (list, eId) { + if (list) { // transient anchors dont get entries in this list. + var f = function (e) { + return e[4] === eId; + }; + _ju.removeWithFunction(list.top, f); + _ju.removeWithFunction(list.left, f); + _ju.removeWithFunction(list.bottom, f); + _ju.removeWithFunction(list.right, f); + } + })(anchorLists[endpoint.elementId], endpoint.id); + }; + this.connectionDetached = function (connInfo, doNotRedraw) { + var connection = connInfo.connection || connInfo, + sourceId = connInfo.sourceId, + targetId = connInfo.targetId, + ep = connection.endpoints, + removeConnection = function (otherIndex, otherEndpoint, otherAnchor, elId, c) { + _ju.removeWithFunction(connectionsByElementId[elId], function (_c) { + return _c[0].id === c.id; + }); + }; + + removeConnection(1, ep[1], ep[1].anchor, sourceId, connection); + removeConnection(0, ep[0], ep[0].anchor, targetId, connection); + if (connection.floatingId) { + removeConnection(connection.floatingIndex, connection.floatingEndpoint, connection.floatingEndpoint.anchor, connection.floatingId, connection); + removeEndpointFromAnchorLists(connection.floatingEndpoint); + } + + // remove from anchorLists + removeEndpointFromAnchorLists(connection.endpoints[0]); + removeEndpointFromAnchorLists(connection.endpoints[1]); + + if (!doNotRedraw) { + self.redraw(connection.sourceId); + if (connection.targetId !== connection.sourceId) { + self.redraw(connection.targetId); + } + } + }; + this.add = function (endpoint, elementId) { + _ju.addToList(_amEndpoints, elementId, endpoint); + }; + this.changeId = function (oldId, newId) { + connectionsByElementId[newId] = connectionsByElementId[oldId]; + _amEndpoints[newId] = _amEndpoints[oldId]; + delete connectionsByElementId[oldId]; + delete _amEndpoints[oldId]; + }; + this.getConnectionsFor = function (elementId) { + return connectionsByElementId[elementId] || []; + }; + this.getEndpointsFor = function (elementId) { + return _amEndpoints[elementId] || []; + }; + this.deleteEndpoint = function (endpoint) { + _ju.removeWithFunction(_amEndpoints[endpoint.elementId], function (e) { + return e.id === endpoint.id; + }); + removeEndpointFromAnchorLists(endpoint); + }; + this.clearFor = function (elementId) { + delete _amEndpoints[elementId]; + _amEndpoints[elementId] = []; + }; + // updates the given anchor list by either updating an existing anchor's info, or adding it. this function + // also removes the anchor from its previous list, if the edge it is on has changed. + // all connections found along the way (those that are connected to one of the faces this function + // operates on) are added to the connsToPaint list, as are their endpoints. in this way we know to repaint + // them wthout having to calculate anything else about them. + var _updateAnchorList = function (lists, theta, order, conn, aBoolean, otherElId, idx, reverse, edgeId, elId, connsToPaint, endpointsToPaint) { + // first try to find the exact match, but keep track of the first index of a matching element id along the way.s + var exactIdx = -1, + firstMatchingElIdx = -1, + endpoint = conn.endpoints[idx], + endpointId = endpoint.id, + oIdx = [1, 0][idx], + values = [ + [ theta, order ], + conn, + aBoolean, + otherElId, + endpointId + ], + listToAddTo = lists[edgeId], + listToRemoveFrom = endpoint._continuousAnchorEdge ? lists[endpoint._continuousAnchorEdge] : null, + i, + candidate; + + if (listToRemoveFrom) { + var rIdx = _ju.findWithFunction(listToRemoveFrom, function (e) { + return e[4] === endpointId; + }); + if (rIdx !== -1) { + listToRemoveFrom.splice(rIdx, 1); + // get all connections from this list + for (i = 0; i < listToRemoveFrom.length; i++) { + candidate = listToRemoveFrom[i][1]; + _ju.addWithFunction(connsToPaint, candidate, function (c) { + return c.id === candidate.id; + }); + _ju.addWithFunction(endpointsToPaint, listToRemoveFrom[i][1].endpoints[idx], function (e) { + return e.id === candidate.endpoints[idx].id; + }); + _ju.addWithFunction(endpointsToPaint, listToRemoveFrom[i][1].endpoints[oIdx], function (e) { + return e.id === candidate.endpoints[oIdx].id; + }); + } + } + } + + for (i = 0; i < listToAddTo.length; i++) { + candidate = listToAddTo[i][1]; + if (params.idx === 1 && listToAddTo[i][3] === otherElId && firstMatchingElIdx === -1) { + firstMatchingElIdx = i; + } + _ju.addWithFunction(connsToPaint, candidate, function (c) { + return c.id === candidate.id; + }); + _ju.addWithFunction(endpointsToPaint, listToAddTo[i][1].endpoints[idx], function (e) { + return e.id === candidate.endpoints[idx].id; + }); + _ju.addWithFunction(endpointsToPaint, listToAddTo[i][1].endpoints[oIdx], function (e) { + return e.id === candidate.endpoints[oIdx].id; + }); + } + if (exactIdx !== -1) { + listToAddTo[exactIdx] = values; + } + else { + var insertIdx = reverse ? firstMatchingElIdx !== -1 ? firstMatchingElIdx : 0 : listToAddTo.length; // of course we will get this from having looked through the array shortly. + listToAddTo.splice(insertIdx, 0, values); + } + + // store this for next time. + endpoint._continuousAnchorEdge = edgeId; + }; + + // + // find the entry in an endpoint's list for this connection and update its target endpoint + // with the current target in the connection. + // This method and sourceChanged need to be folder into one. + // + this.updateOtherEndpoint = function (sourceElId, oldTargetId, newTargetId, connection) { + var sIndex = _ju.findWithFunction(connectionsByElementId[sourceElId], function (i) { + return i[0].id === connection.id; + }), + tIndex = _ju.findWithFunction(connectionsByElementId[oldTargetId], function (i) { + return i[0].id === connection.id; + }); + + // update or add data for source + if (sIndex !== -1) { + connectionsByElementId[sourceElId][sIndex][0] = connection; + connectionsByElementId[sourceElId][sIndex][1] = connection.endpoints[1]; + connectionsByElementId[sourceElId][sIndex][2] = connection.endpoints[1].anchor.constructor === _jp.DynamicAnchor; + } + + // remove entry for previous target (if there) + if (tIndex > -1) { + connectionsByElementId[oldTargetId].splice(tIndex, 1); + // add entry for new target + _ju.addToList(connectionsByElementId, newTargetId, [connection, connection.endpoints[0], connection.endpoints[0].anchor.constructor === _jp.DynamicAnchor]); + } + + connection.updateConnectedClass(); + }; + + // + // notification that the connection given has changed source from the originalId to the newId. + // This involves: + // 1. removing the connection from the list of connections stored for the originalId + // 2. updating the source information for the target of the connection + // 3. re-registering the connection in connectionsByElementId with the newId + // + this.sourceChanged = function (originalId, newId, connection, newElement) { + if (originalId !== newId) { + + connection.sourceId = newId; + connection.source = newElement; + + // remove the entry that points from the old source to the target + _ju.removeWithFunction(connectionsByElementId[originalId], function (info) { + return info[0].id === connection.id; + }); + // find entry for target and update it + var tIdx = _ju.findWithFunction(connectionsByElementId[connection.targetId], function (i) { + return i[0].id === connection.id; + }); + if (tIdx > -1) { + connectionsByElementId[connection.targetId][tIdx][0] = connection; + connectionsByElementId[connection.targetId][tIdx][1] = connection.endpoints[0]; + connectionsByElementId[connection.targetId][tIdx][2] = connection.endpoints[0].anchor.constructor === _jp.DynamicAnchor; + } + // add entry for new source + _ju.addToList(connectionsByElementId, newId, [connection, connection.endpoints[1], connection.endpoints[1].anchor.constructor === _jp.DynamicAnchor]); + + // TODO SP not final on this yet. when a user drags an existing connection and it turns into a self + // loop, then this code hides the target endpoint (by removing it from the DOM) But I think this should + // occur only if the anchor is Continuous + if (connection.endpoints[1].anchor.isContinuous) { + if (connection.source === connection.target) { + connection._jsPlumb.instance.removeElement(connection.endpoints[1].canvas); + } + else { + if (connection.endpoints[1].canvas.parentNode == null) { + connection._jsPlumb.instance.appendElement(connection.endpoints[1].canvas); + } + } + } + + connection.updateConnectedClass(); + } + }; + + // + // moves the given endpoint from `currentId` to `element`. + // This involves: + // + // 1. changing the key in _amEndpoints under which the endpoint is stored + // 2. changing the source or target values in all of the endpoint's connections + // 3. changing the array in connectionsByElementId in which the endpoint's connections + // are stored (done by either sourceChanged or updateOtherEndpoint) + // + this.rehomeEndpoint = function (ep, currentId, element) { + var eps = _amEndpoints[currentId] || [], + elementId = jsPlumbInstance.getId(element); + + if (elementId !== currentId) { + var idx = eps.indexOf(ep); + if (idx > -1) { + var _ep = eps.splice(idx, 1)[0]; + self.add(_ep, elementId); + } + } + + for (var i = 0; i < ep.connections.length; i++) { + if (ep.connections[i].sourceId === currentId) { + self.sourceChanged(currentId, ep.elementId, ep.connections[i], ep.element); + } + else if (ep.connections[i].targetId === currentId) { + ep.connections[i].targetId = ep.elementId; + ep.connections[i].target = ep.element; + self.updateOtherEndpoint(ep.connections[i].sourceId, currentId, ep.elementId, ep.connections[i]); + } + } + }; + + this.redraw = function (elementId, ui, timestamp, offsetToUI, clearEdits, doNotRecalcEndpoint) { + + if (!jsPlumbInstance.isSuspendDrawing()) { + // get all the endpoints for this element + var ep = _amEndpoints[elementId] || [], + endpointConnections = connectionsByElementId[elementId] || [], + connectionsToPaint = [], + endpointsToPaint = [], + anchorsToUpdate = []; + + timestamp = timestamp || jsPlumbInstance.timestamp(); + // offsetToUI are values that would have been calculated in the dragManager when registering + // an endpoint for an element that had a parent (somewhere in the hierarchy) that had been + // registered as draggable. + offsetToUI = offsetToUI || {left: 0, top: 0}; + if (ui) { + ui = { + left: ui.left + offsetToUI.left, + top: ui.top + offsetToUI.top + }; + } + + // valid for one paint cycle. + var myOffset = jsPlumbInstance.updateOffset({ elId: elementId, offset: ui, recalc: false, timestamp: timestamp }), + orientationCache = {}; + + // actually, first we should compute the orientation of this element to all other elements to which + // this element is connected with a continuous anchor (whether both ends of the connection have + // a continuous anchor or just one) + + for (var i = 0; i < endpointConnections.length; i++) { + var conn = endpointConnections[i][0], + sourceId = conn.sourceId, + targetId = conn.targetId, + sourceContinuous = conn.endpoints[0].anchor.isContinuous, + targetContinuous = conn.endpoints[1].anchor.isContinuous; + + if (sourceContinuous || targetContinuous) { + var oKey = sourceId + "_" + targetId, + o = orientationCache[oKey], + oIdx = conn.sourceId === elementId ? 1 : 0; + + if (sourceContinuous && !anchorLists[sourceId]) { + anchorLists[sourceId] = { top: [], right: [], bottom: [], left: [] }; + } + if (targetContinuous && !anchorLists[targetId]) { + anchorLists[targetId] = { top: [], right: [], bottom: [], left: [] }; + } + + if (elementId !== targetId) { + jsPlumbInstance.updateOffset({ elId: targetId, timestamp: timestamp }); + } + if (elementId !== sourceId) { + jsPlumbInstance.updateOffset({ elId: sourceId, timestamp: timestamp }); + } + + var td = jsPlumbInstance.getCachedData(targetId), + sd = jsPlumbInstance.getCachedData(sourceId); + + if (targetId === sourceId && (sourceContinuous || targetContinuous)) { + // here we may want to improve this by somehow determining the face we'd like + // to put the connector on. ideally, when drawing, the face should be calculated + // by determining which face is closest to the point at which the mouse button + // was released. for now, we're putting it on the top face. + _updateAnchorList( anchorLists[sourceId], -Math.PI / 2, 0, conn, false, targetId, 0, false, "top", sourceId, connectionsToPaint, endpointsToPaint); + _updateAnchorList( anchorLists[targetId], -Math.PI / 2, 0, conn, false, sourceId, 1, false, "top", targetId, connectionsToPaint, endpointsToPaint); + } + else { + if (!o) { + o = this.calculateOrientation(sourceId, targetId, sd.o, td.o, conn.endpoints[0].anchor, conn.endpoints[1].anchor, conn); + orientationCache[oKey] = o; + // this would be a performance enhancement, but the computed angles need to be clamped to + //the (-PI/2 -> PI/2) range in order for the sorting to work properly. + /* orientationCache[oKey2] = { + orientation:o.orientation, + a:[o.a[1], o.a[0]], + theta:o.theta + Math.PI, + theta2:o.theta2 + Math.PI + };*/ + } + if (sourceContinuous) { + _updateAnchorList(anchorLists[sourceId], o.theta, 0, conn, false, targetId, 0, false, o.a[0], sourceId, connectionsToPaint, endpointsToPaint); + } + if (targetContinuous) { + _updateAnchorList(anchorLists[targetId], o.theta2, -1, conn, true, sourceId, 1, true, o.a[1], targetId, connectionsToPaint, endpointsToPaint); + } + } + + if (sourceContinuous) { + _ju.addWithFunction(anchorsToUpdate, sourceId, function (a) { + return a === sourceId; + }); + } + if (targetContinuous) { + _ju.addWithFunction(anchorsToUpdate, targetId, function (a) { + return a === targetId; + }); + } + _ju.addWithFunction(connectionsToPaint, conn, function (c) { + return c.id === conn.id; + }); + if ((sourceContinuous && oIdx === 0) || (targetContinuous && oIdx === 1)) { + _ju.addWithFunction(endpointsToPaint, conn.endpoints[oIdx], function (e) { + return e.id === conn.endpoints[oIdx].id; + }); + } + } + } + + // place Endpoints whose anchors are continuous but have no Connections + for (i = 0; i < ep.length; i++) { + if (ep[i].connections.length === 0 && ep[i].anchor.isContinuous) { + if (!anchorLists[elementId]) { + anchorLists[elementId] = { top: [], right: [], bottom: [], left: [] }; + } + _updateAnchorList(anchorLists[elementId], -Math.PI / 2, 0, {endpoints: [ep[i], ep[i]], paint: function () { + }}, false, elementId, 0, false, ep[i].anchor.getDefaultFace(), elementId, connectionsToPaint, endpointsToPaint); + _ju.addWithFunction(anchorsToUpdate, elementId, function (a) { + return a === elementId; + }); + } + } + + // now place all the continuous anchors we need to; + for (i = 0; i < anchorsToUpdate.length; i++) { + placeAnchors(anchorsToUpdate[i], anchorLists[anchorsToUpdate[i]]); + } + + // now that continuous anchors have been placed, paint all the endpoints for this element + for (i = 0; i < ep.length; i++) { + ep[i].paint({ timestamp: timestamp, offset: myOffset, dimensions: myOffset.s, recalc: doNotRecalcEndpoint !== true }); + } + + // ... and any other endpoints we came across as a result of the continuous anchors. + for (i = 0; i < endpointsToPaint.length; i++) { + var cd = jsPlumbInstance.getCachedData(endpointsToPaint[i].elementId); + //endpointsToPaint[i].paint({ timestamp: timestamp, offset: cd, dimensions: cd.s }); + endpointsToPaint[i].paint({ timestamp: null, offset: cd, dimensions: cd.s }); + } + + // paint all the standard and "dynamic connections", which are connections whose other anchor is + // static and therefore does need to be recomputed; we make sure that happens only one time. + + // TODO we could have compiled a list of these in the first pass through connections; might save some time. + for (i = 0; i < endpointConnections.length; i++) { + var otherEndpoint = endpointConnections[i][1]; + if (otherEndpoint.anchor.constructor === _jp.DynamicAnchor) { + otherEndpoint.paint({ elementWithPrecedence: elementId, timestamp: timestamp }); + _ju.addWithFunction(connectionsToPaint, endpointConnections[i][0], function (c) { + return c.id === endpointConnections[i][0].id; + }); + // all the connections for the other endpoint now need to be repainted + for (var k = 0; k < otherEndpoint.connections.length; k++) { + if (otherEndpoint.connections[k] !== endpointConnections[i][0]) { + _ju.addWithFunction(connectionsToPaint, otherEndpoint.connections[k], function (c) { + return c.id === otherEndpoint.connections[k].id; + }); + } + } + } else { + _ju.addWithFunction(connectionsToPaint, endpointConnections[i][0], function (c) { + return c.id === endpointConnections[i][0].id; + }); + } + } + + // paint current floating connection for this element, if there is one. + var fc = floatingConnections[elementId]; + if (fc) { + fc.paint({timestamp: timestamp, recalc: false, elId: elementId}); + } + + // paint all the connections + for (i = 0; i < connectionsToPaint.length; i++) { + connectionsToPaint[i].paint({elId: elementId, timestamp: null, recalc: false, clearEdits: clearEdits}); + } + } + }; + + var ContinuousAnchor = function (anchorParams) { + _ju.EventGenerator.apply(this); + this.type = "Continuous"; + this.isDynamic = true; + this.isContinuous = true; + var faces = anchorParams.faces || ["top", "right", "bottom", "left"], + clockwise = !(anchorParams.clockwise === false), + availableFaces = { }, + opposites = { "top": "bottom", "right": "left", "left": "right", "bottom": "top" }, + clockwiseOptions = { "top": "right", "right": "bottom", "left": "top", "bottom": "left" }, + antiClockwiseOptions = { "top": "left", "right": "top", "left": "bottom", "bottom": "right" }, + secondBest = clockwise ? clockwiseOptions : antiClockwiseOptions, + lastChoice = clockwise ? antiClockwiseOptions : clockwiseOptions, + cssClass = anchorParams.cssClass || "", + _currentFace = null, _lockedFace = null, X_AXIS_FACES = ["left", "right"], Y_AXIS_FACES = ["top", "bottom"], + _lockedAxis = null; + + for (var i = 0; i < faces.length; i++) { + availableFaces[faces[i]] = true; + } + + this.getDefaultFace = function () { + return faces.length === 0 ? "top" : faces[0]; + }; + + this.isRelocatable = function() { return true; }; + this.isSnapOnRelocate = function() { return true; }; + + // if the given edge is supported, returns it. otherwise looks for a substitute that _is_ + // supported. if none supported we also return the request edge. + this.verifyEdge = function (edge) { + if (availableFaces[edge]) { + return edge; + } + else if (availableFaces[opposites[edge]]) { + return opposites[edge]; + } + else if (availableFaces[secondBest[edge]]) { + return secondBest[edge]; + } + else if (availableFaces[lastChoice[edge]]) { + return lastChoice[edge]; + } + return edge; // we have to give them something. + }; + + this.isEdgeSupported = function (edge) { + return _lockedAxis == null ? + + (_lockedFace == null ? availableFaces[edge] === true : _lockedFace === edge) + + : _lockedAxis.indexOf(edge) !== -1; + }; + + this.setCurrentFace = function(face, overrideLock) { + _currentFace = face; + // if currently locked, and the user wants to override, do that. + if (overrideLock && _lockedFace != null) { + _lockedFace = _currentFace; + } + }; + + this.getCurrentFace = function() { return _currentFace; }; + this.getSupportedFaces = function() { + var af = []; + for (var k in availableFaces) { + if (availableFaces[k]) { + af.push(k); + } + } + return af; + }; + + this.lock = function() { + _lockedFace = _currentFace; + }; + this.unlock = function() { + _lockedFace = null; + }; + this.isLocked = function() { + return _lockedFace != null; + }; + + this.lockCurrentAxis = function() { + if (_currentFace != null) { + _lockedAxis = (_currentFace === "left" || _currentFace === "right") ? X_AXIS_FACES : Y_AXIS_FACES; + } + }; + + this.unlockCurrentAxis = function() { + _lockedAxis = null; + }; + + this.compute = function (params) { + return continuousAnchorLocations[params.element.id] || [0, 0]; + }; + this.getCurrentLocation = function (params) { + return continuousAnchorLocations[params.element.id] || [0, 0]; + }; + this.getOrientation = function (endpoint) { + return continuousAnchorOrientations[endpoint.id] || [0, 0]; + }; + this.getCssClass = function () { + return cssClass; + }; + }; + + // continuous anchors + jsPlumbInstance.continuousAnchorFactory = { + get: function (params) { + return new ContinuousAnchor(params); + }, + clear: function (elementId) { + delete continuousAnchorLocations[elementId]; + } + }; + }; + + _jp.AnchorManager.prototype.calculateOrientation = function (sourceId, targetId, sd, td, sourceAnchor, targetAnchor) { + + var Orientation = { HORIZONTAL: "horizontal", VERTICAL: "vertical", DIAGONAL: "diagonal", IDENTITY: "identity" }, + axes = ["left", "top", "right", "bottom"]; + + if (sourceId === targetId) { + return { + orientation: Orientation.IDENTITY, + a: ["top", "top"] + }; + } + + var theta = Math.atan2((td.centery - sd.centery), (td.centerx - sd.centerx)), + theta2 = Math.atan2((sd.centery - td.centery), (sd.centerx - td.centerx)); + +// -------------------------------------------------------------------------------------- + + // improved face calculation. get midpoints of each face for source and target, then put in an array with all combinations of + // source/target faces. sort this array by distance between midpoints. the entry at index 0 is our preferred option. we can + // go through the array one by one until we find an entry in which each requested face is supported. + var candidates = [], midpoints = { }; + (function (types, dim) { + for (var i = 0; i < types.length; i++) { + midpoints[types[i]] = { + "left": [ dim[i].left, dim[i].centery ], + "right": [ dim[i].right, dim[i].centery ], + "top": [ dim[i].centerx, dim[i].top ], + "bottom": [ dim[i].centerx , dim[i].bottom] + }; + } + })([ "source", "target" ], [ sd, td ]); + + for (var sf = 0; sf < axes.length; sf++) { + for (var tf = 0; tf < axes.length; tf++) { + candidates.push({ + source: axes[sf], + target: axes[tf], + dist: Biltong.lineLength(midpoints.source[axes[sf]], midpoints.target[axes[tf]]) + }); + } + } + + candidates.sort(function (a, b) { + return a.dist < b.dist ? -1 : a.dist > b.dist ? 1 : 0; + }); + + // now go through this list and try to get an entry that satisfies both (there will be one, unless one of the anchors + // declares no available faces) + var sourceEdge = candidates[0].source, targetEdge = candidates[0].target; + for (var i = 0; i < candidates.length; i++) { + + if (!sourceAnchor.isContinuous || sourceAnchor.isEdgeSupported(candidates[i].source)) { + sourceEdge = candidates[i].source; + } + else { + sourceEdge = null; + } + + if (!targetAnchor.isContinuous || targetAnchor.isEdgeSupported(candidates[i].target)) { + targetEdge = candidates[i].target; + } + else { + targetEdge = null; + } + + if (sourceEdge != null && targetEdge != null) { + break; + } + } + + if (sourceAnchor.isContinuous) { + sourceAnchor.setCurrentFace(sourceEdge); + } + + if (targetAnchor.isContinuous) { + targetAnchor.setCurrentFace(targetEdge); + } + +// -------------------------------------------------------------------------------------- + + return { + a: [ sourceEdge, targetEdge ], + theta: theta, + theta2: theta2 + }; + }; + + /** + * Anchors model a position on some element at which an Endpoint may be located. They began as a first class citizen of jsPlumb, ie. a user + * was required to create these themselves, but over time this has been replaced by the concept of referring to them either by name (eg. "TopMiddle"), + * or by an array describing their coordinates (eg. [ 0, 0.5, 0, -1 ], which is the same as "TopMiddle"). jsPlumb now handles all of the + * creation of Anchors without user intervention. + */ + _jp.Anchor = function (params) { + this.x = params.x || 0; + this.y = params.y || 0; + this.elementId = params.elementId; + this.cssClass = params.cssClass || ""; + this.userDefinedLocation = null; + this.orientation = params.orientation || [ 0, 0 ]; + this.lastReturnValue = null; + this.offsets = params.offsets || [ 0, 0 ]; + this.timestamp = null; + + var relocatable = params.relocatable !== false; + this.isRelocatable = function() { return relocatable; }; + this.setRelocatable = function(_relocatable) { relocatable = _relocatable; }; + var snapOnRelocate = params.snapOnRelocate !== false; + this.isSnapOnRelocate = function() { return snapOnRelocate; }; + + var locked = false; + this.lock = function() { locked = true; }; + this.unlock = function() { locked = false; }; + this.isLocked = function() { return locked; }; + + _ju.EventGenerator.apply(this); + + this.compute = function (params) { + + var xy = params.xy, wh = params.wh, timestamp = params.timestamp; + + if (params.clearUserDefinedLocation) { + this.userDefinedLocation = null; + } + + if (timestamp && timestamp === this.timestamp) { + return this.lastReturnValue; + } + + if (this.userDefinedLocation != null) { + this.lastReturnValue = this.userDefinedLocation; + } + else { + this.lastReturnValue = [ xy[0] + (this.x * wh[0]) + this.offsets[0], xy[1] + (this.y * wh[1]) + this.offsets[1], this.x, this.y ]; + } + + this.timestamp = timestamp; + return this.lastReturnValue; + }; + + this.getCurrentLocation = function (params) { + params = params || {}; + return (this.lastReturnValue == null || (params.timestamp != null && this.timestamp !== params.timestamp)) ? this.compute(params) : this.lastReturnValue; + }; + + this.setPosition = function(x, y, ox, oy, overrideLock) { + if (!locked || overrideLock) { + this.x = x; + this.y = y; + this.orientation = [ ox, oy ]; + this.lastReturnValue = null; + } + }; + }; + _ju.extend(_jp.Anchor, _ju.EventGenerator, { + equals: function (anchor) { + if (!anchor) { + return false; + } + var ao = anchor.getOrientation(), + o = this.getOrientation(); + return this.x === anchor.x && this.y === anchor.y && this.offsets[0] === anchor.offsets[0] && this.offsets[1] === anchor.offsets[1] && o[0] === ao[0] && o[1] === ao[1]; + }, + getUserDefinedLocation: function () { + return this.userDefinedLocation; + }, + setUserDefinedLocation: function (l) { + this.userDefinedLocation = l; + }, + clearUserDefinedLocation: function () { + this.userDefinedLocation = null; + }, + getOrientation: function () { + return this.orientation; + }, + getCssClass: function () { + return this.cssClass; + } + }); + + /** + * An Anchor that floats. its orientation is computed dynamically from + * its position relative to the anchor it is floating relative to. It is used when creating + * a connection through drag and drop. + * + * TODO FloatingAnchor could totally be refactored to extend Anchor just slightly. + */ + _jp.FloatingAnchor = function (params) { + + _jp.Anchor.apply(this, arguments); + + // this is the anchor that this floating anchor is referenced to for + // purposes of calculating the orientation. + var ref = params.reference, + // the canvas this refers to. + refCanvas = params.referenceCanvas, + size = _jp.getSize(refCanvas), + // these are used to store the current relative position of our + // anchor wrt the reference anchor. they only indicate + // direction, so have a value of 1 or -1 (or, very rarely, 0). these + // values are written by the compute method, and read + // by the getOrientation method. + xDir = 0, yDir = 0, + // temporary member used to store an orientation when the floating + // anchor is hovering over another anchor. + orientation = null, + _lastResult = null; + + // clear from parent. we want floating anchor orientation to always be computed. + this.orientation = null; + + // set these to 0 each; they are used by certain types of connectors in the loopback case, + // when the connector is trying to clear the element it is on. but for floating anchor it's not + // very important. + this.x = 0; + this.y = 0; + + this.isFloating = true; + + this.compute = function (params) { + var xy = params.xy, + result = [ xy[0] + (size[0] / 2), xy[1] + (size[1] / 2) ]; // return origin of the element. we may wish to improve this so that any object can be the drag proxy. + _lastResult = result; + return result; + }; + + this.getOrientation = function (_endpoint) { + if (orientation) { + return orientation; + } + else { + var o = ref.getOrientation(_endpoint); + // here we take into account the orientation of the other + // anchor: if it declares zero for some direction, we declare zero too. this might not be the most awesome. perhaps we can come + // up with a better way. it's just so that the line we draw looks like it makes sense. maybe this wont make sense. + return [ Math.abs(o[0]) * xDir * -1, + Math.abs(o[1]) * yDir * -1 ]; + } + }; + + /** + * notification the endpoint associated with this anchor is hovering + * over another anchor; we want to assume that anchor's orientation + * for the duration of the hover. + */ + this.over = function (anchor, endpoint) { + orientation = anchor.getOrientation(endpoint); + }; + + /** + * notification the endpoint associated with this anchor is no + * longer hovering over another anchor; we should resume calculating + * orientation as we normally do. + */ + this.out = function () { + orientation = null; + }; + + this.getCurrentLocation = function (params) { + return _lastResult == null ? this.compute(params) : _lastResult; + }; + }; + _ju.extend(_jp.FloatingAnchor, _jp.Anchor); + + var _convertAnchor = function (anchor, jsPlumbInstance, elementId) { + return anchor.constructor === _jp.Anchor ? anchor : jsPlumbInstance.makeAnchor(anchor, elementId, jsPlumbInstance); + }; + + /* + * A DynamicAnchor is an Anchor that contains a list of other Anchors, which it cycles + * through at compute time to find the one that is located closest to + * the center of the target element, and returns that Anchor's compute + * method result. this causes endpoints to follow each other with + * respect to the orientation of their target elements, which is a useful + * feature for some applications. + * + */ + _jp.DynamicAnchor = function (params) { + _jp.Anchor.apply(this, arguments); + + this.isDynamic = true; + this.anchors = []; + this.elementId = params.elementId; + this.jsPlumbInstance = params.jsPlumbInstance; + + for (var i = 0; i < params.anchors.length; i++) { + this.anchors[i] = _convertAnchor(params.anchors[i], this.jsPlumbInstance, this.elementId); + } + + this.getAnchors = function () { + return this.anchors; + }; + + var _curAnchor = this.anchors.length > 0 ? this.anchors[0] : null, + _lastAnchor = _curAnchor, + self = this, + + // helper method to calculate the distance between the centers of the two elements. + _distance = function (anchor, cx, cy, xy, wh) { + var ax = xy[0] + (anchor.x * wh[0]), ay = xy[1] + (anchor.y * wh[1]), + acx = xy[0] + (wh[0] / 2), acy = xy[1] + (wh[1] / 2); + return (Math.sqrt(Math.pow(cx - ax, 2) + Math.pow(cy - ay, 2)) + + Math.sqrt(Math.pow(acx - ax, 2) + Math.pow(acy - ay, 2))); + }, + // default method uses distance between element centers. you can provide your own method in the dynamic anchor + // constructor (and also to jsPlumb.makeDynamicAnchor). the arguments to it are four arrays: + // xy - xy loc of the anchor's element + // wh - anchor's element's dimensions + // txy - xy loc of the element of the other anchor in the connection + // twh - dimensions of the element of the other anchor in the connection. + // anchors - the list of selectable anchors + _anchorSelector = params.selector || function (xy, wh, txy, twh, anchors) { + var cx = txy[0] + (twh[0] / 2), cy = txy[1] + (twh[1] / 2); + var minIdx = -1, minDist = Infinity; + for (var i = 0; i < anchors.length; i++) { + var d = _distance(anchors[i], cx, cy, xy, wh); + if (d < minDist) { + minIdx = i + 0; + minDist = d; + } + } + return anchors[minIdx]; + }; + + this.compute = function (params) { + var xy = params.xy, wh = params.wh, txy = params.txy, twh = params.twh; + + this.timestamp = params.timestamp; + + var udl = self.getUserDefinedLocation(); + if (udl != null) { + return udl; + } + + // if anchor is locked or an opposite element was not given, we + // maintain our state. anchor will be locked + // if it is the source of a drag and drop. + if (this.isLocked() || txy == null || twh == null) { + return _curAnchor.compute(params); + } + else { + params.timestamp = null; // otherwise clear this, i think. we want the anchor to compute. + } + + _curAnchor = _anchorSelector(xy, wh, txy, twh, this.anchors); + this.x = _curAnchor.x; + this.y = _curAnchor.y; + + if (_curAnchor !== _lastAnchor) { + this.fire("anchorChanged", _curAnchor); + } + + _lastAnchor = _curAnchor; + + return _curAnchor.compute(params); + }; + + this.getCurrentLocation = function (params) { + return this.getUserDefinedLocation() || (_curAnchor != null ? _curAnchor.getCurrentLocation(params) : null); + }; + + this.getOrientation = function (_endpoint) { + return _curAnchor != null ? _curAnchor.getOrientation(_endpoint) : [ 0, 0 ]; + }; + this.over = function (anchor, endpoint) { + if (_curAnchor != null) { + _curAnchor.over(anchor, endpoint); + } + }; + this.out = function () { + if (_curAnchor != null) { + _curAnchor.out(); + } + }; + + this.setAnchor = function(a) { + _curAnchor = a; + }; + + this.getCssClass = function () { + return (_curAnchor && _curAnchor.getCssClass()) || ""; + }; + + /** + * Attempt to match an anchor with the given coordinates and then set it. + * @param coords + * @returns true if matching anchor found, false otherwise. + */ + this.setAnchorCoordinates = function(coords) { + var idx = jsPlumbUtil.findWithFunction(this.anchors, function(a) { + return a.x === coords[0] && a.y === coords[1]; + }); + if (idx !== -1) { + this.setAnchor(this.anchors[idx]); + return true; + } else { + return false; + } + }; + }; + _ju.extend(_jp.DynamicAnchor, _jp.Anchor); + +// -------- basic anchors ------------------ + var _curryAnchor = function (x, y, ox, oy, type, fnInit) { + _jp.Anchors[type] = function (params) { + var a = params.jsPlumbInstance.makeAnchor([ x, y, ox, oy, 0, 0 ], params.elementId, params.jsPlumbInstance); + a.type = type; + if (fnInit) { + fnInit(a, params); + } + return a; + }; + }; + + _curryAnchor(0.5, 0, 0, -1, "TopCenter"); + _curryAnchor(0.5, 1, 0, 1, "BottomCenter"); + _curryAnchor(0, 0.5, -1, 0, "LeftMiddle"); + _curryAnchor(1, 0.5, 1, 0, "RightMiddle"); + + _curryAnchor(0.5, 0, 0, -1, "Top"); + _curryAnchor(0.5, 1, 0, 1, "Bottom"); + _curryAnchor(0, 0.5, -1, 0, "Left"); + _curryAnchor(1, 0.5, 1, 0, "Right"); + _curryAnchor(0.5, 0.5, 0, 0, "Center"); + _curryAnchor(1, 0, 0, -1, "TopRight"); + _curryAnchor(1, 1, 0, 1, "BottomRight"); + _curryAnchor(0, 0, 0, -1, "TopLeft"); + _curryAnchor(0, 1, 0, 1, "BottomLeft"); + +// ------- dynamic anchors ------------------- + + // default dynamic anchors chooses from Top, Right, Bottom, Left + _jp.Defaults.DynamicAnchors = function (params) { + return params.jsPlumbInstance.makeAnchors(["TopCenter", "RightMiddle", "BottomCenter", "LeftMiddle"], params.elementId, params.jsPlumbInstance); + }; + + // default dynamic anchors bound to name 'AutoDefault' + _jp.Anchors.AutoDefault = function (params) { + var a = params.jsPlumbInstance.makeDynamicAnchor(_jp.Defaults.DynamicAnchors(params)); + a.type = "AutoDefault"; + return a; + }; + +// ------- continuous anchors ------------------- + + var _curryContinuousAnchor = function (type, faces) { + _jp.Anchors[type] = function (params) { + var a = params.jsPlumbInstance.makeAnchor(["Continuous", { faces: faces }], params.elementId, params.jsPlumbInstance); + a.type = type; + return a; + }; + }; + + _jp.Anchors.Continuous = function (params) { + return params.jsPlumbInstance.continuousAnchorFactory.get(params); + }; + + _curryContinuousAnchor("ContinuousLeft", ["left"]); + _curryContinuousAnchor("ContinuousTop", ["top"]); + _curryContinuousAnchor("ContinuousBottom", ["bottom"]); + _curryContinuousAnchor("ContinuousRight", ["right"]); + +// ------- position assign anchors ------------------- + + // this anchor type lets you assign the position at connection time. + _curryAnchor(0, 0, 0, 0, "Assign", function (anchor, params) { + // find what to use as the "position finder". the user may have supplied a String which represents + // the id of a position finder in jsPlumb.AnchorPositionFinders, or the user may have supplied the + // position finder as a function. we find out what to use and then set it on the anchor. + var pf = params.position || "Fixed"; + anchor.positionFinder = pf.constructor === String ? params.jsPlumbInstance.AnchorPositionFinders[pf] : pf; + // always set the constructor params; the position finder might need them later (the Grid one does, + // for example) + anchor.constructorParams = params; + }); + + // these are the default anchor positions finders, which are used by the makeTarget function. supplying + // a position finder argument to that function allows you to specify where the resulting anchor will + // be located + root.jsPlumbInstance.prototype.AnchorPositionFinders = { + "Fixed": function (dp, ep, es) { + return [ (dp.left - ep.left) / es[0], (dp.top - ep.top) / es[1] ]; + }, + "Grid": function (dp, ep, es, params) { + var dx = dp.left - ep.left, dy = dp.top - ep.top, + gx = es[0] / (params.grid[0]), gy = es[1] / (params.grid[1]), + mx = Math.floor(dx / gx), my = Math.floor(dy / gy); + return [ ((mx * gx) + (gx / 2)) / es[0], ((my * gy) + (gy / 2)) / es[1] ]; + } + }; + +// ------- perimeter anchors ------------------- + + _jp.Anchors.Perimeter = function (params) { + params = params || {}; + var anchorCount = params.anchorCount || 60, + shape = params.shape; + + if (!shape) { + throw new Error("no shape supplied to Perimeter Anchor type"); + } + + var _circle = function () { + var r = 0.5, step = Math.PI * 2 / anchorCount, current = 0, a = []; + for (var i = 0; i < anchorCount; i++) { + var x = r + (r * Math.sin(current)), + y = r + (r * Math.cos(current)); + a.push([ x, y, 0, 0 ]); + current += step; + } + return a; + }, + _path = function (segments) { + var anchorsPerFace = anchorCount / segments.length, a = [], + _computeFace = function (x1, y1, x2, y2, fractionalLength) { + anchorsPerFace = anchorCount * fractionalLength; + var dx = (x2 - x1) / anchorsPerFace, dy = (y2 - y1) / anchorsPerFace; + for (var i = 0; i < anchorsPerFace; i++) { + a.push([ + x1 + (dx * i), + y1 + (dy * i), + 0, + 0 + ]); + } + }; + + for (var i = 0; i < segments.length; i++) { + _computeFace.apply(null, segments[i]); + } + + return a; + }, + _shape = function (faces) { + var s = []; + for (var i = 0; i < faces.length; i++) { + s.push([faces[i][0], faces[i][1], faces[i][2], faces[i][3], 1 / faces.length]); + } + return _path(s); + }, + _rectangle = function () { + return _shape([ + [ 0, 0, 1, 0 ], + [ 1, 0, 1, 1 ], + [ 1, 1, 0, 1 ], + [ 0, 1, 0, 0 ] + ]); + }; + + var _shapes = { + "Circle": _circle, + "Ellipse": _circle, + "Diamond": function () { + return _shape([ + [ 0.5, 0, 1, 0.5 ], + [ 1, 0.5, 0.5, 1 ], + [ 0.5, 1, 0, 0.5 ], + [ 0, 0.5, 0.5, 0 ] + ]); + }, + "Rectangle": _rectangle, + "Square": _rectangle, + "Triangle": function () { + return _shape([ + [ 0.5, 0, 1, 1 ], + [ 1, 1, 0, 1 ], + [ 0, 1, 0.5, 0] + ]); + }, + "Path": function (params) { + var points = params.points, p = [], tl = 0; + for (var i = 0; i < points.length - 1; i++) { + var l = Math.sqrt(Math.pow(points[i][2] - points[i][0]) + Math.pow(points[i][3] - points[i][1])); + tl += l; + p.push([points[i][0], points[i][1], points[i + 1][0], points[i + 1][1], l]); + } + for (var j = 0; j < p.length; j++) { + p[j][4] = p[j][4] / tl; + } + return _path(p); + } + }, + _rotate = function (points, amountInDegrees) { + var o = [], theta = amountInDegrees / 180 * Math.PI; + for (var i = 0; i < points.length; i++) { + var _x = points[i][0] - 0.5, + _y = points[i][1] - 0.5; + + o.push([ + 0.5 + ((_x * Math.cos(theta)) - (_y * Math.sin(theta))), + 0.5 + ((_x * Math.sin(theta)) + (_y * Math.cos(theta))), + points[i][2], + points[i][3] + ]); + } + return o; + }; + + if (!_shapes[shape]) { + throw new Error("Shape [" + shape + "] is unknown by Perimeter Anchor type"); + } + + var da = _shapes[shape](params); + if (params.rotation) { + da = _rotate(da, params.rotation); + } + var a = params.jsPlumbInstance.makeDynamicAnchor(da); + a.type = "Perimeter"; + return a; + }; +}).call(typeof window !== 'undefined' ? window : this); +/* + * This file contains the default Connectors, Endpoint and Overlay definitions. + * + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +; +(function () { + + "use strict"; + var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil, _jg = root.Biltong; + + _jp.Segments = { + + /* + * Class: AbstractSegment + * A Connector is made up of 1..N Segments, each of which has a Type, such as 'Straight', 'Arc', + * 'Bezier'. This is new from 1.4.2, and gives us a lot more flexibility when drawing connections: things such + * as rounded corners for flowchart connectors, for example, or a straight line stub for Bezier connections, are + * much easier to do now. + * + * A Segment is responsible for providing coordinates for painting it, and also must be able to report its length. + * + */ + AbstractSegment: function (params) { + this.params = params; + + /** + * Function: findClosestPointOnPath + * Finds the closest point on this segment to the given [x, y], + * returning both the x and y of the point plus its distance from + * the supplied point, and its location along the length of the + * path inscribed by the segment. This implementation returns + * Infinity for distance and null values for everything else; + * subclasses are expected to override. + */ + this.findClosestPointOnPath = function (x, y) { + return { + d: Infinity, + x: null, + y: null, + l: null + }; + }; + + this.getBounds = function () { + return { + minX: Math.min(params.x1, params.x2), + minY: Math.min(params.y1, params.y2), + maxX: Math.max(params.x1, params.x2), + maxY: Math.max(params.y1, params.y2) + }; + }; + + /** + * Computes the list of points on the segment that intersect the given line. + * @method lineIntersection + * @param {number} x1 + * @param {number} y1 + * @param {number} x2 + * @param {number} y2 + * @returns {Array<[number, number]>} + */ + this.lineIntersection = function(x1, y1, x2, y2) { + return []; + }; + + /** + * Computes the list of points on the segment that intersect the box with the given origin and size. + * @method boxIntersection + * @param {number} x1 + * @param {number} y1 + * @param {number} w + * @param {number} h + * @returns {Array<[number, number]>} + */ + this.boxIntersection = function(x, y, w, h) { + var a = []; + a.push.apply(a, this.lineIntersection(x, y, x + w, y)); + a.push.apply(a, this.lineIntersection(x + w, y, x + w, y + h)); + a.push.apply(a, this.lineIntersection(x + w, y + h, x, y + h)); + a.push.apply(a, this.lineIntersection(x, y + h, x, y)); + return a; + }; + + /** + * Computes the list of points on the segment that intersect the given bounding box, which is an object of the form { x:.., y:.., w:.., h:.. }. + * @method lineIntersection + * @param {BoundingRectangle} box + * @returns {Array<[number, number]>} + */ + this.boundingBoxIntersection = function(box) { + return this.boxIntersection(box.x, box.y, box.w, box.y); + }; + }, + Straight: function (params) { + var _super = _jp.Segments.AbstractSegment.apply(this, arguments), + length, m, m2, x1, x2, y1, y2, + _recalc = function () { + length = Math.sqrt(Math.pow(x2 - x1, 2) + Math.pow(y2 - y1, 2)); + m = _jg.gradient({x: x1, y: y1}, {x: x2, y: y2}); + m2 = -1 / m; + }; + + this.type = "Straight"; + + this.getLength = function () { + return length; + }; + this.getGradient = function () { + return m; + }; + + this.getCoordinates = function () { + return { x1: x1, y1: y1, x2: x2, y2: y2 }; + }; + this.setCoordinates = function (coords) { + x1 = coords.x1; + y1 = coords.y1; + x2 = coords.x2; + y2 = coords.y2; + _recalc(); + }; + this.setCoordinates({x1: params.x1, y1: params.y1, x2: params.x2, y2: params.y2}); + + this.getBounds = function () { + return { + minX: Math.min(x1, x2), + minY: Math.min(y1, y2), + maxX: Math.max(x1, x2), + maxY: Math.max(y1, y2) + }; + }; + + /** + * returns the point on the segment's path that is 'location' along the length of the path, where 'location' is a decimal from + * 0 to 1 inclusive. for the straight line segment this is simple maths. + */ + this.pointOnPath = function (location, absolute) { + if (location === 0 && !absolute) { + return { x: x1, y: y1 }; + } + else if (location === 1 && !absolute) { + return { x: x2, y: y2 }; + } + else { + var l = absolute ? location > 0 ? location : length + location : location * length; + return _jg.pointOnLine({x: x1, y: y1}, {x: x2, y: y2}, l); + } + }; + + /** + * returns the gradient of the segment at the given point - which for us is constant. + */ + this.gradientAtPoint = function (_) { + return m; + }; + + /** + * returns the point on the segment's path that is 'distance' along the length of the path from 'location', where + * 'location' is a decimal from 0 to 1 inclusive, and 'distance' is a number of pixels. + * this hands off to jsPlumbUtil to do the maths, supplying two points and the distance. + */ + this.pointAlongPathFrom = function (location, distance, absolute) { + var p = this.pointOnPath(location, absolute), + farAwayPoint = distance <= 0 ? {x: x1, y: y1} : {x: x2, y: y2 }; + + /* + location == 1 ? { + x:x1 + ((x2 - x1) * 10), + y:y1 + ((y1 - y2) * 10) + } : + */ + + if (distance <= 0 && Math.abs(distance) > 1) { + distance *= -1; + } + + return _jg.pointOnLine(p, farAwayPoint, distance); + }; + + // is c between a and b? + var within = function (a, b, c) { + return c >= Math.min(a, b) && c <= Math.max(a, b); + }; + // find which of a and b is closest to c + var closest = function (a, b, c) { + return Math.abs(c - a) < Math.abs(c - b) ? a : b; + }; + + /** + Function: findClosestPointOnPath + Finds the closest point on this segment to [x,y]. See + notes on this method in AbstractSegment. + */ + this.findClosestPointOnPath = function (x, y) { + var out = { + d: Infinity, + x: null, + y: null, + l: null, + x1: x1, + x2: x2, + y1: y1, + y2: y2 + }; + + if (m === 0) { + out.y = y1; + out.x = within(x1, x2, x) ? x : closest(x1, x2, x); + } + else if (m === Infinity || m === -Infinity) { + out.x = x1; + out.y = within(y1, y2, y) ? y : closest(y1, y2, y); + } + else { + // closest point lies on normal from given point to this line. + var b = y1 - (m * x1), + b2 = y - (m2 * x), + // y1 = m.x1 + b and y1 = m2.x1 + b2 + // so m.x1 + b = m2.x1 + b2 + // x1(m - m2) = b2 - b + // x1 = (b2 - b) / (m - m2) + _x1 = (b2 - b) / (m - m2), + _y1 = (m * _x1) + b; + + out.x = within(x1, x2, _x1) ? _x1 : closest(x1, x2, _x1);//_x1; + out.y = within(y1, y2, _y1) ? _y1 : closest(y1, y2, _y1);//_y1; + } + + var fractionInSegment = _jg.lineLength([ out.x, out.y ], [ x1, y1 ]); + out.d = _jg.lineLength([x, y], [out.x, out.y]); + out.l = fractionInSegment / length; + return out; + }; + + var _pointLiesBetween = function(q, p1, p2) { + return (p2 > p1) ? (p1 <= q && q <= p2) : (p1 >= q && q >= p2); + }, _plb = _pointLiesBetween; + + /** + * Calculates all intersections of the given line with this segment. + * @param _x1 + * @param _y1 + * @param _x2 + * @param _y2 + * @returns {Array} + */ + this.lineIntersection = function(_x1, _y1, _x2, _y2) { + var m2 = Math.abs(_jg.gradient({x: _x1, y: _y1}, {x: _x2, y: _y2})), + m1 = Math.abs(m), + b = m1 === Infinity ? x1 : y1 - (m1 * x1), + out = [], + b2 = m2 === Infinity ? _x1 : _y1 - (m2 * _x1); + + // if lines parallel, no intersection + if (m2 !== m1) { + // perpendicular, segment horizontal + if(m2 === Infinity && m1 === 0) { + if (_plb(_x1, x1, x2) && _plb(y1, _y1, _y2)) { + out = [ _x1, y1 ]; // we return X on the incident line and Y from the segment + } + } else if(m2 === 0 && m1 === Infinity) { + // perpendicular, segment vertical + if(_plb(_y1, y1, y2) && _plb(x1, _x1, _x2)) { + out = [x1, _y1]; // we return X on the segment and Y from the incident line + } + } else { + var X, Y; + if (m2 === Infinity) { + // test line is a vertical line. where does it cross the segment? + X = _x1; + if (_plb(X, x1, x2)) { + Y = (m1 * _x1) + b; + if (_plb(Y, _y1, _y2)) { + out = [ X, Y ]; + } + } + } else if (m2 === 0) { + Y = _y1; + // test line is a horizontal line. where does it cross the segment? + if (_plb(Y, y1, y2)) { + X = (_y1 - b) / m1; + if (_plb(X, _x1, _x2)) { + out = [ X, Y ]; + } + } + } else { + // mX + b = m2X + b2 + // mX - m2X = b2 - b + // X(m - m2) = b2 - b + // X = (b2 - b) / (m - m2) + // Y = mX + b + X = (b2 - b) / (m1 - m2); + Y = (m1 * X) + b; + if(_plb(X, x1, x2) && _plb(Y, y1, y2)) { + out = [ X, Y]; + } + } + } + } + + return out; + }; + + /** + * Calculates all intersections of the given box with this segment. By default this method simply calls `lineIntersection` with each of the four + * faces of the box; subclasses can override this if they think there's a faster way to compute the entire box at once. + * @param x X position of top left corner of box + * @param y Y position of top left corner of box + * @param w width of box + * @param h height of box + * @returns {Array} + */ + this.boxIntersection = function(x, y, w, h) { + var a = []; + a.push.apply(a, this.lineIntersection(x, y, x + w, y)); + a.push.apply(a, this.lineIntersection(x + w, y, x + w, y + h)); + a.push.apply(a, this.lineIntersection(x + w, y + h, x, y + h)); + a.push.apply(a, this.lineIntersection(x, y + h, x, y)); + return a; + }; + + /** + * Calculates all intersections of the given bounding box with this segment. By default this method simply calls `lineIntersection` with each of the four + * faces of the box; subclasses can override this if they think there's a faster way to compute the entire box at once. + * @param box Bounding box, in { x:.., y:..., w:..., h:... } format. + * @returns {Array} + */ + this.boundingBoxIntersection = function(box) { + return this.boxIntersection(box.x, box.y, box.w, box.h); + }; + }, + + /* + Arc Segment. You need to supply: + + r - radius + cx - center x for the arc + cy - center y for the arc + ac - whether the arc is anticlockwise or not. default is clockwise. + + and then either: + + startAngle - startAngle for the arc. + endAngle - endAngle for the arc. + + or: + + x1 - x for start point + y1 - y for start point + x2 - x for end point + y2 - y for end point + + */ + Arc: function (params) { + var _super = _jp.Segments.AbstractSegment.apply(this, arguments), + _calcAngle = function (_x, _y) { + return _jg.theta([params.cx, params.cy], [_x, _y]); + }, + _calcAngleForLocation = function (segment, location) { + if (segment.anticlockwise) { + var sa = segment.startAngle < segment.endAngle ? segment.startAngle + TWO_PI : segment.startAngle, + s = Math.abs(sa - segment.endAngle); + return sa - (s * location); + } + else { + var ea = segment.endAngle < segment.startAngle ? segment.endAngle + TWO_PI : segment.endAngle, + ss = Math.abs(ea - segment.startAngle); + + return segment.startAngle + (ss * location); + } + }, + TWO_PI = 2 * Math.PI; + + this.radius = params.r; + this.anticlockwise = params.ac; + this.type = "Arc"; + + if (params.startAngle && params.endAngle) { + this.startAngle = params.startAngle; + this.endAngle = params.endAngle; + this.x1 = params.cx + (this.radius * Math.cos(params.startAngle)); + this.y1 = params.cy + (this.radius * Math.sin(params.startAngle)); + this.x2 = params.cx + (this.radius * Math.cos(params.endAngle)); + this.y2 = params.cy + (this.radius * Math.sin(params.endAngle)); + } + else { + this.startAngle = _calcAngle(params.x1, params.y1); + this.endAngle = _calcAngle(params.x2, params.y2); + this.x1 = params.x1; + this.y1 = params.y1; + this.x2 = params.x2; + this.y2 = params.y2; + } + + if (this.endAngle < 0) { + this.endAngle += TWO_PI; + } + if (this.startAngle < 0) { + this.startAngle += TWO_PI; + } + + // segment is used by vml + //this.segment = _jg.quadrant([this.x1, this.y1], [this.x2, this.y2]); + + // we now have startAngle and endAngle as positive numbers, meaning the + // absolute difference (|d|) between them is the sweep (s) of this arc, unless the + // arc is 'anticlockwise' in which case 's' is given by 2PI - |d|. + + var ea = this.endAngle < this.startAngle ? this.endAngle + TWO_PI : this.endAngle; + this.sweep = Math.abs(ea - this.startAngle); + if (this.anticlockwise) { + this.sweep = TWO_PI - this.sweep; + } + var circumference = 2 * Math.PI * this.radius, + frac = this.sweep / TWO_PI, + length = circumference * frac; + + this.getLength = function () { + return length; + }; + + this.getBounds = function () { + return { + minX: params.cx - params.r, + maxX: params.cx + params.r, + minY: params.cy - params.r, + maxY: params.cy + params.r + }; + }; + + var VERY_SMALL_VALUE = 0.0000000001, + gentleRound = function (n) { + var f = Math.floor(n), r = Math.ceil(n); + if (n - f < VERY_SMALL_VALUE) { + return f; + } + else if (r - n < VERY_SMALL_VALUE) { + return r; + } + return n; + }; + + /** + * returns the point on the segment's path that is 'location' along the length of the path, where 'location' is a decimal from + * 0 to 1 inclusive. + */ + this.pointOnPath = function (location, absolute) { + + if (location === 0) { + return { x: this.x1, y: this.y1, theta: this.startAngle }; + } + else if (location === 1) { + return { x: this.x2, y: this.y2, theta: this.endAngle }; + } + + if (absolute) { + location = location / length; + } + + var angle = _calcAngleForLocation(this, location), + _x = params.cx + (params.r * Math.cos(angle)), + _y = params.cy + (params.r * Math.sin(angle)); + + return { x: gentleRound(_x), y: gentleRound(_y), theta: angle }; + }; + + /** + * returns the gradient of the segment at the given point. + */ + this.gradientAtPoint = function (location, absolute) { + var p = this.pointOnPath(location, absolute); + var m = _jg.normal([ params.cx, params.cy ], [p.x, p.y ]); + if (!this.anticlockwise && (m === Infinity || m === -Infinity)) { + m *= -1; + } + return m; + }; + + this.pointAlongPathFrom = function (location, distance, absolute) { + var p = this.pointOnPath(location, absolute), + arcSpan = distance / circumference * 2 * Math.PI, + dir = this.anticlockwise ? -1 : 1, + startAngle = p.theta + (dir * arcSpan), + startX = params.cx + (this.radius * Math.cos(startAngle)), + startY = params.cy + (this.radius * Math.sin(startAngle)); + + return {x: startX, y: startY}; + }; + + // TODO: lineIntersection + }, + + Bezier: function (params) { + this.curve = [ + { x: params.x1, y: params.y1}, + { x: params.cp1x, y: params.cp1y }, + { x: params.cp2x, y: params.cp2y }, + { x: params.x2, y: params.y2 } + ]; + + var _super = _jp.Segments.AbstractSegment.apply(this, arguments); + // although this is not a strictly rigorous determination of bounds + // of a bezier curve, it works for the types of curves that this segment + // type produces. + this.bounds = { + minX: Math.min(params.x1, params.x2, params.cp1x, params.cp2x), + minY: Math.min(params.y1, params.y2, params.cp1y, params.cp2y), + maxX: Math.max(params.x1, params.x2, params.cp1x, params.cp2x), + maxY: Math.max(params.y1, params.y2, params.cp1y, params.cp2y) + }; + + this.type = "Bezier"; + + var _translateLocation = function (_curve, location, absolute) { + if (absolute) { + location = root.jsBezier.locationAlongCurveFrom(_curve, location > 0 ? 0 : 1, location); + } + + return location; + }; + + /** + * returns the point on the segment's path that is 'location' along the length of the path, where 'location' is a decimal from + * 0 to 1 inclusive. + */ + this.pointOnPath = function (location, absolute) { + location = _translateLocation(this.curve, location, absolute); + return root.jsBezier.pointOnCurve(this.curve, location); + }; + + /** + * returns the gradient of the segment at the given point. + */ + this.gradientAtPoint = function (location, absolute) { + location = _translateLocation(this.curve, location, absolute); + return root.jsBezier.gradientAtPoint(this.curve, location); + }; + + this.pointAlongPathFrom = function (location, distance, absolute) { + location = _translateLocation(this.curve, location, absolute); + return root.jsBezier.pointAlongCurveFrom(this.curve, location, distance); + }; + + this.getLength = function () { + return root.jsBezier.getLength(this.curve); + }; + + this.getBounds = function () { + return this.bounds; + }; + + this.findClosestPointOnPath = function (x, y) { + var p = root.jsBezier.nearestPointOnCurve({x:x,y:y}, this.curve); + return { + d:Math.sqrt(Math.pow(p.point.x - x, 2) + Math.pow(p.point.y - y, 2)), + x:p.point.x, + y:p.point.y, + l:p.location, + s:this + }; + }; + + this.lineIntersection = function(x1, y1, x2, y2) { + return root.jsBezier.lineIntersection(x1, y1, x2, y2, this.curve); + }; + } + }; + + _jp.SegmentRenderer = { + getPath: function (segment, isFirstSegment) { + return ({ + "Straight": function (isFirstSegment) { + var d = segment.getCoordinates(); + return (isFirstSegment ? "M " + d.x1 + " " + d.y1 + " " : "") + "L " + d.x2 + " " + d.y2; + }, + "Bezier": function (isFirstSegment) { + var d = segment.params; + return (isFirstSegment ? "M " + d.x2 + " " + d.y2 + " " : "") + + "C " + d.cp2x + " " + d.cp2y + " " + d.cp1x + " " + d.cp1y + " " + d.x1 + " " + d.y1; + }, + "Arc": function (isFirstSegment) { + var d = segment.params, + laf = segment.sweep > Math.PI ? 1 : 0, + sf = segment.anticlockwise ? 0 : 1; + + return (isFirstSegment ? "M" + segment.x1 + " " + segment.y1 + " " : "") + "A " + segment.radius + " " + d.r + " 0 " + laf + "," + sf + " " + segment.x2 + " " + segment.y2; + } + })[segment.type](isFirstSegment); + } + }; + + /* + Class: UIComponent + Superclass for Connector and AbstractEndpoint. + */ + var AbstractComponent = function () { + this.resetBounds = function () { + this.bounds = { minX: Infinity, minY: Infinity, maxX: -Infinity, maxY: -Infinity }; + }; + this.resetBounds(); + }; + + /* + * Class: Connector + * Superclass for all Connectors; here is where Segments are managed. This is exposed on jsPlumb just so it + * can be accessed from other files. You should not try to instantiate one of these directly. + * + * When this class is asked for a pointOnPath, or gradient etc, it must first figure out which segment to dispatch + * that request to. This is done by keeping track of the total connector length as segments are added, and also + * their cumulative ratios to the total length. Then when the right segment is found it is a simple case of dispatching + * the request to it (and adjusting 'location' so that it is relative to the beginning of that segment.) + */ + _jp.Connectors.AbstractConnector = function (params) { + + AbstractComponent.apply(this, arguments); + + var segments = [], + totalLength = 0, + segmentProportions = [], + segmentProportionalLengths = [], + stub = params.stub || 0, + sourceStub = _ju.isArray(stub) ? stub[0] : stub, + targetStub = _ju.isArray(stub) ? stub[1] : stub, + gap = params.gap || 0, + sourceGap = _ju.isArray(gap) ? gap[0] : gap, + targetGap = _ju.isArray(gap) ? gap[1] : gap, + userProvidedSegments = null, + paintInfo = null; + + this.getPathData = function() { + var p = ""; + for (var i = 0; i < segments.length; i++) { + p += _jp.SegmentRenderer.getPath(segments[i], i === 0); + p += " "; + } + return p; + }; + + /** + * Function: findSegmentForPoint + * Returns the segment that is closest to the given [x,y], + * null if nothing found. This function returns a JS + * object with: + * + * d - distance from segment + * l - proportional location in segment + * x - x point on the segment + * y - y point on the segment + * s - the segment itself. + */ + this.findSegmentForPoint = function (x, y) { + var out = { d: Infinity, s: null, x: null, y: null, l: null }; + for (var i = 0; i < segments.length; i++) { + var _s = segments[i].findClosestPointOnPath(x, y); + if (_s.d < out.d) { + out.d = _s.d; + out.l = _s.l; + out.x = _s.x; + out.y = _s.y; + out.s = segments[i]; + out.x1 = _s.x1; + out.x2 = _s.x2; + out.y1 = _s.y1; + out.y2 = _s.y2; + out.index = i; + } + } + + return out; + }; + + this.lineIntersection = function(x1, y1, x2, y2) { + var out = []; + for (var i = 0; i < segments.length; i++) { + out.push.apply(out, segments[i].lineIntersection(x1, y1, x2, y2)); + } + return out; + }; + + this.boxIntersection = function(x, y, w, h) { + var out = []; + for (var i = 0; i < segments.length; i++) { + out.push.apply(out, segments[i].boxIntersection(x, y, w, h)); + } + return out; + }; + + this.boundingBoxIntersection = function(box) { + var out = []; + for (var i = 0; i < segments.length; i++) { + out.push.apply(out, segments[i].boundingBoxIntersection(box)); + } + return out; + }; + + var _updateSegmentProportions = function () { + var curLoc = 0; + for (var i = 0; i < segments.length; i++) { + var sl = segments[i].getLength(); + segmentProportionalLengths[i] = sl / totalLength; + segmentProportions[i] = [curLoc, (curLoc += (sl / totalLength)) ]; + } + }, + + /** + * returns [segment, proportion of travel in segment, segment index] for the segment + * that contains the point which is 'location' distance along the entire path, where + * 'location' is a decimal between 0 and 1 inclusive. in this connector type, paths + * are made up of a list of segments, each of which contributes some fraction to + * the total length. + * From 1.3.10 this also supports the 'absolute' property, which lets us specify a location + * as the absolute distance in pixels, rather than a proportion of the total path. + */ + _findSegmentForLocation = function (location, absolute) { + if (absolute) { + location = location > 0 ? location / totalLength : (totalLength + location) / totalLength; + } + var idx = segmentProportions.length - 1, inSegmentProportion = 1; + for (var i = 0; i < segmentProportions.length; i++) { + if (segmentProportions[i][1] >= location) { + idx = i; + // todo is this correct for all connector path types? + inSegmentProportion = location === 1 ? 1 : location === 0 ? 0 : (location - segmentProportions[i][0]) / segmentProportionalLengths[i]; + break; + } + } + return { segment: segments[idx], proportion: inSegmentProportion, index: idx }; + }, + _addSegment = function (conn, type, params) { + if (params.x1 === params.x2 && params.y1 === params.y2) { + return; + } + var s = new _jp.Segments[type](params); + segments.push(s); + totalLength += s.getLength(); + conn.updateBounds(s); + }, + _clearSegments = function () { + totalLength = segments.length = segmentProportions.length = segmentProportionalLengths.length = 0; + }; + + this.setSegments = function (_segs) { + userProvidedSegments = []; + totalLength = 0; + for (var i = 0; i < _segs.length; i++) { + userProvidedSegments.push(_segs[i]); + totalLength += _segs[i].getLength(); + } + }; + + this.getLength = function() { + return totalLength; + }; + + var _prepareCompute = function (params) { + this.strokeWidth = params.strokeWidth; + var segment = _jg.quadrant(params.sourcePos, params.targetPos), + swapX = params.targetPos[0] < params.sourcePos[0], + swapY = params.targetPos[1] < params.sourcePos[1], + lw = params.strokeWidth || 1, + so = params.sourceEndpoint.anchor.getOrientation(params.sourceEndpoint), + to = params.targetEndpoint.anchor.getOrientation(params.targetEndpoint), + x = swapX ? params.targetPos[0] : params.sourcePos[0], + y = swapY ? params.targetPos[1] : params.sourcePos[1], + w = Math.abs(params.targetPos[0] - params.sourcePos[0]), + h = Math.abs(params.targetPos[1] - params.sourcePos[1]); + + // if either anchor does not have an orientation set, we derive one from their relative + // positions. we fix the axis to be the one in which the two elements are further apart, and + // point each anchor at the other element. this is also used when dragging a new connection. + if (so[0] === 0 && so[1] === 0 || to[0] === 0 && to[1] === 0) { + var index = w > h ? 0 : 1, oIndex = [1, 0][index]; + so = []; + to = []; + so[index] = params.sourcePos[index] > params.targetPos[index] ? -1 : 1; + to[index] = params.sourcePos[index] > params.targetPos[index] ? 1 : -1; + so[oIndex] = 0; + to[oIndex] = 0; + } + + var sx = swapX ? w + (sourceGap * so[0]) : sourceGap * so[0], + sy = swapY ? h + (sourceGap * so[1]) : sourceGap * so[1], + tx = swapX ? targetGap * to[0] : w + (targetGap * to[0]), + ty = swapY ? targetGap * to[1] : h + (targetGap * to[1]), + oProduct = ((so[0] * to[0]) + (so[1] * to[1])); + + var result = { + sx: sx, sy: sy, tx: tx, ty: ty, lw: lw, + xSpan: Math.abs(tx - sx), + ySpan: Math.abs(ty - sy), + mx: (sx + tx) / 2, + my: (sy + ty) / 2, + so: so, to: to, x: x, y: y, w: w, h: h, + segment: segment, + startStubX: sx + (so[0] * sourceStub), + startStubY: sy + (so[1] * sourceStub), + endStubX: tx + (to[0] * targetStub), + endStubY: ty + (to[1] * targetStub), + isXGreaterThanStubTimes2: Math.abs(sx - tx) > (sourceStub + targetStub), + isYGreaterThanStubTimes2: Math.abs(sy - ty) > (sourceStub + targetStub), + opposite: oProduct === -1, + perpendicular: oProduct === 0, + orthogonal: oProduct === 1, + sourceAxis: so[0] === 0 ? "y" : "x", + points: [x, y, w, h, sx, sy, tx, ty ], + stubs:[sourceStub, targetStub] + }; + result.anchorOrientation = result.opposite ? "opposite" : result.orthogonal ? "orthogonal" : "perpendicular"; + return result; + }; + + this.getSegments = function () { + return segments; + }; + + this.updateBounds = function (segment) { + var segBounds = segment.getBounds(); + this.bounds.minX = Math.min(this.bounds.minX, segBounds.minX); + this.bounds.maxX = Math.max(this.bounds.maxX, segBounds.maxX); + this.bounds.minY = Math.min(this.bounds.minY, segBounds.minY); + this.bounds.maxY = Math.max(this.bounds.maxY, segBounds.maxY); + }; + + var dumpSegmentsToConsole = function () { + console.log("SEGMENTS:"); + for (var i = 0; i < segments.length; i++) { + console.log(segments[i].type, segments[i].getLength(), segmentProportions[i]); + } + }; + + this.pointOnPath = function (location, absolute) { + var seg = _findSegmentForLocation(location, absolute); + return seg.segment && seg.segment.pointOnPath(seg.proportion, false) || [0, 0]; + }; + + this.gradientAtPoint = function (location, absolute) { + var seg = _findSegmentForLocation(location, absolute); + return seg.segment && seg.segment.gradientAtPoint(seg.proportion, false) || 0; + }; + + this.pointAlongPathFrom = function (location, distance, absolute) { + var seg = _findSegmentForLocation(location, absolute); + // TODO what happens if this crosses to the next segment? + return seg.segment && seg.segment.pointAlongPathFrom(seg.proportion, distance, false) || [0, 0]; + }; + + this.compute = function (params) { + paintInfo = _prepareCompute.call(this, params); + + _clearSegments(); + this._compute(paintInfo, params); + this.x = paintInfo.points[0]; + this.y = paintInfo.points[1]; + this.w = paintInfo.points[2]; + this.h = paintInfo.points[3]; + this.segment = paintInfo.segment; + _updateSegmentProportions(); + }; + + return { + addSegment: _addSegment, + prepareCompute: _prepareCompute, + sourceStub: sourceStub, + targetStub: targetStub, + maxStub: Math.max(sourceStub, targetStub), + sourceGap: sourceGap, + targetGap: targetGap, + maxGap: Math.max(sourceGap, targetGap) + }; + }; + _ju.extend(_jp.Connectors.AbstractConnector, AbstractComponent); + + + // ********************************* END OF CONNECTOR TYPES ******************************************************************* + + // ********************************* ENDPOINT TYPES ******************************************************************* + + _jp.Endpoints.AbstractEndpoint = function (params) { + AbstractComponent.apply(this, arguments); + var compute = this.compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) { + var out = this._compute.apply(this, arguments); + this.x = out[0]; + this.y = out[1]; + this.w = out[2]; + this.h = out[3]; + this.bounds.minX = this.x; + this.bounds.minY = this.y; + this.bounds.maxX = this.x + this.w; + this.bounds.maxY = this.y + this.h; + return out; + }; + return { + compute: compute, + cssClass: params.cssClass + }; + }; + _ju.extend(_jp.Endpoints.AbstractEndpoint, AbstractComponent); + + /** + * Class: Endpoints.Dot + * A round endpoint, with default radius 10 pixels. + */ + + /** + * Function: Constructor + * + * Parameters: + * + * radius - radius of the endpoint. defaults to 10 pixels. + */ + _jp.Endpoints.Dot = function (params) { + this.type = "Dot"; + var _super = _jp.Endpoints.AbstractEndpoint.apply(this, arguments); + params = params || {}; + this.radius = params.radius || 10; + this.defaultOffset = 0.5 * this.radius; + this.defaultInnerRadius = this.radius / 3; + + this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) { + this.radius = endpointStyle.radius || this.radius; + var x = anchorPoint[0] - this.radius, + y = anchorPoint[1] - this.radius, + w = this.radius * 2, + h = this.radius * 2; + + if (endpointStyle.stroke) { + var lw = endpointStyle.strokeWidth || 1; + x -= lw; + y -= lw; + w += (lw * 2); + h += (lw * 2); + } + return [ x, y, w, h, this.radius ]; + }; + }; + _ju.extend(_jp.Endpoints.Dot, _jp.Endpoints.AbstractEndpoint); + + _jp.Endpoints.Rectangle = function (params) { + this.type = "Rectangle"; + var _super = _jp.Endpoints.AbstractEndpoint.apply(this, arguments); + params = params || {}; + this.width = params.width || 20; + this.height = params.height || 20; + + this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) { + var width = endpointStyle.width || this.width, + height = endpointStyle.height || this.height, + x = anchorPoint[0] - (width / 2), + y = anchorPoint[1] - (height / 2); + + return [ x, y, width, height]; + }; + }; + _ju.extend(_jp.Endpoints.Rectangle, _jp.Endpoints.AbstractEndpoint); + + var DOMElementEndpoint = function (params) { + _jp.jsPlumbUIComponent.apply(this, arguments); + this._jsPlumb.displayElements = []; + }; + _ju.extend(DOMElementEndpoint, _jp.jsPlumbUIComponent, { + getDisplayElements: function () { + return this._jsPlumb.displayElements; + }, + appendDisplayElement: function (el) { + this._jsPlumb.displayElements.push(el); + } + }); + + /** + * Class: Endpoints.Image + * Draws an image as the Endpoint. + */ + /** + * Function: Constructor + * + * Parameters: + * + * src - location of the image to use. + + TODO: multiple references to self. not sure quite how to get rid of them entirely. perhaps self = null in the cleanup + function will suffice + + TODO this class still might leak memory. + + */ + _jp.Endpoints.Image = function (params) { + + this.type = "Image"; + DOMElementEndpoint.apply(this, arguments); + _jp.Endpoints.AbstractEndpoint.apply(this, arguments); + + var _onload = params.onload, + src = params.src || params.url, + clazz = params.cssClass ? " " + params.cssClass : ""; + + this._jsPlumb.img = new Image(); + this._jsPlumb.ready = false; + this._jsPlumb.initialized = false; + this._jsPlumb.deleted = false; + this._jsPlumb.widthToUse = params.width; + this._jsPlumb.heightToUse = params.height; + this._jsPlumb.endpoint = params.endpoint; + + this._jsPlumb.img.onload = function () { + if (this._jsPlumb != null) { + this._jsPlumb.ready = true; + this._jsPlumb.widthToUse = this._jsPlumb.widthToUse || this._jsPlumb.img.width; + this._jsPlumb.heightToUse = this._jsPlumb.heightToUse || this._jsPlumb.img.height; + if (_onload) { + _onload(this); + } + } + }.bind(this); + + /* + Function: setImage + Sets the Image to use in this Endpoint. + + Parameters: + img - may be a URL or an Image object + onload - optional; a callback to execute once the image has loaded. + */ + this._jsPlumb.endpoint.setImage = function (_img, onload) { + var s = _img.constructor === String ? _img : _img.src; + _onload = onload; + this._jsPlumb.img.src = s; + + if (this.canvas != null) { + this.canvas.setAttribute("src", this._jsPlumb.img.src); + } + }.bind(this); + + this._jsPlumb.endpoint.setImage(src, _onload); + this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) { + this.anchorPoint = anchorPoint; + if (this._jsPlumb.ready) { + return [anchorPoint[0] - this._jsPlumb.widthToUse / 2, anchorPoint[1] - this._jsPlumb.heightToUse / 2, + this._jsPlumb.widthToUse, this._jsPlumb.heightToUse]; + } + else { + return [0, 0, 0, 0]; + } + }; + + this.canvas = _jp.createElement("img", { + position:"absolute", + margin:0, + padding:0, + outline:0 + }, this._jsPlumb.instance.endpointClass + clazz); + + if (this._jsPlumb.widthToUse) { + this.canvas.setAttribute("width", this._jsPlumb.widthToUse); + } + if (this._jsPlumb.heightToUse) { + this.canvas.setAttribute("height", this._jsPlumb.heightToUse); + } + this._jsPlumb.instance.appendElement(this.canvas); + + this.actuallyPaint = function (d, style, anchor) { + if (!this._jsPlumb.deleted) { + if (!this._jsPlumb.initialized) { + this.canvas.setAttribute("src", this._jsPlumb.img.src); + this.appendDisplayElement(this.canvas); + this._jsPlumb.initialized = true; + } + var x = this.anchorPoint[0] - (this._jsPlumb.widthToUse / 2), + y = this.anchorPoint[1] - (this._jsPlumb.heightToUse / 2); + _ju.sizeElement(this.canvas, x, y, this._jsPlumb.widthToUse, this._jsPlumb.heightToUse); + } + }; + + this.paint = function (style, anchor) { + if (this._jsPlumb != null) { // may have been deleted + if (this._jsPlumb.ready) { + this.actuallyPaint(style, anchor); + } + else { + root.setTimeout(function () { + this.paint(style, anchor); + }.bind(this), 200); + } + } + }; + }; + _ju.extend(_jp.Endpoints.Image, [ DOMElementEndpoint, _jp.Endpoints.AbstractEndpoint ], { + cleanup: function (force) { + if (force) { + this._jsPlumb.deleted = true; + if (this.canvas) { + this.canvas.parentNode.removeChild(this.canvas); + } + this.canvas = null; + } + } + }); + + /* + * Class: Endpoints.Blank + * An Endpoint that paints nothing (visible) on the screen. Supports cssClass and hoverClass parameters like all Endpoints. + */ + _jp.Endpoints.Blank = function (params) { + var _super = _jp.Endpoints.AbstractEndpoint.apply(this, arguments); + this.type = "Blank"; + DOMElementEndpoint.apply(this, arguments); + this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) { + return [anchorPoint[0], anchorPoint[1], 10, 0]; + }; + + var clazz = params.cssClass ? " " + params.cssClass : ""; + + this.canvas = _jp.createElement("div", { + display: "block", + width: "1px", + height: "1px", + background: "transparent", + position: "absolute" + }, this._jsPlumb.instance.endpointClass + clazz); + + this._jsPlumb.instance.appendElement(this.canvas); + + this.paint = function (style, anchor) { + _ju.sizeElement(this.canvas, this.x, this.y, this.w, this.h); + }; + }; + _ju.extend(_jp.Endpoints.Blank, [_jp.Endpoints.AbstractEndpoint, DOMElementEndpoint], { + cleanup: function () { + if (this.canvas && this.canvas.parentNode) { + this.canvas.parentNode.removeChild(this.canvas); + } + } + }); + + /* + * Class: Endpoints.Triangle + * A triangular Endpoint. + */ + /* + * Function: Constructor + * + * Parameters: + * + * width width of the triangle's base. defaults to 55 pixels. + * height height of the triangle from base to apex. defaults to 55 pixels. + */ + _jp.Endpoints.Triangle = function (params) { + this.type = "Triangle"; + _jp.Endpoints.AbstractEndpoint.apply(this, arguments); + var self = this; + params = params || { }; + params.width = params.width || 55; + params.height = params.height || 55; + this.width = params.width; + this.height = params.height; + this._compute = function (anchorPoint, orientation, endpointStyle, connectorPaintStyle) { + var width = endpointStyle.width || self.width, + height = endpointStyle.height || self.height, + x = anchorPoint[0] - (width / 2), + y = anchorPoint[1] - (height / 2); + return [ x, y, width, height ]; + }; + }; +// ********************************* END OF ENDPOINT TYPES ******************************************************************* + + +// ********************************* OVERLAY DEFINITIONS *********************************************************************** + + var AbstractOverlay = _jp.Overlays.AbstractOverlay = function (params) { + this.visible = true; + this.isAppendedAtTopLevel = true; + this.component = params.component; + this.loc = params.location == null ? 0.5 : params.location; + this.endpointLoc = params.endpointLocation == null ? [ 0.5, 0.5] : params.endpointLocation; + this.visible = params.visible !== false; + }; + AbstractOverlay.prototype = { + cleanup: function (force) { + if (force) { + this.component = null; + this.canvas = null; + this.endpointLoc = null; + } + }, + reattach:function(instance, component) { }, + setVisible: function (val) { + this.visible = val; + this.component.repaint(); + }, + isVisible: function () { + return this.visible; + }, + hide: function () { + this.setVisible(false); + }, + show: function () { + this.setVisible(true); + }, + incrementLocation: function (amount) { + this.loc += amount; + this.component.repaint(); + }, + setLocation: function (l) { + this.loc = l; + this.component.repaint(); + }, + getLocation: function () { + return this.loc; + }, + updateFrom:function() { } + }; + + + /* + * Class: Overlays.Arrow + * + * An arrow overlay, defined by four points: the head, the two sides of the tail, and a 'foldback' point at some distance along the length + * of the arrow that lines from each tail point converge into. The foldback point is defined using a decimal that indicates some fraction + * of the length of the arrow and has a default value of 0.623. A foldback point value of 1 would mean that the arrow had a straight line + * across the tail. + */ + /* + * @constructor + * + * @param {Object} params Constructor params. + * @param {Number} [params.length] Distance in pixels from head to tail baseline. default 20. + * @param {Number} [params.width] Width in pixels of the tail baseline. default 20. + * @param {String} [params.fill] Style to use when filling the arrow. defaults to "black". + * @param {String} [params.stroke] Style to use when stroking the arrow. defaults to null, which means the arrow is not stroked. + * @param {Number} [params.stroke-width] Line width to use when stroking the arrow. defaults to 1, but only used if stroke is not null. + * @param {Number} [params.foldback] Distance (as a decimal from 0 to 1 inclusive) along the length of the arrow marking the point the tail points should fold back to. defaults to 0.623. + * @param {Number} [params.location] Distance (as a decimal from 0 to 1 inclusive) marking where the arrow should sit on the connector. defaults to 0.5. + * @param {NUmber} [params.direction] Indicates the direction the arrow points in. valid values are -1 and 1; 1 is default. + */ + _jp.Overlays.Arrow = function (params) { + this.type = "Arrow"; + AbstractOverlay.apply(this, arguments); + this.isAppendedAtTopLevel = false; + params = params || {}; + var self = this; + + this.length = params.length || 20; + this.width = params.width || 20; + this.id = params.id; + var direction = (params.direction || 1) < 0 ? -1 : 1, + paintStyle = params.paintStyle || { "stroke-width": 1 }, + // how far along the arrow the lines folding back in come to. default is 62.3%. + foldback = params.foldback || 0.623; + + this.computeMaxSize = function () { + return self.width * 1.5; + }; + + this.elementCreated = function(p, component) { + this.path = p; + if (params.events) { + for (var i in params.events) { + _jp.on(p, i, params.events[i]); + } + } + }; + + this.draw = function (component, currentConnectionPaintStyle) { + + var hxy, mid, txy, tail, cxy; + if (component.pointAlongPathFrom) { + + if (_ju.isString(this.loc) || this.loc > 1 || this.loc < 0) { + var l = parseInt(this.loc, 10), + fromLoc = this.loc < 0 ? 1 : 0; + hxy = component.pointAlongPathFrom(fromLoc, l, false); + mid = component.pointAlongPathFrom(fromLoc, l - (direction * this.length / 2), false); + txy = _jg.pointOnLine(hxy, mid, this.length); + } + else if (this.loc === 1) { + hxy = component.pointOnPath(this.loc); + mid = component.pointAlongPathFrom(this.loc, -(this.length)); + txy = _jg.pointOnLine(hxy, mid, this.length); + + if (direction === -1) { + var _ = txy; + txy = hxy; + hxy = _; + } + } + else if (this.loc === 0) { + txy = component.pointOnPath(this.loc); + mid = component.pointAlongPathFrom(this.loc, this.length); + hxy = _jg.pointOnLine(txy, mid, this.length); + if (direction === -1) { + var __ = txy; + txy = hxy; + hxy = __; + } + } + else { + hxy = component.pointAlongPathFrom(this.loc, direction * this.length / 2); + mid = component.pointOnPath(this.loc); + txy = _jg.pointOnLine(hxy, mid, this.length); + } + + tail = _jg.perpendicularLineTo(hxy, txy, this.width); + cxy = _jg.pointOnLine(hxy, txy, foldback * this.length); + + var d = { hxy: hxy, tail: tail, cxy: cxy }, + stroke = paintStyle.stroke || currentConnectionPaintStyle.stroke, + fill = paintStyle.fill || currentConnectionPaintStyle.stroke, + lineWidth = paintStyle.strokeWidth || currentConnectionPaintStyle.strokeWidth; + + return { + component: component, + d: d, + "stroke-width": lineWidth, + stroke: stroke, + fill: fill, + minX: Math.min(hxy.x, tail[0].x, tail[1].x), + maxX: Math.max(hxy.x, tail[0].x, tail[1].x), + minY: Math.min(hxy.y, tail[0].y, tail[1].y), + maxY: Math.max(hxy.y, tail[0].y, tail[1].y) + }; + } + else { + return {component: component, minX: 0, maxX: 0, minY: 0, maxY: 0}; + } + }; + }; + _ju.extend(_jp.Overlays.Arrow, AbstractOverlay, { + updateFrom:function(d) { + this.length = d.length || this.length; + this.width = d.width|| this.width; + this.direction = d.direction != null ? d.direction : this.direction; + this.foldback = d.foldback|| this.foldback; + }, + cleanup:function() { + if (this.path && this.canvas) { + this.canvas.removeChild(this.path); + } + } + }); + + /* + * Class: Overlays.PlainArrow + * + * A basic arrow. This is in fact just one instance of the more generic case in which the tail folds back on itself to some + * point along the length of the arrow: in this case, that foldback point is the full length of the arrow. so it just does + * a 'call' to Arrow with foldback set appropriately. + */ + /* + * Function: Constructor + * See for allowed parameters for this overlay. + */ + _jp.Overlays.PlainArrow = function (params) { + params = params || {}; + var p = _jp.extend(params, {foldback: 1}); + _jp.Overlays.Arrow.call(this, p); + this.type = "PlainArrow"; + }; + _ju.extend(_jp.Overlays.PlainArrow, _jp.Overlays.Arrow); + + /* + * Class: Overlays.Diamond + * + * A diamond. Like PlainArrow, this is a concrete case of the more generic case of the tail points converging on some point...it just + * happens that in this case, that point is greater than the length of the the arrow. + * + * this could probably do with some help with positioning...due to the way it reuses the Arrow paint code, what Arrow thinks is the + * center is actually 1/4 of the way along for this guy. but we don't have any knowledge of pixels at this point, so we're kind of + * stuck when it comes to helping out the Arrow class. possibly we could pass in a 'transpose' parameter or something. the value + * would be -l/4 in this case - move along one quarter of the total length. + */ + /* + * Function: Constructor + * See for allowed parameters for this overlay. + */ + _jp.Overlays.Diamond = function (params) { + params = params || {}; + var l = params.length || 40, + p = _jp.extend(params, {length: l / 2, foldback: 2}); + _jp.Overlays.Arrow.call(this, p); + this.type = "Diamond"; + }; + _ju.extend(_jp.Overlays.Diamond, _jp.Overlays.Arrow); + + var _getDimensions = function (component, forceRefresh) { + if (component._jsPlumb.cachedDimensions == null || forceRefresh) { + component._jsPlumb.cachedDimensions = component.getDimensions(); + } + return component._jsPlumb.cachedDimensions; + }; + + // abstract superclass for overlays that add an element to the DOM. + var AbstractDOMOverlay = function (params) { + _jp.jsPlumbUIComponent.apply(this, arguments); + AbstractOverlay.apply(this, arguments); + + // hand off fired events to associated component. + var _f = this.fire; + this.fire = function () { + _f.apply(this, arguments); + if (this.component) { + this.component.fire.apply(this.component, arguments); + } + }; + + this.detached=false; + this.id = params.id; + this._jsPlumb.div = null; + this._jsPlumb.initialised = false; + this._jsPlumb.component = params.component; + this._jsPlumb.cachedDimensions = null; + this._jsPlumb.create = params.create; + this._jsPlumb.initiallyInvisible = params.visible === false; + + this.getElement = function () { + if (this._jsPlumb.div == null) { + var div = this._jsPlumb.div = _jp.getElement(this._jsPlumb.create(this._jsPlumb.component)); + div.style.position = "absolute"; + jsPlumb.addClass(div, this._jsPlumb.instance.overlayClass + " " + + (this.cssClass ? this.cssClass : + params.cssClass ? params.cssClass : "")); + this._jsPlumb.instance.appendElement(div); + this._jsPlumb.instance.getId(div); + this.canvas = div; + + // in IE the top left corner is what it placed at the desired location. This will not + // be fixed. IE8 is not going to be supported for much longer. + var ts = "translate(-50%, -50%)"; + div.style.webkitTransform = ts; + div.style.mozTransform = ts; + div.style.msTransform = ts; + div.style.oTransform = ts; + div.style.transform = ts; + + // write the related component into the created element + div._jsPlumb = this; + + if (params.visible === false) { + div.style.display = "none"; + } + } + return this._jsPlumb.div; + }; + + this.draw = function (component, currentConnectionPaintStyle, absolutePosition) { + var td = _getDimensions(this); + if (td != null && td.length === 2) { + var cxy = { x: 0, y: 0 }; + + // absolutePosition would have been set by a call to connection.setAbsoluteOverlayPosition. + if (absolutePosition) { + cxy = { x: absolutePosition[0], y: absolutePosition[1] }; + } + else if (component.pointOnPath) { + var loc = this.loc, absolute = false; + if (_ju.isString(this.loc) || this.loc < 0 || this.loc > 1) { + loc = parseInt(this.loc, 10); + absolute = true; + } + cxy = component.pointOnPath(loc, absolute); // a connection + } + else { + var locToUse = this.loc.constructor === Array ? this.loc : this.endpointLoc; + cxy = { x: locToUse[0] * component.w, + y: locToUse[1] * component.h }; + } + + var minx = cxy.x - (td[0] / 2), + miny = cxy.y - (td[1] / 2); + + return { + component: component, + d: { minx: minx, miny: miny, td: td, cxy: cxy }, + minX: minx, + maxX: minx + td[0], + minY: miny, + maxY: miny + td[1] + }; + } + else { + return {minX: 0, maxX: 0, minY: 0, maxY: 0}; + } + }; + }; + _ju.extend(AbstractDOMOverlay, [_jp.jsPlumbUIComponent, AbstractOverlay], { + getDimensions: function () { + return [1,1]; + }, + setVisible: function (state) { + if (this._jsPlumb.div) { + this._jsPlumb.div.style.display = state ? "block" : "none"; + // if initially invisible, dimensions are 0,0 and never get updated + if (state && this._jsPlumb.initiallyInvisible) { + _getDimensions(this, true); + this.component.repaint(); + this._jsPlumb.initiallyInvisible = false; + } + } + }, + /* + * Function: clearCachedDimensions + * Clears the cached dimensions for the label. As a performance enhancement, label dimensions are + * cached from 1.3.12 onwards. The cache is cleared when you change the label text, of course, but + * there are other reasons why the text dimensions might change - if you make a change through CSS, for + * example, you might change the font size. in that case you should explicitly call this method. + */ + clearCachedDimensions: function () { + this._jsPlumb.cachedDimensions = null; + }, + cleanup: function (force) { + if (force) { + if (this._jsPlumb.div != null) { + this._jsPlumb.div._jsPlumb = null; + this._jsPlumb.instance.removeElement(this._jsPlumb.div); + } + } + else { + // if not a forced cleanup, just detach child from parent for now. + if (this._jsPlumb && this._jsPlumb.div && this._jsPlumb.div.parentNode) { + this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div); + } + this.detached = true; + } + + }, + reattach:function(instance, component) { + if (this._jsPlumb.div != null) { + instance.getContainer().appendChild(this._jsPlumb.div); + } + this.detached = false; + }, + computeMaxSize: function () { + var td = _getDimensions(this); + return Math.max(td[0], td[1]); + }, + paint: function (p, containerExtents) { + if (!this._jsPlumb.initialised) { + this.getElement(); + p.component.appendDisplayElement(this._jsPlumb.div); + this._jsPlumb.initialised = true; + if (this.detached) { + this._jsPlumb.div.parentNode.removeChild(this._jsPlumb.div); + } + } + this._jsPlumb.div.style.left = (p.component.x + p.d.minx) + "px"; + this._jsPlumb.div.style.top = (p.component.y + p.d.miny) + "px"; + } + }); + + /* + * Class: Overlays.Custom + * A Custom overlay. You supply a 'create' function which returns some DOM element, and jsPlumb positions it. + * The 'create' function is passed a Connection or Endpoint. + */ + /* + * Function: Constructor + * + * Parameters: + * create - function for jsPlumb to call that returns a DOM element. + * location - distance (as a decimal from 0 to 1 inclusive) marking where the label should sit on the connector. defaults to 0.5. + * id - optional id to use for later retrieval of this overlay. + * + */ + _jp.Overlays.Custom = function (params) { + this.type = "Custom"; + AbstractDOMOverlay.apply(this, arguments); + }; + _ju.extend(_jp.Overlays.Custom, AbstractDOMOverlay); + + _jp.Overlays.GuideLines = function () { + var self = this; + self.length = 50; + self.strokeWidth = 5; + this.type = "GuideLines"; + AbstractOverlay.apply(this, arguments); + _jp.jsPlumbUIComponent.apply(this, arguments); + this.draw = function (connector, currentConnectionPaintStyle) { + + var head = connector.pointAlongPathFrom(self.loc, self.length / 2), + mid = connector.pointOnPath(self.loc), + tail = _jg.pointOnLine(head, mid, self.length), + tailLine = _jg.perpendicularLineTo(head, tail, 40), + headLine = _jg.perpendicularLineTo(tail, head, 20); + + return { + connector: connector, + head: head, + tail: tail, + headLine: headLine, + tailLine: tailLine, + minX: Math.min(head.x, tail.x, headLine[0].x, headLine[1].x), + minY: Math.min(head.y, tail.y, headLine[0].y, headLine[1].y), + maxX: Math.max(head.x, tail.x, headLine[0].x, headLine[1].x), + maxY: Math.max(head.y, tail.y, headLine[0].y, headLine[1].y) + }; + }; + + // this.cleanup = function() { }; // nothing to clean up for GuideLines + }; + + /* + * Class: Overlays.Label + + */ + /* + * Function: Constructor + * + * Parameters: + * cssClass - optional css class string to append to css class. This string is appended "as-is", so you can of course have multiple classes + * defined. This parameter is preferred to using labelStyle, borderWidth and borderStyle. + * label - the label to paint. May be a string or a function that returns a string. Nothing will be painted if your label is null or your + * label function returns null. empty strings _will_ be painted. + * location - distance (as a decimal from 0 to 1 inclusive) marking where the label should sit on the connector. defaults to 0.5. + * id - optional id to use for later retrieval of this overlay. + * + * + */ + _jp.Overlays.Label = function (params) { + this.labelStyle = params.labelStyle; + + var labelWidth = null, labelHeight = null, labelText = null, labelPadding = null; + this.cssClass = this.labelStyle != null ? this.labelStyle.cssClass : null; + var p = _jp.extend({ + create: function () { + return _jp.createElement("div"); + }}, params); + _jp.Overlays.Custom.call(this, p); + this.type = "Label"; + this.label = params.label || ""; + this.labelText = null; + if (this.labelStyle) { + var el = this.getElement(); + this.labelStyle.font = this.labelStyle.font || "12px sans-serif"; + el.style.font = this.labelStyle.font; + el.style.color = this.labelStyle.color || "black"; + if (this.labelStyle.fill) { + el.style.background = this.labelStyle.fill; + } + if (this.labelStyle.borderWidth > 0) { + var dStyle = this.labelStyle.borderStyle ? this.labelStyle.borderStyle : "black"; + el.style.border = this.labelStyle.borderWidth + "px solid " + dStyle; + } + if (this.labelStyle.padding) { + el.style.padding = this.labelStyle.padding; + } + } + + }; + _ju.extend(_jp.Overlays.Label, _jp.Overlays.Custom, { + cleanup: function (force) { + if (force) { + this.div = null; + this.label = null; + this.labelText = null; + this.cssClass = null; + this.labelStyle = null; + } + }, + getLabel: function () { + return this.label; + }, + /* + * Function: setLabel + * sets the label's, um, label. you would think i'd call this function + * 'setText', but you can pass either a Function or a String to this, so + * it makes more sense as 'setLabel'. This uses innerHTML on the label div, so keep + * that in mind if you need escaped HTML. + */ + setLabel: function (l) { + this.label = l; + this.labelText = null; + this.clearCachedDimensions(); + this.update(); + this.component.repaint(); + }, + getDimensions: function () { + this.update(); + return AbstractDOMOverlay.prototype.getDimensions.apply(this, arguments); + }, + update: function () { + if (typeof this.label === "function") { + var lt = this.label(this); + this.getElement().innerHTML = lt.replace(/\r\n/g, "
"); + } + else { + if (this.labelText == null) { + this.labelText = this.label; + this.getElement().innerHTML = this.labelText.replace(/\r\n/g, "
"); + } + } + }, + updateFrom:function(d) { + if(d.label != null){ + this.setLabel(d.label); + } + } + }); + + // ********************************* END OF OVERLAY DEFINITIONS *********************************************************************** + +}).call(typeof window !== 'undefined' ? window : this); + +/* + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +;(function() { + "use strict"; + + var root = this, + _ju = root.jsPlumbUtil, + _jpi = root.jsPlumbInstance; + + var GROUP_COLLAPSED_CLASS = "jtk-group-collapsed"; + var GROUP_EXPANDED_CLASS = "jtk-group-expanded"; + var GROUP_CONTAINER_SELECTOR = "[jtk-group-content]"; + var ELEMENT_DRAGGABLE_EVENT = "elementDraggable"; + var STOP = "stop"; + var REVERT = "revert"; + var GROUP_MANAGER = "_groupManager"; + var GROUP = "_jsPlumbGroup"; + var GROUP_DRAG_SCOPE = "_jsPlumbGroupDrag"; + var EVT_CHILD_ADDED = "group:addMember"; + var EVT_CHILD_REMOVED = "group:removeMember"; + var EVT_GROUP_ADDED = "group:add"; + var EVT_GROUP_REMOVED = "group:remove"; + var EVT_EXPAND = "group:expand"; + var EVT_COLLAPSE = "group:collapse"; + var EVT_GROUP_DRAG_STOP = "groupDragStop"; + var EVT_CONNECTION_MOVED = "connectionMoved"; + var EVT_INTERNAL_CONNECTION_DETACHED = "internal.connectionDetached"; + + var CMD_REMOVE_ALL = "removeAll"; + var CMD_ORPHAN_ALL = "orphanAll"; + var CMD_SHOW = "show"; + var CMD_HIDE = "hide"; + + var GroupManager = function(_jsPlumb) { + var _managedGroups = {}, _connectionSourceMap = {}, _connectionTargetMap = {}, self = this; + + _jsPlumb.bind("connection", function(p) { + if (p.source[GROUP] != null && p.target[GROUP] != null && p.source[GROUP] === p.target[GROUP]) { + _connectionSourceMap[p.connection.id] = p.source[GROUP]; + _connectionTargetMap[p.connection.id] = p.source[GROUP]; + } + else { + if (p.source[GROUP] != null) { + _ju.suggest(p.source[GROUP].connections.source, p.connection); + _connectionSourceMap[p.connection.id] = p.source[GROUP]; + } + if (p.target[GROUP] != null) { + _ju.suggest(p.target[GROUP].connections.target, p.connection); + _connectionTargetMap[p.connection.id] = p.target[GROUP]; + } + } + }); + + function _cleanupDetachedConnection(conn) { + delete conn.proxies; + var group = _connectionSourceMap[conn.id], f; + if (group != null) { + f = function(c) { return c.id === conn.id; }; + _ju.removeWithFunction(group.connections.source, f); + _ju.removeWithFunction(group.connections.target, f); + delete _connectionSourceMap[conn.id]; + } + + group = _connectionTargetMap[conn.id]; + if (group != null) { + f = function(c) { return c.id === conn.id; }; + _ju.removeWithFunction(group.connections.source, f); + _ju.removeWithFunction(group.connections.target, f); + delete _connectionTargetMap[conn.id]; + } + } + + _jsPlumb.bind(EVT_INTERNAL_CONNECTION_DETACHED, function(p) { + _cleanupDetachedConnection(p.connection); + }); + + _jsPlumb.bind(EVT_CONNECTION_MOVED, function(p) { + var connMap = p.index === 0 ? _connectionSourceMap : _connectionTargetMap; + var group = connMap[p.connection.id]; + if (group) { + var list = group.connections[p.index === 0 ? "source" : "target"]; + var idx = list.indexOf(p.connection); + if (idx !== -1) { + list.splice(idx, 1); + } + } + }); + + this.addGroup = function(group) { + _jsPlumb.addClass(group.getEl(), GROUP_EXPANDED_CLASS); + _managedGroups[group.id] = group; + group.manager = this; + _updateConnectionsForGroup(group); + _jsPlumb.fire(EVT_GROUP_ADDED, { group:group }); + }; + + this.addToGroup = function(group, el, doNotFireEvent) { + group = this.getGroup(group); + if (group) { + var groupEl = group.getEl(); + + if (el._isJsPlumbGroup) { + return; + } + var currentGroup = el._jsPlumbGroup; + // if already a member of this group, do nothing + if (currentGroup !== group) { + var elpos = _jsPlumb.getOffset(el, true); + var cpos = group.collapsed ? _jsPlumb.getOffset(groupEl, true) : _jsPlumb.getOffset(group.getDragArea(), true); + + // otherwise, transfer to this group. + if (currentGroup != null) { + currentGroup.remove(el, false, doNotFireEvent, false, group); + self.updateConnectionsForGroup(currentGroup); + } + group.add(el, doNotFireEvent/*, currentGroup*/); + + var handleDroppedConnections = function (list, index) { + var oidx = index === 0 ? 1 : 0; + list.each(function (c) { + c.setVisible(false); + if (c.endpoints[oidx].element._jsPlumbGroup === group) { + c.endpoints[oidx].setVisible(false); + self.expandConnection(c, oidx, group); + } + else { + c.endpoints[index].setVisible(false); + self.collapseConnection(c, index, group); + } + }); + }; + + if (group.collapsed) { + handleDroppedConnections(_jsPlumb.select({source: el}), 0); + handleDroppedConnections(_jsPlumb.select({target: el}), 1); + } + + var elId = _jsPlumb.getId(el); + _jsPlumb.dragManager.setParent(el, elId, groupEl, _jsPlumb.getId(groupEl), elpos); + + var newPosition = { left: elpos.left - cpos.left, top: elpos.top - cpos.top }; + + _jsPlumb.setPosition(el, newPosition); + + _jsPlumb.dragManager.revalidateParent(el, elId, elpos); + + self.updateConnectionsForGroup(group); + + _jsPlumb.revalidate(elId); + + if (!doNotFireEvent) { + var p = {group: group, el: el, pos:newPosition}; + if (currentGroup) { + p.sourceGroup = currentGroup; + } + _jsPlumb.fire(EVT_CHILD_ADDED, p); + } + } + } + }; + + this.removeFromGroup = function(group, el, doNotFireEvent) { + group = this.getGroup(group); + if (group) { + group.remove(el, null, doNotFireEvent); + } + }; + + this.getGroup = function(groupId) { + var group = groupId; + if (_ju.isString(groupId)) { + group = _managedGroups[groupId]; + if (group == null) { + throw new TypeError("No such group [" + groupId + "]"); + } + } + return group; + }; + + this.getGroups = function() { + var o = []; + for (var g in _managedGroups) { + o.push(_managedGroups[g]); + } + return o; + }; + + this.removeGroup = function(group, deleteMembers, manipulateDOM, doNotFireEvent) { + group = this.getGroup(group); + this.expandGroup(group, true); // this reinstates any original connections and removes all proxies, but does not fire an event. + var newPositions = group[deleteMembers ? CMD_REMOVE_ALL : CMD_ORPHAN_ALL](manipulateDOM, doNotFireEvent); + _jsPlumb.remove(group.getEl()); + delete _managedGroups[group.id]; + delete _jsPlumb._groups[group.id]; + _jsPlumb.fire(EVT_GROUP_REMOVED, { group:group }); + return newPositions; // this will be null in the case or remove, but be a map of {id->[x,y]} in the case of orphan + }; + + this.removeAllGroups = function(deleteMembers, manipulateDOM, doNotFireEvent) { + for (var g in _managedGroups) { + this.removeGroup(_managedGroups[g], deleteMembers, manipulateDOM, doNotFireEvent); + } + }; + + function _setVisible(group, state) { + var m = group.getMembers(); + for (var i = 0; i < m.length; i++) { + _jsPlumb[state ? CMD_SHOW : CMD_HIDE](m[i], true); + } + } + + var _collapseConnection = this.collapseConnection = function(c, index, group) { + + var proxyEp, groupEl = group.getEl(), groupElId = _jsPlumb.getId(groupEl), + originalElementId = c.endpoints[index].elementId; + + var otherEl = c.endpoints[index === 0 ? 1 : 0].element; + if (otherEl[GROUP] && (!otherEl[GROUP].shouldProxy() && otherEl[GROUP].collapsed)) { + return; + } + + c.proxies = c.proxies || []; + if(c.proxies[index]) { + proxyEp = c.proxies[index].ep; + }else { + proxyEp = _jsPlumb.addEndpoint(groupEl, { + endpoint:group.getEndpoint(c, index), + anchor:group.getAnchor(c, index), + parameters:{ + isProxyEndpoint:true + } + }); + } + proxyEp.setDeleteOnEmpty(true); + + // for this index, stash proxy info: the new EP, the original EP. + c.proxies[index] = { ep:proxyEp, originalEp: c.endpoints[index] }; + + // and advise the anchor manager + if (index === 0) { + // TODO why are there two differently named methods? Why is there not one method that says "some end of this + // connection changed (you give the index), and here's the new element and element id." + _jsPlumb.anchorManager.sourceChanged(originalElementId, groupElId, c, groupEl); + } + else { + _jsPlumb.anchorManager.updateOtherEndpoint(c.endpoints[0].elementId, originalElementId, groupElId, c); + c.target = groupEl; + c.targetId = groupElId; + } + + + // detach the original EP from the connection. + c.proxies[index].originalEp.detachFromConnection(c, null, true); + + // set the proxy as the new ep + proxyEp.connections = [ c ]; + c.endpoints[index] = proxyEp; + + c.setVisible(true); + }; + + this.collapseGroup = function(group) { + group = this.getGroup(group); + if (group == null || group.collapsed) { + return; + } + var groupEl = group.getEl(); + + // todo remove old proxy endpoints first, just in case? + //group.proxies.length = 0; + + // hide all connections + _setVisible(group, false); + + if (group.shouldProxy()) { + // collapses all connections in a group. + var _collapseSet = function (conns, index) { + for (var i = 0; i < conns.length; i++) { + var c = conns[i]; + _collapseConnection(c, index, group); + } + }; + + // setup proxies for sources and targets + _collapseSet(group.connections.source, 0); + _collapseSet(group.connections.target, 1); + } + + group.collapsed = true; + _jsPlumb.removeClass(groupEl, GROUP_EXPANDED_CLASS); + _jsPlumb.addClass(groupEl, GROUP_COLLAPSED_CLASS); + _jsPlumb.revalidate(groupEl); + _jsPlumb.fire(EVT_COLLAPSE, { group:group }); + }; + + var _expandConnection = this.expandConnection = function(c, index, group) { + + // if no proxies or none for this end of the connection, abort. + if (c.proxies == null || c.proxies[index] == null) { + return; + } + + var groupElId = _jsPlumb.getId(group.getEl()), + originalElement = c.proxies[index].originalEp.element, + originalElementId = c.proxies[index].originalEp.elementId; + + c.endpoints[index] = c.proxies[index].originalEp; + // and advise the anchor manager + if (index === 0) { + // TODO why are there two differently named methods? Why is there not one method that says "some end of this + // connection changed (you give the index), and here's the new element and element id." + _jsPlumb.anchorManager.sourceChanged(groupElId, originalElementId, c, originalElement); + } + else { + _jsPlumb.anchorManager.updateOtherEndpoint(c.endpoints[0].elementId, groupElId, originalElementId, c); + c.target = originalElement; + c.targetId = originalElementId; + } + + // detach the proxy EP from the connection (which will cause it to be removed as we no longer need it) + c.proxies[index].ep.detachFromConnection(c, null); + + c.proxies[index].originalEp.addConnection(c); + + // cleanup + delete c.proxies[index]; + }; + + this.expandGroup = function(group, doNotFireEvent) { + + group = this.getGroup(group); + + if (group == null || !group.collapsed) { + return; + } + var groupEl = group.getEl(); + + _setVisible(group, true); + + if (group.shouldProxy()) { + // collapses all connections in a group. + var _expandSet = function (conns, index) { + for (var i = 0; i < conns.length; i++) { + var c = conns[i]; + _expandConnection(c, index, group); + } + }; + + // setup proxies for sources and targets + _expandSet(group.connections.source, 0); + _expandSet(group.connections.target, 1); + } + + group.collapsed = false; + _jsPlumb.addClass(groupEl, GROUP_EXPANDED_CLASS); + _jsPlumb.removeClass(groupEl, GROUP_COLLAPSED_CLASS); + _jsPlumb.revalidate(groupEl); + this.repaintGroup(group); + if (!doNotFireEvent) { + _jsPlumb.fire(EVT_EXPAND, { group: group}); + } + }; + + this.repaintGroup = function(group) { + group = this.getGroup(group); + var m = group.getMembers(); + for (var i = 0; i < m.length; i++) { + _jsPlumb.revalidate(m[i]); + } + }; + + // TODO refactor this with the code that responds to `connection` events. + function _updateConnectionsForGroup(group) { + var members = group.getMembers(); + var c1 = _jsPlumb.getConnections({source:members, scope:"*"}, true); + var c2 = _jsPlumb.getConnections({target:members, scope:"*"}, true); + var processed = {}; + group.connections.source.length = 0; + group.connections.target.length = 0; + var oneSet = function(c) { + for (var i = 0; i < c.length; i++) { + if (processed[c[i].id]) { + continue; + } + processed[c[i].id] = true; + if (c[i].source._jsPlumbGroup === group) { + if (c[i].target._jsPlumbGroup !== group) { + group.connections.source.push(c[i]); + } + _connectionSourceMap[c[i].id] = group; + } + else if (c[i].target._jsPlumbGroup === group) { + group.connections.target.push(c[i]); + _connectionTargetMap[c[i].id] = group; + } + } + }; + oneSet(c1); oneSet(c2); + } + + this.updateConnectionsForGroup = _updateConnectionsForGroup; + this.refreshAllGroups = function() { + for (var g in _managedGroups) { + _updateConnectionsForGroup(_managedGroups[g]); + _jsPlumb.dragManager.updateOffsets(_jsPlumb.getId(_managedGroups[g].getEl())); + } + }; + }; + + /** + * + * @param {jsPlumbInstance} _jsPlumb Associated jsPlumb instance. + * @param {Object} params + * @param {Element} params.el The DOM element representing the Group. + * @param {String} [params.id] Optional ID for the Group. A UUID will be assigned as the Group's ID if you do not provide one. + * @param {Boolean} [params.constrain=false] If true, child elements will not be able to be dragged outside of the Group container. + * @param {Boolean} [params.revert=true] By default, child elements revert to the container if dragged outside. You can change this by setting `revert:false`. This behaviour is also overridden if you set `orphan` or `prune`. + * @param {Boolean} [params.orphan=false] If true, child elements dropped outside of the Group container will be removed from the Group (but not from the DOM). + * @param {Boolean} [params.prune=false] If true, child elements dropped outside of the Group container will be removed from the Group and also from the DOM. + * @param {Boolean} [params.dropOverride=false] If true, a child element that has been dropped onto some other Group will not be subject to the controls imposed by `prune`, `revert` or `orphan`. + * @constructor + */ + var Group = function(_jsPlumb, params) { + var self = this; + var el = params.el; + this.getEl = function() { return el; }; + this.id = params.id || _ju.uuid(); + el._isJsPlumbGroup = true; + + var getDragArea = this.getDragArea = function() { + var da = _jsPlumb.getSelector(el, GROUP_CONTAINER_SELECTOR); + return da && da.length > 0 ? da[0] : el; + }; + + var ghost = params.ghost === true; + var constrain = ghost || (params.constrain === true); + var revert = params.revert !== false; + var orphan = params.orphan === true; + var prune = params.prune === true; + var dropOverride = params.dropOverride === true; + var proxied = params.proxied !== false; + var elements = []; + this.connections = { source:[], target:[], internal:[] }; + + // this function, and getEndpoint below, are stubs for a future setup in which we can choose endpoint + // and anchor based upon the connection and the index (source/target) of the endpoint to be proxied. + this.getAnchor = function(conn, endpointIndex) { + return params.anchor || "Continuous"; + }; + + this.getEndpoint = function(conn, endpointIndex) { + return params.endpoint || [ "Dot", { radius:10 }]; + }; + + this.collapsed = false; + if (params.draggable !== false) { + var opts = { + stop:function(params) { + _jsPlumb.fire(EVT_GROUP_DRAG_STOP, jsPlumb.extend(params, {group:self})); + }, + scope:GROUP_DRAG_SCOPE + }; + if (params.dragOptions) { + root.jsPlumb.extend(opts, params.dragOptions); + } + _jsPlumb.draggable(params.el, opts); + } + if (params.droppable !== false) { + _jsPlumb.droppable(params.el, { + drop:function(p) { + var el = p.drag.el; + if (el._isJsPlumbGroup) { + return; + } + var currentGroup = el._jsPlumbGroup; + if (currentGroup !== self) { + if (currentGroup != null) { + if (currentGroup.overrideDrop(el, self)) { + return; + } + } + _jsPlumb.getGroupManager().addToGroup(self, el, false); + } + + } + }); + } + var _each = function(_el, fn) { + var els = _el.nodeType == null ? _el : [ _el ]; + for (var i = 0; i < els.length; i++) { + fn(els[i]); + } + }; + + this.overrideDrop = function(_el, targetGroup) { + return dropOverride && (revert || prune || orphan); + }; + + this.add = function(_el, doNotFireEvent/*, sourceGroup*/) { + var dragArea = getDragArea(); + _each(_el, function(__el) { + + if (__el._jsPlumbGroup != null) { + if (__el._jsPlumbGroup === self) { + return; + } else { + __el._jsPlumbGroup.remove(__el, true, doNotFireEvent, false); + } + } + + __el._jsPlumbGroup = self; + elements.push(__el); + // test if draggable and add handlers if so. + if (_jsPlumb.isAlreadyDraggable(__el)) { + _bindDragHandlers(__el); + } + + if (__el.parentNode !== dragArea) { + dragArea.appendChild(__el); + } + + // if (!doNotFireEvent) { + // var p = {group: self, el: __el}; + // if (sourceGroup) { + // p.sourceGroup = sourceGroup; + // } + // //_jsPlumb.fire(EVT_CHILD_ADDED, p); + // } + }); + + _jsPlumb.getGroupManager().updateConnectionsForGroup(self); + }; + + this.remove = function(el, manipulateDOM, doNotFireEvent, doNotUpdateConnections, targetGroup) { + + _each(el, function(__el) { + delete __el._jsPlumbGroup; + _ju.removeWithFunction(elements, function(e) { + return e === __el; + }); + + if (manipulateDOM) { + try { self.getDragArea().removeChild(__el); } + catch (e) { + jsPlumbUtil.log("Could not remove element from Group " + e); + } + } + _unbindDragHandlers(__el); + if (!doNotFireEvent) { + var p = {group: self, el: __el}; + if (targetGroup) { + p.targetGroup = targetGroup; + } + _jsPlumb.fire(EVT_CHILD_REMOVED, p); + } + }); + if (!doNotUpdateConnections) { + _jsPlumb.getGroupManager().updateConnectionsForGroup(self); + } + }; + this.removeAll = function(manipulateDOM, doNotFireEvent) { + for (var i = 0, l = elements.length; i < l; i++) { + var el = elements[0]; + self.remove(el, manipulateDOM, doNotFireEvent, true); + _jsPlumb.remove(el, true); + } + elements.length = 0; + _jsPlumb.getGroupManager().updateConnectionsForGroup(self); + }; + this.orphanAll = function() { + var orphanedPositions = {}; + for (var i = 0; i < elements.length; i++) { + var newPosition = _orphan(elements[i]); + orphanedPositions[newPosition[0]] = newPosition[1]; + } + elements.length = 0; + + return orphanedPositions; + }; + this.getMembers = function() { return elements; }; + + el[GROUP] = this; + + _jsPlumb.bind(ELEMENT_DRAGGABLE_EVENT, function(dragParams) { + // if its for the current group, + if (dragParams.el._jsPlumbGroup === this) { + _bindDragHandlers(dragParams.el); + } + }.bind(this)); + + function _findParent(_el) { + return _el.offsetParent; + } + + function _isInsideParent(_el, pos) { + var p = _findParent(_el), + s = _jsPlumb.getSize(p), + ss = _jsPlumb.getSize(_el), + leftEdge = pos[0], + rightEdge = leftEdge + ss[0], + topEdge = pos[1], + bottomEdge = topEdge + ss[1]; + + return rightEdge > 0 && leftEdge < s[0] && bottomEdge > 0 && topEdge < s[1]; + } + + // + // orphaning an element means taking it out of the group and adding it to the main jsplumb container. + // we return the new calculated position from this method and the element's id. + // + function _orphan(_el) { + var id = _jsPlumb.getId(_el); + var pos = _jsPlumb.getOffset(_el); + _el.parentNode.removeChild(_el); + _jsPlumb.getContainer().appendChild(_el); + _jsPlumb.setPosition(_el, pos); + delete _el._jsPlumbGroup; + _unbindDragHandlers(_el); + _jsPlumb.dragManager.clearParent(_el, id); + return [id, pos]; + } + + // + // remove an element from the group, then either prune it from the jsplumb instance, or just orphan it. + // + function _pruneOrOrphan(p) { + var orphanedPosition = null; + if (!_isInsideParent(p.el, p.pos)) { + var group = p.el._jsPlumbGroup; + if (prune) { + _jsPlumb.remove(p.el); + } else { + orphanedPosition = _orphan(p.el); + } + + group.remove(p.el); + } + + return orphanedPosition; + } + + // + // redraws the element + // + function _revalidate(_el) { + var id = _jsPlumb.getId(_el); + _jsPlumb.revalidate(_el); + _jsPlumb.dragManager.revalidateParent(_el, id); + } + + // + // unbind the group specific drag/revert handlers. + // + function _unbindDragHandlers(_el) { + if (!_el._katavorioDrag) { + return; + } + if (prune || orphan) { + _el._katavorioDrag.off(STOP, _pruneOrOrphan); + } + if (!prune && !orphan && revert) { + _el._katavorioDrag.off(REVERT, _revalidate); + _el._katavorioDrag.setRevert(null); + } + } + + function _bindDragHandlers(_el) { + if (!_el._katavorioDrag) { + return; + } + if (prune || orphan) { + _el._katavorioDrag.on(STOP, _pruneOrOrphan); + } + + if (constrain) { + _el._katavorioDrag.setConstrain(true); + } + + if (ghost) { + _el._katavorioDrag.setUseGhostProxy(true); + } + + if (!prune && !orphan && revert) { + _el._katavorioDrag.on(REVERT, _revalidate); + _el._katavorioDrag.setRevert(function(__el, pos) { + return !_isInsideParent(__el, pos); + }); + } + } + + this.shouldProxy = function() { + return proxied; + }; + + _jsPlumb.getGroupManager().addGroup(this); + }; + + /** + * Adds a group to the jsPlumb instance. + * @method addGroup + * @param {Object} params + * @return {Group} The newly created Group. + */ + _jpi.prototype.addGroup = function(params) { + var j = this; + j._groups = j._groups || {}; + if (j._groups[params.id] != null) { + throw new TypeError("cannot create Group [" + params.id + "]; a Group with that ID exists"); + } + if (params.el[GROUP] != null) { + throw new TypeError("cannot create Group [" + params.id + "]; the given element is already a Group"); + } + var group = new Group(j, params); + j._groups[group.id] = group; + if (params.collapsed) { + this.collapseGroup(group); + } + return group; + }; + + /** + * Add an element to a group. + * @method addToGroup + * @param {String} group Group, or ID of the group, to add the element to. + * @param {Element} el Element to add to the group. + */ + _jpi.prototype.addToGroup = function(group, el, doNotFireEvent) { + + var _one = function(_el) { + var id = this.getId(_el); + this.manage(id, _el); + this.getGroupManager().addToGroup(group, _el, doNotFireEvent); + }.bind(this); + + if (Array.isArray(el)) { + for (var i = 0; i < el.length; i++) { + _one(el[i]); + } + } else { + _one(el); + } + }; + + /** + * Remove an element from a group. + * @method removeFromGroup + * @param {String} group Group, or ID of the group, to remove the element from. + * @param {Element} el Element to add to the group. + */ + _jpi.prototype.removeFromGroup = function(group, el, doNotFireEvent) { + this.getGroupManager().removeFromGroup(group, el, doNotFireEvent); + }; + + /** + * Remove a group, and optionally remove its members from the jsPlumb instance. + * @method removeGroup + * @param {String|Group} group Group to delete, or ID of Group to delete. + * @param {Boolean} [deleteMembers=false] If true, group members will be removed along with the group. Otherwise they will + * just be 'orphaned' (returned to the main container). + * @returns {Map[String, Position}} When deleteMembers is false, this method returns a map of {id->position} + */ + _jpi.prototype.removeGroup = function(group, deleteMembers, manipulateDOM, doNotFireEvent) { + return this.getGroupManager().removeGroup(group, deleteMembers, manipulateDOM, doNotFireEvent); + }; + + /** + * Remove all groups, and optionally remove their members from the jsPlumb instance. + * @method removeAllGroup + * @param {Boolean} [deleteMembers=false] If true, group members will be removed along with the groups. Otherwise they will + * just be 'orphaned' (returned to the main container). + */ + _jpi.prototype.removeAllGroups = function(deleteMembers, manipulateDOM, doNotFireEvent) { + this.getGroupManager().removeAllGroups(deleteMembers, manipulateDOM, doNotFireEvent); + }; + + /** + * Get a Group + * @method getGroup + * @param {String} groupId ID of the group to get + * @return {Group} Group with the given ID, null if not found. + */ + _jpi.prototype.getGroup = function(groupId) { + return this.getGroupManager().getGroup(groupId); + }; + + /** + * Gets all the Groups managed by the jsPlumb instance. + * @returns {Group[]} List of Groups. Empty if none. + */ + _jpi.prototype.getGroups = function() { + return this.getGroupManager().getGroups(); + }; + + /** + * Expands a group element. jsPlumb doesn't do "everything" for you here, because what it means to expand a Group + * will vary from application to application. jsPlumb does these things: + * + * - Hides any connections that are internal to the group (connections between members, and connections from member of + * the group to the group itself) + * - Proxies all connections for which the source or target is a member of the group. + * - Hides the proxied connections. + * - Adds the jtk-group-expanded class to the group's element + * - Removes the jtk-group-collapsed class from the group's element. + * + * @method expandGroup + * @param {String|Group} group Group to expand, or ID of Group to expand. + */ + _jpi.prototype.expandGroup = function(group) { + this.getGroupManager().expandGroup(group); + }; + + /** + * Collapses a group element. jsPlumb doesn't do "everything" for you here, because what it means to collapse a Group + * will vary from application to application. jsPlumb does these things: + * + * - Shows any connections that are internal to the group (connections between members, and connections from member of + * the group to the group itself) + * - Removes proxies for all connections for which the source or target is a member of the group. + * - Shows the previously proxied connections. + * - Adds the jtk-group-collapsed class to the group's element + * - Removes the jtk-group-expanded class from the group's element. + * + * @method expandGroup + * @param {String|Group} group Group to expand, or ID of Group to expand. + */ + _jpi.prototype.collapseGroup = function(groupId) { + this.getGroupManager().collapseGroup(groupId); + }; + + + _jpi.prototype.repaintGroup = function(group) { + this.getGroupManager().repaintGroup(group); + }; + + /** + * Collapses or expands a group element depending on its current state. See notes in the collapseGroup and expandGroup method. + * + * @method toggleGroup + * @param {String|Group} group Group to expand/collapse, or ID of Group to expand/collapse. + */ + _jpi.prototype.toggleGroup = function(group) { + group = this.getGroupManager().getGroup(group); + if (group != null) { + this.getGroupManager()[group.collapsed ? "expandGroup" : "collapseGroup"](group); + } + }; + + // + // lazy init a group manager for the given jsplumb instance. + // + _jpi.prototype.getGroupManager = function() { + var mgr = this[GROUP_MANAGER]; + if (mgr == null) { + mgr = this[GROUP_MANAGER] = new GroupManager(this); + } + return mgr; + }; + + _jpi.prototype.removeGroupManager = function() { + delete this[GROUP_MANAGER]; + }; + + /** + * Gets the Group that the given element belongs to, null if none. + * @method getGroupFor + * @param {String|Element} el Element, or element ID. + * @returns {Group} A Group, if found, or null. + */ + _jpi.prototype.getGroupFor = function(el) { + el = this.getElement(el); + if (el) { + return el[GROUP]; + } + }; + +}).call(typeof window !== 'undefined' ? window : this); + + +/* + * This file contains the 'flowchart' connectors, consisting of vertical and horizontal line segments. + * + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +; +(function () { + + "use strict"; + var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil; + var STRAIGHT = "Straight"; + var ARC = "Arc"; + + var Flowchart = function (params) { + this.type = "Flowchart"; + params = params || {}; + params.stub = params.stub == null ? 30 : params.stub; + var segments, + _super = _jp.Connectors.AbstractConnector.apply(this, arguments), + midpoint = params.midpoint == null ? 0.5 : params.midpoint, + alwaysRespectStubs = params.alwaysRespectStubs === true, + lastx = null, lasty = null, lastOrientation, + cornerRadius = params.cornerRadius != null ? params.cornerRadius : 0, + + // TODO now common between this and AbstractBezierEditor; refactor into superclass? + loopbackRadius = params.loopbackRadius || 25, + isLoopbackCurrently = false, + + sgn = function (n) { + return n < 0 ? -1 : n === 0 ? 0 : 1; + }, + segmentDirections = function(segment) { + return [ + sgn( segment[2] - segment[0] ), + sgn( segment[3] - segment[1] ) + ]; + }, + /** + * helper method to add a segment. + */ + addSegment = function (segments, x, y, paintInfo) { + if (lastx === x && lasty === y) { + return; + } + var lx = lastx == null ? paintInfo.sx : lastx, + ly = lasty == null ? paintInfo.sy : lasty, + o = lx === x ? "v" : "h"; + + lastx = x; + lasty = y; + segments.push([ lx, ly, x, y, o ]); + }, + segLength = function (s) { + return Math.sqrt(Math.pow(s[0] - s[2], 2) + Math.pow(s[1] - s[3], 2)); + }, + _cloneArray = function (a) { + var _a = []; + _a.push.apply(_a, a); + return _a; + }, + writeSegments = function (conn, segments, paintInfo) { + var current = null, next, currentDirection, nextDirection; + for (var i = 0; i < segments.length - 1; i++) { + + current = current || _cloneArray(segments[i]); + next = _cloneArray(segments[i + 1]); + + currentDirection = segmentDirections(current); + nextDirection = segmentDirections(next); + + if (cornerRadius > 0 && current[4] !== next[4]) { + + var minSegLength = Math.min(segLength(current), segLength(next)); + var radiusToUse = Math.min(cornerRadius, minSegLength / 2); + + current[2] -= currentDirection[0] * radiusToUse; + current[3] -= currentDirection[1] * radiusToUse; + next[0] += nextDirection[0] * radiusToUse; + next[1] += nextDirection[1] * radiusToUse; + + var ac = (currentDirection[1] === nextDirection[0] && nextDirection[0] === 1) || + ((currentDirection[1] === nextDirection[0] && nextDirection[0] === 0) && currentDirection[0] !== nextDirection[1]) || + (currentDirection[1] === nextDirection[0] && nextDirection[0] === -1), + sgny = next[1] > current[3] ? 1 : -1, + sgnx = next[0] > current[2] ? 1 : -1, + sgnEqual = sgny === sgnx, + cx = (sgnEqual && ac || (!sgnEqual && !ac)) ? next[0] : current[2], + cy = (sgnEqual && ac || (!sgnEqual && !ac)) ? current[3] : next[1]; + + _super.addSegment(conn, STRAIGHT, { + x1: current[0], y1: current[1], x2: current[2], y2: current[3] + }); + + _super.addSegment(conn, ARC, { + r: radiusToUse, + x1: current[2], + y1: current[3], + x2: next[0], + y2: next[1], + cx: cx, + cy: cy, + ac: ac + }); + } + else { + // dx + dy are used to adjust for line width. + var dx = (current[2] === current[0]) ? 0 : (current[2] > current[0]) ? (paintInfo.lw / 2) : -(paintInfo.lw / 2), + dy = (current[3] === current[1]) ? 0 : (current[3] > current[1]) ? (paintInfo.lw / 2) : -(paintInfo.lw / 2); + + _super.addSegment(conn, STRAIGHT, { + x1: current[0] - dx, y1: current[1] - dy, x2: current[2] + dx, y2: current[3] + dy + }); + } + current = next; + } + if (next != null) { + // last segment + _super.addSegment(conn, STRAIGHT, { + x1: next[0], y1: next[1], x2: next[2], y2: next[3] + }); + } + }; + + this._compute = function (paintInfo, params) { + + segments = []; + lastx = null; + lasty = null; + lastOrientation = null; + + var commonStubCalculator = function () { + return [paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY]; + }, + stubCalculators = { + perpendicular: commonStubCalculator, + orthogonal: commonStubCalculator, + opposite: function (axis) { + var pi = paintInfo, + idx = axis === "x" ? 0 : 1, + areInProximity = { + "x": function () { + return ( (pi.so[idx] === 1 && ( + ( (pi.startStubX > pi.endStubX) && (pi.tx > pi.startStubX) ) || + ( (pi.sx > pi.endStubX) && (pi.tx > pi.sx))))) || + + ( (pi.so[idx] === -1 && ( + ( (pi.startStubX < pi.endStubX) && (pi.tx < pi.startStubX) ) || + ( (pi.sx < pi.endStubX) && (pi.tx < pi.sx))))); + }, + "y": function () { + return ( (pi.so[idx] === 1 && ( + ( (pi.startStubY > pi.endStubY) && (pi.ty > pi.startStubY) ) || + ( (pi.sy > pi.endStubY) && (pi.ty > pi.sy))))) || + + ( (pi.so[idx] === -1 && ( + ( (pi.startStubY < pi.endStubY) && (pi.ty < pi.startStubY) ) || + ( (pi.sy < pi.endStubY) && (pi.ty < pi.sy))))); + } + }; + + if (!alwaysRespectStubs && areInProximity[axis]()) { + return { + "x": [(paintInfo.sx + paintInfo.tx) / 2, paintInfo.startStubY, (paintInfo.sx + paintInfo.tx) / 2, paintInfo.endStubY], + "y": [paintInfo.startStubX, (paintInfo.sy + paintInfo.ty) / 2, paintInfo.endStubX, (paintInfo.sy + paintInfo.ty) / 2] + }[axis]; + } + else { + return [paintInfo.startStubX, paintInfo.startStubY, paintInfo.endStubX, paintInfo.endStubY]; + } + } + }; + + // calculate Stubs. + var stubs = stubCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis), + idx = paintInfo.sourceAxis === "x" ? 0 : 1, + oidx = paintInfo.sourceAxis === "x" ? 1 : 0, + ss = stubs[idx], + oss = stubs[oidx], + es = stubs[idx + 2], + oes = stubs[oidx + 2]; + + // add the start stub segment. use stubs for loopback as it will look better, with the loop spaced + // away from the element. + addSegment(segments, stubs[0], stubs[1], paintInfo); + + // if its a loopback and we should treat it differently. + // if (false && params.sourcePos[0] === params.targetPos[0] && params.sourcePos[1] === params.targetPos[1]) { + // + // // we use loopbackRadius here, as statemachine connectors do. + // // so we go radius to the left from stubs[0], then upwards by 2*radius, to the right by 2*radius, + // // down by 2*radius, left by radius. + // addSegment(segments, stubs[0] - loopbackRadius, stubs[1], paintInfo); + // addSegment(segments, stubs[0] - loopbackRadius, stubs[1] - (2 * loopbackRadius), paintInfo); + // addSegment(segments, stubs[0] + loopbackRadius, stubs[1] - (2 * loopbackRadius), paintInfo); + // addSegment(segments, stubs[0] + loopbackRadius, stubs[1], paintInfo); + // addSegment(segments, stubs[0], stubs[1], paintInfo); + // + // } + // else { + + + var midx = paintInfo.startStubX + ((paintInfo.endStubX - paintInfo.startStubX) * midpoint), + midy = paintInfo.startStubY + ((paintInfo.endStubY - paintInfo.startStubY) * midpoint); + + var orientations = {x: [0, 1], y: [1, 0]}, + lineCalculators = { + perpendicular: function (axis) { + var pi = paintInfo, + sis = { + x: [ + [[1, 2, 3, 4], null, [2, 1, 4, 3]], + null, + [[4, 3, 2, 1], null, [3, 4, 1, 2]] + ], + y: [ + [[3, 2, 1, 4], null, [2, 3, 4, 1]], + null, + [[4, 1, 2, 3], null, [1, 4, 3, 2]] + ] + }, + stubs = { + x: [[pi.startStubX, pi.endStubX], null, [pi.endStubX, pi.startStubX]], + y: [[pi.startStubY, pi.endStubY], null, [pi.endStubY, pi.startStubY]] + }, + midLines = { + x: [[midx, pi.startStubY], [midx, pi.endStubY]], + y: [[pi.startStubX, midy], [pi.endStubX, midy]] + }, + linesToEnd = { + x: [[pi.endStubX, pi.startStubY]], + y: [[pi.startStubX, pi.endStubY]] + }, + startToEnd = { + x: [[pi.startStubX, pi.endStubY], [pi.endStubX, pi.endStubY]], + y: [[pi.endStubX, pi.startStubY], [pi.endStubX, pi.endStubY]] + }, + startToMidToEnd = { + x: [[pi.startStubX, midy], [pi.endStubX, midy], [pi.endStubX, pi.endStubY]], + y: [[midx, pi.startStubY], [midx, pi.endStubY], [pi.endStubX, pi.endStubY]] + }, + otherStubs = { + x: [pi.startStubY, pi.endStubY], + y: [pi.startStubX, pi.endStubX] + }, + soIdx = orientations[axis][0], toIdx = orientations[axis][1], + _so = pi.so[soIdx] + 1, + _to = pi.to[toIdx] + 1, + otherFlipped = (pi.to[toIdx] === -1 && (otherStubs[axis][1] < otherStubs[axis][0])) || (pi.to[toIdx] === 1 && (otherStubs[axis][1] > otherStubs[axis][0])), + stub1 = stubs[axis][_so][0], + stub2 = stubs[axis][_so][1], + segmentIndexes = sis[axis][_so][_to]; + + if (pi.segment === segmentIndexes[3] || (pi.segment === segmentIndexes[2] && otherFlipped)) { + return midLines[axis]; + } + else if (pi.segment === segmentIndexes[2] && stub2 < stub1) { + return linesToEnd[axis]; + } + else if ((pi.segment === segmentIndexes[2] && stub2 >= stub1) || (pi.segment === segmentIndexes[1] && !otherFlipped)) { + return startToMidToEnd[axis]; + } + else if (pi.segment === segmentIndexes[0] || (pi.segment === segmentIndexes[1] && otherFlipped)) { + return startToEnd[axis]; + } + }, + orthogonal: function (axis, startStub, otherStartStub, endStub, otherEndStub) { + var pi = paintInfo, + extent = { + "x": pi.so[0] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub), + "y": pi.so[1] === -1 ? Math.min(startStub, endStub) : Math.max(startStub, endStub) + }[axis]; + + return { + "x": [ + [extent, otherStartStub], + [extent, otherEndStub], + [endStub, otherEndStub] + ], + "y": [ + [otherStartStub, extent], + [otherEndStub, extent], + [otherEndStub, endStub] + ] + }[axis]; + }, + opposite: function (axis, ss, oss, es) { + var pi = paintInfo, + otherAxis = {"x": "y", "y": "x"}[axis], + dim = {"x": "height", "y": "width"}[axis], + comparator = pi["is" + axis.toUpperCase() + "GreaterThanStubTimes2"]; + + if (params.sourceEndpoint.elementId === params.targetEndpoint.elementId) { + var _val = oss + ((1 - params.sourceEndpoint.anchor[otherAxis]) * params.sourceInfo[dim]) + _super.maxStub; + return { + "x": [ + [ss, _val], + [es, _val] + ], + "y": [ + [_val, ss], + [_val, es] + ] + }[axis]; + + } + else if (!comparator || (pi.so[idx] === 1 && ss > es) || (pi.so[idx] === -1 && ss < es)) { + return { + "x": [ + [ss, midy], + [es, midy] + ], + "y": [ + [midx, ss], + [midx, es] + ] + }[axis]; + } + else if ((pi.so[idx] === 1 && ss < es) || (pi.so[idx] === -1 && ss > es)) { + return { + "x": [ + [midx, pi.sy], + [midx, pi.ty] + ], + "y": [ + [pi.sx, midy], + [pi.tx, midy] + ] + }[axis]; + } + } + }; + + // compute the rest of the line + var p = lineCalculators[paintInfo.anchorOrientation](paintInfo.sourceAxis, ss, oss, es, oes); + if (p) { + for (var i = 0; i < p.length; i++) { + addSegment(segments, p[i][0], p[i][1], paintInfo); + } + } + + // line to end stub + addSegment(segments, stubs[2], stubs[3], paintInfo); + + //} + + // end stub to end (common) + addSegment(segments, paintInfo.tx, paintInfo.ty, paintInfo); + + + + // write out the segments. + writeSegments(this, segments, paintInfo); + + }; + }; + + _jp.Connectors.Flowchart = Flowchart; + _ju.extend(_jp.Connectors.Flowchart, _jp.Connectors.AbstractConnector); + +}).call(typeof window !== 'undefined' ? window : this); +/* + * This file contains the code for the Bezier connector type. + * + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +; +(function () { + + "use strict"; + var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil; + + _jp.Connectors.AbstractBezierConnector = function(params) { + params = params || {}; + var showLoopback = params.showLoopback !== false, + curviness = params.curviness || 10, + margin = params.margin || 5, + proximityLimit = params.proximityLimit || 80, + clockwise = params.orientation && params.orientation === "clockwise", + loopbackRadius = params.loopbackRadius || 25, + isLoopbackCurrently = false, + _super; + + this._compute = function (paintInfo, p) { + + var sp = p.sourcePos, + tp = p.targetPos, + _w = Math.abs(sp[0] - tp[0]), + _h = Math.abs(sp[1] - tp[1]); + + if (!showLoopback || (p.sourceEndpoint.elementId !== p.targetEndpoint.elementId)) { + isLoopbackCurrently = false; + this._computeBezier(paintInfo, p, sp, tp, _w, _h); + } else { + isLoopbackCurrently = true; + // a loopback connector. draw an arc from one anchor to the other. + var x1 = p.sourcePos[0], y1 = p.sourcePos[1] - margin, + cx = x1, cy = y1 - loopbackRadius, + // canvas sizing stuff, to ensure the whole painted area is visible. + _x = cx - loopbackRadius, + _y = cy - loopbackRadius; + + _w = 2 * loopbackRadius; + _h = 2 * loopbackRadius; + + paintInfo.points[0] = _x; + paintInfo.points[1] = _y; + paintInfo.points[2] = _w; + paintInfo.points[3] = _h; + + // ADD AN ARC SEGMENT. + _super.addSegment(this, "Arc", { + loopback: true, + x1: (x1 - _x) + 4, + y1: y1 - _y, + startAngle: 0, + endAngle: 2 * Math.PI, + r: loopbackRadius, + ac: !clockwise, + x2: (x1 - _x) - 4, + y2: y1 - _y, + cx: cx - _x, + cy: cy - _y + }); + } + }; + + _super = _jp.Connectors.AbstractConnector.apply(this, arguments); + return _super; + }; + _ju.extend(_jp.Connectors.AbstractBezierConnector, _jp.Connectors.AbstractConnector); + + var Bezier = function (params) { + params = params || {}; + this.type = "Bezier"; + + var _super = _jp.Connectors.AbstractBezierConnector.apply(this, arguments), + majorAnchor = params.curviness || 150, + minorAnchor = 10; + + this.getCurviness = function () { + return majorAnchor; + }; + + this._findControlPoint = function (point, sourceAnchorPosition, targetAnchorPosition, sourceEndpoint, targetEndpoint, soo, too) { + // determine if the two anchors are perpendicular to each other in their orientation. we swap the control + // points around if so (code could be tightened up) + var perpendicular = soo[0] !== too[0] || soo[1] === too[1], + p = []; + + if (!perpendicular) { + if (soo[0] === 0) { + p.push(sourceAnchorPosition[0] < targetAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor); + } + else { + p.push(point[0] - (majorAnchor * soo[0])); + } + + if (soo[1] === 0) { + p.push(sourceAnchorPosition[1] < targetAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor); + } + else { + p.push(point[1] + (majorAnchor * too[1])); + } + } + else { + if (too[0] === 0) { + p.push(targetAnchorPosition[0] < sourceAnchorPosition[0] ? point[0] + minorAnchor : point[0] - minorAnchor); + } + else { + p.push(point[0] + (majorAnchor * too[0])); + } + + if (too[1] === 0) { + p.push(targetAnchorPosition[1] < sourceAnchorPosition[1] ? point[1] + minorAnchor : point[1] - minorAnchor); + } + else { + p.push(point[1] + (majorAnchor * soo[1])); + } + } + + return p; + }; + + this._computeBezier = function (paintInfo, p, sp, tp, _w, _h) { + + var _CP, _CP2, + _sx = sp[0] < tp[0] ? _w : 0, + _sy = sp[1] < tp[1] ? _h : 0, + _tx = sp[0] < tp[0] ? 0 : _w, + _ty = sp[1] < tp[1] ? 0 : _h; + + _CP = this._findControlPoint([_sx, _sy], sp, tp, p.sourceEndpoint, p.targetEndpoint, paintInfo.so, paintInfo.to); + _CP2 = this._findControlPoint([_tx, _ty], tp, sp, p.targetEndpoint, p.sourceEndpoint, paintInfo.to, paintInfo.so); + + + _super.addSegment(this, "Bezier", { + x1: _sx, y1: _sy, x2: _tx, y2: _ty, + cp1x: _CP[0], cp1y: _CP[1], cp2x: _CP2[0], cp2y: _CP2[1] + }); + }; + + + }; + + _jp.Connectors.Bezier = Bezier; + _ju.extend(Bezier, _jp.Connectors.AbstractBezierConnector); + +}).call(typeof window !== 'undefined' ? window : this); +/* + * This file contains the state machine connectors, which extend AbstractBezierConnector. + * + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +; +(function () { + + "use strict"; + var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil; + + var _segment = function (x1, y1, x2, y2) { + if (x1 <= x2 && y2 <= y1) { + return 1; + } + else if (x1 <= x2 && y1 <= y2) { + return 2; + } + else if (x2 <= x1 && y2 >= y1) { + return 3; + } + return 4; + }, + + // the control point we will use depends on the faces to which each end of the connection is assigned, specifically whether or not the + // two faces are parallel or perpendicular. if they are parallel then the control point lies on the midpoint of the axis in which they + // are parellel and varies only in the other axis; this variation is proportional to the distance that the anchor points lie from the + // center of that face. if the two faces are perpendicular then the control point is at some distance from both the midpoints; the amount and + // direction are dependent on the orientation of the two elements. 'seg', passed in to this method, tells you which segment the target element + // lies in with respect to the source: 1 is top right, 2 is bottom right, 3 is bottom left, 4 is top left. + // + // sourcePos and targetPos are arrays of info about where on the source and target each anchor is located. their contents are: + // + // 0 - absolute x + // 1 - absolute y + // 2 - proportional x in element (0 is left edge, 1 is right edge) + // 3 - proportional y in element (0 is top edge, 1 is bottom edge) + // + _findControlPoint = function (midx, midy, segment, sourceEdge, targetEdge, dx, dy, distance, proximityLimit) { + // TODO (maybe) + // - if anchor pos is 0.5, make the control point take into account the relative position of the elements. + if (distance <= proximityLimit) { + return [midx, midy]; + } + + if (segment === 1) { + if (sourceEdge[3] <= 0 && targetEdge[3] >= 1) { + return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ]; + } + else if (sourceEdge[2] >= 1 && targetEdge[2] <= 0) { + return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ]; + } + else { + return [ midx + (-1 * dx) , midy + (-1 * dy) ]; + } + } + else if (segment === 2) { + if (sourceEdge[3] >= 1 && targetEdge[3] <= 0) { + return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ]; + } + else if (sourceEdge[2] >= 1 && targetEdge[2] <= 0) { + return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ]; + } + else { + return [ midx + dx, midy + (-1 * dy) ]; + } + } + else if (segment === 3) { + if (sourceEdge[3] >= 1 && targetEdge[3] <= 0) { + return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ]; + } + else if (sourceEdge[2] <= 0 && targetEdge[2] >= 1) { + return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ]; + } + else { + return [ midx + (-1 * dx) , midy + (-1 * dy) ]; + } + } + else if (segment === 4) { + if (sourceEdge[3] <= 0 && targetEdge[3] >= 1) { + return [ midx + (sourceEdge[2] < 0.5 ? -1 * dx : dx), midy ]; + } + else if (sourceEdge[2] <= 0 && targetEdge[2] >= 1) { + return [ midx, midy + (sourceEdge[3] < 0.5 ? -1 * dy : dy) ]; + } + else { + return [ midx + dx , midy + (-1 * dy) ]; + } + } + + }; + + var StateMachine = function (params) { + params = params || {}; + this.type = "StateMachine"; + + var _super = _jp.Connectors.AbstractBezierConnector.apply(this, arguments), + curviness = params.curviness || 10, + margin = params.margin || 5, + proximityLimit = params.proximityLimit || 80, + clockwise = params.orientation && params.orientation === "clockwise", + _controlPoint; + + this._computeBezier = function(paintInfo, params, sp, tp, w, h) { + var _sx = params.sourcePos[0] < params.targetPos[0] ? 0 : w, + _sy = params.sourcePos[1] < params.targetPos[1] ? 0 : h, + _tx = params.sourcePos[0] < params.targetPos[0] ? w : 0, + _ty = params.sourcePos[1] < params.targetPos[1] ? h : 0; + + // now adjust for the margin + if (params.sourcePos[2] === 0) { + _sx -= margin; + } + if (params.sourcePos[2] === 1) { + _sx += margin; + } + if (params.sourcePos[3] === 0) { + _sy -= margin; + } + if (params.sourcePos[3] === 1) { + _sy += margin; + } + if (params.targetPos[2] === 0) { + _tx -= margin; + } + if (params.targetPos[2] === 1) { + _tx += margin; + } + if (params.targetPos[3] === 0) { + _ty -= margin; + } + if (params.targetPos[3] === 1) { + _ty += margin; + } + + // + // these connectors are quadratic bezier curves, having a single control point. if both anchors + // are located at 0.5 on their respective faces, the control point is set to the midpoint and you + // get a straight line. this is also the case if the two anchors are within 'proximityLimit', since + // it seems to make good aesthetic sense to do that. outside of that, the control point is positioned + // at 'curviness' pixels away along the normal to the straight line connecting the two anchors. + // + // there may be two improvements to this. firstly, we might actually support the notion of avoiding nodes + // in the UI, or at least making a good effort at doing so. if a connection would pass underneath some node, + // for example, we might increase the distance the control point is away from the midpoint in a bid to + // steer it around that node. this will work within limits, but i think those limits would also be the likely + // limits for, once again, aesthetic good sense in the layout of a chart using these connectors. + // + // the second possible change is actually two possible changes: firstly, it is possible we should gradually + // decrease the 'curviness' as the distance between the anchors decreases; start tailing it off to 0 at some + // point (which should be configurable). secondly, we might slightly increase the 'curviness' for connectors + // with respect to how far their anchor is from the center of its respective face. this could either look cool, + // or stupid, and may indeed work only in a way that is so subtle as to have been a waste of time. + // + + var _midx = (_sx + _tx) / 2, + _midy = (_sy + _ty) / 2, + segment = _segment(_sx, _sy, _tx, _ty), + distance = Math.sqrt(Math.pow(_tx - _sx, 2) + Math.pow(_ty - _sy, 2)), + cp1x, cp2x, cp1y, cp2y; + + + // calculate the control point. this code will be where we'll put in a rudimentary element avoidance scheme; it + // will work by extending the control point to force the curve to be, um, curvier. + _controlPoint = _findControlPoint(_midx, + _midy, + segment, + params.sourcePos, + params.targetPos, + curviness, curviness, + distance, + proximityLimit); + + cp1x = _controlPoint[0]; + cp2x = _controlPoint[0]; + cp1y = _controlPoint[1]; + cp2y = _controlPoint[1]; + + _super.addSegment(this, "Bezier", { + x1: _tx, y1: _ty, x2: _sx, y2: _sy, + cp1x: cp1x, cp1y: cp1y, + cp2x: cp2x, cp2y: cp2y + }); + }; + }; + + _jp.Connectors.StateMachine = StateMachine; + _ju.extend(StateMachine, _jp.Connectors.AbstractBezierConnector); + +}).call(typeof window !== 'undefined' ? window : this); +/* + * This file contains the 'flowchart' connectors, consisting of vertical and horizontal line segments. + * + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +; +(function () { + + "use strict"; + var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil; + var STRAIGHT = "Straight"; + + var Straight = function (params) { + this.type = STRAIGHT; + var _super = _jp.Connectors.AbstractConnector.apply(this, arguments); + + this._compute = function (paintInfo, _) { + _super.addSegment(this, STRAIGHT, {x1: paintInfo.sx, y1: paintInfo.sy, x2: paintInfo.startStubX, y2: paintInfo.startStubY}); + _super.addSegment(this, STRAIGHT, {x1: paintInfo.startStubX, y1: paintInfo.startStubY, x2: paintInfo.endStubX, y2: paintInfo.endStubY}); + _super.addSegment(this, STRAIGHT, {x1: paintInfo.endStubX, y1: paintInfo.endStubY, x2: paintInfo.tx, y2: paintInfo.ty}); + }; + }; + + _jp.Connectors.Straight = Straight; + _ju.extend(Straight, _jp.Connectors.AbstractConnector); + +}).call(typeof window !== 'undefined' ? window : this); +/* + * This file contains the SVG renderers. + * + * Copyright (c) 2010 - 2018 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +; +(function () { + +// ************************** SVG utility methods ******************************************** + + "use strict"; + var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil; + + var svgAttributeMap = { + "stroke-linejoin": "stroke-linejoin", + "stroke-dashoffset": "stroke-dashoffset", + "stroke-linecap": "stroke-linecap" + }, + STROKE_DASHARRAY = "stroke-dasharray", + DASHSTYLE = "dashstyle", + LINEAR_GRADIENT = "linearGradient", + RADIAL_GRADIENT = "radialGradient", + DEFS = "defs", + FILL = "fill", + STOP = "stop", + STROKE = "stroke", + STROKE_WIDTH = "stroke-width", + STYLE = "style", + NONE = "none", + JSPLUMB_GRADIENT = "jsplumb_gradient_", + LINE_WIDTH = "strokeWidth", + ns = { + svg: "http://www.w3.org/2000/svg" + }, + _attr = function (node, attributes) { + for (var i in attributes) { + node.setAttribute(i, "" + attributes[i]); + } + }, + _node = function (name, attributes) { + attributes = attributes || {}; + attributes.version = "1.1"; + attributes.xmlns = ns.svg; + return _jp.createElementNS(ns.svg, name, null, null, attributes); + }, + _pos = function (d) { + return "position:absolute;left:" + d[0] + "px;top:" + d[1] + "px"; + }, + _clearGradient = function (parent) { + var els = parent.querySelectorAll(" defs,linearGradient,radialGradient"); + for (var i = 0; i < els.length; i++) { + els[i].parentNode.removeChild(els[i]); + } + }, + _updateGradient = function (parent, node, style, dimensions, uiComponent) { + var id = JSPLUMB_GRADIENT + uiComponent._jsPlumb.instance.idstamp(); + // first clear out any existing gradient + _clearGradient(parent); + // this checks for an 'offset' property in the gradient, and in the absence of it, assumes + // we want a linear gradient. if it's there, we create a radial gradient. + // it is possible that a more explicit means of defining the gradient type would be + // better. relying on 'offset' means that we can never have a radial gradient that uses + // some default offset, for instance. + // issue 244 suggested the 'gradientUnits' attribute; without this, straight/flowchart connectors with gradients would + // not show gradients when the line was perfectly horizontal or vertical. + var g; + if (!style.gradient.offset) { + g = _node(LINEAR_GRADIENT, {id: id, gradientUnits: "userSpaceOnUse"}); + } + else { + g = _node(RADIAL_GRADIENT, { id: id }); + } + + var defs = _node(DEFS); + parent.appendChild(defs); + defs.appendChild(g); + + // the svg radial gradient seems to treat stops in the reverse + // order to how canvas does it. so we want to keep all the maths the same, but + // iterate the actual style declarations in reverse order, if the x indexes are not in order. + for (var i = 0; i < style.gradient.stops.length; i++) { + var styleToUse = uiComponent.segment === 1 || uiComponent.segment === 2 ? i : style.gradient.stops.length - 1 - i, + stopColor = style.gradient.stops[styleToUse][1], + s = _node(STOP, {"offset": Math.floor(style.gradient.stops[i][0] * 100) + "%", "stop-color": stopColor}); + + g.appendChild(s); + } + var applyGradientTo = style.stroke ? STROKE : FILL; + node.setAttribute(applyGradientTo, "url(#" + id + ")"); + }, + _applyStyles = function (parent, node, style, dimensions, uiComponent) { + + node.setAttribute(FILL, style.fill ? style.fill : NONE); + node.setAttribute(STROKE, style.stroke ? style.stroke : NONE); + + if (style.gradient) { + _updateGradient(parent, node, style, dimensions, uiComponent); + } + else { + // make sure we clear any existing gradient + _clearGradient(parent); + node.setAttribute(STYLE, ""); + } + + if (style.strokeWidth) { + node.setAttribute(STROKE_WIDTH, style.strokeWidth); + } + + // in SVG there is a stroke-dasharray attribute we can set, and its syntax looks like + // the syntax in VML but is actually kind of nasty: values are given in the pixel + // coordinate space, whereas in VML they are multiples of the width of the stroked + // line, which makes a lot more sense. for that reason, jsPlumb is supporting both + // the native svg 'stroke-dasharray' attribute, and also the 'dashstyle' concept from + // VML, which will be the preferred method. the code below this converts a dashstyle + // attribute given in terms of stroke width into a pixel representation, by using the + // stroke's lineWidth. + if (style[DASHSTYLE] && style[LINE_WIDTH] && !style[STROKE_DASHARRAY]) { + var sep = style[DASHSTYLE].indexOf(",") === -1 ? " " : ",", + parts = style[DASHSTYLE].split(sep), + styleToUse = ""; + parts.forEach(function (p) { + styleToUse += (Math.floor(p * style.strokeWidth) + sep); + }); + node.setAttribute(STROKE_DASHARRAY, styleToUse); + } + else if (style[STROKE_DASHARRAY]) { + node.setAttribute(STROKE_DASHARRAY, style[STROKE_DASHARRAY]); + } + + // extra attributes such as join type, dash offset. + for (var i in svgAttributeMap) { + if (style[i]) { + node.setAttribute(svgAttributeMap[i], style[i]); + } + } + }, + _appendAtIndex = function (svg, path, idx) { + if (svg.childNodes.length > idx) { + svg.insertBefore(path, svg.childNodes[idx]); + } + else { + svg.appendChild(path); + } + }; + + /** + utility methods for other objects to use. + */ + _ju.svg = { + node: _node, + attr: _attr, + pos: _pos + }; + + // ************************** / SVG utility methods ******************************************** + + /* + * Base class for SVG components. + */ + var SvgComponent = function (params) { + var pointerEventsSpec = params.pointerEventsSpec || "all", renderer = {}; + + _jp.jsPlumbUIComponent.apply(this, params.originalArgs); + this.canvas = null; + this.path = null; + this.svg = null; + this.bgCanvas = null; + + var clazz = params.cssClass + " " + (params.originalArgs[0].cssClass || ""), + svgParams = { + "style": "", + "width": 0, + "height": 0, + "pointer-events": pointerEventsSpec, + "position": "absolute" + }; + + this.svg = _node("svg", svgParams); + + if (params.useDivWrapper) { + this.canvas = _jp.createElement("div", { position : "absolute" }); + _ju.sizeElement(this.canvas, 0, 0, 1, 1); + this.canvas.className = clazz; + } + else { + _attr(this.svg, { "class": clazz }); + this.canvas = this.svg; + } + + params._jsPlumb.appendElement(this.canvas, params.originalArgs[0].parent); + if (params.useDivWrapper) { + this.canvas.appendChild(this.svg); + } + + var displayElements = [ this.canvas ]; + this.getDisplayElements = function () { + return displayElements; + }; + + this.appendDisplayElement = function (el) { + displayElements.push(el); + }; + + this.paint = function (style, anchor, extents) { + if (style != null) { + + var xy = [ this.x, this.y ], wh = [ this.w, this.h ], p; + if (extents != null) { + if (extents.xmin < 0) { + xy[0] += extents.xmin; + } + if (extents.ymin < 0) { + xy[1] += extents.ymin; + } + wh[0] = extents.xmax + ((extents.xmin < 0) ? -extents.xmin : 0); + wh[1] = extents.ymax + ((extents.ymin < 0) ? -extents.ymin : 0); + } + + if (params.useDivWrapper) { + _ju.sizeElement(this.canvas, xy[0], xy[1], wh[0], wh[1]); + xy[0] = 0; + xy[1] = 0; + p = _pos([ 0, 0 ]); + } + else { + p = _pos([ xy[0], xy[1] ]); + } + + renderer.paint.apply(this, arguments); + + _attr(this.svg, { + "style": p, + "width": wh[0] || 0, + "height": wh[1] || 0 + }); + } + }; + + return { + renderer: renderer + }; + }; + + _ju.extend(SvgComponent, _jp.jsPlumbUIComponent, { + cleanup: function (force) { + if (force || this.typeId == null) { + if (this.canvas) { + this.canvas._jsPlumb = null; + } + if (this.svg) { + this.svg._jsPlumb = null; + } + if (this.bgCanvas) { + this.bgCanvas._jsPlumb = null; + } + + if (this.canvas && this.canvas.parentNode) { + this.canvas.parentNode.removeChild(this.canvas); + } + if (this.bgCanvas && this.bgCanvas.parentNode) { + this.canvas.parentNode.removeChild(this.canvas); + } + + this.svg = null; + this.canvas = null; + this.path = null; + this.group = null; + } + else { + // if not a forced cleanup, just detach from DOM for now. + if (this.canvas && this.canvas.parentNode) { + this.canvas.parentNode.removeChild(this.canvas); + } + if (this.bgCanvas && this.bgCanvas.parentNode) { + this.bgCanvas.parentNode.removeChild(this.bgCanvas); + } + } + }, + reattach:function(instance) { + var c = instance.getContainer(); + if (this.canvas && this.canvas.parentNode == null) { + c.appendChild(this.canvas); + } + if (this.bgCanvas && this.bgCanvas.parentNode == null) { + c.appendChild(this.bgCanvas); + } + }, + setVisible: function (v) { + if (this.canvas) { + this.canvas.style.display = v ? "block" : "none"; + } + } + }); + + /* + * Base class for SVG connectors. + */ + _jp.ConnectorRenderers.svg = function (params) { + var self = this, + _super = SvgComponent.apply(this, [ + { + cssClass: params._jsPlumb.connectorClass, + originalArgs: arguments, + pointerEventsSpec: "none", + _jsPlumb: params._jsPlumb + } + ]); + + _super.renderer.paint = function (style, anchor, extents) { + + var segments = self.getSegments(), p = "", offset = [0, 0]; + if (extents.xmin < 0) { + offset[0] = -extents.xmin; + } + if (extents.ymin < 0) { + offset[1] = -extents.ymin; + } + + if (segments.length > 0) { + + p = self.getPathData(); + + var a = { + d: p, + transform: "translate(" + offset[0] + "," + offset[1] + ")", + "pointer-events": params["pointer-events"] || "visibleStroke" + }, + outlineStyle = null, + d = [self.x, self.y, self.w, self.h]; + + // outline style. actually means drawing an svg object underneath the main one. + if (style.outlineStroke) { + var outlineWidth = style.outlineWidth || 1, + outlineStrokeWidth = style.strokeWidth + (2 * outlineWidth); + outlineStyle = _jp.extend({}, style); + delete outlineStyle.gradient; + outlineStyle.stroke = style.outlineStroke; + outlineStyle.strokeWidth = outlineStrokeWidth; + + if (self.bgPath == null) { + self.bgPath = _node("path", a); + _jp.addClass(self.bgPath, _jp.connectorOutlineClass); + _appendAtIndex(self.svg, self.bgPath, 0); + } + else { + _attr(self.bgPath, a); + } + + _applyStyles(self.svg, self.bgPath, outlineStyle, d, self); + } + + if (self.path == null) { + self.path = _node("path", a); + _appendAtIndex(self.svg, self.path, style.outlineStroke ? 1 : 0); + } + else { + _attr(self.path, a); + } + + _applyStyles(self.svg, self.path, style, d, self); + } + }; + }; + _ju.extend(_jp.ConnectorRenderers.svg, SvgComponent); + +// ******************************* svg segment renderer ***************************************************** + + +// ******************************* /svg segments ***************************************************** + + /* + * Base class for SVG endpoints. + */ + var SvgEndpoint = _jp.SvgEndpoint = function (params) { + var _super = SvgComponent.apply(this, [ + { + cssClass: params._jsPlumb.endpointClass, + originalArgs: arguments, + pointerEventsSpec: "all", + useDivWrapper: true, + _jsPlumb: params._jsPlumb + } + ]); + + _super.renderer.paint = function (style) { + var s = _jp.extend({}, style); + if (s.outlineStroke) { + s.stroke = s.outlineStroke; + } + + if (this.node == null) { + this.node = this.makeNode(s); + this.svg.appendChild(this.node); + } + else if (this.updateNode != null) { + this.updateNode(this.node); + } + _applyStyles(this.svg, this.node, s, [ this.x, this.y, this.w, this.h ], this); + _pos(this.node, [ this.x, this.y ]); + }.bind(this); + + }; + _ju.extend(SvgEndpoint, SvgComponent); + + /* + * SVG Dot Endpoint + */ + _jp.Endpoints.svg.Dot = function () { + _jp.Endpoints.Dot.apply(this, arguments); + SvgEndpoint.apply(this, arguments); + this.makeNode = function (style) { + return _node("circle", { + "cx": this.w / 2, + "cy": this.h / 2, + "r": this.radius + }); + }; + this.updateNode = function (node) { + _attr(node, { + "cx": this.w / 2, + "cy": this.h / 2, + "r": this.radius + }); + }; + }; + _ju.extend(_jp.Endpoints.svg.Dot, [_jp.Endpoints.Dot, SvgEndpoint]); + + /* + * SVG Rectangle Endpoint + */ + _jp.Endpoints.svg.Rectangle = function () { + _jp.Endpoints.Rectangle.apply(this, arguments); + SvgEndpoint.apply(this, arguments); + this.makeNode = function (style) { + return _node("rect", { + "width": this.w, + "height": this.h + }); + }; + this.updateNode = function (node) { + _attr(node, { + "width": this.w, + "height": this.h + }); + }; + }; + _ju.extend(_jp.Endpoints.svg.Rectangle, [_jp.Endpoints.Rectangle, SvgEndpoint]); + + /* + * SVG Image Endpoint is the default image endpoint. + */ + _jp.Endpoints.svg.Image = _jp.Endpoints.Image; + /* + * Blank endpoint in svg renderer is the default Blank endpoint. + */ + _jp.Endpoints.svg.Blank = _jp.Endpoints.Blank; + /* + * Label overlay in svg renderer is the default Label overlay. + */ + _jp.Overlays.svg.Label = _jp.Overlays.Label; + /* + * Custom overlay in svg renderer is the default Custom overlay. + */ + _jp.Overlays.svg.Custom = _jp.Overlays.Custom; + + var AbstractSvgArrowOverlay = function (superclass, originalArgs) { + superclass.apply(this, originalArgs); + _jp.jsPlumbUIComponent.apply(this, originalArgs); + this.isAppendedAtTopLevel = false; + var self = this; + this.path = null; + this.paint = function (params, containerExtents) { + // only draws on connections, not endpoints. + if (params.component.svg && containerExtents) { + if (this.path == null) { + this.path = _node("path", { + "pointer-events": "all" + }); + params.component.svg.appendChild(this.path); + if (this.elementCreated) { + this.elementCreated(this.path, params.component); + } + + this.canvas = params.component.svg; // for the sake of completeness; this behaves the same as other overlays + } + var clazz = originalArgs && (originalArgs.length === 1) ? (originalArgs[0].cssClass || "") : "", + offset = [0, 0]; + + if (containerExtents.xmin < 0) { + offset[0] = -containerExtents.xmin; + } + if (containerExtents.ymin < 0) { + offset[1] = -containerExtents.ymin; + } + + _attr(this.path, { + "d": makePath(params.d), + "class": clazz, + stroke: params.stroke ? params.stroke : null, + fill: params.fill ? params.fill : null, + transform: "translate(" + offset[0] + "," + offset[1] + ")" + }); + } + }; + var makePath = function (d) { + return (isNaN(d.cxy.x) || isNaN(d.cxy.y)) ? "" : "M" + d.hxy.x + "," + d.hxy.y + + " L" + d.tail[0].x + "," + d.tail[0].y + + " L" + d.cxy.x + "," + d.cxy.y + + " L" + d.tail[1].x + "," + d.tail[1].y + + " L" + d.hxy.x + "," + d.hxy.y; + }; + this.transfer = function(target) { + if (target.canvas && this.path && this.path.parentNode) { + this.path.parentNode.removeChild(this.path); + target.canvas.appendChild(this.path); + } + }; + }; + _ju.extend(AbstractSvgArrowOverlay, [_jp.jsPlumbUIComponent, _jp.Overlays.AbstractOverlay], { + cleanup: function (force) { + if (this.path != null) { + if (force) { + this._jsPlumb.instance.removeElement(this.path); + } + else { + if (this.path.parentNode) { + this.path.parentNode.removeChild(this.path); + } + } + } + }, + reattach:function(instance, component) { + if (this.path && component.canvas) { + component.canvas.appendChild(this.path); + } + }, + setVisible: function (v) { + if (this.path != null) { + (this.path.style.display = (v ? "block" : "none")); + } + } + }); + + _jp.Overlays.svg.Arrow = function () { + AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.Arrow, arguments]); + }; + _ju.extend(_jp.Overlays.svg.Arrow, [ _jp.Overlays.Arrow, AbstractSvgArrowOverlay ]); + + _jp.Overlays.svg.PlainArrow = function () { + AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.PlainArrow, arguments]); + }; + _ju.extend(_jp.Overlays.svg.PlainArrow, [ _jp.Overlays.PlainArrow, AbstractSvgArrowOverlay ]); + + _jp.Overlays.svg.Diamond = function () { + AbstractSvgArrowOverlay.apply(this, [_jp.Overlays.Diamond, arguments]); + }; + _ju.extend(_jp.Overlays.svg.Diamond, [ _jp.Overlays.Diamond, AbstractSvgArrowOverlay ]); + + // a test + _jp.Overlays.svg.GuideLines = function () { + var path = null, self = this, p1_1, p1_2; + _jp.Overlays.GuideLines.apply(this, arguments); + this.paint = function (params, containerExtents) { + if (path == null) { + path = _node("path"); + params.connector.svg.appendChild(path); + self.attachListeners(path, params.connector); + self.attachListeners(path, self); + + p1_1 = _node("path"); + params.connector.svg.appendChild(p1_1); + self.attachListeners(p1_1, params.connector); + self.attachListeners(p1_1, self); + + p1_2 = _node("path"); + params.connector.svg.appendChild(p1_2); + self.attachListeners(p1_2, params.connector); + self.attachListeners(p1_2, self); + } + + var offset = [0, 0]; + if (containerExtents.xmin < 0) { + offset[0] = -containerExtents.xmin; + } + if (containerExtents.ymin < 0) { + offset[1] = -containerExtents.ymin; + } + + _attr(path, { + "d": makePath(params.head, params.tail), + stroke: "red", + fill: null, + transform: "translate(" + offset[0] + "," + offset[1] + ")" + }); + + _attr(p1_1, { + "d": makePath(params.tailLine[0], params.tailLine[1]), + stroke: "blue", + fill: null, + transform: "translate(" + offset[0] + "," + offset[1] + ")" + }); + + _attr(p1_2, { + "d": makePath(params.headLine[0], params.headLine[1]), + stroke: "green", + fill: null, + transform: "translate(" + offset[0] + "," + offset[1] + ")" + }); + }; + + var makePath = function (d1, d2) { + return "M " + d1.x + "," + d1.y + + " L" + d2.x + "," + d2.y; + }; + }; + _ju.extend(_jp.Overlays.svg.GuideLines, _jp.Overlays.GuideLines); +}).call(typeof window !== 'undefined' ? window : this); + +/* + * This file contains code used when jsPlumb is being rendered in a DOM. + * + * Copyright (c) 2010 - 2019 jsPlumb (hello@jsplumbtoolkit.com) + * + * https://jsplumbtoolkit.com + * https://github.com/jsplumb/jsplumb + * + * Dual licensed under the MIT and GPL2 licenses. + */ +; +(function () { + + "use strict"; + + var root = this, _jp = root.jsPlumb, _ju = root.jsPlumbUtil, + _jk = root.Katavorio, _jg = root.Biltong; + + var _getEventManager = function(instance) { + var e = instance._mottle; + if (!e) { + e = instance._mottle = new root.Mottle(); + } + return e; + }; + + var _getDragManager = function (instance, category) { + + category = category || "main"; + var key = "_katavorio_" + category; + var k = instance[key], + e = instance.getEventManager(); + + if (!k) { + k = new _jk({ + bind: e.on, + unbind: e.off, + getSize: _jp.getSize, + getConstrainingRectangle:function(el) { + return [ el.parentNode.scrollWidth, el.parentNode.scrollHeight ]; + }, + getPosition: function (el, relativeToRoot) { + // if this is a nested draggable then compute the offset against its own offsetParent, otherwise + // compute against the Container's origin. see also the getUIPosition method below. + var o = instance.getOffset(el, relativeToRoot, el._katavorioDrag ? el.offsetParent : null); + return [o.left, o.top]; + }, + setPosition: function (el, xy) { + el.style.left = xy[0] + "px"; + el.style.top = xy[1] + "px"; + }, + addClass: _jp.addClass, + removeClass: _jp.removeClass, + intersects: _jg.intersects, + indexOf: function(l, i) { return l.indexOf(i); }, + scope:instance.getDefaultScope(), + css: { + noSelect: instance.dragSelectClass, + droppable: "jtk-droppable", + draggable: "jtk-draggable", + drag: "jtk-drag", + selected: "jtk-drag-selected", + active: "jtk-drag-active", + hover: "jtk-drag-hover", + ghostProxy:"jtk-ghost-proxy" + } + }); + k.setZoom(instance.getZoom()); + instance[key] = k; + instance.bind("zoom", k.setZoom); + } + return k; + }; + + var _dragStart=function(params) { + var options = params.el._jsPlumbDragOptions; + var cont = true; + if (options.canDrag) { + cont = options.canDrag(); + } + if (cont) { + this.setHoverSuspended(true); + this.select({source: params.el}).addClass(this.elementDraggingClass + " " + this.sourceElementDraggingClass, true); + this.select({target: params.el}).addClass(this.elementDraggingClass + " " + this.targetElementDraggingClass, true); + this.setConnectionBeingDragged(true); + } + return cont; + }; + var _dragMove=function(params) { + var ui = this.getUIPosition(arguments, this.getZoom()); + if (ui != null) { + var o = params.el._jsPlumbDragOptions; + this.draw(params.el, ui, null, true); + if (o._dragging) { + this.addClass(params.el, "jtk-dragged"); + } + o._dragging = true; + } + }; + var _dragStop=function(params) { + var elements = params.selection, uip; + + var _one = function (_e) { + if (_e[1] != null) { + // run the reported offset through the code that takes parent containers + // into account, to adjust if necessary (issue 554) + uip = this.getUIPosition([{ + el:_e[2].el, + pos:[_e[1].left, _e[1].top] + }]); + this.draw(_e[2].el, uip); + } + + delete _e[0]._jsPlumbDragOptions._dragging; + + this.removeClass(_e[0], "jtk-dragged"); + this.select({source: _e[2].el}).removeClass(this.elementDraggingClass + " " + this.sourceElementDraggingClass, true); + this.select({target: _e[2].el}).removeClass(this.elementDraggingClass + " " + this.targetElementDraggingClass, true); + this.getDragManager().dragEnded(_e[2].el); + }.bind(this); + + for (var i = 0; i < elements.length; i++) { + _one(elements[i]); + } + + this.setHoverSuspended(false); + this.setConnectionBeingDragged(false); + }; + + var _animProps = function (o, p) { + var _one = function (pName) { + if (p[pName] != null) { + if (_ju.isString(p[pName])) { + var m = p[pName].match(/-=/) ? -1 : 1, + v = p[pName].substring(2); + return o[pName] + (m * v); + } + else { + return p[pName]; + } + } + else { + return o[pName]; + } + }; + return [ _one("left"), _one("top") ]; + }; + + var _genLoc = function (prefix, e) { + if (e == null) { + return [ 0, 0 ]; + } + var ts = _touches(e), t = _getTouch(ts, 0); + return [t[prefix + "X"], t[prefix + "Y"]]; + }, + _pageLocation = _genLoc.bind(this, "page"), + _screenLocation = _genLoc.bind(this, "screen"), + _clientLocation = _genLoc.bind(this, "client"), + _getTouch = function (touches, idx) { + return touches.item ? touches.item(idx) : touches[idx]; + }, + _touches = function (e) { + return e.touches && e.touches.length > 0 ? e.touches : + e.changedTouches && e.changedTouches.length > 0 ? e.changedTouches : + e.targetTouches && e.targetTouches.length > 0 ? e.targetTouches : + [ e ]; + }; + + /** + Manages dragging for some instance of jsPlumb. + + TODO instead of this being accessed directly, it should subscribe to events on the jsPlumb instance: every method + in here is called directly by jsPlumb. But what should happen is that we have unpublished events that this listens + to. The only trick is getting one of these instantiated with every jsPlumb instance: it needs to have a hook somehow. + Basically the general idea is to pull ALL the drag code out (prototype method registrations plus this) into a + dedicated drag script), that does not necessarily need to be included. + + + */ + var DragManager = function (_currentInstance) { + var _draggables = {}, _dlist = [], _delements = {}, _elementsWithEndpoints = {}, + // elementids mapped to the draggable to which they belong. + _draggablesForElements = {}; + + /** + register some element as draggable. right now the drag init stuff is done elsewhere, and it is + possible that will continue to be the case. + */ + this.register = function (el) { + var id = _currentInstance.getId(el), + parentOffset; + + if (!_draggables[id]) { + _draggables[id] = el; + _dlist.push(el); + _delements[id] = {}; + } + + // look for child elements that have endpoints and register them against this draggable. + var _oneLevel = function (p) { + if (p) { + for (var i = 0; i < p.childNodes.length; i++) { + if (p.childNodes[i].nodeType !== 3 && p.childNodes[i].nodeType !== 8) { + var cEl = jsPlumb.getElement(p.childNodes[i]), + cid = _currentInstance.getId(p.childNodes[i], null, true); + if (cid && _elementsWithEndpoints[cid] && _elementsWithEndpoints[cid] > 0) { + if (!parentOffset) { + parentOffset = _currentInstance.getOffset(el); + } + var cOff = _currentInstance.getOffset(cEl); + _delements[id][cid] = { + id: cid, + offset: { + left: cOff.left - parentOffset.left, + top: cOff.top - parentOffset.top + } + }; + _draggablesForElements[cid] = id; + } + _oneLevel(p.childNodes[i]); + } + } + } + }; + + _oneLevel(el); + }; + + // refresh the offsets for child elements of this element. + this.updateOffsets = function (elId, childOffsetOverrides) { + if (elId != null) { + childOffsetOverrides = childOffsetOverrides || {}; + var domEl = jsPlumb.getElement(elId), + id = _currentInstance.getId(domEl), + children = _delements[id], + parentOffset; + + if (children) { + for (var i in children) { + if (children.hasOwnProperty(i)) { + var cel = jsPlumb.getElement(i), + cOff = childOffsetOverrides[i] || _currentInstance.getOffset(cel); + + // do not update if we have a value already and we'd just be writing 0,0 + if (cel.offsetParent == null && _delements[id][i] != null) { + continue; + } + + if (!parentOffset) { + parentOffset = _currentInstance.getOffset(domEl); + } + + _delements[id][i] = { + id: i, + offset: { + left: cOff.left - parentOffset.left, + top: cOff.top - parentOffset.top + } + }; + _draggablesForElements[i] = id; + } + } + } + } + }; + + /** + notification that an endpoint was added to the given el. we go up from that el's parent + node, looking for a parent that has been registered as a draggable. if we find one, we add this + el to that parent's list of elements to update on drag (if it is not there already) + */ + this.endpointAdded = function (el, id) { + + id = id || _currentInstance.getId(el); + + var b = document.body, + p = el.parentNode; + + _elementsWithEndpoints[id] = _elementsWithEndpoints[id] ? _elementsWithEndpoints[id] + 1 : 1; + + while (p != null && p !== b) { + var pid = _currentInstance.getId(p, null, true); + if (pid && _draggables[pid]) { + var pLoc = _currentInstance.getOffset(p); + + if (_delements[pid][id] == null) { + var cLoc = _currentInstance.getOffset(el); + _delements[pid][id] = { + id: id, + offset: { + left: cLoc.left - pLoc.left, + top: cLoc.top - pLoc.top + } + }; + _draggablesForElements[id] = pid; + } + break; + } + p = p.parentNode; + } + }; + + this.endpointDeleted = function (endpoint) { + if (_elementsWithEndpoints[endpoint.elementId]) { + _elementsWithEndpoints[endpoint.elementId]--; + if (_elementsWithEndpoints[endpoint.elementId] <= 0) { + for (var i in _delements) { + if (_delements.hasOwnProperty(i) && _delements[i]) { + delete _delements[i][endpoint.elementId]; + delete _draggablesForElements[endpoint.elementId]; + } + } + } + } + }; + + this.changeId = function (oldId, newId) { + _delements[newId] = _delements[oldId]; + _delements[oldId] = {}; + _draggablesForElements[newId] = _draggablesForElements[oldId]; + _draggablesForElements[oldId] = null; + }; + + this.getElementsForDraggable = function (id) { + return _delements[id]; + }; + + this.elementRemoved = function (elementId) { + var elId = _draggablesForElements[elementId]; + if (elId) { + delete _delements[elId][elementId]; + delete _draggablesForElements[elementId]; + } + }; + + this.reset = function () { + _draggables = {}; + _dlist = []; + _delements = {}; + _elementsWithEndpoints = {}; + }; + + // + // notification drag ended. We check automatically if need to update some + // ancestor's offsets. + // + this.dragEnded = function (el) { + if (el.offsetParent != null) { + var id = _currentInstance.getId(el), + ancestor = _draggablesForElements[id]; + + if (ancestor) { + this.updateOffsets(ancestor); + } + } + }; + + this.setParent = function (el, elId, p, pId, currentChildLocation) { + var current = _draggablesForElements[elId]; + if (!_delements[pId]) { + _delements[pId] = {}; + } + var pLoc = _currentInstance.getOffset(p), + cLoc = currentChildLocation || _currentInstance.getOffset(el); + + if (current && _delements[current]) { + delete _delements[current][elId]; + } + + _delements[pId][elId] = { + id:elId, + offset : { + left: cLoc.left - pLoc.left, + top: cLoc.top - pLoc.top + } + }; + _draggablesForElements[elId] = pId; + }; + + this.clearParent = function(el, elId) { + var current = _draggablesForElements[elId]; + if (current) { + delete _delements[current][elId]; + delete _draggablesForElements[elId]; + } + }; + + this.revalidateParent = function(el, elId, childOffset) { + var current = _draggablesForElements[elId]; + if (current) { + var co = {}; + co[elId] = childOffset; + this.updateOffsets(current, co); + _currentInstance.revalidate(current); + } + }; + + this.getDragAncestor = function (el) { + var de = jsPlumb.getElement(el), + id = _currentInstance.getId(de), + aid = _draggablesForElements[id]; + + if (aid) { + return jsPlumb.getElement(aid); + } + else { + return null; + } + }; + + }; + + var _setClassName = function (el, cn, classList) { + cn = _ju.fastTrim(cn); + if (typeof el.className.baseVal !== "undefined") { + el.className.baseVal = cn; + } + else { + el.className = cn; + } + + // recent (i currently have 61.0.3163.100) version of chrome do not update classList when you set the base val + // of an svg element's className. in the long run we'd like to move to just using classList anyway + try { + var cl = el.classList; + if (cl != null) { + while (cl.length > 0) { + cl.remove(cl.item(0)); + } + for (var i = 0; i < classList.length; i++) { + if (classList[i]) { + cl.add(classList[i]); + } + } + } + } + catch(e) { + // not fatal + _ju.log("JSPLUMB: cannot set class list", e); + } + }, + _getClassName = function (el) { + return (typeof el.className.baseVal === "undefined") ? el.className : el.className.baseVal; + }, + _classManip = function (el, classesToAdd, classesToRemove) { + classesToAdd = classesToAdd == null ? [] : _ju.isArray(classesToAdd) ? classesToAdd : classesToAdd.split(/\s+/); + classesToRemove = classesToRemove == null ? [] : _ju.isArray(classesToRemove) ? classesToRemove : classesToRemove.split(/\s+/); + + var className = _getClassName(el), + curClasses = className.split(/\s+/); + + var _oneSet = function (add, classes) { + for (var i = 0; i < classes.length; i++) { + if (add) { + if (curClasses.indexOf(classes[i]) === -1) { + curClasses.push(classes[i]); + } + } + else { + var idx = curClasses.indexOf(classes[i]); + if (idx !== -1) { + curClasses.splice(idx, 1); + } + } + } + }; + + _oneSet(true, classesToAdd); + _oneSet(false, classesToRemove); + + _setClassName(el, curClasses.join(" "), curClasses); + }; + + root.jsPlumb.extend(root.jsPlumbInstance.prototype, { + + headless: false, + + pageLocation: _pageLocation, + screenLocation: _screenLocation, + clientLocation: _clientLocation, + + getDragManager:function() { + if (this.dragManager == null) { + this.dragManager = new DragManager(this); + } + + return this.dragManager; + }, + + recalculateOffsets:function(elId) { + this.getDragManager().updateOffsets(elId); + }, + + createElement:function(tag, style, clazz, atts) { + return this.createElementNS(null, tag, style, clazz, atts); + }, + + createElementNS:function(ns, tag, style, clazz, atts) { + var e = ns == null ? document.createElement(tag) : document.createElementNS(ns, tag); + var i; + style = style || {}; + for (i in style) { + e.style[i] = style[i]; + } + + if (clazz) { + e.className = clazz; + } + + atts = atts || {}; + for (i in atts) { + e.setAttribute(i, "" + atts[i]); + } + + return e; + }, + + getAttribute: function (el, attName) { + return el.getAttribute != null ? el.getAttribute(attName) : null; + }, + + setAttribute: function (el, a, v) { + if (el.setAttribute != null) { + el.setAttribute(a, v); + } + }, + + setAttributes: function (el, atts) { + for (var i in atts) { + if (atts.hasOwnProperty(i)) { + el.setAttribute(i, atts[i]); + } + } + }, + appendToRoot: function (node) { + document.body.appendChild(node); + }, + getRenderModes: function () { + return [ "svg" ]; + }, + getClass:_getClassName, + addClass: function (el, clazz) { + jsPlumb.each(el, function (e) { + _classManip(e, clazz); + }); + }, + hasClass: function (el, clazz) { + el = jsPlumb.getElement(el); + if (el.classList) { + return el.classList.contains(clazz); + } + else { + return _getClassName(el).indexOf(clazz) !== -1; + } + }, + removeClass: function (el, clazz) { + jsPlumb.each(el, function (e) { + _classManip(e, null, clazz); + }); + }, + toggleClass:function(el, clazz) { + if (jsPlumb.hasClass(el, clazz)) { + jsPlumb.removeClass(el, clazz); + } else { + jsPlumb.addClass(el, clazz); + } + }, + updateClasses: function (el, toAdd, toRemove) { + jsPlumb.each(el, function (e) { + _classManip(e, toAdd, toRemove); + }); + }, + setClass: function (el, clazz) { + if (clazz != null) { + jsPlumb.each(el, function (e) { + _setClassName(e, clazz, clazz.split(/\s+/)); + }); + } + }, + setPosition: function (el, p) { + el.style.left = p.left + "px"; + el.style.top = p.top + "px"; + }, + getPosition: function (el) { + var _one = function (prop) { + var v = el.style[prop]; + return v ? v.substring(0, v.length - 2) : 0; + }; + return { + left: _one("left"), + top: _one("top") + }; + }, + getStyle:function(el, prop) { + if (typeof window.getComputedStyle !== 'undefined') { + return getComputedStyle(el, null).getPropertyValue(prop); + } else { + return el.currentStyle[prop]; + } + }, + getSelector: function (ctx, spec) { + var sel = null; + if (arguments.length === 1) { + sel = ctx.nodeType != null ? ctx : document.querySelectorAll(ctx); + } + else { + sel = ctx.querySelectorAll(spec); + } + + return sel; + }, + getOffset:function(el, relativeToRoot, container) { + el = jsPlumb.getElement(el); + container = container || this.getContainer(); + var out = { + left: el.offsetLeft, + top: el.offsetTop + }, + op = (relativeToRoot || (container != null && (el !== container && el.offsetParent !== container))) ? el.offsetParent : null, + _maybeAdjustScroll = function(offsetParent) { + if (offsetParent != null && offsetParent !== document.body && (offsetParent.scrollTop > 0 || offsetParent.scrollLeft > 0)) { + out.left -= offsetParent.scrollLeft; + out.top -= offsetParent.scrollTop; + } + }.bind(this); + + while (op != null) { + out.left += op.offsetLeft; + out.top += op.offsetTop; + _maybeAdjustScroll(op); + op = relativeToRoot ? op.offsetParent : + op.offsetParent === container ? null : op.offsetParent; + } + + // if container is scrolled and the element (or its offset parent) is not absolute or fixed, adjust accordingly. + if (container != null && !relativeToRoot && (container.scrollTop > 0 || container.scrollLeft > 0)) { + var pp = el.offsetParent != null ? this.getStyle(el.offsetParent, "position") : "static", + p = this.getStyle(el, "position"); + if (p !== "absolute" && p !== "fixed" && pp !== "absolute" && pp !== "fixed") { + out.left -= container.scrollLeft; + out.top -= container.scrollTop; + } + } + return out; + }, + // + // return x+y proportion of the given element's size corresponding to the location of the given event. + // + getPositionOnElement: function (evt, el, zoom) { + var box = typeof el.getBoundingClientRect !== "undefined" ? el.getBoundingClientRect() : { left: 0, top: 0, width: 0, height: 0 }, + body = document.body, + docElem = document.documentElement, + scrollTop = window.pageYOffset || docElem.scrollTop || body.scrollTop, + scrollLeft = window.pageXOffset || docElem.scrollLeft || body.scrollLeft, + clientTop = docElem.clientTop || body.clientTop || 0, + clientLeft = docElem.clientLeft || body.clientLeft || 0, + pst = 0, + psl = 0, + top = box.top + scrollTop - clientTop + (pst * zoom), + left = box.left + scrollLeft - clientLeft + (psl * zoom), + cl = jsPlumb.pageLocation(evt), + w = box.width || (el.offsetWidth * zoom), + h = box.height || (el.offsetHeight * zoom), + x = (cl[0] - left) / w, + y = (cl[1] - top) / h; + + return [ x, y ]; + }, + + /** + * Gets the absolute position of some element as read from the left/top properties in its style. + * @method getAbsolutePosition + * @param {Element} el The element to retrieve the absolute coordinates from. **Note** this is a DOM element, not a selector from the underlying library. + * @return {Number[]} [left, top] pixel values. + */ + getAbsolutePosition: function (el) { + var _one = function (s) { + var ss = el.style[s]; + if (ss) { + return parseFloat(ss.substring(0, ss.length - 2)); + } + }; + return [ _one("left"), _one("top") ]; + }, + + /** + * Sets the absolute position of some element by setting the left/top properties in its style. + * @method setAbsolutePosition + * @param {Element} el The element to set the absolute coordinates on. **Note** this is a DOM element, not a selector from the underlying library. + * @param {Number[]} xy x and y coordinates + * @param {Number[]} [animateFrom] Optional previous xy to animate from. + * @param {Object} [animateOptions] Options for the animation. + */ + setAbsolutePosition: function (el, xy, animateFrom, animateOptions) { + if (animateFrom) { + this.animate(el, { + left: "+=" + (xy[0] - animateFrom[0]), + top: "+=" + (xy[1] - animateFrom[1]) + }, animateOptions); + } + else { + el.style.left = xy[0] + "px"; + el.style.top = xy[1] + "px"; + } + }, + /** + * gets the size for the element, in an array : [ width, height ]. + */ + getSize: function (el) { + return [ el.offsetWidth, el.offsetHeight ]; + }, + getWidth: function (el) { + return el.offsetWidth; + }, + getHeight: function (el) { + return el.offsetHeight; + }, + getRenderMode : function() { return "svg"; }, + draggable : function (el, options) { + var info; + el = _ju.isArray(el) || (el.length != null && !_ju.isString(el)) ? el: [ el ]; + Array.prototype.slice.call(el).forEach(function(_el) { + info = this.info(_el); + if (info.el) { + this._initDraggableIfNecessary(info.el, true, options, info.id, true); + } + }.bind(this)); + return this; + }, + initDraggable: function (el, options, category) { + _getDragManager(this, category).draggable(el, options); + el._jsPlumbDragOptions = options; + }, + destroyDraggable: function (el, category) { + _getDragManager(this, category).destroyDraggable(el); + delete el._jsPlumbDragOptions; + }, + unbindDraggable: function (el, evt, fn, category) { + _getDragManager(this, category).destroyDraggable(el, evt, fn); + }, + setDraggable : function (element, draggable) { + return jsPlumb.each(element, function (el) { + if (this.isDragSupported(el)) { + this._draggableStates[this.getAttribute(el, "id")] = draggable; + this.setElementDraggable(el, draggable); + } + }.bind(this)); + }, + _draggableStates : {}, + /* + * toggles the draggable state of the given element(s). + * el is either an id, or an element object, or a list of ids/element objects. + */ + toggleDraggable : function (el) { + var state; + jsPlumb.each(el, function (el) { + var elId = this.getAttribute(el, "id"); + state = this._draggableStates[elId] == null ? false : this._draggableStates[elId]; + state = !state; + this._draggableStates[elId] = state; + this.setDraggable(el, state); + return state; + }.bind(this)); + return state; + }, + _initDraggableIfNecessary : function (element, isDraggable, dragOptions, id, fireEvent) { + // TODO FIRST: move to DragManager. including as much of the decision to init dragging as possible. + if (!jsPlumb.headless) { + var _draggable = isDraggable == null ? false : isDraggable; + if (_draggable) { + if (jsPlumb.isDragSupported(element, this)) { + var options = dragOptions || this.Defaults.DragOptions; + options = jsPlumb.extend({}, options); // make a copy. + if (!jsPlumb.isAlreadyDraggable(element, this)) { + var dragEvent = jsPlumb.dragEvents.drag, + stopEvent = jsPlumb.dragEvents.stop, + startEvent = jsPlumb.dragEvents.start; + + this.manage(id, element); + + options[startEvent] = _ju.wrap(options[startEvent], _dragStart.bind(this)); + + options[dragEvent] = _ju.wrap(options[dragEvent], _dragMove.bind(this)); + + options[stopEvent] = _ju.wrap(options[stopEvent], _dragStop.bind(this)); + + var elId = this.getId(element); // need ID + + this._draggableStates[elId] = true; + var draggable = this._draggableStates[elId]; + + options.disabled = draggable == null ? false : !draggable; + this.initDraggable(element, options); + this.getDragManager().register(element); + if (fireEvent) { + this.fire("elementDraggable", {el:element, options:options}); + } + } + else { + // already draggable. attach any start, drag or stop listeners to the current Drag. + if (dragOptions.force) { + this.initDraggable(element, options); + } + } + } + } + } + }, + animationSupported:true, + getElement: function (el) { + if (el == null) { + return null; + } + // here we pluck the first entry if el was a list of entries. + // this is not my favourite thing to do, but previous versions of + // jsplumb supported jquery selectors, and it is possible a selector + // will be passed in here. + el = typeof el === "string" ? el : el.length != null && el.enctype == null ? el[0] : el; + return typeof el === "string" ? document.getElementById(el) : el; + }, + removeElement: function (element) { + _getDragManager(this).elementRemoved(element); + this.getEventManager().remove(element); + }, + // + // this adapter supports a rudimentary animation function. no easing is supported. only + // left/top properties are supported. property delta args are expected to be in the form + // + // +=x.xxxx + // + // or + // + // -=x.xxxx + // + doAnimate: function (el, properties, options) { + options = options || {}; + var o = this.getOffset(el), + ap = _animProps(o, properties), + ldist = ap[0] - o.left, + tdist = ap[1] - o.top, + d = options.duration || 250, + step = 15, steps = d / step, + linc = (step / d) * ldist, + tinc = (step / d) * tdist, + idx = 0, + _int = setInterval(function () { + _jp.setPosition(el, { + left: o.left + (linc * (idx + 1)), + top: o.top + (tinc * (idx + 1)) + }); + if (options.step != null) { + options.step(idx, Math.ceil(steps)); + } + idx++; + if (idx >= steps) { + window.clearInterval(_int); + if (options.complete != null) { + options.complete(); + } + } + }, step); + }, + // DRAG/DROP + + + destroyDroppable: function (el, category) { + _getDragManager(this, category).destroyDroppable(el); + }, + unbindDroppable: function (el, evt, fn, category) { + _getDragManager(this, category).destroyDroppable(el, evt, fn); + }, + + droppable :function(el, options) { + el = _ju.isArray(el) || (el.length != null && !_ju.isString(el)) ? el: [ el ]; + var info; + options = options || {}; + options.allowLoopback = false; + Array.prototype.slice.call(el).forEach(function(_el) { + info = this.info(_el); + if (info.el) { + this.initDroppable(info.el, options); + } + }.bind(this)); + return this; + }, + + initDroppable: function (el, options, category) { + _getDragManager(this, category).droppable(el, options); + }, + isAlreadyDraggable: function (el) { + return el._katavorioDrag != null; + }, + isDragSupported: function (el, options) { + return true; + }, + isDropSupported: function (el, options) { + return true; + }, + isElementDraggable: function (el) { + el = _jp.getElement(el); + return el._katavorioDrag && el._katavorioDrag.isEnabled(); + }, + getDragObject: function (eventArgs) { + return eventArgs[0].drag.getDragElement(); + }, + getDragScope: function (el) { + return el._katavorioDrag && el._katavorioDrag.scopes.join(" ") || ""; + }, + getDropEvent: function (args) { + return args[0].e; + }, + getUIPosition: function (eventArgs, zoom) { + // here the position reported to us by Katavorio is relative to the element's offsetParent. For top + // level nodes that is fine, but if we have a nested draggable then its offsetParent is actually + // not going to be the jsplumb container; it's going to be some child of that element. In that case + // we want to adjust the UI position to account for the offsetParent's position relative to the Container + // origin. + var el = eventArgs[0].el; + if (el.offsetParent == null) { + return null; + } + var finalPos = eventArgs[0].finalPos || eventArgs[0].pos; + var p = { left:finalPos[0], top:finalPos[1] }; + if (el._katavorioDrag && el.offsetParent !== this.getContainer()) { + var oc = this.getOffset(el.offsetParent); + p.left += oc.left; + p.top += oc.top; + } + return p; + }, + setDragFilter: function (el, filter, _exclude) { + if (el._katavorioDrag) { + el._katavorioDrag.setFilter(filter, _exclude); + } + }, + setElementDraggable: function (el, draggable) { + el = _jp.getElement(el); + if (el._katavorioDrag) { + el._katavorioDrag.setEnabled(draggable); + } + }, + setDragScope: function (el, scope) { + if (el._katavorioDrag) { + el._katavorioDrag.k.setDragScope(el, scope); + } + }, + setDropScope:function(el, scope) { + if (el._katavorioDrop && el._katavorioDrop.length > 0) { + el._katavorioDrop[0].k.setDropScope(el, scope); + } + }, + addToPosse:function(el, spec) { + var specs = Array.prototype.slice.call(arguments, 1); + var dm = _getDragManager(this); + _jp.each(el, function(_el) { + _el = [ _jp.getElement(_el) ]; + _el.push.apply(_el, specs ); + dm.addToPosse.apply(dm, _el); + }); + }, + setPosse:function(el, spec) { + var specs = Array.prototype.slice.call(arguments, 1); + var dm = _getDragManager(this); + _jp.each(el, function(_el) { + _el = [ _jp.getElement(_el) ]; + _el.push.apply(_el, specs ); + dm.setPosse.apply(dm, _el); + }); + }, + removeFromPosse:function(el, posseId) { + var specs = Array.prototype.slice.call(arguments, 1); + var dm = _getDragManager(this); + _jp.each(el, function(_el) { + _el = [ _jp.getElement(_el) ]; + _el.push.apply(_el, specs ); + dm.removeFromPosse.apply(dm, _el); + }); + }, + removeFromAllPosses:function(el) { + var dm = _getDragManager(this); + _jp.each(el, function(_el) { dm.removeFromAllPosses(_jp.getElement(_el)); }); + }, + setPosseState:function(el, posseId, state) { + var dm = _getDragManager(this); + _jp.each(el, function(_el) { dm.setPosseState(_jp.getElement(_el), posseId, state); }); + }, + dragEvents: { + 'start': 'start', 'stop': 'stop', 'drag': 'drag', 'step': 'step', + 'over': 'over', 'out': 'out', 'drop': 'drop', 'complete': 'complete', + 'beforeStart':'beforeStart' + }, + animEvents: { + 'step': "step", 'complete': 'complete' + }, + stopDrag: function (el) { + if (el._katavorioDrag) { + el._katavorioDrag.abort(); + } + }, + addToDragSelection: function (spec) { + _getDragManager(this).select(spec); + }, + removeFromDragSelection: function (spec) { + _getDragManager(this).deselect(spec); + }, + clearDragSelection: function () { + _getDragManager(this).deselectAll(); + }, + trigger: function (el, event, originalEvent, payload) { + this.getEventManager().trigger(el, event, originalEvent, payload); + }, + doReset:function() { + // look for katavorio instances and reset each one if found. + for (var key in this) { + if (key.indexOf("_katavorio_") === 0) { + this[key].reset(); + } + } + }, + getEventManager:function() { + return _getEventManager(this); + }, + on : function(el, event, callback) { + // TODO: here we would like to map the tap event if we know its + // an internal bind to a click. we have to know its internal because only + // then can we be sure that the UP event wont be consumed (tap is a synthesized + // event from a mousedown followed by a mouseup). + //event = { "click":"tap", "dblclick":"dbltap"}[event] || event; + this.getEventManager().on.apply(this, arguments); + return this; + }, + off : function(el, event, callback) { + this.getEventManager().off.apply(this, arguments); + return this; + } + + }); + + var ready = function (f) { + var _do = function () { + if (/complete|loaded|interactive/.test(document.readyState) && typeof(document.body) !== "undefined" && document.body != null) { + f(); + } + else { + setTimeout(_do, 9); + } + }; + + _do(); + }; + ready(_jp.init); + +}).call(typeof window !== 'undefined' ? window : this); diff --git a/experiment/simulation/js/monostablecal.js b/experiment/simulation/js/monostablecal.js new file mode 100644 index 0000000..3b6ae22 --- /dev/null +++ b/experiment/simulation/js/monostablecal.js @@ -0,0 +1,300 @@ +var rlslider,cldslider; + + +function resChange() { + rlslider = document.getElementById("res1").value; + document.getElementById("res").value = rlslider; +} + +function capldChange() { + cldslider = document.getElementById("capa1").value; + document.getElementById("capac1").value = cldslider; +} + +function vinChange(){ + var vi=document.getElementById("vdc").value; + document.getElementById("dc").value=vi; + +} +function tinChange(){ + var tinp=document.getElementById("tinrange").value; + document.getElementById("timeprdata").value=tinp; +} + + var r1; + var c1; + var vcc; + + var tin=20; //ms + var tout;//ms //pulse width + var datapoints=[]; + var datapoints1=[]; + var datapoints2=[]; + var to=tin; + var toff; + + function voutput(){ + + + vcc=document.getElementById("dc").value; + var vo=vcc; + toff=0.25*tin; + r1=document.getElementById("res").value*Math.pow(10,3); + c1=document.getElementById("capac1").value*Math.pow(10,-6); + tout=1.1*parseFloat(r1)*parseFloat(c1)*Math.pow(10,3);//ms //pulse width + + var i,j=0; + + + for(i=0;i<=3;i=i+1){ + for(j=0;j<=to;j=j+0.1){ + if(j<(tout)){ //11ms + + datapoints.push({x:j+(to*i),y:parseInt(vcc)}); + + } + else if(j + + + + Monostable Multivibrator using 555 + + + + + + + + + + + + + + + + + + + + + + + + + +
+ +
+ +
+
+
+
+
+
+
+
+ + + +
+
+ +
+

+ + + +

+

+

+

+

+

+

+

+

+ + + + + + + + + + +
+ + + + + + + + + + + + + +
+ +
+ +

CONTROLS

+
+ + + + +
+ +    Resistance (Ra) :   kΩ
+    Capacitance (C) :  µf
+    Supply voltage (Vcc) :       Volt
+    Time period (Tin) :       mSec
+ +
+ + + + +
+ + + + +
+
+
+

+

+ +
+ +
+ + + +
+ + +
+

GRAPH PLOT

+
+ Print
+ + +
+
+
+
+ + + + + + + + + diff --git a/experiment/theory.md b/experiment/theory.md index ef57af9..54a02ba 100644 --- a/experiment/theory.md +++ b/experiment/theory.md @@ -1 +1,50 @@ -### Link your theory in here \ No newline at end of file +## Theory + +One of the most versatile linear ICs is the 555 times. It was first introduced in early 1970 by Signetic Corporation giving the name as SE/NE 555 timer. The 555 is a monolithic timing circuit that can produce highly stable time delays or oscillation. The timer basically operates in one of the two modes either as monostable or as an astable multivibrator. + +A monostable multivibrator, often called a one-shot multivibrator, is a Pulse generating circuit in which the duration of the pulse is determined by the RC network connected externally to the 555 timer. In a stable or standby state the output of the circuit is approximately zero or at logic-low level. When an external trigger pulse is applied, the output is forced to go high (≅ Vcc). The time the output remains high is determined by the external RC network connected to the timer. AT the end of the timing interval, the output automatically reverts back to its logic-low stable state. The output remains low until the trigger pulse is again applied. Then the cycle repeats. The monostable circuit has only one stable state (output low), hence the name monostable. Normally, the output of the monostable multivibrator is low + +#### 555 pin configuration + +The 555 IC is available as an 8-pin metal can as given below. + +
+ +

Figure 1

+
+ +**Pin1 : Grounded Terminal** All the voltages are measured w.r.t. this terminal. +**Pin2 : Trigger Terminal** This pin is an inverting input to a comparator that is reponsible for transition of flip-flop from set to reset. The output of the timer depends on the amplitude of the external tigger pulse applied to this pin. +**Pin3 : Output Terminal** Output of the timer is available at this pin. There are two ways in which a load can be connected to the output terminal either between pin 3 and ground pin or between pin 3 and supply pin. +**Pin4 : Reset Terminal**To disable or reset the timer a negative pulse is applied to this pin due to which it is referred to as reset terminal. When this pin is not to be used, it should be connected to +Vcc to avoid any possibility pf false triggering. +**Pin5 : Control Voltage Terminal** The function of this terminal is to control the threshold and trigger levels. Thus either the external voltage or apot connected to this pin determines the pulse width of the output waveform. The external voltage applied to this pin can also be used to modulate th eoutput waveform. When this pin is not used, it should be connected to ground through a 0.01uF to avoid any noice problem. +**Pin6 : Threshold Terminal** This is the noninverting input terminal of comparator 1,which compares the voltage applied to this terminal with a refernce volatge of +2/3 VCC. The amplitude of the volatge applied to this terminal is responsible for the set state of flip flop. +**Pin7 : Discharge Terminal** This pin is connected internally to the collector of transistor and mostly a capacitor is discharge terminal because when transistor saturates, capacitor discharges through the transistor. When the transistor is cutoff, the capacitor charges at a rate determined by external resistor and capacitor. +**Pin8 : Supply Terminal** A supply voltage of +5V to +18V is applied to this terminal w.r.t. to ground pin. + +#### The 555 Timer as a Monostable Multivibrator + +The schematic of a 555 timer in monostable mode of operation is shown in figure 2. The ciruit details are given below. Pin 1 is grounded. Trigger input is applied to pin 2. In quiescent condition of output this input is kept at +Vcc. To obtain transition of output from stable to quasistable state, a negative-going pulse of naroow width and amplitudeof greater than +2/3 Vcc +is applied to pin 2. Output is taken from pin 3. Pin 4 is usually connected to +Vcc +tp avoid reset. Pin 5 is grounded through a 0.01uF capacitor to avoid noise problem. Pin 6 is shorted to pin 7. A resistor RA +is connected between pins 6 and 8. At pin 7 a discharge capacitor is connected while pin 8 is connected to supply VCC. + + +
+ +

Figure 2

+
+ +#### Monostable operation: +According to Figure 1 initially when output is low, that is , the circuit is in a stable state, transistor Q1 is on and the capacitor C is shorted out of the ground. However, upon application of a negative trigger pulse to pin 2, transistor Q1 is turned off, which releases the short circuit across the external capacitor C and drives the output high. The capacitor C now starts charging up toward VCC through RA. However, when the voltage across the capacitor equals 2/3 VCC, comparator 1’s output switches from low to high, which in turn drives the output to its low state via the output of the flip-flop. At the same time, the output of the flip-flop turns transistor Q1 ON, and hence capacitor C rapidly discharges through the transistor. The output of the monostable remains low until a trigger pulse is again applied. Then the cycle reprats. Figure 3 shows the trigger input, output voltage, and capacitor voltage waveform. As shown here, the pulse width of the trigger input must be smaller than the expected pulse width of the output waveform. Also the trigger pulse must be a negative-going input signal with amplitude larger than 1/3 VCC. + +
+ +

Figure 3

+
+ +#### Applications of monostable multivibrator +1. The monostable multivibrator is used as delay and timing circuits. +2. It is also used for temporary memories. +3. It is often used to trigger another pulse generator. +4. It is used for regenerating old and worn out pulses. \ No newline at end of file