@flexem/fc-gui 3.0.0-alpha.88 → 3.0.0-alpha.89
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +6 -1
- package/bundles/@flexem/fc-gui.umd.js +5 -3
- package/bundles/@flexem/fc-gui.umd.js.map +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js +1 -1
- package/bundles/@flexem/fc-gui.umd.min.js.map +1 -1
- package/elements/view-operation/view-operation.element.js +5 -3
- package/package.json +1 -1
|
@@ -21,7 +21,7 @@ MERCHANTABLITY OR NON-INFRINGEMENT.
|
|
|
21
21
|
See the Apache Version 2.0 License for specific language governing permissions
|
|
22
22
|
and limitations under the License.
|
|
23
23
|
***************************************************************************** */
|
|
24
|
-
var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function r(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}},function(t,e,n){"use strict";var i,r=n(252);class a{constructor(t,e){this.graphType=t,this.source=e}}class o{constructor(t,e){this.graph=t,this.failed=e}static failed(){return o.failedResult}static success(t){return new o(t)}}o.failedResult=new o(null,!0),function(t){t[t.SVG=0]="SVG",t[t.Image=1]="Image"}(i||(i={}));var s=n(251),l=n(250),u=n(30),c=n(249),d=n(248);class h{constructor(t,e,n){this.error=t,this.isUnbind=e,this.values=n}}class f{constructor(t,e){this.time=t,this.values=e}}class m{constructor(t,e,n,i,r,a,o){this.dataSourceCode=t,this.dataItemName=e,this.channelNames=n,this.startTime=i,this.endTime=r,this.limit=a,this.rangeType=o}}var p=n(247);class g{constructor(t,e,n){this.name=t,this.groupName=e,this.code=n}}var v=n(246);class _{constructor(t,e,n,i,r){this.alarmNames=t,this.triggeredStartTime=e,this.triggeredEndTime=n,this.maxResultCount=i,this.skipCount=r}}n.d(e,"b",function(){return r.ConfigStore}),n.d(e,"f",function(){return a}),n.d(e,"g",function(){return o}),n.d(e,"i",function(){return i}),n.d(e,"h",function(){return s.GraphStore}),n.d(e,"p",function(){return l.ViewStore}),n.d(e,"o",function(){return u.a}),n.d(e,"m",function(){return c.ImageStore}),n.d(e,"k",function(){return d.HistoryDataStore}),n.d(e,"j",function(){return h}),n.d(e,"l",function(){return f}),n.d(e,"d",function(){return m}),n.d(e,"n",function(){return p.VariableStore}),n.d(e,"e",function(){return g}),n.d(e,"a",function(){return v.AlarmsStore}),n.d(e,"c",function(){return _})},function(t,e,n){"use strict";var i=n(28);var r=n(52),a=n(53);var o=n(40),s=n(270);function l(t){return 0===t.length?s.a:1===t.length?t[0]:function(e){return t.reduce(function(t,e){return e(t)},e)}}var u=n(23);n.d(e,"a",function(){return c});var c=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var o=this.operator,s=function(t,e,n){if(t){if(t instanceof i.a)return t;if(t[r.a])return t[r.a]()}return t||e||n?new i.a(t,e,n):new i.a(a.a)}(t,e,n);if(o?s.add(o.call(s,this.source)):s.add(this.source||u.a.useDeprecatedSynchronousErrorHandling&&!s.syncErrorThrowable?this._subscribe(s):this._trySubscribe(s)),u.a.useDeprecatedSynchronousErrorHandling&&s.syncErrorThrowable&&(s.syncErrorThrowable=!1,s.syncErrorThrown))throw s.syncErrorValue;return s},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){u.a.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),!function(t){for(;t;){var e=t,n=e.closed,r=e.destination,a=e.isStopped;if(n||a)return!1;t=r&&r instanceof i.a?r:null}return!0}(t)?console.warn(e):t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=d(e))(function(e,i){var r;r=n.subscribe(function(e){try{t(e)}catch(t){i(t),r&&r.unsubscribe()}},i,e)})},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[o.a]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:l(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=d(t))(function(t,n){var i;e.subscribe(function(t){return i=t},function(t){return n(t)},function(){return t(i)})})},t.create=function(e){return new t(e)},t}();function d(t){if(t||(t=u.a.Promise||Promise),!t)throw new Error("no Promise impl found");return t}},function(t,e,n){"use strict";var i,r;!function(t){t[t.Uniform=0]="Uniform",t[t.HorizontalUniform=1]="HorizontalUniform"}(i||(i={})),function(t){t[t.Web=0]="Web",t[t.Mobile=1]="Mobile"}(r||(r={}));var a=n(48);n.d(e,"c",function(){return i}),n.d(e,"a",function(){return r}),n.d(e,"b",function(){return a.a})},function(t,e,n){"use strict";var i;n.d(e,"a",function(){return i}),function(t){t[t.Constant=0]="Constant",t[t.Variable=1]="Variable"}(i||(i={}))},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e,n){"use strict";n.d(e,"b",function(){return r}),n.d(e,"a",function(){return a});var i=n(0);const r=new i.InjectionToken("fc.gui.loc"),a={loadFailed:"Load failed.",setting:"Setting",submit:"Submit",submitting:"Submitting···",numericalValueRequired:"Numerical value can't be emtpy",invalidNumericalValue:"Numerical value is not valid",writeValueTimeout:"write value error: timeout",binaryType:"Binary",decimalType:"Decimal",hexadecimalType:"Hexadecimal",stringType:"String",numericalValueTooLong:"Numerical value too long",fractionDigitsMustLessThan:"Fraction digits must be less than ",canNotBeNegative:"Can not be negative",valueOutOfRange:"Numerical value is out of range",timeout:"timeout",confirmOperationPrompt:"Sure to do this operation?",confirm:"Yes",cancel:"Cancel",characterInputRequired:"Character input can't be empty",character:"(Character)",characterOutofRange:"Character length is out of range",writeValueRange:"Write value range",loading:"Loading",unbind:"Unbind",offline:"Offline",abnormal:"Data abnormal",disable:"Disable",permissiontip:"You have no permission to operate.",conditionIsNotMetTip:"Unsatisfied operating conditions or variable abnorma.",chartNoData:"No Data Available",lastThirtyMinutes:"Last thirty minutes",lastOneHour:"Last one hour",lastEightHour:"Last eight hours",lastTwentyFourHours:"Last 24 hours",lastSevenDays:"Last 7 days",lastThirtyDays:"Last 30 days",lastOneYear:"Last 1 year",grouped:"Grouped",stacked:"Stacked",passwordVerify:"Password verifiers",passwordError:"Password error",password:"Password",passwordToolTip:"Password error, please re-enter",passwordRequired:"Password can't be empty",invalidVideoAddress:"Invalid video address",unconfiguredVideoAddress:"Unconfigured Video Address",weatherNotSupport:"Location not supported",weatherNotAddress:"Address not configured",weatherNotAvailable:"Address not yet available",airQualityNotSupport:"Location not supported",airQualityNotAddress:"Address not configured",airQualityNotAvailable:"Address not yet available"}},function(t,e,n){"use strict";n.d(e,"a",function(){return l});var i=n(0),r=n(39),a=n(2),o=n(9),s=function(t,e){return function(n,i){e(n,i,t)}};let l=class{constructor(t){this.localization=t,this._onClosed=new r.a,this.passwordError=!1}get onClosed(){return this._onClosed}ngOnInit(){this.validate()}validate(){Object(a.isNil)(this.password)||""===this.password.trim()?(this.passwordError=!0,this.validationErrorText=this.localization.passwordRequired):(this.passwordError=!1,this.validationErrorText="")}checkSecurity(){this.securityChecker.isValid(this.password).then(t=>{t?this.close(!0):(this.passwordError=!0,this.validationErrorText=this.localization.passwordToolTip)}).catch(()=>{throw new Error("Failure of the checkSecurity")})}close(t){this._onClosed.next(t),this._onClosed.complete()}};l=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Component)({selector:"verify-password",template:'<form #verifyPasswordForm="ngForm" novalidate (ngSubmit)="checkSecurity()" bs-modal-drag> <div class="modal-header"> <h4 class="modal-title"> <span>{{localization.passwordVerify}}</span> </h4> <button type="button" class="close pull-right" aria-label="Close" (click)="close()"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <span class="password-span">{{localization.password}}: </span> <input type="password" name="password" autoFocus class="form-control element-password" [(ngModel)]="password" (keyup)="validate()" autocomplete="off"> <span class="help-block text-danger" [hidden]="!passwordError">{{validationErrorText}}</span> </div> <div class="modal-footer"> <button type="button" class="btn md-skip btn-cancel" (click)="close()">{{localization.cancel}} </button> <button type="submit" class="btn md-skip btn-primary" [disabled]="passwordError">{{localization.submit}}</button> </div> </form> ',styles:[".modal-header { padding: 10px; border-color: transparent; } .modal-body { position: relative; padding: 0px 5px !important; padding-top: 10px !important; } .modal-title { display: unset; margin-left: -6px; font-size: 16px !important; } .form-control { margin: 0 5%; float: none; width: 90%; } .modal-footer { padding: 10px 4px 20px 5px !important; text-align: right; border-color: transparent; color: #fff; } .text-danger { display: block; color: #ed6b75; font-size: 14px; margin: 5px 0px 0px 15px; } .btn-primary { color: #fff; height: 32px; margin-right: 10px; line-height: 0px } .password-span { color: #7f939e; font-size: 14px; margin-left: 15px; } .btn-cancel { color: #fff; height: 32px; min-width: 71px; margin-right: 6px; background-color: #dddddd; line-height: 0px } .element-password { padding-left: 8px; height: 32px; min-width: 71px; margin-left: 16px; } "]}),s(0,Object(i.Inject)(o.b))],l)},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var i=n(0),r=n(39),a=n(18),o=function(t,e){return function(n,i){e(n,i,t)}};let s=class{constructor(t){this.localization=t,this._onClosed=new r.a}get onClosed(){return this._onClosed}close(t){this._onClosed.next(t),this._onClosed.complete()}confirm(){this.close(!0)}};s=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Component)({selector:"confirmOperationModal",template:'<form novalidate (ngSubmit)="confirm()" bs-modal-drag> <div class="modal-body"> <div style="text-align:center;margin-top:20px;"> <div class="alertIcon"></div> <h3 class="confirm-h3">{{localization.confirmOperationPrompt}}</h3> </div> </div> <div class="modal-footer form-group confirm-btn-group"> <button type="button" class="sweet-alert-btn" (click)="close()"> {{localization.cancel}} </button> <button type="submit" class="sweet-alert-btn"> {{localization.confirm}} </button> </div> </form> ',styles:[".modal-body { padding: 17px; position: relative; text-align: center; } .modal-footer { padding: 10px 5px; text-align: center; border-color: transparent; } .confirm-modal { max-width: 478px; } .confirm-modal>.modal-content { padding: 17px; } h3.confirm-h3 { font-size: 20px; font-weight: bold; } .confirm-btn-group { padding: 0; margin-bottom: 28px; margin-right: 50px; } .confirm-btn-group button { display: inline-block; } .confirm-btn-group button:last-child { background-color: rgb(221, 107, 85); box-shadow: rgba(221, 107, 85, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.05) 0px 0px 0px 1px; } .alertIcon { background: url(assets/img/alert.svg); width: 88px; height: 88px; display: inline-block; } .sweet-alert-btn { color: #fff; border: none; background: #ddd; font-size: 17px; font-weight: 500; border-radius: 5px; padding: 10px 32px; margin: 26px 5px 0; cursor: pointer } "]}),o(0,Object(i.Inject)(a.b))],s)},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var i=n(0),r=n(18),a=n(267),o=function(t,e){return function(n,i){e(n,i,t)}};let s=class{constructor(t){this.localization=t,this._onClosed=new a.Subject}get onClosed(){return this._onClosed}close(){this._onClosed.next(),this._onClosed.complete()}};s=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Component)({selector:"alertModal",template:'<div class="modal-body"> <div style="text-align:center"> <div class="alertIcon"></div> <h3 class="alert-h3">{{alermMessage}}</h3> </div> </div> <div class="modal-footer form-group confirm-btn"> <button type="button" class="sweet-alert-btn" (click)="close()"> {{localization.confirm}} </button> </div> ',styles:[".modal-header { padding: 17px; border-color: transparent; } .modal-body { padding: 17px; position: relative; text-align: center; } .modal-footer { padding: 10px 5px; text-align: center; border-color: transparent; } .alert-modal { max-width: 478px; } .alert-modal>.modal-content { padding: 17px; } h3.alert-h3 { font-size: 20px; font-weight: bold; } .alert-btn { padding: 0; margin-bottom: 0; } .alert-btn button { display: inline-block; } .alertIcon { background: url(assets/img/alert.svg); width: 88px; height: 88px; display: inline-block; } .sweet-alert-btn { color: #fff; border: none; background: #ddd; font-size: 17px; font-weight: 500; border-radius: 5px; padding: 10px 32px; margin: 26px 5px 0; cursor: point; background-color: rgb(221, 107, 85); box-shadow: rgba(221, 107, 85, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.05) 0px 0px 0px 1px; } "]}),o(0,Object(i.Inject)(r.b))],s)},function(t,e,n){"use strict";var i;n.d(e,"a",function(){return i}),function(t){t[t.None=0]="None",t[t.And=1]="And",t[t.Or=2]="Or"}(i||(i={}))},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var i=!1,r={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;i=t},get useDeprecatedSynchronousErrorHandling(){return i}}},function(t,e,n){"use strict";var i=n(55),r=n(271),a=n(51),o=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}();n.d(e,"a",function(){return s});var s=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this._parentOrParents,s=this._unsubscribe,u=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof t)n.remove(this);else if(null!==n)for(var c=0;c<n.length;++c){n[c].remove(this)}if(Object(a.a)(s))try{s.call(this)}catch(t){e=t instanceof o?l(t.errors):[t]}if(Object(i.a)(u)){c=-1;for(var d=u.length;++c<d;){var h=u[c];if(Object(r.a)(h))try{h.unsubscribe()}catch(t){e=e||[],t instanceof o?e=e.concat(l(t.errors)):e.push(t)}}}if(e)throw new o(e)}},t.prototype.add=function(e){var n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var i=n;(n=new t)._subscriptions=[i]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var r=n._parentOrParents;if(null===r)n._parentOrParents=this;else if(r instanceof t){if(r===this)return n;n._parentOrParents=[r,this]}else{if(-1!==r.indexOf(this))return n;r.push(this)}var a=this._subscriptions;return null===a?this._subscriptions=[n]:a.push(n),n},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function l(t){return t.reduce(function(t,e){return t.concat(e instanceof o?e.errors:e)},[])}},function(t,e,n){var i,r;!function(){var a={version:"3.5.12"},o=[].slice,s=function(t){return o.call(t)},l=this.document;function u(t){return t&&(t.ownerDocument||t.document||t).documentElement}function c(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(l)try{s(l.documentElement.childNodes)[0].nodeType}catch(t){s=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),l)try{l.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var d=this.Element.prototype,h=d.setAttribute,f=d.setAttributeNS,m=this.CSSStyleDeclaration.prototype,p=m.setProperty;d.setAttribute=function(t,e){h.call(this,t,e+"")},d.setAttributeNS=function(t,e,n){f.call(this,t,e,n+"")},m.setProperty=function(t,e,n){p.call(this,t,e+"",n)}}function g(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function v(t){return null===t?NaN:+t}function _(t){return!isNaN(t)}function y(t){return{left:function(e,n,i,r){for(arguments.length<3&&(i=0),arguments.length<4&&(r=e.length);i<r;){var a=i+r>>>1;t(e[a],n)<0?i=a+1:r=a}return i},right:function(e,n,i,r){for(arguments.length<3&&(i=0),arguments.length<4&&(r=e.length);i<r;){var a=i+r>>>1;t(e[a],n)>0?r=a:i=a+1}return i}}}a.ascending=g,a.descending=function(t,e){return e<t?-1:e>t?1:e>=t?0:NaN},a.min=function(t,e){var n,i,r=-1,a=t.length;if(1===arguments.length){for(;++r<a;)if(null!=(i=t[r])&&i>=i){n=i;break}for(;++r<a;)null!=(i=t[r])&&n>i&&(n=i)}else{for(;++r<a;)if(null!=(i=e.call(t,t[r],r))&&i>=i){n=i;break}for(;++r<a;)null!=(i=e.call(t,t[r],r))&&n>i&&(n=i)}return n},a.max=function(t,e){var n,i,r=-1,a=t.length;if(1===arguments.length){for(;++r<a;)if(null!=(i=t[r])&&i>=i){n=i;break}for(;++r<a;)null!=(i=t[r])&&i>n&&(n=i)}else{for(;++r<a;)if(null!=(i=e.call(t,t[r],r))&&i>=i){n=i;break}for(;++r<a;)null!=(i=e.call(t,t[r],r))&&i>n&&(n=i)}return n},a.extent=function(t,e){var n,i,r,a=-1,o=t.length;if(1===arguments.length){for(;++a<o;)if(null!=(i=t[a])&&i>=i){n=r=i;break}for(;++a<o;)null!=(i=t[a])&&(n>i&&(n=i),r<i&&(r=i))}else{for(;++a<o;)if(null!=(i=e.call(t,t[a],a))&&i>=i){n=r=i;break}for(;++a<o;)null!=(i=e.call(t,t[a],a))&&(n>i&&(n=i),r<i&&(r=i))}return[n,r]},a.sum=function(t,e){var n,i=0,r=t.length,a=-1;if(1===arguments.length)for(;++a<r;)_(n=+t[a])&&(i+=n);else for(;++a<r;)_(n=+e.call(t,t[a],a))&&(i+=n);return i},a.mean=function(t,e){var n,i=0,r=t.length,a=-1,o=r;if(1===arguments.length)for(;++a<r;)_(n=v(t[a]))?i+=n:--o;else for(;++a<r;)_(n=v(e.call(t,t[a],a)))?i+=n:--o;if(o)return i/o},a.quantile=function(t,e){var n=(t.length-1)*e+1,i=Math.floor(n),r=+t[i-1],a=n-i;return a?r+a*(t[i]-r):r},a.median=function(t,e){var n,i=[],r=t.length,o=-1;if(1===arguments.length)for(;++o<r;)_(n=v(t[o]))&&i.push(n);else for(;++o<r;)_(n=v(e.call(t,t[o],o)))&&i.push(n);if(i.length)return a.quantile(i.sort(g),.5)},a.variance=function(t,e){var n,i,r=t.length,a=0,o=0,s=-1,l=0;if(1===arguments.length)for(;++s<r;)_(n=v(t[s]))&&(o+=(i=n-a)*(n-(a+=i/++l)));else for(;++s<r;)_(n=v(e.call(t,t[s],s)))&&(o+=(i=n-a)*(n-(a+=i/++l)));if(l>1)return o/(l-1)},a.deviation=function(){var t=a.variance.apply(this,arguments);return t?Math.sqrt(t):t};var b=y(g);function M(t){return t.length}a.bisectLeft=b.left,a.bisect=a.bisectRight=b.right,a.bisector=function(t){return y(1===t.length?function(e,n){return g(t(e),n)}:t)},a.shuffle=function(t,e,n){(a=arguments.length)<3&&(n=t.length,a<2&&(e=0));for(var i,r,a=n-e;a;)r=Math.random()*a--|0,i=t[a+e],t[a+e]=t[r+e],t[r+e]=i;return t},a.permute=function(t,e){for(var n=e.length,i=new Array(n);n--;)i[n]=t[e[n]];return i},a.pairs=function(t){for(var e=0,n=t.length-1,i=t[0],r=new Array(n<0?0:n);e<n;)r[e]=[i,i=t[++e]];return r},a.zip=function(){if(!(i=arguments.length))return[];for(var t=-1,e=a.min(arguments,M),n=new Array(e);++t<e;)for(var i,r=-1,o=n[t]=new Array(i);++r<i;)o[r]=arguments[r][t];return n},a.transpose=function(t){return a.zip.apply(a,t)},a.keys=function(t){var e=[];for(var n in t)e.push(n);return e},a.values=function(t){var e=[];for(var n in t)e.push(t[n]);return e},a.entries=function(t){var e=[];for(var n in t)e.push({key:n,value:t[n]});return e},a.merge=function(t){for(var e,n,i,r=t.length,a=-1,o=0;++a<r;)o+=t[a].length;for(n=new Array(o);--r>=0;)for(e=(i=t[r]).length;--e>=0;)n[--o]=i[e];return n};var x=Math.abs;function w(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function k(){this._=Object.create(null)}a.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n==1/0)throw new Error("infinite range");var i,r=[],a=function(t){var e=1;for(;t*e%1;)e*=10;return e}(x(n)),o=-1;if(t*=a,e*=a,(n*=a)<0)for(;(i=t+n*++o)>e;)r.push(i/a);else for(;(i=t+n*++o)<e;)r.push(i/a);return r},a.map=function(t,e){var n=new k;if(t instanceof k)t.forEach(function(t,e){n.set(t,e)});else if(Array.isArray(t)){var i,r=-1,a=t.length;if(1===arguments.length)for(;++r<a;)n.set(r,t[r]);else for(;++r<a;)n.set(e.call(t,i=t[r],r),i)}else for(var o in t)n.set(o,t[o]);return n};var L="__proto__",S="\0";function T(t){return(t+="")===L||t[0]===S?S+t:t}function Y(t){return(t+="")[0]===S?t.slice(1):t}function D(t){return T(t)in this._}function C(t){return(t=T(t))in this._&&delete this._[t]}function E(){var t=[];for(var e in this._)t.push(Y(e));return t}function A(){var t=0;for(var e in this._)++t;return t}function O(){for(var t in this._)return!1;return!0}function j(){this._=Object.create(null)}function N(t){return t}function H(t,e,n){return function(){var i=n.apply(e,arguments);return i===e?t:i}}function V(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,i=P.length;n<i;++n){var r=P[n]+e;if(r in t)return r}}w(k,{has:D,get:function(t){return this._[T(t)]},set:function(t,e){return this._[T(t)]=e},remove:C,keys:E,values:function(){var t=[];for(var e in this._)t.push(this._[e]);return t},entries:function(){var t=[];for(var e in this._)t.push({key:Y(e),value:this._[e]});return t},size:A,empty:O,forEach:function(t){for(var e in this._)t.call(this,Y(e),this._[e])}}),a.nest=function(){var t,e,n={},i=[],r=[];function o(r,a,s){if(s>=i.length)return e?e.call(n,a):t?a.sort(t):a;for(var l,u,c,d,h=-1,f=a.length,m=i[s++],p=new k;++h<f;)(d=p.get(l=m(u=a[h])))?d.push(u):p.set(l,[u]);return r?(u=r(),c=function(t,e){u.set(t,o(r,e,s))}):(u={},c=function(t,e){u[t]=o(r,e,s)}),p.forEach(c),u}return n.map=function(t,e){return o(e,t,0)},n.entries=function(t){return function t(e,n){if(n>=i.length)return e;var a=[],o=r[n++];return e.forEach(function(e,i){a.push({key:e,values:t(i,n)})}),o?a.sort(function(t,e){return o(t.key,e.key)}):a}(o(a.map,t,0),0)},n.key=function(t){return i.push(t),n},n.sortKeys=function(t){return r[i.length-1]=t,n},n.sortValues=function(e){return t=e,n},n.rollup=function(t){return e=t,n},n},a.set=function(t){var e=new j;if(t)for(var n=0,i=t.length;n<i;++n)e.add(t[n]);return e},w(j,{has:D,add:function(t){return this._[T(t+="")]=!0,t},remove:C,values:E,size:A,empty:O,forEach:function(t){for(var e in this._)t.call(this,Y(e))}}),a.behavior={},a.rebind=function(t,e){for(var n,i=1,r=arguments.length;++i<r;)t[n=arguments[i]]=H(t,e,e[n]);return t};var P=["webkit","ms","moz","Moz","o","O"];function F(){}function I(){}function R(t){var e=[],n=new k;function i(){for(var n,i=e,r=-1,a=i.length;++r<a;)(n=i[r].on)&&n.apply(this,arguments);return t}return i.on=function(i,r){var a,o=n.get(i);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,a=e.indexOf(o)).concat(e.slice(a+1)),n.remove(i)),r&&e.push(n.set(i,{on:r})),t)},i}function W(){a.event.preventDefault()}function z(){for(var t,e=a.event;t=e.sourceEvent;)e=t;return e}function B(t){for(var e=new I,n=0,i=arguments.length;++n<i;)e[arguments[n]]=R(e);return e.of=function(n,i){return function(r){try{var o=r.sourceEvent=a.event;r.target=t,a.event=r,e[r.type].apply(n,i)}finally{a.event=o}}},e}a.dispatch=function(){for(var t=new I,e=-1,n=arguments.length;++e<n;)t[arguments[e]]=R(t);return t},I.prototype.on=function(t,e){var n=t.indexOf("."),i="";if(n>=0&&(i=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(i):this[t].on(i,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(i,null);return this}},a.event=null,a.requote=function(t){return t.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,G={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]};function $(t){return G(t,Z),t}var q=function(t,e){return e.querySelector(t)},J=function(t,e){return e.querySelectorAll(t)},X=function(t,e){var n=t.matches||t[V(t,"matchesSelector")];return(X=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(q=function(t,e){return Sizzle(t,e)[0]||null},J=Sizzle,X=Sizzle.matchesSelector),a.selection=function(){return a.select(l.documentElement)};var Z=a.selection.prototype=[];function K(t){return"function"==typeof t?t:function(){return q(t,this)}}function Q(t){return"function"==typeof t?t:function(){return J(t,this)}}Z.select=function(t){var e,n,i,r,a=[];t=K(t);for(var o=-1,s=this.length;++o<s;){a.push(e=[]),e.parentNode=(i=this[o]).parentNode;for(var l=-1,u=i.length;++l<u;)(r=i[l])?(e.push(n=t.call(r,r.__data__,l,o)),n&&"__data__"in r&&(n.__data__=r.__data__)):e.push(null)}return $(a)},Z.selectAll=function(t){var e,n,i=[];t=Q(t);for(var r=-1,a=this.length;++r<a;)for(var o=this[r],l=-1,u=o.length;++l<u;)(n=o[l])&&(i.push(e=s(t.call(n,n.__data__,l,r))),e.parentNode=n);return $(i)};var tt={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function et(t,e){return t=a.ns.qualify(t),null==e?t.local?function(){this.removeAttributeNS(t.space,t.local)}:function(){this.removeAttribute(t)}:"function"==typeof e?t.local?function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}:function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}:t.local?function(){this.setAttributeNS(t.space,t.local,e)}:function(){this.setAttribute(t,e)}}function nt(t){return t.trim().replace(/\s+/g," ")}function it(t){return new RegExp("(?:^|\\s+)"+a.requote(t)+"(?:\\s+|$)","g")}function rt(t){return(t+"").trim().split(/^|\s+/)}function at(t,e){var n=(t=rt(t).map(ot)).length;return"function"==typeof e?function(){for(var i=-1,r=e.apply(this,arguments);++i<n;)t[i](this,r)}:function(){for(var i=-1;++i<n;)t[i](this,e)}}function ot(t){var e=it(t);return function(n,i){if(r=n.classList)return i?r.add(t):r.remove(t);var r=n.getAttribute("class")||"";i?(e.lastIndex=0,e.test(r)||n.setAttribute("class",nt(r+" "+t))):n.setAttribute("class",nt(r.replace(e," ")))}}function st(t,e,n){return null==e?function(){this.style.removeProperty(t)}:"function"==typeof e?function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}:function(){this.style.setProperty(t,e,n)}}function lt(t,e){return null==e?function(){delete this[t]}:"function"==typeof e?function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}:function(){this[t]=e}}function ut(t){return"function"==typeof t?t:(t=a.ns.qualify(t)).local?function(){return this.ownerDocument.createElementNS(t.space,t.local)}:function(){var e=this.ownerDocument,n=this.namespaceURI;return n?e.createElementNS(n,t):e.createElement(t)}}function ct(){var t=this.parentNode;t&&t.removeChild(this)}function dt(t){return{__data__:t}}function ht(t){return function(){return X(this,t)}}function ft(t,e){for(var n=0,i=t.length;n<i;n++)for(var r,a=t[n],o=0,s=a.length;o<s;o++)(r=a[o])&&e(r,o,n);return t}function mt(t){return G(t,pt),t}a.ns={prefix:tt,qualify:function(t){var e=t.indexOf(":"),n=t;return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),tt.hasOwnProperty(n)?{space:tt[n],local:t}:t}},Z.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return(t=a.ns.qualify(t)).local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(et(e,t[e]));return this}return this.each(et(t,e))},Z.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),i=(t=rt(t)).length,r=-1;if(e=n.classList){for(;++r<i;)if(!e.contains(t[r]))return!1}else for(e=n.getAttribute("class");++r<i;)if(!it(t[r]).test(e))return!1;return!0}for(e in t)this.each(at(e,t[e]));return this}return this.each(at(t,e))},Z.style=function(t,e,n){var i=arguments.length;if(i<3){if("string"!=typeof t){for(n in i<2&&(e=""),t)this.each(st(n,t[n],e));return this}if(i<2){var r=this.node();return c(r).getComputedStyle(r,null).getPropertyValue(t)}n=""}return this.each(st(t,e,n))},Z.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(lt(e,t[e]));return this}return this.each(lt(t,e))},Z.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},Z.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},Z.append=function(t){return t=ut(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},Z.insert=function(t,e){return t=ut(t),e=K(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},Z.remove=function(){return this.each(ct)},Z.data=function(t,e){var n,i,r=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(n=this[0]).length);++r<a;)(i=n[r])&&(t[r]=i.__data__);return t}function o(t,n){var i,r,a,o=t.length,c=n.length,d=Math.min(o,c),h=new Array(c),f=new Array(c),m=new Array(o);if(e){var p,g=new k,v=new Array(o);for(i=-1;++i<o;)(r=t[i])&&(g.has(p=e.call(r,r.__data__,i))?m[i]=r:g.set(p,r),v[i]=p);for(i=-1;++i<c;)(r=g.get(p=e.call(n,a=n[i],i)))?!0!==r&&(h[i]=r,r.__data__=a):f[i]=dt(a),g.set(p,!0);for(i=-1;++i<o;)i in v&&!0!==g.get(v[i])&&(m[i]=t[i])}else{for(i=-1;++i<d;)r=t[i],a=n[i],r?(r.__data__=a,h[i]=r):f[i]=dt(a);for(;i<c;++i)f[i]=dt(n[i]);for(;i<o;++i)m[i]=t[i]}f.update=h,f.parentNode=h.parentNode=m.parentNode=t.parentNode,s.push(f),l.push(h),u.push(m)}var s=mt([]),l=$([]),u=$([]);if("function"==typeof t)for(;++r<a;)o(n=this[r],t.call(n,n.parentNode.__data__,r));else for(;++r<a;)o(n=this[r],t);return l.enter=function(){return s},l.exit=function(){return u},l},Z.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},Z.filter=function(t){var e,n,i,r=[];"function"!=typeof t&&(t=ht(t));for(var a=0,o=this.length;a<o;a++){r.push(e=[]),e.parentNode=(n=this[a]).parentNode;for(var s=0,l=n.length;s<l;s++)(i=n[s])&&t.call(i,i.__data__,s,a)&&e.push(i)}return $(r)},Z.order=function(){for(var t=-1,e=this.length;++t<e;)for(var n,i=this[t],r=i.length-1,a=i[r];--r>=0;)(n=i[r])&&(a&&a!==n.nextSibling&&a.parentNode.insertBefore(n,a),a=n);return this},Z.sort=function(t){t=function(t){arguments.length||(t=g);return function(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}}.apply(this,arguments);for(var e=-1,n=this.length;++e<n;)this[e].sort(t);return this.order()},Z.each=function(t){return ft(this,function(e,n,i){t.call(e,e.__data__,n,i)})},Z.call=function(t){var e=s(arguments);return t.apply(e[0]=this,e),this},Z.empty=function(){return!this.node()},Z.node=function(){for(var t=0,e=this.length;t<e;t++)for(var n=this[t],i=0,r=n.length;i<r;i++){var a=n[i];if(a)return a}return null},Z.size=function(){var t=0;return ft(this,function(){++t}),t};var pt=[];function gt(t,e,n){var i="__on"+t,r=t.indexOf("."),o=_t;r>0&&(t=t.slice(0,r));var l=vt.get(t);function u(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}return l&&(t=l,o=yt),r?e?function(){var r=o(e,s(arguments));u.call(this),this.addEventListener(t,this[i]=r,r.$=n),r._=e}:u:e?F:function(){var e,n=new RegExp("^__on([^.]+)"+a.requote(t)+"$");for(var i in this)if(e=i.match(n)){var r=this[i];this.removeEventListener(e[1],r,r.$),delete this[i]}}}a.selection.enter=mt,a.selection.enter.prototype=pt,pt.append=Z.append,pt.empty=Z.empty,pt.node=Z.node,pt.call=Z.call,pt.size=Z.size,pt.select=function(t){for(var e,n,i,r,a,o=[],s=-1,l=this.length;++s<l;){i=(r=this[s]).update,o.push(e=[]),e.parentNode=r.parentNode;for(var u=-1,c=r.length;++u<c;)(a=r[u])?(e.push(i[u]=n=t.call(r.parentNode,a.__data__,u,s)),n.__data__=a.__data__):e.push(null)}return $(o)},pt.insert=function(t,e){return arguments.length<2&&(e=function(t){var e,n;return function(i,r,a){var o,s=t[a].update,l=s.length;for(a!=n&&(n=a,e=0),r>=e&&(e=r+1);!(o=s[e])&&++e<l;);return o}}(this)),Z.insert.call(this,t,e)},a.select=function(t){var e;return"string"==typeof t?(e=[q(t,l)]).parentNode=l.documentElement:(e=[t]).parentNode=u(t),$([e])},a.selectAll=function(t){var e;return"string"==typeof t?(e=s(J(t,l))).parentNode=l.documentElement:(e=s(t)).parentNode=null,$([e])},Z.on=function(t,e,n){var i=arguments.length;if(i<3){if("string"!=typeof t){for(n in i<2&&(e=!1),t)this.each(gt(n,t[n],e));return this}if(i<2)return(i=this.node()["__on"+t])&&i._;n=!1}return this.each(gt(t,e,n))};var vt=a.map({mouseenter:"mouseover",mouseleave:"mouseout"});function _t(t,e){return function(n){var i=a.event;a.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{a.event=i}}}function yt(t,e){var n=_t(t,e);return function(t){var e=t.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||n.call(this,t)}}l&&vt.forEach(function(t){"on"+t in l&&vt.remove(t)});var bt,Mt=0;function xt(t){var e=".dragsuppress-"+ ++Mt,n="click"+e,i=a.select(c(t)).on("touchmove"+e,W).on("dragstart"+e,W).on("selectstart"+e,W);if(null==bt&&(bt=!("onselectstart"in t)&&V(t.style,"userSelect")),bt){var r=u(t).style,o=r[bt];r[bt]="none"}return function(t){if(i.on(e,null),bt&&(r[bt]=o),t){var a=function(){i.on(n,null)};i.on(n,function(){W(),a()},!0),setTimeout(a,0)}}}a.mouse=function(t){return kt(t,z())};var wt=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;function kt(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();if(wt<0){var r=c(t);if(r.scrollX||r.scrollY){var o=(n=a.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();wt=!(o.f||o.e),n.remove()}}return wt?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),[(i=i.matrixTransform(t.getScreenCTM().inverse())).x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function Lt(){return a.event.changedTouches[0].identifier}a.touch=function(t,e,n){if(arguments.length<3&&(n=e,e=z().changedTouches),e)for(var i,r=0,a=e.length;r<a;++r)if((i=e[r]).identifier===n)return kt(t,i)},a.behavior.drag=function(){var t=B(r,"drag","dragstart","dragend"),e=null,n=o(F,a.mouse,c,"mousemove","mouseup"),i=o(Lt,a.touch,N,"touchmove","touchend");function r(){this.on("mousedown.drag",n).on("touchstart.drag",i)}function o(n,i,r,o,s){return function(){var l,u=a.event.target,c=this.parentNode,d=t.of(this,arguments),h=0,f=n(),m=".drag"+(null==f?"":"-"+f),p=a.select(r(u)).on(o+m,function(){var t,e,n=i(c,f);if(!n)return;t=n[0]-v[0],e=n[1]-v[1],h|=t|e,v=n,d({type:"drag",x:n[0]+l[0],y:n[1]+l[1],dx:t,dy:e})}).on(s+m,function(){if(!i(c,f))return;p.on(o+m,null).on(s+m,null),g(h),d({type:"dragend"})}),g=xt(u),v=i(c,f);l=e?[(l=e.apply(this,arguments)).x-v[0],l.y-v[1]]:[0,0],d({type:"dragstart"})}}return r.origin=function(t){return arguments.length?(e=t,r):e},a.rebind(r,t,"on")},a.touches=function(t,e){return arguments.length<2&&(e=z().touches),e?s(e).map(function(e){var n=kt(t,e);return n.identifier=e.identifier,n}):[]};var St=1e-6,Tt=St*St,Yt=Math.PI,Dt=2*Yt,Ct=Dt-St,Et=Yt/2,At=Yt/180,Ot=180/Yt;function jt(t){return t>0?1:t<0?-1:0}function Nt(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function Ht(t){return t>1?0:t<-1?Yt:Math.acos(t)}function Vt(t){return t>1?Et:t<-1?-Et:Math.asin(t)}function Pt(t){return((t=Math.exp(t))+1/t)/2}function Ft(t){return(t=Math.sin(t/2))*t}var It=Math.SQRT2;a.interpolateZoom=function(t,e){var n,i,r=t[0],a=t[1],o=t[2],s=e[0],l=e[1],u=e[2],c=s-r,d=l-a,h=c*c+d*d;if(h<Tt)i=Math.log(u/o)/It,n=function(t){return[r+t*c,a+t*d,o*Math.exp(It*t*i)]};else{var f=Math.sqrt(h),m=(u*u-o*o+4*h)/(2*o*2*f),p=(u*u-o*o-4*h)/(2*u*2*f),g=Math.log(Math.sqrt(m*m+1)-m),v=Math.log(Math.sqrt(p*p+1)-p);i=(v-g)/It,n=function(t){var e=t*i,n=Pt(g),s=o/(2*f)*(n*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(It*e+g)-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[r+s*c,a+s*d,o*n/Pt(It*e+g)]}}return n.duration=1e3*i,n},a.behavior.zoom=function(){var t,e,n,i,r,o,s,u,d,h={x:0,y:0,k:1},f=[960,500],m=zt,p=250,g=0,v="mousedown.zoom",_="mousemove.zoom",y="mouseup.zoom",b="touchstart.zoom",M=B(x,"zoomstart","zoom","zoomend");function x(t){t.on(v,E).on(Wt+".zoom",O).on("dblclick.zoom",j).on(b,A)}function w(t){return[(t[0]-h.x)/h.k,(t[1]-h.y)/h.k]}function k(t){h.k=Math.max(m[0],Math.min(m[1],t))}function L(t,e){e=function(t){return[t[0]*h.k+h.x,t[1]*h.k+h.y]}(e),h.x+=t[0]-e[0],h.y+=t[1]-e[1]}function S(t,n,i,r){t.__chart__={x:h.x,y:h.y,k:h.k},k(Math.pow(2,r)),L(e=n,i),t=a.select(t),p>0&&(t=t.transition().duration(p)),t.call(x.event)}function T(){s&&s.domain(o.range().map(function(t){return(t-h.x)/h.k}).map(o.invert)),d&&d.domain(u.range().map(function(t){return(t-h.y)/h.k}).map(u.invert))}function Y(t){g++||t({type:"zoomstart"})}function D(t){T(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function C(t){--g||(t({type:"zoomend"}),e=null)}function E(){var t=this,e=M.of(t,arguments),n=0,i=a.select(c(t)).on(_,function(){n=1,L(a.mouse(t),r),D(e)}).on(y,function(){i.on(_,null).on(y,null),o(n),C(e)}),r=w(a.mouse(t)),o=xt(t);hs.call(t),Y(e)}function A(){var t,e=this,n=M.of(e,arguments),i={},o=0,s=".zoom-"+a.event.changedTouches[0].identifier,l="touchmove"+s,u="touchend"+s,c=[],d=a.select(e),f=xt(e);function m(){var n=a.touches(e);return t=h.k,n.forEach(function(t){t.identifier in i&&(i[t.identifier]=w(t))}),n}function p(){var t=a.event.target;a.select(t).on(l,g).on(u,_),c.push(t);for(var n=a.event.changedTouches,s=0,d=n.length;s<d;++s)i[n[s].identifier]=null;var f=m(),p=Date.now();if(1===f.length){if(p-r<500){var v=f[0];S(e,v,i[v.identifier],Math.floor(Math.log(h.k)/Math.LN2)+1),W()}r=p}else if(f.length>1){v=f[0];var y=f[1],b=v[0]-y[0],M=v[1]-y[1];o=b*b+M*M}}function g(){var s,l,u,c,d=a.touches(e);hs.call(e);for(var h=0,f=d.length;h<f;++h,c=null)if(u=d[h],c=i[u.identifier]){if(l)break;s=u,l=c}if(c){var m=(m=u[0]-s[0])*m+(m=u[1]-s[1])*m,p=o&&Math.sqrt(m/o);s=[(s[0]+u[0])/2,(s[1]+u[1])/2],l=[(l[0]+c[0])/2,(l[1]+c[1])/2],k(p*t)}r=null,L(s,l),D(n)}function _(){if(a.event.touches.length){for(var t=a.event.changedTouches,e=0,r=t.length;e<r;++e)delete i[t[e].identifier];for(var o in i)return void m()}a.selectAll(c).on(s,null),d.on(v,E).on(b,A),f(),C(n)}p(),Y(n),d.on(v,null).on(b,p)}function O(){var r=M.of(this,arguments);i?clearTimeout(i):(hs.call(this),t=w(e=n||a.mouse(this)),Y(r)),i=setTimeout(function(){i=null,C(r)},50),W(),k(Math.pow(2,.002*Rt())*h.k),L(e,t),D(r)}function j(){var t=a.mouse(this),e=Math.log(h.k)/Math.LN2;S(this,t,w(t),a.event.shiftKey?Math.ceil(e)-1:Math.floor(e)+1)}return Wt||(Wt="onwheel"in l?(Rt=function(){return-a.event.deltaY*(a.event.deltaMode?120:1)},"wheel"):"onmousewheel"in l?(Rt=function(){return a.event.wheelDelta},"mousewheel"):(Rt=function(){return-a.event.detail},"MozMousePixelScroll")),x.event=function(t){t.each(function(){var t=M.of(this,arguments),n=h;ps?a.select(this).transition().each("start.zoom",function(){h=this.__chart__||{x:0,y:0,k:1},Y(t)}).tween("zoom:zoom",function(){var i=f[0],r=f[1],o=e?e[0]:i/2,s=e?e[1]:r/2,l=a.interpolateZoom([(o-h.x)/h.k,(s-h.y)/h.k,i/h.k],[(o-n.x)/n.k,(s-n.y)/n.k,i/n.k]);return function(e){var n=l(e),r=i/n[2];this.__chart__=h={x:o-n[0]*r,y:s-n[1]*r,k:r},D(t)}}).each("interrupt.zoom",function(){C(t)}).each("end.zoom",function(){C(t)}):(this.__chart__=h,Y(t),D(t),C(t))})},x.translate=function(t){return arguments.length?(h={x:+t[0],y:+t[1],k:h.k},T(),x):[h.x,h.y]},x.scale=function(t){return arguments.length?(h={x:h.x,y:h.y,k:null},k(+t),T(),x):h.k},x.scaleExtent=function(t){return arguments.length?(m=null==t?zt:[+t[0],+t[1]],x):m},x.center=function(t){return arguments.length?(n=t&&[+t[0],+t[1]],x):n},x.size=function(t){return arguments.length?(f=t&&[+t[0],+t[1]],x):f},x.duration=function(t){return arguments.length?(p=+t,x):p},x.x=function(t){return arguments.length?(s=t,o=t.copy(),h={x:0,y:0,k:1},x):s},x.y=function(t){return arguments.length?(d=t,u=t.copy(),h={x:0,y:0,k:1},x):d},a.rebind(x,M,"on")};var Rt,Wt,zt=[0,1/0];function Bt(){}function Ut(t,e,n){return this instanceof Ut?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof Ut?new Ut(t.h,t.s,t.l):fe(""+t,me,Ut):new Ut(t,e,n)}a.color=Bt,Bt.prototype.toString=function(){return this.rgb()+""},a.hsl=Ut;var Gt=Ut.prototype=new Bt;function $t(t,e,n){var i,r;function a(t){return Math.round(255*function(t){return t>360?t-=360:t<0&&(t+=360),t<60?i+(r-i)*t/60:t<180?r:t<240?i+(r-i)*(240-t)/60:i}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,i=2*(n=n<0?0:n>1?1:n)-(r=n<=.5?n*(1+e):n+e-n*e),new le(a(t+120),a(t),a(t-120))}function qt(t,e,n){return this instanceof qt?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof qt?new qt(t.h,t.c,t.l):re(t instanceof Zt?t.l:(t=pe((t=a.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new qt(t,e,n)}Gt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ut(this.h,this.s,this.l/t)},Gt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ut(this.h,this.s,t*this.l)},Gt.rgb=function(){return $t(this.h,this.s,this.l)},a.hcl=qt;var Jt=qt.prototype=new Bt;function Xt(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Zt(n,Math.cos(t*=At)*e,Math.sin(t)*e)}function Zt(t,e,n){return this instanceof Zt?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof Zt?new Zt(t.l,t.a,t.b):t instanceof qt?Xt(t.h,t.c,t.l):pe((t=le(t)).r,t.g,t.b):new Zt(t,e,n)}Jt.brighter=function(t){return new qt(this.h,this.c,Math.min(100,this.l+Kt*(arguments.length?t:1)))},Jt.darker=function(t){return new qt(this.h,this.c,Math.max(0,this.l-Kt*(arguments.length?t:1)))},Jt.rgb=function(){return Xt(this.h,this.c,this.l).rgb()},a.lab=Zt;var Kt=18,Qt=.95047,te=1,ee=1.08883,ne=Zt.prototype=new Bt;function ie(t,e,n){var i=(t+16)/116,r=i+e/500,a=i-n/200;return new le(se(3.2404542*(r=ae(r)*Qt)-1.5371385*(i=ae(i)*te)-.4985314*(a=ae(a)*ee)),se(-.969266*r+1.8760108*i+.041556*a),se(.0556434*r-.2040259*i+1.0572252*a))}function re(t,e,n){return t>0?new qt(Math.atan2(n,e)*Ot,Math.sqrt(e*e+n*n),t):new qt(NaN,NaN,t)}function ae(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function oe(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function se(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function le(t,e,n){return this instanceof le?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof le?new le(t.r,t.g,t.b):fe(""+t,le,$t):new le(t,e,n)}function ue(t){return new le(t>>16,t>>8&255,255&t)}function ce(t){return ue(t)+""}ne.brighter=function(t){return new Zt(Math.min(100,this.l+Kt*(arguments.length?t:1)),this.a,this.b)},ne.darker=function(t){return new Zt(Math.max(0,this.l-Kt*(arguments.length?t:1)),this.a,this.b)},ne.rgb=function(){return ie(this.l,this.a,this.b)},a.rgb=le;var de=le.prototype=new Bt;function he(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function fe(t,e,n){var i,r,a,o=0,s=0,l=0;if(i=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(r=i[2].split(","),i[1]){case"hsl":return n(parseFloat(r[0]),parseFloat(r[1])/100,parseFloat(r[2])/100);case"rgb":return e(ve(r[0]),ve(r[1]),ve(r[2]))}return(a=_e.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function me(t,e,n){var i,r,a=Math.min(t/=255,e/=255,n/=255),o=Math.max(t,e,n),s=o-a,l=(o+a)/2;return s?(r=l<.5?s/(o+a):s/(2-o-a),i=t==o?(e-n)/s+(e<n?6:0):e==o?(n-t)/s+2:(t-e)/s+4,i*=60):(i=NaN,r=l>0&&l<1?0:i),new Ut(i,r,l)}function pe(t,e,n){var i=oe((.4124564*(t=ge(t))+.3575761*(e=ge(e))+.1804375*(n=ge(n)))/Qt),r=oe((.2126729*t+.7151522*e+.072175*n)/te);return Zt(116*r-16,500*(i-r),200*(r-oe((.0193339*t+.119192*e+.9503041*n)/ee)))}function ge(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ve(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}de.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,n=this.g,i=this.b,r=30;return e||n||i?(e&&e<r&&(e=r),n&&n<r&&(n=r),i&&i<r&&(i=r),new le(Math.min(255,e/t),Math.min(255,n/t),Math.min(255,i/t))):new le(r,r,r)},de.darker=function(t){return new le((t=Math.pow(.7,arguments.length?t:1))*this.r,t*this.g,t*this.b)},de.hsl=function(){return me(this.r,this.g,this.b)},de.toString=function(){return"#"+he(this.r)+he(this.g)+he(this.b)};var _e=a.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});function ye(t){return"function"==typeof t?t:function(){return t}}function be(t){return function(e,n,i){return 2===arguments.length&&"function"==typeof n&&(i=n,n=null),Me(e,n,t,i)}}function Me(t,e,n,i){var r={},o=a.dispatch("beforesend","progress","load","error"),l={},u=new XMLHttpRequest,c=null;function d(){var t,e=u.status;if(!e&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(u)||e>=200&&e<300||304===e){try{t=n.call(r,u)}catch(t){return void o.error.call(r,t)}o.load.call(r,t)}else o.error.call(r,u)}return!this.XDomainRequest||"withCredentials"in u||!/^(http(s)?:)?\/\//.test(t)||(u=new XDomainRequest),"onload"in u?u.onload=u.onerror=d:u.onreadystatechange=function(){u.readyState>3&&d()},u.onprogress=function(t){var e=a.event;a.event=t;try{o.progress.call(r,u)}finally{a.event=e}},r.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?l[t]:(null==e?delete l[t]:l[t]=e+"",r)},r.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",r):e},r.responseType=function(t){return arguments.length?(c=t,r):c},r.response=function(t){return n=t,r},["get","post"].forEach(function(t){r[t]=function(){return r.send.apply(r,[t].concat(s(arguments)))}}),r.send=function(n,i,a){if(2===arguments.length&&"function"==typeof i&&(a=i,i=null),u.open(n,t,!0),null==e||"accept"in l||(l.accept=e+",*/*"),u.setRequestHeader)for(var s in l)u.setRequestHeader(s,l[s]);return null!=e&&u.overrideMimeType&&u.overrideMimeType(e),null!=c&&(u.responseType=c),null!=a&&r.on("error",a).on("load",function(t){a(null,t)}),o.beforesend.call(r,u),u.send(null==i?null:i),r},r.abort=function(){return u.abort(),r},a.rebind(r,o,"on"),null==i?r:r.get(function(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}(i))}_e.forEach(function(t,e){_e.set(t,ue(e))}),a.functor=ye,a.xhr=be(N),a.dsv=function(t,e){var n=new RegExp('["'+t+"\n]"),i=t.charCodeAt(0);function r(t,n,i){arguments.length<3&&(i=n,n=null);var r=Me(t,e,null==n?a:o(n),i);return r.row=function(t){return arguments.length?r.response(null==(n=t)?a:o(t)):n},r}function a(t){return r.parse(t.responseText)}function o(t){return function(e){return r.parse(e.responseText,t)}}function s(e){return e.map(l).join(t)}function l(t){return n.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return r.parse=function(t,e){var n;return r.parseRows(t,function(t,i){if(n)return n(t,i-1);var r=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");n=e?function(t,n){return e(r(t),n)}:r})},r.parseRows=function(t,e){var n,r,a={},o={},s=[],l=t.length,u=0,c=0;function d(){if(u>=l)return o;if(r)return r=!1,a;var e=u;if(34===t.charCodeAt(e)){for(var n=e;n++<l;)if(34===t.charCodeAt(n)){if(34!==t.charCodeAt(n+1))break;++n}return u=n+2,13===(s=t.charCodeAt(n+1))?(r=!0,10===t.charCodeAt(n+2)&&++u):10===s&&(r=!0),t.slice(e+1,n).replace(/""/g,'"')}for(;u<l;){var s,c=1;if(10===(s=t.charCodeAt(u++)))r=!0;else if(13===s)r=!0,10===t.charCodeAt(u)&&(++u,++c);else if(s!==i)continue;return t.slice(e,u-c)}return t.slice(e)}for(;(n=d())!==o;){for(var h=[];n!==a&&n!==o;)h.push(n),n=d();e&&null==(h=e(h,c++))||s.push(h)}return s},r.format=function(e){if(Array.isArray(e[0]))return r.formatRows(e);var n=new j,i=[];return e.forEach(function(t){for(var e in t)n.has(e)||i.push(n.add(e))}),[i.map(l).join(t)].concat(e.map(function(e){return i.map(function(t){return l(e[t])}).join(t)})).join("\n")},r.formatRows=function(t){return t.map(s).join("\n")},r},a.csv=a.dsv(",","text/csv"),a.tsv=a.dsv("\t","text/tab-separated-values");var xe,we,ke,Le,Se=this[V(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};function Te(t,e,n){var i=arguments.length;i<2&&(e=0),i<3&&(n=Date.now());var r={c:t,t:n+e,n:null};return we?we.n=r:xe=r,we=r,ke||(Le=clearTimeout(Le),ke=1,Se(Ye)),r}function Ye(){var t=De(),e=Ce()-t;e>24?(isFinite(e)&&(clearTimeout(Le),Le=setTimeout(Ye,e)),ke=0):(ke=1,Se(Ye))}function De(){for(var t=Date.now(),e=xe;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ce(){for(var t,e=xe,n=1/0;e;)e.c?(e.t<n&&(n=e.t),e=(t=e).n):e=t?t.n=e.n:xe=e.n;return we=t,n}function Ee(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)}a.timer=function(){Te.apply(this,arguments)},a.timer.flush=function(){De(),Ce()},a.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var Ae=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(function(t,e){var n=Math.pow(10,3*x(8-e));return{scale:e>8?function(t){return t/n}:function(t){return t*n},symbol:t}});a.formatPrefix=function(t,e){var n=0;return(t=+t)&&(t<0&&(t*=-1),e&&(t=a.round(t,Ee(t,e))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Ae[8+n/3]};var Oe=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,je=a.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=a.round(t,Ee(t,e))).toFixed(Math.max(0,Math.min(20,Ee(t*(1+1e-15),e))))}});function Ne(t){return t+""}var He=a.time={},Ve=Date;function Pe(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Pe.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Fe.setUTCDate.apply(this._,arguments)},setDay:function(){Fe.setUTCDay.apply(this._,arguments)},setFullYear:function(){Fe.setUTCFullYear.apply(this._,arguments)},setHours:function(){Fe.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Fe.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Fe.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Fe.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Fe.setUTCSeconds.apply(this._,arguments)},setTime:function(){Fe.setTime.apply(this._,arguments)}};var Fe=Date.prototype;function Ie(t,e,n){function i(e){var n=t(e),i=a(n,1);return e-n<i-e?n:i}function r(n){return e(n=t(new Ve(n-1)),1),n}function a(t,n){return e(t=new Ve(+t),n),t}function o(t,i,a){var o=r(t),s=[];if(a>1)for(;o<i;)n(o)%a||s.push(new Date(+o)),e(o,1);else for(;o<i;)s.push(new Date(+o)),e(o,1);return s}t.floor=t,t.round=i,t.ceil=r,t.offset=a,t.range=o;var s=t.utc=Re(t);return s.floor=s,s.round=Re(i),s.ceil=Re(r),s.offset=Re(a),s.range=function(t,e,n){try{Ve=Pe;var i=new Pe;return i._=t,o(i,e,n)}finally{Ve=Date}},t}function Re(t){return function(e,n){try{Ve=Pe;var i=new Pe;return i._=e,t(i,n)._}finally{Ve=Date}}}He.year=Ie(function(t){return(t=He.day(t)).setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),He.years=He.year.range,He.years.utc=He.year.utc.range,He.day=Ie(function(t){var e=new Ve(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),He.days=He.day.range,He.days.utc=He.day.utc.range,He.dayOfYear=function(t){var e=He.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=He[t]=Ie(function(t){return(t=He.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=He.year(t).getDay();return Math.floor((He.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});He[t+"s"]=n.range,He[t+"s"].utc=n.utc.range,He[t+"OfYear"]=function(t){var n=He.year(t).getDay();return Math.floor((He.dayOfYear(t)+(n+e)%7)/7)}}),He.week=He.sunday,He.weeks=He.sunday.range,He.weeks.utc=He.sunday.utc.range,He.weekOfYear=He.sundayOfYear;var We={"-":"",_:" ",0:"0"},ze=/^\s*\d+/,Be=/^%/;function Ue(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",a=r.length;return i+(a<n?new Array(n-a+1).join(e)+r:r)}function Ge(t){return new RegExp("^(?:"+t.map(a.requote).join("|")+")","i")}function $e(t){for(var e=new k,n=-1,i=t.length;++n<i;)e.set(t[n].toLowerCase(),n);return e}function qe(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function Je(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n));return i?(t.U=+i[0],n+i[0].length):-1}function Xe(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n));return i?(t.W=+i[0],n+i[0].length):-1}function Ze(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function Ke(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.y=function(t){return t+(t>68?1900:2e3)}(+i[0]),n+i[0].length):-1}function Qe(t,e,n){return/^[+-]\d{4}$/.test(e=e.slice(n,n+5))?(t.Z=-e,n+5):-1}function tn(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function en(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function nn(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+3));return i?(t.j=+i[0],n+i[0].length):-1}function rn(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function an(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function on(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function sn(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function ln(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",i=x(e)/60|0,r=x(e)%60;return n+Ue(i,"0",2)+Ue(r,"0",2)}function un(t,e,n){Be.lastIndex=0;var i=Be.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function cn(t){for(var e=t.length,n=-1;++n<e;)t[n][0]=this(t[n][0]);return function(e){for(var n=0,i=t[n];!i[1](e);)i=t[++n];return i[0](e)}}a.locale=function(t){return{numberFormat:function(t){var e=t.decimal,n=t.thousands,i=t.grouping,r=t.currency,o=i&&n?function(t,e){for(var r=t.length,a=[],o=0,s=i[0],l=0;r>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(r-=s,r+s)),!((l+=s+1)>e));)s=i[o=(o+1)%i.length];return a.reverse().join(n)}:N;return function(t){var n=Oe.exec(t),i=n[1]||" ",s=n[2]||">",l=n[3]||"-",u=n[4]||"",c=n[5],d=+n[6],h=n[7],f=n[8],m=n[9],p=1,g="",v="",_=!1,y=!0;switch(f&&(f=+f.substring(1)),(c||"0"===i&&"="===s)&&(c=i="0",s="="),m){case"n":h=!0,m="g";break;case"%":p=100,v="%",m="f";break;case"p":p=100,v="%",m="r";break;case"b":case"o":case"x":case"X":"#"===u&&(g="0"+m.toLowerCase());case"c":y=!1;case"d":_=!0,f=0;break;case"s":p=-1,m="r"}"$"===u&&(g=r[0],v=r[1]),"r"!=m||f||(m="g"),null!=f&&("g"==m?f=Math.max(1,Math.min(21,f)):"e"!=m&&"f"!=m||(f=Math.max(0,Math.min(20,f)))),m=je.get(m)||Ne;var b=c&&h;return function(t){var n=v;if(_&&t%1)return"";var r=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===l?"":l;if(p<0){var u=a.formatPrefix(t,f);t=u.scale(t),n=u.symbol+v}else t*=p;var M,x,w=(t=m(t,f)).lastIndexOf(".");if(w<0){var k=y?t.lastIndexOf("e"):-1;k<0?(M=t,x=""):(M=t.substring(0,k),x=t.substring(k))}else M=t.substring(0,w),x=e+t.substring(w+1);!c&&h&&(M=o(M,1/0));var L=g.length+M.length+x.length+(b?0:r.length),S=L<d?new Array(L=d-L+1).join(i):"";return b&&(M=o(S+M,S.length?d-x.length:1/0)),r+=g,t=M+x,("<"===s?r+t+S:">"===s?S+r+t:"^"===s?S.substring(0,L>>=1)+r+t+S.substring(L):r+(b?t:S+t))+n}}}(t),timeFormat:function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,s=t.shortDays,l=t.months,u=t.shortMonths;function c(t){var e=t.length;function n(n){for(var i,r,a,o=[],s=-1,l=0;++s<e;)37===t.charCodeAt(s)&&(o.push(t.slice(l,s)),null!=(r=We[i=t.charAt(++s)])&&(i=t.charAt(++s)),(a=M[i])&&(i=a(n,null==r?"e"===i?" ":"0":r)),o.push(i),l=s+1);return o.push(t.slice(l,s)),o.join("")}return n.parse=function(e){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null};if(d(n,t,e,0)!=e.length)return null;"p"in n&&(n.H=n.H%12+12*n.p);var i=null!=n.Z&&Ve!==Pe,r=new(i?Pe:Ve);return"j"in n?r.setFullYear(n.y,0,n.j):"W"in n||"U"in n?("w"in n||(n.w="W"in n?1:0),r.setFullYear(n.y,0,1),r.setFullYear(n.y,0,"W"in n?(n.w+6)%7+7*n.W-(r.getDay()+5)%7:n.w+7*n.U-(r.getDay()+6)%7)):r.setFullYear(n.y,n.m,n.d),r.setHours(n.H+(n.Z/100|0),n.M+n.Z%100,n.S,n.L),i?r._:r},n.toString=function(){return t},n}function d(t,e,n,i){for(var r,a,o,s=0,l=e.length,u=n.length;s<l;){if(i>=u)return-1;if(37===(r=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=x[o in We?e.charAt(s++):o])||(i=a(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}c.utc=function(t){var e=c(t);function n(t){try{var n=new(Ve=Pe);return n._=t,e(n)}finally{Ve=Date}}return n.parse=function(t){try{Ve=Pe;var n=e.parse(t);return n&&n._}finally{Ve=Date}},n.toString=e.toString,n},c.multi=c.utc.multi=cn;var h=a.map(),f=Ge(o),m=$e(o),p=Ge(s),g=$e(s),v=Ge(l),_=$e(l),y=Ge(u),b=$e(u);r.forEach(function(t,e){h.set(t.toLowerCase(),e)});var M={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return l[t.getMonth()]},c:c(e),d:function(t,e){return Ue(t.getDate(),e,2)},e:function(t,e){return Ue(t.getDate(),e,2)},H:function(t,e){return Ue(t.getHours(),e,2)},I:function(t,e){return Ue(t.getHours()%12||12,e,2)},j:function(t,e){return Ue(1+He.dayOfYear(t),e,3)},L:function(t,e){return Ue(t.getMilliseconds(),e,3)},m:function(t,e){return Ue(t.getMonth()+1,e,2)},M:function(t,e){return Ue(t.getMinutes(),e,2)},p:function(t){return r[+(t.getHours()>=12)]},S:function(t,e){return Ue(t.getSeconds(),e,2)},U:function(t,e){return Ue(He.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ue(He.mondayOfYear(t),e,2)},x:c(n),X:c(i),y:function(t,e){return Ue(t.getFullYear()%100,e,2)},Y:function(t,e){return Ue(t.getFullYear()%1e4,e,4)},Z:ln,"%":function(){return"%"}},x={a:function(t,e,n){p.lastIndex=0;var i=p.exec(e.slice(n));return i?(t.w=g.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){f.lastIndex=0;var i=f.exec(e.slice(n));return i?(t.w=m.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){y.lastIndex=0;var i=y.exec(e.slice(n));return i?(t.m=b.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){v.lastIndex=0;var i=v.exec(e.slice(n));return i?(t.m=_.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,e,n){return d(t,M.c.toString(),e,n)},d:en,e:en,H:rn,I:rn,j:nn,L:sn,m:tn,M:an,p:function(t,e,n){var i=h.get(e.slice(n,n+=2).toLowerCase());return null==i?-1:(t.p=i,n)},S:on,U:Je,w:qe,W:Xe,x:function(t,e,n){return d(t,M.x.toString(),e,n)},X:function(t,e,n){return d(t,M.X.toString(),e,n)},y:Ke,Y:Ze,Z:Qe,"%":un};return c}(t)}};var dn=a.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function hn(){}a.format=dn.numberFormat,a.geo={},hn.prototype={s:0,t:0,add:function(t){mn(t,this.t,fn),mn(fn.s,this.s,this),this.s?this.t+=fn.t:this.s=fn.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var fn=new hn;function mn(t,e,n){var i=n.s=t+e,r=i-t,a=i-r;n.t=t-a+(e-r)}function pn(t,e){t&&vn.hasOwnProperty(t.type)&&vn[t.type](t,e)}a.geo.stream=function(t,e){t&&gn.hasOwnProperty(t.type)?gn[t.type](t,e):pn(t,e)};var gn={Feature:function(t,e){pn(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,r=n.length;++i<r;)pn(n[i].geometry,e)}},vn={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,i=-1,r=n.length;++i<r;)t=n[i],e.point(t[0],t[1],t[2])},LineString:function(t,e){_n(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,i=-1,r=n.length;++i<r;)_n(n[i],e,0)},Polygon:function(t,e){yn(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,i=-1,r=n.length;++i<r;)yn(n[i],e)},GeometryCollection:function(t,e){for(var n=t.geometries,i=-1,r=n.length;++i<r;)pn(n[i],e)}};function _n(t,e,n){var i,r=-1,a=t.length-n;for(e.lineStart();++r<a;)i=t[r],e.point(i[0],i[1],i[2]);e.lineEnd()}function yn(t,e){var n=-1,i=t.length;for(e.polygonStart();++n<i;)_n(t[n],e,1);e.polygonEnd()}a.geo.area=function(t){return bn=0,a.geo.stream(t,On),bn};var bn,Mn,xn,wn,kn,Ln,Sn,Tn,Yn,Dn,Cn,En,An=new hn,On={sphere:function(){bn+=4*Yt},point:F,lineStart:F,lineEnd:F,polygonStart:function(){An.reset(),On.lineStart=jn},polygonEnd:function(){var t=2*An;bn+=t<0?4*Yt+t:t,On.lineStart=On.lineEnd=On.point=F}};function jn(){var t,e,n,i,r;function a(t,e){e=e*At/2+Yt/4;var a=(t*=At)-n,o=a>=0?1:-1,s=o*a,l=Math.cos(e),u=Math.sin(e),c=r*u,d=i*l+c*Math.cos(s),h=c*o*Math.sin(s);An.add(Math.atan2(h,d)),n=t,i=l,r=u}On.point=function(o,s){On.point=a,n=(t=o)*At,i=Math.cos(s=(e=s)*At/2+Yt/4),r=Math.sin(s)},On.lineEnd=function(){a(t,e)}}function Nn(t){var e=t[0],n=t[1],i=Math.cos(n);return[i*Math.cos(e),i*Math.sin(e),Math.sin(n)]}function Hn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Vn(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Pn(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Fn(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function In(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Rn(t){return[Math.atan2(t[1],t[0]),Vt(t[2])]}function Wn(t,e){return x(t[0]-e[0])<St&&x(t[1]-e[1])<St}a.geo.bounds=function(){var t,e,n,i,r,o,s,l,u,c,d,h={point:f,lineStart:p,lineEnd:g,polygonStart:function(){h.point=v,h.lineStart=_,h.lineEnd=y,u=0,On.polygonStart()},polygonEnd:function(){On.polygonEnd(),h.point=f,h.lineStart=p,h.lineEnd=g,An<0?(t=-(n=180),e=-(i=90)):u>St?i=90:u<-St&&(e=-90),d[0]=t,d[1]=n}};function f(r,a){c.push(d=[t=r,n=r]),a<e&&(e=a),a>i&&(i=a)}function m(a,o){var s=Nn([a*At,o*At]);if(l){var u=Vn(l,s),c=Vn([u[1],-u[0],0],u);In(c),c=Rn(c);var d=a-r,h=d>0?1:-1,m=c[0]*Ot*h,p=x(d)>180;if(p^(h*r<m&&m<h*a))(g=c[1]*Ot)>i&&(i=g);else if(p^(h*r<(m=(m+360)%360-180)&&m<h*a)){var g;(g=-c[1]*Ot)<e&&(e=g)}else o<e&&(e=o),o>i&&(i=o);p?a<r?b(t,a)>b(t,n)&&(n=a):b(a,n)>b(t,n)&&(t=a):n>=t?(a<t&&(t=a),a>n&&(n=a)):a>r?b(t,a)>b(t,n)&&(n=a):b(a,n)>b(t,n)&&(t=a)}else f(a,o);l=s,r=a}function p(){h.point=m}function g(){d[0]=t,d[1]=n,h.point=f,l=null}function v(t,e){if(l){var n=t-r;u+=x(n)>180?n+(n>0?360:-360):n}else o=t,s=e;On.point(t,e),m(t,e)}function _(){On.lineStart()}function y(){v(o,s),On.lineEnd(),x(u)>St&&(t=-(n=180)),d[0]=t,d[1]=n,l=null}function b(t,e){return(e-=t)<0?e+360:e}function M(t,e){return t[0]-e[0]}function w(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}return function(r){if(i=n=-(t=e=1/0),c=[],a.geo.stream(r,h),u=c.length){c.sort(M);for(var o=1,s=[p=c[0]];o<u;++o)w((f=c[o])[0],p)||w(f[1],p)?(b(p[0],f[1])>b(p[0],p[1])&&(p[1]=f[1]),b(f[0],p[1])>b(p[0],p[1])&&(p[0]=f[0])):s.push(p=f);for(var l,u,f,m=-1/0,p=(o=0,s[u=s.length-1]);o<=u;p=f,++o)f=s[o],(l=b(p[1],f[0]))>m&&(m=l,t=f[0],n=p[1])}return c=d=null,t===1/0||e===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,e],[n,i]]}}(),a.geo.centroid=function(t){Mn=xn=wn=kn=Ln=Sn=Tn=Yn=Dn=Cn=En=0,a.geo.stream(t,zn);var e=Dn,n=Cn,i=En,r=e*e+n*n+i*i;return r<Tt&&(e=Sn,n=Tn,i=Yn,xn<St&&(e=wn,n=kn,i=Ln),(r=e*e+n*n+i*i)<Tt)?[NaN,NaN]:[Math.atan2(n,e)*Ot,Vt(i/Math.sqrt(r))*Ot]};var zn={sphere:F,point:Bn,lineStart:Gn,lineEnd:$n,polygonStart:function(){zn.lineStart=qn},polygonEnd:function(){zn.lineStart=Gn}};function Bn(t,e){t*=At;var n=Math.cos(e*=At);Un(n*Math.cos(t),n*Math.sin(t),Math.sin(e))}function Un(t,e,n){wn+=(t-wn)/++Mn,kn+=(e-kn)/Mn,Ln+=(n-Ln)/Mn}function Gn(){var t,e,n;function i(i,r){i*=At;var a=Math.cos(r*=At),o=a*Math.cos(i),s=a*Math.sin(i),l=Math.sin(r),u=Math.atan2(Math.sqrt((u=e*l-n*s)*u+(u=n*o-t*l)*u+(u=t*s-e*o)*u),t*o+e*s+n*l);xn+=u,Sn+=u*(t+(t=o)),Tn+=u*(e+(e=s)),Yn+=u*(n+(n=l)),Un(t,e,n)}zn.point=function(r,a){r*=At;var o=Math.cos(a*=At);t=o*Math.cos(r),e=o*Math.sin(r),n=Math.sin(a),zn.point=i,Un(t,e,n)}}function $n(){zn.point=Bn}function qn(){var t,e,n,i,r;function a(t,e){t*=At;var a=Math.cos(e*=At),o=a*Math.cos(t),s=a*Math.sin(t),l=Math.sin(e),u=i*l-r*s,c=r*o-n*l,d=n*s-i*o,h=Math.sqrt(u*u+c*c+d*d),f=n*o+i*s+r*l,m=h&&-Ht(f)/h,p=Math.atan2(h,f);Dn+=m*u,Cn+=m*c,En+=m*d,xn+=p,Sn+=p*(n+(n=o)),Tn+=p*(i+(i=s)),Yn+=p*(r+(r=l)),Un(n,i,r)}zn.point=function(o,s){t=o,e=s,zn.point=a,o*=At;var l=Math.cos(s*=At);n=l*Math.cos(o),i=l*Math.sin(o),r=Math.sin(s),Un(n,i,r)},zn.lineEnd=function(){a(t,e),zn.lineEnd=$n,zn.point=Bn}}function Jn(t,e){function n(n,i){return n=t(n,i),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,i){return(n=e.invert(n,i))&&t.invert(n[0],n[1])}),n}function Xn(){return!0}function Zn(t,e,n,i,r){var a=[],o=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n=t[0],i=t[e];if(Wn(n,i)){r.lineStart();for(var s=0;s<e;++s)r.point((n=t[s])[0],n[1]);r.lineEnd()}else{var l=new Qn(n,t,null,!0),u=new Qn(n,null,l,!1);l.o=u,a.push(l),o.push(u),u=new Qn(i,null,l=new Qn(i,t,null,!1),!0),l.o=u,a.push(l),o.push(u)}}}),o.sort(e),Kn(a),Kn(o),a.length){for(var s=0,l=n,u=o.length;s<u;++s)o[s].e=l=!l;for(var c,d,h=a[0];;){for(var f=h,m=!0;f.v;)if((f=f.n)===h)return;c=f.z,r.lineStart();do{if(f.v=f.o.v=!0,f.e){if(m)for(s=0,u=c.length;s<u;++s)r.point((d=c[s])[0],d[1]);else i(f.x,f.n.x,1,r);f=f.n}else{if(m)for(s=(c=f.p.z).length-1;s>=0;--s)r.point((d=c[s])[0],d[1]);else i(f.x,f.p.x,-1,r);f=f.p}c=(f=f.o).z,m=!m}while(!f.v);r.lineEnd()}}}function Kn(t){if(e=t.length){for(var e,n,i=0,r=t[0];++i<e;)r.n=n=t[i],n.p=r,r=n;r.n=n=t[0],n.p=r}}function Qn(t,e,n,i){this.x=t,this.z=e,this.o=n,this.e=i,this.v=!1,this.n=this.p=null}function ti(t,e,n,i){return function(r,o){var s,l=e(o),u=r.invert(i[0],i[1]),c={point:d,lineStart:f,lineEnd:m,polygonStart:function(){c.point=b,c.lineStart=M,c.lineEnd=x,s=[],p=[]},polygonEnd:function(){c.point=d,c.lineStart=f,c.lineEnd=m,s=a.merge(s);var t=function(t,e){var n=t[0],i=t[1],r=[Math.sin(n),-Math.cos(n),0],a=0,o=0;An.reset();for(var s=0,l=e.length;s<l;++s){var u=e[s],c=u.length;if(c)for(var d=u[0],h=d[0],f=d[1]/2+Yt/4,m=Math.sin(f),p=Math.cos(f),g=1;;){g===c&&(g=0);var v=(t=u[g])[0],_=t[1]/2+Yt/4,y=Math.sin(_),b=Math.cos(_),M=v-h,x=M>=0?1:-1,w=x*M,k=w>Yt,L=m*y;if(An.add(Math.atan2(L*x*Math.sin(w),p*b+L*Math.cos(w))),a+=k?M+x*Dt:M,k^h>=n^v>=n){var S=Vn(Nn(d),Nn(t));In(S);var T=Vn(r,S);In(T);var Y=(k^M>=0?-1:1)*Vt(T[2]);(i>Y||i===Y&&(S[0]||S[1]))&&(o+=k^M>=0?1:-1)}if(!g++)break;h=v,m=y,p=b,d=t}}return(a<-St||a<St&&An<0)^1&o}(u,p);s.length?(y||(o.polygonStart(),y=!0),Zn(s,ii,t,n,o)):t&&(y||(o.polygonStart(),y=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),y&&(o.polygonEnd(),y=!1),s=p=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(e,n){var i=r(e,n);t(e=i[0],n=i[1])&&o.point(e,n)}function h(t,e){var n=r(t,e);l.point(n[0],n[1])}function f(){c.point=h,l.lineStart()}function m(){c.point=d,l.lineEnd()}var p,g,v=ni(),_=e(v),y=!1;function b(t,e){g.push([t,e]);var n=r(t,e);_.point(n[0],n[1])}function M(){_.lineStart(),g=[]}function x(){b(g[0][0],g[0][1]),_.lineEnd();var t,e=_.clean(),n=v.buffer(),i=n.length;if(g.pop(),p.push(g),g=null,i)if(1&e){var r,a=-1;if((i=(t=n[0]).length-1)>0){for(y||(o.polygonStart(),y=!0),o.lineStart();++a<i;)o.point((r=t[a])[0],r[1]);o.lineEnd()}}else i>1&&2&e&&n.push(n.pop().concat(n.shift())),s.push(n.filter(ei))}return c}}function ei(t){return t.length>1}function ni(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:F,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function ii(t,e){return((t=t.x)[0]<0?t[1]-Et-St:Et-t[1])-((e=e.x)[0]<0?e[1]-Et-St:Et-e[1])}var ri=ti(Xn,function(t){var e,n=NaN,i=NaN,r=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?Yt:-Yt,l=x(a-n);x(l-Yt)<St?(t.point(n,i=(i+o)/2>0?Et:-Et),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(s,i),t.point(a,i),e=0):r!==s&&l>=Yt&&(x(n-r)<St&&(n-=r*St),x(a-s)<St&&(a-=s*St),i=function(t,e,n,i){var r,a,o=Math.sin(t-n);return x(o)>St?Math.atan((Math.sin(e)*(a=Math.cos(i))*Math.sin(n)-Math.sin(i)*(r=Math.cos(e))*Math.sin(t))/(r*a*o)):(e+i)/2}(n,i,a,o),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(s,i),e=0),t.point(n=a,i=o),r=s},lineEnd:function(){t.lineEnd(),n=i=NaN},clean:function(){return 2-e}}},function(t,e,n,i){var r;if(null==t)r=n*Et,i.point(-Yt,r),i.point(0,r),i.point(Yt,r),i.point(Yt,0),i.point(Yt,-r),i.point(0,-r),i.point(-Yt,-r),i.point(-Yt,0),i.point(-Yt,r);else if(x(t[0]-e[0])>St){var a=t[0]<e[0]?Yt:-Yt;r=n*a/2,i.point(-a,r),i.point(0,r),i.point(a,r)}else i.point(e[0],e[1])},[-Yt,-Yt/2]);function ai(t,e,n,i){return function(r){var a,o=r.a,s=r.b,l=o.x,u=o.y,c=0,d=1,h=s.x-l,f=s.y-u;if(a=t-l,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<d&&(d=a)}else if(h>0){if(a>d)return;a>c&&(c=a)}if(a=n-l,h||!(a<0)){if(a/=h,h<0){if(a>d)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<d&&(d=a)}if(a=e-u,f||!(a>0)){if(a/=f,f<0){if(a<c)return;a<d&&(d=a)}else if(f>0){if(a>d)return;a>c&&(c=a)}if(a=i-u,f||!(a<0)){if(a/=f,f<0){if(a>d)return;a>c&&(c=a)}else if(f>0){if(a<c)return;a<d&&(d=a)}return c>0&&(r.a={x:l+c*h,y:u+c*f}),d<1&&(r.b={x:l+d*h,y:u+d*f}),r}}}}}}var oi=1e9;function si(t,e,n,i){return function(l){var u,c,d,h,f,m,p,g,v,_,y,b=l,M=ni(),x=ai(t,e,n,i),w={point:S,lineStart:function(){w.point=T,c&&c.push(d=[]);_=!0,v=!1,p=g=NaN},lineEnd:function(){u&&(T(h,f),m&&v&&M.rejoin(),u.push(M.buffer()));w.point=S,v&&l.lineEnd()},polygonStart:function(){l=M,u=[],c=[],y=!0},polygonEnd:function(){l=b,u=a.merge(u);var e=function(t){for(var e=0,n=c.length,i=t[1],r=0;r<n;++r)for(var a,o=1,s=c[r],l=s.length,u=s[0];o<l;++o)a=s[o],u[1]<=i?a[1]>i&&Nt(u,a,t)>0&&++e:a[1]<=i&&Nt(u,a,t)<0&&--e,u=a;return 0!==e}([t,i]),n=y&&e,r=u.length;(n||r)&&(l.polygonStart(),n&&(l.lineStart(),k(null,null,1,l),l.lineEnd()),r&&Zn(u,o,e,k,l),l.polygonEnd()),u=c=d=null}};function k(a,o,l,u){var c=0,d=0;if(null==a||(c=r(a,l))!==(d=r(o,l))||s(a,o)<0^l>0)do{u.point(0===c||3===c?t:n,c>1?i:e)}while((c=(c+l+4)%4)!==d);else u.point(o[0],o[1])}function L(r,a){return t<=r&&r<=n&&e<=a&&a<=i}function S(t,e){L(t,e)&&l.point(t,e)}function T(t,e){var n=L(t=Math.max(-oi,Math.min(oi,t)),e=Math.max(-oi,Math.min(oi,e)));if(c&&d.push([t,e]),_)h=t,f=e,m=n,_=!1,n&&(l.lineStart(),l.point(t,e));else if(n&&v)l.point(t,e);else{var i={a:{x:p,y:g},b:{x:t,y:e}};x(i)?(v||(l.lineStart(),l.point(i.a.x,i.a.y)),l.point(i.b.x,i.b.y),n||l.lineEnd(),y=!1):n&&(l.lineStart(),l.point(t,e),y=!1)}p=t,g=e,v=n}return w};function r(i,r){return x(i[0]-t)<St?r>0?0:3:x(i[0]-n)<St?r>0?2:1:x(i[1]-e)<St?r>0?1:0:r>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var n=r(t,1),i=r(e,1);return n!==i?n-i:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}}function li(t){var e=0,n=Yt/3,i=Ci(t),r=i(e,n);return r.parallels=function(t){return arguments.length?i(e=t[0]*Yt/180,n=t[1]*Yt/180):[e/Yt*180,n/Yt*180]},r}function ui(t,e){var n=Math.sin(t),i=(n+Math.sin(e))/2,r=1+n*(2*i-n),a=Math.sqrt(r)/i;function o(t,e){var n=Math.sqrt(r-2*i*Math.sin(e))/i;return[n*Math.sin(t*=i),a-n*Math.cos(t)]}return o.invert=function(t,e){var n=a-e;return[Math.atan2(t,n)/i,Vt((r-(t*t+n*n)*i*i)/(2*i))]},o}a.geo.clipExtent=function(){var t,e,n,i,r,a,o={stream:function(t){return r&&(r.valid=!1),(r=a(t)).valid=!0,r},extent:function(s){return arguments.length?(a=si(t=+s[0][0],e=+s[0][1],n=+s[1][0],i=+s[1][1]),r&&(r.valid=!1,r=null),o):[[t,e],[n,i]]}};return o.extent([[0,0],[960,500]])},(a.geo.conicEqualArea=function(){return li(ui)}).raw=ui,a.geo.albers=function(){return a.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},a.geo.albersUsa=function(){var t,e,n,i,r=a.geo.albers(),o=a.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=a.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(e,n){t=[e,n]}};function u(r){var a=r[0],o=r[1];return t=null,e(a,o),t||(n(a,o),t)||i(a,o),t}return u.invert=function(t){var e=r.scale(),n=r.translate(),i=(t[0]-n[0])/e,a=(t[1]-n[1])/e;return(a>=.12&&a<.234&&i>=-.425&&i<-.214?o:a>=.166&&a<.234&&i>=-.214&&i<-.115?s:r).invert(t)},u.stream=function(t){var e=r.stream(t),n=o.stream(t),i=s.stream(t);return{point:function(t,r){e.point(t,r),n.point(t,r),i.point(t,r)},sphere:function(){e.sphere(),n.sphere(),i.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),i.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),i.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),i.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),i.polygonEnd()}}},u.precision=function(t){return arguments.length?(r.precision(t),o.precision(t),s.precision(t),u):r.precision()},u.scale=function(t){return arguments.length?(r.scale(t),o.scale(.35*t),s.scale(t),u.translate(r.translate())):r.scale()},u.translate=function(t){if(!arguments.length)return r.translate();var a=r.scale(),c=+t[0],d=+t[1];return e=r.translate(t).clipExtent([[c-.455*a,d-.238*a],[c+.455*a,d+.238*a]]).stream(l).point,n=o.translate([c-.307*a,d+.201*a]).clipExtent([[c-.425*a+St,d+.12*a+St],[c-.214*a-St,d+.234*a-St]]).stream(l).point,i=s.translate([c-.205*a,d+.212*a]).clipExtent([[c-.214*a+St,d+.166*a+St],[c-.115*a-St,d+.234*a-St]]).stream(l).point,u},u.scale(1070)};var ci,di,hi,fi,mi,pi,gi={point:F,lineStart:F,lineEnd:F,polygonStart:function(){di=0,gi.lineStart=vi},polygonEnd:function(){gi.lineStart=gi.lineEnd=gi.point=F,ci+=x(di/2)}};function vi(){var t,e,n,i;function r(t,e){di+=i*t-n*e,n=t,i=e}gi.point=function(a,o){gi.point=r,t=n=a,e=i=o},gi.lineEnd=function(){r(t,e)}}var _i={point:function(t,e){t<hi&&(hi=t);t>mi&&(mi=t);e<fi&&(fi=e);e>pi&&(pi=e)},lineStart:F,lineEnd:F,polygonStart:F,polygonEnd:F};function yi(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var bi,Mi={point:xi,lineStart:wi,lineEnd:ki,polygonStart:function(){Mi.lineStart=Li},polygonEnd:function(){Mi.point=xi,Mi.lineStart=wi,Mi.lineEnd=ki}};function xi(t,e){wn+=t,kn+=e,++Ln}function wi(){var t,e;function n(n,i){var r=n-t,a=i-e,o=Math.sqrt(r*r+a*a);Sn+=o*(t+n)/2,Tn+=o*(e+i)/2,Yn+=o,xi(t=n,e=i)}Mi.point=function(i,r){Mi.point=n,xi(t=i,e=r)}}function ki(){Mi.point=xi}function Li(){var t,e,n,i;function r(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Sn+=o*(n+t)/2,Tn+=o*(i+e)/2,Yn+=o,Dn+=(o=i*t-n*e)*(n+t),Cn+=o*(i+e),En+=3*o,xi(n=t,i=e)}Mi.point=function(a,o){Mi.point=r,xi(t=n=a,e=i=o)},Mi.lineEnd=function(){r(t,e)}}function Si(t){var e=.5,n=Math.cos(30*At),i=16;function r(e){return(i?function(e){var n,r,o,s,l,u,c,d,h,f,m,p,g={point:v,lineStart:_,lineEnd:b,polygonStart:function(){e.polygonStart(),g.lineStart=M},polygonEnd:function(){e.polygonEnd(),g.lineStart=_}};function v(n,i){n=t(n,i),e.point(n[0],n[1])}function _(){d=NaN,g.point=y,e.lineStart()}function y(n,r){var o=Nn([n,r]),s=t(n,r);a(d,h,c,f,m,p,d=s[0],h=s[1],c=n,f=o[0],m=o[1],p=o[2],i,e),e.point(d,h)}function b(){g.point=v,e.lineEnd()}function M(){_(),g.point=x,g.lineEnd=w}function x(t,e){y(n=t,e),r=d,o=h,s=f,l=m,u=p,g.point=y}function w(){a(d,h,c,f,m,p,r,o,n,s,l,u,i,e),g.lineEnd=b,b()}return g}:function(e){return Yi(e,function(n,i){n=t(n,i),e.point(n[0],n[1])})})(e)}function a(i,r,o,s,l,u,c,d,h,f,m,p,g,v){var _=c-i,y=d-r,b=_*_+y*y;if(b>4*e&&g--){var M=s+f,w=l+m,k=u+p,L=Math.sqrt(M*M+w*w+k*k),S=Math.asin(k/=L),T=x(x(k)-1)<St||x(o-h)<St?(o+h)/2:Math.atan2(w,M),Y=t(T,S),D=Y[0],C=Y[1],E=D-i,A=C-r,O=y*E-_*A;(O*O/b>e||x((_*E+y*A)/b-.5)>.3||s*f+l*m+u*p<n)&&(a(i,r,o,s,l,u,D,C,T,M/=L,w/=L,k,g,v),v.point(D,C),a(D,C,T,M,w,k,c,d,h,f,m,p,g,v))}}return r.precision=function(t){return arguments.length?(i=(e=t*t)>0&&16,r):Math.sqrt(e)},r}function Ti(t){this.stream=t}function Yi(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function Di(t){return Ci(function(){return t})()}function Ci(t){var e,n,i,r,o,s,l=Si(function(t,n){return[(t=e(t,n))[0]*u+r,o-t[1]*u]}),u=150,c=480,d=250,h=0,f=0,m=0,p=0,g=0,v=ri,_=N,y=null,b=null;function M(t){return[(t=i(t[0]*At,t[1]*At))[0]*u+r,o-t[1]*u]}function w(t){return(t=i.invert((t[0]-r)/u,(o-t[1])/u))&&[t[0]*Ot,t[1]*Ot]}function k(){i=Jn(n=ji(m,p,g),e);var t=e(h,f);return r=c-t[0]*u,o=d+t[1]*u,L()}function L(){return s&&(s.valid=!1,s=null),M}return M.stream=function(t){return s&&(s.valid=!1),(s=Ei(v(n,l(_(t))))).valid=!0,s},M.clipAngle=function(t){return arguments.length?(v=null==t?(y=t,ri):function(t){var e=Math.cos(t),n=e>0,i=x(e)>St;return ti(r,function(t){var e,s,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(d,h){var f,m=[d,h],p=r(d,h),g=n?p?0:o(d,h):p?o(d+(d<0?Yt:-Yt),h):0;if(!e&&(u=l=p)&&t.lineStart(),p!==l&&(f=a(e,m),(Wn(e,f)||Wn(m,f))&&(m[0]+=St,m[1]+=St,p=r(m[0],m[1]))),p!==l)c=0,p?(t.lineStart(),f=a(m,e),t.point(f[0],f[1])):(f=a(e,m),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(i&&e&&n^p){var v;g&s||!(v=a(m,e,!0))||(c=0,n?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!p||e&&Wn(e,m)||t.point(m[0],m[1]),e=m,l=p,s=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(u&&l)<<1}}},Pi(t,6*At),n?[0,-t]:[-Yt,t-Yt]);function r(t,n){return Math.cos(t)*Math.cos(n)>e}function a(t,n,i){var r=[1,0,0],a=Vn(Nn(t),Nn(n)),o=Hn(a,a),s=a[0],l=o-s*s;if(!l)return!i&&t;var u=e*o/l,c=-e*s/l,d=Vn(r,a),h=Fn(r,u);Pn(h,Fn(a,c));var f=d,m=Hn(h,f),p=Hn(f,f),g=m*m-p*(Hn(h,h)-1);if(!(g<0)){var v=Math.sqrt(g),_=Fn(f,(-m-v)/p);if(Pn(_,h),_=Rn(_),!i)return _;var y,b=t[0],M=n[0],w=t[1],k=n[1];M<b&&(y=b,b=M,M=y);var L=M-b,S=x(L-Yt)<St;if(!S&&k<w&&(y=w,w=k,k=y),S||L<St?S?w+k>0^_[1]<(x(_[0]-b)<St?w:k):w<=_[1]&&_[1]<=k:L>Yt^(b<=_[0]&&_[0]<=M)){var T=Fn(f,(-m+v)/p);return Pn(T,h),[_,Rn(T)]}}}function o(e,i){var r=n?t:Yt-t,a=0;return e<-r?a|=1:e>r&&(a|=2),i<-r?a|=4:i>r&&(a|=8),a}}((y=+t)*At),L()):y},M.clipExtent=function(t){return arguments.length?(b=t,_=t?si(t[0][0],t[0][1],t[1][0],t[1][1]):N,L()):b},M.scale=function(t){return arguments.length?(u=+t,k()):u},M.translate=function(t){return arguments.length?(c=+t[0],d=+t[1],k()):[c,d]},M.center=function(t){return arguments.length?(h=t[0]%360*At,f=t[1]%360*At,k()):[h*Ot,f*Ot]},M.rotate=function(t){return arguments.length?(m=t[0]%360*At,p=t[1]%360*At,g=t.length>2?t[2]%360*At:0,k()):[m*Ot,p*Ot,g*Ot]},a.rebind(M,l,"precision"),function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,k()}}function Ei(t){return Yi(t,function(e,n){t.point(e*At,n*At)})}function Ai(t,e){return[t,e]}function Oi(t,e){return[t>Yt?t-Dt:t<-Yt?t+Dt:t,e]}function ji(t,e,n){return t?e||n?Jn(Hi(t),Vi(e,n)):Hi(t):e||n?Vi(e,n):Oi}function Ni(t){return function(e,n){return[(e+=t)>Yt?e-Dt:e<-Yt?e+Dt:e,n]}}function Hi(t){var e=Ni(t);return e.invert=Ni(-t),e}function Vi(t,e){var n=Math.cos(t),i=Math.sin(t),r=Math.cos(e),a=Math.sin(e);function o(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*r-c*a,s*n-u*i),Vt(c*r+l*a)]}return o.invert=function(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*r-l*a;return[Math.atan2(l*r+u*a,s*n+c*i),Vt(c*n-s*i)]},o}function Pi(t,e){var n=Math.cos(t),i=Math.sin(t);return function(r,a,o,s){var l=o*e;null!=r?(r=Fi(n,r),a=Fi(n,a),(o>0?r<a:r>a)&&(r+=o*Dt)):(r=t+o*Dt,a=t-.5*l);for(var u,c=r;o>0?c>a:c<a;c-=l)s.point((u=Rn([n,-i*Math.cos(c),-i*Math.sin(c)]))[0],u[1])}}function Fi(t,e){var n=Nn(e);n[0]-=t,In(n);var i=Ht(-n[1]);return((-n[2]<0?-i:i)+2*Math.PI-St)%(2*Math.PI)}function Ii(t,e,n){var i=a.range(t,e-St,n).concat(e);return function(t){return i.map(function(e){return[t,e]})}}function Ri(t,e,n){var i=a.range(t,e-St,n).concat(e);return function(t){return i.map(function(e){return[e,t]})}}function Wi(t){return t.source}function zi(t){return t.target}a.geo.path=function(){var t,e,n,i,r,o=4.5;function s(t){return t&&("function"==typeof o&&i.pointRadius(+o.apply(this,arguments)),r&&r.valid||(r=n(i)),a.geo.stream(t,r)),i.result()}function l(){return r=null,s}return s.area=function(t){return ci=0,a.geo.stream(t,n(gi)),ci},s.centroid=function(t){return wn=kn=Ln=Sn=Tn=Yn=Dn=Cn=En=0,a.geo.stream(t,n(Mi)),En?[Dn/En,Cn/En]:Yn?[Sn/Yn,Tn/Yn]:Ln?[wn/Ln,kn/Ln]:[NaN,NaN]},s.bounds=function(t){return mi=pi=-(hi=fi=1/0),a.geo.stream(t,n(_i)),[[hi,fi],[mi,pi]]},s.projection=function(e){return arguments.length?(n=(t=e)?e.stream||function(t){var e=Si(function(e,n){return t([e*Ot,n*Ot])});return function(t){return Ei(e(t))}}(e):N,l()):t},s.context=function(t){return arguments.length?(i=null==(e=t)?new function(){var t=yi(4.5),e=[],n={point:i,lineStart:function(){n.point=r},lineEnd:o,polygonStart:function(){n.lineEnd=s},polygonEnd:function(){n.lineEnd=o,n.point=i},pointRadius:function(e){return t=yi(e),n},result:function(){if(e.length){var t=e.join("");return e=[],t}}};function i(n,i){e.push("M",n,",",i,t)}function r(t,i){e.push("M",t,",",i),n.point=a}function a(t,n){e.push("L",t,",",n)}function o(){n.point=i}function s(){e.push("Z")}return n}:new function(t){var e=4.5,n={point:i,lineStart:function(){n.point=r},lineEnd:o,polygonStart:function(){n.lineEnd=s},polygonEnd:function(){n.lineEnd=o,n.point=i},pointRadius:function(t){return e=t,n},result:F};function i(n,i){t.moveTo(n+e,i),t.arc(n,i,e,0,Dt)}function r(e,i){t.moveTo(e,i),n.point=a}function a(e,n){t.lineTo(e,n)}function o(){n.point=i}function s(){t.closePath()}return n}(t),"function"!=typeof o&&i.pointRadius(o),l()):e},s.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(i.pointRadius(+t),+t),s):o},s.projection(a.geo.albersUsa()).context(null)},a.geo.transform=function(t){return{stream:function(e){var n=new Ti(e);for(var i in t)n[i]=t[i];return n}}},Ti.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},a.geo.projection=Di,a.geo.projectionMutator=Ci,(a.geo.equirectangular=function(){return Di(Ai)}).raw=Ai.invert=Ai,a.geo.rotation=function(t){function e(e){return(e=t(e[0]*At,e[1]*At))[0]*=Ot,e[1]*=Ot,e}return t=ji(t[0]%360*At,t[1]*At,t.length>2?t[2]*At:0),e.invert=function(e){return(e=t.invert(e[0]*At,e[1]*At))[0]*=Ot,e[1]*=Ot,e},e},Oi.invert=Ai,a.geo.circle=function(){var t,e,n=[0,0],i=6;function r(){var t="function"==typeof n?n.apply(this,arguments):n,i=ji(-t[0]*At,-t[1]*At,0).invert,r=[];return e(null,null,1,{point:function(t,e){r.push(t=i(t,e)),t[0]*=Ot,t[1]*=Ot}}),{type:"Polygon",coordinates:[r]}}return r.origin=function(t){return arguments.length?(n=t,r):n},r.angle=function(n){return arguments.length?(e=Pi((t=+n)*At,i*At),r):t},r.precision=function(n){return arguments.length?(e=Pi(t*At,(i=+n)*At),r):i},r.angle(90)},a.geo.distance=function(t,e){var n,i=(e[0]-t[0])*At,r=t[1]*At,a=e[1]*At,o=Math.sin(i),s=Math.cos(i),l=Math.sin(r),u=Math.cos(r),c=Math.sin(a),d=Math.cos(a);return Math.atan2(Math.sqrt((n=d*o)*n+(n=u*c-l*d*s)*n),l*c+u*d*s)},a.geo.graticule=function(){var t,e,n,i,r,o,s,l,u,c,d,h,f=10,m=f,p=90,g=360,v=2.5;function _(){return{type:"MultiLineString",coordinates:y()}}function y(){return a.range(Math.ceil(i/p)*p,n,p).map(d).concat(a.range(Math.ceil(l/g)*g,s,g).map(h)).concat(a.range(Math.ceil(e/f)*f,t,f).filter(function(t){return x(t%p)>St}).map(u)).concat(a.range(Math.ceil(o/m)*m,r,m).filter(function(t){return x(t%g)>St}).map(c))}return _.lines=function(){return y().map(function(t){return{type:"LineString",coordinates:t}})},_.outline=function(){return{type:"Polygon",coordinates:[d(i).concat(h(s).slice(1),d(n).reverse().slice(1),h(l).reverse().slice(1))]}},_.extent=function(t){return arguments.length?_.majorExtent(t).minorExtent(t):_.minorExtent()},_.majorExtent=function(t){return arguments.length?(i=+t[0][0],n=+t[1][0],l=+t[0][1],s=+t[1][1],i>n&&(t=i,i=n,n=t),l>s&&(t=l,l=s,s=t),_.precision(v)):[[i,l],[n,s]]},_.minorExtent=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],r=+n[1][1],e>t&&(n=e,e=t,t=n),o>r&&(n=o,o=r,r=n),_.precision(v)):[[e,o],[t,r]]},_.step=function(t){return arguments.length?_.majorStep(t).minorStep(t):_.minorStep()},_.majorStep=function(t){return arguments.length?(p=+t[0],g=+t[1],_):[p,g]},_.minorStep=function(t){return arguments.length?(f=+t[0],m=+t[1],_):[f,m]},_.precision=function(a){return arguments.length?(v=+a,u=Ii(o,r,90),c=Ri(e,t,v),d=Ii(l,s,90),h=Ri(i,n,v),_):v},_.majorExtent([[-180,-90+St],[180,90-St]]).minorExtent([[-180,-80-St],[180,80+St]])},a.geo.greatArc=function(){var t,e,n=Wi,i=zi;function r(){return{type:"LineString",coordinates:[t||n.apply(this,arguments),e||i.apply(this,arguments)]}}return r.distance=function(){return a.geo.distance(t||n.apply(this,arguments),e||i.apply(this,arguments))},r.source=function(e){return arguments.length?(n=e,t="function"==typeof e?null:e,r):n},r.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,r):i},r.precision=function(){return arguments.length?r:0},r},a.geo.interpolate=function(t,e){return function(t,e,n,i){var r=Math.cos(e),a=Math.sin(e),o=Math.cos(i),s=Math.sin(i),l=r*Math.cos(t),u=r*Math.sin(t),c=o*Math.cos(n),d=o*Math.sin(n),h=2*Math.asin(Math.sqrt(Ft(i-e)+r*o*Ft(n-t))),f=1/Math.sin(h),m=h?function(t){var e=Math.sin(t*=h)*f,n=Math.sin(h-t)*f,i=n*l+e*c,r=n*u+e*d,o=n*a+e*s;return[Math.atan2(r,i)*Ot,Math.atan2(o,Math.sqrt(i*i+r*r))*Ot]}:function(){return[t*Ot,e*Ot]};return m.distance=h,m}(t[0]*At,t[1]*At,e[0]*At,e[1]*At)},a.geo.length=function(t){return bi=0,a.geo.stream(t,Bi),bi};var Bi={sphere:F,point:F,lineStart:function(){var t,e,n;function i(i,r){var a=Math.sin(r*=At),o=Math.cos(r),s=x((i*=At)-t),l=Math.cos(s);bi+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=n*a-e*o*l)*s),e*a+n*o*l),t=i,e=a,n=o}Bi.point=function(r,a){t=r*At,e=Math.sin(a*=At),n=Math.cos(a),Bi.point=i},Bi.lineEnd=function(){Bi.point=Bi.lineEnd=F}},lineEnd:F,polygonStart:F,polygonEnd:F};function Ui(t,e){function n(e,n){var i=Math.cos(e),r=Math.cos(n),a=t(i*r);return[a*r*Math.sin(e),a*Math.sin(n)]}return n.invert=function(t,n){var i=Math.sqrt(t*t+n*n),r=e(i),a=Math.sin(r),o=Math.cos(r);return[Math.atan2(t*a,i*o),Math.asin(i&&n*a/i)]},n}var Gi=Ui(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(a.geo.azimuthalEqualArea=function(){return Di(Gi)}).raw=Gi;var $i=Ui(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},N);function qi(t,e){var n=Math.cos(t),i=function(t){return Math.tan(Yt/4+t/2)},r=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),a=n*Math.pow(i(t),r)/r;if(!r)return Zi;function o(t,e){a>0?e<-Et+St&&(e=-Et+St):e>Et-St&&(e=Et-St);var n=a/Math.pow(i(e),r);return[n*Math.sin(r*t),a-n*Math.cos(r*t)]}return o.invert=function(t,e){var n=a-e,i=jt(r)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/r,2*Math.atan(Math.pow(a/i,1/r))-Et]},o}function Ji(t,e){var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),r=n/i+t;if(x(i)<St)return Ai;function a(t,e){var n=r-e;return[n*Math.sin(i*t),r-n*Math.cos(i*t)]}return a.invert=function(t,e){var n=r-e;return[Math.atan2(t,n)/i,r-jt(i)*Math.sqrt(t*t+n*n)]},a}(a.geo.azimuthalEquidistant=function(){return Di($i)}).raw=$i,(a.geo.conicConformal=function(){return li(qi)}).raw=qi,(a.geo.conicEquidistant=function(){return li(Ji)}).raw=Ji;var Xi=Ui(function(t){return 1/t},Math.atan);function Zi(t,e){return[t,Math.log(Math.tan(Yt/4+e/2))]}function Ki(t){var e,n=Di(t),i=n.scale,r=n.translate,a=n.clipExtent;return n.scale=function(){var t=i.apply(n,arguments);return t===n?e?n.clipExtent(null):n:t},n.translate=function(){var t=r.apply(n,arguments);return t===n?e?n.clipExtent(null):n:t},n.clipExtent=function(t){var o=a.apply(n,arguments);if(o===n){if(e=null==t){var s=Yt*i(),l=r();a([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else e&&(o=null);return o},n.clipExtent(null)}(a.geo.gnomonic=function(){return Di(Xi)}).raw=Xi,Zi.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Et]},(a.geo.mercator=function(){return Ki(Zi)}).raw=Zi;var Qi=Ui(function(){return 1},Math.asin);(a.geo.orthographic=function(){return Di(Qi)}).raw=Qi;var tr=Ui(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});function er(t,e){return[Math.log(Math.tan(Yt/4+e/2)),-t]}function nr(t){return t[0]}function ir(t){return t[1]}function rr(t){for(var e=t.length,n=[0,1],i=2,r=2;r<e;r++){for(;i>1&&Nt(t[n[i-2]],t[n[i-1]],t[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}function ar(t,e){return t[0]-e[0]||t[1]-e[1]}(a.geo.stereographic=function(){return Di(tr)}).raw=tr,er.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Et]},(a.geo.transverseMercator=function(){var t=Ki(er),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90])}).raw=er,a.geom={},a.geom.hull=function(t){var e=nr,n=ir;if(arguments.length)return i(t);function i(t){if(t.length<3)return[];var i,r=ye(e),a=ye(n),o=t.length,s=[],l=[];for(i=0;i<o;i++)s.push([+r.call(this,t[i],i),+a.call(this,t[i],i),i]);for(s.sort(ar),i=0;i<o;i++)l.push([s[i][0],-s[i][1]]);var u=rr(s),c=rr(l),d=c[0]===u[0],h=c[c.length-1]===u[u.length-1],f=[];for(i=u.length-1;i>=0;--i)f.push(t[s[u[i]][2]]);for(i=+d;i<c.length-h;++i)f.push(t[s[c[i]][2]]);return f}return i.x=function(t){return arguments.length?(e=t,i):e},i.y=function(t){return arguments.length?(n=t,i):n},i},a.geom.polygon=function(t){return G(t,or),t};var or=a.geom.polygon.prototype=[];function sr(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function lr(t,e,n,i){var r=t[0],a=n[0],o=e[0]-r,s=i[0]-a,l=t[1],u=n[1],c=e[1]-l,d=i[1]-u,h=(s*(l-u)-d*(r-a))/(d*o-s*c);return[r+h*o,l+h*c]}function ur(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}or.area=function(){for(var t,e=-1,n=this.length,i=this[n-1],r=0;++e<n;)t=i,i=this[e],r+=t[1]*i[0]-t[0]*i[1];return.5*r},or.centroid=function(t){var e,n,i=-1,r=this.length,a=0,o=0,s=this[r-1];for(arguments.length||(t=-1/(6*this.area()));++i<r;)e=s,s=this[i],n=e[0]*s[1]-s[0]*e[1],a+=(e[0]+s[0])*n,o+=(e[1]+s[1])*n;return[a*t,o*t]},or.clip=function(t){for(var e,n,i,r,a,o,s=ur(t),l=-1,u=this.length-ur(this),c=this[u-1];++l<u;){for(e=t.slice(),t.length=0,r=this[l],a=e[(i=e.length-s)-1],n=-1;++n<i;)sr(o=e[n],c,r)?(sr(a,c,r)||t.push(lr(a,o,c,r)),t.push(o)):sr(a,c,r)&&t.push(lr(a,o,c,r)),a=o;s&&t.push(t[0]),c=r}return t};var cr,dr,hr,fr,mr,pr=[],gr=[];function vr(t){var e=pr.pop()||new function(){jr(this),this.edge=this.site=this.circle=null};return e.site=t,e}function _r(t){Sr(t),hr.remove(t),pr.push(t),jr(t)}function yr(t){var e=t.circle,n=e.x,i=e.cy,r={x:n,y:i},a=t.P,o=t.N,s=[t];_r(t);for(var l=a;l.circle&&x(n-l.circle.x)<St&&x(i-l.circle.cy)<St;)a=l.P,s.unshift(l),_r(l),l=a;s.unshift(l),Sr(l);for(var u=o;u.circle&&x(n-u.circle.x)<St&&x(i-u.circle.cy)<St;)o=u.N,s.push(u),_r(u),u=o;s.push(u),Sr(u);var c,d=s.length;for(c=1;c<d;++c)u=s[c],l=s[c-1],Er(u.edge,l.site,u.site,r);l=s[0],(u=s[d-1]).edge=Dr(l.site,u.site,null,r),Lr(l),Lr(u)}function br(t){for(var e,n,i,r,a=t.x,o=t.y,s=hr._;s;)if((i=Mr(s,o)-a)>St)s=s.L;else{if(!((r=a-xr(s,o))>St)){i>-St?(e=s.P,n=s):r>-St?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}var l=vr(t);if(hr.insert(e,l),e||n){if(e===n)return Sr(e),n=vr(e.site),hr.insert(l,n),l.edge=n.edge=Dr(e.site,l.site),Lr(e),void Lr(n);if(n){Sr(e),Sr(n);var u=e.site,c=u.x,d=u.y,h=t.x-c,f=t.y-d,m=n.site,p=m.x-c,g=m.y-d,v=2*(h*g-f*p),_=h*h+f*f,y=p*p+g*g,b={x:(g*_-f*y)/v+c,y:(h*y-p*_)/v+d};Er(n.edge,u,m,b),l.edge=Dr(u,t,null,b),n.edge=Dr(t,m,null,b),Lr(e),Lr(n)}else l.edge=Dr(e.site,l.site)}}function Mr(t,e){var n=t.site,i=n.x,r=n.y,a=r-e;if(!a)return i;var o=t.P;if(!o)return-1/0;var s=(n=o.site).x,l=n.y,u=l-e;if(!u)return s;var c=s-i,d=1/a-1/u,h=c/u;return d?(-h+Math.sqrt(h*h-2*d*(c*c/(-2*u)-l+u/2+r-a/2)))/d+i:(i+s)/2}function xr(t,e){var n=t.N;if(n)return Mr(n,e);var i=t.site;return i.y===e?i.x:1/0}function wr(t){this.site=t,this.edges=[]}function kr(t,e){return e.angle-t.angle}function Lr(t){var e=t.P,n=t.N;if(e&&n){var i=e.site,r=t.site,a=n.site;if(i!==a){var o=r.x,s=r.y,l=i.x-o,u=i.y-s,c=a.x-o,d=2*(l*(g=a.y-s)-u*c);if(!(d>=-Tt)){var h=l*l+u*u,f=c*c+g*g,m=(g*h-u*f)/d,p=(l*f-c*h)/d,g=p+s,v=gr.pop()||new function(){jr(this),this.x=this.y=this.arc=this.site=this.cy=null};v.arc=t,v.site=r,v.x=m+o,v.y=g+Math.sqrt(m*m+p*p),v.cy=g,t.circle=v;for(var _=null,y=mr._;y;)if(v.y<y.y||v.y===y.y&&v.x<=y.x){if(!y.L){_=y.P;break}y=y.L}else{if(!y.R){_=y;break}y=y.R}mr.insert(_,v),_||(fr=v)}}}}function Sr(t){var e=t.circle;e&&(e.P||(fr=e.N),mr.remove(e),gr.push(e),jr(e),t.circle=null)}function Tr(t,e){var n=t.b;if(n)return!0;var i,r,a=t.a,o=e[0][0],s=e[1][0],l=e[0][1],u=e[1][1],c=t.l,d=t.r,h=c.x,f=c.y,m=d.x,p=d.y,g=(h+m)/2,v=(f+p)/2;if(p===f){if(g<o||g>=s)return;if(h>m){if(a){if(a.y>=u)return}else a={x:g,y:l};n={x:g,y:u}}else{if(a){if(a.y<l)return}else a={x:g,y:u};n={x:g,y:l}}}else if(r=v-(i=(h-m)/(p-f))*g,i<-1||i>1)if(h>m){if(a){if(a.y>=u)return}else a={x:(l-r)/i,y:l};n={x:(u-r)/i,y:u}}else{if(a){if(a.y<l)return}else a={x:(u-r)/i,y:u};n={x:(l-r)/i,y:l}}else if(f<p){if(a){if(a.x>=s)return}else a={x:o,y:i*o+r};n={x:s,y:i*s+r}}else{if(a){if(a.x<o)return}else a={x:s,y:i*s+r};n={x:o,y:i*o+r}}return t.a=a,t.b=n,!0}function Yr(t,e){this.l=t,this.r=e,this.a=this.b=null}function Dr(t,e,n,i){var r=new Yr(t,e);return cr.push(r),n&&Er(r,t,e,n),i&&Er(r,e,t,i),dr[t.i].edges.push(new Ar(r,t,e)),dr[e.i].edges.push(new Ar(r,e,t)),r}function Cr(t,e,n){var i=new Yr(t,null);return i.a=e,i.b=n,cr.push(i),i}function Er(t,e,n,i){t.a||t.b?t.l===n?t.b=i:t.a=i:(t.a=i,t.l=e,t.r=n)}function Ar(t,e,n){var i=t.a,r=t.b;this.edge=t,this.site=e,this.angle=n?Math.atan2(n.y-e.y,n.x-e.x):t.l===e?Math.atan2(r.x-i.x,i.y-r.y):Math.atan2(i.x-r.x,r.y-i.y)}function Or(){this._=null}function jr(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Nr(t,e){var n=e,i=e.R,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.R=i.L,n.R&&(n.R.U=n),i.L=n}function Hr(t,e){var n=e,i=e.L,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.L=i.R,n.L&&(n.L.U=n),i.R=n}function Vr(t){for(;t.L;)t=t.L;return t}function Pr(t,e){var n,i,r,a=t.sort(Fr).pop();for(cr=[],dr=new Array(t.length),hr=new Or,mr=new Or;;)if(r=fr,a&&(!r||a.y<r.y||a.y===r.y&&a.x<r.x))a.x===n&&a.y===i||(dr[a.i]=new wr(a),br(a),n=a.x,i=a.y),a=t.pop();else{if(!r)break;yr(r.arc)}e&&(function(t){for(var e,n=cr,i=ai(t[0][0],t[0][1],t[1][0],t[1][1]),r=n.length;r--;)(!Tr(e=n[r],t)||!i(e)||x(e.a.x-e.b.x)<St&&x(e.a.y-e.b.y)<St)&&(e.a=e.b=null,n.splice(r,1))}(e),function(t){for(var e,n,i,r,a,o,s,l,u,c,d=t[0][0],h=t[1][0],f=t[0][1],m=t[1][1],p=dr,g=p.length;g--;)if((a=p[g])&&a.prepare())for(l=(s=a.edges).length,o=0;o<l;)i=(c=s[o].end()).x,r=c.y,e=(u=s[++o%l].start()).x,n=u.y,(x(i-e)>St||x(r-n)>St)&&(s.splice(o,0,new Ar(Cr(a.site,c,x(i-d)<St&&m-r>St?{x:d,y:x(e-d)<St?n:m}:x(r-m)<St&&h-i>St?{x:x(n-m)<St?e:h,y:m}:x(i-h)<St&&r-f>St?{x:h,y:x(e-h)<St?n:f}:x(r-f)<St&&i-d>St?{x:x(n-f)<St?e:d,y:f}:null),a.site,null)),++l)}(e));var o={cells:dr,edges:cr};return hr=mr=cr=dr=null,o}function Fr(t,e){return e.y-t.y||e.x-t.x}wr.prototype.prepare=function(){for(var t,e=this.edges,n=e.length;n--;)(t=e[n].edge).b&&t.a||e.splice(n,1);return e.sort(kr),e.length},Ar.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},Or.prototype={insert:function(t,e){var n,i,r;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else this._?(t=Vr(this._),e.P=null,e.N=t,t.P=t.L=e,n=t):(e.P=e.N=null,this._=e,n=null);for(e.L=e.R=null,e.U=n,e.C=!0,t=e;n&&n.C;)n===(i=n.U).L?(r=i.R)&&r.C?(n.C=r.C=!1,i.C=!0,t=i):(t===n.R&&(Nr(this,n),n=(t=n).U),n.C=!1,i.C=!0,Hr(this,i)):(r=i.L)&&r.C?(n.C=r.C=!1,i.C=!0,t=i):(t===n.L&&(Hr(this,n),n=(t=n).U),n.C=!1,i.C=!0,Nr(this,i)),n=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,n,i,r=t.U,a=t.L,o=t.R;if(n=a?o?Vr(o):a:o,r?r.L===t?r.L=n:r.R=n:this._=n,a&&o?(i=n.C,n.C=t.C,n.L=a,a.U=n,n!==o?(r=n.U,n.U=t.U,t=n.R,r.L=t,n.R=o,o.U=n):(n.U=r,r=n,t=n.R)):(i=t.C,t=n),t&&(t.U=r),!i)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===r.L){if((e=r.R).C&&(e.C=!1,r.C=!0,Nr(this,r),e=r.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,Hr(this,e),e=r.R),e.C=r.C,r.C=e.R.C=!1,Nr(this,r),t=this._;break}}else if((e=r.L).C&&(e.C=!1,r.C=!0,Hr(this,r),e=r.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,Nr(this,e),e=r.L),e.C=r.C,r.C=e.L.C=!1,Hr(this,r),t=this._;break}e.C=!0,t=r,r=r.U}while(!t.C);t&&(t.C=!1)}}},a.geom.voronoi=function(t){var e=nr,n=ir,i=e,r=n,a=Ir;if(t)return o(t);function o(t){var e=new Array(t.length),n=a[0][0],i=a[0][1],r=a[1][0],o=a[1][1];return Pr(s(t),a).cells.forEach(function(a,s){var l=a.edges,u=a.site;(e[s]=l.length?l.map(function(t){var e=t.start();return[e.x,e.y]}):u.x>=n&&u.x<=r&&u.y>=i&&u.y<=o?[[n,o],[r,o],[r,i],[n,i]]:[]).point=t[s]}),e}function s(t){return t.map(function(t,e){return{x:Math.round(i(t,e)/St)*St,y:Math.round(r(t,e)/St)*St,i:e}})}return o.links=function(t){return Pr(s(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},o.triangles=function(t){var e=[];return Pr(s(t)).cells.forEach(function(n,i){for(var r,a=n.site,o=n.edges.sort(kr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s<l;)u,r=c,c=(u=o[s].edge).l===a?u.r:u.l,i<r.i&&i<c.i&&Rr(a,r,c)<0&&e.push([t[i],t[r.i],t[c.i]])}),e},o.x=function(t){return arguments.length?(i=ye(e=t),o):e},o.y=function(t){return arguments.length?(r=ye(n=t),o):n},o.clipExtent=function(t){return arguments.length?(a=null==t?Ir:t,o):a===Ir?null:a},o.size=function(t){return arguments.length?o.clipExtent(t&&[[0,0],t]):a===Ir?null:a&&a[1]},o};var Ir=[[-1e6,-1e6],[1e6,1e6]];function Rr(t,e,n){return(t.x-n.x)*(e.y-t.y)-(t.x-e.x)*(n.y-t.y)}function Wr(t){return t.x}function zr(t){return t.y}function Br(t,e){t=a.rgb(t),e=a.rgb(e);var n=t.r,i=t.g,r=t.b,o=e.r-n,s=e.g-i,l=e.b-r;return function(t){return"#"+he(Math.round(n+o*t))+he(Math.round(i+s*t))+he(Math.round(r+l*t))}}function Ur(t,e){var n,i={},r={};for(n in t)n in e?i[n]=Xr(t[n],e[n]):r[n]=t[n];for(n in e)n in t||(r[n]=e[n]);return function(t){for(n in i)r[n]=i[n](t);return r}}function Gr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function $r(t,e){var n,i,r,a=qr.lastIndex=Jr.lastIndex=0,o=-1,s=[],l=[];for(t+="",e+="";(n=qr.exec(t))&&(i=Jr.exec(e));)(r=i.index)>a&&(r=e.slice(a,r),s[o]?s[o]+=r:s[++o]=r),(n=n[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,l.push({i:o,x:Gr(n,i)})),a=Jr.lastIndex;return a<e.length&&(r=e.slice(a),s[o]?s[o]+=r:s[++o]=r),s.length<2?l[0]?(e=l[0].x,function(t){return e(t)+""}):function(){return e}:(e=l.length,function(t){for(var n,i=0;i<e;++i)s[(n=l[i]).i]=n.x(t);return s.join("")})}a.geom.delaunay=function(t){return a.geom.voronoi().triangles(t)},a.geom.quadtree=function(t,e,n,i,r){var a,o=nr,s=ir;if(a=arguments.length)return o=Wr,s=zr,3===a&&(r=n,i=e,n=e=0),l(t);function l(t){var l,u,c,d,h,f,m,p,g,v=ye(o),_=ye(s);if(null!=e)f=e,m=n,p=i,g=r;else if(p=g=-(f=m=1/0),u=[],c=[],h=t.length,a)for(d=0;d<h;++d)(l=t[d]).x<f&&(f=l.x),l.y<m&&(m=l.y),l.x>p&&(p=l.x),l.y>g&&(g=l.y),u.push(l.x),c.push(l.y);else for(d=0;d<h;++d){var y=+v(l=t[d],d),b=+_(l,d);y<f&&(f=y),b<m&&(m=b),y>p&&(p=y),b>g&&(g=b),u.push(y),c.push(b)}var M=p-f,w=g-m;function k(t,e,n,i,r,a,o,s){if(!isNaN(n)&&!isNaN(i))if(t.leaf){var l=t.x,u=t.y;if(null!=l)if(x(l-n)+x(u-i)<.01)L(t,e,n,i,r,a,o,s);else{var c=t.point;t.x=t.y=t.point=null,L(t,c,l,u,r,a,o,s),L(t,e,n,i,r,a,o,s)}else t.x=n,t.y=i,t.point=e}else L(t,e,n,i,r,a,o,s)}function L(t,e,n,i,r,a,o,s){var l=.5*(r+o),u=.5*(a+s),c=n>=l,d=i>=u,h=d<<1|c;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(S,t,+v(t,++d),+_(t,d),f,m,p,g)}}),c?r=l:o=l,d?a=u:s=u,k(t,e,n,i,r,a,o,s)}M>w?g=m+M:p=f+w;var S={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(S,t,+v(t,++d),+_(t,d),f,m,p,g)}};if(S.visit=function(t){!function t(e,n,i,r,a,o){if(!e(n,i,r,a,o)){var s=.5*(i+a),l=.5*(r+o),u=n.nodes;u[0]&&t(e,u[0],i,r,s,l),u[1]&&t(e,u[1],s,r,a,l),u[2]&&t(e,u[2],i,l,s,o),u[3]&&t(e,u[3],s,l,a,o)}}(t,S,f,m,p,g)},S.find=function(t){return function(t,e,n,i,r,a,o){var s,l=1/0;return function t(u,c,d,h,f){if(!(c>a||d>o||h<i||f<r)){if(m=u.point){var m,p=e-u.x,g=n-u.y,v=p*p+g*g;if(v<l){var _=Math.sqrt(l=v);i=e-_,r=n-_,a=e+_,o=n+_,s=m}}for(var y=u.nodes,b=.5*(c+h),M=.5*(d+f),x=(n>=M)<<1|e>=b,w=x+4;x<w;++x)if(u=y[3&x])switch(3&x){case 0:t(u,c,d,b,M);break;case 1:t(u,b,d,h,M);break;case 2:t(u,c,M,b,f);break;case 3:t(u,b,M,h,f)}}}(t,i,r,a,o),s}(S,t[0],t[1],f,m,p,g)},d=-1,null==e){for(;++d<h;)k(S,t[d],u[d],c[d],f,m,p,g);--d}else t.forEach(S.add);return u=c=t=l=null,S}return l.x=function(t){return arguments.length?(o=t,l):o},l.y=function(t){return arguments.length?(s=t,l):s},l.extent=function(t){return arguments.length?(null==t?e=n=i=r=null:(e=+t[0][0],n=+t[0][1],i=+t[1][0],r=+t[1][1]),l):null==e?null:[[e,n],[i,r]]},l.size=function(t){return arguments.length?(null==t?e=n=i=r=null:(e=n=0,i=+t[0],r=+t[1]),l):null==e?null:[i-e,r-n]},l},a.interpolateRgb=Br,a.interpolateObject=Ur,a.interpolateNumber=Gr,a.interpolateString=$r;var qr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jr=new RegExp(qr.source,"g");function Xr(t,e){for(var n,i=a.interpolators.length;--i>=0&&!(n=a.interpolators[i](t,e)););return n}function Zr(t,e){var n,i=[],r=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(n=0;n<s;++n)i.push(Xr(t[n],e[n]));for(;n<a;++n)r[n]=t[n];for(;n<o;++n)r[n]=e[n];return function(t){for(n=0;n<s;++n)r[n]=i[n](t);return r}}a.interpolate=Xr,a.interpolators=[function(t,e){var n=typeof e;return("string"===n?_e.has(e.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(e)?Br:$r:e instanceof Bt?Br:Array.isArray(e)?Zr:"object"===n&&isNaN(e)?Ur:Gr)(t,e)}],a.interpolateArray=Zr;var Kr=function(){return N},Qr=a.map({linear:Kr,poly:function(t){return function(e){return Math.pow(e,t)}},quad:function(){return ia},cubic:function(){return ra},sin:function(){return oa},exp:function(){return sa},circle:function(){return la},elastic:function(t,e){var n;arguments.length<2&&(e=.45);arguments.length?n=e/Dt*Math.asin(1/t):(t=1,n=e/4);return function(i){return 1+t*Math.pow(2,-10*i)*Math.sin((i-n)*Dt/e)}},back:function(t){t||(t=1.70158);return function(e){return e*e*((t+1)*e-t)}},bounce:function(){return ua}}),ta=a.map({in:N,out:ea,"in-out":na,"out-in":function(t){return na(ea(t))}});function ea(t){return function(e){return 1-t(1-e)}}function na(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function ia(t){return t*t}function ra(t){return t*t*t}function aa(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function oa(t){return 1-Math.cos(t*Et)}function sa(t){return Math.pow(2,10*(t-1))}function la(t){return 1-Math.sqrt(1-t*t)}function ua(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function ca(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function da(t){var e=[t.a,t.b],n=[t.c,t.d],i=fa(e),r=ha(e,n),a=fa(function(t,e,n){return t[0]+=n*e[0],t[1]+=n*e[1],t}(n,e,-r))||0;e[0]*n[1]<n[0]*e[1]&&(e[0]*=-1,e[1]*=-1,i*=-1,r*=-1),this.rotate=(i?Math.atan2(e[1],e[0]):Math.atan2(-n[0],n[1]))*Ot,this.translate=[t.e,t.f],this.scale=[i,a],this.skew=a?Math.atan2(r,a)*Ot:0}function ha(t,e){return t[0]*e[0]+t[1]*e[1]}function fa(t){var e=Math.sqrt(ha(t,t));return e&&(t[0]/=e,t[1]/=e),e}a.ease=function(t){var e=t.indexOf("-"),n=e>=0?t.slice(0,e):t,i=e>=0?t.slice(e+1):"in";return n=Qr.get(n)||Kr,function(t){return function(e){return e<=0?0:e>=1?1:t(e)}}((i=ta.get(i)||N)(n.apply(null,o.call(arguments,1))))},a.interpolateHcl=function(t,e){t=a.hcl(t),e=a.hcl(e);var n=t.h,i=t.c,r=t.l,o=e.h-n,s=e.c-i,l=e.l-r;isNaN(s)&&(s=0,i=isNaN(i)?e.c:i);isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Xt(n+o*t,i+s*t,r+l*t)+""}},a.interpolateHsl=function(t,e){t=a.hsl(t),e=a.hsl(e);var n=t.h,i=t.s,r=t.l,o=e.h-n,s=e.s-i,l=e.l-r;isNaN(s)&&(s=0,i=isNaN(i)?e.s:i);isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return $t(n+o*t,i+s*t,r+l*t)+""}},a.interpolateLab=function(t,e){t=a.lab(t),e=a.lab(e);var n=t.l,i=t.a,r=t.b,o=e.l-n,s=e.a-i,l=e.b-r;return function(t){return ie(n+o*t,i+s*t,r+l*t)+""}},a.interpolateRound=ca,a.transform=function(t){var e=l.createElementNS(a.ns.prefix.svg,"g");return(a.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new da(n?n.matrix:ma)})(t)},da.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ma={a:1,b:0,c:0,d:1,e:0,f:0};function pa(t){return t.length?t.pop()+",":""}function ga(t,e){var n=[],i=[];return t=a.transform(t),e=a.transform(e),function(t,e,n,i){if(t[0]!==e[0]||t[1]!==e[1]){var r=n.push("translate(",null,",",null,")");i.push({i:r-4,x:Gr(t[0],e[0])},{i:r-2,x:Gr(t[1],e[1])})}else(e[0]||e[1])&&n.push("translate("+e+")")}(t.translate,e.translate,n,i),function(t,e,n,i){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(pa(n)+"rotate(",null,")")-2,x:Gr(t,e)})):e&&n.push(pa(n)+"rotate("+e+")")}(t.rotate,e.rotate,n,i),function(t,e,n,i){t!==e?i.push({i:n.push(pa(n)+"skewX(",null,")")-2,x:Gr(t,e)}):e&&n.push(pa(n)+"skewX("+e+")")}(t.skew,e.skew,n,i),function(t,e,n,i){if(t[0]!==e[0]||t[1]!==e[1]){var r=n.push(pa(n)+"scale(",null,",",null,")");i.push({i:r-4,x:Gr(t[0],e[0])},{i:r-2,x:Gr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(pa(n)+"scale("+e+")")}(t.scale,e.scale,n,i),t=e=null,function(t){for(var e,r=-1,a=i.length;++r<a;)n[(e=i[r]).i]=e.x(t);return n.join("")}}function va(t,e){return e=(e-=t=+t)||1/e,function(n){return(n-t)/e}}function _a(t,e){return e=(e-=t=+t)||1/e,function(n){return Math.max(0,Math.min(1,(n-t)/e))}}function ya(t){for(var e=t.source,n=t.target,i=function(t,e){if(t===e)return t;var n=ba(t),i=ba(e),r=n.pop(),a=i.pop(),o=null;for(;r===a;)o=r,r=n.pop(),a=i.pop();return o}(e,n),r=[e];e!==i;)e=e.parent,r.push(e);for(var a=r.length;n!==i;)r.splice(a,0,n),n=n.parent;return r}function ba(t){for(var e=[],n=t.parent;null!=n;)e.push(t),t=n,n=n.parent;return e.push(t),e}function Ma(t){t.fixed|=2}function xa(t){t.fixed&=-7}function wa(t){t.fixed|=4,t.px=t.x,t.py=t.y}function ka(t){t.fixed&=-5}a.interpolateTransform=ga,a.layout={},a.layout.bundle=function(){return function(t){for(var e=[],n=-1,i=t.length;++n<i;)e.push(ya(t[n]));return e}},a.layout.chord=function(){var t,e,n,i,r,o,s,l={},u=0;function c(){var l,c,h,f,m,p={},g=[],v=a.range(i),_=[];for(t=[],e=[],l=0,f=-1;++f<i;){for(c=0,m=-1;++m<i;)c+=n[f][m];g.push(c),_.push(a.range(i)),l+=c}for(r&&v.sort(function(t,e){return r(g[t],g[e])}),o&&_.forEach(function(t,e){t.sort(function(t,i){return o(n[e][t],n[e][i])})}),l=(Dt-u*i)/l,c=0,f=-1;++f<i;){for(h=c,m=-1;++m<i;){var y=v[f],b=_[y][m],M=n[y][b],x=c,w=c+=M*l;p[y+"-"+b]={index:y,subindex:b,startAngle:x,endAngle:w,value:M}}e[y]={index:y,startAngle:h,endAngle:c,value:g[y]},c+=u}for(f=-1;++f<i;)for(m=f-1;++m<i;){var k=p[f+"-"+m],L=p[m+"-"+f];(k.value||L.value)&&t.push(k.value<L.value?{source:L,target:k}:{source:k,target:L})}s&&d()}function d(){t.sort(function(t,e){return s((t.source.value+t.target.value)/2,(e.source.value+e.target.value)/2)})}return l.matrix=function(r){return arguments.length?(i=(n=r)&&n.length,t=e=null,l):n},l.padding=function(n){return arguments.length?(u=n,t=e=null,l):u},l.sortGroups=function(n){return arguments.length?(r=n,t=e=null,l):r},l.sortSubgroups=function(e){return arguments.length?(o=e,t=null,l):o},l.sortChords=function(e){return arguments.length?(s=e,t&&d(),l):s},l.chords=function(){return t||c(),t},l.groups=function(){return e||c(),e},l},a.layout.force=function(){var t,e,n,i,r,o,s={},l=a.dispatch("start","tick","end"),u=[1,1],c=.9,d=La,h=Sa,f=-30,m=Ta,p=.1,g=.64,v=[],_=[];function y(t){return function(e,n,i,r){if(e.point!==t){var a=e.cx-t.x,o=e.cy-t.y,s=r-n,l=a*a+o*o;if(s*s/g<l){if(l<m){var u=e.charge/l;t.px-=a*u,t.py-=o*u}return!0}if(e.point&&l&&l<m){u=e.pointCharge/l;t.px-=a*u,t.py-=o*u}}return!e.charge}}function b(t){t.px=a.event.x,t.py=a.event.y,s.resume()}return s.tick=function(){if((n*=.99)<.005)return t=null,l.end({type:"end",alpha:n=0}),!0;var e,s,d,h,m,g,b,M,x,w=v.length,k=_.length;for(s=0;s<k;++s)h=(d=_[s]).source,(g=(M=(m=d.target).x-h.x)*M+(x=m.y-h.y)*x)&&(M*=g=n*r[s]*((g=Math.sqrt(g))-i[s])/g,x*=g,m.x-=M*(b=h.weight+m.weight?h.weight/(h.weight+m.weight):.5),m.y-=x*b,h.x+=M*(b=1-b),h.y+=x*b);if((b=n*p)&&(M=u[0]/2,x=u[1]/2,s=-1,b))for(;++s<w;)(d=v[s]).x+=(M-d.x)*b,d.y+=(x-d.y)*b;if(f)for(!function t(e,n,i){var r=0,a=0;e.charge=0;if(!e.leaf)for(var o,s=e.nodes,l=s.length,u=-1;++u<l;)null!=(o=s[u])&&(t(o,n,i),e.charge+=o.charge,r+=o.charge*o.cx,a+=o.charge*o.cy);if(e.point){e.leaf||(e.point.x+=Math.random()-.5,e.point.y+=Math.random()-.5);var c=n*i[e.point.index];e.charge+=e.pointCharge=c,r+=c*e.point.x,a+=c*e.point.y}e.cx=r/e.charge;e.cy=a/e.charge}(e=a.geom.quadtree(v),n,o),s=-1;++s<w;)(d=v[s]).fixed||e.visit(y(d));for(s=-1;++s<w;)(d=v[s]).fixed?(d.x=d.px,d.y=d.py):(d.x-=(d.px-(d.px=d.x))*c,d.y-=(d.py-(d.py=d.y))*c);l.tick({type:"tick",alpha:n})},s.nodes=function(t){return arguments.length?(v=t,s):v},s.links=function(t){return arguments.length?(_=t,s):_},s.size=function(t){return arguments.length?(u=t,s):u},s.linkDistance=function(t){return arguments.length?(d="function"==typeof t?t:+t,s):d},s.distance=s.linkDistance,s.linkStrength=function(t){return arguments.length?(h="function"==typeof t?t:+t,s):h},s.friction=function(t){return arguments.length?(c=+t,s):c},s.charge=function(t){return arguments.length?(f="function"==typeof t?t:+t,s):f},s.chargeDistance=function(t){return arguments.length?(m=t*t,s):Math.sqrt(m)},s.gravity=function(t){return arguments.length?(p=+t,s):p},s.theta=function(t){return arguments.length?(g=t*t,s):Math.sqrt(g)},s.alpha=function(e){return arguments.length?(e=+e,n?e>0?n=e:(t.c=null,t.t=NaN,t=null,l.end({type:"end",alpha:n=0})):e>0&&(l.start({type:"start",alpha:n=e}),t=Te(s.tick)),s):n},s.start=function(){var t,e,n,a=v.length,l=_.length,c=u[0],m=u[1];for(t=0;t<a;++t)(n=v[t]).index=t,n.weight=0;for(t=0;t<l;++t)"number"==typeof(n=_[t]).source&&(n.source=v[n.source]),"number"==typeof n.target&&(n.target=v[n.target]),++n.source.weight,++n.target.weight;for(t=0;t<a;++t)n=v[t],isNaN(n.x)&&(n.x=p("x",c)),isNaN(n.y)&&(n.y=p("y",m)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(i=[],"function"==typeof d)for(t=0;t<l;++t)i[t]=+d.call(this,_[t],t);else for(t=0;t<l;++t)i[t]=d;if(r=[],"function"==typeof h)for(t=0;t<l;++t)r[t]=+h.call(this,_[t],t);else for(t=0;t<l;++t)r[t]=h;if(o=[],"function"==typeof f)for(t=0;t<a;++t)o[t]=+f.call(this,v[t],t);else for(t=0;t<a;++t)o[t]=f;function p(n,i){if(!e){for(e=new Array(a),u=0;u<a;++u)e[u]=[];for(u=0;u<l;++u){var r=_[u];e[r.source.index].push(r.target),e[r.target.index].push(r.source)}}for(var o,s=e[t],u=-1,c=s.length;++u<c;)if(!isNaN(o=s[u][n]))return o;return Math.random()*i}return s.resume()},s.resume=function(){return s.alpha(.1)},s.stop=function(){return s.alpha(0)},s.drag=function(){if(e||(e=a.behavior.drag().origin(N).on("dragstart.force",Ma).on("drag.force",b).on("dragend.force",xa)),!arguments.length)return e;this.on("mouseover.force",wa).on("mouseout.force",ka).call(e)},a.rebind(s,l,"on")};var La=20,Sa=1,Ta=1/0;function Ya(t,e){return a.rebind(t,e,"sort","children","value"),t.nodes=t,t.links=ja,t}function Da(t,e){for(var n=[t];null!=(t=n.pop());)if(e(t),(r=t.children)&&(i=r.length))for(var i,r;--i>=0;)n.push(r[i])}function Ca(t,e){for(var n=[t],i=[];null!=(t=n.pop());)if(i.push(t),(a=t.children)&&(r=a.length))for(var r,a,o=-1;++o<r;)n.push(a[o]);for(;null!=(t=i.pop());)e(t)}function Ea(t){return t.children}function Aa(t){return t.value}function Oa(t,e){return e.value-t.value}function ja(t){return a.merge(t.map(function(t){return(t.children||[]).map(function(e){return{source:t,target:e}})}))}a.layout.hierarchy=function(){var t=Oa,e=Ea,n=Aa;function i(r){var a,o=[r],s=[];for(r.depth=0;null!=(a=o.pop());)if(s.push(a),(u=e.call(i,a,a.depth))&&(l=u.length)){for(var l,u,c;--l>=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=u}else n&&(a.value=+n.call(i,a,a.depth)||0),delete a.children;return Ca(r,function(e){var i,r;t&&(i=e.children)&&i.sort(t),n&&(r=e.parent)&&(r.value+=e.value)}),s}return i.sort=function(e){return arguments.length?(t=e,i):t},i.children=function(t){return arguments.length?(e=t,i):e},i.value=function(t){return arguments.length?(n=t,i):n},i.revalue=function(t){return n&&(Da(t,function(t){t.children&&(t.value=0)}),Ca(t,function(t){var e;t.children||(t.value=+n.call(i,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},i},a.layout.partition=function(){var t=a.layout.hierarchy(),e=[1,1];function n(n,i){var r=t.call(this,n,i);return function t(e,n,i,r){var a=e.children;if(e.x=n,e.y=e.depth*r,e.dx=i,e.dy=r,a&&(o=a.length)){var o,s,l,u=-1;for(i=e.value?i/e.value:0;++u<o;)t(s=a[u],n,l=s.value*i,r),n+=l}}(r[0],0,e[0],e[1]/function t(e){var n=e.children,i=0;if(n&&(r=n.length))for(var r,a=-1;++a<r;)i=Math.max(i,t(n[a]));return 1+i}(r[0])),r}return n.size=function(t){return arguments.length?(e=t,n):e},Ya(n,t)},a.layout.pie=function(){var t=Number,e=Na,n=0,i=Dt,r=0;function o(s){var l,u=s.length,c=s.map(function(e,n){return+t.call(o,e,n)}),d=+("function"==typeof n?n.apply(this,arguments):n),h=("function"==typeof i?i.apply(this,arguments):i)-d,f=Math.min(Math.abs(h)/u,+("function"==typeof r?r.apply(this,arguments):r)),m=f*(h<0?-1:1),p=a.sum(c),g=p?(h-u*m)/p:0,v=a.range(u),_=[];return null!=e&&v.sort(e===Na?function(t,e){return c[e]-c[t]}:function(t,n){return e(s[t],s[n])}),v.forEach(function(t){_[t]={data:s[t],value:l=c[t],startAngle:d,endAngle:d+=l*g+m,padAngle:f}}),_}return o.value=function(e){return arguments.length?(t=e,o):t},o.sort=function(t){return arguments.length?(e=t,o):e},o.startAngle=function(t){return arguments.length?(n=t,o):n},o.endAngle=function(t){return arguments.length?(i=t,o):i},o.padAngle=function(t){return arguments.length?(r=t,o):r},o};var Na={};function Ha(t){return t.x}function Va(t){return t.y}function Pa(t,e,n){t.y0=e,t.y=n}a.layout.stack=function(){var t=N,e=Ra,n=Wa,i=Pa,r=Ha,o=Va;function s(l,u){if(!(f=l.length))return l;var c=l.map(function(e,n){return t.call(s,e,n)}),d=c.map(function(t){return t.map(function(t,e){return[r.call(s,t,e),o.call(s,t,e)]})}),h=e.call(s,d,u);c=a.permute(c,h),d=a.permute(d,h);var f,m,p,g,v=n.call(s,d,u),_=c[0].length;for(p=0;p<_;++p)for(i.call(s,c[0][p],g=v[p],d[0][p][1]),m=1;m<f;++m)i.call(s,c[m][p],g+=d[m-1][p][1],d[m][p][1]);return l}return s.values=function(e){return arguments.length?(t=e,s):t},s.order=function(t){return arguments.length?(e="function"==typeof t?t:Fa.get(t)||Ra,s):e},s.offset=function(t){return arguments.length?(n="function"==typeof t?t:Ia.get(t)||Wa,s):n},s.x=function(t){return arguments.length?(r=t,s):r},s.y=function(t){return arguments.length?(o=t,s):o},s.out=function(t){return arguments.length?(i=t,s):i},s};var Fa=a.map({"inside-out":function(t){var e,n,i=t.length,r=t.map(za),o=t.map(Ba),s=a.range(i).sort(function(t,e){return r[t]-r[e]}),l=0,u=0,c=[],d=[];for(e=0;e<i;++e)n=s[e],l<u?(l+=o[n],c.push(n)):(u+=o[n],d.push(n));return d.reverse().concat(c)},reverse:function(t){return a.range(t.length).reverse()},default:Ra}),Ia=a.map({silhouette:function(t){var e,n,i,r=t.length,a=t[0].length,o=[],s=0,l=[];for(n=0;n<a;++n){for(e=0,i=0;e<r;e++)i+=t[e][n][1];i>s&&(s=i),o.push(i)}for(n=0;n<a;++n)l[n]=(s-o[n])/2;return l},wiggle:function(t){var e,n,i,r,a,o,s,l,u,c=t.length,d=t[0],h=d.length,f=[];for(f[0]=l=u=0,n=1;n<h;++n){for(e=0,r=0;e<c;++e)r+=t[e][n][1];for(e=0,a=0,s=d[n][0]-d[n-1][0];e<c;++e){for(i=0,o=(t[e][n][1]-t[e][n-1][1])/(2*s);i<e;++i)o+=(t[i][n][1]-t[i][n-1][1])/s;a+=o*t[e][n][1]}f[n]=l-=r?a/r*s:0,l<u&&(u=l)}for(n=0;n<h;++n)f[n]-=u;return f},expand:function(t){var e,n,i,r=t.length,a=t[0].length,o=1/r,s=[];for(n=0;n<a;++n){for(e=0,i=0;e<r;e++)i+=t[e][n][1];if(i)for(e=0;e<r;e++)t[e][n][1]/=i;else for(e=0;e<r;e++)t[e][n][1]=o}for(n=0;n<a;++n)s[n]=0;return s},zero:Wa});function Ra(t){return a.range(t.length)}function Wa(t){for(var e=-1,n=t[0].length,i=[];++e<n;)i[e]=0;return i}function za(t){for(var e,n=1,i=0,r=t[0][1],a=t.length;n<a;++n)(e=t[n][1])>r&&(i=n,r=e);return i}function Ba(t){return t.reduce(Ua,0)}function Ua(t,e){return t+e[1]}function Ga(t,e){return $a(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function $a(t,e){for(var n=-1,i=+t[0],r=(t[1]-i)/e,a=[];++n<=e;)a[n]=r*n+i;return a}function qa(t){return[a.min(t),a.max(t)]}function Ja(t,e){return t.value-e.value}function Xa(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Za(t,e){t._pack_next=e,e._pack_prev=t}function Ka(t,e){var n=e.x-t.x,i=e.y-t.y,r=t.r+e.r;return.999*r*r>n*n+i*i}function Qa(t){if((e=t.children)&&(l=e.length)){var e,n,i,r,a,o,s,l,u=1/0,c=-1/0,d=1/0,h=-1/0;if(e.forEach(to),(n=e[0]).x=-n.r,n.y=0,y(n),l>1&&((i=e[1]).x=i.r,i.y=0,y(i),l>2))for(no(n,i,r=e[2]),y(r),Xa(n,r),n._pack_prev=r,Xa(r,i),i=n._pack_next,a=3;a<l;a++){no(n,i,r=e[a]);var f=0,m=1,p=1;for(o=i._pack_next;o!==i;o=o._pack_next,m++)if(Ka(o,r)){f=1;break}if(1==f)for(s=n._pack_prev;s!==o._pack_prev&&!Ka(s,r);s=s._pack_prev,p++);f?(m<p||m==p&&i.r<n.r?Za(n,i=o):Za(n=s,i),a--):(Xa(n,r),i=r,y(r))}var g=(u+c)/2,v=(d+h)/2,_=0;for(a=0;a<l;a++)(r=e[a]).x-=g,r.y-=v,_=Math.max(_,r.r+Math.sqrt(r.x*r.x+r.y*r.y));t.r=_,e.forEach(eo)}function y(t){u=Math.min(t.x-t.r,u),c=Math.max(t.x+t.r,c),d=Math.min(t.y-t.r,d),h=Math.max(t.y+t.r,h)}}function to(t){t._pack_next=t._pack_prev=t}function eo(t){delete t._pack_next,delete t._pack_prev}function no(t,e,n){var i=t.r+n.r,r=e.x-t.x,a=e.y-t.y;if(i&&(r||a)){var o=e.r+n.r,s=r*r+a*a,l=.5+((i*=i)-(o*=o))/(2*s),u=Math.sqrt(Math.max(0,2*o*(i+s)-(i-=s)*i-o*o))/(2*s);n.x=t.x+l*r+u*a,n.y=t.y+l*a-u*r}else n.x=t.x+i,n.y=t.y}function io(t,e){return t.parent==e.parent?1:2}function ro(t){var e=t.children;return e.length?e[0]:t.t}function ao(t){var e,n=t.children;return(e=n.length)?n[e-1]:t.t}function oo(t,e,n){var i=n/(e.i-t.i);e.c-=i,e.s+=n,t.c+=i,e.z+=n,e.m+=n}function so(t,e,n){return t.a.parent===e.parent?t.a:n}function lo(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function uo(t,e){var n=t.x+e[3],i=t.y+e[0],r=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return r<0&&(n+=r/2,r=0),a<0&&(i+=a/2,a=0),{x:n,y:i,dx:r,dy:a}}function co(t){var e=t[0],n=t[t.length-1];return e<n?[e,n]:[n,e]}function ho(t){return t.rangeExtent?t.rangeExtent():co(t.range())}function fo(t,e,n,i){var r=n(t[0],t[1]),a=i(e[0],e[1]);return function(t){return a(r(t))}}function mo(t,e){var n,i=0,r=t.length-1,a=t[i],o=t[r];return o<a&&(n=i,i=r,r=n,n=a,a=o,o=n),t[i]=e.floor(a),t[r]=e.ceil(o),t}function po(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:go}a.layout.histogram=function(){var t=!0,e=Number,n=qa,i=Ga;function r(r,o){for(var s,l,u=[],c=r.map(e,this),d=n.call(this,c,o),h=i.call(this,d,c,o),f=(o=-1,c.length),m=h.length-1,p=t?1:1/f;++o<m;)(s=u[o]=[]).dx=h[o+1]-(s.x=h[o]),s.y=0;if(m>0)for(o=-1;++o<f;)(l=c[o])>=d[0]&&l<=d[1]&&((s=u[a.bisect(h,l,1,m)-1]).y+=p,s.push(r[o]));return u}return r.value=function(t){return arguments.length?(e=t,r):e},r.range=function(t){return arguments.length?(n=ye(t),r):n},r.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return $a(e,t)}:ye(t),r):i},r.frequency=function(e){return arguments.length?(t=!!e,r):t},r},a.layout.pack=function(){var t,e=a.layout.hierarchy().sort(Ja),n=0,i=[1,1];function r(r,a){var o=e.call(this,r,a),s=o[0],l=i[0],u=i[1],c=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(s.x=s.y=0,Ca(s,function(t){t.r=+c(t.value)}),Ca(s,Qa),n){var d=n*(t?1:Math.max(2*s.r/l,2*s.r/u))/2;Ca(s,function(t){t.r+=d}),Ca(s,Qa),Ca(s,function(t){t.r-=d})}return function t(e,n,i,r){var a=e.children;e.x=n+=r*e.x;e.y=i+=r*e.y;e.r*=r;if(a)for(var o=-1,s=a.length;++o<s;)t(a[o],n,i,r)}(s,l/2,u/2,t?1:1/Math.max(2*s.r/l,2*s.r/u)),o}return r.size=function(t){return arguments.length?(i=t,r):i},r.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,r):t},r.padding=function(t){return arguments.length?(n=+t,r):n},Ya(r,e)},a.layout.tree=function(){var t=a.layout.hierarchy().sort(null).value(null),e=io,n=[1,1],i=null;function r(r,a){var u=t.call(this,r,a),c=u[0],d=function(t){var e,n={A:null,children:[t]},i=[n];for(;null!=(e=i.pop());)for(var r,a=e.children,o=0,s=a.length;o<s;++o)i.push((a[o]=r={_:a[o],parent:e,children:(r=a[o].children)&&r.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=r);return n.children[0]}(c);if(Ca(d,o),d.parent.m=-d.z,Da(d,s),i)Da(c,l);else{var h=c,f=c,m=c;Da(c,function(t){t.x<h.x&&(h=t),t.x>f.x&&(f=t),t.depth>m.depth&&(m=t)});var p=e(h,f)/2-h.x,g=n[0]/(f.x+e(f,h)/2+p),v=n[1]/(m.depth||1);Da(c,function(t){t.x=(t.x+p)*g,t.y=t.depth*v})}return u}function o(t){var n=t.children,i=t.parent.children,r=t.i?i[t.i-1]:null;if(n.length){!function(t){var e,n=0,i=0,r=t.children,a=r.length;for(;--a>=0;)(e=r[a]).z+=n,e.m+=n,n+=e.s+(i+=e.c)}(t);var a=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+e(t._,r._),t.m=t.z-a):t.z=a}else r&&(t.z=r.z+e(t._,r._));t.parent.A=function(t,n,i){if(n){for(var r,a=t,o=t,s=n,l=a.parent.children[0],u=a.m,c=o.m,d=s.m,h=l.m;s=ao(s),a=ro(a),s&&a;)l=ro(l),(o=ao(o)).a=t,(r=s.z+d-a.z-u+e(s._,a._))>0&&(oo(so(s,t,i),t,r),u+=r,c+=r),d+=s.m,u+=a.m,h+=l.m,c+=o.m;s&&!ao(o)&&(o.t=s,o.m+=d-c),a&&!ro(l)&&(l.t=a,l.m+=u-h,i=t)}return i}(t,r,t.parent.A||i[0])}function s(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function l(t){t.x*=n[0],t.y=t.depth*n[1]}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(t){return arguments.length?(i=null==(n=t)?l:null,r):i?null:n},r.nodeSize=function(t){return arguments.length?(i=null==(n=t)?null:l,r):i?n:null},Ya(r,t)},a.layout.cluster=function(){var t=a.layout.hierarchy().sort(null).value(null),e=io,n=[1,1],i=!1;function r(r,o){var s,l=t.call(this,r,o),u=l[0],c=0;Ca(u,function(t){var n=t.children;n&&n.length?(t.x=function(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}(n),t.y=function(t){return 1+a.max(t,function(t){return t.y})}(n)):(t.x=s?c+=e(t,s):0,t.y=0,s=t)});var d=function t(e){var n=e.children;return n&&n.length?t(n[0]):e}(u),h=function t(e){var n,i=e.children;return i&&(n=i.length)?t(i[n-1]):e}(u),f=d.x-e(d,h)/2,m=h.x+e(h,d)/2;return Ca(u,i?function(t){t.x=(t.x-u.x)*n[0],t.y=(u.y-t.y)*n[1]}:function(t){t.x=(t.x-f)/(m-f)*n[0],t.y=(1-(u.y?t.y/u.y:1))*n[1]}),l}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(t){return arguments.length?(i=null==(n=t),r):i?null:n},r.nodeSize=function(t){return arguments.length?(i=null!=(n=t),r):i?n:null},Ya(r,t)},a.layout.treemap=function(){var t,e=a.layout.hierarchy(),n=Math.round,i=[1,1],r=null,o=lo,s=!1,l="squarify",u=.5*(1+Math.sqrt(5));function c(t,e){for(var n,i,r=-1,a=t.length;++r<a;)i=(n=t[r]).value*(e<0?0:e),n.area=isNaN(i)||i<=0?0:i}function d(t){var e=t.children;if(e&&e.length){var n,i,r,a=o(t),s=[],u=e.slice(),h=1/0,p="slice"===l?a.dx:"dice"===l?a.dy:"slice-dice"===l?1&t.depth?a.dy:a.dx:Math.min(a.dx,a.dy);for(c(u,a.dx*a.dy/t.value),s.area=0;(r=u.length)>0;)s.push(n=u[r-1]),s.area+=n.area,"squarify"!==l||(i=f(s,p))<=h?(u.pop(),h=i):(s.area-=s.pop().area,m(s,p,a,!1),p=Math.min(a.dx,a.dy),s.length=s.area=0,h=1/0);s.length&&(m(s,p,a,!0),s.length=s.area=0),e.forEach(d)}}function h(t){var e=t.children;if(e&&e.length){var n,i=o(t),r=e.slice(),a=[];for(c(r,i.dx*i.dy/t.value),a.area=0;n=r.pop();)a.push(n),a.area+=n.area,null!=n.z&&(m(a,n.z?i.dx:i.dy,i,!r.length),a.length=a.area=0);e.forEach(h)}}function f(t,e){for(var n,i=t.area,r=0,a=1/0,o=-1,s=t.length;++o<s;)(n=t[o].area)&&(n<a&&(a=n),n>r&&(r=n));return e*=e,(i*=i)?Math.max(e*r*u/i,i/(e*a*u)):1/0}function m(t,e,i,r){var a,o=-1,s=t.length,l=i.x,u=i.y,c=e?n(t.area/e):0;if(e==i.dx){for((r||c>i.dy)&&(c=i.dy);++o<s;)(a=t[o]).x=l,a.y=u,a.dy=c,l+=a.dx=Math.min(i.x+i.dx-l,c?n(a.area/c):0);a.z=!0,a.dx+=i.x+i.dx-l,i.y+=c,i.dy-=c}else{for((r||c>i.dx)&&(c=i.dx);++o<s;)(a=t[o]).x=l,a.y=u,a.dx=c,u+=a.dy=Math.min(i.y+i.dy-u,c?n(a.area/c):0);a.z=!1,a.dy+=i.y+i.dy-u,i.x+=c,i.dx-=c}}function p(n){var r=t||e(n),a=r[0];return a.x=a.y=0,a.value?(a.dx=i[0],a.dy=i[1]):a.dx=a.dy=0,t&&e.revalue(a),c([a],a.dx*a.dy/a.value),(t?h:d)(a),s&&(t=r),r}return p.size=function(t){return arguments.length?(i=t,p):i},p.padding=function(t){if(!arguments.length)return r;function e(e){return uo(e,t)}var n;return o=null==(r=t)?lo:"function"==(n=typeof t)?function(e){var n=t.call(p,e,e.depth);return null==n?lo(e):uo(e,"number"==typeof n?[n,n,n,n]:n)}:"number"===n?(t=[t,t,t,t],e):e,p},p.round=function(t){return arguments.length?(n=t?Math.round:Number,p):n!=Number},p.sticky=function(e){return arguments.length?(s=e,t=null,p):s},p.ratio=function(t){return arguments.length?(u=t,p):u},p.mode=function(t){return arguments.length?(l=t+"",p):l},Ya(p,e)},a.random={normal:function(t,e){var n=arguments.length;return n<2&&(e=1),n<1&&(t=0),function(){var n,i,r;do{r=(n=2*Math.random()-1)*n+(i=2*Math.random()-1)*i}while(!r||r>1);return t+e*n*Math.sqrt(-2*Math.log(r)/r)}},logNormal:function(){var t=a.random.normal.apply(a,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=a.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;n<t;n++)e+=Math.random();return e}}},a.scale={};var go={floor:N,ceil:N};function vo(t,e,n,i){var r=[],o=[],s=0,l=Math.min(t.length,e.length)-1;for(t[l]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<=l;)r.push(n(t[s-1],t[s])),o.push(i(e[s-1],e[s]));return function(e){var n=a.bisect(t,e,1,l)-1;return o[n](r[n](e))}}function _o(t,e){return a.rebind(t,e,"range","rangeRound","interpolate","clamp")}function yo(t,e){return mo(t,po(bo(t,e)[2])),mo(t,po(bo(t,e)[2])),t}function bo(t,e){null==e&&(e=10);var n=co(t),i=n[1]-n[0],r=Math.pow(10,Math.floor(Math.log(i/e)/Math.LN10)),a=e/i*r;return a<=.15?r*=10:a<=.35?r*=5:a<=.75&&(r*=2),n[0]=Math.ceil(n[0]/r)*r,n[1]=Math.floor(n[1]/r)*r+.5*r,n[2]=r,n}function Mo(t,e){return a.range.apply(a,bo(t,e))}function xo(t,e,n){var i=bo(t,e);if(n){var r=Oe.exec(n);if(r.shift(),"s"===r[8]){var o=a.formatPrefix(Math.max(x(i[0]),x(i[1])));return r[7]||(r[7]="."+ko(o.scale(i[2]))),r[8]="f",n=a.format(r.join("")),function(t){return n(o.scale(t))+o.symbol}}r[7]||(r[7]="."+function(t,e){var n=ko(e[2]);return t in wo?Math.abs(n-ko(Math.max(x(e[0]),x(e[1]))))+ +("e"!==t):n-2*("%"===t)}(r[8],i)),n=r.join("")}else n=",."+ko(i[2])+"f";return a.format(n)}a.scale.linear=function(){return function t(e,n,i,r){var a,o;function s(){var t=Math.min(e.length,n.length)>2?vo:fo,s=r?_a:va;return a=t(e,n,s,i),o=t(n,e,s,Xr),l}function l(t){return a(t)}l.invert=function(t){return o(t)};l.domain=function(t){return arguments.length?(e=t.map(Number),s()):e};l.range=function(t){return arguments.length?(n=t,s()):n};l.rangeRound=function(t){return l.range(t).interpolate(ca)};l.clamp=function(t){return arguments.length?(r=t,s()):r};l.interpolate=function(t){return arguments.length?(i=t,s()):i};l.ticks=function(t){return Mo(e,t)};l.tickFormat=function(t,n){return xo(e,t,n)};l.nice=function(t){return yo(e,t),s()};l.copy=function(){return t(e,n,i,r)};return s()}([0,1],[0,1],Xr,!1)};var wo={s:1,g:1,p:1,r:1,e:1};function ko(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}a.scale.log=function(){return function t(e,n,i,r){function o(t){return(i?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function s(t){return i?Math.pow(n,t):-Math.pow(n,-t)}function l(t){return e(o(t))}l.invert=function(t){return s(e.invert(t))};l.domain=function(t){return arguments.length?(i=t[0]>=0,e.domain((r=t.map(Number)).map(o)),l):r};l.base=function(t){return arguments.length?(n=+t,e.domain(r.map(o)),l):n};l.nice=function(){var t=mo(r.map(o),i?Math:So);return e.domain(t),r=t.map(s),l};l.ticks=function(){var t=co(r),e=[],a=t[0],l=t[1],u=Math.floor(o(a)),c=Math.ceil(o(l)),d=n%1?2:n;if(isFinite(c-u)){if(i){for(;u<c;u++)for(var h=1;h<d;h++)e.push(s(u)*h);e.push(s(u))}else for(e.push(s(u));u++<c;)for(var h=d-1;h>0;h--)e.push(s(u)*h);for(u=0;e[u]<a;u++);for(c=e.length;e[c-1]>l;c--);e=e.slice(u,c)}return e};l.tickFormat=function(t,e){if(!arguments.length)return Lo;arguments.length<2?e=Lo:"function"!=typeof e&&(e=a.format(e));var i=Math.max(1,n*t/l.ticks().length);return function(t){var r=t/s(Math.round(o(t)));return r*n<n-.5&&(r*=n),r<=i?e(t):""}};l.copy=function(){return t(e.copy(),n,i,r)};return _o(l,e)}(a.scale.linear().domain([0,1]),10,!0,[1,10])};var Lo=a.format(".0e"),So={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};function To(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}a.scale.pow=function(){return function t(e,n,i){var r=To(n),a=To(1/n);function o(t){return e(r(t))}o.invert=function(t){return a(e.invert(t))};o.domain=function(t){return arguments.length?(e.domain((i=t.map(Number)).map(r)),o):i};o.ticks=function(t){return Mo(i,t)};o.tickFormat=function(t,e){return xo(i,t,e)};o.nice=function(t){return o.domain(yo(i,t))};o.exponent=function(t){return arguments.length?(r=To(n=t),a=To(1/n),e.domain(i.map(r)),o):n};o.copy=function(){return t(e.copy(),n,i)};return _o(o,e)}(a.scale.linear(),1,[0,1])},a.scale.sqrt=function(){return a.scale.pow().exponent(.5)},a.scale.ordinal=function(){return function t(e,n){var i,r,o;function s(t){return r[((i.get(t)||("range"===n.t?i.set(t,e.push(t)):NaN))-1)%r.length]}function l(t,n){return a.range(e.length).map(function(e){return t+n*e})}s.domain=function(t){if(!arguments.length)return e;e=[],i=new k;for(var r,a=-1,o=t.length;++a<o;)i.has(r=t[a])||i.set(r,e.push(r));return s[n.t].apply(s,n.a)};s.range=function(t){return arguments.length?(r=t,o=0,n={t:"range",a:arguments},s):r};s.rangePoints=function(t,i){arguments.length<2&&(i=0);var a=t[0],u=t[1],c=e.length<2?(a=(a+u)/2,0):(u-a)/(e.length-1+i);return r=l(a+c*i/2,c),o=0,n={t:"rangePoints",a:arguments},s};s.rangeRoundPoints=function(t,i){arguments.length<2&&(i=0);var a=t[0],u=t[1],c=e.length<2?(a=u=Math.round((a+u)/2),0):(u-a)/(e.length-1+i)|0;return r=l(a+Math.round(c*i/2+(u-a-(e.length-1+i)*c)/2),c),o=0,n={t:"rangeRoundPoints",a:arguments},s};s.rangeBands=function(t,i,a){arguments.length<2&&(i=0),arguments.length<3&&(a=i);var u=t[1]<t[0],c=t[u-0],d=t[1-u],h=(d-c)/(e.length-i+2*a);return r=l(c+h*a,h),u&&r.reverse(),o=h*(1-i),n={t:"rangeBands",a:arguments},s};s.rangeRoundBands=function(t,i,a){arguments.length<2&&(i=0),arguments.length<3&&(a=i);var u=t[1]<t[0],c=t[u-0],d=t[1-u],h=Math.floor((d-c)/(e.length-i+2*a));return r=l(c+Math.round((d-c-(e.length-i)*h)/2),h),u&&r.reverse(),o=Math.round(h*(1-i)),n={t:"rangeRoundBands",a:arguments},s};s.rangeBand=function(){return o};s.rangeExtent=function(){return co(n.a[0])};s.copy=function(){return t(e,n)};return s.domain(e)}([],{t:"range",a:[[]]})},a.scale.category10=function(){return a.scale.ordinal().range(Yo)},a.scale.category20=function(){return a.scale.ordinal().range(Do)},a.scale.category20b=function(){return a.scale.ordinal().range(Co)},a.scale.category20c=function(){return a.scale.ordinal().range(Eo)};var Yo=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(ce),Do=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(ce),Co=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(ce),Eo=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(ce);function Ao(){return 0}a.scale.quantile=function(){return function t(e,n){var i;function r(){var t=0,r=n.length;for(i=[];++t<r;)i[t-1]=a.quantile(e,t/r);return o}function o(t){if(!isNaN(t=+t))return n[a.bisect(i,t)]}o.domain=function(t){return arguments.length?(e=t.map(v).filter(_).sort(g),r()):e};o.range=function(t){return arguments.length?(n=t,r()):n};o.quantiles=function(){return i};o.invertExtent=function(t){return(t=n.indexOf(t))<0?[NaN,NaN]:[t>0?i[t-1]:e[0],t<i.length?i[t]:e[e.length-1]]};o.copy=function(){return t(e,n)};return r()}([],[])},a.scale.quantize=function(){return function t(e,n,i){var r,a;function o(t){return i[Math.max(0,Math.min(a,Math.floor(r*(t-e))))]}function s(){return r=i.length/(n-e),a=i.length-1,o}o.domain=function(t){return arguments.length?(e=+t[0],n=+t[t.length-1],s()):[e,n]};o.range=function(t){return arguments.length?(i=t,s()):i};o.invertExtent=function(t){return[t=(t=i.indexOf(t))<0?NaN:t/r+e,t+1/r]};o.copy=function(){return t(e,n,i)};return s()}(0,1,[0,1])},a.scale.threshold=function(){return function t(e,n){function i(t){if(t<=t)return n[a.bisect(e,t)]}i.domain=function(t){return arguments.length?(e=t,i):e};i.range=function(t){return arguments.length?(n=t,i):n};i.invertExtent=function(t){return t=n.indexOf(t),[e[t-1],e[t]]};i.copy=function(){return t(e,n)};return i}([.5],[0,1])},a.scale.identity=function(){return function t(e){function n(t){return+t}n.invert=n;n.domain=n.range=function(t){return arguments.length?(e=t.map(n),n):e};n.ticks=function(t){return Mo(e,t)};n.tickFormat=function(t,n){return xo(e,t,n)};n.copy=function(){return t(e)};return n}([0,1])},a.svg={},a.svg.arc=function(){var t=jo,e=No,n=Ao,i=Oo,r=Ho,a=Vo,o=Po;function s(){var s=Math.max(0,+t.apply(this,arguments)),u=Math.max(0,+e.apply(this,arguments)),c=r.apply(this,arguments)-Et,d=a.apply(this,arguments)-Et,h=Math.abs(d-c),f=c>d?0:1;if(u<s&&(m=u,u=s,s=m),h>=Ct)return l(u,f)+(s?l(s,1-f):"")+"Z";var m,p,g,v,_,y,b,M,x,w,k,L,S=0,T=0,Y=[];if((v=(+o.apply(this,arguments)||0)/2)&&(g=i===Oo?Math.sqrt(s*s+u*u):+i.apply(this,arguments),f||(T*=-1),u&&(T=Vt(g/u*Math.sin(v))),s&&(S=Vt(g/s*Math.sin(v)))),u){_=u*Math.cos(c+T),y=u*Math.sin(c+T),b=u*Math.cos(d-T),M=u*Math.sin(d-T);var D=Math.abs(d-c-2*T)<=Yt?0:1;if(T&&Fo(_,y,b,M)===f^D){var C=(c+d)/2;_=u*Math.cos(C),y=u*Math.sin(C),b=M=null}}else _=y=0;if(s){x=s*Math.cos(d-S),w=s*Math.sin(d-S),k=s*Math.cos(c+S),L=s*Math.sin(c+S);var E=Math.abs(c-d+2*S)<=Yt?0:1;if(S&&Fo(x,w,k,L)===1-f^E){var A=(c+d)/2;x=s*Math.cos(A),w=s*Math.sin(A),k=L=null}}else x=w=0;if(h>St&&(m=Math.min(Math.abs(u-s)/2,+n.apply(this,arguments)))>.001){p=s<u^f?0:1;var O=m,j=m;if(h<Yt){var N=null==k?[x,w]:null==b?[_,y]:lr([_,y],[k,L],[b,M],[x,w]),H=_-N[0],V=y-N[1],P=b-N[0],F=M-N[1],I=1/Math.sin(Math.acos((H*P+V*F)/(Math.sqrt(H*H+V*V)*Math.sqrt(P*P+F*F)))/2),R=Math.sqrt(N[0]*N[0]+N[1]*N[1]);j=Math.min(m,(s-R)/(I-1)),O=Math.min(m,(u-R)/(I+1))}if(null!=b){var W=Io(null==k?[x,w]:[k,L],[_,y],u,O,f),z=Io([b,M],[x,w],u,O,f);m===O?Y.push("M",W[0],"A",O,",",O," 0 0,",p," ",W[1],"A",u,",",u," 0 ",1-f^Fo(W[1][0],W[1][1],z[1][0],z[1][1]),",",f," ",z[1],"A",O,",",O," 0 0,",p," ",z[0]):Y.push("M",W[0],"A",O,",",O," 0 1,",p," ",z[0])}else Y.push("M",_,",",y);if(null!=k){var B=Io([_,y],[k,L],s,-j,f),U=Io([x,w],null==b?[_,y]:[b,M],s,-j,f);m===j?Y.push("L",U[0],"A",j,",",j," 0 0,",p," ",U[1],"A",s,",",s," 0 ",f^Fo(U[1][0],U[1][1],B[1][0],B[1][1]),",",1-f," ",B[1],"A",j,",",j," 0 0,",p," ",B[0]):Y.push("L",U[0],"A",j,",",j," 0 0,",p," ",B[0])}else Y.push("L",x,",",w)}else Y.push("M",_,",",y),null!=b&&Y.push("A",u,",",u," 0 ",D,",",f," ",b,",",M),Y.push("L",x,",",w),null!=k&&Y.push("A",s,",",s," 0 ",E,",",1-f," ",k,",",L);return Y.push("Z"),Y.join("")}function l(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}return s.innerRadius=function(e){return arguments.length?(t=ye(e),s):t},s.outerRadius=function(t){return arguments.length?(e=ye(t),s):e},s.cornerRadius=function(t){return arguments.length?(n=ye(t),s):n},s.padRadius=function(t){return arguments.length?(i=t==Oo?Oo:ye(t),s):i},s.startAngle=function(t){return arguments.length?(r=ye(t),s):r},s.endAngle=function(t){return arguments.length?(a=ye(t),s):a},s.padAngle=function(t){return arguments.length?(o=ye(t),s):o},s.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +a.apply(this,arguments))/2-Et;return[Math.cos(i)*n,Math.sin(i)*n]},s};var Oo="auto";function jo(t){return t.innerRadius}function No(t){return t.outerRadius}function Ho(t){return t.startAngle}function Vo(t){return t.endAngle}function Po(t){return t&&t.padAngle}function Fo(t,e,n,i){return(t-n)*e-(e-i)*t>0?0:1}function Io(t,e,n,i,r){var a=t[0]-e[0],o=t[1]-e[1],s=(r?i:-i)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,d=t[1]+u,h=e[0]+l,f=e[1]+u,m=(c+h)/2,p=(d+f)/2,g=h-c,v=f-d,_=g*g+v*v,y=n-i,b=c*f-h*d,M=(v<0?-1:1)*Math.sqrt(Math.max(0,y*y*_-b*b)),x=(b*v-g*M)/_,w=(-b*g-v*M)/_,k=(b*v+g*M)/_,L=(-b*g+v*M)/_,S=x-m,T=w-p,Y=k-m,D=L-p;return S*S+T*T>Y*Y+D*D&&(x=k,w=L),[[x-l,w-u],[x*n/y,w*n/y]]}function Ro(t){var e=nr,n=ir,i=Xn,r=zo,a=r.key,o=.7;function s(a){var s,l=[],u=[],c=-1,d=a.length,h=ye(e),f=ye(n);function m(){l.push("M",r(t(u),o))}for(;++c<d;)i.call(this,s=a[c],c)?u.push([+h.call(this,s,c),+f.call(this,s,c)]):u.length&&(m(),u=[]);return u.length&&m(),l.length?l.join(""):null}return s.x=function(t){return arguments.length?(e=t,s):e},s.y=function(t){return arguments.length?(n=t,s):n},s.defined=function(t){return arguments.length?(i=t,s):i},s.interpolate=function(t){return arguments.length?(a="function"==typeof t?r=t:(r=Wo.get(t)||zo).key,s):a},s.tension=function(t){return arguments.length?(o=t,s):o},s}a.svg.line=function(){return Ro(N)};var Wo=a.map({linear:zo,"linear-closed":Bo,step:function(t){var e=0,n=t.length,i=t[0],r=[i[0],",",i[1]];for(;++e<n;)r.push("H",(i[0]+(i=t[e])[0])/2,"V",i[1]);n>1&&r.push("H",i[0]);return r.join("")},"step-before":Uo,"step-after":Go,basis:Jo,"basis-open":function(t){if(t.length<4)return zo(t);var e,n=[],i=-1,r=t.length,a=[0],o=[0];for(;++i<3;)e=t[i],a.push(e[0]),o.push(e[1]);n.push(Xo(Qo,a)+","+Xo(Qo,o)),--i;for(;++i<r;)e=t[i],a.shift(),a.push(e[0]),o.shift(),o.push(e[1]),ts(n,a,o);return n.join("")},"basis-closed":function(t){var e,n,i=-1,r=t.length,a=r+4,o=[],s=[];for(;++i<4;)n=t[i%r],o.push(n[0]),s.push(n[1]);e=[Xo(Qo,o),",",Xo(Qo,s)],--i;for(;++i<a;)n=t[i%r],o.shift(),o.push(n[0]),s.shift(),s.push(n[1]),ts(e,o,s);return e.join("")},bundle:function(t,e){var n=t.length-1;if(n)for(var i,r,a=t[0][0],o=t[0][1],s=t[n][0]-a,l=t[n][1]-o,u=-1;++u<=n;)i=t[u],r=u/n,i[0]=e*i[0]+(1-e)*(a+r*s),i[1]=e*i[1]+(1-e)*(o+r*l);return Jo(t)},cardinal:function(t,e){return t.length<3?zo(t):t[0]+$o(t,qo(t,e))},"cardinal-open":function(t,e){return t.length<4?zo(t):t[1]+$o(t.slice(1,-1),qo(t,e))},"cardinal-closed":function(t,e){return t.length<3?Bo(t):t[0]+$o((t.push(t[0]),t),qo([t[t.length-2]].concat(t,[t[1]]),e))},monotone:function(t){return t.length<3?zo(t):t[0]+$o(t,function(t){var e,n,i,r,a=[],o=function(t){var e=0,n=t.length-1,i=[],r=t[0],a=t[1],o=i[0]=es(r,a);for(;++e<n;)i[e]=(o+(o=es(r=a,a=t[e+1])))/2;return i[e]=o,i}(t),s=-1,l=t.length-1;for(;++s<l;)e=es(t[s],t[s+1]),x(e)<St?o[s]=o[s+1]=0:(n=o[s]/e,i=o[s+1]/e,(r=n*n+i*i)>9&&(r=3*e/Math.sqrt(r),o[s]=r*n,o[s+1]=r*i));s=-1;for(;++s<=l;)r=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([r||0,o[s]*r||0]);return a}(t))}});function zo(t){return t.length>1?t.join("L"):t+"Z"}function Bo(t){return t.join("L")+"Z"}function Uo(t){for(var e=0,n=t.length,i=t[0],r=[i[0],",",i[1]];++e<n;)r.push("V",(i=t[e])[1],"H",i[0]);return r.join("")}function Go(t){for(var e=0,n=t.length,i=t[0],r=[i[0],",",i[1]];++e<n;)r.push("H",(i=t[e])[0],"V",i[1]);return r.join("")}function $o(t,e){if(e.length<1||t.length!=e.length&&t.length!=e.length+2)return zo(t);var n=t.length!=e.length,i="",r=t[0],a=t[1],o=e[0],s=o,l=1;if(n&&(i+="Q"+(a[0]-2*o[0]/3)+","+(a[1]-2*o[1]/3)+","+a[0]+","+a[1],r=t[1],l=2),e.length>1){s=e[1],a=t[l],l++,i+="C"+(r[0]+o[0])+","+(r[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;u<e.length;u++,l++)a=t[l],s=e[u],i+="S"+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1]}if(n){var c=t[l];i+="Q"+(a[0]+2*s[0]/3)+","+(a[1]+2*s[1]/3)+","+c[0]+","+c[1]}return i}function qo(t,e){for(var n,i=[],r=(1-e)/2,a=t[0],o=t[1],s=1,l=t.length;++s<l;)n=a,a=o,o=t[s],i.push([r*(o[0]-n[0]),r*(o[1]-n[1])]);return i}function Jo(t){if(t.length<3)return zo(t);var e=1,n=t.length,i=t[0],r=i[0],a=i[1],o=[r,r,r,(i=t[1])[0]],s=[a,a,a,i[1]],l=[r,",",a,"L",Xo(Qo,o),",",Xo(Qo,s)];for(t.push(t[n-1]);++e<=n;)i=t[e],o.shift(),o.push(i[0]),s.shift(),s.push(i[1]),ts(l,o,s);return t.pop(),l.push("L",i),l.join("")}function Xo(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}Wo.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var Zo=[0,2/3,1/3,0],Ko=[0,1/3,2/3,0],Qo=[0,1/6,2/3,1/6];function ts(t,e,n){t.push("C",Xo(Zo,e),",",Xo(Zo,n),",",Xo(Ko,e),",",Xo(Ko,n),",",Xo(Qo,e),",",Xo(Qo,n))}function es(t,e){return(e[1]-t[1])/(e[0]-t[0])}function ns(t){for(var e,n,i,r=-1,a=t.length;++r<a;)n=(e=t[r])[0],i=e[1]-Et,e[0]=n*Math.cos(i),e[1]=n*Math.sin(i);return t}function is(t){var e=nr,n=nr,i=0,r=ir,a=Xn,o=zo,s=o.key,l=o,u="L",c=.7;function d(s){var d,h,f,m=[],p=[],g=[],v=-1,_=s.length,y=ye(e),b=ye(i),M=e===n?function(){return h}:ye(n),x=i===r?function(){return f}:ye(r);function w(){m.push("M",o(t(g),c),u,l(t(p.reverse()),c),"Z")}for(;++v<_;)a.call(this,d=s[v],v)?(p.push([h=+y.call(this,d,v),f=+b.call(this,d,v)]),g.push([+M.call(this,d,v),+x.call(this,d,v)])):p.length&&(w(),p=[],g=[]);return p.length&&w(),m.length?m.join(""):null}return d.x=function(t){return arguments.length?(e=n=t,d):n},d.x0=function(t){return arguments.length?(e=t,d):e},d.x1=function(t){return arguments.length?(n=t,d):n},d.y=function(t){return arguments.length?(i=r=t,d):r},d.y0=function(t){return arguments.length?(i=t,d):i},d.y1=function(t){return arguments.length?(r=t,d):r},d.defined=function(t){return arguments.length?(a=t,d):a},d.interpolate=function(t){return arguments.length?(s="function"==typeof t?o=t:(o=Wo.get(t)||zo).key,l=o.reverse||o,u=o.closed?"M":"L",d):s},d.tension=function(t){return arguments.length?(c=t,d):c},d}function rs(t){return t.radius}function as(t){return[t.x,t.y]}function os(){return 64}function ss(){return"circle"}function ls(t){var e=Math.sqrt(t/Yt);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}a.svg.line.radial=function(){var t=Ro(ns);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},Uo.reverse=Go,Go.reverse=Uo,a.svg.area=function(){return is(N)},a.svg.area.radial=function(){var t=is(ns);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},a.svg.chord=function(){var t=Wi,e=zi,n=rs,i=Ho,r=Vo;function a(n,i){var r=o(this,t,n,i),a=o(this,e,n,i);return"M"+r.p0+s(r.r,r.p1,r.a1-r.a0)+(function(t,e){return t.a0==e.a0&&t.a1==e.a1}(r,a)?l(r.r,r.p1,r.r,r.p0):l(r.r,r.p1,a.r,a.p0)+s(a.r,a.p1,a.a1-a.a0)+l(a.r,a.p1,r.r,r.p0))+"Z"}function o(t,e,a,o){var s=e.call(t,a,o),l=n.call(t,s,o),u=i.call(t,s,o)-Et,c=r.call(t,s,o)-Et;return{r:l,a0:u,a1:c,p0:[l*Math.cos(u),l*Math.sin(u)],p1:[l*Math.cos(c),l*Math.sin(c)]}}function s(t,e,n){return"A"+t+","+t+" 0 "+ +(n>Yt)+",1 "+e}function l(t,e,n,i){return"Q 0,0 "+i}return a.radius=function(t){return arguments.length?(n=ye(t),a):n},a.source=function(e){return arguments.length?(t=ye(e),a):t},a.target=function(t){return arguments.length?(e=ye(t),a):e},a.startAngle=function(t){return arguments.length?(i=ye(t),a):i},a.endAngle=function(t){return arguments.length?(r=ye(t),a):r},a},a.svg.diagonal=function(){var t=Wi,e=zi,n=as;function i(i,r){var a=t.call(this,i,r),o=e.call(this,i,r),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return"M"+(l=l.map(n))[0]+"C"+l[1]+" "+l[2]+" "+l[3]}return i.source=function(e){return arguments.length?(t=ye(e),i):t},i.target=function(t){return arguments.length?(e=ye(t),i):e},i.projection=function(t){return arguments.length?(n=t,i):n},i},a.svg.diagonal.radial=function(){var t=a.svg.diagonal(),e=as,n=t.projection;return t.projection=function(t){return arguments.length?n(function(t){return function(){var e=t.apply(this,arguments),n=e[0],i=e[1]-Et;return[n*Math.cos(i),n*Math.sin(i)]}}(e=t)):e},t},a.svg.symbol=function(){var t=ss,e=os;function n(n,i){return(us.get(t.call(this,n,i))||ls)(e.call(this,n,i))}return n.type=function(e){return arguments.length?(t=ye(e),n):t},n.size=function(t){return arguments.length?(e=ye(t),n):e},n};var us=a.map({circle:ls,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*ds)),n=e*ds;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/cs),n=e*cs/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/cs),n=e*cs/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});a.svg.symbolTypes=us.keys();var cs=Math.sqrt(3),ds=Math.tan(30*At);Z.transition=function(t){for(var e,n,i=ps||++_s,r=Ms(t),a=[],o=gs||{time:Date.now(),ease:aa,delay:0,duration:250},s=-1,l=this.length;++s<l;){a.push(e=[]);for(var u=this[s],c=-1,d=u.length;++c<d;)(n=u[c])&&xs(n,c,r,i,o),e.push(n)}return ms(a,r,i)},Z.interrupt=function(t){return this.each(null==t?hs:fs(Ms(t)))};var hs=fs(Ms());function fs(t){return function(){var e,n,i;(e=this[t])&&(i=e[n=e.active])&&(i.timer.c=null,i.timer.t=NaN,--e.count?delete e[n]:delete this[t],e.active+=.5,i.event&&i.event.interrupt.call(this,this.__data__,i.index))}}function ms(t,e,n){return G(t,vs),t.namespace=e,t.id=n,t}var ps,gs,vs=[],_s=0;function ys(t,e,n,i){var r=t.id,a=t.namespace;return ft(t,"function"==typeof n?function(t,o,s){t[a][r].tween.set(e,i(n.call(t,t.__data__,o,s)))}:(n=i(n),function(t){t[a][r].tween.set(e,n)}))}function bs(t){return null==t&&(t=""),function(){this.textContent=t}}function Ms(t){return null==t?"__transition__":"__transition_"+t+"__"}function xs(t,e,n,i,r){var a,o,s,l,u,c=t[n]||(t[n]={active:0,count:0}),d=c[i];function h(n){var r=c.active,h=c[r];for(var m in h&&(h.timer.c=null,h.timer.t=NaN,--c.count,delete c[r],h.event&&h.event.interrupt.call(t,t.__data__,h.index)),c)if(+m<i){var p=c[m];p.timer.c=null,p.timer.t=NaN,--c.count,delete c[m]}o.c=f,Te(function(){return o.c&&f(n||1)&&(o.c=null,o.t=NaN),1},0,a),c.active=i,d.event&&d.event.start.call(t,t.__data__,e),u=[],d.tween.forEach(function(n,i){(i=i.call(t,t.__data__,e))&&u.push(i)}),l=d.ease,s=d.duration}function f(r){for(var a=r/s,o=l(a),h=u.length;h>0;)u[--h].call(t,o);if(a>=1)return d.event&&d.event.end.call(t,t.__data__,e),--c.count?delete c[i]:delete t[n],1}d||(a=r.time,o=Te(function(t){var e=d.delay;if(o.t=e+a,e<=t)return h(t-e);o.c=h},0,a),d=c[i]={tween:new k,time:a,timer:o,delay:r.delay,duration:r.duration,ease:r.ease,index:e},r=null,++c.count)}vs.call=Z.call,vs.empty=Z.empty,vs.node=Z.node,vs.size=Z.size,a.transition=function(t,e){return t&&t.transition?ps?t.transition(e):t:a.selection().transition(t)},a.transition.prototype=vs,vs.select=function(t){var e,n,i,r=this.id,a=this.namespace,o=[];t=K(t);for(var s=-1,l=this.length;++s<l;){o.push(e=[]);for(var u=this[s],c=-1,d=u.length;++c<d;)(i=u[c])&&(n=t.call(i,i.__data__,c,s))?("__data__"in i&&(n.__data__=i.__data__),xs(n,c,a,r,i[a][r]),e.push(n)):e.push(null)}return ms(o,a,r)},vs.selectAll=function(t){var e,n,i,r,a,o=this.id,s=this.namespace,l=[];t=Q(t);for(var u=-1,c=this.length;++u<c;)for(var d=this[u],h=-1,f=d.length;++h<f;)if(i=d[h]){a=i[s][o],n=t.call(i,i.__data__,h,u),l.push(e=[]);for(var m=-1,p=n.length;++m<p;)(r=n[m])&&xs(r,m,s,o,a),e.push(r)}return ms(l,s,o)},vs.filter=function(t){var e,n,i=[];"function"!=typeof t&&(t=ht(t));for(var r=0,a=this.length;r<a;r++){i.push(e=[]);for(var o,s=0,l=(o=this[r]).length;s<l;s++)(n=o[s])&&t.call(n,n.__data__,s,r)&&e.push(n)}return ms(i,this.namespace,this.id)},vs.tween=function(t,e){var n=this.id,i=this.namespace;return arguments.length<2?this.node()[i][n].tween.get(t):ft(this,null==e?function(e){e[i][n].tween.remove(t)}:function(r){r[i][n].tween.set(t,e)})},vs.attr=function(t,e){if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var n="transform"==t?ga:Xr,i=a.ns.qualify(t);function r(){this.removeAttribute(i)}function o(){this.removeAttributeNS(i.space,i.local)}return ys(this,"attr."+t,e,i.local?function(t){return null==t?o:(t+="",function(){var e,r=this.getAttributeNS(i.space,i.local);return r!==t&&(e=n(r,t),function(t){this.setAttributeNS(i.space,i.local,e(t))})})}:function(t){return null==t?r:(t+="",function(){var e,r=this.getAttribute(i);return r!==t&&(e=n(r,t),function(t){this.setAttribute(i,e(t))})})})},vs.attrTween=function(t,e){var n=a.ns.qualify(t);return this.tween("attr."+t,n.local?function(t,i){var r=e.call(this,t,i,this.getAttributeNS(n.space,n.local));return r&&function(t){this.setAttributeNS(n.space,n.local,r(t))}}:function(t,i){var r=e.call(this,t,i,this.getAttribute(n));return r&&function(t){this.setAttribute(n,r(t))}})},vs.style=function(t,e,n){var i=arguments.length;if(i<3){if("string"!=typeof t){for(n in i<2&&(e=""),t)this.style(n,t[n],e);return this}n=""}function r(){this.style.removeProperty(t)}return ys(this,"style."+t,e,function(e){return null==e?r:(e+="",function(){var i,r=c(this).getComputedStyle(this,null).getPropertyValue(t);return r!==e&&(i=Xr(r,e),function(e){this.style.setProperty(t,i(e),n)})})})},vs.styleTween=function(t,e,n){return arguments.length<3&&(n=""),this.tween("style."+t,function(i,r){var a=e.call(this,i,r,c(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(e){this.style.setProperty(t,a(e),n)}})},vs.text=function(t){return ys(this,"text",t,bs)},vs.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},vs.ease=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].ease:("function"!=typeof t&&(t=a.ease.apply(a,arguments)),ft(this,function(i){i[n][e].ease=t}))},vs.delay=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].delay:ft(this,"function"==typeof t?function(i,r,a){i[n][e].delay=+t.call(i,i.__data__,r,a)}:(t=+t,function(i){i[n][e].delay=t}))},vs.duration=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].duration:ft(this,"function"==typeof t?function(i,r,a){i[n][e].duration=Math.max(1,t.call(i,i.__data__,r,a))}:(t=Math.max(1,t),function(i){i[n][e].duration=t}))},vs.each=function(t,e){var n=this.id,i=this.namespace;if(arguments.length<2){var r=gs,o=ps;try{ps=n,ft(this,function(e,r,a){gs=e[i][n],t.call(e,e.__data__,r,a)})}finally{gs=r,ps=o}}else ft(this,function(r){var o=r[i][n];(o.event||(o.event=a.dispatch("start","end","interrupt"))).on(t,e)});return this},vs.transition=function(){for(var t,e,n,i=this.id,r=++_s,a=this.namespace,o=[],s=0,l=this.length;s<l;s++){o.push(t=[]);for(var u,c=0,d=(u=this[s]).length;c<d;c++)(e=u[c])&&xs(e,c,a,r,{time:(n=e[a][i]).time,ease:n.ease,delay:n.delay+n.duration,duration:n.duration}),t.push(e)}return ms(o,a,r)},a.svg.axis=function(){var t,e=a.scale.linear(),n=ws,i=6,r=6,o=3,l=[10],u=null;function c(s){s.each(function(){var s,c=a.select(this),d=this.__chart__||e,h=this.__chart__=e.copy(),f=null==u?h.ticks?h.ticks.apply(h,l):h.domain():u,m=null==t?h.tickFormat?h.tickFormat.apply(h,l):N:t,p=c.selectAll(".tick").data(f,h),g=p.enter().insert("g",".domain").attr("class","tick").style("opacity",St),v=a.transition(p.exit()).style("opacity",St).remove(),_=a.transition(p.order()).style("opacity",1),y=Math.max(i,0)+o,b=ho(h),M=c.selectAll(".domain").data([0]),x=(M.enter().append("path").attr("class","domain"),a.transition(M));g.append("line"),g.append("text");var w,k,L,S,T=g.select("line"),Y=_.select("line"),D=p.select("text").text(m),C=g.select("text"),E=_.select("text"),A="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(s=Ls,w="x",L="y",k="x2",S="y2",D.attr("dy",A<0?"0em":".71em").style("text-anchor","middle"),x.attr("d","M"+b[0]+","+A*r+"V0H"+b[1]+"V"+A*r)):(s=Ss,w="y",L="x",k="y2",S="x2",D.attr("dy",".32em").style("text-anchor",A<0?"end":"start"),x.attr("d","M"+A*r+","+b[0]+"H0V"+b[1]+"H"+A*r)),T.attr(S,A*i),C.attr(L,A*y),Y.attr(k,0).attr(S,A*i),E.attr(w,0).attr(L,A*y),h.rangeBand){var O=h,j=O.rangeBand()/2;d=h=function(t){return O(t)+j}}else d.rangeBand?d=h:v.call(s,h,d);g.call(s,d,h),_.call(s,h,h)})}return c.scale=function(t){return arguments.length?(e=t,c):e},c.orient=function(t){return arguments.length?(n=t in ks?t+"":ws,c):n},c.ticks=function(){return arguments.length?(l=s(arguments),c):l},c.tickValues=function(t){return arguments.length?(u=t,c):u},c.tickFormat=function(e){return arguments.length?(t=e,c):t},c.tickSize=function(t){var e=arguments.length;return e?(i=+t,r=+arguments[e-1],c):i},c.innerTickSize=function(t){return arguments.length?(i=+t,c):i},c.outerTickSize=function(t){return arguments.length?(r=+t,c):r},c.tickPadding=function(t){return arguments.length?(o=+t,c):o},c.tickSubdivide=function(){return arguments.length&&c},c};var ws="bottom",ks={top:1,right:1,bottom:1,left:1};function Ls(t,e,n){t.attr("transform",function(t){var i=e(t);return"translate("+(isFinite(i)?i:n(t))+",0)"})}function Ss(t,e,n){t.attr("transform",function(t){var i=e(t);return"translate(0,"+(isFinite(i)?i:n(t))+")"})}a.svg.brush=function(){var t,e,n=B(h,"brushstart","brush","brushend"),i=null,r=null,o=[0,0],s=[0,0],l=!0,u=!0,d=Ys[0];function h(t){t.each(function(){var t=a.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",g).on("touchstart.brush",g),e=t.selectAll(".background").data([0]);e.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var n=t.selectAll(".resize").data(d,N);n.exit().remove(),n.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Ts[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),n.style("display",h.empty()?"none":null);var o,s=a.transition(t),l=a.transition(e);i&&(o=ho(i),l.attr("x",o[0]).attr("width",o[1]-o[0]),m(s)),r&&(o=ho(r),l.attr("y",o[0]).attr("height",o[1]-o[0]),p(s)),f(s)})}function f(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+o[+/e$/.test(t)]+","+s[+/^s/.test(t)]+")"})}function m(t){t.select(".extent").attr("x",o[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",o[1]-o[0])}function p(t){t.select(".extent").attr("y",s[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function g(){var d,g,v=this,_=a.select(a.event.target),y=n.of(v,arguments),b=a.select(v),M=_.datum(),x=!/^(n|s)$/.test(M)&&i,w=!/^(e|w)$/.test(M)&&r,k=_.classed("extent"),L=xt(v),S=a.mouse(v),T=a.select(c(v)).on("keydown.brush",function(){32==a.event.keyCode&&(k||(d=null,S[0]-=o[1],S[1]-=s[1],k=2),W())}).on("keyup.brush",function(){32==a.event.keyCode&&2==k&&(S[0]+=o[1],S[1]+=s[1],k=0,W())});if(a.event.changedTouches?T.on("touchmove.brush",C).on("touchend.brush",A):T.on("mousemove.brush",C).on("mouseup.brush",A),b.interrupt().selectAll("*").interrupt(),k)S[0]=o[0]-S[0],S[1]=s[0]-S[1];else if(M){var Y=+/w$/.test(M),D=+/^n/.test(M);g=[o[1-Y]-S[0],s[1-D]-S[1]],S[0]=o[Y],S[1]=s[D]}else a.event.altKey&&(d=S.slice());function C(){var t=a.mouse(v),e=!1;g&&(t[0]+=g[0],t[1]+=g[1]),k||(a.event.altKey?(d||(d=[(o[0]+o[1])/2,(s[0]+s[1])/2]),S[0]=o[+(t[0]<d[0])],S[1]=s[+(t[1]<d[1])]):d=null),x&&E(t,i,0)&&(m(b),e=!0),w&&E(t,r,1)&&(p(b),e=!0),e&&(f(b),y({type:"brush",mode:k?"move":"resize"}))}function E(n,i,r){var a,c,h=ho(i),f=h[0],m=h[1],p=S[r],g=r?s:o,v=g[1]-g[0];if(k&&(f-=p,m-=v+p),a=(r?u:l)?Math.max(f,Math.min(m,n[r])):n[r],k?c=(a+=p)+v:(d&&(p=Math.max(f,Math.min(m,2*d[r]-a))),p<a?(c=a,a=p):c=p),g[0]!=a||g[1]!=c)return r?e=null:t=null,g[0]=a,g[1]=c,!0}function A(){C(),b.style("pointer-events","all").selectAll(".resize").style("display",h.empty()?"none":null),a.select("body").style("cursor",null),T.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),L(),y({type:"brushend"})}b.style("pointer-events","none").selectAll(".resize").style("display",null),a.select("body").style("cursor",_.style("cursor")),y({type:"brushstart"}),C()}return h.event=function(i){i.each(function(){var i=n.of(this,arguments),r={x:o,y:s,i:t,j:e},l=this.__chart__||r;this.__chart__=r,ps?a.select(this).transition().each("start.brush",function(){t=l.i,e=l.j,o=l.x,s=l.y,i({type:"brushstart"})}).tween("brush:brush",function(){var n=Zr(o,r.x),a=Zr(s,r.y);return t=e=null,function(t){o=r.x=n(t),s=r.y=a(t),i({type:"brush",mode:"resize"})}}).each("end.brush",function(){t=r.i,e=r.j,i({type:"brush",mode:"resize"}),i({type:"brushend"})}):(i({type:"brushstart"}),i({type:"brush",mode:"resize"}),i({type:"brushend"}))})},h.x=function(t){return arguments.length?(d=Ys[!(i=t)<<1|!r],h):i},h.y=function(t){return arguments.length?(d=Ys[!i<<1|!(r=t)],h):r},h.clamp=function(t){return arguments.length?(i&&r?(l=!!t[0],u=!!t[1]):i?l=!!t:r&&(u=!!t),h):i&&r?[l,u]:i?l:r?u:null},h.extent=function(n){var a,l,u,c,d;return arguments.length?(i&&(a=n[0],l=n[1],r&&(a=a[0],l=l[0]),t=[a,l],i.invert&&(a=i(a),l=i(l)),l<a&&(d=a,a=l,l=d),a==o[0]&&l==o[1]||(o=[a,l])),r&&(u=n[0],c=n[1],i&&(u=u[1],c=c[1]),e=[u,c],r.invert&&(u=r(u),c=r(c)),c<u&&(d=u,u=c,c=d),u==s[0]&&c==s[1]||(s=[u,c])),h):(i&&(t?(a=t[0],l=t[1]):(a=o[0],l=o[1],i.invert&&(a=i.invert(a),l=i.invert(l)),l<a&&(d=a,a=l,l=d))),r&&(e?(u=e[0],c=e[1]):(u=s[0],c=s[1],r.invert&&(u=r.invert(u),c=r.invert(c)),c<u&&(d=u,u=c,c=d))),i&&r?[[a,u],[l,c]]:i?[a,l]:r&&[u,c])},h.clear=function(){return h.empty()||(o=[0,0],s=[0,0],t=e=null),h},h.empty=function(){return!!i&&o[0]==o[1]||!!r&&s[0]==s[1]},a.rebind(h,n,"on")};var Ts={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ys=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Ds=He.format=dn.timeFormat,Cs=Ds.utc,Es=Cs("%Y-%m-%dT%H:%M:%S.%LZ");function As(t){return t.toISOString()}function Os(t,e,n){function i(e){return t(e)}function r(t,n){var i=(t[1]-t[0])/n,r=a.bisect(Ns,i);return r==Ns.length?[e.year,bo(t.map(function(t){return t/31536e6}),n)[2]]:r?e[i/Ns[r-1]<Ns[r]/i?r-1:r]:[Ps,bo(t,n)[2]]}return i.invert=function(e){return js(t.invert(e))},i.domain=function(e){return arguments.length?(t.domain(e),i):t.domain().map(js)},i.nice=function(t,e){var n=i.domain(),a=co(n),o=null==t?r(a,10):"number"==typeof t&&r(a,t);function s(n){return!isNaN(n)&&!t.range(n,js(+n+1),e).length}return o&&(t=o[0],e=o[1]),i.domain(mo(n,e>1?{floor:function(e){for(;s(e=t.floor(e));)e=js(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=js(+e+1);return e}}:t))},i.ticks=function(t,e){var n=co(i.domain()),a=null==t?r(n,10):"number"==typeof t?r(n,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(n[0],js(+n[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Os(t.copy(),e,n)},_o(i,t)}function js(t){return new Date(t)}Ds.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?As:Es,As.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},As.toString=Es.toString,He.second=Ie(function(t){return new Ve(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),He.seconds=He.second.range,He.seconds.utc=He.second.utc.range,He.minute=Ie(function(t){return new Ve(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),He.minutes=He.minute.range,He.minutes.utc=He.minute.utc.range,He.hour=Ie(function(t){var e=t.getTimezoneOffset()/60;return new Ve(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),He.hours=He.hour.range,He.hours.utc=He.hour.utc.range,He.month=Ie(function(t){return(t=He.day(t)).setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),He.months=He.month.range,He.months.utc=He.month.utc.range;var Ns=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Hs=[[He.second,1],[He.second,5],[He.second,15],[He.second,30],[He.minute,1],[He.minute,5],[He.minute,15],[He.minute,30],[He.hour,1],[He.hour,3],[He.hour,6],[He.hour,12],[He.day,1],[He.day,2],[He.week,1],[He.month,1],[He.month,3],[He.year,1]],Vs=Ds.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Xn]]),Ps={range:function(t,e,n){return a.range(Math.ceil(t/n)*n,+e,n).map(js)},floor:N,ceil:N};Hs.year=He.year,He.scale=function(){return Os(a.scale.linear(),Hs,Vs)};var Fs=Hs.map(function(t){return[t[0].utc,t[1]]}),Is=Cs.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Xn]]);function Rs(t){return JSON.parse(t.responseText)}function Ws(t){var e=l.createRange();return e.selectNode(l.body),e.createContextualFragment(t.responseText)}Fs.year=He.year.utc,He.scale.utc=function(){return Os(a.scale.linear(),Fs,Is)},a.text=be(function(t){return t.responseText}),a.json=function(t,e){return Me(t,"application/json",Rs,e)},a.html=function(t,e){return Me(t,"text/html",Ws,e)},a.xml=be(function(t){return t.responseXML}),this.d3=a,void 0===(r="function"==typeof(i=a)?i.call(e,n,e,t):i)||(t.exports=r)}()},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var i=n(0);let r=class{constructor(){this.toggleViews=new Map}};r=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)()],r)},function(t,e,n){"use strict";n.d(e,"a",function(){return i});class i{constructor(t){this.guid=t}static newGuid(){let t,e,n;for(t="",n=0;n<32;n++)8!==n&&12!==n&&16!==n&&20!==n||(t+="-"),t+=e=Math.floor(16*Math.random()).toString(16).toUpperCase();return new i(t)}toString(t){return t&&"n"===t.toLowerCase()?this.guid.replace(/-/g,""):this.guid}}},function(t,e,n){"use strict";n.d(e,"a",function(){return c});var i=n(11),r=n(51),a=n(53),o=n(24),s=n(52),l=n(23),u=n(34),c=function(t){function e(n,i,r){var o=t.call(this)||this;switch(o.syncErrorValue=null,o.syncErrorThrown=!1,o.syncErrorThrowable=!1,o.isStopped=!1,arguments.length){case 0:o.destination=a.a;break;case 1:if(!n){o.destination=a.a;break}if("object"==typeof n){n instanceof e?(o.syncErrorThrowable=n.syncErrorThrowable,o.destination=n,n.add(o)):(o.syncErrorThrowable=!0,o.destination=new d(o,n));break}default:o.syncErrorThrowable=!0,o.destination=new d(o,n,i,r)}return o}return i.a(e,t),e.prototype[s.a]=function(){return this},e.create=function(t,n,i){var r=new e(t,n,i);return r.syncErrorThrowable=!1,r},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(o.a),d=function(t){function e(e,n,i,o){var s,l=t.call(this)||this;l._parentSubscriber=e;var u=l;return Object(r.a)(n)?s=n:n&&(s=n.next,i=n.error,o=n.complete,n!==a.a&&(u=Object.create(n),Object(r.a)(u.unsubscribe)&&l.add(u.unsubscribe.bind(u)),u.unsubscribe=l.unsubscribe.bind(l))),l._context=u,l._next=s,l._error=i,l._complete=o,l}return i.a(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;l.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,n=l.a.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):Object(u.a)(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;Object(u.a)(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};l.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),l.a.useDeprecatedSynchronousErrorHandling)throw t;Object(u.a)(t)}},e.prototype.__tryOrSetError=function(t,e,n){if(!l.a.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(e){return l.a.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(Object(u.a)(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(c)},function(t,e,n){"use strict";n.d(e,"a",function(){return i});class i{constructor(t){this.catToString=t,this.internalMap=new Map}set(t,e){return this.internalMap.set(this.catToString(t),e)}get(t){return this.internalMap.get(this.catToString(t))}has(t){return this.internalMap.has(this.catToString(t))}delete(t){return this.internalMap.delete(this.catToString(t))}get size(){return this.internalMap.size}forEach(t,e){this.internalMap.forEach(t,e)}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});class i{constructor(t){this.config=t}}},function(t,e,n){"use strict";var i=n(7),r="http://www.w3.org/1999/xhtml",a={svg:"http://www.w3.org/2000/svg",xhtml:r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},o=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),a.hasOwnProperty(e)?{space:a[e],local:t}:t};var s=function(t){var e=o(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===r&&e.documentElement.namespaceURI===r?e.createElement(t):e.createElementNS(n,t)}})(e)};function l(){}var u=function(t){return null==t?l:function(){return this.querySelector(t)}};function c(){return[]}var d=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var h=document.documentElement;if(!h.matches){var f=h.webkitMatchesSelector||h.msMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector;d=function(t){return function(){return f.call(this,t)}}}}var m=d,p=function(t){return new Array(t.length)};function g(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}g.prototype={constructor:g,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var v="$";function _(t,e,n,i,r,a){for(var o,s=0,l=e.length,u=a.length;s<u;++s)(o=e[s])?(o.__data__=a[s],i[s]=o):n[s]=new g(t,a[s]);for(;s<l;++s)(o=e[s])&&(r[s]=o)}function y(t,e,n,i,r,a,o){var s,l,u,c={},d=e.length,h=a.length,f=new Array(d);for(s=0;s<d;++s)(l=e[s])&&(f[s]=u=v+o.call(l,l.__data__,s,e),u in c?r[s]=l:c[u]=l);for(s=0;s<h;++s)(l=c[u=v+o.call(t,a[s],s,a)])?(i[s]=l,l.__data__=a[s],c[u]=null):n[s]=new g(t,a[s]);for(s=0;s<d;++s)(l=e[s])&&c[f[s]]===l&&(r[s]=l)}function b(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var M=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function x(t){return t.trim().split(/^|\s+/)}function w(t){return t.classList||new k(t)}function k(t){this._node=t,this._names=x(t.getAttribute("class")||"")}function L(t,e){for(var n=w(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function S(t,e){for(var n=w(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}k.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function T(){this.textContent=""}function Y(){this.innerHTML=""}function D(){this.nextSibling&&this.parentNode.appendChild(this)}function C(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function E(){return null}function A(){var t=this.parentNode;t&&t.removeChild(this)}function O(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function j(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}var N={},H=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(N={mouseenter:"mouseover",mouseleave:"mouseout"}));function V(t,e,n){return t=P(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function P(t,e,n){return function(i){var r=H;H=i;try{t.call(this,this.__data__,e,n)}finally{H=r}}}function F(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,a=e.length;i<a;++i)n=e[i],t.type&&n.type!==t.type||n.name!==t.name?e[++r]=n:this.removeEventListener(n.type,n.listener,n.capture);++r?e.length=r:delete this.__on}}}function I(t,e,n){var i=N.hasOwnProperty(t.type)?V:P;return function(r,a,o){var s,l=this.__on,u=i(e,a,o);if(l)for(var c=0,d=l.length;c<d;++c)if((s=l[c]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=u,s.capture=n),void(s.value=e);this.addEventListener(t.type,u,n),s={type:t.type,name:t.name,value:e,listener:u,capture:n},l?l.push(s):this.__on=[s]}}function R(t,e,n,i){var r=H;t.sourceEvent=H,H=t;try{return e.apply(n,i)}finally{H=r}}function W(t,e,n){var i=M(t),r=i.CustomEvent;"function"==typeof r?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}var z=[null];function B(t,e){this._groups=t,this._parents=e}function U(){return new B([[document.documentElement]],z)}B.prototype=U.prototype={constructor:B,select:function(t){"function"!=typeof t&&(t=u(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var a,o,s=e[r],l=s.length,c=i[r]=new Array(l),d=0;d<l;++d)(a=s[d])&&(o=t.call(a,a.__data__,d,s))&&("__data__"in a&&(o.__data__=a.__data__),c[d]=o);return new B(i,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=function(t){return null==t?c:function(){return this.querySelectorAll(t)}}(t));for(var e=this._groups,n=e.length,i=[],r=[],a=0;a<n;++a)for(var o,s=e[a],l=s.length,u=0;u<l;++u)(o=s[u])&&(i.push(t.call(o,o.__data__,u,s)),r.push(o));return new B(i,r)},filter:function(t){"function"!=typeof t&&(t=m(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var a,o=e[r],s=o.length,l=i[r]=[],u=0;u<s;++u)(a=o[u])&&t.call(a,a.__data__,u,o)&&l.push(a);return new B(i,this._parents)},data:function(t,e){if(!t)return f=new Array(this.size()),u=-1,this.each(function(t){f[++u]=t}),f;var n=e?y:_,i=this._parents,r=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var a=r.length,o=new Array(a),s=new Array(a),l=new Array(a),u=0;u<a;++u){var c=i[u],d=r[u],h=d.length,f=t.call(c,c&&c.__data__,u,i),m=f.length,p=s[u]=new Array(m),g=o[u]=new Array(m);n(c,d,p,g,l[u]=new Array(h),f,e);for(var v,b,M=0,x=0;M<m;++M)if(v=p[M]){for(M>=x&&(x=M+1);!(b=g[x])&&++x<m;);v._next=b||null}}return(o=new B(o,i))._enter=s,o._exit=l,o},enter:function(){return new B(this._enter||this._groups.map(p),this._parents)},exit:function(){return new B(this._exit||this._groups.map(p),this._parents)},merge:function(t){for(var e=this._groups,n=t._groups,i=e.length,r=n.length,a=Math.min(i,r),o=new Array(i),s=0;s<a;++s)for(var l,u=e[s],c=n[s],d=u.length,h=o[s]=new Array(d),f=0;f<d;++f)(l=u[f]||c[f])&&(h[f]=l);for(;s<i;++s)o[s]=e[s];return new B(o,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i,r=t[e],a=r.length-1,o=r[a];--a>=0;)(i=r[a])&&(o&&o!==i.nextSibling&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=b);for(var n=this._groups,i=n.length,r=new Array(i),a=0;a<i;++a){for(var o,s=n[a],l=s.length,u=r[a]=new Array(l),c=0;c<l;++c)(o=s[c])&&(u[c]=o);u.sort(e)}return new B(r,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,a=i.length;r<a;++r){var o=i[r];if(o)return o}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r,a=e[n],o=0,s=a.length;o<s;++o)(r=a[o])&&t.call(r,r.__data__,o,a);return this},attr:function(t,e){var n=o(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==e?n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof e?n.local?function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}:function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}:n.local?function(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}:function(t,e){return function(){this.setAttribute(t,e)}})(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):function(t,e){return t.style.getPropertyValue(e)||M(t).getComputedStyle(t,null).getPropertyValue(e)}(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=x(t+"");if(arguments.length<2){for(var i=w(this.node()),r=-1,a=n.length;++r<a;)if(!i.contains(n[r]))return!1;return!0}return this.each(("function"==typeof e?function(t,e){return function(){(e.apply(this,arguments)?L:S)(this,t)}}:e?function(t){return function(){L(this,t)}}:function(t){return function(){S(this,t)}})(n,e))},text:function(t){return arguments.length?this.each(null==t?T:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Y:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(D)},lower:function(){return this.each(C)},append:function(t){var e="function"==typeof t?t:s(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:s(t),i=null==e?E:"function"==typeof e?e:u(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})},remove:function(){return this.each(A)},clone:function(t){return this.select(t?j:O)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var i,r,a=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),o=a.length;if(!(arguments.length<2)){for(s=e?I:F,null==n&&(n=!1),i=0;i<o;++i)this.each(s(a[i],e,n));return this}var s=this.node().__on;if(s)for(var l,u=0,c=s.length;u<c;++u)for(i=0,l=s[u];i<o;++i)if((r=a[i]).type===l.type&&r.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?function(t,e){return function(){return W(this,t,e.apply(this,arguments))}}:function(t,e){return function(){return W(this,t,e)}})(t,e))}};var G=function(t){return"string"==typeof t?new B([[document.querySelector(t)]],[document.documentElement]):new B([[t]],z)},q=function(t){return G(s(t).call(document.documentElement))},J=0;function X(){this._="@"+(++J).toString(36)}X.prototype=function(){return new X}.prototype={constructor:X,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var Z,K=function(){for(var t,e=H;t=e.sourceEvent;)e=t;return e},Q=function(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,[(i=i.matrixTransform(t.getScreenCTM().inverse())).x,i.y]}var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]},tt=function(t){var e=K();return e.changedTouches&&(e=e.changedTouches[0]),Q(t,e)},et=function(t,e,n){arguments.length<3&&(n=e,e=K().changedTouches);for(var i,r=0,a=e?e.length:0;r<a;++r)if((i=e[r]).identifier===n)return Q(t,i);return null},nt=n(2),it=n(16),rt=n(4),at=n(9),ot=n(3);!function(t){t[t.SolidColor=0]="SolidColor",t[t.Image=1]="Image",t[t.Graph=2]="Graph"}(Z||(Z={}));var st,lt=n(5);!function(t){t[t.HorizontalTranslation=0]="HorizontalTranslation",t[t.VerticalTranslation=1]="VerticalTranslation",t[t.Rotation=2]="Rotation"}(st||(st={}));var ut,ct=n(0);!function(t){t[t.ClockWise=0]="ClockWise",t[t.ReverseClockWise=1]="ReverseClockWise"}(ut||(ut={}));var dt,ht=n(8),ft=n(10);class mt{constructor(t,e,n,i){if(this.signalRAppId=i,this.rotationValueChanged=new ct.EventEmitter,!t.variableName)return;const r=new ft.a(t.variableName,t.variableGroupName,t.dataSourceCode,t.variableVersion),a=ht.a.getConvertedVariableName(n,r);a&&e.subscribeVariableState(a).subscribe(t=>{t.state===rt.d.Normal&&e.openVariable(a,this.signalRAppId).subscribe(t=>{t.state===rt.d.DataNormal&&(this.currentValue=t,this.rotationValueChanged.emit(this.currentValue.value))})})}}class pt{constructor(t,e,n,i){this.doRotation=new ct.EventEmitter,new mt(t,e,n,i).rotationValueChanged.subscribe(e=>{if(+t.rotationDirection===ut.ClockWise){let n;if(!0===t.isProportion){const i=(t.maxAngle-t.minAngle)/(t.maxProportionScale-t.minProportionScale);n=!0===t.isReverseProportion?e>t.maxProportionScale?t.minAngle:e<t.minProportionScale?t.maxAngle:t.maxAngle-(e-t.minProportionScale)*i:e>t.maxProportionScale?t.maxAngle:e<t.minProportionScale?t.minAngle:t.minAngle+(e-t.minProportionScale)*i,this.doRotation.emit(n)}else e<t.minAngle?this.doRotation.emit(t.minAngle):e>t.maxAngle?this.doRotation.emit(t.maxAngle):this.doRotation.emit(e)}else if(+t.rotationDirection===ut.ReverseClockWise){let n;const i=360-t.maxAngle,r=360-t.minAngle;if(!0===t.isProportion){const a=(r-i)/(t.maxProportionScale-t.minProportionScale);!0===t.isReverseProportion?n=e>t.maxProportionScale?r:e<t.minProportionScale?i:i+(e-t.minProportionScale)*a:(n=e>t.maxProportionScale?i:e<t.minProportionScale?r:r-(e-t.minProportionScale)*a)>r?n=r:n<i&&(n=i),this.doRotation.emit(n)}else(n=360-e)<i?this.doRotation.emit(i):n>r?this.doRotation.emit(r):this.doRotation.emit(n)}})}}!function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(dt||(dt={}));class gt{constructor(t,e,n,i){if(this.translationValueChanged=new ct.EventEmitter,!t.variableName)return;const r=new ft.a(t.variableName,t.variableGroupName,t.dataSourceCode,t.variableVersion),a=ht.a.getConvertedVariableName(n,r);a&&e.subscribeVariableState(a).subscribe(t=>{t.state===rt.d.Normal&&e.openVariable(a,i).subscribe(t=>{t.state===rt.d.DataNormal&&(this.currentValue=t,this.translationValueChanged.emit(this.currentValue.value))})})}}class vt{constructor(t,e,n,i,r,a){if(this.doTranslation=new ct.EventEmitter,i===dt.Horizontal){new gt(t,e,n,a).translationValueChanged.subscribe(e=>{const n=this.getTranslationValue(t,+e,r.x);this.doTranslation.emit(n)})}if(i===dt.Vertical){new gt(t,e,n,a).translationValueChanged.subscribe(e=>{const n=this.getTranslationValue(t,+e,r.y);this.doTranslation.emit(n)})}}getTranslationValue(t,e,n){let i;if(!0===t.isProportion){const r=(t.maxCoordinate-t.minCoordinate)/(t.maxProportionScale-t.minProportionScale);if(!0===t.isReverseProportion){const a=n+t.maxCoordinate;i=+e>t.maxProportionScale?n+t.minCoordinate:+e<t.minProportionScale?a:a-(+e-t.minProportionScale)*r}else i=+e>t.maxProportionScale?t.maxCoordinate+n:+e<t.minProportionScale?t.minCoordinate+n:n+t.minCoordinate+(e-t.minProportionScale)*r}else i=e+n;return i>t.maxCoordinate+n&&(i=t.maxCoordinate+n),i<t.minCoordinate+n&&(i=t.minCoordinate+n),i}}class _t{constructor(t,e,n){this.translation=t,this.angel=e,this.behaviorType=n}}class yt{constructor(t,e,n,i,r){if(this.doBehavior=new ct.EventEmitter,t.isHorizontalTranslation&&null!=t.horizontalTranslation){new vt(t.horizontalTranslation,e,n,dt.Horizontal,i,r).doTranslation.subscribe(t=>{const e=new _t(t,void 0,st.HorizontalTranslation);this.doBehavior.emit(e)})}if(t.isVerticalTranslation&&null!=t.verticalTranslation){new vt(t.verticalTranslation,e,n,dt.Vertical,i,r).doTranslation.subscribe(t=>{const e=new _t(t,void 0,st.VerticalTranslation);this.doBehavior.emit(e)})}if(t.isRotation&&null!=t.rotation){new pt(t.rotation,e,n,r).doRotation.subscribe(t=>{const e=new _t(void 0,t,st.Rotation);this.doBehavior.emit(e)})}}}class bt{constructor(t,e=""){this.signalRAppId=e,this.$element=$(t),this.rootElement=G(t),this.model=JSON.parse(this.rootElement.attr("data-model"))}}class Mt extends bt{constructor(t,e,n,i,r){super(t,r),this.permissionChecker=e,this.variableCommunicator=n,this.variableStore=i,this.initDisplay()}initDisplay(){if(!1===this.model.isAwaysDisplay)if(this.hide(),null==this.model.version||this.model.version<3)this.updateVisibilityByCondition();else{const t=this.model.isDisplayControl||this.model.conditionItems.length>0;this.model.isDisplayPermission&&!t&&this.updateVisibilityByPermission(),!this.model.isDisplayPermission&&t&&this.updateVisibilityByCondition(),this.model.isDisplayPermission&&t&&this.checkDisplayConditionAndPermission()}}checkDisplayConditionAndPermission(){if(null==this.model.conditionItems||!this.model.conditionItems.length)return;const t=new ot.ConditionItemsResultObserver(this.model.conditionItems,this.variableCommunicator,this.variableStore);t.conditionResultChanged.subscribe(t=>{t.value?this.updateVisibilityByPermission():this.hide()}),t.requestData(this.signalRAppId)}updateVisibilityByCondition(){if(null==this.model.conditionItems||!this.model.conditionItems.length)return;const t=new ot.ConditionItemsResultObserver(this.model.conditionItems,this.variableCommunicator,this.variableStore);t.conditionResultChanged.subscribe(t=>{t.value?this.show():this.hide()}),t.requestData(this.signalRAppId)}updateVisibilityByPermission(){this.model.displayPermissionCodes&&this.model.displayPermissionCodes.length&&(this.permissionChecker.isGranted(this.model.displayPermissionCodes)?this.show():this.hide())}hide(){this.rootElement.style("display","none")}show(){this.rootElement.style("display","block")}}class xt extends Mt{constructor(t,e,n,i,r){super(t,e,n,i,r),this.variableCommunicator=n,this.variableStore=i,this.initDynamicBehavior()}initDynamicBehavior(){if(this.ang=0,this.model.version>=1&&null!=this.model.dynamicSetting){const t=this.getActualLocation(),e=this.model.strokeWidth?this.model.strokeWidth:0;this.hor=t.x-Number(e)/2,this.ver=t.y-Number(e)/2,new yt(this.model.dynamicSetting,this.variableCommunicator,this.variableStore,t,this.signalRAppId).doBehavior.subscribe(t=>{this.model.angle&&(this.ang=Number(this.model.angle)),t.behaviorType===st.HorizontalTranslation?this.hor=Number(t.translation)-Number(e)/2:t.behaviorType===st.VerticalTranslation?this.ver=Number(t.translation)-Number(e)/2:t.behaviorType===st.Rotation&&(this.model.angle?this.ang+=Number(t.angel):this.ang=Number(t.angel));const n=Math.cos(this.ang*Math.PI/180),i=Math.sin(this.ang*Math.PI/180);if(this.model.version>=2){const t=this.getActualSize();if(void 0===t)this.x=this.hor,this.y=this.ver;else switch(this.model.fixedPositionType){case 0:this.x=this.hor,this.y=this.ver;break;case 1:this.x=this.hor+t.width/2,this.y=this.ver;break;case 2:this.x=this.hor+t.width,this.y=this.ver;break;case 3:this.x=this.hor,this.y=this.ver+t.height/2;break;case 4:this.x=this.hor+t.width/2,this.y=this.ver+t.height/2;break;case 5:this.x=this.hor+t.width,this.y=this.ver+t.height/2;break;case 6:this.x=this.hor,this.y=this.ver+t.height;break;case 7:this.x=this.hor+t.width/2,this.y=this.ver+t.height;break;case 8:this.x=this.hor+t.width,this.y=this.ver+t.height}let e=!0;(e=(this.model.category!==lt.d.components.meterKey&&this.model.category!==lt.d.components.switchIndicatorLightKey&&this.model.category!==lt.d.components.imageKey||!(this.model.version>4))&&(!(this.model.category===lt.d.components.toggleViewKey&&this.model.version>5)&&!(this.model.category!==lt.d.components.meterKey&&this.model.category!==lt.d.components.switchIndicatorLightKey&&this.model.category!==lt.d.components.imageKey&&this.model.category!==lt.d.components.toggleViewKey&&this.model.version>3)))?(this.rotatedHor=(this.hor-this.x)*n-(this.ver-this.y)*i+this.x,this.rotatedVer=(this.hor-this.x)*i+(this.ver-this.y)*n+this.y):(this.rotatedHor=(this.hor-this.x)*n-(this.ver-this.y)*i+this.hor,this.rotatedVer=(this.hor-this.x)*i+(this.ver-this.y)*n+this.ver),this.transform="matrix("+n.toFixed(6)+","+i.toFixed(6)+","+(-1*i).toFixed(6)+","+n.toFixed(6)+","+this.rotatedHor+","+this.rotatedVer+")",this.rootElement.style("-webkit-transform",this.transform)}else this.transform="matrix("+n.toFixed(6)+","+i.toFixed(6)+","+(-1*i).toFixed(6)+","+n.toFixed(6)+","+this.hor+","+this.ver+")",this.rootElement.style("-webkit-transform",this.transform)})}}getActualSize(){return this.model.size}getActualLocation(){return this.model.location}isBold(t){return t&&-1!==t.indexOf("bold")}isItalic(t){return t&&-1!==t.indexOf("Italic")}fontFamily(t){if(!t)return null;const e=this.isBold(t)?1:0,n=this.isItalic(t)?1:0,i=t.split(" "),r=e+n+1;return i.length>r?i[r]:null}}class wt extends xt{constructor(t,e,n,i,r,a){super(t,e,n,i,a),this.localization=r,this.isEnable=!0,this.elementStates=[]}initState(){this.elementStates.length&&(this.state=ot.State.Loading,this.loadStateData(this.state))}updateElementStates(t){Object(nt.forEach)(this.elementStates,e=>{Object(nt.forEach)(t,t=>{e.variableName===t.variableName&&(e.state=t.state)})}),this.changeStates()}addElementState(t){let e=!1;Object(nt.forEach)(this.elementStates,n=>{n.variableName===t.variableName&&(e=!0)}),e||this.elementStates.push(t)}changeStates(){this.state=ot.State.Normal,Object(nt.forEach)(this.elementStates,t=>{const e=this.getState(t);this.changeState(e)}),this.state===ot.State.Normal&&(this.isEnable||(this.state=ot.State.Disable)),this.loadStateData(this.state)}getState(t){let e=ot.State.Loading;switch(t.state){case rt.d.Offline:e=ot.State.Offline;break;case rt.d.Unbind:e=ot.State.Unbind;break;case rt.d.DataNormal:e=ot.State.Normal;break;case rt.d.Abnormal:e=ot.State.Abnormal}return e}changeState(t){switch(t){case ot.State.Unbind:this.state=ot.State.Unbind;break;case ot.State.Offline:this.state!==ot.State.Unbind&&(this.state=ot.State.Offline);break;case ot.State.Loading:this.state!==ot.State.Unbind&&this.state!==ot.State.Offline&&(this.state=ot.State.Loading);break;case ot.State.Abnormal:this.state!==ot.State.Unbind&&this.state!==ot.State.Offline&&this.state!==ot.State.Loading&&(this.state=ot.State.Abnormal)}}loadStateData(t){if(t===this.preState)return;if(this.preState=t,this.state===ot.State.Normal)return void this.clearTip();let e="",n="",i="";switch(t){case ot.State.Offline:e="assets/img/offline.svg",n=this.localization.offline,i="#999999";break;case ot.State.Unbind:e="assets/img/unbind.svg",n=this.localization.unbind,i="#586e7c";break;case ot.State.Abnormal:e="assets/img/abnormal.svg",n=this.localization.abnormal,i="#f6a520";break;case ot.State.Disable:e="assets/img/disabled.svg",n=this.localization.disable,i="#ff4444";break;default:e="assets/img/loading.svg",n=this.localization.loading,i="#226abc"}this.setState(e,n,i)}setState(t,e,n){if(this.clearTip(),this.currentRect||(this.currentRect=this.$element.find("rect#StateFrame").first()),!this.currentRect.length)return;const i=this.$element[0].ownerDocument,r=i.createElementNS("http://www.w3.org/2000/svg","image");if(r){const a=this.currentRect[0];let o=Number(a.getAttribute("width"))-20;const s=a.getAttribute("x");null!==s&&(o+=Number(s)),a.setAttribute("stroke",n),a.setAttribute("stroke-opacity","0.5"),r.href.baseVal=t,r.setAttributeNS(null,"id","StateImage"),r.setAttributeNS(null,"x",o.toString()),r.setAttributeNS(null,"y","0"),r.setAttributeNS(null,"height","20px"),r.setAttributeNS(null,"width","20px");const l=i.createElementNS("http://www.w3.org/2000/svg","title"),u=i.createTextNode(e);l.appendChild(u),r.appendChild(l),this.$element.append(r)}}clearTip(){if(this.currentRect||(this.currentRect=this.$element.find("rect#StateFrame").first()),!this.currentRect.length)return;const t=this.currentRect[0];t.getAttribute("stroke")&&t.removeAttribute("stroke"),this.$element.find("image#StateImage").remove()}}class kt extends wt{constructor(t,e,n,i,r,a){super(t,e,n,i,r,a),this.permissionChecker=e,this.variableCommunicator=n,this.variableStore=i,this.localization=r,this.isGrantedPermission=!1,this.isInitialized=!1,setTimeout(()=>{this.initialize()})}initialize(){!1===this.model.isAwaysEnable?(null==this.model.version||this.model.version<3?this.updateEnableStateByCondition():((this.model.isEnablePermission||void 0===this.model.isEnablePermission)&&this.model.enablePermissionCodes?this.isGrantedPermission=this.permissionChecker.isGranted(this.model.enablePermissionCodes):this.isGrantedPermission=!0,this.model.isEnablePermission&&!this.model.isEnableControl&&this.updateEnableStateByPermission(),!this.model.isEnablePermission&&this.model.isEnableControl&&this.updateEnableStateByCondition(),this.model.isEnablePermission&&this.model.isEnableControl&&this.updateEnableStateByConditionAndPermission(),this.model.isEnablePermission||this.model.isEnableControl||this.updateEnableStateByConditionAndPermission()),this.isGrantedPermission||(this.isInitialized=!0,this.isEnable=!1,this.changeStates())):this.isInitialized=!0}updateEnableStateByConditionAndPermission(){if(null==this.model.enableItems||!this.model.enableItems.length)return void(this.isInitialized=!0);const t=new ot.ConditionItemsResultObserver(this.model.enableItems,this.variableCommunicator,this.variableStore);t.conditionResultChanged.subscribe(t=>{t.value?this.updateEnableStateByPermission():this.setEnableByConditionOrPermission(!1),this.isInitialized=!0,this.changeStates()}),t.requestData(this.signalRAppId)}updateEnableStateByCondition(){if(null==this.model.enableItems||!this.model.enableItems.length)return void(this.isInitialized=!0);const t=new ot.ConditionItemsResultObserver(this.model.enableItems,this.variableCommunicator,this.variableStore);t.conditionResultChanged.subscribe(t=>{this.setEnableByConditionOrPermission(t.value),this.isInitialized=!0,this.changeStates()}),t.requestData(this.signalRAppId)}updateEnableStateByPermission(){let t=!1;t=!this.model.enablePermissionCodes||this.permissionChecker.isGranted(this.model.enablePermissionCodes),this.setEnableByConditionOrPermission(t),this.isInitialized=!0}setEnableByConditionOrPermission(t){this.isEnable=t}}class Lt extends kt{constructor(t,e,n,i,r,a){super(t,e,n,i,r,a)}init(t){if(t){let e=!1;Object(nt.forEach)(this.elementStates,n=>{n.variableName===t&&(e=!0)}),e||this.elementStates.push(new rt.c(t,void 0))}this.initState()}get readVariableName(){if(!this.model)throw new Error("Model cannot be null");if(null==this.model.version||this.model.version<2)return this.model.variableName;{const t=this.model.readVariable;if(!t)return;return ht.a.getConvertedVariableName(this.variableStore,t)}}get minVariableName(){if(this.model.minValueType)return this.getVariableName(this.model.minVariable)}get minValueType(){return this.model.minValueType}get maxVariableName(){if(this.model.maxValueType)return this.getVariableName(this.model.maxVariable)}get maxValueType(){return this.model.maxValueType}getVariableName(t){if(!this.model)throw new Error("Model cannot be null");if(t)return ht.a.getConvertedVariableName(this.variableStore,t)}reportStateChanged(t){Object(nt.forEach)(this.elementStates,e=>{e.variableName===t.variableName&&(e.state=t.state,this.changeStates())})}reportValueChanged(t){Object(nt.forEach)(this.elementStates,e=>{e.variableName===t.variableName&&(e.state=t.state,this.changeStates())}),this.state!==ot.State.Normal&&this.state!==ot.State.Disable&&t.variableName!==this.minVariableName&&t.variableName!==this.maxVariableName||this.updateVariableValue(t.value,t.variableName)}}function St(t,e,n){return n>e?1:n<t?0:(n-t)/(e-t)}function Tt(t){return t*(Math.PI/180)}var Yt=n(15);class Dt extends Lt{constructor(t,e,n,i,r,a){if(super(t,e,n,i,r,a),this.defaultBarColor="#6fd149",this.defaultUpperLimitColor="#ff4448",this.defaultLowerLimitColor="#0f60e8",this.barText="",this.valueObj={},this.isNeedUpdateScale=!1,(this.model.minValueType===Yt.a.Constant&&this.model.maxValueType===Yt.a.Variable||this.model.maxValueType===Yt.a.Constant&&this.model.minValueType===Yt.a.Variable)&&(this.isNeedUpdateScale=!0,this.updateScale(),this.isNeedUpdateScale=!1),this.$barRect=this.$element.find("rect"),this.$barText=this.$element.find('text[id="text"]').last(),this.model.version&&this.model.version>=1){const t=this.model.backgroundColor?this.model.backgroundColor:"transparent";this.barElement=this.$element.children(`path[fill='${t}']`),this.defaultTransform=this.barElement.attr("transform"),this.$barRect.attr("transform",this.defaultTransform)}setTimeout(()=>{this.initFrameNode()},0)}get readVariableName(){if(!this.model)throw new Error("Model cannot be null");if(null==this.model.version||this.model.version<2)return this.model.variableName;{const t=this.model.readVariable;if(!t)return;return ht.a.getConvertedVariableName(this.variableStore,t)}}initFrameNode(){const t=Snap(this.$element[0]).getBBox(!0);this.rootElement.append("rect").attr("id","StateFrame").attr("width",t.width).attr("height",t.height).attr("fill","transparent")}updateValueObj(t,e){var n,i,r;(null===(n=this.model.readVariable)||void 0===n?void 0:n.name)===e&&(this.isNeedUpdateScale=!1,this.valueObj.value=t),(null===(i=this.model.minVariable)||void 0===i?void 0:i.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.min=t),(null===(r=this.model.maxVariable)||void 0===r?void 0:r.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.max=t)}updateScale(){if(!this.isNeedUpdateScale)return;const t=this.$element.find("g:first > text");let e=this.model.minValueType?this.valueObj.min:this.model.min,n=this.model.maxValueType?this.valueObj.max:this.model.max;e=Number(e),n=Number(n),(isNaN(e)||isNaN(n))&&(e=Dt.DEFAULT_MIN_VALUE,n=Dt.DEFAULT_MAX_VALUE);const i=((n-e)/this.model.masterDivisionNumber).toFixed(5);for(let n=0;n<t.length;n++){const r=t[n];if(!r.innerHTML)continue;let a=(Number(i)*n+e).toFixed(0);this.model.fractionDigits>0&&(a=(a/Math.pow(10,this.model.fractionDigits)).toFixed(this.model.fractionDigits)),isNaN(a)||(r.innerHTML=a)}}updateVariableValue(t,e){this.updateValueObj(t,e),this.updateScale();const n=Number(this.valueObj.value);let i=this.model.maxValueType?this.valueObj.max:this.model.max,r=this.model.minValueType?this.valueObj.min:this.model.min;if(r=Number(r),i=Number(i),(isNaN(r)||isNaN(i))&&(r=Dt.DEFAULT_MIN_VALUE,i=Dt.DEFAULT_MAX_VALUE),isNaN(n))return;const a=this.model.useAlarmLimit,o=null!=this.model.upperLimit,s=null!=this.model.lowerLimit;let l=this.model.barColor;const u=this.model.upperLimitColor,c=this.model.lowerLimitColor,d=this.model.percentageFont;let h;h=this.model.version&&this.model.version>=1?this.barElement[0].getBBox():this.$barRect.parent()[0].getBBox();const f=St(r,i,n);let m=0;this.model.direction!==ot.BarGraphDirection.DownToUp&&this.model.direction!==ot.BarGraphDirection.LeftToRight||(m=h.height*(1-f)),l||(l=this.defaultBarColor),a&&(o&&n>+this.model.upperLimit?l=u||this.defaultUpperLimitColor:s&&n<+this.model.lowerLimit&&(l=c||this.defaultLowerLimitColor)),this.$barRect.attr("height",h.height*f),this.$barRect.attr("width",h.width),this.$barRect.attr("fill",l),this.model.version&&this.model.version>=1?this.$barRect.attr("transform",this.defaultTransform+` translate(0,${m})`):this.$barRect.attr("transform",`translate(0,${m})`),this.barText=(100*f).toFixed(0)+"%",this.$barText.text(this.barText),d&&(this.$barText.attr("font-family","Microsoft YaHei"),this.$barText.attr("font-size",d.fontSize+""),this.$barText.attr("fill",d.color),d.isBold&&this.$barText.attr("font-weight","bold"),d.isItalic&&this.$barText.attr("font-style","italic"),d.isUnderline&&this.$barText.attr("text-decoration","underline"))}}Dt.DEFAULT_MIN_VALUE=0,Dt.DEFAULT_MAX_VALUE=100;var Ct=n(12),Et=n(21),At=n(20);class Ot{constructor(t,e,n,i){this.variableName=t,this.isPassword=e,this.charCount=n,this.originValue=i}}var jt=n(37),Nt=n(42);class Ht{static getExtendedStyle(t,e){if(e<0)throw new Error("stateIndex can not less than zero.");let n;return null!=t.styles&&(n=t.styles.find(t=>null==t.version?null!=t.state&&+t.state===e:t.stateIndex===e)),n}}n(47),n(46);var Vt=n(45),Pt=n(44),Ft=n(41),It=n(19);class Rt{constructor(t,e,n,i,r){/iPhone|iPod/i.test(navigator.userAgent)&&(n+=10),this._element=this.getforeignObjectElement(n,i),this._element.innerHTML="";const a=this.createNewForeignObjectText(t,e,n,i,r);this._element.appendChild(a)}get Element(){return this._element}getforeignObjectElement(t,e){const n=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");return n.setAttribute("width",t.toString()),n.setAttribute("height",e.toString()),n}createNewForeignObjectText(t,e,n,i,r){e&&!e.fontFamily.includes(",msyh")&&(e.fontFamily+=",msyh");const a=document.createElement("div"),o=e.textAlign?e.textAlign:"center";a.style.cssText=`user-select: none;text-align: ${o};display: table-cell;vertical-align: middle;`,Object(nt.isNil)(t)&&(t="");let s=t.toString().split("\n");s=s.map(t=>t.toString().replace(/\s/g," "));const l=document.createDocumentFragment();for(let t=0;t<s.length;t++){const n=document.createElement("div");n.className="text-list";const i=s[t]?s[t]:" ";let r="";e.isItalic&&(r+="italic "),e.isBold&&(r+="bold ");let a=0;const o=12;a=parseInt(e.fontSize,10)+5,r+=e.fontSize+"/"+a.toString()+"px "+e.fontFamily,n.style.cssText=`color: ${e.color};word-break: break-all;font: ${r};`,e.isUnderline&&(n.style.textDecoration="underline");const u=document.createElement("span");u.style.cssText=`\n display: contents;\n transform: scale(${parseInt(e.fontSize,10)>o?1:parseInt(e.fontSize,10)/o});\n width: 100%;\n height: 100%;\n `,u.innerHTML=i,n.appendChild(u),l.appendChild(n)}a.appendChild(l);const u=document.createElement("div");u.style.cssText="display: table;width: 100%;height: 100%;",u.appendChild(a);const c=document.createElement("div");return c.style.cssText=`overflow: hidden;width: ${n.toString()+"px"};height: ${i.toString()+"px"};`,r&&(c.style.paddingRight="8px"),c.appendChild(u),c}}class Wt extends Lt{constructor(t,e,n,r,a,o,s,l,u,c,d){super(t,o,r,u,c,d),this.modalService=n,this.graphStore=a,this.operationRecordService=s,this.securityChecker=l,this.displayValue="",this.graphs=new Map,this.logger=e.get(i.b),this.accessPermissionService=e.get(Nt.a),this.initElement(),this.initClickEvent()}get readVariableName(){if(!this.model)throw new Error("Model cannot be null");if(null==this.model.version||this.model.version<1)return this.model.readVariableName;{const t=this.model.readVariable;if(!t)return;return ht.a.getConvertedVariableName(this.variableStore,t)}}get writeVariableName(){if(!this.model)throw new Error("Model cannot be null");if(null==this.model.version)return this.model.isSameVariable?this.model.readVariableName:this.model.writeVariableName;{const t=this.model.writeVariable;if(!t)return;return ht.a.getConvertedVariableName(this.variableStore,t)}}updateVariableValue(t){const e=this.getVariableValueText(t);this.displayValue=e.replace(/[\u0000-\u001F]|[\u007F-\u00A0]/g,""),this.updateDisplayValue(this.displayValue)}changeStates(){super.changeStates(),this.state===ot.State.Normal||this.state===ot.State.Disable?this.updateDisplayValue(this.displayValue):this.updateDisplayValue("")}updateDisplayValue(t){const e=this.$element.find("foreignObject").find("i");e&&e.text(t)}getVariableValueText(t){return this.characterDisplayText(this.model.isPassword,t)}characterDisplayText(t,e){let n="";return null==e||e.toString().trim().length<=0?n:(n=e.toString(),t&&(n="*".repeat(n.length)),n)}initElement(){const{rootElement:t}=this;t.selectAll("*").remove();const e=this.model.label;let n=null,i=null;this.model.size&&(n=this.model.size.width,i=this.model.size.height),n&&i||(n=60,i=38),t.append("rect").attr("id","StateFrame").attr("width",n).attr("height",i).attr("fill","transparent"),this.initVariableText(n,i);let r="";this.model.showVariableText?(r=`translate(${7*n/11},0)`,n=4*n/11):r="translate(0,0)",this.model.useGraph&&t.append("image").attr("width",n).attr("height",i).attr("preserveAspectRatio","none").attr("fill","none").attr("crossorigin","anonymous").attr("transform",r);const a=e.font;if(!a)throw new Error("font missing.");const o=t.append("foreignObject").attr("width",n).attr("height",i).attr("fill","none").attr("transform",r).append("xhtml:div").attr("class","svgBody").html("<div></div>").select("div").style("height",i+"px").style("overflow","hidden").style("display","flex").style("align-items","center").append("i");if(o.style("word-break","break-all").style("text-align",a.textAlign).style("alignment-baseline","central").style("transform",`translate(${n/2},${i/2})`).text(e.content).style("color",a.color).style("font-size",a.fontSize).style("font-style","normal").style("width","100%"),a.fontStyle){const t=a.fontStyle.split(" "),e=$.inArray("bold",t),n=$.inArray("Italic",t),i=t.pop();e>=0&&o.style("font-weight","bold"),n>=0&&o.style("font-style","italic"),o.style("font-family",i?i+",msyh":"msyh")}if(a.isUnderline&&o.style("text-decoration","underline"),this.model.useGraph)if(this.graphs.has(0)){const t=this.graphs.get(0);if(null==t)return;this.changeGraph(t)}else this.graphs.set(0,null),this.graphStore.getGraph(this.model.graphSetting.id,0,Ht.getExtendedStyle(this.model.graphSetting,0)).subscribe(t=>{this.graphs.set(0,t),this.changeGraph(t)})}initVariableText(t,e){if(!this.model.showVariableText)return;const n={isUnderline:this.model.variableText.font.isUnderline,isBold:this.model.variableText.font.isBold,isItalic:this.model.variableText.font.isItalic,fontSize:this.model.variableText.font.fontSize,fontFamily:this.model.variableText.font.fontFamily,color:this.model.variableText.font.color,textAlign:this.model.variableText.font.textAlign},i=new Rt(this.model.variableText.content+":",n,7*t/11,e,!0);this.$element.append(i.Element)}initClickEvent(){this.writeVariableName&&this.accessPermissionService.canWrite(this.model.accessPermission)&&(this.rootElement.style("cursor","hand"),setTimeout(()=>{const t=this.$element[0].getBBox();this.$element.find("rect").attr("width",t.width),this.$element.find("rect").attr("height",t.height)},0),this.$element.click(t=>{if(this.isInitialized)if(this.isEnable)if(this.model.useSecurity){const t=this.modalService.show(At.a,{backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.checkElementPassword()})}else this.checkElementPassword();else{const t=this.isGrantedPermission?this.localization.conditionIsNotMetTip:this.localization.permissiontip,e=this.modalService.show(Et.a,{initialState:{alermMessage:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),n=e.content.onClosed.subscribe(()=>{e.hide(),n.unsubscribe()})}}))}checkElementPassword(){if(this.model.enablePassword){const t=this.modalService.show(It.a,{initialState:{securityChecker:this.securityChecker},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.doWriteCharacterValue()})}else this.doWriteCharacterValue()}doWriteCharacterValue(){if(null==this.writeVariableName)return;const t=new Ot(this.writeVariableName,this.model.isPassword,this.model.charCount,this.displayValue),e=this.modalService.show(jt.a,{initialState:{args:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),n=e.content.onClosed.subscribe(t=>{e.hide(),n.unsubscribe(),t&&(this.variableCommunicator.write(this.writeVariableName,t.value).subscribe(),this.recordOperation(t.value))})}recordOperation(t){(this.model.isRecordOperation||void 0===this.model.isRecordOperation)&&this.operationRecordService.record({variableOptionModel:{variableName:this.writeVariableName,originValue:this.displayValue,newValue:t},operationDescription:this.model.operationDescription})}changeGraph(t){if(t.failed)this.rootElement.select("image").attr("xlink:href",null);else{const e=t.graph;switch(e.graphType){case Ct.i.Image:case Ct.i.SVG:this.rootElement.select("image").attr("xlink:href",e.source);break;default:this.logger.error(new Error(`Unknown graph ${e.graphType}.`)),this.rootElement.select("image").attr("xlink:href",null)}}}}var zt,Bt,Ut,Gt=n(1);!function(t){t[t.YYMMDD=0]="YYMMDD",t[t.MMDDYY=1]="MMDDYY",t[t.DDMMYY=2]="DDMMYY"}(zt||(zt={})),function(t){t[t.Dot=0]="Dot",t[t.Line=1]="Line",t[t.Slash=2]="Slash",t[t.CHS=3]="CHS"}(Bt||(Bt={})),function(t){t[t.HHMM=0]="HHMM",t[t.HHMMSS=1]="HHMMSS"}(Ut||(Ut={}));class $t{constructor(t,e,n,i,r,a,o){this.graphSetting=t,this.width=e,this.height=n,this.graphStore=i,this.logger=r,this.version=a,this.faultFlickers=o,this.graphs=new Map,this.activeState=0,this.faultFlickerStatus=!1,this.faultFlickerInterval=void 0,this._element=document.createElementNS("http://www.w3.org/2000/svg","g")}get Element(){return this._element}switchToState(t){if(this.activeState=t,this.graphs.has(t)){const e=this.graphs.get(t);if(null==e)return;this.changeGraph(t,e)}else this.graphs.set(t,null),this.graphStore.getGraph(this.graphSetting.id,t,Ht.getExtendedStyle(this.graphSetting,t)).subscribe(e=>{this.graphs.set(t,e),this.activeState===t&&this.changeGraph(t,e)})}changeGraph(t,e){if(e.failed)this.removeImageElement();else{const n=e.graph;switch(n.graphType){case Ct.i.Image:case Ct.i.SVG:const e=this.getImageElement();e.setAttributeNS("http://www.w3.org/1999/xlink","href",n.source),this.doFaultFlicker(e,t);break;default:this.logger.error(new Error(`Unknown graph ${n.graphType}.`)),this.removeImageElement()}}}getImageElement(){return this.imageElement||(this.imageElement=document.createElementNS("http://www.w3.org/2000/svg","image"),this.imageElement.setAttribute("width",this.width+""),this.imageElement.setAttribute("height",this.height+""),this.imageElement.setAttribute("fill","none"),this.imageElement.setAttribute("preserveAspectRatio","none"),this.imageElement.setAttribute("crossorigin","anonymous"),this._element.appendChild(this.imageElement)),this.imageElement}removeImageElement(){this.imageElement&&(this._element.removeChild(this.imageElement),delete this.imageElement)}doFaultFlicker(t,e){if(this.version>3&&this.faultFlickers){this.clearFlickerInterval(t);const n=this.faultFlickers.find(t=>t.id===e);n&&n.faultFlicker&&n.faultFlicker.flicker===ot.Flicker.Image&&(this.faultFlickerInterval=setInterval(()=>{this.faultFlickerStatus?(t.setAttributeNS(null,"display","block"),this.faultFlickerStatus=!1):(t.setAttributeNS(null,"display","none"),this.faultFlickerStatus=!0)},500*n.faultFlicker.frequency))}}clearFlickerInterval(t){this.faultFlickerInterval&&(clearInterval(this.faultFlickerInterval),this.faultFlickerStatus&&t.setAttributeNS(null,"display","block"))}}class qt extends Mt{constructor(t,e,n,r,a,o,s){if(super(t,n,r,a,s),this.permissionChecker=n,this.variableCommunicator=r,this.variableStore=a,this.graphStore=o,this.logger=e.get(i.b),this.model.size&&this.model.useGraph&&this.initGraph(this.model.size.width,this.model.size.height),this.model.showDate||this.model.showWeek||this.model.showTime){this.$dateTimeText=this.$element.find("text").last();const t=this.getDatetimeFormat(this.model);this.getAndSetCurrentTime(t),setInterval(()=>{this.getAndSetCurrentTime(t)},1e3)}}getAndSetCurrentTime(t){const e=Gt().local().format(t);this.$dateTimeText.text(e);let n=this.$dateTimeText.css("font-family");n&&-1===n.lastIndexOf("msyh")&&this.$dateTimeText.css("font-family",n+=", msyh")}getDatetimeFormat(t){let e="";const n=t.showFullYear?"YYYY":"YY";let i="";const r=t.showMonthDayWithoutZero?"M":"MM",a=t.showMonthDayWithoutZero?"D":"DD";if(t.showDate){switch(t.datetimeSeparator){case Bt.Slash:i="/";break;case Bt.Line:i="-";break;case Bt.Dot:i=".";break;case Bt.CHS:}e=this.getFormat(t.dateFormat,n,r,a,i)}if(t.showWeek&&(e+=" ddd"),t.showTime)if(e+=" ",t.isTwelveHourHex)switch(e+="A ",t.timeFormat){case Ut.HHMMSS:e+="h:mm:ss";break;case Ut.HHMM:e+="h:mm"}else switch(t.timeFormat){case Ut.HHMMSS:e+="HH:mm:ss";break;case Ut.HHMM:e+="HH:mm"}return e}initGraph(t,e){if(!0===this.model.useGraph){const n=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger);n.switchToState(0),this.$element.prepend(n.Element)}}getFormat(t,e,n,i,r){let a="";if(""===r)switch(t){case zt.YYMMDD:a=e+"年"+n+"月"+i+"日";break;case zt.MMDDYY:a=n+"月"+i+"日"+e+"年";break;case zt.DDMMYY:a=i+"日"+n+"月"+e+"年"}else switch(t){case zt.YYMMDD:a=e+r+n+r+i;break;case zt.MMDDYY:a=n+r+i+r+e;break;case zt.DDMMYY:a=i+r+n+r+e}return a}}var Jt,Xt,Zt=n(25),Kt=n(38);!function(t){t[t.BeginOpenEndOpen=0]="BeginOpenEndOpen",t[t.BeginOpenEndClose=1]="BeginOpenEndClose",t[t.BeginCloseEndOpen=2]="BeginCloseEndOpen",t[t.BeginCloseEndClose=3]="BeginCloseEndClose"}(Jt||(Jt={})),function(t){t[t.Normal=0]="Normal",t[t.Loading=1]="Loading",t[t.Unbound=2]="Unbound",t[t.LoadFailed=3]="LoadFailed"}(Xt||(Xt={}));var Qt,te,ee=n(14);!function(t){t[t.Line=0]="Line",t[t.BarGroup=1]="BarGroup",t[t.BarStack=2]="BarStack"}(Qt||(Qt={})),function(t){t[t.Auto=0]="Auto",t[t.Custom=1]="Custom"}(te||(te={}));class ne extends Mt{constructor(t,e,n,r,a,o,s){super(t,n,r,a,s),this.historyDataStore=o,this.displayOption={dataLimit:500,dataZoomHeight:32,marginLeft:40,marginRight:20,mobileMinWidth:450,operationAreaHeight:32,operationAreaMarginTop:25,operationSelectFontSize:"16px",operationButtonWidth:24,operationButtonHeight:24,operationButtonMargin:4},this.elementStatus=Xt.Loading,this.logger=e.get(i.b),this.localization=e.get(at.b),this.timePeriods=this.getValidTimePeriods(),this.updateTimeRange(this.model.displaySetting.displayTimePeriod),this.refreshIntervalId=setInterval(()=>{this.loadFirstPage(),this.logger.debug(`[GUI]Refresh Histoical Curve:${Zt.time.format("%x %X")(new Date)}`)},1e3*this.model.displaySetting.refreshInterval),this.isMobileMode=ee.a.Mobile===e.get(ee.b).displayMode,this.isMobileMode&&(this.displayOption.operationAreaMarginTop=35,this.model.displaySetting.size.width>=this.displayOption.mobileMinWidth&&(this.displayOption.operationAreaHeight=68,this.displayOption.operationSelectFontSize="24px",this.displayOption.operationButtonWidth=60,this.displayOption.operationButtonHeight=60,this.displayOption.operationButtonMargin=6)),this.loadFirstPage()}dispose(){clearInterval(this.refreshIntervalId),this.chartElement&&this.chartElement.tooltip.hidden(!0),this.logger.debug(`[GUI]Dispose Histoical Curve Refresh Interval:${Zt.time.format("%x %X")(new Date)}`)}getValidTimePeriods(){const t=new Array;return t.push({key:6,name:this.localization.lastThirtyMinutes}),t.push({key:1,name:this.localization.lastOneHour}),t.push({key:7,name:this.localization.lastEightHour}),t.push({key:2,name:this.localization.lastTwentyFourHours}),t.push({key:3,name:this.localization.lastSevenDays}),t.push({key:4,name:this.localization.lastThirtyDays}),t.push({key:5,name:this.localization.lastOneYear}),t}updateTimeRange(t){this.currentTimePeriod=+t,this.updateQueryTimeRange()}updateQueryTimeRange(){switch(this.endTime=Gt(),this.currentTimePeriod){case 1:this.startTime=Gt().subtract(1,"hours");break;case 3:this.startTime=Gt().subtract(7,"days");break;case 4:this.startTime=Gt().subtract(30,"days");break;case 5:this.startTime=Gt().subtract(1,"years");break;case 6:this.startTime=Gt().subtract(30,"minutes");break;case 7:this.startTime=Gt().subtract(8,"hours");break;default:this.startTime=Gt().subtract(1,"days")}}reRenderElement(t,e,n,i){this.rootElement.selectAll("*").remove(),this.chartElement=null,this.renderElement(t,e,n,i)}renderElement(t,e,n,i){if(!this.model.dataSetting)return;const r=this.model.dataSetting.dataName,a=this.model.dataSetting.dataSourceCode,o=this.model.dataSetting.channels.map(t=>t.name);this.updateElementStatus(Xt.Loading);const s=new Ct.d(a,r,o,t,e,n,i);this.historyDataStore.getHistoryData(s).subscribe(t=>{t.error?this.updateElementStatus(Xt.LoadFailed,t.error):(this.clearStatus(),t.isUnbind?this.updateElementStatus(Xt.Unbound):this.updateElementStatus(Xt.Normal),t.values.length&&(this.currentStartTime=Gt(Object(nt.first)(t.values).time),this.currentEndTime=Gt(Object(nt.last)(t.values).time)),this.chartElement=this.renderChart(t.values))})}renderChart(t){const e=this.model.displaySetting.size.width,n=this.model.displaySetting.size.height-this.displayOption.operationAreaHeight-this.displayOption.operationAreaMarginTop,i=new Array;Object(nt.each)(this.model.dataSetting.channels,(e,n)=>{const r=new Array;Object(nt.each)(t,t=>r.push({x:Gt(t.time).local().toDate().valueOf(),y:t.values[n]})),i.push({key:e.name,area:e.projectEnabled,values:r})}),Kt.addGraph(()=>this.model.displaySetting.curveType===Qt.BarGroup||this.model.displaySetting.curveType===Qt.BarStack?this.getMultiBarWithFocusChart(e,n,i):this.getLineChart(e,n,i))}getLineChart(t,e,n){const i=Kt.models.lineChart().showLegend(!0).margin({top:0,bottom:0,left:this.displayOption.marginLeft,right:this.displayOption.marginRight}).noData(this.localization.chartNoData);return this.model.displaySetting.axisSetting.yAxisRangeType===te.Custom&&i.yDomain([this.model.displaySetting.axisSetting.yAxisMin,this.model.displaySetting.axisSetting.yAxisMax]),this.isMobileMode||(i.focusEnable(!0),i.focus.margin({top:10,right:0,bottom:0,left:0}),i.focus.height(40),i.focus.showXAxis(!1)),this.renderCommonProperty(i,t,e,n),this.renderOperationArea(t,e),i}getMultiBarWithFocusChart(t,e,n){const i=Kt.models.multiBarWithFocusChart().margin({top:0,bottom:0,left:this.displayOption.marginLeft,right:this.displayOption.marginRight}).controlLabels({grouped:this.localization.grouped,stacked:this.localization.stacked}).noData(this.localization.chartNoData);this.model.displaySetting.curveType===Qt.BarStack&&(i.stacked(!0),i.multibar.stacked(!0),i.multibar2.stacked(!0)),this.model.displaySetting.axisSetting.yAxisRangeType===te.Custom&&i.yDomain([this.model.displaySetting.axisSetting.yAxisMin,this.model.displaySetting.axisSetting.yAxisMax]),this.isMobileMode||(i.focusEnable(!0),i.focusShowAxisX(!1)),i.xAxis.tickFormat(t=>this.timeFormat(t,"%x %X")),this.renderCommonProperty(i,t,e,n),this.renderOperationArea(t,e);const r=this.rootElement.select(".nv-context");return r.select(".nv-barsWrap.nvd3-svg").attr("transform","translate(0,30)"),r.select(".nv-brushBackground").attr("transform","translate(0,30)"),r.select(".nv-x.nv-brush").attr("transform","translate(0,30)"),this.model.displaySetting.showAxis||(this.rootElement.select(".tick.zero").style("display","none"),this.rootElement.select(".nv-x.nv-axis.nvd3-svg").style("display","none"),this.rootElement.select(".nv-y.nv-axis.nvd3-svg").style("display","none")),i.update(),i}renderCommonProperty(t,e,n,i){var r,a;t.tooltip.headerFormatter(t=>this.timeFormat(t,"%x %X")),this.model.displaySetting.showAxis?(t.xAxis.showMaxMin(!0).tickFormat(t=>3===this.currentTimePeriod||4===this.currentTimePeriod||5===this.currentTimePeriod?this.timeFormat(t,"%y-%m-%d"):this.timeFormat(Number(t),"%X")),this.model.displaySetting.axisSetting&&(this.model.displaySetting.axisSetting.showAxisLabel&&this.model.displaySetting.axisSetting.axisLabelFont?(t.xAxis.fontSize(this.model.displaySetting.axisSetting.axisLabelFont.fontSize),t.yAxis.fontSize(this.model.displaySetting.axisSetting.axisLabelFont.fontSize).tickFormat(t=>+Zt.format(".9g")(t))):(t.xAxis.tickFormat(()=>""),t.yAxis.tickFormat(()=>"")))):(t.showXAxis(!1),t.showYAxis(!1)),t.width(e),t.height(n),t.color(this.model.dataSetting.channels.map(t=>t.connectorColor)),this.rootElement.append("g").datum(i).call(t),this.rootElement.selectAll(".nv-noData").attr("x",e/2).attr("y",n/2+this.displayOption.operationAreaHeight),Kt.utils.windowResize(()=>{t.update(),this.rootElement.selectAll(".nv-noData").attr("x",e/2).attr("y",n/2+this.displayOption.operationAreaHeight)});const o=null===(a=null===(r=this.model.displaySetting.axisSetting)||void 0===r?void 0:r.axisLabelFont)||void 0===a?void 0:a.fontSize;if(this.rootElement.selectAll(".domain").style("stroke-opacity",1),this.model.displaySetting.showAxis&&this.model.displaySetting.axisSetting){const t=this.model.displaySetting.axisSetting.axisColor;this.rootElement.selectAll(".domain").style("stroke",t),o&&this.model.displaySetting.axisSetting.showAxisLabel&&this.rootElement.selectAll(".nv-axisMaxMin").select("text").style("font-size",o)}let s=0;if(!1!==this.model.displaySetting.axisSetting.showTick&&(s=1),this.rootElement.selectAll(".nv-x").selectAll(".tick").selectAll("line").attr("style",`stroke:${this.model.displaySetting.axisSetting.xAxisTickColor||"rgb(127, 147, 159)"};stroke-width:${s};`),this.rootElement.selectAll(".nv-y").selectAll(".tick").selectAll("line").attr("style",`stroke:${this.model.displaySetting.axisSetting.yAxisTickColor||"rgb(127, 147, 159)"};stroke-width:${s};`),o&&3===this.currentTimePeriod||4===this.currentTimePeriod||5===this.currentTimePeriod){const t=this;this.rootElement.selectAll(".nv-x").selectAll(".tick").selectAll("text").data(function(e){return[t.timeFormat(Number(e),"%y-%m-%d"),t.timeFormat(Number(e),"%H:%M:%S")]}).enter().append("text").attr("class","full-date").attr("x",0).attr("y",0).attr("dy","2.3em").style("text-anchor","middle").style("font-size",o).text(t=>t),this.rootElement.selectAll(".nv-axisMaxMin-x").selectAll("text").data(function(e){return[t.timeFormat(Number(e),"%y-%m-%d"),t.timeFormat(Number(e),"%H:%M:%S")]}).enter().append("text").attr("class","full-date").attr("x",0).attr("y",0).attr("dy","2.3em").style("text-anchor","middle").style("font-size",o).text(t=>t);const e=this.rootElement.selectAll(".nv-focusWrap");if(e.size()){let t=e.attr("transform");t&&t.length&&-1!==t.indexOf(",")&&(t=t.slice(0,-1).split(",")[1],this.rootElement.selectAll(".nv-focusWrap").attr("transform",`translate(0,${Number(t)+15})`))}const n=new window.MutationObserver(()=>{this.rootElement.selectAll(".nv-x").selectAll(".tick").selectAll(".full-date").remove(),this.rootElement.selectAll(".nv-x").selectAll(".tick").selectAll("text").data(function(e){return[t.timeFormat(Number(e),"%y-%m-%d"),t.timeFormat(Number(e),"%H:%M:%S")]}).enter().append("text").attr("class","full-date").attr("x",0).attr("y",0).attr("dy","2.3em").style("text-anchor","middle").style("font-size",o).text(t=>t)}),i=document.getElementsByClassName("extent");i.length&&n.observe(i[0],{attributes:!0})}else this.rootElement.selectAll(".full-date").remove()}renderOperationArea(t,e){const n=this.rootElement.append("g").attr("transform",`translate(0,${e+this.displayOption.operationAreaMarginTop})`).append("foreignObject").attr("width",t).attr("height",this.displayOption.operationAreaHeight).attr("fill","none").append("xhtml:div").style("height",this.displayOption.operationAreaHeight-4+"px").style("overflow","hidden").style("margin-top","4px");n.append("select").style("margin-left",this.displayOption.marginLeft+"px").style("font-size",this.displayOption.operationSelectFontSize).on("change",()=>{const t=this.rootElement.select("select").property("value");this.updateTimeRange(t),this.reRenderElement(this.startTime,this.endTime,this.displayOption.dataLimit,Jt.BeginOpenEndOpen)}).selectAll("option").data(this.timePeriods).enter().append("option").text(t=>t.name).attr("value",t=>t.key).property("selected",t=>t.key===Number(this.currentTimePeriod));const i=this.displayOption.operationButtonWidth+"px",r=this.displayOption.operationButtonHeight+"px";n.append("button").style("width",i).style("height",r).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/last_page.svg)").on("click",()=>{this.loadLastPage()}),n.append("button").style("width",i).style("height",r).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/next_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadNextPage()}),n.append("button").style("width",i).style("height",r).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/previous_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadPreviousPage()}),n.append("button").style("width",i).style("height",r).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/first_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadFirstPage()})}timeFormat(t,e){return Zt.time.format(e)(new Date(t))}loadFirstPage(){this.updateQueryTimeRange(),this.reRenderElement(this.startTime,this.endTime,this.displayOption.dataLimit,Jt.BeginOpenEndOpen)}loadNextPage(){this.reRenderElement(this.currentEndTime,this.endTime,this.displayOption.dataLimit,Jt.BeginOpenEndClose)}loadPreviousPage(){this.reRenderElement(this.startTime,this.currentStartTime,-this.displayOption.dataLimit,Jt.BeginCloseEndOpen)}loadLastPage(){this.updateQueryTimeRange(),this.reRenderElement(this.startTime,this.endTime,-this.displayOption.dataLimit,Jt.BeginOpenEndOpen)}initElementStatus(){this.model.dataSetting&&null!=this.model.dataSetting.dataSourceCode&&this.updateElementStatus(Xt.Loading)}updateElementStatus(t,e){switch(t){case Xt.Normal:this.elementStatus!==Xt.Normal&&(this.elementStatus=Xt.Normal);break;case Xt.Unbound:this.elementStatus=Xt.Unbound,this.setStatusAsUnbound();break;case Xt.Loading:this.elementStatus!==Xt.Unbound&&(this.elementStatus=Xt.Loading,this.setStatusAsLoading());break;case Xt.LoadFailed:this.elementStatus!==Xt.Unbound&&(this.elementStatus=Xt.LoadFailed,this.setStatusAsLoadFailed(e||this.localization.abnormal));break;default:this.logger.error(`Invalid HistoricalCurveElementStatus:${t}`)}}setStatusAsUnbound(){this.renderStatus("assets/img/unbind.svg",this.localization.unbind,"#586e7c")}setStatusAsLoading(){this.renderStatus("assets/img/loading.svg",this.localization.loading,"#226abc")}setStatusAsLoadFailed(t){this.logger.error(`[GUI]Failed to load historical curve:${t}`),this.renderStatus("assets/img/abnormal.svg",t,"#f6a520")}renderStatus(t,e,n){if(this.elementStatus===Xt.Normal)return void this.clearStatus();this.rootElement.append("rect").attr("id","StateFrame").attr("fill","transparent").attr("width",this.model.displaySetting.size.width).attr("height",this.model.displaySetting.size.height);const i=this.$element[0].ownerDocument,r=this.$element.find("rect#StateFrame").first();if(!r.length)return;this.$element.find("image#StateImage").remove();const a=i.createElementNS("http://www.w3.org/2000/svg","image");if(a){let o=Number(r[0].getAttribute("width"))-20;const s=r[0].getAttribute("x");null!==s&&(o+=Number(s)),r[0].setAttribute("stroke",n),r[0].setAttribute("stroke-opacity","0.5"),a.href.baseVal=t,a.setAttributeNS(null,"id","StateImage"),a.setAttributeNS(null,"x",o.toString()),a.setAttributeNS(null,"y","0"),a.setAttributeNS(null,"height","20px"),a.setAttributeNS(null,"width","20px");const l=i.createElementNS("http://www.w3.org/2000/svg","title"),u=i.createTextNode(e);l.appendChild(u),a.appendChild(l),this.$element.append(a)}}clearStatus(){const t=this.$element.find("rect#StateFrame").first();t.length&&(t[0].getAttribute("stroke")&&t[0].removeAttribute("stroke"),this.$element.find("image#StateImage").remove())}}class ie extends Lt{constructor(t,e,n,i,r,a){let o;if(super(t,e,n,i,r,a),this.cx=0,this.cy=0,this.offsetY=0,this.valueObj={},this.isNeedUpdateScale=!1,(this.model.minValueType===Yt.a.Constant&&this.model.maxValueType===Yt.a.Variable||this.model.maxValueType===Yt.a.Constant&&this.model.minValueType===Yt.a.Variable)&&(this.isNeedUpdateScale=!0,this.updateScale(),this.isNeedUpdateScale=!1),this.model.version&&this.model.version>3?(o=this.$element.find('[data-id="main"]'),this.$handEl=this.$element.find('[data-id="hand"]'),this.arcPath$=this.$element.find('[data-id="arc"]')):(o=this.$element.children().eq(0),this.$handEl=this.$element.find("path[fill='red']"),this.arcPath$=this.$element.find("g:first > g:first > path:eq(0)")),1!==this.$handEl.length)throw new Error("missing meter hand.");this.mainElementTransform=o.attr("transform");const s=Snap(this.$handEl[0]).getBBox(!0),l=(s.x+s.width)/2;this.cx=l,this.cy=l-s.x,this.offsetY=l-s.height/2,setTimeout(()=>{this.initFrameNode(),this.changeStates()})}updateValueObj(t,e){var n,i,r;(null===(n=this.model.readVariable)||void 0===n?void 0:n.name)===e&&(this.isNeedUpdateScale=!1,this.valueObj.value=t),(null===(i=this.model.minVariable)||void 0===i?void 0:i.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.min=t),(null===(r=this.model.maxVariable)||void 0===r?void 0:r.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.max=t)}updateVariableValue(t,e){this.updateValueObj(t,e),this.updateScale();const n=this.getAngle();Object(nt.isNumber)(n)&&this.$handEl.attr("transform",this.mainElementTransform+` translate(0,${this.offsetY}) rotate(${n}, ${this.cx}, ${this.cy})`)}initFrameNode(){const t=Snap(this.$element[0]).getBBox();this.rootElement.append("rect").attr("id","StateFrame").attr("width",t.width).attr("height",t.height).attr("fill","transparent")}updateScale(){if(!this.isNeedUpdateScale)return;let t=this.model.minValueType?this.valueObj.min:this.model.min,e=this.model.maxValueType?this.valueObj.max:this.model.max;t=Number(t),e=Number(e),(isNaN(t)||isNaN(e))&&(t=ie.DEFAULT_MIN_VALUE,e=ie.DEFAULT_MAX_VALUE);const n=((e-t)/this.model.masterDivisionNumber).toFixed(5),i=this.$element.find("g:first > text");for(let e=0;e<i.length;e++){const r=i[e];if(!r.innerHTML)continue;let a=(Number(n)*e+t).toFixed(0);this.model.fractionDigits>0&&(a=(a/Math.pow(10,this.model.fractionDigits)).toFixed(this.model.fractionDigits)),isNaN(a)||(r.innerHTML=a)}}getAngle(){let t=this.model.minValueType?this.valueObj.min:this.model.min,e=this.model.maxValueType?this.valueObj.max:this.model.max;if(t=Number(t),e=Number(e),(isNaN(t)||isNaN(e))&&(t=ie.DEFAULT_MIN_VALUE,e=ie.DEFAULT_MAX_VALUE),!this.valueObj.value&&isNaN(Number(this.valueObj.value)))return;const n=(Math.min(Math.max(this.valueObj.value||0,t),e)-t)/(e-t),i=Snap(this.arcPath$[0]),r=i.getBBox(!0),a=i.getPointAtLength(n*i.getTotalLength());return this.directionPoint({x:r.width/2,y:r.height/2},a)}directionPoint(t,e){const n=e.x-t.x,i=e.y-t.y;if(0===n)return 0<i?90:0>i?270:0;if(0===i)return 0<n?0:180;if(isNaN(n)||isNaN(i))return 0;let r=180*Math.atan(Math.abs(i/n))/Math.PI;return 0>n?r=0>i?r+180:180-r:0>i&&(r=360-r),r}}ie.DEFAULT_MIN_VALUE=0,ie.DEFAULT_MAX_VALUE=100;class re{constructor(t,e,n,i,r,a,o,s,l){this.variableName=t,this.dataType=e,this.fBoxDataType=n,this.integerDigits=i,this.fractionDigits=r,this.numericalOperation=a,this.version=o,this.enableDataParsed=s,this.releasedVariableService=l}}var ae,oe=n(36),se=n(6);!function(t){t[t.read=4]="read",t[t.witer=2]="witer",t[t.readWiter=6]="readWiter"}(ae||(ae={}));class le extends Lt{constructor(t,e,n,r,a,o,s,l,u,c,d,h){super(t,r,a,c,d,h),this.modalService=n,this.graphStore=o,this.operationRecordService=s,this.releasedVariableService=l,this.securityChecker=u,this.displayText="",this.enableDataParsed=!1,this.logger=e.get(i.b),this.dataTypeService=e.get(Vt.a),this.fractionDigitService=e.get(Pt.a),this.accessPermissionService=e.get(Nt.a),this.numericalOperationService=e.get(Ft.a),Object(nt.isNil)(this.model.displayDataType)||(this.model.displayDataType===ot.DisplayDataType.Binary&&(this.model.dataType=se.a.Binary),this.model.displayDataType===ot.DisplayDataType.Hex&&(this.model.dataType=se.a.Hex)),(this.model.version<6||this.model.enableDataParsed)&&(this.enableDataParsed=!0),this.initElement()}get writeVariableName(){return this.readVariableName}dispose(){this.displayForeignObject&&this.displayForeignObject.remove(),this.$element&&this.$element.remove()}initElement(){const{rootElement:t}=this;t.selectAll("*").remove();let e=null,n=null;this.model.size&&(e=this.model.size.width,n=this.model.size.height),e&&n||(e=60,n=38),t.append("rect").attr("id","StateFrame").attr("width",e).attr("height",n).attr("fill","transparent"),this.initVariableText(e,n),this.initGraphAndText(e,n),this.accessPermissionService.canWrite(this.model.accessPermission)&&null!=this.model.dataType&&(this.rootElement.style("cursor","hand"),this.$element.click(t=>{if(this.isInitialized)if(this.isEnable)if(this.model.useSecurity){const t=this.modalService.show(At.a,{backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.checkElementPassword()})}else this.checkElementPassword();else{const t=this.isGrantedPermission?this.localization.conditionIsNotMetTip:this.localization.permissiontip,e=this.modalService.show(Et.a,{initialState:{alermMessage:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),n=e.content.onClosed.subscribe(()=>{e.hide(),n.unsubscribe()})}}))}checkElementPassword(){if(this.model.enablePassword){const t=this.modalService.show(It.a,{initialState:{securityChecker:this.securityChecker},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.doWriteValue()})}else this.doWriteValue()}initVariableText(t,e){if(!this.model.showVariableText)return;const n={isUnderline:this.model.variableText.font.isUnderline,isBold:this.model.variableText.font.isBold,isItalic:this.model.variableText.font.isItalic,fontSize:this.model.variableText.font.fontSize,fontFamily:this.model.variableText.font.fontFamily,color:this.model.variableText.font.color,textAlign:this.model.variableText.font.textAlign},i=new Rt(this.model.variableText.content+":",n,7*t/11,e,!0);this.$element.append(i.Element)}initGraphAndText(t,e){let n="";if(this.model.showVariableText?(n=`translate(${7*t/11},0)`,t=4*t/11):n="translate(0,0)",!0===this.model.useGraph){const i=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger);i.Element.setAttribute("transform",n),this.$element.append(i.Element),i.switchToState(0)}let i=!1,r=!1,a=!1,o="Microsoft YaHei";if(this.model.font){const t=this.model.font.split(" ");i=this.model.isUnderline,r=$.inArray("bold",t)>=0,a=$.inArray("Italic",t)>=0,o=this.model.font.split(" ").pop()}const s={isUnderline:i,isBold:r,isItalic:a,fontSize:this.model.fontSize,fontFamily:o,color:this.model.stroke,textAlign:this.model.textAlign},l=new Rt("",s,t,e);l.Element.setAttribute("transform",n),this.$element.append(l.Element)}doWriteValue(){if(null==this.writeVariableName)return;const t=new re(this.writeVariableName,this.model.dataType,this.model.fBoxDataType,this.model.integerDigits,this.model.fractionDigits,this.numericalOperationService.getNumericalOperations(this.model),this.model.version,this.enableDataParsed,this.releasedVariableService);this.writeValueMmodalRef=this.modalService.show(oe.a,{initialState:{args:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),this.writeValueMmodalRef.content.onClosed=(t=>{if(t){this.restorationTimer&&(clearTimeout(this.restorationTimer),this.restorationTimer=void 0),this.recordValue=t.value;const e=this.dataTypeService.formatToDecimal(this.model.version,t.value,this.model.dataType);this.showValue=t.showValue,this.displayText!==this.showValue||t.variableRwType===ae.witer?(this.numericalOperation||t.enableNumericalOperation||t.isNumericalOperation||t.variableRwType===ae.witer?(this.recordOperation(t.value),this.writeValueMmodalRef.hide()):this.restorationTimer=setTimeout(()=>{(this.model.fractionDigits?parseFloat(this.displayText)===parseFloat(this.showValue):parseInt(this.displayText,16)===parseInt(this.showValue,16))||(this.writeValueMmodalRef.content.isSubmitting=!1,this.writeValueMmodalRef.content.showValidationErrorInfo(this.localization.writeValueTimeout))},1e4),this.variableCommunicator.write(this.writeVariableName,e).subscribe()):this.writeValueMmodalRef.hide()}})}recordOperation(t){(this.model.isRecordOperation||void 0===this.model.isRecordOperation)&&this.operationRecordService.record({variableOptionModel:{variableName:this.writeVariableName,originValue:this.formatDisplayTextUnit(this.displayText),newValue:this.formatDisplayTextUnit(this.formatNumericalDisplayText(this.model.dataType,this.model.fractionDigits,t))},operationDescription:this.model.operationDescription})}changeStates(){super.changeStates(),this.state===ot.State.Normal||this.state===ot.State.Disable?this.updateDisplayText(this.formatDisplayTextUnit(this.displayText)):this.preState!==this.state&&this.updateDisplayText("")}updateVariableValue(t){var e;const n=this.formatNumericalDisplayText(this.model.dataType,this.model.fractionDigits,t),i=this.model.fractionDigits?parseFloat(n)===parseFloat(this.showValue):parseInt(n,16)===parseInt(this.showValue,16);(null===(e=this.writeValueMmodalRef)||void 0===e?void 0:e.content)&&i&&(this.restorationTimer&&(clearTimeout(this.restorationTimer),this.restorationTimer=void 0,this.recordOperation(this.recordValue)),this.writeValueMmodalRef.hide(),this.writeValueMmodalRef.content.hideValidationErrorInfo()),this.displayText=n,this.updateDisplayText(this.formatDisplayTextUnit(this.displayText))}updateDisplayText(t){if(this.displayForeignObject||(this.model.showVariableText?this.displayForeignObject=this.$element.find("foreignObject").eq(1):this.displayForeignObject=this.$element.find("foreignObject").eq(0)),Object(nt.isNil)(t))this.displayForeignObject.remove();else{const e=this.displayForeignObject.find(".text-list"),n=t.toString().split("\n");if(e.length===n.length)for(let t=0;t<e.length;t++)e[t].innerText=n[t];else{this.displayForeignObject.remove();const e=this.displayForeignObject.attr("width"),n=this.displayForeignObject.attr("height"),i=this.displayForeignObject.attr("transform");this.displayForeignObject=$(this.rebuildTextElement(e,n,i,t))}}}rebuildTextElement(t,e,n,i){let r=!1,a=!1,o=!1,s="Microsoft YaHei";if(this.model.font){const t=this.model.font.split(" ");r=this.model.isUnderline,a=$.inArray("bold",t)>=0,o=$.inArray("Italic",t)>=0,s=this.model.font.split(" ").pop()}const l={isUnderline:r,isBold:a,isItalic:o,fontSize:this.model.fontSize,fontFamily:s,color:this.model.stroke,textAlign:this.model.textAlign},u=new Rt(i,l,Number(t),Number(e));return u.Element.setAttribute("transform",n),this.$element.append(u.Element),u.Element}formatNumericalDisplayText(t,e,n){if(null==n||n.toString().trim().length<=0)return"";if(n=+n,this.dataTypeService.isHexType(this.model.version,t))return(n>>>0).toString(16).toUpperCase();if(this.dataTypeService.isBinaryType(this.model.version,t)){const t=(n>>>0).toString(2);if(t.length<17)return t;const e="1111111111111111";if(0===t.indexOf(e))return t.replace(e,"");const i="0000000000000000";return 0===t.indexOf(i)?t.replace(i,""):t}if(!this.isNumeric(n)||null==e||e<0)return n;if(!this.enableDataParsed)return n;if(!this.dataTypeService.isSupportFractionDigit(this.model.version,t))return n;if(this.dataTypeService.isSupportNumericalOperation(this.model.version,t)&&this.model.enableNumericalOperation&&this.isNumeric(n))return this.numericalOperationService.getNumericalOperationedValue(this.model,n,e);if(this.dataTypeService.isFloat(this.model.version,t))return this.formatFloatDisplayText(e,n);if(0===e)return n;let i=Number(n).toFixed(0).toString();const r=+i<0;if(r&&(i=i.slice(1,i.length)),i.length>e){const t=i.length-e;i=i.substr(0,t)+"."+i.substr(t)}else{const t=e-i.length;for(let e=0;e<t;e++)i=`0${i}`;i=`0.${i}`}return r?`-${i}`:i}formatFloatDisplayText(t,e){let n=Number(e);return Object(nt.isNil)(t)?n.toFixed(0):(n=+n.toFixed(t+2),this.fractionDigitService.roundingToFixedFractionDigits(n,t))}isNumeric(t){return!isNaN(t)}formatDisplayTextUnit(t){return!1!==this.model.showUnit&&this.model.unit?`${t||0} ${this.model.unit}`:t}}var ue=n(33),ce=n(22);class de extends wt{constructor(t,e,n,i,r,a){super(t,e,n,i,r,a),this.variableCommunicator=n,this.variableStore=i,this.recoverData(),setTimeout(()=>{this.initConditionalControl()})}initConditionalControl(){if(!1===this.model.isControl)return;if(null==this.model.controlItems||!this.model.controlItems.length)return;const t=new ot.ConditionItemsResultObserver(this.model.controlItems,this.variableCommunicator,this.variableStore);t.conditionResultChanged.subscribe(t=>{this.updateElement(t)}),t.requestData(this.signalRAppId)}recoverData(){if(!this.model)throw new Error("Model cannot be null");if(null==this.model.version||this.model.version<1){if(this.model.variableName){this.model.controlItems=new Array;const t={variableName:this.model.variableName,bitConditionLogic:ot.BitConditonLogic.On},e={index:0,conditionType:ue.a.Bit,condition:t,relationType:ce.a.None};this.model.controlItems.push(e);const n=new ft.a(e.condition.variableName,e.condition.variableGroupName,e.condition.dataSourceCode,e.condition.variableVersion);this.addElementState(new rt.c(ht.a.getConvertedVariableName(this.variableStore,n),void 0)),this.initState()}}else if(this.model.version<2){if(this.model.readVariable&&this.model.readVariable.name&&this.model.readVariable.groupName){this.model.controlItems=new Array;const t={variableName:this.model.readVariable.name,variableGroupName:this.model.readVariable.groupName,bitConditionLogic:ot.BitConditonLogic.On},e={index:0,conditionType:ue.a.Bit,condition:t,relationType:ce.a.None};this.model.controlItems.push(e);const n=new ft.a(e.condition.variableName,e.condition.variableGroupName,e.condition.dataSourceCode,e.condition.variableVersion);this.addElementState(new rt.c(ht.a.getConvertedVariableName(this.variableStore,n),void 0)),this.initState()}}else Object(nt.forEach)(this.model.controlItems,t=>{if(t.condition.variableName){const e=new ft.a(t.condition.variableName,t.condition.variableGroupName,t.condition.dataSourceCode,t.condition.variableVersion);this.addElementState(new rt.c(ht.a.getConvertedVariableName(this.variableStore,e),void 0)),this.initState()}})}}class he extends de{constructor(t,e,n,i,r,a){super(t,e,n,i,r,a),this.initDefaultData(this.model);const o=this.$element.children();if(o&&o.length){if(this.model.isPipeWall){const t=o.eq(0);t&&(t.attr("stroke",this.model.pipeWallColor),t.attr("stroke-width",this.model.pipeDiameter))}if(this.elePipeInnerwall=o.eq(this.model.isPipeWall?1:0),this.elePipeInnerwall.attr("stroke",this.model.backGroundColor),this.model.pipeDiameter-2*this.model.pipeWallSize<=0?this.elePipeInnerwall.attr("stroke-width",1):this.elePipeInnerwall.attr("stroke-width",this.model.pipeDiameter-2*this.model.pipeWallSize),this.elePipeInnerwall.attr("stroke-opacity",1),this.model.isFlowBlock){const t=this.model.blockLength+","+this.model.blockMargin;this.elePipeFlowBlock=o.eq(this.model.isPipeWall?2:1),this.elePipeFlowBlock.attr("d",o.first().attr("d")),this.elePipeFlowBlock.attr("stroke",this.model.blockColor),this.elePipeFlowBlock.attr("stroke-width",this.model.blockWidth),this.elePipeFlowBlock.attr("stroke-dasharray",t),this.elePipeFlowBlock.attr("stroke-opacity",1),this.elePipeFlowBlock.css("display","block")}this.pathLength=this.model.blockLength+this.model.blockMargin,this.model.isFlowBlock&&!this.model.isFlow&&this.elePipeFlowBlock.append(this.getAnimate()),setTimeout(()=>{this.initFrameNode()},0)}}initDefaultData(t){void 0===t.isPipeWall&&(t.isPipeWall=!0),void 0===t.isFlowBlock&&(t.isFlowBlock=!0),void 0===t.pipeWallColor&&(this.model.pipeWallColor="#333"),void 0===t.pipeDiameter&&(t.pipeDiameter=14),void 0===t.backGroundColor&&(t.backGroundColor="#ffffff"),void 0===t.pipeWallSize&&(t.pipeWallSize=1),void 0===t.blockLength&&(t.blockLength=12),void 0===t.blockMargin&&(t.blockMargin=6),void 0===t.blockColor&&(t.blockColor="#0081ff"),void 0===t.blockWidth&&(t.blockWidth=6)}updateElement(t){this.updateElementStates(t.states),this.model.isFlow&&this.startOrStopPipeFlow(t.value)}initFrameNode(){const t=Snap(this.$element.find("path:last")[0]).getBBox(!0);let e=this.model.pipeDiameter,n=t.width+1,i=(e=(e=e<t.height?t.height:e)<20?20:e)/2;t.height>0?(i=6,e+=15,n+=2):(i-=1,20===e&&(i-=3)),this.rootElement.append("rect").attr("id","StateFrame").attr("width",n).attr("height",e).attr("x",i).attr("fill","none")}startOrStopPipeFlow(t){this.elePipeFlowBlock&&(this.elePipeFlowBlock.children().remove(),t&&this.elePipeFlowBlock.append(this.getAnimate()))}getAnimate(){switch(this.model.flowDirection){case ot.FlowDirectionType.Positive:return this.getAnimateElement(this.pathLength,0);case ot.FlowDirectionType.Negative:return this.getAnimateElement(0,this.pathLength);default:throw new Error("Unknown flowDirection:"+this.model.flowDirection)}}getAnimateElement(t,e){const n=this.$element[0].ownerDocument.createElementNS("http://www.w3.org/2000/svg","animate");return n.setAttribute("attributeType","XML"),n.setAttribute("attributeName","stroke-dashoffset"),n.setAttribute("from",t.toString()),n.setAttribute("to",e.toString()),n.setAttribute("by","3"),n.setAttribute("dur","1s"),n.setAttribute("repeatCount","indefinite"),n}}var fe=Math.PI,me=2*fe,pe=me-1e-6;function ge(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function ve(){return new ge}ge.prototype=ve.prototype={constructor:ge,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,a){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+a)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var a=this._x1,o=this._y1,s=n-t,l=i-e,u=a-t,c=o-e,d=u*u+c*c;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(d>1e-6)if(Math.abs(c*s-l*u)>1e-6&&r){var h=n-a,f=i-o,m=s*s+l*l,p=h*h+f*f,g=Math.sqrt(m),v=Math.sqrt(d),_=r*Math.tan((fe-Math.acos((m+d-p)/(2*g*v)))/2),y=_/v,b=_/g;Math.abs(y-1)>1e-6&&(this._+="L"+(t+y*u)+","+(e+y*c)),this._+="A"+r+","+r+",0,0,"+ +(c*h>u*f)+","+(this._x1=t+b*s)+","+(this._y1=e+b*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,a){t=+t,e=+e;var o=(n=+n)*Math.cos(i),s=n*Math.sin(i),l=t+o,u=e+s,c=1^a,d=a?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+l+","+u:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-u)>1e-6)&&(this._+="L"+l+","+u),n&&(d<0&&(d=d%me+me),d>pe?this._+="A"+n+","+n+",0,1,"+c+","+(t-o)+","+(e-s)+"A"+n+","+n+",0,1,"+c+","+(this._x1=l)+","+(this._y1=u):d>1e-6&&(this._+="A"+n+","+n+",0,"+ +(d>=fe)+","+c+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var _e,ye=ve;class be extends Lt{constructor(t,e,n,i,r,a){super(t,e,n,i,r,a),this.valueObj={},this.isNeedUpdateScale=!1,(this.model.minValueType===Yt.a.Constant&&this.model.maxValueType===Yt.a.Variable||this.model.maxValueType===Yt.a.Constant&&this.model.minValueType===Yt.a.Variable)&&(this.isNeedUpdateScale=!0,this.updateScale(),this.isNeedUpdateScale=!1);const o=$(t);this._barElement$=o.find('path[data-id="barArc"]'),this._textElement$=o.find('text[data-id="pText"]'),setTimeout(()=>{this.initFrameNode(),this.changeStates()})}get readVariableName(){if(!this.model.variableId)return"";if(!this.model.variableId.variableName||!this.model.variableId.variableName.name)return;const t=new ft.a(this.model.variableId.variableName.name,this.model.variableId.variableName.groupName,this.model.variableId.dataSourceCode,this.model.variableId.variableName.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}get minVariableName(){if(!this.model.minValueType)return;if(!this.model.minVariable||!this.model.minVariable.name)return;const t=new ft.a(this.model.minVariable.name,this.model.minVariable.groupName,this.model.minVariable.dataSourceCode,this.model.minVariable.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}get maxVariableName(){if(!this.model.maxValueType)return;if(!this.model.maxVariable||!this.model.maxVariable.name)return;const t=new ft.a(this.model.maxVariable.name,this.model.maxVariable.groupName,this.model.maxVariable.dataSourceCode,this.model.maxVariable.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}initFrameNode(){const t=Snap(this.$element[0]).getBBox(!0);this.rootElement.append("rect").attr("id","StateFrame").attr("width",t.width).attr("height",t.height).attr("fill","transparent")}init(t){if(t){let e=!1;Object(nt.forEach)(this.elementStates,n=>{n.variableName===t&&(e=!0)}),e||t!==this.readVariableName||this.elementStates.push(new rt.c(t,void 0))}}updateValueObj(t,e){var n,i,r;(null===(n=this.model.variableId)||void 0===n?void 0:n.variableName.name)===e&&(this.isNeedUpdateScale=!1,this.valueObj.value=t),(null===(i=this.model.minVariable)||void 0===i?void 0:i.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.min=t),(null===(r=this.model.maxVariable)||void 0===r?void 0:r.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.max=t)}updateScale(){if(!this.isNeedUpdateScale)return;const t=this.$element.find("g:first > text");let e=this.model.minValueType?this.valueObj.min:this.model.min,n=this.model.maxValueType?this.valueObj.max:this.model.max;e=Number(e),n=Number(n),(isNaN(e)||isNaN(n))&&(e=be.DEFAULT_MIN_VALUE,n=be.DEFAULT_MAX_VALUE);const i=((n-e)/this.model.masterDivisionNumber).toFixed(5);for(let n=0;n<t.length;n++){const r=t[n];if(!r.innerHTML)continue;let a=(Number(i)*n+e).toFixed(0);this.model.fractionDigits>0&&(a=(a/Math.pow(10,this.model.fractionDigits)).toFixed(this.model.fractionDigits)),isNaN(a)||(r.innerHTML=a)}}updateVariableValue(t,e){this.updateValueObj(t,e),this.updateScale();let n=this.model.minValueType?this.valueObj.min:this.model.min,i=this.model.maxValueType?this.valueObj.max:this.model.max;n=Number(n),i=Number(i),(isNaN(n)||isNaN(i))&&(n=be.DEFAULT_MIN_VALUE,i=be.DEFAULT_MAX_VALUE);const r=St(n,i,this.valueObj.value||0);this.updateBar(r),this._barElement$.attr("fill",this.getBarColor(t)),this.model.showPercentage&&this._textElement$.text((100*r).toFixed(0)+"%")}updateBar(t){const e=this.model,n=e.size.width/2,i=e.arc.startAngle,r=e.arc.endAngle,a=i===r?360:i<r?r-i:r+360-i,o=n*(e.scale/100),s=ye();switch(Number(e.direction)){case ut.ClockWise:this.drawClockWiseArc(i,a,t,s,n,o);break;case ut.ReverseClockWise:this.drawAntiClockWiseArc(r,a,t,s,n,o)}s.closePath(),this._barElement$.attr("d",s.toString())}getBarColor(t){const e=this.model;if(!e.enableAlarmRange)return e.barFill;const n=e.alarmRange;return t>n.upper?n.upperFill:t<n.lower?n.lowerFill:e.barFill}drawClockWiseArc(t,e,n,i,r,a){const o=Tt(t),s=Tt(e*n+t);i.arc(r,r,r,o,s),i.arc(r,r,a,s,o,!0)}drawAntiClockWiseArc(t,e,n,i,r,a){const o=Tt(t),s=Tt(t-e*n);i.arc(r,r,r,o,s,!0),i.arc(r,r,a,s,o)}}be.DEFAULT_MIN_VALUE=0,be.DEFAULT_MAX_VALUE=100,function(t){t[t.Image=0]="Image",t[t.Graph=1]="Graph"}(_e||(_e={}));class Me extends xt{constructor(t,e,n,r,a,o,s,l){if(super(t,r,a,o,l),this.graphStore=s,this.logger=e.get(i.b),!this.model.version||this.model.version<4||this.model.fillType!==_e.Graph){let t="";this.model.imageId&&(t=n.getImageUrl(this.model.imageId));const e=this.rootElement.select("image");if(e.empty()){const e=this.model.size;e&&this.rootElement.append("image").attr("width",e.width).attr("height",e.height).attr("xlink:href",t).attr("preserveAspectRatio","none").attr("crossorigin","anonymous")}else e.attr("xlink:href",t).attr("crossorigin","anonymous")}else this.initGraph(this.model.size.width,this.model.size.height)}initGraph(t,e){const n=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger);n.switchToState(0),this.$element.prepend(n.Element)}}class xe extends xt{constructor(t,e,n,r,a,o,s){if(super(t,n,r,a,s),this.graphStore=o,this.logger=e.get(i.b),this.model.text&&this.model.size){const t=this.model.size.width,e=this.model.size.height;if(this.rootElement.selectAll("*").remove(),this.rootElement.append("rect").attr("width",t).attr("height",e).attr("fill","transparent"),!0===this.model.useGraph){const n=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger);n.switchToState(0),this.$element.prepend(n.Element)}const n={isUnderline:this.model.isUnderline,isBold:this.isBold(this.model.font),isItalic:this.isItalic(this.model.font),fontSize:this.model.fontSize,fontFamily:this.fontFamily(this.model.font),color:this.model.stroke,textAlign:this.model.textAlign},i=new Rt(this.model.text,n,t,e);this.$element.append(i.Element)}else this.handleTextValue(),this.model.size&&this.model.useGraph&&this.initGraph(this.model.size.width,this.model.size.height)}dispose(){this.$element&&this.$element.remove()}handleTextValue(){const t=this.$element.find("text");for(let e=0;e<t.length;e++)t[e].style.whiteSpace="pre"}initGraph(t,e){const n=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger);n.switchToState(0),this.$element.prepend(n.Element)}}class we{constructor(t,e,n,i,r,a){this.textStates=t,this.width=e,this.height=n,this.logger=i,this.version=r,this.faultFlickers=a,this.faultFlickerStatus=!1,this.faultFlickerInterval=void 0,this._element=document.createElementNS("http://www.w3.org/2000/svg","g")}get Element(){return this._element}switchToState(t){const e=this.textStates.find(e=>e.id===t);if(void 0===e)return this.removeForeignObjectlement(),void this.logger.debug(`Can not find text state:${t}.`);const n=e.text.content;if(""===n)return void this.removeForeignObjectlement();const i=e.text.font;if(!i)return this.removeForeignObjectlement(),void this.logger.debug("The font is undefined.");const r=this.getforeignObjectElement();r.innerHTML="";const a=this.createNewForeignObjectText(n,i);r.appendChild(a),this.doFaultFlicker(r,t)}getforeignObjectElement(){return this.textElement||(this.textElement=document.createElementNS("http://www.w3.org/2000/svg","foreignObject"),this.textElement.setAttribute("width",this.width.toString()),this.textElement.setAttribute("height",this.height.toString()),this._element.appendChild(this.textElement)),this.textElement}createNewForeignObjectText(t,e){e&&!e.fontFamily.includes(",msyh")&&(e.fontFamily+=",msyh");const n=document.createElement("div");n.style.textAlign=e.textAlign?e.textAlign:"center",n.style.userSelect="none",n.style.display="table-cell",n.style.verticalAlign="middle",Object(nt.isNil)(t)&&(t="");let i=t.toString().split("\n");i=i.map(t=>t.toString().replace(/\s/g," "));const r=document.createDocumentFragment();for(let t=0;t<i.length;t++){const n=document.createElement("div");n.innerHTML=i[t]?i[t]:" ";let a="";e.isItalic&&(a+="italic "),e.isBold&&(a+="bold "),n.style.wordBreak="break-word",n.style.color=e.color;let o=0;o=parseInt(e.fontSize,10)+5,a+=e.fontSize+"px/"+o+"px "+e.fontFamily,n.style.font=a,e.isUnderline&&(n.style.textDecoration="underline"),r.appendChild(n)}n.appendChild(r);const a=document.createElement("div");a.style.display="table",a.style.width="100%",a.style.height="100%",a.appendChild(n);const o=document.createElement("div");return o.style.overflow="hidden",o.style.width=this.width.toString()+"px",o.style.height=this.height.toString()+"px",o.appendChild(a),o}removeForeignObjectlement(){this.textElement&&(this._element.removeChild(this.textElement),delete this.textElement)}doFaultFlicker(t,e){if(this.version>3&&this.faultFlickers){this.clearFlickerInterval(t);const n=this.faultFlickers.find(t=>t.id===e);n&&n.faultFlicker&&n.faultFlicker.flicker===ot.Flicker.Label&&(this.faultFlickerInterval=setInterval(()=>{this.faultFlickerStatus?(t.setAttributeNS(null,"display","block"),this.faultFlickerStatus=!1):(t.setAttributeNS(null,"display","none"),this.faultFlickerStatus=!0)},500*n.faultFlicker.frequency))}}clearFlickerInterval(t){this.faultFlickerInterval&&(clearInterval(this.faultFlickerInterval),this.faultFlickerStatus&&t.setAttributeNS(null,"display","block"))}}class ke{constructor(t,e){this.state=t,this.value=e,this.state=t,this.value=e}}var Le=n(32);class Se{constructor(t,e,n,i){if(this.settings=t,this.variableCommunicator=n,this.variableStore=i,this.currentStateIdChanged=new ct.EventEmitter,!this.settings)throw new Error("settings cannot be null");Object(nt.each)(e,t=>{const e=t.condition;if(!e)throw new Error("Invalid bit condition.");switch(+e.logic){case ot.BitConditonLogic.Off:if(this.offStateId)throw new Error("Dumplicate off state.");this.offStateId=t.id;break;case ot.BitConditonLogic.On:if(this.onStateId)throw new Error("Dumplicate on state.");this.onStateId=t.id;break;default:throw new Error(`Unknown BitConditonLogic:${e.logic}`)}})}get variableName(){const t=new ft.a(this.settings.variableName,this.settings.variableGroupName,this.settings.dataSourceCode,this.settings.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}requestData(t){this.variableName&&this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===rt.d.Normal?this.requestCurrentSateIdValue(this.variableCommunicator,t):this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,e.state)))})}requestCurrentSateIdValue(t,e=""){t.openVariable(this.variableName,e).subscribe(t=>{if(t.state===rt.d.DataNormal)if(this.settings.isBitwiseIndex){const e=31;this.binary=new Le.a(t.value,e+1);const n=new rt.e(t.variableName,t.state,Number(this.binary.convertToBinary().substr(e-this.settings.bitIndex,1)));this.currentStateId=n.value?this.onStateId:this.offStateId,this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state),this.currentStateId))}else this.currentStateId=t.value?this.onStateId:this.offStateId,this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state),this.currentStateId));else delete this.currentStateId,this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state)))})}}class Te{constructor(t,e,n,i){if(this.settings=t,this.variableCommunicator=e,this.variableStore=n,this.signalRAppId=i,!this.settings)throw new Error("settings cannot be null");this.settings.isWriteOnly?this.canExecuteInternal=!0:e.openVariable(this.variableName,this.signalRAppId).subscribe(t=>{this.currentValue=t,this.canExecuteInternal=this.currentValue&&this.currentValue.state===rt.d.DataNormal})}get variableName(){const t=new ft.a(this.settings.variableName,this.settings.variableGroupName,this.settings.dataSourceCode,this.settings.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}canExecute(){return this.canExecuteInternal}execute(){if(!this.canExecute())throw new Error("Can not execute.");const t=this.settings;let e,n,i;switch(t.isBitwiseIndex&&(n=31,this.binary=new Le.a(this.currentValue.value,n+1)),+t.operation){case ot.BitSwitchOperation.On:e=1,t.isBitwiseIndex?this.variableCommunicator.writeWordByBit(this.variableName,t.bitIndex,e).subscribe():this.variableCommunicator.write(this.variableName,e).subscribe();break;case ot.BitSwitchOperation.Off:e=0,t.isBitwiseIndex?this.variableCommunicator.writeWordByBit(this.variableName,t.bitIndex,e).subscribe():this.variableCommunicator.write(this.variableName,e).subscribe();break;case ot.BitSwitchOperation.Inverse:if(!this.settings.isWriteOnly)if(e=0===this.currentValue.value?1:0,t.isBitwiseIndex){let e=Number(this.binary.convertToBinary().substr(n-this.settings.bitIndex,1));e=0===e?1:0,this.variableCommunicator.writeWordByBit(this.variableName,t.bitIndex,e).subscribe()}else this.variableCommunicator.write(this.variableName,e).subscribe();break;case ot.BitSwitchOperation.Restoration:break;default:throw new Error(`Unknown BitSwitchOperation:${t.operation}`)}return this.currentValue&&void 0!==this.currentValue.value&&(i=this.currentValue.value),Promise.resolve({variableName:this.variableName,originValue:i,newValue:e})}writeValue(t){let e;return this.settings.isBitwiseIndex?this.variableCommunicator.writeWordByBit(this.variableName,this.settings.bitIndex,t).subscribe():this.variableCommunicator.write(this.variableName,t).subscribe(),this.currentValue&&void 0!==this.currentValue.value&&(e=this.currentValue.value),Promise.resolve({variableName:this.variableName,originValue:e,newValue:t})}}class Ye{constructor(t,e,n,i){if(this.settings=t,this.variableCommunicator=n,this.variableStore=i,this.currentStateIdChanged=new ct.EventEmitter,!this.settings)throw new Error("settings cannot be null");this.sortedStates=Object(nt.sortBy)(e,["id"])}get variableName(){const t=new ft.a(this.settings.variableName,this.settings.variableGroupName,this.settings.dataSourceCode,this.settings.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}requestData(t){this.variableName?this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===rt.d.Normal?this.requestCurrentSateIdValue(this.variableCommunicator,t):this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,e.state)))}):this.requestCurrentSateIdValue(this.variableCommunicator,t)}requestCurrentSateIdValue(t,e=""){t.openVariable(this.variableName,e).subscribe(t=>{if(t.state===rt.d.DataNormal){let e=0;for(let n=0;n<this.sortedStates.length-1;n++){const i=this.sortedStates[n],r=i.condition;if(!r)throw new Error(`condition is not WordCondition.stateId:${i.id}`);if(e=i.id,ot.ConditionHelper.isSatisfied(r.operator,r.operand,+t.value))return this.currentStateId=e,void this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state),this.currentStateId))}this.currentStateId=Object(nt.last)(this.sortedStates).id,this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state),this.currentStateId))}else delete this.currentStateId,this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state)))})}}class De{constructor(t,e,n,i){if(this.settings=t,this.variableCommunicator=e,this.variableStore=n,this.signalRAppId=i,!this.settings)throw new Error("settings cannot be null");this.settings.isWriteOnly?this.canExecuteInternal=!0:e.openVariable(this.variableName,this.signalRAppId).subscribe(t=>{this.currentValue=t,this.canExecuteInternal=this.currentValue&&this.currentValue.state===rt.d.DataNormal})}get variableName(){const t=new ft.a(this.settings.variableName,this.settings.variableGroupName,this.settings.dataSourceCode,this.settings.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}canExecute(){return this.canExecuteInternal}execute(){if(!this.canExecute())throw new Error("Can not execute.");const t=this.settings;let e,n;switch(+t.operation){case ot.WordSwitchOperation.Add:this.settings.isWriteOnly||(e=lt.e.add(+this.currentValue.value,t.operand,t.dataType,t.maxValue),this.variableCommunicator.write(this.variableName,e).subscribe());break;case ot.WordSwitchOperation.Subtract:this.settings.isWriteOnly||(e=lt.e.subtract(+this.currentValue.value,t.operand,t.dataType,t.minValue),this.variableCommunicator.write(this.variableName,e).subscribe());break;case ot.WordSwitchOperation.SetConstant:e=t.operand,this.variableCommunicator.write(this.variableName,e).subscribe();break;default:throw new Error(`Unknown WordSwitchOperator:${t.operation}`)}return this.currentValue&&void 0!==this.currentValue.value&&(n=this.currentValue.value),Promise.resolve({variableName:this.variableName,originValue:n,newValue:e})}writeValue(t){return Promise.resolve({newValue:t})}}class Ce extends kt{constructor(t,e,n,r,a,o,s,l,u,c,d){if(super(t,o,r,u,c,d),this.modalService=n,this.graphStore=a,this.operationRecordService=s,this.securityChecker=l,this.isBitRestoration=!1,this.isVerifiedForRestoration=!1,this.isWriteRestorationDownValue=!1,this.logger=e.get(i.b),this.isMobileMode=ee.a.Mobile===e.get(ee.b).displayMode,this.checkState(),this.model.useSwitch){this.initSwitchOperator(),this.rootElement.style("cursor","hand");const t=navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);this.rootElement.on(this.isMobileMode&&t?"touchstart":"mousedown",()=>{if(this.isInitialized)if(this.isEnable){if(this.switchOperator.canExecute()){if(this.isBitRestoration&&this.isVerifiedForRestoration)document.addEventListener(this.isMobileMode?"touchend":"mouseup",this.onDocMouseUp),this.restorationTimer=setTimeout(()=>{this.writeValue(1),this.isWriteRestorationDownValue=!0},1e3);else if(this.model.useSecurity){const t=this.modalService.show(At.a,{backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.checkElementPassword(!0)})}else this.checkElementPassword(!1),this.model.useIndicatorLight||this.isMobileMode||this.switchToState(1);H.preventDefault()}}else{const t=this.isGrantedPermission?this.localization.conditionIsNotMetTip:this.localization.permissiontip,e=this.modalService.show(Et.a,{initialState:{alermMessage:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),n=e.content.onClosed.subscribe(()=>{e.hide(),n.unsubscribe()})}}),this.rootElement.on(this.isMobileMode&&t?"touchend":"mouseup",()=>{this.handleMouseUp(),H.stopPropagation()}),this.initOnDocMouseUpEvent()}this.initGraphAndText(),this.model.useIndicatorLight?this.initIndictorLightOperator():this.switchToState(0)}handleMouseUp(){this.restorationTimer&&(clearTimeout(this.restorationTimer),this.restorationTimer=void 0),this.isBitRestoration&&this.isWriteRestorationDownValue&&this.writeValue(0),document.removeEventListener(this.isMobileMode?"touchend":"mouseup",this.onDocMouseUp),this.isVerifiedForRestoration=!1,this.isWriteRestorationDownValue=!1,this.model.useIndicatorLight||this.isMobileMode||(this.switchToState(0),H&&H.preventDefault())}initOnDocMouseUpEvent(){this.onDocMouseUp=(()=>{this.handleMouseUp()})}checkElementPassword(t){if(this.model.enablePassword){const t=this.modalService.show(It.a,{initialState:{securityChecker:this.securityChecker},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&(this.isBitRestoration?this.isVerifiedForRestoration=!0:this.doSwitchOperator())})}else this.isBitRestoration?t?this.isVerifiedForRestoration=!0:(this.isVerifiedForRestoration=!0,document.addEventListener(this.isMobileMode?"touchend":"mouseup",this.onDocMouseUp),this.restorationTimer=setTimeout(()=>{this.writeValue(1),this.isWriteRestorationDownValue=!0},1e3)):this.doSwitchOperator()}doSwitchOperator(){this.switchOperator.execute().then(t=>{(this.model.isRecordOperation||void 0===this.model.isRecordOperation)&&(void 0===t.newValue&&void 0===t.originValue||this.operationRecordService.record({variableOptionModel:t,operationDescription:this.model.operationDescription}))}).catch(()=>{throw new Error("Failure of the operation record:switchOperator")})}writeValue(t){this.switchOperator.writeValue(t).then(t=>{(this.model.isRecordOperation||void 0===this.model.isRecordOperation)&&(void 0===t.newValue&&void 0===t.originValue||this.operationRecordService.record({variableOptionModel:t,operationDescription:this.model.operationDescription}))}).catch(()=>{throw new Error("Failure of the operation record:switchOperator")})}initSwitchOperator(){const t=this.model.switchSettings;switch(t.type){case ot.SwitchType.Bit:this.switchOperator=new Te(t.settings,this.variableCommunicator,this.variableStore,this.signalRAppId),this.isBitRestoration=t.settings.operation===ot.BitSwitchOperation.Restoration;break;case ot.SwitchType.Word:this.switchOperator=new De(t.settings,this.variableCommunicator,this.variableStore,this.signalRAppId);break;default:throw new Error(`Unknown switchType:${t.type}`)}}initIndictorLightOperator(){const t=this.model.indicatorLightSettings;if(t.settings.variableName){const e=new ft.a(t.settings.variableName,t.settings.variableGroupName,t.settings.dataSourceCode,t.settings.variableVersion);this.addElementState(new rt.c(ht.a.getConvertedVariableName(this.variableStore,e),void 0)),this.initState()}switch(t.type){case ot.IndicatorLightType.Bit:this.indicatorLightOperator=new Se(t.settings,this.model.states,this.variableCommunicator,this.variableStore);break;case ot.IndicatorLightType.Word:this.indicatorLightOperator=new Ye(t.settings,this.model.states,this.variableCommunicator,this.variableStore);break;default:throw new Error(`Unknown switchType:${t.type}`)}this.indicatorLightOperator.currentStateIdChanged.subscribe(t=>{this.currentStateIdChange(t)}),this.indicatorLightOperator.requestData(this.signalRAppId)}currentStateIdChange(t){Object(nt.isUndefined)(t.value)||this.switchToState(t.value),this.updateElementStates([t.state]),this.state!==ot.State.Unbind&&this.state!==ot.State.Offline||this.switchToState(0)}switchToState(t){this.textStateElement.switchToState(t),this.graphStateElement&&this.graphStateElement.switchToState(t)}initGraphAndText(){this.rootElement.selectAll("*").remove();const t=this.model.size,e=t.width,n=t.height;this.rootElement.append("rect").attr("id","StateFrame").attr("width",e).attr("height",n).attr("fill","transparent"),!0===this.model.useGraph&&(this.graphStateElement=new $t(this.model.graphSetting,e,n,this.graphStore,this.logger,this.model.version,this.model.states),this.$element.append(this.graphStateElement.Element)),this.textStateElement=new we(this.model.states,e,n,this.logger,this.model.version,this.model.states),this.$element.append(this.textStateElement.Element)}checkState(){if(!this.model.states)throw new Error("The switch indicator light's states is undefined.");if(this.model.states.length<2)throw new Error("The switch indicator light's states must greater than 2.")}}class Ee extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}}class Ae extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}}class Oe extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}}var je={value:function(){}};function Ne(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i)throw new Error("illegal type: "+t);i[t]=[]}return new He(i)}function He(t){this._=t}function Ve(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function Pe(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=je,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}He.prototype=Ne.prototype={constructor:He,on:function(t,e){var n,i=this._,r=function(t,e){return t.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}(t+"",i),a=-1,o=r.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<o;)if(n=(t=r[a]).type)i[n]=Pe(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Pe(i[n],t.name,null);return this}for(;++a<o;)if((n=(t=r[a]).type)&&(n=Ve(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new He(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),a=0;a<n;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(i=this._[t]).length;a<n;++a)i[a].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,a=i.length;r<a;++r)i[r].value.apply(e,n)}};var Fe=Ne;function Ie(){H.stopImmediatePropagation()}var Re=function(){H.preventDefault(),H.stopImmediatePropagation()},We=function(t){var e=t.document.documentElement,n=G(t).on("dragstart.drag",Re,!0);"onselectstart"in e?n.on("selectstart.drag",Re,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")};var ze=function(t){return function(){return t}};function Be(t,e,n,i,r,a,o,s,l,u){this.target=t,this.type=e,this.subject=n,this.identifier=i,this.active=r,this.x=a,this.y=o,this.dx=s,this.dy=l,this._=u}function Ue(){return!H.button}function Ge(){return this.parentNode}function $e(t){return null==t?{x:H.x,y:H.y}:t}function qe(){return"ontouchstart"in this}Be.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Je=function(){var t,e,n,i,r=Ue,a=Ge,o=$e,s=qe,l={},u=Fe("start","drag","end"),c=0,d=0;function h(t){t.on("mousedown.drag",f).filter(s).on("touchstart.drag",g).on("touchmove.drag",v).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(){if(!i&&r.apply(this,arguments)){var o=y("mouse",a.apply(this,arguments),tt,this,arguments);o&&(G(H.view).on("mousemove.drag",m,!0).on("mouseup.drag",p,!0),We(H.view),Ie(),n=!1,t=H.clientX,e=H.clientY,o("start"))}}function m(){if(Re(),!n){var i=H.clientX-t,r=H.clientY-e;n=i*i+r*r>d}l.mouse("drag")}function p(){G(H.view).on("mousemove.drag mouseup.drag",null),function(t,e){var n=t.document.documentElement,i=G(t).on("dragstart.drag",null);e&&(i.on("click.drag",Re,!0),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(H.view,n),Re(),l.mouse("end")}function g(){if(r.apply(this,arguments)){var t,e,n=H.changedTouches,i=a.apply(this,arguments),o=n.length;for(t=0;t<o;++t)(e=y(n[t].identifier,i,et,this,arguments))&&(Ie(),e("start"))}}function v(){var t,e,n=H.changedTouches,i=n.length;for(t=0;t<i;++t)(e=l[n[t].identifier])&&(Re(),e("drag"))}function _(){var t,e,n=H.changedTouches,r=n.length;for(i&&clearTimeout(i),i=setTimeout(function(){i=null},500),t=0;t<r;++t)(e=l[n[t].identifier])&&(Ie(),e("end"))}function y(t,e,n,i,r){var a,s,d,f=n(e,t),m=u.copy();if(R(new Be(h,"beforestart",a,t,c,f[0],f[1],0,0,m),function(){return null!=(H.subject=a=o.apply(i,r))&&(s=a.x-f[0]||0,d=a.y-f[1]||0,!0)}))return function o(u){var p,g=f;switch(u){case"start":l[t]=o,p=c++;break;case"end":delete l[t],--c;case"drag":f=n(e,t),p=c}R(new Be(h,u,a,t,p,f[0]+s,f[1]+d,f[0]-g[0],f[1]-g[1],m),m.apply,m,[u,i,r])}}return h.filter=function(t){return arguments.length?(r="function"==typeof t?t:ze(!!t),h):r},h.container=function(t){return arguments.length?(a="function"==typeof t?t:ze(t),h):a},h.subject=function(t){return arguments.length?(o="function"==typeof t?t:ze(t),h):o},h.touchable=function(t){return arguments.length?(s="function"==typeof t?t:ze(!!t),h):s},h.on=function(){var t=u.on.apply(u,arguments);return t===u?h:t},h.clickDistance=function(t){return arguments.length?(d=(t=+t)*t,h):Math.sqrt(d)},h},Xe=n(26);class Ze extends kt{constructor(t,e,n,r,a,o,s,l,u,c,d,h,f,m){super(t,s,r,a,c,m),this.modalService=n,this.graphStore=o,this.operationRecordService=l,this.securityChecker=u,this.popupViewService=d,this.hostContainerId=h,this.el=f,this.touchedScreenX=0,this.touchedScreenY=0,this.logger=e.get(i.b),this.viewService=e.get(Xe.a),this.initElement()}initElement(){const t=this.model.size.width,e=this.model.size.height;this.initGraph(t,e),this.rootElement.append("rect").attr("id","StateFrame").attr("width",t).attr("height",e).attr("fill","transparent");const n=this.$element.find("text").last(),i=this.model.label.font.fontStyle;n.css("font",i+",msyh"),this.switchToState(0),this.rootElement.on("mousedown",()=>{if(this.isInitialized)if(this.switchToState(1),H.preventDefault(),this.isEnable);else{const t=this.isGrantedPermission?this.localization.conditionIsNotMetTip:this.localization.permissiontip,e=this.modalService.show(Et.a,{initialState:{alermMessage:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),n=e.content.onClosed.subscribe(()=>{e.hide(),n.unsubscribe()})}}),this.rootElement.on("mouseup",()=>{if(this.switchToState(0),H.preventDefault(),this.isInitialized&&this.isEnable)if(this.model.useSecurity){const t=this.modalService.show(At.a,{backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.checkElementPassword()})}else this.checkElementPassword()}),this.model.operationType===ot.ViewOperationType.ControlView?(this.rootElement.style("cursor","move"),this.rootElement.call(Je().on("start",()=>{this.isEnable?H&&H.sourceEvent?"touchstart"===H.sourceEvent.type&&H.sourceEvent.touches.length&&(this.touchedScreenX=H.sourceEvent.touches[0].screenX,this.touchedScreenY=H.sourceEvent.touches[0].screenY):this.logger.error("[GUI]Failed to get DragEvent",H):this.rootElement.style("cursor","hand")}).on("drag",()=>{if(this.isEnable)if(H&&H.sourceEvent){if("mousemove"===H.sourceEvent.type)this.moveView(H.sourceEvent.movementX,H.sourceEvent.movementY);else if("touchmove"===H.sourceEvent.type&&H.sourceEvent.touches.length){const t=H.sourceEvent.touches[0].screenX-this.touchedScreenX,e=H.sourceEvent.touches[0].screenY-this.touchedScreenY;this.touchedScreenX=H.sourceEvent.touches[0].screenX,this.touchedScreenY=H.sourceEvent.touches[0].screenY,this.moveView(t,e)}}else this.logger.error("[GUI]Failed to get DragEvent",H);else this.rootElement.style("cursor","hand")}).on("end",()=>this.switchToState(0)))):this.rootElement.style("cursor","hand")}switchToState(t){this.graphStateElement&&this.graphStateElement.switchToState(t)}initGraph(t,e){!0===this.model.useGraph&&(this.graphStateElement=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger),this.$element.prepend(this.graphStateElement.Element),this.graphStateElement.switchToState(0))}checkElementPassword(){if(this.model.enablePassword){const t=this.modalService.show(It.a,{initialState:{securityChecker:this.securityChecker},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.executeViewOperation()})}else this.executeViewOperation()}executeViewOperation(){let t=this.model.version>=5?this.model.operationType:ot.ViewOperationType.ToggleView;switch(t=void 0===t?ot.ViewOperationType.ToggleView:t){case ot.ViewOperationType.ToggleView:this.toggleView();break;case ot.ViewOperationType.PopupView:this.popView();break;case ot.ViewOperationType.CloseView:this.closeView()}}toggleView(){const t=this.model.viewIndex;if(null!=t){const e=this.viewService.toggleViews.get(this.el);if(!e)return;e(t,this.hostContainerId,this.el).subscribe(()=>this.recordViewOperation(),e=>this.logger.error(`ToggleView(${t}) failed. `,e))}else this.logger.error("[GUI]Toggle View:invalid view index")}popView(){const t=this.model.viewIndex;null!=t?(this.popupViewService.popView(t,this.hostContainerId,this.el).subscribe(()=>this.recordViewOperation(),e=>this.logger.error(`ToggleView(${t}) failed. ${e}`)),$(`#${this.hostContainerId} video`).addClass("video-hidden").css("visibility","hidden")):this.logger.error("[GUI]Toggle View:invalid view index")}closeView(){this.popupViewService.closeView(),$(`#${this.hostContainerId} .video-hidden`).removeClass("video-hidden").css("visibility","visible"),this.recordViewOperation()}moveView(t,e){isNaN(t)||isNaN(e)||(this.popupViewService.moveView(t,e),this.recordViewOperation())}recordViewOperation(){this.model.isRecordOperation&&this.operationRecordService.record({operationDescription:this.model.operationDescription})}}class Ke extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}getActualSize(){const t=Snap(this.$element.find("path")[0]).getBBox(!0);return new ot.Size(t.width,t.height)}getActualLocation(){return{x:this.model.location.x,y:this.model.location.y}}}class Qe extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}getActualSize(){const t=Snap(this.$element.find("path")[0]).getBBox(!0);return new ot.Size(t.width,t.height)}getActualLocation(){return{x:this.model.location.x,y:this.model.location.y}}}class tn extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}getActualSize(){const t=Snap(this.$element.find("path")[0]).getBBox(!0);return new ot.Size(t.width,t.height)}getActualLocation(){return{x:this.model.location.x,y:this.model.location.y}}}class en extends xt{constructor(t,e,n,r,a,o,s){super(t,n,r,a,s),this.graphStore=o,this.logger=e.get(i.b),this.model.size&&this.initGraphAndText(),this.model&&this.model.linkAddress&&(this.rootElement.style("cursor","hand"),this.rootElement.on("mousedown",()=>{let t=this.model.linkAddress;/^http(s)?:\/\/.+$/.test(t)||(t="http://"+t),window.open(t,"_system")}))}initGraphAndText(){this.rootElement.selectAll("*").remove();const t=this.model.size,e=t.width,n=t.height;if(this.rootElement.append("rect").attr("id","StateFrame").attr("width",e).attr("height",n).attr("fill","transparent"),!0===this.model.useGraph){const t=new $t(this.model.graphSetting,e,n,this.graphStore,this.logger);t.switchToState(0),this.$element.prepend(t.Element)}const i={isUnderline:this.model.isUnderline,isBold:this.isBold(this.model.font),isItalic:this.isItalic(this.model.font),fontSize:this.model.fontSize,fontFamily:this.fontFamily(this.model.font),color:this.model.stroke,textAlign:this.model.textAlign},r=new Rt(this.model.text,i,e,n);this.$element.append(r.Element)}}var nn,rn=n(27);class an extends Mt{constructor(t,e,n,i,r,a,o,s,l){super(t,n,i,r,l),this.videoService=a,this.guiSize=o,this.svgRootClass=s,this.videoId="",this.isMobileMode=ee.a.Mobile===e.get(ee.b).displayMode,this.localization=e.get(at.b),this.init()}dispose(){this.videoPlayer&&"function"==typeof this.videoPlayer.stop&&this.videoPlayer.stop(),$("div."+this.svgRootClass+" video").each(function(){$(this).remove()})}hide(){super.hide(),this.isShow=!1,Object(nt.isNil)(this.videoId)||""===this.videoId||setTimeout(()=>{$("#"+this.videoId).hide()},0)}show(){super.show(),this.isShow=!0,setTimeout(()=>{$("#"+this.videoId).show()},0)}init(){this.rootElement.selectAll("*").remove(),this.model.videoTag?(this.videoId=rn.a.newGuid().toString("n"),this.rootElement.append("rect").attr("id","rect"+this.videoId).attr("fill","transparent").attr("width",this.model.size.width).attr("height",this.model.size.height),this.videoService.getVideoUrl(this.model.videoTag).then(t=>{this.initVideo(t.url,t.isMobileType,this.videoId)}).catch(()=>{throw new Error("Failure of the videoService")})):this.addVideoAddressToolTip(this.localization.unconfiguredVideoAddress)}initVideo(t,e,n){if(-1!==t.indexOf("http:")&&(t=t.replace("http:","https:")),!/https:.+.m3u8/.test(t)){let e=this.localization.invalidVideoAddress;return(Object(nt.isNil)(t)||""===t)&&(e=this.localization.unconfiguredVideoAddress),void this.addVideoAddressToolTip(e)}const i=this.$element.find("rect#rect"+n).first();if(!i.length)return;const r=i[0].getBoundingClientRect(),a=r.width,o=r.height,s=this.model.location.x/this.guiSize.width*$("."+this.svgRootClass).find(".svg-content").width(),l=this.model.location.y/this.guiSize.height*$("."+this.svgRootClass).find(".svg-content").height();let u=`<video scareX="${this.model.location.x/this.guiSize.width}"\n scareY="${this.model.location.y/this.guiSize.height}" id="${n}" src="${t}" style="\n position: absolute;top:${l}px;left:${s}px;width:${a}px;height:${o}px;object-fit:fill;z-index:0"\n playsInline webkit-playsinline `;const c=!!navigator.userAgent.match(/(Android)/i);this.isMobileMode?c?(e&&(u+=" controls "),u+=" autoplay muted></video>"):u+=" controls muted></video>":u+=" controls autoplay muted></video>",$("."+this.svgRootClass).find(".svg-content").append(u),!1===this.isShow&&$("#"+this.videoId).hide(),this.videoPlayer=new EZUIPlayer(n),c&&!e&&this.setAndroidVideo(n)}addVideoAddressToolTip(t){const e=this.model.size;this.rootElement.append("image").attr("width",e.width).attr("height",e.height).attr("xlink:href","assets/img/video.jpg").attr("preserveAspectRatio","none").attr("crossorigin","anonymous");const n=new Rt(t,{isUnderline:!1,isBold:!1,isItalic:!1,fontSize:"16px",fontFamily:"Microsoft YaHei",color:"#fff",textAlign:"center"},e.width,e.height);this.$element.append(n.Element)}setAndroidVideo(t){let e=!1;const n=$("#"+t);let i=n.height(),r=n.width(),a=n.css("top"),o=n.css("left");n.on("click",()=>{if(e)n.css("width",r+"px"),n.css("height",i+"px"),n.css("left",o),n.css("top",a),n.css("z-index","0"),e=!1;else{i=n.height(),r=n.width(),a=n.css("top"),o=n.css("left");const t=document.body.clientWidth,s=9*t/16;n.css("width",t+"px"),n.css("height",s+"px"),n.css("left","0px"),n.css("top","0px"),n.css("z-index","99"),e=!0}})}}class on extends Mt{constructor(t,e,n,r,a,o,s){super(t,n,r,a,s),this.weatherService=o,this.localization=e.get(at.b),this.logger=e.get(i.b),this.initWeatherInfo(),this.id=Math.abs(+this.model.id),this.timer=setInterval(()=>this.initWeatherInfo(),36e5)}dispose(){clearInterval(this.timer)}initWeatherInfo(){this.clear(),this.weatherService.getWeatherInfo().then(t=>{const e=t;if(!e.supported)return void this.handleNotSupported();if(e.gettingAddress)return void this.handleGettingAddress();if(!e.hasAddress)return void this.handleNoAddress();const n=e.location.length>4?`${e.location.substr(0,3)}...`:e.location;this.handleNormal(e.temperature,e.humidity,n,e.wind,e.weatherIcon,e.weatherPhenomenon)}).catch(()=>{this.handleNotSupported()})}clear(){this.rootElement.selectAll("*").remove()}handleNotSupported(){this.handleUnusualCommon(this.localization.weatherNotSupport)}handleGettingAddress(){this.handleUnusualCommon(this.localization.weatherNotAvailable)}handleNoAddress(){this.handleUnusualCommon(this.localization.weatherNotAddress)}handleUnusualCommon(t){const e=q("svg");this.buildBackgroudRect(e,"#081625","0.5"),this.buildUnusualTipIcon(e,t.length),this.buildUnusualTipText(e,t),this.appendWeatherSvg(e)}handleNormal(t,e,n,i,r,a){const o=this.model.stroke?this.model.stroke:"#FFFFFF",s=this.model.fill&&this.model.fill||"#86A7C5",l=q("svg");this.buildBackgroudRect(l,s),this.buildTemperatureGroup(l,t,e,o),this.buildWeather(l,r),this.buildLocGroup(l,n,o),this.buildWindGroup(l,i,o,n.length),this.buildWeatherText(l,a,o),this.appendWeatherSvg(l)}getRainPath(){return"M78,200c-43,0-78-33.3-78-74.3C0,74.9,55.5,20.4,72.5,4.9L77.8,0l5.4,4.8c0.7,0.6,72.5,64.6,72.8,120.9\nC156,166.7,121,200,78,200z M77.9,21.7C60.2,38.8,16,85.4,16,125.7c0,32.2,27.8,58.3,62,58.3s62-26.2,62-58.3\nC139.7,88.4,99.2,41.9,77.9,21.7z M87.7,163.9c-4.2,0-7.6-3.3-7.7-7.5c0-4.2,3.3-7.7,7.6-7.7c14.3-0.2,25.7-11.3,25.5-24.7\nc0-4.2,3.3-7.7,7.6-7.7c0,0,0.1,0,0.1,0c4.2,0,7.6,3.3,7.7,7.5C128.7,145.6,110.5,163.6,87.7,163.9\nC87.7,163.9,87.7,163.9,87.7,163.9z"}getLocPath(){return"M78,0C35,0,0,33.3,0,74.3c0,50.8,55.5,105.4,72.6,120.9l5.3,4.8l5.3-4.7c0.7-0.6,72.5-64.6,72.8-121v0\nC156,33.3,121,0,78,0z M78,178.6c-17.8-17.1-62.1-63.9-62.1-104.4C15.8,42,43.7,15.7,78,15.7c34.3,0,62.2,26.3,62.2,58.5\nC140,111.8,99.2,158.4,78,178.6z M78,40.4c-17.8,0-32.4,14.4-32.4,32.2s14.5,32.2,32.4,32.2s32.4-14.4,32.4-32.2S95.8,\n40.4,78,40.4z M78,89.1c-9.1,0-16.5-7.4-16.5-16.5S68.9,56.2,78,56.2s16.5,7.4,16.5,16.5S87.1,89.1,78,89.1z"}getWindPath(){return"M7.1,56.7h85.7c15.8,0,28.6-12.7,28.6-28.4S108.6,0,92.9,0C77.1,0,64.3,12.7,64.3,28.4h14.3\nc0-7.8,6.4-14.2,14.3-14.2c7.9,0,14.3,6.3,14.3,14.2c0,7.8-6.4,14.2-14.3,14.2H7.1c-3.9,0-7.1,3.2-7.1,7.1\nC0,53.6,3.2,56.7,7.1,56.7L7.1,56.7z\nM164.3,99.3H7.1c-3.9,0-7.1,3.2-7.1,7.1c0,3.9,3.2,7.1,7.1,7.1h157.1c7.9,0,14.3,6.4,14.3,14.2\nc0,7.8-6.4,14.2-14.3,14.2c-7.9,0-14.3-6.3-14.3-14.2h-14.3c0,15.7,12.8,28.4,28.6,28.4c15.8,0,28.6-12.7,28.6-28.4\nS180.1,99.3,164.3,99.3L164.3,99.3z\nM7.1,85.1h157.1c19.7,0,35.7-15.9,35.7-35.5c0-19.6-16-35.5-35.7-35.5c-19.7,0-35.7,15.9-35.7,35.5\nc0,2.4,0.3,4.8,0.8,7.1h14.8c-0.8-2.2-1.3-4.6-1.3-7.1c0-11.7,9.6-21.3,21.4-21.3c11.8,0,21.4,9.5,21.4,21.3\nc0,11.1-8.6,20.2-19.6,21.1c-0.3,0-0.6,0.2-0.9,0.2H7.1C3.2,70.9,0,74.1,0,78C0,81.9,3.2,85.1,7.1,85.1L7.1,85.1z"}getUnusualIconPath(){return'<g>\n<ellipse class="st2" cx="74.6" cy="72.3" rx="36.4" ry="36.3" fill="#EFCA30"/>\n<path class="st2" fill="#EFCA30" d="M74.5,24.5C74.6,24.5,74.6,24.5,74.5,24.5c3.7,0,5.7-2,5.7-5.5V5.5C80.2,2,78,0,74.6,0C71,0,69,2.1,69,5.5V19\nC69,22.3,71,24.4,74.5,24.5L74.5,24.5z"/>\n<path class="st2" fill="#EFCA30" d="M37.2,28.5l-6.9-6.7c-1.3-1.3-2.7-1.9-4.1-1.9s-2.8,0.6-4.1,1.9c-1.3,1.3-1.9,2.6-1.9,4s0.6,2.7,1.9,4\nl6.4,6.1c0.5,0.5,1.2,1.1,1.9,1.4c1.2,0.5,2,0.7,2.8,0.7c0.6,0,1.3-0.2,2-0.4c1.4-0.5,2.7-1.5,3.3-2.8c0.3-0.7,0.5-1.5,0.5-2.2\nC39.1,31.2,38.5,29.8,37.2,28.5L37.2,28.5z"/>\n<path class="st2" fill="#EFCA30" d="M112.5,36.9c1.6,0.7,2.7,1.2,3.7,1.2s2-0.4,3.6-1.2c0.2-0.1,0.4-0.2,0.5-0.4l6.9-6.7c1.3-1.3,1.9-2.6,1.9-4\ns-0.6-2.7-1.9-4c-1.3-1.3-2.7-1.9-4.1-1.9s-2.8,0.6-4.1,1.9l-6.9,6.7c-1.3,1.3-1.9,2.6-1.9,4c0,1.4,0.6,2.7,1.9,4\nC112.1,36.6,112.3,36.8,112.5,36.9L112.5,36.9z"/>\n<path class="st2" fill="#EFCA30" d="M25.1,73.2C25.1,73.1,25.1,73.1,25.1,73.2c0-3.6-2-5.6-5.6-5.6H5.6C2,67.6,0,69.7,0,73.1\nc0,3.4,2.2,5.5,5.6,5.5h13.8C22.7,78.6,24.9,76.6,25.1,73.2L25.1,73.2z"/>\n<path class="st2" fill="#EFCA30" d="M33.2,107.6c-1.4,0-2.8,0.6-4.1,1.9l-6.9,6.7c-1.3,1.3-1.9,2.6-1.9,4s0.6,2.7,1.9,4c0.2,0.2,0.3,0.3,0.5,0.4\nc1.6,0.7,2.7,1.2,3.7,1.2c0.5,0,1.5-0.1,3.6-1.2c0.2-0.1,0.4-0.2,0.5-0.4l6.9-6.7c2.6-2.5,2.6-5.6,0-8.1\nC36,108.3,34.6,107.6,33.2,107.6L33.2,107.6z"/>\n</g>\n<path class="st3" fill="#FFFFFF" d="M68.8,160h99.3c17.9-2,31.9-17.1,31.9-35.5c0-18.3-13.8-33.3-31.5-35.4c-8-17-25.2-28.9-45.3-28.9\nc-22.4,0-41.4,14.7-47.7,35c-1.1-0.1-2.2-0.2-3.4-0.2c-18,0-32.6,14.6-32.6,32.6C39.5,144.5,52.3,158.3,68.8,160z"/>'}buildBackgroudRect(t,e,n="1"){t.append("rect").attr("x","0").attr("y","0").attr("rx","2").attr("width","268").attr("height","92").attr("fill",e).attr("fill-opacity",n)}buildTemperatureGroup(t,e,n,i){const r=t.append("text").attr("x","14").attr("y","57").attr("font-family","sans-serif").attr("font-weight","lighter").attr("font-size","50").attr("fill",i).text(e);r.append("tspan").attr("dy","-27").attr("font-size","20").attr("fill",i).text("°C"),r.append("tspan").attr("dx","-8").attr("dy","25").attr("font-size","22").attr("fill",i).text("/"),t.append("svg").attr("x",`${16+50*e.length*.75}`).attr("y","46").attr("width","11").attr("height","11").attr("viewBox","0 0 156 200").append("path").attr("fill",i).attr("d",this.getRainPath()),t.append("text").attr("x",`${30+50*e.length*.75}`).attr("y","57").attr("font-size","12").attr("fill",i).text(n)}buildWeather(t,e){t.append("image").attr("x","151").attr("y","2").attr("width","110").attr("height","66").attr("xlink:href",`assets/img/weather/${e}.png`).attr("preserveAspectRatio","none").attr("crossorigin","anonymous")}buildLocGroup(t,e,n){t.append("svg").attr("x","14").attr("y","70").attr("width","11").attr("height","11").attr("viewBox","0 0 156 200").append("path").attr("fill",n).attr("d",this.getLocPath),t.append("text").attr("x","28").attr("y","80").attr("font-size","12").attr("fill",n).text(e)}buildWindGroup(t,e,n,i){t.append("svg").attr("x",`${28+12*i+10}`).attr("y","69").attr("width","13").attr("height","13").attr("viewBox","0 0 200 156").append("path").attr("fill",n).attr("d",this.getWindPath),t.append("text").attr("x",`${28+12*i+10+14+2}`).attr("y","80").attr("font-size","12").attr("fill",n).text(e)}buildWeatherText(t,e,n){t.append("text").attr("x","201").attr("y","80").attr("font-size",12).attr("font-anchor","middle").attr("fill",n).text(e)}buildUnusualTipIcon(t,e){t.append("svg").attr("x",e>9?(268-7*e-8-42)/2:"44").attr("y","23").attr("width","42").attr("height","34").attr("viewBox","0 0 200 160").html(this.getUnusualIconPath)}buildUnusualTipText(t,e){const n=e.length;t.append("text").attr("x",n>9?(268-7*n-8-42)/2+42+8:"94").attr("y","46").attr("font-size",14).attr("font-anchor","middle").attr("fill","#FFFFFF").attr("dominant-baseline","central").text(e)}appendWeatherSvg(t){this.rootElement.append(()=>t.node())}}class sn extends Mt{constructor(t,e,n,i,r,a,o){super(t,n,i,r,o),this.weatherService=a,this.localization=e.get(at.b),this.initAirQualityInfo(),this.timer=setInterval(()=>this.initAirQualityInfo(),36e5)}dispose(){clearInterval(this.timer)}initAirQualityInfo(){this.clear(),this.weatherService.getAirQualityInfo().then(t=>{const e=t;e.supported?e.gettingAddress?this.handleGettingAddress():e.hasAddress?this.handleData(e.airQuality):this.handleNoAddress():this.handleNotSupported()}).catch(()=>{this.handleNotSupported()})}handleData(t){const e=this.model.stroke?this.model.stroke:"#FFFFFF",n=this.model.fill&&this.model.fill||"#86A7C5",i=q("svg");this.buildBackgroudRect(i,n),this.buildLocGroup(i,t.city,e),this.buildAirQualityText(i,130,55,t.aqi,e,53),this.buildAirQualityText(i,220,28,"空气质量",e),this.buildRectBackgroundForAqi(i,t.level),this.buildAirQualityText(i,220,49,t.category,e),this.buildAirQualityText(i,30,75,"PM2.5",e,12,.8),this.buildAirQualityText(i,30,95,t.pm25,e,15),this.buildAirQualityText(i,80,75,"PM10",e,12,.8),this.buildAirQualityText(i,80,95,t.pm10,e,15),this.buildAirQualityText(i,130,75,"NO2",e,12,.8),this.buildAirQualityText(i,130,95,t.no2,e,15),this.buildAirQualityText(i,175,75,"SO2",e,12,.8),this.buildAirQualityText(i,175,95,t.so2,e,15),this.buildAirQualityText(i,215,75,"CO",e,12,.8),this.buildAirQualityText(i,215,95,t.co,e,15),this.buildAirQualityText(i,250,75,"O3",e,12,.8),this.buildAirQualityText(i,250,95,t.o3,e,15),this.appendAirQualitySvg(i)}handleNotSupported(){this.handleUnusualCommon(this.localization.airQualityNotSupport)}handleGettingAddress(){this.handleUnusualCommon(this.localization.airQualityNotAvailable)}handleNoAddress(){this.handleUnusualCommon(this.localization.airQualityNotAddress)}handleUnusualCommon(t){const e=q("svg");this.buildBackgroudRect(e,"#081625","0.5"),this.buildUnusualTipIcon(e,t.length),this.buildUnusualTipText(e,t),this.appendAirQualitySvg(e)}buildBackgroudRect(t,e,n="1"){t.append("rect").attr("x","0").attr("y","0").attr("rx","2").attr("width","280").attr("height","105").attr("fill",e).attr("fill-opacity",n)}buildRectBackgroundForAqi(t,e,n="1"){let i;e>=0&&e<=50?i="#50DF56":e>=51&&e<=100?i="#FBCD1C":e>=101&&e<=150?i="#FF9900":e>=151&&e<=200?i="#FF3232":e>=201&&e<=300?i="#F403B5":e>300&&(i="#A10E0E"),t.append("rect").attr("x","195").attr("y","35").attr("rx","5").attr("width","50").attr("height","20").attr("fill",i).attr("fill-opacity",n)}buildUnusualTipIcon(t,e){t.append("svg").attr("x",e>9?(268-7*e-8-42)/2:"44").attr("y","23").attr("width","42").attr("height","34").attr("viewBox","0 0 200 160").html(this.getUnusualIconPath)}getUnusualIconPath(){return'<g>\n <ellipse class="st2" cx="74.6" cy="72.3" rx="36.4" ry="36.3" fill="#EFCA30"/>\n <path class="st2" fill="#EFCA30" d="M74.5,24.5C74.6,24.5,74.6,24.5,74.5,24.5c3.7,0,5.7-2,5.7-5.5V5.5C80.2,2,78,0,74.6,0C71,0,69,2.1,69,5.5V19\n C69,22.3,71,24.4,74.5,24.5L74.5,24.5z"/>\n <path class="st2" fill="#EFCA30" d="M37.2,28.5l-6.9-6.7c-1.3-1.3-2.7-1.9-4.1-1.9s-2.8,0.6-4.1,1.9c-1.3,1.3-1.9,2.6-1.9,4s0.6,2.7,1.9,4\n l6.4,6.1c0.5,0.5,1.2,1.1,1.9,1.4c1.2,0.5,2,0.7,2.8,0.7c0.6,0,1.3-0.2,2-0.4c1.4-0.5,2.7-1.5,3.3-2.8c0.3-0.7,0.5-1.5,0.5-2.2\n C39.1,31.2,38.5,29.8,37.2,28.5L37.2,28.5z"/>\n <path class="st2" fill="#EFCA30" d="M112.5,36.9c1.6,0.7,2.7,1.2,3.7,1.2s2-0.4,3.6-1.2c0.2-0.1,0.4-0.2,0.5-0.4l6.9-6.7c1.3-1.3,1.9-2.6,1.9-4\n s-0.6-2.7-1.9-4c-1.3-1.3-2.7-1.9-4.1-1.9s-2.8,0.6-4.1,1.9l-6.9,6.7c-1.3,1.3-1.9,2.6-1.9,4c0,1.4,0.6,2.7,1.9,4\n C112.1,36.6,112.3,36.8,112.5,36.9L112.5,36.9z"/>\n <path class="st2" fill="#EFCA30" d="M25.1,73.2C25.1,73.1,25.1,73.1,25.1,73.2c0-3.6-2-5.6-5.6-5.6H5.6C2,67.6,0,69.7,0,73.1\n c0,3.4,2.2,5.5,5.6,5.5h13.8C22.7,78.6,24.9,76.6,25.1,73.2L25.1,73.2z"/>\n <path class="st2" fill="#EFCA30" d="M33.2,107.6c-1.4,0-2.8,0.6-4.1,1.9l-6.9,6.7c-1.3,1.3-1.9,2.6-1.9,4s0.6,2.7,1.9,4c0.2,0.2,0.3,0.3,0.5,0.4\n c1.6,0.7,2.7,1.2,3.7,1.2c0.5,0,1.5-0.1,3.6-1.2c0.2-0.1,0.4-0.2,0.5-0.4l6.9-6.7c2.6-2.5,2.6-5.6,0-8.1\n C36,108.3,34.6,107.6,33.2,107.6L33.2,107.6z"/>\n </g>\n <path class="st3" fill="#FFFFFF" d="M68.8,160h99.3c17.9-2,31.9-17.1,31.9-35.5c0-18.3-13.8-33.3-31.5-35.4c-8-17-25.2-28.9-45.3-28.9\n c-22.4,0-41.4,14.7-47.7,35c-1.1-0.1-2.2-0.2-3.4-0.2c-18,0-32.6,14.6-32.6,32.6C39.5,144.5,52.3,158.3,68.8,160z"/>'}buildUnusualTipText(t,e){const n=e.length;t.append("text").attr("x",n>9?(268-7*n-8-42)/2+42+8:"94").attr("y","46").attr("font-size",14).attr("font-anchor","middle").attr("fill","#FFFFFF").attr("dominant-baseline","central").text(e)}buildAirQualityText(t,e,n,i,r,a=12,o=1){t.append("text").attr("x",e).attr("y",n).attr("font-size",a).attr("text-anchor","middle").attr("fill",r).attr("opacity",o).text(i)}buildLocGroup(t,e,n){t.append("svg").attr("x","14").attr("y","10").attr("width","11").attr("height","15").attr("viewBox","0 0 156 200").append("path").attr("fill",n).attr("d",this.getLocPath),t.append("text").attr("x","30").attr("y","22").attr("font-size","12").attr("fill",n).text(e)}getLocPath(){return"M78,0C35,0,0,33.3,0,74.3c0,50.8,55.5,105.4,72.6,120.9l5.3,4.8l5.3-4.7c0.7-0.6,72.5-64.6,72.8-121v0\nC156,33.3,121,0,78,0z M78,178.6c-17.8-17.1-62.1-63.9-62.1-104.4C15.8,42,43.7,15.7,78,15.7c34.3,0,62.2,26.3,62.2,58.5\nC140,111.8,99.2,158.4,78,178.6z M78,40.4c-17.8,0-32.4,14.4-32.4,32.2s14.5,32.2,32.4,32.2s32.4-14.4,32.4-32.2S95.8,\n40.4,78,40.4z M78,89.1c-9.1,0-16.5-7.4-16.5-16.5S68.9,56.2,78,56.2s16.5,7.4,16.5,16.5S87.1,89.1,78,89.1z"}appendAirQualitySvg(t){this.rootElement.append(()=>t.node())}clear(){this.rootElement.selectAll("*").remove()}}!function(t){t[t.Normal=0]="Normal",t[t.Loading=1]="Loading"}(nn||(nn={}));class ln extends Mt{constructor(t,e,n,r,a,o,s){var l;super(t,n,r,a,s),this.alarmsStore=o,this.elementStatus=nn.Loading,this.displayOption={dataLimit:500,dataZoomHeight:32,marginLeft:1,marginRight:20,mobileMinWidth:450,operationAreaHeight:32,operationAreaMarginTop:10,operationSelectFontSize:"16px",operationButtonWidth:24,operationButtonHeight:24,operationButtonMargin:4},this.alarmNames=[],this.alarmList=[],this.currentAlarmList=[],this.page=0,this.totalCount=0,this.pageSize=5,this.rootElement.selectAll("*").remove(),this.setStatusAsLoading(),this.logger=e.get(i.b),this.localization=e.get(at.b),this.variableCommunicator=r,this.timePeriods=this.getValidTimePeriods(),this.pageSize=this.model.generalSetting.pageSize,localStorage.setItem("simulate-time",Gt().valueOf()+""),this.model.filterSetting?(this.alarmNames=this.model.filterSetting.detailsData.map(t=>t.name),this.currentTimePeriod=null===(l=this.model.filterSetting)||void 0===l?void 0:l.displayPeriod,this.updateQueryTimeRange(),this.model.filterSetting.alarmType?this.refreshIntervalId=setInterval(()=>{this.loadFirstPage(),this.logger.debug(`[GUI]Refresh Alarm Table:${Zt.time.format("%x %X")(new Date)}`)},60*this.model.filterSetting.refreshCycle*1e3):r.subscribeUserDeviceAlarms(s).subscribe(t=>{t.forEach(t=>{-1===this.alarmNames.indexOf(t.name)||this.getAlarmData()})}),this.getAlarmData()):(this.totalCount=0,this.alarmList=[],this.renderElement())}dispose(){clearInterval(this.refreshIntervalId),this.element&&this.element.tooltip.hidden(!0),this.logger.debug(`[GUI]Dispose Alarm Table Refresh Interval:${Zt.time.format("%x %X")(new Date)}`)}getValidTimePeriods(){const t=new Array;return t.push({key:6,name:this.localization.lastThirtyMinutes}),t.push({key:1,name:this.localization.lastOneHour}),t.push({key:7,name:this.localization.lastEightHour}),t.push({key:2,name:this.localization.lastTwentyFourHours}),t.push({key:3,name:this.localization.lastSevenDays}),t.push({key:4,name:this.localization.lastThirtyDays}),t.push({key:5,name:this.localization.lastOneYear}),t}getAlarmData(){this.rootElement.selectAll("*").remove(),this.setStatusAsLoading(),clearTimeout(this.getAlarmDataId),this.getAlarmDataId=setTimeout(()=>{if(this.model.filterSetting.alarmType){this.updateQueryTimeRange();const t=new Ct.c(this.alarmNames,this.startTime,this.endTime,this.pageSize,this.page*this.pageSize);this.alarmsStore.getHistoryAlarms(t).subscribe(t=>{t.error||(this.totalCount=t.totalCount,this.alarmList=t.items.map(t=>[t.name,t.message,t.alarmLevel,t.triggeredTime.format("YYYY-MM-DD HH:mm:ss")]),this.renderElement())})}else{const t=new Ct.c(this.alarmNames,void 0,void 0,this.pageSize,this.page*this.pageSize);this.alarmsStore.getCurrentAlarms(t).subscribe(t=>{if(!t.error){if(this.totalCount=t.totalCount,this.currentAlarmList=t.items,!t.items.length&&t.totalCount)return this.page=0,void this.getAlarmData();this.alarmList=this.currentAlarmList.map(t=>[t.name,t.message,t.alarmLevel,t.triggeredTime.format("YYYY-MM-DD HH:mm:ss")]),this.renderElement()}})}},500)}renderElement(){const t=this.model.size.height;this.element=document.createElementNS("http://www.w3.org/2000/svg","foreignObject"),this.element.setAttribute("width",this.model.size.width.toString()),this.element.setAttribute("height",t.toString()),this.$element.append(this.element);const e=document.createElement("table");e.style.cssText=`border: 2px solid ${this.model.generalSetting.stroke};\n height: ${t-39}`;let n=document.createElement("tr"),i="";this.model.generalSetting.headerFont.isItalic&&(i+="italic "),this.model.generalSetting.headerFont.isBold&&(i+="bold "),i+=this.model.generalSetting.headerFont.fontSize+" "+this.model.generalSetting.headerFont.fontFamily,n.style.cssText=`height: ${this.model.heights[0]}px;\n background: ${this.model.generalSetting.headerFillColor};\n color: ${this.model.generalSetting.headerFont.color};\n font: ${i};\n text-align: ${this.model.generalSetting.headerFont.textAlign};\n ${this.model.generalSetting.headerFont.isUnderline?"text-decoration: underline":""};\n vertical-align: middle;`;for(let t=0;t<4;t++){const e=document.createElement("th");e.innerHTML=this.model.columLabels[t],e.style.cssText=`width: ${this.model.widths[t]/this.model.size.width*100}%;\n border-style: solid;\n border-color: ${this.model.generalSetting.splitLine};\n border-left-width: ${!t||this.model.generalSetting.isHiddenColumnSplitLine?0:1}px;`,n.appendChild(e)}e.appendChild(n);const r=["#3695FF","#FFE900","#FFA800","#E84F4F"];for(let t=0;t<this.pageSize;t++){(n=document.createElement("tr")).style.cssText=`height: ${this.model.heights[t+1]}px;\n background: ${this.model.generalSetting.tableFillColor};\n font: ${this.model.generalSetting.fontStyle};\n color: ${this.model.generalSetting.fontColor};\n text-align: ${this.model.generalSetting.textAlign};\n vertical-align: middle;`;for(let e=0;e<4;e++){const i=document.createElement("td");if(i.style.cssText=`border-style: solid;\n border-color: ${this.model.generalSetting.splitLine};\n border-top-width: ${this.model.generalSetting.isHiddenColumnSplitLine?0:1}px;\n border-left-width: ${!e||this.model.generalSetting.isHiddenColumnSplitLine?0:1}px;`,this.alarmList[t])if(2!==e)i.innerHTML=this.alarmList[t][e],i.style.cssText+=`${this.model.generalSetting.isUnderline?"text-decoration: underline":""};`;else{const n=document.createElement("div");let a=parseInt(this.model.generalSetting.fontSize)+15;a>this.model.heights[t+1]&&(a=this.model.heights[t+1]);let o="0 15px";"left"===this.model.generalSetting.textAlign?o="0 30px 0 0":"right"===this.model.generalSetting.textAlign&&(o="0 0 0 30px"),n.style.cssText=`margin: ${o};\n border-radius: 5px;\n background: ${r[this.alarmList[t][e]]};\n color: #ffffff;\n width: ${this.model.widths[e]-30}px;\n height: ${a}px;\n max-height: ${this.model.heights[t+1]}px;\n display: flex;\n justify-content: center;\n align-items: center;\n ${this.model.generalSetting.isUnderline?"text-decoration: underline":""};`,n.innerHTML=this.model.levelText[this.alarmList[t][e]],i.appendChild(n)}else if(2===e){const t=document.createElement("div");let n="0 15px";"left"===this.model.generalSetting.textAlign?n="0 30px 0 0":"right"===this.model.generalSetting.textAlign&&(n="0 0 0 30px"),t.style.cssText=`margin: ${n};\n width: ${this.model.widths[e]-30}px;`,i.appendChild(t)}n.appendChild(i)}e.appendChild(n)}this.element.appendChild(e),this.renderOperationArea(this.model.size.width,t-39)}renderOperationArea(t,e){var n;const i=this.rootElement.append("g").attr("transform",`translate(0,${e+this.displayOption.operationAreaMarginTop})`).append("foreignObject").attr("width",t).attr("height",this.displayOption.operationAreaHeight).attr("fill","none").append("xhtml:div").style("height",this.displayOption.operationAreaHeight-4+"px").style("overflow","hidden").style("margin-top","4px");if(null===(n=this.model.filterSetting)||void 0===n?void 0:n.alarmType){i.append("select").style("margin-left",this.displayOption.marginLeft+"px").style("font-size",this.displayOption.operationSelectFontSize).on("change",()=>{const t=this.rootElement.select("select").property("value");this.updateTimeRange(t),this.getAlarmData()}).selectAll("option").data(this.timePeriods).enter().append("option").text(t=>t.name).attr("value",t=>t.key).property("selected",t=>t.key===Number(this.currentTimePeriod))}const r=this.displayOption.operationButtonWidth+"px",a=this.displayOption.operationButtonHeight+"px";i.append("button").style("width",r).style("height",a).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/last_page.svg)").on("click",()=>{this.loadLastPage()}),i.append("button").style("width",r).style("height",a).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/next_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadNextPage()}),i.append("button").style("width",r).style("height",a).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/previous_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadPreviousPage()}),i.append("button").style("width",r).style("height",a).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/first_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadFirstPage()}),this.setStatusAsNormal()}updateTimeRange(t){this.currentTimePeriod=+t,this.updateQueryTimeRange()}updateQueryTimeRange(){switch(this.endTime=Gt(),this.currentTimePeriod){case 1:this.startTime=Gt().subtract(1,"hours");break;case 3:this.startTime=Gt().subtract(7,"days");break;case 4:this.startTime=Gt().subtract(30,"days");break;case 5:this.startTime=Gt().subtract(1,"years");break;case 6:this.startTime=Gt().subtract(30,"minutes");break;case 7:this.startTime=Gt().subtract(8,"hours");break;default:this.startTime=Gt().subtract(1,"days")}}loadFirstPage(){this.page>0&&(this.page=0,this.getAlarmData())}loadNextPage(){let t=Math.ceil(this.totalCount/this.pageSize);t&&t--,this.page<t&&(this.page++,this.getAlarmData())}loadPreviousPage(){this.page>0&&(this.page--,this.getAlarmData())}loadLastPage(){let t=Math.ceil(this.totalCount/this.pageSize);t&&t--,this.page!==t&&(this.page=t,this.getAlarmData())}setStatusAsNormal(){this.elementStatus=nn.Normal,this.clearStatus()}setStatusAsLoading(){this.elementStatus=nn.Loading,this.renderStatus("assets/img/loading.svg","#226abc")}renderStatus(t,e){if(this.elementStatus===nn.Normal)return void this.clearStatus();this.rootElement.append("rect").attr("id","StateFrame").attr("fill","transparent").attr("width",this.model.size.width).attr("height",this.model.size.height);const n=this.$element[0].ownerDocument,i=this.$element.find("rect#StateFrame").first();if(!i.length)return;this.$element.find("image#StateImage").remove();const r=n.createElementNS("http://www.w3.org/2000/svg","image");if(r){let a=Number(i[0].getAttribute("width"))-20;const o=i[0].getAttribute("x");null!==o&&(a+=Number(o)),i[0].setAttribute("stroke",e),i[0].setAttribute("stroke-opacity","0.5"),r.href.baseVal=t,r.setAttributeNS(null,"id","StateImage"),r.setAttributeNS(null,"x",a.toString()),r.setAttributeNS(null,"y","0"),r.setAttributeNS(null,"height","20px"),r.setAttributeNS(null,"width","20px");const s=n.createElementNS("http://www.w3.org/2000/svg","title");r.appendChild(s),this.$element.append(r)}}clearStatus(){const t=this.$element.find("rect#StateFrame").first();t.length&&(t[0].getAttribute("stroke")&&t[0].removeAttribute("stroke"),this.$element.find("image#StateImage").remove())}}class un{constructor(t,e,n,r,a,o){this.injector=t,this.bsModalService=e,this.context=n,this.variableCommunicator=r,this.popupViewService=a,this.signalRAppId=o,this.elements=new Array,this.logger=t.get(i.b)}get rootElement(){return this.root[0]}load(t,e=!1,n){if(this.hostContainerId=n.hostContainerId,this.isLoaded)throw new Error("The Main Element already loaded.");this.root=$(t),this.root.attr("style",`margin: 0 auto;display: block;${e?"overflow: visible;":""}`),this.rawWidth=Number.parseInt(this.root.attr("width")),this.rawHeight=Number.parseInt(this.root.attr("height"));const i=this.root.find("[data-model]");Object(nt.each)(i,t=>{switch($(t).data("model").category){case lt.d.components.numericalDisplayKey:const e=new le(t,this.injector,this.bsModalService,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.graphStore,this.context.operationRecordService,this.context.releasedVariableService,this.context.securityChecker,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId);this.elements.push(e);break;case lt.d.components.imageKey:this.elements.push(new Me(t,this.injector,this.context.configStore.imageStore,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.graphStore,this.signalRAppId));break;case lt.d.components.meterKey:this.elements.push(new ie(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.pipeKey:this.elements.push(new he(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.switchIndicatorLightKey:this.elements.push(new Ce(t,this.injector,this.bsModalService,this.variableCommunicator,this.context.configStore.graphStore,this.context.permissionChecker,this.context.operationRecordService,this.context.securityChecker,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.barGraphKey:this.elements.push(new Dt(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.toggleViewKey:case lt.d.components.viewOperationElement:this.elements.push(new Ze(t,this.injector,this.bsModalService,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.graphStore,this.context.permissionChecker,this.context.operationRecordService,this.context.securityChecker,this.injector.get(at.b),this.popupViewService,n.hostContainerId,n.el,this.signalRAppId));break;case lt.d.components.characterKey:this.elements.push(new Wt(t,this.injector,this.bsModalService,this.variableCommunicator,this.context.configStore.graphStore,this.context.permissionChecker,this.context.operationRecordService,this.context.securityChecker,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.textKey:this.elements.push(new xe(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.graphStore,this.signalRAppId));break;case lt.d.components.hyperlinkKey:this.elements.push(new en(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.graphStore,this.signalRAppId));break;case lt.d.components.straightLineKey:this.elements.push(new Ke(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.polyLineKey:this.elements.push(new Qe(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.ellipseKey:this.elements.push(new Ee(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.rectangleKey:this.elements.push(new Ae(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.sectorkey:this.elements.push(new Oe(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.datetimeDisplayKey:this.elements.push(new qt(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.graphStore,this.signalRAppId));break;case lt.d.components.historicalCurveKey:this.elements.push(new ne(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.historyDataStore,this.signalRAppId));break;case lt.d.components.ringGraphKey:this.elements.push(new be(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.polygonKey:this.elements.push(new tn(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.videokey:this.elements.push(new an(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.videoService,new ot.Size(this.rawWidth,this.rawHeight),n.svgRootClass,this.signalRAppId));break;case lt.d.components.tableKey:this.elements.push(new tn(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.weatherKey:this.elements.push(new on(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.weatherService,this.signalRAppId));break;case lt.d.components.airQualityKey:this.elements.push(new sn(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.weatherService,this.signalRAppId));break;case lt.d.components.alarmKey:this.elements.push(new ln(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.alarmsStore,this.signalRAppId))}}),this.initBackground(),this.isLoaded=!0,this.logger.debug("[GUI] Main element loaded.")}uniformStretch(t,e){if(!t.isReal())throw new Error("size is not real.");this.checkIsLoaded();const n=this.rawHeight/this.rawWidth;t.height/t.width>n?t.height=t.width*n:t.width=t.height/n;const i=this.oldSize?this.oldSize:t;if(setTimeout(()=>{this.changeVideoStyle(t,i,e)},200),this.root.attr("width",t.width),this.root.attr("height",t.height),!this.root.attr("viewBox")){const e=t.width/this.rawWidth;this.root.find("g:first").attr("transform",`scale(${e})`)}this.oldSize=t}changeVideoStyle(t,e,n){const i=this;$("div."+n+" video").each(function(){const n=t.width/e.width*$(this).width();if(n>$("body").width()||n.toFixed(0)===$("body").width().toFixed(0))return;$(this).css("width",n+"px"),$(this).css("height",t.height/e.height*$(this).height()+"px");let r=t.width*Number($(this).attr("scareX")),a=t.height*Number($(this).attr("scareY"));if(i.hostContainerId){const e=$("#"+i.hostContainerId);if(e.length){const n=e[0].clientWidth,i=e[0].clientHeight;r+=(n-t.width)/2,a+=(i-t.height)/2}}$(this).css("left",r+"px"),$(this).css("top",a+"px")})}horizontalStretch(t){if(!t.isReal())throw new Error("size is not real.");if(this.checkIsLoaded(),t.height=t.width/this.rawWidth*this.rawHeight,this.root.attr("width",t.width),this.root.attr("height",t.height),!this.root.attr("viewBox")){const e=t.width/this.rawWidth;this.root.find("g:first").attr("transform",`scale(${e})`)}}initElementState(){Object(nt.forEach)(this.elements,t=>{t instanceof Lt?t.init(t.readVariableName||t.maxVariableName||t.minVariableName):t instanceof ne&&t.initElementStatus()}),this.logger.debug("[GUI] Main element enabled.")}getVariableNames(){const t=new Array;return Object(nt.forEach)(this.elements,e=>{var n,i;if(e instanceof Lt){const r=null===(n=e)||void 0===n?void 0:n.maxVariableName,a=e.maxValueType,o=null===(i=e)||void 0===i?void 0:i.minVariableName,s=e.minValueType,l=e.readVariableName;a&&r&&!t.find(t=>Object(nt.isEqual)(r,t))&&t.push(r),s&&o&&!t.find(t=>Object(nt.isEqual)(o,t))&&t.push(o),l&&!t.find(t=>Object(nt.isEqual)(l,t))&&t.push(e.readVariableName)}}),t}reportVariableStates(t){this.checkIsLoaded(),Object(nt.each)(t,t=>{Object(nt.each)(this.elements,e=>{if(e instanceof Lt){const n=e.readVariableName;n&&n===t.variableName&&e.reportStateChanged(t)}})})}reportVariableValues(t){this.checkIsLoaded(),Object(nt.each)(t,t=>{Object(nt.each)(this.elements,e=>{e instanceof Lt&&(e.readVariableName!==t.variableName&&e.minVariableName!==t.variableName&&e.maxVariableName!==t.variableName||e.reportValueChanged(t))})})}dispose(){Object(nt.each)(this.elements,t=>{(t instanceof ne||t instanceof an||t instanceof on||t instanceof le||t instanceof xe||t instanceof sn)&&t.dispose()})}checkIsLoaded(){if(!this.isLoaded)throw new Error("The Main Element is not loaded.please call load method first.")}initBackground(){const t=this.root.data("model");if(t){const e=t.background;switch(e.fillType){case Z.SolidColor:if(e.solidColor){const t=$(document.createElementNS("http://www.w3.org/2000/svg","rect")).attr({width:String(this.rawWidth),height:String(this.rawHeight),fill:e.solidColor});this.root.prepend(t)}break;case Z.Image:e.imageId&&this.root.prepend(this.getImageEl(e.imageId));break;case Z.Graph:if(e.graphSetting&&e.graphSetting.id>0){const t=new $t(e.graphSetting,this.rawWidth,this.rawHeight,this.context.configStore.graphStore,this.logger);t.switchToState(0),this.root.prepend(t.Element);const n=$(document.createElementNS("http://www.w3.org/2000/svg","rect")).attr({width:String(this.rawWidth),height:String(this.rawHeight),fill:"#fff"});this.root.prepend(n)}}}}getImageEl(t){const e=document.createElementNS("http://www.w3.org/2000/svg","image");return e.setAttribute("width",this.rawWidth+""),e.setAttribute("height",this.rawHeight+""),e.setAttribute("fill","none"),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("crossorigin","anonymous"),e.setAttributeNS("http://www.w3.org/1999/xlink","href",this.context.configStore.imageStore.getImageUrl(t)),e}}var cn=n(13);class dn{constructor(t){this.observers=new Map,this.variableValuesChangedSubscriptions=new Array,this.variableStatesChangedSubscription=new Array,this.alarmSubscription=new Array,this._rawVariableCommunicator=t}openVariable(t,e){return this.openVariables([t],e).pipe(Object(it.map)(t=>t[0]))}openVariables(t,e=""){return new cn.a(n=>{Object(nt.each)(t,t=>{this.observers.has(t)||this.observers.set(t,[]),this.observers.get(t).push(n)});const i=this._rawVariableCommunicator.openVariables(t,e).subscribe(t=>n.next(t),t=>n.error(t),()=>n.complete());this.variableValuesChangedSubscriptions.push(i)})}write(t,e){return this._rawVariableCommunicator.write(t,e)}writeWordByBit(t,e,n){return this._rawVariableCommunicator.writeWordByBit(t,e,n)}subscribeVariableState(t){return this.subscribeVariableStates([t]).pipe(Object(it.map)(t=>t[0]))}subscribeVariableStates(t){return new cn.a(e=>{const n=this._rawVariableCommunicator.subscribeVariableStates(t).subscribe(t=>e.next(t),t=>e.error(t),()=>e.complete());this.variableStatesChangedSubscription.push(n)})}subscribeUserDeviceAlarms(t=""){return new cn.a(e=>{const n=this._rawVariableCommunicator.subscribeUserDeviceAlarms(t).subscribe(t=>e.next(t),t=>e.error(t),()=>e.complete());this.alarmSubscription.push(n)})}dispose(){Object(nt.forEach)(this.variableValuesChangedSubscriptions,t=>t.unsubscribe()),Object(nt.forEach)(this.variableStatesChangedSubscription,t=>t.unsubscribe()),Object(nt.forEach)(this.alarmSubscription,t=>t.unsubscribe())}}n.d(e,"a",function(){return hn});class hn{constructor(t,e,n,r){this.injector=t,this.bsModalService=e,this.context=n,this.parentView=r,this.viewId=rn.a.newGuid().toString("n"),this.logger=t.get(i.b),this.childViews=new Array,r&&r.childViews.push(this),this.isMobileMode=ee.a.Mobile===t.get(ee.b).displayMode,this.signalRAppId=rn.a.newGuid().toString("n")}get element(){return this.mainElement.rootElement}get rawWidth(){return this.mainElement.rawWidth}get rawHeight(){return this.mainElement.rawHeight}resize(t,e,n){if(t){if(!t.isReal())throw new Error("invalid size.");switch(e){case ee.c.HorizontalUniform:this.mainElement.horizontalStretch(t);break;default:this.mainElement.uniformStretch(t,n)}}}load(t,e){const{context:n}=this;this.svgRootClass=e.svgRootClass,this.perViewVariableCommunicator=new dn(n.variableCommunicator),this.mainElement=new un(this.injector,this.bsModalService,n,this.perViewVariableCommunicator,this,this.signalRAppId),this.mainElement.load(t.config,!!this.parentView,e),setTimeout(()=>{this.loadElementState()},0),this.logger.debug("[GUI] View loaded.")}loadElementState(){this.mainElement&&(this.mainElement.initElementState(),this.openVariableStatesSubscription&&this.openVariableStatesSubscription.unsubscribe(),this.openVariableStatesSubscription&&this.openVariableStatesSubscription.unsubscribe(),this.openedVariableNames=this.mainElement.getVariableNames(),0!==this.openedVariableNames.length&&(this.openVariableStatesSubscription=this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe(t=>{this.mainElement.reportVariableStates(t);const e=[];Object(nt.each)(t,t=>{t.state===rt.d.Normal&&-1===e.indexOf(t.variableName)&&e.push(t.variableName)}),e.length>0&&this.normalOpenedVariableNames(e)})))}popView(t,e,n){return this.context.configStore.viewStore.getViewConfig(t).pipe(Object(it.map)(t=>{if(!t.config||!t.config.length)throw new lt.a;const i=new hn(this.injector,this.bsModalService,this.context,this),r={svgRootClass:this.svgRootClass,hostContainerId:e,el:n};i.load(t,r);const a=$(i.element).data("model");if(!a.popup)return;let o,s;switch(a.popup.locationType===ot.ViewPopupLocationType.Custom&&a.popup.location?(o=a.popup.location.x,s=a.popup.location.y):(o=(this.rawWidth-i.rawWidth)/2,s=(this.rawHeight-i.rawHeight)/2),a.popup.backdropType){case ot.ViewPopupBackdropType.Shadow:this.isMobileMode||i.showShadow();break;case ot.ViewPopupBackdropType.Musk:this.showMusk()}i.element.setAttribute("x",String(o)),i.element.setAttribute("y",String(s)),this.element.appendChild(i.element)}))}closeView(){this.parentView&&(this.parentView.hideMusk(),this.dispose(),this.element.parentElement.removeChild(this.element))}moveView(t,e){const n=Number(this.element.getAttribute("x"))+t,i=Number(this.element.getAttribute("y"))+e;this.element.setAttributeNS(null,"x",String(n)),this.element.setAttributeNS(null,"y",String(i))}showMusk(){this.muskElement||(this.muskElement=document.createElementNS("http://www.w3.org/2000/svg","rect"),this.muskElement.setAttribute("width",String(this.rawWidth)),this.muskElement.setAttribute("height",String(this.rawHeight)),this.muskElement.setAttribute("fill","#081625"),this.muskElement.setAttribute("fill-opacity","0.4")),this.element.appendChild(this.muskElement)}showShadow(){const t=`dropshadow-${this.viewId}`,e=G(this.element).append("defs").append("filter").attr("id",t).attr("x",0).attr("y",0).attr("color-interpolation-filters","sRGB").attr("filterUnits","userSpaceOnUse");e.append("feDropShadow").attr("stdDeviation","6").attr("flood-color","rgba(69,65,78,.3)"),e.append("feOffset").attr("dx",0).attr("dy",0).attr("result","shadow"),e.append("feComposite").attr("in","SourceGraphic").attr("in2","shadow").attr("operator","over");const n=this.element.children[0];n&&(n.setAttribute("filter",`url(#${t})`),n.setAttribute("x","6"),n.setAttribute("y","6"),$(this.element).children("g").attr("transform","matrix(1, 0, 0, 1, 6, 6)"))}hideMusk(){this.muskElement&&(this.element.removeChild(this.muskElement),this.muskElement=null)}dispose(){this.openVariableStatesSubscription&&this.openVariableStatesSubscription.unsubscribe(),this.openVariablesSubscription&&this.openVariablesSubscription.unsubscribe(),this.perViewVariableCommunicator&&this.perViewVariableCommunicator.dispose(),this.childViews&&this.childViews.length&&Object(nt.forEach)(this.childViews,t=>t.dispose()),this.mainElement&&this.mainElement.dispose(),this.logger.debug("[GUI] View disposed.")}normalOpenedVariableNames(t){t.length>0&&(this.openVariablesSubscription=this.perViewVariableCommunicator.openVariables(t,this.signalRAppId).subscribe(t=>this.mainElement.reportVariableValues(t)))}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});class i{constructor(t,e){this.num=t||0,this.bits=e||0}decimalToBinary(t,e){const n=[],i=[];let r=0;for(;t>0;)n.push(t%2),t=parseInt((t/2).toString()),r++;for(let t=r-1;t>=0;t--)i.push(n[t]);if(e<i.length&&console.log("控制位小于转换位数"),e)for(let t=i.length;t<e;t++)i.unshift("0");return i.join().replace(/,/g,"")}convertToBinary(){const t=Number(this.num);return this.decimalToBinary(Math.abs(t),this.bits)}}},function(t,e,n){"use strict";var i;n.d(e,"a",function(){return i}),function(t){t[t.Bit=0]="Bit",t[t.Word=1]="Word"}(i||(i={}))},function(t,e,n){"use strict";function i(t){setTimeout(function(){throw t},0)}n.d(e,"a",function(){return i})},function(t,e,n){"use strict";var i=n(0),r=n(2),a=n(9),o=n(14),s=n(7),l=n(5),u=n(26),c=n(31),d=n(16);var h=n(27);n.d(e,"a",function(){return p});var f=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o},m=function(t,e){return function(n,i){e(n,i,t)}};let p=class{constructor(t,e,n,r){this.el=t,this.localization=e,this.injector=n,this.bsModalService=r,this.loadFailed=new i.EventEmitter,this.loaded=new i.EventEmitter,this.lastScale=1,this.isMobileMode=!1,this.globalSettings=this.injector.get(o.b),this.viewService=n.get(u.a)}get viewResizeMode(){switch(this.resizeMode){case"HorizontalUniform":return o.c.HorizontalUniform;default:return o.c.Uniform}}ngOnChanges(t){t.displayMode&&this.onDisplayModeChanged(t.displayMode.previousValue,t.displayMode.currentValue),t.context&&this.onProviderChanged(t.context.previousValue,t.context.currentValue),t.size&&this.onSizeChanged(t.size.previousValue,t.size.currentValue),t.resizeMode&&this.onResizeModeChanged(t.resizeMode.previousValue,t.resizeMode.currentValue)}doubleFingerZooming(){const t=this.$svg.find("div.svg-content").first()[0],e=this;e.initWidth=t.offsetWidth,e.initHeight=t.offsetHeight,e.lastScale=1,t.addEventListener("touchstart",function(n){e.pageX=n.targetTouches[0].pageX,e.pageY=n.targetTouches[0].pageY,e.initX=Object(r.isNaN)(parseInt(t.style.left,10))?0:parseInt(t.style.left,10),e.initY=Object(r.isNaN)(parseInt(t.style.top,10))?0:parseInt(t.style.top,10),n.touches.length>=2&&(e.startTouch=n.touches),e.isTouch=!0},!1),t.addEventListener("touchmove",function(n){if(1===n.touches.length&&e.isTouch&&e.lastScale>1){n.preventDefault();const i=n.targetTouches[0].pageX,r=n.targetTouches[0].pageY,a=Number(i)-Number(e.pageX)+Number(e.initX),o=Number(r)-Number(e.pageY)+Number(e.initY);a>-(e.lastScale-1)*e.initWidth/2&&a<(e.lastScale-1)*e.initWidth/2&&(t.style.left=a+"px"),o>-(e.lastScale-1)*e.initHeight/2&&o<(e.lastScale-1)*e.initHeight/2&&(t.style.top=o+"px")}if(n.touches.length>=2&&e.isTouch){n.preventDefault();const i=n.touches,r=e.getDistance(i[0],i[1])/e.getDistance(e.startTouch[0],e.startTouch[1]);let a=e.lastScale;r>=1&&(a*=1.008),a<1&&(a=1),a>5&&(a=5),r<1&&(a*=.992,t.style.left=-(a-1)*e.initWidth/8+"px",t.style.top=-(a-1)*e.initHeight/8+"px"),t.style.transform="scale("+a+")",e.lastScale=a}},!1),t.addEventListener("touchend",function(){e.isTouch&&(e.isTouch=!1)},!1)}getDistance(t,e){const n=e.pageX-t.pageX,i=e.pageY-t.pageY;return Math.sqrt(n*n+i*i)}ngOnDestroy(){this.host&&this.host.dispose()}onProviderChanged(t,e){if(!Object(r.isEqual)(t,e))if(this.host&&(this.host.dispose(),this.host=null),e){this.$svg=$(this.el.nativeElement).find("div.svgView").first(),this.$svg.empty();const t="S"+h.a.newGuid().toString("n");this.hostContainerId="H"+h.a.newGuid().toString("n"),this.$svg.addClass(t);const n={svgRootClass:t,hostContainerId:this.hostContainerId,el:this.el},i=new class{constructor(t,e,n,i,r){this.injector=t,this.bsModalService=e,this.context=n,this.guiOptions=i,this.el=r,this.logger=t.get(s.b),t.get(u.a).toggleViews.set(r,(t,e,n)=>(this.currentViewIndex=t,this.context.configStore.viewStore.getViewConfig(t).pipe(Object(d.map)(i=>{if(this.currentViewIndex!==t)return;if(!i||!i.config||!i.config.length)throw new l.a;this.currentView&&this.currentView.dispose(),this.currentView=new c.a(this.injector,this.bsModalService,this.context);const r={svgRootClass:this.guiOptions.svgRootClass,hostContainerId:e,el:n};this.currentView.load(i,r),this.currentView.resize(this.currentViewSize,this.currentViewReiszeMode,this.guiOptions.svgRootClass),this.containerEl=$(n.nativeElement).find(`div#${e}`).first(),this.containerEl.empty(),this.containerEl.append(this.currentView.element),this.logger.debug(`[GUI] Toggle View(${t}) successed.`)}))))}get element(){if(this.containerEl)return this.containerEl[0];throw new Error("Gui Host not loaded yet.")}load(t){if(this.isLoaded)throw new Error("The GuiHost already loaded.");return this.isLoaded=!0,this.containerEl=$(`<div class="svg-content" id= "${this.guiOptions.hostContainerId}" style="display:flex;position:relative;"></div>`),new Promise((e,n)=>{t&&0!==t?this.loadViewConfigByConfigureViewId(e,n,t):this.loadMainViewConfig(e,n)})}loadByConfigureViewCode(t){if(this.isLoaded)throw new Error("The GuiHost already loaded.");return this.isLoaded=!0,this.containerEl=$(`<div class="svg-content" id= "${this.guiOptions.hostContainerId}" style="display: inline-block;position: relative;"></div>`),new Promise((e,n)=>{t?this.loadViewConfigByConfigureViewCode(e,n,t):this.loadMainViewConfig(e,n)})}loadMainViewConfig(t,e){this.context.configStore.viewStore.getMainViewConfig().subscribe(n=>{n.config&&n.config.length?(this.currentView=new c.a(this.injector,this.bsModalService,this.context),this.currentView.load(n,this.guiOptions),this.containerEl.empty(),this.containerEl.append(this.currentView.element),t(this),this.logger.debug("[GUI] Host loaded.")):e(new l.a)},t=>{this.logger.error("[GUI] Load failed: "+t.stack),e(t)})}loadViewConfigByConfigureViewId(t,e,n){this.context.configStore.viewStore.getViewConfigByConfigureViewId(n).subscribe(n=>{this.handleViewConfigCallback(t,e,n)},t=>{this.logger.error("[GUI] Load failed: "+t.stack),e(t)})}loadViewConfigByConfigureViewCode(t,e,n){this.context.configStore.viewStore.getViewConfigByConfigureViewCode(n).subscribe(n=>{this.handleViewConfigCallback(t,e,n)},t=>{this.logger.error("[GUI] Load failed: "+t.stack),e(t)})}handleViewConfigCallback(t,e,n){n.config&&n.config.length||e(new l.a),this.currentView=new c.a(this.injector,this.bsModalService,this.context),this.currentView.load(n,this.guiOptions),this.containerEl.empty(),this.containerEl.append(this.currentView.element),t(this),this.logger.debug("[GUI] Host loaded.")}resizeView(t,e){this.currentView&&(this.currentView.resize(t,e,this.guiOptions.svgRootClass),this.currentViewSize=t,this.currentViewReiszeMode=e)}updateViewSize(t){this.currentView&&(this.currentView.resize(t,this.currentViewReiszeMode,this.guiOptions.svgRootClass),this.currentViewSize=t)}updateViewResizeMode(t){this.currentView&&(this.currentView.resize(this.currentViewSize,t,this.guiOptions.svgRootClass),this.currentViewReiszeMode=t)}dispose(){this.currentView&&this.currentView.dispose(),this.context&&this.context.dispose(),this.logger.debug("[GUI] GuiHost disposed.")}}(this.injector,this.bsModalService,e,n,this.el);(this.context.configureViewCode?i.loadByConfigureViewCode(this.context.configureViewCode):i.load(this.context.configureViewId)).then(t=>{Object(r.isEqual)(this.context,t.context)?(this.host=i,this.host.resizeView(this.size,this.viewResizeMode),this.$svg.append(t.element),this.isMobileMode&&this.doubleFingerZooming(),this.loaded.emit()):t.dispose()}).catch(t=>{this.$svg.append(`<p>${this.localization.loadFailed}</p>`),this.loadFailed.emit(t)})}else this.$svg&&this.$svg.empty(),this.host=null}onSizeChanged(t,e){this.host&&!Object(r.isEqual)(t,e)&&(this.host.updateViewSize(e),this.isMobileMode&&this.doubleFingerZooming())}onResizeModeChanged(t,e){this.host&&!Object(r.isEqual)(t,e)&&this.host.updateViewResizeMode(this.viewResizeMode)}onDisplayModeChanged(t,e){Object(r.isEqual)(t,e)||(this.isMobileMode="Mobile"===this.displayMode,this.globalSettings.displayMode=this.isMobileMode?o.a.Mobile:o.a.Web)}refreshCurrentPage(){if(void 0===this.host.currentViewIndex)return!1;const t=this.viewService.toggleViews.get(this.el);return!!t&&(t(this.host.currentViewIndex,this.hostContainerId,this.el).subscribe(),!0)}};f([Object(i.Input)()],p.prototype,"context",void 0),f([Object(i.Input)()],p.prototype,"size",void 0),f([Object(i.Input)()],p.prototype,"resizeMode",void 0),f([Object(i.Input)()],p.prototype,"displayMode",void 0),f([Object(i.Output)()],p.prototype,"loadFailed",void 0),f([Object(i.Output)()],p.prototype,"loaded",void 0),p=f([Object(i.Component)({selector:"fc-gui",template:"<div> <div class='svgView' style=\"position: relative;display: flex;justify-content: center;align-items: center;\"></div> </div> "}),m(1,Object(i.Inject)(a.b))],p)},function(t,e,n){"use strict";n.d(e,"a",function(){return l});var i=n(0),r=n(9),a=n(2),o=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o},s=function(t,e){return function(n,i){e(n,i,t)}};let l=class{constructor(t,e,n,i,r){this.localization=t,this.dataTypeService=e,this.fractionDigitService=n,this.numericalOperationService=i,this.bsModalRef=r,this.writeValueRangeText="",this.isSubmitting=!1}get invalidErrorText(){return this.localization.loadFailed}ngOnInit(){this.initData(this.args),this.validate()}initData(t){this.variableName=t.variableName,this.dataType=t.dataType,this.fBoxDataType=t.fBoxDataType,this.integerDigits=t.integerDigits?t.integerDigits:0,this.fractionDigits=t.fractionDigits?t.fractionDigits:0,this.valueType=this.dataTypeService.getValueType(t.version,t.dataType),this.pattern=this.dataTypeService.getValuePattern(t.version,t.dataType),this.numericalOperation=t.numericalOperation,this.enableNumericalOperation=!!this.numericalOperation.enableNumericalOperation&&this.numericalOperation.enableNumericalOperation,this.value="",this.args.enableDataParsed?this.setValueRangeAccordToDataParsed(t):(this.writeMaxValue=this.dataTypeService.getMaxValue(t.version,this.dataType,this.fBoxDataType),this.writeMinValue=this.dataTypeService.getMinValue(t.version,this.dataType,this.fBoxDataType)),this.writeValueRangeText=this.getWriteValueRangeText()}setValueRangeAccordToDataParsed(t){this.dataTypeService.isFloat(t.version,this.dataType)||this.enableNumericalOperation?(this.maxValueLimit=this.dataTypeService.getMaxValue(t.version,this.dataType,this.fBoxDataType),this.minValueLimit=this.dataTypeService.getMinValue(t.version,this.dataType,this.fBoxDataType),this.numericalLowerLimit=this.numericalOperation.numericalLowerLimit,this.numericalUpperLimit=this.numericalOperation.numericalUpperLimit):(this.maxValueLimit=+this.fractionDigitService.movePoint(this.dataTypeService.getMaxValue(t.version,this.dataType,this.fBoxDataType),-this.fractionDigits),this.minValueLimit=+this.fractionDigitService.movePoint(this.dataTypeService.getMinValue(t.version,this.dataType,this.fBoxDataType),-this.fractionDigits),this.numericalLowerLimit=+this.fractionDigitService.movePoint(this.numericalOperation.numericalLowerLimit,-this.fractionDigits),this.numericalUpperLimit=+this.fractionDigitService.movePoint(this.numericalOperation.numericalUpperLimit,-this.fractionDigits));const e=this.numericalOperationService.getWriteMinValue(this.minValueLimit,this.numericalOperation),n=this.numericalOperationService.getWriteMaxValue(this.maxValueLimit,this.numericalOperation),i=this.numericalOperationService.getWriteMinValue(this.numericalLowerLimit,this.numericalOperation),r=this.numericalOperationService.getWriteMaxValue(this.numericalUpperLimit,this.numericalOperation),a=e<n?e:n,o=e<n?n:e,s=i<r?i:r,l=i<r?r:i;this.writeMinValue=a>s?a:s,this.writeMaxValue=o<l?o:l}getWriteValueRangeText(){let t="",e="";return this.dataTypeService.isHexOrBinaryType(this.args.version,this.dataType)?(t=this.writeMinValue.toString(16),e=this.writeMaxValue.toString(16)):this.args.enableDataParsed&&this.fractionDigits>0?(t=this.writeMinValue.toFixed(this.fractionDigits).toString(),e=this.writeMaxValue.toFixed(this.fractionDigits).toString()):(t=this.writeMinValue.toString(),e=this.writeMaxValue.toString()),t+"~"+e}save(){this.isSubmitting=!0;let t=this.value;const e=this.value;this.args.enableDataParsed&&(t=this.enableNumericalOperation?this.numericalOperationService.getWriteValue(this.args.version,this.value,this.numericalOperation,this.dataType,this.fractionDigits):this.formatWriteValue()),this.args.releasedVariableService.getVariableWithValueTransform(this.variableName).subscribe(n=>{0!==JSON.parse(n.valueTransform).Type&&(this.isNumericalOperation=!0),this.onClosed({value:t,showValue:e,enableNumericalOperation:this.enableNumericalOperation,isNumericalOperation:this.isNumericalOperation,variableRwType:n.variableRwType})})}close(){this.bsModalRef.hide()}validate(t=null){if(t&&13===t.keyCode&&!this.validationError)return void this.save();if(null==this.value||""===this.value.trim())return this.showValidationErrorInfo(this.localization.numericalValueRequired);if(!new RegExp(this.pattern).test(this.value))return this.showValidationErrorInfo(this.localization.invalidNumericalValue);if(!this.enableNumericalOperation&&this.dataTypeService.isSupportFractionDigit(this.args.version,this.dataType)&&this.getFractionDigits(this.value)>this.fractionDigits)return this.showValidationErrorInfo(`${this.localization.fractionDigitsMustLessThan}${this.fractionDigits}`);if((Object(a.isNil)(this.args.version)||!Object(a.isNil)(this.args.version)&&this.args.version<5)&&!this.enableNumericalOperation&&!this.dataTypeService.isSignedType(this.args.version,this.dataType)&&this.value.startsWith("-"))return this.showValidationErrorInfo(this.localization.canNotBeNegative);if(this.dataTypeService.isBinaryType(this.args.version,this.dataType)||this.dataTypeService.isHexType(this.args.version,this.dataType)){const t=this.dataTypeService.getValueMaxLength(this.args.version,this.dataType,this.fBoxDataType),e=this.integerDigits?Math.min(this.integerDigits,t):t;if(this.value.length>e)return this.showValidationErrorInfo(this.localization.numericalValueTooLong)}let e;if(e=this.dataTypeService.isHexOrBinaryType(this.args.version,this.dataType)?this.dataTypeService.formatToDecimal(this.args.version,this.value,this.dataType):Number(this.value),Number(e)>this.writeMaxValue||Number(e)<this.writeMinValue)return this.showValidationErrorInfo(this.localization.valueOutOfRange);this.hideValidationErrorInfo()}showValidationErrorInfo(t){this.validationError=!0,this.validationErrorText=t}hideValidationErrorInfo(){this.validationError=!1,this.validationErrorText=""}getFractionDigits(t){return t&&t.indexOf(".")>0?t.split(".")[1].length:0}formatWriteValue(){return this.dataTypeService.isSupportFractionDigit(this.args.version,this.dataType)&&!this.dataTypeService.isFloat(this.args.version,this.dataType)&&this.fractionDigits?this.fractionDigitService.movePoint(this.value,this.fractionDigits):(this.dataTypeService.isSupportNumericalOperation(this.args.version,this.dataType)&&(this.value=Number(this.value).toString()),this.value)}};o([Object(i.Output)()],l.prototype,"invalidErrorText",null),l=o([Object(i.Component)({selector:"writeValueModal",template:'<form #writeValueForm="ngForm" novalidate (ngSubmit)="save()" bs-modal-drag> <div class="modal-header"> <h4 class="modal-title"> <span>{{localization.setting}}</span> <span>{{variableName}}</span> </h4> <button type="button" class="close pull-right" aria-label="Close" (click)="close()"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <span class="write-value-range">{{localization.writeValueRange}}:</span> <div class="write-value-range"> {{writeValueRangeText}} <span *ngIf="valueType">({{valueType}})</span> </div> <input type="text" name="valueInput" autoFocus class="form-control write-value" [(ngModel)]="value" (keyup)="validate($event)" autocomplete="off"> <span class="help-block text-danger" [hidden]="!validationError">{{validationErrorText}}</span> </div> <div class="modal-footer"> <button type="submit" class="btn md-skip btn-primary btn-block" [disabled]="validationError || isSubmitting"> <ng-container *ngIf="!isSubmitting">{{localization.submit}}</ng-container> <ng-container *ngIf="isSubmitting">{{localization.submitting}}</ng-container> </button> </div> </form> ',styles:[".modal-header { padding: 10px; border-color: transparent; } .modal-body { position: relative; padding: 0px 5px !important; padding-top: 10px !important; } .modal-title { display: unset; margin-left: -6px; font-size: 16px !important; } .form-control { margin: 0 5%; float: none; width: 90%; } .modal-footer { padding: 10px 4px 20px 5px !important; text-align: right; border-color: transparent; } .text-danger { display: block; color: #ed6b75; font-size: 14px; margin: 5px 0px 0px 15px; } .btn-primary { background-color: #3B97FC; border-color: #3B97FC; padding: 5px 30px; width: 90%; margin: 0 5%; height: 32px; } .write-value-range { color: #7f939e; font-size: 14px; margin-left: 15px; } .write-value { padding-left: 8px; margin-left: 16px; height: 32px; } "]}),s(0,Object(i.Inject)(r.b))],l)},function(t,e,n){"use strict";n.d(e,"a",function(){return l});var i=n(0),r=n(39),a=n(9),o=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o},s=function(t,e){return function(n,i){e(n,i,t)}};let l=class{constructor(t){this.localization=t,this._onClosed=new r.a}get onClosed(){return this._onClosed}get invalidErrorText(){return this.localization.loadFailed}ngOnInit(){this.variableName=this.args.variableName,this.isPassword=!!this.args.isPassword&&this.args.isPassword,this.charCount=this.args.charCount,this.value="",this.validate()}validate(){return null==this.value||""===this.value.trim()?this.showValidationErrorInfo(this.localization.characterInputRequired):this.value.length>this.charCount?this.showValidationErrorInfo(this.localization.characterOutofRange):void this.hideValidationErrorInfo()}showValidationErrorInfo(t){this.validationError=!0,this.validationErrorText=t}hideValidationErrorInfo(){this.validationError=!1,this.validationErrorText=""}save(){this.close({value:this.value})}close(t){this._onClosed.next(t),this._onClosed.complete()}};o([Object(i.Output)()],l.prototype,"invalidErrorText",null),l=o([Object(i.Component)({selector:"writeCharacterModal",template:'<form #writeValueForm="ngForm" novalidate (ngSubmit)="save()" bs-modal-drag> <div class="modal-header"> <h4 class="modal-title"> <span>{{localization.setting}}</span> <span>{{variableName}}</span> </h4> <button type="button" class="close pull-right" aria-label="Close" (click)="close()"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <input type="text" name="characterInput" autoFocus class="form-control write-character-value" [(ngModel)]="value" (keyup)="validate()" *ngIf="!isPassword" autocomplete="off"> <input type="password" name="passwordInput" autoFocus class="form-control write-character-value" [(ngModel)]="value" (keyup)="validate()" *ngIf="isPassword" autocomplete="off"> <span class="help-block text-danger" [hidden]="!validationError">{{validationErrorText}}</span> </div> <div class="modal-footer"> <button type="submit" class="btn md-skip btn-primary btn-block" [disabled]="validationError">{{localization.submit}}</button> </div> </form> ',styles:[".modal-header { padding: 10px; border-color: transparent; } .modal-body { position: relative; padding: 0px 5px !important; } .modal-title { display: unset; margin-left: -6px; font-size: 16px !important; } .form-control { margin: 0 5%; float: none; width: 90%; } .modal-footer { padding: 10px 4px 20px 5px !important; text-align: right; border-color: transparent; } .text-danger { display: block; color: #ed6b75; font-size: 14px; margin: 10px 0px 0px 15px; } .btn-primary { background-color: #3B97FC; border-color: #3B97FC; padding: 5px 30px; width: 90%; margin: 0 5%; height: 32px; } .write-character-value { padding-left: 8px; height: 32px; margin-left: 16px; } "]}),s(0,Object(i.Inject)(a.b))],l)},function(t,e,n){!function(){var i={dev:!1};i.tooltip=i.tooltip||{},i.utils=i.utils||{},i.models=i.models||{},i.charts={},i.logs={},i.dom={},void 0!==t&&void 0!==e&&"undefined"==typeof d3&&(d3=n(25)),i.dispatch=d3.dispatch("render_start","render_end"),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),n=this,i=function(){},r=function(){return n.apply(this instanceof i&&t?this:t,e.concat(Array.prototype.slice.call(arguments)))};return i.prototype=this.prototype,r.prototype=new i,r}),i.dev&&(i.dispatch.on("render_start",function(t){i.logs.startTime=+new Date}),i.dispatch.on("render_end",function(t){i.logs.endTime=+new Date,i.logs.totalTime=i.logs.endTime-i.logs.startTime,i.log("total",i.logs.totalTime)})),i.log=function(){if(i.dev&&window.console&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(i.dev&&window.console&&"function"==typeof console.log&&Function.prototype.bind){Function.prototype.bind.call(console.log,console).apply(console,arguments)}return arguments[arguments.length-1]},i.deprecated=function(t,e){console&&console.warn&&console.warn("nvd3 warning: `"+t+"` has been deprecated. ",e||"")},i.render=function(t){t=t||1,i.render.active=!0,i.dispatch.render_start();var e=function(){for(var n,r,a=0;a<t&&(r=i.render.queue[a]);a++)n=r.generate(),typeof r.callback==typeof Function&&r.callback(n);i.render.queue.splice(0,a),i.render.queue.length?setTimeout(e):(i.dispatch.render_end(),i.render.active=!1)};setTimeout(e)},i.render.active=!1,i.render.queue=[],i.addGraph=function(t){typeof arguments[0]==typeof Function&&(t={generate:arguments[0],callback:arguments[1]}),i.render.queue.push(t),i.render.active||i.render()},t.exports=i,"undefined"!=typeof window&&(window.nv=i),i.dom.write=function(t){return void 0!==window.fastdom?fastdom.mutate(t):t()},i.dom.read=function(t){return void 0!==window.fastdom?fastdom.measure(t):t()},i.interactiveGuideline=function(){"use strict";var t={left:0,top:0},e=null,n=null,r=d3.scale.linear(),a=d3.dispatch("elementMousemove","elementMouseout","elementClick","elementDblclick","elementMouseDown","elementMouseUp"),o=!0,s=null,l=i.models.tooltip(),u=window.ActiveXObject;function c(d){d.each(function(d){var h=d3.select(this),f=e||960,m=n||400,p=h.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([d]);function g(){var e=d3.event.clientX-this.getBoundingClientRect().left,n=d3.event.clientY-this.getBoundingClientRect().top,i=!0,o=!1;if(u&&(e=d3.event.offsetX,n=d3.event.offsetY,"svg"!==d3.event.target.tagName&&(i=!1),d3.event.target.className.baseVal.match("nv-legend")&&(o=!0)),i&&(e-=t.left,n-=t.top),"mouseout"===d3.event.type||e<0||n<0||e>f||n>m||d3.event.relatedTarget&&void 0===d3.event.relatedTarget.ownerSVGElement||o){if(u&&d3.event.relatedTarget&&void 0===d3.event.relatedTarget.ownerSVGElement&&(void 0===d3.event.relatedTarget.className||d3.event.relatedTarget.className.match(l.nvPointerEventsClass)))return;return a.elementMouseout({mouseX:e,mouseY:n}),c.renderGuideLine(null),void l.hidden(!0)}l.hidden(!1);var s=void 0;if("function"==typeof r.rangeBands){var d=d3.bisect(r.range(),e)-1;if(!(r.range()[d]+r.rangeBand()>=e))return a.elementMouseout({mouseX:e,mouseY:n}),c.renderGuideLine(null),void l.hidden(!0);s=r.domain()[d3.bisect(r.range(),e)-1]}else s=r.invert(e);a.elementMousemove({mouseX:e,mouseY:n,pointXValue:s}),"dblclick"===d3.event.type&&a.elementDblclick({mouseX:e,mouseY:n,pointXValue:s}),"click"===d3.event.type&&a.elementClick({mouseX:e,mouseY:n,pointXValue:s}),"mousedown"===d3.event.type&&a.elementMouseDown({mouseX:e,mouseY:n,pointXValue:s}),"mouseup"===d3.event.type&&a.elementMouseUp({mouseX:e,mouseY:n,pointXValue:s})}p.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer").append("g").attr("class","nv-interactiveGuideLine"),s&&(s.on("touchmove",g).on("mousemove",g,!0).on("mouseout",g,!0).on("mousedown",g,!0).on("mouseup",g,!0).on("dblclick",g).on("click",g),c.guideLine=null,c.renderGuideLine=function(t){o&&(c.guideLine&&c.guideLine.attr("x1")===t||i.dom.write(function(){var e=p.select(".nv-interactiveGuideLine").selectAll("line").data(null!=t?[i.utils.NaNtoZero(t)]:[],String);e.enter().append("line").attr("class","nv-guideline").attr("x1",function(t){return t}).attr("x2",function(t){return t}).attr("y1",m).attr("y2",0),e.exit().remove()}))})})}return l.duration(0).hideDelay(0).hidden(!1),c.dispatch=a,c.tooltip=l,c.margin=function(e){return arguments.length?(t.top=void 0!==e.top?e.top:t.top,t.left=void 0!==e.left?e.left:t.left,c):t},c.width=function(t){return arguments.length?(e=t,c):e},c.height=function(t){return arguments.length?(n=t,c):n},c.xScale=function(t){return arguments.length?(r=t,c):r},c.showGuideLine=function(t){return arguments.length?(o=t,c):o},c.svgContainer=function(t){return arguments.length?(s=t,c):s},c},i.interactiveBisect=function(t,e,n){"use strict";if(!(t instanceof Array))return null;var i;i="function"!=typeof n?function(t){return t.x}:n;var r=d3.bisector(function(t,e){return i(t)-e}).left,a=d3.max([0,r(t,e)-1]),o=i(t[a]);if(void 0===o&&(o=a),o===e)return a;var s=d3.min([a+1,t.length-1]),l=i(t[s]);return void 0===l&&(l=s),Math.abs(l-e)>=Math.abs(o-e)?a:s},i.nearestValueIndex=function(t,e,n){"use strict";var i=1/0,r=null;return t.forEach(function(t,a){var o=Math.abs(e-t);null!=t&&o<=i&&o<n&&(i=o,r=a)}),r},i.models.tooltip=function(){"use strict";var t="nvtooltip-"+Math.floor(1e5*Math.random()),e=null,n="w",r=25,a=0,o=null,s=!0,l=200,u=null,c={left:null,top:null},d=!0,h=100,f=!0,m="nv-pointer-events-none",p=function(t,e,n){return t},g=function(t){return t},v=function(t,e){return t},_=function(t,e){if(null===t)return"";var n=d3.select(document.createElement("table"));f&&n.selectAll("thead").data([t]).enter().append("thead").append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",!0).html(g(t.value));var i=n.selectAll("tbody").data([t]).enter().append("tbody").selectAll("tr").data(function(t){return t.series}).enter().append("tr").classed("highlight",function(t){return t.highlight});i.append("td").classed("legend-color-guide",!0).append("div").style("background-color",function(t){return t.color}),i.append("td").classed("key",!0).classed("total",function(t){return!!t.total}).html(function(t,e){return v(t.key,e)}),i.append("td").classed("value",!0).html(function(t,e){return p(t.value,e,t)}),i.filter(function(t,e){return void 0!==t.percent}).append("td").classed("percent",!0).html(function(t,e){return"("+d3.format("%")(t.percent)+")"}),i.selectAll("td").each(function(t){if(t.highlight){var e=d3.scale.linear().domain([0,1]).range(["#fff",t.color]);d3.select(this).style("border-bottom-color",e(.6)).style("border-top-color",e(.6))}});var r=n.node().outerHTML;return void 0!==t.footer&&(r+="<div class='footer'>"+t.footer+"</div>"),r},y=function(){var t={left:null!==d3.event?d3.event.clientX:0,top:null!==d3.event?d3.event.clientY:0};if("none"!=getComputedStyle(document.body).transform){var e=document.body.getBoundingClientRect();t.left-=e.left,t.top-=e.top}return t},b=function(t){if(t&&t.series){if(i.utils.isArray(t.series))return!0;if(i.utils.isObject(t.series))return t.series=[t.series],!0}return!1},M=function(){i.dom.read(function(){var t=y(),e=function(t){var e,i,a,o=u.node().offsetHeight,s=u.node().offsetWidth,l=document.documentElement.clientWidth,c=document.documentElement.clientHeight;switch(n){case"e":e=-s-r,i=-o/2,t.left+e<0&&(e=r),(a=t.top+i)<0&&(i-=a),(a=t.top+i+o)>c&&(i-=a-c);break;case"w":e=r,i=-o/2,t.left+e+s>l&&(e=-s-r),(a=t.top+i)<0&&(i-=a),(a=t.top+i+o)>c&&(i-=a-c);break;case"n":e=-s/2-5,i=r,t.top+i+o>c&&(i=-o-r),(a=t.left+e)<0&&(e-=a),(a=t.left+e+s)>l&&(e-=a-l);break;case"s":e=-s/2,i=-o-r,t.top+i<0&&(i=r),(a=t.left+e)<0&&(e-=a),(a=t.left+e+s)>l&&(e-=a-l);break;case"center":e=-s/2,i=-o/2;break;default:e=0,i=0}return{left:e,top:i}}(t),i=t.left+e.left,a=t.top+e.top;if(s)u.interrupt().transition().delay(l).duration(0).style("opacity",0);else{var o="translate("+c.left+"px, "+c.top+"px)",d="translate("+Math.round(i)+"px, "+Math.round(a)+"px)",f=d3.interpolateString(o,d),m=u.style("opacity")<.1;u.interrupt().transition().duration(m?0:h).styleTween("transform",function(t){return f},"important").styleTween("-webkit-transform",function(t){return f}).style("-ms-transform",d).style("opacity",1)}c.left=i,c.top=a})};function x(){if(d&&b(e))return i.dom.write(function(){u&&u.node()||((u=d3.select(document.body).selectAll("#"+t).data([1])).enter().append("div").attr("class","nvtooltip "+(o||"xy-tooltip")).attr("id",t).style("top",0).style("left",0).style("opacity",0).style("position","absolute").selectAll("div, table, td, tr").classed(m,!0).classed(m,!0),u.exit().remove());var n=_(e,u.node());n&&(u.node().innerHTML=n),M()}),x}return x.nvPointerEventsClass=m,x.options=i.utils.optionsFunc.bind(x),x._options=Object.create({},{duration:{get:function(){return h},set:function(t){h=t}},gravity:{get:function(){return n},set:function(t){n=t}},distance:{get:function(){return r},set:function(t){r=t}},snapDistance:{get:function(){return a},set:function(t){a=t}},classes:{get:function(){return o},set:function(t){o=t}},enabled:{get:function(){return d},set:function(t){d=t}},hideDelay:{get:function(){return l},set:function(t){l=t}},contentGenerator:{get:function(){return _},set:function(t){_=t}},valueFormatter:{get:function(){return p},set:function(t){p=t}},headerFormatter:{get:function(){return g},set:function(t){g=t}},keyFormatter:{get:function(){return v},set:function(t){v=t}},headerEnabled:{get:function(){return f},set:function(t){f=t}},position:{get:function(){return y},set:function(t){y=t}},chartContainer:{get:function(){return document.body},set:function(t){i.deprecated("chartContainer","feature removed after 1.8.3")}},fixedTop:{get:function(){return null},set:function(t){i.deprecated("fixedTop","feature removed after 1.8.1")}},offset:{get:function(){return{left:0,top:0}},set:function(t){i.deprecated("offset","use chart.tooltip.distance() instead")}},hidden:{get:function(){return s},set:function(t){s!=t&&(s=!!t,x())}},data:{get:function(){return e},set:function(t){t.point&&(t.value=t.point.x,t.series=t.series||{},t.series.value=t.point.y,t.series.color=t.point.color||t.series.color),e=t}},node:{get:function(){return u.node()},set:function(t){}},id:{get:function(){return t},set:function(t){}}}),i.utils.initOptions(x),x},i.utils.windowSize=function(){var t={width:640,height:480};return window.innerWidth&&window.innerHeight?(t.width=window.innerWidth,t.height=window.innerHeight,t):"CSS1Compat"==document.compatMode&&document.documentElement&&document.documentElement.offsetWidth?(t.width=document.documentElement.offsetWidth,t.height=document.documentElement.offsetHeight,t):document.body&&document.body.offsetWidth?(t.width=document.body.offsetWidth,t.height=document.body.offsetHeight,t):t},i.utils.isArray=Array.isArray,i.utils.isObject=function(t){return null!==t&&"object"==typeof t},i.utils.isFunction=function(t){return"function"==typeof t},i.utils.isDate=function(t){return"[object Date]"===toString.call(t)},i.utils.isNumber=function(t){return!isNaN(t)&&"number"==typeof t},i.utils.windowResize=function(t){return window.addEventListener?window.addEventListener("resize",t):i.log("ERROR: Failed to bind to window.resize with: ",t),{callback:t,clear:function(){window.removeEventListener("resize",t)}}},i.utils.getColor=function(t){if(void 0===t)return i.utils.defaultColor();if(i.utils.isArray(t)){var e=d3.scale.ordinal().range(t);return function(t,n){var i=void 0===n?t:n;return t.color||e(i)}}return t},i.utils.defaultColor=function(){return i.utils.getColor(d3.scale.category20().range())},i.utils.customTheme=function(t,e,n){e=e||function(t){return t.key};var r=(n=n||d3.scale.category20().range()).length;return function(a,o){var s=e(a);return i.utils.isFunction(t[s])?t[s]():void 0!==t[s]?t[s]:(r||(r=n.length),n[r-=1])}},i.utils.pjax=function(t,e){var n=function(n){d3.html(n,function(n){var r=d3.select(e).node();r.parentNode.replaceChild(d3.select(n).select(e).node(),r),i.utils.pjax(t,e)})};d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href),n(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&n(d3.event.state)})},i.utils.calcApproxTextWidth=function(t){if(i.utils.isFunction(t.style)&&i.utils.isFunction(t.text)){var e=parseInt(t.style("font-size").replace("px",""),10),n=t.text().length;return i.utils.NaNtoZero(n*e*.5)}return 0},i.utils.NaNtoZero=function(t){return!i.utils.isNumber(t)||isNaN(t)||null===t||t===1/0||t===-1/0?0:t},d3.selection.prototype.watchTransition=function(t){var e=[this].concat([].slice.call(arguments,1));return t.transition.apply(t,e)},i.utils.renderWatch=function(t,e){if(!(this instanceof i.utils.renderWatch))return new i.utils.renderWatch(t,e);var n=void 0!==e?e:250,r=[],a=this;this.models=function(t){return[].slice.call(arguments,0).forEach(function(t){t.__rendered=!1,function(t){t.dispatch.on("renderEnd",function(e){t.__rendered=!0,a.renderEnd("model")})}(t),r.indexOf(t)<0&&r.push(t)}),this},this.reset=function(t){void 0!==t&&(n=t),r=[]},this.transition=function(t,e,i){if(i=(e=arguments.length>1?[].slice.call(arguments,1):[]).length>1?e.pop():void 0!==n?n:250,t.__rendered=!1,r.indexOf(t)<0&&r.push(t),0===i)return t.__rendered=!0,t.delay=function(){return this},t.duration=function(){return this},t;0===t.length?t.__rendered=!0:t.every(function(t){return!t.length})?t.__rendered=!0:t.__rendered=!1;var o=0;return t.transition().duration(i).each(function(){++o}).each("end",function(n,i){0==--o&&(t.__rendered=!0,a.renderEnd.apply(this,e))})},this.renderEnd=function(){r.every(function(t){return t.__rendered})&&(r.forEach(function(t){t.__rendered=!1}),t.renderEnd.apply(this,arguments))}},i.utils.deepExtend=function(t){(arguments.length>1?[].slice.call(arguments,1):[]).forEach(function(e){for(var n in e){var r=i.utils.isArray(t[n]),a=i.utils.isObject(t[n]),o=i.utils.isObject(e[n]);a&&!r&&o?i.utils.deepExtend(t[n],e[n]):t[n]=e[n]}})},i.utils.state=function(){if(!(this instanceof i.utils.state))return new i.utils.state;var t={},e=function(){},n=function(){return{}},r=null;this.dispatch=d3.dispatch("change","set"),this.dispatch.on("set",function(t){e(t,!0)}),this.getter=function(t){return n=t,this},this.setter=function(t,n){return n||(n=function(){}),e=function(e,i){t(e),i&&n()},this},this.init=function(t){r=r||{},i.utils.deepExtend(r,t)};this.update=function(){r&&(e(r,!1),r=null),function(){var e=n();if(JSON.stringify(e)===JSON.stringify(t))return!1;for(var i in e)void 0===t[i]&&(t[i]={}),t[i]=e[i],!0;return!0}.call(this)&&this.dispatch.change(t)}},i.utils.optionsFunc=function(t){return t&&d3.map(t).forEach(function(t,e){i.utils.isFunction(this[t])&&this[t](e)}.bind(this)),this},i.utils.calcTicksX=function(t,e){for(var n=1,r=0;r<e.length;r+=1){var a=e[r]&&e[r].values?e[r].values.length:0;n=a>n?a:n}return i.log("Requested number of ticks: ",t),i.log("Calculated max values to be: ",n),t=(t=t>n?t=n-1:t)<1?1:t,t=Math.floor(t),i.log("Calculating tick count as: ",t),t},i.utils.calcTicksY=function(t,e,n){if(n){for(var r=1,a=0;a<e.length;a+=1)for(var o,s=e[a]&&e[a].values?e[a].values:[],l=0;l<s.length;l+=1)r=(o=s[l]&&n(s[l])?n(s[l]):0)>r?o:r;return i.log("Requested number of ticks: ",t),i.log("Calculated max values to be: ",r),t=(t=t>r?r-1:t)<1?1:t,t=Math.floor(t),i.log("Calculating tick count as: ",t),t}return i.utils.calcTicksX(t,e)},i.utils.initOption=function(t,e){t._calls&&t._calls[e]?t[e]=t._calls[e]:(t[e]=function(n){return arguments.length?(t._overrides[e]=!0,t._options[e]=n,t):t._options[e]},t["_"+e]=function(n){return arguments.length?(t._overrides[e]||(t._options[e]=n),t):t._options[e]})},i.utils.initOptions=function(t){t._overrides=t._overrides||{};var e=Object.getOwnPropertyNames(t._options||{}),n=Object.getOwnPropertyNames(t._calls||{});for(var r in e=e.concat(n))i.utils.initOption(t,e[r])},i.utils.inheritOptionsD3=function(t,e,n){t._d3options=n.concat(t._d3options||[]),t._d3options=(t._d3options||[]).filter(function(t,e,n){return n.indexOf(t)===e}),n.unshift(e),n.unshift(t),d3.rebind.apply(this,n)},i.utils.arrayUnique=function(t){return t.sort().filter(function(e,n){return!n||e!=t[n-1]})},i.utils.symbolMap=d3.map(),i.utils.symbol=function(){var t,e=64;function n(n,r){var a=t.call(this,n,r),o=e.call(this,n,r);return-1!==d3.svg.symbolTypes.indexOf(a)?d3.svg.symbol().type(a).size(o)():i.utils.symbolMap.get(a)(o)}return n.type=function(e){return arguments.length?(t=d3.functor(e),n):t},n.size=function(t){return arguments.length?(e=d3.functor(t),n):e},n},i.utils.inheritOptions=function(t,e){var n=Object.getOwnPropertyNames(e._options||{}),r=Object.getOwnPropertyNames(e._calls||{}),a=e._inherited||[],o=e._d3options||[],s=n.concat(r).concat(a).concat(o);s.unshift(e),s.unshift(t),d3.rebind.apply(this,s),t._inherited=i.utils.arrayUnique(n.concat(r).concat(a).concat(n).concat(t._inherited||[])),t._d3options=i.utils.arrayUnique(o.concat(t._d3options||[]))},i.utils.initSVG=function(t){t.classed({"nvd3-svg":!0})},i.utils.sanitizeHeight=function(t,e){return t||parseInt(e.style("height"),10)||400},i.utils.sanitizeWidth=function(t,e){return t||parseInt(e.style("width"),10)||960},i.utils.availableHeight=function(t,e,n){return Math.max(0,i.utils.sanitizeHeight(t,e)-n.top-n.bottom)},i.utils.availableWidth=function(t,e,n){return Math.max(0,i.utils.sanitizeWidth(t,e)-n.left-n.right)},i.utils.noData=function(t,e){var n=t.options(),r=n.margin(),a=n.noData(),o=null==a?["No Data Available."]:[a],s=i.utils.availableHeight(null,e,r),l=i.utils.availableWidth(null,e,r),u=r.left+l/2,c=r.top+s/2;e.selectAll("g").remove();var d=e.selectAll(".nv-noData").data(o);d.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),d.attr("x",u).attr("y",c).text(function(t){return t})},i.utils.wrapTicks=function(t,e){t.each(function(){for(var t,n=d3.select(this),i=n.text().split(/\s+/).reverse(),r=[],a=0,o=n.attr("y"),s=parseFloat(n.attr("dy")),l=n.text(null).append("tspan").attr("x",0).attr("y",o).attr("dy",s+"em");t=i.pop();)r.push(t),l.text(r.join(" ")),l.node().getComputedTextLength()>e&&(r.pop(),l.text(r.join(" ")),r=[t],l=n.append("tspan").attr("x",0).attr("y",o).attr("dy",1.1*++a+s+"em").text(t))})},i.utils.arrayEquals=function(t,e){if(t===e)return!0;if(!t||!e)return!1;if(t.length!=e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!i.arrayEquals(t[n],e[n]))return!1}else if(t[n]!=e[n])return!1;return!0},i.utils.pointIsInArc=function(t,e,n){var i=n.innerRadius()(e),r=n.outerRadius()(e),a=n.startAngle()(e),o=n.endAngle()(e),s=t.x*t.x+t.y*t.y,l=Math.atan2(t.x,-t.y);return l=l<0?l+2*Math.PI:l,i*i<=s&&s<=r*r&&a<=l&&l<=o},i.models.axis=function(){"use strict";var t,e,n=d3.svg.axis(),r=d3.scale.linear(),a={top:0,right:0,bottom:0,left:0},o=75,s=60,l=null,u=!0,c=0,d=!0,h=!1,f=!1,m=null,p=0,g=void 0,v=250,_=d3.dispatch("renderEnd");n.scale(r).orient("bottom").tickFormat(function(t){return t});var y=i.utils.renderWatch(_,v);function b(s){return y.reset(),s.each(function(s){var v=d3.select(this);i.utils.initSVG(v);var _=v.selectAll("g.nv-wrap.nv-axis").data([s]),b=(_.enter().append("g").attr("class","nvd3 nv-wrap nv-axis").append("g"),_.select("g"));null!==m?n.ticks(m):"top"!=n.orient()&&"bottom"!=n.orient()||n.ticks(Math.abs(r.range()[1]-r.range()[0])/100),b.watchTransition(y,"axis").call(n),e=e||n.scale();var M=n.tickFormat();null==M&&(M=e.tickFormat());var x,w,k,L=b.selectAll("text.nv-axislabel").data([l||null]);switch(L.exit().remove(),void 0!==g&&b.selectAll("g").select("text").style("font-size",g),n.orient()){case"top":x=p+36,L.enter().append("text").attr("class","nv-axislabel"),k=0,1===r.range().length?k=f?2*r.range()[0]+r.rangeBand():0:2===r.range().length?k=f?r.range()[0]+r.range()[1]+r.rangeBand():r.range()[1]:r.range().length>2&&(k=r.range()[r.range().length-1]+(r.range()[1]-r.range()[0])),L.attr("text-anchor","middle").attr("y",-x).attr("x",k/2),u&&((w=_.selectAll("g.nv-axisMaxMin").data(r.domain())).enter().append("g").attr("class",function(t,e){return["nv-axisMaxMin","nv-axisMaxMin-x",0==e?"nv-axisMin-x":"nv-axisMax-x"].join(" ")}).append("text"),w.exit().remove(),w.attr("transform",function(t,e){return"translate("+i.utils.NaNtoZero(r(t))+",0)"}).select("text").attr("dy","-0.5em").attr("y",-n.tickPadding()).attr("text-anchor","middle").text(function(e,n){var i=(t||M)(e);return(""+i).match("NaN")?"":i}),w.watchTransition(y,"min-max top").attr("transform",function(t,e){return"translate("+i.utils.NaNtoZero(r.range()[e])+",0)"}));break;case"bottom":x=p+36;var S=30,T=0,Y=b.selectAll("g").select("text"),D="";if(c%360){Y.attr("transform",""),Y.each(function(t,e){var n=this.getBoundingClientRect(),i=n.width;T=n.height,i>S&&(S=i)}),D="rotate("+c+" 0,"+(T/2+n.tickPadding())+")";var C=Math.abs(Math.sin(c*Math.PI/180));x=(C?C*S:S)+30,Y.attr("transform",D).style("text-anchor",c%360>0?"start":"end")}else h?Y.attr("transform",function(t,e){return"translate(0,"+(e%2==0?"0":"12")+")"}):Y.attr("transform","translate(0,0)");L.enter().append("text").attr("class","nv-axislabel"),k=0,1===r.range().length?k=f?2*r.range()[0]+r.rangeBand():0:2===r.range().length?k=f?r.range()[0]+r.range()[1]+r.rangeBand():r.range()[1]:r.range().length>2&&(k=r.range()[r.range().length-1]+(r.range()[1]-r.range()[0])),L.attr("text-anchor","middle").attr("y",x).attr("x",k/2),u&&((w=_.selectAll("g.nv-axisMaxMin").data([r.domain()[0],r.domain()[r.domain().length-1]])).enter().append("g").attr("class",function(t,e){return["nv-axisMaxMin","nv-axisMaxMin-x",0==e?"nv-axisMin-x":"nv-axisMax-x"].join(" ")}).append("text"),w.exit().remove(),w.attr("transform",function(t,e){return"translate("+i.utils.NaNtoZero(r(t)+(f?r.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",n.tickPadding()).attr("transform",D).style("text-anchor",c?c%360>0?"start":"end":"middle").text(function(e,n){var i=(t||M)(e);return(""+i).match("NaN")?"":i}),w.watchTransition(y,"min-max bottom").attr("transform",function(t,e){return"translate("+i.utils.NaNtoZero(r(t)+(f?r.rangeBand()/2:0))+",0)"}));break;case"right":L.enter().append("text").attr("class","nv-axislabel"),L.style("text-anchor",d?"middle":"begin").attr("transform",d?"rotate(90)":"").attr("y",d?12-Math.max(a.right,o)-(p||0):-10).attr("x",d?d3.max(r.range())/2:n.tickPadding()),u&&((w=_.selectAll("g.nv-axisMaxMin").data(r.domain())).enter().append("g").attr("class",function(t,e){return["nv-axisMaxMin","nv-axisMaxMin-y",0==e?"nv-axisMin-y":"nv-axisMax-y"].join(" ")}).append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(t,e){return"translate(0,"+i.utils.NaNtoZero(r(t))+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",n.tickPadding()).style("text-anchor","start").text(function(e,n){var i=(t||M)(e);return(""+i).match("NaN")?"":i}),w.watchTransition(y,"min-max right").attr("transform",function(t,e){return"translate(0,"+i.utils.NaNtoZero(r.range()[e])+")"}).select("text").style("opacity",1));break;case"left":L.enter().append("text").attr("class","nv-axislabel"),L.style("text-anchor",d?"middle":"end").attr("transform",d?"rotate(-90)":"").attr("y",d?25-Math.max(a.left,o)-(p||0):-10).attr("x",d?-d3.max(r.range())/2:-n.tickPadding()),u&&((w=_.selectAll("g.nv-axisMaxMin").data(r.domain())).enter().append("g").attr("class",function(t,e){return["nv-axisMaxMin","nv-axisMaxMin-y",0==e?"nv-axisMin-y":"nv-axisMax-y"].join(" ")}).append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(t,n){return"translate(0,"+i.utils.NaNtoZero(e(t))+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-n.tickPadding()).attr("text-anchor","end").text(function(e,n){var i=(t||M)(e);return(""+i).match("NaN")?"":i}),w.watchTransition(y,"min-max right").attr("transform",function(t,e){return"translate(0,"+i.utils.NaNtoZero(r.range()[e])+")"}).select("text").style("opacity",1))}if(L.text(function(t){return t}),!u||"left"!==n.orient()&&"right"!==n.orient()||(b.selectAll("g").each(function(t,e){d3.select(this).select("text").attr("opacity",1),(r(t)<r.range()[1]+10||r(t)>r.range()[0]-10)&&((t>1e-10||t<-1e-10)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0))}),r.domain()[0]==r.domain()[1]&&0==r.domain()[0]&&_.selectAll("g.nv-axisMaxMin").style("opacity",function(t,e){return e?0:1})),u&&("top"===n.orient()||"bottom"===n.orient())){var E=[];_.selectAll("g.nv-axisMaxMin").each(function(t,e){try{e?E.push(r(t)-this.getBoundingClientRect().width-4):E.push(r(t)+this.getBoundingClientRect().width+4)}catch(n){e?E.push(r(t)-4):E.push(r(t)+4)}}),b.selectAll("g").each(function(t,e){(r(t)<E[0]||r(t)>E[1])&&(t>1e-10||t<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove())})}b.selectAll(".tick").filter(function(t){return!parseFloat(Math.round(1e5*t)/1e6)&&void 0!==t}).classed("zero",!0),e=r.copy()}),y.renderEnd("axis immediate"),b}return b.axis=n,b.dispatch=_,b.options=i.utils.optionsFunc.bind(b),b._options=Object.create({},{axisLabelDistance:{get:function(){return p},set:function(t){p=t}},staggerLabels:{get:function(){return h},set:function(t){h=t}},rotateLabels:{get:function(){return c},set:function(t){c=t}},rotateYLabel:{get:function(){return d},set:function(t){d=t}},showMaxMin:{get:function(){return u},set:function(t){u=t}},axisLabel:{get:function(){return l},set:function(t){l=t}},height:{get:function(){return s},set:function(t){s=t}},ticks:{get:function(){return m},set:function(t){m=t}},width:{get:function(){return o},set:function(t){o=t}},fontSize:{get:function(){return g},set:function(t){g=t}},tickFormatMaxMin:{get:function(){return t},set:function(e){t=e}},margin:{get:function(){return a},set:function(t){a.top=void 0!==t.top?t.top:a.top,a.right=void 0!==t.right?t.right:a.right,a.bottom=void 0!==t.bottom?t.bottom:a.bottom,a.left=void 0!==t.left?t.left:a.left}},duration:{get:function(){return v},set:function(t){v=t,y.reset(v)}},scale:{get:function(){return r},set:function(t){r=t,n.scale(r),f="function"==typeof r.rangeBands,i.utils.inheritOptionsD3(b,r,["domain","range","rangeBand","rangeBands"])}}}),i.utils.initOptions(b),i.utils.inheritOptionsD3(b,n,["orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"]),i.utils.inheritOptionsD3(b,r,["domain","range","rangeBand","rangeBands"]),b},i.models.boxPlot=function(){"use strict";var t,e,n,r,a,o,s={top:0,right:0,bottom:0,left:0},l=960,u=500,c=Math.floor(1e4*Math.random()),d=d3.scale.ordinal(),h=d3.scale.linear(),f=function(t){return t.label},m=function(t){return t.values.Q1},p=function(t){return t.values.Q2},g=function(t){return t.values.Q3},v=function(t){return t.values.whisker_low},_=function(t){return t.values.whisker_high},y=function(t){return t.color},b=function(t){return t.values.outliers},M=function(t,e,n){return t},x=function(t,e,n){return t},w=function(t,e,n){},k=i.utils.defaultColor(),L=null,S=d3.dispatch("elementMouseover","elementMouseout","elementMousemove","renderEnd"),T=250,Y=null,D=i.utils.renderWatch(S,T);function C(c){return D.reset(),c.each(function(c){var C=l-s.left-s.right,E=u-s.top-s.bottom;L=d3.select(this),i.utils.initSVG(L),d.domain(t||c.map(function(t,e){return f(t,e)})).rangeBands(e||[0,C],.1);var A=[];if(!n){var O=[];c.forEach(function(t,e){var n=m(t),i=g(t),r=v(t),a=_(t),o=b(t);o&&o.forEach(function(t,e){O.push(M(t,e,void 0))}),r&&O.push(r),n&&O.push(n),i&&O.push(i),a&&O.push(a)}),A=[d3.min(O),d3.max(O)]}h.domain(n||A),h.range(r||[E,0]),a=a||d,o=o||h.copy().range([h(0),h(0)]);var j=L.selectAll("g.nv-wrap").data([c]);j.enter().append("g").attr("class","nvd3 nv-wrap");j.attr("transform","translate("+s.left+","+s.top+")");var N=j.selectAll(".nv-boxplot").data(function(t){return t}),H=N.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);N.attr("class","nv-boxplot").attr("transform",function(t,e,n){return"translate("+(d(f(t,e))+.05*d.rangeBand())+", 0)"}).classed("hover",function(t){return t.hover}),N.watchTransition(D,"nv-boxplot: boxplots").style("stroke-opacity",1).style("fill-opacity",.75).delay(function(t,e){return e*T/c.length}).attr("transform",function(t,e){return"translate("+(d(f(t,e))+.05*d.rangeBand())+", 0)"}),N.exit().remove(),H.each(function(t,e){var n=d3.select(this);[v,_].forEach(function(i){if(void 0!==i(t)&&null!==i(t)){var r=i===v?"low":"high";n.append("line").style("stroke",y(t)||k(t,e)).attr("class","nv-boxplot-whisker nv-boxplot-"+r),n.append("line").style("stroke",y(t)||k(t,e)).attr("class","nv-boxplot-tick nv-boxplot-"+r)}})});var V=function(){return null===Y?.9*d.rangeBand():Math.min(75,.9*d.rangeBand())},P=function(){return.45*d.rangeBand()-V()/2},F=function(){return.45*d.rangeBand()+V()/2};[v,_].forEach(function(t){var e=t===v?"low":"high",n=t===v?m:g;N.select("line.nv-boxplot-whisker.nv-boxplot-"+e).watchTransition(D,"nv-boxplot: boxplots").attr("x1",.45*d.rangeBand()).attr("y1",function(e,n){return h(t(e))}).attr("x2",.45*d.rangeBand()).attr("y2",function(t,e){return h(n(t))}),N.select("line.nv-boxplot-tick.nv-boxplot-"+e).watchTransition(D,"nv-boxplot: boxplots").attr("x1",P).attr("y1",function(e,n){return h(t(e))}).attr("x2",F).attr("y2",function(e,n){return h(t(e))})}),[v,_].forEach(function(t){var e=t===v?"low":"high";H.selectAll(".nv-boxplot-"+e).on("mouseover",function(e,n,i){d3.select(this).classed("hover",!0),S.elementMouseover({series:{key:t(e),color:y(e)||k(e,i)},e:d3.event})}).on("mouseout",function(e,n,i){d3.select(this).classed("hover",!1),S.elementMouseout({series:{key:t(e),color:y(e)||k(e,i)},e:d3.event})}).on("mousemove",function(t,e){S.elementMousemove({e:d3.event})})}),H.append("rect").attr("class","nv-boxplot-box").on("mouseover",function(t,e){d3.select(this).classed("hover",!0),S.elementMouseover({key:f(t),value:f(t),series:[{key:"Q3",value:g(t),color:y(t)||k(t,e)},{key:"Q2",value:p(t),color:y(t)||k(t,e)},{key:"Q1",value:m(t),color:y(t)||k(t,e)}],data:t,index:e,e:d3.event})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),S.elementMouseout({key:f(t),value:f(t),series:[{key:"Q3",value:g(t),color:y(t)||k(t,e)},{key:"Q2",value:p(t),color:y(t)||k(t,e)},{key:"Q1",value:m(t),color:y(t)||k(t,e)}],data:t,index:e,e:d3.event})}).on("mousemove",function(t,e){S.elementMousemove({e:d3.event})}),N.select("rect.nv-boxplot-box").watchTransition(D,"nv-boxplot: boxes").attr("y",function(t,e){return h(g(t))}).attr("width",V).attr("x",P).attr("height",function(t,e){return Math.abs(h(g(t))-h(m(t)))||1}).style("fill",function(t,e){return y(t)||k(t,e)}).style("stroke",function(t,e){return y(t)||k(t,e)}),H.append("line").attr("class","nv-boxplot-median"),N.select("line.nv-boxplot-median").watchTransition(D,"nv-boxplot: boxplots line").attr("x1",P).attr("y1",function(t,e){return h(p(t))}).attr("x2",F).attr("y2",function(t,e){return h(p(t))});var I=N.selectAll(".nv-boxplot-outlier").data(function(t){return b(t)||[]});I.enter().append("circle").style("fill",function(t,e,n){return w(t,e,n)||k(t,n)}).style("stroke",function(t,e,n){return w(t,e,n)||k(t,n)}).style("z-index",9e3).on("mouseover",function(t,e,n){d3.select(this).classed("hover",!0),S.elementMouseover({series:{key:x(t,e,n),color:w(t,e,n)||k(t,n)},e:d3.event})}).on("mouseout",function(t,e,n){d3.select(this).classed("hover",!1),S.elementMouseout({series:{key:x(t,e,n),color:w(t,e,n)||k(t,n)},e:d3.event})}).on("mousemove",function(t,e){S.elementMousemove({e:d3.event})}),I.attr("class","nv-boxplot-outlier"),I.watchTransition(D,"nv-boxplot: nv-boxplot-outlier").attr("cx",.45*d.rangeBand()).attr("cy",function(t,e,n){return h(M(t,e,n))}).attr("r","3"),I.exit().remove(),a=d.copy(),o=h.copy()}),D.renderEnd("nv-boxplot immediate"),C}return C.dispatch=S,C.options=i.utils.optionsFunc.bind(C),C._options=Object.create({},{width:{get:function(){return l},set:function(t){l=t}},height:{get:function(){return u},set:function(t){u=t}},maxBoxWidth:{get:function(){return Y},set:function(t){Y=t}},x:{get:function(){return f},set:function(t){f=t}},q1:{get:function(){return m},set:function(t){m=t}},q2:{get:function(){return p},set:function(t){p=t}},q3:{get:function(){return g},set:function(t){g=t}},wl:{get:function(){return v},set:function(t){v=t}},wh:{get:function(){return _},set:function(t){_=t}},itemColor:{get:function(){return y},set:function(t){y=t}},outliers:{get:function(){return b},set:function(t){b=t}},outlierValue:{get:function(){return M},set:function(t){M=t}},outlierLabel:{get:function(){return x},set:function(t){x=t}},outlierColor:{get:function(){return w},set:function(t){w=t}},xScale:{get:function(){return d},set:function(t){d=t}},yScale:{get:function(){return h},set:function(t){h=t}},xDomain:{get:function(){return t},set:function(e){t=e}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return e},set:function(t){e=t}},yRange:{get:function(){return r},set:function(t){r=t}},id:{get:function(){return c},set:function(t){c=t}},y:{get:function(){return console.warn("BoxPlot 'y' chart option is deprecated. Please use model overrides instead."),{}},set:function(t){console.warn("BoxPlot 'y' chart option is deprecated. Please use model overrides instead.")}},margin:{get:function(){return s},set:function(t){s.top=void 0!==t.top?t.top:s.top,s.right=void 0!==t.right?t.right:s.right,s.bottom=void 0!==t.bottom?t.bottom:s.bottom,s.left=void 0!==t.left?t.left:s.left}},color:{get:function(){return k},set:function(t){k=i.utils.getColor(t)}},duration:{get:function(){return T},set:function(t){T=t,D.reset(T)}}}),i.utils.initOptions(C),C},i.models.boxPlotChart=function(){"use strict";var t,e,n=i.models.boxPlot(),r=i.models.axis(),a=i.models.axis(),o={top:15,right:10,bottom:50,left:60},s=null,l=null,u=i.utils.getColor(),c=!0,d=!0,h=!1,f=!1,m=i.models.tooltip(),p="No Data Available.",g=d3.dispatch("beforeUpdate","renderEnd"),v=250;r.orient("bottom").showMaxMin(!1).tickFormat(function(t){return t}),a.orient(h?"right":"left").tickFormat(d3.format(",.1f")),m.duration(0);var _=i.utils.renderWatch(g,v);function y(u){return _.reset(),_.models(n),c&&_.models(r),d&&_.models(a),u.each(function(u){var m=d3.select(this);i.utils.initSVG(m);var _=(s||parseInt(m.style("width"))||960)-o.left-o.right,b=(l||parseInt(m.style("height"))||400)-o.top-o.bottom;if(y.update=function(){g.beforeUpdate(),m.transition().duration(v).call(y)},y.container=this,!u||!u.length){var M=m.selectAll(".nv-noData").data([p]);return M.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),M.attr("x",o.left+_/2).attr("y",o.top+b/2).text(function(t){return t}),y}m.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale().clamp(!0);var x=m.selectAll("g.nv-wrap.nv-boxPlotWithAxes").data([u]),w=x.enter().append("g").attr("class","nvd3 nv-wrap nv-boxPlotWithAxes").append("g"),k=w.append("defs"),L=x.select("g");if(w.append("g").attr("class","nv-x nv-axis"),w.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),w.append("g").attr("class","nv-barsWrap"),L.attr("transform","translate("+o.left+","+o.top+")"),h&&L.select(".nv-y.nv-axis").attr("transform","translate("+_+",0)"),n.width(_).height(b),L.select(".nv-barsWrap").datum(u.filter(function(t){return!t.disabled})).transition().call(n),k.append("clipPath").attr("id","nv-x-label-clip-"+n.id()).append("rect"),L.select("#nv-x-label-clip-"+n.id()+" rect").attr("width",t.rangeBand()*(f?2:1)).attr("height",16).attr("x",-t.rangeBand()/(f?1:2)),c){r.scale(t).ticks(i.utils.calcTicksX(_/100,u)).tickSize(-b,0),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),L.select(".nv-x.nv-axis").call(r);var S=L.select(".nv-x.nv-axis").selectAll("g");f&&S.selectAll("text").attr("transform",function(t,e,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}d&&(a.scale(e).ticks(Math.floor(b/36)).tickSize(-_,0),L.select(".nv-y.nv-axis").call(a)),L.select(".nv-zeroLine line").attr("x1",0).attr("x2",_).attr("y1",e(0)).attr("y2",e(0))}),_.renderEnd("nv-boxplot chart immediate"),y}return n.dispatch.on("elementMouseover.tooltip",function(t){m.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){m.data(t).hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){m()}),y.dispatch=g,y.boxplot=n,y.xAxis=r,y.yAxis=a,y.tooltip=m,y.options=i.utils.optionsFunc.bind(y),y._options=Object.create({},{width:{get:function(){return s},set:function(t){s=t}},height:{get:function(){return l},set:function(t){l=t}},staggerLabels:{get:function(){return f},set:function(t){f=t}},showXAxis:{get:function(){return c},set:function(t){c=t}},showYAxis:{get:function(){return d},set:function(t){d=t}},tooltipContent:{get:function(){return m},set:function(t){m=t}},noData:{get:function(){return p},set:function(t){p=t}},margin:{get:function(){return o},set:function(t){o.top=void 0!==t.top?t.top:o.top,o.right=void 0!==t.right?t.right:o.right,o.bottom=void 0!==t.bottom?t.bottom:o.bottom,o.left=void 0!==t.left?t.left:o.left}},duration:{get:function(){return v},set:function(t){v=t,_.reset(v),n.duration(v),r.duration(v),a.duration(v)}},color:{get:function(){return u},set:function(t){u=i.utils.getColor(t),n.color(u)}},rightAlignYAxis:{get:function(){return h},set:function(t){h=t,a.orient(t?"right":"left")}}}),i.utils.inheritOptions(y,n),i.utils.initOptions(y),y},i.models.bullet=function(){"use strict";var t={top:0,right:0,bottom:0,left:0},e="left",n=!1,r=function(t){return t.ranges},a=function(t){return t.markers?t.markers:[]},o=function(t){return t.markerLines?t.markerLines:[0]},s=function(t){return t.measures},l=function(t){return t.rangeLabels?t.rangeLabels:[]},u=function(t){return t.markerLabels?t.markerLabels:[]},c=function(t){return t.markerLineLabels?t.markerLineLabels:[]},d=function(t){return t.measureLabels?t.measureLabels:[]},h=[0],f=380,m=30,p=null,g=null,v=i.utils.getColor(["#1f77b4"]),_=d3.dispatch("elementMouseover","elementMouseout","elementMousemove"),y=["Maximum","Mean","Minimum"],b=["Max","Avg","Min"],M=1e3;function x(t,e){var n=t.slice();t.sort(function(t,i){var r=n.indexOf(t),a=n.indexOf(i);return d3.descending(e[r],e[a])})}function w(e){return e.each(function(e,g){var w=f-t.left-t.right,k=m-t.top-t.bottom;p=d3.select(this),i.utils.initSVG(p);var L=r.call(this,e,g).slice(),S=a.call(this,e,g).slice(),T=o.call(this,e,g).slice(),Y=s.call(this,e,g).slice(),D=l.call(this,e,g).slice(),C=u.call(this,e,g).slice(),E=c.call(this,e,g).slice(),A=d.call(this,e,g).slice();x(D,L),x(C,S),x(E,T),x(A,Y),L.sort(d3.descending),S.sort(d3.descending),T.sort(d3.descending),Y.sort(d3.descending);var O=d3.scale.linear().domain(d3.extent(d3.merge([h,L]))).range(n?[w,0]:[0,w]);this.__chart__||d3.scale.linear().domain([0,1/0]).range(O.range());this.__chart__=O;d3.min(L),d3.max(L),L[1];for(var j=p.selectAll("g.nv-wrap.nv-bullet").data([e]),N=j.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet").append("g"),H=j.select("g"),V=(g=0,L.length);g<V;g++){var P="nv-range nv-range"+g;g<=2&&(P=P+" nv-range"+b[g]),N.append("rect").attr("class",P)}N.append("rect").attr("class","nv-measure"),j.attr("transform","translate("+t.left+","+t.top+")");var F=function(t){return Math.abs(O(t)-O(0))},I=function(t){return O(t<0?t:0)};for(g=0,V=L.length;g<V;g++){var R=L[g];H.select("rect.nv-range"+g).datum(R).attr("height",k).transition().duration(M).attr("width",F(R)).attr("x",I(R))}H.select("rect.nv-measure").style("fill",v).attr("height",k/3).attr("y",k/3).on("mouseover",function(){_.elementMouseover({value:Y[0],label:A[0]||"Current",color:d3.select(this).style("fill")})}).on("mousemove",function(){_.elementMousemove({value:Y[0],label:A[0]||"Current",color:d3.select(this).style("fill")})}).on("mouseout",function(){_.elementMouseout({value:Y[0],label:A[0]||"Current",color:d3.select(this).style("fill")})}).transition().duration(M).attr("width",Y<0?O(0)-O(Y[0]):O(Y[0])-O(0)).attr("x",I(Y));var W=k/6,z=S.map(function(t,e){return{value:t,label:C[e]}});N.selectAll("path.nv-markerTriangle").data(z).enter().append("path").attr("class","nv-markerTriangle").attr("d","M0,"+W+"L"+W+","+-W+" "+-W+","+-W+"Z").on("mouseover",function(t){_.elementMouseover({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill"),pos:[O(t.value),k/2]})}).on("mousemove",function(t){_.elementMousemove({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){_.elementMouseout({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill")})}),H.selectAll("path.nv-markerTriangle").data(z).transition().duration(M).attr("transform",function(t){return"translate("+O(t.value)+","+k/2+")"});var B=T.map(function(t,e){return{value:t,label:E[e]}});N.selectAll("line.nv-markerLine").data(B).enter().append("line").attr("cursor","").attr("class","nv-markerLine").attr("x1",function(t){return O(t.value)}).attr("y1","2").attr("x2",function(t){return O(t.value)}).attr("y2",k-2).on("mouseover",function(t){_.elementMouseover({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill"),pos:[O(t.value),k/2]})}).on("mousemove",function(t){_.elementMousemove({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){_.elementMouseout({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill")})}),H.selectAll("line.nv-markerLine").data(B).transition().duration(M).attr("x1",function(t){return O(t.value)}).attr("x2",function(t){return O(t.value)}),j.selectAll(".nv-range").on("mouseover",function(t,e){var n=D[e]||y[e];_.elementMouseover({value:t,label:n,color:d3.select(this).style("fill")})}).on("mousemove",function(){_.elementMousemove({value:Y[0],label:A[0]||"Previous",color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){var n=D[e]||y[e];_.elementMouseout({value:t,label:n,color:d3.select(this).style("fill")})})}),w}return w.dispatch=_,w.options=i.utils.optionsFunc.bind(w),w._options=Object.create({},{ranges:{get:function(){return r},set:function(t){r=t}},markers:{get:function(){return a},set:function(t){a=t}},measures:{get:function(){return s},set:function(t){s=t}},forceX:{get:function(){return h},set:function(t){h=t}},width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return m},set:function(t){m=t}},tickFormat:{get:function(){return g},set:function(t){g=t}},duration:{get:function(){return M},set:function(t){M=t}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},orient:{get:function(){return e},set:function(t){n="right"==(e=t)||"bottom"==e}},color:{get:function(){return v},set:function(t){v=i.utils.getColor(t)}}}),i.utils.initOptions(w),w},i.models.bulletChart=function(){"use strict";var t=i.models.bullet(),e=i.models.tooltip(),n="left",r=!1,a={top:5,right:40,bottom:20,left:120},o=function(t){return t.ranges},s=function(t){return t.markers?t.markers:[]},l=function(t){return t.measures},u=null,c=55,d=null,h=null,f=null,m=d3.dispatch();function p(e){return e.each(function(n,f){var m=d3.select(this);i.utils.initSVG(m);var g=i.utils.availableWidth(u,m,a),v=c-a.top-a.bottom;if(p.update=function(){p(e)},p.container=this,!n||!o.call(this,n,f))return i.utils.noData(p,m),p;m.selectAll(".nv-noData").remove();var _=o.call(this,n,f).slice().sort(d3.descending),y=s.call(this,n,f).slice().sort(d3.descending),b=l.call(this,n,f).slice().sort(d3.descending),M=m.selectAll("g.nv-wrap.nv-bulletChart").data([n]),x=M.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart").append("g"),w=M.select("g");x.append("g").attr("class","nv-bulletWrap"),x.append("g").attr("class","nv-titles"),M.attr("transform","translate("+a.left+","+a.top+")");var k=d3.scale.linear().domain([0,Math.max(_[0],y[0]||0,b[0])]).range(r?[g,0]:[0,g]),L=this.__chart__||d3.scale.linear().domain([0,1/0]).range(k.range());this.__chart__=k;var S=x.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(c-a.top-a.bottom)/2+")");S.append("text").attr("class","nv-title").text(function(t){return t.title}),S.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(t){return t.subtitle}),t.width(g).height(v);var T=w.select(".nv-bulletWrap");d3.transition(T).call(t);var Y=d||k.tickFormat(g/100),D=w.selectAll("g.nv-tick").data(k.ticks(h||g/50),function(t){return this.textContent||Y(t)}),C=D.enter().append("g").attr("class","nv-tick").attr("transform",function(t){return"translate("+L(t)+",0)"}).style("opacity",1e-6);C.append("line").attr("y1",v).attr("y2",7*v/6),C.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",7*v/6).text(Y);var E=d3.transition(D).transition().duration(t.duration()).attr("transform",function(t){return"translate("+k(t)+",0)"}).style("opacity",1);E.select("line").attr("y1",v).attr("y2",7*v/6),E.select("text").attr("y",7*v/6),d3.transition(D.exit()).transition().duration(t.duration()).attr("transform",function(t){return"translate("+k(t)+",0)"}).style("opacity",1e-6).remove()}),d3.timer.flush(),p}return e.duration(0).headerEnabled(!1),t.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:t.label,value:t.value,color:t.color},e.data(t).hidden(!1)}),t.dispatch.on("elementMouseout.tooltip",function(t){e.hidden(!0)}),t.dispatch.on("elementMousemove.tooltip",function(t){e()}),p.bullet=t,p.dispatch=m,p.tooltip=e,p.options=i.utils.optionsFunc.bind(p),p._options=Object.create({},{ranges:{get:function(){return o},set:function(t){o=t}},markers:{get:function(){return s},set:function(t){s=t}},measures:{get:function(){return l},set:function(t){l=t}},width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},tickFormat:{get:function(){return d},set:function(t){d=t}},ticks:{get:function(){return h},set:function(t){h=t}},noData:{get:function(){return f},set:function(t){f=t}},margin:{get:function(){return a},set:function(t){a.top=void 0!==t.top?t.top:a.top,a.right=void 0!==t.right?t.right:a.right,a.bottom=void 0!==t.bottom?t.bottom:a.bottom,a.left=void 0!==t.left?t.left:a.left}},orient:{get:function(){return n},set:function(t){r="right"==(n=t)||"bottom"==n}}}),i.utils.inheritOptions(p,t),i.utils.initOptions(p),p},i.models.candlestickBar=function(){"use strict";var t,e,n,r,a,o={top:0,right:0,bottom:0,left:0},s=null,l=null,u=Math.floor(1e4*Math.random()),c=d3.scale.linear(),d=d3.scale.linear(),h=function(t){return t.x},f=function(t){return t.y},m=function(t){return t.open},p=function(t){return t.close},g=function(t){return t.high},v=function(t){return t.low},_=[],y=[],b=!1,M=!0,x=i.utils.defaultColor(),w=!1,k=d3.dispatch("stateChange","changeState","renderEnd","chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove");function L(x){return x.each(function(x){t=d3.select(this);var w=i.utils.availableWidth(s,t,o),L=i.utils.availableHeight(l,t,o);i.utils.initSVG(t);var S=w/x[0].values.length*.45;c.domain(e||d3.extent(x[0].values.map(h).concat(_))),b?c.range(r||[.5*w/x[0].values.length,w*(x[0].values.length-.5)/x[0].values.length]):c.range(r||[5+S/2,w-S/2-5]),d.domain(n||[d3.min(x[0].values.map(v).concat(y)),d3.max(x[0].values.map(g).concat(y))]).range(a||[L,0]),c.domain()[0]===c.domain()[1]&&(c.domain()[0]?c.domain([c.domain()[0]-.01*c.domain()[0],c.domain()[1]+.01*c.domain()[1]]):c.domain([-1,1])),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]+.01*d.domain()[0],d.domain()[1]-.01*d.domain()[1]]):d.domain([-1,1]));var T=d3.select(this).selectAll("g.nv-wrap.nv-candlestickBar").data([x[0].values]),Y=T.enter().append("g").attr("class","nvd3 nv-wrap nv-candlestickBar"),D=Y.append("defs"),C=Y.append("g"),E=T.select("g");C.append("g").attr("class","nv-ticks"),T.attr("transform","translate("+o.left+","+o.top+")"),t.on("click",function(t,e){k.chartClick({data:t,index:e,pos:d3.event,id:u})}),D.append("clipPath").attr("id","nv-chart-clip-path-"+u).append("rect"),T.select("#nv-chart-clip-path-"+u+" rect").attr("width",w).attr("height",L),E.attr("clip-path",M?"url(#nv-chart-clip-path-"+u+")":"");var A=T.select(".nv-ticks").selectAll(".nv-tick").data(function(t){return t});A.exit().remove();var O=A.enter().append("g");A.attr("class",function(t,e,n){return(m(t,e)>p(t,e)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+e});O.append("line").attr("class","nv-candlestick-lines").attr("transform",function(t,e){return"translate("+c(h(t,e))+",0)"}).attr("x1",0).attr("y1",function(t,e){return d(g(t,e))}).attr("x2",0).attr("y2",function(t,e){return d(v(t,e))}),O.append("rect").attr("class","nv-candlestick-rects nv-bars").attr("transform",function(t,e){return"translate("+(c(h(t,e))-S/2)+","+(d(f(t,e))-(m(t,e)>p(t,e)?d(p(t,e))-d(m(t,e)):0))+")"}).attr("x",0).attr("y",0).attr("width",S).attr("height",function(t,e){var n=m(t,e),i=p(t,e);return n>i?d(i)-d(n):d(n)-d(i)});A.select(".nv-candlestick-lines").transition().attr("transform",function(t,e){return"translate("+c(h(t,e))+",0)"}).attr("x1",0).attr("y1",function(t,e){return d(g(t,e))}).attr("x2",0).attr("y2",function(t,e){return d(v(t,e))}),A.select(".nv-candlestick-rects").transition().attr("transform",function(t,e){return"translate("+(c(h(t,e))-S/2)+","+(d(f(t,e))-(m(t,e)>p(t,e)?d(p(t,e))-d(m(t,e)):0))+")"}).attr("x",0).attr("y",0).attr("width",S).attr("height",function(t,e){var n=m(t,e),i=p(t,e);return n>i?d(i)-d(n):d(n)-d(i)})}),L}return L.highlightPoint=function(e,n){L.clearHighlights(),t.select(".nv-candlestickBar .nv-tick-0-"+e).classed("hover",n)},L.clearHighlights=function(){t.select(".nv-candlestickBar .nv-tick.hover").classed("hover",!1)},L.dispatch=k,L.options=i.utils.optionsFunc.bind(L),L._options=Object.create({},{width:{get:function(){return s},set:function(t){s=t}},height:{get:function(){return l},set:function(t){l=t}},xScale:{get:function(){return c},set:function(t){c=t}},yScale:{get:function(){return d},set:function(t){d=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return r},set:function(t){r=t}},yRange:{get:function(){return a},set:function(t){a=t}},forceX:{get:function(){return _},set:function(t){_=t}},forceY:{get:function(){return y},set:function(t){y=t}},padData:{get:function(){return b},set:function(t){b=t}},clipEdge:{get:function(){return M},set:function(t){M=t}},id:{get:function(){return u},set:function(t){u=t}},interactive:{get:function(){return w},set:function(t){w=t}},x:{get:function(){return h},set:function(t){h=t}},y:{get:function(){return f},set:function(t){f=t}},open:{get:function(){return m()},set:function(t){m=t}},close:{get:function(){return p()},set:function(t){p=t}},high:{get:function(){return g},set:function(t){g=t}},low:{get:function(){return v},set:function(t){v=t}},margin:{get:function(){return o},set:function(t){o.top=void 0!=t.top?t.top:o.top,o.right=void 0!=t.right?t.right:o.right,o.bottom=void 0!=t.bottom?t.bottom:o.bottom,o.left=void 0!=t.left?t.left:o.left}},color:{get:function(){return x},set:function(t){x=i.utils.getColor(t)}}}),i.utils.initOptions(L),L},i.models.cumulativeLineChart=function(){"use strict";var t,e,n=i.models.line(),r=i.models.axis(),a=i.models.axis(),o=i.models.legend(),s=i.models.legend(),l=i.interactiveGuideline(),u=i.models.tooltip(),c={top:30,right:30,bottom:50,left:60},d=null,h=i.utils.defaultColor(),f=null,m=null,p=!0,g=!0,v=!0,_=!1,y=!0,b=!1,M=!0,x=n.id(),w=i.utils.state(),k=null,L=null,S=function(t){return t.average},T=d3.dispatch("stateChange","changeState","renderEnd"),Y=250,D=!1;w.index=0,w.rescaleY=M,r.orient("bottom").tickPadding(7),a.orient(_?"right":"left"),u.valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),s.updateState(!1);var C,E=d3.scale.linear(),A={i:0,x:0},O=i.utils.renderWatch(T,Y),j=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),index:A.i,rescaleY:M}}},N=function(t){return function(e){void 0!==e.index&&(A.i=e.index),void 0!==e.rescaleY&&(M=e.rescaleY),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function H(u){return O.reset(),O.models(n),g&&O.models(r),v&&O.models(a),u.each(function(u){var L=d3.select(this);i.utils.initSVG(L),L.classed("nv-chart-"+x,!0);var O,F=i.utils.availableWidth(f,L,c),I=i.utils.availableHeight(m,L,c);if(H.update=function(){0===Y?L.call(H):L.transition().duration(Y).call(H)},H.container=this,w.setter(N(u),H.update).getter(j(u)).update(),w.disabled=u.map(function(t){return!!t.disabled}),!k)for(O in k={},w)w[O]instanceof Array?k[O]=w[O].slice(0):k[O]=w[O];var R=d3.behavior.drag().on("dragstart",function(t,e){d3.select(H.container).style("cursor","ew-resize")}).on("drag",function(t,e){A.x=d3.event.x,A.i=Math.round(E.invert(A.x)),Q()}).on("dragend",function(t,e){d3.select(H.container).style("cursor","auto"),w.index=A.i,T.stateChange(w)});if(!(u&&u.length&&u.filter(function(t){return t.values.length}).length))return i.utils.noData(H,L),H;L.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale(),E.domain([0,u[0].values.length-1]).range([0,F]).clamp(!0);u=function(t,e){V||(V=n.y());return e.map(function(e,n){if(!e.values)return e;var i=e.values[t];if(null==i)return e;var r=V(i,t);return Math.abs(r)<1e-5&&!D?(e.tempDisabled=!0,e):(e.tempDisabled=!1,e.values=e.values.map(function(t,e){return t.display={y:(V(t,e)-r)/r},t}),e)})}(A.i,u);void 0===C&&(C=P(u)),M?n.yDomain(null):(n.yDomain(C),n.clipEdge(!0));var W=b?"none":"all",z=L.selectAll("g.nv-wrap.nv-cumulativeLine").data([u]),B=z.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),U=z.select("g");if(B.append("g").attr("class","nv-interactive"),B.append("g").attr("class","nv-x nv-axis").style("pointer-events","none"),B.append("g").attr("class","nv-y nv-axis"),B.append("g").attr("class","nv-background"),B.append("g").attr("class","nv-linesWrap").style("pointer-events",W),B.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none"),B.append("g").attr("class","nv-legendWrap"),B.append("g").attr("class","nv-controlsWrap"),p?(o.width(F),U.select(".nv-legendWrap").datum(u).call(o),d||o.height()===c.top||(c.top=o.height(),I=i.utils.availableHeight(m,L,c)),U.select(".nv-legendWrap").attr("transform","translate(0,"+-c.top+")")):U.select(".nv-legendWrap").selectAll("*").remove(),y){var G=[{key:"Re-scale y-axis",disabled:!M}];s.width(140).color(["#444","#444","#444"]).rightAlign(!1).margin({top:5,right:0,bottom:5,left:20}),U.select(".nv-controlsWrap").datum(G).attr("transform","translate(0,"+-c.top+")").call(s)}else U.select(".nv-controlsWrap").selectAll("*").remove();z.attr("transform","translate("+c.left+","+c.top+")"),_&&U.select(".nv-y.nv-axis").attr("transform","translate("+F+",0)");var $=u.filter(function(t){return t.tempDisabled});z.select(".tempDisabled").remove(),$.length&&z.append("text").attr("class","tempDisabled").attr("x",F/2).attr("y","-.71em").style("text-anchor","end").text($.map(function(t){return t.key}).join(", ")+" values cannot be calculated for this time period."),b&&(l.width(F).height(I).margin({left:c.left,top:c.top}).svgContainer(L).xScale(t),z.select(".nv-interactive").call(l)),B.select(".nv-background").append("rect"),U.select(".nv-background rect").attr("width",F).attr("height",I),n.y(function(t){return t.display.y}).width(F).height(I).color(u.map(function(t,e){return t.color||h(t,e)}).filter(function(t,e){return!u[e].disabled&&!u[e].tempDisabled}));var q=U.select(".nv-linesWrap").datum(u.filter(function(t){return!t.disabled&&!t.tempDisabled}));q.call(n),u.forEach(function(t,e){t.seriesIndex=e});var J=u.filter(function(t){return!t.disabled&&!!S(t)}),X=U.select(".nv-avgLinesWrap").selectAll("line").data(J,function(t){return t.key}),Z=function(t){var n=e(S(t));return n<0?0:n>I?I:n};X.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(t,e){return n.color()(t,t.seriesIndex)}).attr("x1",0).attr("x2",F).attr("y1",Z).attr("y2",Z),X.style("stroke-opacity",function(t){var n=e(S(t));return n<0||n>I?0:1}).attr("x1",0).attr("x2",F).attr("y1",Z).attr("y2",Z),X.exit().remove();var K=q.selectAll(".nv-indexLine").data([A]);function Q(){K.data([A]);var t=H.duration();H.duration(0),H.update(),H.duration(t)}K.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(R),K.attr("transform",function(t){return"translate("+E(t.i)+",0)"}).attr("height",I),g&&(r.scale(t)._ticks(i.utils.calcTicksX(F/70,u)).tickSize(-I,0),U.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),U.select(".nv-x.nv-axis").call(r)),v&&(a.scale(e)._ticks(i.utils.calcTicksY(I/36,u)).tickSize(-F,0),U.select(".nv-y.nv-axis").call(a)),U.select(".nv-background rect").on("click",function(){A.x=d3.mouse(this)[0],A.i=Math.round(E.invert(A.x)),w.index=A.i,T.stateChange(w),Q()}),n.dispatch.on("elementClick",function(t){A.i=t.pointIndex,A.x=E(A.i),w.index=A.i,T.stateChange(w),Q()}),s.dispatch.on("legendClick",function(t,e){t.disabled=!t.disabled,M=!t.disabled,w.rescaleY=M,M||(C=P(u)),T.stateChange(w),H.update()}),o.dispatch.on("stateChange",function(t){for(var e in t)w[e]=t[e];T.stateChange(w),H.update()}),l.dispatch.on("elementMousemove",function(t){n.clearHighlights();var e,o,s,c=[];if(u.filter(function(t,e){return t.seriesIndex=e,!(t.disabled||t.tempDisabled)}).forEach(function(r,a){o=i.interactiveBisect(r.values,t.pointXValue,H.x()),n.highlightPoint(a,o,!0);var l=r.values[o];void 0!==l&&(void 0===e&&(e=l),void 0===s&&(s=H.xScale()(H.x()(l,o))),c.push({key:r.key,value:H.y()(l,o),color:h(r,r.seriesIndex)}))}),c.length>2){var d=H.yScale().invert(t.mouseY),f=.03*Math.abs(H.yScale().domain()[0]-H.yScale().domain()[1]),m=i.nearestValueIndex(c.map(function(t){return t.value}),d,f);null!==m&&(c[m].highlight=!0)}var p=r.tickFormat()(H.x()(e,o),o);l.tooltip.valueFormatter(function(t,e){return a.tickFormat()(t)}).data({value:p,series:c})(),l.renderGuideLine(s)}),l.dispatch.on("elementMouseout",function(t){n.clearHighlights()}),T.on("changeState",function(t){void 0!==t.disabled&&(u.forEach(function(e,n){e.disabled=t.disabled[n]}),w.disabled=t.disabled),void 0!==t.index&&(A.i=t.index,A.x=E(A.i),w.index=t.index,K.data([A])),void 0!==t.rescaleY&&(M=t.rescaleY),H.update()})}),O.renderEnd("cumulativeLineChart immediate"),H}n.dispatch.on("elementMouseover.tooltip",function(t){var e={x:H.x()(t.point),y:H.y()(t.point),color:t.point.color};t.point=e,u.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){u.hidden(!0)});var V=null;function P(t){var e=t.filter(function(t){return!(t.disabled||t.tempDisabled)}).map(function(t,e){return d3.extent(t.values,function(t){return t.display.y})});return[d3.min(e,function(t){return t[0]}),d3.max(e,function(t){return t[1]})]}return H.dispatch=T,H.lines=n,H.legend=o,H.controls=s,H.xAxis=r,H.yAxis=a,H.interactiveLayer=l,H.state=w,H.tooltip=u,H.options=i.utils.optionsFunc.bind(H),H._options=Object.create({},{width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return m},set:function(t){m=t}},showControls:{get:function(){return y},set:function(t){y=t}},showLegend:{get:function(){return p},set:function(t){p=t}},average:{get:function(){return S},set:function(t){S=t}},defaultState:{get:function(){return k},set:function(t){k=t}},noData:{get:function(){return L},set:function(t){L=t}},showXAxis:{get:function(){return g},set:function(t){g=t}},showYAxis:{get:function(){return v},set:function(t){v=t}},noErrorCheck:{get:function(){return D},set:function(t){D=t}},rescaleY:{get:function(){return M},set:function(t){M=t,H.state.rescaleY=t}},margin:{get:function(){return c},set:function(t){void 0!==t.top&&(c.top=t.top,d=t.top),c.right=void 0!==t.right?t.right:c.right,c.bottom=void 0!==t.bottom?t.bottom:c.bottom,c.left=void 0!==t.left?t.left:c.left}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t),o.color(h)}},useInteractiveGuideline:{get:function(){return b},set:function(t){b=t,!0===t&&(H.interactive(!1),H.useVoronoi(!1))}},rightAlignYAxis:{get:function(){return _},set:function(t){_=t,a.orient(t?"right":"left")}},duration:{get:function(){return Y},set:function(t){Y=t,n.duration(Y),r.duration(Y),a.duration(Y),O.reset(Y)}}}),i.utils.inheritOptions(H,n),i.utils.initOptions(H),H},i.models.differenceChart=function(){"use strict";var t=void 0,e=i.models.multiChart(),n=i.models.focus(i.models.line()),r=function(t){return function(t){return void 0!==t}(t.y0)?t.y0:t.y},a=function(t){return t.x},o=function(t){return t.x},s="x",l=function(t){return t.y},u=300,c=null,d=null,h=null,f=null,m={top:30,right:50,bottom:20,left:70},p={top:0,right:0,bottom:0,left:0},g=!0,v="linear",_=1,y=d3.time.scale(),b=d3.time.format.multi([["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",function(){return!0}]]);function M(o){o.each(function(o){t=d3.select(this);var s=(o||[]).filter(function(t){return!t.disabled});if(!o||!s.length)return i.utils.noData(M,t),M;var l=x(o),g=i.utils.availableHeight(h,t,m)-n.height(),_=i.utils.availableWidth(f,t,m);t.attr("class","nv-differenceChart"),i.utils.initSVG(t),M.container=this,e.margin(m).color(d3.scale.category10().range()).y(r).width(f).height(g).interpolate(v).useInteractiveGuideline(!0),e.interactiveLayer.tooltip.valueFormatter(function(t,e,n){if(n.key===d||n.key===c){var i=Math.abs(n.data.y0-n.data.y1);return 0===i?"-":i}return t}),e.stack1.areaY1(function(t){return e.stack1.scatter.yScale()(t.display.y)}),e.stack1.transformData(function(t){t.display={y:t.y1,y0:t.y0}}),e.xAxis.scale(y),e.xAxis.tickFormat(b);var w=l.filter(function(t){return!t.disabled}).map(function(t){return t.values}),k=d3.extent(d3.merge(w),function(t){return a(t)});e.xAxis.domain(k).range([0,_]);var L=d3.extent(d3.merge(w),function(t){return r(t)});return e.yDomain1(L),e.yAxis1.tickFormat(d3.format(",.1f")),e.yAxis2.tickFormat(d3.format(",.1f")),n.width(_),n.margin(p),n.xScale(y.copy()),n.xAxis.tickFormat(b),n.xAxis.rotateLabels(0),t.append("g").attr("class","nv-focusWrap").style("display","initial").attr("transform","translate("+m.left+", "+(g+n.margin().top)+")").datum(l.filter(function(t){return"line"===t.type})).call(n),t.datum(l).call(e),n.dispatch.on("onBrush",function(n){var i=l.map(function(t){var e=-1,i=-1;t.values.some(function(t,r){return-1===e&&t.x>=n[0]&&(e=r),-1===i&&t.x>=n[1]&&(i=r,!0)});for(var r=t.values.slice(e,i),a=0;r.length<2&&a<5;)e-=1,i+=1,r=t.values.slice(e,i),a++;return Object.assign({},t,{values:r})});t.datum(i),e.xAxis.domain(n),e.update()}),M.update=function(){t.selectAll("*").remove(),0===u?t.call(M):t.transition().duration(u).call(M)},M})}function x(t){var e=t.slice(0),n=e.every(function(t){return t.processed}),i=e.filter(function(t){return"actual"===t.type}),r=e.filter(function(t){return"expected"===t.type});if(n)return e;if(!i.length||!r.length)return[];var a=r[0].key+" minus "+i[0].key+" (Predicted > Actual)",u=r[0].key+" minus "+i[0].key+" (Predicted < Actual)",h=[{key:c||a,type:"area",values:[],yAxis:1,color:"rgba(44,160,44,.9)",processed:!0,noHighlightSeries:!0},{key:d||u,type:"area",values:[],yAxis:1,color:"rgba(234,39,40,.9)",processed:!0,noHighlightSeries:!0},{key:i[0].key,type:"line",values:[],yAxis:1,color:"#666666",processed:!0,strokeWidth:_}];g&&(h[3]={key:r[0].key,type:"line",values:[],yAxis:1,color:"#aec7e8",processed:!0,strokeWidth:_});var f=i[0].values.reduce(function(t,e,n){return t[o(e)]=l(e),t},{}),m=r[0].values.reduce(function(t,e,n){return t[o(e)]=l(e),t},{});return Object.keys(f).forEach(function(t,e){var n=f[t],i=m[t],r={};r[s]=t;var a=o(r),l=i-n;isNaN(l)?(h[1].values[e]={x:a,y0:n,y1:n},h[0].values[e]={x:a,y0:n,y1:n}):l<0?(h[1].values[e]={x:a,y0:n,y1:i},h[0].values[e]={x:a,y0:n,y1:n}):(h[0].values[e]={x:a,y0:n,y1:i},h[1].values[e]={x:a,y0:n,y1:n}),h[2].values[e]={x:a,y:n},g&&(h[3].values[e]={x:a,y:i})}),h}return M.options=i.utils.optionsFunc.bind(M),M._options=Object.create({},{width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return h},set:function(t){h=t}},strokeWidth:{get:function(){return _},set:function(t){_=t}},x:{get:function(){return o},set:function(t){o=t}},keyForXValue:{get:function(){return s},set:function(t){s=t}},y:{get:function(){return l},set:function(t){l=t}},xScale:{get:function(){return y},set:function(t){y=t}},keyForActualLessThanPredicted:{get:function(){return c},set:function(t){c=t}},keyForActualGreaterThanPredicted:{get:function(){return d},set:function(t){d=t}},showPredictedLine:{get:function(){return g},set:function(t){g=t}},tickFormat:{get:function(){return b},set:function(t){b=t}},interpolate:{get:function(){return v},set:function(t){v=t}},focusMargin:{get:function(){return p},set:function(t){p.top=void 0!==t.top?t.top:p.top,p.right=void 0!==t.right?t.right:p.right,p.bottom=void 0!==t.bottom?t.bottom:p.bottom,p.left=void 0!==t.left?t.left:p.left}},margin:{get:function(){return m},set:function(t){m.top=void 0!==t.top?t.top:m.top,m.right=void 0!==t.right?t.right:m.right,m.bottom=void 0!==t.bottom?t.bottom:m.bottom,m.left=void 0!==t.left?t.left:m.left}}}),M.xAxis=e.xAxis,M.yAxis=e.yAxis1,M.multiChart=e,M.focus=n,M.processData=x,i.utils.inheritOptions(M,e),i.utils.initOptions(M),M},i.models.discreteBar=function(){"use strict";var t,e,n,r,a,o,s,l={top:0,right:0,bottom:0,left:0},u=960,c=500,d=Math.floor(1e4*Math.random()),h=d3.scale.ordinal(),f=d3.scale.linear(),m=function(t){return t.x},p=function(t){return t.y},g=[0],v=i.utils.defaultColor(),_=0,y=!1,b=d3.format(",.2f"),M=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),x="discreteBar",w=250,k=i.utils.renderWatch(M,w);function L(d){return k.reset(),d.each(function(d){var w=u-l.left-l.right,L=c-l.top-l.bottom;t=d3.select(this),i.utils.initSVG(t),d.forEach(function(t,e){t.values.forEach(function(t){t.series=e})});var S=e&&n?[]:d.map(function(t){return t.values.map(function(t,e){return{x:m(t,e),y:p(t,e),y0:t.y0}})});h.domain(e||d3.merge(S).map(function(t){return t.x})).rangeBands(r||[0,w],.1),f.domain(n||d3.extent(d3.merge(S).map(function(t){return t.y}).concat(g))),y?f.range(a||[L-(f.domain()[0]<0?12:0),f.domain()[1]>0?12:0]):f.range(a||[L,0]),o=o||h,s=s||f.copy().range([f(0),f(0)]);var T=t.selectAll("g.nv-wrap.nv-discretebar").data([d]),Y=T.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar").append("g");T.select("g");Y.append("g").attr("class","nv-groups"),T.attr("transform","translate("+l.left+","+l.top+")");var D=T.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t){return t.key});D.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),D.exit().watchTransition(k,"discreteBar: exit groups").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),D.attr("class",function(t,e){return"nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}),D.watchTransition(k,"discreteBar: groups").style("stroke-opacity",1).style("fill-opacity",.75);var C=D.selectAll("g.nv-bar").data(function(t){return t.values});C.exit().remove();var E=C.enter().append("g").attr("transform",function(t,e,n){return"translate("+(h(m(t,e))+.05*h.rangeBand())+", "+f(0)+")"}).on("mouseover",function(t,e){d3.select(this).classed("hover",!0),M.elementMouseover({data:t,index:e,color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),M.elementMouseout({data:t,index:e,color:d3.select(this).style("fill")})}).on("mousemove",function(t,e){M.elementMousemove({data:t,index:e,color:d3.select(this).style("fill")})}).on("click",function(t,e){M.elementClick({data:t,index:e,color:d3.select(this).style("fill"),event:d3.event,element:this}),d3.event.stopPropagation()}).on("dblclick",function(t,e){M.elementDblClick({data:t,index:e,color:d3.select(this).style("fill")}),d3.event.stopPropagation()});E.append("rect").attr("height",0).attr("width",.9*h.rangeBand()/d.length),y?(E.append("text").attr("text-anchor","middle"),C.select("text").text(function(t,e){return b(p(t,e))}).watchTransition(k,"discreteBar: bars text").attr("x",.9*h.rangeBand()/2).attr("y",function(t,e){return p(t,e)<0?f(p(t,e))-f(0)+12:-4})):C.selectAll("text").remove(),C.attr("class",function(t,e){return p(t,e)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(t,e){return t.color||v(t,e)}).style("stroke",function(t,e){return t.color||v(t,e)}).select("rect").attr("rx",_).attr("class",x).watchTransition(k,"discreteBar: bars rect").attr("width",.9*h.rangeBand()/d.length),C.watchTransition(k,"discreteBar: bars").attr("transform",function(t,e){return"translate("+(h(m(t,e))+.05*h.rangeBand())+", "+(p(t,e)<0?f(0):f(0)-f(p(t,e))<1?f(0)-1:f(p(t,e)))+")"}).select("rect").attr("height",function(t,e){return Math.max(Math.abs(f(p(t,e))-f(0)),1)}),o=h.copy(),s=f.copy()}),k.renderEnd("discreteBar immediate"),L}return L.dispatch=M,L.options=i.utils.optionsFunc.bind(L),L._options=Object.create({},{width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},forceY:{get:function(){return g},set:function(t){g=t}},showValues:{get:function(){return y},set:function(t){y=t}},cornerRadius:{get:function(){return _},set:function(t){_=t}},x:{get:function(){return m},set:function(t){m=t}},y:{get:function(){return p},set:function(t){p=t}},xScale:{get:function(){return h},set:function(t){h=t}},yScale:{get:function(){return f},set:function(t){f=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return r},set:function(t){r=t}},yRange:{get:function(){return a},set:function(t){a=t}},valueFormat:{get:function(){return b},set:function(t){b=t}},id:{get:function(){return d},set:function(t){d=t}},rectClass:{get:function(){return x},set:function(t){x=t}},margin:{get:function(){return l},set:function(t){l.top=void 0!==t.top?t.top:l.top,l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},color:{get:function(){return v},set:function(t){v=i.utils.getColor(t)}},duration:{get:function(){return w},set:function(t){w=t,k.reset(w)}}}),i.utils.initOptions(L),L},i.models.discreteBarChart=function(){"use strict";var t,e,n=i.models.discreteBar(),r=i.models.axis(),a=i.models.axis(),o=i.models.legend(),s=i.models.tooltip(),l={top:15,right:10,bottom:50,left:60},u=null,c=null,d=null,h=i.utils.getColor(),f=!1,m=!0,p=!0,g=!1,v=!1,_=!1,y=0,b=null,M=d3.dispatch("beforeUpdate","renderEnd"),x=250;r.orient("bottom").showMaxMin(!1).tickFormat(function(t){return t}),a.orient(g?"right":"left").tickFormat(d3.format(",.1f")),s.duration(0).headerEnabled(!1).valueFormatter(function(t,e){return a.tickFormat()(t,e)}).keyFormatter(function(t,e){return r.tickFormat()(t,e)});var w=i.utils.renderWatch(M,x);function k(s){return w.reset(),w.models(n),m&&w.models(r),p&&w.models(a),s.each(function(s){var h=d3.select(this);i.utils.initSVG(h);var b=i.utils.availableWidth(c,h,l),w=i.utils.availableHeight(d,h,l);if(k.update=function(){M.beforeUpdate(),h.transition().duration(x).call(k)},k.container=this,!(s&&s.length&&s.filter(function(t){return t.values.length}).length))return i.utils.noData(k,h),k;h.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale().clamp(!0);var L=h.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([s]),S=L.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),T=S.append("defs"),Y=L.select("g");if(S.append("g").attr("class","nv-x nv-axis"),S.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),S.append("g").attr("class","nv-barsWrap"),S.append("g").attr("class","nv-legendWrap"),Y.attr("transform","translate("+l.left+","+l.top+")"),f?(o.width(b),Y.select(".nv-legendWrap").datum(s).call(o),u||o.height()===l.top||(l.top=o.height(),w=i.utils.availableHeight(d,h,l)),L.select(".nv-legendWrap").attr("transform","translate(0,"+-l.top+")")):Y.select(".nv-legendWrap").selectAll("*").remove(),g&&Y.select(".nv-y.nv-axis").attr("transform","translate("+b+",0)"),n.width(b).height(w),Y.select(".nv-barsWrap").datum(s.filter(function(t){return!t.disabled})).transition().call(n),T.append("clipPath").attr("id","nv-x-label-clip-"+n.id()).append("rect"),Y.select("#nv-x-label-clip-"+n.id()+" rect").attr("width",t.rangeBand()*(v?2:1)).attr("height",16).attr("x",-t.rangeBand()/(v?1:2)),m){r.scale(t)._ticks(i.utils.calcTicksX(b/100,s)).tickSize(-w,0),Y.select(".nv-x.nv-axis").attr("transform","translate(0,"+(e.range()[0]+(n.showValues()&&e.domain()[0]<0?16:0))+")"),Y.select(".nv-x.nv-axis").call(r);var D=Y.select(".nv-x.nv-axis").selectAll("g");v&&D.selectAll("text").attr("transform",function(t,e,n){return"translate(0,"+(n%2==0?"5":"17")+")"}),y&&D.selectAll(".tick text").attr("transform","rotate("+y+" 0,0)").style("text-anchor",y>0?"start":"end"),_&&Y.selectAll(".tick text").call(i.utils.wrapTicks,k.xAxis.rangeBand())}p&&(a.scale(e)._ticks(i.utils.calcTicksY(w/36,s,n.y())).tickSize(-b,0),Y.select(".nv-y.nv-axis").call(a)),Y.select(".nv-zeroLine line").attr("x1",0).attr("x2",g?-b:b).attr("y1",e(0)).attr("y2",e(0))}),w.renderEnd("discreteBar chart immediate"),k}return n.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:k.x()(t.data),value:k.y()(t.data),color:t.color},s.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){s.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){s()}),k.dispatch=M,k.discretebar=n,k.legend=o,k.xAxis=r,k.yAxis=a,k.tooltip=s,k.options=i.utils.optionsFunc.bind(k),k._options=Object.create({},{width:{get:function(){return c},set:function(t){c=t}},height:{get:function(){return d},set:function(t){d=t}},showLegend:{get:function(){return f},set:function(t){f=t}},staggerLabels:{get:function(){return v},set:function(t){v=t}},rotateLabels:{get:function(){return y},set:function(t){y=t}},wrapLabels:{get:function(){return _},set:function(t){_=!!t}},showXAxis:{get:function(){return m},set:function(t){m=t}},showYAxis:{get:function(){return p},set:function(t){p=t}},noData:{get:function(){return b},set:function(t){b=t}},margin:{get:function(){return l},set:function(t){void 0!==t.top&&(l.top=t.top,u=t.top),l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},duration:{get:function(){return x},set:function(t){x=t,w.reset(x),n.duration(x),r.duration(x),a.duration(x)}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t),n.color(h),o.color(h)}},rightAlignYAxis:{get:function(){return g},set:function(t){g=t,a.orient(t?"right":"left")}}}),i.utils.inheritOptions(k,n),i.utils.initOptions(k),k},i.models.distribution=function(){"use strict";var t,e={top:0,right:0,bottom:0,left:0},n=400,r=8,a="x",o=function(t){return t[a]},s=i.utils.defaultColor(),l=d3.scale.linear(),u=250,c=d3.dispatch("renderEnd"),d=i.utils.renderWatch(c,u);function h(n){return d.reset(),n.each(function(n){"x"===a?(e.left,e.right):(e.top,e.bottom);var u="x"==a?"y":"x",c=d3.select(this);i.utils.initSVG(c),t=t||l;var h=c.selectAll("g.nv-distribution").data([n]),f=(h.enter().append("g").attr("class","nvd3 nv-distribution").append("g"),h.select("g"));h.attr("transform","translate("+e.left+","+e.top+")");var m=f.selectAll("g.nv-dist").data(function(t){return t},function(t){return t.key});m.enter().append("g"),m.attr("class",function(t,e){return"nv-dist nv-series-"+e}).style("stroke",function(t,e){return s(t,e)});var p=m.selectAll("line.nv-dist"+a).data(function(t){return t.values});p.enter().append("line").attr(a+"1",function(e,n){return t(o(e,n))}).attr(a+"2",function(e,n){return t(o(e,n))}),d.transition(m.exit().selectAll("line.nv-dist"+a),"dist exit").attr(a+"1",function(t,e){return l(o(t,e))}).attr(a+"2",function(t,e){return l(o(t,e))}).style("stroke-opacity",0).remove(),p.attr("class",function(t,e){return"nv-dist"+a+" nv-dist"+a+"-"+e}).attr(u+"1",0).attr(u+"2",r),d.transition(p,"dist").attr(a+"1",function(t,e){return l(o(t,e))}).attr(a+"2",function(t,e){return l(o(t,e))}),t=l.copy()}),d.renderEnd("distribution immediate"),h}return h.options=i.utils.optionsFunc.bind(h),h.dispatch=c,h.margin=function(t){return arguments.length?(e.top=void 0!==t.top?t.top:e.top,e.right=void 0!==t.right?t.right:e.right,e.bottom=void 0!==t.bottom?t.bottom:e.bottom,e.left=void 0!==t.left?t.left:e.left,h):e},h.width=function(t){return arguments.length?(n=t,h):n},h.axis=function(t){return arguments.length?(a=t,h):a},h.size=function(t){return arguments.length?(r=t,h):r},h.getData=function(t){return arguments.length?(o=d3.functor(t),h):o},h.scale=function(t){return arguments.length?(l=t,h):l},h.color=function(t){return arguments.length?(s=i.utils.getColor(t),h):s},h.duration=function(t){return arguments.length?(u=t,d.reset(u),h):u},h},i.models.distroPlot=function(){"use strict";var t,e,n,r,a,o={top:0,right:0,bottom:0,left:0},s=960,l=500,u=Math.floor(1e4*Math.random()),c=d3.scale.ordinal(),d=d3.scale.linear(),h=function(t){return t.label},f=function(t){return t.value},m=function(t){return t.color},p=function(t){return t.values.q1},g=function(t){return t.values.q2},v=function(t){return t.values.q3},_=function(t){return("mean"==A?b(t):g(t))-t.values.notch},y=function(t){return("mean"==A?b(t):g(t))+t.values.notch},b=function(t){return t.values.mean},M=function(t){return t.values.wl[Y]},x=function(t){return t.values.wu[Y]},w=function(t){return t.values.min},k=function(t){return t.values.max},L=function(t){return t.values.dev},S=function(t){return t.values.observations},T=!1,Y="iqr",D=!1,C=!1,E=!1,A=!1,O=!0,j=.7,N=!0,H="scott",V=!0,P=50,F=3,I=i.utils.defaultColor(),R=null,W=d3.dispatch("elementMouseover","elementMouseout","elementMousemove","renderEnd"),z=250,B=null;function U(t,e){void 0===e&&(e="scott");var n=function(t){var e=t.sort(d3.ascending),n=(d3.quantile(e,.75)-d3.quantile(e,.25))/1.349;return d3.min([d3.deviation(e),n])}(t),i=t.length;return"scott"===e?Math.pow(1.059*n*i,-.2):Math.pow(.9*n*i,-.2)}function G(t){function e(t,e){var n,i=t.map(function(t){return E&&Z.add(E(t)),f(t)}).sort(d3.ascending),r=d3.quantile(i,.25),a=d3.quantile(i,.75),o=a-r,s=a+1.5*o,l=r-1.5*o,u={iqr:d3.max([d3.min(i),d3.min(i.filter(function(t){return t>l}))]),minmax:d3.min(i),stddev:d3.mean(i)-d3.deviation(i)},c={iqr:d3.min([d3.max(i),d3.max(i.filter(function(t){return t<s}))]),minmax:d3.max(i),stddev:d3.mean(i)+d3.deviation(i)},h=d3.median(i),m=d3.mean(i),p=[];(void 0!==d3.beeswarm?(p=d3.beeswarm().data(t.map(function(t){return f(t)})).radius(F+1).orientation("vertical").side("symmetric").distributeOn(function(t){return d(t)}).arrange()).map(function(n,i){n.key=e,n.object_constancy=t[i].object_constancy,n.isOutlier=n.datum<u.iqr||n.datum>c.iqr,n.isOutlierStdDev=n.datum<u.stddev||n.datum>c.stddev,n.randX=Math.random()*j*(1==Math.floor(2*Math.random())?1:-1)}):i.forEach(function(t,n){p.push({object_constancy:t.object_constancy,datum:t,key:e,isOutlier:t<u.iqr||t>c.iqr,isOutlierStdDev:t<u.stddev||t>c.stddev,randX:Math.random()*j*(1==Math.floor(2*Math.random())?1:-1)})}),isNaN(parseFloat(H)))&&(n=-1!=["scott","silverman"].indexOf(H)?U(i,H):U(i));var g=function(t,e){return function(n){return e.map(function(e){var i=d3.mean(n,function(n){return t(e-n)});return{x:e,y:i}})}}(function(t){return function(e){return Math.abs(e/=t)<=1?.75*(1-e*e)/t:0}}(n),d.ticks(P)),v=V?function(t,e){if(e[0]===e[1])return t;var n=t.reduce(function(t,n){return n.x>=e[0]&&n.x<=e[1]&&t.push(n),t},[]);e[0]<n[0].x&&n.unshift({x:e[0],y:n[0].y});e[1]>n[n.length-1].x&&n.push({x:e[1],y:n[n.length-1].y});return n}(g(i),d3.extent(i)):g(i),_=d3.scale.linear().domain([0,d3.max(v,function(t){return t.y})]).clamp(!0);K.push(_);var y={count:i.length,num_outlier:p.filter(function(t){return t.isOutlier}).length,sum:d3.sum(i),mean:m,q1:r,q2:h,q3:a,wl:u,wu:c,iqr:o,min:d3.min(i),max:d3.max(i),dev:d3.deviation(i),observations:p,key:e,kde:v,notch:1.57*o/Math.sqrt(i.length)};return E&&Q.push({key:e,values:y}),y}var n;if(t.forEach(function(t,e){t.object_constancy=e+"_"+f(t)+"_"+h(t)}),E){Z=d3.set();var i=d3.nest().key(function(t){return h(t)}).key(function(t){return E(t)}).rollup(function(t){return e(t,h(t[0]))}).entries(t);Z=Z.values();for(var r=i.map(function(t){return t.key}),a=[],o=0;o<r.length;o++)for(var s=0;s<Z.length;s++)a.push(r[o]+"_"+Z[s]);Z=a,n=[],i.forEach(function(t){t.values.forEach(function(e){e.key=t.key+"_"+e.key}),n.push.apply(n,t.values)})}else n=d3.nest().key(function(t){return h(t)}).rollup(function(t,n){return e(t)}).entries(t);return n}function $(t){return"iqr"==Y&&t.isOutlier||"stddev"==Y&&t.isOutlierStdDev}var q,J,X,Z=d3.set(),K=[],Q=[],tt=i.utils.renderWatch(W,z);function et(u){return tt.reset(),u.each(function(u){J=s-o.left-o.right,X=l-o.top-o.bottom,R=d3.select(this),i.utils.initSVG(R),d.domain(r||d3.extent(u.map(function(t){return f(t)}))).nice().range(a||[X,0]),void 0===q&&(q=G(u)),c.rangeBands(n||[0,J],.1).domain(e||E&&!N?Z:q.map(function(t){return t.key}));var h=R.selectAll("g.nv-wrap").data([q]);h.enter().append("g").attr("class","nvd3 nv-wrap");h.watchTransition(tt,"nv-wrap: wrap").attr("transform","translate("+o.left+","+o.top+")");var Y,j=h.selectAll(".nv-distroplot-x-group").data(function(t){return t});j.each(function(t,e){d3.select(this).selectAll("line.nv-distroplot-middle").datum(t)}),Y=j.enter().append("g").attr("class","nv-distroplot-x-group").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).style("fill",function(t,e){return m(t)||I(t,e)}).style("stroke",function(t,e){return m(t)||I(t,e)}),j.exit().remove();var H=function(){return c.rangeBand()},V=function(){return d3.min([B,.9*H()])},P=function(){return V()/2},z=function(){return P()-V()/2},U=function(){return P()-V()/5},Q=function(){return P()+V()/5};Y.attr("transform",function(t){return"translate("+(c(t.key)+.5*(H()-V()))+", 0)"}),j.watchTransition(tt,"nv-distroplot-x-group: distroplots").style("stroke-opacity",1).style("fill-opacity",.5).attr("transform",function(t){return"translate("+(c(t.key)+.5*(H()-V()))+", 0)"}),K.map(function(t){t.range([V()/2,0])}),t||(O=!1,T||(T="random")),Y.each(function(t,e){var n=d3.select(this);[M,x].forEach(function(t){var e=t===M?"low":"high";n.append("line").style("opacity",function(){return D?"1":"0"}).attr("class","nv-distroplot-whisker nv-distroplot-"+e),n.append("line").style("opacity",function(){return D?"0":"1"}).attr("class","nv-distroplot-tick nv-distroplot-"+e)})}),[M,x].forEach(function(e){var n=e===M?"low":"high",i=e===M?p:v;j.select("line.nv-distroplot-whisker.nv-distroplot-"+n).watchTransition(tt,"nv-distroplot-x-group: distroplots").attr("x1",P()).attr("y1",function(n){return d("violin"!=t?e(n):g(n))}).attr("x2",P()).attr("y2",function(e){return d("box"==t?i(e):g(e))}).style("opacity",function(){return D?"0":"1"}),j.select("line.nv-distroplot-tick.nv-distroplot-"+n).watchTransition(tt,"nv-distroplot-x-group: distroplots").attr("x1",function(e){return"violin"!=t?U():P()}).attr("y1",function(n,i){return d("violin"!=t?e(n):g(n))}).attr("x2",function(e){return"violin"!=t?Q():P()}).attr("y2",function(n,i){return d("violin"!=t?e(n):g(n))}).style("opacity",function(){return D?"0":"1"})}),[M,x].forEach(function(t){var e=t===M?"low":"high";Y.selectAll(".nv-distroplot-"+e).on("mouseover",function(n,i,r){d3.select(this.parentNode).selectAll("line.nv-distroplot-"+e).classed("hover",!0),W.elementMouseover({value:"low"==e?"Lower whisker":"Upper whisker",series:{key:t(n).toFixed(2),color:m(n)||I(n,r)},e:d3.event})}).on("mouseout",function(n,i,r){d3.select(this.parentNode).selectAll("line.nv-distroplot-"+e).classed("hover",!1),W.elementMouseout({value:"low"==e?"Lower whisker":"Upper whisker",series:{key:t(n).toFixed(2),color:m(n)||I(n,r)},e:d3.event})}).on("mousemove",function(t,e){W.elementMousemove({e:d3.event})})}),Y.each(function(t,e){var n=d3.select(this);["left","right"].forEach(function(t){["line","area"].forEach(function(e){n.append("path").attr("class","nv-distribution-"+e+" nv-distribution-"+t).attr("transform","rotate(90,0,0) translate(0,"+("left"==t?-V():0)+")"+("left"==t?"":" scale(1,-1)"))})}),Y.selectAll(".nv-distribution-line").style("fill","none"),Y.selectAll(".nv-distribution-area").style("stroke","none").style("opacity",.7)}),j.each(function(e,n){var i=d3.select(this),r="box"==t?function(t,e,n,i){var r="mean"==A?b(i):g(i);return C?[{x:n,y:d(p(i))},{x:t,y:d(p(i))},{x:t,y:d(_(i))},{x:e,y:d(r)},{x:t,y:d(y(i))},{x:t,y:d(v(i))},{x:n,y:d(v(i))}]:[{x:n,y:d(p(i))},{x:t,y:d(p(i))},{x:t,y:d(r)},{x:t,y:d(r)},{x:t,y:d(r)},{x:t,y:d(v(i))},{x:n,y:d(v(i))}]}(z(),U(),P(),e):e.values.kde;i.selectAll("path").datum(r);var a=K[n],o="box"==t?"linear":"basis";"box"==t||"violin"==t?["left","right"].forEach(function(e){j.selectAll(".nv-distribution-line.nv-distribution-"+e).attr("d",d3.svg.line().x(function(e){return"box"==t?e.y:d(e.x)}).y(function(e){return"box"==t?e.x:a(e.y)}).interpolate(o)).attr("transform","rotate(90,0,0) translate(0,"+("left"==e?-V():0)+")"+("left"==e?"":" scale(1,-1)")).style("opacity",t?"1":"0"),j.selectAll(".nv-distribution-area.nv-distribution-"+e).attr("d",d3.svg.area().x(function(e){return"box"==t?e.y:d(e.x)}).y(function(e){return"box"==t?e.x:a(e.y)}).y0(V()/2).interpolate(o)).attr("transform","rotate(90,0,0) translate(0,"+("left"==e?-V():0)+")"+("left"==e?"":" scale(1,-1)")).style("opacity",t?"1":"0")}):(j.selectAll(".nv-distribution-area").watchTransition(tt,"nv-distribution-area: distroplots").style("opacity",t?"1":"0"),j.selectAll(".nv-distribution-line").watchTransition(tt,"nv-distribution-line: distroplots").style("opacity",t?"1":"0"))}),j.selectAll("path").on("mouseover",function(t,e,n){t=d3.select(this.parentNode).datum(),d3.select(this).classed("hover",!0),W.elementMouseover({key:t.key,value:"Group "+t.key+" stats",series:[{key:"max",value:k(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q3",value:v(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q2",value:g(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q1",value:p(t).toFixed(2),color:m(t)||I(t,n)},{key:"min",value:w(t).toFixed(2),color:m(t)||I(t,n)},{key:"mean",value:b(t).toFixed(2),color:m(t)||I(t,n)},{key:"std. dev.",value:L(t).toFixed(2),color:m(t)||I(t,n)},{key:"count",value:t.values.count,color:m(t)||I(t,n)},{key:"num. outliers",value:t.values.num_outlier,color:m(t)||I(t,n)}],data:t,index:e,e:d3.event})}).on("mouseout",function(t,e,n){d3.select(this).classed("hover",!1),t=d3.select(this.parentNode).datum(),W.elementMouseout({key:t.key,value:"Group "+t.key+" stats",series:[{key:"max",value:k(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q3",value:v(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q2",value:g(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q1",value:p(t).toFixed(2),color:m(t)||I(t,n)},{key:"min",value:w(t).toFixed(2),color:m(t)||I(t,n)},{key:"mean",value:b(t).toFixed(2),color:m(t)||I(t,n)},{key:"std. dev.",value:L(t).toFixed(2),color:m(t)||I(t,n)},{key:"count",value:t.values.count,color:m(t)||I(t,n)},{key:"num. outliers",value:t.values.num_outlier,color:m(t)||I(t,n)}],data:t,index:e,e:d3.event})}).on("mousemove",function(t,e){W.elementMousemove({e:d3.event})}),Y.append("line").attr("class",function(t){return"nv-distroplot-middle"}),j.selectAll("line.nv-distroplot-middle").watchTransition(tt,"nv-distroplot-x-group: distroplots line").attr("x1",C?U:"violin"!=t?z:U()).attr("y1",function(t,e,n){return d("mean"==A?b(t):g(t))}).attr("x2",C?Q:"violin"!=t?function(){return P()+V()/2}:Q()).attr("y2",function(t,e){return d("mean"==A?b(t):g(t))}).style("opacity",A?"1":"0"),j.selectAll(".nv-distroplot-middle").on("mouseover",function(t,e,n){if(0!=d3.select(this).style("opacity")){var i=d3.select(this.parentNode).style("fill");d3.select(this).classed("hover",!0),W.elementMouseover({value:"mean"==A?"Mean":"Median",series:{key:"mean"==A?b(t).toFixed(2):g(t).toFixed(2),color:i},e:d3.event})}}).on("mouseout",function(t,e,n){if(0!=d3.select(this).style("opacity")){d3.select(this).classed("hover",!1);var i=d3.select(this.parentNode).style("fill");W.elementMouseout({value:"mean"==A?"Mean":"Median",series:{key:"mean"==A?b(t).toFixed(2):g(t).toFixed(2),color:i},e:d3.event})}}).on("mousemove",function(t,e){W.elementMousemove({e:d3.event})});var et=j.selectAll("g.nv-distroplot-observation").data(function(t){return S(t)},function(t){return t.object_constancy}),nt=et.enter().append("g").attr("class","nv-distroplot-observation");nt.append("circle").style({opacity:0}),nt.append("line").style("stroke-width",1).style({stroke:d3.rgb(85,85,85),opacity:0}),et.exit().remove(),et.attr("class",function(e){return"nv-distroplot-observation "+($(e)&&"box"==t?"nv-distroplot-outlier":"nv-distroplot-non-outlier")}),"line"==T?j.selectAll("g.nv-distroplot-observation line").watchTransition(tt,"nv-distrolot-x-group: nv-distoplot-observation").attr("x1",U()+V()/4).attr("x2",Q()-V()/4).attr("y1",function(t){return d(t.datum)}).attr("y2",function(t){return d(t.datum)}):(j.selectAll("g.nv-distroplot-observation circle").watchTransition(tt,"nv-distroplot: nv-distroplot-observation").attr("cy",function(t){return d(t.datum)}).attr("r",F),j.selectAll("g.nv-distroplot-observation circle").watchTransition(tt,"nv-distroplot: nv-distroplot-observation").attr("cx",function(t){return"swarm"==T?t.x+V()/2:"random"==T?V()/2+t.randX*V()/2:V()/2})),!1!==T&&(O?(j.selectAll(".nv-distroplot-outlier "+("line"==T?"line":"circle")).watchTransition(tt,"nv-distroplot: nv-distroplot-observation").style("opacity",1),j.selectAll(".nv-distroplot-non-outlier "+("line"==T?"line":"circle")).watchTransition(tt,"nv-distroplot: nv-distroplot-observation").style("opacity",0)):j.selectAll("line"==T?"line":"circle").watchTransition(tt,"nv-distroplot: nv-distroplot-observation").style("opacity",1)),j.selectAll(".nv-distroplot-observation"+("line"==T?" circle":" line")).watchTransition(tt,"nv-distroplot: nv-distoplot-observation").style("opacity",0),j.selectAll(".nv-distroplot-observation").on("mouseover",function(e,n,i){var r=d3.select(this);if(!O||"box"!=t||$(e)){var a=d3.select(this.parentNode).style("fill");r.classed("hover",!0),W.elementMouseover({value:"box"==t&&$(e)?"Outlier":"Observation",series:{key:e.datum.toFixed(2),color:a},e:d3.event})}}).on("mouseout",function(e,n,i){var r=d3.select(this),a=d3.select(this.parentNode).style("fill");r.classed("hover",!1),W.elementMouseout({value:"box"==t&&$(e)?"Outlier":"Observation",series:{key:e.datum.toFixed(2),color:a},e:d3.event})}).on("mousemove",function(t,e){W.elementMousemove({e:d3.event})})}),tt.renderEnd("nv-distroplot-x-group immediate"),et}return et.dispatch=W,et.options=i.utils.optionsFunc.bind(et),et._options=Object.create({},{width:{get:function(){return s},set:function(t){s=t}},height:{get:function(){return l},set:function(t){l=t}},maxBoxWidth:{get:function(){return B},set:function(t){B=t}},x:{get:function(){return h},set:function(t){h=t}},y:{get:function(){return f},set:function(t){f=t}},plotType:{get:function(){return t},set:function(e){t=e}},observationType:{get:function(){return T},set:function(t){T=t}},whiskerDef:{get:function(){return Y},set:function(t){Y=t}},notchBox:{get:function(){return C},set:function(t){C=t}},hideWhiskers:{get:function(){return D},set:function(t){D=t}},colorGroup:{get:function(){return E},set:function(t){E=t}},centralTendency:{get:function(){return A},set:function(t){A=t}},bandwidth:{get:function(){return H},set:function(t){H=t}},clampViolin:{get:function(){return V},set:function(t){V=t}},resolution:{get:function(){return P},set:function(t){P=t}},xScale:{get:function(){return c},set:function(t){c=t}},yScale:{get:function(){return d},set:function(t){d=t}},showOnlyOutliers:{get:function(){return O},set:function(t){O=t}},jitter:{get:function(){return j},set:function(t){j=t}},squash:{get:function(){return N},set:function(t){N=t}},pointSize:{get:function(){return F},set:function(t){F=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return r},set:function(t){r=t}},xRange:{get:function(){return n},set:function(t){n=t}},yRange:{get:function(){return a},set:function(t){a=t}},recalcData:{get:function(){q=G(R.datum())}},itemColor:{get:function(){return m},set:function(t){m=t}},id:{get:function(){return u},set:function(t){u=t}},margin:{get:function(){return o},set:function(t){o.top=void 0!==t.top?t.top:o.top,o.right=void 0!==t.right?t.right:o.right,o.bottom=void 0!==t.bottom?t.bottom:o.bottom,o.left=void 0!==t.left?t.left:o.left}},color:{get:function(){return I},set:function(t){I=i.utils.getColor(t)}},duration:{get:function(){return z},set:function(t){z=t,tt.reset(z)}}}),i.utils.initOptions(et),et},i.models.distroPlotChart=function(){"use strict";var t,e,n=i.models.distroPlot(),r=i.models.axis(),a=i.models.axis(),o={top:25,right:10,bottom:40,left:60},s=null,l=null,u=i.utils.getColor(),c=!0,d=!0,h=!1,f=!1,m=!1,p=!1,g=i.models.tooltip(),v="No Data Available.",_=d3.dispatch("stateChange","beforeUpdate","renderEnd"),y=500;r.orient("bottom").showMaxMin(!1).tickFormat(function(t){return t}),a.orient(h?"right":"left").tickFormat(d3.format(",.1f")),g.duration(0);var b,M,x,w,k,L,S,T=i.utils.renderWatch(_,y);o.top;function Y(t){return!function(t,e){if(t.length!==e.length)return!1;for(var n=t.length;n--;)if("object_constancy"in t[n]&&delete t[n].object_constancy,"object_constancy"in e[n]&&delete e[n].object_constancy,!D(t[n],e[n]))return!1;return!0}(t,S)&&(S=JSON.parse(JSON.stringify(t)),!0)}function D(t,e){var n=Object.getOwnPropertyNames(t),i=Object.getOwnPropertyNames(e);if(n.length!=i.length)return!1;for(var r=0;r<n.length;r++){var a=n[r];if(t[a]!==e[a])return!1}return!0}function C(u){return T.reset(),T.models(n),c&&T.models(r),d&&T.models(a),u.each(function(u){var m=d3.select(this);i.utils.initSVG(m);var p=(s||parseInt(m.style("width"))||960)-o.left-o.right,g=(l||parseInt(m.style("height"))||400)-o.top-o.bottom;if(void 0===S&&(S=JSON.parse(JSON.stringify(u))),C.update=function(){_.beforeUpdate();var t=n.options();(b!==t.colorGroup()||M!==t.x()||x!==t.y()||k!==t.bandwidth()||w!==t.resolution()||L!==t.clampViolin()||Y(u))&&n.recalcData(),m.transition().duration(y).call(C)},C.container=this,"function"!=typeof d3.beeswarm&&"swarm"==C.options().observationType()){o.left;return v='Please include the library https://github.com/Kcnarf/d3-beeswarm to use "swarm".',i.utils.noData(C,m),C}if(!u||!u.length)return i.utils.noData(C,m),C;m.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale().clamp(!0);var D=m.selectAll("g.nv-wrap.nv-distroPlot").data([u]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-distroPlot").append("g"),A=E.append("defs"),O=D.select("g");if(E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),E.append("g").attr("class","nv-distroWrap"),E.attr("transform","translate("+o.left+","+o.top+")"),O.watchTransition(T,"nv-wrap: wrap").attr("transform","translate("+o.left+","+o.top+")"),h&&O.select(".nv-y.nv-axis").attr("transform","translate("+p+",0)"),n.width(p).height(g),O.select(".nv-distroWrap").datum(u).transition().call(n),A.append("clipPath").attr("id","nv-x-label-clip-"+n.id()).append("rect"),O.select("#nv-x-label-clip-"+n.id()+" rect").attr("width",t.rangeBand()*(f?2:1)).attr("height",16).attr("x",-t.rangeBand()/(f?1:2)),c){r.scale(t).ticks(i.utils.calcTicksX(p/100,u)).tickSize(-g,0),O.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),O.select(".nv-x.nv-axis").call(r);var j=O.select(".nv-x.nv-axis").selectAll("g");f&&j.selectAll("text").attr("transform",function(t,e,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}d&&(a.scale(e).ticks(Math.floor(g/36)).tickSize(-p,0),O.select(".nv-y.nv-axis").call(a)),O.select(".nv-zeroLine line").attr("x1",0).attr("x2",p).attr("y1",e(0)).attr("y2",e(0)),b=n.options().colorGroup(),M=n.options().x(),x=n.options().y(),k=n.options().bandwidth(),w=n.options().resolution(),L=n.options().clampViolin()}),T.renderEnd("nv-distroplot chart immediate"),C}return n.dispatch.on("elementMouseover.tooltip",function(t){g.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){g.data(t).hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){g()}),C.dispatch=_,C.distroplot=n,C.xAxis=r,C.yAxis=a,C.tooltip=g,C.options=i.utils.optionsFunc.bind(C),C._options=Object.create({},{width:{get:function(){return s},set:function(t){s=t}},height:{get:function(){return l},set:function(t){l=t}},staggerLabels:{get:function(){return f},set:function(t){f=t}},showXAxis:{get:function(){return c},set:function(t){c=t}},showYAxis:{get:function(){return d},set:function(t){d=t}},tooltipContent:{get:function(){return g},set:function(t){g=t}},noData:{get:function(){return v},set:function(t){v=t}},defaultState:{get:function(){return defaultState},set:function(t){defaultState=t}},margin:{get:function(){return o},set:function(t){o.top=void 0!==t.top?t.top:o.top,o.right=void 0!==t.right?t.right:o.right,o.bottom=void 0!==t.bottom?t.bottom:o.bottom,o.left=void 0!==t.left?t.left:o.left}},duration:{get:function(){return y},set:function(t){y=t,T.reset(y),n.duration(y),r.duration(y),a.duration(y)}},color:{get:function(){return u},set:function(t){u=i.utils.getColor(t),n.color(u)}},rightAlignYAxis:{get:function(){return h},set:function(t){h=t,a.orient(t?"right":"left")}},xLabel:{get:function(){return m},set:function(t){m=t,r.axisLabel(m)}},yLabel:{get:function(){return p},set:function(t){p=t,a.axisLabel(p)}}}),i.utils.inheritOptions(C,n),i.utils.initOptions(C),C},i.models.focus=function(t){"use strict";t=t||i.models.line();var e,n,r=i.models.axis(),a=i.models.axis(),o=d3.svg.brush(),s={top:10,right:0,bottom:30,left:0},l=i.utils.defaultColor(),u=null,c=70,d=!0,h=!1,f=!1,m=null,p=250,g=d3.dispatch("brush","onBrush","renderEnd"),v=!0;t.interactive(!1),t.pointActive(function(t){return!1});var _=i.utils.renderWatch(g,p);function y(b){return _.reset(),_.models(t),d&&_.models(r),h&&_.models(a),b.each(function(_){var b=d3.select(this);i.utils.initSVG(b);var M=i.utils.availableWidth(u,b,s),x=c-s.top-s.bottom;y.update=function(){0===p?b.call(y):b.transition().duration(p).call(y)},y.container=this,e=t.xScale(),n=t.yScale();var w=b.selectAll("g.nv-focus").data([_]),k=w.enter().append("g").attr("class","nvd3 nv-focus").append("g"),L=w.select("g");w.attr("transform","translate("+s.left+","+s.top+")"),k.append("g").attr("class","nv-background").append("rect"),k.append("g").attr("class","nv-x nv-axis"),k.append("g").attr("class","nv-y nv-axis"),k.append("g").attr("class","nv-contentWrap"),k.append("g").attr("class","nv-brushBackground"),k.append("g").attr("class","nv-x nv-brush"),f&&L.select(".nv-y.nv-axis").attr("transform","translate("+M+",0)"),L.select(".nv-background rect").attr("width",M).attr("height",x),t.width(M).height(x).color(_.map(function(t,e){return t.color||l(t,e)}).filter(function(t,e){return!_[e].disabled}));var S=L.select(".nv-contentWrap").datum(_.filter(function(t){return!t.disabled}));d3.transition(S).call(t),o.x(e).on("brush",function(){C(v)}),o.on("brushend",function(){v||g.onBrush(o.empty()?e.domain():o.extent())}),m&&o.extent(m);var T=L.select(".nv-brushBackground").selectAll("g").data([m||o.extent()]),Y=T.enter().append("g");Y.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",x),Y.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",x);var D=L.select(".nv-x.nv-brush").call(o);function C(t){m=o.empty()?null:o.extent();var n=o.empty()?e.domain():o.extent();g.brush({extent:n,brush:o}),o.empty()||o.extent(m),T.data([o.empty()?e.domain():m]).each(function(t,n){var i=e(t[0])-e.range()[0],r=M-e(t[1]);d3.select(this).select(".left").attr("width",i<0?0:i),d3.select(this).select(".right").attr("x",e(t[1])).attr("width",r<0?0:r)}),t&&g.onBrush(n)}D.selectAll("rect").attr("height",x),D.selectAll(".resize").append("path").attr("d",function(t){var e=+("e"==t),n=e?1:-1,i=x/3;return"M"+.5*n+","+i+"A6,6 0 0 "+e+" "+6.5*n+","+(i+6)+"V"+(2*i-6)+"A6,6 0 0 "+e+" "+.5*n+","+2*i+"ZM"+2.5*n+","+(i+8)+"V"+(2*i-8)+"M"+4.5*n+","+(i+8)+"V"+(2*i-8)}),C(!0),L.select(".nv-background rect").attr("width",M).attr("height",x),d&&(r.scale(e)._ticks(i.utils.calcTicksX(M/100,_)).tickSize(-x,0),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")"),d3.transition(L.select(".nv-x.nv-axis")).call(r)),h&&(a.scale(n)._ticks(i.utils.calcTicksY(x/36,_)).tickSize(-M,0),d3.transition(L.select(".nv-y.nv-axis")).call(a)),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")")}),_.renderEnd("focus immediate"),y}return y.dispatch=g,y.content=t,y.brush=o,y.xAxis=r,y.yAxis=a,y.options=i.utils.optionsFunc.bind(y),y._options=Object.create({},{width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},showXAxis:{get:function(){return d},set:function(t){d=t}},showYAxis:{get:function(){return h},set:function(t){h=t}},brushExtent:{get:function(){return m},set:function(t){m=t}},syncBrushing:{get:function(){return v},set:function(t){v=t}},margin:{get:function(){return s},set:function(t){s.top=void 0!==t.top?t.top:s.top,s.right=void 0!==t.right?t.right:s.right,s.bottom=void 0!==t.bottom?t.bottom:s.bottom,s.left=void 0!==t.left?t.left:s.left}},duration:{get:function(){return p},set:function(e){p=e,_.reset(p),t.duration(p),r.duration(p),a.duration(p)}},color:{get:function(){return l},set:function(e){l=i.utils.getColor(e),t.color(l)}},interpolate:{get:function(){return t.interpolate()},set:function(e){t.interpolate(e)}},xTickFormat:{get:function(){return r.tickFormat()},set:function(t){r.tickFormat(t)}},yTickFormat:{get:function(){return a.tickFormat()},set:function(t){a.tickFormat(t)}},x:{get:function(){return t.x()},set:function(e){t.x(e)}},y:{get:function(){return t.y()},set:function(e){t.y(e)}},rightAlignYAxis:{get:function(){return f},set:function(t){f=t,a.orient(f?"right":"left")}}}),i.utils.inheritOptions(y,t),i.utils.initOptions(y),y},i.models.forceDirectedGraph=function(){"use strict";var t={top:2,right:0,bottom:2,left:0},e=400,n=32,r=null,a=d3.dispatch("renderEnd"),o=i.utils.getColor(["#000"]),s=i.models.tooltip(),l=null,u=.1,c=.9,d=30,h=-120,f=.1,m=.8,p=.1,g=5,v=function(t){},_=function(t){},y=d3.functor(0),b=d3.functor(0),M=i.utils.renderWatch(a);function x(a){return M.reset(),a.each(function(a){r=d3.select(this),i.utils.initSVG(r);var l=i.utils.availableWidth(e,r,t),y=i.utils.availableHeight(n,r,t);if(r.attr("width",l).attr("height",y),!(a&&a.links&&a.nodes))return i.utils.noData(x,r),x;r.selectAll(".nv-noData").remove(),r.selectAll("*").remove();var b=new Set;a.nodes.forEach(function(t){Object.keys(t).forEach(function(t){b.add(t)})});var M=d3.layout.force().nodes(a.nodes).links(a.links).size([l,y]).linkStrength(u).friction(c).linkDistance(d).charge(h).gravity(f).theta(m).alpha(p).start(),w=r.selectAll(".link").data(a.links).enter().append("line").attr("class","nv-force-link").style("stroke-width",function(t){return Math.sqrt(t.value)}),k=r.selectAll(".node").data(a.nodes).enter().append("g").attr("class","nv-force-node").call(M.drag);k.append("circle").attr("r",g).style("fill",function(t){return o(t)}).on("mouseover",function(t){r.select(".nv-series-"+t.seriesIndex+" .nv-distx-"+t.pointIndex).attr("y1",t.py),r.select(".nv-series-"+t.seriesIndex+" .nv-disty-"+t.pointIndex).attr("x2",t.px);var e=o(t);t.series=[],b.forEach(function(n){t.series.push({color:e,key:n,value:t[n]})}),s.data(t).hidden(!1)}).on("mouseout",function(t){s.hidden(!0)}),s.headerFormatter(function(t){return"Node"}),_(w),v(k),M.on("tick",function(){w.attr("x1",function(t){return t.source.x}).attr("y1",function(t){return t.source.y}).attr("x2",function(t){return t.target.x}).attr("y2",function(t){return t.target.y}),k.attr("transform",function(t){return"translate("+t.x+", "+t.y+")"})})}),x}return x.options=i.utils.optionsFunc.bind(x),x._options=Object.create({},{width:{get:function(){return e},set:function(t){e=t}},height:{get:function(){return n},set:function(t){n=t}},linkStrength:{get:function(){return u},set:function(t){u=t}},friction:{get:function(){return c},set:function(t){c=t}},linkDist:{get:function(){return d},set:function(t){d=t}},charge:{get:function(){return h},set:function(t){h=t}},gravity:{get:function(){return f},set:function(t){f=t}},theta:{get:function(){return m},set:function(t){m=t}},alpha:{get:function(){return p},set:function(t){p=t}},radius:{get:function(){return g},set:function(t){g=t}},x:{get:function(){return y},set:function(t){y=d3.functor(t)}},y:{get:function(){return b},set:function(t){b=d3.functor(t)}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},color:{get:function(){return o},set:function(t){o=i.utils.getColor(t)}},noData:{get:function(){return l},set:function(t){l=t}},nodeExtras:{get:function(){return v},set:function(t){v=t}},linkExtras:{get:function(){return _},set:function(t){_=t}}}),x.dispatch=a,x.tooltip=s,i.utils.initOptions(x),x},i.models.furiousLegend=function(){"use strict";var t={top:5,right:0,bottom:5,left:0},e=400,n=20,r=function(t){return t.key},a=function(t){return t},o=i.utils.getColor(),s=20,l=!0,u=28,c=!0,d=!0,h=!1,f=!1,m=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),p="classic";function g(v){function _(t,e){return"furious"!=p?"#000":f?t.disengaged?o(t,e):"#fff":f?void 0:t.disabled?o(t,e):"#fff"}function y(t,e){return f&&"furious"==p?t.disengaged?"#fff":o(t,e):t.disabled?"#fff":o(t,e)}return v.each(function(g){var v=e-t.left-t.right,b=d3.select(this);i.utils.initSVG(b);var M=b.selectAll("g.nv-legend").data([g]),x=(M.enter().append("g").attr("class","nvd3 nv-legend").append("g"),M.select("g"));M.attr("transform","translate("+t.left+","+t.top+")");var w,k=x.selectAll(".nv-series").data(function(t){return"furious"!=p?t:t.filter(function(t){return!!f||!t.disengaged})}),L=k.enter().append("g").attr("class","nv-series");if("classic"==p)L.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),w=k.select("circle");else if("furious"==p){L.append("rect").style("stroke-width",2).attr("class","nv-legend-symbol").attr("rx",3).attr("ry",3),w=k.select("rect"),L.append("g").attr("class","nv-check-box").property("innerHTML",'<path d="M0.5,5 L22.5,5 L22.5,26.5 L0.5,26.5 L0.5,5 Z" class="nv-box"></path><path d="M5.5,12.8618467 L11.9185089,19.2803556 L31,0.198864511" class="nv-check"></path>').attr("transform","translate(-10,-8)scale(0.5)"),k.select(".nv-check-box").each(function(t,e){d3.select(this).selectAll("path").attr("stroke",_(t,e))})}L.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");var S,T=k.select("text.nv-legend-text");switch(k.on("mouseover",function(t,e){m.legendMouseover(t,e)}).on("mouseout",function(t,e){m.legendMouseout(t,e)}).on("click",function(t,e){m.legendClick(t,e);var n=k.data();if(d){if("classic"==p)h?(n.forEach(function(t){t.disabled=!0}),t.disabled=!1):(t.disabled=!t.disabled,n.every(function(t){return t.disabled})&&n.forEach(function(t){t.disabled=!1}));else if("furious"==p)if(f)t.disengaged=!t.disengaged,t.userDisabled=void 0==t.userDisabled?!!t.disabled:t.userDisabled,t.disabled=t.disengaged||t.userDisabled;else if(!f){t.disabled=!t.disabled,t.userDisabled=t.disabled,n.filter(function(t){return!t.disengaged}).every(function(t){return t.userDisabled})&&n.forEach(function(t){t.disabled=t.userDisabled=!1})}m.stateChange({disabled:n.map(function(t){return!!t.disabled}),disengaged:n.map(function(t){return!!t.disengaged})})}}).on("dblclick",function(t,e){if(("furious"!=p||!f)&&(m.legendDblclick(t,e),d)){var n=k.data();n.forEach(function(t){t.disabled=!0,"furious"==p&&(t.userDisabled=t.disabled)}),t.disabled=!1,"furious"==p&&(t.userDisabled=t.disabled),m.stateChange({disabled:n.map(function(t){return!!t.disabled})})}}),k.classed("nv-disabled",function(t){return t.userDisabled}),k.exit().remove(),T.attr("fill",_).text(function(t){return a(r(t))}),p){case"furious":S=23;break;case"classic":S=20}if(l){var Y=[];k.each(function(t,e){var n,o;if(a(r(t))&&a(r(t)).length>s){var l=a(r(t)).substring(0,s);n=d3.select(this).select("text").text(l+"..."),d3.select(this).append("svg:title").text(a(r(t)))}else n=d3.select(this).select("text");try{if((o=n.node().getComputedTextLength())<=0)throw Error()}catch(t){o=i.utils.calcApproxTextWidth(n)}Y.push(o+u)});for(var D=0,C=0,E=[];C<v&&D<Y.length;)E[D]=Y[D],C+=Y[D++];for(0===D&&(D=1);C>v&&D>1;){E=[],D--;for(var A=0;A<Y.length;A++)Y[A]>(E[A%D]||0)&&(E[A%D]=Y[A]);C=E.reduce(function(t,e,n,i){return t+e})}for(var O=[],j=0,N=0;j<D;j++)O[j]=N,N+=E[j];k.attr("transform",function(t,e){return"translate("+O[e%D]+","+(5+Math.floor(e/D)*S)+")"}),c?x.attr("transform","translate("+(e-t.right-C)+","+t.top+")"):x.attr("transform","translate(0,"+t.top+")"),n=t.top+t.bottom+Math.ceil(Y.length/D)*S}else{var H,V=5,P=5,F=0;k.attr("transform",function(n,i){var r=d3.select(this).select("text").node().getComputedTextLength()+u;return H=P,e<t.left+t.right+H+r&&(P=H=5,V+=S),(P+=r)>F&&(F=P),"translate("+H+","+V+")"}),x.attr("transform","translate("+(e-t.right-F)+","+t.top+")"),n=t.top+t.bottom+V+15}"furious"==p&&w.attr("width",function(t,e){return T[0][e].getComputedTextLength()+27}).attr("height",18).attr("y",-9).attr("x",-15),w.style("fill",y).style("stroke",function(t,e){return t.color||o(t,e)})}),g}return g.dispatch=m,g.options=i.utils.optionsFunc.bind(g),g._options=Object.create({},{width:{get:function(){return e},set:function(t){e=t}},height:{get:function(){return n},set:function(t){n=t}},key:{get:function(){return r},set:function(t){r=t}},keyFormatter:{get:function(){return a},set:function(t){a=t}},align:{get:function(){return l},set:function(t){l=t}},rightAlign:{get:function(){return c},set:function(t){c=t}},maxKeyLength:{get:function(){return s},set:function(t){s=t}},padding:{get:function(){return u},set:function(t){u=t}},updateState:{get:function(){return d},set:function(t){d=t}},radioButtonMode:{get:function(){return h},set:function(t){h=t}},expanded:{get:function(){return f},set:function(t){f=t}},vers:{get:function(){return p},set:function(t){p=t}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},color:{get:function(){return o},set:function(t){o=i.utils.getColor(t)}}}),i.utils.initOptions(g),g},i.models.heatMap=function(){"use strict";var t,e,n,r,a,o,s,l,u,c={top:0,right:0,bottom:0,left:0},d=960,h=500,f=Math.floor(1e4*Math.random()),m=d3.scale.ordinal(),p=d3.scale.ordinal(),g=!1,v=function(t){return t.x},_=function(t){return t.y},y=function(t){return t.value},b=!0,M=function(t){return"number"==typeof t?t.toFixed(0):t},x=!1,w=2,k=4,L=!1,S=!0,T=i.utils.defaultColor(),Y=i.utils.defaultColor(),D="#bcbcbc",C="",E=5,A=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),O=250,j=function(t){return B/3},N=function(t){return U/3},H=!1;function V(t){var e=d3.median(t),n=t.map(function(t){return Math.abs(t-e)});return d3.median(n)}function P(t){var e=L?ot(t):y(t);return F()&&!isNaN(e)||void 0!==e?g(e):D}function F(){return"number"==typeof Z[0]}function I(t){if(-1!=["centerRow","robustCenterRow","centerScaleRow","robustCenterScaleRow","centerColumn","robustCenterColumn","centerScaleColumn","robustCenterScaleColumn","centerAll","robustCenterAll","centerScaleAll","robustCenterScaleAll"].indexOf(L)){Object.keys(J),Object.keys(X);var e=!!L.includes("Scale"),n=L.includes("robust")?"median":"mean",i=L.includes("Row")?"row":L.includes("Column")?"col":null,r=function(t,e){var n={};return t.forEach(function(t,i){"row"==e?(at(t)in n||(n[at(t)]=[]),n[at(t)].push(y(t))):"col"==e?(rt(t)in n||(n[rt(t)]=[]),n[rt(t)].push(y(t))):null==e&&(0 in n||(n[0]=[]),n[0].push(y(t)))}),n}(t,i),a={},o={};for(var s in r)a[s]="mean"==n?d3.mean(r[s]):d3.median(r[s]),e&&(o[s]="mean"==n?d3.deviation(r[s]):V(r[s]));t.forEach(function(t,n){if(F()){if("row"==i)var r=at(t);else if("col"==i)r=rt(t);else if(null==i)r=0;var s=y(t)-a[r];t._cellPos.norm=e?s/o[r]:s}else t._cellPos.norm=y(t)})}else L=!1;return t}function R(t){J={},X={},Z=[],K=[],Q=[],tt=[];var e,n=[],i={},r=0,a=0,l=0;t.forEach(function(t){var u=v(t),c=_(t),d=y(t);u in J||(J[u]=r,r++,i[u]={},"function"==typeof o&&K.push(o(t))),c in X||(X[c]=a,a++,i[u][c]={},"function"==typeof s&&Q.push(s(t))),-1==Z.indexOf(d)&&Z.push(d),t._cellPos={idx:l,ix:J[u],iy:X[c]},l++,!function(t,e){var n=JSON.stringify(e);return t.some(function(t){return JSON.stringify(t)===n})}(tt,e=[u,c])?(tt.push(e),i[u][c]=t):-1==n.indexOf(u+c)&&(n.push(u+c),console.warn("The row/column position "+u+"/"+c+" has multiple values; ensure each cell has only a single value."))}),Z=Z.sort();var u=[];return Object.keys(X).forEach(function(t){Object.keys(J).forEach(function(e){var n=i[e][t];if(n)u.push(n);else{var r={idx:l,ix:J[e],iy:X[t]};l++,u.push({_cellPos:r})}})}),L?I(u):u}function W(){d3.selectAll(".cell-hover").classed("cell-hover",!1),d3.selectAll(".no-hover").classed("no-hover",!1),d3.selectAll(".row-hover").classed("row-hover",!1),d3.selectAll(".column-hover").classed("column-hover",!1)}var z,B,U,G=function(t){var e=M(L?ot(t):y(t));return F()&&!isNaN(e)||void 0!==e?e:C};function $(t){return Object.keys(t).sort(function(e,n){return t[e]-t[n]})}function q(t,e){return Object.keys(t).filter(function(n){return t[n]===e})[0]}var J={},X={},Z=[],K=[],Q=[],tt=[],et=i.utils.renderWatch(A,O),nt=["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],it=function(t){return t._cellPos},rt=function(t){return it(t).ix},at=function(t){return it(t).iy},ot=function(t){return it(t).norm},st=function(t){return it(t).idx};function lt(f){return et.reset(),f.each(function(f){z=R(f);var v=d-c.left-c.right,_=h-c.top-c.bottom;U=v/Object.keys(J).length,B=x?U/x:_/Object.keys(X).length,x&&(_=B*Object.keys(X).length-c.top-c.bottom),t=d3.select(this),i.utils.initSVG(t),m.domain(e||$(J)).rangeBands(r||[0,v-k/2]),p.domain(n||$(X)).rangeBands(a||[0,_-k/2]),(g=F()?d3.scale.quantize():d3.scale.ordinal()).domain(u||(F()?L?d3.extent(z,function(t){return ot(t)}):d3.extent(Z):F()?void 0:Z)).range(l||nt);var M=t.selectAll("g.nv-heatMapWrap").data([z]),D=M.enter().append("g").attr("class","nvd3 nv-heatMapWrap");D.append("g").attr("class","cellWrap"),M.watchTransition(et,"nv-wrap: heatMapWrap").attr("transform","translate("+c.left+","+c.top+")");D.append("g").attr("class","cellGrid").style("opacity",1e-6);var C=M.select(".cellGrid").selectAll(".gridLines.verticalGrid").data(Object.values(J).concat([Object.values(J).length]));C.enter().append("line").attr("class","gridLines verticalGrid"),C.exit().remove();var O=M.select(".cellGrid").selectAll(".gridLines.horizontalGrid").data(Object.values(X).concat([Object.values(X).length]));O.enter().append("line").attr("class","gridLines horizontalGrid"),O.exit().remove();var V=M.select(".cellWrap").selectAll(".nv-cell").data(function(t){return t},function(t){return st(t)}),I=(D.append("g").attr("class","xMetaWrap").attr("transform",function(){return"translate(0,"+(-j()-k-E)+")"}),M.select(".xMetaWrap").selectAll(".x-meta").data(K)),tt=(I.enter().append("rect").attr("class","x-meta meta").attr("width",U-k).attr("height",j()).attr("transform","translate(0,0)").attr("fill",function(t){return T(t)}),D.append("g").attr("class","yMetaWrap").attr("transform",function(t,e){return"translate("+(-N()-k-E)+",0)"}),M.select(".yMetaWrap").selectAll(".y-meta").data(Q));tt.enter().append("rect").attr("class","y-meta meta").attr("width",N()).attr("height",B-k).attr("transform",function(t,e){return"translate(0,0)"}).attr("fill",function(t,e){return Y(t)});I.exit().remove(),tt.exit().remove();var it=V.enter().append("g").style("opacity",1e-6).attr("transform",function(t){return"translate(0,"+at(t)*B+")"}).attr("data-row",function(t){return at(t)}).attr("data-column",function(t){return rt(t)});it.append("rect"),it.append("text").attr("text-anchor","middle").attr("dy",4).attr("class","cell-text"),V.selectAll("rect").watchTransition(et,"heatMap: rect").attr("width",U-k).attr("height",B-k).attr("rx",w).attr("ry",w).style("stroke",function(t){return P(t)}),V.attr("class",function(t){return isNaN(y(t))?"nv-cell cell-missing":"nv-cell"}).watchTransition(et,"heatMap: cells").style({opacity:1,fill:function(t){return P(t)}}).attr("transform",function(t){return"translate("+rt(t)*U+","+at(t)*B+")"}).attr("class",function(t){return isNaN(y(t))?"nv-cell cell-missing":"nv-cell"}),V.exit().remove(),V.selectAll("text").watchTransition(et,"heatMap: cells text").text(function(t){return G(t)}).attr("x",function(t){return(U-k)/2}).attr("y",function(t){return(B-k)/2}).style("fill",function(t){return function(t){if(S){var e=d3.rgb(t);return(299*e.r+587*e.g+114*e.b)/1e3>=128?"#404040":"#EDEDED"}return"black"}(P(t))}).style("opacity",function(){return b?1:0}),M.selectAll(".verticalGrid").watchTransition(et,"heatMap: gridLines").attr("y1",0).attr("y2",_-k).attr("x1",function(t){return t*U-k/2}).attr("x2",function(t){return t*U-k/2});var lt=Object.keys(X).length;M.selectAll(".horizontalGrid").watchTransition(et,"heatMap: gridLines").attr("x1",function(t){return 0==t||t==lt?-k:0}).attr("x2",function(t){return 0==t||t==lt?v:v-k}).attr("y1",function(t){return t*B-k/2}).attr("y2",function(t){return t*B-k/2}),M.select(".cellGrid").watchTransition(et,"heatMap: gridLines").style({"stroke-width":k,opacity:function(){return H?1:1e-6}});M.selectAll(".x-meta"),M.selectAll(".y-meta");var ut=M.selectAll(".meta");I.watchTransition(et,"heatMap: xMetaRect").attr("width",U-k).attr("height",j()).attr("transform",function(t,e){return"translate("+e*U+",0)"}),tt.watchTransition(et,"heatMap: yMetaRect").attr("width",N()).attr("height",B-k).attr("transform",function(t,e){return"translate(0,"+e*B+")"}),M.select(".xMetaWrap").watchTransition(et,"heatMap: xMetaWrap").attr("transform",function(t,e){return"translate(0,"+(-j()-k-E)+")"}).style("opacity",function(){return!1!==o?1:0}),M.select(".yMetaWrap").watchTransition(et,"heatMap: yMetaWrap").attr("transform",function(t,e){return"translate("+(-N()-k-E)+",0)"}).style("opacity",function(){return!1!==s?1:0}),V.on("mouseover",function(t,e){var n=st(t),i=rt(t),r=at(t);d3.selectAll(".nv-cell").each(function(t){n==st(t)?(d3.select(this).classed("cell-hover",!0),d3.select(this).classed("no-hover",!1)):(d3.select(this).classed("no-hover",!0),d3.select(this).classed("cell-hover",!1)),i==rt(t)&&(d3.select(this).classed("no-hover",!1),d3.select(this).classed("column-hover",!0)),r==at(t)&&(d3.select(this).classed("no-hover",!1),d3.select(this).classed("row-hover",!0))}),d3.selectAll(".x-meta").each(function(t,e){e==i?(d3.select(this).classed("cell-hover",!0),d3.select(this).classed("no-hover",!1)):(d3.select(this).classed("no-hover",!0),d3.select(this).classed("cell-hover",!1))}),d3.selectAll(".y-meta").each(function(t,e){e==r?(d3.select(this).classed("cell-hover",!0),d3.select(this).classed("no-hover",!1)):(d3.select(this).classed("no-hover",!0),d3.select(this).classed("cell-hover",!1))}),A.elementMouseover({value:q(J,i)+" & "+q(X,r),series:{value:G(t),color:d3.select(this).select("rect").style("fill")},e:d3.event})}).on("mouseout",function(t,e){d3.select(this).select("rect").node().getBBox();var n=d3.mouse(d3.select(".nv-heatMap").node()),i=n[0],r=n[1];(i+k>=v||r+k>=_||i<0||r<0)&&(W(),A.elementMouseout({e:d3.event}))}).on("mousemove",function(t,e){A.elementMousemove({e:d3.event})}),ut.on("mouseover",function(t,e){var n=-1!=d3.select(this).attr("class").indexOf("x-meta");d3.selectAll(".nv-cell").each(function(t){n&&e==rt(t)?(d3.select(this).classed("column-hover",!0),d3.select(this).classed("no-hover",!1)):n||e-K.length!=at(t)?(d3.select(this).classed("no-hover",!0),d3.select(this).classed("column-hover",!1),d3.select(this).classed("row-hover",!1)):(d3.select(this).classed("row-hover",!0),d3.select(this).classed("no-hover",!1)),d3.select(this).classed("cell-hover",!1)}),d3.selectAll(".meta").classed("no-hover",!0),d3.select(this).classed("cell-hover",!0),d3.select(this).classed("no-hover",!1),A.elementMouseover({value:n?"Column meta":"Row meta",series:{value:t,color:d3.select(this).style("fill")}})}).on("mouseout",function(t,e){var n=-1!=d3.select(this).attr("class").indexOf("x-meta"),i=(d3.select(this).node().getBBox(),d3.mouse(d3.select(n?".xMetaWrap":".yMetaWrap").node())),r=i[0],a=i[1];(a<0||r<0||n&&r+k>=v||!n&&a+k>=_)&&(W(),A.elementMouseout({e:d3.event}))}).on("mousemove",function(t,e){A.elementMousemove({e:d3.event})})}),et.renderEnd("heatMap immediate"),lt}return lt.dispatch=A,lt.options=i.utils.optionsFunc.bind(lt),lt._options=Object.create({},{width:{get:function(){return d},set:function(t){d=t}},height:{get:function(){return h},set:function(t){h=t}},showCellValues:{get:function(){return b},set:function(t){b=t}},x:{get:function(){return v},set:function(t){v=t}},y:{get:function(){return _},set:function(t){_=t}},cellValue:{get:function(){return y},set:function(t){y=t}},missingDataColor:{get:function(){return D},set:function(t){D=t}},missingDataLabel:{get:function(){return C},set:function(t){C=t}},xScale:{get:function(){return m},set:function(t){m=t}},yScale:{get:function(){return p},set:function(t){p=t}},colorScale:{get:function(){return g},set:function(t){g=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return r},set:function(t){r=t}},yRange:{get:function(){return a},set:function(t){a=t}},colorRange:{get:function(){return l},set:function(t){l=t}},colorDomain:{get:function(){return u},set:function(t){u=t}},xMeta:{get:function(){return o},set:function(t){o=t}},yMeta:{get:function(){return s},set:function(t){s=t}},xMetaColorScale:{get:function(){return color},set:function(t){color=i.utils.getColor(t)}},yMetaColorScale:{get:function(){return color},set:function(t){color=i.utils.getColor(t)}},cellAspectRatio:{get:function(){return x},set:function(t){x=t}},cellRadius:{get:function(){return w},set:function(t){w=t}},cellHeight:{get:function(){return B}},cellWidth:{get:function(){return U}},normalize:{get:function(){return L},set:function(t){L=t}},cellBorderWidth:{get:function(){return k},set:function(t){k=t}},highContrastText:{get:function(){return S},set:function(t){S=t}},cellValueFormat:{get:function(){return M},set:function(t){M=t}},id:{get:function(){return f},set:function(t){f=t}},metaOffset:{get:function(){return E},set:function(t){E=t}},xMetaHeight:{get:function(){return j},set:function(t){j=t}},yMetaWidth:{get:function(){return N},set:function(t){N=t}},showGrid:{get:function(){return H},set:function(t){H=t}},margin:{get:function(){return c},set:function(t){c.top=void 0!==t.top?t.top:c.top,c.right=void 0!==t.right?t.right:c.right,c.bottom=void 0!==t.bottom?t.bottom:c.bottom,c.left=void 0!==t.left?t.left:c.left}},duration:{get:function(){return O},set:function(t){O=t,et.reset(O)}}}),i.utils.initOptions(lt),lt},i.models.heatMapChart=function(){"use strict";var t,e,n=i.models.heatMap(),r=i.models.legend(),a=(i.models.legend(),i.models.legend(),i.models.tooltip()),o=i.models.axis(),s=i.models.axis(),l={top:20,right:10,bottom:50,left:60},u=null,c=null,d=(i.utils.getColor(),!0),h=!1,f=!0,m=!0,p="left",g="top",v=0,_=null,y=d3.dispatch("beforeUpdate","renderEnd"),b=250;o.orient(g).showMaxMin(!1).tickFormat(function(t){return t}),s.orient(p).showMaxMin(!1).tickFormat(function(t){return t}),a.duration(0).headerEnabled(!0).keyFormatter(function(t,e){return o.tickFormat()(t,e)});var M=i.utils.renderWatch(y,b);function x(a){return M.reset(),M.models(n),M.models(o),M.models(s),a.each(function(a){var _=d3.select(this);i.utils.initSVG(_);var w=i.utils.availableWidth(u,_,l),k=i.utils.availableHeight(c,_,l);if(x.update=function(){y.beforeUpdate(),_.transition().duration(b).call(x)},x.container=this,!a||!a.length)return i.utils.noData(x,_),x;_.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale();var L=_.selectAll("g.nv-wrap").data([a]),S=L.enter().append("g").attr("class","nvd3 nv-wrap").append("g"),T=L.select("g");S.append("g").attr("class","nv-heatMap"),S.append("g").attr("class","nv-legendWrap"),S.append("g").attr("class","nv-x nv-axis"),S.append("g").attr("class","nv-y nv-axis"),T.attr("transform","translate("+l.left+","+l.top+")"),n.width(w).height(k),T.select(".nv-heatMap").datum(a.filter(function(t){return!t.disabled})).transition().call(n),n.cellAspectRatio()&&(k=n.cellHeight()*e.domain().length,n.height(k)),o.scale(t)._ticks(i.utils.calcTicksX(w/100,a)).tickSize(-k,0);var Y=T.select(".nv-x.nv-axis");Y.call(o).watchTransition(M,"heatMap: axisX").selectAll(".tick").style("opacity",function(){return f?1:0}),Y.selectAll("g").selectAll(".tick text").attr("transform",function(t,e,n){return"translate(0, "+(h?n%2==0?"5":"17":"0")+") rotate("+(0!=v?v:"0")+" 0,0)"}).style("text-anchor",v>0?"start":v<0?"end":"middle");var D=-5;if("function"==typeof n.xMeta()&&(Y.selectAll("text").style("text-anchor","middle"),D=-n.xMetaHeight()()/2-n.metaOffset()+3),"bottom"==g){if(Y.watchTransition(M,"heatMap: axisX").attr("transform","translate(0,"+(k-D)+")"),!1!==n.xMeta()){var C=k+n.metaOffset()+n.cellBorderWidth();T.select(".xMetaWrap").watchTransition(M,"heatMap: xMetaWrap").attr("transform",function(t,e){return"translate(0,"+C+")"})}}else Y.watchTransition(M,"heatMap: axisX").attr("transform","translate(0,"+D+")");s.scale(e)._ticks(i.utils.calcTicksY(k/36,a)).tickSize(-w,0);var E=T.select(".nv-y.nv-axis");E.call(s).watchTransition(M,"heatMap: axisY").selectAll(".tick").style("opacity",function(){return m?1:0});var A=-5;if("function"==typeof n.yMeta()&&(E.selectAll("text").style("text-anchor","middle"),A=-n.yMetaWidth()()/2-n.metaOffset()),"right"==p){if(E.attr("transform","translate("+(w-A)+",0)"),!1!==n.yMeta()){C=w+n.metaOffset()+n.cellBorderWidth();T.select(".yMetaWrap").watchTransition(M,"heatMap: yMetaWrap").attr("transform",function(t,e){return"translate("+C+",0)"})}}else E.attr("transform","translate("+A+",0)");var O=T.select(".nv-legendWrap");r.width(w).color(n.colorScale().range());var j=function(){var t=n.colorScale();return"string"==typeof t.domain()[0]?t.domain():t.range().map(function(e){var n=t.invertExtent(e);return null===n[0]&&(n[0]=t.domain()[0]),null===n[1]&&(n[1]=t.domain()[1]),n})}().map(function(t){return Array.isArray(t)?{key:t[0].toFixed(1)+" - "+t[1].toFixed(1)}:{key:t}});O.datum(j).call(r).attr("transform","translate(0,"+("top"==g?k:-30)+")"),O.watchTransition(M,"heatMap: nv-legendWrap").style("opacity",function(){return d?1:0})}),d3.selectAll(".nv-axis").selectAll("line").style("stroke-opacity",0),d3.select(".nv-y").select("path.domain").remove(),M.renderEnd("heatMap chart immediate"),x}return n.dispatch.on("elementMouseover.tooltip",function(t){a.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){a.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){a()}),x.dispatch=y,x.heatMap=n,x.legend=r,x.xAxis=o,x.yAxis=s,x.tooltip=a,x.options=i.utils.optionsFunc.bind(x),x._options=Object.create({},{width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},showLegend:{get:function(){return d},set:function(t){d=t}},noData:{get:function(){return _},set:function(t){_=t}},showXAxis:{get:function(){return f},set:function(t){f=t}},showYAxis:{get:function(){return m},set:function(t){m=t}},staggerLabels:{get:function(){return h},set:function(t){h=t}},rotateLabels:{get:function(){return v},set:function(t){v=t}},margin:{get:function(){return l},set:function(t){void 0!==t.top&&(l.top=t.top,t.top),l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},duration:{get:function(){return b},set:function(t){b=t,M.reset(b),n.duration(b),o.duration(b),s.duration(b)}},alignYAxis:{get:function(){return p},set:function(t){p=t,s.orient(t)}},alignXAxis:{get:function(){return g},set:function(t){g=t,o.orient(t)}}}),i.utils.inheritOptions(x,n),i.utils.initOptions(x),x},i.models.historicalBar=function(){"use strict";var t,e,n,r,a={top:0,right:0,bottom:0,left:0},o=null,s=null,l=Math.floor(1e4*Math.random()),u=null,c=d3.scale.linear(),d=d3.scale.linear(),h=function(t){return t.x},f=function(t){return t.y},m=[],p=[0],g=!1,v=!0,_=i.utils.defaultColor(),y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),b=!0,M=i.utils.renderWatch(y,0);function x(w){return w.each(function(x){M.reset(),u=d3.select(this);var w=i.utils.availableWidth(o,u,a),k=i.utils.availableHeight(s,u,a);i.utils.initSVG(u),c.domain(t||d3.extent(x[0].values.map(h).concat(m))),g?c.range(n||[.5*w/x[0].values.length,w*(x[0].values.length-.5)/x[0].values.length]):c.range(n||[0,w]),d.domain(e||d3.extent(x[0].values.map(f).concat(p))).range(r||[k,0]),c.domain()[0]===c.domain()[1]&&(c.domain()[0]?c.domain([c.domain()[0]-.01*c.domain()[0],c.domain()[1]+.01*c.domain()[1]]):c.domain([-1,1])),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]+.01*d.domain()[0],d.domain()[1]-.01*d.domain()[1]]):d.domain([-1,1]));var L=u.selectAll("g.nv-wrap.nv-historicalBar-"+l).data([x[0].values]),S=L.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+l),T=S.append("defs"),Y=S.append("g"),D=L.select("g");Y.append("g").attr("class","nv-bars"),L.attr("transform","translate("+a.left+","+a.top+")"),u.on("click",function(t,e){y.chartClick({data:t,index:e,pos:d3.event,id:l})}),T.append("clipPath").attr("id","nv-chart-clip-path-"+l).append("rect"),L.select("#nv-chart-clip-path-"+l+" rect").attr("width",w).attr("height",k),D.attr("clip-path",v?"url(#nv-chart-clip-path-"+l+")":"");var C=L.select(".nv-bars").selectAll(".nv-bar").data(function(t){return t},function(t,e){return h(t,e)});C.exit().remove(),C.enter().append("rect").attr("x",0).attr("y",function(t,e){return i.utils.NaNtoZero(d(Math.max(0,f(t,e))))}).attr("height",function(t,e){return i.utils.NaNtoZero(Math.abs(d(f(t,e))-d(0)))}).attr("transform",function(t,e){return"translate("+(c(h(t,e))-w/x[0].values.length*.45)+",0)"}).on("mouseover",function(t,e){b&&(d3.select(this).classed("hover",!0),y.elementMouseover({data:t,index:e,color:d3.select(this).style("fill")}))}).on("mouseout",function(t,e){b&&(d3.select(this).classed("hover",!1),y.elementMouseout({data:t,index:e,color:d3.select(this).style("fill")}))}).on("mousemove",function(t,e){b&&y.elementMousemove({data:t,index:e,color:d3.select(this).style("fill")})}).on("click",function(t,e){if(b){y.elementClick({data:t,index:e,color:d3.select(this).style("fill"),event:d3.event,element:this}),d3.event.stopPropagation()}}).on("dblclick",function(t,e){b&&(y.elementDblClick({data:t,index:e,color:d3.select(this).style("fill")}),d3.event.stopPropagation())}),C.attr("fill",function(t,e){return _(t,e)}).attr("class",function(t,e,n){return(f(t,e)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+e}).watchTransition(M,"bars").attr("transform",function(t,e){return"translate("+(c(h(t,e))-w/x[0].values.length*.45)+",0)"}).attr("width",w/x[0].values.length*.9),C.watchTransition(M,"bars").attr("y",function(t,e){var n=f(t,e)<0?d(0):d(0)-d(f(t,e))<1?d(0)-1:d(f(t,e));return i.utils.NaNtoZero(n)}).attr("height",function(t,e){return i.utils.NaNtoZero(Math.max(Math.abs(d(f(t,e))-d(0)),1))})}),M.renderEnd("historicalBar immediate"),x}return x.highlightPoint=function(t,e){u.select(".nv-bars .nv-bar-0-"+t).classed("hover",e)},x.clearHighlights=function(){u.select(".nv-bars .nv-bar.hover").classed("hover",!1)},x.dispatch=y,x.options=i.utils.optionsFunc.bind(x),x._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},forceX:{get:function(){return m},set:function(t){m=t}},forceY:{get:function(){return p},set:function(t){p=t}},padData:{get:function(){return g},set:function(t){g=t}},x:{get:function(){return h},set:function(t){h=t}},y:{get:function(){return f},set:function(t){f=t}},xScale:{get:function(){return c},set:function(t){c=t}},yScale:{get:function(){return d},set:function(t){d=t}},xDomain:{get:function(){return t},set:function(e){t=e}},yDomain:{get:function(){return e},set:function(t){e=t}},xRange:{get:function(){return n},set:function(t){n=t}},yRange:{get:function(){return r},set:function(t){r=t}},clipEdge:{get:function(){return v},set:function(t){v=t}},id:{get:function(){return l},set:function(t){l=t}},interactive:{get:function(){return b},set:function(t){b=t}},margin:{get:function(){return a},set:function(t){a.top=void 0!==t.top?t.top:a.top,a.right=void 0!==t.right?t.right:a.right,a.bottom=void 0!==t.bottom?t.bottom:a.bottom,a.left=void 0!==t.left?t.left:a.left}},color:{get:function(){return _},set:function(t){_=i.utils.getColor(t)}}}),i.utils.initOptions(x),x},i.models.historicalBarChart=function(t){"use strict";var e,n,r=t||i.models.historicalBar(),a=i.models.axis(),o=i.models.axis(),s=i.models.legend(),l=i.interactiveGuideline(),u=i.models.tooltip(),c={top:30,right:90,bottom:50,left:90},d=null,h=i.utils.defaultColor(),f=null,m=null,p=!1,g=!0,v=!0,_=!1,y=!1,b={},M=null,x=null,w=d3.dispatch("tooltipHide","stateChange","changeState","renderEnd"),k=250;a.orient("bottom").tickPadding(7),o.orient(_?"right":"left"),u.duration(0).headerEnabled(!1).valueFormatter(function(t,e){return o.tickFormat()(t,e)}).headerFormatter(function(t,e){return a.tickFormat()(t,e)});var L=i.utils.renderWatch(w,0);function S(t){return t.each(function(u){L.reset(),L.models(r),g&&L.models(a),v&&L.models(o);var x=d3.select(this);i.utils.initSVG(x);var T,Y=i.utils.availableWidth(f,x,c),D=i.utils.availableHeight(m,x,c);if(S.update=function(){x.transition().duration(k).call(S)},S.container=this,b.disabled=u.map(function(t){return!!t.disabled}),!M)for(T in M={},b)b[T]instanceof Array?M[T]=b[T].slice(0):M[T]=b[T];if(!(u&&u.length&&u.filter(function(t){return t.values.length}).length))return i.utils.noData(S,x),S;x.selectAll(".nv-noData").remove(),e=r.xScale(),n=r.yScale();var C=x.selectAll("g.nv-wrap.nv-historicalBarChart").data([u]),E=C.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g"),A=C.select("g");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y nv-axis"),E.append("g").attr("class","nv-barsWrap"),E.append("g").attr("class","nv-legendWrap"),E.append("g").attr("class","nv-interactive"),p?(s.width(Y),A.select(".nv-legendWrap").datum(u).call(s),d||s.height()===c.top||(c.top=s.height(),D=i.utils.availableHeight(m,x,c)),C.select(".nv-legendWrap").attr("transform","translate(0,"+-c.top+")")):A.select(".nv-legendWrap").selectAll("*").remove(),C.attr("transform","translate("+c.left+","+c.top+")"),_&&A.select(".nv-y.nv-axis").attr("transform","translate("+Y+",0)"),y&&(l.width(Y).height(D).margin({left:c.left,top:c.top}).svgContainer(x).xScale(e),C.select(".nv-interactive").call(l)),r.width(Y).height(D).color(u.map(function(t,e){return t.color||h(t,e)}).filter(function(t,e){return!u[e].disabled})),A.select(".nv-barsWrap").datum(u.filter(function(t){return!t.disabled})).transition().call(r),g&&(a.scale(e)._ticks(i.utils.calcTicksX(Y/100,u)).tickSize(-D,0),A.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")"),A.select(".nv-x.nv-axis").transition().call(a)),v&&(o.scale(n)._ticks(i.utils.calcTicksY(D/36,u)).tickSize(-Y,0),A.select(".nv-y.nv-axis").transition().call(o)),l.dispatch.on("elementMousemove",function(t){r.clearHighlights();var e,n,s,c=[];u.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(a,o){n=i.interactiveBisect(a.values,t.pointXValue,S.x()),r.highlightPoint(n,!0);var l=a.values[n];void 0!==l&&(void 0===e&&(e=l),void 0===s&&(s=S.xScale()(S.x()(l,n))),c.push({key:a.key,value:S.y()(l,n),color:h(a,a.seriesIndex),data:a.values[n]}))});var d=a.tickFormat()(S.x()(e,n));l.tooltip.valueFormatter(function(t,e){return o.tickFormat()(t)}).data({value:d,index:n,series:c})(),l.renderGuideLine(s)}),l.dispatch.on("elementMouseout",function(t){w.tooltipHide(),r.clearHighlights()}),s.dispatch.on("legendClick",function(e,n){e.disabled=!e.disabled,u.filter(function(t){return!t.disabled}).length||u.map(function(t){return t.disabled=!1,C.selectAll(".nv-series").classed("disabled",!1),t}),b.disabled=u.map(function(t){return!!t.disabled}),w.stateChange(b),t.transition().call(S)}),s.dispatch.on("legendDblclick",function(t){u.forEach(function(t){t.disabled=!0}),t.disabled=!1,b.disabled=u.map(function(t){return!!t.disabled}),w.stateChange(b),S.update()}),w.on("changeState",function(t){void 0!==t.disabled&&(u.forEach(function(e,n){e.disabled=t.disabled[n]}),b.disabled=t.disabled),S.update()})}),L.renderEnd("historicalBarChart immediate"),S}return r.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:S.x()(t.data),value:S.y()(t.data),color:t.color},u.data(t).hidden(!1)}),r.dispatch.on("elementMouseout.tooltip",function(t){u.hidden(!0)}),r.dispatch.on("elementMousemove.tooltip",function(t){u()}),S.dispatch=w,S.bars=r,S.legend=s,S.xAxis=a,S.yAxis=o,S.interactiveLayer=l,S.tooltip=u,S.options=i.utils.optionsFunc.bind(S),S._options=Object.create({},{width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return m},set:function(t){m=t}},showLegend:{get:function(){return p},set:function(t){p=t}},showXAxis:{get:function(){return g},set:function(t){g=t}},showYAxis:{get:function(){return v},set:function(t){v=t}},defaultState:{get:function(){return M},set:function(t){M=t}},noData:{get:function(){return x},set:function(t){x=t}},margin:{get:function(){return c},set:function(t){void 0!==t.top&&(c.top=t.top,d=t.top),c.right=void 0!==t.right?t.right:c.right,c.bottom=void 0!==t.bottom?t.bottom:c.bottom,c.left=void 0!==t.left?t.left:c.left}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t),s.color(h),r.color(h)}},duration:{get:function(){return k},set:function(t){k=t,L.reset(k),o.duration(k),a.duration(k)}},rightAlignYAxis:{get:function(){return _},set:function(t){_=t,o.orient(t?"right":"left")}},useInteractiveGuideline:{get:function(){return y},set:function(t){y=t,!0===t&&S.interactive(!1)}}}),i.utils.inheritOptions(S,r),i.utils.initOptions(S),S},i.models.ohlcBarChart=function(){var t=i.models.historicalBarChart(i.models.ohlcBar());return t.useInteractiveGuideline(!0),t.interactiveLayer.tooltip.contentGenerator(function(e){var n=e.series[0].data;return'<h3 style="color: #'+(n.open<n.close?"2ca02c":"d62728")+'">'+e.value+"</h3><table><tr><td>open:</td><td>"+t.yAxis.tickFormat()(n.open)+"</td></tr><tr><td>close:</td><td>"+t.yAxis.tickFormat()(n.close)+"</td></tr><tr><td>high</td><td>"+t.yAxis.tickFormat()(n.high)+"</td></tr><tr><td>low:</td><td>"+t.yAxis.tickFormat()(n.low)+"</td></tr></table>"}),t},i.models.candlestickBarChart=function(){var t=i.models.historicalBarChart(i.models.candlestickBar());return t.useInteractiveGuideline(!0),t.interactiveLayer.tooltip.contentGenerator(function(e){var n=e.series[0].data;return'<h3 style="color: #'+(n.open<n.close?"2ca02c":"d62728")+'">'+e.value+"</h3><table><tr><td>open:</td><td>"+t.yAxis.tickFormat()(n.open)+"</td></tr><tr><td>close:</td><td>"+t.yAxis.tickFormat()(n.close)+"</td></tr><tr><td>high</td><td>"+t.yAxis.tickFormat()(n.high)+"</td></tr><tr><td>low:</td><td>"+t.yAxis.tickFormat()(n.low)+"</td></tr></table>"}),t},i.models.legend=function(){"use strict";var t={top:5,right:0,bottom:5,left:0},e=400,n=20,r=function(t){return t.key},a=function(t){return t},o=i.utils.getColor(),s=20,l=!0,u=32,c=!0,d=!0,h=!0,f=!1,m=!1,p=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),g="classic";function v(_){function y(t,e){return"furious"!=g?"#000":m?t.disengaged?"#000":"#fff":m?void 0:(t.color||(t.color=o(t,e)),t.disabled?t.color:"#fff")}function b(t,e){return m&&"furious"==g&&t.disengaged?"#eee":t.color||o(t,e)}function M(t,e){return m&&"furious"==g?1:t.disabled?0:1}return _.each(function(o){var v=e-t.left-t.right,_=d3.select(this);i.utils.initSVG(_);var x=_.selectAll("g.nv-legend").data([o]),w=x.enter().append("g").attr("class","nvd3 nv-legend").append("g"),k=x.select("g");c?x.attr("transform","translate("+-t.right+","+t.top+")"):x.attr("transform","translate("+t.left+","+t.top+")");var L,S,T=k.selectAll(".nv-series").data(function(t){return"furious"!=g?t:t.filter(function(t){return!!m||!t.disengaged})}),Y=T.enter().append("g").attr("class","nv-series");switch(g){case"furious":S=23;break;case"classic":S=20}if("classic"==g)Y.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),L=T.select(".nv-legend-symbol");else if("furious"==g){Y.append("rect").style("stroke-width",2).attr("class","nv-legend-symbol").attr("rx",3).attr("ry",3),L=T.select(".nv-legend-symbol"),Y.append("g").attr("class","nv-check-box").property("innerHTML",'<path d="M0.5,5 L22.5,5 L22.5,26.5 L0.5,26.5 L0.5,5 Z" class="nv-box"></path><path d="M5.5,12.8618467 L11.9185089,19.2803556 L31,0.198864511" class="nv-check"></path>').attr("transform","translate(-10,-8)scale(0.5)"),T.select(".nv-check-box").each(function(t,e){d3.select(this).selectAll("path").attr("stroke",y(t,e))})}Y.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");var D=T.select("text.nv-legend-text");T.on("mouseover",function(t,e){p.legendMouseover(t,e)}).on("mouseout",function(t,e){p.legendMouseout(t,e)}).on("click",function(t,e){p.legendClick(t,e);var n=T.data();if(d){if("classic"==g)f?(n.forEach(function(t){t.disabled=!0}),t.disabled=!1):(t.disabled=!t.disabled,n.every(function(t){return t.disabled})&&n.forEach(function(t){t.disabled=!1}));else if("furious"==g)if(m)t.disengaged=!t.disengaged,t.userDisabled=void 0==t.userDisabled?!!t.disabled:t.userDisabled,t.disabled=t.disengaged||t.userDisabled;else if(!m){t.disabled=!t.disabled,t.userDisabled=t.disabled,n.filter(function(t){return!t.disengaged}).every(function(t){return t.userDisabled})&&n.forEach(function(t){t.disabled=t.userDisabled=!1})}p.stateChange({disabled:n.map(function(t){return!!t.disabled}),disengaged:n.map(function(t){return!!t.disengaged})})}}).on("dblclick",function(t,e){if(h){if("furious"==g&&m)return;if(p.legendDblclick(t,e),d){var n=T.data();n.forEach(function(t){t.disabled=!0,"furious"==g&&(t.userDisabled=t.disabled)}),t.disabled=!1,"furious"==g&&(t.userDisabled=t.disabled),p.stateChange({disabled:n.map(function(t){return!!t.disabled})})}}}),T.classed("nv-disabled",function(t){return t.userDisabled}),T.exit().remove(),D.attr("fill",y).text(function(t){return a(r(t))});var C=0;if(l){var E=[];T.each(function(t,e){var n,o;if(a(r(t))&&a(r(t)).length>s){var l=a(r(t)).substring(0,s);n=d3.select(this).select("text").text(l+"..."),d3.select(this).append("svg:title").text(a(r(t)))}else n=d3.select(this).select("text");try{if((o=n.node().getComputedTextLength())<=0)throw Error()}catch(t){o=i.utils.calcApproxTextWidth(n)}E.push(o+u)});var A=0,O=[];for(C=0;C<v&&A<E.length;)O[A]=E[A],C+=E[A++];for(0===A&&(A=1);C>v&&A>1;){O=[],A--;for(var j=0;j<E.length;j++)E[j]>(O[j%A]||0)&&(O[j%A]=E[j]);C=O.reduce(function(t,e,n,i){return t+e})}for(var N=[],H=0,V=0;H<A;H++)N[H]=V,V+=O[H];T.attr("transform",function(t,e){return"translate("+N[e%A]+","+(5+Math.floor(e/A)*S)+")"}),c?k.attr("transform","translate("+(e-t.right-C)+","+t.top+")"):k.attr("transform","translate(0,"+t.top+")"),n=t.top+t.bottom+Math.ceil(E.length/A)*S}else{var P,F=5,I=5,R=0;T.attr("transform",function(n,i){var r=d3.select(this).select("text").node().getComputedTextLength()+u;return P=I,e<t.left+t.right+P+r&&(I=P=5,F+=S),(I+=r)>R&&(R=I),C<P+R&&(C=P+R),"translate("+P+","+F+")"}),k.attr("transform","translate("+(e-t.right-R)+","+t.top+")"),n=t.top+t.bottom+F+15}"furious"==g&&(L.attr("width",function(t,e){return D[0][e].getComputedTextLength()+27}).attr("height",18).attr("y",-9).attr("x",-15),w.insert("rect",":first-child").attr("class","nv-legend-bg").attr("fill","#eee").attr("opacity",0),k.select(".nv-legend-bg").transition().duration(300).attr("x",-S).attr("width",C+S-12).attr("height",n+10).attr("y",-t.top-10).attr("opacity",m?1:0));L.style("fill",b).style("fill-opacity",M).style("stroke",b)}),v}return v.dispatch=p,v.options=i.utils.optionsFunc.bind(v),v._options=Object.create({},{width:{get:function(){return e},set:function(t){e=t}},height:{get:function(){return n},set:function(t){n=t}},key:{get:function(){return r},set:function(t){r=t}},keyFormatter:{get:function(){return a},set:function(t){a=t}},align:{get:function(){return l},set:function(t){l=t}},maxKeyLength:{get:function(){return s},set:function(t){s=t}},rightAlign:{get:function(){return c},set:function(t){c=t}},padding:{get:function(){return u},set:function(t){u=t}},updateState:{get:function(){return d},set:function(t){d=t}},enableDoubleClick:{get:function(){return h},set:function(t){h=t}},radioButtonMode:{get:function(){return f},set:function(t){f=t}},expanded:{get:function(){return m},set:function(t){m=t}},vers:{get:function(){return g},set:function(t){g=t}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},color:{get:function(){return o},set:function(t){o=i.utils.getColor(t)}}}),i.utils.initOptions(v),v},i.models.line=function(){"use strict";var t,e,n=i.models.scatter(),r={top:0,right:0,bottom:0,left:0},a=960,o=500,s=null,l=1.5,u=i.utils.defaultColor(),c=function(t){return t.x},d=function(t){return t.y},h=function(t,e){return!isNaN(d(t,e))&&null!==d(t,e)},f=function(t){return t.area},m=!1,p="linear",g=250,v=d3.dispatch("elementClick","elementMouseover","elementMouseout","renderEnd");n.pointSize(16).pointDomain([16,256]);var _,y,b=i.utils.renderWatch(v,g);function M(g){return b.reset(),b.models(n),g.each(function(g){s=d3.select(this);var v=i.utils.availableWidth(a,s,r),M=i.utils.availableHeight(o,s,r);i.utils.initSVG(s),t=n.xScale(),e=n.yScale(),_=_||t,y=y||e;var x=s.selectAll("g.nv-wrap.nv-line").data([g]),w=x.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),k=w.append("defs"),L=w.append("g"),S=x.select("g");L.append("g").attr("class","nv-groups"),L.append("g").attr("class","nv-scatterWrap"),x.attr("transform","translate("+r.left+","+r.top+")"),n.width(v).height(M);var T=x.select(".nv-scatterWrap");T.call(n),k.append("clipPath").attr("id","nv-edge-clip-"+n.id()).append("rect"),x.select("#nv-edge-clip-"+n.id()+" rect").attr("width",v).attr("height",M>0?M:0),S.attr("clip-path",m?"url(#nv-edge-clip-"+n.id()+")":""),T.attr("clip-path",m?"url(#nv-edge-clip-"+n.id()+")":"");var Y=x.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t){return t.key});Y.enter().append("g").style("stroke-opacity",1e-6).style("stroke-width",function(t){return t.strokeWidth||l}).style("fill-opacity",1e-6),Y.exit().remove(),Y.attr("class",function(t,e){return(t.classed||"")+" nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}).style("fill",function(t,e){return u(t,e)}).style("stroke",function(t,e){return u(t,e)}),Y.watchTransition(b,"line: groups").style("stroke-opacity",1).style("fill-opacity",function(t){return t.fillOpacity||.5});var D=Y.selectAll("path.nv-area").data(function(t){return f(t)?[t]:[]});D.enter().append("path").attr("class","nv-area").attr("d",function(t){return d3.svg.area().interpolate(p).defined(h).x(function(t,e){return i.utils.NaNtoZero(_(c(t,e)))}).y0(function(t,e){return i.utils.NaNtoZero(y(d(t,e)))}).y1(function(t,n){return y(e.domain()[0]<=0?e.domain()[1]>=0?0:e.domain()[1]:e.domain()[0])}).apply(this,[t.values])}),Y.exit().selectAll("path.nv-area").remove(),D.watchTransition(b,"line: areaPaths").attr("d",function(n){return d3.svg.area().interpolate(p).defined(h).x(function(e,n){return i.utils.NaNtoZero(t(c(e,n)))}).y0(function(t,n){return i.utils.NaNtoZero(e(d(t,n)))}).y1(function(t,n){return e(e.domain()[0]<=0?e.domain()[1]>=0?0:e.domain()[1]:e.domain()[0])}).apply(this,[n.values])});var C=Y.selectAll("path.nv-line").data(function(t){return[t.values]});C.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(h).x(function(t,e){return i.utils.NaNtoZero(_(c(t,e)))}).y(function(t,e){return i.utils.NaNtoZero(y(d(t,e)))})),C.watchTransition(b,"line: linePaths").attr("d",d3.svg.line().interpolate(p).defined(h).x(function(e,n){return i.utils.NaNtoZero(t(c(e,n)))}).y(function(t,n){return i.utils.NaNtoZero(e(d(t,n)))})),_=t.copy(),y=e.copy()}),b.renderEnd("line immediate"),M}return M.dispatch=v,M.scatter=n,n.dispatch.on("elementClick",function(){v.elementClick.apply(this,arguments)}),n.dispatch.on("elementMouseover",function(){v.elementMouseover.apply(this,arguments)}),n.dispatch.on("elementMouseout",function(){v.elementMouseout.apply(this,arguments)}),M.options=i.utils.optionsFunc.bind(M),M._options=Object.create({},{width:{get:function(){return a},set:function(t){a=t}},height:{get:function(){return o},set:function(t){o=t}},defined:{get:function(){return h},set:function(t){h=t}},interpolate:{get:function(){return p},set:function(t){p=t}},clipEdge:{get:function(){return m},set:function(t){m=t}},margin:{get:function(){return r},set:function(t){r.top=void 0!==t.top?t.top:r.top,r.right=void 0!==t.right?t.right:r.right,r.bottom=void 0!==t.bottom?t.bottom:r.bottom,r.left=void 0!==t.left?t.left:r.left}},duration:{get:function(){return g},set:function(t){g=t,b.reset(g),n.duration(g)}},isArea:{get:function(){return f},set:function(t){f=d3.functor(t)}},x:{get:function(){return c},set:function(t){c=t,n.x(t)}},y:{get:function(){return d},set:function(t){d=t,n.y(t)}},color:{get:function(){return u},set:function(t){u=i.utils.getColor(t),n.color(u)}}}),i.utils.inheritOptions(M,n),i.utils.initOptions(M),M},i.models.lineChart=function(){"use strict";var t,e,n=i.models.line(),r=i.models.axis(),a=i.models.axis(),o=i.models.legend(),s=i.interactiveGuideline(),l=i.models.tooltip(),u=i.models.focus(i.models.line()),c={top:30,right:20,bottom:50,left:60},d=null,h=i.utils.defaultColor(),f=null,m=null,p=!0,g="top",v=!0,_=!0,y=!1,b=!1,M=!1,x=i.utils.state(),w=null,k=null,L=d3.dispatch("stateChange","changeState","renderEnd"),S=250;r.orient("bottom").tickPadding(7),a.orient(y?"right":"left"),n.clipEdge(!0).duration(0),l.valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),s.tooltip.valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)});var T=i.utils.renderWatch(L,S),Y=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},D=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function C(l){return T.reset(),T.models(n),v&&T.models(r),_&&T.models(a),l.each(function(l){var k=d3.select(this);i.utils.initSVG(k);var T,E=i.utils.availableWidth(f,k,c),A=i.utils.availableHeight(m,k,c)-(M?u.height():0);if(C.update=function(){0===S?k.call(C):k.transition().duration(S).call(C)},C.container=this,x.setter(D(l),C.update).getter(Y(l)).update(),x.disabled=l.map(function(t){return!!t.disabled}),!w)for(T in w={},x)x[T]instanceof Array?w[T]=x[T].slice(0):w[T]=x[T];if(!(l&&l.length&&l.filter(function(t){return t.values.length}).length))return i.utils.noData(C,k),C;k.selectAll(".nv-noData").remove(),u.dispatch.on("onBrush",function(t){R(t)}),t=n.xScale(),e=n.yScale();var O=k.selectAll("g.nv-wrap.nv-lineChart").data([l]),j=O.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),N=O.select("g");j.append("g").attr("class","nv-legendWrap");var H=j.append("g").attr("class","nv-focus");H.append("g").attr("class","nv-background").append("rect"),H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-linesWrap"),H.append("g").attr("class","nv-interactive");j.append("g").attr("class","nv-focusWrap");p?(o.width(E),N.select(".nv-legendWrap").datum(l).call(o),"bottom"===g?(c.bottom=r.height()+o.height(),A=i.utils.availableHeight(m,k,c),N.select(".nv-legendWrap").attr("transform","translate(0,"+(A+r.height())+")")):"top"===g&&(d||o.height()===c.top||(c.top=o.height(),A=i.utils.availableHeight(m,k,c)-(M?u.height():0)),O.select(".nv-legendWrap").attr("transform","translate(0,"+-c.top+")"))):N.select(".nv-legendWrap").selectAll("*").remove(),O.attr("transform","translate("+c.left+","+c.top+")"),y&&N.select(".nv-y.nv-axis").attr("transform","translate("+E+",0)"),b&&(s.width(E).height(A).margin({left:c.left,top:c.top}).svgContainer(k).xScale(t),O.select(".nv-interactive").call(s)),N.select(".nv-focus .nv-background rect").attr("width",E).attr("height",A),n.width(E).height(A).color(l.map(function(t,e){return t.color||h(t,e)}).filter(function(t,e){return!l[e].disabled}));var V=N.select(".nv-linesWrap").datum(l.filter(function(t){return!t.disabled}));function P(){v&&N.select(".nv-focus .nv-x.nv-axis").transition().duration(S).call(r)}function F(){_&&N.select(".nv-focus .nv-y.nv-axis").transition().duration(S).call(a)}if(v&&r.scale(t)._ticks(i.utils.calcTicksX(E/100,l)).tickSize(-A,0),_&&a.scale(e)._ticks(i.utils.calcTicksY(A/36,l)).tickSize(-E,0),N.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+A+")"),M||null!==u.brush.extent()){u.width(E),N.select(".nv-focusWrap").style("display",M?"initial":"none").attr("transform","translate(0,"+(A+c.bottom+u.margin().top)+")").call(u);var I=u.brush.empty()?u.xDomain():u.brush.extent();null!==I&&R(I)}else V.transition().call(n),P(),F();function R(t){N.select(".nv-focus .nv-linesWrap").datum(l.filter(function(t){return!t.disabled}).map(function(e,i){return{key:e.key,area:e.area,classed:e.classed,values:e.values.filter(function(e,i){return n.x()(e,i)>=t[0]&&n.x()(e,i)<=t[1]}),disableTooltip:e.disableTooltip}})).transition().duration(S).call(n),P(),F()}o.dispatch.on("stateChange",function(t){for(var e in t)x[e]=t[e];L.stateChange(x),C.update()}),s.dispatch.on("elementMousemove",function(e){n.clearHighlights();var r,o,c,d=[];if(l.filter(function(t,e){return t.seriesIndex=e,!t.disabled&&!t.disableTooltip}).forEach(function(a,s){var l=null!==u.brush.extent()?u.brush.empty()?u.xScale().domain():u.brush.extent():t.domain(),f=a.values.filter(function(t,e){return l[0]<=l[1]?n.x()(t,e)>=l[0]&&n.x()(t,e)<=l[1]:n.x()(t,e)>=l[1]&&n.x()(t,e)<=l[0]});if(f.length>0){var m=f[o=i.interactiveBisect(f,e.pointXValue,n.x())],p=C.y()(m,o);if(null!==p&&n.highlightPoint(s,a.values.indexOf(m),!0),void 0===m)return;void 0===r&&(r=m),void 0===c&&(c=C.xScale()(C.x()(m,o))),d.push({key:a.key,value:p,color:h(a,a.seriesIndex),data:m})}}),d.length>2){var f=C.yScale().invert(e.mouseY),m=.03*Math.abs(C.yScale().domain()[0]-C.yScale().domain()[1]),p=i.nearestValueIndex(d.map(function(t){return t.value}),f,m);null!==p&&(d[p].highlight=!0)}void 0!==o&&(s.tooltip.valueFormatter(s.tooltip.valueFormatter()||function(t,e){return null==t?"N/A":a.tickFormat()(t)}).data({value:C.x()(r,o),index:o,series:d})(),s.renderGuideLine(c))}),s.dispatch.on("elementClick",function(t){var e,r=[];l.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(n){var a=i.interactiveBisect(n.values,t.pointXValue,C.x()),o=n.values[a];if(void 0!==o){void 0===e&&(e=C.xScale()(C.x()(o,a)));var s=C.yScale()(C.y()(o,a));r.push({point:o,pointIndex:a,pos:[e,s],seriesIndex:n.seriesIndex,series:n})}}),n.dispatch.elementClick(r)}),s.dispatch.on("elementMouseout",function(t){n.clearHighlights()}),L.on("changeState",function(t){void 0!==t.disabled&&l.length===t.disabled.length&&(l.forEach(function(e,n){e.disabled=t.disabled[n]}),x.disabled=t.disabled),C.update()})}),T.renderEnd("lineChart immediate"),C}return n.dispatch.on("elementMouseover.tooltip",function(t){t.series.disableTooltip||l.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){l.hidden(!0)}),C.dispatch=L,C.lines=n,C.legend=o,C.focus=u,C.xAxis=r,C.x2Axis=u.xAxis,C.yAxis=a,C.y2Axis=u.yAxis,C.interactiveLayer=s,C.tooltip=l,C.state=x,C.dispatch=L,C.options=i.utils.optionsFunc.bind(C),C._options=Object.create({},{width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return m},set:function(t){m=t}},showLegend:{get:function(){return p},set:function(t){p=t}},legendPosition:{get:function(){return g},set:function(t){g=t}},showXAxis:{get:function(){return v},set:function(t){v=t}},showYAxis:{get:function(){return _},set:function(t){_=t}},defaultState:{get:function(){return w},set:function(t){w=t}},noData:{get:function(){return k},set:function(t){k=t}},focusEnable:{get:function(){return M},set:function(t){M=t}},focusHeight:{get:function(){return u.height()},set:function(t){u.height(t)}},focusShowAxisX:{get:function(){return u.showXAxis()},set:function(t){u.showXAxis(t)}},focusShowAxisY:{get:function(){return u.showYAxis()},set:function(t){u.showYAxis(t)}},brushExtent:{get:function(){return u.brushExtent()},set:function(t){u.brushExtent(t)}},focusMargin:{get:function(){return u.margin},set:function(t){void 0!==t.top&&(c.top=t.top,d=t.top),u.margin.right=void 0!==t.right?t.right:u.margin.right,u.margin.bottom=void 0!==t.bottom?t.bottom:u.margin.bottom,u.margin.left=void 0!==t.left?t.left:u.margin.left}},margin:{get:function(){return c},set:function(t){c.top=void 0!==t.top?t.top:c.top,c.right=void 0!==t.right?t.right:c.right,c.bottom=void 0!==t.bottom?t.bottom:c.bottom,c.left=void 0!==t.left?t.left:c.left}},duration:{get:function(){return S},set:function(t){S=t,T.reset(S),n.duration(S),u.duration(S),r.duration(S),a.duration(S)}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t),o.color(h),n.color(h),u.color(h)}},interpolate:{get:function(){return n.interpolate()},set:function(t){n.interpolate(t),u.interpolate(t)}},xTickFormat:{get:function(){return r.tickFormat()},set:function(t){r.tickFormat(t),u.xTickFormat(t)}},yTickFormat:{get:function(){return a.tickFormat()},set:function(t){a.tickFormat(t),u.yTickFormat(t)}},x:{get:function(){return n.x()},set:function(t){n.x(t),u.x(t)}},y:{get:function(){return n.y()},set:function(t){n.y(t),u.y(t)}},rightAlignYAxis:{get:function(){return y},set:function(t){y=t,a.orient(y?"right":"left")}},useInteractiveGuideline:{get:function(){return b},set:function(t){(b=t)&&(n.interactive(!1),n.useVoronoi(!1))}}}),i.utils.inheritOptions(C,n),i.utils.initOptions(C),C},i.models.lineWithFocusChart=function(){return i.models.lineChart().margin({bottom:30}).focusEnable(!0)},i.models.linePlusBarChart=function(){"use strict";var t,e,n,r,a,o,s,l=i.models.line(),u=i.models.line(),c=i.models.historicalBar(),d=i.models.historicalBar(),h=i.models.axis(),f=i.models.axis(),m=i.models.axis(),p=i.models.axis(),g=i.models.axis(),v=i.models.axis(),_=i.models.legend(),y=d3.svg.brush(),b=i.models.tooltip(),M={top:30,right:30,bottom:30,left:60},x=null,w={top:0,right:30,bottom:20,left:60},k=null,L=null,S=function(t){return t.x},T=function(t){return t.y},Y=i.utils.defaultColor(),D=!0,C=!0,E=!1,A=!0,O=50,j=null,N=null,H=d3.dispatch("brush","stateChange","changeState"),V=0,P=i.utils.state(),F=null,I=" (left axis)",R=" (right axis)",W=!1;l.clipEdge(!0),u.interactive(!1),u.pointActive(function(t){return!1}),h.orient("bottom").tickPadding(5),m.orient("left"),p.orient("right"),f.orient("bottom").tickPadding(5),g.orient("left"),v.orient("right"),b.headerEnabled(!0).headerFormatter(function(t,e){return h.tickFormat()(t,e)});var z=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},B=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}},U=function(t){return t.every(function(t){return t.disabled})};function G(b){return b.each(function(b){var N=d3.select(this);i.utils.initSVG(N);var $,q=i.utils.availableWidth(k,N,M),J=i.utils.availableHeight(L,N,M)-(C?O:0),X=O-w.top-w.bottom;if(G.update=function(){N.transition().duration(V).call(G)},G.container=this,P.setter(B(b),G.update).getter(z(b)).update(),P.disabled=b.map(function(t){return!!t.disabled}),!F)for($ in F={},P)P[$]instanceof Array?F[$]=P[$].slice(0):F[$]=P[$];if(!(b&&b.length&&b.filter(function(t){return t.values.length}).length))return i.utils.noData(G,N),G;N.selectAll(".nv-noData").remove();var Z=b.filter(function(t){return!t.disabled&&t.bar}),K=b.filter(function(t){return!t.bar});e=Z.length&&!W?c.xScale():l.xScale(),n=f.scale(),r=W?l.yScale():c.yScale(),a=W?c.yScale():l.yScale(),o=W?u.yScale():d.yScale(),s=W?d.yScale():u.yScale();var Q=b.filter(function(t){return!t.disabled&&(W?!t.bar:t.bar)}).map(function(t){return t.values.map(function(t,e){return{x:S(t,e),y:T(t,e)}})}),tt=b.filter(function(t){return!t.disabled&&(W?t.bar:!t.bar)}).map(function(t){return t.values.map(function(t,e){return{x:S(t,e),y:T(t,e)}})});e.range([0,q]),n.domain(d3.extent(d3.merge(Q.concat(tt)),function(t){return t.x})).range([0,q]);var et=N.selectAll("g.nv-wrap.nv-linePlusBar").data([b]),nt=et.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),it=et.select("g");nt.append("g").attr("class","nv-legendWrap");var rt=nt.append("g").attr("class","nv-focus");rt.append("g").attr("class","nv-x nv-axis"),rt.append("g").attr("class","nv-y1 nv-axis"),rt.append("g").attr("class","nv-y2 nv-axis"),rt.append("g").attr("class","nv-barsWrap"),rt.append("g").attr("class","nv-linesWrap");var at=nt.append("g").attr("class","nv-context");if(at.append("g").attr("class","nv-x nv-axis"),at.append("g").attr("class","nv-y1 nv-axis"),at.append("g").attr("class","nv-y2 nv-axis"),at.append("g").attr("class","nv-barsWrap"),at.append("g").attr("class","nv-linesWrap"),at.append("g").attr("class","nv-brushBackground"),at.append("g").attr("class","nv-x nv-brush"),D){var ot=_.align()?q/2:q,st=_.align()?ot:0;_.width(ot),it.select(".nv-legendWrap").datum(b.map(function(t){return t.originalKey=void 0===t.originalKey?t.key:t.originalKey,t.key=W?t.originalKey+(t.bar?R:I):t.originalKey+(t.bar?I:R),t})).call(_),x||_.height()===M.top||(M.top=_.height(),J=i.utils.availableHeight(L,N,M)-O),it.select(".nv-legendWrap").attr("transform","translate("+st+","+-M.top+")")}else it.select(".nv-legendWrap").selectAll("*").remove();et.attr("transform","translate("+M.left+","+M.top+")"),it.select(".nv-context").style("display",C?"initial":"none"),d.width(q).height(X).color(b.map(function(t,e){return t.color||Y(t,e)}).filter(function(t,e){return!b[e].disabled&&b[e].bar})),u.width(q).height(X).color(b.map(function(t,e){return t.color||Y(t,e)}).filter(function(t,e){return!b[e].disabled&&!b[e].bar}));var lt=it.select(".nv-context .nv-barsWrap").datum(Z.length?Z:[{values:[]}]),ut=it.select(".nv-context .nv-linesWrap").datum(U(K)?[{values:[]}]:K.filter(function(t){return!t.disabled}));it.select(".nv-context").attr("transform","translate(0,"+(J+M.bottom+w.top)+")"),lt.transition().call(d),ut.transition().call(u),A&&(f._ticks(i.utils.calcTicksX(q/100,b)).tickSize(-X,0),it.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")"),it.select(".nv-context .nv-x.nv-axis").transition().call(f)),E&&(g.scale(o)._ticks(X/36).tickSize(-q,0),v.scale(s)._ticks(X/36).tickSize(Z.length?0:-q,0),it.select(".nv-context .nv-y3.nv-axis").style("opacity",Z.length?1:0).attr("transform","translate(0,"+n.range()[0]+")"),it.select(".nv-context .nv-y2.nv-axis").style("opacity",K.length?1:0).attr("transform","translate("+n.range()[1]+",0)"),it.select(".nv-context .nv-y1.nv-axis").transition().call(g),it.select(".nv-context .nv-y2.nv-axis").transition().call(v)),y.x(n).on("brush",ft),j&&y.extent(j);var ct=it.select(".nv-brushBackground").selectAll("g").data([j||y.extent()]),dt=ct.enter().append("g");dt.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",X),dt.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",X);var ht=it.select(".nv-x.nv-brush").call(y);function ft(){j=y.empty()?null:y.extent(),t=y.empty()?n.domain():y.extent(),H.brush({extent:t,brush:y}),y.empty()||y.extent(j),ct.data([y.empty()?n.domain():j]).each(function(t,e){var i=n(t[0])-n.range()[0],r=n.range()[1]-n(t[1]);d3.select(this).select(".left").attr("width",i<0?0:i),d3.select(this).select(".right").attr("x",n(t[1])).attr("width",r<0?0:r)}),c.width(q).height(J).color(b.map(function(t,e){return t.color||Y(t,e)}).filter(function(t,e){return!b[e].disabled&&b[e].bar})),l.width(q).height(J).color(b.map(function(t,e){return t.color||Y(t,e)}).filter(function(t,e){return!b[e].disabled&&!b[e].bar}));var o=it.select(".nv-focus .nv-barsWrap").datum(Z.length?Z.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return c.x()(e,n)>=t[0]&&c.x()(e,n)<=t[1]})}}):[{values:[]}]),s=it.select(".nv-focus .nv-linesWrap").datum(U(K)?[{values:[]}]:K.filter(function(t){return!t.disabled}).map(function(e,n){return{area:e.area,fillOpacity:e.fillOpacity,strokeWidth:e.strokeWidth,key:e.key,values:e.values.filter(function(e,n){return l.x()(e,n)>=t[0]&&l.x()(e,n)<=t[1]})}}));e=Z.length&&!W?c.xScale():l.xScale(),h.scale(e)._ticks(i.utils.calcTicksX(q/100,b)).tickSize(-J,0),h.domain([Math.ceil(t[0]),Math.floor(t[1])]),it.select(".nv-x.nv-axis").transition().duration(V).call(h),o.transition().duration(V).call(c),s.transition().duration(V).call(l),it.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),m.scale(r)._ticks(i.utils.calcTicksY(J/36,b)).tickSize(-q,0),p.scale(a)._ticks(i.utils.calcTicksY(J/36,b)),W?p.tickSize(K.length?0:-q,0):p.tickSize(Z.length?0:-q,0);var u=Z.length?1:0,d=K.length&&!U(K)?1:0,f=W?d:u,g=W?u:d;it.select(".nv-focus .nv-y1.nv-axis").style("opacity",f),it.select(".nv-focus .nv-y2.nv-axis").style("opacity",g).attr("transform","translate("+e.range()[1]+",0)"),it.select(".nv-focus .nv-y1.nv-axis").transition().duration(V).call(m),it.select(".nv-focus .nv-y2.nv-axis").transition().duration(V).call(p)}ht.selectAll("rect").attr("height",X),ht.selectAll(".resize").append("path").attr("d",function(t){var e=+("e"==t),n=e?1:-1,i=X/3;return"M"+.5*n+","+i+"A6,6 0 0 "+e+" "+6.5*n+","+(i+6)+"V"+(2*i-6)+"A6,6 0 0 "+e+" "+.5*n+","+2*i+"ZM"+2.5*n+","+(i+8)+"V"+(2*i-8)+"M"+4.5*n+","+(i+8)+"V"+(2*i-8)}),_.dispatch.on("stateChange",function(t){for(var e in t)P[e]=t[e];H.stateChange(P),G.update()}),H.on("changeState",function(t){void 0!==t.disabled&&(b.forEach(function(e,n){e.disabled=t.disabled[n]}),P.disabled=t.disabled),G.update()}),ft()}),G}return l.dispatch.on("elementMouseover.tooltip",function(t){b.duration(100).valueFormatter(function(t,e){return(W?{main:m,focus:g}:{main:p,focus:v}).main.tickFormat()(t,e)}).data(t).hidden(!1)}),l.dispatch.on("elementMouseout.tooltip",function(t){b.hidden(!0)}),c.dispatch.on("elementMouseover.tooltip",function(t){t.value=G.x()(t.data),t.series={value:G.y()(t.data),color:t.color},b.duration(0).valueFormatter(function(t,e){return(W?{main:p,focus:v}:{main:m,focus:g}).main.tickFormat()(t,e)}).data(t).hidden(!1)}),c.dispatch.on("elementMouseout.tooltip",function(t){b.hidden(!0)}),c.dispatch.on("elementMousemove.tooltip",function(t){b()}),G.dispatch=H,G.legend=_,G.lines=l,G.lines2=u,G.bars=c,G.bars2=d,G.xAxis=h,G.x2Axis=f,G.y1Axis=m,G.y2Axis=p,G.y3Axis=g,G.y4Axis=v,G.tooltip=b,G.options=i.utils.optionsFunc.bind(G),G._options=Object.create({},{width:{get:function(){return k},set:function(t){k=t}},height:{get:function(){return L},set:function(t){L=t}},showLegend:{get:function(){return D},set:function(t){D=t}},brushExtent:{get:function(){return j},set:function(t){j=t}},noData:{get:function(){return N},set:function(t){N=t}},focusEnable:{get:function(){return C},set:function(t){C=t}},focusHeight:{get:function(){return O},set:function(t){O=t}},focusShowAxisX:{get:function(){return A},set:function(t){A=t}},focusShowAxisY:{get:function(){return E},set:function(t){E=t}},legendLeftAxisHint:{get:function(){return I},set:function(t){I=t}},legendRightAxisHint:{get:function(){return R},set:function(t){R=t}},margin:{get:function(){return M},set:function(t){void 0!==t.top&&(M.top=t.top,x=t.top),M.right=void 0!==t.right?t.right:M.right,M.bottom=void 0!==t.bottom?t.bottom:M.bottom,M.left=void 0!==t.left?t.left:M.left}},focusMargin:{get:function(){return w},set:function(t){w.top=void 0!==t.top?t.top:w.top,w.right=void 0!==t.right?t.right:w.right,w.bottom=void 0!==t.bottom?t.bottom:w.bottom,w.left=void 0!==t.left?t.left:w.left}},duration:{get:function(){return V},set:function(t){V=t}},color:{get:function(){return Y},set:function(t){Y=i.utils.getColor(t),_.color(Y)}},x:{get:function(){return S},set:function(t){S=t,l.x(t),u.x(t),c.x(t),d.x(t)}},y:{get:function(){return T},set:function(t){T=t,l.y(t),u.y(t),c.y(t),d.y(t)}},switchYAxisOrder:{get:function(){return W},set:function(t){if(W!==t){var e=m;m=p,p=e;var n=g;g=v,v=n}W=t,m.orient("left"),p.orient("right"),g.orient("left"),v.orient("right")}}}),i.utils.inheritOptions(G,l),i.utils.initOptions(G),G},i.models.multiBar=function(){"use strict";var t,e,n,r,a,o,s,l={top:0,right:0,bottom:0,left:0},u=960,c=500,d=d3.scale.ordinal(),h=d3.scale.linear(),f=Math.floor(1e4*Math.random()),m=null,p=function(t){return t.x},g=function(t){return t.y},v=[0],_=!0,y=!1,b="zero",M=i.utils.defaultColor(),x=!1,w=null,k=500,L=.1,S=.75,T=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),Y=i.utils.renderWatch(T,k),D=0;function C(E){return Y.reset(),E.each(function(C){var E=u-l.left-l.right,A=c-l.top-l.bottom;m=d3.select(this),i.utils.initSVG(m);var O=0;if(x&&C.length&&(x=[{values:C[0].values.map(function(t){return{x:t.x,y:0,series:t.series,size:.01}})}]),y){var j=d3.layout.stack().offset(b).values(function(t){return t.values}).y(g)(!C.length&&x?x:C);j.forEach(function(t,e){t.nonStackable?(C[e].nonStackableSeries=O++,j[e]=C[e]):e>0&&j[e-1].nonStackable&&j[e].values.map(function(t,n){t.y0-=j[e-1].values[n].y,t.y1=t.y0+t.y})}),C=j}C.forEach(function(t,e){t.values.forEach(function(n){n.series=e,n.key=t.key})}),y&&C.length>0&&C[0].values.map(function(t,e){var n=0,i=0;C.map(function(t,r){if(!C[r].nonStackable){var a=t.values[e];a.size=Math.abs(a.y),a.y<0?(a.y1=i,i-=a.size):(a.y1=a.size+n,n+=a.size)}})});var N=e&&n?[]:C.map(function(t,e){return t.values.map(function(t,n){return{x:p(t,n),y:g(t,n),y0:t.y0,y1:t.y1,idx:e}})});d.domain(e||d3.merge(N).map(function(t){return t.x})).rangeBands(r||[0,E],L),h.domain(n||d3.extent(d3.merge(N).map(function(t){var e=t.y;return y&&!C[t.idx].nonStackable&&(e=t.y>0?t.y1:t.y1+t.y),e}).concat(v))).range(a||[A,0]),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]-.01*d.domain()[0],d.domain()[1]+.01*d.domain()[1]]):d.domain([-1,1])),h.domain()[0]===h.domain()[1]&&(h.domain()[0]?h.domain([h.domain()[0]+.01*h.domain()[0],h.domain()[1]-.01*h.domain()[1]]):h.domain([-1,1])),o=o||d,s=s||h;var H=m.selectAll("g.nv-wrap.nv-multibar").data([C]),V=H.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),P=V.append("defs"),F=V.append("g"),I=H.select("g");F.append("g").attr("class","nv-groups"),H.attr("transform","translate("+l.left+","+l.top+")"),P.append("clipPath").attr("id","nv-edge-clip-"+f).append("rect"),H.select("#nv-edge-clip-"+f+" rect").attr("width",E).attr("height",A),I.attr("clip-path",_?"url(#nv-edge-clip-"+f+")":"");var R=H.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t,e){return e});R.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);var W=Y.transition(R.exit().selectAll("rect.nv-bar"),"multibarExit",Math.min(100,k)).attr("y",function(t,e,n){var i=s(0)||0;return y&&C[t.series]&&!C[t.series].nonStackable&&(i=s(t.y0)),i}).attr("height",0).remove();W.delay&&W.delay(function(t,e){return e*(k/(D+1))-e}),R.attr("class",function(t,e){return"nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}).style("fill",function(t,e){return M(t,e)}).style("stroke",function(t,e){return M(t,e)}),R.style("stroke-opacity",1).style("fill-opacity",S);var z=R.selectAll("rect.nv-bar").data(function(t){return x&&!C.length?x.values:t.values});z.exit().remove();z.enter().append("rect").attr("class",function(t,e){return g(t,e)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,e,n){return y&&!C[n].nonStackable?0:n*d.rangeBand()/C.length}).attr("y",function(t,e,n){return s(y&&!C[n].nonStackable?t.y0:0)||0}).attr("height",0).attr("width",function(t,e,n){return d.rangeBand()/(y&&!C[n].nonStackable?1:C.length)}).attr("transform",function(t,e){return"translate("+d(p(t,e))+",0)"});z.style("fill",function(t,e,n){return M(t,n,e)}).style("stroke",function(t,e,n){return M(t,n,e)}).on("mouseover",function(t,e,n){d3.select(this).classed("hover",!0),T.elementMouseover({data:t,index:e,series:C[n],color:d3.select(this).style("fill")})}).on("mouseout",function(t,e,n){d3.select(this).classed("hover",!1),T.elementMouseout({data:t,index:e,series:C[n],color:d3.select(this).style("fill")})}).on("mousemove",function(t,e,n){T.elementMousemove({data:t,index:e,series:C[n],color:d3.select(this).style("fill")})}).on("click",function(t,e,n){T.elementClick({data:t,index:e,series:C[n],color:d3.select(this).style("fill"),event:d3.event,element:this}),d3.event.stopPropagation()}).on("dblclick",function(t,e,n){T.elementDblClick({data:t,index:e,series:C[n],color:d3.select(this).style("fill")}),d3.event.stopPropagation()}),z.attr("class",function(t,e){return g(t,e)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(t,e){return"translate("+d(p(t,e))+",0)"}),w&&(t||(t=C.map(function(){return!0})),z.style("fill",function(e,n,i){return d3.rgb(w(e,n)).darker(t.map(function(t,e){return e}).filter(function(e,n){return!t[n]})[i]).toString()}).style("stroke",function(e,n,i){return d3.rgb(w(e,n)).darker(t.map(function(t,e){return e}).filter(function(e,n){return!t[n]})[i]).toString()}));var B=z.watchTransition(Y,"multibar",Math.min(250,k)).delay(function(t,e){return e*k/C[0].values.length});y?B.attr("y",function(t,e,n){return C[n].nonStackable?g(t,e)<0?h(0):h(0)-h(g(t,e))<-1?h(0)-1:h(g(t,e))||0:h(t.y1)}).attr("height",function(t,e,n){return C[n].nonStackable?Math.max(Math.abs(h(g(t,e))-h(0)),0)||0:Math.max(Math.abs(h(t.y+t.y0)-h(t.y0)),0)}).attr("x",function(t,e,n){var i=0;return C[n].nonStackable&&(i=t.series*d.rangeBand()/C.length,C.length!==O&&(i=C[n].nonStackableSeries*d.rangeBand()/(2*O))),i}).attr("width",function(t,e,n){if(C[n].nonStackable){var i=d.rangeBand()/O;return C.length!==O&&(i=d.rangeBand()/(2*O)),i}return d.rangeBand()}):B.attr("x",function(t,e){return t.series*d.rangeBand()/C.length}).attr("width",d.rangeBand()/C.length).attr("y",function(t,e){return g(t,e)<0?h(0):h(0)-h(g(t,e))<1?h(0)-1:h(g(t,e))||0}).attr("height",function(t,e){return Math.max(Math.abs(h(g(t,e))-h(0)),1)||0}),o=d.copy(),s=h.copy(),C[0]&&C[0].values&&(D=C[0].values.length)}),Y.renderEnd("multibar immediate"),C}return C.dispatch=T,C.options=i.utils.optionsFunc.bind(C),C._options=Object.create({},{width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},x:{get:function(){return p},set:function(t){p=t}},y:{get:function(){return g},set:function(t){g=t}},xScale:{get:function(){return d},set:function(t){d=t}},yScale:{get:function(){return h},set:function(t){h=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return r},set:function(t){r=t}},yRange:{get:function(){return a},set:function(t){a=t}},forceY:{get:function(){return v},set:function(t){v=t}},stacked:{get:function(){return y},set:function(t){y=t}},stackOffset:{get:function(){return b},set:function(t){b=t}},clipEdge:{get:function(){return _},set:function(t){_=t}},disabled:{get:function(){return t},set:function(e){t=e}},id:{get:function(){return f},set:function(t){f=t}},hideable:{get:function(){return x},set:function(t){x=t}},groupSpacing:{get:function(){return L},set:function(t){L=t}},fillOpacity:{get:function(){return S},set:function(t){S=t}},margin:{get:function(){return l},set:function(t){l.top=void 0!==t.top?t.top:l.top,l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},duration:{get:function(){return k},set:function(t){k=t,Y.reset(k)}},color:{get:function(){return M},set:function(t){M=i.utils.getColor(t)}},barColor:{get:function(){return w},set:function(t){w=t?i.utils.getColor(t):null}}}),i.utils.initOptions(C),C},i.models.multiBarChart=function(){"use strict";var t,e,n=i.models.multiBar(),r=i.models.axis(),a=i.models.axis(),o=i.interactiveGuideline(),s=i.models.legend(),l=i.models.legend(),u=i.models.tooltip(),c={top:30,right:20,bottom:50,left:60},d=null,h=null,f=null,m=i.utils.defaultColor(),p=!0,g={},v=!0,_=null,y=!0,b=!0,M=!1,x=!0,w=!1,k=!1,L=0,S=i.utils.state(),T=null,Y=null,D=d3.dispatch("stateChange","changeState","renderEnd"),C=function(){return p?180:0},E=250,A=!1;S.stacked=!1,n.stacked(!1),r.orient("bottom").tickPadding(7).showMaxMin(!1).tickFormat(function(t){return t}),a.orient(M?"right":"left").tickFormat(d3.format(",.1f")),u.duration(0).valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),o.tooltip.valueFormatter(function(t,e){return null==t?"N/A":a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),o.tooltip.valueFormatter(function(t,e){return null==t?"N/A":a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),o.tooltip.duration(0).valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),l.updateState(!1);var O=i.utils.renderWatch(D),j=!1,N=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),stacked:j}}},H=function(t){return function(e){void 0!==e.stacked&&(j=e.stacked),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function V(Y){return O.reset(),O.models(n),y&&O.models(r),b&&O.models(a),Y.each(function(Y){var O=d3.select(this);i.utils.initSVG(O);var P,F=i.utils.availableWidth(h,O,c),I=i.utils.availableHeight(f,O,c);if(V.update=function(){0===E?O.call(V):O.transition().duration(E).call(V)},V.container=this,S.setter(H(Y),V.update).getter(N(Y)).update(),S.disabled=Y.map(function(t){return!!t.disabled}),!T)for(P in T={},S)S[P]instanceof Array?T[P]=S[P].slice(0):T[P]=S[P];if(!(Y&&Y.length&&Y.filter(function(t){return t.values.length}).length))return i.utils.noData(V,O),V;O.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale();var R=O.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([Y]),W=R.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),z=R.select("g");if(W.append("g").attr("class","nv-x nv-axis"),W.append("g").attr("class","nv-y nv-axis"),W.append("g").attr("class","nv-barsWrap"),W.append("g").attr("class","nv-legendWrap"),W.append("g").attr("class","nv-controlsWrap"),W.append("g").attr("class","nv-interactive"),v?"bottom"===_?(s.width(F-c.right),z.select(".nv-legendWrap").datum(Y).call(s),c.bottom=r.height()+s.height(),I=i.utils.availableHeight(f,O,c),z.select(".nv-legendWrap").attr("transform","translate(0,"+(I+r.height())+")")):(s.width(F-C()),z.select(".nv-legendWrap").datum(Y).call(s),d||s.height()===c.top||(c.top=s.height(),I=i.utils.availableHeight(f,O,c)),z.select(".nv-legendWrap").attr("transform","translate("+C()+","+-c.top+")")):z.select(".nv-legendWrap").selectAll("*").remove(),p){var B=[{key:g.grouped||"Grouped",disabled:n.stacked()},{key:g.stacked||"Stacked",disabled:!n.stacked()}];l.width(C()).color(["#444","#444","#444"]),z.select(".nv-controlsWrap").datum(B).attr("transform","translate(0,"+-c.top+")").call(l)}else z.select(".nv-controlsWrap").selectAll("*").remove();if(R.attr("transform","translate("+c.left+","+c.top+")"),M&&z.select(".nv-y.nv-axis").attr("transform","translate("+F+",0)"),n.disabled(Y.map(function(t){return t.disabled})).width(F).height(I).color(Y.map(function(t,e){return t.color||m(t,e)}).filter(function(t,e){return!Y[e].disabled})),z.select(".nv-barsWrap").datum(Y.filter(function(t){return!t.disabled})).call(n),y){r.scale(t)._ticks(i.utils.calcTicksX(F/100,Y)).tickSize(-I,0),z.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),z.select(".nv-x.nv-axis").call(r);var U=z.select(".nv-x.nv-axis > g").selectAll("g");if(U.selectAll("line, text").style("opacity",1),w){var G=function(t,e){return"translate("+t+","+e+")"};U.selectAll("text").attr("transform",function(t,e,n){return G(0,n%2==0?5:17)});var $=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;z.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(t,e){return G(0,0===e||$%2!=0?17:5)})}k&&z.selectAll(".tick text").call(i.utils.wrapTicks,V.xAxis.rangeBand()),x&&U.filter(function(t,e){return e%Math.ceil(Y[0].values.length/(F/100))!=0}).selectAll("text, line").style("opacity",0),L&&U.selectAll(".tick text").attr("transform","rotate("+L+" 0,0)").style("text-anchor",L>0?"start":"end"),z.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}b&&(a.scale(e)._ticks(i.utils.calcTicksY(I/36,Y)).tickSize(-F,0),z.select(".nv-y.nv-axis").call(a)),A&&(o.width(F).height(I).margin({left:c.left,top:c.top}).svgContainer(O).xScale(t),R.select(".nv-interactive").call(o)),s.dispatch.on("stateChange",function(t){for(var e in t)S[e]=t[e];D.stateChange(S),V.update()}),l.dispatch.on("legendClick",function(t,e){if(t.disabled){switch(B=B.map(function(t){return t.disabled=!0,t}),t.disabled=!1,t.key){case"Grouped":case g.grouped:n.stacked(!1);break;case"Stacked":case g.stacked:n.stacked(!0)}S.stacked=n.stacked(),D.stateChange(S),V.update()}}),D.on("changeState",function(t){void 0!==t.disabled&&(Y.forEach(function(e,n){e.disabled=t.disabled[n]}),S.disabled=t.disabled),void 0!==t.stacked&&(n.stacked(t.stacked),S.stacked=t.stacked,j=t.stacked),V.update()}),A?(o.dispatch.on("elementMousemove",function(e){if(void 0!=e.pointXValue){var n,i,r,a,s=[];Y.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(o,l){i=t.domain().indexOf(e.pointXValue);var u=o.values[i];void 0!==u&&(a=u.x,void 0===n&&(n=u),void 0===r&&(r=e.mouseX),s.push({key:o.key,value:V.y()(u,i),color:m(o,o.seriesIndex),data:o.values[i]}))}),o.tooltip.data({value:a,index:i,series:s})(),o.renderGuideLine(r)}}),o.dispatch.on("elementMouseout",function(t){o.tooltip.hidden(!0)})):(n.dispatch.on("elementMouseover.tooltip",function(t){t.value=V.x()(t.data),t.series={key:t.data.key,value:V.y()(t.data),color:t.color},u.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){u.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){u()}))}),O.renderEnd("multibarchart immediate"),V}return V.dispatch=D,V.multibar=n,V.legend=s,V.controls=l,V.xAxis=r,V.yAxis=a,V.state=S,V.tooltip=u,V.interactiveLayer=o,V.options=i.utils.optionsFunc.bind(V),V._options=Object.create({},{width:{get:function(){return h},set:function(t){h=t}},height:{get:function(){return f},set:function(t){f=t}},showLegend:{get:function(){return v},set:function(t){v=t}},legendPosition:{get:function(){return _},set:function(t){_=t}},showControls:{get:function(){return p},set:function(t){p=t}},controlLabels:{get:function(){return g},set:function(t){g=t}},showXAxis:{get:function(){return y},set:function(t){y=t}},showYAxis:{get:function(){return b},set:function(t){b=t}},defaultState:{get:function(){return T},set:function(t){T=t}},noData:{get:function(){return Y},set:function(t){Y=t}},reduceXTicks:{get:function(){return x},set:function(t){x=t}},rotateLabels:{get:function(){return L},set:function(t){L=t}},staggerLabels:{get:function(){return w},set:function(t){w=t}},wrapLabels:{get:function(){return k},set:function(t){k=!!t}},margin:{get:function(){return c},set:function(t){void 0!==t.top&&(c.top=t.top,d=t.top),c.right=void 0!==t.right?t.right:c.right,c.bottom=void 0!==t.bottom?t.bottom:c.bottom,c.left=void 0!==t.left?t.left:c.left}},duration:{get:function(){return E},set:function(t){E=t,n.duration(E),r.duration(E),a.duration(E),O.reset(E)}},color:{get:function(){return m},set:function(t){m=i.utils.getColor(t),s.color(m)}},rightAlignYAxis:{get:function(){return M},set:function(t){M=t,a.orient(M?"right":"left")}},useInteractiveGuideline:{get:function(){return A},set:function(t){A=t}},barColor:{get:function(){return n.barColor},set:function(t){n.barColor(t),s.color(function(t,e){return d3.rgb("#ccc").darker(1.5*e).toString()})}}}),i.utils.inheritOptions(V,n),i.utils.initOptions(V),V},i.models.multiBarHorizontal=function(){"use strict";var t,e,n,r,a,o,s,l={top:0,right:0,bottom:0,left:0},u=960,c=500,d=Math.floor(1e4*Math.random()),h=null,f=d3.scale.ordinal(),m=d3.scale.linear(),p=function(t){return t.x},g=function(t){return t.y},v=function(t){return t.yErr},_=[0],y=i.utils.defaultColor(),b=null,M=!1,x=!1,w=!1,k=60,L=.1,S=.75,T=d3.format(",.2f"),Y=250,D=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),C=i.utils.renderWatch(D,Y);function E(d){return C.reset(),d.each(function(d){var Y=u-l.left-l.right,E=c-l.top-l.bottom;h=d3.select(this),i.utils.initSVG(h),M&&(d=d3.layout.stack().offset("zero").values(function(t){return t.values}).y(g)(d)),d.forEach(function(t,e){t.values.forEach(function(n){n.series=e,n.key=t.key})}),M&&d[0].values.map(function(t,e){var n=0,i=0;d.map(function(t){var r=t.values[e];r.size=Math.abs(r.y),r.y<0?(r.y1=i-r.size,i-=r.size):(r.y1=n,n+=r.size)})});var A=e&&n?[]:d.map(function(t){return t.values.map(function(t,e){return{x:p(t,e),y:g(t,e),y0:t.y0,y1:t.y1}})});f.domain(e||d3.merge(A).map(function(t){return t.x})).rangeBands(r||[0,E],L),m.domain(n||d3.extent(d3.merge(A).map(function(t){return M?t.y>0?t.y1+t.y:t.y1:t.y}).concat(_))),x&&!M?m.range(a||[m.domain()[0]<0?k:0,Y-(m.domain()[1]>0?k:0)]):m.range(a||[0,Y]),o=o||f,s=s||d3.scale.linear().domain(m.domain()).range([m(0),m(0)]);var O=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([d]),j=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),N=(j.append("defs"),j.append("g"));O.select("g");N.append("g").attr("class","nv-groups"),O.attr("transform","translate("+l.left+","+l.top+")");var H=O.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t,e){return e});H.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),H.exit().watchTransition(C,"multibarhorizontal: exit groups").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),H.attr("class",function(t,e){return"nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}).style("fill",function(t,e){return y(t,e)}).style("stroke",function(t,e){return y(t,e)}),H.watchTransition(C,"multibarhorizontal: groups").style("stroke-opacity",1).style("fill-opacity",S);var V=H.selectAll("g.nv-bar").data(function(t){return t.values});V.exit().remove();var P=V.enter().append("g").attr("transform",function(t,e,n){return"translate("+s(M?t.y0:0)+","+(M?0:n*f.rangeBand()/d.length+f(p(t,e)))+")"});P.append("rect").attr("width",0).attr("height",f.rangeBand()/(M?1:d.length)),V.on("mouseover",function(t,e){d3.select(this).classed("hover",!0),D.elementMouseover({data:t,index:e,color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),D.elementMouseout({data:t,index:e,color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){D.elementMouseout({data:t,index:e,color:d3.select(this).style("fill")})}).on("mousemove",function(t,e){D.elementMousemove({data:t,index:e,color:d3.select(this).style("fill")})}).on("click",function(t,e){D.elementClick({data:t,index:e,color:d3.select(this).style("fill"),event:d3.event,element:this}),d3.event.stopPropagation()}).on("dblclick",function(t,e){D.elementDblClick({data:t,index:e,color:d3.select(this).style("fill")}),d3.event.stopPropagation()}),v(d[0],0)&&(P.append("polyline"),V.select("polyline").attr("fill","none").attr("points",function(t,e){var n=v(t,e),i=.8*f.rangeBand()/(2*(M?1:d.length));return[[(n=(n=n.length?n:[-Math.abs(n),Math.abs(n)]).map(function(n){return m(n+(g(t,e)<0?0:g(t,e)))-m(0)}))[0],-i],[n[0],i],[n[0],0],[n[1],0],[n[1],-i],[n[1],i]].map(function(t){return t.join(",")}).join(" ")}).attr("transform",function(t,e){return"translate(0, "+f.rangeBand()/(2*(M?1:d.length))+")"})),P.append("text"),x&&!M?(V.select("text").attr("text-anchor",function(t,e){return g(t,e)<0?"end":"start"}).attr("y",f.rangeBand()/(2*d.length)).attr("dy",".32em").text(function(t,e){var n=T(g(t,e)),i=v(t,e);return void 0===i?n:i.length?n+"+"+T(Math.abs(i[1]))+"-"+T(Math.abs(i[0])):n+"±"+T(Math.abs(i))}),V.watchTransition(C,"multibarhorizontal: bars").select("text").attr("x",function(t,e){return g(t,e)<0?-4:m(g(t,e))-m(0)+4})):V.selectAll("text").text(""),w&&!M?(P.append("text").classed("nv-bar-label",!0),V.select("text.nv-bar-label").attr("text-anchor",function(t,e){return g(t,e)<0?"start":"end"}).attr("y",f.rangeBand()/(2*d.length)).attr("dy",".32em").text(function(t,e){return p(t,e)}),V.watchTransition(C,"multibarhorizontal: bars").select("text.nv-bar-label").attr("x",function(t,e){return g(t,e)<0?m(0)-m(g(t,e))+4:-4})):V.selectAll("text.nv-bar-label").text(""),V.attr("class",function(t,e){return g(t,e)<0?"nv-bar negative":"nv-bar positive"}),b&&(t||(t=d.map(function(){return!0})),V.style("fill",function(e,n,i){return d3.rgb(b(e,n)).darker(t.map(function(t,e){return e}).filter(function(e,n){return!t[n]})[i]).toString()}).style("stroke",function(e,n,i){return d3.rgb(b(e,n)).darker(t.map(function(t,e){return e}).filter(function(e,n){return!t[n]})[i]).toString()})),M?V.watchTransition(C,"multibarhorizontal: bars").attr("transform",function(t,e){return"translate("+m(t.y1)+","+f(p(t,e))+")"}).select("rect").attr("width",function(t,e){return Math.abs(m(g(t,e)+t.y0)-m(t.y0))||0}).attr("height",f.rangeBand()):V.watchTransition(C,"multibarhorizontal: bars").attr("transform",function(t,e){return"translate("+(g(t,e)<0?m(g(t,e)):m(0))+","+(t.series*f.rangeBand()/d.length+f(p(t,e)))+")"}).select("rect").attr("height",f.rangeBand()/d.length).attr("width",function(t,e){return Math.max(Math.abs(m(g(t,e))-m(0)),1)||0}),o=f.copy(),s=m.copy()}),C.renderEnd("multibarHorizontal immediate"),E}return E.dispatch=D,E.options=i.utils.optionsFunc.bind(E),E._options=Object.create({},{width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},x:{get:function(){return p},set:function(t){p=t}},y:{get:function(){return g},set:function(t){g=t}},yErr:{get:function(){return v},set:function(t){v=t}},xScale:{get:function(){return f},set:function(t){f=t}},yScale:{get:function(){return m},set:function(t){m=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return r},set:function(t){r=t}},yRange:{get:function(){return a},set:function(t){a=t}},forceY:{get:function(){return _},set:function(t){_=t}},stacked:{get:function(){return M},set:function(t){M=t}},showValues:{get:function(){return x},set:function(t){x=t}},disabled:{get:function(){return t},set:function(e){t=e}},id:{get:function(){return d},set:function(t){d=t}},valueFormat:{get:function(){return T},set:function(t){T=t}},valuePadding:{get:function(){return k},set:function(t){k=t}},groupSpacing:{get:function(){return L},set:function(t){L=t}},fillOpacity:{get:function(){return S},set:function(t){S=t}},margin:{get:function(){return l},set:function(t){l.top=void 0!==t.top?t.top:l.top,l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},duration:{get:function(){return Y},set:function(t){Y=t,C.reset(Y)}},color:{get:function(){return y},set:function(t){y=i.utils.getColor(t)}},barColor:{get:function(){return b},set:function(t){b=t?i.utils.getColor(t):null}}}),i.utils.initOptions(E),E},i.models.multiBarHorizontalChart=function(){"use strict";var t,e,n=i.models.multiBarHorizontal(),r=i.models.axis(),a=i.models.axis(),o=i.models.legend().height(30),s=i.models.legend().height(30),l=i.models.tooltip(),u={top:30,right:20,bottom:50,left:60},c=null,d=null,h=null,f=i.utils.defaultColor(),m=!0,p="top",g={},v=!0,_="top",y=!0,b=!0,M=!1,x=i.utils.state(),w=null,k=null,L=d3.dispatch("stateChange","changeState","renderEnd"),S=function(){return m?180:0},T=250;x.stacked=!1,n.stacked(M),r.orient("left").tickPadding(5).showMaxMin(!1).tickFormat(function(t){return t}),a.orient("bottom").tickFormat(d3.format(",.1f")),l.duration(0).valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),s.updateState(!1);var Y=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),stacked:M}}},D=function(t){return function(e){void 0!==e.stacked&&(M=e.stacked),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}},C=i.utils.renderWatch(L,T);function E(l){return C.reset(),C.models(n),y&&C.models(r),b&&C.models(a),l.each(function(l){var k=d3.select(this);i.utils.initSVG(k);var C,A=i.utils.availableWidth(d,k,u),O=i.utils.availableHeight(h,k,u);if(E.update=function(){k.transition().duration(T).call(E)},E.container=this,M=n.stacked(),x.setter(D(l),E.update).getter(Y(l)).update(),x.disabled=l.map(function(t){return!!t.disabled}),!w)for(C in w={},x)x[C]instanceof Array?w[C]=x[C].slice(0):w[C]=x[C];if(!(l&&l.length&&l.filter(function(t){return t.values.length}).length))return i.utils.noData(E,k),E;k.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale().clamp(!0);var j=k.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([l]),N=j.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),H=j.select("g");if(N.append("g").attr("class","nv-x nv-axis"),N.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),N.append("g").attr("class","nv-barsWrap"),N.append("g").attr("class","nv-legendWrap"),N.append("g").attr("class","nv-controlsWrap"),v?(o.width(A-S()),H.select(".nv-legendWrap").datum(l).call(o),"bottom"===_?(u.bottom=r.height()+o.height(),O=i.utils.availableHeight(h,k,u),H.select(".nv-legendWrap").attr("transform","translate("+S()+","+(O+r.height())+")")):"top"===_&&(c||o.height()===u.top||(u.top=o.height(),O=i.utils.availableHeight(h,k,u)),H.select(".nv-legendWrap").attr("transform","translate("+S()+","+-u.top+")"))):H.select(".nv-legendWrap").selectAll("*").remove(),m){var V=[{key:g.grouped||"Grouped",disabled:n.stacked()},{key:g.stacked||"Stacked",disabled:!n.stacked()}];s.width(S()).color(["#444","#444","#444"]),"bottom"===p?(u.bottom=r.height()+o.height(),O=i.utils.availableHeight(h,k,u),H.select(".nv-controlsWrap").datum(V).attr("transform","translate(0,"+(O+r.height())+")").call(s)):"top"===p&&H.select(".nv-controlsWrap").datum(V).attr("transform","translate(0,"+-u.top+")").call(s)}else H.select(".nv-controlsWrap").selectAll("*").remove();(j.attr("transform","translate("+u.left+","+u.top+")"),n.disabled(l.map(function(t){return t.disabled})).width(A).height(O).color(l.map(function(t,e){return t.color||f(t,e)}).filter(function(t,e){return!l[e].disabled})),H.select(".nv-barsWrap").datum(l.filter(function(t){return!t.disabled})).transition().call(n),y)&&(r.scale(t)._ticks(i.utils.calcTicksY(O/24,l)).tickSize(-A,0),H.select(".nv-x.nv-axis").call(r),H.select(".nv-x.nv-axis").selectAll("g").selectAll("line, text"));b&&(a.scale(e)._ticks(i.utils.calcTicksX(A/100,l)).tickSize(-O,0),H.select(".nv-y.nv-axis").attr("transform","translate(0,"+O+")"),H.select(".nv-y.nv-axis").call(a)),H.select(".nv-zeroLine line").attr("x1",e(0)).attr("x2",e(0)).attr("y1",0).attr("y2",-O),o.dispatch.on("stateChange",function(t){for(var e in t)x[e]=t[e];L.stateChange(x),E.update()}),s.dispatch.on("legendClick",function(t,e){if(t.disabled){switch(V=V.map(function(t){return t.disabled=!0,t}),t.disabled=!1,t.key){case"Grouped":case g.grouped:n.stacked(!1);break;case"Stacked":case g.stacked:n.stacked(!0)}x.stacked=n.stacked(),L.stateChange(x),M=n.stacked(),E.update()}}),L.on("changeState",function(t){void 0!==t.disabled&&(l.forEach(function(e,n){e.disabled=t.disabled[n]}),x.disabled=t.disabled),void 0!==t.stacked&&(n.stacked(t.stacked),x.stacked=t.stacked,M=t.stacked),E.update()})}),C.renderEnd("multibar horizontal chart immediate"),E}return n.dispatch.on("elementMouseover.tooltip",function(t){t.value=E.x()(t.data),t.series={key:t.data.key,value:E.y()(t.data),color:t.color},l.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){l.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){l()}),E.dispatch=L,E.multibar=n,E.legend=o,E.controls=s,E.xAxis=r,E.yAxis=a,E.state=x,E.tooltip=l,E.options=i.utils.optionsFunc.bind(E),E._options=Object.create({},{width:{get:function(){return d},set:function(t){d=t}},height:{get:function(){return h},set:function(t){h=t}},showLegend:{get:function(){return v},set:function(t){v=t}},legendPosition:{get:function(){return _},set:function(t){_=t}},controlsPosition:{get:function(){return p},set:function(t){p=t}},showControls:{get:function(){return m},set:function(t){m=t}},controlLabels:{get:function(){return g},set:function(t){g=t}},showXAxis:{get:function(){return y},set:function(t){y=t}},showYAxis:{get:function(){return b},set:function(t){b=t}},defaultState:{get:function(){return w},set:function(t){w=t}},noData:{get:function(){return k},set:function(t){k=t}},margin:{get:function(){return u},set:function(t){void 0!==t.top&&(u.top=t.top,c=t.top),u.right=void 0!==t.right?t.right:u.right,u.bottom=void 0!==t.bottom?t.bottom:u.bottom,u.left=void 0!==t.left?t.left:u.left}},duration:{get:function(){return T},set:function(t){T=t,C.reset(T),n.duration(T),r.duration(T),a.duration(T)}},color:{get:function(){return f},set:function(t){f=i.utils.getColor(t),o.color(f)}},barColor:{get:function(){return n.barColor},set:function(t){n.barColor(t),o.color(function(t,e){return d3.rgb("#ccc").darker(1.5*e).toString()})}}}),i.utils.inheritOptions(E,n),i.utils.initOptions(E),E},i.models.multiBarWithFocusChart=function(){"use strict";var t,e,n,r,a=i.models.multiBar(),o=i.models.multiBar(),s=i.models.axis(),l=i.models.axis(),u=i.interactiveGuideline(),c=i.models.axis(),d=i.models.axis(),h=i.models.legend(),f=i.models.legend(),m=d3.svg.brush(),p=i.models.tooltip(),g={top:30,right:20,bottom:250,left:60},v={top:0,right:30,bottom:20,left:60},_=null,y=null,b=50,M=i.utils.defaultColor(),x=!0,w={},k=!0,L=!1,S=!1,T=!1,Y=40,D=!0,C=!0,E=!1,A=!0,O=!1,j=0,N=!0,H=i.utils.state(),V=null,P=null,F="No Data Available.",I=d3.dispatch("tooltipShow","tooltipHide","brush","stateChange","changeState","renderEnd"),R=function(){return x?180:0},W=250,z=!1;H.stacked=!1,a.stacked(!1),o.stacked(!1),s.orient("bottom").tickPadding(7).showMaxMin(!1).tickFormat(function(t){return t}),l.orient(E?"right":"left").tickFormat(d3.format(",.1f")),c.orient("bottom").tickPadding(5),d.orient("left"),p.duration(0).valueFormatter(function(t,e){return l.tickFormat()(t,e)}).headerFormatter(function(t,e){return s.tickFormat()(t,e)}),u.tooltip.valueFormatter(function(t,e){return null==t?"N/A":l.tickFormat()(t,e)}).headerFormatter(function(t,e){return s.tickFormat()(t,e)}),u.tooltip.valueFormatter(function(t,e){return null==t?"N/A":l.tickFormat()(t,e)}).headerFormatter(function(t,e){return s.tickFormat()(t,e)}),u.tooltip.duration(0).valueFormatter(function(t,e){return l.tickFormat()(t,e)}).headerFormatter(function(t,e){return s.tickFormat()(t,e)}),f.updateState(!1);var B=i.utils.renderWatch(I),U=!1,G=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),stacked:U}}},$=function(t){return function(e){void 0!==e.stacked&&(U=e.stacked),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function q(b){return B.reset(),B.models(a),D&&B.models(s),C&&B.models(l),b.each(function(b){var N=d3.select(this);i.utils.initSVG(N);var B,J=(_||parseInt(N.style("width"))||960)-g.left-g.right,X=(y||parseInt(N.style("height"))||400)-g.top-g.bottom-(L?Y:0),Z=Y-v.top-v.bottom;if(q.update=function(){0===W?N.call(q):N.transition().duration(W).call(q)},q.container=this,H.setter($(b),q.update).getter(G(b)).update(),H.disabled=b.map(function(t){return!!t.disabled}),!P)for(B in P={},H)H[B]instanceof Array?P[B]=H[B].slice(0):P[B]=H[B];if(!(b&&b.length&&b.filter(function(t){return t.values.length}).length)){var K=N.selectAll(".nv-noData").data([F]);return K.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),K.attr("x",g.left+J/2).attr("y",g.top+X/2).text(function(t){return t}),q}N.selectAll(".nv-noData").remove(),t=a.xScale(),e=a.yScale(),n=c.scale(),r=o.yScale(),t.range([0,J]),n.range([0,J]);var Q=d3.min(b[0].values,function(t){return t.x}),tt=d3.max(b[0].values,function(t){return t.x});isNaN(Q)&&(L=!1),L&&(t.domain([Q,tt]),n.domain(t.domain()));var et=N.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([b]),nt=et.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),it=et.select("g"),rt=nt.append("g").attr("class","nv-focus");rt.append("g").attr("class","nv-x nv-axis"),rt.append("g").attr("class","nv-y nv-axis"),rt.append("g").attr("class","nv-barsWrap"),rt.append("g").attr("class","nv-legendWrap"),rt.append("g").attr("class","nv-controlsWrap");var at=nt.append("g").attr("class","nv-context");if(at.append("g").attr("class","nv-x nv-axis"),at.append("g").attr("class","nv-y nv-axis"),at.append("g").attr("class","nv-barsWrap"),at.append("g").attr("class","nv-brushBackground"),at.append("g").attr("class","nv-x nv-brush"),k&&(h.width(J-R()),a.barColor()&&b.forEach(function(t,e){t.color=d3.rgb("#ccc").darker(1.5*e).toString()}),it.select(".nv-legendWrap").datum(b).call(h),g.top!=h.height()&&(g.top=h.height(),X=(y||parseInt(N.style("height"))||400)-g.top-g.bottom),it.select(".nv-legendWrap").attr("transform","translate("+R()+","+-g.top+")")),it.select(".nv-context").style("display",L?"initial":"none"),x){var ot=[{key:w.grouped||"Grouped",disabled:a.stacked()},{key:w.stacked||"Stacked",disabled:!a.stacked()}];f.width(R()).color(["#444","#444","#444"]),it.select(".nv-controlsWrap").datum(ot).attr("transform","translate(0,"+-g.top+")").call(f)}function st(){if(D){s.scale(t).ticks(i.utils.calcTicksX(J/100,b)).tickSize(-X,0),it.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),it.select(".nv-x.nv-axis").call(s);var a=it.select(".nv-x.nv-axis > g").selectAll("g");if(a.selectAll("line, text").style("opacity",1),O){var o=function(t,e){return"translate("+t+","+e+")"};a.selectAll("text").attr("transform",function(t,e,n){return o(0,n%2==0?5:17)});var u=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;it.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(t,e){return o(0,0===e||u%2!=0?17:5)})}A&&a.filter(function(t,e){return e%Math.ceil(b[0].values.length/(J/100))!=0}).selectAll("text, line").style("opacity",0),j&&a.selectAll(".tick text").attr("transform","rotate("+j+" 0,0)").style("text-anchor",j>0?"start":"end"),it.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}C&&(l.scale(e).ticks(i.utils.calcTicksY(X/36,b)).tickSize(-J,0),it.select(".nv-y.nv-axis").call(l)),T&&(c.scale(n).ticks(i.utils.calcTicksX(J/100,b)).tickSize(-Z,0),it.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),it.select(".nv-context .nv-x.nv-axis").transition().call(c)),S&&(d.scale(r).ticks(Z/36).tickSize(-J,0),d3.transition(it.select(".nv-context .nv-y.nv-axis")).call(d),it.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")"),it.select(".nv-context .nv-y1.nv-axis").transition().call(d))}et.attr("transform","translate("+g.left+","+g.top+")"),E&&it.select(".nv-y.nv-axis").attr("transform","translate("+J+",0)"),a.disabled(b.map(function(t){return t.disabled})).width(J).height(X).color(b.map(function(t,e){return t.color||M(t,e)}).filter(function(t,e){return!b[e].disabled})),o.disabled(b.map(function(t){return t.disabled})).width(J).height(Z).color(b.map(function(t,e){return t.color||M(t,e)}).filter(function(t,e){return!b[e].disabled})),it.select(".nv-barsWrap").datum(b.filter(function(t){return!t.disabled})).call(a),it.select(".nv-context").attr("transform","translate(0,"+(X+g.bottom+v.top)+")"),it.select(".nv-context .nv-barsWrap").datum(b.filter(function(t){return!t.disabled})).transition().call(o),st(),m.x(n).on("brush",function(t){var e=q.duration();q.duration(0),dt(),q.duration(e)}),V&&m.extent(V);var lt=it.select(".nv-brushBackground").selectAll("g").data([V||m.extent()]),ut=lt.enter().append("g");ut.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",Z),ut.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",Z);var ct=it.select(".nv-x.nv-brush").call(m);function dt(){V=m.empty()?null:m.extent();var t=m.empty()?n.domain():m.extent();Math.abs(t[0]-t[1])<=1||(I.brush({extent:t,brush:m}),m.empty()||m.extent(V),lt.data([m.empty()?n.domain():V]).each(function(t,e){var i=n(t[0])-n.range()[0],r=n.range()[1]-n(t[1]);d3.select(this).select(".left").attr("width",i<0?0:i),d3.select(this).select(".right").attr("x",n(t[1])).attr("width",r<0?0:r)}),it.select(".nv-focus .nv-barsWrap").datum(b.filter(function(t){return!t.disabled}).map(function(e,n){return{key:e.key,area:e.area,values:e.values.filter(function(e,n){return a.x()(e,n)>=t[0]&&a.x()(e,n)<=t[1]})}})).transition().duration(W).call(a),st(),it.select(".nv-focus .nv-x.nv-axis").call(s),it.select(".nv-focus .nv-y.nv-axis").transition().duration(W).call(l))}ct.selectAll("rect").attr("height",Z),ct.selectAll(".resize").append("path").attr("d",function(t){var e=+("e"==t),n=e?1:-1,i=Z/3;return"M"+.5*n+","+i+"A6,6 0 0 "+e+" "+6.5*n+","+(i+6)+"V"+(2*i-6)+"A6,6 0 0 "+e+" "+.5*n+","+2*i+"ZM"+2.5*n+","+(i+8)+"V"+(2*i-8)+"M"+4.5*n+","+(i+8)+"V"+(2*i-8)}),dt(),z&&(u.width(J).height(X).margin({left:g.left,top:g.top}).svgContainer(N).xScale(t),et.select(".nv-interactive").call(u)),h.dispatch.on("stateChange",function(t){for(var e in t)H[e]=t[e];I.stateChange(H),q.update()}),f.dispatch.on("legendClick",function(t,e){if(t.disabled){switch(ot=ot.map(function(t){return t.disabled=!0,t}),t.disabled=!1,t.key){case"Grouped":case w.grouped:a.stacked(!1),o.stacked(!1);break;case"Stacked":case w.stacked:a.stacked(!0),o.stacked(!0)}H.stacked=a.stacked(),I.stateChange(H),q.update()}}),I.on("changeState",function(t){void 0!==t.disabled&&(b.forEach(function(e,n){e.disabled=t.disabled[n]}),H.disabled=t.disabled),void 0!==t.stacked&&(a.stacked(t.stacked),o.stacked(t.stacked),H.stacked=t.stacked,U=t.stacked),q.update()}),z?(u.dispatch.on("elementMousemove",function(e){if(void 0!=e.pointXValue){var n,i,r,a,o=[];b.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(s,l){i=t.domain().indexOf(e.pointXValue);var u=s.values[i];void 0!==u&&(a=u.x,void 0===n&&(n=u),void 0===r&&(r=e.mouseX),o.push({key:s.key,value:q.y()(u,i),color:M(s,s.seriesIndex),data:s.values[i]}))}),u.tooltip.data({value:a,index:i,series:o})(),u.renderGuideLine(r)}}),u.dispatch.on("elementMouseout",function(t){u.tooltip.hidden(!0)})):(a.dispatch.on("elementMouseover.tooltip",function(t){t.value=q.x()(t.data),t.series={key:t.data.key,value:q.y()(t.data),color:t.color},p.data(t).hidden(!1)}),a.dispatch.on("elementMouseout.tooltip",function(t){p.hidden(!0)}),a.dispatch.on("elementMousemove.tooltip",function(t){p()}))}),B.renderEnd("multibarwithfocuschart immediate"),q}return q.dispatch=I,q.multibar=a,q.multibar2=o,q.legend=h,q.xAxis=s,q.yAxis=l,q.state=H,q.x2Axis=c,q.y2Axis=d,q.options=i.utils.optionsFunc.bind(q),q.tooltip=p,q.interactiveLayer=u,q._options=Object.create({},{width:{get:function(){return _},set:function(t){_=t}},height:{get:function(){return y},set:function(t){y=t}},focusHeight:{get:function(){return b},set:function(t){b=t}},showLegend:{get:function(){return k},set:function(t){k=t}},brushExtent:{get:function(){return V},set:function(t){V=t}},showControls:{get:function(){return x},set:function(t){x=t}},controlLabels:{get:function(){return w},set:function(t){w=t}},showXAxis:{get:function(){return D},set:function(t){D=t}},showYAxis:{get:function(){return C},set:function(t){C=t}},tooltips:{get:function(){return N},set:function(t){N=t}},tooltipContent:{get:function(){return p},set:function(t){p=t}},defaultState:{get:function(){return P},set:function(t){P=t}},noData:{get:function(){return F},set:function(t){F=t}},reduceXTicks:{get:function(){return A},set:function(t){A=t}},rotateLabels:{get:function(){return j},set:function(t){j=t}},staggerLabels:{get:function(){return O},set:function(t){O=t}},focusEnable:{get:function(){return L},set:function(t){L=t}},focusShowAxisX:{get:function(){return T},set:function(t){T=t}},focusShowAxisY:{get:function(){return S},set:function(t){S=t}},margin:{get:function(){return g},set:function(t){g.top=void 0!==t.top?t.top:g.top,g.right=void 0!==t.right?t.right:g.right,g.bottom=void 0!==t.bottom?t.bottom:g.bottom,g.left=void 0!==t.left?t.left:g.left}},duration:{get:function(){return W},set:function(t){W=t,a.duration(W),s.duration(W),l.duration(W),B.reset(W)}},interpolate:{get:function(){return a.interpolate()},set:function(t){a.interpolate(t)}},color:{get:function(){return M},set:function(t){M=i.utils.getColor(t),h.color(M)}},rightAlignYAxis:{get:function(){return E},set:function(t){E=t,l.orient(E?"right":"left")}},xTickFormat:{get:function(){return s.xTickFormat()},set:function(t){s.xTickFormat(t),c.xTickFormat(t)}},yTickFormat:{get:function(){return l.yTickFormat()},set:function(t){l.yTickFormat(t),d.yTickFormat(t)}},x:{get:function(){return a.x()},set:function(t){a.x(t),o.x(t)}},y:{get:function(){return a.y()},set:function(t){a.y(t),o.y(t)}},useInteractiveGuideline:{get:function(){return z},set:function(t){z=t}},barColor:{get:function(){return a.barColor},set:function(t){a.barColor(t),o.barColor(t),h.color(function(t,e){return d3.rgb("#ccc").darker(1.5*e).toString()})}}}),i.utils.inheritOptions(q,a),i.utils.initOptions(q),q},i.models.multiChart=function(){"use strict";var t,e,n={top:30,right:20,bottom:50,left:60},r=null,a=i.utils.defaultColor(),o=null,s=null,l=!0,u=null,c=function(t){return t.x},d=function(t){return t.y},h="linear",f=!0,m=i.interactiveGuideline(),p=!1,g=" (right axis)",v=250,_=d3.scale.linear(),y=d3.scale.linear(),b=d3.scale.linear(),M=i.models.line().yScale(y).duration(v),x=i.models.line().yScale(b).duration(v),w=i.models.scatter().yScale(y).duration(v),k=i.models.scatter().yScale(b).duration(v),L=i.models.multiBar().stacked(!1).yScale(y).duration(v),S=i.models.multiBar().stacked(!1).yScale(b).duration(v),T=i.models.stackedArea().yScale(y).duration(v),Y=i.models.stackedArea().yScale(b).duration(v),D=i.models.axis().scale(_).orient("bottom").tickPadding(5).duration(v),C=i.models.axis().scale(y).orient("left").duration(v),E=i.models.axis().scale(b).orient("right").duration(v),A=i.models.legend().height(30),O=i.models.tooltip(),j=d3.dispatch(),N=[M,x,w,k,L,S,T,Y];function H(u){return u.each(function(u){var f=d3.select(this);i.utils.initSVG(f),H.update=function(){f.transition().call(H)},H.container=this;var v=i.utils.availableWidth(o,f,n),j=i.utils.availableHeight(s,f,n),V=u.filter(function(t){return"line"==t.type&&1==t.yAxis}),P=u.filter(function(t){return"line"==t.type&&2==t.yAxis}),F=u.filter(function(t){return"scatter"==t.type&&1==t.yAxis}),I=u.filter(function(t){return"scatter"==t.type&&2==t.yAxis}),R=u.filter(function(t){return"bar"==t.type&&1==t.yAxis}),W=u.filter(function(t){return"bar"==t.type&&2==t.yAxis}),z=u.filter(function(t){return"area"==t.type&&1==t.yAxis}),B=u.filter(function(t){return"area"==t.type&&2==t.yAxis});if(!(u&&u.length&&u.filter(function(t){return t.values.length}).length))return i.utils.noData(H,f),H;f.selectAll(".nv-noData").remove();var U=u.filter(function(t){return!t.disabled&&1==t.yAxis}).map(function(t){return t.values.map(function(t,e){return{x:c(t),y:d(t)}})}),G=u.filter(function(t){return!t.disabled&&2==t.yAxis}).map(function(t){return t.values.map(function(t,e){return{x:c(t),y:d(t)}})});_.domain(d3.extent(d3.merge(U.concat(G)),function(t){return t.x})).range([0,v]);var $=f.selectAll("g.wrap.multiChart").data([u]),q=$.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");q.append("g").attr("class","nv-x nv-axis"),q.append("g").attr("class","nv-y1 nv-axis"),q.append("g").attr("class","nv-y2 nv-axis"),q.append("g").attr("class","stack1Wrap"),q.append("g").attr("class","stack2Wrap"),q.append("g").attr("class","bars1Wrap"),q.append("g").attr("class","bars2Wrap"),q.append("g").attr("class","scatters1Wrap"),q.append("g").attr("class","scatters2Wrap"),q.append("g").attr("class","lines1Wrap"),q.append("g").attr("class","lines2Wrap"),q.append("g").attr("class","legendWrap"),q.append("g").attr("class","nv-interactive");var J=$.select("g"),X=u.map(function(t,e){return u[e].color||a(t,e)});if(l){var Z=A.align()?v/2:v,K=A.align()?Z:0;A.width(Z),A.color(X),J.select(".legendWrap").datum(u.map(function(t){return t.originalKey=void 0===t.originalKey?t.key:t.originalKey,t.key=t.originalKey+(1==t.yAxis?"":g),t})).call(A),r||A.height()===n.top||(n.top=A.height(),j=i.utils.availableHeight(s,f,n)),J.select(".legendWrap").attr("transform","translate("+K+","+-n.top+")")}else J.select(".legendWrap").selectAll("*").remove();M.width(v).height(j).interpolate(h).color(X.filter(function(t,e){return!u[e].disabled&&1==u[e].yAxis&&"line"==u[e].type})),x.width(v).height(j).interpolate(h).color(X.filter(function(t,e){return!u[e].disabled&&2==u[e].yAxis&&"line"==u[e].type})),w.width(v).height(j).color(X.filter(function(t,e){return!u[e].disabled&&1==u[e].yAxis&&"scatter"==u[e].type})),k.width(v).height(j).color(X.filter(function(t,e){return!u[e].disabled&&2==u[e].yAxis&&"scatter"==u[e].type})),L.width(v).height(j).color(X.filter(function(t,e){return!u[e].disabled&&1==u[e].yAxis&&"bar"==u[e].type})),S.width(v).height(j).color(X.filter(function(t,e){return!u[e].disabled&&2==u[e].yAxis&&"bar"==u[e].type})),T.width(v).height(j).interpolate(h).color(X.filter(function(t,e){return!u[e].disabled&&1==u[e].yAxis&&"area"==u[e].type})),Y.width(v).height(j).interpolate(h).color(X.filter(function(t,e){return!u[e].disabled&&2==u[e].yAxis&&"area"==u[e].type})),J.attr("transform","translate("+n.left+","+n.top+")");var Q=J.select(".lines1Wrap").datum(V.filter(function(t){return!t.disabled})),tt=J.select(".scatters1Wrap").datum(F.filter(function(t){return!t.disabled})),et=J.select(".bars1Wrap").datum(R.filter(function(t){return!t.disabled})),nt=J.select(".stack1Wrap").datum(z.filter(function(t){return!t.disabled})),it=J.select(".lines2Wrap").datum(P.filter(function(t){return!t.disabled})),rt=J.select(".scatters2Wrap").datum(I.filter(function(t){return!t.disabled})),at=J.select(".bars2Wrap").datum(W.filter(function(t){return!t.disabled})),ot=J.select(".stack2Wrap").datum(B.filter(function(t){return!t.disabled})),st=[];L.stacked()&&R.length&&((st=R.filter(function(t){return!t.disabled}).map(function(t){return t.values})).length>0&&(st=st.reduce(function(t,e){return t.map(function(t,n){return{x:t.x,y:t.y+e[n].y}})})));R.length&&st.push({x:0,y:0});var lt=[];S.stacked()&&W.length&&((lt=W.filter(function(t){return!t.disabled}).map(function(t){return t.values})).length>0&&(lt=lt.reduce(function(t,e){return t.map(function(t,n){return{x:t.x,y:t.y+e[n].y}})})));function ut(t){return d3.transpose(t).map(function(t){return t.map(function(t){return t.y})}).map(function(t){return d3.sum(t)})}if(W.length&<.push({x:0,y:0}),y.domain(t||d3.extent(d3.merge(U).concat(st),function(t){return t.y})).range([0,j]),b.domain(e||d3.extent(d3.merge(G).concat(lt),function(t){return t.y})).range([0,j]),M.yDomain(y.domain()),w.yDomain(y.domain()),L.stacked()){var ct=y.domain([0,d3.max(ut(U))]).range([0,j]);L.yDomain(ct.domain())}else L.yDomain(y.domain());if(T.yDomain(y.domain()),x.yDomain(b.domain()),k.yDomain(b.domain()),S.stacked()){var dt=b.domain([0,d3.max(ut(G))]).range([0,j]);S.yDomain(dt.domain())}else S.yDomain(b.domain());function ht(t){var e=2===t.series.yAxis?E:C;t.value=t.point.x,t.series={value:t.point.y,color:t.point.color,key:t.series.key},O.duration(0).headerFormatter(function(t,e){return D.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function ft(t){var e=2===t.series.yAxis?E:C;t.value=t.point.x,t.series={value:t.point.y,color:t.point.color,key:t.series.key},O.duration(100).headerFormatter(function(t,e){return D.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function mt(t){var e=2===t.series.yAxis?E:C;t.point.x=T.x()(t.point),t.point.y=T.y()(t.point),O.duration(0).headerFormatter(function(t,e){return D.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function pt(t){var e=2===t.series.yAxis?E:C;t.value=L.x()(t.data),t.series={value:L.y()(t.data),color:t.color,key:t.data.key},O.duration(0).headerFormatter(function(t,e){return D.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function gt(){for(var t=0,e=N.length;t<e;t++){var n=N[t];try{n.clearHighlights()}catch(t){}}}Y.yDomain(b.domain()),z.length&&d3.transition(nt).call(T),B.length&&d3.transition(ot).call(Y),R.length&&d3.transition(et).call(L),W.length&&d3.transition(at).call(S),V.length&&d3.transition(Q).call(M),P.length&&d3.transition(it).call(x),F.length&&d3.transition(tt).call(w),I.length&&d3.transition(rt).call(k),D._ticks(i.utils.calcTicksX(v/100,u)).tickSize(-j,0),J.select(".nv-x.nv-axis").attr("transform","translate(0,"+j+")"),d3.transition(J.select(".nv-x.nv-axis")).call(D),C._ticks(i.utils.calcTicksY(j/36,u)).tickSize(-v,0),d3.transition(J.select(".nv-y1.nv-axis")).call(C),E._ticks(i.utils.calcTicksY(j/36,u)).tickSize(-v,0),d3.transition(J.select(".nv-y2.nv-axis")).call(E),J.select(".nv-y1.nv-axis").classed("nv-disabled",!U.length).attr("transform","translate("+_.range()[0]+",0)"),J.select(".nv-y2.nv-axis").classed("nv-disabled",!G.length).attr("transform","translate("+_.range()[1]+",0)"),A.dispatch.on("stateChange",function(t){H.update()}),p&&(m.width(v).height(j).margin({left:n.left,top:n.top}).svgContainer(f).xScale(_),$.select(".nv-interactive").call(m)),p?(m.dispatch.on("elementMousemove",function(t){gt();var e,n,r,o=[];u.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(s,l){var u=_.domain(),c=s.values.filter(function(t,e){return H.x()(t,e)>=u[0]&&H.x()(t,e)<=u[1]}),d=c[n=i.interactiveBisect(c,t.pointXValue,H.x())],h=H.y()(d,n);null===h||isNaN(h)||s.noHighlightSeries||function(t,e,n,i){var r={line:{yAxis1:{chart:M,data:V},yAxis2:{chart:x,data:P}},scatter:{yAxis1:{chart:w,data:F},yAxis2:{chart:k,data:I}},bar:{yAxis1:{chart:L,data:R},yAxis2:{chart:S,data:W}},area:{yAxis1:{chart:T,data:z},yAxis2:{chart:Y,data:B}}},a=r[t.type]["yAxis"+t.yAxis].chart,o=r[t.type]["yAxis"+t.yAxis].data.reduce(function(e,n,i){return n.key===t.key?i:e},0);try{a.highlightPoint(o,e,n,i)}catch(t){}}(s,n,!0),void 0!==d&&(void 0===e&&(e=d),void 0===r&&(r=_(H.x()(d,n))),o.push({key:s.key,value:h,color:a(s,s.seriesIndex),data:d,yAxis:2==s.yAxis?E:C}))});m.tooltip.headerFormatter(function(t,e){return D.tickFormat()(t,e)}).valueFormatter(m.tooltip.valueFormatter()||function(t,e){var n=o[e].yAxis;return null==t?"N/A":n.tickFormat()(t)}).data({value:H.x()(e,n),index:n,series:o})(),m.renderGuideLine(r)}),m.dispatch.on("elementMouseout",function(t){gt()})):(M.dispatch.on("elementMouseover.tooltip",ht),x.dispatch.on("elementMouseover.tooltip",ht),M.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),x.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),w.dispatch.on("elementMouseover.tooltip",ft),k.dispatch.on("elementMouseover.tooltip",ft),w.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),k.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),T.dispatch.on("elementMouseover.tooltip",mt),Y.dispatch.on("elementMouseover.tooltip",mt),T.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),Y.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),L.dispatch.on("elementMouseover.tooltip",pt),S.dispatch.on("elementMouseover.tooltip",pt),L.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),S.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),L.dispatch.on("elementMousemove.tooltip",function(t){O()}),S.dispatch.on("elementMousemove.tooltip",function(t){O()}))}),H}return H.dispatch=j,H.legend=A,H.lines1=M,H.lines2=x,H.scatters1=w,H.scatters2=k,H.bars1=L,H.bars2=S,H.stack1=T,H.stack2=Y,H.xAxis=D,H.yAxis1=C,H.yAxis2=E,H.tooltip=O,H.interactiveLayer=m,H.options=i.utils.optionsFunc.bind(H),H._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},showLegend:{get:function(){return l},set:function(t){l=t}},xScale:{get:function(){return _},set:function(t){_=t,D.scale(_)}},yDomain1:{get:function(){return t},set:function(e){t=e}},yDomain2:{get:function(){return e},set:function(t){e=t}},noData:{get:function(){return u},set:function(t){u=t}},interpolate:{get:function(){return h},set:function(t){h=t}},legendRightAxisHint:{get:function(){return g},set:function(t){g=t}},margin:{get:function(){return n},set:function(t){void 0!==t.top&&(n.top=t.top,r=t.top),n.right=void 0!==t.right?t.right:n.right,n.bottom=void 0!==t.bottom?t.bottom:n.bottom,n.left=void 0!==t.left?t.left:n.left}},color:{get:function(){return a},set:function(t){a=i.utils.getColor(t)}},x:{get:function(){return c},set:function(t){c=t,M.x(t),x.x(t),w.x(t),k.x(t),L.x(t),S.x(t),T.x(t),Y.x(t)}},y:{get:function(){return d},set:function(t){d=t,M.y(t),x.y(t),w.y(t),k.y(t),T.y(t),Y.y(t),L.y(t),S.y(t)}},useVoronoi:{get:function(){return f},set:function(t){f=t,M.useVoronoi(t),x.useVoronoi(t),T.useVoronoi(t),Y.useVoronoi(t)}},useInteractiveGuideline:{get:function(){return p},set:function(t){(p=t)&&(M.interactive(!1),M.useVoronoi(!1),x.interactive(!1),x.useVoronoi(!1),T.interactive(!1),T.useVoronoi(!1),Y.interactive(!1),Y.useVoronoi(!1),w.interactive(!1),k.interactive(!1))}},duration:{get:function(){return v},set:function(t){v=t,[M,x,T,Y,w,k,D,C,E].forEach(function(t){t.duration(v)})}}}),i.utils.initOptions(H),H},i.models.ohlcBar=function(){"use strict";var t,e,n,r,a={top:0,right:0,bottom:0,left:0},o=null,s=null,l=Math.floor(1e4*Math.random()),u=null,c=d3.scale.linear(),d=d3.scale.linear(),h=function(t){return t.x},f=function(t){return t.y},m=function(t){return t.open},p=function(t){return t.close},g=function(t){return t.high},v=function(t){return t.low},_=[],y=[],b=!1,M=!0,x=i.utils.defaultColor(),w=!1,k=d3.dispatch("stateChange","changeState","renderEnd","chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove");function L(w){return w.each(function(w){u=d3.select(this);var L=i.utils.availableWidth(o,u,a),S=i.utils.availableHeight(s,u,a);i.utils.initSVG(u);var T=L/w[0].values.length*.9;c.domain(t||d3.extent(w[0].values.map(h).concat(_))),b?c.range(n||[.5*L/w[0].values.length,L*(w[0].values.length-.5)/w[0].values.length]):c.range(n||[5+T/2,L-T/2-5]),d.domain(e||[d3.min(w[0].values.map(v).concat(y)),d3.max(w[0].values.map(g).concat(y))]).range(r||[S,0]),c.domain()[0]===c.domain()[1]&&(c.domain()[0]?c.domain([c.domain()[0]-.01*c.domain()[0],c.domain()[1]+.01*c.domain()[1]]):c.domain([-1,1])),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]+.01*d.domain()[0],d.domain()[1]-.01*d.domain()[1]]):d.domain([-1,1]));var Y=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([w[0].values]),D=Y.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),C=D.append("defs"),E=D.append("g"),A=Y.select("g");E.append("g").attr("class","nv-ticks"),Y.attr("transform","translate("+a.left+","+a.top+")"),u.on("click",function(t,e){k.chartClick({data:t,index:e,pos:d3.event,id:l})}),C.append("clipPath").attr("id","nv-chart-clip-path-"+l).append("rect"),Y.select("#nv-chart-clip-path-"+l+" rect").attr("width",L).attr("height",S),A.attr("clip-path",M?"url(#nv-chart-clip-path-"+l+")":"");var O=Y.select(".nv-ticks").selectAll(".nv-tick").data(function(t){return t});O.exit().remove(),O.enter().append("path").attr("class",function(t,e,n){return(m(t,e)>p(t,e)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+e}).attr("d",function(t,e){return"m0,0l0,"+(d(m(t,e))-d(g(t,e)))+"l"+-T/2+",0l"+T/2+",0l0,"+(d(v(t,e))-d(m(t,e)))+"l0,"+(d(p(t,e))-d(v(t,e)))+"l"+T/2+",0l"+-T/2+",0z"}).attr("transform",function(t,e){return"translate("+c(h(t,e))+","+d(g(t,e))+")"}).attr("fill",function(t,e){return x[0]}).attr("stroke",function(t,e){return x[0]}).attr("x",0).attr("y",function(t,e){return d(Math.max(0,f(t,e)))}).attr("height",function(t,e){return Math.abs(d(f(t,e))-d(0))}),O.attr("class",function(t,e,n){return(m(t,e)>p(t,e)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+e}),d3.transition(O).attr("transform",function(t,e){return"translate("+c(h(t,e))+","+d(g(t,e))+")"}).attr("d",function(t,e){var n=L/w[0].values.length*.9;return"m0,0l0,"+(d(m(t,e))-d(g(t,e)))+"l"+-n/2+",0l"+n/2+",0l0,"+(d(v(t,e))-d(m(t,e)))+"l0,"+(d(p(t,e))-d(v(t,e)))+"l"+n/2+",0l"+-n/2+",0z"})}),L}return L.highlightPoint=function(t,e){L.clearHighlights(),u.select(".nv-ohlcBar .nv-tick-0-"+t).classed("hover",e)},L.clearHighlights=function(){u.select(".nv-ohlcBar .nv-tick.hover").classed("hover",!1)},L.dispatch=k,L.options=i.utils.optionsFunc.bind(L),L._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},xScale:{get:function(){return c},set:function(t){c=t}},yScale:{get:function(){return d},set:function(t){d=t}},xDomain:{get:function(){return t},set:function(e){t=e}},yDomain:{get:function(){return e},set:function(t){e=t}},xRange:{get:function(){return n},set:function(t){n=t}},yRange:{get:function(){return r},set:function(t){r=t}},forceX:{get:function(){return _},set:function(t){_=t}},forceY:{get:function(){return y},set:function(t){y=t}},padData:{get:function(){return b},set:function(t){b=t}},clipEdge:{get:function(){return M},set:function(t){M=t}},id:{get:function(){return l},set:function(t){l=t}},interactive:{get:function(){return w},set:function(t){w=t}},x:{get:function(){return h},set:function(t){h=t}},y:{get:function(){return f},set:function(t){f=t}},open:{get:function(){return m()},set:function(t){m=t}},close:{get:function(){return p()},set:function(t){p=t}},high:{get:function(){return g},set:function(t){g=t}},low:{get:function(){return v},set:function(t){v=t}},margin:{get:function(){return a},set:function(t){a.top=void 0!=t.top?t.top:a.top,a.right=void 0!=t.right?t.right:a.right,a.bottom=void 0!=t.bottom?t.bottom:a.bottom,a.left=void 0!=t.left?t.left:a.left}},color:{get:function(){return x},set:function(t){x=i.utils.getColor(t)}}}),i.utils.initOptions(L),L},i.models.parallelCoordinates=function(){"use strict";var t,e,n,r={top:30,right:0,bottom:10,left:0},a=null,o=null,s=null,l=null,u=d3.scale.ordinal(),c={},d="undefined values",h=[],f=[],m=[],p=!0,g=i.utils.defaultColor(),v=[],_=[],y=[],b=[],M=1,x=d3.svg.line(),w=d3.svg.axis(),k=d3.dispatch("brushstart","brush","brushEnd","dimensionsOrder","stateChange","elementClick","elementMouseover","elementMouseout","elementMousemove","renderEnd","activeChanged"),L=i.utils.renderWatch(k);function S(T){return L.reset(),T.each(function(L){var S=d3.select(this);if(s=i.utils.availableWidth(a,S,r),l=i.utils.availableHeight(o,S,r),i.utils.initSVG(S),void 0===L[0].values){var T=[];L.forEach(function(t){var e={};Object.keys(t).forEach(function(n){"name"!==n&&(e[n]=t[n])}),T.push({key:t.name,values:e})}),L=T}var Y=L.map(function(t){return t.values});0===_.length&&(_=L),m=h.sort(function(t,e){return t.currentPosition-e.currentPosition}).map(function(t){return t.key}),f=h.filter(function(t){return!t.disabled}),u.rangePoints([0,s],1).domain(f.map(function(t){return t.key}));var D={},C=!1,E=[];m.forEach(function(t){var e=d3.extent(Y,function(e){return+e[t]}),n=e[0],i=e[1],r=!1;(isNaN(n)||isNaN(i))&&(r=!0,n=0,i=0),n===i&&(n-=1,i+=1);var a=v.filter(function(e){return e.dimension==t});0!==a.length&&(r?(n=c[t].domain()[0],i=c[t].domain()[1]):!a[0].hasOnlyNaN&&p?(n=n>a[0].extent[0]?a[0].extent[0]:n,i=i<a[0].extent[1]?a[0].extent[1]:i):a[0].hasNaN&&(i=i<a[0].extent[1]?a[0].extent[1]:i,D[t]=c[t].domain()[1],C=!0)),c[t]=d3.scale.linear().domain([n,i]).range([.9*(l-12),0]),b=[],c[t].brush=d3.svg.brush().y(c[t]).on("brushstart",G).on("brush",$).on("brushend",q)});var A=S.selectAll("g.nv-wrap.nv-parallelCoordinates").data([L]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-parallelCoordinates").append("g"),j=A.select("g");O.append("g").attr("class","nv-parallelCoordinates background"),O.append("g").attr("class","nv-parallelCoordinates foreground"),O.append("g").attr("class","nv-parallelCoordinates missingValuesline"),A.attr("transform","translate("+r.left+","+r.top+")"),x.interpolate("cardinal").tension(M),w.orient("left");var N,H,V=d3.behavior.drag().on("dragstart",function(t){y[t.key]=this.parentNode.__origin__=u(t.key),e.attr("visibility","hidden")}).on("drag",function(e){y[e.key]=Math.min(s,Math.max(0,this.parentNode.__origin__+=d3.event.x)),t.attr("d",B),f.sort(function(t,e){return X(t.key)-X(e.key)}),f.forEach(function(t,e){return t.currentPosition=e}),u.domain(f.map(function(t){return t.key})),n.attr("transform",function(t){return"translate("+X(t.key)+")"})}).on("dragend",function(n,i){delete this.parentNode.__origin__,delete y[n.key],d3.select(this.parentNode).attr("transform","translate("+u(n.key)+")"),t.attr("d",B),e.attr("d",B).attr("visibility",null),k.dimensionsOrder(f)}),P=u.range()[1]-u.range()[0];if(P=isNaN(P)?u.range()[0]:P,!isNaN(P)){var F=[0+P/2,l-12,s-P/2,l-12];(N=A.select(".missingValuesline").selectAll("line").data([F])).enter().append("line"),N.exit().remove(),N.attr("x1",function(t){return t[0]}).attr("y1",function(t){return t[1]}).attr("x2",function(t){return t[2]}).attr("y2",function(t){return t[3]}),(H=A.select(".missingValuesline").selectAll("text").data([d])).append("text").data([d]),H.enter().append("text"),H.exit().remove(),H.attr("y",l).attr("x",s-92-P/2).text(function(t){return t})}(e=A.select(".background").selectAll("path").data(L)).enter().append("path"),e.exit().remove(),e.attr("d",B),(t=A.select(".foreground").selectAll("path").data(L)).enter().append("path"),t.exit().remove(),t.attr("d",B).style("stroke-width",function(t,e){return isNaN(t.strokeWidth)&&(t.strokeWidth=1),t.strokeWidth}).attr("stroke",function(t,e){return t.color||g(t,e)}),t.on("mouseover",function(t,e){d3.select(this).classed("hover",!0).style("stroke-width",t.strokeWidth+2+"px").style("stroke-opacity",1),k.elementMouseover({label:t.name,color:t.color||g(t,e),values:t.values,dimensions:f})}),t.on("mouseout",function(t,e){d3.select(this).classed("hover",!1).style("stroke-width",t.strokeWidth+"px").style("stroke-opacity",.7),k.elementMouseout({label:t.name,index:e})}),t.on("mousemove",function(t,e){k.elementMousemove()}),t.on("click",function(t){k.elementClick({id:t.id})});var I=(n=j.selectAll(".dimension").data(f)).enter().append("g").attr("class","nv-parallelCoordinates dimension");n.attr("transform",function(t){return"translate("+u(t.key)+",0)"}),I.append("g").attr("class","nv-axis"),I.append("text").attr("class","nv-label").style("cursor","move").attr("dy","-1em").attr("text-anchor","middle").on("mouseover",function(t,e){k.elementMouseover({label:t.tooltip||t.key,color:t.color})}).on("mouseout",function(t,e){k.elementMouseout({label:t.tooltip})}).on("mousemove",function(t,e){k.elementMousemove()}).call(V),I.append("g").attr("class","nv-brushBackground"),n.exit().remove(),n.select(".nv-label").text(function(t){return t.key}),U(p);var R=m.filter(function(t){return!c[t].brush.empty()}),W=R.map(function(t){return c[t].brush.extent()}),z=_.slice(0);function B(t){return x(f.map(function(e){if(isNaN(t.values[e.key])||isNaN(parseFloat(t.values[e.key]))||C){var n=c[e.key].domain(),i=c[e.key].range(),r=n[0]-(n[1]-n[0])/9;if(b.indexOf(e.key)<0){var a=d3.scale.linear().domain([r,n[1]]).range([l-12,i[1]]);c[e.key].brush.y(a),b.push(e.key)}if(isNaN(t.values[e.key])||isNaN(parseFloat(t.values[e.key])))return[u(e.key),c[e.key](r)]}return void 0!==N&&(b.length>0||C?(N.style("display","inline"),H.style("display","inline")):(N.style("display","none"),H.style("display","none"))),[u(e.key),c[e.key](t.values[e.key])]}))}function U(t){v.forEach(function(e){var n=c[e.dimension].brush.y().domain();e.hasOnlyNaN&&(e.extent[1]=(c[e.dimension].domain()[1]-n[0])*(e.extent[1]-e.extent[0])/(D[e.dimension]-e.extent[0])+n[0]),e.hasNaN&&(e.extent[0]=n[0]),t&&c[e.dimension].brush.extent(e.extent)}),n.select(".nv-brushBackground").each(function(t){d3.select(this).call(c[t.key].brush)}).selectAll("rect").attr("x",-8).attr("width",16),J()}function G(){!1===p&&(p=!0,U(!0))}function $(){R=m.filter(function(t){return!c[t].brush.empty()}),W=R.map(function(t){return c[t].brush.extent()}),v=[],R.forEach(function(t,e){v[e]={dimension:t,extent:W[e],hasNaN:!1,hasOnlyNaN:!1}}),_=[],t.style("display",function(t){var e=R.every(function(e,n){return!(!isNaN(t.values[e])&&!isNaN(parseFloat(t.values[e]))||W[n][0]!=c[e].brush.y().domain()[0])||W[n][0]<=t.values[e]&&t.values[e]<=W[n][1]&&!isNaN(parseFloat(t.values[e]))});return e&&_.push(t),e?null:"none"}),J(),k.brush({filters:v,active:_})}function q(){var t=R.length>0;v.forEach(function(t){t.extent[0]===c[t.dimension].brush.y().domain()[0]&&b.indexOf(t.dimension)>=0&&(t.hasNaN=!0),t.extent[1]<c[t.dimension].domain()[0]&&(t.hasOnlyNaN=!0)}),k.brushEnd(_,t)}function J(){n.select(".nv-axis").each(function(t,e){var n=v.filter(function(e){return e.dimension==t.key});E[t.key]=c[t.key].domain(),0!=n.length&&p&&(E[t.key]=[],n[0].extent[1]>c[t.key].domain()[0]&&(E[t.key]=[n[0].extent[1]]),n[0].extent[0]>=c[t.key].domain()[0]&&E[t.key].push(n[0].extent[0])),d3.select(this).call(w.scale(c[t.key]).tickFormat(t.format).tickValues(E[t.key]))})}function X(t){var e=y[t];return null==e?u(t):e}_=[],t.style("display",function(t){var e=R.every(function(e,n){return!(!isNaN(t.values[e])&&!isNaN(parseFloat(t.values[e]))||W[n][0]!=c[e].brush.y().domain()[0])||W[n][0]<=t.values[e]&&t.values[e]<=W[n][1]&&!isNaN(parseFloat(t.values[e]))});return e&&_.push(t),e?null:"none"}),(v.length>0||!i.utils.arrayEquals(_,z))&&k.activeChanged(_)}),S}return S.dispatch=k,S.options=i.utils.optionsFunc.bind(S),S._options=Object.create({},{width:{get:function(){return a},set:function(t){a=t}},height:{get:function(){return o},set:function(t){o=t}},dimensionData:{get:function(){return h},set:function(t){h=t}},displayBrush:{get:function(){return p},set:function(t){p=t}},filters:{get:function(){return v},set:function(t){v=t}},active:{get:function(){return _},set:function(t){_=t}},lineTension:{get:function(){return M},set:function(t){M=t}},undefinedValuesLabel:{get:function(){return d},set:function(t){d=t}},dimensions:{get:function(){return h.map(function(t){return t.key})},set:function(t){i.deprecated("dimensions","use dimensionData instead"),0===h.length?t.forEach(function(t){h.push({key:t})}):t.forEach(function(t,e){h[e].key=t})}},dimensionNames:{get:function(){return h.map(function(t){return t.key})},set:function(t){i.deprecated("dimensionNames","use dimensionData instead"),m=[],0===h.length?t.forEach(function(t){h.push({key:t})}):t.forEach(function(t,e){h[e].key=t})}},dimensionFormats:{get:function(){return h.map(function(t){return t.format})},set:function(t){i.deprecated("dimensionFormats","use dimensionData instead"),0===h.length?t.forEach(function(t){h.push({format:t})}):t.forEach(function(t,e){h[e].format=t})}},margin:{get:function(){return r},set:function(t){r.top=void 0!==t.top?t.top:r.top,r.right=void 0!==t.right?t.right:r.right,r.bottom=void 0!==t.bottom?t.bottom:r.bottom,r.left=void 0!==t.left?t.left:r.left}},color:{get:function(){return g},set:function(t){g=i.utils.getColor(t)}}}),i.utils.initOptions(S),S},i.models.parallelCoordinatesChart=function(){"use strict";var t=i.models.parallelCoordinates(),e=i.models.legend(),n=i.models.tooltip(),r=(i.models.tooltip(),{top:0,right:0,bottom:0,left:0}),a=null,o=null,s=null,l=!0,u=i.utils.defaultColor(),c=i.utils.state(),d=[],h=!0,f=null,m=null,p="undefined",g=d3.dispatch("dimensionsOrder","brushEnd","stateChange","changeState","renderEnd"),v=i.utils.renderWatch(g),_=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},y=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function b(n){return v.reset(),v.models(t),n.each(function(n){var u=d3.select(this);i.utils.initSVG(u);var m,p=i.utils.availableWidth(o,u,r),v=i.utils.availableHeight(s,u,r);if(b.update=function(){u.call(b)},b.container=this,c.setter(y(d),b.update).getter(_(d)).update(),c.disabled=d.map(function(t){return!!t.disabled}),(d=d.map(function(t){return t.disabled=!!t.disabled,t})).forEach(function(t,e){t.originalPosition=isNaN(t.originalPosition)?e:t.originalPosition,t.currentPosition=isNaN(t.currentPosition)?e:t.currentPosition}),!f)for(m in f={},c)c[m]instanceof Array?f[m]=c[m].slice(0):f[m]=c[m];if(!n||!n.length)return i.utils.noData(b,u),b;u.selectAll(".nv-noData").remove();var M=u.selectAll("g.nv-wrap.nv-parallelCoordinatesChart").data([n]),x=M.enter().append("g").attr("class","nvd3 nv-wrap nv-parallelCoordinatesChart").append("g"),w=M.select("g");x.append("g").attr("class","nv-parallelCoordinatesWrap"),x.append("g").attr("class","nv-legendWrap"),w.select("rect").attr("width",p).attr("height",v>0?v:0),l?(e.width(p).color(function(t){return"rgb(188,190,192)"}),w.select(".nv-legendWrap").datum(d.sort(function(t,e){return t.originalPosition-e.originalPosition})).call(e),a||e.height()===r.top||(r.top=e.height(),v=i.utils.availableHeight(s,u,r)),M.select(".nv-legendWrap").attr("transform","translate( 0 ,"+-r.top+")")):w.select(".nv-legendWrap").selectAll("*").remove(),M.attr("transform","translate("+r.left+","+r.top+")"),t.width(p).height(v).dimensionData(d).displayBrush(h),w.select(".nv-parallelCoordinatesWrap ").datum(n).transition().call(t),t.dispatch.on("brushEnd",function(t,e){e?(h=!0,g.brushEnd(t)):h=!1}),e.dispatch.on("stateChange",function(t){for(var e in t)c[e]=t[e];g.stateChange(c),b.update()}),t.dispatch.on("dimensionsOrder",function(t){d.sort(function(t,e){return t.currentPosition-e.currentPosition});var e=!1;d.forEach(function(t,n){t.currentPosition=n,t.currentPosition!==t.originalPosition&&(e=!0)}),g.dimensionsOrder(d,e)}),g.on("changeState",function(t){void 0!==t.disabled&&(d.forEach(function(e,n){e.disabled=t.disabled[n]}),c.disabled=t.disabled),b.update()})}),v.renderEnd("parraleleCoordinateChart immediate"),b}return n.contentGenerator(function(t){var e='<table><thead><tr><td class="legend-color-guide"><div style="background-color:'+t.color+'"></div></td><td><strong>'+t.key+"</strong></td></tr></thead>";return 0!==t.series.length&&(e+='<tbody><tr><td height ="10px"></td></tr>',t.series.forEach(function(t){e=e+'<tr><td class="legend-color-guide"><div style="background-color:'+t.color+'"></div></td><td class="key">'+t.key+'</td><td class="value">'+t.value+"</td></tr>"}),e+="</tbody>"),e+="</table>"}),t.dispatch.on("elementMouseover.tooltip",function(t){var e={key:t.label,color:t.color,series:[]};t.values&&(Object.keys(t.values).forEach(function(n){var i,r=t.dimensions.filter(function(t){return t.key===n})[0];r&&(i=isNaN(t.values[n])||isNaN(parseFloat(t.values[n]))?p:r.format(t.values[n]),e.series.push({idx:r.currentPosition,key:n,value:i,color:r.color}))}),e.series.sort(function(t,e){return t.idx-e.idx})),n.data(e).hidden(!1)}),t.dispatch.on("elementMouseout.tooltip",function(t){n.hidden(!0)}),t.dispatch.on("elementMousemove.tooltip",function(){n()}),b.dispatch=g,b.parallelCoordinates=t,b.legend=e,b.tooltip=n,b.options=i.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},showLegend:{get:function(){return l},set:function(t){l=t}},defaultState:{get:function(){return f},set:function(t){f=t}},dimensionData:{get:function(){return d},set:function(t){d=t}},displayBrush:{get:function(){return h},set:function(t){h=t}},noData:{get:function(){return m},set:function(t){m=t}},nanValue:{get:function(){return p},set:function(t){p=t}},margin:{get:function(){return r},set:function(t){void 0!==t.top&&(r.top=t.top,a=t.top),r.right=void 0!==t.right?t.right:r.right,r.bottom=void 0!==t.bottom?t.bottom:r.bottom,r.left=void 0!==t.left?t.left:r.left}},color:{get:function(){return u},set:function(n){u=i.utils.getColor(n),e.color(u),t.color(u)}}}),i.utils.inheritOptions(b,t),i.utils.initOptions(b),b},i.models.pie=function(){"use strict";var t={top:0,right:0,bottom:0,left:0},e=500,n=500,r=function(t){return t.x},a=function(t){return t.y},o=Math.floor(1e4*Math.random()),s=null,l=i.utils.defaultColor(),u=d3.format(",.2f"),c=!0,d=!1,h="key",f=.02,m=!1,p=!1,g=!1,v=!0,_=0,y=!1,b=!1,M=!1,x=!1,w=0,k=.5,L=250,S=[],T=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),Y=[],D=[],C=i.utils.renderWatch(T);function E(A){return C.reset(),A.each(function(E){var A=e-t.left-t.right,O=n-t.top-t.bottom,j=Math.min(A,O)/2,N=[],H=[];if(s=d3.select(this),0===S.length)for(var V=j-j/10,P=k*j,F=0;F<E[0].length;F++)N.push(V),H.push(P);else v?(N=S.map(function(t){return(t.outer-t.outer/10)*j}),H=S.map(function(t){return(t.inner-t.inner/10)*j}),k=d3.min(S.map(function(t){return t.inner-t.inner/10}))):(N=S.map(function(t){return t.outer*j}),H=S.map(function(t){return t.inner*j}),k=d3.min(S.map(function(t){return t.inner})));i.utils.initSVG(s);var I=s.selectAll(".nv-wrap.nv-pie").data(E),R=I.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+o).append("g"),W=I.select("g"),z=R.append("g").attr("class","nv-pie");R.append("g").attr("class","nv-pieLabels"),I.attr("transform","translate("+t.left+","+t.top+")"),W.select(".nv-pie").attr("transform","translate("+A/2+","+O/2+")"),W.select(".nv-pieLabels").attr("transform","translate("+A/2+","+O/2+")"),s.on("click",function(t,e){T.chartClick({data:t,index:e,pos:d3.event,id:o})}),Y=[],D=[];for(F=0;F<E[0].length;F++){var B=d3.svg.arc().outerRadius(N[F]),U=d3.svg.arc().outerRadius(N[F]+5);!1!==b&&(B.startAngle(b),U.startAngle(b)),!1!==x&&(B.endAngle(x),U.endAngle(x)),p&&(B.innerRadius(H[F]),U.innerRadius(H[F])),B.cornerRadius&&w&&(B.cornerRadius(w),U.cornerRadius(w)),Y.push(B),D.push(U)}var G=d3.layout.pie().sort(null).value(function(t){return t.disabled?0:a(t)});G.padAngle&&M&&G.padAngle(M),p&&g&&(z.append("text").attr("class","nv-pie-title"),I.select(".nv-pie-title").style("text-anchor","middle").text(function(t){return g}).style("font-size",Math.min(A,O)*k*2/(g.length+2)+"px").attr("dy","0.35em").attr("transform",function(t,e){return"translate(0, "+_+")"}));var $=I.select(".nv-pie").selectAll(".nv-slice").data(G),q=I.select(".nv-pieLabels").selectAll(".nv-label").data(G);$.exit().remove(),q.exit().remove();var J=$.enter().append("g");J.attr("class","nv-slice"),J.on("mouseover",function(t,e){d3.select(this).classed("hover",!0),v&&d3.select(this).select("path").transition().duration(70).attr("d",D[e]),T.elementMouseover({data:t.data,index:e,color:d3.select(this).style("fill"),percent:(t.endAngle-t.startAngle)/(2*Math.PI)})}),J.on("mouseout",function(t,e){d3.select(this).classed("hover",!1),v&&d3.select(this).select("path").transition().duration(50).attr("d",Y[e]),T.elementMouseout({data:t.data,index:e})}),J.on("mousemove",function(t,e){T.elementMousemove({data:t.data,index:e})}),J.on("click",function(t,e){T.elementClick({data:t.data,index:e,color:d3.select(this).style("fill"),event:d3.event,element:this})}),J.on("dblclick",function(t,e){T.elementDblClick({data:t.data,index:e,color:d3.select(this).style("fill")})}),$.attr("fill",function(t,e){return l(t.data,e)}),$.attr("stroke",function(t,e){return l(t.data,e)});J.append("path").each(function(t){this._current=t});if($.select("path").transition().duration(L).attr("d",function(t,e){return Y[e](t)}).attrTween("d",function(t,e){t.endAngle=isNaN(t.endAngle)?0:t.endAngle,t.startAngle=isNaN(t.startAngle)?0:t.startAngle,p||(t.innerRadius=0);var n=d3.interpolate(this._current,t);return this._current=n(0),function(t){return Y[e](n(t))}}),c){var X=[];for(F=0;F<E[0].length;F++)X.push(Y[F]),d?p&&(X[F]=d3.svg.arc().outerRadius(Y[F].outerRadius()),!1!==b&&X[F].startAngle(b),!1!==x&&X[F].endAngle(x)):p||X[F].innerRadius(0);q.enter().append("g").classed("nv-label",!0).each(function(t,e){var n=d3.select(this);n.attr("transform",function(t,e){if(y){t.outerRadius=N[e]+10,t.innerRadius=N[e]+15;var n=(t.startAngle+t.endAngle)/2*(180/Math.PI);return(t.startAngle+t.endAngle)/2<Math.PI?n-=90:n+=90,"translate("+X[e].centroid(t)+") rotate("+n+")"}return t.outerRadius=j+10,t.innerRadius=j+15,"translate("+X[e].centroid(t)+")"}),n.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),n.append("text").style("text-anchor",y?(t.startAngle+t.endAngle)/2<Math.PI?"start":"end":"middle").style("fill","#000")});var Z={},K=function(t){return 140*Math.floor(t[0]/140)+","+14*Math.floor(t[1]/14)},Q=function(t){return(t.endAngle-t.startAngle)/(2*Math.PI)};q.watchTransition(C,"pie labels").attr("transform",function(t,e){if(y){t.outerRadius=N[e]+10,t.innerRadius=N[e]+15;var n=(t.startAngle+t.endAngle)/2*(180/Math.PI);return(t.startAngle+t.endAngle)/2<Math.PI?n-=90:n+=90,"translate("+X[e].centroid(t)+") rotate("+n+")"}t.outerRadius=j+10,t.innerRadius=j+15;var i=X[e].centroid(t),r=Q(t);if(t.value&&r>=f){var a=K(i);Z[a]&&(i[1]-=14),Z[K(i)]=!0}return"translate("+i+")"}),q.select(".nv-label text").style("text-anchor",function(t,e){return y?(t.startAngle+t.endAngle)/2<Math.PI?"start":"end":"middle"}).text(function(t,e){var n=Q(t),i="";if(!t.value||n<f)return"";if("function"==typeof h)i=h(t,e,{key:r(t.data),value:a(t.data),percent:u(n)});else switch(h){case"key":i=r(t.data);break;case"value":i=u(a(t.data));break;case"percent":i=d3.format("%")(n)}return i}),m&&q.each(function(t,e){if(this.getBBox){var n=this.getBBox(),r=X[e].centroid(t),a={x:r[0]+n.x,y:r[1]+n.y},o={x:a.x+n.width,y:a.y},s={x:a.x,y:a.y+n.height},l={x:a.x+n.width,y:a.y+n.height};t.visible=i.utils.pointIsInArc(a,t,B)&&i.utils.pointIsInArc(o,t,B)&&i.utils.pointIsInArc(s,t,B)&&i.utils.pointIsInArc(l,t,B)}}).style("display",function(t){return t.visible?null:"none"})}}),C.renderEnd("pie immediate"),E}return E.dispatch=T,E.options=i.utils.optionsFunc.bind(E),E._options=Object.create({},{arcsRadius:{get:function(){return S},set:function(t){S=t}},width:{get:function(){return e},set:function(t){e=t}},height:{get:function(){return n},set:function(t){n=t}},showLabels:{get:function(){return c},set:function(t){c=t}},title:{get:function(){return g},set:function(t){g=t}},titleOffset:{get:function(){return _},set:function(t){_=t}},labelThreshold:{get:function(){return f},set:function(t){f=t}},hideOverlapLabels:{get:function(){return m},set:function(t){m=t}},valueFormat:{get:function(){return u},set:function(t){u=t}},x:{get:function(){return r},set:function(t){r=t}},id:{get:function(){return o},set:function(t){o=t}},endAngle:{get:function(){return x},set:function(t){x=t}},startAngle:{get:function(){return b},set:function(t){b=t}},padAngle:{get:function(){return M},set:function(t){M=t}},cornerRadius:{get:function(){return w},set:function(t){w=t}},donutRatio:{get:function(){return k},set:function(t){k=t}},labelsOutside:{get:function(){return d},set:function(t){d=t}},labelSunbeamLayout:{get:function(){return y},set:function(t){y=t}},donut:{get:function(){return p},set:function(t){p=t}},growOnHover:{get:function(){return v},set:function(t){v=t}},pieLabelsOutside:{get:function(){return d},set:function(t){d=t,i.deprecated("pieLabelsOutside","use labelsOutside instead")}},donutLabelsOutside:{get:function(){return d},set:function(t){d=t,i.deprecated("donutLabelsOutside","use labelsOutside instead")}},labelFormat:{get:function(){return u},set:function(t){u=t,i.deprecated("labelFormat","use valueFormat instead")}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},duration:{get:function(){return L},set:function(t){L=t,C.reset(L)}},y:{get:function(){return a},set:function(t){a=d3.functor(t)}},color:{get:function(){return l},set:function(t){l=i.utils.getColor(t)}},labelType:{get:function(){return h},set:function(t){h=t||"key"}}}),i.utils.initOptions(E),E},i.models.pieChart=function(){"use strict";var t=i.models.pie(),e=i.models.legend(),n=i.models.tooltip(),r={top:30,right:20,bottom:20,left:20},a=null,o=null,s=null,l=!1,u=!0,c="top",d=i.utils.defaultColor(),h=i.utils.state(),f=null,m=null,p=250,g=d3.dispatch("stateChange","changeState","renderEnd");n.duration(0).headerEnabled(!1).valueFormatter(function(e,n){return t.valueFormat()(e,n)});var v=i.utils.renderWatch(g),_=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},y=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function b(n){return v.reset(),v.models(t),n.each(function(n){var l=d3.select(this);i.utils.initSVG(l);var d,m=i.utils.availableWidth(o,l,r),p=i.utils.availableHeight(s,l,r);if(b.update=function(){l.transition().call(b)},b.container=this,h.setter(y(n),b.update).getter(_(n)).update(),h.disabled=n.map(function(t){return!!t.disabled}),!f)for(d in f={},h)h[d]instanceof Array?f[d]=h[d].slice(0):f[d]=h[d];if(!n||!n.length)return i.utils.noData(b,l),b;l.selectAll(".nv-noData").remove();var v=l.selectAll("g.nv-wrap.nv-pieChart").data([n]),M=v.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),x=v.select("g");if(M.append("g").attr("class","nv-pieWrap"),M.append("g").attr("class","nv-legendWrap"),u)if("top"===c)e.width(m).key(t.x()),v.select(".nv-legendWrap").datum(n).call(e),a||e.height()===r.top||(r.top=e.height(),p=i.utils.availableHeight(s,l,r)),v.select(".nv-legendWrap").attr("transform","translate(0,"+-r.top+")");else if("right"===c){var w=i.models.legend().width();m/2<w&&(w=m/2),e.height(p).key(t.x()),e.width(w),m-=e.width(),v.select(".nv-legendWrap").datum(n).call(e).attr("transform","translate("+m+",0)")}else"bottom"===c&&(e.width(m).key(t.x()),v.select(".nv-legendWrap").datum(n).call(e),r.bottom=e.height(),p=i.utils.availableHeight(s,l,r),v.select(".nv-legendWrap").attr("transform","translate(0,"+p+")"));else x.select(".nv-legendWrap").selectAll("*").remove();v.attr("transform","translate("+r.left+","+r.top+")"),t.width(m).height(p);var k=x.select(".nv-pieWrap").datum([n]);d3.transition(k).call(t),e.dispatch.on("stateChange",function(t){for(var e in t)h[e]=t[e];g.stateChange(h),b.update()}),g.on("changeState",function(t){void 0!==t.disabled&&(n.forEach(function(e,n){e.disabled=t.disabled[n]}),h.disabled=t.disabled),b.update()})}),v.renderEnd("pieChart immediate"),b}return t.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:b.x()(t.data),value:b.y()(t.data),color:t.color,percent:t.percent},l||(delete t.percent,delete t.series.percent),n.data(t).hidden(!1)}),t.dispatch.on("elementMouseout.tooltip",function(t){n.hidden(!0)}),t.dispatch.on("elementMousemove.tooltip",function(t){n()}),b.legend=e,b.dispatch=g,b.pie=t,b.tooltip=n,b.options=i.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},noData:{get:function(){return m},set:function(t){m=t}},showTooltipPercent:{get:function(){return l},set:function(t){l=t}},showLegend:{get:function(){return u},set:function(t){u=t}},legendPosition:{get:function(){return c},set:function(t){c=t}},defaultState:{get:function(){return f},set:function(t){f=t}},color:{get:function(){return d},set:function(n){d=n,e.color(d),t.color(d)}},duration:{get:function(){return p},set:function(e){p=e,v.reset(p),t.duration(p)}},margin:{get:function(){return r},set:function(t){void 0!==t.top&&(r.top=t.top,a=t.top),r.right=void 0!==t.right?t.right:r.right,r.bottom=void 0!==t.bottom?t.bottom:r.bottom,r.left=void 0!==t.left?t.left:r.left}}}),i.utils.inheritOptions(b,t),i.utils.initOptions(b),b},i.models.sankey=function(){"use strict";var t={},e=24,n=8,r=[1,1],a=[],o=[],s=!0,l=function(t){a.forEach(function(t){t.sourceLinks=[],t.targetLinks=[]}),o.forEach(function(t){var e=t.source,n=t.target;"number"==typeof e&&(e=t.source=a[t.source]),"number"==typeof n&&(n=t.target=a[t.target]),e.sourceLinks.push(t),n.targetLinks.push(t)}),a.forEach(function(t){t.value=Math.max(d3.sum(t.sourceLinks,h),d3.sum(t.targetLinks,h))}),function(){var t,n=a,i=0;for(;n.length&&i<a.length;)t=[],n.forEach(function(n){n.x=i,n.dx=e,n.sourceLinks.forEach(function(e){t.indexOf(e.target)<0&&t.push(e.target)})}),n=t,++i;s&&function(t){a.forEach(function(e){e.sourceLinks.length||(e.x=t-1)})}(i);!function(t){a.forEach(function(e){e.x*=t})}((r[0]-e)/(i-1))}(),function(t){var e=d3.nest().key(function(t){return t.x}).sortKeys(d3.ascending).entries(a).map(function(t){return t.values});(function(){var t=d3.min(e,function(t){return(r[1]-(t.length-1)*n)/d3.sum(t,h)});e.forEach(function(e){e.forEach(function(e,n){e.y=n,e.dy=e.value*t})}),o.forEach(function(e){e.dy=e.value*t})})(),u(),d();for(var i=1;t>0;--t)l(i*=.99),u(),d(),s(i),u(),d();function s(t){function n(t){return(t.source.y+t.sy+t.dy/2)*t.value}e.forEach(function(e,i){e.forEach(function(e){if(e.targetLinks.length){var i=d3.sum(e.targetLinks,n)/d3.sum(e.targetLinks,h);e.y+=(i-c(e))*t}})})}function l(t){function n(t){return(t.target.y+t.ty+t.dy/2)*t.value}e.slice().reverse().forEach(function(e){e.forEach(function(e){if(e.sourceLinks.length){var i=d3.sum(e.sourceLinks,n)/d3.sum(e.sourceLinks,h);e.y+=(i-c(e))*t}})})}function u(){e.forEach(function(t){var e,i,a,o=0,s=t.length;for(t.sort(f),a=0;a<s;++a)e=t[a],(i=o-e.y)>0&&(e.y+=i),o=e.y+e.dy+n;if((i=o-n-r[1])>0)for(o=e.y-=i,a=s-2;a>=0;--a)e=t[a],(i=e.y+e.dy+n-o)>0&&(e.y-=i),o=e.y})}function f(t,e){return t.y-e.y}}(t)},u=function(){var t=.5;function e(e){var n=e.source.x+e.source.dx,i=e.target.x,r=d3.interpolateNumber(n,i),a=r(t),o=r(1-t),s=e.source.y+e.sy+e.dy/2,l=e.target.y+e.ty+e.dy/2;return"M"+n+","+s+"C"+a+","+s+" "+o+","+l+" "+i+","+l}return e.curvature=function(n){return arguments.length?(t=+n,e):t},e},c=function(t){return t.y+t.dy/2};function d(){function t(t,e){return t.source.y-e.source.y}function e(t,e){return t.target.y-e.target.y}a.forEach(function(n){n.sourceLinks.sort(e),n.targetLinks.sort(t)}),a.forEach(function(t){var e=0,n=0;t.sourceLinks.forEach(function(t){t.sy=e,e+=t.dy}),t.targetLinks.forEach(function(t){t.ty=n,n+=t.dy})})}function h(t){return t.value}return t.options=i.utils.optionsFunc.bind(t),t._options=Object.create({},{nodeWidth:{get:function(){return e},set:function(t){e=+t}},nodePadding:{get:function(){return n},set:function(t){n=t}},nodes:{get:function(){return a},set:function(t){a=t}},links:{get:function(){return o},set:function(t){o=t}},size:{get:function(){return r},set:function(t){r=t}},sinksRight:{get:function(){return s},set:function(t){s=t}},layout:{get:function(){l(32)},set:function(t){l(t)}},relayout:{get:function(){d()},set:function(t){}},center:{get:function(){return c()},set:function(t){"function"==typeof t&&(c=t)}},link:{get:function(){return u()},set:function(t){return"function"==typeof t&&(u=t),u()}}}),i.utils.initOptions(t),t},i.models.sankeyChart=function(){"use strict";var t={top:5,right:0,bottom:5,left:0},e=i.models.sankey(),n=600,r=400,a=36,o=40,s="units",l=void 0,u=d3.format(",.0f"),c=function(t){return u(t)+" "+s},d=d3.scale.category20(),h=function(t){return t.source.name+" → "+t.target.name+"\n"+c(t.value)},f=function(t){return t.color=d(t.name.replace(/ .*/,""))},m=function(t){return d3.rgb(t.color).darker(2)},p=function(t){return t.name+"\n"+c(t.value)},g=function(t,e){t.append("text").attr("x",0).attr("y",0).attr("class","nvd3-sankey-chart-error").attr("text-anchor","middle").text(e)};function v(t){return t.each(function(i){var s={nodes:[{node:1,name:"Test 1"},{node:2,name:"Test 2"},{node:3,name:"Test 3"},{node:4,name:"Test 4"},{node:5,name:"Test 5"},{node:6,name:"Test 6"}],links:[{source:0,target:1,value:2295},{source:0,target:5,value:1199},{source:1,target:2,value:1119},{source:1,target:5,value:1176},{source:2,target:3,value:487},{source:2,target:5,value:632},{source:3,target:4,value:301},{source:3,target:5,value:186}]},u=!1,c=!1;if(("object"==typeof i.nodes&&i.nodes.length)>=0&&("object"==typeof i.links&&i.links.length)>=0&&(u=!0),i.nodes&&i.nodes.length>0&&i.links&&i.links.length>0&&(c=!0),!u)return console.error("NVD3 Sankey chart error:","invalid data format for",i),console.info("Valid data format is: ",s,JSON.stringify(s)),g(t,"Error loading chart, data is invalid"),!1;if(!c)return g(t,"No data available"),!1;var d=t.append("svg").attr("width",n).attr("height",r).append("g").attr("class","nvd3 nv-wrap nv-sankeyChart");e.nodeWidth(a).nodePadding(o).size([n,r]);var v=e.link();e.nodes(i.nodes).links(i.links).layout(32).center(l);var _=d.append("g").selectAll(".link").data(i.links).enter().append("path").attr("class","link").attr("d",v).style("stroke-width",function(t){return Math.max(1,t.dy)}).sort(function(t,e){return e.dy-t.dy});_.append("title").text(h);var y=d.append("g").selectAll(".node").data(i.nodes).enter().append("g").attr("class","node").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).call(d3.behavior.drag().origin(function(t){return t}).on("dragstart",function(){this.parentNode.appendChild(this)}).on("drag",function(t){d3.select(this).attr("transform","translate("+t.x+","+(t.y=Math.max(0,Math.min(r-t.dy,d3.event.y)))+")"),e.relayout(),_.attr("d",v)}));y.append("rect").attr("height",function(t){return t.dy}).attr("width",e.nodeWidth()).style("fill",f).style("stroke",m).append("title").text(p),y.append("text").attr("x",-6).attr("y",function(t){return t.dy/2}).attr("dy",".35em").attr("text-anchor","end").attr("transform",null).text(function(t){return t.name}).filter(function(t){return t.x<n/2}).attr("x",6+e.nodeWidth()).attr("text-anchor","start")}),v}return v.options=i.utils.optionsFunc.bind(v),v._options=Object.create({},{units:{get:function(){return s},set:function(t){s=t}},width:{get:function(){return n},set:function(t){n=t}},height:{get:function(){return r},set:function(t){r=t}},format:{get:function(){return c},set:function(t){c=t}},linkTitle:{get:function(){return h},set:function(t){h=t}},nodeWidth:{get:function(){return a},set:function(t){a=t}},nodePadding:{get:function(){return o},set:function(t){o=t}},center:{get:function(){return l},set:function(t){l=t}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},nodeStyle:{get:function(){return{}},set:function(t){f=void 0!==t.fillColor?t.fillColor:f,m=void 0!==t.strokeColor?t.strokeColor:m,p=void 0!==t.title?t.title:p}}}),i.utils.initOptions(v),v},i.models.scatter=function(){"use strict";var t,e,n,r,a,o,s,l,u={top:0,right:0,bottom:0,left:0},c=null,d=null,h=i.utils.defaultColor(),f=null,m=Math.floor(1e5*Math.random()),p=null,g=d3.scale.linear(),v=d3.scale.linear(),_=d3.scale.linear(),y=function(t){return t.x},b=function(t){return t.y},M=function(t){return t.size||1},x=function(t){return t.shape||"circle"},w=[],k=[],L=[],S=!0,T=function(t){return!t.notActive},Y=!1,D=.1,C=!1,E=!0,A=!1,O=function(){return 25},j=null,N=null,H=null,V=null,P=null,F=null,I=!1,R=d3.dispatch("elementClick","elementDblClick","elementMouseover","elementMouseout","renderEnd"),W=!0,z=250,B=300,U=!1,G=!1,$=i.utils.renderWatch(R,z),q=[16,256],J={};function X(t){var e;e=t[0].series+":"+t[1],delete J[e]}function Z(t){var e,n,i,r=function(t){var e;return e=t[0].series+":"+t[1],J[e]=J[e]||{}}(t),a=!1;for(e=1;e<arguments.length;e+=2)n=arguments[e],i=arguments[e+1](t[0],t[1]),r[n]===i&&r.hasOwnProperty(n)||(r[n]=i,a=!0);return a}function K(z){return $.reset(),z.each(function(z){p=d3.select(this);var J=i.utils.availableWidth(c,p,u),Q=i.utils.availableHeight(d,p,u);i.utils.initSVG(p),z.forEach(function(t,e){t.values.forEach(function(t){t.series=e})});var tt="function"==typeof K.yScale().base,et=j&&N&&P?[]:d3.merge(z.map(function(t){return t.values.map(function(t,e){return{x:y(t,e),y:b(t,e),size:M(t,e)}})}));if(g.domain(j||d3.extent(et.map(function(t){return t.x}).concat(w))),Y&&z[0]?g.range(H||[(J*D+J)/(2*z[0].values.length),J-J*(1+D)/(2*z[0].values.length)]):g.range(H||[0,J]),tt){var nt=d3.min(et.map(function(t){if(0!==t.y)return t.y}));v.clamp(!0).domain(N||d3.extent(et.map(function(t){return 0!==t.y?t.y:.1*nt}).concat(k))).range(V||[Q,0])}else v.domain(N||d3.extent(et.map(function(t){return t.y}).concat(k))).range(V||[Q,0]);_.domain(P||d3.extent(et.map(function(t){return t.size}).concat(L))).range(F||q),I=g.domain()[0]===g.domain()[1]||v.domain()[0]===v.domain()[1],g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]-.01*g.domain()[0],g.domain()[1]+.01*g.domain()[1]]):g.domain([-1,1])),v.domain()[0]===v.domain()[1]&&(v.domain()[0]?v.domain([v.domain()[0]-.01*v.domain()[0],v.domain()[1]+.01*v.domain()[1]]):v.domain([-1,1])),isNaN(g.domain()[0])&&g.domain([-1,1]),isNaN(v.domain()[0])&&v.domain([-1,1]),t=t||g,e=e||v,n=n||_;var it=g(1)!==t(1)||v(1)!==e(1)||_(1)!==n(1);o=o||c,s=s||d;var rt=o!==c||s!==d,at=(r=r||[])[0]!==g.domain()[0]||r[1]!==g.domain()[1];r=g.domain(),a=a||[],at=at||a[0]!==v.domain()[0]||a[1]!==v.domain()[1],a=v.domain();var ot=p.selectAll("g.nv-wrap.nv-scatter").data([z]),st=ot.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+m),lt=st.append("defs"),ut=st.append("g"),ct=ot.select("g");function dt(){if(G=!1,!S)return!1;if(p.selectAll(".nv-point.hover").classed("hover",!1),ot.select(".nv-point-paths").selectAll("path").remove(),!0===W){var t=d3.merge(z.map(function(t,e){return t.values.map(function(t,n){var r=y(t,n),a=b(t,n);return[i.utils.NaNtoZero(g(r))+1e-4*Math.random(),i.utils.NaNtoZero(v(a))+1e-4*Math.random(),e,n,t]}).filter(function(t,e){return T(t[4],e)})}));if(0==t.length)return!1;t.length<3&&(t.push([g.range()[0]-20,v.range()[0]-20,null,null]),t.push([g.range()[1]+20,v.range()[1]+20,null,null]),t.push([g.range()[0]-20,v.range()[0]+20,null,null]),t.push([g.range()[1]+20,v.range()[1]-20,null,null]));var e=d3.geom.polygon([[-10,-10],[-10,d+10],[c+10,d+10],[c+10,-10]]);t=t.sort(function(t,e){return t[0]-e[0]||t[1]-e[1]});for(var n=0;n<t.length-1;)Math.abs(t[n][0]-t[n+1][0])<1e-4&&Math.abs(t[n][1]-t[n+1][1])<1e-4?t.splice(n+1,1):n++;var r=d3.geom.voronoi(t).map(function(n,i){return 0===n.length?null:{data:e.clip(n),series:t[i][2],point:t[i][3]}}),a=ot.select(".nv-point-paths").selectAll("path").data(r),o=a.enter().append("svg:path").attr("d",function(t){return t&&t.data&&0!==t.data.length?"M"+t.data.join(",")+"Z":"M 0 0"}).attr("id",function(t,e){return"nv-path-"+e}).attr("clip-path",function(t,e){return"url(#nv-clip-"+m+"-"+e+")"});if(A&&o.style("fill",d3.rgb(230,230,230)).style("fill-opacity",.4).style("stroke-opacity",1).style("stroke",d3.rgb(200,200,200)),E){ot.select(".nv-point-clips").selectAll("*").remove();ot.select(".nv-point-clips").selectAll("clipPath").data(t).enter().append("svg:clipPath").attr("id",function(t,e){return"nv-clip-"+m+"-"+e}).append("svg:circle").attr("cx",function(t){return t[0]}).attr("cy",function(t){return t[1]}).attr("r",O)}var s=function(t,e,n){if(G)return 0;var i=z[e.series];if(void 0!==i){var r=i.values[e.point];r.color=h(i,e.series),r.x=y(r),r.y=b(r);var a=p.node().getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,s=window.pageXOffset||document.documentElement.scrollLeft;n({point:r,series:i,pos:{left:g(y(r,e.point))+a.left+s+u.left+10,top:v(b(r,e.point))+a.top+o+u.top+10},relativePos:[g(y(r,e.point))+u.left,v(b(r,e.point))+u.top],seriesIndex:e.series,pointIndex:e.point,event:d3.event,element:t})}};a.on("click",function(t){s(this,t,R.elementClick)}).on("dblclick",function(t){s(this,t,R.elementDblClick)}).on("mouseover",function(t){s(this,t,R.elementMouseover)}).on("mouseout",function(t,e){s(this,t,R.elementMouseout)})}else ot.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(t,e){if(G||!z[t[0].series])return 0;var n=z[t[0].series],i=n.values[e];R.elementClick({point:i,series:n,pos:[g(y(i,e))+u.left,v(b(i,e))+u.top],relativePos:[g(y(i,e))+u.left,v(b(i,e))+u.top],seriesIndex:t[0].series,pointIndex:e,event:d3.event,element:this})}).on("dblclick",function(t,e){if(G||!z[t[0].series])return 0;var n=z[t[0].series],i=n.values[e];R.elementDblClick({point:i,series:n,pos:[g(y(i,e))+u.left,v(b(i,e))+u.top],relativePos:[g(y(i,e))+u.left,v(b(i,e))+u.top],seriesIndex:t[0].series,pointIndex:e})}).on("mouseover",function(t,e){if(G||!z[t[0].series])return 0;var n=z[t[0].series],i=n.values[e];R.elementMouseover({point:i,series:n,pos:[g(y(i,e))+u.left,v(b(i,e))+u.top],relativePos:[g(y(i,e))+u.left,v(b(i,e))+u.top],seriesIndex:t[0].series,pointIndex:e,color:h(t[0],e)})}).on("mouseout",function(t,e){if(G||!z[t[0].series])return 0;var n=z[t[0].series],i=n.values[e];R.elementMouseout({point:i,series:n,pos:[g(y(i,e))+u.left,v(b(i,e))+u.top],relativePos:[g(y(i,e))+u.left,v(b(i,e))+u.top],seriesIndex:t[0].series,pointIndex:e,color:h(t[0],e)})})}ot.classed("nv-single-point",I),ut.append("g").attr("class","nv-groups"),ut.append("g").attr("class","nv-point-paths"),st.append("g").attr("class","nv-point-clips"),ot.attr("transform","translate("+u.left+","+u.top+")"),lt.append("clipPath").attr("id","nv-edge-clip-"+m).append("rect").attr("transform","translate( -10, -10)"),ot.select("#nv-edge-clip-"+m+" rect").attr("width",J+20).attr("height",Q>0?Q+20:0),ct.attr("clip-path",C?"url(#nv-edge-clip-"+m+")":""),G=!0;var ht=ot.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t){return t.key});ht.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),ht.exit().remove(),ht.attr("class",function(t,e){return(t.classed||"")+" nv-group nv-series-"+e}).classed("nv-noninteractive",!S).classed("hover",function(t){return t.hover}),ht.watchTransition($,"scatter: groups").style("fill",function(t,e){return h(t,e)}).style("stroke",function(t,e){return t.pointBorderColor||f||h(t,e)}).style("stroke-opacity",1).style("fill-opacity",.5);var ft=ht.selectAll("path.nv-point").data(function(t){return t.values.map(function(t,e){return[t,e]}).filter(function(t,e){return T(t[0],e)})});if(ft.enter().append("path").attr("class",function(t){return"nv-point nv-point-"+t[1]}).style("fill",function(t){return t.color}).style("stroke",function(t){return t.color}).attr("transform",function(n){return"translate("+i.utils.NaNtoZero(t(y(n[0],n[1])))+","+i.utils.NaNtoZero(e(b(n[0],n[1])))+")"}).attr("d",i.utils.symbol().type(function(t){return x(t[0])}).size(function(t){return _(M(t[0],t[1]))})),ft.exit().each(X).remove(),ht.exit().selectAll("path.nv-point").watchTransition($,"scatter exit").attr("transform",function(t){return"translate("+i.utils.NaNtoZero(g(y(t[0],t[1])))+","+i.utils.NaNtoZero(v(b(t[0],t[1])))+")"}).remove(),ft.filter(function(t){return Z(t,"x",y,"y",b)||it||rt||at}).watchTransition($,"scatter points").attr("transform",function(t){return"translate("+i.utils.NaNtoZero(g(y(t[0],t[1])))+","+i.utils.NaNtoZero(v(b(t[0],t[1])))+")"}),ft.filter(function(t){return Z(t,"shape",x,"size",M)||it||rt||at}).watchTransition($,"scatter points").attr("d",i.utils.symbol().type(function(t){return x(t[0])}).size(function(t){return _(M(t[0],t[1]))})),U){var mt=ht.selectAll(".nv-label").data(function(t){return t.values.map(function(t,e){return[t,e]}).filter(function(t,e){return T(t[0],e)})});mt.enter().append("text").style("fill",function(t,e){return t.color}).style("stroke-opacity",0).style("fill-opacity",1).attr("transform",function(n){return"translate("+(i.utils.NaNtoZero(t(y(n[0],n[1])))+Math.sqrt(_(M(n[0],n[1]))/Math.PI)+2)+","+i.utils.NaNtoZero(e(b(n[0],n[1])))+")"}).text(function(t,e){return t[0].label}),mt.exit().remove(),ht.exit().selectAll("path.nv-label").watchTransition($,"scatter exit").attr("transform",function(t){return"translate("+(i.utils.NaNtoZero(g(y(t[0],t[1])))+Math.sqrt(_(M(t[0],t[1]))/Math.PI)+2)+","+i.utils.NaNtoZero(v(b(t[0],t[1])))+")"}).remove(),mt.each(function(t){d3.select(this).classed("nv-label",!0).classed("nv-label-"+t[1],!1).classed("hover",!1)}),mt.watchTransition($,"scatter labels").text(function(t,e){return t[0].label}).attr("transform",function(t){return"translate("+(i.utils.NaNtoZero(g(y(t[0],t[1])))+Math.sqrt(_(M(t[0],t[1]))/Math.PI)+2)+","+i.utils.NaNtoZero(v(b(t[0],t[1])))+")"})}B?(clearTimeout(l),l=setTimeout(dt,B)):dt(),t=g.copy(),e=v.copy(),n=_.copy(),o=c,s=d}),$.renderEnd("scatter immediate"),K}return K.dispatch=R,K.options=i.utils.optionsFunc.bind(K),K._calls=new function(){this.clearHighlights=function(){return i.dom.write(function(){p.selectAll(".nv-point.hover").classed("hover",!1)}),null},this.highlightPoint=function(t,e,n){i.dom.write(function(){p.select(".nv-groups").selectAll(".nv-series-"+t).selectAll(".nv-point-"+e).classed("hover",n)})}},R.on("elementMouseover.point",function(t){S&&K._calls.highlightPoint(t.seriesIndex,t.pointIndex,!0)}),R.on("elementMouseout.point",function(t){S&&K._calls.highlightPoint(t.seriesIndex,t.pointIndex,!1)}),K._options=Object.create({},{width:{get:function(){return c},set:function(t){c=t}},height:{get:function(){return d},set:function(t){d=t}},xScale:{get:function(){return g},set:function(t){g=t}},yScale:{get:function(){return v},set:function(t){v=t}},pointScale:{get:function(){return _},set:function(t){_=t}},xDomain:{get:function(){return j},set:function(t){j=t}},yDomain:{get:function(){return N},set:function(t){N=t}},pointDomain:{get:function(){return P},set:function(t){P=t}},xRange:{get:function(){return H},set:function(t){H=t}},yRange:{get:function(){return V},set:function(t){V=t}},pointRange:{get:function(){return F},set:function(t){F=t}},forceX:{get:function(){return w},set:function(t){w=t}},forceY:{get:function(){return k},set:function(t){k=t}},forcePoint:{get:function(){return L},set:function(t){L=t}},interactive:{get:function(){return S},set:function(t){S=t}},pointActive:{get:function(){return T},set:function(t){T=t}},padDataOuter:{get:function(){return D},set:function(t){D=t}},padData:{get:function(){return Y},set:function(t){Y=t}},clipEdge:{get:function(){return C},set:function(t){C=t}},clipVoronoi:{get:function(){return E},set:function(t){E=t}},clipRadius:{get:function(){return O},set:function(t){O=t}},showVoronoi:{get:function(){return A},set:function(t){A=t}},id:{get:function(){return m},set:function(t){m=t}},interactiveUpdateDelay:{get:function(){return B},set:function(t){B=t}},showLabels:{get:function(){return U},set:function(t){U=t}},pointBorderColor:{get:function(){return f},set:function(t){f=t}},x:{get:function(){return y},set:function(t){y=d3.functor(t)}},y:{get:function(){return b},set:function(t){b=d3.functor(t)}},pointSize:{get:function(){return M},set:function(t){M=d3.functor(t)}},pointShape:{get:function(){return x},set:function(t){x=d3.functor(t)}},margin:{get:function(){return u},set:function(t){u.top=void 0!==t.top?t.top:u.top,u.right=void 0!==t.right?t.right:u.right,u.bottom=void 0!==t.bottom?t.bottom:u.bottom,u.left=void 0!==t.left?t.left:u.left}},duration:{get:function(){return z},set:function(t){z=t,$.reset(z)}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t)}},useVoronoi:{get:function(){return W},set:function(t){!1===(W=t)&&(E=!1)}}}),i.utils.initOptions(K),K},i.models.scatterChart=function(){"use strict";var t=i.models.scatter(),e=i.models.axis(),n=i.models.axis(),r=i.models.legend(),a=i.models.distribution(),o=i.models.distribution(),s=i.models.tooltip(),l={top:30,right:20,bottom:50,left:75},u=null,c=null,d=null,h=null,f=i.utils.defaultColor(),m=t.xScale(),p=t.yScale(),g=!1,v=!1,_=!0,y=!0,b=!0,M=!1,x=i.utils.state(),w=null,k=d3.dispatch("stateChange","changeState","renderEnd"),L=null,S=250,T=!1;t.xScale(m).yScale(p),e.orient("bottom").tickPadding(10),n.orient(M?"right":"left").tickPadding(10),a.axis("x"),o.axis("y"),s.headerFormatter(function(t,n){return e.tickFormat()(t,n)}).valueFormatter(function(t,e){return n.tickFormat()(t,e)});var Y=i.utils.renderWatch(k,S),D=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},C=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function E(L){return Y.reset(),Y.models(t),y&&Y.models(e),b&&Y.models(n),g&&Y.models(a),v&&Y.models(o),L.each(function(L){h=d3.select(this),i.utils.initSVG(h);var A,O=i.utils.availableWidth(c,h,l),j=i.utils.availableHeight(d,h,l);if(E.update=function(){0===S?h.call(E):h.transition().duration(S).call(E)},E.container=this,x.setter(C(L),E.update).getter(D(L)).update(),x.disabled=L.map(function(t){return!!t.disabled}),!w)for(A in w={},x)x[A]instanceof Array?w[A]=x[A].slice(0):w[A]=x[A];if(!(L&&L.length&&L.filter(function(t){return t.values.length}).length))return i.utils.noData(E,h),Y.renderEnd("scatter immediate"),E;h.selectAll(".nv-noData").remove(),m=t.xScale(),p=t.yScale();var N=h.selectAll("g.nv-wrap.nv-scatterChart").data([L]),H=N.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()).append("g"),V=N.select("g");if(H.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none"),H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-scatterWrap"),H.append("g").attr("class","nv-regressionLinesWrap"),H.append("g").attr("class","nv-distWrap"),H.append("g").attr("class","nv-legendWrap"),M&&V.select(".nv-y.nv-axis").attr("transform","translate("+O+",0)"),_){var P=O;r.width(P),N.select(".nv-legendWrap").datum(L).call(r),u||r.height()===l.top||(l.top=r.height(),j=i.utils.availableHeight(d,h,l)),N.select(".nv-legendWrap").attr("transform","translate(0,"+-l.top+")")}else V.select(".nv-legendWrap").selectAll("*").remove();N.attr("transform","translate("+l.left+","+l.top+")"),t.width(O).height(j).color(L.map(function(t,e){return t.color=t.color||f(t,e),t.color}).filter(function(t,e){return!L[e].disabled})).showLabels(T),N.select(".nv-scatterWrap").datum(L.filter(function(t){return!t.disabled})).call(t),N.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var F=N.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(t){return t});F.enter().append("g").attr("class","nv-regLines");var I=F.selectAll(".nv-regLine").data(function(t){return[t]});I.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0),I.filter(function(t){return t.intercept&&t.slope}).watchTransition(Y,"scatterPlusLineChart: regline").attr("x1",m.range()[0]).attr("x2",m.range()[1]).attr("y1",function(t,e){return p(m.domain()[0]*t.slope+t.intercept)}).attr("y2",function(t,e){return p(m.domain()[1]*t.slope+t.intercept)}).style("stroke",function(t,e,n){return f(t,n)}).style("stroke-opacity",function(t,e){return t.disabled||void 0===t.slope||void 0===t.intercept?0:1}),y&&(e.scale(m)._ticks(i.utils.calcTicksX(O/100,L)).tickSize(-j,0),V.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(e)),b&&(n.scale(p)._ticks(i.utils.calcTicksY(j/36,L)).tickSize(-O,0),V.select(".nv-y.nv-axis").call(n)),a.getData(t.x()).scale(m).width(O).color(L.map(function(t,e){return t.color||f(t,e)}).filter(function(t,e){return!L[e].disabled})),H.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),V.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(L.filter(function(t){return!t.disabled})).call(a).style("opacity",function(){return g?"1":"1e-6"}).watchTransition(Y,"scatterPlusLineChart").style("opacity",function(){return g?"1":"1e-6"}),o.getData(t.y()).scale(p).width(j).color(L.map(function(t,e){return t.color||f(t,e)}).filter(function(t,e){return!L[e].disabled})),H.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),V.select(".nv-distributionY").attr("transform","translate("+(M?O:-o.size())+",0)").datum(L.filter(function(t){return!t.disabled})).call(o).style("opacity",function(){return v?"1":"1e-6"}).watchTransition(Y,"scatterPlusLineChart").style("opacity",function(){return v?"1":"1e-6"}),r.dispatch.on("stateChange",function(t){for(var e in t)x[e]=t[e];k.stateChange(x),E.update()}),k.on("changeState",function(t){void 0!==t.disabled&&(L.forEach(function(e,n){e.disabled=t.disabled[n]}),x.disabled=t.disabled),E.update()}),t.dispatch.on("elementMouseout.tooltip",function(e){s.hidden(!0),h.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),h.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",o.size())}),t.dispatch.on("elementMouseover.tooltip",function(t){h.select(".nv-series-"+t.seriesIndex+" .nv-distx-"+t.pointIndex).attr("y1",t.relativePos[1]-j),h.select(".nv-series-"+t.seriesIndex+" .nv-disty-"+t.pointIndex).attr("x2",t.relativePos[0]+a.size()),s.data(t).hidden(!1)}),m.copy(),p.copy()}),Y.renderEnd("scatter with line immediate"),E}return E.dispatch=k,E.scatter=t,E.legend=r,E.xAxis=e,E.yAxis=n,E.distX=a,E.distY=o,E.tooltip=s,E.options=i.utils.optionsFunc.bind(E),E._options=Object.create({},{width:{get:function(){return c},set:function(t){c=t}},height:{get:function(){return d},set:function(t){d=t}},container:{get:function(){return h},set:function(t){h=t}},showDistX:{get:function(){return g},set:function(t){g=t}},showDistY:{get:function(){return v},set:function(t){v=t}},showLegend:{get:function(){return _},set:function(t){_=t}},showXAxis:{get:function(){return y},set:function(t){y=t}},showYAxis:{get:function(){return b},set:function(t){b=t}},defaultState:{get:function(){return w},set:function(t){w=t}},noData:{get:function(){return L},set:function(t){L=t}},duration:{get:function(){return S},set:function(t){S=t}},showLabels:{get:function(){return T},set:function(t){T=t}},margin:{get:function(){return l},set:function(t){void 0!==t.top&&(l.top=t.top,u=t.top),l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},rightAlignYAxis:{get:function(){return M},set:function(t){M=t,n.orient(t?"right":"left")}},color:{get:function(){return f},set:function(t){f=i.utils.getColor(t),r.color(f),a.color(f),o.color(f)}}}),i.utils.inheritOptions(E,t),i.utils.initOptions(E),E},i.models.sparkline=function(){"use strict";var t,e,n,r,a={top:2,right:0,bottom:2,left:0},o=400,s=32,l=null,u=!0,c=d3.scale.linear(),d=d3.scale.linear(),h=function(t){return t.x},f=function(t){return t.y},m=i.utils.getColor(["#000"]),p=!0,g=!0,v=d3.dispatch("renderEnd"),_=i.utils.renderWatch(v);function y(u){return _.reset(),u.each(function(u){var v=o-a.left-a.right,_=s-a.top-a.bottom;l=d3.select(this),i.utils.initSVG(l),c.domain(t||d3.extent(u,h)).range(n||[0,v]),d.domain(e||d3.extent(u,f)).range(r||[_,0]);var y=l.selectAll("g.nv-wrap.nv-sparkline").data([u]);y.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline").append("g"),y.select("g");y.attr("transform","translate("+a.left+","+a.top+")");var b=y.selectAll("path").data(function(t){return[t]});b.enter().append("path"),b.exit().remove(),b.style("stroke",function(t,e){return t.color||m(t,e)}).attr("d",d3.svg.line().x(function(t,e){return c(h(t,e))}).y(function(t,e){return d(f(t,e))}));var M=y.selectAll("circle.nv-point").data(function(t){var e=t.map(function(t,e){return f(t,e)});function n(e){if(-1!=e){var n=t[e];return n.pointIndex=e,n}return null}var i=n(e.lastIndexOf(d.domain()[1])),r=n(e.indexOf(d.domain()[0])),a=n(e.length-1);return[p?r:null,p?i:null,g?a:null].filter(function(t){return null!=t})});M.enter().append("circle"),M.exit().remove(),M.attr("cx",function(t,e){return c(h(t,t.pointIndex))}).attr("cy",function(t,e){return d(f(t,t.pointIndex))}).attr("r",2).attr("class",function(t,e){return h(t,t.pointIndex)==c.domain()[1]?"nv-point nv-currentValue":f(t,t.pointIndex)==d.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),_.renderEnd("sparkline immediate"),y}return y.options=i.utils.optionsFunc.bind(y),y._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},xDomain:{get:function(){return t},set:function(e){t=e}},yDomain:{get:function(){return e},set:function(t){e=t}},xRange:{get:function(){return n},set:function(t){n=t}},yRange:{get:function(){return r},set:function(t){r=t}},xScale:{get:function(){return c},set:function(t){c=t}},yScale:{get:function(){return d},set:function(t){d=t}},animate:{get:function(){return u},set:function(t){u=t}},showMinMaxPoints:{get:function(){return p},set:function(t){p=t}},showCurrentPoint:{get:function(){return g},set:function(t){g=t}},x:{get:function(){return h},set:function(t){h=d3.functor(t)}},y:{get:function(){return f},set:function(t){f=d3.functor(t)}},margin:{get:function(){return a},set:function(t){a.top=void 0!==t.top?t.top:a.top,a.right=void 0!==t.right?t.right:a.right,a.bottom=void 0!==t.bottom?t.bottom:a.bottom,a.left=void 0!==t.left?t.left:a.left}},color:{get:function(){return m},set:function(t){m=i.utils.getColor(t)}}}),y.dispatch=v,i.utils.initOptions(y),y},i.models.sparklinePlus=function(){"use strict";var t,e,n=i.models.sparkline(),r={top:15,right:100,bottom:10,left:50},a=null,o=null,s=[],l=!1,u=d3.format(",r"),c=d3.format(",.2f"),d=!0,h=!0,f=!1,m=null,p=d3.dispatch("renderEnd"),g=i.utils.renderWatch(p);function v(m){return g.reset(),g.models(n),m.each(function(m){var p=d3.select(this);i.utils.initSVG(p);var g=i.utils.availableWidth(a,p,r),_=i.utils.availableHeight(o,p,r);if(v.update=function(){p.call(v)},v.container=this,!m||!m.length)return i.utils.noData(v,p),v;p.selectAll(".nv-noData").remove();var y=n.y()(m[m.length-1],m.length-1);t=n.xScale(),e=n.yScale();var b=p.selectAll("g.nv-wrap.nv-sparklineplus").data([m]),M=b.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus").append("g"),x=b.select("g");M.append("g").attr("class","nv-sparklineWrap"),M.append("g").attr("class","nv-valueWrap"),M.append("g").attr("class","nv-hoverArea"),b.attr("transform","translate("+r.left+","+r.top+")");var w=x.select(".nv-sparklineWrap");if(n.width(g).height(_),w.call(n),d){var k=x.select(".nv-valueWrap").selectAll(".nv-currentValue").data([y]);k.enter().append("text").attr("class","nv-currentValue").attr("dx",f?-8:8).attr("dy",".9em").style("text-anchor",f?"end":"start"),k.attr("x",g+(f?r.right:0)).attr("y",h?function(t){return e(t)}:0).style("fill",n.color()(m[m.length-1],m.length-1)).text(c(y))}function L(){if(!l){var e=x.selectAll(".nv-hoverValue").data(s),i=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove(),e.attr("transform",function(e){return"translate("+t(n.x()(m[e],e))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1),s.length&&(i.append("line").attr("x1",0).attr("y1",-r.top).attr("x2",0).attr("y2",_),i.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-r.top).attr("text-anchor","end").attr("dy",".9em"),x.select(".nv-hoverValue .nv-xValue").text(u(n.x()(m[s[0]],s[0]))),i.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-r.top).attr("text-anchor","start").attr("dy",".9em"),x.select(".nv-hoverValue .nv-yValue").text(c(n.y()(m[s[0]],s[0]))))}}M.select(".nv-hoverArea").append("rect").on("mousemove",function(){if(l)return;var e=d3.mouse(this)[0]-r.left;s=[function(t,e){for(var i=Math.abs(n.x()(t[0],0)-e),r=0,a=0;a<t.length;a++)Math.abs(n.x()(t[a],a)-e)<i&&(i=Math.abs(n.x()(t[a],a)-e),r=a);return r}(m,Math.round(t.invert(e)))],L()}).on("click",function(){l=!l}).on("mouseout",function(){s=[],L()}),x.select(".nv-hoverArea rect").attr("transform",function(t){return"translate("+-r.left+","+-r.top+")"}).attr("width",g+r.left+r.right).attr("height",_+r.top)}),g.renderEnd("sparklinePlus immediate"),v}return v.dispatch=p,v.sparkline=n,v.options=i.utils.optionsFunc.bind(v),v._options=Object.create({},{width:{get:function(){return a},set:function(t){a=t}},height:{get:function(){return o},set:function(t){o=t}},xTickFormat:{get:function(){return u},set:function(t){u=t}},yTickFormat:{get:function(){return c},set:function(t){c=t}},showLastValue:{get:function(){return d},set:function(t){d=t}},alignValue:{get:function(){return h},set:function(t){h=t}},rightAlignValue:{get:function(){return f},set:function(t){f=t}},noData:{get:function(){return m},set:function(t){m=t}},margin:{get:function(){return r},set:function(t){r.top=void 0!==t.top?t.top:r.top,r.right=void 0!==t.right?t.right:r.right,r.bottom=void 0!==t.bottom?t.bottom:r.bottom,r.left=void 0!==t.left?t.left:r.left}}}),i.utils.inheritOptions(v,n),i.utils.initOptions(v),v},i.models.stackedArea=function(){"use strict";var t,e,n={top:0,right:0,bottom:0,left:0},r=960,a=500,o=i.utils.defaultColor(),s=Math.floor(1e5*Math.random()),l=null,u=function(t){return t.x},c=function(t){return t.y},d=function(t,e){return!isNaN(c(t,e))&&null!==c(t,e)},h="stack",f="zero",m="default",p="linear",g=!1,v=i.models.scatter(),_=250,y=function(t,e,n){t.display={y:n,y0:e}},b=function(t){return e(t.display.y+t.display.y0)},M=d3.dispatch("areaClick","areaMouseover","areaMouseout","renderEnd","elementClick","elementMouseover","elementMouseout");v.pointSize(2.2).pointDomain([2.2,2.2]);var x=i.utils.renderWatch(M,_);function w(h){return x.reset(),x.models(v),h.each(function(h){var _=r-n.left-n.right,k=a-n.top-n.bottom;l=d3.select(this),i.utils.initSVG(l),t=v.xScale(),e=v.yScale();var L=h;h.forEach(function(t,e){t.seriesIndex=e,t.values=t.values.map(function(t,n){return t.index=n,t.seriesIndex=e,t})});var S=h.filter(function(t){return!t.disabled});h=d3.layout.stack().order(m).offset(f).values(function(t){return t.values}).x(u).y(c).out(y)(S);var T=l.selectAll("g.nv-wrap.nv-stackedarea").data([h]),Y=T.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea"),D=Y.append("defs"),C=Y.append("g"),E=T.select("g");C.append("g").attr("class","nv-areaWrap"),C.append("g").attr("class","nv-scatterWrap"),T.attr("transform","translate("+n.left+","+n.top+")"),0==v.forceY().length&&v.forceY().push(0),v.width(_).height(k).x(u).y(function(t){if(void 0!==t.display)return t.display.y+t.display.y0}).color(h.map(function(t,e){return t.color=t.color||o(t,t.seriesIndex),t.color})),E.select(".nv-scatterWrap").datum(h).call(v),D.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),T.select("#nv-edge-clip-"+s+" rect").attr("width",_).attr("height",k),E.attr("clip-path",g?"url(#nv-edge-clip-"+s+")":"");var A=d3.svg.area().defined(d).x(function(e,n){return t(u(e,n))}).y0(function(t){return e(t.display.y0)}).y1(b).interpolate(p),O=d3.svg.area().defined(d).x(function(e,n){return t(u(e,n))}).y0(function(t){return e(t.display.y0)}).y1(function(t){return e(t.display.y0)}),j=E.select(".nv-areaWrap").selectAll("path.nv-area").data(function(t){return t});j.enter().append("path").attr("class",function(t,e){return"nv-area nv-area-"+e}).attr("d",function(t,e){return O(t.values,t.seriesIndex)}).on("mouseover",function(t,e){d3.select(this).classed("hover",!0),M.areaMouseover({point:t,series:t.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t.seriesIndex})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),M.areaMouseout({point:t,series:t.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t.seriesIndex})}).on("click",function(t,e){d3.select(this).classed("hover",!1),M.areaClick({point:t,series:t.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t.seriesIndex})}),j.exit().remove(),j.style("fill",function(t,e){return t.color||o(t,t.seriesIndex)}).style("stroke",function(t,e){return t.color||o(t,t.seriesIndex)}),j.watchTransition(x,"stackedArea path").attr("d",function(t,e){return A(t.values,e)}),v.dispatch.on("elementMouseover.area",function(t){E.select(".nv-chart-"+s+" .nv-area-"+t.seriesIndex).classed("hover",!0)}),v.dispatch.on("elementMouseout.area",function(t){E.select(".nv-chart-"+s+" .nv-area-"+t.seriesIndex).classed("hover",!1)}),w.d3_stackedOffset_stackPercent=function(t){var e,n,i,r=t.length,a=t[0].length,o=[];for(n=0;n<a;++n){for(e=0,i=0;e<L.length;e++)i+=c(L[e].values[n]);if(i)for(e=0;e<r;e++)t[e][n][1]/=i;else for(e=0;e<r;e++)t[e][n][1]=0}for(n=0;n<a;++n)o[n]=0;return o}}),x.renderEnd("stackedArea immediate"),w}return w.dispatch=M,w.scatter=v,v.dispatch.on("elementClick",function(){M.elementClick.apply(this,arguments)}),v.dispatch.on("elementMouseover",function(){M.elementMouseover.apply(this,arguments)}),v.dispatch.on("elementMouseout",function(){M.elementMouseout.apply(this,arguments)}),w.interpolate=function(t){return arguments.length?(p=t,w):p},w.duration=function(t){return arguments.length?(_=t,x.reset(_),v.duration(_),w):_},w.dispatch=M,w.scatter=v,w.options=i.utils.optionsFunc.bind(w),w._options=Object.create({},{width:{get:function(){return r},set:function(t){r=t}},height:{get:function(){return a},set:function(t){a=t}},defined:{get:function(){return d},set:function(t){d=t}},clipEdge:{get:function(){return g},set:function(t){g=t}},offset:{get:function(){return f},set:function(t){f=t}},order:{get:function(){return m},set:function(t){m=t}},interpolate:{get:function(){return p},set:function(t){p=t}},x:{get:function(){return u},set:function(t){u=d3.functor(t)}},y:{get:function(){return c},set:function(t){c=d3.functor(t)}},areaY1:{get:function(){return b},set:function(t){b=d3.functor(t)}},transformData:{get:function(){return y},set:function(t){y=d3.functor(t)}},margin:{get:function(){return n},set:function(t){n.top=void 0!==t.top?t.top:n.top,n.right=void 0!==t.right?t.right:n.right,n.bottom=void 0!==t.bottom?t.bottom:n.bottom,n.left=void 0!==t.left?t.left:n.left}},color:{get:function(){return o},set:function(t){o=i.utils.getColor(t)}},style:{get:function(){return h},set:function(t){switch(h=t){case"stack":w.offset("zero"),w.order("default");break;case"stream":w.offset("wiggle"),w.order("inside-out");break;case"stream-center":w.offset("silhouette"),w.order("inside-out");break;case"expand":w.offset("expand"),w.order("default");break;case"stack_percent":w.offset(w.d3_stackedOffset_stackPercent),w.order("default")}}},duration:{get:function(){return _},set:function(t){_=t,x.reset(_),v.duration(_)}}}),i.utils.inheritOptions(w,v),i.utils.initOptions(w),w},i.models.stackedAreaChart=function(){"use strict";var t,e,n=i.models.stackedArea(),r=i.models.axis(),a=i.models.axis(),o=i.models.legend(),s=i.models.legend(),l=i.interactiveGuideline(),u=i.models.tooltip(),c=i.models.focus(i.models.stackedArea()),d={top:10,right:25,bottom:50,left:60},h=null,f=null,m=null,p=i.utils.defaultColor(),g=!0,v=!0,_="top",y=!0,b=!0,M=!1,x=!1,w=!1,k=!0,L="TOTAL",S=i.utils.state(),T=null,Y=null,D=d3.dispatch("stateChange","changeState","renderEnd"),C=250,E=["Stacked","Stream","Expanded"],A={},O=250;S.style=n.style(),r.orient("bottom").tickPadding(7),a.orient(M?"right":"left"),u.headerFormatter(function(t,e){return r.tickFormat()(t,e)}).valueFormatter(function(t,e){return a.tickFormat()(t,e)}),l.tooltip.headerFormatter(function(t,e){return r.tickFormat()(t,e)}).valueFormatter(function(t,e){return null==t?"N/A":a.tickFormat()(t,e)});var j=null,N=null;s.updateState(!1);var H=i.utils.renderWatch(D),V=(n.style(),function(t){return function(){return{active:t.map(function(t){return!t.disabled}),style:n.style()}}}),P=function(t){return function(e){void 0!==e.style&&e.style,void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}},F=d3.format("%");function I(u){return H.reset(),H.models(n),y&&H.models(r),b&&H.models(a),u.each(function(u){var Y=d3.select(this);i.utils.initSVG(Y);var H,R=i.utils.availableWidth(f,Y,d),W=i.utils.availableHeight(m,Y,d)-(x?c.height():0);if(I.update=function(){Y.transition().duration(O).call(I)},I.container=this,S.setter(P(u),I.update).getter(V(u)).update(),S.disabled=u.map(function(t){return!!t.disabled}),!T)for(H in T={},S)S[H]instanceof Array?T[H]=S[H].slice(0):T[H]=S[H];if(!(u&&u.length&&u.filter(function(t){return t.values.length}).length))return i.utils.noData(I,Y),I;Y.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale();var z=Y.selectAll("g.nv-wrap.nv-stackedAreaChart").data([u]),B=z.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),U=z.select("g");B.append("g").attr("class","nv-legendWrap"),B.append("g").attr("class","nv-controlsWrap");var G=B.append("g").attr("class","nv-focus");G.append("g").attr("class","nv-background").append("rect"),G.append("g").attr("class","nv-x nv-axis"),G.append("g").attr("class","nv-y nv-axis"),G.append("g").attr("class","nv-stackedWrap"),G.append("g").attr("class","nv-interactive");B.append("g").attr("class","nv-focusWrap");if(v){var $=g&&"top"===_?R-C:R;if(o.width($),U.select(".nv-legendWrap").datum(u).call(o),"bottom"===_){var q=r.height();d.bottom=Math.max(o.height()+q,d.bottom);var J=(W=i.utils.availableHeight(m,Y,d)-(x?c.height():0))+q;U.select(".nv-legendWrap").attr("transform","translate(0,"+J+")")}else"top"===_&&(h||d.top==o.height()||(d.top=o.height(),W=i.utils.availableHeight(m,Y,d)-(x?c.height():0)),U.select(".nv-legendWrap").attr("transform","translate("+(R-$)+","+-d.top+")"))}else U.select(".nv-legendWrap").selectAll("*").remove();if(g){var X=[{key:A.stacked||"Stacked",metaKey:"Stacked",disabled:"stack"!=n.style(),style:"stack"},{key:A.stream||"Stream",metaKey:"Stream",disabled:"stream"!=n.style(),style:"stream"},{key:A.stream_center||"Stream Center",metaKey:"Stream_Center",disabled:"stream_center"!=n.style(),style:"stream-center"},{key:A.expanded||"Expanded",metaKey:"Expanded",disabled:"expand"!=n.style(),style:"expand"},{key:A.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:"stack_percent"!=n.style(),style:"stack_percent"}];C=E.length/3*260,X=X.filter(function(t){return-1!==E.indexOf(t.metaKey)}),s.width(C).color(["#444","#444","#444"]),U.select(".nv-controlsWrap").datum(X).call(s);var Z=Math.max(s.height(),v&&"top"===_?o.height():0);d.top!=Z&&(d.top=Z,W=i.utils.availableHeight(m,Y,d)-(x?c.height():0)),U.select(".nv-controlsWrap").attr("transform","translate(0,"+-d.top+")")}else U.select(".nv-controlsWrap").selectAll("*").remove();z.attr("transform","translate("+d.left+","+d.top+")"),M&&U.select(".nv-y.nv-axis").attr("transform","translate("+R+",0)"),w&&(l.width(R).height(W).margin({left:d.left,top:d.top}).svgContainer(Y).xScale(t),z.select(".nv-interactive").call(l)),U.select(".nv-focus .nv-background rect").attr("width",R).attr("height",W),n.width(R).height(W).color(u.map(function(t,e){return t.color||p(t,e)}).filter(function(t,e){return!u[e].disabled}));var K,Q=U.select(".nv-focus .nv-stackedWrap").datum(u.filter(function(t){return!t.disabled}));(y&&r.scale(t)._ticks(i.utils.calcTicksX(R/100,u)).tickSize(-W,0),b)&&(K="wiggle"===n.offset()?0:i.utils.calcTicksY(W/36,u),a.scale(e)._ticks(K).tickSize(-R,0));function tt(){y&&U.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+W+")").transition().duration(O).call(r)}function et(){if(b){if("expand"===n.style()||"stack_percent"===n.style()){var t=a.tickFormat();j&&t===F||(j=t),a.tickFormat(F)}else j&&(a.tickFormat(j),j=null);U.select(".nv-focus .nv-y.nv-axis").transition().duration(0).call(a)}}if(x){c.width(R),U.select(".nv-focusWrap").attr("transform","translate(0,"+(W+d.bottom+c.margin().top)+")").datum(u.filter(function(t){return!t.disabled})).call(c);var nt=c.brush.empty()?c.xDomain():c.brush.extent();null!==nt&&it(nt)}else Q.transition().call(n),tt(),et();function it(t){U.select(".nv-focus .nv-stackedWrap").datum(u.filter(function(t){return!t.disabled}).map(function(e,i){return{key:e.key,area:e.area,classed:e.classed,values:e.values.filter(function(e,i){return n.x()(e,i)>=t[0]&&n.x()(e,i)<=t[1]}),disableTooltip:e.disableTooltip}})).transition().duration(O).call(n),tt(),et()}n.dispatch.on("areaClick.toggle",function(t){1===u.filter(function(t){return!t.disabled}).length?u.forEach(function(t){t.disabled=!1}):u.forEach(function(e,n){e.disabled=n!=t.seriesIndex}),S.disabled=u.map(function(t){return!!t.disabled}),D.stateChange(S),I.update()}),o.dispatch.on("stateChange",function(t){for(var e in t)S[e]=t[e];D.stateChange(S),I.update()}),s.dispatch.on("legendClick",function(t,e){t.disabled&&(X=X.map(function(t){return t.disabled=!0,t}),t.disabled=!1,n.style(t.style),S.style=n.style(),D.stateChange(S),I.update())}),l.dispatch.on("elementMousemove",function(t){n.clearHighlights();var e,r,a,o=[],s=0,c=!0,d=!1;if(u.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(l,h){r=i.interactiveBisect(l.values,t.pointXValue,I.x());var f=l.values[r],m=I.y()(f,r);if(null!=m&&m>0&&(n.highlightPoint(h,r,!0),d=!0),h!==u.length-1||d||n.highlightPoint(h,r,!0),void 0!==f){void 0===e&&(e=f),void 0===a&&(a=I.xScale()(I.x()(f,r)));var g="expand"==n.style()?f.display.y:I.y()(f,r);o.push({key:l.key,value:g,color:p(l,l.seriesIndex),point:f}),k&&"expand"!=n.style()&&null!=g&&(s+=g,c=!1)}}),o.reverse(),o.length>2){var h=I.yScale().invert(t.mouseY),f=null;o.forEach(function(t,e){h=Math.abs(h);var n=Math.abs(t.point.display.y0),i=Math.abs(t.point.display.y);h>=n&&h<=i+n&&(f=e)}),null!=f&&(o[f].highlight=!0)}k&&"expand"!=n.style()&&o.length>=2&&!c&&o.push({key:L,value:s,total:!0});var m=I.x()(e,r),g=l.tooltip.valueFormatter();"expand"===n.style()||"stack_percent"===n.style()?(N||(N=g),g=d3.format(".1%")):N&&(g=N,N=null),l.tooltip.valueFormatter(g).data({value:m,series:o})(),l.renderGuideLine(a)}),l.dispatch.on("elementMouseout",function(t){n.clearHighlights()}),c.dispatch.on("onBrush",function(t){it(t)}),D.on("changeState",function(t){void 0!==t.disabled&&u.length===t.disabled.length&&(u.forEach(function(e,n){e.disabled=t.disabled[n]}),S.disabled=t.disabled),void 0!==t.style&&(n.style(t.style),t.style),I.update()})}),H.renderEnd("stacked Area chart immediate"),I}return n.dispatch.on("elementMouseover.tooltip",function(t){t.point.x=n.x()(t.point),t.point.y=n.y()(t.point),u.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){u.hidden(!0)}),I.dispatch=D,I.stacked=n,I.legend=o,I.controls=s,I.xAxis=r,I.x2Axis=c.xAxis,I.yAxis=a,I.y2Axis=c.yAxis,I.interactiveLayer=l,I.tooltip=u,I.focus=c,I.dispatch=D,I.options=i.utils.optionsFunc.bind(I),I._options=Object.create({},{width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return m},set:function(t){m=t}},showLegend:{get:function(){return v},set:function(t){v=t}},legendPosition:{get:function(){return _},set:function(t){_=t}},showXAxis:{get:function(){return y},set:function(t){y=t}},showYAxis:{get:function(){return b},set:function(t){b=t}},defaultState:{get:function(){return T},set:function(t){T=t}},noData:{get:function(){return Y},set:function(t){Y=t}},showControls:{get:function(){return g},set:function(t){g=t}},controlLabels:{get:function(){return A},set:function(t){A=t}},controlOptions:{get:function(){return E},set:function(t){E=t}},showTotalInTooltip:{get:function(){return k},set:function(t){k=t}},totalLabel:{get:function(){return L},set:function(t){L=t}},focusEnable:{get:function(){return x},set:function(t){x=t}},focusHeight:{get:function(){return c.height()},set:function(t){c.height(t)}},brushExtent:{get:function(){return c.brushExtent()},set:function(t){c.brushExtent(t)}},margin:{get:function(){return d},set:function(t){void 0!==t.top&&(d.top=t.top,h=t.top),d.right=void 0!==t.right?t.right:d.right,d.bottom=void 0!==t.bottom?t.bottom:d.bottom,d.left=void 0!==t.left?t.left:d.left}},focusMargin:{get:function(){return c.margin},set:function(t){c.margin.top=void 0!==t.top?t.top:c.margin.top,c.margin.right=void 0!==t.right?t.right:c.margin.right,c.margin.bottom=void 0!==t.bottom?t.bottom:c.margin.bottom,c.margin.left=void 0!==t.left?t.left:c.margin.left}},duration:{get:function(){return O},set:function(t){O=t,H.reset(O),n.duration(O),r.duration(O),a.duration(O)}},color:{get:function(){return p},set:function(t){p=i.utils.getColor(t),o.color(p),n.color(p),c.color(p)}},x:{get:function(){return n.x()},set:function(t){n.x(t),c.x(t)}},y:{get:function(){return n.y()},set:function(t){n.y(t),c.y(t)}},rightAlignYAxis:{get:function(){return M},set:function(t){M=t,a.orient(M?"right":"left")}},useInteractiveGuideline:{get:function(){return w},set:function(t){w=!!t,I.interactive(!t),I.useVoronoi(!t),n.scatter.interactive(!t)}}}),i.utils.inheritOptions(I,n),i.utils.initOptions(I),I},i.models.stackedAreaWithFocusChart=function(){return i.models.stackedAreaChart().margin({bottom:30}).focusEnable(!0)},i.models.sunburst=function(){"use strict";var t,e,n,r,a={top:0,right:0,bottom:0,left:0},o=600,s=600,l="count",u={count:function(t){return 1},value:function(t){return t.value||t.size},size:function(t){return t.value||t.size}},c=Math.floor(1e4*Math.random()),d=null,h=i.utils.defaultColor(),f=!1,m=function(t){return"count"===l?t.name+" #"+t.value:t.name+" "+(t.value||t.size)},p=.02,g=function(t,e){return t.name>e.name},v=function(t,e){return void 0!==t.parent?t.name+"-"+t.parent.name+"-"+e:t.name},_=!0,y=500,b=d3.dispatch("chartClick","elementClick","elementDblClick","elementMousemove","elementMouseover","elementMouseout","renderEnd"),M=d3.scale.linear().range([0,2*Math.PI]),x=d3.scale.sqrt(),w=d3.layout.partition().sort(g),k={},L=d3.svg.arc().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,M(t.x)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,M(t.x+t.dx)))}).innerRadius(function(t){return Math.max(0,x(t.y))}).outerRadius(function(t){return Math.max(0,x(t.y+t.dy))});function S(t){return T(t)>90?180:0}function T(t){return(Math.max(0,Math.min(2*Math.PI,M(t.x)))+Math.max(0,Math.min(2*Math.PI,M(t.x+t.dx))))/2*(180/Math.PI)-90}function Y(t){var e=Math.max(0,Math.min(2*Math.PI,M(t.x)));return Math.max(0,Math.min(2*Math.PI,M(t.x+t.dx)))-e>p}function D(e,n){var i=d3.interpolate(M.domain(),[t.x,t.x+t.dx]),a=d3.interpolate(x.domain(),[t.y,1]),o=d3.interpolate(x.range(),[t.y?20:0,r]);return 0===n?function(){return L(e)}:function(t){return M.domain(i(t)),x.domain(a(t)).range(o(t)),L(e)}}function C(t){var e=d3.interpolate({x:t.x0,dx:t.dx0,y:t.y0,dy:t.dy0},t);return function(n){var i=e(n);return t.x0=i.x,t.dx0=i.dx,t.y0=i.y,t.dy0=i.dy,L(i)}}function E(t){t.forEach(function(t){var e=v(t),n=k[e];n?(t.dx0=n.dx,t.x0=n.x,t.dy0=n.dy,t.y0=n.y):(t.dx0=t.dx,t.x0=t.x,t.dy0=t.dy,t.y0=t.y),function(t){var e=v(t);k[e]||(k[e]={});var n=k[e];n.dx=t.dx,n.x=t.x,n.dy=t.dy,n.y=t.y}(t)})}function A(e){var n=d.selectAll("text"),i=d.selectAll("path");n.transition().attr("opacity",0),t=e,i.transition().duration(y).attrTween("d",D).each("end",function(t){t.x>=e.x&&t.x<e.x+e.dx&&(t.depth>=e.depth&&d3.select(this.parentNode).select("text").transition().duration(y).text(function(t){return m(t)}).attr("opacity",function(t){return Y(t)?1:0}).attr("transform",function(){var n=this.getBBox().width;if(0===t.depth)return"translate("+n/2*-1+",0)";if(t.depth===e.depth)return"translate("+(x(t.y)+5)+",0)";var i=T(t),r=S(t);return 0===r?"rotate("+i+")translate("+(x(t.y)+5)+",0)":"rotate("+i+")translate("+(x(t.y)+n+5)+",0)rotate("+r+")"}))})}var O=i.utils.renderWatch(b);function j(t){return O.reset(),t.each(function(t){d=d3.select(this),e=i.utils.availableWidth(o,d,a),n=i.utils.availableHeight(s,d,a),r=Math.min(e,n)/2,x.range([0,r]);var p=d.select("g.nvd3.nv-wrap.nv-sunburst");p[0][0]?p.attr("transform","translate("+(e/2+a.left+a.right)+","+(n/2+a.top+a.bottom)+")"):p=d.append("g").attr("class","nvd3 nv-wrap nv-sunburst nv-chart-"+c).attr("transform","translate("+(e/2+a.left+a.right)+","+(n/2+a.top+a.bottom)+")"),d.on("click",function(t,e){b.chartClick({data:t,index:e,pos:d3.event,id:c})}),w.value(u[l]||u.count);var g=w.nodes(t[0]).reverse();E(g);var D=p.selectAll(".arc-container").data(g,v);D.enter().append("g").attr("class","arc-container").append("path").attr("d",L).style("fill",function(t){return t.color?t.color:h(_?(t.children?t:t.parent).name:t.name)}).style("stroke","#FFF").on("click",function(t,e){A(t),b.elementClick({data:t,index:e})}).on("mouseover",function(t,e){d3.select(this).classed("hover",!0).style("opacity",.8),b.elementMouseover({data:t,color:d3.select(this).style("fill"),percent:function(t){var e=Math.max(0,Math.min(2*Math.PI,M(t.x)));return(Math.max(0,Math.min(2*Math.PI,M(t.x+t.dx)))-e)/(2*Math.PI)}(t)})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1).style("opacity",1),b.elementMouseout({data:t})}).on("mousemove",function(t,e){b.elementMousemove({data:t})}),D.each(function(t){d3.select(this).select("path").transition().duration(y).attrTween("d",C)}),f&&(D.selectAll("text").remove(),D.append("text").text(function(t){return m(t)}).transition().duration(y).attr("opacity",function(t){return Y(t)?1:0}).attr("transform",function(t){var e=this.getBBox().width;if(0===t.depth)return"rotate(0)translate("+e/2*-1+",0)";var n=T(t),i=S(t);return 0===i?"rotate("+n+")translate("+(x(t.y)+5)+",0)":"rotate("+n+")translate("+(x(t.y)+e+5)+",0)rotate("+i+")"})),A(g[g.length-1]),D.exit().transition().duration(y).attr("opacity",0).each("end",function(t){var e=v(t);k[e]=void 0}).remove()}),O.renderEnd("sunburst immediate"),j}return j.dispatch=b,j.options=i.utils.optionsFunc.bind(j),j._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},mode:{get:function(){return l},set:function(t){l=t}},id:{get:function(){return c},set:function(t){c=t}},duration:{get:function(){return y},set:function(t){y=t}},groupColorByParent:{get:function(){return _},set:function(t){_=!!t}},showLabels:{get:function(){return f},set:function(t){f=!!t}},labelFormat:{get:function(){return m},set:function(t){m=t}},labelThreshold:{get:function(){return p},set:function(t){p=t}},sort:{get:function(){return g},set:function(t){g=t}},key:{get:function(){return v},set:function(t){v=t}},margin:{get:function(){return a},set:function(t){a.top=void 0!=t.top?t.top:a.top,a.right=void 0!=t.right?t.right:a.right,a.bottom=void 0!=t.bottom?t.bottom:a.bottom,a.left=void 0!=t.left?t.left:a.left}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t)}}}),i.utils.initOptions(j),j},i.models.sunburstChart=function(){"use strict";var t=i.models.sunburst(),e=i.models.tooltip(),n={top:30,right:20,bottom:20,left:20},r=null,a=null,o=i.utils.defaultColor(),s=!1,l=(Math.round(1e5*Math.random()),null),u=null,c=250,d=d3.dispatch("stateChange","changeState","renderEnd"),h=i.utils.renderWatch(d);function f(e){return h.reset(),h.models(t),e.each(function(e){var o=d3.select(this);i.utils.initSVG(o);var s=i.utils.availableWidth(r,o,n),l=i.utils.availableHeight(a,o,n);if(f.update=function(){0===c?o.call(f):o.transition().duration(c).call(f)},f.container=o,!e||!e.length)return i.utils.noData(f,o),f;o.selectAll(".nv-noData").remove(),t.width(s).height(l).margin(n),o.call(t)}),h.renderEnd("sunburstChart immediate"),f}return e.duration(0).headerEnabled(!1).valueFormatter(function(t){return t}),t.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:t.data.name,value:t.data.value||t.data.size,color:t.color,percent:t.percent},s||(delete t.percent,delete t.series.percent),e.data(t).hidden(!1)}),t.dispatch.on("elementMouseout.tooltip",function(t){e.hidden(!0)}),t.dispatch.on("elementMousemove.tooltip",function(t){e()}),f.dispatch=d,f.sunburst=t,f.tooltip=e,f.options=i.utils.optionsFunc.bind(f),f._options=Object.create({},{noData:{get:function(){return u},set:function(t){u=t}},defaultState:{get:function(){return l},set:function(t){l=t}},showTooltipPercent:{get:function(){return s},set:function(t){s=t}},color:{get:function(){return o},set:function(e){o=e,t.color(o)}},duration:{get:function(){return c},set:function(e){c=e,h.reset(c),t.duration(c)}},margin:{get:function(){return n},set:function(e){n.top=void 0!==e.top?e.top:n.top,n.right=void 0!==e.right?e.right:n.right,n.bottom=void 0!==e.bottom?e.bottom:n.bottom,n.left=void 0!==e.left?e.left:n.left,t.margin(n)}}}),i.utils.inheritOptions(f,t),i.utils.initOptions(f),f},i.version="1.8.6-dev"}()},function(t,e,n){"use strict";var i=n(11),r=n(13),a=n(28),o=n(24),s=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),l=function(t){function e(e,n){var i=t.call(this)||this;return i.subject=e,i.subscriber=n,i.closed=!1,i}return i.a(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}},e}(o.a),u=n(52);n.d(e,"a",function(){return d});var c=function(t){function e(e){var n=t.call(this,e)||this;return n.destination=e,n}return i.a(e,t),e}(a.a),d=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return i.a(e,t),e.prototype[u.a]=function(){return new c(this)},e.prototype.lift=function(t){var e=new h(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new s;if(!this.isStopped)for(var e=this.observers,n=e.length,i=e.slice(),r=0;r<n;r++)i[r].next(t)},e.prototype.error=function(t){if(this.closed)throw new s;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,i=e.slice(),r=0;r<n;r++)i[r].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new s;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),i=0;i<e;i++)n[i].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new s;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new s;return this.hasError?(t.error(this.thrownError),o.a.EMPTY):this.isStopped?(t.complete(),o.a.EMPTY):(this.observers.push(t),new l(this,t))},e.prototype.asObservable=function(){var t=new r.a;return t.source=this,t},e.create=function(t,e){return new h(t,e)},e}(r.a),h=function(t){function e(e,n){var i=t.call(this)||this;return i.destination=e,i.source=n,i}return i.a(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):o.a.EMPTY},e}(d)},function(t,e,n){"use strict";n.d(e,"a",function(){return i});var i=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},function(t,e,n){"use strict";var i,r=n(0);!function(t){t[t.ProportionalConversion=2]="ProportionalConversion",t[t.Zoom=4]="Zoom"}(i||(i={})),n.d(e,"a",function(){return a});let a=class{constructor(t){this.dataTypeService=t}getNumericalOperationedValue(t,e,n){let r=e;const a=t.numericalOperationSetting;if(a.type===i.ProportionalConversion){const i=a.settings.upperLimit,o=a.settings.lowerLimit,s=t.numericalUpperLimit,l=t.numericalLowerLimit;if(s===l)return r;r=((i-o)/(s-l)*(e-l)+o).toFixed(n)}else if(a.type===i.Zoom){r=(e*a.settings.gain+a.settings.offset).toFixed(n)}return r}getNumericalOperations(t){const e={};return e.numericalUpperLimit=t.numericalUpperLimit||0===t.numericalUpperLimit?+t.numericalUpperLimit:this.dataTypeService.getMaxValue(t.version,t.dataType,t.fBoxDataType,t.integerDigits,t.fractionDigits),e.numericalLowerLimit=t.numericalLowerLimit||0===t.numericalLowerLimit?+t.numericalLowerLimit:this.dataTypeService.getMinValue(t.version,t.dataType,t.fBoxDataType,t.integerDigits,t.fractionDigits),e.enableNumericalOperation=t.enableNumericalOperation,t.enableNumericalOperation&&(e.type=t.numericalOperationSetting.type,e.type===i.ProportionalConversion?(e.proportionalConversion={},e.proportionalConversion.lowerLimit=t.numericalOperationSetting.settings.lowerLimit,e.proportionalConversion.upperLimit=t.numericalOperationSetting.settings.upperLimit):e.type===i.Zoom&&(e.zoom={},e.zoom.gain=t.numericalOperationSetting.settings.gain,e.zoom.offset=t.numericalOperationSetting.settings.offset)),e}getWriteValue(t,e,n,r,a){const o=Number(e);let s=Number(e);if(n.type===i.ProportionalConversion){const t=n.proportionalConversion.upperLimit,e=n.proportionalConversion.lowerLimit,i=n.numericalUpperLimit,r=n.numericalLowerLimit;if(t===e)return s.toString();s=(o-e)*(i-r)/(t-e)+r}else if(n.type===i.Zoom){const t=n.zoom.gain,e=n.zoom.offset;if(0===t)return s.toString();s=(o-e)/t}return(s=this.dataTypeService.isFloat(t,r)?Number(s.toFixed(a)):Number(s.toFixed(0))).toString()}getWriteMaxValue(t,e){let n=t;if(e.enableNumericalOperation)if(e.type===i.ProportionalConversion)n=e.proportionalConversion.upperLimit;else if(e.type===i.Zoom){const t=e.zoom.gain,i=e.zoom.offset,r=this.toInteger(t);n=n*r.num/r.times+i}return n}getWriteMinValue(t,e){let n=t;if(e.enableNumericalOperation)if(e.type===i.ProportionalConversion)n=e.proportionalConversion.lowerLimit;else if(e.type===i.Zoom){const t=e.zoom.gain,i=e.zoom.offset,r=this.toInteger(t);n=n*r.num/r.times+i}return n}toInteger(t){const e={times:1,num:0},n=t<0;if(t=Math.abs(t),this.isInteger(t))return e.num=t,e.num=n?-t:t,e;const i=t+"",r=i.indexOf("."),a=i.substr(r+1).length,o=Math.pow(10,a),s=parseInt((t*o+.5).toString(),10);return e.times=o,e.num=s,e.num=n?-s:s,e}isInteger(t){return Math.floor(t)===t}};a=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(r.Injectable)()],a)},function(t,e,n){"use strict";var i,r=n(0);!function(t){t[t.Write=2]="Write",t[t.ReadOnly=4]="ReadOnly",t[t.ReadWrite=6]="ReadWrite"}(i||(i={})),n.d(e,"a",function(){return a});let a=class{getAccessPermissions(){return[{key:i.ReadOnly,value:"ReadOnly"},{key:i.ReadWrite,value:"ReadWrite"}]}isReadOnly(t){return t===i.ReadOnly}isReadWrite(t){return t==i.ReadWrite}canRead(t){return t===i.ReadOnly}canWrite(t){return t===i.ReadWrite||t===i.Write}};a=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(r.Injectable)()],a)},function(t,e,n){"use strict";var i=n(29);n.d(e,"a",function(){return i.a})},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var i=n(0);let r=class{constructor(){this.zeroText="0"}padLeft(t,e,n){let i=String(t);n=n||this.zeroText;let r=i.length;for(;r<e;)i=n+i,r++;return i.toString()}padRight(t,e,n){let i=String(t);n=n||this.zeroText;let r=i.length;for(;r<e;)i+=n,r++;return i.toString()}movePointLeft(t,e){if(e<=0)return t;const n=String(t).split(".");let i=n[0]?n[0]:"";const r=n[1]?n[1]:"";let a=".",o="";return"-"===i.slice(0,1)&&(i=i.slice(1),o="-"),i.length<=e&&(a="0.",i=this.padLeft(i,e,"0")),o+i.slice(0,-e)+a+i.slice(-e)+r}movePointRight(t,e){if(e<=0)return t;const n=new String(t).split("."),i=n[0]?n[0]:"";let r=n[1]?n[1]:"",a=".";return r.length<=e&&(a="",r=this.padRight(r,e,"0")),i+r.slice(0,e)+a+r.slice(e,r.length)}movePoint(t,e){return e>=0?this.movePointRight(t,e):this.movePointLeft(t,-e)}roundingToFixedFractionDigits(t,e){const n=String(t),i=n.indexOf(".")+1,r=n.length-i;if(i>=1&&r>e){let r=+this.movePoint(n,e);const a=Number(n.substr(i+e,1));return r=a>=5&&t>=0||a<5&&t<0?Math.ceil(r):Math.floor(r),this.movePoint(r,-e)}return Number(t).toFixed(e)}};r=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)()],r)},function(t,e,n){"use strict";n.d(e,"a",function(){return a});var i=n(0),r=n(2);let a=class{constructor(t,e){this.fcloudDataTypeService=t,this.fboxDataTypeService=e}getValueType(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.getValueType(e):this.fboxDataTypeService.getValueType(e)}getValuePattern(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.getValuePattern(e):this.fboxDataTypeService.getValuePattern(e)}isHexType(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isHexType(e):this.fboxDataTypeService.isHexType(e)}isBinaryType(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isBinaryType(e):this.fboxDataTypeService.isBinaryType(e)}isHexOrBinaryType(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isHexOrBinaryType(e):this.fboxDataTypeService.isHexOrBinaryType(e)}isFloat(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isFloat(e):this.fboxDataTypeService.isFloat(e)}getValueMaxLength(t,e,n){return Object(r.isNumber)(n)?this.fboxDataTypeService.getValueMaxLength(n):!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.getValueMaxLength(e):this.fboxDataTypeService.getValueMaxLength(e)}isSupportFractionDigit(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isSupportFractionDigit(e):this.fboxDataTypeService.isSupportFractionDigit(e)}isSignedType(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isSignedType(e):this.fboxDataTypeService.isSignedType(e)}isSupportNumericalOperation(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isSupportNumericalOperation(e):this.fboxDataTypeService.isSupportNumericalOperation(e)}formatToDecimal(t,e,n){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.formatToDecimal(e,n):this.fboxDataTypeService.formatToDecimal(e,n)}getMinValue(t,e,n,i,a){return Object(r.isNumber)(n)?this.fboxDataTypeService.getMinValue(n,i,a):!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.getMinValue(e):this.fboxDataTypeService.getMinValue(e)}getMaxValue(t,e,n,i,a){return Object(r.isNumber)(n)?this.fboxDataTypeService.getMaxValue(n,i,a):!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.getMaxValue(e):this.fboxDataTypeService.getMaxValue(e)}};a=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)()],a)},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var i=n(0),r=n(9),a=n(6),o=function(t,e){return function(n,i){e(n,i,t)}};let s=class{constructor(t){this.localization=t,this.defaultIntegerDigits=4,this.defaultFractionDigits=0,this.dataTypeList=new Map}getValueType(t){switch(t){case a.a.Binary:return this.localization.binaryType;case a.a.Int32:case a.a.Float:return this.localization.decimalType;case a.a.Hex:return this.localization.hexadecimalType;case a.a.String:return this.localization.stringType}}getValuePattern(t){switch(t){case a.a.Binary:return"^[01]+$";case a.a.Int32:case a.a.Float:return"^[+-]?[0-9]*(\\.[0-9]*)?$";case a.a.Hex:return"^[0-9a-fA-F]+$"}}isHexType(t){return t===a.a.Hex}isBinaryType(t){return t===a.a.Binary}isHexOrBinaryType(t){return t===a.a.Binary||t===a.a.Hex}isFloat(t){return t===a.a.Float}getValueMaxLength(t){switch(t){case a.a.Int32:return 10;case a.a.Float:return 11;case a.a.Binary:return 32;case a.a.Hex:return 8;default:return 0}}isSupportFractionDigit(t){return t!==a.a.Bool&&t!==a.a.String&&t!==a.a.Binary&&t!==a.a.Hex}isSignedType(t){return t===a.a.Int32||t===a.a.Float}isSupportNumericalOperation(t){return t!==a.a.Bool&&t!==a.a.Binary&&t!==a.a.Hex&&t!==a.a.String}formatToDecimal(t,e){return this.isBinaryType(e)?parseInt(t,2):this.isHexType(e)?parseInt(t,16):t}getMinValue(t,e,n){let i;switch(t){case a.a.Binary:case a.a.Hex:i=0;break;case a.a.Int32:i=-2147483648;break;case a.a.Float:i=-1e9}if(e){let r=e;n&&(r+=n),r&&i.toString().length-1>r&&(i=-this.getFillNine(r)),this.isFloat(t)&&n&&(i/=Math.pow(10,n))}return i}getMaxValue(t,e,n){let i;switch(t){case a.a.Binary:case a.a.Hex:i=4294967295;break;case a.a.Int32:i=2147483647;break;case a.a.Float:i=1e9}if(e){let r=e;n&&(r+=n),r&&i.toString().length>r&&(i=this.getFillNine(r)),this.isFloat(t)&&n&&(i/=Math.pow(10,n))}return i}getFillNine(t){let e="9";for(let n=1;n<t;n++)e=`9${e}`;return e}};s=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)(),o(0,Object(i.Inject)(r.b))],s)},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var i=n(0),r=n(9),a=function(t,e){return function(n,i){e(n,i,t)}};let o=class{constructor(t){this.localization=t,this.defaultIntegerDigits=4,this.defaultFractionDigits=0}getValueType(t){switch(t){case 0:case 5:case 15:return this.localization.binaryType;case 1:case 2:case 3:case 11:case 12:case 13:case 16:return this.localization.decimalType;case 4:case 14:return this.localization.hexadecimalType;case 30:return this.localization.stringType}}getValuePattern(t){switch(t){case 0:case 5:case 15:return"^[01]+$";case 1:case 2:case 3:case 11:case 12:case 13:case 16:return"^[+-]?[0-9]*(\\.[0-9]*)?$";case 4:case 14:return"^[0-9a-fA-F]+$"}}isHexType(t){return 4===t||14===t}isBinaryType(t){return 5===t||15===t}isHexOrBinaryType(t){return 4===t||14===t||5===t||15===t}isFloat(t){return 16===t}getValueMaxLength(t){switch(t){case 1:return 5;case 2:return 6;case 3:case 4:return 4;case 5:return 16;case 11:return 10;case 12:case 16:return 11;case 13:case 14:return 8;case 15:return 32;case 21:case 22:case 23:return 16;case 24:return 8;case 25:return 32;default:return 0}}isSupportFractionDigit(t){return 0!==t&&4!==t&&5!==t&&14!==t&&15!==t&&30!==t}isSignedType(t){return 2===t||12===t||16===t}isSupportNumericalOperation(t){return 0!==t&&4!==t&&5!==t&&14!==t&&15!==t&&30!==t}formatToDecimal(t,e){return this.isBinaryType(e)?parseInt(t,2):this.isHexType(e)?parseInt(t,16):t}getMinValue(t,e,n){let i;switch(t){case 1:case 3:case 4:case 5:case 11:case 13:case 14:case 15:case 21:case 23:case 14:case 15:case 24:case 25:i=0;break;case 2:i=-32768;break;case 12:i=-2147483648;break;case 16:i=-1e9;break;case 22:i=Number.MIN_SAFE_INTEGER;break;case 26:i=-Number.MAX_VALUE}if(e){let r=e;n&&(r+=n),r&&i.toString().length-1>r&&(i=-this.getFillNine(r)),this.isFloat(t)&&n&&(i/=Math.pow(10,n))}return i}getMaxValue(t,e,n){let i;switch(t){case 1:case 4:case 5:i=65535;break;case 2:i=32767;break;case 3:i=9999;break;case 11:case 14:case 15:i=4294967295;break;case 12:i=2147483647;break;case 13:i=99999999;break;case 16:i=1e9;break;case 21:case 24:case 25:case 22:case 23:i=Number.MAX_SAFE_INTEGER;break;case 26:i=Number.MAX_VALUE}if(e){let r=e;n&&(r+=n),r&&i.toString().length>r&&(i=this.getFillNine(r)),this.isFloat(t)&&n&&(i/=Math.pow(10,n))}return i}getFillNine(t){let e="9";for(let n=1;n<t;n++)e=`9${e}`;return e}};o=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)(),a(0,Object(i.Inject)(r.b))],o)},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var i=n(0);let r=class{};r=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)()],r)},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var i=n(50),r=n(268),a=n(54);function o(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return Object(i.a)(n)?(t.pop(),Object(a.a)(t,n)):Object(r.a)(t)}},function(t,e,n){"use strict";function i(t){return t&&"function"==typeof t.schedule}n.d(e,"a",function(){return i})},function(t,e,n){"use strict";function i(t){return"function"==typeof t}n.d(e,"a",function(){return i})},function(t,e,n){"use strict";n.d(e,"a",function(){return i});var i=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}()},function(t,e,n){"use strict";n.d(e,"a",function(){return a});var i=n(23),r=n(34),a={closed:!0,next:function(t){},error:function(t){if(i.a.useDeprecatedSynchronousErrorHandling)throw t;Object(r.a)(t)},complete:function(){}}},function(t,e,n){"use strict";n.d(e,"a",function(){return a});var i=n(13),r=n(24);function a(t,e){return new i.a(function(n){var i=new r.a,a=0;return i.add(e.schedule(function(){a!==t.length?(n.next(t[a++]),n.closed||i.add(this.schedule())):n.complete()})),i})}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});var i=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}()},function(t,e,n){"use strict";var i;!function(t){t[t.ToggleView=0]="ToggleView",t[t.PopupView=1]="PopupView",t[t.CloseView=2]="CloseView",t[t.ControlView=3]="ControlView"}(i||(i={}));var r=n(224);n.d(e,"b",function(){return i}),n.d(e,"a",function(){return r.ViewOperationElementModel})},function(t,e,n){"use strict";var i;!function(t){t[t.Positive=0]="Positive",t[t.Negative=1]="Negative"}(i||(i={}));var r=n(225);n.d(e,"a",function(){return i}),n.d(e,"b",function(){return r.Pipe})},function(t,e,n){"use strict";class i{}var r=n(261),a=n(260),o=n(259),s=n(258),l=n(257),u=n(256);n.d(e,"a",function(){return i}),n.d(e,"f",function(){return r.ReadableModel}),n.d(e,"c",function(){return a.ConditionalDisplayModel}),n.d(e,"e",function(){return o.ConditionalEnableModel}),n.d(e,"b",function(){return s.ConditionalControlModel}),n.d(e,"d",function(){return l.ConditionalDynamicDisplayModel}),n.d(e,"g",function(){return u.SecurityModel})},function(t,e,n){"use strict";var i,r,a=n(209);!function(t){t[t.Center=0]="Center",t[t.Custom=1]="Custom"}(i||(i={})),function(t){t[t.Shadow=0]="Shadow",t[t.Musk=1]="Musk"}(r||(r={})),n.d(e,"c",function(){return a.ViewSettingsModel}),n.d(e,"b",function(){return i}),n.d(e,"a",function(){return r})},function(t,e,n){"use strict";var i,r=n(222),a=n(221);!function(t){t[t.ProportionalConversion=2]="ProportionalConversion",t[t.Zoom=4]="Zoom"}(i||(i={}));var o,s=n(220),l=n(219),u=n(218),c=n(217);!function(t){t[t.Decimal=0]="Decimal",t[t.Hex=1]="Hex",t[t.Binary=2]="Binary"}(o||(o={})),n.d(e,"b",function(){return r.NumericalDisplay}),n.d(e,"d",function(){return a.NumericalOperationSettings}),n.d(e,"e",function(){return i}),n.d(e,"c",function(){return s.NumericalOperation}),n.d(e,"f",function(){return l.ProportionalConversion}),n.d(e,"g",function(){return u.TypeSettings}),n.d(e,"h",function(){return c.Zoom}),n.d(e,"a",function(){return o})},function(t,e,n){"use strict";var i=n(73),r=n(72),a=n(71),o=n(70),s=n(69),l=n(68),u=n(67),c=n(66);n.d(e,"h",function(){return i.WeatherService}),n.d(e,"c",function(){return r.PermissionChecker}),n.d(e,"d",function(){return a.ReleasedVariableService}),n.d(e,"a",function(){return o.CreateOperationRecordArgs}),n.d(e,"b",function(){return s.OperationRecordService}),n.d(e,"e",function(){return l.VariableOptionModel}),n.d(e,"f",function(){return u.VideoService}),n.d(e,"g",function(){return c.VideoUrl})},function(t,e,n){"use strict";var i=n(83),r=n(82),a=n(81),o=n(80),s=n(79),l=n(78),u=n(2),c=n(49),d=n(39),h=n(16),f=n(12),m=n(29);class p{constructor(t){this.remoteGraphProtocol=t,this.graphStateCache=new m.a(t=>JSON.stringify(t))}getGraph(t,e,n){const i={graphId:t,stateId:e,extendedStyle:n};return this.graphStateCache.has(i)?Object(c.a)(this.graphStateCache.get(i)):this.remoteGraphProtocol.version>=1?this.getReleasedGraphState(i):this.getSystemGraph(i)}getSystemGraph(t){const e=String(t.graphId);return this.remoteGraphProtocol.getSystemGraphConfig(e).pipe(Object(h.map)(n=>{let i;const r=Object(u.find)(n.states,e=>e.id===t.stateId);if(r){const t="svg"===r.type?f.i.SVG:f.i.Image,n=new f.f(t,this.remoteGraphProtocol.getAbsoluteStateUrl(e,r.url));i=f.g.success(n)}else i=f.g.failed();return this.graphStateCache.set(t,i),i}))}getImageUrl(t){return t?0===t.indexOf("http://")||0===t.indexOf("https://")?t:this.remoteGraphProtocol.remoteServiceBaseUrl+t:t}getReleasedGraphState(t){return t.extendedStyle?this.getReleaseGraphStateWithExtendedStyle(t):(this.graphStateToBeResolved||(this.graphStateToBeResolved=new m.a(t=>JSON.stringify(t)),setTimeout(()=>{this.resolvePendingStates()})),this.graphStateToBeResolved.has(t)||this.graphStateToBeResolved.set(t,new d.a),this.graphStateToBeResolved.get(t))}getReleaseGraphStateWithExtendedStyle(t){const e=Number(t.graphId),n=encodeURIComponent(t.extendedStyle.fill),i=encodeURIComponent(t.extendedStyle.stroke),r=this.remoteGraphProtocol.getGraphStateUrl(e,t.stateId,n,i),a=new f.f(f.i.SVG,r);return Object(c.a)(f.g.success(a))}resolvePendingStates(){const t=this.graphStateToBeResolved,e=[];t.forEach((t,n)=>{const i=JSON.parse(n);e.push({graphId:i.graphId,stateIndex:i.stateId})});const n={states:e};this.remoteGraphProtocol.getReleasedGraphStates(n).subscribe(e=>{e.forEach(e=>{const n={graphId:e.graphId,stateId:e.stateIndex};let i;if(e.result){const t=this.getImageUrl(e.result.url);i=f.g.success(new f.f(e.result.type,t))}else i=f.g.failed();this.graphStateCache.set(n,i);const r=t.get(n);r&&(r.next(i),r.complete())})}),delete this.graphStateToBeResolved}}var g=n(77),v=n(30);class _{constructor(t){this.remoteViewProtocol=t,this.viewConfigCache=new m.a(t=>JSON.stringify(t))}getMainViewConfig(){return this.remoteViewProtocol.getReleasedMainView().pipe(Object(h.map)(t=>{const e=new v.a(t.content);return this.viewConfigCache.set(t.viewIndex,e),e}))}getViewConfig(t){return this.viewConfigCache.has(t)?Object(c.a)(this.viewConfigCache.get(t)):this.remoteViewProtocol.getReleasedView(t).pipe(Object(h.map)(e=>{const n=new v.a(e.content);return this.viewConfigCache.set(t,n),n}))}getViewConfigByConfigureViewId(t){return this.remoteViewProtocol.getViewConfigByConfigureViewId(t).pipe(Object(h.map)(t=>{return new v.a(t.content)}))}getViewConfigByConfigureViewCode(t){return this.remoteViewProtocol.getViewConfigByConfigureViewCode(t).pipe(Object(h.map)(t=>{return new v.a(t.content)}))}}var y=n(76),b=n(75);const M="defaultImage",x="/assets/common/images/configure/defaultImage.png",w="/ConfigureComponent/GetImage",k="id=";class L{constructor(t){this.remoteImageProtocol=t}getDiagramImageUrlPrefix(){return this.remoteImageProtocol.remoteServiceBaseUrl+w+"?"}getImageUrl(t){return t&&t!==M?this.getDiagramImageUrlPrefix()+k+t:this.remoteImageProtocol.appBaseUrl+x}}var S=n(13),T=n(43);class Y{constructor(t,e){this.remoteVariableProtocol=t,this.logger=e,this.observers=new Map,this.appIdVariablesMap=new Map,this.variableStateObservers=new Map,this.variableStateCache=new Map,this.alarmObservers=[],this.variableValueCache=new T.a(t=>JSON.stringify(t)),this.connectedSubscription=this.remoteVariableProtocol.connected.subscribe(()=>{const t=[];this.variableStateObservers.forEach((e,n)=>{t.push(n)}),this.remoteVariableProtocol.subscribeVariableStates(t),this.appIdVariablesMap.forEach((t,e)=>{this.remoteVariableProtocol.tryOpenVariables(t,e)})}),this.doVariableStatesChanged(),this.doVariableValuesChanged(),this.doAlarmChanged()}doAlarmChanged(){void 0!==this.alarmChangedSubscription&&this.alarmChangedSubscription.unsubscribe(),this.alarmChangedSubscription=this.remoteVariableProtocol.virtualDeviceAlarmsChanged.subscribe(t=>{Object(u.each)(this.alarmObservers,e=>{e.next(t)})})}doVariableValuesChanged(){void 0!==this.variableValuesChangedSubscription&&this.variableValuesChangedSubscription.unsubscribe(),this.variableValuesChangedSubscription=this.remoteVariableProtocol.variableValuesChanged.subscribe(t=>{Object(u.each)(t,t=>{const e=t.variableName;this.variableValueCache.set(e,t),this.observers.has(e)&&Object(u.each)(this.observers.get(e),e=>{e.next([t])})})})}doVariableStatesChanged(){void 0!==this.variableStatesChangedSubscription&&this.variableStatesChangedSubscription.unsubscribe(),this.variableStatesChangedSubscription=this.remoteVariableProtocol.variableStatesChanged.subscribe(t=>{Object(u.each)(t,t=>{const e=t.variableName;this.variableStateCache.set(e,t),this.variableStateObservers.has(e)&&Object(u.each)(this.variableStateObservers.get(e),e=>{e.next([t])})})})}subscribeVariableStates(t){return new S.a(e=>{let n=[];return Object(u.each)(t,t=>{this.variableStateObservers.has(t)?this.variableStateCache.has(t)&&e.next([this.variableStateCache.get(t)]):(this.variableStateObservers.set(t,[]),n.push(t)),this.variableStateObservers.get(t).push(e)}),(n=Object(u.uniq)(n))&&n.length>0&&(this.variableStatesToBeOpened||(this.variableStatesToBeOpened=[],setTimeout(()=>{this.remoteVariableProtocol.subscribeVariableStates(this.variableStatesToBeOpened),delete this.variableStatesToBeOpened})),this.variableStatesToBeOpened.push(...n)),()=>{const n=[];Object(u.each)(t,t=>{const i=this.variableStateObservers.get(t);i&&(Object(u.remove)(i,t=>t===e),i.length<=0&&(this.variableStateObservers.delete(t),n.push(t)))}),n.length&&(this.variableStatesToBeClosed||(this.variableStatesToBeClosed=[],setTimeout(()=>{this.remoteVariableProtocol.unsubscribeVariableStates(this.variableStatesToBeClosed),delete this.variableStatesToBeClosed})),this.variableStatesToBeClosed.push(...n))}})}subscribeVariableState(t){return this.subscribeVariableStates([t]).pipe(Object(h.map)(t=>t[0]))}openVariables(t,e=""){return new S.a(n=>{let i=[];return Object(u.each)(t,t=>{t&&(this.observers.has(t)?this.variableValueCache.has(t)&&n.next([this.variableValueCache.get(t)]):(this.observers.set(t,[]),i.push(t)),this.observers.get(t).push(n),this.appIdVariablesMap.get(e)?-1===this.appIdVariablesMap.get(e).indexOf(t)&&this.appIdVariablesMap.get(e).push(t):this.appIdVariablesMap.set(e,[]))}),(i=Object(u.uniq)(i))&&i.length>0&&(this.variablesToBeOpened||(this.variablesToBeOpened=[],setTimeout(()=>{this.remoteVariableProtocol.tryOpenVariables(this.variablesToBeOpened,e),delete this.variablesToBeOpened})),this.variablesToBeOpened.push(...i)),()=>{const i=[];Object(u.each)(t,t=>{const e=this.observers.get(t);e&&(Object(u.remove)(e,t=>t===n),e.length<=0&&(this.observers.delete(t),i.push(t)))}),i.length&&(this.variablesToBeClosed||(this.variablesToBeClosed=[],setTimeout(()=>{this.remoteVariableProtocol.tryStopVariables(this.variablesToBeClosed,e),delete this.variablesToBeClosed})),this.variablesToBeClosed.push(...i))}})}openVariable(t,e=""){if(t)return this.openVariables([t],e).pipe(Object(h.map)(t=>t[0]))}write(t,e){if(t)return this.remoteVariableProtocol.writeVariable(t,e),new S.a(t=>{})}writeWordByBit(t,e,n){if(t)return this.remoteVariableProtocol.writeVariableWordByBit(t,e,n),new S.a(t=>{})}subscribeUserDeviceAlarms(t=""){return new S.a(e=>(this.alarmObservers.push(e),this.remoteVariableProtocol.subscribeVirtualDeviceAlarms(t),()=>{this.remoteVariableProtocol.unsubscribeVirtualDeviceAlarms(t)}))}dispose(){this.connectedSubscription.unsubscribe(),this.variableStatesChangedSubscription.unsubscribe(),this.variableValuesChangedSubscription.unsubscribe(),this.alarmChangedSubscription.unsubscribe(),this.logger&&this.logger.isDebugEnabled()&&this.logger.debug("[VariableCommunicator] RemoteVariableCommunicator disposed.")}}var D=n(74);n.d(e,"a",function(){return i.GetReleasedGraphStateResult}),n.d(e,"e",function(){return r.GraphStateResult}),n.d(e,"b",function(){return a.GetReleasedGraphStates}),n.d(e,"d",function(){return o.GraphStateKey}),n.d(e,"c",function(){return s.GraphState}),n.d(e,"f",function(){return l.RemoteGraphProtocol}),n.d(e,"g",function(){return p}),n.d(e,"l",function(){return g.RemoteViewProtocol}),n.d(e,"m",function(){return _}),n.d(e,"n",function(){return y.ViewResult}),n.d(e,"h",function(){return b.RemoteImageProtocol}),n.d(e,"i",function(){return L}),n.d(e,"j",function(){return Y}),n.d(e,"k",function(){return D.RemoteVariableProtocol})},function(t,e,n){"use strict";var i,r=n(237);!function(t){t[t.Bit=0]="Bit",t[t.Word=1]="Word"}(i||(i={}));var a,o,s=n(236);!function(t){t[t.On=0]="On",t[t.Off=1]="Off",t[t.Inverse=2]="Inverse",t[t.Restoration=3]="Restoration"}(a||(a={})),function(t){t[t.Add=0]="Add",t[t.Subtract=1]="Subtract",t[t.SetConstant=2]="SetConstant"}(o||(o={}));var l,u=n(235),c=n(234);!function(t){t[t.Bit=0]="Bit",t[t.Word=1]="Word"}(l||(l={}));var d,h=n(233),f=n(232),m=n(231),p=n(230);!function(t){t[t.Nothing=0]="Nothing",t[t.Image=1]="Image",t[t.Label=2]="Label"}(d||(d={}));var g=n(229);n.d(e,"k",function(){return r.SwtichSettings}),n.d(e,"j",function(){return i}),n.d(e,"c",function(){return s.BitSwitchSettings}),n.d(e,"b",function(){return a}),n.d(e,"m",function(){return o}),n.d(e,"n",function(){return u.WordSwitchSettings}),n.d(e,"f",function(){return c.IndicatorLightSettings}),n.d(e,"g",function(){return l}),n.d(e,"a",function(){return h.BitIndicatorLightSettings}),n.d(e,"l",function(){return f.WordIndicatorLightSettings}),n.d(e,"i",function(){return m.SwitchIndicatorState}),n.d(e,"h",function(){return p.SwitchIndicatorLight}),n.d(e,"e",function(){return d}),n.d(e,"d",function(){return g.FaultFlicker})},function(t,e,n){"use strict";var i;!function(t){t[t.Equal=0]="Equal",t[t.NotEqual=1]="NotEqual",t[t.GreaterThan=2]="GreaterThan",t[t.LessThan=3]="LessThan",t[t.GreaterOrEqual=4]="GreaterOrEqual",t[t.LessOrEqual=5]="LessOrEqual"}(i||(i={}));var r,a=n(254);!function(t){t[t.Off=0]="Off",t[t.On=1]="On"}(r||(r={}));var o=n(253);class s{static isSatisfied(t,e,n){switch(+t){case i.Equal:return n===e;case i.GreaterOrEqual:return n>=e;case i.GreaterThan:return n>e;case i.LessOrEqual:return n<=e;case i.LessThan:return n<e;case i.NotEqual:return n!==e;default:throw new Error(`Unknown RelationalOperator:${t}.`)}}}var l=n(0),u=n(2),c=n(33),d=n(8),h=n(10);class f{constructor(t,e){this.condition=t,this.variableStore=e,this.conditionEffectiveChanged=new l.EventEmitter}get variableName(){const t=new h.a(this.condition.variableName,this.condition.variableGroupName,this.condition.dataSourceCode,this.condition.variableVersion);return d.a.getConvertedVariableName(this.variableStore,t)}}var m=n(4);class p{constructor(t,e){this.state=t,this.value=e,this.state=t,this.value=e}}var g=n(32);class v extends f{constructor(t,e,n){super(t,n),this.bitConditon=t,this.variableCommunicator=e}requestData(t){if(!this.bitConditon)throw new Error("BitConditionModel cannot be null.");this.variableName&&this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===m.d.Normal?this.requestconditionEffectiveValue(this.variableCommunicator,t):this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,e.state),!1))})}requestconditionEffectiveValue(t,e=""){t.openVariable(this.variableName,e).subscribe(t=>{if(this.bitConditon.isBitwiseIndex){const e=31;this.binary=new g.a(t.value,e+1),this.currentValue=new m.e(t.variableName,t.state,this.binary.convertToBinary().substr(e-this.bitConditon.bitIndex,1))}else this.currentValue=t;this.isConditionEffective=this.getIsConditionEffective(),this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,t.state),this.isConditionEffective))})}getIsConditionEffective(){switch(this.bitConditon.bitConditionLogic){case r.On:return this.currentValue.state===m.d.DataNormal&&1==this.currentValue.value;case r.Off:return this.currentValue.state===m.d.DataNormal&&0==this.currentValue.value;default:throw new Error(`Unknown BitConditonLogic : ${this.bitConditon.bitConditionLogic}.`)}}}class _{constructor(t,e,n){this.key=t,this.relationType=e,this.result=n}}var y=n(15),b=n(22);class M extends f{constructor(t,e,n){super(t,n),this.wordCondition=t,this.variableCommunicator=e}get baseVariable(){const t=this.wordCondition.baseVariableValue;if(!t||!t.variableName)return;const e=new h.a(t.variableName,t.variableGroupName,t.dataSourceCode,t.variableVersion);return d.a.getConvertedVariableName(this.variableStore,e)}get realtionVariable(){const t=this.wordCondition.realtionVariableValue;if(!t||!t.variableName)return;const e=new h.a(t.variableName,t.variableGroupName,t.dataSourceCode,t.variableVersion);return d.a.getConvertedVariableName(this.variableStore,e)}requestData(t){if(!this.wordCondition)throw new Error("WordConditionModel cannot be null.");if(!this.wordCondition.baseVariableValue)throw new Error("WordConditionModel.baseVariableValue cannot be null.");if(this.wordCondition.baseVariableValue.valueType==y.a.Constant?this.baseVariableValue=new m.e(void 0,m.d.DataNormal,this.wordCondition.baseVariableValue.constValue):this.variableName&&this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===m.d.Normal?this.requestconditionEffectiveBaseValue(this.variableCommunicator,t):this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,e.state),!1))}),0!=+this.wordCondition.relationType){if(!this.wordCondition.baseVariableValue)throw new Error("WordConditionModel.realtionVariableValue cannot be null.");this.wordCondition.realtionVariableValue.valueType==y.a.Constant?this.realtionVariableValue=new m.e(void 0,m.d.DataNormal,this.wordCondition.realtionVariableValue.constValue):this.variableName?this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===m.d.Normal?this.requestconditionEffectiveRealtionValue(this.variableCommunicator,t):this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,e.state),!1))}):this.requestconditionEffectiveRealtionValue(this.variableCommunicator,t)}this.variableName&&this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===m.d.Normal?this.requestconditionEffectiveValue(this.variableCommunicator,t):this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,e.state),!1))})}requestconditionEffectiveValue(t,e=""){t.openVariable(this.variableName,e).subscribe(t=>{this.currentValue=t,this.isConditionEffective=this.getIsConditionEffective(),this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,t.state),this.isConditionEffective))})}requestconditionEffectiveBaseValue(t,e=""){t.openVariable(this.baseVariable,e).subscribe(t=>{this.baseVariableValue=t,this.isConditionEffective=this.getIsConditionEffective(),this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,t.state),this.isConditionEffective))})}requestconditionEffectiveRealtionValue(t,e=""){t.openVariable(this.realtionVariable,e).subscribe(t=>{this.realtionVariableValue=t,this.isConditionEffective=this.getIsConditionEffective(),this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,t.state),this.isConditionEffective))})}getIsConditionEffective(){return this.wordCondition.relationType==b.a.None?this.comparator(this.baseVariableValue,this.wordCondition.baseVariableValue.operator):this.wordCondition.relationType==b.a.And?this.comparator(this.baseVariableValue,this.wordCondition.baseVariableValue.operator)&&this.comparator(this.realtionVariableValue,this.wordCondition.realtionVariableValue.operator):this.wordCondition.relationType==b.a.Or?this.comparator(this.baseVariableValue,this.wordCondition.baseVariableValue.operator)||this.comparator(this.realtionVariableValue,this.wordCondition.realtionVariableValue.operator):void 0}comparator(t,e){return null!=t&&(null!=this.currentValue&&(t.state===m.d.DataNormal&&this.currentValue.state===m.d.DataNormal&&(e==i.Equal?+this.currentValue.value==+t.value:e==i.GreaterOrEqual?+this.currentValue.value>+t.value||+this.currentValue.value==+t.value:e==i.GreaterThan?+this.currentValue.value>+t.value:e==i.LessOrEqual?+this.currentValue.value<+t.value||+this.currentValue.value==+t.value:e==i.LessThan?+this.currentValue.value<+t.value:e==i.NotEqual?+this.currentValue.value!=+t.value:void 0)))}}class x{constructor(t,e,n){this.sourceConditionItems=t,this.variableCommunicator=e,this.variableStore=n,this.conditionResultChanged=new l.EventEmitter,this.conditionResults=new Map}requestData(t){if(null==this.sourceConditionItems||!this.sourceConditionItems.length)return;const e=this.sourceConditionItems.sort(t=>t.index);e.forEach(n=>{switch(n.conditionType){case c.a.Bit:const i=new v(n.condition,this.variableCommunicator,this.variableStore);i.conditionEffectiveChanged.subscribe(t=>{this.conditionResults.has(e.indexOf(n))&&this.conditionResults.delete(e.indexOf(n)),this.conditionResults.set(e.indexOf(n),new _(e.indexOf(n),n.relationType,t)),this.emitConditionResult()}),i.requestData(t);break;case c.a.Word:const r=new M(n.condition,this.variableCommunicator,this.variableStore);r.conditionEffectiveChanged.subscribe(t=>{this.conditionResults.has(e.indexOf(n))&&this.conditionResults.delete(e.indexOf(n)),this.conditionResults.set(e.indexOf(n),new _(e.indexOf(n),n.relationType,t)),this.emitConditionResult()}),r.requestData(t);break;default:throw new Error(`Unknown ConditionType :${n.conditionType}`)}})}emitConditionResult(){let t=!0;const e=[],n=[];this.conditionResults.forEach(i=>{n.push({key:i.key,result:i}),i.relationType==b.a.None&&(t=i.result.value,e.push(i.result.state))}),Object(u.sortBy)(n,t=>t.key).forEach(n=>{const i=n.result;i.relationType==b.a.Or?(t=t||i.result.value,e.push(i.result.state)):i.relationType==b.a.And&&(t=t&&i.result.value,e.push(i.result.state))});const i={states:e,value:t};this.conditionResultChanged.emit(i)}}var w=n(245),k=n(244),L=n(243),S=n(242);class T{constructor(t,e){this.width=t||0,this.height=e||0}isReal(){return isFinite(this.width)&&isFinite(this.height)}toString(){return`Size(${this.width} ${this.height})`}}var Y,D=n(241),C=n(240),E=n(239);!function(t){t[t.Normal=0]="Normal",t[t.Offline=1]="Offline",t[t.Unbind=2]="Unbind",t[t.Abnormal=3]="Abnormal",t[t.Loading=4]="Loading",t[t.Disable=9]="Disable"}(Y||(Y={}));var A=n(238);n.d(e,"l",function(){return i}),n.d(e,"b",function(){return a.BitCondition}),n.d(e,"c",function(){return r}),n.d(e,"p",function(){return o.WordCondition}),n.d(e,"e",function(){return s}),n.d(e,"g",function(){return x}),n.d(e,"f",function(){return w.ConditionItemModel}),n.d(e,"d",function(){return k.ConditionControlResultValue}),n.d(e,"i",function(){return L.Font}),n.d(e,"o",function(){return S.Text}),n.d(e,"m",function(){return T}),n.d(e,"k",function(){return D.Point}),n.d(e,"j",function(){return C.GraphSetting}),n.d(e,"h",function(){return E.CustomStyle}),n.d(e,"n",function(){return Y}),n.d(e,"a",function(){return A.ArcModel})},function(t,e,n){"use strict";var i=n(17),r=n(0),a=n(266),o=function(){function t(t,e){this.open=t,this.close=e||t}return t.prototype.isManual=function(){return"manual"===this.open||"manual"===this.close},t}();var s={hover:["mouseover","mouseout"],focus:["focusin","focusout"]};function l(t,e){void 0===e&&(e=s);var n=(t||"").trim();if(0===n.length)return[];var i=n.split(/\s+/).map(function(t){return t.split(":")}).map(function(t){var n=e[t[0]]||t;return new o(n[0],n[1])}),r=i.filter(function(t){return t.isManual()});if(r.length>1)throw new Error("Triggers parse error: only one manual trigger is allowed");if(1===r.length&&i.length>1)throw new Error("Triggers parse error: manual trigger can't be mixed with other triggers");return i}
|
|
24
|
+
var i=function(t,e){return(i=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(t,e){t.__proto__=e}||function(t,e){for(var n in e)e.hasOwnProperty(n)&&(t[n]=e[n])})(t,e)};function r(t,e){function n(){this.constructor=t}i(t,e),t.prototype=null===e?Object.create(e):(n.prototype=e.prototype,new n)}},function(t,e,n){"use strict";var i,r=n(252);class a{constructor(t,e){this.graphType=t,this.source=e}}class o{constructor(t,e){this.graph=t,this.failed=e}static failed(){return o.failedResult}static success(t){return new o(t)}}o.failedResult=new o(null,!0),function(t){t[t.SVG=0]="SVG",t[t.Image=1]="Image"}(i||(i={}));var s=n(251),l=n(250),u=n(30),c=n(249),d=n(248);class h{constructor(t,e,n){this.error=t,this.isUnbind=e,this.values=n}}class f{constructor(t,e){this.time=t,this.values=e}}class m{constructor(t,e,n,i,r,a,o){this.dataSourceCode=t,this.dataItemName=e,this.channelNames=n,this.startTime=i,this.endTime=r,this.limit=a,this.rangeType=o}}var p=n(247);class g{constructor(t,e,n){this.name=t,this.groupName=e,this.code=n}}var v=n(246);class _{constructor(t,e,n,i,r){this.alarmNames=t,this.triggeredStartTime=e,this.triggeredEndTime=n,this.maxResultCount=i,this.skipCount=r}}n.d(e,"b",function(){return r.ConfigStore}),n.d(e,"f",function(){return a}),n.d(e,"g",function(){return o}),n.d(e,"i",function(){return i}),n.d(e,"h",function(){return s.GraphStore}),n.d(e,"p",function(){return l.ViewStore}),n.d(e,"o",function(){return u.a}),n.d(e,"m",function(){return c.ImageStore}),n.d(e,"k",function(){return d.HistoryDataStore}),n.d(e,"j",function(){return h}),n.d(e,"l",function(){return f}),n.d(e,"d",function(){return m}),n.d(e,"n",function(){return p.VariableStore}),n.d(e,"e",function(){return g}),n.d(e,"a",function(){return v.AlarmsStore}),n.d(e,"c",function(){return _})},function(t,e,n){"use strict";var i=n(28);var r=n(52),a=n(53);var o=n(40),s=n(270);function l(t){return 0===t.length?s.a:1===t.length?t[0]:function(e){return t.reduce(function(t,e){return e(t)},e)}}var u=n(23);n.d(e,"a",function(){return c});var c=function(){function t(t){this._isScalar=!1,t&&(this._subscribe=t)}return t.prototype.lift=function(e){var n=new t;return n.source=this,n.operator=e,n},t.prototype.subscribe=function(t,e,n){var o=this.operator,s=function(t,e,n){if(t){if(t instanceof i.a)return t;if(t[r.a])return t[r.a]()}return t||e||n?new i.a(t,e,n):new i.a(a.a)}(t,e,n);if(o?s.add(o.call(s,this.source)):s.add(this.source||u.a.useDeprecatedSynchronousErrorHandling&&!s.syncErrorThrowable?this._subscribe(s):this._trySubscribe(s)),u.a.useDeprecatedSynchronousErrorHandling&&s.syncErrorThrowable&&(s.syncErrorThrowable=!1,s.syncErrorThrown))throw s.syncErrorValue;return s},t.prototype._trySubscribe=function(t){try{return this._subscribe(t)}catch(e){u.a.useDeprecatedSynchronousErrorHandling&&(t.syncErrorThrown=!0,t.syncErrorValue=e),!function(t){for(;t;){var e=t,n=e.closed,r=e.destination,a=e.isStopped;if(n||a)return!1;t=r&&r instanceof i.a?r:null}return!0}(t)?console.warn(e):t.error(e)}},t.prototype.forEach=function(t,e){var n=this;return new(e=d(e))(function(e,i){var r;r=n.subscribe(function(e){try{t(e)}catch(t){i(t),r&&r.unsubscribe()}},i,e)})},t.prototype._subscribe=function(t){var e=this.source;return e&&e.subscribe(t)},t.prototype[o.a]=function(){return this},t.prototype.pipe=function(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];return 0===t.length?this:l(t)(this)},t.prototype.toPromise=function(t){var e=this;return new(t=d(t))(function(t,n){var i;e.subscribe(function(t){return i=t},function(t){return n(t)},function(){return t(i)})})},t.create=function(e){return new t(e)},t}();function d(t){if(t||(t=u.a.Promise||Promise),!t)throw new Error("no Promise impl found");return t}},function(t,e,n){"use strict";var i,r;!function(t){t[t.Uniform=0]="Uniform",t[t.HorizontalUniform=1]="HorizontalUniform"}(i||(i={})),function(t){t[t.Web=0]="Web",t[t.Mobile=1]="Mobile"}(r||(r={}));var a=n(48);n.d(e,"c",function(){return i}),n.d(e,"a",function(){return r}),n.d(e,"b",function(){return a.a})},function(t,e,n){"use strict";var i;n.d(e,"a",function(){return i}),function(t){t[t.Constant=0]="Constant",t[t.Variable=1]="Variable"}(i||(i={}))},function(t,n){t.exports=e},function(t,e){t.exports=n},function(t,e,n){"use strict";n.d(e,"b",function(){return r}),n.d(e,"a",function(){return a});var i=n(0);const r=new i.InjectionToken("fc.gui.loc"),a={loadFailed:"Load failed.",setting:"Setting",submit:"Submit",submitting:"Submitting···",numericalValueRequired:"Numerical value can't be emtpy",invalidNumericalValue:"Numerical value is not valid",writeValueTimeout:"write value error: timeout",binaryType:"Binary",decimalType:"Decimal",hexadecimalType:"Hexadecimal",stringType:"String",numericalValueTooLong:"Numerical value too long",fractionDigitsMustLessThan:"Fraction digits must be less than ",canNotBeNegative:"Can not be negative",valueOutOfRange:"Numerical value is out of range",timeout:"timeout",confirmOperationPrompt:"Sure to do this operation?",confirm:"Yes",cancel:"Cancel",characterInputRequired:"Character input can't be empty",character:"(Character)",characterOutofRange:"Character length is out of range",writeValueRange:"Write value range",loading:"Loading",unbind:"Unbind",offline:"Offline",abnormal:"Data abnormal",disable:"Disable",permissiontip:"You have no permission to operate.",conditionIsNotMetTip:"Unsatisfied operating conditions or variable abnorma.",chartNoData:"No Data Available",lastThirtyMinutes:"Last thirty minutes",lastOneHour:"Last one hour",lastEightHour:"Last eight hours",lastTwentyFourHours:"Last 24 hours",lastSevenDays:"Last 7 days",lastThirtyDays:"Last 30 days",lastOneYear:"Last 1 year",grouped:"Grouped",stacked:"Stacked",passwordVerify:"Password verifiers",passwordError:"Password error",password:"Password",passwordToolTip:"Password error, please re-enter",passwordRequired:"Password can't be empty",invalidVideoAddress:"Invalid video address",unconfiguredVideoAddress:"Unconfigured Video Address",weatherNotSupport:"Location not supported",weatherNotAddress:"Address not configured",weatherNotAvailable:"Address not yet available",airQualityNotSupport:"Location not supported",airQualityNotAddress:"Address not configured",airQualityNotAvailable:"Address not yet available"}},function(t,e,n){"use strict";n.d(e,"a",function(){return l});var i=n(0),r=n(39),a=n(2),o=n(9),s=function(t,e){return function(n,i){e(n,i,t)}};let l=class{constructor(t){this.localization=t,this._onClosed=new r.a,this.passwordError=!1}get onClosed(){return this._onClosed}ngOnInit(){this.validate()}validate(){Object(a.isNil)(this.password)||""===this.password.trim()?(this.passwordError=!0,this.validationErrorText=this.localization.passwordRequired):(this.passwordError=!1,this.validationErrorText="")}checkSecurity(){this.securityChecker.isValid(this.password).then(t=>{t?this.close(!0):(this.passwordError=!0,this.validationErrorText=this.localization.passwordToolTip)}).catch(()=>{throw new Error("Failure of the checkSecurity")})}close(t){this._onClosed.next(t),this._onClosed.complete()}};l=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Component)({selector:"verify-password",template:'<form #verifyPasswordForm="ngForm" novalidate (ngSubmit)="checkSecurity()" bs-modal-drag> <div class="modal-header"> <h4 class="modal-title"> <span>{{localization.passwordVerify}}</span> </h4> <button type="button" class="close pull-right" aria-label="Close" (click)="close()"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <span class="password-span">{{localization.password}}: </span> <input type="password" name="password" autoFocus class="form-control element-password" [(ngModel)]="password" (keyup)="validate()" autocomplete="off"> <span class="help-block text-danger" [hidden]="!passwordError">{{validationErrorText}}</span> </div> <div class="modal-footer"> <button type="button" class="btn md-skip btn-cancel" (click)="close()">{{localization.cancel}} </button> <button type="submit" class="btn md-skip btn-primary" [disabled]="passwordError">{{localization.submit}}</button> </div> </form> ',styles:[".modal-header { padding: 10px; border-color: transparent; } .modal-body { position: relative; padding: 0px 5px !important; padding-top: 10px !important; } .modal-title { display: unset; margin-left: -6px; font-size: 16px !important; } .form-control { margin: 0 5%; float: none; width: 90%; } .modal-footer { padding: 10px 4px 20px 5px !important; text-align: right; border-color: transparent; color: #fff; } .text-danger { display: block; color: #ed6b75; font-size: 14px; margin: 5px 0px 0px 15px; } .btn-primary { color: #fff; height: 32px; margin-right: 10px; line-height: 0px } .password-span { color: #7f939e; font-size: 14px; margin-left: 15px; } .btn-cancel { color: #fff; height: 32px; min-width: 71px; margin-right: 6px; background-color: #dddddd; line-height: 0px } .element-password { padding-left: 8px; height: 32px; min-width: 71px; margin-left: 16px; } "]}),s(0,Object(i.Inject)(o.b))],l)},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var i=n(0),r=n(39),a=n(18),o=function(t,e){return function(n,i){e(n,i,t)}};let s=class{constructor(t){this.localization=t,this._onClosed=new r.a}get onClosed(){return this._onClosed}close(t){this._onClosed.next(t),this._onClosed.complete()}confirm(){this.close(!0)}};s=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Component)({selector:"confirmOperationModal",template:'<form novalidate (ngSubmit)="confirm()" bs-modal-drag> <div class="modal-body"> <div style="text-align:center;margin-top:20px;"> <div class="alertIcon"></div> <h3 class="confirm-h3">{{localization.confirmOperationPrompt}}</h3> </div> </div> <div class="modal-footer form-group confirm-btn-group"> <button type="button" class="sweet-alert-btn" (click)="close()"> {{localization.cancel}} </button> <button type="submit" class="sweet-alert-btn"> {{localization.confirm}} </button> </div> </form> ',styles:[".modal-body { padding: 17px; position: relative; text-align: center; } .modal-footer { padding: 10px 5px; text-align: center; border-color: transparent; } .confirm-modal { max-width: 478px; } .confirm-modal>.modal-content { padding: 17px; } h3.confirm-h3 { font-size: 20px; font-weight: bold; } .confirm-btn-group { padding: 0; margin-bottom: 28px; margin-right: 50px; } .confirm-btn-group button { display: inline-block; } .confirm-btn-group button:last-child { background-color: rgb(221, 107, 85); box-shadow: rgba(221, 107, 85, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.05) 0px 0px 0px 1px; } .alertIcon { background: url(assets/img/alert.svg); width: 88px; height: 88px; display: inline-block; } .sweet-alert-btn { color: #fff; border: none; background: #ddd; font-size: 17px; font-weight: 500; border-radius: 5px; padding: 10px 32px; margin: 26px 5px 0; cursor: pointer } "]}),o(0,Object(i.Inject)(a.b))],s)},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var i=n(0),r=n(18),a=n(267),o=function(t,e){return function(n,i){e(n,i,t)}};let s=class{constructor(t){this.localization=t,this._onClosed=new a.Subject}get onClosed(){return this._onClosed}close(){this._onClosed.next(),this._onClosed.complete()}};s=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Component)({selector:"alertModal",template:'<div class="modal-body"> <div style="text-align:center"> <div class="alertIcon"></div> <h3 class="alert-h3">{{alermMessage}}</h3> </div> </div> <div class="modal-footer form-group confirm-btn"> <button type="button" class="sweet-alert-btn" (click)="close()"> {{localization.confirm}} </button> </div> ',styles:[".modal-header { padding: 17px; border-color: transparent; } .modal-body { padding: 17px; position: relative; text-align: center; } .modal-footer { padding: 10px 5px; text-align: center; border-color: transparent; } .alert-modal { max-width: 478px; } .alert-modal>.modal-content { padding: 17px; } h3.alert-h3 { font-size: 20px; font-weight: bold; } .alert-btn { padding: 0; margin-bottom: 0; } .alert-btn button { display: inline-block; } .alertIcon { background: url(assets/img/alert.svg); width: 88px; height: 88px; display: inline-block; } .sweet-alert-btn { color: #fff; border: none; background: #ddd; font-size: 17px; font-weight: 500; border-radius: 5px; padding: 10px 32px; margin: 26px 5px 0; cursor: point; background-color: rgb(221, 107, 85); box-shadow: rgba(221, 107, 85, 0.8) 0px 0px 2px, rgba(0, 0, 0, 0.05) 0px 0px 0px 1px; } "]}),o(0,Object(i.Inject)(r.b))],s)},function(t,e,n){"use strict";var i;n.d(e,"a",function(){return i}),function(t){t[t.None=0]="None",t[t.And=1]="And",t[t.Or=2]="Or"}(i||(i={}))},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var i=!1,r={Promise:void 0,set useDeprecatedSynchronousErrorHandling(t){t&&(new Error).stack;i=t},get useDeprecatedSynchronousErrorHandling(){return i}}},function(t,e,n){"use strict";var i=n(55),r=n(271),a=n(51),o=function(){function t(t){return Error.call(this),this.message=t?t.length+" errors occurred during unsubscription:\n"+t.map(function(t,e){return e+1+") "+t.toString()}).join("\n "):"",this.name="UnsubscriptionError",this.errors=t,this}return t.prototype=Object.create(Error.prototype),t}();n.d(e,"a",function(){return s});var s=function(){function t(t){this.closed=!1,this._parentOrParents=null,this._subscriptions=null,t&&(this._unsubscribe=t)}return t.prototype.unsubscribe=function(){var e;if(!this.closed){var n=this._parentOrParents,s=this._unsubscribe,u=this._subscriptions;if(this.closed=!0,this._parentOrParents=null,this._subscriptions=null,n instanceof t)n.remove(this);else if(null!==n)for(var c=0;c<n.length;++c){n[c].remove(this)}if(Object(a.a)(s))try{s.call(this)}catch(t){e=t instanceof o?l(t.errors):[t]}if(Object(i.a)(u)){c=-1;for(var d=u.length;++c<d;){var h=u[c];if(Object(r.a)(h))try{h.unsubscribe()}catch(t){e=e||[],t instanceof o?e=e.concat(l(t.errors)):e.push(t)}}}if(e)throw new o(e)}},t.prototype.add=function(e){var n=e;if(!e)return t.EMPTY;switch(typeof e){case"function":n=new t(e);case"object":if(n===this||n.closed||"function"!=typeof n.unsubscribe)return n;if(this.closed)return n.unsubscribe(),n;if(!(n instanceof t)){var i=n;(n=new t)._subscriptions=[i]}break;default:throw new Error("unrecognized teardown "+e+" added to Subscription.")}var r=n._parentOrParents;if(null===r)n._parentOrParents=this;else if(r instanceof t){if(r===this)return n;n._parentOrParents=[r,this]}else{if(-1!==r.indexOf(this))return n;r.push(this)}var a=this._subscriptions;return null===a?this._subscriptions=[n]:a.push(n),n},t.prototype.remove=function(t){var e=this._subscriptions;if(e){var n=e.indexOf(t);-1!==n&&e.splice(n,1)}},t.EMPTY=function(t){return t.closed=!0,t}(new t),t}();function l(t){return t.reduce(function(t,e){return t.concat(e instanceof o?e.errors:e)},[])}},function(t,e,n){var i,r;!function(){var a={version:"3.5.12"},o=[].slice,s=function(t){return o.call(t)},l=this.document;function u(t){return t&&(t.ownerDocument||t.document||t).documentElement}function c(t){return t&&(t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView)}if(l)try{s(l.documentElement.childNodes)[0].nodeType}catch(t){s=function(t){for(var e=t.length,n=new Array(e);e--;)n[e]=t[e];return n}}if(Date.now||(Date.now=function(){return+new Date}),l)try{l.createElement("DIV").style.setProperty("opacity",0,"")}catch(t){var d=this.Element.prototype,h=d.setAttribute,f=d.setAttributeNS,m=this.CSSStyleDeclaration.prototype,p=m.setProperty;d.setAttribute=function(t,e){h.call(this,t,e+"")},d.setAttributeNS=function(t,e,n){f.call(this,t,e,n+"")},m.setProperty=function(t,e,n){p.call(this,t,e+"",n)}}function g(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}function v(t){return null===t?NaN:+t}function _(t){return!isNaN(t)}function y(t){return{left:function(e,n,i,r){for(arguments.length<3&&(i=0),arguments.length<4&&(r=e.length);i<r;){var a=i+r>>>1;t(e[a],n)<0?i=a+1:r=a}return i},right:function(e,n,i,r){for(arguments.length<3&&(i=0),arguments.length<4&&(r=e.length);i<r;){var a=i+r>>>1;t(e[a],n)>0?r=a:i=a+1}return i}}}a.ascending=g,a.descending=function(t,e){return e<t?-1:e>t?1:e>=t?0:NaN},a.min=function(t,e){var n,i,r=-1,a=t.length;if(1===arguments.length){for(;++r<a;)if(null!=(i=t[r])&&i>=i){n=i;break}for(;++r<a;)null!=(i=t[r])&&n>i&&(n=i)}else{for(;++r<a;)if(null!=(i=e.call(t,t[r],r))&&i>=i){n=i;break}for(;++r<a;)null!=(i=e.call(t,t[r],r))&&n>i&&(n=i)}return n},a.max=function(t,e){var n,i,r=-1,a=t.length;if(1===arguments.length){for(;++r<a;)if(null!=(i=t[r])&&i>=i){n=i;break}for(;++r<a;)null!=(i=t[r])&&i>n&&(n=i)}else{for(;++r<a;)if(null!=(i=e.call(t,t[r],r))&&i>=i){n=i;break}for(;++r<a;)null!=(i=e.call(t,t[r],r))&&i>n&&(n=i)}return n},a.extent=function(t,e){var n,i,r,a=-1,o=t.length;if(1===arguments.length){for(;++a<o;)if(null!=(i=t[a])&&i>=i){n=r=i;break}for(;++a<o;)null!=(i=t[a])&&(n>i&&(n=i),r<i&&(r=i))}else{for(;++a<o;)if(null!=(i=e.call(t,t[a],a))&&i>=i){n=r=i;break}for(;++a<o;)null!=(i=e.call(t,t[a],a))&&(n>i&&(n=i),r<i&&(r=i))}return[n,r]},a.sum=function(t,e){var n,i=0,r=t.length,a=-1;if(1===arguments.length)for(;++a<r;)_(n=+t[a])&&(i+=n);else for(;++a<r;)_(n=+e.call(t,t[a],a))&&(i+=n);return i},a.mean=function(t,e){var n,i=0,r=t.length,a=-1,o=r;if(1===arguments.length)for(;++a<r;)_(n=v(t[a]))?i+=n:--o;else for(;++a<r;)_(n=v(e.call(t,t[a],a)))?i+=n:--o;if(o)return i/o},a.quantile=function(t,e){var n=(t.length-1)*e+1,i=Math.floor(n),r=+t[i-1],a=n-i;return a?r+a*(t[i]-r):r},a.median=function(t,e){var n,i=[],r=t.length,o=-1;if(1===arguments.length)for(;++o<r;)_(n=v(t[o]))&&i.push(n);else for(;++o<r;)_(n=v(e.call(t,t[o],o)))&&i.push(n);if(i.length)return a.quantile(i.sort(g),.5)},a.variance=function(t,e){var n,i,r=t.length,a=0,o=0,s=-1,l=0;if(1===arguments.length)for(;++s<r;)_(n=v(t[s]))&&(o+=(i=n-a)*(n-(a+=i/++l)));else for(;++s<r;)_(n=v(e.call(t,t[s],s)))&&(o+=(i=n-a)*(n-(a+=i/++l)));if(l>1)return o/(l-1)},a.deviation=function(){var t=a.variance.apply(this,arguments);return t?Math.sqrt(t):t};var b=y(g);function M(t){return t.length}a.bisectLeft=b.left,a.bisect=a.bisectRight=b.right,a.bisector=function(t){return y(1===t.length?function(e,n){return g(t(e),n)}:t)},a.shuffle=function(t,e,n){(a=arguments.length)<3&&(n=t.length,a<2&&(e=0));for(var i,r,a=n-e;a;)r=Math.random()*a--|0,i=t[a+e],t[a+e]=t[r+e],t[r+e]=i;return t},a.permute=function(t,e){for(var n=e.length,i=new Array(n);n--;)i[n]=t[e[n]];return i},a.pairs=function(t){for(var e=0,n=t.length-1,i=t[0],r=new Array(n<0?0:n);e<n;)r[e]=[i,i=t[++e]];return r},a.zip=function(){if(!(i=arguments.length))return[];for(var t=-1,e=a.min(arguments,M),n=new Array(e);++t<e;)for(var i,r=-1,o=n[t]=new Array(i);++r<i;)o[r]=arguments[r][t];return n},a.transpose=function(t){return a.zip.apply(a,t)},a.keys=function(t){var e=[];for(var n in t)e.push(n);return e},a.values=function(t){var e=[];for(var n in t)e.push(t[n]);return e},a.entries=function(t){var e=[];for(var n in t)e.push({key:n,value:t[n]});return e},a.merge=function(t){for(var e,n,i,r=t.length,a=-1,o=0;++a<r;)o+=t[a].length;for(n=new Array(o);--r>=0;)for(e=(i=t[r]).length;--e>=0;)n[--o]=i[e];return n};var x=Math.abs;function w(t,e){for(var n in e)Object.defineProperty(t.prototype,n,{value:e[n],enumerable:!1})}function k(){this._=Object.create(null)}a.range=function(t,e,n){if(arguments.length<3&&(n=1,arguments.length<2&&(e=t,t=0)),(e-t)/n==1/0)throw new Error("infinite range");var i,r=[],a=function(t){var e=1;for(;t*e%1;)e*=10;return e}(x(n)),o=-1;if(t*=a,e*=a,(n*=a)<0)for(;(i=t+n*++o)>e;)r.push(i/a);else for(;(i=t+n*++o)<e;)r.push(i/a);return r},a.map=function(t,e){var n=new k;if(t instanceof k)t.forEach(function(t,e){n.set(t,e)});else if(Array.isArray(t)){var i,r=-1,a=t.length;if(1===arguments.length)for(;++r<a;)n.set(r,t[r]);else for(;++r<a;)n.set(e.call(t,i=t[r],r),i)}else for(var o in t)n.set(o,t[o]);return n};var L="__proto__",S="\0";function T(t){return(t+="")===L||t[0]===S?S+t:t}function Y(t){return(t+="")[0]===S?t.slice(1):t}function D(t){return T(t)in this._}function C(t){return(t=T(t))in this._&&delete this._[t]}function E(){var t=[];for(var e in this._)t.push(Y(e));return t}function A(){var t=0;for(var e in this._)++t;return t}function O(){for(var t in this._)return!1;return!0}function j(){this._=Object.create(null)}function N(t){return t}function H(t,e,n){return function(){var i=n.apply(e,arguments);return i===e?t:i}}function V(t,e){if(e in t)return e;e=e.charAt(0).toUpperCase()+e.slice(1);for(var n=0,i=P.length;n<i;++n){var r=P[n]+e;if(r in t)return r}}w(k,{has:D,get:function(t){return this._[T(t)]},set:function(t,e){return this._[T(t)]=e},remove:C,keys:E,values:function(){var t=[];for(var e in this._)t.push(this._[e]);return t},entries:function(){var t=[];for(var e in this._)t.push({key:Y(e),value:this._[e]});return t},size:A,empty:O,forEach:function(t){for(var e in this._)t.call(this,Y(e),this._[e])}}),a.nest=function(){var t,e,n={},i=[],r=[];function o(r,a,s){if(s>=i.length)return e?e.call(n,a):t?a.sort(t):a;for(var l,u,c,d,h=-1,f=a.length,m=i[s++],p=new k;++h<f;)(d=p.get(l=m(u=a[h])))?d.push(u):p.set(l,[u]);return r?(u=r(),c=function(t,e){u.set(t,o(r,e,s))}):(u={},c=function(t,e){u[t]=o(r,e,s)}),p.forEach(c),u}return n.map=function(t,e){return o(e,t,0)},n.entries=function(t){return function t(e,n){if(n>=i.length)return e;var a=[],o=r[n++];return e.forEach(function(e,i){a.push({key:e,values:t(i,n)})}),o?a.sort(function(t,e){return o(t.key,e.key)}):a}(o(a.map,t,0),0)},n.key=function(t){return i.push(t),n},n.sortKeys=function(t){return r[i.length-1]=t,n},n.sortValues=function(e){return t=e,n},n.rollup=function(t){return e=t,n},n},a.set=function(t){var e=new j;if(t)for(var n=0,i=t.length;n<i;++n)e.add(t[n]);return e},w(j,{has:D,add:function(t){return this._[T(t+="")]=!0,t},remove:C,values:E,size:A,empty:O,forEach:function(t){for(var e in this._)t.call(this,Y(e))}}),a.behavior={},a.rebind=function(t,e){for(var n,i=1,r=arguments.length;++i<r;)t[n=arguments[i]]=H(t,e,e[n]);return t};var P=["webkit","ms","moz","Moz","o","O"];function F(){}function I(){}function R(t){var e=[],n=new k;function i(){for(var n,i=e,r=-1,a=i.length;++r<a;)(n=i[r].on)&&n.apply(this,arguments);return t}return i.on=function(i,r){var a,o=n.get(i);return arguments.length<2?o&&o.on:(o&&(o.on=null,e=e.slice(0,a=e.indexOf(o)).concat(e.slice(a+1)),n.remove(i)),r&&e.push(n.set(i,{on:r})),t)},i}function W(){a.event.preventDefault()}function z(){for(var t,e=a.event;t=e.sourceEvent;)e=t;return e}function B(t){for(var e=new I,n=0,i=arguments.length;++n<i;)e[arguments[n]]=R(e);return e.of=function(n,i){return function(r){try{var o=r.sourceEvent=a.event;r.target=t,a.event=r,e[r.type].apply(n,i)}finally{a.event=o}}},e}a.dispatch=function(){for(var t=new I,e=-1,n=arguments.length;++e<n;)t[arguments[e]]=R(t);return t},I.prototype.on=function(t,e){var n=t.indexOf("."),i="";if(n>=0&&(i=t.slice(n+1),t=t.slice(0,n)),t)return arguments.length<2?this[t].on(i):this[t].on(i,e);if(2===arguments.length){if(null==e)for(t in this)this.hasOwnProperty(t)&&this[t].on(i,null);return this}},a.event=null,a.requote=function(t){return t.replace(U,"\\$&")};var U=/[\\\^\$\*\+\?\|\[\]\(\)\.\{\}]/g,G={}.__proto__?function(t,e){t.__proto__=e}:function(t,e){for(var n in e)t[n]=e[n]};function $(t){return G(t,Z),t}var q=function(t,e){return e.querySelector(t)},J=function(t,e){return e.querySelectorAll(t)},X=function(t,e){var n=t.matches||t[V(t,"matchesSelector")];return(X=function(t,e){return n.call(t,e)})(t,e)};"function"==typeof Sizzle&&(q=function(t,e){return Sizzle(t,e)[0]||null},J=Sizzle,X=Sizzle.matchesSelector),a.selection=function(){return a.select(l.documentElement)};var Z=a.selection.prototype=[];function K(t){return"function"==typeof t?t:function(){return q(t,this)}}function Q(t){return"function"==typeof t?t:function(){return J(t,this)}}Z.select=function(t){var e,n,i,r,a=[];t=K(t);for(var o=-1,s=this.length;++o<s;){a.push(e=[]),e.parentNode=(i=this[o]).parentNode;for(var l=-1,u=i.length;++l<u;)(r=i[l])?(e.push(n=t.call(r,r.__data__,l,o)),n&&"__data__"in r&&(n.__data__=r.__data__)):e.push(null)}return $(a)},Z.selectAll=function(t){var e,n,i=[];t=Q(t);for(var r=-1,a=this.length;++r<a;)for(var o=this[r],l=-1,u=o.length;++l<u;)(n=o[l])&&(i.push(e=s(t.call(n,n.__data__,l,r))),e.parentNode=n);return $(i)};var tt={svg:"http://www.w3.org/2000/svg",xhtml:"http://www.w3.org/1999/xhtml",xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"};function et(t,e){return t=a.ns.qualify(t),null==e?t.local?function(){this.removeAttributeNS(t.space,t.local)}:function(){this.removeAttribute(t)}:"function"==typeof e?t.local?function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}:function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}:t.local?function(){this.setAttributeNS(t.space,t.local,e)}:function(){this.setAttribute(t,e)}}function nt(t){return t.trim().replace(/\s+/g," ")}function it(t){return new RegExp("(?:^|\\s+)"+a.requote(t)+"(?:\\s+|$)","g")}function rt(t){return(t+"").trim().split(/^|\s+/)}function at(t,e){var n=(t=rt(t).map(ot)).length;return"function"==typeof e?function(){for(var i=-1,r=e.apply(this,arguments);++i<n;)t[i](this,r)}:function(){for(var i=-1;++i<n;)t[i](this,e)}}function ot(t){var e=it(t);return function(n,i){if(r=n.classList)return i?r.add(t):r.remove(t);var r=n.getAttribute("class")||"";i?(e.lastIndex=0,e.test(r)||n.setAttribute("class",nt(r+" "+t))):n.setAttribute("class",nt(r.replace(e," ")))}}function st(t,e,n){return null==e?function(){this.style.removeProperty(t)}:"function"==typeof e?function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}:function(){this.style.setProperty(t,e,n)}}function lt(t,e){return null==e?function(){delete this[t]}:"function"==typeof e?function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}:function(){this[t]=e}}function ut(t){return"function"==typeof t?t:(t=a.ns.qualify(t)).local?function(){return this.ownerDocument.createElementNS(t.space,t.local)}:function(){var e=this.ownerDocument,n=this.namespaceURI;return n?e.createElementNS(n,t):e.createElement(t)}}function ct(){var t=this.parentNode;t&&t.removeChild(this)}function dt(t){return{__data__:t}}function ht(t){return function(){return X(this,t)}}function ft(t,e){for(var n=0,i=t.length;n<i;n++)for(var r,a=t[n],o=0,s=a.length;o<s;o++)(r=a[o])&&e(r,o,n);return t}function mt(t){return G(t,pt),t}a.ns={prefix:tt,qualify:function(t){var e=t.indexOf(":"),n=t;return e>=0&&"xmlns"!==(n=t.slice(0,e))&&(t=t.slice(e+1)),tt.hasOwnProperty(n)?{space:tt[n],local:t}:t}},Z.attr=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node();return(t=a.ns.qualify(t)).local?n.getAttributeNS(t.space,t.local):n.getAttribute(t)}for(e in t)this.each(et(e,t[e]));return this}return this.each(et(t,e))},Z.classed=function(t,e){if(arguments.length<2){if("string"==typeof t){var n=this.node(),i=(t=rt(t)).length,r=-1;if(e=n.classList){for(;++r<i;)if(!e.contains(t[r]))return!1}else for(e=n.getAttribute("class");++r<i;)if(!it(t[r]).test(e))return!1;return!0}for(e in t)this.each(at(e,t[e]));return this}return this.each(at(t,e))},Z.style=function(t,e,n){var i=arguments.length;if(i<3){if("string"!=typeof t){for(n in i<2&&(e=""),t)this.each(st(n,t[n],e));return this}if(i<2){var r=this.node();return c(r).getComputedStyle(r,null).getPropertyValue(t)}n=""}return this.each(st(t,e,n))},Z.property=function(t,e){if(arguments.length<2){if("string"==typeof t)return this.node()[t];for(e in t)this.each(lt(e,t[e]));return this}return this.each(lt(t,e))},Z.text=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}:null==t?function(){this.textContent=""}:function(){this.textContent=t}):this.node().textContent},Z.html=function(t){return arguments.length?this.each("function"==typeof t?function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}:null==t?function(){this.innerHTML=""}:function(){this.innerHTML=t}):this.node().innerHTML},Z.append=function(t){return t=ut(t),this.select(function(){return this.appendChild(t.apply(this,arguments))})},Z.insert=function(t,e){return t=ut(t),e=K(e),this.select(function(){return this.insertBefore(t.apply(this,arguments),e.apply(this,arguments)||null)})},Z.remove=function(){return this.each(ct)},Z.data=function(t,e){var n,i,r=-1,a=this.length;if(!arguments.length){for(t=new Array(a=(n=this[0]).length);++r<a;)(i=n[r])&&(t[r]=i.__data__);return t}function o(t,n){var i,r,a,o=t.length,c=n.length,d=Math.min(o,c),h=new Array(c),f=new Array(c),m=new Array(o);if(e){var p,g=new k,v=new Array(o);for(i=-1;++i<o;)(r=t[i])&&(g.has(p=e.call(r,r.__data__,i))?m[i]=r:g.set(p,r),v[i]=p);for(i=-1;++i<c;)(r=g.get(p=e.call(n,a=n[i],i)))?!0!==r&&(h[i]=r,r.__data__=a):f[i]=dt(a),g.set(p,!0);for(i=-1;++i<o;)i in v&&!0!==g.get(v[i])&&(m[i]=t[i])}else{for(i=-1;++i<d;)r=t[i],a=n[i],r?(r.__data__=a,h[i]=r):f[i]=dt(a);for(;i<c;++i)f[i]=dt(n[i]);for(;i<o;++i)m[i]=t[i]}f.update=h,f.parentNode=h.parentNode=m.parentNode=t.parentNode,s.push(f),l.push(h),u.push(m)}var s=mt([]),l=$([]),u=$([]);if("function"==typeof t)for(;++r<a;)o(n=this[r],t.call(n,n.parentNode.__data__,r));else for(;++r<a;)o(n=this[r],t);return l.enter=function(){return s},l.exit=function(){return u},l},Z.datum=function(t){return arguments.length?this.property("__data__",t):this.property("__data__")},Z.filter=function(t){var e,n,i,r=[];"function"!=typeof t&&(t=ht(t));for(var a=0,o=this.length;a<o;a++){r.push(e=[]),e.parentNode=(n=this[a]).parentNode;for(var s=0,l=n.length;s<l;s++)(i=n[s])&&t.call(i,i.__data__,s,a)&&e.push(i)}return $(r)},Z.order=function(){for(var t=-1,e=this.length;++t<e;)for(var n,i=this[t],r=i.length-1,a=i[r];--r>=0;)(n=i[r])&&(a&&a!==n.nextSibling&&a.parentNode.insertBefore(n,a),a=n);return this},Z.sort=function(t){t=function(t){arguments.length||(t=g);return function(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}}.apply(this,arguments);for(var e=-1,n=this.length;++e<n;)this[e].sort(t);return this.order()},Z.each=function(t){return ft(this,function(e,n,i){t.call(e,e.__data__,n,i)})},Z.call=function(t){var e=s(arguments);return t.apply(e[0]=this,e),this},Z.empty=function(){return!this.node()},Z.node=function(){for(var t=0,e=this.length;t<e;t++)for(var n=this[t],i=0,r=n.length;i<r;i++){var a=n[i];if(a)return a}return null},Z.size=function(){var t=0;return ft(this,function(){++t}),t};var pt=[];function gt(t,e,n){var i="__on"+t,r=t.indexOf("."),o=_t;r>0&&(t=t.slice(0,r));var l=vt.get(t);function u(){var e=this[i];e&&(this.removeEventListener(t,e,e.$),delete this[i])}return l&&(t=l,o=yt),r?e?function(){var r=o(e,s(arguments));u.call(this),this.addEventListener(t,this[i]=r,r.$=n),r._=e}:u:e?F:function(){var e,n=new RegExp("^__on([^.]+)"+a.requote(t)+"$");for(var i in this)if(e=i.match(n)){var r=this[i];this.removeEventListener(e[1],r,r.$),delete this[i]}}}a.selection.enter=mt,a.selection.enter.prototype=pt,pt.append=Z.append,pt.empty=Z.empty,pt.node=Z.node,pt.call=Z.call,pt.size=Z.size,pt.select=function(t){for(var e,n,i,r,a,o=[],s=-1,l=this.length;++s<l;){i=(r=this[s]).update,o.push(e=[]),e.parentNode=r.parentNode;for(var u=-1,c=r.length;++u<c;)(a=r[u])?(e.push(i[u]=n=t.call(r.parentNode,a.__data__,u,s)),n.__data__=a.__data__):e.push(null)}return $(o)},pt.insert=function(t,e){return arguments.length<2&&(e=function(t){var e,n;return function(i,r,a){var o,s=t[a].update,l=s.length;for(a!=n&&(n=a,e=0),r>=e&&(e=r+1);!(o=s[e])&&++e<l;);return o}}(this)),Z.insert.call(this,t,e)},a.select=function(t){var e;return"string"==typeof t?(e=[q(t,l)]).parentNode=l.documentElement:(e=[t]).parentNode=u(t),$([e])},a.selectAll=function(t){var e;return"string"==typeof t?(e=s(J(t,l))).parentNode=l.documentElement:(e=s(t)).parentNode=null,$([e])},Z.on=function(t,e,n){var i=arguments.length;if(i<3){if("string"!=typeof t){for(n in i<2&&(e=!1),t)this.each(gt(n,t[n],e));return this}if(i<2)return(i=this.node()["__on"+t])&&i._;n=!1}return this.each(gt(t,e,n))};var vt=a.map({mouseenter:"mouseover",mouseleave:"mouseout"});function _t(t,e){return function(n){var i=a.event;a.event=n,e[0]=this.__data__;try{t.apply(this,e)}finally{a.event=i}}}function yt(t,e){var n=_t(t,e);return function(t){var e=t.relatedTarget;e&&(e===this||8&e.compareDocumentPosition(this))||n.call(this,t)}}l&&vt.forEach(function(t){"on"+t in l&&vt.remove(t)});var bt,Mt=0;function xt(t){var e=".dragsuppress-"+ ++Mt,n="click"+e,i=a.select(c(t)).on("touchmove"+e,W).on("dragstart"+e,W).on("selectstart"+e,W);if(null==bt&&(bt=!("onselectstart"in t)&&V(t.style,"userSelect")),bt){var r=u(t).style,o=r[bt];r[bt]="none"}return function(t){if(i.on(e,null),bt&&(r[bt]=o),t){var a=function(){i.on(n,null)};i.on(n,function(){W(),a()},!0),setTimeout(a,0)}}}a.mouse=function(t){return kt(t,z())};var wt=this.navigator&&/WebKit/.test(this.navigator.userAgent)?-1:0;function kt(t,e){e.changedTouches&&(e=e.changedTouches[0]);var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();if(wt<0){var r=c(t);if(r.scrollX||r.scrollY){var o=(n=a.select("body").append("svg").style({position:"absolute",top:0,left:0,margin:0,padding:0,border:"none"},"important"))[0][0].getScreenCTM();wt=!(o.f||o.e),n.remove()}}return wt?(i.x=e.pageX,i.y=e.pageY):(i.x=e.clientX,i.y=e.clientY),[(i=i.matrixTransform(t.getScreenCTM().inverse())).x,i.y]}var s=t.getBoundingClientRect();return[e.clientX-s.left-t.clientLeft,e.clientY-s.top-t.clientTop]}function Lt(){return a.event.changedTouches[0].identifier}a.touch=function(t,e,n){if(arguments.length<3&&(n=e,e=z().changedTouches),e)for(var i,r=0,a=e.length;r<a;++r)if((i=e[r]).identifier===n)return kt(t,i)},a.behavior.drag=function(){var t=B(r,"drag","dragstart","dragend"),e=null,n=o(F,a.mouse,c,"mousemove","mouseup"),i=o(Lt,a.touch,N,"touchmove","touchend");function r(){this.on("mousedown.drag",n).on("touchstart.drag",i)}function o(n,i,r,o,s){return function(){var l,u=a.event.target,c=this.parentNode,d=t.of(this,arguments),h=0,f=n(),m=".drag"+(null==f?"":"-"+f),p=a.select(r(u)).on(o+m,function(){var t,e,n=i(c,f);if(!n)return;t=n[0]-v[0],e=n[1]-v[1],h|=t|e,v=n,d({type:"drag",x:n[0]+l[0],y:n[1]+l[1],dx:t,dy:e})}).on(s+m,function(){if(!i(c,f))return;p.on(o+m,null).on(s+m,null),g(h),d({type:"dragend"})}),g=xt(u),v=i(c,f);l=e?[(l=e.apply(this,arguments)).x-v[0],l.y-v[1]]:[0,0],d({type:"dragstart"})}}return r.origin=function(t){return arguments.length?(e=t,r):e},a.rebind(r,t,"on")},a.touches=function(t,e){return arguments.length<2&&(e=z().touches),e?s(e).map(function(e){var n=kt(t,e);return n.identifier=e.identifier,n}):[]};var St=1e-6,Tt=St*St,Yt=Math.PI,Dt=2*Yt,Ct=Dt-St,Et=Yt/2,At=Yt/180,Ot=180/Yt;function jt(t){return t>0?1:t<0?-1:0}function Nt(t,e,n){return(e[0]-t[0])*(n[1]-t[1])-(e[1]-t[1])*(n[0]-t[0])}function Ht(t){return t>1?0:t<-1?Yt:Math.acos(t)}function Vt(t){return t>1?Et:t<-1?-Et:Math.asin(t)}function Pt(t){return((t=Math.exp(t))+1/t)/2}function Ft(t){return(t=Math.sin(t/2))*t}var It=Math.SQRT2;a.interpolateZoom=function(t,e){var n,i,r=t[0],a=t[1],o=t[2],s=e[0],l=e[1],u=e[2],c=s-r,d=l-a,h=c*c+d*d;if(h<Tt)i=Math.log(u/o)/It,n=function(t){return[r+t*c,a+t*d,o*Math.exp(It*t*i)]};else{var f=Math.sqrt(h),m=(u*u-o*o+4*h)/(2*o*2*f),p=(u*u-o*o-4*h)/(2*u*2*f),g=Math.log(Math.sqrt(m*m+1)-m),v=Math.log(Math.sqrt(p*p+1)-p);i=(v-g)/It,n=function(t){var e=t*i,n=Pt(g),s=o/(2*f)*(n*function(t){return((t=Math.exp(2*t))-1)/(t+1)}(It*e+g)-function(t){return((t=Math.exp(t))-1/t)/2}(g));return[r+s*c,a+s*d,o*n/Pt(It*e+g)]}}return n.duration=1e3*i,n},a.behavior.zoom=function(){var t,e,n,i,r,o,s,u,d,h={x:0,y:0,k:1},f=[960,500],m=zt,p=250,g=0,v="mousedown.zoom",_="mousemove.zoom",y="mouseup.zoom",b="touchstart.zoom",M=B(x,"zoomstart","zoom","zoomend");function x(t){t.on(v,E).on(Wt+".zoom",O).on("dblclick.zoom",j).on(b,A)}function w(t){return[(t[0]-h.x)/h.k,(t[1]-h.y)/h.k]}function k(t){h.k=Math.max(m[0],Math.min(m[1],t))}function L(t,e){e=function(t){return[t[0]*h.k+h.x,t[1]*h.k+h.y]}(e),h.x+=t[0]-e[0],h.y+=t[1]-e[1]}function S(t,n,i,r){t.__chart__={x:h.x,y:h.y,k:h.k},k(Math.pow(2,r)),L(e=n,i),t=a.select(t),p>0&&(t=t.transition().duration(p)),t.call(x.event)}function T(){s&&s.domain(o.range().map(function(t){return(t-h.x)/h.k}).map(o.invert)),d&&d.domain(u.range().map(function(t){return(t-h.y)/h.k}).map(u.invert))}function Y(t){g++||t({type:"zoomstart"})}function D(t){T(),t({type:"zoom",scale:h.k,translate:[h.x,h.y]})}function C(t){--g||(t({type:"zoomend"}),e=null)}function E(){var t=this,e=M.of(t,arguments),n=0,i=a.select(c(t)).on(_,function(){n=1,L(a.mouse(t),r),D(e)}).on(y,function(){i.on(_,null).on(y,null),o(n),C(e)}),r=w(a.mouse(t)),o=xt(t);hs.call(t),Y(e)}function A(){var t,e=this,n=M.of(e,arguments),i={},o=0,s=".zoom-"+a.event.changedTouches[0].identifier,l="touchmove"+s,u="touchend"+s,c=[],d=a.select(e),f=xt(e);function m(){var n=a.touches(e);return t=h.k,n.forEach(function(t){t.identifier in i&&(i[t.identifier]=w(t))}),n}function p(){var t=a.event.target;a.select(t).on(l,g).on(u,_),c.push(t);for(var n=a.event.changedTouches,s=0,d=n.length;s<d;++s)i[n[s].identifier]=null;var f=m(),p=Date.now();if(1===f.length){if(p-r<500){var v=f[0];S(e,v,i[v.identifier],Math.floor(Math.log(h.k)/Math.LN2)+1),W()}r=p}else if(f.length>1){v=f[0];var y=f[1],b=v[0]-y[0],M=v[1]-y[1];o=b*b+M*M}}function g(){var s,l,u,c,d=a.touches(e);hs.call(e);for(var h=0,f=d.length;h<f;++h,c=null)if(u=d[h],c=i[u.identifier]){if(l)break;s=u,l=c}if(c){var m=(m=u[0]-s[0])*m+(m=u[1]-s[1])*m,p=o&&Math.sqrt(m/o);s=[(s[0]+u[0])/2,(s[1]+u[1])/2],l=[(l[0]+c[0])/2,(l[1]+c[1])/2],k(p*t)}r=null,L(s,l),D(n)}function _(){if(a.event.touches.length){for(var t=a.event.changedTouches,e=0,r=t.length;e<r;++e)delete i[t[e].identifier];for(var o in i)return void m()}a.selectAll(c).on(s,null),d.on(v,E).on(b,A),f(),C(n)}p(),Y(n),d.on(v,null).on(b,p)}function O(){var r=M.of(this,arguments);i?clearTimeout(i):(hs.call(this),t=w(e=n||a.mouse(this)),Y(r)),i=setTimeout(function(){i=null,C(r)},50),W(),k(Math.pow(2,.002*Rt())*h.k),L(e,t),D(r)}function j(){var t=a.mouse(this),e=Math.log(h.k)/Math.LN2;S(this,t,w(t),a.event.shiftKey?Math.ceil(e)-1:Math.floor(e)+1)}return Wt||(Wt="onwheel"in l?(Rt=function(){return-a.event.deltaY*(a.event.deltaMode?120:1)},"wheel"):"onmousewheel"in l?(Rt=function(){return a.event.wheelDelta},"mousewheel"):(Rt=function(){return-a.event.detail},"MozMousePixelScroll")),x.event=function(t){t.each(function(){var t=M.of(this,arguments),n=h;ps?a.select(this).transition().each("start.zoom",function(){h=this.__chart__||{x:0,y:0,k:1},Y(t)}).tween("zoom:zoom",function(){var i=f[0],r=f[1],o=e?e[0]:i/2,s=e?e[1]:r/2,l=a.interpolateZoom([(o-h.x)/h.k,(s-h.y)/h.k,i/h.k],[(o-n.x)/n.k,(s-n.y)/n.k,i/n.k]);return function(e){var n=l(e),r=i/n[2];this.__chart__=h={x:o-n[0]*r,y:s-n[1]*r,k:r},D(t)}}).each("interrupt.zoom",function(){C(t)}).each("end.zoom",function(){C(t)}):(this.__chart__=h,Y(t),D(t),C(t))})},x.translate=function(t){return arguments.length?(h={x:+t[0],y:+t[1],k:h.k},T(),x):[h.x,h.y]},x.scale=function(t){return arguments.length?(h={x:h.x,y:h.y,k:null},k(+t),T(),x):h.k},x.scaleExtent=function(t){return arguments.length?(m=null==t?zt:[+t[0],+t[1]],x):m},x.center=function(t){return arguments.length?(n=t&&[+t[0],+t[1]],x):n},x.size=function(t){return arguments.length?(f=t&&[+t[0],+t[1]],x):f},x.duration=function(t){return arguments.length?(p=+t,x):p},x.x=function(t){return arguments.length?(s=t,o=t.copy(),h={x:0,y:0,k:1},x):s},x.y=function(t){return arguments.length?(d=t,u=t.copy(),h={x:0,y:0,k:1},x):d},a.rebind(x,M,"on")};var Rt,Wt,zt=[0,1/0];function Bt(){}function Ut(t,e,n){return this instanceof Ut?(this.h=+t,this.s=+e,void(this.l=+n)):arguments.length<2?t instanceof Ut?new Ut(t.h,t.s,t.l):fe(""+t,me,Ut):new Ut(t,e,n)}a.color=Bt,Bt.prototype.toString=function(){return this.rgb()+""},a.hsl=Ut;var Gt=Ut.prototype=new Bt;function $t(t,e,n){var i,r;function a(t){return Math.round(255*function(t){return t>360?t-=360:t<0&&(t+=360),t<60?i+(r-i)*t/60:t<180?r:t<240?i+(r-i)*(240-t)/60:i}(t))}return t=isNaN(t)?0:(t%=360)<0?t+360:t,e=isNaN(e)?0:e<0?0:e>1?1:e,i=2*(n=n<0?0:n>1?1:n)-(r=n<=.5?n*(1+e):n+e-n*e),new le(a(t+120),a(t),a(t-120))}function qt(t,e,n){return this instanceof qt?(this.h=+t,this.c=+e,void(this.l=+n)):arguments.length<2?t instanceof qt?new qt(t.h,t.c,t.l):re(t instanceof Zt?t.l:(t=pe((t=a.rgb(t)).r,t.g,t.b)).l,t.a,t.b):new qt(t,e,n)}Gt.brighter=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ut(this.h,this.s,this.l/t)},Gt.darker=function(t){return t=Math.pow(.7,arguments.length?t:1),new Ut(this.h,this.s,t*this.l)},Gt.rgb=function(){return $t(this.h,this.s,this.l)},a.hcl=qt;var Jt=qt.prototype=new Bt;function Xt(t,e,n){return isNaN(t)&&(t=0),isNaN(e)&&(e=0),new Zt(n,Math.cos(t*=At)*e,Math.sin(t)*e)}function Zt(t,e,n){return this instanceof Zt?(this.l=+t,this.a=+e,void(this.b=+n)):arguments.length<2?t instanceof Zt?new Zt(t.l,t.a,t.b):t instanceof qt?Xt(t.h,t.c,t.l):pe((t=le(t)).r,t.g,t.b):new Zt(t,e,n)}Jt.brighter=function(t){return new qt(this.h,this.c,Math.min(100,this.l+Kt*(arguments.length?t:1)))},Jt.darker=function(t){return new qt(this.h,this.c,Math.max(0,this.l-Kt*(arguments.length?t:1)))},Jt.rgb=function(){return Xt(this.h,this.c,this.l).rgb()},a.lab=Zt;var Kt=18,Qt=.95047,te=1,ee=1.08883,ne=Zt.prototype=new Bt;function ie(t,e,n){var i=(t+16)/116,r=i+e/500,a=i-n/200;return new le(se(3.2404542*(r=ae(r)*Qt)-1.5371385*(i=ae(i)*te)-.4985314*(a=ae(a)*ee)),se(-.969266*r+1.8760108*i+.041556*a),se(.0556434*r-.2040259*i+1.0572252*a))}function re(t,e,n){return t>0?new qt(Math.atan2(n,e)*Ot,Math.sqrt(e*e+n*n),t):new qt(NaN,NaN,t)}function ae(t){return t>.206893034?t*t*t:(t-4/29)/7.787037}function oe(t){return t>.008856?Math.pow(t,1/3):7.787037*t+4/29}function se(t){return Math.round(255*(t<=.00304?12.92*t:1.055*Math.pow(t,1/2.4)-.055))}function le(t,e,n){return this instanceof le?(this.r=~~t,this.g=~~e,void(this.b=~~n)):arguments.length<2?t instanceof le?new le(t.r,t.g,t.b):fe(""+t,le,$t):new le(t,e,n)}function ue(t){return new le(t>>16,t>>8&255,255&t)}function ce(t){return ue(t)+""}ne.brighter=function(t){return new Zt(Math.min(100,this.l+Kt*(arguments.length?t:1)),this.a,this.b)},ne.darker=function(t){return new Zt(Math.max(0,this.l-Kt*(arguments.length?t:1)),this.a,this.b)},ne.rgb=function(){return ie(this.l,this.a,this.b)},a.rgb=le;var de=le.prototype=new Bt;function he(t){return t<16?"0"+Math.max(0,t).toString(16):Math.min(255,t).toString(16)}function fe(t,e,n){var i,r,a,o=0,s=0,l=0;if(i=/([a-z]+)\((.*)\)/.exec(t=t.toLowerCase()))switch(r=i[2].split(","),i[1]){case"hsl":return n(parseFloat(r[0]),parseFloat(r[1])/100,parseFloat(r[2])/100);case"rgb":return e(ve(r[0]),ve(r[1]),ve(r[2]))}return(a=_e.get(t))?e(a.r,a.g,a.b):(null==t||"#"!==t.charAt(0)||isNaN(a=parseInt(t.slice(1),16))||(4===t.length?(o=(3840&a)>>4,o|=o>>4,s=240&a,s|=s>>4,l=15&a,l|=l<<4):7===t.length&&(o=(16711680&a)>>16,s=(65280&a)>>8,l=255&a)),e(o,s,l))}function me(t,e,n){var i,r,a=Math.min(t/=255,e/=255,n/=255),o=Math.max(t,e,n),s=o-a,l=(o+a)/2;return s?(r=l<.5?s/(o+a):s/(2-o-a),i=t==o?(e-n)/s+(e<n?6:0):e==o?(n-t)/s+2:(t-e)/s+4,i*=60):(i=NaN,r=l>0&&l<1?0:i),new Ut(i,r,l)}function pe(t,e,n){var i=oe((.4124564*(t=ge(t))+.3575761*(e=ge(e))+.1804375*(n=ge(n)))/Qt),r=oe((.2126729*t+.7151522*e+.072175*n)/te);return Zt(116*r-16,500*(i-r),200*(r-oe((.0193339*t+.119192*e+.9503041*n)/ee)))}function ge(t){return(t/=255)<=.04045?t/12.92:Math.pow((t+.055)/1.055,2.4)}function ve(t){var e=parseFloat(t);return"%"===t.charAt(t.length-1)?Math.round(2.55*e):e}de.brighter=function(t){t=Math.pow(.7,arguments.length?t:1);var e=this.r,n=this.g,i=this.b,r=30;return e||n||i?(e&&e<r&&(e=r),n&&n<r&&(n=r),i&&i<r&&(i=r),new le(Math.min(255,e/t),Math.min(255,n/t),Math.min(255,i/t))):new le(r,r,r)},de.darker=function(t){return new le((t=Math.pow(.7,arguments.length?t:1))*this.r,t*this.g,t*this.b)},de.hsl=function(){return me(this.r,this.g,this.b)},de.toString=function(){return"#"+he(this.r)+he(this.g)+he(this.b)};var _e=a.map({aliceblue:15792383,antiquewhite:16444375,aqua:65535,aquamarine:8388564,azure:15794175,beige:16119260,bisque:16770244,black:0,blanchedalmond:16772045,blue:255,blueviolet:9055202,brown:10824234,burlywood:14596231,cadetblue:6266528,chartreuse:8388352,chocolate:13789470,coral:16744272,cornflowerblue:6591981,cornsilk:16775388,crimson:14423100,cyan:65535,darkblue:139,darkcyan:35723,darkgoldenrod:12092939,darkgray:11119017,darkgreen:25600,darkgrey:11119017,darkkhaki:12433259,darkmagenta:9109643,darkolivegreen:5597999,darkorange:16747520,darkorchid:10040012,darkred:9109504,darksalmon:15308410,darkseagreen:9419919,darkslateblue:4734347,darkslategray:3100495,darkslategrey:3100495,darkturquoise:52945,darkviolet:9699539,deeppink:16716947,deepskyblue:49151,dimgray:6908265,dimgrey:6908265,dodgerblue:2003199,firebrick:11674146,floralwhite:16775920,forestgreen:2263842,fuchsia:16711935,gainsboro:14474460,ghostwhite:16316671,gold:16766720,goldenrod:14329120,gray:8421504,green:32768,greenyellow:11403055,grey:8421504,honeydew:15794160,hotpink:16738740,indianred:13458524,indigo:4915330,ivory:16777200,khaki:15787660,lavender:15132410,lavenderblush:16773365,lawngreen:8190976,lemonchiffon:16775885,lightblue:11393254,lightcoral:15761536,lightcyan:14745599,lightgoldenrodyellow:16448210,lightgray:13882323,lightgreen:9498256,lightgrey:13882323,lightpink:16758465,lightsalmon:16752762,lightseagreen:2142890,lightskyblue:8900346,lightslategray:7833753,lightslategrey:7833753,lightsteelblue:11584734,lightyellow:16777184,lime:65280,limegreen:3329330,linen:16445670,magenta:16711935,maroon:8388608,mediumaquamarine:6737322,mediumblue:205,mediumorchid:12211667,mediumpurple:9662683,mediumseagreen:3978097,mediumslateblue:8087790,mediumspringgreen:64154,mediumturquoise:4772300,mediumvioletred:13047173,midnightblue:1644912,mintcream:16121850,mistyrose:16770273,moccasin:16770229,navajowhite:16768685,navy:128,oldlace:16643558,olive:8421376,olivedrab:7048739,orange:16753920,orangered:16729344,orchid:14315734,palegoldenrod:15657130,palegreen:10025880,paleturquoise:11529966,palevioletred:14381203,papayawhip:16773077,peachpuff:16767673,peru:13468991,pink:16761035,plum:14524637,powderblue:11591910,purple:8388736,rebeccapurple:6697881,red:16711680,rosybrown:12357519,royalblue:4286945,saddlebrown:9127187,salmon:16416882,sandybrown:16032864,seagreen:3050327,seashell:16774638,sienna:10506797,silver:12632256,skyblue:8900331,slateblue:6970061,slategray:7372944,slategrey:7372944,snow:16775930,springgreen:65407,steelblue:4620980,tan:13808780,teal:32896,thistle:14204888,tomato:16737095,turquoise:4251856,violet:15631086,wheat:16113331,white:16777215,whitesmoke:16119285,yellow:16776960,yellowgreen:10145074});function ye(t){return"function"==typeof t?t:function(){return t}}function be(t){return function(e,n,i){return 2===arguments.length&&"function"==typeof n&&(i=n,n=null),Me(e,n,t,i)}}function Me(t,e,n,i){var r={},o=a.dispatch("beforesend","progress","load","error"),l={},u=new XMLHttpRequest,c=null;function d(){var t,e=u.status;if(!e&&function(t){var e=t.responseType;return e&&"text"!==e?t.response:t.responseText}(u)||e>=200&&e<300||304===e){try{t=n.call(r,u)}catch(t){return void o.error.call(r,t)}o.load.call(r,t)}else o.error.call(r,u)}return!this.XDomainRequest||"withCredentials"in u||!/^(http(s)?:)?\/\//.test(t)||(u=new XDomainRequest),"onload"in u?u.onload=u.onerror=d:u.onreadystatechange=function(){u.readyState>3&&d()},u.onprogress=function(t){var e=a.event;a.event=t;try{o.progress.call(r,u)}finally{a.event=e}},r.header=function(t,e){return t=(t+"").toLowerCase(),arguments.length<2?l[t]:(null==e?delete l[t]:l[t]=e+"",r)},r.mimeType=function(t){return arguments.length?(e=null==t?null:t+"",r):e},r.responseType=function(t){return arguments.length?(c=t,r):c},r.response=function(t){return n=t,r},["get","post"].forEach(function(t){r[t]=function(){return r.send.apply(r,[t].concat(s(arguments)))}}),r.send=function(n,i,a){if(2===arguments.length&&"function"==typeof i&&(a=i,i=null),u.open(n,t,!0),null==e||"accept"in l||(l.accept=e+",*/*"),u.setRequestHeader)for(var s in l)u.setRequestHeader(s,l[s]);return null!=e&&u.overrideMimeType&&u.overrideMimeType(e),null!=c&&(u.responseType=c),null!=a&&r.on("error",a).on("load",function(t){a(null,t)}),o.beforesend.call(r,u),u.send(null==i?null:i),r},r.abort=function(){return u.abort(),r},a.rebind(r,o,"on"),null==i?r:r.get(function(t){return 1===t.length?function(e,n){t(null==e?n:null)}:t}(i))}_e.forEach(function(t,e){_e.set(t,ue(e))}),a.functor=ye,a.xhr=be(N),a.dsv=function(t,e){var n=new RegExp('["'+t+"\n]"),i=t.charCodeAt(0);function r(t,n,i){arguments.length<3&&(i=n,n=null);var r=Me(t,e,null==n?a:o(n),i);return r.row=function(t){return arguments.length?r.response(null==(n=t)?a:o(t)):n},r}function a(t){return r.parse(t.responseText)}function o(t){return function(e){return r.parse(e.responseText,t)}}function s(e){return e.map(l).join(t)}function l(t){return n.test(t)?'"'+t.replace(/\"/g,'""')+'"':t}return r.parse=function(t,e){var n;return r.parseRows(t,function(t,i){if(n)return n(t,i-1);var r=new Function("d","return {"+t.map(function(t,e){return JSON.stringify(t)+": d["+e+"]"}).join(",")+"}");n=e?function(t,n){return e(r(t),n)}:r})},r.parseRows=function(t,e){var n,r,a={},o={},s=[],l=t.length,u=0,c=0;function d(){if(u>=l)return o;if(r)return r=!1,a;var e=u;if(34===t.charCodeAt(e)){for(var n=e;n++<l;)if(34===t.charCodeAt(n)){if(34!==t.charCodeAt(n+1))break;++n}return u=n+2,13===(s=t.charCodeAt(n+1))?(r=!0,10===t.charCodeAt(n+2)&&++u):10===s&&(r=!0),t.slice(e+1,n).replace(/""/g,'"')}for(;u<l;){var s,c=1;if(10===(s=t.charCodeAt(u++)))r=!0;else if(13===s)r=!0,10===t.charCodeAt(u)&&(++u,++c);else if(s!==i)continue;return t.slice(e,u-c)}return t.slice(e)}for(;(n=d())!==o;){for(var h=[];n!==a&&n!==o;)h.push(n),n=d();e&&null==(h=e(h,c++))||s.push(h)}return s},r.format=function(e){if(Array.isArray(e[0]))return r.formatRows(e);var n=new j,i=[];return e.forEach(function(t){for(var e in t)n.has(e)||i.push(n.add(e))}),[i.map(l).join(t)].concat(e.map(function(e){return i.map(function(t){return l(e[t])}).join(t)})).join("\n")},r.formatRows=function(t){return t.map(s).join("\n")},r},a.csv=a.dsv(",","text/csv"),a.tsv=a.dsv("\t","text/tab-separated-values");var xe,we,ke,Le,Se=this[V(this,"requestAnimationFrame")]||function(t){setTimeout(t,17)};function Te(t,e,n){var i=arguments.length;i<2&&(e=0),i<3&&(n=Date.now());var r={c:t,t:n+e,n:null};return we?we.n=r:xe=r,we=r,ke||(Le=clearTimeout(Le),ke=1,Se(Ye)),r}function Ye(){var t=De(),e=Ce()-t;e>24?(isFinite(e)&&(clearTimeout(Le),Le=setTimeout(Ye,e)),ke=0):(ke=1,Se(Ye))}function De(){for(var t=Date.now(),e=xe;e;)t>=e.t&&e.c(t-e.t)&&(e.c=null),e=e.n;return t}function Ce(){for(var t,e=xe,n=1/0;e;)e.c?(e.t<n&&(n=e.t),e=(t=e).n):e=t?t.n=e.n:xe=e.n;return we=t,n}function Ee(t,e){return e-(t?Math.ceil(Math.log(t)/Math.LN10):1)}a.timer=function(){Te.apply(this,arguments)},a.timer.flush=function(){De(),Ce()},a.round=function(t,e){return e?Math.round(t*(e=Math.pow(10,e)))/e:Math.round(t)};var Ae=["y","z","a","f","p","n","µ","m","","k","M","G","T","P","E","Z","Y"].map(function(t,e){var n=Math.pow(10,3*x(8-e));return{scale:e>8?function(t){return t/n}:function(t){return t*n},symbol:t}});a.formatPrefix=function(t,e){var n=0;return(t=+t)&&(t<0&&(t*=-1),e&&(t=a.round(t,Ee(t,e))),n=1+Math.floor(1e-12+Math.log(t)/Math.LN10),n=Math.max(-24,Math.min(24,3*Math.floor((n-1)/3)))),Ae[8+n/3]};var Oe=/(?:([^{])?([<>=^]))?([+\- ])?([$#])?(0)?(\d+)?(,)?(\.-?\d+)?([a-z%])?/i,je=a.map({b:function(t){return t.toString(2)},c:function(t){return String.fromCharCode(t)},o:function(t){return t.toString(8)},x:function(t){return t.toString(16)},X:function(t){return t.toString(16).toUpperCase()},g:function(t,e){return t.toPrecision(e)},e:function(t,e){return t.toExponential(e)},f:function(t,e){return t.toFixed(e)},r:function(t,e){return(t=a.round(t,Ee(t,e))).toFixed(Math.max(0,Math.min(20,Ee(t*(1+1e-15),e))))}});function Ne(t){return t+""}var He=a.time={},Ve=Date;function Pe(){this._=new Date(arguments.length>1?Date.UTC.apply(this,arguments):arguments[0])}Pe.prototype={getDate:function(){return this._.getUTCDate()},getDay:function(){return this._.getUTCDay()},getFullYear:function(){return this._.getUTCFullYear()},getHours:function(){return this._.getUTCHours()},getMilliseconds:function(){return this._.getUTCMilliseconds()},getMinutes:function(){return this._.getUTCMinutes()},getMonth:function(){return this._.getUTCMonth()},getSeconds:function(){return this._.getUTCSeconds()},getTime:function(){return this._.getTime()},getTimezoneOffset:function(){return 0},valueOf:function(){return this._.valueOf()},setDate:function(){Fe.setUTCDate.apply(this._,arguments)},setDay:function(){Fe.setUTCDay.apply(this._,arguments)},setFullYear:function(){Fe.setUTCFullYear.apply(this._,arguments)},setHours:function(){Fe.setUTCHours.apply(this._,arguments)},setMilliseconds:function(){Fe.setUTCMilliseconds.apply(this._,arguments)},setMinutes:function(){Fe.setUTCMinutes.apply(this._,arguments)},setMonth:function(){Fe.setUTCMonth.apply(this._,arguments)},setSeconds:function(){Fe.setUTCSeconds.apply(this._,arguments)},setTime:function(){Fe.setTime.apply(this._,arguments)}};var Fe=Date.prototype;function Ie(t,e,n){function i(e){var n=t(e),i=a(n,1);return e-n<i-e?n:i}function r(n){return e(n=t(new Ve(n-1)),1),n}function a(t,n){return e(t=new Ve(+t),n),t}function o(t,i,a){var o=r(t),s=[];if(a>1)for(;o<i;)n(o)%a||s.push(new Date(+o)),e(o,1);else for(;o<i;)s.push(new Date(+o)),e(o,1);return s}t.floor=t,t.round=i,t.ceil=r,t.offset=a,t.range=o;var s=t.utc=Re(t);return s.floor=s,s.round=Re(i),s.ceil=Re(r),s.offset=Re(a),s.range=function(t,e,n){try{Ve=Pe;var i=new Pe;return i._=t,o(i,e,n)}finally{Ve=Date}},t}function Re(t){return function(e,n){try{Ve=Pe;var i=new Pe;return i._=e,t(i,n)._}finally{Ve=Date}}}He.year=Ie(function(t){return(t=He.day(t)).setMonth(0,1),t},function(t,e){t.setFullYear(t.getFullYear()+e)},function(t){return t.getFullYear()}),He.years=He.year.range,He.years.utc=He.year.utc.range,He.day=Ie(function(t){var e=new Ve(2e3,0);return e.setFullYear(t.getFullYear(),t.getMonth(),t.getDate()),e},function(t,e){t.setDate(t.getDate()+e)},function(t){return t.getDate()-1}),He.days=He.day.range,He.days.utc=He.day.utc.range,He.dayOfYear=function(t){var e=He.year(t);return Math.floor((t-e-6e4*(t.getTimezoneOffset()-e.getTimezoneOffset()))/864e5)},["sunday","monday","tuesday","wednesday","thursday","friday","saturday"].forEach(function(t,e){e=7-e;var n=He[t]=Ie(function(t){return(t=He.day(t)).setDate(t.getDate()-(t.getDay()+e)%7),t},function(t,e){t.setDate(t.getDate()+7*Math.floor(e))},function(t){var n=He.year(t).getDay();return Math.floor((He.dayOfYear(t)+(n+e)%7)/7)-(n!==e)});He[t+"s"]=n.range,He[t+"s"].utc=n.utc.range,He[t+"OfYear"]=function(t){var n=He.year(t).getDay();return Math.floor((He.dayOfYear(t)+(n+e)%7)/7)}}),He.week=He.sunday,He.weeks=He.sunday.range,He.weeks.utc=He.sunday.utc.range,He.weekOfYear=He.sundayOfYear;var We={"-":"",_:" ",0:"0"},ze=/^\s*\d+/,Be=/^%/;function Ue(t,e,n){var i=t<0?"-":"",r=(i?-t:t)+"",a=r.length;return i+(a<n?new Array(n-a+1).join(e)+r:r)}function Ge(t){return new RegExp("^(?:"+t.map(a.requote).join("|")+")","i")}function $e(t){for(var e=new k,n=-1,i=t.length;++n<i;)e.set(t[n].toLowerCase(),n);return e}function qe(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+1));return i?(t.w=+i[0],n+i[0].length):-1}function Je(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n));return i?(t.U=+i[0],n+i[0].length):-1}function Xe(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n));return i?(t.W=+i[0],n+i[0].length):-1}function Ze(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+4));return i?(t.y=+i[0],n+i[0].length):-1}function Ke(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.y=function(t){return t+(t>68?1900:2e3)}(+i[0]),n+i[0].length):-1}function Qe(t,e,n){return/^[+-]\d{4}$/.test(e=e.slice(n,n+5))?(t.Z=-e,n+5):-1}function tn(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.m=i[0]-1,n+i[0].length):-1}function en(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.d=+i[0],n+i[0].length):-1}function nn(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+3));return i?(t.j=+i[0],n+i[0].length):-1}function rn(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.H=+i[0],n+i[0].length):-1}function an(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.M=+i[0],n+i[0].length):-1}function on(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+2));return i?(t.S=+i[0],n+i[0].length):-1}function sn(t,e,n){ze.lastIndex=0;var i=ze.exec(e.slice(n,n+3));return i?(t.L=+i[0],n+i[0].length):-1}function ln(t){var e=t.getTimezoneOffset(),n=e>0?"-":"+",i=x(e)/60|0,r=x(e)%60;return n+Ue(i,"0",2)+Ue(r,"0",2)}function un(t,e,n){Be.lastIndex=0;var i=Be.exec(e.slice(n,n+1));return i?n+i[0].length:-1}function cn(t){for(var e=t.length,n=-1;++n<e;)t[n][0]=this(t[n][0]);return function(e){for(var n=0,i=t[n];!i[1](e);)i=t[++n];return i[0](e)}}a.locale=function(t){return{numberFormat:function(t){var e=t.decimal,n=t.thousands,i=t.grouping,r=t.currency,o=i&&n?function(t,e){for(var r=t.length,a=[],o=0,s=i[0],l=0;r>0&&s>0&&(l+s+1>e&&(s=Math.max(1,e-l)),a.push(t.substring(r-=s,r+s)),!((l+=s+1)>e));)s=i[o=(o+1)%i.length];return a.reverse().join(n)}:N;return function(t){var n=Oe.exec(t),i=n[1]||" ",s=n[2]||">",l=n[3]||"-",u=n[4]||"",c=n[5],d=+n[6],h=n[7],f=n[8],m=n[9],p=1,g="",v="",_=!1,y=!0;switch(f&&(f=+f.substring(1)),(c||"0"===i&&"="===s)&&(c=i="0",s="="),m){case"n":h=!0,m="g";break;case"%":p=100,v="%",m="f";break;case"p":p=100,v="%",m="r";break;case"b":case"o":case"x":case"X":"#"===u&&(g="0"+m.toLowerCase());case"c":y=!1;case"d":_=!0,f=0;break;case"s":p=-1,m="r"}"$"===u&&(g=r[0],v=r[1]),"r"!=m||f||(m="g"),null!=f&&("g"==m?f=Math.max(1,Math.min(21,f)):"e"!=m&&"f"!=m||(f=Math.max(0,Math.min(20,f)))),m=je.get(m)||Ne;var b=c&&h;return function(t){var n=v;if(_&&t%1)return"";var r=t<0||0===t&&1/t<0?(t=-t,"-"):"-"===l?"":l;if(p<0){var u=a.formatPrefix(t,f);t=u.scale(t),n=u.symbol+v}else t*=p;var M,x,w=(t=m(t,f)).lastIndexOf(".");if(w<0){var k=y?t.lastIndexOf("e"):-1;k<0?(M=t,x=""):(M=t.substring(0,k),x=t.substring(k))}else M=t.substring(0,w),x=e+t.substring(w+1);!c&&h&&(M=o(M,1/0));var L=g.length+M.length+x.length+(b?0:r.length),S=L<d?new Array(L=d-L+1).join(i):"";return b&&(M=o(S+M,S.length?d-x.length:1/0)),r+=g,t=M+x,("<"===s?r+t+S:">"===s?S+r+t:"^"===s?S.substring(0,L>>=1)+r+t+S.substring(L):r+(b?t:S+t))+n}}}(t),timeFormat:function(t){var e=t.dateTime,n=t.date,i=t.time,r=t.periods,o=t.days,s=t.shortDays,l=t.months,u=t.shortMonths;function c(t){var e=t.length;function n(n){for(var i,r,a,o=[],s=-1,l=0;++s<e;)37===t.charCodeAt(s)&&(o.push(t.slice(l,s)),null!=(r=We[i=t.charAt(++s)])&&(i=t.charAt(++s)),(a=M[i])&&(i=a(n,null==r?"e"===i?" ":"0":r)),o.push(i),l=s+1);return o.push(t.slice(l,s)),o.join("")}return n.parse=function(e){var n={y:1900,m:0,d:1,H:0,M:0,S:0,L:0,Z:null};if(d(n,t,e,0)!=e.length)return null;"p"in n&&(n.H=n.H%12+12*n.p);var i=null!=n.Z&&Ve!==Pe,r=new(i?Pe:Ve);return"j"in n?r.setFullYear(n.y,0,n.j):"W"in n||"U"in n?("w"in n||(n.w="W"in n?1:0),r.setFullYear(n.y,0,1),r.setFullYear(n.y,0,"W"in n?(n.w+6)%7+7*n.W-(r.getDay()+5)%7:n.w+7*n.U-(r.getDay()+6)%7)):r.setFullYear(n.y,n.m,n.d),r.setHours(n.H+(n.Z/100|0),n.M+n.Z%100,n.S,n.L),i?r._:r},n.toString=function(){return t},n}function d(t,e,n,i){for(var r,a,o,s=0,l=e.length,u=n.length;s<l;){if(i>=u)return-1;if(37===(r=e.charCodeAt(s++))){if(o=e.charAt(s++),!(a=x[o in We?e.charAt(s++):o])||(i=a(t,n,i))<0)return-1}else if(r!=n.charCodeAt(i++))return-1}return i}c.utc=function(t){var e=c(t);function n(t){try{var n=new(Ve=Pe);return n._=t,e(n)}finally{Ve=Date}}return n.parse=function(t){try{Ve=Pe;var n=e.parse(t);return n&&n._}finally{Ve=Date}},n.toString=e.toString,n},c.multi=c.utc.multi=cn;var h=a.map(),f=Ge(o),m=$e(o),p=Ge(s),g=$e(s),v=Ge(l),_=$e(l),y=Ge(u),b=$e(u);r.forEach(function(t,e){h.set(t.toLowerCase(),e)});var M={a:function(t){return s[t.getDay()]},A:function(t){return o[t.getDay()]},b:function(t){return u[t.getMonth()]},B:function(t){return l[t.getMonth()]},c:c(e),d:function(t,e){return Ue(t.getDate(),e,2)},e:function(t,e){return Ue(t.getDate(),e,2)},H:function(t,e){return Ue(t.getHours(),e,2)},I:function(t,e){return Ue(t.getHours()%12||12,e,2)},j:function(t,e){return Ue(1+He.dayOfYear(t),e,3)},L:function(t,e){return Ue(t.getMilliseconds(),e,3)},m:function(t,e){return Ue(t.getMonth()+1,e,2)},M:function(t,e){return Ue(t.getMinutes(),e,2)},p:function(t){return r[+(t.getHours()>=12)]},S:function(t,e){return Ue(t.getSeconds(),e,2)},U:function(t,e){return Ue(He.sundayOfYear(t),e,2)},w:function(t){return t.getDay()},W:function(t,e){return Ue(He.mondayOfYear(t),e,2)},x:c(n),X:c(i),y:function(t,e){return Ue(t.getFullYear()%100,e,2)},Y:function(t,e){return Ue(t.getFullYear()%1e4,e,4)},Z:ln,"%":function(){return"%"}},x={a:function(t,e,n){p.lastIndex=0;var i=p.exec(e.slice(n));return i?(t.w=g.get(i[0].toLowerCase()),n+i[0].length):-1},A:function(t,e,n){f.lastIndex=0;var i=f.exec(e.slice(n));return i?(t.w=m.get(i[0].toLowerCase()),n+i[0].length):-1},b:function(t,e,n){y.lastIndex=0;var i=y.exec(e.slice(n));return i?(t.m=b.get(i[0].toLowerCase()),n+i[0].length):-1},B:function(t,e,n){v.lastIndex=0;var i=v.exec(e.slice(n));return i?(t.m=_.get(i[0].toLowerCase()),n+i[0].length):-1},c:function(t,e,n){return d(t,M.c.toString(),e,n)},d:en,e:en,H:rn,I:rn,j:nn,L:sn,m:tn,M:an,p:function(t,e,n){var i=h.get(e.slice(n,n+=2).toLowerCase());return null==i?-1:(t.p=i,n)},S:on,U:Je,w:qe,W:Xe,x:function(t,e,n){return d(t,M.x.toString(),e,n)},X:function(t,e,n){return d(t,M.X.toString(),e,n)},y:Ke,Y:Ze,Z:Qe,"%":un};return c}(t)}};var dn=a.locale({decimal:".",thousands:",",grouping:[3],currency:["$",""],dateTime:"%a %b %e %X %Y",date:"%m/%d/%Y",time:"%H:%M:%S",periods:["AM","PM"],days:["Sunday","Monday","Tuesday","Wednesday","Thursday","Friday","Saturday"],shortDays:["Sun","Mon","Tue","Wed","Thu","Fri","Sat"],months:["January","February","March","April","May","June","July","August","September","October","November","December"],shortMonths:["Jan","Feb","Mar","Apr","May","Jun","Jul","Aug","Sep","Oct","Nov","Dec"]});function hn(){}a.format=dn.numberFormat,a.geo={},hn.prototype={s:0,t:0,add:function(t){mn(t,this.t,fn),mn(fn.s,this.s,this),this.s?this.t+=fn.t:this.s=fn.t},reset:function(){this.s=this.t=0},valueOf:function(){return this.s}};var fn=new hn;function mn(t,e,n){var i=n.s=t+e,r=i-t,a=i-r;n.t=t-a+(e-r)}function pn(t,e){t&&vn.hasOwnProperty(t.type)&&vn[t.type](t,e)}a.geo.stream=function(t,e){t&&gn.hasOwnProperty(t.type)?gn[t.type](t,e):pn(t,e)};var gn={Feature:function(t,e){pn(t.geometry,e)},FeatureCollection:function(t,e){for(var n=t.features,i=-1,r=n.length;++i<r;)pn(n[i].geometry,e)}},vn={Sphere:function(t,e){e.sphere()},Point:function(t,e){t=t.coordinates,e.point(t[0],t[1],t[2])},MultiPoint:function(t,e){for(var n=t.coordinates,i=-1,r=n.length;++i<r;)t=n[i],e.point(t[0],t[1],t[2])},LineString:function(t,e){_n(t.coordinates,e,0)},MultiLineString:function(t,e){for(var n=t.coordinates,i=-1,r=n.length;++i<r;)_n(n[i],e,0)},Polygon:function(t,e){yn(t.coordinates,e)},MultiPolygon:function(t,e){for(var n=t.coordinates,i=-1,r=n.length;++i<r;)yn(n[i],e)},GeometryCollection:function(t,e){for(var n=t.geometries,i=-1,r=n.length;++i<r;)pn(n[i],e)}};function _n(t,e,n){var i,r=-1,a=t.length-n;for(e.lineStart();++r<a;)i=t[r],e.point(i[0],i[1],i[2]);e.lineEnd()}function yn(t,e){var n=-1,i=t.length;for(e.polygonStart();++n<i;)_n(t[n],e,1);e.polygonEnd()}a.geo.area=function(t){return bn=0,a.geo.stream(t,On),bn};var bn,Mn,xn,wn,kn,Ln,Sn,Tn,Yn,Dn,Cn,En,An=new hn,On={sphere:function(){bn+=4*Yt},point:F,lineStart:F,lineEnd:F,polygonStart:function(){An.reset(),On.lineStart=jn},polygonEnd:function(){var t=2*An;bn+=t<0?4*Yt+t:t,On.lineStart=On.lineEnd=On.point=F}};function jn(){var t,e,n,i,r;function a(t,e){e=e*At/2+Yt/4;var a=(t*=At)-n,o=a>=0?1:-1,s=o*a,l=Math.cos(e),u=Math.sin(e),c=r*u,d=i*l+c*Math.cos(s),h=c*o*Math.sin(s);An.add(Math.atan2(h,d)),n=t,i=l,r=u}On.point=function(o,s){On.point=a,n=(t=o)*At,i=Math.cos(s=(e=s)*At/2+Yt/4),r=Math.sin(s)},On.lineEnd=function(){a(t,e)}}function Nn(t){var e=t[0],n=t[1],i=Math.cos(n);return[i*Math.cos(e),i*Math.sin(e),Math.sin(n)]}function Hn(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]}function Vn(t,e){return[t[1]*e[2]-t[2]*e[1],t[2]*e[0]-t[0]*e[2],t[0]*e[1]-t[1]*e[0]]}function Pn(t,e){t[0]+=e[0],t[1]+=e[1],t[2]+=e[2]}function Fn(t,e){return[t[0]*e,t[1]*e,t[2]*e]}function In(t){var e=Math.sqrt(t[0]*t[0]+t[1]*t[1]+t[2]*t[2]);t[0]/=e,t[1]/=e,t[2]/=e}function Rn(t){return[Math.atan2(t[1],t[0]),Vt(t[2])]}function Wn(t,e){return x(t[0]-e[0])<St&&x(t[1]-e[1])<St}a.geo.bounds=function(){var t,e,n,i,r,o,s,l,u,c,d,h={point:f,lineStart:p,lineEnd:g,polygonStart:function(){h.point=v,h.lineStart=_,h.lineEnd=y,u=0,On.polygonStart()},polygonEnd:function(){On.polygonEnd(),h.point=f,h.lineStart=p,h.lineEnd=g,An<0?(t=-(n=180),e=-(i=90)):u>St?i=90:u<-St&&(e=-90),d[0]=t,d[1]=n}};function f(r,a){c.push(d=[t=r,n=r]),a<e&&(e=a),a>i&&(i=a)}function m(a,o){var s=Nn([a*At,o*At]);if(l){var u=Vn(l,s),c=Vn([u[1],-u[0],0],u);In(c),c=Rn(c);var d=a-r,h=d>0?1:-1,m=c[0]*Ot*h,p=x(d)>180;if(p^(h*r<m&&m<h*a))(g=c[1]*Ot)>i&&(i=g);else if(p^(h*r<(m=(m+360)%360-180)&&m<h*a)){var g;(g=-c[1]*Ot)<e&&(e=g)}else o<e&&(e=o),o>i&&(i=o);p?a<r?b(t,a)>b(t,n)&&(n=a):b(a,n)>b(t,n)&&(t=a):n>=t?(a<t&&(t=a),a>n&&(n=a)):a>r?b(t,a)>b(t,n)&&(n=a):b(a,n)>b(t,n)&&(t=a)}else f(a,o);l=s,r=a}function p(){h.point=m}function g(){d[0]=t,d[1]=n,h.point=f,l=null}function v(t,e){if(l){var n=t-r;u+=x(n)>180?n+(n>0?360:-360):n}else o=t,s=e;On.point(t,e),m(t,e)}function _(){On.lineStart()}function y(){v(o,s),On.lineEnd(),x(u)>St&&(t=-(n=180)),d[0]=t,d[1]=n,l=null}function b(t,e){return(e-=t)<0?e+360:e}function M(t,e){return t[0]-e[0]}function w(t,e){return e[0]<=e[1]?e[0]<=t&&t<=e[1]:t<e[0]||e[1]<t}return function(r){if(i=n=-(t=e=1/0),c=[],a.geo.stream(r,h),u=c.length){c.sort(M);for(var o=1,s=[p=c[0]];o<u;++o)w((f=c[o])[0],p)||w(f[1],p)?(b(p[0],f[1])>b(p[0],p[1])&&(p[1]=f[1]),b(f[0],p[1])>b(p[0],p[1])&&(p[0]=f[0])):s.push(p=f);for(var l,u,f,m=-1/0,p=(o=0,s[u=s.length-1]);o<=u;p=f,++o)f=s[o],(l=b(p[1],f[0]))>m&&(m=l,t=f[0],n=p[1])}return c=d=null,t===1/0||e===1/0?[[NaN,NaN],[NaN,NaN]]:[[t,e],[n,i]]}}(),a.geo.centroid=function(t){Mn=xn=wn=kn=Ln=Sn=Tn=Yn=Dn=Cn=En=0,a.geo.stream(t,zn);var e=Dn,n=Cn,i=En,r=e*e+n*n+i*i;return r<Tt&&(e=Sn,n=Tn,i=Yn,xn<St&&(e=wn,n=kn,i=Ln),(r=e*e+n*n+i*i)<Tt)?[NaN,NaN]:[Math.atan2(n,e)*Ot,Vt(i/Math.sqrt(r))*Ot]};var zn={sphere:F,point:Bn,lineStart:Gn,lineEnd:$n,polygonStart:function(){zn.lineStart=qn},polygonEnd:function(){zn.lineStart=Gn}};function Bn(t,e){t*=At;var n=Math.cos(e*=At);Un(n*Math.cos(t),n*Math.sin(t),Math.sin(e))}function Un(t,e,n){wn+=(t-wn)/++Mn,kn+=(e-kn)/Mn,Ln+=(n-Ln)/Mn}function Gn(){var t,e,n;function i(i,r){i*=At;var a=Math.cos(r*=At),o=a*Math.cos(i),s=a*Math.sin(i),l=Math.sin(r),u=Math.atan2(Math.sqrt((u=e*l-n*s)*u+(u=n*o-t*l)*u+(u=t*s-e*o)*u),t*o+e*s+n*l);xn+=u,Sn+=u*(t+(t=o)),Tn+=u*(e+(e=s)),Yn+=u*(n+(n=l)),Un(t,e,n)}zn.point=function(r,a){r*=At;var o=Math.cos(a*=At);t=o*Math.cos(r),e=o*Math.sin(r),n=Math.sin(a),zn.point=i,Un(t,e,n)}}function $n(){zn.point=Bn}function qn(){var t,e,n,i,r;function a(t,e){t*=At;var a=Math.cos(e*=At),o=a*Math.cos(t),s=a*Math.sin(t),l=Math.sin(e),u=i*l-r*s,c=r*o-n*l,d=n*s-i*o,h=Math.sqrt(u*u+c*c+d*d),f=n*o+i*s+r*l,m=h&&-Ht(f)/h,p=Math.atan2(h,f);Dn+=m*u,Cn+=m*c,En+=m*d,xn+=p,Sn+=p*(n+(n=o)),Tn+=p*(i+(i=s)),Yn+=p*(r+(r=l)),Un(n,i,r)}zn.point=function(o,s){t=o,e=s,zn.point=a,o*=At;var l=Math.cos(s*=At);n=l*Math.cos(o),i=l*Math.sin(o),r=Math.sin(s),Un(n,i,r)},zn.lineEnd=function(){a(t,e),zn.lineEnd=$n,zn.point=Bn}}function Jn(t,e){function n(n,i){return n=t(n,i),e(n[0],n[1])}return t.invert&&e.invert&&(n.invert=function(n,i){return(n=e.invert(n,i))&&t.invert(n[0],n[1])}),n}function Xn(){return!0}function Zn(t,e,n,i,r){var a=[],o=[];if(t.forEach(function(t){if(!((e=t.length-1)<=0)){var e,n=t[0],i=t[e];if(Wn(n,i)){r.lineStart();for(var s=0;s<e;++s)r.point((n=t[s])[0],n[1]);r.lineEnd()}else{var l=new Qn(n,t,null,!0),u=new Qn(n,null,l,!1);l.o=u,a.push(l),o.push(u),u=new Qn(i,null,l=new Qn(i,t,null,!1),!0),l.o=u,a.push(l),o.push(u)}}}),o.sort(e),Kn(a),Kn(o),a.length){for(var s=0,l=n,u=o.length;s<u;++s)o[s].e=l=!l;for(var c,d,h=a[0];;){for(var f=h,m=!0;f.v;)if((f=f.n)===h)return;c=f.z,r.lineStart();do{if(f.v=f.o.v=!0,f.e){if(m)for(s=0,u=c.length;s<u;++s)r.point((d=c[s])[0],d[1]);else i(f.x,f.n.x,1,r);f=f.n}else{if(m)for(s=(c=f.p.z).length-1;s>=0;--s)r.point((d=c[s])[0],d[1]);else i(f.x,f.p.x,-1,r);f=f.p}c=(f=f.o).z,m=!m}while(!f.v);r.lineEnd()}}}function Kn(t){if(e=t.length){for(var e,n,i=0,r=t[0];++i<e;)r.n=n=t[i],n.p=r,r=n;r.n=n=t[0],n.p=r}}function Qn(t,e,n,i){this.x=t,this.z=e,this.o=n,this.e=i,this.v=!1,this.n=this.p=null}function ti(t,e,n,i){return function(r,o){var s,l=e(o),u=r.invert(i[0],i[1]),c={point:d,lineStart:f,lineEnd:m,polygonStart:function(){c.point=b,c.lineStart=M,c.lineEnd=x,s=[],p=[]},polygonEnd:function(){c.point=d,c.lineStart=f,c.lineEnd=m,s=a.merge(s);var t=function(t,e){var n=t[0],i=t[1],r=[Math.sin(n),-Math.cos(n),0],a=0,o=0;An.reset();for(var s=0,l=e.length;s<l;++s){var u=e[s],c=u.length;if(c)for(var d=u[0],h=d[0],f=d[1]/2+Yt/4,m=Math.sin(f),p=Math.cos(f),g=1;;){g===c&&(g=0);var v=(t=u[g])[0],_=t[1]/2+Yt/4,y=Math.sin(_),b=Math.cos(_),M=v-h,x=M>=0?1:-1,w=x*M,k=w>Yt,L=m*y;if(An.add(Math.atan2(L*x*Math.sin(w),p*b+L*Math.cos(w))),a+=k?M+x*Dt:M,k^h>=n^v>=n){var S=Vn(Nn(d),Nn(t));In(S);var T=Vn(r,S);In(T);var Y=(k^M>=0?-1:1)*Vt(T[2]);(i>Y||i===Y&&(S[0]||S[1]))&&(o+=k^M>=0?1:-1)}if(!g++)break;h=v,m=y,p=b,d=t}}return(a<-St||a<St&&An<0)^1&o}(u,p);s.length?(y||(o.polygonStart(),y=!0),Zn(s,ii,t,n,o)):t&&(y||(o.polygonStart(),y=!0),o.lineStart(),n(null,null,1,o),o.lineEnd()),y&&(o.polygonEnd(),y=!1),s=p=null},sphere:function(){o.polygonStart(),o.lineStart(),n(null,null,1,o),o.lineEnd(),o.polygonEnd()}};function d(e,n){var i=r(e,n);t(e=i[0],n=i[1])&&o.point(e,n)}function h(t,e){var n=r(t,e);l.point(n[0],n[1])}function f(){c.point=h,l.lineStart()}function m(){c.point=d,l.lineEnd()}var p,g,v=ni(),_=e(v),y=!1;function b(t,e){g.push([t,e]);var n=r(t,e);_.point(n[0],n[1])}function M(){_.lineStart(),g=[]}function x(){b(g[0][0],g[0][1]),_.lineEnd();var t,e=_.clean(),n=v.buffer(),i=n.length;if(g.pop(),p.push(g),g=null,i)if(1&e){var r,a=-1;if((i=(t=n[0]).length-1)>0){for(y||(o.polygonStart(),y=!0),o.lineStart();++a<i;)o.point((r=t[a])[0],r[1]);o.lineEnd()}}else i>1&&2&e&&n.push(n.pop().concat(n.shift())),s.push(n.filter(ei))}return c}}function ei(t){return t.length>1}function ni(){var t,e=[];return{lineStart:function(){e.push(t=[])},point:function(e,n){t.push([e,n])},lineEnd:F,buffer:function(){var n=e;return e=[],t=null,n},rejoin:function(){e.length>1&&e.push(e.pop().concat(e.shift()))}}}function ii(t,e){return((t=t.x)[0]<0?t[1]-Et-St:Et-t[1])-((e=e.x)[0]<0?e[1]-Et-St:Et-e[1])}var ri=ti(Xn,function(t){var e,n=NaN,i=NaN,r=NaN;return{lineStart:function(){t.lineStart(),e=1},point:function(a,o){var s=a>0?Yt:-Yt,l=x(a-n);x(l-Yt)<St?(t.point(n,i=(i+o)/2>0?Et:-Et),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(s,i),t.point(a,i),e=0):r!==s&&l>=Yt&&(x(n-r)<St&&(n-=r*St),x(a-s)<St&&(a-=s*St),i=function(t,e,n,i){var r,a,o=Math.sin(t-n);return x(o)>St?Math.atan((Math.sin(e)*(a=Math.cos(i))*Math.sin(n)-Math.sin(i)*(r=Math.cos(e))*Math.sin(t))/(r*a*o)):(e+i)/2}(n,i,a,o),t.point(r,i),t.lineEnd(),t.lineStart(),t.point(s,i),e=0),t.point(n=a,i=o),r=s},lineEnd:function(){t.lineEnd(),n=i=NaN},clean:function(){return 2-e}}},function(t,e,n,i){var r;if(null==t)r=n*Et,i.point(-Yt,r),i.point(0,r),i.point(Yt,r),i.point(Yt,0),i.point(Yt,-r),i.point(0,-r),i.point(-Yt,-r),i.point(-Yt,0),i.point(-Yt,r);else if(x(t[0]-e[0])>St){var a=t[0]<e[0]?Yt:-Yt;r=n*a/2,i.point(-a,r),i.point(0,r),i.point(a,r)}else i.point(e[0],e[1])},[-Yt,-Yt/2]);function ai(t,e,n,i){return function(r){var a,o=r.a,s=r.b,l=o.x,u=o.y,c=0,d=1,h=s.x-l,f=s.y-u;if(a=t-l,h||!(a>0)){if(a/=h,h<0){if(a<c)return;a<d&&(d=a)}else if(h>0){if(a>d)return;a>c&&(c=a)}if(a=n-l,h||!(a<0)){if(a/=h,h<0){if(a>d)return;a>c&&(c=a)}else if(h>0){if(a<c)return;a<d&&(d=a)}if(a=e-u,f||!(a>0)){if(a/=f,f<0){if(a<c)return;a<d&&(d=a)}else if(f>0){if(a>d)return;a>c&&(c=a)}if(a=i-u,f||!(a<0)){if(a/=f,f<0){if(a>d)return;a>c&&(c=a)}else if(f>0){if(a<c)return;a<d&&(d=a)}return c>0&&(r.a={x:l+c*h,y:u+c*f}),d<1&&(r.b={x:l+d*h,y:u+d*f}),r}}}}}}var oi=1e9;function si(t,e,n,i){return function(l){var u,c,d,h,f,m,p,g,v,_,y,b=l,M=ni(),x=ai(t,e,n,i),w={point:S,lineStart:function(){w.point=T,c&&c.push(d=[]);_=!0,v=!1,p=g=NaN},lineEnd:function(){u&&(T(h,f),m&&v&&M.rejoin(),u.push(M.buffer()));w.point=S,v&&l.lineEnd()},polygonStart:function(){l=M,u=[],c=[],y=!0},polygonEnd:function(){l=b,u=a.merge(u);var e=function(t){for(var e=0,n=c.length,i=t[1],r=0;r<n;++r)for(var a,o=1,s=c[r],l=s.length,u=s[0];o<l;++o)a=s[o],u[1]<=i?a[1]>i&&Nt(u,a,t)>0&&++e:a[1]<=i&&Nt(u,a,t)<0&&--e,u=a;return 0!==e}([t,i]),n=y&&e,r=u.length;(n||r)&&(l.polygonStart(),n&&(l.lineStart(),k(null,null,1,l),l.lineEnd()),r&&Zn(u,o,e,k,l),l.polygonEnd()),u=c=d=null}};function k(a,o,l,u){var c=0,d=0;if(null==a||(c=r(a,l))!==(d=r(o,l))||s(a,o)<0^l>0)do{u.point(0===c||3===c?t:n,c>1?i:e)}while((c=(c+l+4)%4)!==d);else u.point(o[0],o[1])}function L(r,a){return t<=r&&r<=n&&e<=a&&a<=i}function S(t,e){L(t,e)&&l.point(t,e)}function T(t,e){var n=L(t=Math.max(-oi,Math.min(oi,t)),e=Math.max(-oi,Math.min(oi,e)));if(c&&d.push([t,e]),_)h=t,f=e,m=n,_=!1,n&&(l.lineStart(),l.point(t,e));else if(n&&v)l.point(t,e);else{var i={a:{x:p,y:g},b:{x:t,y:e}};x(i)?(v||(l.lineStart(),l.point(i.a.x,i.a.y)),l.point(i.b.x,i.b.y),n||l.lineEnd(),y=!1):n&&(l.lineStart(),l.point(t,e),y=!1)}p=t,g=e,v=n}return w};function r(i,r){return x(i[0]-t)<St?r>0?0:3:x(i[0]-n)<St?r>0?2:1:x(i[1]-e)<St?r>0?1:0:r>0?3:2}function o(t,e){return s(t.x,e.x)}function s(t,e){var n=r(t,1),i=r(e,1);return n!==i?n-i:0===n?e[1]-t[1]:1===n?t[0]-e[0]:2===n?t[1]-e[1]:e[0]-t[0]}}function li(t){var e=0,n=Yt/3,i=Ci(t),r=i(e,n);return r.parallels=function(t){return arguments.length?i(e=t[0]*Yt/180,n=t[1]*Yt/180):[e/Yt*180,n/Yt*180]},r}function ui(t,e){var n=Math.sin(t),i=(n+Math.sin(e))/2,r=1+n*(2*i-n),a=Math.sqrt(r)/i;function o(t,e){var n=Math.sqrt(r-2*i*Math.sin(e))/i;return[n*Math.sin(t*=i),a-n*Math.cos(t)]}return o.invert=function(t,e){var n=a-e;return[Math.atan2(t,n)/i,Vt((r-(t*t+n*n)*i*i)/(2*i))]},o}a.geo.clipExtent=function(){var t,e,n,i,r,a,o={stream:function(t){return r&&(r.valid=!1),(r=a(t)).valid=!0,r},extent:function(s){return arguments.length?(a=si(t=+s[0][0],e=+s[0][1],n=+s[1][0],i=+s[1][1]),r&&(r.valid=!1,r=null),o):[[t,e],[n,i]]}};return o.extent([[0,0],[960,500]])},(a.geo.conicEqualArea=function(){return li(ui)}).raw=ui,a.geo.albers=function(){return a.geo.conicEqualArea().rotate([96,0]).center([-.6,38.7]).parallels([29.5,45.5]).scale(1070)},a.geo.albersUsa=function(){var t,e,n,i,r=a.geo.albers(),o=a.geo.conicEqualArea().rotate([154,0]).center([-2,58.5]).parallels([55,65]),s=a.geo.conicEqualArea().rotate([157,0]).center([-3,19.9]).parallels([8,18]),l={point:function(e,n){t=[e,n]}};function u(r){var a=r[0],o=r[1];return t=null,e(a,o),t||(n(a,o),t)||i(a,o),t}return u.invert=function(t){var e=r.scale(),n=r.translate(),i=(t[0]-n[0])/e,a=(t[1]-n[1])/e;return(a>=.12&&a<.234&&i>=-.425&&i<-.214?o:a>=.166&&a<.234&&i>=-.214&&i<-.115?s:r).invert(t)},u.stream=function(t){var e=r.stream(t),n=o.stream(t),i=s.stream(t);return{point:function(t,r){e.point(t,r),n.point(t,r),i.point(t,r)},sphere:function(){e.sphere(),n.sphere(),i.sphere()},lineStart:function(){e.lineStart(),n.lineStart(),i.lineStart()},lineEnd:function(){e.lineEnd(),n.lineEnd(),i.lineEnd()},polygonStart:function(){e.polygonStart(),n.polygonStart(),i.polygonStart()},polygonEnd:function(){e.polygonEnd(),n.polygonEnd(),i.polygonEnd()}}},u.precision=function(t){return arguments.length?(r.precision(t),o.precision(t),s.precision(t),u):r.precision()},u.scale=function(t){return arguments.length?(r.scale(t),o.scale(.35*t),s.scale(t),u.translate(r.translate())):r.scale()},u.translate=function(t){if(!arguments.length)return r.translate();var a=r.scale(),c=+t[0],d=+t[1];return e=r.translate(t).clipExtent([[c-.455*a,d-.238*a],[c+.455*a,d+.238*a]]).stream(l).point,n=o.translate([c-.307*a,d+.201*a]).clipExtent([[c-.425*a+St,d+.12*a+St],[c-.214*a-St,d+.234*a-St]]).stream(l).point,i=s.translate([c-.205*a,d+.212*a]).clipExtent([[c-.214*a+St,d+.166*a+St],[c-.115*a-St,d+.234*a-St]]).stream(l).point,u},u.scale(1070)};var ci,di,hi,fi,mi,pi,gi={point:F,lineStart:F,lineEnd:F,polygonStart:function(){di=0,gi.lineStart=vi},polygonEnd:function(){gi.lineStart=gi.lineEnd=gi.point=F,ci+=x(di/2)}};function vi(){var t,e,n,i;function r(t,e){di+=i*t-n*e,n=t,i=e}gi.point=function(a,o){gi.point=r,t=n=a,e=i=o},gi.lineEnd=function(){r(t,e)}}var _i={point:function(t,e){t<hi&&(hi=t);t>mi&&(mi=t);e<fi&&(fi=e);e>pi&&(pi=e)},lineStart:F,lineEnd:F,polygonStart:F,polygonEnd:F};function yi(t){return"m0,"+t+"a"+t+","+t+" 0 1,1 0,"+-2*t+"a"+t+","+t+" 0 1,1 0,"+2*t+"z"}var bi,Mi={point:xi,lineStart:wi,lineEnd:ki,polygonStart:function(){Mi.lineStart=Li},polygonEnd:function(){Mi.point=xi,Mi.lineStart=wi,Mi.lineEnd=ki}};function xi(t,e){wn+=t,kn+=e,++Ln}function wi(){var t,e;function n(n,i){var r=n-t,a=i-e,o=Math.sqrt(r*r+a*a);Sn+=o*(t+n)/2,Tn+=o*(e+i)/2,Yn+=o,xi(t=n,e=i)}Mi.point=function(i,r){Mi.point=n,xi(t=i,e=r)}}function ki(){Mi.point=xi}function Li(){var t,e,n,i;function r(t,e){var r=t-n,a=e-i,o=Math.sqrt(r*r+a*a);Sn+=o*(n+t)/2,Tn+=o*(i+e)/2,Yn+=o,Dn+=(o=i*t-n*e)*(n+t),Cn+=o*(i+e),En+=3*o,xi(n=t,i=e)}Mi.point=function(a,o){Mi.point=r,xi(t=n=a,e=i=o)},Mi.lineEnd=function(){r(t,e)}}function Si(t){var e=.5,n=Math.cos(30*At),i=16;function r(e){return(i?function(e){var n,r,o,s,l,u,c,d,h,f,m,p,g={point:v,lineStart:_,lineEnd:b,polygonStart:function(){e.polygonStart(),g.lineStart=M},polygonEnd:function(){e.polygonEnd(),g.lineStart=_}};function v(n,i){n=t(n,i),e.point(n[0],n[1])}function _(){d=NaN,g.point=y,e.lineStart()}function y(n,r){var o=Nn([n,r]),s=t(n,r);a(d,h,c,f,m,p,d=s[0],h=s[1],c=n,f=o[0],m=o[1],p=o[2],i,e),e.point(d,h)}function b(){g.point=v,e.lineEnd()}function M(){_(),g.point=x,g.lineEnd=w}function x(t,e){y(n=t,e),r=d,o=h,s=f,l=m,u=p,g.point=y}function w(){a(d,h,c,f,m,p,r,o,n,s,l,u,i,e),g.lineEnd=b,b()}return g}:function(e){return Yi(e,function(n,i){n=t(n,i),e.point(n[0],n[1])})})(e)}function a(i,r,o,s,l,u,c,d,h,f,m,p,g,v){var _=c-i,y=d-r,b=_*_+y*y;if(b>4*e&&g--){var M=s+f,w=l+m,k=u+p,L=Math.sqrt(M*M+w*w+k*k),S=Math.asin(k/=L),T=x(x(k)-1)<St||x(o-h)<St?(o+h)/2:Math.atan2(w,M),Y=t(T,S),D=Y[0],C=Y[1],E=D-i,A=C-r,O=y*E-_*A;(O*O/b>e||x((_*E+y*A)/b-.5)>.3||s*f+l*m+u*p<n)&&(a(i,r,o,s,l,u,D,C,T,M/=L,w/=L,k,g,v),v.point(D,C),a(D,C,T,M,w,k,c,d,h,f,m,p,g,v))}}return r.precision=function(t){return arguments.length?(i=(e=t*t)>0&&16,r):Math.sqrt(e)},r}function Ti(t){this.stream=t}function Yi(t,e){return{point:e,sphere:function(){t.sphere()},lineStart:function(){t.lineStart()},lineEnd:function(){t.lineEnd()},polygonStart:function(){t.polygonStart()},polygonEnd:function(){t.polygonEnd()}}}function Di(t){return Ci(function(){return t})()}function Ci(t){var e,n,i,r,o,s,l=Si(function(t,n){return[(t=e(t,n))[0]*u+r,o-t[1]*u]}),u=150,c=480,d=250,h=0,f=0,m=0,p=0,g=0,v=ri,_=N,y=null,b=null;function M(t){return[(t=i(t[0]*At,t[1]*At))[0]*u+r,o-t[1]*u]}function w(t){return(t=i.invert((t[0]-r)/u,(o-t[1])/u))&&[t[0]*Ot,t[1]*Ot]}function k(){i=Jn(n=ji(m,p,g),e);var t=e(h,f);return r=c-t[0]*u,o=d+t[1]*u,L()}function L(){return s&&(s.valid=!1,s=null),M}return M.stream=function(t){return s&&(s.valid=!1),(s=Ei(v(n,l(_(t))))).valid=!0,s},M.clipAngle=function(t){return arguments.length?(v=null==t?(y=t,ri):function(t){var e=Math.cos(t),n=e>0,i=x(e)>St;return ti(r,function(t){var e,s,l,u,c;return{lineStart:function(){u=l=!1,c=1},point:function(d,h){var f,m=[d,h],p=r(d,h),g=n?p?0:o(d,h):p?o(d+(d<0?Yt:-Yt),h):0;if(!e&&(u=l=p)&&t.lineStart(),p!==l&&(f=a(e,m),(Wn(e,f)||Wn(m,f))&&(m[0]+=St,m[1]+=St,p=r(m[0],m[1]))),p!==l)c=0,p?(t.lineStart(),f=a(m,e),t.point(f[0],f[1])):(f=a(e,m),t.point(f[0],f[1]),t.lineEnd()),e=f;else if(i&&e&&n^p){var v;g&s||!(v=a(m,e,!0))||(c=0,n?(t.lineStart(),t.point(v[0][0],v[0][1]),t.point(v[1][0],v[1][1]),t.lineEnd()):(t.point(v[1][0],v[1][1]),t.lineEnd(),t.lineStart(),t.point(v[0][0],v[0][1])))}!p||e&&Wn(e,m)||t.point(m[0],m[1]),e=m,l=p,s=g},lineEnd:function(){l&&t.lineEnd(),e=null},clean:function(){return c|(u&&l)<<1}}},Pi(t,6*At),n?[0,-t]:[-Yt,t-Yt]);function r(t,n){return Math.cos(t)*Math.cos(n)>e}function a(t,n,i){var r=[1,0,0],a=Vn(Nn(t),Nn(n)),o=Hn(a,a),s=a[0],l=o-s*s;if(!l)return!i&&t;var u=e*o/l,c=-e*s/l,d=Vn(r,a),h=Fn(r,u);Pn(h,Fn(a,c));var f=d,m=Hn(h,f),p=Hn(f,f),g=m*m-p*(Hn(h,h)-1);if(!(g<0)){var v=Math.sqrt(g),_=Fn(f,(-m-v)/p);if(Pn(_,h),_=Rn(_),!i)return _;var y,b=t[0],M=n[0],w=t[1],k=n[1];M<b&&(y=b,b=M,M=y);var L=M-b,S=x(L-Yt)<St;if(!S&&k<w&&(y=w,w=k,k=y),S||L<St?S?w+k>0^_[1]<(x(_[0]-b)<St?w:k):w<=_[1]&&_[1]<=k:L>Yt^(b<=_[0]&&_[0]<=M)){var T=Fn(f,(-m+v)/p);return Pn(T,h),[_,Rn(T)]}}}function o(e,i){var r=n?t:Yt-t,a=0;return e<-r?a|=1:e>r&&(a|=2),i<-r?a|=4:i>r&&(a|=8),a}}((y=+t)*At),L()):y},M.clipExtent=function(t){return arguments.length?(b=t,_=t?si(t[0][0],t[0][1],t[1][0],t[1][1]):N,L()):b},M.scale=function(t){return arguments.length?(u=+t,k()):u},M.translate=function(t){return arguments.length?(c=+t[0],d=+t[1],k()):[c,d]},M.center=function(t){return arguments.length?(h=t[0]%360*At,f=t[1]%360*At,k()):[h*Ot,f*Ot]},M.rotate=function(t){return arguments.length?(m=t[0]%360*At,p=t[1]%360*At,g=t.length>2?t[2]%360*At:0,k()):[m*Ot,p*Ot,g*Ot]},a.rebind(M,l,"precision"),function(){return e=t.apply(this,arguments),M.invert=e.invert&&w,k()}}function Ei(t){return Yi(t,function(e,n){t.point(e*At,n*At)})}function Ai(t,e){return[t,e]}function Oi(t,e){return[t>Yt?t-Dt:t<-Yt?t+Dt:t,e]}function ji(t,e,n){return t?e||n?Jn(Hi(t),Vi(e,n)):Hi(t):e||n?Vi(e,n):Oi}function Ni(t){return function(e,n){return[(e+=t)>Yt?e-Dt:e<-Yt?e+Dt:e,n]}}function Hi(t){var e=Ni(t);return e.invert=Ni(-t),e}function Vi(t,e){var n=Math.cos(t),i=Math.sin(t),r=Math.cos(e),a=Math.sin(e);function o(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*n+s*i;return[Math.atan2(l*r-c*a,s*n-u*i),Vt(c*r+l*a)]}return o.invert=function(t,e){var o=Math.cos(e),s=Math.cos(t)*o,l=Math.sin(t)*o,u=Math.sin(e),c=u*r-l*a;return[Math.atan2(l*r+u*a,s*n+c*i),Vt(c*n-s*i)]},o}function Pi(t,e){var n=Math.cos(t),i=Math.sin(t);return function(r,a,o,s){var l=o*e;null!=r?(r=Fi(n,r),a=Fi(n,a),(o>0?r<a:r>a)&&(r+=o*Dt)):(r=t+o*Dt,a=t-.5*l);for(var u,c=r;o>0?c>a:c<a;c-=l)s.point((u=Rn([n,-i*Math.cos(c),-i*Math.sin(c)]))[0],u[1])}}function Fi(t,e){var n=Nn(e);n[0]-=t,In(n);var i=Ht(-n[1]);return((-n[2]<0?-i:i)+2*Math.PI-St)%(2*Math.PI)}function Ii(t,e,n){var i=a.range(t,e-St,n).concat(e);return function(t){return i.map(function(e){return[t,e]})}}function Ri(t,e,n){var i=a.range(t,e-St,n).concat(e);return function(t){return i.map(function(e){return[e,t]})}}function Wi(t){return t.source}function zi(t){return t.target}a.geo.path=function(){var t,e,n,i,r,o=4.5;function s(t){return t&&("function"==typeof o&&i.pointRadius(+o.apply(this,arguments)),r&&r.valid||(r=n(i)),a.geo.stream(t,r)),i.result()}function l(){return r=null,s}return s.area=function(t){return ci=0,a.geo.stream(t,n(gi)),ci},s.centroid=function(t){return wn=kn=Ln=Sn=Tn=Yn=Dn=Cn=En=0,a.geo.stream(t,n(Mi)),En?[Dn/En,Cn/En]:Yn?[Sn/Yn,Tn/Yn]:Ln?[wn/Ln,kn/Ln]:[NaN,NaN]},s.bounds=function(t){return mi=pi=-(hi=fi=1/0),a.geo.stream(t,n(_i)),[[hi,fi],[mi,pi]]},s.projection=function(e){return arguments.length?(n=(t=e)?e.stream||function(t){var e=Si(function(e,n){return t([e*Ot,n*Ot])});return function(t){return Ei(e(t))}}(e):N,l()):t},s.context=function(t){return arguments.length?(i=null==(e=t)?new function(){var t=yi(4.5),e=[],n={point:i,lineStart:function(){n.point=r},lineEnd:o,polygonStart:function(){n.lineEnd=s},polygonEnd:function(){n.lineEnd=o,n.point=i},pointRadius:function(e){return t=yi(e),n},result:function(){if(e.length){var t=e.join("");return e=[],t}}};function i(n,i){e.push("M",n,",",i,t)}function r(t,i){e.push("M",t,",",i),n.point=a}function a(t,n){e.push("L",t,",",n)}function o(){n.point=i}function s(){e.push("Z")}return n}:new function(t){var e=4.5,n={point:i,lineStart:function(){n.point=r},lineEnd:o,polygonStart:function(){n.lineEnd=s},polygonEnd:function(){n.lineEnd=o,n.point=i},pointRadius:function(t){return e=t,n},result:F};function i(n,i){t.moveTo(n+e,i),t.arc(n,i,e,0,Dt)}function r(e,i){t.moveTo(e,i),n.point=a}function a(e,n){t.lineTo(e,n)}function o(){n.point=i}function s(){t.closePath()}return n}(t),"function"!=typeof o&&i.pointRadius(o),l()):e},s.pointRadius=function(t){return arguments.length?(o="function"==typeof t?t:(i.pointRadius(+t),+t),s):o},s.projection(a.geo.albersUsa()).context(null)},a.geo.transform=function(t){return{stream:function(e){var n=new Ti(e);for(var i in t)n[i]=t[i];return n}}},Ti.prototype={point:function(t,e){this.stream.point(t,e)},sphere:function(){this.stream.sphere()},lineStart:function(){this.stream.lineStart()},lineEnd:function(){this.stream.lineEnd()},polygonStart:function(){this.stream.polygonStart()},polygonEnd:function(){this.stream.polygonEnd()}},a.geo.projection=Di,a.geo.projectionMutator=Ci,(a.geo.equirectangular=function(){return Di(Ai)}).raw=Ai.invert=Ai,a.geo.rotation=function(t){function e(e){return(e=t(e[0]*At,e[1]*At))[0]*=Ot,e[1]*=Ot,e}return t=ji(t[0]%360*At,t[1]*At,t.length>2?t[2]*At:0),e.invert=function(e){return(e=t.invert(e[0]*At,e[1]*At))[0]*=Ot,e[1]*=Ot,e},e},Oi.invert=Ai,a.geo.circle=function(){var t,e,n=[0,0],i=6;function r(){var t="function"==typeof n?n.apply(this,arguments):n,i=ji(-t[0]*At,-t[1]*At,0).invert,r=[];return e(null,null,1,{point:function(t,e){r.push(t=i(t,e)),t[0]*=Ot,t[1]*=Ot}}),{type:"Polygon",coordinates:[r]}}return r.origin=function(t){return arguments.length?(n=t,r):n},r.angle=function(n){return arguments.length?(e=Pi((t=+n)*At,i*At),r):t},r.precision=function(n){return arguments.length?(e=Pi(t*At,(i=+n)*At),r):i},r.angle(90)},a.geo.distance=function(t,e){var n,i=(e[0]-t[0])*At,r=t[1]*At,a=e[1]*At,o=Math.sin(i),s=Math.cos(i),l=Math.sin(r),u=Math.cos(r),c=Math.sin(a),d=Math.cos(a);return Math.atan2(Math.sqrt((n=d*o)*n+(n=u*c-l*d*s)*n),l*c+u*d*s)},a.geo.graticule=function(){var t,e,n,i,r,o,s,l,u,c,d,h,f=10,m=f,p=90,g=360,v=2.5;function _(){return{type:"MultiLineString",coordinates:y()}}function y(){return a.range(Math.ceil(i/p)*p,n,p).map(d).concat(a.range(Math.ceil(l/g)*g,s,g).map(h)).concat(a.range(Math.ceil(e/f)*f,t,f).filter(function(t){return x(t%p)>St}).map(u)).concat(a.range(Math.ceil(o/m)*m,r,m).filter(function(t){return x(t%g)>St}).map(c))}return _.lines=function(){return y().map(function(t){return{type:"LineString",coordinates:t}})},_.outline=function(){return{type:"Polygon",coordinates:[d(i).concat(h(s).slice(1),d(n).reverse().slice(1),h(l).reverse().slice(1))]}},_.extent=function(t){return arguments.length?_.majorExtent(t).minorExtent(t):_.minorExtent()},_.majorExtent=function(t){return arguments.length?(i=+t[0][0],n=+t[1][0],l=+t[0][1],s=+t[1][1],i>n&&(t=i,i=n,n=t),l>s&&(t=l,l=s,s=t),_.precision(v)):[[i,l],[n,s]]},_.minorExtent=function(n){return arguments.length?(e=+n[0][0],t=+n[1][0],o=+n[0][1],r=+n[1][1],e>t&&(n=e,e=t,t=n),o>r&&(n=o,o=r,r=n),_.precision(v)):[[e,o],[t,r]]},_.step=function(t){return arguments.length?_.majorStep(t).minorStep(t):_.minorStep()},_.majorStep=function(t){return arguments.length?(p=+t[0],g=+t[1],_):[p,g]},_.minorStep=function(t){return arguments.length?(f=+t[0],m=+t[1],_):[f,m]},_.precision=function(a){return arguments.length?(v=+a,u=Ii(o,r,90),c=Ri(e,t,v),d=Ii(l,s,90),h=Ri(i,n,v),_):v},_.majorExtent([[-180,-90+St],[180,90-St]]).minorExtent([[-180,-80-St],[180,80+St]])},a.geo.greatArc=function(){var t,e,n=Wi,i=zi;function r(){return{type:"LineString",coordinates:[t||n.apply(this,arguments),e||i.apply(this,arguments)]}}return r.distance=function(){return a.geo.distance(t||n.apply(this,arguments),e||i.apply(this,arguments))},r.source=function(e){return arguments.length?(n=e,t="function"==typeof e?null:e,r):n},r.target=function(t){return arguments.length?(i=t,e="function"==typeof t?null:t,r):i},r.precision=function(){return arguments.length?r:0},r},a.geo.interpolate=function(t,e){return function(t,e,n,i){var r=Math.cos(e),a=Math.sin(e),o=Math.cos(i),s=Math.sin(i),l=r*Math.cos(t),u=r*Math.sin(t),c=o*Math.cos(n),d=o*Math.sin(n),h=2*Math.asin(Math.sqrt(Ft(i-e)+r*o*Ft(n-t))),f=1/Math.sin(h),m=h?function(t){var e=Math.sin(t*=h)*f,n=Math.sin(h-t)*f,i=n*l+e*c,r=n*u+e*d,o=n*a+e*s;return[Math.atan2(r,i)*Ot,Math.atan2(o,Math.sqrt(i*i+r*r))*Ot]}:function(){return[t*Ot,e*Ot]};return m.distance=h,m}(t[0]*At,t[1]*At,e[0]*At,e[1]*At)},a.geo.length=function(t){return bi=0,a.geo.stream(t,Bi),bi};var Bi={sphere:F,point:F,lineStart:function(){var t,e,n;function i(i,r){var a=Math.sin(r*=At),o=Math.cos(r),s=x((i*=At)-t),l=Math.cos(s);bi+=Math.atan2(Math.sqrt((s=o*Math.sin(s))*s+(s=n*a-e*o*l)*s),e*a+n*o*l),t=i,e=a,n=o}Bi.point=function(r,a){t=r*At,e=Math.sin(a*=At),n=Math.cos(a),Bi.point=i},Bi.lineEnd=function(){Bi.point=Bi.lineEnd=F}},lineEnd:F,polygonStart:F,polygonEnd:F};function Ui(t,e){function n(e,n){var i=Math.cos(e),r=Math.cos(n),a=t(i*r);return[a*r*Math.sin(e),a*Math.sin(n)]}return n.invert=function(t,n){var i=Math.sqrt(t*t+n*n),r=e(i),a=Math.sin(r),o=Math.cos(r);return[Math.atan2(t*a,i*o),Math.asin(i&&n*a/i)]},n}var Gi=Ui(function(t){return Math.sqrt(2/(1+t))},function(t){return 2*Math.asin(t/2)});(a.geo.azimuthalEqualArea=function(){return Di(Gi)}).raw=Gi;var $i=Ui(function(t){var e=Math.acos(t);return e&&e/Math.sin(e)},N);function qi(t,e){var n=Math.cos(t),i=function(t){return Math.tan(Yt/4+t/2)},r=t===e?Math.sin(t):Math.log(n/Math.cos(e))/Math.log(i(e)/i(t)),a=n*Math.pow(i(t),r)/r;if(!r)return Zi;function o(t,e){a>0?e<-Et+St&&(e=-Et+St):e>Et-St&&(e=Et-St);var n=a/Math.pow(i(e),r);return[n*Math.sin(r*t),a-n*Math.cos(r*t)]}return o.invert=function(t,e){var n=a-e,i=jt(r)*Math.sqrt(t*t+n*n);return[Math.atan2(t,n)/r,2*Math.atan(Math.pow(a/i,1/r))-Et]},o}function Ji(t,e){var n=Math.cos(t),i=t===e?Math.sin(t):(n-Math.cos(e))/(e-t),r=n/i+t;if(x(i)<St)return Ai;function a(t,e){var n=r-e;return[n*Math.sin(i*t),r-n*Math.cos(i*t)]}return a.invert=function(t,e){var n=r-e;return[Math.atan2(t,n)/i,r-jt(i)*Math.sqrt(t*t+n*n)]},a}(a.geo.azimuthalEquidistant=function(){return Di($i)}).raw=$i,(a.geo.conicConformal=function(){return li(qi)}).raw=qi,(a.geo.conicEquidistant=function(){return li(Ji)}).raw=Ji;var Xi=Ui(function(t){return 1/t},Math.atan);function Zi(t,e){return[t,Math.log(Math.tan(Yt/4+e/2))]}function Ki(t){var e,n=Di(t),i=n.scale,r=n.translate,a=n.clipExtent;return n.scale=function(){var t=i.apply(n,arguments);return t===n?e?n.clipExtent(null):n:t},n.translate=function(){var t=r.apply(n,arguments);return t===n?e?n.clipExtent(null):n:t},n.clipExtent=function(t){var o=a.apply(n,arguments);if(o===n){if(e=null==t){var s=Yt*i(),l=r();a([[l[0]-s,l[1]-s],[l[0]+s,l[1]+s]])}}else e&&(o=null);return o},n.clipExtent(null)}(a.geo.gnomonic=function(){return Di(Xi)}).raw=Xi,Zi.invert=function(t,e){return[t,2*Math.atan(Math.exp(e))-Et]},(a.geo.mercator=function(){return Ki(Zi)}).raw=Zi;var Qi=Ui(function(){return 1},Math.asin);(a.geo.orthographic=function(){return Di(Qi)}).raw=Qi;var tr=Ui(function(t){return 1/(1+t)},function(t){return 2*Math.atan(t)});function er(t,e){return[Math.log(Math.tan(Yt/4+e/2)),-t]}function nr(t){return t[0]}function ir(t){return t[1]}function rr(t){for(var e=t.length,n=[0,1],i=2,r=2;r<e;r++){for(;i>1&&Nt(t[n[i-2]],t[n[i-1]],t[r])<=0;)--i;n[i++]=r}return n.slice(0,i)}function ar(t,e){return t[0]-e[0]||t[1]-e[1]}(a.geo.stereographic=function(){return Di(tr)}).raw=tr,er.invert=function(t,e){return[-e,2*Math.atan(Math.exp(t))-Et]},(a.geo.transverseMercator=function(){var t=Ki(er),e=t.center,n=t.rotate;return t.center=function(t){return t?e([-t[1],t[0]]):[(t=e())[1],-t[0]]},t.rotate=function(t){return t?n([t[0],t[1],t.length>2?t[2]+90:90]):[(t=n())[0],t[1],t[2]-90]},n([0,0,90])}).raw=er,a.geom={},a.geom.hull=function(t){var e=nr,n=ir;if(arguments.length)return i(t);function i(t){if(t.length<3)return[];var i,r=ye(e),a=ye(n),o=t.length,s=[],l=[];for(i=0;i<o;i++)s.push([+r.call(this,t[i],i),+a.call(this,t[i],i),i]);for(s.sort(ar),i=0;i<o;i++)l.push([s[i][0],-s[i][1]]);var u=rr(s),c=rr(l),d=c[0]===u[0],h=c[c.length-1]===u[u.length-1],f=[];for(i=u.length-1;i>=0;--i)f.push(t[s[u[i]][2]]);for(i=+d;i<c.length-h;++i)f.push(t[s[c[i]][2]]);return f}return i.x=function(t){return arguments.length?(e=t,i):e},i.y=function(t){return arguments.length?(n=t,i):n},i},a.geom.polygon=function(t){return G(t,or),t};var or=a.geom.polygon.prototype=[];function sr(t,e,n){return(n[0]-e[0])*(t[1]-e[1])<(n[1]-e[1])*(t[0]-e[0])}function lr(t,e,n,i){var r=t[0],a=n[0],o=e[0]-r,s=i[0]-a,l=t[1],u=n[1],c=e[1]-l,d=i[1]-u,h=(s*(l-u)-d*(r-a))/(d*o-s*c);return[r+h*o,l+h*c]}function ur(t){var e=t[0],n=t[t.length-1];return!(e[0]-n[0]||e[1]-n[1])}or.area=function(){for(var t,e=-1,n=this.length,i=this[n-1],r=0;++e<n;)t=i,i=this[e],r+=t[1]*i[0]-t[0]*i[1];return.5*r},or.centroid=function(t){var e,n,i=-1,r=this.length,a=0,o=0,s=this[r-1];for(arguments.length||(t=-1/(6*this.area()));++i<r;)e=s,s=this[i],n=e[0]*s[1]-s[0]*e[1],a+=(e[0]+s[0])*n,o+=(e[1]+s[1])*n;return[a*t,o*t]},or.clip=function(t){for(var e,n,i,r,a,o,s=ur(t),l=-1,u=this.length-ur(this),c=this[u-1];++l<u;){for(e=t.slice(),t.length=0,r=this[l],a=e[(i=e.length-s)-1],n=-1;++n<i;)sr(o=e[n],c,r)?(sr(a,c,r)||t.push(lr(a,o,c,r)),t.push(o)):sr(a,c,r)&&t.push(lr(a,o,c,r)),a=o;s&&t.push(t[0]),c=r}return t};var cr,dr,hr,fr,mr,pr=[],gr=[];function vr(t){var e=pr.pop()||new function(){jr(this),this.edge=this.site=this.circle=null};return e.site=t,e}function _r(t){Sr(t),hr.remove(t),pr.push(t),jr(t)}function yr(t){var e=t.circle,n=e.x,i=e.cy,r={x:n,y:i},a=t.P,o=t.N,s=[t];_r(t);for(var l=a;l.circle&&x(n-l.circle.x)<St&&x(i-l.circle.cy)<St;)a=l.P,s.unshift(l),_r(l),l=a;s.unshift(l),Sr(l);for(var u=o;u.circle&&x(n-u.circle.x)<St&&x(i-u.circle.cy)<St;)o=u.N,s.push(u),_r(u),u=o;s.push(u),Sr(u);var c,d=s.length;for(c=1;c<d;++c)u=s[c],l=s[c-1],Er(u.edge,l.site,u.site,r);l=s[0],(u=s[d-1]).edge=Dr(l.site,u.site,null,r),Lr(l),Lr(u)}function br(t){for(var e,n,i,r,a=t.x,o=t.y,s=hr._;s;)if((i=Mr(s,o)-a)>St)s=s.L;else{if(!((r=a-xr(s,o))>St)){i>-St?(e=s.P,n=s):r>-St?(e=s,n=s.N):e=n=s;break}if(!s.R){e=s;break}s=s.R}var l=vr(t);if(hr.insert(e,l),e||n){if(e===n)return Sr(e),n=vr(e.site),hr.insert(l,n),l.edge=n.edge=Dr(e.site,l.site),Lr(e),void Lr(n);if(n){Sr(e),Sr(n);var u=e.site,c=u.x,d=u.y,h=t.x-c,f=t.y-d,m=n.site,p=m.x-c,g=m.y-d,v=2*(h*g-f*p),_=h*h+f*f,y=p*p+g*g,b={x:(g*_-f*y)/v+c,y:(h*y-p*_)/v+d};Er(n.edge,u,m,b),l.edge=Dr(u,t,null,b),n.edge=Dr(t,m,null,b),Lr(e),Lr(n)}else l.edge=Dr(e.site,l.site)}}function Mr(t,e){var n=t.site,i=n.x,r=n.y,a=r-e;if(!a)return i;var o=t.P;if(!o)return-1/0;var s=(n=o.site).x,l=n.y,u=l-e;if(!u)return s;var c=s-i,d=1/a-1/u,h=c/u;return d?(-h+Math.sqrt(h*h-2*d*(c*c/(-2*u)-l+u/2+r-a/2)))/d+i:(i+s)/2}function xr(t,e){var n=t.N;if(n)return Mr(n,e);var i=t.site;return i.y===e?i.x:1/0}function wr(t){this.site=t,this.edges=[]}function kr(t,e){return e.angle-t.angle}function Lr(t){var e=t.P,n=t.N;if(e&&n){var i=e.site,r=t.site,a=n.site;if(i!==a){var o=r.x,s=r.y,l=i.x-o,u=i.y-s,c=a.x-o,d=2*(l*(g=a.y-s)-u*c);if(!(d>=-Tt)){var h=l*l+u*u,f=c*c+g*g,m=(g*h-u*f)/d,p=(l*f-c*h)/d,g=p+s,v=gr.pop()||new function(){jr(this),this.x=this.y=this.arc=this.site=this.cy=null};v.arc=t,v.site=r,v.x=m+o,v.y=g+Math.sqrt(m*m+p*p),v.cy=g,t.circle=v;for(var _=null,y=mr._;y;)if(v.y<y.y||v.y===y.y&&v.x<=y.x){if(!y.L){_=y.P;break}y=y.L}else{if(!y.R){_=y;break}y=y.R}mr.insert(_,v),_||(fr=v)}}}}function Sr(t){var e=t.circle;e&&(e.P||(fr=e.N),mr.remove(e),gr.push(e),jr(e),t.circle=null)}function Tr(t,e){var n=t.b;if(n)return!0;var i,r,a=t.a,o=e[0][0],s=e[1][0],l=e[0][1],u=e[1][1],c=t.l,d=t.r,h=c.x,f=c.y,m=d.x,p=d.y,g=(h+m)/2,v=(f+p)/2;if(p===f){if(g<o||g>=s)return;if(h>m){if(a){if(a.y>=u)return}else a={x:g,y:l};n={x:g,y:u}}else{if(a){if(a.y<l)return}else a={x:g,y:u};n={x:g,y:l}}}else if(r=v-(i=(h-m)/(p-f))*g,i<-1||i>1)if(h>m){if(a){if(a.y>=u)return}else a={x:(l-r)/i,y:l};n={x:(u-r)/i,y:u}}else{if(a){if(a.y<l)return}else a={x:(u-r)/i,y:u};n={x:(l-r)/i,y:l}}else if(f<p){if(a){if(a.x>=s)return}else a={x:o,y:i*o+r};n={x:s,y:i*s+r}}else{if(a){if(a.x<o)return}else a={x:s,y:i*s+r};n={x:o,y:i*o+r}}return t.a=a,t.b=n,!0}function Yr(t,e){this.l=t,this.r=e,this.a=this.b=null}function Dr(t,e,n,i){var r=new Yr(t,e);return cr.push(r),n&&Er(r,t,e,n),i&&Er(r,e,t,i),dr[t.i].edges.push(new Ar(r,t,e)),dr[e.i].edges.push(new Ar(r,e,t)),r}function Cr(t,e,n){var i=new Yr(t,null);return i.a=e,i.b=n,cr.push(i),i}function Er(t,e,n,i){t.a||t.b?t.l===n?t.b=i:t.a=i:(t.a=i,t.l=e,t.r=n)}function Ar(t,e,n){var i=t.a,r=t.b;this.edge=t,this.site=e,this.angle=n?Math.atan2(n.y-e.y,n.x-e.x):t.l===e?Math.atan2(r.x-i.x,i.y-r.y):Math.atan2(i.x-r.x,r.y-i.y)}function Or(){this._=null}function jr(t){t.U=t.C=t.L=t.R=t.P=t.N=null}function Nr(t,e){var n=e,i=e.R,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.R=i.L,n.R&&(n.R.U=n),i.L=n}function Hr(t,e){var n=e,i=e.L,r=n.U;r?r.L===n?r.L=i:r.R=i:t._=i,i.U=r,n.U=i,n.L=i.R,n.L&&(n.L.U=n),i.R=n}function Vr(t){for(;t.L;)t=t.L;return t}function Pr(t,e){var n,i,r,a=t.sort(Fr).pop();for(cr=[],dr=new Array(t.length),hr=new Or,mr=new Or;;)if(r=fr,a&&(!r||a.y<r.y||a.y===r.y&&a.x<r.x))a.x===n&&a.y===i||(dr[a.i]=new wr(a),br(a),n=a.x,i=a.y),a=t.pop();else{if(!r)break;yr(r.arc)}e&&(function(t){for(var e,n=cr,i=ai(t[0][0],t[0][1],t[1][0],t[1][1]),r=n.length;r--;)(!Tr(e=n[r],t)||!i(e)||x(e.a.x-e.b.x)<St&&x(e.a.y-e.b.y)<St)&&(e.a=e.b=null,n.splice(r,1))}(e),function(t){for(var e,n,i,r,a,o,s,l,u,c,d=t[0][0],h=t[1][0],f=t[0][1],m=t[1][1],p=dr,g=p.length;g--;)if((a=p[g])&&a.prepare())for(l=(s=a.edges).length,o=0;o<l;)i=(c=s[o].end()).x,r=c.y,e=(u=s[++o%l].start()).x,n=u.y,(x(i-e)>St||x(r-n)>St)&&(s.splice(o,0,new Ar(Cr(a.site,c,x(i-d)<St&&m-r>St?{x:d,y:x(e-d)<St?n:m}:x(r-m)<St&&h-i>St?{x:x(n-m)<St?e:h,y:m}:x(i-h)<St&&r-f>St?{x:h,y:x(e-h)<St?n:f}:x(r-f)<St&&i-d>St?{x:x(n-f)<St?e:d,y:f}:null),a.site,null)),++l)}(e));var o={cells:dr,edges:cr};return hr=mr=cr=dr=null,o}function Fr(t,e){return e.y-t.y||e.x-t.x}wr.prototype.prepare=function(){for(var t,e=this.edges,n=e.length;n--;)(t=e[n].edge).b&&t.a||e.splice(n,1);return e.sort(kr),e.length},Ar.prototype={start:function(){return this.edge.l===this.site?this.edge.a:this.edge.b},end:function(){return this.edge.l===this.site?this.edge.b:this.edge.a}},Or.prototype={insert:function(t,e){var n,i,r;if(t){if(e.P=t,e.N=t.N,t.N&&(t.N.P=e),t.N=e,t.R){for(t=t.R;t.L;)t=t.L;t.L=e}else t.R=e;n=t}else this._?(t=Vr(this._),e.P=null,e.N=t,t.P=t.L=e,n=t):(e.P=e.N=null,this._=e,n=null);for(e.L=e.R=null,e.U=n,e.C=!0,t=e;n&&n.C;)n===(i=n.U).L?(r=i.R)&&r.C?(n.C=r.C=!1,i.C=!0,t=i):(t===n.R&&(Nr(this,n),n=(t=n).U),n.C=!1,i.C=!0,Hr(this,i)):(r=i.L)&&r.C?(n.C=r.C=!1,i.C=!0,t=i):(t===n.L&&(Hr(this,n),n=(t=n).U),n.C=!1,i.C=!0,Nr(this,i)),n=t.U;this._.C=!1},remove:function(t){t.N&&(t.N.P=t.P),t.P&&(t.P.N=t.N),t.N=t.P=null;var e,n,i,r=t.U,a=t.L,o=t.R;if(n=a?o?Vr(o):a:o,r?r.L===t?r.L=n:r.R=n:this._=n,a&&o?(i=n.C,n.C=t.C,n.L=a,a.U=n,n!==o?(r=n.U,n.U=t.U,t=n.R,r.L=t,n.R=o,o.U=n):(n.U=r,r=n,t=n.R)):(i=t.C,t=n),t&&(t.U=r),!i)if(t&&t.C)t.C=!1;else{do{if(t===this._)break;if(t===r.L){if((e=r.R).C&&(e.C=!1,r.C=!0,Nr(this,r),e=r.R),e.L&&e.L.C||e.R&&e.R.C){e.R&&e.R.C||(e.L.C=!1,e.C=!0,Hr(this,e),e=r.R),e.C=r.C,r.C=e.R.C=!1,Nr(this,r),t=this._;break}}else if((e=r.L).C&&(e.C=!1,r.C=!0,Hr(this,r),e=r.L),e.L&&e.L.C||e.R&&e.R.C){e.L&&e.L.C||(e.R.C=!1,e.C=!0,Nr(this,e),e=r.L),e.C=r.C,r.C=e.L.C=!1,Hr(this,r),t=this._;break}e.C=!0,t=r,r=r.U}while(!t.C);t&&(t.C=!1)}}},a.geom.voronoi=function(t){var e=nr,n=ir,i=e,r=n,a=Ir;if(t)return o(t);function o(t){var e=new Array(t.length),n=a[0][0],i=a[0][1],r=a[1][0],o=a[1][1];return Pr(s(t),a).cells.forEach(function(a,s){var l=a.edges,u=a.site;(e[s]=l.length?l.map(function(t){var e=t.start();return[e.x,e.y]}):u.x>=n&&u.x<=r&&u.y>=i&&u.y<=o?[[n,o],[r,o],[r,i],[n,i]]:[]).point=t[s]}),e}function s(t){return t.map(function(t,e){return{x:Math.round(i(t,e)/St)*St,y:Math.round(r(t,e)/St)*St,i:e}})}return o.links=function(t){return Pr(s(t)).edges.filter(function(t){return t.l&&t.r}).map(function(e){return{source:t[e.l.i],target:t[e.r.i]}})},o.triangles=function(t){var e=[];return Pr(s(t)).cells.forEach(function(n,i){for(var r,a=n.site,o=n.edges.sort(kr),s=-1,l=o.length,u=o[l-1].edge,c=u.l===a?u.r:u.l;++s<l;)u,r=c,c=(u=o[s].edge).l===a?u.r:u.l,i<r.i&&i<c.i&&Rr(a,r,c)<0&&e.push([t[i],t[r.i],t[c.i]])}),e},o.x=function(t){return arguments.length?(i=ye(e=t),o):e},o.y=function(t){return arguments.length?(r=ye(n=t),o):n},o.clipExtent=function(t){return arguments.length?(a=null==t?Ir:t,o):a===Ir?null:a},o.size=function(t){return arguments.length?o.clipExtent(t&&[[0,0],t]):a===Ir?null:a&&a[1]},o};var Ir=[[-1e6,-1e6],[1e6,1e6]];function Rr(t,e,n){return(t.x-n.x)*(e.y-t.y)-(t.x-e.x)*(n.y-t.y)}function Wr(t){return t.x}function zr(t){return t.y}function Br(t,e){t=a.rgb(t),e=a.rgb(e);var n=t.r,i=t.g,r=t.b,o=e.r-n,s=e.g-i,l=e.b-r;return function(t){return"#"+he(Math.round(n+o*t))+he(Math.round(i+s*t))+he(Math.round(r+l*t))}}function Ur(t,e){var n,i={},r={};for(n in t)n in e?i[n]=Xr(t[n],e[n]):r[n]=t[n];for(n in e)n in t||(r[n]=e[n]);return function(t){for(n in i)r[n]=i[n](t);return r}}function Gr(t,e){return t=+t,e=+e,function(n){return t*(1-n)+e*n}}function $r(t,e){var n,i,r,a=qr.lastIndex=Jr.lastIndex=0,o=-1,s=[],l=[];for(t+="",e+="";(n=qr.exec(t))&&(i=Jr.exec(e));)(r=i.index)>a&&(r=e.slice(a,r),s[o]?s[o]+=r:s[++o]=r),(n=n[0])===(i=i[0])?s[o]?s[o]+=i:s[++o]=i:(s[++o]=null,l.push({i:o,x:Gr(n,i)})),a=Jr.lastIndex;return a<e.length&&(r=e.slice(a),s[o]?s[o]+=r:s[++o]=r),s.length<2?l[0]?(e=l[0].x,function(t){return e(t)+""}):function(){return e}:(e=l.length,function(t){for(var n,i=0;i<e;++i)s[(n=l[i]).i]=n.x(t);return s.join("")})}a.geom.delaunay=function(t){return a.geom.voronoi().triangles(t)},a.geom.quadtree=function(t,e,n,i,r){var a,o=nr,s=ir;if(a=arguments.length)return o=Wr,s=zr,3===a&&(r=n,i=e,n=e=0),l(t);function l(t){var l,u,c,d,h,f,m,p,g,v=ye(o),_=ye(s);if(null!=e)f=e,m=n,p=i,g=r;else if(p=g=-(f=m=1/0),u=[],c=[],h=t.length,a)for(d=0;d<h;++d)(l=t[d]).x<f&&(f=l.x),l.y<m&&(m=l.y),l.x>p&&(p=l.x),l.y>g&&(g=l.y),u.push(l.x),c.push(l.y);else for(d=0;d<h;++d){var y=+v(l=t[d],d),b=+_(l,d);y<f&&(f=y),b<m&&(m=b),y>p&&(p=y),b>g&&(g=b),u.push(y),c.push(b)}var M=p-f,w=g-m;function k(t,e,n,i,r,a,o,s){if(!isNaN(n)&&!isNaN(i))if(t.leaf){var l=t.x,u=t.y;if(null!=l)if(x(l-n)+x(u-i)<.01)L(t,e,n,i,r,a,o,s);else{var c=t.point;t.x=t.y=t.point=null,L(t,c,l,u,r,a,o,s),L(t,e,n,i,r,a,o,s)}else t.x=n,t.y=i,t.point=e}else L(t,e,n,i,r,a,o,s)}function L(t,e,n,i,r,a,o,s){var l=.5*(r+o),u=.5*(a+s),c=n>=l,d=i>=u,h=d<<1|c;t.leaf=!1,t=t.nodes[h]||(t.nodes[h]={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(S,t,+v(t,++d),+_(t,d),f,m,p,g)}}),c?r=l:o=l,d?a=u:s=u,k(t,e,n,i,r,a,o,s)}M>w?g=m+M:p=f+w;var S={leaf:!0,nodes:[],point:null,x:null,y:null,add:function(t){k(S,t,+v(t,++d),+_(t,d),f,m,p,g)}};if(S.visit=function(t){!function t(e,n,i,r,a,o){if(!e(n,i,r,a,o)){var s=.5*(i+a),l=.5*(r+o),u=n.nodes;u[0]&&t(e,u[0],i,r,s,l),u[1]&&t(e,u[1],s,r,a,l),u[2]&&t(e,u[2],i,l,s,o),u[3]&&t(e,u[3],s,l,a,o)}}(t,S,f,m,p,g)},S.find=function(t){return function(t,e,n,i,r,a,o){var s,l=1/0;return function t(u,c,d,h,f){if(!(c>a||d>o||h<i||f<r)){if(m=u.point){var m,p=e-u.x,g=n-u.y,v=p*p+g*g;if(v<l){var _=Math.sqrt(l=v);i=e-_,r=n-_,a=e+_,o=n+_,s=m}}for(var y=u.nodes,b=.5*(c+h),M=.5*(d+f),x=(n>=M)<<1|e>=b,w=x+4;x<w;++x)if(u=y[3&x])switch(3&x){case 0:t(u,c,d,b,M);break;case 1:t(u,b,d,h,M);break;case 2:t(u,c,M,b,f);break;case 3:t(u,b,M,h,f)}}}(t,i,r,a,o),s}(S,t[0],t[1],f,m,p,g)},d=-1,null==e){for(;++d<h;)k(S,t[d],u[d],c[d],f,m,p,g);--d}else t.forEach(S.add);return u=c=t=l=null,S}return l.x=function(t){return arguments.length?(o=t,l):o},l.y=function(t){return arguments.length?(s=t,l):s},l.extent=function(t){return arguments.length?(null==t?e=n=i=r=null:(e=+t[0][0],n=+t[0][1],i=+t[1][0],r=+t[1][1]),l):null==e?null:[[e,n],[i,r]]},l.size=function(t){return arguments.length?(null==t?e=n=i=r=null:(e=n=0,i=+t[0],r=+t[1]),l):null==e?null:[i-e,r-n]},l},a.interpolateRgb=Br,a.interpolateObject=Ur,a.interpolateNumber=Gr,a.interpolateString=$r;var qr=/[-+]?(?:\d+\.?\d*|\.?\d+)(?:[eE][-+]?\d+)?/g,Jr=new RegExp(qr.source,"g");function Xr(t,e){for(var n,i=a.interpolators.length;--i>=0&&!(n=a.interpolators[i](t,e)););return n}function Zr(t,e){var n,i=[],r=[],a=t.length,o=e.length,s=Math.min(t.length,e.length);for(n=0;n<s;++n)i.push(Xr(t[n],e[n]));for(;n<a;++n)r[n]=t[n];for(;n<o;++n)r[n]=e[n];return function(t){for(n=0;n<s;++n)r[n]=i[n](t);return r}}a.interpolate=Xr,a.interpolators=[function(t,e){var n=typeof e;return("string"===n?_e.has(e.toLowerCase())||/^(#|rgb\(|hsl\()/i.test(e)?Br:$r:e instanceof Bt?Br:Array.isArray(e)?Zr:"object"===n&&isNaN(e)?Ur:Gr)(t,e)}],a.interpolateArray=Zr;var Kr=function(){return N},Qr=a.map({linear:Kr,poly:function(t){return function(e){return Math.pow(e,t)}},quad:function(){return ia},cubic:function(){return ra},sin:function(){return oa},exp:function(){return sa},circle:function(){return la},elastic:function(t,e){var n;arguments.length<2&&(e=.45);arguments.length?n=e/Dt*Math.asin(1/t):(t=1,n=e/4);return function(i){return 1+t*Math.pow(2,-10*i)*Math.sin((i-n)*Dt/e)}},back:function(t){t||(t=1.70158);return function(e){return e*e*((t+1)*e-t)}},bounce:function(){return ua}}),ta=a.map({in:N,out:ea,"in-out":na,"out-in":function(t){return na(ea(t))}});function ea(t){return function(e){return 1-t(1-e)}}function na(t){return function(e){return.5*(e<.5?t(2*e):2-t(2-2*e))}}function ia(t){return t*t}function ra(t){return t*t*t}function aa(t){if(t<=0)return 0;if(t>=1)return 1;var e=t*t,n=e*t;return 4*(t<.5?n:3*(t-e)+n-.75)}function oa(t){return 1-Math.cos(t*Et)}function sa(t){return Math.pow(2,10*(t-1))}function la(t){return 1-Math.sqrt(1-t*t)}function ua(t){return t<1/2.75?7.5625*t*t:t<2/2.75?7.5625*(t-=1.5/2.75)*t+.75:t<2.5/2.75?7.5625*(t-=2.25/2.75)*t+.9375:7.5625*(t-=2.625/2.75)*t+.984375}function ca(t,e){return e-=t,function(n){return Math.round(t+e*n)}}function da(t){var e=[t.a,t.b],n=[t.c,t.d],i=fa(e),r=ha(e,n),a=fa(function(t,e,n){return t[0]+=n*e[0],t[1]+=n*e[1],t}(n,e,-r))||0;e[0]*n[1]<n[0]*e[1]&&(e[0]*=-1,e[1]*=-1,i*=-1,r*=-1),this.rotate=(i?Math.atan2(e[1],e[0]):Math.atan2(-n[0],n[1]))*Ot,this.translate=[t.e,t.f],this.scale=[i,a],this.skew=a?Math.atan2(r,a)*Ot:0}function ha(t,e){return t[0]*e[0]+t[1]*e[1]}function fa(t){var e=Math.sqrt(ha(t,t));return e&&(t[0]/=e,t[1]/=e),e}a.ease=function(t){var e=t.indexOf("-"),n=e>=0?t.slice(0,e):t,i=e>=0?t.slice(e+1):"in";return n=Qr.get(n)||Kr,function(t){return function(e){return e<=0?0:e>=1?1:t(e)}}((i=ta.get(i)||N)(n.apply(null,o.call(arguments,1))))},a.interpolateHcl=function(t,e){t=a.hcl(t),e=a.hcl(e);var n=t.h,i=t.c,r=t.l,o=e.h-n,s=e.c-i,l=e.l-r;isNaN(s)&&(s=0,i=isNaN(i)?e.c:i);isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return Xt(n+o*t,i+s*t,r+l*t)+""}},a.interpolateHsl=function(t,e){t=a.hsl(t),e=a.hsl(e);var n=t.h,i=t.s,r=t.l,o=e.h-n,s=e.s-i,l=e.l-r;isNaN(s)&&(s=0,i=isNaN(i)?e.s:i);isNaN(o)?(o=0,n=isNaN(n)?e.h:n):o>180?o-=360:o<-180&&(o+=360);return function(t){return $t(n+o*t,i+s*t,r+l*t)+""}},a.interpolateLab=function(t,e){t=a.lab(t),e=a.lab(e);var n=t.l,i=t.a,r=t.b,o=e.l-n,s=e.a-i,l=e.b-r;return function(t){return ie(n+o*t,i+s*t,r+l*t)+""}},a.interpolateRound=ca,a.transform=function(t){var e=l.createElementNS(a.ns.prefix.svg,"g");return(a.transform=function(t){if(null!=t){e.setAttribute("transform",t);var n=e.transform.baseVal.consolidate()}return new da(n?n.matrix:ma)})(t)},da.prototype.toString=function(){return"translate("+this.translate+")rotate("+this.rotate+")skewX("+this.skew+")scale("+this.scale+")"};var ma={a:1,b:0,c:0,d:1,e:0,f:0};function pa(t){return t.length?t.pop()+",":""}function ga(t,e){var n=[],i=[];return t=a.transform(t),e=a.transform(e),function(t,e,n,i){if(t[0]!==e[0]||t[1]!==e[1]){var r=n.push("translate(",null,",",null,")");i.push({i:r-4,x:Gr(t[0],e[0])},{i:r-2,x:Gr(t[1],e[1])})}else(e[0]||e[1])&&n.push("translate("+e+")")}(t.translate,e.translate,n,i),function(t,e,n,i){t!==e?(t-e>180?e+=360:e-t>180&&(t+=360),i.push({i:n.push(pa(n)+"rotate(",null,")")-2,x:Gr(t,e)})):e&&n.push(pa(n)+"rotate("+e+")")}(t.rotate,e.rotate,n,i),function(t,e,n,i){t!==e?i.push({i:n.push(pa(n)+"skewX(",null,")")-2,x:Gr(t,e)}):e&&n.push(pa(n)+"skewX("+e+")")}(t.skew,e.skew,n,i),function(t,e,n,i){if(t[0]!==e[0]||t[1]!==e[1]){var r=n.push(pa(n)+"scale(",null,",",null,")");i.push({i:r-4,x:Gr(t[0],e[0])},{i:r-2,x:Gr(t[1],e[1])})}else 1===e[0]&&1===e[1]||n.push(pa(n)+"scale("+e+")")}(t.scale,e.scale,n,i),t=e=null,function(t){for(var e,r=-1,a=i.length;++r<a;)n[(e=i[r]).i]=e.x(t);return n.join("")}}function va(t,e){return e=(e-=t=+t)||1/e,function(n){return(n-t)/e}}function _a(t,e){return e=(e-=t=+t)||1/e,function(n){return Math.max(0,Math.min(1,(n-t)/e))}}function ya(t){for(var e=t.source,n=t.target,i=function(t,e){if(t===e)return t;var n=ba(t),i=ba(e),r=n.pop(),a=i.pop(),o=null;for(;r===a;)o=r,r=n.pop(),a=i.pop();return o}(e,n),r=[e];e!==i;)e=e.parent,r.push(e);for(var a=r.length;n!==i;)r.splice(a,0,n),n=n.parent;return r}function ba(t){for(var e=[],n=t.parent;null!=n;)e.push(t),t=n,n=n.parent;return e.push(t),e}function Ma(t){t.fixed|=2}function xa(t){t.fixed&=-7}function wa(t){t.fixed|=4,t.px=t.x,t.py=t.y}function ka(t){t.fixed&=-5}a.interpolateTransform=ga,a.layout={},a.layout.bundle=function(){return function(t){for(var e=[],n=-1,i=t.length;++n<i;)e.push(ya(t[n]));return e}},a.layout.chord=function(){var t,e,n,i,r,o,s,l={},u=0;function c(){var l,c,h,f,m,p={},g=[],v=a.range(i),_=[];for(t=[],e=[],l=0,f=-1;++f<i;){for(c=0,m=-1;++m<i;)c+=n[f][m];g.push(c),_.push(a.range(i)),l+=c}for(r&&v.sort(function(t,e){return r(g[t],g[e])}),o&&_.forEach(function(t,e){t.sort(function(t,i){return o(n[e][t],n[e][i])})}),l=(Dt-u*i)/l,c=0,f=-1;++f<i;){for(h=c,m=-1;++m<i;){var y=v[f],b=_[y][m],M=n[y][b],x=c,w=c+=M*l;p[y+"-"+b]={index:y,subindex:b,startAngle:x,endAngle:w,value:M}}e[y]={index:y,startAngle:h,endAngle:c,value:g[y]},c+=u}for(f=-1;++f<i;)for(m=f-1;++m<i;){var k=p[f+"-"+m],L=p[m+"-"+f];(k.value||L.value)&&t.push(k.value<L.value?{source:L,target:k}:{source:k,target:L})}s&&d()}function d(){t.sort(function(t,e){return s((t.source.value+t.target.value)/2,(e.source.value+e.target.value)/2)})}return l.matrix=function(r){return arguments.length?(i=(n=r)&&n.length,t=e=null,l):n},l.padding=function(n){return arguments.length?(u=n,t=e=null,l):u},l.sortGroups=function(n){return arguments.length?(r=n,t=e=null,l):r},l.sortSubgroups=function(e){return arguments.length?(o=e,t=null,l):o},l.sortChords=function(e){return arguments.length?(s=e,t&&d(),l):s},l.chords=function(){return t||c(),t},l.groups=function(){return e||c(),e},l},a.layout.force=function(){var t,e,n,i,r,o,s={},l=a.dispatch("start","tick","end"),u=[1,1],c=.9,d=La,h=Sa,f=-30,m=Ta,p=.1,g=.64,v=[],_=[];function y(t){return function(e,n,i,r){if(e.point!==t){var a=e.cx-t.x,o=e.cy-t.y,s=r-n,l=a*a+o*o;if(s*s/g<l){if(l<m){var u=e.charge/l;t.px-=a*u,t.py-=o*u}return!0}if(e.point&&l&&l<m){u=e.pointCharge/l;t.px-=a*u,t.py-=o*u}}return!e.charge}}function b(t){t.px=a.event.x,t.py=a.event.y,s.resume()}return s.tick=function(){if((n*=.99)<.005)return t=null,l.end({type:"end",alpha:n=0}),!0;var e,s,d,h,m,g,b,M,x,w=v.length,k=_.length;for(s=0;s<k;++s)h=(d=_[s]).source,(g=(M=(m=d.target).x-h.x)*M+(x=m.y-h.y)*x)&&(M*=g=n*r[s]*((g=Math.sqrt(g))-i[s])/g,x*=g,m.x-=M*(b=h.weight+m.weight?h.weight/(h.weight+m.weight):.5),m.y-=x*b,h.x+=M*(b=1-b),h.y+=x*b);if((b=n*p)&&(M=u[0]/2,x=u[1]/2,s=-1,b))for(;++s<w;)(d=v[s]).x+=(M-d.x)*b,d.y+=(x-d.y)*b;if(f)for(!function t(e,n,i){var r=0,a=0;e.charge=0;if(!e.leaf)for(var o,s=e.nodes,l=s.length,u=-1;++u<l;)null!=(o=s[u])&&(t(o,n,i),e.charge+=o.charge,r+=o.charge*o.cx,a+=o.charge*o.cy);if(e.point){e.leaf||(e.point.x+=Math.random()-.5,e.point.y+=Math.random()-.5);var c=n*i[e.point.index];e.charge+=e.pointCharge=c,r+=c*e.point.x,a+=c*e.point.y}e.cx=r/e.charge;e.cy=a/e.charge}(e=a.geom.quadtree(v),n,o),s=-1;++s<w;)(d=v[s]).fixed||e.visit(y(d));for(s=-1;++s<w;)(d=v[s]).fixed?(d.x=d.px,d.y=d.py):(d.x-=(d.px-(d.px=d.x))*c,d.y-=(d.py-(d.py=d.y))*c);l.tick({type:"tick",alpha:n})},s.nodes=function(t){return arguments.length?(v=t,s):v},s.links=function(t){return arguments.length?(_=t,s):_},s.size=function(t){return arguments.length?(u=t,s):u},s.linkDistance=function(t){return arguments.length?(d="function"==typeof t?t:+t,s):d},s.distance=s.linkDistance,s.linkStrength=function(t){return arguments.length?(h="function"==typeof t?t:+t,s):h},s.friction=function(t){return arguments.length?(c=+t,s):c},s.charge=function(t){return arguments.length?(f="function"==typeof t?t:+t,s):f},s.chargeDistance=function(t){return arguments.length?(m=t*t,s):Math.sqrt(m)},s.gravity=function(t){return arguments.length?(p=+t,s):p},s.theta=function(t){return arguments.length?(g=t*t,s):Math.sqrt(g)},s.alpha=function(e){return arguments.length?(e=+e,n?e>0?n=e:(t.c=null,t.t=NaN,t=null,l.end({type:"end",alpha:n=0})):e>0&&(l.start({type:"start",alpha:n=e}),t=Te(s.tick)),s):n},s.start=function(){var t,e,n,a=v.length,l=_.length,c=u[0],m=u[1];for(t=0;t<a;++t)(n=v[t]).index=t,n.weight=0;for(t=0;t<l;++t)"number"==typeof(n=_[t]).source&&(n.source=v[n.source]),"number"==typeof n.target&&(n.target=v[n.target]),++n.source.weight,++n.target.weight;for(t=0;t<a;++t)n=v[t],isNaN(n.x)&&(n.x=p("x",c)),isNaN(n.y)&&(n.y=p("y",m)),isNaN(n.px)&&(n.px=n.x),isNaN(n.py)&&(n.py=n.y);if(i=[],"function"==typeof d)for(t=0;t<l;++t)i[t]=+d.call(this,_[t],t);else for(t=0;t<l;++t)i[t]=d;if(r=[],"function"==typeof h)for(t=0;t<l;++t)r[t]=+h.call(this,_[t],t);else for(t=0;t<l;++t)r[t]=h;if(o=[],"function"==typeof f)for(t=0;t<a;++t)o[t]=+f.call(this,v[t],t);else for(t=0;t<a;++t)o[t]=f;function p(n,i){if(!e){for(e=new Array(a),u=0;u<a;++u)e[u]=[];for(u=0;u<l;++u){var r=_[u];e[r.source.index].push(r.target),e[r.target.index].push(r.source)}}for(var o,s=e[t],u=-1,c=s.length;++u<c;)if(!isNaN(o=s[u][n]))return o;return Math.random()*i}return s.resume()},s.resume=function(){return s.alpha(.1)},s.stop=function(){return s.alpha(0)},s.drag=function(){if(e||(e=a.behavior.drag().origin(N).on("dragstart.force",Ma).on("drag.force",b).on("dragend.force",xa)),!arguments.length)return e;this.on("mouseover.force",wa).on("mouseout.force",ka).call(e)},a.rebind(s,l,"on")};var La=20,Sa=1,Ta=1/0;function Ya(t,e){return a.rebind(t,e,"sort","children","value"),t.nodes=t,t.links=ja,t}function Da(t,e){for(var n=[t];null!=(t=n.pop());)if(e(t),(r=t.children)&&(i=r.length))for(var i,r;--i>=0;)n.push(r[i])}function Ca(t,e){for(var n=[t],i=[];null!=(t=n.pop());)if(i.push(t),(a=t.children)&&(r=a.length))for(var r,a,o=-1;++o<r;)n.push(a[o]);for(;null!=(t=i.pop());)e(t)}function Ea(t){return t.children}function Aa(t){return t.value}function Oa(t,e){return e.value-t.value}function ja(t){return a.merge(t.map(function(t){return(t.children||[]).map(function(e){return{source:t,target:e}})}))}a.layout.hierarchy=function(){var t=Oa,e=Ea,n=Aa;function i(r){var a,o=[r],s=[];for(r.depth=0;null!=(a=o.pop());)if(s.push(a),(u=e.call(i,a,a.depth))&&(l=u.length)){for(var l,u,c;--l>=0;)o.push(c=u[l]),c.parent=a,c.depth=a.depth+1;n&&(a.value=0),a.children=u}else n&&(a.value=+n.call(i,a,a.depth)||0),delete a.children;return Ca(r,function(e){var i,r;t&&(i=e.children)&&i.sort(t),n&&(r=e.parent)&&(r.value+=e.value)}),s}return i.sort=function(e){return arguments.length?(t=e,i):t},i.children=function(t){return arguments.length?(e=t,i):e},i.value=function(t){return arguments.length?(n=t,i):n},i.revalue=function(t){return n&&(Da(t,function(t){t.children&&(t.value=0)}),Ca(t,function(t){var e;t.children||(t.value=+n.call(i,t,t.depth)||0),(e=t.parent)&&(e.value+=t.value)})),t},i},a.layout.partition=function(){var t=a.layout.hierarchy(),e=[1,1];function n(n,i){var r=t.call(this,n,i);return function t(e,n,i,r){var a=e.children;if(e.x=n,e.y=e.depth*r,e.dx=i,e.dy=r,a&&(o=a.length)){var o,s,l,u=-1;for(i=e.value?i/e.value:0;++u<o;)t(s=a[u],n,l=s.value*i,r),n+=l}}(r[0],0,e[0],e[1]/function t(e){var n=e.children,i=0;if(n&&(r=n.length))for(var r,a=-1;++a<r;)i=Math.max(i,t(n[a]));return 1+i}(r[0])),r}return n.size=function(t){return arguments.length?(e=t,n):e},Ya(n,t)},a.layout.pie=function(){var t=Number,e=Na,n=0,i=Dt,r=0;function o(s){var l,u=s.length,c=s.map(function(e,n){return+t.call(o,e,n)}),d=+("function"==typeof n?n.apply(this,arguments):n),h=("function"==typeof i?i.apply(this,arguments):i)-d,f=Math.min(Math.abs(h)/u,+("function"==typeof r?r.apply(this,arguments):r)),m=f*(h<0?-1:1),p=a.sum(c),g=p?(h-u*m)/p:0,v=a.range(u),_=[];return null!=e&&v.sort(e===Na?function(t,e){return c[e]-c[t]}:function(t,n){return e(s[t],s[n])}),v.forEach(function(t){_[t]={data:s[t],value:l=c[t],startAngle:d,endAngle:d+=l*g+m,padAngle:f}}),_}return o.value=function(e){return arguments.length?(t=e,o):t},o.sort=function(t){return arguments.length?(e=t,o):e},o.startAngle=function(t){return arguments.length?(n=t,o):n},o.endAngle=function(t){return arguments.length?(i=t,o):i},o.padAngle=function(t){return arguments.length?(r=t,o):r},o};var Na={};function Ha(t){return t.x}function Va(t){return t.y}function Pa(t,e,n){t.y0=e,t.y=n}a.layout.stack=function(){var t=N,e=Ra,n=Wa,i=Pa,r=Ha,o=Va;function s(l,u){if(!(f=l.length))return l;var c=l.map(function(e,n){return t.call(s,e,n)}),d=c.map(function(t){return t.map(function(t,e){return[r.call(s,t,e),o.call(s,t,e)]})}),h=e.call(s,d,u);c=a.permute(c,h),d=a.permute(d,h);var f,m,p,g,v=n.call(s,d,u),_=c[0].length;for(p=0;p<_;++p)for(i.call(s,c[0][p],g=v[p],d[0][p][1]),m=1;m<f;++m)i.call(s,c[m][p],g+=d[m-1][p][1],d[m][p][1]);return l}return s.values=function(e){return arguments.length?(t=e,s):t},s.order=function(t){return arguments.length?(e="function"==typeof t?t:Fa.get(t)||Ra,s):e},s.offset=function(t){return arguments.length?(n="function"==typeof t?t:Ia.get(t)||Wa,s):n},s.x=function(t){return arguments.length?(r=t,s):r},s.y=function(t){return arguments.length?(o=t,s):o},s.out=function(t){return arguments.length?(i=t,s):i},s};var Fa=a.map({"inside-out":function(t){var e,n,i=t.length,r=t.map(za),o=t.map(Ba),s=a.range(i).sort(function(t,e){return r[t]-r[e]}),l=0,u=0,c=[],d=[];for(e=0;e<i;++e)n=s[e],l<u?(l+=o[n],c.push(n)):(u+=o[n],d.push(n));return d.reverse().concat(c)},reverse:function(t){return a.range(t.length).reverse()},default:Ra}),Ia=a.map({silhouette:function(t){var e,n,i,r=t.length,a=t[0].length,o=[],s=0,l=[];for(n=0;n<a;++n){for(e=0,i=0;e<r;e++)i+=t[e][n][1];i>s&&(s=i),o.push(i)}for(n=0;n<a;++n)l[n]=(s-o[n])/2;return l},wiggle:function(t){var e,n,i,r,a,o,s,l,u,c=t.length,d=t[0],h=d.length,f=[];for(f[0]=l=u=0,n=1;n<h;++n){for(e=0,r=0;e<c;++e)r+=t[e][n][1];for(e=0,a=0,s=d[n][0]-d[n-1][0];e<c;++e){for(i=0,o=(t[e][n][1]-t[e][n-1][1])/(2*s);i<e;++i)o+=(t[i][n][1]-t[i][n-1][1])/s;a+=o*t[e][n][1]}f[n]=l-=r?a/r*s:0,l<u&&(u=l)}for(n=0;n<h;++n)f[n]-=u;return f},expand:function(t){var e,n,i,r=t.length,a=t[0].length,o=1/r,s=[];for(n=0;n<a;++n){for(e=0,i=0;e<r;e++)i+=t[e][n][1];if(i)for(e=0;e<r;e++)t[e][n][1]/=i;else for(e=0;e<r;e++)t[e][n][1]=o}for(n=0;n<a;++n)s[n]=0;return s},zero:Wa});function Ra(t){return a.range(t.length)}function Wa(t){for(var e=-1,n=t[0].length,i=[];++e<n;)i[e]=0;return i}function za(t){for(var e,n=1,i=0,r=t[0][1],a=t.length;n<a;++n)(e=t[n][1])>r&&(i=n,r=e);return i}function Ba(t){return t.reduce(Ua,0)}function Ua(t,e){return t+e[1]}function Ga(t,e){return $a(t,Math.ceil(Math.log(e.length)/Math.LN2+1))}function $a(t,e){for(var n=-1,i=+t[0],r=(t[1]-i)/e,a=[];++n<=e;)a[n]=r*n+i;return a}function qa(t){return[a.min(t),a.max(t)]}function Ja(t,e){return t.value-e.value}function Xa(t,e){var n=t._pack_next;t._pack_next=e,e._pack_prev=t,e._pack_next=n,n._pack_prev=e}function Za(t,e){t._pack_next=e,e._pack_prev=t}function Ka(t,e){var n=e.x-t.x,i=e.y-t.y,r=t.r+e.r;return.999*r*r>n*n+i*i}function Qa(t){if((e=t.children)&&(l=e.length)){var e,n,i,r,a,o,s,l,u=1/0,c=-1/0,d=1/0,h=-1/0;if(e.forEach(to),(n=e[0]).x=-n.r,n.y=0,y(n),l>1&&((i=e[1]).x=i.r,i.y=0,y(i),l>2))for(no(n,i,r=e[2]),y(r),Xa(n,r),n._pack_prev=r,Xa(r,i),i=n._pack_next,a=3;a<l;a++){no(n,i,r=e[a]);var f=0,m=1,p=1;for(o=i._pack_next;o!==i;o=o._pack_next,m++)if(Ka(o,r)){f=1;break}if(1==f)for(s=n._pack_prev;s!==o._pack_prev&&!Ka(s,r);s=s._pack_prev,p++);f?(m<p||m==p&&i.r<n.r?Za(n,i=o):Za(n=s,i),a--):(Xa(n,r),i=r,y(r))}var g=(u+c)/2,v=(d+h)/2,_=0;for(a=0;a<l;a++)(r=e[a]).x-=g,r.y-=v,_=Math.max(_,r.r+Math.sqrt(r.x*r.x+r.y*r.y));t.r=_,e.forEach(eo)}function y(t){u=Math.min(t.x-t.r,u),c=Math.max(t.x+t.r,c),d=Math.min(t.y-t.r,d),h=Math.max(t.y+t.r,h)}}function to(t){t._pack_next=t._pack_prev=t}function eo(t){delete t._pack_next,delete t._pack_prev}function no(t,e,n){var i=t.r+n.r,r=e.x-t.x,a=e.y-t.y;if(i&&(r||a)){var o=e.r+n.r,s=r*r+a*a,l=.5+((i*=i)-(o*=o))/(2*s),u=Math.sqrt(Math.max(0,2*o*(i+s)-(i-=s)*i-o*o))/(2*s);n.x=t.x+l*r+u*a,n.y=t.y+l*a-u*r}else n.x=t.x+i,n.y=t.y}function io(t,e){return t.parent==e.parent?1:2}function ro(t){var e=t.children;return e.length?e[0]:t.t}function ao(t){var e,n=t.children;return(e=n.length)?n[e-1]:t.t}function oo(t,e,n){var i=n/(e.i-t.i);e.c-=i,e.s+=n,t.c+=i,e.z+=n,e.m+=n}function so(t,e,n){return t.a.parent===e.parent?t.a:n}function lo(t){return{x:t.x,y:t.y,dx:t.dx,dy:t.dy}}function uo(t,e){var n=t.x+e[3],i=t.y+e[0],r=t.dx-e[1]-e[3],a=t.dy-e[0]-e[2];return r<0&&(n+=r/2,r=0),a<0&&(i+=a/2,a=0),{x:n,y:i,dx:r,dy:a}}function co(t){var e=t[0],n=t[t.length-1];return e<n?[e,n]:[n,e]}function ho(t){return t.rangeExtent?t.rangeExtent():co(t.range())}function fo(t,e,n,i){var r=n(t[0],t[1]),a=i(e[0],e[1]);return function(t){return a(r(t))}}function mo(t,e){var n,i=0,r=t.length-1,a=t[i],o=t[r];return o<a&&(n=i,i=r,r=n,n=a,a=o,o=n),t[i]=e.floor(a),t[r]=e.ceil(o),t}function po(t){return t?{floor:function(e){return Math.floor(e/t)*t},ceil:function(e){return Math.ceil(e/t)*t}}:go}a.layout.histogram=function(){var t=!0,e=Number,n=qa,i=Ga;function r(r,o){for(var s,l,u=[],c=r.map(e,this),d=n.call(this,c,o),h=i.call(this,d,c,o),f=(o=-1,c.length),m=h.length-1,p=t?1:1/f;++o<m;)(s=u[o]=[]).dx=h[o+1]-(s.x=h[o]),s.y=0;if(m>0)for(o=-1;++o<f;)(l=c[o])>=d[0]&&l<=d[1]&&((s=u[a.bisect(h,l,1,m)-1]).y+=p,s.push(r[o]));return u}return r.value=function(t){return arguments.length?(e=t,r):e},r.range=function(t){return arguments.length?(n=ye(t),r):n},r.bins=function(t){return arguments.length?(i="number"==typeof t?function(e){return $a(e,t)}:ye(t),r):i},r.frequency=function(e){return arguments.length?(t=!!e,r):t},r},a.layout.pack=function(){var t,e=a.layout.hierarchy().sort(Ja),n=0,i=[1,1];function r(r,a){var o=e.call(this,r,a),s=o[0],l=i[0],u=i[1],c=null==t?Math.sqrt:"function"==typeof t?t:function(){return t};if(s.x=s.y=0,Ca(s,function(t){t.r=+c(t.value)}),Ca(s,Qa),n){var d=n*(t?1:Math.max(2*s.r/l,2*s.r/u))/2;Ca(s,function(t){t.r+=d}),Ca(s,Qa),Ca(s,function(t){t.r-=d})}return function t(e,n,i,r){var a=e.children;e.x=n+=r*e.x;e.y=i+=r*e.y;e.r*=r;if(a)for(var o=-1,s=a.length;++o<s;)t(a[o],n,i,r)}(s,l/2,u/2,t?1:1/Math.max(2*s.r/l,2*s.r/u)),o}return r.size=function(t){return arguments.length?(i=t,r):i},r.radius=function(e){return arguments.length?(t=null==e||"function"==typeof e?e:+e,r):t},r.padding=function(t){return arguments.length?(n=+t,r):n},Ya(r,e)},a.layout.tree=function(){var t=a.layout.hierarchy().sort(null).value(null),e=io,n=[1,1],i=null;function r(r,a){var u=t.call(this,r,a),c=u[0],d=function(t){var e,n={A:null,children:[t]},i=[n];for(;null!=(e=i.pop());)for(var r,a=e.children,o=0,s=a.length;o<s;++o)i.push((a[o]=r={_:a[o],parent:e,children:(r=a[o].children)&&r.slice()||[],A:null,a:null,z:0,m:0,c:0,s:0,t:null,i:o}).a=r);return n.children[0]}(c);if(Ca(d,o),d.parent.m=-d.z,Da(d,s),i)Da(c,l);else{var h=c,f=c,m=c;Da(c,function(t){t.x<h.x&&(h=t),t.x>f.x&&(f=t),t.depth>m.depth&&(m=t)});var p=e(h,f)/2-h.x,g=n[0]/(f.x+e(f,h)/2+p),v=n[1]/(m.depth||1);Da(c,function(t){t.x=(t.x+p)*g,t.y=t.depth*v})}return u}function o(t){var n=t.children,i=t.parent.children,r=t.i?i[t.i-1]:null;if(n.length){!function(t){var e,n=0,i=0,r=t.children,a=r.length;for(;--a>=0;)(e=r[a]).z+=n,e.m+=n,n+=e.s+(i+=e.c)}(t);var a=(n[0].z+n[n.length-1].z)/2;r?(t.z=r.z+e(t._,r._),t.m=t.z-a):t.z=a}else r&&(t.z=r.z+e(t._,r._));t.parent.A=function(t,n,i){if(n){for(var r,a=t,o=t,s=n,l=a.parent.children[0],u=a.m,c=o.m,d=s.m,h=l.m;s=ao(s),a=ro(a),s&&a;)l=ro(l),(o=ao(o)).a=t,(r=s.z+d-a.z-u+e(s._,a._))>0&&(oo(so(s,t,i),t,r),u+=r,c+=r),d+=s.m,u+=a.m,h+=l.m,c+=o.m;s&&!ao(o)&&(o.t=s,o.m+=d-c),a&&!ro(l)&&(l.t=a,l.m+=u-h,i=t)}return i}(t,r,t.parent.A||i[0])}function s(t){t._.x=t.z+t.parent.m,t.m+=t.parent.m}function l(t){t.x*=n[0],t.y=t.depth*n[1]}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(t){return arguments.length?(i=null==(n=t)?l:null,r):i?null:n},r.nodeSize=function(t){return arguments.length?(i=null==(n=t)?null:l,r):i?n:null},Ya(r,t)},a.layout.cluster=function(){var t=a.layout.hierarchy().sort(null).value(null),e=io,n=[1,1],i=!1;function r(r,o){var s,l=t.call(this,r,o),u=l[0],c=0;Ca(u,function(t){var n=t.children;n&&n.length?(t.x=function(t){return t.reduce(function(t,e){return t+e.x},0)/t.length}(n),t.y=function(t){return 1+a.max(t,function(t){return t.y})}(n)):(t.x=s?c+=e(t,s):0,t.y=0,s=t)});var d=function t(e){var n=e.children;return n&&n.length?t(n[0]):e}(u),h=function t(e){var n,i=e.children;return i&&(n=i.length)?t(i[n-1]):e}(u),f=d.x-e(d,h)/2,m=h.x+e(h,d)/2;return Ca(u,i?function(t){t.x=(t.x-u.x)*n[0],t.y=(u.y-t.y)*n[1]}:function(t){t.x=(t.x-f)/(m-f)*n[0],t.y=(1-(u.y?t.y/u.y:1))*n[1]}),l}return r.separation=function(t){return arguments.length?(e=t,r):e},r.size=function(t){return arguments.length?(i=null==(n=t),r):i?null:n},r.nodeSize=function(t){return arguments.length?(i=null!=(n=t),r):i?n:null},Ya(r,t)},a.layout.treemap=function(){var t,e=a.layout.hierarchy(),n=Math.round,i=[1,1],r=null,o=lo,s=!1,l="squarify",u=.5*(1+Math.sqrt(5));function c(t,e){for(var n,i,r=-1,a=t.length;++r<a;)i=(n=t[r]).value*(e<0?0:e),n.area=isNaN(i)||i<=0?0:i}function d(t){var e=t.children;if(e&&e.length){var n,i,r,a=o(t),s=[],u=e.slice(),h=1/0,p="slice"===l?a.dx:"dice"===l?a.dy:"slice-dice"===l?1&t.depth?a.dy:a.dx:Math.min(a.dx,a.dy);for(c(u,a.dx*a.dy/t.value),s.area=0;(r=u.length)>0;)s.push(n=u[r-1]),s.area+=n.area,"squarify"!==l||(i=f(s,p))<=h?(u.pop(),h=i):(s.area-=s.pop().area,m(s,p,a,!1),p=Math.min(a.dx,a.dy),s.length=s.area=0,h=1/0);s.length&&(m(s,p,a,!0),s.length=s.area=0),e.forEach(d)}}function h(t){var e=t.children;if(e&&e.length){var n,i=o(t),r=e.slice(),a=[];for(c(r,i.dx*i.dy/t.value),a.area=0;n=r.pop();)a.push(n),a.area+=n.area,null!=n.z&&(m(a,n.z?i.dx:i.dy,i,!r.length),a.length=a.area=0);e.forEach(h)}}function f(t,e){for(var n,i=t.area,r=0,a=1/0,o=-1,s=t.length;++o<s;)(n=t[o].area)&&(n<a&&(a=n),n>r&&(r=n));return e*=e,(i*=i)?Math.max(e*r*u/i,i/(e*a*u)):1/0}function m(t,e,i,r){var a,o=-1,s=t.length,l=i.x,u=i.y,c=e?n(t.area/e):0;if(e==i.dx){for((r||c>i.dy)&&(c=i.dy);++o<s;)(a=t[o]).x=l,a.y=u,a.dy=c,l+=a.dx=Math.min(i.x+i.dx-l,c?n(a.area/c):0);a.z=!0,a.dx+=i.x+i.dx-l,i.y+=c,i.dy-=c}else{for((r||c>i.dx)&&(c=i.dx);++o<s;)(a=t[o]).x=l,a.y=u,a.dx=c,u+=a.dy=Math.min(i.y+i.dy-u,c?n(a.area/c):0);a.z=!1,a.dy+=i.y+i.dy-u,i.x+=c,i.dx-=c}}function p(n){var r=t||e(n),a=r[0];return a.x=a.y=0,a.value?(a.dx=i[0],a.dy=i[1]):a.dx=a.dy=0,t&&e.revalue(a),c([a],a.dx*a.dy/a.value),(t?h:d)(a),s&&(t=r),r}return p.size=function(t){return arguments.length?(i=t,p):i},p.padding=function(t){if(!arguments.length)return r;function e(e){return uo(e,t)}var n;return o=null==(r=t)?lo:"function"==(n=typeof t)?function(e){var n=t.call(p,e,e.depth);return null==n?lo(e):uo(e,"number"==typeof n?[n,n,n,n]:n)}:"number"===n?(t=[t,t,t,t],e):e,p},p.round=function(t){return arguments.length?(n=t?Math.round:Number,p):n!=Number},p.sticky=function(e){return arguments.length?(s=e,t=null,p):s},p.ratio=function(t){return arguments.length?(u=t,p):u},p.mode=function(t){return arguments.length?(l=t+"",p):l},Ya(p,e)},a.random={normal:function(t,e){var n=arguments.length;return n<2&&(e=1),n<1&&(t=0),function(){var n,i,r;do{r=(n=2*Math.random()-1)*n+(i=2*Math.random()-1)*i}while(!r||r>1);return t+e*n*Math.sqrt(-2*Math.log(r)/r)}},logNormal:function(){var t=a.random.normal.apply(a,arguments);return function(){return Math.exp(t())}},bates:function(t){var e=a.random.irwinHall(t);return function(){return e()/t}},irwinHall:function(t){return function(){for(var e=0,n=0;n<t;n++)e+=Math.random();return e}}},a.scale={};var go={floor:N,ceil:N};function vo(t,e,n,i){var r=[],o=[],s=0,l=Math.min(t.length,e.length)-1;for(t[l]<t[0]&&(t=t.slice().reverse(),e=e.slice().reverse());++s<=l;)r.push(n(t[s-1],t[s])),o.push(i(e[s-1],e[s]));return function(e){var n=a.bisect(t,e,1,l)-1;return o[n](r[n](e))}}function _o(t,e){return a.rebind(t,e,"range","rangeRound","interpolate","clamp")}function yo(t,e){return mo(t,po(bo(t,e)[2])),mo(t,po(bo(t,e)[2])),t}function bo(t,e){null==e&&(e=10);var n=co(t),i=n[1]-n[0],r=Math.pow(10,Math.floor(Math.log(i/e)/Math.LN10)),a=e/i*r;return a<=.15?r*=10:a<=.35?r*=5:a<=.75&&(r*=2),n[0]=Math.ceil(n[0]/r)*r,n[1]=Math.floor(n[1]/r)*r+.5*r,n[2]=r,n}function Mo(t,e){return a.range.apply(a,bo(t,e))}function xo(t,e,n){var i=bo(t,e);if(n){var r=Oe.exec(n);if(r.shift(),"s"===r[8]){var o=a.formatPrefix(Math.max(x(i[0]),x(i[1])));return r[7]||(r[7]="."+ko(o.scale(i[2]))),r[8]="f",n=a.format(r.join("")),function(t){return n(o.scale(t))+o.symbol}}r[7]||(r[7]="."+function(t,e){var n=ko(e[2]);return t in wo?Math.abs(n-ko(Math.max(x(e[0]),x(e[1]))))+ +("e"!==t):n-2*("%"===t)}(r[8],i)),n=r.join("")}else n=",."+ko(i[2])+"f";return a.format(n)}a.scale.linear=function(){return function t(e,n,i,r){var a,o;function s(){var t=Math.min(e.length,n.length)>2?vo:fo,s=r?_a:va;return a=t(e,n,s,i),o=t(n,e,s,Xr),l}function l(t){return a(t)}l.invert=function(t){return o(t)};l.domain=function(t){return arguments.length?(e=t.map(Number),s()):e};l.range=function(t){return arguments.length?(n=t,s()):n};l.rangeRound=function(t){return l.range(t).interpolate(ca)};l.clamp=function(t){return arguments.length?(r=t,s()):r};l.interpolate=function(t){return arguments.length?(i=t,s()):i};l.ticks=function(t){return Mo(e,t)};l.tickFormat=function(t,n){return xo(e,t,n)};l.nice=function(t){return yo(e,t),s()};l.copy=function(){return t(e,n,i,r)};return s()}([0,1],[0,1],Xr,!1)};var wo={s:1,g:1,p:1,r:1,e:1};function ko(t){return-Math.floor(Math.log(t)/Math.LN10+.01)}a.scale.log=function(){return function t(e,n,i,r){function o(t){return(i?Math.log(t<0?0:t):-Math.log(t>0?0:-t))/Math.log(n)}function s(t){return i?Math.pow(n,t):-Math.pow(n,-t)}function l(t){return e(o(t))}l.invert=function(t){return s(e.invert(t))};l.domain=function(t){return arguments.length?(i=t[0]>=0,e.domain((r=t.map(Number)).map(o)),l):r};l.base=function(t){return arguments.length?(n=+t,e.domain(r.map(o)),l):n};l.nice=function(){var t=mo(r.map(o),i?Math:So);return e.domain(t),r=t.map(s),l};l.ticks=function(){var t=co(r),e=[],a=t[0],l=t[1],u=Math.floor(o(a)),c=Math.ceil(o(l)),d=n%1?2:n;if(isFinite(c-u)){if(i){for(;u<c;u++)for(var h=1;h<d;h++)e.push(s(u)*h);e.push(s(u))}else for(e.push(s(u));u++<c;)for(var h=d-1;h>0;h--)e.push(s(u)*h);for(u=0;e[u]<a;u++);for(c=e.length;e[c-1]>l;c--);e=e.slice(u,c)}return e};l.tickFormat=function(t,e){if(!arguments.length)return Lo;arguments.length<2?e=Lo:"function"!=typeof e&&(e=a.format(e));var i=Math.max(1,n*t/l.ticks().length);return function(t){var r=t/s(Math.round(o(t)));return r*n<n-.5&&(r*=n),r<=i?e(t):""}};l.copy=function(){return t(e.copy(),n,i,r)};return _o(l,e)}(a.scale.linear().domain([0,1]),10,!0,[1,10])};var Lo=a.format(".0e"),So={floor:function(t){return-Math.ceil(-t)},ceil:function(t){return-Math.floor(-t)}};function To(t){return function(e){return e<0?-Math.pow(-e,t):Math.pow(e,t)}}a.scale.pow=function(){return function t(e,n,i){var r=To(n),a=To(1/n);function o(t){return e(r(t))}o.invert=function(t){return a(e.invert(t))};o.domain=function(t){return arguments.length?(e.domain((i=t.map(Number)).map(r)),o):i};o.ticks=function(t){return Mo(i,t)};o.tickFormat=function(t,e){return xo(i,t,e)};o.nice=function(t){return o.domain(yo(i,t))};o.exponent=function(t){return arguments.length?(r=To(n=t),a=To(1/n),e.domain(i.map(r)),o):n};o.copy=function(){return t(e.copy(),n,i)};return _o(o,e)}(a.scale.linear(),1,[0,1])},a.scale.sqrt=function(){return a.scale.pow().exponent(.5)},a.scale.ordinal=function(){return function t(e,n){var i,r,o;function s(t){return r[((i.get(t)||("range"===n.t?i.set(t,e.push(t)):NaN))-1)%r.length]}function l(t,n){return a.range(e.length).map(function(e){return t+n*e})}s.domain=function(t){if(!arguments.length)return e;e=[],i=new k;for(var r,a=-1,o=t.length;++a<o;)i.has(r=t[a])||i.set(r,e.push(r));return s[n.t].apply(s,n.a)};s.range=function(t){return arguments.length?(r=t,o=0,n={t:"range",a:arguments},s):r};s.rangePoints=function(t,i){arguments.length<2&&(i=0);var a=t[0],u=t[1],c=e.length<2?(a=(a+u)/2,0):(u-a)/(e.length-1+i);return r=l(a+c*i/2,c),o=0,n={t:"rangePoints",a:arguments},s};s.rangeRoundPoints=function(t,i){arguments.length<2&&(i=0);var a=t[0],u=t[1],c=e.length<2?(a=u=Math.round((a+u)/2),0):(u-a)/(e.length-1+i)|0;return r=l(a+Math.round(c*i/2+(u-a-(e.length-1+i)*c)/2),c),o=0,n={t:"rangeRoundPoints",a:arguments},s};s.rangeBands=function(t,i,a){arguments.length<2&&(i=0),arguments.length<3&&(a=i);var u=t[1]<t[0],c=t[u-0],d=t[1-u],h=(d-c)/(e.length-i+2*a);return r=l(c+h*a,h),u&&r.reverse(),o=h*(1-i),n={t:"rangeBands",a:arguments},s};s.rangeRoundBands=function(t,i,a){arguments.length<2&&(i=0),arguments.length<3&&(a=i);var u=t[1]<t[0],c=t[u-0],d=t[1-u],h=Math.floor((d-c)/(e.length-i+2*a));return r=l(c+Math.round((d-c-(e.length-i)*h)/2),h),u&&r.reverse(),o=Math.round(h*(1-i)),n={t:"rangeRoundBands",a:arguments},s};s.rangeBand=function(){return o};s.rangeExtent=function(){return co(n.a[0])};s.copy=function(){return t(e,n)};return s.domain(e)}([],{t:"range",a:[[]]})},a.scale.category10=function(){return a.scale.ordinal().range(Yo)},a.scale.category20=function(){return a.scale.ordinal().range(Do)},a.scale.category20b=function(){return a.scale.ordinal().range(Co)},a.scale.category20c=function(){return a.scale.ordinal().range(Eo)};var Yo=[2062260,16744206,2924588,14034728,9725885,9197131,14907330,8355711,12369186,1556175].map(ce),Do=[2062260,11454440,16744206,16759672,2924588,10018698,14034728,16750742,9725885,12955861,9197131,12885140,14907330,16234194,8355711,13092807,12369186,14408589,1556175,10410725].map(ce),Co=[3750777,5395619,7040719,10264286,6519097,9216594,11915115,13556636,9202993,12426809,15186514,15190932,8666169,11356490,14049643,15177372,8077683,10834324,13528509,14589654].map(ce),Eo=[3244733,7057110,10406625,13032431,15095053,16616764,16625259,16634018,3253076,7652470,10607003,13101504,7695281,10394312,12369372,14342891,6513507,9868950,12434877,14277081].map(ce);function Ao(){return 0}a.scale.quantile=function(){return function t(e,n){var i;function r(){var t=0,r=n.length;for(i=[];++t<r;)i[t-1]=a.quantile(e,t/r);return o}function o(t){if(!isNaN(t=+t))return n[a.bisect(i,t)]}o.domain=function(t){return arguments.length?(e=t.map(v).filter(_).sort(g),r()):e};o.range=function(t){return arguments.length?(n=t,r()):n};o.quantiles=function(){return i};o.invertExtent=function(t){return(t=n.indexOf(t))<0?[NaN,NaN]:[t>0?i[t-1]:e[0],t<i.length?i[t]:e[e.length-1]]};o.copy=function(){return t(e,n)};return r()}([],[])},a.scale.quantize=function(){return function t(e,n,i){var r,a;function o(t){return i[Math.max(0,Math.min(a,Math.floor(r*(t-e))))]}function s(){return r=i.length/(n-e),a=i.length-1,o}o.domain=function(t){return arguments.length?(e=+t[0],n=+t[t.length-1],s()):[e,n]};o.range=function(t){return arguments.length?(i=t,s()):i};o.invertExtent=function(t){return[t=(t=i.indexOf(t))<0?NaN:t/r+e,t+1/r]};o.copy=function(){return t(e,n,i)};return s()}(0,1,[0,1])},a.scale.threshold=function(){return function t(e,n){function i(t){if(t<=t)return n[a.bisect(e,t)]}i.domain=function(t){return arguments.length?(e=t,i):e};i.range=function(t){return arguments.length?(n=t,i):n};i.invertExtent=function(t){return t=n.indexOf(t),[e[t-1],e[t]]};i.copy=function(){return t(e,n)};return i}([.5],[0,1])},a.scale.identity=function(){return function t(e){function n(t){return+t}n.invert=n;n.domain=n.range=function(t){return arguments.length?(e=t.map(n),n):e};n.ticks=function(t){return Mo(e,t)};n.tickFormat=function(t,n){return xo(e,t,n)};n.copy=function(){return t(e)};return n}([0,1])},a.svg={},a.svg.arc=function(){var t=jo,e=No,n=Ao,i=Oo,r=Ho,a=Vo,o=Po;function s(){var s=Math.max(0,+t.apply(this,arguments)),u=Math.max(0,+e.apply(this,arguments)),c=r.apply(this,arguments)-Et,d=a.apply(this,arguments)-Et,h=Math.abs(d-c),f=c>d?0:1;if(u<s&&(m=u,u=s,s=m),h>=Ct)return l(u,f)+(s?l(s,1-f):"")+"Z";var m,p,g,v,_,y,b,M,x,w,k,L,S=0,T=0,Y=[];if((v=(+o.apply(this,arguments)||0)/2)&&(g=i===Oo?Math.sqrt(s*s+u*u):+i.apply(this,arguments),f||(T*=-1),u&&(T=Vt(g/u*Math.sin(v))),s&&(S=Vt(g/s*Math.sin(v)))),u){_=u*Math.cos(c+T),y=u*Math.sin(c+T),b=u*Math.cos(d-T),M=u*Math.sin(d-T);var D=Math.abs(d-c-2*T)<=Yt?0:1;if(T&&Fo(_,y,b,M)===f^D){var C=(c+d)/2;_=u*Math.cos(C),y=u*Math.sin(C),b=M=null}}else _=y=0;if(s){x=s*Math.cos(d-S),w=s*Math.sin(d-S),k=s*Math.cos(c+S),L=s*Math.sin(c+S);var E=Math.abs(c-d+2*S)<=Yt?0:1;if(S&&Fo(x,w,k,L)===1-f^E){var A=(c+d)/2;x=s*Math.cos(A),w=s*Math.sin(A),k=L=null}}else x=w=0;if(h>St&&(m=Math.min(Math.abs(u-s)/2,+n.apply(this,arguments)))>.001){p=s<u^f?0:1;var O=m,j=m;if(h<Yt){var N=null==k?[x,w]:null==b?[_,y]:lr([_,y],[k,L],[b,M],[x,w]),H=_-N[0],V=y-N[1],P=b-N[0],F=M-N[1],I=1/Math.sin(Math.acos((H*P+V*F)/(Math.sqrt(H*H+V*V)*Math.sqrt(P*P+F*F)))/2),R=Math.sqrt(N[0]*N[0]+N[1]*N[1]);j=Math.min(m,(s-R)/(I-1)),O=Math.min(m,(u-R)/(I+1))}if(null!=b){var W=Io(null==k?[x,w]:[k,L],[_,y],u,O,f),z=Io([b,M],[x,w],u,O,f);m===O?Y.push("M",W[0],"A",O,",",O," 0 0,",p," ",W[1],"A",u,",",u," 0 ",1-f^Fo(W[1][0],W[1][1],z[1][0],z[1][1]),",",f," ",z[1],"A",O,",",O," 0 0,",p," ",z[0]):Y.push("M",W[0],"A",O,",",O," 0 1,",p," ",z[0])}else Y.push("M",_,",",y);if(null!=k){var B=Io([_,y],[k,L],s,-j,f),U=Io([x,w],null==b?[_,y]:[b,M],s,-j,f);m===j?Y.push("L",U[0],"A",j,",",j," 0 0,",p," ",U[1],"A",s,",",s," 0 ",f^Fo(U[1][0],U[1][1],B[1][0],B[1][1]),",",1-f," ",B[1],"A",j,",",j," 0 0,",p," ",B[0]):Y.push("L",U[0],"A",j,",",j," 0 0,",p," ",B[0])}else Y.push("L",x,",",w)}else Y.push("M",_,",",y),null!=b&&Y.push("A",u,",",u," 0 ",D,",",f," ",b,",",M),Y.push("L",x,",",w),null!=k&&Y.push("A",s,",",s," 0 ",E,",",1-f," ",k,",",L);return Y.push("Z"),Y.join("")}function l(t,e){return"M0,"+t+"A"+t+","+t+" 0 1,"+e+" 0,"+-t+"A"+t+","+t+" 0 1,"+e+" 0,"+t}return s.innerRadius=function(e){return arguments.length?(t=ye(e),s):t},s.outerRadius=function(t){return arguments.length?(e=ye(t),s):e},s.cornerRadius=function(t){return arguments.length?(n=ye(t),s):n},s.padRadius=function(t){return arguments.length?(i=t==Oo?Oo:ye(t),s):i},s.startAngle=function(t){return arguments.length?(r=ye(t),s):r},s.endAngle=function(t){return arguments.length?(a=ye(t),s):a},s.padAngle=function(t){return arguments.length?(o=ye(t),s):o},s.centroid=function(){var n=(+t.apply(this,arguments)+ +e.apply(this,arguments))/2,i=(+r.apply(this,arguments)+ +a.apply(this,arguments))/2-Et;return[Math.cos(i)*n,Math.sin(i)*n]},s};var Oo="auto";function jo(t){return t.innerRadius}function No(t){return t.outerRadius}function Ho(t){return t.startAngle}function Vo(t){return t.endAngle}function Po(t){return t&&t.padAngle}function Fo(t,e,n,i){return(t-n)*e-(e-i)*t>0?0:1}function Io(t,e,n,i,r){var a=t[0]-e[0],o=t[1]-e[1],s=(r?i:-i)/Math.sqrt(a*a+o*o),l=s*o,u=-s*a,c=t[0]+l,d=t[1]+u,h=e[0]+l,f=e[1]+u,m=(c+h)/2,p=(d+f)/2,g=h-c,v=f-d,_=g*g+v*v,y=n-i,b=c*f-h*d,M=(v<0?-1:1)*Math.sqrt(Math.max(0,y*y*_-b*b)),x=(b*v-g*M)/_,w=(-b*g-v*M)/_,k=(b*v+g*M)/_,L=(-b*g+v*M)/_,S=x-m,T=w-p,Y=k-m,D=L-p;return S*S+T*T>Y*Y+D*D&&(x=k,w=L),[[x-l,w-u],[x*n/y,w*n/y]]}function Ro(t){var e=nr,n=ir,i=Xn,r=zo,a=r.key,o=.7;function s(a){var s,l=[],u=[],c=-1,d=a.length,h=ye(e),f=ye(n);function m(){l.push("M",r(t(u),o))}for(;++c<d;)i.call(this,s=a[c],c)?u.push([+h.call(this,s,c),+f.call(this,s,c)]):u.length&&(m(),u=[]);return u.length&&m(),l.length?l.join(""):null}return s.x=function(t){return arguments.length?(e=t,s):e},s.y=function(t){return arguments.length?(n=t,s):n},s.defined=function(t){return arguments.length?(i=t,s):i},s.interpolate=function(t){return arguments.length?(a="function"==typeof t?r=t:(r=Wo.get(t)||zo).key,s):a},s.tension=function(t){return arguments.length?(o=t,s):o},s}a.svg.line=function(){return Ro(N)};var Wo=a.map({linear:zo,"linear-closed":Bo,step:function(t){var e=0,n=t.length,i=t[0],r=[i[0],",",i[1]];for(;++e<n;)r.push("H",(i[0]+(i=t[e])[0])/2,"V",i[1]);n>1&&r.push("H",i[0]);return r.join("")},"step-before":Uo,"step-after":Go,basis:Jo,"basis-open":function(t){if(t.length<4)return zo(t);var e,n=[],i=-1,r=t.length,a=[0],o=[0];for(;++i<3;)e=t[i],a.push(e[0]),o.push(e[1]);n.push(Xo(Qo,a)+","+Xo(Qo,o)),--i;for(;++i<r;)e=t[i],a.shift(),a.push(e[0]),o.shift(),o.push(e[1]),ts(n,a,o);return n.join("")},"basis-closed":function(t){var e,n,i=-1,r=t.length,a=r+4,o=[],s=[];for(;++i<4;)n=t[i%r],o.push(n[0]),s.push(n[1]);e=[Xo(Qo,o),",",Xo(Qo,s)],--i;for(;++i<a;)n=t[i%r],o.shift(),o.push(n[0]),s.shift(),s.push(n[1]),ts(e,o,s);return e.join("")},bundle:function(t,e){var n=t.length-1;if(n)for(var i,r,a=t[0][0],o=t[0][1],s=t[n][0]-a,l=t[n][1]-o,u=-1;++u<=n;)i=t[u],r=u/n,i[0]=e*i[0]+(1-e)*(a+r*s),i[1]=e*i[1]+(1-e)*(o+r*l);return Jo(t)},cardinal:function(t,e){return t.length<3?zo(t):t[0]+$o(t,qo(t,e))},"cardinal-open":function(t,e){return t.length<4?zo(t):t[1]+$o(t.slice(1,-1),qo(t,e))},"cardinal-closed":function(t,e){return t.length<3?Bo(t):t[0]+$o((t.push(t[0]),t),qo([t[t.length-2]].concat(t,[t[1]]),e))},monotone:function(t){return t.length<3?zo(t):t[0]+$o(t,function(t){var e,n,i,r,a=[],o=function(t){var e=0,n=t.length-1,i=[],r=t[0],a=t[1],o=i[0]=es(r,a);for(;++e<n;)i[e]=(o+(o=es(r=a,a=t[e+1])))/2;return i[e]=o,i}(t),s=-1,l=t.length-1;for(;++s<l;)e=es(t[s],t[s+1]),x(e)<St?o[s]=o[s+1]=0:(n=o[s]/e,i=o[s+1]/e,(r=n*n+i*i)>9&&(r=3*e/Math.sqrt(r),o[s]=r*n,o[s+1]=r*i));s=-1;for(;++s<=l;)r=(t[Math.min(l,s+1)][0]-t[Math.max(0,s-1)][0])/(6*(1+o[s]*o[s])),a.push([r||0,o[s]*r||0]);return a}(t))}});function zo(t){return t.length>1?t.join("L"):t+"Z"}function Bo(t){return t.join("L")+"Z"}function Uo(t){for(var e=0,n=t.length,i=t[0],r=[i[0],",",i[1]];++e<n;)r.push("V",(i=t[e])[1],"H",i[0]);return r.join("")}function Go(t){for(var e=0,n=t.length,i=t[0],r=[i[0],",",i[1]];++e<n;)r.push("H",(i=t[e])[0],"V",i[1]);return r.join("")}function $o(t,e){if(e.length<1||t.length!=e.length&&t.length!=e.length+2)return zo(t);var n=t.length!=e.length,i="",r=t[0],a=t[1],o=e[0],s=o,l=1;if(n&&(i+="Q"+(a[0]-2*o[0]/3)+","+(a[1]-2*o[1]/3)+","+a[0]+","+a[1],r=t[1],l=2),e.length>1){s=e[1],a=t[l],l++,i+="C"+(r[0]+o[0])+","+(r[1]+o[1])+","+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1];for(var u=2;u<e.length;u++,l++)a=t[l],s=e[u],i+="S"+(a[0]-s[0])+","+(a[1]-s[1])+","+a[0]+","+a[1]}if(n){var c=t[l];i+="Q"+(a[0]+2*s[0]/3)+","+(a[1]+2*s[1]/3)+","+c[0]+","+c[1]}return i}function qo(t,e){for(var n,i=[],r=(1-e)/2,a=t[0],o=t[1],s=1,l=t.length;++s<l;)n=a,a=o,o=t[s],i.push([r*(o[0]-n[0]),r*(o[1]-n[1])]);return i}function Jo(t){if(t.length<3)return zo(t);var e=1,n=t.length,i=t[0],r=i[0],a=i[1],o=[r,r,r,(i=t[1])[0]],s=[a,a,a,i[1]],l=[r,",",a,"L",Xo(Qo,o),",",Xo(Qo,s)];for(t.push(t[n-1]);++e<=n;)i=t[e],o.shift(),o.push(i[0]),s.shift(),s.push(i[1]),ts(l,o,s);return t.pop(),l.push("L",i),l.join("")}function Xo(t,e){return t[0]*e[0]+t[1]*e[1]+t[2]*e[2]+t[3]*e[3]}Wo.forEach(function(t,e){e.key=t,e.closed=/-closed$/.test(t)});var Zo=[0,2/3,1/3,0],Ko=[0,1/3,2/3,0],Qo=[0,1/6,2/3,1/6];function ts(t,e,n){t.push("C",Xo(Zo,e),",",Xo(Zo,n),",",Xo(Ko,e),",",Xo(Ko,n),",",Xo(Qo,e),",",Xo(Qo,n))}function es(t,e){return(e[1]-t[1])/(e[0]-t[0])}function ns(t){for(var e,n,i,r=-1,a=t.length;++r<a;)n=(e=t[r])[0],i=e[1]-Et,e[0]=n*Math.cos(i),e[1]=n*Math.sin(i);return t}function is(t){var e=nr,n=nr,i=0,r=ir,a=Xn,o=zo,s=o.key,l=o,u="L",c=.7;function d(s){var d,h,f,m=[],p=[],g=[],v=-1,_=s.length,y=ye(e),b=ye(i),M=e===n?function(){return h}:ye(n),x=i===r?function(){return f}:ye(r);function w(){m.push("M",o(t(g),c),u,l(t(p.reverse()),c),"Z")}for(;++v<_;)a.call(this,d=s[v],v)?(p.push([h=+y.call(this,d,v),f=+b.call(this,d,v)]),g.push([+M.call(this,d,v),+x.call(this,d,v)])):p.length&&(w(),p=[],g=[]);return p.length&&w(),m.length?m.join(""):null}return d.x=function(t){return arguments.length?(e=n=t,d):n},d.x0=function(t){return arguments.length?(e=t,d):e},d.x1=function(t){return arguments.length?(n=t,d):n},d.y=function(t){return arguments.length?(i=r=t,d):r},d.y0=function(t){return arguments.length?(i=t,d):i},d.y1=function(t){return arguments.length?(r=t,d):r},d.defined=function(t){return arguments.length?(a=t,d):a},d.interpolate=function(t){return arguments.length?(s="function"==typeof t?o=t:(o=Wo.get(t)||zo).key,l=o.reverse||o,u=o.closed?"M":"L",d):s},d.tension=function(t){return arguments.length?(c=t,d):c},d}function rs(t){return t.radius}function as(t){return[t.x,t.y]}function os(){return 64}function ss(){return"circle"}function ls(t){var e=Math.sqrt(t/Yt);return"M0,"+e+"A"+e+","+e+" 0 1,1 0,"+-e+"A"+e+","+e+" 0 1,1 0,"+e+"Z"}a.svg.line.radial=function(){var t=Ro(ns);return t.radius=t.x,delete t.x,t.angle=t.y,delete t.y,t},Uo.reverse=Go,Go.reverse=Uo,a.svg.area=function(){return is(N)},a.svg.area.radial=function(){var t=is(ns);return t.radius=t.x,delete t.x,t.innerRadius=t.x0,delete t.x0,t.outerRadius=t.x1,delete t.x1,t.angle=t.y,delete t.y,t.startAngle=t.y0,delete t.y0,t.endAngle=t.y1,delete t.y1,t},a.svg.chord=function(){var t=Wi,e=zi,n=rs,i=Ho,r=Vo;function a(n,i){var r=o(this,t,n,i),a=o(this,e,n,i);return"M"+r.p0+s(r.r,r.p1,r.a1-r.a0)+(function(t,e){return t.a0==e.a0&&t.a1==e.a1}(r,a)?l(r.r,r.p1,r.r,r.p0):l(r.r,r.p1,a.r,a.p0)+s(a.r,a.p1,a.a1-a.a0)+l(a.r,a.p1,r.r,r.p0))+"Z"}function o(t,e,a,o){var s=e.call(t,a,o),l=n.call(t,s,o),u=i.call(t,s,o)-Et,c=r.call(t,s,o)-Et;return{r:l,a0:u,a1:c,p0:[l*Math.cos(u),l*Math.sin(u)],p1:[l*Math.cos(c),l*Math.sin(c)]}}function s(t,e,n){return"A"+t+","+t+" 0 "+ +(n>Yt)+",1 "+e}function l(t,e,n,i){return"Q 0,0 "+i}return a.radius=function(t){return arguments.length?(n=ye(t),a):n},a.source=function(e){return arguments.length?(t=ye(e),a):t},a.target=function(t){return arguments.length?(e=ye(t),a):e},a.startAngle=function(t){return arguments.length?(i=ye(t),a):i},a.endAngle=function(t){return arguments.length?(r=ye(t),a):r},a},a.svg.diagonal=function(){var t=Wi,e=zi,n=as;function i(i,r){var a=t.call(this,i,r),o=e.call(this,i,r),s=(a.y+o.y)/2,l=[a,{x:a.x,y:s},{x:o.x,y:s},o];return"M"+(l=l.map(n))[0]+"C"+l[1]+" "+l[2]+" "+l[3]}return i.source=function(e){return arguments.length?(t=ye(e),i):t},i.target=function(t){return arguments.length?(e=ye(t),i):e},i.projection=function(t){return arguments.length?(n=t,i):n},i},a.svg.diagonal.radial=function(){var t=a.svg.diagonal(),e=as,n=t.projection;return t.projection=function(t){return arguments.length?n(function(t){return function(){var e=t.apply(this,arguments),n=e[0],i=e[1]-Et;return[n*Math.cos(i),n*Math.sin(i)]}}(e=t)):e},t},a.svg.symbol=function(){var t=ss,e=os;function n(n,i){return(us.get(t.call(this,n,i))||ls)(e.call(this,n,i))}return n.type=function(e){return arguments.length?(t=ye(e),n):t},n.size=function(t){return arguments.length?(e=ye(t),n):e},n};var us=a.map({circle:ls,cross:function(t){var e=Math.sqrt(t/5)/2;return"M"+-3*e+","+-e+"H"+-e+"V"+-3*e+"H"+e+"V"+-e+"H"+3*e+"V"+e+"H"+e+"V"+3*e+"H"+-e+"V"+e+"H"+-3*e+"Z"},diamond:function(t){var e=Math.sqrt(t/(2*ds)),n=e*ds;return"M0,"+-e+"L"+n+",0 0,"+e+" "+-n+",0Z"},square:function(t){var e=Math.sqrt(t)/2;return"M"+-e+","+-e+"L"+e+","+-e+" "+e+","+e+" "+-e+","+e+"Z"},"triangle-down":function(t){var e=Math.sqrt(t/cs),n=e*cs/2;return"M0,"+n+"L"+e+","+-n+" "+-e+","+-n+"Z"},"triangle-up":function(t){var e=Math.sqrt(t/cs),n=e*cs/2;return"M0,"+-n+"L"+e+","+n+" "+-e+","+n+"Z"}});a.svg.symbolTypes=us.keys();var cs=Math.sqrt(3),ds=Math.tan(30*At);Z.transition=function(t){for(var e,n,i=ps||++_s,r=Ms(t),a=[],o=gs||{time:Date.now(),ease:aa,delay:0,duration:250},s=-1,l=this.length;++s<l;){a.push(e=[]);for(var u=this[s],c=-1,d=u.length;++c<d;)(n=u[c])&&xs(n,c,r,i,o),e.push(n)}return ms(a,r,i)},Z.interrupt=function(t){return this.each(null==t?hs:fs(Ms(t)))};var hs=fs(Ms());function fs(t){return function(){var e,n,i;(e=this[t])&&(i=e[n=e.active])&&(i.timer.c=null,i.timer.t=NaN,--e.count?delete e[n]:delete this[t],e.active+=.5,i.event&&i.event.interrupt.call(this,this.__data__,i.index))}}function ms(t,e,n){return G(t,vs),t.namespace=e,t.id=n,t}var ps,gs,vs=[],_s=0;function ys(t,e,n,i){var r=t.id,a=t.namespace;return ft(t,"function"==typeof n?function(t,o,s){t[a][r].tween.set(e,i(n.call(t,t.__data__,o,s)))}:(n=i(n),function(t){t[a][r].tween.set(e,n)}))}function bs(t){return null==t&&(t=""),function(){this.textContent=t}}function Ms(t){return null==t?"__transition__":"__transition_"+t+"__"}function xs(t,e,n,i,r){var a,o,s,l,u,c=t[n]||(t[n]={active:0,count:0}),d=c[i];function h(n){var r=c.active,h=c[r];for(var m in h&&(h.timer.c=null,h.timer.t=NaN,--c.count,delete c[r],h.event&&h.event.interrupt.call(t,t.__data__,h.index)),c)if(+m<i){var p=c[m];p.timer.c=null,p.timer.t=NaN,--c.count,delete c[m]}o.c=f,Te(function(){return o.c&&f(n||1)&&(o.c=null,o.t=NaN),1},0,a),c.active=i,d.event&&d.event.start.call(t,t.__data__,e),u=[],d.tween.forEach(function(n,i){(i=i.call(t,t.__data__,e))&&u.push(i)}),l=d.ease,s=d.duration}function f(r){for(var a=r/s,o=l(a),h=u.length;h>0;)u[--h].call(t,o);if(a>=1)return d.event&&d.event.end.call(t,t.__data__,e),--c.count?delete c[i]:delete t[n],1}d||(a=r.time,o=Te(function(t){var e=d.delay;if(o.t=e+a,e<=t)return h(t-e);o.c=h},0,a),d=c[i]={tween:new k,time:a,timer:o,delay:r.delay,duration:r.duration,ease:r.ease,index:e},r=null,++c.count)}vs.call=Z.call,vs.empty=Z.empty,vs.node=Z.node,vs.size=Z.size,a.transition=function(t,e){return t&&t.transition?ps?t.transition(e):t:a.selection().transition(t)},a.transition.prototype=vs,vs.select=function(t){var e,n,i,r=this.id,a=this.namespace,o=[];t=K(t);for(var s=-1,l=this.length;++s<l;){o.push(e=[]);for(var u=this[s],c=-1,d=u.length;++c<d;)(i=u[c])&&(n=t.call(i,i.__data__,c,s))?("__data__"in i&&(n.__data__=i.__data__),xs(n,c,a,r,i[a][r]),e.push(n)):e.push(null)}return ms(o,a,r)},vs.selectAll=function(t){var e,n,i,r,a,o=this.id,s=this.namespace,l=[];t=Q(t);for(var u=-1,c=this.length;++u<c;)for(var d=this[u],h=-1,f=d.length;++h<f;)if(i=d[h]){a=i[s][o],n=t.call(i,i.__data__,h,u),l.push(e=[]);for(var m=-1,p=n.length;++m<p;)(r=n[m])&&xs(r,m,s,o,a),e.push(r)}return ms(l,s,o)},vs.filter=function(t){var e,n,i=[];"function"!=typeof t&&(t=ht(t));for(var r=0,a=this.length;r<a;r++){i.push(e=[]);for(var o,s=0,l=(o=this[r]).length;s<l;s++)(n=o[s])&&t.call(n,n.__data__,s,r)&&e.push(n)}return ms(i,this.namespace,this.id)},vs.tween=function(t,e){var n=this.id,i=this.namespace;return arguments.length<2?this.node()[i][n].tween.get(t):ft(this,null==e?function(e){e[i][n].tween.remove(t)}:function(r){r[i][n].tween.set(t,e)})},vs.attr=function(t,e){if(arguments.length<2){for(e in t)this.attr(e,t[e]);return this}var n="transform"==t?ga:Xr,i=a.ns.qualify(t);function r(){this.removeAttribute(i)}function o(){this.removeAttributeNS(i.space,i.local)}return ys(this,"attr."+t,e,i.local?function(t){return null==t?o:(t+="",function(){var e,r=this.getAttributeNS(i.space,i.local);return r!==t&&(e=n(r,t),function(t){this.setAttributeNS(i.space,i.local,e(t))})})}:function(t){return null==t?r:(t+="",function(){var e,r=this.getAttribute(i);return r!==t&&(e=n(r,t),function(t){this.setAttribute(i,e(t))})})})},vs.attrTween=function(t,e){var n=a.ns.qualify(t);return this.tween("attr."+t,n.local?function(t,i){var r=e.call(this,t,i,this.getAttributeNS(n.space,n.local));return r&&function(t){this.setAttributeNS(n.space,n.local,r(t))}}:function(t,i){var r=e.call(this,t,i,this.getAttribute(n));return r&&function(t){this.setAttribute(n,r(t))}})},vs.style=function(t,e,n){var i=arguments.length;if(i<3){if("string"!=typeof t){for(n in i<2&&(e=""),t)this.style(n,t[n],e);return this}n=""}function r(){this.style.removeProperty(t)}return ys(this,"style."+t,e,function(e){return null==e?r:(e+="",function(){var i,r=c(this).getComputedStyle(this,null).getPropertyValue(t);return r!==e&&(i=Xr(r,e),function(e){this.style.setProperty(t,i(e),n)})})})},vs.styleTween=function(t,e,n){return arguments.length<3&&(n=""),this.tween("style."+t,function(i,r){var a=e.call(this,i,r,c(this).getComputedStyle(this,null).getPropertyValue(t));return a&&function(e){this.style.setProperty(t,a(e),n)}})},vs.text=function(t){return ys(this,"text",t,bs)},vs.remove=function(){var t=this.namespace;return this.each("end.transition",function(){var e;this[t].count<2&&(e=this.parentNode)&&e.removeChild(this)})},vs.ease=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].ease:("function"!=typeof t&&(t=a.ease.apply(a,arguments)),ft(this,function(i){i[n][e].ease=t}))},vs.delay=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].delay:ft(this,"function"==typeof t?function(i,r,a){i[n][e].delay=+t.call(i,i.__data__,r,a)}:(t=+t,function(i){i[n][e].delay=t}))},vs.duration=function(t){var e=this.id,n=this.namespace;return arguments.length<1?this.node()[n][e].duration:ft(this,"function"==typeof t?function(i,r,a){i[n][e].duration=Math.max(1,t.call(i,i.__data__,r,a))}:(t=Math.max(1,t),function(i){i[n][e].duration=t}))},vs.each=function(t,e){var n=this.id,i=this.namespace;if(arguments.length<2){var r=gs,o=ps;try{ps=n,ft(this,function(e,r,a){gs=e[i][n],t.call(e,e.__data__,r,a)})}finally{gs=r,ps=o}}else ft(this,function(r){var o=r[i][n];(o.event||(o.event=a.dispatch("start","end","interrupt"))).on(t,e)});return this},vs.transition=function(){for(var t,e,n,i=this.id,r=++_s,a=this.namespace,o=[],s=0,l=this.length;s<l;s++){o.push(t=[]);for(var u,c=0,d=(u=this[s]).length;c<d;c++)(e=u[c])&&xs(e,c,a,r,{time:(n=e[a][i]).time,ease:n.ease,delay:n.delay+n.duration,duration:n.duration}),t.push(e)}return ms(o,a,r)},a.svg.axis=function(){var t,e=a.scale.linear(),n=ws,i=6,r=6,o=3,l=[10],u=null;function c(s){s.each(function(){var s,c=a.select(this),d=this.__chart__||e,h=this.__chart__=e.copy(),f=null==u?h.ticks?h.ticks.apply(h,l):h.domain():u,m=null==t?h.tickFormat?h.tickFormat.apply(h,l):N:t,p=c.selectAll(".tick").data(f,h),g=p.enter().insert("g",".domain").attr("class","tick").style("opacity",St),v=a.transition(p.exit()).style("opacity",St).remove(),_=a.transition(p.order()).style("opacity",1),y=Math.max(i,0)+o,b=ho(h),M=c.selectAll(".domain").data([0]),x=(M.enter().append("path").attr("class","domain"),a.transition(M));g.append("line"),g.append("text");var w,k,L,S,T=g.select("line"),Y=_.select("line"),D=p.select("text").text(m),C=g.select("text"),E=_.select("text"),A="top"===n||"left"===n?-1:1;if("bottom"===n||"top"===n?(s=Ls,w="x",L="y",k="x2",S="y2",D.attr("dy",A<0?"0em":".71em").style("text-anchor","middle"),x.attr("d","M"+b[0]+","+A*r+"V0H"+b[1]+"V"+A*r)):(s=Ss,w="y",L="x",k="y2",S="x2",D.attr("dy",".32em").style("text-anchor",A<0?"end":"start"),x.attr("d","M"+A*r+","+b[0]+"H0V"+b[1]+"H"+A*r)),T.attr(S,A*i),C.attr(L,A*y),Y.attr(k,0).attr(S,A*i),E.attr(w,0).attr(L,A*y),h.rangeBand){var O=h,j=O.rangeBand()/2;d=h=function(t){return O(t)+j}}else d.rangeBand?d=h:v.call(s,h,d);g.call(s,d,h),_.call(s,h,h)})}return c.scale=function(t){return arguments.length?(e=t,c):e},c.orient=function(t){return arguments.length?(n=t in ks?t+"":ws,c):n},c.ticks=function(){return arguments.length?(l=s(arguments),c):l},c.tickValues=function(t){return arguments.length?(u=t,c):u},c.tickFormat=function(e){return arguments.length?(t=e,c):t},c.tickSize=function(t){var e=arguments.length;return e?(i=+t,r=+arguments[e-1],c):i},c.innerTickSize=function(t){return arguments.length?(i=+t,c):i},c.outerTickSize=function(t){return arguments.length?(r=+t,c):r},c.tickPadding=function(t){return arguments.length?(o=+t,c):o},c.tickSubdivide=function(){return arguments.length&&c},c};var ws="bottom",ks={top:1,right:1,bottom:1,left:1};function Ls(t,e,n){t.attr("transform",function(t){var i=e(t);return"translate("+(isFinite(i)?i:n(t))+",0)"})}function Ss(t,e,n){t.attr("transform",function(t){var i=e(t);return"translate(0,"+(isFinite(i)?i:n(t))+")"})}a.svg.brush=function(){var t,e,n=B(h,"brushstart","brush","brushend"),i=null,r=null,o=[0,0],s=[0,0],l=!0,u=!0,d=Ys[0];function h(t){t.each(function(){var t=a.select(this).style("pointer-events","all").style("-webkit-tap-highlight-color","rgba(0,0,0,0)").on("mousedown.brush",g).on("touchstart.brush",g),e=t.selectAll(".background").data([0]);e.enter().append("rect").attr("class","background").style("visibility","hidden").style("cursor","crosshair"),t.selectAll(".extent").data([0]).enter().append("rect").attr("class","extent").style("cursor","move");var n=t.selectAll(".resize").data(d,N);n.exit().remove(),n.enter().append("g").attr("class",function(t){return"resize "+t}).style("cursor",function(t){return Ts[t]}).append("rect").attr("x",function(t){return/[ew]$/.test(t)?-3:null}).attr("y",function(t){return/^[ns]/.test(t)?-3:null}).attr("width",6).attr("height",6).style("visibility","hidden"),n.style("display",h.empty()?"none":null);var o,s=a.transition(t),l=a.transition(e);i&&(o=ho(i),l.attr("x",o[0]).attr("width",o[1]-o[0]),m(s)),r&&(o=ho(r),l.attr("y",o[0]).attr("height",o[1]-o[0]),p(s)),f(s)})}function f(t){t.selectAll(".resize").attr("transform",function(t){return"translate("+o[+/e$/.test(t)]+","+s[+/^s/.test(t)]+")"})}function m(t){t.select(".extent").attr("x",o[0]),t.selectAll(".extent,.n>rect,.s>rect").attr("width",o[1]-o[0])}function p(t){t.select(".extent").attr("y",s[0]),t.selectAll(".extent,.e>rect,.w>rect").attr("height",s[1]-s[0])}function g(){var d,g,v=this,_=a.select(a.event.target),y=n.of(v,arguments),b=a.select(v),M=_.datum(),x=!/^(n|s)$/.test(M)&&i,w=!/^(e|w)$/.test(M)&&r,k=_.classed("extent"),L=xt(v),S=a.mouse(v),T=a.select(c(v)).on("keydown.brush",function(){32==a.event.keyCode&&(k||(d=null,S[0]-=o[1],S[1]-=s[1],k=2),W())}).on("keyup.brush",function(){32==a.event.keyCode&&2==k&&(S[0]+=o[1],S[1]+=s[1],k=0,W())});if(a.event.changedTouches?T.on("touchmove.brush",C).on("touchend.brush",A):T.on("mousemove.brush",C).on("mouseup.brush",A),b.interrupt().selectAll("*").interrupt(),k)S[0]=o[0]-S[0],S[1]=s[0]-S[1];else if(M){var Y=+/w$/.test(M),D=+/^n/.test(M);g=[o[1-Y]-S[0],s[1-D]-S[1]],S[0]=o[Y],S[1]=s[D]}else a.event.altKey&&(d=S.slice());function C(){var t=a.mouse(v),e=!1;g&&(t[0]+=g[0],t[1]+=g[1]),k||(a.event.altKey?(d||(d=[(o[0]+o[1])/2,(s[0]+s[1])/2]),S[0]=o[+(t[0]<d[0])],S[1]=s[+(t[1]<d[1])]):d=null),x&&E(t,i,0)&&(m(b),e=!0),w&&E(t,r,1)&&(p(b),e=!0),e&&(f(b),y({type:"brush",mode:k?"move":"resize"}))}function E(n,i,r){var a,c,h=ho(i),f=h[0],m=h[1],p=S[r],g=r?s:o,v=g[1]-g[0];if(k&&(f-=p,m-=v+p),a=(r?u:l)?Math.max(f,Math.min(m,n[r])):n[r],k?c=(a+=p)+v:(d&&(p=Math.max(f,Math.min(m,2*d[r]-a))),p<a?(c=a,a=p):c=p),g[0]!=a||g[1]!=c)return r?e=null:t=null,g[0]=a,g[1]=c,!0}function A(){C(),b.style("pointer-events","all").selectAll(".resize").style("display",h.empty()?"none":null),a.select("body").style("cursor",null),T.on("mousemove.brush",null).on("mouseup.brush",null).on("touchmove.brush",null).on("touchend.brush",null).on("keydown.brush",null).on("keyup.brush",null),L(),y({type:"brushend"})}b.style("pointer-events","none").selectAll(".resize").style("display",null),a.select("body").style("cursor",_.style("cursor")),y({type:"brushstart"}),C()}return h.event=function(i){i.each(function(){var i=n.of(this,arguments),r={x:o,y:s,i:t,j:e},l=this.__chart__||r;this.__chart__=r,ps?a.select(this).transition().each("start.brush",function(){t=l.i,e=l.j,o=l.x,s=l.y,i({type:"brushstart"})}).tween("brush:brush",function(){var n=Zr(o,r.x),a=Zr(s,r.y);return t=e=null,function(t){o=r.x=n(t),s=r.y=a(t),i({type:"brush",mode:"resize"})}}).each("end.brush",function(){t=r.i,e=r.j,i({type:"brush",mode:"resize"}),i({type:"brushend"})}):(i({type:"brushstart"}),i({type:"brush",mode:"resize"}),i({type:"brushend"}))})},h.x=function(t){return arguments.length?(d=Ys[!(i=t)<<1|!r],h):i},h.y=function(t){return arguments.length?(d=Ys[!i<<1|!(r=t)],h):r},h.clamp=function(t){return arguments.length?(i&&r?(l=!!t[0],u=!!t[1]):i?l=!!t:r&&(u=!!t),h):i&&r?[l,u]:i?l:r?u:null},h.extent=function(n){var a,l,u,c,d;return arguments.length?(i&&(a=n[0],l=n[1],r&&(a=a[0],l=l[0]),t=[a,l],i.invert&&(a=i(a),l=i(l)),l<a&&(d=a,a=l,l=d),a==o[0]&&l==o[1]||(o=[a,l])),r&&(u=n[0],c=n[1],i&&(u=u[1],c=c[1]),e=[u,c],r.invert&&(u=r(u),c=r(c)),c<u&&(d=u,u=c,c=d),u==s[0]&&c==s[1]||(s=[u,c])),h):(i&&(t?(a=t[0],l=t[1]):(a=o[0],l=o[1],i.invert&&(a=i.invert(a),l=i.invert(l)),l<a&&(d=a,a=l,l=d))),r&&(e?(u=e[0],c=e[1]):(u=s[0],c=s[1],r.invert&&(u=r.invert(u),c=r.invert(c)),c<u&&(d=u,u=c,c=d))),i&&r?[[a,u],[l,c]]:i?[a,l]:r&&[u,c])},h.clear=function(){return h.empty()||(o=[0,0],s=[0,0],t=e=null),h},h.empty=function(){return!!i&&o[0]==o[1]||!!r&&s[0]==s[1]},a.rebind(h,n,"on")};var Ts={n:"ns-resize",e:"ew-resize",s:"ns-resize",w:"ew-resize",nw:"nwse-resize",ne:"nesw-resize",se:"nwse-resize",sw:"nesw-resize"},Ys=[["n","e","s","w","nw","ne","se","sw"],["e","w"],["n","s"],[]],Ds=He.format=dn.timeFormat,Cs=Ds.utc,Es=Cs("%Y-%m-%dT%H:%M:%S.%LZ");function As(t){return t.toISOString()}function Os(t,e,n){function i(e){return t(e)}function r(t,n){var i=(t[1]-t[0])/n,r=a.bisect(Ns,i);return r==Ns.length?[e.year,bo(t.map(function(t){return t/31536e6}),n)[2]]:r?e[i/Ns[r-1]<Ns[r]/i?r-1:r]:[Ps,bo(t,n)[2]]}return i.invert=function(e){return js(t.invert(e))},i.domain=function(e){return arguments.length?(t.domain(e),i):t.domain().map(js)},i.nice=function(t,e){var n=i.domain(),a=co(n),o=null==t?r(a,10):"number"==typeof t&&r(a,t);function s(n){return!isNaN(n)&&!t.range(n,js(+n+1),e).length}return o&&(t=o[0],e=o[1]),i.domain(mo(n,e>1?{floor:function(e){for(;s(e=t.floor(e));)e=js(e-1);return e},ceil:function(e){for(;s(e=t.ceil(e));)e=js(+e+1);return e}}:t))},i.ticks=function(t,e){var n=co(i.domain()),a=null==t?r(n,10):"number"==typeof t?r(n,t):!t.range&&[{range:t},e];return a&&(t=a[0],e=a[1]),t.range(n[0],js(+n[1]+1),e<1?1:e)},i.tickFormat=function(){return n},i.copy=function(){return Os(t.copy(),e,n)},_o(i,t)}function js(t){return new Date(t)}Ds.iso=Date.prototype.toISOString&&+new Date("2000-01-01T00:00:00.000Z")?As:Es,As.parse=function(t){var e=new Date(t);return isNaN(e)?null:e},As.toString=Es.toString,He.second=Ie(function(t){return new Ve(1e3*Math.floor(t/1e3))},function(t,e){t.setTime(t.getTime()+1e3*Math.floor(e))},function(t){return t.getSeconds()}),He.seconds=He.second.range,He.seconds.utc=He.second.utc.range,He.minute=Ie(function(t){return new Ve(6e4*Math.floor(t/6e4))},function(t,e){t.setTime(t.getTime()+6e4*Math.floor(e))},function(t){return t.getMinutes()}),He.minutes=He.minute.range,He.minutes.utc=He.minute.utc.range,He.hour=Ie(function(t){var e=t.getTimezoneOffset()/60;return new Ve(36e5*(Math.floor(t/36e5-e)+e))},function(t,e){t.setTime(t.getTime()+36e5*Math.floor(e))},function(t){return t.getHours()}),He.hours=He.hour.range,He.hours.utc=He.hour.utc.range,He.month=Ie(function(t){return(t=He.day(t)).setDate(1),t},function(t,e){t.setMonth(t.getMonth()+e)},function(t){return t.getMonth()}),He.months=He.month.range,He.months.utc=He.month.utc.range;var Ns=[1e3,5e3,15e3,3e4,6e4,3e5,9e5,18e5,36e5,108e5,216e5,432e5,864e5,1728e5,6048e5,2592e6,7776e6,31536e6],Hs=[[He.second,1],[He.second,5],[He.second,15],[He.second,30],[He.minute,1],[He.minute,5],[He.minute,15],[He.minute,30],[He.hour,1],[He.hour,3],[He.hour,6],[He.hour,12],[He.day,1],[He.day,2],[He.week,1],[He.month,1],[He.month,3],[He.year,1]],Vs=Ds.multi([[".%L",function(t){return t.getMilliseconds()}],[":%S",function(t){return t.getSeconds()}],["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",Xn]]),Ps={range:function(t,e,n){return a.range(Math.ceil(t/n)*n,+e,n).map(js)},floor:N,ceil:N};Hs.year=He.year,He.scale=function(){return Os(a.scale.linear(),Hs,Vs)};var Fs=Hs.map(function(t){return[t[0].utc,t[1]]}),Is=Cs.multi([[".%L",function(t){return t.getUTCMilliseconds()}],[":%S",function(t){return t.getUTCSeconds()}],["%I:%M",function(t){return t.getUTCMinutes()}],["%I %p",function(t){return t.getUTCHours()}],["%a %d",function(t){return t.getUTCDay()&&1!=t.getUTCDate()}],["%b %d",function(t){return 1!=t.getUTCDate()}],["%B",function(t){return t.getUTCMonth()}],["%Y",Xn]]);function Rs(t){return JSON.parse(t.responseText)}function Ws(t){var e=l.createRange();return e.selectNode(l.body),e.createContextualFragment(t.responseText)}Fs.year=He.year.utc,He.scale.utc=function(){return Os(a.scale.linear(),Fs,Is)},a.text=be(function(t){return t.responseText}),a.json=function(t,e){return Me(t,"application/json",Rs,e)},a.html=function(t,e){return Me(t,"text/html",Ws,e)},a.xml=be(function(t){return t.responseXML}),this.d3=a,void 0===(r="function"==typeof(i=a)?i.call(e,n,e,t):i)||(t.exports=r)}()},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var i=n(0);let r=class{constructor(){this.toggleViews=new Map}};r=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)()],r)},function(t,e,n){"use strict";n.d(e,"a",function(){return i});class i{constructor(t){this.guid=t}static newGuid(){let t,e,n;for(t="",n=0;n<32;n++)8!==n&&12!==n&&16!==n&&20!==n||(t+="-"),t+=e=Math.floor(16*Math.random()).toString(16).toUpperCase();return new i(t)}toString(t){return t&&"n"===t.toLowerCase()?this.guid.replace(/-/g,""):this.guid}}},function(t,e,n){"use strict";n.d(e,"a",function(){return c});var i=n(11),r=n(51),a=n(53),o=n(24),s=n(52),l=n(23),u=n(34),c=function(t){function e(n,i,r){var o=t.call(this)||this;switch(o.syncErrorValue=null,o.syncErrorThrown=!1,o.syncErrorThrowable=!1,o.isStopped=!1,arguments.length){case 0:o.destination=a.a;break;case 1:if(!n){o.destination=a.a;break}if("object"==typeof n){n instanceof e?(o.syncErrorThrowable=n.syncErrorThrowable,o.destination=n,n.add(o)):(o.syncErrorThrowable=!0,o.destination=new d(o,n));break}default:o.syncErrorThrowable=!0,o.destination=new d(o,n,i,r)}return o}return i.a(e,t),e.prototype[s.a]=function(){return this},e.create=function(t,n,i){var r=new e(t,n,i);return r.syncErrorThrowable=!1,r},e.prototype.next=function(t){this.isStopped||this._next(t)},e.prototype.error=function(t){this.isStopped||(this.isStopped=!0,this._error(t))},e.prototype.complete=function(){this.isStopped||(this.isStopped=!0,this._complete())},e.prototype.unsubscribe=function(){this.closed||(this.isStopped=!0,t.prototype.unsubscribe.call(this))},e.prototype._next=function(t){this.destination.next(t)},e.prototype._error=function(t){this.destination.error(t),this.unsubscribe()},e.prototype._complete=function(){this.destination.complete(),this.unsubscribe()},e.prototype._unsubscribeAndRecycle=function(){var t=this._parentOrParents;return this._parentOrParents=null,this.unsubscribe(),this.closed=!1,this.isStopped=!1,this._parentOrParents=t,this},e}(o.a),d=function(t){function e(e,n,i,o){var s,l=t.call(this)||this;l._parentSubscriber=e;var u=l;return Object(r.a)(n)?s=n:n&&(s=n.next,i=n.error,o=n.complete,n!==a.a&&(u=Object.create(n),Object(r.a)(u.unsubscribe)&&l.add(u.unsubscribe.bind(u)),u.unsubscribe=l.unsubscribe.bind(l))),l._context=u,l._next=s,l._error=i,l._complete=o,l}return i.a(e,t),e.prototype.next=function(t){if(!this.isStopped&&this._next){var e=this._parentSubscriber;l.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?this.__tryOrSetError(e,this._next,t)&&this.unsubscribe():this.__tryOrUnsub(this._next,t)}},e.prototype.error=function(t){if(!this.isStopped){var e=this._parentSubscriber,n=l.a.useDeprecatedSynchronousErrorHandling;if(this._error)n&&e.syncErrorThrowable?(this.__tryOrSetError(e,this._error,t),this.unsubscribe()):(this.__tryOrUnsub(this._error,t),this.unsubscribe());else if(e.syncErrorThrowable)n?(e.syncErrorValue=t,e.syncErrorThrown=!0):Object(u.a)(t),this.unsubscribe();else{if(this.unsubscribe(),n)throw t;Object(u.a)(t)}}},e.prototype.complete=function(){var t=this;if(!this.isStopped){var e=this._parentSubscriber;if(this._complete){var n=function(){return t._complete.call(t._context)};l.a.useDeprecatedSynchronousErrorHandling&&e.syncErrorThrowable?(this.__tryOrSetError(e,n),this.unsubscribe()):(this.__tryOrUnsub(n),this.unsubscribe())}else this.unsubscribe()}},e.prototype.__tryOrUnsub=function(t,e){try{t.call(this._context,e)}catch(t){if(this.unsubscribe(),l.a.useDeprecatedSynchronousErrorHandling)throw t;Object(u.a)(t)}},e.prototype.__tryOrSetError=function(t,e,n){if(!l.a.useDeprecatedSynchronousErrorHandling)throw new Error("bad call");try{e.call(this._context,n)}catch(e){return l.a.useDeprecatedSynchronousErrorHandling?(t.syncErrorValue=e,t.syncErrorThrown=!0,!0):(Object(u.a)(e),!0)}return!1},e.prototype._unsubscribe=function(){var t=this._parentSubscriber;this._context=null,this._parentSubscriber=null,t.unsubscribe()},e}(c)},function(t,e,n){"use strict";n.d(e,"a",function(){return i});class i{constructor(t){this.catToString=t,this.internalMap=new Map}set(t,e){return this.internalMap.set(this.catToString(t),e)}get(t){return this.internalMap.get(this.catToString(t))}has(t){return this.internalMap.has(this.catToString(t))}delete(t){return this.internalMap.delete(this.catToString(t))}get size(){return this.internalMap.size}forEach(t,e){this.internalMap.forEach(t,e)}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});class i{constructor(t){this.config=t}}},function(t,e,n){"use strict";var i=n(7),r="http://www.w3.org/1999/xhtml",a={svg:"http://www.w3.org/2000/svg",xhtml:r,xlink:"http://www.w3.org/1999/xlink",xml:"http://www.w3.org/XML/1998/namespace",xmlns:"http://www.w3.org/2000/xmlns/"},o=function(t){var e=t+="",n=e.indexOf(":");return n>=0&&"xmlns"!==(e=t.slice(0,n))&&(t=t.slice(n+1)),a.hasOwnProperty(e)?{space:a[e],local:t}:t};var s=function(t){var e=o(t);return(e.local?function(t){return function(){return this.ownerDocument.createElementNS(t.space,t.local)}}:function(t){return function(){var e=this.ownerDocument,n=this.namespaceURI;return n===r&&e.documentElement.namespaceURI===r?e.createElement(t):e.createElementNS(n,t)}})(e)};function l(){}var u=function(t){return null==t?l:function(){return this.querySelector(t)}};function c(){return[]}var d=function(t){return function(){return this.matches(t)}};if("undefined"!=typeof document){var h=document.documentElement;if(!h.matches){var f=h.webkitMatchesSelector||h.msMatchesSelector||h.mozMatchesSelector||h.oMatchesSelector;d=function(t){return function(){return f.call(this,t)}}}}var m=d,p=function(t){return new Array(t.length)};function g(t,e){this.ownerDocument=t.ownerDocument,this.namespaceURI=t.namespaceURI,this._next=null,this._parent=t,this.__data__=e}g.prototype={constructor:g,appendChild:function(t){return this._parent.insertBefore(t,this._next)},insertBefore:function(t,e){return this._parent.insertBefore(t,e)},querySelector:function(t){return this._parent.querySelector(t)},querySelectorAll:function(t){return this._parent.querySelectorAll(t)}};var v="$";function _(t,e,n,i,r,a){for(var o,s=0,l=e.length,u=a.length;s<u;++s)(o=e[s])?(o.__data__=a[s],i[s]=o):n[s]=new g(t,a[s]);for(;s<l;++s)(o=e[s])&&(r[s]=o)}function y(t,e,n,i,r,a,o){var s,l,u,c={},d=e.length,h=a.length,f=new Array(d);for(s=0;s<d;++s)(l=e[s])&&(f[s]=u=v+o.call(l,l.__data__,s,e),u in c?r[s]=l:c[u]=l);for(s=0;s<h;++s)(l=c[u=v+o.call(t,a[s],s,a)])?(i[s]=l,l.__data__=a[s],c[u]=null):n[s]=new g(t,a[s]);for(s=0;s<d;++s)(l=e[s])&&c[f[s]]===l&&(r[s]=l)}function b(t,e){return t<e?-1:t>e?1:t>=e?0:NaN}var M=function(t){return t.ownerDocument&&t.ownerDocument.defaultView||t.document&&t||t.defaultView};function x(t){return t.trim().split(/^|\s+/)}function w(t){return t.classList||new k(t)}function k(t){this._node=t,this._names=x(t.getAttribute("class")||"")}function L(t,e){for(var n=w(t),i=-1,r=e.length;++i<r;)n.add(e[i])}function S(t,e){for(var n=w(t),i=-1,r=e.length;++i<r;)n.remove(e[i])}k.prototype={add:function(t){this._names.indexOf(t)<0&&(this._names.push(t),this._node.setAttribute("class",this._names.join(" ")))},remove:function(t){var e=this._names.indexOf(t);e>=0&&(this._names.splice(e,1),this._node.setAttribute("class",this._names.join(" ")))},contains:function(t){return this._names.indexOf(t)>=0}};function T(){this.textContent=""}function Y(){this.innerHTML=""}function D(){this.nextSibling&&this.parentNode.appendChild(this)}function C(){this.previousSibling&&this.parentNode.insertBefore(this,this.parentNode.firstChild)}function E(){return null}function A(){var t=this.parentNode;t&&t.removeChild(this)}function O(){return this.parentNode.insertBefore(this.cloneNode(!1),this.nextSibling)}function j(){return this.parentNode.insertBefore(this.cloneNode(!0),this.nextSibling)}var N={},H=null;"undefined"!=typeof document&&("onmouseenter"in document.documentElement||(N={mouseenter:"mouseover",mouseleave:"mouseout"}));function V(t,e,n){return t=P(t,e,n),function(e){var n=e.relatedTarget;n&&(n===this||8&n.compareDocumentPosition(this))||t.call(this,e)}}function P(t,e,n){return function(i){var r=H;H=i;try{t.call(this,this.__data__,e,n)}finally{H=r}}}function F(t){return function(){var e=this.__on;if(e){for(var n,i=0,r=-1,a=e.length;i<a;++i)n=e[i],t.type&&n.type!==t.type||n.name!==t.name?e[++r]=n:this.removeEventListener(n.type,n.listener,n.capture);++r?e.length=r:delete this.__on}}}function I(t,e,n){var i=N.hasOwnProperty(t.type)?V:P;return function(r,a,o){var s,l=this.__on,u=i(e,a,o);if(l)for(var c=0,d=l.length;c<d;++c)if((s=l[c]).type===t.type&&s.name===t.name)return this.removeEventListener(s.type,s.listener,s.capture),this.addEventListener(s.type,s.listener=u,s.capture=n),void(s.value=e);this.addEventListener(t.type,u,n),s={type:t.type,name:t.name,value:e,listener:u,capture:n},l?l.push(s):this.__on=[s]}}function R(t,e,n,i){var r=H;t.sourceEvent=H,H=t;try{return e.apply(n,i)}finally{H=r}}function W(t,e,n){var i=M(t),r=i.CustomEvent;"function"==typeof r?r=new r(e,n):(r=i.document.createEvent("Event"),n?(r.initEvent(e,n.bubbles,n.cancelable),r.detail=n.detail):r.initEvent(e,!1,!1)),t.dispatchEvent(r)}var z=[null];function B(t,e){this._groups=t,this._parents=e}function U(){return new B([[document.documentElement]],z)}B.prototype=U.prototype={constructor:B,select:function(t){"function"!=typeof t&&(t=u(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var a,o,s=e[r],l=s.length,c=i[r]=new Array(l),d=0;d<l;++d)(a=s[d])&&(o=t.call(a,a.__data__,d,s))&&("__data__"in a&&(o.__data__=a.__data__),c[d]=o);return new B(i,this._parents)},selectAll:function(t){"function"!=typeof t&&(t=function(t){return null==t?c:function(){return this.querySelectorAll(t)}}(t));for(var e=this._groups,n=e.length,i=[],r=[],a=0;a<n;++a)for(var o,s=e[a],l=s.length,u=0;u<l;++u)(o=s[u])&&(i.push(t.call(o,o.__data__,u,s)),r.push(o));return new B(i,r)},filter:function(t){"function"!=typeof t&&(t=m(t));for(var e=this._groups,n=e.length,i=new Array(n),r=0;r<n;++r)for(var a,o=e[r],s=o.length,l=i[r]=[],u=0;u<s;++u)(a=o[u])&&t.call(a,a.__data__,u,o)&&l.push(a);return new B(i,this._parents)},data:function(t,e){if(!t)return f=new Array(this.size()),u=-1,this.each(function(t){f[++u]=t}),f;var n=e?y:_,i=this._parents,r=this._groups;"function"!=typeof t&&(t=function(t){return function(){return t}}(t));for(var a=r.length,o=new Array(a),s=new Array(a),l=new Array(a),u=0;u<a;++u){var c=i[u],d=r[u],h=d.length,f=t.call(c,c&&c.__data__,u,i),m=f.length,p=s[u]=new Array(m),g=o[u]=new Array(m);n(c,d,p,g,l[u]=new Array(h),f,e);for(var v,b,M=0,x=0;M<m;++M)if(v=p[M]){for(M>=x&&(x=M+1);!(b=g[x])&&++x<m;);v._next=b||null}}return(o=new B(o,i))._enter=s,o._exit=l,o},enter:function(){return new B(this._enter||this._groups.map(p),this._parents)},exit:function(){return new B(this._exit||this._groups.map(p),this._parents)},merge:function(t){for(var e=this._groups,n=t._groups,i=e.length,r=n.length,a=Math.min(i,r),o=new Array(i),s=0;s<a;++s)for(var l,u=e[s],c=n[s],d=u.length,h=o[s]=new Array(d),f=0;f<d;++f)(l=u[f]||c[f])&&(h[f]=l);for(;s<i;++s)o[s]=e[s];return new B(o,this._parents)},order:function(){for(var t=this._groups,e=-1,n=t.length;++e<n;)for(var i,r=t[e],a=r.length-1,o=r[a];--a>=0;)(i=r[a])&&(o&&o!==i.nextSibling&&o.parentNode.insertBefore(i,o),o=i);return this},sort:function(t){function e(e,n){return e&&n?t(e.__data__,n.__data__):!e-!n}t||(t=b);for(var n=this._groups,i=n.length,r=new Array(i),a=0;a<i;++a){for(var o,s=n[a],l=s.length,u=r[a]=new Array(l),c=0;c<l;++c)(o=s[c])&&(u[c]=o);u.sort(e)}return new B(r,this._parents).order()},call:function(){var t=arguments[0];return arguments[0]=this,t.apply(null,arguments),this},nodes:function(){var t=new Array(this.size()),e=-1;return this.each(function(){t[++e]=this}),t},node:function(){for(var t=this._groups,e=0,n=t.length;e<n;++e)for(var i=t[e],r=0,a=i.length;r<a;++r){var o=i[r];if(o)return o}return null},size:function(){var t=0;return this.each(function(){++t}),t},empty:function(){return!this.node()},each:function(t){for(var e=this._groups,n=0,i=e.length;n<i;++n)for(var r,a=e[n],o=0,s=a.length;o<s;++o)(r=a[o])&&t.call(r,r.__data__,o,a);return this},attr:function(t,e){var n=o(t);if(arguments.length<2){var i=this.node();return n.local?i.getAttributeNS(n.space,n.local):i.getAttribute(n)}return this.each((null==e?n.local?function(t){return function(){this.removeAttributeNS(t.space,t.local)}}:function(t){return function(){this.removeAttribute(t)}}:"function"==typeof e?n.local?function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttributeNS(t.space,t.local):this.setAttributeNS(t.space,t.local,n)}}:function(t,e){return function(){var n=e.apply(this,arguments);null==n?this.removeAttribute(t):this.setAttribute(t,n)}}:n.local?function(t,e){return function(){this.setAttributeNS(t.space,t.local,e)}}:function(t,e){return function(){this.setAttribute(t,e)}})(n,e))},style:function(t,e,n){return arguments.length>1?this.each((null==e?function(t){return function(){this.style.removeProperty(t)}}:"function"==typeof e?function(t,e,n){return function(){var i=e.apply(this,arguments);null==i?this.style.removeProperty(t):this.style.setProperty(t,i,n)}}:function(t,e,n){return function(){this.style.setProperty(t,e,n)}})(t,e,null==n?"":n)):function(t,e){return t.style.getPropertyValue(e)||M(t).getComputedStyle(t,null).getPropertyValue(e)}(this.node(),t)},property:function(t,e){return arguments.length>1?this.each((null==e?function(t){return function(){delete this[t]}}:"function"==typeof e?function(t,e){return function(){var n=e.apply(this,arguments);null==n?delete this[t]:this[t]=n}}:function(t,e){return function(){this[t]=e}})(t,e)):this.node()[t]},classed:function(t,e){var n=x(t+"");if(arguments.length<2){for(var i=w(this.node()),r=-1,a=n.length;++r<a;)if(!i.contains(n[r]))return!1;return!0}return this.each(("function"==typeof e?function(t,e){return function(){(e.apply(this,arguments)?L:S)(this,t)}}:e?function(t){return function(){L(this,t)}}:function(t){return function(){S(this,t)}})(n,e))},text:function(t){return arguments.length?this.each(null==t?T:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.textContent=null==e?"":e}}:function(t){return function(){this.textContent=t}})(t)):this.node().textContent},html:function(t){return arguments.length?this.each(null==t?Y:("function"==typeof t?function(t){return function(){var e=t.apply(this,arguments);this.innerHTML=null==e?"":e}}:function(t){return function(){this.innerHTML=t}})(t)):this.node().innerHTML},raise:function(){return this.each(D)},lower:function(){return this.each(C)},append:function(t){var e="function"==typeof t?t:s(t);return this.select(function(){return this.appendChild(e.apply(this,arguments))})},insert:function(t,e){var n="function"==typeof t?t:s(t),i=null==e?E:"function"==typeof e?e:u(e);return this.select(function(){return this.insertBefore(n.apply(this,arguments),i.apply(this,arguments)||null)})},remove:function(){return this.each(A)},clone:function(t){return this.select(t?j:O)},datum:function(t){return arguments.length?this.property("__data__",t):this.node().__data__},on:function(t,e,n){var i,r,a=function(t){return t.trim().split(/^|\s+/).map(function(t){var e="",n=t.indexOf(".");return n>=0&&(e=t.slice(n+1),t=t.slice(0,n)),{type:t,name:e}})}(t+""),o=a.length;if(!(arguments.length<2)){for(s=e?I:F,null==n&&(n=!1),i=0;i<o;++i)this.each(s(a[i],e,n));return this}var s=this.node().__on;if(s)for(var l,u=0,c=s.length;u<c;++u)for(i=0,l=s[u];i<o;++i)if((r=a[i]).type===l.type&&r.name===l.name)return l.value},dispatch:function(t,e){return this.each(("function"==typeof e?function(t,e){return function(){return W(this,t,e.apply(this,arguments))}}:function(t,e){return function(){return W(this,t,e)}})(t,e))}};var G=function(t){return"string"==typeof t?new B([[document.querySelector(t)]],[document.documentElement]):new B([[t]],z)},q=function(t){return G(s(t).call(document.documentElement))},J=0;function X(){this._="@"+(++J).toString(36)}X.prototype=function(){return new X}.prototype={constructor:X,get:function(t){for(var e=this._;!(e in t);)if(!(t=t.parentNode))return;return t[e]},set:function(t,e){return t[this._]=e},remove:function(t){return this._ in t&&delete t[this._]},toString:function(){return this._}};var Z,K=function(){for(var t,e=H;t=e.sourceEvent;)e=t;return e},Q=function(t,e){var n=t.ownerSVGElement||t;if(n.createSVGPoint){var i=n.createSVGPoint();return i.x=e.clientX,i.y=e.clientY,[(i=i.matrixTransform(t.getScreenCTM().inverse())).x,i.y]}var r=t.getBoundingClientRect();return[e.clientX-r.left-t.clientLeft,e.clientY-r.top-t.clientTop]},tt=function(t){var e=K();return e.changedTouches&&(e=e.changedTouches[0]),Q(t,e)},et=function(t,e,n){arguments.length<3&&(n=e,e=K().changedTouches);for(var i,r=0,a=e?e.length:0;r<a;++r)if((i=e[r]).identifier===n)return Q(t,i);return null},nt=n(2),it=n(16),rt=n(4),at=n(9),ot=n(3);!function(t){t[t.SolidColor=0]="SolidColor",t[t.Image=1]="Image",t[t.Graph=2]="Graph"}(Z||(Z={}));var st,lt=n(5);!function(t){t[t.HorizontalTranslation=0]="HorizontalTranslation",t[t.VerticalTranslation=1]="VerticalTranslation",t[t.Rotation=2]="Rotation"}(st||(st={}));var ut,ct=n(0);!function(t){t[t.ClockWise=0]="ClockWise",t[t.ReverseClockWise=1]="ReverseClockWise"}(ut||(ut={}));var dt,ht=n(8),ft=n(10);class mt{constructor(t,e,n,i){if(this.signalRAppId=i,this.rotationValueChanged=new ct.EventEmitter,!t.variableName)return;const r=new ft.a(t.variableName,t.variableGroupName,t.dataSourceCode,t.variableVersion),a=ht.a.getConvertedVariableName(n,r);a&&e.subscribeVariableState(a).subscribe(t=>{t.state===rt.d.Normal&&e.openVariable(a,this.signalRAppId).subscribe(t=>{t.state===rt.d.DataNormal&&(this.currentValue=t,this.rotationValueChanged.emit(this.currentValue.value))})})}}class pt{constructor(t,e,n,i){this.doRotation=new ct.EventEmitter,new mt(t,e,n,i).rotationValueChanged.subscribe(e=>{if(+t.rotationDirection===ut.ClockWise){let n;if(!0===t.isProportion){const i=(t.maxAngle-t.minAngle)/(t.maxProportionScale-t.minProportionScale);n=!0===t.isReverseProportion?e>t.maxProportionScale?t.minAngle:e<t.minProportionScale?t.maxAngle:t.maxAngle-(e-t.minProportionScale)*i:e>t.maxProportionScale?t.maxAngle:e<t.minProportionScale?t.minAngle:t.minAngle+(e-t.minProportionScale)*i,this.doRotation.emit(n)}else e<t.minAngle?this.doRotation.emit(t.minAngle):e>t.maxAngle?this.doRotation.emit(t.maxAngle):this.doRotation.emit(e)}else if(+t.rotationDirection===ut.ReverseClockWise){let n;const i=360-t.maxAngle,r=360-t.minAngle;if(!0===t.isProportion){const a=(r-i)/(t.maxProportionScale-t.minProportionScale);!0===t.isReverseProportion?n=e>t.maxProportionScale?r:e<t.minProportionScale?i:i+(e-t.minProportionScale)*a:(n=e>t.maxProportionScale?i:e<t.minProportionScale?r:r-(e-t.minProportionScale)*a)>r?n=r:n<i&&(n=i),this.doRotation.emit(n)}else(n=360-e)<i?this.doRotation.emit(i):n>r?this.doRotation.emit(r):this.doRotation.emit(n)}})}}!function(t){t[t.Horizontal=0]="Horizontal",t[t.Vertical=1]="Vertical"}(dt||(dt={}));class gt{constructor(t,e,n,i){if(this.translationValueChanged=new ct.EventEmitter,!t.variableName)return;const r=new ft.a(t.variableName,t.variableGroupName,t.dataSourceCode,t.variableVersion),a=ht.a.getConvertedVariableName(n,r);a&&e.subscribeVariableState(a).subscribe(t=>{t.state===rt.d.Normal&&e.openVariable(a,i).subscribe(t=>{t.state===rt.d.DataNormal&&(this.currentValue=t,this.translationValueChanged.emit(this.currentValue.value))})})}}class vt{constructor(t,e,n,i,r,a){if(this.doTranslation=new ct.EventEmitter,i===dt.Horizontal){new gt(t,e,n,a).translationValueChanged.subscribe(e=>{const n=this.getTranslationValue(t,+e,r.x);this.doTranslation.emit(n)})}if(i===dt.Vertical){new gt(t,e,n,a).translationValueChanged.subscribe(e=>{const n=this.getTranslationValue(t,+e,r.y);this.doTranslation.emit(n)})}}getTranslationValue(t,e,n){let i;if(!0===t.isProportion){const r=(t.maxCoordinate-t.minCoordinate)/(t.maxProportionScale-t.minProportionScale);if(!0===t.isReverseProportion){const a=n+t.maxCoordinate;i=+e>t.maxProportionScale?n+t.minCoordinate:+e<t.minProportionScale?a:a-(+e-t.minProportionScale)*r}else i=+e>t.maxProportionScale?t.maxCoordinate+n:+e<t.minProportionScale?t.minCoordinate+n:n+t.minCoordinate+(e-t.minProportionScale)*r}else i=e+n;return i>t.maxCoordinate+n&&(i=t.maxCoordinate+n),i<t.minCoordinate+n&&(i=t.minCoordinate+n),i}}class _t{constructor(t,e,n){this.translation=t,this.angel=e,this.behaviorType=n}}class yt{constructor(t,e,n,i,r){if(this.doBehavior=new ct.EventEmitter,t.isHorizontalTranslation&&null!=t.horizontalTranslation){new vt(t.horizontalTranslation,e,n,dt.Horizontal,i,r).doTranslation.subscribe(t=>{const e=new _t(t,void 0,st.HorizontalTranslation);this.doBehavior.emit(e)})}if(t.isVerticalTranslation&&null!=t.verticalTranslation){new vt(t.verticalTranslation,e,n,dt.Vertical,i,r).doTranslation.subscribe(t=>{const e=new _t(t,void 0,st.VerticalTranslation);this.doBehavior.emit(e)})}if(t.isRotation&&null!=t.rotation){new pt(t.rotation,e,n,r).doRotation.subscribe(t=>{const e=new _t(void 0,t,st.Rotation);this.doBehavior.emit(e)})}}}class bt{constructor(t,e=""){this.signalRAppId=e,this.$element=$(t),this.rootElement=G(t),this.model=JSON.parse(this.rootElement.attr("data-model"))}}class Mt extends bt{constructor(t,e,n,i,r){super(t,r),this.permissionChecker=e,this.variableCommunicator=n,this.variableStore=i,this.initDisplay()}initDisplay(){if(!1===this.model.isAwaysDisplay)if(this.hide(),null==this.model.version||this.model.version<3)this.updateVisibilityByCondition();else{const t=this.model.isDisplayControl||this.model.conditionItems.length>0;this.model.isDisplayPermission&&!t&&this.updateVisibilityByPermission(),!this.model.isDisplayPermission&&t&&this.updateVisibilityByCondition(),this.model.isDisplayPermission&&t&&this.checkDisplayConditionAndPermission()}}checkDisplayConditionAndPermission(){if(null==this.model.conditionItems||!this.model.conditionItems.length)return;const t=new ot.ConditionItemsResultObserver(this.model.conditionItems,this.variableCommunicator,this.variableStore);t.conditionResultChanged.subscribe(t=>{t.value?this.updateVisibilityByPermission():this.hide()}),t.requestData(this.signalRAppId)}updateVisibilityByCondition(){if(null==this.model.conditionItems||!this.model.conditionItems.length)return;const t=new ot.ConditionItemsResultObserver(this.model.conditionItems,this.variableCommunicator,this.variableStore);t.conditionResultChanged.subscribe(t=>{t.value?this.show():this.hide()}),t.requestData(this.signalRAppId)}updateVisibilityByPermission(){this.model.displayPermissionCodes&&this.model.displayPermissionCodes.length&&(this.permissionChecker.isGranted(this.model.displayPermissionCodes)?this.show():this.hide())}hide(){this.rootElement.style("display","none")}show(){this.rootElement.style("display","block")}}class xt extends Mt{constructor(t,e,n,i,r){super(t,e,n,i,r),this.variableCommunicator=n,this.variableStore=i,this.initDynamicBehavior()}initDynamicBehavior(){if(this.ang=0,this.model.version>=1&&null!=this.model.dynamicSetting){const t=this.getActualLocation(),e=this.model.strokeWidth?this.model.strokeWidth:0;this.hor=t.x-Number(e)/2,this.ver=t.y-Number(e)/2,new yt(this.model.dynamicSetting,this.variableCommunicator,this.variableStore,t,this.signalRAppId).doBehavior.subscribe(t=>{this.model.angle&&(this.ang=Number(this.model.angle)),t.behaviorType===st.HorizontalTranslation?this.hor=Number(t.translation)-Number(e)/2:t.behaviorType===st.VerticalTranslation?this.ver=Number(t.translation)-Number(e)/2:t.behaviorType===st.Rotation&&(this.model.angle?this.ang+=Number(t.angel):this.ang=Number(t.angel));const n=Math.cos(this.ang*Math.PI/180),i=Math.sin(this.ang*Math.PI/180);if(this.model.version>=2){const t=this.getActualSize();if(void 0===t)this.x=this.hor,this.y=this.ver;else switch(this.model.fixedPositionType){case 0:this.x=this.hor,this.y=this.ver;break;case 1:this.x=this.hor+t.width/2,this.y=this.ver;break;case 2:this.x=this.hor+t.width,this.y=this.ver;break;case 3:this.x=this.hor,this.y=this.ver+t.height/2;break;case 4:this.x=this.hor+t.width/2,this.y=this.ver+t.height/2;break;case 5:this.x=this.hor+t.width,this.y=this.ver+t.height/2;break;case 6:this.x=this.hor,this.y=this.ver+t.height;break;case 7:this.x=this.hor+t.width/2,this.y=this.ver+t.height;break;case 8:this.x=this.hor+t.width,this.y=this.ver+t.height}let e=!0;(e=(this.model.category!==lt.d.components.meterKey&&this.model.category!==lt.d.components.switchIndicatorLightKey&&this.model.category!==lt.d.components.imageKey||!(this.model.version>4))&&(!(this.model.category===lt.d.components.toggleViewKey&&this.model.version>5)&&!(this.model.category!==lt.d.components.meterKey&&this.model.category!==lt.d.components.switchIndicatorLightKey&&this.model.category!==lt.d.components.imageKey&&this.model.category!==lt.d.components.toggleViewKey&&this.model.version>3)))?(this.rotatedHor=(this.hor-this.x)*n-(this.ver-this.y)*i+this.x,this.rotatedVer=(this.hor-this.x)*i+(this.ver-this.y)*n+this.y):(this.rotatedHor=(this.hor-this.x)*n-(this.ver-this.y)*i+this.hor,this.rotatedVer=(this.hor-this.x)*i+(this.ver-this.y)*n+this.ver),this.transform="matrix("+n.toFixed(6)+","+i.toFixed(6)+","+(-1*i).toFixed(6)+","+n.toFixed(6)+","+this.rotatedHor+","+this.rotatedVer+")",this.rootElement.style("-webkit-transform",this.transform)}else this.transform="matrix("+n.toFixed(6)+","+i.toFixed(6)+","+(-1*i).toFixed(6)+","+n.toFixed(6)+","+this.hor+","+this.ver+")",this.rootElement.style("-webkit-transform",this.transform)})}}getActualSize(){return this.model.size}getActualLocation(){return this.model.location}isBold(t){return t&&-1!==t.indexOf("bold")}isItalic(t){return t&&-1!==t.indexOf("Italic")}fontFamily(t){if(!t)return null;const e=this.isBold(t)?1:0,n=this.isItalic(t)?1:0,i=t.split(" "),r=e+n+1;return i.length>r?i[r]:null}}class wt extends xt{constructor(t,e,n,i,r,a){super(t,e,n,i,a),this.localization=r,this.isEnable=!0,this.elementStates=[]}initState(){this.elementStates.length&&(this.state=ot.State.Loading,this.loadStateData(this.state))}updateElementStates(t){Object(nt.forEach)(this.elementStates,e=>{Object(nt.forEach)(t,t=>{e.variableName===t.variableName&&(e.state=t.state)})}),this.changeStates()}addElementState(t){let e=!1;Object(nt.forEach)(this.elementStates,n=>{n.variableName===t.variableName&&(e=!0)}),e||this.elementStates.push(t)}changeStates(){this.state=ot.State.Normal,Object(nt.forEach)(this.elementStates,t=>{const e=this.getState(t);this.changeState(e)}),this.state===ot.State.Normal&&(this.isEnable||(this.state=ot.State.Disable)),this.loadStateData(this.state)}getState(t){let e=ot.State.Loading;switch(t.state){case rt.d.Offline:e=ot.State.Offline;break;case rt.d.Unbind:e=ot.State.Unbind;break;case rt.d.DataNormal:e=ot.State.Normal;break;case rt.d.Abnormal:e=ot.State.Abnormal}return e}changeState(t){switch(t){case ot.State.Unbind:this.state=ot.State.Unbind;break;case ot.State.Offline:this.state!==ot.State.Unbind&&(this.state=ot.State.Offline);break;case ot.State.Loading:this.state!==ot.State.Unbind&&this.state!==ot.State.Offline&&(this.state=ot.State.Loading);break;case ot.State.Abnormal:this.state!==ot.State.Unbind&&this.state!==ot.State.Offline&&this.state!==ot.State.Loading&&(this.state=ot.State.Abnormal)}}loadStateData(t){if(t===this.preState)return;if(this.preState=t,this.state===ot.State.Normal)return void this.clearTip();let e="",n="",i="";switch(t){case ot.State.Offline:e="assets/img/offline.svg",n=this.localization.offline,i="#999999";break;case ot.State.Unbind:e="assets/img/unbind.svg",n=this.localization.unbind,i="#586e7c";break;case ot.State.Abnormal:e="assets/img/abnormal.svg",n=this.localization.abnormal,i="#f6a520";break;case ot.State.Disable:e="assets/img/disabled.svg",n=this.localization.disable,i="#ff4444";break;default:e="assets/img/loading.svg",n=this.localization.loading,i="#226abc"}this.setState(e,n,i)}setState(t,e,n){if(this.clearTip(),this.currentRect||(this.currentRect=this.$element.find("rect#StateFrame").first()),!this.currentRect.length)return;const i=this.$element[0].ownerDocument,r=i.createElementNS("http://www.w3.org/2000/svg","image");if(r){const a=this.currentRect[0];let o=Number(a.getAttribute("width"))-20;const s=a.getAttribute("x");null!==s&&(o+=Number(s)),a.setAttribute("stroke",n),a.setAttribute("stroke-opacity","0.5"),r.href.baseVal=t,r.setAttributeNS(null,"id","StateImage"),r.setAttributeNS(null,"x",o.toString()),r.setAttributeNS(null,"y","0"),r.setAttributeNS(null,"height","20px"),r.setAttributeNS(null,"width","20px");const l=i.createElementNS("http://www.w3.org/2000/svg","title"),u=i.createTextNode(e);l.appendChild(u),r.appendChild(l),this.$element.append(r)}}clearTip(){if(this.currentRect||(this.currentRect=this.$element.find("rect#StateFrame").first()),!this.currentRect.length)return;const t=this.currentRect[0];t.getAttribute("stroke")&&t.removeAttribute("stroke"),this.$element.find("image#StateImage").remove()}}class kt extends wt{constructor(t,e,n,i,r,a){super(t,e,n,i,r,a),this.permissionChecker=e,this.variableCommunicator=n,this.variableStore=i,this.localization=r,this.isGrantedPermission=!1,this.isInitialized=!1,setTimeout(()=>{this.initialize()})}initialize(){!1===this.model.isAwaysEnable?(null==this.model.version||this.model.version<3?this.updateEnableStateByCondition():((this.model.isEnablePermission||void 0===this.model.isEnablePermission)&&this.model.enablePermissionCodes?this.isGrantedPermission=this.permissionChecker.isGranted(this.model.enablePermissionCodes):this.isGrantedPermission=!0,this.model.isEnablePermission&&!this.model.isEnableControl&&this.updateEnableStateByPermission(),!this.model.isEnablePermission&&this.model.isEnableControl&&this.updateEnableStateByCondition(),this.model.isEnablePermission&&this.model.isEnableControl&&this.updateEnableStateByConditionAndPermission(),this.model.isEnablePermission||this.model.isEnableControl||this.updateEnableStateByConditionAndPermission()),this.isGrantedPermission||(this.isInitialized=!0,this.isEnable=!1,this.changeStates())):this.isInitialized=!0}updateEnableStateByConditionAndPermission(){if(null==this.model.enableItems||!this.model.enableItems.length)return void(this.isInitialized=!0);const t=new ot.ConditionItemsResultObserver(this.model.enableItems,this.variableCommunicator,this.variableStore);t.conditionResultChanged.subscribe(t=>{t.value?this.updateEnableStateByPermission():this.setEnableByConditionOrPermission(!1),this.isInitialized=!0,this.changeStates()}),t.requestData(this.signalRAppId)}updateEnableStateByCondition(){if(null==this.model.enableItems||!this.model.enableItems.length)return void(this.isInitialized=!0);const t=new ot.ConditionItemsResultObserver(this.model.enableItems,this.variableCommunicator,this.variableStore);t.conditionResultChanged.subscribe(t=>{this.setEnableByConditionOrPermission(t.value),this.isInitialized=!0,this.changeStates()}),t.requestData(this.signalRAppId)}updateEnableStateByPermission(){let t=!1;t=!this.model.enablePermissionCodes||this.permissionChecker.isGranted(this.model.enablePermissionCodes),this.setEnableByConditionOrPermission(t),this.isInitialized=!0}setEnableByConditionOrPermission(t){this.isEnable=t}}class Lt extends kt{constructor(t,e,n,i,r,a){super(t,e,n,i,r,a)}init(t){if(t){let e=!1;Object(nt.forEach)(this.elementStates,n=>{n.variableName===t&&(e=!0)}),e||this.elementStates.push(new rt.c(t,void 0))}this.initState()}get readVariableName(){if(!this.model)throw new Error("Model cannot be null");if(null==this.model.version||this.model.version<2)return this.model.variableName;{const t=this.model.readVariable;if(!t)return;return ht.a.getConvertedVariableName(this.variableStore,t)}}get minVariableName(){if(this.model.minValueType)return this.getVariableName(this.model.minVariable)}get minValueType(){return this.model.minValueType}get maxVariableName(){if(this.model.maxValueType)return this.getVariableName(this.model.maxVariable)}get maxValueType(){return this.model.maxValueType}getVariableName(t){if(!this.model)throw new Error("Model cannot be null");if(t)return ht.a.getConvertedVariableName(this.variableStore,t)}reportStateChanged(t){Object(nt.forEach)(this.elementStates,e=>{e.variableName===t.variableName&&(e.state=t.state,this.changeStates())})}reportValueChanged(t){Object(nt.forEach)(this.elementStates,e=>{e.variableName===t.variableName&&(e.state=t.state,this.changeStates())}),this.state!==ot.State.Normal&&this.state!==ot.State.Disable&&t.variableName!==this.minVariableName&&t.variableName!==this.maxVariableName||this.updateVariableValue(t.value,t.variableName)}}function St(t,e,n){return n>e?1:n<t?0:(n-t)/(e-t)}function Tt(t){return t*(Math.PI/180)}var Yt=n(15);class Dt extends Lt{constructor(t,e,n,i,r,a){if(super(t,e,n,i,r,a),this.defaultBarColor="#6fd149",this.defaultUpperLimitColor="#ff4448",this.defaultLowerLimitColor="#0f60e8",this.barText="",this.valueObj={},this.isNeedUpdateScale=!1,(this.model.minValueType===Yt.a.Constant&&this.model.maxValueType===Yt.a.Variable||this.model.maxValueType===Yt.a.Constant&&this.model.minValueType===Yt.a.Variable)&&(this.isNeedUpdateScale=!0,this.updateScale(),this.isNeedUpdateScale=!1),this.$barRect=this.$element.find("rect"),this.$barText=this.$element.find('text[id="text"]').last(),this.model.version&&this.model.version>=1){const t=this.model.backgroundColor?this.model.backgroundColor:"transparent";this.barElement=this.$element.children(`path[fill='${t}']`),this.defaultTransform=this.barElement.attr("transform"),this.$barRect.attr("transform",this.defaultTransform)}setTimeout(()=>{this.initFrameNode()},0)}get readVariableName(){if(!this.model)throw new Error("Model cannot be null");if(null==this.model.version||this.model.version<2)return this.model.variableName;{const t=this.model.readVariable;if(!t)return;return ht.a.getConvertedVariableName(this.variableStore,t)}}initFrameNode(){const t=Snap(this.$element[0]).getBBox(!0);this.rootElement.append("rect").attr("id","StateFrame").attr("width",t.width).attr("height",t.height).attr("fill","transparent")}updateValueObj(t,e){var n,i,r;(null===(n=this.model.readVariable)||void 0===n?void 0:n.name)===e&&(this.isNeedUpdateScale=!1,this.valueObj.value=t),(null===(i=this.model.minVariable)||void 0===i?void 0:i.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.min=t),(null===(r=this.model.maxVariable)||void 0===r?void 0:r.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.max=t)}updateScale(){if(!this.isNeedUpdateScale)return;const t=this.$element.find("g:first > text");let e=this.model.minValueType?this.valueObj.min:this.model.min,n=this.model.maxValueType?this.valueObj.max:this.model.max;e=Number(e),n=Number(n),(isNaN(e)||isNaN(n))&&(e=Dt.DEFAULT_MIN_VALUE,n=Dt.DEFAULT_MAX_VALUE);const i=((n-e)/this.model.masterDivisionNumber).toFixed(5);for(let n=0;n<t.length;n++){const r=t[n];if(!r.innerHTML)continue;let a=(Number(i)*n+e).toFixed(0);this.model.fractionDigits>0&&(a=(a/Math.pow(10,this.model.fractionDigits)).toFixed(this.model.fractionDigits)),isNaN(a)||(r.innerHTML=a)}}updateVariableValue(t,e){this.updateValueObj(t,e),this.updateScale();const n=Number(this.valueObj.value);let i=this.model.maxValueType?this.valueObj.max:this.model.max,r=this.model.minValueType?this.valueObj.min:this.model.min;if(r=Number(r),i=Number(i),(isNaN(r)||isNaN(i))&&(r=Dt.DEFAULT_MIN_VALUE,i=Dt.DEFAULT_MAX_VALUE),isNaN(n))return;const a=this.model.useAlarmLimit,o=null!=this.model.upperLimit,s=null!=this.model.lowerLimit;let l=this.model.barColor;const u=this.model.upperLimitColor,c=this.model.lowerLimitColor,d=this.model.percentageFont;let h;h=this.model.version&&this.model.version>=1?this.barElement[0].getBBox():this.$barRect.parent()[0].getBBox();const f=St(r,i,n);let m=0;this.model.direction!==ot.BarGraphDirection.DownToUp&&this.model.direction!==ot.BarGraphDirection.LeftToRight||(m=h.height*(1-f)),l||(l=this.defaultBarColor),a&&(o&&n>+this.model.upperLimit?l=u||this.defaultUpperLimitColor:s&&n<+this.model.lowerLimit&&(l=c||this.defaultLowerLimitColor)),this.$barRect.attr("height",h.height*f),this.$barRect.attr("width",h.width),this.$barRect.attr("fill",l),this.model.version&&this.model.version>=1?this.$barRect.attr("transform",this.defaultTransform+` translate(0,${m})`):this.$barRect.attr("transform",`translate(0,${m})`),this.barText=(100*f).toFixed(0)+"%",this.$barText.text(this.barText),d&&(this.$barText.attr("font-family","Microsoft YaHei"),this.$barText.attr("font-size",d.fontSize+""),this.$barText.attr("fill",d.color),d.isBold&&this.$barText.attr("font-weight","bold"),d.isItalic&&this.$barText.attr("font-style","italic"),d.isUnderline&&this.$barText.attr("text-decoration","underline"))}}Dt.DEFAULT_MIN_VALUE=0,Dt.DEFAULT_MAX_VALUE=100;var Ct=n(12),Et=n(21),At=n(20);class Ot{constructor(t,e,n,i){this.variableName=t,this.isPassword=e,this.charCount=n,this.originValue=i}}var jt=n(37),Nt=n(42);class Ht{static getExtendedStyle(t,e){if(e<0)throw new Error("stateIndex can not less than zero.");let n;return null!=t.styles&&(n=t.styles.find(t=>null==t.version?null!=t.state&&+t.state===e:t.stateIndex===e)),n}}n(47),n(46);var Vt=n(45),Pt=n(44),Ft=n(41),It=n(19);class Rt{constructor(t,e,n,i,r){/iPhone|iPod/i.test(navigator.userAgent)&&(n+=10),this._element=this.getforeignObjectElement(n,i),this._element.innerHTML="";const a=this.createNewForeignObjectText(t,e,n,i,r);this._element.appendChild(a)}get Element(){return this._element}getforeignObjectElement(t,e){const n=document.createElementNS("http://www.w3.org/2000/svg","foreignObject");return n.setAttribute("width",t.toString()),n.setAttribute("height",e.toString()),n}createNewForeignObjectText(t,e,n,i,r){e&&!e.fontFamily.includes(",msyh")&&(e.fontFamily+=",msyh");const a=document.createElement("div"),o=e.textAlign?e.textAlign:"center";a.style.cssText=`user-select: none;text-align: ${o};display: table-cell;vertical-align: middle;`,Object(nt.isNil)(t)&&(t="");let s=t.toString().split("\n");s=s.map(t=>t.toString().replace(/\s/g," "));const l=document.createDocumentFragment();for(let t=0;t<s.length;t++){const n=document.createElement("div");n.className="text-list";const i=s[t]?s[t]:" ";let r="";e.isItalic&&(r+="italic "),e.isBold&&(r+="bold ");let a=0;const o=12;a=parseInt(e.fontSize,10)+5,r+=e.fontSize+"/"+a.toString()+"px "+e.fontFamily,n.style.cssText=`color: ${e.color};word-break: break-all;font: ${r};`,e.isUnderline&&(n.style.textDecoration="underline");const u=document.createElement("span");u.style.cssText=`\n display: contents;\n transform: scale(${parseInt(e.fontSize,10)>o?1:parseInt(e.fontSize,10)/o});\n width: 100%;\n height: 100%;\n `,u.innerHTML=i,n.appendChild(u),l.appendChild(n)}a.appendChild(l);const u=document.createElement("div");u.style.cssText="display: table;width: 100%;height: 100%;",u.appendChild(a);const c=document.createElement("div");return c.style.cssText=`overflow: hidden;width: ${n.toString()+"px"};height: ${i.toString()+"px"};`,r&&(c.style.paddingRight="8px"),c.appendChild(u),c}}class Wt extends Lt{constructor(t,e,n,r,a,o,s,l,u,c,d){super(t,o,r,u,c,d),this.modalService=n,this.graphStore=a,this.operationRecordService=s,this.securityChecker=l,this.displayValue="",this.graphs=new Map,this.logger=e.get(i.b),this.accessPermissionService=e.get(Nt.a),this.initElement(),this.initClickEvent()}get readVariableName(){if(!this.model)throw new Error("Model cannot be null");if(null==this.model.version||this.model.version<1)return this.model.readVariableName;{const t=this.model.readVariable;if(!t)return;return ht.a.getConvertedVariableName(this.variableStore,t)}}get writeVariableName(){if(!this.model)throw new Error("Model cannot be null");if(null==this.model.version)return this.model.isSameVariable?this.model.readVariableName:this.model.writeVariableName;{const t=this.model.writeVariable;if(!t)return;return ht.a.getConvertedVariableName(this.variableStore,t)}}updateVariableValue(t){const e=this.getVariableValueText(t);this.displayValue=e.replace(/[\u0000-\u001F]|[\u007F-\u00A0]/g,""),this.updateDisplayValue(this.displayValue)}changeStates(){super.changeStates(),this.state===ot.State.Normal||this.state===ot.State.Disable?this.updateDisplayValue(this.displayValue):this.updateDisplayValue("")}updateDisplayValue(t){const e=this.$element.find("foreignObject").find("i");e&&e.text(t)}getVariableValueText(t){return this.characterDisplayText(this.model.isPassword,t)}characterDisplayText(t,e){let n="";return null==e||e.toString().trim().length<=0?n:(n=e.toString(),t&&(n="*".repeat(n.length)),n)}initElement(){const{rootElement:t}=this;t.selectAll("*").remove();const e=this.model.label;let n=null,i=null;this.model.size&&(n=this.model.size.width,i=this.model.size.height),n&&i||(n=60,i=38),t.append("rect").attr("id","StateFrame").attr("width",n).attr("height",i).attr("fill","transparent"),this.initVariableText(n,i);let r="";this.model.showVariableText?(r=`translate(${7*n/11},0)`,n=4*n/11):r="translate(0,0)",this.model.useGraph&&t.append("image").attr("width",n).attr("height",i).attr("preserveAspectRatio","none").attr("fill","none").attr("crossorigin","anonymous").attr("transform",r);const a=e.font;if(!a)throw new Error("font missing.");const o=t.append("foreignObject").attr("width",n).attr("height",i).attr("fill","none").attr("transform",r).append("xhtml:div").attr("class","svgBody").html("<div></div>").select("div").style("height",i+"px").style("overflow","hidden").style("display","flex").style("align-items","center").append("i");if(o.style("word-break","break-all").style("text-align",a.textAlign).style("alignment-baseline","central").style("transform",`translate(${n/2},${i/2})`).text(e.content).style("color",a.color).style("font-size",a.fontSize).style("font-style","normal").style("width","100%"),a.fontStyle){const t=a.fontStyle.split(" "),e=$.inArray("bold",t),n=$.inArray("Italic",t),i=t.pop();e>=0&&o.style("font-weight","bold"),n>=0&&o.style("font-style","italic"),o.style("font-family",i?i+",msyh":"msyh")}if(a.isUnderline&&o.style("text-decoration","underline"),this.model.useGraph)if(this.graphs.has(0)){const t=this.graphs.get(0);if(null==t)return;this.changeGraph(t)}else this.graphs.set(0,null),this.graphStore.getGraph(this.model.graphSetting.id,0,Ht.getExtendedStyle(this.model.graphSetting,0)).subscribe(t=>{this.graphs.set(0,t),this.changeGraph(t)})}initVariableText(t,e){if(!this.model.showVariableText)return;const n={isUnderline:this.model.variableText.font.isUnderline,isBold:this.model.variableText.font.isBold,isItalic:this.model.variableText.font.isItalic,fontSize:this.model.variableText.font.fontSize,fontFamily:this.model.variableText.font.fontFamily,color:this.model.variableText.font.color,textAlign:this.model.variableText.font.textAlign},i=new Rt(this.model.variableText.content+":",n,7*t/11,e,!0);this.$element.append(i.Element)}initClickEvent(){this.writeVariableName&&this.accessPermissionService.canWrite(this.model.accessPermission)&&(this.rootElement.style("cursor","hand"),setTimeout(()=>{const t=this.$element[0].getBBox();this.$element.find("rect").attr("width",t.width),this.$element.find("rect").attr("height",t.height)},0),this.$element.click(t=>{if(this.isInitialized)if(this.isEnable)if(this.model.useSecurity){const t=this.modalService.show(At.a,{backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.checkElementPassword()})}else this.checkElementPassword();else{const t=this.isGrantedPermission?this.localization.conditionIsNotMetTip:this.localization.permissiontip,e=this.modalService.show(Et.a,{initialState:{alermMessage:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),n=e.content.onClosed.subscribe(()=>{e.hide(),n.unsubscribe()})}}))}checkElementPassword(){if(this.model.enablePassword){const t=this.modalService.show(It.a,{initialState:{securityChecker:this.securityChecker},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.doWriteCharacterValue()})}else this.doWriteCharacterValue()}doWriteCharacterValue(){if(null==this.writeVariableName)return;const t=new Ot(this.writeVariableName,this.model.isPassword,this.model.charCount,this.displayValue),e=this.modalService.show(jt.a,{initialState:{args:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),n=e.content.onClosed.subscribe(t=>{e.hide(),n.unsubscribe(),t&&(this.variableCommunicator.write(this.writeVariableName,t.value).subscribe(),this.recordOperation(t.value))})}recordOperation(t){(this.model.isRecordOperation||void 0===this.model.isRecordOperation)&&this.operationRecordService.record({variableOptionModel:{variableName:this.writeVariableName,originValue:this.displayValue,newValue:t},operationDescription:this.model.operationDescription})}changeGraph(t){if(t.failed)this.rootElement.select("image").attr("xlink:href",null);else{const e=t.graph;switch(e.graphType){case Ct.i.Image:case Ct.i.SVG:this.rootElement.select("image").attr("xlink:href",e.source);break;default:this.logger.error(new Error(`Unknown graph ${e.graphType}.`)),this.rootElement.select("image").attr("xlink:href",null)}}}}var zt,Bt,Ut,Gt=n(1);!function(t){t[t.YYMMDD=0]="YYMMDD",t[t.MMDDYY=1]="MMDDYY",t[t.DDMMYY=2]="DDMMYY"}(zt||(zt={})),function(t){t[t.Dot=0]="Dot",t[t.Line=1]="Line",t[t.Slash=2]="Slash",t[t.CHS=3]="CHS"}(Bt||(Bt={})),function(t){t[t.HHMM=0]="HHMM",t[t.HHMMSS=1]="HHMMSS"}(Ut||(Ut={}));class $t{constructor(t,e,n,i,r,a,o){this.graphSetting=t,this.width=e,this.height=n,this.graphStore=i,this.logger=r,this.version=a,this.faultFlickers=o,this.graphs=new Map,this.activeState=0,this.faultFlickerStatus=!1,this.faultFlickerInterval=void 0,this._element=document.createElementNS("http://www.w3.org/2000/svg","g")}get Element(){return this._element}switchToState(t){if(this.activeState=t,this.graphs.has(t)){const e=this.graphs.get(t);if(null==e)return;this.changeGraph(t,e)}else this.graphs.set(t,null),this.graphStore.getGraph(this.graphSetting.id,t,Ht.getExtendedStyle(this.graphSetting,t)).subscribe(e=>{this.graphs.set(t,e),this.activeState===t&&this.changeGraph(t,e)})}changeGraph(t,e){if(e.failed)this.removeImageElement();else{const n=e.graph;switch(n.graphType){case Ct.i.Image:case Ct.i.SVG:const e=this.getImageElement();e.setAttributeNS("http://www.w3.org/1999/xlink","href",n.source),this.doFaultFlicker(e,t);break;default:this.logger.error(new Error(`Unknown graph ${n.graphType}.`)),this.removeImageElement()}}}getImageElement(){return this.imageElement||(this.imageElement=document.createElementNS("http://www.w3.org/2000/svg","image"),this.imageElement.setAttribute("width",this.width+""),this.imageElement.setAttribute("height",this.height+""),this.imageElement.setAttribute("fill","none"),this.imageElement.setAttribute("preserveAspectRatio","none"),this.imageElement.setAttribute("crossorigin","anonymous"),this._element.appendChild(this.imageElement)),this.imageElement}removeImageElement(){this.imageElement&&(this._element.removeChild(this.imageElement),delete this.imageElement)}doFaultFlicker(t,e){if(this.version>3&&this.faultFlickers){this.clearFlickerInterval(t);const n=this.faultFlickers.find(t=>t.id===e);n&&n.faultFlicker&&n.faultFlicker.flicker===ot.Flicker.Image&&(this.faultFlickerInterval=setInterval(()=>{this.faultFlickerStatus?(t.setAttributeNS(null,"display","block"),this.faultFlickerStatus=!1):(t.setAttributeNS(null,"display","none"),this.faultFlickerStatus=!0)},500*n.faultFlicker.frequency))}}clearFlickerInterval(t){this.faultFlickerInterval&&(clearInterval(this.faultFlickerInterval),this.faultFlickerStatus&&t.setAttributeNS(null,"display","block"))}}class qt extends Mt{constructor(t,e,n,r,a,o,s){if(super(t,n,r,a,s),this.permissionChecker=n,this.variableCommunicator=r,this.variableStore=a,this.graphStore=o,this.logger=e.get(i.b),this.model.size&&this.model.useGraph&&this.initGraph(this.model.size.width,this.model.size.height),this.model.showDate||this.model.showWeek||this.model.showTime){this.$dateTimeText=this.$element.find("text").last();const t=this.getDatetimeFormat(this.model);this.getAndSetCurrentTime(t),setInterval(()=>{this.getAndSetCurrentTime(t)},1e3)}}getAndSetCurrentTime(t){const e=Gt().local().format(t);this.$dateTimeText.text(e);let n=this.$dateTimeText.css("font-family");n&&-1===n.lastIndexOf("msyh")&&this.$dateTimeText.css("font-family",n+=", msyh")}getDatetimeFormat(t){let e="";const n=t.showFullYear?"YYYY":"YY";let i="";const r=t.showMonthDayWithoutZero?"M":"MM",a=t.showMonthDayWithoutZero?"D":"DD";if(t.showDate){switch(t.datetimeSeparator){case Bt.Slash:i="/";break;case Bt.Line:i="-";break;case Bt.Dot:i=".";break;case Bt.CHS:}e=this.getFormat(t.dateFormat,n,r,a,i)}if(t.showWeek&&(e+=" ddd"),t.showTime)if(e+=" ",t.isTwelveHourHex)switch(e+="A ",t.timeFormat){case Ut.HHMMSS:e+="h:mm:ss";break;case Ut.HHMM:e+="h:mm"}else switch(t.timeFormat){case Ut.HHMMSS:e+="HH:mm:ss";break;case Ut.HHMM:e+="HH:mm"}return e}initGraph(t,e){if(!0===this.model.useGraph){const n=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger);n.switchToState(0),this.$element.prepend(n.Element)}}getFormat(t,e,n,i,r){let a="";if(""===r)switch(t){case zt.YYMMDD:a=e+"年"+n+"月"+i+"日";break;case zt.MMDDYY:a=n+"月"+i+"日"+e+"年";break;case zt.DDMMYY:a=i+"日"+n+"月"+e+"年"}else switch(t){case zt.YYMMDD:a=e+r+n+r+i;break;case zt.MMDDYY:a=n+r+i+r+e;break;case zt.DDMMYY:a=i+r+n+r+e}return a}}var Jt,Xt,Zt=n(25),Kt=n(38);!function(t){t[t.BeginOpenEndOpen=0]="BeginOpenEndOpen",t[t.BeginOpenEndClose=1]="BeginOpenEndClose",t[t.BeginCloseEndOpen=2]="BeginCloseEndOpen",t[t.BeginCloseEndClose=3]="BeginCloseEndClose"}(Jt||(Jt={})),function(t){t[t.Normal=0]="Normal",t[t.Loading=1]="Loading",t[t.Unbound=2]="Unbound",t[t.LoadFailed=3]="LoadFailed"}(Xt||(Xt={}));var Qt,te,ee=n(14);!function(t){t[t.Line=0]="Line",t[t.BarGroup=1]="BarGroup",t[t.BarStack=2]="BarStack"}(Qt||(Qt={})),function(t){t[t.Auto=0]="Auto",t[t.Custom=1]="Custom"}(te||(te={}));class ne extends Mt{constructor(t,e,n,r,a,o,s){super(t,n,r,a,s),this.historyDataStore=o,this.displayOption={dataLimit:500,dataZoomHeight:32,marginLeft:40,marginRight:20,mobileMinWidth:450,operationAreaHeight:32,operationAreaMarginTop:25,operationSelectFontSize:"16px",operationButtonWidth:24,operationButtonHeight:24,operationButtonMargin:4},this.elementStatus=Xt.Loading,this.logger=e.get(i.b),this.localization=e.get(at.b),this.timePeriods=this.getValidTimePeriods(),this.updateTimeRange(this.model.displaySetting.displayTimePeriod),this.refreshIntervalId=setInterval(()=>{this.loadFirstPage(),this.logger.debug(`[GUI]Refresh Histoical Curve:${Zt.time.format("%x %X")(new Date)}`)},1e3*this.model.displaySetting.refreshInterval),this.isMobileMode=ee.a.Mobile===e.get(ee.b).displayMode,this.isMobileMode&&(this.displayOption.operationAreaMarginTop=35,this.model.displaySetting.size.width>=this.displayOption.mobileMinWidth&&(this.displayOption.operationAreaHeight=68,this.displayOption.operationSelectFontSize="24px",this.displayOption.operationButtonWidth=60,this.displayOption.operationButtonHeight=60,this.displayOption.operationButtonMargin=6)),this.loadFirstPage()}dispose(){clearInterval(this.refreshIntervalId),this.chartElement&&this.chartElement.tooltip.hidden(!0),this.logger.debug(`[GUI]Dispose Histoical Curve Refresh Interval:${Zt.time.format("%x %X")(new Date)}`)}getValidTimePeriods(){const t=new Array;return t.push({key:6,name:this.localization.lastThirtyMinutes}),t.push({key:1,name:this.localization.lastOneHour}),t.push({key:7,name:this.localization.lastEightHour}),t.push({key:2,name:this.localization.lastTwentyFourHours}),t.push({key:3,name:this.localization.lastSevenDays}),t.push({key:4,name:this.localization.lastThirtyDays}),t.push({key:5,name:this.localization.lastOneYear}),t}updateTimeRange(t){this.currentTimePeriod=+t,this.updateQueryTimeRange()}updateQueryTimeRange(){switch(this.endTime=Gt(),this.currentTimePeriod){case 1:this.startTime=Gt().subtract(1,"hours");break;case 3:this.startTime=Gt().subtract(7,"days");break;case 4:this.startTime=Gt().subtract(30,"days");break;case 5:this.startTime=Gt().subtract(1,"years");break;case 6:this.startTime=Gt().subtract(30,"minutes");break;case 7:this.startTime=Gt().subtract(8,"hours");break;default:this.startTime=Gt().subtract(1,"days")}}reRenderElement(t,e,n,i){this.rootElement.selectAll("*").remove(),this.chartElement=null,this.renderElement(t,e,n,i)}renderElement(t,e,n,i){if(!this.model.dataSetting)return;const r=this.model.dataSetting.dataName,a=this.model.dataSetting.dataSourceCode,o=this.model.dataSetting.channels.map(t=>t.name);this.updateElementStatus(Xt.Loading);const s=new Ct.d(a,r,o,t,e,n,i);this.historyDataStore.getHistoryData(s).subscribe(t=>{t.error?this.updateElementStatus(Xt.LoadFailed,t.error):(this.clearStatus(),t.isUnbind?this.updateElementStatus(Xt.Unbound):this.updateElementStatus(Xt.Normal),t.values.length&&(this.currentStartTime=Gt(Object(nt.first)(t.values).time),this.currentEndTime=Gt(Object(nt.last)(t.values).time)),this.chartElement=this.renderChart(t.values))})}renderChart(t){const e=this.model.displaySetting.size.width,n=this.model.displaySetting.size.height-this.displayOption.operationAreaHeight-this.displayOption.operationAreaMarginTop,i=new Array;Object(nt.each)(this.model.dataSetting.channels,(e,n)=>{const r=new Array;Object(nt.each)(t,t=>r.push({x:Gt(t.time).local().toDate().valueOf(),y:t.values[n]})),i.push({key:e.name,area:e.projectEnabled,values:r})}),Kt.addGraph(()=>this.model.displaySetting.curveType===Qt.BarGroup||this.model.displaySetting.curveType===Qt.BarStack?this.getMultiBarWithFocusChart(e,n,i):this.getLineChart(e,n,i))}getLineChart(t,e,n){const i=Kt.models.lineChart().showLegend(!0).margin({top:0,bottom:0,left:this.displayOption.marginLeft,right:this.displayOption.marginRight}).noData(this.localization.chartNoData);return this.model.displaySetting.axisSetting.yAxisRangeType===te.Custom&&i.yDomain([this.model.displaySetting.axisSetting.yAxisMin,this.model.displaySetting.axisSetting.yAxisMax]),this.isMobileMode||(i.focusEnable(!0),i.focus.margin({top:10,right:0,bottom:0,left:0}),i.focus.height(40),i.focus.showXAxis(!1)),this.renderCommonProperty(i,t,e,n),this.renderOperationArea(t,e),i}getMultiBarWithFocusChart(t,e,n){const i=Kt.models.multiBarWithFocusChart().margin({top:0,bottom:0,left:this.displayOption.marginLeft,right:this.displayOption.marginRight}).controlLabels({grouped:this.localization.grouped,stacked:this.localization.stacked}).noData(this.localization.chartNoData);this.model.displaySetting.curveType===Qt.BarStack&&(i.stacked(!0),i.multibar.stacked(!0),i.multibar2.stacked(!0)),this.model.displaySetting.axisSetting.yAxisRangeType===te.Custom&&i.yDomain([this.model.displaySetting.axisSetting.yAxisMin,this.model.displaySetting.axisSetting.yAxisMax]),this.isMobileMode||(i.focusEnable(!0),i.focusShowAxisX(!1)),i.xAxis.tickFormat(t=>this.timeFormat(t,"%x %X")),this.renderCommonProperty(i,t,e,n),this.renderOperationArea(t,e);const r=this.rootElement.select(".nv-context");return r.select(".nv-barsWrap.nvd3-svg").attr("transform","translate(0,30)"),r.select(".nv-brushBackground").attr("transform","translate(0,30)"),r.select(".nv-x.nv-brush").attr("transform","translate(0,30)"),this.model.displaySetting.showAxis||(this.rootElement.select(".tick.zero").style("display","none"),this.rootElement.select(".nv-x.nv-axis.nvd3-svg").style("display","none"),this.rootElement.select(".nv-y.nv-axis.nvd3-svg").style("display","none")),i.update(),i}renderCommonProperty(t,e,n,i){var r,a;t.tooltip.headerFormatter(t=>this.timeFormat(t,"%x %X")),this.model.displaySetting.showAxis?(t.xAxis.showMaxMin(!0).tickFormat(t=>3===this.currentTimePeriod||4===this.currentTimePeriod||5===this.currentTimePeriod?this.timeFormat(t,"%y-%m-%d"):this.timeFormat(Number(t),"%X")),this.model.displaySetting.axisSetting&&(this.model.displaySetting.axisSetting.showAxisLabel&&this.model.displaySetting.axisSetting.axisLabelFont?(t.xAxis.fontSize(this.model.displaySetting.axisSetting.axisLabelFont.fontSize),t.yAxis.fontSize(this.model.displaySetting.axisSetting.axisLabelFont.fontSize).tickFormat(t=>+Zt.format(".9g")(t))):(t.xAxis.tickFormat(()=>""),t.yAxis.tickFormat(()=>"")))):(t.showXAxis(!1),t.showYAxis(!1)),t.width(e),t.height(n),t.color(this.model.dataSetting.channels.map(t=>t.connectorColor)),this.rootElement.append("g").datum(i).call(t),this.rootElement.selectAll(".nv-noData").attr("x",e/2).attr("y",n/2+this.displayOption.operationAreaHeight),Kt.utils.windowResize(()=>{t.update(),this.rootElement.selectAll(".nv-noData").attr("x",e/2).attr("y",n/2+this.displayOption.operationAreaHeight)});const o=null===(a=null===(r=this.model.displaySetting.axisSetting)||void 0===r?void 0:r.axisLabelFont)||void 0===a?void 0:a.fontSize;if(this.rootElement.selectAll(".domain").style("stroke-opacity",1),this.model.displaySetting.showAxis&&this.model.displaySetting.axisSetting){const t=this.model.displaySetting.axisSetting.axisColor;this.rootElement.selectAll(".domain").style("stroke",t),o&&this.model.displaySetting.axisSetting.showAxisLabel&&this.rootElement.selectAll(".nv-axisMaxMin").select("text").style("font-size",o)}let s=0;if(!1!==this.model.displaySetting.axisSetting.showTick&&(s=1),this.rootElement.selectAll(".nv-x").selectAll(".tick").selectAll("line").attr("style",`stroke:${this.model.displaySetting.axisSetting.xAxisTickColor||"rgb(127, 147, 159)"};stroke-width:${s};`),this.rootElement.selectAll(".nv-y").selectAll(".tick").selectAll("line").attr("style",`stroke:${this.model.displaySetting.axisSetting.yAxisTickColor||"rgb(127, 147, 159)"};stroke-width:${s};`),o&&3===this.currentTimePeriod||4===this.currentTimePeriod||5===this.currentTimePeriod){const t=this;this.rootElement.selectAll(".nv-x").selectAll(".tick").selectAll("text").data(function(e){return[t.timeFormat(Number(e),"%y-%m-%d"),t.timeFormat(Number(e),"%H:%M:%S")]}).enter().append("text").attr("class","full-date").attr("x",0).attr("y",0).attr("dy","2.3em").style("text-anchor","middle").style("font-size",o).text(t=>t),this.rootElement.selectAll(".nv-axisMaxMin-x").selectAll("text").data(function(e){return[t.timeFormat(Number(e),"%y-%m-%d"),t.timeFormat(Number(e),"%H:%M:%S")]}).enter().append("text").attr("class","full-date").attr("x",0).attr("y",0).attr("dy","2.3em").style("text-anchor","middle").style("font-size",o).text(t=>t);const e=this.rootElement.selectAll(".nv-focusWrap");if(e.size()){let t=e.attr("transform");t&&t.length&&-1!==t.indexOf(",")&&(t=t.slice(0,-1).split(",")[1],this.rootElement.selectAll(".nv-focusWrap").attr("transform",`translate(0,${Number(t)+15})`))}const n=new window.MutationObserver(()=>{this.rootElement.selectAll(".nv-x").selectAll(".tick").selectAll(".full-date").remove(),this.rootElement.selectAll(".nv-x").selectAll(".tick").selectAll("text").data(function(e){return[t.timeFormat(Number(e),"%y-%m-%d"),t.timeFormat(Number(e),"%H:%M:%S")]}).enter().append("text").attr("class","full-date").attr("x",0).attr("y",0).attr("dy","2.3em").style("text-anchor","middle").style("font-size",o).text(t=>t)}),i=document.getElementsByClassName("extent");i.length&&n.observe(i[0],{attributes:!0})}else this.rootElement.selectAll(".full-date").remove()}renderOperationArea(t,e){const n=this.rootElement.append("g").attr("transform",`translate(0,${e+this.displayOption.operationAreaMarginTop})`).append("foreignObject").attr("width",t).attr("height",this.displayOption.operationAreaHeight).attr("fill","none").append("xhtml:div").style("height",this.displayOption.operationAreaHeight-4+"px").style("overflow","hidden").style("margin-top","4px");n.append("select").style("margin-left",this.displayOption.marginLeft+"px").style("font-size",this.displayOption.operationSelectFontSize).on("change",()=>{const t=this.rootElement.select("select").property("value");this.updateTimeRange(t),this.reRenderElement(this.startTime,this.endTime,this.displayOption.dataLimit,Jt.BeginOpenEndOpen)}).selectAll("option").data(this.timePeriods).enter().append("option").text(t=>t.name).attr("value",t=>t.key).property("selected",t=>t.key===Number(this.currentTimePeriod));const i=this.displayOption.operationButtonWidth+"px",r=this.displayOption.operationButtonHeight+"px";n.append("button").style("width",i).style("height",r).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/last_page.svg)").on("click",()=>{this.loadLastPage()}),n.append("button").style("width",i).style("height",r).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/next_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadNextPage()}),n.append("button").style("width",i).style("height",r).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/previous_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadPreviousPage()}),n.append("button").style("width",i).style("height",r).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/first_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadFirstPage()})}timeFormat(t,e){return Zt.time.format(e)(new Date(t))}loadFirstPage(){this.updateQueryTimeRange(),this.reRenderElement(this.startTime,this.endTime,this.displayOption.dataLimit,Jt.BeginOpenEndOpen)}loadNextPage(){this.reRenderElement(this.currentEndTime,this.endTime,this.displayOption.dataLimit,Jt.BeginOpenEndClose)}loadPreviousPage(){this.reRenderElement(this.startTime,this.currentStartTime,-this.displayOption.dataLimit,Jt.BeginCloseEndOpen)}loadLastPage(){this.updateQueryTimeRange(),this.reRenderElement(this.startTime,this.endTime,-this.displayOption.dataLimit,Jt.BeginOpenEndOpen)}initElementStatus(){this.model.dataSetting&&null!=this.model.dataSetting.dataSourceCode&&this.updateElementStatus(Xt.Loading)}updateElementStatus(t,e){switch(t){case Xt.Normal:this.elementStatus!==Xt.Normal&&(this.elementStatus=Xt.Normal);break;case Xt.Unbound:this.elementStatus=Xt.Unbound,this.setStatusAsUnbound();break;case Xt.Loading:this.elementStatus!==Xt.Unbound&&(this.elementStatus=Xt.Loading,this.setStatusAsLoading());break;case Xt.LoadFailed:this.elementStatus!==Xt.Unbound&&(this.elementStatus=Xt.LoadFailed,this.setStatusAsLoadFailed(e||this.localization.abnormal));break;default:this.logger.error(`Invalid HistoricalCurveElementStatus:${t}`)}}setStatusAsUnbound(){this.renderStatus("assets/img/unbind.svg",this.localization.unbind,"#586e7c")}setStatusAsLoading(){this.renderStatus("assets/img/loading.svg",this.localization.loading,"#226abc")}setStatusAsLoadFailed(t){this.logger.error(`[GUI]Failed to load historical curve:${t}`),this.renderStatus("assets/img/abnormal.svg",t,"#f6a520")}renderStatus(t,e,n){if(this.elementStatus===Xt.Normal)return void this.clearStatus();this.rootElement.append("rect").attr("id","StateFrame").attr("fill","transparent").attr("width",this.model.displaySetting.size.width).attr("height",this.model.displaySetting.size.height);const i=this.$element[0].ownerDocument,r=this.$element.find("rect#StateFrame").first();if(!r.length)return;this.$element.find("image#StateImage").remove();const a=i.createElementNS("http://www.w3.org/2000/svg","image");if(a){let o=Number(r[0].getAttribute("width"))-20;const s=r[0].getAttribute("x");null!==s&&(o+=Number(s)),r[0].setAttribute("stroke",n),r[0].setAttribute("stroke-opacity","0.5"),a.href.baseVal=t,a.setAttributeNS(null,"id","StateImage"),a.setAttributeNS(null,"x",o.toString()),a.setAttributeNS(null,"y","0"),a.setAttributeNS(null,"height","20px"),a.setAttributeNS(null,"width","20px");const l=i.createElementNS("http://www.w3.org/2000/svg","title"),u=i.createTextNode(e);l.appendChild(u),a.appendChild(l),this.$element.append(a)}}clearStatus(){const t=this.$element.find("rect#StateFrame").first();t.length&&(t[0].getAttribute("stroke")&&t[0].removeAttribute("stroke"),this.$element.find("image#StateImage").remove())}}class ie extends Lt{constructor(t,e,n,i,r,a){let o;if(super(t,e,n,i,r,a),this.cx=0,this.cy=0,this.offsetY=0,this.valueObj={},this.isNeedUpdateScale=!1,(this.model.minValueType===Yt.a.Constant&&this.model.maxValueType===Yt.a.Variable||this.model.maxValueType===Yt.a.Constant&&this.model.minValueType===Yt.a.Variable)&&(this.isNeedUpdateScale=!0,this.updateScale(),this.isNeedUpdateScale=!1),this.model.version&&this.model.version>3?(o=this.$element.find('[data-id="main"]'),this.$handEl=this.$element.find('[data-id="hand"]'),this.arcPath$=this.$element.find('[data-id="arc"]')):(o=this.$element.children().eq(0),this.$handEl=this.$element.find("path[fill='red']"),this.arcPath$=this.$element.find("g:first > g:first > path:eq(0)")),1!==this.$handEl.length)throw new Error("missing meter hand.");this.mainElementTransform=o.attr("transform");const s=Snap(this.$handEl[0]).getBBox(!0),l=(s.x+s.width)/2;this.cx=l,this.cy=l-s.x,this.offsetY=l-s.height/2,setTimeout(()=>{this.initFrameNode(),this.changeStates()})}updateValueObj(t,e){var n,i,r;(null===(n=this.model.readVariable)||void 0===n?void 0:n.name)===e&&(this.isNeedUpdateScale=!1,this.valueObj.value=t),(null===(i=this.model.minVariable)||void 0===i?void 0:i.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.min=t),(null===(r=this.model.maxVariable)||void 0===r?void 0:r.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.max=t)}updateVariableValue(t,e){this.updateValueObj(t,e),this.updateScale();const n=this.getAngle();Object(nt.isNumber)(n)&&this.$handEl.attr("transform",this.mainElementTransform+` translate(0,${this.offsetY}) rotate(${n}, ${this.cx}, ${this.cy})`)}initFrameNode(){const t=Snap(this.$element[0]).getBBox();this.rootElement.append("rect").attr("id","StateFrame").attr("width",t.width).attr("height",t.height).attr("fill","transparent")}updateScale(){if(!this.isNeedUpdateScale)return;let t=this.model.minValueType?this.valueObj.min:this.model.min,e=this.model.maxValueType?this.valueObj.max:this.model.max;t=Number(t),e=Number(e),(isNaN(t)||isNaN(e))&&(t=ie.DEFAULT_MIN_VALUE,e=ie.DEFAULT_MAX_VALUE);const n=((e-t)/this.model.masterDivisionNumber).toFixed(5),i=this.$element.find("g:first > text");for(let e=0;e<i.length;e++){const r=i[e];if(!r.innerHTML)continue;let a=(Number(n)*e+t).toFixed(0);this.model.fractionDigits>0&&(a=(a/Math.pow(10,this.model.fractionDigits)).toFixed(this.model.fractionDigits)),isNaN(a)||(r.innerHTML=a)}}getAngle(){let t=this.model.minValueType?this.valueObj.min:this.model.min,e=this.model.maxValueType?this.valueObj.max:this.model.max;if(t=Number(t),e=Number(e),(isNaN(t)||isNaN(e))&&(t=ie.DEFAULT_MIN_VALUE,e=ie.DEFAULT_MAX_VALUE),!this.valueObj.value&&isNaN(Number(this.valueObj.value)))return;const n=(Math.min(Math.max(this.valueObj.value||0,t),e)-t)/(e-t),i=Snap(this.arcPath$[0]),r=i.getBBox(!0),a=i.getPointAtLength(n*i.getTotalLength());return this.directionPoint({x:r.width/2,y:r.height/2},a)}directionPoint(t,e){const n=e.x-t.x,i=e.y-t.y;if(0===n)return 0<i?90:0>i?270:0;if(0===i)return 0<n?0:180;if(isNaN(n)||isNaN(i))return 0;let r=180*Math.atan(Math.abs(i/n))/Math.PI;return 0>n?r=0>i?r+180:180-r:0>i&&(r=360-r),r}}ie.DEFAULT_MIN_VALUE=0,ie.DEFAULT_MAX_VALUE=100;class re{constructor(t,e,n,i,r,a,o,s,l){this.variableName=t,this.dataType=e,this.fBoxDataType=n,this.integerDigits=i,this.fractionDigits=r,this.numericalOperation=a,this.version=o,this.enableDataParsed=s,this.releasedVariableService=l}}var ae,oe=n(36),se=n(6);!function(t){t[t.read=4]="read",t[t.witer=2]="witer",t[t.readWiter=6]="readWiter"}(ae||(ae={}));class le extends Lt{constructor(t,e,n,r,a,o,s,l,u,c,d,h){super(t,r,a,c,d,h),this.modalService=n,this.graphStore=o,this.operationRecordService=s,this.releasedVariableService=l,this.securityChecker=u,this.displayText="",this.enableDataParsed=!1,this.logger=e.get(i.b),this.dataTypeService=e.get(Vt.a),this.fractionDigitService=e.get(Pt.a),this.accessPermissionService=e.get(Nt.a),this.numericalOperationService=e.get(Ft.a),Object(nt.isNil)(this.model.displayDataType)||(this.model.displayDataType===ot.DisplayDataType.Binary&&(this.model.dataType=se.a.Binary),this.model.displayDataType===ot.DisplayDataType.Hex&&(this.model.dataType=se.a.Hex)),(this.model.version<6||this.model.enableDataParsed)&&(this.enableDataParsed=!0),this.initElement()}get writeVariableName(){return this.readVariableName}dispose(){this.displayForeignObject&&this.displayForeignObject.remove(),this.$element&&this.$element.remove()}initElement(){const{rootElement:t}=this;t.selectAll("*").remove();let e=null,n=null;this.model.size&&(e=this.model.size.width,n=this.model.size.height),e&&n||(e=60,n=38),t.append("rect").attr("id","StateFrame").attr("width",e).attr("height",n).attr("fill","transparent"),this.initVariableText(e,n),this.initGraphAndText(e,n),this.accessPermissionService.canWrite(this.model.accessPermission)&&null!=this.model.dataType&&(this.rootElement.style("cursor","hand"),this.$element.click(t=>{if(this.isInitialized)if(this.isEnable)if(this.model.useSecurity){const t=this.modalService.show(At.a,{backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.checkElementPassword()})}else this.checkElementPassword();else{const t=this.isGrantedPermission?this.localization.conditionIsNotMetTip:this.localization.permissiontip,e=this.modalService.show(Et.a,{initialState:{alermMessage:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),n=e.content.onClosed.subscribe(()=>{e.hide(),n.unsubscribe()})}}))}checkElementPassword(){if(this.model.enablePassword){const t=this.modalService.show(It.a,{initialState:{securityChecker:this.securityChecker},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.doWriteValue()})}else this.doWriteValue()}initVariableText(t,e){if(!this.model.showVariableText)return;const n={isUnderline:this.model.variableText.font.isUnderline,isBold:this.model.variableText.font.isBold,isItalic:this.model.variableText.font.isItalic,fontSize:this.model.variableText.font.fontSize,fontFamily:this.model.variableText.font.fontFamily,color:this.model.variableText.font.color,textAlign:this.model.variableText.font.textAlign},i=new Rt(this.model.variableText.content+":",n,7*t/11,e,!0);this.$element.append(i.Element)}initGraphAndText(t,e){let n="";if(this.model.showVariableText?(n=`translate(${7*t/11},0)`,t=4*t/11):n="translate(0,0)",!0===this.model.useGraph){const i=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger);i.Element.setAttribute("transform",n),this.$element.append(i.Element),i.switchToState(0)}let i=!1,r=!1,a=!1,o="Microsoft YaHei";if(this.model.font){const t=this.model.font.split(" ");i=this.model.isUnderline,r=$.inArray("bold",t)>=0,a=$.inArray("Italic",t)>=0,o=this.model.font.split(" ").pop()}const s={isUnderline:i,isBold:r,isItalic:a,fontSize:this.model.fontSize,fontFamily:o,color:this.model.stroke,textAlign:this.model.textAlign},l=new Rt("",s,t,e);l.Element.setAttribute("transform",n),this.$element.append(l.Element)}doWriteValue(){if(null==this.writeVariableName)return;const t=new re(this.writeVariableName,this.model.dataType,this.model.fBoxDataType,this.model.integerDigits,this.model.fractionDigits,this.numericalOperationService.getNumericalOperations(this.model),this.model.version,this.enableDataParsed,this.releasedVariableService);this.writeValueMmodalRef=this.modalService.show(oe.a,{initialState:{args:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),this.writeValueMmodalRef.content.onClosed=(t=>{if(t){this.restorationTimer&&(clearTimeout(this.restorationTimer),this.restorationTimer=void 0),this.recordValue=t.value;const e=this.dataTypeService.formatToDecimal(this.model.version,t.value,this.model.dataType);this.showValue=t.showValue,this.displayText!==this.showValue||t.variableRwType===ae.witer?(this.numericalOperation||t.enableNumericalOperation||t.isNumericalOperation||t.variableRwType===ae.witer?(this.recordOperation(t.value),this.writeValueMmodalRef.hide()):this.restorationTimer=setTimeout(()=>{(this.model.fractionDigits?parseFloat(this.displayText)===parseFloat(this.showValue):parseInt(this.displayText,16)===parseInt(this.showValue,16))||(this.writeValueMmodalRef.content.isSubmitting=!1,this.writeValueMmodalRef.content.showValidationErrorInfo(this.localization.writeValueTimeout))},1e4),this.variableCommunicator.write(this.writeVariableName,e).subscribe()):this.writeValueMmodalRef.hide()}})}recordOperation(t){(this.model.isRecordOperation||void 0===this.model.isRecordOperation)&&this.operationRecordService.record({variableOptionModel:{variableName:this.writeVariableName,originValue:this.formatDisplayTextUnit(this.displayText),newValue:this.formatDisplayTextUnit(this.formatNumericalDisplayText(this.model.dataType,this.model.fractionDigits,t))},operationDescription:this.model.operationDescription})}changeStates(){super.changeStates(),this.state===ot.State.Normal||this.state===ot.State.Disable?this.updateDisplayText(this.formatDisplayTextUnit(this.displayText)):this.preState!==this.state&&this.updateDisplayText("")}updateVariableValue(t){var e;const n=this.formatNumericalDisplayText(this.model.dataType,this.model.fractionDigits,t),i=this.model.fractionDigits?parseFloat(n)===parseFloat(this.showValue):parseInt(n,16)===parseInt(this.showValue,16);(null===(e=this.writeValueMmodalRef)||void 0===e?void 0:e.content)&&i&&(this.restorationTimer&&(clearTimeout(this.restorationTimer),this.restorationTimer=void 0,this.recordOperation(this.recordValue)),this.writeValueMmodalRef.hide(),this.writeValueMmodalRef.content.hideValidationErrorInfo()),this.displayText=n,this.updateDisplayText(this.formatDisplayTextUnit(this.displayText))}updateDisplayText(t){if(this.displayForeignObject||(this.model.showVariableText?this.displayForeignObject=this.$element.find("foreignObject").eq(1):this.displayForeignObject=this.$element.find("foreignObject").eq(0)),Object(nt.isNil)(t))this.displayForeignObject.remove();else{const e=this.displayForeignObject.find(".text-list"),n=t.toString().split("\n");if(e.length===n.length)for(let t=0;t<e.length;t++)e[t].innerText=n[t];else{this.displayForeignObject.remove();const e=this.displayForeignObject.attr("width"),n=this.displayForeignObject.attr("height"),i=this.displayForeignObject.attr("transform");this.displayForeignObject=$(this.rebuildTextElement(e,n,i,t))}}}rebuildTextElement(t,e,n,i){let r=!1,a=!1,o=!1,s="Microsoft YaHei";if(this.model.font){const t=this.model.font.split(" ");r=this.model.isUnderline,a=$.inArray("bold",t)>=0,o=$.inArray("Italic",t)>=0,s=this.model.font.split(" ").pop()}const l={isUnderline:r,isBold:a,isItalic:o,fontSize:this.model.fontSize,fontFamily:s,color:this.model.stroke,textAlign:this.model.textAlign},u=new Rt(i,l,Number(t),Number(e));return u.Element.setAttribute("transform",n),this.$element.append(u.Element),u.Element}formatNumericalDisplayText(t,e,n){if(null==n||n.toString().trim().length<=0)return"";if(n=+n,this.dataTypeService.isHexType(this.model.version,t))return(n>>>0).toString(16).toUpperCase();if(this.dataTypeService.isBinaryType(this.model.version,t)){const t=(n>>>0).toString(2);if(t.length<17)return t;const e="1111111111111111";if(0===t.indexOf(e))return t.replace(e,"");const i="0000000000000000";return 0===t.indexOf(i)?t.replace(i,""):t}if(!this.isNumeric(n)||null==e||e<0)return n;if(!this.enableDataParsed)return n;if(!this.dataTypeService.isSupportFractionDigit(this.model.version,t))return n;if(this.dataTypeService.isSupportNumericalOperation(this.model.version,t)&&this.model.enableNumericalOperation&&this.isNumeric(n))return this.numericalOperationService.getNumericalOperationedValue(this.model,n,e);if(this.dataTypeService.isFloat(this.model.version,t))return this.formatFloatDisplayText(e,n);if(0===e)return n;let i=Number(n).toFixed(0).toString();const r=+i<0;if(r&&(i=i.slice(1,i.length)),i.length>e){const t=i.length-e;i=i.substr(0,t)+"."+i.substr(t)}else{const t=e-i.length;for(let e=0;e<t;e++)i=`0${i}`;i=`0.${i}`}return r?`-${i}`:i}formatFloatDisplayText(t,e){let n=Number(e);return Object(nt.isNil)(t)?n.toFixed(0):(n=+n.toFixed(t+2),this.fractionDigitService.roundingToFixedFractionDigits(n,t))}isNumeric(t){return!isNaN(t)}formatDisplayTextUnit(t){return!1!==this.model.showUnit&&this.model.unit?`${t||0} ${this.model.unit}`:t}}var ue=n(33),ce=n(22);class de extends wt{constructor(t,e,n,i,r,a){super(t,e,n,i,r,a),this.variableCommunicator=n,this.variableStore=i,this.recoverData(),setTimeout(()=>{this.initConditionalControl()})}initConditionalControl(){if(!1===this.model.isControl)return;if(null==this.model.controlItems||!this.model.controlItems.length)return;const t=new ot.ConditionItemsResultObserver(this.model.controlItems,this.variableCommunicator,this.variableStore);t.conditionResultChanged.subscribe(t=>{this.updateElement(t)}),t.requestData(this.signalRAppId)}recoverData(){if(!this.model)throw new Error("Model cannot be null");if(null==this.model.version||this.model.version<1){if(this.model.variableName){this.model.controlItems=new Array;const t={variableName:this.model.variableName,bitConditionLogic:ot.BitConditonLogic.On},e={index:0,conditionType:ue.a.Bit,condition:t,relationType:ce.a.None};this.model.controlItems.push(e);const n=new ft.a(e.condition.variableName,e.condition.variableGroupName,e.condition.dataSourceCode,e.condition.variableVersion);this.addElementState(new rt.c(ht.a.getConvertedVariableName(this.variableStore,n),void 0)),this.initState()}}else if(this.model.version<2){if(this.model.readVariable&&this.model.readVariable.name&&this.model.readVariable.groupName){this.model.controlItems=new Array;const t={variableName:this.model.readVariable.name,variableGroupName:this.model.readVariable.groupName,bitConditionLogic:ot.BitConditonLogic.On},e={index:0,conditionType:ue.a.Bit,condition:t,relationType:ce.a.None};this.model.controlItems.push(e);const n=new ft.a(e.condition.variableName,e.condition.variableGroupName,e.condition.dataSourceCode,e.condition.variableVersion);this.addElementState(new rt.c(ht.a.getConvertedVariableName(this.variableStore,n),void 0)),this.initState()}}else Object(nt.forEach)(this.model.controlItems,t=>{if(t.condition.variableName){const e=new ft.a(t.condition.variableName,t.condition.variableGroupName,t.condition.dataSourceCode,t.condition.variableVersion);this.addElementState(new rt.c(ht.a.getConvertedVariableName(this.variableStore,e),void 0)),this.initState()}})}}class he extends de{constructor(t,e,n,i,r,a){super(t,e,n,i,r,a),this.initDefaultData(this.model);const o=this.$element.children();if(o&&o.length){if(this.model.isPipeWall){const t=o.eq(0);t&&(t.attr("stroke",this.model.pipeWallColor),t.attr("stroke-width",this.model.pipeDiameter))}if(this.elePipeInnerwall=o.eq(this.model.isPipeWall?1:0),this.elePipeInnerwall.attr("stroke",this.model.backGroundColor),this.model.pipeDiameter-2*this.model.pipeWallSize<=0?this.elePipeInnerwall.attr("stroke-width",1):this.elePipeInnerwall.attr("stroke-width",this.model.pipeDiameter-2*this.model.pipeWallSize),this.elePipeInnerwall.attr("stroke-opacity",1),this.model.isFlowBlock){const t=this.model.blockLength+","+this.model.blockMargin;this.elePipeFlowBlock=o.eq(this.model.isPipeWall?2:1),this.elePipeFlowBlock.attr("d",o.first().attr("d")),this.elePipeFlowBlock.attr("stroke",this.model.blockColor),this.elePipeFlowBlock.attr("stroke-width",this.model.blockWidth),this.elePipeFlowBlock.attr("stroke-dasharray",t),this.elePipeFlowBlock.attr("stroke-opacity",1),this.elePipeFlowBlock.css("display","block")}this.pathLength=this.model.blockLength+this.model.blockMargin,this.model.isFlowBlock&&!this.model.isFlow&&this.elePipeFlowBlock.append(this.getAnimate()),setTimeout(()=>{this.initFrameNode()},0)}}initDefaultData(t){void 0===t.isPipeWall&&(t.isPipeWall=!0),void 0===t.isFlowBlock&&(t.isFlowBlock=!0),void 0===t.pipeWallColor&&(this.model.pipeWallColor="#333"),void 0===t.pipeDiameter&&(t.pipeDiameter=14),void 0===t.backGroundColor&&(t.backGroundColor="#ffffff"),void 0===t.pipeWallSize&&(t.pipeWallSize=1),void 0===t.blockLength&&(t.blockLength=12),void 0===t.blockMargin&&(t.blockMargin=6),void 0===t.blockColor&&(t.blockColor="#0081ff"),void 0===t.blockWidth&&(t.blockWidth=6)}updateElement(t){this.updateElementStates(t.states),this.model.isFlow&&this.startOrStopPipeFlow(t.value)}initFrameNode(){const t=Snap(this.$element.find("path:last")[0]).getBBox(!0);let e=this.model.pipeDiameter,n=t.width+1,i=(e=(e=e<t.height?t.height:e)<20?20:e)/2;t.height>0?(i=6,e+=15,n+=2):(i-=1,20===e&&(i-=3)),this.rootElement.append("rect").attr("id","StateFrame").attr("width",n).attr("height",e).attr("x",i).attr("fill","none")}startOrStopPipeFlow(t){this.elePipeFlowBlock&&(this.elePipeFlowBlock.children().remove(),t&&this.elePipeFlowBlock.append(this.getAnimate()))}getAnimate(){switch(this.model.flowDirection){case ot.FlowDirectionType.Positive:return this.getAnimateElement(this.pathLength,0);case ot.FlowDirectionType.Negative:return this.getAnimateElement(0,this.pathLength);default:throw new Error("Unknown flowDirection:"+this.model.flowDirection)}}getAnimateElement(t,e){const n=this.$element[0].ownerDocument.createElementNS("http://www.w3.org/2000/svg","animate");return n.setAttribute("attributeType","XML"),n.setAttribute("attributeName","stroke-dashoffset"),n.setAttribute("from",t.toString()),n.setAttribute("to",e.toString()),n.setAttribute("by","3"),n.setAttribute("dur","1s"),n.setAttribute("repeatCount","indefinite"),n}}var fe=Math.PI,me=2*fe,pe=me-1e-6;function ge(){this._x0=this._y0=this._x1=this._y1=null,this._=""}function ve(){return new ge}ge.prototype=ve.prototype={constructor:ge,moveTo:function(t,e){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)},closePath:function(){null!==this._x1&&(this._x1=this._x0,this._y1=this._y0,this._+="Z")},lineTo:function(t,e){this._+="L"+(this._x1=+t)+","+(this._y1=+e)},quadraticCurveTo:function(t,e,n,i){this._+="Q"+ +t+","+ +e+","+(this._x1=+n)+","+(this._y1=+i)},bezierCurveTo:function(t,e,n,i,r,a){this._+="C"+ +t+","+ +e+","+ +n+","+ +i+","+(this._x1=+r)+","+(this._y1=+a)},arcTo:function(t,e,n,i,r){t=+t,e=+e,n=+n,i=+i,r=+r;var a=this._x1,o=this._y1,s=n-t,l=i-e,u=a-t,c=o-e,d=u*u+c*c;if(r<0)throw new Error("negative radius: "+r);if(null===this._x1)this._+="M"+(this._x1=t)+","+(this._y1=e);else if(d>1e-6)if(Math.abs(c*s-l*u)>1e-6&&r){var h=n-a,f=i-o,m=s*s+l*l,p=h*h+f*f,g=Math.sqrt(m),v=Math.sqrt(d),_=r*Math.tan((fe-Math.acos((m+d-p)/(2*g*v)))/2),y=_/v,b=_/g;Math.abs(y-1)>1e-6&&(this._+="L"+(t+y*u)+","+(e+y*c)),this._+="A"+r+","+r+",0,0,"+ +(c*h>u*f)+","+(this._x1=t+b*s)+","+(this._y1=e+b*l)}else this._+="L"+(this._x1=t)+","+(this._y1=e);else;},arc:function(t,e,n,i,r,a){t=+t,e=+e;var o=(n=+n)*Math.cos(i),s=n*Math.sin(i),l=t+o,u=e+s,c=1^a,d=a?i-r:r-i;if(n<0)throw new Error("negative radius: "+n);null===this._x1?this._+="M"+l+","+u:(Math.abs(this._x1-l)>1e-6||Math.abs(this._y1-u)>1e-6)&&(this._+="L"+l+","+u),n&&(d<0&&(d=d%me+me),d>pe?this._+="A"+n+","+n+",0,1,"+c+","+(t-o)+","+(e-s)+"A"+n+","+n+",0,1,"+c+","+(this._x1=l)+","+(this._y1=u):d>1e-6&&(this._+="A"+n+","+n+",0,"+ +(d>=fe)+","+c+","+(this._x1=t+n*Math.cos(r))+","+(this._y1=e+n*Math.sin(r))))},rect:function(t,e,n,i){this._+="M"+(this._x0=this._x1=+t)+","+(this._y0=this._y1=+e)+"h"+ +n+"v"+ +i+"h"+-n+"Z"},toString:function(){return this._}};var _e,ye=ve;class be extends Lt{constructor(t,e,n,i,r,a){super(t,e,n,i,r,a),this.valueObj={},this.isNeedUpdateScale=!1,(this.model.minValueType===Yt.a.Constant&&this.model.maxValueType===Yt.a.Variable||this.model.maxValueType===Yt.a.Constant&&this.model.minValueType===Yt.a.Variable)&&(this.isNeedUpdateScale=!0,this.updateScale(),this.isNeedUpdateScale=!1);const o=$(t);this._barElement$=o.find('path[data-id="barArc"]'),this._textElement$=o.find('text[data-id="pText"]'),setTimeout(()=>{this.initFrameNode(),this.changeStates()})}get readVariableName(){if(!this.model.variableId)return"";if(!this.model.variableId.variableName||!this.model.variableId.variableName.name)return;const t=new ft.a(this.model.variableId.variableName.name,this.model.variableId.variableName.groupName,this.model.variableId.dataSourceCode,this.model.variableId.variableName.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}get minVariableName(){if(!this.model.minValueType)return;if(!this.model.minVariable||!this.model.minVariable.name)return;const t=new ft.a(this.model.minVariable.name,this.model.minVariable.groupName,this.model.minVariable.dataSourceCode,this.model.minVariable.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}get maxVariableName(){if(!this.model.maxValueType)return;if(!this.model.maxVariable||!this.model.maxVariable.name)return;const t=new ft.a(this.model.maxVariable.name,this.model.maxVariable.groupName,this.model.maxVariable.dataSourceCode,this.model.maxVariable.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}initFrameNode(){const t=Snap(this.$element[0]).getBBox(!0);this.rootElement.append("rect").attr("id","StateFrame").attr("width",t.width).attr("height",t.height).attr("fill","transparent")}init(t){if(t){let e=!1;Object(nt.forEach)(this.elementStates,n=>{n.variableName===t&&(e=!0)}),e||t!==this.readVariableName||this.elementStates.push(new rt.c(t,void 0))}}updateValueObj(t,e){var n,i,r;(null===(n=this.model.variableId)||void 0===n?void 0:n.variableName.name)===e&&(this.isNeedUpdateScale=!1,this.valueObj.value=t),(null===(i=this.model.minVariable)||void 0===i?void 0:i.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.min=t),(null===(r=this.model.maxVariable)||void 0===r?void 0:r.name)===e&&(this.isNeedUpdateScale=!0,this.valueObj.max=t)}updateScale(){if(!this.isNeedUpdateScale)return;const t=this.$element.find("g:first > text");let e=this.model.minValueType?this.valueObj.min:this.model.min,n=this.model.maxValueType?this.valueObj.max:this.model.max;e=Number(e),n=Number(n),(isNaN(e)||isNaN(n))&&(e=be.DEFAULT_MIN_VALUE,n=be.DEFAULT_MAX_VALUE);const i=((n-e)/this.model.masterDivisionNumber).toFixed(5);for(let n=0;n<t.length;n++){const r=t[n];if(!r.innerHTML)continue;let a=(Number(i)*n+e).toFixed(0);this.model.fractionDigits>0&&(a=(a/Math.pow(10,this.model.fractionDigits)).toFixed(this.model.fractionDigits)),isNaN(a)||(r.innerHTML=a)}}updateVariableValue(t,e){this.updateValueObj(t,e),this.updateScale();let n=this.model.minValueType?this.valueObj.min:this.model.min,i=this.model.maxValueType?this.valueObj.max:this.model.max;n=Number(n),i=Number(i),(isNaN(n)||isNaN(i))&&(n=be.DEFAULT_MIN_VALUE,i=be.DEFAULT_MAX_VALUE);const r=St(n,i,this.valueObj.value||0);this.updateBar(r),this._barElement$.attr("fill",this.getBarColor(t)),this.model.showPercentage&&this._textElement$.text((100*r).toFixed(0)+"%")}updateBar(t){const e=this.model,n=e.size.width/2,i=e.arc.startAngle,r=e.arc.endAngle,a=i===r?360:i<r?r-i:r+360-i,o=n*(e.scale/100),s=ye();switch(Number(e.direction)){case ut.ClockWise:this.drawClockWiseArc(i,a,t,s,n,o);break;case ut.ReverseClockWise:this.drawAntiClockWiseArc(r,a,t,s,n,o)}s.closePath(),this._barElement$.attr("d",s.toString())}getBarColor(t){const e=this.model;if(!e.enableAlarmRange)return e.barFill;const n=e.alarmRange;return t>n.upper?n.upperFill:t<n.lower?n.lowerFill:e.barFill}drawClockWiseArc(t,e,n,i,r,a){const o=Tt(t),s=Tt(e*n+t);i.arc(r,r,r,o,s),i.arc(r,r,a,s,o,!0)}drawAntiClockWiseArc(t,e,n,i,r,a){const o=Tt(t),s=Tt(t-e*n);i.arc(r,r,r,o,s,!0),i.arc(r,r,a,s,o)}}be.DEFAULT_MIN_VALUE=0,be.DEFAULT_MAX_VALUE=100,function(t){t[t.Image=0]="Image",t[t.Graph=1]="Graph"}(_e||(_e={}));class Me extends xt{constructor(t,e,n,r,a,o,s,l){if(super(t,r,a,o,l),this.graphStore=s,this.logger=e.get(i.b),!this.model.version||this.model.version<4||this.model.fillType!==_e.Graph){let t="";this.model.imageId&&(t=n.getImageUrl(this.model.imageId));const e=this.rootElement.select("image");if(e.empty()){const e=this.model.size;e&&this.rootElement.append("image").attr("width",e.width).attr("height",e.height).attr("xlink:href",t).attr("preserveAspectRatio","none").attr("crossorigin","anonymous")}else e.attr("xlink:href",t).attr("crossorigin","anonymous")}else this.initGraph(this.model.size.width,this.model.size.height)}initGraph(t,e){const n=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger);n.switchToState(0),this.$element.prepend(n.Element)}}class xe extends xt{constructor(t,e,n,r,a,o,s){if(super(t,n,r,a,s),this.graphStore=o,this.logger=e.get(i.b),this.model.text&&this.model.size){const t=this.model.size.width,e=this.model.size.height;if(this.rootElement.selectAll("*").remove(),this.rootElement.append("rect").attr("width",t).attr("height",e).attr("fill","transparent"),!0===this.model.useGraph){const n=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger);n.switchToState(0),this.$element.prepend(n.Element)}const n={isUnderline:this.model.isUnderline,isBold:this.isBold(this.model.font),isItalic:this.isItalic(this.model.font),fontSize:this.model.fontSize,fontFamily:this.fontFamily(this.model.font),color:this.model.stroke,textAlign:this.model.textAlign},i=new Rt(this.model.text,n,t,e);this.$element.append(i.Element)}else this.handleTextValue(),this.model.size&&this.model.useGraph&&this.initGraph(this.model.size.width,this.model.size.height)}dispose(){this.$element&&this.$element.remove()}handleTextValue(){const t=this.$element.find("text");for(let e=0;e<t.length;e++)t[e].style.whiteSpace="pre"}initGraph(t,e){const n=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger);n.switchToState(0),this.$element.prepend(n.Element)}}class we{constructor(t,e,n,i,r,a){this.textStates=t,this.width=e,this.height=n,this.logger=i,this.version=r,this.faultFlickers=a,this.faultFlickerStatus=!1,this.faultFlickerInterval=void 0,this._element=document.createElementNS("http://www.w3.org/2000/svg","g")}get Element(){return this._element}switchToState(t){const e=this.textStates.find(e=>e.id===t);if(void 0===e)return this.removeForeignObjectlement(),void this.logger.debug(`Can not find text state:${t}.`);const n=e.text.content;if(""===n)return void this.removeForeignObjectlement();const i=e.text.font;if(!i)return this.removeForeignObjectlement(),void this.logger.debug("The font is undefined.");const r=this.getforeignObjectElement();r.innerHTML="";const a=this.createNewForeignObjectText(n,i);r.appendChild(a),this.doFaultFlicker(r,t)}getforeignObjectElement(){return this.textElement||(this.textElement=document.createElementNS("http://www.w3.org/2000/svg","foreignObject"),this.textElement.setAttribute("width",this.width.toString()),this.textElement.setAttribute("height",this.height.toString()),this._element.appendChild(this.textElement)),this.textElement}createNewForeignObjectText(t,e){e&&!e.fontFamily.includes(",msyh")&&(e.fontFamily+=",msyh");const n=document.createElement("div");n.style.textAlign=e.textAlign?e.textAlign:"center",n.style.userSelect="none",n.style.display="table-cell",n.style.verticalAlign="middle",Object(nt.isNil)(t)&&(t="");let i=t.toString().split("\n");i=i.map(t=>t.toString().replace(/\s/g," "));const r=document.createDocumentFragment();for(let t=0;t<i.length;t++){const n=document.createElement("div");n.innerHTML=i[t]?i[t]:" ";let a="";e.isItalic&&(a+="italic "),e.isBold&&(a+="bold "),n.style.wordBreak="break-word",n.style.color=e.color;let o=0;o=parseInt(e.fontSize,10)+5,a+=e.fontSize+"px/"+o+"px "+e.fontFamily,n.style.font=a,e.isUnderline&&(n.style.textDecoration="underline"),r.appendChild(n)}n.appendChild(r);const a=document.createElement("div");a.style.display="table",a.style.width="100%",a.style.height="100%",a.appendChild(n);const o=document.createElement("div");return o.style.overflow="hidden",o.style.width=this.width.toString()+"px",o.style.height=this.height.toString()+"px",o.appendChild(a),o}removeForeignObjectlement(){this.textElement&&(this._element.removeChild(this.textElement),delete this.textElement)}doFaultFlicker(t,e){if(this.version>3&&this.faultFlickers){this.clearFlickerInterval(t);const n=this.faultFlickers.find(t=>t.id===e);n&&n.faultFlicker&&n.faultFlicker.flicker===ot.Flicker.Label&&(this.faultFlickerInterval=setInterval(()=>{this.faultFlickerStatus?(t.setAttributeNS(null,"display","block"),this.faultFlickerStatus=!1):(t.setAttributeNS(null,"display","none"),this.faultFlickerStatus=!0)},500*n.faultFlicker.frequency))}}clearFlickerInterval(t){this.faultFlickerInterval&&(clearInterval(this.faultFlickerInterval),this.faultFlickerStatus&&t.setAttributeNS(null,"display","block"))}}class ke{constructor(t,e){this.state=t,this.value=e,this.state=t,this.value=e}}var Le=n(32);class Se{constructor(t,e,n,i){if(this.settings=t,this.variableCommunicator=n,this.variableStore=i,this.currentStateIdChanged=new ct.EventEmitter,!this.settings)throw new Error("settings cannot be null");Object(nt.each)(e,t=>{const e=t.condition;if(!e)throw new Error("Invalid bit condition.");switch(+e.logic){case ot.BitConditonLogic.Off:if(this.offStateId)throw new Error("Dumplicate off state.");this.offStateId=t.id;break;case ot.BitConditonLogic.On:if(this.onStateId)throw new Error("Dumplicate on state.");this.onStateId=t.id;break;default:throw new Error(`Unknown BitConditonLogic:${e.logic}`)}})}get variableName(){const t=new ft.a(this.settings.variableName,this.settings.variableGroupName,this.settings.dataSourceCode,this.settings.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}requestData(t){this.variableName&&this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===rt.d.Normal?this.requestCurrentSateIdValue(this.variableCommunicator,t):this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,e.state)))})}requestCurrentSateIdValue(t,e=""){t.openVariable(this.variableName,e).subscribe(t=>{if(t.state===rt.d.DataNormal)if(this.settings.isBitwiseIndex){const e=31;this.binary=new Le.a(t.value,e+1);const n=new rt.e(t.variableName,t.state,Number(this.binary.convertToBinary().substr(e-this.settings.bitIndex,1)));this.currentStateId=n.value?this.onStateId:this.offStateId,this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state),this.currentStateId))}else this.currentStateId=t.value?this.onStateId:this.offStateId,this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state),this.currentStateId));else delete this.currentStateId,this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state)))})}}class Te{constructor(t,e,n,i){if(this.settings=t,this.variableCommunicator=e,this.variableStore=n,this.signalRAppId=i,!this.settings)throw new Error("settings cannot be null");this.settings.isWriteOnly?this.canExecuteInternal=!0:e.openVariable(this.variableName,this.signalRAppId).subscribe(t=>{this.currentValue=t,this.canExecuteInternal=this.currentValue&&this.currentValue.state===rt.d.DataNormal})}get variableName(){const t=new ft.a(this.settings.variableName,this.settings.variableGroupName,this.settings.dataSourceCode,this.settings.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}canExecute(){return this.canExecuteInternal}execute(){if(!this.canExecute())throw new Error("Can not execute.");const t=this.settings;let e,n,i;switch(t.isBitwiseIndex&&(n=31,this.binary=new Le.a(this.currentValue.value,n+1)),+t.operation){case ot.BitSwitchOperation.On:e=1,t.isBitwiseIndex?this.variableCommunicator.writeWordByBit(this.variableName,t.bitIndex,e).subscribe():this.variableCommunicator.write(this.variableName,e).subscribe();break;case ot.BitSwitchOperation.Off:e=0,t.isBitwiseIndex?this.variableCommunicator.writeWordByBit(this.variableName,t.bitIndex,e).subscribe():this.variableCommunicator.write(this.variableName,e).subscribe();break;case ot.BitSwitchOperation.Inverse:if(!this.settings.isWriteOnly)if(e=0===this.currentValue.value?1:0,t.isBitwiseIndex){let e=Number(this.binary.convertToBinary().substr(n-this.settings.bitIndex,1));e=0===e?1:0,this.variableCommunicator.writeWordByBit(this.variableName,t.bitIndex,e).subscribe()}else this.variableCommunicator.write(this.variableName,e).subscribe();break;case ot.BitSwitchOperation.Restoration:break;default:throw new Error(`Unknown BitSwitchOperation:${t.operation}`)}return this.currentValue&&void 0!==this.currentValue.value&&(i=this.currentValue.value),Promise.resolve({variableName:this.variableName,originValue:i,newValue:e})}writeValue(t){let e;return this.settings.isBitwiseIndex?this.variableCommunicator.writeWordByBit(this.variableName,this.settings.bitIndex,t).subscribe():this.variableCommunicator.write(this.variableName,t).subscribe(),this.currentValue&&void 0!==this.currentValue.value&&(e=this.currentValue.value),Promise.resolve({variableName:this.variableName,originValue:e,newValue:t})}}class Ye{constructor(t,e,n,i){if(this.settings=t,this.variableCommunicator=n,this.variableStore=i,this.currentStateIdChanged=new ct.EventEmitter,!this.settings)throw new Error("settings cannot be null");this.sortedStates=Object(nt.sortBy)(e,["id"])}get variableName(){const t=new ft.a(this.settings.variableName,this.settings.variableGroupName,this.settings.dataSourceCode,this.settings.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}requestData(t){this.variableName?this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===rt.d.Normal?this.requestCurrentSateIdValue(this.variableCommunicator,t):this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,e.state)))}):this.requestCurrentSateIdValue(this.variableCommunicator,t)}requestCurrentSateIdValue(t,e=""){t.openVariable(this.variableName,e).subscribe(t=>{if(t.state===rt.d.DataNormal){let e=0;for(let n=0;n<this.sortedStates.length-1;n++){const i=this.sortedStates[n],r=i.condition;if(!r)throw new Error(`condition is not WordCondition.stateId:${i.id}`);if(e=i.id,ot.ConditionHelper.isSatisfied(r.operator,r.operand,+t.value))return this.currentStateId=e,void this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state),this.currentStateId))}this.currentStateId=Object(nt.last)(this.sortedStates).id,this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state),this.currentStateId))}else delete this.currentStateId,this.currentStateIdChanged.emit(new ke(new rt.c(this.variableName,t.state)))})}}class De{constructor(t,e,n,i){if(this.settings=t,this.variableCommunicator=e,this.variableStore=n,this.signalRAppId=i,!this.settings)throw new Error("settings cannot be null");this.settings.isWriteOnly?this.canExecuteInternal=!0:e.openVariable(this.variableName,this.signalRAppId).subscribe(t=>{this.currentValue=t,this.canExecuteInternal=this.currentValue&&this.currentValue.state===rt.d.DataNormal})}get variableName(){const t=new ft.a(this.settings.variableName,this.settings.variableGroupName,this.settings.dataSourceCode,this.settings.variableVersion);return ht.a.getConvertedVariableName(this.variableStore,t)}canExecute(){return this.canExecuteInternal}execute(){if(!this.canExecute())throw new Error("Can not execute.");const t=this.settings;let e,n;switch(+t.operation){case ot.WordSwitchOperation.Add:this.settings.isWriteOnly||(e=lt.e.add(+this.currentValue.value,t.operand,t.dataType,t.maxValue),this.variableCommunicator.write(this.variableName,e).subscribe());break;case ot.WordSwitchOperation.Subtract:this.settings.isWriteOnly||(e=lt.e.subtract(+this.currentValue.value,t.operand,t.dataType,t.minValue),this.variableCommunicator.write(this.variableName,e).subscribe());break;case ot.WordSwitchOperation.SetConstant:e=t.operand,this.variableCommunicator.write(this.variableName,e).subscribe();break;default:throw new Error(`Unknown WordSwitchOperator:${t.operation}`)}return this.currentValue&&void 0!==this.currentValue.value&&(n=this.currentValue.value),Promise.resolve({variableName:this.variableName,originValue:n,newValue:e})}writeValue(t){return Promise.resolve({newValue:t})}}class Ce extends kt{constructor(t,e,n,r,a,o,s,l,u,c,d){if(super(t,o,r,u,c,d),this.modalService=n,this.graphStore=a,this.operationRecordService=s,this.securityChecker=l,this.isBitRestoration=!1,this.isVerifiedForRestoration=!1,this.isWriteRestorationDownValue=!1,this.logger=e.get(i.b),this.isMobileMode=ee.a.Mobile===e.get(ee.b).displayMode,this.checkState(),this.model.useSwitch){this.initSwitchOperator(),this.rootElement.style("cursor","hand");const t=navigator.userAgent.match(/(phone|pad|pod|iPhone|iPod|ios|iPad|Android|Mobile|BlackBerry|IEMobile|MQQBrowser|JUC|Fennec|wOSBrowser|BrowserNG|WebOS|Symbian|Windows Phone)/i);this.rootElement.on(this.isMobileMode&&t?"touchstart":"mousedown",()=>{if(this.isInitialized)if(this.isEnable){if(this.switchOperator.canExecute()){if(this.isBitRestoration&&this.isVerifiedForRestoration)document.addEventListener(this.isMobileMode?"touchend":"mouseup",this.onDocMouseUp),this.restorationTimer=setTimeout(()=>{this.writeValue(1),this.isWriteRestorationDownValue=!0},1e3);else if(this.model.useSecurity){const t=this.modalService.show(At.a,{backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.checkElementPassword(!0)})}else this.checkElementPassword(!1),this.model.useIndicatorLight||this.isMobileMode||this.switchToState(1);H.preventDefault()}}else{const t=this.isGrantedPermission?this.localization.conditionIsNotMetTip:this.localization.permissiontip,e=this.modalService.show(Et.a,{initialState:{alermMessage:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),n=e.content.onClosed.subscribe(()=>{e.hide(),n.unsubscribe()})}}),this.rootElement.on(this.isMobileMode&&t?"touchend":"mouseup",()=>{this.handleMouseUp(),H.stopPropagation()}),this.initOnDocMouseUpEvent()}this.initGraphAndText(),this.model.useIndicatorLight?this.initIndictorLightOperator():this.switchToState(0)}handleMouseUp(){this.restorationTimer&&(clearTimeout(this.restorationTimer),this.restorationTimer=void 0),this.isBitRestoration&&this.isWriteRestorationDownValue&&this.writeValue(0),document.removeEventListener(this.isMobileMode?"touchend":"mouseup",this.onDocMouseUp),this.isVerifiedForRestoration=!1,this.isWriteRestorationDownValue=!1,this.model.useIndicatorLight||this.isMobileMode||(this.switchToState(0),H&&H.preventDefault())}initOnDocMouseUpEvent(){this.onDocMouseUp=(()=>{this.handleMouseUp()})}checkElementPassword(t){if(this.model.enablePassword){const t=this.modalService.show(It.a,{initialState:{securityChecker:this.securityChecker},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&(this.isBitRestoration?this.isVerifiedForRestoration=!0:this.doSwitchOperator())})}else this.isBitRestoration?t?this.isVerifiedForRestoration=!0:(this.isVerifiedForRestoration=!0,document.addEventListener(this.isMobileMode?"touchend":"mouseup",this.onDocMouseUp),this.restorationTimer=setTimeout(()=>{this.writeValue(1),this.isWriteRestorationDownValue=!0},1e3)):this.doSwitchOperator()}doSwitchOperator(){this.switchOperator.execute().then(t=>{(this.model.isRecordOperation||void 0===this.model.isRecordOperation)&&(void 0===t.newValue&&void 0===t.originValue||this.operationRecordService.record({variableOptionModel:t,operationDescription:this.model.operationDescription}))}).catch(()=>{throw new Error("Failure of the operation record:switchOperator")})}writeValue(t){this.switchOperator.writeValue(t).then(t=>{(this.model.isRecordOperation||void 0===this.model.isRecordOperation)&&(void 0===t.newValue&&void 0===t.originValue||this.operationRecordService.record({variableOptionModel:t,operationDescription:this.model.operationDescription}))}).catch(()=>{throw new Error("Failure of the operation record:switchOperator")})}initSwitchOperator(){const t=this.model.switchSettings;switch(t.type){case ot.SwitchType.Bit:this.switchOperator=new Te(t.settings,this.variableCommunicator,this.variableStore,this.signalRAppId),this.isBitRestoration=t.settings.operation===ot.BitSwitchOperation.Restoration;break;case ot.SwitchType.Word:this.switchOperator=new De(t.settings,this.variableCommunicator,this.variableStore,this.signalRAppId);break;default:throw new Error(`Unknown switchType:${t.type}`)}}initIndictorLightOperator(){const t=this.model.indicatorLightSettings;if(t.settings.variableName){const e=new ft.a(t.settings.variableName,t.settings.variableGroupName,t.settings.dataSourceCode,t.settings.variableVersion);this.addElementState(new rt.c(ht.a.getConvertedVariableName(this.variableStore,e),void 0)),this.initState()}switch(t.type){case ot.IndicatorLightType.Bit:this.indicatorLightOperator=new Se(t.settings,this.model.states,this.variableCommunicator,this.variableStore);break;case ot.IndicatorLightType.Word:this.indicatorLightOperator=new Ye(t.settings,this.model.states,this.variableCommunicator,this.variableStore);break;default:throw new Error(`Unknown switchType:${t.type}`)}this.indicatorLightOperator.currentStateIdChanged.subscribe(t=>{this.currentStateIdChange(t)}),this.indicatorLightOperator.requestData(this.signalRAppId)}currentStateIdChange(t){Object(nt.isUndefined)(t.value)||this.switchToState(t.value),this.updateElementStates([t.state]),this.state!==ot.State.Unbind&&this.state!==ot.State.Offline||this.switchToState(0)}switchToState(t){this.textStateElement.switchToState(t),this.graphStateElement&&this.graphStateElement.switchToState(t)}initGraphAndText(){this.rootElement.selectAll("*").remove();const t=this.model.size,e=t.width,n=t.height;this.rootElement.append("rect").attr("id","StateFrame").attr("width",e).attr("height",n).attr("fill","transparent"),!0===this.model.useGraph&&(this.graphStateElement=new $t(this.model.graphSetting,e,n,this.graphStore,this.logger,this.model.version,this.model.states),this.$element.append(this.graphStateElement.Element)),this.textStateElement=new we(this.model.states,e,n,this.logger,this.model.version,this.model.states),this.$element.append(this.textStateElement.Element)}checkState(){if(!this.model.states)throw new Error("The switch indicator light's states is undefined.");if(this.model.states.length<2)throw new Error("The switch indicator light's states must greater than 2.")}}class Ee extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}}class Ae extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}}class Oe extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}}var je={value:function(){}};function Ne(){for(var t,e=0,n=arguments.length,i={};e<n;++e){if(!(t=arguments[e]+"")||t in i)throw new Error("illegal type: "+t);i[t]=[]}return new He(i)}function He(t){this._=t}function Ve(t,e){for(var n,i=0,r=t.length;i<r;++i)if((n=t[i]).name===e)return n.value}function Pe(t,e,n){for(var i=0,r=t.length;i<r;++i)if(t[i].name===e){t[i]=je,t=t.slice(0,i).concat(t.slice(i+1));break}return null!=n&&t.push({name:e,value:n}),t}He.prototype=Ne.prototype={constructor:He,on:function(t,e){var n,i=this._,r=function(t,e){return t.trim().split(/^|\s+/).map(function(t){var n="",i=t.indexOf(".");if(i>=0&&(n=t.slice(i+1),t=t.slice(0,i)),t&&!e.hasOwnProperty(t))throw new Error("unknown type: "+t);return{type:t,name:n}})}(t+"",i),a=-1,o=r.length;if(!(arguments.length<2)){if(null!=e&&"function"!=typeof e)throw new Error("invalid callback: "+e);for(;++a<o;)if(n=(t=r[a]).type)i[n]=Pe(i[n],t.name,e);else if(null==e)for(n in i)i[n]=Pe(i[n],t.name,null);return this}for(;++a<o;)if((n=(t=r[a]).type)&&(n=Ve(i[n],t.name)))return n},copy:function(){var t={},e=this._;for(var n in e)t[n]=e[n].slice();return new He(t)},call:function(t,e){if((n=arguments.length-2)>0)for(var n,i,r=new Array(n),a=0;a<n;++a)r[a]=arguments[a+2];if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(a=0,n=(i=this._[t]).length;a<n;++a)i[a].value.apply(e,r)},apply:function(t,e,n){if(!this._.hasOwnProperty(t))throw new Error("unknown type: "+t);for(var i=this._[t],r=0,a=i.length;r<a;++r)i[r].value.apply(e,n)}};var Fe=Ne;function Ie(){H.stopImmediatePropagation()}var Re=function(){H.preventDefault(),H.stopImmediatePropagation()},We=function(t){var e=t.document.documentElement,n=G(t).on("dragstart.drag",Re,!0);"onselectstart"in e?n.on("selectstart.drag",Re,!0):(e.__noselect=e.style.MozUserSelect,e.style.MozUserSelect="none")};var ze=function(t){return function(){return t}};function Be(t,e,n,i,r,a,o,s,l,u){this.target=t,this.type=e,this.subject=n,this.identifier=i,this.active=r,this.x=a,this.y=o,this.dx=s,this.dy=l,this._=u}function Ue(){return!H.button}function Ge(){return this.parentNode}function $e(t){return null==t?{x:H.x,y:H.y}:t}function qe(){return"ontouchstart"in this}Be.prototype.on=function(){var t=this._.on.apply(this._,arguments);return t===this._?this:t};var Je=function(){var t,e,n,i,r=Ue,a=Ge,o=$e,s=qe,l={},u=Fe("start","drag","end"),c=0,d=0;function h(t){t.on("mousedown.drag",f).filter(s).on("touchstart.drag",g).on("touchmove.drag",v).on("touchend.drag touchcancel.drag",_).style("touch-action","none").style("-webkit-tap-highlight-color","rgba(0,0,0,0)")}function f(){if(!i&&r.apply(this,arguments)){var o=y("mouse",a.apply(this,arguments),tt,this,arguments);o&&(G(H.view).on("mousemove.drag",m,!0).on("mouseup.drag",p,!0),We(H.view),Ie(),n=!1,t=H.clientX,e=H.clientY,o("start"))}}function m(){if(Re(),!n){var i=H.clientX-t,r=H.clientY-e;n=i*i+r*r>d}l.mouse("drag")}function p(){G(H.view).on("mousemove.drag mouseup.drag",null),function(t,e){var n=t.document.documentElement,i=G(t).on("dragstart.drag",null);e&&(i.on("click.drag",Re,!0),setTimeout(function(){i.on("click.drag",null)},0)),"onselectstart"in n?i.on("selectstart.drag",null):(n.style.MozUserSelect=n.__noselect,delete n.__noselect)}(H.view,n),Re(),l.mouse("end")}function g(){if(r.apply(this,arguments)){var t,e,n=H.changedTouches,i=a.apply(this,arguments),o=n.length;for(t=0;t<o;++t)(e=y(n[t].identifier,i,et,this,arguments))&&(Ie(),e("start"))}}function v(){var t,e,n=H.changedTouches,i=n.length;for(t=0;t<i;++t)(e=l[n[t].identifier])&&(Re(),e("drag"))}function _(){var t,e,n=H.changedTouches,r=n.length;for(i&&clearTimeout(i),i=setTimeout(function(){i=null},500),t=0;t<r;++t)(e=l[n[t].identifier])&&(Ie(),e("end"))}function y(t,e,n,i,r){var a,s,d,f=n(e,t),m=u.copy();if(R(new Be(h,"beforestart",a,t,c,f[0],f[1],0,0,m),function(){return null!=(H.subject=a=o.apply(i,r))&&(s=a.x-f[0]||0,d=a.y-f[1]||0,!0)}))return function o(u){var p,g=f;switch(u){case"start":l[t]=o,p=c++;break;case"end":delete l[t],--c;case"drag":f=n(e,t),p=c}R(new Be(h,u,a,t,p,f[0]+s,f[1]+d,f[0]-g[0],f[1]-g[1],m),m.apply,m,[u,i,r])}}return h.filter=function(t){return arguments.length?(r="function"==typeof t?t:ze(!!t),h):r},h.container=function(t){return arguments.length?(a="function"==typeof t?t:ze(t),h):a},h.subject=function(t){return arguments.length?(o="function"==typeof t?t:ze(t),h):o},h.touchable=function(t){return arguments.length?(s="function"==typeof t?t:ze(!!t),h):s},h.on=function(){var t=u.on.apply(u,arguments);return t===u?h:t},h.clickDistance=function(t){return arguments.length?(d=(t=+t)*t,h):Math.sqrt(d)},h},Xe=n(26);class Ze extends kt{constructor(t,e,n,r,a,o,s,l,u,c,d,h,f,m){super(t,s,r,a,c,m),this.modalService=n,this.graphStore=o,this.operationRecordService=l,this.securityChecker=u,this.popupViewService=d,this.hostContainerId=h,this.el=f,this.touchedScreenX=0,this.touchedScreenY=0,this.logger=e.get(i.b),this.viewService=e.get(Xe.a),this.initElement()}initElement(){const t=this.model.size.width,e=this.model.size.height;this.initGraph(t,e),this.rootElement.append("rect").attr("id","StateFrame").attr("width",t).attr("height",e).attr("fill","transparent");const n=this.$element.find("text").last(),i=this.model.label.font.fontStyle;n.css("font",i+",msyh"),this.switchToState(0),this.rootElement.on("mousedown",()=>{if(this.isInitialized)if(this.switchToState(1),H.preventDefault(),this.isEnable);else{const t=this.isGrantedPermission?this.localization.conditionIsNotMetTip:this.localization.permissiontip,e=this.modalService.show(Et.a,{initialState:{alermMessage:t},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),n=e.content.onClosed.subscribe(()=>{e.hide(),n.unsubscribe()})}}),this.rootElement.on("mouseup",()=>{if(this.switchToState(0),H.preventDefault(),this.isInitialized&&this.isEnable)if(this.model.useSecurity){const t=this.modalService.show(At.a,{backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.checkElementPassword()})}else this.checkElementPassword()}),this.model.operationType===ot.ViewOperationType.ControlView?(this.rootElement.style("cursor","move"),this.rootElement.call(Je().on("start",()=>{this.isEnable?H&&H.sourceEvent?"touchstart"===H.sourceEvent.type&&H.sourceEvent.touches.length&&(this.touchedScreenX=H.sourceEvent.touches[0].screenX,this.touchedScreenY=H.sourceEvent.touches[0].screenY):this.logger.error("[GUI]Failed to get DragEvent",H):this.rootElement.style("cursor","hand")}).on("drag",()=>{if(this.isEnable)if(H&&H.sourceEvent){if("mousemove"===H.sourceEvent.type)this.moveView(H.sourceEvent.movementX,H.sourceEvent.movementY);else if("touchmove"===H.sourceEvent.type&&H.sourceEvent.touches.length){const t=H.sourceEvent.touches[0].screenX-this.touchedScreenX,e=H.sourceEvent.touches[0].screenY-this.touchedScreenY;this.touchedScreenX=H.sourceEvent.touches[0].screenX,this.touchedScreenY=H.sourceEvent.touches[0].screenY,this.moveView(t,e)}}else this.logger.error("[GUI]Failed to get DragEvent",H);else this.rootElement.style("cursor","hand")}).on("end",()=>this.switchToState(0)))):this.rootElement.style("cursor","hand")}switchToState(t){this.graphStateElement&&this.graphStateElement.switchToState(t)}initGraph(t,e){!0===this.model.useGraph&&(this.graphStateElement=new $t(this.model.graphSetting,t,e,this.graphStore,this.logger),this.$element.prepend(this.graphStateElement.Element),this.graphStateElement.switchToState(0))}checkElementPassword(){if(this.model.enablePassword){const t=this.modalService.show(It.a,{initialState:{securityChecker:this.securityChecker},backdrop:"static",class:"gui-modal-dialog-position",animated:!1}),e=t.content.onClosed.subscribe(n=>{t.hide(),e.unsubscribe(),n&&this.executeViewOperation()})}else this.executeViewOperation()}executeViewOperation(){let t=this.model.version>=5?this.model.operationType:ot.ViewOperationType.ToggleView;switch(t=void 0===t?ot.ViewOperationType.ToggleView:t){case ot.ViewOperationType.ToggleView:this.toggleView();break;case ot.ViewOperationType.PopupView:this.popView();break;case ot.ViewOperationType.CloseView:this.closeView()}}toggleView(){const t=this.model.viewIndex;if(null!=t){const e=this.viewService.toggleViews.get(this.el);if(!e)return;e(t,this.hostContainerId,this.el).subscribe(()=>this.recordViewOperation(),e=>this.logger.error(`ToggleView(${t}) failed. `,e))}else this.logger.error("[GUI]Toggle View:invalid view index")}popView(){const t=this.model.viewIndex;null!=t?(this.popupViewService.popView(t,this.hostContainerId,this.el).subscribe(()=>this.recordViewOperation(),e=>this.logger.error(`ToggleView(${t}) failed. ${e}`)),$(`#${this.hostContainerId} video`).addClass("video-hidden").css("visibility","hidden")):this.logger.error("[GUI]Toggle View:invalid view index")}closeView(){this.popupViewService.closeView(),1===$(`#${this.hostContainerId} svg`).length&&$(`#${this.hostContainerId} .video-hidden`).removeClass("video-hidden").css("visibility","visible"),this.recordViewOperation()}moveView(t,e){isNaN(t)||isNaN(e)||(this.popupViewService.moveView(t,e),this.recordViewOperation())}recordViewOperation(){this.model.isRecordOperation&&this.operationRecordService.record({operationDescription:this.model.operationDescription})}}class Ke extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}getActualSize(){const t=Snap(this.$element.find("path")[0]).getBBox(!0);return new ot.Size(t.width,t.height)}getActualLocation(){return{x:this.model.location.x,y:this.model.location.y}}}class Qe extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}getActualSize(){const t=Snap(this.$element.find("path")[0]).getBBox(!0);return new ot.Size(t.width,t.height)}getActualLocation(){return{x:this.model.location.x,y:this.model.location.y}}}class tn extends xt{constructor(t,e,n,i,r){super(t,e,n,i,r)}getActualSize(){const t=Snap(this.$element.find("path")[0]).getBBox(!0);return new ot.Size(t.width,t.height)}getActualLocation(){return{x:this.model.location.x,y:this.model.location.y}}}class en extends xt{constructor(t,e,n,r,a,o,s){super(t,n,r,a,s),this.graphStore=o,this.logger=e.get(i.b),this.model.size&&this.initGraphAndText(),this.model&&this.model.linkAddress&&(this.rootElement.style("cursor","hand"),this.rootElement.on("mousedown",()=>{let t=this.model.linkAddress;/^http(s)?:\/\/.+$/.test(t)||(t="http://"+t),window.open(t,"_system")}))}initGraphAndText(){this.rootElement.selectAll("*").remove();const t=this.model.size,e=t.width,n=t.height;if(this.rootElement.append("rect").attr("id","StateFrame").attr("width",e).attr("height",n).attr("fill","transparent"),!0===this.model.useGraph){const t=new $t(this.model.graphSetting,e,n,this.graphStore,this.logger);t.switchToState(0),this.$element.prepend(t.Element)}const i={isUnderline:this.model.isUnderline,isBold:this.isBold(this.model.font),isItalic:this.isItalic(this.model.font),fontSize:this.model.fontSize,fontFamily:this.fontFamily(this.model.font),color:this.model.stroke,textAlign:this.model.textAlign},r=new Rt(this.model.text,i,e,n);this.$element.append(r.Element)}}var nn,rn=n(27);class an extends Mt{constructor(t,e,n,i,r,a,o,s,l){super(t,n,i,r,l),this.videoService=a,this.guiSize=o,this.svgRootClass=s,this.videoId="",this.isMobileMode=ee.a.Mobile===e.get(ee.b).displayMode,this.localization=e.get(at.b),this.init()}dispose(){this.videoPlayer&&"function"==typeof this.videoPlayer.stop&&this.videoPlayer.stop(),$("div."+this.svgRootClass+" video").each(function(){$(this).remove()})}hide(){super.hide(),this.isShow=!1,Object(nt.isNil)(this.videoId)||""===this.videoId||setTimeout(()=>{$("#"+this.videoId).hide()},0)}show(){super.show(),this.isShow=!0,setTimeout(()=>{$("#"+this.videoId).show()},0)}init(){this.rootElement.selectAll("*").remove(),this.model.videoTag?(this.videoId=rn.a.newGuid().toString("n"),this.rootElement.append("rect").attr("id","rect"+this.videoId).attr("fill","transparent").attr("width",this.model.size.width).attr("height",this.model.size.height),this.videoService.getVideoUrl(this.model.videoTag).then(t=>{this.initVideo(t.url,t.isMobileType,this.videoId)}).catch(()=>{throw new Error("Failure of the videoService")})):this.addVideoAddressToolTip(this.localization.unconfiguredVideoAddress)}initVideo(t,e,n){if(-1!==t.indexOf("http:")&&(t=t.replace("http:","https:")),!/https:.+.m3u8/.test(t)){let e=this.localization.invalidVideoAddress;return(Object(nt.isNil)(t)||""===t)&&(e=this.localization.unconfiguredVideoAddress),void this.addVideoAddressToolTip(e)}const i=this.$element.find("rect#rect"+n).first();if(!i.length)return;const r=i[0].getBoundingClientRect(),a=r.width,o=r.height,s=this.model.location.x/this.guiSize.width*$("."+this.svgRootClass).find(".svg-content").width(),l=this.model.location.y/this.guiSize.height*$("."+this.svgRootClass).find(".svg-content").height();let u=`<video scareX="${this.model.location.x/this.guiSize.width}"\n scareY="${this.model.location.y/this.guiSize.height}" id="${n}" src="${t}" style="\n position: absolute;top:${l}px;left:${s}px;width:${a}px;height:${o}px;object-fit:fill;z-index:0"\n playsInline webkit-playsinline `;const c=!!navigator.userAgent.match(/(Android)/i);this.isMobileMode?c?(e&&(u+=" controls "),u+=" autoplay muted></video>"):u+=" controls muted></video>":u+=" controls autoplay muted></video>",$("."+this.svgRootClass).find(".svg-content").append(u),!1===this.isShow&&$("#"+this.videoId).hide(),this.videoPlayer=new EZUIPlayer(n),c&&!e&&this.setAndroidVideo(n)}addVideoAddressToolTip(t){const e=this.model.size;this.rootElement.append("image").attr("width",e.width).attr("height",e.height).attr("xlink:href","assets/img/video.jpg").attr("preserveAspectRatio","none").attr("crossorigin","anonymous");const n=new Rt(t,{isUnderline:!1,isBold:!1,isItalic:!1,fontSize:"16px",fontFamily:"Microsoft YaHei",color:"#fff",textAlign:"center"},e.width,e.height);this.$element.append(n.Element)}setAndroidVideo(t){let e=!1;const n=$("#"+t);let i=n.height(),r=n.width(),a=n.css("top"),o=n.css("left");n.on("click",()=>{if(e)n.css("width",r+"px"),n.css("height",i+"px"),n.css("left",o),n.css("top",a),n.css("z-index","0"),e=!1;else{i=n.height(),r=n.width(),a=n.css("top"),o=n.css("left");const t=document.body.clientWidth,s=9*t/16;n.css("width",t+"px"),n.css("height",s+"px"),n.css("left","0px"),n.css("top","0px"),n.css("z-index","99"),e=!0}})}}class on extends Mt{constructor(t,e,n,r,a,o,s){super(t,n,r,a,s),this.weatherService=o,this.localization=e.get(at.b),this.logger=e.get(i.b),this.initWeatherInfo(),this.id=Math.abs(+this.model.id),this.timer=setInterval(()=>this.initWeatherInfo(),36e5)}dispose(){clearInterval(this.timer)}initWeatherInfo(){this.clear(),this.weatherService.getWeatherInfo().then(t=>{const e=t;if(!e.supported)return void this.handleNotSupported();if(e.gettingAddress)return void this.handleGettingAddress();if(!e.hasAddress)return void this.handleNoAddress();const n=e.location.length>4?`${e.location.substr(0,3)}...`:e.location;this.handleNormal(e.temperature,e.humidity,n,e.wind,e.weatherIcon,e.weatherPhenomenon)}).catch(()=>{this.handleNotSupported()})}clear(){this.rootElement.selectAll("*").remove()}handleNotSupported(){this.handleUnusualCommon(this.localization.weatherNotSupport)}handleGettingAddress(){this.handleUnusualCommon(this.localization.weatherNotAvailable)}handleNoAddress(){this.handleUnusualCommon(this.localization.weatherNotAddress)}handleUnusualCommon(t){const e=q("svg");this.buildBackgroudRect(e,"#081625","0.5"),this.buildUnusualTipIcon(e,t.length),this.buildUnusualTipText(e,t),this.appendWeatherSvg(e)}handleNormal(t,e,n,i,r,a){const o=this.model.stroke?this.model.stroke:"#FFFFFF",s=this.model.fill&&this.model.fill||"#86A7C5",l=q("svg");this.buildBackgroudRect(l,s),this.buildTemperatureGroup(l,t,e,o),this.buildWeather(l,r),this.buildLocGroup(l,n,o),this.buildWindGroup(l,i,o,n.length),this.buildWeatherText(l,a,o),this.appendWeatherSvg(l)}getRainPath(){return"M78,200c-43,0-78-33.3-78-74.3C0,74.9,55.5,20.4,72.5,4.9L77.8,0l5.4,4.8c0.7,0.6,72.5,64.6,72.8,120.9\nC156,166.7,121,200,78,200z M77.9,21.7C60.2,38.8,16,85.4,16,125.7c0,32.2,27.8,58.3,62,58.3s62-26.2,62-58.3\nC139.7,88.4,99.2,41.9,77.9,21.7z M87.7,163.9c-4.2,0-7.6-3.3-7.7-7.5c0-4.2,3.3-7.7,7.6-7.7c14.3-0.2,25.7-11.3,25.5-24.7\nc0-4.2,3.3-7.7,7.6-7.7c0,0,0.1,0,0.1,0c4.2,0,7.6,3.3,7.7,7.5C128.7,145.6,110.5,163.6,87.7,163.9\nC87.7,163.9,87.7,163.9,87.7,163.9z"}getLocPath(){return"M78,0C35,0,0,33.3,0,74.3c0,50.8,55.5,105.4,72.6,120.9l5.3,4.8l5.3-4.7c0.7-0.6,72.5-64.6,72.8-121v0\nC156,33.3,121,0,78,0z M78,178.6c-17.8-17.1-62.1-63.9-62.1-104.4C15.8,42,43.7,15.7,78,15.7c34.3,0,62.2,26.3,62.2,58.5\nC140,111.8,99.2,158.4,78,178.6z M78,40.4c-17.8,0-32.4,14.4-32.4,32.2s14.5,32.2,32.4,32.2s32.4-14.4,32.4-32.2S95.8,\n40.4,78,40.4z M78,89.1c-9.1,0-16.5-7.4-16.5-16.5S68.9,56.2,78,56.2s16.5,7.4,16.5,16.5S87.1,89.1,78,89.1z"}getWindPath(){return"M7.1,56.7h85.7c15.8,0,28.6-12.7,28.6-28.4S108.6,0,92.9,0C77.1,0,64.3,12.7,64.3,28.4h14.3\nc0-7.8,6.4-14.2,14.3-14.2c7.9,0,14.3,6.3,14.3,14.2c0,7.8-6.4,14.2-14.3,14.2H7.1c-3.9,0-7.1,3.2-7.1,7.1\nC0,53.6,3.2,56.7,7.1,56.7L7.1,56.7z\nM164.3,99.3H7.1c-3.9,0-7.1,3.2-7.1,7.1c0,3.9,3.2,7.1,7.1,7.1h157.1c7.9,0,14.3,6.4,14.3,14.2\nc0,7.8-6.4,14.2-14.3,14.2c-7.9,0-14.3-6.3-14.3-14.2h-14.3c0,15.7,12.8,28.4,28.6,28.4c15.8,0,28.6-12.7,28.6-28.4\nS180.1,99.3,164.3,99.3L164.3,99.3z\nM7.1,85.1h157.1c19.7,0,35.7-15.9,35.7-35.5c0-19.6-16-35.5-35.7-35.5c-19.7,0-35.7,15.9-35.7,35.5\nc0,2.4,0.3,4.8,0.8,7.1h14.8c-0.8-2.2-1.3-4.6-1.3-7.1c0-11.7,9.6-21.3,21.4-21.3c11.8,0,21.4,9.5,21.4,21.3\nc0,11.1-8.6,20.2-19.6,21.1c-0.3,0-0.6,0.2-0.9,0.2H7.1C3.2,70.9,0,74.1,0,78C0,81.9,3.2,85.1,7.1,85.1L7.1,85.1z"}getUnusualIconPath(){return'<g>\n<ellipse class="st2" cx="74.6" cy="72.3" rx="36.4" ry="36.3" fill="#EFCA30"/>\n<path class="st2" fill="#EFCA30" d="M74.5,24.5C74.6,24.5,74.6,24.5,74.5,24.5c3.7,0,5.7-2,5.7-5.5V5.5C80.2,2,78,0,74.6,0C71,0,69,2.1,69,5.5V19\nC69,22.3,71,24.4,74.5,24.5L74.5,24.5z"/>\n<path class="st2" fill="#EFCA30" d="M37.2,28.5l-6.9-6.7c-1.3-1.3-2.7-1.9-4.1-1.9s-2.8,0.6-4.1,1.9c-1.3,1.3-1.9,2.6-1.9,4s0.6,2.7,1.9,4\nl6.4,6.1c0.5,0.5,1.2,1.1,1.9,1.4c1.2,0.5,2,0.7,2.8,0.7c0.6,0,1.3-0.2,2-0.4c1.4-0.5,2.7-1.5,3.3-2.8c0.3-0.7,0.5-1.5,0.5-2.2\nC39.1,31.2,38.5,29.8,37.2,28.5L37.2,28.5z"/>\n<path class="st2" fill="#EFCA30" d="M112.5,36.9c1.6,0.7,2.7,1.2,3.7,1.2s2-0.4,3.6-1.2c0.2-0.1,0.4-0.2,0.5-0.4l6.9-6.7c1.3-1.3,1.9-2.6,1.9-4\ns-0.6-2.7-1.9-4c-1.3-1.3-2.7-1.9-4.1-1.9s-2.8,0.6-4.1,1.9l-6.9,6.7c-1.3,1.3-1.9,2.6-1.9,4c0,1.4,0.6,2.7,1.9,4\nC112.1,36.6,112.3,36.8,112.5,36.9L112.5,36.9z"/>\n<path class="st2" fill="#EFCA30" d="M25.1,73.2C25.1,73.1,25.1,73.1,25.1,73.2c0-3.6-2-5.6-5.6-5.6H5.6C2,67.6,0,69.7,0,73.1\nc0,3.4,2.2,5.5,5.6,5.5h13.8C22.7,78.6,24.9,76.6,25.1,73.2L25.1,73.2z"/>\n<path class="st2" fill="#EFCA30" d="M33.2,107.6c-1.4,0-2.8,0.6-4.1,1.9l-6.9,6.7c-1.3,1.3-1.9,2.6-1.9,4s0.6,2.7,1.9,4c0.2,0.2,0.3,0.3,0.5,0.4\nc1.6,0.7,2.7,1.2,3.7,1.2c0.5,0,1.5-0.1,3.6-1.2c0.2-0.1,0.4-0.2,0.5-0.4l6.9-6.7c2.6-2.5,2.6-5.6,0-8.1\nC36,108.3,34.6,107.6,33.2,107.6L33.2,107.6z"/>\n</g>\n<path class="st3" fill="#FFFFFF" d="M68.8,160h99.3c17.9-2,31.9-17.1,31.9-35.5c0-18.3-13.8-33.3-31.5-35.4c-8-17-25.2-28.9-45.3-28.9\nc-22.4,0-41.4,14.7-47.7,35c-1.1-0.1-2.2-0.2-3.4-0.2c-18,0-32.6,14.6-32.6,32.6C39.5,144.5,52.3,158.3,68.8,160z"/>'}buildBackgroudRect(t,e,n="1"){t.append("rect").attr("x","0").attr("y","0").attr("rx","2").attr("width","268").attr("height","92").attr("fill",e).attr("fill-opacity",n)}buildTemperatureGroup(t,e,n,i){const r=t.append("text").attr("x","14").attr("y","57").attr("font-family","sans-serif").attr("font-weight","lighter").attr("font-size","50").attr("fill",i).text(e);r.append("tspan").attr("dy","-27").attr("font-size","20").attr("fill",i).text("°C"),r.append("tspan").attr("dx","-8").attr("dy","25").attr("font-size","22").attr("fill",i).text("/"),t.append("svg").attr("x",`${16+50*e.length*.75}`).attr("y","46").attr("width","11").attr("height","11").attr("viewBox","0 0 156 200").append("path").attr("fill",i).attr("d",this.getRainPath()),t.append("text").attr("x",`${30+50*e.length*.75}`).attr("y","57").attr("font-size","12").attr("fill",i).text(n)}buildWeather(t,e){t.append("image").attr("x","151").attr("y","2").attr("width","110").attr("height","66").attr("xlink:href",`assets/img/weather/${e}.png`).attr("preserveAspectRatio","none").attr("crossorigin","anonymous")}buildLocGroup(t,e,n){t.append("svg").attr("x","14").attr("y","70").attr("width","11").attr("height","11").attr("viewBox","0 0 156 200").append("path").attr("fill",n).attr("d",this.getLocPath),t.append("text").attr("x","28").attr("y","80").attr("font-size","12").attr("fill",n).text(e)}buildWindGroup(t,e,n,i){t.append("svg").attr("x",`${28+12*i+10}`).attr("y","69").attr("width","13").attr("height","13").attr("viewBox","0 0 200 156").append("path").attr("fill",n).attr("d",this.getWindPath),t.append("text").attr("x",`${28+12*i+10+14+2}`).attr("y","80").attr("font-size","12").attr("fill",n).text(e)}buildWeatherText(t,e,n){t.append("text").attr("x","201").attr("y","80").attr("font-size",12).attr("font-anchor","middle").attr("fill",n).text(e)}buildUnusualTipIcon(t,e){t.append("svg").attr("x",e>9?(268-7*e-8-42)/2:"44").attr("y","23").attr("width","42").attr("height","34").attr("viewBox","0 0 200 160").html(this.getUnusualIconPath)}buildUnusualTipText(t,e){const n=e.length;t.append("text").attr("x",n>9?(268-7*n-8-42)/2+42+8:"94").attr("y","46").attr("font-size",14).attr("font-anchor","middle").attr("fill","#FFFFFF").attr("dominant-baseline","central").text(e)}appendWeatherSvg(t){this.rootElement.append(()=>t.node())}}class sn extends Mt{constructor(t,e,n,i,r,a,o){super(t,n,i,r,o),this.weatherService=a,this.localization=e.get(at.b),this.initAirQualityInfo(),this.timer=setInterval(()=>this.initAirQualityInfo(),36e5)}dispose(){clearInterval(this.timer)}initAirQualityInfo(){this.clear(),this.weatherService.getAirQualityInfo().then(t=>{const e=t;e.supported?e.gettingAddress?this.handleGettingAddress():e.hasAddress?this.handleData(e.airQuality):this.handleNoAddress():this.handleNotSupported()}).catch(()=>{this.handleNotSupported()})}handleData(t){const e=this.model.stroke?this.model.stroke:"#FFFFFF",n=this.model.fill&&this.model.fill||"#86A7C5",i=q("svg");this.buildBackgroudRect(i,n),this.buildLocGroup(i,t.city,e),this.buildAirQualityText(i,130,55,t.aqi,e,53),this.buildAirQualityText(i,220,28,"空气质量",e),this.buildRectBackgroundForAqi(i,t.level),this.buildAirQualityText(i,220,49,t.category,e),this.buildAirQualityText(i,30,75,"PM2.5",e,12,.8),this.buildAirQualityText(i,30,95,t.pm25,e,15),this.buildAirQualityText(i,80,75,"PM10",e,12,.8),this.buildAirQualityText(i,80,95,t.pm10,e,15),this.buildAirQualityText(i,130,75,"NO2",e,12,.8),this.buildAirQualityText(i,130,95,t.no2,e,15),this.buildAirQualityText(i,175,75,"SO2",e,12,.8),this.buildAirQualityText(i,175,95,t.so2,e,15),this.buildAirQualityText(i,215,75,"CO",e,12,.8),this.buildAirQualityText(i,215,95,t.co,e,15),this.buildAirQualityText(i,250,75,"O3",e,12,.8),this.buildAirQualityText(i,250,95,t.o3,e,15),this.appendAirQualitySvg(i)}handleNotSupported(){this.handleUnusualCommon(this.localization.airQualityNotSupport)}handleGettingAddress(){this.handleUnusualCommon(this.localization.airQualityNotAvailable)}handleNoAddress(){this.handleUnusualCommon(this.localization.airQualityNotAddress)}handleUnusualCommon(t){const e=q("svg");this.buildBackgroudRect(e,"#081625","0.5"),this.buildUnusualTipIcon(e,t.length),this.buildUnusualTipText(e,t),this.appendAirQualitySvg(e)}buildBackgroudRect(t,e,n="1"){t.append("rect").attr("x","0").attr("y","0").attr("rx","2").attr("width","280").attr("height","105").attr("fill",e).attr("fill-opacity",n)}buildRectBackgroundForAqi(t,e,n="1"){let i;e>=0&&e<=50?i="#50DF56":e>=51&&e<=100?i="#FBCD1C":e>=101&&e<=150?i="#FF9900":e>=151&&e<=200?i="#FF3232":e>=201&&e<=300?i="#F403B5":e>300&&(i="#A10E0E"),t.append("rect").attr("x","195").attr("y","35").attr("rx","5").attr("width","50").attr("height","20").attr("fill",i).attr("fill-opacity",n)}buildUnusualTipIcon(t,e){t.append("svg").attr("x",e>9?(268-7*e-8-42)/2:"44").attr("y","23").attr("width","42").attr("height","34").attr("viewBox","0 0 200 160").html(this.getUnusualIconPath)}getUnusualIconPath(){return'<g>\n <ellipse class="st2" cx="74.6" cy="72.3" rx="36.4" ry="36.3" fill="#EFCA30"/>\n <path class="st2" fill="#EFCA30" d="M74.5,24.5C74.6,24.5,74.6,24.5,74.5,24.5c3.7,0,5.7-2,5.7-5.5V5.5C80.2,2,78,0,74.6,0C71,0,69,2.1,69,5.5V19\n C69,22.3,71,24.4,74.5,24.5L74.5,24.5z"/>\n <path class="st2" fill="#EFCA30" d="M37.2,28.5l-6.9-6.7c-1.3-1.3-2.7-1.9-4.1-1.9s-2.8,0.6-4.1,1.9c-1.3,1.3-1.9,2.6-1.9,4s0.6,2.7,1.9,4\n l6.4,6.1c0.5,0.5,1.2,1.1,1.9,1.4c1.2,0.5,2,0.7,2.8,0.7c0.6,0,1.3-0.2,2-0.4c1.4-0.5,2.7-1.5,3.3-2.8c0.3-0.7,0.5-1.5,0.5-2.2\n C39.1,31.2,38.5,29.8,37.2,28.5L37.2,28.5z"/>\n <path class="st2" fill="#EFCA30" d="M112.5,36.9c1.6,0.7,2.7,1.2,3.7,1.2s2-0.4,3.6-1.2c0.2-0.1,0.4-0.2,0.5-0.4l6.9-6.7c1.3-1.3,1.9-2.6,1.9-4\n s-0.6-2.7-1.9-4c-1.3-1.3-2.7-1.9-4.1-1.9s-2.8,0.6-4.1,1.9l-6.9,6.7c-1.3,1.3-1.9,2.6-1.9,4c0,1.4,0.6,2.7,1.9,4\n C112.1,36.6,112.3,36.8,112.5,36.9L112.5,36.9z"/>\n <path class="st2" fill="#EFCA30" d="M25.1,73.2C25.1,73.1,25.1,73.1,25.1,73.2c0-3.6-2-5.6-5.6-5.6H5.6C2,67.6,0,69.7,0,73.1\n c0,3.4,2.2,5.5,5.6,5.5h13.8C22.7,78.6,24.9,76.6,25.1,73.2L25.1,73.2z"/>\n <path class="st2" fill="#EFCA30" d="M33.2,107.6c-1.4,0-2.8,0.6-4.1,1.9l-6.9,6.7c-1.3,1.3-1.9,2.6-1.9,4s0.6,2.7,1.9,4c0.2,0.2,0.3,0.3,0.5,0.4\n c1.6,0.7,2.7,1.2,3.7,1.2c0.5,0,1.5-0.1,3.6-1.2c0.2-0.1,0.4-0.2,0.5-0.4l6.9-6.7c2.6-2.5,2.6-5.6,0-8.1\n C36,108.3,34.6,107.6,33.2,107.6L33.2,107.6z"/>\n </g>\n <path class="st3" fill="#FFFFFF" d="M68.8,160h99.3c17.9-2,31.9-17.1,31.9-35.5c0-18.3-13.8-33.3-31.5-35.4c-8-17-25.2-28.9-45.3-28.9\n c-22.4,0-41.4,14.7-47.7,35c-1.1-0.1-2.2-0.2-3.4-0.2c-18,0-32.6,14.6-32.6,32.6C39.5,144.5,52.3,158.3,68.8,160z"/>'}buildUnusualTipText(t,e){const n=e.length;t.append("text").attr("x",n>9?(268-7*n-8-42)/2+42+8:"94").attr("y","46").attr("font-size",14).attr("font-anchor","middle").attr("fill","#FFFFFF").attr("dominant-baseline","central").text(e)}buildAirQualityText(t,e,n,i,r,a=12,o=1){t.append("text").attr("x",e).attr("y",n).attr("font-size",a).attr("text-anchor","middle").attr("fill",r).attr("opacity",o).text(i)}buildLocGroup(t,e,n){t.append("svg").attr("x","14").attr("y","10").attr("width","11").attr("height","15").attr("viewBox","0 0 156 200").append("path").attr("fill",n).attr("d",this.getLocPath),t.append("text").attr("x","30").attr("y","22").attr("font-size","12").attr("fill",n).text(e)}getLocPath(){return"M78,0C35,0,0,33.3,0,74.3c0,50.8,55.5,105.4,72.6,120.9l5.3,4.8l5.3-4.7c0.7-0.6,72.5-64.6,72.8-121v0\nC156,33.3,121,0,78,0z M78,178.6c-17.8-17.1-62.1-63.9-62.1-104.4C15.8,42,43.7,15.7,78,15.7c34.3,0,62.2,26.3,62.2,58.5\nC140,111.8,99.2,158.4,78,178.6z M78,40.4c-17.8,0-32.4,14.4-32.4,32.2s14.5,32.2,32.4,32.2s32.4-14.4,32.4-32.2S95.8,\n40.4,78,40.4z M78,89.1c-9.1,0-16.5-7.4-16.5-16.5S68.9,56.2,78,56.2s16.5,7.4,16.5,16.5S87.1,89.1,78,89.1z"}appendAirQualitySvg(t){this.rootElement.append(()=>t.node())}clear(){this.rootElement.selectAll("*").remove()}}!function(t){t[t.Normal=0]="Normal",t[t.Loading=1]="Loading"}(nn||(nn={}));class ln extends Mt{constructor(t,e,n,r,a,o,s){var l;super(t,n,r,a,s),this.alarmsStore=o,this.elementStatus=nn.Loading,this.displayOption={dataLimit:500,dataZoomHeight:32,marginLeft:1,marginRight:20,mobileMinWidth:450,operationAreaHeight:32,operationAreaMarginTop:10,operationSelectFontSize:"16px",operationButtonWidth:24,operationButtonHeight:24,operationButtonMargin:4},this.alarmNames=[],this.alarmList=[],this.currentAlarmList=[],this.page=0,this.totalCount=0,this.pageSize=5,this.rootElement.selectAll("*").remove(),this.setStatusAsLoading(),this.logger=e.get(i.b),this.localization=e.get(at.b),this.variableCommunicator=r,this.timePeriods=this.getValidTimePeriods(),this.pageSize=this.model.generalSetting.pageSize,localStorage.setItem("simulate-time",Gt().valueOf()+""),this.model.filterSetting?(this.alarmNames=this.model.filterSetting.detailsData.map(t=>t.name),this.currentTimePeriod=null===(l=this.model.filterSetting)||void 0===l?void 0:l.displayPeriod,this.updateQueryTimeRange(),this.model.filterSetting.alarmType?this.refreshIntervalId=setInterval(()=>{this.loadFirstPage(),this.logger.debug(`[GUI]Refresh Alarm Table:${Zt.time.format("%x %X")(new Date)}`)},60*this.model.filterSetting.refreshCycle*1e3):r.subscribeUserDeviceAlarms(s).subscribe(t=>{t.forEach(t=>{-1===this.alarmNames.indexOf(t.name)||this.getAlarmData()})}),this.getAlarmData()):(this.totalCount=0,this.alarmList=[],this.renderElement())}dispose(){clearInterval(this.refreshIntervalId),this.element&&this.element.tooltip.hidden(!0),this.logger.debug(`[GUI]Dispose Alarm Table Refresh Interval:${Zt.time.format("%x %X")(new Date)}`)}getValidTimePeriods(){const t=new Array;return t.push({key:6,name:this.localization.lastThirtyMinutes}),t.push({key:1,name:this.localization.lastOneHour}),t.push({key:7,name:this.localization.lastEightHour}),t.push({key:2,name:this.localization.lastTwentyFourHours}),t.push({key:3,name:this.localization.lastSevenDays}),t.push({key:4,name:this.localization.lastThirtyDays}),t.push({key:5,name:this.localization.lastOneYear}),t}getAlarmData(){this.rootElement.selectAll("*").remove(),this.setStatusAsLoading(),clearTimeout(this.getAlarmDataId),this.getAlarmDataId=setTimeout(()=>{if(this.model.filterSetting.alarmType){this.updateQueryTimeRange();const t=new Ct.c(this.alarmNames,this.startTime,this.endTime,this.pageSize,this.page*this.pageSize);this.alarmsStore.getHistoryAlarms(t).subscribe(t=>{t.error||(this.totalCount=t.totalCount,this.alarmList=t.items.map(t=>[t.name,t.message,t.alarmLevel,t.triggeredTime.format("YYYY-MM-DD HH:mm:ss")]),this.renderElement())})}else{const t=new Ct.c(this.alarmNames,void 0,void 0,this.pageSize,this.page*this.pageSize);this.alarmsStore.getCurrentAlarms(t).subscribe(t=>{if(!t.error){if(this.totalCount=t.totalCount,this.currentAlarmList=t.items,!t.items.length&&t.totalCount)return this.page=0,void this.getAlarmData();this.alarmList=this.currentAlarmList.map(t=>[t.name,t.message,t.alarmLevel,t.triggeredTime.format("YYYY-MM-DD HH:mm:ss")]),this.renderElement()}})}},500)}renderElement(){const t=this.model.size.height;this.element=document.createElementNS("http://www.w3.org/2000/svg","foreignObject"),this.element.setAttribute("width",this.model.size.width.toString()),this.element.setAttribute("height",t.toString()),this.$element.append(this.element);const e=document.createElement("table");e.style.cssText=`border: 2px solid ${this.model.generalSetting.stroke};\n height: ${t-39}`;let n=document.createElement("tr"),i="";this.model.generalSetting.headerFont.isItalic&&(i+="italic "),this.model.generalSetting.headerFont.isBold&&(i+="bold "),i+=this.model.generalSetting.headerFont.fontSize+" "+this.model.generalSetting.headerFont.fontFamily,n.style.cssText=`height: ${this.model.heights[0]}px;\n background: ${this.model.generalSetting.headerFillColor};\n color: ${this.model.generalSetting.headerFont.color};\n font: ${i};\n text-align: ${this.model.generalSetting.headerFont.textAlign};\n ${this.model.generalSetting.headerFont.isUnderline?"text-decoration: underline":""};\n vertical-align: middle;`;for(let t=0;t<4;t++){const e=document.createElement("th");e.innerHTML=this.model.columLabels[t],e.style.cssText=`width: ${this.model.widths[t]/this.model.size.width*100}%;\n border-style: solid;\n border-color: ${this.model.generalSetting.splitLine};\n border-left-width: ${!t||this.model.generalSetting.isHiddenColumnSplitLine?0:1}px;`,n.appendChild(e)}e.appendChild(n);const r=["#3695FF","#FFE900","#FFA800","#E84F4F"];for(let t=0;t<this.pageSize;t++){(n=document.createElement("tr")).style.cssText=`height: ${this.model.heights[t+1]}px;\n background: ${this.model.generalSetting.tableFillColor};\n font: ${this.model.generalSetting.fontStyle};\n color: ${this.model.generalSetting.fontColor};\n text-align: ${this.model.generalSetting.textAlign};\n vertical-align: middle;`;for(let e=0;e<4;e++){const i=document.createElement("td");if(i.style.cssText=`border-style: solid;\n border-color: ${this.model.generalSetting.splitLine};\n border-top-width: ${this.model.generalSetting.isHiddenColumnSplitLine?0:1}px;\n border-left-width: ${!e||this.model.generalSetting.isHiddenColumnSplitLine?0:1}px;`,this.alarmList[t])if(2!==e)i.innerHTML=this.alarmList[t][e],i.style.cssText+=`${this.model.generalSetting.isUnderline?"text-decoration: underline":""};`;else{const n=document.createElement("div");let a=parseInt(this.model.generalSetting.fontSize)+15;a>this.model.heights[t+1]&&(a=this.model.heights[t+1]);let o="0 15px";"left"===this.model.generalSetting.textAlign?o="0 30px 0 0":"right"===this.model.generalSetting.textAlign&&(o="0 0 0 30px"),n.style.cssText=`margin: ${o};\n border-radius: 5px;\n background: ${r[this.alarmList[t][e]]};\n color: #ffffff;\n width: ${this.model.widths[e]-30}px;\n height: ${a}px;\n max-height: ${this.model.heights[t+1]}px;\n display: flex;\n justify-content: center;\n align-items: center;\n ${this.model.generalSetting.isUnderline?"text-decoration: underline":""};`,n.innerHTML=this.model.levelText[this.alarmList[t][e]],i.appendChild(n)}else if(2===e){const t=document.createElement("div");let n="0 15px";"left"===this.model.generalSetting.textAlign?n="0 30px 0 0":"right"===this.model.generalSetting.textAlign&&(n="0 0 0 30px"),t.style.cssText=`margin: ${n};\n width: ${this.model.widths[e]-30}px;`,i.appendChild(t)}n.appendChild(i)}e.appendChild(n)}this.element.appendChild(e),this.renderOperationArea(this.model.size.width,t-39)}renderOperationArea(t,e){var n;const i=this.rootElement.append("g").attr("transform",`translate(0,${e+this.displayOption.operationAreaMarginTop})`).append("foreignObject").attr("width",t).attr("height",this.displayOption.operationAreaHeight).attr("fill","none").append("xhtml:div").style("height",this.displayOption.operationAreaHeight-4+"px").style("overflow","hidden").style("margin-top","4px");if(null===(n=this.model.filterSetting)||void 0===n?void 0:n.alarmType){i.append("select").style("margin-left",this.displayOption.marginLeft+"px").style("font-size",this.displayOption.operationSelectFontSize).on("change",()=>{const t=this.rootElement.select("select").property("value");this.updateTimeRange(t),this.getAlarmData()}).selectAll("option").data(this.timePeriods).enter().append("option").text(t=>t.name).attr("value",t=>t.key).property("selected",t=>t.key===Number(this.currentTimePeriod))}const r=this.displayOption.operationButtonWidth+"px",a=this.displayOption.operationButtonHeight+"px";i.append("button").style("width",r).style("height",a).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/last_page.svg)").on("click",()=>{this.loadLastPage()}),i.append("button").style("width",r).style("height",a).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/next_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadNextPage()}),i.append("button").style("width",r).style("height",a).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/previous_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadPreviousPage()}),i.append("button").style("width",r).style("height",a).style("border","none").style("float","right").style("background","white").style("background-image","url(assets/img/first_page.svg)").style("margin",`0 ${this.displayOption.operationButtonMargin}px 0 0`).on("click",()=>{this.loadFirstPage()}),this.setStatusAsNormal()}updateTimeRange(t){this.currentTimePeriod=+t,this.updateQueryTimeRange()}updateQueryTimeRange(){switch(this.endTime=Gt(),this.currentTimePeriod){case 1:this.startTime=Gt().subtract(1,"hours");break;case 3:this.startTime=Gt().subtract(7,"days");break;case 4:this.startTime=Gt().subtract(30,"days");break;case 5:this.startTime=Gt().subtract(1,"years");break;case 6:this.startTime=Gt().subtract(30,"minutes");break;case 7:this.startTime=Gt().subtract(8,"hours");break;default:this.startTime=Gt().subtract(1,"days")}}loadFirstPage(){this.page>0&&(this.page=0,this.getAlarmData())}loadNextPage(){let t=Math.ceil(this.totalCount/this.pageSize);t&&t--,this.page<t&&(this.page++,this.getAlarmData())}loadPreviousPage(){this.page>0&&(this.page--,this.getAlarmData())}loadLastPage(){let t=Math.ceil(this.totalCount/this.pageSize);t&&t--,this.page!==t&&(this.page=t,this.getAlarmData())}setStatusAsNormal(){this.elementStatus=nn.Normal,this.clearStatus()}setStatusAsLoading(){this.elementStatus=nn.Loading,this.renderStatus("assets/img/loading.svg","#226abc")}renderStatus(t,e){if(this.elementStatus===nn.Normal)return void this.clearStatus();this.rootElement.append("rect").attr("id","StateFrame").attr("fill","transparent").attr("width",this.model.size.width).attr("height",this.model.size.height);const n=this.$element[0].ownerDocument,i=this.$element.find("rect#StateFrame").first();if(!i.length)return;this.$element.find("image#StateImage").remove();const r=n.createElementNS("http://www.w3.org/2000/svg","image");if(r){let a=Number(i[0].getAttribute("width"))-20;const o=i[0].getAttribute("x");null!==o&&(a+=Number(o)),i[0].setAttribute("stroke",e),i[0].setAttribute("stroke-opacity","0.5"),r.href.baseVal=t,r.setAttributeNS(null,"id","StateImage"),r.setAttributeNS(null,"x",a.toString()),r.setAttributeNS(null,"y","0"),r.setAttributeNS(null,"height","20px"),r.setAttributeNS(null,"width","20px");const s=n.createElementNS("http://www.w3.org/2000/svg","title");r.appendChild(s),this.$element.append(r)}}clearStatus(){const t=this.$element.find("rect#StateFrame").first();t.length&&(t[0].getAttribute("stroke")&&t[0].removeAttribute("stroke"),this.$element.find("image#StateImage").remove())}}class un{constructor(t,e,n,r,a,o){this.injector=t,this.bsModalService=e,this.context=n,this.variableCommunicator=r,this.popupViewService=a,this.signalRAppId=o,this.elements=new Array,this.logger=t.get(i.b)}get rootElement(){return this.root[0]}load(t,e=!1,n){if(this.hostContainerId=n.hostContainerId,this.isLoaded)throw new Error("The Main Element already loaded.");this.root=$(t),this.root.attr("style",`margin: 0 auto;display: block;${e?"overflow: visible;":""}`),this.rawWidth=Number.parseInt(this.root.attr("width")),this.rawHeight=Number.parseInt(this.root.attr("height"));const i=this.root.find("[data-model]");Object(nt.each)(i,t=>{switch($(t).data("model").category){case lt.d.components.numericalDisplayKey:const e=new le(t,this.injector,this.bsModalService,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.graphStore,this.context.operationRecordService,this.context.releasedVariableService,this.context.securityChecker,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId);this.elements.push(e);break;case lt.d.components.imageKey:this.elements.push(new Me(t,this.injector,this.context.configStore.imageStore,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.graphStore,this.signalRAppId));break;case lt.d.components.meterKey:this.elements.push(new ie(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.pipeKey:this.elements.push(new he(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.switchIndicatorLightKey:this.elements.push(new Ce(t,this.injector,this.bsModalService,this.variableCommunicator,this.context.configStore.graphStore,this.context.permissionChecker,this.context.operationRecordService,this.context.securityChecker,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.barGraphKey:this.elements.push(new Dt(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.toggleViewKey:case lt.d.components.viewOperationElement:this.elements.push(new Ze(t,this.injector,this.bsModalService,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.graphStore,this.context.permissionChecker,this.context.operationRecordService,this.context.securityChecker,this.injector.get(at.b),this.popupViewService,n.hostContainerId,n.el,this.signalRAppId));break;case lt.d.components.characterKey:this.elements.push(new Wt(t,this.injector,this.bsModalService,this.variableCommunicator,this.context.configStore.graphStore,this.context.permissionChecker,this.context.operationRecordService,this.context.securityChecker,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.textKey:this.elements.push(new xe(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.graphStore,this.signalRAppId));break;case lt.d.components.hyperlinkKey:this.elements.push(new en(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.graphStore,this.signalRAppId));break;case lt.d.components.straightLineKey:this.elements.push(new Ke(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.polyLineKey:this.elements.push(new Qe(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.ellipseKey:this.elements.push(new Ee(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.rectangleKey:this.elements.push(new Ae(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.sectorkey:this.elements.push(new Oe(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.datetimeDisplayKey:this.elements.push(new qt(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.graphStore,this.signalRAppId));break;case lt.d.components.historicalCurveKey:this.elements.push(new ne(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.historyDataStore,this.signalRAppId));break;case lt.d.components.ringGraphKey:this.elements.push(new be(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.injector.get(at.b),this.signalRAppId));break;case lt.d.components.polygonKey:this.elements.push(new tn(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.videokey:this.elements.push(new an(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.videoService,new ot.Size(this.rawWidth,this.rawHeight),n.svgRootClass,this.signalRAppId));break;case lt.d.components.tableKey:this.elements.push(new tn(t,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.signalRAppId));break;case lt.d.components.weatherKey:this.elements.push(new on(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.weatherService,this.signalRAppId));break;case lt.d.components.airQualityKey:this.elements.push(new sn(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.weatherService,this.signalRAppId));break;case lt.d.components.alarmKey:this.elements.push(new ln(t,this.injector,this.context.permissionChecker,this.variableCommunicator,this.context.configStore.variableStore,this.context.configStore.alarmsStore,this.signalRAppId))}}),this.initBackground(),this.isLoaded=!0,this.logger.debug("[GUI] Main element loaded.")}uniformStretch(t,e){if(!t.isReal())throw new Error("size is not real.");this.checkIsLoaded();const n=this.rawHeight/this.rawWidth;t.height/t.width>n?t.height=t.width*n:t.width=t.height/n;const i=this.oldSize?this.oldSize:t;if(setTimeout(()=>{this.changeVideoStyle(t,i,e)},200),this.root.attr("width",t.width),this.root.attr("height",t.height),!this.root.attr("viewBox")){const e=t.width/this.rawWidth;this.root.find("g:first").attr("transform",`scale(${e})`)}this.oldSize=t}changeVideoStyle(t,e,n){const i=this;$("div."+n+" video").each(function(){const n=t.width/e.width*$(this).width();if(n>$("body").width()||n.toFixed(0)===$("body").width().toFixed(0))return;$(this).css("width",n+"px"),$(this).css("height",t.height/e.height*$(this).height()+"px");let r=t.width*Number($(this).attr("scareX")),a=t.height*Number($(this).attr("scareY"));if(i.hostContainerId){const e=$("#"+i.hostContainerId);if(e.length){const n=e[0].clientWidth,i=e[0].clientHeight;r+=(n-t.width)/2,a+=(i-t.height)/2}}$(this).css("left",r+"px"),$(this).css("top",a+"px")})}horizontalStretch(t){if(!t.isReal())throw new Error("size is not real.");if(this.checkIsLoaded(),t.height=t.width/this.rawWidth*this.rawHeight,this.root.attr("width",t.width),this.root.attr("height",t.height),!this.root.attr("viewBox")){const e=t.width/this.rawWidth;this.root.find("g:first").attr("transform",`scale(${e})`)}}initElementState(){Object(nt.forEach)(this.elements,t=>{t instanceof Lt?t.init(t.readVariableName||t.maxVariableName||t.minVariableName):t instanceof ne&&t.initElementStatus()}),this.logger.debug("[GUI] Main element enabled.")}getVariableNames(){const t=new Array;return Object(nt.forEach)(this.elements,e=>{var n,i;if(e instanceof Lt){const r=null===(n=e)||void 0===n?void 0:n.maxVariableName,a=e.maxValueType,o=null===(i=e)||void 0===i?void 0:i.minVariableName,s=e.minValueType,l=e.readVariableName;a&&r&&!t.find(t=>Object(nt.isEqual)(r,t))&&t.push(r),s&&o&&!t.find(t=>Object(nt.isEqual)(o,t))&&t.push(o),l&&!t.find(t=>Object(nt.isEqual)(l,t))&&t.push(e.readVariableName)}}),t}reportVariableStates(t){this.checkIsLoaded(),Object(nt.each)(t,t=>{Object(nt.each)(this.elements,e=>{if(e instanceof Lt){const n=e.readVariableName;n&&n===t.variableName&&e.reportStateChanged(t)}})})}reportVariableValues(t){this.checkIsLoaded(),Object(nt.each)(t,t=>{Object(nt.each)(this.elements,e=>{e instanceof Lt&&(e.readVariableName!==t.variableName&&e.minVariableName!==t.variableName&&e.maxVariableName!==t.variableName||e.reportValueChanged(t))})})}dispose(){Object(nt.each)(this.elements,t=>{(t instanceof ne||t instanceof an||t instanceof on||t instanceof le||t instanceof xe||t instanceof sn)&&t.dispose()})}checkIsLoaded(){if(!this.isLoaded)throw new Error("The Main Element is not loaded.please call load method first.")}initBackground(){const t=this.root.data("model");if(t){const e=t.background;switch(e.fillType){case Z.SolidColor:if(e.solidColor){const t=$(document.createElementNS("http://www.w3.org/2000/svg","rect")).attr({width:String(this.rawWidth),height:String(this.rawHeight),fill:e.solidColor});this.root.prepend(t)}break;case Z.Image:e.imageId&&this.root.prepend(this.getImageEl(e.imageId));break;case Z.Graph:if(e.graphSetting&&e.graphSetting.id>0){const t=new $t(e.graphSetting,this.rawWidth,this.rawHeight,this.context.configStore.graphStore,this.logger);t.switchToState(0),this.root.prepend(t.Element);const n=$(document.createElementNS("http://www.w3.org/2000/svg","rect")).attr({width:String(this.rawWidth),height:String(this.rawHeight),fill:"#fff"});this.root.prepend(n)}}}}getImageEl(t){const e=document.createElementNS("http://www.w3.org/2000/svg","image");return e.setAttribute("width",this.rawWidth+""),e.setAttribute("height",this.rawHeight+""),e.setAttribute("fill","none"),e.setAttribute("preserveAspectRatio","none"),e.setAttribute("crossorigin","anonymous"),e.setAttributeNS("http://www.w3.org/1999/xlink","href",this.context.configStore.imageStore.getImageUrl(t)),e}}var cn=n(13);class dn{constructor(t){this.observers=new Map,this.variableValuesChangedSubscriptions=new Array,this.variableStatesChangedSubscription=new Array,this.alarmSubscription=new Array,this._rawVariableCommunicator=t}openVariable(t,e){return this.openVariables([t],e).pipe(Object(it.map)(t=>t[0]))}openVariables(t,e=""){return new cn.a(n=>{Object(nt.each)(t,t=>{this.observers.has(t)||this.observers.set(t,[]),this.observers.get(t).push(n)});const i=this._rawVariableCommunicator.openVariables(t,e).subscribe(t=>n.next(t),t=>n.error(t),()=>n.complete());this.variableValuesChangedSubscriptions.push(i)})}write(t,e){return this._rawVariableCommunicator.write(t,e)}writeWordByBit(t,e,n){return this._rawVariableCommunicator.writeWordByBit(t,e,n)}subscribeVariableState(t){return this.subscribeVariableStates([t]).pipe(Object(it.map)(t=>t[0]))}subscribeVariableStates(t){return new cn.a(e=>{const n=this._rawVariableCommunicator.subscribeVariableStates(t).subscribe(t=>e.next(t),t=>e.error(t),()=>e.complete());this.variableStatesChangedSubscription.push(n)})}subscribeUserDeviceAlarms(t=""){return new cn.a(e=>{const n=this._rawVariableCommunicator.subscribeUserDeviceAlarms(t).subscribe(t=>e.next(t),t=>e.error(t),()=>e.complete());this.alarmSubscription.push(n)})}dispose(){Object(nt.forEach)(this.variableValuesChangedSubscriptions,t=>t.unsubscribe()),Object(nt.forEach)(this.variableStatesChangedSubscription,t=>t.unsubscribe()),Object(nt.forEach)(this.alarmSubscription,t=>t.unsubscribe())}}n.d(e,"a",function(){return hn});class hn{constructor(t,e,n,r){this.injector=t,this.bsModalService=e,this.context=n,this.parentView=r,this.viewId=rn.a.newGuid().toString("n"),this.logger=t.get(i.b),this.childViews=new Array,r&&r.childViews.push(this),this.isMobileMode=ee.a.Mobile===t.get(ee.b).displayMode,this.signalRAppId=rn.a.newGuid().toString("n")}get element(){return this.mainElement.rootElement}get rawWidth(){return this.mainElement.rawWidth}get rawHeight(){return this.mainElement.rawHeight}resize(t,e,n){if(t){if(!t.isReal())throw new Error("invalid size.");switch(e){case ee.c.HorizontalUniform:this.mainElement.horizontalStretch(t);break;default:this.mainElement.uniformStretch(t,n)}}}load(t,e){const{context:n}=this;this.svgRootClass=e.svgRootClass,this.perViewVariableCommunicator=new dn(n.variableCommunicator),this.mainElement=new un(this.injector,this.bsModalService,n,this.perViewVariableCommunicator,this,this.signalRAppId),this.mainElement.load(t.config,!!this.parentView,e),setTimeout(()=>{this.loadElementState()},0),this.logger.debug("[GUI] View loaded.")}loadElementState(){this.mainElement&&(this.mainElement.initElementState(),this.openVariableStatesSubscription&&this.openVariableStatesSubscription.unsubscribe(),this.openVariableStatesSubscription&&this.openVariableStatesSubscription.unsubscribe(),this.openedVariableNames=this.mainElement.getVariableNames(),0!==this.openedVariableNames.length&&(this.openVariableStatesSubscription=this.perViewVariableCommunicator.subscribeVariableStates(this.openedVariableNames).subscribe(t=>{this.mainElement.reportVariableStates(t);const e=[];Object(nt.each)(t,t=>{t.state===rt.d.Normal&&-1===e.indexOf(t.variableName)&&e.push(t.variableName)}),e.length>0&&this.normalOpenedVariableNames(e)})))}popView(t,e,n){return this.context.configStore.viewStore.getViewConfig(t).pipe(Object(it.map)(t=>{if(!t.config||!t.config.length)throw new lt.a;const i=new hn(this.injector,this.bsModalService,this.context,this),r={svgRootClass:this.svgRootClass,hostContainerId:e,el:n};i.load(t,r);const a=$(i.element).data("model");if(!a.popup)return;let o,s;switch(a.popup.locationType===ot.ViewPopupLocationType.Custom&&a.popup.location?(o=a.popup.location.x,s=a.popup.location.y):(o=(this.rawWidth-i.rawWidth)/2,s=(this.rawHeight-i.rawHeight)/2),a.popup.backdropType){case ot.ViewPopupBackdropType.Shadow:this.isMobileMode||i.showShadow();break;case ot.ViewPopupBackdropType.Musk:this.showMusk()}i.element.setAttribute("x",String(o)),i.element.setAttribute("y",String(s)),this.element.appendChild(i.element)}))}closeView(){this.parentView&&(this.parentView.hideMusk(),this.dispose(),this.element.parentElement.removeChild(this.element))}moveView(t,e){const n=Number(this.element.getAttribute("x"))+t,i=Number(this.element.getAttribute("y"))+e;this.element.setAttributeNS(null,"x",String(n)),this.element.setAttributeNS(null,"y",String(i))}showMusk(){this.muskElement||(this.muskElement=document.createElementNS("http://www.w3.org/2000/svg","rect"),this.muskElement.setAttribute("width",String(this.rawWidth)),this.muskElement.setAttribute("height",String(this.rawHeight)),this.muskElement.setAttribute("fill","#081625"),this.muskElement.setAttribute("fill-opacity","0.4")),this.element.appendChild(this.muskElement)}showShadow(){const t=`dropshadow-${this.viewId}`,e=G(this.element).append("defs").append("filter").attr("id",t).attr("x",0).attr("y",0).attr("color-interpolation-filters","sRGB").attr("filterUnits","userSpaceOnUse");e.append("feDropShadow").attr("stdDeviation","6").attr("flood-color","rgba(69,65,78,.3)"),e.append("feOffset").attr("dx",0).attr("dy",0).attr("result","shadow"),e.append("feComposite").attr("in","SourceGraphic").attr("in2","shadow").attr("operator","over");const n=this.element.children[0];n&&(n.setAttribute("filter",`url(#${t})`),n.setAttribute("x","6"),n.setAttribute("y","6"),$(this.element).children("g").attr("transform","matrix(1, 0, 0, 1, 6, 6)"))}hideMusk(){this.muskElement&&(this.element.removeChild(this.muskElement),this.muskElement=null)}dispose(){this.openVariableStatesSubscription&&this.openVariableStatesSubscription.unsubscribe(),this.openVariablesSubscription&&this.openVariablesSubscription.unsubscribe(),this.perViewVariableCommunicator&&this.perViewVariableCommunicator.dispose(),this.childViews&&this.childViews.length&&Object(nt.forEach)(this.childViews,t=>t.dispose()),this.mainElement&&this.mainElement.dispose(),this.logger.debug("[GUI] View disposed.")}normalOpenedVariableNames(t){t.length>0&&(this.openVariablesSubscription=this.perViewVariableCommunicator.openVariables(t,this.signalRAppId).subscribe(t=>this.mainElement.reportVariableValues(t)))}}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});class i{constructor(t,e){this.num=t||0,this.bits=e||0}decimalToBinary(t,e){const n=[],i=[];let r=0;for(;t>0;)n.push(t%2),t=parseInt((t/2).toString()),r++;for(let t=r-1;t>=0;t--)i.push(n[t]);if(e<i.length&&console.log("控制位小于转换位数"),e)for(let t=i.length;t<e;t++)i.unshift("0");return i.join().replace(/,/g,"")}convertToBinary(){const t=Number(this.num);return this.decimalToBinary(Math.abs(t),this.bits)}}},function(t,e,n){"use strict";var i;n.d(e,"a",function(){return i}),function(t){t[t.Bit=0]="Bit",t[t.Word=1]="Word"}(i||(i={}))},function(t,e,n){"use strict";function i(t){setTimeout(function(){throw t},0)}n.d(e,"a",function(){return i})},function(t,e,n){"use strict";var i=n(0),r=n(2),a=n(9),o=n(14),s=n(7),l=n(5),u=n(26),c=n(31),d=n(16);var h=n(27);n.d(e,"a",function(){return p});var f=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o},m=function(t,e){return function(n,i){e(n,i,t)}};let p=class{constructor(t,e,n,r){this.el=t,this.localization=e,this.injector=n,this.bsModalService=r,this.loadFailed=new i.EventEmitter,this.loaded=new i.EventEmitter,this.lastScale=1,this.isMobileMode=!1,this.globalSettings=this.injector.get(o.b),this.viewService=n.get(u.a)}get viewResizeMode(){switch(this.resizeMode){case"HorizontalUniform":return o.c.HorizontalUniform;default:return o.c.Uniform}}ngOnChanges(t){t.displayMode&&this.onDisplayModeChanged(t.displayMode.previousValue,t.displayMode.currentValue),t.context&&this.onProviderChanged(t.context.previousValue,t.context.currentValue),t.size&&this.onSizeChanged(t.size.previousValue,t.size.currentValue),t.resizeMode&&this.onResizeModeChanged(t.resizeMode.previousValue,t.resizeMode.currentValue)}doubleFingerZooming(){const t=this.$svg.find("div.svg-content").first()[0],e=this;e.initWidth=t.offsetWidth,e.initHeight=t.offsetHeight,e.lastScale=1,t.addEventListener("touchstart",function(n){e.pageX=n.targetTouches[0].pageX,e.pageY=n.targetTouches[0].pageY,e.initX=Object(r.isNaN)(parseInt(t.style.left,10))?0:parseInt(t.style.left,10),e.initY=Object(r.isNaN)(parseInt(t.style.top,10))?0:parseInt(t.style.top,10),n.touches.length>=2&&(e.startTouch=n.touches),e.isTouch=!0},!1),t.addEventListener("touchmove",function(n){if(1===n.touches.length&&e.isTouch&&e.lastScale>1){n.preventDefault();const i=n.targetTouches[0].pageX,r=n.targetTouches[0].pageY,a=Number(i)-Number(e.pageX)+Number(e.initX),o=Number(r)-Number(e.pageY)+Number(e.initY);a>-(e.lastScale-1)*e.initWidth/2&&a<(e.lastScale-1)*e.initWidth/2&&(t.style.left=a+"px"),o>-(e.lastScale-1)*e.initHeight/2&&o<(e.lastScale-1)*e.initHeight/2&&(t.style.top=o+"px")}if(n.touches.length>=2&&e.isTouch){n.preventDefault();const i=n.touches,r=e.getDistance(i[0],i[1])/e.getDistance(e.startTouch[0],e.startTouch[1]);let a=e.lastScale;r>=1&&(a*=1.008),a<1&&(a=1),a>5&&(a=5),r<1&&(a*=.992,t.style.left=-(a-1)*e.initWidth/8+"px",t.style.top=-(a-1)*e.initHeight/8+"px"),t.style.transform="scale("+a+")",e.lastScale=a}},!1),t.addEventListener("touchend",function(){e.isTouch&&(e.isTouch=!1)},!1)}getDistance(t,e){const n=e.pageX-t.pageX,i=e.pageY-t.pageY;return Math.sqrt(n*n+i*i)}ngOnDestroy(){this.host&&this.host.dispose()}onProviderChanged(t,e){if(!Object(r.isEqual)(t,e))if(this.host&&(this.host.dispose(),this.host=null),e){this.$svg=$(this.el.nativeElement).find("div.svgView").first(),this.$svg.empty();const t="S"+h.a.newGuid().toString("n");this.hostContainerId="H"+h.a.newGuid().toString("n"),this.$svg.addClass(t);const n={svgRootClass:t,hostContainerId:this.hostContainerId,el:this.el},i=new class{constructor(t,e,n,i,r){this.injector=t,this.bsModalService=e,this.context=n,this.guiOptions=i,this.el=r,this.logger=t.get(s.b),t.get(u.a).toggleViews.set(r,(t,e,n)=>(this.currentViewIndex=t,this.context.configStore.viewStore.getViewConfig(t).pipe(Object(d.map)(i=>{if(this.currentViewIndex!==t)return;if(!i||!i.config||!i.config.length)throw new l.a;this.currentView&&this.currentView.dispose(),this.currentView=new c.a(this.injector,this.bsModalService,this.context);const r={svgRootClass:this.guiOptions.svgRootClass,hostContainerId:e,el:n};this.currentView.load(i,r),this.currentView.resize(this.currentViewSize,this.currentViewReiszeMode,this.guiOptions.svgRootClass),this.containerEl=$(n.nativeElement).find(`div#${e}`).first(),this.containerEl.empty(),this.containerEl.append(this.currentView.element),this.logger.debug(`[GUI] Toggle View(${t}) successed.`)}))))}get element(){if(this.containerEl)return this.containerEl[0];throw new Error("Gui Host not loaded yet.")}load(t){if(this.isLoaded)throw new Error("The GuiHost already loaded.");return this.isLoaded=!0,this.containerEl=$(`<div class="svg-content" id= "${this.guiOptions.hostContainerId}" style="display:flex;position:relative;"></div>`),new Promise((e,n)=>{t&&0!==t?this.loadViewConfigByConfigureViewId(e,n,t):this.loadMainViewConfig(e,n)})}loadByConfigureViewCode(t){if(this.isLoaded)throw new Error("The GuiHost already loaded.");return this.isLoaded=!0,this.containerEl=$(`<div class="svg-content" id= "${this.guiOptions.hostContainerId}" style="display: inline-block;position: relative;"></div>`),new Promise((e,n)=>{t?this.loadViewConfigByConfigureViewCode(e,n,t):this.loadMainViewConfig(e,n)})}loadMainViewConfig(t,e){this.context.configStore.viewStore.getMainViewConfig().subscribe(n=>{n.config&&n.config.length?(this.currentView=new c.a(this.injector,this.bsModalService,this.context),this.currentView.load(n,this.guiOptions),this.containerEl.empty(),this.containerEl.append(this.currentView.element),t(this),this.logger.debug("[GUI] Host loaded.")):e(new l.a)},t=>{this.logger.error("[GUI] Load failed: "+t.stack),e(t)})}loadViewConfigByConfigureViewId(t,e,n){this.context.configStore.viewStore.getViewConfigByConfigureViewId(n).subscribe(n=>{this.handleViewConfigCallback(t,e,n)},t=>{this.logger.error("[GUI] Load failed: "+t.stack),e(t)})}loadViewConfigByConfigureViewCode(t,e,n){this.context.configStore.viewStore.getViewConfigByConfigureViewCode(n).subscribe(n=>{this.handleViewConfigCallback(t,e,n)},t=>{this.logger.error("[GUI] Load failed: "+t.stack),e(t)})}handleViewConfigCallback(t,e,n){n.config&&n.config.length||e(new l.a),this.currentView=new c.a(this.injector,this.bsModalService,this.context),this.currentView.load(n,this.guiOptions),this.containerEl.empty(),this.containerEl.append(this.currentView.element),t(this),this.logger.debug("[GUI] Host loaded.")}resizeView(t,e){this.currentView&&(this.currentView.resize(t,e,this.guiOptions.svgRootClass),this.currentViewSize=t,this.currentViewReiszeMode=e)}updateViewSize(t){this.currentView&&(this.currentView.resize(t,this.currentViewReiszeMode,this.guiOptions.svgRootClass),this.currentViewSize=t)}updateViewResizeMode(t){this.currentView&&(this.currentView.resize(this.currentViewSize,t,this.guiOptions.svgRootClass),this.currentViewReiszeMode=t)}dispose(){this.currentView&&this.currentView.dispose(),this.context&&this.context.dispose(),this.logger.debug("[GUI] GuiHost disposed.")}}(this.injector,this.bsModalService,e,n,this.el);(this.context.configureViewCode?i.loadByConfigureViewCode(this.context.configureViewCode):i.load(this.context.configureViewId)).then(t=>{Object(r.isEqual)(this.context,t.context)?(this.host=i,this.host.resizeView(this.size,this.viewResizeMode),this.$svg.append(t.element),this.isMobileMode&&this.doubleFingerZooming(),this.loaded.emit()):t.dispose()}).catch(t=>{this.$svg.append(`<p>${this.localization.loadFailed}</p>`),this.loadFailed.emit(t)})}else this.$svg&&this.$svg.empty(),this.host=null}onSizeChanged(t,e){this.host&&!Object(r.isEqual)(t,e)&&(this.host.updateViewSize(e),this.isMobileMode&&this.doubleFingerZooming())}onResizeModeChanged(t,e){this.host&&!Object(r.isEqual)(t,e)&&this.host.updateViewResizeMode(this.viewResizeMode)}onDisplayModeChanged(t,e){Object(r.isEqual)(t,e)||(this.isMobileMode="Mobile"===this.displayMode,this.globalSettings.displayMode=this.isMobileMode?o.a.Mobile:o.a.Web)}refreshCurrentPage(){if(void 0===this.host.currentViewIndex)return!1;const t=this.viewService.toggleViews.get(this.el);return!!t&&(t(this.host.currentViewIndex,this.hostContainerId,this.el).subscribe(),!0)}};f([Object(i.Input)()],p.prototype,"context",void 0),f([Object(i.Input)()],p.prototype,"size",void 0),f([Object(i.Input)()],p.prototype,"resizeMode",void 0),f([Object(i.Input)()],p.prototype,"displayMode",void 0),f([Object(i.Output)()],p.prototype,"loadFailed",void 0),f([Object(i.Output)()],p.prototype,"loaded",void 0),p=f([Object(i.Component)({selector:"fc-gui",template:"<div> <div class='svgView' style=\"position: relative;display: flex;justify-content: center;align-items: center;\"></div> </div> "}),m(1,Object(i.Inject)(a.b))],p)},function(t,e,n){"use strict";n.d(e,"a",function(){return l});var i=n(0),r=n(9),a=n(2),o=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o},s=function(t,e){return function(n,i){e(n,i,t)}};let l=class{constructor(t,e,n,i,r){this.localization=t,this.dataTypeService=e,this.fractionDigitService=n,this.numericalOperationService=i,this.bsModalRef=r,this.writeValueRangeText="",this.isSubmitting=!1}get invalidErrorText(){return this.localization.loadFailed}ngOnInit(){this.initData(this.args),this.validate()}initData(t){this.variableName=t.variableName,this.dataType=t.dataType,this.fBoxDataType=t.fBoxDataType,this.integerDigits=t.integerDigits?t.integerDigits:0,this.fractionDigits=t.fractionDigits?t.fractionDigits:0,this.valueType=this.dataTypeService.getValueType(t.version,t.dataType),this.pattern=this.dataTypeService.getValuePattern(t.version,t.dataType),this.numericalOperation=t.numericalOperation,this.enableNumericalOperation=!!this.numericalOperation.enableNumericalOperation&&this.numericalOperation.enableNumericalOperation,this.value="",this.args.enableDataParsed?this.setValueRangeAccordToDataParsed(t):(this.writeMaxValue=this.dataTypeService.getMaxValue(t.version,this.dataType,this.fBoxDataType),this.writeMinValue=this.dataTypeService.getMinValue(t.version,this.dataType,this.fBoxDataType)),this.writeValueRangeText=this.getWriteValueRangeText()}setValueRangeAccordToDataParsed(t){this.dataTypeService.isFloat(t.version,this.dataType)||this.enableNumericalOperation?(this.maxValueLimit=this.dataTypeService.getMaxValue(t.version,this.dataType,this.fBoxDataType),this.minValueLimit=this.dataTypeService.getMinValue(t.version,this.dataType,this.fBoxDataType),this.numericalLowerLimit=this.numericalOperation.numericalLowerLimit,this.numericalUpperLimit=this.numericalOperation.numericalUpperLimit):(this.maxValueLimit=+this.fractionDigitService.movePoint(this.dataTypeService.getMaxValue(t.version,this.dataType,this.fBoxDataType),-this.fractionDigits),this.minValueLimit=+this.fractionDigitService.movePoint(this.dataTypeService.getMinValue(t.version,this.dataType,this.fBoxDataType),-this.fractionDigits),this.numericalLowerLimit=+this.fractionDigitService.movePoint(this.numericalOperation.numericalLowerLimit,-this.fractionDigits),this.numericalUpperLimit=+this.fractionDigitService.movePoint(this.numericalOperation.numericalUpperLimit,-this.fractionDigits));const e=this.numericalOperationService.getWriteMinValue(this.minValueLimit,this.numericalOperation),n=this.numericalOperationService.getWriteMaxValue(this.maxValueLimit,this.numericalOperation),i=this.numericalOperationService.getWriteMinValue(this.numericalLowerLimit,this.numericalOperation),r=this.numericalOperationService.getWriteMaxValue(this.numericalUpperLimit,this.numericalOperation),a=e<n?e:n,o=e<n?n:e,s=i<r?i:r,l=i<r?r:i;this.writeMinValue=a>s?a:s,this.writeMaxValue=o<l?o:l}getWriteValueRangeText(){let t="",e="";return this.dataTypeService.isHexOrBinaryType(this.args.version,this.dataType)?(t=this.writeMinValue.toString(16),e=this.writeMaxValue.toString(16)):this.args.enableDataParsed&&this.fractionDigits>0?(t=this.writeMinValue.toFixed(this.fractionDigits).toString(),e=this.writeMaxValue.toFixed(this.fractionDigits).toString()):(t=this.writeMinValue.toString(),e=this.writeMaxValue.toString()),t+"~"+e}save(){this.isSubmitting=!0;let t=this.value;const e=this.value;this.args.enableDataParsed&&(t=this.enableNumericalOperation?this.numericalOperationService.getWriteValue(this.args.version,this.value,this.numericalOperation,this.dataType,this.fractionDigits):this.formatWriteValue()),this.args.releasedVariableService.getVariableWithValueTransform(this.variableName).subscribe(n=>{0!==JSON.parse(n.valueTransform).Type&&(this.isNumericalOperation=!0),this.onClosed({value:t,showValue:e,enableNumericalOperation:this.enableNumericalOperation,isNumericalOperation:this.isNumericalOperation,variableRwType:n.variableRwType})})}close(){this.bsModalRef.hide()}validate(t=null){if(t&&13===t.keyCode&&!this.validationError)return void this.save();if(null==this.value||""===this.value.trim())return this.showValidationErrorInfo(this.localization.numericalValueRequired);if(!new RegExp(this.pattern).test(this.value))return this.showValidationErrorInfo(this.localization.invalidNumericalValue);if(!this.enableNumericalOperation&&this.dataTypeService.isSupportFractionDigit(this.args.version,this.dataType)&&this.getFractionDigits(this.value)>this.fractionDigits)return this.showValidationErrorInfo(`${this.localization.fractionDigitsMustLessThan}${this.fractionDigits}`);if((Object(a.isNil)(this.args.version)||!Object(a.isNil)(this.args.version)&&this.args.version<5)&&!this.enableNumericalOperation&&!this.dataTypeService.isSignedType(this.args.version,this.dataType)&&this.value.startsWith("-"))return this.showValidationErrorInfo(this.localization.canNotBeNegative);if(this.dataTypeService.isBinaryType(this.args.version,this.dataType)||this.dataTypeService.isHexType(this.args.version,this.dataType)){const t=this.dataTypeService.getValueMaxLength(this.args.version,this.dataType,this.fBoxDataType),e=this.integerDigits?Math.min(this.integerDigits,t):t;if(this.value.length>e)return this.showValidationErrorInfo(this.localization.numericalValueTooLong)}let e;if(e=this.dataTypeService.isHexOrBinaryType(this.args.version,this.dataType)?this.dataTypeService.formatToDecimal(this.args.version,this.value,this.dataType):Number(this.value),Number(e)>this.writeMaxValue||Number(e)<this.writeMinValue)return this.showValidationErrorInfo(this.localization.valueOutOfRange);this.hideValidationErrorInfo()}showValidationErrorInfo(t){this.validationError=!0,this.validationErrorText=t}hideValidationErrorInfo(){this.validationError=!1,this.validationErrorText=""}getFractionDigits(t){return t&&t.indexOf(".")>0?t.split(".")[1].length:0}formatWriteValue(){return this.dataTypeService.isSupportFractionDigit(this.args.version,this.dataType)&&!this.dataTypeService.isFloat(this.args.version,this.dataType)&&this.fractionDigits?this.fractionDigitService.movePoint(this.value,this.fractionDigits):(this.dataTypeService.isSupportNumericalOperation(this.args.version,this.dataType)&&(this.value=Number(this.value).toString()),this.value)}};o([Object(i.Output)()],l.prototype,"invalidErrorText",null),l=o([Object(i.Component)({selector:"writeValueModal",template:'<form #writeValueForm="ngForm" novalidate (ngSubmit)="save()" bs-modal-drag> <div class="modal-header"> <h4 class="modal-title"> <span>{{localization.setting}}</span> <span>{{variableName}}</span> </h4> <button type="button" class="close pull-right" aria-label="Close" (click)="close()"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <span class="write-value-range">{{localization.writeValueRange}}:</span> <div class="write-value-range"> {{writeValueRangeText}} <span *ngIf="valueType">({{valueType}})</span> </div> <input type="text" name="valueInput" autoFocus class="form-control write-value" [(ngModel)]="value" (keyup)="validate($event)" autocomplete="off"> <span class="help-block text-danger" [hidden]="!validationError">{{validationErrorText}}</span> </div> <div class="modal-footer"> <button type="submit" class="btn md-skip btn-primary btn-block" [disabled]="validationError || isSubmitting"> <ng-container *ngIf="!isSubmitting">{{localization.submit}}</ng-container> <ng-container *ngIf="isSubmitting">{{localization.submitting}}</ng-container> </button> </div> </form> ',styles:[".modal-header { padding: 10px; border-color: transparent; } .modal-body { position: relative; padding: 0px 5px !important; padding-top: 10px !important; } .modal-title { display: unset; margin-left: -6px; font-size: 16px !important; } .form-control { margin: 0 5%; float: none; width: 90%; } .modal-footer { padding: 10px 4px 20px 5px !important; text-align: right; border-color: transparent; } .text-danger { display: block; color: #ed6b75; font-size: 14px; margin: 5px 0px 0px 15px; } .btn-primary { background-color: #3B97FC; border-color: #3B97FC; padding: 5px 30px; width: 90%; margin: 0 5%; height: 32px; } .write-value-range { color: #7f939e; font-size: 14px; margin-left: 15px; } .write-value { padding-left: 8px; margin-left: 16px; height: 32px; } "]}),s(0,Object(i.Inject)(r.b))],l)},function(t,e,n){"use strict";n.d(e,"a",function(){return l});var i=n(0),r=n(39),a=n(9),o=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o},s=function(t,e){return function(n,i){e(n,i,t)}};let l=class{constructor(t){this.localization=t,this._onClosed=new r.a}get onClosed(){return this._onClosed}get invalidErrorText(){return this.localization.loadFailed}ngOnInit(){this.variableName=this.args.variableName,this.isPassword=!!this.args.isPassword&&this.args.isPassword,this.charCount=this.args.charCount,this.value="",this.validate()}validate(){return null==this.value||""===this.value.trim()?this.showValidationErrorInfo(this.localization.characterInputRequired):this.value.length>this.charCount?this.showValidationErrorInfo(this.localization.characterOutofRange):void this.hideValidationErrorInfo()}showValidationErrorInfo(t){this.validationError=!0,this.validationErrorText=t}hideValidationErrorInfo(){this.validationError=!1,this.validationErrorText=""}save(){this.close({value:this.value})}close(t){this._onClosed.next(t),this._onClosed.complete()}};o([Object(i.Output)()],l.prototype,"invalidErrorText",null),l=o([Object(i.Component)({selector:"writeCharacterModal",template:'<form #writeValueForm="ngForm" novalidate (ngSubmit)="save()" bs-modal-drag> <div class="modal-header"> <h4 class="modal-title"> <span>{{localization.setting}}</span> <span>{{variableName}}</span> </h4> <button type="button" class="close pull-right" aria-label="Close" (click)="close()"> <span aria-hidden="true">×</span> </button> </div> <div class="modal-body"> <input type="text" name="characterInput" autoFocus class="form-control write-character-value" [(ngModel)]="value" (keyup)="validate()" *ngIf="!isPassword" autocomplete="off"> <input type="password" name="passwordInput" autoFocus class="form-control write-character-value" [(ngModel)]="value" (keyup)="validate()" *ngIf="isPassword" autocomplete="off"> <span class="help-block text-danger" [hidden]="!validationError">{{validationErrorText}}</span> </div> <div class="modal-footer"> <button type="submit" class="btn md-skip btn-primary btn-block" [disabled]="validationError">{{localization.submit}}</button> </div> </form> ',styles:[".modal-header { padding: 10px; border-color: transparent; } .modal-body { position: relative; padding: 0px 5px !important; } .modal-title { display: unset; margin-left: -6px; font-size: 16px !important; } .form-control { margin: 0 5%; float: none; width: 90%; } .modal-footer { padding: 10px 4px 20px 5px !important; text-align: right; border-color: transparent; } .text-danger { display: block; color: #ed6b75; font-size: 14px; margin: 10px 0px 0px 15px; } .btn-primary { background-color: #3B97FC; border-color: #3B97FC; padding: 5px 30px; width: 90%; margin: 0 5%; height: 32px; } .write-character-value { padding-left: 8px; height: 32px; margin-left: 16px; } "]}),s(0,Object(i.Inject)(a.b))],l)},function(t,e,n){!function(){var i={dev:!1};i.tooltip=i.tooltip||{},i.utils=i.utils||{},i.models=i.models||{},i.charts={},i.logs={},i.dom={},void 0!==t&&void 0!==e&&"undefined"==typeof d3&&(d3=n(25)),i.dispatch=d3.dispatch("render_start","render_end"),Function.prototype.bind||(Function.prototype.bind=function(t){if("function"!=typeof this)throw new TypeError("Function.prototype.bind - what is trying to be bound is not callable");var e=Array.prototype.slice.call(arguments,1),n=this,i=function(){},r=function(){return n.apply(this instanceof i&&t?this:t,e.concat(Array.prototype.slice.call(arguments)))};return i.prototype=this.prototype,r.prototype=new i,r}),i.dev&&(i.dispatch.on("render_start",function(t){i.logs.startTime=+new Date}),i.dispatch.on("render_end",function(t){i.logs.endTime=+new Date,i.logs.totalTime=i.logs.endTime-i.logs.startTime,i.log("total",i.logs.totalTime)})),i.log=function(){if(i.dev&&window.console&&console.log&&console.log.apply)console.log.apply(console,arguments);else if(i.dev&&window.console&&"function"==typeof console.log&&Function.prototype.bind){Function.prototype.bind.call(console.log,console).apply(console,arguments)}return arguments[arguments.length-1]},i.deprecated=function(t,e){console&&console.warn&&console.warn("nvd3 warning: `"+t+"` has been deprecated. ",e||"")},i.render=function(t){t=t||1,i.render.active=!0,i.dispatch.render_start();var e=function(){for(var n,r,a=0;a<t&&(r=i.render.queue[a]);a++)n=r.generate(),typeof r.callback==typeof Function&&r.callback(n);i.render.queue.splice(0,a),i.render.queue.length?setTimeout(e):(i.dispatch.render_end(),i.render.active=!1)};setTimeout(e)},i.render.active=!1,i.render.queue=[],i.addGraph=function(t){typeof arguments[0]==typeof Function&&(t={generate:arguments[0],callback:arguments[1]}),i.render.queue.push(t),i.render.active||i.render()},t.exports=i,"undefined"!=typeof window&&(window.nv=i),i.dom.write=function(t){return void 0!==window.fastdom?fastdom.mutate(t):t()},i.dom.read=function(t){return void 0!==window.fastdom?fastdom.measure(t):t()},i.interactiveGuideline=function(){"use strict";var t={left:0,top:0},e=null,n=null,r=d3.scale.linear(),a=d3.dispatch("elementMousemove","elementMouseout","elementClick","elementDblclick","elementMouseDown","elementMouseUp"),o=!0,s=null,l=i.models.tooltip(),u=window.ActiveXObject;function c(d){d.each(function(d){var h=d3.select(this),f=e||960,m=n||400,p=h.selectAll("g.nv-wrap.nv-interactiveLineLayer").data([d]);function g(){var e=d3.event.clientX-this.getBoundingClientRect().left,n=d3.event.clientY-this.getBoundingClientRect().top,i=!0,o=!1;if(u&&(e=d3.event.offsetX,n=d3.event.offsetY,"svg"!==d3.event.target.tagName&&(i=!1),d3.event.target.className.baseVal.match("nv-legend")&&(o=!0)),i&&(e-=t.left,n-=t.top),"mouseout"===d3.event.type||e<0||n<0||e>f||n>m||d3.event.relatedTarget&&void 0===d3.event.relatedTarget.ownerSVGElement||o){if(u&&d3.event.relatedTarget&&void 0===d3.event.relatedTarget.ownerSVGElement&&(void 0===d3.event.relatedTarget.className||d3.event.relatedTarget.className.match(l.nvPointerEventsClass)))return;return a.elementMouseout({mouseX:e,mouseY:n}),c.renderGuideLine(null),void l.hidden(!0)}l.hidden(!1);var s=void 0;if("function"==typeof r.rangeBands){var d=d3.bisect(r.range(),e)-1;if(!(r.range()[d]+r.rangeBand()>=e))return a.elementMouseout({mouseX:e,mouseY:n}),c.renderGuideLine(null),void l.hidden(!0);s=r.domain()[d3.bisect(r.range(),e)-1]}else s=r.invert(e);a.elementMousemove({mouseX:e,mouseY:n,pointXValue:s}),"dblclick"===d3.event.type&&a.elementDblclick({mouseX:e,mouseY:n,pointXValue:s}),"click"===d3.event.type&&a.elementClick({mouseX:e,mouseY:n,pointXValue:s}),"mousedown"===d3.event.type&&a.elementMouseDown({mouseX:e,mouseY:n,pointXValue:s}),"mouseup"===d3.event.type&&a.elementMouseUp({mouseX:e,mouseY:n,pointXValue:s})}p.enter().append("g").attr("class"," nv-wrap nv-interactiveLineLayer").append("g").attr("class","nv-interactiveGuideLine"),s&&(s.on("touchmove",g).on("mousemove",g,!0).on("mouseout",g,!0).on("mousedown",g,!0).on("mouseup",g,!0).on("dblclick",g).on("click",g),c.guideLine=null,c.renderGuideLine=function(t){o&&(c.guideLine&&c.guideLine.attr("x1")===t||i.dom.write(function(){var e=p.select(".nv-interactiveGuideLine").selectAll("line").data(null!=t?[i.utils.NaNtoZero(t)]:[],String);e.enter().append("line").attr("class","nv-guideline").attr("x1",function(t){return t}).attr("x2",function(t){return t}).attr("y1",m).attr("y2",0),e.exit().remove()}))})})}return l.duration(0).hideDelay(0).hidden(!1),c.dispatch=a,c.tooltip=l,c.margin=function(e){return arguments.length?(t.top=void 0!==e.top?e.top:t.top,t.left=void 0!==e.left?e.left:t.left,c):t},c.width=function(t){return arguments.length?(e=t,c):e},c.height=function(t){return arguments.length?(n=t,c):n},c.xScale=function(t){return arguments.length?(r=t,c):r},c.showGuideLine=function(t){return arguments.length?(o=t,c):o},c.svgContainer=function(t){return arguments.length?(s=t,c):s},c},i.interactiveBisect=function(t,e,n){"use strict";if(!(t instanceof Array))return null;var i;i="function"!=typeof n?function(t){return t.x}:n;var r=d3.bisector(function(t,e){return i(t)-e}).left,a=d3.max([0,r(t,e)-1]),o=i(t[a]);if(void 0===o&&(o=a),o===e)return a;var s=d3.min([a+1,t.length-1]),l=i(t[s]);return void 0===l&&(l=s),Math.abs(l-e)>=Math.abs(o-e)?a:s},i.nearestValueIndex=function(t,e,n){"use strict";var i=1/0,r=null;return t.forEach(function(t,a){var o=Math.abs(e-t);null!=t&&o<=i&&o<n&&(i=o,r=a)}),r},i.models.tooltip=function(){"use strict";var t="nvtooltip-"+Math.floor(1e5*Math.random()),e=null,n="w",r=25,a=0,o=null,s=!0,l=200,u=null,c={left:null,top:null},d=!0,h=100,f=!0,m="nv-pointer-events-none",p=function(t,e,n){return t},g=function(t){return t},v=function(t,e){return t},_=function(t,e){if(null===t)return"";var n=d3.select(document.createElement("table"));f&&n.selectAll("thead").data([t]).enter().append("thead").append("tr").append("td").attr("colspan",3).append("strong").classed("x-value",!0).html(g(t.value));var i=n.selectAll("tbody").data([t]).enter().append("tbody").selectAll("tr").data(function(t){return t.series}).enter().append("tr").classed("highlight",function(t){return t.highlight});i.append("td").classed("legend-color-guide",!0).append("div").style("background-color",function(t){return t.color}),i.append("td").classed("key",!0).classed("total",function(t){return!!t.total}).html(function(t,e){return v(t.key,e)}),i.append("td").classed("value",!0).html(function(t,e){return p(t.value,e,t)}),i.filter(function(t,e){return void 0!==t.percent}).append("td").classed("percent",!0).html(function(t,e){return"("+d3.format("%")(t.percent)+")"}),i.selectAll("td").each(function(t){if(t.highlight){var e=d3.scale.linear().domain([0,1]).range(["#fff",t.color]);d3.select(this).style("border-bottom-color",e(.6)).style("border-top-color",e(.6))}});var r=n.node().outerHTML;return void 0!==t.footer&&(r+="<div class='footer'>"+t.footer+"</div>"),r},y=function(){var t={left:null!==d3.event?d3.event.clientX:0,top:null!==d3.event?d3.event.clientY:0};if("none"!=getComputedStyle(document.body).transform){var e=document.body.getBoundingClientRect();t.left-=e.left,t.top-=e.top}return t},b=function(t){if(t&&t.series){if(i.utils.isArray(t.series))return!0;if(i.utils.isObject(t.series))return t.series=[t.series],!0}return!1},M=function(){i.dom.read(function(){var t=y(),e=function(t){var e,i,a,o=u.node().offsetHeight,s=u.node().offsetWidth,l=document.documentElement.clientWidth,c=document.documentElement.clientHeight;switch(n){case"e":e=-s-r,i=-o/2,t.left+e<0&&(e=r),(a=t.top+i)<0&&(i-=a),(a=t.top+i+o)>c&&(i-=a-c);break;case"w":e=r,i=-o/2,t.left+e+s>l&&(e=-s-r),(a=t.top+i)<0&&(i-=a),(a=t.top+i+o)>c&&(i-=a-c);break;case"n":e=-s/2-5,i=r,t.top+i+o>c&&(i=-o-r),(a=t.left+e)<0&&(e-=a),(a=t.left+e+s)>l&&(e-=a-l);break;case"s":e=-s/2,i=-o-r,t.top+i<0&&(i=r),(a=t.left+e)<0&&(e-=a),(a=t.left+e+s)>l&&(e-=a-l);break;case"center":e=-s/2,i=-o/2;break;default:e=0,i=0}return{left:e,top:i}}(t),i=t.left+e.left,a=t.top+e.top;if(s)u.interrupt().transition().delay(l).duration(0).style("opacity",0);else{var o="translate("+c.left+"px, "+c.top+"px)",d="translate("+Math.round(i)+"px, "+Math.round(a)+"px)",f=d3.interpolateString(o,d),m=u.style("opacity")<.1;u.interrupt().transition().duration(m?0:h).styleTween("transform",function(t){return f},"important").styleTween("-webkit-transform",function(t){return f}).style("-ms-transform",d).style("opacity",1)}c.left=i,c.top=a})};function x(){if(d&&b(e))return i.dom.write(function(){u&&u.node()||((u=d3.select(document.body).selectAll("#"+t).data([1])).enter().append("div").attr("class","nvtooltip "+(o||"xy-tooltip")).attr("id",t).style("top",0).style("left",0).style("opacity",0).style("position","absolute").selectAll("div, table, td, tr").classed(m,!0).classed(m,!0),u.exit().remove());var n=_(e,u.node());n&&(u.node().innerHTML=n),M()}),x}return x.nvPointerEventsClass=m,x.options=i.utils.optionsFunc.bind(x),x._options=Object.create({},{duration:{get:function(){return h},set:function(t){h=t}},gravity:{get:function(){return n},set:function(t){n=t}},distance:{get:function(){return r},set:function(t){r=t}},snapDistance:{get:function(){return a},set:function(t){a=t}},classes:{get:function(){return o},set:function(t){o=t}},enabled:{get:function(){return d},set:function(t){d=t}},hideDelay:{get:function(){return l},set:function(t){l=t}},contentGenerator:{get:function(){return _},set:function(t){_=t}},valueFormatter:{get:function(){return p},set:function(t){p=t}},headerFormatter:{get:function(){return g},set:function(t){g=t}},keyFormatter:{get:function(){return v},set:function(t){v=t}},headerEnabled:{get:function(){return f},set:function(t){f=t}},position:{get:function(){return y},set:function(t){y=t}},chartContainer:{get:function(){return document.body},set:function(t){i.deprecated("chartContainer","feature removed after 1.8.3")}},fixedTop:{get:function(){return null},set:function(t){i.deprecated("fixedTop","feature removed after 1.8.1")}},offset:{get:function(){return{left:0,top:0}},set:function(t){i.deprecated("offset","use chart.tooltip.distance() instead")}},hidden:{get:function(){return s},set:function(t){s!=t&&(s=!!t,x())}},data:{get:function(){return e},set:function(t){t.point&&(t.value=t.point.x,t.series=t.series||{},t.series.value=t.point.y,t.series.color=t.point.color||t.series.color),e=t}},node:{get:function(){return u.node()},set:function(t){}},id:{get:function(){return t},set:function(t){}}}),i.utils.initOptions(x),x},i.utils.windowSize=function(){var t={width:640,height:480};return window.innerWidth&&window.innerHeight?(t.width=window.innerWidth,t.height=window.innerHeight,t):"CSS1Compat"==document.compatMode&&document.documentElement&&document.documentElement.offsetWidth?(t.width=document.documentElement.offsetWidth,t.height=document.documentElement.offsetHeight,t):document.body&&document.body.offsetWidth?(t.width=document.body.offsetWidth,t.height=document.body.offsetHeight,t):t},i.utils.isArray=Array.isArray,i.utils.isObject=function(t){return null!==t&&"object"==typeof t},i.utils.isFunction=function(t){return"function"==typeof t},i.utils.isDate=function(t){return"[object Date]"===toString.call(t)},i.utils.isNumber=function(t){return!isNaN(t)&&"number"==typeof t},i.utils.windowResize=function(t){return window.addEventListener?window.addEventListener("resize",t):i.log("ERROR: Failed to bind to window.resize with: ",t),{callback:t,clear:function(){window.removeEventListener("resize",t)}}},i.utils.getColor=function(t){if(void 0===t)return i.utils.defaultColor();if(i.utils.isArray(t)){var e=d3.scale.ordinal().range(t);return function(t,n){var i=void 0===n?t:n;return t.color||e(i)}}return t},i.utils.defaultColor=function(){return i.utils.getColor(d3.scale.category20().range())},i.utils.customTheme=function(t,e,n){e=e||function(t){return t.key};var r=(n=n||d3.scale.category20().range()).length;return function(a,o){var s=e(a);return i.utils.isFunction(t[s])?t[s]():void 0!==t[s]?t[s]:(r||(r=n.length),n[r-=1])}},i.utils.pjax=function(t,e){var n=function(n){d3.html(n,function(n){var r=d3.select(e).node();r.parentNode.replaceChild(d3.select(n).select(e).node(),r),i.utils.pjax(t,e)})};d3.selectAll(t).on("click",function(){history.pushState(this.href,this.textContent,this.href),n(this.href),d3.event.preventDefault()}),d3.select(window).on("popstate",function(){d3.event.state&&n(d3.event.state)})},i.utils.calcApproxTextWidth=function(t){if(i.utils.isFunction(t.style)&&i.utils.isFunction(t.text)){var e=parseInt(t.style("font-size").replace("px",""),10),n=t.text().length;return i.utils.NaNtoZero(n*e*.5)}return 0},i.utils.NaNtoZero=function(t){return!i.utils.isNumber(t)||isNaN(t)||null===t||t===1/0||t===-1/0?0:t},d3.selection.prototype.watchTransition=function(t){var e=[this].concat([].slice.call(arguments,1));return t.transition.apply(t,e)},i.utils.renderWatch=function(t,e){if(!(this instanceof i.utils.renderWatch))return new i.utils.renderWatch(t,e);var n=void 0!==e?e:250,r=[],a=this;this.models=function(t){return[].slice.call(arguments,0).forEach(function(t){t.__rendered=!1,function(t){t.dispatch.on("renderEnd",function(e){t.__rendered=!0,a.renderEnd("model")})}(t),r.indexOf(t)<0&&r.push(t)}),this},this.reset=function(t){void 0!==t&&(n=t),r=[]},this.transition=function(t,e,i){if(i=(e=arguments.length>1?[].slice.call(arguments,1):[]).length>1?e.pop():void 0!==n?n:250,t.__rendered=!1,r.indexOf(t)<0&&r.push(t),0===i)return t.__rendered=!0,t.delay=function(){return this},t.duration=function(){return this},t;0===t.length?t.__rendered=!0:t.every(function(t){return!t.length})?t.__rendered=!0:t.__rendered=!1;var o=0;return t.transition().duration(i).each(function(){++o}).each("end",function(n,i){0==--o&&(t.__rendered=!0,a.renderEnd.apply(this,e))})},this.renderEnd=function(){r.every(function(t){return t.__rendered})&&(r.forEach(function(t){t.__rendered=!1}),t.renderEnd.apply(this,arguments))}},i.utils.deepExtend=function(t){(arguments.length>1?[].slice.call(arguments,1):[]).forEach(function(e){for(var n in e){var r=i.utils.isArray(t[n]),a=i.utils.isObject(t[n]),o=i.utils.isObject(e[n]);a&&!r&&o?i.utils.deepExtend(t[n],e[n]):t[n]=e[n]}})},i.utils.state=function(){if(!(this instanceof i.utils.state))return new i.utils.state;var t={},e=function(){},n=function(){return{}},r=null;this.dispatch=d3.dispatch("change","set"),this.dispatch.on("set",function(t){e(t,!0)}),this.getter=function(t){return n=t,this},this.setter=function(t,n){return n||(n=function(){}),e=function(e,i){t(e),i&&n()},this},this.init=function(t){r=r||{},i.utils.deepExtend(r,t)};this.update=function(){r&&(e(r,!1),r=null),function(){var e=n();if(JSON.stringify(e)===JSON.stringify(t))return!1;for(var i in e)void 0===t[i]&&(t[i]={}),t[i]=e[i],!0;return!0}.call(this)&&this.dispatch.change(t)}},i.utils.optionsFunc=function(t){return t&&d3.map(t).forEach(function(t,e){i.utils.isFunction(this[t])&&this[t](e)}.bind(this)),this},i.utils.calcTicksX=function(t,e){for(var n=1,r=0;r<e.length;r+=1){var a=e[r]&&e[r].values?e[r].values.length:0;n=a>n?a:n}return i.log("Requested number of ticks: ",t),i.log("Calculated max values to be: ",n),t=(t=t>n?t=n-1:t)<1?1:t,t=Math.floor(t),i.log("Calculating tick count as: ",t),t},i.utils.calcTicksY=function(t,e,n){if(n){for(var r=1,a=0;a<e.length;a+=1)for(var o,s=e[a]&&e[a].values?e[a].values:[],l=0;l<s.length;l+=1)r=(o=s[l]&&n(s[l])?n(s[l]):0)>r?o:r;return i.log("Requested number of ticks: ",t),i.log("Calculated max values to be: ",r),t=(t=t>r?r-1:t)<1?1:t,t=Math.floor(t),i.log("Calculating tick count as: ",t),t}return i.utils.calcTicksX(t,e)},i.utils.initOption=function(t,e){t._calls&&t._calls[e]?t[e]=t._calls[e]:(t[e]=function(n){return arguments.length?(t._overrides[e]=!0,t._options[e]=n,t):t._options[e]},t["_"+e]=function(n){return arguments.length?(t._overrides[e]||(t._options[e]=n),t):t._options[e]})},i.utils.initOptions=function(t){t._overrides=t._overrides||{};var e=Object.getOwnPropertyNames(t._options||{}),n=Object.getOwnPropertyNames(t._calls||{});for(var r in e=e.concat(n))i.utils.initOption(t,e[r])},i.utils.inheritOptionsD3=function(t,e,n){t._d3options=n.concat(t._d3options||[]),t._d3options=(t._d3options||[]).filter(function(t,e,n){return n.indexOf(t)===e}),n.unshift(e),n.unshift(t),d3.rebind.apply(this,n)},i.utils.arrayUnique=function(t){return t.sort().filter(function(e,n){return!n||e!=t[n-1]})},i.utils.symbolMap=d3.map(),i.utils.symbol=function(){var t,e=64;function n(n,r){var a=t.call(this,n,r),o=e.call(this,n,r);return-1!==d3.svg.symbolTypes.indexOf(a)?d3.svg.symbol().type(a).size(o)():i.utils.symbolMap.get(a)(o)}return n.type=function(e){return arguments.length?(t=d3.functor(e),n):t},n.size=function(t){return arguments.length?(e=d3.functor(t),n):e},n},i.utils.inheritOptions=function(t,e){var n=Object.getOwnPropertyNames(e._options||{}),r=Object.getOwnPropertyNames(e._calls||{}),a=e._inherited||[],o=e._d3options||[],s=n.concat(r).concat(a).concat(o);s.unshift(e),s.unshift(t),d3.rebind.apply(this,s),t._inherited=i.utils.arrayUnique(n.concat(r).concat(a).concat(n).concat(t._inherited||[])),t._d3options=i.utils.arrayUnique(o.concat(t._d3options||[]))},i.utils.initSVG=function(t){t.classed({"nvd3-svg":!0})},i.utils.sanitizeHeight=function(t,e){return t||parseInt(e.style("height"),10)||400},i.utils.sanitizeWidth=function(t,e){return t||parseInt(e.style("width"),10)||960},i.utils.availableHeight=function(t,e,n){return Math.max(0,i.utils.sanitizeHeight(t,e)-n.top-n.bottom)},i.utils.availableWidth=function(t,e,n){return Math.max(0,i.utils.sanitizeWidth(t,e)-n.left-n.right)},i.utils.noData=function(t,e){var n=t.options(),r=n.margin(),a=n.noData(),o=null==a?["No Data Available."]:[a],s=i.utils.availableHeight(null,e,r),l=i.utils.availableWidth(null,e,r),u=r.left+l/2,c=r.top+s/2;e.selectAll("g").remove();var d=e.selectAll(".nv-noData").data(o);d.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),d.attr("x",u).attr("y",c).text(function(t){return t})},i.utils.wrapTicks=function(t,e){t.each(function(){for(var t,n=d3.select(this),i=n.text().split(/\s+/).reverse(),r=[],a=0,o=n.attr("y"),s=parseFloat(n.attr("dy")),l=n.text(null).append("tspan").attr("x",0).attr("y",o).attr("dy",s+"em");t=i.pop();)r.push(t),l.text(r.join(" ")),l.node().getComputedTextLength()>e&&(r.pop(),l.text(r.join(" ")),r=[t],l=n.append("tspan").attr("x",0).attr("y",o).attr("dy",1.1*++a+s+"em").text(t))})},i.utils.arrayEquals=function(t,e){if(t===e)return!0;if(!t||!e)return!1;if(t.length!=e.length)return!1;for(var n=0,r=t.length;n<r;n++)if(t[n]instanceof Array&&e[n]instanceof Array){if(!i.arrayEquals(t[n],e[n]))return!1}else if(t[n]!=e[n])return!1;return!0},i.utils.pointIsInArc=function(t,e,n){var i=n.innerRadius()(e),r=n.outerRadius()(e),a=n.startAngle()(e),o=n.endAngle()(e),s=t.x*t.x+t.y*t.y,l=Math.atan2(t.x,-t.y);return l=l<0?l+2*Math.PI:l,i*i<=s&&s<=r*r&&a<=l&&l<=o},i.models.axis=function(){"use strict";var t,e,n=d3.svg.axis(),r=d3.scale.linear(),a={top:0,right:0,bottom:0,left:0},o=75,s=60,l=null,u=!0,c=0,d=!0,h=!1,f=!1,m=null,p=0,g=void 0,v=250,_=d3.dispatch("renderEnd");n.scale(r).orient("bottom").tickFormat(function(t){return t});var y=i.utils.renderWatch(_,v);function b(s){return y.reset(),s.each(function(s){var v=d3.select(this);i.utils.initSVG(v);var _=v.selectAll("g.nv-wrap.nv-axis").data([s]),b=(_.enter().append("g").attr("class","nvd3 nv-wrap nv-axis").append("g"),_.select("g"));null!==m?n.ticks(m):"top"!=n.orient()&&"bottom"!=n.orient()||n.ticks(Math.abs(r.range()[1]-r.range()[0])/100),b.watchTransition(y,"axis").call(n),e=e||n.scale();var M=n.tickFormat();null==M&&(M=e.tickFormat());var x,w,k,L=b.selectAll("text.nv-axislabel").data([l||null]);switch(L.exit().remove(),void 0!==g&&b.selectAll("g").select("text").style("font-size",g),n.orient()){case"top":x=p+36,L.enter().append("text").attr("class","nv-axislabel"),k=0,1===r.range().length?k=f?2*r.range()[0]+r.rangeBand():0:2===r.range().length?k=f?r.range()[0]+r.range()[1]+r.rangeBand():r.range()[1]:r.range().length>2&&(k=r.range()[r.range().length-1]+(r.range()[1]-r.range()[0])),L.attr("text-anchor","middle").attr("y",-x).attr("x",k/2),u&&((w=_.selectAll("g.nv-axisMaxMin").data(r.domain())).enter().append("g").attr("class",function(t,e){return["nv-axisMaxMin","nv-axisMaxMin-x",0==e?"nv-axisMin-x":"nv-axisMax-x"].join(" ")}).append("text"),w.exit().remove(),w.attr("transform",function(t,e){return"translate("+i.utils.NaNtoZero(r(t))+",0)"}).select("text").attr("dy","-0.5em").attr("y",-n.tickPadding()).attr("text-anchor","middle").text(function(e,n){var i=(t||M)(e);return(""+i).match("NaN")?"":i}),w.watchTransition(y,"min-max top").attr("transform",function(t,e){return"translate("+i.utils.NaNtoZero(r.range()[e])+",0)"}));break;case"bottom":x=p+36;var S=30,T=0,Y=b.selectAll("g").select("text"),D="";if(c%360){Y.attr("transform",""),Y.each(function(t,e){var n=this.getBoundingClientRect(),i=n.width;T=n.height,i>S&&(S=i)}),D="rotate("+c+" 0,"+(T/2+n.tickPadding())+")";var C=Math.abs(Math.sin(c*Math.PI/180));x=(C?C*S:S)+30,Y.attr("transform",D).style("text-anchor",c%360>0?"start":"end")}else h?Y.attr("transform",function(t,e){return"translate(0,"+(e%2==0?"0":"12")+")"}):Y.attr("transform","translate(0,0)");L.enter().append("text").attr("class","nv-axislabel"),k=0,1===r.range().length?k=f?2*r.range()[0]+r.rangeBand():0:2===r.range().length?k=f?r.range()[0]+r.range()[1]+r.rangeBand():r.range()[1]:r.range().length>2&&(k=r.range()[r.range().length-1]+(r.range()[1]-r.range()[0])),L.attr("text-anchor","middle").attr("y",x).attr("x",k/2),u&&((w=_.selectAll("g.nv-axisMaxMin").data([r.domain()[0],r.domain()[r.domain().length-1]])).enter().append("g").attr("class",function(t,e){return["nv-axisMaxMin","nv-axisMaxMin-x",0==e?"nv-axisMin-x":"nv-axisMax-x"].join(" ")}).append("text"),w.exit().remove(),w.attr("transform",function(t,e){return"translate("+i.utils.NaNtoZero(r(t)+(f?r.rangeBand()/2:0))+",0)"}).select("text").attr("dy",".71em").attr("y",n.tickPadding()).attr("transform",D).style("text-anchor",c?c%360>0?"start":"end":"middle").text(function(e,n){var i=(t||M)(e);return(""+i).match("NaN")?"":i}),w.watchTransition(y,"min-max bottom").attr("transform",function(t,e){return"translate("+i.utils.NaNtoZero(r(t)+(f?r.rangeBand()/2:0))+",0)"}));break;case"right":L.enter().append("text").attr("class","nv-axislabel"),L.style("text-anchor",d?"middle":"begin").attr("transform",d?"rotate(90)":"").attr("y",d?12-Math.max(a.right,o)-(p||0):-10).attr("x",d?d3.max(r.range())/2:n.tickPadding()),u&&((w=_.selectAll("g.nv-axisMaxMin").data(r.domain())).enter().append("g").attr("class",function(t,e){return["nv-axisMaxMin","nv-axisMaxMin-y",0==e?"nv-axisMin-y":"nv-axisMax-y"].join(" ")}).append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(t,e){return"translate(0,"+i.utils.NaNtoZero(r(t))+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",n.tickPadding()).style("text-anchor","start").text(function(e,n){var i=(t||M)(e);return(""+i).match("NaN")?"":i}),w.watchTransition(y,"min-max right").attr("transform",function(t,e){return"translate(0,"+i.utils.NaNtoZero(r.range()[e])+")"}).select("text").style("opacity",1));break;case"left":L.enter().append("text").attr("class","nv-axislabel"),L.style("text-anchor",d?"middle":"end").attr("transform",d?"rotate(-90)":"").attr("y",d?25-Math.max(a.left,o)-(p||0):-10).attr("x",d?-d3.max(r.range())/2:-n.tickPadding()),u&&((w=_.selectAll("g.nv-axisMaxMin").data(r.domain())).enter().append("g").attr("class",function(t,e){return["nv-axisMaxMin","nv-axisMaxMin-y",0==e?"nv-axisMin-y":"nv-axisMax-y"].join(" ")}).append("text").style("opacity",0),w.exit().remove(),w.attr("transform",function(t,n){return"translate(0,"+i.utils.NaNtoZero(e(t))+")"}).select("text").attr("dy",".32em").attr("y",0).attr("x",-n.tickPadding()).attr("text-anchor","end").text(function(e,n){var i=(t||M)(e);return(""+i).match("NaN")?"":i}),w.watchTransition(y,"min-max right").attr("transform",function(t,e){return"translate(0,"+i.utils.NaNtoZero(r.range()[e])+")"}).select("text").style("opacity",1))}if(L.text(function(t){return t}),!u||"left"!==n.orient()&&"right"!==n.orient()||(b.selectAll("g").each(function(t,e){d3.select(this).select("text").attr("opacity",1),(r(t)<r.range()[1]+10||r(t)>r.range()[0]-10)&&((t>1e-10||t<-1e-10)&&d3.select(this).attr("opacity",0),d3.select(this).select("text").attr("opacity",0))}),r.domain()[0]==r.domain()[1]&&0==r.domain()[0]&&_.selectAll("g.nv-axisMaxMin").style("opacity",function(t,e){return e?0:1})),u&&("top"===n.orient()||"bottom"===n.orient())){var E=[];_.selectAll("g.nv-axisMaxMin").each(function(t,e){try{e?E.push(r(t)-this.getBoundingClientRect().width-4):E.push(r(t)+this.getBoundingClientRect().width+4)}catch(n){e?E.push(r(t)-4):E.push(r(t)+4)}}),b.selectAll("g").each(function(t,e){(r(t)<E[0]||r(t)>E[1])&&(t>1e-10||t<-1e-10?d3.select(this).remove():d3.select(this).select("text").remove())})}b.selectAll(".tick").filter(function(t){return!parseFloat(Math.round(1e5*t)/1e6)&&void 0!==t}).classed("zero",!0),e=r.copy()}),y.renderEnd("axis immediate"),b}return b.axis=n,b.dispatch=_,b.options=i.utils.optionsFunc.bind(b),b._options=Object.create({},{axisLabelDistance:{get:function(){return p},set:function(t){p=t}},staggerLabels:{get:function(){return h},set:function(t){h=t}},rotateLabels:{get:function(){return c},set:function(t){c=t}},rotateYLabel:{get:function(){return d},set:function(t){d=t}},showMaxMin:{get:function(){return u},set:function(t){u=t}},axisLabel:{get:function(){return l},set:function(t){l=t}},height:{get:function(){return s},set:function(t){s=t}},ticks:{get:function(){return m},set:function(t){m=t}},width:{get:function(){return o},set:function(t){o=t}},fontSize:{get:function(){return g},set:function(t){g=t}},tickFormatMaxMin:{get:function(){return t},set:function(e){t=e}},margin:{get:function(){return a},set:function(t){a.top=void 0!==t.top?t.top:a.top,a.right=void 0!==t.right?t.right:a.right,a.bottom=void 0!==t.bottom?t.bottom:a.bottom,a.left=void 0!==t.left?t.left:a.left}},duration:{get:function(){return v},set:function(t){v=t,y.reset(v)}},scale:{get:function(){return r},set:function(t){r=t,n.scale(r),f="function"==typeof r.rangeBands,i.utils.inheritOptionsD3(b,r,["domain","range","rangeBand","rangeBands"])}}}),i.utils.initOptions(b),i.utils.inheritOptionsD3(b,n,["orient","tickValues","tickSubdivide","tickSize","tickPadding","tickFormat"]),i.utils.inheritOptionsD3(b,r,["domain","range","rangeBand","rangeBands"]),b},i.models.boxPlot=function(){"use strict";var t,e,n,r,a,o,s={top:0,right:0,bottom:0,left:0},l=960,u=500,c=Math.floor(1e4*Math.random()),d=d3.scale.ordinal(),h=d3.scale.linear(),f=function(t){return t.label},m=function(t){return t.values.Q1},p=function(t){return t.values.Q2},g=function(t){return t.values.Q3},v=function(t){return t.values.whisker_low},_=function(t){return t.values.whisker_high},y=function(t){return t.color},b=function(t){return t.values.outliers},M=function(t,e,n){return t},x=function(t,e,n){return t},w=function(t,e,n){},k=i.utils.defaultColor(),L=null,S=d3.dispatch("elementMouseover","elementMouseout","elementMousemove","renderEnd"),T=250,Y=null,D=i.utils.renderWatch(S,T);function C(c){return D.reset(),c.each(function(c){var C=l-s.left-s.right,E=u-s.top-s.bottom;L=d3.select(this),i.utils.initSVG(L),d.domain(t||c.map(function(t,e){return f(t,e)})).rangeBands(e||[0,C],.1);var A=[];if(!n){var O=[];c.forEach(function(t,e){var n=m(t),i=g(t),r=v(t),a=_(t),o=b(t);o&&o.forEach(function(t,e){O.push(M(t,e,void 0))}),r&&O.push(r),n&&O.push(n),i&&O.push(i),a&&O.push(a)}),A=[d3.min(O),d3.max(O)]}h.domain(n||A),h.range(r||[E,0]),a=a||d,o=o||h.copy().range([h(0),h(0)]);var j=L.selectAll("g.nv-wrap").data([c]);j.enter().append("g").attr("class","nvd3 nv-wrap");j.attr("transform","translate("+s.left+","+s.top+")");var N=j.selectAll(".nv-boxplot").data(function(t){return t}),H=N.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);N.attr("class","nv-boxplot").attr("transform",function(t,e,n){return"translate("+(d(f(t,e))+.05*d.rangeBand())+", 0)"}).classed("hover",function(t){return t.hover}),N.watchTransition(D,"nv-boxplot: boxplots").style("stroke-opacity",1).style("fill-opacity",.75).delay(function(t,e){return e*T/c.length}).attr("transform",function(t,e){return"translate("+(d(f(t,e))+.05*d.rangeBand())+", 0)"}),N.exit().remove(),H.each(function(t,e){var n=d3.select(this);[v,_].forEach(function(i){if(void 0!==i(t)&&null!==i(t)){var r=i===v?"low":"high";n.append("line").style("stroke",y(t)||k(t,e)).attr("class","nv-boxplot-whisker nv-boxplot-"+r),n.append("line").style("stroke",y(t)||k(t,e)).attr("class","nv-boxplot-tick nv-boxplot-"+r)}})});var V=function(){return null===Y?.9*d.rangeBand():Math.min(75,.9*d.rangeBand())},P=function(){return.45*d.rangeBand()-V()/2},F=function(){return.45*d.rangeBand()+V()/2};[v,_].forEach(function(t){var e=t===v?"low":"high",n=t===v?m:g;N.select("line.nv-boxplot-whisker.nv-boxplot-"+e).watchTransition(D,"nv-boxplot: boxplots").attr("x1",.45*d.rangeBand()).attr("y1",function(e,n){return h(t(e))}).attr("x2",.45*d.rangeBand()).attr("y2",function(t,e){return h(n(t))}),N.select("line.nv-boxplot-tick.nv-boxplot-"+e).watchTransition(D,"nv-boxplot: boxplots").attr("x1",P).attr("y1",function(e,n){return h(t(e))}).attr("x2",F).attr("y2",function(e,n){return h(t(e))})}),[v,_].forEach(function(t){var e=t===v?"low":"high";H.selectAll(".nv-boxplot-"+e).on("mouseover",function(e,n,i){d3.select(this).classed("hover",!0),S.elementMouseover({series:{key:t(e),color:y(e)||k(e,i)},e:d3.event})}).on("mouseout",function(e,n,i){d3.select(this).classed("hover",!1),S.elementMouseout({series:{key:t(e),color:y(e)||k(e,i)},e:d3.event})}).on("mousemove",function(t,e){S.elementMousemove({e:d3.event})})}),H.append("rect").attr("class","nv-boxplot-box").on("mouseover",function(t,e){d3.select(this).classed("hover",!0),S.elementMouseover({key:f(t),value:f(t),series:[{key:"Q3",value:g(t),color:y(t)||k(t,e)},{key:"Q2",value:p(t),color:y(t)||k(t,e)},{key:"Q1",value:m(t),color:y(t)||k(t,e)}],data:t,index:e,e:d3.event})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),S.elementMouseout({key:f(t),value:f(t),series:[{key:"Q3",value:g(t),color:y(t)||k(t,e)},{key:"Q2",value:p(t),color:y(t)||k(t,e)},{key:"Q1",value:m(t),color:y(t)||k(t,e)}],data:t,index:e,e:d3.event})}).on("mousemove",function(t,e){S.elementMousemove({e:d3.event})}),N.select("rect.nv-boxplot-box").watchTransition(D,"nv-boxplot: boxes").attr("y",function(t,e){return h(g(t))}).attr("width",V).attr("x",P).attr("height",function(t,e){return Math.abs(h(g(t))-h(m(t)))||1}).style("fill",function(t,e){return y(t)||k(t,e)}).style("stroke",function(t,e){return y(t)||k(t,e)}),H.append("line").attr("class","nv-boxplot-median"),N.select("line.nv-boxplot-median").watchTransition(D,"nv-boxplot: boxplots line").attr("x1",P).attr("y1",function(t,e){return h(p(t))}).attr("x2",F).attr("y2",function(t,e){return h(p(t))});var I=N.selectAll(".nv-boxplot-outlier").data(function(t){return b(t)||[]});I.enter().append("circle").style("fill",function(t,e,n){return w(t,e,n)||k(t,n)}).style("stroke",function(t,e,n){return w(t,e,n)||k(t,n)}).style("z-index",9e3).on("mouseover",function(t,e,n){d3.select(this).classed("hover",!0),S.elementMouseover({series:{key:x(t,e,n),color:w(t,e,n)||k(t,n)},e:d3.event})}).on("mouseout",function(t,e,n){d3.select(this).classed("hover",!1),S.elementMouseout({series:{key:x(t,e,n),color:w(t,e,n)||k(t,n)},e:d3.event})}).on("mousemove",function(t,e){S.elementMousemove({e:d3.event})}),I.attr("class","nv-boxplot-outlier"),I.watchTransition(D,"nv-boxplot: nv-boxplot-outlier").attr("cx",.45*d.rangeBand()).attr("cy",function(t,e,n){return h(M(t,e,n))}).attr("r","3"),I.exit().remove(),a=d.copy(),o=h.copy()}),D.renderEnd("nv-boxplot immediate"),C}return C.dispatch=S,C.options=i.utils.optionsFunc.bind(C),C._options=Object.create({},{width:{get:function(){return l},set:function(t){l=t}},height:{get:function(){return u},set:function(t){u=t}},maxBoxWidth:{get:function(){return Y},set:function(t){Y=t}},x:{get:function(){return f},set:function(t){f=t}},q1:{get:function(){return m},set:function(t){m=t}},q2:{get:function(){return p},set:function(t){p=t}},q3:{get:function(){return g},set:function(t){g=t}},wl:{get:function(){return v},set:function(t){v=t}},wh:{get:function(){return _},set:function(t){_=t}},itemColor:{get:function(){return y},set:function(t){y=t}},outliers:{get:function(){return b},set:function(t){b=t}},outlierValue:{get:function(){return M},set:function(t){M=t}},outlierLabel:{get:function(){return x},set:function(t){x=t}},outlierColor:{get:function(){return w},set:function(t){w=t}},xScale:{get:function(){return d},set:function(t){d=t}},yScale:{get:function(){return h},set:function(t){h=t}},xDomain:{get:function(){return t},set:function(e){t=e}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return e},set:function(t){e=t}},yRange:{get:function(){return r},set:function(t){r=t}},id:{get:function(){return c},set:function(t){c=t}},y:{get:function(){return console.warn("BoxPlot 'y' chart option is deprecated. Please use model overrides instead."),{}},set:function(t){console.warn("BoxPlot 'y' chart option is deprecated. Please use model overrides instead.")}},margin:{get:function(){return s},set:function(t){s.top=void 0!==t.top?t.top:s.top,s.right=void 0!==t.right?t.right:s.right,s.bottom=void 0!==t.bottom?t.bottom:s.bottom,s.left=void 0!==t.left?t.left:s.left}},color:{get:function(){return k},set:function(t){k=i.utils.getColor(t)}},duration:{get:function(){return T},set:function(t){T=t,D.reset(T)}}}),i.utils.initOptions(C),C},i.models.boxPlotChart=function(){"use strict";var t,e,n=i.models.boxPlot(),r=i.models.axis(),a=i.models.axis(),o={top:15,right:10,bottom:50,left:60},s=null,l=null,u=i.utils.getColor(),c=!0,d=!0,h=!1,f=!1,m=i.models.tooltip(),p="No Data Available.",g=d3.dispatch("beforeUpdate","renderEnd"),v=250;r.orient("bottom").showMaxMin(!1).tickFormat(function(t){return t}),a.orient(h?"right":"left").tickFormat(d3.format(",.1f")),m.duration(0);var _=i.utils.renderWatch(g,v);function y(u){return _.reset(),_.models(n),c&&_.models(r),d&&_.models(a),u.each(function(u){var m=d3.select(this);i.utils.initSVG(m);var _=(s||parseInt(m.style("width"))||960)-o.left-o.right,b=(l||parseInt(m.style("height"))||400)-o.top-o.bottom;if(y.update=function(){g.beforeUpdate(),m.transition().duration(v).call(y)},y.container=this,!u||!u.length){var M=m.selectAll(".nv-noData").data([p]);return M.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),M.attr("x",o.left+_/2).attr("y",o.top+b/2).text(function(t){return t}),y}m.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale().clamp(!0);var x=m.selectAll("g.nv-wrap.nv-boxPlotWithAxes").data([u]),w=x.enter().append("g").attr("class","nvd3 nv-wrap nv-boxPlotWithAxes").append("g"),k=w.append("defs"),L=x.select("g");if(w.append("g").attr("class","nv-x nv-axis"),w.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),w.append("g").attr("class","nv-barsWrap"),L.attr("transform","translate("+o.left+","+o.top+")"),h&&L.select(".nv-y.nv-axis").attr("transform","translate("+_+",0)"),n.width(_).height(b),L.select(".nv-barsWrap").datum(u.filter(function(t){return!t.disabled})).transition().call(n),k.append("clipPath").attr("id","nv-x-label-clip-"+n.id()).append("rect"),L.select("#nv-x-label-clip-"+n.id()+" rect").attr("width",t.rangeBand()*(f?2:1)).attr("height",16).attr("x",-t.rangeBand()/(f?1:2)),c){r.scale(t).ticks(i.utils.calcTicksX(_/100,u)).tickSize(-b,0),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),L.select(".nv-x.nv-axis").call(r);var S=L.select(".nv-x.nv-axis").selectAll("g");f&&S.selectAll("text").attr("transform",function(t,e,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}d&&(a.scale(e).ticks(Math.floor(b/36)).tickSize(-_,0),L.select(".nv-y.nv-axis").call(a)),L.select(".nv-zeroLine line").attr("x1",0).attr("x2",_).attr("y1",e(0)).attr("y2",e(0))}),_.renderEnd("nv-boxplot chart immediate"),y}return n.dispatch.on("elementMouseover.tooltip",function(t){m.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){m.data(t).hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){m()}),y.dispatch=g,y.boxplot=n,y.xAxis=r,y.yAxis=a,y.tooltip=m,y.options=i.utils.optionsFunc.bind(y),y._options=Object.create({},{width:{get:function(){return s},set:function(t){s=t}},height:{get:function(){return l},set:function(t){l=t}},staggerLabels:{get:function(){return f},set:function(t){f=t}},showXAxis:{get:function(){return c},set:function(t){c=t}},showYAxis:{get:function(){return d},set:function(t){d=t}},tooltipContent:{get:function(){return m},set:function(t){m=t}},noData:{get:function(){return p},set:function(t){p=t}},margin:{get:function(){return o},set:function(t){o.top=void 0!==t.top?t.top:o.top,o.right=void 0!==t.right?t.right:o.right,o.bottom=void 0!==t.bottom?t.bottom:o.bottom,o.left=void 0!==t.left?t.left:o.left}},duration:{get:function(){return v},set:function(t){v=t,_.reset(v),n.duration(v),r.duration(v),a.duration(v)}},color:{get:function(){return u},set:function(t){u=i.utils.getColor(t),n.color(u)}},rightAlignYAxis:{get:function(){return h},set:function(t){h=t,a.orient(t?"right":"left")}}}),i.utils.inheritOptions(y,n),i.utils.initOptions(y),y},i.models.bullet=function(){"use strict";var t={top:0,right:0,bottom:0,left:0},e="left",n=!1,r=function(t){return t.ranges},a=function(t){return t.markers?t.markers:[]},o=function(t){return t.markerLines?t.markerLines:[0]},s=function(t){return t.measures},l=function(t){return t.rangeLabels?t.rangeLabels:[]},u=function(t){return t.markerLabels?t.markerLabels:[]},c=function(t){return t.markerLineLabels?t.markerLineLabels:[]},d=function(t){return t.measureLabels?t.measureLabels:[]},h=[0],f=380,m=30,p=null,g=null,v=i.utils.getColor(["#1f77b4"]),_=d3.dispatch("elementMouseover","elementMouseout","elementMousemove"),y=["Maximum","Mean","Minimum"],b=["Max","Avg","Min"],M=1e3;function x(t,e){var n=t.slice();t.sort(function(t,i){var r=n.indexOf(t),a=n.indexOf(i);return d3.descending(e[r],e[a])})}function w(e){return e.each(function(e,g){var w=f-t.left-t.right,k=m-t.top-t.bottom;p=d3.select(this),i.utils.initSVG(p);var L=r.call(this,e,g).slice(),S=a.call(this,e,g).slice(),T=o.call(this,e,g).slice(),Y=s.call(this,e,g).slice(),D=l.call(this,e,g).slice(),C=u.call(this,e,g).slice(),E=c.call(this,e,g).slice(),A=d.call(this,e,g).slice();x(D,L),x(C,S),x(E,T),x(A,Y),L.sort(d3.descending),S.sort(d3.descending),T.sort(d3.descending),Y.sort(d3.descending);var O=d3.scale.linear().domain(d3.extent(d3.merge([h,L]))).range(n?[w,0]:[0,w]);this.__chart__||d3.scale.linear().domain([0,1/0]).range(O.range());this.__chart__=O;d3.min(L),d3.max(L),L[1];for(var j=p.selectAll("g.nv-wrap.nv-bullet").data([e]),N=j.enter().append("g").attr("class","nvd3 nv-wrap nv-bullet").append("g"),H=j.select("g"),V=(g=0,L.length);g<V;g++){var P="nv-range nv-range"+g;g<=2&&(P=P+" nv-range"+b[g]),N.append("rect").attr("class",P)}N.append("rect").attr("class","nv-measure"),j.attr("transform","translate("+t.left+","+t.top+")");var F=function(t){return Math.abs(O(t)-O(0))},I=function(t){return O(t<0?t:0)};for(g=0,V=L.length;g<V;g++){var R=L[g];H.select("rect.nv-range"+g).datum(R).attr("height",k).transition().duration(M).attr("width",F(R)).attr("x",I(R))}H.select("rect.nv-measure").style("fill",v).attr("height",k/3).attr("y",k/3).on("mouseover",function(){_.elementMouseover({value:Y[0],label:A[0]||"Current",color:d3.select(this).style("fill")})}).on("mousemove",function(){_.elementMousemove({value:Y[0],label:A[0]||"Current",color:d3.select(this).style("fill")})}).on("mouseout",function(){_.elementMouseout({value:Y[0],label:A[0]||"Current",color:d3.select(this).style("fill")})}).transition().duration(M).attr("width",Y<0?O(0)-O(Y[0]):O(Y[0])-O(0)).attr("x",I(Y));var W=k/6,z=S.map(function(t,e){return{value:t,label:C[e]}});N.selectAll("path.nv-markerTriangle").data(z).enter().append("path").attr("class","nv-markerTriangle").attr("d","M0,"+W+"L"+W+","+-W+" "+-W+","+-W+"Z").on("mouseover",function(t){_.elementMouseover({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill"),pos:[O(t.value),k/2]})}).on("mousemove",function(t){_.elementMousemove({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){_.elementMouseout({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill")})}),H.selectAll("path.nv-markerTriangle").data(z).transition().duration(M).attr("transform",function(t){return"translate("+O(t.value)+","+k/2+")"});var B=T.map(function(t,e){return{value:t,label:E[e]}});N.selectAll("line.nv-markerLine").data(B).enter().append("line").attr("cursor","").attr("class","nv-markerLine").attr("x1",function(t){return O(t.value)}).attr("y1","2").attr("x2",function(t){return O(t.value)}).attr("y2",k-2).on("mouseover",function(t){_.elementMouseover({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill"),pos:[O(t.value),k/2]})}).on("mousemove",function(t){_.elementMousemove({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){_.elementMouseout({value:t.value,label:t.label||"Previous",color:d3.select(this).style("fill")})}),H.selectAll("line.nv-markerLine").data(B).transition().duration(M).attr("x1",function(t){return O(t.value)}).attr("x2",function(t){return O(t.value)}),j.selectAll(".nv-range").on("mouseover",function(t,e){var n=D[e]||y[e];_.elementMouseover({value:t,label:n,color:d3.select(this).style("fill")})}).on("mousemove",function(){_.elementMousemove({value:Y[0],label:A[0]||"Previous",color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){var n=D[e]||y[e];_.elementMouseout({value:t,label:n,color:d3.select(this).style("fill")})})}),w}return w.dispatch=_,w.options=i.utils.optionsFunc.bind(w),w._options=Object.create({},{ranges:{get:function(){return r},set:function(t){r=t}},markers:{get:function(){return a},set:function(t){a=t}},measures:{get:function(){return s},set:function(t){s=t}},forceX:{get:function(){return h},set:function(t){h=t}},width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return m},set:function(t){m=t}},tickFormat:{get:function(){return g},set:function(t){g=t}},duration:{get:function(){return M},set:function(t){M=t}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},orient:{get:function(){return e},set:function(t){n="right"==(e=t)||"bottom"==e}},color:{get:function(){return v},set:function(t){v=i.utils.getColor(t)}}}),i.utils.initOptions(w),w},i.models.bulletChart=function(){"use strict";var t=i.models.bullet(),e=i.models.tooltip(),n="left",r=!1,a={top:5,right:40,bottom:20,left:120},o=function(t){return t.ranges},s=function(t){return t.markers?t.markers:[]},l=function(t){return t.measures},u=null,c=55,d=null,h=null,f=null,m=d3.dispatch();function p(e){return e.each(function(n,f){var m=d3.select(this);i.utils.initSVG(m);var g=i.utils.availableWidth(u,m,a),v=c-a.top-a.bottom;if(p.update=function(){p(e)},p.container=this,!n||!o.call(this,n,f))return i.utils.noData(p,m),p;m.selectAll(".nv-noData").remove();var _=o.call(this,n,f).slice().sort(d3.descending),y=s.call(this,n,f).slice().sort(d3.descending),b=l.call(this,n,f).slice().sort(d3.descending),M=m.selectAll("g.nv-wrap.nv-bulletChart").data([n]),x=M.enter().append("g").attr("class","nvd3 nv-wrap nv-bulletChart").append("g"),w=M.select("g");x.append("g").attr("class","nv-bulletWrap"),x.append("g").attr("class","nv-titles"),M.attr("transform","translate("+a.left+","+a.top+")");var k=d3.scale.linear().domain([0,Math.max(_[0],y[0]||0,b[0])]).range(r?[g,0]:[0,g]),L=this.__chart__||d3.scale.linear().domain([0,1/0]).range(k.range());this.__chart__=k;var S=x.select(".nv-titles").append("g").attr("text-anchor","end").attr("transform","translate(-6,"+(c-a.top-a.bottom)/2+")");S.append("text").attr("class","nv-title").text(function(t){return t.title}),S.append("text").attr("class","nv-subtitle").attr("dy","1em").text(function(t){return t.subtitle}),t.width(g).height(v);var T=w.select(".nv-bulletWrap");d3.transition(T).call(t);var Y=d||k.tickFormat(g/100),D=w.selectAll("g.nv-tick").data(k.ticks(h||g/50),function(t){return this.textContent||Y(t)}),C=D.enter().append("g").attr("class","nv-tick").attr("transform",function(t){return"translate("+L(t)+",0)"}).style("opacity",1e-6);C.append("line").attr("y1",v).attr("y2",7*v/6),C.append("text").attr("text-anchor","middle").attr("dy","1em").attr("y",7*v/6).text(Y);var E=d3.transition(D).transition().duration(t.duration()).attr("transform",function(t){return"translate("+k(t)+",0)"}).style("opacity",1);E.select("line").attr("y1",v).attr("y2",7*v/6),E.select("text").attr("y",7*v/6),d3.transition(D.exit()).transition().duration(t.duration()).attr("transform",function(t){return"translate("+k(t)+",0)"}).style("opacity",1e-6).remove()}),d3.timer.flush(),p}return e.duration(0).headerEnabled(!1),t.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:t.label,value:t.value,color:t.color},e.data(t).hidden(!1)}),t.dispatch.on("elementMouseout.tooltip",function(t){e.hidden(!0)}),t.dispatch.on("elementMousemove.tooltip",function(t){e()}),p.bullet=t,p.dispatch=m,p.tooltip=e,p.options=i.utils.optionsFunc.bind(p),p._options=Object.create({},{ranges:{get:function(){return o},set:function(t){o=t}},markers:{get:function(){return s},set:function(t){s=t}},measures:{get:function(){return l},set:function(t){l=t}},width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},tickFormat:{get:function(){return d},set:function(t){d=t}},ticks:{get:function(){return h},set:function(t){h=t}},noData:{get:function(){return f},set:function(t){f=t}},margin:{get:function(){return a},set:function(t){a.top=void 0!==t.top?t.top:a.top,a.right=void 0!==t.right?t.right:a.right,a.bottom=void 0!==t.bottom?t.bottom:a.bottom,a.left=void 0!==t.left?t.left:a.left}},orient:{get:function(){return n},set:function(t){r="right"==(n=t)||"bottom"==n}}}),i.utils.inheritOptions(p,t),i.utils.initOptions(p),p},i.models.candlestickBar=function(){"use strict";var t,e,n,r,a,o={top:0,right:0,bottom:0,left:0},s=null,l=null,u=Math.floor(1e4*Math.random()),c=d3.scale.linear(),d=d3.scale.linear(),h=function(t){return t.x},f=function(t){return t.y},m=function(t){return t.open},p=function(t){return t.close},g=function(t){return t.high},v=function(t){return t.low},_=[],y=[],b=!1,M=!0,x=i.utils.defaultColor(),w=!1,k=d3.dispatch("stateChange","changeState","renderEnd","chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove");function L(x){return x.each(function(x){t=d3.select(this);var w=i.utils.availableWidth(s,t,o),L=i.utils.availableHeight(l,t,o);i.utils.initSVG(t);var S=w/x[0].values.length*.45;c.domain(e||d3.extent(x[0].values.map(h).concat(_))),b?c.range(r||[.5*w/x[0].values.length,w*(x[0].values.length-.5)/x[0].values.length]):c.range(r||[5+S/2,w-S/2-5]),d.domain(n||[d3.min(x[0].values.map(v).concat(y)),d3.max(x[0].values.map(g).concat(y))]).range(a||[L,0]),c.domain()[0]===c.domain()[1]&&(c.domain()[0]?c.domain([c.domain()[0]-.01*c.domain()[0],c.domain()[1]+.01*c.domain()[1]]):c.domain([-1,1])),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]+.01*d.domain()[0],d.domain()[1]-.01*d.domain()[1]]):d.domain([-1,1]));var T=d3.select(this).selectAll("g.nv-wrap.nv-candlestickBar").data([x[0].values]),Y=T.enter().append("g").attr("class","nvd3 nv-wrap nv-candlestickBar"),D=Y.append("defs"),C=Y.append("g"),E=T.select("g");C.append("g").attr("class","nv-ticks"),T.attr("transform","translate("+o.left+","+o.top+")"),t.on("click",function(t,e){k.chartClick({data:t,index:e,pos:d3.event,id:u})}),D.append("clipPath").attr("id","nv-chart-clip-path-"+u).append("rect"),T.select("#nv-chart-clip-path-"+u+" rect").attr("width",w).attr("height",L),E.attr("clip-path",M?"url(#nv-chart-clip-path-"+u+")":"");var A=T.select(".nv-ticks").selectAll(".nv-tick").data(function(t){return t});A.exit().remove();var O=A.enter().append("g");A.attr("class",function(t,e,n){return(m(t,e)>p(t,e)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+e});O.append("line").attr("class","nv-candlestick-lines").attr("transform",function(t,e){return"translate("+c(h(t,e))+",0)"}).attr("x1",0).attr("y1",function(t,e){return d(g(t,e))}).attr("x2",0).attr("y2",function(t,e){return d(v(t,e))}),O.append("rect").attr("class","nv-candlestick-rects nv-bars").attr("transform",function(t,e){return"translate("+(c(h(t,e))-S/2)+","+(d(f(t,e))-(m(t,e)>p(t,e)?d(p(t,e))-d(m(t,e)):0))+")"}).attr("x",0).attr("y",0).attr("width",S).attr("height",function(t,e){var n=m(t,e),i=p(t,e);return n>i?d(i)-d(n):d(n)-d(i)});A.select(".nv-candlestick-lines").transition().attr("transform",function(t,e){return"translate("+c(h(t,e))+",0)"}).attr("x1",0).attr("y1",function(t,e){return d(g(t,e))}).attr("x2",0).attr("y2",function(t,e){return d(v(t,e))}),A.select(".nv-candlestick-rects").transition().attr("transform",function(t,e){return"translate("+(c(h(t,e))-S/2)+","+(d(f(t,e))-(m(t,e)>p(t,e)?d(p(t,e))-d(m(t,e)):0))+")"}).attr("x",0).attr("y",0).attr("width",S).attr("height",function(t,e){var n=m(t,e),i=p(t,e);return n>i?d(i)-d(n):d(n)-d(i)})}),L}return L.highlightPoint=function(e,n){L.clearHighlights(),t.select(".nv-candlestickBar .nv-tick-0-"+e).classed("hover",n)},L.clearHighlights=function(){t.select(".nv-candlestickBar .nv-tick.hover").classed("hover",!1)},L.dispatch=k,L.options=i.utils.optionsFunc.bind(L),L._options=Object.create({},{width:{get:function(){return s},set:function(t){s=t}},height:{get:function(){return l},set:function(t){l=t}},xScale:{get:function(){return c},set:function(t){c=t}},yScale:{get:function(){return d},set:function(t){d=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return r},set:function(t){r=t}},yRange:{get:function(){return a},set:function(t){a=t}},forceX:{get:function(){return _},set:function(t){_=t}},forceY:{get:function(){return y},set:function(t){y=t}},padData:{get:function(){return b},set:function(t){b=t}},clipEdge:{get:function(){return M},set:function(t){M=t}},id:{get:function(){return u},set:function(t){u=t}},interactive:{get:function(){return w},set:function(t){w=t}},x:{get:function(){return h},set:function(t){h=t}},y:{get:function(){return f},set:function(t){f=t}},open:{get:function(){return m()},set:function(t){m=t}},close:{get:function(){return p()},set:function(t){p=t}},high:{get:function(){return g},set:function(t){g=t}},low:{get:function(){return v},set:function(t){v=t}},margin:{get:function(){return o},set:function(t){o.top=void 0!=t.top?t.top:o.top,o.right=void 0!=t.right?t.right:o.right,o.bottom=void 0!=t.bottom?t.bottom:o.bottom,o.left=void 0!=t.left?t.left:o.left}},color:{get:function(){return x},set:function(t){x=i.utils.getColor(t)}}}),i.utils.initOptions(L),L},i.models.cumulativeLineChart=function(){"use strict";var t,e,n=i.models.line(),r=i.models.axis(),a=i.models.axis(),o=i.models.legend(),s=i.models.legend(),l=i.interactiveGuideline(),u=i.models.tooltip(),c={top:30,right:30,bottom:50,left:60},d=null,h=i.utils.defaultColor(),f=null,m=null,p=!0,g=!0,v=!0,_=!1,y=!0,b=!1,M=!0,x=n.id(),w=i.utils.state(),k=null,L=null,S=function(t){return t.average},T=d3.dispatch("stateChange","changeState","renderEnd"),Y=250,D=!1;w.index=0,w.rescaleY=M,r.orient("bottom").tickPadding(7),a.orient(_?"right":"left"),u.valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),s.updateState(!1);var C,E=d3.scale.linear(),A={i:0,x:0},O=i.utils.renderWatch(T,Y),j=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),index:A.i,rescaleY:M}}},N=function(t){return function(e){void 0!==e.index&&(A.i=e.index),void 0!==e.rescaleY&&(M=e.rescaleY),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function H(u){return O.reset(),O.models(n),g&&O.models(r),v&&O.models(a),u.each(function(u){var L=d3.select(this);i.utils.initSVG(L),L.classed("nv-chart-"+x,!0);var O,F=i.utils.availableWidth(f,L,c),I=i.utils.availableHeight(m,L,c);if(H.update=function(){0===Y?L.call(H):L.transition().duration(Y).call(H)},H.container=this,w.setter(N(u),H.update).getter(j(u)).update(),w.disabled=u.map(function(t){return!!t.disabled}),!k)for(O in k={},w)w[O]instanceof Array?k[O]=w[O].slice(0):k[O]=w[O];var R=d3.behavior.drag().on("dragstart",function(t,e){d3.select(H.container).style("cursor","ew-resize")}).on("drag",function(t,e){A.x=d3.event.x,A.i=Math.round(E.invert(A.x)),Q()}).on("dragend",function(t,e){d3.select(H.container).style("cursor","auto"),w.index=A.i,T.stateChange(w)});if(!(u&&u.length&&u.filter(function(t){return t.values.length}).length))return i.utils.noData(H,L),H;L.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale(),E.domain([0,u[0].values.length-1]).range([0,F]).clamp(!0);u=function(t,e){V||(V=n.y());return e.map(function(e,n){if(!e.values)return e;var i=e.values[t];if(null==i)return e;var r=V(i,t);return Math.abs(r)<1e-5&&!D?(e.tempDisabled=!0,e):(e.tempDisabled=!1,e.values=e.values.map(function(t,e){return t.display={y:(V(t,e)-r)/r},t}),e)})}(A.i,u);void 0===C&&(C=P(u)),M?n.yDomain(null):(n.yDomain(C),n.clipEdge(!0));var W=b?"none":"all",z=L.selectAll("g.nv-wrap.nv-cumulativeLine").data([u]),B=z.enter().append("g").attr("class","nvd3 nv-wrap nv-cumulativeLine").append("g"),U=z.select("g");if(B.append("g").attr("class","nv-interactive"),B.append("g").attr("class","nv-x nv-axis").style("pointer-events","none"),B.append("g").attr("class","nv-y nv-axis"),B.append("g").attr("class","nv-background"),B.append("g").attr("class","nv-linesWrap").style("pointer-events",W),B.append("g").attr("class","nv-avgLinesWrap").style("pointer-events","none"),B.append("g").attr("class","nv-legendWrap"),B.append("g").attr("class","nv-controlsWrap"),p?(o.width(F),U.select(".nv-legendWrap").datum(u).call(o),d||o.height()===c.top||(c.top=o.height(),I=i.utils.availableHeight(m,L,c)),U.select(".nv-legendWrap").attr("transform","translate(0,"+-c.top+")")):U.select(".nv-legendWrap").selectAll("*").remove(),y){var G=[{key:"Re-scale y-axis",disabled:!M}];s.width(140).color(["#444","#444","#444"]).rightAlign(!1).margin({top:5,right:0,bottom:5,left:20}),U.select(".nv-controlsWrap").datum(G).attr("transform","translate(0,"+-c.top+")").call(s)}else U.select(".nv-controlsWrap").selectAll("*").remove();z.attr("transform","translate("+c.left+","+c.top+")"),_&&U.select(".nv-y.nv-axis").attr("transform","translate("+F+",0)");var $=u.filter(function(t){return t.tempDisabled});z.select(".tempDisabled").remove(),$.length&&z.append("text").attr("class","tempDisabled").attr("x",F/2).attr("y","-.71em").style("text-anchor","end").text($.map(function(t){return t.key}).join(", ")+" values cannot be calculated for this time period."),b&&(l.width(F).height(I).margin({left:c.left,top:c.top}).svgContainer(L).xScale(t),z.select(".nv-interactive").call(l)),B.select(".nv-background").append("rect"),U.select(".nv-background rect").attr("width",F).attr("height",I),n.y(function(t){return t.display.y}).width(F).height(I).color(u.map(function(t,e){return t.color||h(t,e)}).filter(function(t,e){return!u[e].disabled&&!u[e].tempDisabled}));var q=U.select(".nv-linesWrap").datum(u.filter(function(t){return!t.disabled&&!t.tempDisabled}));q.call(n),u.forEach(function(t,e){t.seriesIndex=e});var J=u.filter(function(t){return!t.disabled&&!!S(t)}),X=U.select(".nv-avgLinesWrap").selectAll("line").data(J,function(t){return t.key}),Z=function(t){var n=e(S(t));return n<0?0:n>I?I:n};X.enter().append("line").style("stroke-width",2).style("stroke-dasharray","10,10").style("stroke",function(t,e){return n.color()(t,t.seriesIndex)}).attr("x1",0).attr("x2",F).attr("y1",Z).attr("y2",Z),X.style("stroke-opacity",function(t){var n=e(S(t));return n<0||n>I?0:1}).attr("x1",0).attr("x2",F).attr("y1",Z).attr("y2",Z),X.exit().remove();var K=q.selectAll(".nv-indexLine").data([A]);function Q(){K.data([A]);var t=H.duration();H.duration(0),H.update(),H.duration(t)}K.enter().append("rect").attr("class","nv-indexLine").attr("width",3).attr("x",-2).attr("fill","red").attr("fill-opacity",.5).style("pointer-events","all").call(R),K.attr("transform",function(t){return"translate("+E(t.i)+",0)"}).attr("height",I),g&&(r.scale(t)._ticks(i.utils.calcTicksX(F/70,u)).tickSize(-I,0),U.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),U.select(".nv-x.nv-axis").call(r)),v&&(a.scale(e)._ticks(i.utils.calcTicksY(I/36,u)).tickSize(-F,0),U.select(".nv-y.nv-axis").call(a)),U.select(".nv-background rect").on("click",function(){A.x=d3.mouse(this)[0],A.i=Math.round(E.invert(A.x)),w.index=A.i,T.stateChange(w),Q()}),n.dispatch.on("elementClick",function(t){A.i=t.pointIndex,A.x=E(A.i),w.index=A.i,T.stateChange(w),Q()}),s.dispatch.on("legendClick",function(t,e){t.disabled=!t.disabled,M=!t.disabled,w.rescaleY=M,M||(C=P(u)),T.stateChange(w),H.update()}),o.dispatch.on("stateChange",function(t){for(var e in t)w[e]=t[e];T.stateChange(w),H.update()}),l.dispatch.on("elementMousemove",function(t){n.clearHighlights();var e,o,s,c=[];if(u.filter(function(t,e){return t.seriesIndex=e,!(t.disabled||t.tempDisabled)}).forEach(function(r,a){o=i.interactiveBisect(r.values,t.pointXValue,H.x()),n.highlightPoint(a,o,!0);var l=r.values[o];void 0!==l&&(void 0===e&&(e=l),void 0===s&&(s=H.xScale()(H.x()(l,o))),c.push({key:r.key,value:H.y()(l,o),color:h(r,r.seriesIndex)}))}),c.length>2){var d=H.yScale().invert(t.mouseY),f=.03*Math.abs(H.yScale().domain()[0]-H.yScale().domain()[1]),m=i.nearestValueIndex(c.map(function(t){return t.value}),d,f);null!==m&&(c[m].highlight=!0)}var p=r.tickFormat()(H.x()(e,o),o);l.tooltip.valueFormatter(function(t,e){return a.tickFormat()(t)}).data({value:p,series:c})(),l.renderGuideLine(s)}),l.dispatch.on("elementMouseout",function(t){n.clearHighlights()}),T.on("changeState",function(t){void 0!==t.disabled&&(u.forEach(function(e,n){e.disabled=t.disabled[n]}),w.disabled=t.disabled),void 0!==t.index&&(A.i=t.index,A.x=E(A.i),w.index=t.index,K.data([A])),void 0!==t.rescaleY&&(M=t.rescaleY),H.update()})}),O.renderEnd("cumulativeLineChart immediate"),H}n.dispatch.on("elementMouseover.tooltip",function(t){var e={x:H.x()(t.point),y:H.y()(t.point),color:t.point.color};t.point=e,u.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){u.hidden(!0)});var V=null;function P(t){var e=t.filter(function(t){return!(t.disabled||t.tempDisabled)}).map(function(t,e){return d3.extent(t.values,function(t){return t.display.y})});return[d3.min(e,function(t){return t[0]}),d3.max(e,function(t){return t[1]})]}return H.dispatch=T,H.lines=n,H.legend=o,H.controls=s,H.xAxis=r,H.yAxis=a,H.interactiveLayer=l,H.state=w,H.tooltip=u,H.options=i.utils.optionsFunc.bind(H),H._options=Object.create({},{width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return m},set:function(t){m=t}},showControls:{get:function(){return y},set:function(t){y=t}},showLegend:{get:function(){return p},set:function(t){p=t}},average:{get:function(){return S},set:function(t){S=t}},defaultState:{get:function(){return k},set:function(t){k=t}},noData:{get:function(){return L},set:function(t){L=t}},showXAxis:{get:function(){return g},set:function(t){g=t}},showYAxis:{get:function(){return v},set:function(t){v=t}},noErrorCheck:{get:function(){return D},set:function(t){D=t}},rescaleY:{get:function(){return M},set:function(t){M=t,H.state.rescaleY=t}},margin:{get:function(){return c},set:function(t){void 0!==t.top&&(c.top=t.top,d=t.top),c.right=void 0!==t.right?t.right:c.right,c.bottom=void 0!==t.bottom?t.bottom:c.bottom,c.left=void 0!==t.left?t.left:c.left}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t),o.color(h)}},useInteractiveGuideline:{get:function(){return b},set:function(t){b=t,!0===t&&(H.interactive(!1),H.useVoronoi(!1))}},rightAlignYAxis:{get:function(){return _},set:function(t){_=t,a.orient(t?"right":"left")}},duration:{get:function(){return Y},set:function(t){Y=t,n.duration(Y),r.duration(Y),a.duration(Y),O.reset(Y)}}}),i.utils.inheritOptions(H,n),i.utils.initOptions(H),H},i.models.differenceChart=function(){"use strict";var t=void 0,e=i.models.multiChart(),n=i.models.focus(i.models.line()),r=function(t){return function(t){return void 0!==t}(t.y0)?t.y0:t.y},a=function(t){return t.x},o=function(t){return t.x},s="x",l=function(t){return t.y},u=300,c=null,d=null,h=null,f=null,m={top:30,right:50,bottom:20,left:70},p={top:0,right:0,bottom:0,left:0},g=!0,v="linear",_=1,y=d3.time.scale(),b=d3.time.format.multi([["%I:%M",function(t){return t.getMinutes()}],["%I %p",function(t){return t.getHours()}],["%a %d",function(t){return t.getDay()&&1!=t.getDate()}],["%b %d",function(t){return 1!=t.getDate()}],["%B",function(t){return t.getMonth()}],["%Y",function(){return!0}]]);function M(o){o.each(function(o){t=d3.select(this);var s=(o||[]).filter(function(t){return!t.disabled});if(!o||!s.length)return i.utils.noData(M,t),M;var l=x(o),g=i.utils.availableHeight(h,t,m)-n.height(),_=i.utils.availableWidth(f,t,m);t.attr("class","nv-differenceChart"),i.utils.initSVG(t),M.container=this,e.margin(m).color(d3.scale.category10().range()).y(r).width(f).height(g).interpolate(v).useInteractiveGuideline(!0),e.interactiveLayer.tooltip.valueFormatter(function(t,e,n){if(n.key===d||n.key===c){var i=Math.abs(n.data.y0-n.data.y1);return 0===i?"-":i}return t}),e.stack1.areaY1(function(t){return e.stack1.scatter.yScale()(t.display.y)}),e.stack1.transformData(function(t){t.display={y:t.y1,y0:t.y0}}),e.xAxis.scale(y),e.xAxis.tickFormat(b);var w=l.filter(function(t){return!t.disabled}).map(function(t){return t.values}),k=d3.extent(d3.merge(w),function(t){return a(t)});e.xAxis.domain(k).range([0,_]);var L=d3.extent(d3.merge(w),function(t){return r(t)});return e.yDomain1(L),e.yAxis1.tickFormat(d3.format(",.1f")),e.yAxis2.tickFormat(d3.format(",.1f")),n.width(_),n.margin(p),n.xScale(y.copy()),n.xAxis.tickFormat(b),n.xAxis.rotateLabels(0),t.append("g").attr("class","nv-focusWrap").style("display","initial").attr("transform","translate("+m.left+", "+(g+n.margin().top)+")").datum(l.filter(function(t){return"line"===t.type})).call(n),t.datum(l).call(e),n.dispatch.on("onBrush",function(n){var i=l.map(function(t){var e=-1,i=-1;t.values.some(function(t,r){return-1===e&&t.x>=n[0]&&(e=r),-1===i&&t.x>=n[1]&&(i=r,!0)});for(var r=t.values.slice(e,i),a=0;r.length<2&&a<5;)e-=1,i+=1,r=t.values.slice(e,i),a++;return Object.assign({},t,{values:r})});t.datum(i),e.xAxis.domain(n),e.update()}),M.update=function(){t.selectAll("*").remove(),0===u?t.call(M):t.transition().duration(u).call(M)},M})}function x(t){var e=t.slice(0),n=e.every(function(t){return t.processed}),i=e.filter(function(t){return"actual"===t.type}),r=e.filter(function(t){return"expected"===t.type});if(n)return e;if(!i.length||!r.length)return[];var a=r[0].key+" minus "+i[0].key+" (Predicted > Actual)",u=r[0].key+" minus "+i[0].key+" (Predicted < Actual)",h=[{key:c||a,type:"area",values:[],yAxis:1,color:"rgba(44,160,44,.9)",processed:!0,noHighlightSeries:!0},{key:d||u,type:"area",values:[],yAxis:1,color:"rgba(234,39,40,.9)",processed:!0,noHighlightSeries:!0},{key:i[0].key,type:"line",values:[],yAxis:1,color:"#666666",processed:!0,strokeWidth:_}];g&&(h[3]={key:r[0].key,type:"line",values:[],yAxis:1,color:"#aec7e8",processed:!0,strokeWidth:_});var f=i[0].values.reduce(function(t,e,n){return t[o(e)]=l(e),t},{}),m=r[0].values.reduce(function(t,e,n){return t[o(e)]=l(e),t},{});return Object.keys(f).forEach(function(t,e){var n=f[t],i=m[t],r={};r[s]=t;var a=o(r),l=i-n;isNaN(l)?(h[1].values[e]={x:a,y0:n,y1:n},h[0].values[e]={x:a,y0:n,y1:n}):l<0?(h[1].values[e]={x:a,y0:n,y1:i},h[0].values[e]={x:a,y0:n,y1:n}):(h[0].values[e]={x:a,y0:n,y1:i},h[1].values[e]={x:a,y0:n,y1:n}),h[2].values[e]={x:a,y:n},g&&(h[3].values[e]={x:a,y:i})}),h}return M.options=i.utils.optionsFunc.bind(M),M._options=Object.create({},{width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return h},set:function(t){h=t}},strokeWidth:{get:function(){return _},set:function(t){_=t}},x:{get:function(){return o},set:function(t){o=t}},keyForXValue:{get:function(){return s},set:function(t){s=t}},y:{get:function(){return l},set:function(t){l=t}},xScale:{get:function(){return y},set:function(t){y=t}},keyForActualLessThanPredicted:{get:function(){return c},set:function(t){c=t}},keyForActualGreaterThanPredicted:{get:function(){return d},set:function(t){d=t}},showPredictedLine:{get:function(){return g},set:function(t){g=t}},tickFormat:{get:function(){return b},set:function(t){b=t}},interpolate:{get:function(){return v},set:function(t){v=t}},focusMargin:{get:function(){return p},set:function(t){p.top=void 0!==t.top?t.top:p.top,p.right=void 0!==t.right?t.right:p.right,p.bottom=void 0!==t.bottom?t.bottom:p.bottom,p.left=void 0!==t.left?t.left:p.left}},margin:{get:function(){return m},set:function(t){m.top=void 0!==t.top?t.top:m.top,m.right=void 0!==t.right?t.right:m.right,m.bottom=void 0!==t.bottom?t.bottom:m.bottom,m.left=void 0!==t.left?t.left:m.left}}}),M.xAxis=e.xAxis,M.yAxis=e.yAxis1,M.multiChart=e,M.focus=n,M.processData=x,i.utils.inheritOptions(M,e),i.utils.initOptions(M),M},i.models.discreteBar=function(){"use strict";var t,e,n,r,a,o,s,l={top:0,right:0,bottom:0,left:0},u=960,c=500,d=Math.floor(1e4*Math.random()),h=d3.scale.ordinal(),f=d3.scale.linear(),m=function(t){return t.x},p=function(t){return t.y},g=[0],v=i.utils.defaultColor(),_=0,y=!1,b=d3.format(",.2f"),M=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),x="discreteBar",w=250,k=i.utils.renderWatch(M,w);function L(d){return k.reset(),d.each(function(d){var w=u-l.left-l.right,L=c-l.top-l.bottom;t=d3.select(this),i.utils.initSVG(t),d.forEach(function(t,e){t.values.forEach(function(t){t.series=e})});var S=e&&n?[]:d.map(function(t){return t.values.map(function(t,e){return{x:m(t,e),y:p(t,e),y0:t.y0}})});h.domain(e||d3.merge(S).map(function(t){return t.x})).rangeBands(r||[0,w],.1),f.domain(n||d3.extent(d3.merge(S).map(function(t){return t.y}).concat(g))),y?f.range(a||[L-(f.domain()[0]<0?12:0),f.domain()[1]>0?12:0]):f.range(a||[L,0]),o=o||h,s=s||f.copy().range([f(0),f(0)]);var T=t.selectAll("g.nv-wrap.nv-discretebar").data([d]),Y=T.enter().append("g").attr("class","nvd3 nv-wrap nv-discretebar").append("g");T.select("g");Y.append("g").attr("class","nv-groups"),T.attr("transform","translate("+l.left+","+l.top+")");var D=T.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t){return t.key});D.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),D.exit().watchTransition(k,"discreteBar: exit groups").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),D.attr("class",function(t,e){return"nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}),D.watchTransition(k,"discreteBar: groups").style("stroke-opacity",1).style("fill-opacity",.75);var C=D.selectAll("g.nv-bar").data(function(t){return t.values});C.exit().remove();var E=C.enter().append("g").attr("transform",function(t,e,n){return"translate("+(h(m(t,e))+.05*h.rangeBand())+", "+f(0)+")"}).on("mouseover",function(t,e){d3.select(this).classed("hover",!0),M.elementMouseover({data:t,index:e,color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),M.elementMouseout({data:t,index:e,color:d3.select(this).style("fill")})}).on("mousemove",function(t,e){M.elementMousemove({data:t,index:e,color:d3.select(this).style("fill")})}).on("click",function(t,e){M.elementClick({data:t,index:e,color:d3.select(this).style("fill"),event:d3.event,element:this}),d3.event.stopPropagation()}).on("dblclick",function(t,e){M.elementDblClick({data:t,index:e,color:d3.select(this).style("fill")}),d3.event.stopPropagation()});E.append("rect").attr("height",0).attr("width",.9*h.rangeBand()/d.length),y?(E.append("text").attr("text-anchor","middle"),C.select("text").text(function(t,e){return b(p(t,e))}).watchTransition(k,"discreteBar: bars text").attr("x",.9*h.rangeBand()/2).attr("y",function(t,e){return p(t,e)<0?f(p(t,e))-f(0)+12:-4})):C.selectAll("text").remove(),C.attr("class",function(t,e){return p(t,e)<0?"nv-bar negative":"nv-bar positive"}).style("fill",function(t,e){return t.color||v(t,e)}).style("stroke",function(t,e){return t.color||v(t,e)}).select("rect").attr("rx",_).attr("class",x).watchTransition(k,"discreteBar: bars rect").attr("width",.9*h.rangeBand()/d.length),C.watchTransition(k,"discreteBar: bars").attr("transform",function(t,e){return"translate("+(h(m(t,e))+.05*h.rangeBand())+", "+(p(t,e)<0?f(0):f(0)-f(p(t,e))<1?f(0)-1:f(p(t,e)))+")"}).select("rect").attr("height",function(t,e){return Math.max(Math.abs(f(p(t,e))-f(0)),1)}),o=h.copy(),s=f.copy()}),k.renderEnd("discreteBar immediate"),L}return L.dispatch=M,L.options=i.utils.optionsFunc.bind(L),L._options=Object.create({},{width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},forceY:{get:function(){return g},set:function(t){g=t}},showValues:{get:function(){return y},set:function(t){y=t}},cornerRadius:{get:function(){return _},set:function(t){_=t}},x:{get:function(){return m},set:function(t){m=t}},y:{get:function(){return p},set:function(t){p=t}},xScale:{get:function(){return h},set:function(t){h=t}},yScale:{get:function(){return f},set:function(t){f=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return r},set:function(t){r=t}},yRange:{get:function(){return a},set:function(t){a=t}},valueFormat:{get:function(){return b},set:function(t){b=t}},id:{get:function(){return d},set:function(t){d=t}},rectClass:{get:function(){return x},set:function(t){x=t}},margin:{get:function(){return l},set:function(t){l.top=void 0!==t.top?t.top:l.top,l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},color:{get:function(){return v},set:function(t){v=i.utils.getColor(t)}},duration:{get:function(){return w},set:function(t){w=t,k.reset(w)}}}),i.utils.initOptions(L),L},i.models.discreteBarChart=function(){"use strict";var t,e,n=i.models.discreteBar(),r=i.models.axis(),a=i.models.axis(),o=i.models.legend(),s=i.models.tooltip(),l={top:15,right:10,bottom:50,left:60},u=null,c=null,d=null,h=i.utils.getColor(),f=!1,m=!0,p=!0,g=!1,v=!1,_=!1,y=0,b=null,M=d3.dispatch("beforeUpdate","renderEnd"),x=250;r.orient("bottom").showMaxMin(!1).tickFormat(function(t){return t}),a.orient(g?"right":"left").tickFormat(d3.format(",.1f")),s.duration(0).headerEnabled(!1).valueFormatter(function(t,e){return a.tickFormat()(t,e)}).keyFormatter(function(t,e){return r.tickFormat()(t,e)});var w=i.utils.renderWatch(M,x);function k(s){return w.reset(),w.models(n),m&&w.models(r),p&&w.models(a),s.each(function(s){var h=d3.select(this);i.utils.initSVG(h);var b=i.utils.availableWidth(c,h,l),w=i.utils.availableHeight(d,h,l);if(k.update=function(){M.beforeUpdate(),h.transition().duration(x).call(k)},k.container=this,!(s&&s.length&&s.filter(function(t){return t.values.length}).length))return i.utils.noData(k,h),k;h.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale().clamp(!0);var L=h.selectAll("g.nv-wrap.nv-discreteBarWithAxes").data([s]),S=L.enter().append("g").attr("class","nvd3 nv-wrap nv-discreteBarWithAxes").append("g"),T=S.append("defs"),Y=L.select("g");if(S.append("g").attr("class","nv-x nv-axis"),S.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),S.append("g").attr("class","nv-barsWrap"),S.append("g").attr("class","nv-legendWrap"),Y.attr("transform","translate("+l.left+","+l.top+")"),f?(o.width(b),Y.select(".nv-legendWrap").datum(s).call(o),u||o.height()===l.top||(l.top=o.height(),w=i.utils.availableHeight(d,h,l)),L.select(".nv-legendWrap").attr("transform","translate(0,"+-l.top+")")):Y.select(".nv-legendWrap").selectAll("*").remove(),g&&Y.select(".nv-y.nv-axis").attr("transform","translate("+b+",0)"),n.width(b).height(w),Y.select(".nv-barsWrap").datum(s.filter(function(t){return!t.disabled})).transition().call(n),T.append("clipPath").attr("id","nv-x-label-clip-"+n.id()).append("rect"),Y.select("#nv-x-label-clip-"+n.id()+" rect").attr("width",t.rangeBand()*(v?2:1)).attr("height",16).attr("x",-t.rangeBand()/(v?1:2)),m){r.scale(t)._ticks(i.utils.calcTicksX(b/100,s)).tickSize(-w,0),Y.select(".nv-x.nv-axis").attr("transform","translate(0,"+(e.range()[0]+(n.showValues()&&e.domain()[0]<0?16:0))+")"),Y.select(".nv-x.nv-axis").call(r);var D=Y.select(".nv-x.nv-axis").selectAll("g");v&&D.selectAll("text").attr("transform",function(t,e,n){return"translate(0,"+(n%2==0?"5":"17")+")"}),y&&D.selectAll(".tick text").attr("transform","rotate("+y+" 0,0)").style("text-anchor",y>0?"start":"end"),_&&Y.selectAll(".tick text").call(i.utils.wrapTicks,k.xAxis.rangeBand())}p&&(a.scale(e)._ticks(i.utils.calcTicksY(w/36,s,n.y())).tickSize(-b,0),Y.select(".nv-y.nv-axis").call(a)),Y.select(".nv-zeroLine line").attr("x1",0).attr("x2",g?-b:b).attr("y1",e(0)).attr("y2",e(0))}),w.renderEnd("discreteBar chart immediate"),k}return n.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:k.x()(t.data),value:k.y()(t.data),color:t.color},s.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){s.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){s()}),k.dispatch=M,k.discretebar=n,k.legend=o,k.xAxis=r,k.yAxis=a,k.tooltip=s,k.options=i.utils.optionsFunc.bind(k),k._options=Object.create({},{width:{get:function(){return c},set:function(t){c=t}},height:{get:function(){return d},set:function(t){d=t}},showLegend:{get:function(){return f},set:function(t){f=t}},staggerLabels:{get:function(){return v},set:function(t){v=t}},rotateLabels:{get:function(){return y},set:function(t){y=t}},wrapLabels:{get:function(){return _},set:function(t){_=!!t}},showXAxis:{get:function(){return m},set:function(t){m=t}},showYAxis:{get:function(){return p},set:function(t){p=t}},noData:{get:function(){return b},set:function(t){b=t}},margin:{get:function(){return l},set:function(t){void 0!==t.top&&(l.top=t.top,u=t.top),l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},duration:{get:function(){return x},set:function(t){x=t,w.reset(x),n.duration(x),r.duration(x),a.duration(x)}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t),n.color(h),o.color(h)}},rightAlignYAxis:{get:function(){return g},set:function(t){g=t,a.orient(t?"right":"left")}}}),i.utils.inheritOptions(k,n),i.utils.initOptions(k),k},i.models.distribution=function(){"use strict";var t,e={top:0,right:0,bottom:0,left:0},n=400,r=8,a="x",o=function(t){return t[a]},s=i.utils.defaultColor(),l=d3.scale.linear(),u=250,c=d3.dispatch("renderEnd"),d=i.utils.renderWatch(c,u);function h(n){return d.reset(),n.each(function(n){"x"===a?(e.left,e.right):(e.top,e.bottom);var u="x"==a?"y":"x",c=d3.select(this);i.utils.initSVG(c),t=t||l;var h=c.selectAll("g.nv-distribution").data([n]),f=(h.enter().append("g").attr("class","nvd3 nv-distribution").append("g"),h.select("g"));h.attr("transform","translate("+e.left+","+e.top+")");var m=f.selectAll("g.nv-dist").data(function(t){return t},function(t){return t.key});m.enter().append("g"),m.attr("class",function(t,e){return"nv-dist nv-series-"+e}).style("stroke",function(t,e){return s(t,e)});var p=m.selectAll("line.nv-dist"+a).data(function(t){return t.values});p.enter().append("line").attr(a+"1",function(e,n){return t(o(e,n))}).attr(a+"2",function(e,n){return t(o(e,n))}),d.transition(m.exit().selectAll("line.nv-dist"+a),"dist exit").attr(a+"1",function(t,e){return l(o(t,e))}).attr(a+"2",function(t,e){return l(o(t,e))}).style("stroke-opacity",0).remove(),p.attr("class",function(t,e){return"nv-dist"+a+" nv-dist"+a+"-"+e}).attr(u+"1",0).attr(u+"2",r),d.transition(p,"dist").attr(a+"1",function(t,e){return l(o(t,e))}).attr(a+"2",function(t,e){return l(o(t,e))}),t=l.copy()}),d.renderEnd("distribution immediate"),h}return h.options=i.utils.optionsFunc.bind(h),h.dispatch=c,h.margin=function(t){return arguments.length?(e.top=void 0!==t.top?t.top:e.top,e.right=void 0!==t.right?t.right:e.right,e.bottom=void 0!==t.bottom?t.bottom:e.bottom,e.left=void 0!==t.left?t.left:e.left,h):e},h.width=function(t){return arguments.length?(n=t,h):n},h.axis=function(t){return arguments.length?(a=t,h):a},h.size=function(t){return arguments.length?(r=t,h):r},h.getData=function(t){return arguments.length?(o=d3.functor(t),h):o},h.scale=function(t){return arguments.length?(l=t,h):l},h.color=function(t){return arguments.length?(s=i.utils.getColor(t),h):s},h.duration=function(t){return arguments.length?(u=t,d.reset(u),h):u},h},i.models.distroPlot=function(){"use strict";var t,e,n,r,a,o={top:0,right:0,bottom:0,left:0},s=960,l=500,u=Math.floor(1e4*Math.random()),c=d3.scale.ordinal(),d=d3.scale.linear(),h=function(t){return t.label},f=function(t){return t.value},m=function(t){return t.color},p=function(t){return t.values.q1},g=function(t){return t.values.q2},v=function(t){return t.values.q3},_=function(t){return("mean"==A?b(t):g(t))-t.values.notch},y=function(t){return("mean"==A?b(t):g(t))+t.values.notch},b=function(t){return t.values.mean},M=function(t){return t.values.wl[Y]},x=function(t){return t.values.wu[Y]},w=function(t){return t.values.min},k=function(t){return t.values.max},L=function(t){return t.values.dev},S=function(t){return t.values.observations},T=!1,Y="iqr",D=!1,C=!1,E=!1,A=!1,O=!0,j=.7,N=!0,H="scott",V=!0,P=50,F=3,I=i.utils.defaultColor(),R=null,W=d3.dispatch("elementMouseover","elementMouseout","elementMousemove","renderEnd"),z=250,B=null;function U(t,e){void 0===e&&(e="scott");var n=function(t){var e=t.sort(d3.ascending),n=(d3.quantile(e,.75)-d3.quantile(e,.25))/1.349;return d3.min([d3.deviation(e),n])}(t),i=t.length;return"scott"===e?Math.pow(1.059*n*i,-.2):Math.pow(.9*n*i,-.2)}function G(t){function e(t,e){var n,i=t.map(function(t){return E&&Z.add(E(t)),f(t)}).sort(d3.ascending),r=d3.quantile(i,.25),a=d3.quantile(i,.75),o=a-r,s=a+1.5*o,l=r-1.5*o,u={iqr:d3.max([d3.min(i),d3.min(i.filter(function(t){return t>l}))]),minmax:d3.min(i),stddev:d3.mean(i)-d3.deviation(i)},c={iqr:d3.min([d3.max(i),d3.max(i.filter(function(t){return t<s}))]),minmax:d3.max(i),stddev:d3.mean(i)+d3.deviation(i)},h=d3.median(i),m=d3.mean(i),p=[];(void 0!==d3.beeswarm?(p=d3.beeswarm().data(t.map(function(t){return f(t)})).radius(F+1).orientation("vertical").side("symmetric").distributeOn(function(t){return d(t)}).arrange()).map(function(n,i){n.key=e,n.object_constancy=t[i].object_constancy,n.isOutlier=n.datum<u.iqr||n.datum>c.iqr,n.isOutlierStdDev=n.datum<u.stddev||n.datum>c.stddev,n.randX=Math.random()*j*(1==Math.floor(2*Math.random())?1:-1)}):i.forEach(function(t,n){p.push({object_constancy:t.object_constancy,datum:t,key:e,isOutlier:t<u.iqr||t>c.iqr,isOutlierStdDev:t<u.stddev||t>c.stddev,randX:Math.random()*j*(1==Math.floor(2*Math.random())?1:-1)})}),isNaN(parseFloat(H)))&&(n=-1!=["scott","silverman"].indexOf(H)?U(i,H):U(i));var g=function(t,e){return function(n){return e.map(function(e){var i=d3.mean(n,function(n){return t(e-n)});return{x:e,y:i}})}}(function(t){return function(e){return Math.abs(e/=t)<=1?.75*(1-e*e)/t:0}}(n),d.ticks(P)),v=V?function(t,e){if(e[0]===e[1])return t;var n=t.reduce(function(t,n){return n.x>=e[0]&&n.x<=e[1]&&t.push(n),t},[]);e[0]<n[0].x&&n.unshift({x:e[0],y:n[0].y});e[1]>n[n.length-1].x&&n.push({x:e[1],y:n[n.length-1].y});return n}(g(i),d3.extent(i)):g(i),_=d3.scale.linear().domain([0,d3.max(v,function(t){return t.y})]).clamp(!0);K.push(_);var y={count:i.length,num_outlier:p.filter(function(t){return t.isOutlier}).length,sum:d3.sum(i),mean:m,q1:r,q2:h,q3:a,wl:u,wu:c,iqr:o,min:d3.min(i),max:d3.max(i),dev:d3.deviation(i),observations:p,key:e,kde:v,notch:1.57*o/Math.sqrt(i.length)};return E&&Q.push({key:e,values:y}),y}var n;if(t.forEach(function(t,e){t.object_constancy=e+"_"+f(t)+"_"+h(t)}),E){Z=d3.set();var i=d3.nest().key(function(t){return h(t)}).key(function(t){return E(t)}).rollup(function(t){return e(t,h(t[0]))}).entries(t);Z=Z.values();for(var r=i.map(function(t){return t.key}),a=[],o=0;o<r.length;o++)for(var s=0;s<Z.length;s++)a.push(r[o]+"_"+Z[s]);Z=a,n=[],i.forEach(function(t){t.values.forEach(function(e){e.key=t.key+"_"+e.key}),n.push.apply(n,t.values)})}else n=d3.nest().key(function(t){return h(t)}).rollup(function(t,n){return e(t)}).entries(t);return n}function $(t){return"iqr"==Y&&t.isOutlier||"stddev"==Y&&t.isOutlierStdDev}var q,J,X,Z=d3.set(),K=[],Q=[],tt=i.utils.renderWatch(W,z);function et(u){return tt.reset(),u.each(function(u){J=s-o.left-o.right,X=l-o.top-o.bottom,R=d3.select(this),i.utils.initSVG(R),d.domain(r||d3.extent(u.map(function(t){return f(t)}))).nice().range(a||[X,0]),void 0===q&&(q=G(u)),c.rangeBands(n||[0,J],.1).domain(e||E&&!N?Z:q.map(function(t){return t.key}));var h=R.selectAll("g.nv-wrap").data([q]);h.enter().append("g").attr("class","nvd3 nv-wrap");h.watchTransition(tt,"nv-wrap: wrap").attr("transform","translate("+o.left+","+o.top+")");var Y,j=h.selectAll(".nv-distroplot-x-group").data(function(t){return t});j.each(function(t,e){d3.select(this).selectAll("line.nv-distroplot-middle").datum(t)}),Y=j.enter().append("g").attr("class","nv-distroplot-x-group").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).style("fill",function(t,e){return m(t)||I(t,e)}).style("stroke",function(t,e){return m(t)||I(t,e)}),j.exit().remove();var H=function(){return c.rangeBand()},V=function(){return d3.min([B,.9*H()])},P=function(){return V()/2},z=function(){return P()-V()/2},U=function(){return P()-V()/5},Q=function(){return P()+V()/5};Y.attr("transform",function(t){return"translate("+(c(t.key)+.5*(H()-V()))+", 0)"}),j.watchTransition(tt,"nv-distroplot-x-group: distroplots").style("stroke-opacity",1).style("fill-opacity",.5).attr("transform",function(t){return"translate("+(c(t.key)+.5*(H()-V()))+", 0)"}),K.map(function(t){t.range([V()/2,0])}),t||(O=!1,T||(T="random")),Y.each(function(t,e){var n=d3.select(this);[M,x].forEach(function(t){var e=t===M?"low":"high";n.append("line").style("opacity",function(){return D?"1":"0"}).attr("class","nv-distroplot-whisker nv-distroplot-"+e),n.append("line").style("opacity",function(){return D?"0":"1"}).attr("class","nv-distroplot-tick nv-distroplot-"+e)})}),[M,x].forEach(function(e){var n=e===M?"low":"high",i=e===M?p:v;j.select("line.nv-distroplot-whisker.nv-distroplot-"+n).watchTransition(tt,"nv-distroplot-x-group: distroplots").attr("x1",P()).attr("y1",function(n){return d("violin"!=t?e(n):g(n))}).attr("x2",P()).attr("y2",function(e){return d("box"==t?i(e):g(e))}).style("opacity",function(){return D?"0":"1"}),j.select("line.nv-distroplot-tick.nv-distroplot-"+n).watchTransition(tt,"nv-distroplot-x-group: distroplots").attr("x1",function(e){return"violin"!=t?U():P()}).attr("y1",function(n,i){return d("violin"!=t?e(n):g(n))}).attr("x2",function(e){return"violin"!=t?Q():P()}).attr("y2",function(n,i){return d("violin"!=t?e(n):g(n))}).style("opacity",function(){return D?"0":"1"})}),[M,x].forEach(function(t){var e=t===M?"low":"high";Y.selectAll(".nv-distroplot-"+e).on("mouseover",function(n,i,r){d3.select(this.parentNode).selectAll("line.nv-distroplot-"+e).classed("hover",!0),W.elementMouseover({value:"low"==e?"Lower whisker":"Upper whisker",series:{key:t(n).toFixed(2),color:m(n)||I(n,r)},e:d3.event})}).on("mouseout",function(n,i,r){d3.select(this.parentNode).selectAll("line.nv-distroplot-"+e).classed("hover",!1),W.elementMouseout({value:"low"==e?"Lower whisker":"Upper whisker",series:{key:t(n).toFixed(2),color:m(n)||I(n,r)},e:d3.event})}).on("mousemove",function(t,e){W.elementMousemove({e:d3.event})})}),Y.each(function(t,e){var n=d3.select(this);["left","right"].forEach(function(t){["line","area"].forEach(function(e){n.append("path").attr("class","nv-distribution-"+e+" nv-distribution-"+t).attr("transform","rotate(90,0,0) translate(0,"+("left"==t?-V():0)+")"+("left"==t?"":" scale(1,-1)"))})}),Y.selectAll(".nv-distribution-line").style("fill","none"),Y.selectAll(".nv-distribution-area").style("stroke","none").style("opacity",.7)}),j.each(function(e,n){var i=d3.select(this),r="box"==t?function(t,e,n,i){var r="mean"==A?b(i):g(i);return C?[{x:n,y:d(p(i))},{x:t,y:d(p(i))},{x:t,y:d(_(i))},{x:e,y:d(r)},{x:t,y:d(y(i))},{x:t,y:d(v(i))},{x:n,y:d(v(i))}]:[{x:n,y:d(p(i))},{x:t,y:d(p(i))},{x:t,y:d(r)},{x:t,y:d(r)},{x:t,y:d(r)},{x:t,y:d(v(i))},{x:n,y:d(v(i))}]}(z(),U(),P(),e):e.values.kde;i.selectAll("path").datum(r);var a=K[n],o="box"==t?"linear":"basis";"box"==t||"violin"==t?["left","right"].forEach(function(e){j.selectAll(".nv-distribution-line.nv-distribution-"+e).attr("d",d3.svg.line().x(function(e){return"box"==t?e.y:d(e.x)}).y(function(e){return"box"==t?e.x:a(e.y)}).interpolate(o)).attr("transform","rotate(90,0,0) translate(0,"+("left"==e?-V():0)+")"+("left"==e?"":" scale(1,-1)")).style("opacity",t?"1":"0"),j.selectAll(".nv-distribution-area.nv-distribution-"+e).attr("d",d3.svg.area().x(function(e){return"box"==t?e.y:d(e.x)}).y(function(e){return"box"==t?e.x:a(e.y)}).y0(V()/2).interpolate(o)).attr("transform","rotate(90,0,0) translate(0,"+("left"==e?-V():0)+")"+("left"==e?"":" scale(1,-1)")).style("opacity",t?"1":"0")}):(j.selectAll(".nv-distribution-area").watchTransition(tt,"nv-distribution-area: distroplots").style("opacity",t?"1":"0"),j.selectAll(".nv-distribution-line").watchTransition(tt,"nv-distribution-line: distroplots").style("opacity",t?"1":"0"))}),j.selectAll("path").on("mouseover",function(t,e,n){t=d3.select(this.parentNode).datum(),d3.select(this).classed("hover",!0),W.elementMouseover({key:t.key,value:"Group "+t.key+" stats",series:[{key:"max",value:k(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q3",value:v(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q2",value:g(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q1",value:p(t).toFixed(2),color:m(t)||I(t,n)},{key:"min",value:w(t).toFixed(2),color:m(t)||I(t,n)},{key:"mean",value:b(t).toFixed(2),color:m(t)||I(t,n)},{key:"std. dev.",value:L(t).toFixed(2),color:m(t)||I(t,n)},{key:"count",value:t.values.count,color:m(t)||I(t,n)},{key:"num. outliers",value:t.values.num_outlier,color:m(t)||I(t,n)}],data:t,index:e,e:d3.event})}).on("mouseout",function(t,e,n){d3.select(this).classed("hover",!1),t=d3.select(this.parentNode).datum(),W.elementMouseout({key:t.key,value:"Group "+t.key+" stats",series:[{key:"max",value:k(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q3",value:v(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q2",value:g(t).toFixed(2),color:m(t)||I(t,n)},{key:"Q1",value:p(t).toFixed(2),color:m(t)||I(t,n)},{key:"min",value:w(t).toFixed(2),color:m(t)||I(t,n)},{key:"mean",value:b(t).toFixed(2),color:m(t)||I(t,n)},{key:"std. dev.",value:L(t).toFixed(2),color:m(t)||I(t,n)},{key:"count",value:t.values.count,color:m(t)||I(t,n)},{key:"num. outliers",value:t.values.num_outlier,color:m(t)||I(t,n)}],data:t,index:e,e:d3.event})}).on("mousemove",function(t,e){W.elementMousemove({e:d3.event})}),Y.append("line").attr("class",function(t){return"nv-distroplot-middle"}),j.selectAll("line.nv-distroplot-middle").watchTransition(tt,"nv-distroplot-x-group: distroplots line").attr("x1",C?U:"violin"!=t?z:U()).attr("y1",function(t,e,n){return d("mean"==A?b(t):g(t))}).attr("x2",C?Q:"violin"!=t?function(){return P()+V()/2}:Q()).attr("y2",function(t,e){return d("mean"==A?b(t):g(t))}).style("opacity",A?"1":"0"),j.selectAll(".nv-distroplot-middle").on("mouseover",function(t,e,n){if(0!=d3.select(this).style("opacity")){var i=d3.select(this.parentNode).style("fill");d3.select(this).classed("hover",!0),W.elementMouseover({value:"mean"==A?"Mean":"Median",series:{key:"mean"==A?b(t).toFixed(2):g(t).toFixed(2),color:i},e:d3.event})}}).on("mouseout",function(t,e,n){if(0!=d3.select(this).style("opacity")){d3.select(this).classed("hover",!1);var i=d3.select(this.parentNode).style("fill");W.elementMouseout({value:"mean"==A?"Mean":"Median",series:{key:"mean"==A?b(t).toFixed(2):g(t).toFixed(2),color:i},e:d3.event})}}).on("mousemove",function(t,e){W.elementMousemove({e:d3.event})});var et=j.selectAll("g.nv-distroplot-observation").data(function(t){return S(t)},function(t){return t.object_constancy}),nt=et.enter().append("g").attr("class","nv-distroplot-observation");nt.append("circle").style({opacity:0}),nt.append("line").style("stroke-width",1).style({stroke:d3.rgb(85,85,85),opacity:0}),et.exit().remove(),et.attr("class",function(e){return"nv-distroplot-observation "+($(e)&&"box"==t?"nv-distroplot-outlier":"nv-distroplot-non-outlier")}),"line"==T?j.selectAll("g.nv-distroplot-observation line").watchTransition(tt,"nv-distrolot-x-group: nv-distoplot-observation").attr("x1",U()+V()/4).attr("x2",Q()-V()/4).attr("y1",function(t){return d(t.datum)}).attr("y2",function(t){return d(t.datum)}):(j.selectAll("g.nv-distroplot-observation circle").watchTransition(tt,"nv-distroplot: nv-distroplot-observation").attr("cy",function(t){return d(t.datum)}).attr("r",F),j.selectAll("g.nv-distroplot-observation circle").watchTransition(tt,"nv-distroplot: nv-distroplot-observation").attr("cx",function(t){return"swarm"==T?t.x+V()/2:"random"==T?V()/2+t.randX*V()/2:V()/2})),!1!==T&&(O?(j.selectAll(".nv-distroplot-outlier "+("line"==T?"line":"circle")).watchTransition(tt,"nv-distroplot: nv-distroplot-observation").style("opacity",1),j.selectAll(".nv-distroplot-non-outlier "+("line"==T?"line":"circle")).watchTransition(tt,"nv-distroplot: nv-distroplot-observation").style("opacity",0)):j.selectAll("line"==T?"line":"circle").watchTransition(tt,"nv-distroplot: nv-distroplot-observation").style("opacity",1)),j.selectAll(".nv-distroplot-observation"+("line"==T?" circle":" line")).watchTransition(tt,"nv-distroplot: nv-distoplot-observation").style("opacity",0),j.selectAll(".nv-distroplot-observation").on("mouseover",function(e,n,i){var r=d3.select(this);if(!O||"box"!=t||$(e)){var a=d3.select(this.parentNode).style("fill");r.classed("hover",!0),W.elementMouseover({value:"box"==t&&$(e)?"Outlier":"Observation",series:{key:e.datum.toFixed(2),color:a},e:d3.event})}}).on("mouseout",function(e,n,i){var r=d3.select(this),a=d3.select(this.parentNode).style("fill");r.classed("hover",!1),W.elementMouseout({value:"box"==t&&$(e)?"Outlier":"Observation",series:{key:e.datum.toFixed(2),color:a},e:d3.event})}).on("mousemove",function(t,e){W.elementMousemove({e:d3.event})})}),tt.renderEnd("nv-distroplot-x-group immediate"),et}return et.dispatch=W,et.options=i.utils.optionsFunc.bind(et),et._options=Object.create({},{width:{get:function(){return s},set:function(t){s=t}},height:{get:function(){return l},set:function(t){l=t}},maxBoxWidth:{get:function(){return B},set:function(t){B=t}},x:{get:function(){return h},set:function(t){h=t}},y:{get:function(){return f},set:function(t){f=t}},plotType:{get:function(){return t},set:function(e){t=e}},observationType:{get:function(){return T},set:function(t){T=t}},whiskerDef:{get:function(){return Y},set:function(t){Y=t}},notchBox:{get:function(){return C},set:function(t){C=t}},hideWhiskers:{get:function(){return D},set:function(t){D=t}},colorGroup:{get:function(){return E},set:function(t){E=t}},centralTendency:{get:function(){return A},set:function(t){A=t}},bandwidth:{get:function(){return H},set:function(t){H=t}},clampViolin:{get:function(){return V},set:function(t){V=t}},resolution:{get:function(){return P},set:function(t){P=t}},xScale:{get:function(){return c},set:function(t){c=t}},yScale:{get:function(){return d},set:function(t){d=t}},showOnlyOutliers:{get:function(){return O},set:function(t){O=t}},jitter:{get:function(){return j},set:function(t){j=t}},squash:{get:function(){return N},set:function(t){N=t}},pointSize:{get:function(){return F},set:function(t){F=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return r},set:function(t){r=t}},xRange:{get:function(){return n},set:function(t){n=t}},yRange:{get:function(){return a},set:function(t){a=t}},recalcData:{get:function(){q=G(R.datum())}},itemColor:{get:function(){return m},set:function(t){m=t}},id:{get:function(){return u},set:function(t){u=t}},margin:{get:function(){return o},set:function(t){o.top=void 0!==t.top?t.top:o.top,o.right=void 0!==t.right?t.right:o.right,o.bottom=void 0!==t.bottom?t.bottom:o.bottom,o.left=void 0!==t.left?t.left:o.left}},color:{get:function(){return I},set:function(t){I=i.utils.getColor(t)}},duration:{get:function(){return z},set:function(t){z=t,tt.reset(z)}}}),i.utils.initOptions(et),et},i.models.distroPlotChart=function(){"use strict";var t,e,n=i.models.distroPlot(),r=i.models.axis(),a=i.models.axis(),o={top:25,right:10,bottom:40,left:60},s=null,l=null,u=i.utils.getColor(),c=!0,d=!0,h=!1,f=!1,m=!1,p=!1,g=i.models.tooltip(),v="No Data Available.",_=d3.dispatch("stateChange","beforeUpdate","renderEnd"),y=500;r.orient("bottom").showMaxMin(!1).tickFormat(function(t){return t}),a.orient(h?"right":"left").tickFormat(d3.format(",.1f")),g.duration(0);var b,M,x,w,k,L,S,T=i.utils.renderWatch(_,y);o.top;function Y(t){return!function(t,e){if(t.length!==e.length)return!1;for(var n=t.length;n--;)if("object_constancy"in t[n]&&delete t[n].object_constancy,"object_constancy"in e[n]&&delete e[n].object_constancy,!D(t[n],e[n]))return!1;return!0}(t,S)&&(S=JSON.parse(JSON.stringify(t)),!0)}function D(t,e){var n=Object.getOwnPropertyNames(t),i=Object.getOwnPropertyNames(e);if(n.length!=i.length)return!1;for(var r=0;r<n.length;r++){var a=n[r];if(t[a]!==e[a])return!1}return!0}function C(u){return T.reset(),T.models(n),c&&T.models(r),d&&T.models(a),u.each(function(u){var m=d3.select(this);i.utils.initSVG(m);var p=(s||parseInt(m.style("width"))||960)-o.left-o.right,g=(l||parseInt(m.style("height"))||400)-o.top-o.bottom;if(void 0===S&&(S=JSON.parse(JSON.stringify(u))),C.update=function(){_.beforeUpdate();var t=n.options();(b!==t.colorGroup()||M!==t.x()||x!==t.y()||k!==t.bandwidth()||w!==t.resolution()||L!==t.clampViolin()||Y(u))&&n.recalcData(),m.transition().duration(y).call(C)},C.container=this,"function"!=typeof d3.beeswarm&&"swarm"==C.options().observationType()){o.left;return v='Please include the library https://github.com/Kcnarf/d3-beeswarm to use "swarm".',i.utils.noData(C,m),C}if(!u||!u.length)return i.utils.noData(C,m),C;m.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale().clamp(!0);var D=m.selectAll("g.nv-wrap.nv-distroPlot").data([u]),E=D.enter().append("g").attr("class","nvd3 nv-wrap nv-distroPlot").append("g"),A=E.append("defs"),O=D.select("g");if(E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),E.append("g").attr("class","nv-distroWrap"),E.attr("transform","translate("+o.left+","+o.top+")"),O.watchTransition(T,"nv-wrap: wrap").attr("transform","translate("+o.left+","+o.top+")"),h&&O.select(".nv-y.nv-axis").attr("transform","translate("+p+",0)"),n.width(p).height(g),O.select(".nv-distroWrap").datum(u).transition().call(n),A.append("clipPath").attr("id","nv-x-label-clip-"+n.id()).append("rect"),O.select("#nv-x-label-clip-"+n.id()+" rect").attr("width",t.rangeBand()*(f?2:1)).attr("height",16).attr("x",-t.rangeBand()/(f?1:2)),c){r.scale(t).ticks(i.utils.calcTicksX(p/100,u)).tickSize(-g,0),O.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),O.select(".nv-x.nv-axis").call(r);var j=O.select(".nv-x.nv-axis").selectAll("g");f&&j.selectAll("text").attr("transform",function(t,e,n){return"translate(0,"+(n%2==0?"5":"17")+")"})}d&&(a.scale(e).ticks(Math.floor(g/36)).tickSize(-p,0),O.select(".nv-y.nv-axis").call(a)),O.select(".nv-zeroLine line").attr("x1",0).attr("x2",p).attr("y1",e(0)).attr("y2",e(0)),b=n.options().colorGroup(),M=n.options().x(),x=n.options().y(),k=n.options().bandwidth(),w=n.options().resolution(),L=n.options().clampViolin()}),T.renderEnd("nv-distroplot chart immediate"),C}return n.dispatch.on("elementMouseover.tooltip",function(t){g.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){g.data(t).hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){g()}),C.dispatch=_,C.distroplot=n,C.xAxis=r,C.yAxis=a,C.tooltip=g,C.options=i.utils.optionsFunc.bind(C),C._options=Object.create({},{width:{get:function(){return s},set:function(t){s=t}},height:{get:function(){return l},set:function(t){l=t}},staggerLabels:{get:function(){return f},set:function(t){f=t}},showXAxis:{get:function(){return c},set:function(t){c=t}},showYAxis:{get:function(){return d},set:function(t){d=t}},tooltipContent:{get:function(){return g},set:function(t){g=t}},noData:{get:function(){return v},set:function(t){v=t}},defaultState:{get:function(){return defaultState},set:function(t){defaultState=t}},margin:{get:function(){return o},set:function(t){o.top=void 0!==t.top?t.top:o.top,o.right=void 0!==t.right?t.right:o.right,o.bottom=void 0!==t.bottom?t.bottom:o.bottom,o.left=void 0!==t.left?t.left:o.left}},duration:{get:function(){return y},set:function(t){y=t,T.reset(y),n.duration(y),r.duration(y),a.duration(y)}},color:{get:function(){return u},set:function(t){u=i.utils.getColor(t),n.color(u)}},rightAlignYAxis:{get:function(){return h},set:function(t){h=t,a.orient(t?"right":"left")}},xLabel:{get:function(){return m},set:function(t){m=t,r.axisLabel(m)}},yLabel:{get:function(){return p},set:function(t){p=t,a.axisLabel(p)}}}),i.utils.inheritOptions(C,n),i.utils.initOptions(C),C},i.models.focus=function(t){"use strict";t=t||i.models.line();var e,n,r=i.models.axis(),a=i.models.axis(),o=d3.svg.brush(),s={top:10,right:0,bottom:30,left:0},l=i.utils.defaultColor(),u=null,c=70,d=!0,h=!1,f=!1,m=null,p=250,g=d3.dispatch("brush","onBrush","renderEnd"),v=!0;t.interactive(!1),t.pointActive(function(t){return!1});var _=i.utils.renderWatch(g,p);function y(b){return _.reset(),_.models(t),d&&_.models(r),h&&_.models(a),b.each(function(_){var b=d3.select(this);i.utils.initSVG(b);var M=i.utils.availableWidth(u,b,s),x=c-s.top-s.bottom;y.update=function(){0===p?b.call(y):b.transition().duration(p).call(y)},y.container=this,e=t.xScale(),n=t.yScale();var w=b.selectAll("g.nv-focus").data([_]),k=w.enter().append("g").attr("class","nvd3 nv-focus").append("g"),L=w.select("g");w.attr("transform","translate("+s.left+","+s.top+")"),k.append("g").attr("class","nv-background").append("rect"),k.append("g").attr("class","nv-x nv-axis"),k.append("g").attr("class","nv-y nv-axis"),k.append("g").attr("class","nv-contentWrap"),k.append("g").attr("class","nv-brushBackground"),k.append("g").attr("class","nv-x nv-brush"),f&&L.select(".nv-y.nv-axis").attr("transform","translate("+M+",0)"),L.select(".nv-background rect").attr("width",M).attr("height",x),t.width(M).height(x).color(_.map(function(t,e){return t.color||l(t,e)}).filter(function(t,e){return!_[e].disabled}));var S=L.select(".nv-contentWrap").datum(_.filter(function(t){return!t.disabled}));d3.transition(S).call(t),o.x(e).on("brush",function(){C(v)}),o.on("brushend",function(){v||g.onBrush(o.empty()?e.domain():o.extent())}),m&&o.extent(m);var T=L.select(".nv-brushBackground").selectAll("g").data([m||o.extent()]),Y=T.enter().append("g");Y.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",x),Y.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",x);var D=L.select(".nv-x.nv-brush").call(o);function C(t){m=o.empty()?null:o.extent();var n=o.empty()?e.domain():o.extent();g.brush({extent:n,brush:o}),o.empty()||o.extent(m),T.data([o.empty()?e.domain():m]).each(function(t,n){var i=e(t[0])-e.range()[0],r=M-e(t[1]);d3.select(this).select(".left").attr("width",i<0?0:i),d3.select(this).select(".right").attr("x",e(t[1])).attr("width",r<0?0:r)}),t&&g.onBrush(n)}D.selectAll("rect").attr("height",x),D.selectAll(".resize").append("path").attr("d",function(t){var e=+("e"==t),n=e?1:-1,i=x/3;return"M"+.5*n+","+i+"A6,6 0 0 "+e+" "+6.5*n+","+(i+6)+"V"+(2*i-6)+"A6,6 0 0 "+e+" "+.5*n+","+2*i+"ZM"+2.5*n+","+(i+8)+"V"+(2*i-8)+"M"+4.5*n+","+(i+8)+"V"+(2*i-8)}),C(!0),L.select(".nv-background rect").attr("width",M).attr("height",x),d&&(r.scale(e)._ticks(i.utils.calcTicksX(M/100,_)).tickSize(-x,0),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")"),d3.transition(L.select(".nv-x.nv-axis")).call(r)),h&&(a.scale(n)._ticks(i.utils.calcTicksY(x/36,_)).tickSize(-M,0),d3.transition(L.select(".nv-y.nv-axis")).call(a)),L.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")")}),_.renderEnd("focus immediate"),y}return y.dispatch=g,y.content=t,y.brush=o,y.xAxis=r,y.yAxis=a,y.options=i.utils.optionsFunc.bind(y),y._options=Object.create({},{width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},showXAxis:{get:function(){return d},set:function(t){d=t}},showYAxis:{get:function(){return h},set:function(t){h=t}},brushExtent:{get:function(){return m},set:function(t){m=t}},syncBrushing:{get:function(){return v},set:function(t){v=t}},margin:{get:function(){return s},set:function(t){s.top=void 0!==t.top?t.top:s.top,s.right=void 0!==t.right?t.right:s.right,s.bottom=void 0!==t.bottom?t.bottom:s.bottom,s.left=void 0!==t.left?t.left:s.left}},duration:{get:function(){return p},set:function(e){p=e,_.reset(p),t.duration(p),r.duration(p),a.duration(p)}},color:{get:function(){return l},set:function(e){l=i.utils.getColor(e),t.color(l)}},interpolate:{get:function(){return t.interpolate()},set:function(e){t.interpolate(e)}},xTickFormat:{get:function(){return r.tickFormat()},set:function(t){r.tickFormat(t)}},yTickFormat:{get:function(){return a.tickFormat()},set:function(t){a.tickFormat(t)}},x:{get:function(){return t.x()},set:function(e){t.x(e)}},y:{get:function(){return t.y()},set:function(e){t.y(e)}},rightAlignYAxis:{get:function(){return f},set:function(t){f=t,a.orient(f?"right":"left")}}}),i.utils.inheritOptions(y,t),i.utils.initOptions(y),y},i.models.forceDirectedGraph=function(){"use strict";var t={top:2,right:0,bottom:2,left:0},e=400,n=32,r=null,a=d3.dispatch("renderEnd"),o=i.utils.getColor(["#000"]),s=i.models.tooltip(),l=null,u=.1,c=.9,d=30,h=-120,f=.1,m=.8,p=.1,g=5,v=function(t){},_=function(t){},y=d3.functor(0),b=d3.functor(0),M=i.utils.renderWatch(a);function x(a){return M.reset(),a.each(function(a){r=d3.select(this),i.utils.initSVG(r);var l=i.utils.availableWidth(e,r,t),y=i.utils.availableHeight(n,r,t);if(r.attr("width",l).attr("height",y),!(a&&a.links&&a.nodes))return i.utils.noData(x,r),x;r.selectAll(".nv-noData").remove(),r.selectAll("*").remove();var b=new Set;a.nodes.forEach(function(t){Object.keys(t).forEach(function(t){b.add(t)})});var M=d3.layout.force().nodes(a.nodes).links(a.links).size([l,y]).linkStrength(u).friction(c).linkDistance(d).charge(h).gravity(f).theta(m).alpha(p).start(),w=r.selectAll(".link").data(a.links).enter().append("line").attr("class","nv-force-link").style("stroke-width",function(t){return Math.sqrt(t.value)}),k=r.selectAll(".node").data(a.nodes).enter().append("g").attr("class","nv-force-node").call(M.drag);k.append("circle").attr("r",g).style("fill",function(t){return o(t)}).on("mouseover",function(t){r.select(".nv-series-"+t.seriesIndex+" .nv-distx-"+t.pointIndex).attr("y1",t.py),r.select(".nv-series-"+t.seriesIndex+" .nv-disty-"+t.pointIndex).attr("x2",t.px);var e=o(t);t.series=[],b.forEach(function(n){t.series.push({color:e,key:n,value:t[n]})}),s.data(t).hidden(!1)}).on("mouseout",function(t){s.hidden(!0)}),s.headerFormatter(function(t){return"Node"}),_(w),v(k),M.on("tick",function(){w.attr("x1",function(t){return t.source.x}).attr("y1",function(t){return t.source.y}).attr("x2",function(t){return t.target.x}).attr("y2",function(t){return t.target.y}),k.attr("transform",function(t){return"translate("+t.x+", "+t.y+")"})})}),x}return x.options=i.utils.optionsFunc.bind(x),x._options=Object.create({},{width:{get:function(){return e},set:function(t){e=t}},height:{get:function(){return n},set:function(t){n=t}},linkStrength:{get:function(){return u},set:function(t){u=t}},friction:{get:function(){return c},set:function(t){c=t}},linkDist:{get:function(){return d},set:function(t){d=t}},charge:{get:function(){return h},set:function(t){h=t}},gravity:{get:function(){return f},set:function(t){f=t}},theta:{get:function(){return m},set:function(t){m=t}},alpha:{get:function(){return p},set:function(t){p=t}},radius:{get:function(){return g},set:function(t){g=t}},x:{get:function(){return y},set:function(t){y=d3.functor(t)}},y:{get:function(){return b},set:function(t){b=d3.functor(t)}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},color:{get:function(){return o},set:function(t){o=i.utils.getColor(t)}},noData:{get:function(){return l},set:function(t){l=t}},nodeExtras:{get:function(){return v},set:function(t){v=t}},linkExtras:{get:function(){return _},set:function(t){_=t}}}),x.dispatch=a,x.tooltip=s,i.utils.initOptions(x),x},i.models.furiousLegend=function(){"use strict";var t={top:5,right:0,bottom:5,left:0},e=400,n=20,r=function(t){return t.key},a=function(t){return t},o=i.utils.getColor(),s=20,l=!0,u=28,c=!0,d=!0,h=!1,f=!1,m=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),p="classic";function g(v){function _(t,e){return"furious"!=p?"#000":f?t.disengaged?o(t,e):"#fff":f?void 0:t.disabled?o(t,e):"#fff"}function y(t,e){return f&&"furious"==p?t.disengaged?"#fff":o(t,e):t.disabled?"#fff":o(t,e)}return v.each(function(g){var v=e-t.left-t.right,b=d3.select(this);i.utils.initSVG(b);var M=b.selectAll("g.nv-legend").data([g]),x=(M.enter().append("g").attr("class","nvd3 nv-legend").append("g"),M.select("g"));M.attr("transform","translate("+t.left+","+t.top+")");var w,k=x.selectAll(".nv-series").data(function(t){return"furious"!=p?t:t.filter(function(t){return!!f||!t.disengaged})}),L=k.enter().append("g").attr("class","nv-series");if("classic"==p)L.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),w=k.select("circle");else if("furious"==p){L.append("rect").style("stroke-width",2).attr("class","nv-legend-symbol").attr("rx",3).attr("ry",3),w=k.select("rect"),L.append("g").attr("class","nv-check-box").property("innerHTML",'<path d="M0.5,5 L22.5,5 L22.5,26.5 L0.5,26.5 L0.5,5 Z" class="nv-box"></path><path d="M5.5,12.8618467 L11.9185089,19.2803556 L31,0.198864511" class="nv-check"></path>').attr("transform","translate(-10,-8)scale(0.5)"),k.select(".nv-check-box").each(function(t,e){d3.select(this).selectAll("path").attr("stroke",_(t,e))})}L.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");var S,T=k.select("text.nv-legend-text");switch(k.on("mouseover",function(t,e){m.legendMouseover(t,e)}).on("mouseout",function(t,e){m.legendMouseout(t,e)}).on("click",function(t,e){m.legendClick(t,e);var n=k.data();if(d){if("classic"==p)h?(n.forEach(function(t){t.disabled=!0}),t.disabled=!1):(t.disabled=!t.disabled,n.every(function(t){return t.disabled})&&n.forEach(function(t){t.disabled=!1}));else if("furious"==p)if(f)t.disengaged=!t.disengaged,t.userDisabled=void 0==t.userDisabled?!!t.disabled:t.userDisabled,t.disabled=t.disengaged||t.userDisabled;else if(!f){t.disabled=!t.disabled,t.userDisabled=t.disabled,n.filter(function(t){return!t.disengaged}).every(function(t){return t.userDisabled})&&n.forEach(function(t){t.disabled=t.userDisabled=!1})}m.stateChange({disabled:n.map(function(t){return!!t.disabled}),disengaged:n.map(function(t){return!!t.disengaged})})}}).on("dblclick",function(t,e){if(("furious"!=p||!f)&&(m.legendDblclick(t,e),d)){var n=k.data();n.forEach(function(t){t.disabled=!0,"furious"==p&&(t.userDisabled=t.disabled)}),t.disabled=!1,"furious"==p&&(t.userDisabled=t.disabled),m.stateChange({disabled:n.map(function(t){return!!t.disabled})})}}),k.classed("nv-disabled",function(t){return t.userDisabled}),k.exit().remove(),T.attr("fill",_).text(function(t){return a(r(t))}),p){case"furious":S=23;break;case"classic":S=20}if(l){var Y=[];k.each(function(t,e){var n,o;if(a(r(t))&&a(r(t)).length>s){var l=a(r(t)).substring(0,s);n=d3.select(this).select("text").text(l+"..."),d3.select(this).append("svg:title").text(a(r(t)))}else n=d3.select(this).select("text");try{if((o=n.node().getComputedTextLength())<=0)throw Error()}catch(t){o=i.utils.calcApproxTextWidth(n)}Y.push(o+u)});for(var D=0,C=0,E=[];C<v&&D<Y.length;)E[D]=Y[D],C+=Y[D++];for(0===D&&(D=1);C>v&&D>1;){E=[],D--;for(var A=0;A<Y.length;A++)Y[A]>(E[A%D]||0)&&(E[A%D]=Y[A]);C=E.reduce(function(t,e,n,i){return t+e})}for(var O=[],j=0,N=0;j<D;j++)O[j]=N,N+=E[j];k.attr("transform",function(t,e){return"translate("+O[e%D]+","+(5+Math.floor(e/D)*S)+")"}),c?x.attr("transform","translate("+(e-t.right-C)+","+t.top+")"):x.attr("transform","translate(0,"+t.top+")"),n=t.top+t.bottom+Math.ceil(Y.length/D)*S}else{var H,V=5,P=5,F=0;k.attr("transform",function(n,i){var r=d3.select(this).select("text").node().getComputedTextLength()+u;return H=P,e<t.left+t.right+H+r&&(P=H=5,V+=S),(P+=r)>F&&(F=P),"translate("+H+","+V+")"}),x.attr("transform","translate("+(e-t.right-F)+","+t.top+")"),n=t.top+t.bottom+V+15}"furious"==p&&w.attr("width",function(t,e){return T[0][e].getComputedTextLength()+27}).attr("height",18).attr("y",-9).attr("x",-15),w.style("fill",y).style("stroke",function(t,e){return t.color||o(t,e)})}),g}return g.dispatch=m,g.options=i.utils.optionsFunc.bind(g),g._options=Object.create({},{width:{get:function(){return e},set:function(t){e=t}},height:{get:function(){return n},set:function(t){n=t}},key:{get:function(){return r},set:function(t){r=t}},keyFormatter:{get:function(){return a},set:function(t){a=t}},align:{get:function(){return l},set:function(t){l=t}},rightAlign:{get:function(){return c},set:function(t){c=t}},maxKeyLength:{get:function(){return s},set:function(t){s=t}},padding:{get:function(){return u},set:function(t){u=t}},updateState:{get:function(){return d},set:function(t){d=t}},radioButtonMode:{get:function(){return h},set:function(t){h=t}},expanded:{get:function(){return f},set:function(t){f=t}},vers:{get:function(){return p},set:function(t){p=t}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},color:{get:function(){return o},set:function(t){o=i.utils.getColor(t)}}}),i.utils.initOptions(g),g},i.models.heatMap=function(){"use strict";var t,e,n,r,a,o,s,l,u,c={top:0,right:0,bottom:0,left:0},d=960,h=500,f=Math.floor(1e4*Math.random()),m=d3.scale.ordinal(),p=d3.scale.ordinal(),g=!1,v=function(t){return t.x},_=function(t){return t.y},y=function(t){return t.value},b=!0,M=function(t){return"number"==typeof t?t.toFixed(0):t},x=!1,w=2,k=4,L=!1,S=!0,T=i.utils.defaultColor(),Y=i.utils.defaultColor(),D="#bcbcbc",C="",E=5,A=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),O=250,j=function(t){return B/3},N=function(t){return U/3},H=!1;function V(t){var e=d3.median(t),n=t.map(function(t){return Math.abs(t-e)});return d3.median(n)}function P(t){var e=L?ot(t):y(t);return F()&&!isNaN(e)||void 0!==e?g(e):D}function F(){return"number"==typeof Z[0]}function I(t){if(-1!=["centerRow","robustCenterRow","centerScaleRow","robustCenterScaleRow","centerColumn","robustCenterColumn","centerScaleColumn","robustCenterScaleColumn","centerAll","robustCenterAll","centerScaleAll","robustCenterScaleAll"].indexOf(L)){Object.keys(J),Object.keys(X);var e=!!L.includes("Scale"),n=L.includes("robust")?"median":"mean",i=L.includes("Row")?"row":L.includes("Column")?"col":null,r=function(t,e){var n={};return t.forEach(function(t,i){"row"==e?(at(t)in n||(n[at(t)]=[]),n[at(t)].push(y(t))):"col"==e?(rt(t)in n||(n[rt(t)]=[]),n[rt(t)].push(y(t))):null==e&&(0 in n||(n[0]=[]),n[0].push(y(t)))}),n}(t,i),a={},o={};for(var s in r)a[s]="mean"==n?d3.mean(r[s]):d3.median(r[s]),e&&(o[s]="mean"==n?d3.deviation(r[s]):V(r[s]));t.forEach(function(t,n){if(F()){if("row"==i)var r=at(t);else if("col"==i)r=rt(t);else if(null==i)r=0;var s=y(t)-a[r];t._cellPos.norm=e?s/o[r]:s}else t._cellPos.norm=y(t)})}else L=!1;return t}function R(t){J={},X={},Z=[],K=[],Q=[],tt=[];var e,n=[],i={},r=0,a=0,l=0;t.forEach(function(t){var u=v(t),c=_(t),d=y(t);u in J||(J[u]=r,r++,i[u]={},"function"==typeof o&&K.push(o(t))),c in X||(X[c]=a,a++,i[u][c]={},"function"==typeof s&&Q.push(s(t))),-1==Z.indexOf(d)&&Z.push(d),t._cellPos={idx:l,ix:J[u],iy:X[c]},l++,!function(t,e){var n=JSON.stringify(e);return t.some(function(t){return JSON.stringify(t)===n})}(tt,e=[u,c])?(tt.push(e),i[u][c]=t):-1==n.indexOf(u+c)&&(n.push(u+c),console.warn("The row/column position "+u+"/"+c+" has multiple values; ensure each cell has only a single value."))}),Z=Z.sort();var u=[];return Object.keys(X).forEach(function(t){Object.keys(J).forEach(function(e){var n=i[e][t];if(n)u.push(n);else{var r={idx:l,ix:J[e],iy:X[t]};l++,u.push({_cellPos:r})}})}),L?I(u):u}function W(){d3.selectAll(".cell-hover").classed("cell-hover",!1),d3.selectAll(".no-hover").classed("no-hover",!1),d3.selectAll(".row-hover").classed("row-hover",!1),d3.selectAll(".column-hover").classed("column-hover",!1)}var z,B,U,G=function(t){var e=M(L?ot(t):y(t));return F()&&!isNaN(e)||void 0!==e?e:C};function $(t){return Object.keys(t).sort(function(e,n){return t[e]-t[n]})}function q(t,e){return Object.keys(t).filter(function(n){return t[n]===e})[0]}var J={},X={},Z=[],K=[],Q=[],tt=[],et=i.utils.renderWatch(A,O),nt=["#a50026","#d73027","#f46d43","#fdae61","#fee090","#ffffbf","#e0f3f8","#abd9e9","#74add1","#4575b4","#313695"],it=function(t){return t._cellPos},rt=function(t){return it(t).ix},at=function(t){return it(t).iy},ot=function(t){return it(t).norm},st=function(t){return it(t).idx};function lt(f){return et.reset(),f.each(function(f){z=R(f);var v=d-c.left-c.right,_=h-c.top-c.bottom;U=v/Object.keys(J).length,B=x?U/x:_/Object.keys(X).length,x&&(_=B*Object.keys(X).length-c.top-c.bottom),t=d3.select(this),i.utils.initSVG(t),m.domain(e||$(J)).rangeBands(r||[0,v-k/2]),p.domain(n||$(X)).rangeBands(a||[0,_-k/2]),(g=F()?d3.scale.quantize():d3.scale.ordinal()).domain(u||(F()?L?d3.extent(z,function(t){return ot(t)}):d3.extent(Z):F()?void 0:Z)).range(l||nt);var M=t.selectAll("g.nv-heatMapWrap").data([z]),D=M.enter().append("g").attr("class","nvd3 nv-heatMapWrap");D.append("g").attr("class","cellWrap"),M.watchTransition(et,"nv-wrap: heatMapWrap").attr("transform","translate("+c.left+","+c.top+")");D.append("g").attr("class","cellGrid").style("opacity",1e-6);var C=M.select(".cellGrid").selectAll(".gridLines.verticalGrid").data(Object.values(J).concat([Object.values(J).length]));C.enter().append("line").attr("class","gridLines verticalGrid"),C.exit().remove();var O=M.select(".cellGrid").selectAll(".gridLines.horizontalGrid").data(Object.values(X).concat([Object.values(X).length]));O.enter().append("line").attr("class","gridLines horizontalGrid"),O.exit().remove();var V=M.select(".cellWrap").selectAll(".nv-cell").data(function(t){return t},function(t){return st(t)}),I=(D.append("g").attr("class","xMetaWrap").attr("transform",function(){return"translate(0,"+(-j()-k-E)+")"}),M.select(".xMetaWrap").selectAll(".x-meta").data(K)),tt=(I.enter().append("rect").attr("class","x-meta meta").attr("width",U-k).attr("height",j()).attr("transform","translate(0,0)").attr("fill",function(t){return T(t)}),D.append("g").attr("class","yMetaWrap").attr("transform",function(t,e){return"translate("+(-N()-k-E)+",0)"}),M.select(".yMetaWrap").selectAll(".y-meta").data(Q));tt.enter().append("rect").attr("class","y-meta meta").attr("width",N()).attr("height",B-k).attr("transform",function(t,e){return"translate(0,0)"}).attr("fill",function(t,e){return Y(t)});I.exit().remove(),tt.exit().remove();var it=V.enter().append("g").style("opacity",1e-6).attr("transform",function(t){return"translate(0,"+at(t)*B+")"}).attr("data-row",function(t){return at(t)}).attr("data-column",function(t){return rt(t)});it.append("rect"),it.append("text").attr("text-anchor","middle").attr("dy",4).attr("class","cell-text"),V.selectAll("rect").watchTransition(et,"heatMap: rect").attr("width",U-k).attr("height",B-k).attr("rx",w).attr("ry",w).style("stroke",function(t){return P(t)}),V.attr("class",function(t){return isNaN(y(t))?"nv-cell cell-missing":"nv-cell"}).watchTransition(et,"heatMap: cells").style({opacity:1,fill:function(t){return P(t)}}).attr("transform",function(t){return"translate("+rt(t)*U+","+at(t)*B+")"}).attr("class",function(t){return isNaN(y(t))?"nv-cell cell-missing":"nv-cell"}),V.exit().remove(),V.selectAll("text").watchTransition(et,"heatMap: cells text").text(function(t){return G(t)}).attr("x",function(t){return(U-k)/2}).attr("y",function(t){return(B-k)/2}).style("fill",function(t){return function(t){if(S){var e=d3.rgb(t);return(299*e.r+587*e.g+114*e.b)/1e3>=128?"#404040":"#EDEDED"}return"black"}(P(t))}).style("opacity",function(){return b?1:0}),M.selectAll(".verticalGrid").watchTransition(et,"heatMap: gridLines").attr("y1",0).attr("y2",_-k).attr("x1",function(t){return t*U-k/2}).attr("x2",function(t){return t*U-k/2});var lt=Object.keys(X).length;M.selectAll(".horizontalGrid").watchTransition(et,"heatMap: gridLines").attr("x1",function(t){return 0==t||t==lt?-k:0}).attr("x2",function(t){return 0==t||t==lt?v:v-k}).attr("y1",function(t){return t*B-k/2}).attr("y2",function(t){return t*B-k/2}),M.select(".cellGrid").watchTransition(et,"heatMap: gridLines").style({"stroke-width":k,opacity:function(){return H?1:1e-6}});M.selectAll(".x-meta"),M.selectAll(".y-meta");var ut=M.selectAll(".meta");I.watchTransition(et,"heatMap: xMetaRect").attr("width",U-k).attr("height",j()).attr("transform",function(t,e){return"translate("+e*U+",0)"}),tt.watchTransition(et,"heatMap: yMetaRect").attr("width",N()).attr("height",B-k).attr("transform",function(t,e){return"translate(0,"+e*B+")"}),M.select(".xMetaWrap").watchTransition(et,"heatMap: xMetaWrap").attr("transform",function(t,e){return"translate(0,"+(-j()-k-E)+")"}).style("opacity",function(){return!1!==o?1:0}),M.select(".yMetaWrap").watchTransition(et,"heatMap: yMetaWrap").attr("transform",function(t,e){return"translate("+(-N()-k-E)+",0)"}).style("opacity",function(){return!1!==s?1:0}),V.on("mouseover",function(t,e){var n=st(t),i=rt(t),r=at(t);d3.selectAll(".nv-cell").each(function(t){n==st(t)?(d3.select(this).classed("cell-hover",!0),d3.select(this).classed("no-hover",!1)):(d3.select(this).classed("no-hover",!0),d3.select(this).classed("cell-hover",!1)),i==rt(t)&&(d3.select(this).classed("no-hover",!1),d3.select(this).classed("column-hover",!0)),r==at(t)&&(d3.select(this).classed("no-hover",!1),d3.select(this).classed("row-hover",!0))}),d3.selectAll(".x-meta").each(function(t,e){e==i?(d3.select(this).classed("cell-hover",!0),d3.select(this).classed("no-hover",!1)):(d3.select(this).classed("no-hover",!0),d3.select(this).classed("cell-hover",!1))}),d3.selectAll(".y-meta").each(function(t,e){e==r?(d3.select(this).classed("cell-hover",!0),d3.select(this).classed("no-hover",!1)):(d3.select(this).classed("no-hover",!0),d3.select(this).classed("cell-hover",!1))}),A.elementMouseover({value:q(J,i)+" & "+q(X,r),series:{value:G(t),color:d3.select(this).select("rect").style("fill")},e:d3.event})}).on("mouseout",function(t,e){d3.select(this).select("rect").node().getBBox();var n=d3.mouse(d3.select(".nv-heatMap").node()),i=n[0],r=n[1];(i+k>=v||r+k>=_||i<0||r<0)&&(W(),A.elementMouseout({e:d3.event}))}).on("mousemove",function(t,e){A.elementMousemove({e:d3.event})}),ut.on("mouseover",function(t,e){var n=-1!=d3.select(this).attr("class").indexOf("x-meta");d3.selectAll(".nv-cell").each(function(t){n&&e==rt(t)?(d3.select(this).classed("column-hover",!0),d3.select(this).classed("no-hover",!1)):n||e-K.length!=at(t)?(d3.select(this).classed("no-hover",!0),d3.select(this).classed("column-hover",!1),d3.select(this).classed("row-hover",!1)):(d3.select(this).classed("row-hover",!0),d3.select(this).classed("no-hover",!1)),d3.select(this).classed("cell-hover",!1)}),d3.selectAll(".meta").classed("no-hover",!0),d3.select(this).classed("cell-hover",!0),d3.select(this).classed("no-hover",!1),A.elementMouseover({value:n?"Column meta":"Row meta",series:{value:t,color:d3.select(this).style("fill")}})}).on("mouseout",function(t,e){var n=-1!=d3.select(this).attr("class").indexOf("x-meta"),i=(d3.select(this).node().getBBox(),d3.mouse(d3.select(n?".xMetaWrap":".yMetaWrap").node())),r=i[0],a=i[1];(a<0||r<0||n&&r+k>=v||!n&&a+k>=_)&&(W(),A.elementMouseout({e:d3.event}))}).on("mousemove",function(t,e){A.elementMousemove({e:d3.event})})}),et.renderEnd("heatMap immediate"),lt}return lt.dispatch=A,lt.options=i.utils.optionsFunc.bind(lt),lt._options=Object.create({},{width:{get:function(){return d},set:function(t){d=t}},height:{get:function(){return h},set:function(t){h=t}},showCellValues:{get:function(){return b},set:function(t){b=t}},x:{get:function(){return v},set:function(t){v=t}},y:{get:function(){return _},set:function(t){_=t}},cellValue:{get:function(){return y},set:function(t){y=t}},missingDataColor:{get:function(){return D},set:function(t){D=t}},missingDataLabel:{get:function(){return C},set:function(t){C=t}},xScale:{get:function(){return m},set:function(t){m=t}},yScale:{get:function(){return p},set:function(t){p=t}},colorScale:{get:function(){return g},set:function(t){g=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return r},set:function(t){r=t}},yRange:{get:function(){return a},set:function(t){a=t}},colorRange:{get:function(){return l},set:function(t){l=t}},colorDomain:{get:function(){return u},set:function(t){u=t}},xMeta:{get:function(){return o},set:function(t){o=t}},yMeta:{get:function(){return s},set:function(t){s=t}},xMetaColorScale:{get:function(){return color},set:function(t){color=i.utils.getColor(t)}},yMetaColorScale:{get:function(){return color},set:function(t){color=i.utils.getColor(t)}},cellAspectRatio:{get:function(){return x},set:function(t){x=t}},cellRadius:{get:function(){return w},set:function(t){w=t}},cellHeight:{get:function(){return B}},cellWidth:{get:function(){return U}},normalize:{get:function(){return L},set:function(t){L=t}},cellBorderWidth:{get:function(){return k},set:function(t){k=t}},highContrastText:{get:function(){return S},set:function(t){S=t}},cellValueFormat:{get:function(){return M},set:function(t){M=t}},id:{get:function(){return f},set:function(t){f=t}},metaOffset:{get:function(){return E},set:function(t){E=t}},xMetaHeight:{get:function(){return j},set:function(t){j=t}},yMetaWidth:{get:function(){return N},set:function(t){N=t}},showGrid:{get:function(){return H},set:function(t){H=t}},margin:{get:function(){return c},set:function(t){c.top=void 0!==t.top?t.top:c.top,c.right=void 0!==t.right?t.right:c.right,c.bottom=void 0!==t.bottom?t.bottom:c.bottom,c.left=void 0!==t.left?t.left:c.left}},duration:{get:function(){return O},set:function(t){O=t,et.reset(O)}}}),i.utils.initOptions(lt),lt},i.models.heatMapChart=function(){"use strict";var t,e,n=i.models.heatMap(),r=i.models.legend(),a=(i.models.legend(),i.models.legend(),i.models.tooltip()),o=i.models.axis(),s=i.models.axis(),l={top:20,right:10,bottom:50,left:60},u=null,c=null,d=(i.utils.getColor(),!0),h=!1,f=!0,m=!0,p="left",g="top",v=0,_=null,y=d3.dispatch("beforeUpdate","renderEnd"),b=250;o.orient(g).showMaxMin(!1).tickFormat(function(t){return t}),s.orient(p).showMaxMin(!1).tickFormat(function(t){return t}),a.duration(0).headerEnabled(!0).keyFormatter(function(t,e){return o.tickFormat()(t,e)});var M=i.utils.renderWatch(y,b);function x(a){return M.reset(),M.models(n),M.models(o),M.models(s),a.each(function(a){var _=d3.select(this);i.utils.initSVG(_);var w=i.utils.availableWidth(u,_,l),k=i.utils.availableHeight(c,_,l);if(x.update=function(){y.beforeUpdate(),_.transition().duration(b).call(x)},x.container=this,!a||!a.length)return i.utils.noData(x,_),x;_.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale();var L=_.selectAll("g.nv-wrap").data([a]),S=L.enter().append("g").attr("class","nvd3 nv-wrap").append("g"),T=L.select("g");S.append("g").attr("class","nv-heatMap"),S.append("g").attr("class","nv-legendWrap"),S.append("g").attr("class","nv-x nv-axis"),S.append("g").attr("class","nv-y nv-axis"),T.attr("transform","translate("+l.left+","+l.top+")"),n.width(w).height(k),T.select(".nv-heatMap").datum(a.filter(function(t){return!t.disabled})).transition().call(n),n.cellAspectRatio()&&(k=n.cellHeight()*e.domain().length,n.height(k)),o.scale(t)._ticks(i.utils.calcTicksX(w/100,a)).tickSize(-k,0);var Y=T.select(".nv-x.nv-axis");Y.call(o).watchTransition(M,"heatMap: axisX").selectAll(".tick").style("opacity",function(){return f?1:0}),Y.selectAll("g").selectAll(".tick text").attr("transform",function(t,e,n){return"translate(0, "+(h?n%2==0?"5":"17":"0")+") rotate("+(0!=v?v:"0")+" 0,0)"}).style("text-anchor",v>0?"start":v<0?"end":"middle");var D=-5;if("function"==typeof n.xMeta()&&(Y.selectAll("text").style("text-anchor","middle"),D=-n.xMetaHeight()()/2-n.metaOffset()+3),"bottom"==g){if(Y.watchTransition(M,"heatMap: axisX").attr("transform","translate(0,"+(k-D)+")"),!1!==n.xMeta()){var C=k+n.metaOffset()+n.cellBorderWidth();T.select(".xMetaWrap").watchTransition(M,"heatMap: xMetaWrap").attr("transform",function(t,e){return"translate(0,"+C+")"})}}else Y.watchTransition(M,"heatMap: axisX").attr("transform","translate(0,"+D+")");s.scale(e)._ticks(i.utils.calcTicksY(k/36,a)).tickSize(-w,0);var E=T.select(".nv-y.nv-axis");E.call(s).watchTransition(M,"heatMap: axisY").selectAll(".tick").style("opacity",function(){return m?1:0});var A=-5;if("function"==typeof n.yMeta()&&(E.selectAll("text").style("text-anchor","middle"),A=-n.yMetaWidth()()/2-n.metaOffset()),"right"==p){if(E.attr("transform","translate("+(w-A)+",0)"),!1!==n.yMeta()){C=w+n.metaOffset()+n.cellBorderWidth();T.select(".yMetaWrap").watchTransition(M,"heatMap: yMetaWrap").attr("transform",function(t,e){return"translate("+C+",0)"})}}else E.attr("transform","translate("+A+",0)");var O=T.select(".nv-legendWrap");r.width(w).color(n.colorScale().range());var j=function(){var t=n.colorScale();return"string"==typeof t.domain()[0]?t.domain():t.range().map(function(e){var n=t.invertExtent(e);return null===n[0]&&(n[0]=t.domain()[0]),null===n[1]&&(n[1]=t.domain()[1]),n})}().map(function(t){return Array.isArray(t)?{key:t[0].toFixed(1)+" - "+t[1].toFixed(1)}:{key:t}});O.datum(j).call(r).attr("transform","translate(0,"+("top"==g?k:-30)+")"),O.watchTransition(M,"heatMap: nv-legendWrap").style("opacity",function(){return d?1:0})}),d3.selectAll(".nv-axis").selectAll("line").style("stroke-opacity",0),d3.select(".nv-y").select("path.domain").remove(),M.renderEnd("heatMap chart immediate"),x}return n.dispatch.on("elementMouseover.tooltip",function(t){a.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){a.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){a()}),x.dispatch=y,x.heatMap=n,x.legend=r,x.xAxis=o,x.yAxis=s,x.tooltip=a,x.options=i.utils.optionsFunc.bind(x),x._options=Object.create({},{width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},showLegend:{get:function(){return d},set:function(t){d=t}},noData:{get:function(){return _},set:function(t){_=t}},showXAxis:{get:function(){return f},set:function(t){f=t}},showYAxis:{get:function(){return m},set:function(t){m=t}},staggerLabels:{get:function(){return h},set:function(t){h=t}},rotateLabels:{get:function(){return v},set:function(t){v=t}},margin:{get:function(){return l},set:function(t){void 0!==t.top&&(l.top=t.top,t.top),l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},duration:{get:function(){return b},set:function(t){b=t,M.reset(b),n.duration(b),o.duration(b),s.duration(b)}},alignYAxis:{get:function(){return p},set:function(t){p=t,s.orient(t)}},alignXAxis:{get:function(){return g},set:function(t){g=t,o.orient(t)}}}),i.utils.inheritOptions(x,n),i.utils.initOptions(x),x},i.models.historicalBar=function(){"use strict";var t,e,n,r,a={top:0,right:0,bottom:0,left:0},o=null,s=null,l=Math.floor(1e4*Math.random()),u=null,c=d3.scale.linear(),d=d3.scale.linear(),h=function(t){return t.x},f=function(t){return t.y},m=[],p=[0],g=!1,v=!0,_=i.utils.defaultColor(),y=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),b=!0,M=i.utils.renderWatch(y,0);function x(w){return w.each(function(x){M.reset(),u=d3.select(this);var w=i.utils.availableWidth(o,u,a),k=i.utils.availableHeight(s,u,a);i.utils.initSVG(u),c.domain(t||d3.extent(x[0].values.map(h).concat(m))),g?c.range(n||[.5*w/x[0].values.length,w*(x[0].values.length-.5)/x[0].values.length]):c.range(n||[0,w]),d.domain(e||d3.extent(x[0].values.map(f).concat(p))).range(r||[k,0]),c.domain()[0]===c.domain()[1]&&(c.domain()[0]?c.domain([c.domain()[0]-.01*c.domain()[0],c.domain()[1]+.01*c.domain()[1]]):c.domain([-1,1])),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]+.01*d.domain()[0],d.domain()[1]-.01*d.domain()[1]]):d.domain([-1,1]));var L=u.selectAll("g.nv-wrap.nv-historicalBar-"+l).data([x[0].values]),S=L.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBar-"+l),T=S.append("defs"),Y=S.append("g"),D=L.select("g");Y.append("g").attr("class","nv-bars"),L.attr("transform","translate("+a.left+","+a.top+")"),u.on("click",function(t,e){y.chartClick({data:t,index:e,pos:d3.event,id:l})}),T.append("clipPath").attr("id","nv-chart-clip-path-"+l).append("rect"),L.select("#nv-chart-clip-path-"+l+" rect").attr("width",w).attr("height",k),D.attr("clip-path",v?"url(#nv-chart-clip-path-"+l+")":"");var C=L.select(".nv-bars").selectAll(".nv-bar").data(function(t){return t},function(t,e){return h(t,e)});C.exit().remove(),C.enter().append("rect").attr("x",0).attr("y",function(t,e){return i.utils.NaNtoZero(d(Math.max(0,f(t,e))))}).attr("height",function(t,e){return i.utils.NaNtoZero(Math.abs(d(f(t,e))-d(0)))}).attr("transform",function(t,e){return"translate("+(c(h(t,e))-w/x[0].values.length*.45)+",0)"}).on("mouseover",function(t,e){b&&(d3.select(this).classed("hover",!0),y.elementMouseover({data:t,index:e,color:d3.select(this).style("fill")}))}).on("mouseout",function(t,e){b&&(d3.select(this).classed("hover",!1),y.elementMouseout({data:t,index:e,color:d3.select(this).style("fill")}))}).on("mousemove",function(t,e){b&&y.elementMousemove({data:t,index:e,color:d3.select(this).style("fill")})}).on("click",function(t,e){if(b){y.elementClick({data:t,index:e,color:d3.select(this).style("fill"),event:d3.event,element:this}),d3.event.stopPropagation()}}).on("dblclick",function(t,e){b&&(y.elementDblClick({data:t,index:e,color:d3.select(this).style("fill")}),d3.event.stopPropagation())}),C.attr("fill",function(t,e){return _(t,e)}).attr("class",function(t,e,n){return(f(t,e)<0?"nv-bar negative":"nv-bar positive")+" nv-bar-"+n+"-"+e}).watchTransition(M,"bars").attr("transform",function(t,e){return"translate("+(c(h(t,e))-w/x[0].values.length*.45)+",0)"}).attr("width",w/x[0].values.length*.9),C.watchTransition(M,"bars").attr("y",function(t,e){var n=f(t,e)<0?d(0):d(0)-d(f(t,e))<1?d(0)-1:d(f(t,e));return i.utils.NaNtoZero(n)}).attr("height",function(t,e){return i.utils.NaNtoZero(Math.max(Math.abs(d(f(t,e))-d(0)),1))})}),M.renderEnd("historicalBar immediate"),x}return x.highlightPoint=function(t,e){u.select(".nv-bars .nv-bar-0-"+t).classed("hover",e)},x.clearHighlights=function(){u.select(".nv-bars .nv-bar.hover").classed("hover",!1)},x.dispatch=y,x.options=i.utils.optionsFunc.bind(x),x._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},forceX:{get:function(){return m},set:function(t){m=t}},forceY:{get:function(){return p},set:function(t){p=t}},padData:{get:function(){return g},set:function(t){g=t}},x:{get:function(){return h},set:function(t){h=t}},y:{get:function(){return f},set:function(t){f=t}},xScale:{get:function(){return c},set:function(t){c=t}},yScale:{get:function(){return d},set:function(t){d=t}},xDomain:{get:function(){return t},set:function(e){t=e}},yDomain:{get:function(){return e},set:function(t){e=t}},xRange:{get:function(){return n},set:function(t){n=t}},yRange:{get:function(){return r},set:function(t){r=t}},clipEdge:{get:function(){return v},set:function(t){v=t}},id:{get:function(){return l},set:function(t){l=t}},interactive:{get:function(){return b},set:function(t){b=t}},margin:{get:function(){return a},set:function(t){a.top=void 0!==t.top?t.top:a.top,a.right=void 0!==t.right?t.right:a.right,a.bottom=void 0!==t.bottom?t.bottom:a.bottom,a.left=void 0!==t.left?t.left:a.left}},color:{get:function(){return _},set:function(t){_=i.utils.getColor(t)}}}),i.utils.initOptions(x),x},i.models.historicalBarChart=function(t){"use strict";var e,n,r=t||i.models.historicalBar(),a=i.models.axis(),o=i.models.axis(),s=i.models.legend(),l=i.interactiveGuideline(),u=i.models.tooltip(),c={top:30,right:90,bottom:50,left:90},d=null,h=i.utils.defaultColor(),f=null,m=null,p=!1,g=!0,v=!0,_=!1,y=!1,b={},M=null,x=null,w=d3.dispatch("tooltipHide","stateChange","changeState","renderEnd"),k=250;a.orient("bottom").tickPadding(7),o.orient(_?"right":"left"),u.duration(0).headerEnabled(!1).valueFormatter(function(t,e){return o.tickFormat()(t,e)}).headerFormatter(function(t,e){return a.tickFormat()(t,e)});var L=i.utils.renderWatch(w,0);function S(t){return t.each(function(u){L.reset(),L.models(r),g&&L.models(a),v&&L.models(o);var x=d3.select(this);i.utils.initSVG(x);var T,Y=i.utils.availableWidth(f,x,c),D=i.utils.availableHeight(m,x,c);if(S.update=function(){x.transition().duration(k).call(S)},S.container=this,b.disabled=u.map(function(t){return!!t.disabled}),!M)for(T in M={},b)b[T]instanceof Array?M[T]=b[T].slice(0):M[T]=b[T];if(!(u&&u.length&&u.filter(function(t){return t.values.length}).length))return i.utils.noData(S,x),S;x.selectAll(".nv-noData").remove(),e=r.xScale(),n=r.yScale();var C=x.selectAll("g.nv-wrap.nv-historicalBarChart").data([u]),E=C.enter().append("g").attr("class","nvd3 nv-wrap nv-historicalBarChart").append("g"),A=C.select("g");E.append("g").attr("class","nv-x nv-axis"),E.append("g").attr("class","nv-y nv-axis"),E.append("g").attr("class","nv-barsWrap"),E.append("g").attr("class","nv-legendWrap"),E.append("g").attr("class","nv-interactive"),p?(s.width(Y),A.select(".nv-legendWrap").datum(u).call(s),d||s.height()===c.top||(c.top=s.height(),D=i.utils.availableHeight(m,x,c)),C.select(".nv-legendWrap").attr("transform","translate(0,"+-c.top+")")):A.select(".nv-legendWrap").selectAll("*").remove(),C.attr("transform","translate("+c.left+","+c.top+")"),_&&A.select(".nv-y.nv-axis").attr("transform","translate("+Y+",0)"),y&&(l.width(Y).height(D).margin({left:c.left,top:c.top}).svgContainer(x).xScale(e),C.select(".nv-interactive").call(l)),r.width(Y).height(D).color(u.map(function(t,e){return t.color||h(t,e)}).filter(function(t,e){return!u[e].disabled})),A.select(".nv-barsWrap").datum(u.filter(function(t){return!t.disabled})).transition().call(r),g&&(a.scale(e)._ticks(i.utils.calcTicksX(Y/100,u)).tickSize(-D,0),A.select(".nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")"),A.select(".nv-x.nv-axis").transition().call(a)),v&&(o.scale(n)._ticks(i.utils.calcTicksY(D/36,u)).tickSize(-Y,0),A.select(".nv-y.nv-axis").transition().call(o)),l.dispatch.on("elementMousemove",function(t){r.clearHighlights();var e,n,s,c=[];u.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(a,o){n=i.interactiveBisect(a.values,t.pointXValue,S.x()),r.highlightPoint(n,!0);var l=a.values[n];void 0!==l&&(void 0===e&&(e=l),void 0===s&&(s=S.xScale()(S.x()(l,n))),c.push({key:a.key,value:S.y()(l,n),color:h(a,a.seriesIndex),data:a.values[n]}))});var d=a.tickFormat()(S.x()(e,n));l.tooltip.valueFormatter(function(t,e){return o.tickFormat()(t)}).data({value:d,index:n,series:c})(),l.renderGuideLine(s)}),l.dispatch.on("elementMouseout",function(t){w.tooltipHide(),r.clearHighlights()}),s.dispatch.on("legendClick",function(e,n){e.disabled=!e.disabled,u.filter(function(t){return!t.disabled}).length||u.map(function(t){return t.disabled=!1,C.selectAll(".nv-series").classed("disabled",!1),t}),b.disabled=u.map(function(t){return!!t.disabled}),w.stateChange(b),t.transition().call(S)}),s.dispatch.on("legendDblclick",function(t){u.forEach(function(t){t.disabled=!0}),t.disabled=!1,b.disabled=u.map(function(t){return!!t.disabled}),w.stateChange(b),S.update()}),w.on("changeState",function(t){void 0!==t.disabled&&(u.forEach(function(e,n){e.disabled=t.disabled[n]}),b.disabled=t.disabled),S.update()})}),L.renderEnd("historicalBarChart immediate"),S}return r.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:S.x()(t.data),value:S.y()(t.data),color:t.color},u.data(t).hidden(!1)}),r.dispatch.on("elementMouseout.tooltip",function(t){u.hidden(!0)}),r.dispatch.on("elementMousemove.tooltip",function(t){u()}),S.dispatch=w,S.bars=r,S.legend=s,S.xAxis=a,S.yAxis=o,S.interactiveLayer=l,S.tooltip=u,S.options=i.utils.optionsFunc.bind(S),S._options=Object.create({},{width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return m},set:function(t){m=t}},showLegend:{get:function(){return p},set:function(t){p=t}},showXAxis:{get:function(){return g},set:function(t){g=t}},showYAxis:{get:function(){return v},set:function(t){v=t}},defaultState:{get:function(){return M},set:function(t){M=t}},noData:{get:function(){return x},set:function(t){x=t}},margin:{get:function(){return c},set:function(t){void 0!==t.top&&(c.top=t.top,d=t.top),c.right=void 0!==t.right?t.right:c.right,c.bottom=void 0!==t.bottom?t.bottom:c.bottom,c.left=void 0!==t.left?t.left:c.left}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t),s.color(h),r.color(h)}},duration:{get:function(){return k},set:function(t){k=t,L.reset(k),o.duration(k),a.duration(k)}},rightAlignYAxis:{get:function(){return _},set:function(t){_=t,o.orient(t?"right":"left")}},useInteractiveGuideline:{get:function(){return y},set:function(t){y=t,!0===t&&S.interactive(!1)}}}),i.utils.inheritOptions(S,r),i.utils.initOptions(S),S},i.models.ohlcBarChart=function(){var t=i.models.historicalBarChart(i.models.ohlcBar());return t.useInteractiveGuideline(!0),t.interactiveLayer.tooltip.contentGenerator(function(e){var n=e.series[0].data;return'<h3 style="color: #'+(n.open<n.close?"2ca02c":"d62728")+'">'+e.value+"</h3><table><tr><td>open:</td><td>"+t.yAxis.tickFormat()(n.open)+"</td></tr><tr><td>close:</td><td>"+t.yAxis.tickFormat()(n.close)+"</td></tr><tr><td>high</td><td>"+t.yAxis.tickFormat()(n.high)+"</td></tr><tr><td>low:</td><td>"+t.yAxis.tickFormat()(n.low)+"</td></tr></table>"}),t},i.models.candlestickBarChart=function(){var t=i.models.historicalBarChart(i.models.candlestickBar());return t.useInteractiveGuideline(!0),t.interactiveLayer.tooltip.contentGenerator(function(e){var n=e.series[0].data;return'<h3 style="color: #'+(n.open<n.close?"2ca02c":"d62728")+'">'+e.value+"</h3><table><tr><td>open:</td><td>"+t.yAxis.tickFormat()(n.open)+"</td></tr><tr><td>close:</td><td>"+t.yAxis.tickFormat()(n.close)+"</td></tr><tr><td>high</td><td>"+t.yAxis.tickFormat()(n.high)+"</td></tr><tr><td>low:</td><td>"+t.yAxis.tickFormat()(n.low)+"</td></tr></table>"}),t},i.models.legend=function(){"use strict";var t={top:5,right:0,bottom:5,left:0},e=400,n=20,r=function(t){return t.key},a=function(t){return t},o=i.utils.getColor(),s=20,l=!0,u=32,c=!0,d=!0,h=!0,f=!1,m=!1,p=d3.dispatch("legendClick","legendDblclick","legendMouseover","legendMouseout","stateChange"),g="classic";function v(_){function y(t,e){return"furious"!=g?"#000":m?t.disengaged?"#000":"#fff":m?void 0:(t.color||(t.color=o(t,e)),t.disabled?t.color:"#fff")}function b(t,e){return m&&"furious"==g&&t.disengaged?"#eee":t.color||o(t,e)}function M(t,e){return m&&"furious"==g?1:t.disabled?0:1}return _.each(function(o){var v=e-t.left-t.right,_=d3.select(this);i.utils.initSVG(_);var x=_.selectAll("g.nv-legend").data([o]),w=x.enter().append("g").attr("class","nvd3 nv-legend").append("g"),k=x.select("g");c?x.attr("transform","translate("+-t.right+","+t.top+")"):x.attr("transform","translate("+t.left+","+t.top+")");var L,S,T=k.selectAll(".nv-series").data(function(t){return"furious"!=g?t:t.filter(function(t){return!!m||!t.disengaged})}),Y=T.enter().append("g").attr("class","nv-series");switch(g){case"furious":S=23;break;case"classic":S=20}if("classic"==g)Y.append("circle").style("stroke-width",2).attr("class","nv-legend-symbol").attr("r",5),L=T.select(".nv-legend-symbol");else if("furious"==g){Y.append("rect").style("stroke-width",2).attr("class","nv-legend-symbol").attr("rx",3).attr("ry",3),L=T.select(".nv-legend-symbol"),Y.append("g").attr("class","nv-check-box").property("innerHTML",'<path d="M0.5,5 L22.5,5 L22.5,26.5 L0.5,26.5 L0.5,5 Z" class="nv-box"></path><path d="M5.5,12.8618467 L11.9185089,19.2803556 L31,0.198864511" class="nv-check"></path>').attr("transform","translate(-10,-8)scale(0.5)"),T.select(".nv-check-box").each(function(t,e){d3.select(this).selectAll("path").attr("stroke",y(t,e))})}Y.append("text").attr("text-anchor","start").attr("class","nv-legend-text").attr("dy",".32em").attr("dx","8");var D=T.select("text.nv-legend-text");T.on("mouseover",function(t,e){p.legendMouseover(t,e)}).on("mouseout",function(t,e){p.legendMouseout(t,e)}).on("click",function(t,e){p.legendClick(t,e);var n=T.data();if(d){if("classic"==g)f?(n.forEach(function(t){t.disabled=!0}),t.disabled=!1):(t.disabled=!t.disabled,n.every(function(t){return t.disabled})&&n.forEach(function(t){t.disabled=!1}));else if("furious"==g)if(m)t.disengaged=!t.disengaged,t.userDisabled=void 0==t.userDisabled?!!t.disabled:t.userDisabled,t.disabled=t.disengaged||t.userDisabled;else if(!m){t.disabled=!t.disabled,t.userDisabled=t.disabled,n.filter(function(t){return!t.disengaged}).every(function(t){return t.userDisabled})&&n.forEach(function(t){t.disabled=t.userDisabled=!1})}p.stateChange({disabled:n.map(function(t){return!!t.disabled}),disengaged:n.map(function(t){return!!t.disengaged})})}}).on("dblclick",function(t,e){if(h){if("furious"==g&&m)return;if(p.legendDblclick(t,e),d){var n=T.data();n.forEach(function(t){t.disabled=!0,"furious"==g&&(t.userDisabled=t.disabled)}),t.disabled=!1,"furious"==g&&(t.userDisabled=t.disabled),p.stateChange({disabled:n.map(function(t){return!!t.disabled})})}}}),T.classed("nv-disabled",function(t){return t.userDisabled}),T.exit().remove(),D.attr("fill",y).text(function(t){return a(r(t))});var C=0;if(l){var E=[];T.each(function(t,e){var n,o;if(a(r(t))&&a(r(t)).length>s){var l=a(r(t)).substring(0,s);n=d3.select(this).select("text").text(l+"..."),d3.select(this).append("svg:title").text(a(r(t)))}else n=d3.select(this).select("text");try{if((o=n.node().getComputedTextLength())<=0)throw Error()}catch(t){o=i.utils.calcApproxTextWidth(n)}E.push(o+u)});var A=0,O=[];for(C=0;C<v&&A<E.length;)O[A]=E[A],C+=E[A++];for(0===A&&(A=1);C>v&&A>1;){O=[],A--;for(var j=0;j<E.length;j++)E[j]>(O[j%A]||0)&&(O[j%A]=E[j]);C=O.reduce(function(t,e,n,i){return t+e})}for(var N=[],H=0,V=0;H<A;H++)N[H]=V,V+=O[H];T.attr("transform",function(t,e){return"translate("+N[e%A]+","+(5+Math.floor(e/A)*S)+")"}),c?k.attr("transform","translate("+(e-t.right-C)+","+t.top+")"):k.attr("transform","translate(0,"+t.top+")"),n=t.top+t.bottom+Math.ceil(E.length/A)*S}else{var P,F=5,I=5,R=0;T.attr("transform",function(n,i){var r=d3.select(this).select("text").node().getComputedTextLength()+u;return P=I,e<t.left+t.right+P+r&&(I=P=5,F+=S),(I+=r)>R&&(R=I),C<P+R&&(C=P+R),"translate("+P+","+F+")"}),k.attr("transform","translate("+(e-t.right-R)+","+t.top+")"),n=t.top+t.bottom+F+15}"furious"==g&&(L.attr("width",function(t,e){return D[0][e].getComputedTextLength()+27}).attr("height",18).attr("y",-9).attr("x",-15),w.insert("rect",":first-child").attr("class","nv-legend-bg").attr("fill","#eee").attr("opacity",0),k.select(".nv-legend-bg").transition().duration(300).attr("x",-S).attr("width",C+S-12).attr("height",n+10).attr("y",-t.top-10).attr("opacity",m?1:0));L.style("fill",b).style("fill-opacity",M).style("stroke",b)}),v}return v.dispatch=p,v.options=i.utils.optionsFunc.bind(v),v._options=Object.create({},{width:{get:function(){return e},set:function(t){e=t}},height:{get:function(){return n},set:function(t){n=t}},key:{get:function(){return r},set:function(t){r=t}},keyFormatter:{get:function(){return a},set:function(t){a=t}},align:{get:function(){return l},set:function(t){l=t}},maxKeyLength:{get:function(){return s},set:function(t){s=t}},rightAlign:{get:function(){return c},set:function(t){c=t}},padding:{get:function(){return u},set:function(t){u=t}},updateState:{get:function(){return d},set:function(t){d=t}},enableDoubleClick:{get:function(){return h},set:function(t){h=t}},radioButtonMode:{get:function(){return f},set:function(t){f=t}},expanded:{get:function(){return m},set:function(t){m=t}},vers:{get:function(){return g},set:function(t){g=t}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},color:{get:function(){return o},set:function(t){o=i.utils.getColor(t)}}}),i.utils.initOptions(v),v},i.models.line=function(){"use strict";var t,e,n=i.models.scatter(),r={top:0,right:0,bottom:0,left:0},a=960,o=500,s=null,l=1.5,u=i.utils.defaultColor(),c=function(t){return t.x},d=function(t){return t.y},h=function(t,e){return!isNaN(d(t,e))&&null!==d(t,e)},f=function(t){return t.area},m=!1,p="linear",g=250,v=d3.dispatch("elementClick","elementMouseover","elementMouseout","renderEnd");n.pointSize(16).pointDomain([16,256]);var _,y,b=i.utils.renderWatch(v,g);function M(g){return b.reset(),b.models(n),g.each(function(g){s=d3.select(this);var v=i.utils.availableWidth(a,s,r),M=i.utils.availableHeight(o,s,r);i.utils.initSVG(s),t=n.xScale(),e=n.yScale(),_=_||t,y=y||e;var x=s.selectAll("g.nv-wrap.nv-line").data([g]),w=x.enter().append("g").attr("class","nvd3 nv-wrap nv-line"),k=w.append("defs"),L=w.append("g"),S=x.select("g");L.append("g").attr("class","nv-groups"),L.append("g").attr("class","nv-scatterWrap"),x.attr("transform","translate("+r.left+","+r.top+")"),n.width(v).height(M);var T=x.select(".nv-scatterWrap");T.call(n),k.append("clipPath").attr("id","nv-edge-clip-"+n.id()).append("rect"),x.select("#nv-edge-clip-"+n.id()+" rect").attr("width",v).attr("height",M>0?M:0),S.attr("clip-path",m?"url(#nv-edge-clip-"+n.id()+")":""),T.attr("clip-path",m?"url(#nv-edge-clip-"+n.id()+")":"");var Y=x.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t){return t.key});Y.enter().append("g").style("stroke-opacity",1e-6).style("stroke-width",function(t){return t.strokeWidth||l}).style("fill-opacity",1e-6),Y.exit().remove(),Y.attr("class",function(t,e){return(t.classed||"")+" nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}).style("fill",function(t,e){return u(t,e)}).style("stroke",function(t,e){return u(t,e)}),Y.watchTransition(b,"line: groups").style("stroke-opacity",1).style("fill-opacity",function(t){return t.fillOpacity||.5});var D=Y.selectAll("path.nv-area").data(function(t){return f(t)?[t]:[]});D.enter().append("path").attr("class","nv-area").attr("d",function(t){return d3.svg.area().interpolate(p).defined(h).x(function(t,e){return i.utils.NaNtoZero(_(c(t,e)))}).y0(function(t,e){return i.utils.NaNtoZero(y(d(t,e)))}).y1(function(t,n){return y(e.domain()[0]<=0?e.domain()[1]>=0?0:e.domain()[1]:e.domain()[0])}).apply(this,[t.values])}),Y.exit().selectAll("path.nv-area").remove(),D.watchTransition(b,"line: areaPaths").attr("d",function(n){return d3.svg.area().interpolate(p).defined(h).x(function(e,n){return i.utils.NaNtoZero(t(c(e,n)))}).y0(function(t,n){return i.utils.NaNtoZero(e(d(t,n)))}).y1(function(t,n){return e(e.domain()[0]<=0?e.domain()[1]>=0?0:e.domain()[1]:e.domain()[0])}).apply(this,[n.values])});var C=Y.selectAll("path.nv-line").data(function(t){return[t.values]});C.enter().append("path").attr("class","nv-line").attr("d",d3.svg.line().interpolate(p).defined(h).x(function(t,e){return i.utils.NaNtoZero(_(c(t,e)))}).y(function(t,e){return i.utils.NaNtoZero(y(d(t,e)))})),C.watchTransition(b,"line: linePaths").attr("d",d3.svg.line().interpolate(p).defined(h).x(function(e,n){return i.utils.NaNtoZero(t(c(e,n)))}).y(function(t,n){return i.utils.NaNtoZero(e(d(t,n)))})),_=t.copy(),y=e.copy()}),b.renderEnd("line immediate"),M}return M.dispatch=v,M.scatter=n,n.dispatch.on("elementClick",function(){v.elementClick.apply(this,arguments)}),n.dispatch.on("elementMouseover",function(){v.elementMouseover.apply(this,arguments)}),n.dispatch.on("elementMouseout",function(){v.elementMouseout.apply(this,arguments)}),M.options=i.utils.optionsFunc.bind(M),M._options=Object.create({},{width:{get:function(){return a},set:function(t){a=t}},height:{get:function(){return o},set:function(t){o=t}},defined:{get:function(){return h},set:function(t){h=t}},interpolate:{get:function(){return p},set:function(t){p=t}},clipEdge:{get:function(){return m},set:function(t){m=t}},margin:{get:function(){return r},set:function(t){r.top=void 0!==t.top?t.top:r.top,r.right=void 0!==t.right?t.right:r.right,r.bottom=void 0!==t.bottom?t.bottom:r.bottom,r.left=void 0!==t.left?t.left:r.left}},duration:{get:function(){return g},set:function(t){g=t,b.reset(g),n.duration(g)}},isArea:{get:function(){return f},set:function(t){f=d3.functor(t)}},x:{get:function(){return c},set:function(t){c=t,n.x(t)}},y:{get:function(){return d},set:function(t){d=t,n.y(t)}},color:{get:function(){return u},set:function(t){u=i.utils.getColor(t),n.color(u)}}}),i.utils.inheritOptions(M,n),i.utils.initOptions(M),M},i.models.lineChart=function(){"use strict";var t,e,n=i.models.line(),r=i.models.axis(),a=i.models.axis(),o=i.models.legend(),s=i.interactiveGuideline(),l=i.models.tooltip(),u=i.models.focus(i.models.line()),c={top:30,right:20,bottom:50,left:60},d=null,h=i.utils.defaultColor(),f=null,m=null,p=!0,g="top",v=!0,_=!0,y=!1,b=!1,M=!1,x=i.utils.state(),w=null,k=null,L=d3.dispatch("stateChange","changeState","renderEnd"),S=250;r.orient("bottom").tickPadding(7),a.orient(y?"right":"left"),n.clipEdge(!0).duration(0),l.valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),s.tooltip.valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)});var T=i.utils.renderWatch(L,S),Y=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},D=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function C(l){return T.reset(),T.models(n),v&&T.models(r),_&&T.models(a),l.each(function(l){var k=d3.select(this);i.utils.initSVG(k);var T,E=i.utils.availableWidth(f,k,c),A=i.utils.availableHeight(m,k,c)-(M?u.height():0);if(C.update=function(){0===S?k.call(C):k.transition().duration(S).call(C)},C.container=this,x.setter(D(l),C.update).getter(Y(l)).update(),x.disabled=l.map(function(t){return!!t.disabled}),!w)for(T in w={},x)x[T]instanceof Array?w[T]=x[T].slice(0):w[T]=x[T];if(!(l&&l.length&&l.filter(function(t){return t.values.length}).length))return i.utils.noData(C,k),C;k.selectAll(".nv-noData").remove(),u.dispatch.on("onBrush",function(t){R(t)}),t=n.xScale(),e=n.yScale();var O=k.selectAll("g.nv-wrap.nv-lineChart").data([l]),j=O.enter().append("g").attr("class","nvd3 nv-wrap nv-lineChart").append("g"),N=O.select("g");j.append("g").attr("class","nv-legendWrap");var H=j.append("g").attr("class","nv-focus");H.append("g").attr("class","nv-background").append("rect"),H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-linesWrap"),H.append("g").attr("class","nv-interactive");j.append("g").attr("class","nv-focusWrap");p?(o.width(E),N.select(".nv-legendWrap").datum(l).call(o),"bottom"===g?(c.bottom=r.height()+o.height(),A=i.utils.availableHeight(m,k,c),N.select(".nv-legendWrap").attr("transform","translate(0,"+(A+r.height())+")")):"top"===g&&(d||o.height()===c.top||(c.top=o.height(),A=i.utils.availableHeight(m,k,c)-(M?u.height():0)),O.select(".nv-legendWrap").attr("transform","translate(0,"+-c.top+")"))):N.select(".nv-legendWrap").selectAll("*").remove(),O.attr("transform","translate("+c.left+","+c.top+")"),y&&N.select(".nv-y.nv-axis").attr("transform","translate("+E+",0)"),b&&(s.width(E).height(A).margin({left:c.left,top:c.top}).svgContainer(k).xScale(t),O.select(".nv-interactive").call(s)),N.select(".nv-focus .nv-background rect").attr("width",E).attr("height",A),n.width(E).height(A).color(l.map(function(t,e){return t.color||h(t,e)}).filter(function(t,e){return!l[e].disabled}));var V=N.select(".nv-linesWrap").datum(l.filter(function(t){return!t.disabled}));function P(){v&&N.select(".nv-focus .nv-x.nv-axis").transition().duration(S).call(r)}function F(){_&&N.select(".nv-focus .nv-y.nv-axis").transition().duration(S).call(a)}if(v&&r.scale(t)._ticks(i.utils.calcTicksX(E/100,l)).tickSize(-A,0),_&&a.scale(e)._ticks(i.utils.calcTicksY(A/36,l)).tickSize(-E,0),N.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+A+")"),M||null!==u.brush.extent()){u.width(E),N.select(".nv-focusWrap").style("display",M?"initial":"none").attr("transform","translate(0,"+(A+c.bottom+u.margin().top)+")").call(u);var I=u.brush.empty()?u.xDomain():u.brush.extent();null!==I&&R(I)}else V.transition().call(n),P(),F();function R(t){N.select(".nv-focus .nv-linesWrap").datum(l.filter(function(t){return!t.disabled}).map(function(e,i){return{key:e.key,area:e.area,classed:e.classed,values:e.values.filter(function(e,i){return n.x()(e,i)>=t[0]&&n.x()(e,i)<=t[1]}),disableTooltip:e.disableTooltip}})).transition().duration(S).call(n),P(),F()}o.dispatch.on("stateChange",function(t){for(var e in t)x[e]=t[e];L.stateChange(x),C.update()}),s.dispatch.on("elementMousemove",function(e){n.clearHighlights();var r,o,c,d=[];if(l.filter(function(t,e){return t.seriesIndex=e,!t.disabled&&!t.disableTooltip}).forEach(function(a,s){var l=null!==u.brush.extent()?u.brush.empty()?u.xScale().domain():u.brush.extent():t.domain(),f=a.values.filter(function(t,e){return l[0]<=l[1]?n.x()(t,e)>=l[0]&&n.x()(t,e)<=l[1]:n.x()(t,e)>=l[1]&&n.x()(t,e)<=l[0]});if(f.length>0){var m=f[o=i.interactiveBisect(f,e.pointXValue,n.x())],p=C.y()(m,o);if(null!==p&&n.highlightPoint(s,a.values.indexOf(m),!0),void 0===m)return;void 0===r&&(r=m),void 0===c&&(c=C.xScale()(C.x()(m,o))),d.push({key:a.key,value:p,color:h(a,a.seriesIndex),data:m})}}),d.length>2){var f=C.yScale().invert(e.mouseY),m=.03*Math.abs(C.yScale().domain()[0]-C.yScale().domain()[1]),p=i.nearestValueIndex(d.map(function(t){return t.value}),f,m);null!==p&&(d[p].highlight=!0)}void 0!==o&&(s.tooltip.valueFormatter(s.tooltip.valueFormatter()||function(t,e){return null==t?"N/A":a.tickFormat()(t)}).data({value:C.x()(r,o),index:o,series:d})(),s.renderGuideLine(c))}),s.dispatch.on("elementClick",function(t){var e,r=[];l.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(n){var a=i.interactiveBisect(n.values,t.pointXValue,C.x()),o=n.values[a];if(void 0!==o){void 0===e&&(e=C.xScale()(C.x()(o,a)));var s=C.yScale()(C.y()(o,a));r.push({point:o,pointIndex:a,pos:[e,s],seriesIndex:n.seriesIndex,series:n})}}),n.dispatch.elementClick(r)}),s.dispatch.on("elementMouseout",function(t){n.clearHighlights()}),L.on("changeState",function(t){void 0!==t.disabled&&l.length===t.disabled.length&&(l.forEach(function(e,n){e.disabled=t.disabled[n]}),x.disabled=t.disabled),C.update()})}),T.renderEnd("lineChart immediate"),C}return n.dispatch.on("elementMouseover.tooltip",function(t){t.series.disableTooltip||l.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){l.hidden(!0)}),C.dispatch=L,C.lines=n,C.legend=o,C.focus=u,C.xAxis=r,C.x2Axis=u.xAxis,C.yAxis=a,C.y2Axis=u.yAxis,C.interactiveLayer=s,C.tooltip=l,C.state=x,C.dispatch=L,C.options=i.utils.optionsFunc.bind(C),C._options=Object.create({},{width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return m},set:function(t){m=t}},showLegend:{get:function(){return p},set:function(t){p=t}},legendPosition:{get:function(){return g},set:function(t){g=t}},showXAxis:{get:function(){return v},set:function(t){v=t}},showYAxis:{get:function(){return _},set:function(t){_=t}},defaultState:{get:function(){return w},set:function(t){w=t}},noData:{get:function(){return k},set:function(t){k=t}},focusEnable:{get:function(){return M},set:function(t){M=t}},focusHeight:{get:function(){return u.height()},set:function(t){u.height(t)}},focusShowAxisX:{get:function(){return u.showXAxis()},set:function(t){u.showXAxis(t)}},focusShowAxisY:{get:function(){return u.showYAxis()},set:function(t){u.showYAxis(t)}},brushExtent:{get:function(){return u.brushExtent()},set:function(t){u.brushExtent(t)}},focusMargin:{get:function(){return u.margin},set:function(t){void 0!==t.top&&(c.top=t.top,d=t.top),u.margin.right=void 0!==t.right?t.right:u.margin.right,u.margin.bottom=void 0!==t.bottom?t.bottom:u.margin.bottom,u.margin.left=void 0!==t.left?t.left:u.margin.left}},margin:{get:function(){return c},set:function(t){c.top=void 0!==t.top?t.top:c.top,c.right=void 0!==t.right?t.right:c.right,c.bottom=void 0!==t.bottom?t.bottom:c.bottom,c.left=void 0!==t.left?t.left:c.left}},duration:{get:function(){return S},set:function(t){S=t,T.reset(S),n.duration(S),u.duration(S),r.duration(S),a.duration(S)}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t),o.color(h),n.color(h),u.color(h)}},interpolate:{get:function(){return n.interpolate()},set:function(t){n.interpolate(t),u.interpolate(t)}},xTickFormat:{get:function(){return r.tickFormat()},set:function(t){r.tickFormat(t),u.xTickFormat(t)}},yTickFormat:{get:function(){return a.tickFormat()},set:function(t){a.tickFormat(t),u.yTickFormat(t)}},x:{get:function(){return n.x()},set:function(t){n.x(t),u.x(t)}},y:{get:function(){return n.y()},set:function(t){n.y(t),u.y(t)}},rightAlignYAxis:{get:function(){return y},set:function(t){y=t,a.orient(y?"right":"left")}},useInteractiveGuideline:{get:function(){return b},set:function(t){(b=t)&&(n.interactive(!1),n.useVoronoi(!1))}}}),i.utils.inheritOptions(C,n),i.utils.initOptions(C),C},i.models.lineWithFocusChart=function(){return i.models.lineChart().margin({bottom:30}).focusEnable(!0)},i.models.linePlusBarChart=function(){"use strict";var t,e,n,r,a,o,s,l=i.models.line(),u=i.models.line(),c=i.models.historicalBar(),d=i.models.historicalBar(),h=i.models.axis(),f=i.models.axis(),m=i.models.axis(),p=i.models.axis(),g=i.models.axis(),v=i.models.axis(),_=i.models.legend(),y=d3.svg.brush(),b=i.models.tooltip(),M={top:30,right:30,bottom:30,left:60},x=null,w={top:0,right:30,bottom:20,left:60},k=null,L=null,S=function(t){return t.x},T=function(t){return t.y},Y=i.utils.defaultColor(),D=!0,C=!0,E=!1,A=!0,O=50,j=null,N=null,H=d3.dispatch("brush","stateChange","changeState"),V=0,P=i.utils.state(),F=null,I=" (left axis)",R=" (right axis)",W=!1;l.clipEdge(!0),u.interactive(!1),u.pointActive(function(t){return!1}),h.orient("bottom").tickPadding(5),m.orient("left"),p.orient("right"),f.orient("bottom").tickPadding(5),g.orient("left"),v.orient("right"),b.headerEnabled(!0).headerFormatter(function(t,e){return h.tickFormat()(t,e)});var z=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},B=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}},U=function(t){return t.every(function(t){return t.disabled})};function G(b){return b.each(function(b){var N=d3.select(this);i.utils.initSVG(N);var $,q=i.utils.availableWidth(k,N,M),J=i.utils.availableHeight(L,N,M)-(C?O:0),X=O-w.top-w.bottom;if(G.update=function(){N.transition().duration(V).call(G)},G.container=this,P.setter(B(b),G.update).getter(z(b)).update(),P.disabled=b.map(function(t){return!!t.disabled}),!F)for($ in F={},P)P[$]instanceof Array?F[$]=P[$].slice(0):F[$]=P[$];if(!(b&&b.length&&b.filter(function(t){return t.values.length}).length))return i.utils.noData(G,N),G;N.selectAll(".nv-noData").remove();var Z=b.filter(function(t){return!t.disabled&&t.bar}),K=b.filter(function(t){return!t.bar});e=Z.length&&!W?c.xScale():l.xScale(),n=f.scale(),r=W?l.yScale():c.yScale(),a=W?c.yScale():l.yScale(),o=W?u.yScale():d.yScale(),s=W?d.yScale():u.yScale();var Q=b.filter(function(t){return!t.disabled&&(W?!t.bar:t.bar)}).map(function(t){return t.values.map(function(t,e){return{x:S(t,e),y:T(t,e)}})}),tt=b.filter(function(t){return!t.disabled&&(W?t.bar:!t.bar)}).map(function(t){return t.values.map(function(t,e){return{x:S(t,e),y:T(t,e)}})});e.range([0,q]),n.domain(d3.extent(d3.merge(Q.concat(tt)),function(t){return t.x})).range([0,q]);var et=N.selectAll("g.nv-wrap.nv-linePlusBar").data([b]),nt=et.enter().append("g").attr("class","nvd3 nv-wrap nv-linePlusBar").append("g"),it=et.select("g");nt.append("g").attr("class","nv-legendWrap");var rt=nt.append("g").attr("class","nv-focus");rt.append("g").attr("class","nv-x nv-axis"),rt.append("g").attr("class","nv-y1 nv-axis"),rt.append("g").attr("class","nv-y2 nv-axis"),rt.append("g").attr("class","nv-barsWrap"),rt.append("g").attr("class","nv-linesWrap");var at=nt.append("g").attr("class","nv-context");if(at.append("g").attr("class","nv-x nv-axis"),at.append("g").attr("class","nv-y1 nv-axis"),at.append("g").attr("class","nv-y2 nv-axis"),at.append("g").attr("class","nv-barsWrap"),at.append("g").attr("class","nv-linesWrap"),at.append("g").attr("class","nv-brushBackground"),at.append("g").attr("class","nv-x nv-brush"),D){var ot=_.align()?q/2:q,st=_.align()?ot:0;_.width(ot),it.select(".nv-legendWrap").datum(b.map(function(t){return t.originalKey=void 0===t.originalKey?t.key:t.originalKey,t.key=W?t.originalKey+(t.bar?R:I):t.originalKey+(t.bar?I:R),t})).call(_),x||_.height()===M.top||(M.top=_.height(),J=i.utils.availableHeight(L,N,M)-O),it.select(".nv-legendWrap").attr("transform","translate("+st+","+-M.top+")")}else it.select(".nv-legendWrap").selectAll("*").remove();et.attr("transform","translate("+M.left+","+M.top+")"),it.select(".nv-context").style("display",C?"initial":"none"),d.width(q).height(X).color(b.map(function(t,e){return t.color||Y(t,e)}).filter(function(t,e){return!b[e].disabled&&b[e].bar})),u.width(q).height(X).color(b.map(function(t,e){return t.color||Y(t,e)}).filter(function(t,e){return!b[e].disabled&&!b[e].bar}));var lt=it.select(".nv-context .nv-barsWrap").datum(Z.length?Z:[{values:[]}]),ut=it.select(".nv-context .nv-linesWrap").datum(U(K)?[{values:[]}]:K.filter(function(t){return!t.disabled}));it.select(".nv-context").attr("transform","translate(0,"+(J+M.bottom+w.top)+")"),lt.transition().call(d),ut.transition().call(u),A&&(f._ticks(i.utils.calcTicksX(q/100,b)).tickSize(-X,0),it.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+o.range()[0]+")"),it.select(".nv-context .nv-x.nv-axis").transition().call(f)),E&&(g.scale(o)._ticks(X/36).tickSize(-q,0),v.scale(s)._ticks(X/36).tickSize(Z.length?0:-q,0),it.select(".nv-context .nv-y3.nv-axis").style("opacity",Z.length?1:0).attr("transform","translate(0,"+n.range()[0]+")"),it.select(".nv-context .nv-y2.nv-axis").style("opacity",K.length?1:0).attr("transform","translate("+n.range()[1]+",0)"),it.select(".nv-context .nv-y1.nv-axis").transition().call(g),it.select(".nv-context .nv-y2.nv-axis").transition().call(v)),y.x(n).on("brush",ft),j&&y.extent(j);var ct=it.select(".nv-brushBackground").selectAll("g").data([j||y.extent()]),dt=ct.enter().append("g");dt.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",X),dt.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",X);var ht=it.select(".nv-x.nv-brush").call(y);function ft(){j=y.empty()?null:y.extent(),t=y.empty()?n.domain():y.extent(),H.brush({extent:t,brush:y}),y.empty()||y.extent(j),ct.data([y.empty()?n.domain():j]).each(function(t,e){var i=n(t[0])-n.range()[0],r=n.range()[1]-n(t[1]);d3.select(this).select(".left").attr("width",i<0?0:i),d3.select(this).select(".right").attr("x",n(t[1])).attr("width",r<0?0:r)}),c.width(q).height(J).color(b.map(function(t,e){return t.color||Y(t,e)}).filter(function(t,e){return!b[e].disabled&&b[e].bar})),l.width(q).height(J).color(b.map(function(t,e){return t.color||Y(t,e)}).filter(function(t,e){return!b[e].disabled&&!b[e].bar}));var o=it.select(".nv-focus .nv-barsWrap").datum(Z.length?Z.map(function(e,n){return{key:e.key,values:e.values.filter(function(e,n){return c.x()(e,n)>=t[0]&&c.x()(e,n)<=t[1]})}}):[{values:[]}]),s=it.select(".nv-focus .nv-linesWrap").datum(U(K)?[{values:[]}]:K.filter(function(t){return!t.disabled}).map(function(e,n){return{area:e.area,fillOpacity:e.fillOpacity,strokeWidth:e.strokeWidth,key:e.key,values:e.values.filter(function(e,n){return l.x()(e,n)>=t[0]&&l.x()(e,n)<=t[1]})}}));e=Z.length&&!W?c.xScale():l.xScale(),h.scale(e)._ticks(i.utils.calcTicksX(q/100,b)).tickSize(-J,0),h.domain([Math.ceil(t[0]),Math.floor(t[1])]),it.select(".nv-x.nv-axis").transition().duration(V).call(h),o.transition().duration(V).call(c),s.transition().duration(V).call(l),it.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),m.scale(r)._ticks(i.utils.calcTicksY(J/36,b)).tickSize(-q,0),p.scale(a)._ticks(i.utils.calcTicksY(J/36,b)),W?p.tickSize(K.length?0:-q,0):p.tickSize(Z.length?0:-q,0);var u=Z.length?1:0,d=K.length&&!U(K)?1:0,f=W?d:u,g=W?u:d;it.select(".nv-focus .nv-y1.nv-axis").style("opacity",f),it.select(".nv-focus .nv-y2.nv-axis").style("opacity",g).attr("transform","translate("+e.range()[1]+",0)"),it.select(".nv-focus .nv-y1.nv-axis").transition().duration(V).call(m),it.select(".nv-focus .nv-y2.nv-axis").transition().duration(V).call(p)}ht.selectAll("rect").attr("height",X),ht.selectAll(".resize").append("path").attr("d",function(t){var e=+("e"==t),n=e?1:-1,i=X/3;return"M"+.5*n+","+i+"A6,6 0 0 "+e+" "+6.5*n+","+(i+6)+"V"+(2*i-6)+"A6,6 0 0 "+e+" "+.5*n+","+2*i+"ZM"+2.5*n+","+(i+8)+"V"+(2*i-8)+"M"+4.5*n+","+(i+8)+"V"+(2*i-8)}),_.dispatch.on("stateChange",function(t){for(var e in t)P[e]=t[e];H.stateChange(P),G.update()}),H.on("changeState",function(t){void 0!==t.disabled&&(b.forEach(function(e,n){e.disabled=t.disabled[n]}),P.disabled=t.disabled),G.update()}),ft()}),G}return l.dispatch.on("elementMouseover.tooltip",function(t){b.duration(100).valueFormatter(function(t,e){return(W?{main:m,focus:g}:{main:p,focus:v}).main.tickFormat()(t,e)}).data(t).hidden(!1)}),l.dispatch.on("elementMouseout.tooltip",function(t){b.hidden(!0)}),c.dispatch.on("elementMouseover.tooltip",function(t){t.value=G.x()(t.data),t.series={value:G.y()(t.data),color:t.color},b.duration(0).valueFormatter(function(t,e){return(W?{main:p,focus:v}:{main:m,focus:g}).main.tickFormat()(t,e)}).data(t).hidden(!1)}),c.dispatch.on("elementMouseout.tooltip",function(t){b.hidden(!0)}),c.dispatch.on("elementMousemove.tooltip",function(t){b()}),G.dispatch=H,G.legend=_,G.lines=l,G.lines2=u,G.bars=c,G.bars2=d,G.xAxis=h,G.x2Axis=f,G.y1Axis=m,G.y2Axis=p,G.y3Axis=g,G.y4Axis=v,G.tooltip=b,G.options=i.utils.optionsFunc.bind(G),G._options=Object.create({},{width:{get:function(){return k},set:function(t){k=t}},height:{get:function(){return L},set:function(t){L=t}},showLegend:{get:function(){return D},set:function(t){D=t}},brushExtent:{get:function(){return j},set:function(t){j=t}},noData:{get:function(){return N},set:function(t){N=t}},focusEnable:{get:function(){return C},set:function(t){C=t}},focusHeight:{get:function(){return O},set:function(t){O=t}},focusShowAxisX:{get:function(){return A},set:function(t){A=t}},focusShowAxisY:{get:function(){return E},set:function(t){E=t}},legendLeftAxisHint:{get:function(){return I},set:function(t){I=t}},legendRightAxisHint:{get:function(){return R},set:function(t){R=t}},margin:{get:function(){return M},set:function(t){void 0!==t.top&&(M.top=t.top,x=t.top),M.right=void 0!==t.right?t.right:M.right,M.bottom=void 0!==t.bottom?t.bottom:M.bottom,M.left=void 0!==t.left?t.left:M.left}},focusMargin:{get:function(){return w},set:function(t){w.top=void 0!==t.top?t.top:w.top,w.right=void 0!==t.right?t.right:w.right,w.bottom=void 0!==t.bottom?t.bottom:w.bottom,w.left=void 0!==t.left?t.left:w.left}},duration:{get:function(){return V},set:function(t){V=t}},color:{get:function(){return Y},set:function(t){Y=i.utils.getColor(t),_.color(Y)}},x:{get:function(){return S},set:function(t){S=t,l.x(t),u.x(t),c.x(t),d.x(t)}},y:{get:function(){return T},set:function(t){T=t,l.y(t),u.y(t),c.y(t),d.y(t)}},switchYAxisOrder:{get:function(){return W},set:function(t){if(W!==t){var e=m;m=p,p=e;var n=g;g=v,v=n}W=t,m.orient("left"),p.orient("right"),g.orient("left"),v.orient("right")}}}),i.utils.inheritOptions(G,l),i.utils.initOptions(G),G},i.models.multiBar=function(){"use strict";var t,e,n,r,a,o,s,l={top:0,right:0,bottom:0,left:0},u=960,c=500,d=d3.scale.ordinal(),h=d3.scale.linear(),f=Math.floor(1e4*Math.random()),m=null,p=function(t){return t.x},g=function(t){return t.y},v=[0],_=!0,y=!1,b="zero",M=i.utils.defaultColor(),x=!1,w=null,k=500,L=.1,S=.75,T=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),Y=i.utils.renderWatch(T,k),D=0;function C(E){return Y.reset(),E.each(function(C){var E=u-l.left-l.right,A=c-l.top-l.bottom;m=d3.select(this),i.utils.initSVG(m);var O=0;if(x&&C.length&&(x=[{values:C[0].values.map(function(t){return{x:t.x,y:0,series:t.series,size:.01}})}]),y){var j=d3.layout.stack().offset(b).values(function(t){return t.values}).y(g)(!C.length&&x?x:C);j.forEach(function(t,e){t.nonStackable?(C[e].nonStackableSeries=O++,j[e]=C[e]):e>0&&j[e-1].nonStackable&&j[e].values.map(function(t,n){t.y0-=j[e-1].values[n].y,t.y1=t.y0+t.y})}),C=j}C.forEach(function(t,e){t.values.forEach(function(n){n.series=e,n.key=t.key})}),y&&C.length>0&&C[0].values.map(function(t,e){var n=0,i=0;C.map(function(t,r){if(!C[r].nonStackable){var a=t.values[e];a.size=Math.abs(a.y),a.y<0?(a.y1=i,i-=a.size):(a.y1=a.size+n,n+=a.size)}})});var N=e&&n?[]:C.map(function(t,e){return t.values.map(function(t,n){return{x:p(t,n),y:g(t,n),y0:t.y0,y1:t.y1,idx:e}})});d.domain(e||d3.merge(N).map(function(t){return t.x})).rangeBands(r||[0,E],L),h.domain(n||d3.extent(d3.merge(N).map(function(t){var e=t.y;return y&&!C[t.idx].nonStackable&&(e=t.y>0?t.y1:t.y1+t.y),e}).concat(v))).range(a||[A,0]),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]-.01*d.domain()[0],d.domain()[1]+.01*d.domain()[1]]):d.domain([-1,1])),h.domain()[0]===h.domain()[1]&&(h.domain()[0]?h.domain([h.domain()[0]+.01*h.domain()[0],h.domain()[1]-.01*h.domain()[1]]):h.domain([-1,1])),o=o||d,s=s||h;var H=m.selectAll("g.nv-wrap.nv-multibar").data([C]),V=H.enter().append("g").attr("class","nvd3 nv-wrap nv-multibar"),P=V.append("defs"),F=V.append("g"),I=H.select("g");F.append("g").attr("class","nv-groups"),H.attr("transform","translate("+l.left+","+l.top+")"),P.append("clipPath").attr("id","nv-edge-clip-"+f).append("rect"),H.select("#nv-edge-clip-"+f+" rect").attr("width",E).attr("height",A),I.attr("clip-path",_?"url(#nv-edge-clip-"+f+")":"");var R=H.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t,e){return e});R.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6);var W=Y.transition(R.exit().selectAll("rect.nv-bar"),"multibarExit",Math.min(100,k)).attr("y",function(t,e,n){var i=s(0)||0;return y&&C[t.series]&&!C[t.series].nonStackable&&(i=s(t.y0)),i}).attr("height",0).remove();W.delay&&W.delay(function(t,e){return e*(k/(D+1))-e}),R.attr("class",function(t,e){return"nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}).style("fill",function(t,e){return M(t,e)}).style("stroke",function(t,e){return M(t,e)}),R.style("stroke-opacity",1).style("fill-opacity",S);var z=R.selectAll("rect.nv-bar").data(function(t){return x&&!C.length?x.values:t.values});z.exit().remove();z.enter().append("rect").attr("class",function(t,e){return g(t,e)<0?"nv-bar negative":"nv-bar positive"}).attr("x",function(t,e,n){return y&&!C[n].nonStackable?0:n*d.rangeBand()/C.length}).attr("y",function(t,e,n){return s(y&&!C[n].nonStackable?t.y0:0)||0}).attr("height",0).attr("width",function(t,e,n){return d.rangeBand()/(y&&!C[n].nonStackable?1:C.length)}).attr("transform",function(t,e){return"translate("+d(p(t,e))+",0)"});z.style("fill",function(t,e,n){return M(t,n,e)}).style("stroke",function(t,e,n){return M(t,n,e)}).on("mouseover",function(t,e,n){d3.select(this).classed("hover",!0),T.elementMouseover({data:t,index:e,series:C[n],color:d3.select(this).style("fill")})}).on("mouseout",function(t,e,n){d3.select(this).classed("hover",!1),T.elementMouseout({data:t,index:e,series:C[n],color:d3.select(this).style("fill")})}).on("mousemove",function(t,e,n){T.elementMousemove({data:t,index:e,series:C[n],color:d3.select(this).style("fill")})}).on("click",function(t,e,n){T.elementClick({data:t,index:e,series:C[n],color:d3.select(this).style("fill"),event:d3.event,element:this}),d3.event.stopPropagation()}).on("dblclick",function(t,e,n){T.elementDblClick({data:t,index:e,series:C[n],color:d3.select(this).style("fill")}),d3.event.stopPropagation()}),z.attr("class",function(t,e){return g(t,e)<0?"nv-bar negative":"nv-bar positive"}).attr("transform",function(t,e){return"translate("+d(p(t,e))+",0)"}),w&&(t||(t=C.map(function(){return!0})),z.style("fill",function(e,n,i){return d3.rgb(w(e,n)).darker(t.map(function(t,e){return e}).filter(function(e,n){return!t[n]})[i]).toString()}).style("stroke",function(e,n,i){return d3.rgb(w(e,n)).darker(t.map(function(t,e){return e}).filter(function(e,n){return!t[n]})[i]).toString()}));var B=z.watchTransition(Y,"multibar",Math.min(250,k)).delay(function(t,e){return e*k/C[0].values.length});y?B.attr("y",function(t,e,n){return C[n].nonStackable?g(t,e)<0?h(0):h(0)-h(g(t,e))<-1?h(0)-1:h(g(t,e))||0:h(t.y1)}).attr("height",function(t,e,n){return C[n].nonStackable?Math.max(Math.abs(h(g(t,e))-h(0)),0)||0:Math.max(Math.abs(h(t.y+t.y0)-h(t.y0)),0)}).attr("x",function(t,e,n){var i=0;return C[n].nonStackable&&(i=t.series*d.rangeBand()/C.length,C.length!==O&&(i=C[n].nonStackableSeries*d.rangeBand()/(2*O))),i}).attr("width",function(t,e,n){if(C[n].nonStackable){var i=d.rangeBand()/O;return C.length!==O&&(i=d.rangeBand()/(2*O)),i}return d.rangeBand()}):B.attr("x",function(t,e){return t.series*d.rangeBand()/C.length}).attr("width",d.rangeBand()/C.length).attr("y",function(t,e){return g(t,e)<0?h(0):h(0)-h(g(t,e))<1?h(0)-1:h(g(t,e))||0}).attr("height",function(t,e){return Math.max(Math.abs(h(g(t,e))-h(0)),1)||0}),o=d.copy(),s=h.copy(),C[0]&&C[0].values&&(D=C[0].values.length)}),Y.renderEnd("multibar immediate"),C}return C.dispatch=T,C.options=i.utils.optionsFunc.bind(C),C._options=Object.create({},{width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},x:{get:function(){return p},set:function(t){p=t}},y:{get:function(){return g},set:function(t){g=t}},xScale:{get:function(){return d},set:function(t){d=t}},yScale:{get:function(){return h},set:function(t){h=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return r},set:function(t){r=t}},yRange:{get:function(){return a},set:function(t){a=t}},forceY:{get:function(){return v},set:function(t){v=t}},stacked:{get:function(){return y},set:function(t){y=t}},stackOffset:{get:function(){return b},set:function(t){b=t}},clipEdge:{get:function(){return _},set:function(t){_=t}},disabled:{get:function(){return t},set:function(e){t=e}},id:{get:function(){return f},set:function(t){f=t}},hideable:{get:function(){return x},set:function(t){x=t}},groupSpacing:{get:function(){return L},set:function(t){L=t}},fillOpacity:{get:function(){return S},set:function(t){S=t}},margin:{get:function(){return l},set:function(t){l.top=void 0!==t.top?t.top:l.top,l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},duration:{get:function(){return k},set:function(t){k=t,Y.reset(k)}},color:{get:function(){return M},set:function(t){M=i.utils.getColor(t)}},barColor:{get:function(){return w},set:function(t){w=t?i.utils.getColor(t):null}}}),i.utils.initOptions(C),C},i.models.multiBarChart=function(){"use strict";var t,e,n=i.models.multiBar(),r=i.models.axis(),a=i.models.axis(),o=i.interactiveGuideline(),s=i.models.legend(),l=i.models.legend(),u=i.models.tooltip(),c={top:30,right:20,bottom:50,left:60},d=null,h=null,f=null,m=i.utils.defaultColor(),p=!0,g={},v=!0,_=null,y=!0,b=!0,M=!1,x=!0,w=!1,k=!1,L=0,S=i.utils.state(),T=null,Y=null,D=d3.dispatch("stateChange","changeState","renderEnd"),C=function(){return p?180:0},E=250,A=!1;S.stacked=!1,n.stacked(!1),r.orient("bottom").tickPadding(7).showMaxMin(!1).tickFormat(function(t){return t}),a.orient(M?"right":"left").tickFormat(d3.format(",.1f")),u.duration(0).valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),o.tooltip.valueFormatter(function(t,e){return null==t?"N/A":a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),o.tooltip.valueFormatter(function(t,e){return null==t?"N/A":a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),o.tooltip.duration(0).valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),l.updateState(!1);var O=i.utils.renderWatch(D),j=!1,N=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),stacked:j}}},H=function(t){return function(e){void 0!==e.stacked&&(j=e.stacked),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function V(Y){return O.reset(),O.models(n),y&&O.models(r),b&&O.models(a),Y.each(function(Y){var O=d3.select(this);i.utils.initSVG(O);var P,F=i.utils.availableWidth(h,O,c),I=i.utils.availableHeight(f,O,c);if(V.update=function(){0===E?O.call(V):O.transition().duration(E).call(V)},V.container=this,S.setter(H(Y),V.update).getter(N(Y)).update(),S.disabled=Y.map(function(t){return!!t.disabled}),!T)for(P in T={},S)S[P]instanceof Array?T[P]=S[P].slice(0):T[P]=S[P];if(!(Y&&Y.length&&Y.filter(function(t){return t.values.length}).length))return i.utils.noData(V,O),V;O.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale();var R=O.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([Y]),W=R.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),z=R.select("g");if(W.append("g").attr("class","nv-x nv-axis"),W.append("g").attr("class","nv-y nv-axis"),W.append("g").attr("class","nv-barsWrap"),W.append("g").attr("class","nv-legendWrap"),W.append("g").attr("class","nv-controlsWrap"),W.append("g").attr("class","nv-interactive"),v?"bottom"===_?(s.width(F-c.right),z.select(".nv-legendWrap").datum(Y).call(s),c.bottom=r.height()+s.height(),I=i.utils.availableHeight(f,O,c),z.select(".nv-legendWrap").attr("transform","translate(0,"+(I+r.height())+")")):(s.width(F-C()),z.select(".nv-legendWrap").datum(Y).call(s),d||s.height()===c.top||(c.top=s.height(),I=i.utils.availableHeight(f,O,c)),z.select(".nv-legendWrap").attr("transform","translate("+C()+","+-c.top+")")):z.select(".nv-legendWrap").selectAll("*").remove(),p){var B=[{key:g.grouped||"Grouped",disabled:n.stacked()},{key:g.stacked||"Stacked",disabled:!n.stacked()}];l.width(C()).color(["#444","#444","#444"]),z.select(".nv-controlsWrap").datum(B).attr("transform","translate(0,"+-c.top+")").call(l)}else z.select(".nv-controlsWrap").selectAll("*").remove();if(R.attr("transform","translate("+c.left+","+c.top+")"),M&&z.select(".nv-y.nv-axis").attr("transform","translate("+F+",0)"),n.disabled(Y.map(function(t){return t.disabled})).width(F).height(I).color(Y.map(function(t,e){return t.color||m(t,e)}).filter(function(t,e){return!Y[e].disabled})),z.select(".nv-barsWrap").datum(Y.filter(function(t){return!t.disabled})).call(n),y){r.scale(t)._ticks(i.utils.calcTicksX(F/100,Y)).tickSize(-I,0),z.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),z.select(".nv-x.nv-axis").call(r);var U=z.select(".nv-x.nv-axis > g").selectAll("g");if(U.selectAll("line, text").style("opacity",1),w){var G=function(t,e){return"translate("+t+","+e+")"};U.selectAll("text").attr("transform",function(t,e,n){return G(0,n%2==0?5:17)});var $=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;z.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(t,e){return G(0,0===e||$%2!=0?17:5)})}k&&z.selectAll(".tick text").call(i.utils.wrapTicks,V.xAxis.rangeBand()),x&&U.filter(function(t,e){return e%Math.ceil(Y[0].values.length/(F/100))!=0}).selectAll("text, line").style("opacity",0),L&&U.selectAll(".tick text").attr("transform","rotate("+L+" 0,0)").style("text-anchor",L>0?"start":"end"),z.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}b&&(a.scale(e)._ticks(i.utils.calcTicksY(I/36,Y)).tickSize(-F,0),z.select(".nv-y.nv-axis").call(a)),A&&(o.width(F).height(I).margin({left:c.left,top:c.top}).svgContainer(O).xScale(t),R.select(".nv-interactive").call(o)),s.dispatch.on("stateChange",function(t){for(var e in t)S[e]=t[e];D.stateChange(S),V.update()}),l.dispatch.on("legendClick",function(t,e){if(t.disabled){switch(B=B.map(function(t){return t.disabled=!0,t}),t.disabled=!1,t.key){case"Grouped":case g.grouped:n.stacked(!1);break;case"Stacked":case g.stacked:n.stacked(!0)}S.stacked=n.stacked(),D.stateChange(S),V.update()}}),D.on("changeState",function(t){void 0!==t.disabled&&(Y.forEach(function(e,n){e.disabled=t.disabled[n]}),S.disabled=t.disabled),void 0!==t.stacked&&(n.stacked(t.stacked),S.stacked=t.stacked,j=t.stacked),V.update()}),A?(o.dispatch.on("elementMousemove",function(e){if(void 0!=e.pointXValue){var n,i,r,a,s=[];Y.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(o,l){i=t.domain().indexOf(e.pointXValue);var u=o.values[i];void 0!==u&&(a=u.x,void 0===n&&(n=u),void 0===r&&(r=e.mouseX),s.push({key:o.key,value:V.y()(u,i),color:m(o,o.seriesIndex),data:o.values[i]}))}),o.tooltip.data({value:a,index:i,series:s})(),o.renderGuideLine(r)}}),o.dispatch.on("elementMouseout",function(t){o.tooltip.hidden(!0)})):(n.dispatch.on("elementMouseover.tooltip",function(t){t.value=V.x()(t.data),t.series={key:t.data.key,value:V.y()(t.data),color:t.color},u.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){u.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){u()}))}),O.renderEnd("multibarchart immediate"),V}return V.dispatch=D,V.multibar=n,V.legend=s,V.controls=l,V.xAxis=r,V.yAxis=a,V.state=S,V.tooltip=u,V.interactiveLayer=o,V.options=i.utils.optionsFunc.bind(V),V._options=Object.create({},{width:{get:function(){return h},set:function(t){h=t}},height:{get:function(){return f},set:function(t){f=t}},showLegend:{get:function(){return v},set:function(t){v=t}},legendPosition:{get:function(){return _},set:function(t){_=t}},showControls:{get:function(){return p},set:function(t){p=t}},controlLabels:{get:function(){return g},set:function(t){g=t}},showXAxis:{get:function(){return y},set:function(t){y=t}},showYAxis:{get:function(){return b},set:function(t){b=t}},defaultState:{get:function(){return T},set:function(t){T=t}},noData:{get:function(){return Y},set:function(t){Y=t}},reduceXTicks:{get:function(){return x},set:function(t){x=t}},rotateLabels:{get:function(){return L},set:function(t){L=t}},staggerLabels:{get:function(){return w},set:function(t){w=t}},wrapLabels:{get:function(){return k},set:function(t){k=!!t}},margin:{get:function(){return c},set:function(t){void 0!==t.top&&(c.top=t.top,d=t.top),c.right=void 0!==t.right?t.right:c.right,c.bottom=void 0!==t.bottom?t.bottom:c.bottom,c.left=void 0!==t.left?t.left:c.left}},duration:{get:function(){return E},set:function(t){E=t,n.duration(E),r.duration(E),a.duration(E),O.reset(E)}},color:{get:function(){return m},set:function(t){m=i.utils.getColor(t),s.color(m)}},rightAlignYAxis:{get:function(){return M},set:function(t){M=t,a.orient(M?"right":"left")}},useInteractiveGuideline:{get:function(){return A},set:function(t){A=t}},barColor:{get:function(){return n.barColor},set:function(t){n.barColor(t),s.color(function(t,e){return d3.rgb("#ccc").darker(1.5*e).toString()})}}}),i.utils.inheritOptions(V,n),i.utils.initOptions(V),V},i.models.multiBarHorizontal=function(){"use strict";var t,e,n,r,a,o,s,l={top:0,right:0,bottom:0,left:0},u=960,c=500,d=Math.floor(1e4*Math.random()),h=null,f=d3.scale.ordinal(),m=d3.scale.linear(),p=function(t){return t.x},g=function(t){return t.y},v=function(t){return t.yErr},_=[0],y=i.utils.defaultColor(),b=null,M=!1,x=!1,w=!1,k=60,L=.1,S=.75,T=d3.format(",.2f"),Y=250,D=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),C=i.utils.renderWatch(D,Y);function E(d){return C.reset(),d.each(function(d){var Y=u-l.left-l.right,E=c-l.top-l.bottom;h=d3.select(this),i.utils.initSVG(h),M&&(d=d3.layout.stack().offset("zero").values(function(t){return t.values}).y(g)(d)),d.forEach(function(t,e){t.values.forEach(function(n){n.series=e,n.key=t.key})}),M&&d[0].values.map(function(t,e){var n=0,i=0;d.map(function(t){var r=t.values[e];r.size=Math.abs(r.y),r.y<0?(r.y1=i-r.size,i-=r.size):(r.y1=n,n+=r.size)})});var A=e&&n?[]:d.map(function(t){return t.values.map(function(t,e){return{x:p(t,e),y:g(t,e),y0:t.y0,y1:t.y1}})});f.domain(e||d3.merge(A).map(function(t){return t.x})).rangeBands(r||[0,E],L),m.domain(n||d3.extent(d3.merge(A).map(function(t){return M?t.y>0?t.y1+t.y:t.y1:t.y}).concat(_))),x&&!M?m.range(a||[m.domain()[0]<0?k:0,Y-(m.domain()[1]>0?k:0)]):m.range(a||[0,Y]),o=o||f,s=s||d3.scale.linear().domain(m.domain()).range([m(0),m(0)]);var O=d3.select(this).selectAll("g.nv-wrap.nv-multibarHorizontal").data([d]),j=O.enter().append("g").attr("class","nvd3 nv-wrap nv-multibarHorizontal"),N=(j.append("defs"),j.append("g"));O.select("g");N.append("g").attr("class","nv-groups"),O.attr("transform","translate("+l.left+","+l.top+")");var H=O.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t,e){return e});H.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),H.exit().watchTransition(C,"multibarhorizontal: exit groups").style("stroke-opacity",1e-6).style("fill-opacity",1e-6).remove(),H.attr("class",function(t,e){return"nv-group nv-series-"+e}).classed("hover",function(t){return t.hover}).style("fill",function(t,e){return y(t,e)}).style("stroke",function(t,e){return y(t,e)}),H.watchTransition(C,"multibarhorizontal: groups").style("stroke-opacity",1).style("fill-opacity",S);var V=H.selectAll("g.nv-bar").data(function(t){return t.values});V.exit().remove();var P=V.enter().append("g").attr("transform",function(t,e,n){return"translate("+s(M?t.y0:0)+","+(M?0:n*f.rangeBand()/d.length+f(p(t,e)))+")"});P.append("rect").attr("width",0).attr("height",f.rangeBand()/(M?1:d.length)),V.on("mouseover",function(t,e){d3.select(this).classed("hover",!0),D.elementMouseover({data:t,index:e,color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),D.elementMouseout({data:t,index:e,color:d3.select(this).style("fill")})}).on("mouseout",function(t,e){D.elementMouseout({data:t,index:e,color:d3.select(this).style("fill")})}).on("mousemove",function(t,e){D.elementMousemove({data:t,index:e,color:d3.select(this).style("fill")})}).on("click",function(t,e){D.elementClick({data:t,index:e,color:d3.select(this).style("fill"),event:d3.event,element:this}),d3.event.stopPropagation()}).on("dblclick",function(t,e){D.elementDblClick({data:t,index:e,color:d3.select(this).style("fill")}),d3.event.stopPropagation()}),v(d[0],0)&&(P.append("polyline"),V.select("polyline").attr("fill","none").attr("points",function(t,e){var n=v(t,e),i=.8*f.rangeBand()/(2*(M?1:d.length));return[[(n=(n=n.length?n:[-Math.abs(n),Math.abs(n)]).map(function(n){return m(n+(g(t,e)<0?0:g(t,e)))-m(0)}))[0],-i],[n[0],i],[n[0],0],[n[1],0],[n[1],-i],[n[1],i]].map(function(t){return t.join(",")}).join(" ")}).attr("transform",function(t,e){return"translate(0, "+f.rangeBand()/(2*(M?1:d.length))+")"})),P.append("text"),x&&!M?(V.select("text").attr("text-anchor",function(t,e){return g(t,e)<0?"end":"start"}).attr("y",f.rangeBand()/(2*d.length)).attr("dy",".32em").text(function(t,e){var n=T(g(t,e)),i=v(t,e);return void 0===i?n:i.length?n+"+"+T(Math.abs(i[1]))+"-"+T(Math.abs(i[0])):n+"±"+T(Math.abs(i))}),V.watchTransition(C,"multibarhorizontal: bars").select("text").attr("x",function(t,e){return g(t,e)<0?-4:m(g(t,e))-m(0)+4})):V.selectAll("text").text(""),w&&!M?(P.append("text").classed("nv-bar-label",!0),V.select("text.nv-bar-label").attr("text-anchor",function(t,e){return g(t,e)<0?"start":"end"}).attr("y",f.rangeBand()/(2*d.length)).attr("dy",".32em").text(function(t,e){return p(t,e)}),V.watchTransition(C,"multibarhorizontal: bars").select("text.nv-bar-label").attr("x",function(t,e){return g(t,e)<0?m(0)-m(g(t,e))+4:-4})):V.selectAll("text.nv-bar-label").text(""),V.attr("class",function(t,e){return g(t,e)<0?"nv-bar negative":"nv-bar positive"}),b&&(t||(t=d.map(function(){return!0})),V.style("fill",function(e,n,i){return d3.rgb(b(e,n)).darker(t.map(function(t,e){return e}).filter(function(e,n){return!t[n]})[i]).toString()}).style("stroke",function(e,n,i){return d3.rgb(b(e,n)).darker(t.map(function(t,e){return e}).filter(function(e,n){return!t[n]})[i]).toString()})),M?V.watchTransition(C,"multibarhorizontal: bars").attr("transform",function(t,e){return"translate("+m(t.y1)+","+f(p(t,e))+")"}).select("rect").attr("width",function(t,e){return Math.abs(m(g(t,e)+t.y0)-m(t.y0))||0}).attr("height",f.rangeBand()):V.watchTransition(C,"multibarhorizontal: bars").attr("transform",function(t,e){return"translate("+(g(t,e)<0?m(g(t,e)):m(0))+","+(t.series*f.rangeBand()/d.length+f(p(t,e)))+")"}).select("rect").attr("height",f.rangeBand()/d.length).attr("width",function(t,e){return Math.max(Math.abs(m(g(t,e))-m(0)),1)||0}),o=f.copy(),s=m.copy()}),C.renderEnd("multibarHorizontal immediate"),E}return E.dispatch=D,E.options=i.utils.optionsFunc.bind(E),E._options=Object.create({},{width:{get:function(){return u},set:function(t){u=t}},height:{get:function(){return c},set:function(t){c=t}},x:{get:function(){return p},set:function(t){p=t}},y:{get:function(){return g},set:function(t){g=t}},yErr:{get:function(){return v},set:function(t){v=t}},xScale:{get:function(){return f},set:function(t){f=t}},yScale:{get:function(){return m},set:function(t){m=t}},xDomain:{get:function(){return e},set:function(t){e=t}},yDomain:{get:function(){return n},set:function(t){n=t}},xRange:{get:function(){return r},set:function(t){r=t}},yRange:{get:function(){return a},set:function(t){a=t}},forceY:{get:function(){return _},set:function(t){_=t}},stacked:{get:function(){return M},set:function(t){M=t}},showValues:{get:function(){return x},set:function(t){x=t}},disabled:{get:function(){return t},set:function(e){t=e}},id:{get:function(){return d},set:function(t){d=t}},valueFormat:{get:function(){return T},set:function(t){T=t}},valuePadding:{get:function(){return k},set:function(t){k=t}},groupSpacing:{get:function(){return L},set:function(t){L=t}},fillOpacity:{get:function(){return S},set:function(t){S=t}},margin:{get:function(){return l},set:function(t){l.top=void 0!==t.top?t.top:l.top,l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},duration:{get:function(){return Y},set:function(t){Y=t,C.reset(Y)}},color:{get:function(){return y},set:function(t){y=i.utils.getColor(t)}},barColor:{get:function(){return b},set:function(t){b=t?i.utils.getColor(t):null}}}),i.utils.initOptions(E),E},i.models.multiBarHorizontalChart=function(){"use strict";var t,e,n=i.models.multiBarHorizontal(),r=i.models.axis(),a=i.models.axis(),o=i.models.legend().height(30),s=i.models.legend().height(30),l=i.models.tooltip(),u={top:30,right:20,bottom:50,left:60},c=null,d=null,h=null,f=i.utils.defaultColor(),m=!0,p="top",g={},v=!0,_="top",y=!0,b=!0,M=!1,x=i.utils.state(),w=null,k=null,L=d3.dispatch("stateChange","changeState","renderEnd"),S=function(){return m?180:0},T=250;x.stacked=!1,n.stacked(M),r.orient("left").tickPadding(5).showMaxMin(!1).tickFormat(function(t){return t}),a.orient("bottom").tickFormat(d3.format(",.1f")),l.duration(0).valueFormatter(function(t,e){return a.tickFormat()(t,e)}).headerFormatter(function(t,e){return r.tickFormat()(t,e)}),s.updateState(!1);var Y=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),stacked:M}}},D=function(t){return function(e){void 0!==e.stacked&&(M=e.stacked),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}},C=i.utils.renderWatch(L,T);function E(l){return C.reset(),C.models(n),y&&C.models(r),b&&C.models(a),l.each(function(l){var k=d3.select(this);i.utils.initSVG(k);var C,A=i.utils.availableWidth(d,k,u),O=i.utils.availableHeight(h,k,u);if(E.update=function(){k.transition().duration(T).call(E)},E.container=this,M=n.stacked(),x.setter(D(l),E.update).getter(Y(l)).update(),x.disabled=l.map(function(t){return!!t.disabled}),!w)for(C in w={},x)x[C]instanceof Array?w[C]=x[C].slice(0):w[C]=x[C];if(!(l&&l.length&&l.filter(function(t){return t.values.length}).length))return i.utils.noData(E,k),E;k.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale().clamp(!0);var j=k.selectAll("g.nv-wrap.nv-multiBarHorizontalChart").data([l]),N=j.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarHorizontalChart").append("g"),H=j.select("g");if(N.append("g").attr("class","nv-x nv-axis"),N.append("g").attr("class","nv-y nv-axis").append("g").attr("class","nv-zeroLine").append("line"),N.append("g").attr("class","nv-barsWrap"),N.append("g").attr("class","nv-legendWrap"),N.append("g").attr("class","nv-controlsWrap"),v?(o.width(A-S()),H.select(".nv-legendWrap").datum(l).call(o),"bottom"===_?(u.bottom=r.height()+o.height(),O=i.utils.availableHeight(h,k,u),H.select(".nv-legendWrap").attr("transform","translate("+S()+","+(O+r.height())+")")):"top"===_&&(c||o.height()===u.top||(u.top=o.height(),O=i.utils.availableHeight(h,k,u)),H.select(".nv-legendWrap").attr("transform","translate("+S()+","+-u.top+")"))):H.select(".nv-legendWrap").selectAll("*").remove(),m){var V=[{key:g.grouped||"Grouped",disabled:n.stacked()},{key:g.stacked||"Stacked",disabled:!n.stacked()}];s.width(S()).color(["#444","#444","#444"]),"bottom"===p?(u.bottom=r.height()+o.height(),O=i.utils.availableHeight(h,k,u),H.select(".nv-controlsWrap").datum(V).attr("transform","translate(0,"+(O+r.height())+")").call(s)):"top"===p&&H.select(".nv-controlsWrap").datum(V).attr("transform","translate(0,"+-u.top+")").call(s)}else H.select(".nv-controlsWrap").selectAll("*").remove();(j.attr("transform","translate("+u.left+","+u.top+")"),n.disabled(l.map(function(t){return t.disabled})).width(A).height(O).color(l.map(function(t,e){return t.color||f(t,e)}).filter(function(t,e){return!l[e].disabled})),H.select(".nv-barsWrap").datum(l.filter(function(t){return!t.disabled})).transition().call(n),y)&&(r.scale(t)._ticks(i.utils.calcTicksY(O/24,l)).tickSize(-A,0),H.select(".nv-x.nv-axis").call(r),H.select(".nv-x.nv-axis").selectAll("g").selectAll("line, text"));b&&(a.scale(e)._ticks(i.utils.calcTicksX(A/100,l)).tickSize(-O,0),H.select(".nv-y.nv-axis").attr("transform","translate(0,"+O+")"),H.select(".nv-y.nv-axis").call(a)),H.select(".nv-zeroLine line").attr("x1",e(0)).attr("x2",e(0)).attr("y1",0).attr("y2",-O),o.dispatch.on("stateChange",function(t){for(var e in t)x[e]=t[e];L.stateChange(x),E.update()}),s.dispatch.on("legendClick",function(t,e){if(t.disabled){switch(V=V.map(function(t){return t.disabled=!0,t}),t.disabled=!1,t.key){case"Grouped":case g.grouped:n.stacked(!1);break;case"Stacked":case g.stacked:n.stacked(!0)}x.stacked=n.stacked(),L.stateChange(x),M=n.stacked(),E.update()}}),L.on("changeState",function(t){void 0!==t.disabled&&(l.forEach(function(e,n){e.disabled=t.disabled[n]}),x.disabled=t.disabled),void 0!==t.stacked&&(n.stacked(t.stacked),x.stacked=t.stacked,M=t.stacked),E.update()})}),C.renderEnd("multibar horizontal chart immediate"),E}return n.dispatch.on("elementMouseover.tooltip",function(t){t.value=E.x()(t.data),t.series={key:t.data.key,value:E.y()(t.data),color:t.color},l.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){l.hidden(!0)}),n.dispatch.on("elementMousemove.tooltip",function(t){l()}),E.dispatch=L,E.multibar=n,E.legend=o,E.controls=s,E.xAxis=r,E.yAxis=a,E.state=x,E.tooltip=l,E.options=i.utils.optionsFunc.bind(E),E._options=Object.create({},{width:{get:function(){return d},set:function(t){d=t}},height:{get:function(){return h},set:function(t){h=t}},showLegend:{get:function(){return v},set:function(t){v=t}},legendPosition:{get:function(){return _},set:function(t){_=t}},controlsPosition:{get:function(){return p},set:function(t){p=t}},showControls:{get:function(){return m},set:function(t){m=t}},controlLabels:{get:function(){return g},set:function(t){g=t}},showXAxis:{get:function(){return y},set:function(t){y=t}},showYAxis:{get:function(){return b},set:function(t){b=t}},defaultState:{get:function(){return w},set:function(t){w=t}},noData:{get:function(){return k},set:function(t){k=t}},margin:{get:function(){return u},set:function(t){void 0!==t.top&&(u.top=t.top,c=t.top),u.right=void 0!==t.right?t.right:u.right,u.bottom=void 0!==t.bottom?t.bottom:u.bottom,u.left=void 0!==t.left?t.left:u.left}},duration:{get:function(){return T},set:function(t){T=t,C.reset(T),n.duration(T),r.duration(T),a.duration(T)}},color:{get:function(){return f},set:function(t){f=i.utils.getColor(t),o.color(f)}},barColor:{get:function(){return n.barColor},set:function(t){n.barColor(t),o.color(function(t,e){return d3.rgb("#ccc").darker(1.5*e).toString()})}}}),i.utils.inheritOptions(E,n),i.utils.initOptions(E),E},i.models.multiBarWithFocusChart=function(){"use strict";var t,e,n,r,a=i.models.multiBar(),o=i.models.multiBar(),s=i.models.axis(),l=i.models.axis(),u=i.interactiveGuideline(),c=i.models.axis(),d=i.models.axis(),h=i.models.legend(),f=i.models.legend(),m=d3.svg.brush(),p=i.models.tooltip(),g={top:30,right:20,bottom:250,left:60},v={top:0,right:30,bottom:20,left:60},_=null,y=null,b=50,M=i.utils.defaultColor(),x=!0,w={},k=!0,L=!1,S=!1,T=!1,Y=40,D=!0,C=!0,E=!1,A=!0,O=!1,j=0,N=!0,H=i.utils.state(),V=null,P=null,F="No Data Available.",I=d3.dispatch("tooltipShow","tooltipHide","brush","stateChange","changeState","renderEnd"),R=function(){return x?180:0},W=250,z=!1;H.stacked=!1,a.stacked(!1),o.stacked(!1),s.orient("bottom").tickPadding(7).showMaxMin(!1).tickFormat(function(t){return t}),l.orient(E?"right":"left").tickFormat(d3.format(",.1f")),c.orient("bottom").tickPadding(5),d.orient("left"),p.duration(0).valueFormatter(function(t,e){return l.tickFormat()(t,e)}).headerFormatter(function(t,e){return s.tickFormat()(t,e)}),u.tooltip.valueFormatter(function(t,e){return null==t?"N/A":l.tickFormat()(t,e)}).headerFormatter(function(t,e){return s.tickFormat()(t,e)}),u.tooltip.valueFormatter(function(t,e){return null==t?"N/A":l.tickFormat()(t,e)}).headerFormatter(function(t,e){return s.tickFormat()(t,e)}),u.tooltip.duration(0).valueFormatter(function(t,e){return l.tickFormat()(t,e)}).headerFormatter(function(t,e){return s.tickFormat()(t,e)}),f.updateState(!1);var B=i.utils.renderWatch(I),U=!1,G=function(t){return function(){return{active:t.map(function(t){return!t.disabled}),stacked:U}}},$=function(t){return function(e){void 0!==e.stacked&&(U=e.stacked),void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function q(b){return B.reset(),B.models(a),D&&B.models(s),C&&B.models(l),b.each(function(b){var N=d3.select(this);i.utils.initSVG(N);var B,J=(_||parseInt(N.style("width"))||960)-g.left-g.right,X=(y||parseInt(N.style("height"))||400)-g.top-g.bottom-(L?Y:0),Z=Y-v.top-v.bottom;if(q.update=function(){0===W?N.call(q):N.transition().duration(W).call(q)},q.container=this,H.setter($(b),q.update).getter(G(b)).update(),H.disabled=b.map(function(t){return!!t.disabled}),!P)for(B in P={},H)H[B]instanceof Array?P[B]=H[B].slice(0):P[B]=H[B];if(!(b&&b.length&&b.filter(function(t){return t.values.length}).length)){var K=N.selectAll(".nv-noData").data([F]);return K.enter().append("text").attr("class","nvd3 nv-noData").attr("dy","-.7em").style("text-anchor","middle"),K.attr("x",g.left+J/2).attr("y",g.top+X/2).text(function(t){return t}),q}N.selectAll(".nv-noData").remove(),t=a.xScale(),e=a.yScale(),n=c.scale(),r=o.yScale(),t.range([0,J]),n.range([0,J]);var Q=d3.min(b[0].values,function(t){return t.x}),tt=d3.max(b[0].values,function(t){return t.x});isNaN(Q)&&(L=!1),L&&(t.domain([Q,tt]),n.domain(t.domain()));var et=N.selectAll("g.nv-wrap.nv-multiBarWithLegend").data([b]),nt=et.enter().append("g").attr("class","nvd3 nv-wrap nv-multiBarWithLegend").append("g"),it=et.select("g"),rt=nt.append("g").attr("class","nv-focus");rt.append("g").attr("class","nv-x nv-axis"),rt.append("g").attr("class","nv-y nv-axis"),rt.append("g").attr("class","nv-barsWrap"),rt.append("g").attr("class","nv-legendWrap"),rt.append("g").attr("class","nv-controlsWrap");var at=nt.append("g").attr("class","nv-context");if(at.append("g").attr("class","nv-x nv-axis"),at.append("g").attr("class","nv-y nv-axis"),at.append("g").attr("class","nv-barsWrap"),at.append("g").attr("class","nv-brushBackground"),at.append("g").attr("class","nv-x nv-brush"),k&&(h.width(J-R()),a.barColor()&&b.forEach(function(t,e){t.color=d3.rgb("#ccc").darker(1.5*e).toString()}),it.select(".nv-legendWrap").datum(b).call(h),g.top!=h.height()&&(g.top=h.height(),X=(y||parseInt(N.style("height"))||400)-g.top-g.bottom),it.select(".nv-legendWrap").attr("transform","translate("+R()+","+-g.top+")")),it.select(".nv-context").style("display",L?"initial":"none"),x){var ot=[{key:w.grouped||"Grouped",disabled:a.stacked()},{key:w.stacked||"Stacked",disabled:!a.stacked()}];f.width(R()).color(["#444","#444","#444"]),it.select(".nv-controlsWrap").datum(ot).attr("transform","translate(0,"+-g.top+")").call(f)}function st(){if(D){s.scale(t).ticks(i.utils.calcTicksX(J/100,b)).tickSize(-X,0),it.select(".nv-x.nv-axis").attr("transform","translate(0,"+e.range()[0]+")"),it.select(".nv-x.nv-axis").call(s);var a=it.select(".nv-x.nv-axis > g").selectAll("g");if(a.selectAll("line, text").style("opacity",1),O){var o=function(t,e){return"translate("+t+","+e+")"};a.selectAll("text").attr("transform",function(t,e,n){return o(0,n%2==0?5:17)});var u=d3.selectAll(".nv-x.nv-axis .nv-wrap g g text")[0].length;it.selectAll(".nv-x.nv-axis .nv-axisMaxMin text").attr("transform",function(t,e){return o(0,0===e||u%2!=0?17:5)})}A&&a.filter(function(t,e){return e%Math.ceil(b[0].values.length/(J/100))!=0}).selectAll("text, line").style("opacity",0),j&&a.selectAll(".tick text").attr("transform","rotate("+j+" 0,0)").style("text-anchor",j>0?"start":"end"),it.select(".nv-x.nv-axis").selectAll("g.nv-axisMaxMin text").style("opacity",1)}C&&(l.scale(e).ticks(i.utils.calcTicksY(X/36,b)).tickSize(-J,0),it.select(".nv-y.nv-axis").call(l)),T&&(c.scale(n).ticks(i.utils.calcTicksX(J/100,b)).tickSize(-Z,0),it.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+r.range()[0]+")"),it.select(".nv-context .nv-x.nv-axis").transition().call(c)),S&&(d.scale(r).ticks(Z/36).tickSize(-J,0),d3.transition(it.select(".nv-context .nv-y.nv-axis")).call(d),it.select(".nv-context .nv-x.nv-axis").attr("transform","translate(0,"+n.range()[0]+")"),it.select(".nv-context .nv-y1.nv-axis").transition().call(d))}et.attr("transform","translate("+g.left+","+g.top+")"),E&&it.select(".nv-y.nv-axis").attr("transform","translate("+J+",0)"),a.disabled(b.map(function(t){return t.disabled})).width(J).height(X).color(b.map(function(t,e){return t.color||M(t,e)}).filter(function(t,e){return!b[e].disabled})),o.disabled(b.map(function(t){return t.disabled})).width(J).height(Z).color(b.map(function(t,e){return t.color||M(t,e)}).filter(function(t,e){return!b[e].disabled})),it.select(".nv-barsWrap").datum(b.filter(function(t){return!t.disabled})).call(a),it.select(".nv-context").attr("transform","translate(0,"+(X+g.bottom+v.top)+")"),it.select(".nv-context .nv-barsWrap").datum(b.filter(function(t){return!t.disabled})).transition().call(o),st(),m.x(n).on("brush",function(t){var e=q.duration();q.duration(0),dt(),q.duration(e)}),V&&m.extent(V);var lt=it.select(".nv-brushBackground").selectAll("g").data([V||m.extent()]),ut=lt.enter().append("g");ut.append("rect").attr("class","left").attr("x",0).attr("y",0).attr("height",Z),ut.append("rect").attr("class","right").attr("x",0).attr("y",0).attr("height",Z);var ct=it.select(".nv-x.nv-brush").call(m);function dt(){V=m.empty()?null:m.extent();var t=m.empty()?n.domain():m.extent();Math.abs(t[0]-t[1])<=1||(I.brush({extent:t,brush:m}),m.empty()||m.extent(V),lt.data([m.empty()?n.domain():V]).each(function(t,e){var i=n(t[0])-n.range()[0],r=n.range()[1]-n(t[1]);d3.select(this).select(".left").attr("width",i<0?0:i),d3.select(this).select(".right").attr("x",n(t[1])).attr("width",r<0?0:r)}),it.select(".nv-focus .nv-barsWrap").datum(b.filter(function(t){return!t.disabled}).map(function(e,n){return{key:e.key,area:e.area,values:e.values.filter(function(e,n){return a.x()(e,n)>=t[0]&&a.x()(e,n)<=t[1]})}})).transition().duration(W).call(a),st(),it.select(".nv-focus .nv-x.nv-axis").call(s),it.select(".nv-focus .nv-y.nv-axis").transition().duration(W).call(l))}ct.selectAll("rect").attr("height",Z),ct.selectAll(".resize").append("path").attr("d",function(t){var e=+("e"==t),n=e?1:-1,i=Z/3;return"M"+.5*n+","+i+"A6,6 0 0 "+e+" "+6.5*n+","+(i+6)+"V"+(2*i-6)+"A6,6 0 0 "+e+" "+.5*n+","+2*i+"ZM"+2.5*n+","+(i+8)+"V"+(2*i-8)+"M"+4.5*n+","+(i+8)+"V"+(2*i-8)}),dt(),z&&(u.width(J).height(X).margin({left:g.left,top:g.top}).svgContainer(N).xScale(t),et.select(".nv-interactive").call(u)),h.dispatch.on("stateChange",function(t){for(var e in t)H[e]=t[e];I.stateChange(H),q.update()}),f.dispatch.on("legendClick",function(t,e){if(t.disabled){switch(ot=ot.map(function(t){return t.disabled=!0,t}),t.disabled=!1,t.key){case"Grouped":case w.grouped:a.stacked(!1),o.stacked(!1);break;case"Stacked":case w.stacked:a.stacked(!0),o.stacked(!0)}H.stacked=a.stacked(),I.stateChange(H),q.update()}}),I.on("changeState",function(t){void 0!==t.disabled&&(b.forEach(function(e,n){e.disabled=t.disabled[n]}),H.disabled=t.disabled),void 0!==t.stacked&&(a.stacked(t.stacked),o.stacked(t.stacked),H.stacked=t.stacked,U=t.stacked),q.update()}),z?(u.dispatch.on("elementMousemove",function(e){if(void 0!=e.pointXValue){var n,i,r,a,o=[];b.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(s,l){i=t.domain().indexOf(e.pointXValue);var u=s.values[i];void 0!==u&&(a=u.x,void 0===n&&(n=u),void 0===r&&(r=e.mouseX),o.push({key:s.key,value:q.y()(u,i),color:M(s,s.seriesIndex),data:s.values[i]}))}),u.tooltip.data({value:a,index:i,series:o})(),u.renderGuideLine(r)}}),u.dispatch.on("elementMouseout",function(t){u.tooltip.hidden(!0)})):(a.dispatch.on("elementMouseover.tooltip",function(t){t.value=q.x()(t.data),t.series={key:t.data.key,value:q.y()(t.data),color:t.color},p.data(t).hidden(!1)}),a.dispatch.on("elementMouseout.tooltip",function(t){p.hidden(!0)}),a.dispatch.on("elementMousemove.tooltip",function(t){p()}))}),B.renderEnd("multibarwithfocuschart immediate"),q}return q.dispatch=I,q.multibar=a,q.multibar2=o,q.legend=h,q.xAxis=s,q.yAxis=l,q.state=H,q.x2Axis=c,q.y2Axis=d,q.options=i.utils.optionsFunc.bind(q),q.tooltip=p,q.interactiveLayer=u,q._options=Object.create({},{width:{get:function(){return _},set:function(t){_=t}},height:{get:function(){return y},set:function(t){y=t}},focusHeight:{get:function(){return b},set:function(t){b=t}},showLegend:{get:function(){return k},set:function(t){k=t}},brushExtent:{get:function(){return V},set:function(t){V=t}},showControls:{get:function(){return x},set:function(t){x=t}},controlLabels:{get:function(){return w},set:function(t){w=t}},showXAxis:{get:function(){return D},set:function(t){D=t}},showYAxis:{get:function(){return C},set:function(t){C=t}},tooltips:{get:function(){return N},set:function(t){N=t}},tooltipContent:{get:function(){return p},set:function(t){p=t}},defaultState:{get:function(){return P},set:function(t){P=t}},noData:{get:function(){return F},set:function(t){F=t}},reduceXTicks:{get:function(){return A},set:function(t){A=t}},rotateLabels:{get:function(){return j},set:function(t){j=t}},staggerLabels:{get:function(){return O},set:function(t){O=t}},focusEnable:{get:function(){return L},set:function(t){L=t}},focusShowAxisX:{get:function(){return T},set:function(t){T=t}},focusShowAxisY:{get:function(){return S},set:function(t){S=t}},margin:{get:function(){return g},set:function(t){g.top=void 0!==t.top?t.top:g.top,g.right=void 0!==t.right?t.right:g.right,g.bottom=void 0!==t.bottom?t.bottom:g.bottom,g.left=void 0!==t.left?t.left:g.left}},duration:{get:function(){return W},set:function(t){W=t,a.duration(W),s.duration(W),l.duration(W),B.reset(W)}},interpolate:{get:function(){return a.interpolate()},set:function(t){a.interpolate(t)}},color:{get:function(){return M},set:function(t){M=i.utils.getColor(t),h.color(M)}},rightAlignYAxis:{get:function(){return E},set:function(t){E=t,l.orient(E?"right":"left")}},xTickFormat:{get:function(){return s.xTickFormat()},set:function(t){s.xTickFormat(t),c.xTickFormat(t)}},yTickFormat:{get:function(){return l.yTickFormat()},set:function(t){l.yTickFormat(t),d.yTickFormat(t)}},x:{get:function(){return a.x()},set:function(t){a.x(t),o.x(t)}},y:{get:function(){return a.y()},set:function(t){a.y(t),o.y(t)}},useInteractiveGuideline:{get:function(){return z},set:function(t){z=t}},barColor:{get:function(){return a.barColor},set:function(t){a.barColor(t),o.barColor(t),h.color(function(t,e){return d3.rgb("#ccc").darker(1.5*e).toString()})}}}),i.utils.inheritOptions(q,a),i.utils.initOptions(q),q},i.models.multiChart=function(){"use strict";var t,e,n={top:30,right:20,bottom:50,left:60},r=null,a=i.utils.defaultColor(),o=null,s=null,l=!0,u=null,c=function(t){return t.x},d=function(t){return t.y},h="linear",f=!0,m=i.interactiveGuideline(),p=!1,g=" (right axis)",v=250,_=d3.scale.linear(),y=d3.scale.linear(),b=d3.scale.linear(),M=i.models.line().yScale(y).duration(v),x=i.models.line().yScale(b).duration(v),w=i.models.scatter().yScale(y).duration(v),k=i.models.scatter().yScale(b).duration(v),L=i.models.multiBar().stacked(!1).yScale(y).duration(v),S=i.models.multiBar().stacked(!1).yScale(b).duration(v),T=i.models.stackedArea().yScale(y).duration(v),Y=i.models.stackedArea().yScale(b).duration(v),D=i.models.axis().scale(_).orient("bottom").tickPadding(5).duration(v),C=i.models.axis().scale(y).orient("left").duration(v),E=i.models.axis().scale(b).orient("right").duration(v),A=i.models.legend().height(30),O=i.models.tooltip(),j=d3.dispatch(),N=[M,x,w,k,L,S,T,Y];function H(u){return u.each(function(u){var f=d3.select(this);i.utils.initSVG(f),H.update=function(){f.transition().call(H)},H.container=this;var v=i.utils.availableWidth(o,f,n),j=i.utils.availableHeight(s,f,n),V=u.filter(function(t){return"line"==t.type&&1==t.yAxis}),P=u.filter(function(t){return"line"==t.type&&2==t.yAxis}),F=u.filter(function(t){return"scatter"==t.type&&1==t.yAxis}),I=u.filter(function(t){return"scatter"==t.type&&2==t.yAxis}),R=u.filter(function(t){return"bar"==t.type&&1==t.yAxis}),W=u.filter(function(t){return"bar"==t.type&&2==t.yAxis}),z=u.filter(function(t){return"area"==t.type&&1==t.yAxis}),B=u.filter(function(t){return"area"==t.type&&2==t.yAxis});if(!(u&&u.length&&u.filter(function(t){return t.values.length}).length))return i.utils.noData(H,f),H;f.selectAll(".nv-noData").remove();var U=u.filter(function(t){return!t.disabled&&1==t.yAxis}).map(function(t){return t.values.map(function(t,e){return{x:c(t),y:d(t)}})}),G=u.filter(function(t){return!t.disabled&&2==t.yAxis}).map(function(t){return t.values.map(function(t,e){return{x:c(t),y:d(t)}})});_.domain(d3.extent(d3.merge(U.concat(G)),function(t){return t.x})).range([0,v]);var $=f.selectAll("g.wrap.multiChart").data([u]),q=$.enter().append("g").attr("class","wrap nvd3 multiChart").append("g");q.append("g").attr("class","nv-x nv-axis"),q.append("g").attr("class","nv-y1 nv-axis"),q.append("g").attr("class","nv-y2 nv-axis"),q.append("g").attr("class","stack1Wrap"),q.append("g").attr("class","stack2Wrap"),q.append("g").attr("class","bars1Wrap"),q.append("g").attr("class","bars2Wrap"),q.append("g").attr("class","scatters1Wrap"),q.append("g").attr("class","scatters2Wrap"),q.append("g").attr("class","lines1Wrap"),q.append("g").attr("class","lines2Wrap"),q.append("g").attr("class","legendWrap"),q.append("g").attr("class","nv-interactive");var J=$.select("g"),X=u.map(function(t,e){return u[e].color||a(t,e)});if(l){var Z=A.align()?v/2:v,K=A.align()?Z:0;A.width(Z),A.color(X),J.select(".legendWrap").datum(u.map(function(t){return t.originalKey=void 0===t.originalKey?t.key:t.originalKey,t.key=t.originalKey+(1==t.yAxis?"":g),t})).call(A),r||A.height()===n.top||(n.top=A.height(),j=i.utils.availableHeight(s,f,n)),J.select(".legendWrap").attr("transform","translate("+K+","+-n.top+")")}else J.select(".legendWrap").selectAll("*").remove();M.width(v).height(j).interpolate(h).color(X.filter(function(t,e){return!u[e].disabled&&1==u[e].yAxis&&"line"==u[e].type})),x.width(v).height(j).interpolate(h).color(X.filter(function(t,e){return!u[e].disabled&&2==u[e].yAxis&&"line"==u[e].type})),w.width(v).height(j).color(X.filter(function(t,e){return!u[e].disabled&&1==u[e].yAxis&&"scatter"==u[e].type})),k.width(v).height(j).color(X.filter(function(t,e){return!u[e].disabled&&2==u[e].yAxis&&"scatter"==u[e].type})),L.width(v).height(j).color(X.filter(function(t,e){return!u[e].disabled&&1==u[e].yAxis&&"bar"==u[e].type})),S.width(v).height(j).color(X.filter(function(t,e){return!u[e].disabled&&2==u[e].yAxis&&"bar"==u[e].type})),T.width(v).height(j).interpolate(h).color(X.filter(function(t,e){return!u[e].disabled&&1==u[e].yAxis&&"area"==u[e].type})),Y.width(v).height(j).interpolate(h).color(X.filter(function(t,e){return!u[e].disabled&&2==u[e].yAxis&&"area"==u[e].type})),J.attr("transform","translate("+n.left+","+n.top+")");var Q=J.select(".lines1Wrap").datum(V.filter(function(t){return!t.disabled})),tt=J.select(".scatters1Wrap").datum(F.filter(function(t){return!t.disabled})),et=J.select(".bars1Wrap").datum(R.filter(function(t){return!t.disabled})),nt=J.select(".stack1Wrap").datum(z.filter(function(t){return!t.disabled})),it=J.select(".lines2Wrap").datum(P.filter(function(t){return!t.disabled})),rt=J.select(".scatters2Wrap").datum(I.filter(function(t){return!t.disabled})),at=J.select(".bars2Wrap").datum(W.filter(function(t){return!t.disabled})),ot=J.select(".stack2Wrap").datum(B.filter(function(t){return!t.disabled})),st=[];L.stacked()&&R.length&&((st=R.filter(function(t){return!t.disabled}).map(function(t){return t.values})).length>0&&(st=st.reduce(function(t,e){return t.map(function(t,n){return{x:t.x,y:t.y+e[n].y}})})));R.length&&st.push({x:0,y:0});var lt=[];S.stacked()&&W.length&&((lt=W.filter(function(t){return!t.disabled}).map(function(t){return t.values})).length>0&&(lt=lt.reduce(function(t,e){return t.map(function(t,n){return{x:t.x,y:t.y+e[n].y}})})));function ut(t){return d3.transpose(t).map(function(t){return t.map(function(t){return t.y})}).map(function(t){return d3.sum(t)})}if(W.length&<.push({x:0,y:0}),y.domain(t||d3.extent(d3.merge(U).concat(st),function(t){return t.y})).range([0,j]),b.domain(e||d3.extent(d3.merge(G).concat(lt),function(t){return t.y})).range([0,j]),M.yDomain(y.domain()),w.yDomain(y.domain()),L.stacked()){var ct=y.domain([0,d3.max(ut(U))]).range([0,j]);L.yDomain(ct.domain())}else L.yDomain(y.domain());if(T.yDomain(y.domain()),x.yDomain(b.domain()),k.yDomain(b.domain()),S.stacked()){var dt=b.domain([0,d3.max(ut(G))]).range([0,j]);S.yDomain(dt.domain())}else S.yDomain(b.domain());function ht(t){var e=2===t.series.yAxis?E:C;t.value=t.point.x,t.series={value:t.point.y,color:t.point.color,key:t.series.key},O.duration(0).headerFormatter(function(t,e){return D.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function ft(t){var e=2===t.series.yAxis?E:C;t.value=t.point.x,t.series={value:t.point.y,color:t.point.color,key:t.series.key},O.duration(100).headerFormatter(function(t,e){return D.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function mt(t){var e=2===t.series.yAxis?E:C;t.point.x=T.x()(t.point),t.point.y=T.y()(t.point),O.duration(0).headerFormatter(function(t,e){return D.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function pt(t){var e=2===t.series.yAxis?E:C;t.value=L.x()(t.data),t.series={value:L.y()(t.data),color:t.color,key:t.data.key},O.duration(0).headerFormatter(function(t,e){return D.tickFormat()(t,e)}).valueFormatter(function(t,n){return e.tickFormat()(t,n)}).data(t).hidden(!1)}function gt(){for(var t=0,e=N.length;t<e;t++){var n=N[t];try{n.clearHighlights()}catch(t){}}}Y.yDomain(b.domain()),z.length&&d3.transition(nt).call(T),B.length&&d3.transition(ot).call(Y),R.length&&d3.transition(et).call(L),W.length&&d3.transition(at).call(S),V.length&&d3.transition(Q).call(M),P.length&&d3.transition(it).call(x),F.length&&d3.transition(tt).call(w),I.length&&d3.transition(rt).call(k),D._ticks(i.utils.calcTicksX(v/100,u)).tickSize(-j,0),J.select(".nv-x.nv-axis").attr("transform","translate(0,"+j+")"),d3.transition(J.select(".nv-x.nv-axis")).call(D),C._ticks(i.utils.calcTicksY(j/36,u)).tickSize(-v,0),d3.transition(J.select(".nv-y1.nv-axis")).call(C),E._ticks(i.utils.calcTicksY(j/36,u)).tickSize(-v,0),d3.transition(J.select(".nv-y2.nv-axis")).call(E),J.select(".nv-y1.nv-axis").classed("nv-disabled",!U.length).attr("transform","translate("+_.range()[0]+",0)"),J.select(".nv-y2.nv-axis").classed("nv-disabled",!G.length).attr("transform","translate("+_.range()[1]+",0)"),A.dispatch.on("stateChange",function(t){H.update()}),p&&(m.width(v).height(j).margin({left:n.left,top:n.top}).svgContainer(f).xScale(_),$.select(".nv-interactive").call(m)),p?(m.dispatch.on("elementMousemove",function(t){gt();var e,n,r,o=[];u.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(s,l){var u=_.domain(),c=s.values.filter(function(t,e){return H.x()(t,e)>=u[0]&&H.x()(t,e)<=u[1]}),d=c[n=i.interactiveBisect(c,t.pointXValue,H.x())],h=H.y()(d,n);null===h||isNaN(h)||s.noHighlightSeries||function(t,e,n,i){var r={line:{yAxis1:{chart:M,data:V},yAxis2:{chart:x,data:P}},scatter:{yAxis1:{chart:w,data:F},yAxis2:{chart:k,data:I}},bar:{yAxis1:{chart:L,data:R},yAxis2:{chart:S,data:W}},area:{yAxis1:{chart:T,data:z},yAxis2:{chart:Y,data:B}}},a=r[t.type]["yAxis"+t.yAxis].chart,o=r[t.type]["yAxis"+t.yAxis].data.reduce(function(e,n,i){return n.key===t.key?i:e},0);try{a.highlightPoint(o,e,n,i)}catch(t){}}(s,n,!0),void 0!==d&&(void 0===e&&(e=d),void 0===r&&(r=_(H.x()(d,n))),o.push({key:s.key,value:h,color:a(s,s.seriesIndex),data:d,yAxis:2==s.yAxis?E:C}))});m.tooltip.headerFormatter(function(t,e){return D.tickFormat()(t,e)}).valueFormatter(m.tooltip.valueFormatter()||function(t,e){var n=o[e].yAxis;return null==t?"N/A":n.tickFormat()(t)}).data({value:H.x()(e,n),index:n,series:o})(),m.renderGuideLine(r)}),m.dispatch.on("elementMouseout",function(t){gt()})):(M.dispatch.on("elementMouseover.tooltip",ht),x.dispatch.on("elementMouseover.tooltip",ht),M.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),x.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),w.dispatch.on("elementMouseover.tooltip",ft),k.dispatch.on("elementMouseover.tooltip",ft),w.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),k.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),T.dispatch.on("elementMouseover.tooltip",mt),Y.dispatch.on("elementMouseover.tooltip",mt),T.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),Y.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),L.dispatch.on("elementMouseover.tooltip",pt),S.dispatch.on("elementMouseover.tooltip",pt),L.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),S.dispatch.on("elementMouseout.tooltip",function(t){O.hidden(!0)}),L.dispatch.on("elementMousemove.tooltip",function(t){O()}),S.dispatch.on("elementMousemove.tooltip",function(t){O()}))}),H}return H.dispatch=j,H.legend=A,H.lines1=M,H.lines2=x,H.scatters1=w,H.scatters2=k,H.bars1=L,H.bars2=S,H.stack1=T,H.stack2=Y,H.xAxis=D,H.yAxis1=C,H.yAxis2=E,H.tooltip=O,H.interactiveLayer=m,H.options=i.utils.optionsFunc.bind(H),H._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},showLegend:{get:function(){return l},set:function(t){l=t}},xScale:{get:function(){return _},set:function(t){_=t,D.scale(_)}},yDomain1:{get:function(){return t},set:function(e){t=e}},yDomain2:{get:function(){return e},set:function(t){e=t}},noData:{get:function(){return u},set:function(t){u=t}},interpolate:{get:function(){return h},set:function(t){h=t}},legendRightAxisHint:{get:function(){return g},set:function(t){g=t}},margin:{get:function(){return n},set:function(t){void 0!==t.top&&(n.top=t.top,r=t.top),n.right=void 0!==t.right?t.right:n.right,n.bottom=void 0!==t.bottom?t.bottom:n.bottom,n.left=void 0!==t.left?t.left:n.left}},color:{get:function(){return a},set:function(t){a=i.utils.getColor(t)}},x:{get:function(){return c},set:function(t){c=t,M.x(t),x.x(t),w.x(t),k.x(t),L.x(t),S.x(t),T.x(t),Y.x(t)}},y:{get:function(){return d},set:function(t){d=t,M.y(t),x.y(t),w.y(t),k.y(t),T.y(t),Y.y(t),L.y(t),S.y(t)}},useVoronoi:{get:function(){return f},set:function(t){f=t,M.useVoronoi(t),x.useVoronoi(t),T.useVoronoi(t),Y.useVoronoi(t)}},useInteractiveGuideline:{get:function(){return p},set:function(t){(p=t)&&(M.interactive(!1),M.useVoronoi(!1),x.interactive(!1),x.useVoronoi(!1),T.interactive(!1),T.useVoronoi(!1),Y.interactive(!1),Y.useVoronoi(!1),w.interactive(!1),k.interactive(!1))}},duration:{get:function(){return v},set:function(t){v=t,[M,x,T,Y,w,k,D,C,E].forEach(function(t){t.duration(v)})}}}),i.utils.initOptions(H),H},i.models.ohlcBar=function(){"use strict";var t,e,n,r,a={top:0,right:0,bottom:0,left:0},o=null,s=null,l=Math.floor(1e4*Math.random()),u=null,c=d3.scale.linear(),d=d3.scale.linear(),h=function(t){return t.x},f=function(t){return t.y},m=function(t){return t.open},p=function(t){return t.close},g=function(t){return t.high},v=function(t){return t.low},_=[],y=[],b=!1,M=!0,x=i.utils.defaultColor(),w=!1,k=d3.dispatch("stateChange","changeState","renderEnd","chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove");function L(w){return w.each(function(w){u=d3.select(this);var L=i.utils.availableWidth(o,u,a),S=i.utils.availableHeight(s,u,a);i.utils.initSVG(u);var T=L/w[0].values.length*.9;c.domain(t||d3.extent(w[0].values.map(h).concat(_))),b?c.range(n||[.5*L/w[0].values.length,L*(w[0].values.length-.5)/w[0].values.length]):c.range(n||[5+T/2,L-T/2-5]),d.domain(e||[d3.min(w[0].values.map(v).concat(y)),d3.max(w[0].values.map(g).concat(y))]).range(r||[S,0]),c.domain()[0]===c.domain()[1]&&(c.domain()[0]?c.domain([c.domain()[0]-.01*c.domain()[0],c.domain()[1]+.01*c.domain()[1]]):c.domain([-1,1])),d.domain()[0]===d.domain()[1]&&(d.domain()[0]?d.domain([d.domain()[0]+.01*d.domain()[0],d.domain()[1]-.01*d.domain()[1]]):d.domain([-1,1]));var Y=d3.select(this).selectAll("g.nv-wrap.nv-ohlcBar").data([w[0].values]),D=Y.enter().append("g").attr("class","nvd3 nv-wrap nv-ohlcBar"),C=D.append("defs"),E=D.append("g"),A=Y.select("g");E.append("g").attr("class","nv-ticks"),Y.attr("transform","translate("+a.left+","+a.top+")"),u.on("click",function(t,e){k.chartClick({data:t,index:e,pos:d3.event,id:l})}),C.append("clipPath").attr("id","nv-chart-clip-path-"+l).append("rect"),Y.select("#nv-chart-clip-path-"+l+" rect").attr("width",L).attr("height",S),A.attr("clip-path",M?"url(#nv-chart-clip-path-"+l+")":"");var O=Y.select(".nv-ticks").selectAll(".nv-tick").data(function(t){return t});O.exit().remove(),O.enter().append("path").attr("class",function(t,e,n){return(m(t,e)>p(t,e)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+e}).attr("d",function(t,e){return"m0,0l0,"+(d(m(t,e))-d(g(t,e)))+"l"+-T/2+",0l"+T/2+",0l0,"+(d(v(t,e))-d(m(t,e)))+"l0,"+(d(p(t,e))-d(v(t,e)))+"l"+T/2+",0l"+-T/2+",0z"}).attr("transform",function(t,e){return"translate("+c(h(t,e))+","+d(g(t,e))+")"}).attr("fill",function(t,e){return x[0]}).attr("stroke",function(t,e){return x[0]}).attr("x",0).attr("y",function(t,e){return d(Math.max(0,f(t,e)))}).attr("height",function(t,e){return Math.abs(d(f(t,e))-d(0))}),O.attr("class",function(t,e,n){return(m(t,e)>p(t,e)?"nv-tick negative":"nv-tick positive")+" nv-tick-"+n+"-"+e}),d3.transition(O).attr("transform",function(t,e){return"translate("+c(h(t,e))+","+d(g(t,e))+")"}).attr("d",function(t,e){var n=L/w[0].values.length*.9;return"m0,0l0,"+(d(m(t,e))-d(g(t,e)))+"l"+-n/2+",0l"+n/2+",0l0,"+(d(v(t,e))-d(m(t,e)))+"l0,"+(d(p(t,e))-d(v(t,e)))+"l"+n/2+",0l"+-n/2+",0z"})}),L}return L.highlightPoint=function(t,e){L.clearHighlights(),u.select(".nv-ohlcBar .nv-tick-0-"+t).classed("hover",e)},L.clearHighlights=function(){u.select(".nv-ohlcBar .nv-tick.hover").classed("hover",!1)},L.dispatch=k,L.options=i.utils.optionsFunc.bind(L),L._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},xScale:{get:function(){return c},set:function(t){c=t}},yScale:{get:function(){return d},set:function(t){d=t}},xDomain:{get:function(){return t},set:function(e){t=e}},yDomain:{get:function(){return e},set:function(t){e=t}},xRange:{get:function(){return n},set:function(t){n=t}},yRange:{get:function(){return r},set:function(t){r=t}},forceX:{get:function(){return _},set:function(t){_=t}},forceY:{get:function(){return y},set:function(t){y=t}},padData:{get:function(){return b},set:function(t){b=t}},clipEdge:{get:function(){return M},set:function(t){M=t}},id:{get:function(){return l},set:function(t){l=t}},interactive:{get:function(){return w},set:function(t){w=t}},x:{get:function(){return h},set:function(t){h=t}},y:{get:function(){return f},set:function(t){f=t}},open:{get:function(){return m()},set:function(t){m=t}},close:{get:function(){return p()},set:function(t){p=t}},high:{get:function(){return g},set:function(t){g=t}},low:{get:function(){return v},set:function(t){v=t}},margin:{get:function(){return a},set:function(t){a.top=void 0!=t.top?t.top:a.top,a.right=void 0!=t.right?t.right:a.right,a.bottom=void 0!=t.bottom?t.bottom:a.bottom,a.left=void 0!=t.left?t.left:a.left}},color:{get:function(){return x},set:function(t){x=i.utils.getColor(t)}}}),i.utils.initOptions(L),L},i.models.parallelCoordinates=function(){"use strict";var t,e,n,r={top:30,right:0,bottom:10,left:0},a=null,o=null,s=null,l=null,u=d3.scale.ordinal(),c={},d="undefined values",h=[],f=[],m=[],p=!0,g=i.utils.defaultColor(),v=[],_=[],y=[],b=[],M=1,x=d3.svg.line(),w=d3.svg.axis(),k=d3.dispatch("brushstart","brush","brushEnd","dimensionsOrder","stateChange","elementClick","elementMouseover","elementMouseout","elementMousemove","renderEnd","activeChanged"),L=i.utils.renderWatch(k);function S(T){return L.reset(),T.each(function(L){var S=d3.select(this);if(s=i.utils.availableWidth(a,S,r),l=i.utils.availableHeight(o,S,r),i.utils.initSVG(S),void 0===L[0].values){var T=[];L.forEach(function(t){var e={};Object.keys(t).forEach(function(n){"name"!==n&&(e[n]=t[n])}),T.push({key:t.name,values:e})}),L=T}var Y=L.map(function(t){return t.values});0===_.length&&(_=L),m=h.sort(function(t,e){return t.currentPosition-e.currentPosition}).map(function(t){return t.key}),f=h.filter(function(t){return!t.disabled}),u.rangePoints([0,s],1).domain(f.map(function(t){return t.key}));var D={},C=!1,E=[];m.forEach(function(t){var e=d3.extent(Y,function(e){return+e[t]}),n=e[0],i=e[1],r=!1;(isNaN(n)||isNaN(i))&&(r=!0,n=0,i=0),n===i&&(n-=1,i+=1);var a=v.filter(function(e){return e.dimension==t});0!==a.length&&(r?(n=c[t].domain()[0],i=c[t].domain()[1]):!a[0].hasOnlyNaN&&p?(n=n>a[0].extent[0]?a[0].extent[0]:n,i=i<a[0].extent[1]?a[0].extent[1]:i):a[0].hasNaN&&(i=i<a[0].extent[1]?a[0].extent[1]:i,D[t]=c[t].domain()[1],C=!0)),c[t]=d3.scale.linear().domain([n,i]).range([.9*(l-12),0]),b=[],c[t].brush=d3.svg.brush().y(c[t]).on("brushstart",G).on("brush",$).on("brushend",q)});var A=S.selectAll("g.nv-wrap.nv-parallelCoordinates").data([L]),O=A.enter().append("g").attr("class","nvd3 nv-wrap nv-parallelCoordinates").append("g"),j=A.select("g");O.append("g").attr("class","nv-parallelCoordinates background"),O.append("g").attr("class","nv-parallelCoordinates foreground"),O.append("g").attr("class","nv-parallelCoordinates missingValuesline"),A.attr("transform","translate("+r.left+","+r.top+")"),x.interpolate("cardinal").tension(M),w.orient("left");var N,H,V=d3.behavior.drag().on("dragstart",function(t){y[t.key]=this.parentNode.__origin__=u(t.key),e.attr("visibility","hidden")}).on("drag",function(e){y[e.key]=Math.min(s,Math.max(0,this.parentNode.__origin__+=d3.event.x)),t.attr("d",B),f.sort(function(t,e){return X(t.key)-X(e.key)}),f.forEach(function(t,e){return t.currentPosition=e}),u.domain(f.map(function(t){return t.key})),n.attr("transform",function(t){return"translate("+X(t.key)+")"})}).on("dragend",function(n,i){delete this.parentNode.__origin__,delete y[n.key],d3.select(this.parentNode).attr("transform","translate("+u(n.key)+")"),t.attr("d",B),e.attr("d",B).attr("visibility",null),k.dimensionsOrder(f)}),P=u.range()[1]-u.range()[0];if(P=isNaN(P)?u.range()[0]:P,!isNaN(P)){var F=[0+P/2,l-12,s-P/2,l-12];(N=A.select(".missingValuesline").selectAll("line").data([F])).enter().append("line"),N.exit().remove(),N.attr("x1",function(t){return t[0]}).attr("y1",function(t){return t[1]}).attr("x2",function(t){return t[2]}).attr("y2",function(t){return t[3]}),(H=A.select(".missingValuesline").selectAll("text").data([d])).append("text").data([d]),H.enter().append("text"),H.exit().remove(),H.attr("y",l).attr("x",s-92-P/2).text(function(t){return t})}(e=A.select(".background").selectAll("path").data(L)).enter().append("path"),e.exit().remove(),e.attr("d",B),(t=A.select(".foreground").selectAll("path").data(L)).enter().append("path"),t.exit().remove(),t.attr("d",B).style("stroke-width",function(t,e){return isNaN(t.strokeWidth)&&(t.strokeWidth=1),t.strokeWidth}).attr("stroke",function(t,e){return t.color||g(t,e)}),t.on("mouseover",function(t,e){d3.select(this).classed("hover",!0).style("stroke-width",t.strokeWidth+2+"px").style("stroke-opacity",1),k.elementMouseover({label:t.name,color:t.color||g(t,e),values:t.values,dimensions:f})}),t.on("mouseout",function(t,e){d3.select(this).classed("hover",!1).style("stroke-width",t.strokeWidth+"px").style("stroke-opacity",.7),k.elementMouseout({label:t.name,index:e})}),t.on("mousemove",function(t,e){k.elementMousemove()}),t.on("click",function(t){k.elementClick({id:t.id})});var I=(n=j.selectAll(".dimension").data(f)).enter().append("g").attr("class","nv-parallelCoordinates dimension");n.attr("transform",function(t){return"translate("+u(t.key)+",0)"}),I.append("g").attr("class","nv-axis"),I.append("text").attr("class","nv-label").style("cursor","move").attr("dy","-1em").attr("text-anchor","middle").on("mouseover",function(t,e){k.elementMouseover({label:t.tooltip||t.key,color:t.color})}).on("mouseout",function(t,e){k.elementMouseout({label:t.tooltip})}).on("mousemove",function(t,e){k.elementMousemove()}).call(V),I.append("g").attr("class","nv-brushBackground"),n.exit().remove(),n.select(".nv-label").text(function(t){return t.key}),U(p);var R=m.filter(function(t){return!c[t].brush.empty()}),W=R.map(function(t){return c[t].brush.extent()}),z=_.slice(0);function B(t){return x(f.map(function(e){if(isNaN(t.values[e.key])||isNaN(parseFloat(t.values[e.key]))||C){var n=c[e.key].domain(),i=c[e.key].range(),r=n[0]-(n[1]-n[0])/9;if(b.indexOf(e.key)<0){var a=d3.scale.linear().domain([r,n[1]]).range([l-12,i[1]]);c[e.key].brush.y(a),b.push(e.key)}if(isNaN(t.values[e.key])||isNaN(parseFloat(t.values[e.key])))return[u(e.key),c[e.key](r)]}return void 0!==N&&(b.length>0||C?(N.style("display","inline"),H.style("display","inline")):(N.style("display","none"),H.style("display","none"))),[u(e.key),c[e.key](t.values[e.key])]}))}function U(t){v.forEach(function(e){var n=c[e.dimension].brush.y().domain();e.hasOnlyNaN&&(e.extent[1]=(c[e.dimension].domain()[1]-n[0])*(e.extent[1]-e.extent[0])/(D[e.dimension]-e.extent[0])+n[0]),e.hasNaN&&(e.extent[0]=n[0]),t&&c[e.dimension].brush.extent(e.extent)}),n.select(".nv-brushBackground").each(function(t){d3.select(this).call(c[t.key].brush)}).selectAll("rect").attr("x",-8).attr("width",16),J()}function G(){!1===p&&(p=!0,U(!0))}function $(){R=m.filter(function(t){return!c[t].brush.empty()}),W=R.map(function(t){return c[t].brush.extent()}),v=[],R.forEach(function(t,e){v[e]={dimension:t,extent:W[e],hasNaN:!1,hasOnlyNaN:!1}}),_=[],t.style("display",function(t){var e=R.every(function(e,n){return!(!isNaN(t.values[e])&&!isNaN(parseFloat(t.values[e]))||W[n][0]!=c[e].brush.y().domain()[0])||W[n][0]<=t.values[e]&&t.values[e]<=W[n][1]&&!isNaN(parseFloat(t.values[e]))});return e&&_.push(t),e?null:"none"}),J(),k.brush({filters:v,active:_})}function q(){var t=R.length>0;v.forEach(function(t){t.extent[0]===c[t.dimension].brush.y().domain()[0]&&b.indexOf(t.dimension)>=0&&(t.hasNaN=!0),t.extent[1]<c[t.dimension].domain()[0]&&(t.hasOnlyNaN=!0)}),k.brushEnd(_,t)}function J(){n.select(".nv-axis").each(function(t,e){var n=v.filter(function(e){return e.dimension==t.key});E[t.key]=c[t.key].domain(),0!=n.length&&p&&(E[t.key]=[],n[0].extent[1]>c[t.key].domain()[0]&&(E[t.key]=[n[0].extent[1]]),n[0].extent[0]>=c[t.key].domain()[0]&&E[t.key].push(n[0].extent[0])),d3.select(this).call(w.scale(c[t.key]).tickFormat(t.format).tickValues(E[t.key]))})}function X(t){var e=y[t];return null==e?u(t):e}_=[],t.style("display",function(t){var e=R.every(function(e,n){return!(!isNaN(t.values[e])&&!isNaN(parseFloat(t.values[e]))||W[n][0]!=c[e].brush.y().domain()[0])||W[n][0]<=t.values[e]&&t.values[e]<=W[n][1]&&!isNaN(parseFloat(t.values[e]))});return e&&_.push(t),e?null:"none"}),(v.length>0||!i.utils.arrayEquals(_,z))&&k.activeChanged(_)}),S}return S.dispatch=k,S.options=i.utils.optionsFunc.bind(S),S._options=Object.create({},{width:{get:function(){return a},set:function(t){a=t}},height:{get:function(){return o},set:function(t){o=t}},dimensionData:{get:function(){return h},set:function(t){h=t}},displayBrush:{get:function(){return p},set:function(t){p=t}},filters:{get:function(){return v},set:function(t){v=t}},active:{get:function(){return _},set:function(t){_=t}},lineTension:{get:function(){return M},set:function(t){M=t}},undefinedValuesLabel:{get:function(){return d},set:function(t){d=t}},dimensions:{get:function(){return h.map(function(t){return t.key})},set:function(t){i.deprecated("dimensions","use dimensionData instead"),0===h.length?t.forEach(function(t){h.push({key:t})}):t.forEach(function(t,e){h[e].key=t})}},dimensionNames:{get:function(){return h.map(function(t){return t.key})},set:function(t){i.deprecated("dimensionNames","use dimensionData instead"),m=[],0===h.length?t.forEach(function(t){h.push({key:t})}):t.forEach(function(t,e){h[e].key=t})}},dimensionFormats:{get:function(){return h.map(function(t){return t.format})},set:function(t){i.deprecated("dimensionFormats","use dimensionData instead"),0===h.length?t.forEach(function(t){h.push({format:t})}):t.forEach(function(t,e){h[e].format=t})}},margin:{get:function(){return r},set:function(t){r.top=void 0!==t.top?t.top:r.top,r.right=void 0!==t.right?t.right:r.right,r.bottom=void 0!==t.bottom?t.bottom:r.bottom,r.left=void 0!==t.left?t.left:r.left}},color:{get:function(){return g},set:function(t){g=i.utils.getColor(t)}}}),i.utils.initOptions(S),S},i.models.parallelCoordinatesChart=function(){"use strict";var t=i.models.parallelCoordinates(),e=i.models.legend(),n=i.models.tooltip(),r=(i.models.tooltip(),{top:0,right:0,bottom:0,left:0}),a=null,o=null,s=null,l=!0,u=i.utils.defaultColor(),c=i.utils.state(),d=[],h=!0,f=null,m=null,p="undefined",g=d3.dispatch("dimensionsOrder","brushEnd","stateChange","changeState","renderEnd"),v=i.utils.renderWatch(g),_=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},y=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function b(n){return v.reset(),v.models(t),n.each(function(n){var u=d3.select(this);i.utils.initSVG(u);var m,p=i.utils.availableWidth(o,u,r),v=i.utils.availableHeight(s,u,r);if(b.update=function(){u.call(b)},b.container=this,c.setter(y(d),b.update).getter(_(d)).update(),c.disabled=d.map(function(t){return!!t.disabled}),(d=d.map(function(t){return t.disabled=!!t.disabled,t})).forEach(function(t,e){t.originalPosition=isNaN(t.originalPosition)?e:t.originalPosition,t.currentPosition=isNaN(t.currentPosition)?e:t.currentPosition}),!f)for(m in f={},c)c[m]instanceof Array?f[m]=c[m].slice(0):f[m]=c[m];if(!n||!n.length)return i.utils.noData(b,u),b;u.selectAll(".nv-noData").remove();var M=u.selectAll("g.nv-wrap.nv-parallelCoordinatesChart").data([n]),x=M.enter().append("g").attr("class","nvd3 nv-wrap nv-parallelCoordinatesChart").append("g"),w=M.select("g");x.append("g").attr("class","nv-parallelCoordinatesWrap"),x.append("g").attr("class","nv-legendWrap"),w.select("rect").attr("width",p).attr("height",v>0?v:0),l?(e.width(p).color(function(t){return"rgb(188,190,192)"}),w.select(".nv-legendWrap").datum(d.sort(function(t,e){return t.originalPosition-e.originalPosition})).call(e),a||e.height()===r.top||(r.top=e.height(),v=i.utils.availableHeight(s,u,r)),M.select(".nv-legendWrap").attr("transform","translate( 0 ,"+-r.top+")")):w.select(".nv-legendWrap").selectAll("*").remove(),M.attr("transform","translate("+r.left+","+r.top+")"),t.width(p).height(v).dimensionData(d).displayBrush(h),w.select(".nv-parallelCoordinatesWrap ").datum(n).transition().call(t),t.dispatch.on("brushEnd",function(t,e){e?(h=!0,g.brushEnd(t)):h=!1}),e.dispatch.on("stateChange",function(t){for(var e in t)c[e]=t[e];g.stateChange(c),b.update()}),t.dispatch.on("dimensionsOrder",function(t){d.sort(function(t,e){return t.currentPosition-e.currentPosition});var e=!1;d.forEach(function(t,n){t.currentPosition=n,t.currentPosition!==t.originalPosition&&(e=!0)}),g.dimensionsOrder(d,e)}),g.on("changeState",function(t){void 0!==t.disabled&&(d.forEach(function(e,n){e.disabled=t.disabled[n]}),c.disabled=t.disabled),b.update()})}),v.renderEnd("parraleleCoordinateChart immediate"),b}return n.contentGenerator(function(t){var e='<table><thead><tr><td class="legend-color-guide"><div style="background-color:'+t.color+'"></div></td><td><strong>'+t.key+"</strong></td></tr></thead>";return 0!==t.series.length&&(e+='<tbody><tr><td height ="10px"></td></tr>',t.series.forEach(function(t){e=e+'<tr><td class="legend-color-guide"><div style="background-color:'+t.color+'"></div></td><td class="key">'+t.key+'</td><td class="value">'+t.value+"</td></tr>"}),e+="</tbody>"),e+="</table>"}),t.dispatch.on("elementMouseover.tooltip",function(t){var e={key:t.label,color:t.color,series:[]};t.values&&(Object.keys(t.values).forEach(function(n){var i,r=t.dimensions.filter(function(t){return t.key===n})[0];r&&(i=isNaN(t.values[n])||isNaN(parseFloat(t.values[n]))?p:r.format(t.values[n]),e.series.push({idx:r.currentPosition,key:n,value:i,color:r.color}))}),e.series.sort(function(t,e){return t.idx-e.idx})),n.data(e).hidden(!1)}),t.dispatch.on("elementMouseout.tooltip",function(t){n.hidden(!0)}),t.dispatch.on("elementMousemove.tooltip",function(){n()}),b.dispatch=g,b.parallelCoordinates=t,b.legend=e,b.tooltip=n,b.options=i.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},showLegend:{get:function(){return l},set:function(t){l=t}},defaultState:{get:function(){return f},set:function(t){f=t}},dimensionData:{get:function(){return d},set:function(t){d=t}},displayBrush:{get:function(){return h},set:function(t){h=t}},noData:{get:function(){return m},set:function(t){m=t}},nanValue:{get:function(){return p},set:function(t){p=t}},margin:{get:function(){return r},set:function(t){void 0!==t.top&&(r.top=t.top,a=t.top),r.right=void 0!==t.right?t.right:r.right,r.bottom=void 0!==t.bottom?t.bottom:r.bottom,r.left=void 0!==t.left?t.left:r.left}},color:{get:function(){return u},set:function(n){u=i.utils.getColor(n),e.color(u),t.color(u)}}}),i.utils.inheritOptions(b,t),i.utils.initOptions(b),b},i.models.pie=function(){"use strict";var t={top:0,right:0,bottom:0,left:0},e=500,n=500,r=function(t){return t.x},a=function(t){return t.y},o=Math.floor(1e4*Math.random()),s=null,l=i.utils.defaultColor(),u=d3.format(",.2f"),c=!0,d=!1,h="key",f=.02,m=!1,p=!1,g=!1,v=!0,_=0,y=!1,b=!1,M=!1,x=!1,w=0,k=.5,L=250,S=[],T=d3.dispatch("chartClick","elementClick","elementDblClick","elementMouseover","elementMouseout","elementMousemove","renderEnd"),Y=[],D=[],C=i.utils.renderWatch(T);function E(A){return C.reset(),A.each(function(E){var A=e-t.left-t.right,O=n-t.top-t.bottom,j=Math.min(A,O)/2,N=[],H=[];if(s=d3.select(this),0===S.length)for(var V=j-j/10,P=k*j,F=0;F<E[0].length;F++)N.push(V),H.push(P);else v?(N=S.map(function(t){return(t.outer-t.outer/10)*j}),H=S.map(function(t){return(t.inner-t.inner/10)*j}),k=d3.min(S.map(function(t){return t.inner-t.inner/10}))):(N=S.map(function(t){return t.outer*j}),H=S.map(function(t){return t.inner*j}),k=d3.min(S.map(function(t){return t.inner})));i.utils.initSVG(s);var I=s.selectAll(".nv-wrap.nv-pie").data(E),R=I.enter().append("g").attr("class","nvd3 nv-wrap nv-pie nv-chart-"+o).append("g"),W=I.select("g"),z=R.append("g").attr("class","nv-pie");R.append("g").attr("class","nv-pieLabels"),I.attr("transform","translate("+t.left+","+t.top+")"),W.select(".nv-pie").attr("transform","translate("+A/2+","+O/2+")"),W.select(".nv-pieLabels").attr("transform","translate("+A/2+","+O/2+")"),s.on("click",function(t,e){T.chartClick({data:t,index:e,pos:d3.event,id:o})}),Y=[],D=[];for(F=0;F<E[0].length;F++){var B=d3.svg.arc().outerRadius(N[F]),U=d3.svg.arc().outerRadius(N[F]+5);!1!==b&&(B.startAngle(b),U.startAngle(b)),!1!==x&&(B.endAngle(x),U.endAngle(x)),p&&(B.innerRadius(H[F]),U.innerRadius(H[F])),B.cornerRadius&&w&&(B.cornerRadius(w),U.cornerRadius(w)),Y.push(B),D.push(U)}var G=d3.layout.pie().sort(null).value(function(t){return t.disabled?0:a(t)});G.padAngle&&M&&G.padAngle(M),p&&g&&(z.append("text").attr("class","nv-pie-title"),I.select(".nv-pie-title").style("text-anchor","middle").text(function(t){return g}).style("font-size",Math.min(A,O)*k*2/(g.length+2)+"px").attr("dy","0.35em").attr("transform",function(t,e){return"translate(0, "+_+")"}));var $=I.select(".nv-pie").selectAll(".nv-slice").data(G),q=I.select(".nv-pieLabels").selectAll(".nv-label").data(G);$.exit().remove(),q.exit().remove();var J=$.enter().append("g");J.attr("class","nv-slice"),J.on("mouseover",function(t,e){d3.select(this).classed("hover",!0),v&&d3.select(this).select("path").transition().duration(70).attr("d",D[e]),T.elementMouseover({data:t.data,index:e,color:d3.select(this).style("fill"),percent:(t.endAngle-t.startAngle)/(2*Math.PI)})}),J.on("mouseout",function(t,e){d3.select(this).classed("hover",!1),v&&d3.select(this).select("path").transition().duration(50).attr("d",Y[e]),T.elementMouseout({data:t.data,index:e})}),J.on("mousemove",function(t,e){T.elementMousemove({data:t.data,index:e})}),J.on("click",function(t,e){T.elementClick({data:t.data,index:e,color:d3.select(this).style("fill"),event:d3.event,element:this})}),J.on("dblclick",function(t,e){T.elementDblClick({data:t.data,index:e,color:d3.select(this).style("fill")})}),$.attr("fill",function(t,e){return l(t.data,e)}),$.attr("stroke",function(t,e){return l(t.data,e)});J.append("path").each(function(t){this._current=t});if($.select("path").transition().duration(L).attr("d",function(t,e){return Y[e](t)}).attrTween("d",function(t,e){t.endAngle=isNaN(t.endAngle)?0:t.endAngle,t.startAngle=isNaN(t.startAngle)?0:t.startAngle,p||(t.innerRadius=0);var n=d3.interpolate(this._current,t);return this._current=n(0),function(t){return Y[e](n(t))}}),c){var X=[];for(F=0;F<E[0].length;F++)X.push(Y[F]),d?p&&(X[F]=d3.svg.arc().outerRadius(Y[F].outerRadius()),!1!==b&&X[F].startAngle(b),!1!==x&&X[F].endAngle(x)):p||X[F].innerRadius(0);q.enter().append("g").classed("nv-label",!0).each(function(t,e){var n=d3.select(this);n.attr("transform",function(t,e){if(y){t.outerRadius=N[e]+10,t.innerRadius=N[e]+15;var n=(t.startAngle+t.endAngle)/2*(180/Math.PI);return(t.startAngle+t.endAngle)/2<Math.PI?n-=90:n+=90,"translate("+X[e].centroid(t)+") rotate("+n+")"}return t.outerRadius=j+10,t.innerRadius=j+15,"translate("+X[e].centroid(t)+")"}),n.append("rect").style("stroke","#fff").style("fill","#fff").attr("rx",3).attr("ry",3),n.append("text").style("text-anchor",y?(t.startAngle+t.endAngle)/2<Math.PI?"start":"end":"middle").style("fill","#000")});var Z={},K=function(t){return 140*Math.floor(t[0]/140)+","+14*Math.floor(t[1]/14)},Q=function(t){return(t.endAngle-t.startAngle)/(2*Math.PI)};q.watchTransition(C,"pie labels").attr("transform",function(t,e){if(y){t.outerRadius=N[e]+10,t.innerRadius=N[e]+15;var n=(t.startAngle+t.endAngle)/2*(180/Math.PI);return(t.startAngle+t.endAngle)/2<Math.PI?n-=90:n+=90,"translate("+X[e].centroid(t)+") rotate("+n+")"}t.outerRadius=j+10,t.innerRadius=j+15;var i=X[e].centroid(t),r=Q(t);if(t.value&&r>=f){var a=K(i);Z[a]&&(i[1]-=14),Z[K(i)]=!0}return"translate("+i+")"}),q.select(".nv-label text").style("text-anchor",function(t,e){return y?(t.startAngle+t.endAngle)/2<Math.PI?"start":"end":"middle"}).text(function(t,e){var n=Q(t),i="";if(!t.value||n<f)return"";if("function"==typeof h)i=h(t,e,{key:r(t.data),value:a(t.data),percent:u(n)});else switch(h){case"key":i=r(t.data);break;case"value":i=u(a(t.data));break;case"percent":i=d3.format("%")(n)}return i}),m&&q.each(function(t,e){if(this.getBBox){var n=this.getBBox(),r=X[e].centroid(t),a={x:r[0]+n.x,y:r[1]+n.y},o={x:a.x+n.width,y:a.y},s={x:a.x,y:a.y+n.height},l={x:a.x+n.width,y:a.y+n.height};t.visible=i.utils.pointIsInArc(a,t,B)&&i.utils.pointIsInArc(o,t,B)&&i.utils.pointIsInArc(s,t,B)&&i.utils.pointIsInArc(l,t,B)}}).style("display",function(t){return t.visible?null:"none"})}}),C.renderEnd("pie immediate"),E}return E.dispatch=T,E.options=i.utils.optionsFunc.bind(E),E._options=Object.create({},{arcsRadius:{get:function(){return S},set:function(t){S=t}},width:{get:function(){return e},set:function(t){e=t}},height:{get:function(){return n},set:function(t){n=t}},showLabels:{get:function(){return c},set:function(t){c=t}},title:{get:function(){return g},set:function(t){g=t}},titleOffset:{get:function(){return _},set:function(t){_=t}},labelThreshold:{get:function(){return f},set:function(t){f=t}},hideOverlapLabels:{get:function(){return m},set:function(t){m=t}},valueFormat:{get:function(){return u},set:function(t){u=t}},x:{get:function(){return r},set:function(t){r=t}},id:{get:function(){return o},set:function(t){o=t}},endAngle:{get:function(){return x},set:function(t){x=t}},startAngle:{get:function(){return b},set:function(t){b=t}},padAngle:{get:function(){return M},set:function(t){M=t}},cornerRadius:{get:function(){return w},set:function(t){w=t}},donutRatio:{get:function(){return k},set:function(t){k=t}},labelsOutside:{get:function(){return d},set:function(t){d=t}},labelSunbeamLayout:{get:function(){return y},set:function(t){y=t}},donut:{get:function(){return p},set:function(t){p=t}},growOnHover:{get:function(){return v},set:function(t){v=t}},pieLabelsOutside:{get:function(){return d},set:function(t){d=t,i.deprecated("pieLabelsOutside","use labelsOutside instead")}},donutLabelsOutside:{get:function(){return d},set:function(t){d=t,i.deprecated("donutLabelsOutside","use labelsOutside instead")}},labelFormat:{get:function(){return u},set:function(t){u=t,i.deprecated("labelFormat","use valueFormat instead")}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},duration:{get:function(){return L},set:function(t){L=t,C.reset(L)}},y:{get:function(){return a},set:function(t){a=d3.functor(t)}},color:{get:function(){return l},set:function(t){l=i.utils.getColor(t)}},labelType:{get:function(){return h},set:function(t){h=t||"key"}}}),i.utils.initOptions(E),E},i.models.pieChart=function(){"use strict";var t=i.models.pie(),e=i.models.legend(),n=i.models.tooltip(),r={top:30,right:20,bottom:20,left:20},a=null,o=null,s=null,l=!1,u=!0,c="top",d=i.utils.defaultColor(),h=i.utils.state(),f=null,m=null,p=250,g=d3.dispatch("stateChange","changeState","renderEnd");n.duration(0).headerEnabled(!1).valueFormatter(function(e,n){return t.valueFormat()(e,n)});var v=i.utils.renderWatch(g),_=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},y=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function b(n){return v.reset(),v.models(t),n.each(function(n){var l=d3.select(this);i.utils.initSVG(l);var d,m=i.utils.availableWidth(o,l,r),p=i.utils.availableHeight(s,l,r);if(b.update=function(){l.transition().call(b)},b.container=this,h.setter(y(n),b.update).getter(_(n)).update(),h.disabled=n.map(function(t){return!!t.disabled}),!f)for(d in f={},h)h[d]instanceof Array?f[d]=h[d].slice(0):f[d]=h[d];if(!n||!n.length)return i.utils.noData(b,l),b;l.selectAll(".nv-noData").remove();var v=l.selectAll("g.nv-wrap.nv-pieChart").data([n]),M=v.enter().append("g").attr("class","nvd3 nv-wrap nv-pieChart").append("g"),x=v.select("g");if(M.append("g").attr("class","nv-pieWrap"),M.append("g").attr("class","nv-legendWrap"),u)if("top"===c)e.width(m).key(t.x()),v.select(".nv-legendWrap").datum(n).call(e),a||e.height()===r.top||(r.top=e.height(),p=i.utils.availableHeight(s,l,r)),v.select(".nv-legendWrap").attr("transform","translate(0,"+-r.top+")");else if("right"===c){var w=i.models.legend().width();m/2<w&&(w=m/2),e.height(p).key(t.x()),e.width(w),m-=e.width(),v.select(".nv-legendWrap").datum(n).call(e).attr("transform","translate("+m+",0)")}else"bottom"===c&&(e.width(m).key(t.x()),v.select(".nv-legendWrap").datum(n).call(e),r.bottom=e.height(),p=i.utils.availableHeight(s,l,r),v.select(".nv-legendWrap").attr("transform","translate(0,"+p+")"));else x.select(".nv-legendWrap").selectAll("*").remove();v.attr("transform","translate("+r.left+","+r.top+")"),t.width(m).height(p);var k=x.select(".nv-pieWrap").datum([n]);d3.transition(k).call(t),e.dispatch.on("stateChange",function(t){for(var e in t)h[e]=t[e];g.stateChange(h),b.update()}),g.on("changeState",function(t){void 0!==t.disabled&&(n.forEach(function(e,n){e.disabled=t.disabled[n]}),h.disabled=t.disabled),b.update()})}),v.renderEnd("pieChart immediate"),b}return t.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:b.x()(t.data),value:b.y()(t.data),color:t.color,percent:t.percent},l||(delete t.percent,delete t.series.percent),n.data(t).hidden(!1)}),t.dispatch.on("elementMouseout.tooltip",function(t){n.hidden(!0)}),t.dispatch.on("elementMousemove.tooltip",function(t){n()}),b.legend=e,b.dispatch=g,b.pie=t,b.tooltip=n,b.options=i.utils.optionsFunc.bind(b),b._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},noData:{get:function(){return m},set:function(t){m=t}},showTooltipPercent:{get:function(){return l},set:function(t){l=t}},showLegend:{get:function(){return u},set:function(t){u=t}},legendPosition:{get:function(){return c},set:function(t){c=t}},defaultState:{get:function(){return f},set:function(t){f=t}},color:{get:function(){return d},set:function(n){d=n,e.color(d),t.color(d)}},duration:{get:function(){return p},set:function(e){p=e,v.reset(p),t.duration(p)}},margin:{get:function(){return r},set:function(t){void 0!==t.top&&(r.top=t.top,a=t.top),r.right=void 0!==t.right?t.right:r.right,r.bottom=void 0!==t.bottom?t.bottom:r.bottom,r.left=void 0!==t.left?t.left:r.left}}}),i.utils.inheritOptions(b,t),i.utils.initOptions(b),b},i.models.sankey=function(){"use strict";var t={},e=24,n=8,r=[1,1],a=[],o=[],s=!0,l=function(t){a.forEach(function(t){t.sourceLinks=[],t.targetLinks=[]}),o.forEach(function(t){var e=t.source,n=t.target;"number"==typeof e&&(e=t.source=a[t.source]),"number"==typeof n&&(n=t.target=a[t.target]),e.sourceLinks.push(t),n.targetLinks.push(t)}),a.forEach(function(t){t.value=Math.max(d3.sum(t.sourceLinks,h),d3.sum(t.targetLinks,h))}),function(){var t,n=a,i=0;for(;n.length&&i<a.length;)t=[],n.forEach(function(n){n.x=i,n.dx=e,n.sourceLinks.forEach(function(e){t.indexOf(e.target)<0&&t.push(e.target)})}),n=t,++i;s&&function(t){a.forEach(function(e){e.sourceLinks.length||(e.x=t-1)})}(i);!function(t){a.forEach(function(e){e.x*=t})}((r[0]-e)/(i-1))}(),function(t){var e=d3.nest().key(function(t){return t.x}).sortKeys(d3.ascending).entries(a).map(function(t){return t.values});(function(){var t=d3.min(e,function(t){return(r[1]-(t.length-1)*n)/d3.sum(t,h)});e.forEach(function(e){e.forEach(function(e,n){e.y=n,e.dy=e.value*t})}),o.forEach(function(e){e.dy=e.value*t})})(),u(),d();for(var i=1;t>0;--t)l(i*=.99),u(),d(),s(i),u(),d();function s(t){function n(t){return(t.source.y+t.sy+t.dy/2)*t.value}e.forEach(function(e,i){e.forEach(function(e){if(e.targetLinks.length){var i=d3.sum(e.targetLinks,n)/d3.sum(e.targetLinks,h);e.y+=(i-c(e))*t}})})}function l(t){function n(t){return(t.target.y+t.ty+t.dy/2)*t.value}e.slice().reverse().forEach(function(e){e.forEach(function(e){if(e.sourceLinks.length){var i=d3.sum(e.sourceLinks,n)/d3.sum(e.sourceLinks,h);e.y+=(i-c(e))*t}})})}function u(){e.forEach(function(t){var e,i,a,o=0,s=t.length;for(t.sort(f),a=0;a<s;++a)e=t[a],(i=o-e.y)>0&&(e.y+=i),o=e.y+e.dy+n;if((i=o-n-r[1])>0)for(o=e.y-=i,a=s-2;a>=0;--a)e=t[a],(i=e.y+e.dy+n-o)>0&&(e.y-=i),o=e.y})}function f(t,e){return t.y-e.y}}(t)},u=function(){var t=.5;function e(e){var n=e.source.x+e.source.dx,i=e.target.x,r=d3.interpolateNumber(n,i),a=r(t),o=r(1-t),s=e.source.y+e.sy+e.dy/2,l=e.target.y+e.ty+e.dy/2;return"M"+n+","+s+"C"+a+","+s+" "+o+","+l+" "+i+","+l}return e.curvature=function(n){return arguments.length?(t=+n,e):t},e},c=function(t){return t.y+t.dy/2};function d(){function t(t,e){return t.source.y-e.source.y}function e(t,e){return t.target.y-e.target.y}a.forEach(function(n){n.sourceLinks.sort(e),n.targetLinks.sort(t)}),a.forEach(function(t){var e=0,n=0;t.sourceLinks.forEach(function(t){t.sy=e,e+=t.dy}),t.targetLinks.forEach(function(t){t.ty=n,n+=t.dy})})}function h(t){return t.value}return t.options=i.utils.optionsFunc.bind(t),t._options=Object.create({},{nodeWidth:{get:function(){return e},set:function(t){e=+t}},nodePadding:{get:function(){return n},set:function(t){n=t}},nodes:{get:function(){return a},set:function(t){a=t}},links:{get:function(){return o},set:function(t){o=t}},size:{get:function(){return r},set:function(t){r=t}},sinksRight:{get:function(){return s},set:function(t){s=t}},layout:{get:function(){l(32)},set:function(t){l(t)}},relayout:{get:function(){d()},set:function(t){}},center:{get:function(){return c()},set:function(t){"function"==typeof t&&(c=t)}},link:{get:function(){return u()},set:function(t){return"function"==typeof t&&(u=t),u()}}}),i.utils.initOptions(t),t},i.models.sankeyChart=function(){"use strict";var t={top:5,right:0,bottom:5,left:0},e=i.models.sankey(),n=600,r=400,a=36,o=40,s="units",l=void 0,u=d3.format(",.0f"),c=function(t){return u(t)+" "+s},d=d3.scale.category20(),h=function(t){return t.source.name+" → "+t.target.name+"\n"+c(t.value)},f=function(t){return t.color=d(t.name.replace(/ .*/,""))},m=function(t){return d3.rgb(t.color).darker(2)},p=function(t){return t.name+"\n"+c(t.value)},g=function(t,e){t.append("text").attr("x",0).attr("y",0).attr("class","nvd3-sankey-chart-error").attr("text-anchor","middle").text(e)};function v(t){return t.each(function(i){var s={nodes:[{node:1,name:"Test 1"},{node:2,name:"Test 2"},{node:3,name:"Test 3"},{node:4,name:"Test 4"},{node:5,name:"Test 5"},{node:6,name:"Test 6"}],links:[{source:0,target:1,value:2295},{source:0,target:5,value:1199},{source:1,target:2,value:1119},{source:1,target:5,value:1176},{source:2,target:3,value:487},{source:2,target:5,value:632},{source:3,target:4,value:301},{source:3,target:5,value:186}]},u=!1,c=!1;if(("object"==typeof i.nodes&&i.nodes.length)>=0&&("object"==typeof i.links&&i.links.length)>=0&&(u=!0),i.nodes&&i.nodes.length>0&&i.links&&i.links.length>0&&(c=!0),!u)return console.error("NVD3 Sankey chart error:","invalid data format for",i),console.info("Valid data format is: ",s,JSON.stringify(s)),g(t,"Error loading chart, data is invalid"),!1;if(!c)return g(t,"No data available"),!1;var d=t.append("svg").attr("width",n).attr("height",r).append("g").attr("class","nvd3 nv-wrap nv-sankeyChart");e.nodeWidth(a).nodePadding(o).size([n,r]);var v=e.link();e.nodes(i.nodes).links(i.links).layout(32).center(l);var _=d.append("g").selectAll(".link").data(i.links).enter().append("path").attr("class","link").attr("d",v).style("stroke-width",function(t){return Math.max(1,t.dy)}).sort(function(t,e){return e.dy-t.dy});_.append("title").text(h);var y=d.append("g").selectAll(".node").data(i.nodes).enter().append("g").attr("class","node").attr("transform",function(t){return"translate("+t.x+","+t.y+")"}).call(d3.behavior.drag().origin(function(t){return t}).on("dragstart",function(){this.parentNode.appendChild(this)}).on("drag",function(t){d3.select(this).attr("transform","translate("+t.x+","+(t.y=Math.max(0,Math.min(r-t.dy,d3.event.y)))+")"),e.relayout(),_.attr("d",v)}));y.append("rect").attr("height",function(t){return t.dy}).attr("width",e.nodeWidth()).style("fill",f).style("stroke",m).append("title").text(p),y.append("text").attr("x",-6).attr("y",function(t){return t.dy/2}).attr("dy",".35em").attr("text-anchor","end").attr("transform",null).text(function(t){return t.name}).filter(function(t){return t.x<n/2}).attr("x",6+e.nodeWidth()).attr("text-anchor","start")}),v}return v.options=i.utils.optionsFunc.bind(v),v._options=Object.create({},{units:{get:function(){return s},set:function(t){s=t}},width:{get:function(){return n},set:function(t){n=t}},height:{get:function(){return r},set:function(t){r=t}},format:{get:function(){return c},set:function(t){c=t}},linkTitle:{get:function(){return h},set:function(t){h=t}},nodeWidth:{get:function(){return a},set:function(t){a=t}},nodePadding:{get:function(){return o},set:function(t){o=t}},center:{get:function(){return l},set:function(t){l=t}},margin:{get:function(){return t},set:function(e){t.top=void 0!==e.top?e.top:t.top,t.right=void 0!==e.right?e.right:t.right,t.bottom=void 0!==e.bottom?e.bottom:t.bottom,t.left=void 0!==e.left?e.left:t.left}},nodeStyle:{get:function(){return{}},set:function(t){f=void 0!==t.fillColor?t.fillColor:f,m=void 0!==t.strokeColor?t.strokeColor:m,p=void 0!==t.title?t.title:p}}}),i.utils.initOptions(v),v},i.models.scatter=function(){"use strict";var t,e,n,r,a,o,s,l,u={top:0,right:0,bottom:0,left:0},c=null,d=null,h=i.utils.defaultColor(),f=null,m=Math.floor(1e5*Math.random()),p=null,g=d3.scale.linear(),v=d3.scale.linear(),_=d3.scale.linear(),y=function(t){return t.x},b=function(t){return t.y},M=function(t){return t.size||1},x=function(t){return t.shape||"circle"},w=[],k=[],L=[],S=!0,T=function(t){return!t.notActive},Y=!1,D=.1,C=!1,E=!0,A=!1,O=function(){return 25},j=null,N=null,H=null,V=null,P=null,F=null,I=!1,R=d3.dispatch("elementClick","elementDblClick","elementMouseover","elementMouseout","renderEnd"),W=!0,z=250,B=300,U=!1,G=!1,$=i.utils.renderWatch(R,z),q=[16,256],J={};function X(t){var e;e=t[0].series+":"+t[1],delete J[e]}function Z(t){var e,n,i,r=function(t){var e;return e=t[0].series+":"+t[1],J[e]=J[e]||{}}(t),a=!1;for(e=1;e<arguments.length;e+=2)n=arguments[e],i=arguments[e+1](t[0],t[1]),r[n]===i&&r.hasOwnProperty(n)||(r[n]=i,a=!0);return a}function K(z){return $.reset(),z.each(function(z){p=d3.select(this);var J=i.utils.availableWidth(c,p,u),Q=i.utils.availableHeight(d,p,u);i.utils.initSVG(p),z.forEach(function(t,e){t.values.forEach(function(t){t.series=e})});var tt="function"==typeof K.yScale().base,et=j&&N&&P?[]:d3.merge(z.map(function(t){return t.values.map(function(t,e){return{x:y(t,e),y:b(t,e),size:M(t,e)}})}));if(g.domain(j||d3.extent(et.map(function(t){return t.x}).concat(w))),Y&&z[0]?g.range(H||[(J*D+J)/(2*z[0].values.length),J-J*(1+D)/(2*z[0].values.length)]):g.range(H||[0,J]),tt){var nt=d3.min(et.map(function(t){if(0!==t.y)return t.y}));v.clamp(!0).domain(N||d3.extent(et.map(function(t){return 0!==t.y?t.y:.1*nt}).concat(k))).range(V||[Q,0])}else v.domain(N||d3.extent(et.map(function(t){return t.y}).concat(k))).range(V||[Q,0]);_.domain(P||d3.extent(et.map(function(t){return t.size}).concat(L))).range(F||q),I=g.domain()[0]===g.domain()[1]||v.domain()[0]===v.domain()[1],g.domain()[0]===g.domain()[1]&&(g.domain()[0]?g.domain([g.domain()[0]-.01*g.domain()[0],g.domain()[1]+.01*g.domain()[1]]):g.domain([-1,1])),v.domain()[0]===v.domain()[1]&&(v.domain()[0]?v.domain([v.domain()[0]-.01*v.domain()[0],v.domain()[1]+.01*v.domain()[1]]):v.domain([-1,1])),isNaN(g.domain()[0])&&g.domain([-1,1]),isNaN(v.domain()[0])&&v.domain([-1,1]),t=t||g,e=e||v,n=n||_;var it=g(1)!==t(1)||v(1)!==e(1)||_(1)!==n(1);o=o||c,s=s||d;var rt=o!==c||s!==d,at=(r=r||[])[0]!==g.domain()[0]||r[1]!==g.domain()[1];r=g.domain(),a=a||[],at=at||a[0]!==v.domain()[0]||a[1]!==v.domain()[1],a=v.domain();var ot=p.selectAll("g.nv-wrap.nv-scatter").data([z]),st=ot.enter().append("g").attr("class","nvd3 nv-wrap nv-scatter nv-chart-"+m),lt=st.append("defs"),ut=st.append("g"),ct=ot.select("g");function dt(){if(G=!1,!S)return!1;if(p.selectAll(".nv-point.hover").classed("hover",!1),ot.select(".nv-point-paths").selectAll("path").remove(),!0===W){var t=d3.merge(z.map(function(t,e){return t.values.map(function(t,n){var r=y(t,n),a=b(t,n);return[i.utils.NaNtoZero(g(r))+1e-4*Math.random(),i.utils.NaNtoZero(v(a))+1e-4*Math.random(),e,n,t]}).filter(function(t,e){return T(t[4],e)})}));if(0==t.length)return!1;t.length<3&&(t.push([g.range()[0]-20,v.range()[0]-20,null,null]),t.push([g.range()[1]+20,v.range()[1]+20,null,null]),t.push([g.range()[0]-20,v.range()[0]+20,null,null]),t.push([g.range()[1]+20,v.range()[1]-20,null,null]));var e=d3.geom.polygon([[-10,-10],[-10,d+10],[c+10,d+10],[c+10,-10]]);t=t.sort(function(t,e){return t[0]-e[0]||t[1]-e[1]});for(var n=0;n<t.length-1;)Math.abs(t[n][0]-t[n+1][0])<1e-4&&Math.abs(t[n][1]-t[n+1][1])<1e-4?t.splice(n+1,1):n++;var r=d3.geom.voronoi(t).map(function(n,i){return 0===n.length?null:{data:e.clip(n),series:t[i][2],point:t[i][3]}}),a=ot.select(".nv-point-paths").selectAll("path").data(r),o=a.enter().append("svg:path").attr("d",function(t){return t&&t.data&&0!==t.data.length?"M"+t.data.join(",")+"Z":"M 0 0"}).attr("id",function(t,e){return"nv-path-"+e}).attr("clip-path",function(t,e){return"url(#nv-clip-"+m+"-"+e+")"});if(A&&o.style("fill",d3.rgb(230,230,230)).style("fill-opacity",.4).style("stroke-opacity",1).style("stroke",d3.rgb(200,200,200)),E){ot.select(".nv-point-clips").selectAll("*").remove();ot.select(".nv-point-clips").selectAll("clipPath").data(t).enter().append("svg:clipPath").attr("id",function(t,e){return"nv-clip-"+m+"-"+e}).append("svg:circle").attr("cx",function(t){return t[0]}).attr("cy",function(t){return t[1]}).attr("r",O)}var s=function(t,e,n){if(G)return 0;var i=z[e.series];if(void 0!==i){var r=i.values[e.point];r.color=h(i,e.series),r.x=y(r),r.y=b(r);var a=p.node().getBoundingClientRect(),o=window.pageYOffset||document.documentElement.scrollTop,s=window.pageXOffset||document.documentElement.scrollLeft;n({point:r,series:i,pos:{left:g(y(r,e.point))+a.left+s+u.left+10,top:v(b(r,e.point))+a.top+o+u.top+10},relativePos:[g(y(r,e.point))+u.left,v(b(r,e.point))+u.top],seriesIndex:e.series,pointIndex:e.point,event:d3.event,element:t})}};a.on("click",function(t){s(this,t,R.elementClick)}).on("dblclick",function(t){s(this,t,R.elementDblClick)}).on("mouseover",function(t){s(this,t,R.elementMouseover)}).on("mouseout",function(t,e){s(this,t,R.elementMouseout)})}else ot.select(".nv-groups").selectAll(".nv-group").selectAll(".nv-point").on("click",function(t,e){if(G||!z[t[0].series])return 0;var n=z[t[0].series],i=n.values[e];R.elementClick({point:i,series:n,pos:[g(y(i,e))+u.left,v(b(i,e))+u.top],relativePos:[g(y(i,e))+u.left,v(b(i,e))+u.top],seriesIndex:t[0].series,pointIndex:e,event:d3.event,element:this})}).on("dblclick",function(t,e){if(G||!z[t[0].series])return 0;var n=z[t[0].series],i=n.values[e];R.elementDblClick({point:i,series:n,pos:[g(y(i,e))+u.left,v(b(i,e))+u.top],relativePos:[g(y(i,e))+u.left,v(b(i,e))+u.top],seriesIndex:t[0].series,pointIndex:e})}).on("mouseover",function(t,e){if(G||!z[t[0].series])return 0;var n=z[t[0].series],i=n.values[e];R.elementMouseover({point:i,series:n,pos:[g(y(i,e))+u.left,v(b(i,e))+u.top],relativePos:[g(y(i,e))+u.left,v(b(i,e))+u.top],seriesIndex:t[0].series,pointIndex:e,color:h(t[0],e)})}).on("mouseout",function(t,e){if(G||!z[t[0].series])return 0;var n=z[t[0].series],i=n.values[e];R.elementMouseout({point:i,series:n,pos:[g(y(i,e))+u.left,v(b(i,e))+u.top],relativePos:[g(y(i,e))+u.left,v(b(i,e))+u.top],seriesIndex:t[0].series,pointIndex:e,color:h(t[0],e)})})}ot.classed("nv-single-point",I),ut.append("g").attr("class","nv-groups"),ut.append("g").attr("class","nv-point-paths"),st.append("g").attr("class","nv-point-clips"),ot.attr("transform","translate("+u.left+","+u.top+")"),lt.append("clipPath").attr("id","nv-edge-clip-"+m).append("rect").attr("transform","translate( -10, -10)"),ot.select("#nv-edge-clip-"+m+" rect").attr("width",J+20).attr("height",Q>0?Q+20:0),ct.attr("clip-path",C?"url(#nv-edge-clip-"+m+")":""),G=!0;var ht=ot.select(".nv-groups").selectAll(".nv-group").data(function(t){return t},function(t){return t.key});ht.enter().append("g").style("stroke-opacity",1e-6).style("fill-opacity",1e-6),ht.exit().remove(),ht.attr("class",function(t,e){return(t.classed||"")+" nv-group nv-series-"+e}).classed("nv-noninteractive",!S).classed("hover",function(t){return t.hover}),ht.watchTransition($,"scatter: groups").style("fill",function(t,e){return h(t,e)}).style("stroke",function(t,e){return t.pointBorderColor||f||h(t,e)}).style("stroke-opacity",1).style("fill-opacity",.5);var ft=ht.selectAll("path.nv-point").data(function(t){return t.values.map(function(t,e){return[t,e]}).filter(function(t,e){return T(t[0],e)})});if(ft.enter().append("path").attr("class",function(t){return"nv-point nv-point-"+t[1]}).style("fill",function(t){return t.color}).style("stroke",function(t){return t.color}).attr("transform",function(n){return"translate("+i.utils.NaNtoZero(t(y(n[0],n[1])))+","+i.utils.NaNtoZero(e(b(n[0],n[1])))+")"}).attr("d",i.utils.symbol().type(function(t){return x(t[0])}).size(function(t){return _(M(t[0],t[1]))})),ft.exit().each(X).remove(),ht.exit().selectAll("path.nv-point").watchTransition($,"scatter exit").attr("transform",function(t){return"translate("+i.utils.NaNtoZero(g(y(t[0],t[1])))+","+i.utils.NaNtoZero(v(b(t[0],t[1])))+")"}).remove(),ft.filter(function(t){return Z(t,"x",y,"y",b)||it||rt||at}).watchTransition($,"scatter points").attr("transform",function(t){return"translate("+i.utils.NaNtoZero(g(y(t[0],t[1])))+","+i.utils.NaNtoZero(v(b(t[0],t[1])))+")"}),ft.filter(function(t){return Z(t,"shape",x,"size",M)||it||rt||at}).watchTransition($,"scatter points").attr("d",i.utils.symbol().type(function(t){return x(t[0])}).size(function(t){return _(M(t[0],t[1]))})),U){var mt=ht.selectAll(".nv-label").data(function(t){return t.values.map(function(t,e){return[t,e]}).filter(function(t,e){return T(t[0],e)})});mt.enter().append("text").style("fill",function(t,e){return t.color}).style("stroke-opacity",0).style("fill-opacity",1).attr("transform",function(n){return"translate("+(i.utils.NaNtoZero(t(y(n[0],n[1])))+Math.sqrt(_(M(n[0],n[1]))/Math.PI)+2)+","+i.utils.NaNtoZero(e(b(n[0],n[1])))+")"}).text(function(t,e){return t[0].label}),mt.exit().remove(),ht.exit().selectAll("path.nv-label").watchTransition($,"scatter exit").attr("transform",function(t){return"translate("+(i.utils.NaNtoZero(g(y(t[0],t[1])))+Math.sqrt(_(M(t[0],t[1]))/Math.PI)+2)+","+i.utils.NaNtoZero(v(b(t[0],t[1])))+")"}).remove(),mt.each(function(t){d3.select(this).classed("nv-label",!0).classed("nv-label-"+t[1],!1).classed("hover",!1)}),mt.watchTransition($,"scatter labels").text(function(t,e){return t[0].label}).attr("transform",function(t){return"translate("+(i.utils.NaNtoZero(g(y(t[0],t[1])))+Math.sqrt(_(M(t[0],t[1]))/Math.PI)+2)+","+i.utils.NaNtoZero(v(b(t[0],t[1])))+")"})}B?(clearTimeout(l),l=setTimeout(dt,B)):dt(),t=g.copy(),e=v.copy(),n=_.copy(),o=c,s=d}),$.renderEnd("scatter immediate"),K}return K.dispatch=R,K.options=i.utils.optionsFunc.bind(K),K._calls=new function(){this.clearHighlights=function(){return i.dom.write(function(){p.selectAll(".nv-point.hover").classed("hover",!1)}),null},this.highlightPoint=function(t,e,n){i.dom.write(function(){p.select(".nv-groups").selectAll(".nv-series-"+t).selectAll(".nv-point-"+e).classed("hover",n)})}},R.on("elementMouseover.point",function(t){S&&K._calls.highlightPoint(t.seriesIndex,t.pointIndex,!0)}),R.on("elementMouseout.point",function(t){S&&K._calls.highlightPoint(t.seriesIndex,t.pointIndex,!1)}),K._options=Object.create({},{width:{get:function(){return c},set:function(t){c=t}},height:{get:function(){return d},set:function(t){d=t}},xScale:{get:function(){return g},set:function(t){g=t}},yScale:{get:function(){return v},set:function(t){v=t}},pointScale:{get:function(){return _},set:function(t){_=t}},xDomain:{get:function(){return j},set:function(t){j=t}},yDomain:{get:function(){return N},set:function(t){N=t}},pointDomain:{get:function(){return P},set:function(t){P=t}},xRange:{get:function(){return H},set:function(t){H=t}},yRange:{get:function(){return V},set:function(t){V=t}},pointRange:{get:function(){return F},set:function(t){F=t}},forceX:{get:function(){return w},set:function(t){w=t}},forceY:{get:function(){return k},set:function(t){k=t}},forcePoint:{get:function(){return L},set:function(t){L=t}},interactive:{get:function(){return S},set:function(t){S=t}},pointActive:{get:function(){return T},set:function(t){T=t}},padDataOuter:{get:function(){return D},set:function(t){D=t}},padData:{get:function(){return Y},set:function(t){Y=t}},clipEdge:{get:function(){return C},set:function(t){C=t}},clipVoronoi:{get:function(){return E},set:function(t){E=t}},clipRadius:{get:function(){return O},set:function(t){O=t}},showVoronoi:{get:function(){return A},set:function(t){A=t}},id:{get:function(){return m},set:function(t){m=t}},interactiveUpdateDelay:{get:function(){return B},set:function(t){B=t}},showLabels:{get:function(){return U},set:function(t){U=t}},pointBorderColor:{get:function(){return f},set:function(t){f=t}},x:{get:function(){return y},set:function(t){y=d3.functor(t)}},y:{get:function(){return b},set:function(t){b=d3.functor(t)}},pointSize:{get:function(){return M},set:function(t){M=d3.functor(t)}},pointShape:{get:function(){return x},set:function(t){x=d3.functor(t)}},margin:{get:function(){return u},set:function(t){u.top=void 0!==t.top?t.top:u.top,u.right=void 0!==t.right?t.right:u.right,u.bottom=void 0!==t.bottom?t.bottom:u.bottom,u.left=void 0!==t.left?t.left:u.left}},duration:{get:function(){return z},set:function(t){z=t,$.reset(z)}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t)}},useVoronoi:{get:function(){return W},set:function(t){!1===(W=t)&&(E=!1)}}}),i.utils.initOptions(K),K},i.models.scatterChart=function(){"use strict";var t=i.models.scatter(),e=i.models.axis(),n=i.models.axis(),r=i.models.legend(),a=i.models.distribution(),o=i.models.distribution(),s=i.models.tooltip(),l={top:30,right:20,bottom:50,left:75},u=null,c=null,d=null,h=null,f=i.utils.defaultColor(),m=t.xScale(),p=t.yScale(),g=!1,v=!1,_=!0,y=!0,b=!0,M=!1,x=i.utils.state(),w=null,k=d3.dispatch("stateChange","changeState","renderEnd"),L=null,S=250,T=!1;t.xScale(m).yScale(p),e.orient("bottom").tickPadding(10),n.orient(M?"right":"left").tickPadding(10),a.axis("x"),o.axis("y"),s.headerFormatter(function(t,n){return e.tickFormat()(t,n)}).valueFormatter(function(t,e){return n.tickFormat()(t,e)});var Y=i.utils.renderWatch(k,S),D=function(t){return function(){return{active:t.map(function(t){return!t.disabled})}}},C=function(t){return function(e){void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}};function E(L){return Y.reset(),Y.models(t),y&&Y.models(e),b&&Y.models(n),g&&Y.models(a),v&&Y.models(o),L.each(function(L){h=d3.select(this),i.utils.initSVG(h);var A,O=i.utils.availableWidth(c,h,l),j=i.utils.availableHeight(d,h,l);if(E.update=function(){0===S?h.call(E):h.transition().duration(S).call(E)},E.container=this,x.setter(C(L),E.update).getter(D(L)).update(),x.disabled=L.map(function(t){return!!t.disabled}),!w)for(A in w={},x)x[A]instanceof Array?w[A]=x[A].slice(0):w[A]=x[A];if(!(L&&L.length&&L.filter(function(t){return t.values.length}).length))return i.utils.noData(E,h),Y.renderEnd("scatter immediate"),E;h.selectAll(".nv-noData").remove(),m=t.xScale(),p=t.yScale();var N=h.selectAll("g.nv-wrap.nv-scatterChart").data([L]),H=N.enter().append("g").attr("class","nvd3 nv-wrap nv-scatterChart nv-chart-"+t.id()).append("g"),V=N.select("g");if(H.append("rect").attr("class","nvd3 nv-background").style("pointer-events","none"),H.append("g").attr("class","nv-x nv-axis"),H.append("g").attr("class","nv-y nv-axis"),H.append("g").attr("class","nv-scatterWrap"),H.append("g").attr("class","nv-regressionLinesWrap"),H.append("g").attr("class","nv-distWrap"),H.append("g").attr("class","nv-legendWrap"),M&&V.select(".nv-y.nv-axis").attr("transform","translate("+O+",0)"),_){var P=O;r.width(P),N.select(".nv-legendWrap").datum(L).call(r),u||r.height()===l.top||(l.top=r.height(),j=i.utils.availableHeight(d,h,l)),N.select(".nv-legendWrap").attr("transform","translate(0,"+-l.top+")")}else V.select(".nv-legendWrap").selectAll("*").remove();N.attr("transform","translate("+l.left+","+l.top+")"),t.width(O).height(j).color(L.map(function(t,e){return t.color=t.color||f(t,e),t.color}).filter(function(t,e){return!L[e].disabled})).showLabels(T),N.select(".nv-scatterWrap").datum(L.filter(function(t){return!t.disabled})).call(t),N.select(".nv-regressionLinesWrap").attr("clip-path","url(#nv-edge-clip-"+t.id()+")");var F=N.select(".nv-regressionLinesWrap").selectAll(".nv-regLines").data(function(t){return t});F.enter().append("g").attr("class","nv-regLines");var I=F.selectAll(".nv-regLine").data(function(t){return[t]});I.enter().append("line").attr("class","nv-regLine").style("stroke-opacity",0),I.filter(function(t){return t.intercept&&t.slope}).watchTransition(Y,"scatterPlusLineChart: regline").attr("x1",m.range()[0]).attr("x2",m.range()[1]).attr("y1",function(t,e){return p(m.domain()[0]*t.slope+t.intercept)}).attr("y2",function(t,e){return p(m.domain()[1]*t.slope+t.intercept)}).style("stroke",function(t,e,n){return f(t,n)}).style("stroke-opacity",function(t,e){return t.disabled||void 0===t.slope||void 0===t.intercept?0:1}),y&&(e.scale(m)._ticks(i.utils.calcTicksX(O/100,L)).tickSize(-j,0),V.select(".nv-x.nv-axis").attr("transform","translate(0,"+p.range()[0]+")").call(e)),b&&(n.scale(p)._ticks(i.utils.calcTicksY(j/36,L)).tickSize(-O,0),V.select(".nv-y.nv-axis").call(n)),a.getData(t.x()).scale(m).width(O).color(L.map(function(t,e){return t.color||f(t,e)}).filter(function(t,e){return!L[e].disabled})),H.select(".nv-distWrap").append("g").attr("class","nv-distributionX"),V.select(".nv-distributionX").attr("transform","translate(0,"+p.range()[0]+")").datum(L.filter(function(t){return!t.disabled})).call(a).style("opacity",function(){return g?"1":"1e-6"}).watchTransition(Y,"scatterPlusLineChart").style("opacity",function(){return g?"1":"1e-6"}),o.getData(t.y()).scale(p).width(j).color(L.map(function(t,e){return t.color||f(t,e)}).filter(function(t,e){return!L[e].disabled})),H.select(".nv-distWrap").append("g").attr("class","nv-distributionY"),V.select(".nv-distributionY").attr("transform","translate("+(M?O:-o.size())+",0)").datum(L.filter(function(t){return!t.disabled})).call(o).style("opacity",function(){return v?"1":"1e-6"}).watchTransition(Y,"scatterPlusLineChart").style("opacity",function(){return v?"1":"1e-6"}),r.dispatch.on("stateChange",function(t){for(var e in t)x[e]=t[e];k.stateChange(x),E.update()}),k.on("changeState",function(t){void 0!==t.disabled&&(L.forEach(function(e,n){e.disabled=t.disabled[n]}),x.disabled=t.disabled),E.update()}),t.dispatch.on("elementMouseout.tooltip",function(e){s.hidden(!0),h.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-distx-"+e.pointIndex).attr("y1",0),h.select(".nv-chart-"+t.id()+" .nv-series-"+e.seriesIndex+" .nv-disty-"+e.pointIndex).attr("x2",o.size())}),t.dispatch.on("elementMouseover.tooltip",function(t){h.select(".nv-series-"+t.seriesIndex+" .nv-distx-"+t.pointIndex).attr("y1",t.relativePos[1]-j),h.select(".nv-series-"+t.seriesIndex+" .nv-disty-"+t.pointIndex).attr("x2",t.relativePos[0]+a.size()),s.data(t).hidden(!1)}),m.copy(),p.copy()}),Y.renderEnd("scatter with line immediate"),E}return E.dispatch=k,E.scatter=t,E.legend=r,E.xAxis=e,E.yAxis=n,E.distX=a,E.distY=o,E.tooltip=s,E.options=i.utils.optionsFunc.bind(E),E._options=Object.create({},{width:{get:function(){return c},set:function(t){c=t}},height:{get:function(){return d},set:function(t){d=t}},container:{get:function(){return h},set:function(t){h=t}},showDistX:{get:function(){return g},set:function(t){g=t}},showDistY:{get:function(){return v},set:function(t){v=t}},showLegend:{get:function(){return _},set:function(t){_=t}},showXAxis:{get:function(){return y},set:function(t){y=t}},showYAxis:{get:function(){return b},set:function(t){b=t}},defaultState:{get:function(){return w},set:function(t){w=t}},noData:{get:function(){return L},set:function(t){L=t}},duration:{get:function(){return S},set:function(t){S=t}},showLabels:{get:function(){return T},set:function(t){T=t}},margin:{get:function(){return l},set:function(t){void 0!==t.top&&(l.top=t.top,u=t.top),l.right=void 0!==t.right?t.right:l.right,l.bottom=void 0!==t.bottom?t.bottom:l.bottom,l.left=void 0!==t.left?t.left:l.left}},rightAlignYAxis:{get:function(){return M},set:function(t){M=t,n.orient(t?"right":"left")}},color:{get:function(){return f},set:function(t){f=i.utils.getColor(t),r.color(f),a.color(f),o.color(f)}}}),i.utils.inheritOptions(E,t),i.utils.initOptions(E),E},i.models.sparkline=function(){"use strict";var t,e,n,r,a={top:2,right:0,bottom:2,left:0},o=400,s=32,l=null,u=!0,c=d3.scale.linear(),d=d3.scale.linear(),h=function(t){return t.x},f=function(t){return t.y},m=i.utils.getColor(["#000"]),p=!0,g=!0,v=d3.dispatch("renderEnd"),_=i.utils.renderWatch(v);function y(u){return _.reset(),u.each(function(u){var v=o-a.left-a.right,_=s-a.top-a.bottom;l=d3.select(this),i.utils.initSVG(l),c.domain(t||d3.extent(u,h)).range(n||[0,v]),d.domain(e||d3.extent(u,f)).range(r||[_,0]);var y=l.selectAll("g.nv-wrap.nv-sparkline").data([u]);y.enter().append("g").attr("class","nvd3 nv-wrap nv-sparkline").append("g"),y.select("g");y.attr("transform","translate("+a.left+","+a.top+")");var b=y.selectAll("path").data(function(t){return[t]});b.enter().append("path"),b.exit().remove(),b.style("stroke",function(t,e){return t.color||m(t,e)}).attr("d",d3.svg.line().x(function(t,e){return c(h(t,e))}).y(function(t,e){return d(f(t,e))}));var M=y.selectAll("circle.nv-point").data(function(t){var e=t.map(function(t,e){return f(t,e)});function n(e){if(-1!=e){var n=t[e];return n.pointIndex=e,n}return null}var i=n(e.lastIndexOf(d.domain()[1])),r=n(e.indexOf(d.domain()[0])),a=n(e.length-1);return[p?r:null,p?i:null,g?a:null].filter(function(t){return null!=t})});M.enter().append("circle"),M.exit().remove(),M.attr("cx",function(t,e){return c(h(t,t.pointIndex))}).attr("cy",function(t,e){return d(f(t,t.pointIndex))}).attr("r",2).attr("class",function(t,e){return h(t,t.pointIndex)==c.domain()[1]?"nv-point nv-currentValue":f(t,t.pointIndex)==d.domain()[0]?"nv-point nv-minValue":"nv-point nv-maxValue"})}),_.renderEnd("sparkline immediate"),y}return y.options=i.utils.optionsFunc.bind(y),y._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},xDomain:{get:function(){return t},set:function(e){t=e}},yDomain:{get:function(){return e},set:function(t){e=t}},xRange:{get:function(){return n},set:function(t){n=t}},yRange:{get:function(){return r},set:function(t){r=t}},xScale:{get:function(){return c},set:function(t){c=t}},yScale:{get:function(){return d},set:function(t){d=t}},animate:{get:function(){return u},set:function(t){u=t}},showMinMaxPoints:{get:function(){return p},set:function(t){p=t}},showCurrentPoint:{get:function(){return g},set:function(t){g=t}},x:{get:function(){return h},set:function(t){h=d3.functor(t)}},y:{get:function(){return f},set:function(t){f=d3.functor(t)}},margin:{get:function(){return a},set:function(t){a.top=void 0!==t.top?t.top:a.top,a.right=void 0!==t.right?t.right:a.right,a.bottom=void 0!==t.bottom?t.bottom:a.bottom,a.left=void 0!==t.left?t.left:a.left}},color:{get:function(){return m},set:function(t){m=i.utils.getColor(t)}}}),y.dispatch=v,i.utils.initOptions(y),y},i.models.sparklinePlus=function(){"use strict";var t,e,n=i.models.sparkline(),r={top:15,right:100,bottom:10,left:50},a=null,o=null,s=[],l=!1,u=d3.format(",r"),c=d3.format(",.2f"),d=!0,h=!0,f=!1,m=null,p=d3.dispatch("renderEnd"),g=i.utils.renderWatch(p);function v(m){return g.reset(),g.models(n),m.each(function(m){var p=d3.select(this);i.utils.initSVG(p);var g=i.utils.availableWidth(a,p,r),_=i.utils.availableHeight(o,p,r);if(v.update=function(){p.call(v)},v.container=this,!m||!m.length)return i.utils.noData(v,p),v;p.selectAll(".nv-noData").remove();var y=n.y()(m[m.length-1],m.length-1);t=n.xScale(),e=n.yScale();var b=p.selectAll("g.nv-wrap.nv-sparklineplus").data([m]),M=b.enter().append("g").attr("class","nvd3 nv-wrap nv-sparklineplus").append("g"),x=b.select("g");M.append("g").attr("class","nv-sparklineWrap"),M.append("g").attr("class","nv-valueWrap"),M.append("g").attr("class","nv-hoverArea"),b.attr("transform","translate("+r.left+","+r.top+")");var w=x.select(".nv-sparklineWrap");if(n.width(g).height(_),w.call(n),d){var k=x.select(".nv-valueWrap").selectAll(".nv-currentValue").data([y]);k.enter().append("text").attr("class","nv-currentValue").attr("dx",f?-8:8).attr("dy",".9em").style("text-anchor",f?"end":"start"),k.attr("x",g+(f?r.right:0)).attr("y",h?function(t){return e(t)}:0).style("fill",n.color()(m[m.length-1],m.length-1)).text(c(y))}function L(){if(!l){var e=x.selectAll(".nv-hoverValue").data(s),i=e.enter().append("g").attr("class","nv-hoverValue").style("stroke-opacity",0).style("fill-opacity",0);e.exit().transition().duration(250).style("stroke-opacity",0).style("fill-opacity",0).remove(),e.attr("transform",function(e){return"translate("+t(n.x()(m[e],e))+",0)"}).transition().duration(250).style("stroke-opacity",1).style("fill-opacity",1),s.length&&(i.append("line").attr("x1",0).attr("y1",-r.top).attr("x2",0).attr("y2",_),i.append("text").attr("class","nv-xValue").attr("x",-6).attr("y",-r.top).attr("text-anchor","end").attr("dy",".9em"),x.select(".nv-hoverValue .nv-xValue").text(u(n.x()(m[s[0]],s[0]))),i.append("text").attr("class","nv-yValue").attr("x",6).attr("y",-r.top).attr("text-anchor","start").attr("dy",".9em"),x.select(".nv-hoverValue .nv-yValue").text(c(n.y()(m[s[0]],s[0]))))}}M.select(".nv-hoverArea").append("rect").on("mousemove",function(){if(l)return;var e=d3.mouse(this)[0]-r.left;s=[function(t,e){for(var i=Math.abs(n.x()(t[0],0)-e),r=0,a=0;a<t.length;a++)Math.abs(n.x()(t[a],a)-e)<i&&(i=Math.abs(n.x()(t[a],a)-e),r=a);return r}(m,Math.round(t.invert(e)))],L()}).on("click",function(){l=!l}).on("mouseout",function(){s=[],L()}),x.select(".nv-hoverArea rect").attr("transform",function(t){return"translate("+-r.left+","+-r.top+")"}).attr("width",g+r.left+r.right).attr("height",_+r.top)}),g.renderEnd("sparklinePlus immediate"),v}return v.dispatch=p,v.sparkline=n,v.options=i.utils.optionsFunc.bind(v),v._options=Object.create({},{width:{get:function(){return a},set:function(t){a=t}},height:{get:function(){return o},set:function(t){o=t}},xTickFormat:{get:function(){return u},set:function(t){u=t}},yTickFormat:{get:function(){return c},set:function(t){c=t}},showLastValue:{get:function(){return d},set:function(t){d=t}},alignValue:{get:function(){return h},set:function(t){h=t}},rightAlignValue:{get:function(){return f},set:function(t){f=t}},noData:{get:function(){return m},set:function(t){m=t}},margin:{get:function(){return r},set:function(t){r.top=void 0!==t.top?t.top:r.top,r.right=void 0!==t.right?t.right:r.right,r.bottom=void 0!==t.bottom?t.bottom:r.bottom,r.left=void 0!==t.left?t.left:r.left}}}),i.utils.inheritOptions(v,n),i.utils.initOptions(v),v},i.models.stackedArea=function(){"use strict";var t,e,n={top:0,right:0,bottom:0,left:0},r=960,a=500,o=i.utils.defaultColor(),s=Math.floor(1e5*Math.random()),l=null,u=function(t){return t.x},c=function(t){return t.y},d=function(t,e){return!isNaN(c(t,e))&&null!==c(t,e)},h="stack",f="zero",m="default",p="linear",g=!1,v=i.models.scatter(),_=250,y=function(t,e,n){t.display={y:n,y0:e}},b=function(t){return e(t.display.y+t.display.y0)},M=d3.dispatch("areaClick","areaMouseover","areaMouseout","renderEnd","elementClick","elementMouseover","elementMouseout");v.pointSize(2.2).pointDomain([2.2,2.2]);var x=i.utils.renderWatch(M,_);function w(h){return x.reset(),x.models(v),h.each(function(h){var _=r-n.left-n.right,k=a-n.top-n.bottom;l=d3.select(this),i.utils.initSVG(l),t=v.xScale(),e=v.yScale();var L=h;h.forEach(function(t,e){t.seriesIndex=e,t.values=t.values.map(function(t,n){return t.index=n,t.seriesIndex=e,t})});var S=h.filter(function(t){return!t.disabled});h=d3.layout.stack().order(m).offset(f).values(function(t){return t.values}).x(u).y(c).out(y)(S);var T=l.selectAll("g.nv-wrap.nv-stackedarea").data([h]),Y=T.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedarea"),D=Y.append("defs"),C=Y.append("g"),E=T.select("g");C.append("g").attr("class","nv-areaWrap"),C.append("g").attr("class","nv-scatterWrap"),T.attr("transform","translate("+n.left+","+n.top+")"),0==v.forceY().length&&v.forceY().push(0),v.width(_).height(k).x(u).y(function(t){if(void 0!==t.display)return t.display.y+t.display.y0}).color(h.map(function(t,e){return t.color=t.color||o(t,t.seriesIndex),t.color})),E.select(".nv-scatterWrap").datum(h).call(v),D.append("clipPath").attr("id","nv-edge-clip-"+s).append("rect"),T.select("#nv-edge-clip-"+s+" rect").attr("width",_).attr("height",k),E.attr("clip-path",g?"url(#nv-edge-clip-"+s+")":"");var A=d3.svg.area().defined(d).x(function(e,n){return t(u(e,n))}).y0(function(t){return e(t.display.y0)}).y1(b).interpolate(p),O=d3.svg.area().defined(d).x(function(e,n){return t(u(e,n))}).y0(function(t){return e(t.display.y0)}).y1(function(t){return e(t.display.y0)}),j=E.select(".nv-areaWrap").selectAll("path.nv-area").data(function(t){return t});j.enter().append("path").attr("class",function(t,e){return"nv-area nv-area-"+e}).attr("d",function(t,e){return O(t.values,t.seriesIndex)}).on("mouseover",function(t,e){d3.select(this).classed("hover",!0),M.areaMouseover({point:t,series:t.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t.seriesIndex})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1),M.areaMouseout({point:t,series:t.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t.seriesIndex})}).on("click",function(t,e){d3.select(this).classed("hover",!1),M.areaClick({point:t,series:t.key,pos:[d3.event.pageX,d3.event.pageY],seriesIndex:t.seriesIndex})}),j.exit().remove(),j.style("fill",function(t,e){return t.color||o(t,t.seriesIndex)}).style("stroke",function(t,e){return t.color||o(t,t.seriesIndex)}),j.watchTransition(x,"stackedArea path").attr("d",function(t,e){return A(t.values,e)}),v.dispatch.on("elementMouseover.area",function(t){E.select(".nv-chart-"+s+" .nv-area-"+t.seriesIndex).classed("hover",!0)}),v.dispatch.on("elementMouseout.area",function(t){E.select(".nv-chart-"+s+" .nv-area-"+t.seriesIndex).classed("hover",!1)}),w.d3_stackedOffset_stackPercent=function(t){var e,n,i,r=t.length,a=t[0].length,o=[];for(n=0;n<a;++n){for(e=0,i=0;e<L.length;e++)i+=c(L[e].values[n]);if(i)for(e=0;e<r;e++)t[e][n][1]/=i;else for(e=0;e<r;e++)t[e][n][1]=0}for(n=0;n<a;++n)o[n]=0;return o}}),x.renderEnd("stackedArea immediate"),w}return w.dispatch=M,w.scatter=v,v.dispatch.on("elementClick",function(){M.elementClick.apply(this,arguments)}),v.dispatch.on("elementMouseover",function(){M.elementMouseover.apply(this,arguments)}),v.dispatch.on("elementMouseout",function(){M.elementMouseout.apply(this,arguments)}),w.interpolate=function(t){return arguments.length?(p=t,w):p},w.duration=function(t){return arguments.length?(_=t,x.reset(_),v.duration(_),w):_},w.dispatch=M,w.scatter=v,w.options=i.utils.optionsFunc.bind(w),w._options=Object.create({},{width:{get:function(){return r},set:function(t){r=t}},height:{get:function(){return a},set:function(t){a=t}},defined:{get:function(){return d},set:function(t){d=t}},clipEdge:{get:function(){return g},set:function(t){g=t}},offset:{get:function(){return f},set:function(t){f=t}},order:{get:function(){return m},set:function(t){m=t}},interpolate:{get:function(){return p},set:function(t){p=t}},x:{get:function(){return u},set:function(t){u=d3.functor(t)}},y:{get:function(){return c},set:function(t){c=d3.functor(t)}},areaY1:{get:function(){return b},set:function(t){b=d3.functor(t)}},transformData:{get:function(){return y},set:function(t){y=d3.functor(t)}},margin:{get:function(){return n},set:function(t){n.top=void 0!==t.top?t.top:n.top,n.right=void 0!==t.right?t.right:n.right,n.bottom=void 0!==t.bottom?t.bottom:n.bottom,n.left=void 0!==t.left?t.left:n.left}},color:{get:function(){return o},set:function(t){o=i.utils.getColor(t)}},style:{get:function(){return h},set:function(t){switch(h=t){case"stack":w.offset("zero"),w.order("default");break;case"stream":w.offset("wiggle"),w.order("inside-out");break;case"stream-center":w.offset("silhouette"),w.order("inside-out");break;case"expand":w.offset("expand"),w.order("default");break;case"stack_percent":w.offset(w.d3_stackedOffset_stackPercent),w.order("default")}}},duration:{get:function(){return _},set:function(t){_=t,x.reset(_),v.duration(_)}}}),i.utils.inheritOptions(w,v),i.utils.initOptions(w),w},i.models.stackedAreaChart=function(){"use strict";var t,e,n=i.models.stackedArea(),r=i.models.axis(),a=i.models.axis(),o=i.models.legend(),s=i.models.legend(),l=i.interactiveGuideline(),u=i.models.tooltip(),c=i.models.focus(i.models.stackedArea()),d={top:10,right:25,bottom:50,left:60},h=null,f=null,m=null,p=i.utils.defaultColor(),g=!0,v=!0,_="top",y=!0,b=!0,M=!1,x=!1,w=!1,k=!0,L="TOTAL",S=i.utils.state(),T=null,Y=null,D=d3.dispatch("stateChange","changeState","renderEnd"),C=250,E=["Stacked","Stream","Expanded"],A={},O=250;S.style=n.style(),r.orient("bottom").tickPadding(7),a.orient(M?"right":"left"),u.headerFormatter(function(t,e){return r.tickFormat()(t,e)}).valueFormatter(function(t,e){return a.tickFormat()(t,e)}),l.tooltip.headerFormatter(function(t,e){return r.tickFormat()(t,e)}).valueFormatter(function(t,e){return null==t?"N/A":a.tickFormat()(t,e)});var j=null,N=null;s.updateState(!1);var H=i.utils.renderWatch(D),V=(n.style(),function(t){return function(){return{active:t.map(function(t){return!t.disabled}),style:n.style()}}}),P=function(t){return function(e){void 0!==e.style&&e.style,void 0!==e.active&&t.forEach(function(t,n){t.disabled=!e.active[n]})}},F=d3.format("%");function I(u){return H.reset(),H.models(n),y&&H.models(r),b&&H.models(a),u.each(function(u){var Y=d3.select(this);i.utils.initSVG(Y);var H,R=i.utils.availableWidth(f,Y,d),W=i.utils.availableHeight(m,Y,d)-(x?c.height():0);if(I.update=function(){Y.transition().duration(O).call(I)},I.container=this,S.setter(P(u),I.update).getter(V(u)).update(),S.disabled=u.map(function(t){return!!t.disabled}),!T)for(H in T={},S)S[H]instanceof Array?T[H]=S[H].slice(0):T[H]=S[H];if(!(u&&u.length&&u.filter(function(t){return t.values.length}).length))return i.utils.noData(I,Y),I;Y.selectAll(".nv-noData").remove(),t=n.xScale(),e=n.yScale();var z=Y.selectAll("g.nv-wrap.nv-stackedAreaChart").data([u]),B=z.enter().append("g").attr("class","nvd3 nv-wrap nv-stackedAreaChart").append("g"),U=z.select("g");B.append("g").attr("class","nv-legendWrap"),B.append("g").attr("class","nv-controlsWrap");var G=B.append("g").attr("class","nv-focus");G.append("g").attr("class","nv-background").append("rect"),G.append("g").attr("class","nv-x nv-axis"),G.append("g").attr("class","nv-y nv-axis"),G.append("g").attr("class","nv-stackedWrap"),G.append("g").attr("class","nv-interactive");B.append("g").attr("class","nv-focusWrap");if(v){var $=g&&"top"===_?R-C:R;if(o.width($),U.select(".nv-legendWrap").datum(u).call(o),"bottom"===_){var q=r.height();d.bottom=Math.max(o.height()+q,d.bottom);var J=(W=i.utils.availableHeight(m,Y,d)-(x?c.height():0))+q;U.select(".nv-legendWrap").attr("transform","translate(0,"+J+")")}else"top"===_&&(h||d.top==o.height()||(d.top=o.height(),W=i.utils.availableHeight(m,Y,d)-(x?c.height():0)),U.select(".nv-legendWrap").attr("transform","translate("+(R-$)+","+-d.top+")"))}else U.select(".nv-legendWrap").selectAll("*").remove();if(g){var X=[{key:A.stacked||"Stacked",metaKey:"Stacked",disabled:"stack"!=n.style(),style:"stack"},{key:A.stream||"Stream",metaKey:"Stream",disabled:"stream"!=n.style(),style:"stream"},{key:A.stream_center||"Stream Center",metaKey:"Stream_Center",disabled:"stream_center"!=n.style(),style:"stream-center"},{key:A.expanded||"Expanded",metaKey:"Expanded",disabled:"expand"!=n.style(),style:"expand"},{key:A.stack_percent||"Stack %",metaKey:"Stack_Percent",disabled:"stack_percent"!=n.style(),style:"stack_percent"}];C=E.length/3*260,X=X.filter(function(t){return-1!==E.indexOf(t.metaKey)}),s.width(C).color(["#444","#444","#444"]),U.select(".nv-controlsWrap").datum(X).call(s);var Z=Math.max(s.height(),v&&"top"===_?o.height():0);d.top!=Z&&(d.top=Z,W=i.utils.availableHeight(m,Y,d)-(x?c.height():0)),U.select(".nv-controlsWrap").attr("transform","translate(0,"+-d.top+")")}else U.select(".nv-controlsWrap").selectAll("*").remove();z.attr("transform","translate("+d.left+","+d.top+")"),M&&U.select(".nv-y.nv-axis").attr("transform","translate("+R+",0)"),w&&(l.width(R).height(W).margin({left:d.left,top:d.top}).svgContainer(Y).xScale(t),z.select(".nv-interactive").call(l)),U.select(".nv-focus .nv-background rect").attr("width",R).attr("height",W),n.width(R).height(W).color(u.map(function(t,e){return t.color||p(t,e)}).filter(function(t,e){return!u[e].disabled}));var K,Q=U.select(".nv-focus .nv-stackedWrap").datum(u.filter(function(t){return!t.disabled}));(y&&r.scale(t)._ticks(i.utils.calcTicksX(R/100,u)).tickSize(-W,0),b)&&(K="wiggle"===n.offset()?0:i.utils.calcTicksY(W/36,u),a.scale(e)._ticks(K).tickSize(-R,0));function tt(){y&&U.select(".nv-focus .nv-x.nv-axis").attr("transform","translate(0,"+W+")").transition().duration(O).call(r)}function et(){if(b){if("expand"===n.style()||"stack_percent"===n.style()){var t=a.tickFormat();j&&t===F||(j=t),a.tickFormat(F)}else j&&(a.tickFormat(j),j=null);U.select(".nv-focus .nv-y.nv-axis").transition().duration(0).call(a)}}if(x){c.width(R),U.select(".nv-focusWrap").attr("transform","translate(0,"+(W+d.bottom+c.margin().top)+")").datum(u.filter(function(t){return!t.disabled})).call(c);var nt=c.brush.empty()?c.xDomain():c.brush.extent();null!==nt&&it(nt)}else Q.transition().call(n),tt(),et();function it(t){U.select(".nv-focus .nv-stackedWrap").datum(u.filter(function(t){return!t.disabled}).map(function(e,i){return{key:e.key,area:e.area,classed:e.classed,values:e.values.filter(function(e,i){return n.x()(e,i)>=t[0]&&n.x()(e,i)<=t[1]}),disableTooltip:e.disableTooltip}})).transition().duration(O).call(n),tt(),et()}n.dispatch.on("areaClick.toggle",function(t){1===u.filter(function(t){return!t.disabled}).length?u.forEach(function(t){t.disabled=!1}):u.forEach(function(e,n){e.disabled=n!=t.seriesIndex}),S.disabled=u.map(function(t){return!!t.disabled}),D.stateChange(S),I.update()}),o.dispatch.on("stateChange",function(t){for(var e in t)S[e]=t[e];D.stateChange(S),I.update()}),s.dispatch.on("legendClick",function(t,e){t.disabled&&(X=X.map(function(t){return t.disabled=!0,t}),t.disabled=!1,n.style(t.style),S.style=n.style(),D.stateChange(S),I.update())}),l.dispatch.on("elementMousemove",function(t){n.clearHighlights();var e,r,a,o=[],s=0,c=!0,d=!1;if(u.filter(function(t,e){return t.seriesIndex=e,!t.disabled}).forEach(function(l,h){r=i.interactiveBisect(l.values,t.pointXValue,I.x());var f=l.values[r],m=I.y()(f,r);if(null!=m&&m>0&&(n.highlightPoint(h,r,!0),d=!0),h!==u.length-1||d||n.highlightPoint(h,r,!0),void 0!==f){void 0===e&&(e=f),void 0===a&&(a=I.xScale()(I.x()(f,r)));var g="expand"==n.style()?f.display.y:I.y()(f,r);o.push({key:l.key,value:g,color:p(l,l.seriesIndex),point:f}),k&&"expand"!=n.style()&&null!=g&&(s+=g,c=!1)}}),o.reverse(),o.length>2){var h=I.yScale().invert(t.mouseY),f=null;o.forEach(function(t,e){h=Math.abs(h);var n=Math.abs(t.point.display.y0),i=Math.abs(t.point.display.y);h>=n&&h<=i+n&&(f=e)}),null!=f&&(o[f].highlight=!0)}k&&"expand"!=n.style()&&o.length>=2&&!c&&o.push({key:L,value:s,total:!0});var m=I.x()(e,r),g=l.tooltip.valueFormatter();"expand"===n.style()||"stack_percent"===n.style()?(N||(N=g),g=d3.format(".1%")):N&&(g=N,N=null),l.tooltip.valueFormatter(g).data({value:m,series:o})(),l.renderGuideLine(a)}),l.dispatch.on("elementMouseout",function(t){n.clearHighlights()}),c.dispatch.on("onBrush",function(t){it(t)}),D.on("changeState",function(t){void 0!==t.disabled&&u.length===t.disabled.length&&(u.forEach(function(e,n){e.disabled=t.disabled[n]}),S.disabled=t.disabled),void 0!==t.style&&(n.style(t.style),t.style),I.update()})}),H.renderEnd("stacked Area chart immediate"),I}return n.dispatch.on("elementMouseover.tooltip",function(t){t.point.x=n.x()(t.point),t.point.y=n.y()(t.point),u.data(t).hidden(!1)}),n.dispatch.on("elementMouseout.tooltip",function(t){u.hidden(!0)}),I.dispatch=D,I.stacked=n,I.legend=o,I.controls=s,I.xAxis=r,I.x2Axis=c.xAxis,I.yAxis=a,I.y2Axis=c.yAxis,I.interactiveLayer=l,I.tooltip=u,I.focus=c,I.dispatch=D,I.options=i.utils.optionsFunc.bind(I),I._options=Object.create({},{width:{get:function(){return f},set:function(t){f=t}},height:{get:function(){return m},set:function(t){m=t}},showLegend:{get:function(){return v},set:function(t){v=t}},legendPosition:{get:function(){return _},set:function(t){_=t}},showXAxis:{get:function(){return y},set:function(t){y=t}},showYAxis:{get:function(){return b},set:function(t){b=t}},defaultState:{get:function(){return T},set:function(t){T=t}},noData:{get:function(){return Y},set:function(t){Y=t}},showControls:{get:function(){return g},set:function(t){g=t}},controlLabels:{get:function(){return A},set:function(t){A=t}},controlOptions:{get:function(){return E},set:function(t){E=t}},showTotalInTooltip:{get:function(){return k},set:function(t){k=t}},totalLabel:{get:function(){return L},set:function(t){L=t}},focusEnable:{get:function(){return x},set:function(t){x=t}},focusHeight:{get:function(){return c.height()},set:function(t){c.height(t)}},brushExtent:{get:function(){return c.brushExtent()},set:function(t){c.brushExtent(t)}},margin:{get:function(){return d},set:function(t){void 0!==t.top&&(d.top=t.top,h=t.top),d.right=void 0!==t.right?t.right:d.right,d.bottom=void 0!==t.bottom?t.bottom:d.bottom,d.left=void 0!==t.left?t.left:d.left}},focusMargin:{get:function(){return c.margin},set:function(t){c.margin.top=void 0!==t.top?t.top:c.margin.top,c.margin.right=void 0!==t.right?t.right:c.margin.right,c.margin.bottom=void 0!==t.bottom?t.bottom:c.margin.bottom,c.margin.left=void 0!==t.left?t.left:c.margin.left}},duration:{get:function(){return O},set:function(t){O=t,H.reset(O),n.duration(O),r.duration(O),a.duration(O)}},color:{get:function(){return p},set:function(t){p=i.utils.getColor(t),o.color(p),n.color(p),c.color(p)}},x:{get:function(){return n.x()},set:function(t){n.x(t),c.x(t)}},y:{get:function(){return n.y()},set:function(t){n.y(t),c.y(t)}},rightAlignYAxis:{get:function(){return M},set:function(t){M=t,a.orient(M?"right":"left")}},useInteractiveGuideline:{get:function(){return w},set:function(t){w=!!t,I.interactive(!t),I.useVoronoi(!t),n.scatter.interactive(!t)}}}),i.utils.inheritOptions(I,n),i.utils.initOptions(I),I},i.models.stackedAreaWithFocusChart=function(){return i.models.stackedAreaChart().margin({bottom:30}).focusEnable(!0)},i.models.sunburst=function(){"use strict";var t,e,n,r,a={top:0,right:0,bottom:0,left:0},o=600,s=600,l="count",u={count:function(t){return 1},value:function(t){return t.value||t.size},size:function(t){return t.value||t.size}},c=Math.floor(1e4*Math.random()),d=null,h=i.utils.defaultColor(),f=!1,m=function(t){return"count"===l?t.name+" #"+t.value:t.name+" "+(t.value||t.size)},p=.02,g=function(t,e){return t.name>e.name},v=function(t,e){return void 0!==t.parent?t.name+"-"+t.parent.name+"-"+e:t.name},_=!0,y=500,b=d3.dispatch("chartClick","elementClick","elementDblClick","elementMousemove","elementMouseover","elementMouseout","renderEnd"),M=d3.scale.linear().range([0,2*Math.PI]),x=d3.scale.sqrt(),w=d3.layout.partition().sort(g),k={},L=d3.svg.arc().startAngle(function(t){return Math.max(0,Math.min(2*Math.PI,M(t.x)))}).endAngle(function(t){return Math.max(0,Math.min(2*Math.PI,M(t.x+t.dx)))}).innerRadius(function(t){return Math.max(0,x(t.y))}).outerRadius(function(t){return Math.max(0,x(t.y+t.dy))});function S(t){return T(t)>90?180:0}function T(t){return(Math.max(0,Math.min(2*Math.PI,M(t.x)))+Math.max(0,Math.min(2*Math.PI,M(t.x+t.dx))))/2*(180/Math.PI)-90}function Y(t){var e=Math.max(0,Math.min(2*Math.PI,M(t.x)));return Math.max(0,Math.min(2*Math.PI,M(t.x+t.dx)))-e>p}function D(e,n){var i=d3.interpolate(M.domain(),[t.x,t.x+t.dx]),a=d3.interpolate(x.domain(),[t.y,1]),o=d3.interpolate(x.range(),[t.y?20:0,r]);return 0===n?function(){return L(e)}:function(t){return M.domain(i(t)),x.domain(a(t)).range(o(t)),L(e)}}function C(t){var e=d3.interpolate({x:t.x0,dx:t.dx0,y:t.y0,dy:t.dy0},t);return function(n){var i=e(n);return t.x0=i.x,t.dx0=i.dx,t.y0=i.y,t.dy0=i.dy,L(i)}}function E(t){t.forEach(function(t){var e=v(t),n=k[e];n?(t.dx0=n.dx,t.x0=n.x,t.dy0=n.dy,t.y0=n.y):(t.dx0=t.dx,t.x0=t.x,t.dy0=t.dy,t.y0=t.y),function(t){var e=v(t);k[e]||(k[e]={});var n=k[e];n.dx=t.dx,n.x=t.x,n.dy=t.dy,n.y=t.y}(t)})}function A(e){var n=d.selectAll("text"),i=d.selectAll("path");n.transition().attr("opacity",0),t=e,i.transition().duration(y).attrTween("d",D).each("end",function(t){t.x>=e.x&&t.x<e.x+e.dx&&(t.depth>=e.depth&&d3.select(this.parentNode).select("text").transition().duration(y).text(function(t){return m(t)}).attr("opacity",function(t){return Y(t)?1:0}).attr("transform",function(){var n=this.getBBox().width;if(0===t.depth)return"translate("+n/2*-1+",0)";if(t.depth===e.depth)return"translate("+(x(t.y)+5)+",0)";var i=T(t),r=S(t);return 0===r?"rotate("+i+")translate("+(x(t.y)+5)+",0)":"rotate("+i+")translate("+(x(t.y)+n+5)+",0)rotate("+r+")"}))})}var O=i.utils.renderWatch(b);function j(t){return O.reset(),t.each(function(t){d=d3.select(this),e=i.utils.availableWidth(o,d,a),n=i.utils.availableHeight(s,d,a),r=Math.min(e,n)/2,x.range([0,r]);var p=d.select("g.nvd3.nv-wrap.nv-sunburst");p[0][0]?p.attr("transform","translate("+(e/2+a.left+a.right)+","+(n/2+a.top+a.bottom)+")"):p=d.append("g").attr("class","nvd3 nv-wrap nv-sunburst nv-chart-"+c).attr("transform","translate("+(e/2+a.left+a.right)+","+(n/2+a.top+a.bottom)+")"),d.on("click",function(t,e){b.chartClick({data:t,index:e,pos:d3.event,id:c})}),w.value(u[l]||u.count);var g=w.nodes(t[0]).reverse();E(g);var D=p.selectAll(".arc-container").data(g,v);D.enter().append("g").attr("class","arc-container").append("path").attr("d",L).style("fill",function(t){return t.color?t.color:h(_?(t.children?t:t.parent).name:t.name)}).style("stroke","#FFF").on("click",function(t,e){A(t),b.elementClick({data:t,index:e})}).on("mouseover",function(t,e){d3.select(this).classed("hover",!0).style("opacity",.8),b.elementMouseover({data:t,color:d3.select(this).style("fill"),percent:function(t){var e=Math.max(0,Math.min(2*Math.PI,M(t.x)));return(Math.max(0,Math.min(2*Math.PI,M(t.x+t.dx)))-e)/(2*Math.PI)}(t)})}).on("mouseout",function(t,e){d3.select(this).classed("hover",!1).style("opacity",1),b.elementMouseout({data:t})}).on("mousemove",function(t,e){b.elementMousemove({data:t})}),D.each(function(t){d3.select(this).select("path").transition().duration(y).attrTween("d",C)}),f&&(D.selectAll("text").remove(),D.append("text").text(function(t){return m(t)}).transition().duration(y).attr("opacity",function(t){return Y(t)?1:0}).attr("transform",function(t){var e=this.getBBox().width;if(0===t.depth)return"rotate(0)translate("+e/2*-1+",0)";var n=T(t),i=S(t);return 0===i?"rotate("+n+")translate("+(x(t.y)+5)+",0)":"rotate("+n+")translate("+(x(t.y)+e+5)+",0)rotate("+i+")"})),A(g[g.length-1]),D.exit().transition().duration(y).attr("opacity",0).each("end",function(t){var e=v(t);k[e]=void 0}).remove()}),O.renderEnd("sunburst immediate"),j}return j.dispatch=b,j.options=i.utils.optionsFunc.bind(j),j._options=Object.create({},{width:{get:function(){return o},set:function(t){o=t}},height:{get:function(){return s},set:function(t){s=t}},mode:{get:function(){return l},set:function(t){l=t}},id:{get:function(){return c},set:function(t){c=t}},duration:{get:function(){return y},set:function(t){y=t}},groupColorByParent:{get:function(){return _},set:function(t){_=!!t}},showLabels:{get:function(){return f},set:function(t){f=!!t}},labelFormat:{get:function(){return m},set:function(t){m=t}},labelThreshold:{get:function(){return p},set:function(t){p=t}},sort:{get:function(){return g},set:function(t){g=t}},key:{get:function(){return v},set:function(t){v=t}},margin:{get:function(){return a},set:function(t){a.top=void 0!=t.top?t.top:a.top,a.right=void 0!=t.right?t.right:a.right,a.bottom=void 0!=t.bottom?t.bottom:a.bottom,a.left=void 0!=t.left?t.left:a.left}},color:{get:function(){return h},set:function(t){h=i.utils.getColor(t)}}}),i.utils.initOptions(j),j},i.models.sunburstChart=function(){"use strict";var t=i.models.sunburst(),e=i.models.tooltip(),n={top:30,right:20,bottom:20,left:20},r=null,a=null,o=i.utils.defaultColor(),s=!1,l=(Math.round(1e5*Math.random()),null),u=null,c=250,d=d3.dispatch("stateChange","changeState","renderEnd"),h=i.utils.renderWatch(d);function f(e){return h.reset(),h.models(t),e.each(function(e){var o=d3.select(this);i.utils.initSVG(o);var s=i.utils.availableWidth(r,o,n),l=i.utils.availableHeight(a,o,n);if(f.update=function(){0===c?o.call(f):o.transition().duration(c).call(f)},f.container=o,!e||!e.length)return i.utils.noData(f,o),f;o.selectAll(".nv-noData").remove(),t.width(s).height(l).margin(n),o.call(t)}),h.renderEnd("sunburstChart immediate"),f}return e.duration(0).headerEnabled(!1).valueFormatter(function(t){return t}),t.dispatch.on("elementMouseover.tooltip",function(t){t.series={key:t.data.name,value:t.data.value||t.data.size,color:t.color,percent:t.percent},s||(delete t.percent,delete t.series.percent),e.data(t).hidden(!1)}),t.dispatch.on("elementMouseout.tooltip",function(t){e.hidden(!0)}),t.dispatch.on("elementMousemove.tooltip",function(t){e()}),f.dispatch=d,f.sunburst=t,f.tooltip=e,f.options=i.utils.optionsFunc.bind(f),f._options=Object.create({},{noData:{get:function(){return u},set:function(t){u=t}},defaultState:{get:function(){return l},set:function(t){l=t}},showTooltipPercent:{get:function(){return s},set:function(t){s=t}},color:{get:function(){return o},set:function(e){o=e,t.color(o)}},duration:{get:function(){return c},set:function(e){c=e,h.reset(c),t.duration(c)}},margin:{get:function(){return n},set:function(e){n.top=void 0!==e.top?e.top:n.top,n.right=void 0!==e.right?e.right:n.right,n.bottom=void 0!==e.bottom?e.bottom:n.bottom,n.left=void 0!==e.left?e.left:n.left,t.margin(n)}}}),i.utils.inheritOptions(f,t),i.utils.initOptions(f),f},i.version="1.8.6-dev"}()},function(t,e,n){"use strict";var i=n(11),r=n(13),a=n(28),o=n(24),s=function(){function t(){return Error.call(this),this.message="object unsubscribed",this.name="ObjectUnsubscribedError",this}return t.prototype=Object.create(Error.prototype),t}(),l=function(t){function e(e,n){var i=t.call(this)||this;return i.subject=e,i.subscriber=n,i.closed=!1,i}return i.a(e,t),e.prototype.unsubscribe=function(){if(!this.closed){this.closed=!0;var t=this.subject,e=t.observers;if(this.subject=null,e&&0!==e.length&&!t.isStopped&&!t.closed){var n=e.indexOf(this.subscriber);-1!==n&&e.splice(n,1)}}},e}(o.a),u=n(52);n.d(e,"a",function(){return d});var c=function(t){function e(e){var n=t.call(this,e)||this;return n.destination=e,n}return i.a(e,t),e}(a.a),d=function(t){function e(){var e=t.call(this)||this;return e.observers=[],e.closed=!1,e.isStopped=!1,e.hasError=!1,e.thrownError=null,e}return i.a(e,t),e.prototype[u.a]=function(){return new c(this)},e.prototype.lift=function(t){var e=new h(this,this);return e.operator=t,e},e.prototype.next=function(t){if(this.closed)throw new s;if(!this.isStopped)for(var e=this.observers,n=e.length,i=e.slice(),r=0;r<n;r++)i[r].next(t)},e.prototype.error=function(t){if(this.closed)throw new s;this.hasError=!0,this.thrownError=t,this.isStopped=!0;for(var e=this.observers,n=e.length,i=e.slice(),r=0;r<n;r++)i[r].error(t);this.observers.length=0},e.prototype.complete=function(){if(this.closed)throw new s;this.isStopped=!0;for(var t=this.observers,e=t.length,n=t.slice(),i=0;i<e;i++)n[i].complete();this.observers.length=0},e.prototype.unsubscribe=function(){this.isStopped=!0,this.closed=!0,this.observers=null},e.prototype._trySubscribe=function(e){if(this.closed)throw new s;return t.prototype._trySubscribe.call(this,e)},e.prototype._subscribe=function(t){if(this.closed)throw new s;return this.hasError?(t.error(this.thrownError),o.a.EMPTY):this.isStopped?(t.complete(),o.a.EMPTY):(this.observers.push(t),new l(this,t))},e.prototype.asObservable=function(){var t=new r.a;return t.source=this,t},e.create=function(t,e){return new h(t,e)},e}(r.a),h=function(t){function e(e,n){var i=t.call(this)||this;return i.destination=e,i.source=n,i}return i.a(e,t),e.prototype.next=function(t){var e=this.destination;e&&e.next&&e.next(t)},e.prototype.error=function(t){var e=this.destination;e&&e.error&&this.destination.error(t)},e.prototype.complete=function(){var t=this.destination;t&&t.complete&&this.destination.complete()},e.prototype._subscribe=function(t){return this.source?this.source.subscribe(t):o.a.EMPTY},e}(d)},function(t,e,n){"use strict";n.d(e,"a",function(){return i});var i=function(){return"function"==typeof Symbol&&Symbol.observable||"@@observable"}()},function(t,e,n){"use strict";var i,r=n(0);!function(t){t[t.ProportionalConversion=2]="ProportionalConversion",t[t.Zoom=4]="Zoom"}(i||(i={})),n.d(e,"a",function(){return a});let a=class{constructor(t){this.dataTypeService=t}getNumericalOperationedValue(t,e,n){let r=e;const a=t.numericalOperationSetting;if(a.type===i.ProportionalConversion){const i=a.settings.upperLimit,o=a.settings.lowerLimit,s=t.numericalUpperLimit,l=t.numericalLowerLimit;if(s===l)return r;r=((i-o)/(s-l)*(e-l)+o).toFixed(n)}else if(a.type===i.Zoom){r=(e*a.settings.gain+a.settings.offset).toFixed(n)}return r}getNumericalOperations(t){const e={};return e.numericalUpperLimit=t.numericalUpperLimit||0===t.numericalUpperLimit?+t.numericalUpperLimit:this.dataTypeService.getMaxValue(t.version,t.dataType,t.fBoxDataType,t.integerDigits,t.fractionDigits),e.numericalLowerLimit=t.numericalLowerLimit||0===t.numericalLowerLimit?+t.numericalLowerLimit:this.dataTypeService.getMinValue(t.version,t.dataType,t.fBoxDataType,t.integerDigits,t.fractionDigits),e.enableNumericalOperation=t.enableNumericalOperation,t.enableNumericalOperation&&(e.type=t.numericalOperationSetting.type,e.type===i.ProportionalConversion?(e.proportionalConversion={},e.proportionalConversion.lowerLimit=t.numericalOperationSetting.settings.lowerLimit,e.proportionalConversion.upperLimit=t.numericalOperationSetting.settings.upperLimit):e.type===i.Zoom&&(e.zoom={},e.zoom.gain=t.numericalOperationSetting.settings.gain,e.zoom.offset=t.numericalOperationSetting.settings.offset)),e}getWriteValue(t,e,n,r,a){const o=Number(e);let s=Number(e);if(n.type===i.ProportionalConversion){const t=n.proportionalConversion.upperLimit,e=n.proportionalConversion.lowerLimit,i=n.numericalUpperLimit,r=n.numericalLowerLimit;if(t===e)return s.toString();s=(o-e)*(i-r)/(t-e)+r}else if(n.type===i.Zoom){const t=n.zoom.gain,e=n.zoom.offset;if(0===t)return s.toString();s=(o-e)/t}return(s=this.dataTypeService.isFloat(t,r)?Number(s.toFixed(a)):Number(s.toFixed(0))).toString()}getWriteMaxValue(t,e){let n=t;if(e.enableNumericalOperation)if(e.type===i.ProportionalConversion)n=e.proportionalConversion.upperLimit;else if(e.type===i.Zoom){const t=e.zoom.gain,i=e.zoom.offset,r=this.toInteger(t);n=n*r.num/r.times+i}return n}getWriteMinValue(t,e){let n=t;if(e.enableNumericalOperation)if(e.type===i.ProportionalConversion)n=e.proportionalConversion.lowerLimit;else if(e.type===i.Zoom){const t=e.zoom.gain,i=e.zoom.offset,r=this.toInteger(t);n=n*r.num/r.times+i}return n}toInteger(t){const e={times:1,num:0},n=t<0;if(t=Math.abs(t),this.isInteger(t))return e.num=t,e.num=n?-t:t,e;const i=t+"",r=i.indexOf("."),a=i.substr(r+1).length,o=Math.pow(10,a),s=parseInt((t*o+.5).toString(),10);return e.times=o,e.num=s,e.num=n?-s:s,e}isInteger(t){return Math.floor(t)===t}};a=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(r.Injectable)()],a)},function(t,e,n){"use strict";var i,r=n(0);!function(t){t[t.Write=2]="Write",t[t.ReadOnly=4]="ReadOnly",t[t.ReadWrite=6]="ReadWrite"}(i||(i={})),n.d(e,"a",function(){return a});let a=class{getAccessPermissions(){return[{key:i.ReadOnly,value:"ReadOnly"},{key:i.ReadWrite,value:"ReadWrite"}]}isReadOnly(t){return t===i.ReadOnly}isReadWrite(t){return t==i.ReadWrite}canRead(t){return t===i.ReadOnly}canWrite(t){return t===i.ReadWrite||t===i.Write}};a=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(r.Injectable)()],a)},function(t,e,n){"use strict";var i=n(29);n.d(e,"a",function(){return i.a})},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var i=n(0);let r=class{constructor(){this.zeroText="0"}padLeft(t,e,n){let i=String(t);n=n||this.zeroText;let r=i.length;for(;r<e;)i=n+i,r++;return i.toString()}padRight(t,e,n){let i=String(t);n=n||this.zeroText;let r=i.length;for(;r<e;)i+=n,r++;return i.toString()}movePointLeft(t,e){if(e<=0)return t;const n=String(t).split(".");let i=n[0]?n[0]:"";const r=n[1]?n[1]:"";let a=".",o="";return"-"===i.slice(0,1)&&(i=i.slice(1),o="-"),i.length<=e&&(a="0.",i=this.padLeft(i,e,"0")),o+i.slice(0,-e)+a+i.slice(-e)+r}movePointRight(t,e){if(e<=0)return t;const n=new String(t).split("."),i=n[0]?n[0]:"";let r=n[1]?n[1]:"",a=".";return r.length<=e&&(a="",r=this.padRight(r,e,"0")),i+r.slice(0,e)+a+r.slice(e,r.length)}movePoint(t,e){return e>=0?this.movePointRight(t,e):this.movePointLeft(t,-e)}roundingToFixedFractionDigits(t,e){const n=String(t),i=n.indexOf(".")+1,r=n.length-i;if(i>=1&&r>e){let r=+this.movePoint(n,e);const a=Number(n.substr(i+e,1));return r=a>=5&&t>=0||a<5&&t<0?Math.ceil(r):Math.floor(r),this.movePoint(r,-e)}return Number(t).toFixed(e)}};r=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)()],r)},function(t,e,n){"use strict";n.d(e,"a",function(){return a});var i=n(0),r=n(2);let a=class{constructor(t,e){this.fcloudDataTypeService=t,this.fboxDataTypeService=e}getValueType(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.getValueType(e):this.fboxDataTypeService.getValueType(e)}getValuePattern(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.getValuePattern(e):this.fboxDataTypeService.getValuePattern(e)}isHexType(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isHexType(e):this.fboxDataTypeService.isHexType(e)}isBinaryType(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isBinaryType(e):this.fboxDataTypeService.isBinaryType(e)}isHexOrBinaryType(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isHexOrBinaryType(e):this.fboxDataTypeService.isHexOrBinaryType(e)}isFloat(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isFloat(e):this.fboxDataTypeService.isFloat(e)}getValueMaxLength(t,e,n){return Object(r.isNumber)(n)?this.fboxDataTypeService.getValueMaxLength(n):!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.getValueMaxLength(e):this.fboxDataTypeService.getValueMaxLength(e)}isSupportFractionDigit(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isSupportFractionDigit(e):this.fboxDataTypeService.isSupportFractionDigit(e)}isSignedType(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isSignedType(e):this.fboxDataTypeService.isSignedType(e)}isSupportNumericalOperation(t,e){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.isSupportNumericalOperation(e):this.fboxDataTypeService.isSupportNumericalOperation(e)}formatToDecimal(t,e,n){return!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.formatToDecimal(e,n):this.fboxDataTypeService.formatToDecimal(e,n)}getMinValue(t,e,n,i,a){return Object(r.isNumber)(n)?this.fboxDataTypeService.getMinValue(n,i,a):!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.getMinValue(e):this.fboxDataTypeService.getMinValue(e)}getMaxValue(t,e,n,i,a){return Object(r.isNumber)(n)?this.fboxDataTypeService.getMaxValue(n,i,a):!Object(r.isNil)(t)&&t>4?this.fcloudDataTypeService.getMaxValue(e):this.fboxDataTypeService.getMaxValue(e)}};a=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)()],a)},function(t,e,n){"use strict";n.d(e,"a",function(){return s});var i=n(0),r=n(9),a=n(6),o=function(t,e){return function(n,i){e(n,i,t)}};let s=class{constructor(t){this.localization=t,this.defaultIntegerDigits=4,this.defaultFractionDigits=0,this.dataTypeList=new Map}getValueType(t){switch(t){case a.a.Binary:return this.localization.binaryType;case a.a.Int32:case a.a.Float:return this.localization.decimalType;case a.a.Hex:return this.localization.hexadecimalType;case a.a.String:return this.localization.stringType}}getValuePattern(t){switch(t){case a.a.Binary:return"^[01]+$";case a.a.Int32:case a.a.Float:return"^[+-]?[0-9]*(\\.[0-9]*)?$";case a.a.Hex:return"^[0-9a-fA-F]+$"}}isHexType(t){return t===a.a.Hex}isBinaryType(t){return t===a.a.Binary}isHexOrBinaryType(t){return t===a.a.Binary||t===a.a.Hex}isFloat(t){return t===a.a.Float}getValueMaxLength(t){switch(t){case a.a.Int32:return 10;case a.a.Float:return 11;case a.a.Binary:return 32;case a.a.Hex:return 8;default:return 0}}isSupportFractionDigit(t){return t!==a.a.Bool&&t!==a.a.String&&t!==a.a.Binary&&t!==a.a.Hex}isSignedType(t){return t===a.a.Int32||t===a.a.Float}isSupportNumericalOperation(t){return t!==a.a.Bool&&t!==a.a.Binary&&t!==a.a.Hex&&t!==a.a.String}formatToDecimal(t,e){return this.isBinaryType(e)?parseInt(t,2):this.isHexType(e)?parseInt(t,16):t}getMinValue(t,e,n){let i;switch(t){case a.a.Binary:case a.a.Hex:i=0;break;case a.a.Int32:i=-2147483648;break;case a.a.Float:i=-1e9}if(e){let r=e;n&&(r+=n),r&&i.toString().length-1>r&&(i=-this.getFillNine(r)),this.isFloat(t)&&n&&(i/=Math.pow(10,n))}return i}getMaxValue(t,e,n){let i;switch(t){case a.a.Binary:case a.a.Hex:i=4294967295;break;case a.a.Int32:i=2147483647;break;case a.a.Float:i=1e9}if(e){let r=e;n&&(r+=n),r&&i.toString().length>r&&(i=this.getFillNine(r)),this.isFloat(t)&&n&&(i/=Math.pow(10,n))}return i}getFillNine(t){let e="9";for(let n=1;n<t;n++)e=`9${e}`;return e}};s=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)(),o(0,Object(i.Inject)(r.b))],s)},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var i=n(0),r=n(9),a=function(t,e){return function(n,i){e(n,i,t)}};let o=class{constructor(t){this.localization=t,this.defaultIntegerDigits=4,this.defaultFractionDigits=0}getValueType(t){switch(t){case 0:case 5:case 15:return this.localization.binaryType;case 1:case 2:case 3:case 11:case 12:case 13:case 16:return this.localization.decimalType;case 4:case 14:return this.localization.hexadecimalType;case 30:return this.localization.stringType}}getValuePattern(t){switch(t){case 0:case 5:case 15:return"^[01]+$";case 1:case 2:case 3:case 11:case 12:case 13:case 16:return"^[+-]?[0-9]*(\\.[0-9]*)?$";case 4:case 14:return"^[0-9a-fA-F]+$"}}isHexType(t){return 4===t||14===t}isBinaryType(t){return 5===t||15===t}isHexOrBinaryType(t){return 4===t||14===t||5===t||15===t}isFloat(t){return 16===t}getValueMaxLength(t){switch(t){case 1:return 5;case 2:return 6;case 3:case 4:return 4;case 5:return 16;case 11:return 10;case 12:case 16:return 11;case 13:case 14:return 8;case 15:return 32;case 21:case 22:case 23:return 16;case 24:return 8;case 25:return 32;default:return 0}}isSupportFractionDigit(t){return 0!==t&&4!==t&&5!==t&&14!==t&&15!==t&&30!==t}isSignedType(t){return 2===t||12===t||16===t}isSupportNumericalOperation(t){return 0!==t&&4!==t&&5!==t&&14!==t&&15!==t&&30!==t}formatToDecimal(t,e){return this.isBinaryType(e)?parseInt(t,2):this.isHexType(e)?parseInt(t,16):t}getMinValue(t,e,n){let i;switch(t){case 1:case 3:case 4:case 5:case 11:case 13:case 14:case 15:case 21:case 23:case 14:case 15:case 24:case 25:i=0;break;case 2:i=-32768;break;case 12:i=-2147483648;break;case 16:i=-1e9;break;case 22:i=Number.MIN_SAFE_INTEGER;break;case 26:i=-Number.MAX_VALUE}if(e){let r=e;n&&(r+=n),r&&i.toString().length-1>r&&(i=-this.getFillNine(r)),this.isFloat(t)&&n&&(i/=Math.pow(10,n))}return i}getMaxValue(t,e,n){let i;switch(t){case 1:case 4:case 5:i=65535;break;case 2:i=32767;break;case 3:i=9999;break;case 11:case 14:case 15:i=4294967295;break;case 12:i=2147483647;break;case 13:i=99999999;break;case 16:i=1e9;break;case 21:case 24:case 25:case 22:case 23:i=Number.MAX_SAFE_INTEGER;break;case 26:i=Number.MAX_VALUE}if(e){let r=e;n&&(r+=n),r&&i.toString().length>r&&(i=this.getFillNine(r)),this.isFloat(t)&&n&&(i/=Math.pow(10,n))}return i}getFillNine(t){let e="9";for(let n=1;n<t;n++)e=`9${e}`;return e}};o=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)(),a(0,Object(i.Inject)(r.b))],o)},function(t,e,n){"use strict";n.d(e,"a",function(){return r});var i=n(0);let r=class{};r=function(t,e,n,i){var r,a=arguments.length,o=a<3?e:null===i?i=Object.getOwnPropertyDescriptor(e,n):i;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(t,e,n,i);else for(var s=t.length-1;s>=0;s--)(r=t[s])&&(o=(a<3?r(o):a>3?r(e,n,o):r(e,n))||o);return a>3&&o&&Object.defineProperty(e,n,o),o}([Object(i.Injectable)()],r)},function(t,e,n){"use strict";n.d(e,"a",function(){return o});var i=n(50),r=n(268),a=n(54);function o(){for(var t=[],e=0;e<arguments.length;e++)t[e]=arguments[e];var n=t[t.length-1];return Object(i.a)(n)?(t.pop(),Object(a.a)(t,n)):Object(r.a)(t)}},function(t,e,n){"use strict";function i(t){return t&&"function"==typeof t.schedule}n.d(e,"a",function(){return i})},function(t,e,n){"use strict";function i(t){return"function"==typeof t}n.d(e,"a",function(){return i})},function(t,e,n){"use strict";n.d(e,"a",function(){return i});var i=function(){return"function"==typeof Symbol?Symbol("rxSubscriber"):"@@rxSubscriber_"+Math.random()}()},function(t,e,n){"use strict";n.d(e,"a",function(){return a});var i=n(23),r=n(34),a={closed:!0,next:function(t){},error:function(t){if(i.a.useDeprecatedSynchronousErrorHandling)throw t;Object(r.a)(t)},complete:function(){}}},function(t,e,n){"use strict";n.d(e,"a",function(){return a});var i=n(13),r=n(24);function a(t,e){return new i.a(function(n){var i=new r.a,a=0;return i.add(e.schedule(function(){a!==t.length?(n.next(t[a++]),n.closed||i.add(this.schedule())):n.complete()})),i})}},function(t,e,n){"use strict";n.d(e,"a",function(){return i});var i=function(){return Array.isArray||function(t){return t&&"number"==typeof t.length}}()},function(t,e,n){"use strict";var i;!function(t){t[t.ToggleView=0]="ToggleView",t[t.PopupView=1]="PopupView",t[t.CloseView=2]="CloseView",t[t.ControlView=3]="ControlView"}(i||(i={}));var r=n(224);n.d(e,"b",function(){return i}),n.d(e,"a",function(){return r.ViewOperationElementModel})},function(t,e,n){"use strict";var i;!function(t){t[t.Positive=0]="Positive",t[t.Negative=1]="Negative"}(i||(i={}));var r=n(225);n.d(e,"a",function(){return i}),n.d(e,"b",function(){return r.Pipe})},function(t,e,n){"use strict";class i{}var r=n(261),a=n(260),o=n(259),s=n(258),l=n(257),u=n(256);n.d(e,"a",function(){return i}),n.d(e,"f",function(){return r.ReadableModel}),n.d(e,"c",function(){return a.ConditionalDisplayModel}),n.d(e,"e",function(){return o.ConditionalEnableModel}),n.d(e,"b",function(){return s.ConditionalControlModel}),n.d(e,"d",function(){return l.ConditionalDynamicDisplayModel}),n.d(e,"g",function(){return u.SecurityModel})},function(t,e,n){"use strict";var i,r,a=n(209);!function(t){t[t.Center=0]="Center",t[t.Custom=1]="Custom"}(i||(i={})),function(t){t[t.Shadow=0]="Shadow",t[t.Musk=1]="Musk"}(r||(r={})),n.d(e,"c",function(){return a.ViewSettingsModel}),n.d(e,"b",function(){return i}),n.d(e,"a",function(){return r})},function(t,e,n){"use strict";var i,r=n(222),a=n(221);!function(t){t[t.ProportionalConversion=2]="ProportionalConversion",t[t.Zoom=4]="Zoom"}(i||(i={}));var o,s=n(220),l=n(219),u=n(218),c=n(217);!function(t){t[t.Decimal=0]="Decimal",t[t.Hex=1]="Hex",t[t.Binary=2]="Binary"}(o||(o={})),n.d(e,"b",function(){return r.NumericalDisplay}),n.d(e,"d",function(){return a.NumericalOperationSettings}),n.d(e,"e",function(){return i}),n.d(e,"c",function(){return s.NumericalOperation}),n.d(e,"f",function(){return l.ProportionalConversion}),n.d(e,"g",function(){return u.TypeSettings}),n.d(e,"h",function(){return c.Zoom}),n.d(e,"a",function(){return o})},function(t,e,n){"use strict";var i=n(73),r=n(72),a=n(71),o=n(70),s=n(69),l=n(68),u=n(67),c=n(66);n.d(e,"h",function(){return i.WeatherService}),n.d(e,"c",function(){return r.PermissionChecker}),n.d(e,"d",function(){return a.ReleasedVariableService}),n.d(e,"a",function(){return o.CreateOperationRecordArgs}),n.d(e,"b",function(){return s.OperationRecordService}),n.d(e,"e",function(){return l.VariableOptionModel}),n.d(e,"f",function(){return u.VideoService}),n.d(e,"g",function(){return c.VideoUrl})},function(t,e,n){"use strict";var i=n(83),r=n(82),a=n(81),o=n(80),s=n(79),l=n(78),u=n(2),c=n(49),d=n(39),h=n(16),f=n(12),m=n(29);class p{constructor(t){this.remoteGraphProtocol=t,this.graphStateCache=new m.a(t=>JSON.stringify(t))}getGraph(t,e,n){const i={graphId:t,stateId:e,extendedStyle:n};return this.graphStateCache.has(i)?Object(c.a)(this.graphStateCache.get(i)):this.remoteGraphProtocol.version>=1?this.getReleasedGraphState(i):this.getSystemGraph(i)}getSystemGraph(t){const e=String(t.graphId);return this.remoteGraphProtocol.getSystemGraphConfig(e).pipe(Object(h.map)(n=>{let i;const r=Object(u.find)(n.states,e=>e.id===t.stateId);if(r){const t="svg"===r.type?f.i.SVG:f.i.Image,n=new f.f(t,this.remoteGraphProtocol.getAbsoluteStateUrl(e,r.url));i=f.g.success(n)}else i=f.g.failed();return this.graphStateCache.set(t,i),i}))}getImageUrl(t){return t?0===t.indexOf("http://")||0===t.indexOf("https://")?t:this.remoteGraphProtocol.remoteServiceBaseUrl+t:t}getReleasedGraphState(t){return t.extendedStyle?this.getReleaseGraphStateWithExtendedStyle(t):(this.graphStateToBeResolved||(this.graphStateToBeResolved=new m.a(t=>JSON.stringify(t)),setTimeout(()=>{this.resolvePendingStates()})),this.graphStateToBeResolved.has(t)||this.graphStateToBeResolved.set(t,new d.a),this.graphStateToBeResolved.get(t))}getReleaseGraphStateWithExtendedStyle(t){const e=Number(t.graphId),n=encodeURIComponent(t.extendedStyle.fill),i=encodeURIComponent(t.extendedStyle.stroke),r=this.remoteGraphProtocol.getGraphStateUrl(e,t.stateId,n,i),a=new f.f(f.i.SVG,r);return Object(c.a)(f.g.success(a))}resolvePendingStates(){const t=this.graphStateToBeResolved,e=[];t.forEach((t,n)=>{const i=JSON.parse(n);e.push({graphId:i.graphId,stateIndex:i.stateId})});const n={states:e};this.remoteGraphProtocol.getReleasedGraphStates(n).subscribe(e=>{e.forEach(e=>{const n={graphId:e.graphId,stateId:e.stateIndex};let i;if(e.result){const t=this.getImageUrl(e.result.url);i=f.g.success(new f.f(e.result.type,t))}else i=f.g.failed();this.graphStateCache.set(n,i);const r=t.get(n);r&&(r.next(i),r.complete())})}),delete this.graphStateToBeResolved}}var g=n(77),v=n(30);class _{constructor(t){this.remoteViewProtocol=t,this.viewConfigCache=new m.a(t=>JSON.stringify(t))}getMainViewConfig(){return this.remoteViewProtocol.getReleasedMainView().pipe(Object(h.map)(t=>{const e=new v.a(t.content);return this.viewConfigCache.set(t.viewIndex,e),e}))}getViewConfig(t){return this.viewConfigCache.has(t)?Object(c.a)(this.viewConfigCache.get(t)):this.remoteViewProtocol.getReleasedView(t).pipe(Object(h.map)(e=>{const n=new v.a(e.content);return this.viewConfigCache.set(t,n),n}))}getViewConfigByConfigureViewId(t){return this.remoteViewProtocol.getViewConfigByConfigureViewId(t).pipe(Object(h.map)(t=>{return new v.a(t.content)}))}getViewConfigByConfigureViewCode(t){return this.remoteViewProtocol.getViewConfigByConfigureViewCode(t).pipe(Object(h.map)(t=>{return new v.a(t.content)}))}}var y=n(76),b=n(75);const M="defaultImage",x="/assets/common/images/configure/defaultImage.png",w="/ConfigureComponent/GetImage",k="id=";class L{constructor(t){this.remoteImageProtocol=t}getDiagramImageUrlPrefix(){return this.remoteImageProtocol.remoteServiceBaseUrl+w+"?"}getImageUrl(t){return t&&t!==M?this.getDiagramImageUrlPrefix()+k+t:this.remoteImageProtocol.appBaseUrl+x}}var S=n(13),T=n(43);class Y{constructor(t,e){this.remoteVariableProtocol=t,this.logger=e,this.observers=new Map,this.appIdVariablesMap=new Map,this.variableStateObservers=new Map,this.variableStateCache=new Map,this.alarmObservers=[],this.variableValueCache=new T.a(t=>JSON.stringify(t)),this.connectedSubscription=this.remoteVariableProtocol.connected.subscribe(()=>{const t=[];this.variableStateObservers.forEach((e,n)=>{t.push(n)}),this.remoteVariableProtocol.subscribeVariableStates(t),this.appIdVariablesMap.forEach((t,e)=>{this.remoteVariableProtocol.tryOpenVariables(t,e)})}),this.doVariableStatesChanged(),this.doVariableValuesChanged(),this.doAlarmChanged()}doAlarmChanged(){void 0!==this.alarmChangedSubscription&&this.alarmChangedSubscription.unsubscribe(),this.alarmChangedSubscription=this.remoteVariableProtocol.virtualDeviceAlarmsChanged.subscribe(t=>{Object(u.each)(this.alarmObservers,e=>{e.next(t)})})}doVariableValuesChanged(){void 0!==this.variableValuesChangedSubscription&&this.variableValuesChangedSubscription.unsubscribe(),this.variableValuesChangedSubscription=this.remoteVariableProtocol.variableValuesChanged.subscribe(t=>{Object(u.each)(t,t=>{const e=t.variableName;this.variableValueCache.set(e,t),this.observers.has(e)&&Object(u.each)(this.observers.get(e),e=>{e.next([t])})})})}doVariableStatesChanged(){void 0!==this.variableStatesChangedSubscription&&this.variableStatesChangedSubscription.unsubscribe(),this.variableStatesChangedSubscription=this.remoteVariableProtocol.variableStatesChanged.subscribe(t=>{Object(u.each)(t,t=>{const e=t.variableName;this.variableStateCache.set(e,t),this.variableStateObservers.has(e)&&Object(u.each)(this.variableStateObservers.get(e),e=>{e.next([t])})})})}subscribeVariableStates(t){return new S.a(e=>{let n=[];return Object(u.each)(t,t=>{this.variableStateObservers.has(t)?this.variableStateCache.has(t)&&e.next([this.variableStateCache.get(t)]):(this.variableStateObservers.set(t,[]),n.push(t)),this.variableStateObservers.get(t).push(e)}),(n=Object(u.uniq)(n))&&n.length>0&&(this.variableStatesToBeOpened||(this.variableStatesToBeOpened=[],setTimeout(()=>{this.remoteVariableProtocol.subscribeVariableStates(this.variableStatesToBeOpened),delete this.variableStatesToBeOpened})),this.variableStatesToBeOpened.push(...n)),()=>{const n=[];Object(u.each)(t,t=>{const i=this.variableStateObservers.get(t);i&&(Object(u.remove)(i,t=>t===e),i.length<=0&&(this.variableStateObservers.delete(t),n.push(t)))}),n.length&&(this.variableStatesToBeClosed||(this.variableStatesToBeClosed=[],setTimeout(()=>{this.remoteVariableProtocol.unsubscribeVariableStates(this.variableStatesToBeClosed),delete this.variableStatesToBeClosed})),this.variableStatesToBeClosed.push(...n))}})}subscribeVariableState(t){return this.subscribeVariableStates([t]).pipe(Object(h.map)(t=>t[0]))}openVariables(t,e=""){return new S.a(n=>{let i=[];return Object(u.each)(t,t=>{t&&(this.observers.has(t)?this.variableValueCache.has(t)&&n.next([this.variableValueCache.get(t)]):(this.observers.set(t,[]),i.push(t)),this.observers.get(t).push(n),this.appIdVariablesMap.get(e)?-1===this.appIdVariablesMap.get(e).indexOf(t)&&this.appIdVariablesMap.get(e).push(t):this.appIdVariablesMap.set(e,[]))}),(i=Object(u.uniq)(i))&&i.length>0&&(this.variablesToBeOpened||(this.variablesToBeOpened=[],setTimeout(()=>{this.remoteVariableProtocol.tryOpenVariables(this.variablesToBeOpened,e),delete this.variablesToBeOpened})),this.variablesToBeOpened.push(...i)),()=>{const i=[];Object(u.each)(t,t=>{const e=this.observers.get(t);e&&(Object(u.remove)(e,t=>t===n),e.length<=0&&(this.observers.delete(t),i.push(t)))}),i.length&&(this.variablesToBeClosed||(this.variablesToBeClosed=[],setTimeout(()=>{this.remoteVariableProtocol.tryStopVariables(this.variablesToBeClosed,e),delete this.variablesToBeClosed})),this.variablesToBeClosed.push(...i))}})}openVariable(t,e=""){if(t)return this.openVariables([t],e).pipe(Object(h.map)(t=>t[0]))}write(t,e){if(t)return this.remoteVariableProtocol.writeVariable(t,e),new S.a(t=>{})}writeWordByBit(t,e,n){if(t)return this.remoteVariableProtocol.writeVariableWordByBit(t,e,n),new S.a(t=>{})}subscribeUserDeviceAlarms(t=""){return new S.a(e=>(this.alarmObservers.push(e),this.remoteVariableProtocol.subscribeVirtualDeviceAlarms(t),()=>{this.remoteVariableProtocol.unsubscribeVirtualDeviceAlarms(t)}))}dispose(){this.connectedSubscription.unsubscribe(),this.variableStatesChangedSubscription.unsubscribe(),this.variableValuesChangedSubscription.unsubscribe(),this.alarmChangedSubscription.unsubscribe(),this.logger&&this.logger.isDebugEnabled()&&this.logger.debug("[VariableCommunicator] RemoteVariableCommunicator disposed.")}}var D=n(74);n.d(e,"a",function(){return i.GetReleasedGraphStateResult}),n.d(e,"e",function(){return r.GraphStateResult}),n.d(e,"b",function(){return a.GetReleasedGraphStates}),n.d(e,"d",function(){return o.GraphStateKey}),n.d(e,"c",function(){return s.GraphState}),n.d(e,"f",function(){return l.RemoteGraphProtocol}),n.d(e,"g",function(){return p}),n.d(e,"l",function(){return g.RemoteViewProtocol}),n.d(e,"m",function(){return _}),n.d(e,"n",function(){return y.ViewResult}),n.d(e,"h",function(){return b.RemoteImageProtocol}),n.d(e,"i",function(){return L}),n.d(e,"j",function(){return Y}),n.d(e,"k",function(){return D.RemoteVariableProtocol})},function(t,e,n){"use strict";var i,r=n(237);!function(t){t[t.Bit=0]="Bit",t[t.Word=1]="Word"}(i||(i={}));var a,o,s=n(236);!function(t){t[t.On=0]="On",t[t.Off=1]="Off",t[t.Inverse=2]="Inverse",t[t.Restoration=3]="Restoration"}(a||(a={})),function(t){t[t.Add=0]="Add",t[t.Subtract=1]="Subtract",t[t.SetConstant=2]="SetConstant"}(o||(o={}));var l,u=n(235),c=n(234);!function(t){t[t.Bit=0]="Bit",t[t.Word=1]="Word"}(l||(l={}));var d,h=n(233),f=n(232),m=n(231),p=n(230);!function(t){t[t.Nothing=0]="Nothing",t[t.Image=1]="Image",t[t.Label=2]="Label"}(d||(d={}));var g=n(229);n.d(e,"k",function(){return r.SwtichSettings}),n.d(e,"j",function(){return i}),n.d(e,"c",function(){return s.BitSwitchSettings}),n.d(e,"b",function(){return a}),n.d(e,"m",function(){return o}),n.d(e,"n",function(){return u.WordSwitchSettings}),n.d(e,"f",function(){return c.IndicatorLightSettings}),n.d(e,"g",function(){return l}),n.d(e,"a",function(){return h.BitIndicatorLightSettings}),n.d(e,"l",function(){return f.WordIndicatorLightSettings}),n.d(e,"i",function(){return m.SwitchIndicatorState}),n.d(e,"h",function(){return p.SwitchIndicatorLight}),n.d(e,"e",function(){return d}),n.d(e,"d",function(){return g.FaultFlicker})},function(t,e,n){"use strict";var i;!function(t){t[t.Equal=0]="Equal",t[t.NotEqual=1]="NotEqual",t[t.GreaterThan=2]="GreaterThan",t[t.LessThan=3]="LessThan",t[t.GreaterOrEqual=4]="GreaterOrEqual",t[t.LessOrEqual=5]="LessOrEqual"}(i||(i={}));var r,a=n(254);!function(t){t[t.Off=0]="Off",t[t.On=1]="On"}(r||(r={}));var o=n(253);class s{static isSatisfied(t,e,n){switch(+t){case i.Equal:return n===e;case i.GreaterOrEqual:return n>=e;case i.GreaterThan:return n>e;case i.LessOrEqual:return n<=e;case i.LessThan:return n<e;case i.NotEqual:return n!==e;default:throw new Error(`Unknown RelationalOperator:${t}.`)}}}var l=n(0),u=n(2),c=n(33),d=n(8),h=n(10);class f{constructor(t,e){this.condition=t,this.variableStore=e,this.conditionEffectiveChanged=new l.EventEmitter}get variableName(){const t=new h.a(this.condition.variableName,this.condition.variableGroupName,this.condition.dataSourceCode,this.condition.variableVersion);return d.a.getConvertedVariableName(this.variableStore,t)}}var m=n(4);class p{constructor(t,e){this.state=t,this.value=e,this.state=t,this.value=e}}var g=n(32);class v extends f{constructor(t,e,n){super(t,n),this.bitConditon=t,this.variableCommunicator=e}requestData(t){if(!this.bitConditon)throw new Error("BitConditionModel cannot be null.");this.variableName&&this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===m.d.Normal?this.requestconditionEffectiveValue(this.variableCommunicator,t):this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,e.state),!1))})}requestconditionEffectiveValue(t,e=""){t.openVariable(this.variableName,e).subscribe(t=>{if(this.bitConditon.isBitwiseIndex){const e=31;this.binary=new g.a(t.value,e+1),this.currentValue=new m.e(t.variableName,t.state,this.binary.convertToBinary().substr(e-this.bitConditon.bitIndex,1))}else this.currentValue=t;this.isConditionEffective=this.getIsConditionEffective(),this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,t.state),this.isConditionEffective))})}getIsConditionEffective(){switch(this.bitConditon.bitConditionLogic){case r.On:return this.currentValue.state===m.d.DataNormal&&1==this.currentValue.value;case r.Off:return this.currentValue.state===m.d.DataNormal&&0==this.currentValue.value;default:throw new Error(`Unknown BitConditonLogic : ${this.bitConditon.bitConditionLogic}.`)}}}class _{constructor(t,e,n){this.key=t,this.relationType=e,this.result=n}}var y=n(15),b=n(22);class M extends f{constructor(t,e,n){super(t,n),this.wordCondition=t,this.variableCommunicator=e}get baseVariable(){const t=this.wordCondition.baseVariableValue;if(!t||!t.variableName)return;const e=new h.a(t.variableName,t.variableGroupName,t.dataSourceCode,t.variableVersion);return d.a.getConvertedVariableName(this.variableStore,e)}get realtionVariable(){const t=this.wordCondition.realtionVariableValue;if(!t||!t.variableName)return;const e=new h.a(t.variableName,t.variableGroupName,t.dataSourceCode,t.variableVersion);return d.a.getConvertedVariableName(this.variableStore,e)}requestData(t){if(!this.wordCondition)throw new Error("WordConditionModel cannot be null.");if(!this.wordCondition.baseVariableValue)throw new Error("WordConditionModel.baseVariableValue cannot be null.");if(this.wordCondition.baseVariableValue.valueType==y.a.Constant?this.baseVariableValue=new m.e(void 0,m.d.DataNormal,this.wordCondition.baseVariableValue.constValue):this.variableName&&this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===m.d.Normal?this.requestconditionEffectiveBaseValue(this.variableCommunicator,t):this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,e.state),!1))}),0!=+this.wordCondition.relationType){if(!this.wordCondition.baseVariableValue)throw new Error("WordConditionModel.realtionVariableValue cannot be null.");this.wordCondition.realtionVariableValue.valueType==y.a.Constant?this.realtionVariableValue=new m.e(void 0,m.d.DataNormal,this.wordCondition.realtionVariableValue.constValue):this.variableName?this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===m.d.Normal?this.requestconditionEffectiveRealtionValue(this.variableCommunicator,t):this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,e.state),!1))}):this.requestconditionEffectiveRealtionValue(this.variableCommunicator,t)}this.variableName&&this.variableCommunicator.subscribeVariableState(this.variableName).subscribe(e=>{e.state===m.d.Normal?this.requestconditionEffectiveValue(this.variableCommunicator,t):this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,e.state),!1))})}requestconditionEffectiveValue(t,e=""){t.openVariable(this.variableName,e).subscribe(t=>{this.currentValue=t,this.isConditionEffective=this.getIsConditionEffective(),this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,t.state),this.isConditionEffective))})}requestconditionEffectiveBaseValue(t,e=""){t.openVariable(this.baseVariable,e).subscribe(t=>{this.baseVariableValue=t,this.isConditionEffective=this.getIsConditionEffective(),this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,t.state),this.isConditionEffective))})}requestconditionEffectiveRealtionValue(t,e=""){t.openVariable(this.realtionVariable,e).subscribe(t=>{this.realtionVariableValue=t,this.isConditionEffective=this.getIsConditionEffective(),this.conditionEffectiveChanged.emit(new p(new m.c(this.variableName,t.state),this.isConditionEffective))})}getIsConditionEffective(){return this.wordCondition.relationType==b.a.None?this.comparator(this.baseVariableValue,this.wordCondition.baseVariableValue.operator):this.wordCondition.relationType==b.a.And?this.comparator(this.baseVariableValue,this.wordCondition.baseVariableValue.operator)&&this.comparator(this.realtionVariableValue,this.wordCondition.realtionVariableValue.operator):this.wordCondition.relationType==b.a.Or?this.comparator(this.baseVariableValue,this.wordCondition.baseVariableValue.operator)||this.comparator(this.realtionVariableValue,this.wordCondition.realtionVariableValue.operator):void 0}comparator(t,e){return null!=t&&(null!=this.currentValue&&(t.state===m.d.DataNormal&&this.currentValue.state===m.d.DataNormal&&(e==i.Equal?+this.currentValue.value==+t.value:e==i.GreaterOrEqual?+this.currentValue.value>+t.value||+this.currentValue.value==+t.value:e==i.GreaterThan?+this.currentValue.value>+t.value:e==i.LessOrEqual?+this.currentValue.value<+t.value||+this.currentValue.value==+t.value:e==i.LessThan?+this.currentValue.value<+t.value:e==i.NotEqual?+this.currentValue.value!=+t.value:void 0)))}}class x{constructor(t,e,n){this.sourceConditionItems=t,this.variableCommunicator=e,this.variableStore=n,this.conditionResultChanged=new l.EventEmitter,this.conditionResults=new Map}requestData(t){if(null==this.sourceConditionItems||!this.sourceConditionItems.length)return;const e=this.sourceConditionItems.sort(t=>t.index);e.forEach(n=>{switch(n.conditionType){case c.a.Bit:const i=new v(n.condition,this.variableCommunicator,this.variableStore);i.conditionEffectiveChanged.subscribe(t=>{this.conditionResults.has(e.indexOf(n))&&this.conditionResults.delete(e.indexOf(n)),this.conditionResults.set(e.indexOf(n),new _(e.indexOf(n),n.relationType,t)),this.emitConditionResult()}),i.requestData(t);break;case c.a.Word:const r=new M(n.condition,this.variableCommunicator,this.variableStore);r.conditionEffectiveChanged.subscribe(t=>{this.conditionResults.has(e.indexOf(n))&&this.conditionResults.delete(e.indexOf(n)),this.conditionResults.set(e.indexOf(n),new _(e.indexOf(n),n.relationType,t)),this.emitConditionResult()}),r.requestData(t);break;default:throw new Error(`Unknown ConditionType :${n.conditionType}`)}})}emitConditionResult(){let t=!0;const e=[],n=[];this.conditionResults.forEach(i=>{n.push({key:i.key,result:i}),i.relationType==b.a.None&&(t=i.result.value,e.push(i.result.state))}),Object(u.sortBy)(n,t=>t.key).forEach(n=>{const i=n.result;i.relationType==b.a.Or?(t=t||i.result.value,e.push(i.result.state)):i.relationType==b.a.And&&(t=t&&i.result.value,e.push(i.result.state))});const i={states:e,value:t};this.conditionResultChanged.emit(i)}}var w=n(245),k=n(244),L=n(243),S=n(242);class T{constructor(t,e){this.width=t||0,this.height=e||0}isReal(){return isFinite(this.width)&&isFinite(this.height)}toString(){return`Size(${this.width} ${this.height})`}}var Y,D=n(241),C=n(240),E=n(239);!function(t){t[t.Normal=0]="Normal",t[t.Offline=1]="Offline",t[t.Unbind=2]="Unbind",t[t.Abnormal=3]="Abnormal",t[t.Loading=4]="Loading",t[t.Disable=9]="Disable"}(Y||(Y={}));var A=n(238);n.d(e,"l",function(){return i}),n.d(e,"b",function(){return a.BitCondition}),n.d(e,"c",function(){return r}),n.d(e,"p",function(){return o.WordCondition}),n.d(e,"e",function(){return s}),n.d(e,"g",function(){return x}),n.d(e,"f",function(){return w.ConditionItemModel}),n.d(e,"d",function(){return k.ConditionControlResultValue}),n.d(e,"i",function(){return L.Font}),n.d(e,"o",function(){return S.Text}),n.d(e,"m",function(){return T}),n.d(e,"k",function(){return D.Point}),n.d(e,"j",function(){return C.GraphSetting}),n.d(e,"h",function(){return E.CustomStyle}),n.d(e,"n",function(){return Y}),n.d(e,"a",function(){return A.ArcModel})},function(t,e,n){"use strict";var i=n(17),r=n(0),a=n(266),o=function(){function t(t,e){this.open=t,this.close=e||t}return t.prototype.isManual=function(){return"manual"===this.open||"manual"===this.close},t}();var s={hover:["mouseover","mouseout"],focus:["focusin","focusout"]};function l(t,e){void 0===e&&(e=s);var n=(t||"").trim();if(0===n.length)return[];var i=n.split(/\s+/).map(function(t){return t.split(":")}).map(function(t){var n=e[t[0]]||t;return new o(n[0],n[1])}),r=i.filter(function(t){return t.isManual()});if(r.length>1)throw new Error("Triggers parse error: only one manual trigger is allowed");if(1===r.length&&i.length>1)throw new Error("Triggers parse error: manual trigger can't be mixed with other triggers");return i}
|
|
25
25
|
/**
|
|
26
26
|
* @license
|
|
27
27
|
* Copyright Google Inc. All Rights Reserved.
|